{
  "version": 3,
  "sources": ["../../../../../node_modules/draft-js/node_modules/immutable/dist/immutable.js", "../../../../../node_modules/draft-js/lib/BlockMapBuilder.js", "../../../../../node_modules/draft-js/lib/CharacterMetadata.js", "../../../../../node_modules/draft-js/lib/findRangesImmutable.js", "../../../../../node_modules/draft-js/lib/ContentBlock.js", "../../../../../node_modules/draft-js/lib/ContentBlockNode.js", "../../../../../node_modules/draft-js/lib/ContentStateInlineStyle.js", "../../../../../node_modules/draft-js/lib/applyEntityToContentBlock.js", "../../../../../node_modules/draft-js/lib/applyEntityToContentState.js", "../../../../../node_modules/draft-js/lib/DraftEntitySegments.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/invariant.js", "../../../../../node_modules/draft-js/lib/getRangesForDraftEntity.js", "../../../../../node_modules/draft-js/lib/getCharacterRemovalRange.js", "../../../../../node_modules/draft-js/lib/generateRandomKey.js", "../../../../../node_modules/draft-js/lib/randomizeBlockMapKeys.js", "../../../../../node_modules/draft-js/lib/removeEntitiesAtEdges.js", "../../../../../node_modules/draft-js/lib/getContentStateFragment.js", "../../../../../node_modules/draft-js/lib/insertIntoList.js", "../../../../../node_modules/draft-js/lib/insertFragmentIntoContentState.js", "../../../../../node_modules/draft-js/lib/insertTextIntoContentState.js", "../../../../../node_modules/draft-js/lib/modifyBlockForContentState.js", "../../../../../node_modules/draft-js/lib/getNextDelimiterBlockKey.js", "../../../../../node_modules/draft-js/lib/removeRangeFromContentState.js", "../../../../../node_modules/draft-js/lib/splitBlockInContentState.js", "../../../../../node_modules/draft-js/lib/DraftModifier.js", "../../../../../node_modules/draft-js/lib/BlockTree.js", "../../../../../node_modules/draft-js/lib/DraftEntityInstance.js", "../../../../../node_modules/draft-js/lib/DraftEntity.js", "../../../../../node_modules/draft-js/lib/SelectionState.js", "../../../../../node_modules/draft-js/lib/gkx.js", "../../../../../node_modules/draft-js/lib/sanitizeDraftText.js", "../../../../../node_modules/draft-js/lib/ContentState.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/UnicodeBidiDirection.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/UnicodeBidi.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/UnicodeBidiService.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/nullthrows.js", "../../../../../node_modules/draft-js/lib/EditorBidiService.js", "../../../../../node_modules/draft-js/lib/EditorState.js", "../../../../../node_modules/draft-js/lib/moveBlockInContentState.js", "../../../../../node_modules/draft-js/lib/AtomicBlockUtils.js", "../../../../../node_modules/draft-js/lib/CompositeDraftDecorator.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/cx.js", "../../../../../node_modules/draft-js/lib/DefaultDraftBlockRenderMap.js", "../../../../../node_modules/draft-js/lib/DefaultDraftInlineStyle.js", "../../../../../node_modules/ua-parser-js/src/ua-parser.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/UserAgentData.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/VersionRange.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/mapObject.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/memoizeStringOnly.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/UserAgent.js", "../../../../../node_modules/draft-js/lib/getCorrectDocumentFromNode.js", "../../../../../node_modules/draft-js/lib/isElement.js", "../../../../../node_modules/draft-js/lib/getSelectionOffsetKeyForNode.js", "../../../../../node_modules/draft-js/lib/findAncestorOffsetKey.js", "../../../../../node_modules/draft-js/lib/getWindowForNode.js", "../../../../../node_modules/draft-js/lib/DOMObserver.js", "../../../../../node_modules/draft-js/lib/DraftOffsetKey.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/Keys.js", "../../../../../node_modules/draft-js/lib/DraftJsDebugLogging.js", "../../../../../node_modules/draft-js/lib/isHTMLElement.js", "../../../../../node_modules/draft-js/lib/getContentEditableContainer.js", "../../../../../node_modules/draft-js/lib/getUpdatedSelectionState.js", "../../../../../node_modules/draft-js/lib/getDraftEditorSelectionWithNodes.js", "../../../../../node_modules/draft-js/lib/getDraftEditorSelection.js", "../../../../../node_modules/draft-js/lib/editOnSelect.js", "../../../../../node_modules/draft-js/lib/getEntityKeyForSelection.js", "../../../../../node_modules/draft-js/lib/DraftEditorCompositionHandler.js", "../../../../../node_modules/draft-js/lib/DraftEditorDecoratedLeaves.react.js", "../../../../../node_modules/draft-js/lib/DraftEditorTextNode.react.js", "../../../../../node_modules/draft-js/lib/DraftEffects.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/isNode.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/isTextNode.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/containsNode.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/getActiveElement.js", "../../../../../node_modules/draft-js/lib/setDraftEditorSelection.js", "../../../../../node_modules/draft-js/lib/DraftEditorLeaf.react.js", "../../../../../node_modules/draft-js/lib/DraftEditorNode.react.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/Scroll.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/camelize.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/hyphenate.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/getStyleProperty.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/Style.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/getElementRect.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/getElementPosition.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/getDocumentScrollElement.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/getUnboundedScrollPosition.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/getScrollPosition.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/getViewportDimensions.js", "../../../../../node_modules/draft-js/lib/DraftEditorBlockNode.react.js", "../../../../../node_modules/draft-js/lib/DraftEditorContentsExperimental.react.js", "../../../../../node_modules/draft-js/lib/DraftEditorBlock.react.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/joinClasses.js", "../../../../../node_modules/draft-js/lib/DraftEditorContents-core.react.js", "../../../../../node_modules/draft-js/lib/DraftEditorContents.react.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/PhotosMimeType.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/createArrayFromMixed.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/emptyFunction.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/DataTransfer.js", "../../../../../node_modules/draft-js/lib/getTextContentFromFiles.js", "../../../../../node_modules/draft-js/lib/isEventHandled.js", "../../../../../node_modules/draft-js/lib/DraftEditorDragHandler.js", "../../../../../node_modules/draft-js/lib/isSelectionAtLeafStart.js", "../../../../../node_modules/setimmediate/setImmediate.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/setImmediate.js", "../../../../../node_modules/draft-js/lib/editOnBeforeInput.js", "../../../../../node_modules/draft-js/lib/editOnBlur.js", "../../../../../node_modules/draft-js/lib/editOnCompositionStart.js", "../../../../../node_modules/draft-js/lib/getFragmentFromSelection.js", "../../../../../node_modules/draft-js/lib/editOnCopy.js", "../../../../../node_modules/draft-js/lib/isInstanceOfNode.js", "../../../../../node_modules/draft-js/lib/editOnCut.js", "../../../../../node_modules/draft-js/lib/editOnDragOver.js", "../../../../../node_modules/draft-js/lib/editOnDragStart.js", "../../../../../node_modules/draft-js/lib/editOnFocus.js", "../../../../../node_modules/draft-js/lib/draftKeyUtils.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/UnicodeUtils.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/warning.js", "../../../../../node_modules/draft-js/lib/moveSelectionBackward.js", "../../../../../node_modules/draft-js/lib/removeTextWithStrategy.js", "../../../../../node_modules/draft-js/lib/keyCommandPlainBackspace.js", "../../../../../node_modules/draft-js/lib/editOnInput.js", "../../../../../node_modules/draft-js/lib/isSoftNewlineEvent.js", "../../../../../node_modules/draft-js/lib/KeyBindingUtil.js", "../../../../../node_modules/draft-js/lib/SecondaryClipboard.js", "../../../../../node_modules/draft-js/lib/getRangeClientRects.js", "../../../../../node_modules/draft-js/lib/expandRangeToStartOfLine.js", "../../../../../node_modules/draft-js/lib/keyCommandBackspaceToStartOfLine.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/TokenizeUtil.js", "../../../../../node_modules/draft-js/lib/DraftRemovableWord.js", "../../../../../node_modules/draft-js/lib/keyCommandBackspaceWord.js", "../../../../../node_modules/draft-js/lib/moveSelectionForward.js", "../../../../../node_modules/draft-js/lib/keyCommandDeleteWord.js", "../../../../../node_modules/draft-js/lib/keyCommandInsertNewline.js", "../../../../../node_modules/draft-js/lib/keyCommandMoveSelectionToEndOfBlock.js", "../../../../../node_modules/draft-js/lib/keyCommandMoveSelectionToStartOfBlock.js", "../../../../../node_modules/draft-js/lib/keyCommandPlainDelete.js", "../../../../../node_modules/draft-js/lib/keyCommandTransposeCharacters.js", "../../../../../node_modules/draft-js/lib/keyCommandUndo.js", "../../../../../node_modules/draft-js/lib/editOnKeyDown.js", "../../../../../node_modules/draft-js/node_modules/fbjs/lib/URI.js", "../../../../../node_modules/draft-js/lib/getSafeBodyFromHTML.js", "../../../../../node_modules/draft-js/lib/isHTMLAnchorElement.js", "../../../../../node_modules/draft-js/lib/isHTMLBRElement.js", "../../../../../node_modules/draft-js/lib/isHTMLImageElement.js", "../../../../../node_modules/draft-js/lib/convertFromHTMLToContentBlocks.js", "../../../../../node_modules/draft-js/lib/DraftPasteProcessor.js", "../../../../../node_modules/draft-js/lib/adjustBlockDepthForContentState.js", "../../../../../node_modules/draft-js/lib/RichTextEditorUtil.js", "../../../../../node_modules/draft-js/lib/splitTextIntoTextBlocks.js", "../../../../../node_modules/draft-js/lib/editOnPaste.js", "../../../../../node_modules/draft-js/lib/DraftEditorEditHandler.js", "../../../../../node_modules/draft-js/lib/DraftEditorPlaceholder.react.js", "../../../../../node_modules/draft-js/lib/getDefaultKeyBinding.js", "../../../../../node_modules/draft-js/lib/DraftEditor.react.js", "../../../../../node_modules/draft-js/lib/RawDraftContentState.js", "../../../../../node_modules/draft-js/lib/DraftStringKey.js", "../../../../../node_modules/draft-js/lib/encodeEntityRanges.js", "../../../../../node_modules/draft-js/lib/encodeInlineStyleRanges.js", "../../../../../node_modules/draft-js/lib/convertFromDraftStateToRaw.js", "../../../../../node_modules/draft-js/lib/DraftTreeAdapter.js", "../../../../../node_modules/draft-js/lib/DraftTreeInvariants.js", "../../../../../node_modules/draft-js/lib/createCharacterList.js", "../../../../../node_modules/draft-js/lib/decodeEntityRanges.js", "../../../../../node_modules/draft-js/lib/decodeInlineStyleRanges.js", "../../../../../node_modules/draft-js/lib/convertFromRawToDraftState.js", "../../../../../node_modules/draft-js/lib/getRangeBoundingClientRect.js", "../../../../../node_modules/draft-js/lib/getVisibleSelectionRect.js", "../../../../../node_modules/draft-js/lib/Draft.js", "../../../../../node_modules/immutable/dist/immutable.js", "../../../../../node_modules/bezier-js/lib/utils.js", "../../../../../node_modules/bezier-js/lib/poly-bezier.js", "../../../../../node_modules/bezier-js/lib/normalise-svg.js", "../../../../../node_modules/bezier-js/lib/svg-to-beziers.js", "../../../../../node_modules/bezier-js/lib/bezier.js", "../../../../../node_modules/bezier-js/index.js", "../../src/document/models/CanvasTree/traits/WithPins.ts", "../../src/document/models/CanvasTree/traits/WithFill.ts", "../../src/document/utils/CollectionItemVariables.ts", "../../src/utils/collectionReferenceUtils.ts", "../../src/document/components/chrome/insertSidebar/dataSources/withPublishedModulePrefix.ts", "../../src/utils/moduleComponents.ts", "../../src/document/components/chrome/insertSidebar/types.ts", "../../src/document/components/chrome/insertSidebar/dataSources/items/codeBlockItem.ts", "../../src/document/components/chrome/insertSidebar/dataSources/items/twitterItem.ts", "../../src/document/components/chrome/insertSidebar/dataSources/items/vimeoItem.ts", "../../src/document/components/chrome/insertSidebar/dataSources/items/youtubeItem.ts", "../../src/prosemirror/schema/module.ts", "../../src/code-generation/utils/createFramerClassName.ts", "../../src/prosemirror/schema/utils.ts", "../../src/prosemirror/schema/backgroundMask.ts", "../../src/prosemirror/schema/backgroundStyles.ts", "../../../../../node_modules/@handlewithcare/remark-prosemirror/lib/mdast-util-from-prosemirror.js", "../../src/prosemirror/schema/blockquote.ts", "../../src/prosemirror/schema/bold.ts", "../../src/prosemirror/schema/doc.ts", "../../src/utils/tryParseNumber.ts", "../../../../shared/src/ssg/canonicalURLForPath.ts", "../../src/document/models/CanvasTree/nodes/utils/getVariableValue.ts", "../../src/utils/collectionSlugUtils.ts", "../../src/utils/getLinkToWebPageFromPath.ts", "../../src/utils/resolveLink.ts", "../../src/prosemirror/schema/link.ts", "../../src/prosemirror/schema/image.ts", "../../../../../node_modules/unist-util-map/lib/index.js", "../../src/prosemirror/schema/inlineCode.ts", "../../src/prosemirror/schema/inlineStyles.ts", "../../src/prosemirror/schema/italic.ts", "../../src/prosemirror/schema/lineBreak.ts", "../../src/prosemirror/schema/textBlock.ts", "../../src/prosemirror/schema/list.ts", "../../../../../node_modules/prosemirror-tables/dist/index.js", "../../src/prosemirror/schema/table.ts", "../../src/prosemirror/schema/text.ts", "../../src/prosemirror/schema/index.ts", "../../src/prosemirror/serialization/dom.ts", "../../src/document/models/CanvasTree/traits/utils/doesDimensionFitImage.ts", "../../src/document/models/CanvasTree/traits/WithGridItemSize.ts", "../../src/document/models/CanvasTree/traits/WithSizeDimensionType.ts", "../../src/document/models/StyledText/DraftEditor.ts", "../../src/prosemirror/inflateStyles.ts", "../../src/prosemirror/plugins/inflateStylesPlugin.ts", "../../src/prosemirror/plugins/textDirectionPlugin.ts", "../../src/prosemirror/editorState.ts", "../../src/prosemirror/patching.ts", "../../src/utils/deepClone.ts", "../../src/document/models/StyledText/StyledTextDraft.ts", "../../src/document/models/StyledText/StyledText.ts", "../../src/document/models/CanvasTree/traits/WithCodeOverride.ts", "../../src/document/models/CanvasTree/traits/WithPluginData.ts", "../../src/document/models/CanvasTree/traits/WithReplicaVariants.ts", "../../src/document/models/CanvasTree/traits/WithRichText.ts", "../../src/document/models/CanvasTree/traits/WithStyledText.ts", "../../src/document/models/CanvasTree/traits/WithVariableBinding.ts", "../../src/document/models/CanvasTree/traits/WithComponentPresets.ts", "../../src/document/models/CanvasTree/utils/isPrefixedKey.ts", "../../../../../node_modules/deep-object-diff/mjs/utils.js", "../../../../../node_modules/deep-object-diff/mjs/diff.js", "../../src/document/models/CanvasTree/nodes/utils/extractRichTextOverrideKeys.ts", "../../src/document/models/CanvasTree/nodes/TemplateHelper.ts", "../../src/document/models/CanvasTree/traits/forms/WithFormContainer.ts", "../../src/document/models/CanvasTree/traits/WithFrameEvents.ts", "../../src/document/models/CanvasTree/traits/forms/WithFormInputEvents.ts", "../../src/document/models/CanvasTree/actions/actions.ts", "../../src/document/models/CanvasTree/actions/overlayActions.ts", "../../src/document/components/utils/breakpointVariantDefaults.ts", "../../src/document/models/CanvasTree/traits/WithTriggerActions.ts", "../../src/document/models/CanvasTree/traits/WithAspectRatio.ts", "../../src/document/models/CanvasTree/traits/WithSizeConstraints.ts", "../../src/document/models/CanvasTree/traits/WithViewport.ts", "../../src/document/models/CanvasTree/traits/utils/viewportHelpers.ts", "../../src/document/models/CanvasTree/nodes/utils/overlayHelpers.ts", "../../src/document/models/CanvasTree/traits/WithItemsOrder.ts", "../../src/document/models/CanvasTree/traits/WithVisibility.ts", "../../src/document/models/FramePoint.ts", "../../src/document/models/Matrix.ts", "../../src/document/models/CanvasTree/traits/WithFilters.ts", "../../src/document/models/CanvasTree/traits/WithOpacity.ts", "../../src/document/models/CanvasTree/traits/WithTransforms.ts", "../../src/document/models/CanvasTree/traits/WithPositionType.ts", "../../src/document/models/CanvasTree/traits/utils/positionTypeHelpers.ts", "../../src/document/models/CanvasTree/utils/geometry.ts", "../../src/code-generation/utils/isOnlyVisibleInCurrentVariant.ts", "../../src/document/components/chrome/localization/getNameForDefaultLocale.ts", "../../src/document/models/CanvasTree/traits/utils/EagerVariableProviderMap.ts", "../../src/document/utils/getLayoutDirectionValue.ts", "../../src/utils/getDataIdentifierAndEnumFieldKeyForControl.ts", "../../src/document/utils/LocaleVariable.ts", "../../src/document/models/CanvasTree/traits/Generated.ts", "../../src/document/models/CanvasTree/traits/VariableProvider.ts", "../../src/utils/serializedWebPageLink.ts", "../../src/utils/serializedValueToVariableValue.ts", "../../src/document/models/CanvasTree/nodes/DataSourceValueMap.ts", "../../src/utils/collectionNames.ts", "../../src/utils/variableMetadata.ts", "../../src/document/models/controlProps/CollectionControlType.ts", "../../src/document/models/controlProps/CollectionControlDescription.ts", "../../src/document/models/CanvasTree/nodes/utils/getVariableFromControlDescription.ts", "../../src/document/models/CanvasTree/nodes/utils/LazyVariableMapFromControlMap.ts", "../../src/document/models/CanvasTree/nodes/utils/getDataSourceVariablesFromDataDefinition.ts", "../../src/document/models/CanvasTree/nodes/CanvasNodeCache.ts", "../../src/document/models/CanvasTree/nodes/CanvasNode.ts", "../../src/app/GlobalErrorHandler.ts", "../../src/document/models/CanvasTree/traits/WithScopeLoader.ts", "../../src/document/models/CanvasTree/nodes/ScopeNode.ts", "../../src/document/models/CanvasTree/traits/WithChildren.ts", "../../src/document/stores/ToolEnum.ts", "../../src/document/models/CanvasTree/traits/WithVectorSetItem.ts", "../../src/document/models/CanvasTree/traits/WithShape.ts", "../../src/document/models/CanvasTree/actions/triggerEventActions.ts", "../../src/document/models/CanvasTree/traits/WithLink.ts", "../../src/document/models/CanvasTree/nodes/utils/moduleIdentifierToLocalComponentId.ts", "../../src/document/models/CanvasTree/nodes/utils/smartComponentInstanceHelpers.ts", "../../src/document/models/CanvasTree/traits/WithHTMLTag.ts", "../../src/document/models/CanvasTree/traits/WithFormVariants.ts", "../../src/document/models/CanvasTree/traits/WithIntrinsicSize.ts", "../../src/document/models/CanvasTree/traits/WithCollectionOptions.ts", "../../src/document/models/CanvasTree/traits/WithFlowEffect.ts", "../../src/code-generation/utils/annotations.ts", "../../../../../node_modules/@framerjs/framer-events/lib/esm/generated/EventActionCreateConsoleLog.js", "../../../../../node_modules/@framerjs/framer-events/lib/esm/generated/EventActionCreateCustom.js", "../../../../../node_modules/@framerjs/framer-events/lib/esm/generated/EventActionCreateNavigate.js", "../../../../../node_modules/@framerjs/framer-events/lib/esm/generated/EventActionCreateOpenUrl.js", "../../../../../node_modules/@framerjs/framer-events/lib/esm/generated/EventActionUpdateConsoleLog.js", "../../../../../node_modules/@framerjs/framer-events/lib/esm/generated/EventActionUpdateCustom.js", "../../../../../node_modules/@framerjs/framer-events/lib/esm/generated/EventActionUpdateNavigate.js", "../../../../../node_modules/@framerjs/framer-events/lib/esm/generated/EventActionUpdateOpenUrl.js", "../../src/document/models/CanvasTree/nodes/ExternalModuleNode.ts", "../../src/document/utils/getNormalizedAssetNamePath.ts", "../../src/document/utils/assetPath.ts", "../../src/document/models/CanvasTree/nodes/LocalModuleNode.ts", "../../src/document/components/chrome/shared/VariablesModal/getSelectedVariableInfo.ts", "../../src/utils/compareStringsNaturally.ts", "../../src/utils/vectorSets.ts", "../../src/document/models/CanvasTree/nodes/MergedVariableProviderMap.ts", "../../src/document/utils/RepeaterVariables.ts", "../../src/code-generation/variantDetails.ts", "../../src/document/models/CanvasTree/nodes/utils/unsafeGetParent.ts", "../../src/document/models/CanvasTree/nodes/utils/isStackOrGridChild.ts", "../../src/document/models/CanvasTree/nodes/utils/nodeLayoutDependsOnParent.ts", "../../src/document/models/CanvasTree/traits/utils/autoSizeHelpers.ts", "../../src/document/models/CanvasTree/traits/WithPosition.ts", "../../src/document/models/CanvasTree/utils/getGroundNodeRect.ts", "../../src/document/models/CanvasTree/traits/utils/layoutSupportsAspectRatio.ts", "../../src/document/models/CanvasTree/traits/mixins/withDOMLayoutTrait.ts", "../../src/document/models/CanvasTree/traits/WithBorder.ts", "../../src/document/models/CanvasTree/traits/utils/borderForNode.ts", "../../src/document/models/CanvasTree/traits/utils/collectNameForNode.ts", "../../src/document/models/ConstraintSolver.ts", "../../src/document/models/controlProps/linkSlotContentChanges.ts", "../../src/document/models/CanvasTree/traits/WithBoxShadowDefaults.ts", "../../src/document/models/CanvasTree/traits/WithExport.ts", "../../src/document/models/CanvasTree/traits/WithFillDefaults.ts", "../../src/document/models/CanvasTree/traits/WithCustomizations.ts", "../../src/document/models/CanvasTree/actions/navigationActions.ts", "../../src/document/components/chrome/properties/panels/utils/eventActionTracking.ts", "../../src/document/models/CanvasTree/traits/WithEventActions.ts", "../../src/document/components/chrome/properties/utils/eventActions.ts", "../../src/utils/isKeySetAndNotInherited.ts", "../../src/document/models/CanvasTree/actions/paginationActions.ts", "../../src/document/models/CanvasTree/traits/WithDataLoaderVariants.ts", "../../src/document/models/CanvasTree/traits/WithDragEffect.ts", "../../src/document/models/CanvasTree/traits/WithDraggable.ts", "../../src/document/models/CanvasTree/traits/WithKitSectionHash.ts", "../../src/document/models/CanvasTree/traits/WithKitSectionSource.ts", "../../src/document/models/CanvasTree/traits/WithLock.ts", "../../src/document/models/CanvasTree/traits/WithLoopEffect.ts", "../../src/document/models/GradientColorStop.ts", "../../src/document/models/CanvasTree/traits/WithMasks.ts", "../../src/document/models/CanvasTree/traits/WithName.ts", "../../src/document/models/CanvasTree/traits/WithParallax.ts", "../../src/document/models/CanvasTree/traits/WithPreviewSettings.ts", "../../src/document/models/CanvasTree/traits/WithRotation.ts", "../../src/document/models/CanvasTree/traits/utils/EffectTrigger.ts", "../../src/document/models/CanvasTree/traits/utils/getEffectRotate.ts", "../../src/document/models/CanvasTree/traits/WithStyleAppearEffect.ts", "../../src/document/models/CanvasTree/traits/WithStyleTransformEffect.ts", "../../src/document/models/CanvasTree/traits/WithTokenOverrides.ts", "../../src/document/models/CanvasTree/traits/WithTransition.ts", "../../src/document/models/CanvasTree/traits/WithVariantAppearEffect.ts", "../../src/document/models/CanvasTree/traits/WithViewTransitionNone.ts", "../../src/document/models/CanvasTree/traits/WithWhileHover.ts", "../../src/document/models/CanvasTree/traits/WithWhileOpenEffect.ts", "../../src/document/models/CanvasTree/traits/WithWhileTap.ts", "../../src/document/models/CanvasTree/records/memoRecord.ts", "../../src/document/models/CanvasTree/records/CodeComponentRecord.ts", "../../src/document/models/CanvasTree/traits/collectProps/collectCanvasFloatingPosition.ts", "../../src/document/models/CanvasTree/traits/collectProps/collectGroundNodeLayout.ts", "../../src/code-generation/components/GeneratedVariantComponentVars.ts", "../../src/code-generation/js/jsxTypes.ts", "../../src/code-generation/js/SerializableValue.ts", "../../src/utils/getFirstItemFromIterable.ts", "../../src/code-generation/utils/toCSSCustomPropertyName.ts", "../../src/code-generation/utils/CSSVariableDefinitionCollector.ts", "../../src/code-generation/utils/DeclarationCollector.ts", "../../src/code-generation/utils/VariableCollector.ts", "../../src/document/models/CanvasTree/traits/utils/cssValues.ts", "../../src/document/components/chrome/properties/panels/types.ts", "../../src/document/models/CanvasTree/traits/utils/getCSSDeclarationBlock.ts", "../../src/code-generation/jsx/svg/svgContext.ts", "../../src/code-generation/jsx/svg/fills.ts", "../../src/document/models/CanvasTree/traits/WithStroke.ts", "../../src/document/models/Path.ts", "../../src/document/models/CanvasTree/utils/reverseSegment.ts", "../../src/document/models/CanvasTree/traits/WithStrokeEffect.ts", "../../src/code-generation/jsx/svg/effects.ts", "../../src/code-generation/jsx/svg/shadows.ts", "../../src/code-generation/jsx/svg/transforms.ts", "../../src/code-generation/jsx/svg/visibility.ts", "../../src/code-generation/jsx/svg/svgForNode.ts", "../../src/document/models/CanvasTree/traits/collectProps/collectMasks.ts", "../../src/document/models/CanvasTree/traits/collectProps/collectPositionType.ts", "../../src/code-generation/js/jsdoc.ts", "../../src/code-generation/components/shared.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectAspectRatio.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectBlending.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectPosition.ts", "../../src/document/models/CanvasTree/traits/utils/getStaggerValueForNode.ts", "../../src/document/models/CanvasTree/traits/utils/calculateCumulativeStaggerDelay.ts", "../../src/document/models/CanvasTree/traits/utils/createStaggerTransition.ts", "../../src/document/components/chrome/properties/panels/getInitialBoxShadowValueFromReducedShadows.ts", "../../src/document/models/CanvasTree/traits/WithLightboxEffect.ts", "../../src/document/models/CanvasTree/traits/WithTextEffect.ts", "../../src/document/models/CanvasTree/traits/utils/effects.ts", "../../src/document/models/CanvasTree/traits/collectProps/collectLightboxEffect.ts", "../../src/document/models/CanvasTree/traits/WithTextContent.ts", "../../src/document/models/CanvasTree/nodes/utils/isAnyTextNode.ts", "../../src/document/models/CanvasTree/traits/utils/sizeValue.ts", "../../src/document/models/CanvasTree/traits/utils/newConstraintProperties.ts", "../../src/document/models/CanvasTree/traits/utils/needsMinSize.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectStackAndGridAutoSize.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectStackItemLayout.ts", "../../src/document/models/CanvasTree/traits/WithTextTruncation.ts", "../../src/document/models/CanvasTree/traits/WithTextFit.ts", "../../src/document/models/CanvasTree/traits/WithTextWrapBalance.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectTextWrap.ts", "../../src/document/models/CanvasTree/traits/utils/tickerItemFractionalUnitFallback.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectTickerItemLayoutOverrides.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectLayout.ts", "../../src/document/models/CanvasTree/traits/utils/getFallbackPerspective.ts", "../../src/document/models/CanvasTree/traits/utils/supportsAppearEffectOptimization.ts", "../../src/document/models/CanvasTree/traits/collectProps/collectOptimizedMotionProps.ts", "../../src/document/models/CanvasTree/traits/collectProps/collectMotionExit.ts", "../../src/document/models/CanvasTree/traits/collectProps/collectEffects.ts", "../../src/document/models/CanvasTree/traits/collectProps/collectLoopEffect.ts", "../../src/document/models/CanvasTree/traits/collectProps/collectMotionWhileHover.ts", "../../src/document/models/CanvasTree/traits/collectProps/collectMotionWhileTap.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectEphemeralEffectPreviewStyle.ts", "../../src/document/models/CanvasTree/traits/utils/getFilterBlurForBoxBlur.ts", "../../src/document/models/CanvasTree/traits/WithSVG.ts", "../../src/document/models/CanvasTree/traits/utils/wantsFilterShadow.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectFilters.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectGridItemLayout.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectMoveToolRootFontSize.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectOpacity.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectPointerEvents.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectRotate.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectSizeConstraints.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectTextTruncation.ts", "../../src/document/models/ConicGradientClass.ts", "../../src/document/models/LinearGradientClass.ts", "../../src/document/models/RadialGradientClass.ts", "../../src/document/models/Gradient.ts", "../../src/document/models/CanvasTree/utils/resolveColor.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectBackgroundFill.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectBackgroundFilters.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectBoxShadow.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectOverflow.ts", "../../src/document/models/CanvasTree/traits/WithParagraphSpacing.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectParagraphSpacing.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectRichTextVariables.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectTextShadow.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectTransforms.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectStyle.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectTokenOverrides.ts", "../../src/document/models/CanvasTree/traits/collectStyles/collectZIndex.ts", "../../src/document/models/CanvasTree/traits/mixins/with3DTransformsTrait.ts", "../../src/document/models/CanvasTree/traits/mixins/withControlPropsTrait.ts", "../../src/document/models/CanvasTree/traits/mixins/withPinsSizeRatioConstraints.ts", "../../src/document/models/CanvasTree/traits/utils/fixedSizeHelpers.ts", "../../src/document/models/CanvasTree/traits/utils/createBackgroundImage.ts", "../../src/document/models/CanvasTree/traits/utils/collectBackgroundForNode.ts", "../../src/document/models/CanvasTree/traits/utils/getArrayProviderNodeInAncestorScope.ts", "../../src/document/models/CanvasTree/utils/getStyleForSupportedLayout.ts", "../../src/document/models/CanvasTree/nodes/getArraySourceVariablesFromControlDescription.ts", "../../src/document/models/CanvasTree/nodes/ArraySourceVariableProviderCache.ts", "../../src/document/models/CanvasTree/nodes/RawControlPropsCache.ts", "../../src/document/models/CanvasTree/nodes/CodeComponentNodeCache.ts", "../../src/document/models/CanvasTree/nodes/CodeComponentNode.ts", "../../src/document/models/controlProps/filterComponentPresetControls.ts", "../../src/document/utils/parseGradient.ts"],
  "sourcesContent": ["/**\n *  Copyright (c) 2014-2015, Facebook, Inc.\n *  All rights reserved.\n *\n *  This source code is licensed under the BSD-style license found in the\n *  LICENSE file in the root directory of this source tree. An additional grant\n *  of patent rights can be found in the PATENTS file in the same directory.\n */\n\n(function (global, factory) {\n  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n  typeof define === 'function' && define.amd ? define(factory) :\n  global.Immutable = factory();\n}(this, function () { 'use strict';var SLICE$0 = Array.prototype.slice;\n\n  function createClass(ctor, superClass) {\n    if (superClass) {\n      ctor.prototype = Object.create(superClass.prototype);\n    }\n    ctor.prototype.constructor = ctor;\n  }\n\n  function Iterable(value) {\n      return isIterable(value) ? value : Seq(value);\n    }\n\n\n  createClass(KeyedIterable, Iterable);\n    function KeyedIterable(value) {\n      return isKeyed(value) ? value : KeyedSeq(value);\n    }\n\n\n  createClass(IndexedIterable, Iterable);\n    function IndexedIterable(value) {\n      return isIndexed(value) ? value : IndexedSeq(value);\n    }\n\n\n  createClass(SetIterable, Iterable);\n    function SetIterable(value) {\n      return isIterable(value) && !isAssociative(value) ? value : SetSeq(value);\n    }\n\n\n\n  function isIterable(maybeIterable) {\n    return !!(maybeIterable && maybeIterable[IS_ITERABLE_SENTINEL]);\n  }\n\n  function isKeyed(maybeKeyed) {\n    return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL]);\n  }\n\n  function isIndexed(maybeIndexed) {\n    return !!(maybeIndexed && maybeIndexed[IS_INDEXED_SENTINEL]);\n  }\n\n  function isAssociative(maybeAssociative) {\n    return isKeyed(maybeAssociative) || isIndexed(maybeAssociative);\n  }\n\n  function isOrdered(maybeOrdered) {\n    return !!(maybeOrdered && maybeOrdered[IS_ORDERED_SENTINEL]);\n  }\n\n  Iterable.isIterable = isIterable;\n  Iterable.isKeyed = isKeyed;\n  Iterable.isIndexed = isIndexed;\n  Iterable.isAssociative = isAssociative;\n  Iterable.isOrdered = isOrdered;\n\n  Iterable.Keyed = KeyedIterable;\n  Iterable.Indexed = IndexedIterable;\n  Iterable.Set = SetIterable;\n\n\n  var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';\n  var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';\n  var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@';\n  var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';\n\n  // Used for setting prototype methods that IE8 chokes on.\n  var DELETE = 'delete';\n\n  // Constants describing the size of trie nodes.\n  var SHIFT = 5; // Resulted in best performance after ______?\n  var SIZE = 1 << SHIFT;\n  var MASK = SIZE - 1;\n\n  // A consistent shared value representing \"not set\" which equals nothing other\n  // than itself, and nothing that could be provided externally.\n  var NOT_SET = {};\n\n  // Boolean references, Rough equivalent of `bool &`.\n  var CHANGE_LENGTH = { value: false };\n  var DID_ALTER = { value: false };\n\n  function MakeRef(ref) {\n    ref.value = false;\n    return ref;\n  }\n\n  function SetRef(ref) {\n    ref && (ref.value = true);\n  }\n\n  // A function which returns a value representing an \"owner\" for transient writes\n  // to tries. The return value will only ever equal itself, and will not equal\n  // the return of any subsequent call of this function.\n  function OwnerID() {}\n\n  // http://jsperf.com/copy-array-inline\n  function arrCopy(arr, offset) {\n    offset = offset || 0;\n    var len = Math.max(0, arr.length - offset);\n    var newArr = new Array(len);\n    for (var ii = 0; ii < len; ii++) {\n      newArr[ii] = arr[ii + offset];\n    }\n    return newArr;\n  }\n\n  function ensureSize(iter) {\n    if (iter.size === undefined) {\n      iter.size = iter.__iterate(returnTrue);\n    }\n    return iter.size;\n  }\n\n  function wrapIndex(iter, index) {\n    // This implements \"is array index\" which the ECMAString spec defines as:\n    //\n    //     A String property name P is an array index if and only if\n    //     ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal\n    //     to 2^32\u22121.\n    //\n    // http://www.ecma-international.org/ecma-262/6.0/#sec-array-exotic-objects\n    if (typeof index !== 'number') {\n      var uint32Index = index >>> 0; // N >>> 0 is shorthand for ToUint32\n      if ('' + uint32Index !== index || uint32Index === 4294967295) {\n        return NaN;\n      }\n      index = uint32Index;\n    }\n    return index < 0 ? ensureSize(iter) + index : index;\n  }\n\n  function returnTrue() {\n    return true;\n  }\n\n  function wholeSlice(begin, end, size) {\n    return (begin === 0 || (size !== undefined && begin <= -size)) &&\n      (end === undefined || (size !== undefined && end >= size));\n  }\n\n  function resolveBegin(begin, size) {\n    return resolveIndex(begin, size, 0);\n  }\n\n  function resolveEnd(end, size) {\n    return resolveIndex(end, size, size);\n  }\n\n  function resolveIndex(index, size, defaultIndex) {\n    return index === undefined ?\n      defaultIndex :\n      index < 0 ?\n        Math.max(0, size + index) :\n        size === undefined ?\n          index :\n          Math.min(size, index);\n  }\n\n  /* global Symbol */\n\n  var ITERATE_KEYS = 0;\n  var ITERATE_VALUES = 1;\n  var ITERATE_ENTRIES = 2;\n\n  var REAL_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;\n  var FAUX_ITERATOR_SYMBOL = '@@iterator';\n\n  var ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL;\n\n\n  function Iterator(next) {\n      this.next = next;\n    }\n\n    Iterator.prototype.toString = function() {\n      return '[Iterator]';\n    };\n\n\n  Iterator.KEYS = ITERATE_KEYS;\n  Iterator.VALUES = ITERATE_VALUES;\n  Iterator.ENTRIES = ITERATE_ENTRIES;\n\n  Iterator.prototype.inspect =\n  Iterator.prototype.toSource = function () { return this.toString(); }\n  Iterator.prototype[ITERATOR_SYMBOL] = function () {\n    return this;\n  };\n\n\n  function iteratorValue(type, k, v, iteratorResult) {\n    var value = type === 0 ? k : type === 1 ? v : [k, v];\n    iteratorResult ? (iteratorResult.value = value) : (iteratorResult = {\n      value: value, done: false\n    });\n    return iteratorResult;\n  }\n\n  function iteratorDone() {\n    return { value: undefined, done: true };\n  }\n\n  function hasIterator(maybeIterable) {\n    return !!getIteratorFn(maybeIterable);\n  }\n\n  function isIterator(maybeIterator) {\n    return maybeIterator && typeof maybeIterator.next === 'function';\n  }\n\n  function getIterator(iterable) {\n    var iteratorFn = getIteratorFn(iterable);\n    return iteratorFn && iteratorFn.call(iterable);\n  }\n\n  function getIteratorFn(iterable) {\n    var iteratorFn = iterable && (\n      (REAL_ITERATOR_SYMBOL && iterable[REAL_ITERATOR_SYMBOL]) ||\n      iterable[FAUX_ITERATOR_SYMBOL]\n    );\n    if (typeof iteratorFn === 'function') {\n      return iteratorFn;\n    }\n  }\n\n  function isArrayLike(value) {\n    return value && typeof value.length === 'number';\n  }\n\n  createClass(Seq, Iterable);\n    function Seq(value) {\n      return value === null || value === undefined ? emptySequence() :\n        isIterable(value) ? value.toSeq() : seqFromValue(value);\n    }\n\n    Seq.of = function(/*...values*/) {\n      return Seq(arguments);\n    };\n\n    Seq.prototype.toSeq = function() {\n      return this;\n    };\n\n    Seq.prototype.toString = function() {\n      return this.__toString('Seq {', '}');\n    };\n\n    Seq.prototype.cacheResult = function() {\n      if (!this._cache && this.__iterateUncached) {\n        this._cache = this.entrySeq().toArray();\n        this.size = this._cache.length;\n      }\n      return this;\n    };\n\n    // abstract __iterateUncached(fn, reverse)\n\n    Seq.prototype.__iterate = function(fn, reverse) {\n      return seqIterate(this, fn, reverse, true);\n    };\n\n    // abstract __iteratorUncached(type, reverse)\n\n    Seq.prototype.__iterator = function(type, reverse) {\n      return seqIterator(this, type, reverse, true);\n    };\n\n\n\n  createClass(KeyedSeq, Seq);\n    function KeyedSeq(value) {\n      return value === null || value === undefined ?\n        emptySequence().toKeyedSeq() :\n        isIterable(value) ?\n          (isKeyed(value) ? value.toSeq() : value.fromEntrySeq()) :\n          keyedSeqFromValue(value);\n    }\n\n    KeyedSeq.prototype.toKeyedSeq = function() {\n      return this;\n    };\n\n\n\n  createClass(IndexedSeq, Seq);\n    function IndexedSeq(value) {\n      return value === null || value === undefined ? emptySequence() :\n        !isIterable(value) ? indexedSeqFromValue(value) :\n        isKeyed(value) ? value.entrySeq() : value.toIndexedSeq();\n    }\n\n    IndexedSeq.of = function(/*...values*/) {\n      return IndexedSeq(arguments);\n    };\n\n    IndexedSeq.prototype.toIndexedSeq = function() {\n      return this;\n    };\n\n    IndexedSeq.prototype.toString = function() {\n      return this.__toString('Seq [', ']');\n    };\n\n    IndexedSeq.prototype.__iterate = function(fn, reverse) {\n      return seqIterate(this, fn, reverse, false);\n    };\n\n    IndexedSeq.prototype.__iterator = function(type, reverse) {\n      return seqIterator(this, type, reverse, false);\n    };\n\n\n\n  createClass(SetSeq, Seq);\n    function SetSeq(value) {\n      return (\n        value === null || value === undefined ? emptySequence() :\n        !isIterable(value) ? indexedSeqFromValue(value) :\n        isKeyed(value) ? value.entrySeq() : value\n      ).toSetSeq();\n    }\n\n    SetSeq.of = function(/*...values*/) {\n      return SetSeq(arguments);\n    };\n\n    SetSeq.prototype.toSetSeq = function() {\n      return this;\n    };\n\n\n\n  Seq.isSeq = isSeq;\n  Seq.Keyed = KeyedSeq;\n  Seq.Set = SetSeq;\n  Seq.Indexed = IndexedSeq;\n\n  var IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';\n\n  Seq.prototype[IS_SEQ_SENTINEL] = true;\n\n\n\n  createClass(ArraySeq, IndexedSeq);\n    function ArraySeq(array) {\n      this._array = array;\n      this.size = array.length;\n    }\n\n    ArraySeq.prototype.get = function(index, notSetValue) {\n      return this.has(index) ? this._array[wrapIndex(this, index)] : notSetValue;\n    };\n\n    ArraySeq.prototype.__iterate = function(fn, reverse) {\n      var array = this._array;\n      var maxIndex = array.length - 1;\n      for (var ii = 0; ii <= maxIndex; ii++) {\n        if (fn(array[reverse ? maxIndex - ii : ii], ii, this) === false) {\n          return ii + 1;\n        }\n      }\n      return ii;\n    };\n\n    ArraySeq.prototype.__iterator = function(type, reverse) {\n      var array = this._array;\n      var maxIndex = array.length - 1;\n      var ii = 0;\n      return new Iterator(function() \n        {return ii > maxIndex ?\n          iteratorDone() :\n          iteratorValue(type, ii, array[reverse ? maxIndex - ii++ : ii++])}\n      );\n    };\n\n\n\n  createClass(ObjectSeq, KeyedSeq);\n    function ObjectSeq(object) {\n      var keys = Object.keys(object);\n      this._object = object;\n      this._keys = keys;\n      this.size = keys.length;\n    }\n\n    ObjectSeq.prototype.get = function(key, notSetValue) {\n      if (notSetValue !== undefined && !this.has(key)) {\n        return notSetValue;\n      }\n      return this._object[key];\n    };\n\n    ObjectSeq.prototype.has = function(key) {\n      return this._object.hasOwnProperty(key);\n    };\n\n    ObjectSeq.prototype.__iterate = function(fn, reverse) {\n      var object = this._object;\n      var keys = this._keys;\n      var maxIndex = keys.length - 1;\n      for (var ii = 0; ii <= maxIndex; ii++) {\n        var key = keys[reverse ? maxIndex - ii : ii];\n        if (fn(object[key], key, this) === false) {\n          return ii + 1;\n        }\n      }\n      return ii;\n    };\n\n    ObjectSeq.prototype.__iterator = function(type, reverse) {\n      var object = this._object;\n      var keys = this._keys;\n      var maxIndex = keys.length - 1;\n      var ii = 0;\n      return new Iterator(function()  {\n        var key = keys[reverse ? maxIndex - ii : ii];\n        return ii++ > maxIndex ?\n          iteratorDone() :\n          iteratorValue(type, key, object[key]);\n      });\n    };\n\n  ObjectSeq.prototype[IS_ORDERED_SENTINEL] = true;\n\n\n  createClass(IterableSeq, IndexedSeq);\n    function IterableSeq(iterable) {\n      this._iterable = iterable;\n      this.size = iterable.length || iterable.size;\n    }\n\n    IterableSeq.prototype.__iterateUncached = function(fn, reverse) {\n      if (reverse) {\n        return this.cacheResult().__iterate(fn, reverse);\n      }\n      var iterable = this._iterable;\n      var iterator = getIterator(iterable);\n      var iterations = 0;\n      if (isIterator(iterator)) {\n        var step;\n        while (!(step = iterator.next()).done) {\n          if (fn(step.value, iterations++, this) === false) {\n            break;\n          }\n        }\n      }\n      return iterations;\n    };\n\n    IterableSeq.prototype.__iteratorUncached = function(type, reverse) {\n      if (reverse) {\n        return this.cacheResult().__iterator(type, reverse);\n      }\n      var iterable = this._iterable;\n      var iterator = getIterator(iterable);\n      if (!isIterator(iterator)) {\n        return new Iterator(iteratorDone);\n      }\n      var iterations = 0;\n      return new Iterator(function()  {\n        var step = iterator.next();\n        return step.done ? step : iteratorValue(type, iterations++, step.value);\n      });\n    };\n\n\n\n  createClass(IteratorSeq, IndexedSeq);\n    function IteratorSeq(iterator) {\n      this._iterator = iterator;\n      this._iteratorCache = [];\n    }\n\n    IteratorSeq.prototype.__iterateUncached = function(fn, reverse) {\n      if (reverse) {\n        return this.cacheResult().__iterate(fn, reverse);\n      }\n      var iterator = this._iterator;\n      var cache = this._iteratorCache;\n      var iterations = 0;\n      while (iterations < cache.length) {\n        if (fn(cache[iterations], iterations++, this) === false) {\n          return iterations;\n        }\n      }\n      var step;\n      while (!(step = iterator.next()).done) {\n        var val = step.value;\n        cache[iterations] = val;\n        if (fn(val, iterations++, this) === false) {\n          break;\n        }\n      }\n      return iterations;\n    };\n\n    IteratorSeq.prototype.__iteratorUncached = function(type, reverse) {\n      if (reverse) {\n        return this.cacheResult().__iterator(type, reverse);\n      }\n      var iterator = this._iterator;\n      var cache = this._iteratorCache;\n      var iterations = 0;\n      return new Iterator(function()  {\n        if (iterations >= cache.length) {\n          var step = iterator.next();\n          if (step.done) {\n            return step;\n          }\n          cache[iterations] = step.value;\n        }\n        return iteratorValue(type, iterations, cache[iterations++]);\n      });\n    };\n\n\n\n\n  // # pragma Helper functions\n\n  function isSeq(maybeSeq) {\n    return !!(maybeSeq && maybeSeq[IS_SEQ_SENTINEL]);\n  }\n\n  var EMPTY_SEQ;\n\n  function emptySequence() {\n    return EMPTY_SEQ || (EMPTY_SEQ = new ArraySeq([]));\n  }\n\n  function keyedSeqFromValue(value) {\n    var seq =\n      Array.isArray(value) ? new ArraySeq(value).fromEntrySeq() :\n      isIterator(value) ? new IteratorSeq(value).fromEntrySeq() :\n      hasIterator(value) ? new IterableSeq(value).fromEntrySeq() :\n      typeof value === 'object' ? new ObjectSeq(value) :\n      undefined;\n    if (!seq) {\n      throw new TypeError(\n        'Expected Array or iterable object of [k, v] entries, '+\n        'or keyed object: ' + value\n      );\n    }\n    return seq;\n  }\n\n  function indexedSeqFromValue(value) {\n    var seq = maybeIndexedSeqFromValue(value);\n    if (!seq) {\n      throw new TypeError(\n        'Expected Array or iterable object of values: ' + value\n      );\n    }\n    return seq;\n  }\n\n  function seqFromValue(value) {\n    var seq = maybeIndexedSeqFromValue(value) ||\n      (typeof value === 'object' && new ObjectSeq(value));\n    if (!seq) {\n      throw new TypeError(\n        'Expected Array or iterable object of values, or keyed object: ' + value\n      );\n    }\n    return seq;\n  }\n\n  function maybeIndexedSeqFromValue(value) {\n    return (\n      isArrayLike(value) ? new ArraySeq(value) :\n      isIterator(value) ? new IteratorSeq(value) :\n      hasIterator(value) ? new IterableSeq(value) :\n      undefined\n    );\n  }\n\n  function seqIterate(seq, fn, reverse, useKeys) {\n    var cache = seq._cache;\n    if (cache) {\n      var maxIndex = cache.length - 1;\n      for (var ii = 0; ii <= maxIndex; ii++) {\n        var entry = cache[reverse ? maxIndex - ii : ii];\n        if (fn(entry[1], useKeys ? entry[0] : ii, seq) === false) {\n          return ii + 1;\n        }\n      }\n      return ii;\n    }\n    return seq.__iterateUncached(fn, reverse);\n  }\n\n  function seqIterator(seq, type, reverse, useKeys) {\n    var cache = seq._cache;\n    if (cache) {\n      var maxIndex = cache.length - 1;\n      var ii = 0;\n      return new Iterator(function()  {\n        var entry = cache[reverse ? maxIndex - ii : ii];\n        return ii++ > maxIndex ?\n          iteratorDone() :\n          iteratorValue(type, useKeys ? entry[0] : ii - 1, entry[1]);\n      });\n    }\n    return seq.__iteratorUncached(type, reverse);\n  }\n\n  function fromJS(json, converter) {\n    return converter ?\n      fromJSWith(converter, json, '', {'': json}) :\n      fromJSDefault(json);\n  }\n\n  function fromJSWith(converter, json, key, parentJSON) {\n    if (Array.isArray(json)) {\n      return converter.call(parentJSON, key, IndexedSeq(json).map(function(v, k)  {return fromJSWith(converter, v, k, json)}));\n    }\n    if (isPlainObj(json)) {\n      return converter.call(parentJSON, key, KeyedSeq(json).map(function(v, k)  {return fromJSWith(converter, v, k, json)}));\n    }\n    return json;\n  }\n\n  function fromJSDefault(json) {\n    if (Array.isArray(json)) {\n      return IndexedSeq(json).map(fromJSDefault).toList();\n    }\n    if (isPlainObj(json)) {\n      return KeyedSeq(json).map(fromJSDefault).toMap();\n    }\n    return json;\n  }\n\n  function isPlainObj(value) {\n    return value && (value.constructor === Object || value.constructor === undefined);\n  }\n\n  /**\n   * An extension of the \"same-value\" algorithm as [described for use by ES6 Map\n   * and Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#Key_equality)\n   *\n   * NaN is considered the same as NaN, however -0 and 0 are considered the same\n   * value, which is different from the algorithm described by\n   * [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).\n   *\n   * This is extended further to allow Objects to describe the values they\n   * represent, by way of `valueOf` or `equals` (and `hashCode`).\n   *\n   * Note: because of this extension, the key equality of Immutable.Map and the\n   * value equality of Immutable.Set will differ from ES6 Map and Set.\n   *\n   * ### Defining custom values\n   *\n   * The easiest way to describe the value an object represents is by implementing\n   * `valueOf`. For example, `Date` represents a value by returning a unix\n   * timestamp for `valueOf`:\n   *\n   *     var date1 = new Date(1234567890000); // Fri Feb 13 2009 ...\n   *     var date2 = new Date(1234567890000);\n   *     date1.valueOf(); // 1234567890000\n   *     assert( date1 !== date2 );\n   *     assert( Immutable.is( date1, date2 ) );\n   *\n   * Note: overriding `valueOf` may have other implications if you use this object\n   * where JavaScript expects a primitive, such as implicit string coercion.\n   *\n   * For more complex types, especially collections, implementing `valueOf` may\n   * not be performant. An alternative is to implement `equals` and `hashCode`.\n   *\n   * `equals` takes another object, presumably of similar type, and returns true\n   * if the it is equal. Equality is symmetrical, so the same result should be\n   * returned if this and the argument are flipped.\n   *\n   *     assert( a.equals(b) === b.equals(a) );\n   *\n   * `hashCode` returns a 32bit integer number representing the object which will\n   * be used to determine how to store the value object in a Map or Set. You must\n   * provide both or neither methods, one must not exist without the other.\n   *\n   * Also, an important relationship between these methods must be upheld: if two\n   * values are equal, they *must* return the same hashCode. If the values are not\n   * equal, they might have the same hashCode; this is called a hash collision,\n   * and while undesirable for performance reasons, it is acceptable.\n   *\n   *     if (a.equals(b)) {\n   *       assert( a.hashCode() === b.hashCode() );\n   *     }\n   *\n   * All Immutable collections implement `equals` and `hashCode`.\n   *\n   */\n  function is(valueA, valueB) {\n    if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {\n      return true;\n    }\n    if (!valueA || !valueB) {\n      return false;\n    }\n    if (typeof valueA.valueOf === 'function' &&\n        typeof valueB.valueOf === 'function') {\n      valueA = valueA.valueOf();\n      valueB = valueB.valueOf();\n      if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {\n        return true;\n      }\n      if (!valueA || !valueB) {\n        return false;\n      }\n    }\n    if (typeof valueA.equals === 'function' &&\n        typeof valueB.equals === 'function' &&\n        valueA.equals(valueB)) {\n      return true;\n    }\n    return false;\n  }\n\n  function deepEqual(a, b) {\n    if (a === b) {\n      return true;\n    }\n\n    if (\n      !isIterable(b) ||\n      a.size !== undefined && b.size !== undefined && a.size !== b.size ||\n      a.__hash !== undefined && b.__hash !== undefined && a.__hash !== b.__hash ||\n      isKeyed(a) !== isKeyed(b) ||\n      isIndexed(a) !== isIndexed(b) ||\n      isOrdered(a) !== isOrdered(b)\n    ) {\n      return false;\n    }\n\n    if (a.size === 0 && b.size === 0) {\n      return true;\n    }\n\n    var notAssociative = !isAssociative(a);\n\n    if (isOrdered(a)) {\n      var entries = a.entries();\n      return b.every(function(v, k)  {\n        var entry = entries.next().value;\n        return entry && is(entry[1], v) && (notAssociative || is(entry[0], k));\n      }) && entries.next().done;\n    }\n\n    var flipped = false;\n\n    if (a.size === undefined) {\n      if (b.size === undefined) {\n        if (typeof a.cacheResult === 'function') {\n          a.cacheResult();\n        }\n      } else {\n        flipped = true;\n        var _ = a;\n        a = b;\n        b = _;\n      }\n    }\n\n    var allEqual = true;\n    var bSize = b.__iterate(function(v, k)  {\n      if (notAssociative ? !a.has(v) :\n          flipped ? !is(v, a.get(k, NOT_SET)) : !is(a.get(k, NOT_SET), v)) {\n        allEqual = false;\n        return false;\n      }\n    });\n\n    return allEqual && a.size === bSize;\n  }\n\n  createClass(Repeat, IndexedSeq);\n\n    function Repeat(value, times) {\n      if (!(this instanceof Repeat)) {\n        return new Repeat(value, times);\n      }\n      this._value = value;\n      this.size = times === undefined ? Infinity : Math.max(0, times);\n      if (this.size === 0) {\n        if (EMPTY_REPEAT) {\n          return EMPTY_REPEAT;\n        }\n        EMPTY_REPEAT = this;\n      }\n    }\n\n    Repeat.prototype.toString = function() {\n      if (this.size === 0) {\n        return 'Repeat []';\n      }\n      return 'Repeat [ ' + this._value + ' ' + this.size + ' times ]';\n    };\n\n    Repeat.prototype.get = function(index, notSetValue) {\n      return this.has(index) ? this._value : notSetValue;\n    };\n\n    Repeat.prototype.includes = function(searchValue) {\n      return is(this._value, searchValue);\n    };\n\n    Repeat.prototype.slice = function(begin, end) {\n      var size = this.size;\n      return wholeSlice(begin, end, size) ? this :\n        new Repeat(this._value, resolveEnd(end, size) - resolveBegin(begin, size));\n    };\n\n    Repeat.prototype.reverse = function() {\n      return this;\n    };\n\n    Repeat.prototype.indexOf = function(searchValue) {\n      if (is(this._value, searchValue)) {\n        return 0;\n      }\n      return -1;\n    };\n\n    Repeat.prototype.lastIndexOf = function(searchValue) {\n      if (is(this._value, searchValue)) {\n        return this.size;\n      }\n      return -1;\n    };\n\n    Repeat.prototype.__iterate = function(fn, reverse) {\n      for (var ii = 0; ii < this.size; ii++) {\n        if (fn(this._value, ii, this) === false) {\n          return ii + 1;\n        }\n      }\n      return ii;\n    };\n\n    Repeat.prototype.__iterator = function(type, reverse) {var this$0 = this;\n      var ii = 0;\n      return new Iterator(function() \n        {return ii < this$0.size ? iteratorValue(type, ii++, this$0._value) : iteratorDone()}\n      );\n    };\n\n    Repeat.prototype.equals = function(other) {\n      return other instanceof Repeat ?\n        is(this._value, other._value) :\n        deepEqual(other);\n    };\n\n\n  var EMPTY_REPEAT;\n\n  function invariant(condition, error) {\n    if (!condition) throw new Error(error);\n  }\n\n  createClass(Range, IndexedSeq);\n\n    function Range(start, end, step) {\n      if (!(this instanceof Range)) {\n        return new Range(start, end, step);\n      }\n      invariant(step !== 0, 'Cannot step a Range by 0');\n      start = start || 0;\n      if (end === undefined) {\n        end = Infinity;\n      }\n      step = step === undefined ? 1 : Math.abs(step);\n      if (end < start) {\n        step = -step;\n      }\n      this._start = start;\n      this._end = end;\n      this._step = step;\n      this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1);\n      if (this.size === 0) {\n        if (EMPTY_RANGE) {\n          return EMPTY_RANGE;\n        }\n        EMPTY_RANGE = this;\n      }\n    }\n\n    Range.prototype.toString = function() {\n      if (this.size === 0) {\n        return 'Range []';\n      }\n      return 'Range [ ' +\n        this._start + '...' + this._end +\n        (this._step > 1 ? ' by ' + this._step : '') +\n      ' ]';\n    };\n\n    Range.prototype.get = function(index, notSetValue) {\n      return this.has(index) ?\n        this._start + wrapIndex(this, index) * this._step :\n        notSetValue;\n    };\n\n    Range.prototype.includes = function(searchValue) {\n      var possibleIndex = (searchValue - this._start) / this._step;\n      return possibleIndex >= 0 &&\n        possibleIndex < this.size &&\n        possibleIndex === Math.floor(possibleIndex);\n    };\n\n    Range.prototype.slice = function(begin, end) {\n      if (wholeSlice(begin, end, this.size)) {\n        return this;\n      }\n      begin = resolveBegin(begin, this.size);\n      end = resolveEnd(end, this.size);\n      if (end <= begin) {\n        return new Range(0, 0);\n      }\n      return new Range(this.get(begin, this._end), this.get(end, this._end), this._step);\n    };\n\n    Range.prototype.indexOf = function(searchValue) {\n      var offsetValue = searchValue - this._start;\n      if (offsetValue % this._step === 0) {\n        var index = offsetValue / this._step;\n        if (index >= 0 && index < this.size) {\n          return index\n        }\n      }\n      return -1;\n    };\n\n    Range.prototype.lastIndexOf = function(searchValue) {\n      return this.indexOf(searchValue);\n    };\n\n    Range.prototype.__iterate = function(fn, reverse) {\n      var maxIndex = this.size - 1;\n      var step = this._step;\n      var value = reverse ? this._start + maxIndex * step : this._start;\n      for (var ii = 0; ii <= maxIndex; ii++) {\n        if (fn(value, ii, this) === false) {\n          return ii + 1;\n        }\n        value += reverse ? -step : step;\n      }\n      return ii;\n    };\n\n    Range.prototype.__iterator = function(type, reverse) {\n      var maxIndex = this.size - 1;\n      var step = this._step;\n      var value = reverse ? this._start + maxIndex * step : this._start;\n      var ii = 0;\n      return new Iterator(function()  {\n        var v = value;\n        value += reverse ? -step : step;\n        return ii > maxIndex ? iteratorDone() : iteratorValue(type, ii++, v);\n      });\n    };\n\n    Range.prototype.equals = function(other) {\n      return other instanceof Range ?\n        this._start === other._start &&\n        this._end === other._end &&\n        this._step === other._step :\n        deepEqual(this, other);\n    };\n\n\n  var EMPTY_RANGE;\n\n  createClass(Collection, Iterable);\n    function Collection() {\n      throw TypeError('Abstract');\n    }\n\n\n  createClass(KeyedCollection, Collection);function KeyedCollection() {}\n\n  createClass(IndexedCollection, Collection);function IndexedCollection() {}\n\n  createClass(SetCollection, Collection);function SetCollection() {}\n\n\n  Collection.Keyed = KeyedCollection;\n  Collection.Indexed = IndexedCollection;\n  Collection.Set = SetCollection;\n\n  var imul =\n    typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2 ?\n    Math.imul :\n    function imul(a, b) {\n      a = a | 0; // int\n      b = b | 0; // int\n      var c = a & 0xffff;\n      var d = b & 0xffff;\n      // Shift by 0 fixes the sign on the high part.\n      return (c * d) + ((((a >>> 16) * d + c * (b >>> 16)) << 16) >>> 0) | 0; // int\n    };\n\n  // v8 has an optimization for storing 31-bit signed numbers.\n  // Values which have either 00 or 11 as the high order bits qualify.\n  // This function drops the highest order bit in a signed number, maintaining\n  // the sign bit.\n  function smi(i32) {\n    return ((i32 >>> 1) & 0x40000000) | (i32 & 0xBFFFFFFF);\n  }\n\n  function hash(o) {\n    if (o === false || o === null || o === undefined) {\n      return 0;\n    }\n    if (typeof o.valueOf === 'function') {\n      o = o.valueOf();\n      if (o === false || o === null || o === undefined) {\n        return 0;\n      }\n    }\n    if (o === true) {\n      return 1;\n    }\n    var type = typeof o;\n    if (type === 'number') {\n      var h = o | 0;\n      if (h !== o) {\n        h ^= o * 0xFFFFFFFF;\n      }\n      while (o > 0xFFFFFFFF) {\n        o /= 0xFFFFFFFF;\n        h ^= o;\n      }\n      return smi(h);\n    }\n    if (type === 'string') {\n      return o.length > STRING_HASH_CACHE_MIN_STRLEN ? cachedHashString(o) : hashString(o);\n    }\n    if (typeof o.hashCode === 'function') {\n      return o.hashCode();\n    }\n    if (type === 'object') {\n      return hashJSObj(o);\n    }\n    if (typeof o.toString === 'function') {\n      return hashString(o.toString());\n    }\n    throw new Error('Value type ' + type + ' cannot be hashed.');\n  }\n\n  function cachedHashString(string) {\n    var hash = stringHashCache[string];\n    if (hash === undefined) {\n      hash = hashString(string);\n      if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) {\n        STRING_HASH_CACHE_SIZE = 0;\n        stringHashCache = {};\n      }\n      STRING_HASH_CACHE_SIZE++;\n      stringHashCache[string] = hash;\n    }\n    return hash;\n  }\n\n  // http://jsperf.com/hashing-strings\n  function hashString(string) {\n    // This is the hash from JVM\n    // The hash code for a string is computed as\n    // s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1],\n    // where s[i] is the ith character of the string and n is the length of\n    // the string. We \"mod\" the result to make it between 0 (inclusive) and 2^31\n    // (exclusive) by dropping high bits.\n    var hash = 0;\n    for (var ii = 0; ii < string.length; ii++) {\n      hash = 31 * hash + string.charCodeAt(ii) | 0;\n    }\n    return smi(hash);\n  }\n\n  function hashJSObj(obj) {\n    var hash;\n    if (usingWeakMap) {\n      hash = weakMap.get(obj);\n      if (hash !== undefined) {\n        return hash;\n      }\n    }\n\n    hash = obj[UID_HASH_KEY];\n    if (hash !== undefined) {\n      return hash;\n    }\n\n    if (!canDefineProperty) {\n      hash = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY];\n      if (hash !== undefined) {\n        return hash;\n      }\n\n      hash = getIENodeHash(obj);\n      if (hash !== undefined) {\n        return hash;\n      }\n    }\n\n    hash = ++objHashUID;\n    if (objHashUID & 0x40000000) {\n      objHashUID = 0;\n    }\n\n    if (usingWeakMap) {\n      weakMap.set(obj, hash);\n    } else if (isExtensible !== undefined && isExtensible(obj) === false) {\n      throw new Error('Non-extensible objects are not allowed as keys.');\n    } else if (canDefineProperty) {\n      Object.defineProperty(obj, UID_HASH_KEY, {\n        'enumerable': false,\n        'configurable': false,\n        'writable': false,\n        'value': hash\n      });\n    } else if (obj.propertyIsEnumerable !== undefined &&\n               obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable) {\n      // Since we can't define a non-enumerable property on the object\n      // we'll hijack one of the less-used non-enumerable properties to\n      // save our hash on it. Since this is a function it will not show up in\n      // `JSON.stringify` which is what we want.\n      obj.propertyIsEnumerable = function() {\n        return this.constructor.prototype.propertyIsEnumerable.apply(this, arguments);\n      };\n      obj.propertyIsEnumerable[UID_HASH_KEY] = hash;\n    } else if (obj.nodeType !== undefined) {\n      // At this point we couldn't get the IE `uniqueID` to use as a hash\n      // and we couldn't use a non-enumerable property to exploit the\n      // dontEnum bug so we simply add the `UID_HASH_KEY` on the node\n      // itself.\n      obj[UID_HASH_KEY] = hash;\n    } else {\n      throw new Error('Unable to set a non-enumerable property on object.');\n    }\n\n    return hash;\n  }\n\n  // Get references to ES5 object methods.\n  var isExtensible = Object.isExtensible;\n\n  // True if Object.defineProperty works as expected. IE8 fails this test.\n  var canDefineProperty = (function() {\n    try {\n      Object.defineProperty({}, '@', {});\n      return true;\n    } catch (e) {\n      return false;\n    }\n  }());\n\n  // IE has a `uniqueID` property on DOM nodes. We can construct the hash from it\n  // and avoid memory leaks from the IE cloneNode bug.\n  function getIENodeHash(node) {\n    if (node && node.nodeType > 0) {\n      switch (node.nodeType) {\n        case 1: // Element\n          return node.uniqueID;\n        case 9: // Document\n          return node.documentElement && node.documentElement.uniqueID;\n      }\n    }\n  }\n\n  // If possible, use a WeakMap.\n  var usingWeakMap = typeof WeakMap === 'function';\n  var weakMap;\n  if (usingWeakMap) {\n    weakMap = new WeakMap();\n  }\n\n  var objHashUID = 0;\n\n  var UID_HASH_KEY = '__immutablehash__';\n  if (typeof Symbol === 'function') {\n    UID_HASH_KEY = Symbol(UID_HASH_KEY);\n  }\n\n  var STRING_HASH_CACHE_MIN_STRLEN = 16;\n  var STRING_HASH_CACHE_MAX_SIZE = 255;\n  var STRING_HASH_CACHE_SIZE = 0;\n  var stringHashCache = {};\n\n  function assertNotInfinite(size) {\n    invariant(\n      size !== Infinity,\n      'Cannot perform this action with an infinite size.'\n    );\n  }\n\n  createClass(Map, KeyedCollection);\n\n    // @pragma Construction\n\n    function Map(value) {\n      return value === null || value === undefined ? emptyMap() :\n        isMap(value) && !isOrdered(value) ? value :\n        emptyMap().withMutations(function(map ) {\n          var iter = KeyedIterable(value);\n          assertNotInfinite(iter.size);\n          iter.forEach(function(v, k)  {return map.set(k, v)});\n        });\n    }\n\n    Map.prototype.toString = function() {\n      return this.__toString('Map {', '}');\n    };\n\n    // @pragma Access\n\n    Map.prototype.get = function(k, notSetValue) {\n      return this._root ?\n        this._root.get(0, undefined, k, notSetValue) :\n        notSetValue;\n    };\n\n    // @pragma Modification\n\n    Map.prototype.set = function(k, v) {\n      return updateMap(this, k, v);\n    };\n\n    Map.prototype.setIn = function(keyPath, v) {\n      return this.updateIn(keyPath, NOT_SET, function()  {return v});\n    };\n\n    Map.prototype.remove = function(k) {\n      return updateMap(this, k, NOT_SET);\n    };\n\n    Map.prototype.deleteIn = function(keyPath) {\n      return this.updateIn(keyPath, function()  {return NOT_SET});\n    };\n\n    Map.prototype.update = function(k, notSetValue, updater) {\n      return arguments.length === 1 ?\n        k(this) :\n        this.updateIn([k], notSetValue, updater);\n    };\n\n    Map.prototype.updateIn = function(keyPath, notSetValue, updater) {\n      if (!updater) {\n        updater = notSetValue;\n        notSetValue = undefined;\n      }\n      var updatedValue = updateInDeepMap(\n        this,\n        forceIterator(keyPath),\n        notSetValue,\n        updater\n      );\n      return updatedValue === NOT_SET ? undefined : updatedValue;\n    };\n\n    Map.prototype.clear = function() {\n      if (this.size === 0) {\n        return this;\n      }\n      if (this.__ownerID) {\n        this.size = 0;\n        this._root = null;\n        this.__hash = undefined;\n        this.__altered = true;\n        return this;\n      }\n      return emptyMap();\n    };\n\n    // @pragma Composition\n\n    Map.prototype.merge = function(/*...iters*/) {\n      return mergeIntoMapWith(this, undefined, arguments);\n    };\n\n    Map.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n      return mergeIntoMapWith(this, merger, iters);\n    };\n\n    Map.prototype.mergeIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1);\n      return this.updateIn(\n        keyPath,\n        emptyMap(),\n        function(m ) {return typeof m.merge === 'function' ?\n          m.merge.apply(m, iters) :\n          iters[iters.length - 1]}\n      );\n    };\n\n    Map.prototype.mergeDeep = function(/*...iters*/) {\n      return mergeIntoMapWith(this, deepMerger, arguments);\n    };\n\n    Map.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n      return mergeIntoMapWith(this, deepMergerWith(merger), iters);\n    };\n\n    Map.prototype.mergeDeepIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1);\n      return this.updateIn(\n        keyPath,\n        emptyMap(),\n        function(m ) {return typeof m.mergeDeep === 'function' ?\n          m.mergeDeep.apply(m, iters) :\n          iters[iters.length - 1]}\n      );\n    };\n\n    Map.prototype.sort = function(comparator) {\n      // Late binding\n      return OrderedMap(sortFactory(this, comparator));\n    };\n\n    Map.prototype.sortBy = function(mapper, comparator) {\n      // Late binding\n      return OrderedMap(sortFactory(this, comparator, mapper));\n    };\n\n    // @pragma Mutability\n\n    Map.prototype.withMutations = function(fn) {\n      var mutable = this.asMutable();\n      fn(mutable);\n      return mutable.wasAltered() ? mutable.__ensureOwner(this.__ownerID) : this;\n    };\n\n    Map.prototype.asMutable = function() {\n      return this.__ownerID ? this : this.__ensureOwner(new OwnerID());\n    };\n\n    Map.prototype.asImmutable = function() {\n      return this.__ensureOwner();\n    };\n\n    Map.prototype.wasAltered = function() {\n      return this.__altered;\n    };\n\n    Map.prototype.__iterator = function(type, reverse) {\n      return new MapIterator(this, type, reverse);\n    };\n\n    Map.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n      var iterations = 0;\n      this._root && this._root.iterate(function(entry ) {\n        iterations++;\n        return fn(entry[1], entry[0], this$0);\n      }, reverse);\n      return iterations;\n    };\n\n    Map.prototype.__ensureOwner = function(ownerID) {\n      if (ownerID === this.__ownerID) {\n        return this;\n      }\n      if (!ownerID) {\n        this.__ownerID = ownerID;\n        this.__altered = false;\n        return this;\n      }\n      return makeMap(this.size, this._root, ownerID, this.__hash);\n    };\n\n\n  function isMap(maybeMap) {\n    return !!(maybeMap && maybeMap[IS_MAP_SENTINEL]);\n  }\n\n  Map.isMap = isMap;\n\n  var IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';\n\n  var MapPrototype = Map.prototype;\n  MapPrototype[IS_MAP_SENTINEL] = true;\n  MapPrototype[DELETE] = MapPrototype.remove;\n  MapPrototype.removeIn = MapPrototype.deleteIn;\n\n\n  // #pragma Trie Nodes\n\n\n\n    function ArrayMapNode(ownerID, entries) {\n      this.ownerID = ownerID;\n      this.entries = entries;\n    }\n\n    ArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n      var entries = this.entries;\n      for (var ii = 0, len = entries.length; ii < len; ii++) {\n        if (is(key, entries[ii][0])) {\n          return entries[ii][1];\n        }\n      }\n      return notSetValue;\n    };\n\n    ArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n      var removed = value === NOT_SET;\n\n      var entries = this.entries;\n      var idx = 0;\n      for (var len = entries.length; idx < len; idx++) {\n        if (is(key, entries[idx][0])) {\n          break;\n        }\n      }\n      var exists = idx < len;\n\n      if (exists ? entries[idx][1] === value : removed) {\n        return this;\n      }\n\n      SetRef(didAlter);\n      (removed || !exists) && SetRef(didChangeSize);\n\n      if (removed && entries.length === 1) {\n        return; // undefined\n      }\n\n      if (!exists && !removed && entries.length >= MAX_ARRAY_MAP_SIZE) {\n        return createNodes(ownerID, entries, key, value);\n      }\n\n      var isEditable = ownerID && ownerID === this.ownerID;\n      var newEntries = isEditable ? entries : arrCopy(entries);\n\n      if (exists) {\n        if (removed) {\n          idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop());\n        } else {\n          newEntries[idx] = [key, value];\n        }\n      } else {\n        newEntries.push([key, value]);\n      }\n\n      if (isEditable) {\n        this.entries = newEntries;\n        return this;\n      }\n\n      return new ArrayMapNode(ownerID, newEntries);\n    };\n\n\n\n\n    function BitmapIndexedNode(ownerID, bitmap, nodes) {\n      this.ownerID = ownerID;\n      this.bitmap = bitmap;\n      this.nodes = nodes;\n    }\n\n    BitmapIndexedNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n      if (keyHash === undefined) {\n        keyHash = hash(key);\n      }\n      var bit = (1 << ((shift === 0 ? keyHash : keyHash >>> shift) & MASK));\n      var bitmap = this.bitmap;\n      return (bitmap & bit) === 0 ? notSetValue :\n        this.nodes[popCount(bitmap & (bit - 1))].get(shift + SHIFT, keyHash, key, notSetValue);\n    };\n\n    BitmapIndexedNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n      if (keyHash === undefined) {\n        keyHash = hash(key);\n      }\n      var keyHashFrag = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n      var bit = 1 << keyHashFrag;\n      var bitmap = this.bitmap;\n      var exists = (bitmap & bit) !== 0;\n\n      if (!exists && value === NOT_SET) {\n        return this;\n      }\n\n      var idx = popCount(bitmap & (bit - 1));\n      var nodes = this.nodes;\n      var node = exists ? nodes[idx] : undefined;\n      var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);\n\n      if (newNode === node) {\n        return this;\n      }\n\n      if (!exists && newNode && nodes.length >= MAX_BITMAP_INDEXED_SIZE) {\n        return expandNodes(ownerID, nodes, bitmap, keyHashFrag, newNode);\n      }\n\n      if (exists && !newNode && nodes.length === 2 && isLeafNode(nodes[idx ^ 1])) {\n        return nodes[idx ^ 1];\n      }\n\n      if (exists && newNode && nodes.length === 1 && isLeafNode(newNode)) {\n        return newNode;\n      }\n\n      var isEditable = ownerID && ownerID === this.ownerID;\n      var newBitmap = exists ? newNode ? bitmap : bitmap ^ bit : bitmap | bit;\n      var newNodes = exists ? newNode ?\n        setIn(nodes, idx, newNode, isEditable) :\n        spliceOut(nodes, idx, isEditable) :\n        spliceIn(nodes, idx, newNode, isEditable);\n\n      if (isEditable) {\n        this.bitmap = newBitmap;\n        this.nodes = newNodes;\n        return this;\n      }\n\n      return new BitmapIndexedNode(ownerID, newBitmap, newNodes);\n    };\n\n\n\n\n    function HashArrayMapNode(ownerID, count, nodes) {\n      this.ownerID = ownerID;\n      this.count = count;\n      this.nodes = nodes;\n    }\n\n    HashArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n      if (keyHash === undefined) {\n        keyHash = hash(key);\n      }\n      var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n      var node = this.nodes[idx];\n      return node ? node.get(shift + SHIFT, keyHash, key, notSetValue) : notSetValue;\n    };\n\n    HashArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n      if (keyHash === undefined) {\n        keyHash = hash(key);\n      }\n      var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n      var removed = value === NOT_SET;\n      var nodes = this.nodes;\n      var node = nodes[idx];\n\n      if (removed && !node) {\n        return this;\n      }\n\n      var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);\n      if (newNode === node) {\n        return this;\n      }\n\n      var newCount = this.count;\n      if (!node) {\n        newCount++;\n      } else if (!newNode) {\n        newCount--;\n        if (newCount < MIN_HASH_ARRAY_MAP_SIZE) {\n          return packNodes(ownerID, nodes, newCount, idx);\n        }\n      }\n\n      var isEditable = ownerID && ownerID === this.ownerID;\n      var newNodes = setIn(nodes, idx, newNode, isEditable);\n\n      if (isEditable) {\n        this.count = newCount;\n        this.nodes = newNodes;\n        return this;\n      }\n\n      return new HashArrayMapNode(ownerID, newCount, newNodes);\n    };\n\n\n\n\n    function HashCollisionNode(ownerID, keyHash, entries) {\n      this.ownerID = ownerID;\n      this.keyHash = keyHash;\n      this.entries = entries;\n    }\n\n    HashCollisionNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n      var entries = this.entries;\n      for (var ii = 0, len = entries.length; ii < len; ii++) {\n        if (is(key, entries[ii][0])) {\n          return entries[ii][1];\n        }\n      }\n      return notSetValue;\n    };\n\n    HashCollisionNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n      if (keyHash === undefined) {\n        keyHash = hash(key);\n      }\n\n      var removed = value === NOT_SET;\n\n      if (keyHash !== this.keyHash) {\n        if (removed) {\n          return this;\n        }\n        SetRef(didAlter);\n        SetRef(didChangeSize);\n        return mergeIntoNode(this, ownerID, shift, keyHash, [key, value]);\n      }\n\n      var entries = this.entries;\n      var idx = 0;\n      for (var len = entries.length; idx < len; idx++) {\n        if (is(key, entries[idx][0])) {\n          break;\n        }\n      }\n      var exists = idx < len;\n\n      if (exists ? entries[idx][1] === value : removed) {\n        return this;\n      }\n\n      SetRef(didAlter);\n      (removed || !exists) && SetRef(didChangeSize);\n\n      if (removed && len === 2) {\n        return new ValueNode(ownerID, this.keyHash, entries[idx ^ 1]);\n      }\n\n      var isEditable = ownerID && ownerID === this.ownerID;\n      var newEntries = isEditable ? entries : arrCopy(entries);\n\n      if (exists) {\n        if (removed) {\n          idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop());\n        } else {\n          newEntries[idx] = [key, value];\n        }\n      } else {\n        newEntries.push([key, value]);\n      }\n\n      if (isEditable) {\n        this.entries = newEntries;\n        return this;\n      }\n\n      return new HashCollisionNode(ownerID, this.keyHash, newEntries);\n    };\n\n\n\n\n    function ValueNode(ownerID, keyHash, entry) {\n      this.ownerID = ownerID;\n      this.keyHash = keyHash;\n      this.entry = entry;\n    }\n\n    ValueNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n      return is(key, this.entry[0]) ? this.entry[1] : notSetValue;\n    };\n\n    ValueNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n      var removed = value === NOT_SET;\n      var keyMatch = is(key, this.entry[0]);\n      if (keyMatch ? value === this.entry[1] : removed) {\n        return this;\n      }\n\n      SetRef(didAlter);\n\n      if (removed) {\n        SetRef(didChangeSize);\n        return; // undefined\n      }\n\n      if (keyMatch) {\n        if (ownerID && ownerID === this.ownerID) {\n          this.entry[1] = value;\n          return this;\n        }\n        return new ValueNode(ownerID, this.keyHash, [key, value]);\n      }\n\n      SetRef(didChangeSize);\n      return mergeIntoNode(this, ownerID, shift, hash(key), [key, value]);\n    };\n\n\n\n  // #pragma Iterators\n\n  ArrayMapNode.prototype.iterate =\n  HashCollisionNode.prototype.iterate = function (fn, reverse) {\n    var entries = this.entries;\n    for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) {\n      if (fn(entries[reverse ? maxIndex - ii : ii]) === false) {\n        return false;\n      }\n    }\n  }\n\n  BitmapIndexedNode.prototype.iterate =\n  HashArrayMapNode.prototype.iterate = function (fn, reverse) {\n    var nodes = this.nodes;\n    for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) {\n      var node = nodes[reverse ? maxIndex - ii : ii];\n      if (node && node.iterate(fn, reverse) === false) {\n        return false;\n      }\n    }\n  }\n\n  ValueNode.prototype.iterate = function (fn, reverse) {\n    return fn(this.entry);\n  }\n\n  createClass(MapIterator, Iterator);\n\n    function MapIterator(map, type, reverse) {\n      this._type = type;\n      this._reverse = reverse;\n      this._stack = map._root && mapIteratorFrame(map._root);\n    }\n\n    MapIterator.prototype.next = function() {\n      var type = this._type;\n      var stack = this._stack;\n      while (stack) {\n        var node = stack.node;\n        var index = stack.index++;\n        var maxIndex;\n        if (node.entry) {\n          if (index === 0) {\n            return mapIteratorValue(type, node.entry);\n          }\n        } else if (node.entries) {\n          maxIndex = node.entries.length - 1;\n          if (index <= maxIndex) {\n            return mapIteratorValue(type, node.entries[this._reverse ? maxIndex - index : index]);\n          }\n        } else {\n          maxIndex = node.nodes.length - 1;\n          if (index <= maxIndex) {\n            var subNode = node.nodes[this._reverse ? maxIndex - index : index];\n            if (subNode) {\n              if (subNode.entry) {\n                return mapIteratorValue(type, subNode.entry);\n              }\n              stack = this._stack = mapIteratorFrame(subNode, stack);\n            }\n            continue;\n          }\n        }\n        stack = this._stack = this._stack.__prev;\n      }\n      return iteratorDone();\n    };\n\n\n  function mapIteratorValue(type, entry) {\n    return iteratorValue(type, entry[0], entry[1]);\n  }\n\n  function mapIteratorFrame(node, prev) {\n    return {\n      node: node,\n      index: 0,\n      __prev: prev\n    };\n  }\n\n  function makeMap(size, root, ownerID, hash) {\n    var map = Object.create(MapPrototype);\n    map.size = size;\n    map._root = root;\n    map.__ownerID = ownerID;\n    map.__hash = hash;\n    map.__altered = false;\n    return map;\n  }\n\n  var EMPTY_MAP;\n  function emptyMap() {\n    return EMPTY_MAP || (EMPTY_MAP = makeMap(0));\n  }\n\n  function updateMap(map, k, v) {\n    var newRoot;\n    var newSize;\n    if (!map._root) {\n      if (v === NOT_SET) {\n        return map;\n      }\n      newSize = 1;\n      newRoot = new ArrayMapNode(map.__ownerID, [[k, v]]);\n    } else {\n      var didChangeSize = MakeRef(CHANGE_LENGTH);\n      var didAlter = MakeRef(DID_ALTER);\n      newRoot = updateNode(map._root, map.__ownerID, 0, undefined, k, v, didChangeSize, didAlter);\n      if (!didAlter.value) {\n        return map;\n      }\n      newSize = map.size + (didChangeSize.value ? v === NOT_SET ? -1 : 1 : 0);\n    }\n    if (map.__ownerID) {\n      map.size = newSize;\n      map._root = newRoot;\n      map.__hash = undefined;\n      map.__altered = true;\n      return map;\n    }\n    return newRoot ? makeMap(newSize, newRoot) : emptyMap();\n  }\n\n  function updateNode(node, ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n    if (!node) {\n      if (value === NOT_SET) {\n        return node;\n      }\n      SetRef(didAlter);\n      SetRef(didChangeSize);\n      return new ValueNode(ownerID, keyHash, [key, value]);\n    }\n    return node.update(ownerID, shift, keyHash, key, value, didChangeSize, didAlter);\n  }\n\n  function isLeafNode(node) {\n    return node.constructor === ValueNode || node.constructor === HashCollisionNode;\n  }\n\n  function mergeIntoNode(node, ownerID, shift, keyHash, entry) {\n    if (node.keyHash === keyHash) {\n      return new HashCollisionNode(ownerID, keyHash, [node.entry, entry]);\n    }\n\n    var idx1 = (shift === 0 ? node.keyHash : node.keyHash >>> shift) & MASK;\n    var idx2 = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n\n    var newNode;\n    var nodes = idx1 === idx2 ?\n      [mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)] :\n      ((newNode = new ValueNode(ownerID, keyHash, entry)), idx1 < idx2 ? [node, newNode] : [newNode, node]);\n\n    return new BitmapIndexedNode(ownerID, (1 << idx1) | (1 << idx2), nodes);\n  }\n\n  function createNodes(ownerID, entries, key, value) {\n    if (!ownerID) {\n      ownerID = new OwnerID();\n    }\n    var node = new ValueNode(ownerID, hash(key), [key, value]);\n    for (var ii = 0; ii < entries.length; ii++) {\n      var entry = entries[ii];\n      node = node.update(ownerID, 0, undefined, entry[0], entry[1]);\n    }\n    return node;\n  }\n\n  function packNodes(ownerID, nodes, count, excluding) {\n    var bitmap = 0;\n    var packedII = 0;\n    var packedNodes = new Array(count);\n    for (var ii = 0, bit = 1, len = nodes.length; ii < len; ii++, bit <<= 1) {\n      var node = nodes[ii];\n      if (node !== undefined && ii !== excluding) {\n        bitmap |= bit;\n        packedNodes[packedII++] = node;\n      }\n    }\n    return new BitmapIndexedNode(ownerID, bitmap, packedNodes);\n  }\n\n  function expandNodes(ownerID, nodes, bitmap, including, node) {\n    var count = 0;\n    var expandedNodes = new Array(SIZE);\n    for (var ii = 0; bitmap !== 0; ii++, bitmap >>>= 1) {\n      expandedNodes[ii] = bitmap & 1 ? nodes[count++] : undefined;\n    }\n    expandedNodes[including] = node;\n    return new HashArrayMapNode(ownerID, count + 1, expandedNodes);\n  }\n\n  function mergeIntoMapWith(map, merger, iterables) {\n    var iters = [];\n    for (var ii = 0; ii < iterables.length; ii++) {\n      var value = iterables[ii];\n      var iter = KeyedIterable(value);\n      if (!isIterable(value)) {\n        iter = iter.map(function(v ) {return fromJS(v)});\n      }\n      iters.push(iter);\n    }\n    return mergeIntoCollectionWith(map, merger, iters);\n  }\n\n  function deepMerger(existing, value, key) {\n    return existing && existing.mergeDeep && isIterable(value) ?\n      existing.mergeDeep(value) :\n      is(existing, value) ? existing : value;\n  }\n\n  function deepMergerWith(merger) {\n    return function(existing, value, key)  {\n      if (existing && existing.mergeDeepWith && isIterable(value)) {\n        return existing.mergeDeepWith(merger, value);\n      }\n      var nextValue = merger(existing, value, key);\n      return is(existing, nextValue) ? existing : nextValue;\n    };\n  }\n\n  function mergeIntoCollectionWith(collection, merger, iters) {\n    iters = iters.filter(function(x ) {return x.size !== 0});\n    if (iters.length === 0) {\n      return collection;\n    }\n    if (collection.size === 0 && !collection.__ownerID && iters.length === 1) {\n      return collection.constructor(iters[0]);\n    }\n    return collection.withMutations(function(collection ) {\n      var mergeIntoMap = merger ?\n        function(value, key)  {\n          collection.update(key, NOT_SET, function(existing )\n            {return existing === NOT_SET ? value : merger(existing, value, key)}\n          );\n        } :\n        function(value, key)  {\n          collection.set(key, value);\n        }\n      for (var ii = 0; ii < iters.length; ii++) {\n        iters[ii].forEach(mergeIntoMap);\n      }\n    });\n  }\n\n  function updateInDeepMap(existing, keyPathIter, notSetValue, updater) {\n    var isNotSet = existing === NOT_SET;\n    var step = keyPathIter.next();\n    if (step.done) {\n      var existingValue = isNotSet ? notSetValue : existing;\n      var newValue = updater(existingValue);\n      return newValue === existingValue ? existing : newValue;\n    }\n    invariant(\n      isNotSet || (existing && existing.set),\n      'invalid keyPath'\n    );\n    var key = step.value;\n    var nextExisting = isNotSet ? NOT_SET : existing.get(key, NOT_SET);\n    var nextUpdated = updateInDeepMap(\n      nextExisting,\n      keyPathIter,\n      notSetValue,\n      updater\n    );\n    return nextUpdated === nextExisting ? existing :\n      nextUpdated === NOT_SET ? existing.remove(key) :\n      (isNotSet ? emptyMap() : existing).set(key, nextUpdated);\n  }\n\n  function popCount(x) {\n    x = x - ((x >> 1) & 0x55555555);\n    x = (x & 0x33333333) + ((x >> 2) & 0x33333333);\n    x = (x + (x >> 4)) & 0x0f0f0f0f;\n    x = x + (x >> 8);\n    x = x + (x >> 16);\n    return x & 0x7f;\n  }\n\n  function setIn(array, idx, val, canEdit) {\n    var newArray = canEdit ? array : arrCopy(array);\n    newArray[idx] = val;\n    return newArray;\n  }\n\n  function spliceIn(array, idx, val, canEdit) {\n    var newLen = array.length + 1;\n    if (canEdit && idx + 1 === newLen) {\n      array[idx] = val;\n      return array;\n    }\n    var newArray = new Array(newLen);\n    var after = 0;\n    for (var ii = 0; ii < newLen; ii++) {\n      if (ii === idx) {\n        newArray[ii] = val;\n        after = -1;\n      } else {\n        newArray[ii] = array[ii + after];\n      }\n    }\n    return newArray;\n  }\n\n  function spliceOut(array, idx, canEdit) {\n    var newLen = array.length - 1;\n    if (canEdit && idx === newLen) {\n      array.pop();\n      return array;\n    }\n    var newArray = new Array(newLen);\n    var after = 0;\n    for (var ii = 0; ii < newLen; ii++) {\n      if (ii === idx) {\n        after = 1;\n      }\n      newArray[ii] = array[ii + after];\n    }\n    return newArray;\n  }\n\n  var MAX_ARRAY_MAP_SIZE = SIZE / 4;\n  var MAX_BITMAP_INDEXED_SIZE = SIZE / 2;\n  var MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4;\n\n  createClass(List, IndexedCollection);\n\n    // @pragma Construction\n\n    function List(value) {\n      var empty = emptyList();\n      if (value === null || value === undefined) {\n        return empty;\n      }\n      if (isList(value)) {\n        return value;\n      }\n      var iter = IndexedIterable(value);\n      var size = iter.size;\n      if (size === 0) {\n        return empty;\n      }\n      assertNotInfinite(size);\n      if (size > 0 && size < SIZE) {\n        return makeList(0, size, SHIFT, null, new VNode(iter.toArray()));\n      }\n      return empty.withMutations(function(list ) {\n        list.setSize(size);\n        iter.forEach(function(v, i)  {return list.set(i, v)});\n      });\n    }\n\n    List.of = function(/*...values*/) {\n      return this(arguments);\n    };\n\n    List.prototype.toString = function() {\n      return this.__toString('List [', ']');\n    };\n\n    // @pragma Access\n\n    List.prototype.get = function(index, notSetValue) {\n      index = wrapIndex(this, index);\n      if (index >= 0 && index < this.size) {\n        index += this._origin;\n        var node = listNodeFor(this, index);\n        return node && node.array[index & MASK];\n      }\n      return notSetValue;\n    };\n\n    // @pragma Modification\n\n    List.prototype.set = function(index, value) {\n      return updateList(this, index, value);\n    };\n\n    List.prototype.remove = function(index) {\n      return !this.has(index) ? this :\n        index === 0 ? this.shift() :\n        index === this.size - 1 ? this.pop() :\n        this.splice(index, 1);\n    };\n\n    List.prototype.insert = function(index, value) {\n      return this.splice(index, 0, value);\n    };\n\n    List.prototype.clear = function() {\n      if (this.size === 0) {\n        return this;\n      }\n      if (this.__ownerID) {\n        this.size = this._origin = this._capacity = 0;\n        this._level = SHIFT;\n        this._root = this._tail = null;\n        this.__hash = undefined;\n        this.__altered = true;\n        return this;\n      }\n      return emptyList();\n    };\n\n    List.prototype.push = function(/*...values*/) {\n      var values = arguments;\n      var oldSize = this.size;\n      return this.withMutations(function(list ) {\n        setListBounds(list, 0, oldSize + values.length);\n        for (var ii = 0; ii < values.length; ii++) {\n          list.set(oldSize + ii, values[ii]);\n        }\n      });\n    };\n\n    List.prototype.pop = function() {\n      return setListBounds(this, 0, -1);\n    };\n\n    List.prototype.unshift = function(/*...values*/) {\n      var values = arguments;\n      return this.withMutations(function(list ) {\n        setListBounds(list, -values.length);\n        for (var ii = 0; ii < values.length; ii++) {\n          list.set(ii, values[ii]);\n        }\n      });\n    };\n\n    List.prototype.shift = function() {\n      return setListBounds(this, 1);\n    };\n\n    // @pragma Composition\n\n    List.prototype.merge = function(/*...iters*/) {\n      return mergeIntoListWith(this, undefined, arguments);\n    };\n\n    List.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n      return mergeIntoListWith(this, merger, iters);\n    };\n\n    List.prototype.mergeDeep = function(/*...iters*/) {\n      return mergeIntoListWith(this, deepMerger, arguments);\n    };\n\n    List.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n      return mergeIntoListWith(this, deepMergerWith(merger), iters);\n    };\n\n    List.prototype.setSize = function(size) {\n      return setListBounds(this, 0, size);\n    };\n\n    // @pragma Iteration\n\n    List.prototype.slice = function(begin, end) {\n      var size = this.size;\n      if (wholeSlice(begin, end, size)) {\n        return this;\n      }\n      return setListBounds(\n        this,\n        resolveBegin(begin, size),\n        resolveEnd(end, size)\n      );\n    };\n\n    List.prototype.__iterator = function(type, reverse) {\n      var index = 0;\n      var values = iterateList(this, reverse);\n      return new Iterator(function()  {\n        var value = values();\n        return value === DONE ?\n          iteratorDone() :\n          iteratorValue(type, index++, value);\n      });\n    };\n\n    List.prototype.__iterate = function(fn, reverse) {\n      var index = 0;\n      var values = iterateList(this, reverse);\n      var value;\n      while ((value = values()) !== DONE) {\n        if (fn(value, index++, this) === false) {\n          break;\n        }\n      }\n      return index;\n    };\n\n    List.prototype.__ensureOwner = function(ownerID) {\n      if (ownerID === this.__ownerID) {\n        return this;\n      }\n      if (!ownerID) {\n        this.__ownerID = ownerID;\n        return this;\n      }\n      return makeList(this._origin, this._capacity, this._level, this._root, this._tail, ownerID, this.__hash);\n    };\n\n\n  function isList(maybeList) {\n    return !!(maybeList && maybeList[IS_LIST_SENTINEL]);\n  }\n\n  List.isList = isList;\n\n  var IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';\n\n  var ListPrototype = List.prototype;\n  ListPrototype[IS_LIST_SENTINEL] = true;\n  ListPrototype[DELETE] = ListPrototype.remove;\n  ListPrototype.setIn = MapPrototype.setIn;\n  ListPrototype.deleteIn =\n  ListPrototype.removeIn = MapPrototype.removeIn;\n  ListPrototype.update = MapPrototype.update;\n  ListPrototype.updateIn = MapPrototype.updateIn;\n  ListPrototype.mergeIn = MapPrototype.mergeIn;\n  ListPrototype.mergeDeepIn = MapPrototype.mergeDeepIn;\n  ListPrototype.withMutations = MapPrototype.withMutations;\n  ListPrototype.asMutable = MapPrototype.asMutable;\n  ListPrototype.asImmutable = MapPrototype.asImmutable;\n  ListPrototype.wasAltered = MapPrototype.wasAltered;\n\n\n\n    function VNode(array, ownerID) {\n      this.array = array;\n      this.ownerID = ownerID;\n    }\n\n    // TODO: seems like these methods are very similar\n\n    VNode.prototype.removeBefore = function(ownerID, level, index) {\n      if (index === level ? 1 << level : 0 || this.array.length === 0) {\n        return this;\n      }\n      var originIndex = (index >>> level) & MASK;\n      if (originIndex >= this.array.length) {\n        return new VNode([], ownerID);\n      }\n      var removingFirst = originIndex === 0;\n      var newChild;\n      if (level > 0) {\n        var oldChild = this.array[originIndex];\n        newChild = oldChild && oldChild.removeBefore(ownerID, level - SHIFT, index);\n        if (newChild === oldChild && removingFirst) {\n          return this;\n        }\n      }\n      if (removingFirst && !newChild) {\n        return this;\n      }\n      var editable = editableVNode(this, ownerID);\n      if (!removingFirst) {\n        for (var ii = 0; ii < originIndex; ii++) {\n          editable.array[ii] = undefined;\n        }\n      }\n      if (newChild) {\n        editable.array[originIndex] = newChild;\n      }\n      return editable;\n    };\n\n    VNode.prototype.removeAfter = function(ownerID, level, index) {\n      if (index === (level ? 1 << level : 0) || this.array.length === 0) {\n        return this;\n      }\n      var sizeIndex = ((index - 1) >>> level) & MASK;\n      if (sizeIndex >= this.array.length) {\n        return this;\n      }\n\n      var newChild;\n      if (level > 0) {\n        var oldChild = this.array[sizeIndex];\n        newChild = oldChild && oldChild.removeAfter(ownerID, level - SHIFT, index);\n        if (newChild === oldChild && sizeIndex === this.array.length - 1) {\n          return this;\n        }\n      }\n\n      var editable = editableVNode(this, ownerID);\n      editable.array.splice(sizeIndex + 1);\n      if (newChild) {\n        editable.array[sizeIndex] = newChild;\n      }\n      return editable;\n    };\n\n\n\n  var DONE = {};\n\n  function iterateList(list, reverse) {\n    var left = list._origin;\n    var right = list._capacity;\n    var tailPos = getTailOffset(right);\n    var tail = list._tail;\n\n    return iterateNodeOrLeaf(list._root, list._level, 0);\n\n    function iterateNodeOrLeaf(node, level, offset) {\n      return level === 0 ?\n        iterateLeaf(node, offset) :\n        iterateNode(node, level, offset);\n    }\n\n    function iterateLeaf(node, offset) {\n      var array = offset === tailPos ? tail && tail.array : node && node.array;\n      var from = offset > left ? 0 : left - offset;\n      var to = right - offset;\n      if (to > SIZE) {\n        to = SIZE;\n      }\n      return function()  {\n        if (from === to) {\n          return DONE;\n        }\n        var idx = reverse ? --to : from++;\n        return array && array[idx];\n      };\n    }\n\n    function iterateNode(node, level, offset) {\n      var values;\n      var array = node && node.array;\n      var from = offset > left ? 0 : (left - offset) >> level;\n      var to = ((right - offset) >> level) + 1;\n      if (to > SIZE) {\n        to = SIZE;\n      }\n      return function()  {\n        do {\n          if (values) {\n            var value = values();\n            if (value !== DONE) {\n              return value;\n            }\n            values = null;\n          }\n          if (from === to) {\n            return DONE;\n          }\n          var idx = reverse ? --to : from++;\n          values = iterateNodeOrLeaf(\n            array && array[idx], level - SHIFT, offset + (idx << level)\n          );\n        } while (true);\n      };\n    }\n  }\n\n  function makeList(origin, capacity, level, root, tail, ownerID, hash) {\n    var list = Object.create(ListPrototype);\n    list.size = capacity - origin;\n    list._origin = origin;\n    list._capacity = capacity;\n    list._level = level;\n    list._root = root;\n    list._tail = tail;\n    list.__ownerID = ownerID;\n    list.__hash = hash;\n    list.__altered = false;\n    return list;\n  }\n\n  var EMPTY_LIST;\n  function emptyList() {\n    return EMPTY_LIST || (EMPTY_LIST = makeList(0, 0, SHIFT));\n  }\n\n  function updateList(list, index, value) {\n    index = wrapIndex(list, index);\n\n    if (index !== index) {\n      return list;\n    }\n\n    if (index >= list.size || index < 0) {\n      return list.withMutations(function(list ) {\n        index < 0 ?\n          setListBounds(list, index).set(0, value) :\n          setListBounds(list, 0, index + 1).set(index, value)\n      });\n    }\n\n    index += list._origin;\n\n    var newTail = list._tail;\n    var newRoot = list._root;\n    var didAlter = MakeRef(DID_ALTER);\n    if (index >= getTailOffset(list._capacity)) {\n      newTail = updateVNode(newTail, list.__ownerID, 0, index, value, didAlter);\n    } else {\n      newRoot = updateVNode(newRoot, list.__ownerID, list._level, index, value, didAlter);\n    }\n\n    if (!didAlter.value) {\n      return list;\n    }\n\n    if (list.__ownerID) {\n      list._root = newRoot;\n      list._tail = newTail;\n      list.__hash = undefined;\n      list.__altered = true;\n      return list;\n    }\n    return makeList(list._origin, list._capacity, list._level, newRoot, newTail);\n  }\n\n  function updateVNode(node, ownerID, level, index, value, didAlter) {\n    var idx = (index >>> level) & MASK;\n    var nodeHas = node && idx < node.array.length;\n    if (!nodeHas && value === undefined) {\n      return node;\n    }\n\n    var newNode;\n\n    if (level > 0) {\n      var lowerNode = node && node.array[idx];\n      var newLowerNode = updateVNode(lowerNode, ownerID, level - SHIFT, index, value, didAlter);\n      if (newLowerNode === lowerNode) {\n        return node;\n      }\n      newNode = editableVNode(node, ownerID);\n      newNode.array[idx] = newLowerNode;\n      return newNode;\n    }\n\n    if (nodeHas && node.array[idx] === value) {\n      return node;\n    }\n\n    SetRef(didAlter);\n\n    newNode = editableVNode(node, ownerID);\n    if (value === undefined && idx === newNode.array.length - 1) {\n      newNode.array.pop();\n    } else {\n      newNode.array[idx] = value;\n    }\n    return newNode;\n  }\n\n  function editableVNode(node, ownerID) {\n    if (ownerID && node && ownerID === node.ownerID) {\n      return node;\n    }\n    return new VNode(node ? node.array.slice() : [], ownerID);\n  }\n\n  function listNodeFor(list, rawIndex) {\n    if (rawIndex >= getTailOffset(list._capacity)) {\n      return list._tail;\n    }\n    if (rawIndex < 1 << (list._level + SHIFT)) {\n      var node = list._root;\n      var level = list._level;\n      while (node && level > 0) {\n        node = node.array[(rawIndex >>> level) & MASK];\n        level -= SHIFT;\n      }\n      return node;\n    }\n  }\n\n  function setListBounds(list, begin, end) {\n    // Sanitize begin & end using this shorthand for ToInt32(argument)\n    // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32\n    if (begin !== undefined) {\n      begin = begin | 0;\n    }\n    if (end !== undefined) {\n      end = end | 0;\n    }\n    var owner = list.__ownerID || new OwnerID();\n    var oldOrigin = list._origin;\n    var oldCapacity = list._capacity;\n    var newOrigin = oldOrigin + begin;\n    var newCapacity = end === undefined ? oldCapacity : end < 0 ? oldCapacity + end : oldOrigin + end;\n    if (newOrigin === oldOrigin && newCapacity === oldCapacity) {\n      return list;\n    }\n\n    // If it's going to end after it starts, it's empty.\n    if (newOrigin >= newCapacity) {\n      return list.clear();\n    }\n\n    var newLevel = list._level;\n    var newRoot = list._root;\n\n    // New origin might need creating a higher root.\n    var offsetShift = 0;\n    while (newOrigin + offsetShift < 0) {\n      newRoot = new VNode(newRoot && newRoot.array.length ? [undefined, newRoot] : [], owner);\n      newLevel += SHIFT;\n      offsetShift += 1 << newLevel;\n    }\n    if (offsetShift) {\n      newOrigin += offsetShift;\n      oldOrigin += offsetShift;\n      newCapacity += offsetShift;\n      oldCapacity += offsetShift;\n    }\n\n    var oldTailOffset = getTailOffset(oldCapacity);\n    var newTailOffset = getTailOffset(newCapacity);\n\n    // New size might need creating a higher root.\n    while (newTailOffset >= 1 << (newLevel + SHIFT)) {\n      newRoot = new VNode(newRoot && newRoot.array.length ? [newRoot] : [], owner);\n      newLevel += SHIFT;\n    }\n\n    // Locate or create the new tail.\n    var oldTail = list._tail;\n    var newTail = newTailOffset < oldTailOffset ?\n      listNodeFor(list, newCapacity - 1) :\n      newTailOffset > oldTailOffset ? new VNode([], owner) : oldTail;\n\n    // Merge Tail into tree.\n    if (oldTail && newTailOffset > oldTailOffset && newOrigin < oldCapacity && oldTail.array.length) {\n      newRoot = editableVNode(newRoot, owner);\n      var node = newRoot;\n      for (var level = newLevel; level > SHIFT; level -= SHIFT) {\n        var idx = (oldTailOffset >>> level) & MASK;\n        node = node.array[idx] = editableVNode(node.array[idx], owner);\n      }\n      node.array[(oldTailOffset >>> SHIFT) & MASK] = oldTail;\n    }\n\n    // If the size has been reduced, there's a chance the tail needs to be trimmed.\n    if (newCapacity < oldCapacity) {\n      newTail = newTail && newTail.removeAfter(owner, 0, newCapacity);\n    }\n\n    // If the new origin is within the tail, then we do not need a root.\n    if (newOrigin >= newTailOffset) {\n      newOrigin -= newTailOffset;\n      newCapacity -= newTailOffset;\n      newLevel = SHIFT;\n      newRoot = null;\n      newTail = newTail && newTail.removeBefore(owner, 0, newOrigin);\n\n    // Otherwise, if the root has been trimmed, garbage collect.\n    } else if (newOrigin > oldOrigin || newTailOffset < oldTailOffset) {\n      offsetShift = 0;\n\n      // Identify the new top root node of the subtree of the old root.\n      while (newRoot) {\n        var beginIndex = (newOrigin >>> newLevel) & MASK;\n        if (beginIndex !== (newTailOffset >>> newLevel) & MASK) {\n          break;\n        }\n        if (beginIndex) {\n          offsetShift += (1 << newLevel) * beginIndex;\n        }\n        newLevel -= SHIFT;\n        newRoot = newRoot.array[beginIndex];\n      }\n\n      // Trim the new sides of the new root.\n      if (newRoot && newOrigin > oldOrigin) {\n        newRoot = newRoot.removeBefore(owner, newLevel, newOrigin - offsetShift);\n      }\n      if (newRoot && newTailOffset < oldTailOffset) {\n        newRoot = newRoot.removeAfter(owner, newLevel, newTailOffset - offsetShift);\n      }\n      if (offsetShift) {\n        newOrigin -= offsetShift;\n        newCapacity -= offsetShift;\n      }\n    }\n\n    if (list.__ownerID) {\n      list.size = newCapacity - newOrigin;\n      list._origin = newOrigin;\n      list._capacity = newCapacity;\n      list._level = newLevel;\n      list._root = newRoot;\n      list._tail = newTail;\n      list.__hash = undefined;\n      list.__altered = true;\n      return list;\n    }\n    return makeList(newOrigin, newCapacity, newLevel, newRoot, newTail);\n  }\n\n  function mergeIntoListWith(list, merger, iterables) {\n    var iters = [];\n    var maxSize = 0;\n    for (var ii = 0; ii < iterables.length; ii++) {\n      var value = iterables[ii];\n      var iter = IndexedIterable(value);\n      if (iter.size > maxSize) {\n        maxSize = iter.size;\n      }\n      if (!isIterable(value)) {\n        iter = iter.map(function(v ) {return fromJS(v)});\n      }\n      iters.push(iter);\n    }\n    if (maxSize > list.size) {\n      list = list.setSize(maxSize);\n    }\n    return mergeIntoCollectionWith(list, merger, iters);\n  }\n\n  function getTailOffset(size) {\n    return size < SIZE ? 0 : (((size - 1) >>> SHIFT) << SHIFT);\n  }\n\n  createClass(OrderedMap, Map);\n\n    // @pragma Construction\n\n    function OrderedMap(value) {\n      return value === null || value === undefined ? emptyOrderedMap() :\n        isOrderedMap(value) ? value :\n        emptyOrderedMap().withMutations(function(map ) {\n          var iter = KeyedIterable(value);\n          assertNotInfinite(iter.size);\n          iter.forEach(function(v, k)  {return map.set(k, v)});\n        });\n    }\n\n    OrderedMap.of = function(/*...values*/) {\n      return this(arguments);\n    };\n\n    OrderedMap.prototype.toString = function() {\n      return this.__toString('OrderedMap {', '}');\n    };\n\n    // @pragma Access\n\n    OrderedMap.prototype.get = function(k, notSetValue) {\n      var index = this._map.get(k);\n      return index !== undefined ? this._list.get(index)[1] : notSetValue;\n    };\n\n    // @pragma Modification\n\n    OrderedMap.prototype.clear = function() {\n      if (this.size === 0) {\n        return this;\n      }\n      if (this.__ownerID) {\n        this.size = 0;\n        this._map.clear();\n        this._list.clear();\n        return this;\n      }\n      return emptyOrderedMap();\n    };\n\n    OrderedMap.prototype.set = function(k, v) {\n      return updateOrderedMap(this, k, v);\n    };\n\n    OrderedMap.prototype.remove = function(k) {\n      return updateOrderedMap(this, k, NOT_SET);\n    };\n\n    OrderedMap.prototype.wasAltered = function() {\n      return this._map.wasAltered() || this._list.wasAltered();\n    };\n\n    OrderedMap.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n      return this._list.__iterate(\n        function(entry ) {return entry && fn(entry[1], entry[0], this$0)},\n        reverse\n      );\n    };\n\n    OrderedMap.prototype.__iterator = function(type, reverse) {\n      return this._list.fromEntrySeq().__iterator(type, reverse);\n    };\n\n    OrderedMap.prototype.__ensureOwner = function(ownerID) {\n      if (ownerID === this.__ownerID) {\n        return this;\n      }\n      var newMap = this._map.__ensureOwner(ownerID);\n      var newList = this._list.__ensureOwner(ownerID);\n      if (!ownerID) {\n        this.__ownerID = ownerID;\n        this._map = newMap;\n        this._list = newList;\n        return this;\n      }\n      return makeOrderedMap(newMap, newList, ownerID, this.__hash);\n    };\n\n\n  function isOrderedMap(maybeOrderedMap) {\n    return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap);\n  }\n\n  OrderedMap.isOrderedMap = isOrderedMap;\n\n  OrderedMap.prototype[IS_ORDERED_SENTINEL] = true;\n  OrderedMap.prototype[DELETE] = OrderedMap.prototype.remove;\n\n\n\n  function makeOrderedMap(map, list, ownerID, hash) {\n    var omap = Object.create(OrderedMap.prototype);\n    omap.size = map ? map.size : 0;\n    omap._map = map;\n    omap._list = list;\n    omap.__ownerID = ownerID;\n    omap.__hash = hash;\n    return omap;\n  }\n\n  var EMPTY_ORDERED_MAP;\n  function emptyOrderedMap() {\n    return EMPTY_ORDERED_MAP || (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList()));\n  }\n\n  function updateOrderedMap(omap, k, v) {\n    var map = omap._map;\n    var list = omap._list;\n    var i = map.get(k);\n    var has = i !== undefined;\n    var newMap;\n    var newList;\n    if (v === NOT_SET) { // removed\n      if (!has) {\n        return omap;\n      }\n      if (list.size >= SIZE && list.size >= map.size * 2) {\n        newList = list.filter(function(entry, idx)  {return entry !== undefined && i !== idx});\n        newMap = newList.toKeyedSeq().map(function(entry ) {return entry[0]}).flip().toMap();\n        if (omap.__ownerID) {\n          newMap.__ownerID = newList.__ownerID = omap.__ownerID;\n        }\n      } else {\n        newMap = map.remove(k);\n        newList = i === list.size - 1 ? list.pop() : list.set(i, undefined);\n      }\n    } else {\n      if (has) {\n        if (v === list.get(i)[1]) {\n          return omap;\n        }\n        newMap = map;\n        newList = list.set(i, [k, v]);\n      } else {\n        newMap = map.set(k, list.size);\n        newList = list.set(list.size, [k, v]);\n      }\n    }\n    if (omap.__ownerID) {\n      omap.size = newMap.size;\n      omap._map = newMap;\n      omap._list = newList;\n      omap.__hash = undefined;\n      return omap;\n    }\n    return makeOrderedMap(newMap, newList);\n  }\n\n  createClass(ToKeyedSequence, KeyedSeq);\n    function ToKeyedSequence(indexed, useKeys) {\n      this._iter = indexed;\n      this._useKeys = useKeys;\n      this.size = indexed.size;\n    }\n\n    ToKeyedSequence.prototype.get = function(key, notSetValue) {\n      return this._iter.get(key, notSetValue);\n    };\n\n    ToKeyedSequence.prototype.has = function(key) {\n      return this._iter.has(key);\n    };\n\n    ToKeyedSequence.prototype.valueSeq = function() {\n      return this._iter.valueSeq();\n    };\n\n    ToKeyedSequence.prototype.reverse = function() {var this$0 = this;\n      var reversedSequence = reverseFactory(this, true);\n      if (!this._useKeys) {\n        reversedSequence.valueSeq = function()  {return this$0._iter.toSeq().reverse()};\n      }\n      return reversedSequence;\n    };\n\n    ToKeyedSequence.prototype.map = function(mapper, context) {var this$0 = this;\n      var mappedSequence = mapFactory(this, mapper, context);\n      if (!this._useKeys) {\n        mappedSequence.valueSeq = function()  {return this$0._iter.toSeq().map(mapper, context)};\n      }\n      return mappedSequence;\n    };\n\n    ToKeyedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n      var ii;\n      return this._iter.__iterate(\n        this._useKeys ?\n          function(v, k)  {return fn(v, k, this$0)} :\n          ((ii = reverse ? resolveSize(this) : 0),\n            function(v ) {return fn(v, reverse ? --ii : ii++, this$0)}),\n        reverse\n      );\n    };\n\n    ToKeyedSequence.prototype.__iterator = function(type, reverse) {\n      if (this._useKeys) {\n        return this._iter.__iterator(type, reverse);\n      }\n      var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n      var ii = reverse ? resolveSize(this) : 0;\n      return new Iterator(function()  {\n        var step = iterator.next();\n        return step.done ? step :\n          iteratorValue(type, reverse ? --ii : ii++, step.value, step);\n      });\n    };\n\n  ToKeyedSequence.prototype[IS_ORDERED_SENTINEL] = true;\n\n\n  createClass(ToIndexedSequence, IndexedSeq);\n    function ToIndexedSequence(iter) {\n      this._iter = iter;\n      this.size = iter.size;\n    }\n\n    ToIndexedSequence.prototype.includes = function(value) {\n      return this._iter.includes(value);\n    };\n\n    ToIndexedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n      var iterations = 0;\n      return this._iter.__iterate(function(v ) {return fn(v, iterations++, this$0)}, reverse);\n    };\n\n    ToIndexedSequence.prototype.__iterator = function(type, reverse) {\n      var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n      var iterations = 0;\n      return new Iterator(function()  {\n        var step = iterator.next();\n        return step.done ? step :\n          iteratorValue(type, iterations++, step.value, step)\n      });\n    };\n\n\n\n  createClass(ToSetSequence, SetSeq);\n    function ToSetSequence(iter) {\n      this._iter = iter;\n      this.size = iter.size;\n    }\n\n    ToSetSequence.prototype.has = function(key) {\n      return this._iter.includes(key);\n    };\n\n    ToSetSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n      return this._iter.__iterate(function(v ) {return fn(v, v, this$0)}, reverse);\n    };\n\n    ToSetSequence.prototype.__iterator = function(type, reverse) {\n      var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n      return new Iterator(function()  {\n        var step = iterator.next();\n        return step.done ? step :\n          iteratorValue(type, step.value, step.value, step);\n      });\n    };\n\n\n\n  createClass(FromEntriesSequence, KeyedSeq);\n    function FromEntriesSequence(entries) {\n      this._iter = entries;\n      this.size = entries.size;\n    }\n\n    FromEntriesSequence.prototype.entrySeq = function() {\n      return this._iter.toSeq();\n    };\n\n    FromEntriesSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n      return this._iter.__iterate(function(entry ) {\n        // Check if entry exists first so array access doesn't throw for holes\n        // in the parent iteration.\n        if (entry) {\n          validateEntry(entry);\n          var indexedIterable = isIterable(entry);\n          return fn(\n            indexedIterable ? entry.get(1) : entry[1],\n            indexedIterable ? entry.get(0) : entry[0],\n            this$0\n          );\n        }\n      }, reverse);\n    };\n\n    FromEntriesSequence.prototype.__iterator = function(type, reverse) {\n      var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n      return new Iterator(function()  {\n        while (true) {\n          var step = iterator.next();\n          if (step.done) {\n            return step;\n          }\n          var entry = step.value;\n          // Check if entry exists first so array access doesn't throw for holes\n          // in the parent iteration.\n          if (entry) {\n            validateEntry(entry);\n            var indexedIterable = isIterable(entry);\n            return iteratorValue(\n              type,\n              indexedIterable ? entry.get(0) : entry[0],\n              indexedIterable ? entry.get(1) : entry[1],\n              step\n            );\n          }\n        }\n      });\n    };\n\n\n  ToIndexedSequence.prototype.cacheResult =\n  ToKeyedSequence.prototype.cacheResult =\n  ToSetSequence.prototype.cacheResult =\n  FromEntriesSequence.prototype.cacheResult =\n    cacheResultThrough;\n\n\n  function flipFactory(iterable) {\n    var flipSequence = makeSequence(iterable);\n    flipSequence._iter = iterable;\n    flipSequence.size = iterable.size;\n    flipSequence.flip = function()  {return iterable};\n    flipSequence.reverse = function () {\n      var reversedSequence = iterable.reverse.apply(this); // super.reverse()\n      reversedSequence.flip = function()  {return iterable.reverse()};\n      return reversedSequence;\n    };\n    flipSequence.has = function(key ) {return iterable.includes(key)};\n    flipSequence.includes = function(key ) {return iterable.has(key)};\n    flipSequence.cacheResult = cacheResultThrough;\n    flipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n      return iterable.__iterate(function(v, k)  {return fn(k, v, this$0) !== false}, reverse);\n    }\n    flipSequence.__iteratorUncached = function(type, reverse) {\n      if (type === ITERATE_ENTRIES) {\n        var iterator = iterable.__iterator(type, reverse);\n        return new Iterator(function()  {\n          var step = iterator.next();\n          if (!step.done) {\n            var k = step.value[0];\n            step.value[0] = step.value[1];\n            step.value[1] = k;\n          }\n          return step;\n        });\n      }\n      return iterable.__iterator(\n        type === ITERATE_VALUES ? ITERATE_KEYS : ITERATE_VALUES,\n        reverse\n      );\n    }\n    return flipSequence;\n  }\n\n\n  function mapFactory(iterable, mapper, context) {\n    var mappedSequence = makeSequence(iterable);\n    mappedSequence.size = iterable.size;\n    mappedSequence.has = function(key ) {return iterable.has(key)};\n    mappedSequence.get = function(key, notSetValue)  {\n      var v = iterable.get(key, NOT_SET);\n      return v === NOT_SET ?\n        notSetValue :\n        mapper.call(context, v, key, iterable);\n    };\n    mappedSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n      return iterable.__iterate(\n        function(v, k, c)  {return fn(mapper.call(context, v, k, c), k, this$0) !== false},\n        reverse\n      );\n    }\n    mappedSequence.__iteratorUncached = function (type, reverse) {\n      var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n      return new Iterator(function()  {\n        var step = iterator.next();\n        if (step.done) {\n          return step;\n        }\n        var entry = step.value;\n        var key = entry[0];\n        return iteratorValue(\n          type,\n          key,\n          mapper.call(context, entry[1], key, iterable),\n          step\n        );\n      });\n    }\n    return mappedSequence;\n  }\n\n\n  function reverseFactory(iterable, useKeys) {\n    var reversedSequence = makeSequence(iterable);\n    reversedSequence._iter = iterable;\n    reversedSequence.size = iterable.size;\n    reversedSequence.reverse = function()  {return iterable};\n    if (iterable.flip) {\n      reversedSequence.flip = function () {\n        var flipSequence = flipFactory(iterable);\n        flipSequence.reverse = function()  {return iterable.flip()};\n        return flipSequence;\n      };\n    }\n    reversedSequence.get = function(key, notSetValue) \n      {return iterable.get(useKeys ? key : -1 - key, notSetValue)};\n    reversedSequence.has = function(key )\n      {return iterable.has(useKeys ? key : -1 - key)};\n    reversedSequence.includes = function(value ) {return iterable.includes(value)};\n    reversedSequence.cacheResult = cacheResultThrough;\n    reversedSequence.__iterate = function (fn, reverse) {var this$0 = this;\n      return iterable.__iterate(function(v, k)  {return fn(v, k, this$0)}, !reverse);\n    };\n    reversedSequence.__iterator =\n      function(type, reverse)  {return iterable.__iterator(type, !reverse)};\n    return reversedSequence;\n  }\n\n\n  function filterFactory(iterable, predicate, context, useKeys) {\n    var filterSequence = makeSequence(iterable);\n    if (useKeys) {\n      filterSequence.has = function(key ) {\n        var v = iterable.get(key, NOT_SET);\n        return v !== NOT_SET && !!predicate.call(context, v, key, iterable);\n      };\n      filterSequence.get = function(key, notSetValue)  {\n        var v = iterable.get(key, NOT_SET);\n        return v !== NOT_SET && predicate.call(context, v, key, iterable) ?\n          v : notSetValue;\n      };\n    }\n    filterSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n      var iterations = 0;\n      iterable.__iterate(function(v, k, c)  {\n        if (predicate.call(context, v, k, c)) {\n          iterations++;\n          return fn(v, useKeys ? k : iterations - 1, this$0);\n        }\n      }, reverse);\n      return iterations;\n    };\n    filterSequence.__iteratorUncached = function (type, reverse) {\n      var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n      var iterations = 0;\n      return new Iterator(function()  {\n        while (true) {\n          var step = iterator.next();\n          if (step.done) {\n            return step;\n          }\n          var entry = step.value;\n          var key = entry[0];\n          var value = entry[1];\n          if (predicate.call(context, value, key, iterable)) {\n            return iteratorValue(type, useKeys ? key : iterations++, value, step);\n          }\n        }\n      });\n    }\n    return filterSequence;\n  }\n\n\n  function countByFactory(iterable, grouper, context) {\n    var groups = Map().asMutable();\n    iterable.__iterate(function(v, k)  {\n      groups.update(\n        grouper.call(context, v, k, iterable),\n        0,\n        function(a ) {return a + 1}\n      );\n    });\n    return groups.asImmutable();\n  }\n\n\n  function groupByFactory(iterable, grouper, context) {\n    var isKeyedIter = isKeyed(iterable);\n    var groups = (isOrdered(iterable) ? OrderedMap() : Map()).asMutable();\n    iterable.__iterate(function(v, k)  {\n      groups.update(\n        grouper.call(context, v, k, iterable),\n        function(a ) {return (a = a || [], a.push(isKeyedIter ? [k, v] : v), a)}\n      );\n    });\n    var coerce = iterableClass(iterable);\n    return groups.map(function(arr ) {return reify(iterable, coerce(arr))});\n  }\n\n\n  function sliceFactory(iterable, begin, end, useKeys) {\n    var originalSize = iterable.size;\n\n    // Sanitize begin & end using this shorthand for ToInt32(argument)\n    // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32\n    if (begin !== undefined) {\n      begin = begin | 0;\n    }\n    if (end !== undefined) {\n      end = end | 0;\n    }\n\n    if (wholeSlice(begin, end, originalSize)) {\n      return iterable;\n    }\n\n    var resolvedBegin = resolveBegin(begin, originalSize);\n    var resolvedEnd = resolveEnd(end, originalSize);\n\n    // begin or end will be NaN if they were provided as negative numbers and\n    // this iterable's size is unknown. In that case, cache first so there is\n    // a known size and these do not resolve to NaN.\n    if (resolvedBegin !== resolvedBegin || resolvedEnd !== resolvedEnd) {\n      return sliceFactory(iterable.toSeq().cacheResult(), begin, end, useKeys);\n    }\n\n    // Note: resolvedEnd is undefined when the original sequence's length is\n    // unknown and this slice did not supply an end and should contain all\n    // elements after resolvedBegin.\n    // In that case, resolvedSize will be NaN and sliceSize will remain undefined.\n    var resolvedSize = resolvedEnd - resolvedBegin;\n    var sliceSize;\n    if (resolvedSize === resolvedSize) {\n      sliceSize = resolvedSize < 0 ? 0 : resolvedSize;\n    }\n\n    var sliceSeq = makeSequence(iterable);\n\n    // If iterable.size is undefined, the size of the realized sliceSeq is\n    // unknown at this point unless the number of items to slice is 0\n    sliceSeq.size = sliceSize === 0 ? sliceSize : iterable.size && sliceSize || undefined;\n\n    if (!useKeys && isSeq(iterable) && sliceSize >= 0) {\n      sliceSeq.get = function (index, notSetValue) {\n        index = wrapIndex(this, index);\n        return index >= 0 && index < sliceSize ?\n          iterable.get(index + resolvedBegin, notSetValue) :\n          notSetValue;\n      }\n    }\n\n    sliceSeq.__iterateUncached = function(fn, reverse) {var this$0 = this;\n      if (sliceSize === 0) {\n        return 0;\n      }\n      if (reverse) {\n        return this.cacheResult().__iterate(fn, reverse);\n      }\n      var skipped = 0;\n      var isSkipping = true;\n      var iterations = 0;\n      iterable.__iterate(function(v, k)  {\n        if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) {\n          iterations++;\n          return fn(v, useKeys ? k : iterations - 1, this$0) !== false &&\n                 iterations !== sliceSize;\n        }\n      });\n      return iterations;\n    };\n\n    sliceSeq.__iteratorUncached = function(type, reverse) {\n      if (sliceSize !== 0 && reverse) {\n        return this.cacheResult().__iterator(type, reverse);\n      }\n      // Don't bother instantiating parent iterator if taking 0.\n      var iterator = sliceSize !== 0 && iterable.__iterator(type, reverse);\n      var skipped = 0;\n      var iterations = 0;\n      return new Iterator(function()  {\n        while (skipped++ < resolvedBegin) {\n          iterator.next();\n        }\n        if (++iterations > sliceSize) {\n          return iteratorDone();\n        }\n        var step = iterator.next();\n        if (useKeys || type === ITERATE_VALUES) {\n          return step;\n        } else if (type === ITERATE_KEYS) {\n          return iteratorValue(type, iterations - 1, undefined, step);\n        } else {\n          return iteratorValue(type, iterations - 1, step.value[1], step);\n        }\n      });\n    }\n\n    return sliceSeq;\n  }\n\n\n  function takeWhileFactory(iterable, predicate, context) {\n    var takeSequence = makeSequence(iterable);\n    takeSequence.__iterateUncached = function(fn, reverse) {var this$0 = this;\n      if (reverse) {\n        return this.cacheResult().__iterate(fn, reverse);\n      }\n      var iterations = 0;\n      iterable.__iterate(function(v, k, c) \n        {return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$0)}\n      );\n      return iterations;\n    };\n    takeSequence.__iteratorUncached = function(type, reverse) {var this$0 = this;\n      if (reverse) {\n        return this.cacheResult().__iterator(type, reverse);\n      }\n      var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n      var iterating = true;\n      return new Iterator(function()  {\n        if (!iterating) {\n          return iteratorDone();\n        }\n        var step = iterator.next();\n        if (step.done) {\n          return step;\n        }\n        var entry = step.value;\n        var k = entry[0];\n        var v = entry[1];\n        if (!predicate.call(context, v, k, this$0)) {\n          iterating = false;\n          return iteratorDone();\n        }\n        return type === ITERATE_ENTRIES ? step :\n          iteratorValue(type, k, v, step);\n      });\n    };\n    return takeSequence;\n  }\n\n\n  function skipWhileFactory(iterable, predicate, context, useKeys) {\n    var skipSequence = makeSequence(iterable);\n    skipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n      if (reverse) {\n        return this.cacheResult().__iterate(fn, reverse);\n      }\n      var isSkipping = true;\n      var iterations = 0;\n      iterable.__iterate(function(v, k, c)  {\n        if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) {\n          iterations++;\n          return fn(v, useKeys ? k : iterations - 1, this$0);\n        }\n      });\n      return iterations;\n    };\n    skipSequence.__iteratorUncached = function(type, reverse) {var this$0 = this;\n      if (reverse) {\n        return this.cacheResult().__iterator(type, reverse);\n      }\n      var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n      var skipping = true;\n      var iterations = 0;\n      return new Iterator(function()  {\n        var step, k, v;\n        do {\n          step = iterator.next();\n          if (step.done) {\n            if (useKeys || type === ITERATE_VALUES) {\n              return step;\n            } else if (type === ITERATE_KEYS) {\n              return iteratorValue(type, iterations++, undefined, step);\n            } else {\n              return iteratorValue(type, iterations++, step.value[1], step);\n            }\n          }\n          var entry = step.value;\n          k = entry[0];\n          v = entry[1];\n          skipping && (skipping = predicate.call(context, v, k, this$0));\n        } while (skipping);\n        return type === ITERATE_ENTRIES ? step :\n          iteratorValue(type, k, v, step);\n      });\n    };\n    return skipSequence;\n  }\n\n\n  function concatFactory(iterable, values) {\n    var isKeyedIterable = isKeyed(iterable);\n    var iters = [iterable].concat(values).map(function(v ) {\n      if (!isIterable(v)) {\n        v = isKeyedIterable ?\n          keyedSeqFromValue(v) :\n          indexedSeqFromValue(Array.isArray(v) ? v : [v]);\n      } else if (isKeyedIterable) {\n        v = KeyedIterable(v);\n      }\n      return v;\n    }).filter(function(v ) {return v.size !== 0});\n\n    if (iters.length === 0) {\n      return iterable;\n    }\n\n    if (iters.length === 1) {\n      var singleton = iters[0];\n      if (singleton === iterable ||\n          isKeyedIterable && isKeyed(singleton) ||\n          isIndexed(iterable) && isIndexed(singleton)) {\n        return singleton;\n      }\n    }\n\n    var concatSeq = new ArraySeq(iters);\n    if (isKeyedIterable) {\n      concatSeq = concatSeq.toKeyedSeq();\n    } else if (!isIndexed(iterable)) {\n      concatSeq = concatSeq.toSetSeq();\n    }\n    concatSeq = concatSeq.flatten(true);\n    concatSeq.size = iters.reduce(\n      function(sum, seq)  {\n        if (sum !== undefined) {\n          var size = seq.size;\n          if (size !== undefined) {\n            return sum + size;\n          }\n        }\n      },\n      0\n    );\n    return concatSeq;\n  }\n\n\n  function flattenFactory(iterable, depth, useKeys) {\n    var flatSequence = makeSequence(iterable);\n    flatSequence.__iterateUncached = function(fn, reverse) {\n      var iterations = 0;\n      var stopped = false;\n      function flatDeep(iter, currentDepth) {var this$0 = this;\n        iter.__iterate(function(v, k)  {\n          if ((!depth || currentDepth < depth) && isIterable(v)) {\n            flatDeep(v, currentDepth + 1);\n          } else if (fn(v, useKeys ? k : iterations++, this$0) === false) {\n            stopped = true;\n          }\n          return !stopped;\n        }, reverse);\n      }\n      flatDeep(iterable, 0);\n      return iterations;\n    }\n    flatSequence.__iteratorUncached = function(type, reverse) {\n      var iterator = iterable.__iterator(type, reverse);\n      var stack = [];\n      var iterations = 0;\n      return new Iterator(function()  {\n        while (iterator) {\n          var step = iterator.next();\n          if (step.done !== false) {\n            iterator = stack.pop();\n            continue;\n          }\n          var v = step.value;\n          if (type === ITERATE_ENTRIES) {\n            v = v[1];\n          }\n          if ((!depth || stack.length < depth) && isIterable(v)) {\n            stack.push(iterator);\n            iterator = v.__iterator(type, reverse);\n          } else {\n            return useKeys ? step : iteratorValue(type, iterations++, v, step);\n          }\n        }\n        return iteratorDone();\n      });\n    }\n    return flatSequence;\n  }\n\n\n  function flatMapFactory(iterable, mapper, context) {\n    var coerce = iterableClass(iterable);\n    return iterable.toSeq().map(\n      function(v, k)  {return coerce(mapper.call(context, v, k, iterable))}\n    ).flatten(true);\n  }\n\n\n  function interposeFactory(iterable, separator) {\n    var interposedSequence = makeSequence(iterable);\n    interposedSequence.size = iterable.size && iterable.size * 2 -1;\n    interposedSequence.__iterateUncached = function(fn, reverse) {var this$0 = this;\n      var iterations = 0;\n      iterable.__iterate(function(v, k) \n        {return (!iterations || fn(separator, iterations++, this$0) !== false) &&\n        fn(v, iterations++, this$0) !== false},\n        reverse\n      );\n      return iterations;\n    };\n    interposedSequence.__iteratorUncached = function(type, reverse) {\n      var iterator = iterable.__iterator(ITERATE_VALUES, reverse);\n      var iterations = 0;\n      var step;\n      return new Iterator(function()  {\n        if (!step || iterations % 2) {\n          step = iterator.next();\n          if (step.done) {\n            return step;\n          }\n        }\n        return iterations % 2 ?\n          iteratorValue(type, iterations++, separator) :\n          iteratorValue(type, iterations++, step.value, step);\n      });\n    };\n    return interposedSequence;\n  }\n\n\n  function sortFactory(iterable, comparator, mapper) {\n    if (!comparator) {\n      comparator = defaultComparator;\n    }\n    var isKeyedIterable = isKeyed(iterable);\n    var index = 0;\n    var entries = iterable.toSeq().map(\n      function(v, k)  {return [k, v, index++, mapper ? mapper(v, k, iterable) : v]}\n    ).toArray();\n    entries.sort(function(a, b)  {return comparator(a[3], b[3]) || a[2] - b[2]}).forEach(\n      isKeyedIterable ?\n      function(v, i)  { entries[i].length = 2; } :\n      function(v, i)  { entries[i] = v[1]; }\n    );\n    return isKeyedIterable ? KeyedSeq(entries) :\n      isIndexed(iterable) ? IndexedSeq(entries) :\n      SetSeq(entries);\n  }\n\n\n  function maxFactory(iterable, comparator, mapper) {\n    if (!comparator) {\n      comparator = defaultComparator;\n    }\n    if (mapper) {\n      var entry = iterable.toSeq()\n        .map(function(v, k)  {return [v, mapper(v, k, iterable)]})\n        .reduce(function(a, b)  {return maxCompare(comparator, a[1], b[1]) ? b : a});\n      return entry && entry[0];\n    } else {\n      return iterable.reduce(function(a, b)  {return maxCompare(comparator, a, b) ? b : a});\n    }\n  }\n\n  function maxCompare(comparator, a, b) {\n    var comp = comparator(b, a);\n    // b is considered the new max if the comparator declares them equal, but\n    // they are not equal and b is in fact a nullish value.\n    return (comp === 0 && b !== a && (b === undefined || b === null || b !== b)) || comp > 0;\n  }\n\n\n  function zipWithFactory(keyIter, zipper, iters) {\n    var zipSequence = makeSequence(keyIter);\n    zipSequence.size = new ArraySeq(iters).map(function(i ) {return i.size}).min();\n    // Note: this a generic base implementation of __iterate in terms of\n    // __iterator which may be more generically useful in the future.\n    zipSequence.__iterate = function(fn, reverse) {\n      /* generic:\n      var iterator = this.__iterator(ITERATE_ENTRIES, reverse);\n      var step;\n      var iterations = 0;\n      while (!(step = iterator.next()).done) {\n        iterations++;\n        if (fn(step.value[1], step.value[0], this) === false) {\n          break;\n        }\n      }\n      return iterations;\n      */\n      // indexed:\n      var iterator = this.__iterator(ITERATE_VALUES, reverse);\n      var step;\n      var iterations = 0;\n      while (!(step = iterator.next()).done) {\n        if (fn(step.value, iterations++, this) === false) {\n          break;\n        }\n      }\n      return iterations;\n    };\n    zipSequence.__iteratorUncached = function(type, reverse) {\n      var iterators = iters.map(function(i )\n        {return (i = Iterable(i), getIterator(reverse ? i.reverse() : i))}\n      );\n      var iterations = 0;\n      var isDone = false;\n      return new Iterator(function()  {\n        var steps;\n        if (!isDone) {\n          steps = iterators.map(function(i ) {return i.next()});\n          isDone = steps.some(function(s ) {return s.done});\n        }\n        if (isDone) {\n          return iteratorDone();\n        }\n        return iteratorValue(\n          type,\n          iterations++,\n          zipper.apply(null, steps.map(function(s ) {return s.value}))\n        );\n      });\n    };\n    return zipSequence\n  }\n\n\n  // #pragma Helper Functions\n\n  function reify(iter, seq) {\n    return isSeq(iter) ? seq : iter.constructor(seq);\n  }\n\n  function validateEntry(entry) {\n    if (entry !== Object(entry)) {\n      throw new TypeError('Expected [K, V] tuple: ' + entry);\n    }\n  }\n\n  function resolveSize(iter) {\n    assertNotInfinite(iter.size);\n    return ensureSize(iter);\n  }\n\n  function iterableClass(iterable) {\n    return isKeyed(iterable) ? KeyedIterable :\n      isIndexed(iterable) ? IndexedIterable :\n      SetIterable;\n  }\n\n  function makeSequence(iterable) {\n    return Object.create(\n      (\n        isKeyed(iterable) ? KeyedSeq :\n        isIndexed(iterable) ? IndexedSeq :\n        SetSeq\n      ).prototype\n    );\n  }\n\n  function cacheResultThrough() {\n    if (this._iter.cacheResult) {\n      this._iter.cacheResult();\n      this.size = this._iter.size;\n      return this;\n    } else {\n      return Seq.prototype.cacheResult.call(this);\n    }\n  }\n\n  function defaultComparator(a, b) {\n    return a > b ? 1 : a < b ? -1 : 0;\n  }\n\n  function forceIterator(keyPath) {\n    var iter = getIterator(keyPath);\n    if (!iter) {\n      // Array might not be iterable in this environment, so we need a fallback\n      // to our wrapped type.\n      if (!isArrayLike(keyPath)) {\n        throw new TypeError('Expected iterable or array-like: ' + keyPath);\n      }\n      iter = getIterator(Iterable(keyPath));\n    }\n    return iter;\n  }\n\n  createClass(Record, KeyedCollection);\n\n    function Record(defaultValues, name) {\n      var hasInitialized;\n\n      var RecordType = function Record(values) {\n        if (values instanceof RecordType) {\n          return values;\n        }\n        if (!(this instanceof RecordType)) {\n          return new RecordType(values);\n        }\n        if (!hasInitialized) {\n          hasInitialized = true;\n          var keys = Object.keys(defaultValues);\n          setProps(RecordTypePrototype, keys);\n          RecordTypePrototype.size = keys.length;\n          RecordTypePrototype._name = name;\n          RecordTypePrototype._keys = keys;\n          RecordTypePrototype._defaultValues = defaultValues;\n        }\n        this._map = Map(values);\n      };\n\n      var RecordTypePrototype = RecordType.prototype = Object.create(RecordPrototype);\n      RecordTypePrototype.constructor = RecordType;\n\n      return RecordType;\n    }\n\n    Record.prototype.toString = function() {\n      return this.__toString(recordName(this) + ' {', '}');\n    };\n\n    // @pragma Access\n\n    Record.prototype.has = function(k) {\n      return this._defaultValues.hasOwnProperty(k);\n    };\n\n    Record.prototype.get = function(k, notSetValue) {\n      if (!this.has(k)) {\n        return notSetValue;\n      }\n      var defaultVal = this._defaultValues[k];\n      return this._map ? this._map.get(k, defaultVal) : defaultVal;\n    };\n\n    // @pragma Modification\n\n    Record.prototype.clear = function() {\n      if (this.__ownerID) {\n        this._map && this._map.clear();\n        return this;\n      }\n      var RecordType = this.constructor;\n      return RecordType._empty || (RecordType._empty = makeRecord(this, emptyMap()));\n    };\n\n    Record.prototype.set = function(k, v) {\n      if (!this.has(k)) {\n        throw new Error('Cannot set unknown key \"' + k + '\" on ' + recordName(this));\n      }\n      var newMap = this._map && this._map.set(k, v);\n      if (this.__ownerID || newMap === this._map) {\n        return this;\n      }\n      return makeRecord(this, newMap);\n    };\n\n    Record.prototype.remove = function(k) {\n      if (!this.has(k)) {\n        return this;\n      }\n      var newMap = this._map && this._map.remove(k);\n      if (this.__ownerID || newMap === this._map) {\n        return this;\n      }\n      return makeRecord(this, newMap);\n    };\n\n    Record.prototype.wasAltered = function() {\n      return this._map.wasAltered();\n    };\n\n    Record.prototype.__iterator = function(type, reverse) {var this$0 = this;\n      return KeyedIterable(this._defaultValues).map(function(_, k)  {return this$0.get(k)}).__iterator(type, reverse);\n    };\n\n    Record.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n      return KeyedIterable(this._defaultValues).map(function(_, k)  {return this$0.get(k)}).__iterate(fn, reverse);\n    };\n\n    Record.prototype.__ensureOwner = function(ownerID) {\n      if (ownerID === this.__ownerID) {\n        return this;\n      }\n      var newMap = this._map && this._map.__ensureOwner(ownerID);\n      if (!ownerID) {\n        this.__ownerID = ownerID;\n        this._map = newMap;\n        return this;\n      }\n      return makeRecord(this, newMap, ownerID);\n    };\n\n\n  var RecordPrototype = Record.prototype;\n  RecordPrototype[DELETE] = RecordPrototype.remove;\n  RecordPrototype.deleteIn =\n  RecordPrototype.removeIn = MapPrototype.removeIn;\n  RecordPrototype.merge = MapPrototype.merge;\n  RecordPrototype.mergeWith = MapPrototype.mergeWith;\n  RecordPrototype.mergeIn = MapPrototype.mergeIn;\n  RecordPrototype.mergeDeep = MapPrototype.mergeDeep;\n  RecordPrototype.mergeDeepWith = MapPrototype.mergeDeepWith;\n  RecordPrototype.mergeDeepIn = MapPrototype.mergeDeepIn;\n  RecordPrototype.setIn = MapPrototype.setIn;\n  RecordPrototype.update = MapPrototype.update;\n  RecordPrototype.updateIn = MapPrototype.updateIn;\n  RecordPrototype.withMutations = MapPrototype.withMutations;\n  RecordPrototype.asMutable = MapPrototype.asMutable;\n  RecordPrototype.asImmutable = MapPrototype.asImmutable;\n\n\n  function makeRecord(likeRecord, map, ownerID) {\n    var record = Object.create(Object.getPrototypeOf(likeRecord));\n    record._map = map;\n    record.__ownerID = ownerID;\n    return record;\n  }\n\n  function recordName(record) {\n    return record._name || record.constructor.name || 'Record';\n  }\n\n  function setProps(prototype, names) {\n    try {\n      names.forEach(setProp.bind(undefined, prototype));\n    } catch (error) {\n      // Object.defineProperty failed. Probably IE8.\n    }\n  }\n\n  function setProp(prototype, name) {\n    Object.defineProperty(prototype, name, {\n      get: function() {\n        return this.get(name);\n      },\n      set: function(value) {\n        invariant(this.__ownerID, 'Cannot set on an immutable record.');\n        this.set(name, value);\n      }\n    });\n  }\n\n  createClass(Set, SetCollection);\n\n    // @pragma Construction\n\n    function Set(value) {\n      return value === null || value === undefined ? emptySet() :\n        isSet(value) && !isOrdered(value) ? value :\n        emptySet().withMutations(function(set ) {\n          var iter = SetIterable(value);\n          assertNotInfinite(iter.size);\n          iter.forEach(function(v ) {return set.add(v)});\n        });\n    }\n\n    Set.of = function(/*...values*/) {\n      return this(arguments);\n    };\n\n    Set.fromKeys = function(value) {\n      return this(KeyedIterable(value).keySeq());\n    };\n\n    Set.prototype.toString = function() {\n      return this.__toString('Set {', '}');\n    };\n\n    // @pragma Access\n\n    Set.prototype.has = function(value) {\n      return this._map.has(value);\n    };\n\n    // @pragma Modification\n\n    Set.prototype.add = function(value) {\n      return updateSet(this, this._map.set(value, true));\n    };\n\n    Set.prototype.remove = function(value) {\n      return updateSet(this, this._map.remove(value));\n    };\n\n    Set.prototype.clear = function() {\n      return updateSet(this, this._map.clear());\n    };\n\n    // @pragma Composition\n\n    Set.prototype.union = function() {var iters = SLICE$0.call(arguments, 0);\n      iters = iters.filter(function(x ) {return x.size !== 0});\n      if (iters.length === 0) {\n        return this;\n      }\n      if (this.size === 0 && !this.__ownerID && iters.length === 1) {\n        return this.constructor(iters[0]);\n      }\n      return this.withMutations(function(set ) {\n        for (var ii = 0; ii < iters.length; ii++) {\n          SetIterable(iters[ii]).forEach(function(value ) {return set.add(value)});\n        }\n      });\n    };\n\n    Set.prototype.intersect = function() {var iters = SLICE$0.call(arguments, 0);\n      if (iters.length === 0) {\n        return this;\n      }\n      iters = iters.map(function(iter ) {return SetIterable(iter)});\n      var originalSet = this;\n      return this.withMutations(function(set ) {\n        originalSet.forEach(function(value ) {\n          if (!iters.every(function(iter ) {return iter.includes(value)})) {\n            set.remove(value);\n          }\n        });\n      });\n    };\n\n    Set.prototype.subtract = function() {var iters = SLICE$0.call(arguments, 0);\n      if (iters.length === 0) {\n        return this;\n      }\n      iters = iters.map(function(iter ) {return SetIterable(iter)});\n      var originalSet = this;\n      return this.withMutations(function(set ) {\n        originalSet.forEach(function(value ) {\n          if (iters.some(function(iter ) {return iter.includes(value)})) {\n            set.remove(value);\n          }\n        });\n      });\n    };\n\n    Set.prototype.merge = function() {\n      return this.union.apply(this, arguments);\n    };\n\n    Set.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n      return this.union.apply(this, iters);\n    };\n\n    Set.prototype.sort = function(comparator) {\n      // Late binding\n      return OrderedSet(sortFactory(this, comparator));\n    };\n\n    Set.prototype.sortBy = function(mapper, comparator) {\n      // Late binding\n      return OrderedSet(sortFactory(this, comparator, mapper));\n    };\n\n    Set.prototype.wasAltered = function() {\n      return this._map.wasAltered();\n    };\n\n    Set.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n      return this._map.__iterate(function(_, k)  {return fn(k, k, this$0)}, reverse);\n    };\n\n    Set.prototype.__iterator = function(type, reverse) {\n      return this._map.map(function(_, k)  {return k}).__iterator(type, reverse);\n    };\n\n    Set.prototype.__ensureOwner = function(ownerID) {\n      if (ownerID === this.__ownerID) {\n        return this;\n      }\n      var newMap = this._map.__ensureOwner(ownerID);\n      if (!ownerID) {\n        this.__ownerID = ownerID;\n        this._map = newMap;\n        return this;\n      }\n      return this.__make(newMap, ownerID);\n    };\n\n\n  function isSet(maybeSet) {\n    return !!(maybeSet && maybeSet[IS_SET_SENTINEL]);\n  }\n\n  Set.isSet = isSet;\n\n  var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';\n\n  var SetPrototype = Set.prototype;\n  SetPrototype[IS_SET_SENTINEL] = true;\n  SetPrototype[DELETE] = SetPrototype.remove;\n  SetPrototype.mergeDeep = SetPrototype.merge;\n  SetPrototype.mergeDeepWith = SetPrototype.mergeWith;\n  SetPrototype.withMutations = MapPrototype.withMutations;\n  SetPrototype.asMutable = MapPrototype.asMutable;\n  SetPrototype.asImmutable = MapPrototype.asImmutable;\n\n  SetPrototype.__empty = emptySet;\n  SetPrototype.__make = makeSet;\n\n  function updateSet(set, newMap) {\n    if (set.__ownerID) {\n      set.size = newMap.size;\n      set._map = newMap;\n      return set;\n    }\n    return newMap === set._map ? set :\n      newMap.size === 0 ? set.__empty() :\n      set.__make(newMap);\n  }\n\n  function makeSet(map, ownerID) {\n    var set = Object.create(SetPrototype);\n    set.size = map ? map.size : 0;\n    set._map = map;\n    set.__ownerID = ownerID;\n    return set;\n  }\n\n  var EMPTY_SET;\n  function emptySet() {\n    return EMPTY_SET || (EMPTY_SET = makeSet(emptyMap()));\n  }\n\n  createClass(OrderedSet, Set);\n\n    // @pragma Construction\n\n    function OrderedSet(value) {\n      return value === null || value === undefined ? emptyOrderedSet() :\n        isOrderedSet(value) ? value :\n        emptyOrderedSet().withMutations(function(set ) {\n          var iter = SetIterable(value);\n          assertNotInfinite(iter.size);\n          iter.forEach(function(v ) {return set.add(v)});\n        });\n    }\n\n    OrderedSet.of = function(/*...values*/) {\n      return this(arguments);\n    };\n\n    OrderedSet.fromKeys = function(value) {\n      return this(KeyedIterable(value).keySeq());\n    };\n\n    OrderedSet.prototype.toString = function() {\n      return this.__toString('OrderedSet {', '}');\n    };\n\n\n  function isOrderedSet(maybeOrderedSet) {\n    return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet);\n  }\n\n  OrderedSet.isOrderedSet = isOrderedSet;\n\n  var OrderedSetPrototype = OrderedSet.prototype;\n  OrderedSetPrototype[IS_ORDERED_SENTINEL] = true;\n\n  OrderedSetPrototype.__empty = emptyOrderedSet;\n  OrderedSetPrototype.__make = makeOrderedSet;\n\n  function makeOrderedSet(map, ownerID) {\n    var set = Object.create(OrderedSetPrototype);\n    set.size = map ? map.size : 0;\n    set._map = map;\n    set.__ownerID = ownerID;\n    return set;\n  }\n\n  var EMPTY_ORDERED_SET;\n  function emptyOrderedSet() {\n    return EMPTY_ORDERED_SET || (EMPTY_ORDERED_SET = makeOrderedSet(emptyOrderedMap()));\n  }\n\n  createClass(Stack, IndexedCollection);\n\n    // @pragma Construction\n\n    function Stack(value) {\n      return value === null || value === undefined ? emptyStack() :\n        isStack(value) ? value :\n        emptyStack().unshiftAll(value);\n    }\n\n    Stack.of = function(/*...values*/) {\n      return this(arguments);\n    };\n\n    Stack.prototype.toString = function() {\n      return this.__toString('Stack [', ']');\n    };\n\n    // @pragma Access\n\n    Stack.prototype.get = function(index, notSetValue) {\n      var head = this._head;\n      index = wrapIndex(this, index);\n      while (head && index--) {\n        head = head.next;\n      }\n      return head ? head.value : notSetValue;\n    };\n\n    Stack.prototype.peek = function() {\n      return this._head && this._head.value;\n    };\n\n    // @pragma Modification\n\n    Stack.prototype.push = function(/*...values*/) {\n      if (arguments.length === 0) {\n        return this;\n      }\n      var newSize = this.size + arguments.length;\n      var head = this._head;\n      for (var ii = arguments.length - 1; ii >= 0; ii--) {\n        head = {\n          value: arguments[ii],\n          next: head\n        };\n      }\n      if (this.__ownerID) {\n        this.size = newSize;\n        this._head = head;\n        this.__hash = undefined;\n        this.__altered = true;\n        return this;\n      }\n      return makeStack(newSize, head);\n    };\n\n    Stack.prototype.pushAll = function(iter) {\n      iter = IndexedIterable(iter);\n      if (iter.size === 0) {\n        return this;\n      }\n      assertNotInfinite(iter.size);\n      var newSize = this.size;\n      var head = this._head;\n      iter.reverse().forEach(function(value ) {\n        newSize++;\n        head = {\n          value: value,\n          next: head\n        };\n      });\n      if (this.__ownerID) {\n        this.size = newSize;\n        this._head = head;\n        this.__hash = undefined;\n        this.__altered = true;\n        return this;\n      }\n      return makeStack(newSize, head);\n    };\n\n    Stack.prototype.pop = function() {\n      return this.slice(1);\n    };\n\n    Stack.prototype.unshift = function(/*...values*/) {\n      return this.push.apply(this, arguments);\n    };\n\n    Stack.prototype.unshiftAll = function(iter) {\n      return this.pushAll(iter);\n    };\n\n    Stack.prototype.shift = function() {\n      return this.pop.apply(this, arguments);\n    };\n\n    Stack.prototype.clear = function() {\n      if (this.size === 0) {\n        return this;\n      }\n      if (this.__ownerID) {\n        this.size = 0;\n        this._head = undefined;\n        this.__hash = undefined;\n        this.__altered = true;\n        return this;\n      }\n      return emptyStack();\n    };\n\n    Stack.prototype.slice = function(begin, end) {\n      if (wholeSlice(begin, end, this.size)) {\n        return this;\n      }\n      var resolvedBegin = resolveBegin(begin, this.size);\n      var resolvedEnd = resolveEnd(end, this.size);\n      if (resolvedEnd !== this.size) {\n        // super.slice(begin, end);\n        return IndexedCollection.prototype.slice.call(this, begin, end);\n      }\n      var newSize = this.size - resolvedBegin;\n      var head = this._head;\n      while (resolvedBegin--) {\n        head = head.next;\n      }\n      if (this.__ownerID) {\n        this.size = newSize;\n        this._head = head;\n        this.__hash = undefined;\n        this.__altered = true;\n        return this;\n      }\n      return makeStack(newSize, head);\n    };\n\n    // @pragma Mutability\n\n    Stack.prototype.__ensureOwner = function(ownerID) {\n      if (ownerID === this.__ownerID) {\n        return this;\n      }\n      if (!ownerID) {\n        this.__ownerID = ownerID;\n        this.__altered = false;\n        return this;\n      }\n      return makeStack(this.size, this._head, ownerID, this.__hash);\n    };\n\n    // @pragma Iteration\n\n    Stack.prototype.__iterate = function(fn, reverse) {\n      if (reverse) {\n        return this.reverse().__iterate(fn);\n      }\n      var iterations = 0;\n      var node = this._head;\n      while (node) {\n        if (fn(node.value, iterations++, this) === false) {\n          break;\n        }\n        node = node.next;\n      }\n      return iterations;\n    };\n\n    Stack.prototype.__iterator = function(type, reverse) {\n      if (reverse) {\n        return this.reverse().__iterator(type);\n      }\n      var iterations = 0;\n      var node = this._head;\n      return new Iterator(function()  {\n        if (node) {\n          var value = node.value;\n          node = node.next;\n          return iteratorValue(type, iterations++, value);\n        }\n        return iteratorDone();\n      });\n    };\n\n\n  function isStack(maybeStack) {\n    return !!(maybeStack && maybeStack[IS_STACK_SENTINEL]);\n  }\n\n  Stack.isStack = isStack;\n\n  var IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';\n\n  var StackPrototype = Stack.prototype;\n  StackPrototype[IS_STACK_SENTINEL] = true;\n  StackPrototype.withMutations = MapPrototype.withMutations;\n  StackPrototype.asMutable = MapPrototype.asMutable;\n  StackPrototype.asImmutable = MapPrototype.asImmutable;\n  StackPrototype.wasAltered = MapPrototype.wasAltered;\n\n\n  function makeStack(size, head, ownerID, hash) {\n    var map = Object.create(StackPrototype);\n    map.size = size;\n    map._head = head;\n    map.__ownerID = ownerID;\n    map.__hash = hash;\n    map.__altered = false;\n    return map;\n  }\n\n  var EMPTY_STACK;\n  function emptyStack() {\n    return EMPTY_STACK || (EMPTY_STACK = makeStack(0));\n  }\n\n  /**\n   * Contributes additional methods to a constructor\n   */\n  function mixin(ctor, methods) {\n    var keyCopier = function(key ) { ctor.prototype[key] = methods[key]; };\n    Object.keys(methods).forEach(keyCopier);\n    Object.getOwnPropertySymbols &&\n      Object.getOwnPropertySymbols(methods).forEach(keyCopier);\n    return ctor;\n  }\n\n  Iterable.Iterator = Iterator;\n\n  mixin(Iterable, {\n\n    // ### Conversion to other types\n\n    toArray: function() {\n      assertNotInfinite(this.size);\n      var array = new Array(this.size || 0);\n      this.valueSeq().__iterate(function(v, i)  { array[i] = v; });\n      return array;\n    },\n\n    toIndexedSeq: function() {\n      return new ToIndexedSequence(this);\n    },\n\n    toJS: function() {\n      return this.toSeq().map(\n        function(value ) {return value && typeof value.toJS === 'function' ? value.toJS() : value}\n      ).__toJS();\n    },\n\n    toJSON: function() {\n      return this.toSeq().map(\n        function(value ) {return value && typeof value.toJSON === 'function' ? value.toJSON() : value}\n      ).__toJS();\n    },\n\n    toKeyedSeq: function() {\n      return new ToKeyedSequence(this, true);\n    },\n\n    toMap: function() {\n      // Use Late Binding here to solve the circular dependency.\n      return Map(this.toKeyedSeq());\n    },\n\n    toObject: function() {\n      assertNotInfinite(this.size);\n      var object = {};\n      this.__iterate(function(v, k)  { object[k] = v; });\n      return object;\n    },\n\n    toOrderedMap: function() {\n      // Use Late Binding here to solve the circular dependency.\n      return OrderedMap(this.toKeyedSeq());\n    },\n\n    toOrderedSet: function() {\n      // Use Late Binding here to solve the circular dependency.\n      return OrderedSet(isKeyed(this) ? this.valueSeq() : this);\n    },\n\n    toSet: function() {\n      // Use Late Binding here to solve the circular dependency.\n      return Set(isKeyed(this) ? this.valueSeq() : this);\n    },\n\n    toSetSeq: function() {\n      return new ToSetSequence(this);\n    },\n\n    toSeq: function() {\n      return isIndexed(this) ? this.toIndexedSeq() :\n        isKeyed(this) ? this.toKeyedSeq() :\n        this.toSetSeq();\n    },\n\n    toStack: function() {\n      // Use Late Binding here to solve the circular dependency.\n      return Stack(isKeyed(this) ? this.valueSeq() : this);\n    },\n\n    toList: function() {\n      // Use Late Binding here to solve the circular dependency.\n      return List(isKeyed(this) ? this.valueSeq() : this);\n    },\n\n\n    // ### Common JavaScript methods and properties\n\n    toString: function() {\n      return '[Iterable]';\n    },\n\n    __toString: function(head, tail) {\n      if (this.size === 0) {\n        return head + tail;\n      }\n      return head + ' ' + this.toSeq().map(this.__toStringMapper).join(', ') + ' ' + tail;\n    },\n\n\n    // ### ES6 Collection methods (ES6 Array and Map)\n\n    concat: function() {var values = SLICE$0.call(arguments, 0);\n      return reify(this, concatFactory(this, values));\n    },\n\n    includes: function(searchValue) {\n      return this.some(function(value ) {return is(value, searchValue)});\n    },\n\n    entries: function() {\n      return this.__iterator(ITERATE_ENTRIES);\n    },\n\n    every: function(predicate, context) {\n      assertNotInfinite(this.size);\n      var returnValue = true;\n      this.__iterate(function(v, k, c)  {\n        if (!predicate.call(context, v, k, c)) {\n          returnValue = false;\n          return false;\n        }\n      });\n      return returnValue;\n    },\n\n    filter: function(predicate, context) {\n      return reify(this, filterFactory(this, predicate, context, true));\n    },\n\n    find: function(predicate, context, notSetValue) {\n      var entry = this.findEntry(predicate, context);\n      return entry ? entry[1] : notSetValue;\n    },\n\n    findEntry: function(predicate, context) {\n      var found;\n      this.__iterate(function(v, k, c)  {\n        if (predicate.call(context, v, k, c)) {\n          found = [k, v];\n          return false;\n        }\n      });\n      return found;\n    },\n\n    findLastEntry: function(predicate, context) {\n      return this.toSeq().reverse().findEntry(predicate, context);\n    },\n\n    forEach: function(sideEffect, context) {\n      assertNotInfinite(this.size);\n      return this.__iterate(context ? sideEffect.bind(context) : sideEffect);\n    },\n\n    join: function(separator) {\n      assertNotInfinite(this.size);\n      separator = separator !== undefined ? '' + separator : ',';\n      var joined = '';\n      var isFirst = true;\n      this.__iterate(function(v ) {\n        isFirst ? (isFirst = false) : (joined += separator);\n        joined += v !== null && v !== undefined ? v.toString() : '';\n      });\n      return joined;\n    },\n\n    keys: function() {\n      return this.__iterator(ITERATE_KEYS);\n    },\n\n    map: function(mapper, context) {\n      return reify(this, mapFactory(this, mapper, context));\n    },\n\n    reduce: function(reducer, initialReduction, context) {\n      assertNotInfinite(this.size);\n      var reduction;\n      var useFirst;\n      if (arguments.length < 2) {\n        useFirst = true;\n      } else {\n        reduction = initialReduction;\n      }\n      this.__iterate(function(v, k, c)  {\n        if (useFirst) {\n          useFirst = false;\n          reduction = v;\n        } else {\n          reduction = reducer.call(context, reduction, v, k, c);\n        }\n      });\n      return reduction;\n    },\n\n    reduceRight: function(reducer, initialReduction, context) {\n      var reversed = this.toKeyedSeq().reverse();\n      return reversed.reduce.apply(reversed, arguments);\n    },\n\n    reverse: function() {\n      return reify(this, reverseFactory(this, true));\n    },\n\n    slice: function(begin, end) {\n      return reify(this, sliceFactory(this, begin, end, true));\n    },\n\n    some: function(predicate, context) {\n      return !this.every(not(predicate), context);\n    },\n\n    sort: function(comparator) {\n      return reify(this, sortFactory(this, comparator));\n    },\n\n    values: function() {\n      return this.__iterator(ITERATE_VALUES);\n    },\n\n\n    // ### More sequential methods\n\n    butLast: function() {\n      return this.slice(0, -1);\n    },\n\n    isEmpty: function() {\n      return this.size !== undefined ? this.size === 0 : !this.some(function()  {return true});\n    },\n\n    count: function(predicate, context) {\n      return ensureSize(\n        predicate ? this.toSeq().filter(predicate, context) : this\n      );\n    },\n\n    countBy: function(grouper, context) {\n      return countByFactory(this, grouper, context);\n    },\n\n    equals: function(other) {\n      return deepEqual(this, other);\n    },\n\n    entrySeq: function() {\n      var iterable = this;\n      if (iterable._cache) {\n        // We cache as an entries array, so we can just return the cache!\n        return new ArraySeq(iterable._cache);\n      }\n      var entriesSequence = iterable.toSeq().map(entryMapper).toIndexedSeq();\n      entriesSequence.fromEntrySeq = function()  {return iterable.toSeq()};\n      return entriesSequence;\n    },\n\n    filterNot: function(predicate, context) {\n      return this.filter(not(predicate), context);\n    },\n\n    findLast: function(predicate, context, notSetValue) {\n      return this.toKeyedSeq().reverse().find(predicate, context, notSetValue);\n    },\n\n    first: function() {\n      return this.find(returnTrue);\n    },\n\n    flatMap: function(mapper, context) {\n      return reify(this, flatMapFactory(this, mapper, context));\n    },\n\n    flatten: function(depth) {\n      return reify(this, flattenFactory(this, depth, true));\n    },\n\n    fromEntrySeq: function() {\n      return new FromEntriesSequence(this);\n    },\n\n    get: function(searchKey, notSetValue) {\n      return this.find(function(_, key)  {return is(key, searchKey)}, undefined, notSetValue);\n    },\n\n    getIn: function(searchKeyPath, notSetValue) {\n      var nested = this;\n      // Note: in an ES6 environment, we would prefer:\n      // for (var key of searchKeyPath) {\n      var iter = forceIterator(searchKeyPath);\n      var step;\n      while (!(step = iter.next()).done) {\n        var key = step.value;\n        nested = nested && nested.get ? nested.get(key, NOT_SET) : NOT_SET;\n        if (nested === NOT_SET) {\n          return notSetValue;\n        }\n      }\n      return nested;\n    },\n\n    groupBy: function(grouper, context) {\n      return groupByFactory(this, grouper, context);\n    },\n\n    has: function(searchKey) {\n      return this.get(searchKey, NOT_SET) !== NOT_SET;\n    },\n\n    hasIn: function(searchKeyPath) {\n      return this.getIn(searchKeyPath, NOT_SET) !== NOT_SET;\n    },\n\n    isSubset: function(iter) {\n      iter = typeof iter.includes === 'function' ? iter : Iterable(iter);\n      return this.every(function(value ) {return iter.includes(value)});\n    },\n\n    isSuperset: function(iter) {\n      iter = typeof iter.isSubset === 'function' ? iter : Iterable(iter);\n      return iter.isSubset(this);\n    },\n\n    keySeq: function() {\n      return this.toSeq().map(keyMapper).toIndexedSeq();\n    },\n\n    last: function() {\n      return this.toSeq().reverse().first();\n    },\n\n    max: function(comparator) {\n      return maxFactory(this, comparator);\n    },\n\n    maxBy: function(mapper, comparator) {\n      return maxFactory(this, comparator, mapper);\n    },\n\n    min: function(comparator) {\n      return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator);\n    },\n\n    minBy: function(mapper, comparator) {\n      return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator, mapper);\n    },\n\n    rest: function() {\n      return this.slice(1);\n    },\n\n    skip: function(amount) {\n      return this.slice(Math.max(0, amount));\n    },\n\n    skipLast: function(amount) {\n      return reify(this, this.toSeq().reverse().skip(amount).reverse());\n    },\n\n    skipWhile: function(predicate, context) {\n      return reify(this, skipWhileFactory(this, predicate, context, true));\n    },\n\n    skipUntil: function(predicate, context) {\n      return this.skipWhile(not(predicate), context);\n    },\n\n    sortBy: function(mapper, comparator) {\n      return reify(this, sortFactory(this, comparator, mapper));\n    },\n\n    take: function(amount) {\n      return this.slice(0, Math.max(0, amount));\n    },\n\n    takeLast: function(amount) {\n      return reify(this, this.toSeq().reverse().take(amount).reverse());\n    },\n\n    takeWhile: function(predicate, context) {\n      return reify(this, takeWhileFactory(this, predicate, context));\n    },\n\n    takeUntil: function(predicate, context) {\n      return this.takeWhile(not(predicate), context);\n    },\n\n    valueSeq: function() {\n      return this.toIndexedSeq();\n    },\n\n\n    // ### Hashable Object\n\n    hashCode: function() {\n      return this.__hash || (this.__hash = hashIterable(this));\n    }\n\n\n    // ### Internal\n\n    // abstract __iterate(fn, reverse)\n\n    // abstract __iterator(type, reverse)\n  });\n\n  // var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';\n  // var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';\n  // var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@';\n  // var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';\n\n  var IterablePrototype = Iterable.prototype;\n  IterablePrototype[IS_ITERABLE_SENTINEL] = true;\n  IterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.values;\n  IterablePrototype.__toJS = IterablePrototype.toArray;\n  IterablePrototype.__toStringMapper = quoteString;\n  IterablePrototype.inspect =\n  IterablePrototype.toSource = function() { return this.toString(); };\n  IterablePrototype.chain = IterablePrototype.flatMap;\n  IterablePrototype.contains = IterablePrototype.includes;\n\n  // Temporary warning about using length\n  (function () {\n    try {\n      Object.defineProperty(IterablePrototype, 'length', {\n        get: function () {\n          if (!Iterable.noLengthWarning) {\n            var stack;\n            try {\n              throw new Error();\n            } catch (error) {\n              stack = error.stack;\n            }\n            if (stack.indexOf('_wrapObject') === -1) {\n              console && console.warn && console.warn(\n                'iterable.length has been deprecated, '+\n                'use iterable.size or iterable.count(). '+\n                'This warning will become a silent error in a future version. ' +\n                stack\n              );\n              return this.size;\n            }\n          }\n        }\n      });\n    } catch (e) {}\n  })();\n\n\n\n  mixin(KeyedIterable, {\n\n    // ### More sequential methods\n\n    flip: function() {\n      return reify(this, flipFactory(this));\n    },\n\n    findKey: function(predicate, context) {\n      var entry = this.findEntry(predicate, context);\n      return entry && entry[0];\n    },\n\n    findLastKey: function(predicate, context) {\n      return this.toSeq().reverse().findKey(predicate, context);\n    },\n\n    keyOf: function(searchValue) {\n      return this.findKey(function(value ) {return is(value, searchValue)});\n    },\n\n    lastKeyOf: function(searchValue) {\n      return this.findLastKey(function(value ) {return is(value, searchValue)});\n    },\n\n    mapEntries: function(mapper, context) {var this$0 = this;\n      var iterations = 0;\n      return reify(this,\n        this.toSeq().map(\n          function(v, k)  {return mapper.call(context, [k, v], iterations++, this$0)}\n        ).fromEntrySeq()\n      );\n    },\n\n    mapKeys: function(mapper, context) {var this$0 = this;\n      return reify(this,\n        this.toSeq().flip().map(\n          function(k, v)  {return mapper.call(context, k, v, this$0)}\n        ).flip()\n      );\n    }\n\n  });\n\n  var KeyedIterablePrototype = KeyedIterable.prototype;\n  KeyedIterablePrototype[IS_KEYED_SENTINEL] = true;\n  KeyedIterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.entries;\n  KeyedIterablePrototype.__toJS = IterablePrototype.toObject;\n  KeyedIterablePrototype.__toStringMapper = function(v, k)  {return JSON.stringify(k) + ': ' + quoteString(v)};\n\n\n\n  mixin(IndexedIterable, {\n\n    // ### Conversion to other types\n\n    toKeyedSeq: function() {\n      return new ToKeyedSequence(this, false);\n    },\n\n\n    // ### ES6 Collection methods (ES6 Array and Map)\n\n    filter: function(predicate, context) {\n      return reify(this, filterFactory(this, predicate, context, false));\n    },\n\n    findIndex: function(predicate, context) {\n      var entry = this.findEntry(predicate, context);\n      return entry ? entry[0] : -1;\n    },\n\n    indexOf: function(searchValue) {\n      var key = this.toKeyedSeq().keyOf(searchValue);\n      return key === undefined ? -1 : key;\n    },\n\n    lastIndexOf: function(searchValue) {\n      var key = this.toKeyedSeq().reverse().keyOf(searchValue);\n      return key === undefined ? -1 : key;\n\n      // var index =\n      // return this.toSeq().reverse().indexOf(searchValue);\n    },\n\n    reverse: function() {\n      return reify(this, reverseFactory(this, false));\n    },\n\n    slice: function(begin, end) {\n      return reify(this, sliceFactory(this, begin, end, false));\n    },\n\n    splice: function(index, removeNum /*, ...values*/) {\n      var numArgs = arguments.length;\n      removeNum = Math.max(removeNum | 0, 0);\n      if (numArgs === 0 || (numArgs === 2 && !removeNum)) {\n        return this;\n      }\n      // If index is negative, it should resolve relative to the size of the\n      // collection. However size may be expensive to compute if not cached, so\n      // only call count() if the number is in fact negative.\n      index = resolveBegin(index, index < 0 ? this.count() : this.size);\n      var spliced = this.slice(0, index);\n      return reify(\n        this,\n        numArgs === 1 ?\n          spliced :\n          spliced.concat(arrCopy(arguments, 2), this.slice(index + removeNum))\n      );\n    },\n\n\n    // ### More collection methods\n\n    findLastIndex: function(predicate, context) {\n      var key = this.toKeyedSeq().findLastKey(predicate, context);\n      return key === undefined ? -1 : key;\n    },\n\n    first: function() {\n      return this.get(0);\n    },\n\n    flatten: function(depth) {\n      return reify(this, flattenFactory(this, depth, false));\n    },\n\n    get: function(index, notSetValue) {\n      index = wrapIndex(this, index);\n      return (index < 0 || (this.size === Infinity ||\n          (this.size !== undefined && index > this.size))) ?\n        notSetValue :\n        this.find(function(_, key)  {return key === index}, undefined, notSetValue);\n    },\n\n    has: function(index) {\n      index = wrapIndex(this, index);\n      return index >= 0 && (this.size !== undefined ?\n        this.size === Infinity || index < this.size :\n        this.indexOf(index) !== -1\n      );\n    },\n\n    interpose: function(separator) {\n      return reify(this, interposeFactory(this, separator));\n    },\n\n    interleave: function(/*...iterables*/) {\n      var iterables = [this].concat(arrCopy(arguments));\n      var zipped = zipWithFactory(this.toSeq(), IndexedSeq.of, iterables);\n      var interleaved = zipped.flatten(true);\n      if (zipped.size) {\n        interleaved.size = zipped.size * iterables.length;\n      }\n      return reify(this, interleaved);\n    },\n\n    last: function() {\n      return this.get(-1);\n    },\n\n    skipWhile: function(predicate, context) {\n      return reify(this, skipWhileFactory(this, predicate, context, false));\n    },\n\n    zip: function(/*, ...iterables */) {\n      var iterables = [this].concat(arrCopy(arguments));\n      return reify(this, zipWithFactory(this, defaultZipper, iterables));\n    },\n\n    zipWith: function(zipper/*, ...iterables */) {\n      var iterables = arrCopy(arguments);\n      iterables[0] = this;\n      return reify(this, zipWithFactory(this, zipper, iterables));\n    }\n\n  });\n\n  IndexedIterable.prototype[IS_INDEXED_SENTINEL] = true;\n  IndexedIterable.prototype[IS_ORDERED_SENTINEL] = true;\n\n\n\n  mixin(SetIterable, {\n\n    // ### ES6 Collection methods (ES6 Array and Map)\n\n    get: function(value, notSetValue) {\n      return this.has(value) ? value : notSetValue;\n    },\n\n    includes: function(value) {\n      return this.has(value);\n    },\n\n\n    // ### More sequential methods\n\n    keySeq: function() {\n      return this.valueSeq();\n    }\n\n  });\n\n  SetIterable.prototype.has = IterablePrototype.includes;\n\n\n  // Mixin subclasses\n\n  mixin(KeyedSeq, KeyedIterable.prototype);\n  mixin(IndexedSeq, IndexedIterable.prototype);\n  mixin(SetSeq, SetIterable.prototype);\n\n  mixin(KeyedCollection, KeyedIterable.prototype);\n  mixin(IndexedCollection, IndexedIterable.prototype);\n  mixin(SetCollection, SetIterable.prototype);\n\n\n  // #pragma Helper functions\n\n  function keyMapper(v, k) {\n    return k;\n  }\n\n  function entryMapper(v, k) {\n    return [k, v];\n  }\n\n  function not(predicate) {\n    return function() {\n      return !predicate.apply(this, arguments);\n    }\n  }\n\n  function neg(predicate) {\n    return function() {\n      return -predicate.apply(this, arguments);\n    }\n  }\n\n  function quoteString(value) {\n    return typeof value === 'string' ? JSON.stringify(value) : value;\n  }\n\n  function defaultZipper() {\n    return arrCopy(arguments);\n  }\n\n  function defaultNegComparator(a, b) {\n    return a < b ? 1 : a > b ? -1 : 0;\n  }\n\n  function hashIterable(iterable) {\n    if (iterable.size === Infinity) {\n      return 0;\n    }\n    var ordered = isOrdered(iterable);\n    var keyed = isKeyed(iterable);\n    var h = ordered ? 1 : 0;\n    var size = iterable.__iterate(\n      keyed ?\n        ordered ?\n          function(v, k)  { h = 31 * h + hashMerge(hash(v), hash(k)) | 0; } :\n          function(v, k)  { h = h + hashMerge(hash(v), hash(k)) | 0; } :\n        ordered ?\n          function(v ) { h = 31 * h + hash(v) | 0; } :\n          function(v ) { h = h + hash(v) | 0; }\n    );\n    return murmurHashOfSize(size, h);\n  }\n\n  function murmurHashOfSize(size, h) {\n    h = imul(h, 0xCC9E2D51);\n    h = imul(h << 15 | h >>> -15, 0x1B873593);\n    h = imul(h << 13 | h >>> -13, 5);\n    h = (h + 0xE6546B64 | 0) ^ size;\n    h = imul(h ^ h >>> 16, 0x85EBCA6B);\n    h = imul(h ^ h >>> 13, 0xC2B2AE35);\n    h = smi(h ^ h >>> 16);\n    return h;\n  }\n\n  function hashMerge(a, b) {\n    return a ^ b + 0x9E3779B9 + (a << 6) + (a >> 2) | 0; // int\n  }\n\n  var Immutable = {\n\n    Iterable: Iterable,\n\n    Seq: Seq,\n    Collection: Collection,\n    Map: Map,\n    OrderedMap: OrderedMap,\n    List: List,\n    Stack: Stack,\n    Set: Set,\n    OrderedSet: OrderedSet,\n\n    Record: Record,\n    Range: Range,\n    Repeat: Repeat,\n\n    is: is,\n    fromJS: fromJS\n\n  };\n\n  return Immutable;\n\n}));", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar Immutable = require(\"immutable\");\n\nvar OrderedMap = Immutable.OrderedMap;\nvar BlockMapBuilder = {\n  createFromArray: function createFromArray(blocks) {\n    return OrderedMap(blocks.map(function (block) {\n      return [block.getKey(), block];\n    }));\n  }\n};\nmodule.exports = BlockMapBuilder;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nvar _require = require(\"immutable\"),\n    Map = _require.Map,\n    OrderedSet = _require.OrderedSet,\n    Record = _require.Record; // Immutable.map is typed such that the value for every key in the map\n// must be the same type\n\n\nvar EMPTY_SET = OrderedSet();\nvar defaultRecord = {\n  style: EMPTY_SET,\n  entity: null\n};\nvar CharacterMetadataRecord = Record(defaultRecord);\n\nvar CharacterMetadata =\n/*#__PURE__*/\nfunction (_CharacterMetadataRec) {\n  _inheritsLoose(CharacterMetadata, _CharacterMetadataRec);\n\n  function CharacterMetadata() {\n    return _CharacterMetadataRec.apply(this, arguments) || this;\n  }\n\n  var _proto = CharacterMetadata.prototype;\n\n  _proto.getStyle = function getStyle() {\n    return this.get('style');\n  };\n\n  _proto.getEntity = function getEntity() {\n    return this.get('entity');\n  };\n\n  _proto.hasStyle = function hasStyle(style) {\n    return this.getStyle().includes(style);\n  };\n\n  CharacterMetadata.applyStyle = function applyStyle(record, style) {\n    var withStyle = record.set('style', record.getStyle().add(style));\n    return CharacterMetadata.create(withStyle);\n  };\n\n  CharacterMetadata.removeStyle = function removeStyle(record, style) {\n    var withoutStyle = record.set('style', record.getStyle().remove(style));\n    return CharacterMetadata.create(withoutStyle);\n  };\n\n  CharacterMetadata.applyEntity = function applyEntity(record, entityKey) {\n    var withEntity = record.getEntity() === entityKey ? record : record.set('entity', entityKey);\n    return CharacterMetadata.create(withEntity);\n  }\n  /**\n   * Use this function instead of the `CharacterMetadata` constructor.\n   * Since most content generally uses only a very small number of\n   * style/entity permutations, we can reuse these objects as often as\n   * possible.\n   */\n  ;\n\n  CharacterMetadata.create = function create(config) {\n    if (!config) {\n      return EMPTY;\n    }\n\n    var defaultConfig = {\n      style: EMPTY_SET,\n      entity: null\n    }; // Fill in unspecified properties, if necessary.\n\n    var configMap = Map(defaultConfig).merge(config);\n    var existing = pool.get(configMap);\n\n    if (existing) {\n      return existing;\n    }\n\n    var newCharacter = new CharacterMetadata(configMap);\n    pool = pool.set(configMap, newCharacter);\n    return newCharacter;\n  };\n\n  return CharacterMetadata;\n}(CharacterMetadataRecord);\n\nvar EMPTY = new CharacterMetadata();\nvar pool = Map([[Map(defaultRecord), EMPTY]]);\nCharacterMetadata.EMPTY = EMPTY;\nmodule.exports = CharacterMetadata;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\n/**\n * Search through an array to find contiguous stretches of elements that\n * match a specified filter function.\n *\n * When ranges are found, execute a specified `found` function to supply\n * the values to the caller.\n */\nfunction findRangesImmutable(haystack, areEqualFn, filterFn, foundFn) {\n  if (!haystack.size) {\n    return;\n  }\n\n  var cursor = 0;\n  haystack.reduce(function (value, nextValue, nextIndex) {\n    if (!areEqualFn(value, nextValue)) {\n      if (filterFn(value)) {\n        foundFn(cursor, nextIndex);\n      }\n\n      cursor = nextIndex;\n    }\n\n    return nextValue;\n  });\n  filterFn(haystack.last()) && foundFn(cursor, haystack.count());\n}\n\nmodule.exports = findRangesImmutable;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nvar CharacterMetadata = require(\"./CharacterMetadata\");\n\nvar findRangesImmutable = require(\"./findRangesImmutable\");\n\nvar Immutable = require(\"immutable\");\n\nvar List = Immutable.List,\n    Map = Immutable.Map,\n    OrderedSet = Immutable.OrderedSet,\n    Record = Immutable.Record,\n    Repeat = Immutable.Repeat;\nvar EMPTY_SET = OrderedSet();\nvar defaultRecord = {\n  key: '',\n  type: 'unstyled',\n  text: '',\n  characterList: List(),\n  depth: 0,\n  data: Map()\n};\nvar ContentBlockRecord = Record(defaultRecord);\n\nvar decorateCharacterList = function decorateCharacterList(config) {\n  if (!config) {\n    return config;\n  }\n\n  var characterList = config.characterList,\n      text = config.text;\n\n  if (text && !characterList) {\n    config.characterList = List(Repeat(CharacterMetadata.EMPTY, text.length));\n  }\n\n  return config;\n};\n\nvar ContentBlock =\n/*#__PURE__*/\nfunction (_ContentBlockRecord) {\n  _inheritsLoose(ContentBlock, _ContentBlockRecord);\n\n  function ContentBlock(config) {\n    return _ContentBlockRecord.call(this, decorateCharacterList(config)) || this;\n  }\n\n  var _proto = ContentBlock.prototype;\n\n  _proto.getKey = function getKey() {\n    return this.get('key');\n  };\n\n  _proto.getType = function getType() {\n    return this.get('type');\n  };\n\n  _proto.getText = function getText() {\n    return this.get('text');\n  };\n\n  _proto.getCharacterList = function getCharacterList() {\n    return this.get('characterList');\n  };\n\n  _proto.getLength = function getLength() {\n    return this.getText().length;\n  };\n\n  _proto.getDepth = function getDepth() {\n    return this.get('depth');\n  };\n\n  _proto.getData = function getData() {\n    return this.get('data');\n  };\n\n  _proto.getInlineStyleAt = function getInlineStyleAt(offset) {\n    var character = this.getCharacterList().get(offset);\n    return character ? character.getStyle() : EMPTY_SET;\n  };\n\n  _proto.getEntityAt = function getEntityAt(offset) {\n    var character = this.getCharacterList().get(offset);\n    return character ? character.getEntity() : null;\n  }\n  /**\n   * Execute a callback for every contiguous range of styles within the block.\n   */\n  ;\n\n  _proto.findStyleRanges = function findStyleRanges(filterFn, callback) {\n    findRangesImmutable(this.getCharacterList(), haveEqualStyle, filterFn, callback);\n  }\n  /**\n   * Execute a callback for every contiguous range of entities within the block.\n   */\n  ;\n\n  _proto.findEntityRanges = function findEntityRanges(filterFn, callback) {\n    findRangesImmutable(this.getCharacterList(), haveEqualEntity, filterFn, callback);\n  };\n\n  return ContentBlock;\n}(ContentBlockRecord);\n\nfunction haveEqualStyle(charA, charB) {\n  return charA.getStyle() === charB.getStyle();\n}\n\nfunction haveEqualEntity(charA, charB) {\n  return charA.getEntity() === charB.getEntity();\n}\n\nmodule.exports = ContentBlock;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n *\n * This file is a fork of ContentBlock adding support for nesting references by\n * providing links to children, parent, prevSibling, and nextSibling.\n *\n * This is unstable and not part of the public API and should not be used by\n * production systems. This file may be update/removed without notice.\n */\n'use strict';\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nvar CharacterMetadata = require(\"./CharacterMetadata\");\n\nvar findRangesImmutable = require(\"./findRangesImmutable\");\n\nvar Immutable = require(\"immutable\");\n\nvar List = Immutable.List,\n    Map = Immutable.Map,\n    OrderedSet = Immutable.OrderedSet,\n    Record = Immutable.Record,\n    Repeat = Immutable.Repeat;\nvar EMPTY_SET = OrderedSet();\nvar defaultRecord = {\n  parent: null,\n  characterList: List(),\n  data: Map(),\n  depth: 0,\n  key: '',\n  text: '',\n  type: 'unstyled',\n  children: List(),\n  prevSibling: null,\n  nextSibling: null\n};\n\nvar haveEqualStyle = function haveEqualStyle(charA, charB) {\n  return charA.getStyle() === charB.getStyle();\n};\n\nvar haveEqualEntity = function haveEqualEntity(charA, charB) {\n  return charA.getEntity() === charB.getEntity();\n};\n\nvar decorateCharacterList = function decorateCharacterList(config) {\n  if (!config) {\n    return config;\n  }\n\n  var characterList = config.characterList,\n      text = config.text;\n\n  if (text && !characterList) {\n    config.characterList = List(Repeat(CharacterMetadata.EMPTY, text.length));\n  }\n\n  return config;\n};\n\nvar ContentBlockNode =\n/*#__PURE__*/\nfunction (_ref) {\n  _inheritsLoose(ContentBlockNode, _ref);\n\n  function ContentBlockNode() {\n    var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultRecord;\n\n    /* eslint-disable-next-line constructor-super */\n    return _ref.call(this, decorateCharacterList(props)) || this;\n  }\n\n  var _proto = ContentBlockNode.prototype;\n\n  _proto.getKey = function getKey() {\n    return this.get('key');\n  };\n\n  _proto.getType = function getType() {\n    return this.get('type');\n  };\n\n  _proto.getText = function getText() {\n    return this.get('text');\n  };\n\n  _proto.getCharacterList = function getCharacterList() {\n    return this.get('characterList');\n  };\n\n  _proto.getLength = function getLength() {\n    return this.getText().length;\n  };\n\n  _proto.getDepth = function getDepth() {\n    return this.get('depth');\n  };\n\n  _proto.getData = function getData() {\n    return this.get('data');\n  };\n\n  _proto.getInlineStyleAt = function getInlineStyleAt(offset) {\n    var character = this.getCharacterList().get(offset);\n    return character ? character.getStyle() : EMPTY_SET;\n  };\n\n  _proto.getEntityAt = function getEntityAt(offset) {\n    var character = this.getCharacterList().get(offset);\n    return character ? character.getEntity() : null;\n  };\n\n  _proto.getChildKeys = function getChildKeys() {\n    return this.get('children');\n  };\n\n  _proto.getParentKey = function getParentKey() {\n    return this.get('parent');\n  };\n\n  _proto.getPrevSiblingKey = function getPrevSiblingKey() {\n    return this.get('prevSibling');\n  };\n\n  _proto.getNextSiblingKey = function getNextSiblingKey() {\n    return this.get('nextSibling');\n  };\n\n  _proto.findStyleRanges = function findStyleRanges(filterFn, callback) {\n    findRangesImmutable(this.getCharacterList(), haveEqualStyle, filterFn, callback);\n  };\n\n  _proto.findEntityRanges = function findEntityRanges(filterFn, callback) {\n    findRangesImmutable(this.getCharacterList(), haveEqualEntity, filterFn, callback);\n  };\n\n  return ContentBlockNode;\n}(Record(defaultRecord));\n\nmodule.exports = ContentBlockNode;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar CharacterMetadata = require(\"./CharacterMetadata\");\n\nvar _require = require(\"immutable\"),\n    Map = _require.Map;\n\nvar ContentStateInlineStyle = {\n  add: function add(contentState, selectionState, inlineStyle) {\n    return modifyInlineStyle(contentState, selectionState, inlineStyle, true);\n  },\n  remove: function remove(contentState, selectionState, inlineStyle) {\n    return modifyInlineStyle(contentState, selectionState, inlineStyle, false);\n  }\n};\n\nfunction modifyInlineStyle(contentState, selectionState, inlineStyle, addOrRemove) {\n  var blockMap = contentState.getBlockMap();\n  var startKey = selectionState.getStartKey();\n  var startOffset = selectionState.getStartOffset();\n  var endKey = selectionState.getEndKey();\n  var endOffset = selectionState.getEndOffset();\n  var newBlocks = blockMap.skipUntil(function (_, k) {\n    return k === startKey;\n  }).takeUntil(function (_, k) {\n    return k === endKey;\n  }).concat(Map([[endKey, blockMap.get(endKey)]])).map(function (block, blockKey) {\n    var sliceStart;\n    var sliceEnd;\n\n    if (startKey === endKey) {\n      sliceStart = startOffset;\n      sliceEnd = endOffset;\n    } else {\n      sliceStart = blockKey === startKey ? startOffset : 0;\n      sliceEnd = blockKey === endKey ? endOffset : block.getLength();\n    }\n\n    var chars = block.getCharacterList();\n    var current;\n\n    while (sliceStart < sliceEnd) {\n      current = chars.get(sliceStart);\n      chars = chars.set(sliceStart, addOrRemove ? CharacterMetadata.applyStyle(current, inlineStyle) : CharacterMetadata.removeStyle(current, inlineStyle));\n      sliceStart++;\n    }\n\n    return block.set('characterList', chars);\n  });\n  return contentState.merge({\n    blockMap: blockMap.merge(newBlocks),\n    selectionBefore: selectionState,\n    selectionAfter: selectionState\n  });\n}\n\nmodule.exports = ContentStateInlineStyle;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar CharacterMetadata = require(\"./CharacterMetadata\");\n\nfunction applyEntityToContentBlock(contentBlock, start, end, entityKey) {\n  var characterList = contentBlock.getCharacterList();\n\n  while (start < end) {\n    characterList = characterList.set(start, CharacterMetadata.applyEntity(characterList.get(start), entityKey));\n    start++;\n  }\n\n  return contentBlock.set('characterList', characterList);\n}\n\nmodule.exports = applyEntityToContentBlock;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar applyEntityToContentBlock = require(\"./applyEntityToContentBlock\");\n\nvar Immutable = require(\"immutable\");\n\nfunction applyEntityToContentState(contentState, selectionState, entityKey) {\n  var blockMap = contentState.getBlockMap();\n  var startKey = selectionState.getStartKey();\n  var startOffset = selectionState.getStartOffset();\n  var endKey = selectionState.getEndKey();\n  var endOffset = selectionState.getEndOffset();\n  var newBlocks = blockMap.skipUntil(function (_, k) {\n    return k === startKey;\n  }).takeUntil(function (_, k) {\n    return k === endKey;\n  }).toOrderedMap().merge(Immutable.OrderedMap([[endKey, blockMap.get(endKey)]])).map(function (block, blockKey) {\n    var sliceStart = blockKey === startKey ? startOffset : 0;\n    var sliceEnd = blockKey === endKey ? endOffset : block.getLength();\n    return applyEntityToContentBlock(block, sliceStart, sliceEnd, entityKey);\n  });\n  return contentState.merge({\n    blockMap: blockMap.merge(newBlocks),\n    selectionBefore: selectionState,\n    selectionAfter: selectionState\n  });\n}\n\nmodule.exports = applyEntityToContentState;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\n/**\n * Identify the range to delete from a segmented entity.\n *\n * Rules:\n *\n *  Example: 'John F. Kennedy'\n *\n *   - Deletion from within any non-whitespace (i.e. ['John', 'F.', 'Kennedy'])\n *     will return the range of that text.\n *\n *       'John F. Kennedy' -> 'John F.'\n *                  ^\n *\n *   - Forward deletion of whitespace will remove the following section:\n *\n *       'John F. Kennedy' -> 'John Kennedy'\n *            ^\n *\n *   - Backward deletion of whitespace will remove the previous section:\n *\n *       'John F. Kennedy' -> 'F. Kennedy'\n *            ^\n */\nvar DraftEntitySegments = {\n  getRemovalRange: function getRemovalRange(selectionStart, selectionEnd, text, entityStart, direction) {\n    var segments = text.split(' ');\n    segments = segments.map(function (\n    /*string*/\n    segment,\n    /*number*/\n    ii) {\n      if (direction === 'forward') {\n        if (ii > 0) {\n          return ' ' + segment;\n        }\n      } else if (ii < segments.length - 1) {\n        return segment + ' ';\n      }\n\n      return segment;\n    });\n    var segmentStart = entityStart;\n    var segmentEnd;\n    var segment;\n    var removalStart = null;\n    var removalEnd = null;\n\n    for (var jj = 0; jj < segments.length; jj++) {\n      segment = segments[jj];\n      segmentEnd = segmentStart + segment.length; // Our selection overlaps this segment.\n\n      if (selectionStart < segmentEnd && segmentStart < selectionEnd) {\n        if (removalStart !== null) {\n          removalEnd = segmentEnd;\n        } else {\n          removalStart = segmentStart;\n          removalEnd = segmentEnd;\n        }\n      } else if (removalStart !== null) {\n        break;\n      }\n\n      segmentStart = segmentEnd;\n    }\n\n    var entityEnd = entityStart + text.length;\n    var atStart = removalStart === entityStart;\n    var atEnd = removalEnd === entityEnd;\n\n    if (!atStart && atEnd || atStart && !atEnd) {\n      if (direction === 'forward') {\n        if (removalEnd !== entityEnd) {\n          removalEnd++;\n        }\n      } else if (removalStart !== entityStart) {\n        removalStart--;\n      }\n    }\n\n    return {\n      start: removalStart,\n      end: removalEnd\n    };\n  }\n};\nmodule.exports = DraftEntitySegments;", "/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n'use strict';\n\nvar validateFormat = process.env.NODE_ENV !== \"production\" ? function (format) {} : function (format) {\n  if (format === undefined) {\n    throw new Error('invariant(...): Second argument must be a string.');\n  }\n};\n/**\n * Use invariant() to assert state which your program assumes to be true.\n *\n * Provide sprintf-style format (only %s is supported) and arguments to provide\n * information about what broke and what you were expecting.\n *\n * The invariant message will be stripped in production, but the invariant will\n * remain to ensure logic does not differ in production.\n */\n\nfunction invariant(condition, format) {\n  for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n    args[_key - 2] = arguments[_key];\n  }\n\n  validateFormat(format);\n\n  if (!condition) {\n    var error;\n\n    if (format === undefined) {\n      error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');\n    } else {\n      var argIndex = 0;\n      error = new Error(format.replace(/%s/g, function () {\n        return String(args[argIndex++]);\n      }));\n      error.name = 'Invariant Violation';\n    }\n\n    error.framesToPop = 1; // Skip invariant's own stack frame.\n\n    throw error;\n  }\n}\n\nmodule.exports = invariant;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar invariant = require(\"fbjs/lib/invariant\");\n/**\n * Obtain the start and end positions of the range that has the\n * specified entity applied to it.\n *\n * Entity keys are applied only to contiguous stretches of text, so this\n * method searches for the first instance of the entity key and returns\n * the subsequent range.\n */\n\n\nfunction getRangesForDraftEntity(block, key) {\n  var ranges = [];\n  block.findEntityRanges(function (c) {\n    return c.getEntity() === key;\n  }, function (start, end) {\n    ranges.push({\n      start: start,\n      end: end\n    });\n  });\n  !!!ranges.length ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Entity key not found in this range.') : invariant(false) : void 0;\n  return ranges;\n}\n\nmodule.exports = getRangesForDraftEntity;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar DraftEntitySegments = require(\"./DraftEntitySegments\");\n\nvar getRangesForDraftEntity = require(\"./getRangesForDraftEntity\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n/**\n * Given a SelectionState and a removal direction, determine the entire range\n * that should be removed from a ContentState. This is based on any entities\n * within the target, with their `mutability` values taken into account.\n *\n * For instance, if we are attempting to remove part of an \"immutable\" entity\n * range, the entire entity must be removed. The returned `SelectionState`\n * will be adjusted accordingly.\n */\n\n\nfunction getCharacterRemovalRange(entityMap, startBlock, endBlock, selectionState, direction) {\n  var start = selectionState.getStartOffset();\n  var end = selectionState.getEndOffset();\n  var startEntityKey = startBlock.getEntityAt(start);\n  var endEntityKey = endBlock.getEntityAt(end - 1);\n\n  if (!startEntityKey && !endEntityKey) {\n    return selectionState;\n  }\n\n  var newSelectionState = selectionState;\n\n  if (startEntityKey && startEntityKey === endEntityKey) {\n    newSelectionState = getEntityRemovalRange(entityMap, startBlock, newSelectionState, direction, startEntityKey, true, true);\n  } else if (startEntityKey && endEntityKey) {\n    var startSelectionState = getEntityRemovalRange(entityMap, startBlock, newSelectionState, direction, startEntityKey, false, true);\n    var endSelectionState = getEntityRemovalRange(entityMap, endBlock, newSelectionState, direction, endEntityKey, false, false);\n    newSelectionState = newSelectionState.merge({\n      anchorOffset: startSelectionState.getAnchorOffset(),\n      focusOffset: endSelectionState.getFocusOffset(),\n      isBackward: false\n    });\n  } else if (startEntityKey) {\n    var _startSelectionState = getEntityRemovalRange(entityMap, startBlock, newSelectionState, direction, startEntityKey, false, true);\n\n    newSelectionState = newSelectionState.merge({\n      anchorOffset: _startSelectionState.getStartOffset(),\n      isBackward: false\n    });\n  } else if (endEntityKey) {\n    var _endSelectionState = getEntityRemovalRange(entityMap, endBlock, newSelectionState, direction, endEntityKey, false, false);\n\n    newSelectionState = newSelectionState.merge({\n      focusOffset: _endSelectionState.getEndOffset(),\n      isBackward: false\n    });\n  }\n\n  return newSelectionState;\n}\n\nfunction getEntityRemovalRange(entityMap, block, selectionState, direction, entityKey, isEntireSelectionWithinEntity, isEntityAtStart) {\n  var start = selectionState.getStartOffset();\n  var end = selectionState.getEndOffset();\n\n  var entity = entityMap.__get(entityKey);\n\n  var mutability = entity.getMutability();\n  var sideToConsider = isEntityAtStart ? start : end; // `MUTABLE` entities can just have the specified range of text removed\n  // directly. No adjustments are needed.\n\n  if (mutability === 'MUTABLE') {\n    return selectionState;\n  } // Find the entity range that overlaps with our removal range.\n\n\n  var entityRanges = getRangesForDraftEntity(block, entityKey).filter(function (range) {\n    return sideToConsider <= range.end && sideToConsider >= range.start;\n  });\n  !(entityRanges.length == 1) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'There should only be one entity range within this removal range.') : invariant(false) : void 0;\n  var entityRange = entityRanges[0]; // For `IMMUTABLE` entity types, we will remove the entire entity range.\n\n  if (mutability === 'IMMUTABLE') {\n    return selectionState.merge({\n      anchorOffset: entityRange.start,\n      focusOffset: entityRange.end,\n      isBackward: false\n    });\n  } // For `SEGMENTED` entity types, determine the appropriate segment to\n  // remove.\n\n\n  if (!isEntireSelectionWithinEntity) {\n    if (isEntityAtStart) {\n      end = entityRange.end;\n    } else {\n      start = entityRange.start;\n    }\n  }\n\n  var removalRange = DraftEntitySegments.getRemovalRange(start, end, block.getText().slice(entityRange.start, entityRange.end), entityRange.start, direction);\n  return selectionState.merge({\n    anchorOffset: removalRange.start,\n    focusOffset: removalRange.end,\n    isBackward: false\n  });\n}\n\nmodule.exports = getCharacterRemovalRange;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar seenKeys = {};\nvar MULTIPLIER = Math.pow(2, 24);\n\nfunction generateRandomKey() {\n  var key;\n\n  while (key === undefined || seenKeys.hasOwnProperty(key) || !isNaN(+key)) {\n    key = Math.floor(Math.random() * MULTIPLIER).toString(32);\n  }\n\n  seenKeys[key] = true;\n  return key;\n}\n\nmodule.exports = generateRandomKey;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar ContentBlockNode = require(\"./ContentBlockNode\");\n\nvar generateRandomKey = require(\"./generateRandomKey\");\n\nvar Immutable = require(\"immutable\");\n\nvar OrderedMap = Immutable.OrderedMap;\n\nvar randomizeContentBlockNodeKeys = function randomizeContentBlockNodeKeys(blockMap) {\n  var newKeysRef = {}; // we keep track of root blocks in order to update subsequent sibling links\n\n  var lastRootBlock;\n  return OrderedMap(blockMap.withMutations(function (blockMapState) {\n    blockMapState.forEach(function (block, index) {\n      var oldKey = block.getKey();\n      var nextKey = block.getNextSiblingKey();\n      var prevKey = block.getPrevSiblingKey();\n      var childrenKeys = block.getChildKeys();\n      var parentKey = block.getParentKey(); // new key that we will use to build linking\n\n      var key = generateRandomKey(); // we will add it here to re-use it later\n\n      newKeysRef[oldKey] = key;\n\n      if (nextKey) {\n        var nextBlock = blockMapState.get(nextKey);\n\n        if (nextBlock) {\n          blockMapState.setIn([nextKey, 'prevSibling'], key);\n        } else {\n          // this can happen when generating random keys for fragments\n          blockMapState.setIn([oldKey, 'nextSibling'], null);\n        }\n      }\n\n      if (prevKey) {\n        var prevBlock = blockMapState.get(prevKey);\n\n        if (prevBlock) {\n          blockMapState.setIn([prevKey, 'nextSibling'], key);\n        } else {\n          // this can happen when generating random keys for fragments\n          blockMapState.setIn([oldKey, 'prevSibling'], null);\n        }\n      }\n\n      if (parentKey && blockMapState.get(parentKey)) {\n        var parentBlock = blockMapState.get(parentKey);\n        var parentChildrenList = parentBlock.getChildKeys();\n        blockMapState.setIn([parentKey, 'children'], parentChildrenList.set(parentChildrenList.indexOf(block.getKey()), key));\n      } else {\n        // blocks will then be treated as root block nodes\n        blockMapState.setIn([oldKey, 'parent'], null);\n\n        if (lastRootBlock) {\n          blockMapState.setIn([lastRootBlock.getKey(), 'nextSibling'], key);\n          blockMapState.setIn([oldKey, 'prevSibling'], newKeysRef[lastRootBlock.getKey()]);\n        }\n\n        lastRootBlock = blockMapState.get(oldKey);\n      }\n\n      childrenKeys.forEach(function (childKey) {\n        var childBlock = blockMapState.get(childKey);\n\n        if (childBlock) {\n          blockMapState.setIn([childKey, 'parent'], key);\n        } else {\n          blockMapState.setIn([oldKey, 'children'], block.getChildKeys().filter(function (child) {\n            return child !== childKey;\n          }));\n        }\n      });\n    });\n  }).toArray().map(function (block) {\n    return [newKeysRef[block.getKey()], block.set('key', newKeysRef[block.getKey()])];\n  }));\n};\n\nvar randomizeContentBlockKeys = function randomizeContentBlockKeys(blockMap) {\n  return OrderedMap(blockMap.toArray().map(function (block) {\n    var key = generateRandomKey();\n    return [key, block.set('key', key)];\n  }));\n};\n\nvar randomizeBlockMapKeys = function randomizeBlockMapKeys(blockMap) {\n  var isTreeBasedBlockMap = blockMap.first() instanceof ContentBlockNode;\n\n  if (!isTreeBasedBlockMap) {\n    return randomizeContentBlockKeys(blockMap);\n  }\n\n  return randomizeContentBlockNodeKeys(blockMap);\n};\n\nmodule.exports = randomizeBlockMapKeys;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar CharacterMetadata = require(\"./CharacterMetadata\");\n\nvar findRangesImmutable = require(\"./findRangesImmutable\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nfunction removeEntitiesAtEdges(contentState, selectionState) {\n  var blockMap = contentState.getBlockMap();\n  var entityMap = contentState.getEntityMap();\n  var updatedBlocks = {};\n  var startKey = selectionState.getStartKey();\n  var startOffset = selectionState.getStartOffset();\n  var startBlock = blockMap.get(startKey);\n  var updatedStart = removeForBlock(entityMap, startBlock, startOffset);\n\n  if (updatedStart !== startBlock) {\n    updatedBlocks[startKey] = updatedStart;\n  }\n\n  var endKey = selectionState.getEndKey();\n  var endOffset = selectionState.getEndOffset();\n  var endBlock = blockMap.get(endKey);\n\n  if (startKey === endKey) {\n    endBlock = updatedStart;\n  }\n\n  var updatedEnd = removeForBlock(entityMap, endBlock, endOffset);\n\n  if (updatedEnd !== endBlock) {\n    updatedBlocks[endKey] = updatedEnd;\n  }\n\n  if (!Object.keys(updatedBlocks).length) {\n    return contentState.set('selectionAfter', selectionState);\n  }\n\n  return contentState.merge({\n    blockMap: blockMap.merge(updatedBlocks),\n    selectionAfter: selectionState\n  });\n}\n/**\n * Given a list of characters and an offset that is in the middle of an entity,\n * returns the start and end of the entity that is overlapping the offset.\n * Note: This method requires that the offset be in an entity range.\n */\n\n\nfunction getRemovalRange(characters, entityKey, offset) {\n  var removalRange; // Iterates through a list looking for ranges of matching items\n  // based on the 'isEqual' callback.\n  // Then instead of returning the result, call the 'found' callback\n  // with each range.\n  // Then filters those ranges based on the 'filter' callback\n  //\n  // Here we use it to find ranges of characters with the same entity key.\n\n  findRangesImmutable(characters, // the list to iterate through\n  function (a, b) {\n    return a.getEntity() === b.getEntity();\n  }, // 'isEqual' callback\n  function (element) {\n    return element.getEntity() === entityKey;\n  }, // 'filter' callback\n  function (start, end) {\n    // 'found' callback\n    if (start <= offset && end >= offset) {\n      // this entity overlaps the offset index\n      removalRange = {\n        start: start,\n        end: end\n      };\n    }\n  });\n  !(typeof removalRange === 'object') ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Removal range must exist within character list.') : invariant(false) : void 0;\n  return removalRange;\n}\n\nfunction removeForBlock(entityMap, block, offset) {\n  var chars = block.getCharacterList();\n  var charBefore = offset > 0 ? chars.get(offset - 1) : undefined;\n  var charAfter = offset < chars.count() ? chars.get(offset) : undefined;\n  var entityBeforeCursor = charBefore ? charBefore.getEntity() : undefined;\n  var entityAfterCursor = charAfter ? charAfter.getEntity() : undefined;\n\n  if (entityAfterCursor && entityAfterCursor === entityBeforeCursor) {\n    var entity = entityMap.__get(entityAfterCursor);\n\n    if (entity.getMutability() !== 'MUTABLE') {\n      var _getRemovalRange = getRemovalRange(chars, entityAfterCursor, offset),\n          start = _getRemovalRange.start,\n          end = _getRemovalRange.end;\n\n      var current;\n\n      while (start < end) {\n        current = chars.get(start);\n        chars = chars.set(start, CharacterMetadata.applyEntity(current, null));\n        start++;\n      }\n\n      return block.set('characterList', chars);\n    }\n  }\n\n  return block;\n}\n\nmodule.exports = removeEntitiesAtEdges;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar randomizeBlockMapKeys = require(\"./randomizeBlockMapKeys\");\n\nvar removeEntitiesAtEdges = require(\"./removeEntitiesAtEdges\");\n\nvar getContentStateFragment = function getContentStateFragment(contentState, selectionState) {\n  var startKey = selectionState.getStartKey();\n  var startOffset = selectionState.getStartOffset();\n  var endKey = selectionState.getEndKey();\n  var endOffset = selectionState.getEndOffset(); // Edge entities should be stripped to ensure that we don't preserve\n  // invalid partial entities when the fragment is reused. We do, however,\n  // preserve entities that are entirely within the selection range.\n\n  var contentWithoutEdgeEntities = removeEntitiesAtEdges(contentState, selectionState);\n  var blockMap = contentWithoutEdgeEntities.getBlockMap();\n  var blockKeys = blockMap.keySeq();\n  var startIndex = blockKeys.indexOf(startKey);\n  var endIndex = blockKeys.indexOf(endKey) + 1;\n  return randomizeBlockMapKeys(blockMap.slice(startIndex, endIndex).map(function (block, blockKey) {\n    var text = block.getText();\n    var chars = block.getCharacterList();\n\n    if (startKey === endKey) {\n      return block.merge({\n        text: text.slice(startOffset, endOffset),\n        characterList: chars.slice(startOffset, endOffset)\n      });\n    }\n\n    if (blockKey === startKey) {\n      return block.merge({\n        text: text.slice(startOffset),\n        characterList: chars.slice(startOffset)\n      });\n    }\n\n    if (blockKey === endKey) {\n      return block.merge({\n        text: text.slice(0, endOffset),\n        characterList: chars.slice(0, endOffset)\n      });\n    }\n\n    return block;\n  }));\n};\n\nmodule.exports = getContentStateFragment;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\n/**\n * Maintain persistence for target list when appending and prepending.\n */\nfunction insertIntoList(targetListArg, toInsert, offset) {\n  var targetList = targetListArg;\n\n  if (offset === targetList.count()) {\n    toInsert.forEach(function (c) {\n      targetList = targetList.push(c);\n    });\n  } else if (offset === 0) {\n    toInsert.reverse().forEach(function (c) {\n      targetList = targetList.unshift(c);\n    });\n  } else {\n    var head = targetList.slice(0, offset);\n    var tail = targetList.slice(offset);\n    targetList = head.concat(toInsert, tail).toList();\n  }\n\n  return targetList;\n}\n\nmodule.exports = insertIntoList;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar BlockMapBuilder = require(\"./BlockMapBuilder\");\n\nvar ContentBlockNode = require(\"./ContentBlockNode\");\n\nvar Immutable = require(\"immutable\");\n\nvar insertIntoList = require(\"./insertIntoList\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar randomizeBlockMapKeys = require(\"./randomizeBlockMapKeys\");\n\nvar List = Immutable.List;\n\nvar updateExistingBlock = function updateExistingBlock(contentState, selectionState, blockMap, fragmentBlock, targetKey, targetOffset) {\n  var mergeBlockData = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 'REPLACE_WITH_NEW_DATA';\n  var targetBlock = blockMap.get(targetKey);\n  var text = targetBlock.getText();\n  var chars = targetBlock.getCharacterList();\n  var finalKey = targetKey;\n  var finalOffset = targetOffset + fragmentBlock.getText().length;\n  var data = null;\n\n  switch (mergeBlockData) {\n    case 'MERGE_OLD_DATA_TO_NEW_DATA':\n      data = fragmentBlock.getData().merge(targetBlock.getData());\n      break;\n\n    case 'REPLACE_WITH_NEW_DATA':\n      data = fragmentBlock.getData();\n      break;\n  }\n\n  var newBlock = targetBlock.merge({\n    text: text.slice(0, targetOffset) + fragmentBlock.getText() + text.slice(targetOffset),\n    characterList: insertIntoList(chars, fragmentBlock.getCharacterList(), targetOffset),\n    data: data\n  });\n  return contentState.merge({\n    blockMap: blockMap.set(targetKey, newBlock),\n    selectionBefore: selectionState,\n    selectionAfter: selectionState.merge({\n      anchorKey: finalKey,\n      anchorOffset: finalOffset,\n      focusKey: finalKey,\n      focusOffset: finalOffset,\n      isBackward: false\n    })\n  });\n};\n/**\n * Appends text/characterList from the fragment first block to\n * target block.\n */\n\n\nvar updateHead = function updateHead(block, targetOffset, fragment) {\n  var text = block.getText();\n  var chars = block.getCharacterList(); // Modify head portion of block.\n\n  var headText = text.slice(0, targetOffset);\n  var headCharacters = chars.slice(0, targetOffset);\n  var appendToHead = fragment.first();\n  return block.merge({\n    text: headText + appendToHead.getText(),\n    characterList: headCharacters.concat(appendToHead.getCharacterList()),\n    type: headText ? block.getType() : appendToHead.getType(),\n    data: appendToHead.getData()\n  });\n};\n/**\n * Appends offset text/characterList from the target block to the last\n * fragment block.\n */\n\n\nvar updateTail = function updateTail(block, targetOffset, fragment) {\n  // Modify tail portion of block.\n  var text = block.getText();\n  var chars = block.getCharacterList(); // Modify head portion of block.\n\n  var blockSize = text.length;\n  var tailText = text.slice(targetOffset, blockSize);\n  var tailCharacters = chars.slice(targetOffset, blockSize);\n  var prependToTail = fragment.last();\n  return prependToTail.merge({\n    text: prependToTail.getText() + tailText,\n    characterList: prependToTail.getCharacterList().concat(tailCharacters),\n    data: prependToTail.getData()\n  });\n};\n\nvar getRootBlocks = function getRootBlocks(block, blockMap) {\n  var headKey = block.getKey();\n  var rootBlock = block;\n  var rootBlocks = []; // sometimes the fragment head block will not be part of the blockMap itself this can happen when\n  // the fragment head is used to update the target block, however when this does not happen we need\n  // to make sure that we include it on the rootBlocks since the first block of a fragment is always a\n  // fragment root block\n\n  if (blockMap.get(headKey)) {\n    rootBlocks.push(headKey);\n  }\n\n  while (rootBlock && rootBlock.getNextSiblingKey()) {\n    var lastSiblingKey = rootBlock.getNextSiblingKey();\n\n    if (!lastSiblingKey) {\n      break;\n    }\n\n    rootBlocks.push(lastSiblingKey);\n    rootBlock = blockMap.get(lastSiblingKey);\n  }\n\n  return rootBlocks;\n};\n\nvar updateBlockMapLinks = function updateBlockMapLinks(blockMap, originalBlockMap, targetBlock, fragmentHeadBlock) {\n  return blockMap.withMutations(function (blockMapState) {\n    var targetKey = targetBlock.getKey();\n    var headKey = fragmentHeadBlock.getKey();\n    var targetNextKey = targetBlock.getNextSiblingKey();\n    var targetParentKey = targetBlock.getParentKey();\n    var fragmentRootBlocks = getRootBlocks(fragmentHeadBlock, blockMap);\n    var lastRootFragmentBlockKey = fragmentRootBlocks[fragmentRootBlocks.length - 1];\n\n    if (blockMapState.get(headKey)) {\n      // update the fragment head when it is part of the blockMap otherwise\n      blockMapState.setIn([targetKey, 'nextSibling'], headKey);\n      blockMapState.setIn([headKey, 'prevSibling'], targetKey);\n    } else {\n      // update the target block that had the fragment head contents merged into it\n      blockMapState.setIn([targetKey, 'nextSibling'], fragmentHeadBlock.getNextSiblingKey());\n      blockMapState.setIn([fragmentHeadBlock.getNextSiblingKey(), 'prevSibling'], targetKey);\n    } // update the last root block fragment\n\n\n    blockMapState.setIn([lastRootFragmentBlockKey, 'nextSibling'], targetNextKey); // update the original target next block\n\n    if (targetNextKey) {\n      blockMapState.setIn([targetNextKey, 'prevSibling'], lastRootFragmentBlockKey);\n    } // update fragment parent links\n\n\n    fragmentRootBlocks.forEach(function (blockKey) {\n      return blockMapState.setIn([blockKey, 'parent'], targetParentKey);\n    }); // update targetBlock parent child links\n\n    if (targetParentKey) {\n      var targetParent = blockMap.get(targetParentKey);\n      var originalTargetParentChildKeys = targetParent.getChildKeys();\n      var targetBlockIndex = originalTargetParentChildKeys.indexOf(targetKey);\n      var insertionIndex = targetBlockIndex + 1;\n      var newChildrenKeysArray = originalTargetParentChildKeys.toArray(); // insert fragment children\n\n      newChildrenKeysArray.splice.apply(newChildrenKeysArray, [insertionIndex, 0].concat(fragmentRootBlocks));\n      blockMapState.setIn([targetParentKey, 'children'], List(newChildrenKeysArray));\n    }\n  });\n};\n\nvar insertFragment = function insertFragment(contentState, selectionState, blockMap, fragment, targetKey, targetOffset) {\n  var isTreeBasedBlockMap = blockMap.first() instanceof ContentBlockNode;\n  var newBlockArr = [];\n  var fragmentSize = fragment.size;\n  var target = blockMap.get(targetKey);\n  var head = fragment.first();\n  var tail = fragment.last();\n  var finalOffset = tail.getLength();\n  var finalKey = tail.getKey();\n  var shouldNotUpdateFromFragmentBlock = isTreeBasedBlockMap && (!target.getChildKeys().isEmpty() || !head.getChildKeys().isEmpty());\n  blockMap.forEach(function (block, blockKey) {\n    if (blockKey !== targetKey) {\n      newBlockArr.push(block);\n      return;\n    }\n\n    if (shouldNotUpdateFromFragmentBlock) {\n      newBlockArr.push(block);\n    } else {\n      newBlockArr.push(updateHead(block, targetOffset, fragment));\n    } // Insert fragment blocks after the head and before the tail.\n\n\n    fragment // when we are updating the target block with the head fragment block we skip the first fragment\n    // head since its contents have already been merged with the target block otherwise we include\n    // the whole fragment\n    .slice(shouldNotUpdateFromFragmentBlock ? 0 : 1, fragmentSize - 1).forEach(function (fragmentBlock) {\n      return newBlockArr.push(fragmentBlock);\n    }); // update tail\n\n    newBlockArr.push(updateTail(block, targetOffset, fragment));\n  });\n  var updatedBlockMap = BlockMapBuilder.createFromArray(newBlockArr);\n\n  if (isTreeBasedBlockMap) {\n    updatedBlockMap = updateBlockMapLinks(updatedBlockMap, blockMap, target, head);\n  }\n\n  return contentState.merge({\n    blockMap: updatedBlockMap,\n    selectionBefore: selectionState,\n    selectionAfter: selectionState.merge({\n      anchorKey: finalKey,\n      anchorOffset: finalOffset,\n      focusKey: finalKey,\n      focusOffset: finalOffset,\n      isBackward: false\n    })\n  });\n};\n\nvar insertFragmentIntoContentState = function insertFragmentIntoContentState(contentState, selectionState, fragmentBlockMap) {\n  var mergeBlockData = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'REPLACE_WITH_NEW_DATA';\n  !selectionState.isCollapsed() ? process.env.NODE_ENV !== \"production\" ? invariant(false, '`insertFragment` should only be called with a collapsed selection state.') : invariant(false) : void 0;\n  var blockMap = contentState.getBlockMap();\n  var fragment = randomizeBlockMapKeys(fragmentBlockMap);\n  var targetKey = selectionState.getStartKey();\n  var targetOffset = selectionState.getStartOffset();\n  var targetBlock = blockMap.get(targetKey);\n\n  if (targetBlock instanceof ContentBlockNode) {\n    !targetBlock.getChildKeys().isEmpty() ? process.env.NODE_ENV !== \"production\" ? invariant(false, '`insertFragment` should not be called when a container node is selected.') : invariant(false) : void 0;\n  } // When we insert a fragment with a single block we simply update the target block\n  // with the contents of the inserted fragment block\n\n\n  if (fragment.size === 1) {\n    return updateExistingBlock(contentState, selectionState, blockMap, fragment.first(), targetKey, targetOffset, mergeBlockData);\n  }\n\n  return insertFragment(contentState, selectionState, blockMap, fragment, targetKey, targetOffset);\n};\n\nmodule.exports = insertFragmentIntoContentState;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar Immutable = require(\"immutable\");\n\nvar insertIntoList = require(\"./insertIntoList\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar Repeat = Immutable.Repeat;\n\nfunction insertTextIntoContentState(contentState, selectionState, text, characterMetadata) {\n  !selectionState.isCollapsed() ? process.env.NODE_ENV !== \"production\" ? invariant(false, '`insertText` should only be called with a collapsed range.') : invariant(false) : void 0;\n  var len = null;\n\n  if (text != null) {\n    len = text.length;\n  }\n\n  if (len == null || len === 0) {\n    return contentState;\n  }\n\n  var blockMap = contentState.getBlockMap();\n  var key = selectionState.getStartKey();\n  var offset = selectionState.getStartOffset();\n  var block = blockMap.get(key);\n  var blockText = block.getText();\n  var newBlock = block.merge({\n    text: blockText.slice(0, offset) + text + blockText.slice(offset, block.getLength()),\n    characterList: insertIntoList(block.getCharacterList(), Repeat(characterMetadata, len).toList(), offset)\n  });\n  var newOffset = offset + len;\n  return contentState.merge({\n    blockMap: blockMap.set(key, newBlock),\n    selectionAfter: selectionState.merge({\n      anchorOffset: newOffset,\n      focusOffset: newOffset\n    })\n  });\n}\n\nmodule.exports = insertTextIntoContentState;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar Immutable = require(\"immutable\");\n\nvar Map = Immutable.Map;\n\nfunction modifyBlockForContentState(contentState, selectionState, operation) {\n  var startKey = selectionState.getStartKey();\n  var endKey = selectionState.getEndKey();\n  var blockMap = contentState.getBlockMap();\n  var newBlocks = blockMap.toSeq().skipUntil(function (_, k) {\n    return k === startKey;\n  }).takeUntil(function (_, k) {\n    return k === endKey;\n  }).concat(Map([[endKey, blockMap.get(endKey)]])).map(operation);\n  return contentState.merge({\n    blockMap: blockMap.merge(newBlocks),\n    selectionBefore: selectionState,\n    selectionAfter: selectionState\n  });\n}\n\nmodule.exports = modifyBlockForContentState;", "\"use strict\";\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n *\n * This is unstable and not part of the public API and should not be used by\n * production systems. This file may be update/removed without notice.\n */\nvar ContentBlockNode = require(\"./ContentBlockNode\");\n\nvar getNextDelimiterBlockKey = function getNextDelimiterBlockKey(block, blockMap) {\n  var isExperimentalTreeBlock = block instanceof ContentBlockNode;\n\n  if (!isExperimentalTreeBlock) {\n    return null;\n  }\n\n  var nextSiblingKey = block.getNextSiblingKey();\n\n  if (nextSiblingKey) {\n    return nextSiblingKey;\n  }\n\n  var parent = block.getParentKey();\n\n  if (!parent) {\n    return null;\n  }\n\n  var nextNonDescendantBlock = blockMap.get(parent);\n\n  while (nextNonDescendantBlock && !nextNonDescendantBlock.getNextSiblingKey()) {\n    var parentKey = nextNonDescendantBlock.getParentKey();\n    nextNonDescendantBlock = parentKey ? blockMap.get(parentKey) : null;\n  }\n\n  if (!nextNonDescendantBlock) {\n    return null;\n  }\n\n  return nextNonDescendantBlock.getNextSiblingKey();\n};\n\nmodule.exports = getNextDelimiterBlockKey;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar ContentBlockNode = require(\"./ContentBlockNode\");\n\nvar getNextDelimiterBlockKey = require(\"./getNextDelimiterBlockKey\");\n\nvar Immutable = require(\"immutable\");\n\nvar List = Immutable.List,\n    Map = Immutable.Map;\n\nvar transformBlock = function transformBlock(key, blockMap, func) {\n  if (!key) {\n    return;\n  }\n\n  var block = blockMap.get(key);\n\n  if (!block) {\n    return;\n  }\n\n  blockMap.set(key, func(block));\n};\n/**\n * Ancestors needs to be preserved when there are non selected\n * children to make sure we do not leave any orphans behind\n */\n\n\nvar getAncestorsKeys = function getAncestorsKeys(blockKey, blockMap) {\n  var parents = [];\n\n  if (!blockKey) {\n    return parents;\n  }\n\n  var blockNode = blockMap.get(blockKey);\n\n  while (blockNode && blockNode.getParentKey()) {\n    var parentKey = blockNode.getParentKey();\n\n    if (parentKey) {\n      parents.push(parentKey);\n    }\n\n    blockNode = parentKey ? blockMap.get(parentKey) : null;\n  }\n\n  return parents;\n};\n/**\n * Get all next delimiter keys until we hit a root delimiter and return\n * an array of key references\n */\n\n\nvar getNextDelimitersBlockKeys = function getNextDelimitersBlockKeys(block, blockMap) {\n  var nextDelimiters = [];\n\n  if (!block) {\n    return nextDelimiters;\n  }\n\n  var nextDelimiter = getNextDelimiterBlockKey(block, blockMap);\n\n  while (nextDelimiter && blockMap.get(nextDelimiter)) {\n    var _block = blockMap.get(nextDelimiter);\n\n    nextDelimiters.push(nextDelimiter); // we do not need to keep checking all root node siblings, just the first occurance\n\n    nextDelimiter = _block.getParentKey() ? getNextDelimiterBlockKey(_block, blockMap) : null;\n  }\n\n  return nextDelimiters;\n};\n\nvar getNextValidSibling = function getNextValidSibling(block, blockMap, originalBlockMap) {\n  if (!block) {\n    return null;\n  } // note that we need to make sure we refer to the original block since this\n  // function is called within a withMutations\n\n\n  var nextValidSiblingKey = originalBlockMap.get(block.getKey()).getNextSiblingKey();\n\n  while (nextValidSiblingKey && !blockMap.get(nextValidSiblingKey)) {\n    nextValidSiblingKey = originalBlockMap.get(nextValidSiblingKey).getNextSiblingKey() || null;\n  }\n\n  return nextValidSiblingKey;\n};\n\nvar getPrevValidSibling = function getPrevValidSibling(block, blockMap, originalBlockMap) {\n  if (!block) {\n    return null;\n  } // note that we need to make sure we refer to the original block since this\n  // function is called within a withMutations\n\n\n  var prevValidSiblingKey = originalBlockMap.get(block.getKey()).getPrevSiblingKey();\n\n  while (prevValidSiblingKey && !blockMap.get(prevValidSiblingKey)) {\n    prevValidSiblingKey = originalBlockMap.get(prevValidSiblingKey).getPrevSiblingKey() || null;\n  }\n\n  return prevValidSiblingKey;\n};\n\nvar updateBlockMapLinks = function updateBlockMapLinks(blockMap, startBlock, endBlock, originalBlockMap) {\n  return blockMap.withMutations(function (blocks) {\n    // update start block if its retained\n    transformBlock(startBlock.getKey(), blocks, function (block) {\n      return block.merge({\n        nextSibling: getNextValidSibling(block, blocks, originalBlockMap),\n        prevSibling: getPrevValidSibling(block, blocks, originalBlockMap)\n      });\n    }); // update endblock if its retained\n\n    transformBlock(endBlock.getKey(), blocks, function (block) {\n      return block.merge({\n        nextSibling: getNextValidSibling(block, blocks, originalBlockMap),\n        prevSibling: getPrevValidSibling(block, blocks, originalBlockMap)\n      });\n    }); // update start block parent ancestors\n\n    getAncestorsKeys(startBlock.getKey(), originalBlockMap).forEach(function (parentKey) {\n      return transformBlock(parentKey, blocks, function (block) {\n        return block.merge({\n          children: block.getChildKeys().filter(function (key) {\n            return blocks.get(key);\n          }),\n          nextSibling: getNextValidSibling(block, blocks, originalBlockMap),\n          prevSibling: getPrevValidSibling(block, blocks, originalBlockMap)\n        });\n      });\n    }); // update start block next - can only happen if startBlock == endBlock\n\n    transformBlock(startBlock.getNextSiblingKey(), blocks, function (block) {\n      return block.merge({\n        prevSibling: startBlock.getPrevSiblingKey()\n      });\n    }); // update start block prev\n\n    transformBlock(startBlock.getPrevSiblingKey(), blocks, function (block) {\n      return block.merge({\n        nextSibling: getNextValidSibling(block, blocks, originalBlockMap)\n      });\n    }); // update end block next\n\n    transformBlock(endBlock.getNextSiblingKey(), blocks, function (block) {\n      return block.merge({\n        prevSibling: getPrevValidSibling(block, blocks, originalBlockMap)\n      });\n    }); // update end block prev\n\n    transformBlock(endBlock.getPrevSiblingKey(), blocks, function (block) {\n      return block.merge({\n        nextSibling: endBlock.getNextSiblingKey()\n      });\n    }); // update end block parent ancestors\n\n    getAncestorsKeys(endBlock.getKey(), originalBlockMap).forEach(function (parentKey) {\n      transformBlock(parentKey, blocks, function (block) {\n        return block.merge({\n          children: block.getChildKeys().filter(function (key) {\n            return blocks.get(key);\n          }),\n          nextSibling: getNextValidSibling(block, blocks, originalBlockMap),\n          prevSibling: getPrevValidSibling(block, blocks, originalBlockMap)\n        });\n      });\n    }); // update next delimiters all the way to a root delimiter\n\n    getNextDelimitersBlockKeys(endBlock, originalBlockMap).forEach(function (delimiterKey) {\n      return transformBlock(delimiterKey, blocks, function (block) {\n        return block.merge({\n          nextSibling: getNextValidSibling(block, blocks, originalBlockMap),\n          prevSibling: getPrevValidSibling(block, blocks, originalBlockMap)\n        });\n      });\n    }); // if parent (startBlock) was deleted\n\n    if (blockMap.get(startBlock.getKey()) == null && blockMap.get(endBlock.getKey()) != null && endBlock.getParentKey() === startBlock.getKey() && endBlock.getPrevSiblingKey() == null) {\n      var prevSiblingKey = startBlock.getPrevSiblingKey(); // endBlock becomes next sibling of parent's prevSibling\n\n      transformBlock(endBlock.getKey(), blocks, function (block) {\n        return block.merge({\n          prevSibling: prevSiblingKey\n        });\n      });\n      transformBlock(prevSiblingKey, blocks, function (block) {\n        return block.merge({\n          nextSibling: endBlock.getKey()\n        });\n      }); // Update parent for previous parent's children, and children for that parent\n\n      var prevSibling = prevSiblingKey ? blockMap.get(prevSiblingKey) : null;\n      var newParentKey = prevSibling ? prevSibling.getParentKey() : null;\n      startBlock.getChildKeys().forEach(function (childKey) {\n        transformBlock(childKey, blocks, function (block) {\n          return block.merge({\n            parent: newParentKey // set to null if there is no parent\n\n          });\n        });\n      });\n\n      if (newParentKey != null) {\n        var newParent = blockMap.get(newParentKey);\n        transformBlock(newParentKey, blocks, function (block) {\n          return block.merge({\n            children: newParent.getChildKeys().concat(startBlock.getChildKeys())\n          });\n        });\n      } // last child of deleted parent should point to next sibling\n\n\n      transformBlock(startBlock.getChildKeys().find(function (key) {\n        var block = blockMap.get(key);\n        return block.getNextSiblingKey() === null;\n      }), blocks, function (block) {\n        return block.merge({\n          nextSibling: startBlock.getNextSiblingKey()\n        });\n      });\n    }\n  });\n};\n\nvar removeRangeFromContentState = function removeRangeFromContentState(contentState, selectionState) {\n  if (selectionState.isCollapsed()) {\n    return contentState;\n  }\n\n  var blockMap = contentState.getBlockMap();\n  var startKey = selectionState.getStartKey();\n  var startOffset = selectionState.getStartOffset();\n  var endKey = selectionState.getEndKey();\n  var endOffset = selectionState.getEndOffset();\n  var startBlock = blockMap.get(startKey);\n  var endBlock = blockMap.get(endKey); // we assume that ContentBlockNode and ContentBlocks are not mixed together\n\n  var isExperimentalTreeBlock = startBlock instanceof ContentBlockNode; // used to retain blocks that should not be deleted to avoid orphan children\n\n  var parentAncestors = [];\n\n  if (isExperimentalTreeBlock) {\n    var endBlockchildrenKeys = endBlock.getChildKeys();\n    var endBlockAncestors = getAncestorsKeys(endKey, blockMap); // endBlock has unselected siblings so we can not remove its ancestors parents\n\n    if (endBlock.getNextSiblingKey()) {\n      parentAncestors = parentAncestors.concat(endBlockAncestors);\n    } // endBlock has children so can not remove this block or any of its ancestors\n\n\n    if (!endBlockchildrenKeys.isEmpty()) {\n      parentAncestors = parentAncestors.concat(endBlockAncestors.concat([endKey]));\n    } // we need to retain all ancestors of the next delimiter block\n\n\n    parentAncestors = parentAncestors.concat(getAncestorsKeys(getNextDelimiterBlockKey(endBlock, blockMap), blockMap));\n  }\n\n  var characterList;\n\n  if (startBlock === endBlock) {\n    characterList = removeFromList(startBlock.getCharacterList(), startOffset, endOffset);\n  } else {\n    characterList = startBlock.getCharacterList().slice(0, startOffset).concat(endBlock.getCharacterList().slice(endOffset));\n  }\n\n  var modifiedStart = startBlock.merge({\n    text: startBlock.getText().slice(0, startOffset) + endBlock.getText().slice(endOffset),\n    characterList: characterList\n  }); // If cursor (collapsed) is at the start of the first child, delete parent\n  // instead of child\n\n  var shouldDeleteParent = isExperimentalTreeBlock && startOffset === 0 && endOffset === 0 && endBlock.getParentKey() === startKey && endBlock.getPrevSiblingKey() == null;\n  var newBlocks = shouldDeleteParent ? Map([[startKey, null]]) : blockMap.toSeq().skipUntil(function (_, k) {\n    return k === startKey;\n  }).takeUntil(function (_, k) {\n    return k === endKey;\n  }).filter(function (_, k) {\n    return parentAncestors.indexOf(k) === -1;\n  }).concat(Map([[endKey, null]])).map(function (_, k) {\n    return k === startKey ? modifiedStart : null;\n  });\n  var updatedBlockMap = blockMap.merge(newBlocks).filter(function (block) {\n    return !!block;\n  }); // Only update tree block pointers if the range is across blocks\n\n  if (isExperimentalTreeBlock && startBlock !== endBlock) {\n    updatedBlockMap = updateBlockMapLinks(updatedBlockMap, startBlock, endBlock, blockMap);\n  }\n\n  return contentState.merge({\n    blockMap: updatedBlockMap,\n    selectionBefore: selectionState,\n    selectionAfter: selectionState.merge({\n      anchorKey: startKey,\n      anchorOffset: startOffset,\n      focusKey: startKey,\n      focusOffset: startOffset,\n      isBackward: false\n    })\n  });\n};\n/**\n * Maintain persistence for target list when removing characters on the\n * head and tail of the character list.\n */\n\n\nvar removeFromList = function removeFromList(targetList, startOffset, endOffset) {\n  if (startOffset === 0) {\n    while (startOffset < endOffset) {\n      targetList = targetList.shift();\n      startOffset++;\n    }\n  } else if (endOffset === targetList.count()) {\n    while (endOffset > startOffset) {\n      targetList = targetList.pop();\n      endOffset--;\n    }\n  } else {\n    var head = targetList.slice(0, startOffset);\n    var tail = targetList.slice(endOffset);\n    targetList = head.concat(tail).toList();\n  }\n\n  return targetList;\n};\n\nmodule.exports = removeRangeFromContentState;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar ContentBlockNode = require(\"./ContentBlockNode\");\n\nvar generateRandomKey = require(\"./generateRandomKey\");\n\nvar Immutable = require(\"immutable\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar modifyBlockForContentState = require(\"./modifyBlockForContentState\");\n\nvar List = Immutable.List,\n    Map = Immutable.Map;\n\nvar transformBlock = function transformBlock(key, blockMap, func) {\n  if (!key) {\n    return;\n  }\n\n  var block = blockMap.get(key);\n\n  if (!block) {\n    return;\n  }\n\n  blockMap.set(key, func(block));\n};\n\nvar updateBlockMapLinks = function updateBlockMapLinks(blockMap, originalBlock, belowBlock) {\n  return blockMap.withMutations(function (blocks) {\n    var originalBlockKey = originalBlock.getKey();\n    var belowBlockKey = belowBlock.getKey(); // update block parent\n\n    transformBlock(originalBlock.getParentKey(), blocks, function (block) {\n      var parentChildrenList = block.getChildKeys();\n      var insertionIndex = parentChildrenList.indexOf(originalBlockKey) + 1;\n      var newChildrenArray = parentChildrenList.toArray();\n      newChildrenArray.splice(insertionIndex, 0, belowBlockKey);\n      return block.merge({\n        children: List(newChildrenArray)\n      });\n    }); // update original next block\n\n    transformBlock(originalBlock.getNextSiblingKey(), blocks, function (block) {\n      return block.merge({\n        prevSibling: belowBlockKey\n      });\n    }); // update original block\n\n    transformBlock(originalBlockKey, blocks, function (block) {\n      return block.merge({\n        nextSibling: belowBlockKey\n      });\n    }); // update below block\n\n    transformBlock(belowBlockKey, blocks, function (block) {\n      return block.merge({\n        prevSibling: originalBlockKey\n      });\n    });\n  });\n};\n\nvar splitBlockInContentState = function splitBlockInContentState(contentState, selectionState) {\n  !selectionState.isCollapsed() ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Selection range must be collapsed.') : invariant(false) : void 0;\n  var key = selectionState.getAnchorKey();\n  var blockMap = contentState.getBlockMap();\n  var blockToSplit = blockMap.get(key);\n  var text = blockToSplit.getText();\n\n  if (!text) {\n    var blockType = blockToSplit.getType();\n\n    if (blockType === 'unordered-list-item' || blockType === 'ordered-list-item') {\n      return modifyBlockForContentState(contentState, selectionState, function (block) {\n        return block.merge({\n          type: 'unstyled',\n          depth: 0\n        });\n      });\n    }\n  }\n\n  var offset = selectionState.getAnchorOffset();\n  var chars = blockToSplit.getCharacterList();\n  var keyBelow = generateRandomKey();\n  var isExperimentalTreeBlock = blockToSplit instanceof ContentBlockNode;\n  var blockAbove = blockToSplit.merge({\n    text: text.slice(0, offset),\n    characterList: chars.slice(0, offset)\n  });\n  var blockBelow = blockAbove.merge({\n    key: keyBelow,\n    text: text.slice(offset),\n    characterList: chars.slice(offset),\n    data: Map()\n  });\n  var blocksBefore = blockMap.toSeq().takeUntil(function (v) {\n    return v === blockToSplit;\n  });\n  var blocksAfter = blockMap.toSeq().skipUntil(function (v) {\n    return v === blockToSplit;\n  }).rest();\n  var newBlocks = blocksBefore.concat([[key, blockAbove], [keyBelow, blockBelow]], blocksAfter).toOrderedMap();\n\n  if (isExperimentalTreeBlock) {\n    !blockToSplit.getChildKeys().isEmpty() ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'ContentBlockNode must not have children') : invariant(false) : void 0;\n    newBlocks = updateBlockMapLinks(newBlocks, blockAbove, blockBelow);\n  }\n\n  return contentState.merge({\n    blockMap: newBlocks,\n    selectionBefore: selectionState,\n    selectionAfter: selectionState.merge({\n      anchorKey: keyBelow,\n      anchorOffset: 0,\n      focusKey: keyBelow,\n      focusOffset: 0,\n      isBackward: false\n    })\n  });\n};\n\nmodule.exports = splitBlockInContentState;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar CharacterMetadata = require(\"./CharacterMetadata\");\n\nvar ContentStateInlineStyle = require(\"./ContentStateInlineStyle\");\n\nvar applyEntityToContentState = require(\"./applyEntityToContentState\");\n\nvar getCharacterRemovalRange = require(\"./getCharacterRemovalRange\");\n\nvar getContentStateFragment = require(\"./getContentStateFragment\");\n\nvar Immutable = require(\"immutable\");\n\nvar insertFragmentIntoContentState = require(\"./insertFragmentIntoContentState\");\n\nvar insertTextIntoContentState = require(\"./insertTextIntoContentState\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar modifyBlockForContentState = require(\"./modifyBlockForContentState\");\n\nvar removeEntitiesAtEdges = require(\"./removeEntitiesAtEdges\");\n\nvar removeRangeFromContentState = require(\"./removeRangeFromContentState\");\n\nvar splitBlockInContentState = require(\"./splitBlockInContentState\");\n\nvar OrderedSet = Immutable.OrderedSet;\n/**\n * `DraftModifier` provides a set of convenience methods that apply\n * modifications to a `ContentState` object based on a target `SelectionState`.\n *\n * Any change to a `ContentState` should be decomposable into a series of\n * transaction functions that apply the required changes and return output\n * `ContentState` objects.\n *\n * These functions encapsulate some of the most common transaction sequences.\n */\n\nvar DraftModifier = {\n  replaceText: function replaceText(contentState, rangeToReplace, text, inlineStyle, entityKey) {\n    var withoutEntities = removeEntitiesAtEdges(contentState, rangeToReplace);\n    var withoutText = removeRangeFromContentState(withoutEntities, rangeToReplace);\n    var character = CharacterMetadata.create({\n      style: inlineStyle || OrderedSet(),\n      entity: entityKey || null\n    });\n    return insertTextIntoContentState(withoutText, withoutText.getSelectionAfter(), text, character);\n  },\n  insertText: function insertText(contentState, targetRange, text, inlineStyle, entityKey) {\n    !targetRange.isCollapsed() ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Target range must be collapsed for `insertText`.') : invariant(false) : void 0;\n    return DraftModifier.replaceText(contentState, targetRange, text, inlineStyle, entityKey);\n  },\n  moveText: function moveText(contentState, removalRange, targetRange) {\n    var movedFragment = getContentStateFragment(contentState, removalRange);\n    var afterRemoval = DraftModifier.removeRange(contentState, removalRange, 'backward');\n    return DraftModifier.replaceWithFragment(afterRemoval, targetRange, movedFragment);\n  },\n  replaceWithFragment: function replaceWithFragment(contentState, targetRange, fragment) {\n    var mergeBlockData = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'REPLACE_WITH_NEW_DATA';\n    var withoutEntities = removeEntitiesAtEdges(contentState, targetRange);\n    var withoutText = removeRangeFromContentState(withoutEntities, targetRange);\n    return insertFragmentIntoContentState(withoutText, withoutText.getSelectionAfter(), fragment, mergeBlockData);\n  },\n  removeRange: function removeRange(contentState, rangeToRemove, removalDirection) {\n    var startKey, endKey, startBlock, endBlock;\n\n    if (rangeToRemove.getIsBackward()) {\n      rangeToRemove = rangeToRemove.merge({\n        anchorKey: rangeToRemove.getFocusKey(),\n        anchorOffset: rangeToRemove.getFocusOffset(),\n        focusKey: rangeToRemove.getAnchorKey(),\n        focusOffset: rangeToRemove.getAnchorOffset(),\n        isBackward: false\n      });\n    }\n\n    startKey = rangeToRemove.getAnchorKey();\n    endKey = rangeToRemove.getFocusKey();\n    startBlock = contentState.getBlockForKey(startKey);\n    endBlock = contentState.getBlockForKey(endKey);\n    var startOffset = rangeToRemove.getStartOffset();\n    var endOffset = rangeToRemove.getEndOffset();\n    var startEntityKey = startBlock.getEntityAt(startOffset);\n    var endEntityKey = endBlock.getEntityAt(endOffset - 1); // Check whether the selection state overlaps with a single entity.\n    // If so, try to remove the appropriate substring of the entity text.\n\n    if (startKey === endKey) {\n      if (startEntityKey && startEntityKey === endEntityKey) {\n        var adjustedRemovalRange = getCharacterRemovalRange(contentState.getEntityMap(), startBlock, endBlock, rangeToRemove, removalDirection);\n        return removeRangeFromContentState(contentState, adjustedRemovalRange);\n      }\n    }\n\n    var withoutEntities = removeEntitiesAtEdges(contentState, rangeToRemove);\n    return removeRangeFromContentState(withoutEntities, rangeToRemove);\n  },\n  splitBlock: function splitBlock(contentState, selectionState) {\n    var withoutEntities = removeEntitiesAtEdges(contentState, selectionState);\n    var withoutText = removeRangeFromContentState(withoutEntities, selectionState);\n    return splitBlockInContentState(withoutText, withoutText.getSelectionAfter());\n  },\n  applyInlineStyle: function applyInlineStyle(contentState, selectionState, inlineStyle) {\n    return ContentStateInlineStyle.add(contentState, selectionState, inlineStyle);\n  },\n  removeInlineStyle: function removeInlineStyle(contentState, selectionState, inlineStyle) {\n    return ContentStateInlineStyle.remove(contentState, selectionState, inlineStyle);\n  },\n  setBlockType: function setBlockType(contentState, selectionState, blockType) {\n    return modifyBlockForContentState(contentState, selectionState, function (block) {\n      return block.merge({\n        type: blockType,\n        depth: 0\n      });\n    });\n  },\n  setBlockData: function setBlockData(contentState, selectionState, blockData) {\n    return modifyBlockForContentState(contentState, selectionState, function (block) {\n      return block.merge({\n        data: blockData\n      });\n    });\n  },\n  mergeBlockData: function mergeBlockData(contentState, selectionState, blockData) {\n    return modifyBlockForContentState(contentState, selectionState, function (block) {\n      return block.merge({\n        data: block.getData().merge(blockData)\n      });\n    });\n  },\n  applyEntity: function applyEntity(contentState, selectionState, entityKey) {\n    var withoutEntities = removeEntitiesAtEdges(contentState, selectionState);\n    return applyEntityToContentState(withoutEntities, selectionState, entityKey);\n  }\n};\nmodule.exports = DraftModifier;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar findRangesImmutable = require(\"./findRangesImmutable\");\n\nvar Immutable = require(\"immutable\");\n\nvar List = Immutable.List,\n    Repeat = Immutable.Repeat,\n    Record = Immutable.Record;\n\nvar returnTrue = function returnTrue() {\n  return true;\n};\n\nvar defaultLeafRange = {\n  start: null,\n  end: null\n};\nvar LeafRange = Record(defaultLeafRange);\nvar defaultDecoratorRange = {\n  start: null,\n  end: null,\n  decoratorKey: null,\n  leaves: null\n};\nvar DecoratorRange = Record(defaultDecoratorRange);\nvar BlockTree = {\n  /**\n   * Generate a block tree for a given ContentBlock/decorator pair.\n   */\n  generate: function generate(contentState, block, decorator) {\n    var textLength = block.getLength();\n\n    if (!textLength) {\n      return List.of(new DecoratorRange({\n        start: 0,\n        end: 0,\n        decoratorKey: null,\n        leaves: List.of(new LeafRange({\n          start: 0,\n          end: 0\n        }))\n      }));\n    }\n\n    var leafSets = [];\n    var decorations = decorator ? decorator.getDecorations(block, contentState) : List(Repeat(null, textLength));\n    var chars = block.getCharacterList();\n    findRangesImmutable(decorations, areEqual, returnTrue, function (start, end) {\n      leafSets.push(new DecoratorRange({\n        start: start,\n        end: end,\n        decoratorKey: decorations.get(start),\n        leaves: generateLeaves(chars.slice(start, end).toList(), start)\n      }));\n    });\n    return List(leafSets);\n  }\n};\n/**\n * Generate LeafRange records for a given character list.\n */\n\nfunction generateLeaves(characters, offset) {\n  var leaves = [];\n  var inlineStyles = characters.map(function (c) {\n    return c.getStyle();\n  }).toList();\n  findRangesImmutable(inlineStyles, areEqual, returnTrue, function (start, end) {\n    leaves.push(new LeafRange({\n      start: start + offset,\n      end: end + offset\n    }));\n  });\n  return List(leaves);\n}\n\nfunction areEqual(a, b) {\n  return a === b;\n}\n\nmodule.exports = BlockTree;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @legacyServerCallableInstance\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nvar Immutable = require(\"immutable\");\n\nvar Record = Immutable.Record;\nvar DraftEntityInstanceRecord = Record({\n  type: 'TOKEN',\n  mutability: 'IMMUTABLE',\n  data: Object\n});\n/**\n * An instance of a document entity, consisting of a `type` and relevant\n * `data`, metadata about the entity.\n *\n * For instance, a \"link\" entity might provide a URI, and a \"mention\"\n * entity might provide the mentioned user's ID. These pieces of data\n * may be used when rendering the entity as part of a ContentBlock DOM\n * representation. For a link, the data would be used as an href for\n * the rendered anchor. For a mention, the ID could be used to retrieve\n * a hovercard.\n */\n\nvar DraftEntityInstance =\n/*#__PURE__*/\nfunction (_DraftEntityInstanceR) {\n  _inheritsLoose(DraftEntityInstance, _DraftEntityInstanceR);\n\n  function DraftEntityInstance() {\n    return _DraftEntityInstanceR.apply(this, arguments) || this;\n  }\n\n  var _proto = DraftEntityInstance.prototype;\n\n  _proto.getType = function getType() {\n    return this.get('type');\n  };\n\n  _proto.getMutability = function getMutability() {\n    return this.get('mutability');\n  };\n\n  _proto.getData = function getData() {\n    return this.get('data');\n  };\n\n  return DraftEntityInstance;\n}(DraftEntityInstanceRecord);\n\nmodule.exports = DraftEntityInstance;", "\"use strict\";\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\nvar DraftEntityInstance = require(\"./DraftEntityInstance\");\n\nvar Immutable = require(\"immutable\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar Map = Immutable.Map;\nvar instances = Map();\nvar instanceKey = 0;\n/**\n * Temporary utility for generating the warnings\n */\n\nfunction logWarning(oldMethodCall, newMethodCall) {\n  console.warn('WARNING: ' + oldMethodCall + ' will be deprecated soon!\\nPlease use \"' + newMethodCall + '\" instead.');\n}\n\n/**\n * A \"document entity\" is an object containing metadata associated with a\n * piece of text in a ContentBlock.\n *\n * For example, a `link` entity might include a `uri` property. When a\n * ContentBlock is rendered in the browser, text that refers to that link\n * entity may be rendered as an anchor, with the `uri` as the href value.\n *\n * In a ContentBlock, every position in the text may correspond to zero\n * or one entities. This correspondence is tracked using a key string,\n * generated via DraftEntity.create() and used to obtain entity metadata\n * via DraftEntity.get().\n */\nvar DraftEntity = {\n  /**\n   * WARNING: This method will be deprecated soon!\n   * Please use 'contentState.getLastCreatedEntityKey' instead.\n   * ---\n   * Get the random key string from whatever entity was last created.\n   * We need this to support the new API, as part of transitioning to put Entity\n   * storage in contentState.\n   */\n  getLastCreatedEntityKey: function getLastCreatedEntityKey() {\n    logWarning('DraftEntity.getLastCreatedEntityKey', 'contentState.getLastCreatedEntityKey');\n    return DraftEntity.__getLastCreatedEntityKey();\n  },\n\n  /**\n   * WARNING: This method will be deprecated soon!\n   * Please use 'contentState.createEntity' instead.\n   * ---\n   * Create a DraftEntityInstance and store it for later retrieval.\n   *\n   * A random key string will be generated and returned. This key may\n   * be used to track the entity's usage in a ContentBlock, and for\n   * retrieving data about the entity at render time.\n   */\n  create: function create(type, mutability, data) {\n    logWarning('DraftEntity.create', 'contentState.createEntity');\n    return DraftEntity.__create(type, mutability, data);\n  },\n\n  /**\n   * WARNING: This method will be deprecated soon!\n   * Please use 'contentState.addEntity' instead.\n   * ---\n   * Add an existing DraftEntityInstance to the DraftEntity map. This is\n   * useful when restoring instances from the server.\n   */\n  add: function add(instance) {\n    logWarning('DraftEntity.add', 'contentState.addEntity');\n    return DraftEntity.__add(instance);\n  },\n\n  /**\n   * WARNING: This method will be deprecated soon!\n   * Please use 'contentState.getEntity' instead.\n   * ---\n   * Retrieve the entity corresponding to the supplied key string.\n   */\n  get: function get(key) {\n    logWarning('DraftEntity.get', 'contentState.getEntity');\n    return DraftEntity.__get(key);\n  },\n\n  /**\n   * WARNING: This method will be deprecated soon!\n   * Please use 'contentState.mergeEntityData' instead.\n   * ---\n   * Entity instances are immutable. If you need to update the data for an\n   * instance, this method will merge your data updates and return a new\n   * instance.\n   */\n  mergeData: function mergeData(key, toMerge) {\n    logWarning('DraftEntity.mergeData', 'contentState.mergeEntityData');\n    return DraftEntity.__mergeData(key, toMerge);\n  },\n\n  /**\n   * WARNING: This method will be deprecated soon!\n   * Please use 'contentState.replaceEntityData' instead.\n   * ---\n   * Completely replace the data for a given instance.\n   */\n  replaceData: function replaceData(key, newData) {\n    logWarning('DraftEntity.replaceData', 'contentState.replaceEntityData');\n    return DraftEntity.__replaceData(key, newData);\n  },\n  // ***********************************WARNING******************************\n  // --- the above public API will be deprecated in the next version of Draft!\n  // The methods below this line are private - don't call them directly.\n\n  /**\n   * Get the random key string from whatever entity was last created.\n   * We need this to support the new API, as part of transitioning to put Entity\n   * storage in contentState.\n   */\n  __getLastCreatedEntityKey: function __getLastCreatedEntityKey() {\n    return '' + instanceKey;\n  },\n\n  /**\n   * Create a DraftEntityInstance and store it for later retrieval.\n   *\n   * A random key string will be generated and returned. This key may\n   * be used to track the entity's usage in a ContentBlock, and for\n   * retrieving data about the entity at render time.\n   */\n  __create: function __create(type, mutability, data) {\n    return DraftEntity.__add(new DraftEntityInstance({\n      type: type,\n      mutability: mutability,\n      data: data || {}\n    }));\n  },\n\n  /**\n   * Add an existing DraftEntityInstance to the DraftEntity map. This is\n   * useful when restoring instances from the server.\n   */\n  __add: function __add(instance) {\n    var key = '' + ++instanceKey;\n    instances = instances.set(key, instance);\n    return key;\n  },\n\n  /**\n   * Retrieve the entity corresponding to the supplied key string.\n   */\n  __get: function __get(key) {\n    var instance = instances.get(key);\n    !!!instance ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Unknown DraftEntity key: %s.', key) : invariant(false) : void 0;\n    return instance;\n  },\n\n  /**\n   * Entity instances are immutable. If you need to update the data for an\n   * instance, this method will merge your data updates and return a new\n   * instance.\n   */\n  __mergeData: function __mergeData(key, toMerge) {\n    var instance = DraftEntity.__get(key);\n\n    var newData = _objectSpread({}, instance.getData(), toMerge);\n\n    var newInstance = instance.set('data', newData);\n    instances = instances.set(key, newInstance);\n    return newInstance;\n  },\n\n  /**\n   * Completely replace the data for a given instance.\n   */\n  __replaceData: function __replaceData(key, newData) {\n    var instance = DraftEntity.__get(key);\n\n    var newInstance = instance.set('data', newData);\n    instances = instances.set(key, newInstance);\n    return newInstance;\n  }\n};\nmodule.exports = DraftEntity;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nvar Immutable = require(\"immutable\");\n\nvar Record = Immutable.Record;\nvar defaultRecord = {\n  anchorKey: '',\n  anchorOffset: 0,\n  focusKey: '',\n  focusOffset: 0,\n  isBackward: false,\n  hasFocus: false\n};\n/* $FlowFixMe This comment suppresses an error found when automatically adding\n * a type annotation with the codemod Komodo/Annotate_exports. To see the error\n * delete this comment and run Flow. */\n\nvar SelectionStateRecord = Record(defaultRecord);\n\nvar SelectionState =\n/*#__PURE__*/\nfunction (_SelectionStateRecord) {\n  _inheritsLoose(SelectionState, _SelectionStateRecord);\n\n  function SelectionState() {\n    return _SelectionStateRecord.apply(this, arguments) || this;\n  }\n\n  var _proto = SelectionState.prototype;\n\n  _proto.serialize = function serialize() {\n    return 'Anchor: ' + this.getAnchorKey() + ':' + this.getAnchorOffset() + ', ' + 'Focus: ' + this.getFocusKey() + ':' + this.getFocusOffset() + ', ' + 'Is Backward: ' + String(this.getIsBackward()) + ', ' + 'Has Focus: ' + String(this.getHasFocus());\n  };\n\n  _proto.getAnchorKey = function getAnchorKey() {\n    return this.get('anchorKey');\n  };\n\n  _proto.getAnchorOffset = function getAnchorOffset() {\n    return this.get('anchorOffset');\n  };\n\n  _proto.getFocusKey = function getFocusKey() {\n    return this.get('focusKey');\n  };\n\n  _proto.getFocusOffset = function getFocusOffset() {\n    return this.get('focusOffset');\n  };\n\n  _proto.getIsBackward = function getIsBackward() {\n    return this.get('isBackward');\n  };\n\n  _proto.getHasFocus = function getHasFocus() {\n    return this.get('hasFocus');\n  }\n  /**\n   * Return whether the specified range overlaps with an edge of the\n   * SelectionState.\n   */\n  ;\n\n  _proto.hasEdgeWithin = function hasEdgeWithin(blockKey, start, end) {\n    var anchorKey = this.getAnchorKey();\n    var focusKey = this.getFocusKey();\n\n    if (anchorKey === focusKey && anchorKey === blockKey) {\n      var selectionStart = this.getStartOffset();\n      var selectionEnd = this.getEndOffset();\n      return start <= selectionStart && selectionStart <= end || // selectionStart is between start and end, or\n      start <= selectionEnd && selectionEnd <= end // selectionEnd is between start and end\n      ;\n    }\n\n    if (blockKey !== anchorKey && blockKey !== focusKey) {\n      return false;\n    }\n\n    var offsetToCheck = blockKey === anchorKey ? this.getAnchorOffset() : this.getFocusOffset();\n    return start <= offsetToCheck && end >= offsetToCheck;\n  };\n\n  _proto.isCollapsed = function isCollapsed() {\n    return this.getAnchorKey() === this.getFocusKey() && this.getAnchorOffset() === this.getFocusOffset();\n  };\n\n  _proto.getStartKey = function getStartKey() {\n    return this.getIsBackward() ? this.getFocusKey() : this.getAnchorKey();\n  };\n\n  _proto.getStartOffset = function getStartOffset() {\n    return this.getIsBackward() ? this.getFocusOffset() : this.getAnchorOffset();\n  };\n\n  _proto.getEndKey = function getEndKey() {\n    return this.getIsBackward() ? this.getAnchorKey() : this.getFocusKey();\n  };\n\n  _proto.getEndOffset = function getEndOffset() {\n    return this.getIsBackward() ? this.getAnchorOffset() : this.getFocusOffset();\n  };\n\n  SelectionState.createEmpty = function createEmpty(key) {\n    return new SelectionState({\n      anchorKey: key,\n      anchorOffset: 0,\n      focusKey: key,\n      focusOffset: 0,\n      isBackward: false,\n      hasFocus: false\n    });\n  };\n\n  return SelectionState;\n}(SelectionStateRecord);\n\nmodule.exports = SelectionState;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n */\n'use strict';\n\nmodule.exports = function (name) {\n  if (typeof window !== 'undefined' && window.__DRAFT_GKX) {\n    return !!window.__DRAFT_GKX[name];\n  }\n\n  return false;\n};", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar REGEX_BLOCK_DELIMITER = new RegExp('\\r', 'g');\n\nfunction sanitizeDraftText(input) {\n  return input.replace(REGEX_BLOCK_DELIMITER, '');\n}\n\nmodule.exports = sanitizeDraftText;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nvar BlockMapBuilder = require(\"./BlockMapBuilder\");\n\nvar CharacterMetadata = require(\"./CharacterMetadata\");\n\nvar ContentBlock = require(\"./ContentBlock\");\n\nvar ContentBlockNode = require(\"./ContentBlockNode\");\n\nvar DraftEntity = require(\"./DraftEntity\");\n\nvar SelectionState = require(\"./SelectionState\");\n\nvar generateRandomKey = require(\"./generateRandomKey\");\n\nvar gkx = require(\"./gkx\");\n\nvar Immutable = require(\"immutable\");\n\nvar sanitizeDraftText = require(\"./sanitizeDraftText\");\n\nvar List = Immutable.List,\n    Record = Immutable.Record,\n    Repeat = Immutable.Repeat;\nvar defaultRecord = {\n  entityMap: null,\n  blockMap: null,\n  selectionBefore: null,\n  selectionAfter: null\n};\nvar ContentStateRecord = Record(defaultRecord);\n\nvar ContentState =\n/*#__PURE__*/\nfunction (_ContentStateRecord) {\n  _inheritsLoose(ContentState, _ContentStateRecord);\n\n  function ContentState() {\n    return _ContentStateRecord.apply(this, arguments) || this;\n  }\n\n  var _proto = ContentState.prototype;\n\n  _proto.getEntityMap = function getEntityMap() {\n    // TODO: update this when we fully remove DraftEntity\n    return DraftEntity;\n  };\n\n  _proto.getBlockMap = function getBlockMap() {\n    return this.get('blockMap');\n  };\n\n  _proto.getSelectionBefore = function getSelectionBefore() {\n    return this.get('selectionBefore');\n  };\n\n  _proto.getSelectionAfter = function getSelectionAfter() {\n    return this.get('selectionAfter');\n  };\n\n  _proto.getBlockForKey = function getBlockForKey(key) {\n    var block = this.getBlockMap().get(key);\n    return block;\n  };\n\n  _proto.getKeyBefore = function getKeyBefore(key) {\n    return this.getBlockMap().reverse().keySeq().skipUntil(function (v) {\n      return v === key;\n    }).skip(1).first();\n  };\n\n  _proto.getKeyAfter = function getKeyAfter(key) {\n    return this.getBlockMap().keySeq().skipUntil(function (v) {\n      return v === key;\n    }).skip(1).first();\n  };\n\n  _proto.getBlockAfter = function getBlockAfter(key) {\n    return this.getBlockMap().skipUntil(function (_, k) {\n      return k === key;\n    }).skip(1).first();\n  };\n\n  _proto.getBlockBefore = function getBlockBefore(key) {\n    return this.getBlockMap().reverse().skipUntil(function (_, k) {\n      return k === key;\n    }).skip(1).first();\n  };\n\n  _proto.getBlocksAsArray = function getBlocksAsArray() {\n    return this.getBlockMap().toArray();\n  };\n\n  _proto.getFirstBlock = function getFirstBlock() {\n    return this.getBlockMap().first();\n  };\n\n  _proto.getLastBlock = function getLastBlock() {\n    return this.getBlockMap().last();\n  };\n\n  _proto.getPlainText = function getPlainText(delimiter) {\n    return this.getBlockMap().map(function (block) {\n      return block ? block.getText() : '';\n    }).join(delimiter || '\\n');\n  };\n\n  _proto.getLastCreatedEntityKey = function getLastCreatedEntityKey() {\n    // TODO: update this when we fully remove DraftEntity\n    return DraftEntity.__getLastCreatedEntityKey();\n  };\n\n  _proto.hasText = function hasText() {\n    var blockMap = this.getBlockMap();\n    return blockMap.size > 1 || // make sure that there are no zero width space chars\n    escape(blockMap.first().getText()).replace(/%u200B/g, '').length > 0;\n  };\n\n  _proto.createEntity = function createEntity(type, mutability, data) {\n    // TODO: update this when we fully remove DraftEntity\n    DraftEntity.__create(type, mutability, data);\n\n    return this;\n  };\n\n  _proto.mergeEntityData = function mergeEntityData(key, toMerge) {\n    // TODO: update this when we fully remove DraftEntity\n    DraftEntity.__mergeData(key, toMerge);\n\n    return this;\n  };\n\n  _proto.replaceEntityData = function replaceEntityData(key, newData) {\n    // TODO: update this when we fully remove DraftEntity\n    DraftEntity.__replaceData(key, newData);\n\n    return this;\n  };\n\n  _proto.addEntity = function addEntity(instance) {\n    // TODO: update this when we fully remove DraftEntity\n    DraftEntity.__add(instance);\n\n    return this;\n  };\n\n  _proto.getEntity = function getEntity(key) {\n    // TODO: update this when we fully remove DraftEntity\n    return DraftEntity.__get(key);\n  };\n\n  ContentState.createFromBlockArray = function createFromBlockArray( // TODO: update flow type when we completely deprecate the old entity API\n  blocks, entityMap) {\n    // TODO: remove this when we completely deprecate the old entity API\n    var theBlocks = Array.isArray(blocks) ? blocks : blocks.contentBlocks;\n    var blockMap = BlockMapBuilder.createFromArray(theBlocks);\n    var selectionState = blockMap.isEmpty() ? new SelectionState() : SelectionState.createEmpty(blockMap.first().getKey());\n    return new ContentState({\n      blockMap: blockMap,\n      entityMap: entityMap || DraftEntity,\n      selectionBefore: selectionState,\n      selectionAfter: selectionState\n    });\n  };\n\n  ContentState.createFromText = function createFromText(text) {\n    var delimiter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : /\\r\\n?|\\n/g;\n    var strings = text.split(delimiter);\n    var blocks = strings.map(function (block) {\n      block = sanitizeDraftText(block);\n      var ContentBlockNodeRecord = gkx('draft_tree_data_support') ? ContentBlockNode : ContentBlock;\n      return new ContentBlockNodeRecord({\n        key: generateRandomKey(),\n        text: block,\n        type: 'unstyled',\n        characterList: List(Repeat(CharacterMetadata.EMPTY, block.length))\n      });\n    });\n    return ContentState.createFromBlockArray(blocks);\n  };\n\n  return ContentState;\n}(ContentStateRecord);\n\nmodule.exports = ContentState;", "/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n * \n */\n\n/**\n * Constants to represent text directionality\n *\n * Also defines a *global* direciton, to be used in bidi algorithms as a\n * default fallback direciton, when no better direction is found or provided.\n *\n * NOTE: Use `setGlobalDir()`, or update `initGlobalDir()`, to set the initial\n *       global direction value based on the application.\n *\n * Part of the implementation of Unicode Bidirectional Algorithm (UBA)\n * Unicode Standard Annex #9 (UAX9)\n * http://www.unicode.org/reports/tr9/\n */\n'use strict';\n\nvar invariant = require(\"./invariant\");\n\nvar NEUTRAL = 'NEUTRAL'; // No strong direction\n\nvar LTR = 'LTR'; // Left-to-Right direction\n\nvar RTL = 'RTL'; // Right-to-Left direction\n\nvar globalDir = null; // == Helpers ==\n\n/**\n * Check if a directionality value is a Strong one\n */\n\nfunction isStrong(dir) {\n  return dir === LTR || dir === RTL;\n}\n/**\n * Get string value to be used for `dir` HTML attribute or `direction` CSS\n * property.\n */\n\n\nfunction getHTMLDir(dir) {\n  !isStrong(dir) ? process.env.NODE_ENV !== \"production\" ? invariant(false, '`dir` must be a strong direction to be converted to HTML Direction') : invariant(false) : void 0;\n  return dir === LTR ? 'ltr' : 'rtl';\n}\n/**\n * Get string value to be used for `dir` HTML attribute or `direction` CSS\n * property, but returns null if `dir` has same value as `otherDir`.\n * `null`.\n */\n\n\nfunction getHTMLDirIfDifferent(dir, otherDir) {\n  !isStrong(dir) ? process.env.NODE_ENV !== \"production\" ? invariant(false, '`dir` must be a strong direction to be converted to HTML Direction') : invariant(false) : void 0;\n  !isStrong(otherDir) ? process.env.NODE_ENV !== \"production\" ? invariant(false, '`otherDir` must be a strong direction to be converted to HTML Direction') : invariant(false) : void 0;\n  return dir === otherDir ? null : getHTMLDir(dir);\n} // == Global Direction ==\n\n/**\n * Set the global direction.\n */\n\n\nfunction setGlobalDir(dir) {\n  globalDir = dir;\n}\n/**\n * Initialize the global direction\n */\n\n\nfunction initGlobalDir() {\n  setGlobalDir(LTR);\n}\n/**\n * Get the global direction\n */\n\n\nfunction getGlobalDir() {\n  if (!globalDir) {\n    this.initGlobalDir();\n  }\n\n  !globalDir ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Global direction not set.') : invariant(false) : void 0;\n  return globalDir;\n}\n\nvar UnicodeBidiDirection = {\n  // Values\n  NEUTRAL: NEUTRAL,\n  LTR: LTR,\n  RTL: RTL,\n  // Helpers\n  isStrong: isStrong,\n  getHTMLDir: getHTMLDir,\n  getHTMLDirIfDifferent: getHTMLDirIfDifferent,\n  // Global Direction\n  setGlobalDir: setGlobalDir,\n  initGlobalDir: initGlobalDir,\n  getGlobalDir: getGlobalDir\n};\nmodule.exports = UnicodeBidiDirection;", "/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n * \n */\n\n/**\n * Basic (stateless) API for text direction detection\n *\n * Part of our implementation of Unicode Bidirectional Algorithm (UBA)\n * Unicode Standard Annex #9 (UAX9)\n * http://www.unicode.org/reports/tr9/\n */\n'use strict';\n\nvar UnicodeBidiDirection = require(\"./UnicodeBidiDirection\");\n\nvar invariant = require(\"./invariant\");\n\n/**\n * RegExp ranges of characters with a *Strong* Bidi_Class value.\n *\n * Data is based on DerivedBidiClass.txt in UCD version 7.0.0.\n *\n * NOTE: For performance reasons, we only support Unicode's\n *       Basic Multilingual Plane (BMP) for now.\n */\nvar RANGE_BY_BIDI_TYPE = {\n  L: \"A-Za-z\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u01BA\\u01BB\" + \"\\u01BC-\\u01BF\\u01C0-\\u01C3\\u01C4-\\u0293\\u0294\\u0295-\\u02AF\\u02B0-\\u02B8\" + \"\\u02BB-\\u02C1\\u02D0-\\u02D1\\u02E0-\\u02E4\\u02EE\\u0370-\\u0373\\u0376-\\u0377\" + \"\\u037A\\u037B-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\" + \"\\u03A3-\\u03F5\\u03F7-\\u0481\\u0482\\u048A-\\u052F\\u0531-\\u0556\\u0559\" + \"\\u055A-\\u055F\\u0561-\\u0587\\u0589\\u0903\\u0904-\\u0939\\u093B\\u093D\" + \"\\u093E-\\u0940\\u0949-\\u094C\\u094E-\\u094F\\u0950\\u0958-\\u0961\\u0964-\\u0965\" + \"\\u0966-\\u096F\\u0970\\u0971\\u0972-\\u0980\\u0982-\\u0983\\u0985-\\u098C\" + \"\\u098F-\\u0990\\u0993-\\u09A8\\u09AA-\\u09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0F01-\\u0F03\\u0F04-\\u0F12\\u0F13\\u0F14\" + \"\\u0F15-\\u0F17\\u0F1A-\\u0F1F\\u0F20-\\u0F29\\u0F2A-\\u0F33\\u0F34\\u0F36\\u0F38\" + \"\\u0F3E-\\u0F3F\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F7F\\u0F85\\u0F88-\\u0F8C\" + \"\\u0FBE-\\u0FC5\\u0FC7-\\u0FCC\\u0FCE-\\u0FCF\\u0FD0-\\u0FD4\\u0FD5-\\u0FD8\" + \"\\u0FD9-\\u0FDA\\u1000-\\u102A\\u102B-\\u102C\\u1031\\u1038\\u103B-\\u103C\\u103F\" + \"\\u1040-\\u1049\\u104A-\\u104F\\u1050-\\u1055\\u1056-\\u1057\\u105A-\\u105D\\u1061\" + \"\\u1062-\\u1064\\u1065-\\u1066\\u1067-\\u106D\\u106E-\\u1070\\u1075-\\u1081\" + \"\\u1083-\\u1084\\u1087-\\u108C\\u108E\\u108F\\u1090-\\u1099\\u109A-\\u109C\" + \"\\u109E-\\u109F\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FB\\u10FC\" + \"\\u10FD-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\" + \"\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\" + \"\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1360-\\u1368\" + \"\\u1369-\\u137C\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166D-\\u166E\" + \"\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EB-\\u16ED\\u16EE-\\u16F0\" + \"\\u16F1-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1735-\\u1736\" + \"\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17B6\\u17BE-\\u17C5\" + \"\\u17C7-\\u17C8\\u17D4-\\u17D6\\u17D7\\u17D8-\\u17DA\\u17DC\\u17E0-\\u17E9\" + \"\\u1810-\\u1819\\u1820-\\u1842\\u1843\\u1844-\\u1877\\u1880-\\u18A8\\u18AA\" + \"\\u18B0-\\u18F5\\u1900-\\u191E\\u1923-\\u1926\\u1929-\\u192B\\u1930-\\u1931\" + \"\\u1933-\\u1938\\u1946-\\u194F\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\" + \"\\u19B0-\\u19C0\\u19C1-\\u19C7\\u19C8-\\u19C9\\u19D0-\\u19D9\\u19DA\\u1A00-\\u1A16\" + \"\\u1A19-\\u1A1A\\u1A1E-\\u1A1F\\u1A20-\\u1A54\\u1A55\\u1A57\\u1A61\\u1A63-\\u1A64\" + \"\\u1A6D-\\u1A72\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1AA0-\\u1AA6\\u1AA7\\u1AA8-\\u1AAD\" + \"\\u1B04\\u1B05-\\u1B33\\u1B35\\u1B3B\\u1B3D-\\u1B41\\u1B43-\\u1B44\\u1B45-\\u1B4B\" + \"\\u1B50-\\u1B59\\u1B5A-\\u1B60\\u1B61-\\u1B6A\\u1B74-\\u1B7C\\u1B82\\u1B83-\\u1BA0\" + \"\\u1BA1\\u1BA6-\\u1BA7\\u1BAA\\u1BAE-\\u1BAF\\u1BB0-\\u1BB9\\u1BBA-\\u1BE5\\u1BE7\" + \"\\u1BEA-\\u1BEC\\u1BEE\\u1BF2-\\u1BF3\\u1BFC-\\u1BFF\\u1C00-\\u1C23\\u1C24-\\u1C2B\" + \"\\u1C34-\\u1C35\\u1C3B-\\u1C3F\\u1C40-\\u1C49\\u1C4D-\\u1C4F\\u1C50-\\u1C59\" + \"\\u1C5A-\\u1C77\\u1C78-\\u1C7D\\u1C7E-\\u1C7F\\u1CC0-\\u1CC7\\u1CD3\\u1CE1\" + \"\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF2-\\u1CF3\\u1CF5-\\u1CF6\\u1D00-\\u1D2B\" + \"\\u1D2C-\\u1D6A\\u1D6B-\\u1D77\\u1D78\\u1D79-\\u1D9A\\u1D9B-\\u1DBF\\u1E00-\\u1F15\" + \"\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\" + \"\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\" + \"\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200E\" + \"\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\" + \"\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2134\\u2135-\\u2138\\u2139\" + \"\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u214F\\u2160-\\u2182\\u2183-\\u2184\" + \"\\u2185-\\u2188\\u2336-\\u237A\\u2395\\u249C-\\u24E9\\u26AC\\u2800-\\u28FF\" + \"\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2C7B\\u2C7C-\\u2C7D\\u2C7E-\\u2CE4\" + \"\\u2CEB-\\u2CEE\\u2CF2-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\" + \"\\u2D70\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\" + \"\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u3005\\u3006\\u3007\" + \"\\u3021-\\u3029\\u302E-\\u302F\\u3031-\\u3035\\u3038-\\u303A\\u303B\\u303C\" + \"\\u3041-\\u3096\\u309D-\\u309E\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FE\\u30FF\" + \"\\u3105-\\u312D\\u3131-\\u318E\\u3190-\\u3191\\u3192-\\u3195\\u3196-\\u319F\" + \"\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3200-\\u321C\\u3220-\\u3229\\u322A-\\u3247\" + \"\\u3248-\\u324F\\u3260-\\u327B\\u327F\\u3280-\\u3289\\u328A-\\u32B0\\u32C0-\\u32CB\" + \"\\u32D0-\\u32FE\\u3300-\\u3376\\u337B-\\u33DD\\u33E0-\\u33FE\\u3400-\\u4DB5\" + \"\\u4E00-\\u9FCC\\uA000-\\uA014\\uA015\\uA016-\\uA48C\\uA4D0-\\uA4F7\\uA4F8-\\uA4FD\" + \"\\uA4FE-\\uA4FF\\uA500-\\uA60B\\uA60C\\uA610-\\uA61F\\uA620-\\uA629\\uA62A-\\uA62B\" + \"\\uA640-\\uA66D\\uA66E\\uA680-\\uA69B\\uA69C-\\uA69D\\uA6A0-\\uA6E5\\uA6E6-\\uA6EF\" + \"\\uA6F2-\\uA6F7\\uA722-\\uA76F\\uA770\\uA771-\\uA787\\uA789-\\uA78A\\uA78B-\\uA78E\" + \"\\uA790-\\uA7AD\\uA7B0-\\uA7B1\\uA7F7\\uA7F8-\\uA7F9\\uA7FA\\uA7FB-\\uA801\" + \"\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA823-\\uA824\\uA827\\uA830-\\uA835\" + \"\\uA836-\\uA837\\uA840-\\uA873\\uA880-\\uA881\\uA882-\\uA8B3\\uA8B4-\\uA8C3\" + \"\\uA8CE-\\uA8CF\\uA8D0-\\uA8D9\\uA8F2-\\uA8F7\\uA8F8-\\uA8FA\\uA8FB\\uA900-\\uA909\" + \"\\uA90A-\\uA925\\uA92E-\\uA92F\\uA930-\\uA946\\uA952-\\uA953\\uA95F\\uA960-\\uA97C\" + \"\\uA983\\uA984-\\uA9B2\\uA9B4-\\uA9B5\\uA9BA-\\uA9BB\\uA9BD-\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\\u05C6\\u05C8-\\u05CF\\u05D0-\\u05EA\\u05EB-\\u05EF\" + \"\\u05F0-\\u05F2\\u05F3-\\u05F4\\u05F5-\\u05FF\\u07C0-\\u07C9\\u07CA-\\u07EA\" + \"\\u07F4-\\u07F5\\u07FA\\u07FB-\\u07FF\\u0800-\\u0815\\u081A\\u0824\\u0828\" + \"\\u082E-\\u082F\\u0830-\\u083E\\u083F\\u0840-\\u0858\\u085C-\\u085D\\u085E\" + \"\\u085F-\\u089F\\u200F\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB37\\uFB38-\\uFB3C\" + \"\\uFB3D\\uFB3E\\uFB3F\\uFB40-\\uFB41\\uFB42\\uFB43-\\uFB44\\uFB45\\uFB46-\\uFB4F\",\n  AL: \"\\u0608\\u060B\\u060D\\u061B\\u061C\\u061D\\u061E-\\u061F\\u0620-\\u063F\\u0640\" + \"\\u0641-\\u064A\\u066D\\u066E-\\u066F\\u0671-\\u06D3\\u06D4\\u06D5\\u06E5-\\u06E6\" + \"\\u06EE-\\u06EF\\u06FA-\\u06FC\\u06FD-\\u06FE\\u06FF\\u0700-\\u070D\\u070E\\u070F\" + \"\\u0710\\u0712-\\u072F\\u074B-\\u074C\\u074D-\\u07A5\\u07B1\\u07B2-\\u07BF\" + \"\\u08A0-\\u08B2\\u08B3-\\u08E3\\uFB50-\\uFBB1\\uFBB2-\\uFBC1\\uFBC2-\\uFBD2\" + \"\\uFBD3-\\uFD3D\\uFD40-\\uFD4F\\uFD50-\\uFD8F\\uFD90-\\uFD91\\uFD92-\\uFDC7\" + \"\\uFDC8-\\uFDCF\\uFDF0-\\uFDFB\\uFDFC\\uFDFE-\\uFDFF\\uFE70-\\uFE74\\uFE75\" + \"\\uFE76-\\uFEFC\\uFEFD-\\uFEFE\"\n};\nvar REGEX_STRONG = new RegExp('[' + RANGE_BY_BIDI_TYPE.L + RANGE_BY_BIDI_TYPE.R + RANGE_BY_BIDI_TYPE.AL + ']');\nvar REGEX_RTL = new RegExp('[' + RANGE_BY_BIDI_TYPE.R + RANGE_BY_BIDI_TYPE.AL + ']');\n/**\n * Returns the first strong character (has Bidi_Class value of L, R, or AL).\n *\n * @param str  A text block; e.g. paragraph, table cell, tag\n * @return     A character with strong bidi direction, or null if not found\n */\n\nfunction firstStrongChar(str) {\n  var match = REGEX_STRONG.exec(str);\n  return match == null ? null : match[0];\n}\n/**\n * Returns the direction of a block of text, based on the direction of its\n * first strong character (has Bidi_Class value of L, R, or AL).\n *\n * @param str  A text block; e.g. paragraph, table cell, tag\n * @return     The resolved direction\n */\n\n\nfunction firstStrongCharDir(str) {\n  var strongChar = firstStrongChar(str);\n\n  if (strongChar == null) {\n    return UnicodeBidiDirection.NEUTRAL;\n  }\n\n  return REGEX_RTL.exec(strongChar) ? UnicodeBidiDirection.RTL : UnicodeBidiDirection.LTR;\n}\n/**\n * Returns the direction of a block of text, based on the direction of its\n * first strong character (has Bidi_Class value of L, R, or AL), or a fallback\n * direction, if no strong character is found.\n *\n * This function is supposed to be used in respect to Higher-Level Protocol\n * rule HL1. (http://www.unicode.org/reports/tr9/#HL1)\n *\n * @param str       A text block; e.g. paragraph, table cell, tag\n * @param fallback  Fallback direction, used if no strong direction detected\n *                  for the block (default = NEUTRAL)\n * @return          The resolved direction\n */\n\n\nfunction resolveBlockDir(str, fallback) {\n  fallback = fallback || UnicodeBidiDirection.NEUTRAL;\n\n  if (!str.length) {\n    return fallback;\n  }\n\n  var blockDir = firstStrongCharDir(str);\n  return blockDir === UnicodeBidiDirection.NEUTRAL ? fallback : blockDir;\n}\n/**\n * Returns the direction of a block of text, based on the direction of its\n * first strong character (has Bidi_Class value of L, R, or AL), or a fallback\n * direction, if no strong character is found.\n *\n * NOTE: This function is similar to resolveBlockDir(), but uses the global\n * direction as the fallback, so it *always* returns a Strong direction,\n * making it useful for integration in places that you need to make the final\n * decision, like setting some CSS class.\n *\n * This function is supposed to be used in respect to Higher-Level Protocol\n * rule HL1. (http://www.unicode.org/reports/tr9/#HL1)\n *\n * @param str             A text block; e.g. paragraph, table cell\n * @param strongFallback  Fallback direction, used if no strong direction\n *                        detected for the block (default = global direction)\n * @return                The resolved Strong direction\n */\n\n\nfunction getDirection(str, strongFallback) {\n  if (!strongFallback) {\n    strongFallback = UnicodeBidiDirection.getGlobalDir();\n  }\n\n  !UnicodeBidiDirection.isStrong(strongFallback) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Fallback direction must be a strong direction') : invariant(false) : void 0;\n  return resolveBlockDir(str, strongFallback);\n}\n/**\n * Returns true if getDirection(arguments...) returns LTR.\n *\n * @param str             A text block; e.g. paragraph, table cell\n * @param strongFallback  Fallback direction, used if no strong direction\n *                        detected for the block (default = global direction)\n * @return                True if the resolved direction is LTR\n */\n\n\nfunction isDirectionLTR(str, strongFallback) {\n  return getDirection(str, strongFallback) === UnicodeBidiDirection.LTR;\n}\n/**\n * Returns true if getDirection(arguments...) returns RTL.\n *\n * @param str             A text block; e.g. paragraph, table cell\n * @param strongFallback  Fallback direction, used if no strong direction\n *                        detected for the block (default = global direction)\n * @return                True if the resolved direction is RTL\n */\n\n\nfunction isDirectionRTL(str, strongFallback) {\n  return getDirection(str, strongFallback) === UnicodeBidiDirection.RTL;\n}\n\nvar UnicodeBidi = {\n  firstStrongChar: firstStrongChar,\n  firstStrongCharDir: firstStrongCharDir,\n  resolveBlockDir: resolveBlockDir,\n  getDirection: getDirection,\n  isDirectionLTR: isDirectionLTR,\n  isDirectionRTL: isDirectionRTL\n};\nmodule.exports = UnicodeBidi;", "/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n * \n */\n\n/**\n * Stateful API for text direction detection\n *\n * This class can be used in applications where you need to detect the\n * direction of a sequence of text blocks, where each direction shall be used\n * as the fallback direction for the next one.\n *\n * NOTE: A default direction, if not provided, is set based on the global\n *       direction, as defined by `UnicodeBidiDirection`.\n *\n * == Example ==\n * ```\n * var UnicodeBidiService = require('UnicodeBidiService');\n *\n * var bidiService = new UnicodeBidiService();\n *\n * ...\n *\n * bidiService.reset();\n * for (var para in paragraphs) {\n *   var dir = bidiService.getDirection(para);\n *   ...\n * }\n * ```\n *\n * Part of our implementation of Unicode Bidirectional Algorithm (UBA)\n * Unicode Standard Annex #9 (UAX9)\n * http://www.unicode.org/reports/tr9/\n */\n'use strict';\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar UnicodeBidi = require(\"./UnicodeBidi\");\n\nvar UnicodeBidiDirection = require(\"./UnicodeBidiDirection\");\n\nvar invariant = require(\"./invariant\");\n\nvar UnicodeBidiService =\n/*#__PURE__*/\nfunction () {\n  /**\n   * Stateful class for paragraph direction detection\n   *\n   * @param defaultDir  Default direction of the service\n   */\n  function UnicodeBidiService(defaultDir) {\n    _defineProperty(this, \"_defaultDir\", void 0);\n\n    _defineProperty(this, \"_lastDir\", void 0);\n\n    if (!defaultDir) {\n      defaultDir = UnicodeBidiDirection.getGlobalDir();\n    } else {\n      !UnicodeBidiDirection.isStrong(defaultDir) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Default direction must be a strong direction (LTR or RTL)') : invariant(false) : void 0;\n    }\n\n    this._defaultDir = defaultDir;\n    this.reset();\n  }\n  /**\n   * Reset the internal state\n   *\n   * Instead of creating a new instance, you can just reset() your instance\n   * everytime you start a new loop.\n   */\n\n\n  var _proto = UnicodeBidiService.prototype;\n\n  _proto.reset = function reset() {\n    this._lastDir = this._defaultDir;\n  };\n  /**\n   * Returns the direction of a block of text, and remembers it as the\n   * fall-back direction for the next paragraph.\n   *\n   * @param str  A text block, e.g. paragraph, table cell, tag\n   * @return     The resolved direction\n   */\n\n\n  _proto.getDirection = function getDirection(str) {\n    this._lastDir = UnicodeBidi.getDirection(str, this._lastDir);\n    return this._lastDir;\n  };\n\n  return UnicodeBidiService;\n}();\n\nmodule.exports = UnicodeBidiService;", "\"use strict\";\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\nvar nullthrows = function nullthrows(x) {\n  if (x != null) {\n    return x;\n  }\n\n  throw new Error(\"Got unexpected null or undefined\");\n};\n\nmodule.exports = nullthrows;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar UnicodeBidiService = require(\"fbjs/lib/UnicodeBidiService\");\n\nvar Immutable = require(\"immutable\");\n\nvar nullthrows = require(\"fbjs/lib/nullthrows\");\n\nvar OrderedMap = Immutable.OrderedMap;\nvar bidiService;\nvar EditorBidiService = {\n  getDirectionMap: function getDirectionMap(content, prevBidiMap) {\n    if (!bidiService) {\n      bidiService = new UnicodeBidiService();\n    } else {\n      bidiService.reset();\n    }\n\n    var blockMap = content.getBlockMap();\n    var nextBidi = blockMap.valueSeq().map(function (block) {\n      return nullthrows(bidiService).getDirection(block.getText());\n    });\n    var bidiMap = OrderedMap(blockMap.keySeq().zip(nextBidi));\n\n    if (prevBidiMap != null && Immutable.is(prevBidiMap, bidiMap)) {\n      return prevBidiMap;\n    }\n\n    return bidiMap;\n  }\n};\nmodule.exports = EditorBidiService;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar BlockTree = require(\"./BlockTree\");\n\nvar ContentState = require(\"./ContentState\");\n\nvar EditorBidiService = require(\"./EditorBidiService\");\n\nvar SelectionState = require(\"./SelectionState\");\n\nvar Immutable = require(\"immutable\");\n\nvar OrderedSet = Immutable.OrderedSet,\n    Record = Immutable.Record,\n    Stack = Immutable.Stack;\nvar defaultRecord = {\n  allowUndo: true,\n  currentContent: null,\n  decorator: null,\n  directionMap: null,\n  forceSelection: false,\n  inCompositionMode: false,\n  inlineStyleOverride: null,\n  lastChangeType: null,\n  nativelyRenderedContent: null,\n  redoStack: Stack(),\n  selection: null,\n  treeMap: null,\n  undoStack: Stack()\n};\nvar EditorStateRecord = Record(defaultRecord);\n\nvar EditorState =\n/*#__PURE__*/\nfunction () {\n  EditorState.createEmpty = function createEmpty(decorator) {\n    return EditorState.createWithContent(ContentState.createFromText(''), decorator);\n  };\n\n  EditorState.createWithContent = function createWithContent(contentState, decorator) {\n    if (contentState.getBlockMap().count() === 0) {\n      return EditorState.createEmpty(decorator);\n    }\n\n    var firstKey = contentState.getBlockMap().first().getKey();\n    return EditorState.create({\n      currentContent: contentState,\n      undoStack: Stack(),\n      redoStack: Stack(),\n      decorator: decorator || null,\n      selection: SelectionState.createEmpty(firstKey)\n    });\n  };\n\n  EditorState.create = function create(config) {\n    var currentContent = config.currentContent,\n        decorator = config.decorator;\n\n    var recordConfig = _objectSpread({}, config, {\n      treeMap: generateNewTreeMap(currentContent, decorator),\n      directionMap: EditorBidiService.getDirectionMap(currentContent)\n    });\n\n    return new EditorState(new EditorStateRecord(recordConfig));\n  };\n\n  EditorState.set = function set(editorState, put) {\n    var map = editorState.getImmutable().withMutations(function (state) {\n      var existingDecorator = state.get('decorator');\n      var decorator = existingDecorator;\n\n      if (put.decorator === null) {\n        decorator = null;\n      } else if (put.decorator) {\n        decorator = put.decorator;\n      }\n\n      var newContent = put.currentContent || editorState.getCurrentContent();\n\n      if (decorator !== existingDecorator) {\n        var treeMap = state.get('treeMap');\n        var newTreeMap;\n\n        if (decorator && existingDecorator) {\n          newTreeMap = regenerateTreeForNewDecorator(newContent, newContent.getBlockMap(), treeMap, decorator, existingDecorator);\n        } else {\n          newTreeMap = generateNewTreeMap(newContent, decorator);\n        }\n\n        state.merge({\n          decorator: decorator,\n          treeMap: newTreeMap,\n          nativelyRenderedContent: null\n        });\n        return;\n      }\n\n      var existingContent = editorState.getCurrentContent();\n\n      if (newContent !== existingContent) {\n        state.set('treeMap', regenerateTreeForNewBlocks(editorState, newContent.getBlockMap(), newContent.getEntityMap(), decorator));\n      }\n\n      state.merge(put);\n    });\n    return new EditorState(map);\n  };\n\n  var _proto = EditorState.prototype;\n\n  _proto.toJS = function toJS() {\n    return this.getImmutable().toJS();\n  };\n\n  _proto.getAllowUndo = function getAllowUndo() {\n    return this.getImmutable().get('allowUndo');\n  };\n\n  _proto.getCurrentContent = function getCurrentContent() {\n    return this.getImmutable().get('currentContent');\n  };\n\n  _proto.getUndoStack = function getUndoStack() {\n    return this.getImmutable().get('undoStack');\n  };\n\n  _proto.getRedoStack = function getRedoStack() {\n    return this.getImmutable().get('redoStack');\n  };\n\n  _proto.getSelection = function getSelection() {\n    return this.getImmutable().get('selection');\n  };\n\n  _proto.getDecorator = function getDecorator() {\n    return this.getImmutable().get('decorator');\n  };\n\n  _proto.isInCompositionMode = function isInCompositionMode() {\n    return this.getImmutable().get('inCompositionMode');\n  };\n\n  _proto.mustForceSelection = function mustForceSelection() {\n    return this.getImmutable().get('forceSelection');\n  };\n\n  _proto.getNativelyRenderedContent = function getNativelyRenderedContent() {\n    return this.getImmutable().get('nativelyRenderedContent');\n  };\n\n  _proto.getLastChangeType = function getLastChangeType() {\n    return this.getImmutable().get('lastChangeType');\n  }\n  /**\n   * While editing, the user may apply inline style commands with a collapsed\n   * cursor, intending to type text that adopts the specified style. In this\n   * case, we track the specified style as an \"override\" that takes precedence\n   * over the inline style of the text adjacent to the cursor.\n   *\n   * If null, there is no override in place.\n   */\n  ;\n\n  _proto.getInlineStyleOverride = function getInlineStyleOverride() {\n    return this.getImmutable().get('inlineStyleOverride');\n  };\n\n  EditorState.setInlineStyleOverride = function setInlineStyleOverride(editorState, inlineStyleOverride) {\n    return EditorState.set(editorState, {\n      inlineStyleOverride: inlineStyleOverride\n    });\n  }\n  /**\n   * Get the appropriate inline style for the editor state. If an\n   * override is in place, use it. Otherwise, the current style is\n   * based on the location of the selection state.\n   */\n  ;\n\n  _proto.getCurrentInlineStyle = function getCurrentInlineStyle() {\n    var override = this.getInlineStyleOverride();\n\n    if (override != null) {\n      return override;\n    }\n\n    var content = this.getCurrentContent();\n    var selection = this.getSelection();\n\n    if (selection.isCollapsed()) {\n      return getInlineStyleForCollapsedSelection(content, selection);\n    }\n\n    return getInlineStyleForNonCollapsedSelection(content, selection);\n  };\n\n  _proto.getBlockTree = function getBlockTree(blockKey) {\n    return this.getImmutable().getIn(['treeMap', blockKey]);\n  };\n\n  _proto.isSelectionAtStartOfContent = function isSelectionAtStartOfContent() {\n    var firstKey = this.getCurrentContent().getBlockMap().first().getKey();\n    return this.getSelection().hasEdgeWithin(firstKey, 0, 0);\n  };\n\n  _proto.isSelectionAtEndOfContent = function isSelectionAtEndOfContent() {\n    var content = this.getCurrentContent();\n    var blockMap = content.getBlockMap();\n    var last = blockMap.last();\n    var end = last.getLength();\n    return this.getSelection().hasEdgeWithin(last.getKey(), end, end);\n  };\n\n  _proto.getDirectionMap = function getDirectionMap() {\n    return this.getImmutable().get('directionMap');\n  }\n  /**\n   * Incorporate native DOM selection changes into the EditorState. This\n   * method can be used when we simply want to accept whatever the DOM\n   * has given us to represent selection, and we do not need to re-render\n   * the editor.\n   *\n   * To forcibly move the DOM selection, see `EditorState.forceSelection`.\n   */\n  ;\n\n  EditorState.acceptSelection = function acceptSelection(editorState, selection) {\n    return updateSelection(editorState, selection, false);\n  }\n  /**\n   * At times, we need to force the DOM selection to be where we\n   * need it to be. This can occur when the anchor or focus nodes\n   * are non-text nodes, for instance. In this case, we want to trigger\n   * a re-render of the editor, which in turn forces selection into\n   * the correct place in the DOM. The `forceSelection` method\n   * accomplishes this.\n   *\n   * This method should be used in cases where you need to explicitly\n   * move the DOM selection from one place to another without a change\n   * in ContentState.\n   */\n  ;\n\n  EditorState.forceSelection = function forceSelection(editorState, selection) {\n    if (!selection.getHasFocus()) {\n      selection = selection.set('hasFocus', true);\n    }\n\n    return updateSelection(editorState, selection, true);\n  }\n  /**\n   * Move selection to the end of the editor without forcing focus.\n   */\n  ;\n\n  EditorState.moveSelectionToEnd = function moveSelectionToEnd(editorState) {\n    var content = editorState.getCurrentContent();\n    var lastBlock = content.getLastBlock();\n    var lastKey = lastBlock.getKey();\n    var length = lastBlock.getLength();\n    return EditorState.acceptSelection(editorState, new SelectionState({\n      anchorKey: lastKey,\n      anchorOffset: length,\n      focusKey: lastKey,\n      focusOffset: length,\n      isBackward: false\n    }));\n  }\n  /**\n   * Force focus to the end of the editor. This is useful in scenarios\n   * where we want to programmatically focus the input and it makes sense\n   * to allow the user to continue working seamlessly.\n   */\n  ;\n\n  EditorState.moveFocusToEnd = function moveFocusToEnd(editorState) {\n    var afterSelectionMove = EditorState.moveSelectionToEnd(editorState);\n    return EditorState.forceSelection(afterSelectionMove, afterSelectionMove.getSelection());\n  }\n  /**\n   * Push the current ContentState onto the undo stack if it should be\n   * considered a boundary state, and set the provided ContentState as the\n   * new current content.\n   */\n  ;\n\n  EditorState.push = function push(editorState, contentState, changeType) {\n    var forceSelection = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;\n\n    if (editorState.getCurrentContent() === contentState) {\n      return editorState;\n    }\n\n    var directionMap = EditorBidiService.getDirectionMap(contentState, editorState.getDirectionMap());\n\n    if (!editorState.getAllowUndo()) {\n      return EditorState.set(editorState, {\n        currentContent: contentState,\n        directionMap: directionMap,\n        lastChangeType: changeType,\n        selection: contentState.getSelectionAfter(),\n        forceSelection: forceSelection,\n        inlineStyleOverride: null\n      });\n    }\n\n    var selection = editorState.getSelection();\n    var currentContent = editorState.getCurrentContent();\n    var undoStack = editorState.getUndoStack();\n    var newContent = contentState;\n\n    if (selection !== currentContent.getSelectionAfter() || mustBecomeBoundary(editorState, changeType)) {\n      undoStack = undoStack.push(currentContent);\n      newContent = newContent.set('selectionBefore', selection);\n    } else if (changeType === 'insert-characters' || changeType === 'backspace-character' || changeType === 'delete-character') {\n      // Preserve the previous selection.\n      newContent = newContent.set('selectionBefore', currentContent.getSelectionBefore());\n    }\n\n    var inlineStyleOverride = editorState.getInlineStyleOverride(); // Don't discard inline style overrides for the following change types:\n\n    var overrideChangeTypes = ['adjust-depth', 'change-block-type', 'split-block'];\n\n    if (overrideChangeTypes.indexOf(changeType) === -1) {\n      inlineStyleOverride = null;\n    }\n\n    var editorStateChanges = {\n      currentContent: newContent,\n      directionMap: directionMap,\n      undoStack: undoStack,\n      redoStack: Stack(),\n      lastChangeType: changeType,\n      selection: contentState.getSelectionAfter(),\n      forceSelection: forceSelection,\n      inlineStyleOverride: inlineStyleOverride\n    };\n    return EditorState.set(editorState, editorStateChanges);\n  }\n  /**\n   * Make the top ContentState in the undo stack the new current content and\n   * push the current content onto the redo stack.\n   */\n  ;\n\n  EditorState.undo = function undo(editorState) {\n    if (!editorState.getAllowUndo()) {\n      return editorState;\n    }\n\n    var undoStack = editorState.getUndoStack();\n    var newCurrentContent = undoStack.peek();\n\n    if (!newCurrentContent) {\n      return editorState;\n    }\n\n    var currentContent = editorState.getCurrentContent();\n    var directionMap = EditorBidiService.getDirectionMap(newCurrentContent, editorState.getDirectionMap());\n    return EditorState.set(editorState, {\n      currentContent: newCurrentContent,\n      directionMap: directionMap,\n      undoStack: undoStack.shift(),\n      redoStack: editorState.getRedoStack().push(currentContent),\n      forceSelection: true,\n      inlineStyleOverride: null,\n      lastChangeType: 'undo',\n      nativelyRenderedContent: null,\n      selection: currentContent.getSelectionBefore()\n    });\n  }\n  /**\n   * Make the top ContentState in the redo stack the new current content and\n   * push the current content onto the undo stack.\n   */\n  ;\n\n  EditorState.redo = function redo(editorState) {\n    if (!editorState.getAllowUndo()) {\n      return editorState;\n    }\n\n    var redoStack = editorState.getRedoStack();\n    var newCurrentContent = redoStack.peek();\n\n    if (!newCurrentContent) {\n      return editorState;\n    }\n\n    var currentContent = editorState.getCurrentContent();\n    var directionMap = EditorBidiService.getDirectionMap(newCurrentContent, editorState.getDirectionMap());\n    return EditorState.set(editorState, {\n      currentContent: newCurrentContent,\n      directionMap: directionMap,\n      undoStack: editorState.getUndoStack().push(currentContent),\n      redoStack: redoStack.shift(),\n      forceSelection: true,\n      inlineStyleOverride: null,\n      lastChangeType: 'redo',\n      nativelyRenderedContent: null,\n      selection: newCurrentContent.getSelectionAfter()\n    });\n  }\n  /**\n   * Not for public consumption.\n   */\n  ;\n\n  function EditorState(immutable) {\n    _defineProperty(this, \"_immutable\", void 0);\n\n    this._immutable = immutable;\n  }\n  /**\n   * Not for public consumption.\n   */\n\n\n  _proto.getImmutable = function getImmutable() {\n    return this._immutable;\n  };\n\n  return EditorState;\n}();\n/**\n * Set the supplied SelectionState as the new current selection, and set\n * the `force` flag to trigger manual selection placement by the view.\n */\n\n\nfunction updateSelection(editorState, selection, forceSelection) {\n  return EditorState.set(editorState, {\n    selection: selection,\n    forceSelection: forceSelection,\n    nativelyRenderedContent: null,\n    inlineStyleOverride: null\n  });\n}\n/**\n * Regenerate the entire tree map for a given ContentState and decorator.\n * Returns an OrderedMap that maps all available ContentBlock objects.\n */\n\n\nfunction generateNewTreeMap(contentState, decorator) {\n  return contentState.getBlockMap().map(function (block) {\n    return BlockTree.generate(contentState, block, decorator);\n  }).toOrderedMap();\n}\n/**\n * Regenerate tree map objects for all ContentBlocks that have changed\n * between the current editorState and newContent. Returns an OrderedMap\n * with only changed regenerated tree map objects.\n */\n\n\nfunction regenerateTreeForNewBlocks(editorState, newBlockMap, newEntityMap, decorator) {\n  var contentState = editorState.getCurrentContent().set('entityMap', newEntityMap);\n  var prevBlockMap = contentState.getBlockMap();\n  var prevTreeMap = editorState.getImmutable().get('treeMap');\n  return prevTreeMap.merge(newBlockMap.toSeq().filter(function (block, key) {\n    return block !== prevBlockMap.get(key);\n  }).map(function (block) {\n    return BlockTree.generate(contentState, block, decorator);\n  }));\n}\n/**\n * Generate tree map objects for a new decorator object, preserving any\n * decorations that are unchanged from the previous decorator.\n *\n * Note that in order for this to perform optimally, decoration Lists for\n * decorators should be preserved when possible to allow for direct immutable\n * List comparison.\n */\n\n\nfunction regenerateTreeForNewDecorator(content, blockMap, previousTreeMap, decorator, existingDecorator) {\n  return previousTreeMap.merge(blockMap.toSeq().filter(function (block) {\n    return decorator.getDecorations(block, content) !== existingDecorator.getDecorations(block, content);\n  }).map(function (block) {\n    return BlockTree.generate(content, block, decorator);\n  }));\n}\n/**\n * Return whether a change should be considered a boundary state, given\n * the previous change type. Allows us to discard potential boundary states\n * during standard typing or deletion behavior.\n */\n\n\nfunction mustBecomeBoundary(editorState, changeType) {\n  var lastChangeType = editorState.getLastChangeType();\n  return changeType !== lastChangeType || changeType !== 'insert-characters' && changeType !== 'backspace-character' && changeType !== 'delete-character';\n}\n\nfunction getInlineStyleForCollapsedSelection(content, selection) {\n  var startKey = selection.getStartKey();\n  var startOffset = selection.getStartOffset();\n  var startBlock = content.getBlockForKey(startKey); // If the cursor is not at the start of the block, look backward to\n  // preserve the style of the preceding character.\n\n  if (startOffset > 0) {\n    return startBlock.getInlineStyleAt(startOffset - 1);\n  } // The caret is at position zero in this block. If the block has any\n  // text at all, use the style of the first character.\n\n\n  if (startBlock.getLength()) {\n    return startBlock.getInlineStyleAt(0);\n  } // Otherwise, look upward in the document to find the closest character.\n\n\n  return lookUpwardForInlineStyle(content, startKey);\n}\n\nfunction getInlineStyleForNonCollapsedSelection(content, selection) {\n  var startKey = selection.getStartKey();\n  var startOffset = selection.getStartOffset();\n  var startBlock = content.getBlockForKey(startKey); // If there is a character just inside the selection, use its style.\n\n  if (startOffset < startBlock.getLength()) {\n    return startBlock.getInlineStyleAt(startOffset);\n  } // Check if the selection at the end of a non-empty block. Use the last\n  // style in the block.\n\n\n  if (startOffset > 0) {\n    return startBlock.getInlineStyleAt(startOffset - 1);\n  } // Otherwise, look upward in the document to find the closest character.\n\n\n  return lookUpwardForInlineStyle(content, startKey);\n}\n\nfunction lookUpwardForInlineStyle(content, fromKey) {\n  var lastNonEmpty = content.getBlockMap().reverse().skipUntil(function (_, k) {\n    return k === fromKey;\n  }).skip(1).skipUntil(function (block, _) {\n    return block.getLength();\n  }).first();\n\n  if (lastNonEmpty) {\n    return lastNonEmpty.getInlineStyleAt(lastNonEmpty.getLength() - 1);\n  }\n\n  return OrderedSet();\n}\n\nmodule.exports = EditorState;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar ContentBlockNode = require(\"./ContentBlockNode\");\n\nvar getNextDelimiterBlockKey = require(\"./getNextDelimiterBlockKey\");\n\nvar Immutable = require(\"immutable\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar OrderedMap = Immutable.OrderedMap,\n    List = Immutable.List;\n\nvar transformBlock = function transformBlock(key, blockMap, func) {\n  if (!key) {\n    return;\n  }\n\n  var block = blockMap.get(key);\n\n  if (!block) {\n    return;\n  }\n\n  blockMap.set(key, func(block));\n};\n\nvar updateBlockMapLinks = function updateBlockMapLinks(blockMap, originalBlockToBeMoved, originalTargetBlock, insertionMode, isExperimentalTreeBlock) {\n  if (!isExperimentalTreeBlock) {\n    return blockMap;\n  } // possible values of 'insertionMode' are: 'after', 'before'\n\n\n  var isInsertedAfterTarget = insertionMode === 'after';\n  var originalBlockKey = originalBlockToBeMoved.getKey();\n  var originalTargetKey = originalTargetBlock.getKey();\n  var originalParentKey = originalBlockToBeMoved.getParentKey();\n  var originalNextSiblingKey = originalBlockToBeMoved.getNextSiblingKey();\n  var originalPrevSiblingKey = originalBlockToBeMoved.getPrevSiblingKey();\n  var newParentKey = originalTargetBlock.getParentKey();\n  var newNextSiblingKey = isInsertedAfterTarget ? originalTargetBlock.getNextSiblingKey() : originalTargetKey;\n  var newPrevSiblingKey = isInsertedAfterTarget ? originalTargetKey : originalTargetBlock.getPrevSiblingKey();\n  return blockMap.withMutations(function (blocks) {\n    // update old parent\n    transformBlock(originalParentKey, blocks, function (block) {\n      var parentChildrenList = block.getChildKeys();\n      return block.merge({\n        children: parentChildrenList[\"delete\"](parentChildrenList.indexOf(originalBlockKey))\n      });\n    }); // update old prev\n\n    transformBlock(originalPrevSiblingKey, blocks, function (block) {\n      return block.merge({\n        nextSibling: originalNextSiblingKey\n      });\n    }); // update old next\n\n    transformBlock(originalNextSiblingKey, blocks, function (block) {\n      return block.merge({\n        prevSibling: originalPrevSiblingKey\n      });\n    }); // update new next\n\n    transformBlock(newNextSiblingKey, blocks, function (block) {\n      return block.merge({\n        prevSibling: originalBlockKey\n      });\n    }); // update new prev\n\n    transformBlock(newPrevSiblingKey, blocks, function (block) {\n      return block.merge({\n        nextSibling: originalBlockKey\n      });\n    }); // update new parent\n\n    transformBlock(newParentKey, blocks, function (block) {\n      var newParentChildrenList = block.getChildKeys();\n      var targetBlockIndex = newParentChildrenList.indexOf(originalTargetKey);\n      var insertionIndex = isInsertedAfterTarget ? targetBlockIndex + 1 : targetBlockIndex !== 0 ? targetBlockIndex - 1 : 0;\n      var newChildrenArray = newParentChildrenList.toArray();\n      newChildrenArray.splice(insertionIndex, 0, originalBlockKey);\n      return block.merge({\n        children: List(newChildrenArray)\n      });\n    }); // update block\n\n    transformBlock(originalBlockKey, blocks, function (block) {\n      return block.merge({\n        nextSibling: newNextSiblingKey,\n        prevSibling: newPrevSiblingKey,\n        parent: newParentKey\n      });\n    });\n  });\n};\n\nvar moveBlockInContentState = function moveBlockInContentState(contentState, blockToBeMoved, targetBlock, insertionMode) {\n  !(insertionMode !== 'replace') ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Replacing blocks is not supported.') : invariant(false) : void 0;\n  var targetKey = targetBlock.getKey();\n  var blockKey = blockToBeMoved.getKey();\n  !(blockKey !== targetKey) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Block cannot be moved next to itself.') : invariant(false) : void 0;\n  var blockMap = contentState.getBlockMap();\n  var isExperimentalTreeBlock = blockToBeMoved instanceof ContentBlockNode;\n  var blocksToBeMoved = [blockToBeMoved];\n  var blockMapWithoutBlocksToBeMoved = blockMap[\"delete\"](blockKey);\n\n  if (isExperimentalTreeBlock) {\n    blocksToBeMoved = [];\n    blockMapWithoutBlocksToBeMoved = blockMap.withMutations(function (blocks) {\n      var nextSiblingKey = blockToBeMoved.getNextSiblingKey();\n      var nextDelimiterBlockKey = getNextDelimiterBlockKey(blockToBeMoved, blocks);\n      blocks.toSeq().skipUntil(function (block) {\n        return block.getKey() === blockKey;\n      }).takeWhile(function (block) {\n        var key = block.getKey();\n        var isBlockToBeMoved = key === blockKey;\n        var hasNextSiblingAndIsNotNextSibling = nextSiblingKey && key !== nextSiblingKey;\n        var doesNotHaveNextSiblingAndIsNotDelimiter = !nextSiblingKey && block.getParentKey() && (!nextDelimiterBlockKey || key !== nextDelimiterBlockKey);\n        return !!(isBlockToBeMoved || hasNextSiblingAndIsNotNextSibling || doesNotHaveNextSiblingAndIsNotDelimiter);\n      }).forEach(function (block) {\n        blocksToBeMoved.push(block);\n        blocks[\"delete\"](block.getKey());\n      });\n    });\n  }\n\n  var blocksBefore = blockMapWithoutBlocksToBeMoved.toSeq().takeUntil(function (v) {\n    return v === targetBlock;\n  });\n  var blocksAfter = blockMapWithoutBlocksToBeMoved.toSeq().skipUntil(function (v) {\n    return v === targetBlock;\n  }).skip(1);\n  var slicedBlocks = blocksToBeMoved.map(function (block) {\n    return [block.getKey(), block];\n  });\n  var newBlocks = OrderedMap();\n\n  if (insertionMode === 'before') {\n    var blockBefore = contentState.getBlockBefore(targetKey);\n    !(!blockBefore || blockBefore.getKey() !== blockToBeMoved.getKey()) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Block cannot be moved next to itself.') : invariant(false) : void 0;\n    newBlocks = blocksBefore.concat([].concat(slicedBlocks, [[targetKey, targetBlock]]), blocksAfter).toOrderedMap();\n  } else if (insertionMode === 'after') {\n    var blockAfter = contentState.getBlockAfter(targetKey);\n    !(!blockAfter || blockAfter.getKey() !== blockKey) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Block cannot be moved next to itself.') : invariant(false) : void 0;\n    newBlocks = blocksBefore.concat([[targetKey, targetBlock]].concat(slicedBlocks), blocksAfter).toOrderedMap();\n  }\n\n  return contentState.merge({\n    blockMap: updateBlockMapLinks(newBlocks, blockToBeMoved, targetBlock, insertionMode, isExperimentalTreeBlock),\n    selectionBefore: contentState.getSelectionAfter(),\n    selectionAfter: contentState.getSelectionAfter().merge({\n      anchorKey: blockKey,\n      focusKey: blockKey\n    })\n  });\n};\n\nmodule.exports = moveBlockInContentState;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar BlockMapBuilder = require(\"./BlockMapBuilder\");\n\nvar CharacterMetadata = require(\"./CharacterMetadata\");\n\nvar ContentBlock = require(\"./ContentBlock\");\n\nvar ContentBlockNode = require(\"./ContentBlockNode\");\n\nvar DraftModifier = require(\"./DraftModifier\");\n\nvar EditorState = require(\"./EditorState\");\n\nvar generateRandomKey = require(\"./generateRandomKey\");\n\nvar gkx = require(\"./gkx\");\n\nvar Immutable = require(\"immutable\");\n\nvar moveBlockInContentState = require(\"./moveBlockInContentState\");\n\nvar experimentalTreeDataSupport = gkx('draft_tree_data_support');\nvar ContentBlockRecord = experimentalTreeDataSupport ? ContentBlockNode : ContentBlock;\nvar List = Immutable.List,\n    Repeat = Immutable.Repeat;\nvar AtomicBlockUtils = {\n  insertAtomicBlock: function insertAtomicBlock(editorState, entityKey, character) {\n    var contentState = editorState.getCurrentContent();\n    var selectionState = editorState.getSelection();\n    var afterRemoval = DraftModifier.removeRange(contentState, selectionState, 'backward');\n    var targetSelection = afterRemoval.getSelectionAfter();\n    var afterSplit = DraftModifier.splitBlock(afterRemoval, targetSelection);\n    var insertionTarget = afterSplit.getSelectionAfter();\n    var asAtomicBlock = DraftModifier.setBlockType(afterSplit, insertionTarget, 'atomic');\n    var charData = CharacterMetadata.create({\n      entity: entityKey\n    });\n    var atomicBlockConfig = {\n      key: generateRandomKey(),\n      type: 'atomic',\n      text: character,\n      characterList: List(Repeat(charData, character.length))\n    };\n    var atomicDividerBlockConfig = {\n      key: generateRandomKey(),\n      type: 'unstyled'\n    };\n\n    if (experimentalTreeDataSupport) {\n      atomicBlockConfig = _objectSpread({}, atomicBlockConfig, {\n        nextSibling: atomicDividerBlockConfig.key\n      });\n      atomicDividerBlockConfig = _objectSpread({}, atomicDividerBlockConfig, {\n        prevSibling: atomicBlockConfig.key\n      });\n    }\n\n    var fragmentArray = [new ContentBlockRecord(atomicBlockConfig), new ContentBlockRecord(atomicDividerBlockConfig)];\n    var fragment = BlockMapBuilder.createFromArray(fragmentArray);\n    var withAtomicBlock = DraftModifier.replaceWithFragment(asAtomicBlock, insertionTarget, fragment);\n    var newContent = withAtomicBlock.merge({\n      selectionBefore: selectionState,\n      selectionAfter: withAtomicBlock.getSelectionAfter().set('hasFocus', true)\n    });\n    return EditorState.push(editorState, newContent, 'insert-fragment');\n  },\n  moveAtomicBlock: function moveAtomicBlock(editorState, atomicBlock, targetRange, insertionMode) {\n    var contentState = editorState.getCurrentContent();\n    var selectionState = editorState.getSelection();\n    var withMovedAtomicBlock;\n\n    if (insertionMode === 'before' || insertionMode === 'after') {\n      var targetBlock = contentState.getBlockForKey(insertionMode === 'before' ? targetRange.getStartKey() : targetRange.getEndKey());\n      withMovedAtomicBlock = moveBlockInContentState(contentState, atomicBlock, targetBlock, insertionMode);\n    } else {\n      var afterRemoval = DraftModifier.removeRange(contentState, targetRange, 'backward');\n      var selectionAfterRemoval = afterRemoval.getSelectionAfter();\n\n      var _targetBlock = afterRemoval.getBlockForKey(selectionAfterRemoval.getFocusKey());\n\n      if (selectionAfterRemoval.getStartOffset() === 0) {\n        withMovedAtomicBlock = moveBlockInContentState(afterRemoval, atomicBlock, _targetBlock, 'before');\n      } else if (selectionAfterRemoval.getEndOffset() === _targetBlock.getLength()) {\n        withMovedAtomicBlock = moveBlockInContentState(afterRemoval, atomicBlock, _targetBlock, 'after');\n      } else {\n        var afterSplit = DraftModifier.splitBlock(afterRemoval, selectionAfterRemoval);\n        var selectionAfterSplit = afterSplit.getSelectionAfter();\n\n        var _targetBlock2 = afterSplit.getBlockForKey(selectionAfterSplit.getFocusKey());\n\n        withMovedAtomicBlock = moveBlockInContentState(afterSplit, atomicBlock, _targetBlock2, 'before');\n      }\n    }\n\n    var newContent = withMovedAtomicBlock.merge({\n      selectionBefore: selectionState,\n      selectionAfter: withMovedAtomicBlock.getSelectionAfter().set('hasFocus', true)\n    });\n    return EditorState.push(editorState, newContent, 'move-block');\n  }\n};\nmodule.exports = AtomicBlockUtils;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar Immutable = require(\"immutable\");\n\nvar List = Immutable.List;\nvar DELIMITER = '.';\n/**\n * A CompositeDraftDecorator traverses through a list of DraftDecorator\n * instances to identify sections of a ContentBlock that should be rendered\n * in a \"decorated\" manner. For example, hashtags, mentions, and links may\n * be intended to stand out visually, be rendered as anchors, etc.\n *\n * The list of decorators supplied to the constructor will be used in the\n * order they are provided. This allows the caller to specify a priority for\n * string matching, in case of match collisions among decorators.\n *\n * For instance, I may have a link with a `#` in its text. Though this section\n * of text may match our hashtag decorator, it should not be treated as a\n * hashtag. I should therefore list my link DraftDecorator\n * before my hashtag DraftDecorator when constructing this composite\n * decorator instance.\n *\n * Thus, when a collision like this is encountered, the earlier match is\n * preserved and the new match is discarded.\n */\n\nvar CompositeDraftDecorator =\n/*#__PURE__*/\nfunction () {\n  function CompositeDraftDecorator(decorators) {\n    _defineProperty(this, \"_decorators\", void 0);\n\n    // Copy the decorator array, since we use this array order to determine\n    // precedence of decoration matching. If the array is mutated externally,\n    // we don't want to be affected here.\n    this._decorators = decorators.slice();\n  }\n\n  var _proto = CompositeDraftDecorator.prototype;\n\n  _proto.getDecorations = function getDecorations(block, contentState) {\n    var decorations = Array(block.getText().length).fill(null);\n\n    this._decorators.forEach(function (\n    /*object*/\n    decorator,\n    /*number*/\n    ii) {\n      var counter = 0;\n      var strategy = decorator.strategy;\n\n      var callback = function callback(\n      /*number*/\n      start,\n      /*number*/\n      end) {\n        // Find out if any of our matching range is already occupied\n        // by another decorator. If so, discard the match. Otherwise, store\n        // the component key for rendering.\n        if (canOccupySlice(decorations, start, end)) {\n          occupySlice(decorations, start, end, ii + DELIMITER + counter);\n          counter++;\n        }\n      };\n\n      strategy(block, callback, contentState);\n    });\n\n    return List(decorations);\n  };\n\n  _proto.getComponentForKey = function getComponentForKey(key) {\n    var componentKey = parseInt(key.split(DELIMITER)[0], 10);\n    return this._decorators[componentKey].component;\n  };\n\n  _proto.getPropsForKey = function getPropsForKey(key) {\n    var componentKey = parseInt(key.split(DELIMITER)[0], 10);\n    return this._decorators[componentKey].props;\n  };\n\n  return CompositeDraftDecorator;\n}();\n/**\n * Determine whether we can occupy the specified slice of the decorations\n * array.\n */\n\n\nfunction canOccupySlice(decorations, start, end) {\n  for (var ii = start; ii < end; ii++) {\n    if (decorations[ii] != null) {\n      return false;\n    }\n  }\n\n  return true;\n}\n/**\n * Splice the specified component into our decoration array at the desired\n * range.\n */\n\n\nfunction occupySlice(targetArr, start, end, componentKey) {\n  for (var ii = start; ii < end; ii++) {\n    targetArr[ii] = componentKey;\n  }\n}\n\nmodule.exports = CompositeDraftDecorator;", "\"use strict\";\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n/**\n * This function is used to mark string literals representing CSS class names\n * so that they can be transformed statically. This allows for modularization\n * and minification of CSS class names.\n *\n * In static_upstream, this function is actually implemented, but it should\n * eventually be replaced with something more descriptive, and the transform\n * that is used in the main stack should be ported for use elsewhere.\n *\n * @param string|object className to modularize, or an object of key/values.\n *                      In the object case, the values are conditions that\n *                      determine if the className keys should be included.\n * @param [string ...]  Variable list of classNames in the string case.\n * @return string       Renderable space-separated CSS className.\n */\nfunction cx(classNames) {\n  if (typeof classNames == 'object') {\n    return Object.keys(classNames).filter(function (className) {\n      return classNames[className];\n    }).map(replace).join(' ');\n  }\n\n  return Array.prototype.map.call(arguments, replace).join(' ');\n}\n\nfunction replace(str) {\n  return str.replace(/\\//g, '-');\n}\n\nmodule.exports = cx;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar React = require(\"react\");\n\nvar cx = require(\"fbjs/lib/cx\");\n\nvar _require = require(\"immutable\"),\n    Map = _require.Map;\n\nvar UL_WRAP = React.createElement(\"ul\", {\n  className: cx('public/DraftStyleDefault/ul')\n});\nvar OL_WRAP = React.createElement(\"ol\", {\n  className: cx('public/DraftStyleDefault/ol')\n});\nvar PRE_WRAP = React.createElement(\"pre\", {\n  className: cx('public/DraftStyleDefault/pre')\n});\nvar DefaultDraftBlockRenderMap = Map({\n  'header-one': {\n    element: 'h1'\n  },\n  'header-two': {\n    element: 'h2'\n  },\n  'header-three': {\n    element: 'h3'\n  },\n  'header-four': {\n    element: 'h4'\n  },\n  'header-five': {\n    element: 'h5'\n  },\n  'header-six': {\n    element: 'h6'\n  },\n  'unordered-list-item': {\n    element: 'li',\n    wrapper: UL_WRAP\n  },\n  'ordered-list-item': {\n    element: 'li',\n    wrapper: OL_WRAP\n  },\n  blockquote: {\n    element: 'blockquote'\n  },\n  atomic: {\n    element: 'figure'\n  },\n  'code-block': {\n    element: 'pre',\n    wrapper: PRE_WRAP\n  },\n  unstyled: {\n    element: 'div',\n    aliasedElements: ['p']\n  }\n});\nmodule.exports = DefaultDraftBlockRenderMap;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nmodule.exports = {\n  BOLD: {\n    fontWeight: 'bold'\n  },\n  CODE: {\n    fontFamily: 'monospace',\n    wordWrap: 'break-word'\n  },\n  ITALIC: {\n    fontStyle: 'italic'\n  },\n  STRIKETHROUGH: {\n    textDecoration: 'line-through'\n  },\n  UNDERLINE: {\n    textDecoration: 'underline'\n  }\n};", "/////////////////////////////////////////////////////////////////////////////////\n/* UAParser.js v0.7.33\n   Copyright \u00A9 2012-2021 Faisal Salman <f@faisalman.com>\n   MIT License *//*\n   Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data.\n   Supports browser & node.js environment. \n   Demo   : https://faisalman.github.io/ua-parser-js\n   Source : https://github.com/faisalman/ua-parser-js */\n/////////////////////////////////////////////////////////////////////////////////\n\n(function (window, undefined) {\n\n    'use strict';\n\n    //////////////\n    // Constants\n    /////////////\n\n\n    var LIBVERSION  = '0.7.33',\n        EMPTY       = '',\n        UNKNOWN     = '?',\n        FUNC_TYPE   = 'function',\n        UNDEF_TYPE  = 'undefined',\n        OBJ_TYPE    = 'object',\n        STR_TYPE    = 'string',\n        MAJOR       = 'major',\n        MODEL       = 'model',\n        NAME        = 'name',\n        TYPE        = 'type',\n        VENDOR      = 'vendor',\n        VERSION     = 'version',\n        ARCHITECTURE= 'architecture',\n        CONSOLE     = 'console',\n        MOBILE      = 'mobile',\n        TABLET      = 'tablet',\n        SMARTTV     = 'smarttv',\n        WEARABLE    = 'wearable',\n        EMBEDDED    = 'embedded',\n        UA_MAX_LENGTH = 350;\n\n    var AMAZON  = 'Amazon',\n        APPLE   = 'Apple',\n        ASUS    = 'ASUS',\n        BLACKBERRY = 'BlackBerry',\n        BROWSER = 'Browser',\n        CHROME  = 'Chrome',\n        EDGE    = 'Edge',\n        FIREFOX = 'Firefox',\n        GOOGLE  = 'Google',\n        HUAWEI  = 'Huawei',\n        LG      = 'LG',\n        MICROSOFT = 'Microsoft',\n        MOTOROLA  = 'Motorola',\n        OPERA   = 'Opera',\n        SAMSUNG = 'Samsung',\n        SHARP   = 'Sharp',\n        SONY    = 'Sony',\n        XIAOMI  = 'Xiaomi',\n        ZEBRA   = 'Zebra',\n        FACEBOOK   = 'Facebook';\n\n    ///////////\n    // Helper\n    //////////\n\n    var extend = function (regexes, extensions) {\n            var mergedRegexes = {};\n            for (var i in regexes) {\n                if (extensions[i] && extensions[i].length % 2 === 0) {\n                    mergedRegexes[i] = extensions[i].concat(regexes[i]);\n                } else {\n                    mergedRegexes[i] = regexes[i];\n                }\n            }\n            return mergedRegexes;\n        },\n        enumerize = function (arr) {\n            var enums = {};\n            for (var i=0; i<arr.length; i++) {\n                enums[arr[i].toUpperCase()] = arr[i];\n            }\n            return enums;\n        },\n        has = function (str1, str2) {\n            return typeof str1 === STR_TYPE ? lowerize(str2).indexOf(lowerize(str1)) !== -1 : false;\n        },\n        lowerize = function (str) {\n            return str.toLowerCase();\n        },\n        majorize = function (version) {\n            return typeof(version) === STR_TYPE ? version.replace(/[^\\d\\.]/g, EMPTY).split('.')[0] : undefined;\n        },\n        trim = function (str, len) {\n            if (typeof(str) === STR_TYPE) {\n                str = str.replace(/^\\s\\s*/, EMPTY);\n                return typeof(len) === UNDEF_TYPE ? str : str.substring(0, UA_MAX_LENGTH);\n            }\n    };\n\n    ///////////////\n    // Map helper\n    //////////////\n\n    var rgxMapper = function (ua, arrays) {\n\n            var i = 0, j, k, p, q, matches, match;\n\n            // loop through all regexes maps\n            while (i < arrays.length && !matches) {\n\n                var regex = arrays[i],       // even sequence (0,2,4,..)\n                    props = arrays[i + 1];   // odd sequence (1,3,5,..)\n                j = k = 0;\n\n                // try matching uastring with regexes\n                while (j < regex.length && !matches) {\n\n                    matches = regex[j++].exec(ua);\n\n                    if (!!matches) {\n                        for (p = 0; p < props.length; p++) {\n                            match = matches[++k];\n                            q = props[p];\n                            // check if given property is actually array\n                            if (typeof q === OBJ_TYPE && q.length > 0) {\n                                if (q.length === 2) {\n                                    if (typeof q[1] == FUNC_TYPE) {\n                                        // assign modified match\n                                        this[q[0]] = q[1].call(this, match);\n                                    } else {\n                                        // assign given value, ignore regex match\n                                        this[q[0]] = q[1];\n                                    }\n                                } else if (q.length === 3) {\n                                    // check whether function or regex\n                                    if (typeof q[1] === FUNC_TYPE && !(q[1].exec && q[1].test)) {\n                                        // call function (usually string mapper)\n                                        this[q[0]] = match ? q[1].call(this, match, q[2]) : undefined;\n                                    } else {\n                                        // sanitize match using given regex\n                                        this[q[0]] = match ? match.replace(q[1], q[2]) : undefined;\n                                    }\n                                } else if (q.length === 4) {\n                                        this[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined;\n                                }\n                            } else {\n                                this[q] = match ? match : undefined;\n                            }\n                        }\n                    }\n                }\n                i += 2;\n            }\n        },\n\n        strMapper = function (str, map) {\n\n            for (var i in map) {\n                // check if current value is array\n                if (typeof map[i] === OBJ_TYPE && map[i].length > 0) {\n                    for (var j = 0; j < map[i].length; j++) {\n                        if (has(map[i][j], str)) {\n                            return (i === UNKNOWN) ? undefined : i;\n                        }\n                    }\n                } else if (has(map[i], str)) {\n                    return (i === UNKNOWN) ? undefined : i;\n                }\n            }\n            return str;\n    };\n\n    ///////////////\n    // String map\n    //////////////\n\n    // Safari < 3.0\n    var oldSafariMap = {\n            '1.0'   : '/8',\n            '1.2'   : '/1',\n            '1.3'   : '/3',\n            '2.0'   : '/412',\n            '2.0.2' : '/416',\n            '2.0.3' : '/417',\n            '2.0.4' : '/419',\n            '?'     : '/'\n        },\n        windowsVersionMap = {\n            'ME'        : '4.90',\n            'NT 3.11'   : 'NT3.51',\n            'NT 4.0'    : 'NT4.0',\n            '2000'      : 'NT 5.0',\n            'XP'        : ['NT 5.1', 'NT 5.2'],\n            'Vista'     : 'NT 6.0',\n            '7'         : 'NT 6.1',\n            '8'         : 'NT 6.2',\n            '8.1'       : 'NT 6.3',\n            '10'        : ['NT 6.4', 'NT 10.0'],\n            'RT'        : 'ARM'\n    };\n\n    //////////////\n    // Regex map\n    /////////////\n\n    var regexes = {\n\n        browser : [[\n\n            /\\b(?:crmo|crios)\\/([\\w\\.]+)/i                                      // Chrome for Android/iOS\n            ], [VERSION, [NAME, 'Chrome']], [\n            /edg(?:e|ios|a)?\\/([\\w\\.]+)/i                                       // Microsoft Edge\n            ], [VERSION, [NAME, 'Edge']], [\n\n            // Presto based\n            /(opera mini)\\/([-\\w\\.]+)/i,                                        // Opera Mini\n            /(opera [mobiletab]{3,6})\\b.+version\\/([-\\w\\.]+)/i,                 // Opera Mobi/Tablet\n            /(opera)(?:.+version\\/|[\\/ ]+)([\\w\\.]+)/i                           // Opera\n            ], [NAME, VERSION], [\n            /opios[\\/ ]+([\\w\\.]+)/i                                             // Opera mini on iphone >= 8.0\n            ], [VERSION, [NAME, OPERA+' Mini']], [\n            /\\bopr\\/([\\w\\.]+)/i                                                 // Opera Webkit\n            ], [VERSION, [NAME, OPERA]], [\n\n            // Mixed\n            /(kindle)\\/([\\w\\.]+)/i,                                             // Kindle\n            /(lunascape|maxthon|netfront|jasmine|blazer)[\\/ ]?([\\w\\.]*)/i,      // Lunascape/Maxthon/Netfront/Jasmine/Blazer\n            // Trident based\n            /(avant |iemobile|slim)(?:browser)?[\\/ ]?([\\w\\.]*)/i,               // Avant/IEMobile/SlimBrowser\n            /(ba?idubrowser)[\\/ ]?([\\w\\.]+)/i,                                  // Baidu Browser\n            /(?:ms|\\()(ie) ([\\w\\.]+)/i,                                         // Internet Explorer\n\n            // Webkit/KHTML based                                               // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon\n            /(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\\/([-\\w\\.]+)/i,\n                                                                                // Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ, aka ShouQ\n            /(weibo)__([\\d\\.]+)/i                                               // Weibo\n            ], [NAME, VERSION], [\n            /(?:\\buc? ?browser|(?:juc.+)ucweb)[\\/ ]?([\\w\\.]+)/i                 // UCBrowser\n            ], [VERSION, [NAME, 'UC'+BROWSER]], [\n            /microm.+\\bqbcore\\/([\\w\\.]+)/i,                                     // WeChat Desktop for Windows Built-in Browser\n            /\\bqbcore\\/([\\w\\.]+).+microm/i\n            ], [VERSION, [NAME, 'WeChat(Win) Desktop']], [\n            /micromessenger\\/([\\w\\.]+)/i                                        // WeChat\n            ], [VERSION, [NAME, 'WeChat']], [\n            /konqueror\\/([\\w\\.]+)/i                                             // Konqueror\n            ], [VERSION, [NAME, 'Konqueror']], [\n            /trident.+rv[: ]([\\w\\.]{1,9})\\b.+like gecko/i                       // IE11\n            ], [VERSION, [NAME, 'IE']], [\n            /yabrowser\\/([\\w\\.]+)/i                                             // Yandex\n            ], [VERSION, [NAME, 'Yandex']], [\n            /(avast|avg)\\/([\\w\\.]+)/i                                           // Avast/AVG Secure Browser\n            ], [[NAME, /(.+)/, '$1 Secure '+BROWSER], VERSION], [\n            /\\bfocus\\/([\\w\\.]+)/i                                               // Firefox Focus\n            ], [VERSION, [NAME, FIREFOX+' Focus']], [\n            /\\bopt\\/([\\w\\.]+)/i                                                 // Opera Touch\n            ], [VERSION, [NAME, OPERA+' Touch']], [\n            /coc_coc\\w+\\/([\\w\\.]+)/i                                            // Coc Coc Browser\n            ], [VERSION, [NAME, 'Coc Coc']], [\n            /dolfin\\/([\\w\\.]+)/i                                                // Dolphin\n            ], [VERSION, [NAME, 'Dolphin']], [\n            /coast\\/([\\w\\.]+)/i                                                 // Opera Coast\n            ], [VERSION, [NAME, OPERA+' Coast']], [\n            /miuibrowser\\/([\\w\\.]+)/i                                           // MIUI Browser\n            ], [VERSION, [NAME, 'MIUI '+BROWSER]], [\n            /fxios\\/([-\\w\\.]+)/i                                                // Firefox for iOS\n            ], [VERSION, [NAME, FIREFOX]], [\n            /\\bqihu|(qi?ho?o?|360)browser/i                                     // 360\n            ], [[NAME, '360 '+BROWSER]], [\n            /(oculus|samsung|sailfish|huawei)browser\\/([\\w\\.]+)/i\n            ], [[NAME, /(.+)/, '$1 '+BROWSER], VERSION], [                      // Oculus/Samsung/Sailfish/Huawei Browser\n            /(comodo_dragon)\\/([\\w\\.]+)/i                                       // Comodo Dragon\n            ], [[NAME, /_/g, ' '], VERSION], [\n            /(electron)\\/([\\w\\.]+) safari/i,                                    // Electron-based App\n            /(tesla)(?: qtcarbrowser|\\/(20\\d\\d\\.[-\\w\\.]+))/i,                   // Tesla\n            /m?(qqbrowser|baiduboxapp|2345Explorer)[\\/ ]?([\\w\\.]+)/i            // QQBrowser/Baidu App/2345 Browser\n            ], [NAME, VERSION], [\n            /(metasr)[\\/ ]?([\\w\\.]+)/i,                                         // SouGouBrowser\n            /(lbbrowser)/i,                                                     // LieBao Browser\n            /\\[(linkedin)app\\]/i                                                // LinkedIn App for iOS & Android\n            ], [NAME], [\n\n            // WebView\n            /((?:fban\\/fbios|fb_iab\\/fb4a)(?!.+fbav)|;fbav\\/([\\w\\.]+);)/i       // Facebook App for iOS & Android\n            ], [[NAME, FACEBOOK], VERSION], [\n            /safari (line)\\/([\\w\\.]+)/i,                                        // Line App for iOS\n            /\\b(line)\\/([\\w\\.]+)\\/iab/i,                                        // Line App for Android\n            /(chromium|instagram)[\\/ ]([-\\w\\.]+)/i                              // Chromium/Instagram\n            ], [NAME, VERSION], [\n            /\\bgsa\\/([\\w\\.]+) .*safari\\//i                                      // Google Search Appliance on iOS\n            ], [VERSION, [NAME, 'GSA']], [\n\n            /headlesschrome(?:\\/([\\w\\.]+)| )/i                                  // Chrome Headless\n            ], [VERSION, [NAME, CHROME+' Headless']], [\n\n            / wv\\).+(chrome)\\/([\\w\\.]+)/i                                       // Chrome WebView\n            ], [[NAME, CHROME+' WebView'], VERSION], [\n\n            /droid.+ version\\/([\\w\\.]+)\\b.+(?:mobile safari|safari)/i           // Android Browser\n            ], [VERSION, [NAME, 'Android '+BROWSER]], [\n\n            /(chrome|omniweb|arora|[tizenoka]{5} ?browser)\\/v?([\\w\\.]+)/i       // Chrome/OmniWeb/Arora/Tizen/Nokia\n            ], [NAME, VERSION], [\n\n            /version\\/([\\w\\.\\,]+) .*mobile\\/\\w+ (safari)/i                      // Mobile Safari\n            ], [VERSION, [NAME, 'Mobile Safari']], [\n            /version\\/([\\w(\\.|\\,)]+) .*(mobile ?safari|safari)/i                // Safari & Safari Mobile\n            ], [VERSION, NAME], [\n            /webkit.+?(mobile ?safari|safari)(\\/[\\w\\.]+)/i                      // Safari < 3.0\n            ], [NAME, [VERSION, strMapper, oldSafariMap]], [\n\n            /(webkit|khtml)\\/([\\w\\.]+)/i\n            ], [NAME, VERSION], [\n\n            // Gecko based\n            /(navigator|netscape\\d?)\\/([-\\w\\.]+)/i                              // Netscape\n            ], [[NAME, 'Netscape'], VERSION], [\n            /mobile vr; rv:([\\w\\.]+)\\).+firefox/i                               // Firefox Reality\n            ], [VERSION, [NAME, FIREFOX+' Reality']], [\n            /ekiohf.+(flow)\\/([\\w\\.]+)/i,                                       // Flow\n            /(swiftfox)/i,                                                      // Swiftfox\n            /(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\\/ ]?([\\w\\.\\+]+)/i,\n                                                                                // IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror/Klar\n            /(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\\/([-\\w\\.]+)$/i,\n                                                                                // Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix\n            /(firefox)\\/([\\w\\.]+)/i,                                            // Other Firefox-based\n            /(mozilla)\\/([\\w\\.]+) .+rv\\:.+gecko\\/\\d+/i,                         // Mozilla\n\n            // Other\n            /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\\. ]?browser)[-\\/ ]?v?([\\w\\.]+)/i,\n                                                                                // Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir/Obigo/Mosaic/Go/ICE/UP.Browser\n            /(links) \\(([\\w\\.]+)/i                                              // Links\n            ], [NAME, VERSION], [\n            \n            /(cobalt)\\/([\\w\\.]+)/i                                              // Cobalt\n            ], [NAME, [VERSION, /master.|lts./, \"\"]]\n        ],\n\n        cpu : [[\n\n            /(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\\)]/i                     // AMD64 (x64)\n            ], [[ARCHITECTURE, 'amd64']], [\n\n            /(ia32(?=;))/i                                                      // IA32 (quicktime)\n            ], [[ARCHITECTURE, lowerize]], [\n\n            /((?:i[346]|x)86)[;\\)]/i                                            // IA32 (x86)\n            ], [[ARCHITECTURE, 'ia32']], [\n\n            /\\b(aarch64|arm(v?8e?l?|_?64))\\b/i                                 // ARM64\n            ], [[ARCHITECTURE, 'arm64']], [\n\n            /\\b(arm(?:v[67])?ht?n?[fl]p?)\\b/i                                   // ARMHF\n            ], [[ARCHITECTURE, 'armhf']], [\n\n            // PocketPC mistakenly identified as PowerPC\n            /windows (ce|mobile); ppc;/i\n            ], [[ARCHITECTURE, 'arm']], [\n\n            /((?:ppc|powerpc)(?:64)?)(?: mac|;|\\))/i                            // PowerPC\n            ], [[ARCHITECTURE, /ower/, EMPTY, lowerize]], [\n\n            /(sun4\\w)[;\\)]/i                                                    // SPARC\n            ], [[ARCHITECTURE, 'sparc']], [\n\n            /((?:avr32|ia64(?=;))|68k(?=\\))|\\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\\b|pa-risc)/i\n                                                                                // IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC\n            ], [[ARCHITECTURE, lowerize]]\n        ],\n\n        device : [[\n\n            //////////////////////////\n            // MOBILES & TABLETS\n            // Ordered by popularity\n            /////////////////////////\n\n            // Samsung\n            /\\b(sch-i[89]0\\d|shw-m380s|sm-[ptx]\\w{2,4}|gt-[pn]\\d{2,4}|sgh-t8[56]9|nexus 10)/i\n            ], [MODEL, [VENDOR, SAMSUNG], [TYPE, TABLET]], [\n            /\\b((?:s[cgp]h|gt|sm)-\\w+|galaxy nexus)/i,\n            /samsung[- ]([-\\w]+)/i,\n            /sec-(sgh\\w+)/i\n            ], [MODEL, [VENDOR, SAMSUNG], [TYPE, MOBILE]], [\n\n            // Apple\n            /\\((ip(?:hone|od)[\\w ]*);/i                                         // iPod/iPhone\n            ], [MODEL, [VENDOR, APPLE], [TYPE, MOBILE]], [\n            /\\((ipad);[-\\w\\),; ]+apple/i,                                       // iPad\n            /applecoremedia\\/[\\w\\.]+ \\((ipad)/i,\n            /\\b(ipad)\\d\\d?,\\d\\d?[;\\]].+ios/i\n            ], [MODEL, [VENDOR, APPLE], [TYPE, TABLET]], [\n            /(macintosh);/i\n            ], [MODEL, [VENDOR, APPLE]], [\n\n            // Huawei\n            /\\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\\d{2})\\b(?!.+d\\/s)/i\n            ], [MODEL, [VENDOR, HUAWEI], [TYPE, TABLET]], [\n            /(?:huawei|honor)([-\\w ]+)[;\\)]/i,\n            /\\b(nexus 6p|\\w{2,4}e?-[atu]?[ln][\\dx][012359c][adn]?)\\b(?!.+d\\/s)/i\n            ], [MODEL, [VENDOR, HUAWEI], [TYPE, MOBILE]], [\n\n            // Xiaomi\n            /\\b(poco[\\w ]+)(?: bui|\\))/i,                                       // Xiaomi POCO\n            /\\b; (\\w+) build\\/hm\\1/i,                                           // Xiaomi Hongmi 'numeric' models\n            /\\b(hm[-_ ]?note?[_ ]?(?:\\d\\w)?) bui/i,                             // Xiaomi Hongmi\n            /\\b(redmi[\\-_ ]?(?:note|k)?[\\w_ ]+)(?: bui|\\))/i,                   // Xiaomi Redmi\n            /\\b(mi[-_ ]?(?:a\\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\\d?\\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\\))/i // Xiaomi Mi\n            ], [[MODEL, /_/g, ' '], [VENDOR, XIAOMI], [TYPE, MOBILE]], [\n            /\\b(mi[-_ ]?(?:pad)(?:[\\w_ ]+))(?: bui|\\))/i                        // Mi Pad tablets\n            ],[[MODEL, /_/g, ' '], [VENDOR, XIAOMI], [TYPE, TABLET]], [\n\n            // OPPO\n            /; (\\w+) bui.+ oppo/i,\n            /\\b(cph[12]\\d{3}|p(?:af|c[al]|d\\w|e[ar])[mt]\\d0|x9007|a101op)\\b/i\n            ], [MODEL, [VENDOR, 'OPPO'], [TYPE, MOBILE]], [\n\n            // Vivo\n            /vivo (\\w+)(?: bui|\\))/i,\n            /\\b(v[12]\\d{3}\\w?[at])(?: bui|;)/i\n            ], [MODEL, [VENDOR, 'Vivo'], [TYPE, MOBILE]], [\n\n            // Realme\n            /\\b(rmx[12]\\d{3})(?: bui|;|\\))/i\n            ], [MODEL, [VENDOR, 'Realme'], [TYPE, MOBILE]], [\n\n            // Motorola\n            /\\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\\b[\\w ]+build\\//i,\n            /\\bmot(?:orola)?[- ](\\w*)/i,\n            /((?:moto[\\w\\(\\) ]+|xt\\d{3,4}|nexus 6)(?= bui|\\)))/i\n            ], [MODEL, [VENDOR, MOTOROLA], [TYPE, MOBILE]], [\n            /\\b(mz60\\d|xoom[2 ]{0,2}) build\\//i\n            ], [MODEL, [VENDOR, MOTOROLA], [TYPE, TABLET]], [\n\n            // LG\n            /((?=lg)?[vl]k\\-?\\d{3}) bui| 3\\.[-\\w; ]{10}lg?-([06cv9]{3,4})/i\n            ], [MODEL, [VENDOR, LG], [TYPE, TABLET]], [\n            /(lm(?:-?f100[nv]?|-[\\w\\.]+)(?= bui|\\))|nexus [45])/i,\n            /\\blg[-e;\\/ ]+((?!browser|netcast|android tv)\\w+)/i,\n            /\\blg-?([\\d\\w]+) bui/i\n            ], [MODEL, [VENDOR, LG], [TYPE, MOBILE]], [\n\n            // Lenovo\n            /(ideatab[-\\w ]+)/i,\n            /lenovo ?(s[56]000[-\\w]+|tab(?:[\\w ]+)|yt[-\\d\\w]{6}|tb[-\\d\\w]{6})/i\n            ], [MODEL, [VENDOR, 'Lenovo'], [TYPE, TABLET]], [\n\n            // Nokia\n            /(?:maemo|nokia).*(n900|lumia \\d+)/i,\n            /nokia[-_ ]?([-\\w\\.]*)/i\n            ], [[MODEL, /_/g, ' '], [VENDOR, 'Nokia'], [TYPE, MOBILE]], [\n\n            // Google\n            /(pixel c)\\b/i                                                      // Google Pixel C\n            ], [MODEL, [VENDOR, GOOGLE], [TYPE, TABLET]], [\n            /droid.+; (pixel[\\daxl ]{0,6})(?: bui|\\))/i                         // Google Pixel\n            ], [MODEL, [VENDOR, GOOGLE], [TYPE, MOBILE]], [\n\n            // Sony\n            /droid.+ (a?\\d[0-2]{2}so|[c-g]\\d{4}|so[-gl]\\w+|xq-a\\w[4-7][12])(?= bui|\\).+chrome\\/(?![1-6]{0,1}\\d\\.))/i\n            ], [MODEL, [VENDOR, SONY], [TYPE, MOBILE]], [\n            /sony tablet [ps]/i,\n            /\\b(?:sony)?sgp\\w+(?: bui|\\))/i\n            ], [[MODEL, 'Xperia Tablet'], [VENDOR, SONY], [TYPE, TABLET]], [\n\n            // OnePlus\n            / (kb2005|in20[12]5|be20[12][59])\\b/i,\n            /(?:one)?(?:plus)? (a\\d0\\d\\d)(?: b|\\))/i\n            ], [MODEL, [VENDOR, 'OnePlus'], [TYPE, MOBILE]], [\n\n            // Amazon\n            /(alexa)webm/i,\n            /(kf[a-z]{2}wi)( bui|\\))/i,                                         // Kindle Fire without Silk\n            /(kf[a-z]+)( bui|\\)).+silk\\//i                                      // Kindle Fire HD\n            ], [MODEL, [VENDOR, AMAZON], [TYPE, TABLET]], [\n            /((?:sd|kf)[0349hijorstuw]+)( bui|\\)).+silk\\//i                     // Fire Phone\n            ], [[MODEL, /(.+)/g, 'Fire Phone $1'], [VENDOR, AMAZON], [TYPE, MOBILE]], [\n\n            // BlackBerry\n            /(playbook);[-\\w\\),; ]+(rim)/i                                      // BlackBerry PlayBook\n            ], [MODEL, VENDOR, [TYPE, TABLET]], [\n            /\\b((?:bb[a-f]|st[hv])100-\\d)/i,\n            /\\(bb10; (\\w+)/i                                                    // BlackBerry 10\n            ], [MODEL, [VENDOR, BLACKBERRY], [TYPE, MOBILE]], [\n\n            // Asus\n            /(?:\\b|asus_)(transfo[prime ]{4,10} \\w+|eeepc|slider \\w+|nexus 7|padfone|p00[cj])/i\n            ], [MODEL, [VENDOR, ASUS], [TYPE, TABLET]], [\n            / (z[bes]6[027][012][km][ls]|zenfone \\d\\w?)\\b/i\n            ], [MODEL, [VENDOR, ASUS], [TYPE, MOBILE]], [\n\n            // HTC\n            /(nexus 9)/i                                                        // HTC Nexus 9\n            ], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [\n            /(htc)[-;_ ]{1,2}([\\w ]+(?=\\)| bui)|\\w+)/i,                         // HTC\n\n            // ZTE\n            /(zte)[- ]([\\w ]+?)(?: bui|\\/|\\))/i,\n            /(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\\w]*)/i         // Alcatel/GeeksPhone/Nexian/Panasonic/Sony\n            ], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [\n\n            // Acer\n            /droid.+; ([ab][1-7]-?[0178a]\\d\\d?)/i\n            ], [MODEL, [VENDOR, 'Acer'], [TYPE, TABLET]], [\n\n            // Meizu\n            /droid.+; (m[1-5] note) bui/i,\n            /\\bmz-([-\\w]{2,})/i\n            ], [MODEL, [VENDOR, 'Meizu'], [TYPE, MOBILE]], [\n\n            // Sharp\n            /\\b(sh-?[altvz]?\\d\\d[a-ekm]?)/i\n            ], [MODEL, [VENDOR, SHARP], [TYPE, MOBILE]], [\n\n            // MIXED\n            /(blackberry|benq|palm(?=\\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\\w]*)/i,\n                                                                                // BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron\n            /(hp) ([\\w ]+\\w)/i,                                                 // HP iPAQ\n            /(asus)-?(\\w+)/i,                                                   // Asus\n            /(microsoft); (lumia[\\w ]+)/i,                                      // Microsoft Lumia\n            /(lenovo)[-_ ]?([-\\w]+)/i,                                          // Lenovo\n            /(jolla)/i,                                                         // Jolla\n            /(oppo) ?([\\w ]+) bui/i                                             // OPPO\n            ], [VENDOR, MODEL, [TYPE, MOBILE]], [\n\n            /(archos) (gamepad2?)/i,                                            // Archos\n            /(hp).+(touchpad(?!.+tablet)|tablet)/i,                             // HP TouchPad\n            /(kindle)\\/([\\w\\.]+)/i,                                             // Kindle\n            /(nook)[\\w ]+build\\/(\\w+)/i,                                        // Nook\n            /(dell) (strea[kpr\\d ]*[\\dko])/i,                                   // Dell Streak\n            /(le[- ]+pan)[- ]+(\\w{1,9}) bui/i,                                  // Le Pan Tablets\n            /(trinity)[- ]*(t\\d{3}) bui/i,                                      // Trinity Tablets\n            /(gigaset)[- ]+(q\\w{1,9}) bui/i,                                    // Gigaset Tablets\n            /(vodafone) ([\\w ]+)(?:\\)| bui)/i                                   // Vodafone\n            ], [VENDOR, MODEL, [TYPE, TABLET]], [\n\n            /(surface duo)/i                                                    // Surface Duo\n            ], [MODEL, [VENDOR, MICROSOFT], [TYPE, TABLET]], [\n            /droid [\\d\\.]+; (fp\\du?)(?: b|\\))/i                                 // Fairphone\n            ], [MODEL, [VENDOR, 'Fairphone'], [TYPE, MOBILE]], [\n            /(u304aa)/i                                                         // AT&T\n            ], [MODEL, [VENDOR, 'AT&T'], [TYPE, MOBILE]], [\n            /\\bsie-(\\w*)/i                                                      // Siemens\n            ], [MODEL, [VENDOR, 'Siemens'], [TYPE, MOBILE]], [\n            /\\b(rct\\w+) b/i                                                     // RCA Tablets\n            ], [MODEL, [VENDOR, 'RCA'], [TYPE, TABLET]], [\n            /\\b(venue[\\d ]{2,7}) b/i                                            // Dell Venue Tablets\n            ], [MODEL, [VENDOR, 'Dell'], [TYPE, TABLET]], [\n            /\\b(q(?:mv|ta)\\w+) b/i                                              // Verizon Tablet\n            ], [MODEL, [VENDOR, 'Verizon'], [TYPE, TABLET]], [\n            /\\b(?:barnes[& ]+noble |bn[rt])([\\w\\+ ]*) b/i                       // Barnes & Noble Tablet\n            ], [MODEL, [VENDOR, 'Barnes & Noble'], [TYPE, TABLET]], [\n            /\\b(tm\\d{3}\\w+) b/i\n            ], [MODEL, [VENDOR, 'NuVision'], [TYPE, TABLET]], [\n            /\\b(k88) b/i                                                        // ZTE K Series Tablet\n            ], [MODEL, [VENDOR, 'ZTE'], [TYPE, TABLET]], [\n            /\\b(nx\\d{3}j) b/i                                                   // ZTE Nubia\n            ], [MODEL, [VENDOR, 'ZTE'], [TYPE, MOBILE]], [\n            /\\b(gen\\d{3}) b.+49h/i                                              // Swiss GEN Mobile\n            ], [MODEL, [VENDOR, 'Swiss'], [TYPE, MOBILE]], [\n            /\\b(zur\\d{3}) b/i                                                   // Swiss ZUR Tablet\n            ], [MODEL, [VENDOR, 'Swiss'], [TYPE, TABLET]], [\n            /\\b((zeki)?tb.*\\b) b/i                                              // Zeki Tablets\n            ], [MODEL, [VENDOR, 'Zeki'], [TYPE, TABLET]], [\n            /\\b([yr]\\d{2}) b/i,\n            /\\b(dragon[- ]+touch |dt)(\\w{5}) b/i                                // Dragon Touch Tablet\n            ], [[VENDOR, 'Dragon Touch'], MODEL, [TYPE, TABLET]], [\n            /\\b(ns-?\\w{0,9}) b/i                                                // Insignia Tablets\n            ], [MODEL, [VENDOR, 'Insignia'], [TYPE, TABLET]], [\n            /\\b((nxa|next)-?\\w{0,9}) b/i                                        // NextBook Tablets\n            ], [MODEL, [VENDOR, 'NextBook'], [TYPE, TABLET]], [\n            /\\b(xtreme\\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i                  // Voice Xtreme Phones\n            ], [[VENDOR, 'Voice'], MODEL, [TYPE, MOBILE]], [\n            /\\b(lvtel\\-)?(v1[12]) b/i                                           // LvTel Phones\n            ], [[VENDOR, 'LvTel'], MODEL, [TYPE, MOBILE]], [\n            /\\b(ph-1) /i                                                        // Essential PH-1\n            ], [MODEL, [VENDOR, 'Essential'], [TYPE, MOBILE]], [\n            /\\b(v(100md|700na|7011|917g).*\\b) b/i                               // Envizen Tablets\n            ], [MODEL, [VENDOR, 'Envizen'], [TYPE, TABLET]], [\n            /\\b(trio[-\\w\\. ]+) b/i                                              // MachSpeed Tablets\n            ], [MODEL, [VENDOR, 'MachSpeed'], [TYPE, TABLET]], [\n            /\\btu_(1491) b/i                                                    // Rotor Tablets\n            ], [MODEL, [VENDOR, 'Rotor'], [TYPE, TABLET]], [\n            /(shield[\\w ]+) b/i                                                 // Nvidia Shield Tablets\n            ], [MODEL, [VENDOR, 'Nvidia'], [TYPE, TABLET]], [\n            /(sprint) (\\w+)/i                                                   // Sprint Phones\n            ], [VENDOR, MODEL, [TYPE, MOBILE]], [\n            /(kin\\.[onetw]{3})/i                                                // Microsoft Kin\n            ], [[MODEL, /\\./g, ' '], [VENDOR, MICROSOFT], [TYPE, MOBILE]], [\n            /droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\\)/i             // Zebra\n            ], [MODEL, [VENDOR, ZEBRA], [TYPE, TABLET]], [\n            /droid.+; (ec30|ps20|tc[2-8]\\d[kx])\\)/i\n            ], [MODEL, [VENDOR, ZEBRA], [TYPE, MOBILE]], [\n\n            ///////////////////\n            // CONSOLES\n            ///////////////////\n\n            /(ouya)/i,                                                          // Ouya\n            /(nintendo) ([wids3utch]+)/i                                        // Nintendo\n            ], [VENDOR, MODEL, [TYPE, CONSOLE]], [\n            /droid.+; (shield) bui/i                                            // Nvidia\n            ], [MODEL, [VENDOR, 'Nvidia'], [TYPE, CONSOLE]], [\n            /(playstation [345portablevi]+)/i                                   // Playstation\n            ], [MODEL, [VENDOR, SONY], [TYPE, CONSOLE]], [\n            /\\b(xbox(?: one)?(?!; xbox))[\\); ]/i                                // Microsoft Xbox\n            ], [MODEL, [VENDOR, MICROSOFT], [TYPE, CONSOLE]], [\n\n            ///////////////////\n            // SMARTTVS\n            ///////////////////\n\n            /smart-tv.+(samsung)/i                                              // Samsung\n            ], [VENDOR, [TYPE, SMARTTV]], [\n            /hbbtv.+maple;(\\d+)/i\n            ], [[MODEL, /^/, 'SmartTV'], [VENDOR, SAMSUNG], [TYPE, SMARTTV]], [\n            /(nux; netcast.+smarttv|lg (netcast\\.tv-201\\d|android tv))/i        // LG SmartTV\n            ], [[VENDOR, LG], [TYPE, SMARTTV]], [\n            /(apple) ?tv/i                                                      // Apple TV\n            ], [VENDOR, [MODEL, APPLE+' TV'], [TYPE, SMARTTV]], [\n            /crkey/i                                                            // Google Chromecast\n            ], [[MODEL, CHROME+'cast'], [VENDOR, GOOGLE], [TYPE, SMARTTV]], [\n            /droid.+aft(\\w)( bui|\\))/i                                          // Fire TV\n            ], [MODEL, [VENDOR, AMAZON], [TYPE, SMARTTV]], [\n            /\\(dtv[\\);].+(aquos)/i,\n            /(aquos-tv[\\w ]+)\\)/i                                               // Sharp\n            ], [MODEL, [VENDOR, SHARP], [TYPE, SMARTTV]],[\n            /(bravia[\\w ]+)( bui|\\))/i                                              // Sony\n            ], [MODEL, [VENDOR, SONY], [TYPE, SMARTTV]], [\n            /(mitv-\\w{5}) bui/i                                                 // Xiaomi\n            ], [MODEL, [VENDOR, XIAOMI], [TYPE, SMARTTV]], [\n            /\\b(roku)[\\dx]*[\\)\\/]((?:dvp-)?[\\d\\.]*)/i,                          // Roku\n            /hbbtv\\/\\d+\\.\\d+\\.\\d+ +\\([\\w ]*; *(\\w[^;]*);([^;]*)/i               // HbbTV devices\n            ], [[VENDOR, trim], [MODEL, trim], [TYPE, SMARTTV]], [\n            /\\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\\b/i                   // SmartTV from Unidentified Vendors\n            ], [[TYPE, SMARTTV]], [\n\n            ///////////////////\n            // WEARABLES\n            ///////////////////\n\n            /((pebble))app/i                                                    // Pebble\n            ], [VENDOR, MODEL, [TYPE, WEARABLE]], [\n            /droid.+; (glass) \\d/i                                              // Google Glass\n            ], [MODEL, [VENDOR, GOOGLE], [TYPE, WEARABLE]], [\n            /droid.+; (wt63?0{2,3})\\)/i\n            ], [MODEL, [VENDOR, ZEBRA], [TYPE, WEARABLE]], [\n            /(quest( 2)?)/i                                                     // Oculus Quest\n            ], [MODEL, [VENDOR, FACEBOOK], [TYPE, WEARABLE]], [\n\n            ///////////////////\n            // EMBEDDED\n            ///////////////////\n\n            /(tesla)(?: qtcarbrowser|\\/[-\\w\\.]+)/i                              // Tesla\n            ], [VENDOR, [TYPE, EMBEDDED]], [\n\n            ////////////////////\n            // MIXED (GENERIC)\n            ///////////////////\n\n            /droid .+?; ([^;]+?)(?: bui|\\) applew).+? mobile safari/i           // Android Phones from Unidentified Vendors\n            ], [MODEL, [TYPE, MOBILE]], [\n            /droid .+?; ([^;]+?)(?: bui|\\) applew).+?(?! mobile) safari/i       // Android Tablets from Unidentified Vendors\n            ], [MODEL, [TYPE, TABLET]], [\n            /\\b((tablet|tab)[;\\/]|focus\\/\\d(?!.+mobile))/i                      // Unidentifiable Tablet\n            ], [[TYPE, TABLET]], [\n            /(phone|mobile(?:[;\\/]| [ \\w\\/\\.]*safari)|pda(?=.+windows ce))/i    // Unidentifiable Mobile\n            ], [[TYPE, MOBILE]], [\n            /(android[-\\w\\. ]{0,9});.+buil/i                                    // Generic Android Device\n            ], [MODEL, [VENDOR, 'Generic']]\n        ],\n\n        engine : [[\n\n            /windows.+ edge\\/([\\w\\.]+)/i                                       // EdgeHTML\n            ], [VERSION, [NAME, EDGE+'HTML']], [\n\n            /webkit\\/537\\.36.+chrome\\/(?!27)([\\w\\.]+)/i                         // Blink\n            ], [VERSION, [NAME, 'Blink']], [\n\n            /(presto)\\/([\\w\\.]+)/i,                                             // Presto\n            /(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\\/([\\w\\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna\n            /ekioh(flow)\\/([\\w\\.]+)/i,                                          // Flow\n            /(khtml|tasman|links)[\\/ ]\\(?([\\w\\.]+)/i,                           // KHTML/Tasman/Links\n            /(icab)[\\/ ]([23]\\.[\\d\\.]+)/i                                       // iCab\n            ], [NAME, VERSION], [\n\n            /rv\\:([\\w\\.]{1,9})\\b.+(gecko)/i                                     // Gecko\n            ], [VERSION, NAME]\n        ],\n\n        os : [[\n\n            // Windows\n            /microsoft (windows) (vista|xp)/i                                   // Windows (iTunes)\n            ], [NAME, VERSION], [\n            /(windows) nt 6\\.2; (arm)/i,                                        // Windows RT\n            /(windows (?:phone(?: os)?|mobile))[\\/ ]?([\\d\\.\\w ]*)/i,            // Windows Phone\n            /(windows)[\\/ ]?([ntce\\d\\. ]+\\w)(?!.+xbox)/i\n            ], [NAME, [VERSION, strMapper, windowsVersionMap]], [\n            /(win(?=3|9|n)|win 9x )([nt\\d\\.]+)/i\n            ], [[NAME, 'Windows'], [VERSION, strMapper, windowsVersionMap]], [\n\n            // iOS/macOS\n            /ip[honead]{2,4}\\b(?:.*os ([\\w]+) like mac|; opera)/i,              // iOS\n            /cfnetwork\\/.+darwin/i\n            ], [[VERSION, /_/g, '.'], [NAME, 'iOS']], [\n            /(mac os x) ?([\\w\\. ]*)/i,\n            /(macintosh|mac_powerpc\\b)(?!.+haiku)/i                             // Mac OS\n            ], [[NAME, 'Mac OS'], [VERSION, /_/g, '.']], [\n\n            // Mobile OSes\n            /droid ([\\w\\.]+)\\b.+(android[- ]x86|harmonyos)/i                    // Android-x86/HarmonyOS\n            ], [VERSION, NAME], [                                               // Android/WebOS/QNX/Bada/RIM/Maemo/MeeGo/Sailfish OS\n            /(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\\/ ]?([\\w\\.]*)/i,\n            /(blackberry)\\w*\\/([\\w\\.]*)/i,                                      // Blackberry\n            /(tizen|kaios)[\\/ ]([\\w\\.]+)/i,                                     // Tizen/KaiOS\n            /\\((series40);/i                                                    // Series 40\n            ], [NAME, VERSION], [\n            /\\(bb(10);/i                                                        // BlackBerry 10\n            ], [VERSION, [NAME, BLACKBERRY]], [\n            /(?:symbian ?os|symbos|s60(?=;)|series60)[-\\/ ]?([\\w\\.]*)/i         // Symbian\n            ], [VERSION, [NAME, 'Symbian']], [\n            /mozilla\\/[\\d\\.]+ \\((?:mobile|tablet|tv|mobile; [\\w ]+); rv:.+ gecko\\/([\\w\\.]+)/i // Firefox OS\n            ], [VERSION, [NAME, FIREFOX+' OS']], [\n            /web0s;.+rt(tv)/i,\n            /\\b(?:hp)?wos(?:browser)?\\/([\\w\\.]+)/i                              // WebOS\n            ], [VERSION, [NAME, 'webOS']], [\n\n            // Google Chromecast\n            /crkey\\/([\\d\\.]+)/i                                                 // Google Chromecast\n            ], [VERSION, [NAME, CHROME+'cast']], [\n            /(cros) [\\w]+ ([\\w\\.]+\\w)/i                                         // Chromium OS\n            ], [[NAME, 'Chromium OS'], VERSION],[\n\n            // Console\n            /(nintendo|playstation) ([wids345portablevuch]+)/i,                 // Nintendo/Playstation\n            /(xbox); +xbox ([^\\);]+)/i,                                         // Microsoft Xbox (360, One, X, S, Series X, Series S)\n\n            // Other\n            /\\b(joli|palm)\\b ?(?:os)?\\/?([\\w\\.]*)/i,                            // Joli/Palm\n            /(mint)[\\/\\(\\) ]?(\\w*)/i,                                           // Mint\n            /(mageia|vectorlinux)[; ]/i,                                        // Mageia/VectorLinux\n            /([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\\/ ]?(?!chrom|package)([-\\w\\.]*)/i,\n                                                                                // Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware/Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus/Raspbian/Plan9/Minix/RISCOS/Contiki/Deepin/Manjaro/elementary/Sabayon/Linspire\n            /(hurd|linux) ?([\\w\\.]*)/i,                                         // Hurd/Linux\n            /(gnu) ?([\\w\\.]*)/i,                                                // GNU\n            /\\b([-frentopcghs]{0,5}bsd|dragonfly)[\\/ ]?(?!amd|[ix346]{1,2}86)([\\w\\.]*)/i, // FreeBSD/NetBSD/OpenBSD/PC-BSD/GhostBSD/DragonFly\n            /(haiku) (\\w+)/i                                                    // Haiku\n            ], [NAME, VERSION], [\n            /(sunos) ?([\\w\\.\\d]*)/i                                             // Solaris\n            ], [[NAME, 'Solaris'], VERSION], [\n            /((?:open)?solaris)[-\\/ ]?([\\w\\.]*)/i,                              // Solaris\n            /(aix) ((\\d)(?=\\.|\\)| )[\\w\\.])*/i,                                  // AIX\n            /\\b(beos|os\\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,            // BeOS/OS2/AmigaOS/MorphOS/OpenVMS/Fuchsia/HP-UX\n            /(unix) ?([\\w\\.]*)/i                                                // UNIX\n            ], [NAME, VERSION]\n        ]\n    };\n\n    /////////////////\n    // Constructor\n    ////////////////\n\n    var UAParser = function (ua, extensions) {\n\n        if (typeof ua === OBJ_TYPE) {\n            extensions = ua;\n            ua = undefined;\n        }\n\n        if (!(this instanceof UAParser)) {\n            return new UAParser(ua, extensions).getResult();\n        }\n\n        var _ua = ua || ((typeof window !== UNDEF_TYPE && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY);\n        var _rgxmap = extensions ? extend(regexes, extensions) : regexes;\n\n        this.getBrowser = function () {\n            var _browser = {};\n            _browser[NAME] = undefined;\n            _browser[VERSION] = undefined;\n            rgxMapper.call(_browser, _ua, _rgxmap.browser);\n            _browser.major = majorize(_browser.version);\n            return _browser;\n        };\n        this.getCPU = function () {\n            var _cpu = {};\n            _cpu[ARCHITECTURE] = undefined;\n            rgxMapper.call(_cpu, _ua, _rgxmap.cpu);\n            return _cpu;\n        };\n        this.getDevice = function () {\n            var _device = {};\n            _device[VENDOR] = undefined;\n            _device[MODEL] = undefined;\n            _device[TYPE] = undefined;\n            rgxMapper.call(_device, _ua, _rgxmap.device);\n            return _device;\n        };\n        this.getEngine = function () {\n            var _engine = {};\n            _engine[NAME] = undefined;\n            _engine[VERSION] = undefined;\n            rgxMapper.call(_engine, _ua, _rgxmap.engine);\n            return _engine;\n        };\n        this.getOS = function () {\n            var _os = {};\n            _os[NAME] = undefined;\n            _os[VERSION] = undefined;\n            rgxMapper.call(_os, _ua, _rgxmap.os);\n            return _os;\n        };\n        this.getResult = function () {\n            return {\n                ua      : this.getUA(),\n                browser : this.getBrowser(),\n                engine  : this.getEngine(),\n                os      : this.getOS(),\n                device  : this.getDevice(),\n                cpu     : this.getCPU()\n            };\n        };\n        this.getUA = function () {\n            return _ua;\n        };\n        this.setUA = function (ua) {\n            _ua = (typeof ua === STR_TYPE && ua.length > UA_MAX_LENGTH) ? trim(ua, UA_MAX_LENGTH) : ua;\n            return this;\n        };\n        this.setUA(_ua);\n        return this;\n    };\n\n    UAParser.VERSION = LIBVERSION;\n    UAParser.BROWSER =  enumerize([NAME, VERSION, MAJOR]);\n    UAParser.CPU = enumerize([ARCHITECTURE]);\n    UAParser.DEVICE = enumerize([MODEL, VENDOR, TYPE, CONSOLE, MOBILE, SMARTTV, TABLET, WEARABLE, EMBEDDED]);\n    UAParser.ENGINE = UAParser.OS = enumerize([NAME, VERSION]);\n\n    ///////////\n    // Export\n    //////////\n\n    // check js environment\n    if (typeof(exports) !== UNDEF_TYPE) {\n        // nodejs env\n        if (typeof module !== UNDEF_TYPE && module.exports) {\n            exports = module.exports = UAParser;\n        }\n        exports.UAParser = UAParser;\n    } else {\n        // requirejs env (optional)\n        if (typeof(define) === FUNC_TYPE && define.amd) {\n            define(function () {\n                return UAParser;\n            });\n        } else if (typeof window !== UNDEF_TYPE) {\n            // browser env\n            window.UAParser = UAParser;\n        }\n    }\n\n    // jQuery/Zepto specific (optional)\n    // Note:\n    //   In AMD env the global scope should be kept clean, but jQuery is an exception.\n    //   jQuery always exports to global scope, unless jQuery.noConflict(true) is used,\n    //   and we should catch that.\n    var $ = typeof window !== UNDEF_TYPE && (window.jQuery || window.Zepto);\n    if ($ && !$.ua) {\n        var parser = new UAParser();\n        $.ua = parser.getResult();\n        $.ua.get = function () {\n            return parser.getUA();\n        };\n        $.ua.set = function (ua) {\n            parser.setUA(ua);\n            var result = parser.getResult();\n            for (var prop in result) {\n                $.ua[prop] = result[prop];\n            }\n        };\n    }\n\n})(typeof window === 'object' ? window : this);\n", "/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n/**\n * Usage note:\n * This module makes a best effort to export the same data we would internally.\n * At Facebook we use a server-generated module that does the parsing and\n * exports the data for the client to use. We can't rely on a server-side\n * implementation in open source so instead we make use of an open source\n * library to do the heavy lifting and then make some adjustments as necessary.\n * It's likely there will be some differences. Some we can smooth over.\n * Others are going to be harder.\n */\n'use strict';\n\nvar UAParser = require(\"ua-parser-js\");\n\nvar UNKNOWN = 'Unknown';\nvar PLATFORM_MAP = {\n  'Mac OS': 'Mac OS X'\n};\n/**\n * Convert from UAParser platform name to what we expect.\n */\n\nfunction convertPlatformName(name) {\n  return PLATFORM_MAP[name] || name;\n}\n/**\n * Get the version number in parts. This is very naive. We actually get major\n * version as a part of UAParser already, which is generally good enough, but\n * let's get the minor just in case.\n */\n\n\nfunction getBrowserVersion(version) {\n  if (!version) {\n    return {\n      major: '',\n      minor: ''\n    };\n  }\n\n  var parts = version.split('.');\n  return {\n    major: parts[0],\n    minor: parts[1]\n  };\n}\n/**\n * Get the UA data fom UAParser and then convert it to the format we're\n * expecting for our APIS.\n */\n\n\nvar parser = new UAParser();\nvar results = parser.getResult(); // Do some conversion first.\n\nvar browserVersionData = getBrowserVersion(results.browser.version);\nvar uaData = {\n  browserArchitecture: results.cpu.architecture || UNKNOWN,\n  browserFullVersion: results.browser.version || UNKNOWN,\n  browserMinorVersion: browserVersionData.minor || UNKNOWN,\n  browserName: results.browser.name || UNKNOWN,\n  browserVersion: results.browser.major || UNKNOWN,\n  deviceName: results.device.model || UNKNOWN,\n  engineName: results.engine.name || UNKNOWN,\n  engineVersion: results.engine.version || UNKNOWN,\n  platformArchitecture: results.cpu.architecture || UNKNOWN,\n  platformName: convertPlatformName(results.os.name) || UNKNOWN,\n  platformVersion: results.os.version || UNKNOWN,\n  platformFullVersion: results.os.version || UNKNOWN\n};\nmodule.exports = uaData;", "/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n'use strict';\n\nvar invariant = require(\"./invariant\");\n\nvar componentRegex = /\\./;\nvar orRegex = /\\|\\|/;\nvar rangeRegex = /\\s+\\-\\s+/;\nvar modifierRegex = /^(<=|<|=|>=|~>|~|>|)?\\s*(.+)/;\nvar numericRegex = /^(\\d*)(.*)/;\n/**\n * Splits input `range` on \"||\" and returns true if any subrange matches\n * `version`.\n *\n * @param {string} range\n * @param {string} version\n * @returns {boolean}\n */\n\nfunction checkOrExpression(range, version) {\n  var expressions = range.split(orRegex);\n\n  if (expressions.length > 1) {\n    return expressions.some(function (range) {\n      return VersionRange.contains(range, version);\n    });\n  } else {\n    range = expressions[0].trim();\n    return checkRangeExpression(range, version);\n  }\n}\n/**\n * Splits input `range` on \" - \" (the surrounding whitespace is required) and\n * returns true if version falls between the two operands.\n *\n * @param {string} range\n * @param {string} version\n * @returns {boolean}\n */\n\n\nfunction checkRangeExpression(range, version) {\n  var expressions = range.split(rangeRegex);\n  !(expressions.length > 0 && expressions.length <= 2) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'the \"-\" operator expects exactly 2 operands') : invariant(false) : void 0;\n\n  if (expressions.length === 1) {\n    return checkSimpleExpression(expressions[0], version);\n  } else {\n    var startVersion = expressions[0],\n        endVersion = expressions[1];\n    !(isSimpleVersion(startVersion) && isSimpleVersion(endVersion)) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'operands to the \"-\" operator must be simple (no modifiers)') : invariant(false) : void 0;\n    return checkSimpleExpression('>=' + startVersion, version) && checkSimpleExpression('<=' + endVersion, version);\n  }\n}\n/**\n * Checks if `range` matches `version`. `range` should be a \"simple\" range (ie.\n * not a compound range using the \" - \" or \"||\" operators).\n *\n * @param {string} range\n * @param {string} version\n * @returns {boolean}\n */\n\n\nfunction checkSimpleExpression(range, version) {\n  range = range.trim();\n\n  if (range === '') {\n    return true;\n  }\n\n  var versionComponents = version.split(componentRegex);\n\n  var _getModifierAndCompon = getModifierAndComponents(range),\n      modifier = _getModifierAndCompon.modifier,\n      rangeComponents = _getModifierAndCompon.rangeComponents;\n\n  switch (modifier) {\n    case '<':\n      return checkLessThan(versionComponents, rangeComponents);\n\n    case '<=':\n      return checkLessThanOrEqual(versionComponents, rangeComponents);\n\n    case '>=':\n      return checkGreaterThanOrEqual(versionComponents, rangeComponents);\n\n    case '>':\n      return checkGreaterThan(versionComponents, rangeComponents);\n\n    case '~':\n    case '~>':\n      return checkApproximateVersion(versionComponents, rangeComponents);\n\n    default:\n      return checkEqual(versionComponents, rangeComponents);\n  }\n}\n/**\n * Checks whether `a` is less than `b`.\n *\n * @param {array<string>} a\n * @param {array<string>} b\n * @returns {boolean}\n */\n\n\nfunction checkLessThan(a, b) {\n  return compareComponents(a, b) === -1;\n}\n/**\n * Checks whether `a` is less than or equal to `b`.\n *\n * @param {array<string>} a\n * @param {array<string>} b\n * @returns {boolean}\n */\n\n\nfunction checkLessThanOrEqual(a, b) {\n  var result = compareComponents(a, b);\n  return result === -1 || result === 0;\n}\n/**\n * Checks whether `a` is equal to `b`.\n *\n * @param {array<string>} a\n * @param {array<string>} b\n * @returns {boolean}\n */\n\n\nfunction checkEqual(a, b) {\n  return compareComponents(a, b) === 0;\n}\n/**\n * Checks whether `a` is greater than or equal to `b`.\n *\n * @param {array<string>} a\n * @param {array<string>} b\n * @returns {boolean}\n */\n\n\nfunction checkGreaterThanOrEqual(a, b) {\n  var result = compareComponents(a, b);\n  return result === 1 || result === 0;\n}\n/**\n * Checks whether `a` is greater than `b`.\n *\n * @param {array<string>} a\n * @param {array<string>} b\n * @returns {boolean}\n */\n\n\nfunction checkGreaterThan(a, b) {\n  return compareComponents(a, b) === 1;\n}\n/**\n * Checks whether `a` is \"reasonably close\" to `b` (as described in\n * https://www.npmjs.org/doc/misc/semver.html). For example, if `b` is \"1.3.1\"\n * then \"reasonably close\" is defined as \">= 1.3.1 and < 1.4\".\n *\n * @param {array<string>} a\n * @param {array<string>} b\n * @returns {boolean}\n */\n\n\nfunction checkApproximateVersion(a, b) {\n  var lowerBound = b.slice();\n  var upperBound = b.slice();\n\n  if (upperBound.length > 1) {\n    upperBound.pop();\n  }\n\n  var lastIndex = upperBound.length - 1;\n  var numeric = parseInt(upperBound[lastIndex], 10);\n\n  if (isNumber(numeric)) {\n    upperBound[lastIndex] = numeric + 1 + '';\n  }\n\n  return checkGreaterThanOrEqual(a, lowerBound) && checkLessThan(a, upperBound);\n}\n/**\n * Extracts the optional modifier (<, <=, =, >=, >, ~, ~>) and version\n * components from `range`.\n *\n * For example, given `range` \">= 1.2.3\" returns an object with a `modifier` of\n * `\">=\"` and `components` of `[1, 2, 3]`.\n *\n * @param {string} range\n * @returns {object}\n */\n\n\nfunction getModifierAndComponents(range) {\n  var rangeComponents = range.split(componentRegex);\n  var matches = rangeComponents[0].match(modifierRegex);\n  !matches ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'expected regex to match but it did not') : invariant(false) : void 0;\n  return {\n    modifier: matches[1],\n    rangeComponents: [matches[2]].concat(rangeComponents.slice(1))\n  };\n}\n/**\n * Determines if `number` is a number.\n *\n * @param {mixed} number\n * @returns {boolean}\n */\n\n\nfunction isNumber(number) {\n  return !isNaN(number) && isFinite(number);\n}\n/**\n * Tests whether `range` is a \"simple\" version number without any modifiers\n * (\">\", \"~\" etc).\n *\n * @param {string} range\n * @returns {boolean}\n */\n\n\nfunction isSimpleVersion(range) {\n  return !getModifierAndComponents(range).modifier;\n}\n/**\n * Zero-pads array `array` until it is at least `length` long.\n *\n * @param {array} array\n * @param {number} length\n */\n\n\nfunction zeroPad(array, length) {\n  for (var i = array.length; i < length; i++) {\n    array[i] = '0';\n  }\n}\n/**\n * Normalizes `a` and `b` in preparation for comparison by doing the following:\n *\n * - zero-pads `a` and `b`\n * - marks any \"x\", \"X\" or \"*\" component in `b` as equivalent by zero-ing it out\n *   in both `a` and `b`\n * - marks any final \"*\" component in `b` as a greedy wildcard by zero-ing it\n *   and all of its successors in `a`\n *\n * @param {array<string>} a\n * @param {array<string>} b\n * @returns {array<array<string>>}\n */\n\n\nfunction normalizeVersions(a, b) {\n  a = a.slice();\n  b = b.slice();\n  zeroPad(a, b.length); // mark \"x\" and \"*\" components as equal\n\n  for (var i = 0; i < b.length; i++) {\n    var matches = b[i].match(/^[x*]$/i);\n\n    if (matches) {\n      b[i] = a[i] = '0'; // final \"*\" greedily zeros all remaining components\n\n      if (matches[0] === '*' && i === b.length - 1) {\n        for (var j = i; j < a.length; j++) {\n          a[j] = '0';\n        }\n      }\n    }\n  }\n\n  zeroPad(b, a.length);\n  return [a, b];\n}\n/**\n * Returns the numerical -- not the lexicographical -- ordering of `a` and `b`.\n *\n * For example, `10-alpha` is greater than `2-beta`.\n *\n * @param {string} a\n * @param {string} b\n * @returns {number} -1, 0 or 1 to indicate whether `a` is less than, equal to,\n * or greater than `b`, respectively\n */\n\n\nfunction compareNumeric(a, b) {\n  var aPrefix = a.match(numericRegex)[1];\n  var bPrefix = b.match(numericRegex)[1];\n  var aNumeric = parseInt(aPrefix, 10);\n  var bNumeric = parseInt(bPrefix, 10);\n\n  if (isNumber(aNumeric) && isNumber(bNumeric) && aNumeric !== bNumeric) {\n    return compare(aNumeric, bNumeric);\n  } else {\n    return compare(a, b);\n  }\n}\n/**\n * Returns the ordering of `a` and `b`.\n *\n * @param {string|number} a\n * @param {string|number} b\n * @returns {number} -1, 0 or 1 to indicate whether `a` is less than, equal to,\n * or greater than `b`, respectively\n */\n\n\nfunction compare(a, b) {\n  !(typeof a === typeof b) ? process.env.NODE_ENV !== \"production\" ? invariant(false, '\"a\" and \"b\" must be of the same type') : invariant(false) : void 0;\n\n  if (a > b) {\n    return 1;\n  } else if (a < b) {\n    return -1;\n  } else {\n    return 0;\n  }\n}\n/**\n * Compares arrays of version components.\n *\n * @param {array<string>} a\n * @param {array<string>} b\n * @returns {number} -1, 0 or 1 to indicate whether `a` is less than, equal to,\n * or greater than `b`, respectively\n */\n\n\nfunction compareComponents(a, b) {\n  var _normalizeVersions = normalizeVersions(a, b),\n      aNormalized = _normalizeVersions[0],\n      bNormalized = _normalizeVersions[1];\n\n  for (var i = 0; i < bNormalized.length; i++) {\n    var result = compareNumeric(aNormalized[i], bNormalized[i]);\n\n    if (result) {\n      return result;\n    }\n  }\n\n  return 0;\n}\n\nvar VersionRange = {\n  /**\n   * Checks whether `version` satisfies the `range` specification.\n   *\n   * We support a subset of the expressions defined in\n   * https://www.npmjs.org/doc/misc/semver.html:\n   *\n   *    version   Must match version exactly\n   *    =version  Same as just version\n   *    >version  Must be greater than version\n   *    >=version Must be greater than or equal to version\n   *    <version  Must be less than version\n   *    <=version Must be less than or equal to version\n   *    ~version  Must be at least version, but less than the next significant\n   *              revision above version:\n   *              \"~1.2.3\" is equivalent to \">= 1.2.3 and < 1.3\"\n   *    ~>version Equivalent to ~version\n   *    1.2.x     Must match \"1.2.x\", where \"x\" is a wildcard that matches\n   *              anything\n   *    1.2.*     Similar to \"1.2.x\", but \"*\" in the trailing position is a\n   *              \"greedy\" wildcard, so will match any number of additional\n   *              components:\n   *              \"1.2.*\" will match \"1.2.1\", \"1.2.1.1\", \"1.2.1.1.1\" etc\n   *    *         Any version\n   *    \"\"        (Empty string) Same as *\n   *    v1 - v2   Equivalent to \">= v1 and <= v2\"\n   *    r1 || r2  Passes if either r1 or r2 are satisfied\n   *\n   * @param {string} range\n   * @param {string} version\n   * @returns {boolean}\n   */\n  contains: function contains(range, version) {\n    return checkOrExpression(range.trim(), version.trim());\n  }\n};\nmodule.exports = VersionRange;", "/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n'use strict';\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n/**\n * Executes the provided `callback` once for each enumerable own property in the\n * object and constructs a new object from the results. The `callback` is\n * invoked with three arguments:\n *\n *  - the property value\n *  - the property name\n *  - the object being traversed\n *\n * Properties that are added after the call to `mapObject` will not be visited\n * by `callback`. If the values of existing properties are changed, the value\n * passed to `callback` will be the value at the time `mapObject` visits them.\n * Properties that are deleted before being visited are not visited.\n *\n * @grep function objectMap()\n * @grep function objMap()\n *\n * @param {?object} object\n * @param {function} callback\n * @param {*} context\n * @return {?object}\n */\n\nfunction mapObject(object, callback, context) {\n  if (!object) {\n    return null;\n  }\n\n  var result = {};\n\n  for (var name in object) {\n    if (hasOwnProperty.call(object, name)) {\n      result[name] = callback.call(context, object[name], name, object);\n    }\n  }\n\n  return result;\n}\n\nmodule.exports = mapObject;", "/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n * @typechecks static-only\n */\n'use strict';\n/**\n * Memoizes the return value of a function that accepts one string argument.\n */\n\nfunction memoizeStringOnly(callback) {\n  var cache = {};\n  return function (string) {\n    if (!cache.hasOwnProperty(string)) {\n      cache[string] = callback.call(this, string);\n    }\n\n    return cache[string];\n  };\n}\n\nmodule.exports = memoizeStringOnly;", "/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n'use strict';\n\nvar UserAgentData = require(\"./UserAgentData\");\n\nvar VersionRange = require(\"./VersionRange\");\n\nvar mapObject = require(\"./mapObject\");\n\nvar memoizeStringOnly = require(\"./memoizeStringOnly\");\n/**\n * Checks to see whether `name` and `version` satisfy `query`.\n *\n * @param {string} name Name of the browser, device, engine or platform\n * @param {?string} version Version of the browser, engine or platform\n * @param {string} query Query of form \"Name [range expression]\"\n * @param {?function} normalizer Optional pre-processor for range expression\n * @return {boolean}\n */\n\n\nfunction compare(name, version, query, normalizer) {\n  // check for exact match with no version\n  if (name === query) {\n    return true;\n  } // check for non-matching names\n\n\n  if (!query.startsWith(name)) {\n    return false;\n  } // full comparison with version\n\n\n  var range = query.slice(name.length);\n\n  if (version) {\n    range = normalizer ? normalizer(range) : range;\n    return VersionRange.contains(range, version);\n  }\n\n  return false;\n}\n/**\n * Normalizes `version` by stripping any \"NT\" prefix, but only on the Windows\n * platform.\n *\n * Mimics the stripping performed by the `UserAgentWindowsPlatform` PHP class.\n *\n * @param {string} version\n * @return {string}\n */\n\n\nfunction normalizePlatformVersion(version) {\n  if (UserAgentData.platformName === 'Windows') {\n    return version.replace(/^\\s*NT/, '');\n  }\n\n  return version;\n}\n/**\n * Provides client-side access to the authoritative PHP-generated User Agent\n * information supplied by the server.\n */\n\n\nvar UserAgent = {\n  /**\n   * Check if the User Agent browser matches `query`.\n   *\n   * `query` should be a string like \"Chrome\" or \"Chrome > 33\".\n   *\n   * Valid browser names include:\n   *\n   * - ACCESS NetFront\n   * - AOL\n   * - Amazon Silk\n   * - Android\n   * - BlackBerry\n   * - BlackBerry PlayBook\n   * - Chrome\n   * - Chrome for iOS\n   * - Chrome frame\n   * - Facebook PHP SDK\n   * - Facebook for iOS\n   * - Firefox\n   * - IE\n   * - IE Mobile\n   * - Mobile Safari\n   * - Motorola Internet Browser\n   * - Nokia\n   * - Openwave Mobile Browser\n   * - Opera\n   * - Opera Mini\n   * - Opera Mobile\n   * - Safari\n   * - UIWebView\n   * - Unknown\n   * - webOS\n   * - etc...\n   *\n   * An authoritative list can be found in the PHP `BrowserDetector` class and\n   * related classes in the same file (see calls to `new UserAgentBrowser` here:\n   * https://fburl.com/50728104).\n   *\n   * @note Function results are memoized\n   *\n   * @param {string} query Query of the form \"Name [range expression]\"\n   * @return {boolean}\n   */\n  isBrowser: function isBrowser(query) {\n    return compare(UserAgentData.browserName, UserAgentData.browserFullVersion, query);\n  },\n\n  /**\n   * Check if the User Agent browser uses a 32 or 64 bit architecture.\n   *\n   * @note Function results are memoized\n   *\n   * @param {string} query Query of the form \"32\" or \"64\".\n   * @return {boolean}\n   */\n  isBrowserArchitecture: function isBrowserArchitecture(query) {\n    return compare(UserAgentData.browserArchitecture, null, query);\n  },\n\n  /**\n   * Check if the User Agent device matches `query`.\n   *\n   * `query` should be a string like \"iPhone\" or \"iPad\".\n   *\n   * Valid device names include:\n   *\n   * - Kindle\n   * - Kindle Fire\n   * - Unknown\n   * - iPad\n   * - iPhone\n   * - iPod\n   * - etc...\n   *\n   * An authoritative list can be found in the PHP `DeviceDetector` class and\n   * related classes in the same file (see calls to `new UserAgentDevice` here:\n   * https://fburl.com/50728332).\n   *\n   * @note Function results are memoized\n   *\n   * @param {string} query Query of the form \"Name\"\n   * @return {boolean}\n   */\n  isDevice: function isDevice(query) {\n    return compare(UserAgentData.deviceName, null, query);\n  },\n\n  /**\n   * Check if the User Agent rendering engine matches `query`.\n   *\n   * `query` should be a string like \"WebKit\" or \"WebKit >= 537\".\n   *\n   * Valid engine names include:\n   *\n   * - Gecko\n   * - Presto\n   * - Trident\n   * - WebKit\n   * - etc...\n   *\n   * An authoritative list can be found in the PHP `RenderingEngineDetector`\n   * class related classes in the same file (see calls to `new\n   * UserAgentRenderingEngine` here: https://fburl.com/50728617).\n   *\n   * @note Function results are memoized\n   *\n   * @param {string} query Query of the form \"Name [range expression]\"\n   * @return {boolean}\n   */\n  isEngine: function isEngine(query) {\n    return compare(UserAgentData.engineName, UserAgentData.engineVersion, query);\n  },\n\n  /**\n   * Check if the User Agent platform matches `query`.\n   *\n   * `query` should be a string like \"Windows\" or \"iOS 5 - 6\".\n   *\n   * Valid platform names include:\n   *\n   * - Android\n   * - BlackBerry OS\n   * - Java ME\n   * - Linux\n   * - Mac OS X\n   * - Mac OS X Calendar\n   * - Mac OS X Internet Account\n   * - Symbian\n   * - SymbianOS\n   * - Windows\n   * - Windows Mobile\n   * - Windows Phone\n   * - iOS\n   * - iOS Facebook Integration Account\n   * - iOS Facebook Social Sharing UI\n   * - webOS\n   * - Chrome OS\n   * - etc...\n   *\n   * An authoritative list can be found in the PHP `PlatformDetector` class and\n   * related classes in the same file (see calls to `new UserAgentPlatform`\n   * here: https://fburl.com/50729226).\n   *\n   * @note Function results are memoized\n   *\n   * @param {string} query Query of the form \"Name [range expression]\"\n   * @return {boolean}\n   */\n  isPlatform: function isPlatform(query) {\n    return compare(UserAgentData.platformName, UserAgentData.platformFullVersion, query, normalizePlatformVersion);\n  },\n\n  /**\n   * Check if the User Agent platform is a 32 or 64 bit architecture.\n   *\n   * @note Function results are memoized\n   *\n   * @param {string} query Query of the form \"32\" or \"64\".\n   * @return {boolean}\n   */\n  isPlatformArchitecture: function isPlatformArchitecture(query) {\n    return compare(UserAgentData.platformArchitecture, null, query);\n  }\n};\nmodule.exports = mapObject(UserAgent, memoizeStringOnly);", "\"use strict\";\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\nfunction getCorrectDocumentFromNode(node) {\n  if (!node || !node.ownerDocument) {\n    return document;\n  }\n\n  return node.ownerDocument;\n}\n\nmodule.exports = getCorrectDocumentFromNode;", "\"use strict\";\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\nfunction isElement(node) {\n  if (!node || !node.ownerDocument) {\n    return false;\n  }\n\n  return node.nodeType === Node.ELEMENT_NODE;\n}\n\nmodule.exports = isElement;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n/**\n * Get offset key from a node or it's child nodes. Return the first offset key\n * found on the DOM tree of given node.\n */\n\nvar isElement = require(\"./isElement\");\n\nfunction getSelectionOffsetKeyForNode(node) {\n  if (isElement(node)) {\n    var castedNode = node;\n    var offsetKey = castedNode.getAttribute('data-offset-key');\n\n    if (offsetKey) {\n      return offsetKey;\n    }\n\n    for (var ii = 0; ii < castedNode.childNodes.length; ii++) {\n      var childOffsetKey = getSelectionOffsetKeyForNode(castedNode.childNodes[ii]);\n\n      if (childOffsetKey) {\n        return childOffsetKey;\n      }\n    }\n  }\n\n  return null;\n}\n\nmodule.exports = getSelectionOffsetKeyForNode;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar getCorrectDocumentFromNode = require(\"./getCorrectDocumentFromNode\");\n\nvar getSelectionOffsetKeyForNode = require(\"./getSelectionOffsetKeyForNode\");\n/**\n * Get the key from the node's nearest offset-aware ancestor.\n */\n\n\nfunction findAncestorOffsetKey(node) {\n  var searchNode = node;\n\n  while (searchNode && searchNode !== getCorrectDocumentFromNode(node).documentElement) {\n    var key = getSelectionOffsetKeyForNode(searchNode);\n\n    if (key != null) {\n      return key;\n    }\n\n    searchNode = searchNode.parentNode;\n  }\n\n  return null;\n}\n\nmodule.exports = findAncestorOffsetKey;", "\"use strict\";\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\nfunction getWindowForNode(node) {\n  if (!node || !node.ownerDocument || !node.ownerDocument.defaultView) {\n    return window;\n  }\n\n  return node.ownerDocument.defaultView;\n}\n\nmodule.exports = getWindowForNode;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar UserAgent = require(\"fbjs/lib/UserAgent\");\n\nvar findAncestorOffsetKey = require(\"./findAncestorOffsetKey\");\n\nvar getWindowForNode = require(\"./getWindowForNode\");\n\nvar Immutable = require(\"immutable\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar nullthrows = require(\"fbjs/lib/nullthrows\");\n\nvar Map = Immutable.Map;\n// Heavily based on Prosemirror's DOMObserver https://github.com/ProseMirror/prosemirror-view/blob/master/src/domobserver.js\nvar DOM_OBSERVER_OPTIONS = {\n  subtree: true,\n  characterData: true,\n  childList: true,\n  characterDataOldValue: false,\n  attributes: false\n}; // IE11 has very broken mutation observers, so we also listen to DOMCharacterDataModified\n\nvar USE_CHAR_DATA = UserAgent.isBrowser('IE <= 11');\n\nvar DOMObserver =\n/*#__PURE__*/\nfunction () {\n  function DOMObserver(container) {\n    var _this = this;\n\n    _defineProperty(this, \"observer\", void 0);\n\n    _defineProperty(this, \"container\", void 0);\n\n    _defineProperty(this, \"mutations\", void 0);\n\n    _defineProperty(this, \"onCharData\", void 0);\n\n    this.container = container;\n    this.mutations = Map();\n    var containerWindow = getWindowForNode(container);\n\n    if (containerWindow.MutationObserver && !USE_CHAR_DATA) {\n      this.observer = new containerWindow.MutationObserver(function (mutations) {\n        return _this.registerMutations(mutations);\n      });\n    } else {\n      this.onCharData = function (e) {\n        !(e.target instanceof Node) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Expected target to be an instance of Node') : invariant(false) : void 0;\n\n        _this.registerMutation({\n          type: 'characterData',\n          target: e.target\n        });\n      };\n    }\n  }\n\n  var _proto = DOMObserver.prototype;\n\n  _proto.start = function start() {\n    if (this.observer) {\n      this.observer.observe(this.container, DOM_OBSERVER_OPTIONS);\n    } else {\n      /* $FlowFixMe(>=0.68.0 site=www,mobile) This event type is not defined\n       * by Flow's standard library */\n      this.container.addEventListener('DOMCharacterDataModified', this.onCharData);\n    }\n  };\n\n  _proto.stopAndFlushMutations = function stopAndFlushMutations() {\n    var observer = this.observer;\n\n    if (observer) {\n      this.registerMutations(observer.takeRecords());\n      observer.disconnect();\n    } else {\n      /* $FlowFixMe(>=0.68.0 site=www,mobile) This event type is not defined\n       * by Flow's standard library */\n      this.container.removeEventListener('DOMCharacterDataModified', this.onCharData);\n    }\n\n    var mutations = this.mutations;\n    this.mutations = Map();\n    return mutations;\n  };\n\n  _proto.registerMutations = function registerMutations(mutations) {\n    for (var i = 0; i < mutations.length; i++) {\n      this.registerMutation(mutations[i]);\n    }\n  };\n\n  _proto.getMutationTextContent = function getMutationTextContent(mutation) {\n    var type = mutation.type,\n        target = mutation.target,\n        removedNodes = mutation.removedNodes;\n\n    if (type === 'characterData') {\n      // When `textContent` is '', there is a race condition that makes\n      // getting the offsetKey from the target not possible.\n      // These events are also followed by a `childList`, which is the one\n      // we are able to retrieve the offsetKey and apply the '' text.\n      if (target.textContent !== '') {\n        return target.textContent;\n      }\n    } else if (type === 'childList') {\n      // `characterData` events won't happen or are ignored when\n      // removing the last character of a leaf node, what happens\n      // instead is a `childList` event with a `removedNodes` array.\n      // For this case the textContent should be '' and\n      // `DraftModifier.replaceText` will make sure the content is\n      // updated properly.\n      if (removedNodes && removedNodes.length) {\n        return '';\n      }\n    }\n\n    return null;\n  };\n\n  _proto.registerMutation = function registerMutation(mutation) {\n    var textContent = this.getMutationTextContent(mutation);\n\n    if (textContent != null) {\n      var offsetKey = nullthrows(findAncestorOffsetKey(mutation.target));\n      this.mutations = this.mutations.set(offsetKey, textContent);\n    }\n  };\n\n  return DOMObserver;\n}();\n\nmodule.exports = DOMObserver;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar KEY_DELIMITER = '-';\nvar DraftOffsetKey = {\n  encode: function encode(blockKey, decoratorKey, leafKey) {\n    return blockKey + KEY_DELIMITER + decoratorKey + KEY_DELIMITER + leafKey;\n  },\n  decode: function decode(offsetKey) {\n    // Extracts the last two parts of offsetKey and captures the rest in blockKeyParts\n    var _offsetKey$split$reve = offsetKey.split(KEY_DELIMITER).reverse(),\n        leafKey = _offsetKey$split$reve[0],\n        decoratorKey = _offsetKey$split$reve[1],\n        blockKeyParts = _offsetKey$split$reve.slice(2);\n\n    return {\n      // Recomposes the parts of blockKey after reversing them\n      blockKey: blockKeyParts.reverse().join(KEY_DELIMITER),\n      decoratorKey: parseInt(decoratorKey, 10),\n      leafKey: parseInt(leafKey, 10)\n    };\n  }\n};\nmodule.exports = DraftOffsetKey;", "\"use strict\";\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\nmodule.exports = {\n  BACKSPACE: 8,\n  TAB: 9,\n  RETURN: 13,\n  ALT: 18,\n  ESC: 27,\n  SPACE: 32,\n  PAGE_UP: 33,\n  PAGE_DOWN: 34,\n  END: 35,\n  HOME: 36,\n  LEFT: 37,\n  UP: 38,\n  RIGHT: 39,\n  DOWN: 40,\n  DELETE: 46,\n  COMMA: 188,\n  PERIOD: 190,\n  A: 65,\n  Z: 90,\n  ZERO: 48,\n  NUMPAD_0: 96,\n  NUMPAD_9: 105\n};", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n'use strict';\n\nmodule.exports = {\n  logBlockedSelectionEvent: function logBlockedSelectionEvent() {\n    return null;\n  },\n  logSelectionStateFailure: function logSelectionStateFailure() {\n    return null;\n  }\n};", "\"use strict\";\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\nfunction isHTMLElement(node) {\n  if (!node || !node.ownerDocument) {\n    return false;\n  }\n\n  if (!node.ownerDocument.defaultView) {\n    return node instanceof HTMLElement;\n  }\n\n  if (node instanceof node.ownerDocument.defaultView.HTMLElement) {\n    return true;\n  }\n\n  return false;\n}\n\nmodule.exports = isHTMLElement;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar ReactDOM = require(\"react-dom\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar isHTMLElement = require(\"./isHTMLElement\");\n\nfunction getContentEditableContainer(editor) {\n  var editorNode = ReactDOM.findDOMNode(editor.editorContainer);\n  !editorNode ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Missing editorNode') : invariant(false) : void 0;\n  !isHTMLElement(editorNode.firstChild) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'editorNode.firstChild is not an HTMLElement') : invariant(false) : void 0;\n  var htmlElement = editorNode.firstChild;\n  return htmlElement;\n}\n\nmodule.exports = getContentEditableContainer;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar DraftOffsetKey = require(\"./DraftOffsetKey\");\n\nvar nullthrows = require(\"fbjs/lib/nullthrows\");\n\nfunction getUpdatedSelectionState(editorState, anchorKey, anchorOffset, focusKey, focusOffset) {\n  var selection = nullthrows(editorState.getSelection());\n\n  if (process.env.NODE_ENV !== \"production\") {\n    if (!anchorKey || !focusKey) {\n      /* eslint-disable-next-line */\n      console.warn('Invalid selection state.', arguments, editorState.toJS());\n      return selection;\n    }\n  }\n\n  var anchorPath = DraftOffsetKey.decode(anchorKey);\n  var anchorBlockKey = anchorPath.blockKey;\n  var anchorLeaf = editorState.getBlockTree(anchorBlockKey).getIn([anchorPath.decoratorKey, 'leaves', anchorPath.leafKey]);\n  var focusPath = DraftOffsetKey.decode(focusKey);\n  var focusBlockKey = focusPath.blockKey;\n  var focusLeaf = editorState.getBlockTree(focusBlockKey).getIn([focusPath.decoratorKey, 'leaves', focusPath.leafKey]);\n\n  if (!anchorLeaf || !focusLeaf) {\n    // If we cannot make sense of the updated selection state, stick to the current one.\n    if (process.env.NODE_ENV !== \"production\") {\n      /* eslint-disable-next-line */\n      console.warn('Invalid selection state.', arguments, editorState.toJS());\n    }\n\n    return selection;\n  }\n\n  var anchorLeafStart = anchorLeaf.get('start');\n  var focusLeafStart = focusLeaf.get('start');\n  var anchorBlockOffset = anchorLeaf ? anchorLeafStart + anchorOffset : null;\n  var focusBlockOffset = focusLeaf ? focusLeafStart + focusOffset : null;\n  var areEqual = selection.getAnchorKey() === anchorBlockKey && selection.getAnchorOffset() === anchorBlockOffset && selection.getFocusKey() === focusBlockKey && selection.getFocusOffset() === focusBlockOffset;\n\n  if (areEqual) {\n    return selection;\n  }\n\n  var isBackward = false;\n\n  if (anchorBlockKey === focusBlockKey) {\n    var anchorLeafEnd = anchorLeaf.get('end');\n    var focusLeafEnd = focusLeaf.get('end');\n\n    if (focusLeafStart === anchorLeafStart && focusLeafEnd === anchorLeafEnd) {\n      isBackward = focusOffset < anchorOffset;\n    } else {\n      isBackward = focusLeafStart < anchorLeafStart;\n    }\n  } else {\n    var startKey = editorState.getCurrentContent().getBlockMap().keySeq().skipUntil(function (v) {\n      return v === anchorBlockKey || v === focusBlockKey;\n    }).first();\n    isBackward = startKey === focusBlockKey;\n  }\n\n  return selection.merge({\n    anchorKey: anchorBlockKey,\n    anchorOffset: anchorBlockOffset,\n    focusKey: focusBlockKey,\n    focusOffset: focusBlockOffset,\n    isBackward: isBackward\n  });\n}\n\nmodule.exports = getUpdatedSelectionState;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar findAncestorOffsetKey = require(\"./findAncestorOffsetKey\");\n\nvar getSelectionOffsetKeyForNode = require(\"./getSelectionOffsetKeyForNode\");\n\nvar getUpdatedSelectionState = require(\"./getUpdatedSelectionState\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar isElement = require(\"./isElement\");\n\nvar nullthrows = require(\"fbjs/lib/nullthrows\");\n\n/**\n * Convert the current selection range to an anchor/focus pair of offset keys\n * and values that can be interpreted by components.\n */\nfunction getDraftEditorSelectionWithNodes(editorState, root, anchorNode, anchorOffset, focusNode, focusOffset) {\n  var anchorIsTextNode = anchorNode.nodeType === Node.TEXT_NODE;\n  var focusIsTextNode = focusNode.nodeType === Node.TEXT_NODE; // If the selection range lies only on text nodes, the task is simple.\n  // Find the nearest offset-aware elements and use the\n  // offset values supplied by the selection range.\n\n  if (anchorIsTextNode && focusIsTextNode) {\n    return {\n      selectionState: getUpdatedSelectionState(editorState, nullthrows(findAncestorOffsetKey(anchorNode)), anchorOffset, nullthrows(findAncestorOffsetKey(focusNode)), focusOffset),\n      needsRecovery: false\n    };\n  }\n\n  var anchorPoint = null;\n  var focusPoint = null;\n  var needsRecovery = true; // An element is selected. Convert this selection range into leaf offset\n  // keys and offset values for consumption at the component level. This\n  // is common in Firefox, where select-all and triple click behavior leads\n  // to entire elements being selected.\n  //\n  // Note that we use the `needsRecovery` parameter in the callback here. This\n  // is because when certain elements are selected, the behavior for subsequent\n  // cursor movement (e.g. via arrow keys) is uncertain and may not match\n  // expectations at the component level. For example, if an entire <div> is\n  // selected and the user presses the right arrow, Firefox keeps the selection\n  // on the <div>. If we allow subsequent keypresses to insert characters\n  // natively, they will be inserted into a browser-created text node to the\n  // right of that <div>. This is obviously undesirable.\n  //\n  // With the `needsRecovery` flag, we inform the caller that it is responsible\n  // for manually setting the selection state on the rendered document to\n  // ensure proper selection state maintenance.\n\n  if (anchorIsTextNode) {\n    anchorPoint = {\n      key: nullthrows(findAncestorOffsetKey(anchorNode)),\n      offset: anchorOffset\n    };\n    focusPoint = getPointForNonTextNode(root, focusNode, focusOffset);\n  } else if (focusIsTextNode) {\n    focusPoint = {\n      key: nullthrows(findAncestorOffsetKey(focusNode)),\n      offset: focusOffset\n    };\n    anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset);\n  } else {\n    anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset);\n    focusPoint = getPointForNonTextNode(root, focusNode, focusOffset); // If the selection is collapsed on an empty block, don't force recovery.\n    // This way, on arrow key selection changes, the browser can move the\n    // cursor from a non-zero offset on one block, through empty blocks,\n    // to a matching non-zero offset on other text blocks.\n\n    if (anchorNode === focusNode && anchorOffset === focusOffset) {\n      needsRecovery = !!anchorNode.firstChild && anchorNode.firstChild.nodeName !== 'BR';\n    }\n  }\n\n  return {\n    selectionState: getUpdatedSelectionState(editorState, anchorPoint.key, anchorPoint.offset, focusPoint.key, focusPoint.offset),\n    needsRecovery: needsRecovery\n  };\n}\n/**\n * Identify the first leaf descendant for the given node.\n */\n\n\nfunction getFirstLeaf(node) {\n  while (node.firstChild && ( // data-blocks has no offset\n  isElement(node.firstChild) && node.firstChild.getAttribute('data-blocks') === 'true' || getSelectionOffsetKeyForNode(node.firstChild))) {\n    node = node.firstChild;\n  }\n\n  return node;\n}\n/**\n * Identify the last leaf descendant for the given node.\n */\n\n\nfunction getLastLeaf(node) {\n  while (node.lastChild && ( // data-blocks has no offset\n  isElement(node.lastChild) && node.lastChild.getAttribute('data-blocks') === 'true' || getSelectionOffsetKeyForNode(node.lastChild))) {\n    node = node.lastChild;\n  }\n\n  return node;\n}\n\nfunction getPointForNonTextNode(editorRoot, startNode, childOffset) {\n  var node = startNode;\n  var offsetKey = findAncestorOffsetKey(node);\n  !(offsetKey != null || editorRoot && (editorRoot === node || editorRoot.firstChild === node)) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Unknown node in selection range.') : invariant(false) : void 0; // If the editorRoot is the selection, step downward into the content\n  // wrapper.\n\n  if (editorRoot === node) {\n    node = node.firstChild;\n    !isElement(node) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Invalid DraftEditorContents node.') : invariant(false) : void 0;\n    var castedNode = node; // assignment only added for flow :/\n    // otherwise it throws in line 200 saying that node can be null or undefined\n\n    node = castedNode;\n    !(node.getAttribute('data-contents') === 'true') ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Invalid DraftEditorContents structure.') : invariant(false) : void 0;\n\n    if (childOffset > 0) {\n      childOffset = node.childNodes.length;\n    }\n  } // If the child offset is zero and we have an offset key, we're done.\n  // If there's no offset key because the entire editor is selected,\n  // find the leftmost (\"first\") leaf in the tree and use that as the offset\n  // key.\n\n\n  if (childOffset === 0) {\n    var key = null;\n\n    if (offsetKey != null) {\n      key = offsetKey;\n    } else {\n      var firstLeaf = getFirstLeaf(node);\n      key = nullthrows(getSelectionOffsetKeyForNode(firstLeaf));\n    }\n\n    return {\n      key: key,\n      offset: 0\n    };\n  }\n\n  var nodeBeforeCursor = node.childNodes[childOffset - 1];\n  var leafKey = null;\n  var textLength = null;\n\n  if (!getSelectionOffsetKeyForNode(nodeBeforeCursor)) {\n    // Our target node may be a leaf or a text node, in which case we're\n    // already where we want to be and can just use the child's length as\n    // our offset.\n    leafKey = nullthrows(offsetKey);\n    textLength = getTextContentLength(nodeBeforeCursor);\n  } else {\n    // Otherwise, we'll look at the child to the left of the cursor and find\n    // the last leaf node in its subtree.\n    var lastLeaf = getLastLeaf(nodeBeforeCursor);\n    leafKey = nullthrows(getSelectionOffsetKeyForNode(lastLeaf));\n    textLength = getTextContentLength(lastLeaf);\n  }\n\n  return {\n    key: leafKey,\n    offset: textLength\n  };\n}\n/**\n * Return the length of a node's textContent, regarding single newline\n * characters as zero-length. This allows us to avoid problems with identifying\n * the correct selection offset for empty blocks in IE, in which we\n * render newlines instead of break tags.\n */\n\n\nfunction getTextContentLength(node) {\n  var textContent = node.textContent;\n  return textContent === '\\n' ? 0 : textContent.length;\n}\n\nmodule.exports = getDraftEditorSelectionWithNodes;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar getDraftEditorSelectionWithNodes = require(\"./getDraftEditorSelectionWithNodes\");\n/**\n * Convert the current selection range to an anchor/focus pair of offset keys\n * and values that can be interpreted by components.\n */\n\n\nfunction getDraftEditorSelection(editorState, root) {\n  var selection = root.ownerDocument.defaultView.getSelection(); // No active selection.\n\n  if (selection.rangeCount === 0) {\n    return {\n      selectionState: editorState.getSelection().set('hasFocus', false),\n      needsRecovery: false\n    };\n  }\n\n  return getDraftEditorSelectionWithNodes(editorState, root, selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);\n}\n\nmodule.exports = getDraftEditorSelection;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar DraftJsDebugLogging = require(\"./DraftJsDebugLogging\");\n\nvar EditorState = require(\"./EditorState\");\n\nvar getContentEditableContainer = require(\"./getContentEditableContainer\");\n\nvar getDraftEditorSelection = require(\"./getDraftEditorSelection\");\n\nfunction editOnSelect(editor) {\n  if (editor._blockSelectEvents || editor._latestEditorState !== editor.props.editorState) {\n    if (editor._blockSelectEvents) {\n      var _editorState = editor.props.editorState;\n\n      var selectionState = _editorState.getSelection();\n\n      DraftJsDebugLogging.logBlockedSelectionEvent({\n        // For now I don't think we need any other info\n        anonymizedDom: 'N/A',\n        extraParams: JSON.stringify({\n          stacktrace: new Error().stack\n        }),\n        selectionState: JSON.stringify(selectionState.toJS())\n      });\n    }\n\n    return;\n  }\n\n  var editorState = editor.props.editorState;\n  var documentSelection = getDraftEditorSelection(editorState, getContentEditableContainer(editor));\n  var updatedSelectionState = documentSelection.selectionState;\n\n  if (updatedSelectionState !== editorState.getSelection()) {\n    if (documentSelection.needsRecovery) {\n      editorState = EditorState.forceSelection(editorState, updatedSelectionState);\n    } else {\n      editorState = EditorState.acceptSelection(editorState, updatedSelectionState);\n    }\n\n    editor.update(editorState);\n  }\n}\n\nmodule.exports = editOnSelect;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\n/**\n * Return the entity key that should be used when inserting text for the\n * specified target selection, only if the entity is `MUTABLE`. `IMMUTABLE`\n * and `SEGMENTED` entities should not be used for insertion behavior.\n */\nfunction getEntityKeyForSelection(contentState, targetSelection) {\n  var entityKey;\n\n  if (targetSelection.isCollapsed()) {\n    var key = targetSelection.getAnchorKey();\n    var offset = targetSelection.getAnchorOffset();\n\n    if (offset > 0) {\n      entityKey = contentState.getBlockForKey(key).getEntityAt(offset - 1);\n\n      if (entityKey !== contentState.getBlockForKey(key).getEntityAt(offset)) {\n        return null;\n      }\n\n      return filterKey(contentState.getEntityMap(), entityKey);\n    }\n\n    return null;\n  }\n\n  var startKey = targetSelection.getStartKey();\n  var startOffset = targetSelection.getStartOffset();\n  var startBlock = contentState.getBlockForKey(startKey);\n  entityKey = startOffset === startBlock.getLength() ? null : startBlock.getEntityAt(startOffset);\n  return filterKey(contentState.getEntityMap(), entityKey);\n}\n/**\n * Determine whether an entity key corresponds to a `MUTABLE` entity. If so,\n * return it. If not, return null.\n */\n\n\nfunction filterKey(entityMap, entityKey) {\n  if (entityKey) {\n    var entity = entityMap.__get(entityKey);\n\n    return entity.getMutability() === 'MUTABLE' ? entityKey : null;\n  }\n\n  return null;\n}\n\nmodule.exports = getEntityKeyForSelection;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar DOMObserver = require(\"./DOMObserver\");\n\nvar DraftModifier = require(\"./DraftModifier\");\n\nvar DraftOffsetKey = require(\"./DraftOffsetKey\");\n\nvar EditorState = require(\"./EditorState\");\n\nvar Keys = require(\"fbjs/lib/Keys\");\n\nvar editOnSelect = require(\"./editOnSelect\");\n\nvar getContentEditableContainer = require(\"./getContentEditableContainer\");\n\nvar getDraftEditorSelection = require(\"./getDraftEditorSelection\");\n\nvar getEntityKeyForSelection = require(\"./getEntityKeyForSelection\");\n\nvar nullthrows = require(\"fbjs/lib/nullthrows\");\n/**\n * Millisecond delay to allow `compositionstart` to fire again upon\n * `compositionend`.\n *\n * This is used for Korean input to ensure that typing can continue without\n * the editor trying to render too quickly. More specifically, Safari 7.1+\n * triggers `compositionstart` a little slower than Chrome/FF, which\n * leads to composed characters being resolved and re-render occurring\n * sooner than we want.\n */\n\n\nvar RESOLVE_DELAY = 20;\n/**\n * A handful of variables used to track the current composition and its\n * resolution status. These exist at the module level because it is not\n * possible to have compositions occurring in multiple editors simultaneously,\n * and it simplifies state management with respect to the DraftEditor component.\n */\n\nvar resolved = false;\nvar stillComposing = false;\nvar domObserver = null;\n\nfunction startDOMObserver(editor) {\n  if (!domObserver) {\n    domObserver = new DOMObserver(getContentEditableContainer(editor));\n    domObserver.start();\n  }\n}\n\nvar DraftEditorCompositionHandler = {\n  /**\n   * A `compositionstart` event has fired while we're still in composition\n   * mode. Continue the current composition session to prevent a re-render.\n   */\n  onCompositionStart: function onCompositionStart(editor) {\n    stillComposing = true;\n    startDOMObserver(editor);\n  },\n\n  /**\n   * Attempt to end the current composition session.\n   *\n   * Defer handling because browser will still insert the chars into active\n   * element after `compositionend`. If a `compositionstart` event fires\n   * before `resolveComposition` executes, our composition session will\n   * continue.\n   *\n   * The `resolved` flag is useful because certain IME interfaces fire the\n   * `compositionend` event multiple times, thus queueing up multiple attempts\n   * at handling the composition. Since handling the same composition event\n   * twice could break the DOM, we only use the first event. Example: Arabic\n   * Google Input Tools on Windows 8.1 fires `compositionend` three times.\n   */\n  onCompositionEnd: function onCompositionEnd(editor) {\n    resolved = false;\n    stillComposing = false;\n    setTimeout(function () {\n      if (!resolved) {\n        DraftEditorCompositionHandler.resolveComposition(editor);\n      }\n    }, RESOLVE_DELAY);\n  },\n  onSelect: editOnSelect,\n\n  /**\n   * In Safari, keydown events may fire when committing compositions. If\n   * the arrow keys are used to commit, prevent default so that the cursor\n   * doesn't move, otherwise it will jump back noticeably on re-render.\n   */\n  onKeyDown: function onKeyDown(editor, e) {\n    if (!stillComposing) {\n      // If a keydown event is received after compositionend but before the\n      // 20ms timer expires (ex: type option-E then backspace, or type A then\n      // backspace in 2-Set Korean), we should immediately resolve the\n      // composition and reinterpret the key press in edit mode.\n      DraftEditorCompositionHandler.resolveComposition(editor);\n\n      editor._onKeyDown(e);\n\n      return;\n    }\n\n    if (e.which === Keys.RIGHT || e.which === Keys.LEFT) {\n      e.preventDefault();\n    }\n  },\n\n  /**\n   * Keypress events may fire when committing compositions. In Firefox,\n   * pressing RETURN commits the composition and inserts extra newline\n   * characters that we do not want. `preventDefault` allows the composition\n   * to be committed while preventing the extra characters.\n   */\n  onKeyPress: function onKeyPress(editor, e) {\n    if (e.which === Keys.RETURN) {\n      e.preventDefault();\n    }\n  },\n\n  /**\n   * Attempt to insert composed characters into the document.\n   *\n   * If we are still in a composition session, do nothing. Otherwise, insert\n   * the characters into the document and terminate the composition session.\n   *\n   * If no characters were composed -- for instance, the user\n   * deleted all composed characters and committed nothing new --\n   * force a re-render. We also re-render when the composition occurs\n   * at the beginning of a leaf, to ensure that if the browser has\n   * created a new text node for the composition, we will discard it.\n   *\n   * Resetting innerHTML will move focus to the beginning of the editor,\n   * so we update to force it back to the correct place.\n   */\n  resolveComposition: function resolveComposition(editor) {\n    if (stillComposing) {\n      return;\n    }\n\n    var mutations = nullthrows(domObserver).stopAndFlushMutations();\n    domObserver = null;\n    resolved = true;\n    var editorState = EditorState.set(editor._latestEditorState, {\n      inCompositionMode: false\n    });\n    editor.exitCurrentMode();\n\n    if (!mutations.size) {\n      editor.update(editorState);\n      return;\n    } // TODO, check if Facebook still needs this flag or if it could be removed.\n    // Since there can be multiple mutations providing a `composedChars` doesn't\n    // apply well on this new model.\n    // if (\n    //   gkx('draft_handlebeforeinput_composed_text') &&\n    //   editor.props.handleBeforeInput &&\n    //   isEventHandled(\n    //     editor.props.handleBeforeInput(\n    //       composedChars,\n    //       editorState,\n    //       event.timeStamp,\n    //     ),\n    //   )\n    // ) {\n    //   return;\n    // }\n\n\n    var contentState = editorState.getCurrentContent();\n    mutations.forEach(function (composedChars, offsetKey) {\n      var _DraftOffsetKey$decod = DraftOffsetKey.decode(offsetKey),\n          blockKey = _DraftOffsetKey$decod.blockKey,\n          decoratorKey = _DraftOffsetKey$decod.decoratorKey,\n          leafKey = _DraftOffsetKey$decod.leafKey;\n\n      var _editorState$getBlock = editorState.getBlockTree(blockKey).getIn([decoratorKey, 'leaves', leafKey]),\n          start = _editorState$getBlock.start,\n          end = _editorState$getBlock.end;\n\n      var replacementRange = editorState.getSelection().merge({\n        anchorKey: blockKey,\n        focusKey: blockKey,\n        anchorOffset: start,\n        focusOffset: end,\n        isBackward: false\n      });\n      var entityKey = getEntityKeyForSelection(contentState, replacementRange);\n      var currentStyle = contentState.getBlockForKey(blockKey).getInlineStyleAt(start);\n      contentState = DraftModifier.replaceText(contentState, replacementRange, composedChars, currentStyle, entityKey); // We need to update the editorState so the leaf node ranges are properly\n      // updated and multiple mutations are correctly applied.\n\n      editorState = EditorState.set(editorState, {\n        currentContent: contentState\n      });\n    }); // When we apply the text changes to the ContentState, the selection always\n    // goes to the end of the field, but it should just stay where it is\n    // after compositionEnd.\n\n    var documentSelection = getDraftEditorSelection(editorState, getContentEditableContainer(editor));\n    var compositionEndSelectionState = documentSelection.selectionState;\n    editor.restoreEditorDOM();\n    var editorStateWithUpdatedSelection = EditorState.acceptSelection(editorState, compositionEndSelectionState);\n    editor.update(EditorState.push(editorStateWithUpdatedSelection, contentState, 'insert-characters'));\n  }\n};\nmodule.exports = DraftEditorCompositionHandler;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n *\n * This is unstable and not part of the public API and should not be used by\n * production systems. This file may be update/removed without notice.\n */\n'use strict';\n\nvar _assign = require(\"object-assign\");\n\nfunction _extends() { _extends = _assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nvar DraftOffsetKey = require(\"./DraftOffsetKey\");\n\nvar React = require(\"react\");\n\nvar UnicodeBidi = require(\"fbjs/lib/UnicodeBidi\");\n\nvar UnicodeBidiDirection = require(\"fbjs/lib/UnicodeBidiDirection\");\n\nvar DraftEditorDecoratedLeaves =\n/*#__PURE__*/\nfunction (_React$Component) {\n  _inheritsLoose(DraftEditorDecoratedLeaves, _React$Component);\n\n  function DraftEditorDecoratedLeaves() {\n    return _React$Component.apply(this, arguments) || this;\n  }\n\n  var _proto = DraftEditorDecoratedLeaves.prototype;\n\n  _proto.render = function render() {\n    var _this$props = this.props,\n        block = _this$props.block,\n        children = _this$props.children,\n        contentState = _this$props.contentState,\n        decorator = _this$props.decorator,\n        decoratorKey = _this$props.decoratorKey,\n        direction = _this$props.direction,\n        leafSet = _this$props.leafSet,\n        text = _this$props.text;\n    var blockKey = block.getKey();\n    var leavesForLeafSet = leafSet.get('leaves');\n    var DecoratorComponent = decorator.getComponentForKey(decoratorKey);\n    var decoratorProps = decorator.getPropsForKey(decoratorKey);\n    var decoratorOffsetKey = DraftOffsetKey.encode(blockKey, parseInt(decoratorKey, 10), 0);\n    var decoratedText = text.slice(leavesForLeafSet.first().get('start'), leavesForLeafSet.last().get('end')); // Resetting dir to the same value on a child node makes Chrome/Firefox\n    // confused on cursor movement. See http://jsfiddle.net/d157kLck/3/\n\n    var dir = UnicodeBidiDirection.getHTMLDirIfDifferent(UnicodeBidi.getDirection(decoratedText), direction);\n    return React.createElement(DecoratorComponent, _extends({}, decoratorProps, {\n      contentState: contentState,\n      decoratedText: decoratedText,\n      dir: dir,\n      key: decoratorOffsetKey,\n      entityKey: block.getEntityAt(leafSet.get('start')),\n      offsetKey: decoratorOffsetKey\n    }), children);\n  };\n\n  return DraftEditorDecoratedLeaves;\n}(React.Component);\n\nmodule.exports = DraftEditorDecoratedLeaves;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar React = require(\"react\");\n\nvar UserAgent = require(\"fbjs/lib/UserAgent\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar isElement = require(\"./isElement\"); // In IE, spans with <br> tags render as two newlines. By rendering a span\n// with only a newline character, we can be sure to render a single line.\n\n\nvar useNewlineChar = UserAgent.isBrowser('IE <= 11');\n/**\n * Check whether the node should be considered a newline.\n */\n\nfunction isNewline(node) {\n  return useNewlineChar ? node.textContent === '\\n' : node.tagName === 'BR';\n}\n/**\n * Placeholder elements for empty text content.\n *\n * What is this `data-text` attribute, anyway? It turns out that we need to\n * put an attribute on the lowest-level text node in order to preserve correct\n * spellcheck handling. If the <span> is naked, Chrome and Safari may do\n * bizarre things to do the DOM -- split text nodes, create extra spans, etc.\n * If the <span> has an attribute, this appears not to happen.\n * See http://jsfiddle.net/9khdavod/ for the failure case, and\n * http://jsfiddle.net/7pg143f7/ for the fixed case.\n */\n\n\nvar NEWLINE_A = function NEWLINE_A(ref) {\n  return useNewlineChar ? React.createElement(\"span\", {\n    key: \"A\",\n    \"data-text\": \"true\",\n    ref: ref\n  }, '\\n') : React.createElement(\"br\", {\n    key: \"A\",\n    \"data-text\": \"true\",\n    ref: ref\n  });\n};\n\nvar NEWLINE_B = function NEWLINE_B(ref) {\n  return useNewlineChar ? React.createElement(\"span\", {\n    key: \"B\",\n    \"data-text\": \"true\",\n    ref: ref\n  }, '\\n') : React.createElement(\"br\", {\n    key: \"B\",\n    \"data-text\": \"true\",\n    ref: ref\n  });\n};\n\n/**\n * The lowest-level component in a `DraftEditor`, the text node component\n * replaces the default React text node implementation. This allows us to\n * perform custom handling of newline behavior and avoid re-rendering text\n * nodes with DOM state that already matches the expectations of our immutable\n * editor state.\n */\nvar DraftEditorTextNode =\n/*#__PURE__*/\nfunction (_React$Component) {\n  _inheritsLoose(DraftEditorTextNode, _React$Component);\n\n  function DraftEditorTextNode(props) {\n    var _this;\n\n    _this = _React$Component.call(this, props) || this; // By flipping this flag, we also keep flipping keys which forces\n    // React to remount this node every time it rerenders.\n\n    _defineProperty(_assertThisInitialized(_this), \"_forceFlag\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_node\", void 0);\n\n    _this._forceFlag = false;\n    return _this;\n  }\n\n  var _proto = DraftEditorTextNode.prototype;\n\n  _proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {\n    var node = this._node;\n    var shouldBeNewline = nextProps.children === '';\n    !isElement(node) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'node is not an Element') : invariant(false) : void 0;\n    var elementNode = node;\n\n    if (shouldBeNewline) {\n      return !isNewline(elementNode);\n    }\n\n    return elementNode.textContent !== nextProps.children;\n  };\n\n  _proto.componentDidMount = function componentDidMount() {\n    this._forceFlag = !this._forceFlag;\n  };\n\n  _proto.componentDidUpdate = function componentDidUpdate() {\n    this._forceFlag = !this._forceFlag;\n  };\n\n  _proto.render = function render() {\n    var _this2 = this;\n\n    if (this.props.children === '') {\n      return this._forceFlag ? NEWLINE_A(function (ref) {\n        return _this2._node = ref;\n      }) : NEWLINE_B(function (ref) {\n        return _this2._node = ref;\n      });\n    }\n\n    return React.createElement(\"span\", {\n      key: this._forceFlag ? 'A' : 'B',\n      \"data-text\": \"true\",\n      ref: function ref(_ref) {\n        return _this2._node = _ref;\n      }\n    }, this.props.children);\n  };\n\n  return DraftEditorTextNode;\n}(React.Component);\n\nmodule.exports = DraftEditorTextNode;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n'use strict';\n\nmodule.exports = {\n  initODS: function initODS() {},\n  handleExtensionCausedError: function handleExtensionCausedError() {}\n};", "\"use strict\";\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\n\n/**\n * @param {*} object The object to check.\n * @return {boolean} Whether or not the object is a DOM node.\n */\nfunction isNode(object) {\n  var doc = object ? object.ownerDocument || object : document;\n  var defaultView = doc.defaultView || window;\n  return !!(object && (typeof defaultView.Node === 'function' ? object instanceof defaultView.Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));\n}\n\nmodule.exports = isNode;", "\"use strict\";\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\nvar isNode = require(\"./isNode\");\n/**\n * @param {*} object The object to check.\n * @return {boolean} Whether or not the object is a DOM text node.\n */\n\n\nfunction isTextNode(object) {\n  return isNode(object) && object.nodeType == 3;\n}\n\nmodule.exports = isTextNode;", "\"use strict\";\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\nvar isTextNode = require(\"./isTextNode\");\n/*eslint-disable no-bitwise */\n\n/**\n * Checks if a given DOM node contains or is another DOM node.\n */\n\n\nfunction containsNode(outerNode, innerNode) {\n  if (!outerNode || !innerNode) {\n    return false;\n  } else if (outerNode === innerNode) {\n    return true;\n  } else if (isTextNode(outerNode)) {\n    return false;\n  } else if (isTextNode(innerNode)) {\n    return containsNode(outerNode, innerNode.parentNode);\n  } else if ('contains' in outerNode) {\n    return outerNode.contains(innerNode);\n  } else if (outerNode.compareDocumentPosition) {\n    return !!(outerNode.compareDocumentPosition(innerNode) & 16);\n  } else {\n    return false;\n  }\n}\n\nmodule.exports = containsNode;", "\"use strict\";\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\n\n/* eslint-disable fb-www/typeof-undefined */\n\n/**\n * Same as document.activeElement but wraps in a try-catch block. In IE it is\n * not safe to call document.activeElement if there is nothing focused.\n *\n * The activeElement will be null only if the document or document body is not\n * yet defined.\n *\n * @param {?DOMDocument} doc Defaults to current document.\n * @return {?DOMElement}\n */\nfunction getActiveElement(doc)\n/*?DOMElement*/\n{\n  doc = doc || (typeof document !== 'undefined' ? document : undefined);\n\n  if (typeof doc === 'undefined') {\n    return null;\n  }\n\n  try {\n    return doc.activeElement || doc.body;\n  } catch (e) {\n    return doc.body;\n  }\n}\n\nmodule.exports = getActiveElement;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar DraftEffects = require(\"./DraftEffects\");\n\nvar DraftJsDebugLogging = require(\"./DraftJsDebugLogging\");\n\nvar containsNode = require(\"fbjs/lib/containsNode\");\n\nvar getActiveElement = require(\"fbjs/lib/getActiveElement\");\n\nvar getCorrectDocumentFromNode = require(\"./getCorrectDocumentFromNode\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar isElement = require(\"./isElement\");\n\nfunction getAnonymizedDOM(node, getNodeLabels) {\n  if (!node) {\n    return '[empty]';\n  }\n\n  var anonymized = anonymizeTextWithin(node, getNodeLabels);\n\n  if (anonymized.nodeType === Node.TEXT_NODE) {\n    return anonymized.textContent;\n  }\n\n  !isElement(anonymized) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Node must be an Element if it is not a text node.') : invariant(false) : void 0;\n  var castedElement = anonymized;\n  return castedElement.outerHTML;\n}\n\nfunction anonymizeTextWithin(node, getNodeLabels) {\n  var labels = getNodeLabels !== undefined ? getNodeLabels(node) : [];\n\n  if (node.nodeType === Node.TEXT_NODE) {\n    var length = node.textContent.length;\n    return getCorrectDocumentFromNode(node).createTextNode('[text ' + length + (labels.length ? ' | ' + labels.join(', ') : '') + ']');\n  }\n\n  var clone = node.cloneNode();\n\n  if (clone.nodeType === 1 && labels.length) {\n    clone.setAttribute('data-labels', labels.join(', '));\n  }\n\n  var childNodes = node.childNodes;\n\n  for (var ii = 0; ii < childNodes.length; ii++) {\n    clone.appendChild(anonymizeTextWithin(childNodes[ii], getNodeLabels));\n  }\n\n  return clone;\n}\n\nfunction getAnonymizedEditorDOM(node, getNodeLabels) {\n  // grabbing the DOM content of the Draft editor\n  var currentNode = node; // this should only be used after checking with isElement\n\n  var castedNode = currentNode;\n\n  while (currentNode) {\n    if (isElement(currentNode) && castedNode.hasAttribute('contenteditable')) {\n      // found the Draft editor container\n      return getAnonymizedDOM(currentNode, getNodeLabels);\n    } else {\n      currentNode = currentNode.parentNode;\n      castedNode = currentNode;\n    }\n  }\n\n  return 'Could not find contentEditable parent of node';\n}\n\nfunction getNodeLength(node) {\n  return node.nodeValue === null ? node.childNodes.length : node.nodeValue.length;\n}\n/**\n * In modern non-IE browsers, we can support both forward and backward\n * selections.\n *\n * Note: IE10+ supports the Selection object, but it does not support\n * the `extend` method, which means that even in modern IE, it's not possible\n * to programatically create a backward selection. Thus, for all IE\n * versions, we use the old IE API to create our selections.\n */\n\n\nfunction setDraftEditorSelection(selectionState, node, blockKey, nodeStart, nodeEnd) {\n  // It's possible that the editor has been removed from the DOM but\n  // our selection code doesn't know it yet. Forcing selection in\n  // this case may lead to errors, so just bail now.\n  var documentObject = getCorrectDocumentFromNode(node);\n\n  if (!containsNode(documentObject.documentElement, node)) {\n    return;\n  }\n\n  var selection = documentObject.defaultView.getSelection();\n  var anchorKey = selectionState.getAnchorKey();\n  var anchorOffset = selectionState.getAnchorOffset();\n  var focusKey = selectionState.getFocusKey();\n  var focusOffset = selectionState.getFocusOffset();\n  var isBackward = selectionState.getIsBackward(); // IE doesn't support backward selection. Swap key/offset pairs.\n\n  if (!selection.extend && isBackward) {\n    var tempKey = anchorKey;\n    var tempOffset = anchorOffset;\n    anchorKey = focusKey;\n    anchorOffset = focusOffset;\n    focusKey = tempKey;\n    focusOffset = tempOffset;\n    isBackward = false;\n  }\n\n  var hasAnchor = anchorKey === blockKey && nodeStart <= anchorOffset && nodeEnd >= anchorOffset;\n  var hasFocus = focusKey === blockKey && nodeStart <= focusOffset && nodeEnd >= focusOffset; // If the selection is entirely bound within this node, set the selection\n  // and be done.\n\n  if (hasAnchor && hasFocus) {\n    selection.removeAllRanges();\n    addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n    addFocusToSelection(selection, node, focusOffset - nodeStart, selectionState);\n    return;\n  }\n\n  if (!isBackward) {\n    // If the anchor is within this node, set the range start.\n    if (hasAnchor) {\n      selection.removeAllRanges();\n      addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n    } // If the focus is within this node, we can assume that we have\n    // already set the appropriate start range on the selection, and\n    // can simply extend the selection.\n\n\n    if (hasFocus) {\n      addFocusToSelection(selection, node, focusOffset - nodeStart, selectionState);\n    }\n  } else {\n    // If this node has the focus, set the selection range to be a\n    // collapsed range beginning here. Later, when we encounter the anchor,\n    // we'll use this information to extend the selection.\n    if (hasFocus) {\n      selection.removeAllRanges();\n      addPointToSelection(selection, node, focusOffset - nodeStart, selectionState);\n    } // If this node has the anchor, we may assume that the correct\n    // focus information is already stored on the selection object.\n    // We keep track of it, reset the selection range, and extend it\n    // back to the focus point.\n\n\n    if (hasAnchor) {\n      var storedFocusNode = selection.focusNode;\n      var storedFocusOffset = selection.focusOffset;\n      selection.removeAllRanges();\n      addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState);\n      addFocusToSelection(selection, storedFocusNode, storedFocusOffset, selectionState);\n    }\n  }\n}\n/**\n * Extend selection towards focus point.\n */\n\n\nfunction addFocusToSelection(selection, node, offset, selectionState) {\n  var activeElement = getActiveElement();\n\n  if (selection.extend && containsNode(activeElement, node)) {\n    // If `extend` is called while another element has focus, an error is\n    // thrown. We therefore disable `extend` if the active element is somewhere\n    // other than the node we are selecting. This should only occur in Firefox,\n    // since it is the only browser to support multiple selections.\n    // See https://bugzilla.mozilla.org/show_bug.cgi?id=921444.\n    // logging to catch bug that is being reported in t16250795\n    if (offset > getNodeLength(node)) {\n      // the call to 'selection.extend' is about to throw\n      DraftJsDebugLogging.logSelectionStateFailure({\n        anonymizedDom: getAnonymizedEditorDOM(node),\n        extraParams: JSON.stringify({\n          offset: offset\n        }),\n        selectionState: JSON.stringify(selectionState.toJS())\n      });\n    } // logging to catch bug that is being reported in t18110632\n\n\n    var nodeWasFocus = node === selection.focusNode;\n\n    try {\n      selection.extend(node, offset);\n    } catch (e) {\n      DraftJsDebugLogging.logSelectionStateFailure({\n        anonymizedDom: getAnonymizedEditorDOM(node, function (n) {\n          var labels = [];\n\n          if (n === activeElement) {\n            labels.push('active element');\n          }\n\n          if (n === selection.anchorNode) {\n            labels.push('selection anchor node');\n          }\n\n          if (n === selection.focusNode) {\n            labels.push('selection focus node');\n          }\n\n          return labels;\n        }),\n        extraParams: JSON.stringify({\n          activeElementName: activeElement ? activeElement.nodeName : null,\n          nodeIsFocus: node === selection.focusNode,\n          nodeWasFocus: nodeWasFocus,\n          selectionRangeCount: selection.rangeCount,\n          selectionAnchorNodeName: selection.anchorNode ? selection.anchorNode.nodeName : null,\n          selectionAnchorOffset: selection.anchorOffset,\n          selectionFocusNodeName: selection.focusNode ? selection.focusNode.nodeName : null,\n          selectionFocusOffset: selection.focusOffset,\n          message: e ? '' + e : null,\n          offset: offset\n        }, null, 2),\n        selectionState: JSON.stringify(selectionState.toJS(), null, 2)\n      }); // allow the error to be thrown -\n      // better than continuing in a broken state\n\n      throw e;\n    }\n  } else {\n    // IE doesn't support extend. This will mean no backward selection.\n    // Extract the existing selection range and add focus to it.\n    // Additionally, clone the selection range. IE11 throws an\n    // InvalidStateError when attempting to access selection properties\n    // after the range is detached.\n    var range = selection.getRangeAt(0);\n    range.setEnd(node, offset);\n    selection.addRange(range.cloneRange());\n  }\n}\n\nfunction addPointToSelection(selection, node, offset, selectionState) {\n  var range = getCorrectDocumentFromNode(node).createRange(); // logging to catch bug that is being reported in t16250795\n\n  if (offset > getNodeLength(node)) {\n    // in this case we know that the call to 'range.setStart' is about to throw\n    DraftJsDebugLogging.logSelectionStateFailure({\n      anonymizedDom: getAnonymizedEditorDOM(node),\n      extraParams: JSON.stringify({\n        offset: offset\n      }),\n      selectionState: JSON.stringify(selectionState.toJS())\n    });\n    DraftEffects.handleExtensionCausedError();\n  }\n\n  range.setStart(node, offset);\n  selection.addRange(range);\n}\n\nmodule.exports = setDraftEditorSelection;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar _assign = require(\"object-assign\");\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar DraftEditorTextNode = require(\"./DraftEditorTextNode.react\");\n\nvar React = require(\"react\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar setDraftEditorSelection = require(\"./setDraftEditorSelection\");\n\n/**\n * All leaf nodes in the editor are spans with single text nodes. Leaf\n * elements are styled based on the merging of an optional custom style map\n * and a default style map.\n *\n * `DraftEditorLeaf` also provides a wrapper for calling into the imperative\n * DOM Selection API. In this way, top-level components can declaratively\n * maintain the selection state.\n */\nvar DraftEditorLeaf =\n/*#__PURE__*/\nfunction (_React$Component) {\n  _inheritsLoose(DraftEditorLeaf, _React$Component);\n\n  function DraftEditorLeaf() {\n    var _this;\n\n    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n      args[_key] = arguments[_key];\n    }\n\n    _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;\n\n    _defineProperty(_assertThisInitialized(_this), \"leaf\", void 0);\n\n    return _this;\n  }\n\n  var _proto = DraftEditorLeaf.prototype;\n\n  _proto._setSelection = function _setSelection() {\n    var selection = this.props.selection; // If selection state is irrelevant to the parent block, no-op.\n\n    if (selection == null || !selection.getHasFocus()) {\n      return;\n    }\n\n    var _this$props = this.props,\n        block = _this$props.block,\n        start = _this$props.start,\n        text = _this$props.text;\n    var blockKey = block.getKey();\n    var end = start + text.length;\n\n    if (!selection.hasEdgeWithin(blockKey, start, end)) {\n      return;\n    } // Determine the appropriate target node for selection. If the child\n    // is not a text node, it is a <br /> spacer. In this case, use the\n    // <span> itself as the selection target.\n\n\n    var node = this.leaf;\n    !node ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Missing node') : invariant(false) : void 0;\n    var child = node.firstChild;\n    !child ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Missing child') : invariant(false) : void 0;\n    var targetNode;\n\n    if (child.nodeType === Node.TEXT_NODE) {\n      targetNode = child;\n    } else if (child instanceof Element && child.tagName === 'BR') {\n      targetNode = node;\n    } else {\n      targetNode = child.firstChild;\n      !targetNode ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Missing targetNode') : invariant(false) : void 0;\n    }\n\n    setDraftEditorSelection(selection, targetNode, blockKey, start, end);\n  };\n\n  _proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {\n    var leafNode = this.leaf;\n    !leafNode ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Missing leafNode') : invariant(false) : void 0;\n    var shouldUpdate = leafNode.textContent !== nextProps.text || nextProps.styleSet !== this.props.styleSet || nextProps.forceSelection;\n    return shouldUpdate;\n  };\n\n  _proto.componentDidUpdate = function componentDidUpdate() {\n    this._setSelection();\n  };\n\n  _proto.componentDidMount = function componentDidMount() {\n    this._setSelection();\n  };\n\n  _proto.render = function render() {\n    var _this2 = this;\n\n    var block = this.props.block;\n    var text = this.props.text; // If the leaf is at the end of its block and ends in a soft newline, append\n    // an extra line feed character. Browsers collapse trailing newline\n    // characters, which leaves the cursor in the wrong place after a\n    // shift+enter. The extra character repairs this.\n\n    if (text.endsWith('\\n') && this.props.isLast) {\n      text += '\\n';\n    }\n\n    var _this$props2 = this.props,\n        customStyleMap = _this$props2.customStyleMap,\n        customStyleFn = _this$props2.customStyleFn,\n        offsetKey = _this$props2.offsetKey,\n        styleSet = _this$props2.styleSet;\n    var styleObj = styleSet.reduce(function (map, styleName) {\n      var mergedStyles = {};\n      var style = customStyleMap[styleName];\n\n      if (style !== undefined && map.textDecoration !== style.textDecoration) {\n        // .trim() is necessary for IE9/10/11 and Edge\n        mergedStyles.textDecoration = [map.textDecoration, style.textDecoration].join(' ').trim();\n      }\n\n      return _assign(map, style, mergedStyles);\n    }, {});\n\n    if (customStyleFn) {\n      var newStyles = customStyleFn(styleSet, block);\n      styleObj = _assign(styleObj, newStyles);\n    }\n\n    return React.createElement(\"span\", {\n      \"data-offset-key\": offsetKey,\n      ref: function ref(_ref) {\n        return _this2.leaf = _ref;\n      },\n      style: styleObj\n    }, React.createElement(DraftEditorTextNode, null, text));\n  };\n\n  return DraftEditorLeaf;\n}(React.Component);\n\nmodule.exports = DraftEditorLeaf;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n *\n * This is unstable and not part of the public API and should not be used by\n * production systems. This file may be update/removed without notice.\n */\n'use strict';\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nvar DraftEditorDecoratedLeaves = require(\"./DraftEditorDecoratedLeaves.react\");\n\nvar DraftEditorLeaf = require(\"./DraftEditorLeaf.react\");\n\nvar DraftOffsetKey = require(\"./DraftOffsetKey\");\n\nvar Immutable = require(\"immutable\");\n\nvar React = require(\"react\");\n\nvar cx = require(\"fbjs/lib/cx\");\n\nvar List = Immutable.List;\n\nvar DraftEditorNode =\n/*#__PURE__*/\nfunction (_React$Component) {\n  _inheritsLoose(DraftEditorNode, _React$Component);\n\n  function DraftEditorNode() {\n    return _React$Component.apply(this, arguments) || this;\n  }\n\n  var _proto = DraftEditorNode.prototype;\n\n  _proto.render = function render() {\n    var _this$props = this.props,\n        block = _this$props.block,\n        contentState = _this$props.contentState,\n        customStyleFn = _this$props.customStyleFn,\n        customStyleMap = _this$props.customStyleMap,\n        decorator = _this$props.decorator,\n        direction = _this$props.direction,\n        forceSelection = _this$props.forceSelection,\n        hasSelection = _this$props.hasSelection,\n        selection = _this$props.selection,\n        tree = _this$props.tree;\n    var blockKey = block.getKey();\n    var text = block.getText();\n    var lastLeafSet = tree.size - 1;\n    var children = this.props.children || tree.map(function (leafSet, ii) {\n      var decoratorKey = leafSet.get('decoratorKey');\n      var leavesForLeafSet = leafSet.get('leaves');\n      var lastLeaf = leavesForLeafSet.size - 1;\n      var Leaves = leavesForLeafSet.map(function (leaf, jj) {\n        var offsetKey = DraftOffsetKey.encode(blockKey, ii, jj);\n        var start = leaf.get('start');\n        var end = leaf.get('end');\n        return React.createElement(DraftEditorLeaf, {\n          key: offsetKey,\n          offsetKey: offsetKey,\n          block: block,\n          start: start,\n          selection: hasSelection ? selection : null,\n          forceSelection: forceSelection,\n          text: text.slice(start, end),\n          styleSet: block.getInlineStyleAt(start),\n          customStyleMap: customStyleMap,\n          customStyleFn: customStyleFn,\n          isLast: decoratorKey === lastLeafSet && jj === lastLeaf\n        });\n      }).toArray();\n\n      if (!decoratorKey || !decorator) {\n        return Leaves;\n      }\n\n      return React.createElement(DraftEditorDecoratedLeaves, {\n        block: block,\n        children: Leaves,\n        contentState: contentState,\n        decorator: decorator,\n        decoratorKey: decoratorKey,\n        direction: direction,\n        leafSet: leafSet,\n        text: text,\n        key: ii\n      });\n    }).toArray();\n    return React.createElement(\"div\", {\n      \"data-offset-key\": DraftOffsetKey.encode(blockKey, 0, 0),\n      className: cx({\n        'public/DraftStyleDefault/block': true,\n        'public/DraftStyleDefault/ltr': direction === 'LTR',\n        'public/DraftStyleDefault/rtl': direction === 'RTL'\n      })\n    }, children);\n  };\n\n  return DraftEditorNode;\n}(React.Component);\n\nmodule.exports = DraftEditorNode;", "\"use strict\";\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n/**\n * @param {DOMElement} element\n * @param {DOMDocument} doc\n * @return {boolean}\n */\nfunction _isViewportScrollElement(element, doc) {\n  return !!doc && (element === doc.documentElement || element === doc.body);\n}\n/**\n * Scroll Module. This class contains 4 simple static functions\n * to be used to access Element.scrollTop/scrollLeft properties.\n * To solve the inconsistencies between browsers when either\n * document.body or document.documentElement is supplied,\n * below logic will be used to alleviate the issue:\n *\n * 1. If 'element' is either 'document.body' or 'document.documentElement,\n *    get whichever element's 'scroll{Top,Left}' is larger.\n * 2. If 'element' is either 'document.body' or 'document.documentElement',\n *    set the 'scroll{Top,Left}' on both elements.\n */\n\n\nvar Scroll = {\n  /**\n   * @param {DOMElement} element\n   * @return {number}\n   */\n  getTop: function getTop(element) {\n    var doc = element.ownerDocument;\n    return _isViewportScrollElement(element, doc) ? // In practice, they will either both have the same value,\n    // or one will be zero and the other will be the scroll position\n    // of the viewport. So we can use `X || Y` instead of `Math.max(X, Y)`\n    doc.body.scrollTop || doc.documentElement.scrollTop : element.scrollTop;\n  },\n\n  /**\n   * @param {DOMElement} element\n   * @param {number} newTop\n   */\n  setTop: function setTop(element, newTop) {\n    var doc = element.ownerDocument;\n\n    if (_isViewportScrollElement(element, doc)) {\n      doc.body.scrollTop = doc.documentElement.scrollTop = newTop;\n    } else {\n      element.scrollTop = newTop;\n    }\n  },\n\n  /**\n   * @param {DOMElement} element\n   * @return {number}\n   */\n  getLeft: function getLeft(element) {\n    var doc = element.ownerDocument;\n    return _isViewportScrollElement(element, doc) ? doc.body.scrollLeft || doc.documentElement.scrollLeft : element.scrollLeft;\n  },\n\n  /**\n   * @param {DOMElement} element\n   * @param {number} newLeft\n   */\n  setLeft: function setLeft(element, newLeft) {\n    var doc = element.ownerDocument;\n\n    if (_isViewportScrollElement(element, doc)) {\n      doc.body.scrollLeft = doc.documentElement.scrollLeft = newLeft;\n    } else {\n      element.scrollLeft = newLeft;\n    }\n  }\n};\nmodule.exports = Scroll;", "\"use strict\";\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\nvar _hyphenPattern = /-(.)/g;\n/**\n * Camelcases a hyphenated string, for example:\n *\n *   > camelize('background-color')\n *   < \"backgroundColor\"\n *\n * @param {string} string\n * @return {string}\n */\n\nfunction camelize(string) {\n  return string.replace(_hyphenPattern, function (_, character) {\n    return character.toUpperCase();\n  });\n}\n\nmodule.exports = camelize;", "\"use strict\";\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\nvar _uppercasePattern = /([A-Z])/g;\n/**\n * Hyphenates a camelcased string, for example:\n *\n *   > hyphenate('backgroundColor')\n *   < \"background-color\"\n *\n * For CSS style names, use `hyphenateStyleName` instead which works properly\n * with all vendor prefixes, including `ms`.\n *\n * @param {string} string\n * @return {string}\n */\n\nfunction hyphenate(string) {\n  return string.replace(_uppercasePattern, '-$1').toLowerCase();\n}\n\nmodule.exports = hyphenate;", "\"use strict\";\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\nvar camelize = require(\"./camelize\");\n\nvar hyphenate = require(\"./hyphenate\");\n\nfunction asString(value)\n/*?string*/\n{\n  return value == null ? value : String(value);\n}\n\nfunction getStyleProperty(\n/*DOMNode*/\nnode,\n/*string*/\nname)\n/*?string*/\n{\n  var computedStyle; // W3C Standard\n\n  if (window.getComputedStyle) {\n    // In certain cases such as within an iframe in FF3, this returns null.\n    computedStyle = window.getComputedStyle(node, null);\n\n    if (computedStyle) {\n      return asString(computedStyle.getPropertyValue(hyphenate(name)));\n    }\n  } // Safari\n\n\n  if (document.defaultView && document.defaultView.getComputedStyle) {\n    computedStyle = document.defaultView.getComputedStyle(node, null); // A Safari bug causes this to return null for `display: none` elements.\n\n    if (computedStyle) {\n      return asString(computedStyle.getPropertyValue(hyphenate(name)));\n    }\n\n    if (name === 'display') {\n      return 'none';\n    }\n  } // Internet Explorer\n\n\n  if (node.currentStyle) {\n    if (name === 'float') {\n      return asString(node.currentStyle.cssFloat || node.currentStyle.styleFloat);\n    }\n\n    return asString(node.currentStyle[camelize(name)]);\n  }\n\n  return asString(node.style && node.style[camelize(name)]);\n}\n\nmodule.exports = getStyleProperty;", "\"use strict\";\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\nvar getStyleProperty = require(\"./getStyleProperty\");\n/**\n * @param {DOMNode} element [description]\n * @param {string} name Overflow style property name.\n * @return {boolean} True if the supplied ndoe is scrollable.\n */\n\n\nfunction _isNodeScrollable(element, name) {\n  var overflow = Style.get(element, name);\n  return overflow === 'auto' || overflow === 'scroll';\n}\n/**\n * Utilities for querying and mutating style properties.\n */\n\n\nvar Style = {\n  /**\n   * Gets the style property for the supplied node. This will return either the\n   * computed style, if available, or the declared style.\n   *\n   * @param {DOMNode} node\n   * @param {string} name Style property name.\n   * @return {?string} Style property value.\n   */\n  get: getStyleProperty,\n\n  /**\n   * Determines the nearest ancestor of a node that is scrollable.\n   *\n   * NOTE: This can be expensive if used repeatedly or on a node nested deeply.\n   *\n   * @param {?DOMNode} node Node from which to start searching.\n   * @return {?DOMWindow|DOMElement} Scroll parent of the supplied node.\n   */\n  getScrollParent: function getScrollParent(node) {\n    if (!node) {\n      return null;\n    }\n\n    var ownerDocument = node.ownerDocument;\n\n    while (node && node !== ownerDocument.body) {\n      if (_isNodeScrollable(node, 'overflow') || _isNodeScrollable(node, 'overflowY') || _isNodeScrollable(node, 'overflowX')) {\n        return node;\n      }\n\n      node = node.parentNode;\n    }\n\n    return ownerDocument.defaultView || ownerDocument.parentWindow;\n  }\n};\nmodule.exports = Style;", "\"use strict\";\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\nvar containsNode = require(\"./containsNode\");\n/**\n * Gets an element's bounding rect in pixels relative to the viewport.\n *\n * @param {DOMElement} elem\n * @return {object}\n */\n\n\nfunction getElementRect(elem) {\n  var docElem = elem.ownerDocument.documentElement; // FF 2, Safari 3 and Opera 9.5- do not support getBoundingClientRect().\n  // IE9- will throw if the element is not in the document.\n\n  if (!('getBoundingClientRect' in elem) || !containsNode(docElem, elem)) {\n    return {\n      left: 0,\n      right: 0,\n      top: 0,\n      bottom: 0\n    };\n  } // Subtracts clientTop/Left because IE8- added a 2px border to the\n  // <html> element (see http://fburl.com/1493213). IE 7 in\n  // Quicksmode does not report clientLeft/clientTop so there\n  // will be an unaccounted offset of 2px when in quirksmode\n\n\n  var rect = elem.getBoundingClientRect();\n  return {\n    left: Math.round(rect.left) - docElem.clientLeft,\n    right: Math.round(rect.right) - docElem.clientLeft,\n    top: Math.round(rect.top) - docElem.clientTop,\n    bottom: Math.round(rect.bottom) - docElem.clientTop\n  };\n}\n\nmodule.exports = getElementRect;", "\"use strict\";\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\nvar getElementRect = require(\"./getElementRect\");\n/**\n * Gets an element's position in pixels relative to the viewport. The returned\n * object represents the position of the element's top left corner.\n *\n * @param {DOMElement} element\n * @return {object}\n */\n\n\nfunction getElementPosition(element) {\n  var rect = getElementRect(element);\n  return {\n    x: rect.left,\n    y: rect.top,\n    width: rect.right - rect.left,\n    height: rect.bottom - rect.top\n  };\n}\n\nmodule.exports = getElementPosition;", "/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\n'use strict';\n\nvar isWebkit = typeof navigator !== 'undefined' && navigator.userAgent.indexOf('AppleWebKit') > -1;\n/**\n * Gets the element with the document scroll properties such as `scrollLeft` and\n * `scrollHeight`. This may differ across different browsers.\n *\n * NOTE: The return value can be null if the DOM is not yet ready.\n *\n * @param {?DOMDocument} doc Defaults to current document.\n * @return {?DOMElement}\n */\n\nfunction getDocumentScrollElement(doc) {\n  doc = doc || document;\n\n  if (doc.scrollingElement) {\n    return doc.scrollingElement;\n  }\n\n  return !isWebkit && doc.compatMode === 'CSS1Compat' ? doc.documentElement : doc.body;\n}\n\nmodule.exports = getDocumentScrollElement;", "/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\n'use strict';\n/**\n * Gets the scroll position of the supplied element or window.\n *\n * The return values are unbounded, unlike `getScrollPosition`. This means they\n * may be negative or exceed the element boundaries (which is possible using\n * inertial scrolling).\n *\n * @param {DOMWindow|DOMElement} scrollable\n * @return {object} Map with `x` and `y` keys.\n */\n\nfunction getUnboundedScrollPosition(scrollable) {\n  if (scrollable.Window && scrollable instanceof scrollable.Window) {\n    return {\n      x: scrollable.pageXOffset || scrollable.document.documentElement.scrollLeft,\n      y: scrollable.pageYOffset || scrollable.document.documentElement.scrollTop\n    };\n  }\n\n  return {\n    x: scrollable.scrollLeft,\n    y: scrollable.scrollTop\n  };\n}\n\nmodule.exports = getUnboundedScrollPosition;", "/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\n'use strict';\n\nvar getDocumentScrollElement = require(\"./getDocumentScrollElement\");\n\nvar getUnboundedScrollPosition = require(\"./getUnboundedScrollPosition\");\n/**\n * Gets the scroll position of the supplied element or window.\n *\n * The return values are bounded. This means that if the scroll position is\n * negative or exceeds the element boundaries (which is possible using inertial\n * scrolling), you will get zero or the maximum scroll position, respectively.\n *\n * If you need the unbound scroll position, use `getUnboundedScrollPosition`.\n *\n * @param {DOMWindow|DOMElement} scrollable\n * @return {object} Map with `x` and `y` keys.\n */\n\n\nfunction getScrollPosition(scrollable) {\n  var documentScrollElement = getDocumentScrollElement(scrollable.ownerDocument || scrollable.document);\n\n  if (scrollable.Window && scrollable instanceof scrollable.Window) {\n    scrollable = documentScrollElement;\n  }\n\n  var scrollPosition = getUnboundedScrollPosition(scrollable);\n  var viewport = scrollable === documentScrollElement ? scrollable.ownerDocument.documentElement : scrollable;\n  var xMax = scrollable.scrollWidth - viewport.clientWidth;\n  var yMax = scrollable.scrollHeight - viewport.clientHeight;\n  scrollPosition.x = Math.max(0, Math.min(scrollPosition.x, xMax));\n  scrollPosition.y = Math.max(0, Math.min(scrollPosition.y, yMax));\n  return scrollPosition;\n}\n\nmodule.exports = getScrollPosition;", "\"use strict\";\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n * @typechecks\n */\nfunction getViewportWidth() {\n  var width;\n\n  if (document.documentElement) {\n    width = document.documentElement.clientWidth;\n  }\n\n  if (!width && document.body) {\n    width = document.body.clientWidth;\n  }\n\n  return width || 0;\n}\n\nfunction getViewportHeight() {\n  var height;\n\n  if (document.documentElement) {\n    height = document.documentElement.clientHeight;\n  }\n\n  if (!height && document.body) {\n    height = document.body.clientHeight;\n  }\n\n  return height || 0;\n}\n/**\n * Gets the viewport dimensions including any scrollbars.\n */\n\n\nfunction getViewportDimensions() {\n  return {\n    width: window.innerWidth || getViewportWidth(),\n    height: window.innerHeight || getViewportHeight()\n  };\n}\n/**\n * Gets the viewport dimensions excluding any scrollbars.\n */\n\n\ngetViewportDimensions.withoutScrollbars = function () {\n  return {\n    width: getViewportWidth(),\n    height: getViewportHeight()\n  };\n};\n\nmodule.exports = getViewportDimensions;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n *\n * This file is a fork of DraftEditorBlock.react.js and DraftEditorContents.react.js\n *\n * This is unstable and not part of the public API and should not be used by\n * production systems. This file may be update/removed without notice.\n */\n'use strict';\n\nvar _assign = require(\"object-assign\");\n\nfunction _extends() { _extends = _assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar DraftEditorNode = require(\"./DraftEditorNode.react\");\n\nvar DraftOffsetKey = require(\"./DraftOffsetKey\");\n\nvar React = require(\"react\");\n\nvar ReactDOM = require(\"react-dom\");\n\nvar Scroll = require(\"fbjs/lib/Scroll\");\n\nvar Style = require(\"fbjs/lib/Style\");\n\nvar getElementPosition = require(\"fbjs/lib/getElementPosition\");\n\nvar getScrollPosition = require(\"fbjs/lib/getScrollPosition\");\n\nvar getViewportDimensions = require(\"fbjs/lib/getViewportDimensions\");\n\nvar Immutable = require(\"immutable\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar isHTMLElement = require(\"./isHTMLElement\");\n\nvar SCROLL_BUFFER = 10;\nvar List = Immutable.List; // we should harden up the bellow flow types to make them more strict\n\n/**\n * Return whether a block overlaps with either edge of the `SelectionState`.\n */\nvar isBlockOnSelectionEdge = function isBlockOnSelectionEdge(selection, key) {\n  return selection.getAnchorKey() === key || selection.getFocusKey() === key;\n};\n/**\n * We will use this helper to identify blocks that need to be wrapped but have siblings that\n * also share the same wrapper element, this way we can do the wrapping once the last sibling\n * is added.\n */\n\n\nvar shouldNotAddWrapperElement = function shouldNotAddWrapperElement(block, contentState) {\n  var nextSiblingKey = block.getNextSiblingKey();\n  return nextSiblingKey ? contentState.getBlockForKey(nextSiblingKey).getType() === block.getType() : false;\n};\n\nvar applyWrapperElementToSiblings = function applyWrapperElementToSiblings(wrapperTemplate, Element, nodes) {\n  var wrappedSiblings = []; // we check back until we find a sibbling that does not have same wrapper\n\n  var _iteratorNormalCompletion = true;\n  var _didIteratorError = false;\n  var _iteratorError = undefined;\n\n  try {\n    for (var _iterator = nodes.reverse()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n      var sibling = _step.value;\n\n      if (sibling.type !== Element) {\n        break;\n      }\n\n      wrappedSiblings.push(sibling);\n    } // we now should remove from acc the wrappedSiblings and add them back under same wrap\n\n  } catch (err) {\n    _didIteratorError = true;\n    _iteratorError = err;\n  } finally {\n    try {\n      if (!_iteratorNormalCompletion && _iterator[\"return\"] != null) {\n        _iterator[\"return\"]();\n      }\n    } finally {\n      if (_didIteratorError) {\n        throw _iteratorError;\n      }\n    }\n  }\n\n  nodes.splice(nodes.indexOf(wrappedSiblings[0]), wrappedSiblings.length + 1);\n  var childrenIs = wrappedSiblings.reverse();\n  var key = childrenIs[0].key;\n  nodes.push(React.cloneElement(wrapperTemplate, {\n    key: \"\".concat(key, \"-wrap\"),\n    'data-offset-key': DraftOffsetKey.encode(key, 0, 0)\n  }, childrenIs));\n  return nodes;\n};\n\nvar getDraftRenderConfig = function getDraftRenderConfig(block, blockRenderMap) {\n  var configForType = blockRenderMap.get(block.getType()) || blockRenderMap.get('unstyled');\n  var wrapperTemplate = configForType.wrapper;\n  var Element = configForType.element || blockRenderMap.get('unstyled').element;\n  return {\n    Element: Element,\n    wrapperTemplate: wrapperTemplate\n  };\n};\n\nvar getCustomRenderConfig = function getCustomRenderConfig(block, blockRendererFn) {\n  var customRenderer = blockRendererFn(block);\n\n  if (!customRenderer) {\n    return {};\n  }\n\n  var CustomComponent = customRenderer.component,\n      customProps = customRenderer.props,\n      customEditable = customRenderer.editable;\n  return {\n    CustomComponent: CustomComponent,\n    customProps: customProps,\n    customEditable: customEditable\n  };\n};\n\nvar getElementPropsConfig = function getElementPropsConfig(block, editorKey, offsetKey, blockStyleFn, customConfig) {\n  var elementProps = {\n    'data-block': true,\n    'data-editor': editorKey,\n    'data-offset-key': offsetKey,\n    key: block.getKey()\n  };\n  var customClass = blockStyleFn(block);\n\n  if (customClass) {\n    elementProps.className = customClass;\n  }\n\n  if (customConfig.customEditable !== undefined) {\n    elementProps = _objectSpread({}, elementProps, {\n      contentEditable: customConfig.customEditable,\n      suppressContentEditableWarning: true\n    });\n  }\n\n  return elementProps;\n};\n\nvar DraftEditorBlockNode =\n/*#__PURE__*/\nfunction (_React$Component) {\n  _inheritsLoose(DraftEditorBlockNode, _React$Component);\n\n  function DraftEditorBlockNode() {\n    return _React$Component.apply(this, arguments) || this;\n  }\n\n  var _proto = DraftEditorBlockNode.prototype;\n\n  _proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {\n    var _this$props = this.props,\n        block = _this$props.block,\n        direction = _this$props.direction,\n        tree = _this$props.tree;\n    var isContainerNode = !block.getChildKeys().isEmpty();\n    var blockHasChanged = block !== nextProps.block || tree !== nextProps.tree || direction !== nextProps.direction || isBlockOnSelectionEdge(nextProps.selection, nextProps.block.getKey()) && nextProps.forceSelection; // if we have children at this stage we always re-render container nodes\n    // else if its a root node we avoid re-rendering by checking for block updates\n\n    return isContainerNode || blockHasChanged;\n  }\n  /**\n   * When a block is mounted and overlaps the selection state, we need to make\n   * sure that the cursor is visible to match native behavior. This may not\n   * be the case if the user has pressed `RETURN` or pasted some content, since\n   * programatically creating these new blocks and setting the DOM selection\n   * will miss out on the browser natively scrolling to that position.\n   *\n   * To replicate native behavior, if the block overlaps the selection state\n   * on mount, force the scroll position. Check the scroll state of the scroll\n   * parent, and adjust it to align the entire block to the bottom of the\n   * scroll parent.\n   */\n  ;\n\n  _proto.componentDidMount = function componentDidMount() {\n    var selection = this.props.selection;\n    var endKey = selection.getEndKey();\n\n    if (!selection.getHasFocus() || endKey !== this.props.block.getKey()) {\n      return;\n    }\n\n    var blockNode = ReactDOM.findDOMNode(this);\n    var scrollParent = Style.getScrollParent(blockNode);\n    var scrollPosition = getScrollPosition(scrollParent);\n    var scrollDelta;\n\n    if (scrollParent === window) {\n      var nodePosition = getElementPosition(blockNode);\n      var nodeBottom = nodePosition.y + nodePosition.height;\n      var viewportHeight = getViewportDimensions().height;\n      scrollDelta = nodeBottom - viewportHeight;\n\n      if (scrollDelta > 0) {\n        window.scrollTo(scrollPosition.x, scrollPosition.y + scrollDelta + SCROLL_BUFFER);\n      }\n    } else {\n      !isHTMLElement(blockNode) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'blockNode is not an HTMLElement') : invariant(false) : void 0;\n      var htmlBlockNode = blockNode;\n      var blockBottom = htmlBlockNode.offsetHeight + htmlBlockNode.offsetTop;\n      var scrollBottom = scrollParent.offsetHeight + scrollPosition.y;\n      scrollDelta = blockBottom - scrollBottom;\n\n      if (scrollDelta > 0) {\n        Scroll.setTop(scrollParent, Scroll.getTop(scrollParent) + scrollDelta + SCROLL_BUFFER);\n      }\n    }\n  };\n\n  _proto.render = function render() {\n    var _this = this;\n\n    var _this$props2 = this.props,\n        block = _this$props2.block,\n        blockRenderMap = _this$props2.blockRenderMap,\n        blockRendererFn = _this$props2.blockRendererFn,\n        blockStyleFn = _this$props2.blockStyleFn,\n        contentState = _this$props2.contentState,\n        decorator = _this$props2.decorator,\n        editorKey = _this$props2.editorKey,\n        editorState = _this$props2.editorState,\n        customStyleFn = _this$props2.customStyleFn,\n        customStyleMap = _this$props2.customStyleMap,\n        direction = _this$props2.direction,\n        forceSelection = _this$props2.forceSelection,\n        selection = _this$props2.selection,\n        tree = _this$props2.tree;\n    var children = null;\n\n    if (block.children.size) {\n      children = block.children.reduce(function (acc, key) {\n        var offsetKey = DraftOffsetKey.encode(key, 0, 0);\n        var child = contentState.getBlockForKey(key);\n        var customConfig = getCustomRenderConfig(child, blockRendererFn);\n        var Component = customConfig.CustomComponent || DraftEditorBlockNode;\n\n        var _getDraftRenderConfig = getDraftRenderConfig(child, blockRenderMap),\n            Element = _getDraftRenderConfig.Element,\n            wrapperTemplate = _getDraftRenderConfig.wrapperTemplate;\n\n        var elementProps = getElementPropsConfig(child, editorKey, offsetKey, blockStyleFn, customConfig);\n\n        var childProps = _objectSpread({}, _this.props, {\n          tree: editorState.getBlockTree(key),\n          blockProps: customConfig.customProps,\n          offsetKey: offsetKey,\n          block: child\n        });\n\n        acc.push(React.createElement(Element, elementProps, React.createElement(Component, childProps)));\n\n        if (!wrapperTemplate || shouldNotAddWrapperElement(child, contentState)) {\n          return acc;\n        } // if we are here it means we are the last block\n        // that has a wrapperTemplate so we should wrap itself\n        // and all other previous siblings that share the same wrapper\n\n\n        applyWrapperElementToSiblings(wrapperTemplate, Element, acc);\n        return acc;\n      }, []);\n    }\n\n    var blockKey = block.getKey();\n    var offsetKey = DraftOffsetKey.encode(blockKey, 0, 0);\n    var customConfig = getCustomRenderConfig(block, blockRendererFn);\n    var Component = customConfig.CustomComponent;\n    var blockNode = Component != null ? React.createElement(Component, _extends({}, this.props, {\n      tree: editorState.getBlockTree(blockKey),\n      blockProps: customConfig.customProps,\n      offsetKey: offsetKey,\n      block: block\n    })) : React.createElement(DraftEditorNode, {\n      block: block,\n      children: children,\n      contentState: contentState,\n      customStyleFn: customStyleFn,\n      customStyleMap: customStyleMap,\n      decorator: decorator,\n      direction: direction,\n      forceSelection: forceSelection,\n      hasSelection: isBlockOnSelectionEdge(selection, blockKey),\n      selection: selection,\n      tree: tree\n    });\n\n    if (block.getParentKey()) {\n      return blockNode;\n    }\n\n    var _getDraftRenderConfig2 = getDraftRenderConfig(block, blockRenderMap),\n        Element = _getDraftRenderConfig2.Element;\n\n    var elementProps = getElementPropsConfig(block, editorKey, offsetKey, blockStyleFn, customConfig); // root block nodes needs to be wrapped\n\n    return React.createElement(Element, elementProps, blockNode);\n  };\n\n  return DraftEditorBlockNode;\n}(React.Component);\n\nmodule.exports = DraftEditorBlockNode;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n *\n * This file is a fork of DraftEditorContents.react.js for tree nodes\n *\n * This is unstable and not part of the public API and should not be used by\n * production systems. This file may be update/removed without notice.\n */\n'use strict';\n\nvar _assign = require(\"object-assign\");\n\nfunction _extends() { _extends = _assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nvar DraftEditorBlockNode = require(\"./DraftEditorBlockNode.react\");\n\nvar DraftOffsetKey = require(\"./DraftOffsetKey\");\n\nvar React = require(\"react\");\n\nvar nullthrows = require(\"fbjs/lib/nullthrows\");\n\n/**\n * `DraftEditorContents` is the container component for all block components\n * rendered for a `DraftEditor`. It is optimized to aggressively avoid\n * re-rendering blocks whenever possible.\n *\n * This component is separate from `DraftEditor` because certain props\n * (for instance, ARIA props) must be allowed to update without affecting\n * the contents of the editor.\n */\nvar DraftEditorContentsExperimental =\n/*#__PURE__*/\nfunction (_React$Component) {\n  _inheritsLoose(DraftEditorContentsExperimental, _React$Component);\n\n  function DraftEditorContentsExperimental() {\n    return _React$Component.apply(this, arguments) || this;\n  }\n\n  var _proto = DraftEditorContentsExperimental.prototype;\n\n  _proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {\n    var prevEditorState = this.props.editorState;\n    var nextEditorState = nextProps.editorState;\n    var prevDirectionMap = prevEditorState.getDirectionMap();\n    var nextDirectionMap = nextEditorState.getDirectionMap(); // Text direction has changed for one or more blocks. We must re-render.\n\n    if (prevDirectionMap !== nextDirectionMap) {\n      return true;\n    }\n\n    var didHaveFocus = prevEditorState.getSelection().getHasFocus();\n    var nowHasFocus = nextEditorState.getSelection().getHasFocus();\n\n    if (didHaveFocus !== nowHasFocus) {\n      return true;\n    }\n\n    var nextNativeContent = nextEditorState.getNativelyRenderedContent();\n    var wasComposing = prevEditorState.isInCompositionMode();\n    var nowComposing = nextEditorState.isInCompositionMode(); // If the state is unchanged or we're currently rendering a natively\n    // rendered state, there's nothing new to be done.\n\n    if (prevEditorState === nextEditorState || nextNativeContent !== null && nextEditorState.getCurrentContent() === nextNativeContent || wasComposing && nowComposing) {\n      return false;\n    }\n\n    var prevContent = prevEditorState.getCurrentContent();\n    var nextContent = nextEditorState.getCurrentContent();\n    var prevDecorator = prevEditorState.getDecorator();\n    var nextDecorator = nextEditorState.getDecorator();\n    return wasComposing !== nowComposing || prevContent !== nextContent || prevDecorator !== nextDecorator || nextEditorState.mustForceSelection();\n  };\n\n  _proto.render = function render() {\n    var _this$props = this.props,\n        blockRenderMap = _this$props.blockRenderMap,\n        blockRendererFn = _this$props.blockRendererFn,\n        blockStyleFn = _this$props.blockStyleFn,\n        customStyleMap = _this$props.customStyleMap,\n        customStyleFn = _this$props.customStyleFn,\n        editorState = _this$props.editorState,\n        editorKey = _this$props.editorKey,\n        textDirectionality = _this$props.textDirectionality;\n    var content = editorState.getCurrentContent();\n    var selection = editorState.getSelection();\n    var forceSelection = editorState.mustForceSelection();\n    var decorator = editorState.getDecorator();\n    var directionMap = nullthrows(editorState.getDirectionMap());\n    var blocksAsArray = content.getBlocksAsArray();\n    var rootBlock = blocksAsArray[0];\n    var processedBlocks = [];\n    var nodeBlock = rootBlock;\n\n    while (nodeBlock) {\n      var blockKey = nodeBlock.getKey();\n      var blockProps = {\n        blockRenderMap: blockRenderMap,\n        blockRendererFn: blockRendererFn,\n        blockStyleFn: blockStyleFn,\n        contentState: content,\n        customStyleFn: customStyleFn,\n        customStyleMap: customStyleMap,\n        decorator: decorator,\n        editorKey: editorKey,\n        editorState: editorState,\n        forceSelection: forceSelection,\n        selection: selection,\n        block: nodeBlock,\n        direction: textDirectionality ? textDirectionality : directionMap.get(blockKey),\n        tree: editorState.getBlockTree(blockKey)\n      };\n      var configForType = blockRenderMap.get(nodeBlock.getType()) || blockRenderMap.get('unstyled');\n      var wrapperTemplate = configForType.wrapper;\n      processedBlocks.push({\n        /* $FlowFixMe(>=0.112.0 site=mobile) This comment suppresses an error\n         * found when Flow v0.112 was deployed. To see the error delete this\n         * comment and run Flow. */\n\n        /* $FlowFixMe(>=0.112.0 site=www) This comment suppresses an error\n         * found when Flow v0.112 was deployed. To see the error delete this\n         * comment and run Flow. */\n\n        /* $FlowFixMe(>=0.112.0 site=www,mobile) This comment suppresses an\n         * error found when Flow v0.112 was deployed. To see the error delete\n         * this comment and run Flow. */\n        block: React.createElement(DraftEditorBlockNode, _extends({\n          key: blockKey\n        }, blockProps)),\n        wrapperTemplate: wrapperTemplate,\n        key: blockKey,\n        offsetKey: DraftOffsetKey.encode(blockKey, 0, 0)\n      });\n      var nextBlockKey = nodeBlock.getNextSiblingKey();\n      nodeBlock = nextBlockKey ? content.getBlockForKey(nextBlockKey) : null;\n    } // Group contiguous runs of blocks that have the same wrapperTemplate\n\n\n    var outputBlocks = [];\n\n    for (var ii = 0; ii < processedBlocks.length;) {\n      var info = processedBlocks[ii];\n\n      if (info.wrapperTemplate) {\n        var blocks = [];\n\n        do {\n          blocks.push(processedBlocks[ii].block);\n          ii++;\n        } while (ii < processedBlocks.length && processedBlocks[ii].wrapperTemplate === info.wrapperTemplate);\n\n        var wrapperElement = React.cloneElement(info.wrapperTemplate, {\n          key: info.key + '-wrap',\n          'data-offset-key': info.offsetKey\n        }, blocks);\n        outputBlocks.push(wrapperElement);\n      } else {\n        outputBlocks.push(info.block);\n        ii++;\n      }\n    }\n\n    return React.createElement(\"div\", {\n      \"data-contents\": \"true\"\n    }, outputBlocks);\n  };\n\n  return DraftEditorContentsExperimental;\n}(React.Component);\n\nmodule.exports = DraftEditorContentsExperimental;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar _assign = require(\"object-assign\");\n\nfunction _extends() { _extends = _assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar DraftEditorLeaf = require(\"./DraftEditorLeaf.react\");\n\nvar DraftOffsetKey = require(\"./DraftOffsetKey\");\n\nvar React = require(\"react\");\n\nvar Scroll = require(\"fbjs/lib/Scroll\");\n\nvar Style = require(\"fbjs/lib/Style\");\n\nvar UnicodeBidi = require(\"fbjs/lib/UnicodeBidi\");\n\nvar UnicodeBidiDirection = require(\"fbjs/lib/UnicodeBidiDirection\");\n\nvar cx = require(\"fbjs/lib/cx\");\n\nvar getElementPosition = require(\"fbjs/lib/getElementPosition\");\n\nvar getScrollPosition = require(\"fbjs/lib/getScrollPosition\");\n\nvar getViewportDimensions = require(\"fbjs/lib/getViewportDimensions\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar isHTMLElement = require(\"./isHTMLElement\");\n\nvar nullthrows = require(\"fbjs/lib/nullthrows\");\n\nvar SCROLL_BUFFER = 10;\n\n/**\n * Return whether a block overlaps with either edge of the `SelectionState`.\n */\nvar isBlockOnSelectionEdge = function isBlockOnSelectionEdge(selection, key) {\n  return selection.getAnchorKey() === key || selection.getFocusKey() === key;\n};\n/**\n * The default block renderer for a `DraftEditor` component.\n *\n * A `DraftEditorBlock` is able to render a given `ContentBlock` to its\n * appropriate decorator and inline style components.\n */\n\n\nvar DraftEditorBlock =\n/*#__PURE__*/\nfunction (_React$Component) {\n  _inheritsLoose(DraftEditorBlock, _React$Component);\n\n  function DraftEditorBlock() {\n    var _this;\n\n    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n      args[_key] = arguments[_key];\n    }\n\n    _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;\n\n    _defineProperty(_assertThisInitialized(_this), \"_node\", void 0);\n\n    return _this;\n  }\n\n  var _proto = DraftEditorBlock.prototype;\n\n  _proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {\n    return this.props.block !== nextProps.block || this.props.tree !== nextProps.tree || this.props.direction !== nextProps.direction || isBlockOnSelectionEdge(nextProps.selection, nextProps.block.getKey()) && nextProps.forceSelection;\n  }\n  /**\n   * When a block is mounted and overlaps the selection state, we need to make\n   * sure that the cursor is visible to match native behavior. This may not\n   * be the case if the user has pressed `RETURN` or pasted some content, since\n   * programmatically creating these new blocks and setting the DOM selection\n   * will miss out on the browser natively scrolling to that position.\n   *\n   * To replicate native behavior, if the block overlaps the selection state\n   * on mount, force the scroll position. Check the scroll state of the scroll\n   * parent, and adjust it to align the entire block to the bottom of the\n   * scroll parent.\n   */\n  ;\n\n  _proto.componentDidMount = function componentDidMount() {\n    var selection = this.props.selection;\n    var endKey = selection.getEndKey();\n\n    if (!selection.getHasFocus() || endKey !== this.props.block.getKey()) {\n      return;\n    }\n\n    var blockNode = this._node;\n\n    if (blockNode == null) {\n      return;\n    }\n\n    var scrollParent = Style.getScrollParent(blockNode);\n    var scrollPosition = getScrollPosition(scrollParent);\n    var scrollDelta;\n\n    if (scrollParent === window) {\n      var nodePosition = getElementPosition(blockNode);\n      var nodeBottom = nodePosition.y + nodePosition.height;\n      var viewportHeight = getViewportDimensions().height;\n      scrollDelta = nodeBottom - viewportHeight;\n\n      if (scrollDelta > 0) {\n        window.scrollTo(scrollPosition.x, scrollPosition.y + scrollDelta + SCROLL_BUFFER);\n      }\n    } else {\n      !isHTMLElement(blockNode) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'blockNode is not an HTMLElement') : invariant(false) : void 0;\n      var blockBottom = blockNode.offsetHeight + blockNode.offsetTop;\n      var pOffset = scrollParent.offsetTop + scrollParent.offsetHeight;\n      var scrollBottom = pOffset + scrollPosition.y;\n      scrollDelta = blockBottom - scrollBottom;\n\n      if (scrollDelta > 0) {\n        Scroll.setTop(scrollParent, Scroll.getTop(scrollParent) + scrollDelta + SCROLL_BUFFER);\n      }\n    }\n  };\n\n  _proto._renderChildren = function _renderChildren() {\n    var _this2 = this;\n\n    var block = this.props.block;\n    var blockKey = block.getKey();\n    var text = block.getText();\n    var lastLeafSet = this.props.tree.size - 1;\n    var hasSelection = isBlockOnSelectionEdge(this.props.selection, blockKey);\n    return this.props.tree.map(function (leafSet, ii) {\n      var leavesForLeafSet = leafSet.get('leaves'); // T44088704\n\n      if (leavesForLeafSet.size === 0) {\n        return null;\n      }\n\n      var lastLeaf = leavesForLeafSet.size - 1;\n      var leaves = leavesForLeafSet.map(function (leaf, jj) {\n        var offsetKey = DraftOffsetKey.encode(blockKey, ii, jj);\n        var start = leaf.get('start');\n        var end = leaf.get('end');\n        return React.createElement(DraftEditorLeaf, {\n          key: offsetKey,\n          offsetKey: offsetKey,\n          block: block,\n          start: start,\n          selection: hasSelection ? _this2.props.selection : null,\n          forceSelection: _this2.props.forceSelection,\n          text: text.slice(start, end),\n          styleSet: block.getInlineStyleAt(start),\n          customStyleMap: _this2.props.customStyleMap,\n          customStyleFn: _this2.props.customStyleFn,\n          isLast: ii === lastLeafSet && jj === lastLeaf\n        });\n      }).toArray();\n      var decoratorKey = leafSet.get('decoratorKey');\n\n      if (decoratorKey == null) {\n        return leaves;\n      }\n\n      if (!_this2.props.decorator) {\n        return leaves;\n      }\n\n      var decorator = nullthrows(_this2.props.decorator);\n      var DecoratorComponent = decorator.getComponentForKey(decoratorKey);\n\n      if (!DecoratorComponent) {\n        return leaves;\n      }\n\n      var decoratorProps = decorator.getPropsForKey(decoratorKey);\n      var decoratorOffsetKey = DraftOffsetKey.encode(blockKey, ii, 0);\n      var start = leavesForLeafSet.first().get('start');\n      var end = leavesForLeafSet.last().get('end');\n      var decoratedText = text.slice(start, end);\n      var entityKey = block.getEntityAt(leafSet.get('start')); // Resetting dir to the same value on a child node makes Chrome/Firefox\n      // confused on cursor movement. See http://jsfiddle.net/d157kLck/3/\n\n      var dir = UnicodeBidiDirection.getHTMLDirIfDifferent(UnicodeBidi.getDirection(decoratedText), _this2.props.direction);\n      var commonProps = {\n        contentState: _this2.props.contentState,\n        decoratedText: decoratedText,\n        dir: dir,\n        key: decoratorOffsetKey,\n        start: start,\n        end: end,\n        blockKey: blockKey,\n        entityKey: entityKey,\n        offsetKey: decoratorOffsetKey\n      };\n      return React.createElement(DecoratorComponent, _extends({}, decoratorProps, commonProps), leaves);\n    }).toArray();\n  };\n\n  _proto.render = function render() {\n    var _this3 = this;\n\n    var _this$props = this.props,\n        direction = _this$props.direction,\n        offsetKey = _this$props.offsetKey;\n    var className = cx({\n      'public/DraftStyleDefault/block': true,\n      'public/DraftStyleDefault/ltr': direction === 'LTR',\n      'public/DraftStyleDefault/rtl': direction === 'RTL'\n    });\n    return React.createElement(\"div\", {\n      \"data-offset-key\": offsetKey,\n      className: className,\n      ref: function ref(_ref) {\n        return _this3._node = _ref;\n      }\n    }, this._renderChildren());\n  };\n\n  return DraftEditorBlock;\n}(React.Component);\n\nmodule.exports = DraftEditorBlock;", "/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n * @typechecks static-only\n */\n'use strict';\n/**\n * Combines multiple className strings into one.\n */\n\nfunction joinClasses(className) {\n  var newClassName = className || '';\n  var argLength = arguments.length;\n\n  if (argLength > 1) {\n    for (var index = 1; index < argLength; index++) {\n      var nextClass = arguments[index];\n\n      if (nextClass) {\n        newClassName = (newClassName ? newClassName + ' ' : '') + nextClass;\n      }\n    }\n  }\n\n  return newClassName;\n}\n\nmodule.exports = joinClasses;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar _assign = require(\"object-assign\");\n\nfunction _extends() { _extends = _assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nvar DraftEditorBlock = require(\"./DraftEditorBlock.react\");\n\nvar DraftOffsetKey = require(\"./DraftOffsetKey\");\n\nvar React = require(\"react\");\n\nvar cx = require(\"fbjs/lib/cx\");\n\nvar joinClasses = require(\"fbjs/lib/joinClasses\");\n\nvar nullthrows = require(\"fbjs/lib/nullthrows\");\n\n/**\n * Provide default styling for list items. This way, lists will be styled with\n * proper counters and indentation even if the caller does not specify\n * their own styling at all. If more than five levels of nesting are needed,\n * the necessary CSS classes can be provided via `blockStyleFn` configuration.\n */\nvar getListItemClasses = function getListItemClasses(type, depth, shouldResetCount, direction) {\n  return cx({\n    'public/DraftStyleDefault/unorderedListItem': type === 'unordered-list-item',\n    'public/DraftStyleDefault/orderedListItem': type === 'ordered-list-item',\n    'public/DraftStyleDefault/reset': shouldResetCount,\n    'public/DraftStyleDefault/depth0': depth === 0,\n    'public/DraftStyleDefault/depth1': depth === 1,\n    'public/DraftStyleDefault/depth2': depth === 2,\n    'public/DraftStyleDefault/depth3': depth === 3,\n    'public/DraftStyleDefault/depth4': depth >= 4,\n    'public/DraftStyleDefault/listLTR': direction === 'LTR',\n    'public/DraftStyleDefault/listRTL': direction === 'RTL'\n  });\n};\n/**\n * `DraftEditorContents` is the container component for all block components\n * rendered for a `DraftEditor`. It is optimized to aggressively avoid\n * re-rendering blocks whenever possible.\n *\n * This component is separate from `DraftEditor` because certain props\n * (for instance, ARIA props) must be allowed to update without affecting\n * the contents of the editor.\n */\n\n\nvar DraftEditorContents =\n/*#__PURE__*/\nfunction (_React$Component) {\n  _inheritsLoose(DraftEditorContents, _React$Component);\n\n  function DraftEditorContents() {\n    return _React$Component.apply(this, arguments) || this;\n  }\n\n  var _proto = DraftEditorContents.prototype;\n\n  _proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {\n    var prevEditorState = this.props.editorState;\n    var nextEditorState = nextProps.editorState;\n    var prevDirectionMap = prevEditorState.getDirectionMap();\n    var nextDirectionMap = nextEditorState.getDirectionMap(); // Text direction has changed for one or more blocks. We must re-render.\n\n    if (prevDirectionMap !== nextDirectionMap) {\n      return true;\n    }\n\n    var didHaveFocus = prevEditorState.getSelection().getHasFocus();\n    var nowHasFocus = nextEditorState.getSelection().getHasFocus();\n\n    if (didHaveFocus !== nowHasFocus) {\n      return true;\n    }\n\n    var nextNativeContent = nextEditorState.getNativelyRenderedContent();\n    var wasComposing = prevEditorState.isInCompositionMode();\n    var nowComposing = nextEditorState.isInCompositionMode(); // If the state is unchanged or we're currently rendering a natively\n    // rendered state, there's nothing new to be done.\n\n    if (prevEditorState === nextEditorState || nextNativeContent !== null && nextEditorState.getCurrentContent() === nextNativeContent || wasComposing && nowComposing) {\n      return false;\n    }\n\n    var prevContent = prevEditorState.getCurrentContent();\n    var nextContent = nextEditorState.getCurrentContent();\n    var prevDecorator = prevEditorState.getDecorator();\n    var nextDecorator = nextEditorState.getDecorator();\n    return wasComposing !== nowComposing || prevContent !== nextContent || prevDecorator !== nextDecorator || nextEditorState.mustForceSelection();\n  };\n\n  _proto.render = function render() {\n    var _this$props = this.props,\n        blockRenderMap = _this$props.blockRenderMap,\n        blockRendererFn = _this$props.blockRendererFn,\n        blockStyleFn = _this$props.blockStyleFn,\n        customStyleMap = _this$props.customStyleMap,\n        customStyleFn = _this$props.customStyleFn,\n        editorState = _this$props.editorState,\n        editorKey = _this$props.editorKey,\n        textDirectionality = _this$props.textDirectionality;\n    var content = editorState.getCurrentContent();\n    var selection = editorState.getSelection();\n    var forceSelection = editorState.mustForceSelection();\n    var decorator = editorState.getDecorator();\n    var directionMap = nullthrows(editorState.getDirectionMap());\n    var blocksAsArray = content.getBlocksAsArray();\n    var processedBlocks = [];\n    var currentDepth = null;\n    var lastWrapperTemplate = null;\n\n    for (var ii = 0; ii < blocksAsArray.length; ii++) {\n      var _block = blocksAsArray[ii];\n\n      var key = _block.getKey();\n\n      var blockType = _block.getType();\n\n      var customRenderer = blockRendererFn(_block);\n      var CustomComponent = void 0,\n          customProps = void 0,\n          customEditable = void 0;\n\n      if (customRenderer) {\n        CustomComponent = customRenderer.component;\n        customProps = customRenderer.props;\n        customEditable = customRenderer.editable;\n      }\n\n      var direction = textDirectionality ? textDirectionality : directionMap.get(key);\n      var offsetKey = DraftOffsetKey.encode(key, 0, 0);\n      var componentProps = {\n        contentState: content,\n        block: _block,\n        blockProps: customProps,\n        blockStyleFn: blockStyleFn,\n        customStyleMap: customStyleMap,\n        customStyleFn: customStyleFn,\n        decorator: decorator,\n        direction: direction,\n        forceSelection: forceSelection,\n        offsetKey: offsetKey,\n        selection: selection,\n        tree: editorState.getBlockTree(key)\n      };\n      var configForType = blockRenderMap.get(blockType) || blockRenderMap.get('unstyled');\n      var wrapperTemplate = configForType.wrapper;\n      var Element = configForType.element || blockRenderMap.get('unstyled').element;\n\n      var depth = _block.getDepth();\n\n      var _className = '';\n\n      if (blockStyleFn) {\n        _className = blockStyleFn(_block);\n      } // List items are special snowflakes, since we handle nesting and\n      // counters manually.\n\n\n      if (Element === 'li') {\n        var shouldResetCount = lastWrapperTemplate !== wrapperTemplate || currentDepth === null || depth > currentDepth;\n        _className = joinClasses(_className, getListItemClasses(blockType, depth, shouldResetCount, direction));\n      }\n\n      var Component = CustomComponent || DraftEditorBlock;\n      var childProps = {\n        className: _className,\n        'data-block': true,\n        'data-editor': editorKey,\n        'data-offset-key': offsetKey,\n        key: key\n      };\n\n      if (customEditable !== undefined) {\n        childProps = _objectSpread({}, childProps, {\n          contentEditable: customEditable,\n          suppressContentEditableWarning: true\n        });\n      }\n\n      var child = React.createElement(Element, childProps,\n      /* $FlowFixMe(>=0.112.0 site=mobile) This comment suppresses an error\n       * found when Flow v0.112 was deployed. To see the error delete this\n       * comment and run Flow. */\n\n      /* $FlowFixMe(>=0.112.0 site=www) This comment suppresses an error\n       * found when Flow v0.112 was deployed. To see the error delete this\n       * comment and run Flow. */\n\n      /* $FlowFixMe(>=0.112.0 site=www,mobile) This comment suppresses an\n       * error found when Flow v0.112 was deployed. To see the error delete\n       * this comment and run Flow. */\n      React.createElement(Component, _extends({}, componentProps, {\n        key: key\n      })));\n      processedBlocks.push({\n        block: child,\n        wrapperTemplate: wrapperTemplate,\n        key: key,\n        offsetKey: offsetKey\n      });\n\n      if (wrapperTemplate) {\n        currentDepth = _block.getDepth();\n      } else {\n        currentDepth = null;\n      }\n\n      lastWrapperTemplate = wrapperTemplate;\n    } // Group contiguous runs of blocks that have the same wrapperTemplate\n\n\n    var outputBlocks = [];\n\n    for (var _ii = 0; _ii < processedBlocks.length;) {\n      var info = processedBlocks[_ii];\n\n      if (info.wrapperTemplate) {\n        var blocks = [];\n\n        do {\n          blocks.push(processedBlocks[_ii].block);\n          _ii++;\n        } while (_ii < processedBlocks.length && processedBlocks[_ii].wrapperTemplate === info.wrapperTemplate);\n\n        var wrapperElement = React.cloneElement(info.wrapperTemplate, {\n          key: info.key + '-wrap',\n          'data-offset-key': info.offsetKey\n        }, blocks);\n        outputBlocks.push(wrapperElement);\n      } else {\n        outputBlocks.push(info.block);\n        _ii++;\n      }\n    }\n\n    return React.createElement(\"div\", {\n      \"data-contents\": \"true\"\n    }, outputBlocks);\n  };\n\n  return DraftEditorContents;\n}(React.Component);\n\nmodule.exports = DraftEditorContents;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n */\n'use strict';\n\nvar gkx = require(\"./gkx\");\n\nvar experimentalTreeDataSupport = gkx('draft_tree_data_support');\nmodule.exports = experimentalTreeDataSupport ? require(\"./DraftEditorContentsExperimental.react\") : require(\"./DraftEditorContents-core.react\");", "\"use strict\";\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\nvar PhotosMimeType = {\n  isImage: function isImage(mimeString) {\n    return getParts(mimeString)[0] === 'image';\n  },\n  isJpeg: function isJpeg(mimeString) {\n    var parts = getParts(mimeString);\n    return PhotosMimeType.isImage(mimeString) && ( // see http://fburl.com/10972194\n    parts[1] === 'jpeg' || parts[1] === 'pjpeg');\n  }\n};\n\nfunction getParts(mimeString) {\n  return mimeString.split('/');\n}\n\nmodule.exports = PhotosMimeType;", "\"use strict\";\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\nvar invariant = require(\"./invariant\");\n/**\n * Convert array-like objects to arrays.\n *\n * This API assumes the caller knows the contents of the data type. For less\n * well defined inputs use createArrayFromMixed.\n *\n * @param {object|function|filelist} obj\n * @return {array}\n */\n\n\nfunction toArray(obj) {\n  var length = obj.length; // Some browsers builtin objects can report typeof 'function' (e.g. NodeList\n  // in old versions of Safari).\n\n  !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : void 0;\n  !(typeof length === 'number') ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : void 0;\n  !(length === 0 || length - 1 in obj) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : void 0;\n  !(typeof obj.callee !== 'function') ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'toArray: Object can\\'t be `arguments`. Use rest params ' + '(function(...args) {}) or Array.from() instead.') : invariant(false) : void 0; // Old IE doesn't give collections access to hasOwnProperty. Assume inputs\n  // without method will throw during the slice call and skip straight to the\n  // fallback.\n\n  if (obj.hasOwnProperty) {\n    try {\n      return Array.prototype.slice.call(obj);\n    } catch (e) {// IE < 9 does not support Array#slice on collections objects\n    }\n  } // Fall back to copying key by key. This assumes all keys have a value,\n  // so will not preserve sparsely populated inputs.\n\n\n  var ret = Array(length);\n\n  for (var ii = 0; ii < length; ii++) {\n    ret[ii] = obj[ii];\n  }\n\n  return ret;\n}\n/**\n * Perform a heuristic test to determine if an object is \"array-like\".\n *\n *   A monk asked Joshu, a Zen master, \"Has a dog Buddha nature?\"\n *   Joshu replied: \"Mu.\"\n *\n * This function determines if its argument has \"array nature\": it returns\n * true if the argument is an actual array, an `arguments' object, or an\n * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).\n *\n * It will return false for other array-like objects like Filelist.\n *\n * @param {*} obj\n * @return {boolean}\n */\n\n\nfunction hasArrayNature(obj) {\n  return (// not null/false\n    !!obj && ( // arrays are objects, NodeLists are functions in Safari\n    typeof obj == 'object' || typeof obj == 'function') && // quacks like an array\n    'length' in obj && // not window\n    !('setInterval' in obj) && // no DOM node should be considered an array-like\n    // a 'select' element has 'length' and 'item' properties on IE8\n    typeof obj.nodeType != 'number' && ( // a real array\n    Array.isArray(obj) || // arguments\n    'callee' in obj || // HTMLCollection/NodeList\n    'item' in obj)\n  );\n}\n/**\n * Ensure that the argument is an array by wrapping it in an array if it is not.\n * Creates a copy of the argument if it is already an array.\n *\n * This is mostly useful idiomatically:\n *\n *   var createArrayFromMixed = require('createArrayFromMixed');\n *\n *   function takesOneOrMoreThings(things) {\n *     things = createArrayFromMixed(things);\n *     ...\n *   }\n *\n * This allows you to treat `things' as an array, but accept scalars in the API.\n *\n * If you need to convert an array-like object, like `arguments`, into an array\n * use toArray instead.\n *\n * @param {*} obj\n * @return {array}\n */\n\n\nfunction createArrayFromMixed(obj) {\n  if (!hasArrayNature(obj)) {\n    return [obj];\n  } else if (Array.isArray(obj)) {\n    return obj.slice();\n  } else {\n    return toArray(obj);\n  }\n}\n\nmodule.exports = createArrayFromMixed;", "\"use strict\";\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\nfunction makeEmptyFunction(arg) {\n  return function () {\n    return arg;\n  };\n}\n/**\n * This function accepts and discards inputs; it has no side effects. This is\n * primarily useful idiomatically for overridable function endpoints which\n * always need to be callable, since JS lacks a null-call idiom ala Cocoa.\n */\n\n\nvar emptyFunction = function emptyFunction() {};\n\nemptyFunction.thatReturns = makeEmptyFunction;\nemptyFunction.thatReturnsFalse = makeEmptyFunction(false);\nemptyFunction.thatReturnsTrue = makeEmptyFunction(true);\nemptyFunction.thatReturnsNull = makeEmptyFunction(null);\n\nemptyFunction.thatReturnsThis = function () {\n  return this;\n};\n\nemptyFunction.thatReturnsArgument = function (arg) {\n  return arg;\n};\n\nmodule.exports = emptyFunction;", "\"use strict\";\n\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\nvar PhotosMimeType = require(\"./PhotosMimeType\");\n\nvar createArrayFromMixed = require(\"./createArrayFromMixed\");\n\nvar emptyFunction = require(\"./emptyFunction\");\n\nvar CR_LF_REGEX = new RegExp(\"\\r\\n\", 'g');\nvar LF_ONLY = \"\\n\";\nvar RICH_TEXT_TYPES = {\n  'text/rtf': 1,\n  'text/html': 1\n};\n/**\n * If DataTransferItem is a file then return the Blob of data.\n *\n * @param {object} item\n * @return {?blob}\n */\n\nfunction getFileFromDataTransfer(item) {\n  if (item.kind == 'file') {\n    return item.getAsFile();\n  }\n}\n\nvar DataTransfer =\n/*#__PURE__*/\nfunction () {\n  /**\n   * @param {object} data\n   */\n  function DataTransfer(data) {\n    this.data = data; // Types could be DOMStringList or array\n\n    this.types = data.types ? createArrayFromMixed(data.types) : [];\n  }\n  /**\n   * Is this likely to be a rich text data transfer?\n   *\n   * @return {boolean}\n   */\n\n\n  var _proto = DataTransfer.prototype;\n\n  _proto.isRichText = function isRichText() {\n    // If HTML is available, treat this data as rich text. This way, we avoid\n    // using a pasted image if it is packaged with HTML -- this may occur with\n    // pastes from MS Word, for example.  However this is only rich text if\n    // there's accompanying text.\n    if (this.getHTML() && this.getText()) {\n      return true;\n    } // When an image is copied from a preview window, you end up with two\n    // DataTransferItems one of which is a file's metadata as text.  Skip those.\n\n\n    if (this.isImage()) {\n      return false;\n    }\n\n    return this.types.some(function (type) {\n      return RICH_TEXT_TYPES[type];\n    });\n  };\n  /**\n   * Get raw text.\n   *\n   * @return {?string}\n   */\n\n\n  _proto.getText = function getText() {\n    var text;\n\n    if (this.data.getData) {\n      if (!this.types.length) {\n        text = this.data.getData('Text');\n      } else if (this.types.indexOf('text/plain') != -1) {\n        text = this.data.getData('text/plain');\n      }\n    }\n\n    return text ? text.replace(CR_LF_REGEX, LF_ONLY) : null;\n  };\n  /**\n   * Get HTML paste data\n   *\n   * @return {?string}\n   */\n\n\n  _proto.getHTML = function getHTML() {\n    if (this.data.getData) {\n      if (!this.types.length) {\n        return this.data.getData('Text');\n      } else if (this.types.indexOf('text/html') != -1) {\n        return this.data.getData('text/html');\n      }\n    }\n  };\n  /**\n   * Is this a link data transfer?\n   *\n   * @return {boolean}\n   */\n\n\n  _proto.isLink = function isLink() {\n    return this.types.some(function (type) {\n      return type.indexOf('Url') != -1 || type.indexOf('text/uri-list') != -1 || type.indexOf('text/x-moz-url');\n    });\n  };\n  /**\n   * Get a link url.\n   *\n   * @return {?string}\n   */\n\n\n  _proto.getLink = function getLink() {\n    if (this.data.getData) {\n      if (this.types.indexOf('text/x-moz-url') != -1) {\n        var url = this.data.getData('text/x-moz-url').split('\\n');\n        return url[0];\n      }\n\n      return this.types.indexOf('text/uri-list') != -1 ? this.data.getData('text/uri-list') : this.data.getData('url');\n    }\n\n    return null;\n  };\n  /**\n   * Is this an image data transfer?\n   *\n   * @return {boolean}\n   */\n\n\n  _proto.isImage = function isImage() {\n    var isImage = this.types.some(function (type) {\n      // Firefox will have a type of application/x-moz-file for images during\n      // dragging\n      return type.indexOf('application/x-moz-file') != -1;\n    });\n\n    if (isImage) {\n      return true;\n    }\n\n    var items = this.getFiles();\n\n    for (var i = 0; i < items.length; i++) {\n      var type = items[i].type;\n\n      if (!PhotosMimeType.isImage(type)) {\n        return false;\n      }\n    }\n\n    return true;\n  };\n\n  _proto.getCount = function getCount() {\n    if (this.data.hasOwnProperty('items')) {\n      return this.data.items.length;\n    } else if (this.data.hasOwnProperty('mozItemCount')) {\n      return this.data.mozItemCount;\n    } else if (this.data.files) {\n      return this.data.files.length;\n    }\n\n    return null;\n  };\n  /**\n   * Get files.\n   *\n   * @return {array}\n   */\n\n\n  _proto.getFiles = function getFiles() {\n    if (this.data.items) {\n      // createArrayFromMixed doesn't properly handle DataTransferItemLists.\n      return Array.prototype.slice.call(this.data.items).map(getFileFromDataTransfer).filter(emptyFunction.thatReturnsArgument);\n    } else if (this.data.files) {\n      return Array.prototype.slice.call(this.data.files);\n    } else {\n      return [];\n    }\n  };\n  /**\n   * Are there any files to fetch?\n   *\n   * @return {boolean}\n   */\n\n\n  _proto.hasFiles = function hasFiles() {\n    return this.getFiles().length > 0;\n  };\n\n  return DataTransfer;\n}();\n\nmodule.exports = DataTransfer;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar TEXT_CLIPPING_REGEX = /\\.textClipping$/;\nvar TEXT_TYPES = {\n  'text/plain': true,\n  'text/html': true,\n  'text/rtf': true\n}; // Somewhat arbitrary upper bound on text size. Let's not lock up the browser.\n\nvar TEXT_SIZE_UPPER_BOUND = 5000;\n/**\n * Extract the text content from a file list.\n */\n\nfunction getTextContentFromFiles(files, callback) {\n  var readCount = 0;\n  var results = [];\n  files.forEach(function (\n  /*blob*/\n  file) {\n    readFile(file, function (\n    /*string*/\n    text) {\n      readCount++;\n      text && results.push(text.slice(0, TEXT_SIZE_UPPER_BOUND));\n\n      if (readCount == files.length) {\n        callback(results.join('\\r'));\n      }\n    });\n  });\n}\n/**\n * todo isaac: Do work to turn html/rtf into a content fragment.\n */\n\n\nfunction readFile(file, callback) {\n  if (!global.FileReader || file.type && !(file.type in TEXT_TYPES)) {\n    callback('');\n    return;\n  }\n\n  if (file.type === '') {\n    var _contents = ''; // Special-case text clippings, which have an empty type but include\n    // `.textClipping` in the file name. `readAsText` results in an empty\n    // string for text clippings, so we force the file name to serve\n    // as the text value for the file.\n\n    if (TEXT_CLIPPING_REGEX.test(file.name)) {\n      _contents = file.name.replace(TEXT_CLIPPING_REGEX, '');\n    }\n\n    callback(_contents);\n    return;\n  }\n\n  var reader = new FileReader();\n\n  reader.onload = function () {\n    var result = reader.result;\n    !(typeof result === 'string') ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'We should be calling \"FileReader.readAsText\" which returns a string') : invariant(false) : void 0;\n    callback(result);\n  };\n\n  reader.onerror = function () {\n    callback('');\n  };\n\n  reader.readAsText(file);\n}\n\nmodule.exports = getTextContentFromFiles;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\n/**\n * Utility method for determining whether or not the value returned\n * from a handler indicates that it was handled.\n */\nfunction isEventHandled(value) {\n  return value === 'handled' || value === true;\n}\n\nmodule.exports = isEventHandled;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar DataTransfer = require(\"fbjs/lib/DataTransfer\");\n\nvar DraftModifier = require(\"./DraftModifier\");\n\nvar EditorState = require(\"./EditorState\");\n\nvar ReactDOM = require(\"react-dom\");\n\nvar findAncestorOffsetKey = require(\"./findAncestorOffsetKey\");\n\nvar getCorrectDocumentFromNode = require(\"./getCorrectDocumentFromNode\");\n\nvar getTextContentFromFiles = require(\"./getTextContentFromFiles\");\n\nvar getUpdatedSelectionState = require(\"./getUpdatedSelectionState\");\n\nvar getWindowForNode = require(\"./getWindowForNode\");\n\nvar isEventHandled = require(\"./isEventHandled\");\n\nvar nullthrows = require(\"fbjs/lib/nullthrows\");\n/**\n * Get a SelectionState for the supplied mouse event.\n */\n\n\nfunction getSelectionForEvent(event, editorState) {\n  var node = null;\n  var offset = null;\n  var eventTargetDocument = getCorrectDocumentFromNode(event.currentTarget);\n  /* $FlowFixMe(>=0.68.0 site=www,mobile) This comment suppresses an error\n   * found when Flow v0.68 was deployed. To see the error delete this comment\n   * and run Flow. */\n\n  if (typeof eventTargetDocument.caretRangeFromPoint === 'function') {\n    var dropRange = eventTargetDocument.caretRangeFromPoint(event.x, event.y);\n    node = dropRange.startContainer;\n    offset = dropRange.startOffset;\n  } else if (event.rangeParent) {\n    node = event.rangeParent;\n    offset = event.rangeOffset;\n  } else {\n    return null;\n  }\n\n  node = nullthrows(node);\n  offset = nullthrows(offset);\n  var offsetKey = nullthrows(findAncestorOffsetKey(node));\n  return getUpdatedSelectionState(editorState, offsetKey, offset, offsetKey, offset);\n}\n\nvar DraftEditorDragHandler = {\n  /**\n   * Drag originating from input terminated.\n   */\n  onDragEnd: function onDragEnd(editor) {\n    editor.exitCurrentMode();\n    endDrag(editor);\n  },\n\n  /**\n   * Handle data being dropped.\n   */\n  onDrop: function onDrop(editor, e) {\n    var data = new DataTransfer(e.nativeEvent.dataTransfer);\n    var editorState = editor._latestEditorState;\n    var dropSelection = getSelectionForEvent(e.nativeEvent, editorState);\n    e.preventDefault();\n    editor._dragCount = 0;\n    editor.exitCurrentMode();\n\n    if (dropSelection == null) {\n      return;\n    }\n    /* $FlowFixMe This comment suppresses an error found DataTransfer was typed.\n     * getFiles() returns an array of <Files extends Blob>, not Blob */\n\n\n    var files = data.getFiles();\n\n    if (files.length > 0) {\n      if (editor.props.handleDroppedFiles && isEventHandled(editor.props.handleDroppedFiles(dropSelection, files))) {\n        return;\n      }\n\n      getTextContentFromFiles(files, function (fileText) {\n        fileText && editor.update(insertTextAtSelection(editorState, dropSelection, fileText));\n      });\n      return;\n    }\n\n    var dragType = editor._internalDrag ? 'internal' : 'external';\n\n    if (editor.props.handleDrop && isEventHandled(editor.props.handleDrop(dropSelection, data, dragType))) {// handled\n    } else if (editor._internalDrag) {\n      editor.update(moveText(editorState, dropSelection));\n    } else {\n      editor.update(insertTextAtSelection(editorState, dropSelection, data.getText()));\n    }\n\n    endDrag(editor);\n  }\n};\n\nfunction endDrag(editor) {\n  editor._internalDrag = false; // Fix issue #1383\n  // Prior to React v16.5.0 onDrop breaks onSelect event:\n  // https://github.com/facebook/react/issues/11379.\n  // Dispatching a mouseup event on DOM node will make it go back to normal.\n\n  var editorNode = ReactDOM.findDOMNode(editor);\n\n  if (editorNode) {\n    var mouseUpEvent = new MouseEvent('mouseup', {\n      view: getWindowForNode(editorNode),\n      bubbles: true,\n      cancelable: true\n    });\n    editorNode.dispatchEvent(mouseUpEvent);\n  }\n}\n\nfunction moveText(editorState, targetSelection) {\n  var newContentState = DraftModifier.moveText(editorState.getCurrentContent(), editorState.getSelection(), targetSelection);\n  return EditorState.push(editorState, newContentState, 'insert-fragment');\n}\n/**\n * Insert text at a specified selection.\n */\n\n\nfunction insertTextAtSelection(editorState, selection, text) {\n  var newContentState = DraftModifier.insertText(editorState.getCurrentContent(), selection, text, editorState.getCurrentInlineStyle());\n  return EditorState.push(editorState, newContentState, 'insert-fragment');\n}\n\nmodule.exports = DraftEditorDragHandler;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nfunction isSelectionAtLeafStart(editorState) {\n  var selection = editorState.getSelection();\n  var anchorKey = selection.getAnchorKey();\n  var blockTree = editorState.getBlockTree(anchorKey);\n  var offset = selection.getStartOffset();\n  var isAtStart = false;\n  blockTree.some(function (leafSet) {\n    if (offset === leafSet.get('start')) {\n      isAtStart = true;\n      return true;\n    }\n\n    if (offset < leafSet.get('end')) {\n      return leafSet.get('leaves').some(function (leaf) {\n        var leafStart = leaf.get('start');\n\n        if (offset === leafStart) {\n          isAtStart = true;\n          return true;\n        }\n\n        return false;\n      });\n    }\n\n    return false;\n  });\n  return isAtStart;\n}\n\nmodule.exports = isSelectionAtLeafStart;", "(function (global, undefined) {\n    \"use strict\";\n\n    if (global.setImmediate) {\n        return;\n    }\n\n    var nextHandle = 1; // Spec says greater than zero\n    var tasksByHandle = {};\n    var currentlyRunningATask = false;\n    var doc = global.document;\n    var registerImmediate;\n\n    function setImmediate(callback) {\n      // Callback can either be a function or a string\n      if (typeof callback !== \"function\") {\n        callback = new Function(\"\" + callback);\n      }\n      // Copy function arguments\n      var args = new Array(arguments.length - 1);\n      for (var i = 0; i < args.length; i++) {\n          args[i] = arguments[i + 1];\n      }\n      // Store and register the task\n      var task = { callback: callback, args: args };\n      tasksByHandle[nextHandle] = task;\n      registerImmediate(nextHandle);\n      return nextHandle++;\n    }\n\n    function clearImmediate(handle) {\n        delete tasksByHandle[handle];\n    }\n\n    function run(task) {\n        var callback = task.callback;\n        var args = task.args;\n        switch (args.length) {\n        case 0:\n            callback();\n            break;\n        case 1:\n            callback(args[0]);\n            break;\n        case 2:\n            callback(args[0], args[1]);\n            break;\n        case 3:\n            callback(args[0], args[1], args[2]);\n            break;\n        default:\n            callback.apply(undefined, args);\n            break;\n        }\n    }\n\n    function runIfPresent(handle) {\n        // From the spec: \"Wait until any invocations of this algorithm started before this one have completed.\"\n        // So if we're currently running a task, we'll need to delay this invocation.\n        if (currentlyRunningATask) {\n            // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a\n            // \"too much recursion\" error.\n            setTimeout(runIfPresent, 0, handle);\n        } else {\n            var task = tasksByHandle[handle];\n            if (task) {\n                currentlyRunningATask = true;\n                try {\n                    run(task);\n                } finally {\n                    clearImmediate(handle);\n                    currentlyRunningATask = false;\n                }\n            }\n        }\n    }\n\n    function installNextTickImplementation() {\n        registerImmediate = function(handle) {\n            process.nextTick(function () { runIfPresent(handle); });\n        };\n    }\n\n    function canUsePostMessage() {\n        // The test against `importScripts` prevents this implementation from being installed inside a web worker,\n        // where `global.postMessage` means something completely different and can't be used for this purpose.\n        if (global.postMessage && !global.importScripts) {\n            var postMessageIsAsynchronous = true;\n            var oldOnMessage = global.onmessage;\n            global.onmessage = function() {\n                postMessageIsAsynchronous = false;\n            };\n            global.postMessage(\"\", \"*\");\n            global.onmessage = oldOnMessage;\n            return postMessageIsAsynchronous;\n        }\n    }\n\n    function installPostMessageImplementation() {\n        // Installs an event handler on `global` for the `message` event: see\n        // * https://developer.mozilla.org/en/DOM/window.postMessage\n        // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages\n\n        var messagePrefix = \"setImmediate$\" + Math.random() + \"$\";\n        var onGlobalMessage = function(event) {\n            if (event.source === global &&\n                typeof event.data === \"string\" &&\n                event.data.indexOf(messagePrefix) === 0) {\n                runIfPresent(+event.data.slice(messagePrefix.length));\n            }\n        };\n\n        if (global.addEventListener) {\n            global.addEventListener(\"message\", onGlobalMessage, false);\n        } else {\n            global.attachEvent(\"onmessage\", onGlobalMessage);\n        }\n\n        registerImmediate = function(handle) {\n            global.postMessage(messagePrefix + handle, \"*\");\n        };\n    }\n\n    function installMessageChannelImplementation() {\n        var channel = new MessageChannel();\n        channel.port1.onmessage = function(event) {\n            var handle = event.data;\n            runIfPresent(handle);\n        };\n\n        registerImmediate = function(handle) {\n            channel.port2.postMessage(handle);\n        };\n    }\n\n    function installReadyStateChangeImplementation() {\n        var html = doc.documentElement;\n        registerImmediate = function(handle) {\n            // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted\n            // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.\n            var script = doc.createElement(\"script\");\n            script.onreadystatechange = function () {\n                runIfPresent(handle);\n                script.onreadystatechange = null;\n                html.removeChild(script);\n                script = null;\n            };\n            html.appendChild(script);\n        };\n    }\n\n    function installSetTimeoutImplementation() {\n        registerImmediate = function(handle) {\n            setTimeout(runIfPresent, 0, handle);\n        };\n    }\n\n    // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.\n    var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);\n    attachTo = attachTo && attachTo.setTimeout ? attachTo : global;\n\n    // Don't get fooled by e.g. browserify environments.\n    if ({}.toString.call(global.process) === \"[object process]\") {\n        // For Node.js before 0.9\n        installNextTickImplementation();\n\n    } else if (canUsePostMessage()) {\n        // For non-IE10 modern browsers\n        installPostMessageImplementation();\n\n    } else if (global.MessageChannel) {\n        // For web workers, where supported\n        installMessageChannelImplementation();\n\n    } else if (doc && \"onreadystatechange\" in doc.createElement(\"script\")) {\n        // For IE 6\u20138\n        installReadyStateChangeImplementation();\n\n    } else {\n        // For older browsers\n        installSetTimeoutImplementation();\n    }\n\n    attachTo.setImmediate = setImmediate;\n    attachTo.clearImmediate = clearImmediate;\n}(typeof self === \"undefined\" ? typeof global === \"undefined\" ? this : global : self));\n", "/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n'use strict'; // setimmediate adds setImmediate to the global. We want to make sure we export\n// the actual function.\n\nrequire(\"setimmediate\");\n\nmodule.exports = global.setImmediate;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar DraftModifier = require(\"./DraftModifier\");\n\nvar EditorState = require(\"./EditorState\");\n\nvar UserAgent = require(\"fbjs/lib/UserAgent\");\n\nvar getEntityKeyForSelection = require(\"./getEntityKeyForSelection\");\n\nvar isEventHandled = require(\"./isEventHandled\");\n\nvar isSelectionAtLeafStart = require(\"./isSelectionAtLeafStart\");\n\nvar nullthrows = require(\"fbjs/lib/nullthrows\");\n\nvar setImmediate = require(\"fbjs/lib/setImmediate\"); // When nothing is focused, Firefox regards two characters, `'` and `/`, as\n// commands that should open and focus the \"quickfind\" search bar. This should\n// *never* happen while a contenteditable is focused, but as of v28, it\n// sometimes does, even when the keypress event target is the contenteditable.\n// This breaks the input. Special case these characters to ensure that when\n// they are typed, we prevent default on the event to make sure not to\n// trigger quickfind.\n\n\nvar FF_QUICKFIND_CHAR = \"'\";\nvar FF_QUICKFIND_LINK_CHAR = '/';\nvar isFirefox = UserAgent.isBrowser('Firefox');\n\nfunction mustPreventDefaultForCharacter(character) {\n  return isFirefox && (character == FF_QUICKFIND_CHAR || character == FF_QUICKFIND_LINK_CHAR);\n}\n/**\n * Replace the current selection with the specified text string, with the\n * inline style and entity key applied to the newly inserted text.\n */\n\n\nfunction replaceText(editorState, text, inlineStyle, entityKey, forceSelection) {\n  var contentState = DraftModifier.replaceText(editorState.getCurrentContent(), editorState.getSelection(), text, inlineStyle, entityKey);\n  return EditorState.push(editorState, contentState, 'insert-characters', forceSelection);\n}\n/**\n * When `onBeforeInput` executes, the browser is attempting to insert a\n * character into the editor. Apply this character data to the document,\n * allowing native insertion if possible.\n *\n * Native insertion is encouraged in order to limit re-rendering and to\n * preserve spellcheck highlighting, which disappears or flashes if re-render\n * occurs on the relevant text nodes.\n */\n\n\nfunction editOnBeforeInput(editor, e) {\n  if (editor._pendingStateFromBeforeInput !== undefined) {\n    editor.update(editor._pendingStateFromBeforeInput);\n    editor._pendingStateFromBeforeInput = undefined;\n  }\n\n  var editorState = editor._latestEditorState;\n  var chars = e.data; // In some cases (ex: IE ideographic space insertion) no character data\n  // is provided. There's nothing to do when this happens.\n\n  if (!chars) {\n    return;\n  } // Allow the top-level component to handle the insertion manually. This is\n  // useful when triggering interesting behaviors for a character insertion,\n  // Simple examples: replacing a raw text ':)' with a smile emoji or image\n  // decorator, or setting a block to be a list item after typing '- ' at the\n  // start of the block.\n\n\n  if (editor.props.handleBeforeInput && isEventHandled(editor.props.handleBeforeInput(chars, editorState, e.timeStamp))) {\n    e.preventDefault();\n    return;\n  } // If selection is collapsed, conditionally allow native behavior. This\n  // reduces re-renders and preserves spellcheck highlighting. If the selection\n  // is not collapsed, we will re-render.\n\n\n  var selection = editorState.getSelection();\n  var selectionStart = selection.getStartOffset();\n  var anchorKey = selection.getAnchorKey();\n\n  if (!selection.isCollapsed()) {\n    e.preventDefault();\n    editor.update(replaceText(editorState, chars, editorState.getCurrentInlineStyle(), getEntityKeyForSelection(editorState.getCurrentContent(), editorState.getSelection()), true));\n    return;\n  }\n\n  var newEditorState = replaceText(editorState, chars, editorState.getCurrentInlineStyle(), getEntityKeyForSelection(editorState.getCurrentContent(), editorState.getSelection()), false); // Bunch of different cases follow where we need to prevent native insertion.\n\n  var mustPreventNative = false;\n\n  if (!mustPreventNative) {\n    // Browsers tend to insert text in weird places in the DOM when typing at\n    // the start of a leaf, so we'll handle it ourselves.\n    mustPreventNative = isSelectionAtLeafStart(editor._latestCommittedEditorState);\n  }\n\n  if (!mustPreventNative) {\n    // Chrome will also split up a node into two pieces if it contains a Tab\n    // char, for no explicable reason. Seemingly caused by this commit:\n    // https://chromium.googlesource.com/chromium/src/+/013ac5eaf3%5E%21/\n    // in test environment, e.target is not available\n    var nativeSelection = (e.currentTarget ? e.currentTarget.ownerDocument.defaultView : global).getSelection(); // Selection is necessarily collapsed at this point due to earlier check.\n\n    if (nativeSelection.anchorNode && nativeSelection.anchorNode.nodeType === Node.TEXT_NODE) {\n      // See isTabHTMLSpanElement in chromium EditingUtilities.cpp.\n      var parentNode = nativeSelection.anchorNode.parentNode;\n      mustPreventNative = parentNode.nodeName === 'SPAN' && parentNode.firstChild.nodeType === Node.TEXT_NODE && parentNode.firstChild.nodeValue.indexOf('\\t') !== -1;\n    }\n  }\n\n  if (!mustPreventNative) {\n    // Let's say we have a decorator that highlights hashtags. In many cases\n    // we need to prevent native behavior and rerender ourselves --\n    // particularly, any case *except* where the inserted characters end up\n    // anywhere except exactly where you put them.\n    //\n    // Using [] to denote a decorated leaf, some examples:\n    //\n    // 1. 'hi #' and append 'f'\n    // desired rendering: 'hi [#f]'\n    // native rendering would be: 'hi #f' (incorrect)\n    //\n    // 2. 'x [#foo]' and insert '#' before 'f'\n    // desired rendering: 'x #[#foo]'\n    // native rendering would be: 'x [##foo]' (incorrect)\n    //\n    // 3. '[#foobar]' and insert ' ' between 'foo' and 'bar'\n    // desired rendering: '[#foo] bar'\n    // native rendering would be: '[#foo bar]' (incorrect)\n    //\n    // 4. '[#foo]' and delete '#' [won't use this beforeinput codepath though]\n    // desired rendering: 'foo'\n    // native rendering would be: '[foo]' (incorrect)\n    //\n    // 5. '[#foo]' and append 'b'\n    // desired rendering: '[#foob]'\n    // native rendering would be: '[#foob]'\n    // (native insertion here would be ok for decorators like simple spans,\n    // but not more complex decorators. To be safe, we need to prevent it.)\n    //\n    // It is safe to allow native insertion if and only if the full list of\n    // decorator ranges matches what we expect native insertion to give, and\n    // the range lengths have not changed. We don't need to compare the content\n    // because the only possible mutation to consider here is inserting plain\n    // text and decorators can't affect text content.\n    var oldBlockTree = editorState.getBlockTree(anchorKey);\n    var newBlockTree = newEditorState.getBlockTree(anchorKey);\n    mustPreventNative = oldBlockTree.size !== newBlockTree.size || oldBlockTree.zip(newBlockTree).some(function (_ref) {\n      var oldLeafSet = _ref[0],\n          newLeafSet = _ref[1];\n      // selectionStart is guaranteed to be selectionEnd here\n      var oldStart = oldLeafSet.get('start');\n      var adjustedStart = oldStart + (oldStart >= selectionStart ? chars.length : 0);\n      var oldEnd = oldLeafSet.get('end');\n      var adjustedEnd = oldEnd + (oldEnd >= selectionStart ? chars.length : 0);\n      var newStart = newLeafSet.get('start');\n      var newEnd = newLeafSet.get('end');\n      var newDecoratorKey = newLeafSet.get('decoratorKey');\n      return (// Different decorators\n        oldLeafSet.get('decoratorKey') !== newDecoratorKey || // Different number of inline styles\n        oldLeafSet.get('leaves').size !== newLeafSet.get('leaves').size || // Different effective decorator position\n        adjustedStart !== newStart || adjustedEnd !== newEnd || // Decorator already existed and its length changed\n        newDecoratorKey != null && newEnd - newStart !== oldEnd - oldStart\n      );\n    });\n  }\n\n  if (!mustPreventNative) {\n    mustPreventNative = mustPreventDefaultForCharacter(chars);\n  }\n\n  if (!mustPreventNative) {\n    mustPreventNative = nullthrows(newEditorState.getDirectionMap()).get(anchorKey) !== nullthrows(editorState.getDirectionMap()).get(anchorKey);\n  }\n\n  if (mustPreventNative) {\n    e.preventDefault();\n    newEditorState = EditorState.set(newEditorState, {\n      forceSelection: true\n    });\n    editor.update(newEditorState);\n    return;\n  } // We made it all the way! Let the browser do its thing and insert the char.\n\n\n  newEditorState = EditorState.set(newEditorState, {\n    nativelyRenderedContent: newEditorState.getCurrentContent()\n  }); // The native event is allowed to occur. To allow user onChange handlers to\n  // change the inserted text, we wait until the text is actually inserted\n  // before we actually update our state. That way when we rerender, the text\n  // we see in the DOM will already have been inserted properly.\n\n  editor._pendingStateFromBeforeInput = newEditorState;\n  setImmediate(function () {\n    if (editor._pendingStateFromBeforeInput !== undefined) {\n      editor.update(editor._pendingStateFromBeforeInput);\n      editor._pendingStateFromBeforeInput = undefined;\n    }\n  });\n}\n\nmodule.exports = editOnBeforeInput;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar EditorState = require(\"./EditorState\");\n\nvar containsNode = require(\"fbjs/lib/containsNode\");\n\nvar getActiveElement = require(\"fbjs/lib/getActiveElement\");\n\nfunction editOnBlur(editor, e) {\n  // In a contentEditable element, when you select a range and then click\n  // another active element, this does trigger a `blur` event but will not\n  // remove the DOM selection from the contenteditable.\n  // This is consistent across all browsers, but we prefer that the editor\n  // behave like a textarea, where a `blur` event clears the DOM selection.\n  // We therefore force the issue to be certain, checking whether the active\n  // element is `body` to force it when blurring occurs within the window (as\n  // opposed to clicking to another tab or window).\n  var ownerDocument = e.currentTarget.ownerDocument;\n\n  if (!Boolean(editor.props.preserveSelectionOnBlur) && getActiveElement(ownerDocument) === ownerDocument.body) {\n    var _selection = ownerDocument.defaultView.getSelection();\n\n    var editorNode = editor.editor;\n\n    if (_selection.rangeCount === 1 && containsNode(editorNode, _selection.anchorNode) && containsNode(editorNode, _selection.focusNode)) {\n      _selection.removeAllRanges();\n    }\n  }\n\n  var editorState = editor._latestEditorState;\n  var currentSelection = editorState.getSelection();\n\n  if (!currentSelection.getHasFocus()) {\n    return;\n  }\n\n  var selection = currentSelection.set('hasFocus', false);\n  editor.props.onBlur && editor.props.onBlur(e);\n  editor.update(EditorState.acceptSelection(editorState, selection));\n}\n\nmodule.exports = editOnBlur;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar EditorState = require(\"./EditorState\");\n/**\n * The user has begun using an IME input system. Switching to `composite` mode\n * allows handling composition input and disables other edit behavior.\n */\n\n\nfunction editOnCompositionStart(editor, e) {\n  editor.setMode('composite');\n  editor.update(EditorState.set(editor._latestEditorState, {\n    inCompositionMode: true\n  })); // Allow composition handler to interpret the compositionstart event\n\n  editor._onCompositionStart(e);\n}\n\nmodule.exports = editOnCompositionStart;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar getContentStateFragment = require(\"./getContentStateFragment\");\n\nfunction getFragmentFromSelection(editorState) {\n  var selectionState = editorState.getSelection();\n\n  if (selectionState.isCollapsed()) {\n    return null;\n  }\n\n  return getContentStateFragment(editorState.getCurrentContent(), selectionState);\n}\n\nmodule.exports = getFragmentFromSelection;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar getFragmentFromSelection = require(\"./getFragmentFromSelection\");\n/**\n * If we have a selection, create a ContentState fragment and store\n * it in our internal clipboard. Subsequent paste events will use this\n * fragment if no external clipboard data is supplied.\n */\n\n\nfunction editOnCopy(editor, e) {\n  var editorState = editor._latestEditorState;\n  var selection = editorState.getSelection(); // No selection, so there's nothing to copy.\n\n  if (selection.isCollapsed()) {\n    e.preventDefault();\n    return;\n  }\n\n  editor.setClipboard(getFragmentFromSelection(editor._latestEditorState));\n}\n\nmodule.exports = editOnCopy;", "\"use strict\";\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\nfunction isInstanceOfNode(target) {\n  // we changed the name because of having duplicate module provider (fbjs)\n  if (!target || !('ownerDocument' in target)) {\n    return false;\n  }\n\n  if ('ownerDocument' in target) {\n    var node = target;\n\n    if (!node.ownerDocument.defaultView) {\n      return node instanceof Node;\n    } // $FlowFixMe https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11508#issuecomment-256045682\n\n\n    if (node instanceof node.ownerDocument.defaultView.Node) {\n      return true;\n    }\n  }\n\n  return false;\n}\n\nmodule.exports = isInstanceOfNode;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar DraftModifier = require(\"./DraftModifier\");\n\nvar EditorState = require(\"./EditorState\");\n\nvar Style = require(\"fbjs/lib/Style\");\n\nvar getFragmentFromSelection = require(\"./getFragmentFromSelection\");\n\nvar getScrollPosition = require(\"fbjs/lib/getScrollPosition\");\n\nvar isNode = require(\"./isInstanceOfNode\");\n/**\n * On `cut` events, native behavior is allowed to occur so that the system\n * clipboard is set properly. This means that we need to take steps to recover\n * the editor DOM state after the `cut` has occurred in order to maintain\n * control of the component.\n *\n * In addition, we can keep a copy of the removed fragment, including all\n * styles and entities, for use as an internal paste.\n */\n\n\nfunction editOnCut(editor, e) {\n  var editorState = editor._latestEditorState;\n  var selection = editorState.getSelection();\n  var element = e.target;\n  var scrollPosition; // No selection, so there's nothing to cut.\n\n  if (selection.isCollapsed()) {\n    e.preventDefault();\n    return;\n  } // Track the current scroll position so that it can be forced back in place\n  // after the editor regains control of the DOM.\n\n\n  if (isNode(element)) {\n    var node = element;\n    scrollPosition = getScrollPosition(Style.getScrollParent(node));\n  }\n\n  var fragment = getFragmentFromSelection(editorState);\n  editor.setClipboard(fragment); // Set `cut` mode to disable all event handling temporarily.\n\n  editor.setMode('cut'); // Let native `cut` behavior occur, then recover control.\n\n  setTimeout(function () {\n    editor.restoreEditorDOM(scrollPosition);\n    editor.exitCurrentMode();\n    editor.update(removeFragment(editorState));\n  }, 0);\n}\n\nfunction removeFragment(editorState) {\n  var newContent = DraftModifier.removeRange(editorState.getCurrentContent(), editorState.getSelection(), 'forward');\n  return EditorState.push(editorState, newContent, 'remove-range');\n}\n\nmodule.exports = editOnCut;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\n/**\n * Drag behavior has begun from outside the editor element.\n */\nfunction editOnDragOver(editor, e) {\n  editor.setMode('drag');\n  e.preventDefault();\n}\n\nmodule.exports = editOnDragOver;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\n/**\n * A `dragstart` event has begun within the text editor component.\n */\nfunction editOnDragStart(editor) {\n  editor._internalDrag = true;\n  editor.setMode('drag');\n}\n\nmodule.exports = editOnDragStart;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar EditorState = require(\"./EditorState\");\n\nvar UserAgent = require(\"fbjs/lib/UserAgent\");\n\nfunction editOnFocus(editor, e) {\n  var editorState = editor._latestEditorState;\n  var currentSelection = editorState.getSelection();\n\n  if (currentSelection.getHasFocus()) {\n    return;\n  }\n\n  var selection = currentSelection.set('hasFocus', true);\n  editor.props.onFocus && editor.props.onFocus(e); // When the tab containing this text editor is hidden and the user does a\n  // find-in-page in a _different_ tab, Chrome on Mac likes to forget what the\n  // selection was right after sending this focus event and (if you let it)\n  // moves the cursor back to the beginning of the editor, so we force the\n  // selection here instead of simply accepting it in order to preserve the\n  // old cursor position. See https://crbug.com/540004.\n  // But it looks like this is fixed in Chrome 60.0.3081.0.\n  // Other browsers also don't have this bug, so we prefer to acceptSelection\n  // when possible, to ensure that unfocusing and refocusing a Draft editor\n  // doesn't preserve the selection, matching how textareas work.\n\n  if (UserAgent.isBrowser('Chrome < 60.0.3081.0')) {\n    editor.update(EditorState.forceSelection(editorState, selection));\n  } else {\n    editor.update(EditorState.acceptSelection(editorState, selection));\n  }\n}\n\nmodule.exports = editOnFocus;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * Provides utilities for handling draftjs keys.\n *\n * @emails oncall+draft_js\n * \n * @format\n */\n'use strict';\n\nfunction notEmptyKey(key) {\n  return key != null && key != '';\n}\n\nmodule.exports = {\n  notEmptyKey: notEmptyKey\n};", "/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n */\n\n/**\n * Unicode-enabled replacesments for basic String functions.\n *\n * All the functions in this module assume that the input string is a valid\n * UTF-16 encoding of a Unicode sequence. If it's not the case, the behavior\n * will be undefined.\n *\n * WARNING: Since this module is typechecks-enforced, you may find new bugs\n * when replacing normal String functions with ones provided here.\n */\n'use strict';\n\nvar invariant = require(\"./invariant\"); // These two ranges are consecutive so anything in [HIGH_START, LOW_END] is a\n// surrogate code unit.\n\n\nvar SURROGATE_HIGH_START = 0xD800;\nvar SURROGATE_HIGH_END = 0xDBFF;\nvar SURROGATE_LOW_START = 0xDC00;\nvar SURROGATE_LOW_END = 0xDFFF;\nvar SURROGATE_UNITS_REGEX = /[\\uD800-\\uDFFF]/;\n/**\n * @param {number} codeUnit   A Unicode code-unit, in range [0, 0x10FFFF]\n * @return {boolean}          Whether code-unit is in a surrogate (hi/low) range\n */\n\nfunction isCodeUnitInSurrogateRange(codeUnit) {\n  return SURROGATE_HIGH_START <= codeUnit && codeUnit <= SURROGATE_LOW_END;\n}\n/**\n * Returns whether the two characters starting at `index` form a surrogate pair.\n * For example, given the string s = \"\\uD83D\\uDE0A\", (s, 0) returns true and\n * (s, 1) returns false.\n *\n * @param {string} str\n * @param {number} index\n * @return {boolean}\n */\n\n\nfunction isSurrogatePair(str, index) {\n  !(0 <= index && index < str.length) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'isSurrogatePair: Invalid index %s for string length %s.', index, str.length) : invariant(false) : void 0;\n\n  if (index + 1 === str.length) {\n    return false;\n  }\n\n  var first = str.charCodeAt(index);\n  var second = str.charCodeAt(index + 1);\n  return SURROGATE_HIGH_START <= first && first <= SURROGATE_HIGH_END && SURROGATE_LOW_START <= second && second <= SURROGATE_LOW_END;\n}\n/**\n * @param {string} str  Non-empty string\n * @return {boolean}    True if the input includes any surrogate code units\n */\n\n\nfunction hasSurrogateUnit(str) {\n  return SURROGATE_UNITS_REGEX.test(str);\n}\n/**\n * Return the length of the original Unicode character at given position in the\n * String by looking into the UTF-16 code unit; that is equal to 1 for any\n * non-surrogate characters in BMP ([U+0000..U+D7FF] and [U+E000, U+FFFF]); and\n * returns 2 for the hi/low surrogates ([U+D800..U+DFFF]), which are in fact\n * representing non-BMP characters ([U+10000..U+10FFFF]).\n *\n * Examples:\n * - '\\u0020' => 1\n * - '\\u3020' => 1\n * - '\\uD835' => 2\n * - '\\uD835\\uDDEF' => 2\n * - '\\uDDEF' => 2\n *\n * @param {string} str  Non-empty string\n * @param {number} pos  Position in the string to look for one code unit\n * @return {number}      Number 1 or 2\n */\n\n\nfunction getUTF16Length(str, pos) {\n  return 1 + isCodeUnitInSurrogateRange(str.charCodeAt(pos));\n}\n/**\n * Fully Unicode-enabled replacement for String#length\n *\n * @param {string} str  Valid Unicode string\n * @return {number}     The number of Unicode characters in the string\n */\n\n\nfunction strlen(str) {\n  // Call the native functions if there's no surrogate char\n  if (!hasSurrogateUnit(str)) {\n    return str.length;\n  }\n\n  var len = 0;\n\n  for (var pos = 0; pos < str.length; pos += getUTF16Length(str, pos)) {\n    len++;\n  }\n\n  return len;\n}\n/**\n * Fully Unicode-enabled replacement for String#substr()\n *\n * @param {string} str      Valid Unicode string\n * @param {number} start    Location in Unicode sequence to begin extracting\n * @param {?number} length  The number of Unicode characters to extract\n *                          (default: to the end of the string)\n * @return {string}         Extracted sub-string\n */\n\n\nfunction substr(str, start, length) {\n  start = start || 0;\n  length = length === undefined ? Infinity : length || 0; // Call the native functions if there's no surrogate char\n\n  if (!hasSurrogateUnit(str)) {\n    return str.substr(start, length);\n  } // Obvious cases\n\n\n  var size = str.length;\n\n  if (size <= 0 || start > size || length <= 0) {\n    return '';\n  } // Find the actual starting position\n\n\n  var posA = 0;\n\n  if (start > 0) {\n    for (; start > 0 && posA < size; start--) {\n      posA += getUTF16Length(str, posA);\n    }\n\n    if (posA >= size) {\n      return '';\n    }\n  } else if (start < 0) {\n    for (posA = size; start < 0 && 0 < posA; start++) {\n      posA -= getUTF16Length(str, posA - 1);\n    }\n\n    if (posA < 0) {\n      posA = 0;\n    }\n  } // Find the actual ending position\n\n\n  var posB = size;\n\n  if (length < size) {\n    for (posB = posA; length > 0 && posB < size; length--) {\n      posB += getUTF16Length(str, posB);\n    }\n  }\n\n  return str.substring(posA, posB);\n}\n/**\n * Fully Unicode-enabled replacement for String#substring()\n *\n * @param {string} str    Valid Unicode string\n * @param {number} start  Location in Unicode sequence to begin extracting\n * @param {?number} end   Location in Unicode sequence to end extracting\n *                        (default: end of the string)\n * @return {string}       Extracted sub-string\n */\n\n\nfunction substring(str, start, end) {\n  start = start || 0;\n  end = end === undefined ? Infinity : end || 0;\n\n  if (start < 0) {\n    start = 0;\n  }\n\n  if (end < 0) {\n    end = 0;\n  }\n\n  var length = Math.abs(end - start);\n  start = start < end ? start : end;\n  return substr(str, start, length);\n}\n/**\n * Get a list of Unicode code-points from a String\n *\n * @param {string} str        Valid Unicode string\n * @return {array<number>}    A list of code-points in [0..0x10FFFF]\n */\n\n\nfunction getCodePoints(str) {\n  var codePoints = [];\n\n  for (var pos = 0; pos < str.length; pos += getUTF16Length(str, pos)) {\n    codePoints.push(str.codePointAt(pos));\n  }\n\n  return codePoints;\n}\n\nvar UnicodeUtils = {\n  getCodePoints: getCodePoints,\n  getUTF16Length: getUTF16Length,\n  hasSurrogateUnit: hasSurrogateUnit,\n  isCodeUnitInSurrogateRange: isCodeUnitInSurrogateRange,\n  isSurrogatePair: isSurrogatePair,\n  strlen: strlen,\n  substring: substring,\n  substr: substr\n};\nmodule.exports = UnicodeUtils;", "/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n'use strict';\n\nvar emptyFunction = require(\"./emptyFunction\");\n/**\n * Similar to invariant but only logs a warning if the condition is not met.\n * This can be used to log issues in development environments in critical\n * paths. Removing the logging code for production environments will keep the\n * same logic and follow the same code paths.\n */\n\n\nfunction printWarning(format) {\n  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n    args[_key - 1] = arguments[_key];\n  }\n\n  var argIndex = 0;\n  var message = 'Warning: ' + format.replace(/%s/g, function () {\n    return args[argIndex++];\n  });\n\n  if (typeof console !== 'undefined') {\n    console.error(message);\n  }\n\n  try {\n    // --- Welcome to debugging React ---\n    // This error was thrown as a convenience so that you can use this stack\n    // to find the callsite that caused this warning to fire.\n    throw new Error(message);\n  } catch (x) {}\n}\n\nvar warning = process.env.NODE_ENV !== \"production\" ? function (condition, format) {\n  if (format === undefined) {\n    throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');\n  }\n\n  if (!condition) {\n    for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {\n      args[_key2 - 2] = arguments[_key2];\n    }\n\n    printWarning.apply(void 0, [format].concat(args));\n  }\n} : emptyFunction;\nmodule.exports = warning;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar warning = require(\"fbjs/lib/warning\");\n/**\n * Given a collapsed selection, move the focus `maxDistance` backward within\n * the selected block. If the selection will go beyond the start of the block,\n * move focus to the end of the previous block, but no further.\n *\n * This function is not Unicode-aware, so surrogate pairs will be treated\n * as having length 2.\n */\n\n\nfunction moveSelectionBackward(editorState, maxDistance) {\n  var selection = editorState.getSelection(); // Should eventually make this an invariant\n\n  process.env.NODE_ENV !== \"production\" ? warning(selection.isCollapsed(), 'moveSelectionBackward should only be called with a collapsed SelectionState') : void 0;\n  var content = editorState.getCurrentContent();\n  var key = selection.getStartKey();\n  var offset = selection.getStartOffset();\n  var focusKey = key;\n  var focusOffset = 0;\n\n  if (maxDistance > offset) {\n    var keyBefore = content.getKeyBefore(key);\n\n    if (keyBefore == null) {\n      focusKey = key;\n    } else {\n      focusKey = keyBefore;\n      var blockBefore = content.getBlockForKey(keyBefore);\n      focusOffset = blockBefore.getText().length;\n    }\n  } else {\n    focusOffset = offset - maxDistance;\n  }\n\n  return selection.merge({\n    focusKey: focusKey,\n    focusOffset: focusOffset,\n    isBackward: true\n  });\n}\n\nmodule.exports = moveSelectionBackward;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar DraftModifier = require(\"./DraftModifier\");\n\nvar gkx = require(\"./gkx\");\n\nvar experimentalTreeDataSupport = gkx('draft_tree_data_support');\n/**\n * For a collapsed selection state, remove text based on the specified strategy.\n * If the selection state is not collapsed, remove the entire selected range.\n */\n\nfunction removeTextWithStrategy(editorState, strategy, direction) {\n  var selection = editorState.getSelection();\n  var content = editorState.getCurrentContent();\n  var target = selection;\n  var anchorKey = selection.getAnchorKey();\n  var focusKey = selection.getFocusKey();\n  var anchorBlock = content.getBlockForKey(anchorKey);\n\n  if (experimentalTreeDataSupport) {\n    if (direction === 'forward') {\n      if (anchorKey !== focusKey) {\n        // For now we ignore forward delete across blocks,\n        // if there is demand for this we will implement it.\n        return content;\n      }\n    }\n  }\n\n  if (selection.isCollapsed()) {\n    if (direction === 'forward') {\n      if (editorState.isSelectionAtEndOfContent()) {\n        return content;\n      }\n\n      if (experimentalTreeDataSupport) {\n        var isAtEndOfBlock = selection.getAnchorOffset() === content.getBlockForKey(anchorKey).getLength();\n\n        if (isAtEndOfBlock) {\n          var anchorBlockSibling = content.getBlockForKey(anchorBlock.nextSibling);\n\n          if (!anchorBlockSibling || anchorBlockSibling.getLength() === 0) {\n            // For now we ignore forward delete at the end of a block,\n            // if there is demand for this we will implement it.\n            return content;\n          }\n        }\n      }\n    } else if (editorState.isSelectionAtStartOfContent()) {\n      return content;\n    }\n\n    target = strategy(editorState);\n\n    if (target === selection) {\n      return content;\n    }\n  }\n\n  return DraftModifier.removeRange(content, target, direction);\n}\n\nmodule.exports = removeTextWithStrategy;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar EditorState = require(\"./EditorState\");\n\nvar UnicodeUtils = require(\"fbjs/lib/UnicodeUtils\");\n\nvar moveSelectionBackward = require(\"./moveSelectionBackward\");\n\nvar removeTextWithStrategy = require(\"./removeTextWithStrategy\");\n/**\n * Remove the selected range. If the cursor is collapsed, remove the preceding\n * character. This operation is Unicode-aware, so removing a single character\n * will remove a surrogate pair properly as well.\n */\n\n\nfunction keyCommandPlainBackspace(editorState) {\n  var afterRemoval = removeTextWithStrategy(editorState, function (strategyState) {\n    var selection = strategyState.getSelection();\n    var content = strategyState.getCurrentContent();\n    var key = selection.getAnchorKey();\n    var offset = selection.getAnchorOffset();\n    var charBehind = content.getBlockForKey(key).getText()[offset - 1];\n    return moveSelectionBackward(strategyState, charBehind ? UnicodeUtils.getUTF16Length(charBehind, 0) : 1);\n  }, 'backward');\n\n  if (afterRemoval === editorState.getCurrentContent()) {\n    return editorState;\n  }\n\n  var selection = editorState.getSelection();\n  return EditorState.push(editorState, afterRemoval.set('selectionBefore', selection), selection.isCollapsed() ? 'backspace-character' : 'remove-range');\n}\n\nmodule.exports = keyCommandPlainBackspace;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar DraftModifier = require(\"./DraftModifier\");\n\nvar DraftOffsetKey = require(\"./DraftOffsetKey\");\n\nvar EditorState = require(\"./EditorState\");\n\nvar UserAgent = require(\"fbjs/lib/UserAgent\");\n\nvar _require = require(\"./draftKeyUtils\"),\n    notEmptyKey = _require.notEmptyKey;\n\nvar findAncestorOffsetKey = require(\"./findAncestorOffsetKey\");\n\nvar keyCommandPlainBackspace = require(\"./keyCommandPlainBackspace\");\n\nvar nullthrows = require(\"fbjs/lib/nullthrows\");\n\nvar isGecko = UserAgent.isEngine('Gecko');\nvar DOUBLE_NEWLINE = '\\n\\n';\n\nfunction onInputType(inputType, editorState) {\n  switch (inputType) {\n    case 'deleteContentBackward':\n      return keyCommandPlainBackspace(editorState);\n  }\n\n  return editorState;\n}\n/**\n * This function serves two purposes\n *\n * 1. To update the editorState and call onChange method with the new\n * editorState. This editorState is calculated in editOnBeforeInput but the\n * onChange method is not called with the new state until this method does it.\n * It is done to handle a specific case where certain character inputs might\n * be replaced with something else. E.g. snippets ('rc' might be replaced\n * with boilerplate code for react component). More information on the\n * exact problem can be found here -\n * https://github.com/facebook/draft-js/commit/07892ba479bd4dfc6afd1e0ed179aaf51cd138b1\n *\n * 2. intended to handle spellcheck and autocorrect changes,\n * which occur in the DOM natively without any opportunity to observe or\n * interpret the changes before they occur.\n *\n * The `input` event fires in contentEditable elements reliably for non-IE\n * browsers, immediately after changes occur to the editor DOM. Since our other\n * handlers override or otherwise handle cover other varieties of text input,\n * the DOM state should match the model in all controlled input cases. Thus,\n * when an `input` change leads to a DOM/model mismatch, the change should be\n * due to a spellcheck change, and we can incorporate it into our model.\n */\n\n\nfunction editOnInput(editor, e) {\n  if (editor._pendingStateFromBeforeInput !== undefined) {\n    editor.update(editor._pendingStateFromBeforeInput);\n    editor._pendingStateFromBeforeInput = undefined;\n  } // at this point editor is not null for sure (after input)\n\n\n  var castedEditorElement = editor.editor;\n  var domSelection = castedEditorElement.ownerDocument.defaultView.getSelection();\n  var anchorNode = domSelection.anchorNode,\n      isCollapsed = domSelection.isCollapsed;\n  var isNotTextOrElementNode = anchorNode.nodeType !== Node.TEXT_NODE && anchorNode.nodeType !== Node.ELEMENT_NODE;\n\n  if (isNotTextOrElementNode) {\n    // TODO: (t16149272) figure out context for this change\n    return;\n  }\n\n  if (anchorNode.nodeType === Node.TEXT_NODE && (anchorNode.previousSibling !== null || anchorNode.nextSibling !== null)) {\n    // When typing at the beginning of a visual line, Chrome splits the text\n    // nodes into two. Why? No one knows. This commit is suspicious:\n    // https://chromium.googlesource.com/chromium/src/+/a3b600981286b135632371477f902214c55a1724\n    // To work around, we'll merge the sibling text nodes back into this one.\n    var span = anchorNode.parentNode;\n    anchorNode.nodeValue = span.textContent;\n\n    for (var child = span.firstChild; child !== null; child = child.nextSibling) {\n      if (child !== anchorNode) {\n        span.removeChild(child);\n      }\n    }\n  }\n\n  var domText = anchorNode.textContent;\n  var editorState = editor._latestEditorState;\n  var offsetKey = nullthrows(findAncestorOffsetKey(anchorNode));\n\n  var _DraftOffsetKey$decod = DraftOffsetKey.decode(offsetKey),\n      blockKey = _DraftOffsetKey$decod.blockKey,\n      decoratorKey = _DraftOffsetKey$decod.decoratorKey,\n      leafKey = _DraftOffsetKey$decod.leafKey;\n\n  var _editorState$getBlock = editorState.getBlockTree(blockKey).getIn([decoratorKey, 'leaves', leafKey]),\n      start = _editorState$getBlock.start,\n      end = _editorState$getBlock.end;\n\n  var content = editorState.getCurrentContent();\n  var block = content.getBlockForKey(blockKey);\n  var modelText = block.getText().slice(start, end); // Special-case soft newlines here. If the DOM text ends in a soft newline,\n  // we will have manually inserted an extra soft newline in DraftEditorLeaf.\n  // We want to remove this extra newline for the purpose of our comparison\n  // of DOM and model text.\n\n  if (domText.endsWith(DOUBLE_NEWLINE)) {\n    domText = domText.slice(0, -1);\n  } // No change -- the DOM is up to date. Nothing to do here.\n\n\n  if (domText === modelText) {\n    // This can be buggy for some Android keyboards because they don't fire\n    // standard onkeydown/pressed events and only fired editOnInput\n    // so domText is already changed by the browser and ends up being equal\n    // to modelText unexpectedly.\n    // Newest versions of Android support the dom-inputevent-inputtype\n    // and we can use the `inputType` to properly apply the state changes.\n\n    /* $FlowFixMe inputType is only defined on a draft of a standard.\n     * https://w3c.github.io/input-events/#dom-inputevent-inputtype */\n    var inputType = e.nativeEvent.inputType;\n\n    if (inputType) {\n      var newEditorState = onInputType(inputType, editorState);\n\n      if (newEditorState !== editorState) {\n        editor.restoreEditorDOM();\n        editor.update(newEditorState);\n        return;\n      }\n    }\n\n    return;\n  }\n\n  var selection = editorState.getSelection(); // We'll replace the entire leaf with the text content of the target.\n\n  var targetRange = selection.merge({\n    anchorOffset: start,\n    focusOffset: end,\n    isBackward: false\n  });\n  var entityKey = block.getEntityAt(start);\n  var entity = notEmptyKey(entityKey) ? content.getEntity(entityKey) : null;\n  var entityType = entity != null ? entity.getMutability() : null;\n  var preserveEntity = entityType === 'MUTABLE'; // Immutable or segmented entities cannot properly be handled by the\n  // default browser undo, so we have to use a different change type to\n  // force using our internal undo method instead of falling through to the\n  // native browser undo.\n\n  var changeType = preserveEntity ? 'spellcheck-change' : 'apply-entity';\n  var newContent = DraftModifier.replaceText(content, targetRange, domText, block.getInlineStyleAt(start), preserveEntity ? block.getEntityAt(start) : null);\n  var anchorOffset, focusOffset, startOffset, endOffset;\n\n  if (isGecko) {\n    // Firefox selection does not change while the context menu is open, so\n    // we preserve the anchor and focus values of the DOM selection.\n    anchorOffset = domSelection.anchorOffset;\n    focusOffset = domSelection.focusOffset;\n    startOffset = start + Math.min(anchorOffset, focusOffset);\n    endOffset = startOffset + Math.abs(anchorOffset - focusOffset);\n    anchorOffset = startOffset;\n    focusOffset = endOffset;\n  } else {\n    // Browsers other than Firefox may adjust DOM selection while the context\n    // menu is open, and Safari autocorrect is prone to providing an inaccurate\n    // DOM selection. Don't trust it. Instead, use our existing SelectionState\n    // and adjust it based on the number of characters changed during the\n    // mutation.\n    var charDelta = domText.length - modelText.length;\n    startOffset = selection.getStartOffset();\n    endOffset = selection.getEndOffset();\n    anchorOffset = isCollapsed ? endOffset + charDelta : startOffset;\n    focusOffset = endOffset + charDelta;\n  } // Segmented entities are completely or partially removed when their\n  // text content changes. For this case we do not want any text to be selected\n  // after the change, so we are not merging the selection.\n\n\n  var contentWithAdjustedDOMSelection = newContent.merge({\n    selectionBefore: content.getSelectionAfter(),\n    selectionAfter: selection.merge({\n      anchorOffset: anchorOffset,\n      focusOffset: focusOffset\n    })\n  });\n  editor.update(EditorState.push(editorState, contentWithAdjustedDOMSelection, changeType));\n}\n\nmodule.exports = editOnInput;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar Keys = require(\"fbjs/lib/Keys\");\n\nfunction isSoftNewlineEvent(e) {\n  return e.which === Keys.RETURN && (e.getModifierState('Shift') || e.getModifierState('Alt') || e.getModifierState('Control'));\n}\n\nmodule.exports = isSoftNewlineEvent;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar UserAgent = require(\"fbjs/lib/UserAgent\");\n\nvar isSoftNewlineEvent = require(\"./isSoftNewlineEvent\");\n\nvar isOSX = UserAgent.isPlatform('Mac OS X');\nvar KeyBindingUtil = {\n  /**\n   * Check whether the ctrlKey modifier is *not* being used in conjunction with\n   * the altKey modifier. If they are combined, the result is an `altGraph`\n   * key modifier, which should not be handled by this set of key bindings.\n   */\n  isCtrlKeyCommand: function isCtrlKeyCommand(e) {\n    return !!e.ctrlKey && !e.altKey;\n  },\n  isOptionKeyCommand: function isOptionKeyCommand(e) {\n    return isOSX && e.altKey;\n  },\n  usesMacOSHeuristics: function usesMacOSHeuristics() {\n    return isOSX;\n  },\n  hasCommandModifier: function hasCommandModifier(e) {\n    return isOSX ? !!e.metaKey && !e.altKey : KeyBindingUtil.isCtrlKeyCommand(e);\n  },\n  isSoftNewlineEvent: isSoftNewlineEvent\n};\nmodule.exports = KeyBindingUtil;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar DraftModifier = require(\"./DraftModifier\");\n\nvar EditorState = require(\"./EditorState\");\n\nvar getContentStateFragment = require(\"./getContentStateFragment\");\n\nvar nullthrows = require(\"fbjs/lib/nullthrows\");\n\nvar clipboard = null;\n/**\n * Some systems offer a \"secondary\" clipboard to allow quick internal cut\n * and paste behavior. For instance, Ctrl+K (cut) and Ctrl+Y (paste).\n */\n\nvar SecondaryClipboard = {\n  cut: function cut(editorState) {\n    var content = editorState.getCurrentContent();\n    var selection = editorState.getSelection();\n    var targetRange = null;\n\n    if (selection.isCollapsed()) {\n      var anchorKey = selection.getAnchorKey();\n      var blockEnd = content.getBlockForKey(anchorKey).getLength();\n\n      if (blockEnd === selection.getAnchorOffset()) {\n        var keyAfter = content.getKeyAfter(anchorKey);\n\n        if (keyAfter == null) {\n          return editorState;\n        }\n\n        targetRange = selection.set('focusKey', keyAfter).set('focusOffset', 0);\n      } else {\n        targetRange = selection.set('focusOffset', blockEnd);\n      }\n    } else {\n      targetRange = selection;\n    }\n\n    targetRange = nullthrows(targetRange); // TODO: This should actually append to the current state when doing\n    // successive ^K commands without any other cursor movement\n\n    clipboard = getContentStateFragment(content, targetRange);\n    var afterRemoval = DraftModifier.removeRange(content, targetRange, 'forward');\n\n    if (afterRemoval === content) {\n      return editorState;\n    }\n\n    return EditorState.push(editorState, afterRemoval, 'remove-range');\n  },\n  paste: function paste(editorState) {\n    if (!clipboard) {\n      return editorState;\n    }\n\n    var newContent = DraftModifier.replaceWithFragment(editorState.getCurrentContent(), editorState.getSelection(), clipboard);\n    return EditorState.push(editorState, newContent, 'insert-fragment');\n  }\n};\nmodule.exports = SecondaryClipboard;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar UserAgent = require(\"fbjs/lib/UserAgent\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar isChrome = UserAgent.isBrowser('Chrome'); // In Chrome, the client rects will include the entire bounds of all nodes that\n// begin (have a start tag) within the selection, even if the selection does\n// not overlap the entire node. To resolve this, we split the range at each\n// start tag and join the client rects together.\n// https://code.google.com/p/chromium/issues/detail?id=324437\n\n/* eslint-disable consistent-return */\n\nfunction getRangeClientRectsChrome(range) {\n  var tempRange = range.cloneRange();\n  var clientRects = [];\n\n  for (var ancestor = range.endContainer; ancestor != null; ancestor = ancestor.parentNode) {\n    // If we've climbed up to the common ancestor, we can now use the\n    // original start point and stop climbing the tree.\n    var atCommonAncestor = ancestor === range.commonAncestorContainer;\n\n    if (atCommonAncestor) {\n      tempRange.setStart(range.startContainer, range.startOffset);\n    } else {\n      tempRange.setStart(tempRange.endContainer, 0);\n    }\n\n    var rects = Array.from(tempRange.getClientRects());\n    clientRects.push(rects);\n\n    if (atCommonAncestor) {\n      var _ref;\n\n      clientRects.reverse();\n      return (_ref = []).concat.apply(_ref, clientRects);\n    }\n\n    tempRange.setEndBefore(ancestor);\n  }\n\n  !false ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Found an unexpected detached subtree when getting range client rects.') : invariant(false) : void 0;\n}\n/* eslint-enable consistent-return */\n\n/**\n * Like range.getClientRects() but normalizes for browser bugs.\n */\n\n\nvar getRangeClientRects = isChrome ? getRangeClientRectsChrome : function (range) {\n  return Array.from(range.getClientRects());\n};\nmodule.exports = getRangeClientRects;", "\"use strict\";\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\nvar UnicodeUtils = require(\"fbjs/lib/UnicodeUtils\");\n\nvar getCorrectDocumentFromNode = require(\"./getCorrectDocumentFromNode\");\n\nvar getRangeClientRects = require(\"./getRangeClientRects\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n/**\n * Return the computed line height, in pixels, for the provided element.\n */\n\n\nfunction getLineHeightPx(element) {\n  var computed = getComputedStyle(element);\n  var correctDocument = getCorrectDocumentFromNode(element);\n  var div = correctDocument.createElement('div');\n  div.style.fontFamily = computed.fontFamily;\n  div.style.fontSize = computed.fontSize;\n  div.style.fontStyle = computed.fontStyle;\n  div.style.fontWeight = computed.fontWeight;\n  div.style.lineHeight = computed.lineHeight;\n  div.style.position = 'absolute';\n  div.textContent = 'M';\n  var documentBody = correctDocument.body;\n  !documentBody ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Missing document.body') : invariant(false) : void 0; // forced layout here\n\n  documentBody.appendChild(div);\n  var rect = div.getBoundingClientRect();\n  documentBody.removeChild(div);\n  return rect.height;\n}\n/**\n * Return whether every ClientRect in the provided list lies on the same line.\n *\n * We assume that the rects on the same line all contain the baseline, so the\n * lowest top line needs to be above the highest bottom line (i.e., if you were\n * to project the rects onto the y-axis, their intersection would be nonempty).\n *\n * In addition, we require that no two boxes are lineHeight (or more) apart at\n * either top or bottom, which helps protect against false positives for fonts\n * with extremely large glyph heights (e.g., with a font size of 17px, Zapfino\n * produces rects of height 58px!).\n */\n\n\nfunction areRectsOnOneLine(rects, lineHeight) {\n  var minTop = Infinity;\n  var minBottom = Infinity;\n  var maxTop = -Infinity;\n  var maxBottom = -Infinity;\n\n  for (var ii = 0; ii < rects.length; ii++) {\n    var rect = rects[ii];\n\n    if (rect.width === 0 || rect.width === 1) {\n      // When a range starts or ends a soft wrap, many browsers (Chrome, IE,\n      // Safari) include an empty rect on the previous or next line. When the\n      // text lies in a container whose position is not integral (e.g., from\n      // margin: auto), Safari makes these empty rects have width 1 (instead of\n      // 0). Having one-pixel-wide characters seems unlikely (and most browsers\n      // report widths in subpixel precision anyway) so it's relatively safe to\n      // skip over them.\n      continue;\n    }\n\n    minTop = Math.min(minTop, rect.top);\n    minBottom = Math.min(minBottom, rect.bottom);\n    maxTop = Math.max(maxTop, rect.top);\n    maxBottom = Math.max(maxBottom, rect.bottom);\n  }\n\n  return maxTop <= minBottom && maxTop - minTop < lineHeight && maxBottom - minBottom < lineHeight;\n}\n/**\n * Return the length of a node, as used by Range offsets.\n */\n\n\nfunction getNodeLength(node) {\n  // http://www.w3.org/TR/dom/#concept-node-length\n  switch (node.nodeType) {\n    case Node.DOCUMENT_TYPE_NODE:\n      return 0;\n\n    case Node.TEXT_NODE:\n    case Node.PROCESSING_INSTRUCTION_NODE:\n    case Node.COMMENT_NODE:\n      return node.length;\n\n    default:\n      return node.childNodes.length;\n  }\n}\n/**\n * Given a collapsed range, move the start position backwards as far as\n * possible while the range still spans only a single line.\n */\n\n\nfunction expandRangeToStartOfLine(range) {\n  !range.collapsed ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'expandRangeToStartOfLine: Provided range is not collapsed.') : invariant(false) : void 0;\n  range = range.cloneRange();\n  var containingElement = range.startContainer;\n\n  if (containingElement.nodeType !== 1) {\n    containingElement = containingElement.parentNode;\n  }\n\n  var lineHeight = getLineHeightPx(containingElement); // Imagine our text looks like:\n  //   <div><span>once upon a time, there was a <em>boy\n  //   who lived</em> </span><q><strong>under^ the\n  //   stairs</strong> in a small closet.</q></div>\n  // where the caret represents the cursor. First, we crawl up the tree until\n  // the range spans multiple lines (setting the start point to before\n  // \"<strong>\", then before \"<div>\"), then at each level we do a search to\n  // find the latest point which is still on a previous line. We'll find that\n  // the break point is inside the span, then inside the <em>, then in its text\n  // node child, the actual break point before \"who\".\n\n  var bestContainer = range.endContainer;\n  var bestOffset = range.endOffset;\n  range.setStart(range.startContainer, 0);\n\n  while (areRectsOnOneLine(getRangeClientRects(range), lineHeight)) {\n    bestContainer = range.startContainer;\n    bestOffset = range.startOffset;\n    !bestContainer.parentNode ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Found unexpected detached subtree when traversing.') : invariant(false) : void 0;\n    range.setStartBefore(bestContainer);\n\n    if (bestContainer.nodeType === 1 && getComputedStyle(bestContainer).display !== 'inline') {\n      // The start of the line is never in a different block-level container.\n      break;\n    }\n  } // In the above example, range now spans from \"<div>\" to \"under\",\n  // bestContainer is <div>, and bestOffset is 1 (index of <q> inside <div>)].\n  // Picking out which child to recurse into here is a special case since we\n  // don't want to check past <q> -- once we find that the final range starts\n  // in <span>, we can look at all of its children (and all of their children)\n  // to find the break point.\n  // At all times, (bestContainer, bestOffset) is the latest single-line start\n  // point that we know of.\n\n\n  var currentContainer = bestContainer;\n  var maxIndexToConsider = bestOffset - 1;\n\n  do {\n    var nodeValue = currentContainer.nodeValue;\n    var ii = maxIndexToConsider;\n\n    for (; ii >= 0; ii--) {\n      if (nodeValue != null && ii > 0 && UnicodeUtils.isSurrogatePair(nodeValue, ii - 1)) {\n        // We're in the middle of a surrogate pair -- skip over so we never\n        // return a range with an endpoint in the middle of a code point.\n        continue;\n      }\n\n      range.setStart(currentContainer, ii);\n\n      if (areRectsOnOneLine(getRangeClientRects(range), lineHeight)) {\n        bestContainer = currentContainer;\n        bestOffset = ii;\n      } else {\n        break;\n      }\n    }\n\n    if (ii === -1 || currentContainer.childNodes.length === 0) {\n      // If ii === -1, then (bestContainer, bestOffset), which is equal to\n      // (currentContainer, 0), was a single-line start point but a start\n      // point before currentContainer wasn't, so the line break seems to\n      // have occurred immediately after currentContainer's start tag\n      //\n      // If currentContainer.childNodes.length === 0, we're already at a\n      // terminal node (e.g., text node) and should return our current best.\n      break;\n    }\n\n    currentContainer = currentContainer.childNodes[ii];\n    maxIndexToConsider = getNodeLength(currentContainer);\n  } while (true);\n\n  range.setStart(bestContainer, bestOffset);\n  return range;\n}\n\nmodule.exports = expandRangeToStartOfLine;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar EditorState = require(\"./EditorState\");\n\nvar expandRangeToStartOfLine = require(\"./expandRangeToStartOfLine\");\n\nvar getDraftEditorSelectionWithNodes = require(\"./getDraftEditorSelectionWithNodes\");\n\nvar moveSelectionBackward = require(\"./moveSelectionBackward\");\n\nvar removeTextWithStrategy = require(\"./removeTextWithStrategy\");\n\nfunction keyCommandBackspaceToStartOfLine(editorState, e) {\n  var afterRemoval = removeTextWithStrategy(editorState, function (strategyState) {\n    var selection = strategyState.getSelection();\n\n    if (selection.isCollapsed() && selection.getAnchorOffset() === 0) {\n      return moveSelectionBackward(strategyState, 1);\n    }\n\n    var ownerDocument = e.currentTarget.ownerDocument;\n    var domSelection = ownerDocument.defaultView.getSelection();\n    var range = domSelection.getRangeAt(0);\n    range = expandRangeToStartOfLine(range);\n    return getDraftEditorSelectionWithNodes(strategyState, null, range.endContainer, range.endOffset, range.startContainer, range.startOffset).selectionState;\n  }, 'backward');\n\n  if (afterRemoval === editorState.getCurrentContent()) {\n    return editorState;\n  }\n\n  return EditorState.push(editorState, afterRemoval, 'remove-range');\n}\n\nmodule.exports = keyCommandBackspaceToStartOfLine;", "/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @typechecks\n * @stub\n * \n */\n'use strict'; // \\u00a1-\\u00b1\\u00b4-\\u00b8\\u00ba\\u00bb\\u00bf\n//             is latin supplement punctuation except fractions and superscript\n//             numbers\n// \\u2010-\\u2027\\u2030-\\u205e\n//             is punctuation from the general punctuation block:\n//             weird quotes, commas, bullets, dashes, etc.\n// \\u30fb\\u3001\\u3002\\u3008-\\u3011\\u3014-\\u301f\n//             is CJK punctuation\n// \\uff1a-\\uff1f\\uff01-\\uff0f\\uff3b-\\uff40\\uff5b-\\uff65\n//             is some full-width/half-width punctuation\n// \\u2E2E\\u061f\\u066a-\\u066c\\u061b\\u060c\\u060d\\uFD3e\\uFD3F\n//             is some Arabic punctuation marks\n// \\u1801\\u0964\\u104a\\u104b\n//             is misc. other language punctuation marks\n\nvar PUNCTUATION = '[.,+*?$|#{}()\\'\\\\^\\\\-\\\\[\\\\]\\\\\\\\\\\\/!@%\"~=<>_:;' + \"\\u30FB\\u3001\\u3002\\u3008-\\u3011\\u3014-\\u301F\\uFF1A-\\uFF1F\\uFF01-\\uFF0F\" + \"\\uFF3B-\\uFF40\\uFF5B-\\uFF65\\u2E2E\\u061F\\u066A-\\u066C\\u061B\\u060C\\u060D\" + \"\\uFD3E\\uFD3F\\u1801\\u0964\\u104A\\u104B\\u2010-\\u2027\\u2030-\\u205E\" + \"\\xA1-\\xB1\\xB4-\\xB8\\xBA\\xBB\\xBF]\";\nmodule.exports = {\n  getPunctuation: function getPunctuation() {\n    return PUNCTUATION;\n  }\n};", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar TokenizeUtil = require(\"fbjs/lib/TokenizeUtil\");\n\nvar punctuation = TokenizeUtil.getPunctuation(); // The apostrophe and curly single quotes behave in a curious way: when\n// surrounded on both sides by word characters, they behave as word chars; when\n// either neighbor is punctuation or an end of the string, they behave as\n// punctuation.\n\nvar CHAMELEON_CHARS = \"['\\u2018\\u2019]\"; // Remove the underscore, which should count as part of the removable word. The\n// \"chameleon chars\" also count as punctuation in this regex.\n\nvar WHITESPACE_AND_PUNCTUATION = '\\\\s|(?![_])' + punctuation;\nvar DELETE_STRING = '^' + '(?:' + WHITESPACE_AND_PUNCTUATION + ')*' + '(?:' + CHAMELEON_CHARS + '|(?!' + WHITESPACE_AND_PUNCTUATION + ').)*' + '(?:(?!' + WHITESPACE_AND_PUNCTUATION + ').)';\nvar DELETE_REGEX = new RegExp(DELETE_STRING);\nvar BACKSPACE_STRING = '(?:(?!' + WHITESPACE_AND_PUNCTUATION + ').)' + '(?:' + CHAMELEON_CHARS + '|(?!' + WHITESPACE_AND_PUNCTUATION + ').)*' + '(?:' + WHITESPACE_AND_PUNCTUATION + ')*' + '$';\nvar BACKSPACE_REGEX = new RegExp(BACKSPACE_STRING);\n\nfunction getRemovableWord(text, isBackward) {\n  var matches = isBackward ? BACKSPACE_REGEX.exec(text) : DELETE_REGEX.exec(text);\n  return matches ? matches[0] : text;\n}\n\nvar DraftRemovableWord = {\n  getBackward: function getBackward(text) {\n    return getRemovableWord(text, true);\n  },\n  getForward: function getForward(text) {\n    return getRemovableWord(text, false);\n  }\n};\nmodule.exports = DraftRemovableWord;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar DraftRemovableWord = require(\"./DraftRemovableWord\");\n\nvar EditorState = require(\"./EditorState\");\n\nvar moveSelectionBackward = require(\"./moveSelectionBackward\");\n\nvar removeTextWithStrategy = require(\"./removeTextWithStrategy\");\n/**\n * Delete the word that is left of the cursor, as well as any spaces or\n * punctuation after the word.\n */\n\n\nfunction keyCommandBackspaceWord(editorState) {\n  var afterRemoval = removeTextWithStrategy(editorState, function (strategyState) {\n    var selection = strategyState.getSelection();\n    var offset = selection.getStartOffset(); // If there are no words before the cursor, remove the preceding newline.\n\n    if (offset === 0) {\n      return moveSelectionBackward(strategyState, 1);\n    }\n\n    var key = selection.getStartKey();\n    var content = strategyState.getCurrentContent();\n    var text = content.getBlockForKey(key).getText().slice(0, offset);\n    var toRemove = DraftRemovableWord.getBackward(text);\n    return moveSelectionBackward(strategyState, toRemove.length || 1);\n  }, 'backward');\n\n  if (afterRemoval === editorState.getCurrentContent()) {\n    return editorState;\n  }\n\n  return EditorState.push(editorState, afterRemoval, 'remove-range');\n}\n\nmodule.exports = keyCommandBackspaceWord;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar warning = require(\"fbjs/lib/warning\");\n/**\n * Given a collapsed selection, move the focus `maxDistance` forward within\n * the selected block. If the selection will go beyond the end of the block,\n * move focus to the start of the next block, but no further.\n *\n * This function is not Unicode-aware, so surrogate pairs will be treated\n * as having length 2.\n */\n\n\nfunction moveSelectionForward(editorState, maxDistance) {\n  var selection = editorState.getSelection(); // Should eventually make this an invariant\n\n  process.env.NODE_ENV !== \"production\" ? warning(selection.isCollapsed(), 'moveSelectionForward should only be called with a collapsed SelectionState') : void 0;\n  var key = selection.getStartKey();\n  var offset = selection.getStartOffset();\n  var content = editorState.getCurrentContent();\n  var focusKey = key;\n  var focusOffset;\n  var block = content.getBlockForKey(key);\n\n  if (maxDistance > block.getText().length - offset) {\n    focusKey = content.getKeyAfter(key);\n    focusOffset = 0;\n  } else {\n    focusOffset = offset + maxDistance;\n  }\n\n  return selection.merge({\n    focusKey: focusKey,\n    focusOffset: focusOffset\n  });\n}\n\nmodule.exports = moveSelectionForward;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar DraftRemovableWord = require(\"./DraftRemovableWord\");\n\nvar EditorState = require(\"./EditorState\");\n\nvar moveSelectionForward = require(\"./moveSelectionForward\");\n\nvar removeTextWithStrategy = require(\"./removeTextWithStrategy\");\n/**\n * Delete the word that is right of the cursor, as well as any spaces or\n * punctuation before the word.\n */\n\n\nfunction keyCommandDeleteWord(editorState) {\n  var afterRemoval = removeTextWithStrategy(editorState, function (strategyState) {\n    var selection = strategyState.getSelection();\n    var offset = selection.getStartOffset();\n    var key = selection.getStartKey();\n    var content = strategyState.getCurrentContent();\n    var text = content.getBlockForKey(key).getText().slice(offset);\n    var toRemove = DraftRemovableWord.getForward(text); // If there are no words in front of the cursor, remove the newline.\n\n    return moveSelectionForward(strategyState, toRemove.length || 1);\n  }, 'forward');\n\n  if (afterRemoval === editorState.getCurrentContent()) {\n    return editorState;\n  }\n\n  return EditorState.push(editorState, afterRemoval, 'remove-range');\n}\n\nmodule.exports = keyCommandDeleteWord;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar DraftModifier = require(\"./DraftModifier\");\n\nvar EditorState = require(\"./EditorState\");\n\nfunction keyCommandInsertNewline(editorState) {\n  var contentState = DraftModifier.splitBlock(editorState.getCurrentContent(), editorState.getSelection());\n  return EditorState.push(editorState, contentState, 'split-block');\n}\n\nmodule.exports = keyCommandInsertNewline;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar EditorState = require(\"./EditorState\");\n/**\n * See comment for `moveSelectionToStartOfBlock`.\n */\n\n\nfunction keyCommandMoveSelectionToEndOfBlock(editorState) {\n  var selection = editorState.getSelection();\n  var endKey = selection.getEndKey();\n  var content = editorState.getCurrentContent();\n  var textLength = content.getBlockForKey(endKey).getLength();\n  return EditorState.set(editorState, {\n    selection: selection.merge({\n      anchorKey: endKey,\n      anchorOffset: textLength,\n      focusKey: endKey,\n      focusOffset: textLength,\n      isBackward: false\n    }),\n    forceSelection: true\n  });\n}\n\nmodule.exports = keyCommandMoveSelectionToEndOfBlock;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar EditorState = require(\"./EditorState\");\n/**\n * Collapse selection at the start of the first selected block. This is used\n * for Firefox versions that attempt to navigate forward/backward instead of\n * moving the cursor. Other browsers are able to move the cursor natively.\n */\n\n\nfunction keyCommandMoveSelectionToStartOfBlock(editorState) {\n  var selection = editorState.getSelection();\n  var startKey = selection.getStartKey();\n  return EditorState.set(editorState, {\n    selection: selection.merge({\n      anchorKey: startKey,\n      anchorOffset: 0,\n      focusKey: startKey,\n      focusOffset: 0,\n      isBackward: false\n    }),\n    forceSelection: true\n  });\n}\n\nmodule.exports = keyCommandMoveSelectionToStartOfBlock;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar EditorState = require(\"./EditorState\");\n\nvar UnicodeUtils = require(\"fbjs/lib/UnicodeUtils\");\n\nvar moveSelectionForward = require(\"./moveSelectionForward\");\n\nvar removeTextWithStrategy = require(\"./removeTextWithStrategy\");\n/**\n * Remove the selected range. If the cursor is collapsed, remove the following\n * character. This operation is Unicode-aware, so removing a single character\n * will remove a surrogate pair properly as well.\n */\n\n\nfunction keyCommandPlainDelete(editorState) {\n  var afterRemoval = removeTextWithStrategy(editorState, function (strategyState) {\n    var selection = strategyState.getSelection();\n    var content = strategyState.getCurrentContent();\n    var key = selection.getAnchorKey();\n    var offset = selection.getAnchorOffset();\n    var charAhead = content.getBlockForKey(key).getText()[offset];\n    return moveSelectionForward(strategyState, charAhead ? UnicodeUtils.getUTF16Length(charAhead, 0) : 1);\n  }, 'forward');\n\n  if (afterRemoval === editorState.getCurrentContent()) {\n    return editorState;\n  }\n\n  var selection = editorState.getSelection();\n  return EditorState.push(editorState, afterRemoval.set('selectionBefore', selection), selection.isCollapsed() ? 'delete-character' : 'remove-range');\n}\n\nmodule.exports = keyCommandPlainDelete;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar DraftModifier = require(\"./DraftModifier\");\n\nvar EditorState = require(\"./EditorState\");\n\nvar getContentStateFragment = require(\"./getContentStateFragment\");\n/**\n * Transpose the characters on either side of a collapsed cursor, or\n * if the cursor is at the end of the block, transpose the last two\n * characters.\n */\n\n\nfunction keyCommandTransposeCharacters(editorState) {\n  var selection = editorState.getSelection();\n\n  if (!selection.isCollapsed()) {\n    return editorState;\n  }\n\n  var offset = selection.getAnchorOffset();\n\n  if (offset === 0) {\n    return editorState;\n  }\n\n  var blockKey = selection.getAnchorKey();\n  var content = editorState.getCurrentContent();\n  var block = content.getBlockForKey(blockKey);\n  var length = block.getLength(); // Nothing to transpose if there aren't two characters.\n\n  if (length <= 1) {\n    return editorState;\n  }\n\n  var removalRange;\n  var finalSelection;\n\n  if (offset === length) {\n    // The cursor is at the end of the block. Swap the last two characters.\n    removalRange = selection.set('anchorOffset', offset - 1);\n    finalSelection = selection;\n  } else {\n    removalRange = selection.set('focusOffset', offset + 1);\n    finalSelection = removalRange.set('anchorOffset', offset + 1);\n  } // Extract the character to move as a fragment. This preserves its\n  // styling and entity, if any.\n\n\n  var movedFragment = getContentStateFragment(content, removalRange);\n  var afterRemoval = DraftModifier.removeRange(content, removalRange, 'backward'); // After the removal, the insertion target is one character back.\n\n  var selectionAfter = afterRemoval.getSelectionAfter();\n  var targetOffset = selectionAfter.getAnchorOffset() - 1;\n  var targetRange = selectionAfter.merge({\n    anchorOffset: targetOffset,\n    focusOffset: targetOffset\n  });\n  var afterInsert = DraftModifier.replaceWithFragment(afterRemoval, targetRange, movedFragment);\n  var newEditorState = EditorState.push(editorState, afterInsert, 'insert-fragment');\n  return EditorState.acceptSelection(newEditorState, finalSelection);\n}\n\nmodule.exports = keyCommandTransposeCharacters;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar EditorState = require(\"./EditorState\");\n\nfunction keyCommandUndo(e, editorState, updateFn) {\n  var undoneState = EditorState.undo(editorState); // If the last change to occur was a spellcheck change, allow the undo\n  // event to fall through to the browser. This allows the browser to record\n  // the unwanted change, which should soon lead it to learn not to suggest\n  // the correction again.\n\n  if (editorState.getLastChangeType() === 'spellcheck-change') {\n    var nativelyRenderedContent = undoneState.getCurrentContent();\n    updateFn(EditorState.set(undoneState, {\n      nativelyRenderedContent: nativelyRenderedContent\n    }));\n    return;\n  } // Otheriwse, manage the undo behavior manually.\n\n\n  e.preventDefault();\n\n  if (!editorState.getNativelyRenderedContent()) {\n    updateFn(undoneState);\n    return;\n  } // Trigger a re-render with the current content state to ensure that the\n  // component tree has up-to-date props for comparison.\n\n\n  updateFn(EditorState.set(editorState, {\n    nativelyRenderedContent: null\n  })); // Wait to ensure that the re-render has occurred before performing\n  // the undo action.\n\n  setTimeout(function () {\n    updateFn(undoneState);\n  }, 0);\n}\n\nmodule.exports = keyCommandUndo;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar DraftModifier = require(\"./DraftModifier\");\n\nvar EditorState = require(\"./EditorState\");\n\nvar KeyBindingUtil = require(\"./KeyBindingUtil\");\n\nvar Keys = require(\"fbjs/lib/Keys\");\n\nvar SecondaryClipboard = require(\"./SecondaryClipboard\");\n\nvar UserAgent = require(\"fbjs/lib/UserAgent\");\n\nvar isEventHandled = require(\"./isEventHandled\");\n\nvar keyCommandBackspaceToStartOfLine = require(\"./keyCommandBackspaceToStartOfLine\");\n\nvar keyCommandBackspaceWord = require(\"./keyCommandBackspaceWord\");\n\nvar keyCommandDeleteWord = require(\"./keyCommandDeleteWord\");\n\nvar keyCommandInsertNewline = require(\"./keyCommandInsertNewline\");\n\nvar keyCommandMoveSelectionToEndOfBlock = require(\"./keyCommandMoveSelectionToEndOfBlock\");\n\nvar keyCommandMoveSelectionToStartOfBlock = require(\"./keyCommandMoveSelectionToStartOfBlock\");\n\nvar keyCommandPlainBackspace = require(\"./keyCommandPlainBackspace\");\n\nvar keyCommandPlainDelete = require(\"./keyCommandPlainDelete\");\n\nvar keyCommandTransposeCharacters = require(\"./keyCommandTransposeCharacters\");\n\nvar keyCommandUndo = require(\"./keyCommandUndo\");\n\nvar isOptionKeyCommand = KeyBindingUtil.isOptionKeyCommand;\nvar isChrome = UserAgent.isBrowser('Chrome');\n/**\n * Map a `DraftEditorCommand` command value to a corresponding function.\n */\n\nfunction onKeyCommand(command, editorState, e) {\n  switch (command) {\n    case 'redo':\n      return EditorState.redo(editorState);\n\n    case 'delete':\n      return keyCommandPlainDelete(editorState);\n\n    case 'delete-word':\n      return keyCommandDeleteWord(editorState);\n\n    case 'backspace':\n      return keyCommandPlainBackspace(editorState);\n\n    case 'backspace-word':\n      return keyCommandBackspaceWord(editorState);\n\n    case 'backspace-to-start-of-line':\n      return keyCommandBackspaceToStartOfLine(editorState, e);\n\n    case 'split-block':\n      return keyCommandInsertNewline(editorState);\n\n    case 'transpose-characters':\n      return keyCommandTransposeCharacters(editorState);\n\n    case 'move-selection-to-start-of-block':\n      return keyCommandMoveSelectionToStartOfBlock(editorState);\n\n    case 'move-selection-to-end-of-block':\n      return keyCommandMoveSelectionToEndOfBlock(editorState);\n\n    case 'secondary-cut':\n      return SecondaryClipboard.cut(editorState);\n\n    case 'secondary-paste':\n      return SecondaryClipboard.paste(editorState);\n\n    default:\n      return editorState;\n  }\n}\n/**\n * Intercept keydown behavior to handle keys and commands manually, if desired.\n *\n * Keydown combinations may be mapped to `DraftCommand` values, which may\n * correspond to command functions that modify the editor or its contents.\n *\n * See `getDefaultKeyBinding` for defaults. Alternatively, the top-level\n * component may provide a custom mapping via the `keyBindingFn` prop.\n */\n\n\nfunction editOnKeyDown(editor, e) {\n  var keyCode = e.which;\n  var editorState = editor._latestEditorState;\n\n  function callDeprecatedHandler(handlerName) {\n    var deprecatedHandler = editor.props[handlerName];\n\n    if (deprecatedHandler) {\n      deprecatedHandler(e);\n      return true;\n    } else {\n      return false;\n    }\n  }\n\n  switch (keyCode) {\n    case Keys.RETURN:\n      e.preventDefault(); // The top-level component may manually handle newline insertion. If\n      // no special handling is performed, fall through to command handling.\n\n      if (editor.props.handleReturn && isEventHandled(editor.props.handleReturn(e, editorState))) {\n        return;\n      }\n\n      break;\n\n    case Keys.ESC:\n      e.preventDefault();\n\n      if (callDeprecatedHandler('onEscape')) {\n        return;\n      }\n\n      break;\n\n    case Keys.TAB:\n      if (callDeprecatedHandler('onTab')) {\n        return;\n      }\n\n      break;\n\n    case Keys.UP:\n      if (callDeprecatedHandler('onUpArrow')) {\n        return;\n      }\n\n      break;\n\n    case Keys.RIGHT:\n      if (callDeprecatedHandler('onRightArrow')) {\n        return;\n      }\n\n      break;\n\n    case Keys.DOWN:\n      if (callDeprecatedHandler('onDownArrow')) {\n        return;\n      }\n\n      break;\n\n    case Keys.LEFT:\n      if (callDeprecatedHandler('onLeftArrow')) {\n        return;\n      }\n\n      break;\n\n    case Keys.SPACE:\n      // Prevent Chrome on OSX behavior where option + space scrolls.\n      if (isChrome && isOptionKeyCommand(e)) {\n        e.preventDefault();\n      }\n\n  }\n\n  var command = editor.props.keyBindingFn(e); // If no command is specified, allow keydown event to continue.\n\n  if (command == null || command === '') {\n    if (keyCode === Keys.SPACE && isChrome && isOptionKeyCommand(e)) {\n      // The default keydown event has already been prevented in order to stop\n      // Chrome from scrolling. Insert a nbsp into the editor as OSX would for\n      // other browsers.\n      var contentState = DraftModifier.replaceText(editorState.getCurrentContent(), editorState.getSelection(), \"\\xA0\");\n      editor.update(EditorState.push(editorState, contentState, 'insert-characters'));\n    }\n\n    return;\n  }\n\n  if (command === 'undo') {\n    // Since undo requires some special updating behavior to keep the editor\n    // in sync, handle it separately.\n    keyCommandUndo(e, editorState, editor.update);\n    return;\n  } // At this point, we know that we're handling a command of some kind, so\n  // we don't want to insert a character following the keydown.\n\n\n  e.preventDefault(); // Allow components higher up the tree to handle the command first.\n\n  if (editor.props.handleKeyCommand && isEventHandled(editor.props.handleKeyCommand(command, editorState, e.timeStamp))) {\n    return;\n  }\n\n  var newState = onKeyCommand(command, editorState, e);\n\n  if (newState !== editorState) {\n    editor.update(newState);\n  }\n}\n\nmodule.exports = editOnKeyDown;", "/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n'use strict';\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar URI =\n/*#__PURE__*/\nfunction () {\n  function URI(uri) {\n    _defineProperty(this, \"_uri\", void 0);\n\n    this._uri = uri;\n  }\n\n  var _proto = URI.prototype;\n\n  _proto.toString = function toString() {\n    return this._uri;\n  };\n\n  return URI;\n}();\n\nmodule.exports = URI;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar UserAgent = require(\"fbjs/lib/UserAgent\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar isOldIE = UserAgent.isBrowser('IE <= 9'); // Provides a dom node that will not execute scripts\n// https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation.createHTMLDocument\n// https://developer.mozilla.org/en-US/Add-ons/Code_snippets/HTML_to_DOM\n\nfunction getSafeBodyFromHTML(html) {\n  var doc;\n  var root = null; // Provides a safe context\n\n  if (!isOldIE && document.implementation && document.implementation.createHTMLDocument) {\n    doc = document.implementation.createHTMLDocument('foo');\n    !doc.documentElement ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Missing doc.documentElement') : invariant(false) : void 0;\n    doc.documentElement.innerHTML = html;\n    root = doc.getElementsByTagName('body')[0];\n  }\n\n  return root;\n}\n\nmodule.exports = getSafeBodyFromHTML;", "\"use strict\";\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\nvar isElement = require(\"./isElement\");\n\nfunction isHTMLAnchorElement(node) {\n  if (!node || !node.ownerDocument) {\n    return false;\n  }\n\n  return isElement(node) && node.nodeName === 'A';\n}\n\nmodule.exports = isHTMLAnchorElement;", "\"use strict\";\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\nfunction isHTMLBRElement(node) {\n  if (!node || !node.ownerDocument) {\n    return false;\n  }\n\n  if (!node.ownerDocument.defaultView) {\n    return node instanceof HTMLBRElement;\n  }\n\n  if (node instanceof node.ownerDocument.defaultView.HTMLElement) {\n    return true;\n  }\n\n  return false;\n}\n\nmodule.exports = isHTMLBRElement;", "\"use strict\";\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\nvar isElement = require(\"./isElement\");\n\nfunction isHTMLImageElement(node) {\n  if (!node || !node.ownerDocument) {\n    return false;\n  }\n\n  return isElement(node) && node.nodeName === 'IMG';\n}\n\nmodule.exports = isHTMLImageElement;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar _knownListItemDepthCl;\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar CharacterMetadata = require(\"./CharacterMetadata\");\n\nvar ContentBlock = require(\"./ContentBlock\");\n\nvar ContentBlockNode = require(\"./ContentBlockNode\");\n\nvar DefaultDraftBlockRenderMap = require(\"./DefaultDraftBlockRenderMap\");\n\nvar DraftEntity = require(\"./DraftEntity\");\n\nvar URI = require(\"fbjs/lib/URI\");\n\nvar cx = require(\"fbjs/lib/cx\");\n\nvar generateRandomKey = require(\"./generateRandomKey\");\n\nvar getSafeBodyFromHTML = require(\"./getSafeBodyFromHTML\");\n\nvar gkx = require(\"./gkx\");\n\nvar _require = require(\"immutable\"),\n    List = _require.List,\n    Map = _require.Map,\n    OrderedSet = _require.OrderedSet;\n\nvar isHTMLAnchorElement = require(\"./isHTMLAnchorElement\");\n\nvar isHTMLBRElement = require(\"./isHTMLBRElement\");\n\nvar isHTMLElement = require(\"./isHTMLElement\");\n\nvar isHTMLImageElement = require(\"./isHTMLImageElement\");\n\nvar experimentalTreeDataSupport = gkx('draft_tree_data_support');\nvar NBSP = '&nbsp;';\nvar SPACE = ' '; // used for replacing characters in HTML\n\nvar REGEX_CR = new RegExp('\\r', 'g');\nvar REGEX_LF = new RegExp('\\n', 'g');\nvar REGEX_LEADING_LF = new RegExp('^\\n', 'g');\nvar REGEX_NBSP = new RegExp(NBSP, 'g');\nvar REGEX_CARRIAGE = new RegExp('&#13;?', 'g');\nvar REGEX_ZWS = new RegExp('&#8203;?', 'g'); // https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight\n\nvar boldValues = ['bold', 'bolder', '500', '600', '700', '800', '900'];\nvar notBoldValues = ['light', 'lighter', '100', '200', '300', '400'];\nvar anchorAttr = ['className', 'href', 'rel', 'target', 'title'];\nvar imgAttr = ['alt', 'className', 'height', 'src', 'width'];\nvar knownListItemDepthClasses = (_knownListItemDepthCl = {}, _defineProperty(_knownListItemDepthCl, cx('public/DraftStyleDefault/depth0'), 0), _defineProperty(_knownListItemDepthCl, cx('public/DraftStyleDefault/depth1'), 1), _defineProperty(_knownListItemDepthCl, cx('public/DraftStyleDefault/depth2'), 2), _defineProperty(_knownListItemDepthCl, cx('public/DraftStyleDefault/depth3'), 3), _defineProperty(_knownListItemDepthCl, cx('public/DraftStyleDefault/depth4'), 4), _knownListItemDepthCl);\nvar HTMLTagToRawInlineStyleMap = Map({\n  b: 'BOLD',\n  code: 'CODE',\n  del: 'STRIKETHROUGH',\n  em: 'ITALIC',\n  i: 'ITALIC',\n  s: 'STRIKETHROUGH',\n  strike: 'STRIKETHROUGH',\n  strong: 'BOLD',\n  u: 'UNDERLINE',\n  mark: 'HIGHLIGHT'\n});\n\n/**\n * Build a mapping from HTML tags to draftjs block types\n * out of a BlockRenderMap.\n *\n * The BlockTypeMap for the default BlockRenderMap looks like this:\n *   Map({\n *     h1: 'header-one',\n *     h2: 'header-two',\n *     h3: 'header-three',\n *     h4: 'header-four',\n *     h5: 'header-five',\n *     h6: 'header-six',\n *     blockquote: 'blockquote',\n *     figure: 'atomic',\n *     pre: ['code-block'],\n *     div: 'unstyled',\n *     p: 'unstyled',\n *     li: ['ordered-list-item', 'unordered-list-item'],\n *   })\n */\nvar buildBlockTypeMap = function buildBlockTypeMap(blockRenderMap) {\n  var blockTypeMap = {};\n  blockRenderMap.mapKeys(function (blockType, desc) {\n    var elements = [desc.element];\n\n    if (desc.aliasedElements !== undefined) {\n      elements.push.apply(elements, desc.aliasedElements);\n    }\n\n    elements.forEach(function (element) {\n      if (blockTypeMap[element] === undefined) {\n        blockTypeMap[element] = blockType;\n      } else if (typeof blockTypeMap[element] === 'string') {\n        blockTypeMap[element] = [blockTypeMap[element], blockType];\n      } else {\n        blockTypeMap[element].push(blockType);\n      }\n    });\n  });\n  return Map(blockTypeMap);\n};\n/**\n * If we're pasting from one DraftEditor to another we can check to see if\n * existing list item depth classes are being used and preserve this style\n */\n\n\nvar getListItemDepth = function getListItemDepth(node) {\n  var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n  Object.keys(knownListItemDepthClasses).some(function (depthClass) {\n    if (node.classList.contains(depthClass)) {\n      depth = knownListItemDepthClasses[depthClass];\n    }\n  });\n  return depth;\n};\n/**\n * Return true if the provided HTML Element can be used to build a\n * Draftjs-compatible link.\n */\n\n\nvar isValidAnchor = function isValidAnchor(node) {\n  if (!isHTMLAnchorElement(node)) {\n    return false;\n  }\n\n  var anchorNode = node;\n  return !!(anchorNode.href && (anchorNode.protocol === 'http:' || anchorNode.protocol === 'https:' || anchorNode.protocol === 'mailto:'));\n};\n/**\n * Return true if the provided HTML Element can be used to build a\n * Draftjs-compatible image.\n */\n\n\nvar isValidImage = function isValidImage(node) {\n  if (!isHTMLImageElement(node)) {\n    return false;\n  }\n\n  var imageNode = node;\n  return !!(imageNode.attributes.getNamedItem('src') && imageNode.attributes.getNamedItem('src').value);\n};\n/**\n * Try to guess the inline style of an HTML element based on its css\n * styles (font-weight, font-style and text-decoration).\n */\n\n\nvar styleFromNodeAttributes = function styleFromNodeAttributes(node) {\n  var style = OrderedSet();\n\n  if (!isHTMLElement(node)) {\n    return style;\n  }\n\n  var htmlElement = node;\n  var fontWeight = htmlElement.style.fontWeight;\n  var fontStyle = htmlElement.style.fontStyle;\n  var textDecoration = htmlElement.style.textDecoration;\n  return style.withMutations(function (style) {\n    if (boldValues.indexOf(fontWeight) >= 0) {\n      style.add('BOLD');\n    } else if (notBoldValues.indexOf(fontWeight) >= 0) {\n      style.remove('BOLD');\n    }\n\n    if (fontStyle === 'italic') {\n      style.add('ITALIC');\n    } else if (fontStyle === 'normal') {\n      style.remove('ITALIC');\n    }\n\n    if (textDecoration === 'underline') {\n      style.add('UNDERLINE');\n    }\n\n    if (textDecoration === 'line-through') {\n      style.add('STRIKETHROUGH');\n    }\n\n    if (textDecoration === 'none') {\n      style.remove('UNDERLINE');\n      style.remove('STRIKETHROUGH');\n    }\n  });\n};\n/**\n * Determine if a nodeName is a list type, 'ul' or 'ol'\n */\n\n\nvar isListNode = function isListNode(nodeName) {\n  return nodeName === 'ul' || nodeName === 'ol';\n};\n/**\n *  ContentBlockConfig is a mutable data structure that holds all\n *  the information required to build a ContentBlock and an array of\n *  all the child nodes (childConfigs).\n *  It is being used a temporary data structure by the\n *  ContentBlocksBuilder class.\n */\n\n\n/**\n * ContentBlocksBuilder builds a list of ContentBlocks and an Entity Map\n * out of one (or several) HTMLElement(s).\n *\n * The algorithm has two passes: first it builds a tree of ContentBlockConfigs\n * by walking through the HTML nodes and their children, then it walks the\n * ContentBlockConfigs tree to compute parents/siblings and create\n * the actual ContentBlocks.\n *\n * Typical usage is:\n *     new ContentBlocksBuilder()\n *        .addDOMNode(someHTMLNode)\n *        .addDOMNode(someOtherHTMLNode)\n *       .getContentBlocks();\n *\n */\nvar ContentBlocksBuilder =\n/*#__PURE__*/\nfunction () {\n  // Most of the method in the class depend on the state of the content builder\n  // (i.e. currentBlockType, currentDepth, currentEntity etc.). Though it may\n  // be confusing at first, it made the code simpler than the alternative which\n  // is to pass those values around in every call.\n  // The following attributes are used to accumulate text and styles\n  // as we are walking the HTML node tree.\n  // Describes the future ContentState as a tree of content blocks\n  // The content blocks generated from the blockConfigs\n  // Entity map use to store links and images found in the HTML nodes\n  // Map HTML tags to draftjs block types and disambiguation function\n  function ContentBlocksBuilder(blockTypeMap, disambiguate) {\n    _defineProperty(this, \"characterList\", List());\n\n    _defineProperty(this, \"currentBlockType\", 'unstyled');\n\n    _defineProperty(this, \"currentDepth\", 0);\n\n    _defineProperty(this, \"currentEntity\", null);\n\n    _defineProperty(this, \"currentStyle\", OrderedSet());\n\n    _defineProperty(this, \"currentText\", '');\n\n    _defineProperty(this, \"wrapper\", null);\n\n    _defineProperty(this, \"blockConfigs\", []);\n\n    _defineProperty(this, \"contentBlocks\", []);\n\n    _defineProperty(this, \"entityMap\", DraftEntity);\n\n    _defineProperty(this, \"blockTypeMap\", void 0);\n\n    _defineProperty(this, \"disambiguate\", void 0);\n\n    this.clear();\n    this.blockTypeMap = blockTypeMap;\n    this.disambiguate = disambiguate;\n  }\n  /**\n   * Clear the internal state of the ContentBlocksBuilder\n   */\n\n\n  var _proto = ContentBlocksBuilder.prototype;\n\n  _proto.clear = function clear() {\n    this.characterList = List();\n    this.blockConfigs = [];\n    this.currentBlockType = 'unstyled';\n    this.currentDepth = 0;\n    this.currentEntity = null;\n    this.currentStyle = OrderedSet();\n    this.currentText = '';\n    this.entityMap = DraftEntity;\n    this.wrapper = null;\n    this.contentBlocks = [];\n  }\n  /**\n   * Add an HTMLElement to the ContentBlocksBuilder\n   */\n  ;\n\n  _proto.addDOMNode = function addDOMNode(node) {\n    var _this$blockConfigs;\n\n    this.contentBlocks = [];\n    this.currentDepth = 0; // Converts the HTML node to block config\n\n    (_this$blockConfigs = this.blockConfigs).push.apply(_this$blockConfigs, this._toBlockConfigs([node])); // There might be some left over text in the builder's\n    // internal state, if so make a ContentBlock out of it.\n\n\n    this._trimCurrentText();\n\n    if (this.currentText !== '') {\n      this.blockConfigs.push(this._makeBlockConfig());\n    } // for chaining\n\n\n    return this;\n  }\n  /**\n   * Return the ContentBlocks and the EntityMap that corresponds\n   * to the previously added HTML nodes.\n   */\n  ;\n\n  _proto.getContentBlocks = function getContentBlocks() {\n    if (this.contentBlocks.length === 0) {\n      if (experimentalTreeDataSupport) {\n        this._toContentBlocks(this.blockConfigs);\n      } else {\n        this._toFlatContentBlocks(this.blockConfigs);\n      }\n    }\n\n    return {\n      contentBlocks: this.contentBlocks,\n      entityMap: this.entityMap\n    };\n  }\n  /**\n   * Add a new inline style to the upcoming nodes.\n   */\n  ;\n\n  _proto.addStyle = function addStyle(inlineStyle) {\n    this.currentStyle = this.currentStyle.union(inlineStyle);\n  }\n  /**\n   * Remove a currently applied inline style.\n   */\n  ;\n\n  _proto.removeStyle = function removeStyle(inlineStyle) {\n    this.currentStyle = this.currentStyle.subtract(inlineStyle);\n  } // ***********************************WARNING******************************\n  // The methods below this line are private - don't call them directly.\n\n  /**\n   * Generate a new ContentBlockConfig out of the current internal state\n   * of the builder, then clears the internal state.\n   */\n  ;\n\n  _proto._makeBlockConfig = function _makeBlockConfig() {\n    var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n    var key = config.key || generateRandomKey();\n\n    var block = _objectSpread({\n      key: key,\n      type: this.currentBlockType,\n      text: this.currentText,\n      characterList: this.characterList,\n      depth: this.currentDepth,\n      parent: null,\n      children: List(),\n      prevSibling: null,\n      nextSibling: null,\n      childConfigs: []\n    }, config);\n\n    this.characterList = List();\n    this.currentBlockType = 'unstyled';\n    this.currentText = '';\n    return block;\n  }\n  /**\n   * Converts an array of HTML elements to a multi-root tree of content\n   * block configs. Some text content may be left in the builders internal\n   * state to enable chaining sucessive calls.\n   */\n  ;\n\n  _proto._toBlockConfigs = function _toBlockConfigs(nodes) {\n    var blockConfigs = [];\n\n    for (var i = 0; i < nodes.length; i++) {\n      var node = nodes[i];\n      var nodeName = node.nodeName.toLowerCase();\n\n      if (nodeName === 'body' || isListNode(nodeName)) {\n        // body, ol and ul are 'block' type nodes so create a block config\n        // with the text accumulated so far (if any)\n        this._trimCurrentText();\n\n        if (this.currentText !== '') {\n          blockConfigs.push(this._makeBlockConfig());\n        } // body, ol and ul nodes are ignored, but their children are inlined in\n        // the parent block config.\n\n\n        var wasCurrentDepth = this.currentDepth;\n        var wasWrapper = this.wrapper;\n\n        if (isListNode(nodeName)) {\n          this.wrapper = nodeName;\n\n          if (isListNode(wasWrapper)) {\n            this.currentDepth++;\n          }\n        }\n\n        blockConfigs.push.apply(blockConfigs, this._toBlockConfigs(Array.from(node.childNodes)));\n        this.currentDepth = wasCurrentDepth;\n        this.wrapper = wasWrapper;\n        continue;\n      }\n\n      var blockType = this.blockTypeMap.get(nodeName);\n\n      if (blockType !== undefined) {\n        // 'block' type node means we need to create a block config\n        // with the text accumulated so far (if any)\n        this._trimCurrentText();\n\n        if (this.currentText !== '') {\n          blockConfigs.push(this._makeBlockConfig());\n        }\n\n        var _wasCurrentDepth = this.currentDepth;\n        var _wasWrapper = this.wrapper;\n        this.wrapper = nodeName === 'pre' ? 'pre' : this.wrapper;\n\n        if (typeof blockType !== 'string') {\n          blockType = this.disambiguate(nodeName, this.wrapper) || blockType[0] || 'unstyled';\n        }\n\n        if (!experimentalTreeDataSupport && isHTMLElement(node) && (blockType === 'unordered-list-item' || blockType === 'ordered-list-item')) {\n          var htmlElement = node;\n          this.currentDepth = getListItemDepth(htmlElement, this.currentDepth);\n        }\n\n        var key = generateRandomKey();\n\n        var childConfigs = this._toBlockConfigs(Array.from(node.childNodes));\n\n        this._trimCurrentText();\n\n        blockConfigs.push(this._makeBlockConfig({\n          key: key,\n          childConfigs: childConfigs,\n          type: blockType\n        }));\n        this.currentDepth = _wasCurrentDepth;\n        this.wrapper = _wasWrapper;\n        continue;\n      }\n\n      if (nodeName === '#text') {\n        this._addTextNode(node);\n\n        continue;\n      }\n\n      if (nodeName === 'br') {\n        this._addBreakNode(node);\n\n        continue;\n      }\n\n      if (isValidImage(node)) {\n        this._addImgNode(node);\n\n        continue;\n      }\n\n      if (isValidAnchor(node)) {\n        this._addAnchorNode(node, blockConfigs);\n\n        continue;\n      }\n\n      var inlineStyle = HTMLTagToRawInlineStyleMap.has(nodeName) ? OrderedSet.of(HTMLTagToRawInlineStyleMap.get(nodeName)) : OrderedSet();\n      var attributesStyle = styleFromNodeAttributes(node);\n      this.addStyle(inlineStyle);\n      this.addStyle(attributesStyle);\n      blockConfigs.push.apply(blockConfigs, this._toBlockConfigs(Array.from(node.childNodes)));\n      this.removeStyle(attributesStyle);\n      this.removeStyle(inlineStyle);\n    }\n\n    return blockConfigs;\n  }\n  /**\n   * Append a string of text to the internal buffer.\n   */\n  ;\n\n  _proto._appendText = function _appendText(text) {\n    var _this$characterList;\n\n    this.currentText += text;\n    var characterMetadata = CharacterMetadata.create({\n      style: this.currentStyle,\n      entity: this.currentEntity\n    });\n    this.characterList = (_this$characterList = this.characterList).push.apply(_this$characterList, Array(text.length).fill(characterMetadata));\n  }\n  /**\n   * Trim the text in the internal buffer.\n   */\n  ;\n\n  _proto._trimCurrentText = function _trimCurrentText() {\n    var l = this.currentText.length;\n    var begin = l - this.currentText.trimLeft().length;\n    var end = this.currentText.trimRight().length; // We should not trim whitespaces for which an entity is defined.\n\n    var entity = this.characterList.findEntry(function (characterMetadata) {\n      return characterMetadata.getEntity() !== null;\n    });\n    begin = entity !== undefined ? Math.min(begin, entity[0]) : begin;\n    entity = this.characterList.reverse().findEntry(function (characterMetadata) {\n      return characterMetadata.getEntity() !== null;\n    });\n    end = entity !== undefined ? Math.max(end, l - entity[0]) : end;\n\n    if (begin > end) {\n      this.currentText = '';\n      this.characterList = List();\n    } else {\n      this.currentText = this.currentText.slice(begin, end);\n      this.characterList = this.characterList.slice(begin, end);\n    }\n  }\n  /**\n   * Add the content of an HTML text node to the internal state\n   */\n  ;\n\n  _proto._addTextNode = function _addTextNode(node) {\n    var text = node.textContent;\n    var trimmedText = text.trim(); // If we are not in a pre block and the trimmed content is empty,\n    // normalize to a single space.\n\n    if (trimmedText === '' && this.wrapper !== 'pre') {\n      text = ' ';\n    }\n\n    if (this.wrapper !== 'pre') {\n      // Trim leading line feed, which is invisible in HTML\n      text = text.replace(REGEX_LEADING_LF, ''); // Can't use empty string because MSWord\n\n      text = text.replace(REGEX_LF, SPACE);\n    }\n\n    this._appendText(text);\n  };\n\n  _proto._addBreakNode = function _addBreakNode(node) {\n    if (!isHTMLBRElement(node)) {\n      return;\n    }\n\n    this._appendText('\\n');\n  }\n  /**\n   * Add the content of an HTML img node to the internal state\n   */\n  ;\n\n  _proto._addImgNode = function _addImgNode(node) {\n    if (!isHTMLImageElement(node)) {\n      return;\n    }\n\n    var image = node;\n    var entityConfig = {};\n    imgAttr.forEach(function (attr) {\n      var imageAttribute = image.getAttribute(attr);\n\n      if (imageAttribute) {\n        entityConfig[attr] = imageAttribute;\n      }\n    }); // TODO: T15530363 update this when we remove DraftEntity entirely\n\n    this.currentEntity = this.entityMap.__create('IMAGE', 'IMMUTABLE', entityConfig); // The child text node cannot just have a space or return as content (since\n    // we strip those out), unless the image is for presentation only.\n    // See https://github.com/facebook/draft-js/issues/231 for some context.\n\n    if (gkx('draftjs_fix_paste_for_img')) {\n      if (image.getAttribute('role') !== 'presentation') {\n        this._appendText(\"\\uD83D\\uDCF7\");\n      }\n    } else {\n      this._appendText(\"\\uD83D\\uDCF7\");\n    }\n\n    this.currentEntity = null;\n  }\n  /**\n   * Add the content of an HTML 'a' node to the internal state. Child nodes\n   * (if any) are converted to Block Configs and appended to the provided\n   * blockConfig array.\n   */\n  ;\n\n  _proto._addAnchorNode = function _addAnchorNode(node, blockConfigs) {\n    // The check has already been made by isValidAnchor but\n    // we have to do it again to keep flow happy.\n    if (!isHTMLAnchorElement(node)) {\n      return;\n    }\n\n    var anchor = node;\n    var entityConfig = {};\n    anchorAttr.forEach(function (attr) {\n      var anchorAttribute = anchor.getAttribute(attr);\n\n      if (anchorAttribute) {\n        entityConfig[attr] = anchorAttribute;\n      }\n    });\n    entityConfig.url = new URI(anchor.href).toString(); // TODO: T15530363 update this when we remove DraftEntity completely\n\n    this.currentEntity = this.entityMap.__create('LINK', 'MUTABLE', entityConfig || {});\n    blockConfigs.push.apply(blockConfigs, this._toBlockConfigs(Array.from(node.childNodes)));\n    this.currentEntity = null;\n  }\n  /**\n   * Walk the BlockConfig tree, compute parent/children/siblings,\n   * and generate the corresponding ContentBlockNode\n   */\n  ;\n\n  _proto._toContentBlocks = function _toContentBlocks(blockConfigs) {\n    var parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n    var l = blockConfigs.length - 1;\n\n    for (var i = 0; i <= l; i++) {\n      var config = blockConfigs[i];\n      config.parent = parent;\n      config.prevSibling = i > 0 ? blockConfigs[i - 1].key : null;\n      config.nextSibling = i < l ? blockConfigs[i + 1].key : null;\n      config.children = List(config.childConfigs.map(function (child) {\n        return child.key;\n      }));\n      this.contentBlocks.push(new ContentBlockNode(_objectSpread({}, config)));\n\n      this._toContentBlocks(config.childConfigs, config.key);\n    }\n  }\n  /**\n   * Remove 'useless' container nodes from the block config hierarchy, by\n   * replacing them with their children.\n   */\n  ;\n\n  _proto._hoistContainersInBlockConfigs = function _hoistContainersInBlockConfigs(blockConfigs) {\n    var _this = this;\n\n    var hoisted = List(blockConfigs).flatMap(function (blockConfig) {\n      // Don't mess with useful blocks\n      if (blockConfig.type !== 'unstyled' || blockConfig.text !== '') {\n        return [blockConfig];\n      }\n\n      return _this._hoistContainersInBlockConfigs(blockConfig.childConfigs);\n    });\n    return hoisted;\n  } // ***********************************************************************\n  // The two methods below are used for backward compatibility when\n  // experimentalTreeDataSupport is disabled.\n\n  /**\n   * Same as _toContentBlocks but replaces nested blocks by their\n   * text content.\n   */\n  ;\n\n  _proto._toFlatContentBlocks = function _toFlatContentBlocks(blockConfigs) {\n    var _this2 = this;\n\n    var cleanConfigs = this._hoistContainersInBlockConfigs(blockConfigs);\n\n    cleanConfigs.forEach(function (config) {\n      var _this2$_extractTextFr = _this2._extractTextFromBlockConfigs(config.childConfigs),\n          text = _this2$_extractTextFr.text,\n          characterList = _this2$_extractTextFr.characterList;\n\n      _this2.contentBlocks.push(new ContentBlock(_objectSpread({}, config, {\n        text: config.text + text,\n        characterList: config.characterList.concat(characterList)\n      })));\n    });\n  }\n  /**\n   * Extract the text and the associated inline styles form an\n   * array of content block configs.\n   */\n  ;\n\n  _proto._extractTextFromBlockConfigs = function _extractTextFromBlockConfigs(blockConfigs) {\n    var l = blockConfigs.length - 1;\n    var text = '';\n    var characterList = List();\n\n    for (var i = 0; i <= l; i++) {\n      var config = blockConfigs[i];\n      text += config.text;\n      characterList = characterList.concat(config.characterList);\n\n      if (text !== '' && config.type !== 'unstyled') {\n        text += '\\n';\n        characterList = characterList.push(characterList.last());\n      }\n\n      var children = this._extractTextFromBlockConfigs(config.childConfigs);\n\n      text += children.text;\n      characterList = characterList.concat(children.characterList);\n    }\n\n    return {\n      text: text,\n      characterList: characterList\n    };\n  };\n\n  return ContentBlocksBuilder;\n}();\n/**\n * Converts an HTML string to an array of ContentBlocks and an EntityMap\n * suitable to initialize the internal state of a Draftjs component.\n */\n\n\nvar convertFromHTMLToContentBlocks = function convertFromHTMLToContentBlocks(html) {\n  var DOMBuilder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getSafeBodyFromHTML;\n  var blockRenderMap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DefaultDraftBlockRenderMap;\n  // Be ABSOLUTELY SURE that the dom builder you pass here won't execute\n  // arbitrary code in whatever environment you're running this in. For an\n  // example of how we try to do this in-browser, see getSafeBodyFromHTML.\n  // Remove funky characters from the HTML string\n  html = html.trim().replace(REGEX_CR, '').replace(REGEX_NBSP, SPACE).replace(REGEX_CARRIAGE, '').replace(REGEX_ZWS, ''); // Build a DOM tree out of the HTML string\n\n  var safeBody = DOMBuilder(html);\n\n  if (!safeBody) {\n    return null;\n  } // Build a BlockTypeMap out of the BlockRenderMap\n\n\n  var blockTypeMap = buildBlockTypeMap(blockRenderMap); // Select the proper block type for the cases where the blockRenderMap\n  // uses multiple block types for the same html tag.\n\n  var disambiguate = function disambiguate(tag, wrapper) {\n    if (tag === 'li') {\n      return wrapper === 'ol' ? 'ordered-list-item' : 'unordered-list-item';\n    }\n\n    return null;\n  };\n\n  return new ContentBlocksBuilder(blockTypeMap, disambiguate).addDOMNode(safeBody).getContentBlocks();\n};\n\nmodule.exports = convertFromHTMLToContentBlocks;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar ContentBlock = require(\"./ContentBlock\");\n\nvar ContentBlockNode = require(\"./ContentBlockNode\");\n\nvar convertFromHTMLToContentBlocks = require(\"./convertFromHTMLToContentBlocks\");\n\nvar generateRandomKey = require(\"./generateRandomKey\");\n\nvar getSafeBodyFromHTML = require(\"./getSafeBodyFromHTML\");\n\nvar gkx = require(\"./gkx\");\n\nvar Immutable = require(\"immutable\");\n\nvar sanitizeDraftText = require(\"./sanitizeDraftText\");\n\nvar List = Immutable.List,\n    Repeat = Immutable.Repeat;\nvar experimentalTreeDataSupport = gkx('draft_tree_data_support');\nvar ContentBlockRecord = experimentalTreeDataSupport ? ContentBlockNode : ContentBlock;\nvar DraftPasteProcessor = {\n  processHTML: function processHTML(html, blockRenderMap) {\n    return convertFromHTMLToContentBlocks(html, getSafeBodyFromHTML, blockRenderMap);\n  },\n  processText: function processText(textBlocks, character, type) {\n    return textBlocks.reduce(function (acc, textLine, index) {\n      textLine = sanitizeDraftText(textLine);\n      var key = generateRandomKey();\n      var blockNodeConfig = {\n        key: key,\n        type: type,\n        text: textLine,\n        characterList: List(Repeat(character, textLine.length))\n      }; // next block updates previous block\n\n      if (experimentalTreeDataSupport && index !== 0) {\n        var prevSiblingIndex = index - 1; // update previous block\n\n        var previousBlock = acc[prevSiblingIndex] = acc[prevSiblingIndex].merge({\n          nextSibling: key\n        });\n        blockNodeConfig = _objectSpread({}, blockNodeConfig, {\n          prevSibling: previousBlock.getKey()\n        });\n      }\n\n      acc.push(new ContentBlockRecord(blockNodeConfig));\n      return acc;\n    }, []);\n  }\n};\nmodule.exports = DraftPasteProcessor;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nfunction adjustBlockDepthForContentState(contentState, selectionState, adjustment, maxDepth) {\n  var startKey = selectionState.getStartKey();\n  var endKey = selectionState.getEndKey();\n  var blockMap = contentState.getBlockMap();\n  var blocks = blockMap.toSeq().skipUntil(function (_, k) {\n    return k === startKey;\n  }).takeUntil(function (_, k) {\n    return k === endKey;\n  }).concat([[endKey, blockMap.get(endKey)]]).map(function (block) {\n    var depth = block.getDepth() + adjustment;\n    depth = Math.max(0, Math.min(depth, maxDepth));\n    return block.set('depth', depth);\n  });\n  blockMap = blockMap.merge(blocks);\n  return contentState.merge({\n    blockMap: blockMap,\n    selectionBefore: selectionState,\n    selectionAfter: selectionState\n  });\n}\n\nmodule.exports = adjustBlockDepthForContentState;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar DraftModifier = require(\"./DraftModifier\");\n\nvar EditorState = require(\"./EditorState\");\n\nvar adjustBlockDepthForContentState = require(\"./adjustBlockDepthForContentState\");\n\nvar nullthrows = require(\"fbjs/lib/nullthrows\");\n\nvar RichTextEditorUtil = {\n  currentBlockContainsLink: function currentBlockContainsLink(editorState) {\n    var selection = editorState.getSelection();\n    var contentState = editorState.getCurrentContent();\n    var entityMap = contentState.getEntityMap();\n    return contentState.getBlockForKey(selection.getAnchorKey()).getCharacterList().slice(selection.getStartOffset(), selection.getEndOffset()).some(function (v) {\n      var entity = v.getEntity();\n      return !!entity && entityMap.__get(entity).getType() === 'LINK';\n    });\n  },\n  getCurrentBlockType: function getCurrentBlockType(editorState) {\n    var selection = editorState.getSelection();\n    return editorState.getCurrentContent().getBlockForKey(selection.getStartKey()).getType();\n  },\n  getDataObjectForLinkURL: function getDataObjectForLinkURL(uri) {\n    return {\n      url: uri.toString()\n    };\n  },\n  handleKeyCommand: function handleKeyCommand(editorState, command, eventTimeStamp) {\n    switch (command) {\n      case 'bold':\n        return RichTextEditorUtil.toggleInlineStyle(editorState, 'BOLD');\n\n      case 'italic':\n        return RichTextEditorUtil.toggleInlineStyle(editorState, 'ITALIC');\n\n      case 'underline':\n        return RichTextEditorUtil.toggleInlineStyle(editorState, 'UNDERLINE');\n\n      case 'code':\n        return RichTextEditorUtil.toggleCode(editorState);\n\n      case 'backspace':\n      case 'backspace-word':\n      case 'backspace-to-start-of-line':\n        return RichTextEditorUtil.onBackspace(editorState);\n\n      case 'delete':\n      case 'delete-word':\n      case 'delete-to-end-of-block':\n        return RichTextEditorUtil.onDelete(editorState);\n\n      default:\n        // they may have custom editor commands; ignore those\n        return null;\n    }\n  },\n  insertSoftNewline: function insertSoftNewline(editorState) {\n    var contentState = DraftModifier.insertText(editorState.getCurrentContent(), editorState.getSelection(), '\\n', editorState.getCurrentInlineStyle(), null);\n    var newEditorState = EditorState.push(editorState, contentState, 'insert-characters');\n    return EditorState.forceSelection(newEditorState, contentState.getSelectionAfter());\n  },\n\n  /**\n   * For collapsed selections at the start of styled blocks, backspace should\n   * just remove the existing style.\n   */\n  onBackspace: function onBackspace(editorState) {\n    var selection = editorState.getSelection();\n\n    if (!selection.isCollapsed() || selection.getAnchorOffset() || selection.getFocusOffset()) {\n      return null;\n    } // First, try to remove a preceding atomic block.\n\n\n    var content = editorState.getCurrentContent();\n    var startKey = selection.getStartKey();\n    var blockBefore = content.getBlockBefore(startKey);\n\n    if (blockBefore && blockBefore.getType() === 'atomic') {\n      var blockMap = content.getBlockMap()[\"delete\"](blockBefore.getKey());\n      var withoutAtomicBlock = content.merge({\n        blockMap: blockMap,\n        selectionAfter: selection\n      });\n\n      if (withoutAtomicBlock !== content) {\n        return EditorState.push(editorState, withoutAtomicBlock, 'remove-range');\n      }\n    } // If that doesn't succeed, try to remove the current block style.\n\n\n    var withoutBlockStyle = RichTextEditorUtil.tryToRemoveBlockStyle(editorState);\n\n    if (withoutBlockStyle) {\n      return EditorState.push(editorState, withoutBlockStyle, 'change-block-type');\n    }\n\n    return null;\n  },\n  onDelete: function onDelete(editorState) {\n    var selection = editorState.getSelection();\n\n    if (!selection.isCollapsed()) {\n      return null;\n    }\n\n    var content = editorState.getCurrentContent();\n    var startKey = selection.getStartKey();\n    var block = content.getBlockForKey(startKey);\n    var length = block.getLength(); // The cursor is somewhere within the text. Behave normally.\n\n    if (selection.getStartOffset() < length) {\n      return null;\n    }\n\n    var blockAfter = content.getBlockAfter(startKey);\n\n    if (!blockAfter || blockAfter.getType() !== 'atomic') {\n      return null;\n    }\n\n    var atomicBlockTarget = selection.merge({\n      focusKey: blockAfter.getKey(),\n      focusOffset: blockAfter.getLength()\n    });\n    var withoutAtomicBlock = DraftModifier.removeRange(content, atomicBlockTarget, 'forward');\n\n    if (withoutAtomicBlock !== content) {\n      return EditorState.push(editorState, withoutAtomicBlock, 'remove-range');\n    }\n\n    return null;\n  },\n  onTab: function onTab(event, editorState, maxDepth) {\n    var selection = editorState.getSelection();\n    var key = selection.getAnchorKey();\n\n    if (key !== selection.getFocusKey()) {\n      return editorState;\n    }\n\n    var content = editorState.getCurrentContent();\n    var block = content.getBlockForKey(key);\n    var type = block.getType();\n\n    if (type !== 'unordered-list-item' && type !== 'ordered-list-item') {\n      return editorState;\n    }\n\n    event.preventDefault();\n    var depth = block.getDepth();\n\n    if (!event.shiftKey && depth === maxDepth) {\n      return editorState;\n    }\n\n    var withAdjustment = adjustBlockDepthForContentState(content, selection, event.shiftKey ? -1 : 1, maxDepth);\n    return EditorState.push(editorState, withAdjustment, 'adjust-depth');\n  },\n  toggleBlockType: function toggleBlockType(editorState, blockType) {\n    var selection = editorState.getSelection();\n    var startKey = selection.getStartKey();\n    var endKey = selection.getEndKey();\n    var content = editorState.getCurrentContent();\n    var target = selection; // Triple-click can lead to a selection that includes offset 0 of the\n    // following block. The `SelectionState` for this case is accurate, but\n    // we should avoid toggling block type for the trailing block because it\n    // is a confusing interaction.\n\n    if (startKey !== endKey && selection.getEndOffset() === 0) {\n      var blockBefore = nullthrows(content.getBlockBefore(endKey));\n      endKey = blockBefore.getKey();\n      target = target.merge({\n        anchorKey: startKey,\n        anchorOffset: selection.getStartOffset(),\n        focusKey: endKey,\n        focusOffset: blockBefore.getLength(),\n        isBackward: false\n      });\n    }\n\n    var hasAtomicBlock = content.getBlockMap().skipWhile(function (_, k) {\n      return k !== startKey;\n    }).reverse().skipWhile(function (_, k) {\n      return k !== endKey;\n    }).some(function (v) {\n      return v.getType() === 'atomic';\n    });\n\n    if (hasAtomicBlock) {\n      return editorState;\n    }\n\n    var typeToSet = content.getBlockForKey(startKey).getType() === blockType ? 'unstyled' : blockType;\n    return EditorState.push(editorState, DraftModifier.setBlockType(content, target, typeToSet), 'change-block-type');\n  },\n  toggleCode: function toggleCode(editorState) {\n    var selection = editorState.getSelection();\n    var anchorKey = selection.getAnchorKey();\n    var focusKey = selection.getFocusKey();\n\n    if (selection.isCollapsed() || anchorKey !== focusKey) {\n      return RichTextEditorUtil.toggleBlockType(editorState, 'code-block');\n    }\n\n    return RichTextEditorUtil.toggleInlineStyle(editorState, 'CODE');\n  },\n\n  /**\n   * Toggle the specified inline style for the selection. If the\n   * user's selection is collapsed, apply or remove the style for the\n   * internal state. If it is not collapsed, apply the change directly\n   * to the document state.\n   */\n  toggleInlineStyle: function toggleInlineStyle(editorState, inlineStyle) {\n    var selection = editorState.getSelection();\n    var currentStyle = editorState.getCurrentInlineStyle(); // If the selection is collapsed, toggle the specified style on or off and\n    // set the result as the new inline style override. This will then be\n    // used as the inline style for the next character to be inserted.\n\n    if (selection.isCollapsed()) {\n      return EditorState.setInlineStyleOverride(editorState, currentStyle.has(inlineStyle) ? currentStyle.remove(inlineStyle) : currentStyle.add(inlineStyle));\n    } // If characters are selected, immediately apply or remove the\n    // inline style on the document state itself.\n\n\n    var content = editorState.getCurrentContent();\n    var newContent; // If the style is already present for the selection range, remove it.\n    // Otherwise, apply it.\n\n    if (currentStyle.has(inlineStyle)) {\n      newContent = DraftModifier.removeInlineStyle(content, selection, inlineStyle);\n    } else {\n      newContent = DraftModifier.applyInlineStyle(content, selection, inlineStyle);\n    }\n\n    return EditorState.push(editorState, newContent, 'change-inline-style');\n  },\n  toggleLink: function toggleLink(editorState, targetSelection, entityKey) {\n    var withoutLink = DraftModifier.applyEntity(editorState.getCurrentContent(), targetSelection, entityKey);\n    return EditorState.push(editorState, withoutLink, 'apply-entity');\n  },\n\n  /**\n   * When a collapsed cursor is at the start of a styled block, changes block\n   * type to 'unstyled'. Returns null if selection does not meet that criteria.\n   */\n  tryToRemoveBlockStyle: function tryToRemoveBlockStyle(editorState) {\n    var selection = editorState.getSelection();\n    var offset = selection.getAnchorOffset();\n\n    if (selection.isCollapsed() && offset === 0) {\n      var key = selection.getAnchorKey();\n      var content = editorState.getCurrentContent();\n      var block = content.getBlockForKey(key);\n      var type = block.getType();\n      var blockBefore = content.getBlockBefore(key);\n\n      if (type === 'code-block' && blockBefore && blockBefore.getType() === 'code-block' && blockBefore.getLength() !== 0) {\n        return null;\n      }\n\n      if (type !== 'unstyled') {\n        return DraftModifier.setBlockType(content, selection, 'unstyled');\n      }\n    }\n\n    return null;\n  }\n};\nmodule.exports = RichTextEditorUtil;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar NEWLINE_REGEX = /\\r\\n?|\\n/g;\n\nfunction splitTextIntoTextBlocks(text) {\n  return text.split(NEWLINE_REGEX);\n}\n\nmodule.exports = splitTextIntoTextBlocks;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar BlockMapBuilder = require(\"./BlockMapBuilder\");\n\nvar CharacterMetadata = require(\"./CharacterMetadata\");\n\nvar DataTransfer = require(\"fbjs/lib/DataTransfer\");\n\nvar DraftModifier = require(\"./DraftModifier\");\n\nvar DraftPasteProcessor = require(\"./DraftPasteProcessor\");\n\nvar EditorState = require(\"./EditorState\");\n\nvar RichTextEditorUtil = require(\"./RichTextEditorUtil\");\n\nvar getEntityKeyForSelection = require(\"./getEntityKeyForSelection\");\n\nvar getTextContentFromFiles = require(\"./getTextContentFromFiles\");\n\nvar isEventHandled = require(\"./isEventHandled\");\n\nvar splitTextIntoTextBlocks = require(\"./splitTextIntoTextBlocks\");\n/**\n * Paste content.\n */\n\n\nfunction editOnPaste(editor, e) {\n  e.preventDefault();\n  var data = new DataTransfer(e.clipboardData); // Get files, unless this is likely to be a string the user wants inline.\n\n  if (!data.isRichText()) {\n    /* $FlowFixMe This comment suppresses an error found DataTransfer was typed.\n     * getFiles() returns an array of <Files extends Blob>, not Blob */\n    var files = data.getFiles();\n    var defaultFileText = data.getText();\n\n    if (files.length > 0) {\n      // Allow customized paste handling for images, etc. Otherwise, fall\n      // through to insert text contents into the editor.\n      if (editor.props.handlePastedFiles && isEventHandled(editor.props.handlePastedFiles(files))) {\n        return;\n      }\n\n      getTextContentFromFiles(files, function (\n      /*string*/\n      fileText) {\n        fileText = fileText || defaultFileText;\n\n        if (!fileText) {\n          return;\n        }\n\n        var editorState = editor._latestEditorState;\n        var blocks = splitTextIntoTextBlocks(fileText);\n        var character = CharacterMetadata.create({\n          style: editorState.getCurrentInlineStyle(),\n          entity: getEntityKeyForSelection(editorState.getCurrentContent(), editorState.getSelection())\n        });\n        var currentBlockType = RichTextEditorUtil.getCurrentBlockType(editorState);\n        var text = DraftPasteProcessor.processText(blocks, character, currentBlockType);\n        var fragment = BlockMapBuilder.createFromArray(text);\n        var withInsertedText = DraftModifier.replaceWithFragment(editorState.getCurrentContent(), editorState.getSelection(), fragment);\n        editor.update(EditorState.push(editorState, withInsertedText, 'insert-fragment'));\n      });\n      return;\n    }\n  }\n\n  var textBlocks = [];\n  var text = data.getText();\n  var html = data.getHTML();\n  var editorState = editor._latestEditorState;\n\n  if (editor.props.handlePastedText && isEventHandled(editor.props.handlePastedText(text, html, editorState))) {\n    return;\n  }\n\n  if (text) {\n    textBlocks = splitTextIntoTextBlocks(text);\n  }\n\n  if (!editor.props.stripPastedStyles) {\n    // If the text from the paste event is rich content that matches what we\n    // already have on the internal clipboard, assume that we should just use\n    // the clipboard fragment for the paste. This will allow us to preserve\n    // styling and entities, if any are present. Note that newlines are\n    // stripped during comparison -- this is because copy/paste within the\n    // editor in Firefox and IE will not include empty lines. The resulting\n    // paste will preserve the newlines correctly.\n    var internalClipboard = editor.getClipboard();\n\n    if (data.isRichText() && internalClipboard) {\n      if ( // If the editorKey is present in the pasted HTML, it should be safe to\n      // assume this is an internal paste.\n      html.indexOf(editor.getEditorKey()) !== -1 || // The copy may have been made within a single block, in which case the\n      // editor key won't be part of the paste. In this case, just check\n      // whether the pasted text matches the internal clipboard.\n      textBlocks.length === 1 && internalClipboard.size === 1 && internalClipboard.first().getText() === text) {\n        editor.update(insertFragment(editor._latestEditorState, internalClipboard));\n        return;\n      }\n    } else if (internalClipboard && data.types.includes('com.apple.webarchive') && !data.types.includes('text/html') && areTextBlocksAndClipboardEqual(textBlocks, internalClipboard)) {\n      // Safari does not properly store text/html in some cases.\n      // Use the internalClipboard if present and equal to what is on\n      // the clipboard. See https://bugs.webkit.org/show_bug.cgi?id=19893.\n      editor.update(insertFragment(editor._latestEditorState, internalClipboard));\n      return;\n    } // If there is html paste data, try to parse that.\n\n\n    if (html) {\n      var htmlFragment = DraftPasteProcessor.processHTML(html, editor.props.blockRenderMap);\n\n      if (htmlFragment) {\n        var contentBlocks = htmlFragment.contentBlocks,\n            entityMap = htmlFragment.entityMap;\n\n        if (contentBlocks) {\n          var htmlMap = BlockMapBuilder.createFromArray(contentBlocks);\n          editor.update(insertFragment(editor._latestEditorState, htmlMap, entityMap));\n          return;\n        }\n      }\n    } // Otherwise, create a new fragment from our pasted text. Also\n    // empty the internal clipboard, since it's no longer valid.\n\n\n    editor.setClipboard(null);\n  }\n\n  if (textBlocks.length) {\n    var character = CharacterMetadata.create({\n      style: editorState.getCurrentInlineStyle(),\n      entity: getEntityKeyForSelection(editorState.getCurrentContent(), editorState.getSelection())\n    });\n    var currentBlockType = RichTextEditorUtil.getCurrentBlockType(editorState);\n    var textFragment = DraftPasteProcessor.processText(textBlocks, character, currentBlockType);\n    var textMap = BlockMapBuilder.createFromArray(textFragment);\n    editor.update(insertFragment(editor._latestEditorState, textMap));\n  }\n}\n\nfunction insertFragment(editorState, fragment, entityMap) {\n  var newContent = DraftModifier.replaceWithFragment(editorState.getCurrentContent(), editorState.getSelection(), fragment); // TODO: merge the entity map once we stop using DraftEntity\n  // like this:\n  // const mergedEntityMap = newContent.getEntityMap().merge(entityMap);\n\n  return EditorState.push(editorState, newContent.set('entityMap', entityMap), 'insert-fragment');\n}\n\nfunction areTextBlocksAndClipboardEqual(textBlocks, blockMap) {\n  return textBlocks.length === blockMap.size && blockMap.valueSeq().every(function (block, ii) {\n    return block.getText() === textBlocks[ii];\n  });\n}\n\nmodule.exports = editOnPaste;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar UserAgent = require(\"fbjs/lib/UserAgent\");\n\nvar onBeforeInput = require(\"./editOnBeforeInput\");\n\nvar onBlur = require(\"./editOnBlur\");\n\nvar onCompositionStart = require(\"./editOnCompositionStart\");\n\nvar onCopy = require(\"./editOnCopy\");\n\nvar onCut = require(\"./editOnCut\");\n\nvar onDragOver = require(\"./editOnDragOver\");\n\nvar onDragStart = require(\"./editOnDragStart\");\n\nvar onFocus = require(\"./editOnFocus\");\n\nvar onInput = require(\"./editOnInput\");\n\nvar onKeyDown = require(\"./editOnKeyDown\");\n\nvar onPaste = require(\"./editOnPaste\");\n\nvar onSelect = require(\"./editOnSelect\");\n\nvar isChrome = UserAgent.isBrowser('Chrome');\nvar selectionHandler = isChrome ? onSelect : function (e) {};\nvar DraftEditorEditHandler = {\n  onBeforeInput: onBeforeInput,\n  onBlur: onBlur,\n  onCompositionStart: onCompositionStart,\n  onCopy: onCopy,\n  onCut: onCut,\n  onDragOver: onDragOver,\n  onDragStart: onDragStart,\n  onFocus: onFocus,\n  onInput: onInput,\n  onKeyDown: onKeyDown,\n  onPaste: onPaste,\n  onSelect: onSelect,\n  // In certain cases, contenteditable on chrome does not fire the onSelect\n  // event, causing problems with cursor positioning. Therefore, the selection\n  // state update handler is added to more events to ensure that the selection\n  // state is always synced with the actual cursor positions.\n  onMouseUp: selectionHandler,\n  onKeyUp: selectionHandler\n};\nmodule.exports = DraftEditorEditHandler;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nvar React = require(\"react\");\n\nvar cx = require(\"fbjs/lib/cx\");\n\n/**\n * This component is responsible for rendering placeholder text for the\n * `DraftEditor` component.\n *\n * Override placeholder style via CSS.\n */\nvar DraftEditorPlaceholder =\n/*#__PURE__*/\nfunction (_React$Component) {\n  _inheritsLoose(DraftEditorPlaceholder, _React$Component);\n\n  function DraftEditorPlaceholder() {\n    return _React$Component.apply(this, arguments) || this;\n  }\n\n  var _proto = DraftEditorPlaceholder.prototype;\n\n  _proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {\n    return this.props.text !== nextProps.text || this.props.editorState.getSelection().getHasFocus() !== nextProps.editorState.getSelection().getHasFocus();\n  };\n\n  _proto.render = function render() {\n    var hasFocus = this.props.editorState.getSelection().getHasFocus();\n    var className = cx({\n      'public/DraftEditorPlaceholder/root': true,\n      'public/DraftEditorPlaceholder/hasFocus': hasFocus\n    });\n    var contentStyle = {\n      whiteSpace: 'pre-wrap'\n    };\n    return React.createElement(\"div\", {\n      className: className\n    }, React.createElement(\"div\", {\n      className: cx('public/DraftEditorPlaceholder/inner'),\n      id: this.props.accessibilityID,\n      style: contentStyle\n    }, this.props.text));\n  };\n\n  return DraftEditorPlaceholder;\n}(React.Component);\n\nmodule.exports = DraftEditorPlaceholder;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar KeyBindingUtil = require(\"./KeyBindingUtil\");\n\nvar Keys = require(\"fbjs/lib/Keys\");\n\nvar UserAgent = require(\"fbjs/lib/UserAgent\");\n\nvar isOSX = UserAgent.isPlatform('Mac OS X'); // Firefox on OSX had a bug resulting in navigation instead of cursor movement.\n// This bug was fixed in Firefox 29. Feature detection is virtually impossible\n// so we just check the version number. See #342765.\n\nvar shouldFixFirefoxMovement = isOSX && UserAgent.isBrowser('Firefox < 29');\nvar hasCommandModifier = KeyBindingUtil.hasCommandModifier,\n    isCtrlKeyCommand = KeyBindingUtil.isCtrlKeyCommand;\n\nfunction shouldRemoveWord(e) {\n  return isOSX && e.altKey || isCtrlKeyCommand(e);\n}\n/**\n * Get the appropriate undo/redo command for a Z key command.\n */\n\n\nfunction getZCommand(e) {\n  if (!hasCommandModifier(e)) {\n    return null;\n  }\n\n  return e.shiftKey ? 'redo' : 'undo';\n}\n\nfunction getDeleteCommand(e) {\n  // Allow default \"cut\" behavior for PCs on Shift + Delete.\n  if (!isOSX && e.shiftKey) {\n    return null;\n  }\n\n  return shouldRemoveWord(e) ? 'delete-word' : 'delete';\n}\n\nfunction getBackspaceCommand(e) {\n  if (hasCommandModifier(e) && isOSX) {\n    return 'backspace-to-start-of-line';\n  }\n\n  return shouldRemoveWord(e) ? 'backspace-word' : 'backspace';\n}\n/**\n * Retrieve a bound key command for the given event.\n */\n\n\nfunction getDefaultKeyBinding(e) {\n  switch (e.keyCode) {\n    case 66:\n      // B\n      return hasCommandModifier(e) ? 'bold' : null;\n\n    case 68:\n      // D\n      return isCtrlKeyCommand(e) ? 'delete' : null;\n\n    case 72:\n      // H\n      return isCtrlKeyCommand(e) ? 'backspace' : null;\n\n    case 73:\n      // I\n      return hasCommandModifier(e) ? 'italic' : null;\n\n    case 74:\n      // J\n      return hasCommandModifier(e) ? 'code' : null;\n\n    case 75:\n      // K\n      return isOSX && isCtrlKeyCommand(e) ? 'secondary-cut' : null;\n\n    case 77:\n      // M\n      return isCtrlKeyCommand(e) ? 'split-block' : null;\n\n    case 79:\n      // O\n      return isCtrlKeyCommand(e) ? 'split-block' : null;\n\n    case 84:\n      // T\n      return isOSX && isCtrlKeyCommand(e) ? 'transpose-characters' : null;\n\n    case 85:\n      // U\n      return hasCommandModifier(e) ? 'underline' : null;\n\n    case 87:\n      // W\n      return isOSX && isCtrlKeyCommand(e) ? 'backspace-word' : null;\n\n    case 89:\n      // Y\n      if (isCtrlKeyCommand(e)) {\n        return isOSX ? 'secondary-paste' : 'redo';\n      }\n\n      return null;\n\n    case 90:\n      // Z\n      return getZCommand(e) || null;\n\n    case Keys.RETURN:\n      return 'split-block';\n\n    case Keys.DELETE:\n      return getDeleteCommand(e);\n\n    case Keys.BACKSPACE:\n      return getBackspaceCommand(e);\n    // LEFT/RIGHT handlers serve as a workaround for a Firefox bug.\n\n    case Keys.LEFT:\n      return shouldFixFirefoxMovement && hasCommandModifier(e) ? 'move-selection-to-start-of-block' : null;\n\n    case Keys.RIGHT:\n      return shouldFixFirefoxMovement && hasCommandModifier(e) ? 'move-selection-to-end-of-block' : null;\n\n    default:\n      return null;\n  }\n}\n\nmodule.exports = getDefaultKeyBinding;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @preventMunge\n * @emails oncall+draft_js\n */\n'use strict';\n\nvar _assign = require(\"object-assign\");\n\nfunction _extends() { _extends = _assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nvar DefaultDraftBlockRenderMap = require(\"./DefaultDraftBlockRenderMap\");\n\nvar DefaultDraftInlineStyle = require(\"./DefaultDraftInlineStyle\");\n\nvar DraftEditorCompositionHandler = require(\"./DraftEditorCompositionHandler\");\n\nvar DraftEditorContents = require(\"./DraftEditorContents.react\");\n\nvar DraftEditorDragHandler = require(\"./DraftEditorDragHandler\");\n\nvar DraftEditorEditHandler = require(\"./DraftEditorEditHandler\");\n\nvar DraftEditorPlaceholder = require(\"./DraftEditorPlaceholder.react\");\n\nvar DraftEffects = require(\"./DraftEffects\");\n\nvar EditorState = require(\"./EditorState\");\n\nvar React = require(\"react\");\n\nvar ReactDOM = require(\"react-dom\");\n\nvar Scroll = require(\"fbjs/lib/Scroll\");\n\nvar Style = require(\"fbjs/lib/Style\");\n\nvar UserAgent = require(\"fbjs/lib/UserAgent\");\n\nvar cx = require(\"fbjs/lib/cx\");\n\nvar generateRandomKey = require(\"./generateRandomKey\");\n\nvar getDefaultKeyBinding = require(\"./getDefaultKeyBinding\");\n\nvar getScrollPosition = require(\"fbjs/lib/getScrollPosition\");\n\nvar gkx = require(\"./gkx\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar isHTMLElement = require(\"./isHTMLElement\");\n\nvar nullthrows = require(\"fbjs/lib/nullthrows\");\n\nvar isIE = UserAgent.isBrowser('IE'); // IE does not support the `input` event on contentEditable, so we can't\n// observe spellcheck behavior.\n\nvar allowSpellCheck = !isIE; // Define a set of handler objects to correspond to each possible `mode`\n// of editor behavior.\n\nvar handlerMap = {\n  edit: DraftEditorEditHandler,\n  composite: DraftEditorCompositionHandler,\n  drag: DraftEditorDragHandler,\n  cut: null,\n  render: null\n};\nvar didInitODS = false;\n\nvar UpdateDraftEditorFlags =\n/*#__PURE__*/\nfunction (_React$Component) {\n  _inheritsLoose(UpdateDraftEditorFlags, _React$Component);\n\n  function UpdateDraftEditorFlags() {\n    return _React$Component.apply(this, arguments) || this;\n  }\n\n  var _proto = UpdateDraftEditorFlags.prototype;\n\n  _proto.render = function render() {\n    return null;\n  };\n\n  _proto.componentDidMount = function componentDidMount() {\n    this._update();\n  };\n\n  _proto.componentDidUpdate = function componentDidUpdate() {\n    this._update();\n  };\n\n  _proto._update = function _update() {\n    var editor = this.props.editor;\n    /**\n     * Sometimes a render triggers a 'focus' or other event, and that will\n     * schedule a second render pass.\n     * In order to make sure the second render pass gets the latest editor\n     * state, we update it here.\n     * Example:\n     * render #1\n     * +\n     * |\n     * | cWU -> Nothing ... latestEditorState = STALE_STATE :(\n     * |\n     * | render -> this.props.editorState = FRESH_STATE\n     * | +         *and* set latestEditorState = FRESH_STATE\n     *   |\n     * | |\n     * | +--> triggers 'focus' event, calling 'handleFocus' with latestEditorState\n     * |                                                +\n     * |                                                |\n     * +>cdU -> latestEditorState = FRESH_STATE         | the 'handleFocus' call schedules render #2\n     *                                                  | with latestEditorState, which is FRESH_STATE\n     *                                                  |\n     * render #2 <--------------------------------------+\n     * +\n     * |\n     * | cwU -> nothing updates\n     * |\n     * | render -> this.props.editorState = FRESH_STATE which was passed in above\n     * |\n     * +>cdU fires and resets latestEditorState = FRESH_STATE\n     * ---\n     * Note that if we don't set latestEditorState in 'render' in the above\n     * diagram, then STALE_STATE gets passed to render #2.\n     */\n\n    editor._latestEditorState = this.props.editorState;\n    /**\n     * The reason we set this 'blockSelectEvents' flag is that  IE will fire a\n     * 'selectionChange' event when we programmatically change the selection,\n     * meaning it would trigger a new select event while we are in the middle\n     * of updating.\n     * We found that the 'selection.addRange' was what triggered the stray\n     * selectionchange event in IE.\n     * To be clear - we have not been able to reproduce specific bugs related\n     * to this stray selection event, but have recorded logs that some\n     * conditions do cause it to get bumped into during editOnSelect.\n     */\n\n    editor._blockSelectEvents = true;\n  };\n\n  return UpdateDraftEditorFlags;\n}(React.Component);\n/**\n * `DraftEditor` is the root editor component. It composes a `contentEditable`\n * div, and provides a wide variety of useful function props for managing the\n * state of the editor. See `DraftEditorProps` for details.\n */\n\n\nvar DraftEditor =\n/*#__PURE__*/\nfunction (_React$Component2) {\n  _inheritsLoose(DraftEditor, _React$Component2);\n\n  /**\n   * Define proxies that can route events to the current handler.\n   */\n  function DraftEditor(props) {\n    var _this;\n\n    _this = _React$Component2.call(this, props) || this;\n\n    _defineProperty(_assertThisInitialized(_this), \"_blockSelectEvents\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_clipboard\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_handler\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_dragCount\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_internalDrag\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_editorKey\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_placeholderAccessibilityID\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_latestEditorState\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_latestCommittedEditorState\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_pendingStateFromBeforeInput\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_onBeforeInput\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_onBlur\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_onCharacterData\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_onCompositionEnd\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_onCompositionStart\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_onCopy\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_onCut\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_onDragEnd\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_onDragOver\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_onDragStart\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_onDrop\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_onInput\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_onFocus\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_onKeyDown\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_onKeyPress\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_onKeyUp\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_onMouseDown\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_onMouseUp\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_onPaste\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"_onSelect\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"editor\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"editorContainer\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"focus\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"blur\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"setMode\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"exitCurrentMode\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"restoreEditorDOM\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"setClipboard\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"getClipboard\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"getEditorKey\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"update\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"onDragEnter\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"onDragLeave\", void 0);\n\n    _defineProperty(_assertThisInitialized(_this), \"focus\", function (scrollPosition) {\n      var editorState = _this.props.editorState;\n      var alreadyHasFocus = editorState.getSelection().getHasFocus();\n      var editorNode = _this.editor;\n\n      if (!editorNode) {\n        // once in a while people call 'focus' in a setTimeout, and the node has\n        // been deleted, so it can be null in that case.\n        return;\n      }\n\n      var scrollParent = Style.getScrollParent(editorNode);\n\n      var _ref = scrollPosition || getScrollPosition(scrollParent),\n          x = _ref.x,\n          y = _ref.y;\n\n      !isHTMLElement(editorNode) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'editorNode is not an HTMLElement') : invariant(false) : void 0;\n      editorNode.focus(); // Restore scroll position\n\n      if (scrollParent === window) {\n        window.scrollTo(x, y);\n      } else {\n        Scroll.setTop(scrollParent, y);\n      } // On Chrome and Safari, calling focus on contenteditable focuses the\n      // cursor at the first character. This is something you don't expect when\n      // you're clicking on an input element but not directly on a character.\n      // Put the cursor back where it was before the blur.\n\n\n      if (!alreadyHasFocus) {\n        _this.update(EditorState.forceSelection(editorState, editorState.getSelection()));\n      }\n    });\n\n    _defineProperty(_assertThisInitialized(_this), \"blur\", function () {\n      var editorNode = _this.editor;\n\n      if (!editorNode) {\n        return;\n      }\n\n      !isHTMLElement(editorNode) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'editorNode is not an HTMLElement') : invariant(false) : void 0;\n      editorNode.blur();\n    });\n\n    _defineProperty(_assertThisInitialized(_this), \"setMode\", function (mode) {\n      var _this$props = _this.props,\n          onPaste = _this$props.onPaste,\n          onCut = _this$props.onCut,\n          onCopy = _this$props.onCopy;\n\n      var editHandler = _objectSpread({}, handlerMap.edit);\n\n      if (onPaste) {\n        /* $FlowFixMe(>=0.111.0) This comment suppresses an error found when Flow\n         * v0.111.0 was deployed. To see the error, delete this comment and run\n         * Flow. */\n        editHandler.onPaste = onPaste;\n      }\n\n      if (onCut) {\n        editHandler.onCut = onCut;\n      }\n\n      if (onCopy) {\n        editHandler.onCopy = onCopy;\n      }\n\n      var handler = _objectSpread({}, handlerMap, {\n        edit: editHandler\n      });\n\n      _this._handler = handler[mode];\n    });\n\n    _defineProperty(_assertThisInitialized(_this), \"exitCurrentMode\", function () {\n      _this.setMode('edit');\n    });\n\n    _defineProperty(_assertThisInitialized(_this), \"restoreEditorDOM\", function (scrollPosition) {\n      _this.setState({\n        contentsKey: _this.state.contentsKey + 1\n      }, function () {\n        _this.focus(scrollPosition);\n      });\n    });\n\n    _defineProperty(_assertThisInitialized(_this), \"setClipboard\", function (clipboard) {\n      _this._clipboard = clipboard;\n    });\n\n    _defineProperty(_assertThisInitialized(_this), \"getClipboard\", function () {\n      return _this._clipboard;\n    });\n\n    _defineProperty(_assertThisInitialized(_this), \"update\", function (editorState) {\n      _this._latestEditorState = editorState;\n\n      _this.props.onChange(editorState);\n    });\n\n    _defineProperty(_assertThisInitialized(_this), \"onDragEnter\", function () {\n      _this._dragCount++;\n    });\n\n    _defineProperty(_assertThisInitialized(_this), \"onDragLeave\", function () {\n      _this._dragCount--;\n\n      if (_this._dragCount === 0) {\n        _this.exitCurrentMode();\n      }\n    });\n\n    _this._blockSelectEvents = false;\n    _this._clipboard = null;\n    _this._handler = null;\n    _this._dragCount = 0;\n    _this._editorKey = props.editorKey || generateRandomKey();\n    _this._placeholderAccessibilityID = 'placeholder-' + _this._editorKey;\n    _this._latestEditorState = props.editorState;\n    _this._latestCommittedEditorState = props.editorState;\n    _this._onBeforeInput = _this._buildHandler('onBeforeInput');\n    _this._onBlur = _this._buildHandler('onBlur');\n    _this._onCharacterData = _this._buildHandler('onCharacterData');\n    _this._onCompositionEnd = _this._buildHandler('onCompositionEnd');\n    _this._onCompositionStart = _this._buildHandler('onCompositionStart');\n    _this._onCopy = _this._buildHandler('onCopy');\n    _this._onCut = _this._buildHandler('onCut');\n    _this._onDragEnd = _this._buildHandler('onDragEnd');\n    _this._onDragOver = _this._buildHandler('onDragOver');\n    _this._onDragStart = _this._buildHandler('onDragStart');\n    _this._onDrop = _this._buildHandler('onDrop');\n    _this._onInput = _this._buildHandler('onInput');\n    _this._onFocus = _this._buildHandler('onFocus');\n    _this._onKeyDown = _this._buildHandler('onKeyDown');\n    _this._onKeyPress = _this._buildHandler('onKeyPress');\n    _this._onKeyUp = _this._buildHandler('onKeyUp');\n    _this._onMouseDown = _this._buildHandler('onMouseDown');\n    _this._onMouseUp = _this._buildHandler('onMouseUp');\n    _this._onPaste = _this._buildHandler('onPaste');\n    _this._onSelect = _this._buildHandler('onSelect');\n\n    _this.getEditorKey = function () {\n      return _this._editorKey;\n    };\n\n    if (process.env.NODE_ENV !== \"production\") {\n      ['onDownArrow', 'onEscape', 'onLeftArrow', 'onRightArrow', 'onTab', 'onUpArrow'].forEach(function (propName) {\n        if (props.hasOwnProperty(propName)) {\n          // eslint-disable-next-line no-console\n          console.warn(\"Supplying an `\".concat(propName, \"` prop to `DraftEditor` has \") + 'been deprecated. If your handler needs access to the keyboard ' + 'event, supply a custom `keyBindingFn` prop that falls back to ' + 'the default one (eg. https://is.gd/RG31RJ).');\n        }\n      });\n    } // See `restoreEditorDOM()`.\n\n\n    _this.state = {\n      contentsKey: 0\n    };\n    return _this;\n  }\n  /**\n   * Build a method that will pass the event to the specified handler method.\n   * This allows us to look up the correct handler function for the current\n   * editor mode, if any has been specified.\n   */\n\n\n  var _proto2 = DraftEditor.prototype;\n\n  _proto2._buildHandler = function _buildHandler(eventName) {\n    var _this2 = this;\n\n    var flushControlled =\n    /* $FlowFixMe(>=0.79.1 site=www) This comment suppresses an error found\n     * when Flow v0.79 was deployed. To see the error delete this comment and\n     * run Flow. */\n    ReactDOM.unstable_flushControlled; // Wrap event handlers in `flushControlled`. In sync mode, this is\n    // effectively a no-op. In async mode, this ensures all updates scheduled\n    // inside the handler are flushed before React yields to the browser.\n\n    return function (e) {\n      if (!_this2.props.readOnly) {\n        var method = _this2._handler && _this2._handler[eventName];\n\n        if (method) {\n          if (flushControlled) {\n            flushControlled(function () {\n              return method(_this2, e);\n            });\n          } else {\n            method(_this2, e);\n          }\n        }\n      }\n    };\n  };\n\n  _proto2._showPlaceholder = function _showPlaceholder() {\n    return !!this.props.placeholder && !this.props.editorState.isInCompositionMode() && !this.props.editorState.getCurrentContent().hasText();\n  };\n\n  _proto2._renderPlaceholder = function _renderPlaceholder() {\n    if (this._showPlaceholder()) {\n      var placeHolderProps = {\n        text: nullthrows(this.props.placeholder),\n        editorState: this.props.editorState,\n        textAlignment: this.props.textAlignment,\n        accessibilityID: this._placeholderAccessibilityID\n      };\n      /* $FlowFixMe(>=0.112.0 site=mobile) This comment suppresses an error\n       * found when Flow v0.112 was deployed. To see the error delete this\n       * comment and run Flow. */\n\n      /* $FlowFixMe(>=0.112.0 site=www) This comment suppresses an error found\n       * when Flow v0.112 was deployed. To see the error delete this comment\n       * and run Flow. */\n\n      /* $FlowFixMe(>=0.112.0 site=www,mobile) This comment suppresses an error\n       * found when Flow v0.112 was deployed. To see the error delete this\n       * comment and run Flow. */\n\n      return React.createElement(DraftEditorPlaceholder, placeHolderProps);\n    }\n\n    return null;\n  };\n\n  _proto2.render = function render() {\n    var _this3 = this;\n\n    var _this$props2 = this.props,\n        blockRenderMap = _this$props2.blockRenderMap,\n        blockRendererFn = _this$props2.blockRendererFn,\n        blockStyleFn = _this$props2.blockStyleFn,\n        customStyleFn = _this$props2.customStyleFn,\n        customStyleMap = _this$props2.customStyleMap,\n        editorState = _this$props2.editorState,\n        readOnly = _this$props2.readOnly,\n        textAlignment = _this$props2.textAlignment,\n        textDirectionality = _this$props2.textDirectionality;\n    var rootClass = cx({\n      'DraftEditor/root': true,\n      'DraftEditor/alignLeft': textAlignment === 'left',\n      'DraftEditor/alignRight': textAlignment === 'right',\n      'DraftEditor/alignCenter': textAlignment === 'center'\n    });\n    var contentStyle = {\n      outline: 'none',\n      // fix parent-draggable Safari bug. #1326\n      userSelect: 'text',\n      WebkitUserSelect: 'text',\n      whiteSpace: 'pre-wrap',\n      wordWrap: 'break-word'\n    }; // The aria-expanded and aria-haspopup properties should only be rendered\n    // for a combobox.\n\n    /* $FlowFixMe(>=0.68.0 site=www,mobile) This comment suppresses an error\n     * found when Flow v0.68 was deployed. To see the error delete this comment\n     * and run Flow. */\n\n    var ariaRole = this.props.role || 'textbox';\n    var ariaExpanded = ariaRole === 'combobox' ? !!this.props.ariaExpanded : null;\n    var editorContentsProps = {\n      blockRenderMap: blockRenderMap,\n      blockRendererFn: blockRendererFn,\n      blockStyleFn: blockStyleFn,\n      customStyleMap: _objectSpread({}, DefaultDraftInlineStyle, customStyleMap),\n      customStyleFn: customStyleFn,\n      editorKey: this._editorKey,\n      editorState: editorState,\n      textDirectionality: textDirectionality\n    };\n    return React.createElement(\"div\", {\n      className: rootClass\n    }, this._renderPlaceholder(), React.createElement(\"div\", {\n      className: cx('DraftEditor/editorContainer'),\n      ref: function ref(_ref3) {\n        return _this3.editorContainer = _ref3;\n      }\n    }, React.createElement(\"div\", {\n      \"aria-activedescendant\": readOnly ? null : this.props.ariaActiveDescendantID,\n      \"aria-autocomplete\": readOnly ? null : this.props.ariaAutoComplete,\n      \"aria-controls\": readOnly ? null : this.props.ariaControls,\n      \"aria-describedby\": this.props.ariaDescribedBy || this._placeholderAccessibilityID,\n      \"aria-expanded\": readOnly ? null : ariaExpanded,\n      \"aria-label\": this.props.ariaLabel,\n      \"aria-labelledby\": this.props.ariaLabelledBy,\n      \"aria-multiline\": this.props.ariaMultiline,\n      \"aria-owns\": readOnly ? null : this.props.ariaOwneeID,\n      autoCapitalize: this.props.autoCapitalize,\n      autoComplete: this.props.autoComplete,\n      autoCorrect: this.props.autoCorrect,\n      className: cx({\n        // Chrome's built-in translation feature mutates the DOM in ways\n        // that Draft doesn't expect (ex: adding <font> tags inside\n        // DraftEditorLeaf spans) and causes problems. We add notranslate\n        // here which makes its autotranslation skip over this subtree.\n        notranslate: !readOnly,\n        'public/DraftEditor/content': true\n      }),\n      contentEditable: !readOnly,\n      \"data-testid\": this.props.webDriverTestID,\n      onBeforeInput: this._onBeforeInput,\n      onBlur: this._onBlur,\n      onCompositionEnd: this._onCompositionEnd,\n      onCompositionStart: this._onCompositionStart,\n      onCopy: this._onCopy,\n      onCut: this._onCut,\n      onDragEnd: this._onDragEnd,\n      onDragEnter: this.onDragEnter,\n      onDragLeave: this.onDragLeave,\n      onDragOver: this._onDragOver,\n      onDragStart: this._onDragStart,\n      onDrop: this._onDrop,\n      onFocus: this._onFocus,\n      onInput: this._onInput,\n      onKeyDown: this._onKeyDown,\n      onKeyPress: this._onKeyPress,\n      onKeyUp: this._onKeyUp,\n      onMouseUp: this._onMouseUp,\n      onPaste: this._onPaste,\n      onSelect: this._onSelect,\n      ref: function ref(_ref2) {\n        return _this3.editor = _ref2;\n      },\n      role: readOnly ? null : ariaRole,\n      spellCheck: allowSpellCheck && this.props.spellCheck,\n      style: contentStyle,\n      suppressContentEditableWarning: true,\n      tabIndex: this.props.tabIndex\n    }, React.createElement(UpdateDraftEditorFlags, {\n      editor: this,\n      editorState: editorState\n    }), React.createElement(DraftEditorContents, _extends({}, editorContentsProps, {\n      key: 'contents' + this.state.contentsKey\n    })))));\n  };\n\n  _proto2.componentDidMount = function componentDidMount() {\n    this._blockSelectEvents = false;\n\n    if (!didInitODS && gkx('draft_ods_enabled')) {\n      didInitODS = true;\n      DraftEffects.initODS();\n    }\n\n    this.setMode('edit');\n    /**\n     * IE has a hardcoded \"feature\" that attempts to convert link text into\n     * anchors in contentEditable DOM. This breaks the editor's expectations of\n     * the DOM, and control is lost. Disable it to make IE behave.\n     * See: http://blogs.msdn.com/b/ieinternals/archive/2010/09/15/\n     * ie9-beta-minor-change-list.aspx\n     */\n\n    if (isIE) {\n      // editor can be null after mounting\n      // https://stackoverflow.com/questions/44074747/componentdidmount-called-before-ref-callback\n      if (!this.editor) {\n        global.execCommand('AutoUrlDetect', false, false);\n      } else {\n        this.editor.ownerDocument.execCommand('AutoUrlDetect', false, false);\n      }\n    }\n  };\n\n  _proto2.componentDidUpdate = function componentDidUpdate() {\n    this._blockSelectEvents = false;\n    this._latestEditorState = this.props.editorState;\n    this._latestCommittedEditorState = this.props.editorState;\n  }\n  /**\n   * Used via `this.focus()`.\n   *\n   * Force focus back onto the editor node.\n   *\n   * We attempt to preserve scroll position when focusing. You can also pass\n   * a specified scroll position (for cases like `cut` behavior where it should\n   * be restored to a known position).\n   */\n  ;\n\n  return DraftEditor;\n}(React.Component);\n\n_defineProperty(DraftEditor, \"defaultProps\", {\n  blockRenderMap: DefaultDraftBlockRenderMap,\n  blockRendererFn: function blockRendererFn() {\n    return null;\n  },\n  blockStyleFn: function blockStyleFn() {\n    return '';\n  },\n  keyBindingFn: getDefaultKeyBinding,\n  readOnly: false,\n  spellCheck: false,\n  stripPastedStyles: false\n});\n\nmodule.exports = DraftEditor;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar DraftStringKey = {\n  stringify: function stringify(key) {\n    return '_' + String(key);\n  },\n  unstringify: function unstringify(key) {\n    return key.slice(1);\n  }\n};\nmodule.exports = DraftStringKey;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar DraftStringKey = require(\"./DraftStringKey\");\n\nvar UnicodeUtils = require(\"fbjs/lib/UnicodeUtils\");\n\nvar strlen = UnicodeUtils.strlen;\n/**\n * Convert to UTF-8 character counts for storage.\n */\n\nfunction encodeEntityRanges(block, storageMap) {\n  var encoded = [];\n  block.findEntityRanges(function (character) {\n    return !!character.getEntity();\n  }, function (\n  /*number*/\n  start,\n  /*number*/\n  end) {\n    var text = block.getText();\n    var key = block.getEntityAt(start);\n    encoded.push({\n      offset: strlen(text.slice(0, start)),\n      length: strlen(text.slice(start, end)),\n      // Encode the key as a number for range storage.\n      key: Number(storageMap[DraftStringKey.stringify(key)])\n    });\n  });\n  return encoded;\n}\n\nmodule.exports = encodeEntityRanges;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar UnicodeUtils = require(\"fbjs/lib/UnicodeUtils\");\n\nvar findRangesImmutable = require(\"./findRangesImmutable\");\n\nvar areEqual = function areEqual(a, b) {\n  return a === b;\n};\n\nvar isTruthy = function isTruthy(a) {\n  return !!a;\n};\n\nvar EMPTY_ARRAY = [];\n/**\n * Helper function for getting encoded styles for each inline style. Convert\n * to UTF-8 character counts for storage.\n */\n\nfunction getEncodedInlinesForType(block, styleList, styleToEncode) {\n  var ranges = []; // Obtain an array with ranges for only the specified style.\n\n  var filteredInlines = styleList.map(function (style) {\n    return style.has(styleToEncode);\n  }).toList();\n  findRangesImmutable(filteredInlines, areEqual, // We only want to keep ranges with nonzero style values.\n  isTruthy, function (start, end) {\n    var text = block.getText();\n    ranges.push({\n      offset: UnicodeUtils.strlen(text.slice(0, start)),\n      length: UnicodeUtils.strlen(text.slice(start, end)),\n      style: styleToEncode\n    });\n  });\n  return ranges;\n}\n/*\n * Retrieve the encoded arrays of inline styles, with each individual style\n * treated separately.\n */\n\n\nfunction encodeInlineStyleRanges(block) {\n  var styleList = block.getCharacterList().map(function (c) {\n    return c.getStyle();\n  }).toList();\n  var ranges = styleList.flatten().toSet().map(function (style) {\n    return getEncodedInlinesForType(block, styleList, style);\n  });\n  return Array.prototype.concat.apply(EMPTY_ARRAY, ranges.toJS());\n}\n\nmodule.exports = encodeInlineStyleRanges;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar ContentBlock = require(\"./ContentBlock\");\n\nvar ContentBlockNode = require(\"./ContentBlockNode\");\n\nvar DraftStringKey = require(\"./DraftStringKey\");\n\nvar encodeEntityRanges = require(\"./encodeEntityRanges\");\n\nvar encodeInlineStyleRanges = require(\"./encodeInlineStyleRanges\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar createRawBlock = function createRawBlock(block, entityStorageMap) {\n  return {\n    key: block.getKey(),\n    text: block.getText(),\n    type: block.getType(),\n    depth: block.getDepth(),\n    inlineStyleRanges: encodeInlineStyleRanges(block),\n    entityRanges: encodeEntityRanges(block, entityStorageMap),\n    data: block.getData().toObject()\n  };\n};\n\nvar insertRawBlock = function insertRawBlock(block, entityMap, rawBlocks, blockCacheRef) {\n  if (block instanceof ContentBlock) {\n    rawBlocks.push(createRawBlock(block, entityMap));\n    return;\n  }\n\n  !(block instanceof ContentBlockNode) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'block is not a BlockNode') : invariant(false) : void 0;\n  var parentKey = block.getParentKey();\n\n  var rawBlock = blockCacheRef[block.getKey()] = _objectSpread({}, createRawBlock(block, entityMap), {\n    children: []\n  });\n\n  if (parentKey) {\n    blockCacheRef[parentKey].children.push(rawBlock);\n    return;\n  }\n\n  rawBlocks.push(rawBlock);\n};\n\nvar encodeRawBlocks = function encodeRawBlocks(contentState, rawState) {\n  var entityMap = rawState.entityMap;\n  var rawBlocks = [];\n  var blockCacheRef = {};\n  var entityCacheRef = {};\n  var entityStorageKey = 0;\n  contentState.getBlockMap().forEach(function (block) {\n    block.findEntityRanges(function (character) {\n      return character.getEntity() !== null;\n    }, function (start) {\n      var entityKey = block.getEntityAt(start); // Stringify to maintain order of otherwise numeric keys.\n\n      var stringifiedEntityKey = DraftStringKey.stringify(entityKey); // This makes this function resilient to two entities\n      // erroneously having the same key\n\n      if (entityCacheRef[stringifiedEntityKey]) {\n        return;\n      }\n\n      entityCacheRef[stringifiedEntityKey] = entityKey; // we need the `any` casting here since this is a temporary state\n      // where we will later on flip the entity map and populate it with\n      // real entity, at this stage we just need to map back the entity\n      // key used by the BlockNode\n\n      entityMap[stringifiedEntityKey] = \"\".concat(entityStorageKey);\n      entityStorageKey++;\n    });\n    insertRawBlock(block, entityMap, rawBlocks, blockCacheRef);\n  });\n  return {\n    blocks: rawBlocks,\n    entityMap: entityMap\n  };\n}; // Flip storage map so that our storage keys map to global\n// DraftEntity keys.\n\n\nvar encodeRawEntityMap = function encodeRawEntityMap(contentState, rawState) {\n  var blocks = rawState.blocks,\n      entityMap = rawState.entityMap;\n  var rawEntityMap = {};\n  Object.keys(entityMap).forEach(function (key, index) {\n    var entity = contentState.getEntity(DraftStringKey.unstringify(key));\n    rawEntityMap[index] = {\n      type: entity.getType(),\n      mutability: entity.getMutability(),\n      data: entity.getData()\n    };\n  });\n  return {\n    blocks: blocks,\n    entityMap: rawEntityMap\n  };\n};\n\nvar convertFromDraftStateToRaw = function convertFromDraftStateToRaw(contentState) {\n  var rawDraftContentState = {\n    entityMap: {},\n    blocks: []\n  }; // add blocks\n\n  rawDraftContentState = encodeRawBlocks(contentState, rawDraftContentState); // add entities\n\n  rawDraftContentState = encodeRawEntityMap(contentState, rawDraftContentState);\n  return rawDraftContentState;\n};\n\nmodule.exports = convertFromDraftStateToRaw;", "\"use strict\";\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n *\n * This is unstable and not part of the public API and should not be used by\n * production systems. This file may be update/removed without notice.\n */\nvar generateRandomKey = require(\"./generateRandomKey\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar traverseInDepthOrder = function traverseInDepthOrder(blocks, fn) {\n  var stack = [].concat(blocks).reverse();\n\n  while (stack.length) {\n    var _block = stack.pop();\n\n    fn(_block);\n    var children = _block.children;\n    !Array.isArray(children) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Invalid tree raw block') : invariant(false) : void 0;\n    stack = stack.concat([].concat(children.reverse()));\n  }\n};\n\nvar isListBlock = function isListBlock(block) {\n  if (!(block && block.type)) {\n    return false;\n  }\n\n  var type = block.type;\n  return type === 'unordered-list-item' || type === 'ordered-list-item';\n};\n\nvar addDepthToChildren = function addDepthToChildren(block) {\n  if (Array.isArray(block.children)) {\n    block.children = block.children.map(function (child) {\n      return child.type === block.type ? _objectSpread({}, child, {\n        depth: (block.depth || 0) + 1\n      }) : child;\n    });\n  }\n};\n/**\n * This adapter is intended to be be used as an adapter to draft tree data\n *\n * draft state <=====> draft tree state\n */\n\n\nvar DraftTreeAdapter = {\n  /**\n   * Converts from a tree raw state back to draft raw state\n   */\n  fromRawTreeStateToRawState: function fromRawTreeStateToRawState(draftTreeState) {\n    var blocks = draftTreeState.blocks;\n    var transformedBlocks = [];\n    !Array.isArray(blocks) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Invalid raw state') : invariant(false) : void 0;\n\n    if (!Array.isArray(blocks) || !blocks.length) {\n      return draftTreeState;\n    }\n\n    traverseInDepthOrder(blocks, function (block) {\n      var newBlock = _objectSpread({}, block);\n\n      if (isListBlock(block)) {\n        newBlock.depth = newBlock.depth || 0;\n        addDepthToChildren(block); // if it's a non-leaf node, we don't do anything else\n\n        if (block.children != null && block.children.length > 0) {\n          return;\n        }\n      }\n\n      delete newBlock.children;\n      transformedBlocks.push(newBlock);\n    });\n    draftTreeState.blocks = transformedBlocks;\n    return _objectSpread({}, draftTreeState, {\n      blocks: transformedBlocks\n    });\n  },\n\n  /**\n   * Converts from draft raw state to tree draft state\n   */\n  fromRawStateToRawTreeState: function fromRawStateToRawTreeState(draftState) {\n    var transformedBlocks = [];\n    var parentStack = [];\n    draftState.blocks.forEach(function (block) {\n      var isList = isListBlock(block);\n      var depth = block.depth || 0;\n\n      var treeBlock = _objectSpread({}, block, {\n        children: []\n      });\n\n      if (!isList) {\n        transformedBlocks.push(treeBlock);\n        return;\n      }\n\n      var lastParent = parentStack[0]; // block is non-nested & there are no nested blocks, directly push block\n\n      if (lastParent == null && depth === 0) {\n        transformedBlocks.push(treeBlock); // block is first nested block or previous nested block is at a lower level\n      } else if (lastParent == null || lastParent.depth < depth - 1) {\n        // create new parent block\n        var newParent = {\n          key: generateRandomKey(),\n          text: '',\n          depth: depth - 1,\n          type: block.type,\n          children: [],\n          entityRanges: [],\n          inlineStyleRanges: []\n        };\n        parentStack.unshift(newParent);\n\n        if (depth === 1) {\n          // add as a root-level block\n          transformedBlocks.push(newParent);\n        } else if (lastParent != null) {\n          // depth > 1 => also add as previous parent's child\n          lastParent.children.push(newParent);\n        }\n\n        newParent.children.push(treeBlock);\n      } else if (lastParent.depth === depth - 1) {\n        // add as child of last parent\n        lastParent.children.push(treeBlock);\n      } else {\n        // pop out parents at levels above this one from the parent stack\n        while (lastParent != null && lastParent.depth >= depth) {\n          parentStack.shift();\n          lastParent = parentStack[0];\n        }\n\n        if (depth > 0) {\n          lastParent.children.push(treeBlock);\n        } else {\n          transformedBlocks.push(treeBlock);\n        }\n      }\n    });\n    return _objectSpread({}, draftState, {\n      blocks: transformedBlocks\n    });\n  }\n};\nmodule.exports = DraftTreeAdapter;", "\"use strict\";\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n *\n * This is unstable and not part of the public API and should not be used by\n * production systems. This file may be update/removed without notice.\n */\nvar warning = require(\"fbjs/lib/warning\");\n\nvar DraftTreeInvariants = {\n  /**\n   * Check if the block is valid\n   */\n  isValidBlock: function isValidBlock(block, blockMap) {\n    var key = block.getKey(); // is its parent's child\n\n    var parentKey = block.getParentKey();\n\n    if (parentKey != null) {\n      var parent = blockMap.get(parentKey);\n\n      if (!parent.getChildKeys().includes(key)) {\n        process.env.NODE_ENV !== \"production\" ? warning(true, 'Tree is missing parent -> child pointer on %s', key) : void 0;\n        return false;\n      }\n    } // is its children's parent\n\n\n    var children = block.getChildKeys().map(function (k) {\n      return blockMap.get(k);\n    });\n\n    if (!children.every(function (c) {\n      return c.getParentKey() === key;\n    })) {\n      process.env.NODE_ENV !== \"production\" ? warning(true, 'Tree is missing child -> parent pointer on %s', key) : void 0;\n      return false;\n    } // is its previous sibling's next sibling\n\n\n    var prevSiblingKey = block.getPrevSiblingKey();\n\n    if (prevSiblingKey != null) {\n      var prevSibling = blockMap.get(prevSiblingKey);\n\n      if (prevSibling.getNextSiblingKey() !== key) {\n        process.env.NODE_ENV !== \"production\" ? warning(true, \"Tree is missing nextSibling pointer on %s's prevSibling\", key) : void 0;\n        return false;\n      }\n    } // is its next sibling's previous sibling\n\n\n    var nextSiblingKey = block.getNextSiblingKey();\n\n    if (nextSiblingKey != null) {\n      var nextSibling = blockMap.get(nextSiblingKey);\n\n      if (nextSibling.getPrevSiblingKey() !== key) {\n        process.env.NODE_ENV !== \"production\" ? warning(true, \"Tree is missing prevSibling pointer on %s's nextSibling\", key) : void 0;\n        return false;\n      }\n    } // no 2-node cycles\n\n\n    if (nextSiblingKey !== null && prevSiblingKey !== null) {\n      if (prevSiblingKey === nextSiblingKey) {\n        process.env.NODE_ENV !== \"production\" ? warning(true, 'Tree has a two-node cycle at %s', key) : void 0;\n        return false;\n      }\n    } // if it's a leaf node, it has text but no children\n\n\n    if (block.text != '') {\n      if (block.getChildKeys().size > 0) {\n        process.env.NODE_ENV !== \"production\" ? warning(true, 'Leaf node %s has children', key) : void 0;\n        return false;\n      }\n    }\n\n    return true;\n  },\n\n  /**\n   * Checks that this is a connected tree on all the blocks\n   * starting from the first block, traversing nextSibling and child pointers\n   * should be a tree (preorder traversal - parent, then children)\n   * num of connected node === number of blocks\n   */\n  isConnectedTree: function isConnectedTree(blockMap) {\n    // exactly one node has no previous sibling + no parent\n    var eligibleFirstNodes = blockMap.toArray().filter(function (block) {\n      return block.getParentKey() == null && block.getPrevSiblingKey() == null;\n    });\n\n    if (eligibleFirstNodes.length !== 1) {\n      process.env.NODE_ENV !== \"production\" ? warning(true, 'Tree is not connected. More or less than one first node') : void 0;\n      return false;\n    }\n\n    var firstNode = eligibleFirstNodes.shift();\n    var nodesSeen = 0;\n    var currentKey = firstNode.getKey();\n    var visitedStack = [];\n\n    while (currentKey != null) {\n      var currentNode = blockMap.get(currentKey);\n      var childKeys = currentNode.getChildKeys();\n      var nextSiblingKey = currentNode.getNextSiblingKey(); // if the node has children, add parent's next sibling to stack and go to children\n\n      if (childKeys.size > 0) {\n        if (nextSiblingKey != null) {\n          visitedStack.unshift(nextSiblingKey);\n        }\n\n        var children = childKeys.map(function (k) {\n          return blockMap.get(k);\n        });\n\n        var _firstNode = children.find(function (block) {\n          return block.getPrevSiblingKey() == null;\n        });\n\n        if (_firstNode == null) {\n          process.env.NODE_ENV !== \"production\" ? warning(true, '%s has no first child', currentKey) : void 0;\n          return false;\n        }\n\n        currentKey = _firstNode.getKey(); // TODO(T32490138): Deal with multi-node cycles here\n      } else {\n        if (currentNode.getNextSiblingKey() != null) {\n          currentKey = currentNode.getNextSiblingKey();\n        } else {\n          currentKey = visitedStack.shift();\n        }\n      }\n\n      nodesSeen++;\n    }\n\n    if (nodesSeen !== blockMap.size) {\n      process.env.NODE_ENV !== \"production\" ? warning(true, 'Tree is not connected. %s nodes were seen instead of %s', nodesSeen, blockMap.size) : void 0;\n      return false;\n    }\n\n    return true;\n  },\n\n  /**\n   * Checks that the block map is a connected tree with valid blocks\n   */\n  isValidTree: function isValidTree(blockMap) {\n    var _this = this;\n\n    var blocks = blockMap.toArray();\n\n    if (!blocks.every(function (block) {\n      return _this.isValidBlock(block, blockMap);\n    })) {\n      return false;\n    }\n\n    return this.isConnectedTree(blockMap);\n  }\n};\nmodule.exports = DraftTreeInvariants;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar CharacterMetadata = require(\"./CharacterMetadata\");\n\nvar Immutable = require(\"immutable\");\n\nvar List = Immutable.List;\n\nfunction createCharacterList(inlineStyles, entities) {\n  var characterArray = inlineStyles.map(function (style, ii) {\n    var entity = entities[ii];\n    return CharacterMetadata.create({\n      style: style,\n      entity: entity\n    });\n  });\n  return List(characterArray);\n}\n\nmodule.exports = createCharacterList;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar UnicodeUtils = require(\"fbjs/lib/UnicodeUtils\");\n\nvar substr = UnicodeUtils.substr;\n/**\n * Convert to native JavaScript string lengths to determine ranges.\n */\n\nfunction decodeEntityRanges(text, ranges) {\n  var entities = Array(text.length).fill(null);\n\n  if (ranges) {\n    ranges.forEach(function (range) {\n      // Using Unicode-enabled substrings converted to JavaScript lengths,\n      // fill the output array with entity keys.\n      var start = substr(text, 0, range.offset).length;\n      var end = start + substr(text, range.offset, range.length).length;\n\n      for (var ii = start; ii < end; ii++) {\n        entities[ii] = range.key;\n      }\n    });\n  }\n\n  return entities;\n}\n\nmodule.exports = decodeEntityRanges;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar UnicodeUtils = require(\"fbjs/lib/UnicodeUtils\");\n\nvar _require = require(\"immutable\"),\n    OrderedSet = _require.OrderedSet;\n\nvar substr = UnicodeUtils.substr;\nvar EMPTY_SET = OrderedSet();\n/**\n * Convert to native JavaScript string lengths to determine ranges.\n */\n\nfunction decodeInlineStyleRanges(text, ranges) {\n  var styles = Array(text.length).fill(EMPTY_SET);\n\n  if (ranges) {\n    ranges.forEach(function (range) {\n      var cursor = substr(text, 0, range.offset).length;\n      var end = cursor + substr(text, range.offset, range.length).length;\n\n      while (cursor < end) {\n        styles[cursor] = styles[cursor].add(range.style);\n        cursor++;\n      }\n    });\n  }\n\n  return styles;\n}\n\nmodule.exports = decodeInlineStyleRanges;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar ContentBlock = require(\"./ContentBlock\");\n\nvar ContentBlockNode = require(\"./ContentBlockNode\");\n\nvar ContentState = require(\"./ContentState\");\n\nvar DraftEntity = require(\"./DraftEntity\");\n\nvar DraftTreeAdapter = require(\"./DraftTreeAdapter\");\n\nvar DraftTreeInvariants = require(\"./DraftTreeInvariants\");\n\nvar SelectionState = require(\"./SelectionState\");\n\nvar createCharacterList = require(\"./createCharacterList\");\n\nvar decodeEntityRanges = require(\"./decodeEntityRanges\");\n\nvar decodeInlineStyleRanges = require(\"./decodeInlineStyleRanges\");\n\nvar generateRandomKey = require(\"./generateRandomKey\");\n\nvar gkx = require(\"./gkx\");\n\nvar Immutable = require(\"immutable\");\n\nvar invariant = require(\"fbjs/lib/invariant\");\n\nvar experimentalTreeDataSupport = gkx('draft_tree_data_support');\nvar List = Immutable.List,\n    Map = Immutable.Map,\n    OrderedMap = Immutable.OrderedMap;\n\nvar decodeBlockNodeConfig = function decodeBlockNodeConfig(block, entityMap) {\n  var key = block.key,\n      type = block.type,\n      data = block.data,\n      text = block.text,\n      depth = block.depth;\n  var blockNodeConfig = {\n    text: text,\n    depth: depth || 0,\n    type: type || 'unstyled',\n    key: key || generateRandomKey(),\n    data: Map(data),\n    characterList: decodeCharacterList(block, entityMap)\n  };\n  return blockNodeConfig;\n};\n\nvar decodeCharacterList = function decodeCharacterList(block, entityMap) {\n  var text = block.text,\n      rawEntityRanges = block.entityRanges,\n      rawInlineStyleRanges = block.inlineStyleRanges;\n  var entityRanges = rawEntityRanges || [];\n  var inlineStyleRanges = rawInlineStyleRanges || []; // Translate entity range keys to the DraftEntity map.\n\n  return createCharacterList(decodeInlineStyleRanges(text, inlineStyleRanges), decodeEntityRanges(text, entityRanges.filter(function (range) {\n    return entityMap.hasOwnProperty(range.key);\n  }).map(function (range) {\n    return _objectSpread({}, range, {\n      key: entityMap[range.key]\n    });\n  })));\n};\n\nvar addKeyIfMissing = function addKeyIfMissing(block) {\n  return _objectSpread({}, block, {\n    key: block.key || generateRandomKey()\n  });\n};\n/**\n * Node stack is responsible to ensure we traverse the tree only once\n * in depth order, while also providing parent refs to inner nodes to\n * construct their links.\n */\n\n\nvar updateNodeStack = function updateNodeStack(stack, nodes, parentRef) {\n  var nodesWithParentRef = nodes.map(function (block) {\n    return _objectSpread({}, block, {\n      parentRef: parentRef\n    });\n  }); // since we pop nodes from the stack we need to insert them in reverse\n\n  return stack.concat(nodesWithParentRef.reverse());\n};\n/**\n * This will build a tree draft content state by creating the node\n * reference links into a single tree walk. Each node has a link\n * reference to \"parent\", \"children\", \"nextSibling\" and \"prevSibling\"\n * blockMap will be created using depth ordering.\n */\n\n\nvar decodeContentBlockNodes = function decodeContentBlockNodes(blocks, entityMap) {\n  return blocks // ensure children have valid keys to enable sibling links\n  .map(addKeyIfMissing).reduce(function (blockMap, block, index) {\n    !Array.isArray(block.children) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'invalid RawDraftContentBlock can not be converted to ContentBlockNode') : invariant(false) : void 0; // ensure children have valid keys to enable sibling links\n\n    var children = block.children.map(addKeyIfMissing); // root level nodes\n\n    var contentBlockNode = new ContentBlockNode(_objectSpread({}, decodeBlockNodeConfig(block, entityMap), {\n      prevSibling: index === 0 ? null : blocks[index - 1].key,\n      nextSibling: index === blocks.length - 1 ? null : blocks[index + 1].key,\n      children: List(children.map(function (child) {\n        return child.key;\n      }))\n    })); // push root node to blockMap\n\n    blockMap = blockMap.set(contentBlockNode.getKey(), contentBlockNode); // this stack is used to ensure we visit all nodes respecting depth ordering\n\n    var stack = updateNodeStack([], children, contentBlockNode); // start computing children nodes\n\n    while (stack.length > 0) {\n      // we pop from the stack and start processing this node\n      var node = stack.pop(); // parentRef already points to a converted ContentBlockNode\n\n      var parentRef = node.parentRef;\n      var siblings = parentRef.getChildKeys();\n\n      var _index = siblings.indexOf(node.key);\n\n      var isValidBlock = Array.isArray(node.children);\n\n      if (!isValidBlock) {\n        !isValidBlock ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'invalid RawDraftContentBlock can not be converted to ContentBlockNode') : invariant(false) : void 0;\n        break;\n      } // ensure children have valid keys to enable sibling links\n\n\n      var _children = node.children.map(addKeyIfMissing);\n\n      var _contentBlockNode = new ContentBlockNode(_objectSpread({}, decodeBlockNodeConfig(node, entityMap), {\n        parent: parentRef.getKey(),\n        children: List(_children.map(function (child) {\n          return child.key;\n        })),\n        prevSibling: _index === 0 ? null : siblings.get(_index - 1),\n        nextSibling: _index === siblings.size - 1 ? null : siblings.get(_index + 1)\n      })); // push node to blockMap\n\n\n      blockMap = blockMap.set(_contentBlockNode.getKey(), _contentBlockNode); // this stack is used to ensure we visit all nodes respecting depth ordering\n\n      stack = updateNodeStack(stack, _children, _contentBlockNode);\n    }\n\n    return blockMap;\n  }, OrderedMap());\n};\n\nvar decodeContentBlocks = function decodeContentBlocks(blocks, entityMap) {\n  return OrderedMap(blocks.map(function (block) {\n    var contentBlock = new ContentBlock(decodeBlockNodeConfig(block, entityMap));\n    return [contentBlock.getKey(), contentBlock];\n  }));\n};\n\nvar decodeRawBlocks = function decodeRawBlocks(rawState, entityMap) {\n  var isTreeRawBlock = rawState.blocks.find(function (block) {\n    return Array.isArray(block.children) && block.children.length > 0;\n  });\n  var rawBlocks = experimentalTreeDataSupport && !isTreeRawBlock ? DraftTreeAdapter.fromRawStateToRawTreeState(rawState).blocks : rawState.blocks;\n\n  if (!experimentalTreeDataSupport) {\n    return decodeContentBlocks(isTreeRawBlock ? DraftTreeAdapter.fromRawTreeStateToRawState(rawState).blocks : rawBlocks, entityMap);\n  }\n\n  var blockMap = decodeContentBlockNodes(rawBlocks, entityMap); // in dev mode, check that the tree invariants are met\n\n  if (process.env.NODE_ENV !== \"production\") {\n    !DraftTreeInvariants.isValidTree(blockMap) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'Should be a valid tree') : invariant(false) : void 0;\n  }\n\n  return blockMap;\n};\n\nvar decodeRawEntityMap = function decodeRawEntityMap(rawState) {\n  var rawEntityMap = rawState.entityMap;\n  var entityMap = {}; // TODO: Update this once we completely remove DraftEntity\n\n  Object.keys(rawEntityMap).forEach(function (rawEntityKey) {\n    var _rawEntityMap$rawEnti = rawEntityMap[rawEntityKey],\n        type = _rawEntityMap$rawEnti.type,\n        mutability = _rawEntityMap$rawEnti.mutability,\n        data = _rawEntityMap$rawEnti.data; // get the key reference to created entity\n\n    entityMap[rawEntityKey] = DraftEntity.__create(type, mutability, data || {});\n  });\n  return entityMap;\n};\n\nvar convertFromRawToDraftState = function convertFromRawToDraftState(rawState) {\n  !Array.isArray(rawState.blocks) ? process.env.NODE_ENV !== \"production\" ? invariant(false, 'invalid RawDraftContentState') : invariant(false) : void 0; // decode entities\n\n  var entityMap = decodeRawEntityMap(rawState); // decode blockMap\n\n  var blockMap = decodeRawBlocks(rawState, entityMap); // create initial selection\n\n  var selectionState = blockMap.isEmpty() ? new SelectionState() : SelectionState.createEmpty(blockMap.first().getKey());\n  return new ContentState({\n    blockMap: blockMap,\n    entityMap: entityMap,\n    selectionBefore: selectionState,\n    selectionAfter: selectionState\n  });\n};\n\nmodule.exports = convertFromRawToDraftState;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar getRangeClientRects = require(\"./getRangeClientRects\");\n\n/**\n * Like range.getBoundingClientRect() but normalizes for browser bugs.\n */\nfunction getRangeBoundingClientRect(range) {\n  // \"Return a DOMRect object describing the smallest rectangle that includes\n  // the first rectangle in list and all of the remaining rectangles of which\n  // the height or width is not zero.\"\n  // http://www.w3.org/TR/cssom-view/#dom-range-getboundingclientrect\n  var rects = getRangeClientRects(range);\n  var top = 0;\n  var right = 0;\n  var bottom = 0;\n  var left = 0;\n\n  if (rects.length) {\n    // If the first rectangle has 0 width, we use the second, this is needed\n    // because Chrome renders a 0 width rectangle when the selection contains\n    // a line break.\n    if (rects.length > 1 && rects[0].width === 0) {\n      var _rects$ = rects[1];\n      top = _rects$.top;\n      right = _rects$.right;\n      bottom = _rects$.bottom;\n      left = _rects$.left;\n    } else {\n      var _rects$2 = rects[0];\n      top = _rects$2.top;\n      right = _rects$2.right;\n      bottom = _rects$2.bottom;\n      left = _rects$2.left;\n    }\n\n    for (var ii = 1; ii < rects.length; ii++) {\n      var rect = rects[ii];\n\n      if (rect.height !== 0 && rect.width !== 0) {\n        top = Math.min(top, rect.top);\n        right = Math.max(right, rect.right);\n        bottom = Math.max(bottom, rect.bottom);\n        left = Math.min(left, rect.left);\n      }\n    }\n  }\n\n  return {\n    top: top,\n    right: right,\n    bottom: bottom,\n    left: left,\n    width: right - left,\n    height: bottom - top\n  };\n}\n\nmodule.exports = getRangeBoundingClientRect;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar getRangeBoundingClientRect = require(\"./getRangeBoundingClientRect\");\n/**\n * Return the bounding ClientRect for the visible DOM selection, if any.\n * In cases where there are no selected ranges or the bounding rect is\n * temporarily invalid, return null.\n *\n * When using from an iframe, you should pass the iframe window object\n */\n\n\nfunction getVisibleSelectionRect(global) {\n  var selection = global.getSelection();\n\n  if (!selection.rangeCount) {\n    return null;\n  }\n\n  var range = selection.getRangeAt(0);\n  var boundingRect = getRangeBoundingClientRect(range);\n  var top = boundingRect.top,\n      right = boundingRect.right,\n      bottom = boundingRect.bottom,\n      left = boundingRect.left; // When a re-render leads to a node being removed, the DOM selection will\n  // temporarily be placed on an ancestor node, which leads to an invalid\n  // bounding rect. Discard this state.\n\n  if (top === 0 && right === 0 && bottom === 0 && left === 0) {\n    return null;\n  }\n\n  return boundingRect;\n}\n\nmodule.exports = getVisibleSelectionRect;", "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n */\n'use strict';\n\nvar AtomicBlockUtils = require(\"./AtomicBlockUtils\");\n\nvar BlockMapBuilder = require(\"./BlockMapBuilder\");\n\nvar CharacterMetadata = require(\"./CharacterMetadata\");\n\nvar CompositeDraftDecorator = require(\"./CompositeDraftDecorator\");\n\nvar ContentBlock = require(\"./ContentBlock\");\n\nvar ContentState = require(\"./ContentState\");\n\nvar DefaultDraftBlockRenderMap = require(\"./DefaultDraftBlockRenderMap\");\n\nvar DefaultDraftInlineStyle = require(\"./DefaultDraftInlineStyle\");\n\nvar DraftEditor = require(\"./DraftEditor.react\");\n\nvar DraftEditorBlock = require(\"./DraftEditorBlock.react\");\n\nvar DraftEntity = require(\"./DraftEntity\");\n\nvar DraftModifier = require(\"./DraftModifier\");\n\nvar DraftEntityInstance = require(\"./DraftEntityInstance\");\n\nvar EditorState = require(\"./EditorState\");\n\nvar KeyBindingUtil = require(\"./KeyBindingUtil\");\n\nvar RawDraftContentState = require(\"./RawDraftContentState\");\n\nvar RichTextEditorUtil = require(\"./RichTextEditorUtil\");\n\nvar SelectionState = require(\"./SelectionState\");\n\nvar convertFromDraftStateToRaw = require(\"./convertFromDraftStateToRaw\");\n\nvar convertFromRawToDraftState = require(\"./convertFromRawToDraftState\");\n\nvar generateRandomKey = require(\"./generateRandomKey\");\n\nvar getDefaultKeyBinding = require(\"./getDefaultKeyBinding\");\n\nvar getVisibleSelectionRect = require(\"./getVisibleSelectionRect\");\n\nvar convertFromHTML = require(\"./convertFromHTMLToContentBlocks\");\n\nvar DraftPublic = {\n  Editor: DraftEditor,\n  EditorBlock: DraftEditorBlock,\n  EditorState: EditorState,\n  CompositeDecorator: CompositeDraftDecorator,\n  Entity: DraftEntity,\n  EntityInstance: DraftEntityInstance,\n  BlockMapBuilder: BlockMapBuilder,\n  CharacterMetadata: CharacterMetadata,\n  ContentBlock: ContentBlock,\n  ContentState: ContentState,\n  RawDraftContentState: RawDraftContentState,\n  SelectionState: SelectionState,\n  AtomicBlockUtils: AtomicBlockUtils,\n  KeyBindingUtil: KeyBindingUtil,\n  Modifier: DraftModifier,\n  RichUtils: RichTextEditorUtil,\n  DefaultDraftBlockRenderMap: DefaultDraftBlockRenderMap,\n  DefaultDraftInlineStyle: DefaultDraftInlineStyle,\n  convertFromHTML: convertFromHTML,\n  convertFromRaw: convertFromRawToDraftState,\n  convertToRaw: convertFromDraftStateToRaw,\n  genKey: generateRandomKey,\n  getDefaultKeyBinding: getDefaultKeyBinding,\n  getVisibleSelectionRect: getVisibleSelectionRect\n};\nmodule.exports = DraftPublic;", "/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n(function (global, factory) {\n  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n  typeof define === 'function' && define.amd ? define(factory) :\n  (global.Immutable = factory());\n}(this, function () { 'use strict';var SLICE$0 = Array.prototype.slice;\n\n  function createClass(ctor, superClass) {\n    if (superClass) {\n      ctor.prototype = Object.create(superClass.prototype);\n    }\n    ctor.prototype.constructor = ctor;\n  }\n\n  function Iterable(value) {\n      return isIterable(value) ? value : Seq(value);\n    }\n\n\n  createClass(KeyedIterable, Iterable);\n    function KeyedIterable(value) {\n      return isKeyed(value) ? value : KeyedSeq(value);\n    }\n\n\n  createClass(IndexedIterable, Iterable);\n    function IndexedIterable(value) {\n      return isIndexed(value) ? value : IndexedSeq(value);\n    }\n\n\n  createClass(SetIterable, Iterable);\n    function SetIterable(value) {\n      return isIterable(value) && !isAssociative(value) ? value : SetSeq(value);\n    }\n\n\n\n  function isIterable(maybeIterable) {\n    return !!(maybeIterable && maybeIterable[IS_ITERABLE_SENTINEL]);\n  }\n\n  function isKeyed(maybeKeyed) {\n    return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL]);\n  }\n\n  function isIndexed(maybeIndexed) {\n    return !!(maybeIndexed && maybeIndexed[IS_INDEXED_SENTINEL]);\n  }\n\n  function isAssociative(maybeAssociative) {\n    return isKeyed(maybeAssociative) || isIndexed(maybeAssociative);\n  }\n\n  function isOrdered(maybeOrdered) {\n    return !!(maybeOrdered && maybeOrdered[IS_ORDERED_SENTINEL]);\n  }\n\n  Iterable.isIterable = isIterable;\n  Iterable.isKeyed = isKeyed;\n  Iterable.isIndexed = isIndexed;\n  Iterable.isAssociative = isAssociative;\n  Iterable.isOrdered = isOrdered;\n\n  Iterable.Keyed = KeyedIterable;\n  Iterable.Indexed = IndexedIterable;\n  Iterable.Set = SetIterable;\n\n\n  var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';\n  var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';\n  var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@';\n  var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';\n\n  // Used for setting prototype methods that IE8 chokes on.\n  var DELETE = 'delete';\n\n  // Constants describing the size of trie nodes.\n  var SHIFT = 5; // Resulted in best performance after ______?\n  var SIZE = 1 << SHIFT;\n  var MASK = SIZE - 1;\n\n  // A consistent shared value representing \"not set\" which equals nothing other\n  // than itself, and nothing that could be provided externally.\n  var NOT_SET = {};\n\n  // Boolean references, Rough equivalent of `bool &`.\n  var CHANGE_LENGTH = { value: false };\n  var DID_ALTER = { value: false };\n\n  function MakeRef(ref) {\n    ref.value = false;\n    return ref;\n  }\n\n  function SetRef(ref) {\n    ref && (ref.value = true);\n  }\n\n  // A function which returns a value representing an \"owner\" for transient writes\n  // to tries. The return value will only ever equal itself, and will not equal\n  // the return of any subsequent call of this function.\n  function OwnerID() {}\n\n  // http://jsperf.com/copy-array-inline\n  function arrCopy(arr, offset) {\n    offset = offset || 0;\n    var len = Math.max(0, arr.length - offset);\n    var newArr = new Array(len);\n    for (var ii = 0; ii < len; ii++) {\n      newArr[ii] = arr[ii + offset];\n    }\n    return newArr;\n  }\n\n  function ensureSize(iter) {\n    if (iter.size === undefined) {\n      iter.size = iter.__iterate(returnTrue);\n    }\n    return iter.size;\n  }\n\n  function wrapIndex(iter, index) {\n    // This implements \"is array index\" which the ECMAString spec defines as:\n    //\n    //     A String property name P is an array index if and only if\n    //     ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal\n    //     to 2^32\u22121.\n    //\n    // http://www.ecma-international.org/ecma-262/6.0/#sec-array-exotic-objects\n    if (typeof index !== 'number') {\n      var uint32Index = index >>> 0; // N >>> 0 is shorthand for ToUint32\n      if ('' + uint32Index !== index || uint32Index === 4294967295) {\n        return NaN;\n      }\n      index = uint32Index;\n    }\n    return index < 0 ? ensureSize(iter) + index : index;\n  }\n\n  function returnTrue() {\n    return true;\n  }\n\n  function wholeSlice(begin, end, size) {\n    return (begin === 0 || (size !== undefined && begin <= -size)) &&\n      (end === undefined || (size !== undefined && end >= size));\n  }\n\n  function resolveBegin(begin, size) {\n    return resolveIndex(begin, size, 0);\n  }\n\n  function resolveEnd(end, size) {\n    return resolveIndex(end, size, size);\n  }\n\n  function resolveIndex(index, size, defaultIndex) {\n    return index === undefined ?\n      defaultIndex :\n      index < 0 ?\n        Math.max(0, size + index) :\n        size === undefined ?\n          index :\n          Math.min(size, index);\n  }\n\n  /* global Symbol */\n\n  var ITERATE_KEYS = 0;\n  var ITERATE_VALUES = 1;\n  var ITERATE_ENTRIES = 2;\n\n  var REAL_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;\n  var FAUX_ITERATOR_SYMBOL = '@@iterator';\n\n  var ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL;\n\n\n  function Iterator(next) {\n      this.next = next;\n    }\n\n    Iterator.prototype.toString = function() {\n      return '[Iterator]';\n    };\n\n\n  Iterator.KEYS = ITERATE_KEYS;\n  Iterator.VALUES = ITERATE_VALUES;\n  Iterator.ENTRIES = ITERATE_ENTRIES;\n\n  Iterator.prototype.inspect =\n  Iterator.prototype.toSource = function () { return this.toString(); }\n  Iterator.prototype[ITERATOR_SYMBOL] = function () {\n    return this;\n  };\n\n\n  function iteratorValue(type, k, v, iteratorResult) {\n    var value = type === 0 ? k : type === 1 ? v : [k, v];\n    iteratorResult ? (iteratorResult.value = value) : (iteratorResult = {\n      value: value, done: false\n    });\n    return iteratorResult;\n  }\n\n  function iteratorDone() {\n    return { value: undefined, done: true };\n  }\n\n  function hasIterator(maybeIterable) {\n    return !!getIteratorFn(maybeIterable);\n  }\n\n  function isIterator(maybeIterator) {\n    return maybeIterator && typeof maybeIterator.next === 'function';\n  }\n\n  function getIterator(iterable) {\n    var iteratorFn = getIteratorFn(iterable);\n    return iteratorFn && iteratorFn.call(iterable);\n  }\n\n  function getIteratorFn(iterable) {\n    var iteratorFn = iterable && (\n      (REAL_ITERATOR_SYMBOL && iterable[REAL_ITERATOR_SYMBOL]) ||\n      iterable[FAUX_ITERATOR_SYMBOL]\n    );\n    if (typeof iteratorFn === 'function') {\n      return iteratorFn;\n    }\n  }\n\n  function isArrayLike(value) {\n    return value && typeof value.length === 'number';\n  }\n\n  createClass(Seq, Iterable);\n    function Seq(value) {\n      return value === null || value === undefined ? emptySequence() :\n        isIterable(value) ? value.toSeq() : seqFromValue(value);\n    }\n\n    Seq.of = function(/*...values*/) {\n      return Seq(arguments);\n    };\n\n    Seq.prototype.toSeq = function() {\n      return this;\n    };\n\n    Seq.prototype.toString = function() {\n      return this.__toString('Seq {', '}');\n    };\n\n    Seq.prototype.cacheResult = function() {\n      if (!this._cache && this.__iterateUncached) {\n        this._cache = this.entrySeq().toArray();\n        this.size = this._cache.length;\n      }\n      return this;\n    };\n\n    // abstract __iterateUncached(fn, reverse)\n\n    Seq.prototype.__iterate = function(fn, reverse) {\n      return seqIterate(this, fn, reverse, true);\n    };\n\n    // abstract __iteratorUncached(type, reverse)\n\n    Seq.prototype.__iterator = function(type, reverse) {\n      return seqIterator(this, type, reverse, true);\n    };\n\n\n\n  createClass(KeyedSeq, Seq);\n    function KeyedSeq(value) {\n      return value === null || value === undefined ?\n        emptySequence().toKeyedSeq() :\n        isIterable(value) ?\n          (isKeyed(value) ? value.toSeq() : value.fromEntrySeq()) :\n          keyedSeqFromValue(value);\n    }\n\n    KeyedSeq.prototype.toKeyedSeq = function() {\n      return this;\n    };\n\n\n\n  createClass(IndexedSeq, Seq);\n    function IndexedSeq(value) {\n      return value === null || value === undefined ? emptySequence() :\n        !isIterable(value) ? indexedSeqFromValue(value) :\n        isKeyed(value) ? value.entrySeq() : value.toIndexedSeq();\n    }\n\n    IndexedSeq.of = function(/*...values*/) {\n      return IndexedSeq(arguments);\n    };\n\n    IndexedSeq.prototype.toIndexedSeq = function() {\n      return this;\n    };\n\n    IndexedSeq.prototype.toString = function() {\n      return this.__toString('Seq [', ']');\n    };\n\n    IndexedSeq.prototype.__iterate = function(fn, reverse) {\n      return seqIterate(this, fn, reverse, false);\n    };\n\n    IndexedSeq.prototype.__iterator = function(type, reverse) {\n      return seqIterator(this, type, reverse, false);\n    };\n\n\n\n  createClass(SetSeq, Seq);\n    function SetSeq(value) {\n      return (\n        value === null || value === undefined ? emptySequence() :\n        !isIterable(value) ? indexedSeqFromValue(value) :\n        isKeyed(value) ? value.entrySeq() : value\n      ).toSetSeq();\n    }\n\n    SetSeq.of = function(/*...values*/) {\n      return SetSeq(arguments);\n    };\n\n    SetSeq.prototype.toSetSeq = function() {\n      return this;\n    };\n\n\n\n  Seq.isSeq = isSeq;\n  Seq.Keyed = KeyedSeq;\n  Seq.Set = SetSeq;\n  Seq.Indexed = IndexedSeq;\n\n  var IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';\n\n  Seq.prototype[IS_SEQ_SENTINEL] = true;\n\n\n\n  createClass(ArraySeq, IndexedSeq);\n    function ArraySeq(array) {\n      this._array = array;\n      this.size = array.length;\n    }\n\n    ArraySeq.prototype.get = function(index, notSetValue) {\n      return this.has(index) ? this._array[wrapIndex(this, index)] : notSetValue;\n    };\n\n    ArraySeq.prototype.__iterate = function(fn, reverse) {\n      var array = this._array;\n      var maxIndex = array.length - 1;\n      for (var ii = 0; ii <= maxIndex; ii++) {\n        if (fn(array[reverse ? maxIndex - ii : ii], ii, this) === false) {\n          return ii + 1;\n        }\n      }\n      return ii;\n    };\n\n    ArraySeq.prototype.__iterator = function(type, reverse) {\n      var array = this._array;\n      var maxIndex = array.length - 1;\n      var ii = 0;\n      return new Iterator(function() \n        {return ii > maxIndex ?\n          iteratorDone() :\n          iteratorValue(type, ii, array[reverse ? maxIndex - ii++ : ii++])}\n      );\n    };\n\n\n\n  createClass(ObjectSeq, KeyedSeq);\n    function ObjectSeq(object) {\n      var keys = Object.keys(object);\n      this._object = object;\n      this._keys = keys;\n      this.size = keys.length;\n    }\n\n    ObjectSeq.prototype.get = function(key, notSetValue) {\n      if (notSetValue !== undefined && !this.has(key)) {\n        return notSetValue;\n      }\n      return this._object[key];\n    };\n\n    ObjectSeq.prototype.has = function(key) {\n      return this._object.hasOwnProperty(key);\n    };\n\n    ObjectSeq.prototype.__iterate = function(fn, reverse) {\n      var object = this._object;\n      var keys = this._keys;\n      var maxIndex = keys.length - 1;\n      for (var ii = 0; ii <= maxIndex; ii++) {\n        var key = keys[reverse ? maxIndex - ii : ii];\n        if (fn(object[key], key, this) === false) {\n          return ii + 1;\n        }\n      }\n      return ii;\n    };\n\n    ObjectSeq.prototype.__iterator = function(type, reverse) {\n      var object = this._object;\n      var keys = this._keys;\n      var maxIndex = keys.length - 1;\n      var ii = 0;\n      return new Iterator(function()  {\n        var key = keys[reverse ? maxIndex - ii : ii];\n        return ii++ > maxIndex ?\n          iteratorDone() :\n          iteratorValue(type, key, object[key]);\n      });\n    };\n\n  ObjectSeq.prototype[IS_ORDERED_SENTINEL] = true;\n\n\n  createClass(IterableSeq, IndexedSeq);\n    function IterableSeq(iterable) {\n      this._iterable = iterable;\n      this.size = iterable.length || iterable.size;\n    }\n\n    IterableSeq.prototype.__iterateUncached = function(fn, reverse) {\n      if (reverse) {\n        return this.cacheResult().__iterate(fn, reverse);\n      }\n      var iterable = this._iterable;\n      var iterator = getIterator(iterable);\n      var iterations = 0;\n      if (isIterator(iterator)) {\n        var step;\n        while (!(step = iterator.next()).done) {\n          if (fn(step.value, iterations++, this) === false) {\n            break;\n          }\n        }\n      }\n      return iterations;\n    };\n\n    IterableSeq.prototype.__iteratorUncached = function(type, reverse) {\n      if (reverse) {\n        return this.cacheResult().__iterator(type, reverse);\n      }\n      var iterable = this._iterable;\n      var iterator = getIterator(iterable);\n      if (!isIterator(iterator)) {\n        return new Iterator(iteratorDone);\n      }\n      var iterations = 0;\n      return new Iterator(function()  {\n        var step = iterator.next();\n        return step.done ? step : iteratorValue(type, iterations++, step.value);\n      });\n    };\n\n\n\n  createClass(IteratorSeq, IndexedSeq);\n    function IteratorSeq(iterator) {\n      this._iterator = iterator;\n      this._iteratorCache = [];\n    }\n\n    IteratorSeq.prototype.__iterateUncached = function(fn, reverse) {\n      if (reverse) {\n        return this.cacheResult().__iterate(fn, reverse);\n      }\n      var iterator = this._iterator;\n      var cache = this._iteratorCache;\n      var iterations = 0;\n      while (iterations < cache.length) {\n        if (fn(cache[iterations], iterations++, this) === false) {\n          return iterations;\n        }\n      }\n      var step;\n      while (!(step = iterator.next()).done) {\n        var val = step.value;\n        cache[iterations] = val;\n        if (fn(val, iterations++, this) === false) {\n          break;\n        }\n      }\n      return iterations;\n    };\n\n    IteratorSeq.prototype.__iteratorUncached = function(type, reverse) {\n      if (reverse) {\n        return this.cacheResult().__iterator(type, reverse);\n      }\n      var iterator = this._iterator;\n      var cache = this._iteratorCache;\n      var iterations = 0;\n      return new Iterator(function()  {\n        if (iterations >= cache.length) {\n          var step = iterator.next();\n          if (step.done) {\n            return step;\n          }\n          cache[iterations] = step.value;\n        }\n        return iteratorValue(type, iterations, cache[iterations++]);\n      });\n    };\n\n\n\n\n  // # pragma Helper functions\n\n  function isSeq(maybeSeq) {\n    return !!(maybeSeq && maybeSeq[IS_SEQ_SENTINEL]);\n  }\n\n  var EMPTY_SEQ;\n\n  function emptySequence() {\n    return EMPTY_SEQ || (EMPTY_SEQ = new ArraySeq([]));\n  }\n\n  function keyedSeqFromValue(value) {\n    var seq =\n      Array.isArray(value) ? new ArraySeq(value).fromEntrySeq() :\n      isIterator(value) ? new IteratorSeq(value).fromEntrySeq() :\n      hasIterator(value) ? new IterableSeq(value).fromEntrySeq() :\n      typeof value === 'object' ? new ObjectSeq(value) :\n      undefined;\n    if (!seq) {\n      throw new TypeError(\n        'Expected Array or iterable object of [k, v] entries, '+\n        'or keyed object: ' + value\n      );\n    }\n    return seq;\n  }\n\n  function indexedSeqFromValue(value) {\n    var seq = maybeIndexedSeqFromValue(value);\n    if (!seq) {\n      throw new TypeError(\n        'Expected Array or iterable object of values: ' + value\n      );\n    }\n    return seq;\n  }\n\n  function seqFromValue(value) {\n    var seq = maybeIndexedSeqFromValue(value) ||\n      (typeof value === 'object' && new ObjectSeq(value));\n    if (!seq) {\n      throw new TypeError(\n        'Expected Array or iterable object of values, or keyed object: ' + value\n      );\n    }\n    return seq;\n  }\n\n  function maybeIndexedSeqFromValue(value) {\n    return (\n      isArrayLike(value) ? new ArraySeq(value) :\n      isIterator(value) ? new IteratorSeq(value) :\n      hasIterator(value) ? new IterableSeq(value) :\n      undefined\n    );\n  }\n\n  function seqIterate(seq, fn, reverse, useKeys) {\n    var cache = seq._cache;\n    if (cache) {\n      var maxIndex = cache.length - 1;\n      for (var ii = 0; ii <= maxIndex; ii++) {\n        var entry = cache[reverse ? maxIndex - ii : ii];\n        if (fn(entry[1], useKeys ? entry[0] : ii, seq) === false) {\n          return ii + 1;\n        }\n      }\n      return ii;\n    }\n    return seq.__iterateUncached(fn, reverse);\n  }\n\n  function seqIterator(seq, type, reverse, useKeys) {\n    var cache = seq._cache;\n    if (cache) {\n      var maxIndex = cache.length - 1;\n      var ii = 0;\n      return new Iterator(function()  {\n        var entry = cache[reverse ? maxIndex - ii : ii];\n        return ii++ > maxIndex ?\n          iteratorDone() :\n          iteratorValue(type, useKeys ? entry[0] : ii - 1, entry[1]);\n      });\n    }\n    return seq.__iteratorUncached(type, reverse);\n  }\n\n  function fromJS(json, converter) {\n    return converter ?\n      fromJSWith(converter, json, '', {'': json}) :\n      fromJSDefault(json);\n  }\n\n  function fromJSWith(converter, json, key, parentJSON) {\n    if (Array.isArray(json)) {\n      return converter.call(parentJSON, key, IndexedSeq(json).map(function(v, k)  {return fromJSWith(converter, v, k, json)}));\n    }\n    if (isPlainObj(json)) {\n      return converter.call(parentJSON, key, KeyedSeq(json).map(function(v, k)  {return fromJSWith(converter, v, k, json)}));\n    }\n    return json;\n  }\n\n  function fromJSDefault(json) {\n    if (Array.isArray(json)) {\n      return IndexedSeq(json).map(fromJSDefault).toList();\n    }\n    if (isPlainObj(json)) {\n      return KeyedSeq(json).map(fromJSDefault).toMap();\n    }\n    return json;\n  }\n\n  function isPlainObj(value) {\n    return value && (value.constructor === Object || value.constructor === undefined);\n  }\n\n  /**\n   * An extension of the \"same-value\" algorithm as [described for use by ES6 Map\n   * and Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#Key_equality)\n   *\n   * NaN is considered the same as NaN, however -0 and 0 are considered the same\n   * value, which is different from the algorithm described by\n   * [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).\n   *\n   * This is extended further to allow Objects to describe the values they\n   * represent, by way of `valueOf` or `equals` (and `hashCode`).\n   *\n   * Note: because of this extension, the key equality of Immutable.Map and the\n   * value equality of Immutable.Set will differ from ES6 Map and Set.\n   *\n   * ### Defining custom values\n   *\n   * The easiest way to describe the value an object represents is by implementing\n   * `valueOf`. For example, `Date` represents a value by returning a unix\n   * timestamp for `valueOf`:\n   *\n   *     var date1 = new Date(1234567890000); // Fri Feb 13 2009 ...\n   *     var date2 = new Date(1234567890000);\n   *     date1.valueOf(); // 1234567890000\n   *     assert( date1 !== date2 );\n   *     assert( Immutable.is( date1, date2 ) );\n   *\n   * Note: overriding `valueOf` may have other implications if you use this object\n   * where JavaScript expects a primitive, such as implicit string coercion.\n   *\n   * For more complex types, especially collections, implementing `valueOf` may\n   * not be performant. An alternative is to implement `equals` and `hashCode`.\n   *\n   * `equals` takes another object, presumably of similar type, and returns true\n   * if the it is equal. Equality is symmetrical, so the same result should be\n   * returned if this and the argument are flipped.\n   *\n   *     assert( a.equals(b) === b.equals(a) );\n   *\n   * `hashCode` returns a 32bit integer number representing the object which will\n   * be used to determine how to store the value object in a Map or Set. You must\n   * provide both or neither methods, one must not exist without the other.\n   *\n   * Also, an important relationship between these methods must be upheld: if two\n   * values are equal, they *must* return the same hashCode. If the values are not\n   * equal, they might have the same hashCode; this is called a hash collision,\n   * and while undesirable for performance reasons, it is acceptable.\n   *\n   *     if (a.equals(b)) {\n   *       assert( a.hashCode() === b.hashCode() );\n   *     }\n   *\n   * All Immutable collections implement `equals` and `hashCode`.\n   *\n   */\n  function is(valueA, valueB) {\n    if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {\n      return true;\n    }\n    if (!valueA || !valueB) {\n      return false;\n    }\n    if (typeof valueA.valueOf === 'function' &&\n        typeof valueB.valueOf === 'function') {\n      valueA = valueA.valueOf();\n      valueB = valueB.valueOf();\n      if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {\n        return true;\n      }\n      if (!valueA || !valueB) {\n        return false;\n      }\n    }\n    if (typeof valueA.equals === 'function' &&\n        typeof valueB.equals === 'function' &&\n        valueA.equals(valueB)) {\n      return true;\n    }\n    return false;\n  }\n\n  function deepEqual(a, b) {\n    if (a === b) {\n      return true;\n    }\n\n    if (\n      !isIterable(b) ||\n      a.size !== undefined && b.size !== undefined && a.size !== b.size ||\n      a.__hash !== undefined && b.__hash !== undefined && a.__hash !== b.__hash ||\n      isKeyed(a) !== isKeyed(b) ||\n      isIndexed(a) !== isIndexed(b) ||\n      isOrdered(a) !== isOrdered(b)\n    ) {\n      return false;\n    }\n\n    if (a.size === 0 && b.size === 0) {\n      return true;\n    }\n\n    var notAssociative = !isAssociative(a);\n\n    if (isOrdered(a)) {\n      var entries = a.entries();\n      return b.every(function(v, k)  {\n        var entry = entries.next().value;\n        return entry && is(entry[1], v) && (notAssociative || is(entry[0], k));\n      }) && entries.next().done;\n    }\n\n    var flipped = false;\n\n    if (a.size === undefined) {\n      if (b.size === undefined) {\n        if (typeof a.cacheResult === 'function') {\n          a.cacheResult();\n        }\n      } else {\n        flipped = true;\n        var _ = a;\n        a = b;\n        b = _;\n      }\n    }\n\n    var allEqual = true;\n    var bSize = b.__iterate(function(v, k)  {\n      if (notAssociative ? !a.has(v) :\n          flipped ? !is(v, a.get(k, NOT_SET)) : !is(a.get(k, NOT_SET), v)) {\n        allEqual = false;\n        return false;\n      }\n    });\n\n    return allEqual && a.size === bSize;\n  }\n\n  createClass(Repeat, IndexedSeq);\n\n    function Repeat(value, times) {\n      if (!(this instanceof Repeat)) {\n        return new Repeat(value, times);\n      }\n      this._value = value;\n      this.size = times === undefined ? Infinity : Math.max(0, times);\n      if (this.size === 0) {\n        if (EMPTY_REPEAT) {\n          return EMPTY_REPEAT;\n        }\n        EMPTY_REPEAT = this;\n      }\n    }\n\n    Repeat.prototype.toString = function() {\n      if (this.size === 0) {\n        return 'Repeat []';\n      }\n      return 'Repeat [ ' + this._value + ' ' + this.size + ' times ]';\n    };\n\n    Repeat.prototype.get = function(index, notSetValue) {\n      return this.has(index) ? this._value : notSetValue;\n    };\n\n    Repeat.prototype.includes = function(searchValue) {\n      return is(this._value, searchValue);\n    };\n\n    Repeat.prototype.slice = function(begin, end) {\n      var size = this.size;\n      return wholeSlice(begin, end, size) ? this :\n        new Repeat(this._value, resolveEnd(end, size) - resolveBegin(begin, size));\n    };\n\n    Repeat.prototype.reverse = function() {\n      return this;\n    };\n\n    Repeat.prototype.indexOf = function(searchValue) {\n      if (is(this._value, searchValue)) {\n        return 0;\n      }\n      return -1;\n    };\n\n    Repeat.prototype.lastIndexOf = function(searchValue) {\n      if (is(this._value, searchValue)) {\n        return this.size;\n      }\n      return -1;\n    };\n\n    Repeat.prototype.__iterate = function(fn, reverse) {\n      for (var ii = 0; ii < this.size; ii++) {\n        if (fn(this._value, ii, this) === false) {\n          return ii + 1;\n        }\n      }\n      return ii;\n    };\n\n    Repeat.prototype.__iterator = function(type, reverse) {var this$0 = this;\n      var ii = 0;\n      return new Iterator(function() \n        {return ii < this$0.size ? iteratorValue(type, ii++, this$0._value) : iteratorDone()}\n      );\n    };\n\n    Repeat.prototype.equals = function(other) {\n      return other instanceof Repeat ?\n        is(this._value, other._value) :\n        deepEqual(other);\n    };\n\n\n  var EMPTY_REPEAT;\n\n  function invariant(condition, error) {\n    if (!condition) throw new Error(error);\n  }\n\n  createClass(Range, IndexedSeq);\n\n    function Range(start, end, step) {\n      if (!(this instanceof Range)) {\n        return new Range(start, end, step);\n      }\n      invariant(step !== 0, 'Cannot step a Range by 0');\n      start = start || 0;\n      if (end === undefined) {\n        end = Infinity;\n      }\n      step = step === undefined ? 1 : Math.abs(step);\n      if (end < start) {\n        step = -step;\n      }\n      this._start = start;\n      this._end = end;\n      this._step = step;\n      this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1);\n      if (this.size === 0) {\n        if (EMPTY_RANGE) {\n          return EMPTY_RANGE;\n        }\n        EMPTY_RANGE = this;\n      }\n    }\n\n    Range.prototype.toString = function() {\n      if (this.size === 0) {\n        return 'Range []';\n      }\n      return 'Range [ ' +\n        this._start + '...' + this._end +\n        (this._step !== 1 ? ' by ' + this._step : '') +\n      ' ]';\n    };\n\n    Range.prototype.get = function(index, notSetValue) {\n      return this.has(index) ?\n        this._start + wrapIndex(this, index) * this._step :\n        notSetValue;\n    };\n\n    Range.prototype.includes = function(searchValue) {\n      var possibleIndex = (searchValue - this._start) / this._step;\n      return possibleIndex >= 0 &&\n        possibleIndex < this.size &&\n        possibleIndex === Math.floor(possibleIndex);\n    };\n\n    Range.prototype.slice = function(begin, end) {\n      if (wholeSlice(begin, end, this.size)) {\n        return this;\n      }\n      begin = resolveBegin(begin, this.size);\n      end = resolveEnd(end, this.size);\n      if (end <= begin) {\n        return new Range(0, 0);\n      }\n      return new Range(this.get(begin, this._end), this.get(end, this._end), this._step);\n    };\n\n    Range.prototype.indexOf = function(searchValue) {\n      var offsetValue = searchValue - this._start;\n      if (offsetValue % this._step === 0) {\n        var index = offsetValue / this._step;\n        if (index >= 0 && index < this.size) {\n          return index\n        }\n      }\n      return -1;\n    };\n\n    Range.prototype.lastIndexOf = function(searchValue) {\n      return this.indexOf(searchValue);\n    };\n\n    Range.prototype.__iterate = function(fn, reverse) {\n      var maxIndex = this.size - 1;\n      var step = this._step;\n      var value = reverse ? this._start + maxIndex * step : this._start;\n      for (var ii = 0; ii <= maxIndex; ii++) {\n        if (fn(value, ii, this) === false) {\n          return ii + 1;\n        }\n        value += reverse ? -step : step;\n      }\n      return ii;\n    };\n\n    Range.prototype.__iterator = function(type, reverse) {\n      var maxIndex = this.size - 1;\n      var step = this._step;\n      var value = reverse ? this._start + maxIndex * step : this._start;\n      var ii = 0;\n      return new Iterator(function()  {\n        var v = value;\n        value += reverse ? -step : step;\n        return ii > maxIndex ? iteratorDone() : iteratorValue(type, ii++, v);\n      });\n    };\n\n    Range.prototype.equals = function(other) {\n      return other instanceof Range ?\n        this._start === other._start &&\n        this._end === other._end &&\n        this._step === other._step :\n        deepEqual(this, other);\n    };\n\n\n  var EMPTY_RANGE;\n\n  createClass(Collection, Iterable);\n    function Collection() {\n      throw TypeError('Abstract');\n    }\n\n\n  createClass(KeyedCollection, Collection);function KeyedCollection() {}\n\n  createClass(IndexedCollection, Collection);function IndexedCollection() {}\n\n  createClass(SetCollection, Collection);function SetCollection() {}\n\n\n  Collection.Keyed = KeyedCollection;\n  Collection.Indexed = IndexedCollection;\n  Collection.Set = SetCollection;\n\n  var imul =\n    typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2 ?\n    Math.imul :\n    function imul(a, b) {\n      a = a | 0; // int\n      b = b | 0; // int\n      var c = a & 0xffff;\n      var d = b & 0xffff;\n      // Shift by 0 fixes the sign on the high part.\n      return (c * d) + ((((a >>> 16) * d + c * (b >>> 16)) << 16) >>> 0) | 0; // int\n    };\n\n  // v8 has an optimization for storing 31-bit signed numbers.\n  // Values which have either 00 or 11 as the high order bits qualify.\n  // This function drops the highest order bit in a signed number, maintaining\n  // the sign bit.\n  function smi(i32) {\n    return ((i32 >>> 1) & 0x40000000) | (i32 & 0xBFFFFFFF);\n  }\n\n  function hash(o) {\n    if (o === false || o === null || o === undefined) {\n      return 0;\n    }\n    if (typeof o.valueOf === 'function') {\n      o = o.valueOf();\n      if (o === false || o === null || o === undefined) {\n        return 0;\n      }\n    }\n    if (o === true) {\n      return 1;\n    }\n    var type = typeof o;\n    if (type === 'number') {\n      if (o !== o || o === Infinity) {\n        return 0;\n      }\n      var h = o | 0;\n      if (h !== o) {\n        h ^= o * 0xFFFFFFFF;\n      }\n      while (o > 0xFFFFFFFF) {\n        o /= 0xFFFFFFFF;\n        h ^= o;\n      }\n      return smi(h);\n    }\n    if (type === 'string') {\n      return o.length > STRING_HASH_CACHE_MIN_STRLEN ? cachedHashString(o) : hashString(o);\n    }\n    if (typeof o.hashCode === 'function') {\n      return o.hashCode();\n    }\n    if (type === 'object') {\n      return hashJSObj(o);\n    }\n    if (typeof o.toString === 'function') {\n      return hashString(o.toString());\n    }\n    throw new Error('Value type ' + type + ' cannot be hashed.');\n  }\n\n  function cachedHashString(string) {\n    var hash = stringHashCache[string];\n    if (hash === undefined) {\n      hash = hashString(string);\n      if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) {\n        STRING_HASH_CACHE_SIZE = 0;\n        stringHashCache = {};\n      }\n      STRING_HASH_CACHE_SIZE++;\n      stringHashCache[string] = hash;\n    }\n    return hash;\n  }\n\n  // http://jsperf.com/hashing-strings\n  function hashString(string) {\n    // This is the hash from JVM\n    // The hash code for a string is computed as\n    // s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1],\n    // where s[i] is the ith character of the string and n is the length of\n    // the string. We \"mod\" the result to make it between 0 (inclusive) and 2^31\n    // (exclusive) by dropping high bits.\n    var hash = 0;\n    for (var ii = 0; ii < string.length; ii++) {\n      hash = 31 * hash + string.charCodeAt(ii) | 0;\n    }\n    return smi(hash);\n  }\n\n  function hashJSObj(obj) {\n    var hash;\n    if (usingWeakMap) {\n      hash = weakMap.get(obj);\n      if (hash !== undefined) {\n        return hash;\n      }\n    }\n\n    hash = obj[UID_HASH_KEY];\n    if (hash !== undefined) {\n      return hash;\n    }\n\n    if (!canDefineProperty) {\n      hash = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY];\n      if (hash !== undefined) {\n        return hash;\n      }\n\n      hash = getIENodeHash(obj);\n      if (hash !== undefined) {\n        return hash;\n      }\n    }\n\n    hash = ++objHashUID;\n    if (objHashUID & 0x40000000) {\n      objHashUID = 0;\n    }\n\n    if (usingWeakMap) {\n      weakMap.set(obj, hash);\n    } else if (isExtensible !== undefined && isExtensible(obj) === false) {\n      throw new Error('Non-extensible objects are not allowed as keys.');\n    } else if (canDefineProperty) {\n      Object.defineProperty(obj, UID_HASH_KEY, {\n        'enumerable': false,\n        'configurable': false,\n        'writable': false,\n        'value': hash\n      });\n    } else if (obj.propertyIsEnumerable !== undefined &&\n               obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable) {\n      // Since we can't define a non-enumerable property on the object\n      // we'll hijack one of the less-used non-enumerable properties to\n      // save our hash on it. Since this is a function it will not show up in\n      // `JSON.stringify` which is what we want.\n      obj.propertyIsEnumerable = function() {\n        return this.constructor.prototype.propertyIsEnumerable.apply(this, arguments);\n      };\n      obj.propertyIsEnumerable[UID_HASH_KEY] = hash;\n    } else if (obj.nodeType !== undefined) {\n      // At this point we couldn't get the IE `uniqueID` to use as a hash\n      // and we couldn't use a non-enumerable property to exploit the\n      // dontEnum bug so we simply add the `UID_HASH_KEY` on the node\n      // itself.\n      obj[UID_HASH_KEY] = hash;\n    } else {\n      throw new Error('Unable to set a non-enumerable property on object.');\n    }\n\n    return hash;\n  }\n\n  // Get references to ES5 object methods.\n  var isExtensible = Object.isExtensible;\n\n  // True if Object.defineProperty works as expected. IE8 fails this test.\n  var canDefineProperty = (function() {\n    try {\n      Object.defineProperty({}, '@', {});\n      return true;\n    } catch (e) {\n      return false;\n    }\n  }());\n\n  // IE has a `uniqueID` property on DOM nodes. We can construct the hash from it\n  // and avoid memory leaks from the IE cloneNode bug.\n  function getIENodeHash(node) {\n    if (node && node.nodeType > 0) {\n      switch (node.nodeType) {\n        case 1: // Element\n          return node.uniqueID;\n        case 9: // Document\n          return node.documentElement && node.documentElement.uniqueID;\n      }\n    }\n  }\n\n  // If possible, use a WeakMap.\n  var usingWeakMap = typeof WeakMap === 'function';\n  var weakMap;\n  if (usingWeakMap) {\n    weakMap = new WeakMap();\n  }\n\n  var objHashUID = 0;\n\n  var UID_HASH_KEY = '__immutablehash__';\n  if (typeof Symbol === 'function') {\n    UID_HASH_KEY = Symbol(UID_HASH_KEY);\n  }\n\n  var STRING_HASH_CACHE_MIN_STRLEN = 16;\n  var STRING_HASH_CACHE_MAX_SIZE = 255;\n  var STRING_HASH_CACHE_SIZE = 0;\n  var stringHashCache = {};\n\n  function assertNotInfinite(size) {\n    invariant(\n      size !== Infinity,\n      'Cannot perform this action with an infinite size.'\n    );\n  }\n\n  createClass(Map, KeyedCollection);\n\n    // @pragma Construction\n\n    function Map(value) {\n      return value === null || value === undefined ? emptyMap() :\n        isMap(value) && !isOrdered(value) ? value :\n        emptyMap().withMutations(function(map ) {\n          var iter = KeyedIterable(value);\n          assertNotInfinite(iter.size);\n          iter.forEach(function(v, k)  {return map.set(k, v)});\n        });\n    }\n\n    Map.of = function() {var keyValues = SLICE$0.call(arguments, 0);\n      return emptyMap().withMutations(function(map ) {\n        for (var i = 0; i < keyValues.length; i += 2) {\n          if (i + 1 >= keyValues.length) {\n            throw new Error('Missing value for key: ' + keyValues[i]);\n          }\n          map.set(keyValues[i], keyValues[i + 1]);\n        }\n      });\n    };\n\n    Map.prototype.toString = function() {\n      return this.__toString('Map {', '}');\n    };\n\n    // @pragma Access\n\n    Map.prototype.get = function(k, notSetValue) {\n      return this._root ?\n        this._root.get(0, undefined, k, notSetValue) :\n        notSetValue;\n    };\n\n    // @pragma Modification\n\n    Map.prototype.set = function(k, v) {\n      return updateMap(this, k, v);\n    };\n\n    Map.prototype.setIn = function(keyPath, v) {\n      return this.updateIn(keyPath, NOT_SET, function()  {return v});\n    };\n\n    Map.prototype.remove = function(k) {\n      return updateMap(this, k, NOT_SET);\n    };\n\n    Map.prototype.deleteIn = function(keyPath) {\n      return this.updateIn(keyPath, function()  {return NOT_SET});\n    };\n\n    Map.prototype.update = function(k, notSetValue, updater) {\n      return arguments.length === 1 ?\n        k(this) :\n        this.updateIn([k], notSetValue, updater);\n    };\n\n    Map.prototype.updateIn = function(keyPath, notSetValue, updater) {\n      if (!updater) {\n        updater = notSetValue;\n        notSetValue = undefined;\n      }\n      var updatedValue = updateInDeepMap(\n        this,\n        forceIterator(keyPath),\n        notSetValue,\n        updater\n      );\n      return updatedValue === NOT_SET ? undefined : updatedValue;\n    };\n\n    Map.prototype.clear = function() {\n      if (this.size === 0) {\n        return this;\n      }\n      if (this.__ownerID) {\n        this.size = 0;\n        this._root = null;\n        this.__hash = undefined;\n        this.__altered = true;\n        return this;\n      }\n      return emptyMap();\n    };\n\n    // @pragma Composition\n\n    Map.prototype.merge = function(/*...iters*/) {\n      return mergeIntoMapWith(this, undefined, arguments);\n    };\n\n    Map.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n      return mergeIntoMapWith(this, merger, iters);\n    };\n\n    Map.prototype.mergeIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1);\n      return this.updateIn(\n        keyPath,\n        emptyMap(),\n        function(m ) {return typeof m.merge === 'function' ?\n          m.merge.apply(m, iters) :\n          iters[iters.length - 1]}\n      );\n    };\n\n    Map.prototype.mergeDeep = function(/*...iters*/) {\n      return mergeIntoMapWith(this, deepMerger, arguments);\n    };\n\n    Map.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n      return mergeIntoMapWith(this, deepMergerWith(merger), iters);\n    };\n\n    Map.prototype.mergeDeepIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1);\n      return this.updateIn(\n        keyPath,\n        emptyMap(),\n        function(m ) {return typeof m.mergeDeep === 'function' ?\n          m.mergeDeep.apply(m, iters) :\n          iters[iters.length - 1]}\n      );\n    };\n\n    Map.prototype.sort = function(comparator) {\n      // Late binding\n      return OrderedMap(sortFactory(this, comparator));\n    };\n\n    Map.prototype.sortBy = function(mapper, comparator) {\n      // Late binding\n      return OrderedMap(sortFactory(this, comparator, mapper));\n    };\n\n    // @pragma Mutability\n\n    Map.prototype.withMutations = function(fn) {\n      var mutable = this.asMutable();\n      fn(mutable);\n      return mutable.wasAltered() ? mutable.__ensureOwner(this.__ownerID) : this;\n    };\n\n    Map.prototype.asMutable = function() {\n      return this.__ownerID ? this : this.__ensureOwner(new OwnerID());\n    };\n\n    Map.prototype.asImmutable = function() {\n      return this.__ensureOwner();\n    };\n\n    Map.prototype.wasAltered = function() {\n      return this.__altered;\n    };\n\n    Map.prototype.__iterator = function(type, reverse) {\n      return new MapIterator(this, type, reverse);\n    };\n\n    Map.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n      var iterations = 0;\n      this._root && this._root.iterate(function(entry ) {\n        iterations++;\n        return fn(entry[1], entry[0], this$0);\n      }, reverse);\n      return iterations;\n    };\n\n    Map.prototype.__ensureOwner = function(ownerID) {\n      if (ownerID === this.__ownerID) {\n        return this;\n      }\n      if (!ownerID) {\n        this.__ownerID = ownerID;\n        this.__altered = false;\n        return this;\n      }\n      return makeMap(this.size, this._root, ownerID, this.__hash);\n    };\n\n\n  function isMap(maybeMap) {\n    return !!(maybeMap && maybeMap[IS_MAP_SENTINEL]);\n  }\n\n  Map.isMap = isMap;\n\n  var IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';\n\n  var MapPrototype = Map.prototype;\n  MapPrototype[IS_MAP_SENTINEL] = true;\n  MapPrototype[DELETE] = MapPrototype.remove;\n  MapPrototype.removeIn = MapPrototype.deleteIn;\n\n\n  // #pragma Trie Nodes\n\n\n\n    function ArrayMapNode(ownerID, entries) {\n      this.ownerID = ownerID;\n      this.entries = entries;\n    }\n\n    ArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n      var entries = this.entries;\n      for (var ii = 0, len = entries.length; ii < len; ii++) {\n        if (is(key, entries[ii][0])) {\n          return entries[ii][1];\n        }\n      }\n      return notSetValue;\n    };\n\n    ArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n      var removed = value === NOT_SET;\n\n      var entries = this.entries;\n      var idx = 0;\n      for (var len = entries.length; idx < len; idx++) {\n        if (is(key, entries[idx][0])) {\n          break;\n        }\n      }\n      var exists = idx < len;\n\n      if (exists ? entries[idx][1] === value : removed) {\n        return this;\n      }\n\n      SetRef(didAlter);\n      (removed || !exists) && SetRef(didChangeSize);\n\n      if (removed && entries.length === 1) {\n        return; // undefined\n      }\n\n      if (!exists && !removed && entries.length >= MAX_ARRAY_MAP_SIZE) {\n        return createNodes(ownerID, entries, key, value);\n      }\n\n      var isEditable = ownerID && ownerID === this.ownerID;\n      var newEntries = isEditable ? entries : arrCopy(entries);\n\n      if (exists) {\n        if (removed) {\n          idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop());\n        } else {\n          newEntries[idx] = [key, value];\n        }\n      } else {\n        newEntries.push([key, value]);\n      }\n\n      if (isEditable) {\n        this.entries = newEntries;\n        return this;\n      }\n\n      return new ArrayMapNode(ownerID, newEntries);\n    };\n\n\n\n\n    function BitmapIndexedNode(ownerID, bitmap, nodes) {\n      this.ownerID = ownerID;\n      this.bitmap = bitmap;\n      this.nodes = nodes;\n    }\n\n    BitmapIndexedNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n      if (keyHash === undefined) {\n        keyHash = hash(key);\n      }\n      var bit = (1 << ((shift === 0 ? keyHash : keyHash >>> shift) & MASK));\n      var bitmap = this.bitmap;\n      return (bitmap & bit) === 0 ? notSetValue :\n        this.nodes[popCount(bitmap & (bit - 1))].get(shift + SHIFT, keyHash, key, notSetValue);\n    };\n\n    BitmapIndexedNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n      if (keyHash === undefined) {\n        keyHash = hash(key);\n      }\n      var keyHashFrag = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n      var bit = 1 << keyHashFrag;\n      var bitmap = this.bitmap;\n      var exists = (bitmap & bit) !== 0;\n\n      if (!exists && value === NOT_SET) {\n        return this;\n      }\n\n      var idx = popCount(bitmap & (bit - 1));\n      var nodes = this.nodes;\n      var node = exists ? nodes[idx] : undefined;\n      var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);\n\n      if (newNode === node) {\n        return this;\n      }\n\n      if (!exists && newNode && nodes.length >= MAX_BITMAP_INDEXED_SIZE) {\n        return expandNodes(ownerID, nodes, bitmap, keyHashFrag, newNode);\n      }\n\n      if (exists && !newNode && nodes.length === 2 && isLeafNode(nodes[idx ^ 1])) {\n        return nodes[idx ^ 1];\n      }\n\n      if (exists && newNode && nodes.length === 1 && isLeafNode(newNode)) {\n        return newNode;\n      }\n\n      var isEditable = ownerID && ownerID === this.ownerID;\n      var newBitmap = exists ? newNode ? bitmap : bitmap ^ bit : bitmap | bit;\n      var newNodes = exists ? newNode ?\n        setIn(nodes, idx, newNode, isEditable) :\n        spliceOut(nodes, idx, isEditable) :\n        spliceIn(nodes, idx, newNode, isEditable);\n\n      if (isEditable) {\n        this.bitmap = newBitmap;\n        this.nodes = newNodes;\n        return this;\n      }\n\n      return new BitmapIndexedNode(ownerID, newBitmap, newNodes);\n    };\n\n\n\n\n    function HashArrayMapNode(ownerID, count, nodes) {\n      this.ownerID = ownerID;\n      this.count = count;\n      this.nodes = nodes;\n    }\n\n    HashArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n      if (keyHash === undefined) {\n        keyHash = hash(key);\n      }\n      var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n      var node = this.nodes[idx];\n      return node ? node.get(shift + SHIFT, keyHash, key, notSetValue) : notSetValue;\n    };\n\n    HashArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n      if (keyHash === undefined) {\n        keyHash = hash(key);\n      }\n      var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n      var removed = value === NOT_SET;\n      var nodes = this.nodes;\n      var node = nodes[idx];\n\n      if (removed && !node) {\n        return this;\n      }\n\n      var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);\n      if (newNode === node) {\n        return this;\n      }\n\n      var newCount = this.count;\n      if (!node) {\n        newCount++;\n      } else if (!newNode) {\n        newCount--;\n        if (newCount < MIN_HASH_ARRAY_MAP_SIZE) {\n          return packNodes(ownerID, nodes, newCount, idx);\n        }\n      }\n\n      var isEditable = ownerID && ownerID === this.ownerID;\n      var newNodes = setIn(nodes, idx, newNode, isEditable);\n\n      if (isEditable) {\n        this.count = newCount;\n        this.nodes = newNodes;\n        return this;\n      }\n\n      return new HashArrayMapNode(ownerID, newCount, newNodes);\n    };\n\n\n\n\n    function HashCollisionNode(ownerID, keyHash, entries) {\n      this.ownerID = ownerID;\n      this.keyHash = keyHash;\n      this.entries = entries;\n    }\n\n    HashCollisionNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n      var entries = this.entries;\n      for (var ii = 0, len = entries.length; ii < len; ii++) {\n        if (is(key, entries[ii][0])) {\n          return entries[ii][1];\n        }\n      }\n      return notSetValue;\n    };\n\n    HashCollisionNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n      if (keyHash === undefined) {\n        keyHash = hash(key);\n      }\n\n      var removed = value === NOT_SET;\n\n      if (keyHash !== this.keyHash) {\n        if (removed) {\n          return this;\n        }\n        SetRef(didAlter);\n        SetRef(didChangeSize);\n        return mergeIntoNode(this, ownerID, shift, keyHash, [key, value]);\n      }\n\n      var entries = this.entries;\n      var idx = 0;\n      for (var len = entries.length; idx < len; idx++) {\n        if (is(key, entries[idx][0])) {\n          break;\n        }\n      }\n      var exists = idx < len;\n\n      if (exists ? entries[idx][1] === value : removed) {\n        return this;\n      }\n\n      SetRef(didAlter);\n      (removed || !exists) && SetRef(didChangeSize);\n\n      if (removed && len === 2) {\n        return new ValueNode(ownerID, this.keyHash, entries[idx ^ 1]);\n      }\n\n      var isEditable = ownerID && ownerID === this.ownerID;\n      var newEntries = isEditable ? entries : arrCopy(entries);\n\n      if (exists) {\n        if (removed) {\n          idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop());\n        } else {\n          newEntries[idx] = [key, value];\n        }\n      } else {\n        newEntries.push([key, value]);\n      }\n\n      if (isEditable) {\n        this.entries = newEntries;\n        return this;\n      }\n\n      return new HashCollisionNode(ownerID, this.keyHash, newEntries);\n    };\n\n\n\n\n    function ValueNode(ownerID, keyHash, entry) {\n      this.ownerID = ownerID;\n      this.keyHash = keyHash;\n      this.entry = entry;\n    }\n\n    ValueNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n      return is(key, this.entry[0]) ? this.entry[1] : notSetValue;\n    };\n\n    ValueNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n      var removed = value === NOT_SET;\n      var keyMatch = is(key, this.entry[0]);\n      if (keyMatch ? value === this.entry[1] : removed) {\n        return this;\n      }\n\n      SetRef(didAlter);\n\n      if (removed) {\n        SetRef(didChangeSize);\n        return; // undefined\n      }\n\n      if (keyMatch) {\n        if (ownerID && ownerID === this.ownerID) {\n          this.entry[1] = value;\n          return this;\n        }\n        return new ValueNode(ownerID, this.keyHash, [key, value]);\n      }\n\n      SetRef(didChangeSize);\n      return mergeIntoNode(this, ownerID, shift, hash(key), [key, value]);\n    };\n\n\n\n  // #pragma Iterators\n\n  ArrayMapNode.prototype.iterate =\n  HashCollisionNode.prototype.iterate = function (fn, reverse) {\n    var entries = this.entries;\n    for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) {\n      if (fn(entries[reverse ? maxIndex - ii : ii]) === false) {\n        return false;\n      }\n    }\n  }\n\n  BitmapIndexedNode.prototype.iterate =\n  HashArrayMapNode.prototype.iterate = function (fn, reverse) {\n    var nodes = this.nodes;\n    for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) {\n      var node = nodes[reverse ? maxIndex - ii : ii];\n      if (node && node.iterate(fn, reverse) === false) {\n        return false;\n      }\n    }\n  }\n\n  ValueNode.prototype.iterate = function (fn, reverse) {\n    return fn(this.entry);\n  }\n\n  createClass(MapIterator, Iterator);\n\n    function MapIterator(map, type, reverse) {\n      this._type = type;\n      this._reverse = reverse;\n      this._stack = map._root && mapIteratorFrame(map._root);\n    }\n\n    MapIterator.prototype.next = function() {\n      var type = this._type;\n      var stack = this._stack;\n      while (stack) {\n        var node = stack.node;\n        var index = stack.index++;\n        var maxIndex;\n        if (node.entry) {\n          if (index === 0) {\n            return mapIteratorValue(type, node.entry);\n          }\n        } else if (node.entries) {\n          maxIndex = node.entries.length - 1;\n          if (index <= maxIndex) {\n            return mapIteratorValue(type, node.entries[this._reverse ? maxIndex - index : index]);\n          }\n        } else {\n          maxIndex = node.nodes.length - 1;\n          if (index <= maxIndex) {\n            var subNode = node.nodes[this._reverse ? maxIndex - index : index];\n            if (subNode) {\n              if (subNode.entry) {\n                return mapIteratorValue(type, subNode.entry);\n              }\n              stack = this._stack = mapIteratorFrame(subNode, stack);\n            }\n            continue;\n          }\n        }\n        stack = this._stack = this._stack.__prev;\n      }\n      return iteratorDone();\n    };\n\n\n  function mapIteratorValue(type, entry) {\n    return iteratorValue(type, entry[0], entry[1]);\n  }\n\n  function mapIteratorFrame(node, prev) {\n    return {\n      node: node,\n      index: 0,\n      __prev: prev\n    };\n  }\n\n  function makeMap(size, root, ownerID, hash) {\n    var map = Object.create(MapPrototype);\n    map.size = size;\n    map._root = root;\n    map.__ownerID = ownerID;\n    map.__hash = hash;\n    map.__altered = false;\n    return map;\n  }\n\n  var EMPTY_MAP;\n  function emptyMap() {\n    return EMPTY_MAP || (EMPTY_MAP = makeMap(0));\n  }\n\n  function updateMap(map, k, v) {\n    var newRoot;\n    var newSize;\n    if (!map._root) {\n      if (v === NOT_SET) {\n        return map;\n      }\n      newSize = 1;\n      newRoot = new ArrayMapNode(map.__ownerID, [[k, v]]);\n    } else {\n      var didChangeSize = MakeRef(CHANGE_LENGTH);\n      var didAlter = MakeRef(DID_ALTER);\n      newRoot = updateNode(map._root, map.__ownerID, 0, undefined, k, v, didChangeSize, didAlter);\n      if (!didAlter.value) {\n        return map;\n      }\n      newSize = map.size + (didChangeSize.value ? v === NOT_SET ? -1 : 1 : 0);\n    }\n    if (map.__ownerID) {\n      map.size = newSize;\n      map._root = newRoot;\n      map.__hash = undefined;\n      map.__altered = true;\n      return map;\n    }\n    return newRoot ? makeMap(newSize, newRoot) : emptyMap();\n  }\n\n  function updateNode(node, ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n    if (!node) {\n      if (value === NOT_SET) {\n        return node;\n      }\n      SetRef(didAlter);\n      SetRef(didChangeSize);\n      return new ValueNode(ownerID, keyHash, [key, value]);\n    }\n    return node.update(ownerID, shift, keyHash, key, value, didChangeSize, didAlter);\n  }\n\n  function isLeafNode(node) {\n    return node.constructor === ValueNode || node.constructor === HashCollisionNode;\n  }\n\n  function mergeIntoNode(node, ownerID, shift, keyHash, entry) {\n    if (node.keyHash === keyHash) {\n      return new HashCollisionNode(ownerID, keyHash, [node.entry, entry]);\n    }\n\n    var idx1 = (shift === 0 ? node.keyHash : node.keyHash >>> shift) & MASK;\n    var idx2 = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n\n    var newNode;\n    var nodes = idx1 === idx2 ?\n      [mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)] :\n      ((newNode = new ValueNode(ownerID, keyHash, entry)), idx1 < idx2 ? [node, newNode] : [newNode, node]);\n\n    return new BitmapIndexedNode(ownerID, (1 << idx1) | (1 << idx2), nodes);\n  }\n\n  function createNodes(ownerID, entries, key, value) {\n    if (!ownerID) {\n      ownerID = new OwnerID();\n    }\n    var node = new ValueNode(ownerID, hash(key), [key, value]);\n    for (var ii = 0; ii < entries.length; ii++) {\n      var entry = entries[ii];\n      node = node.update(ownerID, 0, undefined, entry[0], entry[1]);\n    }\n    return node;\n  }\n\n  function packNodes(ownerID, nodes, count, excluding) {\n    var bitmap = 0;\n    var packedII = 0;\n    var packedNodes = new Array(count);\n    for (var ii = 0, bit = 1, len = nodes.length; ii < len; ii++, bit <<= 1) {\n      var node = nodes[ii];\n      if (node !== undefined && ii !== excluding) {\n        bitmap |= bit;\n        packedNodes[packedII++] = node;\n      }\n    }\n    return new BitmapIndexedNode(ownerID, bitmap, packedNodes);\n  }\n\n  function expandNodes(ownerID, nodes, bitmap, including, node) {\n    var count = 0;\n    var expandedNodes = new Array(SIZE);\n    for (var ii = 0; bitmap !== 0; ii++, bitmap >>>= 1) {\n      expandedNodes[ii] = bitmap & 1 ? nodes[count++] : undefined;\n    }\n    expandedNodes[including] = node;\n    return new HashArrayMapNode(ownerID, count + 1, expandedNodes);\n  }\n\n  function mergeIntoMapWith(map, merger, iterables) {\n    var iters = [];\n    for (var ii = 0; ii < iterables.length; ii++) {\n      var value = iterables[ii];\n      var iter = KeyedIterable(value);\n      if (!isIterable(value)) {\n        iter = iter.map(function(v ) {return fromJS(v)});\n      }\n      iters.push(iter);\n    }\n    return mergeIntoCollectionWith(map, merger, iters);\n  }\n\n  function deepMerger(existing, value, key) {\n    return existing && existing.mergeDeep && isIterable(value) ?\n      existing.mergeDeep(value) :\n      is(existing, value) ? existing : value;\n  }\n\n  function deepMergerWith(merger) {\n    return function(existing, value, key)  {\n      if (existing && existing.mergeDeepWith && isIterable(value)) {\n        return existing.mergeDeepWith(merger, value);\n      }\n      var nextValue = merger(existing, value, key);\n      return is(existing, nextValue) ? existing : nextValue;\n    };\n  }\n\n  function mergeIntoCollectionWith(collection, merger, iters) {\n    iters = iters.filter(function(x ) {return x.size !== 0});\n    if (iters.length === 0) {\n      return collection;\n    }\n    if (collection.size === 0 && !collection.__ownerID && iters.length === 1) {\n      return collection.constructor(iters[0]);\n    }\n    return collection.withMutations(function(collection ) {\n      var mergeIntoMap = merger ?\n        function(value, key)  {\n          collection.update(key, NOT_SET, function(existing )\n            {return existing === NOT_SET ? value : merger(existing, value, key)}\n          );\n        } :\n        function(value, key)  {\n          collection.set(key, value);\n        }\n      for (var ii = 0; ii < iters.length; ii++) {\n        iters[ii].forEach(mergeIntoMap);\n      }\n    });\n  }\n\n  function updateInDeepMap(existing, keyPathIter, notSetValue, updater) {\n    var isNotSet = existing === NOT_SET;\n    var step = keyPathIter.next();\n    if (step.done) {\n      var existingValue = isNotSet ? notSetValue : existing;\n      var newValue = updater(existingValue);\n      return newValue === existingValue ? existing : newValue;\n    }\n    invariant(\n      isNotSet || (existing && existing.set),\n      'invalid keyPath'\n    );\n    var key = step.value;\n    var nextExisting = isNotSet ? NOT_SET : existing.get(key, NOT_SET);\n    var nextUpdated = updateInDeepMap(\n      nextExisting,\n      keyPathIter,\n      notSetValue,\n      updater\n    );\n    return nextUpdated === nextExisting ? existing :\n      nextUpdated === NOT_SET ? existing.remove(key) :\n      (isNotSet ? emptyMap() : existing).set(key, nextUpdated);\n  }\n\n  function popCount(x) {\n    x = x - ((x >> 1) & 0x55555555);\n    x = (x & 0x33333333) + ((x >> 2) & 0x33333333);\n    x = (x + (x >> 4)) & 0x0f0f0f0f;\n    x = x + (x >> 8);\n    x = x + (x >> 16);\n    return x & 0x7f;\n  }\n\n  function setIn(array, idx, val, canEdit) {\n    var newArray = canEdit ? array : arrCopy(array);\n    newArray[idx] = val;\n    return newArray;\n  }\n\n  function spliceIn(array, idx, val, canEdit) {\n    var newLen = array.length + 1;\n    if (canEdit && idx + 1 === newLen) {\n      array[idx] = val;\n      return array;\n    }\n    var newArray = new Array(newLen);\n    var after = 0;\n    for (var ii = 0; ii < newLen; ii++) {\n      if (ii === idx) {\n        newArray[ii] = val;\n        after = -1;\n      } else {\n        newArray[ii] = array[ii + after];\n      }\n    }\n    return newArray;\n  }\n\n  function spliceOut(array, idx, canEdit) {\n    var newLen = array.length - 1;\n    if (canEdit && idx === newLen) {\n      array.pop();\n      return array;\n    }\n    var newArray = new Array(newLen);\n    var after = 0;\n    for (var ii = 0; ii < newLen; ii++) {\n      if (ii === idx) {\n        after = 1;\n      }\n      newArray[ii] = array[ii + after];\n    }\n    return newArray;\n  }\n\n  var MAX_ARRAY_MAP_SIZE = SIZE / 4;\n  var MAX_BITMAP_INDEXED_SIZE = SIZE / 2;\n  var MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4;\n\n  createClass(List, IndexedCollection);\n\n    // @pragma Construction\n\n    function List(value) {\n      var empty = emptyList();\n      if (value === null || value === undefined) {\n        return empty;\n      }\n      if (isList(value)) {\n        return value;\n      }\n      var iter = IndexedIterable(value);\n      var size = iter.size;\n      if (size === 0) {\n        return empty;\n      }\n      assertNotInfinite(size);\n      if (size > 0 && size < SIZE) {\n        return makeList(0, size, SHIFT, null, new VNode(iter.toArray()));\n      }\n      return empty.withMutations(function(list ) {\n        list.setSize(size);\n        iter.forEach(function(v, i)  {return list.set(i, v)});\n      });\n    }\n\n    List.of = function(/*...values*/) {\n      return this(arguments);\n    };\n\n    List.prototype.toString = function() {\n      return this.__toString('List [', ']');\n    };\n\n    // @pragma Access\n\n    List.prototype.get = function(index, notSetValue) {\n      index = wrapIndex(this, index);\n      if (index >= 0 && index < this.size) {\n        index += this._origin;\n        var node = listNodeFor(this, index);\n        return node && node.array[index & MASK];\n      }\n      return notSetValue;\n    };\n\n    // @pragma Modification\n\n    List.prototype.set = function(index, value) {\n      return updateList(this, index, value);\n    };\n\n    List.prototype.remove = function(index) {\n      return !this.has(index) ? this :\n        index === 0 ? this.shift() :\n        index === this.size - 1 ? this.pop() :\n        this.splice(index, 1);\n    };\n\n    List.prototype.insert = function(index, value) {\n      return this.splice(index, 0, value);\n    };\n\n    List.prototype.clear = function() {\n      if (this.size === 0) {\n        return this;\n      }\n      if (this.__ownerID) {\n        this.size = this._origin = this._capacity = 0;\n        this._level = SHIFT;\n        this._root = this._tail = null;\n        this.__hash = undefined;\n        this.__altered = true;\n        return this;\n      }\n      return emptyList();\n    };\n\n    List.prototype.push = function(/*...values*/) {\n      var values = arguments;\n      var oldSize = this.size;\n      return this.withMutations(function(list ) {\n        setListBounds(list, 0, oldSize + values.length);\n        for (var ii = 0; ii < values.length; ii++) {\n          list.set(oldSize + ii, values[ii]);\n        }\n      });\n    };\n\n    List.prototype.pop = function() {\n      return setListBounds(this, 0, -1);\n    };\n\n    List.prototype.unshift = function(/*...values*/) {\n      var values = arguments;\n      return this.withMutations(function(list ) {\n        setListBounds(list, -values.length);\n        for (var ii = 0; ii < values.length; ii++) {\n          list.set(ii, values[ii]);\n        }\n      });\n    };\n\n    List.prototype.shift = function() {\n      return setListBounds(this, 1);\n    };\n\n    // @pragma Composition\n\n    List.prototype.merge = function(/*...iters*/) {\n      return mergeIntoListWith(this, undefined, arguments);\n    };\n\n    List.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n      return mergeIntoListWith(this, merger, iters);\n    };\n\n    List.prototype.mergeDeep = function(/*...iters*/) {\n      return mergeIntoListWith(this, deepMerger, arguments);\n    };\n\n    List.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n      return mergeIntoListWith(this, deepMergerWith(merger), iters);\n    };\n\n    List.prototype.setSize = function(size) {\n      return setListBounds(this, 0, size);\n    };\n\n    // @pragma Iteration\n\n    List.prototype.slice = function(begin, end) {\n      var size = this.size;\n      if (wholeSlice(begin, end, size)) {\n        return this;\n      }\n      return setListBounds(\n        this,\n        resolveBegin(begin, size),\n        resolveEnd(end, size)\n      );\n    };\n\n    List.prototype.__iterator = function(type, reverse) {\n      var index = 0;\n      var values = iterateList(this, reverse);\n      return new Iterator(function()  {\n        var value = values();\n        return value === DONE ?\n          iteratorDone() :\n          iteratorValue(type, index++, value);\n      });\n    };\n\n    List.prototype.__iterate = function(fn, reverse) {\n      var index = 0;\n      var values = iterateList(this, reverse);\n      var value;\n      while ((value = values()) !== DONE) {\n        if (fn(value, index++, this) === false) {\n          break;\n        }\n      }\n      return index;\n    };\n\n    List.prototype.__ensureOwner = function(ownerID) {\n      if (ownerID === this.__ownerID) {\n        return this;\n      }\n      if (!ownerID) {\n        this.__ownerID = ownerID;\n        return this;\n      }\n      return makeList(this._origin, this._capacity, this._level, this._root, this._tail, ownerID, this.__hash);\n    };\n\n\n  function isList(maybeList) {\n    return !!(maybeList && maybeList[IS_LIST_SENTINEL]);\n  }\n\n  List.isList = isList;\n\n  var IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';\n\n  var ListPrototype = List.prototype;\n  ListPrototype[IS_LIST_SENTINEL] = true;\n  ListPrototype[DELETE] = ListPrototype.remove;\n  ListPrototype.setIn = MapPrototype.setIn;\n  ListPrototype.deleteIn =\n  ListPrototype.removeIn = MapPrototype.removeIn;\n  ListPrototype.update = MapPrototype.update;\n  ListPrototype.updateIn = MapPrototype.updateIn;\n  ListPrototype.mergeIn = MapPrototype.mergeIn;\n  ListPrototype.mergeDeepIn = MapPrototype.mergeDeepIn;\n  ListPrototype.withMutations = MapPrototype.withMutations;\n  ListPrototype.asMutable = MapPrototype.asMutable;\n  ListPrototype.asImmutable = MapPrototype.asImmutable;\n  ListPrototype.wasAltered = MapPrototype.wasAltered;\n\n\n\n    function VNode(array, ownerID) {\n      this.array = array;\n      this.ownerID = ownerID;\n    }\n\n    // TODO: seems like these methods are very similar\n\n    VNode.prototype.removeBefore = function(ownerID, level, index) {\n      if (index === level ? 1 << level : 0 || this.array.length === 0) {\n        return this;\n      }\n      var originIndex = (index >>> level) & MASK;\n      if (originIndex >= this.array.length) {\n        return new VNode([], ownerID);\n      }\n      var removingFirst = originIndex === 0;\n      var newChild;\n      if (level > 0) {\n        var oldChild = this.array[originIndex];\n        newChild = oldChild && oldChild.removeBefore(ownerID, level - SHIFT, index);\n        if (newChild === oldChild && removingFirst) {\n          return this;\n        }\n      }\n      if (removingFirst && !newChild) {\n        return this;\n      }\n      var editable = editableVNode(this, ownerID);\n      if (!removingFirst) {\n        for (var ii = 0; ii < originIndex; ii++) {\n          editable.array[ii] = undefined;\n        }\n      }\n      if (newChild) {\n        editable.array[originIndex] = newChild;\n      }\n      return editable;\n    };\n\n    VNode.prototype.removeAfter = function(ownerID, level, index) {\n      if (index === (level ? 1 << level : 0) || this.array.length === 0) {\n        return this;\n      }\n      var sizeIndex = ((index - 1) >>> level) & MASK;\n      if (sizeIndex >= this.array.length) {\n        return this;\n      }\n\n      var newChild;\n      if (level > 0) {\n        var oldChild = this.array[sizeIndex];\n        newChild = oldChild && oldChild.removeAfter(ownerID, level - SHIFT, index);\n        if (newChild === oldChild && sizeIndex === this.array.length - 1) {\n          return this;\n        }\n      }\n\n      var editable = editableVNode(this, ownerID);\n      editable.array.splice(sizeIndex + 1);\n      if (newChild) {\n        editable.array[sizeIndex] = newChild;\n      }\n      return editable;\n    };\n\n\n\n  var DONE = {};\n\n  function iterateList(list, reverse) {\n    var left = list._origin;\n    var right = list._capacity;\n    var tailPos = getTailOffset(right);\n    var tail = list._tail;\n\n    return iterateNodeOrLeaf(list._root, list._level, 0);\n\n    function iterateNodeOrLeaf(node, level, offset) {\n      return level === 0 ?\n        iterateLeaf(node, offset) :\n        iterateNode(node, level, offset);\n    }\n\n    function iterateLeaf(node, offset) {\n      var array = offset === tailPos ? tail && tail.array : node && node.array;\n      var from = offset > left ? 0 : left - offset;\n      var to = right - offset;\n      if (to > SIZE) {\n        to = SIZE;\n      }\n      return function()  {\n        if (from === to) {\n          return DONE;\n        }\n        var idx = reverse ? --to : from++;\n        return array && array[idx];\n      };\n    }\n\n    function iterateNode(node, level, offset) {\n      var values;\n      var array = node && node.array;\n      var from = offset > left ? 0 : (left - offset) >> level;\n      var to = ((right - offset) >> level) + 1;\n      if (to > SIZE) {\n        to = SIZE;\n      }\n      return function()  {\n        do {\n          if (values) {\n            var value = values();\n            if (value !== DONE) {\n              return value;\n            }\n            values = null;\n          }\n          if (from === to) {\n            return DONE;\n          }\n          var idx = reverse ? --to : from++;\n          values = iterateNodeOrLeaf(\n            array && array[idx], level - SHIFT, offset + (idx << level)\n          );\n        } while (true);\n      };\n    }\n  }\n\n  function makeList(origin, capacity, level, root, tail, ownerID, hash) {\n    var list = Object.create(ListPrototype);\n    list.size = capacity - origin;\n    list._origin = origin;\n    list._capacity = capacity;\n    list._level = level;\n    list._root = root;\n    list._tail = tail;\n    list.__ownerID = ownerID;\n    list.__hash = hash;\n    list.__altered = false;\n    return list;\n  }\n\n  var EMPTY_LIST;\n  function emptyList() {\n    return EMPTY_LIST || (EMPTY_LIST = makeList(0, 0, SHIFT));\n  }\n\n  function updateList(list, index, value) {\n    index = wrapIndex(list, index);\n\n    if (index !== index) {\n      return list;\n    }\n\n    if (index >= list.size || index < 0) {\n      return list.withMutations(function(list ) {\n        index < 0 ?\n          setListBounds(list, index).set(0, value) :\n          setListBounds(list, 0, index + 1).set(index, value)\n      });\n    }\n\n    index += list._origin;\n\n    var newTail = list._tail;\n    var newRoot = list._root;\n    var didAlter = MakeRef(DID_ALTER);\n    if (index >= getTailOffset(list._capacity)) {\n      newTail = updateVNode(newTail, list.__ownerID, 0, index, value, didAlter);\n    } else {\n      newRoot = updateVNode(newRoot, list.__ownerID, list._level, index, value, didAlter);\n    }\n\n    if (!didAlter.value) {\n      return list;\n    }\n\n    if (list.__ownerID) {\n      list._root = newRoot;\n      list._tail = newTail;\n      list.__hash = undefined;\n      list.__altered = true;\n      return list;\n    }\n    return makeList(list._origin, list._capacity, list._level, newRoot, newTail);\n  }\n\n  function updateVNode(node, ownerID, level, index, value, didAlter) {\n    var idx = (index >>> level) & MASK;\n    var nodeHas = node && idx < node.array.length;\n    if (!nodeHas && value === undefined) {\n      return node;\n    }\n\n    var newNode;\n\n    if (level > 0) {\n      var lowerNode = node && node.array[idx];\n      var newLowerNode = updateVNode(lowerNode, ownerID, level - SHIFT, index, value, didAlter);\n      if (newLowerNode === lowerNode) {\n        return node;\n      }\n      newNode = editableVNode(node, ownerID);\n      newNode.array[idx] = newLowerNode;\n      return newNode;\n    }\n\n    if (nodeHas && node.array[idx] === value) {\n      return node;\n    }\n\n    SetRef(didAlter);\n\n    newNode = editableVNode(node, ownerID);\n    if (value === undefined && idx === newNode.array.length - 1) {\n      newNode.array.pop();\n    } else {\n      newNode.array[idx] = value;\n    }\n    return newNode;\n  }\n\n  function editableVNode(node, ownerID) {\n    if (ownerID && node && ownerID === node.ownerID) {\n      return node;\n    }\n    return new VNode(node ? node.array.slice() : [], ownerID);\n  }\n\n  function listNodeFor(list, rawIndex) {\n    if (rawIndex >= getTailOffset(list._capacity)) {\n      return list._tail;\n    }\n    if (rawIndex < 1 << (list._level + SHIFT)) {\n      var node = list._root;\n      var level = list._level;\n      while (node && level > 0) {\n        node = node.array[(rawIndex >>> level) & MASK];\n        level -= SHIFT;\n      }\n      return node;\n    }\n  }\n\n  function setListBounds(list, begin, end) {\n    // Sanitize begin & end using this shorthand for ToInt32(argument)\n    // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32\n    if (begin !== undefined) {\n      begin = begin | 0;\n    }\n    if (end !== undefined) {\n      end = end | 0;\n    }\n    var owner = list.__ownerID || new OwnerID();\n    var oldOrigin = list._origin;\n    var oldCapacity = list._capacity;\n    var newOrigin = oldOrigin + begin;\n    var newCapacity = end === undefined ? oldCapacity : end < 0 ? oldCapacity + end : oldOrigin + end;\n    if (newOrigin === oldOrigin && newCapacity === oldCapacity) {\n      return list;\n    }\n\n    // If it's going to end after it starts, it's empty.\n    if (newOrigin >= newCapacity) {\n      return list.clear();\n    }\n\n    var newLevel = list._level;\n    var newRoot = list._root;\n\n    // New origin might need creating a higher root.\n    var offsetShift = 0;\n    while (newOrigin + offsetShift < 0) {\n      newRoot = new VNode(newRoot && newRoot.array.length ? [undefined, newRoot] : [], owner);\n      newLevel += SHIFT;\n      offsetShift += 1 << newLevel;\n    }\n    if (offsetShift) {\n      newOrigin += offsetShift;\n      oldOrigin += offsetShift;\n      newCapacity += offsetShift;\n      oldCapacity += offsetShift;\n    }\n\n    var oldTailOffset = getTailOffset(oldCapacity);\n    var newTailOffset = getTailOffset(newCapacity);\n\n    // New size might need creating a higher root.\n    while (newTailOffset >= 1 << (newLevel + SHIFT)) {\n      newRoot = new VNode(newRoot && newRoot.array.length ? [newRoot] : [], owner);\n      newLevel += SHIFT;\n    }\n\n    // Locate or create the new tail.\n    var oldTail = list._tail;\n    var newTail = newTailOffset < oldTailOffset ?\n      listNodeFor(list, newCapacity - 1) :\n      newTailOffset > oldTailOffset ? new VNode([], owner) : oldTail;\n\n    // Merge Tail into tree.\n    if (oldTail && newTailOffset > oldTailOffset && newOrigin < oldCapacity && oldTail.array.length) {\n      newRoot = editableVNode(newRoot, owner);\n      var node = newRoot;\n      for (var level = newLevel; level > SHIFT; level -= SHIFT) {\n        var idx = (oldTailOffset >>> level) & MASK;\n        node = node.array[idx] = editableVNode(node.array[idx], owner);\n      }\n      node.array[(oldTailOffset >>> SHIFT) & MASK] = oldTail;\n    }\n\n    // If the size has been reduced, there's a chance the tail needs to be trimmed.\n    if (newCapacity < oldCapacity) {\n      newTail = newTail && newTail.removeAfter(owner, 0, newCapacity);\n    }\n\n    // If the new origin is within the tail, then we do not need a root.\n    if (newOrigin >= newTailOffset) {\n      newOrigin -= newTailOffset;\n      newCapacity -= newTailOffset;\n      newLevel = SHIFT;\n      newRoot = null;\n      newTail = newTail && newTail.removeBefore(owner, 0, newOrigin);\n\n    // Otherwise, if the root has been trimmed, garbage collect.\n    } else if (newOrigin > oldOrigin || newTailOffset < oldTailOffset) {\n      offsetShift = 0;\n\n      // Identify the new top root node of the subtree of the old root.\n      while (newRoot) {\n        var beginIndex = (newOrigin >>> newLevel) & MASK;\n        if (beginIndex !== (newTailOffset >>> newLevel) & MASK) {\n          break;\n        }\n        if (beginIndex) {\n          offsetShift += (1 << newLevel) * beginIndex;\n        }\n        newLevel -= SHIFT;\n        newRoot = newRoot.array[beginIndex];\n      }\n\n      // Trim the new sides of the new root.\n      if (newRoot && newOrigin > oldOrigin) {\n        newRoot = newRoot.removeBefore(owner, newLevel, newOrigin - offsetShift);\n      }\n      if (newRoot && newTailOffset < oldTailOffset) {\n        newRoot = newRoot.removeAfter(owner, newLevel, newTailOffset - offsetShift);\n      }\n      if (offsetShift) {\n        newOrigin -= offsetShift;\n        newCapacity -= offsetShift;\n      }\n    }\n\n    if (list.__ownerID) {\n      list.size = newCapacity - newOrigin;\n      list._origin = newOrigin;\n      list._capacity = newCapacity;\n      list._level = newLevel;\n      list._root = newRoot;\n      list._tail = newTail;\n      list.__hash = undefined;\n      list.__altered = true;\n      return list;\n    }\n    return makeList(newOrigin, newCapacity, newLevel, newRoot, newTail);\n  }\n\n  function mergeIntoListWith(list, merger, iterables) {\n    var iters = [];\n    var maxSize = 0;\n    for (var ii = 0; ii < iterables.length; ii++) {\n      var value = iterables[ii];\n      var iter = IndexedIterable(value);\n      if (iter.size > maxSize) {\n        maxSize = iter.size;\n      }\n      if (!isIterable(value)) {\n        iter = iter.map(function(v ) {return fromJS(v)});\n      }\n      iters.push(iter);\n    }\n    if (maxSize > list.size) {\n      list = list.setSize(maxSize);\n    }\n    return mergeIntoCollectionWith(list, merger, iters);\n  }\n\n  function getTailOffset(size) {\n    return size < SIZE ? 0 : (((size - 1) >>> SHIFT) << SHIFT);\n  }\n\n  createClass(OrderedMap, Map);\n\n    // @pragma Construction\n\n    function OrderedMap(value) {\n      return value === null || value === undefined ? emptyOrderedMap() :\n        isOrderedMap(value) ? value :\n        emptyOrderedMap().withMutations(function(map ) {\n          var iter = KeyedIterable(value);\n          assertNotInfinite(iter.size);\n          iter.forEach(function(v, k)  {return map.set(k, v)});\n        });\n    }\n\n    OrderedMap.of = function(/*...values*/) {\n      return this(arguments);\n    };\n\n    OrderedMap.prototype.toString = function() {\n      return this.__toString('OrderedMap {', '}');\n    };\n\n    // @pragma Access\n\n    OrderedMap.prototype.get = function(k, notSetValue) {\n      var index = this._map.get(k);\n      return index !== undefined ? this._list.get(index)[1] : notSetValue;\n    };\n\n    // @pragma Modification\n\n    OrderedMap.prototype.clear = function() {\n      if (this.size === 0) {\n        return this;\n      }\n      if (this.__ownerID) {\n        this.size = 0;\n        this._map.clear();\n        this._list.clear();\n        return this;\n      }\n      return emptyOrderedMap();\n    };\n\n    OrderedMap.prototype.set = function(k, v) {\n      return updateOrderedMap(this, k, v);\n    };\n\n    OrderedMap.prototype.remove = function(k) {\n      return updateOrderedMap(this, k, NOT_SET);\n    };\n\n    OrderedMap.prototype.wasAltered = function() {\n      return this._map.wasAltered() || this._list.wasAltered();\n    };\n\n    OrderedMap.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n      return this._list.__iterate(\n        function(entry ) {return entry && fn(entry[1], entry[0], this$0)},\n        reverse\n      );\n    };\n\n    OrderedMap.prototype.__iterator = function(type, reverse) {\n      return this._list.fromEntrySeq().__iterator(type, reverse);\n    };\n\n    OrderedMap.prototype.__ensureOwner = function(ownerID) {\n      if (ownerID === this.__ownerID) {\n        return this;\n      }\n      var newMap = this._map.__ensureOwner(ownerID);\n      var newList = this._list.__ensureOwner(ownerID);\n      if (!ownerID) {\n        this.__ownerID = ownerID;\n        this._map = newMap;\n        this._list = newList;\n        return this;\n      }\n      return makeOrderedMap(newMap, newList, ownerID, this.__hash);\n    };\n\n\n  function isOrderedMap(maybeOrderedMap) {\n    return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap);\n  }\n\n  OrderedMap.isOrderedMap = isOrderedMap;\n\n  OrderedMap.prototype[IS_ORDERED_SENTINEL] = true;\n  OrderedMap.prototype[DELETE] = OrderedMap.prototype.remove;\n\n\n\n  function makeOrderedMap(map, list, ownerID, hash) {\n    var omap = Object.create(OrderedMap.prototype);\n    omap.size = map ? map.size : 0;\n    omap._map = map;\n    omap._list = list;\n    omap.__ownerID = ownerID;\n    omap.__hash = hash;\n    return omap;\n  }\n\n  var EMPTY_ORDERED_MAP;\n  function emptyOrderedMap() {\n    return EMPTY_ORDERED_MAP || (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList()));\n  }\n\n  function updateOrderedMap(omap, k, v) {\n    var map = omap._map;\n    var list = omap._list;\n    var i = map.get(k);\n    var has = i !== undefined;\n    var newMap;\n    var newList;\n    if (v === NOT_SET) { // removed\n      if (!has) {\n        return omap;\n      }\n      if (list.size >= SIZE && list.size >= map.size * 2) {\n        newList = list.filter(function(entry, idx)  {return entry !== undefined && i !== idx});\n        newMap = newList.toKeyedSeq().map(function(entry ) {return entry[0]}).flip().toMap();\n        if (omap.__ownerID) {\n          newMap.__ownerID = newList.__ownerID = omap.__ownerID;\n        }\n      } else {\n        newMap = map.remove(k);\n        newList = i === list.size - 1 ? list.pop() : list.set(i, undefined);\n      }\n    } else {\n      if (has) {\n        if (v === list.get(i)[1]) {\n          return omap;\n        }\n        newMap = map;\n        newList = list.set(i, [k, v]);\n      } else {\n        newMap = map.set(k, list.size);\n        newList = list.set(list.size, [k, v]);\n      }\n    }\n    if (omap.__ownerID) {\n      omap.size = newMap.size;\n      omap._map = newMap;\n      omap._list = newList;\n      omap.__hash = undefined;\n      return omap;\n    }\n    return makeOrderedMap(newMap, newList);\n  }\n\n  createClass(ToKeyedSequence, KeyedSeq);\n    function ToKeyedSequence(indexed, useKeys) {\n      this._iter = indexed;\n      this._useKeys = useKeys;\n      this.size = indexed.size;\n    }\n\n    ToKeyedSequence.prototype.get = function(key, notSetValue) {\n      return this._iter.get(key, notSetValue);\n    };\n\n    ToKeyedSequence.prototype.has = function(key) {\n      return this._iter.has(key);\n    };\n\n    ToKeyedSequence.prototype.valueSeq = function() {\n      return this._iter.valueSeq();\n    };\n\n    ToKeyedSequence.prototype.reverse = function() {var this$0 = this;\n      var reversedSequence = reverseFactory(this, true);\n      if (!this._useKeys) {\n        reversedSequence.valueSeq = function()  {return this$0._iter.toSeq().reverse()};\n      }\n      return reversedSequence;\n    };\n\n    ToKeyedSequence.prototype.map = function(mapper, context) {var this$0 = this;\n      var mappedSequence = mapFactory(this, mapper, context);\n      if (!this._useKeys) {\n        mappedSequence.valueSeq = function()  {return this$0._iter.toSeq().map(mapper, context)};\n      }\n      return mappedSequence;\n    };\n\n    ToKeyedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n      var ii;\n      return this._iter.__iterate(\n        this._useKeys ?\n          function(v, k)  {return fn(v, k, this$0)} :\n          ((ii = reverse ? resolveSize(this) : 0),\n            function(v ) {return fn(v, reverse ? --ii : ii++, this$0)}),\n        reverse\n      );\n    };\n\n    ToKeyedSequence.prototype.__iterator = function(type, reverse) {\n      if (this._useKeys) {\n        return this._iter.__iterator(type, reverse);\n      }\n      var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n      var ii = reverse ? resolveSize(this) : 0;\n      return new Iterator(function()  {\n        var step = iterator.next();\n        return step.done ? step :\n          iteratorValue(type, reverse ? --ii : ii++, step.value, step);\n      });\n    };\n\n  ToKeyedSequence.prototype[IS_ORDERED_SENTINEL] = true;\n\n\n  createClass(ToIndexedSequence, IndexedSeq);\n    function ToIndexedSequence(iter) {\n      this._iter = iter;\n      this.size = iter.size;\n    }\n\n    ToIndexedSequence.prototype.includes = function(value) {\n      return this._iter.includes(value);\n    };\n\n    ToIndexedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n      var iterations = 0;\n      return this._iter.__iterate(function(v ) {return fn(v, iterations++, this$0)}, reverse);\n    };\n\n    ToIndexedSequence.prototype.__iterator = function(type, reverse) {\n      var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n      var iterations = 0;\n      return new Iterator(function()  {\n        var step = iterator.next();\n        return step.done ? step :\n          iteratorValue(type, iterations++, step.value, step)\n      });\n    };\n\n\n\n  createClass(ToSetSequence, SetSeq);\n    function ToSetSequence(iter) {\n      this._iter = iter;\n      this.size = iter.size;\n    }\n\n    ToSetSequence.prototype.has = function(key) {\n      return this._iter.includes(key);\n    };\n\n    ToSetSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n      return this._iter.__iterate(function(v ) {return fn(v, v, this$0)}, reverse);\n    };\n\n    ToSetSequence.prototype.__iterator = function(type, reverse) {\n      var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n      return new Iterator(function()  {\n        var step = iterator.next();\n        return step.done ? step :\n          iteratorValue(type, step.value, step.value, step);\n      });\n    };\n\n\n\n  createClass(FromEntriesSequence, KeyedSeq);\n    function FromEntriesSequence(entries) {\n      this._iter = entries;\n      this.size = entries.size;\n    }\n\n    FromEntriesSequence.prototype.entrySeq = function() {\n      return this._iter.toSeq();\n    };\n\n    FromEntriesSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n      return this._iter.__iterate(function(entry ) {\n        // Check if entry exists first so array access doesn't throw for holes\n        // in the parent iteration.\n        if (entry) {\n          validateEntry(entry);\n          var indexedIterable = isIterable(entry);\n          return fn(\n            indexedIterable ? entry.get(1) : entry[1],\n            indexedIterable ? entry.get(0) : entry[0],\n            this$0\n          );\n        }\n      }, reverse);\n    };\n\n    FromEntriesSequence.prototype.__iterator = function(type, reverse) {\n      var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n      return new Iterator(function()  {\n        while (true) {\n          var step = iterator.next();\n          if (step.done) {\n            return step;\n          }\n          var entry = step.value;\n          // Check if entry exists first so array access doesn't throw for holes\n          // in the parent iteration.\n          if (entry) {\n            validateEntry(entry);\n            var indexedIterable = isIterable(entry);\n            return iteratorValue(\n              type,\n              indexedIterable ? entry.get(0) : entry[0],\n              indexedIterable ? entry.get(1) : entry[1],\n              step\n            );\n          }\n        }\n      });\n    };\n\n\n  ToIndexedSequence.prototype.cacheResult =\n  ToKeyedSequence.prototype.cacheResult =\n  ToSetSequence.prototype.cacheResult =\n  FromEntriesSequence.prototype.cacheResult =\n    cacheResultThrough;\n\n\n  function flipFactory(iterable) {\n    var flipSequence = makeSequence(iterable);\n    flipSequence._iter = iterable;\n    flipSequence.size = iterable.size;\n    flipSequence.flip = function()  {return iterable};\n    flipSequence.reverse = function () {\n      var reversedSequence = iterable.reverse.apply(this); // super.reverse()\n      reversedSequence.flip = function()  {return iterable.reverse()};\n      return reversedSequence;\n    };\n    flipSequence.has = function(key ) {return iterable.includes(key)};\n    flipSequence.includes = function(key ) {return iterable.has(key)};\n    flipSequence.cacheResult = cacheResultThrough;\n    flipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n      return iterable.__iterate(function(v, k)  {return fn(k, v, this$0) !== false}, reverse);\n    }\n    flipSequence.__iteratorUncached = function(type, reverse) {\n      if (type === ITERATE_ENTRIES) {\n        var iterator = iterable.__iterator(type, reverse);\n        return new Iterator(function()  {\n          var step = iterator.next();\n          if (!step.done) {\n            var k = step.value[0];\n            step.value[0] = step.value[1];\n            step.value[1] = k;\n          }\n          return step;\n        });\n      }\n      return iterable.__iterator(\n        type === ITERATE_VALUES ? ITERATE_KEYS : ITERATE_VALUES,\n        reverse\n      );\n    }\n    return flipSequence;\n  }\n\n\n  function mapFactory(iterable, mapper, context) {\n    var mappedSequence = makeSequence(iterable);\n    mappedSequence.size = iterable.size;\n    mappedSequence.has = function(key ) {return iterable.has(key)};\n    mappedSequence.get = function(key, notSetValue)  {\n      var v = iterable.get(key, NOT_SET);\n      return v === NOT_SET ?\n        notSetValue :\n        mapper.call(context, v, key, iterable);\n    };\n    mappedSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n      return iterable.__iterate(\n        function(v, k, c)  {return fn(mapper.call(context, v, k, c), k, this$0) !== false},\n        reverse\n      );\n    }\n    mappedSequence.__iteratorUncached = function (type, reverse) {\n      var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n      return new Iterator(function()  {\n        var step = iterator.next();\n        if (step.done) {\n          return step;\n        }\n        var entry = step.value;\n        var key = entry[0];\n        return iteratorValue(\n          type,\n          key,\n          mapper.call(context, entry[1], key, iterable),\n          step\n        );\n      });\n    }\n    return mappedSequence;\n  }\n\n\n  function reverseFactory(iterable, useKeys) {\n    var reversedSequence = makeSequence(iterable);\n    reversedSequence._iter = iterable;\n    reversedSequence.size = iterable.size;\n    reversedSequence.reverse = function()  {return iterable};\n    if (iterable.flip) {\n      reversedSequence.flip = function () {\n        var flipSequence = flipFactory(iterable);\n        flipSequence.reverse = function()  {return iterable.flip()};\n        return flipSequence;\n      };\n    }\n    reversedSequence.get = function(key, notSetValue) \n      {return iterable.get(useKeys ? key : -1 - key, notSetValue)};\n    reversedSequence.has = function(key )\n      {return iterable.has(useKeys ? key : -1 - key)};\n    reversedSequence.includes = function(value ) {return iterable.includes(value)};\n    reversedSequence.cacheResult = cacheResultThrough;\n    reversedSequence.__iterate = function (fn, reverse) {var this$0 = this;\n      return iterable.__iterate(function(v, k)  {return fn(v, k, this$0)}, !reverse);\n    };\n    reversedSequence.__iterator =\n      function(type, reverse)  {return iterable.__iterator(type, !reverse)};\n    return reversedSequence;\n  }\n\n\n  function filterFactory(iterable, predicate, context, useKeys) {\n    var filterSequence = makeSequence(iterable);\n    if (useKeys) {\n      filterSequence.has = function(key ) {\n        var v = iterable.get(key, NOT_SET);\n        return v !== NOT_SET && !!predicate.call(context, v, key, iterable);\n      };\n      filterSequence.get = function(key, notSetValue)  {\n        var v = iterable.get(key, NOT_SET);\n        return v !== NOT_SET && predicate.call(context, v, key, iterable) ?\n          v : notSetValue;\n      };\n    }\n    filterSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n      var iterations = 0;\n      iterable.__iterate(function(v, k, c)  {\n        if (predicate.call(context, v, k, c)) {\n          iterations++;\n          return fn(v, useKeys ? k : iterations - 1, this$0);\n        }\n      }, reverse);\n      return iterations;\n    };\n    filterSequence.__iteratorUncached = function (type, reverse) {\n      var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n      var iterations = 0;\n      return new Iterator(function()  {\n        while (true) {\n          var step = iterator.next();\n          if (step.done) {\n            return step;\n          }\n          var entry = step.value;\n          var key = entry[0];\n          var value = entry[1];\n          if (predicate.call(context, value, key, iterable)) {\n            return iteratorValue(type, useKeys ? key : iterations++, value, step);\n          }\n        }\n      });\n    }\n    return filterSequence;\n  }\n\n\n  function countByFactory(iterable, grouper, context) {\n    var groups = Map().asMutable();\n    iterable.__iterate(function(v, k)  {\n      groups.update(\n        grouper.call(context, v, k, iterable),\n        0,\n        function(a ) {return a + 1}\n      );\n    });\n    return groups.asImmutable();\n  }\n\n\n  function groupByFactory(iterable, grouper, context) {\n    var isKeyedIter = isKeyed(iterable);\n    var groups = (isOrdered(iterable) ? OrderedMap() : Map()).asMutable();\n    iterable.__iterate(function(v, k)  {\n      groups.update(\n        grouper.call(context, v, k, iterable),\n        function(a ) {return (a = a || [], a.push(isKeyedIter ? [k, v] : v), a)}\n      );\n    });\n    var coerce = iterableClass(iterable);\n    return groups.map(function(arr ) {return reify(iterable, coerce(arr))});\n  }\n\n\n  function sliceFactory(iterable, begin, end, useKeys) {\n    var originalSize = iterable.size;\n\n    // Sanitize begin & end using this shorthand for ToInt32(argument)\n    // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32\n    if (begin !== undefined) {\n      begin = begin | 0;\n    }\n    if (end !== undefined) {\n      if (end === Infinity) {\n        end = originalSize;\n      } else {\n        end = end | 0;\n      }\n    }\n\n    if (wholeSlice(begin, end, originalSize)) {\n      return iterable;\n    }\n\n    var resolvedBegin = resolveBegin(begin, originalSize);\n    var resolvedEnd = resolveEnd(end, originalSize);\n\n    // begin or end will be NaN if they were provided as negative numbers and\n    // this iterable's size is unknown. In that case, cache first so there is\n    // a known size and these do not resolve to NaN.\n    if (resolvedBegin !== resolvedBegin || resolvedEnd !== resolvedEnd) {\n      return sliceFactory(iterable.toSeq().cacheResult(), begin, end, useKeys);\n    }\n\n    // Note: resolvedEnd is undefined when the original sequence's length is\n    // unknown and this slice did not supply an end and should contain all\n    // elements after resolvedBegin.\n    // In that case, resolvedSize will be NaN and sliceSize will remain undefined.\n    var resolvedSize = resolvedEnd - resolvedBegin;\n    var sliceSize;\n    if (resolvedSize === resolvedSize) {\n      sliceSize = resolvedSize < 0 ? 0 : resolvedSize;\n    }\n\n    var sliceSeq = makeSequence(iterable);\n\n    // If iterable.size is undefined, the size of the realized sliceSeq is\n    // unknown at this point unless the number of items to slice is 0\n    sliceSeq.size = sliceSize === 0 ? sliceSize : iterable.size && sliceSize || undefined;\n\n    if (!useKeys && isSeq(iterable) && sliceSize >= 0) {\n      sliceSeq.get = function (index, notSetValue) {\n        index = wrapIndex(this, index);\n        return index >= 0 && index < sliceSize ?\n          iterable.get(index + resolvedBegin, notSetValue) :\n          notSetValue;\n      }\n    }\n\n    sliceSeq.__iterateUncached = function(fn, reverse) {var this$0 = this;\n      if (sliceSize === 0) {\n        return 0;\n      }\n      if (reverse) {\n        return this.cacheResult().__iterate(fn, reverse);\n      }\n      var skipped = 0;\n      var isSkipping = true;\n      var iterations = 0;\n      iterable.__iterate(function(v, k)  {\n        if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) {\n          iterations++;\n          return fn(v, useKeys ? k : iterations - 1, this$0) !== false &&\n                 iterations !== sliceSize;\n        }\n      });\n      return iterations;\n    };\n\n    sliceSeq.__iteratorUncached = function(type, reverse) {\n      if (sliceSize !== 0 && reverse) {\n        return this.cacheResult().__iterator(type, reverse);\n      }\n      // Don't bother instantiating parent iterator if taking 0.\n      var iterator = sliceSize !== 0 && iterable.__iterator(type, reverse);\n      var skipped = 0;\n      var iterations = 0;\n      return new Iterator(function()  {\n        while (skipped++ < resolvedBegin) {\n          iterator.next();\n        }\n        if (++iterations > sliceSize) {\n          return iteratorDone();\n        }\n        var step = iterator.next();\n        if (useKeys || type === ITERATE_VALUES) {\n          return step;\n        } else if (type === ITERATE_KEYS) {\n          return iteratorValue(type, iterations - 1, undefined, step);\n        } else {\n          return iteratorValue(type, iterations - 1, step.value[1], step);\n        }\n      });\n    }\n\n    return sliceSeq;\n  }\n\n\n  function takeWhileFactory(iterable, predicate, context) {\n    var takeSequence = makeSequence(iterable);\n    takeSequence.__iterateUncached = function(fn, reverse) {var this$0 = this;\n      if (reverse) {\n        return this.cacheResult().__iterate(fn, reverse);\n      }\n      var iterations = 0;\n      iterable.__iterate(function(v, k, c) \n        {return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$0)}\n      );\n      return iterations;\n    };\n    takeSequence.__iteratorUncached = function(type, reverse) {var this$0 = this;\n      if (reverse) {\n        return this.cacheResult().__iterator(type, reverse);\n      }\n      var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n      var iterating = true;\n      return new Iterator(function()  {\n        if (!iterating) {\n          return iteratorDone();\n        }\n        var step = iterator.next();\n        if (step.done) {\n          return step;\n        }\n        var entry = step.value;\n        var k = entry[0];\n        var v = entry[1];\n        if (!predicate.call(context, v, k, this$0)) {\n          iterating = false;\n          return iteratorDone();\n        }\n        return type === ITERATE_ENTRIES ? step :\n          iteratorValue(type, k, v, step);\n      });\n    };\n    return takeSequence;\n  }\n\n\n  function skipWhileFactory(iterable, predicate, context, useKeys) {\n    var skipSequence = makeSequence(iterable);\n    skipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n      if (reverse) {\n        return this.cacheResult().__iterate(fn, reverse);\n      }\n      var isSkipping = true;\n      var iterations = 0;\n      iterable.__iterate(function(v, k, c)  {\n        if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) {\n          iterations++;\n          return fn(v, useKeys ? k : iterations - 1, this$0);\n        }\n      });\n      return iterations;\n    };\n    skipSequence.__iteratorUncached = function(type, reverse) {var this$0 = this;\n      if (reverse) {\n        return this.cacheResult().__iterator(type, reverse);\n      }\n      var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n      var skipping = true;\n      var iterations = 0;\n      return new Iterator(function()  {\n        var step, k, v;\n        do {\n          step = iterator.next();\n          if (step.done) {\n            if (useKeys || type === ITERATE_VALUES) {\n              return step;\n            } else if (type === ITERATE_KEYS) {\n              return iteratorValue(type, iterations++, undefined, step);\n            } else {\n              return iteratorValue(type, iterations++, step.value[1], step);\n            }\n          }\n          var entry = step.value;\n          k = entry[0];\n          v = entry[1];\n          skipping && (skipping = predicate.call(context, v, k, this$0));\n        } while (skipping);\n        return type === ITERATE_ENTRIES ? step :\n          iteratorValue(type, k, v, step);\n      });\n    };\n    return skipSequence;\n  }\n\n\n  function concatFactory(iterable, values) {\n    var isKeyedIterable = isKeyed(iterable);\n    var iters = [iterable].concat(values).map(function(v ) {\n      if (!isIterable(v)) {\n        v = isKeyedIterable ?\n          keyedSeqFromValue(v) :\n          indexedSeqFromValue(Array.isArray(v) ? v : [v]);\n      } else if (isKeyedIterable) {\n        v = KeyedIterable(v);\n      }\n      return v;\n    }).filter(function(v ) {return v.size !== 0});\n\n    if (iters.length === 0) {\n      return iterable;\n    }\n\n    if (iters.length === 1) {\n      var singleton = iters[0];\n      if (singleton === iterable ||\n          isKeyedIterable && isKeyed(singleton) ||\n          isIndexed(iterable) && isIndexed(singleton)) {\n        return singleton;\n      }\n    }\n\n    var concatSeq = new ArraySeq(iters);\n    if (isKeyedIterable) {\n      concatSeq = concatSeq.toKeyedSeq();\n    } else if (!isIndexed(iterable)) {\n      concatSeq = concatSeq.toSetSeq();\n    }\n    concatSeq = concatSeq.flatten(true);\n    concatSeq.size = iters.reduce(\n      function(sum, seq)  {\n        if (sum !== undefined) {\n          var size = seq.size;\n          if (size !== undefined) {\n            return sum + size;\n          }\n        }\n      },\n      0\n    );\n    return concatSeq;\n  }\n\n\n  function flattenFactory(iterable, depth, useKeys) {\n    var flatSequence = makeSequence(iterable);\n    flatSequence.__iterateUncached = function(fn, reverse) {\n      var iterations = 0;\n      var stopped = false;\n      function flatDeep(iter, currentDepth) {var this$0 = this;\n        iter.__iterate(function(v, k)  {\n          if ((!depth || currentDepth < depth) && isIterable(v)) {\n            flatDeep(v, currentDepth + 1);\n          } else if (fn(v, useKeys ? k : iterations++, this$0) === false) {\n            stopped = true;\n          }\n          return !stopped;\n        }, reverse);\n      }\n      flatDeep(iterable, 0);\n      return iterations;\n    }\n    flatSequence.__iteratorUncached = function(type, reverse) {\n      var iterator = iterable.__iterator(type, reverse);\n      var stack = [];\n      var iterations = 0;\n      return new Iterator(function()  {\n        while (iterator) {\n          var step = iterator.next();\n          if (step.done !== false) {\n            iterator = stack.pop();\n            continue;\n          }\n          var v = step.value;\n          if (type === ITERATE_ENTRIES) {\n            v = v[1];\n          }\n          if ((!depth || stack.length < depth) && isIterable(v)) {\n            stack.push(iterator);\n            iterator = v.__iterator(type, reverse);\n          } else {\n            return useKeys ? step : iteratorValue(type, iterations++, v, step);\n          }\n        }\n        return iteratorDone();\n      });\n    }\n    return flatSequence;\n  }\n\n\n  function flatMapFactory(iterable, mapper, context) {\n    var coerce = iterableClass(iterable);\n    return iterable.toSeq().map(\n      function(v, k)  {return coerce(mapper.call(context, v, k, iterable))}\n    ).flatten(true);\n  }\n\n\n  function interposeFactory(iterable, separator) {\n    var interposedSequence = makeSequence(iterable);\n    interposedSequence.size = iterable.size && iterable.size * 2 -1;\n    interposedSequence.__iterateUncached = function(fn, reverse) {var this$0 = this;\n      var iterations = 0;\n      iterable.__iterate(function(v, k) \n        {return (!iterations || fn(separator, iterations++, this$0) !== false) &&\n        fn(v, iterations++, this$0) !== false},\n        reverse\n      );\n      return iterations;\n    };\n    interposedSequence.__iteratorUncached = function(type, reverse) {\n      var iterator = iterable.__iterator(ITERATE_VALUES, reverse);\n      var iterations = 0;\n      var step;\n      return new Iterator(function()  {\n        if (!step || iterations % 2) {\n          step = iterator.next();\n          if (step.done) {\n            return step;\n          }\n        }\n        return iterations % 2 ?\n          iteratorValue(type, iterations++, separator) :\n          iteratorValue(type, iterations++, step.value, step);\n      });\n    };\n    return interposedSequence;\n  }\n\n\n  function sortFactory(iterable, comparator, mapper) {\n    if (!comparator) {\n      comparator = defaultComparator;\n    }\n    var isKeyedIterable = isKeyed(iterable);\n    var index = 0;\n    var entries = iterable.toSeq().map(\n      function(v, k)  {return [k, v, index++, mapper ? mapper(v, k, iterable) : v]}\n    ).toArray();\n    entries.sort(function(a, b)  {return comparator(a[3], b[3]) || a[2] - b[2]}).forEach(\n      isKeyedIterable ?\n      function(v, i)  { entries[i].length = 2; } :\n      function(v, i)  { entries[i] = v[1]; }\n    );\n    return isKeyedIterable ? KeyedSeq(entries) :\n      isIndexed(iterable) ? IndexedSeq(entries) :\n      SetSeq(entries);\n  }\n\n\n  function maxFactory(iterable, comparator, mapper) {\n    if (!comparator) {\n      comparator = defaultComparator;\n    }\n    if (mapper) {\n      var entry = iterable.toSeq()\n        .map(function(v, k)  {return [v, mapper(v, k, iterable)]})\n        .reduce(function(a, b)  {return maxCompare(comparator, a[1], b[1]) ? b : a});\n      return entry && entry[0];\n    } else {\n      return iterable.reduce(function(a, b)  {return maxCompare(comparator, a, b) ? b : a});\n    }\n  }\n\n  function maxCompare(comparator, a, b) {\n    var comp = comparator(b, a);\n    // b is considered the new max if the comparator declares them equal, but\n    // they are not equal and b is in fact a nullish value.\n    return (comp === 0 && b !== a && (b === undefined || b === null || b !== b)) || comp > 0;\n  }\n\n\n  function zipWithFactory(keyIter, zipper, iters) {\n    var zipSequence = makeSequence(keyIter);\n    zipSequence.size = new ArraySeq(iters).map(function(i ) {return i.size}).min();\n    // Note: this a generic base implementation of __iterate in terms of\n    // __iterator which may be more generically useful in the future.\n    zipSequence.__iterate = function(fn, reverse) {\n      /* generic:\n      var iterator = this.__iterator(ITERATE_ENTRIES, reverse);\n      var step;\n      var iterations = 0;\n      while (!(step = iterator.next()).done) {\n        iterations++;\n        if (fn(step.value[1], step.value[0], this) === false) {\n          break;\n        }\n      }\n      return iterations;\n      */\n      // indexed:\n      var iterator = this.__iterator(ITERATE_VALUES, reverse);\n      var step;\n      var iterations = 0;\n      while (!(step = iterator.next()).done) {\n        if (fn(step.value, iterations++, this) === false) {\n          break;\n        }\n      }\n      return iterations;\n    };\n    zipSequence.__iteratorUncached = function(type, reverse) {\n      var iterators = iters.map(function(i )\n        {return (i = Iterable(i), getIterator(reverse ? i.reverse() : i))}\n      );\n      var iterations = 0;\n      var isDone = false;\n      return new Iterator(function()  {\n        var steps;\n        if (!isDone) {\n          steps = iterators.map(function(i ) {return i.next()});\n          isDone = steps.some(function(s ) {return s.done});\n        }\n        if (isDone) {\n          return iteratorDone();\n        }\n        return iteratorValue(\n          type,\n          iterations++,\n          zipper.apply(null, steps.map(function(s ) {return s.value}))\n        );\n      });\n    };\n    return zipSequence\n  }\n\n\n  // #pragma Helper Functions\n\n  function reify(iter, seq) {\n    return isSeq(iter) ? seq : iter.constructor(seq);\n  }\n\n  function validateEntry(entry) {\n    if (entry !== Object(entry)) {\n      throw new TypeError('Expected [K, V] tuple: ' + entry);\n    }\n  }\n\n  function resolveSize(iter) {\n    assertNotInfinite(iter.size);\n    return ensureSize(iter);\n  }\n\n  function iterableClass(iterable) {\n    return isKeyed(iterable) ? KeyedIterable :\n      isIndexed(iterable) ? IndexedIterable :\n      SetIterable;\n  }\n\n  function makeSequence(iterable) {\n    return Object.create(\n      (\n        isKeyed(iterable) ? KeyedSeq :\n        isIndexed(iterable) ? IndexedSeq :\n        SetSeq\n      ).prototype\n    );\n  }\n\n  function cacheResultThrough() {\n    if (this._iter.cacheResult) {\n      this._iter.cacheResult();\n      this.size = this._iter.size;\n      return this;\n    } else {\n      return Seq.prototype.cacheResult.call(this);\n    }\n  }\n\n  function defaultComparator(a, b) {\n    return a > b ? 1 : a < b ? -1 : 0;\n  }\n\n  function forceIterator(keyPath) {\n    var iter = getIterator(keyPath);\n    if (!iter) {\n      // Array might not be iterable in this environment, so we need a fallback\n      // to our wrapped type.\n      if (!isArrayLike(keyPath)) {\n        throw new TypeError('Expected iterable or array-like: ' + keyPath);\n      }\n      iter = getIterator(Iterable(keyPath));\n    }\n    return iter;\n  }\n\n  createClass(Record, KeyedCollection);\n\n    function Record(defaultValues, name) {\n      var hasInitialized;\n\n      var RecordType = function Record(values) {\n        if (values instanceof RecordType) {\n          return values;\n        }\n        if (!(this instanceof RecordType)) {\n          return new RecordType(values);\n        }\n        if (!hasInitialized) {\n          hasInitialized = true;\n          var keys = Object.keys(defaultValues);\n          setProps(RecordTypePrototype, keys);\n          RecordTypePrototype.size = keys.length;\n          RecordTypePrototype._name = name;\n          RecordTypePrototype._keys = keys;\n          RecordTypePrototype._defaultValues = defaultValues;\n        }\n        this._map = Map(values);\n      };\n\n      var RecordTypePrototype = RecordType.prototype = Object.create(RecordPrototype);\n      RecordTypePrototype.constructor = RecordType;\n\n      return RecordType;\n    }\n\n    Record.prototype.toString = function() {\n      return this.__toString(recordName(this) + ' {', '}');\n    };\n\n    // @pragma Access\n\n    Record.prototype.has = function(k) {\n      return this._defaultValues.hasOwnProperty(k);\n    };\n\n    Record.prototype.get = function(k, notSetValue) {\n      if (!this.has(k)) {\n        return notSetValue;\n      }\n      var defaultVal = this._defaultValues[k];\n      return this._map ? this._map.get(k, defaultVal) : defaultVal;\n    };\n\n    // @pragma Modification\n\n    Record.prototype.clear = function() {\n      if (this.__ownerID) {\n        this._map && this._map.clear();\n        return this;\n      }\n      var RecordType = this.constructor;\n      return RecordType._empty || (RecordType._empty = makeRecord(this, emptyMap()));\n    };\n\n    Record.prototype.set = function(k, v) {\n      if (!this.has(k)) {\n        throw new Error('Cannot set unknown key \"' + k + '\" on ' + recordName(this));\n      }\n      if (this._map && !this._map.has(k)) {\n        var defaultVal = this._defaultValues[k];\n        if (v === defaultVal) {\n          return this;\n        }\n      }\n      var newMap = this._map && this._map.set(k, v);\n      if (this.__ownerID || newMap === this._map) {\n        return this;\n      }\n      return makeRecord(this, newMap);\n    };\n\n    Record.prototype.remove = function(k) {\n      if (!this.has(k)) {\n        return this;\n      }\n      var newMap = this._map && this._map.remove(k);\n      if (this.__ownerID || newMap === this._map) {\n        return this;\n      }\n      return makeRecord(this, newMap);\n    };\n\n    Record.prototype.wasAltered = function() {\n      return this._map.wasAltered();\n    };\n\n    Record.prototype.__iterator = function(type, reverse) {var this$0 = this;\n      return KeyedIterable(this._defaultValues).map(function(_, k)  {return this$0.get(k)}).__iterator(type, reverse);\n    };\n\n    Record.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n      return KeyedIterable(this._defaultValues).map(function(_, k)  {return this$0.get(k)}).__iterate(fn, reverse);\n    };\n\n    Record.prototype.__ensureOwner = function(ownerID) {\n      if (ownerID === this.__ownerID) {\n        return this;\n      }\n      var newMap = this._map && this._map.__ensureOwner(ownerID);\n      if (!ownerID) {\n        this.__ownerID = ownerID;\n        this._map = newMap;\n        return this;\n      }\n      return makeRecord(this, newMap, ownerID);\n    };\n\n\n  var RecordPrototype = Record.prototype;\n  RecordPrototype[DELETE] = RecordPrototype.remove;\n  RecordPrototype.deleteIn =\n  RecordPrototype.removeIn = MapPrototype.removeIn;\n  RecordPrototype.merge = MapPrototype.merge;\n  RecordPrototype.mergeWith = MapPrototype.mergeWith;\n  RecordPrototype.mergeIn = MapPrototype.mergeIn;\n  RecordPrototype.mergeDeep = MapPrototype.mergeDeep;\n  RecordPrototype.mergeDeepWith = MapPrototype.mergeDeepWith;\n  RecordPrototype.mergeDeepIn = MapPrototype.mergeDeepIn;\n  RecordPrototype.setIn = MapPrototype.setIn;\n  RecordPrototype.update = MapPrototype.update;\n  RecordPrototype.updateIn = MapPrototype.updateIn;\n  RecordPrototype.withMutations = MapPrototype.withMutations;\n  RecordPrototype.asMutable = MapPrototype.asMutable;\n  RecordPrototype.asImmutable = MapPrototype.asImmutable;\n\n\n  function makeRecord(likeRecord, map, ownerID) {\n    var record = Object.create(Object.getPrototypeOf(likeRecord));\n    record._map = map;\n    record.__ownerID = ownerID;\n    return record;\n  }\n\n  function recordName(record) {\n    return record._name || record.constructor.name || 'Record';\n  }\n\n  function setProps(prototype, names) {\n    try {\n      names.forEach(setProp.bind(undefined, prototype));\n    } catch (error) {\n      // Object.defineProperty failed. Probably IE8.\n    }\n  }\n\n  function setProp(prototype, name) {\n    Object.defineProperty(prototype, name, {\n      get: function() {\n        return this.get(name);\n      },\n      set: function(value) {\n        invariant(this.__ownerID, 'Cannot set on an immutable record.');\n        this.set(name, value);\n      }\n    });\n  }\n\n  createClass(Set, SetCollection);\n\n    // @pragma Construction\n\n    function Set(value) {\n      return value === null || value === undefined ? emptySet() :\n        isSet(value) && !isOrdered(value) ? value :\n        emptySet().withMutations(function(set ) {\n          var iter = SetIterable(value);\n          assertNotInfinite(iter.size);\n          iter.forEach(function(v ) {return set.add(v)});\n        });\n    }\n\n    Set.of = function(/*...values*/) {\n      return this(arguments);\n    };\n\n    Set.fromKeys = function(value) {\n      return this(KeyedIterable(value).keySeq());\n    };\n\n    Set.prototype.toString = function() {\n      return this.__toString('Set {', '}');\n    };\n\n    // @pragma Access\n\n    Set.prototype.has = function(value) {\n      return this._map.has(value);\n    };\n\n    // @pragma Modification\n\n    Set.prototype.add = function(value) {\n      return updateSet(this, this._map.set(value, true));\n    };\n\n    Set.prototype.remove = function(value) {\n      return updateSet(this, this._map.remove(value));\n    };\n\n    Set.prototype.clear = function() {\n      return updateSet(this, this._map.clear());\n    };\n\n    // @pragma Composition\n\n    Set.prototype.union = function() {var iters = SLICE$0.call(arguments, 0);\n      iters = iters.filter(function(x ) {return x.size !== 0});\n      if (iters.length === 0) {\n        return this;\n      }\n      if (this.size === 0 && !this.__ownerID && iters.length === 1) {\n        return this.constructor(iters[0]);\n      }\n      return this.withMutations(function(set ) {\n        for (var ii = 0; ii < iters.length; ii++) {\n          SetIterable(iters[ii]).forEach(function(value ) {return set.add(value)});\n        }\n      });\n    };\n\n    Set.prototype.intersect = function() {var iters = SLICE$0.call(arguments, 0);\n      if (iters.length === 0) {\n        return this;\n      }\n      iters = iters.map(function(iter ) {return SetIterable(iter)});\n      var originalSet = this;\n      return this.withMutations(function(set ) {\n        originalSet.forEach(function(value ) {\n          if (!iters.every(function(iter ) {return iter.includes(value)})) {\n            set.remove(value);\n          }\n        });\n      });\n    };\n\n    Set.prototype.subtract = function() {var iters = SLICE$0.call(arguments, 0);\n      if (iters.length === 0) {\n        return this;\n      }\n      iters = iters.map(function(iter ) {return SetIterable(iter)});\n      var originalSet = this;\n      return this.withMutations(function(set ) {\n        originalSet.forEach(function(value ) {\n          if (iters.some(function(iter ) {return iter.includes(value)})) {\n            set.remove(value);\n          }\n        });\n      });\n    };\n\n    Set.prototype.merge = function() {\n      return this.union.apply(this, arguments);\n    };\n\n    Set.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n      return this.union.apply(this, iters);\n    };\n\n    Set.prototype.sort = function(comparator) {\n      // Late binding\n      return OrderedSet(sortFactory(this, comparator));\n    };\n\n    Set.prototype.sortBy = function(mapper, comparator) {\n      // Late binding\n      return OrderedSet(sortFactory(this, comparator, mapper));\n    };\n\n    Set.prototype.wasAltered = function() {\n      return this._map.wasAltered();\n    };\n\n    Set.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n      return this._map.__iterate(function(_, k)  {return fn(k, k, this$0)}, reverse);\n    };\n\n    Set.prototype.__iterator = function(type, reverse) {\n      return this._map.map(function(_, k)  {return k}).__iterator(type, reverse);\n    };\n\n    Set.prototype.__ensureOwner = function(ownerID) {\n      if (ownerID === this.__ownerID) {\n        return this;\n      }\n      var newMap = this._map.__ensureOwner(ownerID);\n      if (!ownerID) {\n        this.__ownerID = ownerID;\n        this._map = newMap;\n        return this;\n      }\n      return this.__make(newMap, ownerID);\n    };\n\n\n  function isSet(maybeSet) {\n    return !!(maybeSet && maybeSet[IS_SET_SENTINEL]);\n  }\n\n  Set.isSet = isSet;\n\n  var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';\n\n  var SetPrototype = Set.prototype;\n  SetPrototype[IS_SET_SENTINEL] = true;\n  SetPrototype[DELETE] = SetPrototype.remove;\n  SetPrototype.mergeDeep = SetPrototype.merge;\n  SetPrototype.mergeDeepWith = SetPrototype.mergeWith;\n  SetPrototype.withMutations = MapPrototype.withMutations;\n  SetPrototype.asMutable = MapPrototype.asMutable;\n  SetPrototype.asImmutable = MapPrototype.asImmutable;\n\n  SetPrototype.__empty = emptySet;\n  SetPrototype.__make = makeSet;\n\n  function updateSet(set, newMap) {\n    if (set.__ownerID) {\n      set.size = newMap.size;\n      set._map = newMap;\n      return set;\n    }\n    return newMap === set._map ? set :\n      newMap.size === 0 ? set.__empty() :\n      set.__make(newMap);\n  }\n\n  function makeSet(map, ownerID) {\n    var set = Object.create(SetPrototype);\n    set.size = map ? map.size : 0;\n    set._map = map;\n    set.__ownerID = ownerID;\n    return set;\n  }\n\n  var EMPTY_SET;\n  function emptySet() {\n    return EMPTY_SET || (EMPTY_SET = makeSet(emptyMap()));\n  }\n\n  createClass(OrderedSet, Set);\n\n    // @pragma Construction\n\n    function OrderedSet(value) {\n      return value === null || value === undefined ? emptyOrderedSet() :\n        isOrderedSet(value) ? value :\n        emptyOrderedSet().withMutations(function(set ) {\n          var iter = SetIterable(value);\n          assertNotInfinite(iter.size);\n          iter.forEach(function(v ) {return set.add(v)});\n        });\n    }\n\n    OrderedSet.of = function(/*...values*/) {\n      return this(arguments);\n    };\n\n    OrderedSet.fromKeys = function(value) {\n      return this(KeyedIterable(value).keySeq());\n    };\n\n    OrderedSet.prototype.toString = function() {\n      return this.__toString('OrderedSet {', '}');\n    };\n\n\n  function isOrderedSet(maybeOrderedSet) {\n    return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet);\n  }\n\n  OrderedSet.isOrderedSet = isOrderedSet;\n\n  var OrderedSetPrototype = OrderedSet.prototype;\n  OrderedSetPrototype[IS_ORDERED_SENTINEL] = true;\n\n  OrderedSetPrototype.__empty = emptyOrderedSet;\n  OrderedSetPrototype.__make = makeOrderedSet;\n\n  function makeOrderedSet(map, ownerID) {\n    var set = Object.create(OrderedSetPrototype);\n    set.size = map ? map.size : 0;\n    set._map = map;\n    set.__ownerID = ownerID;\n    return set;\n  }\n\n  var EMPTY_ORDERED_SET;\n  function emptyOrderedSet() {\n    return EMPTY_ORDERED_SET || (EMPTY_ORDERED_SET = makeOrderedSet(emptyOrderedMap()));\n  }\n\n  createClass(Stack, IndexedCollection);\n\n    // @pragma Construction\n\n    function Stack(value) {\n      return value === null || value === undefined ? emptyStack() :\n        isStack(value) ? value :\n        emptyStack().unshiftAll(value);\n    }\n\n    Stack.of = function(/*...values*/) {\n      return this(arguments);\n    };\n\n    Stack.prototype.toString = function() {\n      return this.__toString('Stack [', ']');\n    };\n\n    // @pragma Access\n\n    Stack.prototype.get = function(index, notSetValue) {\n      var head = this._head;\n      index = wrapIndex(this, index);\n      while (head && index--) {\n        head = head.next;\n      }\n      return head ? head.value : notSetValue;\n    };\n\n    Stack.prototype.peek = function() {\n      return this._head && this._head.value;\n    };\n\n    // @pragma Modification\n\n    Stack.prototype.push = function(/*...values*/) {\n      if (arguments.length === 0) {\n        return this;\n      }\n      var newSize = this.size + arguments.length;\n      var head = this._head;\n      for (var ii = arguments.length - 1; ii >= 0; ii--) {\n        head = {\n          value: arguments[ii],\n          next: head\n        };\n      }\n      if (this.__ownerID) {\n        this.size = newSize;\n        this._head = head;\n        this.__hash = undefined;\n        this.__altered = true;\n        return this;\n      }\n      return makeStack(newSize, head);\n    };\n\n    Stack.prototype.pushAll = function(iter) {\n      iter = IndexedIterable(iter);\n      if (iter.size === 0) {\n        return this;\n      }\n      assertNotInfinite(iter.size);\n      var newSize = this.size;\n      var head = this._head;\n      iter.reverse().forEach(function(value ) {\n        newSize++;\n        head = {\n          value: value,\n          next: head\n        };\n      });\n      if (this.__ownerID) {\n        this.size = newSize;\n        this._head = head;\n        this.__hash = undefined;\n        this.__altered = true;\n        return this;\n      }\n      return makeStack(newSize, head);\n    };\n\n    Stack.prototype.pop = function() {\n      return this.slice(1);\n    };\n\n    Stack.prototype.unshift = function(/*...values*/) {\n      return this.push.apply(this, arguments);\n    };\n\n    Stack.prototype.unshiftAll = function(iter) {\n      return this.pushAll(iter);\n    };\n\n    Stack.prototype.shift = function() {\n      return this.pop.apply(this, arguments);\n    };\n\n    Stack.prototype.clear = function() {\n      if (this.size === 0) {\n        return this;\n      }\n      if (this.__ownerID) {\n        this.size = 0;\n        this._head = undefined;\n        this.__hash = undefined;\n        this.__altered = true;\n        return this;\n      }\n      return emptyStack();\n    };\n\n    Stack.prototype.slice = function(begin, end) {\n      if (wholeSlice(begin, end, this.size)) {\n        return this;\n      }\n      var resolvedBegin = resolveBegin(begin, this.size);\n      var resolvedEnd = resolveEnd(end, this.size);\n      if (resolvedEnd !== this.size) {\n        // super.slice(begin, end);\n        return IndexedCollection.prototype.slice.call(this, begin, end);\n      }\n      var newSize = this.size - resolvedBegin;\n      var head = this._head;\n      while (resolvedBegin--) {\n        head = head.next;\n      }\n      if (this.__ownerID) {\n        this.size = newSize;\n        this._head = head;\n        this.__hash = undefined;\n        this.__altered = true;\n        return this;\n      }\n      return makeStack(newSize, head);\n    };\n\n    // @pragma Mutability\n\n    Stack.prototype.__ensureOwner = function(ownerID) {\n      if (ownerID === this.__ownerID) {\n        return this;\n      }\n      if (!ownerID) {\n        this.__ownerID = ownerID;\n        this.__altered = false;\n        return this;\n      }\n      return makeStack(this.size, this._head, ownerID, this.__hash);\n    };\n\n    // @pragma Iteration\n\n    Stack.prototype.__iterate = function(fn, reverse) {\n      if (reverse) {\n        return this.reverse().__iterate(fn);\n      }\n      var iterations = 0;\n      var node = this._head;\n      while (node) {\n        if (fn(node.value, iterations++, this) === false) {\n          break;\n        }\n        node = node.next;\n      }\n      return iterations;\n    };\n\n    Stack.prototype.__iterator = function(type, reverse) {\n      if (reverse) {\n        return this.reverse().__iterator(type);\n      }\n      var iterations = 0;\n      var node = this._head;\n      return new Iterator(function()  {\n        if (node) {\n          var value = node.value;\n          node = node.next;\n          return iteratorValue(type, iterations++, value);\n        }\n        return iteratorDone();\n      });\n    };\n\n\n  function isStack(maybeStack) {\n    return !!(maybeStack && maybeStack[IS_STACK_SENTINEL]);\n  }\n\n  Stack.isStack = isStack;\n\n  var IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';\n\n  var StackPrototype = Stack.prototype;\n  StackPrototype[IS_STACK_SENTINEL] = true;\n  StackPrototype.withMutations = MapPrototype.withMutations;\n  StackPrototype.asMutable = MapPrototype.asMutable;\n  StackPrototype.asImmutable = MapPrototype.asImmutable;\n  StackPrototype.wasAltered = MapPrototype.wasAltered;\n\n\n  function makeStack(size, head, ownerID, hash) {\n    var map = Object.create(StackPrototype);\n    map.size = size;\n    map._head = head;\n    map.__ownerID = ownerID;\n    map.__hash = hash;\n    map.__altered = false;\n    return map;\n  }\n\n  var EMPTY_STACK;\n  function emptyStack() {\n    return EMPTY_STACK || (EMPTY_STACK = makeStack(0));\n  }\n\n  /**\n   * Contributes additional methods to a constructor\n   */\n  function mixin(ctor, methods) {\n    var keyCopier = function(key ) { ctor.prototype[key] = methods[key]; };\n    Object.keys(methods).forEach(keyCopier);\n    Object.getOwnPropertySymbols &&\n      Object.getOwnPropertySymbols(methods).forEach(keyCopier);\n    return ctor;\n  }\n\n  function isProtoKey(key) {\n    return (\n      typeof key === 'string' && (key === '__proto__' || key === 'constructor')\n    );\n  }\n\n  Iterable.Iterator = Iterator;\n\n  mixin(Iterable, {\n\n    // ### Conversion to other types\n\n    toArray: function() {\n      assertNotInfinite(this.size);\n      var array = new Array(this.size || 0);\n      this.valueSeq().__iterate(function(v, i)  { array[i] = v; });\n      return array;\n    },\n\n    toIndexedSeq: function() {\n      return new ToIndexedSequence(this);\n    },\n\n    toJS: function() {\n      return this.toSeq().map(\n        function(value ) {return value && typeof value.toJS === 'function' ? value.toJS() : value}\n      ).__toJS();\n    },\n\n    toJSON: function() {\n      return this.toSeq().map(\n        function(value ) {return value && typeof value.toJSON === 'function' ? value.toJSON() : value}\n      ).__toJS();\n    },\n\n    toKeyedSeq: function() {\n      return new ToKeyedSequence(this, true);\n    },\n\n    toMap: function() {\n      // Use Late Binding here to solve the circular dependency.\n      return Map(this.toKeyedSeq());\n    },\n\n    toObject: function() {\n      assertNotInfinite(this.size);\n      var object = {};\n      this.__iterate(function(v, k)  {\n        if (isProtoKey(k)) {\n          return;\n        }\n        \n        object[k] = v;\n      });\n      return object;\n    },\n\n    toOrderedMap: function() {\n      // Use Late Binding here to solve the circular dependency.\n      return OrderedMap(this.toKeyedSeq());\n    },\n\n    toOrderedSet: function() {\n      // Use Late Binding here to solve the circular dependency.\n      return OrderedSet(isKeyed(this) ? this.valueSeq() : this);\n    },\n\n    toSet: function() {\n      // Use Late Binding here to solve the circular dependency.\n      return Set(isKeyed(this) ? this.valueSeq() : this);\n    },\n\n    toSetSeq: function() {\n      return new ToSetSequence(this);\n    },\n\n    toSeq: function() {\n      return isIndexed(this) ? this.toIndexedSeq() :\n        isKeyed(this) ? this.toKeyedSeq() :\n        this.toSetSeq();\n    },\n\n    toStack: function() {\n      // Use Late Binding here to solve the circular dependency.\n      return Stack(isKeyed(this) ? this.valueSeq() : this);\n    },\n\n    toList: function() {\n      // Use Late Binding here to solve the circular dependency.\n      return List(isKeyed(this) ? this.valueSeq() : this);\n    },\n\n\n    // ### Common JavaScript methods and properties\n\n    toString: function() {\n      return '[Iterable]';\n    },\n\n    __toString: function(head, tail) {\n      if (this.size === 0) {\n        return head + tail;\n      }\n      return head + ' ' + this.toSeq().map(this.__toStringMapper).join(', ') + ' ' + tail;\n    },\n\n\n    // ### ES6 Collection methods (ES6 Array and Map)\n\n    concat: function() {var values = SLICE$0.call(arguments, 0);\n      return reify(this, concatFactory(this, values));\n    },\n\n    includes: function(searchValue) {\n      return this.some(function(value ) {return is(value, searchValue)});\n    },\n\n    entries: function() {\n      return this.__iterator(ITERATE_ENTRIES);\n    },\n\n    every: function(predicate, context) {\n      assertNotInfinite(this.size);\n      var returnValue = true;\n      this.__iterate(function(v, k, c)  {\n        if (!predicate.call(context, v, k, c)) {\n          returnValue = false;\n          return false;\n        }\n      });\n      return returnValue;\n    },\n\n    filter: function(predicate, context) {\n      return reify(this, filterFactory(this, predicate, context, true));\n    },\n\n    find: function(predicate, context, notSetValue) {\n      var entry = this.findEntry(predicate, context);\n      return entry ? entry[1] : notSetValue;\n    },\n\n    forEach: function(sideEffect, context) {\n      assertNotInfinite(this.size);\n      return this.__iterate(context ? sideEffect.bind(context) : sideEffect);\n    },\n\n    join: function(separator) {\n      assertNotInfinite(this.size);\n      separator = separator !== undefined ? '' + separator : ',';\n      var joined = '';\n      var isFirst = true;\n      this.__iterate(function(v ) {\n        isFirst ? (isFirst = false) : (joined += separator);\n        joined += v !== null && v !== undefined ? v.toString() : '';\n      });\n      return joined;\n    },\n\n    keys: function() {\n      return this.__iterator(ITERATE_KEYS);\n    },\n\n    map: function(mapper, context) {\n      return reify(this, mapFactory(this, mapper, context));\n    },\n\n    reduce: function(reducer, initialReduction, context) {\n      assertNotInfinite(this.size);\n      var reduction;\n      var useFirst;\n      if (arguments.length < 2) {\n        useFirst = true;\n      } else {\n        reduction = initialReduction;\n      }\n      this.__iterate(function(v, k, c)  {\n        if (useFirst) {\n          useFirst = false;\n          reduction = v;\n        } else {\n          reduction = reducer.call(context, reduction, v, k, c);\n        }\n      });\n      return reduction;\n    },\n\n    reduceRight: function(reducer, initialReduction, context) {\n      var reversed = this.toKeyedSeq().reverse();\n      return reversed.reduce.apply(reversed, arguments);\n    },\n\n    reverse: function() {\n      return reify(this, reverseFactory(this, true));\n    },\n\n    slice: function(begin, end) {\n      return reify(this, sliceFactory(this, begin, end, true));\n    },\n\n    some: function(predicate, context) {\n      return !this.every(not(predicate), context);\n    },\n\n    sort: function(comparator) {\n      return reify(this, sortFactory(this, comparator));\n    },\n\n    values: function() {\n      return this.__iterator(ITERATE_VALUES);\n    },\n\n\n    // ### More sequential methods\n\n    butLast: function() {\n      return this.slice(0, -1);\n    },\n\n    isEmpty: function() {\n      return this.size !== undefined ? this.size === 0 : !this.some(function()  {return true});\n    },\n\n    count: function(predicate, context) {\n      return ensureSize(\n        predicate ? this.toSeq().filter(predicate, context) : this\n      );\n    },\n\n    countBy: function(grouper, context) {\n      return countByFactory(this, grouper, context);\n    },\n\n    equals: function(other) {\n      return deepEqual(this, other);\n    },\n\n    entrySeq: function() {\n      var iterable = this;\n      if (iterable._cache) {\n        // We cache as an entries array, so we can just return the cache!\n        return new ArraySeq(iterable._cache);\n      }\n      var entriesSequence = iterable.toSeq().map(entryMapper).toIndexedSeq();\n      entriesSequence.fromEntrySeq = function()  {return iterable.toSeq()};\n      return entriesSequence;\n    },\n\n    filterNot: function(predicate, context) {\n      return this.filter(not(predicate), context);\n    },\n\n    findEntry: function(predicate, context, notSetValue) {\n      var found = notSetValue;\n      this.__iterate(function(v, k, c)  {\n        if (predicate.call(context, v, k, c)) {\n          found = [k, v];\n          return false;\n        }\n      });\n      return found;\n    },\n\n    findKey: function(predicate, context) {\n      var entry = this.findEntry(predicate, context);\n      return entry && entry[0];\n    },\n\n    findLast: function(predicate, context, notSetValue) {\n      return this.toKeyedSeq().reverse().find(predicate, context, notSetValue);\n    },\n\n    findLastEntry: function(predicate, context, notSetValue) {\n      return this.toKeyedSeq().reverse().findEntry(predicate, context, notSetValue);\n    },\n\n    findLastKey: function(predicate, context) {\n      return this.toKeyedSeq().reverse().findKey(predicate, context);\n    },\n\n    first: function() {\n      return this.find(returnTrue);\n    },\n\n    flatMap: function(mapper, context) {\n      return reify(this, flatMapFactory(this, mapper, context));\n    },\n\n    flatten: function(depth) {\n      return reify(this, flattenFactory(this, depth, true));\n    },\n\n    fromEntrySeq: function() {\n      return new FromEntriesSequence(this);\n    },\n\n    get: function(searchKey, notSetValue) {\n      return this.find(function(_, key)  {return is(key, searchKey)}, undefined, notSetValue);\n    },\n\n    getIn: function(searchKeyPath, notSetValue) {\n      var nested = this;\n      // Note: in an ES6 environment, we would prefer:\n      // for (var key of searchKeyPath) {\n      var iter = forceIterator(searchKeyPath);\n      var step;\n      while (!(step = iter.next()).done) {\n        var key = step.value;\n        nested = nested && nested.get ? nested.get(key, NOT_SET) : NOT_SET;\n        if (nested === NOT_SET) {\n          return notSetValue;\n        }\n      }\n      return nested;\n    },\n\n    groupBy: function(grouper, context) {\n      return groupByFactory(this, grouper, context);\n    },\n\n    has: function(searchKey) {\n      return this.get(searchKey, NOT_SET) !== NOT_SET;\n    },\n\n    hasIn: function(searchKeyPath) {\n      return this.getIn(searchKeyPath, NOT_SET) !== NOT_SET;\n    },\n\n    isSubset: function(iter) {\n      iter = typeof iter.includes === 'function' ? iter : Iterable(iter);\n      return this.every(function(value ) {return iter.includes(value)});\n    },\n\n    isSuperset: function(iter) {\n      iter = typeof iter.isSubset === 'function' ? iter : Iterable(iter);\n      return iter.isSubset(this);\n    },\n\n    keyOf: function(searchValue) {\n      return this.findKey(function(value ) {return is(value, searchValue)});\n    },\n\n    keySeq: function() {\n      return this.toSeq().map(keyMapper).toIndexedSeq();\n    },\n\n    last: function() {\n      return this.toSeq().reverse().first();\n    },\n\n    lastKeyOf: function(searchValue) {\n      return this.toKeyedSeq().reverse().keyOf(searchValue);\n    },\n\n    max: function(comparator) {\n      return maxFactory(this, comparator);\n    },\n\n    maxBy: function(mapper, comparator) {\n      return maxFactory(this, comparator, mapper);\n    },\n\n    min: function(comparator) {\n      return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator);\n    },\n\n    minBy: function(mapper, comparator) {\n      return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator, mapper);\n    },\n\n    rest: function() {\n      return this.slice(1);\n    },\n\n    skip: function(amount) {\n      return this.slice(Math.max(0, amount));\n    },\n\n    skipLast: function(amount) {\n      return reify(this, this.toSeq().reverse().skip(amount).reverse());\n    },\n\n    skipWhile: function(predicate, context) {\n      return reify(this, skipWhileFactory(this, predicate, context, true));\n    },\n\n    skipUntil: function(predicate, context) {\n      return this.skipWhile(not(predicate), context);\n    },\n\n    sortBy: function(mapper, comparator) {\n      return reify(this, sortFactory(this, comparator, mapper));\n    },\n\n    take: function(amount) {\n      return this.slice(0, Math.max(0, amount));\n    },\n\n    takeLast: function(amount) {\n      return reify(this, this.toSeq().reverse().take(amount).reverse());\n    },\n\n    takeWhile: function(predicate, context) {\n      return reify(this, takeWhileFactory(this, predicate, context));\n    },\n\n    takeUntil: function(predicate, context) {\n      return this.takeWhile(not(predicate), context);\n    },\n\n    valueSeq: function() {\n      return this.toIndexedSeq();\n    },\n\n\n    // ### Hashable Object\n\n    hashCode: function() {\n      return this.__hash || (this.__hash = hashIterable(this));\n    }\n\n\n    // ### Internal\n\n    // abstract __iterate(fn, reverse)\n\n    // abstract __iterator(type, reverse)\n  });\n\n  // var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';\n  // var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';\n  // var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@';\n  // var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';\n\n  var IterablePrototype = Iterable.prototype;\n  IterablePrototype[IS_ITERABLE_SENTINEL] = true;\n  IterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.values;\n  IterablePrototype.__toJS = IterablePrototype.toArray;\n  IterablePrototype.__toStringMapper = quoteString;\n  IterablePrototype.inspect =\n  IterablePrototype.toSource = function() { return this.toString(); };\n  IterablePrototype.chain = IterablePrototype.flatMap;\n  IterablePrototype.contains = IterablePrototype.includes;\n\n  mixin(KeyedIterable, {\n\n    // ### More sequential methods\n\n    flip: function() {\n      return reify(this, flipFactory(this));\n    },\n\n    mapEntries: function(mapper, context) {var this$0 = this;\n      var iterations = 0;\n      return reify(this,\n        this.toSeq().map(\n          function(v, k)  {return mapper.call(context, [k, v], iterations++, this$0)}\n        ).fromEntrySeq()\n      );\n    },\n\n    mapKeys: function(mapper, context) {var this$0 = this;\n      return reify(this,\n        this.toSeq().flip().map(\n          function(k, v)  {return mapper.call(context, k, v, this$0)}\n        ).flip()\n      );\n    }\n\n  });\n\n  var KeyedIterablePrototype = KeyedIterable.prototype;\n  KeyedIterablePrototype[IS_KEYED_SENTINEL] = true;\n  KeyedIterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.entries;\n  KeyedIterablePrototype.__toJS = IterablePrototype.toObject;\n  KeyedIterablePrototype.__toStringMapper = function(v, k)  {return JSON.stringify(k) + ': ' + quoteString(v)};\n\n\n\n  mixin(IndexedIterable, {\n\n    // ### Conversion to other types\n\n    toKeyedSeq: function() {\n      return new ToKeyedSequence(this, false);\n    },\n\n\n    // ### ES6 Collection methods (ES6 Array and Map)\n\n    filter: function(predicate, context) {\n      return reify(this, filterFactory(this, predicate, context, false));\n    },\n\n    findIndex: function(predicate, context) {\n      var entry = this.findEntry(predicate, context);\n      return entry ? entry[0] : -1;\n    },\n\n    indexOf: function(searchValue) {\n      var key = this.keyOf(searchValue);\n      return key === undefined ? -1 : key;\n    },\n\n    lastIndexOf: function(searchValue) {\n      var key = this.lastKeyOf(searchValue);\n      return key === undefined ? -1 : key;\n    },\n\n    reverse: function() {\n      return reify(this, reverseFactory(this, false));\n    },\n\n    slice: function(begin, end) {\n      return reify(this, sliceFactory(this, begin, end, false));\n    },\n\n    splice: function(index, removeNum /*, ...values*/) {\n      var numArgs = arguments.length;\n      removeNum = Math.max(removeNum | 0, 0);\n      if (numArgs === 0 || (numArgs === 2 && !removeNum)) {\n        return this;\n      }\n      // If index is negative, it should resolve relative to the size of the\n      // collection. However size may be expensive to compute if not cached, so\n      // only call count() if the number is in fact negative.\n      index = resolveBegin(index, index < 0 ? this.count() : this.size);\n      var spliced = this.slice(0, index);\n      return reify(\n        this,\n        numArgs === 1 ?\n          spliced :\n          spliced.concat(arrCopy(arguments, 2), this.slice(index + removeNum))\n      );\n    },\n\n\n    // ### More collection methods\n\n    findLastIndex: function(predicate, context) {\n      var entry = this.findLastEntry(predicate, context);\n      return entry ? entry[0] : -1;\n    },\n\n    first: function() {\n      return this.get(0);\n    },\n\n    flatten: function(depth) {\n      return reify(this, flattenFactory(this, depth, false));\n    },\n\n    get: function(index, notSetValue) {\n      index = wrapIndex(this, index);\n      return (index < 0 || (this.size === Infinity ||\n          (this.size !== undefined && index > this.size))) ?\n        notSetValue :\n        this.find(function(_, key)  {return key === index}, undefined, notSetValue);\n    },\n\n    has: function(index) {\n      index = wrapIndex(this, index);\n      return index >= 0 && (this.size !== undefined ?\n        this.size === Infinity || index < this.size :\n        this.indexOf(index) !== -1\n      );\n    },\n\n    interpose: function(separator) {\n      return reify(this, interposeFactory(this, separator));\n    },\n\n    interleave: function(/*...iterables*/) {\n      var iterables = [this].concat(arrCopy(arguments));\n      var zipped = zipWithFactory(this.toSeq(), IndexedSeq.of, iterables);\n      var interleaved = zipped.flatten(true);\n      if (zipped.size) {\n        interleaved.size = zipped.size * iterables.length;\n      }\n      return reify(this, interleaved);\n    },\n\n    keySeq: function() {\n      return Range(0, this.size);\n    },\n\n    last: function() {\n      return this.get(-1);\n    },\n\n    skipWhile: function(predicate, context) {\n      return reify(this, skipWhileFactory(this, predicate, context, false));\n    },\n\n    zip: function(/*, ...iterables */) {\n      var iterables = [this].concat(arrCopy(arguments));\n      return reify(this, zipWithFactory(this, defaultZipper, iterables));\n    },\n\n    zipWith: function(zipper/*, ...iterables */) {\n      var iterables = arrCopy(arguments);\n      iterables[0] = this;\n      return reify(this, zipWithFactory(this, zipper, iterables));\n    }\n\n  });\n\n  IndexedIterable.prototype[IS_INDEXED_SENTINEL] = true;\n  IndexedIterable.prototype[IS_ORDERED_SENTINEL] = true;\n\n\n\n  mixin(SetIterable, {\n\n    // ### ES6 Collection methods (ES6 Array and Map)\n\n    get: function(value, notSetValue) {\n      return this.has(value) ? value : notSetValue;\n    },\n\n    includes: function(value) {\n      return this.has(value);\n    },\n\n\n    // ### More sequential methods\n\n    keySeq: function() {\n      return this.valueSeq();\n    }\n\n  });\n\n  SetIterable.prototype.has = IterablePrototype.includes;\n  SetIterable.prototype.contains = SetIterable.prototype.includes;\n\n\n  // Mixin subclasses\n\n  mixin(KeyedSeq, KeyedIterable.prototype);\n  mixin(IndexedSeq, IndexedIterable.prototype);\n  mixin(SetSeq, SetIterable.prototype);\n\n  mixin(KeyedCollection, KeyedIterable.prototype);\n  mixin(IndexedCollection, IndexedIterable.prototype);\n  mixin(SetCollection, SetIterable.prototype);\n\n\n  // #pragma Helper functions\n\n  function keyMapper(v, k) {\n    return k;\n  }\n\n  function entryMapper(v, k) {\n    return [k, v];\n  }\n\n  function not(predicate) {\n    return function() {\n      return !predicate.apply(this, arguments);\n    }\n  }\n\n  function neg(predicate) {\n    return function() {\n      return -predicate.apply(this, arguments);\n    }\n  }\n\n  function quoteString(value) {\n    return typeof value === 'string' ? JSON.stringify(value) : String(value);\n  }\n\n  function defaultZipper() {\n    return arrCopy(arguments);\n  }\n\n  function defaultNegComparator(a, b) {\n    return a < b ? 1 : a > b ? -1 : 0;\n  }\n\n  function hashIterable(iterable) {\n    if (iterable.size === Infinity) {\n      return 0;\n    }\n    var ordered = isOrdered(iterable);\n    var keyed = isKeyed(iterable);\n    var h = ordered ? 1 : 0;\n    var size = iterable.__iterate(\n      keyed ?\n        ordered ?\n          function(v, k)  { h = 31 * h + hashMerge(hash(v), hash(k)) | 0; } :\n          function(v, k)  { h = h + hashMerge(hash(v), hash(k)) | 0; } :\n        ordered ?\n          function(v ) { h = 31 * h + hash(v) | 0; } :\n          function(v ) { h = h + hash(v) | 0; }\n    );\n    return murmurHashOfSize(size, h);\n  }\n\n  function murmurHashOfSize(size, h) {\n    h = imul(h, 0xCC9E2D51);\n    h = imul(h << 15 | h >>> -15, 0x1B873593);\n    h = imul(h << 13 | h >>> -13, 5);\n    h = (h + 0xE6546B64 | 0) ^ size;\n    h = imul(h ^ h >>> 16, 0x85EBCA6B);\n    h = imul(h ^ h >>> 13, 0xC2B2AE35);\n    h = smi(h ^ h >>> 16);\n    return h;\n  }\n\n  function hashMerge(a, b) {\n    return a ^ b + 0x9E3779B9 + (a << 6) + (a >> 2) | 0; // int\n  }\n\n  var Immutable = {\n\n    Iterable: Iterable,\n\n    Seq: Seq,\n    Collection: Collection,\n    Map: Map,\n    OrderedMap: OrderedMap,\n    List: List,\n    Stack: Stack,\n    Set: Set,\n    OrderedSet: OrderedSet,\n\n    Record: Record,\n    Range: Range,\n    Repeat: Repeat,\n\n    is: is,\n    fromJS: fromJS\n\n  };\n\n  return Immutable;\n\n}));", "(function() {\n  \"use strict\";\n\n  // math-inlining.\n  var abs = Math.abs,\n    cos = Math.cos,\n    sin = Math.sin,\n    acos = Math.acos,\n    atan2 = Math.atan2,\n    sqrt = Math.sqrt,\n    pow = Math.pow,\n    // cube root function yielding real roots\n    crt = function(v) {\n      return v < 0 ? -pow(-v, 1 / 3) : pow(v, 1 / 3);\n    },\n    // trig constants\n    pi = Math.PI,\n    tau = 2 * pi,\n    quart = pi / 2,\n    // float precision significant decimal\n    epsilon = 0.000001,\n    // extremas used in bbox calculation and similar algorithms\n    nMax = Number.MAX_SAFE_INTEGER || 9007199254740991,\n    nMin = Number.MIN_SAFE_INTEGER || -9007199254740991,\n    // a zero coordinate, which is surprisingly useful\n    ZERO = { x: 0, y: 0, z: 0 };\n\n  // Bezier utility functions\n  var utils = {\n    // Legendre-Gauss abscissae with n=24 (x_i values, defined at i=n as the roots of the nth order Legendre polynomial Pn(x))\n    Tvalues: [\n      -0.0640568928626056260850430826247450385909,\n      0.0640568928626056260850430826247450385909,\n      -0.1911188674736163091586398207570696318404,\n      0.1911188674736163091586398207570696318404,\n      -0.3150426796961633743867932913198102407864,\n      0.3150426796961633743867932913198102407864,\n      -0.4337935076260451384870842319133497124524,\n      0.4337935076260451384870842319133497124524,\n      -0.5454214713888395356583756172183723700107,\n      0.5454214713888395356583756172183723700107,\n      -0.6480936519369755692524957869107476266696,\n      0.6480936519369755692524957869107476266696,\n      -0.7401241915785543642438281030999784255232,\n      0.7401241915785543642438281030999784255232,\n      -0.8200019859739029219539498726697452080761,\n      0.8200019859739029219539498726697452080761,\n      -0.8864155270044010342131543419821967550873,\n      0.8864155270044010342131543419821967550873,\n      -0.9382745520027327585236490017087214496548,\n      0.9382745520027327585236490017087214496548,\n      -0.9747285559713094981983919930081690617411,\n      0.9747285559713094981983919930081690617411,\n      -0.9951872199970213601799974097007368118745,\n      0.9951872199970213601799974097007368118745\n    ],\n\n    // Legendre-Gauss weights with n=24 (w_i values, defined by a function linked to in the Bezier primer article)\n    Cvalues: [\n      0.1279381953467521569740561652246953718517,\n      0.1279381953467521569740561652246953718517,\n      0.1258374563468282961213753825111836887264,\n      0.1258374563468282961213753825111836887264,\n      0.121670472927803391204463153476262425607,\n      0.121670472927803391204463153476262425607,\n      0.1155056680537256013533444839067835598622,\n      0.1155056680537256013533444839067835598622,\n      0.1074442701159656347825773424466062227946,\n      0.1074442701159656347825773424466062227946,\n      0.0976186521041138882698806644642471544279,\n      0.0976186521041138882698806644642471544279,\n      0.086190161531953275917185202983742667185,\n      0.086190161531953275917185202983742667185,\n      0.0733464814110803057340336152531165181193,\n      0.0733464814110803057340336152531165181193,\n      0.0592985849154367807463677585001085845412,\n      0.0592985849154367807463677585001085845412,\n      0.0442774388174198061686027482113382288593,\n      0.0442774388174198061686027482113382288593,\n      0.0285313886289336631813078159518782864491,\n      0.0285313886289336631813078159518782864491,\n      0.0123412297999871995468056670700372915759,\n      0.0123412297999871995468056670700372915759\n    ],\n\n    arcfn: function(t, derivativeFn) {\n      var d = derivativeFn(t);\n      var l = d.x * d.x + d.y * d.y;\n      if (typeof d.z !== \"undefined\") {\n        l += d.z * d.z;\n      }\n      return sqrt(l);\n    },\n\n    compute: function(t, points, _3d) {\n      // shortcuts\n      if (t === 0) {\n        return points[0];\n      }\n\n      var order = points.length-1;\n\n      if (t === 1) {\n        return points[order];\n      }\n\n      var p = points;\n      var mt = 1 - t;\n\n      // constant?\n      if (order === 0) {\n        return points[0];\n      }\n\n      // linear?\n      if (order === 1) {\n        ret = {\n          x: mt * p[0].x + t * p[1].x,\n          y: mt * p[0].y + t * p[1].y\n        };\n        if (_3d) {\n          ret.z = mt * p[0].z + t * p[1].z;\n        }\n        return ret;\n      }\n\n      // quadratic/cubic curve?\n      if (order < 4) {\n        var mt2 = mt * mt,\n          t2 = t * t,\n          a,\n          b,\n          c,\n          d = 0;\n        if (order === 2) {\n          p = [p[0], p[1], p[2], ZERO];\n          a = mt2;\n          b = mt * t * 2;\n          c = t2;\n        } else if (order === 3) {\n          a = mt2 * mt;\n          b = mt2 * t * 3;\n          c = mt * t2 * 3;\n          d = t * t2;\n        }\n        var ret = {\n          x: a * p[0].x + b * p[1].x + c * p[2].x + d * p[3].x,\n          y: a * p[0].y + b * p[1].y + c * p[2].y + d * p[3].y\n        };\n        if (_3d) {\n          ret.z = a * p[0].z + b * p[1].z + c * p[2].z + d * p[3].z;\n        }\n        return ret;\n      }\n\n      // higher order curves: use de Casteljau's computation\n      var dCpts = JSON.parse(JSON.stringify(points));\n      while (dCpts.length > 1) {\n        for (var i = 0; i < dCpts.length - 1; i++) {\n          dCpts[i] = {\n            x: dCpts[i].x + (dCpts[i + 1].x - dCpts[i].x) * t,\n            y: dCpts[i].y + (dCpts[i + 1].y - dCpts[i].y) * t\n          };\n          if (typeof dCpts[i].z !== \"undefined\") {\n            dCpts[i] = dCpts[i].z + (dCpts[i + 1].z - dCpts[i].z) * t;\n          }\n        }\n        dCpts.splice(dCpts.length - 1, 1);\n      }\n      return dCpts[0];\n    },\n\n    computeWithRatios: function (t, points, ratios, _3d) {\n      var mt = 1 - t, r = ratios, p = points, d;\n      var f1 = r[0], f2 = r[1], f3 = r[2], f4 = r[3];\n\n      // spec for linear\n      f1 *= mt;\n      f2 *= t;\n\n      if (p.length === 2) {\n        d = f1 + f2;\n        return {\n          x: (f1 * p[0].x + f2 * p[1].x)/d,\n          y: (f1 * p[0].y + f2 * p[1].y)/d,\n          z: !_3d ? false : (f1 * p[0].z + f2 * p[1].z)/d\n        };\n      }\n\n      // upgrade to quadratic\n      f1 *= mt;\n      f2 *= 2 * mt;\n      f3 *= t * t;\n\n      if (p.length === 3) {\n        d = f1 + f2 + f3;\n        return {\n          x: (f1 * p[0].x + f2 * p[1].x + f3 * p[2].x)/d,\n          y: (f1 * p[0].y + f2 * p[1].y + f3 * p[2].y)/d,\n          z: !_3d ? false : (f1 * p[0].z + f2 * p[1].z + f3 * p[2].z)/d\n        };\n      }\n\n      // upgrade to cubic\n      f1 *= mt;\n      f2 *= 1.5 * mt;\n      f3 *= 3 * mt;\n      f4 *= t * t * t;\n\n      if (p.length === 4) {\n        d = f1 + f2 + f3 + f4;\n        return {\n          x: (f1 * p[0].x + f2 * p[1].x + f3 * p[2].x + f4 * p[3].x)/d,\n          y: (f1 * p[0].y + f2 * p[1].y + f3 * p[2].y + f4 * p[3].y)/d,\n          z: !_3d ? false : (f1 * p[0].z + f2 * p[1].z + f3 * p[2].z + f4 * p[3].z)/d\n        };\n      }\n    },\n\n    derive: function (points, _3d) {\n      var dpoints = [];\n      for (var p = points, d = p.length, c = d - 1; d > 1; d--, c--) {\n        var list = [];\n        for (var j = 0, dpt; j < c; j++) {\n          dpt = {\n            x: c * (p[j + 1].x - p[j].x),\n            y: c * (p[j + 1].y - p[j].y)\n          };\n          if (_3d) {\n            dpt.z = c * (p[j + 1].z - p[j].z);\n          }\n          list.push(dpt);\n        }\n        dpoints.push(list);\n        p = list;\n      }\n      return dpoints;\n    },\n\n    between: function(v, m, M) {\n      return (\n        (m <= v && v <= M) ||\n        utils.approximately(v, m) ||\n        utils.approximately(v, M)\n      );\n    },\n\n    approximately: function(a, b, precision) {\n      return abs(a - b) <= (precision || epsilon);\n    },\n\n    length: function(derivativeFn) {\n      var z = 0.5,\n        sum = 0,\n        len = utils.Tvalues.length,\n        i,\n        t;\n      for (i = 0; i < len; i++) {\n        t = z * utils.Tvalues[i] + z;\n        sum += utils.Cvalues[i] * utils.arcfn(t, derivativeFn);\n      }\n      return z * sum;\n    },\n\n    map: function(v, ds, de, ts, te) {\n      var d1 = de - ds,\n        d2 = te - ts,\n        v2 = v - ds,\n        r = v2 / d1;\n      return ts + d2 * r;\n    },\n\n    lerp: function(r, v1, v2) {\n      var ret = {\n        x: v1.x + r * (v2.x - v1.x),\n        y: v1.y + r * (v2.y - v1.y)\n      };\n      if (!!v1.z && !!v2.z) {\n        ret.z = v1.z + r * (v2.z - v1.z);\n      }\n      return ret;\n    },\n\n    pointToString: function(p) {\n      var s = p.x + \"/\" + p.y;\n      if (typeof p.z !== \"undefined\") {\n        s += \"/\" + p.z;\n      }\n      return s;\n    },\n\n    pointsToString: function(points) {\n      return \"[\" + points.map(utils.pointToString).join(\", \") + \"]\";\n    },\n\n    copy: function(obj) {\n      return JSON.parse(JSON.stringify(obj));\n    },\n\n    angle: function(o, v1, v2) {\n      var dx1 = v1.x - o.x,\n        dy1 = v1.y - o.y,\n        dx2 = v2.x - o.x,\n        dy2 = v2.y - o.y,\n        cross = dx1 * dy2 - dy1 * dx2,\n        dot = dx1 * dx2 + dy1 * dy2;\n      return atan2(cross, dot);\n    },\n\n    // round as string, to avoid rounding errors\n    round: function(v, d) {\n      var s = \"\" + v;\n      var pos = s.indexOf(\".\");\n      return parseFloat(s.substring(0, pos + 1 + d));\n    },\n\n    dist: function(p1, p2) {\n      var dx = p1.x - p2.x,\n        dy = p1.y - p2.y;\n      return sqrt(dx * dx + dy * dy);\n    },\n\n    closest: function(LUT, point) {\n      var mdist = pow(2, 63),\n        mpos,\n        d;\n      LUT.forEach(function(p, idx) {\n        d = utils.dist(point, p);\n        if (d < mdist) {\n          mdist = d;\n          mpos = idx;\n        }\n      });\n      return { mdist: mdist, mpos: mpos };\n    },\n\n    abcratio: function(t, n) {\n      // see ratio(t) note on http://pomax.github.io/bezierinfo/#abc\n      if (n !== 2 && n !== 3) {\n        return false;\n      }\n      if (typeof t === \"undefined\") {\n        t = 0.5;\n      } else if (t === 0 || t === 1) {\n        return t;\n      }\n      var bottom = pow(t, n) + pow(1 - t, n),\n        top = bottom - 1;\n      return abs(top / bottom);\n    },\n\n    projectionratio: function(t, n) {\n      // see u(t) note on http://pomax.github.io/bezierinfo/#abc\n      if (n !== 2 && n !== 3) {\n        return false;\n      }\n      if (typeof t === \"undefined\") {\n        t = 0.5;\n      } else if (t === 0 || t === 1) {\n        return t;\n      }\n      var top = pow(1 - t, n),\n        bottom = pow(t, n) + top;\n      return top / bottom;\n    },\n\n    lli8: function(x1, y1, x2, y2, x3, y3, x4, y4) {\n      var nx =\n          (x1 * y2 - y1 * x2) * (x3 - x4) - (x1 - x2) * (x3 * y4 - y3 * x4),\n        ny = (x1 * y2 - y1 * x2) * (y3 - y4) - (y1 - y2) * (x3 * y4 - y3 * x4),\n        d = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);\n      if (d == 0) {\n        return false;\n      }\n      return { x: nx / d, y: ny / d };\n    },\n\n    lli4: function(p1, p2, p3, p4) {\n      var x1 = p1.x,\n        y1 = p1.y,\n        x2 = p2.x,\n        y2 = p2.y,\n        x3 = p3.x,\n        y3 = p3.y,\n        x4 = p4.x,\n        y4 = p4.y;\n      return utils.lli8(x1, y1, x2, y2, x3, y3, x4, y4);\n    },\n\n    lli: function(v1, v2) {\n      return utils.lli4(v1, v1.c, v2, v2.c);\n    },\n\n    makeline: function(p1, p2) {\n      var Bezier = require(\"./bezier\");\n      var x1 = p1.x,\n        y1 = p1.y,\n        x2 = p2.x,\n        y2 = p2.y,\n        dx = (x2 - x1) / 3,\n        dy = (y2 - y1) / 3;\n      return new Bezier(\n        x1,\n        y1,\n        x1 + dx,\n        y1 + dy,\n        x1 + 2 * dx,\n        y1 + 2 * dy,\n        x2,\n        y2\n      );\n    },\n\n    findbbox: function(sections) {\n      var mx = nMax,\n        my = nMax,\n        MX = nMin,\n        MY = nMin;\n      sections.forEach(function(s) {\n        var bbox = s.bbox();\n        if (mx > bbox.x.min) mx = bbox.x.min;\n        if (my > bbox.y.min) my = bbox.y.min;\n        if (MX < bbox.x.max) MX = bbox.x.max;\n        if (MY < bbox.y.max) MY = bbox.y.max;\n      });\n      return {\n        x: { min: mx, mid: (mx + MX) / 2, max: MX, size: MX - mx },\n        y: { min: my, mid: (my + MY) / 2, max: MY, size: MY - my }\n      };\n    },\n\n    shapeintersections: function(\n      s1,\n      bbox1,\n      s2,\n      bbox2,\n      curveIntersectionThreshold\n    ) {\n      if (!utils.bboxoverlap(bbox1, bbox2)) return [];\n      var intersections = [];\n      var a1 = [s1.startcap, s1.forward, s1.back, s1.endcap];\n      var a2 = [s2.startcap, s2.forward, s2.back, s2.endcap];\n      a1.forEach(function(l1) {\n        if (l1.virtual) return;\n        a2.forEach(function(l2) {\n          if (l2.virtual) return;\n          var iss = l1.intersects(l2, curveIntersectionThreshold);\n          if (iss.length > 0) {\n            iss.c1 = l1;\n            iss.c2 = l2;\n            iss.s1 = s1;\n            iss.s2 = s2;\n            intersections.push(iss);\n          }\n        });\n      });\n      return intersections;\n    },\n\n    makeshape: function(forward, back, curveIntersectionThreshold) {\n      var bpl = back.points.length;\n      var fpl = forward.points.length;\n      var start = utils.makeline(back.points[bpl - 1], forward.points[0]);\n      var end = utils.makeline(forward.points[fpl - 1], back.points[0]);\n      var shape = {\n        startcap: start,\n        forward: forward,\n        back: back,\n        endcap: end,\n        bbox: utils.findbbox([start, forward, back, end])\n      };\n      var self = utils;\n      shape.intersections = function(s2) {\n        return self.shapeintersections(\n          shape,\n          shape.bbox,\n          s2,\n          s2.bbox,\n          curveIntersectionThreshold\n        );\n      };\n      return shape;\n    },\n\n    getminmax: function(curve, d, list) {\n      if (!list) return { min: 0, max: 0 };\n      var min = nMax,\n        max = nMin,\n        t,\n        c;\n      if (list.indexOf(0) === -1) {\n        list = [0].concat(list);\n      }\n      if (list.indexOf(1) === -1) {\n        list.push(1);\n      }\n      for (var i = 0, len = list.length; i < len; i++) {\n        t = list[i];\n        c = curve.get(t);\n        if (c[d] < min) {\n          min = c[d];\n        }\n        if (c[d] > max) {\n          max = c[d];\n        }\n      }\n      return { min: min, mid: (min + max) / 2, max: max, size: max - min };\n    },\n\n    align: function(points, line) {\n      var tx = line.p1.x,\n        ty = line.p1.y,\n        a = -atan2(line.p2.y - ty, line.p2.x - tx),\n        d = function(v) {\n          return {\n            x: (v.x - tx) * cos(a) - (v.y - ty) * sin(a),\n            y: (v.x - tx) * sin(a) + (v.y - ty) * cos(a)\n          };\n        };\n      return points.map(d);\n    },\n\n    roots: function(points, line) {\n      line = line || { p1: { x: 0, y: 0 }, p2: { x: 1, y: 0 } };\n      var order = points.length - 1;\n      var p = utils.align(points, line);\n      var reduce = function(t) {\n        return 0 <= t && t <= 1;\n      };\n\n      if (order === 2) {\n        var a = p[0].y,\n          b = p[1].y,\n          c = p[2].y,\n          d = a - 2 * b + c;\n        if (d !== 0) {\n          var m1 = -sqrt(b * b - a * c),\n            m2 = -a + b,\n            v1 = -(m1 + m2) / d,\n            v2 = -(-m1 + m2) / d;\n          return [v1, v2].filter(reduce);\n        } else if (b !== c && d === 0) {\n          return [(2*b - c)/(2*b - 2*c)].filter(reduce);\n        }\n        return [];\n      }\n\n      // see http://www.trans4mind.com/personal_development/mathematics/polynomials/cubicAlgebra.htm\n      var pa = p[0].y,\n        pb = p[1].y,\n        pc = p[2].y,\n        pd = p[3].y,\n        d = -pa + 3 * pb - 3 * pc + pd,\n        a = 3 * pa - 6 * pb + 3 * pc,\n        b = -3 * pa + 3 * pb,\n        c = pa;\n\n      if (utils.approximately(d, 0)) {\n        // this is not a cubic curve.\n        if (utils.approximately(a, 0)) {\n          // in fact, this is not a quadratic curve either.\n          if (utils.approximately(b, 0)) {\n            // in fact in fact, there are no solutions.\n            return [];\n          }\n          // linear solution:\n          return [-c / b].filter(reduce);\n        }\n        // quadratic solution:\n        var q = sqrt(b * b - 4 * a * c),\n          a2 = 2 * a;\n        return [(q - b) / a2, (-b - q) / a2].filter(reduce);\n      }\n\n      // at this point, we know we need a cubic solution:\n\n      a /= d;\n      b /= d;\n      c /= d;\n\n      var p = (3 * b - a * a) / 3,\n        p3 = p / 3,\n        q = (2 * a * a * a - 9 * a * b + 27 * c) / 27,\n        q2 = q / 2,\n        discriminant = q2 * q2 + p3 * p3 * p3,\n        u1,\n        v1,\n        x1,\n        x2,\n        x3;\n      if (discriminant < 0) {\n        var mp3 = -p / 3,\n          mp33 = mp3 * mp3 * mp3,\n          r = sqrt(mp33),\n          t = -q / (2 * r),\n          cosphi = t < -1 ? -1 : t > 1 ? 1 : t,\n          phi = acos(cosphi),\n          crtr = crt(r),\n          t1 = 2 * crtr;\n        x1 = t1 * cos(phi / 3) - a / 3;\n        x2 = t1 * cos((phi + tau) / 3) - a / 3;\n        x3 = t1 * cos((phi + 2 * tau) / 3) - a / 3;\n        return [x1, x2, x3].filter(reduce);\n      } else if (discriminant === 0) {\n        u1 = q2 < 0 ? crt(-q2) : -crt(q2);\n        x1 = 2 * u1 - a / 3;\n        x2 = -u1 - a / 3;\n        return [x1, x2].filter(reduce);\n      } else {\n        var sd = sqrt(discriminant);\n        u1 = crt(-q2 + sd);\n        v1 = crt(q2 + sd);\n        return [u1 - v1 - a / 3].filter(reduce);\n      }\n    },\n\n    droots: function(p) {\n      // quadratic roots are easy\n      if (p.length === 3) {\n        var a = p[0],\n          b = p[1],\n          c = p[2],\n          d = a - 2 * b + c;\n        if (d !== 0) {\n          var m1 = -sqrt(b * b - a * c),\n            m2 = -a + b,\n            v1 = -(m1 + m2) / d,\n            v2 = -(-m1 + m2) / d;\n          return [v1, v2];\n        } else if (b !== c && d === 0) {\n          return [(2 * b - c) / (2 * (b - c))];\n        }\n        return [];\n      }\n\n      // linear roots are even easier\n      if (p.length === 2) {\n        var a = p[0],\n          b = p[1];\n        if (a !== b) {\n          return [a / (a - b)];\n        }\n        return [];\n      }\n    },\n\n    curvature: function(t, points, _3d, kOnly) {\n      var dpoints = utils.derive(points);\n      var d1 = dpoints[0];\n      var d2 = dpoints[1];\n      var num, dnm, adk, dk, k=0, r=0;\n\n      //\n      // We're using the following formula for curvature:\n      //\n      //              x'y\" - y'x\"\n      //   k(t) = ------------------\n      //           (x'\u00B2 + y'\u00B2)^(3/2)\n      //\n      // from https://en.wikipedia.org/wiki/Radius_of_curvature#Definition\n      //\n      // With it corresponding 3D counterpart:\n      //\n      //          sqrt( (y'z\" - y\"z')\u00B2 + (z'x\" - z\"x')\u00B2 + (x'y\" - x\"y')\u00B2)\n      //   k(t) = -------------------------------------------------------\n      //                     (x'\u00B2 + y'\u00B2 + z'\u00B2)^(3/2)\n      //\n\n      var d = utils.compute(t, d1);\n      var dd = utils.compute(t, d2);\n      var qdsum = d.x*d.x + d.y*d.y;\n      if (_3d) {\n        num = sqrt(\n          pow(d.y*dd.z - dd.y*d.z, 2) +\n          pow(d.z*dd.x - dd.z*d.x, 2) +\n          pow(d.x*dd.y - dd.x*d.y, 2)\n        );\n        dnm = pow(qdsum + d.z*d.z, 3/2);\n      } else {\n        num = d.x*dd.y - d.y*dd.x;\n        dnm = pow(qdsum, 3/2);\n      }\n\n      if (num === 0 || dnm === 0) {\n        return { k:0, r:0 };\n      }\n\n      k = num/dnm;\n      r = dnm/num;\n\n      // We're also computing the derivative of kappa, because\n      // there is value in knowing the rate of change for the\n      // curvature along the curve. And we're just going to\n      // ballpark it based on an epsilon.\n      if (!kOnly) {\n        // compute k'(t) based on the interval before, and after it,\n        // to at least try to not introduce forward/backward pass bias.\n        var pk = utils.curvature(t-0.001, points, _3d, true).k;\n        var nk = utils.curvature(t+0.001, points, _3d, true).k;\n        dk = ((nk-k) + (k-pk))/2;\n        adk = (abs(nk-k) + abs(k-pk))/2;\n      }\n\n      return { k: k, r: r, dk: dk, adk:adk, };\n    },\n\n    inflections: function(points) {\n      if (points.length < 4) return [];\n\n      // FIXME: TODO: add in inflection abstraction for quartic+ curves?\n\n      var p = utils.align(points, { p1: points[0], p2: points.slice(-1)[0] }),\n        a = p[2].x * p[1].y,\n        b = p[3].x * p[1].y,\n        c = p[1].x * p[2].y,\n        d = p[3].x * p[2].y,\n        v1 = 18 * (-3 * a + 2 * b + 3 * c - d),\n        v2 = 18 * (3 * a - b - 3 * c),\n        v3 = 18 * (c - a);\n\n      if (utils.approximately(v1, 0)) {\n        if (!utils.approximately(v2, 0)) {\n          var t = -v3 / v2;\n          if (0 <= t && t <= 1) return [t];\n        }\n        return [];\n      }\n\n      var trm = v2 * v2 - 4 * v1 * v3,\n        sq = Math.sqrt(trm),\n        d = 2 * v1;\n\n      if (utils.approximately(d, 0)) return [];\n\n      return [(sq - v2) / d, -(v2 + sq) / d].filter(function(r) {\n        return 0 <= r && r <= 1;\n      });\n    },\n\n    bboxoverlap: function(b1, b2) {\n      var dims = [\"x\", \"y\"],\n        len = dims.length,\n        i,\n        dim,\n        l,\n        t,\n        d;\n      for (i = 0; i < len; i++) {\n        dim = dims[i];\n        l = b1[dim].mid;\n        t = b2[dim].mid;\n        d = (b1[dim].size + b2[dim].size) / 2;\n        if (abs(l - t) >= d) return false;\n      }\n      return true;\n    },\n\n    expandbox: function(bbox, _bbox) {\n      if (_bbox.x.min < bbox.x.min) {\n        bbox.x.min = _bbox.x.min;\n      }\n      if (_bbox.y.min < bbox.y.min) {\n        bbox.y.min = _bbox.y.min;\n      }\n      if (_bbox.z && _bbox.z.min < bbox.z.min) {\n        bbox.z.min = _bbox.z.min;\n      }\n      if (_bbox.x.max > bbox.x.max) {\n        bbox.x.max = _bbox.x.max;\n      }\n      if (_bbox.y.max > bbox.y.max) {\n        bbox.y.max = _bbox.y.max;\n      }\n      if (_bbox.z && _bbox.z.max > bbox.z.max) {\n        bbox.z.max = _bbox.z.max;\n      }\n      bbox.x.mid = (bbox.x.min + bbox.x.max) / 2;\n      bbox.y.mid = (bbox.y.min + bbox.y.max) / 2;\n      if (bbox.z) {\n        bbox.z.mid = (bbox.z.min + bbox.z.max) / 2;\n      }\n      bbox.x.size = bbox.x.max - bbox.x.min;\n      bbox.y.size = bbox.y.max - bbox.y.min;\n      if (bbox.z) {\n        bbox.z.size = bbox.z.max - bbox.z.min;\n      }\n    },\n\n    pairiteration: function(c1, c2, curveIntersectionThreshold) {\n      var c1b = c1.bbox(),\n        c2b = c2.bbox(),\n        r = 100000,\n        threshold = curveIntersectionThreshold || 0.5;\n      if (\n        c1b.x.size + c1b.y.size < threshold &&\n        c2b.x.size + c2b.y.size < threshold\n      ) {\n        return [\n          ((r * (c1._t1 + c1._t2) / 2) | 0) / r +\n            \"/\" +\n            ((r * (c2._t1 + c2._t2) / 2) | 0) / r\n        ];\n      }\n      var cc1 = c1.split(0.5),\n        cc2 = c2.split(0.5),\n        pairs = [\n          { left: cc1.left, right: cc2.left },\n          { left: cc1.left, right: cc2.right },\n          { left: cc1.right, right: cc2.right },\n          { left: cc1.right, right: cc2.left }\n        ];\n      pairs = pairs.filter(function(pair) {\n        return utils.bboxoverlap(pair.left.bbox(), pair.right.bbox());\n      });\n      var results = [];\n      if (pairs.length === 0) return results;\n      pairs.forEach(function(pair) {\n        results = results.concat(\n          utils.pairiteration(pair.left, pair.right, threshold)\n        );\n      });\n      results = results.filter(function(v, i) {\n        return results.indexOf(v) === i;\n      });\n      return results;\n    },\n\n    getccenter: function(p1, p2, p3) {\n      var dx1 = p2.x - p1.x,\n        dy1 = p2.y - p1.y,\n        dx2 = p3.x - p2.x,\n        dy2 = p3.y - p2.y;\n      var dx1p = dx1 * cos(quart) - dy1 * sin(quart),\n        dy1p = dx1 * sin(quart) + dy1 * cos(quart),\n        dx2p = dx2 * cos(quart) - dy2 * sin(quart),\n        dy2p = dx2 * sin(quart) + dy2 * cos(quart);\n      // chord midpoints\n      var mx1 = (p1.x + p2.x) / 2,\n        my1 = (p1.y + p2.y) / 2,\n        mx2 = (p2.x + p3.x) / 2,\n        my2 = (p2.y + p3.y) / 2;\n      // midpoint offsets\n      var mx1n = mx1 + dx1p,\n        my1n = my1 + dy1p,\n        mx2n = mx2 + dx2p,\n        my2n = my2 + dy2p;\n      // intersection of these lines:\n      var arc = utils.lli8(mx1, my1, mx1n, my1n, mx2, my2, mx2n, my2n),\n        r = utils.dist(arc, p1),\n        // arc start/end values, over mid point:\n        s = atan2(p1.y - arc.y, p1.x - arc.x),\n        m = atan2(p2.y - arc.y, p2.x - arc.x),\n        e = atan2(p3.y - arc.y, p3.x - arc.x),\n        _;\n      // determine arc direction (cw/ccw correction)\n      if (s < e) {\n        // if s<m<e, arc(s, e)\n        // if m<s<e, arc(e, s + tau)\n        // if s<e<m, arc(e, s + tau)\n        if (s > m || m > e) {\n          s += tau;\n        }\n        if (s > e) {\n          _ = e;\n          e = s;\n          s = _;\n        }\n      } else {\n        // if e<m<s, arc(e, s)\n        // if m<e<s, arc(s, e + tau)\n        // if e<s<m, arc(s, e + tau)\n        if (e < m && m < s) {\n          _ = e;\n          e = s;\n          s = _;\n        } else {\n          e += tau;\n        }\n      }\n      // assign and done.\n      arc.s = s;\n      arc.e = e;\n      arc.r = r;\n      return arc;\n    },\n\n    numberSort: function(a, b) {\n      return a - b;\n    }\n  };\n\n  module.exports = utils;\n})();\n", "(function() {\n  \"use strict\";\n\n  var utils = require(\"./utils.js\");\n\n  /**\n   * Poly Bezier\n   * @param {[type]} curves [description]\n   */\n  var PolyBezier = function(curves) {\n    this.curves = [];\n    this._3d = false;\n    if (!!curves) {\n      this.curves = curves;\n      this._3d = this.curves[0]._3d;\n    }\n  };\n\n  PolyBezier.prototype = {\n    valueOf: function() {\n      return this.toString();\n    },\n    toString: function() {\n      return (\n        \"[\" +\n        this.curves\n          .map(function(curve) {\n            return utils.pointsToString(curve.points);\n          })\n          .join(\", \") +\n        \"]\"\n      );\n    },\n    addCurve: function(curve) {\n      this.curves.push(curve);\n      this._3d = this._3d || curve._3d;\n    },\n    length: function() {\n      return this.curves\n        .map(function(v) {\n          return v.length();\n        })\n        .reduce(function(a, b) {\n          return a + b;\n        });\n    },\n    curve: function(idx) {\n      return this.curves[idx];\n    },\n    bbox: function() {\n      var c = this.curves;\n      var bbox = c[0].bbox();\n      for (var i = 1; i < c.length; i++) {\n        utils.expandbox(bbox, c[i].bbox());\n      }\n      return bbox;\n    },\n    offset: function(d) {\n      var offset = [];\n      this.curves.forEach(function(v) {\n        offset = offset.concat(v.offset(d));\n      });\n      return new PolyBezier(offset);\n    }\n  };\n\n  module.exports = PolyBezier;\n})();\n", "/**\n * Normalise an SVG path to absolute coordinates\n * and full commands, rather than relative coordinates\n * and/or shortcut commands.\n */\nfunction normalizePath(d) {\n  // preprocess \"d\" so that we have spaces between values\n  d = d\n    .replace(/,/g, \" \") // replace commas with spaces\n    .replace(/-/g, \" - \") // add spacing around minus signs\n    .replace(/-\\s+/g, \"-\") // remove spacing to the right of minus signs.\n    .replace(/([a-zA-Z])/g, \" $1 \");\n\n  // set up the variables used in this function\n  var instructions = d.replace(/([a-zA-Z])\\s?/g, \"|$1\").split(\"|\"),\n    instructionLength = instructions.length,\n    i,\n    instruction,\n    op,\n    lop,\n    args = [],\n    alen,\n    a,\n    sx = 0,\n    sy = 0,\n    x = 0,\n    y = 0,\n    cx = 0,\n    cy = 0,\n    cx2 = 0,\n    cy2 = 0,\n    normalized = \"\";\n\n  // we run through the instruction list starting at 1, not 0,\n  // because we split up \"|M x y ....\" so the first element will\n  // always be an empty string. By design.\n  for (i = 1; i < instructionLength; i++) {\n    // which instruction is this?\n    instruction = instructions[i];\n    op = instruction.substring(0, 1);\n    lop = op.toLowerCase();\n\n    // what are the arguments? note that we need to convert\n    // all strings into numbers, or + will do silly things.\n    args = instruction\n      .replace(op, \"\")\n      .trim()\n      .split(\" \");\n    args = args\n      .filter(function(v) {\n        return v !== \"\";\n      })\n      .map(parseFloat);\n    alen = args.length;\n\n    // we could use a switch, but elaborate code in a \"case\" with\n    // fallthrough is just horrid to read. So let's use ifthen\n    // statements instead.\n\n    // moveto command (plus possible lineto)\n    if (lop === \"m\") {\n      normalized += \"M \";\n      if (op === \"m\") {\n        x += args[0];\n        y += args[1];\n      } else {\n        x = args[0];\n        y = args[1];\n      }\n      // records start position, for dealing\n      // with the shape close operator ('Z')\n      sx = x;\n      sy = y;\n      normalized += x + \" \" + y + \" \";\n      if (alen > 2) {\n        for (a = 0; a < alen; a += 2) {\n          if (op === \"m\") {\n            x += args[a];\n            y += args[a + 1];\n          } else {\n            x = args[a];\n            y = args[a + 1];\n          }\n          normalized += [\"L\",x,y,''].join(\" \");\n        }\n      }\n    } else if (lop === \"l\") {\n      // lineto commands\n      for (a = 0; a < alen; a += 2) {\n        if (op === \"l\") {\n          x += args[a];\n          y += args[a + 1];\n        } else {\n          x = args[a];\n          y = args[a + 1];\n        }\n        normalized += [\"L\",x,y,''].join(\" \");\n      }\n    } else if (lop === \"h\") {\n      for (a = 0; a < alen; a++) {\n        if (op === \"h\") {\n          x += args[a];\n        } else {\n          x = args[a];\n        }\n        normalized += [\"L\",x,y,''].join(\" \");\n      }\n    } else if (lop === \"v\") {\n      for (a = 0; a < alen; a++) {\n        if (op === \"v\") {\n          y += args[a];\n        } else {\n          y = args[a];\n        }\n        normalized += [\"L\",x,y,''].join(\" \");\n      }\n    } else if (lop === \"q\") {\n      // quadratic curveto commands\n      for (a = 0; a < alen; a += 4) {\n        if (op === \"q\") {\n          cx = x + args[a];\n          cy = y + args[a + 1];\n          x += args[a + 2];\n          y += args[a + 3];\n        } else {\n          cx = args[a];\n          cy = args[a + 1];\n          x = args[a + 2];\n          y = args[a + 3];\n        }\n        normalized += [\"Q\",cx,cy,x,y,''].join(\" \");\n      }\n    } else if (lop === \"t\") {\n      for (a = 0; a < alen; a += 2) {\n        // reflect previous cx/cy over x/y\n        cx = x + (x - cx);\n        cy = y + (y - cy);\n        // then get real end point\n        if (op === \"t\") {\n          x += args[a];\n          y += args[a + 1];\n        } else {\n          x = args[a];\n          y = args[a + 1];\n        }\n        normalized += [\"Q\",cx,cy,x,y,''].join(\" \");\n      }\n    } else if (lop === \"c\") {\n      // cubic curveto commands\n      for (a = 0; a < alen; a += 6) {\n        if (op === \"c\") {\n          cx = x + args[a];\n          cy = y + args[a + 1];\n          cx2 = x + args[a + 2];\n          cy2 = y + args[a + 3];\n          x += args[a + 4];\n          y += args[a + 5];\n        } else {\n          cx = args[a];\n          cy = args[a + 1];\n          cx2 = args[a + 2];\n          cy2 = args[a + 3];\n          x = args[a + 4];\n          y = args[a + 5];\n        }\n        normalized += [\"C\",cx,cy,cx2,cy2,x,y,''].join(\" \");\n      }\n    } else if (lop === \"s\") {\n      for (a = 0; a < alen; a += 4) {\n        // reflect previous cx2/cy2 over x/y\n        cx = x + (x - cx2);\n        cy = y + (y - cy2);\n        // then get real control and end point\n        if (op === \"s\") {\n          cx2 = x + args[a];\n          cy2 = y + args[a + 1];\n          x += args[a + 2];\n          y += args[a + 3];\n        } else {\n          cx2 = args[a];\n          cy2 = args[a + 1];\n          x = args[a + 2];\n          y = args[a + 3];\n        }\n        normalized +=[\"C\",cx,cy,cx2,cy2,x,y,''].join(\" \");\n      }\n    } else if (lop === \"z\") {\n      normalized += \"Z \";\n      // not unimportant: path closing changes the current x/y coordinate\n      x = sx;\n      y = sy;\n    }\n  }\n  return normalized.trim();\n}\n\nmodule.exports = normalizePath;\n", "var normalise = require(\"./normalise-svg.js\");\n\nvar M = { x: false, y: false };\n\nfunction makeBezier(Bezier, term, values) {\n  if (term === 'Z') return;\n  if (term === 'M') {\n    M = {x: values[0], y: values[1]};\n    return;\n  }\n  // ES7: new Bezier(M.x, M.y, ...values)\n  var cvalues = [false, M.x, M.y].concat(values);\n  var PreboundConstructor = Bezier.bind.apply(Bezier, cvalues)\n  var curve = new PreboundConstructor();\n  var last = values.slice(-2);\n  M = { x : last[0], y: last[1] };\n  return curve;\n}\n\nfunction convertPath(Bezier, d) {\n  var terms = normalise(d).split(\" \"),\n    term,\n    matcher = new RegExp(\"[MLCQZ]\", \"\"),\n    segment,\n    values,\n    segments = [],\n    ARGS = { \"C\": 6, \"Q\": 4, \"L\": 2, \"M\": 2};\n\n  while (terms.length) {\n    term = terms.splice(0,1)[0];\n    if (matcher.test(term)) {\n      values = terms.splice(0, ARGS[term]).map(parseFloat);\n      segment = makeBezier(Bezier, term, values);\n      if (segment) segments.push(segment);\n    }\n  }\n\n  return new Bezier.PolyBezier(segments);\n}\n\nmodule.exports = convertPath;\n", "/**\n  A javascript Bezier curve library by Pomax.\n\n  Based on http://pomax.github.io/bezierinfo\n\n  This code is MIT licensed.\n**/\n(function() {\n  \"use strict\";\n\n  // math-inlining.\n  var abs = Math.abs,\n    min = Math.min,\n    max = Math.max,\n    cos = Math.cos,\n    sin = Math.sin,\n    acos = Math.acos,\n    sqrt = Math.sqrt,\n    pi = Math.PI,\n    // a zero coordinate, which is surprisingly useful\n    ZERO = { x: 0, y: 0, z: 0 };\n\n  // quite needed\n  var utils = require(\"./utils.js\");\n\n  // only used for outlines atm.\n  var PolyBezier = require(\"./poly-bezier.js\");\n\n  /**\n   * Bezier curve constructor. The constructor argument can be one of three things:\n   *\n   * 1. array/4 of {x:..., y:..., z:...}, z optional\n   * 2. numerical array/8 ordered x1,y1,x2,y2,x3,y3,x4,y4\n   * 3. numerical array/12 ordered x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4\n   *\n   */\n  var Bezier = function(coords) {\n    var args = coords && coords.forEach ? coords : [].slice.call(arguments);\n    var coordlen = false;\n    if (typeof args[0] === \"object\") {\n      coordlen = args.length;\n      var newargs = [];\n      args.forEach(function(point) {\n        [\"x\", \"y\", \"z\"].forEach(function(d) {\n          if (typeof point[d] !== \"undefined\") {\n            newargs.push(point[d]);\n          }\n        });\n      });\n      args = newargs;\n    }\n    var higher = false;\n    var len = args.length;\n    if (coordlen) {\n      if (coordlen > 4) {\n        if (arguments.length !== 1) {\n          throw new Error(\n            \"Only new Bezier(point[]) is accepted for 4th and higher order curves\"\n          );\n        }\n        higher = true;\n      }\n    } else {\n      if (len !== 6 && len !== 8 && len !== 9 && len !== 12) {\n        if (arguments.length !== 1) {\n          throw new Error(\n            \"Only new Bezier(point[]) is accepted for 4th and higher order curves\"\n          );\n        }\n      }\n    }\n    var _3d =\n      (!higher && (len === 9 || len === 12)) ||\n      (coords && coords[0] && typeof coords[0].z !== \"undefined\");\n    this._3d = _3d;\n    var points = [];\n    for (var idx = 0, step = _3d ? 3 : 2; idx < len; idx += step) {\n      var point = {\n        x: args[idx],\n        y: args[idx + 1]\n      };\n      if (_3d) {\n        point.z = args[idx + 2];\n      }\n      points.push(point);\n    }\n    this.order = points.length - 1;\n    this.points = points;\n    var dims = [\"x\", \"y\"];\n    if (_3d) dims.push(\"z\");\n    this.dims = dims;\n    this.dimlen = dims.length;\n\n    (function(curve) {\n      var order = curve.order;\n      var points = curve.points;\n      var a = utils.align(points, { p1: points[0], p2: points[order] });\n      for (var i = 0; i < a.length; i++) {\n        if (abs(a[i].y) > 0.0001) {\n          curve._linear = false;\n          return;\n        }\n      }\n      curve._linear = true;\n    })(this);\n\n    this._t1 = 0;\n    this._t2 = 1;\n    this.update();\n  };\n\n  var svgToBeziers = require(\"./svg-to-beziers\");\n\n  /**\n   * turn an svg <path> d attribute into a sequence of Bezier segments.\n   */\n  Bezier.SVGtoBeziers = function(d) {\n    return svgToBeziers(Bezier, d);\n  };\n\n  function getABC(n, S, B, E, t) {\n    if (typeof t === \"undefined\") {\n      t = 0.5;\n    }\n    var u = utils.projectionratio(t, n),\n      um = 1 - u,\n      C = {\n        x: u * S.x + um * E.x,\n        y: u * S.y + um * E.y\n      },\n      s = utils.abcratio(t, n),\n      A = {\n        x: B.x + (B.x - C.x) / s,\n        y: B.y + (B.y - C.y) / s\n      };\n    return { A: A, B: B, C: C };\n  }\n\n  Bezier.quadraticFromPoints = function(p1, p2, p3, t) {\n    if (typeof t === \"undefined\") {\n      t = 0.5;\n    }\n    // shortcuts, although they're really dumb\n    if (t === 0) {\n      return new Bezier(p2, p2, p3);\n    }\n    if (t === 1) {\n      return new Bezier(p1, p2, p2);\n    }\n    // real fitting.\n    var abc = getABC(2, p1, p2, p3, t);\n    return new Bezier(p1, abc.A, p3);\n  };\n\n  Bezier.cubicFromPoints = function(S, B, E, t, d1) {\n    if (typeof t === \"undefined\") {\n      t = 0.5;\n    }\n    var abc = getABC(3, S, B, E, t);\n    if (typeof d1 === \"undefined\") {\n      d1 = utils.dist(B, abc.C);\n    }\n    var d2 = d1 * (1 - t) / t;\n\n    var selen = utils.dist(S, E),\n      lx = (E.x - S.x) / selen,\n      ly = (E.y - S.y) / selen,\n      bx1 = d1 * lx,\n      by1 = d1 * ly,\n      bx2 = d2 * lx,\n      by2 = d2 * ly;\n    // derivation of new hull coordinates\n    var e1 = { x: B.x - bx1, y: B.y - by1 },\n      e2 = { x: B.x + bx2, y: B.y + by2 },\n      A = abc.A,\n      v1 = { x: A.x + (e1.x - A.x) / (1 - t), y: A.y + (e1.y - A.y) / (1 - t) },\n      v2 = { x: A.x + (e2.x - A.x) / t, y: A.y + (e2.y - A.y) / t },\n      nc1 = { x: S.x + (v1.x - S.x) / t, y: S.y + (v1.y - S.y) / t },\n      nc2 = {\n        x: E.x + (v2.x - E.x) / (1 - t),\n        y: E.y + (v2.y - E.y) / (1 - t)\n      };\n    // ...done\n    return new Bezier(S, nc1, nc2, E);\n  };\n\n  var getUtils = function() {\n    return utils;\n  };\n\n  Bezier.getUtils = getUtils;\n\n  Bezier.PolyBezier = PolyBezier;\n\n  Bezier.prototype = {\n    getUtils: getUtils,\n    valueOf: function() {\n      return this.toString();\n    },\n    toString: function() {\n      return utils.pointsToString(this.points);\n    },\n    toSVG: function(relative) {\n      if (this._3d) return false;\n      var p = this.points,\n        x = p[0].x,\n        y = p[0].y,\n        s = [\"M\", x, y, this.order === 2 ? \"Q\" : \"C\"];\n      for (var i = 1, last = p.length; i < last; i++) {\n        s.push(p[i].x);\n        s.push(p[i].y);\n      }\n      return s.join(\" \");\n    },\n    setRatios: function(ratios) {\n      if (ratios.length !== this.points.length) {\n        throw new Error(\"incorrect number of ratio values\");\n      }\n      this.ratios = ratios;\n      this._lut = []; //  invalidate any precomputed LUT\n    },\n    update: function() {\n      // invalidate any precomputed LUT\n      this._lut = [];\n      this.dpoints = utils.derive(this.points, this._3d);\n      this.computedirection();\n    },\n    computedirection: function() {\n      var points = this.points;\n      var angle = utils.angle(points[0], points[this.order], points[1]);\n      this.clockwise = angle > 0;\n    },\n    length: function() {\n      return utils.length(this.derivative.bind(this));\n    },\n    _lut: [],\n    getLUT: function(steps) {\n      steps = steps || 100;\n      if (this._lut.length === steps) {\n        return this._lut;\n      }\n      this._lut = [];\n      // We want a range from 0 to 1 inclusive, so\n      // we decrement and then use <= rather than <:\n      steps--;\n      for (var t = 0; t <= steps; t++) {\n        this._lut.push(this.compute(t / steps));\n      }\n      return this._lut;\n    },\n    on: function(point, error) {\n      error = error || 5;\n      var lut = this.getLUT(),\n        hits = [],\n        c,\n        t = 0;\n      for (var i = 0; i < lut.length; i++) {\n        c = lut[i];\n        if (utils.dist(c, point) < error) {\n          hits.push(c);\n          t += i / lut.length;\n        }\n      }\n      if (!hits.length) return false;\n      return (t /= hits.length);\n    },\n    project: function(point) {\n      // step 1: coarse check\n      var LUT = this.getLUT(),\n        l = LUT.length - 1,\n        closest = utils.closest(LUT, point),\n        mdist = closest.mdist,\n        mpos = closest.mpos;\n\n      // step 2: fine check\n      var ft,\n        t,\n        p,\n        d,\n        t1 = (mpos - 1) / l,\n        t2 = (mpos + 1) / l,\n        step = 0.1 / l;\n      mdist += 1;\n      for (t = t1, ft = t; t < t2 + step; t += step) {\n        p = this.compute(t);\n        d = utils.dist(point, p);\n        if (d < mdist) {\n          mdist = d;\n          ft = t;\n        }\n      }\n      p = this.compute(ft);\n      p.t = ft;\n      p.d = mdist;\n      return p;\n    },\n    get: function(t) {\n      return this.compute(t);\n    },\n    point: function(idx) {\n      return this.points[idx];\n    },\n    compute: function(t) {\n      if (this.ratios) return utils.computeWithRatios(t, this.points, this.ratios, this._3d);\n      return utils.compute(t, this.points, this._3d, this.ratios);\n    },\n    raise: function() {\n      var p = this.points,\n        np = [p[0]],\n        i,\n        k = p.length,\n        pi,\n        pim;\n      for (var i = 1; i < k; i++) {\n        pi = p[i];\n        pim = p[i - 1];\n        np[i] = {\n          x: (k - i) / k * pi.x + i / k * pim.x,\n          y: (k - i) / k * pi.y + i / k * pim.y\n        };\n      }\n      np[k] = p[k - 1];\n      return new Bezier(np);\n    },\n    derivative: function(t) {\n      var mt = 1 - t,\n        a,\n        b,\n        c = 0,\n        p = this.dpoints[0];\n      if (this.order === 2) {\n        p = [p[0], p[1], ZERO];\n        a = mt;\n        b = t;\n      }\n      if (this.order === 3) {\n        a = mt * mt;\n        b = mt * t * 2;\n        c = t * t;\n      }\n      var ret = {\n        x: a * p[0].x + b * p[1].x + c * p[2].x,\n        y: a * p[0].y + b * p[1].y + c * p[2].y\n      };\n      if (this._3d) {\n        ret.z = a * p[0].z + b * p[1].z + c * p[2].z;\n      }\n      return ret;\n    },\n    curvature: function(t) {\n      return utils.curvature(t, this.points, this._3d);\n    },\n    inflections: function() {\n      return utils.inflections(this.points);\n    },\n    normal: function(t) {\n      return this._3d ? this.__normal3(t) : this.__normal2(t);\n    },\n    __normal2: function(t) {\n      var d = this.derivative(t);\n      var q = sqrt(d.x * d.x + d.y * d.y);\n      return { x: -d.y / q, y: d.x / q };\n    },\n    __normal3: function(t) {\n      // see http://stackoverflow.com/questions/25453159\n      var r1 = this.derivative(t),\n        r2 = this.derivative(t + 0.01),\n        q1 = sqrt(r1.x * r1.x + r1.y * r1.y + r1.z * r1.z),\n        q2 = sqrt(r2.x * r2.x + r2.y * r2.y + r2.z * r2.z);\n      r1.x /= q1;\n      r1.y /= q1;\n      r1.z /= q1;\n      r2.x /= q2;\n      r2.y /= q2;\n      r2.z /= q2;\n      // cross product\n      var c = {\n        x: r2.y * r1.z - r2.z * r1.y,\n        y: r2.z * r1.x - r2.x * r1.z,\n        z: r2.x * r1.y - r2.y * r1.x\n      };\n      var m = sqrt(c.x * c.x + c.y * c.y + c.z * c.z);\n      c.x /= m;\n      c.y /= m;\n      c.z /= m;\n      // rotation matrix\n      var R = [\n        c.x * c.x,\n        c.x * c.y - c.z,\n        c.x * c.z + c.y,\n        c.x * c.y + c.z,\n        c.y * c.y,\n        c.y * c.z - c.x,\n        c.x * c.z - c.y,\n        c.y * c.z + c.x,\n        c.z * c.z\n      ];\n      // normal vector:\n      var n = {\n        x: R[0] * r1.x + R[1] * r1.y + R[2] * r1.z,\n        y: R[3] * r1.x + R[4] * r1.y + R[5] * r1.z,\n        z: R[6] * r1.x + R[7] * r1.y + R[8] * r1.z\n      };\n      return n;\n    },\n    hull: function(t) {\n      var p = this.points,\n        _p = [],\n        pt,\n        q = [],\n        idx = 0,\n        i = 0,\n        l = 0;\n      q[idx++] = p[0];\n      q[idx++] = p[1];\n      q[idx++] = p[2];\n      if (this.order === 3) {\n        q[idx++] = p[3];\n      }\n      // we lerp between all points at each iteration, until we have 1 point left.\n      while (p.length > 1) {\n        _p = [];\n        for (i = 0, l = p.length - 1; i < l; i++) {\n          pt = utils.lerp(t, p[i], p[i + 1]);\n          q[idx++] = pt;\n          _p.push(pt);\n        }\n        p = _p;\n      }\n      return q;\n    },\n    split: function(t1, t2) {\n      // shortcuts\n      if (t1 === 0 && !!t2) {\n        return this.split(t2).left;\n      }\n      if (t2 === 1) {\n        return this.split(t1).right;\n      }\n\n      // no shortcut: use \"de Casteljau\" iteration.\n      var q = this.hull(t1);\n      var result = {\n        left:\n          this.order === 2\n            ? new Bezier([q[0], q[3], q[5]])\n            : new Bezier([q[0], q[4], q[7], q[9]]),\n        right:\n          this.order === 2\n            ? new Bezier([q[5], q[4], q[2]])\n            : new Bezier([q[9], q[8], q[6], q[3]]),\n        span: q\n      };\n\n      // make sure we bind _t1/_t2 information!\n      result.left._t1 = utils.map(0, 0, 1, this._t1, this._t2);\n      result.left._t2 = utils.map(t1, 0, 1, this._t1, this._t2);\n      result.right._t1 = utils.map(t1, 0, 1, this._t1, this._t2);\n      result.right._t2 = utils.map(1, 0, 1, this._t1, this._t2);\n\n      // if we have no t2, we're done\n      if (!t2) {\n        return result;\n      }\n\n      // if we have a t2, split again:\n      t2 = utils.map(t2, t1, 1, 0, 1);\n      var subsplit = result.right.split(t2);\n      return subsplit.left;\n    },\n    extrema: function() {\n      var dims = this.dims,\n        result = {},\n        roots = [],\n        p,\n        mfn;\n      dims.forEach(\n        function(dim) {\n          mfn = function(v) {\n            return v[dim];\n          };\n          p = this.dpoints[0].map(mfn);\n          result[dim] = utils.droots(p);\n          if (this.order === 3) {\n            p = this.dpoints[1].map(mfn);\n            result[dim] = result[dim].concat(utils.droots(p));\n          }\n          result[dim] = result[dim].filter(function(t) {\n            return t >= 0 && t <= 1;\n          });\n          roots = roots.concat(result[dim].sort(utils.numberSort));\n        }.bind(this)\n      );\n      roots = roots.sort(utils.numberSort).filter(function(v, idx) {\n        return roots.indexOf(v) === idx;\n      });\n      result.values = roots;\n      return result;\n    },\n    bbox: function() {\n      var extrema = this.extrema(),\n        result = {};\n      this.dims.forEach(\n        function(d) {\n          result[d] = utils.getminmax(this, d, extrema[d]);\n        }.bind(this)\n      );\n      return result;\n    },\n    overlaps: function(curve) {\n      var lbbox = this.bbox(),\n        tbbox = curve.bbox();\n      return utils.bboxoverlap(lbbox, tbbox);\n    },\n    offset: function(t, d) {\n      if (typeof d !== \"undefined\") {\n        var c = this.get(t);\n        var n = this.normal(t);\n        var ret = {\n          c: c,\n          n: n,\n          x: c.x + n.x * d,\n          y: c.y + n.y * d\n        };\n        if (this._3d) {\n          ret.z = c.z + n.z * d;\n        }\n        return ret;\n      }\n      if (this._linear) {\n        var nv = this.normal(0);\n        var coords = this.points.map(function(p) {\n          var ret = {\n            x: p.x + t * nv.x,\n            y: p.y + t * nv.y\n          };\n          if (p.z && n.z) {\n            ret.z = p.z + t * nv.z;\n          }\n          return ret;\n        });\n        return [new Bezier(coords)];\n      }\n      var reduced = this.reduce();\n      return reduced.map(function(s) {\n        if (s._linear) {\n          return s.offset(t)[0];\n        }\n        return s.scale(t);\n      });\n    },\n    simple: function() {\n      if (this.order === 3) {\n        var a1 = utils.angle(this.points[0], this.points[3], this.points[1]);\n        var a2 = utils.angle(this.points[0], this.points[3], this.points[2]);\n        if ((a1 > 0 && a2 < 0) || (a1 < 0 && a2 > 0)) return false;\n      }\n      var n1 = this.normal(0);\n      var n2 = this.normal(1);\n      var s = n1.x * n2.x + n1.y * n2.y;\n      if (this._3d) {\n        s += n1.z * n2.z;\n      }\n      var angle = abs(acos(s));\n      return angle < pi / 3;\n    },\n    reduce: function() {\n      var i,\n        t1 = 0,\n        t2 = 0,\n        step = 0.01,\n        segment,\n        pass1 = [],\n        pass2 = [];\n      // first pass: split on extrema\n      var extrema = this.extrema().values;\n      if (extrema.indexOf(0) === -1) {\n        extrema = [0].concat(extrema);\n      }\n      if (extrema.indexOf(1) === -1) {\n        extrema.push(1);\n      }\n\n      for (t1 = extrema[0], i = 1; i < extrema.length; i++) {\n        t2 = extrema[i];\n        segment = this.split(t1, t2);\n        segment._t1 = t1;\n        segment._t2 = t2;\n        pass1.push(segment);\n        t1 = t2;\n      }\n\n      // second pass: further reduce these segments to simple segments\n      pass1.forEach(function(p1) {\n        t1 = 0;\n        t2 = 0;\n        while (t2 <= 1) {\n          for (t2 = t1 + step; t2 <= 1 + step; t2 += step) {\n            segment = p1.split(t1, t2);\n            if (!segment.simple()) {\n              t2 -= step;\n              if (abs(t1 - t2) < step) {\n                // we can never form a reduction\n                return [];\n              }\n              segment = p1.split(t1, t2);\n              segment._t1 = utils.map(t1, 0, 1, p1._t1, p1._t2);\n              segment._t2 = utils.map(t2, 0, 1, p1._t1, p1._t2);\n              pass2.push(segment);\n              t1 = t2;\n              break;\n            }\n          }\n        }\n        if (t1 < 1) {\n          segment = p1.split(t1, 1);\n          segment._t1 = utils.map(t1, 0, 1, p1._t1, p1._t2);\n          segment._t2 = p1._t2;\n          pass2.push(segment);\n        }\n      });\n      return pass2;\n    },\n    scale: function(d) {\n      var order = this.order;\n      var distanceFn = false;\n      if (typeof d === \"function\") {\n        distanceFn = d;\n      }\n      if (distanceFn && order === 2) {\n        return this.raise().scale(distanceFn);\n      }\n\n      // TODO: add special handling for degenerate (=linear) curves.\n      var clockwise = this.clockwise;\n      var r1 = distanceFn ? distanceFn(0) : d;\n      var r2 = distanceFn ? distanceFn(1) : d;\n      var v = [this.offset(0, 10), this.offset(1, 10)];\n      var o = utils.lli4(v[0], v[0].c, v[1], v[1].c);\n      if (!o) {\n        throw new Error(\"cannot scale this curve. Try reducing it first.\");\n      }\n      // move all points by distance 'd' wrt the origin 'o'\n      var points = this.points,\n        np = [];\n\n      // move end points by fixed distance along normal.\n      [0, 1].forEach(\n        function(t) {\n          var p = (np[t * order] = utils.copy(points[t * order]));\n          p.x += (t ? r2 : r1) * v[t].n.x;\n          p.y += (t ? r2 : r1) * v[t].n.y;\n        }.bind(this)\n      );\n\n      if (!distanceFn) {\n        // move control points to lie on the intersection of the offset\n        // derivative vector, and the origin-through-control vector\n        [0, 1].forEach(\n          function(t) {\n            if (this.order === 2 && !!t) return;\n            var p = np[t * order];\n            var d = this.derivative(t);\n            var p2 = { x: p.x + d.x, y: p.y + d.y };\n            np[t + 1] = utils.lli4(p, p2, o, points[t + 1]);\n          }.bind(this)\n        );\n        return new Bezier(np);\n      }\n\n      // move control points by \"however much necessary to\n      // ensure the correct tangent to endpoint\".\n      [0, 1].forEach(\n        function(t) {\n          if (this.order === 2 && !!t) return;\n          var p = points[t + 1];\n          var ov = {\n            x: p.x - o.x,\n            y: p.y - o.y\n          };\n          var rc = distanceFn ? distanceFn((t + 1) / order) : d;\n          if (distanceFn && !clockwise) rc = -rc;\n          var m = sqrt(ov.x * ov.x + ov.y * ov.y);\n          ov.x /= m;\n          ov.y /= m;\n          np[t + 1] = {\n            x: p.x + rc * ov.x,\n            y: p.y + rc * ov.y\n          };\n        }.bind(this)\n      );\n      return new Bezier(np);\n    },\n    outline: function(d1, d2, d3, d4) {\n      d2 = typeof d2 === \"undefined\" ? d1 : d2;\n      var reduced = this.reduce(),\n        len = reduced.length,\n        fcurves = [],\n        bcurves = [],\n        p,\n        alen = 0,\n        tlen = this.length();\n\n      var graduated = typeof d3 !== \"undefined\" && typeof d4 !== \"undefined\";\n\n      function linearDistanceFunction(s, e, tlen, alen, slen) {\n        return function(v) {\n          var f1 = alen / tlen,\n            f2 = (alen + slen) / tlen,\n            d = e - s;\n          return utils.map(v, 0, 1, s + f1 * d, s + f2 * d);\n        };\n      }\n\n      // form curve oulines\n      reduced.forEach(function(segment) {\n        slen = segment.length();\n        if (graduated) {\n          fcurves.push(\n            segment.scale(linearDistanceFunction(d1, d3, tlen, alen, slen))\n          );\n          bcurves.push(\n            segment.scale(linearDistanceFunction(-d2, -d4, tlen, alen, slen))\n          );\n        } else {\n          fcurves.push(segment.scale(d1));\n          bcurves.push(segment.scale(-d2));\n        }\n        alen += slen;\n      });\n\n      // reverse the \"return\" outline\n      bcurves = bcurves\n        .map(function(s) {\n          p = s.points;\n          if (p[3]) {\n            s.points = [p[3], p[2], p[1], p[0]];\n          } else {\n            s.points = [p[2], p[1], p[0]];\n          }\n          return s;\n        })\n        .reverse();\n\n      // form the endcaps as lines\n      var fs = fcurves[0].points[0],\n        fe = fcurves[len - 1].points[fcurves[len - 1].points.length - 1],\n        bs = bcurves[len - 1].points[bcurves[len - 1].points.length - 1],\n        be = bcurves[0].points[0],\n        ls = utils.makeline(bs, fs),\n        le = utils.makeline(fe, be),\n        segments = [ls]\n          .concat(fcurves)\n          .concat([le])\n          .concat(bcurves),\n        slen = segments.length;\n\n      return new PolyBezier(segments);\n    },\n    outlineshapes: function(d1, d2, curveIntersectionThreshold) {\n      d2 = d2 || d1;\n      var outline = this.outline(d1, d2).curves;\n      var shapes = [];\n      for (var i = 1, len = outline.length; i < len / 2; i++) {\n        var shape = utils.makeshape(\n          outline[i],\n          outline[len - i],\n          curveIntersectionThreshold\n        );\n        shape.startcap.virtual = i > 1;\n        shape.endcap.virtual = i < len / 2 - 1;\n        shapes.push(shape);\n      }\n      return shapes;\n    },\n    intersects: function(curve, curveIntersectionThreshold) {\n      if (!curve) return this.selfintersects(curveIntersectionThreshold);\n      if (curve.p1 && curve.p2) {\n        return this.lineIntersects(curve);\n      }\n      if (curve instanceof Bezier) {\n        curve = curve.reduce();\n      }\n      return this.curveintersects(\n        this.reduce(),\n        curve,\n        curveIntersectionThreshold\n      );\n    },\n    lineIntersects: function(line) {\n      var mx = min(line.p1.x, line.p2.x),\n        my = min(line.p1.y, line.p2.y),\n        MX = max(line.p1.x, line.p2.x),\n        MY = max(line.p1.y, line.p2.y),\n        self = this;\n      return utils.roots(this.points, line).filter(function(t) {\n        var p = self.get(t);\n        return utils.between(p.x, mx, MX) && utils.between(p.y, my, MY);\n      });\n    },\n    selfintersects: function(curveIntersectionThreshold) {\n      var reduced = this.reduce();\n      // \"simple\" curves cannot intersect with their direct\n      // neighbour, so for each segment X we check whether\n      // it intersects [0:x-2][x+2:last].\n      var i,\n        len = reduced.length - 2,\n        results = [],\n        result,\n        left,\n        right;\n      for (i = 0; i < len; i++) {\n        left = reduced.slice(i, i + 1);\n        right = reduced.slice(i + 2);\n        result = this.curveintersects(left, right, curveIntersectionThreshold);\n        results = results.concat(result);\n      }\n      return results;\n    },\n    curveintersects: function(c1, c2, curveIntersectionThreshold) {\n      var pairs = [];\n      // step 1: pair off any overlapping segments\n      c1.forEach(function(l) {\n        c2.forEach(function(r) {\n          if (l.overlaps(r)) {\n            pairs.push({ left: l, right: r });\n          }\n        });\n      });\n      // step 2: for each pairing, run through the convergence algorithm.\n      var intersections = [];\n      pairs.forEach(function(pair) {\n        var result = utils.pairiteration(\n          pair.left,\n          pair.right,\n          curveIntersectionThreshold\n        );\n        if (result.length > 0) {\n          intersections = intersections.concat(result);\n        }\n      });\n      return intersections;\n    },\n    arcs: function(errorThreshold) {\n      errorThreshold = errorThreshold || 0.5;\n      var circles = [];\n      return this._iterate(errorThreshold, circles);\n    },\n    _error: function(pc, np1, s, e) {\n      var q = (e - s) / 4,\n        c1 = this.get(s + q),\n        c2 = this.get(e - q),\n        ref = utils.dist(pc, np1),\n        d1 = utils.dist(pc, c1),\n        d2 = utils.dist(pc, c2);\n      return abs(d1 - ref) + abs(d2 - ref);\n    },\n    _iterate: function(errorThreshold, circles) {\n      var t_s = 0,\n        t_e = 1,\n        safety;\n      // we do a binary search to find the \"good `t` closest to no-longer-good\"\n      do {\n        safety = 0;\n\n        // step 1: start with the maximum possible arc\n        t_e = 1;\n\n        // points:\n        var np1 = this.get(t_s),\n          np2,\n          np3,\n          arc,\n          prev_arc;\n\n        // booleans:\n        var curr_good = false,\n          prev_good = false,\n          done;\n\n        // numbers:\n        var t_m = t_e,\n          prev_e = 1,\n          step = 0;\n\n        // step 2: find the best possible arc\n        do {\n          prev_good = curr_good;\n          prev_arc = arc;\n          t_m = (t_s + t_e) / 2;\n          step++;\n\n          np2 = this.get(t_m);\n          np3 = this.get(t_e);\n\n          arc = utils.getccenter(np1, np2, np3);\n\n          //also save the t values\n          arc.interval = {\n            start: t_s,\n            end: t_e\n          };\n\n          var error = this._error(arc, np1, t_s, t_e);\n          curr_good = error <= errorThreshold;\n\n          done = prev_good && !curr_good;\n          if (!done) prev_e = t_e;\n\n          // this arc is fine: we can move 'e' up to see if we can find a wider arc\n          if (curr_good) {\n            // if e is already at max, then we're done for this arc.\n            if (t_e >= 1) {\n              // make sure we cap at t=1\n              arc.interval.end = prev_e = 1;\n              prev_arc = arc;\n              // if we capped the arc segment to t=1 we also need to make sure that\n              // the arc's end angle is correct with respect to the bezier end point.\n              if (t_e > 1) {\n                var d = {\n                  x: arc.x + arc.r * cos(arc.e),\n                  y: arc.y + arc.r * sin(arc.e)\n                };\n                arc.e += utils.angle({ x: arc.x, y: arc.y }, d, this.get(1));\n              }\n              break;\n            }\n            // if not, move it up by half the iteration distance\n            t_e = t_e + (t_e - t_s) / 2;\n          } else {\n            // this is a bad arc: we need to move 'e' down to find a good arc\n            t_e = t_m;\n          }\n        } while (!done && safety++ < 100);\n\n        if (safety >= 100) {\n          break;\n        }\n\n        // console.log(\"L835: [F] arc found\", t_s, prev_e, prev_arc.x, prev_arc.y, prev_arc.s, prev_arc.e);\n\n        prev_arc = prev_arc ? prev_arc : arc;\n        circles.push(prev_arc);\n        t_s = prev_e;\n      } while (t_e < 1);\n      return circles;\n    }\n  };\n\n  module.exports = Bezier;\n})();\n", "module.exports = require('./lib/bezier');\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { WithSizeDimensionType } from \"document/models/CanvasTree/traits/WithSizeDimensionType.ts\"\nimport type { CenterPins, Pins } from \"document/models/ConstraintSolver.ts\"\nimport type { ConstraintMask, ConstraintValues } from \"library/render/types/Constraints.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport type { WithGridItemLayout } from \"./WithGridItemLayout.ts\"\nimport { gridItemLayoutDefaults } from \"./WithGridItemLayout.ts\"\nimport type { WithSize } from \"./WithSize.ts\"\nimport { sizeDefaults } from \"./WithSize.ts\"\n\nexport interface WithPins extends Pins, WithSize, WithSizeDimensionType, CenterPins, WithGridItemLayout {\n\tconstraintsLocked: boolean\n}\n\nexport interface WithConstraints {\n\tconstraints: () => ConstraintMask\n\tconstraintValues: () => ConstraintValues\n}\n\nexport const pinDefaults: WithPins = {\n\tconstraintsLocked: false,\n\tleft: 0,\n\tright: null,\n\ttop: 0,\n\tbottom: null,\n\tcenterAnchorX: 0,\n\tcenterAnchorY: 0,\n\twidthType: DimensionType.FixedNumber,\n\theightType: DimensionType.FixedNumber,\n\t...sizeDefaults,\n\t...gridItemLayoutDefaults,\n}\n\nconst key: keyof WithPins = \"constraintsLocked\"\n\nexport function isPinnable<T extends CanvasNode>(node: T): node is T & WithPins & WithConstraints {\n\treturn key in node\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport { jst } from \"code-generation/js/js.ts\"\nimport type { SafeJS } from \"code-generation/js/serializeJS.ts\"\nimport type { CanvasNode, CanvasTree, NodeID, RichTextNode } from \"document/models/CanvasTree/index.ts\"\nimport type { ConicGradient, LinearGradient, RadialGradient } from \"document/models/Gradient.ts\"\nimport type { LocalizedValues } from \"document/models/LocalizedValue.ts\"\nimport type { ImageFit } from \"library/render/types/BackgroundImage.ts\"\nimport { Color } from \"library/render/types/Color/index.ts\"\nimport type { RelativeNumber } from \"library/render/types/RelativeNumber.ts\"\nimport { isRelativeNumber } from \"library/render/types/RelativeNumber.ts\"\nimport type { CSSProperties } from \"react\"\nimport { isArray, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { isVectorNode } from \"../nodes/TreeNode.ts\"\nimport {\n\tisFrameNode,\n\tisKitPageNode,\n\tisRichTextNode,\n\tisSVGNode,\n\tisShapeContainerNode,\n} from \"../nodes/utils/nodeCheck.ts\"\nimport type { ComputedValueFromFetchDataValue } from \"./ComputedValue.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\nimport type { VariableReference } from \"./VariableReference.ts\"\nimport { isStylableNode } from \"./utils/hardCodedCodeComponentIdentifierChecks.ts\"\n\nexport type GradientFillType = \"linear-gradient\" | \"radial-gradient\" | \"conic-gradient\"\nexport type FillType = \"color\" | \"image\" | GradientFillType\nexport type FillImagePositionX = \"left\" | \"center\" | \"right\" | RelativeNumber\nexport type FillImagePositionY = \"top\" | \"center\" | \"bottom\" | RelativeNumber\n\nexport type FillImageType = string | VariableReference | ComputedValueFromFetchDataValue | null | undefined\n\nexport interface FillImageAlt {\n\tid: NodeID\n\timage: string\n\talt: string\n}\n\nexport type CanvasNodeWithImageFill = CanvasNode & WithFill & WithOptionalFill\nexport interface WithFill {\n\tfillType: FillType | undefined\n\tfillColor: string | DynamicValue | undefined\n\tfillLinearGradient: LinearGradient | undefined\n\tfillRadialGradient: RadialGradient | undefined\n\tfillConicGradient: ConicGradient | undefined\n\tfillImage: FillImageType\n\tfillImageOriginalName: string | null | undefined\n\tfillImageResize: ImageFit | undefined\n\t/**\n\t * @deprecated Values are likely to be incorrect because historically they have not always been updated.\n\t * Pixel sizes can be extracted from the `fillImage` asset reference where available, or assetMap otherwise.\n\t * Vector nodes with image fill (not currently supported) rely on this value.\n\t */\n\tfillImagePixelWidth: number | null | undefined\n\t/**\n\t * @deprecated Values are likely to be incorrect because historically they have not always been updated.\n\t * Pixel sizes can be extracted from the `fillImage` asset reference where available, or assetMap otherwise.\n\t * Vector nodes with image fill (not currently supported) rely on this value.\n\t */\n\tfillImagePixelHeight: number | null | undefined\n\tfillImagePositionX: FillImagePositionX | undefined\n\tfillImagePositionY: FillImagePositionY | undefined\n\tfillImageTileSize: number | undefined\n}\n\nexport interface WithFillOpacity {\n\tfillOpacity: number | VariableReference | undefined\n}\n\nconst fillOpacityKey = \"fillOpacity\" satisfies keyof WithFillOpacity\nexport function withFillOpacity(node: CanvasNode): node is CanvasNode & WithFillOpacity {\n\treturn fillOpacityKey in node\n}\n\nexport const fillOpacityDefaults: WithFillOpacity = {\n\tfillOpacity: undefined,\n}\n\nexport interface WithFillImageLocalized {\n\tfillImageLocalized: LocalizedValues | undefined\n}\n\nexport interface WithOptionalFill extends WithFill {\n\tfillEnabled: boolean | undefined\n}\nexport interface WithSupportsGradient extends WithFill {\n\tsupportsGradient(): boolean\n}\n\n// We don't want to support image fill on inputs for the meantime,\n// as it would require multiple CSS variables to be created to support\n// background-size, background-position, etc.\nexport type WithInputFill = Omit<\n\tWithOptionalFill,\n\t| \"fillImage\"\n\t| \"fillImageOriginalName\"\n\t| \"fillImageResize\"\n\t| \"fillImagePixelWidth\"\n\t| \"fillImagePixelHeight\"\n\t| \"fillImagePositionX\"\n\t| \"fillImagePositionY\"\n\t| \"fillImageTileSize\"\n>\n\nconst fillKey = \"fillType\" satisfies keyof WithFill\nconst fillEnabledKey = \"fillEnabled\" satisfies keyof WithOptionalFill\nconst supportsGradientKey = \"supportsGradient\" satisfies keyof WithSupportsGradient\nconst fillImageLocalizedKey: keyof WithFillImageLocalized = \"fillImageLocalized\"\n\nexport function withFill<T extends CanvasNode>(node: T): node is T & WithFill {\n\treturn fillKey in node && isStylableNode(node)\n}\n\nexport function withOptionalFill<T extends CanvasNode>(node: T): node is T & WithOptionalFill {\n\treturn fillEnabledKey in node && isStylableNode(node)\n}\n\nexport function hasFillEnabled(node: CanvasNode): node is CanvasNode & WithFill {\n\tif (!withFill(node)) return false\n\tif (!withOptionalFill(node)) return true\n\treturn Boolean(node.fillEnabled)\n}\n\nexport function withFillImageLocalized(node: CanvasNode): node is CanvasNode & WithFillImageLocalized {\n\treturn fillImageLocalizedKey in node\n}\n\nfunction withSupportsGradient(node: CanvasNode): node is CanvasNode & WithSupportsGradient {\n\treturn supportsGradientKey in node && isStylableNode(node)\n}\n\nexport function supportsGradientProps(node: CanvasNode): node is CanvasNode & WithFill {\n\tif (!isStylableNode(node)) return false\n\treturn withSupportsGradient(node) ? node.supportsGradient() : withFill(node)\n}\n\nexport function supportsGradient(node: CanvasNode | RichTextNode): node is (CanvasNode & WithFill) | RichTextNode {\n\treturn isRichTextNode(node) || supportsGradientProps(node)\n}\n\nexport function supportsConicGradient(node: CanvasNode) {\n\treturn supportsGradient(node) && !(isVectorNode(node) || isShapeContainerNode(node) || isSVGNode(node))\n}\n\nexport function isGradientFillType(fillType: FillType | undefined): fillType is GradientFillType {\n\treturn fillType === \"linear-gradient\" || fillType === \"radial-gradient\" || fillType === \"conic-gradient\"\n}\n\nexport function hasActiveGradientFill(node: (CanvasNode & WithFill) | RichTextNode) {\n\treturn supportsGradientProps(node) ? isGradientFillType(node.fillType) : node.getFills().filter(Boolean).length\n}\n\nexport function hasActiveImageFill(node: CanvasNode & WithFill & WithOptionalFill) {\n\treturn node.fillEnabled && node.fillType === \"image\" && node.fillImage !== null\n}\n\nexport function hasFocalPoint(node: CanvasNode & WithFill) {\n\treturn withFill(node) && isRelativeNumber(node.fillImagePositionX) && isRelativeNumber(node.fillImagePositionY)\n}\n\nexport function hasImageFill<T extends CanvasNode>(node: T): node is T & CanvasNodeWithImageFill {\n\tif (withOptionalFill(node) && !node.fillEnabled) {\n\t\treturn false\n\t}\n\n\treturn withFill(node) && node.fillType === \"image\"\n}\n\nexport function hasTransparentFill(node: CanvasNode & WithFill): boolean {\n\tif (!node.fillType) return false\n\n\tswitch (node.fillType) {\n\t\tcase \"color\": {\n\t\t\tconst fillColor = node.resolveValue(\"fillColor\")\n\t\t\tif (!fillColor) return false\n\n\t\t\tconst color = Color(fillColor)\n\t\t\treturn color.a === 0\n\t\t}\n\t\tcase \"linear-gradient\": {\n\t\t\tif (!node.fillLinearGradient) return false\n\t\t\treturn node.fillLinearGradient.alpha === 0\n\t\t}\n\t\tcase \"radial-gradient\": {\n\t\t\tif (!node.fillRadialGradient) return false\n\t\t\treturn node.fillRadialGradient.alpha === 0\n\t\t}\n\t\tcase \"conic-gradient\": {\n\t\t\tif (!node.fillConicGradient) return false\n\t\t\treturn node.fillConicGradient.alpha === 0\n\t\t}\n\t\tcase \"image\":\n\t\t\treturn false\n\t\tdefault:\n\t\t\tassertNever(node.fillType)\n\t}\n}\n\nexport function hasVisibleFill(node: CanvasNode): node is CanvasNode & WithFill {\n\tif (!withFill(node)) {\n\t\treturn false\n\t}\n\tif (withOptionalFill(node) && !node.fillEnabled) {\n\t\treturn false\n\t}\n\treturn !hasTransparentFill(node)\n}\n\nexport function fillImageFitFromObjectFit(objectFit: CSSProperties[\"objectFit\"]): ImageFit {\n\tswitch (objectFit) {\n\t\tcase undefined:\n\t\tcase \"contain\":\n\t\t\treturn \"fit\"\n\t\tdefault:\n\t\t\treturn \"fill\"\n\t}\n}\n\nexport interface WithFillImageAlts {\n\tfillImageAlts: readonly FillImageAlt[] | undefined\n}\n\nconst fillImageAltsKey = \"fillImageAlts\" satisfies keyof WithFillImageAlts\nexport function withFillImageAlts(node: CanvasNode): node is CanvasNode & WithFillImageAlts {\n\treturn fillImageAltsKey in node\n}\n\n/**\n * Whether the node supports fill image alts, this is only supported for images in kit pages.\n */\nexport function supportsFillImageAlts(tree: CanvasTree, node: CanvasNode): boolean {\n\tif (!withOptionalFill(node) || !node.fillEnabled) return false\n\tif (!hasActiveImageFill(node)) return false\n\tif (!withFillImageAlts(node)) return false\n\n\tconst scopeNode = tree.getScopeNodeFor(node)\n\treturn isKitPageNode(scopeNode)\n}\n\nexport function hasAnyFillImageAlts(node: CanvasNode): node is CanvasNode & WithFill & WithFillImageAlts {\n\tif (!isFrameNode(node) || !withFill(node) || !withFillImageAlts(node)) return false\n\tif (node.fillType !== \"image\") return false\n\n\treturn isArray(node.fillImageAlts) && node.fillImageAlts.length > 0\n}\n\nfunction hasAnyGradientFill<N extends CanvasNode>(\n\tnode: N | null | undefined,\n): node is N & WithFill & WithSupportsGradient {\n\tif (!node || !withFill(node)) return false\n\treturn isGradientFillType(node.fillType)\n}\n\nexport interface GradientInfo {\n\ttype: GradientFillType\n\tangle: number\n}\n\nexport interface VariantGradientInfo {\n\tstops: number\n\tinfo: GradientInfo\n}\n\nexport function getGradientInfo(node: CanvasNode): VariantGradientInfo | undefined {\n\tif (!hasAnyGradientFill(node)) return undefined\n\tif (isUndefined(node.fillType)) return undefined\n\n\tswitch (node.fillType) {\n\t\tcase \"image\":\n\t\tcase \"color\":\n\t\t\treturn undefined\n\t\tcase \"linear-gradient\": {\n\t\t\tconst stops = node.fillLinearGradient?.stops.length\n\t\t\tif (!stops) return undefined\n\t\t\tconst angle = node.fillLinearGradient?.angle\n\t\t\tif (isUndefined(angle)) return undefined\n\t\t\treturn { stops, info: { type: node.fillType, angle } }\n\t\t}\n\t\tcase \"radial-gradient\": {\n\t\t\tconst stops = node.fillRadialGradient?.stops.length\n\t\t\tif (!stops) return undefined\n\t\t\treturn { stops, info: { type: node.fillType, angle: 0 } }\n\t\t}\n\t\tcase \"conic-gradient\": {\n\t\t\tconst stops = node.fillConicGradient?.stops.length\n\t\t\tif (!stops) return undefined\n\t\t\tconst angle = node.fillLinearGradient?.angle\n\t\t\tif (isUndefined(angle)) return undefined\n\t\t\treturn { stops, info: { type: node.fillType, angle } }\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(node.fillType)\n\t}\n}\n\nexport function generateGradientStopsSafeJS(stopCount: number, binding: SafeJS, gradientType: GradientFillType) {\n\tconst maxValue = gradientType === \"conic-gradient\" ? 360 : 100\n\tconst suffix = gradientType === \"conic-gradient\" ? \"deg\" : \"%\"\n\n\treturn jst.join(\n\t\tArray.from({ length: stopCount }).map(\n\t\t\t(_, index) => jst`${binding} ${Math.round((index / (stopCount - 1)) * maxValue)}${suffix}`,\n\t\t),\n\t\t\", \",\n\t)\n}\n\nexport const validPositionXValues = [\"left\", \"center\", \"right\"] satisfies FillImagePositionX[]\nconst validPositionXValuesSet = new Set<string>(validPositionXValues)\n\nexport const validPositionYValues = [\"top\", \"center\", \"bottom\"] satisfies FillImagePositionY[]\nconst validPositionYValuesSet = new Set<string>(validPositionYValues)\n\nexport function isValidFillImagePosition(value: unknown, positionType: \"y\"): value is FillImagePositionY\nexport function isValidFillImagePosition(value: unknown, positionType: \"x\"): value is FillImagePositionX\nexport function isValidFillImagePosition(\n\tvalue: unknown,\n\tpositionType: \"x\" | \"y\",\n): value is FillImagePositionX | FillImagePositionY {\n\tif (!isString(value)) return false\n\tif (positionType === \"y\" && validPositionYValuesSet.has(value)) return true\n\tif (positionType === \"x\" && validPositionXValuesSet.has(value)) return true\n\treturn isRelativeNumber(value)\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport type { CollectionNode } from \"document/models/CanvasTree/index.ts\"\nimport type { VariableDefinition, VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\n\n// WARNING: Don't change the value of this variable as it's used in code\n// generation so it needs to be backwards compatible.\nexport const previousItemVariableId = \"previousItemId\" satisfies VariableID\n\nexport function getPreviousItemVariable(collection: CollectionNode): VariableDefinition {\n\treturn {\n\t\ttype: ControlType.CollectionReference,\n\t\tname: Dictionary.Previous,\n\t\tid: previousItemVariableId,\n\t\tdataIdentifier: collection.instanceIdentifier,\n\t\tinitialValue: undefined,\n\t\texposeInProps: true,\n\t}\n}\n\n// WARNING: Don't change the value of this variable as it's used in code\n// generation so it needs to be backwards compatible.\nexport const nextItemVariableId = \"nextItemId\" satisfies VariableID\n\nexport function getNextItemVariable(collection: CollectionNode): VariableDefinition {\n\treturn {\n\t\ttype: ControlType.CollectionReference,\n\t\tname: Dictionary.Next,\n\t\tid: nextItemVariableId,\n\t\tdataIdentifier: collection.instanceIdentifier,\n\t\tinitialValue: undefined,\n\t\texposeInProps: true,\n\t}\n}\n\nexport function isCollectionNavigationVariableId(variableId: VariableID) {\n\treturn variableId === previousItemVariableId || variableId === nextItemVariableId\n}\n\n// WARNING: Don't change the value of this variable as it's used in code\n// generation so it needs to be backwards compatible.\nexport const createdAtVariableId = \"createdAt\" satisfies VariableID\n\nexport function getCreatedAtVariable(): VariableDefinition {\n\treturn {\n\t\ttype: ControlType.Date,\n\t\tname: Dictionary.CreatedAt,\n\t\tid: createdAtVariableId,\n\t\tinitialValue: undefined,\n\t\texposeInProps: true,\n\t}\n}\n\n// WARNING: Don't change the value of this variable as it's used in code\n// generation so it needs to be backwards compatible.\nexport const updatedAtVariableId = \"updatedAt\" satisfies VariableID\n\nexport function getUpdatedAtVariable(): VariableDefinition {\n\treturn {\n\t\ttype: ControlType.Date,\n\t\tname: Dictionary.UpdatedAt,\n\t\tid: updatedAtVariableId,\n\t\tinitialValue: undefined,\n\t\texposeInProps: true,\n\t}\n}\n", "import type { DataDefinition } from \"@framerjs/framer-runtime\"\nimport { assert } from \"@framerjs/shared\"\nimport type { SandboxRepeaterData } from \"document/SandboxRepeaterData.ts\"\nimport type { CanvasTree, CollectionItemNode, CollectionNode } from \"document/models/CanvasTree/index.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport {\n\tisCollectionItemNode,\n\tisCollectionNode,\n\tisRichTextNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isComputedValueFromVariableReference } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport {\n\ttype VariableReference,\n\tcreateVariableReference,\n\tisVariableReference,\n} from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { hasImageFill } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport type { VariableDefinition, VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { nextItemVariableId, previousItemVariableId } from \"document/utils/CollectionItemVariables.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\n\nexport const separator = \".\"\n\nexport function isReferenceToTailVariableId(referenceId: VariableID, variableId: VariableID) {\n\treturn referenceId === variableId || isNestedReferenceToVariableId(referenceId, variableId)\n}\n\nexport function isNestedReferenceToVariableId(referenceId: VariableID, variableId: VariableID) {\n\treturn referenceId.endsWith(variableId) && referenceId[referenceId.length - variableId.length - 1] === separator\n}\n\nexport function isNestedVariableSelected(referenceId: VariableID, variableId: VariableID) {\n\treturn referenceId.startsWith(variableId) && referenceId[variableId.length] === separator\n}\n\nexport function isNestedVariableId(variableId: VariableID) {\n\treturn variableId.includes(separator)\n}\n\nexport function isNestedVariable(variable: VariableDefinition) {\n\treturn isNestedVariableId(variable.id)\n}\n\nexport function getNestedVariableId(parentVariableId: VariableID | undefined, childVariableId: VariableID) {\n\tif (parentVariableId) {\n\t\treturn parentVariableId + separator + childVariableId\n\t} else {\n\t\treturn childVariableId\n\t}\n}\n\nexport function getParentVariableId(variableId: VariableID) {\n\tconst index = variableId.lastIndexOf(separator)\n\tif (index < 0) return undefined\n\n\treturn variableId.slice(0, index)\n}\n\nexport function createNestedVariableReference(\n\tparentVariableId: VariableID | undefined,\n\tchildVariableId: VariableID,\n\tproviderId: NodeID,\n) {\n\tconst nestedVariableId = getNestedVariableId(parentVariableId, childVariableId)\n\treturn createVariableReference(nestedVariableId, providerId)\n}\n\n/**\n * Determines if a variable definition is the internal \"id\" variable\n */\nexport function isTopLevelIdVariableId(variableId: VariableID) {\n\treturn variableId === \"id\"\n}\n\n/**\n * Determines whether a variable is a top level ID or a nested ID for a reference\n */\nexport function isIdVariableId(variableId: VariableID) {\n\treturn isReferenceToTailVariableId(variableId, \"id\")\n}\n\nexport function dataDefinitionHasCollectionReference(definition: DataDefinition) {\n\tconst controls = Object.entries(definition.properties)\n\n\tfor (const [key, control] of controls) {\n\t\tif (isTopLevelIdVariableId(key)) continue\n\t\tif (control?.type === ControlType.CollectionReference) return true\n\t\tif (control?.type === ControlType.MultiCollectionReference) return true\n\t}\n\n\treturn false\n}\n\nexport type VariablePath = [VariableID, ...VariableID[]]\n\nexport function splitVariableId(variableId: VariableID): VariablePath {\n\treturn variableId.split(separator)\n}\n\nexport function joinVariableId(variablePath: VariableID[]): VariableID {\n\treturn variablePath.join(separator)\n}\n\nexport function getEditableNestedVariableReference(node: CanvasNode): VariableReference | undefined {\n\tif (hasImageFill(node) && isVariableReference(node.fillImage) && isNestedVariableId(node.fillImage.id)) {\n\t\treturn node.fillImage\n\t}\n\n\tif (isRichTextNode(node)) {\n\t\tif (isComputedValueFromVariableReference(node.textContent) && isNestedVariableId(node.textContent.startValue.id)) {\n\t\t\treturn node.textContent.startValue\n\t\t}\n\n\t\tif (isVariableReference(node.htmlContent) && isNestedVariableId(node.htmlContent.id)) {\n\t\t\treturn node.htmlContent\n\t\t}\n\n\t\tif (isVariableReference(node.textContent) && isNestedVariableId(node.textContent.id)) {\n\t\t\treturn node.textContent\n\t\t}\n\t}\n}\n\n/**\n * when editing or highlighting collection variables, we need to consider that variableId might look like path - including another collection item ids, or use \"nextItem\"/\"previousItem\" constants in path.\n * For both editing and highlighting, we want:\n * - if variableId starts with \"nextItem\"/\"previousItem\" - use correct collectionItem neighbor instead of collectionItem itself\n * - if there are no nested references (variableId is just one string id, or \"nextItem.{someId}\") - just return collection item and variable id\n * - if there are nested references (variable id looks like \"varId_1.varId_2.varId_3\") - return last **reference** variable in chain:\n * if collection_item_1 varId_1 references collection_item_2 varId_2, and it references collection_item_3 varId_3,\n * we want to highlight/edit varId_2, not varId_3\n */\nexport function resolveEditableCollectionVariableAsPath(\n\ttree: CanvasTree,\n\tsandboxRepeaterData: SandboxRepeaterData,\n\tvariableId: string,\n\tcollectionItemNode: CollectionItemNode,\n\tcollectionNode: CollectionNode,\n):\n\t| {\n\t\t\tcollectionItemNode: CollectionItemNode\n\t\t\tcollectionNode: CollectionNode\n\t\t\tvariableId: VariableID\n\t  }\n\t| undefined {\n\tif (!isNestedVariableId(variableId)) {\n\t\treturn {\n\t\t\tcollectionItemNode,\n\t\t\tcollectionNode,\n\t\t\tvariableId,\n\t\t}\n\t}\n\n\tconst chainOfCollectionItems = traverseVariableReference(\n\t\ttree,\n\t\tsandboxRepeaterData,\n\t\tvariableId,\n\t\tcollectionItemNode,\n\t\tcollectionNode,\n\t)\n\n\tif (chainOfCollectionItems.length === 0) return undefined\n\n\tlet lastReference: CollectionReferenceChainLink | undefined\n\tif (chainOfCollectionItems.length === 1) {\n\t\tlastReference = chainOfCollectionItems[0]\n\t} else if (chainOfCollectionItems.length > 1) {\n\t\t// if chain is longer than 1 (so it includes at least one collection reference), we don't want to highlight/edit last variable,\n\t\t// we want to get the last reference variable (so - second from the end)\n\t\tlastReference = chainOfCollectionItems[chainOfCollectionItems.length - 2]\n\t}\n\n\tconst { collectionItemNode: finalCollectionItemNode, variableId: finalVariableId } = lastReference ?? {}\n\tif (!finalCollectionItemNode || !finalVariableId) return undefined\n\n\tconst finalCollectionNode = tree.getNodeWithTrait(finalCollectionItemNode.parentid, isCollectionNode)\n\tif (!finalCollectionNode) return undefined\n\n\treturn {\n\t\tcollectionItemNode: finalCollectionItemNode,\n\t\tcollectionNode: finalCollectionNode,\n\t\tvariableId: finalVariableId,\n\t}\n}\n\ninterface CollectionReferenceChainLink {\n\tcollectionItemNode: CollectionItemNode\n\tvariableId: VariableID\n}\ntype CollectionReferenceChain = CollectionReferenceChainLink[]\n/**\n * Handles nested collection references:\n * Constructs a \"linked list\"-like array of collection with tuples like [CollectionItemNode, VariableId][],\n * where VariableId is id of variable reference to next CollectionItemNode, or - for the last item - just id of a normal variable\n * */\nfunction traverseVariableReference(\n\ttree: CanvasTree,\n\tsandboxRepeaterData: SandboxRepeaterData,\n\tvariableId: string,\n\tcollectionItem: CollectionItemNode,\n\tcollectionNode: CollectionNode,\n): CollectionReferenceChain {\n\tconst variablePath = splitVariableId(variableId)\n\n\tconst isNext = variablePath[0] === nextItemVariableId\n\tconst isPrevious = variablePath[0] === previousItemVariableId\n\n\tif (isNext || isPrevious) {\n\t\tconst offset = isNext ? 1 : -1\n\t\tconst collectionItems = collectionNode.getSortedChildren(\"public-only\", \"group-drafts\")\n\t\tconst collectionItemIndex = collectionItems.findIndex(child => child.id === collectionItem.id)\n\t\tif (collectionItemIndex === -1) return []\n\n\t\tconst shiftedCollectionItem = collectionItems[collectionItemIndex + offset]\n\t\tif (!shiftedCollectionItem) return []\n\n\t\treturn traverseVariableReference(\n\t\t\ttree,\n\t\t\tsandboxRepeaterData,\n\t\t\tjoinVariableId(variablePath.slice(1)),\n\t\t\tshiftedCollectionItem,\n\t\t\tcollectionNode,\n\t\t)\n\t}\n\n\tconst collectionChain: CollectionReferenceChain = [\n\t\t{ collectionItemNode: collectionItem, variableId: variablePath[0] },\n\t]\n\n\t// iterating through variablePath, if variable id references a collection item - getting it and continue iterating,\n\t// if not (usually because it is just a last one) - breaking the loop\n\tlet nextCollectionItem = collectionItem\n\tfor (let i = 0; i < variablePath.length; i++) {\n\t\tconst currentVariableId = variablePath[i]\n\t\tif (!currentVariableId) break\n\n\t\tconst controlProp = nextCollectionItem.getControlProp(currentVariableId)\n\t\tif (controlProp?.type !== ControlType.CollectionReference) {\n\t\t\tbreak\n\t\t}\n\n\t\tassert(!isVariableReference(controlProp.value), \"Collections don't support variables\")\n\n\t\tconst referencedCollectionItem = tree.getNodeWithTrait(controlProp.value, isCollectionItemNode)\n\t\tif (!referencedCollectionItem) break\n\n\t\tnextCollectionItem = referencedCollectionItem\n\n\t\tconst nextVariableId = variablePath[i + 1]\n\t\tif (!nextVariableId) break\n\n\t\tcollectionChain.push({ collectionItemNode: nextCollectionItem, variableId: nextVariableId })\n\t}\n\n\treturn collectionChain\n}\n", "import { getServiceMap } from \"@framerjs/shared\"\n\nconst modulesShortLinkPrefix = getServiceMap().modulesShortLink\n\nexport function withPublishedModulePrefix(modulePath: string): string {\n\treturn `${modulesShortLinkPrefix}/${modulePath}`\n}\n", "import { hostInfo } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { withPublishedModulePrefix } from \"document/components/chrome/insertSidebar/dataSources/withPublishedModulePrefix.ts\"\nimport type { SemanticVersion } from \"document/components/chrome/insertSidebar/types.ts\"\nimport type { ModuleLookupQuery } from \"document/stores/ModulesStore.ts\"\n\nexport interface ModuleComponent {\n\ttitle: string\n\tmoduleURL: string\n\tmoduleVersion: SemanticVersion\n\texportSpecifier?: string\n}\n\nexport const moduleComponents = {\n\tvideo: {\n\t\ttitle: Dictionary.Video,\n\t\tmoduleURL: withPublishedModulePrefix(\"framer/Video\"),\n\t\tmoduleVersion: \"1.14.4\",\n\t\texportSpecifier: \"Video\",\n\t},\n\tyoutube: {\n\t\ttitle: \"YouTube\",\n\t\tmoduleURL: withPublishedModulePrefix(\"framer/Youtube\"),\n\t\tmoduleVersion: \"1.6.1\",\n\t\texportSpecifier: \"Youtube\",\n\t},\n\tvimeo: {\n\t\ttitle: \"Vimeo\",\n\t\tmoduleURL: withPublishedModulePrefix(\"framer/vimeo\"),\n\t\tmoduleVersion: \"0.7.0\",\n\t},\n\ttwitter: {\n\t\ttitle: \"X\",\n\t\tmoduleURL: withPublishedModulePrefix(\"framer/twitter\"),\n\t\tmoduleVersion: \"0.2.3\",\n\t},\n\tsearch: {\n\t\ttitle: \"Search\",\n\t\tmoduleURL: withPublishedModulePrefix(\"framer/search\"),\n\t\tmoduleVersion: \"1.59.0\",\n\t},\n\tlocaleSelector: {\n\t\ttitle: \"Locale Selector\",\n\t\tmoduleURL: withPublishedModulePrefix(\"framer/LocaleSelector\"),\n\t\tmoduleVersion: \"0.11.0\",\n\t},\n\tcodeblock: {\n\t\ttitle: \"Code Block\",\n\t\tmoduleURL: withPublishedModulePrefix(\"framer/CodeBlock\"),\n\t\tmoduleVersion: \"1.5.6\",\n\t},\n\tformInput: {\n\t\ttitle: Dictionary.Input,\n\t\tmoduleURL: withPublishedModulePrefix(\"framer/form-input\"),\n\t\tmoduleVersion: \"0.7.0\",\n\t},\n\tformSelect: {\n\t\ttitle: Dictionary.Select,\n\t\tmoduleURL: withPublishedModulePrefix(\"framer/form-select\"),\n\t\tmoduleVersion: \"0.7.0\",\n\t},\n\tformCheckbox: {\n\t\ttitle: Dictionary.Checkbox,\n\t\tmoduleURL: withPublishedModulePrefix(\"framer/form-checkbox\"),\n\t\tmoduleVersion: \"0.3.0\",\n\t},\n\tformButton: {\n\t\ttitle: Dictionary.Button,\n\t\tmoduleURL: withPublishedModulePrefix(\"framer/form-button\"),\n\t\tmoduleVersion: \"0.7.0\",\n\t},\n\tsubmitButton: {\n\t\ttitle: \"Submit Button\",\n\t\tmoduleURL: withPublishedModulePrefix(\"framer/Submit\"),\n\t\tmoduleVersion: \"0.6.0\",\n\t},\n\tloadMoreButton: {\n\t\ttitle: \"Load More Button\",\n\t\tmoduleURL: withPublishedModulePrefix(\"framer/LoadMore\"),\n\t\tmoduleVersion: \"0.8.1\",\n\t},\n\tinfiniteScroll: {\n\t\ttitle: \"Spinner\",\n\t\tmoduleURL: withPublishedModulePrefix(\"framer/InfiniteScroll\"),\n\t\tmoduleVersion: \"0.11.0\",\n\t},\n\ttab: {\n\t\ttitle: \"Tab\",\n\t\tmoduleURL: withPublishedModulePrefix(\"framer/FilterTab\"),\n\t\tmoduleVersion: \"0.6.0\",\n\t},\n} as const satisfies Record<string, ModuleComponent>\n\nexport function getLookupQueryForModuleComponent(item: ModuleComponent): ModuleLookupQuery {\n\tlet url = item.moduleURL\n\n\tif (item.moduleVersion && hostInfo.isProduction) {\n\t\turl += `@${item.moduleVersion}`\n\t}\n\n\treturn { url }\n}\n", "import type { ExperimentName } from \"@framerjs/app-config\"\nimport type { ModulesAPI } from \"@framerjs/framer-services\"\nimport type { ExternalModuleExportIdentifier } from \"@framerjs/shared\"\nimport { asGlobalId, externalModuleIdentifier, hostInfo } from \"@framerjs/shared\"\nimport type { AppAction } from \"app/AppActions.ts\"\nimport type { ProjectFeatureName } from \"app/projectFeatures.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { StylePresetNode } from \"document/models/CanvasTree/nodes/utils/isStylePresetNode.ts\"\nimport type { CSSCursor } from \"document/models/CanvasTree/traits/WithCursor.ts\"\nimport type { ControlProps } from \"document/models/controlProps/ControlProp.ts\"\nimport type { ControlType } from \"library/index.ts\"\nimport type { FramerLayersClipboardData } from \"utils/clipboard/helpers/types.ts\"\n\nexport type InsertContextType =\n\t/** Active when on a canvas page, and within smart component when document contains any canvas pages. */\n\t| \"prototyping\"\n\t/** Active when on a web page, and within smart component when document contains any web pages. */\n\t| \"webdesign\"\n\t/** Active when on a web page. */\n\t| \"webpage\"\n\t/** Active when on a web page and document contains any canvas pages. */\n\t| \"webpage-with-canvas-pages-in-document\"\n\nexport type HoverEffect = \"highlight\" | \"grow\"\n\nexport enum EditBehavior {\n\t/* Default behavior, user will see the unlink modal */\n\tPrompt = \"prompt\",\n\t/* Block unlinking and autodetaching */\n\tBlock = \"block\",\n\t/* Component with auto unlink when a user tries to edit it behavior */\n\tAutoUnlink = \"autoUnlink\",\n\t/* Component with auto detach when a user tries to edit it behavior */\n\tAutoDetach = \"autoDetach\",\n}\n\nexport enum NavigationBehavior {\n\t/* Default behavior, a new side panel is pushed */\n\tPush = \"push\",\n\t/* The new side panel replaces the current one */\n\tReplace = \"replace\",\n}\n\nexport interface ModuleEditBehavior {\n\tmoduleURL: string\n\tmoduleVersion: string\n\teditBehavior: EditBehavior\n\tmodule?: ModulesAPI.ModuleWithSave\n}\n\nexport type VariantName = \"desktop\" | \"tablet\" | \"phone\"\nexport type LayoutVariants = Set<VariantName>\n\nexport type ColorScheme = \"light\" | \"dark\"\n\ninterface DataSourceItemBase {\n\tkey: string\n\ttitle: string\n\tkeywords: string | null\n\texperimentIsOn?: ExperimentName\n\texperimentIsNotOn?: ExperimentName\n\tprojectFeatureIsOn?: ProjectFeatureName\n\tvisibleInContext?: InsertContextType\n\timage: string\n\timageDark?: string\n\tagentTitle?: string\n\tagentPreviewIcon?: React.FunctionComponent\n\tagentPreviewImage?: string\n\tagentPreviewImageLight?: string\n\tagentPreviewWidth?: number\n\tagentPreviewHeight?: number\n\tpreviewPadding?: number\n\tminWidth?: number\n\tminHeight?: number\n\tpreviewWidth?: number\n\tpreviewHeight?: number\n\tpreviewRadius?: number\n\twrapperHeight?: number\n\ttrackingType?: ControlType\n}\n\nexport interface DataSourceClipboardDataItem\n\textends DataSourceItemBase,\n\t\tDataSourceItemAspectRatio,\n\t\tDataSourceItemIntrinsicSize {\n\tclipboardData: () => Promise<FramerLayersClipboardData>\n}\n\nconst clipboardDataItemKey: keyof DataSourceClipboardDataItem = \"clipboardData\"\n\nexport function isClipboardDataItem<T extends DataSourceItemBase>(item: T): item is T & DataSourceClipboardDataItem {\n\treturn clipboardDataItemKey in item\n}\n\ninterface DataSourceItemIntrinsicSize {\n\tintrinsicWidth: number\n\tintrinsicHeight: number\n}\n\nexport function withIntrinsicSize<T extends DataSourceItemBase>(item: T): item is T & DataSourceItemIntrinsicSize {\n\treturn \"intrinsicWidth\" in item && \"intrinsicHeight\" in item\n}\n\ninterface DataSourceItemAspectRatio {\n\t/**\n\t * The aspect ratio of the thumbnail image of this item\n\t */\n\taspectRatio: number\n}\n\ninterface DataSourceItemFullWidth {\n\tfullWidth?: boolean\n}\n\nexport function withFullWidth<T extends DataSourceItemBase>(item: T): item is T & DataSourceItemFullWidth {\n\treturn \"fullWidth\" in item\n}\n\ntype DataSourceItemPreviewSize = DataSourceItemAspectRatio | DataSourceItemFullWidth\n\ntype DataSourceItemCanvas = DataSourceItemBase & DataSourceItemIntrinsicSize & DataSourceItemPreviewSize\n\ninterface DataSourceItemTint {\n\ttint: string\n\tbackgroundLight: string\n\tbackgroundDark: string\n}\n\nconst tintKey: keyof DataSourceItemTint = \"tint\"\n\nexport function hasTint<T extends DataSourceItemBase>(item: T): item is T & DataSourceItemTint {\n\treturn tintKey in item\n}\n\ninterface WithHideTitle {\n\thideTitle: boolean\n}\n\nconst withHideTitleItemKey: keyof WithHideTitle = \"hideTitle\"\n\nexport function withHideTitle<T extends DataSourceItemBase>(item: T): item is T & { hideTitle: boolean } {\n\treturn withHideTitleItemKey in item\n}\n\ninterface FillImageUploadDataSourceItem extends DataSourceItemBase {\n\timageToUpload: ImageToUpload\n}\n\nconst fillImageUploadKey: keyof FillImageUploadDataSourceItem = \"imageToUpload\"\nexport function hasFillImageUpload<T extends DataSourceItemBase>(item: T): item is T & FillImageUploadDataSourceItem {\n\treturn fillImageUploadKey in item\n}\n\ninterface NodeWithPresets {\n\tnode: CanvasNode\n\tstylePresets: StylePresetNode[]\n}\n\nexport interface DataSourceItemGenerateNodes\n\textends DataSourceItemBase,\n\t\tDataSourceItemIntrinsicSize,\n\t\tDataSourceItemFullWidth,\n\t\tWithHideTitle {\n\t/**\n\t * A list of nodes that have to be regenerated before inserting the item.\n\t */\n\tnodesToRegenerate?: NodeID[]\n\tgenerateNodes(engine: VekterEngine): Promise<CanvasNode | NodeWithPresets> | CanvasNode | NodeWithPresets\n}\n\nconst generateNodesKey: keyof DataSourceItemGenerateNodes = \"generateNodes\"\n\nexport function hasGenerateNodes<T extends DataSourceItemBase>(item: T): item is T & DataSourceItemGenerateNodes {\n\treturn generateNodesKey in item\n}\n\nexport type SemanticVersion = `${number}.${number}.${number}`\n\nexport interface DataSourceItemModuleURL {\n\t/**\n\t * The imported module items are published from several FramerStudio projects:\n\t * - Default Components: https://beta.framer.com/projects/Default-Components--i0RbOs7pE8lGyow8pxuq-jpuxN\n\t * - Layout Components: https://beta.framer.com/projects/Layout-Components-V2--drFka7FnqAVU88bSsURC-dWx7t\n\t * - Carousel, Ticker and Slideshow: https://beta.framer.com/projects/Carousel-and-Ticker--oKbEQPOy8myK6skszOzS\n\t * - Integrations: https://beta.framer.com/projects/Integrations--d2UBW78WE2gcmgZ3knHa-giobD\n\t * - Insert Layouts: https://beta.framer.com/projects/Insert-Layouts--jCmKo739Vq1OnviamU8K-iayMy?node=FDVrn9jFr\n\t */\n\tmoduleURL: string\n\tmoduleVersion: SemanticVersion\n\tmodule?: ModulesAPI.ModuleWithSave\n\tmoduleAvailableOnDevelopment?: boolean\n\t/** Defaults to \"default\" */\n\texportSpecifier?: string\n\tcontrolProps?: ControlProps\n\tshouldDetachOnInsert?: boolean\n\tshouldReplaceFloatingPosition?: boolean\n\n\tshouldBecomeFullWidthForVariants?: LayoutVariants\n\t/** Cursor that will be added on drop. */\n\tcursor?: CSSCursor\n}\n\nconst moduleURLKey: keyof DataSourceItemModuleURL = \"moduleURL\"\n\nexport function hasModuleURL<T extends DataSourceItemBase>(item: T): item is T & DataSourceItemModuleURL {\n\treturn moduleURLKey in item\n}\n\nconst useProductionModuleURL = \"https://framer.dev/m/framer/UseProduction.js\"\n\nexport function normalizeModuleURLItemForCurrentEnvironment<T extends DataSourceItemModuleURL>(\n\titem: T,\n\tisProduction = hostInfo.isProduction,\n): T {\n\tif (isProduction) {\n\t\treturn { ...item }\n\t}\n\n\tif (item.moduleAvailableOnDevelopment) {\n\t\treturn {\n\t\t\t...item,\n\t\t\t// Development uses unversioned modules for the items that are available locally.\n\t\t\tmoduleVersion: \"\" as unknown as SemanticVersion,\n\t\t}\n\t}\n\n\treturn {\n\t\t...item,\n\t\tmoduleURL: useProductionModuleURL,\n\t\tmoduleVersion: \"0.1.0\",\n\t\texportSpecifier: \"default\",\n\t}\n}\n\nexport function getModuleIdentifierForItem(item: DataSourceItemModuleURL): ExternalModuleExportIdentifier | undefined {\n\tif (!item.module) return\n\tif (!item.module.files.module) return\n\n\treturn externalModuleIdentifier(\n\t\tasGlobalId(item.module.id),\n\t\titem.module.saveId,\n\t\titem.module.files.module,\n\t\titem.exportSpecifier ?? \"default\",\n\t)\n}\n\nexport type IntegrationsDataSourceItem = DataSourceItemBase &\n\tDataSourceItemTint &\n\tDataSourceItemModuleURL &\n\tDataSourceItemIntrinsicSize &\n\tDataSourceItemFullWidth\n\ntype LayoutsDataSourceItem = DataSourceItemCanvas & DataSourceItemModuleURL\n\nexport type ComponentsDataSourceItem = DataSourceItemCanvas &\n\tDataSourceItemModuleURL &\n\tWithHideTitle &\n\tDataSourceItemTint\n\ninterface DataSourceItemVectorSet {\n\t// VECTOR @TODO: can probably just parse the annotation of the vector module?\n\tvectorSetModuleId: string\n}\nexport type VectorsDataSourceItem = DataSourceItemBase &\n\tDataSourceItemTint &\n\tDataSourceItemIntrinsicSize &\n\tDataSourceItemModuleURL &\n\tDataSourceItemVectorSet\n\nconst vectorSetKey: keyof DataSourceItemVectorSet = \"vectorSetModuleId\"\nexport function isVectorDataSourceItem<T extends DataSourceItemBase>(item: T): item is T & DataSourceItemVectorSet {\n\treturn vectorSetKey in item\n}\n\nexport type DataSourceItem =\n\t| DataSourceItemGenerateNodes\n\t| IntegrationsDataSourceItem\n\t| LayoutsDataSourceItem\n\t| ComponentsDataSourceItem\n\t| FillImageUploadDataSourceItem\n\t| VectorsDataSourceItem\n\t| DataSourceClipboardDataItem\n\nconst dataSourceCategoryGroupTitle = \"categoryGroupTitle\"\ntype CategoryGroupTitle = typeof dataSourceCategoryGroupTitle\n\nconst categories = [\n\t\"wireframer\",\n\t\"layoutSections\",\n\t\"kitSections\",\n\t\"navigation\",\n\t\"menus\",\n\t\"cmsCollectionList\",\n\t\"cmsContentFields\",\n\t\"creative\",\n\t\"shaders\",\n\t\"media\",\n\t\"forms\",\n\t\"interactive\",\n\t\"social\",\n\t\"utility\",\n\t\"vectors\",\n] as const\n\ninterface Section {\n\ttype: typeof dataSourceCategoryGroupTitle\n\ttitle: string\n\texperimentIsOn?: ExperimentName\n}\n\nexport type Category = Exclude<(typeof categories)[number], DataSourceCategoryGroupTitle>\n\nexport function isCategory(category: unknown): category is Category {\n\treturn categories.includes(category as Category)\n}\n\nexport const categoryTypes: (Section | Category)[] = [\n\t{ type: dataSourceCategoryGroupTitle, title: \"Start\" },\n\t\"wireframer\",\n\t\"kitSections\",\n\t{ type: dataSourceCategoryGroupTitle, title: \"Basics\" },\n\t\"layoutSections\",\n\t\"navigation\",\n\t\"menus\",\n\t{ type: dataSourceCategoryGroupTitle, title: \"CMS\" },\n\t\"cmsCollectionList\",\n\t\"cmsContentFields\",\n\t{ type: dataSourceCategoryGroupTitle, title: \"Elements\" },\n\t\"vectors\",\n\t\"shaders\",\n\t\"media\",\n\t\"forms\",\n\t\"interactive\",\n\t\"social\",\n\t\"utility\",\n\t\"creative\",\n] as const\n\nexport const agentCategoryTypes: (Section | Category)[] = [\n\t{ type: dataSourceCategoryGroupTitle, title: \"Elements\" },\n\t\"vectors\",\n\t\"shaders\",\n\t\"media\",\n\t\"forms\",\n\t\"interactive\",\n\t\"social\",\n\t\"utility\",\n\t\"creative\",\n\t{ type: dataSourceCategoryGroupTitle, title: \"CMS\" },\n\t\"cmsCollectionList\",\n\t\"cmsContentFields\",\n] as const\n\ntype BasicSectionCategory = Extract<Category, \"navigation\">\n\nexport function isBasicsSectionCategoryType(category: Category | undefined): category is BasicSectionCategory {\n\treturn category === \"navigation\" || category === \"layoutSections\" || category === \"menus\"\n}\n\nexport enum OverlayType {\n\tFixed = 0,\n\tRelative = 1,\n}\n\n/** ImageToUpload represents details about an image that will be uploaded\n * when the user drops it into the canvas. It is not performant to upload\n * whilst dragging in addition to the fact that the draggable may never be\n * dropped, so we wait until the drop event to upload the image.\n */\nexport interface ImageToUpload {\n\timageUrl: string\n\toriginalFilename: string\n\n\t/** The name of the preset that this image due to be uploaded was based from.\n\t *  Currently used for tiling background patterns only.\n\t */\n\tpresetName?: string\n}\n\nexport interface DataSourceCategory {\n\ttype: Category\n\ttitle: string\n\tappAction: AppAction | null\n\titems: DataSourceItem[] | DataSourceSection[]\n\ticon: React.FunctionComponent\n\teditBehavior: EditBehavior\n\tnavigationBehavior: NavigationBehavior\n\texperimentIsOn: ExperimentName | null\n\texperimentIsNotOn: ExperimentName | null\n\tshouldBecomeFullWidthForVariants: LayoutVariants\n\tshouldIgnoreTint: boolean\n\tvisibleInContext: InsertContextType | undefined\n\tshouldDetachOnInsert: boolean\n\toverlayType: OverlayType | undefined\n\thoverEffect: HoverEffect\n\tshouldKeepInsertSidebarOpenOnItemDrag: boolean\n}\n\nexport interface DataSourceSection<T = DataSourceItem> {\n\tsectionTitle: string | undefined\n\titems: T[]\n\tcolorScheme?: ColorScheme\n}\n\nconst sectionTitleKey: keyof DataSourceSection = \"sectionTitle\"\n\nexport function isDataSourceSection(item: DataSourceItem | DataSourceSection): item is DataSourceSection {\n\treturn sectionTitleKey in item\n}\n\nexport function itemsAreDataSourceSections(\n\titems: DataSourceItem[] | DataSourceSection[],\n): items is DataSourceSection[] {\n\tconst item = items[0]\n\treturn !!item && isDataSourceSection(item)\n}\n\ninterface DataSourceCategoryGroupTitle {\n\ttype: CategoryGroupTitle\n\ttitle: string\n\texperimentIsOn?: ExperimentName\n}\n\nexport function dataSourceCategoryHasItems(\n\tcategory: CategoryTypes,\n): category is DataSourceCategory & { items: unknown[] } {\n\treturn category.type !== \"categoryGroupTitle\" && !!category.items\n}\n\nexport type CategoryTypes = DataSourceCategory | DataSourceCategoryGroupTitle\n\nexport type SearchResults = DataSourceSection<DataSourceItem>[]\n", "import { moduleComponents } from \"utils/moduleComponents.ts\"\nimport type { ComponentsDataSourceItem } from \"../../types.ts\"\n\nexport const codeBlockItemModule: ComponentsDataSourceItem = {\n\t// https://framer.com/projects/Code-Block--ccRHKwUmitJhVmGBxTKc-10OvW?node=augiA20Il&view=code%3AcodeFile%2FZClWxS1\n\tkey: \"code-block\",\n\ttitle: moduleComponents.codeblock.title,\n\tkeywords: \"code block\",\n\timage: \"\", // This file is imported in prosemirror/schema, and it doesn't like imports of PNG files\n\ttint: \"rgb(153, 153, 153)\",\n\tbackgroundLight: \"rgba(0, 0, 0, 0.08)\",\n\tbackgroundDark: \"rgba(255, 255, 255, 0.1)\",\n\tintrinsicHeight: 290,\n\tintrinsicWidth: 500,\n\thideTitle: false,\n\tmoduleURL: moduleComponents.codeblock.moduleURL,\n\tmoduleVersion: moduleComponents.codeblock.moduleVersion,\n\tmoduleAvailableOnDevelopment: true,\n}\n", "import { moduleComponents } from \"utils/moduleComponents.ts\"\nimport type { IntegrationsDataSourceItem } from \"../../types.ts\"\nimport agentXImageLight from \"../images/agent/social/x-light@2x.png\"\nimport agentXImage from \"../images/agent/social/x@2x.png\"\nimport xImage from \"../images/x.png\"\n\n// https://beta.framer.com/projects/Twitter--5dZ1Jouzh5ow2iFEgDPp-2qRwM?view=code%3AcodeFile%2FTeKXIYM&node=RNPPkrQ9e-page\nexport const twitterItemModule: IntegrationsDataSourceItem = {\n\tkey: \"x\",\n\ttitle: moduleComponents.twitter.title,\n\tkeywords: \"tweet twitter\",\n\timage: xImage,\n\tagentPreviewImage: agentXImage,\n\tagentPreviewImageLight: agentXImageLight,\n\tagentPreviewWidth: 40,\n\tagentPreviewHeight: 40,\n\ttint: \"rgb(153, 153, 153)\",\n\tbackgroundLight: \"rgba(0, 0, 0, 0.08)\",\n\tbackgroundDark: \"rgba(255, 255, 255, 0.1)\",\n\tintrinsicWidth: 400,\n\tintrinsicHeight: 225,\n\tmoduleURL: moduleComponents.twitter.moduleURL,\n\tmoduleVersion: moduleComponents.twitter.moduleVersion,\n}\n", "import { moduleComponents } from \"utils/moduleComponents.ts\"\nimport type { IntegrationsDataSourceItem } from \"../../types.ts\"\nimport agentVimeoImage from \"../images/agent/media/vimeo@2x.png\"\nimport vimeoImage from \"../images/vimeo.png\"\n\n// https://beta.framer.com/projects/Vimeo--6QftrecIW4vkUjihqK3P-4KQPX?node=gvewZBByN\nexport const vimeoItemModule: IntegrationsDataSourceItem = {\n\tkey: \"vimeo\",\n\ttitle: moduleComponents.vimeo.title,\n\tkeywords: \"film movie\",\n\timage: vimeoImage,\n\tagentPreviewImage: agentVimeoImage,\n\tagentPreviewWidth: 40,\n\tagentPreviewHeight: 40,\n\ttint: \"rgb(64, 183, 255)\",\n\tbackgroundLight: \"rgba(107, 216, 255, 0.15)\",\n\tbackgroundDark: \"rgba(107, 216, 255, 0.2)\",\n\tintrinsicWidth: 480,\n\tintrinsicHeight: 270,\n\tmoduleURL: moduleComponents.vimeo.moduleURL,\n\tmoduleVersion: moduleComponents.vimeo.moduleVersion,\n\tmoduleAvailableOnDevelopment: true,\n}\n", "import { moduleComponents } from \"utils/moduleComponents.ts\"\nimport type { IntegrationsDataSourceItem } from \"../../types.ts\"\nimport agentYoutubeImage from \"../images/agent/media/youtube@2x.png\"\nimport youtubeImage from \"../images/youtube.png\"\n\nexport const youtubeItemModule: IntegrationsDataSourceItem = {\n\tkey: \"youtube\",\n\ttitle: moduleComponents.youtube.title,\n\tkeywords: \"film movie\",\n\timage: youtubeImage,\n\tagentPreviewImage: agentYoutubeImage,\n\tagentPreviewWidth: 48,\n\tagentPreviewHeight: 33,\n\ttint: \"rgb(255, 36, 112)\",\n\tbackgroundLight: \"rgba(255, 36, 112, 0.15)\",\n\tbackgroundDark: \"rgba(255, 36, 112, 0.2)\",\n\tintrinsicWidth: 480,\n\tintrinsicHeight: 270,\n\tmoduleURL: moduleComponents.youtube.moduleURL,\n\tmoduleVersion: moduleComponents.youtube.moduleVersion,\n\texportSpecifier: moduleComponents.youtube.exportSpecifier,\n\tmoduleAvailableOnDevelopment: true,\n}\n", "import type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { assert, isModuleExportIdentifier } from \"@framerjs/shared\"\nimport { codeBlockItemModule } from \"document/components/chrome/insertSidebar/dataSources/items/codeBlockItem.ts\"\nimport { twitterItemModule } from \"document/components/chrome/insertSidebar/dataSources/items/twitterItem.ts\"\nimport { vimeoItemModule } from \"document/components/chrome/insertSidebar/dataSources/items/vimeoItem.ts\"\nimport { youtubeItemModule } from \"document/components/chrome/insertSidebar/dataSources/items/youtubeItem.ts\"\nimport { getModuleIdentifierForItem } from \"document/components/chrome/insertSidebar/types.ts\"\nimport type { RawControlProps } from \"document/models/controlProps/RawControlProp.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport type { Paragraph as ParagraphMdastNode } from \"mdast\"\nimport type { Node as PmNode } from \"prosemirror-model\"\nimport { isValidEnumValue } from \"utils/isValidEnumValue.ts\"\nimport { isNullish, isString } from \"utils/typeChecks.ts\"\nimport type { ExtendedPmNodeSpec } from \"../types.ts\"\nimport { NodeName } from \"./names.ts\"\n\nexport enum ModuleAlignment {\n\tLeft = \"left\",\n\tCenter = \"center\",\n\tRight = \"right\",\n}\n\nexport enum ModuleWidth {\n\tFill = \"fill\",\n\tFit = \"fit\",\n}\n\nexport function parseModuleWidth(value: string | null | undefined): ModuleWidth {\n\treturn isValidEnumValue(ModuleWidth, value) ? value : ModuleWidth.Fill\n}\n\nexport function parseModuleAlignment(value: string | null | undefined): ModuleAlignment {\n\treturn isValidEnumValue(ModuleAlignment, value) ? value : ModuleAlignment.Left\n}\n\nexport interface ModuleAttrs {\n\treadonly identifier: ModuleExportIdentifierString\n\treadonly props: RawControlProps\n\treadonly width?: ModuleWidth\n\treadonly alignment?: ModuleAlignment\n}\n\nexport type ModuleNode = PmNode<ModuleAttrs>\n\nexport function isModuleNode(node: PmNode | null | undefined): node is ModuleNode {\n\treturn node?.type.name === NodeName.Module\n}\n\nexport const CMS_MODULE_TAG = \"framer-module\"\nexport const CMS_MODULE_IDENTIFIER_ATTR = \"data-module-identifier\"\nexport const CMS_MODULE_PROPS_ATTR = \"data-module-props\"\nexport const CMS_MODULE_WIDTH_ATTR = \"data-module-width\"\nexport const CMS_MODULE_ALIGNMENT_ATTR = \"data-module-alignment\"\n\nexport const moduleIdentifierAttributeRegex = new RegExp(`${CMS_MODULE_IDENTIFIER_ATTR}=\"(.*?)\"`, \"g\")\n\nexport function* iterateRichTextModuleIdentifiers(html: string) {\n\tconst matches = html.matchAll(moduleIdentifierAttributeRegex)\n\tfor (const [, componentIdentifier] of matches) {\n\t\tif (!isModuleExportIdentifier(componentIdentifier)) continue\n\t\tyield componentIdentifier\n\t}\n}\n\n/** @see {@link https://stackoverflow.com/a/5135267/242684} */\nconst CODE_LANGUAGE_CLASS_PREFIXES = [\"lang-\", \"language-\"] as const\nconst CODE_BLOCK_COMPONENT_LANGUAGE_PROP = \"language\"\nconst CODE_BLOCK_COMPONENT_CODE_PROP = \"code\"\n\n// Please keep this in sync with `default` in getLanguageForCodeBlock.ts.\nexport const DEFAULT_LANGUAGE_ALIAS = \"js\" as const\nconst PLAIN_TEXT_LANGUAGE_ALIAS = \"plain-text\"\n\ninterface Language {\n\t/** Human-readable name and Framer-wide identifier, must be supported by Code Block. */\n\tname: string\n\t/** Defaults to `name.toLowerCase()`, an override for cases like C++/cpp, MUST be lowercase. */\n\tout?: string\n\t/** All known shorthands that may be considered to be this language, MUST be lowercase. */\n\taliases?: string[]\n}\n\ndeclare module \"mdast\" {\n\tinterface TextData {\n\t\t/** Declares that the text content must not be escaped. We handle this in our serializer. */\n\t\tavoidEscaping?: boolean\n\t}\n}\n\n/**\n * All languages we support indexed by all known aliases.\n *\n * @see {@link https://github.com/github-linguist/linguist/blob/f164d13fa618023ecf2d8f2ed9a6ce5fae731346/lib/linguist/languages.yml}\n * @see {@link https://github.com/codemirror/language-data/blob/7b21009213b9fdb44d6ec172ad0a779234170f52/src/language-data.ts}\n * @see {@link https://developers.notion.com/reference/block#code}\n * @see {@link https://framer.com/projects/Code-Block--ccRHKwUmitJhVmGBxTKc-10OvW?node=augiA20Il&view=code%3AcodeFile%2FOZPAywU}\n */\nconst LANGUAGES = new Map<string, Language>()\n\nfor (const language of [\n\t{ name: \"Angular\" },\n\t{ name: \"C\", aliases: [\"opencl\", \"unified-parallel-c\", \"x-bitmap\", \"x-pixmap\"] },\n\t{\n\t\tname: \"C#\",\n\t\tout: \"cs\",\n\t\taliases: [\n\t\t\t\"csharp\",\n\t\t\t\"cake\",\n\t\t\t\"cakescript\",\n\t\t\t\"java/c/c++/c#\", // Courtesy of Notion\n\t\t],\n\t},\n\t{ name: \"C++\", out: \"cpp\" },\n\t{ name: \"CSS\", aliases: [\"postcss\"] },\n\t{ name: \"Go\", aliases: [\"golang\"] },\n\t{ name: \"Haskell\", aliases: [\"c2hs-haskell\", \"c2hs\", \"literate-haskell\"] },\n\t{\n\t\tname: \"HTML\",\n\t\taliases: [\n\t\t\t\"xhtml\",\n\t\t\t\"ecmarkup\",\n\t\t\t\"html+ecr\",\n\t\t\t\"ecr\",\n\t\t\t\"html+eex\",\n\t\t\t\"eex\",\n\t\t\t\"heex\",\n\t\t\t\"leex\",\n\t\t\t\"html+erb\",\n\t\t\t\"erb\",\n\t\t\t\"rhtml\",\n\t\t\t\"html+ruby\",\n\t\t\t\"html+razor\",\n\t\t\t\"razor\",\n\t\t],\n\t},\n\t{ name: \"Java\", aliases: [\"java server pages\", \"jsp\", \"java-template-engine\", \"jte\"] },\n\t{\n\t\tname: \"JavaScript\",\n\t\taliases: [\n\t\t\tDEFAULT_LANGUAGE_ALIAS,\n\t\t\t\"jsx\",\n\t\t\t\"flow\",\n\t\t\t\"json\",\n\t\t\t\"node\",\n\t\t\t\"ecere-projects\",\n\t\t\t\"glimmer-js\",\n\t\t\t\"json-with-comments\",\n\t\t\t\"jsonc\",\n\t\t\t\"json5\",\n\t\t\t\"jsonld\",\n\t\t\t\"javascript+erb\",\n\t\t],\n\t},\n\t{ name: \"Julia\", aliases: [\"julia-repl\"] },\n\t{ name: \"Kotlin\" },\n\t{ name: \"Less\", aliases: [\"less-css\"] },\n\t{ name: \"Lua\" },\n\t{ name: \"Markdown\", aliases: [\"md\", \"pandoc\", PLAIN_TEXT_LANGUAGE_ALIAS] },\n\t{ name: \"MATLAB\", aliases: [\"octave\"] },\n\t{ name: \"Nginx\", aliases: [\"nginx-configuration-file\"] },\n\t{ name: \"Objective-C\", out: \"objectivec\", aliases: [\"obj-c\", \"objc\"] },\n\t{ name: \"Perl\", aliases: [\"cperl\"] },\n\t{ name: \"PHP\", aliases: [\"inc\", \"html+php\"] },\n\t{\n\t\tname: \"Python\",\n\t\taliases: [\n\t\t\t\"python3\",\n\t\t\t\"rusthon\",\n\t\t\t\"py\",\n\t\t\t\"easybuild\",\n\t\t\t\"numpy\",\n\t\t\t\"python-console\",\n\t\t\t\"pycon\",\n\t\t\t\"python-traceback\",\n\t\t\t\"snakemake\",\n\t\t\t\"snakefile\",\n\t\t],\n\t},\n\t{ name: \"Ruby\", aliases: [\"jruby\", \"macruby\", \"rake\", \"rb\", \"rbx\", \"rbs\"] },\n\t{ name: \"Rust\", aliases: [\"rs\"] },\n\t{ name: \"Scala\" },\n\t{ name: \"SCSS\", aliases: [\"sass\"] },\n\t{\n\t\tname: \"Shell\",\n\t\taliases: [\n\t\t\t\"sh\",\n\t\t\t\"shell-script\",\n\t\t\t\"bash\",\n\t\t\t\"zsh\",\n\t\t\t\"envrc\",\n\t\t\t\"alpine-abuild\",\n\t\t\t\"gentoo-ebuild\",\n\t\t\t\"gentoo-eclass\",\n\t\t\t\"openrc-runscript\",\n\t\t\t\"openrc\",\n\t\t\t\"tcsh\",\n\t\t\t\"fish\",\n\t\t],\n\t},\n\t{ name: \"SQL\", aliases: [\"tsql\", \"plsql\", \"plpgsql\", \"sqlpl\"] },\n\t{ name: \"Swift\" },\n\t{ name: \"TypeScript\", aliases: [\"ts\", \"tsx\", \"glimmer-ts\"] },\n\t{ name: \"Vue\" },\n\t{ name: \"YAML\", aliases: [\"yml\"] },\n]) {\n\tLANGUAGES.set(language.name.toLowerCase(), language)\n\tif (language.out !== undefined) LANGUAGES.set(language.out, language)\n\tif (language.aliases) {\n\t\tfor (const alias of language.aliases) LANGUAGES.set(alias, language)\n\t}\n}\n\n/**\n * Look up a language in {@link LANGUAGES} by either its `name`, `out` or any of\n * `aliases`, and fall back to {@link DEFAULT_LANGUAGE_ALIAS} if not found.\n */\nexport function getLanguage(...namesOrShorthandsOrAliases: (string | undefined | null)[]): Language {\n\tfor (const candidate of namesOrShorthandsOrAliases) {\n\t\tif (isNullish(candidate)) continue\n\t\tconst language = LANGUAGES.get(candidate.toLowerCase())\n\t\tif (language) return language\n\t}\n\n\tconst defaultLanguage = LANGUAGES.get(DEFAULT_LANGUAGE_ALIAS)\n\tassert(defaultLanguage, \"getLanguage: default language must exist\")\n\treturn defaultLanguage\n}\n\n/**\n * Splits DOM element's className into a list of classes and truncates\n * {@link CODE_LANGUAGE_CLASS_PREFIXES} from all of them.\n *\n * Just in case, className is faster than classList:\n * {@link https://www.measurethat.net/Benchmarks/Show/32341/0/classnamesplit-vs-classlistvalues}\n */\nconst extractLanguageShorthandsFromElement = (element: Element): string[] =>\n\telement.className\n\t\t.toLowerCase()\n\t\t.split(\" \")\n\t\t.filter(x => x !== \"\")\n\t\t.map(rawClass => {\n\t\t\tfor (const prefix of CODE_LANGUAGE_CLASS_PREFIXES) {\n\t\t\t\tif (rawClass.startsWith(prefix)) return rawClass.slice(prefix.length)\n\t\t\t}\n\n\t\t\treturn rawClass\n\t\t})\n\n/**\n * Creates a \"best effort\" combination of classes that convey the language of\n * the contained code that should be placed on `<pre>` and `<code>` elements\n * when generating HTML for consumption by software outside of Framer.\n */\nexport function getInteroperableLanguageClassName(language: Language): string {\n\tconst shorthand = language.out ?? language.name.toLowerCase()\n\treturn `${shorthand} ${CODE_LANGUAGE_CLASS_PREFIXES.map(x => `${x}${shorthand}`).join(\" \")}`\n}\n\nfunction nodeIsValidCodeBlockComponent(node: PmNode<ModuleAttrs>): node is PmNode<\n\tModuleAttrs & {\n\t\tprops: {\n\t\t\t[CODE_BLOCK_COMPONENT_CODE_PROP]: { value: string }\n\t\t\t[CODE_BLOCK_COMPONENT_LANGUAGE_PROP]?: { value: string | undefined }\n\t\t}\n\t}\n> {\n\treturn (\n\t\tnode.attrs.identifier === getModuleIdentifierForItem(codeBlockItemModule)?.value &&\n\t\tisString(node.attrs.props[CODE_BLOCK_COMPONENT_CODE_PROP]?.value)\n\t)\n}\n\nfunction nodeIsYouTubeComponent(node: PmNode<ModuleAttrs>): node is PmNode<\n\tModuleAttrs & {\n\t\tprops: RawControlProps & {\n\t\t\turl: { value: string }\n\t\t}\n\t}\n> {\n\treturn (\n\t\tnode.attrs.identifier === getModuleIdentifierForItem(youtubeItemModule)?.value &&\n\t\tisString(node.attrs.props.url?.value)\n\t)\n}\n\nfunction nodeIsVimeoComponent(node: PmNode<ModuleAttrs>): node is PmNode<\n\tModuleAttrs & {\n\t\tprops: RawControlProps & {\n\t\t\tvideo: { value: string }\n\t\t}\n\t}\n> {\n\treturn (\n\t\tnode.attrs.identifier === getModuleIdentifierForItem(vimeoItemModule)?.value &&\n\t\tisString(node.attrs.props.video?.value)\n\t)\n}\n\nfunction nodeIsTwitterComponent(node: PmNode<ModuleAttrs>): node is PmNode<\n\tModuleAttrs & {\n\t\tprops: RawControlProps & {\n\t\t\turl: {\n\t\t\t\tvalue: string\n\t\t\t}\n\t\t}\n\t}\n> {\n\treturn (\n\t\tnode.attrs.identifier === getModuleIdentifierForItem(twitterItemModule)?.value &&\n\t\tisString(node.attrs.props.url?.value)\n\t)\n}\n\n/**\n * Many editors ([1], [2], etc.) have a convention where pasting a YouTube/Vimeo/Twitter\n * link on a separate line will result in that link being converted into an embed.\n * This function will serialize the given link in a format expected by such editors.\n *\n * [1] https://wordpress.com/support/wordpress-editor/blocks/youtube-block/\n * [2] https://ghost.org/integrations/youtube/\n */\nfunction serializeURLForExternalCMSInterop(url: string): ParagraphMdastNode {\n\treturn {\n\t\ttype: \"paragraph\",\n\t\t// Serializing a link in the format expected by external editors is a bit tricky,\n\t\t// so we have to use our custom `avoidEscaping` flag.\n\t\t// - We cannot use regular `text` nodes because remark would escape the URL\n\t\t//   (https://your.url \u2192 https\\://your.url)\n\t\t// - And we cannot use `link` nodes because remark would wrap such links\n\t\t//   in `<>` (https://your.url \u2192 <https://your.url>), per markdown autolink spec.\n\t\tchildren: [{ type: \"text\", value: url, data: { avoidEscaping: true } }],\n\t}\n}\n\nexport const moduleNode: ExtendedPmNodeSpec<ModuleAttrs> = {\n\tgroup: \"block\",\n\n\tattrs: {\n\t\tidentifier: {},\n\n\t\tprops: {\n\t\t\tdefault: {},\n\t\t},\n\n\t\twidth: {\n\t\t\tdefault: ModuleWidth.Fill,\n\t\t},\n\n\t\talignment: {\n\t\t\tdefault: ModuleAlignment.Left,\n\t\t},\n\t},\n\n\tleafText(node) {\n\t\tif (nodeIsValidCodeBlockComponent(node)) {\n\t\t\treturn node.attrs.props[CODE_BLOCK_COMPONENT_CODE_PROP].value\n\t\t}\n\n\t\treturn \"\"\n\t},\n\n\ttoMarkdown(node) {\n\t\tif (nodeIsValidCodeBlockComponent(node)) {\n\t\t\tconst language = getLanguage(node.attrs.props[CODE_BLOCK_COMPONENT_LANGUAGE_PROP]?.value)\n\t\t\tconst languageTag = language.out ?? language.name.toLowerCase()\n\t\t\treturn { type: \"code\", value: node.attrs.props[CODE_BLOCK_COMPONENT_CODE_PROP].value, lang: languageTag }\n\t\t}\n\n\t\tif (nodeIsYouTubeComponent(node)) {\n\t\t\treturn serializeURLForExternalCMSInterop(node.attrs.props.url.value)\n\t\t}\n\n\t\tif (nodeIsVimeoComponent(node)) {\n\t\t\treturn serializeURLForExternalCMSInterop(node.attrs.props.video.value)\n\t\t}\n\n\t\tif (nodeIsTwitterComponent(node)) {\n\t\t\treturn serializeURLForExternalCMSInterop(node.attrs.props.url.value)\n\t\t}\n\n\t\treturn null\n\t},\n\n\ttoDOM(node) {\n\t\tconst dom = document.createElement(CMS_MODULE_TAG)\n\t\tdom.setAttribute(CMS_MODULE_IDENTIFIER_ATTR, node.attrs.identifier)\n\t\tdom.setAttribute(CMS_MODULE_PROPS_ATTR, JSON.stringify(node.attrs.props))\n\t\tdom.setAttribute(CMS_MODULE_WIDTH_ATTR, node.attrs.width ?? ModuleWidth.Fill)\n\t\tdom.setAttribute(CMS_MODULE_ALIGNMENT_ATTR, node.attrs.alignment ?? ModuleAlignment.Left)\n\n\t\t// Some modules can be serialized to an interoperable format. E.g., code blocks can be\n\t\t// represented as <pre><code> elements, YouTube and Vimeo components can be represented as\n\t\t// <iframe> elements (not implemented as of Jul 2025), etc. We convert them to the\n\t\t// interoperable format when serializing. To keep all Framer-specific props, we put the\n\t\t// interoperable representation inside the Framer-specific <framer-module> element. This way,\n\t\t// Framer will still parse the module as a module, but all editors that don\u2019t support\n\t\t// <framer-module> will render the interoperable format instead.\n\t\tif (nodeIsValidCodeBlockComponent(node)) {\n\t\t\tconst languageClassName = getInteroperableLanguageClassName(\n\t\t\t\tgetLanguage(node.attrs.props[CODE_BLOCK_COMPONENT_LANGUAGE_PROP]?.value),\n\t\t\t)\n\t\t\tconst code = document.createElement(\"code\")\n\t\t\tcode.appendChild(document.createTextNode(node.attrs.props[CODE_BLOCK_COMPONENT_CODE_PROP].value))\n\t\t\tcode.setAttribute(\"class\", languageClassName)\n\n\t\t\tconst pre = document.createElement(\"pre\")\n\t\t\tpre.appendChild(code)\n\t\t\tpre.setAttribute(\"class\", languageClassName)\n\n\t\t\tdom.appendChild(pre)\n\t\t}\n\n\t\treturn dom\n\t},\n\n\tparseDOM: [\n\t\t{\n\t\t\ttag: `${CMS_MODULE_TAG}[${CMS_MODULE_IDENTIFIER_ATTR}]`,\n\n\t\t\tgetAttrs(dom) {\n\t\t\t\tassert(dom instanceof Element, \"parseDOM:module: dom is not an element\")\n\t\t\t\tconst identifier = dom.getAttribute(CMS_MODULE_IDENTIFIER_ATTR) ?? undefined\n\t\t\t\tassert(isModuleExportIdentifier(identifier), \"parseDOM:module: identifier is not a module export identifier\")\n\t\t\t\treturn {\n\t\t\t\t\tidentifier,\n\t\t\t\t\tprops: JSON.parse(dom.getAttribute(CMS_MODULE_PROPS_ATTR) ?? \"\"),\n\t\t\t\t\twidth: parseModuleWidth(dom.getAttribute(CMS_MODULE_WIDTH_ATTR)),\n\t\t\t\t\talignment: parseModuleAlignment(dom.getAttribute(CMS_MODULE_ALIGNMENT_ATTR)),\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\n\t\t// Same logic as above. (`template` used to be an old tag for modules; we switched to\n\t\t// `framer-module` in 2025.)\n\t\t{\n\t\t\ttag: `template[${CMS_MODULE_IDENTIFIER_ATTR}]`,\n\n\t\t\tgetAttrs(dom) {\n\t\t\t\tassert(dom instanceof Element)\n\t\t\t\tconst identifier = dom.getAttribute(CMS_MODULE_IDENTIFIER_ATTR) ?? undefined\n\t\t\t\tassert(isModuleExportIdentifier(identifier))\n\t\t\t\treturn {\n\t\t\t\t\tidentifier,\n\t\t\t\t\tprops: JSON.parse(dom.getAttribute(CMS_MODULE_PROPS_ATTR) ?? \"\"),\n\t\t\t\t\twidth: parseModuleWidth(dom.getAttribute(CMS_MODULE_WIDTH_ATTR)),\n\t\t\t\t\talignment: parseModuleAlignment(dom.getAttribute(CMS_MODULE_ALIGNMENT_ATTR)),\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\n\t\t// Matches pastes of pre-formatted content, often code. I haven't seen\n\t\t// any software that puts code in just <pre> without <code>, but there's\n\t\t// no downside to treating all occurences of <pre> the same, even if\n\t\t// there's no <code> inside. On the other hand, <code> by itself,\n\t\t// without <pre>, is to be treated as inline code, so it's a completely\n\t\t// separate story. To top it off, some software, like Stack Overflow,\n\t\t// sometimes puts language-related attributes on <pre> and not <code>\n\t\t// (or an incorrect value on <code>), so we want to process both.\n\t\t//\n\t\t// Haven't seen any cases where <code> wasn't the first child of <pre>\n\t\t// either, but there is a lot of creativity in this area, so collecting\n\t\t// classes from all children, not just the first one, and also no\n\t\t// filtering for <code> specifically.\n\t\t//\n\t\t// Sometimes pre-formatted text is denoted by inline styles\n\t\t// (\"white-space: pre\") rather than <pre>, like in the case of VS Code,\n\t\t// which could also be handled here, but it brings more complexity,\n\t\t// because it isn't actually pre-formatted, so `textContent` doesn't\n\t\t// have any line breaks in it (line breaks are instead achieved by\n\t\t// wrapping lines in <div>).\n\t\t//\n\t\t// Language attribute extraction is inspired by\n\t\t// https://stackoverflow.com/a/5135267/242684 and experiments of copying\n\t\t// things from Stack Overflow, GitHub, MDN, VS Code, etc. into\n\t\t// https://evercoder.github.io/clipboard-inspector/ and Framer.\n\t\t{\n\t\t\ttag: \"pre\",\n\n\t\t\tgetAttrs(dom) {\n\t\t\t\tassert(dom instanceof Element, \"parseDOM:pre: dom is not an element\")\n\t\t\t\tassert(dom.textContent !== null, \"parseDOM:pre: dom.textContent is null\")\n\n\t\t\t\tconst languageClasses = [\n\t\t\t\t\t...extractLanguageShorthandsFromElement(dom),\n\t\t\t\t\t...Array.from(dom.children).flatMap(x => extractLanguageShorthandsFromElement(x)),\n\t\t\t\t]\n\t\t\t\tconst language =\n\t\t\t\t\tlanguageClasses.length > 0\n\t\t\t\t\t\t? getLanguage(...languageClasses)\n\t\t\t\t\t\t: // This is a code block without any explicit language. Treat it as plain text.\n\t\t\t\t\t\t\tgetLanguage(PLAIN_TEXT_LANGUAGE_ALIAS)\n\n\t\t\t\tconst identifier = getModuleIdentifierForItem(codeBlockItemModule)\n\n\t\t\t\tassert(identifier, \"parseDOM:pre: no module identifier found for codeBlockItemModule\")\n\n\t\t\t\treturn {\n\t\t\t\t\tidentifier: identifier.value,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t[CODE_BLOCK_COMPONENT_CODE_PROP]: {\n\t\t\t\t\t\t\ttype: ControlType.String,\n\t\t\t\t\t\t\tvalue: dom.textContent.trimEnd(), // More often than not, trailing spaces and new lines are undesired\n\t\t\t\t\t\t},\n\t\t\t\t\t\t[CODE_BLOCK_COMPONENT_LANGUAGE_PROP]: {\n\t\t\t\t\t\t\ttype: ControlType.String,\n\t\t\t\t\t\t\tvalue: language.name,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t],\n}\n", "import hash from \"@emotion/hash\"\nimport { assertNever } from \"@framerjs/shared\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\n\nexport enum RuleType {\n\tComponent,\n\tStylePreset,\n\tStylePresetBreakpoint,\n}\n\nexport const COMPONENT_PREFIX = \"framer-\"\nconst STYLE_PRESET_PREFIX = \"framer-styles-preset-\"\nconst STYLE_PRESET_BREAKPOINT_PREFIX = \"framer-styles-preset-breakpoint-\"\n\nexport function createFramerClassName(ruleType: RuleType, id: NodeID) {\n\tswitch (ruleType) {\n\t\tcase RuleType.StylePreset:\n\t\t\treturn STYLE_PRESET_PREFIX + hash(id)\n\n\t\tcase RuleType.StylePresetBreakpoint:\n\t\t\t// This is only used on the canvas. The generated website will use media qeries instead.\n\t\t\treturn STYLE_PRESET_BREAKPOINT_PREFIX + hash(id)\n\n\t\tcase RuleType.Component:\n\t\t\treturn COMPONENT_PREFIX + hash(id)\n\n\t\tdefault:\n\t\t\tassertNever(ruleType)\n\t}\n}\n", "import { RuleType, createFramerClassName } from \"code-generation/utils/createFramerClassName.ts\"\nimport type { Node as PmNode } from \"prosemirror-model\"\nimport { isObject, isString } from \"utils/typeChecks.ts\"\nimport type { BulletedListNode, NumberedListNode } from \"./list.ts\"\nimport type { TextBlockNode } from \"./textBlock.ts\"\n\nexport function withContent(dom: HTMLElement, contentDOM = dom) {\n\treturn { dom, contentDOM }\n}\n\ntype AttrsDefaultSpec<T extends object> = { [K in keyof T]: { default: T[K] } }\n\n/**\n * from\n * { attr1: defaultValue1, attr2: defaultValue2 }\n * to\n * { attr1: { default: defaultValue1 }, attr2: { default: defaultValue2 } }\n */\nexport function attrsToDefaults<T extends object>(defaultValues: T): AttrsDefaultSpec<T> {\n\tconst result = {} as AttrsDefaultSpec<T>\n\n\tfor (const key in defaultValues) {\n\t\tresult[key] = { default: defaultValues[key] }\n\t}\n\n\treturn result\n}\n\nexport const resetStylePreset = Symbol(\"reset\")\ntype ResetStylePreset = typeof resetStylePreset\n\nexport function getStylePreset(preset: string | undefined) {\n\t// We need to reset text styles presets if they are hoisted in nested nodes.\n\t// Text link styles are never hoisted.\n\tif (preset === resetStylePreset.description) {\n\t\treturn resetStylePreset\n\t}\n\n\treturn preset\n}\n\nexport function setStylePreset(dom: HTMLElement, preset: TextStylePreset) {\n\tif (preset === resetStylePreset) {\n\t\tdom.className = \"text-styles-preset-reset\"\n\t\tdom.dataset.stylesPreset = preset.description\n\t} else if (preset) {\n\t\tdom.className = createFramerClassName(RuleType.StylePreset, preset)\n\t\tdom.dataset.stylesPreset = preset\n\t}\n}\n\nexport function hasTextStylePreset(node: PmNode): node is PmNode<{ textStylePreset: string }> {\n\treturn isObject(node.attrs) && isString(node.attrs.textStylePreset)\n}\n\n// TODO: Rename as it's super ProseMirror specific\nexport type TextStylePreset = string | ResetStylePreset | undefined\n\nexport type PmNodeTextDirection = \"auto\" | \"ltr\" | \"rtl\" | \"inherit\"\n\nexport function parseTextDirection(element: HTMLElement): PmNodeTextDirection {\n\tconst attributeValue = element.getAttribute(\"dir\")\n\tif (attributeValue === \"ltr\" || attributeValue === \"rtl\" || attributeValue === \"auto\") {\n\t\treturn attributeValue\n\t}\n\n\tconst cssValue = element.style.getPropertyValue(\"direction\")\n\tif (cssValue === \"ltr\" || cssValue === \"rtl\") {\n\t\treturn cssValue\n\t}\n\n\treturn \"auto\"\n}\n\nexport function setDirFromTextDirection(dom: HTMLElement, node: TextBlockNode | BulletedListNode | NumberedListNode) {\n\tconst textDirection = node.attrs.textDirection\n\tif (textDirection === \"inherit\") {\n\t\tdom.removeAttribute(\"dir\")\n\t} else {\n\t\tdom.setAttribute(\"dir\", textDirection)\n\t}\n}\n", "import type { Mark as PmMark } from \"prosemirror-model\"\nimport type { ExtendedPmMark, ExtendedPmMarkSpec } from \"../types.ts\"\nimport { MarkName } from \"./names.ts\"\nimport { withContent } from \"./utils.ts\"\n\nexport interface BackgroundMaskAttrs {\n\treadonly fill: string\n\treadonly stopIds: string | undefined\n}\n\n// We store a data attribute of the gradient color stop IDs joint together, so every time we parse a text gradient fill\n// on the canvas, the IDs are deterministic. The data-attribute itself does not contribute to the generated site.\nexport const DATA_STOP_IDS = \"data-stopids\"\ntype BackgroundMaskMark = ExtendedPmMark<BackgroundMaskAttrs>\n\nexport function isBackgroundMaskMark(mark: PmMark): mark is BackgroundMaskMark {\n\treturn mark.type.name === MarkName.BackgroundMask\n}\n\nexport const backgroundMask: ExtendedPmMarkSpec<BackgroundMaskAttrs> = {\n\tattrs: {\n\t\tfill: {},\n\t\tstopIds: {},\n\t},\n\n\ttoMarkdown: (_mark, _parent, children) => {\n\t\t// Do not serialize this mark to markdown\n\t\treturn children\n\t},\n\n\ttoDOM(mark) {\n\t\tconst dom = document.createElement(\"span\")\n\n\t\tdom.dataset.textFill = \"true\"\n\t\tdom.style.backgroundImage = mark.attrs.fill\n\t\tdom.setAttribute(DATA_STOP_IDS, mark.attrs.stopIds || \"\")\n\n\t\treturn withContent(dom)\n\t},\n\n\tparseDOM: [\n\t\t{\n\t\t\ttag: \"span[data-text-fill]\",\n\n\t\t\tgetAttrs(dom: HTMLAnchorElement) {\n\t\t\t\treturn {\n\t\t\t\t\tstopIds: dom.getAttribute(DATA_STOP_IDS) || \"\",\n\t\t\t\t\tfill: dom.style.backgroundImage,\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t],\n}\n", "import { isEqual } from \"library/index.ts\"\nimport type { Mark as PmMark } from \"prosemirror-model\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { BackgroundStyles, getStyles, setStyles } from \"../styles.ts\"\nimport type { ExtendedPmMark, ExtendedPmMarkSpec } from \"../types.ts\"\nimport { MarkName } from \"./names.ts\"\nimport { withContent } from \"./utils.ts\"\n\nexport interface BackgroundStylesAttrs {\n\treadonly backgroundStyles: BackgroundStyles\n}\n\nexport type BackgroundStylesMark = ExtendedPmMark<BackgroundStylesAttrs>\n\nexport function isBackgroundStylesMark(mark: PmMark): mark is BackgroundStylesMark {\n\treturn mark.type.name === MarkName.BackgroundStyles\n}\n\nexport function isEmptyBackgroundStyles(styles: BackgroundStyles) {\n\tif (!isUndefined(styles.textBackgroundRadius)) return false\n\tif (!isUndefined(styles.textBackgroundCornerShape)) return false\n\tif (!isUndefined(styles.textBackgroundPadding)) return false\n\tif (\n\t\t!isUndefined(styles.textBackgroundColor) &&\n\t\t!isEqual(styles.textBackgroundColor, BackgroundStyles.defaults.textBackgroundColor)\n\t) {\n\t\treturn false\n\t}\n\n\treturn true\n}\n\nexport const backgroundStyles: ExtendedPmMarkSpec<BackgroundStylesAttrs> = {\n\tattrs: {\n\t\tbackgroundStyles: {\n\t\t\tdefault: {},\n\t\t},\n\t},\n\n\ttoMarkdown: (_mark, _parent, children) => {\n\t\t// Do not serialize this mark to markdown\n\t\treturn children\n\t},\n\n\ttoDOM(mark) {\n\t\tconst dom = document.createElement(\"mark\")\n\t\tsetStyles(dom.style, BackgroundStyles.transforms, mark.attrs.backgroundStyles)\n\t\treturn withContent(dom)\n\t},\n\n\tparseDOM: [\n\t\t{\n\t\t\ttag: \"mark\",\n\t\t\tconsuming: false,\n\n\t\t\tgetAttrs(dom: HTMLSpanElement) {\n\t\t\t\treturn {\n\t\t\t\t\tbackgroundStyles: getStyles(dom.style, BackgroundStyles.transforms),\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t],\n}\n", "import { ok as assert } from \"devlop\";\nimport { is } from \"unist-util-is\";\nfunction createState(nodeHandlers, markHandlers) {\n    const state = {\n        one,\n        all,\n        nodeHandlers,\n        markHandlers\n    };\n    function one(pmNode, parent) {\n        const schema = pmNode.type.schema;\n        const nodeName = pmNode.type.name;\n        const handler = state.nodeHandlers[nodeName];\n        if (handler) {\n            return handler(pmNode, parent, state);\n        }\n        if (pmNode.type === schema.topNodeType) {\n            const children = state.all(pmNode);\n            assert(!children.some((child)=>is(child, \"root\")), \"Expected non-root nodes\");\n            return {\n                type: \"root\",\n                children: children\n            };\n        }\n        if (pmNode.type === schema.nodes[\"text\"]) {\n            // Text nodes always have a text property\n            // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n            return {\n                type: \"text\",\n                value: pmNode.text\n            };\n        }\n        return null;\n    }\n    function processChildPartition(nodes, parent) {\n        const firstChild = nodes[0];\n        const firstMark = firstChild?.marks[0];\n        if (!firstMark) return nodes.map((node)=>state.one(node.node, parent));\n        const children = hydrateMarks(nodes.map(({ node, marks })=>({\n                node,\n                marks: marks.slice(1)\n            })), parent);\n        const handler = state.markHandlers[firstMark.type.name];\n        if (!handler) return children;\n        return handler(firstMark, parent, children, state);\n    }\n    function hydrateMarks(children, parent) {\n        const partitioned = children.reduce((acc, child)=>{\n            const lastPartition = acc[acc.length - 1];\n            if (!lastPartition) {\n                return [\n                    [\n                        child\n                    ]\n                ];\n            }\n            const lastChild = lastPartition[lastPartition.length - 1];\n            if (!lastChild) {\n                return [\n                    ...acc.slice(0, acc.length),\n                    [\n                        child\n                    ]\n                ];\n            }\n            if (!child.marks.length && !lastChild.marks.length || child.marks.length && lastChild.marks.length && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n            child.marks[0]?.eq(lastChild.marks[0])) {\n                return [\n                    ...acc.slice(0, acc.length - 1),\n                    [\n                        ...lastPartition.slice(0, lastPartition.length),\n                        child\n                    ]\n                ];\n            }\n            return [\n                ...acc,\n                [\n                    child\n                ]\n            ];\n        }, []);\n        return partitioned.flatMap((nodes)=>processChildPartition(nodes, parent)).filter((node)=>!!node).flat();\n    }\n    function all(pmNode) {\n        return hydrateMarks(pmNode.children.map((child)=>({\n                node: child,\n                marks: child.marks\n            })), pmNode);\n    }\n    return state;\n}\nexport function fromProseMirror(pmNode, options) {\n    const state = createState(options.nodeHandlers, options.markHandlers);\n    return state.one(pmNode);\n}\nexport function fromPmNode(type, getAttrs) {\n    return (node, _, state)=>{\n        const children = state.all(node);\n        const result = {\n            type,\n            ...getAttrs?.(node),\n            children\n        };\n        return result;\n    };\n}\nexport function fromPmMark(type, getAttrs) {\n    return (mark, _, mdastChildren)=>{\n        const result = {\n            type,\n            ...getAttrs?.(mark),\n            children: mdastChildren\n        };\n        return result;\n    };\n}\n", "import { fromPmNode } from \"@handlewithcare/remark-prosemirror\"\nimport type { Node as PmNode } from \"prosemirror-model\"\nimport type { ExtendedPmNodeSpec } from \"../types.ts\"\nimport { NodeName } from \"./names.ts\"\nimport { withContent } from \"./utils.ts\"\n\nexport function isBlockquoteNode(node: PmNode | undefined): node is PmNode<undefined> {\n\treturn node?.type.name === NodeName.Blockquote\n}\n\nexport const blockquoteNode: ExtendedPmNodeSpec<undefined> = {\n\tcontent: \"block+\",\n\tgroup: \"block\",\n\tdefining: true,\n\ttoMarkdown: fromPmNode(\"blockquote\"),\n\tparseDOM: [{ tag: \"blockquote\" }],\n\ttoDOM() {\n\t\tconst dom = document.createElement(\"blockquote\")\n\t\treturn withContent(dom)\n\t},\n}\n", "import { fromPmMark } from \"@handlewithcare/remark-prosemirror\"\nimport type { Mark as PmMark } from \"prosemirror-model\"\nimport type { ExtendedPmMarkSpec } from \"../types.ts\"\nimport { MarkName } from \"./names.ts\"\nimport { withContent } from \"./utils.ts\"\n\nexport function isBoldMark(mark: PmMark) {\n\treturn mark.type.name === MarkName.Bold\n}\n\nexport const boldMark: ExtendedPmMarkSpec<undefined> = {\n\ttoMarkdown: fromPmMark(\"strong\"),\n\n\ttoDOM() {\n\t\tconst dom = document.createElement(\"strong\")\n\t\treturn withContent(dom)\n\t},\n\n\tparseDOM: [\n\t\t{\n\t\t\ttag: \"strong\",\n\t\t},\n\t\t{\n\t\t\ttag: \"b\",\n\t\t\tgetAttrs(dom: HTMLElement) {\n\t\t\t\t// Google Docs wraps the whole document in a <b> tag.\n\t\t\t\t// We don't want to carry this mark over, so we skip processing\n\t\t\t\t// it when we run into the Google Docs specific id in the dom.\n\t\t\t\tif (dom.id.startsWith(\"docs-internal-guid\")) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\n\t\t\t\treturn null\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttag: \"span\",\n\t\t\tgetAttrs(dom: HTMLElement) {\n\t\t\t\tif (dom.style.fontWeight === \"bold\") return null\n\t\t\t\tif (dom.style.fontWeight === \"bolder\") return null\n\t\t\t\tif (Number(dom.style.fontWeight) > 500) return null\n\t\t\t\treturn false\n\t\t\t},\n\t\t},\n\t],\n}\n", "import { fromPmNode } from \"@handlewithcare/remark-prosemirror\"\nimport type { ExtendedPmNodeSpec } from \"../types.ts\"\n\nexport const doc: ExtendedPmNodeSpec<undefined> = {\n\tcontent: \"block+\",\n\ttoMarkdown: fromPmNode(\"root\"),\n}\n", "export function tryParseNumber(maybeNumber: unknown, asInteger: boolean = false): number | undefined {\n\tif (typeof maybeNumber === \"number\") {\n\t\treturn Number.isNaN(maybeNumber) ? undefined : maybeNumber\n\t}\n\n\tif (typeof maybeNumber !== \"string\") return\n\n\tconst parsed = asInteger ? parseInt(maybeNumber) : parseFloat(maybeNumber)\n\tif (Number.isNaN(parsed)) return\n\treturn parsed\n}\n", "/**\n * Combines a page path with a canonical URL to create a full page URL. Correctly accounts for canonical URLs that include pathnames.\n *\n * @example\n * canonicalURLForPath(\"/about\", \"https://www.framer.com\") // \u2192 \"https://www.framer.com/about\"\n * canonicalURLForPath(\"/about\", \"https://www.framer.com/sites\") // \u2192 \"https://www.framer.com/sites/about\"\n * canonicalURLForPath(\"/about\", \"https://www.framer.com/sites/\") // \u2192 \"https://www.framer.com/sites/about\"\n */\nexport function canonicalURLForPath(path: string, canonicalURL: string): string {\n\tif (path.startsWith(\"/\")) {\n\t\tpath = \".\" + path\n\t}\n\n\tconst baseURL = new URL(canonicalURL)\n\tif (!baseURL.pathname.endsWith(\"/\")) {\n\t\tbaseURL.pathname += \"/\"\n\t}\n\n\tconst url = new URL(path, baseURL)\n\treturn url.href\n}\n", "import type { BaseEngine } from \"document/base-engine/BaseEngine.ts\"\nimport { isVekterEngine } from \"document/useVekterEngine.ts\"\nimport type { VariableReference } from \"../../traits/VariableReference.ts\"\nimport type { WithVariableProvider } from \"../../traits/WithVariableProvider.ts\"\nimport { withVariableProvider } from \"../../traits/WithVariableProvider.ts\"\nimport type { CanvasNode } from \"../CanvasNode.ts\"\nimport { isSmartComponentNode } from \"../utils/nodeCheck.ts\"\n\nfunction getVariableProvider(\n\tengine: BaseEngine,\n\treference: VariableReference,\n): (CanvasNode & WithVariableProvider) | null {\n\tif (reference.providerId) {\n\t\tconst node = engine.tree.get(reference.providerId)\n\t\treturn node && withVariableProvider(node) ? node : null\n\t}\n\n\tif (isVekterEngine(engine)) {\n\t\tconst scope = engine.stores.scopeStore.active\n\t\treturn isSmartComponentNode(scope) ? scope : null\n\t}\n\n\treturn null\n}\n\n/**\n * Returns the variable value from the variable provider.\n */\nexport function getVariableValue(engine: BaseEngine, reference: VariableReference): unknown {\n\tconst provider = getVariableProvider(engine, reference)\n\tif (!provider) return\n\n\tconst valueMap = provider.getProvidedValueMap(\n\t\tengine.tree,\n\t\tundefined,\n\t\tengine.componentLoader,\n\t\tengine.stores.treeStore.sandboxRepeaterData,\n\t\tengine.componentLoader.activeBundleHash,\n\t)\n\tif (!valueMap) return\n\n\treturn valueMap.get(reference.id)\n}\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport type { ItemToSlug } from \"@framerjs/framer-runtime/crossorigin\"\nimport type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport type { CanvasTree } from \"document/models/CanvasTree/CanvasTree.ts\"\nimport { defaultLocaleId } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { getCollectionForIdentifier } from \"./getCollectionForIdentifier.ts\"\nimport { getRouterLocale } from \"./getRouterLocales.ts\"\n\nexport function getItemToSlug(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tdataIdentifier: ModuleExportIdentifierString | null | undefined,\n\tlocaleId = defaultLocaleId,\n): ItemToSlug | undefined {\n\treturn (\n\t\tgetItemToSlugFromTree(tree, dataIdentifier, localeId) ??\n\t\tgetItemToSlugFromComponentLoader(componentLoader, dataIdentifier)\n\t)\n}\n\nexport function getItemToTitle(\n\ttree: CanvasTree,\n\tdataIdentifier: ModuleExportIdentifierString | null | undefined,\n\tlocaleId = defaultLocaleId,\n): ItemToSlug | undefined {\n\tconst routerLocale = getRouterLocale(tree, localeId)\n\tconst collectionNode = getCollectionForIdentifier(tree, dataIdentifier)\n\treturn collectionNode?.getItemToTitle(routerLocale)\n}\n\nfunction getItemToSlugFromTree(\n\ttree: CanvasTree,\n\tdataIdentifier: ModuleExportIdentifierString | null | undefined,\n\tlocaleId = defaultLocaleId,\n): ItemToSlug | undefined {\n\tconst routerLocale = getRouterLocale(tree, localeId)\n\tconst collectionNode = getCollectionForIdentifier(tree, dataIdentifier)\n\treturn collectionNode?.getItemToSlug(routerLocale)\n}\n\nfunction getItemToSlugFromComponentLoader(\n\tcomponentLoader: AnyComponentLoader,\n\tdataIdentifier: ModuleExportIdentifierString | null | undefined,\n): ItemToSlug | undefined {\n\tconst dataDefinition = componentLoader.dataForIdentifier(dataIdentifier)\n\treturn dataDefinition?.itemToSlug\n}\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport { AnnotationKey } from \"@framerjs/framer-runtime/crossorigin\"\nimport { ModuleType, type ModuleExportIdentifierString, isRelativeUrl } from \"@framerjs/shared\"\nimport {\n\tgetAncestorRepeaterIds,\n\ttype ScrollSectionPattern,\n\tisScrollSectionPattern,\n\tisScrollSectionPatternAnnotation,\n\tscrollSectionPatternSeparator,\n} from \"code-generation/utils/elementIdPatternForNode.ts\"\nimport type { BaseEngine } from \"document/base-engine/BaseEngine.ts\"\nimport type { CanvasNode, CanvasTree } from \"document/models/CanvasTree/index.ts\"\nimport type { RouteSegmentNode } from \"document/models/CanvasTree/nodes/RouteSegmentNode.ts\"\nimport type { RouteSegmentRootNode } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.ts\"\nimport { getRouteSegmentRootNode } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.utils.ts\"\nimport {\n\tisCollectionRepeater,\n\tisRouteSegmentNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { createVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { withCollectionDataSource } from \"document/models/CanvasTree/traits/WithCollectionDataSource.ts\"\nimport type { LocaleId } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { hasScrollTarget } from \"document/models/CanvasTree/traits/WithScrollTarget.ts\"\nimport { isCollectionReferenceVariableDefinition } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { LinkVariables, LinkToWebPage } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { createLink } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { slugify } from \"library/utils/slugify.ts\"\nimport { createNestedVariableReference } from \"./collectionReferenceUtils.ts\"\nimport { getItemToSlug } from \"./collectionSlugUtils.ts\"\nimport { getCollectionForIdentifier } from \"./getCollectionForIdentifier.ts\"\nimport { getRouterLocale } from \"./getRouterLocales.ts\"\n\n/**\n * Given a path as input returns a LinkToWebPage object if the path is a valid\n * link to a webpage. Returns undefined if the relative path cannot be resolved.\n */\nexport function getLinkToWebPageFromPath(\n\tpath: string,\n\tengine: BaseEngine,\n\tnode: CanvasNode | null,\n\toptions?: {\n\t\tincludeSelf?: boolean\n\t},\n): LinkToWebPage | undefined {\n\tif (!isRelativeUrl(path)) return\n\n\tconst { hash, path: pathWithoutHash } = parsePathAndHash(path.trim())\n\tconst parsed = parsePathWithLocale(pathWithoutHash, engine)\n\n\tif (parsed.path === \"/\") {\n\t\tconst homePageNodeId = engine.tree.root.homePageNodeId\n\t\tif (!homePageNodeId) return\n\n\t\tconst resolvedHash = hash ? getLinkHashFromPathHash(hash, homePageNodeId, engine, parsed.localeId) : undefined\n\t\tif (hash && !resolvedHash) return\n\n\t\treturn createLink({\n\t\t\twebPageId: homePageNodeId,\n\t\t\thash: resolvedHash?.nodeId,\n\t\t\thashVariables: resolvedHash?.hashVariables,\n\t\t})\n\t}\n\n\tlet currentSegment: RouteSegmentNode | RouteSegmentRootNode = getRouteSegmentRootNode(engine.tree)\n\n\tlet pathVariables: LinkToWebPage[\"pathVariables\"] = undefined\n\n\tfor (const pathSegment of parsed.path.split(\"/\")) {\n\t\t// Leading, trailing, and double slashes are ignored.\n\t\tif (pathSegment === \"\") continue\n\n\t\tconst segmentNode = getSegmentForPath(currentSegment, pathSegment)\n\t\tif (!segmentNode) return\n\n\t\tcurrentSegment = segmentNode\n\n\t\t// A CMS segment needs special processing to ensure the slug is valid.\n\t\tif (segmentNode.dataIdentifier) {\n\t\t\tif (pathSegment.startsWith(\":\")) {\n\t\t\t\tif (!node) return\n\n\t\t\t\tconst targetSlugId = getSlugIdForDataIdentifier(engine, segmentNode.dataIdentifier)\n\t\t\t\tif (!targetSlugId) return\n\n\t\t\t\tconst candidates = function* () {\n\t\t\t\t\tif (options?.includeSelf) yield node\n\t\t\t\t\tyield* node.ancestors()\n\t\t\t\t}\n\n\t\t\t\tfor (const parent of candidates()) {\n\t\t\t\t\tif (!withCollectionDataSource(parent) || !parent.dataIdentifier) continue\n\n\t\t\t\t\tif (parent.dataIdentifier === segmentNode.dataIdentifier) {\n\t\t\t\t\t\tpathVariables ??= {}\n\t\t\t\t\t\tpathVariables[targetSlugId] = createVariableReference(targetSlugId, parent.getPrimaryId())\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\n\t\t\t\t\tconst referenceVariableId = findCollectionReferenceVariable(\n\t\t\t\t\t\tengine,\n\t\t\t\t\t\tparent.dataIdentifier,\n\t\t\t\t\t\tsegmentNode.dataIdentifier,\n\t\t\t\t\t)\n\t\t\t\t\tif (referenceVariableId) {\n\t\t\t\t\t\tpathVariables ??= {}\n\t\t\t\t\t\tpathVariables[targetSlugId] = createNestedVariableReference(\n\t\t\t\t\t\t\treferenceVariableId,\n\t\t\t\t\t\t\ttargetSlugId,\n\t\t\t\t\t\t\tparent.getPrimaryId(),\n\t\t\t\t\t\t)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!pathVariables) return\n\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst slugId = getSlugIdForDataIdentifier(engine, segmentNode.dataIdentifier)\n\t\t\tif (!slugId) return\n\n\t\t\tconst collectionItemId = getCollectionItemIdFromSlug(\n\t\t\t\tengine.tree,\n\t\t\t\tengine.componentLoader,\n\t\t\t\tsegmentNode.dataIdentifier,\n\t\t\t\tparsed.localeId,\n\t\t\t\tpathSegment,\n\t\t\t)\n\t\t\tif (!collectionItemId) return\n\n\t\t\tpathVariables ??= {}\n\t\t\tpathVariables[slugId] = {\n\t\t\t\tcollectionItemId,\n\t\t\t\tvalue: pathSegment,\n\t\t\t\tidentifier: segmentNode.dataIdentifier,\n\t\t\t\tkey: slugId,\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!isRouteSegmentNode(currentSegment)) return\n\n\tconst hasTrailingSlash = parsed.path.endsWith(\"/\")\n\tconst trailingSegmentNode = getSegmentForPath(currentSegment, \"\")\n\n\tconst webPageId =\n\t\t!hasTrailingSlash && currentSegment.webPageId\n\t\t\t? currentSegment.webPageId\n\t\t\t: trailingSegmentNode?.webPageId || currentSegment.webPageId\n\n\tif (!webPageId) return\n\n\tconst resolvedHash = hash ? getLinkHashFromPathHash(hash, webPageId, engine, parsed.localeId) : undefined\n\tif (hash && !resolvedHash) return\n\n\treturn createLink({\n\t\twebPageId,\n\t\tpathVariables,\n\t\thash: resolvedHash?.nodeId,\n\t\thashVariables: resolvedHash?.hashVariables,\n\t})\n}\n\nfunction parsePathAndHash(path: string): { path: string; hash: string | undefined } {\n\tconst hashIndex = path.indexOf(\"#\")\n\tif (hashIndex < 0) return { path, hash: undefined }\n\n\treturn {\n\t\tpath: path.slice(0, hashIndex),\n\t\thash: path.slice(hashIndex + 1) || undefined,\n\t}\n}\n\n/**\n * Given a path, returns the path without the locale slug prefix and extracts the locale ID\n */\nfunction parsePathWithLocale(path: string, engine: BaseEngine): { localeId?: LocaleId | undefined; path: string } {\n\tif (!path.startsWith(\"/\")) path = \"/\" + path\n\n\tif (path === \"/\") return { path }\n\n\tconst locales = engine.tree.root.locales\n\n\tif (!locales || locales.length === 0) return { path }\n\n\tconst pathSegments = path.split(\"/\")\n\tconst firstSegment = pathSegments[1]\n\n\tif (!firstSegment) return { path }\n\n\tconst foundLocale = locales.find(locale => locale.slug === firstSegment)\n\tif (!foundLocale) return { path }\n\n\treturn {\n\t\tpath: \"/\" + pathSegments.slice(2).join(\"/\"),\n\t\tlocaleId: foundLocale.id,\n\t}\n}\n\nfunction getLinkHashFromPathHash(\n\thash: string,\n\twebPageId: string,\n\tengine: BaseEngine,\n\tlocaleId: LocaleId | undefined,\n): { nodeId: string; hashVariables?: LinkVariables | undefined } | undefined {\n\tconst annotationMatch = getLinkHashFromScrollSectionAnnotation(hash, webPageId, engine, localeId)\n\tif (annotationMatch) return annotationMatch\n\n\t// Fallback for cases where screen annotations are unavailable on the canvas.\n\t// This may walk the loaded page subtree to find a matching scroll target.\n\tconst webPage = engine.tree.getNodeWithTrait(webPageId, isWebPageNode)?.loaded\n\tif (!webPage) return undefined\n\n\tfor (const node of webPage.walk()) {\n\t\tif (!hasScrollTarget(node)) continue\n\n\t\tconst hashCandidate = getRepeaterSectionHashCandidate(hash, slugify(node.elementId))\n\t\tif (!hashCandidate) continue\n\n\t\tif (hashCandidate.type === \"direct\") {\n\t\t\treturn { nodeId: node.id }\n\t\t}\n\n\t\tconst hashVariables = matchRepeaterHashVariables(\n\t\t\thashCandidate.slugPrefix,\n\t\t\tgetRepeaterInfosForNode(node, engine, localeId),\n\t\t)\n\t\tif (!hashVariables) continue\n\n\t\treturn {\n\t\t\tnodeId: node.id,\n\t\t\thashVariables,\n\t\t}\n\t}\n}\n\nfunction getLinkHashFromScrollSectionAnnotation(\n\thash: string,\n\twebPageId: string,\n\tengine: BaseEngine,\n\tlocaleId: LocaleId | undefined,\n): { nodeId: string; hashVariables?: LinkVariables | undefined } | undefined {\n\tconst annotation = engine.stores.modulesStore\n\t\t.forType(ModuleType.Screen)\n\t\t.getByStableName(webPageId)\n\t\t?.annotations(null, \"default\")?.[AnnotationKey.FramerScrollSections]\n\tif (!isScrollSectionPatternAnnotation(annotation)) return undefined\n\n\tfor (const nodeId in annotation) {\n\t\tconst info = annotation[nodeId]\n\t\tif (!isScrollSectionPattern(info)) continue\n\n\t\tconst hashCandidate = getRepeaterSectionHashCandidate(hash, slugify(info.name))\n\t\tif (!hashCandidate) continue\n\n\t\tif (hashCandidate.type === \"direct\") {\n\t\t\treturn { nodeId }\n\t\t}\n\n\t\tconst hashVariables = matchRepeaterHashVariables(\n\t\t\thashCandidate.slugPrefix,\n\t\t\tgetRepeaterInfosForPattern(info, engine, localeId),\n\t\t)\n\t\tif (!hashVariables) continue\n\n\t\treturn {\n\t\t\tnodeId,\n\t\t\thashVariables,\n\t\t}\n\t}\n}\n\nfunction getRepeaterInfosForNode(\n\tnode: CanvasNode,\n\tengine: BaseEngine,\n\tlocaleId: LocaleId | undefined,\n): readonly RepeaterHashInfo[] {\n\tconst locale = getRouterLocale(engine.tree, localeId)\n\n\tconst result: RepeaterHashInfo[] = []\n\n\tfor (const repeaterId of getAncestorRepeaterIds(node, engine.tree)) {\n\t\tconst repeater = engine.tree.get(repeaterId)\n\t\tif (!isCollectionRepeater(repeater)) continue\n\n\t\tconst collection = getCollectionForIdentifier(engine.tree, repeater.dataIdentifier)\n\t\tif (!collection) continue\n\n\t\tconst slugVariable = collection.getSlugVariable()\n\t\tif (!slugVariable) continue\n\n\t\tconst itemToSlug = collection.getItemToSlug(locale)\n\t\tresult.push({\n\t\t\tdataIdentifier: repeater.dataIdentifier,\n\t\t\tslugKey: slugVariable.id,\n\t\t\tsortedSlugEntries: getSortedSlugEntries(itemToSlug),\n\t\t})\n\t}\n\n\treturn result\n}\n\nfunction getRepeaterInfosForPattern(\n\tinfo: ScrollSectionPattern,\n\tengine: BaseEngine,\n\tlocaleId: LocaleId | undefined,\n): readonly RepeaterHashInfo[] {\n\tconst locale = getRouterLocale(engine.tree, localeId)\n\n\tconst result: RepeaterHashInfo[] = []\n\n\tfor (const part of info.pattern.split(scrollSectionPatternSeparator)) {\n\t\tconst partId = part.startsWith(\":\") ? part.slice(1) : undefined\n\t\tif (!partId) continue\n\n\t\tconst slugInfo = info.slugs?.[partId]\n\t\tif (!slugInfo) continue\n\n\t\tconst collection = getCollectionForIdentifier(engine.tree, slugInfo.identifier)\n\t\tconst slugVariable = collection?.getSlugVariable()\n\t\tif (!collection || !slugVariable) continue\n\n\t\tconst itemToSlug = collection.getItemToSlug(locale)\n\t\tresult.push({\n\t\t\tdataIdentifier: slugInfo.identifier,\n\t\t\tslugKey: partId,\n\t\t\tsortedSlugEntries: getSortedSlugEntries(itemToSlug),\n\t\t})\n\t}\n\n\treturn result\n}\n\ninterface RepeaterHashInfo {\n\tdataIdentifier: ModuleExportIdentifierString\n\tslugKey: string\n\tsortedSlugEntries: readonly [collectionItemId: string, slug: string][]\n}\n\ntype RepeaterSectionHashCandidate =\n\t| {\n\t\t\ttype: \"direct\"\n\t  }\n\t| {\n\t\t\ttype: \"variables\"\n\t\t\tslugPrefix: string\n\t  }\n\n/**\n * Longest-first matching avoids ambiguous splits when one slug prefixes another,\n * for example `getting` vs `getting-started` in `getting-started-section`.\n */\nfunction getSortedSlugEntries(itemToSlug: Record<string, string>): readonly [collectionItemId: string, slug: string][] {\n\treturn Object.entries(itemToSlug).sort((a, b) => b[1].length - a[1].length)\n}\n\nfunction getRepeaterSectionHashCandidate(hash: string, elementHash: string): RepeaterSectionHashCandidate | undefined {\n\tconst suffix = `${scrollSectionPatternSeparator}${elementHash}`\n\tif (hash === elementHash) {\n\t\treturn { type: \"direct\" }\n\t}\n\tif (!hash.endsWith(suffix)) return undefined\n\n\tconst slugPrefix = hash.slice(0, -suffix.length)\n\tif (!slugPrefix) return undefined\n\n\treturn {\n\t\ttype: \"variables\",\n\t\tslugPrefix,\n\t}\n}\n\nfunction matchRepeaterHashVariables(\n\tremainingHash: string,\n\trepeaterInfos: readonly RepeaterHashInfo[],\n\tindex: number = 0,\n): LinkVariables | undefined {\n\tconst repeaterInfo = repeaterInfos[index]\n\tif (!repeaterInfo) {\n\t\treturn remainingHash.length === 0 ? {} : undefined\n\t}\n\n\tfor (const [collectionItemId, slug] of repeaterInfo.sortedSlugEntries) {\n\t\tif (remainingHash !== slug && !remainingHash.startsWith(`${slug}${scrollSectionPatternSeparator}`)) {\n\t\t\tcontinue\n\t\t}\n\n\t\tconst rest = remainingHash === slug ? \"\" : remainingHash.slice(slug.length + scrollSectionPatternSeparator.length)\n\t\tconst nestedMatch = matchRepeaterHashVariables(rest, repeaterInfos, index + 1)\n\t\tif (!nestedMatch) continue\n\n\t\treturn {\n\t\t\t...nestedMatch,\n\t\t\t[repeaterInfo.slugKey]: {\n\t\t\t\tidentifier: repeaterInfo.dataIdentifier,\n\t\t\t\tcollectionItemId,\n\t\t\t\tkey: repeaterInfo.slugKey,\n\t\t\t\tvalue: slug,\n\t\t\t},\n\t\t}\n\t}\n}\n\nfunction getSlugIdForDataIdentifier(\n\tengine: BaseEngine,\n\tdataIdentifier: ModuleExportIdentifierString | null | undefined,\n): string | undefined {\n\tconst dataDefinition = engine.componentLoader.dataForIdentifier(dataIdentifier)\n\tconst dataDefinitionSlugId = dataDefinition?.annotations?.[AnnotationKey.FramerSlug]\n\tif (dataDefinitionSlugId) return dataDefinitionSlugId\n\n\tconst collectionNode = getCollectionForIdentifier(engine.tree, dataIdentifier)\n\tconst collectionSlugVariable = collectionNode?.getSlugVariable()\n\treturn collectionSlugVariable?.id\n}\n\nfunction getCollectionItemIdFromSlug(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tdataIdentifier: ModuleExportIdentifierString | null | undefined,\n\tlocaleId: LocaleId | undefined,\n\tslug: string,\n) {\n\tconst itemToSlug = getItemToSlug(tree, componentLoader, dataIdentifier, localeId)\n\tif (!itemToSlug) return\n\n\tfor (const itemId in itemToSlug) {\n\t\tconst itemSlug = itemToSlug[itemId]\n\t\tif (!itemSlug) continue\n\n\t\tif (itemSlug === slug) return itemId\n\t}\n}\n\nfunction getSegmentForPath(\n\tsegmentNode: RouteSegmentNode | RouteSegmentRootNode,\n\tsegment: string,\n): RouteSegmentNode | undefined {\n\tlet dataNode: RouteSegmentNode | undefined\n\n\tfor (const node of segmentNode.children) {\n\t\tif (node.dataIdentifier) dataNode = node\n\n\t\tif (node.segment === segment) {\n\t\t\treturn node\n\t\t}\n\t}\n\n\treturn dataNode\n}\n\n/**\n * Finds a CollectionReference variable in the source collection that points to\n * the target collection. Used for cross-collection links where a node inside\n * one collection list needs to link to a different collection's detail page.\n */\nfunction findCollectionReferenceVariable(\n\tengine: BaseEngine,\n\tsourceDataIdentifier: ModuleExportIdentifierString,\n\ttargetDataIdentifier: ModuleExportIdentifierString,\n): VariableID | undefined {\n\tconst sourceCollection = getCollectionForIdentifier(engine.tree, sourceDataIdentifier)\n\tif (!sourceCollection) return\n\n\tfor (const variable of sourceCollection.variables) {\n\t\tif (isCollectionReferenceVariableDefinition(variable) && variable.dataIdentifier === targetDataIdentifier) {\n\t\t\treturn variable.id\n\t\t}\n\t}\n}\n", "import type { BaseEngine } from \"document/base-engine/BaseEngine.ts\"\nimport type { CanvasNode, CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { VariableValueResolver } from \"document/models/CanvasTree/nodes/CanvasNodeCache.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { getWebPageScrollTargets } from \"document/models/CanvasTree/traits/WithScrollTarget.ts\"\nimport type { Link, LinkToWebPage } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { createLink, isLinkToURL, isLinkToWebPage } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { isVekterEngine } from \"document/useVekterEngine.ts\"\nimport { isValidURL, isValidURLWithoutProtocol } from \"document/utils/domainValidation.ts\"\nimport { SlugBehavior, getResolvedLinkToWebPage } from \"document/utils/getResolvedLinkToWebPage.ts\"\nimport { getLinkToWebPageFromPath } from \"utils/getLinkToWebPageFromPath.ts\"\n\nfunction hasVariableReference(link: LinkToWebPage): boolean {\n\tfor (const key in link.pathVariables) {\n\t\tconst value = link.pathVariables[key]\n\t\tif (isVariableReference(value)) return true\n\t}\n\n\treturn false\n}\n\n/**\n * An equivalent to URL.parse. URL.parse should be supported by all relevant browsers and Node.js,\n * but Jest uses JSDOM with whatwg-url, and using it makes tests for this file fail.\n */\nfunction parseURL(url: string) {\n\ttry {\n\t\treturn new URL(url)\n\t} catch {\n\t\treturn null\n\t}\n}\n\n/** decodeURI() can throw if the URL is malformed. Try to decode it, but fall back to the original URL if it fails. */\nfunction decodeURISafe(url: string) {\n\ttry {\n\t\treturn decodeURI(url)\n\t} catch {\n\t\treturn url\n\t}\n}\n\n/** decodeURIComponent() can throw if the URL is malformed. Try to decode it, but fall back to the original URL if it fails. */\nfunction decodeURIComponentSafe(url: string) {\n\ttry {\n\t\treturn decodeURIComponent(url)\n\t} catch {\n\t\treturn url\n\t}\n}\n\nexport function findScrollTargetIdForHash(webPageId: string, rawHash: string, engine: BaseEngine): NodeID | undefined {\n\tconst webPage = engine.tree.getNodeWithTrait(webPageId, isWebPageNode)\n\tif (!webPage || !webPage.isLoaded()) return\n\n\tconst targetID = rawHash.slice(1) // drop the #\n\n\tconst idToElementID = getWebPageScrollTargets(webPage)\n\tfor (const nodeID in idToElementID) {\n\t\tif (idToElementID[nodeID] === targetID) return nodeID\n\t}\n}\n\n/**\n * @example\n * \"example.com\" \u2192 [\"https://example.com/\", \"http://example.com/\"]\n * \"https://example.com/path\" \u2192 [\"https://example.com/path/\", \"http://example.com/path/\"]\n * \"httPs://example.COM/pAth/\" \u2192 [\"https://example.com/pAth/\", \"http://example.com/pAth/\"] // domain is normalized to lowercase, path isn\u2019t, per URL spec\n */\nfunction httpAndHttpsURLs(urlOrHostname: string | undefined, hasProtocol: boolean): URL[] {\n\tif (!urlOrHostname) return []\n\n\tconst parsedURL = parseURL(hasProtocol ? urlOrHostname : `https://${urlOrHostname}`)\n\tif (!parsedURL) return []\n\n\tconst httpsURL = new URL(parsedURL)\n\thttpsURL.protocol = \"https:\"\n\tconst httpURL = new URL(parsedURL)\n\thttpURL.protocol = \"http:\"\n\n\treturn [httpsURL, httpURL]\n}\n\nfunction withTrailingSlash(url: string): string {\n\treturn url.endsWith(\"/\") ? url : url + \"/\"\n}\n\nfunction uniqueUrls(urls: URL[]): URL[] {\n\tconst urlStrings = urls.map(url => url.toString())\n\tconst uniqueUrlStrings = Array.from(new Set(urlStrings))\n\treturn uniqueUrlStrings.map(urlString => new URL(urlString))\n}\n\nexport function resolveLinkToURL(\n\ttree: CanvasTree | undefined,\n\tlink: Link,\n\tvariableValueResolver?: VariableValueResolver,\n): string | undefined {\n\tif (isLinkToURL(link)) {\n\t\treturn link.url\n\t}\n\n\tif (isLinkToWebPage(link)) {\n\t\tif (hasVariableReference(link) && !variableValueResolver) {\n\t\t\treturn getResolvedLinkToWebPage(tree, link, SlugBehavior.DisplayName)\n\t\t}\n\n\t\treturn getResolvedLinkToWebPage(tree, link, SlugBehavior.Resolve, undefined, variableValueResolver)\n\t}\n\n\treturn undefined\n}\n\nexport function getVekterLinkFromURL(engine: BaseEngine, url: string, node: CanvasNode | null): Link | undefined {\n\turl = url.trim()\n\n\tif (url.length === 0) {\n\t\treturn undefined\n\t}\n\n\tconst webPageLink = getLinkToWebPageFromPath(decodeURISafe(url), engine, node)\n\tif (webPageLink) {\n\t\treturn webPageLink\n\t}\n\n\tif (isValidURL(url) || isValidURLWithoutProtocol(url)) {\n\t\treturn createLink({ url })\n\t}\n\n\treturn undefined\n}\n\n/**\n * If the URL is absolute (like `\"https://example.com/some/path\"`), and if it matches the current\n * site, return a matching web page link (like `{ webPageId: \"abc123\" }`).\n *\n * NOTE: if the URL contains a hash, calling this might incur a tree walk (to find the relevant\n * target hash element in the matching web page). If you\u2019re calling this function in a loop, make\n * sure to cache its result to avoid repeated tree walks.\n */\nexport function getWebPageLinkFromURL(url: string, engine: BaseEngine): LinkToWebPage | undefined {\n\tconst parsedURL = parseURL(url)\n\t// can\u2019t parse the URL \u2192 don\u2019t convert it\n\tif (!parsedURL) return\n\n\t// url has query params \u2192 don\u2019t convert it since LinkToWebPage can\u2019t store them\n\tif (parsedURL.search) return\n\n\t// check if the URL is prefixed with any of the known site URLs/domains\n\tconst possibleURLPrefixes = uniqueUrls([\n\t\t...httpAndHttpsURLs(isVekterEngine(engine) ? engine.stores.publishStore.canonicalURL?.url : undefined, true),\n\t\t...httpAndHttpsURLs(engine.stores.hostnameStore.customHostnameString, false),\n\t\t...httpAndHttpsURLs(engine.stores.hostnameStore.defaultHostnameString, false),\n\t])\n\n\tfor (const prefix of possibleURLPrefixes) {\n\t\t// not a matching prefix \u2192 try with the next prefix.\n\t\t// note: adding trailing slashes to avoid the edge case where the canonical URL is\n\t\t// `https://foo.com/path`, and the URL we\u2019re matching against is `https://foo.com/path-2`,\n\t\t// and we (incorrectly) assume the prefix matches the website (and the page slug is `-2`)\n\t\tif (!withTrailingSlash(parsedURL.href).startsWith(withTrailingSlash(prefix.href))) continue\n\n\t\tconst pathname = `/${withTrailingSlash(parsedURL.pathname).slice(withTrailingSlash(prefix.pathname).length)}`\n\n\t\t// decodeURIComponent() because the URL might contain URL-encoded characters (eg cyrillic letters),\n\t\t// but we\u2019re storing pathnames unencoded.\n\t\tconst convertedLink = getLinkToWebPageFromPath(decodeURIComponentSafe(pathname), engine, null)\n\t\t// no matching page \u2192 try with the next prefix\n\t\tif (!convertedLink) continue\n\n\t\tif (parsedURL.hash) {\n\t\t\tconst nodeId = findScrollTargetIdForHash(convertedLink.webPageId, parsedURL.hash, engine)\n\t\t\t// hash didn\u2019t match a section \u2192 try with the next prefix\n\t\t\tif (!nodeId) continue\n\n\t\t\t// hash matched a section \u2192 return the converted link with hash pointing to the section node\n\t\t\treturn { ...convertedLink, hash: nodeId }\n\t\t}\n\n\t\t// no hash \u2192 convert the link\n\t\treturn convertedLink\n\t}\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { canonicalURLForPath } from \"@framerjs/shared/src/ssg/canonicalURLForPath.ts\"\nimport type { BaseEngine } from \"document/base-engine/BaseEngine.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { Link } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { createLink, getLink, isLink } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { type SupportedLinkRelValue, isSupportedLinkRelValue } from \"document/models/SupportedRelValue.ts\"\nimport { isVekterEngine } from \"document/useVekterEngine.ts\"\nimport { AnchorLinkTarget } from \"library/modules/Link/types.ts\"\nimport { phrasing as isPhrasingContent } from \"mdast-util-phrasing\"\nimport type { Mark as PmMark } from \"prosemirror-model\"\nimport { resolveLinkToURL } from \"utils/resolveLink.ts\"\nimport { isArray, isBoolean, isNull, isString } from \"utils/typeChecks.ts\"\nimport type { ExtendedPmMark, ExtendedPmMarkSpec } from \"../types.ts\"\nimport { parseVariable, serializeVariable } from \"../variables.ts\"\nimport { MarkName } from \"./names.ts\"\nimport { setStylePreset, withContent } from \"./utils.ts\"\n\n// Link mark\n\nexport const LINK_ATTR = \"data-framer-link\"\n\nconst VARIABLE_REFERENCE_PREFIX = \"VariableReference:\"\nconst VARIABLE_REFERENCE_PREFIX_LENGTH = VARIABLE_REFERENCE_PREFIX.length\nconst LINK_PREFIX = \"Link:\"\nconst LINK_PREFIX_LENGTH = LINK_PREFIX.length\n\nfunction valueForLinkAttribute(link: Link | VariableReference) {\n\tif (isVariableReference(link)) {\n\t\treturn `${VARIABLE_REFERENCE_PREFIX}${JSON.stringify(link)}`\n\t}\n\n\treturn `${LINK_PREFIX}${JSON.stringify(link)}`\n}\n\nexport function setAnchorElementLink(dom: HTMLElement, link: Link | VariableReference) {\n\t// We set the link as a data attribute so the browser doesn't modify the\n\t// value to be a valid href. E.g if we would set the href to google.com the\n\t// browser would turn this into https://framer.com/google.com. The Link\n\t// component takes care of turning this link into the correct href.\n\tdom.setAttribute(LINK_ATTR, valueForLinkAttribute(link))\n}\n\nfunction urlForLinkAttribute(link: Link | VariableReference, engine: BaseEngine) {\n\tif (isVariableReference(link)) {\n\t\tconst resolved = getVariableValue(engine, link)\n\t\tif (!isLink(resolved)) return\n\n\t\tlink = resolved\n\t}\n\n\tconst resolvedURL = resolveLinkToURL(engine.tree, link, {\n\t\tgetVariableReferenceValue: (variable, variableOverrides) => {\n\t\t\tassert(\n\t\t\t\t!variableOverrides,\n\t\t\t\t\"Prosemirror schema: setAnchorElementHref does not support resolving variable overrides\",\n\t\t\t)\n\t\t\treturn getVariableValue(engine, variable)\n\t\t},\n\t})\n\tif (!resolvedURL) return\n\n\tlet urlWithOrigin = resolvedURL\n\tif (!urlWithOrigin.startsWith(\"https://\") && !urlWithOrigin.startsWith(\"http://\")) {\n\t\tlet origin: string\n\t\tif (isVekterEngine(engine)) {\n\t\t\t// When the canonical URL is available, use it over the custom hostname because it usually reflects\n\t\t\t// the actual URL of the site better\n\t\t\tconst canonicalURL =\n\t\t\t\tengine.stores.publishStore.canonicalURL?.url ?? engine.stores.publishStore.defaultCanonicalURL\n\t\t\tif (!canonicalURL) return\n\t\t\torigin = canonicalURL\n\t\t} else {\n\t\t\tconst hostname =\n\t\t\t\tengine.stores.hostnameStore.customHostnameString ?? engine.stores.hostnameStore.defaultHostnameString\n\t\t\tif (!hostname) return\n\t\t\torigin = `https://${hostname}`\n\t\t}\n\n\t\turlWithOrigin = canonicalURLForPath(resolvedURL, origin)\n\t}\n\n\treturn urlWithOrigin\n}\n\nfunction setAnchorElementHref(dom: HTMLElement, link: Link | VariableReference, engine: BaseEngine) {\n\tconst urlWithOrigin = urlForLinkAttribute(link, engine)\n\tif (!urlWithOrigin) return\n\n\tdom.setAttribute(\"href\", urlWithOrigin)\n}\n\nfunction parseLegacyLinkValue(link: string): VariableReference | Link | undefined {\n\tconst parsedVariable = parseVariable(link)\n\tif (parsedVariable) return parsedVariable\n\tconst linkValue = getLink(link)\n\tassert(!isComputedValue(linkValue), \"Computed values are not supported in rich text.\")\n\treturn linkValue\n}\n\nexport function getAnchorElementLink(dom: HTMLElement): Link | VariableReference | undefined {\n\tconst linkValue = dom.getAttribute(LINK_ATTR)\n\tif (!linkValue) {\n\t\treturn dom instanceof HTMLAnchorElement && dom.href ? parseLegacyLinkValue(dom.href) : undefined\n\t}\n\tif (linkValue.startsWith(VARIABLE_REFERENCE_PREFIX)) {\n\t\tconst variableReference = JSON.parse(linkValue.substring(VARIABLE_REFERENCE_PREFIX_LENGTH))\n\t\treturn isVariableReference(variableReference) ? variableReference : undefined\n\t} else if (linkValue.startsWith(LINK_PREFIX)) {\n\t\tconst link = JSON.parse(linkValue.substring(LINK_PREFIX_LENGTH))\n\t\treturn isLink(link) ? link : undefined\n\t}\n\n\t// This is either an invalid link, or a legacy link.\n\treturn parseLegacyLinkValue(linkValue)\n}\n\nexport const OPEN_IN_NEW_TAB_ATTR = \"data-framer-open-in-new-tab\"\n\nexport function setAnchorElementOpenInNewTab(dom: HTMLElement, isEnabled: boolean | VariableReference) {\n\tif (isVariableReference(isEnabled)) {\n\t\tdom.setAttribute(OPEN_IN_NEW_TAB_ATTR, serializeVariable(isEnabled))\n\t} else if (isEnabled) {\n\t\tdom.setAttribute(OPEN_IN_NEW_TAB_ATTR, \"\")\n\t}\n}\n\nfunction setAnchorElementTarget(dom: HTMLElement, isEnabled: boolean | VariableReference, engine: BaseEngine) {\n\tif (isVariableReference(isEnabled)) {\n\t\tconst resolved = getVariableValue(engine, isEnabled)\n\t\tif (!isBoolean(resolved)) return\n\t\tisEnabled = resolved\n\t}\n\n\tif (isEnabled) {\n\t\tdom.setAttribute(\"target\", \"_blank\")\n\t}\n}\n\nexport const REL_VALUES_VAR_ATTR = \"data-framer-rel\"\nexport function setAnchorElementRelValues(\n\tdom: HTMLElement,\n\tvalues: readonly SupportedLinkRelValue[] | VariableReference | undefined,\n) {\n\tif (isVariableReference(values)) {\n\t\tdom.setAttribute(REL_VALUES_VAR_ATTR, serializeVariable(values))\n\t} else if (isArray(values) && values.length > 0) {\n\t\tdom.setAttribute(\"rel\", values.join(\" \"))\n\t}\n}\n\nexport function getAnchorElementRelValues(\n\tdom: HTMLElement,\n): readonly SupportedLinkRelValue[] | VariableReference | undefined {\n\tconst rel = getAnchorElementRel(dom)\n\tif (isVariableReference(rel)) {\n\t\treturn rel\n\t}\n\treturn rel?.split(\" \").filter(isSupportedLinkRelValue) ?? []\n}\n\nfunction getAnchorElementRel(dom: HTMLElement): string | VariableReference | undefined {\n\tconst relValuesVar = dom.getAttribute(REL_VALUES_VAR_ATTR)\n\tif (relValuesVar) {\n\t\treturn parseVariable(relValuesVar)\n\t}\n\treturn dom.getAttribute(\"rel\") ?? undefined\n}\n\nexport const PRESERVE_PARAMS_ATTR = \"data-framer-preserve-params\"\n\nexport function setAnchorElementPreserveParams(dom: HTMLElement, isEnabled: boolean | VariableReference | undefined) {\n\tif (isVariableReference(isEnabled)) {\n\t\tdom.setAttribute(PRESERVE_PARAMS_ATTR, serializeVariable(isEnabled))\n\t} else if (isBoolean(isEnabled)) {\n\t\t// we have to keep the value in the attribute to enable show/hide of the attribute in the UI\n\t\tdom.setAttribute(PRESERVE_PARAMS_ATTR, isEnabled.toString())\n\t}\n}\n\nexport function getAnchorElementPreserveParams(dom: HTMLElement) {\n\tconst preserveParams = dom.getAttribute(PRESERVE_PARAMS_ATTR)\n\tif (isNull(preserveParams)) return undefined\n\n\tconst variable = parseVariable(preserveParams)\n\tif (variable) return variable\n\n\treturn preserveParams !== \"false\"\n}\n\nexport function getAnchorElementOpenInNewTab(dom: HTMLElement) {\n\tif (dom instanceof HTMLAnchorElement) {\n\t\tconst target = dom.target\n\t\tif (target) return target === AnchorLinkTarget._blank\n\t}\n\n\tconst openInNewTab = dom.getAttribute(OPEN_IN_NEW_TAB_ATTR)\n\tif (isNull(openInNewTab)) return false\n\n\treturn parseVariable(openInNewTab) ?? true\n}\n\nexport const SMOOTH_SCROLL_ATTR = \"data-framer-smooth-scroll\"\n\nexport function setAnchorElementSmoothScroll(dom: HTMLElement, isEnabled: boolean | VariableReference) {\n\tif (isVariableReference(isEnabled)) {\n\t\tdom.setAttribute(SMOOTH_SCROLL_ATTR, serializeVariable(isEnabled))\n\t} else if (isEnabled) {\n\t\tdom.setAttribute(SMOOTH_SCROLL_ATTR, \"\")\n\t}\n}\n\nexport function getAnchorElementSmoothScroll(dom: HTMLElement) {\n\tconst smoothScroll = dom.getAttribute(SMOOTH_SCROLL_ATTR)\n\tif (isNull(smoothScroll)) return false\n\n\treturn parseVariable(smoothScroll) ?? true\n}\n\nexport const CLICK_TRACKING_ID_ATTR = \"data-framer-click-tracking-id\"\n\nexport function setAnchorElementClickTrackingId(\n\tdom: HTMLElement,\n\tclickTrackingId: string | VariableReference | undefined,\n) {\n\tif (isVariableReference(clickTrackingId)) {\n\t\tdom.setAttribute(CLICK_TRACKING_ID_ATTR, serializeVariable(clickTrackingId))\n\t} else if (isString(clickTrackingId)) {\n\t\tdom.setAttribute(CLICK_TRACKING_ID_ATTR, clickTrackingId)\n\t}\n}\n\nexport function getAnchorElementClickTrackingId(dom: HTMLElement) {\n\tconst clickTrackingId = dom.getAttribute(CLICK_TRACKING_ID_ATTR)\n\tif (isNull(clickTrackingId)) return undefined\n\treturn parseVariable(clickTrackingId) ?? clickTrackingId\n}\n\nexport interface LinkAttrs {\n\treadonly link: Link | VariableReference\n\treadonly openInNewTab: boolean | VariableReference\n\treadonly smoothScroll: boolean | VariableReference\n\treadonly clickTrackingId: string | VariableReference | undefined\n\treadonly linkStylePreset: string | undefined\n\treadonly relValues: readonly SupportedLinkRelValue[] | VariableReference | undefined\n\treadonly preserveParams: boolean | VariableReference | undefined\n}\n\nexport type LinkMark = ExtendedPmMark<LinkAttrs>\n\nexport function isLinkMark(mark: PmMark): mark is LinkMark {\n\treturn mark.type.name === MarkName.Link\n}\n\nexport const link = ({ supportsStyles }: { supportsStyles: boolean }): ExtendedPmMarkSpec<LinkAttrs> => ({\n\tattrs: {\n\t\tlink: {},\n\n\t\topenInNewTab: {\n\t\t\tdefault: undefined,\n\t\t},\n\n\t\tsmoothScroll: {\n\t\t\tdefault: false,\n\t\t},\n\n\t\tlinkStylePreset: {\n\t\t\tdefault: undefined,\n\t\t},\n\n\t\tclickTrackingId: {\n\t\t\tdefault: undefined,\n\t\t},\n\n\t\trelValues: {\n\t\t\tdefault: undefined,\n\t\t},\n\n\t\tpreserveParams: {\n\t\t\tdefault: undefined,\n\t\t},\n\t},\n\t// backgroundStyles is not defined if supportsStyles is false\n\texcludes: supportsStyles ? \"link backgroundStyles\" : \"link\",\n\n\ttoMarkdown(mark, _parent, children, _state, engine) {\n\t\tconst resolvedURL = urlForLinkAttribute(mark.attrs.link, engine)\n\t\tif (!resolvedURL) return children\n\n\t\t// Links accept only a subtype of all Mdast nodes as children (e.g. they can receive strong\n\t\t// and emphasis but not heading or paragraph). Let\u2019s satisfy TypeScript.\n\t\tassert(\n\t\t\tchildren.every(isPhrasingContent),\n\t\t\t\"Links accept only phrasing content (strong/em but not paragraph/heading) as children\",\n\t\t)\n\n\t\treturn { type: \"link\", url: resolvedURL, children }\n\t},\n\n\ttoDOM(mark, _inline, engine) {\n\t\tconst dom = document.createElement(\"a\")\n\n\t\tsetAnchorElementLink(dom, mark.attrs.link)\n\t\tif (engine) setAnchorElementHref(dom, mark.attrs.link, engine)\n\t\tsetAnchorElementOpenInNewTab(dom, mark.attrs.openInNewTab)\n\t\tif (engine) setAnchorElementTarget(dom, mark.attrs.openInNewTab, engine)\n\t\tsetAnchorElementSmoothScroll(dom, mark.attrs.smoothScroll)\n\t\tsetAnchorElementClickTrackingId(dom, mark.attrs.clickTrackingId)\n\t\tif (supportsStyles) setStylePreset(dom, mark.attrs.linkStylePreset)\n\t\tsetAnchorElementRelValues(dom, mark.attrs.relValues)\n\t\tsetAnchorElementPreserveParams(dom, mark.attrs.preserveParams)\n\n\t\treturn withContent(dom)\n\t},\n\n\tparseDOM: [\n\t\t{\n\t\t\ttag: \"a\",\n\n\t\t\tgetAttrs(dom: HTMLAnchorElement) {\n\t\t\t\treturn {\n\t\t\t\t\tlink: getAnchorElementLink(dom) ?? createLink({ url: \"\" }),\n\t\t\t\t\topenInNewTab: getAnchorElementOpenInNewTab(dom),\n\t\t\t\t\tsmoothScroll: getAnchorElementSmoothScroll(dom),\n\t\t\t\t\tclickTrackingId: getAnchorElementClickTrackingId(dom),\n\t\t\t\t\tlinkStylePreset: supportsStyles ? dom.dataset.stylesPreset : undefined,\n\t\t\t\t\trelValues: getAnchorElementRelValues(dom),\n\t\t\t\t\tpreserveParams: getAnchorElementPreserveParams(dom),\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t],\n})\n", "import { createAbsoluteImageAssetURL, isAssetReference, parseAssetReference } from \"@framerjs/assets\"\nimport { isSupportedLinkRelValueArray } from \"document/models/SupportedRelValue.ts\"\nimport type { Node as PmNode } from \"prosemirror-model\"\nimport { tryParseNumber } from \"utils/tryParseNumber.ts\"\nimport { isBoolean, isString } from \"utils/typeChecks.ts\"\nimport type { ExtendedPmNodeSpec } from \"../types.ts\"\nimport {\n\ttype LinkAttrs,\n\tgetAnchorElementClickTrackingId,\n\tgetAnchorElementLink,\n\tgetAnchorElementOpenInNewTab,\n\tgetAnchorElementPreserveParams,\n\tgetAnchorElementRelValues,\n\tgetAnchorElementSmoothScroll,\n\tsetAnchorElementClickTrackingId,\n\tsetAnchorElementLink,\n\tsetAnchorElementOpenInNewTab,\n\tsetAnchorElementPreserveParams,\n\tsetAnchorElementRelValues,\n\tsetAnchorElementSmoothScroll,\n} from \"./link.ts\"\nimport { NodeName } from \"./names.ts\"\n\nexport type ImageNode = PmNode<ImageAttrs>\n\nexport function isImageNode(node: PmNode | undefined): node is ImageNode {\n\treturn node?.type.name === NodeName.Image\n}\n\nexport interface ImageAttrs extends Partial<Omit<LinkAttrs, \"linkStylePreset\">> {\n\treadonly src: string\n\treadonly alt?: string\n\treadonly pixelWidth?: number\n\treadonly pixelHeight?: number\n\t/**\n\t * The technical representation of the image.\n\t * - image: A regular image tag.\n\t * - video: Used for GIF-as-video images. We track if it's a video under the\n\t *   hood due to the difference in the DOM APIs.\n\t */\n\treadonly type: \"image\" | \"video\"\n}\n\n/**\n * Assume most people have high DPI screens. Can't use `devicePixelRatio`\n * because this is persisted to the tree. History:\n *\n * https://github.com/framer/FramerStudio/pull/11485#discussion_r865877139\n */\nconst ASSUMED_IMAGE_DEVICE_PIXEL_RATIO = 2\n\nexport const image: ExtendedPmNodeSpec<ImageAttrs> = {\n\tgroup: \"block\",\n\n\tdraggable: true,\n\tselectable: true,\n\n\tattrs: {\n\t\tsrc: {},\n\t\talt: { default: undefined },\n\t\tpixelWidth: { default: undefined },\n\t\tpixelHeight: { default: undefined },\n\t\ttype: { default: \"image\" },\n\t\tlink: { default: undefined },\n\t\topenInNewTab: {\n\t\t\tdefault: undefined,\n\t\t},\n\t\tsmoothScroll: {\n\t\t\tdefault: false,\n\t\t},\n\t\tclickTrackingId: {\n\t\t\tdefault: undefined,\n\t\t},\n\t\trelValues: {\n\t\t\tdefault: undefined,\n\t\t},\n\t\tpreserveParams: {\n\t\t\tdefault: undefined,\n\t\t},\n\t},\n\n\ttoMarkdown: (node: PmNode<ImageAttrs>) => {\n\t\tlet url = node.attrs.src\n\n\t\tif (isAssetReference(node.attrs.src)) {\n\t\t\tconst parsedReference = parseAssetReference(node.attrs.src)\n\t\t\t// If parsing fails, skip serialization\n\t\t\tif (!parsedReference) return null\n\n\t\t\turl = createAbsoluteImageAssetURL(parsedReference.identifier)\n\t\t}\n\n\t\treturn { type: \"paragraph\", children: [{ type: \"image\", url, alt: node.attrs.alt }] }\n\t},\n\n\ttoDOM(node) {\n\t\tlet element: HTMLImageElement | HTMLVideoElement\n\t\tif (node.attrs.type === \"video\") {\n\t\t\telement = document.createElement(\"video\")\n\t\t\telement.setAttribute(\"autoplay\", \"\")\n\t\t\telement.setAttribute(\"loop\", \"\")\n\t\t\telement.setAttribute(\"muted\", \"\")\n\t\t\telement.setAttribute(\"playsinline\", \"\")\n\t\t} else {\n\t\t\telement = document.createElement(\"img\")\n\t\t\telement.alt = node.attrs.alt ?? \"\"\n\t\t\tif (node.attrs.pixelWidth) {\n\t\t\t\telement.dataset.framerWidth = node.attrs.pixelWidth.toString()\n\t\t\t\telement.width = node.attrs.pixelWidth / ASSUMED_IMAGE_DEVICE_PIXEL_RATIO\n\t\t\t}\n\t\t\tif (node.attrs.pixelHeight) {\n\t\t\t\telement.dataset.framerHeight = node.attrs.pixelHeight.toString()\n\t\t\t\telement.height = node.attrs.pixelHeight / ASSUMED_IMAGE_DEVICE_PIXEL_RATIO\n\t\t\t}\n\t\t\tif (node.attrs.pixelWidth && node.attrs.pixelHeight) {\n\t\t\t\telement.style.aspectRatio = `${node.attrs.pixelWidth}/${node.attrs.pixelHeight}`\n\t\t\t}\n\t\t\tif (node.attrs.link) {\n\t\t\t\tsetAnchorElementLink(element, node.attrs.link)\n\t\t\t}\n\t\t\tif (isBoolean(node.attrs.openInNewTab)) {\n\t\t\t\tsetAnchorElementOpenInNewTab(element, node.attrs.openInNewTab)\n\t\t\t}\n\t\t\tif (isBoolean(node.attrs.smoothScroll)) {\n\t\t\t\tsetAnchorElementSmoothScroll(element, node.attrs.smoothScroll)\n\t\t\t}\n\t\t\tif (isString(node.attrs.clickTrackingId)) {\n\t\t\t\tsetAnchorElementClickTrackingId(element, node.attrs.clickTrackingId)\n\t\t\t}\n\t\t\tif (isSupportedLinkRelValueArray(node.attrs.relValues)) {\n\t\t\t\tsetAnchorElementRelValues(element, node.attrs.relValues)\n\t\t\t}\n\t\t\tif (isBoolean(node.attrs.preserveParams)) {\n\t\t\t\tsetAnchorElementPreserveParams(element, node.attrs.preserveParams)\n\t\t\t}\n\t\t}\n\t\tif (isAssetReference(node.attrs.src)) {\n\t\t\t// NOTE: This property is also used in `getAssetReferences.ts`.\n\t\t\telement.dataset.framerAsset = node.attrs.src\n\t\t\t// Also serialize `src` so the image can be copy-pasted\n\t\t\tconst parsedReference = parseAssetReference(node.attrs.src)\n\t\t\tif (parsedReference) element.src = createAbsoluteImageAssetURL(parsedReference.identifier)\n\t\t} else {\n\t\t\telement.src = node.attrs.src\n\t\t}\n\t\telement.className = \"framer-image\"\n\n\t\treturn element\n\t},\n\n\tparseDOM: [\n\t\t{\n\t\t\ttag: \"img\",\n\t\t\tgetAttrs(dom: HTMLImageElement): ImageAttrs {\n\t\t\t\t// NOTE: This method is also used during our pasting logic and\n\t\t\t\t// currently it discards width and height attributes when\n\t\t\t\t// parsing img tags.\n\t\t\t\tlet pixelWidth = tryParseNumber(dom.dataset.framerWidth, true)\n\t\t\t\tif (!pixelWidth && dom.naturalWidth > 0) pixelWidth = dom.naturalWidth\n\t\t\t\tlet pixelHeight = tryParseNumber(dom.dataset.framerHeight, true)\n\t\t\t\tif (!pixelHeight && dom.naturalHeight > 0) pixelHeight = dom.naturalHeight\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"image\",\n\t\t\t\t\tsrc: getFramerAssetSrc(dom),\n\t\t\t\t\talt: dom.alt,\n\t\t\t\t\tpixelWidth,\n\t\t\t\t\tpixelHeight,\n\t\t\t\t\tlink: getAnchorElementLink(dom),\n\t\t\t\t\topenInNewTab: getAnchorElementOpenInNewTab(dom),\n\t\t\t\t\tsmoothScroll: getAnchorElementSmoothScroll(dom),\n\t\t\t\t\tclickTrackingId: getAnchorElementClickTrackingId(dom),\n\t\t\t\t\trelValues: getAnchorElementRelValues(dom),\n\t\t\t\t\tpreserveParams: getAnchorElementPreserveParams(dom),\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\n\t\t{\n\t\t\ttag: \"video.framer-image\",\n\t\t\tgetAttrs(dom: HTMLVideoElement): ImageAttrs {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"video\",\n\t\t\t\t\tsrc: getFramerAssetSrc(dom),\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t],\n}\n\n/**\n * Returns the Framer asset source of a DOM element. Prefers\n * `data-framer-asset` (which carries the original asset reference) over the\n * element's `src` (typically the resolved absolute CDN URL).\n */\nexport function getFramerAssetSrc(element: HTMLElement): string {\n\tlet assetSource = element.dataset.framerAsset\n\tassetSource ||= element instanceof HTMLImageElement || element instanceof HTMLVideoElement ? element.src : undefined\n\treturn assetSource ?? \"\"\n}\n", "/**\n * @typedef {import('unist').Node} UnistNode\n * @typedef {import('unist').Parent} UnistParent\n */\n\n/**\n * @typedef {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10} Uint\n *   Number; capped reasonably.\n * @see https://github.com/syntax-tree/unist-util-visit-parents/blob/main/lib/index.js\n */\n\n/**\n * @typedef {I extends 0 ? 1 : I extends 1 ? 2 : I extends 2 ? 3 : I extends 3 ? 4 : I extends 4 ? 5 : I extends 5 ? 6 : I extends 6 ? 7 : I extends 7 ? 8 : I extends 8 ? 9 : 10} Increment\n *   Increment a number in the type system.\n * @template {Uint} [I=0]\n *   Index.\n * @see https://github.com/syntax-tree/unist-util-visit-parents/blob/main/lib/index.js\n */\n\n/**\n * @typedef {(\n *   Tree extends UnistParent\n *     ? Depth extends Max\n *       ? Tree\n *       : Tree | InclusiveDescendant<Tree['children'][number], Max, Increment<Depth>>\n *     : Tree\n * )} InclusiveDescendant\n *   Collect all (inclusive) descendants of `Tree`.\n *\n *   > \uD83D\uDC49 **Note**: for performance reasons, this seems to be the fastest way to\n *   > recurse without actually running into an infinite loop, which the\n *   > previous version did.\n *   >\n *   > Practically, a max of `2` is typically enough assuming a `Root` is\n *   > passed, but it doesn\u2019t improve performance.\n *   > It gets higher with `List > ListItem > Table > TableRow > TableCell`.\n *   > Using up to `10` doesn\u2019t hurt or help either.\n * @template {UnistNode} Tree\n *   Tree type.\n * @template {Uint} [Max=10]\n *   Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n *   Current depth.\n * @see https://github.com/syntax-tree/unist-util-visit-parents/blob/main/lib/index.js\n */\n\n/**\n * @template {UnistNode} Tree\n *   Node type.\n * @typedef {(\n *   (\n *     node: InclusiveDescendant<Tree>,\n *     index: number | undefined,\n *     parent: Extract<InclusiveDescendant<Tree>, UnistParent> | undefined\n *   ) => Tree | InclusiveDescendant<Tree>\n * )} MapFunction\n *   Function called with a node, its index, and its parent to produce a new\n *   node.\n */\n\n/**\n * Create a new tree by mapping all nodes with the given function.\n *\n * @template {UnistNode} Tree\n *   Type of input tree.\n * @param {Tree} tree\n *   Tree to map.\n * @param {MapFunction<Tree>} mapFunction\n *   Function called with a node, its index, and its parent to produce a new\n *   node.\n * @returns {InclusiveDescendant<Tree>}\n *   New mapped tree.\n */\nexport function map(tree, mapFunction) {\n  const result = preorder(tree, undefined, undefined)\n\n  // @ts-expect-error: the new node is expected.\n  return result\n\n  /** @type {MapFunction<UnistNode | UnistParent>} */\n  function preorder(oldNode, index, parent) {\n    /** @type {UnistNode} */\n    const newNode = {\n      ...mapFunction(\n        // @ts-expect-error: the old node is expected.\n        oldNode,\n        index,\n        parent\n      )\n    }\n\n    if ('children' in oldNode) {\n      const newNodeAstParent = /** @type {UnistParent} */ (newNode)\n\n      const nextChildren = oldNode.children.map(function (child, index) {\n        return preorder(child, index, oldNode)\n      })\n\n      newNodeAstParent.children = nextChildren\n    }\n\n    return newNode\n  }\n}\n", "import type { Mark as PmMark } from \"prosemirror-model\"\nimport { map as mapTree } from \"unist-util-map\"\nimport type { ExtendedPmMark, ExtendedPmMarkSpec } from \"../types.ts\"\nimport { MarkName } from \"./names.ts\"\nimport { setStylePreset, withContent } from \"./utils.ts\"\n\nexport interface InlineCodeAttrs {\n\treadonly inlineCodeStylePreset: string | undefined\n}\n\ntype InlineCodeMark = ExtendedPmMark<InlineCodeAttrs>\n\nexport function isInlineCodeMark(mark: PmMark): mark is InlineCodeMark {\n\treturn mark.type.name === MarkName.InlineCode\n}\n\nexport const inlineCode = ({ supportsStyles }: { supportsStyles: boolean }): ExtendedPmMarkSpec<InlineCodeAttrs> => ({\n\t// backgroundMask and backgroundStyles are not defined if supportsStyles is false\n\texcludes: supportsStyles ? \"inlineCode backgroundMask backgroundStyles\" : \"inlineCode\",\n\n\tattrs: {\n\t\tinlineCodeStylePreset: {\n\t\t\tdefault: undefined,\n\t\t},\n\t},\n\n\ttoMarkdown(_mark, _parent, children) {\n\t\t// Simple scenario: the ProseMirror tree is an equivalent of\n\t\t//   <code>{\"Hello, \"}{\"world\"}</code>\n\t\t// In this scenario, `toMarkdown` will be called with mdast nodes\n\t\t//   children = [{ type: \"text\", value: \"Hello, \" }, { type: \"text\", value: \"world\" }]\n\t\t// and we can just concat their values.\n\t\tconst allChildrenAreText = children.every(child => child.type === \"text\")\n\t\tif (allChildrenAreText) {\n\t\t\treturn {\n\t\t\t\ttype: \"inlineCode\",\n\t\t\t\tvalue: children.map(child => child.value).join(\"\"),\n\t\t\t}\n\t\t}\n\n\t\t// Complex scenario: the ProseMirror tree is an equivalent of\n\t\t//   <code><strong><em>Hello, world</em></strong></code>\n\t\t// In this scenario, the passed `children` will look like\n\t\t//   children = [{ type: \"strong\", children: [{ type: \"emphasis\", children: [{ type: \"text\", value: \"Hello, world\" }] }] }]\n\t\t//\n\t\t// We cannot serialize the above children into inlineCode nodes as-is. Markdown simply doesn\u2019t support it:\n\t\t// you cannot do\n\t\t//   `**_Hello world_**`\n\t\t// to bolden and italicize some code. So, instead, we have to walk the tree down until the find\n\t\t// the leaf `text` nodes \u2013 and wrap *these* nodes with inlineCode.\n\t\treturn children.map(child => {\n\t\t\treturn mapTree(child, node => {\n\t\t\t\tif (node.type === \"text\") {\n\t\t\t\t\treturn { type: \"inlineCode\" as const, value: node.value }\n\t\t\t\t}\n\t\t\t\treturn { ...node }\n\t\t\t})\n\t\t})\n\t},\n\n\ttoDOM(mark) {\n\t\tconst dom = document.createElement(\"code\")\n\t\tif (supportsStyles) setStylePreset(dom, mark.attrs.inlineCodeStylePreset)\n\t\treturn withContent(dom)\n\t},\n\n\tparseDOM: [\n\t\t{\n\t\t\ttag: \"code\",\n\n\t\t\tgetAttrs(dom: HTMLElement) {\n\t\t\t\treturn {\n\t\t\t\t\tinlineCodeStylePreset: supportsStyles ? dom.dataset.stylesPreset : undefined,\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\n\t\t{\n\t\t\ttag: \"span\",\n\n\t\t\tgetAttrs(dom: HTMLElement) {\n\t\t\t\tif (dom.style.fontFamily?.includes(\"monospace\")) return null\n\t\t\t\treturn false\n\t\t\t},\n\t\t},\n\t],\n})\n", "import type { Mark as PmMark } from \"prosemirror-model\"\nimport { InlineStyles, getStyles, setStyles } from \"../styles.ts\"\nimport type { ExtendedPmMark, ExtendedPmMarkSpec } from \"../types.ts\"\nimport { MarkName } from \"./names.ts\"\nimport { withContent } from \"./utils.ts\"\n\n// Inline styles mark\n\nexport interface InlineStylesAttrs {\n\treadonly inlineStyles: InlineStyles\n}\n\ntype InlineStylesMark = ExtendedPmMark<InlineStylesAttrs>\n\nexport function isInlineStylesMark(mark: PmMark): mark is InlineStylesMark {\n\treturn mark.type.name === MarkName.InlineStyles\n}\n\nexport const inlineStyles: ExtendedPmMarkSpec<InlineStylesAttrs> = {\n\tattrs: {\n\t\tinlineStyles: {\n\t\t\tdefault: {},\n\t\t},\n\t},\n\n\ttoMarkdown: (_mark, _parent, children) => {\n\t\t// Do not serialize this mark to markdown\n\t\treturn children\n\t},\n\n\ttoDOM(mark) {\n\t\tconst dom = document.createElement(\"span\")\n\t\tsetStyles(dom.style, InlineStyles.transforms, mark.attrs.inlineStyles)\n\t\treturn withContent(dom)\n\t},\n\n\tparseDOM: [\n\t\t{\n\t\t\ttag: \"span\",\n\t\t\tconsuming: false,\n\n\t\t\tgetAttrs(dom: HTMLSpanElement) {\n\t\t\t\treturn {\n\t\t\t\t\tinlineStyles: getStyles(dom.style, InlineStyles.transforms),\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t],\n}\n", "import { fromPmMark } from \"@handlewithcare/remark-prosemirror\"\nimport type { Mark as PmMark } from \"prosemirror-model\"\nimport type { ExtendedPmMarkSpec } from \"../types.ts\"\nimport { MarkName } from \"./names.ts\"\nimport { withContent } from \"./utils.ts\"\n\nexport function isItalicMark(mark: PmMark) {\n\treturn mark.type.name === MarkName.Italic\n}\n\nexport const italicMark: ExtendedPmMarkSpec<undefined> = {\n\ttoMarkdown: fromPmMark(\"emphasis\"),\n\n\ttoDOM() {\n\t\tconst dom = document.createElement(\"em\")\n\t\treturn withContent(dom)\n\t},\n\n\tparseDOM: [\n\t\t{\n\t\t\ttag: \"em\",\n\t\t},\n\n\t\t{\n\t\t\ttag: \"i\",\n\t\t},\n\n\t\t{\n\t\t\ttag: \"span\",\n\t\t\tgetAttrs(dom: HTMLElement) {\n\t\t\t\tif (dom.style.fontStyle === \"italic\") return null\n\t\t\t\tif (dom.style.fontStyle === \"oblique\") return null\n\t\t\t\treturn false\n\t\t\t},\n\t\t},\n\t],\n}\n", "import { fromPmNode } from \"@handlewithcare/remark-prosemirror\"\nimport type { ExtendedPmNodeSpec } from \"../types.ts\"\n\nexport const lineBreakNode: ExtendedPmNodeSpec<undefined> = {\n\tinline: true,\n\tgroup: \"inline\",\n\n\tselectable: false,\n\n\tleafText: () => \"\\n\",\n\n\ttoMarkdown: fromPmNode(\"break\"),\n\n\ttoDOM() {\n\t\treturn document.createElement(\"br\")\n\t},\n\n\tparseDOM: [\n\t\t{\n\t\t\t// When serializing we add a trailing break if the last node is a line break.\n\t\t\ttag: \"br.trailing-break\",\n\t\t\tignore: true,\n\t\t},\n\n\t\t{\n\t\t\ttag: \"br\",\n\t\t},\n\t],\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport { fromPmNode } from \"@handlewithcare/remark-prosemirror\"\nimport type { Node as PmNode } from \"prosemirror-model\"\nimport { BlockStyles, InlineStyles, getStyles, setStyles } from \"../styles.ts\"\nimport type { ExtendedPmNodeSpec } from \"../types.ts\"\nimport { NodeName } from \"./names.ts\"\nimport {\n\ttype PmNodeTextDirection,\n\ttype TextStylePreset,\n\tattrsToDefaults,\n\tgetStylePreset,\n\tparseTextDirection,\n\tsetDirFromTextDirection,\n\tsetStylePreset,\n\twithContent,\n} from \"./utils.ts\"\n\nconst textBlockTags = [\"p\", \"div\", \"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"] as const\nexport type TextBlockTag = (typeof textBlockTags)[number]\n\nexport function isTextBlockTag(tag: string): tag is TextBlockTag {\n\treturn textBlockTags.includes(tag as TextBlockTag)\n}\n\nexport interface TextBlockAttrs {\n\treadonly textDirection: PmNodeTextDirection\n\treadonly inlineStyles: InlineStyles\n\treadonly blockStyles: BlockStyles\n\treadonly textStylePreset: TextStylePreset\n\treadonly tag: TextBlockTag\n}\n\nexport type TextBlockNode = PmNode<TextBlockAttrs>\n\nexport function isTextBlockNode(node: PmNode | null | undefined): node is TextBlockNode {\n\treturn node?.type.name === NodeName.TextBlock\n}\n\nconst headerTagToLevel = {\n\th1: 1,\n\th2: 2,\n\th3: 3,\n\th4: 4,\n\th5: 5,\n\th6: 6,\n} as const\n\nexport const getDefaultTextBlockAttrs = (): TextBlockAttrs => ({\n\ttextDirection: \"auto\",\n\tinlineStyles: {},\n\tblockStyles: {},\n\ttextStylePreset: undefined,\n\ttag: \"p\",\n})\n\nexport const textBlock = ({ supportsStyles }: { supportsStyles: boolean }): ExtendedPmNodeSpec<TextBlockAttrs> => ({\n\tcontent: \"inline*\",\n\tgroup: \"block\",\n\n\tattrs: attrsToDefaults(getDefaultTextBlockAttrs()),\n\n\ttoMarkdown(node: PmNode<TextBlockAttrs>, parent, state) {\n\t\tconst tag = node.attrs.tag\n\t\tswitch (tag) {\n\t\t\tcase \"p\":\n\t\t\tcase \"div\":\n\t\t\t\treturn fromPmNode(\"paragraph\")(node, parent, state)\n\t\t\tcase \"h1\":\n\t\t\tcase \"h2\":\n\t\t\tcase \"h3\":\n\t\t\tcase \"h4\":\n\t\t\tcase \"h5\":\n\t\t\tcase \"h6\":\n\t\t\t\treturn fromPmNode(\"heading\", () => ({ depth: headerTagToLevel[tag] }))(node, parent, state)\n\t\t\tdefault:\n\t\t\t\tassertNever(tag)\n\t\t}\n\t},\n\n\ttoDOM(node) {\n\t\tconst dom = document.createElement(node.attrs.tag)\n\n\t\tsetDirFromTextDirection(dom, node)\n\n\t\tif (supportsStyles) {\n\t\t\tsetStyles(dom.style, InlineStyles.transforms, node.attrs.inlineStyles)\n\t\t\tsetStyles(dom.style, BlockStyles.transforms, node.attrs.blockStyles)\n\t\t\tsetStylePreset(dom, node.attrs.textStylePreset)\n\t\t}\n\n\t\treturn withContent(dom)\n\t},\n\n\tparseDOM: textBlockTags.map(tag => {\n\t\treturn {\n\t\t\ttag,\n\n\t\t\tgetAttrs(dom: HTMLParagraphElement) {\n\t\t\t\tconst parsedDir = parseTextDirection(dom)\n\t\t\t\treturn {\n\t\t\t\t\ttextDirection: parsedDir,\n\t\t\t\t\tinlineStyles: supportsStyles ? getStyles(dom.style, InlineStyles.transforms) : {},\n\t\t\t\t\tblockStyles: supportsStyles ? getStyles(dom.style, BlockStyles.transforms) : {},\n\t\t\t\t\ttextStylePreset: supportsStyles ? getStylePreset(dom.dataset.stylesPreset) : undefined,\n\t\t\t\t\ttag,\n\t\t\t\t}\n\t\t\t},\n\t\t}\n\t}),\n})\n", "import { fromPmNode } from \"@handlewithcare/remark-prosemirror\"\nimport type { Node as PmNode } from \"prosemirror-model\"\nimport { BlockStyles, InlineStyles, getStyles, setStyles } from \"../styles.ts\"\nimport type { ExtendedPmNodeSpec } from \"../types.ts\"\nimport { NodeName } from \"./names.ts\"\nimport { isTextBlockNode } from \"./textBlock.ts\"\nimport {\n\ttype PmNodeTextDirection,\n\ttype TextStylePreset,\n\tattrsToDefaults,\n\tgetStylePreset,\n\tparseTextDirection,\n\tsetDirFromTextDirection,\n\tsetStylePreset,\n\twithContent,\n} from \"./utils.ts\"\n\nexport type BulletedListNode = PmNode<BulletedListAttrs>\n\nexport function isBulletedListNode(node: PmNode | undefined): node is BulletedListNode {\n\treturn node?.type.name === NodeName.BulletedList\n}\n\nexport interface BulletedListAttrs {\n\treadonly textDirection: PmNodeTextDirection\n\treadonly inlineStyles: InlineStyles\n\treadonly blockStyles: BlockStyles\n\treadonly textStylePreset: TextStylePreset\n}\n\nexport const getDefaultBulletedListAttrs = (): BulletedListAttrs => ({\n\ttextDirection: \"auto\",\n\tinlineStyles: {},\n\tblockStyles: {},\n\ttextStylePreset: undefined,\n})\n\nexport const bulletedList = ({\n\tsupportsStyles,\n}: {\n\tsupportsStyles: boolean\n}): ExtendedPmNodeSpec<BulletedListAttrs> => ({\n\tcontent: \"listItem+\",\n\tgroup: \"block list\",\n\n\tattrs: attrsToDefaults(getDefaultBulletedListAttrs()),\n\n\ttoMarkdown: fromPmNode(\"list\", () => ({\n\t\tordered: false,\n\t})),\n\n\ttoDOM(node) {\n\t\tconst dom = document.createElement(\"ul\")\n\n\t\tsetDirFromTextDirection(dom, node)\n\n\t\tif (supportsStyles) {\n\t\t\tsetStyles(dom.style, InlineStyles.transforms, node.attrs.inlineStyles)\n\t\t\tsetStyles(dom.style, BlockStyles.transforms, node.attrs.blockStyles)\n\t\t\tsetStylePreset(dom, node.attrs.textStylePreset)\n\t\t}\n\n\t\treturn withContent(dom)\n\t},\n\n\tparseDOM: [\n\t\t{\n\t\t\ttag: \"ul\",\n\n\t\t\tgetAttrs(dom: HTMLUListElement) {\n\t\t\t\treturn {\n\t\t\t\t\ttextDirection: parseTextDirection(dom),\n\t\t\t\t\tinlineStyles: supportsStyles ? getStyles(dom.style, InlineStyles.transforms) : {},\n\t\t\t\t\tblockStyles: supportsStyles ? getStyles(dom.style, BlockStyles.transforms) : {},\n\t\t\t\t\ttextStylePreset: supportsStyles ? getStylePreset(dom.dataset.stylesPreset) : undefined,\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t],\n})\n\nexport function isNumberedListNode(node: PmNode | undefined): node is NumberedListNode {\n\treturn node?.type.name === NodeName.NumberedList\n}\n\nexport interface NumberedListAttrs {\n\treadonly textDirection: PmNodeTextDirection\n\treadonly inlineStyles: InlineStyles\n\treadonly blockStyles: BlockStyles\n\treadonly textStylePreset: TextStylePreset\n\treadonly listStyleType: string\n\treadonly start: number\n}\n\nexport type NumberedListNode = PmNode<NumberedListAttrs>\n\nfunction getListStyleType(dom: HTMLOListElement): string {\n\tconst framerListStyleType = dom.style.getPropertyValue(\"--list-style-type\")\n\tconst listStyleType = dom.style.getPropertyValue(\"list-style-type\")\n\n\t// Sometimes the list style type is set on the <li> elements themselves,\n\t// for example in text copied from Google Docs.\n\tconst childListStyleType =\n\t\tdom.firstElementChild instanceof HTMLLIElement\n\t\t\t? dom.firstElementChild.style.getPropertyValue(\"list-style-type\")\n\t\t\t: undefined\n\n\treturn framerListStyleType || listStyleType || childListStyleType || \"decimal\"\n}\n\nexport const getDefaultNumberedListAttrs = (): NumberedListAttrs => ({\n\ttextDirection: \"auto\",\n\tinlineStyles: {},\n\tblockStyles: {},\n\ttextStylePreset: undefined,\n\tlistStyleType: \"decimal\",\n\tstart: 1,\n})\n\nexport const numberedList = ({\n\tsupportsStyles,\n}: {\n\tsupportsStyles: boolean\n}): ExtendedPmNodeSpec<NumberedListAttrs> => ({\n\tcontent: \"listItem+\",\n\tgroup: \"block list\",\n\n\tattrs: attrsToDefaults(getDefaultNumberedListAttrs()),\n\n\ttoMarkdown: fromPmNode(\"list\", (node: PmNode<NumberedListAttrs>) => ({\n\t\tordered: true,\n\t\tstart: node.attrs.start,\n\t})),\n\n\ttoDOM(node) {\n\t\tconst dom = document.createElement(\"ol\")\n\n\t\tsetDirFromTextDirection(dom, node)\n\n\t\tif (supportsStyles) {\n\t\t\tsetStyles(dom.style, InlineStyles.transforms, node.attrs.inlineStyles)\n\t\t\tsetStyles(dom.style, BlockStyles.transforms, node.attrs.blockStyles)\n\t\t\tsetStylePreset(dom, node.attrs.textStylePreset)\n\t\t}\n\n\t\tif (node.attrs.listStyleType !== \"decimal\") {\n\t\t\tdom.style.setProperty(\"--list-style-type\", node.attrs.listStyleType)\n\t\t}\n\n\t\tif (node.attrs.start !== 1) {\n\t\t\tdom.start = node.attrs.start\n\t\t}\n\n\t\treturn withContent(dom)\n\t},\n\n\tparseDOM: [\n\t\t{\n\t\t\ttag: \"ol\",\n\n\t\t\tgetAttrs(dom: HTMLOListElement) {\n\t\t\t\treturn {\n\t\t\t\t\ttextDirection: parseTextDirection(dom),\n\t\t\t\t\tinlineStyles: supportsStyles ? getStyles(dom.style, InlineStyles.transforms) : {},\n\t\t\t\t\tblockStyles: supportsStyles ? getStyles(dom.style, BlockStyles.transforms) : {},\n\t\t\t\t\ttextStylePreset: supportsStyles ? getStylePreset(dom.dataset.stylesPreset) : undefined,\n\t\t\t\t\tlistStyleType: getListStyleType(dom),\n\t\t\t\t\tstart: dom.start,\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t],\n})\n\nexport interface ListItemAttrs {\n\treadonly inlineStyles: InlineStyles\n\treadonly blockStyles: BlockStyles\n\treadonly textStylePreset: TextStylePreset\n}\n\nexport type ListItemNode = PmNode<ListItemAttrs>\n\nexport function isListItemNode(node: PmNode | undefined): node is ListItemNode {\n\treturn node?.type.name === NodeName.ListItem\n}\n\nexport const getDefaultListItemAttrs = (): ListItemAttrs => ({\n\tinlineStyles: {},\n\tblockStyles: {},\n\ttextStylePreset: undefined,\n})\n\nexport const listItem = ({ supportsStyles }: { supportsStyles: boolean }): ExtendedPmNodeSpec<ListItemAttrs> => ({\n\tcontent: \"textBlock block*\",\n\n\tattrs: attrsToDefaults(getDefaultListItemAttrs()),\n\n\ttoMarkdown: fromPmNode(\"listItem\"),\n\n\ttoDOM(node) {\n\t\tconst dom = document.createElement(\"li\")\n\n\t\tconst firstChild = node.children[0]\n\t\tif (firstChild) {\n\t\t\tdom.dataset.presetTag = isTextBlockNode(firstChild) ? firstChild.attrs.tag : \"p\"\n\t\t}\n\n\t\tif (supportsStyles) {\n\t\t\tsetStyles(dom.style, InlineStyles.transforms, node.attrs.inlineStyles)\n\t\t\tsetStyles(dom.style, BlockStyles.transforms, node.attrs.blockStyles)\n\t\t\tsetStylePreset(dom, node.attrs.textStylePreset)\n\t\t}\n\n\t\treturn withContent(dom)\n\t},\n\n\tparseDOM: [\n\t\t{\n\t\t\ttag: \"li\",\n\n\t\t\tgetAttrs(dom: HTMLLIElement) {\n\t\t\t\treturn {\n\t\t\t\t\tinlineStyles: supportsStyles ? getStyles(dom.style, InlineStyles.transforms) : {},\n\t\t\t\t\tblockStyles: supportsStyles ? getStyles(dom.style, BlockStyles.transforms) : {},\n\t\t\t\t\ttextStylePreset: supportsStyles ? getStylePreset(dom.dataset.stylesPreset) : undefined,\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t],\n})\n", "// src/index.ts\nimport { Plugin as Plugin2 } from \"prosemirror-state\";\n\n// src/cellselection.ts\nimport { Fragment, Slice } from \"prosemirror-model\";\nimport {\n  NodeSelection as NodeSelection2,\n  Selection,\n  SelectionRange,\n  TextSelection\n} from \"prosemirror-state\";\nimport { Decoration, DecorationSet } from \"prosemirror-view\";\n\n// src/tablemap.ts\nvar readFromCache;\nvar addToCache;\nif (typeof WeakMap != \"undefined\") {\n  let cache = /* @__PURE__ */ new WeakMap();\n  readFromCache = (key) => cache.get(key);\n  addToCache = (key, value) => {\n    cache.set(key, value);\n    return value;\n  };\n} else {\n  const cache = [];\n  const cacheSize = 10;\n  let cachePos = 0;\n  readFromCache = (key) => {\n    for (let i = 0; i < cache.length; i += 2)\n      if (cache[i] == key)\n        return cache[i + 1];\n  };\n  addToCache = (key, value) => {\n    if (cachePos == cacheSize)\n      cachePos = 0;\n    cache[cachePos++] = key;\n    return cache[cachePos++] = value;\n  };\n}\nvar TableMap = class {\n  constructor(width, height, map, problems) {\n    this.width = width;\n    this.height = height;\n    this.map = map;\n    this.problems = problems;\n  }\n  // Find the dimensions of the cell at the given position.\n  findCell(pos) {\n    for (let i = 0; i < this.map.length; i++) {\n      const curPos = this.map[i];\n      if (curPos != pos)\n        continue;\n      const left = i % this.width;\n      const top = i / this.width | 0;\n      let right = left + 1;\n      let bottom = top + 1;\n      for (let j = 1; right < this.width && this.map[i + j] == curPos; j++) {\n        right++;\n      }\n      for (let j = 1; bottom < this.height && this.map[i + this.width * j] == curPos; j++) {\n        bottom++;\n      }\n      return { left, top, right, bottom };\n    }\n    throw new RangeError(`No cell with offset ${pos} found`);\n  }\n  // Find the left side of the cell at the given position.\n  colCount(pos) {\n    for (let i = 0; i < this.map.length; i++) {\n      if (this.map[i] == pos) {\n        return i % this.width;\n      }\n    }\n    throw new RangeError(`No cell with offset ${pos} found`);\n  }\n  // Find the next cell in the given direction, starting from the cell\n  // at `pos`, if any.\n  nextCell(pos, axis, dir) {\n    const { left, right, top, bottom } = this.findCell(pos);\n    if (axis == \"horiz\") {\n      if (dir < 0 ? left == 0 : right == this.width)\n        return null;\n      return this.map[top * this.width + (dir < 0 ? left - 1 : right)];\n    } else {\n      if (dir < 0 ? top == 0 : bottom == this.height)\n        return null;\n      return this.map[left + this.width * (dir < 0 ? top - 1 : bottom)];\n    }\n  }\n  // Get the rectangle spanning the two given cells.\n  rectBetween(a, b) {\n    const {\n      left: leftA,\n      right: rightA,\n      top: topA,\n      bottom: bottomA\n    } = this.findCell(a);\n    const {\n      left: leftB,\n      right: rightB,\n      top: topB,\n      bottom: bottomB\n    } = this.findCell(b);\n    return {\n      left: Math.min(leftA, leftB),\n      top: Math.min(topA, topB),\n      right: Math.max(rightA, rightB),\n      bottom: Math.max(bottomA, bottomB)\n    };\n  }\n  // Return the position of all cells that have the top left corner in\n  // the given rectangle.\n  cellsInRect(rect) {\n    const result = [];\n    const seen = {};\n    for (let row = rect.top; row < rect.bottom; row++) {\n      for (let col = rect.left; col < rect.right; col++) {\n        const index = row * this.width + col;\n        const pos = this.map[index];\n        if (seen[pos])\n          continue;\n        seen[pos] = true;\n        if (col == rect.left && col && this.map[index - 1] == pos || row == rect.top && row && this.map[index - this.width] == pos) {\n          continue;\n        }\n        result.push(pos);\n      }\n    }\n    return result;\n  }\n  // Return the position at which the cell at the given row and column\n  // starts, or would start, if a cell started there.\n  positionAt(row, col, table) {\n    for (let i = 0, rowStart = 0; ; i++) {\n      const rowEnd = rowStart + table.child(i).nodeSize;\n      if (i == row) {\n        let index = col + row * this.width;\n        const rowEndIndex = (row + 1) * this.width;\n        while (index < rowEndIndex && this.map[index] < rowStart)\n          index++;\n        return index == rowEndIndex ? rowEnd - 1 : this.map[index];\n      }\n      rowStart = rowEnd;\n    }\n  }\n  // Find the table map for the given table node.\n  static get(table) {\n    return readFromCache(table) || addToCache(table, computeMap(table));\n  }\n};\nfunction computeMap(table) {\n  if (table.type.spec.tableRole != \"table\")\n    throw new RangeError(\"Not a table node: \" + table.type.name);\n  const width = findWidth(table), height = table.childCount;\n  const map = [];\n  let mapPos = 0;\n  let problems = null;\n  const colWidths = [];\n  for (let i = 0, e = width * height; i < e; i++)\n    map[i] = 0;\n  for (let row = 0, pos = 0; row < height; row++) {\n    const rowNode = table.child(row);\n    pos++;\n    for (let i = 0; ; i++) {\n      while (mapPos < map.length && map[mapPos] != 0)\n        mapPos++;\n      if (i == rowNode.childCount)\n        break;\n      const cellNode = rowNode.child(i);\n      const { colspan, rowspan, colwidth } = cellNode.attrs;\n      for (let h = 0; h < rowspan; h++) {\n        if (h + row >= height) {\n          (problems || (problems = [])).push({\n            type: \"overlong_rowspan\",\n            pos,\n            n: rowspan - h\n          });\n          break;\n        }\n        const start = mapPos + h * width;\n        for (let w = 0; w < colspan; w++) {\n          if (map[start + w] == 0)\n            map[start + w] = pos;\n          else\n            (problems || (problems = [])).push({\n              type: \"collision\",\n              row,\n              pos,\n              n: colspan - w\n            });\n          const colW = colwidth && colwidth[w];\n          if (colW) {\n            const widthIndex = (start + w) % width * 2, prev = colWidths[widthIndex];\n            if (prev == null || prev != colW && colWidths[widthIndex + 1] == 1) {\n              colWidths[widthIndex] = colW;\n              colWidths[widthIndex + 1] = 1;\n            } else if (prev == colW) {\n              colWidths[widthIndex + 1]++;\n            }\n          }\n        }\n      }\n      mapPos += colspan;\n      pos += cellNode.nodeSize;\n    }\n    const expectedPos = (row + 1) * width;\n    let missing = 0;\n    while (mapPos < expectedPos)\n      if (map[mapPos++] == 0)\n        missing++;\n    if (missing)\n      (problems || (problems = [])).push({ type: \"missing\", row, n: missing });\n    pos++;\n  }\n  const tableMap = new TableMap(width, height, map, problems);\n  let badWidths = false;\n  for (let i = 0; !badWidths && i < colWidths.length; i += 2)\n    if (colWidths[i] != null && colWidths[i + 1] < height)\n      badWidths = true;\n  if (badWidths)\n    findBadColWidths(tableMap, colWidths, table);\n  return tableMap;\n}\nfunction findWidth(table) {\n  let width = -1;\n  let hasRowSpan = false;\n  for (let row = 0; row < table.childCount; row++) {\n    const rowNode = table.child(row);\n    let rowWidth = 0;\n    if (hasRowSpan)\n      for (let j = 0; j < row; j++) {\n        const prevRow = table.child(j);\n        for (let i = 0; i < prevRow.childCount; i++) {\n          const cell = prevRow.child(i);\n          if (j + cell.attrs.rowspan > row)\n            rowWidth += cell.attrs.colspan;\n        }\n      }\n    for (let i = 0; i < rowNode.childCount; i++) {\n      const cell = rowNode.child(i);\n      rowWidth += cell.attrs.colspan;\n      if (cell.attrs.rowspan > 1)\n        hasRowSpan = true;\n    }\n    if (width == -1)\n      width = rowWidth;\n    else if (width != rowWidth)\n      width = Math.max(width, rowWidth);\n  }\n  return width;\n}\nfunction findBadColWidths(map, colWidths, table) {\n  if (!map.problems)\n    map.problems = [];\n  const seen = {};\n  for (let i = 0; i < map.map.length; i++) {\n    const pos = map.map[i];\n    if (seen[pos])\n      continue;\n    seen[pos] = true;\n    const node = table.nodeAt(pos);\n    if (!node) {\n      throw new RangeError(`No cell with offset ${pos} found`);\n    }\n    let updated = null;\n    const attrs = node.attrs;\n    for (let j = 0; j < attrs.colspan; j++) {\n      const col = (i + j) % map.width;\n      const colWidth = colWidths[col * 2];\n      if (colWidth != null && (!attrs.colwidth || attrs.colwidth[j] != colWidth))\n        (updated || (updated = freshColWidth(attrs)))[j] = colWidth;\n    }\n    if (updated)\n      map.problems.unshift({\n        type: \"colwidth mismatch\",\n        pos,\n        colwidth: updated\n      });\n  }\n}\nfunction freshColWidth(attrs) {\n  if (attrs.colwidth)\n    return attrs.colwidth.slice();\n  const result = [];\n  for (let i = 0; i < attrs.colspan; i++)\n    result.push(0);\n  return result;\n}\n\n// src/util.ts\nimport { PluginKey } from \"prosemirror-state\";\n\n// src/schema.ts\nfunction getCellAttrs(dom, extraAttrs) {\n  if (typeof dom === \"string\") {\n    return {};\n  }\n  const widthAttr = dom.getAttribute(\"data-colwidth\");\n  const widths = widthAttr && /^\\d+(,\\d+)*$/.test(widthAttr) ? widthAttr.split(\",\").map((s) => Number(s)) : null;\n  const colspan = Number(dom.getAttribute(\"colspan\") || 1);\n  const result = {\n    colspan,\n    rowspan: Number(dom.getAttribute(\"rowspan\") || 1),\n    colwidth: widths && widths.length == colspan ? widths : null\n  };\n  for (const prop in extraAttrs) {\n    const getter = extraAttrs[prop].getFromDOM;\n    const value = getter && getter(dom);\n    if (value != null) {\n      result[prop] = value;\n    }\n  }\n  return result;\n}\nfunction setCellAttrs(node, extraAttrs) {\n  const attrs = {};\n  if (node.attrs.colspan != 1)\n    attrs.colspan = node.attrs.colspan;\n  if (node.attrs.rowspan != 1)\n    attrs.rowspan = node.attrs.rowspan;\n  if (node.attrs.colwidth)\n    attrs[\"data-colwidth\"] = node.attrs.colwidth.join(\",\");\n  for (const prop in extraAttrs) {\n    const setter = extraAttrs[prop].setDOMAttr;\n    if (setter)\n      setter(node.attrs[prop], attrs);\n  }\n  return attrs;\n}\nfunction tableNodes(options) {\n  const extraAttrs = options.cellAttributes || {};\n  const cellAttrs = {\n    colspan: { default: 1 },\n    rowspan: { default: 1 },\n    colwidth: { default: null }\n  };\n  for (const prop in extraAttrs)\n    cellAttrs[prop] = { default: extraAttrs[prop].default };\n  return {\n    table: {\n      content: \"table_row+\",\n      tableRole: \"table\",\n      isolating: true,\n      group: options.tableGroup,\n      parseDOM: [{ tag: \"table\" }],\n      toDOM() {\n        return [\"table\", [\"tbody\", 0]];\n      }\n    },\n    table_row: {\n      content: \"(table_cell | table_header)*\",\n      tableRole: \"row\",\n      parseDOM: [{ tag: \"tr\" }],\n      toDOM() {\n        return [\"tr\", 0];\n      }\n    },\n    table_cell: {\n      content: options.cellContent,\n      attrs: cellAttrs,\n      tableRole: \"cell\",\n      isolating: true,\n      parseDOM: [\n        { tag: \"td\", getAttrs: (dom) => getCellAttrs(dom, extraAttrs) }\n      ],\n      toDOM(node) {\n        return [\"td\", setCellAttrs(node, extraAttrs), 0];\n      }\n    },\n    table_header: {\n      content: options.cellContent,\n      attrs: cellAttrs,\n      tableRole: \"header_cell\",\n      isolating: true,\n      parseDOM: [\n        { tag: \"th\", getAttrs: (dom) => getCellAttrs(dom, extraAttrs) }\n      ],\n      toDOM(node) {\n        return [\"th\", setCellAttrs(node, extraAttrs), 0];\n      }\n    }\n  };\n}\nfunction tableNodeTypes(schema) {\n  let result = schema.cached.tableNodeTypes;\n  if (!result) {\n    result = schema.cached.tableNodeTypes = {};\n    for (const name in schema.nodes) {\n      const type = schema.nodes[name], role = type.spec.tableRole;\n      if (role)\n        result[role] = type;\n    }\n  }\n  return result;\n}\n\n// src/util.ts\nvar tableEditingKey = new PluginKey(\"selectingCells\");\nfunction cellAround($pos) {\n  for (let d = $pos.depth - 1; d > 0; d--)\n    if ($pos.node(d).type.spec.tableRole == \"row\")\n      return $pos.node(0).resolve($pos.before(d + 1));\n  return null;\n}\nfunction cellWrapping($pos) {\n  for (let d = $pos.depth; d > 0; d--) {\n    const role = $pos.node(d).type.spec.tableRole;\n    if (role === \"cell\" || role === \"header_cell\")\n      return $pos.node(d);\n  }\n  return null;\n}\nfunction isInTable(state) {\n  const $head = state.selection.$head;\n  for (let d = $head.depth; d > 0; d--)\n    if ($head.node(d).type.spec.tableRole == \"row\")\n      return true;\n  return false;\n}\nfunction selectionCell(state) {\n  const sel = state.selection;\n  if (\"$anchorCell\" in sel && sel.$anchorCell) {\n    return sel.$anchorCell.pos > sel.$headCell.pos ? sel.$anchorCell : sel.$headCell;\n  } else if (\"node\" in sel && sel.node && sel.node.type.spec.tableRole == \"cell\") {\n    return sel.$anchor;\n  }\n  const $cell = cellAround(sel.$head) || cellNear(sel.$head);\n  if ($cell) {\n    return $cell;\n  }\n  throw new RangeError(`No cell found around position ${sel.head}`);\n}\nfunction cellNear($pos) {\n  for (let after = $pos.nodeAfter, pos = $pos.pos; after; after = after.firstChild, pos++) {\n    const role = after.type.spec.tableRole;\n    if (role == \"cell\" || role == \"header_cell\")\n      return $pos.doc.resolve(pos);\n  }\n  for (let before = $pos.nodeBefore, pos = $pos.pos; before; before = before.lastChild, pos--) {\n    const role = before.type.spec.tableRole;\n    if (role == \"cell\" || role == \"header_cell\")\n      return $pos.doc.resolve(pos - before.nodeSize);\n  }\n}\nfunction pointsAtCell($pos) {\n  return $pos.parent.type.spec.tableRole == \"row\" && !!$pos.nodeAfter;\n}\nfunction moveCellForward($pos) {\n  return $pos.node(0).resolve($pos.pos + $pos.nodeAfter.nodeSize);\n}\nfunction inSameTable($cellA, $cellB) {\n  return $cellA.depth == $cellB.depth && $cellA.pos >= $cellB.start(-1) && $cellA.pos <= $cellB.end(-1);\n}\nfunction findCell($pos) {\n  return TableMap.get($pos.node(-1)).findCell($pos.pos - $pos.start(-1));\n}\nfunction colCount($pos) {\n  return TableMap.get($pos.node(-1)).colCount($pos.pos - $pos.start(-1));\n}\nfunction nextCell($pos, axis, dir) {\n  const table = $pos.node(-1);\n  const map = TableMap.get(table);\n  const tableStart = $pos.start(-1);\n  const moved = map.nextCell($pos.pos - tableStart, axis, dir);\n  return moved == null ? null : $pos.node(0).resolve(tableStart + moved);\n}\nfunction removeColSpan(attrs, pos, n = 1) {\n  const result = { ...attrs, colspan: attrs.colspan - n };\n  if (result.colwidth) {\n    result.colwidth = result.colwidth.slice();\n    result.colwidth.splice(pos, n);\n    if (!result.colwidth.some((w) => w > 0))\n      result.colwidth = null;\n  }\n  return result;\n}\nfunction addColSpan(attrs, pos, n = 1) {\n  const result = { ...attrs, colspan: attrs.colspan + n };\n  if (result.colwidth) {\n    result.colwidth = result.colwidth.slice();\n    for (let i = 0; i < n; i++)\n      result.colwidth.splice(pos, 0, 0);\n  }\n  return result;\n}\nfunction columnIsHeader(map, table, col) {\n  const headerCell = tableNodeTypes(table.type.schema).header_cell;\n  for (let row = 0; row < map.height; row++)\n    if (table.nodeAt(map.map[col + row * map.width]).type != headerCell)\n      return false;\n  return true;\n}\n\n// src/cellselection.ts\nvar CellSelection = class _CellSelection extends Selection {\n  // A table selection is identified by its anchor and head cells. The\n  // positions given to this constructor should point _before_ two\n  // cells in the same table. They may be the same, to select a single\n  // cell.\n  constructor($anchorCell, $headCell = $anchorCell) {\n    const table = $anchorCell.node(-1);\n    const map = TableMap.get(table);\n    const tableStart = $anchorCell.start(-1);\n    const rect = map.rectBetween(\n      $anchorCell.pos - tableStart,\n      $headCell.pos - tableStart\n    );\n    const doc = $anchorCell.node(0);\n    const cells = map.cellsInRect(rect).filter((p) => p != $headCell.pos - tableStart);\n    cells.unshift($headCell.pos - tableStart);\n    const ranges = cells.map((pos) => {\n      const cell = table.nodeAt(pos);\n      if (!cell) {\n        throw RangeError(`No cell with offset ${pos} found`);\n      }\n      const from = tableStart + pos + 1;\n      return new SelectionRange(\n        doc.resolve(from),\n        doc.resolve(from + cell.content.size)\n      );\n    });\n    super(ranges[0].$from, ranges[0].$to, ranges);\n    this.$anchorCell = $anchorCell;\n    this.$headCell = $headCell;\n  }\n  map(doc, mapping) {\n    const $anchorCell = doc.resolve(mapping.map(this.$anchorCell.pos));\n    const $headCell = doc.resolve(mapping.map(this.$headCell.pos));\n    if (pointsAtCell($anchorCell) && pointsAtCell($headCell) && inSameTable($anchorCell, $headCell)) {\n      const tableChanged = this.$anchorCell.node(-1) != $anchorCell.node(-1);\n      if (tableChanged && this.isRowSelection())\n        return _CellSelection.rowSelection($anchorCell, $headCell);\n      else if (tableChanged && this.isColSelection())\n        return _CellSelection.colSelection($anchorCell, $headCell);\n      else\n        return new _CellSelection($anchorCell, $headCell);\n    }\n    return TextSelection.between($anchorCell, $headCell);\n  }\n  // Returns a rectangular slice of table rows containing the selected\n  // cells.\n  content() {\n    const table = this.$anchorCell.node(-1);\n    const map = TableMap.get(table);\n    const tableStart = this.$anchorCell.start(-1);\n    const rect = map.rectBetween(\n      this.$anchorCell.pos - tableStart,\n      this.$headCell.pos - tableStart\n    );\n    const seen = {};\n    const rows = [];\n    for (let row = rect.top; row < rect.bottom; row++) {\n      const rowContent = [];\n      for (let index = row * map.width + rect.left, col = rect.left; col < rect.right; col++, index++) {\n        const pos = map.map[index];\n        if (seen[pos])\n          continue;\n        seen[pos] = true;\n        const cellRect = map.findCell(pos);\n        let cell = table.nodeAt(pos);\n        if (!cell) {\n          throw RangeError(`No cell with offset ${pos} found`);\n        }\n        const extraLeft = rect.left - cellRect.left;\n        const extraRight = cellRect.right - rect.right;\n        if (extraLeft > 0 || extraRight > 0) {\n          let attrs = cell.attrs;\n          if (extraLeft > 0) {\n            attrs = removeColSpan(attrs, 0, extraLeft);\n          }\n          if (extraRight > 0) {\n            attrs = removeColSpan(\n              attrs,\n              attrs.colspan - extraRight,\n              extraRight\n            );\n          }\n          if (cellRect.left < rect.left) {\n            cell = cell.type.createAndFill(attrs);\n            if (!cell) {\n              throw RangeError(\n                `Could not create cell with attrs ${JSON.stringify(attrs)}`\n              );\n            }\n          } else {\n            cell = cell.type.create(attrs, cell.content);\n          }\n        }\n        if (cellRect.top < rect.top || cellRect.bottom > rect.bottom) {\n          const attrs = {\n            ...cell.attrs,\n            rowspan: Math.min(cellRect.bottom, rect.bottom) - Math.max(cellRect.top, rect.top)\n          };\n          if (cellRect.top < rect.top) {\n            cell = cell.type.createAndFill(attrs);\n          } else {\n            cell = cell.type.create(attrs, cell.content);\n          }\n        }\n        rowContent.push(cell);\n      }\n      rows.push(table.child(row).copy(Fragment.from(rowContent)));\n    }\n    const fragment = this.isColSelection() && this.isRowSelection() ? table : rows;\n    return new Slice(Fragment.from(fragment), 1, 1);\n  }\n  replace(tr, content = Slice.empty) {\n    const mapFrom = tr.steps.length, ranges = this.ranges;\n    for (let i = 0; i < ranges.length; i++) {\n      const { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);\n      tr.replace(\n        mapping.map($from.pos),\n        mapping.map($to.pos),\n        i ? Slice.empty : content\n      );\n    }\n    const sel = Selection.findFrom(\n      tr.doc.resolve(tr.mapping.slice(mapFrom).map(this.to)),\n      -1\n    );\n    if (sel)\n      tr.setSelection(sel);\n  }\n  replaceWith(tr, node) {\n    this.replace(tr, new Slice(Fragment.from(node), 0, 0));\n  }\n  forEachCell(f) {\n    const table = this.$anchorCell.node(-1);\n    const map = TableMap.get(table);\n    const tableStart = this.$anchorCell.start(-1);\n    const cells = map.cellsInRect(\n      map.rectBetween(\n        this.$anchorCell.pos - tableStart,\n        this.$headCell.pos - tableStart\n      )\n    );\n    for (let i = 0; i < cells.length; i++) {\n      f(table.nodeAt(cells[i]), tableStart + cells[i]);\n    }\n  }\n  // True if this selection goes all the way from the top to the\n  // bottom of the table.\n  isColSelection() {\n    const anchorTop = this.$anchorCell.index(-1);\n    const headTop = this.$headCell.index(-1);\n    if (Math.min(anchorTop, headTop) > 0)\n      return false;\n    const anchorBottom = anchorTop + this.$anchorCell.nodeAfter.attrs.rowspan;\n    const headBottom = headTop + this.$headCell.nodeAfter.attrs.rowspan;\n    return Math.max(anchorBottom, headBottom) == this.$headCell.node(-1).childCount;\n  }\n  // Returns the smallest column selection that covers the given anchor\n  // and head cell.\n  static colSelection($anchorCell, $headCell = $anchorCell) {\n    const table = $anchorCell.node(-1);\n    const map = TableMap.get(table);\n    const tableStart = $anchorCell.start(-1);\n    const anchorRect = map.findCell($anchorCell.pos - tableStart);\n    const headRect = map.findCell($headCell.pos - tableStart);\n    const doc = $anchorCell.node(0);\n    if (anchorRect.top <= headRect.top) {\n      if (anchorRect.top > 0)\n        $anchorCell = doc.resolve(tableStart + map.map[anchorRect.left]);\n      if (headRect.bottom < map.height)\n        $headCell = doc.resolve(\n          tableStart + map.map[map.width * (map.height - 1) + headRect.right - 1]\n        );\n    } else {\n      if (headRect.top > 0)\n        $headCell = doc.resolve(tableStart + map.map[headRect.left]);\n      if (anchorRect.bottom < map.height)\n        $anchorCell = doc.resolve(\n          tableStart + map.map[map.width * (map.height - 1) + anchorRect.right - 1]\n        );\n    }\n    return new _CellSelection($anchorCell, $headCell);\n  }\n  // True if this selection goes all the way from the left to the\n  // right of the table.\n  isRowSelection() {\n    const table = this.$anchorCell.node(-1);\n    const map = TableMap.get(table);\n    const tableStart = this.$anchorCell.start(-1);\n    const anchorLeft = map.colCount(this.$anchorCell.pos - tableStart);\n    const headLeft = map.colCount(this.$headCell.pos - tableStart);\n    if (Math.min(anchorLeft, headLeft) > 0)\n      return false;\n    const anchorRight = anchorLeft + this.$anchorCell.nodeAfter.attrs.colspan;\n    const headRight = headLeft + this.$headCell.nodeAfter.attrs.colspan;\n    return Math.max(anchorRight, headRight) == map.width;\n  }\n  eq(other) {\n    return other instanceof _CellSelection && other.$anchorCell.pos == this.$anchorCell.pos && other.$headCell.pos == this.$headCell.pos;\n  }\n  // Returns the smallest row selection that covers the given anchor\n  // and head cell.\n  static rowSelection($anchorCell, $headCell = $anchorCell) {\n    const table = $anchorCell.node(-1);\n    const map = TableMap.get(table);\n    const tableStart = $anchorCell.start(-1);\n    const anchorRect = map.findCell($anchorCell.pos - tableStart);\n    const headRect = map.findCell($headCell.pos - tableStart);\n    const doc = $anchorCell.node(0);\n    if (anchorRect.left <= headRect.left) {\n      if (anchorRect.left > 0)\n        $anchorCell = doc.resolve(\n          tableStart + map.map[anchorRect.top * map.width]\n        );\n      if (headRect.right < map.width)\n        $headCell = doc.resolve(\n          tableStart + map.map[map.width * (headRect.top + 1) - 1]\n        );\n    } else {\n      if (headRect.left > 0)\n        $headCell = doc.resolve(tableStart + map.map[headRect.top * map.width]);\n      if (anchorRect.right < map.width)\n        $anchorCell = doc.resolve(\n          tableStart + map.map[map.width * (anchorRect.top + 1) - 1]\n        );\n    }\n    return new _CellSelection($anchorCell, $headCell);\n  }\n  toJSON() {\n    return {\n      type: \"cell\",\n      anchor: this.$anchorCell.pos,\n      head: this.$headCell.pos\n    };\n  }\n  static fromJSON(doc, json) {\n    return new _CellSelection(doc.resolve(json.anchor), doc.resolve(json.head));\n  }\n  static create(doc, anchorCell, headCell = anchorCell) {\n    return new _CellSelection(doc.resolve(anchorCell), doc.resolve(headCell));\n  }\n  getBookmark() {\n    return new CellBookmark(this.$anchorCell.pos, this.$headCell.pos);\n  }\n};\nCellSelection.prototype.visible = false;\nSelection.jsonID(\"cell\", CellSelection);\nvar CellBookmark = class _CellBookmark {\n  constructor(anchor, head) {\n    this.anchor = anchor;\n    this.head = head;\n  }\n  map(mapping) {\n    return new _CellBookmark(mapping.map(this.anchor), mapping.map(this.head));\n  }\n  resolve(doc) {\n    const $anchorCell = doc.resolve(this.anchor), $headCell = doc.resolve(this.head);\n    if ($anchorCell.parent.type.spec.tableRole == \"row\" && $headCell.parent.type.spec.tableRole == \"row\" && $anchorCell.index() < $anchorCell.parent.childCount && $headCell.index() < $headCell.parent.childCount && inSameTable($anchorCell, $headCell))\n      return new CellSelection($anchorCell, $headCell);\n    else\n      return Selection.near($headCell, 1);\n  }\n};\nfunction drawCellSelection(state) {\n  if (!(state.selection instanceof CellSelection))\n    return null;\n  const cells = [];\n  state.selection.forEachCell((node, pos) => {\n    cells.push(\n      Decoration.node(pos, pos + node.nodeSize, { class: \"selectedCell\" })\n    );\n  });\n  return DecorationSet.create(state.doc, cells);\n}\nfunction isCellBoundarySelection({ $from, $to }) {\n  if ($from.pos == $to.pos || $from.pos < $to.pos - 6)\n    return false;\n  let afterFrom = $from.pos;\n  let beforeTo = $to.pos;\n  let depth = $from.depth;\n  for (; depth >= 0; depth--, afterFrom++)\n    if ($from.after(depth + 1) < $from.end(depth))\n      break;\n  for (let d = $to.depth; d >= 0; d--, beforeTo--)\n    if ($to.before(d + 1) > $to.start(d))\n      break;\n  return afterFrom == beforeTo && /row|table/.test($from.node(depth).type.spec.tableRole);\n}\nfunction isTextSelectionAcrossCells({ $from, $to }) {\n  let fromCellBoundaryNode;\n  let toCellBoundaryNode;\n  for (let i = $from.depth; i > 0; i--) {\n    const node = $from.node(i);\n    if (node.type.spec.tableRole === \"cell\" || node.type.spec.tableRole === \"header_cell\") {\n      fromCellBoundaryNode = node;\n      break;\n    }\n  }\n  for (let i = $to.depth; i > 0; i--) {\n    const node = $to.node(i);\n    if (node.type.spec.tableRole === \"cell\" || node.type.spec.tableRole === \"header_cell\") {\n      toCellBoundaryNode = node;\n      break;\n    }\n  }\n  return fromCellBoundaryNode !== toCellBoundaryNode && $to.parentOffset === 0;\n}\nfunction normalizeSelection(state, tr, allowTableNodeSelection) {\n  const sel = (tr || state).selection;\n  const doc = (tr || state).doc;\n  let normalize;\n  let role;\n  if (sel instanceof NodeSelection2 && (role = sel.node.type.spec.tableRole)) {\n    if (role == \"cell\" || role == \"header_cell\") {\n      normalize = CellSelection.create(doc, sel.from);\n    } else if (role == \"row\") {\n      const $cell = doc.resolve(sel.from + 1);\n      normalize = CellSelection.rowSelection($cell, $cell);\n    } else if (!allowTableNodeSelection) {\n      const map = TableMap.get(sel.node);\n      const start = sel.from + 1;\n      const lastCell = start + map.map[map.width * map.height - 1];\n      normalize = CellSelection.create(doc, start + 1, lastCell);\n    }\n  } else if (sel instanceof TextSelection && isCellBoundarySelection(sel)) {\n    normalize = TextSelection.create(doc, sel.from);\n  } else if (sel instanceof TextSelection && isTextSelectionAcrossCells(sel)) {\n    normalize = TextSelection.create(doc, sel.$from.start(), sel.$from.end());\n  }\n  if (normalize)\n    (tr || (tr = state.tr)).setSelection(normalize);\n  return tr;\n}\n\n// src/fixtables.ts\nimport { PluginKey as PluginKey2 } from \"prosemirror-state\";\nvar fixTablesKey = new PluginKey2(\"fix-tables\");\nfunction changedDescendants(old, cur, offset, f) {\n  const oldSize = old.childCount, curSize = cur.childCount;\n  outer:\n    for (let i = 0, j = 0; i < curSize; i++) {\n      const child = cur.child(i);\n      for (let scan = j, e = Math.min(oldSize, i + 3); scan < e; scan++) {\n        if (old.child(scan) == child) {\n          j = scan + 1;\n          offset += child.nodeSize;\n          continue outer;\n        }\n      }\n      f(child, offset);\n      if (j < oldSize && old.child(j).sameMarkup(child))\n        changedDescendants(old.child(j), child, offset + 1, f);\n      else\n        child.nodesBetween(0, child.content.size, f, offset + 1);\n      offset += child.nodeSize;\n    }\n}\nfunction fixTables(state, oldState) {\n  let tr;\n  const check = (node, pos) => {\n    if (node.type.spec.tableRole == \"table\")\n      tr = fixTable(state, node, pos, tr);\n  };\n  if (!oldState)\n    state.doc.descendants(check);\n  else if (oldState.doc != state.doc)\n    changedDescendants(oldState.doc, state.doc, 0, check);\n  return tr;\n}\nfunction fixTable(state, table, tablePos, tr) {\n  const map = TableMap.get(table);\n  if (!map.problems)\n    return tr;\n  if (!tr)\n    tr = state.tr;\n  const mustAdd = [];\n  for (let i = 0; i < map.height; i++)\n    mustAdd.push(0);\n  for (let i = 0; i < map.problems.length; i++) {\n    const prob = map.problems[i];\n    if (prob.type == \"collision\") {\n      const cell = table.nodeAt(prob.pos);\n      if (!cell)\n        continue;\n      const attrs = cell.attrs;\n      for (let j = 0; j < attrs.rowspan; j++)\n        mustAdd[prob.row + j] += prob.n;\n      tr.setNodeMarkup(\n        tr.mapping.map(tablePos + 1 + prob.pos),\n        null,\n        removeColSpan(attrs, attrs.colspan - prob.n, prob.n)\n      );\n    } else if (prob.type == \"missing\") {\n      mustAdd[prob.row] += prob.n;\n    } else if (prob.type == \"overlong_rowspan\") {\n      const cell = table.nodeAt(prob.pos);\n      if (!cell)\n        continue;\n      tr.setNodeMarkup(tr.mapping.map(tablePos + 1 + prob.pos), null, {\n        ...cell.attrs,\n        rowspan: cell.attrs.rowspan - prob.n\n      });\n    } else if (prob.type == \"colwidth mismatch\") {\n      const cell = table.nodeAt(prob.pos);\n      if (!cell)\n        continue;\n      tr.setNodeMarkup(tr.mapping.map(tablePos + 1 + prob.pos), null, {\n        ...cell.attrs,\n        colwidth: prob.colwidth\n      });\n    }\n  }\n  let first, last;\n  for (let i = 0; i < mustAdd.length; i++)\n    if (mustAdd[i]) {\n      if (first == null)\n        first = i;\n      last = i;\n    }\n  for (let i = 0, pos = tablePos + 1; i < map.height; i++) {\n    const row = table.child(i);\n    const end = pos + row.nodeSize;\n    const add = mustAdd[i];\n    if (add > 0) {\n      let role = \"cell\";\n      if (row.firstChild) {\n        role = row.firstChild.type.spec.tableRole;\n      }\n      const nodes = [];\n      for (let j = 0; j < add; j++) {\n        const node = tableNodeTypes(state.schema)[role].createAndFill();\n        if (node)\n          nodes.push(node);\n      }\n      const side = (i == 0 || first == i - 1) && last == i ? pos + 1 : end - 1;\n      tr.insert(tr.mapping.map(side), nodes);\n    }\n    pos = end;\n  }\n  return tr.setMeta(fixTablesKey, { fixTables: true });\n}\n\n// src/input.ts\nimport { keydownHandler } from \"prosemirror-keymap\";\nimport { Fragment as Fragment4 } from \"prosemirror-model\";\nimport {\n  Selection as Selection2,\n  TextSelection as TextSelection3\n} from \"prosemirror-state\";\n\n// src/commands.ts\nimport {\n  Fragment as Fragment2,\n  Slice as Slice2\n} from \"prosemirror-model\";\nimport {\n  TextSelection as TextSelection2\n} from \"prosemirror-state\";\nfunction selectedRect(state) {\n  const sel = state.selection;\n  const $pos = selectionCell(state);\n  const table = $pos.node(-1);\n  const tableStart = $pos.start(-1);\n  const map = TableMap.get(table);\n  const rect = sel instanceof CellSelection ? map.rectBetween(\n    sel.$anchorCell.pos - tableStart,\n    sel.$headCell.pos - tableStart\n  ) : map.findCell($pos.pos - tableStart);\n  return { ...rect, tableStart, map, table };\n}\nfunction addColumn(tr, { map, tableStart, table }, col) {\n  let refColumn = col > 0 ? -1 : 0;\n  if (columnIsHeader(map, table, col + refColumn)) {\n    refColumn = col == 0 || col == map.width ? null : 0;\n  }\n  for (let row = 0; row < map.height; row++) {\n    const index = row * map.width + col;\n    if (col > 0 && col < map.width && map.map[index - 1] == map.map[index]) {\n      const pos = map.map[index];\n      const cell = table.nodeAt(pos);\n      tr.setNodeMarkup(\n        tr.mapping.map(tableStart + pos),\n        null,\n        addColSpan(cell.attrs, col - map.colCount(pos))\n      );\n      row += cell.attrs.rowspan - 1;\n    } else {\n      const type = refColumn == null ? tableNodeTypes(table.type.schema).cell : table.nodeAt(map.map[index + refColumn]).type;\n      const pos = map.positionAt(row, col, table);\n      tr.insert(tr.mapping.map(tableStart + pos), type.createAndFill());\n    }\n  }\n  return tr;\n}\nfunction addColumnBefore(state, dispatch) {\n  if (!isInTable(state))\n    return false;\n  if (dispatch) {\n    const rect = selectedRect(state);\n    dispatch(addColumn(state.tr, rect, rect.left));\n  }\n  return true;\n}\nfunction addColumnAfter(state, dispatch) {\n  if (!isInTable(state))\n    return false;\n  if (dispatch) {\n    const rect = selectedRect(state);\n    dispatch(addColumn(state.tr, rect, rect.right));\n  }\n  return true;\n}\nfunction removeColumn(tr, { map, table, tableStart }, col) {\n  const mapStart = tr.mapping.maps.length;\n  for (let row = 0; row < map.height; ) {\n    const index = row * map.width + col;\n    const pos = map.map[index];\n    const cell = table.nodeAt(pos);\n    const attrs = cell.attrs;\n    if (col > 0 && map.map[index - 1] == pos || col < map.width - 1 && map.map[index + 1] == pos) {\n      tr.setNodeMarkup(\n        tr.mapping.slice(mapStart).map(tableStart + pos),\n        null,\n        removeColSpan(attrs, col - map.colCount(pos))\n      );\n    } else {\n      const start = tr.mapping.slice(mapStart).map(tableStart + pos);\n      tr.delete(start, start + cell.nodeSize);\n    }\n    row += attrs.rowspan;\n  }\n}\nfunction deleteColumn(state, dispatch) {\n  if (!isInTable(state))\n    return false;\n  if (dispatch) {\n    const rect = selectedRect(state);\n    const tr = state.tr;\n    if (rect.left == 0 && rect.right == rect.map.width)\n      return false;\n    for (let i = rect.right - 1; ; i--) {\n      removeColumn(tr, rect, i);\n      if (i == rect.left)\n        break;\n      const table = rect.tableStart ? tr.doc.nodeAt(rect.tableStart - 1) : tr.doc;\n      if (!table) {\n        throw RangeError(\"No table found\");\n      }\n      rect.table = table;\n      rect.map = TableMap.get(table);\n    }\n    dispatch(tr);\n  }\n  return true;\n}\nfunction rowIsHeader(map, table, row) {\n  var _a;\n  const headerCell = tableNodeTypes(table.type.schema).header_cell;\n  for (let col = 0; col < map.width; col++)\n    if (((_a = table.nodeAt(map.map[col + row * map.width])) == null ? void 0 : _a.type) != headerCell)\n      return false;\n  return true;\n}\nfunction addRow(tr, { map, tableStart, table }, row) {\n  var _a;\n  let rowPos = tableStart;\n  for (let i = 0; i < row; i++)\n    rowPos += table.child(i).nodeSize;\n  const cells = [];\n  let refRow = row > 0 ? -1 : 0;\n  if (rowIsHeader(map, table, row + refRow))\n    refRow = row == 0 || row == map.height ? null : 0;\n  for (let col = 0, index = map.width * row; col < map.width; col++, index++) {\n    if (row > 0 && row < map.height && map.map[index] == map.map[index - map.width]) {\n      const pos = map.map[index];\n      const attrs = table.nodeAt(pos).attrs;\n      tr.setNodeMarkup(tableStart + pos, null, {\n        ...attrs,\n        rowspan: attrs.rowspan + 1\n      });\n      col += attrs.colspan - 1;\n    } else {\n      const type = refRow == null ? tableNodeTypes(table.type.schema).cell : (_a = table.nodeAt(map.map[index + refRow * map.width])) == null ? void 0 : _a.type;\n      const node = type == null ? void 0 : type.createAndFill();\n      if (node)\n        cells.push(node);\n    }\n  }\n  tr.insert(rowPos, tableNodeTypes(table.type.schema).row.create(null, cells));\n  return tr;\n}\nfunction addRowBefore(state, dispatch) {\n  if (!isInTable(state))\n    return false;\n  if (dispatch) {\n    const rect = selectedRect(state);\n    dispatch(addRow(state.tr, rect, rect.top));\n  }\n  return true;\n}\nfunction addRowAfter(state, dispatch) {\n  if (!isInTable(state))\n    return false;\n  if (dispatch) {\n    const rect = selectedRect(state);\n    dispatch(addRow(state.tr, rect, rect.bottom));\n  }\n  return true;\n}\nfunction removeRow(tr, { map, table, tableStart }, row) {\n  let rowPos = 0;\n  for (let i = 0; i < row; i++)\n    rowPos += table.child(i).nodeSize;\n  const nextRow = rowPos + table.child(row).nodeSize;\n  const mapFrom = tr.mapping.maps.length;\n  tr.delete(rowPos + tableStart, nextRow + tableStart);\n  const seen = /* @__PURE__ */ new Set();\n  for (let col = 0, index = row * map.width; col < map.width; col++, index++) {\n    const pos = map.map[index];\n    if (seen.has(pos))\n      continue;\n    seen.add(pos);\n    if (row > 0 && pos == map.map[index - map.width]) {\n      const attrs = table.nodeAt(pos).attrs;\n      tr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos + tableStart), null, {\n        ...attrs,\n        rowspan: attrs.rowspan - 1\n      });\n      col += attrs.colspan - 1;\n    } else if (row < map.height && pos == map.map[index + map.width]) {\n      const cell = table.nodeAt(pos);\n      const attrs = cell.attrs;\n      const copy = cell.type.create(\n        { ...attrs, rowspan: cell.attrs.rowspan - 1 },\n        cell.content\n      );\n      const newPos = map.positionAt(row + 1, col, table);\n      tr.insert(tr.mapping.slice(mapFrom).map(tableStart + newPos), copy);\n      col += attrs.colspan - 1;\n    }\n  }\n}\nfunction deleteRow(state, dispatch) {\n  if (!isInTable(state))\n    return false;\n  if (dispatch) {\n    const rect = selectedRect(state), tr = state.tr;\n    if (rect.top == 0 && rect.bottom == rect.map.height)\n      return false;\n    for (let i = rect.bottom - 1; ; i--) {\n      removeRow(tr, rect, i);\n      if (i == rect.top)\n        break;\n      const table = rect.tableStart ? tr.doc.nodeAt(rect.tableStart - 1) : tr.doc;\n      if (!table) {\n        throw RangeError(\"No table found\");\n      }\n      rect.table = table;\n      rect.map = TableMap.get(rect.table);\n    }\n    dispatch(tr);\n  }\n  return true;\n}\nfunction isEmpty(cell) {\n  const c = cell.content;\n  return c.childCount == 1 && c.child(0).isTextblock && c.child(0).childCount == 0;\n}\nfunction cellsOverlapRectangle({ width, height, map }, rect) {\n  let indexTop = rect.top * width + rect.left, indexLeft = indexTop;\n  let indexBottom = (rect.bottom - 1) * width + rect.left, indexRight = indexTop + (rect.right - rect.left - 1);\n  for (let i = rect.top; i < rect.bottom; i++) {\n    if (rect.left > 0 && map[indexLeft] == map[indexLeft - 1] || rect.right < width && map[indexRight] == map[indexRight + 1])\n      return true;\n    indexLeft += width;\n    indexRight += width;\n  }\n  for (let i = rect.left; i < rect.right; i++) {\n    if (rect.top > 0 && map[indexTop] == map[indexTop - width] || rect.bottom < height && map[indexBottom] == map[indexBottom + width])\n      return true;\n    indexTop++;\n    indexBottom++;\n  }\n  return false;\n}\nfunction mergeCells(state, dispatch) {\n  const sel = state.selection;\n  if (!(sel instanceof CellSelection) || sel.$anchorCell.pos == sel.$headCell.pos)\n    return false;\n  const rect = selectedRect(state), { map } = rect;\n  if (cellsOverlapRectangle(map, rect))\n    return false;\n  if (dispatch) {\n    const tr = state.tr;\n    const seen = {};\n    let content = Fragment2.empty;\n    let mergedPos;\n    let mergedCell;\n    for (let row = rect.top; row < rect.bottom; row++) {\n      for (let col = rect.left; col < rect.right; col++) {\n        const cellPos = map.map[row * map.width + col];\n        const cell = rect.table.nodeAt(cellPos);\n        if (seen[cellPos] || !cell)\n          continue;\n        seen[cellPos] = true;\n        if (mergedPos == null) {\n          mergedPos = cellPos;\n          mergedCell = cell;\n        } else {\n          if (!isEmpty(cell))\n            content = content.append(cell.content);\n          const mapped = tr.mapping.map(cellPos + rect.tableStart);\n          tr.delete(mapped, mapped + cell.nodeSize);\n        }\n      }\n    }\n    if (mergedPos == null || mergedCell == null) {\n      return true;\n    }\n    tr.setNodeMarkup(mergedPos + rect.tableStart, null, {\n      ...addColSpan(\n        mergedCell.attrs,\n        mergedCell.attrs.colspan,\n        rect.right - rect.left - mergedCell.attrs.colspan\n      ),\n      rowspan: rect.bottom - rect.top\n    });\n    if (content.size) {\n      const end = mergedPos + 1 + mergedCell.content.size;\n      const start = isEmpty(mergedCell) ? mergedPos + 1 : end;\n      tr.replaceWith(start + rect.tableStart, end + rect.tableStart, content);\n    }\n    tr.setSelection(\n      new CellSelection(tr.doc.resolve(mergedPos + rect.tableStart))\n    );\n    dispatch(tr);\n  }\n  return true;\n}\nfunction splitCell(state, dispatch) {\n  const nodeTypes = tableNodeTypes(state.schema);\n  return splitCellWithType(({ node }) => {\n    return nodeTypes[node.type.spec.tableRole];\n  })(state, dispatch);\n}\nfunction splitCellWithType(getCellType) {\n  return (state, dispatch) => {\n    var _a;\n    const sel = state.selection;\n    let cellNode;\n    let cellPos;\n    if (!(sel instanceof CellSelection)) {\n      cellNode = cellWrapping(sel.$from);\n      if (!cellNode)\n        return false;\n      cellPos = (_a = cellAround(sel.$from)) == null ? void 0 : _a.pos;\n    } else {\n      if (sel.$anchorCell.pos != sel.$headCell.pos)\n        return false;\n      cellNode = sel.$anchorCell.nodeAfter;\n      cellPos = sel.$anchorCell.pos;\n    }\n    if (cellNode == null || cellPos == null) {\n      return false;\n    }\n    if (cellNode.attrs.colspan == 1 && cellNode.attrs.rowspan == 1) {\n      return false;\n    }\n    if (dispatch) {\n      let baseAttrs = cellNode.attrs;\n      const attrs = [];\n      const colwidth = baseAttrs.colwidth;\n      if (baseAttrs.rowspan > 1)\n        baseAttrs = { ...baseAttrs, rowspan: 1 };\n      if (baseAttrs.colspan > 1)\n        baseAttrs = { ...baseAttrs, colspan: 1 };\n      const rect = selectedRect(state), tr = state.tr;\n      for (let i = 0; i < rect.right - rect.left; i++)\n        attrs.push(\n          colwidth ? {\n            ...baseAttrs,\n            colwidth: colwidth && colwidth[i] ? [colwidth[i]] : null\n          } : baseAttrs\n        );\n      let lastCell;\n      for (let row = rect.top; row < rect.bottom; row++) {\n        let pos = rect.map.positionAt(row, rect.left, rect.table);\n        if (row == rect.top)\n          pos += cellNode.nodeSize;\n        for (let col = rect.left, i = 0; col < rect.right; col++, i++) {\n          if (col == rect.left && row == rect.top)\n            continue;\n          tr.insert(\n            lastCell = tr.mapping.map(pos + rect.tableStart, 1),\n            getCellType({ node: cellNode, row, col }).createAndFill(attrs[i])\n          );\n        }\n      }\n      tr.setNodeMarkup(\n        cellPos,\n        getCellType({ node: cellNode, row: rect.top, col: rect.left }),\n        attrs[0]\n      );\n      if (sel instanceof CellSelection)\n        tr.setSelection(\n          new CellSelection(\n            tr.doc.resolve(sel.$anchorCell.pos),\n            lastCell ? tr.doc.resolve(lastCell) : void 0\n          )\n        );\n      dispatch(tr);\n    }\n    return true;\n  };\n}\nfunction setCellAttr(name, value) {\n  return function(state, dispatch) {\n    if (!isInTable(state))\n      return false;\n    const $cell = selectionCell(state);\n    if ($cell.nodeAfter.attrs[name] === value)\n      return false;\n    if (dispatch) {\n      const tr = state.tr;\n      if (state.selection instanceof CellSelection)\n        state.selection.forEachCell((node, pos) => {\n          if (node.attrs[name] !== value)\n            tr.setNodeMarkup(pos, null, {\n              ...node.attrs,\n              [name]: value\n            });\n        });\n      else\n        tr.setNodeMarkup($cell.pos, null, {\n          ...$cell.nodeAfter.attrs,\n          [name]: value\n        });\n      dispatch(tr);\n    }\n    return true;\n  };\n}\nfunction deprecated_toggleHeader(type) {\n  return function(state, dispatch) {\n    if (!isInTable(state))\n      return false;\n    if (dispatch) {\n      const types = tableNodeTypes(state.schema);\n      const rect = selectedRect(state), tr = state.tr;\n      const cells = rect.map.cellsInRect(\n        type == \"column\" ? {\n          left: rect.left,\n          top: 0,\n          right: rect.right,\n          bottom: rect.map.height\n        } : type == \"row\" ? {\n          left: 0,\n          top: rect.top,\n          right: rect.map.width,\n          bottom: rect.bottom\n        } : rect\n      );\n      const nodes = cells.map((pos) => rect.table.nodeAt(pos));\n      for (let i = 0; i < cells.length; i++)\n        if (nodes[i].type == types.header_cell)\n          tr.setNodeMarkup(\n            rect.tableStart + cells[i],\n            types.cell,\n            nodes[i].attrs\n          );\n      if (tr.steps.length == 0)\n        for (let i = 0; i < cells.length; i++)\n          tr.setNodeMarkup(\n            rect.tableStart + cells[i],\n            types.header_cell,\n            nodes[i].attrs\n          );\n      dispatch(tr);\n    }\n    return true;\n  };\n}\nfunction isHeaderEnabledByType(type, rect, types) {\n  const cellPositions = rect.map.cellsInRect({\n    left: 0,\n    top: 0,\n    right: type == \"row\" ? rect.map.width : 1,\n    bottom: type == \"column\" ? rect.map.height : 1\n  });\n  for (let i = 0; i < cellPositions.length; i++) {\n    const cell = rect.table.nodeAt(cellPositions[i]);\n    if (cell && cell.type !== types.header_cell) {\n      return false;\n    }\n  }\n  return true;\n}\nfunction toggleHeader(type, options) {\n  options = options || { useDeprecatedLogic: false };\n  if (options.useDeprecatedLogic)\n    return deprecated_toggleHeader(type);\n  return function(state, dispatch) {\n    if (!isInTable(state))\n      return false;\n    if (dispatch) {\n      const types = tableNodeTypes(state.schema);\n      const rect = selectedRect(state), tr = state.tr;\n      const isHeaderRowEnabled = isHeaderEnabledByType(\"row\", rect, types);\n      const isHeaderColumnEnabled = isHeaderEnabledByType(\n        \"column\",\n        rect,\n        types\n      );\n      const isHeaderEnabled = type === \"column\" ? isHeaderRowEnabled : type === \"row\" ? isHeaderColumnEnabled : false;\n      const selectionStartsAt = isHeaderEnabled ? 1 : 0;\n      const cellsRect = type == \"column\" ? {\n        left: 0,\n        top: selectionStartsAt,\n        right: 1,\n        bottom: rect.map.height\n      } : type == \"row\" ? {\n        left: selectionStartsAt,\n        top: 0,\n        right: rect.map.width,\n        bottom: 1\n      } : rect;\n      const newType = type == \"column\" ? isHeaderColumnEnabled ? types.cell : types.header_cell : type == \"row\" ? isHeaderRowEnabled ? types.cell : types.header_cell : types.cell;\n      rect.map.cellsInRect(cellsRect).forEach((relativeCellPos) => {\n        const cellPos = relativeCellPos + rect.tableStart;\n        const cell = tr.doc.nodeAt(cellPos);\n        if (cell) {\n          tr.setNodeMarkup(cellPos, newType, cell.attrs);\n        }\n      });\n      dispatch(tr);\n    }\n    return true;\n  };\n}\nvar toggleHeaderRow = toggleHeader(\"row\", {\n  useDeprecatedLogic: true\n});\nvar toggleHeaderColumn = toggleHeader(\"column\", {\n  useDeprecatedLogic: true\n});\nvar toggleHeaderCell = toggleHeader(\"cell\", {\n  useDeprecatedLogic: true\n});\nfunction findNextCell($cell, dir) {\n  if (dir < 0) {\n    const before = $cell.nodeBefore;\n    if (before)\n      return $cell.pos - before.nodeSize;\n    for (let row = $cell.index(-1) - 1, rowEnd = $cell.before(); row >= 0; row--) {\n      const rowNode = $cell.node(-1).child(row);\n      const lastChild = rowNode.lastChild;\n      if (lastChild) {\n        return rowEnd - 1 - lastChild.nodeSize;\n      }\n      rowEnd -= rowNode.nodeSize;\n    }\n  } else {\n    if ($cell.index() < $cell.parent.childCount - 1) {\n      return $cell.pos + $cell.nodeAfter.nodeSize;\n    }\n    const table = $cell.node(-1);\n    for (let row = $cell.indexAfter(-1), rowStart = $cell.after(); row < table.childCount; row++) {\n      const rowNode = table.child(row);\n      if (rowNode.childCount)\n        return rowStart + 1;\n      rowStart += rowNode.nodeSize;\n    }\n  }\n  return null;\n}\nfunction goToNextCell(direction) {\n  return function(state, dispatch) {\n    if (!isInTable(state))\n      return false;\n    const cell = findNextCell(selectionCell(state), direction);\n    if (cell == null)\n      return false;\n    if (dispatch) {\n      const $cell = state.doc.resolve(cell);\n      dispatch(\n        state.tr.setSelection(TextSelection2.between($cell, moveCellForward($cell))).scrollIntoView()\n      );\n    }\n    return true;\n  };\n}\nfunction deleteTable(state, dispatch) {\n  const $pos = state.selection.$anchor;\n  for (let d = $pos.depth; d > 0; d--) {\n    const node = $pos.node(d);\n    if (node.type.spec.tableRole == \"table\") {\n      if (dispatch)\n        dispatch(\n          state.tr.delete($pos.before(d), $pos.after(d)).scrollIntoView()\n        );\n      return true;\n    }\n  }\n  return false;\n}\nfunction deleteCellSelection(state, dispatch) {\n  const sel = state.selection;\n  if (!(sel instanceof CellSelection))\n    return false;\n  if (dispatch) {\n    const tr = state.tr;\n    const baseContent = tableNodeTypes(state.schema).cell.createAndFill().content;\n    sel.forEachCell((cell, pos) => {\n      if (!cell.content.eq(baseContent))\n        tr.replace(\n          tr.mapping.map(pos + 1),\n          tr.mapping.map(pos + cell.nodeSize - 1),\n          new Slice2(baseContent, 0, 0)\n        );\n    });\n    if (tr.docChanged)\n      dispatch(tr);\n  }\n  return true;\n}\n\n// src/copypaste.ts\nimport { Fragment as Fragment3, Slice as Slice3 } from \"prosemirror-model\";\nimport { Transform } from \"prosemirror-transform\";\nfunction pastedCells(slice) {\n  if (!slice.size)\n    return null;\n  let { content, openStart, openEnd } = slice;\n  while (content.childCount == 1 && (openStart > 0 && openEnd > 0 || content.child(0).type.spec.tableRole == \"table\")) {\n    openStart--;\n    openEnd--;\n    content = content.child(0).content;\n  }\n  const first = content.child(0);\n  const role = first.type.spec.tableRole;\n  const schema = first.type.schema, rows = [];\n  if (role == \"row\") {\n    for (let i = 0; i < content.childCount; i++) {\n      let cells = content.child(i).content;\n      const left = i ? 0 : Math.max(0, openStart - 1);\n      const right = i < content.childCount - 1 ? 0 : Math.max(0, openEnd - 1);\n      if (left || right)\n        cells = fitSlice(\n          tableNodeTypes(schema).row,\n          new Slice3(cells, left, right)\n        ).content;\n      rows.push(cells);\n    }\n  } else if (role == \"cell\" || role == \"header_cell\") {\n    rows.push(\n      openStart || openEnd ? fitSlice(\n        tableNodeTypes(schema).row,\n        new Slice3(content, openStart, openEnd)\n      ).content : content\n    );\n  } else {\n    return null;\n  }\n  return ensureRectangular(schema, rows);\n}\nfunction ensureRectangular(schema, rows) {\n  const widths = [];\n  for (let i = 0; i < rows.length; i++) {\n    const row = rows[i];\n    for (let j = row.childCount - 1; j >= 0; j--) {\n      const { rowspan, colspan } = row.child(j).attrs;\n      for (let r = i; r < i + rowspan; r++)\n        widths[r] = (widths[r] || 0) + colspan;\n    }\n  }\n  let width = 0;\n  for (let r = 0; r < widths.length; r++)\n    width = Math.max(width, widths[r]);\n  for (let r = 0; r < widths.length; r++) {\n    if (r >= rows.length)\n      rows.push(Fragment3.empty);\n    if (widths[r] < width) {\n      const empty = tableNodeTypes(schema).cell.createAndFill();\n      const cells = [];\n      for (let i = widths[r]; i < width; i++) {\n        cells.push(empty);\n      }\n      rows[r] = rows[r].append(Fragment3.from(cells));\n    }\n  }\n  return { height: rows.length, width, rows };\n}\nfunction fitSlice(nodeType, slice) {\n  const node = nodeType.createAndFill();\n  const tr = new Transform(node).replace(0, node.content.size, slice);\n  return tr.doc;\n}\nfunction clipCells({ width, height, rows }, newWidth, newHeight) {\n  if (width != newWidth) {\n    const added = [];\n    const newRows = [];\n    for (let row = 0; row < rows.length; row++) {\n      const frag = rows[row], cells = [];\n      for (let col = added[row] || 0, i = 0; col < newWidth; i++) {\n        let cell = frag.child(i % frag.childCount);\n        if (col + cell.attrs.colspan > newWidth)\n          cell = cell.type.createChecked(\n            removeColSpan(\n              cell.attrs,\n              cell.attrs.colspan,\n              col + cell.attrs.colspan - newWidth\n            ),\n            cell.content\n          );\n        cells.push(cell);\n        col += cell.attrs.colspan;\n        for (let j = 1; j < cell.attrs.rowspan; j++)\n          added[row + j] = (added[row + j] || 0) + cell.attrs.colspan;\n      }\n      newRows.push(Fragment3.from(cells));\n    }\n    rows = newRows;\n    width = newWidth;\n  }\n  if (height != newHeight) {\n    const newRows = [];\n    for (let row = 0, i = 0; row < newHeight; row++, i++) {\n      const cells = [], source = rows[i % height];\n      for (let j = 0; j < source.childCount; j++) {\n        let cell = source.child(j);\n        if (row + cell.attrs.rowspan > newHeight)\n          cell = cell.type.create(\n            {\n              ...cell.attrs,\n              rowspan: Math.max(1, newHeight - cell.attrs.rowspan)\n            },\n            cell.content\n          );\n        cells.push(cell);\n      }\n      newRows.push(Fragment3.from(cells));\n    }\n    rows = newRows;\n    height = newHeight;\n  }\n  return { width, height, rows };\n}\nfunction growTable(tr, map, table, start, width, height, mapFrom) {\n  const schema = tr.doc.type.schema;\n  const types = tableNodeTypes(schema);\n  let empty;\n  let emptyHead;\n  if (width > map.width) {\n    for (let row = 0, rowEnd = 0; row < map.height; row++) {\n      const rowNode = table.child(row);\n      rowEnd += rowNode.nodeSize;\n      const cells = [];\n      let add;\n      if (rowNode.lastChild == null || rowNode.lastChild.type == types.cell)\n        add = empty || (empty = types.cell.createAndFill());\n      else\n        add = emptyHead || (emptyHead = types.header_cell.createAndFill());\n      for (let i = map.width; i < width; i++)\n        cells.push(add);\n      tr.insert(tr.mapping.slice(mapFrom).map(rowEnd - 1 + start), cells);\n    }\n  }\n  if (height > map.height) {\n    const cells = [];\n    for (let i = 0, start2 = (map.height - 1) * map.width; i < Math.max(map.width, width); i++) {\n      const header = i >= map.width ? false : table.nodeAt(map.map[start2 + i]).type == types.header_cell;\n      cells.push(\n        header ? emptyHead || (emptyHead = types.header_cell.createAndFill()) : empty || (empty = types.cell.createAndFill())\n      );\n    }\n    const emptyRow = types.row.create(null, Fragment3.from(cells)), rows = [];\n    for (let i = map.height; i < height; i++)\n      rows.push(emptyRow);\n    tr.insert(tr.mapping.slice(mapFrom).map(start + table.nodeSize - 2), rows);\n  }\n  return !!(empty || emptyHead);\n}\nfunction isolateHorizontal(tr, map, table, start, left, right, top, mapFrom) {\n  if (top == 0 || top == map.height)\n    return false;\n  let found = false;\n  for (let col = left; col < right; col++) {\n    const index = top * map.width + col, pos = map.map[index];\n    if (map.map[index - map.width] == pos) {\n      found = true;\n      const cell = table.nodeAt(pos);\n      const { top: cellTop, left: cellLeft } = map.findCell(pos);\n      tr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos + start), null, {\n        ...cell.attrs,\n        rowspan: top - cellTop\n      });\n      tr.insert(\n        tr.mapping.slice(mapFrom).map(map.positionAt(top, cellLeft, table)),\n        cell.type.createAndFill({\n          ...cell.attrs,\n          rowspan: cellTop + cell.attrs.rowspan - top\n        })\n      );\n      col += cell.attrs.colspan - 1;\n    }\n  }\n  return found;\n}\nfunction isolateVertical(tr, map, table, start, top, bottom, left, mapFrom) {\n  if (left == 0 || left == map.width)\n    return false;\n  let found = false;\n  for (let row = top; row < bottom; row++) {\n    const index = row * map.width + left, pos = map.map[index];\n    if (map.map[index - 1] == pos) {\n      found = true;\n      const cell = table.nodeAt(pos);\n      const cellLeft = map.colCount(pos);\n      const updatePos = tr.mapping.slice(mapFrom).map(pos + start);\n      tr.setNodeMarkup(\n        updatePos,\n        null,\n        removeColSpan(\n          cell.attrs,\n          left - cellLeft,\n          cell.attrs.colspan - (left - cellLeft)\n        )\n      );\n      tr.insert(\n        updatePos + cell.nodeSize,\n        cell.type.createAndFill(\n          removeColSpan(cell.attrs, 0, left - cellLeft)\n        )\n      );\n      row += cell.attrs.rowspan - 1;\n    }\n  }\n  return found;\n}\nfunction insertCells(state, dispatch, tableStart, rect, cells) {\n  let table = tableStart ? state.doc.nodeAt(tableStart - 1) : state.doc;\n  if (!table) {\n    throw new Error(\"No table found\");\n  }\n  let map = TableMap.get(table);\n  const { top, left } = rect;\n  const right = left + cells.width, bottom = top + cells.height;\n  const tr = state.tr;\n  let mapFrom = 0;\n  function recomp() {\n    table = tableStart ? tr.doc.nodeAt(tableStart - 1) : tr.doc;\n    if (!table) {\n      throw new Error(\"No table found\");\n    }\n    map = TableMap.get(table);\n    mapFrom = tr.mapping.maps.length;\n  }\n  if (growTable(tr, map, table, tableStart, right, bottom, mapFrom))\n    recomp();\n  if (isolateHorizontal(tr, map, table, tableStart, left, right, top, mapFrom))\n    recomp();\n  if (isolateHorizontal(tr, map, table, tableStart, left, right, bottom, mapFrom))\n    recomp();\n  if (isolateVertical(tr, map, table, tableStart, top, bottom, left, mapFrom))\n    recomp();\n  if (isolateVertical(tr, map, table, tableStart, top, bottom, right, mapFrom))\n    recomp();\n  for (let row = top; row < bottom; row++) {\n    const from = map.positionAt(row, left, table), to = map.positionAt(row, right, table);\n    tr.replace(\n      tr.mapping.slice(mapFrom).map(from + tableStart),\n      tr.mapping.slice(mapFrom).map(to + tableStart),\n      new Slice3(cells.rows[row - top], 0, 0)\n    );\n  }\n  recomp();\n  tr.setSelection(\n    new CellSelection(\n      tr.doc.resolve(tableStart + map.positionAt(top, left, table)),\n      tr.doc.resolve(tableStart + map.positionAt(bottom - 1, right - 1, table))\n    )\n  );\n  dispatch(tr);\n}\n\n// src/input.ts\nvar handleKeyDown = keydownHandler({\n  ArrowLeft: arrow(\"horiz\", -1),\n  ArrowRight: arrow(\"horiz\", 1),\n  ArrowUp: arrow(\"vert\", -1),\n  ArrowDown: arrow(\"vert\", 1),\n  \"Shift-ArrowLeft\": shiftArrow(\"horiz\", -1),\n  \"Shift-ArrowRight\": shiftArrow(\"horiz\", 1),\n  \"Shift-ArrowUp\": shiftArrow(\"vert\", -1),\n  \"Shift-ArrowDown\": shiftArrow(\"vert\", 1),\n  Backspace: deleteCellSelection,\n  \"Mod-Backspace\": deleteCellSelection,\n  Delete: deleteCellSelection,\n  \"Mod-Delete\": deleteCellSelection\n});\nfunction maybeSetSelection(state, dispatch, selection) {\n  if (selection.eq(state.selection))\n    return false;\n  if (dispatch)\n    dispatch(state.tr.setSelection(selection).scrollIntoView());\n  return true;\n}\nfunction arrow(axis, dir) {\n  return (state, dispatch, view) => {\n    if (!view)\n      return false;\n    const sel = state.selection;\n    if (sel instanceof CellSelection) {\n      return maybeSetSelection(\n        state,\n        dispatch,\n        Selection2.near(sel.$headCell, dir)\n      );\n    }\n    if (axis != \"horiz\" && !sel.empty)\n      return false;\n    const end = atEndOfCell(view, axis, dir);\n    if (end == null)\n      return false;\n    if (axis == \"horiz\") {\n      return maybeSetSelection(\n        state,\n        dispatch,\n        Selection2.near(state.doc.resolve(sel.head + dir), dir)\n      );\n    } else {\n      const $cell = state.doc.resolve(end);\n      const $next = nextCell($cell, axis, dir);\n      let newSel;\n      if ($next)\n        newSel = Selection2.near($next, 1);\n      else if (dir < 0)\n        newSel = Selection2.near(state.doc.resolve($cell.before(-1)), -1);\n      else\n        newSel = Selection2.near(state.doc.resolve($cell.after(-1)), 1);\n      return maybeSetSelection(state, dispatch, newSel);\n    }\n  };\n}\nfunction shiftArrow(axis, dir) {\n  return (state, dispatch, view) => {\n    if (!view)\n      return false;\n    const sel = state.selection;\n    let cellSel;\n    if (sel instanceof CellSelection) {\n      cellSel = sel;\n    } else {\n      const end = atEndOfCell(view, axis, dir);\n      if (end == null)\n        return false;\n      cellSel = new CellSelection(state.doc.resolve(end));\n    }\n    const $head = nextCell(cellSel.$headCell, axis, dir);\n    if (!$head)\n      return false;\n    return maybeSetSelection(\n      state,\n      dispatch,\n      new CellSelection(cellSel.$anchorCell, $head)\n    );\n  };\n}\nfunction handleTripleClick(view, pos) {\n  const doc = view.state.doc, $cell = cellAround(doc.resolve(pos));\n  if (!$cell)\n    return false;\n  view.dispatch(view.state.tr.setSelection(new CellSelection($cell)));\n  return true;\n}\nfunction handlePaste(view, _, slice) {\n  if (!isInTable(view.state))\n    return false;\n  let cells = pastedCells(slice);\n  const sel = view.state.selection;\n  if (sel instanceof CellSelection) {\n    if (!cells)\n      cells = {\n        width: 1,\n        height: 1,\n        rows: [\n          Fragment4.from(\n            fitSlice(tableNodeTypes(view.state.schema).cell, slice)\n          )\n        ]\n      };\n    const table = sel.$anchorCell.node(-1);\n    const start = sel.$anchorCell.start(-1);\n    const rect = TableMap.get(table).rectBetween(\n      sel.$anchorCell.pos - start,\n      sel.$headCell.pos - start\n    );\n    cells = clipCells(cells, rect.right - rect.left, rect.bottom - rect.top);\n    insertCells(view.state, view.dispatch, start, rect, cells);\n    return true;\n  } else if (cells) {\n    const $cell = selectionCell(view.state);\n    const start = $cell.start(-1);\n    insertCells(\n      view.state,\n      view.dispatch,\n      start,\n      TableMap.get($cell.node(-1)).findCell($cell.pos - start),\n      cells\n    );\n    return true;\n  } else {\n    return false;\n  }\n}\nfunction handleMouseDown(view, startEvent) {\n  var _a;\n  if (startEvent.ctrlKey || startEvent.metaKey)\n    return;\n  const startDOMCell = domInCell(view, startEvent.target);\n  let $anchor;\n  if (startEvent.shiftKey && view.state.selection instanceof CellSelection) {\n    setCellSelection(view.state.selection.$anchorCell, startEvent);\n    startEvent.preventDefault();\n  } else if (startEvent.shiftKey && startDOMCell && ($anchor = cellAround(view.state.selection.$anchor)) != null && ((_a = cellUnderMouse(view, startEvent)) == null ? void 0 : _a.pos) != $anchor.pos) {\n    setCellSelection($anchor, startEvent);\n    startEvent.preventDefault();\n  } else if (!startDOMCell) {\n    return;\n  }\n  function setCellSelection($anchor2, event) {\n    let $head = cellUnderMouse(view, event);\n    const starting = tableEditingKey.getState(view.state) == null;\n    if (!$head || !inSameTable($anchor2, $head)) {\n      if (starting)\n        $head = $anchor2;\n      else\n        return;\n    }\n    const selection = new CellSelection($anchor2, $head);\n    if (starting || !view.state.selection.eq(selection)) {\n      const tr = view.state.tr.setSelection(selection);\n      if (starting)\n        tr.setMeta(tableEditingKey, $anchor2.pos);\n      view.dispatch(tr);\n    }\n  }\n  function stop() {\n    view.root.removeEventListener(\"mouseup\", stop);\n    view.root.removeEventListener(\"dragstart\", stop);\n    view.root.removeEventListener(\"mousemove\", move);\n    if (tableEditingKey.getState(view.state) != null)\n      view.dispatch(view.state.tr.setMeta(tableEditingKey, -1));\n  }\n  function move(_event) {\n    const event = _event;\n    const anchor = tableEditingKey.getState(view.state);\n    let $anchor2;\n    if (anchor != null) {\n      $anchor2 = view.state.doc.resolve(anchor);\n    } else if (domInCell(view, event.target) != startDOMCell) {\n      $anchor2 = cellUnderMouse(view, startEvent);\n      if (!$anchor2)\n        return stop();\n    }\n    if ($anchor2)\n      setCellSelection($anchor2, event);\n  }\n  view.root.addEventListener(\"mouseup\", stop);\n  view.root.addEventListener(\"dragstart\", stop);\n  view.root.addEventListener(\"mousemove\", move);\n}\nfunction atEndOfCell(view, axis, dir) {\n  if (!(view.state.selection instanceof TextSelection3))\n    return null;\n  const { $head } = view.state.selection;\n  for (let d = $head.depth - 1; d >= 0; d--) {\n    const parent = $head.node(d), index = dir < 0 ? $head.index(d) : $head.indexAfter(d);\n    if (index != (dir < 0 ? 0 : parent.childCount))\n      return null;\n    if (parent.type.spec.tableRole == \"cell\" || parent.type.spec.tableRole == \"header_cell\") {\n      const cellPos = $head.before(d);\n      const dirStr = axis == \"vert\" ? dir > 0 ? \"down\" : \"up\" : dir > 0 ? \"right\" : \"left\";\n      return view.endOfTextblock(dirStr) ? cellPos : null;\n    }\n  }\n  return null;\n}\nfunction domInCell(view, dom) {\n  for (; dom && dom != view.dom; dom = dom.parentNode) {\n    if (dom.nodeName == \"TD\" || dom.nodeName == \"TH\") {\n      return dom;\n    }\n  }\n  return null;\n}\nfunction cellUnderMouse(view, event) {\n  const mousePos = view.posAtCoords({\n    left: event.clientX,\n    top: event.clientY\n  });\n  if (!mousePos)\n    return null;\n  return mousePos ? cellAround(view.state.doc.resolve(mousePos.pos)) : null;\n}\n\n// src/columnresizing.ts\nimport { Plugin, PluginKey as PluginKey3 } from \"prosemirror-state\";\nimport {\n  Decoration as Decoration2,\n  DecorationSet as DecorationSet2\n} from \"prosemirror-view\";\n\n// src/tableview.ts\nvar TableView = class {\n  constructor(node, defaultCellMinWidth) {\n    this.node = node;\n    this.defaultCellMinWidth = defaultCellMinWidth;\n    this.dom = document.createElement(\"div\");\n    this.dom.className = \"tableWrapper\";\n    this.table = this.dom.appendChild(document.createElement(\"table\"));\n    this.table.style.setProperty(\n      \"--default-cell-min-width\",\n      `${defaultCellMinWidth}px`\n    );\n    this.colgroup = this.table.appendChild(document.createElement(\"colgroup\"));\n    updateColumnsOnResize(node, this.colgroup, this.table, defaultCellMinWidth);\n    this.contentDOM = this.table.appendChild(document.createElement(\"tbody\"));\n  }\n  update(node) {\n    if (node.type != this.node.type)\n      return false;\n    this.node = node;\n    updateColumnsOnResize(\n      node,\n      this.colgroup,\n      this.table,\n      this.defaultCellMinWidth\n    );\n    return true;\n  }\n  ignoreMutation(record) {\n    return record.type == \"attributes\" && (record.target == this.table || this.colgroup.contains(record.target));\n  }\n};\nfunction updateColumnsOnResize(node, colgroup, table, defaultCellMinWidth, overrideCol, overrideValue) {\n  var _a;\n  let totalWidth = 0;\n  let fixedWidth = true;\n  let nextDOM = colgroup.firstChild;\n  const row = node.firstChild;\n  if (!row)\n    return;\n  for (let i = 0, col = 0; i < row.childCount; i++) {\n    const { colspan, colwidth } = row.child(i).attrs;\n    for (let j = 0; j < colspan; j++, col++) {\n      const hasWidth = overrideCol == col ? overrideValue : colwidth && colwidth[j];\n      const cssWidth = hasWidth ? hasWidth + \"px\" : \"\";\n      totalWidth += hasWidth || defaultCellMinWidth;\n      if (!hasWidth)\n        fixedWidth = false;\n      if (!nextDOM) {\n        const col2 = document.createElement(\"col\");\n        col2.style.width = cssWidth;\n        colgroup.appendChild(col2);\n      } else {\n        if (nextDOM.style.width != cssWidth) {\n          nextDOM.style.width = cssWidth;\n        }\n        nextDOM = nextDOM.nextSibling;\n      }\n    }\n  }\n  while (nextDOM) {\n    const after = nextDOM.nextSibling;\n    (_a = nextDOM.parentNode) == null ? void 0 : _a.removeChild(nextDOM);\n    nextDOM = after;\n  }\n  if (fixedWidth) {\n    table.style.width = totalWidth + \"px\";\n    table.style.minWidth = \"\";\n  } else {\n    table.style.width = \"\";\n    table.style.minWidth = totalWidth + \"px\";\n  }\n}\n\n// src/columnresizing.ts\nvar columnResizingPluginKey = new PluginKey3(\n  \"tableColumnResizing\"\n);\nfunction columnResizing({\n  handleWidth = 5,\n  cellMinWidth = 25,\n  defaultCellMinWidth = 100,\n  View = TableView,\n  lastColumnResizable = true\n} = {}) {\n  const plugin = new Plugin({\n    key: columnResizingPluginKey,\n    state: {\n      init(_, state) {\n        var _a, _b;\n        const nodeViews = (_b = (_a = plugin.spec) == null ? void 0 : _a.props) == null ? void 0 : _b.nodeViews;\n        const tableName = tableNodeTypes(state.schema).table.name;\n        if (View && nodeViews) {\n          nodeViews[tableName] = (node, view) => {\n            return new View(node, defaultCellMinWidth, view);\n          };\n        }\n        return new ResizeState(-1, false);\n      },\n      apply(tr, prev) {\n        return prev.apply(tr);\n      }\n    },\n    props: {\n      attributes: (state) => {\n        const pluginState = columnResizingPluginKey.getState(state);\n        return pluginState && pluginState.activeHandle > -1 ? { class: \"resize-cursor\" } : {};\n      },\n      handleDOMEvents: {\n        mousemove: (view, event) => {\n          handleMouseMove(view, event, handleWidth, lastColumnResizable);\n        },\n        mouseleave: (view) => {\n          handleMouseLeave(view);\n        },\n        mousedown: (view, event) => {\n          handleMouseDown2(view, event, cellMinWidth, defaultCellMinWidth);\n        }\n      },\n      decorations: (state) => {\n        const pluginState = columnResizingPluginKey.getState(state);\n        if (pluginState && pluginState.activeHandle > -1) {\n          return handleDecorations(state, pluginState.activeHandle);\n        }\n      },\n      nodeViews: {}\n    }\n  });\n  return plugin;\n}\nvar ResizeState = class _ResizeState {\n  constructor(activeHandle, dragging) {\n    this.activeHandle = activeHandle;\n    this.dragging = dragging;\n  }\n  apply(tr) {\n    const state = this;\n    const action = tr.getMeta(columnResizingPluginKey);\n    if (action && action.setHandle != null)\n      return new _ResizeState(action.setHandle, false);\n    if (action && action.setDragging !== void 0)\n      return new _ResizeState(state.activeHandle, action.setDragging);\n    if (state.activeHandle > -1 && tr.docChanged) {\n      let handle = tr.mapping.map(state.activeHandle, -1);\n      if (!pointsAtCell(tr.doc.resolve(handle))) {\n        handle = -1;\n      }\n      return new _ResizeState(handle, state.dragging);\n    }\n    return state;\n  }\n};\nfunction handleMouseMove(view, event, handleWidth, lastColumnResizable) {\n  const pluginState = columnResizingPluginKey.getState(view.state);\n  if (!pluginState)\n    return;\n  if (!pluginState.dragging) {\n    const target = domCellAround(event.target);\n    let cell = -1;\n    if (target) {\n      const { left, right } = target.getBoundingClientRect();\n      if (event.clientX - left <= handleWidth)\n        cell = edgeCell(view, event, \"left\", handleWidth);\n      else if (right - event.clientX <= handleWidth)\n        cell = edgeCell(view, event, \"right\", handleWidth);\n    }\n    if (cell != pluginState.activeHandle) {\n      if (!lastColumnResizable && cell !== -1) {\n        const $cell = view.state.doc.resolve(cell);\n        const table = $cell.node(-1);\n        const map = TableMap.get(table);\n        const tableStart = $cell.start(-1);\n        const col = map.colCount($cell.pos - tableStart) + $cell.nodeAfter.attrs.colspan - 1;\n        if (col == map.width - 1) {\n          return;\n        }\n      }\n      updateHandle(view, cell);\n    }\n  }\n}\nfunction handleMouseLeave(view) {\n  const pluginState = columnResizingPluginKey.getState(view.state);\n  if (pluginState && pluginState.activeHandle > -1 && !pluginState.dragging)\n    updateHandle(view, -1);\n}\nfunction handleMouseDown2(view, event, cellMinWidth, defaultCellMinWidth) {\n  var _a;\n  const win = (_a = view.dom.ownerDocument.defaultView) != null ? _a : window;\n  const pluginState = columnResizingPluginKey.getState(view.state);\n  if (!pluginState || pluginState.activeHandle == -1 || pluginState.dragging)\n    return false;\n  const cell = view.state.doc.nodeAt(pluginState.activeHandle);\n  const width = currentColWidth(view, pluginState.activeHandle, cell.attrs);\n  view.dispatch(\n    view.state.tr.setMeta(columnResizingPluginKey, {\n      setDragging: { startX: event.clientX, startWidth: width }\n    })\n  );\n  function finish(event2) {\n    win.removeEventListener(\"mouseup\", finish);\n    win.removeEventListener(\"mousemove\", move);\n    const pluginState2 = columnResizingPluginKey.getState(view.state);\n    if (pluginState2 == null ? void 0 : pluginState2.dragging) {\n      updateColumnWidth(\n        view,\n        pluginState2.activeHandle,\n        draggedWidth(pluginState2.dragging, event2, cellMinWidth)\n      );\n      view.dispatch(\n        view.state.tr.setMeta(columnResizingPluginKey, { setDragging: null })\n      );\n    }\n  }\n  function move(event2) {\n    if (!event2.which)\n      return finish(event2);\n    const pluginState2 = columnResizingPluginKey.getState(view.state);\n    if (!pluginState2)\n      return;\n    if (pluginState2.dragging) {\n      const dragged = draggedWidth(pluginState2.dragging, event2, cellMinWidth);\n      displayColumnWidth(\n        view,\n        pluginState2.activeHandle,\n        dragged,\n        defaultCellMinWidth\n      );\n    }\n  }\n  displayColumnWidth(\n    view,\n    pluginState.activeHandle,\n    width,\n    defaultCellMinWidth\n  );\n  win.addEventListener(\"mouseup\", finish);\n  win.addEventListener(\"mousemove\", move);\n  event.preventDefault();\n  return true;\n}\nfunction currentColWidth(view, cellPos, { colspan, colwidth }) {\n  const width = colwidth && colwidth[colwidth.length - 1];\n  if (width)\n    return width;\n  const dom = view.domAtPos(cellPos);\n  const node = dom.node.childNodes[dom.offset];\n  let domWidth = node.offsetWidth, parts = colspan;\n  if (colwidth) {\n    for (let i = 0; i < colspan; i++)\n      if (colwidth[i]) {\n        domWidth -= colwidth[i];\n        parts--;\n      }\n  }\n  return domWidth / parts;\n}\nfunction domCellAround(target) {\n  while (target && target.nodeName != \"TD\" && target.nodeName != \"TH\")\n    target = target.classList && target.classList.contains(\"ProseMirror\") ? null : target.parentNode;\n  return target;\n}\nfunction edgeCell(view, event, side, handleWidth) {\n  const offset = side == \"right\" ? -handleWidth : handleWidth;\n  const found = view.posAtCoords({\n    left: event.clientX + offset,\n    top: event.clientY\n  });\n  if (!found)\n    return -1;\n  const { pos } = found;\n  const $cell = cellAround(view.state.doc.resolve(pos));\n  if (!$cell)\n    return -1;\n  if (side == \"right\")\n    return $cell.pos;\n  const map = TableMap.get($cell.node(-1)), start = $cell.start(-1);\n  const index = map.map.indexOf($cell.pos - start);\n  return index % map.width == 0 ? -1 : start + map.map[index - 1];\n}\nfunction draggedWidth(dragging, event, resizeMinWidth) {\n  const offset = event.clientX - dragging.startX;\n  return Math.max(resizeMinWidth, dragging.startWidth + offset);\n}\nfunction updateHandle(view, value) {\n  view.dispatch(\n    view.state.tr.setMeta(columnResizingPluginKey, { setHandle: value })\n  );\n}\nfunction updateColumnWidth(view, cell, width) {\n  const $cell = view.state.doc.resolve(cell);\n  const table = $cell.node(-1), map = TableMap.get(table), start = $cell.start(-1);\n  const col = map.colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1;\n  const tr = view.state.tr;\n  for (let row = 0; row < map.height; row++) {\n    const mapIndex = row * map.width + col;\n    if (row && map.map[mapIndex] == map.map[mapIndex - map.width])\n      continue;\n    const pos = map.map[mapIndex];\n    const attrs = table.nodeAt(pos).attrs;\n    const index = attrs.colspan == 1 ? 0 : col - map.colCount(pos);\n    if (attrs.colwidth && attrs.colwidth[index] == width)\n      continue;\n    const colwidth = attrs.colwidth ? attrs.colwidth.slice() : zeroes(attrs.colspan);\n    colwidth[index] = width;\n    tr.setNodeMarkup(start + pos, null, { ...attrs, colwidth });\n  }\n  if (tr.docChanged)\n    view.dispatch(tr);\n}\nfunction displayColumnWidth(view, cell, width, defaultCellMinWidth) {\n  const $cell = view.state.doc.resolve(cell);\n  const table = $cell.node(-1), start = $cell.start(-1);\n  const col = TableMap.get(table).colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1;\n  let dom = view.domAtPos($cell.start(-1)).node;\n  while (dom && dom.nodeName != \"TABLE\") {\n    dom = dom.parentNode;\n  }\n  if (!dom)\n    return;\n  updateColumnsOnResize(\n    table,\n    dom.firstChild,\n    dom,\n    defaultCellMinWidth,\n    col,\n    width\n  );\n}\nfunction zeroes(n) {\n  return Array(n).fill(0);\n}\nfunction handleDecorations(state, cell) {\n  var _a;\n  const decorations = [];\n  const $cell = state.doc.resolve(cell);\n  const table = $cell.node(-1);\n  if (!table) {\n    return DecorationSet2.empty;\n  }\n  const map = TableMap.get(table);\n  const start = $cell.start(-1);\n  const col = map.colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1;\n  for (let row = 0; row < map.height; row++) {\n    const index = col + row * map.width;\n    if ((col == map.width - 1 || map.map[index] != map.map[index + 1]) && (row == 0 || map.map[index] != map.map[index - map.width])) {\n      const cellPos = map.map[index];\n      const pos = start + cellPos + table.nodeAt(cellPos).nodeSize - 1;\n      const dom = document.createElement(\"div\");\n      dom.className = \"column-resize-handle\";\n      if ((_a = columnResizingPluginKey.getState(state)) == null ? void 0 : _a.dragging) {\n        decorations.push(\n          Decoration2.node(\n            start + cellPos,\n            start + cellPos + table.nodeAt(cellPos).nodeSize,\n            {\n              class: \"column-resize-dragging\"\n            }\n          )\n        );\n      }\n      decorations.push(Decoration2.widget(pos, dom));\n    }\n  }\n  return DecorationSet2.create(state.doc, decorations);\n}\n\n// src/index.ts\nfunction tableEditing({\n  allowTableNodeSelection = false\n} = {}) {\n  return new Plugin2({\n    key: tableEditingKey,\n    // This piece of state is used to remember when a mouse-drag\n    // cell-selection is happening, so that it can continue even as\n    // transactions (which might move its anchor cell) come in.\n    state: {\n      init() {\n        return null;\n      },\n      apply(tr, cur) {\n        const set = tr.getMeta(tableEditingKey);\n        if (set != null)\n          return set == -1 ? null : set;\n        if (cur == null || !tr.docChanged)\n          return cur;\n        const { deleted, pos } = tr.mapping.mapResult(cur);\n        return deleted ? null : pos;\n      }\n    },\n    props: {\n      decorations: drawCellSelection,\n      handleDOMEvents: {\n        mousedown: handleMouseDown\n      },\n      createSelectionBetween(view) {\n        return tableEditingKey.getState(view.state) != null ? view.state.selection : null;\n      },\n      handleTripleClick,\n      handleKeyDown,\n      handlePaste\n    },\n    appendTransaction(_, oldState, state) {\n      return normalizeSelection(\n        state,\n        fixTables(state, oldState),\n        allowTableNodeSelection\n      );\n    }\n  });\n}\nexport {\n  CellBookmark,\n  CellSelection,\n  ResizeState,\n  TableMap,\n  TableView,\n  clipCells as __clipCells,\n  insertCells as __insertCells,\n  pastedCells as __pastedCells,\n  addColSpan,\n  addColumn,\n  addColumnAfter,\n  addColumnBefore,\n  addRow,\n  addRowAfter,\n  addRowBefore,\n  cellAround,\n  cellNear,\n  colCount,\n  columnIsHeader,\n  columnResizing,\n  columnResizingPluginKey,\n  deleteCellSelection,\n  deleteColumn,\n  deleteRow,\n  deleteTable,\n  findCell,\n  fixTables,\n  fixTablesKey,\n  goToNextCell,\n  handlePaste,\n  inSameTable,\n  isInTable,\n  mergeCells,\n  moveCellForward,\n  nextCell,\n  pointsAtCell,\n  removeColSpan,\n  removeColumn,\n  removeRow,\n  rowIsHeader,\n  selectedRect,\n  selectionCell,\n  setCellAttr,\n  splitCell,\n  splitCellWithType,\n  tableEditing,\n  tableEditingKey,\n  tableNodeTypes,\n  tableNodes,\n  toggleHeader,\n  toggleHeaderCell,\n  toggleHeaderColumn,\n  toggleHeaderRow,\n  updateColumnsOnResize\n};\n", "import { fromPmNode } from \"@handlewithcare/remark-prosemirror\"\nimport type { Node as PmNode } from \"prosemirror-model\"\nimport { tableNodes } from \"prosemirror-tables\"\nimport type { ExtendedPmNodeSpec } from \"../types.ts\"\nimport { NodeName } from \"./names.ts\"\n\nexport function isTableNode(node: PmNode): boolean {\n\treturn node.type.name === NodeName.Table\n}\n\nexport function isTableRowNode(node: PmNode): boolean {\n\treturn node.type.name === NodeName.TableRow\n}\n\nexport function isTableCellNode(node: PmNode): boolean {\n\treturn node.type.name === NodeName.TableCell\n}\n\nexport function isTableHeaderNode(node: PmNode): boolean {\n\treturn node.type.name === NodeName.TableHeader\n}\n\nexport function tableNodeSpecs() {\n\t// Casting to add the `toMarkdown` field\n\tconst nodes = tableNodes({ tableGroup: \"block\", cellContent: \"block+\", cellAttributes: {} }) as Record<\n\t\tNodeName.Table | NodeName.TableRow | NodeName.TableCell | NodeName.TableHeader,\n\t\tExtendedPmNodeSpec<unknown>\n\t>\n\n\t/**\n\t * Wraps the table in a wrapper for styling purposes. figure is used instead of div because it is more\n\t * semantically correct and does not conflict with the textBlock parsing.\n\t */\n\tnodes[NodeName.Table].toDOM = () => [\"figure\", { class: \"framer-table-wrapper\" }, [\"table\", [\"tbody\", 0]]]\n\n\t/**\n\t * Parses a table directly for backward compatability of tables created by beta users and a nested table.\n\t */\n\tnodes[NodeName.Table].parseDOM = [{ tag: \"table\" }, { tag: \"figure.framer-table-wrapper table\" }]\n\n\tnodes[NodeName.Table].toMarkdown = fromPmNode(\"table\")\n\tnodes[NodeName.TableRow].toMarkdown = fromPmNode(\"tableRow\")\n\tnodes[NodeName.TableCell].toMarkdown = fromPmNode(\"tableCell\")\n\tnodes[NodeName.TableHeader].toMarkdown = fromPmNode(\"tableCell\")\n\n\treturn nodes\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { fromPmNode } from \"@handlewithcare/remark-prosemirror\"\nimport type { Node as PmNode } from \"prosemirror-model\"\nimport type { ExtendedPmNodeSpec } from \"../types.ts\"\nimport { NodeName } from \"./names.ts\"\n\nexport function isProseMirrorTextNode(node: PmNode): boolean {\n\treturn node.type.name === NodeName.Text\n}\n\nexport const textNode: ExtendedPmNodeSpec<undefined> = {\n\tinline: true,\n\tgroup: \"inline\",\n\ttoMarkdown: fromPmNode(\"text\", (node: PmNode<undefined>) => {\n\t\tassert(node.text !== undefined, \"text node must have text\")\n\t\treturn { value: node.text }\n\t}),\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { Schema } from \"prosemirror-model\"\nimport type { EditorState } from \"prosemirror-state\"\nimport type { ExtendedPmMarkType, ExtendedPmNodeType } from \"../types.ts\"\nimport { type BackgroundMaskAttrs, backgroundMask } from \"./backgroundMask.ts\"\nimport { type BackgroundStylesAttrs, backgroundStyles } from \"./backgroundStyles.ts\"\nimport { blockquoteNode } from \"./blockquote.ts\"\nimport { boldMark } from \"./bold.ts\"\nimport { doc } from \"./doc.ts\"\nimport { type ImageAttrs, image } from \"./image.ts\"\nimport { type InlineCodeAttrs, inlineCode } from \"./inlineCode.ts\"\nimport { type InlineStylesAttrs, inlineStyles } from \"./inlineStyles.ts\"\nimport { italicMark } from \"./italic.ts\"\nimport { lineBreakNode } from \"./lineBreak.ts\"\nimport { type LinkAttrs, link } from \"./link.ts\"\nimport {\n\ttype BulletedListAttrs,\n\ttype ListItemAttrs,\n\ttype NumberedListAttrs,\n\tbulletedList,\n\tlistItem,\n\tnumberedList,\n} from \"./list.ts\"\nimport { type ModuleAttrs, moduleNode } from \"./module.ts\"\nimport { MarkName, NodeName } from \"./names.ts\"\nimport { tableNodeSpecs } from \"./table.ts\"\nimport { textNode } from \"./text.ts\"\nimport { type TextBlockAttrs, textBlock } from \"./textBlock.ts\"\n\n/**\n * The base Framer ProseMirror schema, with features that are supported in all editors across\n * Framer.\n *\n * Many editors support additional features. E.g., CMS supports images and tables, whereas canvas\n * supports inline styles on any part of the text. To assert that the schema you\u2019re working with\n * supports a particular feature, use additional types:\n * - `schema: FramerProseMirrorSchema` for a base schema\n * - `schema: FramerProseMirrorSchema & FramerProseMirrorSchema.WithMedia` when a schema that supports images\n * - `schema: FramerProseMirrorSchema & FramerProseMirrorSchema.WithMedia & FramerProseMirrorSchema.WithEmbeds`\n *   for a schema that supports images and embeds\n * - and so on\n *\n * or runtime checks:\n * - `schemaSupportsMedia(schema)` when the schema needs to support images\n * - `schemaSupportsMedia(schema) && schemaSupportsEmbeds(schema)` when the schema needs to support\n *   images and embeds\n * - and so on\n */\nexport type FramerProseMirrorSchema = Schema & {\n\t// NOTE: when adding new nodes or marks, consider if they must actually be supported in all editors\n\t// (CMS, canvas, localization, variable default value). If not, add them conditionally (see\n\t// FramerProseMirrorSchema.WithMedia for an example). Otherwise, some nodes or marks might be\n\t// retained when copy-pasting content \u2013 and end up rendering in unsupported editors.\n\tnodes: {\n\t\t[NodeName.BulletedList]: ExtendedPmNodeType<BulletedListAttrs>\n\t\t[NodeName.Document]: ExtendedPmNodeType<undefined>\n\t\t[NodeName.LineBreak]: ExtendedPmNodeType<undefined>\n\t\t[NodeName.ListItem]: ExtendedPmNodeType<ListItemAttrs>\n\t\t[NodeName.NumberedList]: ExtendedPmNodeType<NumberedListAttrs>\n\t\t[NodeName.Text]: ExtendedPmNodeType<undefined>\n\t\t[NodeName.TextBlock]: ExtendedPmNodeType<TextBlockAttrs>\n\t}\n\tmarks: {\n\t\t[MarkName.Bold]: ExtendedPmMarkType<undefined>\n\t\t[MarkName.InlineCode]: ExtendedPmMarkType<InlineCodeAttrs>\n\t\t[MarkName.Italic]: ExtendedPmMarkType<undefined>\n\t}\n}\n\nexport namespace FramerProseMirrorSchema {\n\t/** Schema extension to declare media support. Use as `schema: FramerProseMirrorSchema & FramerProseMirrorSchema.WithMedia` */\n\texport interface WithMedia {\n\t\tnodes: { [NodeName.Image]: ExtendedPmNodeType<ImageAttrs> }\n\t}\n\t/** Schema extension to declare embeds support. Use as `schema: FramerProseMirrorSchema & FramerProseMirrorSchema.WithEmbeds` */\n\texport interface WithEmbeds {\n\t\tnodes: { [NodeName.Module]: ExtendedPmNodeType<ModuleAttrs> }\n\t}\n\t/** Schema extension to declare links support. Use as `schema: FramerProseMirrorSchema & FramerProseMirrorSchema.WithLinks` */\n\texport interface WithLinks {\n\t\tmarks: { [MarkName.Link]: ExtendedPmMarkType<LinkAttrs> }\n\t}\n\t/** Schema extension to declare styles support. Use as `schema: FramerProseMirrorSchema & FramerProseMirrorSchema.WithStyles` */\n\texport interface WithStyles {\n\t\tmarks: {\n\t\t\t[MarkName.BackgroundStyles]: ExtendedPmMarkType<BackgroundStylesAttrs>\n\t\t\t[MarkName.BackgroundMask]: ExtendedPmMarkType<BackgroundMaskAttrs>\n\t\t\t[MarkName.InlineStyles]: ExtendedPmMarkType<InlineStylesAttrs>\n\t\t}\n\t}\n\t/** Schema extension to declare blockquotes support. Use as `schema: FramerProseMirrorSchema & FramerProseMirrorSchema.WithBlockquotes` */\n\texport interface WithBlockquotes {\n\t\tnodes: { [NodeName.Blockquote]: ExtendedPmNodeType<undefined> }\n\t}\n\t/** Schema extension to declare tables support. Use as `schema: FramerProseMirrorSchema & FramerProseMirrorSchema.WithTables` */\n\texport interface WithTables {\n\t\tnodes: {\n\t\t\t[NodeName.Table]: ExtendedPmNodeType<unknown>\n\t\t\t[NodeName.TableCell]: ExtendedPmNodeType<unknown>\n\t\t\t[NodeName.TableHeader]: ExtendedPmNodeType<unknown>\n\t\t\t[NodeName.TableRow]: ExtendedPmNodeType<unknown>\n\t\t}\n\t}\n\n\t/** Defines a schema extension that supports *all* features. You\u2019ll normally never need this outside of tests. Use as `schema: FramerProseMirrorSchema & FramerProseMirrorSchema.WithEverything` */\n\texport type WithEverything = FramerProseMirrorSchema &\n\t\tWithMedia &\n\t\tWithEmbeds &\n\t\tWithLinks &\n\t\tWithStyles &\n\t\tWithBlockquotes &\n\t\tWithTables\n}\n\nconst schemaCache = new Map<\n\t`${boolean}-${boolean}-${boolean}-${boolean}-${boolean}-${boolean}`,\n\tFramerProseMirrorSchema\n>()\n\nexport function makeSchema<\n\tSupportsMedia extends boolean = false,\n\tSupportsEmbeds extends boolean = false,\n\tSupportsLinks extends boolean = false,\n\tSupportsStyles extends boolean = false,\n\tSupportsBlockquotes extends boolean = false,\n\tSupportsTables extends boolean = false,\n>({\n\tsupportsMedia,\n\tsupportsEmbeds,\n\tsupportsLinks,\n\tsupportsStyles,\n\tsupportsBlockquotes,\n\tsupportsTables,\n}: {\n\tsupportsMedia: SupportsMedia\n\tsupportsEmbeds: SupportsEmbeds\n\tsupportsLinks: SupportsLinks\n\tsupportsStyles: SupportsStyles\n\tsupportsBlockquotes: SupportsBlockquotes\n\tsupportsTables: SupportsTables\n}): FramerProseMirrorSchema &\n\t(SupportsMedia extends true ? FramerProseMirrorSchema.WithMedia : {}) &\n\t(SupportsEmbeds extends true ? FramerProseMirrorSchema.WithEmbeds : {}) &\n\t(SupportsLinks extends true ? FramerProseMirrorSchema.WithLinks : {}) &\n\t(SupportsStyles extends true ? FramerProseMirrorSchema.WithStyles : {}) &\n\t(SupportsBlockquotes extends true ? FramerProseMirrorSchema.WithBlockquotes : {}) &\n\t(SupportsTables extends true ? FramerProseMirrorSchema.WithTables : {}) {\n\tconst key =\n\t\t`${supportsMedia}-${supportsEmbeds}-${supportsLinks}-${supportsStyles}-${supportsBlockquotes}-${supportsTables}` as const\n\tconst cachedSchema = schemaCache.get(key)\n\tif (cachedSchema) {\n\t\treturn cachedSchema as FramerProseMirrorSchema &\n\t\t\t(SupportsMedia extends true ? FramerProseMirrorSchema.WithMedia : {}) &\n\t\t\t(SupportsEmbeds extends true ? FramerProseMirrorSchema.WithEmbeds : {}) &\n\t\t\t(SupportsLinks extends true ? FramerProseMirrorSchema.WithLinks : {}) &\n\t\t\t(SupportsStyles extends true ? FramerProseMirrorSchema.WithStyles : {}) &\n\t\t\t(SupportsBlockquotes extends true ? FramerProseMirrorSchema.WithBlockquotes : {}) &\n\t\t\t(SupportsTables extends true ? FramerProseMirrorSchema.WithTables : {})\n\t}\n\n\t// WARNING: The order of the elements in the schema is important.\n\tconst schema = new Schema({\n\t\ttopNode: \"document\",\n\n\t\tnodes: {\n\t\t\t[NodeName.Document]: doc,\n\n\t\t\t[NodeName.TextBlock]: textBlock({ supportsStyles }),\n\n\t\t\t[NodeName.BulletedList]: bulletedList({ supportsStyles }),\n\t\t\t[NodeName.NumberedList]: numberedList({ supportsStyles }),\n\n\t\t\t[NodeName.ListItem]: listItem({ supportsStyles }),\n\n\t\t\t...(supportsBlockquotes ? { [NodeName.Blockquote]: blockquoteNode } : {}),\n\n\t\t\t...(supportsMedia ? { [NodeName.Image]: image } : {}),\n\n\t\t\t...(supportsEmbeds ? { [NodeName.Module]: moduleNode } : {}),\n\n\t\t\t[NodeName.Text]: textNode,\n\n\t\t\t[NodeName.LineBreak]: lineBreakNode,\n\n\t\t\t...(supportsTables ? tableNodeSpecs() : {}),\n\t\t},\n\n\t\t// The order that these marks are defined determines the order they will\n\t\t// wrap each other in. This is particularly relevant for code as it adds\n\t\t// padding and a background so it should wrap other marks.\n\t\tmarks: {\n\t\t\t// adds a element spanning background, must be before all marks that shouldn't be occluded by it\n\t\t\t...(supportsStyles ? { [MarkName.BackgroundStyles]: backgroundStyles } : {}),\n\n\t\t\t...(supportsStyles ? { [MarkName.BackgroundMask]: backgroundMask } : {}),\n\n\t\t\t// also adds background to the text but excludes backgroundStyles and backgroundMask so they won't apply behind this element\n\t\t\t[MarkName.InlineCode]: inlineCode({ supportsStyles }),\n\n\t\t\t...(supportsLinks ? { [MarkName.Link]: link({ supportsStyles }) } : {}),\n\n\t\t\t...(supportsStyles ? { [MarkName.InlineStyles]: inlineStyles } : {}),\n\n\t\t\t[MarkName.Italic]: italicMark,\n\n\t\t\t[MarkName.Bold]: boldMark,\n\t\t},\n\n\t\t// \u2193 `as` is not very type-safe, but I spent two hours trying to make it work without it, and no\n\t\t// luck. The only other type-safe alternative is to have a separate overload or `if` branch for\n\t\t// every possible combination of `supportsMedia`, `supportsEmbeds`, `supportsLinks` etc, which\n\t\t// is a lot.\n\t\t//\n\t\t// The core issue here is that conditionally setting the `image` node gives it the type of\n\t\t// `NodeSpec<ImageAttrs> | undefined`, whereas `FramerProseMirrorSchema[\"nodes\"][\"image\"]`\n\t\t// has a type of `SupportsMedia extends true ? NodeSpec<ImageAttrs> : undefined`, and the former\n\t\t// just isn\u2019t assignable to the latter: https://chatgpt.com/share/688a44ba-e324-8008-be32-11415cf77c49\n\t\t//\n\t\t// And even if you solve this in some way that ChatGPT suggests, you still run into the fact that\n\t\t// you\u2019re doing `new Schema()`, and its type definitions are just not designed for conditional\n\t\t// setting of nodes and marks.\n\t\t//\n\t\t// NOTE: Are you getting a \u201CConversion of type 'Schema<...>' to type 'FramerProseMirrorSchema<...>'\n\t\t// may be a mistake because neither type sufficiently overlaps with the other\u201D error? Check if there\n\t\t// are any nodes or marks that you added here but forgot to add into FramerProseMirrorSchema.\n\t}) as FramerProseMirrorSchema &\n\t\t(SupportsMedia extends true ? FramerProseMirrorSchema.WithMedia : {}) &\n\t\t(SupportsEmbeds extends true ? FramerProseMirrorSchema.WithEmbeds : {}) &\n\t\t(SupportsLinks extends true ? FramerProseMirrorSchema.WithLinks : {}) &\n\t\t(SupportsStyles extends true ? FramerProseMirrorSchema.WithStyles : {}) &\n\t\t(SupportsBlockquotes extends true ? FramerProseMirrorSchema.WithBlockquotes : {}) &\n\t\t(SupportsTables extends true ? FramerProseMirrorSchema.WithTables : {})\n\n\tschemaCache.set(key, schema)\n\n\treturn schema\n}\n\n/** Use this in editors for smart component variables. */\nexport const smartComponentVariableSchemaParams = {\n\tsupportsMedia: false,\n\tsupportsEmbeds: false,\n\tsupportsLinks: true,\n\tsupportsStyles: false,\n\tsupportsBlockquotes: false,\n\tsupportsTables: false,\n} satisfies Parameters<typeof makeSchema>[0]\n\n/** Use this for regular canvas rich text. */\nexport const canvasSchemaParams = {\n\tsupportsMedia: false,\n\tsupportsEmbeds: false,\n\tsupportsLinks: true,\n\tsupportsStyles: true,\n\tsupportsBlockquotes: false,\n\tsupportsTables: false,\n} satisfies Parameters<typeof makeSchema>[0]\n\n/**\n * Use this in localization editors for canvas strings. That editor supports\n * all canvas features, but not styles.\n */\nexport const localizationCanvasSchemaParams = {\n\t...canvasSchemaParams,\n\tsupportsStyles: false,\n} satisfies Parameters<typeof makeSchema>[0]\n\n/** Use this for regular CMS rich text. */\nexport const cmsSchemaParams = {\n\tsupportsMedia: true,\n\tsupportsEmbeds: true,\n\tsupportsLinks: true,\n\tsupportsStyles: false,\n\tsupportsBlockquotes: true,\n\tsupportsTables: true,\n} satisfies Parameters<typeof makeSchema>[0]\n\n/**\n * Use this in non-UI code that manipulates HTML without surfacing it to the user (e.g.\n * batch-rewrites all links or variables). Using the full schema means we remain agnostic\n * to the source of the HTML and don\u2019t accidentally discard some important nodes or marks.\n */\nexport const fullSchemaParams = {\n\tsupportsMedia: true,\n\tsupportsEmbeds: true,\n\tsupportsLinks: true,\n\tsupportsStyles: true,\n\tsupportsBlockquotes: true,\n\tsupportsTables: true,\n} satisfies Parameters<typeof makeSchema>[0]\n\nexport function schemaSupportsMedia<T extends FramerProseMirrorSchema>(\n\tschema: T,\n): schema is T & FramerProseMirrorSchema.WithMedia {\n\treturn NodeName.Image in schema.nodes && schema.nodes[NodeName.Image] !== undefined\n}\n\nexport function schemaSupportsEmbeds<T extends FramerProseMirrorSchema>(\n\tschema: T,\n): schema is T & FramerProseMirrorSchema.WithEmbeds {\n\treturn NodeName.Module in schema.nodes && schema.nodes[NodeName.Module] !== undefined\n}\n\nexport function schemaSupportsLinks<T extends FramerProseMirrorSchema>(\n\tschema: T,\n): schema is T & FramerProseMirrorSchema.WithLinks {\n\treturn MarkName.Link in schema.marks && schema.marks[MarkName.Link] !== undefined\n}\n\nexport function schemaSupportsStyles<T extends FramerProseMirrorSchema>(\n\tschema: T,\n): schema is T & FramerProseMirrorSchema.WithStyles {\n\treturn MarkName.InlineStyles in schema.marks && schema.marks[MarkName.InlineStyles] !== undefined\n}\n\nexport function schemaSupportsBlockquotes<T extends FramerProseMirrorSchema>(\n\tschema: T,\n): schema is T & FramerProseMirrorSchema.WithBlockquotes {\n\treturn NodeName.Blockquote in schema.nodes && schema.nodes[NodeName.Blockquote] !== undefined\n}\n\nexport function schemaSupportsTables<T extends FramerProseMirrorSchema>(\n\tschema: T,\n): schema is T & FramerProseMirrorSchema.WithTables {\n\treturn NodeName.Table in schema.nodes && schema.nodes[NodeName.Table] !== undefined\n}\n\n/**\n * This allows you to get a schema from an editor state, asserting it supports particular features.\n * AVOID USING THIS, IF POSSIBLE. Instead, try to always pass the schema down directly \u2013 this\n * provides compile-time type safety for supported features.\n */\nexport function getSchemaFromEditorState<\n\tSupportsMedia extends boolean = false,\n\tSupportsEmbeds extends boolean = false,\n\tSupportsLinks extends boolean = false,\n\tSupportsStyles extends boolean = false,\n\tSupportsBlockquotes extends boolean = false,\n\tSupportsTables extends boolean = false,\n>(\n\tstate: EditorState,\n\t{\n\t\tassertSupportsMedia,\n\t\tassertSupportsEmbeds,\n\t\tassertSupportsLinks,\n\t\tassertSupportsStyles,\n\t\tassertSupportsBlockquotes,\n\t\tassertSupportsTables,\n\t}: {\n\t\tassertSupportsMedia?: SupportsMedia\n\t\tassertSupportsEmbeds?: SupportsEmbeds\n\t\tassertSupportsLinks?: SupportsLinks\n\t\tassertSupportsStyles?: SupportsStyles\n\t\tassertSupportsBlockquotes?: SupportsBlockquotes\n\t\tassertSupportsTables?: SupportsTables\n\t} = {},\n): FramerProseMirrorSchema &\n\t(SupportsMedia extends true ? FramerProseMirrorSchema.WithMedia : {}) &\n\t(SupportsEmbeds extends true ? FramerProseMirrorSchema.WithEmbeds : {}) &\n\t(SupportsLinks extends true ? FramerProseMirrorSchema.WithLinks : {}) &\n\t(SupportsStyles extends true ? FramerProseMirrorSchema.WithStyles : {}) &\n\t(SupportsBlockquotes extends true ? FramerProseMirrorSchema.WithBlockquotes : {}) &\n\t(SupportsTables extends true ? FramerProseMirrorSchema.WithTables : {}) {\n\tconst schema = state.schema as FramerProseMirrorSchema &\n\t\t(SupportsMedia extends true ? FramerProseMirrorSchema.WithMedia : {}) &\n\t\t(SupportsEmbeds extends true ? FramerProseMirrorSchema.WithEmbeds : {}) &\n\t\t(SupportsLinks extends true ? FramerProseMirrorSchema.WithLinks : {}) &\n\t\t(SupportsStyles extends true ? FramerProseMirrorSchema.WithStyles : {}) &\n\t\t(SupportsBlockquotes extends true ? FramerProseMirrorSchema.WithBlockquotes : {}) &\n\t\t(SupportsTables extends true ? FramerProseMirrorSchema.WithTables : {})\n\tif (assertSupportsMedia) {\n\t\tassert(schemaSupportsMedia(schema), \"Schema does not support media\")\n\t}\n\tif (assertSupportsEmbeds) {\n\t\tassert(schemaSupportsEmbeds(schema), \"Schema does not support embeds\")\n\t}\n\tif (assertSupportsLinks) {\n\t\tassert(schemaSupportsLinks(schema), \"Schema does not support links\")\n\t}\n\tif (assertSupportsStyles) {\n\t\tassert(schemaSupportsStyles(schema), \"Schema does not support styles\")\n\t}\n\tif (assertSupportsBlockquotes) {\n\t\tassert(schemaSupportsBlockquotes(schema), \"Schema does not support blockquotes\")\n\t}\n\tif (assertSupportsTables) {\n\t\tassert(schemaSupportsTables(schema), \"Schema does not support tables\")\n\t}\n\n\treturn schema\n}\n", "import type { Node as PmNode } from \"prosemirror-model\"\nimport { DOMParser, DOMSerializer } from \"prosemirror-model\"\nimport { type FramerProseMirrorSchema, schemaSupportsStyles } from \"../schema/index.ts\"\nimport { BlockStyles, InlineStyles, setStyles } from \"../styles.ts\"\n\n// Parsing\n\nexport function parseRichText(html: string, schema: FramerProseMirrorSchema) {\n\tconst template = document.createElement(\"template\")\n\ttemplate.innerHTML = html\n\n\tconst domParser = DOMParser.fromSchema(schema)\n\treturn domParser.parse(template.content, {\n\t\tpreserveWhitespace: true,\n\t})\n}\n\n// Serializing\n\ntype ComputedStyles = Map<string, unknown>\n\ninterface ComputedPreset {\n\tclassName: string\n\tdataAttribute: string\n}\n\nfunction getDefaultStyles() {\n\tif (typeof document === \"undefined\") return new Map()\n\n\tconst div = document.createElement(\"div\")\n\n\tsetStyles(div.style, BlockStyles.transforms, BlockStyles.defaults)\n\tsetStyles(div.style, InlineStyles.transforms, InlineStyles.defaults)\n\n\tconst defaultStyles: ComputedStyles = new Map()\n\n\tfor (let index = 0; index < div.style.length; index++) {\n\t\tconst key = div.style.item(index)\n\t\tconst value = div.style.getPropertyValue(key)\n\t\tdefaultStyles.set(key, value)\n\t}\n\n\treturn defaultStyles\n}\n\n// TODO: Revisit and split into defaultStyles and presetStyles\nconst defaultStyles = getDefaultStyles()\n\nfunction getDefaultPreset(): ComputedPreset {\n\treturn {\n\t\tclassName: \"text-styles-preset-reset\",\n\t\tdataAttribute: \"reset\",\n\t}\n}\n\nconst defaultPreset = getDefaultPreset()\n\nfunction isBlockElement(element: HTMLElement) {\n\treturn (\n\t\telement instanceof HTMLParagraphElement ||\n\t\telement instanceof HTMLHeadingElement ||\n\t\telement instanceof HTMLDivElement\n\t)\n}\n\nfunction dedupeStyles(\n\telement: HTMLElement,\n\tparentStyles: ComputedStyles,\n\tcomputedStyles: ComputedStyles,\n\tparentPreset: ComputedPreset,\n\tcomputedPreset: ComputedPreset,\n) {\n\tconst style = element.style\n\n\t// Remove any styles that are identical with the style of the ancestors.\n\tfor (let index = style.length - 1; index >= 0; index--) {\n\t\tconst name = style.item(index)\n\t\tconst value = style.getPropertyValue(name)\n\t\tconst parentValue = parentStyles.get(name)\n\t\tif (parentValue === value) {\n\t\t\telement.style.removeProperty(name)\n\t\t} else {\n\t\t\tcomputedStyles.set(name, value)\n\t\t}\n\t}\n\n\tif (element.className) {\n\t\tif (element.className === parentPreset.className) {\n\t\t\telement.removeAttribute(\"class\")\n\t\t} else {\n\t\t\tcomputedPreset.className = element.className\n\t\t}\n\t}\n\n\tif (element.dataset.stylesPreset) {\n\t\tif (element.dataset.stylesPreset === parentPreset.dataAttribute) {\n\t\t\tdelete element.dataset.stylesPreset\n\t\t} else {\n\t\t\tcomputedPreset.dataAttribute = element.dataset.stylesPreset\n\t\t}\n\t}\n}\n\nfunction removeEmptyStyleAttribute(element: HTMLElement) {\n\tif (element.style.length === 0) {\n\t\t// WTF? https://stackoverflow.com/a/7167553\n\t\telement.getAttribute(\"style\")\n\t\telement.removeAttribute(\"style\")\n\t}\n}\n\nfunction isRedundantElement(element: HTMLElement) {\n\tif (element.attributes.length !== 0) return false\n\treturn element instanceof HTMLSpanElement || element.tagName === \"MARK\"\n}\n\nfunction removeRedundantElements(element: HTMLElement) {\n\tif (isRedundantElement(element)) {\n\t\tconst parentNode = element.parentNode\n\n\t\tif (parentNode) {\n\t\t\twhile (element.firstChild) {\n\t\t\t\tparentNode.insertBefore(element.firstChild, element)\n\t\t\t}\n\n\t\t\tparentNode.removeChild(element)\n\t\t}\n\t}\n}\n\nfunction insertTrailingBreaks(element: HTMLElement) {\n\tif (isBlockElement(element) && element.parentElement !== null) {\n\t\tif (element.childNodes.length === 0 || endsWithBr(element)) {\n\t\t\tconst br = document.createElement(\"br\")\n\t\t\tbr.classList.add(\"trailing-break\")\n\t\t\telement.appendChild(br)\n\t\t}\n\t}\n}\n\nfunction endsWithBr(node: Node): boolean {\n\tif (node instanceof HTMLBRElement) return true\n\tif (node.nodeType === Node.TEXT_NODE) return false\n\n\tif (node instanceof HTMLElement) {\n\t\tconst lastChild = node.lastChild\n\t\tif (!lastChild) return false\n\t\treturn endsWithBr(lastChild)\n\t}\n\n\treturn false\n}\n\nfunction postProcess(\n\telement: HTMLElement,\n\tparentStyles: ComputedStyles,\n\tparentPreset: ComputedPreset,\n\tsupportsStyles: boolean,\n) {\n\t// Clear all parent styles that are defined by the text styles preset.\n\tif (\n\t\tsupportsStyles &&\n\t\tisBlockElement(element) &&\n\t\telement.dataset.stylesPreset &&\n\t\telement.dataset.stylesPreset !== \"reset\"\n\t) {\n\t\tparentStyles = new Map(parentStyles)\n\t\tfor (const [key] of defaultStyles) {\n\t\t\tparentStyles.delete(key)\n\t\t}\n\t}\n\n\tconst computedPreset = { ...parentPreset }\n\tconst computedStyles = new Map(parentStyles)\n\tif (supportsStyles) {\n\t\tdedupeStyles(element, parentStyles, computedStyles, parentPreset, computedPreset)\n\t}\n\n\tfor (const child of element.childNodes) {\n\t\tif (child instanceof HTMLElement) {\n\t\t\tpostProcess(child, computedStyles, computedPreset, supportsStyles)\n\t\t}\n\t}\n\n\tremoveEmptyStyleAttribute(element)\n\tremoveRedundantElements(element)\n\tinsertTrailingBreaks(element)\n}\n\nexport function serializeRichText(doc: PmNode, schema: FramerProseMirrorSchema) {\n\tconst domSerializer = DOMSerializer.fromSchema(schema)\n\tconst fragment = domSerializer.serializeFragment(doc.content)\n\n\tconst div = document.createElement(\"div\")\n\tdiv.appendChild(fragment)\n\n\tpostProcess(div, defaultStyles, defaultPreset, schemaSupportsStyles(schema))\n\n\treturn div.innerHTML\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { hasActiveImageFill, hasImageFill } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\n\nfunction doesDimensionFitImage(node: CanvasNode, dimension: \"width\" | \"height\"): boolean {\n\tif (!hasImageFill(node) || !hasActiveImageFill(node)) return false\n\tif (!(\"widthType\" in node) || !(\"heightType\" in node)) return false\n\treturn node[`${dimension}Type`] === DimensionType.FitImage\n}\n\nexport function doesHeightFitImage(node: CanvasNode): boolean {\n\treturn doesDimensionFitImage(node, \"height\")\n}\n\nexport function doesWidthFitImage(node: CanvasNode): boolean {\n\treturn doesDimensionFitImage(node, \"width\")\n}\n", "import { experiments } from \"app/experiments.ts\"\nimport { doesHeightFitImage, doesWidthFitImage } from \"document/models/CanvasTree/traits/utils/doesDimensionFitImage.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport { hasColumnMasonryLayout } from \"./WithLayout.ts\"\n\nexport interface WithGridItemSize {\n\tgridItemFillCellWidth: boolean | undefined\n\tgridItemFillCellHeight: boolean | undefined\n}\n\nexport const gridItemSizeDefaults: WithGridItemSize = {\n\tgridItemFillCellWidth: undefined,\n\tgridItemFillCellHeight: undefined,\n}\n\nconst key: keyof WithGridItemSize = \"gridItemFillCellWidth\"\n\nexport function withGridItemSize<N extends CanvasNode>(node: N): node is N & WithGridItemSize {\n\treturn key in node\n}\n\nexport function isGridChildFillingCellHeight<T extends CanvasNode>(node: T): boolean {\n\tif (!withGridItemSize(node)) return false\n\tif (!node.gridItemFillCellHeight) return false\n\tif (node.cache.parentDirected !== \"grid\") return false\n\tif (!experiments.isOn(\"gridBentoFit\") && node.cache.parentDirectedRowHeightType === \"fit\") {\n\t\treturn false\n\t}\n\t// Images with heightType of \"fit-image\" get their inline height set to \"auto\", see Image.tsx.\n\tif (doesHeightFitImage(node)) return false\n\treturn true\n}\n\nexport function isGridChildFillingCellWidth<T extends CanvasNode>(node: T): boolean {\n\tif (!withGridItemSize(node)) return false\n\tif (!node.gridItemFillCellWidth) return false\n\tif (node.cache.parentDirected !== \"grid\") return false\n\t// Images with widthType of \"fit-image\" get their inline width set to \"auto\", see Image.tsx.\n\tif (doesWidthFitImage(node)) return false\n\treturn true\n}\n\n/**\n * Computes the grid-item fill-cell update for a node being inserted or moved\n * into a grid parent. Returns the partial update to apply, or undefined if no\n * changes are needed.\n *\n * Handles fit-image nodes (should not fill), masonry grids (children need\n * intrinsic heights), and default fill behavior.\n */\nexport function gridItemFillCellUpdate(\n\tnode: CanvasNode & WithGridItemSize,\n\tgridParent: CanvasNode,\n): Partial<WithGridItemSize> | undefined {\n\tconst update: Partial<WithGridItemSize> = {}\n\tlet needsUpdate = false\n\n\tif (doesWidthFitImage(node)) {\n\t\tif (node.gridItemFillCellWidth === true) {\n\t\t\tupdate.gridItemFillCellWidth = false\n\t\t\tneedsUpdate = true\n\t\t}\n\t} else if (node.gridItemFillCellWidth === undefined) {\n\t\tupdate.gridItemFillCellWidth = true\n\t\tneedsUpdate = true\n\t}\n\n\tif (doesHeightFitImage(node)) {\n\t\tif (node.gridItemFillCellHeight === true) {\n\t\t\tupdate.gridItemFillCellHeight = false\n\t\t\tneedsUpdate = true\n\t\t}\n\t} else if (hasColumnMasonryLayout(gridParent)) {\n\t\tif (node.gridItemFillCellHeight === true) {\n\t\t\tupdate.gridItemFillCellHeight = undefined\n\t\t\tneedsUpdate = true\n\t\t}\n\t} else if (node.gridItemFillCellHeight === undefined) {\n\t\tupdate.gridItemFillCellHeight = true\n\t\tneedsUpdate = true\n\t}\n\n\treturn needsUpdate ? update : undefined\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport { isGridChildFillingCellHeight, isGridChildFillingCellWidth } from \"./WithGridItemSize.ts\"\nimport type { WithSize } from \"./WithSize.ts\"\n\nexport interface WithSizeDimensionType {\n\twidthType: DimensionType\n\theightType: DimensionType\n}\n\nexport const widthTypeKey: keyof WithSizeDimensionType = \"widthType\"\nexport const heightTypeKey: keyof WithSizeDimensionType = \"heightType\"\n\nexport function withSizeDimensionType<T extends CanvasNode>(node: T): node is T & WithSizeDimensionType {\n\treturn widthTypeKey in node\n}\n\nexport function hasViewportWidth<T extends CanvasNode>(\n\tnode: T,\n): node is T & WithSizeDimensionType & { widthType: DimensionType.Viewport } {\n\tif (!withSizeDimensionType(node)) return false\n\t// if a node fills to its grid parent cell width, we render it as 100% width\n\t// https://github.com/framer/FramerStudio/blob/97823a0d24f2973f7c3d004df6233a63ce6f4868/src/app/vekter/src/document/models/CanvasTree/traits/utils/newConstraintProperties.ts#L50\n\tif (isGridChildFillingCellWidth(node)) return false\n\treturn node.widthType === DimensionType.Viewport\n}\n\nexport function hasViewportHeight<T extends CanvasNode>(\n\tnode: T,\n): node is T & WithSizeDimensionType & { heightType: DimensionType.Viewport } {\n\tif (!withSizeDimensionType(node)) return false\n\t// if a node fills to its grid parent row height, we render it as 100% height\n\t// https://github.com/framer/FramerStudio/blob/97823a0d24f2973f7c3d004df6233a63ce6f4868/src/app/vekter/src/document/models/CanvasTree/traits/utils/newConstraintProperties.ts#L57\n\tif (isGridChildFillingCellHeight(node)) return false\n\treturn node.heightType === DimensionType.Viewport\n}\n\nexport function viewportUnitToPixelValueOnCanvas(viewportUnit: number, viewportSize: number) {\n\treturn viewportUnit * viewportSize\n}\n\nexport function viewportUnitForDimension(dimension: keyof WithSize) {\n\treturn dimension === \"width\" ? \"vw\" : \"vh\"\n}\n", "import type { ContentBlock, ContentState, DraftInlineStyle } from \"draft-js\"\nimport { EditorState, Modifier, SelectionState } from \"draft-js\"\nimport { Map, OrderedSet } from \"immutable\"\nimport { draftStyleDefinitions } from \"text\"\nimport type { TextDirection } from \"text/types.ts\"\n\nconst singleTextStyle = [\"BOLD\", \"ITALIC\"]\nconst additiveTextStyle = [draftStyleDefinitions.textTransform.prefix, draftStyleDefinitions.textDecoration.prefix]\n\nfunction hasStylePrefix(set: OrderedSet<string> | string[], prefix: string) {\n\treturn set.some((style: string) => style.startsWith(prefix))\n}\n\nfunction getEditorText(editor: EditorState) {\n\treturn editor.getCurrentContent().getPlainText()\n}\n\nexport function getEditorWithUpdatedText(editorState: EditorState, text: string) {\n\tconst content = editorState.getCurrentContent()\n\tconst block = content.getFirstBlock()\n\tconst blockLength = block.getLength()\n\n\tlet style: DraftInlineStyle | undefined\n\tif (blockLength > 0) {\n\t\tstyle = block.getInlineStyleAt(blockLength - 1)\n\t}\n\n\treturn EditorState.createWithContent(Modifier.replaceText(content, getEditorFullSelection(editorState), text, style))\n}\n\nexport function getPatchedEditor(from: EditorState, to: EditorState, reference: EditorState): EditorState {\n\tif (getEditorText(from) !== getEditorText(to) && getEditorText(from) === getEditorText(reference)) {\n\t\treturn getEditorWithUpdatedText(reference, getEditorText(to))\n\t}\n\n\tconst fromStyles: string[] = []\n\tif (from) {\n\t\tconst content = from.getCurrentContent()\n\t\tconst styles = content.getFirstBlock().getInlineStyleAt(0)\n\t\tstyles.forEach(s => {\n\t\t\tif (s) fromStyles.push(s)\n\t\t})\n\t}\n\n\tconst toStyles: string[] = []\n\tif (to) {\n\t\tconst content = to.getCurrentContent()\n\t\tconst styles = content.getFirstBlock().getInlineStyleAt(0)\n\t\tstyles.forEach(s => {\n\t\t\tif (s) toStyles.push(s)\n\t\t})\n\t}\n\n\tconst referenceStyles: string[] = []\n\tif (reference) {\n\t\tconst content = reference.getCurrentContent()\n\t\tconst styles = content.getFirstBlock().getInlineStyleAt(0)\n\t\tstyles.forEach(s => {\n\t\t\tif (s) referenceStyles.push(s)\n\t\t})\n\t}\n\n\ttoStyles.forEach(style => {\n\t\tif (style === \"SELECTED\") return\n\t\tif (fromStyles.indexOf(style) >= 0) return\n\t\t// changed\n\t\tlet colon = style.indexOf(\":\")\n\t\tif (colon < 0) {\n\t\t\tcolon = style.length\n\t\t}\n\n\t\tconst key = style.slice(0, colon)\n\t\tconst fromStyle = fromStyles.find(s => s.startsWith(key))\n\t\tconst referenceStyle = referenceStyles.find(s => s.startsWith(key))\n\t\tif (fromStyle === referenceStyle) {\n\t\t\tconst value = style.slice(colon)\n\t\t\treference = getUpdatedEditorWithStyle(reference, referenceStyles, key, value, false)\n\t\t}\n\t})\n\n\tconst singleStyles = singleTextStyle\n\tsingleStyles.forEach(style => {\n\t\tif (fromStyles.indexOf(style) < 0) return\n\t\tif (referenceStyles.indexOf(style) < 0) return\n\t\tif (toStyles.indexOf(style) >= 0) return\n\t\treference = getUpdatedEditorWithToggledStyle(reference, referenceStyles, style, false)\n\t})\n\n\t// Clear the styles removed from the primary component\n\tconst additiveStyles = additiveTextStyle\n\tadditiveStyles.forEach(style => {\n\t\tif (!hasStylePrefix(fromStyles, style)) return\n\t\tif (!hasStylePrefix(referenceStyles, style)) return\n\t\tif (hasStylePrefix(toStyles, style)) return\n\t\treference = getUpdatedEditorWithStyle(reference, referenceStyles, style, undefined, false)\n\t})\n\treturn reference\n}\n\nfunction getEditorFullSelection(editorState: EditorState): SelectionState {\n\tconst contentState = editorState.getCurrentContent()\n\treturn new SelectionState({\n\t\tanchorKey: contentState.getFirstBlock().getKey(),\n\t\tanchorOffset: 0,\n\t\tfocusKey: contentState.getLastBlock().getKey(),\n\t\tfocusOffset: contentState.getLastBlock().getLength(),\n\t})\n}\n\nexport function getUpdatedEditorWithStyle(\n\teditorState: EditorState,\n\tcurrentStyles: string[],\n\tprefix: string,\n\tstyle: string | undefined,\n\tuserSelection: boolean,\n): EditorState {\n\tconst prefixedStyle = `${prefix}${style}`\n\tlet contentState = editorState.getCurrentContent()\n\tconst editorSelection = editorState.getSelection()\n\tconst selection = userSelection ? editorSelection : getEditorFullSelection(editorState)\n\n\tlet styleOverride: DraftInlineStyle | undefined\n\tif (selection.isCollapsed()) {\n\t\tstyleOverride = OrderedSet(\n\t\t\tcurrentStyles.filter(currentStyle => {\n\t\t\t\treturn currentStyle !== undefined && !currentStyle.startsWith(prefix)\n\t\t\t}),\n\t\t)\n\n\t\t// clear the current style if the style is set to undefined\n\t\tstyleOverride = style === undefined ? styleOverride.clear() : styleOverride.add(prefixedStyle)\n\t} else {\n\t\tcurrentStyles.forEach(currentStyle => {\n\t\t\tif (currentStyle && currentStyle.startsWith(prefix)) {\n\t\t\t\tcontentState = Modifier.removeInlineStyle(contentState, selection, currentStyle)\n\t\t\t}\n\t\t})\n\n\t\t// If the value of the style is undefined, we clear the style by only removing the current style and not applying new style,\n\t\t// since keeping `[prefix]:undefined` won't be valuable.\n\t\t// This could happen e.g. when text transform is set to \"none\".\n\t\tif (style !== undefined) {\n\t\t\tcontentState = Modifier.applyInlineStyle(contentState, selection, prefixedStyle)\n\t\t}\n\t}\n\n\treturn getUpdatedEditorAfterStyling(editorState, contentState, editorSelection, styleOverride)\n}\n\nexport function getUpdatedEditorWithToggledStyle(\n\teditorState: EditorState,\n\tstyles: string[],\n\tstyle: string,\n\tuserSelection: boolean,\n): EditorState {\n\tconst currentStyle = OrderedSet<string>(styles)\n\tlet contentState = editorState.getCurrentContent()\n\tconst editorSelection = editorState.getSelection()\n\tconst selection = userSelection ? editorSelection : getEditorFullSelection(editorState)\n\n\tlet styleOverride: DraftInlineStyle | undefined\n\tif (selection.isCollapsed()) {\n\t\tif (currentStyle.includes(style)) {\n\t\t\tstyleOverride = currentStyle.remove(style)\n\t\t} else {\n\t\t\tstyleOverride = currentStyle.add(style)\n\t\t}\n\t} else {\n\t\tif (currentStyle.includes(style)) {\n\t\t\tcontentState = Modifier.removeInlineStyle(contentState, selection, style)\n\t\t} else {\n\t\t\tcontentState = Modifier.applyInlineStyle(contentState, selection, style)\n\t\t}\n\t}\n\n\treturn getUpdatedEditorAfterStyling(editorState, contentState, editorSelection, styleOverride)\n}\n\nfunction getUpdatedEditorAfterStyling(\n\teditorState: EditorState,\n\tcontentState: ContentState,\n\tselection: SelectionState,\n\tstyleOverride?: DraftInlineStyle,\n): EditorState {\n\tlet newEditorState = EditorState.push(editorState, contentState, \"change-inline-style\")\n\tnewEditorState = EditorState.acceptSelection(newEditorState, selection)\n\tif (styleOverride !== undefined) {\n\t\tnewEditorState = EditorState.setInlineStyleOverride(newEditorState, styleOverride)\n\t}\n\treturn newEditorState\n}\n\nfunction getBlockTextDirection(block: ContentBlock): TextDirection {\n\treturn block.getData().get(\"direction\")\n}\n\nfunction setBlockTextDirection(block: ContentBlock, direction: TextDirection): ContentBlock {\n\tconst data =\n\t\tdirection === undefined ? block.getData().remove(\"direction\") : block.getData().set(\"direction\", direction)\n\treturn block.merge({ data }) as ContentBlock\n}\n\n/**\n * Provides an opportunity to update the styles for the entire text or just the\n * current selection (via `userSelection`) for the style prefix provided.\n *\n * The callback should return either a new value or the original if it should be\n * unchanged. Returning `undefined` will remove the style entirely.\n */\nexport function getEditorWithAdjustedStyle(\n\teditorState: EditorState,\n\tstyles: string[],\n\tprefix: string,\n\tupdateValue: (current?: string) => string | undefined,\n\tuserSelection = false,\n): EditorState {\n\tconst currentSelection = editorState.getSelection()\n\tlet newContentState = editorState.getCurrentContent()\n\n\t// Special case\n\tif (userSelection && currentSelection.isCollapsed()) {\n\t\tconst currentStyle = styles.find((style: string) => style.startsWith(prefix))\n\t\tlet currentValue: string | undefined = undefined\n\t\tif (currentStyle !== undefined) {\n\t\t\tcurrentValue = currentStyle.slice(prefix.length)\n\t\t}\n\t\tconst newValue = updateValue(currentValue)\n\t\treturn getUpdatedEditorWithStyle(editorState, styles, prefix, newValue, true)\n\t}\n\n\tconst content = editorState.getCurrentContent()\n\tlet inSelection = false\n\n\tcontent.getBlocksAsArray().forEach(contentBlock => {\n\t\t// Filtering on selection (if needed)\n\t\tlet minStartIndex = NaN\n\t\tlet maxEndIndex = NaN\n\t\tif (userSelection) {\n\t\t\tif (!inSelection) {\n\t\t\t\tif (contentBlock.getKey() === currentSelection.getStartKey()) {\n\t\t\t\t\tinSelection = true\n\t\t\t\t\tminStartIndex = currentSelection.getStartOffset()\n\t\t\t\t} else {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (inSelection) {\n\t\t\t\t// Not an \u201Celse\u201D, can happen immediately\n\t\t\t\tif (contentBlock.getKey() === currentSelection.getEndKey()) {\n\t\t\t\t\tmaxEndIndex = currentSelection.getEndOffset()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlet foundStyle: string | undefined\n\t\tcontentBlock.findStyleRanges(\n\t\t\tcharacterMetaData => {\n\t\t\t\t// const styles = characterMetaData.getStyle()\n\t\t\t\tfoundStyle = undefined\n\t\t\t\tcharacterMetaData.getStyle().forEach((style: string) => {\n\t\t\t\t\tif (style.startsWith(prefix)) {\n\t\t\t\t\t\tfoundStyle = style\n\t\t\t\t\t\treturn false // Stops forEach iteration\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\treturn true\n\t\t\t},\n\t\t\t(startIndex: number, endIndex: number) => {\n\t\t\t\tif (!Number.isNaN(minStartIndex)) {\n\t\t\t\t\tif (minStartIndex > endIndex) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstartIndex = Math.max(minStartIndex, startIndex)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!Number.isNaN(maxEndIndex)) {\n\t\t\t\t\tif (startIndex > maxEndIndex) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t} else {\n\t\t\t\t\t\tendIndex = Math.min(maxEndIndex, endIndex)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst selection = new SelectionState({\n\t\t\t\t\tanchorKey: contentBlock.getKey(),\n\t\t\t\t\tanchorOffset: startIndex,\n\t\t\t\t\tfocusKey: contentBlock.getKey(),\n\t\t\t\t\tfocusOffset: endIndex,\n\t\t\t\t})\n\n\t\t\t\tlet currentValue: undefined | string\n\n\t\t\t\tif (foundStyle !== undefined) {\n\t\t\t\t\t// Remove old style, if used\n\t\t\t\t\tnewContentState = Modifier.removeInlineStyle(newContentState, selection, foundStyle)\n\t\t\t\t\tcurrentValue = foundStyle.slice(prefix.length)\n\t\t\t\t}\n\n\t\t\t\tconst newValue = updateValue(currentValue)\n\t\t\t\tif (newValue !== undefined) {\n\t\t\t\t\t// Add new style\n\t\t\t\t\tnewContentState = Modifier.applyInlineStyle(newContentState, selection, `${prefix}${newValue}`)\n\t\t\t\t}\n\t\t\t},\n\t\t)\n\n\t\tif (!Number.isNaN(maxEndIndex)) {\n\t\t\tinSelection = false\n\t\t}\n\t})\n\n\tlet newEditorState = EditorState.push(editorState, newContentState, \"change-inline-style\")\n\tnewEditorState = EditorState.acceptSelection(newEditorState, currentSelection)\n\treturn newEditorState\n}\n\n// Matches BidiDirection type from https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/unicode/UnicodeBidiDirection.js\ntype BidiDirection = \"LTR\" | \"RTL\" | \"NEUTRAL\"\n\nfunction bidiDirectionToTextDirection(direction?: BidiDirection): TextDirection {\n\tif (direction === \"LTR\") return \"ltr\"\n\tif (direction === \"RTL\") return \"rtl\"\n\treturn undefined\n}\n\nexport function ensureBlockBidiData(\n\tcontentState: ContentState,\n\tdirectionMap: Map<string, BidiDirection>,\n): ContentState {\n\tlet updatedBlocks = Map<string, ContentBlock>()\n\n\tcontentState.getBlockMap().forEach((block: ContentBlock, key: string) => {\n\t\tconst direction = bidiDirectionToTextDirection(directionMap.get(key))\n\t\tif (getBlockTextDirection(block) !== direction) {\n\t\t\tupdatedBlocks = updatedBlocks.set(key, setBlockTextDirection(block, direction))\n\t\t}\n\t})\n\n\tif (updatedBlocks.count() > 0) {\n\t\treturn contentState.merge({ blockMap: contentState.getBlockMap().merge(updatedBlocks) }) as ContentState\n\t} else {\n\t\treturn contentState\n\t}\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { DEFAULT_ROOT_FONT_SIZE } from \"document/models/CanvasTree/traits/WithRootFontSize.ts\"\nimport { type FontSize, isFontSize } from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport { isEqual } from \"library/index.ts\"\nimport type { Node as ProseMirrorNode } from \"prosemirror-model\"\nimport type { EditorState, Transaction } from \"prosemirror-state\"\nimport type { FramerProseMirrorSchema } from \"prosemirror/schema/index.ts\"\nimport { isInlineStylesMark } from \"prosemirror/schema/inlineStyles.ts\"\nimport { isListItemNode } from \"prosemirror/schema/list.ts\"\nimport { isProseMirrorTextNode } from \"prosemirror/schema/text.ts\"\nimport { isTextBlockNode } from \"prosemirror/schema/textBlock.ts\"\nimport type { TextStylePreset } from \"prosemirror/schema/utils.ts\"\nimport { resetStylePreset } from \"prosemirror/schema/utils.ts\"\nimport type { Mutable } from \"utils/Mutable.ts\"\nimport { isArray, isNumber, isObject, isString } from \"utils/typeChecks.ts\"\nimport { type AnyStyles, type BackgroundStyles, BlockStyles, InlineStyles } from \"./styles.ts\"\n\ninterface WithBlockStyles {\n\tblockStyles: BlockStyles\n}\n\nfunction withBlockStyles(attrs: unknown): attrs is WithBlockStyles {\n\treturn isObject(attrs) && \"blockStyles\" in attrs\n}\n\ninterface WithInlineStyles {\n\tinlineStyles: InlineStyles\n}\n\nfunction withInlineStyles(attrs: unknown): attrs is WithInlineStyles {\n\treturn isObject(attrs) && \"inlineStyles\" in attrs\n}\n\ninterface WithTextStylePreset {\n\ttextStylePreset: TextStylePreset\n}\n\nfunction withTextStylePreset(attrs: unknown): attrs is WithTextStylePreset {\n\treturn isObject(attrs) && \"textStylePreset\" in attrs\n}\n\ntype MutableInlineStyles = Mutable<InlineStyles>\ntype MutableBlockStyles = Mutable<BlockStyles>\n\ninterface NodeStyles {\n\tinlineStyles: MutableInlineStyles\n\tblockStyles: MutableBlockStyles\n\ttextStylePreset: TextStylePreset\n}\n\nconst defaultNodeStyles: NodeStyles = {\n\tblockStyles: BlockStyles.defaults,\n\tinlineStyles: InlineStyles.defaults,\n\ttextStylePreset: resetStylePreset,\n}\n\nconst emptyNodeStyles: NodeStyles = {\n\tblockStyles: {},\n\tinlineStyles: {},\n\ttextStylePreset: undefined,\n}\n\ntype FutureNodeStylesMap = Map<ProseMirrorNode, NodeStyles>\n\ntype StyleToValueCountMap<S extends AnyStyles> = {\n\t[Key in keyof S]: Map<S[Key] | undefined, number>\n}\n\nfunction getCurrentStyles(parentStyles: NodeStyles, node: ProseMirrorNode) {\n\tlet resultStyles = { ...parentStyles }\n\n\tif (withTextStylePreset(node.attrs)) {\n\t\tif (isString(node.attrs.textStylePreset)) {\n\t\t\tresultStyles = { ...emptyNodeStyles }\n\t\t} else if (node.attrs.textStylePreset === resetStylePreset) {\n\t\t\tresultStyles = { ...defaultNodeStyles }\n\t\t}\n\t}\n\n\tif (withTextStylePreset(node.attrs) && node.attrs.textStylePreset) {\n\t\tresultStyles.textStylePreset = node.attrs.textStylePreset\n\t}\n\n\tconst hasPreset = isString(resultStyles.textStylePreset)\n\n\t// TextNodes support styles with the InlineStylesMark.\n\tif (isProseMirrorTextNode(node)) {\n\t\tconst inlineStylesMark = node.marks.find(isInlineStylesMark)\n\t\tif (inlineStylesMark) {\n\t\t\tif (hasPreset) {\n\t\t\t\tresultStyles.inlineStyles = {\n\t\t\t\t\t...resultStyles.inlineStyles,\n\t\t\t\t\ttextColor: inlineStylesMark.attrs.inlineStyles.textColor,\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tresultStyles.inlineStyles = { ...resultStyles.inlineStyles, ...inlineStylesMark.attrs.inlineStyles }\n\t\t\t}\n\t\t}\n\t}\n\n\t// Other nodes like TextBlockNode or ListItemNodes support styles in their attributes.\n\tif (withBlockStyles(node.attrs)) {\n\t\tif (hasPreset) {\n\t\t\tresultStyles.blockStyles = { ...resultStyles.blockStyles }\n\n\t\t\tif (node.attrs.blockStyles.textAlignment) {\n\t\t\t\tresultStyles.blockStyles.textAlignment = node.attrs.blockStyles.textAlignment\n\t\t\t}\n\t\t} else {\n\t\t\tresultStyles.blockStyles = { ...resultStyles.blockStyles, ...node.attrs.blockStyles }\n\t\t}\n\t}\n\n\tif (withInlineStyles(node.attrs)) {\n\t\tif (hasPreset) {\n\t\t\tresultStyles.inlineStyles = { ...resultStyles.inlineStyles }\n\n\t\t\tif (node.attrs.inlineStyles.textColor) {\n\t\t\t\tresultStyles.inlineStyles.textColor = node.attrs.inlineStyles.textColor\n\t\t\t}\n\t\t} else {\n\t\t\tresultStyles.inlineStyles = { ...resultStyles.inlineStyles, ...node.attrs.inlineStyles }\n\t\t}\n\t}\n\n\treturn resultStyles\n}\n\n/**\n * We use this function to create a stable reference for non-primitive style\n * values, which we use as a key in the style count map.\n */\nfunction getStableValue<V>(stableValueReferences: unknown[], value: V): V {\n\tif (isArray(value) || isObject(value)) {\n\t\tconst found = stableValueReferences.find(v => isEqual(v, value))\n\t\tif (found) return found as V\n\n\t\tstableValueReferences.push(value)\n\t}\n\n\treturn value\n}\n\ninterface CountStyleOptions<V> {\n\tstableValuesReferences: unknown[]\n\tfutureChildValue: V\n\tcurrentResultValue: V\n\tvalueCountMap: Map<unknown, number>\n\tchildNodeSize: number\n\tonChange(newValue: V): void\n}\n\nfunction countStyle<V>({\n\tstableValuesReferences,\n\tfutureChildValue,\n\tcurrentResultValue,\n\tvalueCountMap,\n\tchildNodeSize,\n\tonChange,\n}: CountStyleOptions<V>) {\n\t// Increase the count of the each style value to keep track of total\n\t// occurrences per value.\n\tconst stableStyleValue = getStableValue(stableValuesReferences, futureChildValue)\n\n\tconst newCount = (valueCountMap.get(stableStyleValue) ?? 0) + childNodeSize\n\tvalueCountMap.set(stableStyleValue, newCount)\n\n\t// Update the resulting styles with the most common style value based on\n\t// the above counts.\n\tif ((valueCountMap.get(currentResultValue) ?? 0) < newCount) {\n\t\tonChange(stableStyleValue)\n\t}\n}\n\nfunction getFutureStyles(node: ProseMirrorNode, futureStylesMap: FutureNodeStylesMap): NodeStyles | undefined {\n\tif (node.childCount === 0) return undefined\n\n\t// List items should have the style of the first character (TextNode).\n\tif (isListItemNode(node)) {\n\t\t// First TextBlockNode in ListItemNode\n\t\tif (node.firstChild) {\n\t\t\tlet futureStyles: NodeStyles | undefined\n\n\t\t\t// First TextNode in TextBlockNode\n\t\t\tif (node.firstChild.firstChild) {\n\t\t\t\tfutureStyles = futureStylesMap.get(node.firstChild.firstChild)\n\t\t\t} else {\n\t\t\t\tfutureStyles = futureStylesMap.get(node.firstChild)\n\t\t\t}\n\n\t\t\tif (futureStyles && futureStyles.inlineStyles.textDecoration !== \"none\") {\n\t\t\t\t// We can't hoist textDecoration.\n\t\t\t\tfutureStyles = {\n\t\t\t\t\t...futureStyles,\n\t\t\t\t\tinlineStyles: {\n\t\t\t\t\t\t...futureStyles.inlineStyles,\n\t\t\t\t\t\ttextDecoration: \"none\",\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn futureStyles\n\t\t}\n\n\t\t// According to the schema ListItemNode should always contain a\n\t\t// TextBlockNode as their first child. Let's be permissive and not throw\n\t\t// an error and use the old styles instead.\n\t\treturn undefined\n\t}\n\n\tconst inlineAggregator = createStyleAggregator(InlineStyles.defaults)\n\tconst blockAggregator = createStyleAggregator(BlockStyles.defaults)\n\tconst textStylePresetAggregator = createStyleAggregator<WithTextStylePreset>({ textStylePreset: undefined })\n\n\tnode.forEach(child => {\n\t\tconst futureChildStyles = futureStylesMap.get(child)\n\t\tassert(futureChildStyles, \"Styles for descendants should be computed first\")\n\n\t\tinlineAggregator.aggregateStyle(futureChildStyles.inlineStyles, child)\n\t\tblockAggregator.aggregateStyle(futureChildStyles.blockStyles, child)\n\t\ttextStylePresetAggregator.aggregateStyle({ textStylePreset: futureChildStyles.textStylePreset }, child)\n\t})\n\n\t// Hoisting textDecoration can only be done if the whole text contains the same textDecoration.\n\tif (inlineAggregator.styleCounts.textDecoration && inlineAggregator.styleCounts.textDecoration.size > 1) {\n\t\tinlineAggregator.resultStyles.textDecoration = \"none\"\n\t}\n\n\tif (isTextBlockNode(node) && inlineAggregator.styleCounts.fontSize) {\n\t\tconst fontSizes = [...inlineAggregator.styleCounts.fontSize.keys()]\n\t\tconst tupleFontSizes: FontSize[] = []\n\n\t\tfor (const fontSize of fontSizes) {\n\t\t\tif (isFontSize(fontSize)) {\n\t\t\t\ttupleFontSizes.push(fontSize)\n\t\t\t} else if (isNumber(fontSize)) {\n\t\t\t\ttupleFontSizes.push([fontSize, \"px\"])\n\t\t\t}\n\t\t}\n\n\t\tif (tupleFontSizes.length > 0 && tupleFontSizes.length === fontSizes.length) {\n\t\t\t// We need to override the hoisted font-size. Because in HTML\n\t\t\t// line-height is only additive and the minimum line-height is dictated\n\t\t\t// by the calculated line-height of the nearest block level ancestor.\n\t\t\t// For that reason we always want to hoist the smallest font-size.\n\t\t\tinlineAggregator.resultStyles.fontSize = getMinimumFontSize(tupleFontSizes)\n\t\t} else if (fontSizes.length > 1) {\n\t\t\t// We set the font-size to 0 if there are variable references and\n\t\t\t// multiple font-sizes. This avoids line-height issues as rendering with\n\t\t\t// variable font-sizes is not deterministic. We don't have this concern\n\t\t\t// if there is only one font-size as it would apply to the text-block as\n\t\t\t// a whole.\n\t\t\tinlineAggregator.resultStyles.fontSize = [0, \"px\"]\n\t\t}\n\t}\n\n\t// Inside text styles presets we can only hoist the styles if all elements\n\t// in the block have an override for that style because we don't know the\n\t// actual value used by the preset for elements without overrides.\n\tif (withTextStylePreset(node.attrs) && isString(node.attrs.textStylePreset)) {\n\t\tfor (const _key in blockAggregator.styleCounts) {\n\t\t\tconst key = _key as keyof typeof blockAggregator.styleCounts\n\t\t\tconst valueCountMap = blockAggregator.styleCounts[key]\n\t\t\tif (valueCountMap.has(undefined)) {\n\t\t\t\tdelete blockAggregator.resultStyles[key]\n\t\t\t}\n\t\t}\n\n\t\tfor (const _key in inlineAggregator.styleCounts) {\n\t\t\tconst key = _key as keyof typeof inlineAggregator.styleCounts\n\t\t\tconst valueCountMap = inlineAggregator.styleCounts[key]\n\t\t\tif (valueCountMap.has(undefined)) {\n\t\t\t\tdelete inlineAggregator.resultStyles[key]\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\tinlineStyles: inlineAggregator.resultStyles,\n\t\tblockStyles: blockAggregator.resultStyles,\n\t\ttextStylePreset: textStylePresetAggregator.resultStyles.textStylePreset,\n\t}\n}\n\ntype AggregatableStyles = InlineStyles | BackgroundStyles | BlockStyles | WithTextStylePreset\ntype StyleAggregatorFn<T extends AggregatableStyles> = (\n\tfutureChildStyles: Mutable<T>,\n\tchildNode: ProseMirrorNode,\n) => void\n\nfunction createStyleAggregator<T extends AggregatableStyles>(\n\tstyleDefaults: Required<T>,\n): { resultStyles: Mutable<T>; styleCounts: StyleToValueCountMap<Required<T>>; aggregateStyle: StyleAggregatorFn<T> } {\n\tconst styleCounts = {} as StyleToValueCountMap<Required<T>>\n\tconst resultStyles = {} as Mutable<T>\n\t// We use the style values as a key in a map and need a stable reference to\n\t// count them properly.\n\tconst stableValuesReferences: unknown[] = []\n\n\tfor (const _key in styleDefaults) {\n\t\tconst key = _key as keyof typeof styleDefaults\n\t\tstyleCounts[key] = new Map()\n\t}\n\n\treturn {\n\t\tstyleCounts,\n\t\tresultStyles,\n\t\taggregateStyle: (futureChildStyles: Mutable<T>, childNode: ProseMirrorNode) => {\n\t\t\tfor (const _key in styleDefaults) {\n\t\t\t\tconst key = _key as keyof typeof styleDefaults\n\t\t\t\tcountStyle<T[typeof key]>({\n\t\t\t\t\tstableValuesReferences,\n\t\t\t\t\tfutureChildValue: futureChildStyles[key],\n\t\t\t\t\tcurrentResultValue: resultStyles[key],\n\t\t\t\t\tvalueCountMap: styleCounts[key],\n\t\t\t\t\tchildNodeSize: childNode.nodeSize,\n\t\t\t\t\tonChange(newValue) {\n\t\t\t\t\t\tresultStyles[key] = newValue\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t}\n}\n\nexport function getMinimumFontSize(fontSizes: FontSize[]): FontSize {\n\tconst [firstFontSize, ...restFontSizes] = fontSizes\n\tassert(isFontSize(firstFontSize), \"Array should have at least one element\")\n\n\t// We must also be able to compare px font size and rem font size somehow,\n\t// so we multiply by the default root font size.\n\n\t// Root font size would make it more accurate, but since these are ProseMirror nodes, it's not\n\t// as easy to get as a Vekter node.\n\treturn restFontSizes.reduce((acc, [curSize, curUnit]) => {\n\t\tconst [accSize, accUnit] = acc\n\t\tconst curSizeToCompare = curUnit === \"px\" ? curSize : curSize * DEFAULT_ROOT_FONT_SIZE\n\t\tconst accSizeToCompare = accUnit === \"px\" ? accSize : accSize * DEFAULT_ROOT_FONT_SIZE\n\t\tif (curSizeToCompare < accSizeToCompare) {\n\t\t\treturn [curSize, curUnit]\n\t\t}\n\t\treturn acc\n\t}, firstFontSize)\n}\n\nfunction updateStyles(\n\ttransaction: Transaction,\n\tnode: ProseMirrorNode,\n\tschema: FramerProseMirrorSchema & FramerProseMirrorSchema.WithStyles,\n\tfutureStyles: NodeStyles,\n\tposition: number,\n) {\n\tconst { inlineStyles, blockStyles, textStylePreset } = futureStyles\n\n\t// TextNodes support styles with the InlineStylesMark.\n\tif (isProseMirrorTextNode(node)) {\n\t\tconst inlineStylesMark = node.marks.find(isInlineStylesMark)\n\n\t\tif (!inlineStylesMark || !isEqual(inlineStylesMark.attrs.inlineStyles, inlineStyles)) {\n\t\t\ttransaction.addMark(\n\t\t\t\tposition,\n\t\t\t\tposition + node.nodeSize,\n\t\t\t\tschema.marks.inlineStyles.create({\n\t\t\t\t\tinlineStyles,\n\t\t\t\t}),\n\t\t\t)\n\t\t}\n\n\t\treturn\n\t}\n\n\t// Other nodes like TextBlockNode or ListItemNode support styles in their attributes.\n\tconst attrs = isObject(node.attrs) ? { ...node.attrs } : {}\n\tlet hasChanged = false\n\n\tif (withBlockStyles(attrs) && !isEqual(attrs.blockStyles, blockStyles)) {\n\t\thasChanged = true\n\t\tattrs.blockStyles = blockStyles\n\t}\n\n\tif (withInlineStyles(attrs) && !isEqual(attrs.inlineStyles, inlineStyles)) {\n\t\thasChanged = true\n\t\tattrs.inlineStyles = inlineStyles\n\t}\n\n\tif (withTextStylePreset(attrs) && attrs.textStylePreset !== textStylePreset) {\n\t\thasChanged = true\n\t\tattrs.textStylePreset = textStylePreset\n\t}\n\n\tif (hasChanged) {\n\t\ttransaction.setNodeMarkup(position, undefined, attrs)\n\t}\n}\n\nfunction traverseNodes(\n\ttransaction: Transaction,\n\tnode: ProseMirrorNode,\n\tschema: FramerProseMirrorSchema & FramerProseMirrorSchema.WithStyles,\n\tparentStyles: NodeStyles,\n\tfutureStylesMap: FutureNodeStylesMap,\n\tposition: number,\n) {\n\tconst currentStyles = getCurrentStyles(parentStyles, node)\n\n\tnode.forEach((child, offset) => {\n\t\ttraverseNodes(transaction, child, schema, currentStyles, futureStylesMap, position + offset + 1)\n\t})\n\n\tconst futureStyles = getFutureStyles(node, futureStylesMap)\n\tfutureStylesMap.set(node, futureStyles ?? currentStyles)\n\n\tupdateStyles(transaction, node, schema, futureStyles ?? currentStyles, position)\n}\n\n/**\n * This function will traverse the document tree depth first and:\n * 1. Compute the current styles before entering a node similar to how CSS\n *    cascading works.\n * 2. Copy the most common value of each child style to the parent after exiting\n *    a node.\n * 3. Update the nodes to contain all computed styles. We dedupe styles in\n *    serialization.ts so the HTML contains the minimal amount of CSS.\n */\nexport function inflateStyles(\n\tstate: EditorState,\n\tschema: FramerProseMirrorSchema & FramerProseMirrorSchema.WithStyles,\n\ttransaction: Transaction = state.tr,\n) {\n\tconst futureStylesMap: FutureNodeStylesMap = new Map()\n\ttraverseNodes(transaction, state.doc, schema, defaultNodeStyles, futureStylesMap, -1)\n\n\treturn transaction\n}\n", "import { Plugin } from \"prosemirror-state\"\nimport type { EditorView } from \"prosemirror-view\"\nimport { inflateStyles } from \"prosemirror/inflateStyles.ts\"\nimport type { FramerProseMirrorSchema } from \"../schema/index.ts\"\n\nexport function inflateStylesPlugin(schema: FramerProseMirrorSchema & FramerProseMirrorSchema.WithStyles) {\n\tlet view: EditorView | undefined\n\n\treturn new Plugin({\n\t\tview(editorView) {\n\t\t\tview = editorView\n\n\t\t\treturn {\n\t\t\t\tdestroy() {\n\t\t\t\t\tview = undefined\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\n\t\tappendTransaction(_transactions, oldState, newState) {\n\t\t\tif (oldState.doc === newState.doc) return\n\n\t\t\t// If we are in composition we don't want to touch the HTML as it will confuse the browser.\n\t\t\tif (view?.composing) return\n\n\t\t\t// TODO: Only operate on changed nodes.\n\t\t\treturn inflateStyles(newState, schema)\n\t\t},\n\t})\n}\n", "import type { EditorState, Transaction } from \"prosemirror-state\"\nimport { Plugin } from \"prosemirror-state\"\nimport { isListItemNode } from \"prosemirror/schema/list.ts\"\nimport { isTextBlockNode } from \"prosemirror/schema/textBlock.ts\"\n\n/**\n * - Top-level text blocks: preserve \"ltr\" and \"rtl\", change \"inherit\" to \"auto\"\n * - Text blocks inside list items: sets textDirection to \"inherit\"\n */\nexport function updateTextDirection(state: EditorState, transaction?: Transaction): Transaction | undefined {\n\tconst { doc } = state\n\n\tdoc.descendants((node, pos, parent) => {\n\t\tif (!isTextBlockNode(node)) {\n\t\t\t// keep descending into non-text-blocks\n\t\t\treturn true\n\t\t}\n\n\t\tif (parent && isListItemNode(parent)) {\n\t\t\tif (node.attrs.textDirection !== \"inherit\") {\n\t\t\t\ttransaction ??= state.tr\n\t\t\t\ttransaction.setNodeAttribute(pos, \"textDirection\", \"inherit\")\n\t\t\t}\n\t\t} else if (!parent || parent === doc) {\n\t\t\tif (node.attrs.textDirection === \"inherit\") {\n\t\t\t\ttransaction ??= state.tr\n\t\t\t\ttransaction.setNodeAttribute(pos, \"textDirection\", \"auto\")\n\t\t\t}\n\t\t}\n\n\t\treturn false\n\t})\n\n\treturn transaction\n}\n\nexport function textDirectionPlugin() {\n\treturn new Plugin({\n\t\tappendTransaction(_transactions, _oldState, newState) {\n\t\t\treturn updateTextDirection(newState) ?? null\n\t\t},\n\t})\n}\n", "import type { Node as PmNode } from \"prosemirror-model\"\nimport type { Plugin, Transaction } from \"prosemirror-state\"\nimport { EditorState } from \"prosemirror-state\"\nimport { inflateStyles } from \"./inflateStyles.ts\"\nimport { inflateStylesPlugin } from \"./plugins/inflateStylesPlugin.ts\"\nimport { textDirectionPlugin, updateTextDirection } from \"./plugins/textDirectionPlugin.ts\"\nimport { type FramerProseMirrorSchema, schemaSupportsStyles } from \"./schema/index.ts\"\nimport { parseRichText } from \"./serialization/dom.ts\"\n\nexport interface EditorStateConfig {\n\treadonly plugins?: Plugin[]\n}\n\nfunction normalizeEditorState(state: EditorState, schema: FramerProseMirrorSchema): EditorState {\n\tlet transaction: Transaction | undefined\n\n\tif (schemaSupportsStyles(schema)) {\n\t\ttransaction = inflateStyles(state, schema, transaction)\n\t}\n\n\t// Sometimes we create state and immediately serialize it, and our textDirectionPlugin doesn't\n\t// have a chance to fix dir attributes (it works on transactions only). So we apply the\n\t// transformation here directly.\n\ttransaction = updateTextDirection(state, transaction)\n\n\tif (transaction) {\n\t\treturn state.apply(transaction)\n\t}\n\n\treturn state\n}\n\nexport function normalizeProseMirrorDoc(doc: PmNode, schema: FramerProseMirrorSchema): PmNode {\n\tconst state = EditorState.create({ doc, schema })\n\treturn normalizeEditorState(state, schema).doc\n}\n\nexport function createEditorState(\n\thtml: string | PmNode,\n\tschema: FramerProseMirrorSchema,\n\t{ plugins = [] }: EditorStateConfig = {},\n) {\n\tconst doc = typeof html === \"string\" ? parseRichText(html, schema) : html\n\n\tconst defaultPlugins: Plugin[] = [textDirectionPlugin()]\n\n\tif (schemaSupportsStyles(schema)) {\n\t\tdefaultPlugins.unshift(inflateStylesPlugin(schema))\n\t}\n\n\t// Create the editor state.\n\tconst state = EditorState.create({\n\t\tdoc,\n\t\tschema,\n\t\tplugins: plugins.concat(defaultPlugins),\n\t})\n\n\treturn normalizeEditorState(state, schema)\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { isEqual } from \"library/index.ts\"\nimport type { Mark, MarkType, Node as ProseMirrorNode } from \"prosemirror-model\"\nimport type { EditorState, Transaction } from \"prosemirror-state\"\nimport { isProseMirrorTextNode } from \"prosemirror/schema/text.ts\"\nimport { isObject } from \"utils/typeChecks.ts\"\n\ntype NodeWithPosition = [ProseMirrorNode, number]\n\n/**\n * Checks if an instance's rich text structure is compatible with the master's structure,\n * allowing style patches to be applied. This validates that:\n * - Both documents have the same number of nodes\n * - Each node has the same type and text content\n */\nexport function canPatchRichText(masterState: EditorState, instanceState: EditorState): boolean {\n\tconst masterNodes = getNodesWithPosition(masterState.doc)\n\tconst instanceNodes = getNodesWithPosition(instanceState.doc)\n\n\tif (masterNodes.length !== instanceNodes.length) return false\n\n\tfor (const [i, masterNodeWithPosition] of masterNodes.entries()) {\n\t\tconst [masterNode] = masterNodeWithPosition\n\t\tconst instanceNodeWithPosition = instanceNodes[i]\n\t\tassert(instanceNodeWithPosition)\n\t\tconst [instanceNode] = instanceNodeWithPosition\n\n\t\tif (masterNode.type !== instanceNode.type) return false\n\t\tif (masterNode.text !== instanceNode.text) return false\n\t}\n\n\treturn true\n}\n\nexport function patchRichText(masterState: EditorState, futureState: EditorState, instanceState: EditorState) {\n\tif (!canPatchRichText(masterState, instanceState)) return\n\n\tconst masterNodes = getNodesWithPosition(masterState.doc)\n\tconst futureNodes = getNodesWithPosition(futureState.doc)\n\tconst instanceNodes = getNodesWithPosition(instanceState.doc)\n\n\tconst transaction = futureState.tr\n\n\tlet startOffset = 0\n\tlet endOffset = 0\n\n\t// Loop from the start of the document and find the first node that has changed (type or text).\n\t// Patch all the attributes and marks of the unchanged nodes in the meantime.\n\twhile (startOffset < masterNodes.length && startOffset < futureNodes.length) {\n\t\tconst masterNodeWithPosition = masterNodes[startOffset]\n\t\tassert(masterNodeWithPosition)\n\t\tconst [masterNode] = masterNodeWithPosition\n\n\t\tconst futureNodeWithPosition = futureNodes[startOffset]\n\t\tassert(futureNodeWithPosition)\n\t\tconst [futureNode, position] = futureNodeWithPosition\n\n\t\tconst instanceNodeWithPosition = instanceNodes[startOffset]\n\t\tassert(instanceNodeWithPosition)\n\t\tconst [instanceNode] = instanceNodeWithPosition\n\n\t\tif (masterNode.type !== futureNode.type) break\n\t\tif (masterNode.text !== futureNode.text) break\n\n\t\tstartOffset++\n\n\t\tpatchNode(position, masterNode, futureNode, instanceNode, transaction)\n\t}\n\n\t// Do the same from the end of the document.\n\twhile (endOffset + startOffset < masterNodes.length && endOffset + startOffset < futureNodes.length) {\n\t\tconst masterNodeWithPosition = masterNodes[masterNodes.length - 1 - endOffset]\n\t\tassert(masterNodeWithPosition)\n\t\tconst [masterNode] = masterNodeWithPosition\n\n\t\tconst futureNodeWithPosition = futureNodes[futureNodes.length - 1 - endOffset]\n\t\tassert(futureNodeWithPosition)\n\t\tconst [futureNode, position] = futureNodeWithPosition\n\n\t\tconst instanceNodeWithPosition = instanceNodes[instanceNodes.length - 1 - endOffset]\n\t\tassert(instanceNodeWithPosition)\n\t\tconst [instanceNode] = instanceNodeWithPosition\n\n\t\tif (masterNode.type !== futureNode.type) break\n\t\tif (masterNode.text !== futureNode.text) break\n\n\t\tendOffset++\n\n\t\tpatchNode(position, masterNode, futureNode, instanceNode, transaction)\n\t}\n\n\t// If the structure of the updated node hasn't changed we can patch the attrs and marks as well.\n\tif (futureNodes.length === masterNodes.length) {\n\t\tlet hasSameStructure = true\n\n\t\tfor (let i = startOffset; i < futureNodes.length - endOffset; i++) {\n\t\t\tconst masterNodeWithPosition = masterNodes[i]\n\t\t\tassert(masterNodeWithPosition)\n\t\t\tconst [masterNode] = masterNodeWithPosition\n\n\t\t\tconst futureNodeWithPosition = futureNodes[i]\n\t\t\tassert(futureNodeWithPosition)\n\t\t\tconst [futureNode] = futureNodeWithPosition\n\n\t\t\tif (masterNode.type !== futureNode.type) {\n\t\t\t\thasSameStructure = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif (hasSameStructure) {\n\t\t\tfor (let i = startOffset; i < futureNodes.length - endOffset; i++) {\n\t\t\t\tconst masterNodeWithPosition = masterNodes[i]\n\t\t\t\tassert(masterNodeWithPosition)\n\t\t\t\tconst [masterNode] = masterNodeWithPosition\n\n\t\t\t\tconst futureNodeWithPosition = futureNodes[i]\n\t\t\t\tassert(futureNodeWithPosition)\n\t\t\t\tconst [futureNode, position] = futureNodeWithPosition\n\n\t\t\t\tconst instanceNodeWithPosition = instanceNodes[i]\n\t\t\t\tassert(instanceNodeWithPosition)\n\t\t\t\tconst [instanceNode] = instanceNodeWithPosition\n\n\t\t\t\tpatchNode(position, masterNode, futureNode, instanceNode, transaction)\n\t\t\t}\n\t\t}\n\t}\n\n\t// If we have inserted a new node we can try to find a node with the same type before.\n\tif (futureNodes.length > masterNodes.length) {\n\t\tfor (let i = startOffset; i < futureNodes.length - endOffset; i++) {\n\t\t\tconst futureNodeWithPosition = futureNodes[i]\n\t\t\tassert(futureNodeWithPosition)\n\t\t\tconst [futureNode, position] = futureNodeWithPosition\n\n\t\t\tlet masterNode: ProseMirrorNode | undefined\n\t\t\tlet instanceNode: ProseMirrorNode | undefined\n\n\t\t\t// Find a node of the same type in the master document.\n\t\t\tfor (let j = startOffset - 1; j >= 0; j--) {\n\t\t\t\tconst masterNodeWithPosition = masterNodes[j]\n\t\t\t\tassert(masterNodeWithPosition)\n\t\t\t\tconst [currentMasterNode] = masterNodeWithPosition\n\n\t\t\t\tconst instanceNodeWithPosition = instanceNodes[j]\n\t\t\t\tassert(instanceNodeWithPosition)\n\t\t\t\tconst [currentInstanceNode] = instanceNodeWithPosition\n\n\t\t\t\tif (currentMasterNode.type === futureNode.type) {\n\t\t\t\t\tmasterNode = currentMasterNode\n\t\t\t\t\tinstanceNode = currentInstanceNode\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (masterNode && instanceNode) {\n\t\t\t\tpatchNode(position, masterNode, futureNode, instanceNode, transaction)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn futureState.apply(transaction)\n}\n\n/** Returns an array of nodes with their position in the document. */\nfunction getNodesWithPosition(doc: ProseMirrorNode) {\n\tconst nodes: NodeWithPosition[] = []\n\n\tdoc.descendants((node, position) => {\n\t\tnodes.push([node, position])\n\t})\n\n\treturn nodes\n}\n\nfunction patchNode(\n\tposition: number,\n\tmasterNode: ProseMirrorNode,\n\tfutureNode: ProseMirrorNode,\n\tinstanceNode: ProseMirrorNode,\n\ttransaction: Transaction,\n) {\n\tif (\n\t\t!isProseMirrorTextNode(masterNode) &&\n\t\t!isProseMirrorTextNode(futureNode) &&\n\t\t!isProseMirrorTextNode(instanceNode)\n\t) {\n\t\t// Patch the attributes of non-text nodes.\n\t\tconst attrs = patchAttributes(masterNode.attrs, futureNode.attrs, instanceNode.attrs)\n\t\ttransaction.setNodeMarkup(position, undefined, attrs)\n\t}\n\n\tif (isProseMirrorTextNode(masterNode) && isProseMirrorTextNode(futureNode) && isProseMirrorTextNode(instanceNode)) {\n\t\t// Patch the marks of text nodes.\n\t\tif (futureNode.marks.length > 0 || instanceNode.marks.length > 0) {\n\t\t\tconst markTypes = new Set<MarkType>()\n\n\t\t\tconst masterMarks = new Map<MarkType, Mark>()\n\t\t\tfor (const mark of masterNode.marks) {\n\t\t\t\tmasterMarks.set(mark.type, mark)\n\t\t\t}\n\n\t\t\tconst futureMarks = new Map<MarkType, Mark>()\n\t\t\tfor (const mark of futureNode.marks) {\n\t\t\t\tmarkTypes.add(mark.type)\n\t\t\t\tfutureMarks.set(mark.type, mark)\n\t\t\t}\n\n\t\t\tconst instanceMarks = new Map<MarkType, Mark>()\n\t\t\tfor (const mark of instanceNode.marks) {\n\t\t\t\tmarkTypes.add(mark.type)\n\t\t\t\tinstanceMarks.set(mark.type, mark)\n\t\t\t}\n\n\t\t\tfor (const markType of markTypes) {\n\t\t\t\tconst masterMark = masterMarks.get(markType)\n\t\t\t\tconst futureMark = futureMarks.get(markType)\n\t\t\t\tconst instanceMark = instanceMarks.get(markType)\n\n\t\t\t\tconst attrs = patchAttributes(masterMark?.attrs, futureMark?.attrs, instanceMark?.attrs)\n\t\t\t\tif (!attrs) continue\n\n\t\t\t\tconst newMark = markType.create(attrs)\n\t\t\t\ttransaction.addMark(position, position + futureNode.nodeSize, newMark)\n\t\t\t}\n\t\t}\n\t}\n}\n\ntype Attributes = { [key: string]: Attributes } | unknown\n\nfunction patchAttributes(masterAttrs: Attributes, futureAttrs: Attributes, instanceAttrs: Attributes) {\n\tif (isObject(masterAttrs) && isObject(futureAttrs) && isObject(instanceAttrs)) {\n\t\tconst keys = new Set<string>()\n\t\tfor (const key in futureAttrs) keys.add(key)\n\t\tfor (const key in instanceAttrs) keys.add(key)\n\n\t\tconst attrs: Record<string, unknown> = {}\n\t\tfor (const key of keys) {\n\t\t\tconst masterValue = masterAttrs[key]\n\t\t\tconst futureValue = futureAttrs[key]\n\t\t\tconst instanceValue = instanceAttrs[key]\n\n\t\t\tattrs[key] = patchAttributes(masterValue, futureValue, instanceValue)\n\t\t}\n\n\t\treturn attrs\n\t}\n\n\treturn isEqual(masterAttrs, instanceAttrs) ? futureAttrs : instanceAttrs\n}\n", "import { isArray, isObject } from \"utils/typeChecks.ts\"\n\nexport function deepClone<T>(input: T): T {\n\tif (isArray(input)) {\n\t\treturn cloneArray(input)\n\t}\n\tif (isObject(input)) {\n\t\tif (input.constructor !== Object) {\n\t\t\tthrow Error(\"only able to clone object literals\")\n\t\t}\n\t\treturn cloneObject(input)\n\t}\n\treturn input\n}\n\n/** Deep clones plain objects and arrays, preserves class instances by reference (may lead to mutation) */\nexport function deepCloneUnsafe<T>(input: T): T {\n\tif (isArray(input)) {\n\t\treturn input.map(deepCloneUnsafe) as T\n\t}\n\tif (isObject(input)) {\n\t\tif (input.constructor !== Object) {\n\t\t\treturn input // preserve class instances by reference\n\t\t}\n\t\treturn cloneObjectUnsafe(input)\n\t}\n\treturn input\n}\n\nfunction cloneArray<T extends unknown[]>(input: T): T {\n\treturn input.map(deepClone) as T\n}\n\nfunction cloneObject<T extends object>(input: T): T {\n\tconst result: T = {} as T\n\tconst keys = Object.keys(input)\n\tfor (const key of keys) {\n\t\tresult[key] = deepClone(input[key])\n\t}\n\treturn result\n}\n\nfunction cloneObjectUnsafe<T extends object>(input: T): T {\n\tconst result: T = {} as T\n\tconst keys = Object.keys(input) as (keyof T)[]\n\tfor (const key of keys) {\n\t\tresult[key] = deepCloneUnsafe(input[key]) as T[keyof T]\n\t}\n\treturn result\n}\n", "import { assert, unhandledError } from \"@framerjs/shared\"\nimport type { RawDraftContentState } from \"draft-js\"\nimport { ContentState, EditorState, convertFromRaw, convertToRaw } from \"draft-js\"\nimport { fontStore } from \"library/render/fonts/fontStore.ts\"\nimport type { TextProperties } from \"library/render/presentation/Text.tsx\"\nimport {\n\tdraftContentStateToHTML,\n\tdraftStyleDefinitions,\n\tgetDraftContent,\n\tgetDraftContentDefaultEmptyText,\n\tgetDraftRange,\n\tgetDraftRangeFromSelection,\n\tgetDraftStylesWithPrefix,\n\tgetDraftStylesWithPrefixCoverRange,\n\tgetDraftText,\n} from \"text\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator, patchClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { HTMLTextTag } from \"../CanvasTree/traits/WithHTMLTextTag.ts\"\nimport type { WithLinkStyle } from \"../CanvasTree/traits/WithLinkStyle.ts\"\nimport type {\n\tLetterSpacing,\n\tLineHeight,\n\tTextAlignment,\n\tTextDecoration,\n\tTextTransform,\n\tWithTextStyle,\n} from \"../CanvasTree/traits/WithTextStyle.ts\"\nimport type { OpenTypeFontFeatures } from \"../CanvasTree/utils/openType.ts\"\nimport { findValueForTokenCSSVariable } from \"../CanvasTree/utils/tokens.ts\"\nimport {\n\tgetEditorWithAdjustedStyle,\n\tgetEditorWithUpdatedText,\n\tgetUpdatedEditorWithStyle,\n\tgetUpdatedEditorWithToggledStyle,\n} from \"./DraftEditor.ts\"\nimport { StyledText } from \"./StyledText.ts\"\n\nexport class StyledTextDraft extends StyledText<EditorState> {\n\treadonly __class: ClassDiscriminator\n\tprivate _data: RawDraftContentState\n\tprivate _fontSelectors?: string[] // Cache for getProps\n\tprivate _cachedStyles?: string[] // Cache for styles\n\n\t// Should be private, but the class discriminator is in the way.\n\tconstructor(data: RawDraftContentState, styledText?: EditorState) {\n\t\tsuper()\n\n\t\tthis.__class = ClassDiscriminator.StyledTextDraft\n\t\tthis._data = data\n\t\tif (styledText) {\n\t\t\tthis._styledText = styledText\n\t\t}\n\t}\n\n\t// Convenience constructors\n\n\tstatic defaultEmptyText() {\n\t\tconst data = getDraftContentDefaultEmptyText()\n\t\treturn new StyledTextDraft(data)\n\t}\n\n\tstatic withText(text: string) {\n\t\tconst data = getDraftContent(text, [])\n\t\treturn new StyledTextDraft(data)\n\t}\n\n\tstatic withEditorState(styledText: EditorState) {\n\t\tconst data = StyledTextDraft.getDraftContentData(styledText.getCurrentContent())\n\t\treturn new StyledTextDraft(data, styledText)\n\t}\n\n\tstatic withContentState(content: ContentState) {\n\t\tconst data = StyledTextDraft.getDraftContentData(content)\n\t\treturn new StyledTextDraft(data)\n\t}\n\n\tstatic fromRawData(rawData: RawDraftContentState & { __class?: string }) {\n\t\tconst data = StyledTextDraft.getDraftContentDataFromRaw(rawData)\n\t\treturn new StyledTextDraft(data)\n\t}\n\n\t// static helper methods\n\n\tprivate static getDraftEditorState(rawData: RawDraftContentState) {\n\t\tconst data = convertFromRaw(rawData)\n\t\treturn EditorState.createWithContent(data)\n\t}\n\n\tprivate static getDraftContentData(content: ContentState): RawDraftContentState {\n\t\tconst data = convertToRaw(content)\n\t\tdata.blocks.forEach(block => {\n\t\t\tfor (const key in block.data) {\n\t\t\t\tconst value = block.data[key]\n\t\t\t\t// This is needed to convert items in the `block.data` property (like emptyStyle)\n\t\t\t\tif (typeof value.toJS === \"function\") {\n\t\t\t\t\tblock.data[key] = value.toJS()\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t\treturn data\n\t}\n\n\t// Used in migrateTextNode to migrate from TextNode to RichTextNode\n\tget rawContentState() {\n\t\treturn this._data\n\t}\n\n\tget text() {\n\t\t// When editing multiline text, Draft creates a new content block for\n\t\t// each line, instead of adding a newline character. When we extract\n\t\t// just the text content, we join the blocks with a newline once again\n\t\t// to restore its original intent. This text representation is used most\n\t\t// commonly in text inputs, where the newlines ensure text is rendered\n\t\t// without splicing together words.\n\t\treturn getDraftText(this._data, \"\\n\")\n\t}\n\n\t/** Returns an editor, creating one if there isn't one yet. This method should only be called when actually editing starts to happen. */\n\tget styledText() {\n\t\tif (!this._styledText) {\n\t\t\tthis._styledText = StyledTextDraft.getDraftEditorState(this._data)\n\t\t}\n\t\treturn this._styledText\n\t}\n\n\tget isFullSelection() {\n\t\tconst contentState = this.styledText.getCurrentContent()\n\t\tconst selection = this.styledText.getSelection()\n\n\t\tconst firstBlock = contentState.getFirstBlock()\n\t\tconst lastBlock = contentState.getLastBlock()\n\n\t\treturn (\n\t\t\tselection.getStartKey() === firstBlock.getKey() &&\n\t\t\tselection.getStartOffset() === 0 &&\n\t\t\tselection.getEndKey() === lastBlock.getKey() &&\n\t\t\tselection.getEndOffset() === lastBlock.getLength()\n\t\t)\n\t}\n\n\tget isCollapsed() {\n\t\tconst selection = this.styledText.getSelection()\n\t\treturn selection.isCollapsed()\n\t}\n\n\tstatic getDraftContentDataFromRaw(data: RawDraftContentState & { __class?: string }): RawDraftContentState {\n\t\treturn {\n\t\t\tblocks: data.blocks.map(block => ({\n\t\t\t\ttext: block.text,\n\t\t\t\ttype: block.type,\n\t\t\t\tkey: block.key,\n\t\t\t\tinlineStyleRanges: block.inlineStyleRanges,\n\t\t\t\tdepth: block.depth,\n\t\t\t\tdata: block.data,\n\t\t\t\tentityRanges: block.entityRanges,\n\t\t\t})),\n\t\t\tentityMap: data.entityMap,\n\t\t}\n\t}\n\n\twithUpdatedText(text: string) {\n\t\treturn StyledTextDraft.withEditorState(getEditorWithUpdatedText(this.styledText, text))\n\t}\n\n\tprotected styledTextToText(text: EditorState) {\n\t\treturn text.getCurrentContent().getPlainText()\n\t}\n\n\ttoJS() {\n\t\treturn { __class: this.__class, ...this._data }\n\t}\n\n\ttoJSON() {\n\t\treturn this.toJS()\n\t}\n\n\t// WithTokenVariables\n\n\tremoveTokenVariables(variables: { [tokenId: string]: string }): StyledText<EditorState> | undefined {\n\t\tconst prevContent = this.styledText.getCurrentContent()\n\n\t\t// NOTE: callback passed to adjustStyle must always return a value\n\t\t// otherwise the style will be removed.\n\t\tconst updated = this.adjustStyle(draftStyleDefinitions.textColor.prefix, current => {\n\t\t\treturn findValueForTokenCSSVariable(current, variables) || current\n\t\t})\n\n\t\t// Return updated only if changed.\n\t\treturn prevContent === updated.styledText.getCurrentContent() ? undefined : updated\n\t}\n\n\tupdateStyledText(styledText: EditorState): StyledTextDraft {\n\t\treturn StyledTextDraft.withEditorState(styledText)\n\t}\n\n\tscaleFontSize(scale: number) {\n\t\treturn this.adjustStyle(draftStyleDefinitions.fontSize.prefix, value => {\n\t\t\tif (value === undefined) {\n\t\t\t\treturn undefined\n\t\t\t}\n\n\t\t\tconst fontSize = draftStyleDefinitions.fontSize.parseValue(value)\n\n\t\t\t// Scale up font size, as naive as humanly possible\n\t\t\tif (typeof fontSize === \"number\") {\n\t\t\t\treturn \"\" + Math.round(fontSize * scale)\n\t\t\t}\n\t\t})\n\t}\n\n\tupdateStyle(prefix: string, style: string | undefined, userSelection: boolean) {\n\t\treturn StyledTextDraft.withEditorState(\n\t\t\tgetUpdatedEditorWithStyle(this.styledText, this.styles(userSelection), prefix, style, userSelection),\n\t\t)\n\t}\n\n\ttoggleStyle(style: string, userSelection: boolean) {\n\t\treturn StyledTextDraft.withEditorState(\n\t\t\tgetUpdatedEditorWithToggledStyle(this.styledText, this.styles(userSelection), style, userSelection),\n\t\t)\n\t}\n\n\tadjustStyle(prefix: string, updateValue: (current?: string) => string | undefined, userSelection: boolean = false) {\n\t\treturn StyledTextDraft.withEditorState(\n\t\t\tgetEditorWithAdjustedStyle(this.styledText, this.styles(userSelection), prefix, updateValue, userSelection),\n\t\t)\n\t}\n\n\tprotected emptyStyledText() {\n\t\treturn this.textToStyledText(\"\")\n\t}\n\n\tprotected textToStyledText(text: string) {\n\t\tconst contentState = ContentState.createFromText(text)\n\t\treturn EditorState.createWithContent(contentState)\n\t}\n\n\tgetFonts(userSelection: boolean) {\n\t\treturn this.getStylesForPrefix(draftStyleDefinitions.font.prefix, userSelection)\n\t}\n\n\tgetTextColors(userSelection: boolean) {\n\t\treturn this.getStylesForPrefix(draftStyleDefinitions.textColor.prefix, userSelection)\n\t}\n\n\tgetFontSizes(userSelection: boolean) {\n\t\treturn this.getStylesForPrefix(draftStyleDefinitions.fontSize.prefix, userSelection).map(value => {\n\t\t\tif (value !== undefined) {\n\t\t\t\treturn draftStyleDefinitions.fontSize.parseValue(value)\n\t\t\t}\n\t\t})\n\t}\n\n\tgetLetterSpacings(userSelection: boolean) {\n\t\treturn this.getStylesForPrefix(draftStyleDefinitions.letterSpacing.prefix, userSelection).map(value => {\n\t\t\tif (value !== undefined) {\n\t\t\t\treturn draftStyleDefinitions.letterSpacing.parseValue(value)\n\t\t\t}\n\t\t})\n\t}\n\n\tgetTextTransforms(userSelection: boolean) {\n\t\treturn this.getStylesForPrefix(draftStyleDefinitions.textTransform.prefix, userSelection).map(value => {\n\t\t\tif (value !== undefined) {\n\t\t\t\treturn draftStyleDefinitions.textTransform.parseValue(value)\n\t\t\t}\n\t\t})\n\t}\n\n\tgetTextDecorations(userSelection: boolean) {\n\t\treturn this.getStylesForPrefix(draftStyleDefinitions.textDecoration.prefix, userSelection).map(value => {\n\t\t\tif (value !== undefined) {\n\t\t\t\treturn draftStyleDefinitions.textDecoration.parseValue(value)\n\t\t\t}\n\t\t})\n\t}\n\n\tgetLinks(userSelection: boolean) {\n\t\treturn this.getStylesForPrefix(\"LINK:\", userSelection)\n\t}\n\n\tgetLineHeight() {\n\t\t// Because line height applies to the whole selection, we can simply take it from any selection\n\t\tconst lineHeight = this.getStylesForPrefix(draftStyleDefinitions.lineHeight.prefix, false)[0]\n\n\t\tif (lineHeight !== undefined) {\n\t\t\treturn draftStyleDefinitions.lineHeight.parseValue(lineHeight)\n\t\t}\n\t}\n\n\tgetTextAlignment() {\n\t\t// Because alignment applies to the whole selection, we can simply take it from any selection\n\t\tconst textAlignment = this.getStylesForPrefix(draftStyleDefinitions.textAlignment.prefix, false)[0]\n\n\t\tif (textAlignment !== undefined) {\n\t\t\treturn draftStyleDefinitions.textAlignment.parseValue(textAlignment)\n\t\t}\n\t}\n\n\tgetOpenTypeFontFeatures(userSelection: boolean) {\n\t\treturn this.getStylesForPrefix(draftStyleDefinitions.openTypeFontFeatures.prefix, userSelection).map(value => {\n\t\t\tif (!isUndefined(value)) {\n\t\t\t\treturn draftStyleDefinitions.openTypeFontFeatures.parseValue(value)\n\t\t\t}\n\t\t})\n\t}\n\n\tsetFont(font: string | undefined, userSelection: boolean) {\n\t\treturn this.updateStyle(draftStyleDefinitions.font.prefix, font, userSelection)\n\t}\n\n\tsetTextColor(textColor: string | undefined, userSelection: boolean) {\n\t\treturn this.updateStyle(draftStyleDefinitions.textColor.prefix, textColor, userSelection)\n\t}\n\n\tsetFontSize(fontSize: number | undefined, userSelection: boolean) {\n\t\tconst value = fontSize !== undefined ? String(fontSize) : undefined\n\t\treturn this.updateStyle(draftStyleDefinitions.fontSize.prefix, value, userSelection)\n\t}\n\n\tsetLetterSpacing(letterSpacing: LetterSpacing | undefined, userSelection: boolean) {\n\t\tconst value = letterSpacing !== undefined ? letterSpacing.join(\"\") : undefined\n\t\treturn this.updateStyle(draftStyleDefinitions.letterSpacing.prefix, value, userSelection)\n\t}\n\n\tsetLink(link: string | undefined, userSelection: boolean) {\n\t\treturn this.updateStyle(\"LINK:\", link, userSelection)\n\t}\n\n\tsetTextTransform(textTransform: TextTransform | undefined, userSelection: boolean) {\n\t\treturn this.updateStyle(draftStyleDefinitions.textTransform.prefix, textTransform, userSelection)\n\t}\n\n\tsetTextDecoration(textDecoration: TextDecoration | undefined, userSelection: boolean) {\n\t\treturn this.updateStyle(draftStyleDefinitions.textDecoration.prefix, textDecoration, userSelection)\n\t}\n\n\tsetLineHeight(lineHeight: LineHeight | undefined) {\n\t\tconst value = lineHeight !== undefined ? lineHeight[0] + lineHeight[1] : undefined\n\t\treturn this.updateStyle(draftStyleDefinitions.lineHeight.prefix, value, false)\n\t}\n\n\tsetTextAlignment(textAlignment: TextAlignment | undefined) {\n\t\treturn this.updateStyle(draftStyleDefinitions.textAlignment.prefix, textAlignment, false)\n\t}\n\n\tsetOpenTypeFontFeatures(\n\t\topenTypeFontFeatures: OpenTypeFontFeatures | undefined,\n\t\tuserSelection: boolean,\n\t): StyledText<EditorState> {\n\t\tconst value = openTypeFontFeatures ? JSON.stringify(openTypeFontFeatures) : undefined\n\t\treturn this.updateStyle(draftStyleDefinitions.openTypeFontFeatures.prefix, value, userSelection)\n\t}\n\n\ttoggleBold(userSelection: boolean) {\n\t\treturn this.toggleStyle(\"BOLD\", userSelection)\n\t}\n\n\ttoggleItalic(userSelection: boolean) {\n\t\treturn this.toggleStyle(\"ITALIC\", userSelection)\n\t}\n\n\t// used by keyboard shortcut only\n\ttoggleUnderline(userSelection: boolean) {\n\t\treturn this.adjustStyle(\n\t\t\tdraftStyleDefinitions.textDecoration.prefix,\n\t\t\t// Clear text decoration if it's already underline\n\t\t\tdecoration => (decoration === \"underline\" ? undefined : \"underline\"),\n\t\t\tuserSelection,\n\t\t)\n\t}\n\n\tprivate styles(currentSelection: boolean) {\n\t\tif (currentSelection) {\n\t\t\treturn this._styles(currentSelection)\n\t\t}\n\n\t\t// If there is no selection, we can safely cache the style calculations\n\t\tif (!this._cachedStyles) {\n\t\t\tthis._cachedStyles = this._styles(currentSelection)\n\t\t}\n\n\t\treturn this._cachedStyles\n\t}\n\n\tprivate _styles(userSelection: boolean) {\n\t\tif (this.text.length === 0) return []\n\n\t\t// Todo: if we are currently editing, this function gets called\n\t\t// multiple time on the same editor instance, re-calculating the\n\t\t// data from the editot state multiple times. This can be a heavy\n\t\t// operation if there is a lot of text. This currently happens\n\t\t// inside the property panel reducer for text while you are typing.\n\t\t// We can maybe cache this per engine frame in the future to make\n\t\t// this a bit cheaper.\n\t\tconst selection = userSelection ? this.styledText.getSelection() : null\n\n\t\t// Get the styles from the editor\n\t\tif (selection && selection.isCollapsed()) {\n\t\t\treturn this.styledText.getCurrentInlineStyle().toArray()\n\t\t}\n\n\t\tconst content = userSelection ? convertToRaw(this.styledText.getCurrentContent()) : this._data\n\n\t\t// Either get the current selection range or use the full text range.\n\t\tconst range: [number, number] = selection\n\t\t\t? (getDraftRangeFromSelection(content, selection) as any)\n\t\t\t: [0, getDraftText(content).length]\n\t\tconst styles = getDraftStylesWithPrefix(content, undefined, range)\n\n\t\t// For text decoration and transform, we see if there were any styles defined and if not we add \"none\".\n\t\tfor (const prefix of [draftStyleDefinitions.textTransform.prefix, draftStyleDefinitions.textDecoration.prefix]) {\n\t\t\tif (!getDraftStylesWithPrefixCoverRange(content, [prefix as any], range)) {\n\t\t\t\tstyles.push(`${prefix}none`)\n\t\t\t}\n\t\t}\n\n\t\treturn styles\n\t}\n\n\t// Returns an array of style values for a prefix.\n\t// It includes undefined as the first element if the range has empty styles.\n\tprivate getStylesForPrefix(prefix: string, userSelection: boolean) {\n\t\tconst styles = new Set<string | undefined>()\n\t\tconst rawContent = this._data\n\n\t\tconst selection = userSelection ? this.styledText.getSelection() : null\n\n\t\tconst range = selection ? getDraftRangeFromSelection(rawContent, selection) : getDraftRange(rawContent)\n\t\tassert(range, \"Can't find selection in raw content state\")\n\n\t\tconst [startPosition, endPosition] = range\n\n\t\t// Get the styles from the editor\n\t\tif (startPosition === endPosition) {\n\t\t\tconst cursorStyles = this.styledText.getCurrentInlineStyle().toArray()\n\t\t\tconst style = cursorStyles.find(value => value.startsWith(prefix))\n\n\t\t\tif (style !== undefined) {\n\t\t\t\tconst value = style.slice(prefix.length)\n\t\t\t\treturn [value]\n\t\t\t}\n\n\t\t\treturn [undefined]\n\t\t}\n\n\t\t// Track if the whole selection has styles, otherwise we add undefined to the result\n\t\tlet continuousStylePosition = startPosition\n\t\tlet nextBlockStartPosition = 0\n\n\t\tfor (const block of rawContent.blocks) {\n\t\t\tconst textLength = block.text.length\n\n\t\t\t// Skip blocks with no text\n\t\t\tif (textLength === 0) continue\n\n\t\t\tconst blockStartPosition = nextBlockStartPosition\n\t\t\tconst blockEndPosition = blockStartPosition + textLength\n\n\t\t\tnextBlockStartPosition += textLength\n\n\t\t\t// Skip blocks before the start position\n\t\t\tif (blockEndPosition <= startPosition) continue\n\n\t\t\t// Stop after the end position\n\t\t\tif (blockStartPosition >= endPosition) break\n\n\t\t\tconst styleRanges = Array.from(block.inlineStyleRanges).sort(\n\t\t\t\t(leftRange, rightRange) => leftRange.offset - rightRange.offset,\n\t\t\t)\n\n\t\t\tfor (const styleRange of styleRanges) {\n\t\t\t\t// Skip styles with different prefix\n\t\t\t\tif (!styleRange.style.startsWith(prefix)) continue\n\n\t\t\t\tconst styleStartPosition = blockStartPosition + styleRange.offset\n\t\t\t\tconst styleEndPosition = styleStartPosition + styleRange.length\n\n\t\t\t\t// Skip styles before the start position\n\t\t\t\tif (styleEndPosition <= startPosition) continue\n\n\t\t\t\t// Skip styles after the end position\n\t\t\t\tif (styleStartPosition >= endPosition) continue\n\n\t\t\t\t// Keep track if the whole text is styled\n\t\t\t\tif (styleStartPosition <= continuousStylePosition && styleEndPosition > continuousStylePosition) {\n\t\t\t\t\tcontinuousStylePosition = styleEndPosition\n\t\t\t\t}\n\n\t\t\t\tconst value = styleRange.style.slice(prefix.length)\n\t\t\t\tstyles.add(value)\n\t\t\t}\n\t\t}\n\n\t\tif (continuousStylePosition < endPosition || styles.size === 0) {\n\t\t\tstyles.add(undefined)\n\t\t}\n\n\t\treturn Array.from(styles).reverse()\n\t}\n\n\t/**\n\t * @param textStyle An object of the default {@link WithTextStyle} from the TextNode\n\t * @param fontsLoadedCallback A callback to invoke if there are changes that could affect this node's dimensions.\n\t * This happens when missing fonts being loaded, and hosts might want to re-calculate the alignment/position according to the new node size\n\t */\n\tpublic getProps(\n\t\ttextStyle: WithTextStyle & WithLinkStyle,\n\t\tlink: string | undefined,\n\t\thtmlTextTag: HTMLTextTag | undefined,\n\t\tfontsLoadedCallback: () => void,\n\t): Partial<TextProperties> {\n\t\t// TODO: Move font loading into TextNode\n\t\tif (\n\t\t\t!this._fontSelectors ||\n\t\t\t(textStyle.font && !this._fontSelectors.includes(textStyle.font)) ||\n\t\t\t(textStyle.linkFont && !this._fontSelectors.includes(textStyle.linkFont)) ||\n\t\t\t(textStyle.linkHoverFont && !this._fontSelectors.includes(textStyle.linkHoverFont)) ||\n\t\t\t(textStyle.linkCurrentFont && !this._fontSelectors.includes(textStyle.linkCurrentFont))\n\t\t) {\n\t\t\tif (textStyle.font) {\n\t\t\t\tconst textStyleFont = textStyle.font\n\t\t\t\tthis._fontSelectors = this.getFonts(false).map(font => font ?? textStyleFont)\n\t\t\t} else {\n\t\t\t\tthis._fontSelectors = []\n\t\t\t}\n\n\t\t\tif (textStyle.linkFont && !this._fontSelectors.includes(textStyle.linkFont)) {\n\t\t\t\tthis._fontSelectors.push(textStyle.linkFont)\n\t\t\t}\n\n\t\t\tif (textStyle.linkHoverFont && !this._fontSelectors.includes(textStyle.linkHoverFont)) {\n\t\t\t\tthis._fontSelectors.push(textStyle.linkHoverFont)\n\t\t\t}\n\n\t\t\tif (textStyle.linkCurrentFont && !this._fontSelectors.includes(textStyle.linkCurrentFont)) {\n\t\t\t\tthis._fontSelectors.push(...textStyle.linkCurrentFont)\n\t\t\t}\n\n\t\t\tfontStore\n\t\t\t\t.loadFonts(this._fontSelectors)\n\t\t\t\t.then(({ newlyLoadedFontCount }) => {\n\t\t\t\t\tif (newlyLoadedFontCount > 0) fontsLoadedCallback()\n\t\t\t\t})\n\t\t\t\t.catch(unhandledError)\n\t\t}\n\n\t\tconst textAlignment = this.getTextAlignment() ?? textStyle.textAlignment\n\n\t\treturn {\n\t\t\talignment: textAlignment !== \"start\" && textAlignment !== \"justify\" ? textAlignment : undefined,\n\t\t\trawHTML: draftContentStateToHTML(this._data, { link, htmlTextTag }),\n\t\t\tfonts: this._fontSelectors,\n\t\t}\n\t}\n}\n\npatchClassDiscriminator(StyledTextDraft, ClassDiscriminator.StyledTextDraft)\n", "import type { TextProperties } from \"library/render/presentation/Text.tsx\"\nimport type { HTMLTextTag } from \"../CanvasTree/traits/WithHTMLTextTag.ts\"\nimport type {\n\tLetterSpacing,\n\tLineHeight,\n\tTextAlignment,\n\tTextDecoration,\n\tTextTransform,\n\tWithTextStyle,\n} from \"../CanvasTree/traits/WithTextStyle.ts\"\nimport type { WithTokenVariables } from \"../CanvasTree/traits/WithTokenVariables.ts\"\nimport type { OpenTypeFontFeatures } from \"../CanvasTree/utils/openType.ts\"\n\ntype Maybe<Type> = Type | undefined\n\nexport abstract class StyledText<T> implements WithTokenVariables<StyledText<T>> {\n\tprivate _text: string | undefined\n\tprotected _styledText: T | undefined\n\n\tconstructor(text?: string | T) {\n\t\tif (typeof text === \"string\") {\n\t\t\tthis._text = text\n\t\t} else if (text !== undefined) {\n\t\t\tthis._styledText = text\n\t\t}\n\t}\n\n\t// Public Properties\n\n\tabstract get text(): string\n\n\tabstract get styledText(): T\n\n\tabstract get isFullSelection(): boolean\n\n\tabstract get isCollapsed(): boolean\n\n\t// WithTokenVariables\n\n\tabstract removeTokenVariables(variables: { [tokenId: string]: string }): StyledText<T> | undefined\n\n\t// Public Abstract Methods\n\n\tabstract withUpdatedText(text: string): StyledText<T>\n\n\tabstract scaleFontSize(height: number): StyledText<T>\n\n\tabstract toJS(): Record<string, any>\n\n\tabstract updateStyledText(styledText: T): StyledText<T>\n\n\tabstract getProps(\n\t\ttextStyle: WithTextStyle,\n\t\tlink: string | undefined,\n\t\thtmlTag: HTMLTextTag | undefined,\n\t\tfontsLoadedCallback: () => void,\n\t): Partial<TextProperties>\n\n\t// Protected Abstract Methods\n\n\tprotected abstract emptyStyledText(): T\n\n\tprotected abstract textToStyledText(text: string): T\n\n\tprotected abstract styledTextToText(styledText: T): string\n\n\t// Font\n\n\tabstract getFonts(userSelection: boolean): Maybe<string>[]\n\tabstract setFont(value: string | undefined, userSelection: boolean): StyledText<T>\n\n\t// Text color\n\n\tabstract getTextColors(userSelection: boolean): Maybe<string>[]\n\tabstract setTextColor(value: string | undefined, userSelection: boolean): StyledText<T>\n\n\t// Font size\n\n\tabstract getFontSizes(userSelection: boolean): Maybe<number>[]\n\tabstract setFontSize(value: number | undefined, userSelection: boolean): StyledText<T>\n\n\t// Letter spacing\n\n\tabstract getLetterSpacings(userSelection: boolean): Maybe<number | LetterSpacing>[]\n\tabstract setLetterSpacing(value: LetterSpacing | undefined, userSelection: boolean): StyledText<T>\n\n\t// Text transform\n\n\tabstract getTextTransforms(userSelection: boolean): Maybe<TextTransform>[]\n\tabstract setTextTransform(value: TextTransform | undefined, userSelection: boolean): StyledText<T>\n\n\t// Text decoration\n\n\tabstract getTextDecorations(userSelection: boolean): Maybe<TextDecoration>[]\n\tabstract setTextDecoration(value: TextDecoration | undefined, userSelection: boolean): StyledText<T>\n\n\t// Line height\n\n\tabstract getLineHeight(): Maybe<LineHeight>\n\tabstract setLineHeight(value: LineHeight | undefined): StyledText<T>\n\n\t// Line height\n\n\tabstract getTextAlignment(): Maybe<TextAlignment>\n\tabstract setTextAlignment(value: TextAlignment | undefined): StyledText<T>\n\n\t// Links\n\n\tabstract getLinks(userSelection: boolean): Maybe<string>[]\n\tabstract setLink(value: string | undefined, userSelection: boolean): StyledText<T>\n\n\t// OpenType features\n\tabstract getOpenTypeFontFeatures(userSelection: boolean): Maybe<OpenTypeFontFeatures>[]\n\tabstract setOpenTypeFontFeatures(value: OpenTypeFontFeatures | undefined, userSelection: boolean): StyledText<T>\n}\n", "import { type ModuleBareIdentifierString, isModuleExportIdentifier, parseModuleIdentifier } from \"@framerjs/shared\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport type { ReducedRecord } from \"./utils/Reduced.ts\"\nimport { reduceProperty } from \"./utils/reduceProperty.ts\"\n\nexport interface WithCodeOverride {\n\tcodeOverrideEnabled: boolean\n\tcodeOverrideIdentifier: string | undefined\n}\n\nexport const codeOverrideDefaults: WithCodeOverride = {\n\tcodeOverrideEnabled: false,\n\tcodeOverrideIdentifier: undefined,\n}\n\nconst key: keyof WithCodeOverride = \"codeOverrideIdentifier\"\n\nexport function withCodeOverride(node: CanvasNode): node is CanvasNode & WithCodeOverride {\n\treturn key in node\n}\n\ninterface HasCodeOverride {\n\tcodeOverrideEnabled: true\n\tcodeOverrideIdentifier: string\n}\n\nexport function hasCodeOverride(node: CanvasNode): node is CanvasNode & HasCodeOverride {\n\treturn withCodeOverride(node) && node.codeOverrideEnabled && isString(node.codeOverrideIdentifier)\n}\n\nexport interface ReducedOverrides extends ReducedRecord<Pick<WithCodeOverride, \"codeOverrideEnabled\">> {\n\tcodeOverrideBareModuleIdentifiers: Set<ModuleBareIdentifierString>\n\tcodeOverrideModuleExportNames: Set<string>\n}\n\nexport function reduceOverride(node: CanvasNode, result: ReducedOverrides) {\n\tif (!withCodeOverride(node)) return\n\n\tif (node.codeOverrideIdentifier && isModuleExportIdentifier(node.codeOverrideIdentifier)) {\n\t\tconst parsed = parseModuleIdentifier(node.codeOverrideIdentifier)\n\n\t\tresult.codeOverrideModuleExportNames.add(parsed.exportSpecifier)\n\t\tresult.codeOverrideBareModuleIdentifiers.add(parsed.bareValue)\n\t}\n\n\treduceProperty(\"codeOverrideEnabled\", result, node)\n}\n", "import type { PluginManifestId } from \"plugins/plugins.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\n\nconst pluginDataPrefix = \"$plugin__\" as const\n\nexport type PluginDataKey = string\nexport type PluginDataPrefix = typeof pluginDataPrefix\nexport type PluginDataIdentifierPrefix = `${PluginDataPrefix}${PluginManifestId}__`\nexport type PrefixedPluginDataKey = `${PluginDataIdentifierPrefix}${PluginDataKey}`\n\nexport type PluginDataValue = string | null\n\nexport interface WithPluginData {\n\t[key: PrefixedPluginDataKey]: PluginDataValue | undefined\n}\n\nexport function isPrefixedPluginDataKey(key: string): key is PrefixedPluginDataKey {\n\treturn key.startsWith(pluginDataPrefix)\n}\n\nexport function getPluginDataIdentifierPrefix(manifestId: PluginManifestId): PluginDataIdentifierPrefix {\n\treturn `${pluginDataPrefix}${manifestId}__`\n}\n\nexport function isPluginDataIdentifierPrefix(\n\tkey: string,\n\tmanifestId: PluginManifestId,\n): key is PluginDataIdentifierPrefix {\n\treturn key.startsWith(getPluginDataIdentifierPrefix(manifestId))\n}\n\nexport function getPrefixedPluginDataKey(manifestId: PluginManifestId, key: PluginDataKey): PrefixedPluginDataKey {\n\treturn `${getPluginDataIdentifierPrefix(manifestId)}${key}`\n}\n\nexport function isPluginDataProperty(node: CanvasNode, key: string): key is PrefixedPluginDataKey {\n\treturn node.supportsPluginData() && isPrefixedPluginDataKey(key)\n}\n", "import type { AnyScopeNode, CanvasNode, FrameNode, MaybeNodeID, NodeID } from \"../index.ts\"\nimport type { IsReplica } from \"./WithTemplate.ts\"\nimport type { GestureType, IsGestureVariant, IsPrimaryVariant, IsTopLevelVariant, IsVariant } from \"./WithVariant.ts\"\n\nconst baseVariantIdKey: keyof WithReplicaVariants = \"baseVariantId\"\n\nexport function withReplicaVariants<T extends CanvasNode | AnyScopeNode>(\n\tnode: T | null | undefined,\n): node is T & WithReplicaVariants {\n\tif (!node) return false\n\treturn baseVariantIdKey in node\n}\n\nexport interface WithReplicaVariants {\n\tbaseVariantId: NodeID\n\tgetPrimaryVariant(): FrameNode & IsPrimaryVariant\n\tgetReplicaVariants(): (FrameNode & IsReplica & IsVariant)[]\n\tgetTopLevelReplicaVariants(): (FrameNode & IsReplica & IsTopLevelVariant)[]\n\tgetTopLevelVariants(): [FrameNode & IsPrimaryVariant, ...(FrameNode & IsReplica & IsTopLevelVariant)[]]\n\tgetVariants(): [FrameNode & IsPrimaryVariant, ...(FrameNode & IsReplica)[]]\n}\n\nexport type GestureVariants = Record<GestureType, MaybeNodeID>\n\nconst getTopLevelVariantForGestureKey: keyof WithGestureVariants = \"getTopLevelVariantForGesture\"\n\nexport function withGestureVariants<T extends CanvasNode>(node: T): node is T & WithGestureVariants {\n\treturn getTopLevelVariantForGestureKey in node\n}\n\nexport interface WithGestureVariants {\n\tgetTopLevelVariantForGesture(gestureNode: CanvasNode & IsGestureVariant): CanvasNode & IsTopLevelVariant\n\tgetGesturesForTopLevelVariant(variantNode: CanvasNode & IsTopLevelVariant): GestureVariants\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { LocalizedTextValue, LocalizedValues } from \"document/models/LocalizedValue.ts\"\nimport type { VariableReference } from \"./VariableReference.ts\"\nimport type { WithParagraphSpacing } from \"./WithParagraphSpacing.ts\"\nimport type { WithTextStyle } from \"./WithTextStyle.ts\"\n\nexport interface WithRichText {\n\thtml: string\n\thtmlLocalized?: LocalizedValues<LocalizedTextValue>\n\thtmlContent: VariableReference | undefined\n\tanchorLinkOffsetY: number | undefined\n}\n\nexport type RichTextVirtualisedProperties =\n\t| keyof Pick<WithRichText, \"htmlContent\">\n\t| keyof WithTextStyle\n\t| keyof WithParagraphSpacing\n\n/**\n * This type is used to define a list of rich text properties that are parsed\n * from the html property and are therefore considered virtualised. Because the\n * process of diffing these virtualised properties (in order to show overrides\n * in the UI) is imperfect due to the complexity of diffing text differences, we\n * fall back to showing the html property as being overridden in the UI if there\n * is a complex difference between primary and replica. So this type\n * encapsulates this behaviour. More here:\n * https://github.com/framer/FramerStudio/pull/16787#discussion_r1506043810\n */\nexport type RichTextVirtualizedPropertyOrHTML = [RichTextVirtualisedProperties, \"html\"]\n\nexport const richTextDefaults: WithRichText = {\n\thtml: \"\",\n\thtmlLocalized: undefined,\n\thtmlContent: undefined,\n\tanchorLinkOffsetY: undefined,\n}\n\nconst htmlKey: keyof WithRichText = \"html\"\n\nexport function withRichText(target: CanvasNode): target is CanvasNode & WithRichText {\n\treturn htmlKey in target\n}\n", "import type { StyledText } from \"document/models/StyledText/StyledText.ts\"\nimport { StyledTextDraft } from \"document/models/StyledText/StyledTextDraft.ts\"\n\nexport interface WithStyledText {\n\tstyledText: StyledText<any>\n\tgetStyledText: () => StyledText<any>\n}\n\nexport const styledTextDefaults: Omit<WithStyledText, \"getStyledText\"> = {\n\tstyledText: StyledTextDraft.defaultEmptyText(),\n}\n\nconst key: keyof WithStyledText = \"styledText\"\n\nexport function withStyledText(target: any): target is WithStyledText {\n\treturn key in target\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport type { FormSelectGenericOptionKey } from \"document/components/chrome/localization/getLocalizationSources.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport { type VariableReference, isVariableReference } from \"./VariableReference.ts\"\n\nexport const formSelectGenericOptionLabels: Record<FormSelectGenericOptionKey, string> = {\n\tallItemsLabel: Dictionary.Default,\n\tbooleanTrueLabel: Dictionary.Yes,\n\tbooleanFalseLabel: Dictionary.No,\n}\n\nexport const formSelectGenericOptionDefaults: Record<FormSelectGenericOptionKey, string> = {\n\tallItemsLabel: Dictionary.All,\n\tbooleanTrueLabel: Dictionary.Yes,\n\tbooleanFalseLabel: Dictionary.No,\n}\n\nexport type BindingType = \"form\" | \"variable\"\n\n/**\n * Intended to be implemented by Form Input Nodes.\n *\n * - \"bindingType: form\"\n *   Used by the Form Builder. The default values can be customized. At runtime, the inputs are\n *   uncontrolled and the value set by the user is used as the Form value.\n *\n * - \"bindingType: variable\"\n *   Used by Dynamic Filters. Must have a `variableBinding` set. At runtime, the inputs are\n *   controlled and bound to a Web Page URL Variable or a Smart Component internal variable.\n */\nexport interface WithVariableBinding {\n\tbindingType: BindingType\n\tvariableBinding: VariableReference | undefined\n}\n\nconst key: keyof WithVariableBinding = \"bindingType\"\n\nexport function withVariableBinding(node: CanvasNode): node is CanvasNode & WithVariableBinding {\n\treturn key in node\n}\n\nexport function hasVariableBinding(\n\tnode: CanvasNode,\n): node is CanvasNode & WithVariableBinding & { bindingType: \"variable\"; variableBinding: VariableReference } {\n\treturn withVariableBinding(node) && node.bindingType === \"variable\" && isVariableReference(node.variableBinding)\n}\n\nexport const withVariableBindingDefaults: WithVariableBinding = {\n\tbindingType: \"form\",\n\tvariableBinding: undefined,\n}\n", "import type { ModuleExportIdentifierString } from \"@framerjs/shared\"\n\nconst componentPresetPrefix = \"$componentPreset__\"\n\nexport type PrefixedComponentPresetKey<T extends ModuleExportIdentifierString = ModuleExportIdentifierString> =\n\t`${typeof componentPresetPrefix}${T}`\n\nexport interface WithComponentPresets {\n\t[key: PrefixedComponentPresetKey]: string\n}\n\nexport function prefixComponentPresetKey<T extends ModuleExportIdentifierString>(\n\tkey: T,\n): PrefixedComponentPresetKey<T> {\n\treturn `${componentPresetPrefix}${key}`\n}\n\nexport function isPrefixedComponentPresetKey(key: string): key is PrefixedComponentPresetKey {\n\treturn key.startsWith(componentPresetPrefix)\n}\n\nexport function removeComponentPresetKeyPrefix<T extends ModuleExportIdentifierString>(\n\tpropKey: PrefixedComponentPresetKey<T>,\n): T {\n\treturn propKey.substring(componentPresetPrefix.length) as T\n}\n", "import { isPrefixedControlPropKey } from \"document/models/controlProps/controlPropKey.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport { isCollectionItemNode, isComponentPresetNode, isRichTextNode } from \"../nodes/utils/nodeCheck.ts\"\nimport { isPrefixedComponentPresetKey } from \"../traits/WithComponentPresets.ts\"\nimport { withControlProps } from \"../traits/WithControlProps.ts\"\n\nexport function isPrefixedKey(key: string) {\n\treturn isPrefixedControlPropKey(key) || isPrefixedComponentPresetKey(key)\n}\n\nexport function nodeUsesPrefixedKeys(node: CanvasNode) {\n\treturn withControlProps(node) || isCollectionItemNode(node) || isComponentPresetNode(node) || isRichTextNode(node)\n}\n", "export const isDate = d => d instanceof Date;\nexport const isEmpty = o => Object.keys(o).length === 0;\nexport const isObject = o => o != null && typeof o === 'object';\nexport const hasOwnProperty = (o, ...args) => Object.prototype.hasOwnProperty.call(o, ...args)\nexport const isEmptyObject = (o) => isObject(o) && isEmpty(o);\nexport const makeObjectWithoutPrototype = () => Object.create(null);\n", "import { isDate, isEmptyObject, isObject, hasOwnProperty, makeObjectWithoutPrototype } from './utils.js';\n\nconst diff = (lhs, rhs) => {\n  if (lhs === rhs) return {}; // equal return no diff\n\n  if (!isObject(lhs) || !isObject(rhs)) return rhs; // return updated rhs\n\n  const deletedValues = Object.keys(lhs).reduce((acc, key) => {\n    if (!hasOwnProperty(rhs, key)) {\n      acc[key] = undefined;\n      \n    }\n\n    return acc;\n  }, makeObjectWithoutPrototype());\n\n  if (isDate(lhs) || isDate(rhs)) {\n    if (lhs.valueOf() == rhs.valueOf()) return {};\n    return rhs;\n  }\n\n  return Object.keys(rhs).reduce((acc, key) => {\n    if (!hasOwnProperty(lhs, key)){\n      acc[key] = rhs[key]; // return added r key\n      return acc;\n    } \n\n    const difference = diff(lhs[key], rhs[key]);\n\n    // If the difference is empty, and the lhs is an empty object or the rhs is not an empty object\n    if (isEmptyObject(difference) && !isDate(difference) && (isEmptyObject(lhs[key]) || !isEmptyObject(rhs[key])))\n      return acc; // return no diff\n\n    acc[key] = difference // return updated key\n    return acc; // return updated key\n  }, deletedValues);\n};\n\nexport default diff;\n", "import { diff } from \"deep-object-diff\"\nimport type { CanvasTree } from \"../../CanvasTree.ts\"\nimport type { IsReplicaOrReplicaChild } from \"../../traits/WithTemplate.ts\"\nimport type { RichTextNode } from \"../RichTextNode.ts\"\nimport { isRichTextNode } from \"./nodeCheck.ts\"\n\n/**\n * extractRichTextOverrideKeys produces a best guess set of properties that have been overridden\n * between the primary and replica node. We use this to show which rich text properties\n * have been overridden in the UI. This is a best guess because rich text could have deeply\n * nested html elements, each with their own text style and content overrides. For the purpose\n * of showing override indicators in the UI, we initially go for the 'good enough' approach which\n * checks if the outer html element styles or the text content have changed versus the primary.\n *\n */\nexport function extractRichTextOverrideKeys(\n\ttree: CanvasTree,\n\treplica: RichTextNode & IsReplicaOrReplicaChild,\n): string[] {\n\tconst nodeInPrimary = tree.get(replica.originalid)\n\tif (!nodeInPrimary) return []\n\n\tconst keys: string[] = []\n\n\tif (isRichTextNode(nodeInPrimary)) {\n\t\tconst stylesInReplica = replica.getTextStyle(false)\n\t\tconst stylesInPrimary = nodeInPrimary.getTextStyle(false)\n\n\t\tconst styleDiff = diff(stylesInPrimary, stylesInReplica)\n\n\t\tconst topLevelStyleDiffKeys = Object.keys(styleDiff)\n\n\t\tif (topLevelStyleDiffKeys.length > 0) {\n\t\t\ttopLevelStyleDiffKeys.forEach(key => keys.push(key))\n\t\t} else if (nodeInPrimary.html !== replica.html) {\n\t\t\t// There is a difference but it is not at the top level so it's not feasible\n\t\t\t// to diff the subselections any further. In this case, we just highlight a\n\t\t\t// difference by marking the whole of the html property as being overridden.\n\t\t\t// In the property panel rows for text, the trait type keys used are either\n\t\t\t// the granular keys in the case of top level differences, with a fallback to\n\t\t\t// a trait type key of 'html' for any more complex / nested differences.\n\t\t\tkeys.push(\"html\")\n\t\t}\n\n\t\tconst contentInPrimary = nodeInPrimary.getTextContent()\n\t\tconst contentInReplica = replica.getTextContent()\n\n\t\tif (contentInPrimary !== contentInReplica) keys.push(\"htmlContent\")\n\t}\n\n\treturn keys\n}\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport { assert } from \"@framerjs/shared\"\nimport type { FrameNode, NodeID, PathNode, ScopeNode, ShapeContainerNode } from \"document/models/CanvasTree/index.ts\"\nimport type { WithPins } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport { isPinnable } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport { getPatchedEditor } from \"document/models/StyledText/DraftEditor.ts\"\nimport { isPrefixedControlPropKey, prefixControlPropKey } from \"document/models/controlProps/controlPropKey.ts\"\nimport { environment } from \"environment/index.ts\"\nimport { isEqual } from \"library/index.ts\"\nimport { createEditorState } from \"prosemirror/editorState.ts\"\nimport { patchRichText } from \"prosemirror/patching.ts\"\nimport { serializeRichText } from \"prosemirror/serialization/dom.ts\"\nimport { deepCloneUnsafe } from \"utils/deepClone.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { StyledTextDraft } from \"../../StyledText/StyledTextDraft.ts\"\nimport type { CanvasTree } from \"../CanvasTree.ts\"\nimport type { VariableProviderValueMap } from \"../traits/VariableProvider.ts\"\nimport { withCodeOverride } from \"../traits/WithCodeOverride.ts\"\nimport { withCollectionDataSource } from \"../traits/WithCollectionDataSource.ts\"\nimport type { WithItemsOrder } from \"../traits/WithItemsOrder.ts\"\nimport { isPluginDataProperty } from \"../traits/WithPluginData.ts\"\nimport { withReplicaVariants } from \"../traits/WithReplicaVariants.ts\"\nimport type { RichTextVirtualisedProperties, WithRichText } from \"../traits/WithRichText.ts\"\nimport { withRichText } from \"../traits/WithRichText.ts\"\nimport { heightTypeKey, widthTypeKey, withSizeDimensionType } from \"../traits/WithSizeDimensionType.ts\"\nimport type { WithStyledText } from \"../traits/WithStyledText.ts\"\nimport { withStyledText } from \"../traits/WithStyledText.ts\"\nimport type {\n\tIsMaster,\n\tIsReplica,\n\tReplicaNodeOverrides,\n\tReplicaOverrides,\n\tWithTemplate,\n} from \"../traits/WithTemplate.ts\"\nimport { HIDDEN_MASTER, isMaster, isReplica, isReplicaOrReplicaChild, withTemplate } from \"../traits/WithTemplate.ts\"\nimport { withVariableBinding } from \"../traits/WithVariableBinding.ts\"\nimport type { IsVariant, WithGesture } from \"../traits/WithVariant.ts\"\nimport {\n\tisBreakpointVariant,\n\tisGestureVariant,\n\tisTopLevelVariant,\n\tisVariant,\n\twithGesture,\n} from \"../traits/WithVariant.ts\"\nimport { isPrefixedKey, nodeUsesPrefixedKeys } from \"../utils/isPrefixedKey.ts\"\nimport type { CanvasNode } from \"./CanvasNode.ts\"\nimport { CanvasChildList } from \"./ChildList.ts\"\nimport type { ReadonlyChildList } from \"./ChildList.ts\"\nimport { randomID } from \"./NodeID.ts\"\nimport { extractRichTextOverrideKeys } from \"./utils/extractRichTextOverrideKeys.ts\"\nimport { isCodeComponentNode, isRichTextNode } from \"./utils/nodeCheck.ts\"\n\n/**\n * Generate a mix id for the replica child node\n * @param replicaId Replica root\n * @param originalId Id of the original node in the master\n */\nexport function generateReplicaChildId<ReplicaId extends NodeID, OriginalId extends NodeID>(\n\treplicaId: ReplicaId,\n\toriginalId: OriginalId,\n): `${ReplicaId}${OriginalId}` {\n\treturn `${replicaId}${originalId}`\n}\n\nexport function isGeneratedReplicaChildId(id: NodeID, originalid: NodeID): boolean {\n\treturn id.length > originalid.length && id.endsWith(originalid)\n}\n\nexport function createDuplicatedFromIfAllowed(fromNode: CanvasNode): string[] | null {\n\treturn !isVariant(fromNode) || isBreakpointVariant(fromNode)\n\t\t? duplicatedFromForNode(fromNode.duplicatedFrom, fromNode.id)\n\t\t: null\n}\n\nexport function duplicatedFromForNode(duplicatedFrom: string[] | null | undefined, newId: NodeID): string[] {\n\tif (duplicatedFrom) {\n\t\tif (!newId) return duplicatedFrom\n\t\treturn duplicatedFrom[duplicatedFrom.length - 1] === newId ? duplicatedFrom : [...duplicatedFrom, newId]\n\t}\n\n\treturn [newId]\n}\n\nexport function allVariantsAreHidden(tree: CanvasTree, scope: ScopeNode | null, node: CanvasNode) {\n\tif (!scope || !withReplicaVariants(scope)) return node.visible === false\n\treturn (\n\t\tnode.visible === false &&\n\t\tscope.getReplicaVariants().every(variant => {\n\t\t\tconst replica = tree.get(generateReplicaChildId(variant.id, node.id))\n\t\t\t// A replica node should always exist, since its expanded from the primary. However it\n\t\t\t// could not be in the tree if the node in the primary, or the replica variant was added\n\t\t\t// in the same frame that this function is called. To avoid this case, we return false\n\t\t\t// since we don't know the visibility of the node.\n\t\t\tif (!replica) return false\n\t\t\treturn replica?.visible === false\n\t\t})\n\t)\n}\n\nexport const ignoredOverrideKeys = {\n\tmutable: true,\n\tcache: true,\n\tupdate: true,\n\tchildren: true,\n\tid: true,\n\tparentid: true,\n\toriginalid: true,\n\treplicaInfo: true,\n\tisMaster: true,\n\tisExternalMaster: true,\n\tcontentHash: true,\n\t_deleted: true,\n\tscrollTargetEnabled: true,\n\tblockDocumentScrolling: true,\n\telementId: true,\n\tflowEffectEnabled: true,\n} as Record<string, boolean>\n\n/** Turns {_deleted: [\"property\"]} into {property: undefined}. */\nfunction objectFromOverrides(override: ReplicaNodeOverrides | undefined): { [key: string]: unknown } | undefined {\n\tif (!override) return undefined\n\tconst hasOriginalId = Object.hasOwn(override, \"originalid\")\n\tconst hasDeleted = Object.hasOwn(override, \"_deleted\")\n\tif (hasOriginalId && hasDeleted) return override\n\n\tconst { originalid: _, _deleted, __deleted, ...result } = override\n\tif (_deleted) {\n\t\tfor (const key of _deleted) {\n\t\t\t/**\n\t\t\t * For each _deleted key, add [key]: undefined to the overrides\n\t\t\t * so that the node is built with an undefined value for that property, instead of the master's value.\n\t\t\t *\n\t\t\t * However, in the case where a replica has inherited some _deleted properties that it overrides,\n\t\t\t * only set [key]: undefined if the replica does not override the property.\n\t\t\t * This can happen when overrides from two replicas are merged when using replica inheritance with `inheritsFrom`.\n\t\t\t */\n\t\t\tconst safeToUnsetDeletedKey = !(key in result)\n\t\t\tif (safeToUnsetDeletedKey) result[key] = undefined\n\t\t}\n\t}\n\n\t// For CRDT\n\tif (__deleted) {\n\t\tfor (const key of __deleted) {\n\t\t\t/**\n\t\t\t * For each _deleted key, add [key]: undefined to the overrides\n\t\t\t * so that the node is built with an undefined value for that property, instead of the master's value.\n\t\t\t *\n\t\t\t * However, in the case where a replica has inherited some _deleted properties that it overrides,\n\t\t\t * only set [key]: undefined if the replica does not override the property.\n\t\t\t * This can happen when overrides from two replicas are merged when using replica inheritance with `inheritsFrom`.\n\t\t\t */\n\t\t\tconst safeToUnsetDeletedKey = !(key in result)\n\t\t\tif (safeToUnsetDeletedKey) result[key] = undefined\n\t\t}\n\t}\n\treturn result\n}\n\n/** Turns {property: undefined} into {_deleted: [\"property\"]}. */\nfunction overridesFromObject(override: { [key: string]: unknown }, node?: CanvasNode): ReplicaNodeOverrides {\n\tlet deleted: Set<string> | undefined\n\tlet result: ReplicaNodeOverrides | undefined\n\tfor (const [key, value] of Object.entries(override)) {\n\t\tif (value !== undefined) continue\n\n\t\tif (!deleted || !result) {\n\t\t\tdeleted = new Set<string>()\n\t\t\tresult = { ...override }\n\t\t}\n\n\t\t// If a node was passed in as reference, we check if the property is actually supported by\n\t\t// the node, otherwise we just drop it from the overrides object.\n\t\tif (!node || key in node || (isPrefixedKey(key) && nodeUsesPrefixedKeys(node)) || isPluginDataProperty(node, key)) {\n\t\t\tdeleted.add(key)\n\t\t}\n\t\tdelete result[key]\n\t}\n\n\t// If there were no undefined values, we can return the object as is.\n\tif (!result || !deleted) return override\n\n\t// Only add a _deleted array if it is not empty.\n\tif (deleted.size > 0) {\n\t\tresult._deleted = Array.from(deleted)\n\t}\n\treturn result\n}\n\nfunction mergeDeletedKeys(deletedInheritedOverrides: string[], deletedOverrides?: string[]) {\n\tif (deletedOverrides) {\n\t\treturn [...deletedInheritedOverrides, ...deletedOverrides]\n\t} else {\n\t\treturn deletedInheritedOverrides\n\t}\n}\n\nfunction hasInheritedDeletedKeys(\n\tdeletedNodeOverrides: ReplicaNodeOverrides[\"_deleted\"],\n): deletedNodeOverrides is string[] {\n\treturn deletedNodeOverrides !== undefined\n}\n\nfunction mergeNodeOverrides(\n\toverrides: ReplicaOverrides,\n\tinheritedOverrides: ReplicaOverrides | undefined,\n\tnodeId: NodeID,\n) {\n\tconst inheritedDeletedOverrides = inheritedOverrides?.[nodeId]?._deleted\n\n\tlet mergedDeletedProperties = {}\n\n\tif (inheritedOverrides && hasInheritedDeletedKeys(inheritedDeletedOverrides)) {\n\t\tmergedDeletedProperties = { _deleted: mergeDeletedKeys(inheritedDeletedOverrides, overrides[nodeId]?._deleted) }\n\t}\n\n\treturn Object.assign({}, inheritedOverrides?.[nodeId], overrides[nodeId], mergedDeletedProperties)\n}\n\nexport function mergeOverrides(\n\toverrides: ReplicaOverrides,\n\tinheritedOverrides?: ReplicaOverrides | null,\n): ReplicaOverrides {\n\tif (!inheritedOverrides) return { ...overrides }\n\n\tconst originalids = new Set([...Object.keys(overrides), ...Object.keys(inheritedOverrides || {})])\n\n\tconst mergedOverrides: Record<string, ReplicaNodeOverrides> = {}\n\tfor (const originalid of originalids) {\n\t\tmergedOverrides[originalid] = mergeNodeOverrides(overrides, inheritedOverrides, originalid)\n\t}\n\n\treturn mergedOverrides\n}\n\nexport function resetUnsupportedReplicaOverrides(nodeInMaster: CanvasNode, nodeInReplicaVariant: CanvasNode) {\n\tresetReplicaCodeOverride(nodeInMaster, nodeInReplicaVariant)\n\tresetReplicaDataIdentifier(nodeInMaster, nodeInReplicaVariant)\n\tresetReplicaVariableBinding(nodeInMaster, nodeInReplicaVariant)\n\tresetReplicaCodeComponentChildren(nodeInMaster, nodeInReplicaVariant)\n}\n\nfunction resetReplicaCodeOverride(nodeInMasterVariant: CanvasNode, nodeInReplicaVariant: CanvasNode) {\n\tif (!withCodeOverride(nodeInMasterVariant) || !withCodeOverride(nodeInReplicaVariant)) return\n\tnodeInReplicaVariant.codeOverrideEnabled = nodeInMasterVariant.codeOverrideEnabled\n\tnodeInReplicaVariant.codeOverrideIdentifier = nodeInMasterVariant.codeOverrideIdentifier\n}\n\nfunction resetReplicaDataIdentifier(nodeInMasterVariant: CanvasNode, nodeInReplicaVariant: CanvasNode) {\n\tif (!withCollectionDataSource(nodeInMasterVariant) || !withCollectionDataSource(nodeInReplicaVariant)) return\n\tnodeInReplicaVariant.dataIdentifier = nodeInMasterVariant.dataIdentifier\n}\n\nfunction resetReplicaVariableBinding(nodeInMasterVariant: CanvasNode, nodeInReplicaVariant: CanvasNode) {\n\tif (!withVariableBinding(nodeInMasterVariant) || !withVariableBinding(nodeInReplicaVariant)) return\n\tnodeInReplicaVariant.bindingType = nodeInMasterVariant.bindingType\n\tnodeInReplicaVariant.variableBinding = nodeInMasterVariant.variableBinding\n}\n\nconst CHILDREN_CONTROL_KEY = prefixControlPropKey(\"children\")\nconst isCodeComponentNodeWithControlChildren = (node: CanvasNode) => {\n\treturn CHILDREN_CONTROL_KEY in node\n}\n\nfunction resetReplicaCodeComponentChildren(nodeInMasterVariant: CanvasNode, nodeInReplicaVariant: CanvasNode) {\n\tif (!isCodeComponentNodeWithControlChildren(nodeInMasterVariant)) return\n\t// @ts-expect-error as value\n\tnodeInReplicaVariant.setProp(CHILDREN_CONTROL_KEY, nodeInMasterVariant[CHILDREN_CONTROL_KEY])\n}\n\nfunction updateNodeWithMaster(\n\texisting: CanvasNode,\n\tmaster: CanvasNode,\n\toverrides: ReplicaNodeOverrides,\n\tisVariantReplica: boolean,\n): void {\n\texisting = existing.asDraft()\n\tconst keep: Partial<CanvasNode & WithGesture & WithTemplate> = {\n\t\tid: existing.id,\n\t\tcache: existing.cache,\n\t\tmutable: true,\n\t\tupdate: existing.update + 1,\n\t\tparentid: existing.parentid,\n\t\toriginalid: existing.originalid,\n\t\tduplicatedFrom: existing.duplicatedFrom,\n\t}\n\tif (\"children\" in existing) {\n\t\tkeep.children = existing.children\n\t}\n\tif (\"replicaInfo\" in existing) {\n\t\tkeep.replicaInfo = existing.replicaInfo\n\t}\n\tif (withGesture(existing)) {\n\t\tkeep.gesture = existing.gesture\n\t}\n\tconst existingName = existing.name\n\tif (withTemplate(existing)) {\n\t\tkeep.isMaster = false\n\t\tkeep.isExternalMaster = null\n\t}\n\t// Delete all existing control props because they are undefined by default, and else they can't\n\t// be reset.\n\tif (isCodeComponentNode(existing)) {\n\t\tfor (const key in existing) {\n\t\t\tif (!isPrefixedControlPropKey(key)) continue\n\t\t\texisting.setProp(key, undefined)\n\t\t}\n\t}\n\texisting.assign(master, objectFromOverrides(overrides), keep)\n\tif (isVariant(existing)) {\n\t\texisting.name = existingName\n\t}\n\tif (isVariantReplica) {\n\t\tresetUnsupportedReplicaOverrides(master, existing)\n\t}\n}\n\nfunction updateNodesWithOverrides(tree: CanvasTree, ownerid: NodeID, node: CanvasNode): void {\n\tconst owner = tree.getNode<CanvasNode & IsReplica>(ownerid)\n\tif (!owner) return\n\n\tconst previousOwner = tree.getNodeAtStart<CanvasNode & IsReplica>(ownerid)\n\tif (!previousOwner) return\n\n\tconst overrides = owner.replicaInfo.overrides\n\tconst previousOverrides = previousOwner.replicaInfo?.overrides ?? {}\n\n\t// If there was no change at all, there is nothing to do.\n\tif (overrides === previousOverrides) return\n\n\tconst inheritedNode = TemplateHelper.inheritedReplicaNode(tree, owner.replicaInfo.inheritsFrom)\n\tconst inheritedOverrides = inheritedNode?.replicaInfo.overrides\n\n\tfor (const child of node.walk()) {\n\t\tconst originalid = child.originalid\n\t\tif (!originalid) continue\n\n\t\tconst override = overrides[originalid]\n\t\tconst previousOverride = previousOverrides[originalid]\n\t\tif (isEqual(override, previousOverride, true)) continue\n\n\t\tconst original = tree.get(originalid)\n\t\tif (!original) return\n\n\t\tupdateNodeWithMaster(\n\t\t\tchild,\n\t\t\toriginal,\n\t\t\tmergeNodeOverrides(overrides, inheritedOverrides, originalid),\n\t\t\tisVariant(owner),\n\t\t)\n\t}\n}\n\nexport function updateVariantName(\n\treplica: CanvasNode & IsVariant,\n\toverrides: ReplicaOverrides,\n\tmaster: CanvasNode & IsMaster,\n) {\n\tif (isGestureVariant(replica)) {\n\t\treplica.name = null\n\t} else if (isTopLevelVariant(replica)) {\n\t\treplica.name = overrides[master.id]?.name ?? null\n\t}\n}\n\nfunction rebuildTemplate(\n\ttree: CanvasTree,\n\townerid: NodeID,\n\tparentid: NodeID,\n\toriginalNode: CanvasNode,\n\toverrides: ReplicaOverrides,\n\tpreviousChildren: Set<NodeID>,\n\tinheritsFromReplica?: boolean,\n\tresetUnsupportedProperties?: boolean,\n\tvariableValueMap?: VariableProviderValueMap,\n): CanvasNode {\n\tconst id = generateReplicaChildId(ownerid, originalNode.id)\n\n\t// make sure we have latest master\n\tif (originalNode.cache.draft) {\n\t\toriginalNode = originalNode.cache.draft\n\t}\n\n\t// if there is an existing node, update it if needed\n\tlet existing = tree.get(id)\n\tif (existing) {\n\t\tassert(existing.originalid === originalNode.id, \"`templateid` must match master\u2019s `id`\", id)\n\n\t\t// no change, mark all existing children as seen\n\t\tif (!originalNode.mutable && !inheritsFromReplica) {\n\t\t\tfor (const n of existing.walk()) {\n\t\t\t\tif (n === existing) continue\n\t\t\t\tpreviousChildren.delete(n.id)\n\t\t\t}\n\n\t\t\t// Update nodes incase only the overrides have changed.\n\t\t\tupdateNodesWithOverrides(tree, ownerid, existing)\n\n\t\t\t// We need to return the draft node if the update above changed anything.\n\t\t\treturn existing.draftOrCurrent()\n\t\t}\n\n\t\texisting = existing.asDraft()\n\t\tconst keep: Partial<CanvasNode & WithTemplate> = {\n\t\t\tid: existing.id,\n\t\t\tcache: existing.cache,\n\t\t\tmutable: true,\n\t\t\tupdate: existing.update + 1,\n\t\t\tparentid: parentid,\n\t\t\toriginalid: existing.originalid,\n\t\t\tduplicatedFrom: null,\n\t\t}\n\n\t\tif (\"children\" in originalNode) {\n\t\t\tkeep.children = rebuildChildren(\n\t\t\t\ttree,\n\t\t\t\townerid,\n\t\t\t\texisting.id,\n\t\t\t\toriginalNode.children,\n\t\t\t\toverrides,\n\t\t\t\tpreviousChildren,\n\t\t\t\tinheritsFromReplica,\n\t\t\t\tresetUnsupportedProperties,\n\t\t\t)\n\t\t}\n\n\t\tif (withTemplate(existing)) {\n\t\t\tkeep.isMaster = false\n\t\t\tkeep.isExternalMaster = null\n\t\t\tkeep.replicaInfo = null\n\t\t}\n\n\t\texisting.assign(originalNode, objectFromOverrides(overrides[originalNode.id]), keep)\n\n\t\tif (isVariant(existing) && isMaster(originalNode)) {\n\t\t\tupdateVariantName(existing, overrides, originalNode)\n\t\t}\n\t\tif (resetUnsupportedProperties) {\n\t\t\tresetUnsupportedReplicaOverrides(originalNode, existing)\n\t\t}\n\n\t\treturn existing\n\t}\n\n\t// if it doesn't exist, create a node\n\tconst keep: any = {}\n\tif (withTemplate(originalNode)) {\n\t\tkeep.isMaster = false\n\t\tkeep.isExternalMaster = null\n\t\tkeep.replicaInfo = null\n\t}\n\n\tif (\"children\" in originalNode) {\n\t\tkeep.children = rebuildChildren(\n\t\t\ttree,\n\t\t\townerid,\n\t\t\tid,\n\t\t\toriginalNode.children,\n\t\t\toverrides,\n\t\t\tpreviousChildren,\n\t\t\tinheritsFromReplica,\n\t\t\tresetUnsupportedProperties,\n\t\t\tvariableValueMap,\n\t\t)\n\t}\n\n\tconst replica = tree.driver.createReplica(originalNode, {\n\t\tid,\n\t\tparentid,\n\t\toriginalid: originalNode.id,\n\t\tduplicatedFrom: null,\n\t\t...objectFromOverrides(overrides[originalNode.id]),\n\t\t...keep,\n\t})\n\n\tif (resetUnsupportedProperties) {\n\t\tresetUnsupportedReplicaOverrides(originalNode, replica)\n\t}\n\n\treturn replica\n}\n\nfunction rebuildChildren(\n\ttree: CanvasTree,\n\townerid: NodeID,\n\tparentid: NodeID,\n\tchildren: ReadonlyChildList<CanvasNode> | undefined,\n\toverrides: ReplicaOverrides,\n\tpreviousChildren: Set<NodeID>,\n\tinheritsFromReplica?: boolean,\n\tresetUnsupportedProperties?: boolean,\n\tvariableValueMap?: VariableProviderValueMap,\n) {\n\tif (!children) return\n\tconst canvasNodes = new CanvasChildList<CanvasNode>()\n\tfor (const n of children) {\n\t\tconst child = rebuildTemplate(\n\t\t\ttree,\n\t\t\townerid,\n\t\t\tparentid,\n\t\t\tn,\n\t\t\toverrides,\n\t\t\tpreviousChildren,\n\t\t\tinheritsFromReplica,\n\t\t\tresetUnsupportedProperties,\n\t\t\tvariableValueMap,\n\t\t)\n\n\t\tif (previousChildren.has(child.id)) {\n\t\t\tpreviousChildren.delete(child.id)\n\t\t} else if (previousChildren.has(parentid)) {\n\t\t\ttree.unsafeInsertNode(child, parentid)\n\t\t}\n\n\t\tcanvasNodes.push(child)\n\t}\n\n\treturn canvasNodes\n}\n\nexport namespace TemplateHelper {\n\texport function create<T extends CanvasNode>(\n\t\ttree: CanvasTree,\n\t\tmaster: T & IsMaster,\n\t\toptions: {\n\t\t\toverrides?: ReplicaOverrides\n\t\t\towner?: NodeID\n\t\t\tinheritsFrom?: NodeID\n\t\t\tduplicatedFrom?: string[] | null\n\t\t\tvariableValueMap?: VariableProviderValueMap\n\t\t\tfromDiff?: boolean\n\t\t} = {},\n\t): T & IsReplica {\n\t\tassert(master.isMaster, \"Node is not a master node\")\n\t\tconst { overrides: inputOverrides = {}, owner = randomID(), inheritsFrom, duplicatedFrom = null } = options\n\t\tconst overrides = deepCloneUnsafe(inputOverrides)\n\t\t// Make sure the replica position is unlinked from the master\n\t\tif (isPinnable(master)) {\n\t\t\tconst replicaOverrides = overrides[master.id]\n\t\t\tconst { top, left, right, bottom, centerAnchorX, centerAnchorY } = master\n\t\t\toverrides[master.id] = { top, left, right, bottom, centerAnchorX, centerAnchorY, ...replicaOverrides }\n\t\t}\n\n\t\t// If the replica is created with a value for inheritsFrom,\n\t\t// we extend it's overrides with the overrides of the inherited replica.\n\t\tconst inheritedReplica = inheritedReplicaNode(tree, inheritsFrom)\n\t\tconst allOverrides = mergeOverrides(overrides, inheritedReplica?.replicaInfo.overrides)\n\t\tconst resetUnsupportedProperties = isVariant(master)\n\n\t\tlet children: ReturnType<typeof rebuildChildren> = undefined\n\t\tif (options.fromDiff) {\n\t\t\t// Don't expand children when starting from a diff, commit() will do that work.\n\t\t\t// Otherwise, as more diffs follow without a commit, we are doing a lot more work then\n\t\t\t// we need, and it is very difficult to track what changed and what did not.\n\t\t\tif (master.children) {\n\t\t\t\tchildren = new CanvasChildList()\n\t\t\t}\n\t\t} else {\n\t\t\tchildren = rebuildChildren(\n\t\t\t\ttree,\n\t\t\t\towner,\n\t\t\t\towner,\n\t\t\t\tmaster.children,\n\t\t\t\tallOverrides,\n\t\t\t\tnew Set(),\n\t\t\t\t!!inheritedReplica,\n\t\t\t\tresetUnsupportedProperties,\n\t\t\t\toptions.variableValueMap,\n\t\t\t)\n\t\t}\n\n\t\t// On Web, when a Design Component is duplicated, we immediately recreate it from a `change` object.\n\t\t// In that case, we just have the duplicatedFrom of the replica,\n\t\t// so we use that here, to get the full reference to the node.\n\t\tconst replica = tree.driver.createReplica<T>(master, {\n\t\t\tid: owner,\n\t\t\toriginalid: master.id,\n\t\t\tisMaster: false,\n\t\t\tisExternalMaster: null,\n\t\t\treplicaInfo: { master: master.id, overrides, inheritsFrom },\n\t\t\tduplicatedFrom,\n\t\t\tchildren,\n\t\t\t...objectFromOverrides(allOverrides[master.id]),\n\t\t\tname: isVariant(master) ? null : master.name,\n\t\t})\n\n\t\tif (resetUnsupportedProperties) {\n\t\t\tresetUnsupportedReplicaOverrides(master, replica)\n\t\t}\n\n\t\tif (master.cache.treeLineage) {\n\t\t\tregisterInInheritedNode(master, replica)\n\t\t}\n\n\t\tif (inheritedReplica?.cache.treeLineage) {\n\t\t\tregisterInInheritedNode(inheritedReplica, replica)\n\t\t}\n\n\t\tif (options.fromDiff) {\n\t\t\treplica.cache.rebuildReplica = true\n\t\t}\n\n\t\tassert(replica.id === owner, \"Replica must be owned by the tree\")\n\t\tfor (const n of replica.walk()) assert(n.originalid, \"Node must have a original id\")\n\t\treturn replica\n\t}\n\n\tfunction nodeDidLoad(tree: CanvasTree, node: CanvasNode, seen: Set<NodeID>, errors: string[]) {\n\t\t// Make sure that all dependent masters have been made mutable before\n\t\t// making the current master mutable. This ensures master will have\n\t\t// expanded their internal templates before they are used to expand\n\t\t// their own replicas.\n\t\tfor (const { node: n, skipChildren } of node.walkWithSkipChildren()) {\n\t\t\tif (seen.has(n.id)) {\n\t\t\t\tskipChildren()\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tseen.add(n.id)\n\t\t\tif (!n.replicaInfo) continue\n\t\t\tconst master = getMaster(tree, n as CanvasNode & IsReplica)\n\t\t\tif (!master) continue\n\n\t\t\tnodeDidLoad(tree, master, seen, errors)\n\t\t\tmaster.asDraft(tree)\n\t\t\tregisterInInheritedNode(master, n as CanvasNode & IsReplica)\n\n\t\t\texpandReplicasOnLoad(tree, n as CanvasNode & IsReplica, errors)\n\t\t}\n\t}\n\n\tfunction expandReplicasOnLoad(tree: CanvasTree, n: CanvasNode & IsReplica, errors: string[]) {\n\t\tif (!n.replicaInfo) return true\n\t\tconst master = getMaster(tree, n)\n\t\tif (!master) return true\n\t\tconst replica = n.asDraft()\n\n\t\tconst inheritedReplica = inheritedReplicaNode(tree, replica.replicaInfo.inheritsFrom)\n\t\tif (inheritedReplica) registerInInheritedNode(inheritedReplica, n)\n\n\t\t// Capture the current draft nodes list and length, so we can undo any unsafeInsertNode's.\n\t\tconst draftNodes = tree.unsafeGetDraftNodes()\n\t\tconst draftNodesLength = draftNodes.length\n\t\ttry {\n\t\t\twithChanges(tree, replica, master, inheritedReplica)\n\t\t} catch {\n\t\t\t// If creating the template throws errors, don't just bail,\n\t\t\t// instead clear out and detatch the replica, and rewind the\n\t\t\t// tree.draftNodes.\n\t\t\terrors.push(`${replica.id}: cannot build replica`)\n\t\t\tconst r: CanvasNode = replica\n\t\t\tassert(r.children!.length === 0, \"Must have empty children.\")\n\t\t\tr.originalid = null\n\t\t\tr.replicaInfo = null\n\t\t\tfor (let i = draftNodesLength; i < draftNodes.length; i++) {\n\t\t\t\tconst id = draftNodes[i]?.id\n\t\t\t\tif (isUndefined(id)) continue\n\t\t\t\ttree.unsafeRemoveId(id)\n\t\t\t}\n\t\t\t// Remove the draft nodes this operation added.\n\t\t\tdraftNodes.length = draftNodesLength\n\t\t}\n\t}\n\n\texport function treeDidLoad(tree: CanvasTree, componentLoader: AnyComponentLoader, errors: string[]): CanvasTree {\n\t\tconst seen = new Set<NodeID>()\n\t\tnodeDidLoad(tree, tree.root, seen, errors)\n\t\treturn tree.commit(componentLoader)\n\t}\n\n\texport function registerInInheritedNode<T1 extends CanvasNode, T2 extends CanvasNode>(\n\t\tmasterOrReplica: T1 & (IsMaster | IsReplica),\n\t\treplica: T2 & IsReplica,\n\t) {\n\t\tif (isMaster(masterOrReplica)) {\n\t\t\tassert(masterOrReplica.id === replica.replicaInfo.master, \"The provided master must be the replica's master\")\n\t\t} else {\n\t\t\tassert(\n\t\t\t\tmasterOrReplica.id === replica.replicaInfo.inheritsFrom,\n\t\t\t\t\"The provided replica must be the replica's inherited replica\",\n\t\t\t)\n\t\t}\n\n\t\tif (!masterOrReplica.cache.replicaInstances) {\n\t\t\tmasterOrReplica.cache.replicaInstances = []\n\t\t}\n\n\t\t// for undo/redo we don't track replica instances going away, make sure not to add twice\n\t\tif (masterOrReplica.cache.replicaInstances.includes(replica.id)) return\n\t\tmasterOrReplica.cache.replicaInstances.push(replica.id)\n\t}\n\n\texport function getMaster<T extends CanvasNode>(tree: CanvasTree, replica: T & IsReplica): CanvasNode & IsMaster {\n\t\treturn tree.get<CanvasNode & IsMaster>(replica.replicaInfo.master)!\n\t}\n\n\texport function replicaWithChanges(tree: CanvasTree, replica: CanvasNode & IsReplica) {\n\t\tconst master = getMaster(tree, replica)\n\t\tif (!master) return\n\t\tconst inheritedReplicaDraft = inheritedReplicaNode(tree, replica.replicaInfo.inheritsFrom)\n\t\twithChanges(tree, replica, master, inheritedReplicaDraft)\n\t}\n\n\texport function withChanges(\n\t\ttree: CanvasTree,\n\t\treplica: CanvasNode & IsReplica,\n\t\tmaster: CanvasNode & IsMaster,\n\t\tinheritedReplica: (CanvasNode & IsReplica) | null = null,\n\t) {\n\t\tconst replicaHasChanges = !!replica.cache.draft\n\t\tconst masterHasChanges = !!master.cache.draft\n\t\tconst inheritedHasChanges = !!inheritedReplica?.cache.draft\n\n\t\tconst canUpdateOverrides = (tree.inEditor && !tree.applyingDiffs) || environment.isTest\n\n\t\t// Update the replicaInfo.overrides if needed, before computing allOverrides\n\t\tif (replicaHasChanges && canUpdateOverrides) {\n\t\t\tassert(replica === replica.cache.draft)\n\t\t\tupdateOverrides(replica)\n\t\t}\n\n\t\tconst allOverrides = mergeOverrides(replica.replicaInfo.overrides, inheritedReplica?.replicaInfo.overrides)\n\n\t\tif (masterHasChanges || replica.cache.rebuildReplica) {\n\t\t\treplica.cache.rebuildReplica = false\n\t\t\tassert(master === tree.get(master.id), \"master must be latest\")\n\t\t\trebuildFromMaster(tree, replica, master, allOverrides, inheritedReplica, canUpdateOverrides)\n\t\t} else if (inheritedHasChanges) {\n\t\t\tassert(inheritedReplica.mutable, \"Inherited replica must be mutable\")\n\t\t\tassert(inheritedReplica === inheritedReplica?.cache.draft)\n\t\t\trebuildFromMaster(tree, replica, master, allOverrides, inheritedReplica, canUpdateOverrides)\n\t\t}\n\t}\n\n\texport function rebuildFromMaster(\n\t\ttree: CanvasTree,\n\t\treplica: CanvasNode & IsReplica,\n\t\tmaster: CanvasNode & IsMaster,\n\t\tallOverrides: ReplicaOverrides,\n\t\tinherited: (CanvasNode & IsReplica) | null,\n\t\tcanUpdateOverrides: boolean,\n\t) {\n\t\tlet replicaInfo = replica.replicaInfo\n\t\tlet overrides = replica.replicaInfo.overrides\n\t\tassert(overrides !== allOverrides, \"overrides should not be the same object as allOverrides\")\n\n\t\treplica = replica.asDraft()\n\t\tconst originalChildren = new Set<NodeID>()\n\t\tfor (const node of replica.walk()) {\n\t\t\toriginalChildren.add(node.id)\n\t\t\tassert(node.originalid, \"Replica child node must have orginalid\")\n\n\t\t\t// check if a textnode can be incrementally patched\n\t\t\tif (canUpdateOverrides) {\n\t\t\t\tif (withStyledText(node)) {\n\t\t\t\t\tconst override = overrides[node.originalid]\n\t\t\t\t\tif (!override || !override.styledText) continue\n\n\t\t\t\t\tconst masterNode = tree.getCurrentOrDraft(node.originalid)\n\t\t\t\t\tif (!masterNode || !withStyledText(masterNode)) continue\n\t\t\t\t\tif (!masterNode.cache.canPatchText) continue\n\n\t\t\t\t\tconst draftNode = masterNode.cache.draft\n\t\t\t\t\tif (!draftNode || !withStyledText(draftNode)) continue\n\n\t\t\t\t\toverrides = maybePatchText(masterNode, draftNode, node, overrides, allOverrides)\n\t\t\t\t} else if (withRichText(node)) {\n\t\t\t\t\tconst override = overrides[node.originalid]\n\t\t\t\t\tif (!override || !override.html) continue\n\n\t\t\t\t\tconst masterNode = tree.getCurrentOrDraft(node.originalid)\n\t\t\t\t\tif (!masterNode || !withRichText(masterNode)) continue\n\t\t\t\t\tif (!masterNode.cache.canPatchText) continue\n\n\t\t\t\t\tconst draftNode = masterNode.cache.draft\n\t\t\t\t\tif (!draftNode || !withRichText(draftNode)) continue\n\n\t\t\t\t\toverrides = maybePatchRichText(masterNode, draftNode, node, overrides, allOverrides)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// clean up stale overrides\n\t\tif (canUpdateOverrides) {\n\t\t\tconst staleOverrideIds = new Set(Object.keys(overrides))\n\t\t\tfor (const n of master.walk()) staleOverrideIds.delete(n.id)\n\t\t\tif (staleOverrideIds.size > 0) {\n\t\t\t\toverrides = { ...overrides }\n\t\t\t\tfor (const id of staleOverrideIds) {\n\t\t\t\t\tdelete overrides[id]\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (replicaInfo.overrides !== overrides) {\n\t\t\t\treplicaInfo = { ...replicaInfo, overrides }\n\t\t\t}\n\t\t}\n\n\t\tconst resetUnsupportedProperties = isVariant(master)\n\n\t\tconst keep: Partial<CanvasNode> | Partial<FrameNode> = {\n\t\t\tid: replica.id,\n\t\t\tcache: replica.cache,\n\t\t\tmutable: true,\n\t\t\tupdate: replica.update + 1,\n\t\t\tparentid: replica.parentid,\n\t\t\toriginalid: replica.originalid,\n\t\t\tduplicatedFrom: replica.duplicatedFrom,\n\t\t\tisMaster: false,\n\t\t\tisExternalMaster: null,\n\t\t\treplicaInfo,\n\t\t\tchildren: rebuildChildren(\n\t\t\t\ttree,\n\t\t\t\treplica.id,\n\t\t\t\treplica.id,\n\t\t\t\tmaster.children,\n\t\t\t\tallOverrides,\n\t\t\t\toriginalChildren,\n\t\t\t\t!!inherited,\n\t\t\t\tresetUnsupportedProperties,\n\t\t\t),\n\t\t}\n\n\t\toriginalChildren.delete(replica.id)\n\n\t\tfor (const id of originalChildren) {\n\t\t\tconst node = tree.get(id)\n\t\t\tif (!node) return\n\n\t\t\ttree.unsafeRemoveNode(node)\n\t\t}\n\n\t\treplica.assign(master, objectFromOverrides(allOverrides[replica.originalid]), keep)\n\n\t\tif (isVariant(replica)) {\n\t\t\tupdateVariantName(replica, overrides, master)\n\t\t}\n\t\tif (resetUnsupportedProperties) {\n\t\t\tresetUnsupportedReplicaOverrides(master, replica)\n\t\t}\n\t}\n\n\texport function updateOverrides(replica: CanvasNode & IsReplica) {\n\t\tassert(replica.mutable, \"Replica must be mutable\")\n\t\tassert(replica.originalid, \"Replica must have original id\")\n\t\tlet overrides: ReplicaOverrides | null = null\n\t\tfor (const n of replica.walk()) {\n\t\t\tconst mutable = n.mutable ? n : n.cache.draft\n\t\t\tif (!mutable) continue\n\t\t\tconst originalid = mutable.originalid\n\t\t\tassert(originalid, \"Original id must not be empty, id: \", mutable.id)\n\n\t\t\t// we need to be careful to treat replicaInfo and overrides as immutables\n\t\t\tconst props = mutable.cache.templateProperties\n\t\t\tif (props && Object.keys(props).length > 0) {\n\t\t\t\tif (!overrides) {\n\t\t\t\t\toverrides = Object.assign({}, replica.replicaInfo.overrides)\n\t\t\t\t\treplica.replicaInfo = {\n\t\t\t\t\t\tmaster: replica.replicaInfo.master,\n\t\t\t\t\t\tinheritsFrom: replica.replicaInfo.inheritsFrom,\n\t\t\t\t\t\toverrides,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// used by the move tool to signal it wants to restore a previous override, eg for alt+drag\n\t\t\t\tif (props.restore) {\n\t\t\t\t\tif (!props.overrides) {\n\t\t\t\t\t\tdelete overrides[originalid]\n\t\t\t\t\t} else {\n\t\t\t\t\t\toverrides[originalid] = props.overrides\n\t\t\t\t\t}\n\t\t\t\t\tmutable.cache.templateProperties = null\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// when pathsegments are change, always copy over x, y, width, height\n\t\t\t\t// otherwise, bounding box changes of the master will have weird effects in this replica\n\t\t\t\tif (props[\"pathSegments\"]) {\n\t\t\t\t\tconst pathNode = n as PathNode\n\t\t\t\t\tprops[\"x\"] = pathNode[\"x\"]\n\t\t\t\t\tprops[\"y\"] = pathNode[\"y\"]\n\t\t\t\t\tprops[\"width\"] = pathNode[\"width\"]\n\t\t\t\t\tprops[\"height\"] = pathNode[\"height\"]\n\t\t\t\t}\n\n\t\t\t\t// Make sure both width and widthType stay in sync when overridden. Same for height and heightType.\n\t\t\t\t// Fixes https://github.com/framer/company/issues/23414\n\t\t\t\tif (props[\"width\"] !== undefined && props[widthTypeKey] === undefined) {\n\t\t\t\t\tif (withSizeDimensionType(n)) props[widthTypeKey] = n.widthType\n\t\t\t\t}\n\t\t\t\tif (props[\"height\"] !== undefined && props[heightTypeKey] === undefined) {\n\t\t\t\t\tif (withSizeDimensionType(n)) props[heightTypeKey] = n.heightType\n\t\t\t\t}\n\n\t\t\t\toverrides[originalid] = overridesFromObject(\n\t\t\t\t\tObject.assign({}, objectFromOverrides(overrides[originalid]), props),\n\t\t\t\t\tmutable,\n\t\t\t\t)\n\t\t\t\tmutable.cache.templateProperties = null\n\t\t\t}\n\t\t}\n\t}\n\n\t/** ShapeContainerNode's compute a contentHash very late in tree.commit(), namely in preFreeze.\n\t * While templates collect their overrides and rebuild much earlier, namely in preCommit(). That\n\t * is why shape containers have to use this method to update the overrides. That way the\n\t * contentHash is always correct in overrides, and the sandbox, or when loading documents, we\n\t * can assume the hash is correct even for replica's and don't have to recompute it all the\n\t * time. */\n\texport function updateContentHash(tree: CanvasTree, node: ShapeContainerNode & { contentHash: number }) {\n\t\tassert(tree.inEditor, \"updateContentHash should only be called in the editor\")\n\n\t\tconst originalid = node.originalid\n\t\tif (!originalid) return\n\n\t\tconst original = tree.get<ShapeContainerNode>(originalid)\n\t\tassert(original, \"original node not found\")\n\n\t\tconst replica = TemplateHelper.getReplicaForTemplateNode(tree, node)\n\t\tassert(replica, \"replica must exist for shape container node with originalid\")\n\t\tassert(replica.isMutable, \"replica, as a parent of the changed shape container node, must itself be mutable\")\n\n\t\tconst override = replica.replicaInfo.overrides[originalid]\n\t\tif (original.contentHash === node.contentHash && !override?.contentHash) return\n\t\tif (override?.contentHash === node.contentHash) return\n\n\t\tconst newOverride = { ...override, contentHash: node.contentHash }\n\t\tconst newOverrides = { ...replica.replicaInfo.overrides, [originalid]: newOverride }\n\t\tconst newReplicaInfo = { ...replica.replicaInfo, overrides: newOverrides }\n\t\treplica.replicaInfo = newReplicaInfo\n\t}\n\n\texport function resetItemsOrder(tree: CanvasTree, node: CanvasNode & WithItemsOrder) {\n\t\tassert(tree.inEditor, \"resetItemsOrder should only be called in the editor\")\n\n\t\tconst originalid = node.originalid\n\t\tif (!originalid) return\n\n\t\tconst original = tree.get<FrameNode>(originalid)\n\t\tassert(original, \"original node not found\")\n\n\t\tconst replica = TemplateHelper.getReplicaForTemplateNode(tree, node)\n\t\tassert(replica, \"replica must exist for node with originalid\")\n\t\tassert(replica.isMutable, \"replica, as a parent of the changed layout, must itself be mutable\")\n\n\t\tconst override = replica.replicaInfo.overrides[originalid]\n\t\tif (!override?.itemsOrder) return\n\t\tconst { itemsOrder: _, ...newOverride } = override\n\t\tconst newOverrides = { ...replica.replicaInfo.overrides, [originalid]: newOverride }\n\t\tconst newReplicaInfo = { ...replica.replicaInfo, overrides: newOverrides }\n\t\treplica.replicaInfo = newReplicaInfo\n\t}\n\n\texport function resetOverrides(tree: CanvasTree, replica: CanvasNode & IsReplica, node: CanvasNode) {\n\t\tif (!node.originalid) return\n\t\tconst master = tree.get(node.originalid)\n\t\tif (!master) return\n\n\t\tconst overrides = Object.assign({}, replica.replicaInfo.overrides)\n\t\tconst keysToClear = TemplateHelper.overrideKeys(tree, [node])\n\t\tkeysToClear.add(\"_deleted\")\n\t\tkeysToClear.add(\"__deleted\")\n\n\t\tconst nodeOverrides = overrides[node.originalid]\n\t\tconst keep: Record<string, ReplicaNodeOverrides> = {}\n\t\tfor (const key in nodeOverrides) {\n\t\t\tif (!keysToClear.has(key)) {\n\t\t\t\tkeep[key] = nodeOverrides[key]\n\t\t\t}\n\t\t}\n\n\t\tif (Object.keys(keep).length === 0) {\n\t\t\tdelete overrides[node.originalid]\n\t\t} else {\n\t\t\toverrides[node.originalid] = keep\n\t\t}\n\t\tconst masterid = replica.replicaInfo.master\n\t\tconst inheritsFrom = replica.replicaInfo.inheritsFrom\n\t\tconst inheritedReplicaOverrides = inheritedReplicaNode(tree, inheritsFrom)?.replicaInfo?.overrides\n\n\t\tupdateNodeWithMaster(\n\t\t\tnode,\n\t\t\tmaster,\n\t\t\tmergeNodeOverrides(overrides, inheritedReplicaOverrides, node.originalid),\n\t\t\tisVariant(replica),\n\t\t)\n\n\t\treplica = replica.asDraft()\n\t\treplica.replicaInfo = { master: masterid, overrides, inheritsFrom }\n\t}\n\n\tconst requiredRichTextVirtualisedProperties: Record<RichTextVirtualisedProperties, true> = {\n\t\tfont: true,\n\t\tfontSize: true,\n\t\tletterSpacing: true,\n\t\tlineHeight: true,\n\t\ttextAlignment: true,\n\t\ttextColor: true,\n\t\ttextBackgroundColor: true,\n\t\ttextBackgroundRadius: true,\n\t\ttextBackgroundCornerShape: true,\n\t\ttextBackgroundPadding: true,\n\t\ttextDecoration: true,\n\t\ttextDecorationColor: true,\n\t\ttextDecorationThickness: true,\n\t\ttextDecorationStyle: true,\n\t\ttextDecorationSkipInk: true,\n\t\ttextDecorationOffset: true,\n\t\ttextTransform: true,\n\t\ttextStrokeWidth: true,\n\t\ttextStrokeColor: true,\n\t\tparagraphSpacing: true,\n\t\topenTypeFontFeatures: true,\n\t\thtmlContent: true,\n\t}\n\n\tfunction isRichTextVirtualisedProperty(key: string) {\n\t\treturn key in requiredRichTextVirtualisedProperties\n\t}\n\n\texport function resetOverridesByProperty(\n\t\ttree: CanvasTree,\n\t\treplica: CanvasNode & IsReplica,\n\t\tnode: CanvasNode,\n\t\tproperties: readonly string[],\n\t) {\n\t\tif (!node.originalid) return\n\n\t\tconst master = tree.get(node.originalid)\n\t\tif (!master) return\n\n\t\tconst overrides = Object.assign({}, replica.replicaInfo.overrides)\n\t\tconst keysToClear = TemplateHelper.overrideKeys(tree, [node])\n\t\tconst newProperties = objectFromOverrides(overrides[node.originalid]) ?? {}\n\n\t\tfor (const key of properties) {\n\t\t\tif (keysToClear.has(key)) {\n\t\t\t\tdelete newProperties[key]\n\t\t\t}\n\n\t\t\t// If there are any properties that are \"materialised\" sub-properties of rich text,\n\t\t\t// we need to remove the override on the html property in order to reset all rich\n\t\t\t// text overrides.\n\t\t\tif (isRichTextVirtualisedProperty(key)) {\n\t\t\t\tconst htmlKey: keyof WithRichText = \"html\"\n\t\t\t\tdelete newProperties[htmlKey]\n\t\t\t}\n\t\t}\n\n\t\toverrides[node.originalid] = overridesFromObject(newProperties)\n\t\tconst masterid = replica.replicaInfo.master\n\t\tconst inheritsFrom = replica.replicaInfo.inheritsFrom\n\t\tconst inheritedReplicaOverrides = inheritedReplicaNode(tree, inheritsFrom)?.replicaInfo?.overrides\n\n\t\tupdateNodeWithMaster(\n\t\t\tnode,\n\t\t\tmaster,\n\t\t\tmergeNodeOverrides(overrides, inheritedReplicaOverrides, node.originalid),\n\t\t\tisVariant(replica),\n\t\t)\n\t\treplica = replica.asDraft()\n\t\treplica.replicaInfo = { master: masterid, overrides, inheritsFrom }\n\t}\n\n\tconst keyToIgnore = [\"name\", \"gesture\"]\n\n\texport const positionKeysToIgnore: (keyof WithPins)[] = [\n\t\t\"bottom\",\n\t\t\"top\",\n\t\t\"left\",\n\t\t\"right\",\n\t\t\"centerAnchorX\",\n\t\t\"centerAnchorY\",\n\t]\n\n\texport function overrideKeys(\n\t\ttree: CanvasTree,\n\t\tnodes: CanvasNode[],\n\t\t/**\n\t\t * If the node is a RichTextNode, this option will parse the html and return\n\t\t * any text styles from the top level element that have been overridden.\n\t\t */\n\t\tincludeRichTextSubProperties?: boolean,\n\t): Set<string> {\n\t\tconst keys: Set<string> = new Set<string>()\n\n\t\tfor (let i = 0, il = nodes.length; i < il; i++) {\n\t\t\tconst node = nodes[i]\n\t\t\tif (isUndefined(node)) continue\n\t\t\tconst replica = TemplateHelper.getReplicaForTemplateNode(tree, node)\n\t\t\t// There should always be a replica\n\t\t\tif (!node.originalid || !replica || !replica.replicaInfo) continue\n\t\t\tconst overridesForNode = objectFromOverrides(replica.replicaInfo.overrides[node.originalid])\n\t\t\tif (!overridesForNode) continue\n\n\t\t\tconst ignorePosition = isReplica(node)\n\n\t\t\tfor (const overrideKey in overridesForNode) {\n\t\t\t\tif (ignorePosition && positionKeysToIgnore.includes(overrideKey as any)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (keyToIgnore.includes(overrideKey)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tkeys.add(overrideKey)\n\t\t\t}\n\n\t\t\tif (includeRichTextSubProperties && isRichTextNode(node) && isReplicaOrReplicaChild(node)) {\n\t\t\t\tconst richTextOverridenKeys = extractRichTextOverrideKeys(tree, node)\n\n\t\t\t\tfor (const richTextOverridenKey of richTextOverridenKeys) {\n\t\t\t\t\tkeys.add(richTextOverridenKey)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn keys\n\t}\n\n\texport function isAnyKeyOverridden(\n\t\treplica: CanvasNode & IsReplica,\n\t\toriginalId: NodeID,\n\t\tkeys: string | readonly string[],\n\t): boolean {\n\t\tconst { overrides } = replica.replicaInfo\n\t\tconst nodeOverrides = overrides[originalId]\n\t\tif (!nodeOverrides) return false\n\t\tif (isString(keys)) return isKeyOverridden(keys, nodeOverrides)\n\t\treturn keys.some(key => isKeyOverridden(key, nodeOverrides))\n\t}\n\n\texport function isInMasterOfReplica(tree: CanvasTree, parent: CanvasNode | null, child: CanvasNode): boolean {\n\t\tif (!parent) return false\n\t\tif (!isReplica(child)) return isAnyChildInMasterOfReplica(tree, parent, child)\n\n\t\twhile (parent) {\n\t\t\tif (isMaster(parent) && isMasterOfReplica(tree, parent, child)) return true\n\t\t\tparent = tree.get(parent.parentid)\n\t\t}\n\n\t\treturn false\n\t}\n\n\texport function getReplicaForTemplateNode(\n\t\ttree: CanvasTree,\n\t\tnode: CanvasNode | undefined,\n\t): (CanvasNode & IsReplica) | null {\n\t\tif (!node || !node.originalid) return null\n\n\t\t// If the cache is setup, we can short circuit.\n\t\tif (node.cache.replicaAncestorId) {\n\t\t\tconst replicaRoot = tree.get(node.cache.replicaAncestorId)\n\t\t\tif (isReplica(replicaRoot)) return replicaRoot\n\t\t}\n\n\t\tlet replica: CanvasNode | null = node\n\t\twhile (replica) {\n\t\t\tif (isReplica(replica)) break\n\t\t\treplica = tree.get(replica.parentid)\n\t\t}\n\t\treturn replica\n\t}\n\n\tfunction isAnyChildInMasterOfReplica(tree: CanvasTree, parent: CanvasNode, node: CanvasNode) {\n\t\treturn node.some(child => isReplica(child) && isInMasterOfReplica(tree, parent, child))\n\t}\n\n\tfunction isMasterOfReplica(tree: CanvasTree, master: CanvasNode & IsMaster, child: CanvasNode & IsReplica): boolean {\n\t\tif (child.replicaInfo.master === master.id) return true\n\n\t\t// recursively check if master.templateInstances point to the master of this replica\n\t\tconst templateInstances = master.cache.replicaInstances\n\t\tif (!templateInstances) return false\n\t\tfor (let i = 0, il = templateInstances.length; i < il; i++) {\n\t\t\tconst id = templateInstances[i]\n\t\t\tif (isInMasterOfReplica(tree, tree.get(id), child)) return true\n\t\t}\n\n\t\treturn false\n\t}\n\n\texport function hasReplicas(tree: CanvasTree, master: CanvasNode & IsMaster): boolean {\n\t\tconst instances = master.cache.replicaInstances\n\t\tif (!instances) return false\n\t\tfor (let i = 0, il = instances.length; i < il; i++) {\n\t\t\tconst id = instances[i]\n\t\t\tif (tree.get(id)) return true\n\t\t}\n\t\treturn false\n\t}\n\n\texport function hideMaster(tree: CanvasTree, master: CanvasNode & IsMaster): void {\n\t\tif (master.isExternalMaster) return\n\t\tmaster.set({ isExternalMaster: HIDDEN_MASTER }, tree)\n\t}\n\n\texport function showMaster(tree: CanvasTree, master: CanvasNode & IsMaster): void {\n\t\tif (master.isExternalMaster !== HIDDEN_MASTER) return\n\t\tmaster.set({ isExternalMaster: null }, tree)\n\t}\n\n\t// if we find a changed styled text in master, try to patch what wasn't overriden in the styled text\n\texport function maybePatchText(\n\t\tmaster: CanvasNode & WithStyledText,\n\t\tdraft: CanvasNode & WithStyledText,\n\t\tinstance: CanvasNode & WithStyledText,\n\t\toverrides: ReplicaOverrides,\n\t\tallOverrides: ReplicaOverrides = {},\n\t): ReplicaOverrides {\n\t\tif (!instance.originalid) return overrides\n\t\tif (!(instance.styledText instanceof StyledTextDraft)) return overrides\n\n\t\tconst from = master.styledText\n\t\tconst to = draft.styledText\n\t\tif (from !== to) {\n\t\t\tconst toUpdate = instance.styledText\n\t\t\tconst patched = StyledTextDraft.withEditorState(\n\t\t\t\tgetPatchedEditor(from.styledText, to.styledText, toUpdate.styledText),\n\t\t\t)\n\n\t\t\tif (patched !== toUpdate) {\n\t\t\t\toverrides = { ...overrides }\n\t\t\t\tconst patchedOverrides = overridesFromObject({\n\t\t\t\t\t...objectFromOverrides(overrides[master.id]),\n\t\t\t\t\tstyledText: patched,\n\t\t\t\t})\n\t\t\t\toverrides[master.id] = allOverrides[master.id] = patchedOverrides\n\t\t\t}\n\t\t}\n\t\treturn overrides\n\t}\n\n\texport function maybePatchRichText(\n\t\tmaster: CanvasNode & WithRichText,\n\t\tfuture: CanvasNode & WithRichText,\n\t\tinstance: CanvasNode & WithRichText,\n\t\toverrides: ReplicaOverrides,\n\t\tallOverrides: ReplicaOverrides = {},\n\t): ReplicaOverrides {\n\t\tif (!instance.originalid) return overrides\n\t\tif (!withRichText(instance)) return overrides\n\t\tif (master.html === future.html) return overrides\n\n\t\t// If the current instance html is the same as the old html, we just want the new html. This\n\t\t// way we can shortcut the much heavier call to pathRichText.\n\t\tif (master.html === instance.html) {\n\t\t\toverrides = { ...overrides }\n\n\t\t\tconst patchedOverrides = overridesFromObject({\n\t\t\t\t...objectFromOverrides(overrides[master.id]),\n\t\t\t\thtml: future.html,\n\t\t\t})\n\n\t\t\toverrides[master.id] = patchedOverrides\n\t\t\tallOverrides[master.id] = patchedOverrides\n\n\t\t\treturn overrides\n\t\t}\n\n\t\t// Patch text content\n\t\tassert(isRichTextNode(master), \"Master must be a rich text node\")\n\t\t// Use the schema from the master node; we assume all nodes will have the same schema\n\t\tconst schema = master.getProseMirrorSchema()\n\t\tconst masterState = createEditorState(master.html, schema)\n\t\tconst draftState = createEditorState(future.html, schema)\n\t\tconst instanceState = createEditorState(instance.html, schema)\n\n\t\tconst newInstanceState = patchRichText(masterState, draftState, instanceState)\n\n\t\tif (newInstanceState) {\n\t\t\tconst newInstanceHTML = serializeRichText(newInstanceState.doc, schema)\n\n\t\t\tif (instance.html !== newInstanceHTML) {\n\t\t\t\toverrides = { ...overrides }\n\n\t\t\t\tconst patchedOverrides = overridesFromObject({\n\t\t\t\t\t...objectFromOverrides(overrides[master.id]),\n\t\t\t\t\thtml: newInstanceHTML,\n\t\t\t\t})\n\n\t\t\t\toverrides[master.id] = patchedOverrides\n\t\t\t\tallOverrides[master.id] = patchedOverrides\n\t\t\t}\n\t\t}\n\n\t\treturn overrides\n\t}\n\n\texport function canMakeMaster(node: CanvasNode) {\n\t\tif (!withTemplate(node)) return false\n\t\tif (isMaster(node)) return false\n\t\tif (node.originalid) return false\n\t\treturn true\n\t}\n\n\texport function inheritedReplicaNode(tree: CanvasTree, inheritsFrom: NodeID | null = null) {\n\t\tif (!inheritsFrom) return null\n\t\tconst inherited = tree.get(inheritsFrom)\n\n\t\tif (!inherited || !isReplica(inherited)) return null\n\n\t\treturn inherited.draftOrCurrent()\n\t}\n}\n\nfunction isKeyOverridden(key: string, overrides: ReplicaNodeOverrides): boolean {\n\tif (key in overrides) return true\n\treturn Boolean(overrides._deleted?.includes(key))\n}\n", "import type { EventActions } from \"document/models/EventAction.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport type { NodeID } from \"../../nodes/NodeID.ts\"\nimport type { DynamicValue } from \"../DynamicValue.ts\"\nimport type { VariableReference } from \"../VariableReference.ts\"\nimport type { Link } from \"../utils/Link.ts\"\nimport type { CaptchaProvider } from \"./formConfig.ts\"\n\nexport type SendTo = \"verifiedEmail\" | \"webhook\" | \"googlesheet\"\nexport const sendToValues = [\"verifiedEmail\", \"webhook\", \"googlesheet\"] as const satisfies SendTo[]\n\nconst sendToTitles: Record<SendTo, string> = {\n\tverifiedEmail: \"Email\",\n\twebhook: \"Webhook\",\n\tgooglesheet: \"Google Sheets\",\n}\n\nexport function titleForSendToOption(sendTo: SendTo): string {\n\treturn sendToTitles[sendTo]\n}\n\nexport interface FormEvents {\n\t/**\n\t * A callback that is invoked as soon as the form is submitted, *before* the\n\t * network requests is resolved. onError or onSuccess will then be\n\t * conditionally called when the response is returned from the server, based\n\t * on it's value.\n\t */\n\tonLoading: EventActions\n\tonSuccess: EventActions\n\tonError: EventActions\n}\n\nexport const formEventKeys = [\"onLoading\", \"onSuccess\", \"onError\"] as const satisfies (keyof FormEvents)[]\n\nexport interface WithFormContainer extends FormEvents {\n\tisFormContainer: boolean | undefined\n\n\tformSubmitButtonId: NodeID | undefined\n\n\t/**\n\t * A unique identifier (uuidv4) that is used to persist a snapshot of the\n\t * form configuration in the backend. The save id is regenerated every time\n\t * the form configuration is changed, and a request is made to the backend\n\t * to save the new configuration. NOTE: The backend is responsible for\n\t * generating the save id.\n\t */\n\tformSaveId: string | undefined\n\n\t/**\n\t * The URL that the form should redirect to after a successful submission.\n\t * Can be a Framer link or an external URL.\n\t */\n\tformOnSuccessRedirectUrl: Link | DynamicValue | undefined\n\n\t/**\n\t * The tracking id that will be sent with the form submit event.\n\t */\n\tformSubmitTrackingId: string | VariableReference | undefined\n\n\t/**\n\t * The captcha provider for the form (e.g. recaptcha_v3).\n\t */\n\tformCaptchaProvider: CaptchaProvider | undefined\n\n\t/**\n\t * The captcha site key for the form.\n\t * This is a public key needed to integrate captchas.\n\t */\n\tformCaptchaSiteKey: string | undefined\n}\n\nconst key: keyof WithFormContainer = \"isFormContainer\"\n\nexport const withFormContainer = <T extends CanvasNode>(node: T): node is T & WithFormContainer => {\n\treturn key in node\n}\n\nexport const isFormContainer = <T extends CanvasNode>(\n\tnode: CanvasNode | null | undefined,\n): node is T & WithFormContainer => {\n\tif (!node) return false\n\treturn withFormContainer(node) && node.isFormContainer === true\n}\n\nexport const formContainerDefaults: WithFormContainer = {\n\tisFormContainer: undefined,\n\tformSubmitButtonId: undefined,\n\tformSaveId: undefined,\n\tformOnSuccessRedirectUrl: undefined,\n\tformSubmitTrackingId: undefined,\n\tformCaptchaProvider: undefined,\n\tformCaptchaSiteKey: undefined,\n\tonSuccess: undefined,\n\tonError: undefined,\n\tonLoading: undefined,\n}\n\nexport const formContainerDefaultValues: WithFormContainer = {\n\t...formContainerDefaults,\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { EventActions } from \"document/models/EventAction.ts\"\nimport type { FormEvents } from \"./forms/WithFormContainer.ts\"\nimport { formEventKeys, isFormContainer } from \"./forms/WithFormContainer.ts\"\n\ninterface WithFrameTapEvents {\n\tonTap: EventActions\n\tonTapStart: EventActions\n}\n\ninterface WithFrameMouseEvents {\n\tonClick: EventActions\n\tonMouseUp: EventActions\n\tonMouseDown: EventActions\n\tonMouseEnter: EventActions\n\tonMouseLeave: EventActions\n}\n\ninterface WithFrameNavigateEvents {\n\tonAppear: EventActions\n}\n\nexport const keyDownKey: keyof WithFrameKeyEvents = \"onKeyDown\"\nexport const appearKey: keyof WithFrameNavigateEvents = \"onAppear\"\n\ninterface WithFrameKeyEvents {\n\tonKeyDown: EventActions\n}\n\nexport type WithFrameEvents = WithFrameTapEvents & WithFrameMouseEvents & WithFrameNavigateEvents & WithFrameKeyEvents\n\nexport const frameEventDefaults: Record<keyof WithFrameEvents, undefined> = {\n\tonTap: undefined,\n\tonTapStart: undefined,\n\tonClick: undefined,\n\tonMouseDown: undefined,\n\tonMouseUp: undefined,\n\tonMouseEnter: undefined,\n\tonMouseLeave: undefined,\n\tonAppear: undefined,\n\tonKeyDown: undefined,\n}\n\nexport const frameTapEventKeys: (keyof WithFrameTapEvents)[] = [\"onTap\", \"onTapStart\"]\nexport const frameMouseEventKeys: (keyof WithFrameMouseEvents)[] = [\n\t\"onClick\",\n\t\"onMouseDown\",\n\t\"onMouseUp\",\n\t\"onMouseEnter\",\n\t\"onMouseLeave\",\n]\nconst frameNavigateEventKeys: (keyof WithFrameNavigateEvents)[] = [\"onAppear\"]\nconst frameKeyboardEventKeys: (keyof WithFrameKeyEvents)[] = [\"onKeyDown\"]\n\n/** A list of all Motion-specific (non-HTML-native) events */\nexport const frameMotionEventKeys: (keyof WithFrameEvents)[] = frameTapEventKeys\n\nexport const frameEventKeys: (keyof WithFrameEvents)[] = [\n\t...frameTapEventKeys,\n\t...frameNavigateEventKeys,\n\t...frameKeyboardEventKeys,\n\t...frameMouseEventKeys,\n]\n\nconst nonGroundNodeFrameEventKeys: Exclude<\n\tkeyof WithFrameEvents,\n\tkeyof WithFrameNavigateEvents | keyof WithFrameKeyEvents\n>[] = [...frameTapEventKeys, ...frameMouseEventKeys]\n\ntype LegacyFrameEventKey = Exclude<keyof WithFrameMouseEvents, \"onMouseEnter\" | \"onMouseLeave\">\nconst legacyFrameEventKeys: LegacyFrameEventKey[] = [\"onClick\", \"onMouseDown\", \"onMouseUp\"]\n\nexport const onTapEventKey: keyof WithFrameEvents = \"onTap\"\n\nexport function withFrameEvents<T extends CanvasNode>(node: T): node is T & WithFrameEvents {\n\treturn onTapEventKey in node\n}\n\nconst allFormEventKeys = [...formEventKeys, ...frameEventKeys]\nconst nonGroundNodeFormEventKeys = [...formEventKeys, ...nonGroundNodeFrameEventKeys]\n\nexport function getFrameEventKeys<T extends CanvasNode>(node: T & WithFrameEvents, getAll: boolean = false) {\n\tif (node.__unsafeIsGroundNode() || getAll) {\n\t\tif (isFormContainer(node)) return allFormEventKeys\n\t\treturn frameEventKeys\n\t}\n\n\tif (isFormContainer(node)) return nonGroundNodeFormEventKeys\n\treturn nonGroundNodeFrameEventKeys\n}\n\nconst overlayKeys: Record<keyof WithFrameEvents & keyof FormEvents, boolean> = {\n\tonTap: true,\n\tonMouseEnter: true,\n\tonSuccess: true,\n\tonError: true,\n\tonSubmit: true,\n}\n\nexport function isValidFixedOverlayTrigger(key: string): boolean {\n\treturn key in overlayKeys\n}\n\nconst frameEventKeyMap: { [K in keyof WithFrameEvents]: boolean } = {\n\tonTap: true,\n\tonTapStart: true,\n\tonClick: true,\n\tonMouseDown: true,\n\tonMouseUp: true,\n\tonMouseEnter: true,\n\tonMouseLeave: true,\n\tonAppear: true,\n\tonKeyDown: true,\n}\n\nexport function isFrameEvent(frameKey: string): frameKey is keyof WithFrameEvents {\n\treturn Object.hasOwn(frameEventKeyMap, frameKey)\n}\n\nexport function isLegacyFrameEventKey(frameKey: string): frameKey is LegacyFrameEventKey {\n\treturn (legacyFrameEventKeys as string[]).includes(frameKey)\n}\n", "import type { EventActions } from \"document/models/EventAction.ts\"\nimport type { FormInputEvents } from \"library/render/presentation/Forms/types.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\n\nexport type WithFormInputEvents = Record<keyof FormInputEvents<unknown>, EventActions>\n\nexport const formInputEventDefaults: Record<keyof WithFormInputEvents, undefined> = {\n\tonBlur: undefined,\n\tonFocus: undefined,\n\tonInvalid: undefined,\n\t/**\n\t * A custom event that a form input can fire when it becomes valid on\n\t * change.\n\t */\n\tonValid: undefined,\n}\n\nexport const formInputEventKeys = [\"onFocus\", \"onBlur\", \"onValid\", \"onInvalid\"] satisfies (keyof WithFormInputEvents)[]\n\nconst key = \"onBlur\" satisfies keyof WithFormInputEvents\nexport function withFormInputEvents<T extends CanvasNode>(node: T): node is T & WithFormInputEvents {\n\treturn key in node\n}\n\nconst formInputKeys = new Set<string>(formInputEventKeys)\nexport function isFormInputEventKey(eventKey: unknown): eventKey is keyof WithFormInputEvents {\n\treturn isString(eventKey) && formInputKeys.has(eventKey)\n}\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport type { CanvasNode, CodeComponentNode } from \"document/models/CanvasTree/index.ts\"\nimport type { EventAction } from \"document/models/EventAction.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isCodeComponentNode } from \"../nodes/utils/nodeCheck.ts\"\nimport type { WithFrameEvents } from \"../traits/WithFrameEvents.ts\"\nimport { getFrameEventKeys, withFrameEvents } from \"../traits/WithFrameEvents.ts\"\nimport type { WithFormInputEvents } from \"../traits/forms/WithFormInputEvents.ts\"\nimport { formInputEventKeys, withFormInputEvents } from \"../traits/forms/WithFormInputEvents.ts\"\n\nexport type OverrideType<T, O extends object> = Omit<T, keyof O> & O\nexport type ActionControlValues<T> = { [K in keyof T]: { type: ControlType; value: T[K] } }\n\nfunction codeComponentHasEvents(node: CodeComponentNode, componentLoader: AnyComponentLoader) {\n\tconst component = componentLoader.reactComponentForIdentifier(node.codeComponentIdentifier)\n\tif (!component) return false\n\tif (!component.properties) return false\n\tfor (const prop in component.properties) {\n\t\tconst property = component.properties[prop]\n\t\tif (property && property.type === ControlType.EventHandler) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\nexport function hasEvents(node: CanvasNode, componentLoader: AnyComponentLoader): boolean {\n\tif (withFrameEvents(node) || withFormInputEvents(node)) return true\n\tif (isCodeComponentNode(node)) return codeComponentHasEvents(node, componentLoader)\n\treturn false\n}\n\nexport function hasEmptyEvents(node: CodeComponentNode, componentLoader: AnyComponentLoader): boolean {\n\tconst component = componentLoader.reactComponentForIdentifier(node.codeComponentIdentifier)\n\tif (!component) return false\n\tif (!component.properties) return false\n\n\t// Break on the first available event handler.\n\tfor (const prop in component.properties) {\n\t\tconst property = component.properties[prop]\n\t\tif (property && property.type === ControlType.EventHandler) {\n\t\t\tconst controlProp = node.getRawControlProp(prop)\n\t\t\tif (!controlProp || !Array.isArray(controlProp.value) || controlProp.value.length === 0) return true\n\t\t}\n\t}\n\n\treturn false\n}\n\nexport function hasActions(node: CanvasNode, componentLoader: AnyComponentLoader): boolean {\n\tif (withFrameEvents(node) || withFormInputEvents(node)) {\n\t\treturn getEventKeys(node).some(eventKey => {\n\t\t\tconst actions = node[eventKey]\n\t\t\treturn Array.isArray(actions) && actions.length > 0\n\t\t})\n\t} else if (isCodeComponentNode(node)) {\n\t\tconst component = componentLoader.reactComponentForIdentifier(node.codeComponentIdentifier)\n\t\tif (!component || !component.properties) return false\n\t\treturn Object.keys(component.properties).some(prop => {\n\t\t\tconst property = component.properties[prop]\n\t\t\tif (!property || property.type !== ControlType.EventHandler) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tconst actions = node.getRawControlProp(prop)?.value\n\t\t\treturn Array.isArray(actions) && actions.length > 0\n\t\t})\n\t} else {\n\t\treturn false\n\t}\n}\n\nfunction containsActionOfType<T extends EventAction>(\n\tvalue: unknown,\n\tpredicate: (value: unknown) => value is T,\n): value is EventAction[] {\n\treturn Array.isArray(value) && value.some(predicate)\n}\n\nexport function getActionsOfType<T extends EventAction>(\n\tnode: CanvasNode,\n\tpredicate: (value: unknown) => value is T,\n\tcomponentLoader: AnyComponentLoader,\n): T[] {\n\tif (withFrameEvents(node) || withFormInputEvents(node)) {\n\t\treturn getNodeWithEventsActionsOfType(node, predicate)\n\t} else if (isCodeComponentNode(node)) {\n\t\treturn getCodeComponentActionsOfType(node, predicate, componentLoader)\n\t} else {\n\t\treturn []\n\t}\n}\n\nexport function containsActionsOfType<T extends EventAction>(\n\tnode: CanvasNode,\n\tpredicate: (value: unknown) => value is T,\n\tcomponentLoader: AnyComponentLoader,\n): boolean {\n\tif (withFrameEvents(node) || withFormInputEvents(node)) {\n\t\treturn nodeWithEventsContainsActionOfType(node, predicate)\n\t} else if (isCodeComponentNode(node)) {\n\t\treturn codeComponentContainsActionOfType(node, predicate, componentLoader)\n\t} else {\n\t\treturn false\n\t}\n}\n\nfunction getEventKeys(node: CanvasNode & (WithFrameEvents | WithFormInputEvents)) {\n\treturn withFrameEvents(node) ? getFrameEventKeys(node) : formInputEventKeys\n}\n\nfunction getNodeWithEventsActionsOfType<T extends EventAction>(\n\tnode: CanvasNode & (WithFrameEvents | WithFormInputEvents),\n\tpredicate: (value: unknown) => value is T,\n): T[] {\n\tconst result: T[] = []\n\tfor (const frameEventKey of getEventKeys(node)) {\n\t\tconst actions = node[frameEventKey]\n\t\tif (Array.isArray(actions)) {\n\t\t\tresult.push(...actions.filter(predicate))\n\t\t}\n\t}\n\treturn result\n}\n\nfunction getCodeComponentActionsOfType<T extends EventAction>(\n\tnode: CodeComponentNode,\n\tpredicate: (value: unknown) => value is T,\n\tcomponentLoader: AnyComponentLoader,\n): T[] {\n\tconst result: T[] = []\n\tconst component = componentLoader.reactComponentForIdentifier(node.codeComponentIdentifier)\n\tif (!component) return result\n\tif (!component.properties) return result\n\n\tfor (const prop in component.properties) {\n\t\tconst property = component.properties[prop]\n\n\t\tif (!property || property.type !== ControlType.EventHandler) continue\n\n\t\tconst controlProp = node.getRawControlProp(prop)\n\t\tif (!controlProp) continue\n\t\tconst actions = controlProp.value\n\t\tif (Array.isArray(actions)) {\n\t\t\tresult.push(...actions.filter(predicate))\n\t\t}\n\t}\n\treturn result\n}\n\nfunction nodeWithEventsContainsActionOfType<T extends EventAction>(\n\tnode: CanvasNode & (WithFrameEvents | WithFormInputEvents),\n\tpredicate: (value: unknown) => value is T,\n): boolean {\n\tfor (const frameEventKey of getEventKeys(node)) {\n\t\tconst actions = node[frameEventKey]\n\t\tif (containsActionOfType(actions, predicate)) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\nfunction codeComponentContainsActionOfType<T extends EventAction>(\n\tnode: CodeComponentNode,\n\tpredicate: (value: unknown) => value is T,\n\tcomponentLoader: AnyComponentLoader,\n): boolean {\n\tconst component = componentLoader.reactComponentForIdentifier(node.codeComponentIdentifier)\n\tif (!component) return false\n\tif (!component.properties) return false\n\n\tfor (const prop in component.properties) {\n\t\tconst property = component.properties[prop]\n\n\t\tif (!property || property.type !== ControlType.EventHandler) continue\n\n\t\tconst controlProp = node.getRawControlProp(prop)\n\t\tif (!controlProp) continue\n\t\tif (containsActionOfType(controlProp.value, predicate)) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n", "import { getLogger } from \"@framerjs/shared\"\nimport type { EventAction } from \"document/models/EventAction.ts\"\nimport { isEventAction } from \"document/models/EventAction.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { v4 as uuid } from \"uuid\"\nimport type { NodeID } from \"../nodes/NodeID.ts\"\nimport { HardCodedCodeIdentifier } from \"../traits/utils/hardCodedCodeComponentIdentifiers.ts\"\nimport type { ActionControlValues } from \"./actions.ts\"\nconst log = getLogger(\"overlayActions\")\n\ninterface DismissOverlayAction extends EventAction {\n\tcontrols: ActionControlValues<{}>\n}\n\nexport function isDismissOverlayAction(value: unknown): value is DismissOverlayAction {\n\treturn isEventAction(value) && value.actionIdentifier === HardCodedCodeIdentifier.dismissOverlayAction\n}\n\nexport function createDismissOverlayAction() {\n\treturn {\n\t\tidentifier: uuid(),\n\t\tactionIdentifier: HardCodedCodeIdentifier.dismissOverlayAction,\n\t\tcontrols: {},\n\t}\n}\n\ninterface ShowOverlayOptions {\n\toverlay: NodeID\n}\n\nexport interface ShowOverlayAction extends EventAction {\n\tactionIdentifier: HardCodedCodeIdentifier.showOverlayAction | HardCodedCodeIdentifier.showRelativeOverlayAction\n\tcontrols: ActionControlValues<ShowOverlayOptions>\n}\ninterface ShowRelativeOverlayAction extends EventAction {\n\tactionIdentifier: HardCodedCodeIdentifier.showRelativeOverlayAction\n\tcontrols: ActionControlValues<ShowOverlayOptions>\n}\n\nexport function createShowOverlayAction(\n\toverlayId: NodeID,\n\tactionIdentifier:\n\t\t| HardCodedCodeIdentifier.showOverlayAction\n\t\t| HardCodedCodeIdentifier.showRelativeOverlayAction = HardCodedCodeIdentifier.showOverlayAction,\n): ShowOverlayAction {\n\treturn {\n\t\tidentifier: uuid(),\n\t\tactionIdentifier,\n\t\tcontrols: {\n\t\t\toverlay: { type: ControlType.String, value: overlayId },\n\t\t},\n\t}\n}\n\nexport function isShowRelativeOverlayAction(value: unknown): value is ShowRelativeOverlayAction {\n\tif (!isEventAction(value)) return false\n\treturn value.actionIdentifier === HardCodedCodeIdentifier.showRelativeOverlayAction\n}\n\nexport function isShowOverlayActionWithId(overlayId: NodeID) {\n\treturn (action: EventAction): action is ShowRelativeOverlayAction =>\n\t\tisShowOverlayAction(action) && action.controls.overlay.value === overlayId\n}\n\nexport function isShowOverlayAction(value: unknown): value is ShowOverlayAction {\n\tif (!isEventAction(value)) return false\n\tif (\n\t\tvalue.actionIdentifier !== HardCodedCodeIdentifier.showOverlayAction &&\n\t\tvalue.actionIdentifier !== HardCodedCodeIdentifier.showRelativeOverlayAction\n\t) {\n\t\treturn false\n\t}\n\tif (!value.controls.overlay) {\n\t\tlog.reportError(\"Invalid overlay action without an overlay control\", {\n\t\t\t...value,\n\t\t})\n\t}\n\treturn true\n}\n", "type BreakpointPreset = \"Desktop\" | \"Tablet\" | \"Phone\"\ninterface BreakpointDefault {\n\tname: BreakpointPreset\n\twidth: number\n\theight: number\n\tviewportHeight: number\n}\n\nconst defaultHeight = 1080\n\nexport const desktopBreakpointVariantDefault: BreakpointDefault = {\n\tname: \"Desktop\",\n\twidth: 1200,\n\theight: defaultHeight,\n\tviewportHeight: 800,\n}\n\nconst tabletBreakpointVariantDefaults: BreakpointDefault = {\n\tname: \"Tablet\",\n\twidth: 810,\n\theight: defaultHeight,\n\tviewportHeight: 1080,\n}\n\nexport const mobileBreakpointVariantDefault: BreakpointDefault = {\n\tname: \"Phone\",\n\twidth: 390,\n\theight: defaultHeight,\n\tviewportHeight: 844,\n}\n\nexport const breakpointVariantDefaults: BreakpointDefault[] = [\n\tdesktopBreakpointVariantDefault,\n\ttabletBreakpointVariantDefaults,\n\tmobileBreakpointVariantDefault,\n]\n", "import type { ComponentLoader } from \"@framerjs/framer-runtime\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { CanvasNode, CodeComponentNode } from \"document/models/CanvasTree/index.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport { assertNever } from \"library/utils/assert.ts\"\nimport type {\n\tTrigger,\n\tTriggerInteraction,\n\tTriggerInvokeAction,\n\tTypedTriggerInteraction,\n} from \"library/utils/triggerActions.ts\"\nimport { isArray, isObject, isString } from \"utils/typeChecks.ts\"\nimport { randomID } from \"../nodes/NodeID.ts\"\nimport { isCodeComponentNode } from \"../nodes/utils/nodeCheck.ts\"\n\nexport interface TriggerAction {\n\tid: string\n\ttrigger: Trigger\n\taction: TriggerInvokeAction\n}\nexport interface WithTriggerActions {\n\ttriggerActions: TriggerAction[] | undefined\n}\n\nexport const triggerActionsDefaults: WithTriggerActions = {\n\ttriggerActions: undefined,\n}\n\nexport const defaultRepeatWithinMs = 2592000000 // 30 days\n\nconst key = \"triggerActions\" satisfies keyof WithTriggerActions\n\nexport function withTriggerActions(node: CanvasNode): node is CanvasNode & WithTriggerActions {\n\treturn key in node\n}\n\nexport function isTriggerAction(item: unknown): item is TriggerAction {\n\treturn isObject(item) && \"id\" in item && \"trigger\" in item && \"action\" in item\n}\n\nexport function hasTriggerActions(\n\tnode: CanvasNode,\n): node is CanvasNode & { triggerActions: [TriggerAction, ...TriggerAction[]] } {\n\treturn withTriggerActions(node) && isArray(node.triggerActions) && node.triggerActions.length > 0\n}\n\nexport function createDefaultTriggerInteraction(type: \"delay\"): TypedTriggerInteraction<\"delay\">\nexport function createDefaultTriggerInteraction(type: \"scrollPercentage\"): TypedTriggerInteraction<\"scrollPercentage\">\nexport function createDefaultTriggerInteraction(type: \"exit\"): TypedTriggerInteraction<\"exit\">\nexport function createDefaultTriggerInteraction(type: TriggerInteraction[\"type\"]) {\n\tswitch (type) {\n\t\tcase \"delay\":\n\t\t\treturn { id: randomID(), operator: \"and\", type: \"delay\", delayMs: 5000, delayType: \"site\" }\n\t\tcase \"scrollPercentage\":\n\t\t\treturn { id: randomID(), operator: \"and\", type: \"scrollPercentage\", scrollPercentage: 50 }\n\t\tcase \"exit\":\n\t\t\treturn { id: randomID(), operator: \"and\", type: \"exit\", exitType: \"mouseleave\" }\n\t\tdefault:\n\t\t\tassertNever(type, \"Unknown trigger condition type\")\n\t}\n}\n\nexport function createTriggerActionWithDefaultTrigger(action: TriggerInvokeAction): TriggerAction {\n\treturn {\n\t\tid: randomID(),\n\t\ttrigger: {\n\t\t\ttrackingId: \"\",\n\t\t\tinteractions: [],\n\t\t},\n\t\taction,\n\t}\n}\n\nexport function getDuplicatedTriggerAction(\n\tengine: VekterEngine,\n\ttargetNode: CanvasNode & WithTriggerActions,\n\ttriggerAction: TriggerAction,\n): TriggerAction {\n\tconst newAction: TriggerInvokeAction = isCodeComponentNode(targetNode)\n\t\t? createDefaultSetVariantAction(\n\t\t\t\tengine.componentLoader,\n\t\t\t\ttargetNode,\n\t\t\t\ttriggerAction.action.type === \"setComponentVariant\" ? triggerAction.action.variant : undefined,\n\t\t\t)\n\t\t: { type: \"showOverlay\" }\n\n\tconst newId = randomID()\n\treturn {\n\t\t...triggerAction,\n\t\tid: newId,\n\t\taction: newAction,\n\t\ttrigger: {\n\t\t\t...triggerAction.trigger,\n\t\t\t// Make sure the repeat rule correctly targets this trigger\n\t\t\teventHistory: triggerAction.trigger.eventHistory?.map(event =>\n\t\t\t\tevent.eventType === \"trigger_invoke\"\n\t\t\t\t\t? {\n\t\t\t\t\t\t\t...event,\n\t\t\t\t\t\t\teventId: newId,\n\t\t\t\t\t\t}\n\t\t\t\t\t: event,\n\t\t\t),\n\t\t},\n\t}\n}\n\nfunction createDefaultSetVariantAction(\n\tcomponentLoader: ComponentLoader,\n\tnode: CodeComponentNode,\n\tcurrentVariant: string | undefined,\n): TriggerInvokeAction {\n\tconst component = componentLoader.reactComponentForIdentifier(node.codeComponentIdentifier)\n\tconst variantControlDescription = component?.properties.variant\n\tif (!variantControlDescription || variantControlDescription.type !== ControlType.Enum) {\n\t\treturn { type: \"setComponentVariant\", variant: \"\" }\n\t}\n\tconst defaultVariant = variantControlDescription.options[0]\n\tconst targetVariant =\n\t\tisString(currentVariant) && variantControlDescription.options.includes(currentVariant)\n\t\t\t? currentVariant\n\t\t\t: defaultVariant\n\n\treturn { type: \"setComponentVariant\", variant: isString(targetVariant) ? targetVariant : \"\" }\n}\n", "export interface WithAspectRatio {\n\taspectRatio: number | null\n}\n\nexport const aspectRatioDefaults: WithAspectRatio = {\n\taspectRatio: null,\n}\n\nconst key: keyof WithAspectRatio = \"aspectRatio\"\n\nexport function withAspectRatio<T extends object>(node: T): node is T & WithAspectRatio {\n\treturn key in node\n}\n", "import type { ComponentLoader } from \"@framerjs/framer-runtime\"\nimport { assertNever } from \"@framerjs/shared\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { Rect } from \"library/render/types/Rect.ts\"\nimport { getKeys } from \"utils/getKeys.ts\"\nimport { isNumber, isString } from \"utils/typeChecks.ts\"\nimport { isCodeComponentNode } from \"../nodes/utils/nodeCheck.ts\"\nimport { withAspectRatio } from \"./WithAspectRatio.ts\"\nimport type { ParentSizeInfo } from \"./WithRect.ts\"\nimport { isBreakpointVariant, isVariant } from \"./WithVariant.ts\"\nimport type { CSSDimension, CSSUnit } from \"./utils/CSSDimension.ts\"\nimport { absoluteCSSDimension, parseCSSDimension } from \"./utils/CSSDimension.ts\"\n\nexport const supportedHeightConstraintUnits = [\"%\", \"px\", \"vh\"] as const satisfies readonly CSSUnit[]\nexport const supportedWidthConstraintUnits = [\"%\", \"px\"] as const satisfies readonly CSSUnit[]\nexport type HeightConstraintUnit = Extract<CSSUnit, (typeof supportedHeightConstraintUnits)[number]>\nexport type WidthConstraintUnit = Extract<CSSUnit, (typeof supportedWidthConstraintUnits)[number]>\nexport type HeightConstraintDimension = CSSDimension<HeightConstraintUnit>\nexport type WidthConstraintDimension = CSSDimension<WidthConstraintUnit>\nexport type ConstraintUnit = HeightConstraintUnit | WidthConstraintUnit\ntype ConstraintDimension = HeightConstraintDimension | WidthConstraintDimension\n\n// WithSizeConstraints previously was a map if keys to numbers. Now all updates\n// will write a CSSDimension string as values to the document. The number type\n// could be removed via a migration if managing that fork proves\n// confusing/troublesome, but seems an acceptable API for the time being.\nexport interface WithSizeConstraints {\n\tmaxWidth: WidthConstraintDimension | number | undefined\n\tminWidth: WidthConstraintDimension | number | undefined\n\tmaxHeight: HeightConstraintDimension | number | undefined\n\tminHeight: HeightConstraintDimension | number | undefined\n}\n\n/**\n * Size constraints where any relative values have been resolved to pixel values\n * by factoring in the parent size.\n */\nexport type AbsoluteSizeConstraints = Record<keyof WithSizeConstraints, number | undefined>\n\nexport interface ConstrainedAxis {\n\tmin?: true\n\tmax?: true\n}\n\nexport interface ConstrainedAxes {\n\tx: ConstrainedAxis\n\ty: ConstrainedAxis\n}\n\ninterface ConstrainContext extends Partial<ParentSizeInfo> {\n\tselectionAspectRatio?: number | null\n}\n\ntype ConstrainAxisContext<K extends keyof AbsoluteSizeConstraints> = ConstrainContext &\n\tPartial<Pick<AbsoluteSizeConstraints, K>>\n\nexport const sizeConstraintsDefaults: WithSizeConstraints = {\n\tmaxWidth: undefined,\n\tminWidth: undefined,\n\tmaxHeight: undefined,\n\tminHeight: undefined,\n}\n\nconst key: keyof WithSizeConstraints = \"maxWidth\"\nexport function withSizeConstraints<T extends CanvasNode>(node: T): node is T & WithSizeConstraints {\n\treturn key in node\n}\n\nexport function supportsSizeConstraints<T extends CanvasNode>(node: T): node is T & WithSizeConstraints {\n\tif (!withSizeConstraints(node)) return false\n\tif (isBreakpointVariant(node)) return false\n\tif (node.__unsafeIsSlotPropertyChildNode()) return false\n\n\t// It's safe to use __unsafeIsGroundNode here as a node not in a tree can't\n\t// have size constraints.\n\treturn isVariant(node) || !node.__unsafeIsGroundNode()\n}\n\nexport function getSizeConstraints(node: CanvasNode) {\n\tif (supportsSizeConstraints(node)) {\n\t\treturn {\n\t\t\tmaxWidth: node.maxWidth,\n\t\t\tminWidth: node.minWidth,\n\t\t\tmaxHeight: node.maxHeight,\n\t\t\tminHeight: node.minHeight,\n\t\t}\n\t}\n\n\treturn sizeConstraintsDefaults\n}\n\nexport function isConstraintDimension(value: unknown): value is ConstraintDimension {\n\tif (!isString(value)) return false\n\tconst [number, unit] = parseCSSDimension(value)\n\tif (Number.isNaN(number)) return false\n\tswitch (unit) {\n\t\tcase \"%\":\n\t\tcase \"px\":\n\t\tcase \"vh\":\n\t\t\treturn true\n\t\tdefault: {\n\t\t\t// If the variable below is not `never`, there are missing cases above.\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\t\t\tconst unhandledUnits = undefined as Extract<typeof unit, ConstraintUnit>\n\t\t}\n\t}\n\treturn false\n}\n\nexport function parseConstraintValue<T extends CSSUnit>(\n\tvalue: CSSDimension<T> | number | undefined | null,\n): [number, T | \"px\"] {\n\tif (isNumber(value)) return [value, \"px\"]\n\tif (!value) return [0, \"px\"]\n\treturn parseCSSDimension<T>(value)\n}\n\n/**\n * Constrain a value between optional minimum and maximum values, prioritizing\n * the minimum value over the maximum value, like in css.\n */\nexport function constrain(value: number, min: number | undefined, max: number | undefined): number {\n\tconst sign = Math.sign(value) || 1\n\tconst absoluteValue = Math.abs(value)\n\n\t// Clamp the value to the minimum value, ignoring that it could be larger\n\t// than the max, just like the css model.\n\tif (isNumber(min) && absoluteValue <= min) return min * sign\n\tif (isNumber(max) && absoluteValue >= max) return max * sign\n\n\treturn absoluteValue * sign\n}\n\nconst absoluteSizeConstraintDefaults: AbsoluteSizeConstraints = {\n\tmaxWidth: undefined,\n\tminWidth: undefined,\n\tmaxHeight: undefined,\n\tminHeight: undefined,\n}\n\n/**\n * Determine the size constraints of a node. If a node doesn't have an aspect\n * ratio, this will be the node's size constraint property values. However, if\n * the node does have an aspect ratio, this will be the min size the node can\n * expand and collapse to, bounded by the constraints, but always respecting the\n * aspect ratio.\n *\n * For example, given a ratio of 2, a maxHeight of 150, and maxWidth of 400, the\n * desired maxWidth will be 300.\n */\nfunction absoluteSizeConstraintsForNode(\n\tnode: CanvasNode,\n\tcomponentLoader: ComponentLoader | undefined,\n\t{ selectionAspectRatio, sizing, viewport }: ConstrainContext = {},\n): AbsoluteSizeConstraints {\n\tconst sizeConstraints: AbsoluteSizeConstraints = Object.assign({}, absoluteSizeConstraintDefaults)\n\tif (!supportsSizeConstraints(node)) return absoluteSizeConstraintDefaults\n\n\tconst aspectRatio = withAspectRatio(node) ? (node.aspectRatio ?? selectionAspectRatio) : selectionAspectRatio\n\n\tconst widthContext = { parentSize: sizing?.width, viewportSize: viewport?.width }\n\tconst heightContext = { parentSize: sizing?.height, viewportSize: viewport?.height }\n\n\t// If we are resizing a smart component instance, it may have recorded any\n\t// min/max sizes that were defined on each variant. This allows us to ensure\n\t// that we do not resize the instance beyond these constraints, and ensure\n\t// that the bounding box rendered by the editor matches what the component\n\t// is rendering on the canvas when resizing.\n\tconst intrinsicConstraints =\n\t\tcomponentLoader && isCodeComponentNode(node) ? node.getCurrentVariantConstraints(componentLoader) : undefined\n\n\tconst minWidth = absoluteCSSDimension(node.minWidth ?? intrinsicConstraints?.minWidth, widthContext) ?? 0\n\tconst minHeight = absoluteCSSDimension(node.minHeight ?? intrinsicConstraints?.minHeight, heightContext) ?? 0\n\tconst maxWidth = absoluteCSSDimension(node.maxWidth ?? intrinsicConstraints?.maxWidth, widthContext) ?? Infinity\n\tconst maxHeight = absoluteCSSDimension(node.maxHeight ?? intrinsicConstraints?.maxHeight, heightContext) ?? Infinity\n\n\tif (!isNumber(aspectRatio)) {\n\t\treturn {\n\t\t\tminWidth,\n\t\t\tminHeight,\n\t\t\tmaxWidth,\n\t\t\tmaxHeight,\n\t\t}\n\t}\n\n\t// If using minHeight to inform the minWidth would create a minWidth that\n\t// exceeds the defined minWidth, we must use minWidth to inform minHeight,\n\t// and vice versa.\n\tconst minWidthViaHeight = minHeight * aspectRatio\n\tif (minWidthViaHeight < minWidth) {\n\t\tsizeConstraints.minWidth = minWidth\n\t\tsizeConstraints.minHeight = Math.max(minWidth / aspectRatio, minHeight)\n\t} else {\n\t\tsizeConstraints.minWidth = Math.max(minWidthViaHeight, minWidth)\n\t\tsizeConstraints.minHeight = minHeight\n\t}\n\n\t// If using maxHeight to inform the maxWidth would create a maxWidth that\n\t// exceeds the defined maxWidth, we must use maxWidth to inform maxHeight,\n\t// and vice versa. Since min values take precedence over max values in css,\n\t// make sure that the calculated max is never smaller than the min.\n\tconst maxWidthViaHeight = maxHeight * aspectRatio\n\tif (maxWidthViaHeight > maxWidth) {\n\t\tsizeConstraints.maxWidth = maxWidth\n\t\tsizeConstraints.maxHeight = Math.max(maxWidth / aspectRatio, sizeConstraints.minHeight)\n\t} else {\n\t\tsizeConstraints.maxWidth = Math.max(maxWidthViaHeight, sizeConstraints.minWidth)\n\t\tsizeConstraints.maxHeight = maxHeight\n\t}\n\n\treturn sizeConstraints\n}\n\n/**\n * Constrain a rect based on the constraints set on a canvas node. If the node\n * also has an aspect ratio, this will be used along with the size constraints\n * to calculate the actual constraints the browser will apply.\n */\nexport function constrainRect(\n\trect: Rect,\n\tnode: CanvasNode,\n\tcomponentLoader: ComponentLoader | undefined,\n\tcontext: ConstrainContext = {},\n): Rect {\n\tif (!supportsSizeConstraints(node)) return rect\n\n\tconst constraints = absoluteSizeConstraintsForNode(node, componentLoader, context)\n\treturn {\n\t\t...rect,\n\t\twidth: constrain(rect.width, constraints.minWidth, constraints.maxWidth),\n\t\theight: constrain(rect.height, constraints.minHeight, constraints.maxHeight),\n\t}\n}\n\nexport function constrainWidth(\n\tnode: CanvasNode,\n\twidth: number,\n\tcomponentLoader: ComponentLoader | undefined,\n\t{ minWidth, maxWidth, ...context }: ConstrainAxisContext<\"maxWidth\" | \"minWidth\"> = {},\n) {\n\tif (!supportsSizeConstraints(node)) return width\n\tconst constraints = absoluteSizeConstraintsForNode(node, componentLoader, context)\n\treturn constrain(width, minWidth ?? constraints.minWidth, maxWidth ?? constraints.maxWidth)\n}\n\nexport function constrainHeight(\n\tnode: CanvasNode,\n\theight: number,\n\tcomponentLoader: ComponentLoader | undefined,\n\t{ minHeight, maxHeight, ...context }: ConstrainAxisContext<\"maxHeight\" | \"minHeight\"> = {},\n) {\n\tif (!supportsSizeConstraints(node)) return height\n\tconst constraints = absoluteSizeConstraintsForNode(node, componentLoader, context)\n\treturn constrain(height, minHeight ?? constraints.minHeight, maxHeight ?? constraints.maxHeight)\n}\n\nconst constraintKeys = getKeys(sizeConstraintsDefaults)\n\n/**\n * Given a CanvasNode and its Rect, determine which constraints are met on each axis.\n */\nexport function constraintsForNodeRect(\n\tnode: CanvasNode,\n\trect: Rect,\n\tcomponentLoader: ComponentLoader | undefined,\n\tcontext: ConstrainContext = {},\n): ConstrainedAxes | null {\n\tif (!supportsSizeConstraints(node)) return null\n\n\tconst constraints: ConstrainedAxes = {\n\t\tx: {},\n\t\ty: {},\n\t}\n\n\tconst constraintValues = absoluteSizeConstraintsForNode(node, componentLoader, context)\n\tfor (const constraintKey of constraintKeys) {\n\t\tconst constraintValue = constraintValues[constraintKey]\n\t\tconst constraintType = constraintKey.substring(0, 3)\n\t\tif (isNumber(constraintValue)) {\n\t\t\tswitch (constraintKey) {\n\t\t\t\tcase \"maxWidth\":\n\t\t\t\t\tif (rect.width >= constraintValue) constraints.x[constraintType] = true\n\t\t\t\t\tbreak\n\t\t\t\tcase \"minWidth\":\n\t\t\t\t\tif (rect.width <= constraintValue) constraints.x[constraintType] = true\n\t\t\t\t\tbreak\n\t\t\t\tcase \"maxHeight\":\n\t\t\t\t\tif (rect.height >= constraintValue) constraints.y[constraintType] = true\n\t\t\t\t\tbreak\n\t\t\t\tcase \"minHeight\":\n\t\t\t\t\tif (rect.height <= constraintValue) constraints.y[constraintType] = true\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(constraintKey)\n\t\t\t}\n\t\t}\n\t}\n\treturn constraints\n}\n\nexport function usingViewHeight(value: WithSizeConstraints[\"minHeight\"]) {\n\treturn isString(value) && value.endsWith(\"vh\")\n}\n\nexport function hasAnyViewHeightConstraints<N extends CanvasNode>(\n\tnode: N,\n): node is N & WithSizeConstraints & ({ minHeight: `${number}vh` } | { maxHeight: `${number}vh` }) {\n\tif (!withSizeConstraints(node)) return false\n\treturn usingViewHeight(node.minHeight) || usingViewHeight(node.maxHeight)\n}\n", "import type { CanvasNode } from \"../nodes/CanvasNode.ts\"\n\nexport interface WithViewport {\n\tviewportHeight?: number\n}\n\nexport const viewportDefaults: WithViewport = {\n\tviewportHeight: undefined,\n}\n\nconst key: keyof WithViewport = \"viewportHeight\"\nexport function withViewport<N extends CanvasNode | null | undefined>(node: N): node is N & WithViewport {\n\tif (!node) return false\n\treturn key in node\n}\n", "import { desktopBreakpointVariantDefault } from \"document/components/utils/breakpointVariantDefaults.ts\"\nimport { DimensionType } from \"library/index.ts\"\nimport type { Rect } from \"library/render/types/Rect.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport type { CanvasTree } from \"../../CanvasTree.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport type { NodeID } from \"../../nodes/NodeID.ts\"\nimport { isDesignPageNode } from \"../../nodes/utils/nodeCheck.ts\"\nimport { withDOMLayout } from \"../WithDOMLayout.ts\"\nimport { isPinnable } from \"../WithPins.ts\"\nimport { hasAnyViewHeightConstraints } from \"../WithSizeConstraints.ts\"\nimport { hasViewportHeight, withSizeDimensionType } from \"../WithSizeDimensionType.ts\"\nimport { isBreakpointVariant, isVariant } from \"../WithVariant.ts\"\nimport type { WithViewport } from \"../WithViewport.ts\"\nimport { withViewport } from \"../WithViewport.ts\"\nimport { isCSSDimension, parseCSSDimension } from \"./CSSDimension.ts\"\n\nexport function canNodeProvideViewportRect<T extends CanvasNode>(node: T | null): node is T & WithViewport {\n\tif (!withViewport(node)) return false\n\tif (isVariant(node)) return true\n\n\treturn isDesignPageNode(node.tree()?.get(node.parentid))\n}\n\nexport const VIEWPORT_HEIGHT_CSS_PROPERTY = \"--framer-viewport-height\"\nexport const CANVAS_FIXED_POSITION_PROPERTY = \"--framer-canvas-fixed-position\"\n\nexport function getCalculatedVHWithFallback(value: string | number | undefined) {\n\tif (!isCSSDimension(value)) return value\n\tconst [v, unit] = parseCSSDimension(value)\n\tif (unit !== \"vh\") return value\n\treturn `calc(var(${VIEWPORT_HEIGHT_CSS_PROPERTY}, 100vh) * ${v / 100})`\n}\n\n/**\n * We must define this variable on the canvas, otherwise generated code that\n * uses viewport height will render at the browsers viewport size, rather than\n * based on some sane canvas value.\n */\nexport const viewportHeightStyle: React.CSSProperties & Record<string, unknown> = {\n\t[VIEWPORT_HEIGHT_CSS_PROPERTY]: `${desktopBreakpointVariantDefault.viewportHeight}px`,\n} as const\nObject.freeze(viewportHeightStyle)\n\nexport function getViewportHeight(\n\tviewportProvider: Readonly<CanvasNode> & WithViewport,\n\trect: Rect,\n\t/**\n\t * determines whether to use the screen height if its value is smaller than the defined viewport height. It should\n\t * be true for fixed elements/overlays, since the screen height will be the viewport height in the generated site,\n\t * that way our canvas UI will match the behavior. But if we're fetching the viewport height for a vh node, we want\n\t * to pick the absolute viewport height instead, otherwise we might create a circular dependency since the screen's\n\t * height may depend on the node's height.\n\t */\n\tpreferMinScreenHeight: boolean = true,\n): number {\n\tconst absoluteViewportHeight = viewportProvider.viewportHeight ?? desktopBreakpointVariantDefault.viewportHeight\n\n\tif (isVariant(viewportProvider) && !isBreakpointVariant(viewportProvider)) {\n\t\t// Smart component variants do not represent the viewport height, so we never want to use the variant height.\n\t\treturn absoluteViewportHeight\n\t}\n\n\tif (!preferMinScreenHeight) return absoluteViewportHeight\n\n\tif (isPinnable(viewportProvider) && viewportProvider.heightType === DimensionType.Auto) {\n\t\t// Auto sized ground nodes cannot limit their viewport:\n\t\t// 1. often the size this produces will influence the size of the ground node, so it changes with every re-render\n\t\t// 2. rendering the node will clear the domRect, so we fallback to some default rect, with unhelpful results\n\t\treturn absoluteViewportHeight\n\t}\n\n\t// If we don't have a measured height for an auto-sized variant, just render the absolute viewport height. Canvas\n\t// rendering will ensure that this will never be larger than 100% of the height of the node. Otherwise `height` will\n\t// be the default frame height of 200, and `Math.min()` may result in it being used instead of a user-defined\n\t// viewportHeight. This can only happen when reloading an existing project.\n\tconst domRect = viewportProvider.cache.getRawDOMRect(viewportProvider.id)\n\tif (withDOMLayout(viewportProvider) && viewportProvider.usesDOMRectCached() && !domRect) {\n\t\treturn absoluteViewportHeight\n\t}\n\n\treturn Math.min(absoluteViewportHeight, rect.height)\n}\n\n/**\n * When updating CanvasNode caches, all descendants of a ground node that can\n * provide a viewport rect need to create or update a viewportRect on their\n * cache. However, nodes that have viewport height use a different value for the\n * height property of that rect then other nodes. To accommodate this, rather\n * than creating a single rect and passing it down, we pass down the width, and\n * 2 unique height values. Each node decides which height value it should use to\n * construct it's own `cache.viewportRect`.\n */\nexport interface ViewportCacheContext {\n\tx?: number\n\ty?: number\n\tviewportWidth?: number\n\tviewportHeight?: number\n\tabsoluteViewportHeight?: number\n}\n\n/**\n * Nodes using vh will possibly have a different viewportRect (than overlay\n * nodes or pos: fixed nodes) in the cache. Normally context.viewportRect.height\n * === min(screen.viewportHeight, screen.height), but for vh nodes we always\n * want to use the set screen.viewportHeight, so that their size don't rely on\n * the height of the screen. This helps to avoid a circular dependency between\n * the size of an auto-sizing screen and its vh children.\n */\nfunction viewportHeightForNodeFromCacheContext(node: CanvasNode, context?: ViewportCacheContext): number | undefined {\n\tif (context) {\n\t\treturn hasViewportHeight(node) || hasAnyViewHeightConstraints(node)\n\t\t\t? context.absoluteViewportHeight\n\t\t\t: context.viewportHeight\n\t}\n\treturn undefined\n}\n\nexport function viewportRectForCacheContext(node: CanvasNode, context?: ViewportCacheContext | null): Rect | null {\n\tif (!context) return null\n\n\tconst height = viewportHeightForNodeFromCacheContext(node, context)\n\tif (!isNumber(height)) return null\n\n\treturn { x: context.x ?? 0, y: context.y ?? 0, width: context.viewportWidth ?? 0, height }\n}\n\nexport function createCacheContext<T>(node: CanvasNode, frame: Rect, context?: T): T | undefined {\n\tif (!canNodeProvideViewportRect(node)) return context\n\n\tconst viewportCacheContext: ViewportCacheContext = {\n\t\tx: frame.x,\n\t\ty: frame.y,\n\t\tviewportWidth: frame.width,\n\t\tviewportHeight: getViewportHeight(node, frame),\n\t\tabsoluteViewportHeight: getViewportHeight(node, frame, false),\n\t}\n\n\tnode.cache.viewportRect = viewportRectForCacheContext(node, viewportCacheContext)\n\n\treturn Object.assign(context ?? {}, viewportCacheContext) as T\n}\n\n/**\n * Returns the viewport provider for a node. This is the node that can provide the viewport rect for\n * the node. This is either the node itself, or the ground node for the node.\n */\nexport function getViewportProviderForNode(tree: CanvasTree, nodeId: NodeID): (CanvasNode & WithViewport) | undefined {\n\tconst node = tree.getNode(nodeId)\n\tif (!node) return undefined\n\n\tconst groundNode = tree.getGroundNodeFor(node)\n\treturn canNodeProvideViewportRect(groundNode) ? groundNode : undefined\n}\n\nexport function supportsViewportSizing(tree: CanvasTree, node: CanvasNode): boolean {\n\tif (!withSizeDimensionType(node)) return false\n\tif (tree.isGroundNode(node)) return false\n\n\tconst viewportProvider = getViewportProviderForNode(tree, node.id)\n\treturn !!viewportProvider\n}\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport type { JSXContext } from \"code-generation/jsx/types.ts\"\nimport type { CanvasTree } from \"../../CanvasTree.ts\"\nimport { getActionsOfType } from \"../../actions/actions.ts\"\nimport { isShowOverlayAction } from \"../../actions/overlayActions.ts\"\nimport type { WithFloatingPosition } from \"../../traits/WithFloatingPosition.ts\"\nimport { hasFloatingPosition } from \"../../traits/WithFloatingPosition.ts\"\nimport { isNodeInTickerEffect } from \"../../traits/WithTickerEffect.ts\"\nimport { hasTriggerActions } from \"../../traits/WithTriggerActions.ts\"\nimport { isBreakpointVariant, isVariantOrVariantChild } from \"../../traits/WithVariant.ts\"\nimport { HardCodedCodeIdentifier } from \"../../traits/utils/hardCodedCodeComponentIdentifiers.ts\"\nimport { getViewportProviderForNode } from \"../../traits/utils/viewportHelpers.ts\"\nimport type { CanvasNode } from \"../CanvasNode.ts\"\nimport type { NodeID } from \"../NodeID.ts\"\nimport type { OverlayNode } from \"../OverlayNode.ts\"\nimport type { AnyScopeNode } from \"../ScopeNode.ts\"\nimport { isInBreakpoint } from \"./breakpointHelpers.ts\"\nimport { isLayoutTemplateNode, isOverlayNode, isSmartComponentNode, isWebPageNode } from \"./nodeCheck.ts\"\n\nexport function nodeIsInOverlay(node: CanvasNode): boolean {\n\treturn !!node.cache.overlayAncestorId\n}\n\nexport function nodeCanTriggerOverlay(\n\tnode: CanvasNode,\n\ttype: HardCodedCodeIdentifier.showRelativeOverlayAction | HardCodedCodeIdentifier.showOverlayAction | string,\n): boolean {\n\tswitch (type) {\n\t\tcase HardCodedCodeIdentifier.showOverlayAction:\n\t\t\treturn isVariantOrVariantChild(node) && !nodeIsInOverlay(node)\n\t\tcase HardCodedCodeIdentifier.showRelativeOverlayAction:\n\t\t\treturn !isBreakpointVariant(node) && !nodeIsInOverlay(node) && !isNodeInTickerEffect(node)\n\t\tdefault:\n\t\t\treturn false\n\t}\n}\n\nexport function scopeSupportsOverlays(scope: AnyScopeNode | null | undefined): boolean {\n\tif (!scope) return false\n\treturn isWebPageNode(scope) || isSmartComponentNode(scope) || isLayoutTemplateNode(scope)\n}\n\nexport function isValidOverlay(node: OverlayNode | (CanvasNode & WithFloatingPosition), tree: CanvasTree): boolean {\n\tif (isOverlayNode(node)) {\n\t\tif (!isInBreakpoint(tree, node.id)) return false\n\t\tif (nodeIsInOverlay(node)) return false\n\n\t\treturn true\n\t}\n\n\tif (hasFloatingPosition(node)) {\n\t\tif (nodeIsInOverlay(node)) return false\n\t\tif (tree.isGroundNode(node)) return false\n\n\t\tconst scope = tree.getScopeNodeFor(node)\n\t\treturn scopeSupportsOverlays(scope)\n\t}\n\n\treturn false\n}\n\n/**\n * isValidOverlay has no performance risks because it doesn't walk ancestors to\n * find the ground node, or any overlay ancestors. It does this by using cache\n * values. This works great in the editor, but in the sandbox CanvasNodeRenderer\n * where these cache values aren't set, we need to walk up the tree to verify.\n *\n * @FIXME - We should find a way to not require 2 methods, and avoid any\n * confusion about which method to use where. Maybe this means setting the cache\n * values in the new CanvasRenderer, or maybe providing some sort of TreeIndex\n * like structure to query these relationships without potentially large tree\n * walks.\n */\nexport function isValidSandboxOverlay(node: OverlayNode | (CanvasNode & WithFloatingPosition), tree: CanvasTree) {\n\tif (isOverlayNode(node)) {\n\t\tlet groundNode: CanvasNode = node\n\t\twhile (groundNode && tree.getParent(groundNode.id)) {\n\t\t\tgroundNode = tree.getParent(groundNode.id)!\n\t\t\tif (isFixedOrRelativeOverlay(groundNode)) return false\n\t\t}\n\n\t\treturn isBreakpointVariant(groundNode)\n\t}\n\n\tif (hasFloatingPosition(node)) {\n\t\tif (tree.isGroundNode(node)) return false\n\t\tlet groundNode: CanvasNode = node\n\t\twhile (groundNode && tree.getParent(groundNode.id)) {\n\t\t\tgroundNode = tree.getParent(groundNode.id)!\n\t\t\tif (isFixedOrRelativeOverlay(groundNode)) return false\n\t\t}\n\n\t\tconst scope = tree.getScopeNodeFor(groundNode)\n\t\treturn scopeSupportsOverlays(scope)\n\t}\n\n\treturn false\n}\n\ntype FixedOrRelativeOverlay = OverlayNode | (WithFloatingPosition & { floatingPositionEnabled: true })\nexport function isFixedOrRelativeOverlay<N extends CanvasNode>(node: N | null): node is N & FixedOrRelativeOverlay {\n\treturn isOverlayNode(node) || hasFloatingPosition(node)\n}\n\nexport function shouldBlockSelectionInOverlayEditMode(\n\tactiveOverlays: ReadonlySet<NodeID>,\n\tactiveOverlayTriggers: ReadonlySet<NodeID>,\n\tnode: CanvasNode,\n) {\n\tif (!activeOverlays.size) return false\n\n\tconst isActiveOverlay = activeOverlays.has(node.id)\n\tif (isActiveOverlay) return false\n\tif (activeOverlayTriggers.has(node.id)) return false\n\tif (nodeIsInActiveOverlay(node, activeOverlays)) return false\n\treturn true\n}\n\n/**\n * When in overlay edit mode, we want to block nodes that are in the same\n * ground node, but not in the overlay node.\n */\nexport function shouldBlockNodeInOverlayEditMode(\n\ttree: CanvasTree,\n\tactiveOverlays: ReadonlySet<NodeID>,\n\tnode: CanvasNode,\n) {\n\tif (!activeOverlays.size) return false\n\n\tconst isActiveOverlay = activeOverlays.has(node.id)\n\tif (isActiveOverlay) return false\n\n\tconst isOrInActiveOverlay = isOverlayNode(node) || nodeIsInActiveOverlay(node, activeOverlays)\n\tif (isOrInActiveOverlay) return false\n\n\tconst groundNodesWithActiveOverlays: Set<NodeID> = new Set()\n\n\tfor (const overlayId of activeOverlays) {\n\t\t// Don't block parenting into floating position overlay variants.\n\t\tif (hasFloatingPosition(tree.get(overlayId))) continue\n\t\tconst viewportProvider = getViewportProviderForNode(tree, overlayId)\n\t\tif (viewportProvider) groundNodesWithActiveOverlays.add(viewportProvider.id)\n\t}\n\n\tconst viewportProvider = getViewportProviderForNode(tree, node.id)\n\tconst isInGroundNodeWithActiveOverlay = viewportProvider && groundNodesWithActiveOverlays.has(viewportProvider.id)\n\treturn isInGroundNodeWithActiveOverlay\n}\n\nexport function nodeIsInActiveOverlay(node: CanvasNode, activeOverlays: ReadonlySet<NodeID>) {\n\tif (!activeOverlays.size) return false\n\n\tconst isActiveOverlay = activeOverlays.has(node.id)\n\tif (isActiveOverlay) return true\n\n\tconst isInActiveOverlay = node.cache.overlayAncestorId && activeOverlays.has(node.cache.overlayAncestorId)\n\treturn isInActiveOverlay\n}\n\n/**\n * Check if a node has any valid overlay.\n *\n * It must have an overlay action that points to an overlay node that exists in\n * the tree.\n */\nexport function nodeHasAnyOverlay(node: CanvasNode, tree: CanvasTree, componentLoader: AnyComponentLoader) {\n\t// A node in an overlay cannot itself have an overlay.\n\tif (nodeIsInOverlay(node)) return false\n\n\tconst showOverlayActions = getActionsOfType(node, isShowOverlayAction, componentLoader)\n\tif (showOverlayActions.length === 0) return false\n\n\tfor (const action of showOverlayActions) {\n\t\tconst overlay = tree.get(action.controls.overlay.value)\n\t\tif (overlay && isFixedOrRelativeOverlay(overlay)) return true\n\t}\n\n\treturn false\n}\n\n/**\n * If the node is an overlay that has no way to be shown then there is no point in generating it.\n */\nexport function isObsoleteOverlay(context: JSXContext, node: CanvasNode & FixedOrRelativeOverlay): boolean {\n\treturn !context.overlays.bindingsByOverlayId.has(node.id) && !hasTriggerActions(node)\n}\n", "import type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isArray } from \"utils/typeChecks.ts\"\nimport type { HasGridLayout, HasStackLayout } from \"./WithLayout.ts\"\nimport { hasGridLayout, hasStackLayout } from \"./WithLayout.ts\"\n\ntype NoUndefinedField<T> = {\n\t[Key in keyof T]: Exclude<T[Key], undefined>\n}\n\nexport interface WithItemsOrder {\n\titemsOrder: NodeID[] | undefined\n\tgetChildrenInVisualOrder: () => CanvasNode[]\n}\n\nconst key: keyof WithItemsOrder = \"itemsOrder\"\n\n/**\n * Please use hasItemsOrderOverride if you want to check if order is overridden in a replica\n */\nexport function withItemsOrder<N extends CanvasNode>(node: N): node is N & WithItemsOrder {\n\treturn key in node\n}\n\nexport function hasItemsOrderOverride<N extends CanvasNode>(node: N): node is N & NoUndefinedField<WithItemsOrder> {\n\treturn withItemsOrder(node) && isArray(node.itemsOrder) && node.itemsOrder.length > 0\n}\n\nexport function supportsItemsOrder<N extends CanvasNode>(\n\tnode: N,\n): node is N & WithItemsOrder & (HasStackLayout | HasGridLayout) {\n\treturn withItemsOrder(node) && (hasStackLayout(node) || hasGridLayout(node))\n}\n\n/**\n * We need to give the node an undefined default, even if only replica nodes\n * should have the itemsOrder prop. In a scenario where the itemsOrder is reset\n * in the replicaInfo:\n *  `a: {width: 2, itemsOrder: [1, 2]}` => `{a: {width: 2}}`,\n * we are relying on the master's `itemsOrder: undefined` to override the\n * existing itemsOrder prop on the replica.\n * see: https://github.com/framer/FramerStudio/blob/643e4322e00d1a7e986529bbccf261f451b3ca44/src/app/vekter/src/document/models/CanvasTree/nodes/TemplateHelper.ts#L236\n */\nexport const withItemsOrderDefaults: Pick<WithItemsOrder, \"itemsOrder\"> = {\n\titemsOrder: undefined,\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isSlotNode, isSlotPropertyNode } from \"../nodes/utils/nodeCheck.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\nimport { isBreakpointVariant } from \"./WithVariant.ts\"\nimport type { ReducedRecord } from \"./utils/Reduced.ts\"\nimport { reduceProperty } from \"./utils/reduceProperty.ts\"\n\nexport interface WithVisibility {\n\tvisible: boolean | DynamicValue\n}\n\nexport const visibilityDefaults: WithVisibility = {\n\tvisible: true,\n}\n\nconst key: keyof WithVisibility = \"visible\"\n\nexport function withVisibility<T extends CanvasNode>(node: T): node is T & WithVisibility {\n\t// FIXME: Checking for breakpoint variants within this trait check is a code\n\t// smell. The proper way to do this is by introducing a specific\n\t// BreakPointNode that doesn't have the visible property. But doing that\n\t// requires a migration. And we don't know yet which other traits should\n\t// be removed. So we'll postpone that work for a later cleanup.\n\tif (isBreakpointVariant(node)) return false\n\tif (isSlotNode(node)) return false\n\tif (isSlotPropertyNode(node)) return false\n\treturn key in node\n}\n\nexport function isVisibleNode(node: CanvasNode | null | undefined) {\n\tif (!node) return false\n\treturn !withVisibility(node) || node.visible !== false\n}\n\nexport type ReducedVisibility = ReducedRecord<WithVisibility>\n\nexport function reduceVisibility(node: CanvasNode, result: ReducedVisibility) {\n\tif (!withVisibility(node)) return\n\treduceProperty(\"visible\", result, node)\n}\n", "import type { Point } from \"library/render/types/Point.ts\"\nimport type { Rect } from \"library/render/types/Rect.ts\"\n\nexport type FramePointValue = 0 | 0.5 | 1\nexport interface FramePoint extends Point {\n\tfx: FramePointValue\n\tfy: FramePointValue\n}\n\nexport type FramePoints = [\n\tFramePoint,\n\tFramePoint,\n\tFramePoint,\n\tFramePoint,\n\tFramePoint,\n\tFramePoint,\n\tFramePoint,\n\tFramePoint,\n\tFramePoint,\n]\n\nconst steps: FramePoint[\"fx\"][] = [0, 0.5, 1]\n\nexport namespace FramePoint {\n\texport const fromFrame = (frame: Rect): FramePoints => {\n\t\tconst result: FramePoints = [] as unknown as FramePoints\n\t\tfor (const fy of steps) {\n\t\t\tfor (const fx of steps) {\n\t\t\t\tresult.push({ x: fx * frame.width, y: fy * frame.height, fx, fy })\n\t\t\t}\n\t\t}\n\t\treturn result\n\t}\n}\n", "import type { Size } from \"library/index.ts\"\nimport { Rect } from \"library/index.ts\"\nimport type { Point } from \"library/render/types/Point.ts\"\n\nlet identityMatrixCache: DOMMatrixReadOnly | null = null\n\n// When converting a point that intersects with the screen, when w is 0.\n// According to the spec, instead of dividing the x and y coordinates by w, we\n// must multiply by n, where n is an implementation-dependent value that should\n// be chosen so that x\u2032 or y\u2032 is much larger than the viewport size.\n// https://www.w3.org/TR/css-transforms-2/#processing-of-perspective-transformed-boxes\nconst n = 2000\n\nexport namespace Matrix {\n\t/**\n\t * Creating new DOMMatrices is expensive. To avoid creating them\n\t * unnecessarily, we reuse the same identity matrix when possible. Since the\n\t * matrix is readonly, you can create easily create a copy at the point of\n\t * mutation by using the non-self methods.\n\t *\n\t * Returns an identity matrix singleton.\n\t */\n\texport const identity = () => {\n\t\t// We use or-equals because otherwise typescript complains about\n\t\t// creating a matrix in a namespace, but we still want to only\n\t\t// instantiate the singleton once.\n\t\treturn (identityMatrixCache ||= new DOMMatrixReadOnly())\n\t}\n\n\t/**\n\t * Create a perspective matrix from a perspective integer to pre-multiply\n\t * into an element's transformMatrix, after origin correction.\n\t * https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/perspective\n\t */\n\texport const perspective = (value: number) => {\n\t\treturn new DOMMatrixReadOnly([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, -1 / value, 0, 0, 0, 1])\n\t}\n\n\texport const pointClipsThroughScreen = (matrix: DOMMatrixReadOnly, point: Point): boolean => {\n\t\treturn matrix.m14 * point.x + matrix.m24 * point.y + matrix.m44 <= 0\n\t}\n\n\t/**\n\t * If the line created by 2 points clips through the screen (when one point\n\t * has a w < 0), we calculate a clipped point by finding the intersection of\n\t * the line with the screen.\n\t *\n\t * This cannot be used if both points are \"behind the camera\", in other\n\t * words both have a w < 0.\n\t */\n\texport const clipPoints = (a: DOMPoint, b: DOMPoint): Point => {\n\t\t// Solve the equation of the line for w = 0.\n\t\tconst t = (0 - a.w) / (b.w - a.w)\n\n\t\t// Then use t to solve the equation of the line for both x and y.\n\t\tconst x = a.x + t * (b.x - a.x)\n\t\tconst y = a.y + t * (b.y - a.y)\n\n\t\t// Finally multiply by the number that would move these points off\n\t\t// screen.\n\t\treturn {\n\t\t\tx: x * n,\n\t\t\ty: y * n,\n\t\t}\n\t}\n\n\t/**\n\t * When converting untransformed points through a matrix, it is possible\n\t * that up to 3 of the points will clip through the screen when projected\n\t * with a low perspective. When this is the case, each of the points \"behind\n\t * the camera\" (those with a transformed point where w < 0) will need to be\n\t * clipped to the screen to match what the browser is able to render.\n\t *\n\t * We do this by creating a lines to the point that needs to be clipped from\n\t * each sibling point, then creating a point for each line at the\n\t * intersection of the screen (when w is 0).\n\t *\n\t * We only include points that have an intersection with the screen. For\n\t * example, we will not create a point for 2 points that are both behind the\n\t * camera. When handling 4 points where 2 sibling points are behind the\n\t * camera, we will create 4 points, 2 for the 2 points that are in front of\n\t * the camera, and 2 points created from the lines from those points to the\n\t * behind camera points.\n\t */\n\texport const convertPointsWithClipping = (matrix: DOMMatrixReadOnly, points: Point[]): Point[] => {\n\t\tconst clippedPoints: Point[] = []\n\n\t\tconst count = points.length\n\t\tfor (let i = 0; i < count; i++) {\n\t\t\tconst point = points[i]!\n\t\t\tconst nextPoint = points[(i + 1) % count]!\n\n\t\t\tif (!Matrix.pointClipsThroughScreen(matrix, point)) {\n\t\t\t\tclippedPoints.push(Matrix.convertPoint(matrix, point))\n\t\t\t\tif (!Matrix.pointClipsThroughScreen(matrix, nextPoint)) continue\n\t\t\t}\n\n\t\t\t// Create a line between the next point and the current point.\n\t\t\t// If the previous point doesn't also clip through the screen,\n\t\t\t// find the point where the line intersects with the screen.\n\t\t\tclippedPoints.push(Matrix.clipPoints(matrix.transformPoint(nextPoint), matrix.transformPoint(point)))\n\t\t}\n\n\t\treturn clippedPoints\n\t}\n\n\t/**\n\t * This is a simplified implementation of\n\t * projectPoint(matrix.transformPoint(point)), which transforms a point\n\t * through a 3d matrix, then projects the 3d point to the 2d point on the\n\t * screen.\n\t *\n\t * This function implements projectPoint(DOMMatrix.transformPoint(Point)),\n\t * skipping unnecessary work.\n\t */\n\texport const convertPoint = (matrix: DOMMatrixReadOnly, point: Point): Point => {\n\t\tconst { x, y } = point\n\t\tconst z = 0\n\t\tlet w = matrix.m14 * x + matrix.m24 * y + matrix.m34 * z + matrix.m44\n\t\tw = w || 1\n\t\treturn {\n\t\t\tx: (matrix.m11 * x + matrix.m21 * y + matrix.m31 * z + matrix.m41) / w,\n\t\t\ty: (matrix.m12 * x + matrix.m22 * y + matrix.m32 * z + matrix.m42) / w,\n\t\t\t// z: (matrix.m13 * x + matrix.m23 * y + matrix.m33 * z + matrix.m43) / w\n\t\t}\n\t}\n\n\texport function equals(m: DOMMatrixReadOnly | null, n: DOMMatrixReadOnly | null) {\n\t\tif (m === n) return true\n\t\tif (!m || !n) return false\n\t\tif (m.isIdentity) return n.isIdentity\n\t\tif (\n\t\t\t// Compare tx, ty first since they're most likely to be different.\n\t\t\tm.m41 !== n.m41 ||\n\t\t\tm.m42 !== n.m42 ||\n\t\t\t// Compare a, b, c, d (2D components).\n\t\t\tm.m11 !== n.m11 ||\n\t\t\tm.m12 !== n.m12 ||\n\t\t\tm.m21 !== n.m21 ||\n\t\t\tm.m22 !== n.m22\n\t\t) {\n\t\t\treturn false\n\t\t}\n\t\t// As long as we're only dealing with 2D we don't need to check more.\n\t\tif (m.is2D && n.is2D) return true\n\t\t// Check the rest of the components.\n\t\treturn (\n\t\t\tm.m13 === n.m13 &&\n\t\t\tm.m14 === n.m14 &&\n\t\t\tm.m23 === n.m23 &&\n\t\t\tm.m24 === n.m24 &&\n\t\t\tm.m31 === n.m31 &&\n\t\t\tm.m32 === n.m32 &&\n\t\t\tm.m33 === n.m33 &&\n\t\t\tm.m34 === n.m34 &&\n\t\t\tm.m43 === n.m43 &&\n\t\t\tm.m44 === n.m44\n\t\t)\n\t}\n\n\t// Chrome differs in rounding behavior when a translation-only vs mixed\n\t// transform matrix is used, so this function is mostly used as a fast way\n\t// to check whether there are any non-translation transforms without\n\t// decomposing the matrix.\n\texport const hasNonTranslationTransform = (m: Partial<DOMMatrixReadOnly>) => {\n\t\treturn (\n\t\t\tm.m11 !== 1 ||\n\t\t\tm.m12 !== 0 ||\n\t\t\tm.m13 !== 0 ||\n\t\t\tm.m14 !== 0 ||\n\t\t\tm.m21 !== 0 ||\n\t\t\tm.m22 !== 1 ||\n\t\t\tm.m23 !== 0 ||\n\t\t\tm.m24 !== 0 ||\n\t\t\tm.m31 !== 0 ||\n\t\t\tm.m32 !== 0 ||\n\t\t\tm.m33 !== 1 ||\n\t\t\tm.m34 !== 0 ||\n\t\t\tm.m44 !== 1\n\t\t)\n\t}\n\n\texport const boundingRectMatrix = (matrix: DOMMatrix | DOMMatrixReadOnly, size: Size) => {\n\t\tconst parentCornerPoints = Rect.pointsAtOrigin(size)\n\t\tconst transformedParentCornerPoints = parentCornerPoints.map(point => matrix.transformPoint(point))\n\t\tconst parentBoundingRect = Rect.boundingRectFromPoints(transformedParentCornerPoints)\n\t\treturn new DOMMatrix().translateSelf(parentBoundingRect.x, parentBoundingRect.y)\n\t}\n\n\t/**\n\t * Given a transformation matrix, this function returns the projective transform matrix defined by the four\n\t * projected points of the transformed shape. It will transform x and y coordinates, but leave the z coordinates\n\t * alone, flattening the transform into a projected surface. We do so by building a 3D transformation matrix using\n\t * the 2D projective transformation matrix entries from the given matrix.\n\t *\n\t * See:\n\t * https://math.stackexchange.com/questions/296794/finding-the-transform-matrix-from-4-projected-points-with-javascript\n\t */\n\texport const flatProjectionMatrix = (matrix: DOMMatrix | DOMMatrixReadOnly): DOMMatrix => {\n\t\treturn new DOMMatrix([\n\t\t\tmatrix.m11,\n\t\t\tmatrix.m12,\n\t\t\t0,\n\t\t\tmatrix.m14,\n\n\t\t\tmatrix.m21,\n\t\t\tmatrix.m22,\n\t\t\t0,\n\t\t\tmatrix.m24,\n\n\t\t\t0,\n\t\t\t0,\n\t\t\t1,\n\t\t\t0,\n\n\t\t\tmatrix.m41,\n\t\t\tmatrix.m42,\n\t\t\t0,\n\t\t\tmatrix.m44,\n\t\t])\n\t}\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\nimport { isDynamicValue } from \"./DynamicValue.ts\"\n\ninterface Filters {\n\tbrightness: number | DynamicValue | undefined\n\tcontrast: number | DynamicValue | undefined\n\tgrayscale: number | DynamicValue | undefined\n\thueRotate: number | DynamicValue | undefined\n\tinvert: number | DynamicValue | undefined\n\tsaturate: number | DynamicValue | undefined\n\tsepia: number | DynamicValue | undefined\n}\n\nexport interface WithFilters extends Filters {\n\tblur: number | DynamicValue | undefined\n\tbackgroundBlur: number | DynamicValue | undefined\n}\n\nexport const filterDefaults: WithFilters = {\n\tbrightness: undefined,\n\tcontrast: undefined,\n\tgrayscale: undefined,\n\thueRotate: undefined,\n\tinvert: undefined,\n\tsaturate: undefined,\n\tsepia: undefined,\n\tblur: undefined,\n\tbackgroundBlur: undefined,\n}\n\nconst key: keyof WithFilters = \"brightness\"\n\nexport function withFilters<T extends CanvasNode>(node: T): node is T & WithFilters {\n\treturn key in node\n}\n\nexport function hasAnyFilters(node: CanvasNode): boolean {\n\tif (!withFilters(node)) return false\n\n\tfor (const filterKey in filterDefaults) {\n\t\tconst value = node[filterKey as keyof WithFilters]\n\t\tif (isNumber(value) || isDynamicValue(value)) return true\n\t}\n\n\treturn false\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\nimport { isBreakpointVariant } from \"./WithVariant.ts\"\n\nexport interface WithOpacity {\n\topacity: number | DynamicValue\n}\n\nexport const opacityDefaults: WithOpacity = {\n\topacity: 1,\n}\n\nconst key: keyof WithOpacity = \"opacity\"\n\nexport function withOpacity<T extends CanvasNode>(node: T): node is T & WithOpacity {\n\t// FIXME: Checking for breakpoint variants within this trait check is a code\n\t// smell. The proper way to do this is by introducing a specific\n\t// BreakPointNode that doesn't have the opacity property. But doing that\n\t// requires a migration. And we don't know yet which other traits should\n\t// be removed. So we'll postpone that work for a later cleanup.\n\tif (isBreakpointVariant(node)) return false\n\n\treturn key in node\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { Point } from \"library/index.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\nimport { hasAnyFilters } from \"./WithFilters.ts\"\nimport { withOpacity } from \"./WithOpacity.ts\"\nimport { isOverflowVisuallyHidden } from \"./WithOverflow.ts\"\n\nexport interface WithTransforms {\n\tscale: number | undefined\n\n\trotateX: number | undefined\n\trotateY: number | undefined\n\trotate3d: boolean | undefined\n\n\tskewX: number | undefined\n\tskewY: number | undefined\n\n\ttranslateZ: number | undefined\n\n\ttransformStylePreserve3d: boolean | undefined\n\tbackfaceVisibility: boolean | undefined\n\n\tperspective: number | DynamicValue | undefined\n\n\ttransformOriginX: number | undefined\n\ttransformOriginY: number | undefined\n}\n\nexport type Transforms = Record<\n\tkeyof Pick<WithTransforms, \"scale\" | \"rotateX\" | \"rotateY\" | \"skewX\" | \"skewY\" | \"translateZ\">,\n\tnumber\n> & { rotate: number; x: number; y: number }\n\nexport const identity: Transforms = {\n\tscale: 1,\n\trotate: 0,\n\trotateX: 0,\n\trotateY: 0,\n\tskewX: 0,\n\tskewY: 0,\n\ttranslateZ: 0,\n\tx: 0,\n\ty: 0,\n}\n\nexport const transformDefaults = {\n\tscale: undefined,\n\n\trotateX: undefined,\n\trotateY: undefined,\n\trotate3d: undefined,\n\n\tskewX: undefined,\n\tskewY: undefined,\n\n\ttranslateZ: undefined,\n\n\ttransformStylePreserve3d: undefined,\n\tbackfaceVisibility: undefined,\n\n\tperspective: undefined,\n\n\ttransformOriginX: undefined,\n\ttransformOriginY: undefined,\n} satisfies WithTransforms\n\nconst key: keyof WithTransforms = \"scale\"\nexport function withTransforms(node: CanvasNode): node is CanvasNode & WithTransforms {\n\treturn key in node\n}\n\n/**\n * Some CSS properties have values that are considered to force \"grouping\": they\n * require that their element and its descendants are rendered as a group before\n * being composited with other elements; these include opacity, filters and\n * properties that affect clipping. Consequently, when used on an element with\n * transform-style:preserve-3d, they change the used value to flat and prevent\n * it from creating or extending a 3D rendering context.\n *\n * https://www.w3.org/TR/css-transforms-2/#3d-rendering-contexts\n */\nexport function creates3dContext<T extends CanvasNode>(node: T | null | undefined): boolean {\n\tif (!node || !withTransforms(node)) return false\n\tif (!node.transformStylePreserve3d) return false\n\n\tif (isOverflowVisuallyHidden(node)) return false\n\tif (hasAnyFilters(node)) return false\n\tif (withOpacity(node) && node.opacity !== 1) return false\n\n\treturn true\n}\n\nexport function getOriginPoint(node: CanvasNode): Point {\n\treturn withTransforms(node)\n\t\t? { x: node.transformOriginX ?? DEFAULT_ORIGIN, y: node.transformOriginY ?? DEFAULT_ORIGIN }\n\t\t: { x: DEFAULT_ORIGIN, y: DEFAULT_ORIGIN }\n}\n\n/** This is the minimum value we set for the perspective range. It's just a suggestion; users can choose their desired value. */\nexport const minPerspective = 500\n/** This is the maximum value we set for the perspective range. It's just a suggestion; users can choose their desired value. */\nexport const maxPerspective = 5000\n/** This is the default value we set for the perspective range. */\nexport const defaultPerspective = 1200\n\nexport const perspectiveEnabledDefaults: Pick<WithTransforms, \"perspective\"> = {\n\tperspective: defaultPerspective,\n}\n\nexport const DEFAULT_ORIGIN = 0.5\nexport const DEFAULT_SCALE = 1\nexport const DEFAULT_SKEW = 0\nexport const DEFAULT_ROTATION = 0\n\n/**\n * Check if a node has any non-identity transforms. A false value does not mean\n * the node doesn't have a skewed bounding box, only that it doesn't skew it's\n * own bounding box.\n */\nexport function hasNonIdentityTransforms(node: CanvasNode | null | undefined): boolean {\n\tif (!node || !withTransforms(node)) return false\n\n\tif (node.rotate3d && isNumber(node.rotateX) && node.rotateX !== 0) return true\n\tif (node.rotate3d && isNumber(node.rotateY) && node.rotateY !== 0) return true\n\n\tif (isNumber(node.scale) && node.scale !== 1) return true\n\tif (isNumber(node.skewX) && node.skewX !== 0) return true\n\tif (isNumber(node.skewY) && node.skewY !== 0) return true\n\tif (isNumber(node.translateZ) && node.translateZ !== 0) return true\n\tif (isNumber(node.perspective)) return true\n\n\treturn false\n}\n\nexport function getTransforms(node: CanvasNode): WithTransforms | undefined {\n\tif (!withTransforms(node)) return\n\n\treturn {\n\t\tscale: node.scale,\n\t\trotateX: node.rotateX,\n\t\trotateY: node.rotateY,\n\t\trotate3d: node.rotate3d,\n\t\tskewX: node.skewX,\n\t\tskewY: node.skewY,\n\t\ttranslateZ: node.translateZ,\n\t\ttransformStylePreserve3d: node.transformStylePreserve3d,\n\t\tbackfaceVisibility: node.backfaceVisibility,\n\t\tperspective: node.perspective,\n\t\ttransformOriginX: node.transformOriginX,\n\t\ttransformOriginY: node.transformOriginY,\n\t}\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\n\nexport const positionTypeOptions = [\"sticky\", \"fixed\", \"absolute\"] as const\ntype PositionTypeOption = (typeof positionTypeOptions)[number]\nexport type PositionType = PositionTypeOption | undefined\n\nconst values = new Set<string>(positionTypeOptions)\nexport function isPositionType(positionType: unknown): positionType is PositionTypeOption {\n\treturn isString(positionType) && values.has(positionType)\n}\n\nexport interface WithPositionType {\n\tposition: PositionType\n\tpositionStickyTop: number | undefined\n\tpositionStickyRight: number | undefined\n\tpositionStickyBottom: number | undefined\n\tpositionStickyLeft: number | undefined\n}\n\nexport const positionTypeDefaults: WithPositionType = {\n\tposition: undefined,\n\tpositionStickyTop: undefined,\n\tpositionStickyRight: undefined,\n\tpositionStickyBottom: undefined,\n\tpositionStickyLeft: undefined,\n}\n\nconst positionTypeKey: keyof WithPositionType = \"position\"\nexport function withPositionType<N extends CanvasNode>(node: N | null | undefined): node is N & WithPositionType {\n\tif (!node) return false\n\tif (node.__unsafeIsSlotPropertyChildNode()) return false\n\treturn positionTypeKey in node\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport type { CanvasNode, CanvasTree } from \"document/models/CanvasTree/index.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { withShape } from \"library/render/traits/Shape.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { isDesignPageNode, isSlotPropertyNode } from \"../../nodes/utils/nodeCheck.ts\"\nimport { hasAnyLayout } from \"../WithLayout.ts\"\nimport type { WithPositionType } from \"../WithPositionType.ts\"\nimport { withPositionType } from \"../WithPositionType.ts\"\nimport { isBreakpointVariant } from \"../WithVariant.ts\"\nimport { canNodeProvideViewportRect } from \"./viewportHelpers.ts\"\n\nexport function isPositionFixed<N extends CanvasNode>(node: N | null | undefined): node is N & WithPositionType {\n\treturn withPositionType(node) && node.position === \"fixed\"\n}\n\n/**\n * Determine if the node has position: absolute *inside a stack or a grid*.\n * Note: don\u2019t use this function for nodes outside of a layout \u2013 this function\n * isn\u2019t designed to handle that and *will* return incorrect values.\n */\nexport function isPositionAbsolute<N extends CanvasNode>(node: N | null | undefined): node is N & WithPositionType {\n\treturn withPositionType(node) && node.position === \"absolute\"\n}\n\n/**\n * Determine if the node has position: sticky *inside a stack or a grid*.\n * Note: don\u2019t use this function for nodes outside of a layout \u2013 this function\n * isn\u2019t designed to handle that and might return incorrect values.\n */\nexport function isPositionSticky<N extends CanvasNode>(node: N | null | undefined): node is N & WithPositionType {\n\treturn withPositionType(node) && node.position === \"sticky\"\n}\n\n/**\n * Determine if the node is position relative *inside a stack or a grid*.\n * Note: don\u2019t use this function for nodes outside of a layout \u2013 this function\n * isn\u2019t designed to handle that and *will* return incorrect values.\n *\n * @param parent Whenever possible, provide the node's current or intended parent to\n * accurately determine its position. While usually it is safe to use\n * `node.cache.parentDirected` to evaluate whether the\n * node is a stack or grid child this can lead to unexpected results, for\n * instance when re-parenting. Unfortunately it is not currently possible to\n * always require a parent, as to many paths in Framer require this function\n * without knowledge of the parent.\n */\nexport function isPositionRelative(node: CanvasNode, parent?: CanvasNode | null): boolean {\n\tif (parent) {\n\t\tif (isSlotPropertyNode(parent)) return true\n\t} else if (node.__unsafeIsSlotPropertyChildNode()) {\n\t\treturn true\n\t}\n\tconst isParentDirected = parent ? hasAnyLayout(parent) : Boolean(node.cache.parentDirected)\n\treturn isParentDirected && !isPositionFixed(node) && !isPositionAbsolute(node)\n}\n\nexport function canBePositionFixed<N extends CanvasNode>(tree: CanvasTree, node: N): node is N & WithPositionType {\n\tif (!withPositionType(node)) return false\n\tif (withShape(node)) return false\n\n\tconst parent = tree.getParent(node.id)\n\tif (!parent || !tree.isGroundNode(parent)) return false\n\tif (isSlotPropertyNode(parent)) return false\n\n\tconst scope = tree.getScopeNodeFor(parent)\n\n\t// In a design page, any ground nodes supporting the trait should allow fixed children.\n\t// Otherwise, only breakpoints can have fixed children.\n\tif (isDesignPageNode(scope)) {\n\t\treturn true\n\t}\n\n\treturn isBreakpointVariant(parent)\n}\n\n/**\n * Determine if the node can have position: absolute *inside a stack or a grid*.\n * NOTE: don\u2019t use this function for nodes outside of a layout \u2013 those can\n * always have position: absolute, but this function isn\u2019t designed to handle\n * that and will return incorrect values.\n *\n * @param parent Whenever possible, provide the node's current or intended parent to\n * accurately determine its position. While usually it is safe to use\n * `node.cache.parentDirected` to evaluate whether the node is a stack or grid\n * child this can lead to unexpected results, for instance when re-parenting.\n * Unfortunately it is not currently possible to always require a parent, as to\n * many paths in Framer require this function without knowledge of the parent.\n */\nexport function canBePositionAbsolute<N extends CanvasNode>(\n\tnode: N,\n\tparent?: CanvasNode | null,\n): node is N & WithPositionType {\n\tconst isParentDirected = parent ? hasAnyLayout(parent) : Boolean(node.cache.parentDirected)\n\treturn withPositionType(node) && isParentDirected\n}\n\n/**\n * Determine if the node can have position: sticky *inside a stack or a grid*.\n * NOTE: don\u2019t use this function for nodes outside of a layout \u2013 this function\n * isn\u2019t designed to handle that and might return incorrect values.\n *\n * @param parent Whenever possible, provide the node's current or intended parent to\n * accurately determine its position. While usually it is safe to use\n * `node.cache.parentDirected` to evaluate whether the node is a stack or grid\n * child this can lead to unexpected results, for instance when re-parenting.\n * Unfortunately it is not currently possible to always require a parent, as to\n * many paths in Framer require this function without knowledge of the parent.\n */\nexport function canBePositionSticky<N extends CanvasNode>(\n\tnode: N | null | undefined,\n\tparent?: CanvasNode | null,\n): node is N & WithPositionType {\n\tif (isSlotPropertyNode(parent)) return false\n\tconst isParentDirected = parent ? hasAnyLayout(parent) : Boolean(node?.cache.parentDirected)\n\t// Only nodes that are inside a stack can be position sticky\n\treturn withPositionType(node) && isParentDirected && !withShape(node)\n}\n\nexport function positionTypeUpdateForNewParent(\n\tnode: CanvasNode | null | undefined,\n\tnewParent?: CanvasNode | null,\n): Partial<WithPositionType> | undefined {\n\tif (!node || !withPositionType(node) || isUndefined(node.position)) return undefined\n\tif (!newParent) return { position: undefined }\n\n\tswitch (node.position) {\n\t\tcase \"sticky\":\n\t\t\tif (!hasAnyLayout(newParent)) break\n\t\t\treturn {\n\t\t\t\tposition: \"sticky\",\n\t\t\t}\n\t\tcase \"fixed\":\n\t\t\tif (!canNodeProvideViewportRect(newParent)) break\n\t\t\treturn {\n\t\t\t\tposition: \"fixed\",\n\t\t\t}\n\t\tcase \"absolute\":\n\t\t\tif (!hasAnyLayout(newParent)) break\n\t\t\treturn {\n\t\t\t\tposition: \"absolute\",\n\t\t\t}\n\t\tdefault:\n\t\t\tassertNever(node.position)\n\t}\n\n\treturn { position: undefined }\n}\n\nexport function scopeTypeSupportsPositionFixed(scopeType: ScopeType) {\n\tswitch (scopeType) {\n\t\tcase ScopeType.WebPage:\n\t\tcase ScopeType.LayoutTemplate:\n\t\tcase ScopeType.DesignPage:\n\t\t\treturn true\n\t\tcase ScopeType.Analytics:\n\t\tcase ScopeType.CanvasPage:\n\t\tcase ScopeType.ContentManagement:\n\t\tcase ScopeType.LocalizationGlossary:\n\t\tcase ScopeType.Routes:\n\t\tcase ScopeType.SmartComponent:\n\t\tcase ScopeType.VectorSet:\n\t\tcase ScopeType.CustomCode:\n\t\t\treturn false\n\t\tdefault:\n\t\t\tassertNever(scopeType)\n\t}\n}\n", "import type { AnyComponentLoader, ComponentLoader } from \"@framerjs/framer-runtime\"\nimport { assert } from \"@framerjs/shared\"\nimport { FramePoint, type FramePoints } from \"document/models/FramePoint.ts\"\nimport { Matrix } from \"document/models/Matrix.ts\"\nimport type { RenderId } from \"document/utils/RenderId.ts\"\nimport { Point, Polygon, Rect } from \"library/index.ts\"\nimport type { CanvasTree } from \"../CanvasTree.ts\"\nimport type { NodeRender } from \"../NodeRender.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport { isDrawableNode, isVectorNode } from \"../nodes/TreeNode.ts\"\nimport { getBreakpointForNode } from \"../nodes/utils/breakpointHelpers.ts\"\nimport { isOverlayNode } from \"../nodes/utils/nodeCheck.ts\"\nimport { isFixedOrRelativeOverlay, isValidOverlay, nodeIsInOverlay } from \"../nodes/utils/overlayHelpers.ts\"\nimport { withDOMLayout } from \"../traits/WithDOMLayout.ts\"\nimport { hasFloatingPosition } from \"../traits/WithFloatingPosition.ts\"\nimport { getLayoutType } from \"../traits/WithLayout.ts\"\nimport { isOverflowVisuallyHidden } from \"../traits/WithOverflow.ts\"\nimport type { ParentSizeInfo } from \"../traits/WithRect.ts\"\nimport { constrainHeight, constrainWidth } from \"../traits/WithSizeConstraints.ts\"\nimport { hasViewportHeight, hasViewportWidth } from \"../traits/WithSizeDimensionType.ts\"\nimport { creates3dContext } from \"../traits/WithTransforms.ts\"\nimport type { WithViewport } from \"../traits/WithViewport.ts\"\nimport { canBePositionFixed, isPositionFixed } from \"../traits/utils/positionTypeHelpers.ts\"\nimport {\n\tcanNodeProvideViewportRect,\n\tgetViewportHeight,\n\tgetViewportProviderForNode,\n\tsupportsViewportSizing,\n} from \"../traits/utils/viewportHelpers.ts\"\n\nexport function convertCornerPointsToCanvas(\n\ttree: CanvasTree,\n\tnode: CanvasNode,\n\tallowCache: boolean = true,\n\trect?: Rect | undefined,\n\trenderId: RenderId = node.id,\n): Point[] {\n\t// When a frame is provided, we can't trust the cache but have to recalculate the value with the given frame.\n\tconst renderInstance = node.cache.getRenderInstance(renderId)\n\tif (allowCache && !rect && renderInstance?.cornerPoints) {\n\t\treturn renderInstance.cornerPoints\n\t}\n\n\tconst cornerPointsAtOrigin = Rect.pointsAtOrigin(\n\t\trect ?? tree.getRect(node, undefined, undefined, undefined, renderId),\n\t)\n\treturn Matrix.convertPointsWithClipping(\n\t\ttransformMatrixToNode(tree, node, undefined, undefined, renderId),\n\t\tcornerPointsAtOrigin,\n\t)\n}\n\nexport function convertRectToCanvasWithRotation(\n\ttree: CanvasTree,\n\tnode: CanvasNode,\n\t/**\n\t * Optionally provide a component loader instance if you are getting the\n\t * rect of a code component node, and want optional size constraints\n\t * that may be included in that components annotations to be\n\t * incorporated into the constrained rect.\n\t */\n\tcomponentLoader?: ComponentLoader,\n\tframe?: Rect,\n): Rect & { rotation: number } {\n\tconst cornerPoints = convertCornerPointsToCanvas(tree, node, true, frame)\n\n\t// If a node is measured, we don't need to constrain the rect created\n\t// from points to the nodes size constraints, as the browser will have\n\t// handled that for us. However, this is not the case if the node is not\n\t// measured, and it's rect is created by Framer. In that case we will\n\t// need to ensure the rect is constrained by its size constraints.\n\tconst pointsIncludeConstraints = withDOMLayout(node) && node.usesDOMRectCached()\n\n\tconst parentSizeInfo = getParentSizeInfo(tree, node)\n\tconst [c1, c2, c3] = cornerPoints as [Point, Point, Point]\n\n\tlet width = Point.distance(c1, c2)\n\tlet height = Point.distance(c2, c3)\n\tif (!pointsIncludeConstraints) {\n\t\twidth = constrainWidth(node, width, componentLoader, parentSizeInfo)\n\t\theight = constrainHeight(node, height, componentLoader, parentSizeInfo)\n\t}\n\n\tconst topEdgeAngle = Point.angleFromX(c1, c2)\n\t// The rectangle can be flipped by rotate X/Y\n\tconst flipped = !Polygon.isClockwise(cornerPoints)\n\tconst rotation = flipped ? topEdgeAngle - 90 : topEdgeAngle\n\treturn { ...c1, width, height, rotation }\n}\n\nexport function getCornerPointsOnCanvasWithZoom(\n\ttree: CanvasTree,\n\tnode: CanvasNode,\n\tzoom: number,\n): [Point, Point, Point, Point] {\n\treturn convertCornerPointsToCanvas(tree, node).map(corner => Point.multiply(corner, zoom)) as [\n\t\tPoint,\n\t\tPoint,\n\t\tPoint,\n\t\tPoint,\n\t]\n}\nexport function convertPointToCanvas(\n\ttree: CanvasTree,\n\tnode: CanvasNode,\n\tpoint: Point,\n\tincludeNode = true,\n\trectOverride?: Rect,\n\trenderId: RenderId = node.id,\n): Point {\n\tif (includeNode && !rectOverride) {\n\t\tconst renderInstance = node.cache.getRenderInstance(renderId)\n\t\tif (renderInstance?.matrix) {\n\t\t\treturn Matrix.convertPoint(renderInstance.matrix, point)\n\t\t}\n\t}\n\n\treturn Matrix.convertPoint(transformMatrixToNode(tree, node, includeNode, false, renderId), point)\n}\n\n/**\n * Get the frame points in the transformed rectangle, relative to the bounding rect and ignoring rotations.\n * For example, if a frame is rotated 180 degrees, its original top-left corner is now the {fx: 1, fy: 1} point:\n *\n * frame rect {x: 100, y: 100, width: 50, height: 50}\n * original top-left corner: {x: 50, y: 50, fx: 1, fy: 1}\n * original bottom-right corner: {x: 0, y: 0, fx: 0, fy: 0}\n *\n *        br\n *          o\u2500\u2500o\u2500\u2500o\n *          \u2502     \u2502\n *          o  o  o\n *          \u2502     \u2502\n *          o\u2500\u2500o\u2500\u2500o tl\n *\n * This helps determine the correct handle cursors to show regardless of the rotation.\n */\nexport function convertFramePointsToCanvas(tree: CanvasTree, node: CanvasNode): FramePoints | null {\n\tconst nodeRect = tree.getRect(node)\n\tconst framePoints = FramePoint.fromFrame(nodeRect)\n\n\tconst matrix = transformMatrixToNode(tree, node)\n\tconst framePointsOnCanvas = [] as unknown as FramePoints\n\tfor (const point of framePoints) {\n\t\tconst clipped = Matrix.pointClipsThroughScreen(matrix, point)\n\t\tif (clipped) return null\n\n\t\tframePointsOnCanvas.push({ ...point, ...convertPointToCanvas(tree, node, point) })\n\t}\n\n\tconst { x: minX, y: minY } = Rect.boundingRectFromPoints(framePointsOnCanvas)\n\treturn framePointsOnCanvas.map(point => ({ ...point, x: point.x - minX, y: point.y - minY })) as FramePoints\n}\n\nexport function convertFrameToCanvas(\n\ttree: CanvasTree,\n\tnode: CanvasNode,\n\trect?: Rect,\n\trenderId: RenderId = node.id,\n): Readonly<Rect> {\n\tif (!rect) return getCanvasBoundingRectCached(tree, node, renderId)\n\n\tconst corners = Rect.cornerPoints(rect)\n\tconst convertedCorners = corners.map(corner => convertPointToCanvas(tree, node, corner, true, undefined, renderId))\n\treturn Rect.boundingRectFromPoints(convertedCorners)\n}\n\nexport function getBoundingFrameForNodes(tree: CanvasTree, nodes: CanvasNode[]): Rect {\n\tif (nodes.length === 0) {\n\t\treturn { x: 0, y: 0, width: 0, height: 0 }\n\t}\n\n\tif (nodes.length === 1) {\n\t\t// We know this node exists because we checked the length above.\n\t\t// biome-ignore lint/style/noNonNullAssertion: @TODO: Add explanation\n\t\treturn convertFrameToCanvas(tree, nodes[0]!)\n\t}\n\n\tlet minX = Infinity\n\tlet minY = Infinity\n\tlet maxX = -Infinity\n\tlet maxY = -Infinity\n\tfor (const node of nodes) {\n\t\tconst frame = convertFrameToCanvas(tree, node)\n\n\t\tlet x = frame.x\n\t\tlet y = frame.y\n\t\tlet x2 = x + frame.width\n\t\tlet y2 = y + frame.height\n\n\t\tif (Math.max(x, y, x2, y2) > Number.MAX_SAFE_INTEGER || Math.min(x, y, x2, y2) < Number.MIN_SAFE_INTEGER) {\n\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\tconsole.warn(\"Encountered bounding box with corrupted dimensions. Please contact Framer support.\")\n\t\t\tx = y = x2 = y2 = 0\n\t\t}\n\n\t\tif (x < minX) {\n\t\t\tminX = x\n\t\t}\n\t\tif (y < minY) {\n\t\t\tminY = y\n\t\t}\n\t\tif (x2 > maxX) {\n\t\t\tmaxX = x2\n\t\t}\n\t\tif (y2 > maxY) {\n\t\t\tmaxY = y2\n\t\t}\n\t}\n\treturn { x: minX, y: minY, width: maxX - minX, height: maxY - minY }\n}\n\nexport function convertPointToNode(\n\ttree: CanvasTree,\n\tnode: CanvasNode | null,\n\tpoint: Point,\n\tincludeNode = true,\n\trenderId?: RenderId,\n): Point {\n\tif (!node) return point\n\n\trenderId ??= node.id\n\n\tif (includeNode) {\n\t\tconst renderInstance = node.cache.getRenderInstance(renderId)\n\t\tif (renderInstance?.matrix) {\n\t\t\treturn Matrix.convertPoint(renderInstance.matrix.inverse(), point)\n\t\t}\n\t}\n\n\treturn Matrix.convertPoint(transformMatrixToNode(tree, node, includeNode, false, renderId).invertSelf(), point)\n}\n\nexport function convertCanvasFrameToNode(\n\ttree: CanvasTree,\n\tnode: CanvasNode | null,\n\tframe: Rect,\n\tincludeLayer = true,\n): Rect {\n\tif (node === null) {\n\t\treturn frame\n\t}\n\tconst corners = Rect.cornerPoints(frame)\n\tconst convertedCorners = corners.map(corner => {\n\t\treturn convertPointToNode(tree, node, corner, includeLayer)\n\t})\n\treturn Rect.boundingRectFromPoints(convertedCorners)\n}\n\nexport function convertPointFromNodeToDescendant(\n\ttree: CanvasTree,\n\tnode: CanvasNode,\n\tdescendant: CanvasNode,\n\tpoint: Point,\n\tincludeNode = true,\n): Point {\n\tlet ancestorFound = false\n\tlet convertedPoint = point\n\tlet convertedGroundNodePoint: Point | null = null\n\tconst ancestorsReverse = [...descendant.ancestors()].reverse()\n\tif (includeNode) {\n\t\tancestorsReverse.push(descendant)\n\t}\n\tfor (const ancestor of ancestorsReverse) {\n\t\tif (!ancestorFound) {\n\t\t\tancestorFound = ancestor.id === node.id\n\t\t\tcontinue\n\t\t}\n\n\t\tconst matrix = ancestor.originAdjustedMatrix(tree.getParentSizeInfo(ancestor)).inverse()\n\t\tif (isOverlayNode(ancestor) && convertedGroundNodePoint) {\n\t\t\tconvertedPoint = Matrix.convertPoint(matrix, convertedGroundNodePoint)\n\t\t} else {\n\t\t\tconvertedPoint = Matrix.convertPoint(matrix, convertedPoint)\n\t\t}\n\n\t\tif (tree.isGroundNode(ancestor)) {\n\t\t\tconvertedGroundNodePoint = convertedPoint\n\t\t}\n\t}\n\tif (!ancestorFound) throw Error(\"Node is not a descendant\")\n\treturn convertedPoint\n}\n\nexport function outOfClippedBounds(tree: CanvasTree, points: Point[], node: CanvasNode, renderId: RenderId = node.id) {\n\t// Overlay nodes and its descendants should not be bound by the trigger node ancestor.\n\tif (isFixedOrRelativeOverlay(node)) return false\n\n\tconst inOverlay = nodeIsInOverlay(node)\n\tlet hasSeenOverlay = false\n\n\tconst ancestorNodeRenders = getSelfAndAncestorNodeRenders(tree, node, renderId)\n\n\t// Remove self from the list\n\tancestorNodeRenders.shift()\n\n\tconst clippingAncestorRenders = ancestorNodeRenders.filter(ancestorRender => {\n\t\t// Overlay descendants should not be bound by nodes outside of its overlay ancestor.\n\t\tif (inOverlay) {\n\t\t\tif (hasSeenOverlay) return false\n\t\t\tif (isFixedOrRelativeOverlay(ancestorRender.node)) {\n\t\t\t\thasSeenOverlay = true\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\n\t\treturn isDrawableNode(ancestorRender.node) && isOverflowVisuallyHidden(ancestorRender.node)\n\t})\n\n\t// Check if the point is outside of any of the ancestor clipped bounds.\n\tconst outOfAnyAncestorClippedBounds = clippingAncestorRenders.some(\n\t\t({ node: ancestorNode, renderId: ancestorRenderId }) => {\n\t\t\tconst clippedBound = convertCornerPointsToCanvas(tree, ancestorNode, undefined, undefined, ancestorRenderId)\n\t\t\treturn !Polygon.intersects(points, clippedBound)\n\t\t},\n\t)\n\n\treturn outOfAnyAncestorClippedBounds\n}\n\nexport function getCanvasBoundingRectCached(tree: CanvasTree, node: CanvasNode, renderId: RenderId = node.id): Rect {\n\tconst renderInstance = node.cache.getRenderInstance(renderId)\n\tif (renderInstance?.canvasRect) {\n\t\treturn renderInstance.canvasRect\n\t}\n\n\tconst convertedCorners = convertCornerPointsToCanvas(tree, node, undefined, undefined, renderId)\n\tconst canvasRect = Rect.boundingRectFromPoints(convertedCorners)\n\n\tif (renderInstance) {\n\t\trenderInstance.canvasRect = canvasRect\n\t}\n\n\treturn canvasRect\n}\n\nexport function getSelfAndAncestorNodeRenders(tree: CanvasTree, node: CanvasNode, renderId: RenderId) {\n\tconst result: NodeRender[] = []\n\n\twhile (true) {\n\t\tresult.push({ node, renderId })\n\n\t\tconst parentNode = tree.get(node.parentid)\n\t\tif (!parentNode) break\n\n\t\tconst renderInstance = node.cache.getRenderInstance(renderId)\n\t\tconst parentRenderId = renderInstance?.parentRenderId ?? parentNode.id\n\n\t\tnode = parentNode\n\t\trenderId = parentRenderId\n\t}\n\n\treturn result\n}\n\n/**\n * Get the aggregate transform matrix to a node. This is identical to the\n * value saved to node.cache.matrix, so use that when possible.\n */\nexport function transformMatrixToNode(\n\ttree: CanvasTree,\n\tnode: CanvasNode,\n\tincludeNode = true,\n\tallowCache = true,\n\trenderId: RenderId = node.id,\n): DOMMatrix {\n\tconst renderInstance = node.cache.getRenderInstance(renderId)\n\tif (allowCache && includeNode && renderInstance?.matrix) {\n\t\treturn Matrix.identity().multiply(renderInstance.matrix)\n\t}\n\n\tconst ancestorNodeRenders = getSelfAndAncestorNodeRenders(tree, node, renderId)\n\tancestorNodeRenders.pop() // Remove root node\n\tif (!includeNode) ancestorNodeRenders.shift()\n\tancestorNodeRenders.reverse()\n\n\tlet aggregateMatrix = new DOMMatrix()\n\tlet groundNodeMatrix: DOMMatrix | null = null\n\n\tfor (const { node: ancestor, renderId: ancestorRenderId } of ancestorNodeRenders) {\n\t\tconst isTargetNode = node.id === ancestor.id\n\n\t\tif (isOverlayNode(ancestor)) {\n\t\t\tassert(groundNodeMatrix, \"Fixed Overlays must be a descendant of a ground node.\")\n\t\t\t// Overlay nodes are children of the trigger, but its matrix should be the same as the ground node, so\n\t\t\t// we reset the matrix to the ground node matrix. Create a new copy to avoid mutaing the\n\t\t\t// groundNodeMatrix when we run multiplySelf on the aggregateMatrix.\n\t\t\taggregateMatrix = new DOMMatrix().multiplySelf(groundNodeMatrix)\n\t\t} else {\n\t\t\tconst parentSizeInfo = tree.getParentSizeInfo(ancestor, undefined, undefined, undefined, ancestorRenderId)\n\t\t\tconst ancestorMatrix = ancestor.originAdjustedMatrix(parentSizeInfo, undefined, ancestorRenderId)\n\t\t\tconst descendantMatrix =\n\t\t\t\tcreates3dContext(ancestor) || isTargetNode ? ancestorMatrix : Matrix.flatProjectionMatrix(ancestorMatrix)\n\n\t\t\t// A relative overlay is positioned (and measured) relative to its parent's bounding client rect. Other\n\t\t\t// transforms on the parent (like rotation) should not be propagated to the overlay. Thus when we\n\t\t\t// encounter a relative overlay, we create a fresh matrix containing only the translation enough to\n\t\t\t// determine the parent bounding box.\n\t\t\tif (hasFloatingPosition(ancestor) && isValidOverlay(ancestor, tree)) {\n\t\t\t\tassert(parentSizeInfo.sizing, \"A floating node must have parent size info\", ancestor.id)\n\t\t\t\taggregateMatrix = Matrix.boundingRectMatrix(aggregateMatrix, parentSizeInfo.sizing).multiplySelf(\n\t\t\t\t\tdescendantMatrix,\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\taggregateMatrix = aggregateMatrix.multiplySelf(descendantMatrix)\n\t\t\t}\n\n\t\t\t// Record the ground node matrix. If we encounter an\n\t\t\t// OverlayNode, we will reset the aggregate matrix to this one.\n\t\t\tif (tree.isGroundNode(ancestor)) groundNodeMatrix = descendantMatrix\n\t\t}\n\t}\n\n\treturn aggregateMatrix\n}\n\nexport function getViewportRect(\n\ttree: CanvasTree,\n\tnode: CanvasNode,\n\tpixelAlign: boolean = true,\n\tpreferMinScreenHeight: boolean = true,\n): Rect | null {\n\tif (!canNodeProvideViewportRect(node)) return null\n\n\tconst rect = tree.getRect(node, pixelAlign)\n\treturn createViewportRect(node, rect, preferMinScreenHeight)\n}\n\nexport function getParentViewportRect(tree: CanvasTree, node: CanvasNode, allowCache: boolean = true): Rect | null {\n\tconst positionFixedNode = canBePositionFixed(tree, node) && isPositionFixed(node)\n\tif (!positionFixedNode) return null\n\n\tconst breakpointParent = tree.getNodeParent(node)\n\tif (!breakpointParent || !canNodeProvideViewportRect(breakpointParent)) return null\n\n\tif (allowCache && node.cache.viewportRect) return node.cache.viewportRect\n\n\treturn getViewportRect(tree, breakpointParent)\n}\n\nexport function getRect(\n\ttree: CanvasTree,\n\tnode: CanvasNode,\n\tpixelAlign: boolean = true,\n\tallowParentSizeInfoCache: boolean = true,\n\t/**\n\t * Optionally provide a component loader instance if you are getting the\n\t * rect of a code component node, and want optional size constraints\n\t * that may be included in that components annotations to be\n\t * incorporated into the constrained rect.\n\t */\n\tcomponentLoader?: AnyComponentLoader,\n\trenderId: RenderId = node.id,\n): Rect {\n\tconst renderInstance = node.cache.getRenderInstance(renderId)\n\tif (renderInstance?.parentDirectedRect) {\n\t\treturn { ...renderInstance.parentDirectedRect }\n\t}\n\n\tconst parent = tree.getNodeParent(node)\n\tconst parentUsesDOMRect = parent && withDOMLayout(parent) && parent.usesDOMRectCached()\n\tconst nodeUsesDOMRect = withDOMLayout(node) && node.usesDOMRectCached()\n\n\tconst shouldPixelAlign = pixelAlign && !isVectorNode(node) && !(nodeUsesDOMRect || parentUsesDOMRect)\n\tconst parentSizeInfo = tree.getParentSizeInfo(node, undefined, shouldPixelAlign, allowParentSizeInfoCache, renderId)\n\treturn node.rect(parentSizeInfo, shouldPixelAlign, componentLoader, renderId)\n}\n\nexport function getParentSizeInfo(\n\ttree: CanvasTree,\n\tnode: CanvasNode,\n\t/**\n\t * If the parentNode is not given (undefined), we will try to get the current parent if we couldn't use the\n\t * cached sizing info. Passing a null parentNode means the node has no parent.\n\t */\n\tparentNode?: CanvasNode | null,\n\tpixelAlign: boolean = true,\n\tallowCache: boolean = true,\n\trenderId: RenderId = node.id,\n): ParentSizeInfo {\n\tconst renderInstance = node.cache.getRenderInstance(renderId)\n\n\tconst isOverlay = isOverlayNode(node)\n\tconst usesViewportRect = isOverlay || (canBePositionFixed(tree, node) && isPositionFixed(node))\n\t// If a parentNode is given, its rect might not match node.cache.parentRect, so don't use the cache here.\n\tif (allowCache && renderInstance && parentNode === undefined) {\n\t\tconst viewport = node.cache.viewportRect\n\n\t\tconst parentRect = renderInstance.parentRect ?? null\n\t\tconst sizing = usesViewportRect ? viewport : mergeViewportAndParentRect(tree, node, viewport, parentRect)\n\t\tconst positioning = usesViewportRect ? viewport : parentRect\n\t\tif (sizing || positioning || viewport) {\n\t\t\tconst layout = node.cache.parentDirected || null\n\t\t\treturn { sizing, positioning, viewport, layout }\n\t\t}\n\t}\n\n\tconst isViewportHeightNode = hasViewportHeight(node)\n\n\tlet viewportProvider: (CanvasNode & WithViewport) | undefined = undefined\n\tif (parentNode) {\n\t\t// when a new parent is provided, use the viewport data on that new parent.\n\t\tviewportProvider = getViewportProviderForNode(tree, parentNode.id)\n\t} else if (canNodeProvideViewportRect(node)) {\n\t\t// If the node itself is a variant, we can early return a\n\t\t// ParentSizeInfo object that only has a viewport value, since it\n\t\t// doesn't have any parent to inform its size.\n\t\treturn {\n\t\t\tsizing: null,\n\t\t\tpositioning: null,\n\t\t\t// We must use `node.rect()` rather than `tree.getRect(node)` to\n\t\t\t// avoid an infinite loop.\n\t\t\tviewport: createViewportRect(node, node.rect(null, pixelAlign, undefined, renderId), !isViewportHeightNode),\n\t\t\tlayout: null,\n\t\t}\n\t} else {\n\t\tviewportProvider = getViewportProviderForNode(tree, node.id)\n\t}\n\n\tconst viewport = viewportProvider\n\t\t? createViewportRect(viewportProvider, viewportProvider.rect(null, pixelAlign), !isViewportHeightNode)\n\t\t: null\n\n\tlet parent: CanvasNode | null = null\n\tif (parentNode) {\n\t\tparent = isOverlay ? getBreakpointForNode(tree, parentNode.id) : parentNode\n\t} else if (parentNode !== null) {\n\t\t// respect if the given parentNode is null\n\t\tparent = isOverlay ? getBreakpointForNode(tree, node.id) : tree.getNodeParent(node)\n\t}\n\tif (!parent) return { sizing: null, positioning: null, viewport: viewport, layout: null }\n\n\tconst parentRect = tree.getRect(parent, pixelAlign, undefined, undefined, renderInstance?.parentRenderId)\n\tconst sizing = usesViewportRect ? viewport : mergeViewportAndParentRect(tree, node, viewport, parentRect)\n\tconst positioning = usesViewportRect ? viewport : parentRect\n\n\treturn { sizing, positioning, viewport, layout: getLayoutType(parent) }\n}\n\n/**\n * Maintain the position (x/y) of the parent rect while using the viewport size for vw/vh nodes. If the node is not\n * using viewport units, the returned result would be the same as the given parentRect.\n */\nfunction mergeViewportAndParentRect(\n\ttree: CanvasTree,\n\tnode: CanvasNode,\n\tviewportRect: Rect | null,\n\tparentRect: Rect | null,\n): Rect | null {\n\tif (!parentRect) return null\n\n\tif (!supportsViewportSizing(tree, node)) {\n\t\treturn parentRect\n\t}\n\n\tconst rect = { ...parentRect }\n\n\tif (viewportRect && hasViewportWidth(node)) {\n\t\trect.width = viewportRect.width\n\t}\n\n\tif (viewportRect && hasViewportHeight(node)) {\n\t\trect.height = viewportRect.height\n\t}\n\n\treturn rect\n}\n\nfunction createViewportRect(variant: CanvasNode & WithViewport, rect: Rect, preferMinScreenHeight = true) {\n\treturn { ...rect, height: getViewportHeight(variant, rect, preferMinScreenHeight) }\n}\n", "import { getLogger } from \"@framerjs/shared\"\nimport type { CanvasNode, CanvasTree } from \"document/models/CanvasTree/index.ts\"\nimport { generateReplicaChildId } from \"document/models/CanvasTree/nodes/TemplateHelper.ts\"\nimport { isFixedOrRelativeOverlay } from \"document/models/CanvasTree/nodes/utils/overlayHelpers.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { IsReplica, IsReplicaOrReplicaChild } from \"document/models/CanvasTree/traits/WithTemplate.ts\"\nimport {\n\tgetMasterAncestor,\n\tisHiddenMaster,\n\tisMaster,\n\tisReplica,\n} from \"document/models/CanvasTree/traits/WithTemplate.ts\"\nimport { isVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { isBoolean, isUndefined } from \"utils/typeChecks.ts\"\nconst log = getLogger(\"in-variant-editing\")\n\nexport function getRelatedReplicaNodes<N extends CanvasNode>(\n\ttree: CanvasTree,\n\toriginalNode: N,\n): { relatedNode: N & IsReplicaOrReplicaChild; replicaRoot: CanvasNode & IsReplica }[] {\n\tconst result: { relatedNode: N & IsReplicaOrReplicaChild; replicaRoot: CanvasNode & IsReplica }[] = []\n\tconst primary = tree.getAncestorThatMatches(originalNode, isMaster, true)\n\tif (!primary) return result\n\tprimary.cache.replicaInstances?.forEach(replicaId => {\n\t\tconst replica = tree.getNode<CanvasNode & IsReplica>(replicaId)\n\t\tif (!replica) return\n\t\tconst isNodeReplicaRoot = replica.originalid === originalNode.id\n\t\tif (isNodeReplicaRoot) {\n\t\t\tresult.push({ relatedNode: replica as unknown as N & IsReplicaOrReplicaChild, replicaRoot: replica })\n\t\t} else {\n\t\t\tconst relatedNodeId = generateReplicaChildId(replica.id, originalNode.id)\n\t\t\tconst relatedNode = tree.getNode<CanvasNode & N & IsReplicaOrReplicaChild>(relatedNodeId)\n\t\t\tif (relatedNode) {\n\t\t\t\tresult.push({ relatedNode, replicaRoot: replica })\n\t\t\t}\n\t\t}\n\t})\n\n\treturn result\n}\n\n/** Ignores downstream gesture variants */\nfunction getRelatedVariantNodesIgnoringOwnGestures(\n\ttree: CanvasTree,\n\tnode: CanvasNode,\n):\n\t| {\n\t\t\trelatedNode: CanvasNode\n\t\t\trelatedRoot: CanvasNode\n\t  }[]\n\t| null {\n\tconst originalid = node.originalid\n\tif (!originalid) return null\n\tconst variantGroundNode = tree.getGroundNodeFor(node)\n\tif (!isVariant(variantGroundNode)) return null\n\tconst scopeNode = tree.getScopeNodeFor(node)\n\tif (!scopeNode) return null\n\n\tconst originalNode = tree.getNode(originalid)\n\tif (!originalNode) return null\n\n\tconst masterNode = getMasterAncestor(originalNode)\n\tif (!masterNode) return null\n\tconst result: {\n\t\trelatedNode: CanvasNode\n\t\trelatedRoot: CanvasNode\n\t}[] = [{ relatedNode: originalNode, relatedRoot: masterNode }]\n\n\tscopeNode.getGroundNodes().forEach(groundNode => {\n\t\tif (!isVariant(groundNode)) return\n\t\tif (isMaster(groundNode)) return\n\t\tif (!isReplica(groundNode)) return\n\t\tif (groundNode.replicaInfo.inheritsFrom === variantGroundNode.id) return\n\t\tconst relatedNodeId = generateReplicaChildId(groundNode.id, originalid)\n\t\tconst relatedNode = tree.getNode(relatedNodeId)\n\t\tif (relatedNode) {\n\t\t\tresult.push({ relatedNode, relatedRoot: groundNode })\n\t\t}\n\t})\n\n\treturn result\n}\n\n/** Checks if the node is the only one visible in all variants. The current node must be itself\n * visible. And the other nodes must be invisible directly and not use a variable. */\nexport function isOnlyVisibleInCurrentVariant(tree: CanvasTree, node: CanvasNode): boolean {\n\treturn checkRelatedNodesAreHidden(tree, node, true)\n}\n\n/** Checks if the node is not visible in other variants. The current node can be itself visible or\n * invisible. And the other nodes must be invisible directly and not use a variable. */\nexport function isVisibleInOtherVariants(tree: CanvasTree, node: CanvasNode): boolean {\n\treturn !checkRelatedNodesAreHidden(tree, node, false)\n}\n\nfunction isOrIsInHiddenOverlay(tree: CanvasTree, node: CanvasNode) {\n\t// An overlay node (or its descendants) can be invisible because of toggling the edit mode, not controlled by the\n\t// actual visibility prop. If the node is (or in) a hidden overlay node, we don't want to push the changes to the\n\t// upstream. If the overlay is visible, it will be handled by the normal visibility check.\n\tif (isFixedOrRelativeOverlay(node)) return node.cache.overlayVisible === false\n\tconst overlayAncestor = tree.get(node.cache.overlayAncestorId)\n\tif (!overlayAncestor) return false\n\treturn overlayAncestor.cache.overlayVisible === false\n}\n\nfunction checkRelatedNodesAreHidden(tree: CanvasTree, node: CanvasNode, nodeMustBeVisible: boolean): boolean {\n\t// If the node itself is hidden, we don't check other nodes, because we don't want to update\n\t// upstream in that case.\n\tif (nodeMustBeVisible && node.cache.visible === false) return false\n\n\ttry {\n\t\tconst relatedNodesInfo = getRelatedVariantNodesIgnoringOwnGestures(tree, node)\n\t\tif (!relatedNodesInfo) return false\n\n\t\tconst relatedNodesAreHidden = relatedNodesInfo.every(({ relatedNode, relatedRoot }) => {\n\t\t\t// If the node inherits from a hidden master (symbol), we will never want to push the change to the\n\t\t\t// upstream.\n\t\t\tif (isHiddenMaster(relatedRoot)) return false\n\n\t\t\t// If any node is hidden due to a variable, we don't want to push any changes upstream.\n\t\t\tif (isDynamicValue(relatedNode.visible)) return false\n\n\t\t\t// If any node is hidden because of overlay edit mode, we don't want to push any changes upstream.\n\t\t\tif (isOrIsInHiddenOverlay(tree, relatedNode)) return false\n\n\t\t\t// Newly created nodes might not have their cache updated yet, so we compute the visibility in place\n\t\t\tif (isUndefined(relatedNode.cache.visible)) {\n\t\t\t\tconst parent = tree.getParent(relatedNode.id)\n\t\t\t\tif (parent && isBoolean(parent.cache.visible)) {\n\t\t\t\t\tconst parentVisible = parent.cache.visible\n\t\t\t\t\tconst relatedNodeVisible: boolean = relatedNode.visible\n\t\t\t\t\tconst isVisible = parentVisible && relatedNodeVisible\n\t\t\t\t\trelatedNode.cache.visible = isVisible\n\t\t\t\t} else if (node.cache.loadedFromDocumentJson) {\n\t\t\t\t\t// If we don't have our current visibility, _and_ we can't\n\t\t\t\t\t// derive it from the parent's cache, we want to report it\n\t\t\t\t\t// as an error, so that we can investigate what lead to this\n\t\t\t\t\t// state\n\t\t\t\t\tlog.reportError(\n\t\t\t\t\t\t\"isOnlyVisibleInCurrentVariant: cache.visible property not initialized, and not deducible from parent\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tnodeId: node.id,\n\t\t\t\t\t\t\trelatedNodeId: relatedNode.id,\n\t\t\t\t\t\t\tparentNodeId: parent?.id,\n\t\t\t\t\t\t\tnodeCacheVisible: node.cache.visible,\n\t\t\t\t\t\t\trelatedNodeCacheVisible: relatedNode.cache.visible,\n\t\t\t\t\t\t\tparentCacheVisible: parent?.cache.visible,\n\t\t\t\t\t\t\tloadedFromDocument: node.cache.loadedFromDocumentJson,\n\t\t\t\t\t\t\tparentLoadedFromDocument: parent?.cache.loadedFromDocumentJson,\n\t\t\t\t\t\t},\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Now that we might have computed visibility, we check again if the node itself is visible.\n\t\t\tif (relatedNode.id === node.id) {\n\t\t\t\tif (nodeMustBeVisible) return relatedNode.cache.visible\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (relatedNode.cache.visible === false) return true\n\t\t\treturn false\n\t\t})\n\n\t\treturn relatedNodesAreHidden\n\t} catch {\n\t\treturn false\n\t}\n}\n", "import type { CanvasTree } from \"document/models/CanvasTree/index.ts\"\n\nexport function getNameForDefaultLocale(tree: CanvasTree) {\n\treturn tree.root.getDefaultLocaleName(\"Default Locale\")\n}\n", "import type { VariableProviderMap } from \"../VariableProvider.ts\"\nimport type { VariableID } from \"../WithVariables.ts\"\n\nexport class EagerVariableProviderMap<Value> extends Map<VariableID, Value> implements VariableProviderMap<Value> {}\n", "import { getTextDirection } from \"document/components/chrome/shared/locales.ts\"\nimport type { Locale } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport type { Locale as RouterLocale } from \"library/router/types.ts\"\n\nexport function getLayoutDirectionValue(\n\tactiveLocale: Locale | RouterLocale | undefined,\n\tadaptLayoutToTextDirection: boolean,\n) {\n\tif (!adaptLayoutToTextDirection) return \"ltr\"\n\tif (!activeLocale) return \"ltr\"\n\n\treturn getTextDirection(activeLocale.code)\n}\n", "import type { EnumControlDescription } from \"library/render/types/PropertyControls.ts\"\n\nconst dataIdentifierSymbol = Symbol(\"dataIdentifier\")\n\ninterface DataIdentifierAndEnumFieldKey {\n\tdataIdentifier: string\n\tenumFieldKey: string\n}\n\n/** Easy lookup of data identifier and field key by control. Prevents having to add complex APIs. */\nexport function setDataIdentifierAndEnumFieldKeyForControl(\n\tcontrol: EnumControlDescription,\n\tdata: DataIdentifierAndEnumFieldKey,\n): void {\n\tcontrol[dataIdentifierSymbol] = data\n}\n\n/** Easy lookup of data identifier and field key by control. Prevents having to add complex APIs. */\nexport function getDataIdentifierAndEnumFieldKeyForControl(\n\tcontrol: EnumControlDescription,\n): DataIdentifierAndEnumFieldKey | null {\n\treturn control[dataIdentifierSymbol] ?? null\n}\n", "import type { SerializedVerifiedControlDescription, VerifiedControlDescription } from \"@framerjs/framer-runtime\"\nimport type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { getNameForDefaultLocale } from \"document/components/chrome/localization/getNameForDefaultLocale.ts\"\nimport type {\n\tCanvasNode,\n\tCanvasTree,\n\tLayoutTemplateNode,\n\tSmartComponentNode,\n\tWebPageNode,\n} from \"document/models/CanvasTree/index.ts\"\nimport {\n\tisLayoutTemplateNode,\n\tisSmartComponentNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type {\n\tCombinedVariableProviderControlMap,\n\tCombinedVariableProviderValueMap,\n\tVariableProviderControlMap,\n\tVariableProviderVariableMap,\n} from \"document/models/CanvasTree/traits/VariableProvider.ts\"\nimport type { Locale } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { defaultLocaleId } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport type { EnumVariableDefinition, VariableDefinition } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { EagerVariableProviderMap } from \"document/models/CanvasTree/traits/utils/EagerVariableProviderMap.ts\"\nimport { getLayoutDirectionValue } from \"document/utils/getLayoutDirectionValue.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport type { Locale as RouterLocale } from \"library/router/types.ts\"\nimport { setDataIdentifierAndEnumFieldKeyForControl } from \"utils/getDataIdentifierAndEnumFieldKeyForControl.ts\"\nimport { memoizeOne } from \"utils/memoizeOne.ts\"\n\nexport const localeVariableId = \"global_locale\"\nexport const layoutDirectionVariableId = \"global_layout_direction\"\nexport const localeProviderId = \"locale_provider_id\"\nexport const localeSourceIdentifier = \"locale_source_identifier\" as ModuleExportIdentifierString\n\nexport const leftToRightName = \"Left to Right\"\nexport const rightToLeftName = \"Right to Left\"\n\nexport type NodeProvidingLocaleEnumVariable = WebPageNode | SmartComponentNode | LayoutTemplateNode\n\nexport function isProvidingLocaleVariable(node: CanvasNode): node is NodeProvidingLocaleEnumVariable {\n\treturn isWebPageNode(node) || isSmartComponentNode(node) || isLayoutTemplateNode(node)\n}\n\nexport const getLocaleVariable: (tree: CanvasTree) => EnumVariableDefinition | null = (() => {\n\tlet previousDefaultLocaleName: string | undefined\n\tlet previousLocales: readonly Locale[] | undefined\n\tlet result: EnumVariableDefinition | undefined\n\n\treturn tree => {\n\t\tconst locales = tree.root.locales\n\t\tif (!locales || locales.length === 0) return null\n\n\t\tconst defaultLocaleName = getNameForDefaultLocale(tree)\n\n\t\tif (result && defaultLocaleName === previousDefaultLocaleName && locales === previousLocales) {\n\t\t\treturn result\n\t\t}\n\n\t\tpreviousDefaultLocaleName = defaultLocaleName\n\t\tpreviousLocales = locales\n\t\tresult = {\n\t\t\tid: localeVariableId,\n\t\t\ttype: ControlType.Enum,\n\t\t\tname: Dictionary.Locale,\n\t\t\tinitialValue: undefined,\n\t\t\tcases: [\n\t\t\t\t{ id: defaultLocaleId, name: getNameForDefaultLocale(tree) },\n\t\t\t\t...locales.map(locale => ({ id: locale.id, name: locale.name })),\n\t\t\t],\n\t\t}\n\n\t\treturn result\n\t}\n})()\n\nexport const getLayoutDirectionVariable: (tree: CanvasTree) => EnumVariableDefinition | null = (() => {\n\tlet result: EnumVariableDefinition | undefined\n\n\treturn tree => {\n\t\tconst locales = tree.root.locales\n\t\tif (!locales || locales.length === 0) return null\n\t\tif (result) return result\n\n\t\tresult = {\n\t\t\tid: layoutDirectionVariableId,\n\t\t\ttype: ControlType.Enum,\n\t\t\tname: Dictionary.LayoutDirection,\n\t\t\tinitialValue: undefined,\n\t\t\tcases: [\n\t\t\t\t{ id: \"ltr\", name: leftToRightName },\n\t\t\t\t{ id: \"rtl\", name: rightToLeftName },\n\t\t\t],\n\t\t}\n\n\t\treturn result\n\t}\n})()\n\ntype VerifiedEnumControlDescription = Extract<SerializedVerifiedControlDescription, { type: ControlType.Enum }>\n\nexport const getLocaleVariableControl = memoizeOne(\n\t(localeVariable: EnumVariableDefinition | null): VerifiedEnumControlDescription | null => {\n\t\tif (!localeVariable) return null\n\t\treturn getLocaleControlDescription(localeVariable)\n\t},\n)\n\nconst getMemoizedLocaleVariableList = memoizeOne(\n\t(\n\t\tlocaleVariable: EnumVariableDefinition | null,\n\t\tlayoutDirectionVariable: EnumVariableDefinition | null,\n\t): VariableProviderVariableMap | undefined => {\n\t\tif (!localeVariable && !layoutDirectionVariable) return\n\n\t\tconst result = new EagerVariableProviderMap<VariableDefinition>()\n\n\t\tif (localeVariable) {\n\t\t\tresult.set(localeVariable.id, localeVariable)\n\t\t}\n\n\t\tif (layoutDirectionVariable) {\n\t\t\tresult.set(layoutDirectionVariable.id, layoutDirectionVariable)\n\t\t}\n\n\t\treturn result\n\t},\n)\n\nexport function getLocaleVariableMap(tree: CanvasTree): VariableProviderVariableMap | undefined {\n\tconst localeVariable = getLocaleVariable(tree)\n\tconst layoutDirectionVariable = getLayoutDirectionVariable(tree)\n\treturn getMemoizedLocaleVariableList(localeVariable, layoutDirectionVariable)\n}\n\nfunction getLocaleControlDescription(localeEnumVariable: EnumVariableDefinition): VerifiedEnumControlDescription {\n\tconst options: string[] = []\n\tconst optionTitles: string[] = []\n\n\tfor (const enumCase of localeEnumVariable.cases) {\n\t\toptions.push(enumCase.id)\n\t\toptionTitles.push(enumCase.name)\n\t}\n\n\tconst control: VerifiedEnumControlDescription = {\n\t\ttype: ControlType.Enum,\n\t\ttitle: Dictionary.Locale,\n\t\toptions,\n\t\toptionTitles,\n\t}\n\n\t// We apply this metadata so we can generate the locale to display name code.\n\tsetDataIdentifierAndEnumFieldKeyForControl(control, {\n\t\tdataIdentifier: localeSourceIdentifier,\n\t\tenumFieldKey: localeVariableId,\n\t})\n\n\treturn control\n}\n\nfunction getLayoutDirectionControlDescription(\n\tlayoutDirectionVariable: EnumVariableDefinition,\n): VerifiedEnumControlDescription {\n\tconst options: string[] = []\n\tconst optionTitles: string[] = []\n\n\tfor (const enumCase of layoutDirectionVariable.cases) {\n\t\toptions.push(enumCase.id)\n\t\toptionTitles.push(enumCase.name)\n\t}\n\n\tconst control: VerifiedEnumControlDescription = {\n\t\ttype: ControlType.Enum,\n\t\ttitle: Dictionary.LayoutDirection,\n\t\toptions,\n\t\toptionTitles,\n\t}\n\n\t// We apply this metadata so we can generate the locale to display name code.\n\tsetDataIdentifierAndEnumFieldKeyForControl(control, {\n\t\tdataIdentifier: localeSourceIdentifier,\n\t\tenumFieldKey: layoutDirectionVariableId,\n\t})\n\n\treturn control\n}\n\nconst getMemoizedLocaleVariableProviderControlMap = memoizeOne(\n\t(\n\t\tlocaleVariable: EnumVariableDefinition | null,\n\t\tlayoutDirectionVariable: EnumVariableDefinition | null,\n\t): VariableProviderControlMap | undefined => {\n\t\tif (!localeVariable && !layoutDirectionVariable) return\n\n\t\tconst result = new EagerVariableProviderMap<VerifiedControlDescription>()\n\n\t\tif (localeVariable) {\n\t\t\tresult.set(localeVariable.id, getLocaleControlDescription(localeVariable))\n\t\t}\n\n\t\tif (layoutDirectionVariable) {\n\t\t\tresult.set(layoutDirectionVariable.id, getLayoutDirectionControlDescription(layoutDirectionVariable))\n\t\t}\n\n\t\treturn result\n\t},\n)\n\nexport function getLocaleVariableProviderControlMap(tree: CanvasTree): VariableProviderControlMap | undefined {\n\tconst localeVariable = getLocaleVariable(tree)\n\tconst layoutDirectionVariable = getLayoutDirectionVariable(tree)\n\treturn getMemoizedLocaleVariableProviderControlMap(localeVariable, layoutDirectionVariable)\n}\n\nconst getMemoizedLocaleCombinedVariableProviderControlMap = memoizeOne(\n\t(controlMap: VariableProviderControlMap | undefined): CombinedVariableProviderControlMap | undefined => {\n\t\tif (!controlMap) return undefined\n\n\t\tconst result: CombinedVariableProviderControlMap = new Map()\n\t\tresult.set(localeProviderId, controlMap)\n\t\treturn result\n\t},\n)\n\nexport function getLocaleCombinedVariableProviderControlMap(\n\ttree: CanvasTree,\n): CombinedVariableProviderControlMap | undefined {\n\tconst controlMap = getLocaleVariableProviderControlMap(tree)\n\treturn getMemoizedLocaleCombinedVariableProviderControlMap(controlMap)\n}\n\nconst getMemoizedLocaleCombinedVariableProviderValueMap = memoizeOne(\n\t(\n\t\tlocaleVariable: EnumVariableDefinition | null,\n\t\tlayoutDirectionVariable: EnumVariableDefinition | null,\n\t\tactiveLocale: Locale | RouterLocale | undefined,\n\t\tadaptLayoutToTextDirection: boolean,\n\t): CombinedVariableProviderValueMap | undefined => {\n\t\tif (!localeVariable && !layoutDirectionVariable) return\n\n\t\tconst variableValueMap = new EagerVariableProviderMap<unknown>()\n\n\t\tif (localeVariable) {\n\t\t\tvariableValueMap.set(localeVariable.id, activeLocale?.id ?? defaultLocaleId)\n\t\t}\n\n\t\tif (layoutDirectionVariable) {\n\t\t\tvariableValueMap.set(\n\t\t\t\tlayoutDirectionVariable.id,\n\t\t\t\tgetLayoutDirectionValue(activeLocale, adaptLayoutToTextDirection),\n\t\t\t)\n\t\t}\n\n\t\tconst combinedVariableValueMap: CombinedVariableProviderValueMap = new Map()\n\t\tcombinedVariableValueMap.set(localeProviderId, variableValueMap)\n\t\treturn combinedVariableValueMap\n\t},\n)\n\nexport function getLocaleCombinedVariableProviderValueMap(\n\ttree: CanvasTree,\n\tactiveLocale: Locale | RouterLocale | undefined,\n): CombinedVariableProviderValueMap | undefined {\n\tconst localeVariable = getLocaleVariable(tree)\n\tconst layoutDirectionVariable = getLayoutDirectionVariable(tree)\n\n\treturn getMemoizedLocaleCombinedVariableProviderValueMap(\n\t\tlocaleVariable,\n\t\tlayoutDirectionVariable,\n\t\tactiveLocale,\n\t\ttree.root.adaptLayoutToTextDirection,\n\t)\n}\n", "import { isObject } from \"utils/typeChecks.ts\"\n\nexport interface Generated<T> {\n\tvalue: T\n\tgenerated: true\n}\n\nexport function createGeneratedValue<T>(value: T): Generated<T> {\n\treturn {\n\t\tvalue,\n\t\tgenerated: true,\n\t}\n}\n\nconst key = \"generated\" satisfies keyof Generated<unknown>\n\nexport function isGeneratedValue<T>(value: Generated<T> | T | undefined): value is Generated<T> {\n\treturn isObject(value) && key in value && value.generated === true\n}\n\nexport function getGeneratedValue<T>(value: Generated<T> | T): T {\n\tif (isGeneratedValue<T>(value)) return value.value\n\treturn value\n}\n", "import type { VerifiedControlDescription } from \"@framerjs/framer-runtime\"\nimport type { NodeID } from \"../nodes/NodeID.ts\"\nimport type { VariableDefinition, VariableID } from \"./WithVariables.ts\"\n\n/**\n * The \"default\" key refers to the top variable context of the active render tree. The reason we\n * have a default is because old variable references don't have an explicit provider id value.\n */\nexport const FALLBACK_PROVIDER_ID = \"default\"\n\nexport class EmptyVariableProviderMap<Value> implements VariableProviderMap<Value> {\n\thas(_variableId: VariableID): boolean {\n\t\treturn false\n\t}\n\n\tget(_variableId: VariableID): Value | undefined {\n\t\treturn undefined\n\t}\n\n\t*[Symbol.iterator](): IterableIterator<[VariableID, Value]> {}\n}\n\nexport const emptyVariableMap: VariableProviderVariableMap = new EmptyVariableProviderMap()\nexport const emptyValueMap: VariableProviderValueMap = new EmptyVariableProviderMap()\nexport const emptyControlMap: VariableProviderControlMap = new EmptyVariableProviderMap()\n\nexport interface VariableProviderMap<Value> {\n\thas(variableId: VariableID): boolean\n\tget(variableId: VariableID): Value | undefined\n\n\t/** @deprecated Iterating over all variables can be really slow. */\n\t[Symbol.iterator](): IterableIterator<[VariableID, Value]>\n}\n\nexport type VariableProviderVariableMap = VariableProviderMap<VariableDefinition>\n\nexport type VariableProviderValueMap = VariableProviderMap<unknown>\nexport type CombinedVariableProviderValueMap = Map<NodeID | typeof FALLBACK_PROVIDER_ID, VariableProviderValueMap>\n\nexport type VariableProviderControlMap = VariableProviderMap<VerifiedControlDescription>\nexport type CombinedVariableProviderControlMap = Map<NodeID | typeof FALLBACK_PROVIDER_ID, VariableProviderControlMap>\n", "import type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport type { SerializableLink } from \"code-generation/utils/LinkCollector.ts\"\nimport { getRouteSegmentNodeByWebPageId } from \"document/components/chrome/Pages/utils/getRouteSegmentNodeByWebPageId.ts\"\nimport type { CanvasTree } from \"document/models/CanvasTree/CanvasTree.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { RouteSegmentNode } from \"document/models/CanvasTree/nodes/RouteSegmentNode.ts\"\nimport { isRouteSegmentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { LinkToWebPage, LinkVariables } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport type { ResolvedCollectionItemSelector } from \"document/models/CanvasTree/traits/utils/ResolvedCollectionItemSelector.ts\"\nimport type { ControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isObject, isString } from \"utils/typeChecks.ts\"\n\nconst webPageLinkTypeKey: keyof LinkToWebPage = \"type\"\nconst webPageIdKey: keyof LinkToWebPage = \"webPageId\"\n\ninterface SerializedLinkToWebPage extends SerializableLink, Pick<LinkToWebPage, \"webPageId\"> {}\n\n/** Serialized links don't work on the canvas, so we convert them to LinkToWebPage. */\nexport function isSerializedWebPageLink(control: ControlDescription, value: unknown): value is SerializedLinkToWebPage {\n\tif (control.type !== ControlType.Link) return false\n\tif (!isObject(value)) return false\n\tif (webPageLinkTypeKey in value) return false\n\tif (webPageIdKey in value) return true\n\treturn false\n}\n\nfunction getDataIdentifierForRouteSegmentNode(\n\ttree: CanvasTree,\n\trouteSegmentNode: RouteSegmentNode,\n): ModuleExportIdentifierString | undefined {\n\tlet segmentNode: CanvasNode | null = routeSegmentNode\n\n\twhile (isRouteSegmentNode(segmentNode)) {\n\t\tif (segmentNode.dataIdentifier) return segmentNode.dataIdentifier\n\t\tsegmentNode = tree.getParent(segmentNode.id)\n\t}\n}\n\nfunction getLinkVariablesFromUnresolvedPathSlugs(\n\ttree: CanvasTree,\n\tlink: SerializedLinkToWebPage,\n): LinkVariables | undefined {\n\tif (!link.unresolvedPathSlugs) return\n\n\tfor (const key in link.unresolvedPathSlugs) {\n\t\tconst value = link.unresolvedPathSlugs[key]\n\t\tif (!isObject(value)) continue\n\n\t\tconst collectionItemId = value.collectionItemId\n\t\tif (!isString(collectionItemId)) continue\n\n\t\tconst routeSegmentNode = getRouteSegmentNodeByWebPageId(tree, link.webPageId)\n\t\tif (!routeSegmentNode) return\n\n\t\tconst dataIdentifier = getDataIdentifierForRouteSegmentNode(tree, routeSegmentNode)\n\t\tif (!dataIdentifier) return\n\n\t\tconst resolvedItemSelector: ResolvedCollectionItemSelector = {\n\t\t\tidentifier: dataIdentifier,\n\t\t\tcollectionItemId,\n\t\t\tkey,\n\t\t\t// The value represents the slug, but the slug will be resolved via the collection data\n\t\t\t// so we can use an empty string.\n\t\t\tvalue: \"\",\n\t\t}\n\n\t\treturn { [key]: resolvedItemSelector }\n\t}\n}\n\nexport function convertSerializedWebPageLinkToPageLink(tree: CanvasTree, link: SerializedLinkToWebPage): LinkToWebPage {\n\treturn {\n\t\ttype: \"webPage\",\n\t\twebPageId: link.webPageId,\n\t\tpathVariables: getLinkVariablesFromUnresolvedPathSlugs(tree, link),\n\t}\n}\n", "import type { VerifiedControlDescription } from \"@framerjs/framer-runtime\"\nimport type { CanvasTree } from \"document/models/CanvasTree/CanvasTree.ts\"\nimport { isResponsiveImage } from \"document/models/CanvasTree/traits/ResponsiveImage.ts\"\nimport { getDefaultVariableValue } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { getPixelDimensionsFromImageSrc } from \"document/models/CanvasTree/traits/utils/getPixelDimensionsFromImageSrc.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isArray, isObject } from \"utils/typeChecks.ts\"\nimport { convertSerializedWebPageLinkToPageLink, isSerializedWebPageLink } from \"./serializedWebPageLink.ts\"\n\nexport function serializedValueToVariableValue(\n\ttree: CanvasTree,\n\tcontrol: VerifiedControlDescription,\n\tvalue: unknown,\n): unknown {\n\tif (isSerializedWebPageLink(control, value)) {\n\t\treturn convertSerializedWebPageLinkToPageLink(tree, value)\n\t}\n\n\tconst resolvedValue = getDefaultVariableValue(control.type, value)\n\n\tif (control.type === ControlType.Array) {\n\t\tif (!isArray(resolvedValue)) return resolvedValue\n\n\t\tconst itemControl = control.control\n\t\tif (!itemControl) return resolvedValue\n\n\t\treturn resolvedValue.map(itemValue => serializedValueToVariableValue(tree, itemControl, itemValue))\n\t}\n\n\tif (control.type === ControlType.Object) {\n\t\tif (!isObject(resolvedValue)) return resolvedValue\n\n\t\tconst result: Record<string, unknown> = {}\n\t\tfor (const key in resolvedValue) {\n\t\t\tconst nestedControl = control.controls[key]\n\t\t\tresult[key] = resolvedValue[key]\n\t\t\tif (!nestedControl) continue\n\n\t\t\tresult[key] = serializedValueToVariableValue(tree, nestedControl, resolvedValue[key])\n\t\t}\n\n\t\treturn result\n\t}\n\n\tif (control.type === ControlType.ResponsiveImage && isResponsiveImage(resolvedValue)) {\n\t\tconst dimensions = getPixelDimensionsFromImageSrc(resolvedValue.src)\n\t\tif (!dimensions) return resolvedValue\n\t\treturn { ...resolvedValue, pixelWidth: dimensions.width, pixelHeight: dimensions.height }\n\t}\n\n\treturn resolvedValue\n}\n", "import { serializedValueToVariableValue } from \"utils/serializedValueToVariableValue.ts\"\nimport type { CanvasTree } from \"../CanvasTree.ts\"\nimport type { VariableProviderControlMap, VariableProviderValueMap } from \"../traits/VariableProvider.ts\"\nimport type { VariableID } from \"../traits/WithVariables.ts\"\n\nexport class DataSourceValueMap implements VariableProviderValueMap {\n\tprivate readonly cache = new Map<VariableID, unknown>()\n\n\tconstructor(\n\t\tprivate readonly tree: CanvasTree,\n\t\tprivate readonly controlMap: VariableProviderControlMap,\n\t\tprivate readonly data: Record<string, unknown> | undefined,\n\t) {}\n\n\thas(variableId: VariableID): boolean {\n\t\treturn this.controlMap.has(variableId)\n\t}\n\n\tget(variableId: VariableID): unknown | undefined {\n\t\tif (this.cache.has(variableId)) {\n\t\t\treturn this.cache.get(variableId)\n\t\t}\n\n\t\tconst control = this.controlMap.get(variableId)\n\t\tif (!control) return undefined\n\n\t\tconst rawValue = this.data?.[variableId]\n\t\tconst value = serializedValueToVariableValue(this.tree, control, rawValue)\n\n\t\tthis.cache.set(variableId, value)\n\n\t\treturn value\n\t}\n\n\t*[Symbol.iterator](): IterableIterator<[VariableID, unknown]> {\n\t\tfor (const [variableId] of this.controlMap) {\n\t\t\tconst value = this.get(variableId)\n\t\t\tyield [variableId, value]\n\t\t}\n\t}\n}\n", "import { plural, singular } from \"pluralize\"\n\nexport function getSingularCollectionName(collectionName: string) {\n\tif (collectionName === \"Blog\") return collectionName + \" Item\"\n\treturn singular(collectionName)\n}\n\nexport function getPluralCollectionName(collectionName: string) {\n\tif (collectionName === \"Blog\") return collectionName\n\treturn plural(collectionName)\n}\n", "import type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport type { VariableDefinition } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { getSingularCollectionName } from \"./collectionNames.ts\"\n\nconst variableToMetadataMap: WeakMap<VariableDefinition, VariableMetadata> = new WeakMap()\n\nexport interface VariableMetadata {\n\tisSlug: boolean\n\tsourceDataIdentifier: ModuleExportIdentifierString\n\tparentVariableName: string | null\n\tcollectionName: string | null\n}\n\nexport function setVariableMetadata(variable: VariableDefinition, metadata: VariableMetadata) {\n\tvariableToMetadataMap.set(variable, metadata)\n}\n\nexport function getVariableMetadata(variable: VariableDefinition): VariableMetadata | undefined {\n\treturn variableToMetadataMap.get(variable)\n}\n\nexport function isSlugVariable(variable: VariableDefinition): boolean {\n\treturn getVariableMetadata(variable)?.isSlug === true\n}\n\nexport function getVariableSourceDataIdentifier(variable: VariableDefinition): ModuleExportIdentifierString | null {\n\tconst metadata = getVariableMetadata(variable)\n\treturn metadata?.sourceDataIdentifier ?? null\n}\n\nexport function isSlugVariableFromDataSource(\n\tvariable: VariableDefinition,\n\tdataSource: ModuleExportIdentifierString,\n): boolean {\n\tconst metadata = getVariableMetadata(variable)\n\tif (!metadata || !metadata.isSlug) return false\n\treturn metadata.sourceDataIdentifier === dataSource\n}\n\nexport function getSlugVariableName(variable: VariableDefinition): string | null {\n\tconst metadata = getVariableMetadata(variable)\n\tif (!metadata || !metadata.isSlug) return null\n\tif (metadata.parentVariableName) return metadata.parentVariableName\n\tif (metadata.collectionName) return getSingularCollectionName(metadata.collectionName)\n\treturn null\n}\n", "import { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\n\n/**\n * A map of control types that are supported in the CMS. Inclusion / exclusion\n * here is probably more of a product decision. Some control types will make more sense\n * than others to support.\n */\nconst supportedCollectionControlTypes = {\n\t[ControlType.Array]: true,\n\t[ControlType.Boolean]: true,\n\t[ControlType.Border]: false,\n\t[ControlType.BorderRadius]: false,\n\t[ControlType.BoxShadow]: false,\n\t[ControlType.CollectionReference]: true,\n\t[ControlType.Color]: true,\n\t[ControlType.ComponentInstance]: false,\n\t[ControlType.Slot]: false,\n\t[ControlType.Cursor]: false,\n\t[ControlType.CustomCursor]: false,\n\t[ControlType.Date]: true,\n\t[ControlType.Enum]: true,\n\t[ControlType.EventHandler]: false,\n\t[ControlType.ChangeHandler]: false,\n\t[ControlType.File]: true,\n\t[ControlType.Font]: false,\n\t[ControlType.FusedNumber]: false,\n\t[ControlType.Image]: true,\n\t[ControlType.Link]: true,\n\t[ControlType.LinkRelValues]: false,\n\t[ControlType.MultiCollectionReference]: true,\n\t[ControlType.Number]: true,\n\t[ControlType.Object]: true, // NOTE: Objects are only supported in arrays.\n\t[ControlType.Gap]: false,\n\t[ControlType.Padding]: false,\n\t[ControlType.PageScope]: false,\n\t[ControlType.ResponsiveImage]: true,\n\t[ControlType.RichText]: true,\n\t[ControlType.ScrollSectionRef]: false,\n\t[ControlType.SegmentedEnum]: false,\n\t[ControlType.String]: true,\n\t[ControlType.Transition]: false,\n\t[ControlType.TrackingId]: false,\n\t[ControlType.VectorSetItem]: true,\n\t[ControlType.Location]: false,\n} as const satisfies Record<ControlType, boolean>\n\ntype SupportedCollectionControlTypeMap = typeof supportedCollectionControlTypes\n\nexport type CollectionControlType = keyof {\n\t[Key in keyof SupportedCollectionControlTypeMap as SupportedCollectionControlTypeMap[Key] extends true\n\t\t? Key\n\t\t: never]: Key\n}\n\nexport function isCollectionControlType(\n\tcontrolType: ControlType | null | undefined,\n): controlType is CollectionControlType {\n\treturn isString(controlType) && supportedCollectionControlTypes[controlType] === true\n}\n", "import type {\n\tVerifiedArrayControlDescription,\n\tVerifiedControlDescription,\n\tVerifiedObjectControlDescription,\n} from \"@framerjs/framer-runtime\"\nimport type { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isObject } from \"utils/typeChecks.ts\"\nimport type { ArrayItemVariableType } from \"../CanvasTree/traits/WithVariables.ts\"\nimport { type CollectionControlType, isCollectionControlType } from \"./CollectionControlType.ts\"\n\ntype CollectionArrayItemControlDescription = Omit<VerifiedObjectControlDescription, \"controls\"> & {\n\tcontrols: Record<string, Extract<VerifiedControlDescription, { type: ArrayItemVariableType }>>\n}\n\nexport interface CollectionArrayControlDescription extends Omit<VerifiedArrayControlDescription, \"control\"> {\n\tcontrol: CollectionArrayItemControlDescription\n}\n\ntype CollectionPrimitiveControlType = Exclude<CollectionControlType, ControlType.Array | ControlType.Object>\n\nexport type CollectionControlDescription =\n\t| Extract<VerifiedControlDescription, { type: CollectionPrimitiveControlType }>\n\t| CollectionArrayControlDescription\n\t| CollectionArrayItemControlDescription\n\nexport function isCollectionControlDescription(\n\tcontrolDescription: VerifiedControlDescription | null | undefined,\n): controlDescription is CollectionControlDescription {\n\treturn isObject(controlDescription) && isCollectionControlType(controlDescription.type)\n}\n", "import type { VerifiedControlDescription } from \"@framerjs/framer-runtime\"\nimport { type ModuleExportIdentifierString, asGlobalId, assertNever, getLogger } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { isCollectionControlDescription } from \"document/models/controlProps/CollectionControlDescription.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport { fallbackTitleForOption } from \"utils/enumControlUtils.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport {\n\ttype ArrayItemVariableDefinition,\n\ttype EnumVariableCase,\n\ttype VariableDefinition,\n\ttype VariableID,\n\tgetDefaultVariableValue,\n\tisArrayItemVariableDefinition,\n} from \"../../traits/WithVariables.ts\"\n\nconst log = getLogger(\"getVariableFromControlDescription\")\n\nexport function getVariableFromControlDescription(\n\tcontrol: VerifiedControlDescription,\n\tvariableId: VariableID,\n): VariableDefinition | undefined {\n\tconst baseVariable = {\n\t\tid: variableId,\n\t\tname: control.title ?? Dictionary.Unknown,\n\t\tdescription: control.description,\n\t}\n\n\t// TODO: Support other control types.\n\tif (!isCollectionControlDescription(control)) return\n\n\tswitch (control.type) {\n\t\tcase ControlType.Array: {\n\t\t\tconst itemControls = control.control.controls\n\t\t\tconst itemVariables: ArrayItemVariableDefinition[] = []\n\n\t\t\tfor (const itemControlKey in itemControls) {\n\t\t\t\tconst itemControl = itemControls[itemControlKey]\n\t\t\t\tif (!itemControl) continue\n\n\t\t\t\tconst itemVariable = getVariableFromControlDescription(itemControl, itemControlKey)\n\t\t\t\tif (!itemVariable) continue\n\t\t\t\t// Arguably this should be an assert but we are concerned that if somebody adds to\n\t\t\t\t// ArrayItemVariableDefinition then later does a rollback we may end up with\n\t\t\t\t// projects that are in an unusable state\n\t\t\t\tif (!isArrayItemVariableDefinition(itemVariable)) {\n\t\t\t\t\tlog.error(\"Unexpected item control type in array control\", itemControl)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\titemVariables.push(itemVariable)\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...baseVariable,\n\t\t\t\ttype: ControlType.Array,\n\t\t\t\titemVariables,\n\t\t\t\tinitialValue: getDefaultVariableValue(control.type, control.defaultValue),\n\t\t\t\tminCount: control.minCount,\n\t\t\t\tmaxCount: control.maxCount,\n\t\t\t}\n\t\t}\n\n\t\tcase ControlType.String: {\n\t\t\treturn {\n\t\t\t\t...baseVariable,\n\t\t\t\ttype: ControlType.String,\n\t\t\t\tinitialValue: getDefaultVariableValue(control.type, control.defaultValue),\n\t\t\t\toptions: {\n\t\t\t\t\tdisplayTextArea: control.displayTextArea,\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\n\t\tcase ControlType.RichText: {\n\t\t\treturn {\n\t\t\t\t...baseVariable,\n\t\t\t\ttype: ControlType.RichText,\n\t\t\t\tinitialValue: getDefaultVariableValue(control.type, control.defaultValue),\n\t\t\t}\n\t\t}\n\n\t\tcase ControlType.Image: {\n\t\t\treturn {\n\t\t\t\t...baseVariable,\n\t\t\t\ttype: ControlType.Image,\n\t\t\t\tinitialValue: undefined,\n\t\t\t}\n\t\t}\n\n\t\tcase ControlType.ResponsiveImage: {\n\t\t\treturn {\n\t\t\t\t...baseVariable,\n\t\t\t\ttype: ControlType.Image,\n\t\t\t\tinitialValue: undefined,\n\t\t\t}\n\t\t}\n\n\t\tcase ControlType.File: {\n\t\t\treturn {\n\t\t\t\t...baseVariable,\n\t\t\t\ttype: ControlType.File,\n\t\t\t\tinitialValue: undefined,\n\t\t\t\tallowedFileTypes: control.allowedFileTypes.map((extension, index) => ({\n\t\t\t\t\textension,\n\t\t\t\t\tid: String(index),\n\t\t\t\t})),\n\t\t\t}\n\t\t}\n\n\t\tcase ControlType.Color: {\n\t\t\treturn {\n\t\t\t\t...baseVariable,\n\t\t\t\ttype: control.type,\n\t\t\t\tinitialValue: getDefaultVariableValue(control.type, control.defaultValue),\n\t\t\t}\n\t\t}\n\n\t\tcase ControlType.Boolean: {\n\t\t\treturn {\n\t\t\t\t...baseVariable,\n\t\t\t\ttype: control.type,\n\t\t\t\tinitialValue: getDefaultVariableValue(control.type, control.defaultValue),\n\t\t\t}\n\t\t}\n\n\t\tcase ControlType.Number: {\n\t\t\treturn {\n\t\t\t\t...baseVariable,\n\t\t\t\ttype: control.type,\n\t\t\t\tinitialValue: getDefaultVariableValue(control.type, control.defaultValue),\n\t\t\t}\n\t\t}\n\n\t\tcase ControlType.Link: {\n\t\t\treturn {\n\t\t\t\t...baseVariable,\n\t\t\t\ttype: control.type,\n\t\t\t\tinitialValue: getDefaultVariableValue(control.type, control.defaultValue),\n\t\t\t}\n\t\t}\n\n\t\tcase ControlType.Date: {\n\t\t\treturn {\n\t\t\t\t...baseVariable,\n\t\t\t\ttype: control.type,\n\t\t\t\tinitialValue: getDefaultVariableValue(control.type, control.defaultValue),\n\t\t\t\toptions: {\n\t\t\t\t\tdisplayTime: control.displayTime,\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\n\t\tcase ControlType.Enum: {\n\t\t\tconst cases: EnumVariableCase[] = []\n\t\t\tfor (let i = 0; i < control.options.length; i++) {\n\t\t\t\tconst option = control.options[i]\n\t\t\t\t// Code components can have enum control options other than strings but variables only support string options\n\t\t\t\t// This function should never run on code component enum controls, so just a safety check\n\t\t\t\tif (!isString(option)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tcases.push({\n\t\t\t\t\tid: option,\n\t\t\t\t\tname: control.optionTitles?.[i] ?? fallbackTitleForOption(option),\n\t\t\t\t})\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t...baseVariable,\n\t\t\t\ttype: control.type,\n\t\t\t\tinitialValue: getDefaultVariableValue(control.type, control.defaultValue),\n\t\t\t\tcases,\n\t\t\t}\n\t\t}\n\n\t\tcase ControlType.CollectionReference: {\n\t\t\treturn {\n\t\t\t\t...baseVariable,\n\t\t\t\ttype: ControlType.CollectionReference,\n\t\t\t\tinitialValue: undefined,\n\t\t\t\tdataIdentifier: control.dataIdentifier as ModuleExportIdentifierString,\n\t\t\t}\n\t\t}\n\n\t\tcase ControlType.MultiCollectionReference: {\n\t\t\treturn {\n\t\t\t\t...baseVariable,\n\t\t\t\ttype: ControlType.MultiCollectionReference,\n\t\t\t\tinitialValue: undefined,\n\t\t\t\tdataIdentifier: control.dataIdentifier as ModuleExportIdentifierString,\n\t\t\t}\n\t\t}\n\n\t\tcase ControlType.VectorSetItem: {\n\t\t\treturn {\n\t\t\t\t...baseVariable,\n\t\t\t\ttype: ControlType.VectorSetItem,\n\t\t\t\tsetModuleId: asGlobalId(control.setModuleId),\n\t\t\t\tinitialValue: {\n\t\t\t\t\tidentifier: control.defaultValue.identifier as ModuleExportIdentifierString,\n\t\t\t\t\tmoduleId: asGlobalId(control.defaultValue.moduleId),\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\n\t\tcase ControlType.Object: {\n\t\t\tthrow new Error(\"Objects are only supported inside arrays\")\n\t\t}\n\n\t\tdefault:\n\t\t\tassertNever(control)\n\t}\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { type VariableMetadata, setVariableMetadata } from \"utils/variableMetadata.ts\"\nimport type { VariableProviderControlMap, VariableProviderVariableMap } from \"../../traits/VariableProvider.ts\"\nimport type { VariableDefinition, VariableID } from \"../../traits/WithVariables.ts\"\nimport { getVariableFromControlDescription } from \"./getVariableFromControlDescription.ts\"\n\nexport class LazyVariableMapFromControlMap implements VariableProviderVariableMap {\n\tprivate readonly cache = new Map<VariableID, VariableDefinition | undefined>()\n\n\tconstructor(\n\t\tprivate readonly controlMap: VariableProviderControlMap & {\n\t\t\tgetMetadata?(variableId: VariableID): VariableMetadata | undefined\n\t\t},\n\t) {}\n\n\thas(variableId: VariableID): boolean {\n\t\tconst variable = this.get(variableId)\n\t\treturn Boolean(variable)\n\t}\n\n\tget(variableId: VariableID): VariableDefinition | undefined {\n\t\tif (this.cache.has(variableId)) {\n\t\t\treturn this.cache.get(variableId)\n\t\t}\n\n\t\tconst control = this.controlMap.get(variableId)\n\t\tif (!control) return undefined\n\n\t\tconst variable = getVariableFromControlDescription(control, variableId)\n\t\tassert(variable, \"Variable must exist\")\n\n\t\t// Copy variable metadata from control to variable.\n\t\tconst metadata = this.controlMap.getMetadata?.(variableId)\n\t\tif (metadata) setVariableMetadata(variable, metadata)\n\n\t\tthis.cache.set(variableId, variable)\n\n\t\treturn variable\n\t}\n\n\t*[Symbol.iterator](): IterableIterator<[VariableID, VariableDefinition]> {\n\t\tfor (const [variableId] of this.controlMap) {\n\t\t\tconst variable = this.get(variableId)\n\t\t\tassert(variable, \"Variable must exist\")\n\n\t\t\tyield [variableId, variable]\n\t\t}\n\t}\n}\n", "import type { AnyComponentLoader, VerifiedControlDescription, VerifiedPropertyControls } from \"@framerjs/framer-runtime\"\nimport { AnnotationKey } from \"@framerjs/framer-runtime/crossorigin\"\nimport type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { assert, emptyArray } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { experiments } from \"app/experiments.ts\"\nimport { nextItemVariableId, previousItemVariableId } from \"document/utils/CollectionItemVariables.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport {\n\ttype VariablePath,\n\tisNestedReferenceToVariableId,\n\tisTopLevelIdVariableId,\n\tjoinVariableId,\n\tsplitVariableId,\n} from \"utils/collectionReferenceUtils.ts\"\nimport { setDataIdentifierAndEnumFieldKeyForControl } from \"utils/getDataIdentifierAndEnumFieldKeyForControl.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { type VariableMetadata, setVariableMetadata } from \"utils/variableMetadata.ts\"\nimport type { CanvasTree } from \"../../CanvasTree.ts\"\nimport {\n\ttype VariableProviderControlMap,\n\ttype VariableProviderVariableMap,\n\temptyControlMap,\n\temptyVariableMap,\n} from \"../../traits/VariableProvider.ts\"\nimport type { VariableDefinition, VariableID } from \"../../traits/WithVariables.ts\"\nimport { EagerVariableProviderMap } from \"../../traits/utils/EagerVariableProviderMap.ts\"\nimport { getContentManagementNode } from \"../ContentManagementNode.utils.ts\"\nimport type {\n\tCollectionControlsIncludingAutoGeneratedByDataIdentifier,\n\tCollectionNameByDataIdentifier,\n\tSlugKeyByDataIdentifier,\n} from \"../ContentManagementNodeCache.ts\"\nimport { LazyVariableMapFromControlMap } from \"./LazyVariableMapFromControlMap.ts\"\nimport { getVariableFromControlDescription } from \"./getVariableFromControlDescription.ts\"\n\nfunction shouldUseCollectionVariablesFromTree(\n\tdataIdentifier: ModuleExportIdentifierString,\n\tcontrolsByDataIdentifier: CollectionControlsIncludingAutoGeneratedByDataIdentifier | undefined,\n): controlsByDataIdentifier is CollectionControlsIncludingAutoGeneratedByDataIdentifier {\n\treturn controlsByDataIdentifier?.has(dataIdentifier) === true\n}\n\nfunction getCollectionInfo(\n\tdataIdentifier: ModuleExportIdentifierString,\n\tcontrolsByDataIdentifier: CollectionControlsIncludingAutoGeneratedByDataIdentifier | undefined,\n\tcollectionNameByIdentifier: CollectionNameByDataIdentifier | undefined,\n\tslugKeyByIdentifier: SlugKeyByDataIdentifier | undefined,\n\tcomponentLoader: AnyComponentLoader,\n): {\n\tcontrols: VerifiedPropertyControls\n\tslugKey: string | undefined\n\tname: string\n} | null {\n\tif (shouldUseCollectionVariablesFromTree(dataIdentifier, controlsByDataIdentifier)) {\n\t\tconst controls = controlsByDataIdentifier.get(dataIdentifier)\n\t\tif (!controls) return null\n\n\t\tconst slugKey = slugKeyByIdentifier?.get(dataIdentifier)\n\t\tconst name = collectionNameByIdentifier?.get(dataIdentifier) ?? Dictionary.Unknown\n\n\t\treturn { controls, slugKey, name }\n\t}\n\n\tconst dataDefinition = componentLoader.dataForIdentifier(dataIdentifier)\n\tif (!dataDefinition || !dataDefinition.properties) return null\n\n\tconst { annotations, properties: controls } = dataDefinition\n\tconst slugKey = annotations?.[AnnotationKey.FramerSlug]\n\tconst name = dataDefinition.name\n\n\treturn { controls, slugKey, name }\n}\n\nexport function getDataSourceVariablesFromDataDefinition(\n\tcontrolsByDataIdentifier: CollectionControlsIncludingAutoGeneratedByDataIdentifier | undefined,\n\tcollectionNameByIdentifier: CollectionNameByDataIdentifier | undefined,\n\tslugKeyByIdentifier: SlugKeyByDataIdentifier | undefined,\n\tcomponentLoader: AnyComponentLoader,\n\tdataIdentifier: ModuleExportIdentifierString | undefined,\n\tparentPath: readonly string[] = emptyArray(),\n\tparentDataIdentifiers: readonly ModuleExportIdentifierString[] = emptyArray(),\n\tparentVariable: VariableDefinition | null = null,\n) {\n\tif (!dataIdentifier) {\n\t\treturn {\n\t\t\tvariableMap: emptyVariableMap,\n\t\t\tcontrolMap: emptyControlMap,\n\t\t}\n\t}\n\n\tif (experiments.isOn(\"lazyProviderMaps\")) {\n\t\tconst controlMap = new LazyDataSourceControlMap(\n\t\t\tdataIdentifier,\n\t\t\tcontrolsByDataIdentifier,\n\t\t\tcollectionNameByIdentifier,\n\t\t\tslugKeyByIdentifier,\n\t\t\tcomponentLoader,\n\t\t)\n\t\tconst variableMap = new LazyVariableMapFromControlMap(controlMap)\n\n\t\treturn {\n\t\t\tvariableMap,\n\t\t\tcontrolMap,\n\t\t}\n\t}\n\n\tconst variableMap = new EagerVariableProviderMap<VariableDefinition>()\n\tconst controlMap = new EagerVariableProviderMap<VerifiedControlDescription>()\n\n\tconst collectionInfo = getCollectionInfo(\n\t\tdataIdentifier,\n\t\tcontrolsByDataIdentifier,\n\t\tcollectionNameByIdentifier,\n\t\tslugKeyByIdentifier,\n\t\tcomponentLoader,\n\t)\n\tif (!collectionInfo) return { variableMap, controlMap }\n\n\tconst controlKeys = Object.keys(collectionInfo.controls)\n\n\tfor (const controlKey of controlKeys) {\n\t\tconst control = collectionInfo.controls[controlKey]\n\t\tif (!control) continue\n\n\t\t// TODO: Find a better place for this?\n\t\tif (control.type === ControlType.Enum) {\n\t\t\tsetDataIdentifierAndEnumFieldKeyForControl(control, {\n\t\t\t\tdataIdentifier,\n\t\t\t\tenumFieldKey: controlKey,\n\t\t\t})\n\t\t}\n\n\t\tconst variablePath = [...parentPath, controlKey]\n\t\tconst variableId = joinVariableId(variablePath)\n\t\tconst variable = getVariableFromControlDescription(control, variableId)\n\t\tif (!variable) continue\n\n\t\tif (\n\t\t\tisNestedReferenceToVariableId(variableId, previousItemVariableId) ||\n\t\t\tisNestedReferenceToVariableId(variableId, nextItemVariableId)\n\t\t) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif (\n\t\t\tvariable.type === ControlType.CollectionReference &&\n\t\t\t!isTopLevelIdVariableId(controlKey) &&\n\t\t\tcanAddReference(controlKey, parentPath, variable.dataIdentifier, dataIdentifier, parentDataIdentifiers)\n\t\t) {\n\t\t\tconst { variableMap: nestedVariableMap, controlMap: nestedControlMap } = getDataSourceVariablesFromDataDefinition(\n\t\t\t\tcontrolsByDataIdentifier,\n\t\t\t\tcollectionNameByIdentifier,\n\t\t\t\tslugKeyByIdentifier,\n\t\t\t\tcomponentLoader,\n\t\t\t\tvariable.dataIdentifier,\n\t\t\t\tvariablePath,\n\t\t\t\t[...parentDataIdentifiers, dataIdentifier],\n\t\t\t\tvariable,\n\t\t\t)\n\t\t\tfor (const [nestedId, nestedVariable] of nestedVariableMap) {\n\t\t\t\tvariableMap.set(nestedId, nestedVariable)\n\t\t\t}\n\t\t\tfor (const [nestedId, nestedControl] of nestedControlMap) {\n\t\t\t\tcontrolMap.set(nestedId, nestedControl)\n\t\t\t}\n\t\t}\n\n\t\tsetVariableMetadata(variable, {\n\t\t\tisSlug: controlKey === collectionInfo.slugKey,\n\t\t\tsourceDataIdentifier: dataIdentifier,\n\t\t\tparentVariableName: parentVariable?.name ?? null,\n\t\t\tcollectionName: collectionInfo.name,\n\t\t})\n\n\t\tvariableMap.set(variableId, variable)\n\t\tcontrolMap.set(variableId, control)\n\t}\n\n\treturn { variableMap, controlMap }\n}\n\nfunction canAddReference(\n\tkey: string,\n\tparentPath: readonly string[],\n\treferencedDataIdentifier: ModuleExportIdentifierString,\n\tcurrentDataIdentifier: ModuleExportIdentifierString,\n\tparentDataIdentifiers: readonly ModuleExportIdentifierString[],\n) {\n\t// Only allow previous/next item variables at the top level\n\tif (key === previousItemVariableId || key === nextItemVariableId) {\n\t\treturn parentPath.length === 0\n\t}\n\n\t// Only allow self references at the top level\n\tif (currentDataIdentifier === referencedDataIdentifier && parentPath.length > 0) {\n\t\treturn false\n\t}\n\n\t// Don't allow references to collections that we've already seen\n\tif (parentDataIdentifiers.includes(referencedDataIdentifier)) {\n\t\treturn false\n\t}\n\n\treturn true\n}\n\nexport class LazyDataSourceControlMap implements VariableProviderControlMap {\n\tprivate readonly cache = new Map<VariableID, [VerifiedControlDescription, VariableMetadata] | undefined>()\n\n\tconstructor(\n\t\tprivate readonly dataIdentifier: ModuleExportIdentifierString,\n\t\tprivate readonly controlsByDataIdentifier: CollectionControlsIncludingAutoGeneratedByDataIdentifier | undefined,\n\t\tprivate readonly collectionNameByIdentifier: CollectionNameByDataIdentifier | undefined,\n\t\tprivate readonly slugKeyByIdentifier: SlugKeyByDataIdentifier | undefined,\n\t\tprivate readonly componentLoader: AnyComponentLoader,\n\t) {}\n\n\thas(variableId: VariableID): boolean {\n\t\tconst control = this.get(variableId)\n\t\treturn Boolean(control)\n\t}\n\n\tget(variableId: VariableID): VerifiedControlDescription | undefined {\n\t\treturn this.getControlWithMetadataCached(variableId)?.[0]\n\t}\n\n\tgetMetadata(variableId: VariableID): VariableMetadata | undefined {\n\t\treturn this.getControlWithMetadataCached(variableId)?.[1]\n\t}\n\n\tprivate getControlWithMetadataCached(\n\t\tvariableId: VariableID,\n\t): [VerifiedControlDescription, VariableMetadata] | undefined {\n\t\tif (this.cache.has(variableId)) {\n\t\t\treturn this.cache.get(variableId)\n\t\t}\n\n\t\tconst variablePath = splitVariableId(variableId)\n\t\tconst controlWithMetadata = this.findControlWithMetadata(variablePath, this.dataIdentifier)\n\t\tthis.cache.set(variableId, controlWithMetadata)\n\n\t\treturn controlWithMetadata\n\t}\n\n\tprivate findControlWithMetadata(\n\t\t[controlKey, ...remainingPath]: VariablePath,\n\t\tdataIdentifier = this.dataIdentifier,\n\t\tparentControl?: VerifiedControlDescription,\n\t): [VerifiedControlDescription, VariableMetadata] | undefined {\n\t\tconst collectionInfo = getCollectionInfo(\n\t\t\tdataIdentifier,\n\t\t\tthis.controlsByDataIdentifier,\n\t\t\tthis.collectionNameByIdentifier,\n\t\t\tthis.slugKeyByIdentifier,\n\t\t\tthis.componentLoader,\n\t\t)\n\t\tif (!collectionInfo) return undefined\n\n\t\tconst control = collectionInfo.controls[controlKey]\n\t\tif (!control) return undefined\n\n\t\tif (control.type === ControlType.Enum) {\n\t\t\tsetDataIdentifierAndEnumFieldKeyForControl(control, {\n\t\t\t\tdataIdentifier,\n\t\t\t\tenumFieldKey: controlKey,\n\t\t\t})\n\t\t}\n\n\t\tif (remainingPath.length === 0) {\n\t\t\tconst metadata: VariableMetadata = {\n\t\t\t\tisSlug: controlKey === collectionInfo.slugKey,\n\t\t\t\tsourceDataIdentifier: dataIdentifier,\n\t\t\t\tparentVariableName: parentControl?.title ?? null,\n\t\t\t\tcollectionName: collectionInfo.name,\n\t\t\t}\n\n\t\t\treturn [control, metadata]\n\t\t}\n\n\t\tif (control.type !== ControlType.CollectionReference) return undefined\n\n\t\treturn this.findControlWithMetadata(\n\t\t\tremainingPath as VariablePath,\n\t\t\tcontrol.dataIdentifier as ModuleExportIdentifierString,\n\t\t\tcontrol,\n\t\t)\n\t}\n\n\t*[Symbol.iterator](): IterableIterator<[VariableID, VerifiedControlDescription]> {\n\t\tfor (const variableId of this.iterateVariableIds(this.dataIdentifier)) {\n\t\t\tconst control = this.get(variableId)\n\t\t\tassert(control, \"Control must exist\")\n\n\t\t\tyield [variableId, control]\n\t\t}\n\t}\n\n\tprivate *iterateVariableIds(\n\t\tdataIdentifier: ModuleExportIdentifierString | undefined,\n\t\tparentPath: readonly string[] = emptyArray(),\n\t\tparentDataIdentifiers: readonly ModuleExportIdentifierString[] = emptyArray(),\n\t): IterableIterator<VariableID> {\n\t\tif (!dataIdentifier) return\n\n\t\tconst collectionInfo = getCollectionInfo(\n\t\t\tdataIdentifier,\n\t\t\tthis.controlsByDataIdentifier,\n\t\t\tthis.collectionNameByIdentifier,\n\t\t\tthis.slugKeyByIdentifier,\n\t\t\tthis.componentLoader,\n\t\t)\n\t\tif (!collectionInfo) return\n\n\t\tconst controlKeys = Object.keys(collectionInfo.controls)\n\n\t\tfor (const controlKey of controlKeys) {\n\t\t\tconst control = collectionInfo.controls[controlKey]\n\t\t\tif (!control) continue\n\n\t\t\tconst variablePath = [...parentPath, controlKey]\n\t\t\tconst variableId = joinVariableId(variablePath)\n\n\t\t\tif (\n\t\t\t\tisNestedReferenceToVariableId(variableId, previousItemVariableId) ||\n\t\t\t\tisNestedReferenceToVariableId(variableId, nextItemVariableId)\n\t\t\t) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tcontrol.type === ControlType.CollectionReference &&\n\t\t\t\t!isTopLevelIdVariableId(controlKey) &&\n\t\t\t\tcanAddReference(\n\t\t\t\t\tcontrolKey,\n\t\t\t\t\tparentPath,\n\t\t\t\t\tcontrol.dataIdentifier as ModuleExportIdentifierString,\n\t\t\t\t\tdataIdentifier,\n\t\t\t\t\tparentDataIdentifiers,\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tyield* this.iterateVariableIds(control.dataIdentifier as ModuleExportIdentifierString, variablePath, [\n\t\t\t\t\t...parentDataIdentifiers,\n\t\t\t\t\tdataIdentifier,\n\t\t\t\t])\n\t\t\t}\n\n\t\t\tyield variableId\n\t\t}\n\t}\n}\n\nexport interface CachedDataSourceVariables {\n\treadonly variableMap: VariableProviderVariableMap\n\treadonly controlMap: VariableProviderControlMap\n}\n\ninterface TreeCacheKey {\n\ttype: \"tree\"\n\tcontrolsByDataIdentifier: CollectionControlsIncludingAutoGeneratedByDataIdentifier | undefined\n\tcollectionNameByIdentifier: CollectionNameByDataIdentifier | undefined\n\tslugKeyByIdentifier: SlugKeyByDataIdentifier | undefined\n}\n\ninterface ComponentLoaderCacheKey {\n\ttype: \"componentLoader\"\n\tcomponentLoaderHash: string | undefined\n}\n\ninterface CacheEntry {\n\tdataSourceVariables: CachedDataSourceVariables\n\tcacheKey: TreeCacheKey | ComponentLoaderCacheKey\n}\n\nconst dataSourceVariablesFromDataDefinitionCache = new Map<ModuleExportIdentifierString | undefined, CacheEntry>()\n\nexport function getDataSourceVariablesFromDataDefinitionCached(\n\tdataIdentifier: ModuleExportIdentifierString,\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tcomponentLoaderHash: string | undefined,\n): CachedDataSourceVariables {\n\tconst cached = dataSourceVariablesFromDataDefinitionCache.get(dataIdentifier)\n\n\tconst contentManagementNode = getContentManagementNode(tree)?.loaded\n\tconst controlsByDataIdentifier = contentManagementNode?.getControlsIncludingAutoGeneratedByIdentifierMap(\n\t\ttree,\n\t\tcomponentLoader,\n\t)\n\tconst collectionNameByIdentifier = contentManagementNode?.getNameByIdentifierMap()\n\tconst slugKeyByIdentifier = contentManagementNode?.getSlugKeyByIdentifierMap()\n\n\tif (shouldUseCollectionVariablesFromTree(dataIdentifier, controlsByDataIdentifier)) {\n\t\tif (\n\t\t\tcached &&\n\t\t\tcached.cacheKey.type === \"tree\" &&\n\t\t\tcached.cacheKey.controlsByDataIdentifier === controlsByDataIdentifier &&\n\t\t\tcached.cacheKey.collectionNameByIdentifier === collectionNameByIdentifier &&\n\t\t\tcached.cacheKey.slugKeyByIdentifier === slugKeyByIdentifier\n\t\t) {\n\t\t\treturn cached.dataSourceVariables\n\t\t}\n\n\t\tconst dataSourceVariables = getDataSourceVariablesFromDataDefinition(\n\t\t\tcontrolsByDataIdentifier,\n\t\t\tcollectionNameByIdentifier,\n\t\t\tslugKeyByIdentifier,\n\t\t\tcomponentLoader,\n\t\t\tdataIdentifier,\n\t\t)\n\n\t\tdataSourceVariablesFromDataDefinitionCache.set(dataIdentifier, {\n\t\t\tdataSourceVariables,\n\t\t\tcacheKey: {\n\t\t\t\ttype: \"tree\",\n\t\t\t\tcontrolsByDataIdentifier,\n\t\t\t\tcollectionNameByIdentifier,\n\t\t\t\tslugKeyByIdentifier,\n\t\t\t},\n\t\t})\n\n\t\treturn dataSourceVariables\n\t}\n\n\t// Using component loader\n\n\tif (\n\t\tisString(componentLoaderHash) &&\n\t\tcached &&\n\t\tcached.cacheKey.type === \"componentLoader\" &&\n\t\tcached.cacheKey.componentLoaderHash === componentLoaderHash\n\t) {\n\t\treturn cached.dataSourceVariables\n\t}\n\n\tconst dataSourceVariables = getDataSourceVariablesFromDataDefinition(\n\t\tcontrolsByDataIdentifier,\n\t\tcollectionNameByIdentifier,\n\t\tslugKeyByIdentifier,\n\t\tcomponentLoader,\n\t\tdataIdentifier,\n\t)\n\n\tdataSourceVariablesFromDataDefinitionCache.set(dataIdentifier, {\n\t\tdataSourceVariables,\n\t\tcacheKey: {\n\t\t\ttype: \"componentLoader\",\n\t\t\tcomponentLoaderHash,\n\t\t},\n\t})\n\n\treturn dataSourceVariables\n}\n", "import type { AnyComponentLoader, VerifiedControlDescription } from \"@framerjs/framer-runtime\"\nimport type { LocalModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { getLogger } from \"@framerjs/shared\"\nimport type { LayoutTemplateDOMInfo } from \"document/LayoutCache.ts\"\nimport type { SandboxRepeaterData } from \"document/SandboxRepeaterData.ts\"\nimport type {\n\tLocalizationSourceGroup,\n\tLocalizationSourceGroupCollectionItem,\n} from \"document/components/chrome/localization/getLocalizationSources.ts\"\nimport type { CachedSelectionProperties } from \"document/components/chrome/properties/panels/utils/selectionProperties.ts\"\nimport type { EffectPreviewType } from \"document/utils/EffectPreviewType.ts\"\nimport type { FontPreview } from \"document/utils/FontPreviewTypes.ts\"\nimport type { RenderId } from \"document/utils/RenderId.ts\"\nimport type { StackDirection } from \"library/components/Stack/types.ts\"\nimport type { Point } from \"library/index.ts\"\nimport type { WithPaths } from \"library/render/traits/Path.ts\"\nimport type { ConstraintProperties, DimensionType } from \"library/render/types/Constraints.ts\"\nimport type { NewConstraintProperties } from \"library/render/types/NewConstraints.tsx\"\nimport type { Rect } from \"library/render/types/Rect.ts\"\nimport type { Size } from \"library/render/types/Size.ts\"\nimport type { Locale as RouterLocale } from \"library/router/types.ts\"\nimport type { CSSProperties } from \"react\"\nimport type { RenderingStateKeys } from \"renderer/RenderingStateTracker.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport type { CanvasTree } from \"../CanvasTree.ts\"\nimport type { DynamicValue } from \"../traits/DynamicValue.ts\"\nimport type {\n\tCombinedVariableProviderControlMap,\n\tCombinedVariableProviderValueMap,\n\tVariableProviderControlMap,\n\tVariableProviderValueMap,\n\tVariableProviderVariableMap,\n} from \"../traits/VariableProvider.ts\"\nimport { emptyValueMap, FALLBACK_PROVIDER_ID } from \"../traits/VariableProvider.ts\"\nimport type { VariableReference } from \"../traits/VariableReference.ts\"\nimport type { HasCollectionDataSource } from \"../traits/WithCollectionDataSource.ts\"\nimport type { GridRowHeightType, LayoutType } from \"../traits/WithLayout.ts\"\nimport type { IncludedLocales } from \"../traits/WithLocaleConfig.ts\"\nimport type { Locale } from \"../traits/WithLocales.ts\"\nimport type { VariablesAndDividers } from \"../traits/WithVariables.ts\"\nimport type { CanvasNode } from \"./CanvasNode.ts\"\nimport { DataSourceValueMap } from \"./DataSourceValueMap.ts\"\nimport { NodeCache } from \"./NodeCache.ts\"\nimport type { MaybeNodeID, NodeID } from \"./NodeID.ts\"\nimport type { RootNode } from \"./RootNode.ts\"\nimport {\n\ttype CachedDataSourceVariables,\n\tgetDataSourceVariablesFromDataDefinitionCached,\n} from \"./utils/getDataSourceVariablesFromDataDefinition.ts\"\n\nconst log = getLogger(\"CanvasNodeCache\")\n\nexport interface PlaceholderAttributes extends Size {\n\tstyle?: CSSProperties\n}\n\nexport interface PlaceholderItem {\n\tindex: number\n\tattributes: PlaceholderAttributes\n}\n\nexport interface BoundingBox {\n\tminX: number\n\tmaxX: number\n\tminY: number\n\tmaxY: number\n}\n\nexport interface VariableValueResolver {\n\tgetVariableReferenceValue(ref: VariableReference, variableOverrides?: CombinedVariableProviderValueMap): unknown\n}\n\nexport const notDependentOnComponentLoader = Symbol(\"NotDependentOnComponentLoader\")\nexport const notDependentOnParentVariables = Symbol(\"NotDependentOnParentVariables\")\n\nexport type NotDependentOnComponentLoader = typeof notDependentOnComponentLoader\nexport type NotDependentOnParentVariables = typeof notDependentOnParentVariables\n\nexport interface TranslatePagePathSettings {\n\ttranslatePagePaths: RootNode[\"translatePagePaths\"]\n\ttranslatePagePathsWithAI: RootNode[\"translatePagePathsWithAI\"]\n}\n\nexport interface SourceGroupCache {\n\tupdate: string\n\tlocales: readonly Locale[]\n\tcomponentHash: string | NotDependentOnComponentLoader\n\tparentVariables: VariablesAndDividers | NotDependentOnParentVariables\n\tgroup: LocalizationSourceGroup | undefined\n\tincludedLocales: IncludedLocales\n\tsubGroups: readonly LocalizationSourceGroupCollectionItem[] | undefined\n\tsettings: TranslatePagePathSettings | undefined\n}\n\nexport interface FormContainerConfigSource {\n\tnodeId: NodeID\n\tsaveId: string\n\t/** undefined if the source form is in the current project */\n\tprojectId: string | undefined\n}\n\ninterface LayoutTemplateRenderCache {\n\tdomRect: LayoutTemplateDOMInfo\n\tcanvasCorners?: Point[]\n\tcanvasRect?: Rect\n}\n\nexport type LayoutTemplateRenderCacheBySelector = Map<string, LayoutTemplateRenderCache>\n\nexport class CanvasNodeCache extends NodeCache implements RenderInstanceCache, VariableValueResolver {\n\toverride draft: CanvasNode | null = null\n\toverride treeLineage: {\n\t\tlatestTree: CanvasTree\n\t\tallowPartialNodeAccess: boolean\n\t\tenablePartialScopeAccessChecks: boolean\n\t\tenableScopeWasLoadedChecks: boolean\n\t\trecordEditReason(): void\n\t\tonEditStart?(): void\n\t\tonEditEnd?(): void\n\t\tonEditError?(error: unknown): void\n\t} | null = null\n\n\t// indicates if the node is partially available, without children being parsed and loaded\n\tisShallowLoad = false\n\tisLoadedWasChecked = false\n\n\t/* Forces the replica to rebuild on commit regardless if the master had changes. For example\n    used by applyChanges. */\n\trebuildReplica = false\n\n\t// Instant lookup to know if we are inside of a variant\n\tinsideVariant: boolean = false\n\n\t// Contains the id of the top most ancestor that is a ground node. Does not include the node\n\t// itself if it is a ground node.\n\tgroundNodeAncestorId: MaybeNodeID = undefined\n\n\t// Contains the id of the top most ancestor that is a master.\n\tmasterAncestorId: MaybeNodeID = null\n\n\t// Contains the id of the top most ancestor that is a replica.\n\treplicaAncestorId: MaybeNodeID = null\n\n\t// All ancestor data repeaters. Does not include the node itself.\n\tancestorRepeaterIds: NodeID[] | null = null\n\t// A node may not be in the repeated child of a repeater. In that case, omit that repeater id.\n\t// Cannot replace `cache.ancestorRepeaterIds` because other code that doesn't care if the node\n\t// is in the repeated content relies on this cached value.\n\trepeatedAncestorRepeaterIds: NodeID[] | null = null\n\n\t// signals if the node is in the selection, can change without any node or tree changes\n\tselected: boolean = false\n\n\t// indicates if a text node has it's text editor active\n\tisEditable: boolean = false\n\n\t// indicates if a node is in an effect preview\n\tisEffectPreview: boolean = false\n\teffectType: EffectPreviewType | null = null\n\teffectIds: Set<NodeID> | null = null\n\twebPageEffect: boolean | undefined = undefined\n\n\t// when non-null, the node is in font preview mode (hover in font popout)\n\tfontPreview: FontPreview | null = null\n\n\t// Added in case we happen to be moving a rich text node with `rem` font size\n\t// units. If it's not there, then the `rem` size will show according to the\n\t// browser default, not the actual size of the breakpoint it was a child of.\n\trootFontSizeOverride: number | null = null\n\n\t// indicates if an overlay node is active\n\toverlayVisible: boolean = false\n\n\t// If a node is a descendant of a fixed/relative overlay node, the value\n\t// would be the overlay node id.\n\toverlayAncestorId: MaybeNodeID = null\n\tslotPropertyAncestorId: MaybeNodeID = null\n\n\t// If a node is a descendant of a ticker effect node, the value\n\t// would be the ticker node id.\n\ttickerAncestorId: MaybeNodeID = null\n\n\t// If a node is a descendant of a layout group effect node, the value\n\t// would be the layout group effect node id.\n\tflowEffectAncestorId: MaybeNodeID = null\n\n\t// If a node is a descendant of a form container, the value is the form\n\t// container id.\n\tformContainerAncestorId: MaybeNodeID = null\n\n\t// Store the source form config saveId when duplicating a form container\n\tformContainerConfigSource: FormContainerConfigSource | undefined = undefined\n\n\t// these are keys by which all further fields are reset\n\tlastUpdate = -1\n\tvisible: boolean | undefined = undefined\n\trepeaterIsEmpty = false\n\tlockedByParent: boolean = false\n\tlayout: LayoutType | undefined = undefined\n\tviewportRect: Rect | null = null\n\tgroundNodeMatrix: DOMMatrixReadOnly | null = null\n\n\t// layout properties\n\tconstraintProps: ConstraintProperties | null = null\n\tnewConstraintProps: NewConstraintProperties | null = null\n\tparentDirected: LayoutType | undefined\n\tparentDirectedRowHeightType: GridRowHeightType | undefined\n\tparentDirection: StackDirection | DynamicValue | null = null\n\tparentWidthType: DimensionType | null = null\n\tparentHeightType: DimensionType | null = null\n\tparentDirectedColumnCount: number | undefined\n\n\t/**\n\t * We store the primary render instance in the cache directly to avoid creating an extra map\n\t * when no secondary render instances exist.\n\t */\n\trenderId: RenderId | undefined\n\tparentRenderId: RenderId | undefined\n\n\tparentRect: Rect | undefined\n\tparentMatrix: DOMMatrixReadOnly | undefined\n\n\tparentDirectedRect: Rect | undefined\n\n\tmatrix: DOMMatrixReadOnly | undefined\n\tcanvasRect: Rect | undefined\n\tcornerPoints: Point[] | undefined\n\n\trepeaterItemIds: readonly string[] | undefined\n\trepeaterItemId: string | undefined\n\n\tminX = Infinity\n\tmaxX = -Infinity\n\tminY = Infinity\n\tmaxY = -Infinity\n\n\tsecondaryRenderInstances: Map<RenderId, RenderInstanceCache> | undefined\n\n\t// DOM layout-related\n\tdomRects: Map<RenderId, Rect> | null = null\n\tusesDOMRect: boolean | undefined\n\t/**\n\t * The identifier of the layout template used by a breakpoint node.\n\t * - LocalModuleExportIdentifierString: Active layout template identifier\n\t * - undefined: Breakpoint is not using a layout template\n\t * - null: Cache has been reset\n\t */\n\tusesLayoutTemplateRectForModuleIdentifier: LocalModuleExportIdentifierString | undefined | null = null\n\tlayoutTemplateRects: LayoutTemplateRenderCacheBySelector | undefined = undefined\n\tselectionProperties: CachedSelectionProperties | undefined = undefined\n\n\t// Only set within Vekter and the old renderer\n\tactiveVekterLocale: Locale | undefined\n\t// Only set within the sandbox by the canvas node renderer\n\tactiveRouterLocale: RouterLocale | undefined\n\n\t// vectors nodes\n\tcalculatedPaths: WithPaths | null = null\n\tpaperPath: any | null = null\n\tbezier: any | null = null\n\n\t// used by the layout queue\n\telementByRenderId: Map<RenderId, Element> | undefined\n\telementByLayoutTemplateSelector: Map<string, Element> | undefined\n\n\t/** Text nodes use this to track if they were explicitly edited and not by applying diffs or such. */\n\tcanPatchText = false\n\t// template nodes collect all changes here, and capture them during commit phase\n\ttemplateProperties: Record<string, any> | null = null\n\t// template master nodes keep a list of all templates instances that use them\n\treplicaInstances: NodeID[] | null = null\n\t// linked nodes update peers when they themselve change, TODO merge templateInstances in here\n\tlinks: Set<NodeID> | null = null\n\n\t/**\n\t * Processed sequentially, one placeholder at a time, inserted at `item.index` in the current\n\t * state of `children`. So, for example, with `[{ index: 1 }, { index: 1 }]`, the second element\n\t * will appear before the first, and with `[{ index: 2 }, { index: 1 }]`, there will be one\n\t * child between these two placeholders.\n\t */\n\tplaceholders: PlaceholderItem[] | null = null\n\n\tchildrenInVisualOrder: CanvasNode[] | null = null\n\n\t// Whether to hide the layout template content in the export sandbox\n\tisLayoutTemplateContentHiddenInExport: boolean = false\n\n\t// for debugging\n\tloadedFromDocumentJson: boolean = false\n\n\tlocalizationSourceGroup: SourceGroupCache | undefined\n\n\toverride reset() {\n\t\tsuper.reset()\n\n\t\tthis.lastUpdate = -1\n\t\tthis.groundNodeAncestorId = undefined\n\t\tthis.masterAncestorId = null\n\t\tthis.replicaAncestorId = null\n\t\tthis.overlayAncestorId = null\n\t\tthis.tickerAncestorId = null\n\t\tthis.flowEffectAncestorId = null\n\t\tthis.formContainerAncestorId = null\n\t\tthis.formContainerConfigSource = undefined\n\n\t\tthis.groundNodeMatrix = null\n\t\tthis.viewportRect = null\n\t\tthis.visible = false\n\t\tthis.constraintProps = null\n\t\tthis.newConstraintProps = null\n\t\tthis.parentDirected = undefined\n\t\tthis.parentDirection = null\n\n\t\tthis.renderId = undefined\n\t\tthis.parentRenderId = undefined\n\n\t\tthis.parentMatrix = undefined\n\t\tthis.parentRect = undefined\n\n\t\tthis.parentDirectedRect = undefined\n\n\t\tthis.matrix = undefined\n\t\tthis.canvasRect = undefined\n\t\tthis.cornerPoints = undefined\n\n\t\tthis.repeaterItemIds = undefined\n\t\tthis.repeaterItemId = undefined\n\n\t\tthis.secondaryRenderInstances = undefined\n\n\t\tthis.domRects = null\n\t\tthis.usesDOMRect = undefined\n\t\tthis.layoutTemplateRects = undefined\n\t\tthis.usesLayoutTemplateRectForModuleIdentifier = null\n\n\t\tthis.calculatedPaths = null\n\t\tthis.paperPath = null\n\t\tthis.bezier = null\n\n\t\tthis.activeVekterLocale = undefined\n\t\tthis.activeRouterLocale = undefined\n\n\t\tthis.canPatchText = false\n\n\t\tthis.childrenInVisualOrder = null\n\n\t\tthis.ancestorRepeaterIds = null\n\t\tthis.repeatedAncestorRepeaterIds = null\n\t}\n\n\tresetForRendering() {\n\t\tsuper.reset()\n\n\t\t// Remove the render state usage.\n\t\tthis.renderingStatesUsed = null\n\t\tthis.useViewportOfNodeId = null\n\t\tthis.useRectsOfRenderIds = null\n\t\tthis.useGroundNodeInViewportRendering = null\n\n\t\tthis.lastUpdate = -1\n\t\tthis.constraintProps = null\n\t\tthis.newConstraintProps = null\n\n\t\tthis.usesDOMRect = undefined\n\t\tthis.usesLayoutTemplateRectForModuleIdentifier = null\n\t\tthis.calculatedPaths = null\n\t\tthis.paperPath = null\n\t\tthis.bezier = null\n\n\t\tthis.canPatchText = false\n\n\t\tthis.ancestorRepeaterIds = null\n\t\tthis.repeatedAncestorRepeaterIds = null\n\t\tthis.childrenInVisualOrder = null\n\t}\n\n\toverride tree(): CanvasTree | undefined {\n\t\treturn this.treeLineage?.latestTree\n\t}\n\n\tgetRenderInstance(renderId: RenderId): RenderInstanceCache | undefined {\n\t\tif (this.renderId === renderId) return this\n\t\treturn this.secondaryRenderInstances?.get(renderId)\n\t}\n\n\t*iterateRenderInstances(): IterableIterator<[RenderId, RenderInstanceCache]> {\n\t\tif (isString(this.renderId)) {\n\t\t\tyield [this.renderId, this]\n\t\t}\n\n\t\tif (this.secondaryRenderInstances) {\n\t\t\tyield* this.secondaryRenderInstances.entries()\n\t\t}\n\t}\n\n\tprivate inheritedCombinedVariableValueMap: CombinedVariableProviderValueMap | undefined\n\n\tsetInheritedCombinedVariableValueMap(inherited: CombinedVariableProviderValueMap | undefined) {\n\t\tthis.inheritedCombinedVariableValueMap = inherited\n\t}\n\n\tprivate combinedVariableValueMap:\n\t\t| {\n\t\t\t\tcombined: CombinedVariableProviderValueMap | undefined\n\t\t\t\tprovided: VariableProviderValueMap | undefined\n\t\t\t\tinherited: CombinedVariableProviderValueMap | undefined\n\t\t  }\n\t\t| undefined\n\n\t/** Use cached or inherited value if possible */\n\tgetCombinedVariableValueMap(\n\t\tinherited: CombinedVariableProviderValueMap | undefined,\n\t\tprovided: VariableProviderValueMap | undefined,\n\t\t_node: CanvasNode,\n\t\t_tree: CanvasTree,\n\t\t_child: CanvasNode | undefined,\n\t): CombinedVariableProviderValueMap | undefined | \"noCache\" {\n\t\tif (\n\t\t\t!this.combinedVariableValueMap ||\n\t\t\tthis.combinedVariableValueMap.inherited !== inherited ||\n\t\t\tthis.combinedVariableValueMap.provided !== provided\n\t\t) {\n\t\t\treturn \"noCache\"\n\t\t}\n\t\treturn this.combinedVariableValueMap.combined\n\t}\n\n\t/** Reset cache with latest values */\n\tsetCombinedVariableValueMap(\n\t\tinherited: CombinedVariableProviderValueMap | undefined,\n\t\tprovided: VariableProviderValueMap | undefined,\n\t\tcombined: CombinedVariableProviderValueMap | undefined,\n\t\t_node: CanvasNode,\n\t\t_tree: CanvasTree,\n\t\t_child: CanvasNode | undefined,\n\t) {\n\t\tthis.combinedVariableValueMap = {\n\t\t\tinherited,\n\t\t\tcombined,\n\t\t\tprovided,\n\t\t}\n\t}\n\n\tprivate combinedVariableControlMap:\n\t\t| {\n\t\t\t\tcombined: CombinedVariableProviderControlMap | undefined\n\t\t\t\tprovided: VariableProviderControlMap | undefined\n\t\t\t\tinherited: CombinedVariableProviderControlMap | undefined\n\t\t  }\n\t\t| undefined\n\n\tgetCombinedVariableControlMap(\n\t\tinherited: CombinedVariableProviderControlMap | undefined,\n\t\tprovided: VariableProviderControlMap | undefined,\n\t\t_node: CanvasNode,\n\t\t_tree: CanvasTree,\n\t\t_child: CanvasNode | undefined,\n\t): CombinedVariableProviderControlMap | undefined | \"noCache\" {\n\t\tif (\n\t\t\t!this.combinedVariableControlMap ||\n\t\t\tthis.combinedVariableControlMap.inherited !== inherited ||\n\t\t\tthis.combinedVariableControlMap.provided !== provided\n\t\t) {\n\t\t\treturn \"noCache\"\n\t\t}\n\t\treturn this.combinedVariableControlMap.combined\n\t}\n\n\t/** Unsafe because it gets the latest value without any validation. Meant for testing only. */\n\tgetUnsafeCombinedVariableControlMap() {\n\t\treturn this.combinedVariableControlMap?.combined\n\t}\n\n\t/** Reset cache with latest values */\n\tsetCombinedVariableControlMap(\n\t\tinherited: CombinedVariableProviderControlMap | undefined,\n\t\tprovided: VariableProviderControlMap | undefined,\n\t\tcombined: CombinedVariableProviderControlMap | undefined,\n\t\t_node: CanvasNode,\n\t\t_tree: CanvasTree,\n\t\t_child: CanvasNode | undefined,\n\t) {\n\t\tthis.combinedVariableControlMap = {\n\t\t\tinherited,\n\t\t\tprovided,\n\t\t\tcombined,\n\t\t}\n\t}\n\n\t/** Set the variables and controls map for the new node renderer. */\n\tsetVariableValueAndControlMap(\n\t\tcombinedValueMap: CombinedVariableProviderValueMap | undefined,\n\t\tinheritedCombinedValueMap: CombinedVariableProviderValueMap | undefined,\n\t\tcombinedControlMap: CombinedVariableProviderControlMap | undefined,\n\t\tactiveLocale: RouterLocale | undefined,\n\t\t_node: CanvasNode,\n\t\t_tree: CanvasTree,\n\t\t_child: CanvasNode | undefined,\n\t) {\n\t\tthis.inheritedCombinedVariableValueMap = inheritedCombinedValueMap\n\n\t\tthis.combinedVariableValueMap = {\n\t\t\tinherited: undefined,\n\t\t\tprovided: undefined,\n\t\t\tcombined: combinedValueMap,\n\t\t}\n\n\t\tthis.combinedVariableControlMap = {\n\t\t\tinherited: undefined,\n\t\t\tprovided: undefined,\n\t\t\tcombined: combinedControlMap,\n\t\t}\n\n\t\tthis.activeRouterLocale = activeLocale\n\t}\n\n\t/** Unsafe because it gets the latest value without any validation */\n\tgetUnsafeCombinedVariableValueMap() {\n\t\treturn this.combinedVariableValueMap?.combined\n\t}\n\n\t/** Unsafe because it gets the latest value without any validation */\n\tgetUnsafeInheritedCombinedVariableValueMap() {\n\t\treturn this.inheritedCombinedVariableValueMap\n\t}\n\n\t/** Gets the value of the provided variable reference, resolved from its variable provider. */\n\tgetVariableReferenceValue(\n\t\tref: VariableReference,\n\t\tvariableOverrides?: CombinedVariableProviderValueMap,\n\t): unknown | undefined {\n\t\tconst { id, providerId = FALLBACK_PROVIDER_ID } = ref\n\t\tif (variableOverrides) {\n\t\t\tconst providerOverride = variableOverrides.get(providerId)\n\t\t\tif (providerOverride) return providerOverride.get(id)\n\t\t}\n\t\treturn this.inheritedCombinedVariableValueMap?.get(providerId)?.get(id)\n\t}\n\n\t/** Get variable control from any provider in scope */\n\tgetVariableControlByReference(ref: VariableReference): VerifiedControlDescription | undefined {\n\t\tconst { id, providerId = FALLBACK_PROVIDER_ID } = ref\n\t\treturn this.combinedVariableControlMap?.combined?.get(providerId)?.get(id)\n\t}\n\n\t/** Get variable control provided by this node. Doesn't include ancestor providers. */\n\tgetVariableControlByKey(key: string): VerifiedControlDescription | undefined {\n\t\treturn this.combinedVariableControlMap?.provided?.get(key)\n\t}\n\n\tcanResolveVariableReference(ref: VariableReference): boolean {\n\t\tconst { id, providerId = FALLBACK_PROVIDER_ID } = ref\n\t\treturn this.inheritedCombinedVariableValueMap?.get(providerId)?.has(id) === true\n\t}\n\n\t// Data Source Variables\n\n\tprivate dataSourceVariableMapCache?: {\n\t\tvariableMap: VariableProviderVariableMap\n\t\tcontrolMap: VariableProviderControlMap\n\n\t\tcacheKey: {\n\t\t\tdataSourceVariables: CachedDataSourceVariables\n\t\t}\n\t}\n\n\tprotected computeDataSourceVariableMap(\n\t\t_node: CanvasNode,\n\t\tdataSourceVariables: CachedDataSourceVariables,\n\t): {\n\t\tvariableMap: VariableProviderVariableMap\n\t\tcontrolMap: VariableProviderControlMap\n\t} {\n\t\treturn {\n\t\t\tvariableMap: dataSourceVariables.variableMap,\n\t\t\tcontrolMap: dataSourceVariables.controlMap,\n\t\t}\n\t}\n\n\tprivate computeDataSourceVariableMapIfNeeded(\n\t\tnode: CanvasNode & HasCollectionDataSource,\n\t\ttree: CanvasTree,\n\t\t_child: CanvasNode | undefined,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tcomponentLoaderHash: string | undefined,\n\t): void {\n\t\tconst dataSourceVariables = getDataSourceVariablesFromDataDefinitionCached(\n\t\t\tnode.dataIdentifier,\n\t\t\ttree,\n\t\t\tcomponentLoader,\n\t\t\tcomponentLoaderHash,\n\t\t)\n\n\t\tif (\n\t\t\tthis.dataSourceVariableMapCache &&\n\t\t\tthis.dataSourceVariableMapCache.cacheKey.dataSourceVariables === dataSourceVariables\n\t\t) {\n\t\t\treturn\n\t\t}\n\n\t\tthis.dataSourceVariableMapCache = {\n\t\t\t...this.computeDataSourceVariableMap(node, dataSourceVariables),\n\t\t\tcacheKey: {\n\t\t\t\tdataSourceVariables,\n\t\t\t},\n\t\t}\n\t}\n\n\tprivate dataSourceValueMapCache?: {\n\t\tvalueMap: VariableProviderValueMap\n\n\t\tcacheKey: {\n\t\t\titem: Record<string, unknown> | undefined\n\t\t\tcontrolMap: VariableProviderControlMap | undefined\n\t\t}\n\t}\n\n\tprotected computeDataSourceValueMap(\n\t\t_node: CanvasNode,\n\t\ttree: CanvasTree,\n\t\tcontrolMap: VariableProviderControlMap | undefined,\n\t\titem: Record<string, unknown> | undefined,\n\t\t_itemCount: number,\n\t): VariableProviderValueMap {\n\t\tif (controlMap) {\n\t\t\treturn new DataSourceValueMap(tree, controlMap, item)\n\t\t}\n\n\t\treturn emptyValueMap\n\t}\n\n\tprivate computeDataSourceValueMapIfNeeded(\n\t\tnode: CanvasNode & HasCollectionDataSource,\n\t\ttree: CanvasTree,\n\t\tchild: CanvasNode | undefined,\n\t\tsandboxRepeaterData: SandboxRepeaterData,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tcomponentLoaderHash: string | undefined,\n\t): void {\n\t\tconst items = sandboxRepeaterData.getData(node.id)\n\t\tconst item = items?.[0]\n\t\tconst itemCount = items?.length ?? 0\n\t\tconst controlMap = this.getDataSourceControlMap(node, tree, child, componentLoader, componentLoaderHash)\n\n\t\tif (\n\t\t\tthis.dataSourceValueMapCache &&\n\t\t\tthis.dataSourceValueMapCache.cacheKey.item === item &&\n\t\t\tthis.dataSourceValueMapCache.cacheKey.controlMap === controlMap\n\t\t) {\n\t\t\treturn\n\t\t}\n\n\t\tif (componentLoader.environment === \"sandbox\" && !item) {\n\t\t\tlog.warn(\"No data found for node\", node.id)\n\t\t}\n\n\t\tthis.dataSourceValueMapCache = {\n\t\t\tvalueMap: this.computeDataSourceValueMap(node, tree, controlMap, item, itemCount),\n\t\t\tcacheKey: {\n\t\t\t\titem,\n\t\t\t\tcontrolMap,\n\t\t\t},\n\t\t}\n\t}\n\n\tgetDataSourceVariableMap(\n\t\tnode: CanvasNode & HasCollectionDataSource,\n\t\ttree: CanvasTree,\n\t\tchild: CanvasNode | undefined,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tcomponentLoaderHash: string | undefined,\n\t): VariableProviderVariableMap | undefined {\n\t\tthis.computeDataSourceVariableMapIfNeeded(node, tree, child, componentLoader, componentLoaderHash)\n\t\treturn this.dataSourceVariableMapCache?.variableMap\n\t}\n\n\tgetDataSourceValueMap(\n\t\tnode: CanvasNode & HasCollectionDataSource,\n\t\ttree: CanvasTree,\n\t\tchild: CanvasNode | undefined,\n\t\tsandboxRepeaterData: SandboxRepeaterData,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tcomponentLoaderHash: string | undefined,\n\t): VariableProviderValueMap | undefined {\n\t\tthis.computeDataSourceValueMapIfNeeded(node, tree, child, sandboxRepeaterData, componentLoader, componentLoaderHash)\n\t\treturn this.dataSourceValueMapCache?.valueMap\n\t}\n\n\tgetDataSourceControlMap(\n\t\tnode: CanvasNode & HasCollectionDataSource,\n\t\ttree: CanvasTree,\n\t\tchild: CanvasNode | undefined,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tcomponentLoaderHash: string | undefined,\n\t): VariableProviderControlMap | undefined {\n\t\tthis.computeDataSourceVariableMapIfNeeded(node, tree, child, componentLoader, componentLoaderHash)\n\t\treturn this.dataSourceVariableMapCache?.controlMap\n\t}\n\n\tgetLocaleCode() {\n\t\tif (this.activeRouterLocale) return this.activeRouterLocale.code\n\t\treturn this.activeVekterLocale?.code ?? \"en-US\"\n\t}\n\n\tparentid: MaybeNodeID\n\tneedsMeasureAffectsParent = false\n\n\twidth: number | undefined\n\theight: number | undefined\n\tviewportHeight: number | undefined\n\tuseViewportOfNodeId: string | null = null\n\tuseRectsOfRenderIds: Set<RenderId> | null = null\n\tuseGroundNodeInViewportRendering: NodeID | null = null\n\trenderingStatesUsed: Set<RenderingStateKeys> | null = null\n\n\t/** Notify that this node's rendering depends on state not in the node but in the rendering context. */\n\tuseRenderingState(state: RenderingStateKeys) {\n\t\tif (!this.renderingStatesUsed) {\n\t\t\tthis.renderingStatesUsed = new Set()\n\t\t}\n\t\tthis.renderingStatesUsed.add(state)\n\t}\n\n\tuseViewportState(nodeId: string) {\n\t\tthis.useViewportOfNodeId = nodeId\n\t}\n\n\t/** Notify that this node's rendering depends on the rects of any of the given nodes. */\n\tuseNodeRectsState(ids: Set<RenderId> | null | undefined) {\n\t\tthis.useRectsOfRenderIds = ids ?? null\n\t}\n\n\tuseGroundNodeInViewport(groundNodeId: NodeID) {\n\t\tthis.useGroundNodeInViewportRendering = groundNodeId\n\t}\n\n\t/** Get the overall layout template rect for a breakpoint. */\n\tgetLayoutTemplateContainerRect(): LayoutTemplateRenderCache | undefined {\n\t\treturn this.layoutTemplateRects?.get(\"container\")\n\t}\n\n\t/**\n\t * Returns the raw dom rect as measured by the canvas sandbox for a given `renderId`. If you\n\t * want to know the rect for a node use `CanvasNode.rect` or `WithDOMLayout.getDOMRect` instead.\n\t */\n\tgetRawDOMRect(renderId: RenderId) {\n\t\treturn this.domRects?.get(renderId) ?? null\n\t}\n\n\tsetRawDOMRect(renderId: RenderId, rect: Rect) {\n\t\tthis.domRects ??= new Map()\n\t\tthis.domRects.set(renderId, rect)\n\t}\n}\n\nexport interface RenderInstanceCache extends BoundingBox {\n\tparentRenderId: RenderId | undefined\n\n\tparentRect: Rect | undefined\n\tparentMatrix: DOMMatrixReadOnly | undefined\n\n\tparentDirectedRect: Rect | undefined\n\n\tmatrix: DOMMatrixReadOnly | undefined\n\tcanvasRect: Rect | undefined\n\tcornerPoints: Point[] | undefined\n\n\trepeaterItemIds: readonly string[] | undefined\n\trepeaterItemId: string | undefined\n}\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport type { ModuleExportIdentifierString, Prettify } from \"@framerjs/shared\"\nimport { assert, getLogger, hostInfo, unhandledError } from \"@framerjs/shared\"\nimport {\n\tgetRelatedReplicaNodes,\n\tisOnlyVisibleInCurrentVariant,\n} from \"code-generation/utils/isOnlyVisibleInCurrentVariant.ts\"\nimport type { SandboxRepeaterData } from \"document/SandboxRepeaterData.ts\"\nimport type { IsReplica } from \"document/models/CanvasTree/traits/WithTemplate.ts\"\nimport {\n\tgetLocaleCombinedVariableProviderControlMap,\n\tgetLocaleCombinedVariableProviderValueMap,\n\tisProvidingLocaleVariable,\n} from \"document/utils/LocaleVariable.ts\"\nimport type { RenderId } from \"document/utils/RenderId.ts\"\nimport type { LayerProps } from \"library/render/presentation/Layer.tsx\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport type { Rect } from \"library/render/types/Rect.ts\"\nimport type { Size } from \"library/render/types/Size.ts\"\nimport { isEqual } from \"library/render/utils/isEqual.ts\"\nimport type { Locale as RouterLocale } from \"library/router/types.ts\"\nimport type { ComponentType } from \"react\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { withClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { CanvasTree } from \"../CanvasTree.ts\"\nimport { isComputedValue, isComputedValueFromVariableReference } from \"../traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"../traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"../traits/DynamicValue.ts\"\nimport type { FetchDataValueResolver } from \"../traits/FetchDataValue.ts\"\nimport { type Generated, getGeneratedValue, isGeneratedValue } from \"../traits/Generated.ts\"\nimport type { FourPixelNumberShorthand } from \"../traits/NumberShorthand.ts\"\nimport type { ResponsiveImage } from \"../traits/ResponsiveImage.ts\"\nimport type {\n\tCombinedVariableProviderControlMap,\n\tCombinedVariableProviderValueMap,\n} from \"../traits/VariableProvider.ts\"\nimport { FALLBACK_PROVIDER_ID } from \"../traits/VariableProvider.ts\"\nimport { isVariableReference } from \"../traits/VariableReference.ts\"\nimport type { WithFill } from \"../traits/WithFill.ts\"\nimport { hasItemsOrderOverride } from \"../traits/WithItemsOrder.ts\"\nimport { maybeConvertFlexValueToVekterValue, objectWithLayout } from \"../traits/WithLayout.ts\"\nimport type { Locale } from \"../traits/WithLocales.ts\"\nimport type { WithPadding } from \"../traits/WithPadding.ts\"\nimport type { WithPluginData } from \"../traits/WithPluginData.ts\"\nimport type { ParentSizeInfo, UpdateForRectOptions } from \"../traits/WithRect.ts\"\nimport { withSizeDimensionType } from \"../traits/WithSizeDimensionType.ts\"\nimport { isMaster, isReplica, isReplicaOrReplicaChild } from \"../traits/WithTemplate.ts\"\nimport { withVariableProvider } from \"../traits/WithVariableProvider.ts\"\nimport type { VectorSetItemVariableInitialValue } from \"../traits/WithVariables.ts\"\nimport { isVariantOrVariantChild } from \"../traits/WithVariant.ts\"\nimport type { VekterConstraintValues } from \"../traits/utils/VekterConstraintValues.ts\"\nimport { computeValue } from \"../traits/utils/computeValue.ts\"\nimport { getNodePropertyControlDescription, isNodePropertyControlKey } from \"../utils/nodePropertyControlDefinitions.ts\"\nimport { CanvasNodeCache } from \"./CanvasNodeCache.ts\"\nimport type { ChildList } from \"./ChildList.ts\"\nimport { MutableNode } from \"./MutableNode.ts\"\nimport { type NodeID, stringFromNodeID } from \"./NodeID.ts\"\nimport { TemplateHelper, generateReplicaChildId, ignoredOverrideKeys } from \"./TemplateHelper.ts\"\nimport { isSlotPropertyNode } from \"./utils/nodeCheck.ts\"\n\nconst log = getLogger(\"CanvasNode\")\n\n/**\n * This is the list of props we want to exclude when pushing the variant edits\n * to the primary. When updating a replica variant node through canvasNode.set,\n * if we detect that one of these props is included in the update, we just abort\n * syncing the change to master.\n */\nconst ignoreUpdateKeysByUpstreamVariant = new Set([\n\t\"visible\",\n\t\"name\",\n\t\"mutable\",\n\t\"cache\",\n\t\"update\",\n\t\"children\",\n\t\"id\",\n\t\"itemsOrder\",\n\t\"parentid\",\n\t\"originalid\",\n\t\"replicaInfo\",\n\t\"isMaster\",\n\t\"isVariant\",\n\t\"isExternalMaster\",\n\t\"contentHash\",\n\t\"duplicatedFrom\",\n])\n\nfunction canApplyUpdateToUpstreamVariant(updatedKeys: string[]): boolean {\n\treturn updatedKeys.every(key => !ignoreUpdateKeysByUpstreamVariant.has(key))\n}\n\ninterface WalkWithSkipChildrenIteratorValue {\n\tnode: CanvasNode\n\tskipChildren: () => void\n}\n\nexport type MaybeCanvasNode = CanvasNode | null | undefined\nexport type MaybeAnyCanvasNode = AnyCanvasNode | null | undefined\n\n// When the node values is a DynamicValue, we extend the type with undefined since we may not be able to resolve it.\ntype OptionallyExtendsUndefined<V, T> = V extends DynamicValue ? T | undefined : T\n\ntype ErrorMessage =\n\t\"This node can either be a shallow or a fully loaded node, you need to use a special nodeCheck to determine which one, like isScopeNode(node, true) or node.loaded or node.isLoaded()\"\n\ninterface NeverWalkableNode {\n\tchildren: never\n\twalk: never\n\tdescendants: never\n\tfind: never\n\tsome: never\n\twalkWithSkipChildren: never\n\taddChild: never\n\tgetChild: never\n\tclone: never\n\ttoJS: never\n}\n\ntype FullyLoadedScopeKeys = keyof NeverWalkableNode\n\ninterface ShallowNodeError<Tag> {\n\t_?: ErrorMessage & Tag\n}\n\n/**\n * Creates a shallow type from a canvas node interface that forbids usage of children and related methods\n * @param KeysToOmit should be the keys that have access to children\n * @see {@link WithScopeLoader}\n */\nexport type ShallowNode<Node extends CanvasNode, KeysToOmit extends keyof Node = never> = Prettify<\n\tShallowNodeError<Node> & NeverWalkableNode & Omit<Node, FullyLoadedScopeKeys | KeysToOmit>\n>\n\nexport type AsAnyNode<Node extends CanvasNode, KeysToOmit extends keyof Node = never> = Prettify<\n\tShallowNodeError<Node> & Omit<Node, FullyLoadedScopeKeys | KeysToOmit>\n>\n\nexport type AnyCanvasNode = AsAnyNode<CanvasNode>\n\nexport interface CanvasNode {\n\t/**\n\t * Will return the latest tree, or `null` if the node has not been added to\n\t * a tree.\n\t */\n\ttree(tree?: CanvasTree): CanvasTree | undefined\n\n\t/**\n\t * Returns the first node that meets the conditions set by the passed in\n\t * function. Otherwise, returns `null`.\n\t *\n\t * Important: This will test the starting node as well!\n\t */\n\tfind<S extends CanvasNode>(predicate: (node: CanvasNode) => node is S): S | null\n\tfind(predicate: (node: CanvasNode) => unknown): CanvasNode | null\n\n\t/**\n\t * Iterate the parent of this node, the grandparent, and so on, up to the\n\t * root of the tree.\n\t */\n\tancestors(): IterableIterator<CanvasNode>\n\n\t/**\n\t * Iterate the node and its children recursively in depth-first order.\n\t */\n\twalk(): IterableIterator<CanvasNode>\n}\n\n/**\n * Base class for all nodes in our document format.\n */\n// biome-ignore lint/suspicious/noUnsafeDeclarationMerging: intentional\nexport class CanvasNode extends withClassDiscriminator(\"CanvasNode\", MutableNode) {\n\tdeclare children?: ChildList<CanvasNode>\n\n\t/**\n\t * Controls whether the node is visible. However, this property can be a variable reference,\n\t * or a parent can be hidden, so its value is not directly useful. If you need to know if a node\n\t * is currently showing on the canvas, use `node.isVisible()` instead. However, if you need to\n\t * set or know the exact value (`true` | `false` | `VariableReference`), you should still use\n\t * this key. If you want to take ancestor and empty data repeater visibility into account,\n\t * use `node.cache.visible`.\n\t */\n\tdeclare visible: boolean | DynamicValue\n\tdeclare name: string | Generated<string> | null\n\tdeclare cache: CanvasNodeCache\n\n\tisVisible() {\n\t\treturn this.resolveValue(\"visible\") !== false\n\t}\n\n\tconstructor(properties?: Partial<CanvasNode>, cache: CanvasNodeCache = new CanvasNodeCache()) {\n\t\tsuper(properties, cache)\n\t\tthis.name = properties?.name ?? null\n\t\tthis.visible = properties?.visible ?? false\n\t}\n\n\t/**\n\t * All mutations to nodes should go through here, so master/replica's can capture changes.\n\t *\n\t * @param _properties a subset of the possible properties of this node type\n\t * @param optionalTree if the tree is easily available, passing it in provides a small performance boost and\n\t * gives clearer errors if using outdated tree\n\t * @param force forces the value to be applied to replica overrides without checking if the value differs\n\t * @param updateUpstream controls whether the master should be updated if this is the only visible node\n\t * between all variants\n\t */\n\toverride set(_properties: Partial<this>, optionalTree?: CanvasTree, force = false, updateUpstream = true): this {\n\t\tthis.cache.treeLineage?.onEditStart?.()\n\n\t\ttry {\n\t\t\tconst properties = _properties as Record<string, unknown>\n\t\t\tconst draft = this.asDraft(optionalTree)\n\t\t\tconst nodePropertyKeys = Object.keys(properties) as Array<keyof CanvasNode>\n\n\t\t\tconst tree = optionalTree ?? draft.tree() ?? null\n\t\t\tif (!hostInfo.isProduction) {\n\t\t\t\tassert(!tree?.isViewOnly, \"Updating a node is not allowed in view only mode\")\n\t\t\t} else if (tree?.isViewOnly) {\n\t\t\t\t// Ideally this should assert in production too, but until we caught\n\t\t\t\t// the most common cases, we should not crash on it.\n\t\t\t\tlog.reportError(\"Updating a node is not allowed in view only mode\")\n\t\t\t}\n\n\t\t\tthis.cache.treeLineage?.recordEditReason()\n\n\t\t\tif (draft.originalid) {\n\t\t\t\tif (!draft.cache.templateProperties) {\n\t\t\t\t\tdraft.cache.templateProperties = {}\n\t\t\t\t}\n\n\t\t\t\t// When editing variants, push the changes upstream to the\n\t\t\t\t// original node, and reset the overrides on the replica and\n\t\t\t\t// inheritsFrom so they stay in sync.\n\t\t\t\ttry {\n\t\t\t\t\t// Push changes to primary if the node is only visible in\n\t\t\t\t\t// the current variant\n\t\t\t\t\tif (\n\t\t\t\t\t\ttree &&\n\t\t\t\t\t\tupdateUpstream &&\n\t\t\t\t\t\t!isReplica(draft) &&\n\t\t\t\t\t\tcanApplyUpdateToUpstreamVariant(nodePropertyKeys) &&\n\t\t\t\t\t\tisOnlyVisibleInCurrentVariant(tree, draft)\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst originalNode = tree.getNode(draft.originalid)\n\t\t\t\t\t\toriginalNode?.set(properties, tree)\n\n\t\t\t\t\t\t// Clear overrides\n\t\t\t\t\t\tconst replica = TemplateHelper.getReplicaForTemplateNode(tree, draft)\n\t\t\t\t\t\tif (replica) {\n\t\t\t\t\t\t\tif (replica.cache.visible !== undefined) {\n\t\t\t\t\t\t\t\tTemplateHelper.resetOverridesByProperty(tree, replica, draft, nodePropertyKeys)\n\t\t\t\t\t\t\t\t// Clear inherited overrides\n\t\t\t\t\t\t\t\tif (replica.replicaInfo.inheritsFrom) {\n\t\t\t\t\t\t\t\t\tconst inheritedNode = tree.get(replica.replicaInfo.inheritsFrom)\n\t\t\t\t\t\t\t\t\tif (inheritedNode && isReplica(inheritedNode)) {\n\t\t\t\t\t\t\t\t\t\tconst relatedNodeId = generateReplicaChildId(inheritedNode.id, draft.originalid)\n\t\t\t\t\t\t\t\t\t\tconst relatedNode = tree.get(relatedNodeId)\n\t\t\t\t\t\t\t\t\t\tif (relatedNode) {\n\t\t\t\t\t\t\t\t\t\t\tif (relatedNode.cache.visible !== undefined) {\n\t\t\t\t\t\t\t\t\t\t\t\tTemplateHelper.resetOverridesByProperty(tree, inheritedNode, relatedNode, nodePropertyKeys)\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\tlog.reportError(\"set properties: relatedNode.cache.visible not initialized\", {\n\t\t\t\t\t\t\t\t\t\t\t\t\tnodeId: this.id,\n\t\t\t\t\t\t\t\t\t\t\t\t\trelatedNodeId: relatedNode.id,\n\t\t\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tlog.reportError(\"set properties: replica.cache.visible not initialized\", {\n\t\t\t\t\t\t\t\t\tnodeId: this.id,\n\t\t\t\t\t\t\t\t\treplicaNodeId: replica.id,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn draft\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tunhandledError(error)\n\t\t\t\t}\n\n\t\t\t\tfor (const nodePropertyKey of nodePropertyKeys) {\n\t\t\t\t\tif (ignoredOverrideKeys[nodePropertyKey]) continue\n\t\t\t\t\tconst newValue = properties[nodePropertyKey]\n\t\t\t\t\t// Only override symbol properties when values are different\n\t\t\t\t\tif (!force && isEqual(draft[nodePropertyKey], newValue)) continue\n\t\t\t\t\tdraft.cache.templateProperties[nodePropertyKey] = newValue\n\t\t\t\t}\n\t\t\t} else if (properties[\"html\"] || properties[\"styledText\"]) {\n\t\t\t\t// For text nodes that are not replica's, we want to track when they are explicitly\n\t\t\t\t// edited. Then in template helper we know if we need to patch any replica's.\n\t\t\t\tdraft.cache.canPatchText = true\n\t\t\t}\n\n\t\t\t// Disabling layout on a variant (child)\n\t\t\tif (tree && isVariantOrVariantChild(draft) && objectWithLayout(properties) && properties.layout === undefined) {\n\t\t\t\tif (isReplicaOrReplicaChild(draft)) {\n\t\t\t\t\tif (!draft.cache.templateProperties) {\n\t\t\t\t\t\tdraft.cache.templateProperties = {}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (withSizeDimensionType(draft)) {\n\t\t\t\t\t\t// When overriding the layout to be disabled on a replica, it's important to also override its\n\t\t\t\t\t\t// dimension type to ensure that any future dimension type updates on the master won't result in an\n\t\t\t\t\t\t// invalid type being pushed to the replicas. For instance, if a replica has layout disabled,\n\t\t\t\t\t\t// inheriting auto-height from its master would be invalid. Normally when disabling layout,\n\t\t\t\t\t\t// properties should include a valid dimension type as well. But we fallback to fixed number in case\n\t\t\t\t\t\t// the dimension types are still auto.\n\t\t\t\t\t\tconst nextWidthType = properties[\"widthType\"] ?? draft.widthType\n\t\t\t\t\t\tconst nextHeightType = properties[\"heightType\"] ?? draft.heightType\n\t\t\t\t\t\tdraft.cache.templateProperties[\"widthType\"] =\n\t\t\t\t\t\t\tnextWidthType === DimensionType.Auto ? DimensionType.FixedNumber : nextWidthType\n\t\t\t\t\t\tdraft.cache.templateProperties[\"heightType\"] =\n\t\t\t\t\t\t\tnextHeightType === DimensionType.Auto ? DimensionType.FixedNumber : nextHeightType\n\t\t\t\t\t\tdraft.cache.rebuildReplica = true\n\t\t\t\t\t}\n\t\t\t\t\t// Also clear its itemsOrder override.\n\t\t\t\t\tif (hasItemsOrderOverride(draft)) {\n\t\t\t\t\t\tdraft.cache.templateProperties[\"itemsOrder\"] = undefined\n\t\t\t\t\t\tdraft.cache.rebuildReplica = true\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// When disabling a variant layout on the master, go through its replicas and cleanup the itemsOrder\n\t\t\t\t\t// overrides. Preserve the order if toggle between stack & grid, or if the replica has layout overridden\n\t\t\t\t\t// to enabled.\n\t\t\t\t\tconst relatedNodesInfo = getRelatedReplicaNodes<CanvasNode>(tree, draft)\n\t\t\t\t\trelatedNodesInfo.forEach(info => {\n\t\t\t\t\t\tconst replicaNode = info.relatedNode\n\t\t\t\t\t\tif (!hasItemsOrderOverride(replicaNode)) return\n\t\t\t\t\t\t// Skip if layout is overridden to enabled\n\t\t\t\t\t\tconst overrides = info.replicaRoot.replicaInfo.overrides[draft.id]\n\t\t\t\t\t\tif (overrides && \"layout\" in overrides && !!overrides.layout) return\n\t\t\t\t\t\treplicaNode.set({ itemsOrder: undefined }, tree)\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdraft.verifyPropertiesToSet(properties)\n\t\t\tdraft.assign(properties)\n\t\t\treturn draft\n\t\t} catch (error) {\n\t\t\tthis.cache.treeLineage?.onEditError?.(error)\n\t\t\tthrow error\n\t\t} finally {\n\t\t\tthis.cache.treeLineage?.onEditEnd?.()\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * Does the same as `node.set()` except it ignores all master replica logic. Use with care.\n\t *\n\t * @param properties\n\t * @param tree\n\t * @returns\n\t */\n\tsetIgnoringReplica(properties: { [key: string]: unknown }, tree?: CanvasTree): this {\n\t\tthis.cache.treeLineage?.onEditStart?.()\n\n\t\ttry {\n\t\t\tthis.cache.treeLineage?.recordEditReason()\n\n\t\t\tconst draft = this.asDraft(tree)\n\t\t\tdraft.verifyPropertiesToSet(properties)\n\t\t\tdraft.assign(properties)\n\t\t\treturn draft\n\t\t} catch (error) {\n\t\t\tthis.cache.treeLineage?.onEditError?.(error)\n\t\t\tthrow error\n\t\t} finally {\n\t\t\tthis.cache.treeLineage?.onEditEnd?.()\n\t\t}\n\t}\n\n\toverride preCommit(this: CanvasNode, tree: CanvasTree, _componentLoader: AnyComponentLoader) {\n\t\tassert(this === this.cache.draft, \"Pre-commit node must be its future\")\n\t\tif (isReplica(this)) {\n\t\t\tTemplateHelper.replicaWithChanges(tree, this)\n\t\t}\n\t\t/**\n\t\t * All of this master's replicas need to be rebuilt when the node changes,\n\t\t * and some of this replica's replicas need to be rebuilt if they inherit overrides from this replica.\n\t\t */\n\t\tif (isMaster(this) || isReplica(this)) {\n\t\t\tconst replicaInstances = this.cache.replicaInstances\n\t\t\tif (replicaInstances) {\n\t\t\t\tfor (let i = 0, il = replicaInstances.length; i < il; i++) {\n\t\t\t\t\tconst replica = tree.get(replicaInstances[i]) as (CanvasNode & IsReplica) | null\n\t\t\t\t\tif (!replica || !replica.replicaInfo) continue // deleted or undo can cause this\n\t\t\t\t\tif (isMaster(this)) {\n\t\t\t\t\t\tassert(replica.replicaInfo.master === this.id, \"A replica cannot be it's own master\")\n\t\t\t\t\t} else {\n\t\t\t\t\t\tassert(replica.replicaInfo.inheritsFrom === this.id, \"A replica cannot inherit from itself\")\n\t\t\t\t\t}\n\n\t\t\t\t\tassert(replica.originalid, \"Replica does not have original id\")\n\t\t\t\t\t// Add the template to the draft nodes list\n\t\t\t\t\treplica.asDraft(tree)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst links = this.cache.links\n\t\tif (links) {\n\t\t\tlinks.forEach(id => {\n\t\t\t\tconst node = tree.get(id)\n\t\t\t\tif (node) node.asDraft()\n\t\t\t})\n\t\t}\n\t}\n\n\tlinkTo(to: NodeID) {\n\t\tthis.cache.links ??= new Set<NodeID>()\n\t\tthis.cache.links.add(to)\n\t}\n\n\tcombineVariableControlMap(\n\t\ttree: CanvasTree,\n\t\tchild: CanvasNode | undefined,\n\t\tinheritedControlMap: CombinedVariableProviderControlMap | undefined,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tcomponentLoaderHash: string | undefined,\n\t): {\n\t\tcombinedVariableControlMap: CombinedVariableProviderControlMap | undefined\n\t\tcombinedVariableControlMapIsEqual: boolean\n\t} {\n\t\tif (isProvidingLocaleVariable(this)) {\n\t\t\tinheritedControlMap = getLocaleCombinedVariableProviderControlMap(tree)\n\t\t}\n\n\t\tlet combinedVariableControlMapIsEqual = true\n\n\t\tconst providedControlMap = withVariableProvider(this)\n\t\t\t? this.getProvidedControlMap(tree, child, componentLoader, componentLoaderHash)\n\t\t\t: undefined\n\n\t\tconst cachedControlMap = this.cache.getCombinedVariableControlMap(\n\t\t\tinheritedControlMap,\n\t\t\tprovidedControlMap,\n\t\t\tthis,\n\t\t\ttree,\n\t\t\tchild,\n\t\t)\n\n\t\tlet combinedVariableControlMap: CombinedVariableProviderControlMap | undefined\n\n\t\tif (cachedControlMap !== \"noCache\") {\n\t\t\tcombinedVariableControlMap = cachedControlMap\n\t\t} else if (!providedControlMap) {\n\t\t\tcombinedVariableControlMapIsEqual = false\n\t\t\tthis.cache.setCombinedVariableControlMap(\n\t\t\t\tinheritedControlMap,\n\t\t\t\tprovidedControlMap,\n\t\t\t\tinheritedControlMap,\n\t\t\t\tthis,\n\t\t\t\ttree,\n\t\t\t\tchild,\n\t\t\t)\n\t\t\tcombinedVariableControlMap = inheritedControlMap\n\t\t} else {\n\t\t\tcombinedVariableControlMapIsEqual = false\n\n\t\t\tlet combinedControlMap: CombinedVariableProviderControlMap\n\n\t\t\tif (inheritedControlMap) {\n\t\t\t\tcombinedControlMap = new Map(inheritedControlMap)\n\t\t\t\tcombinedControlMap.set(this.getPrimaryId(), providedControlMap)\n\t\t\t} else {\n\t\t\t\tcombinedControlMap = new Map([\n\t\t\t\t\t[this.getPrimaryId(), providedControlMap],\n\t\t\t\t\t[FALLBACK_PROVIDER_ID, providedControlMap],\n\t\t\t\t])\n\t\t\t}\n\n\t\t\tcombinedVariableControlMap = combinedControlMap\n\t\t\tthis.cache.setCombinedVariableControlMap(\n\t\t\t\tinheritedControlMap,\n\t\t\t\tprovidedControlMap,\n\t\t\t\tcombinedControlMap,\n\t\t\t\tthis,\n\t\t\t\ttree,\n\t\t\t\tchild,\n\t\t\t)\n\t\t}\n\n\t\treturn { combinedVariableControlMap, combinedVariableControlMapIsEqual }\n\t}\n\n\t/**\n\t * Each node contains two maps that contain the info for all variables that are in scope. One of\n\t * these maps contains all variable values by provider. The other map contains the associated\n\t * variable controls. The control is the property control definition to render the control for\n\t * that variable (e.g. StringVariable -> StringControlDescription). These maps allow for instant\n\t * lookup without having to walk the tree looking for each variable provider.\n\t *\n\t * This function is used to creates those maps for a node given the inherited maps from its parent.\n\t *\n\t * It is also used with a `child` parameter to create the maps that are passed on to a specific child.\n\t * These are often the identity-same ones, but some subclasses override them to only contain\n\t * a subset of the variables available to certain children (non-repeated children of repeaters).\n\t */\n\tcombineVariableValueAndControlMaps(\n\t\ttree: CanvasTree,\n\t\tchild: CanvasNode | undefined,\n\t\tinheritedValueMap: CombinedVariableProviderValueMap | undefined,\n\t\tinheritedControlMap: CombinedVariableProviderControlMap | undefined,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tsandboxRepeaterData: SandboxRepeaterData,\n\t\tcomponentLoaderHash: string | undefined,\n\t\tactiveLocale: Locale | undefined,\n\t): {\n\t\tcombinedVariableValueMap: CombinedVariableProviderValueMap | undefined\n\t\tcombinedVariableControlMap: CombinedVariableProviderControlMap | undefined\n\t\tcombinedVariableMapsAreEqual: boolean\n\t} {\n\t\tif (isProvidingLocaleVariable(this)) {\n\t\t\tinheritedValueMap = getLocaleCombinedVariableProviderValueMap(tree, activeLocale)\n\t\t}\n\n\t\t// First set inherited value map, because the provided values can depend on these when used\n\t\t// for filtering\n\t\tthis.cache.setInheritedCombinedVariableValueMap(inheritedValueMap)\n\n\t\tconst providedValueMap = withVariableProvider(this)\n\t\t\t? this.getProvidedValueMap(tree, child, componentLoader, sandboxRepeaterData, componentLoaderHash)\n\t\t\t: undefined\n\t\tconst cachedValueMap = this.cache.getCombinedVariableValueMap(\n\t\t\tinheritedValueMap,\n\t\t\tprovidedValueMap,\n\t\t\tthis,\n\t\t\ttree,\n\t\t\tchild,\n\t\t)\n\n\t\tlet combinedVariableValueMap: CombinedVariableProviderValueMap | undefined\n\t\tlet combinedVariableValueMapIsEqual = true\n\n\t\tif (cachedValueMap !== \"noCache\") {\n\t\t\tcombinedVariableValueMap = cachedValueMap\n\t\t} else if (!providedValueMap) {\n\t\t\tcombinedVariableValueMapIsEqual = false\n\t\t\tthis.cache.setCombinedVariableValueMap(inheritedValueMap, providedValueMap, inheritedValueMap, this, tree, child)\n\t\t\tcombinedVariableValueMap = inheritedValueMap\n\t\t} else {\n\t\t\tcombinedVariableValueMapIsEqual = false\n\n\t\t\tlet combinedValueMap: CombinedVariableProviderValueMap\n\n\t\t\tif (inheritedValueMap) {\n\t\t\t\tcombinedValueMap = new Map(inheritedValueMap)\n\t\t\t\tcombinedValueMap.set(this.getPrimaryId(), providedValueMap)\n\t\t\t} else {\n\t\t\t\tcombinedValueMap = new Map([\n\t\t\t\t\t[this.getPrimaryId(), providedValueMap],\n\t\t\t\t\t[FALLBACK_PROVIDER_ID, providedValueMap],\n\t\t\t\t])\n\t\t\t}\n\n\t\t\tcombinedVariableValueMap = combinedValueMap\n\t\t\tthis.cache.setCombinedVariableValueMap(inheritedValueMap, providedValueMap, combinedValueMap, this, tree, child)\n\t\t}\n\n\t\tconst { combinedVariableControlMapIsEqual, combinedVariableControlMap } = this.combineVariableControlMap(\n\t\t\ttree,\n\t\t\tchild,\n\t\t\tinheritedControlMap,\n\t\t\tcomponentLoader,\n\t\t\tcomponentLoaderHash,\n\t\t)\n\n\t\treturn {\n\t\t\tcombinedVariableValueMap,\n\t\t\tcombinedVariableControlMap,\n\t\t\tcombinedVariableMapsAreEqual: combinedVariableValueMapIsEqual && combinedVariableControlMapIsEqual,\n\t\t}\n\t}\n\n\t/**\n\t * Nodes do not support variable references and computed values by default, this hides away all entries where you\n\t * can assign variables to a node prop. Can be overridden.\n\t */\n\tsupportsDynamicValues() {\n\t\treturn false\n\t}\n\n\t/** Plugins can store string key/value data on some nodes. */\n\tsupportsPluginData(): this is CanvasNode & WithPluginData {\n\t\treturn false\n\t}\n\n\t// resolving `fillImage` can result in a Responsive Image when the data is coming from the CMS\n\tresolveValue(\n\t\tkey: \"fillImage\",\n\t\tvariableOverrides?: CombinedVariableProviderValueMap,\n\t\tgetResolvedFetchDataValue?: FetchDataValueResolver,\n\t): Exclude<WithFill[\"fillImage\"], DynamicValue> | ResponsiveImage\n\t// Resolving name on complex unions is a common pattern, unfortunately if we rely on the generic\n\t// overload typescript is unable to resolve it to string | null, this specific overload ensures\n\t// that code can continue to be written idiomatically without workarounds for node names.\n\tresolveValue(key: \"name\"): string | null\n\tresolveValue(\n\t\tkey: \"dynamicVectorSetIdentifier\",\n\t\tvariableOverrides?: CombinedVariableProviderValueMap,\n\t): VectorSetItemVariableInitialValue | ModuleExportIdentifierString | ComponentType | undefined\n\tresolveValue(key: \"rotation\", variableOverrides?: CombinedVariableProviderValueMap): number\n\tresolveValue(\n\t\tkey: \"padding\",\n\t\tvariableOverrides?: CombinedVariableProviderValueMap,\n\t\tgetResolvedFetchDataValue?: FetchDataValueResolver,\n\t): Exclude<WithPadding[\"padding\"], DynamicValue> | FourPixelNumberShorthand\n\tresolveValue<K extends keyof this>(\n\t\tkey: K,\n\t\tvariableOverrides?: CombinedVariableProviderValueMap,\n\t\tgetResolvedFetchDataValue?: FetchDataValueResolver,\n\t): OptionallyExtendsUndefined<this[K], Exclude<this[K], DynamicValue | Generated<unknown>>>\n\t/** Omits variable references and computed values and tries to lookup / compute their value instead. */\n\tresolveValue<K extends keyof this>(\n\t\tkey: K,\n\t\tvariableOverrides?: CombinedVariableProviderValueMap,\n\t\tgetResolvedFetchDataValue?: FetchDataValueResolver,\n\t):\n\t\t| Exclude<this[K], DynamicValue | Generated<this[K]>>\n\t\t| ResponsiveImage\n\t\t| VectorSetItemVariableInitialValue\n\t\t| ModuleExportIdentifierString\n\t\t| ComponentType\n\t\t| number\n\t\t| string\n\t\t| null\n\t\t| undefined {\n\t\ttype Result = Exclude<this[K], DynamicValue | Generated<this[K]>>\n\t\tconst value = this[key]\n\n\t\tif (this.__class === \"TextNode\" && key === \"textContent\" && isComputedValue(value)) {\n\t\t\tthrow Error(\"TextNode doesn't support computed text content, should have been converted to RichTextNode\")\n\t\t}\n\n\t\tif (isGeneratedValue(value)) {\n\t\t\treturn getGeneratedValue(value) as Result\n\t\t}\n\n\t\tif (!isDynamicValue(value)) {\n\t\t\tif (key === \"rotation\") {\n\t\t\t\treturn isNumber(value) ? value : 0\n\t\t\t}\n\n\t\t\treturn value as Result\n\t\t}\n\n\t\tif (!this.supportsDynamicValues()) {\n\t\t\treturn undefined\n\t\t}\n\n\t\tlet result: unknown = undefined\n\t\tif (isVariableReference(value)) {\n\t\t\tresult = this.cache.getVariableReferenceValue(value, variableOverrides)\n\t\t} else if (isComputedValue(value)) {\n\t\t\tconst inputControl = isComputedValueFromVariableReference(value)\n\t\t\t\t? this.cache.getVariableControlByReference(value.startValue)\n\t\t\t\t: undefined\n\n\t\t\tconst outputControl = isNodePropertyControlKey(key) ? getNodePropertyControlDescription(key) : undefined\n\n\t\t\tresult = computeValue(\n\t\t\t\tvalue,\n\t\t\t\tthis.cache,\n\t\t\t\tvariableOverrides,\n\t\t\t\tinputControl,\n\t\t\t\toutputControl,\n\t\t\t\tthis.cache.activeRouterLocale,\n\t\t\t\tundefined,\n\t\t\t\tgetResolvedFetchDataValue,\n\t\t\t)\n\t\t}\n\n\t\tassert(!isDynamicValue(result), \"All dynamic values should be handled\")\n\n\t\treturn maybeConvertFlexValueToVekterValue(key, result) as Result\n\t}\n\n\trect(\n\t\t_parentSizeInfo: ParentSizeInfo | null = null,\n\t\t_pixelAlign = true,\n\t\t_componentLoader?: AnyComponentLoader,\n\t\t_renderId?: RenderId,\n\t): Rect {\n\t\treturn { x: 0, y: 0, width: 0, height: 0 }\n\t}\n\n\tupdateForRect(_options: UpdateForRectOptions): any {\n\t\treturn { x: 0, y: 0, width: 0, height: 0 }\n\t}\n\n\tupdateForSize(_size: Partial<Size>, _parentSizeInfo: ParentSizeInfo | null): Partial<VekterConstraintValues> {\n\t\treturn { width: 0, height: 0 }\n\t}\n\n\tmatrix(_parentSizeInfo: ParentSizeInfo | null, _rect?: Rect, _renderId?: RenderId): DOMMatrix {\n\t\treturn new DOMMatrix()\n\t}\n\n\toriginAdjustedMatrix(_parentSizeInfo: ParentSizeInfo | null, _rect?: Rect, _renderId?: RenderId): DOMMatrix {\n\t\treturn new DOMMatrix()\n\t}\n\n\tisEmptyGroup() {\n\t\treturn false\n\t}\n\n\tgetProps(\n\t\t_componentLoader: AnyComponentLoader,\n\t\t_variableOverrides?: CombinedVariableProviderValueMap,\n\t\t_activeLocale?: RouterLocale,\n\t\t_fetchDataResolver?: FetchDataValueResolver,\n\t): LayerProps {\n\t\treturn {\n\t\t\tkey: this.id,\n\t\t\tid: stringFromNodeID(this.id),\n\t\t\tlayoutIdKey: this.id,\n\t\t\tduplicatedFrom: this.duplicatedFrom ?? undefined,\n\t\t}\n\t}\n\n\tcanvasMatrix() {\n\t\tconst matrix = this.cache.matrix\n\t\tif (!matrix) {\n\t\t\treturn new DOMMatrix()\n\t\t\t// TODO: Restore this:\n\t\t\t// throw Error(\"shape matrix requested but does not exist\")\n\t\t}\n\t\treturn matrix\n\t}\n\n\thasAutoSize() {\n\t\treturn false\n\t}\n\n\tisSelected(): boolean {\n\t\treturn this.cache.selected\n\t}\n\n\t// It's unsafe because the node might not be in the tree\n\t__unsafeIsGroundNode(tree?: CanvasTree): boolean {\n\t\treturn this.treeOrLatest(tree)?.isGroundNode(this) ?? false\n\t}\n\n\t// It's unsafe because the node might not be in the tree\n\t__unsafeIsSlotPropertyChildNode(optionalTree?: CanvasTree): boolean {\n\t\tconst tree = this.treeOrLatest(optionalTree)\n\t\tif (!tree) return false\n\n\t\tconst parent = tree.getParent(this.id)\n\t\treturn isSlotPropertyNode(parent)\n\t}\n\n\t/**\n\t * Iterate the node's children recursively in depth-first order.\n\t */\n\t*descendants(): IterableIterator<CanvasNode> {\n\t\tconst children = this.children\n\t\tif (!children) return\n\t\tfor (const child of children) {\n\t\t\tyield* child.walk()\n\t\t}\n\t}\n\n\t/**\n\t * Returns `true` if this node or any of its descendants meet the conditions\n\t * set by the passed in function. Otherwise, returns `false`.\n\t */\n\tsome(predicate: (node: CanvasNode) => unknown): boolean {\n\t\tif (predicate(this)) return true\n\t\tconst children = this.children\n\t\tif (children) {\n\t\t\tfor (const child of children) {\n\t\t\t\tconst found = child.some(predicate)\n\t\t\t\tif (found) return true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}\n\n\t/**\n\t * Iterate the node and its children recursively in depth-first order. The\n\t * values provided by the iterator have a `node` property for the node, and\n\t * a `skipChildren()` method that can be optionally called to prevent\n\t * descending into the children of the node. Note that this method must be\n\t * called before the next iteration, or it will be ignored.\n\t */\n\t*walkWithSkipChildren(): IterableIterator<WalkWithSkipChildrenIteratorValue> {\n\t\tconst children = this.children\n\t\tlet skipChildren = false\n\t\tyield {\n\t\t\tnode: this,\n\t\t\tskipChildren() {\n\t\t\t\tskipChildren = true\n\t\t\t},\n\t\t}\n\t\tif (!children || skipChildren) return\n\t\tfor (const child of children) {\n\t\t\tyield* child.walkWithSkipChildren()\n\t\t}\n\t}\n}\n", "import type { VekterEngineScheduler } from \"document/VekterEngineScheduler.ts\"\n\n/** Normally we ignore uncaught errors. But errors that inherit from this class will be handled by a\n * global error handler and turn into a user visible \"red bar\" report. */\nexport class GloballyHandledError extends Error {}\n\n/** Installs a global error handler that will turn any error inheriting from GloballyHandledError\n * into a user visible \"red bar\" error. And will report the error via sentry with logs attached.\n *\n * We don't turn all errors into red bars, because some errors are out of our control, like errors\n * from browser plugins, or react in dev mode. And, at least for now, to not increase the amount of\n * red bars from errors that were so far ignored. Do note that all such errors are still reported\n * (or filtered) via Sentry's global error handler.\n * */\nexport function installGlobalErrorHandler(taskScheduler: VekterEngineScheduler) {\n\twindow.addEventListener(\"error\", event => {\n\t\tconst error = event.error\n\t\tif (!(error instanceof GloballyHandledError)) return\n\n\t\tevent.preventDefault()\n\t\tevent.stopPropagation()\n\t\ttaskScheduler.errorInEventHandler(error)\n\n\t\t// This makes sure the engine is going to render a frame regardless of what else is going on.\n\t\ttaskScheduler.processWhenReady(() => {})\n\t})\n}\n", "import { assert } from \"@framerjs/shared\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport type { AnyScopeNode, ScopeNode, ShallowScopeNode } from \"../nodes/ScopeNode.ts\"\n\nexport type BaseShallowType = ShallowScopeNode | AnyScopeNode\n\n/**\n * Interface that is able to load shallow scope into fully loaded scope\n *\n * Shallow node means that the scope is not completely loaded and expensive loading/parsing\n * such as parsing children is not done.\n *\n * A developer should think and handle shallow/fully loaded scopes in place based on needs/requirements/etc\n *\n * @see Read more here {@link https://www.notion.so/framer/CanvasTree-Shallow-Scopes-1c38c0714eb74a5d91ee30354a46347c}\n */\nexport interface WithScopeLoader<\n\tShallowType extends BaseShallowType,\n\tLoadedType extends ScopeNode,\n\tFullyLoadedType extends LoadedType = Loaded<LoadedType>,\n> {\n\t/**\n\t * Narrows a shallow node to a fully loaded node\n\t *\n\t * Read more here https://www.notion.so/framer/CanvasTree-Shallow-Scopes-1c38c0714eb74a5d91ee30354a46347c\n\t */\n\tisLoaded(this: ShallowType): this is FullyLoadedType\n\n\tloaded?: FullyLoadedType\n\t/**\n\t * This method requests a node to be fully loaded into a tree (one that is available inside cache)\n\t */\n\tload(): Promise<FullyLoadedType | null>\n\n\tload(callback: ShallowLoaderCallback<FullyLoadedType>): void\n}\n\nexport type Loaded<T> = T & { loaded: T }\n\nexport type ShallowLoaderCallback<T extends ScopeNode | null> = (node: T) => void\n\nconst key: keyof WithScopeLoader<BaseShallowType, ScopeNode> = \"load\"\n\nexport function withScopeLoader<T extends CanvasNode, LoadedType extends ScopeNode>(\n\tnode: T,\n): node is WithScopeLoader<BaseShallowType, LoadedType> & T {\n\treturn key in node\n}\n\n/**\n * Helper function to fully load scope into tree\n *\n * @example\n * const scope = await loadScopeNode(shallowScope)\n *\n * @remark It is important to note that you should not hold node references in multiple async callbacks:\n *\n * @example WRONG USAGE, DON'T DO THIS\n * const [node1, node2] = await Promise.all([loadScopeNode(node1), loadScopeNode(node2)])\n\n * In this case, the `node1` and `node2`\n * are not guaranteed to be correct because the tree might have changed but nodes were returned before the change.\n * In the future we might change the API to batch promises so that this pattern would work in most common cases.\n * But it might come with dragons.\n *\n * @example The right way of getting all scopes:\n * const [node1, node2] = await tree.loadScopes([node1, node2])\n * */\nexport function loadScopeNode<T extends BaseShallowType, RT extends ScopeNode | null>(node: T): Promise<RT>\nexport function loadScopeNode<T extends BaseShallowType, RT extends ScopeNode | null>(\n\tnode: T,\n\tcallback: ShallowLoaderCallback<RT>,\n): void\nexport function loadScopeNode<T extends BaseShallowType, RT extends ScopeNode | null>(\n\tnode: T,\n\tcallback?: ShallowLoaderCallback<RT>,\n) {\n\tconst loader = node.cache.tree()?.getService(\"loader\")\n\n\t// if there is no loader, we can't load the node,\n\t// so we resolve with the node itself\n\tif (!loader) {\n\t\tnode.isLoaded()\n\t\tif (callback) {\n\t\t\tcallback(node as unknown as RT)\n\t\t\treturn\n\t\t}\n\n\t\treturn Promise.resolve(node)\n\t}\n\n\tif (callback) {\n\t\tloader.prioritizeLoadingScope(node.id, () => {\n\t\t\tcallback(getLoadedNodeFromTree(node) as RT)\n\t\t})\n\t\treturn\n\t}\n\n\treturn loader.prioritizeLoadingScope(node.id).then(() => getLoadedNodeFromTree(node) as RT)\n}\n\nconst getLoadedNodeFromTree = (node: BaseShallowType) => {\n\tconst tree = node.cache.tree()\n\tassert(tree)\n\tconst loadedNode = tree.get<AnyScopeNode>(node.id)\n\tloadedNode?.isLoaded?.()\n\treturn loadedNode\n}\n", "import { GloballyHandledError } from \"app/GlobalErrorHandler.ts\"\nimport type { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport { withClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { CanvasTree } from \"../CanvasTree.ts\"\nimport type { WithChildren } from \"../traits/WithChildren.ts\"\nimport type { WithName } from \"../traits/WithName.ts\"\nimport type { Loaded, ShallowLoaderCallback, WithScopeLoader } from \"../traits/WithScopeLoader.ts\"\nimport { loadScopeNode } from \"../traits/WithScopeLoader.ts\"\nimport { isVisibleNode } from \"../traits/WithVisibility.ts\"\nimport { getBoundingFrameForNodes } from \"../utils/geometry.ts\"\nimport type { AsAnyNode, MaybeCanvasNode, ShallowNode } from \"./CanvasNode.ts\"\nimport { CanvasNode } from \"./CanvasNode.ts\"\nimport type { CanvasNodeCache } from \"./CanvasNodeCache.ts\"\nimport type { ChildList } from \"./ChildList.ts\"\n\ninterface CanvasNodeConstructor<Node extends CanvasNode> {\n\tnew (...args: any[]): Node\n}\n\ntype FullyLoadedScopeKeys = \"getGroundNodes\" | \"getGroundNodesOfType\" | \"getBoundingFrame\"\n\n/**\n * Creates a shallow type from a scope node interface that forbids usage of children and related methods\n * @param KeysToOmit should be the keys that have access to children\n * @see {@link WithScopeLoader}\n */\nexport type AsShallowScopeNode<Node extends ScopeNode, KeysToOmit extends keyof Node = never> = ShallowNode<\n\tNode,\n\tFullyLoadedScopeKeys | KeysToOmit\n>\n\nexport type AsAnyScopeNode<Node extends ScopeNode, KeysToOmit extends keyof Node = never> = AsAnyNode<\n\tNode,\n\tFullyLoadedScopeKeys | KeysToOmit\n>\n\n// Do not use this type to create the new shallow types use AsShallowScopeNode instead\nexport type ShallowScopeNode = AsShallowScopeNode<ScopeNode>\nexport type LoadedScopeNode = Loaded<ScopeNode>\nexport type AnyScopeNode = AsAnyScopeNode<ScopeNode>\n\nexport type MaybeLoadedScopeNode = LoadedScopeNode | null | undefined\nexport type MaybeAnyScope = AnyScopeNode | null | undefined\nexport type MaybeShallowScopeNode = ShallowScopeNode | null | undefined\n\nexport function isScopeNode(node: unknown, isAnyScope: true): node is AnyScopeNode\n// prevents .root.children.filter(typeCheck) inferring of CanvasNode\nexport function isScopeNode<T extends MaybeCanvasNode>(node: T, index: number, ...otherArgs: unknown[]): node is never\nexport function isScopeNode<T extends MaybeLoadedScopeNode>(node: T): node is LoadedScopeNode & T\nexport function isScopeNode<T extends MaybeShallowScopeNode>(node: T): node is ShallowScopeNode & T\nexport function isScopeNode<T extends MaybeAnyScope>(node: T): node is AnyScopeNode & T\nexport function isScopeNode<T extends MaybeCanvasNode>(node: T): node is ShallowScopeNode & T\nexport function isScopeNode(node?: { __class: ClassDiscriminator } | null | undefined): node is AnyScopeNode {\n\treturn node instanceof ScopeNode\n}\n\nconst loadedWasChecked = new Set<CanvasNodeCache>()\n\nexport function resetLoadedWasChecked() {\n\tfor (const cache of loadedWasChecked) {\n\t\tcache.isLoadedWasChecked = false\n\t}\n\tloadedWasChecked.clear()\n}\n\nexport function setLoadWasChecked(node: { cache: CanvasNodeCache } | null | undefined): void {\n\tif (!node) return\n\tif (node.cache.isLoadedWasChecked) return\n\n\tnode.cache.isLoadedWasChecked = true\n\tloadedWasChecked.add(node.cache)\n}\n\n// By inheriting from GloballyHandledError assertions will be reported as red bars even if thrown\n// outside of any engine context.\nclass ScopeCheckError extends GloballyHandledError {}\n\n/**\n * The base class for all pages with content that a user can edit (WebPage, CanvasPage, SmartComponent). Scopes do\n * not use Nodes from other scopes. The scope node (and its subtree) can be exported to code without having any\n * dependencies to sibling scopes. `ContentManagementNode` also extends `ScopeNode`, but not `CanvasScopeNode`.\n */\nexport class ScopeNode\n\textends withClassDiscriminator(\"ScopeNode\", CanvasNode)\n\timplements WithChildren, WithName, WithScopeLoader<ShallowScopeNode, ScopeNode>\n{\n\tdeclare children: ChildList<CanvasNode>\n\n\t/** Will install a special runtime check to verify the scope was fully loaded and that loading was checked. */\n\tinstallRuntimeChildrenCheckIfNeeded() {\n\t\tif (\"__children\" in this) return\n\n\t\t// eslint-disable-next-line framer-studio/no-mutable-node-object-methods\n\t\tObject.defineProperty(this, \"__children\", {\n\t\t\tenumerable: false,\n\t\t\twritable: true,\n\t\t\tvalue: this.children,\n\t\t})\n\n\t\t// eslint-disable-next-line framer-studio/no-mutable-node-object-methods\n\t\tObject.defineProperty(this, \"children\", {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\tget(this: ScopeNode & { __children: CanvasNode[] }) {\n\t\t\t\tconst cache = this.cache\n\t\t\t\tif (!cache) return this.__children\n\n\t\t\t\tconst treeLineage = cache.treeLineage\n\t\t\t\tif (!treeLineage) return this.__children\n\t\t\t\tif (!treeLineage.latestTree.inEditor) return this.__children\n\t\t\t\tif (!treeLineage.enablePartialScopeAccessChecks) return this.__children\n\t\t\t\tif (treeLineage.allowPartialNodeAccess) return this.__children\n\n\t\t\t\tif (cache.isShallowLoad) {\n\t\t\t\t\tthrow new ScopeCheckError(\"Accessing children of a partially loaded scope is not allowed.\")\n\t\t\t\t}\n\n\t\t\t\tif (!treeLineage.enableScopeWasLoadedChecks) return this.__children\n\t\t\t\tif (!cache.isLoadedWasChecked) {\n\t\t\t\t\tthrow new ScopeCheckError(\"Accessing children of scope without type check.\")\n\t\t\t\t}\n\t\t\t\treturn this.__children\n\t\t\t},\n\t\t\tset(value: unknown) {\n\t\t\t\tthis.__children = value\n\t\t\t},\n\t\t})\n\t}\n\n\t/** Partial Document Loading might cause scope nodes to load\n\t * without children and those cannot be rendered.\n\t * */\n\tisValid(): boolean {\n\t\treturn this.isLoaded()\n\t}\n\n\t/** @see WithScopeLoader */\n\tisLoaded(): this is LoadedScopeNode {\n\t\tsetLoadWasChecked(this)\n\t\treturn !this.cache.isShallowLoad\n\t}\n\n\t/** @see WithScopeLoader */\n\tget loaded(): LoadedScopeNode | undefined {\n\t\tif (!this.isLoaded()) return undefined\n\n\t\treturn this as LoadedScopeNode\n\t}\n\n\t/** @see WithScopeLoader */\n\tload(this: AnyScopeNode): Promise<LoadedScopeNode | null>\n\tload(this: AnyScopeNode, callback: ShallowLoaderCallback<LoadedScopeNode>): void\n\tload(this: ShallowScopeNode): Promise<LoadedScopeNode | null>\n\tload(this: ShallowScopeNode, callback: ShallowLoaderCallback<LoadedScopeNode>): void\n\tload(this: ShallowScopeNode, callback?: ShallowLoaderCallback<LoadedScopeNode>) {\n\t\treturn callback ? loadScopeNode(this, callback) : loadScopeNode(this)\n\t}\n\n\t/** All direct children of the scope are considered GroundNodes. */\n\tgetGroundNodes(filter?: (node: CanvasNode) => boolean): CanvasNode[] {\n\t\tconst { children } = this.draftOrCurrent()\n\t\treturn filter ? children.filter(filter) : children.slice()\n\t}\n\n\tgetGroundNodesOfType<Node extends CanvasNode>(\n\t\tconstructor: CanvasNodeConstructor<Node>,\n\t\tfilter?: (node: Node) => boolean,\n\t): Node[] {\n\t\tconst groundNodes = this.getGroundNodes(node => {\n\t\t\tif (node instanceof constructor) {\n\t\t\t\treturn filter ? filter(node) : true\n\t\t\t}\n\n\t\t\treturn false\n\t\t})\n\n\t\treturn groundNodes as Node[]\n\t}\n\n\tgetBoundingFrame(tree: CanvasTree) {\n\t\tconst groundNodes = this.getGroundNodes(isVisibleNode)\n\t\treturn getBoundingFrameForNodes(tree, groundNodes)\n\t}\n}\n", "import type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport { CanvasChildList, type ChildList, type ReadonlyChildList } from \"../nodes/ChildList.ts\"\nimport type { ImmutableNode } from \"../nodes/MutableNode.ts\"\n\nexport interface WithChildren<Node extends CanvasNode = CanvasNode> {\n\tchildren: ChildList<Node>\n}\n\nexport const instructionalChildrenDefaults = {}\n\nconst key: keyof WithChildren = \"children\"\n\nexport function withChildren<N extends ImmutableNode>(node: N): node is N & WithChildren {\n\treturn key in node && node.children !== undefined\n}\n\nconst emptyChildList = new CanvasChildList<CanvasNode>()\n\nexport function getChildren(node: CanvasNode): ReadonlyChildList<CanvasNode> {\n\treturn withChildren(node) ? node.children : emptyChildList\n}\n", "import { assert, assertNever } from \"@framerjs/shared\"\n\nexport enum Tools {\n\tAgentDragSelect,\n\tAgentPanel,\n\tAgentSelect,\n\tHighlight,\n\tDirectSelect,\n\tSelect,\n\tPan,\n\tZoom,\n\tZoomSelect,\n\tMove,\n\tResize,\n\tRotate,\n\tLineAnchorMove,\n\tCreateFrame,\n\tCreateRounded,\n\tCreateImage,\n\tCreateScreen,\n\tCreateText,\n\tCreateOvalShape,\n\tCreateRectangleShape,\n\tCreatePolygonShape,\n\tCreateStarShape,\n\tCreateStack,\n\tCreateRows,\n\tCreateColumns,\n\tCreateGrid,\n\tCreateGridSpan,\n\tCreateGridRow,\n\tCreateMasonry,\n\tTextEdit,\n\tRichTextEdit,\n\tRichTextVariableEdit,\n\tStringVariableEdit,\n\tDateVariableEdit,\n\tEnumVariableEdit,\n\tCollectionReferenceVariableEdit,\n\tPadding,\n\tViewportResize,\n\tGap,\n\tPath,\n\tSampleColor,\n\tRadius,\n\tFillGradient,\n\tMaskGradient,\n\tSlotConnect,\n\tLink,\n\tChat,\n\tComment,\n\tGuide,\n\tHighlightStackItem,\n\tLoadingShield,\n\tCreateVideo,\n\tScale,\n\tUnknown,\n}\n\nexport type ToolName = {\n\t[K in keyof typeof Tools]: (typeof Tools)[K] extends Tools ? K : never\n}[keyof typeof Tools]\nexport type Action = `tool${ToolName}`\n\nexport type ShapeTools = Extract<\n\tTools,\n\t| Tools.CreateOvalShape\n\t| Tools.CreatePolygonShape\n\t| Tools.CreateRectangleShape\n\t| Tools.CreateStarShape\n\t| Tools.LineAnchorMove\n\t| Tools.Path\n>\n\nconst allToolNames = Object.freeze(Object.values(Tools).filter((value): value is ToolName => typeof value === \"string\"))\n\nfunction isToolName(value: string): value is ToolName {\n\treturn allToolNames.includes(value as ToolName)\n}\n\n// Allow declaration merging: https://www.typescriptlang.org/docs/handbook/declaration-merging.html\nexport namespace Tools {\n\ttype ToolNameForCase<Tool extends Tools> = {\n\t\t[K in ToolName]: (typeof Tools)[K] extends Tool ? K : never\n\t}[ToolName]\n\n\texport function actionForCase<Tool extends Tools>(tool: Tool): `tool${ToolNameForCase<Tool>}`\n\texport function actionForCase(tool: Tools): Action {\n\t\tconst name = Tools[tool]\n\t\tassert(isToolName(name), \"tool should map to a name\")\n\t\treturn `tool${name}`\n\t}\n\n\texport function actionForName<Name extends ToolName>(name: Name): `tool${Name}` {\n\t\treturn `tool${name}`\n\t}\n\n\texport function allNames(): Readonly<ToolName[]> {\n\t\treturn allToolNames\n\t}\n\n\texport function allActions(): Action[] {\n\t\treturn allNames().map(name => actionForName(name))\n\t}\n\n\t/** Returns false for tools that don't edit the tree via their update() method. */\n\texport function canEditTree(tool: Tools): boolean {\n\t\tswitch (tool) {\n\t\t\tcase Tools.AgentPanel:\n\t\t\tcase Tools.AgentDragSelect:\n\t\t\tcase Tools.AgentSelect:\n\t\t\tcase Tools.Highlight:\n\t\t\tcase Tools.DirectSelect:\n\t\t\tcase Tools.Select:\n\t\t\tcase Tools.Pan:\n\t\t\tcase Tools.Zoom:\n\t\t\tcase Tools.ZoomSelect:\n\t\t\tcase Tools.Chat:\n\t\t\tcase Tools.Comment:\n\t\t\tcase Tools.HighlightStackItem:\n\t\t\tcase Tools.LoadingShield:\n\t\t\t\treturn false\n\n\t\t\tcase Tools.Move:\n\t\t\tcase Tools.Resize:\n\t\t\tcase Tools.Scale:\n\t\t\tcase Tools.Rotate:\n\t\t\tcase Tools.LineAnchorMove:\n\t\t\tcase Tools.CreateFrame:\n\t\t\tcase Tools.CreateRounded:\n\t\t\tcase Tools.CreateImage:\n\t\t\tcase Tools.CreateVideo:\n\t\t\tcase Tools.CreateScreen:\n\t\t\tcase Tools.CreateText:\n\t\t\tcase Tools.CreateOvalShape:\n\t\t\tcase Tools.CreateRectangleShape:\n\t\t\tcase Tools.CreatePolygonShape:\n\t\t\tcase Tools.CreateStarShape:\n\t\t\tcase Tools.CreateStack:\n\t\t\tcase Tools.CreateRows:\n\t\t\tcase Tools.CreateColumns:\n\t\t\tcase Tools.CreateGrid:\n\t\t\tcase Tools.CreateGridRow:\n\t\t\tcase Tools.CreateGridSpan:\n\t\t\tcase Tools.CreateMasonry:\n\t\t\tcase Tools.TextEdit:\n\t\t\tcase Tools.RichTextEdit:\n\t\t\tcase Tools.RichTextVariableEdit:\n\t\t\tcase Tools.StringVariableEdit:\n\t\t\tcase Tools.DateVariableEdit:\n\t\t\tcase Tools.EnumVariableEdit:\n\t\t\tcase Tools.CollectionReferenceVariableEdit:\n\t\t\tcase Tools.Padding:\n\t\t\tcase Tools.ViewportResize:\n\t\t\tcase Tools.Gap:\n\t\t\tcase Tools.Path:\n\t\t\tcase Tools.SampleColor:\n\t\t\tcase Tools.Radius:\n\t\t\tcase Tools.FillGradient:\n\t\t\tcase Tools.MaskGradient:\n\t\t\tcase Tools.SlotConnect:\n\t\t\tcase Tools.Link:\n\t\t\tcase Tools.Guide:\n\t\t\tcase Tools.Unknown:\n\t\t\t\treturn true\n\t\t\tdefault:\n\t\t\t\tassertNever(tool)\n\t\t}\n\t}\n}\n", "import type { MaybeAnyCanvasNode } from \"../nodes/CanvasNode.ts\"\n\nexport interface WithVectorSetItem {\n\t/**\n\t * When true, indicates that this node within a VectorSetNode should be treated as a Vector\n\t * module entry and compiled accordingly. When undefined or false, the node will be treated as a\n\t * regular ground node.\n\t */\n\tisVectorSetItem?: boolean\n}\n\nexport const withVectorSetItemDefaults = {\n\tisVectorSetItem: undefined,\n} satisfies WithVectorSetItem\n\nexport interface IsVectorSetItem extends WithVectorSetItem {\n\tisVectorSetItem: true\n}\n\nconst vectorKey: keyof WithVectorSetItem = \"isVectorSetItem\"\n\nexport function withVectorSetItem<T extends MaybeAnyCanvasNode>(node: T): node is T & WithVectorSetItem {\n\tif (!node) return false\n\treturn vectorKey in node\n}\n\nexport function isVectorSetItem<T extends MaybeAnyCanvasNode>(node: T): node is T & IsVectorSetItem {\n\treturn withVectorSetItem(node) && node.isVectorSetItem === true\n}\n", "import type {\n\tCanvasNode,\n\tOvalShapeNode,\n\tPolygonShapeNode,\n\tRectangleShapeNode,\n\tStarShapeNode,\n} from \"document/models/CanvasTree/index.ts\"\nimport type { WithShape } from \"library/render/traits/Shape.ts\"\nimport { withShape as withShapeTraits } from \"library/render/traits/Shape.ts\"\n\nexport type ShapeType = \"rectangle\" | \"oval\" | \"polygon\" | \"star\"\n\nexport function withShape(node: CanvasNode): node is CanvasNode & WithShape {\n\treturn withShapeTraits(node)\n}\n\nexport function shapeSupportsCenteredAttribute(\n\ttype: ShapeType,\n\t_attributes: Partial<OvalShapeNode | PolygonShapeNode | StarShapeNode | RectangleShapeNode>,\n): _attributes is Partial<StarShapeNode | PolygonShapeNode> {\n\treturn type === \"polygon\" || type === \"star\"\n}\n", "import type { TriggerEventOptions } from \"@framerjs/framer-runtime\"\nimport type { EventAction } from \"document/models/EventAction.ts\"\nimport { isEventAction } from \"document/models/EventAction.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { randomID } from \"../nodes/NodeID.ts\"\nimport { HardCodedCodeIdentifier } from \"../traits/utils/hardCodedCodeComponentIdentifiers.ts\"\nimport type { ActionControlValues } from \"./actions.ts\"\n\ntype TriggerEventActionControls = ActionControlValues<TriggerEventOptions>\n\nexport interface TriggerEventAction extends EventAction {\n\tcontrols: TriggerEventActionControls\n}\n\nexport const triggerEventActionKeys: { [Key in keyof TriggerEventOptions]: Key } = { id: \"id\" }\n\nexport function isTriggerEventAction(value: unknown): value is TriggerEventAction {\n\treturn isEventAction(value) && value.actionIdentifier === HardCodedCodeIdentifier.triggerEventAction\n}\n\nexport function updatedTriggerEventAction(\n\taction: TriggerEventAction,\n\tcontrolOverrides: TriggerEventActionControls,\n): TriggerEventAction {\n\tconst controls = {\n\t\t...action.controls,\n\t\t...controlOverrides,\n\t}\n\treturn { ...action, controls }\n}\n\nexport function createTriggerEventAction(variableId: string, id?: string): TriggerEventAction {\n\treturn {\n\t\tidentifier: id ? id : randomID(),\n\t\tactionIdentifier: HardCodedCodeIdentifier.triggerEventAction,\n\t\tcontrols: {\n\t\t\tid: {\n\t\t\t\ttype: ControlType.String,\n\t\t\t\tvalue: variableId,\n\t\t\t},\n\t\t},\n\t}\n}\n", "import type { LocalizedValues } from \"document/models/LocalizedValue.ts\"\nimport type { SupportedLinkRelValue } from \"document/models/SupportedRelValue.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\nimport { isDynamicValue } from \"./DynamicValue.ts\"\nimport type { VariableReference } from \"./VariableReference.ts\"\nimport type { Link } from \"./utils/Link.ts\"\nimport { isLink, isLinkToURL } from \"./utils/Link.ts\"\n\nexport interface WithLink {\n\t/**\n\t * link used to support strings, which could be absolute urls or\n\t * framer/page-links. With the introduction of the Link type, which stores\n\t * both of these as objects with additional metadata, a link can no longer\n\t * be a string.\n\t *\n\t * Since the parsing for framer/page-link lives in library, and document\n\t * migrations currently don't have access to library, but also to save time,\n\t * we did not migrate these fields from string to Link.\n\t *\n\t * To ensure no one runs into this, reading from the link field is\n\t * deprecated.\n\t *\n\t * Please use `node.getLink()` instead, which guarantees a string will be\n\t * transformed to a Link if required.\n\t * @deprecated\n\t */\n\tlink: string | Link | DynamicValue | undefined\n\tlinkOpenInNewTab: boolean | VariableReference | undefined\n\tlinkSmoothScroll: boolean | VariableReference | undefined\n\tlinkClickTrackingId: string | VariableReference | undefined\n\tlinkLocalized: LocalizedValues | undefined\n\t/** Array of rel values for the link https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/rel */\n\tlinkRelValues: readonly SupportedLinkRelValue[] | VariableReference | undefined\n\tlinkPreserveParams: boolean | VariableReference | undefined\n\t/**\n\t * Get a node's link, transforming it from a string to a Link if required.\n\t */\n\tgetLink: () => Link | DynamicValue | undefined\n}\n\nexport type WithLinkUpdate = Partial<Omit<WithLink, \"link\" | \"getLink\">>\n\nexport const linkDefaults: Omit<WithLink, \"getLink\"> = {\n\tlink: undefined,\n\tlinkOpenInNewTab: undefined,\n\tlinkSmoothScroll: undefined,\n\tlinkLocalized: undefined,\n\tlinkClickTrackingId: undefined,\n\tlinkRelValues: undefined,\n\tlinkPreserveParams: undefined,\n}\n\nconst key: keyof WithLink = \"link\"\n\nexport function withLink<T extends CanvasNode>(node: T | null | undefined): node is T & WithLink {\n\tif (!node) return false\n\treturn key in node\n}\n\nexport function hasLink<T extends CanvasNode>(node: T): node is T & WithLink {\n\tif (!withLink(node)) return false\n\tconst parsedLink = node.getLink()\n\tif (isDynamicValue(parsedLink)) return true\n\tif (isLink(parsedLink)) return true\n\treturn false\n}\n\nexport function shouldOpenLinkInNewTab(link: unknown) {\n\treturn isLinkToURL(link)\n}\n", "import { ModuleType, isLocalModuleIdentifier, parseModuleIdentifier } from \"@framerjs/shared\"\n\nexport function moduleIdentifierToLocalComponentId(moduleIdentifier: string) {\n\tconst parsedIdentifier = parseModuleIdentifier(moduleIdentifier)\n\tif (!isLocalModuleIdentifier(parsedIdentifier)) return null\n\tif (\n\t\tparsedIdentifier.type !== ModuleType.Canvas &&\n\t\tparsedIdentifier.type !== ModuleType.Screen &&\n\t\tparsedIdentifier.type !== ModuleType.LayoutTemplate &&\n\t\tparsedIdentifier.type !== ModuleType.VectorSet\n\t) {\n\t\treturn null\n\t}\n\treturn parsedIdentifier.localIdName\n}\n", "import type { ExternalModuleIdentifierString, LocalModuleIdentifierString } from \"@framerjs/shared\"\nimport {\n\tModuleType,\n\tisExternalModuleIdentifier,\n\tisLocalModuleIdentifier,\n\tparseModuleIdentifier,\n} from \"@framerjs/shared\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport type {\n\tAnySmartComponentNode,\n\tCanvasTree,\n\tCodeComponentNode,\n\tMaybeNodeID,\n\tShallowSmartComponentNode,\n\tShallowWebPageNode,\n} from \"../../index.ts\"\nimport { isVariableReference } from \"../../traits/VariableReference.ts\"\nimport { withVariables } from \"../../traits/WithVariables.ts\"\nimport type { CanvasNode } from \"../CanvasNode.ts\"\nimport type { ExternalModuleNode } from \"../ExternalModuleNode.ts\"\nimport type { NodeID } from \"../NodeID.ts\"\nimport { moduleIdentifierToLocalComponentId } from \"./moduleIdentifierToLocalComponentId.ts\"\nimport { isCodeComponentNode, isSmartComponentNode, isWebPageNode } from \"./nodeCheck.ts\"\n\n/** Uses the code component identifier to return the smart component node. */\nexport function getSmartComponentForCodeComponent(\n\ttree: CanvasTree,\n\tinstance: CodeComponentNode,\n): AnySmartComponentNode | null {\n\tconst scopeId = instance.getLocalSmartComponentNodeId()\n\tconst scopeNode = tree.getNode(scopeId)\n\tif (!isSmartComponentNode(scopeNode)) return null\n\treturn scopeNode\n}\n\n/** Uses the code component identifier to return the web page or smart component node. */\nexport function getSmartComponentOrWebPageForCodeComponent(\n\ttree: CanvasTree,\n\tinstance: CodeComponentNode,\n): ShallowSmartComponentNode | ShallowWebPageNode | null {\n\tconst scopeId = instance.getLocalSmartComponentNodeId()\n\tconst scopeNode = tree.getNode(scopeId)\n\tif (!isSmartComponentNode(scopeNode) && !isWebPageNode(scopeNode)) return null\n\treturn scopeNode\n}\n\nexport function getActiveVariantIdForLocalSmartComponentInstance(\n\ttree: CanvasTree,\n\tnode: CodeComponentNode,\n): MaybeNodeID {\n\tif (!isLocalSmartComponentInstance(node)) return null\n\n\tconst variantProp = node.getRawControlProp(\"variant\")\n\n\t// If there's no variant prop, we take that the active variant is the primary variant\n\tif (!variantProp) {\n\t\tconst scopeId = node.getLocalSmartComponentNodeId()\n\t\tconst scopeNode = tree.getNode(scopeId)\n\t\tif (!isSmartComponentNode(scopeNode)) return null\n\t\treturn scopeNode.baseVariantId ?? null\n\t}\n\n\tlet { value } = variantProp\n\tif (isVariableReference(value)) {\n\t\tconst scopeNode = tree.getScopeNodeFor(node)\n\t\tif (!scopeNode || !withVariables(scopeNode)) return null\n\t\tvalue = scopeNode.getVariableValue(value.id)\n\t}\n\n\tif (!isString(value)) return null\n\tif (!tree.has(value)) return null\n\treturn value\n}\n\nexport function isLocalSmartComponentInstance(\n\tnode: CanvasNode,\n): node is CodeComponentNode & { codeComponentIdentifier: LocalModuleIdentifierString } {\n\tif (!isCodeComponentNode(node)) return false\n\tconst moduleIdentifier = parseModuleIdentifier(node.codeComponentIdentifier)\n\tif (!moduleIdentifier) return false\n\treturn isLocalModuleIdentifier(moduleIdentifier) && moduleIdentifier.type === ModuleType.Canvas\n}\n\nexport function isSmartComponentInstance(\n\ttree: CanvasTree,\n\tnode: CanvasNode,\n): node is CodeComponentNode & {\n\tcodeComponentIdentifier: LocalModuleIdentifierString | ExternalModuleIdentifierString\n} {\n\tif (!isCodeComponentNode(node)) return false\n\n\tconst moduleIdentifier = parseModuleIdentifier(node.codeComponentIdentifier)\n\tif (!moduleIdentifier) return false\n\n\tif (isLocalModuleIdentifier(moduleIdentifier)) {\n\t\treturn moduleIdentifier.type === ModuleType.Canvas\n\t}\n\n\tif (isExternalModuleIdentifier(moduleIdentifier)) {\n\t\tconst moduleNode = tree.getNode<ExternalModuleNode>(moduleIdentifier.moduleId)\n\t\treturn moduleNode?.type === ModuleType.Canvas\n\t}\n\n\treturn false\n}\n\nexport function localScreenComponentId(identifier: string): string | null {\n\tconst parsedIdentifier = parseModuleIdentifier(identifier)\n\tif (!isLocalModuleIdentifier(parsedIdentifier)) return null\n\tif (parsedIdentifier.type !== ModuleType.Screen) return null\n\t// For smartComponents the part after \"/\" in the localId is the node ID.\n\tconst [, id] = parsedIdentifier.localId.split(\"/\")\n\treturn id ?? null\n}\n\nexport function isActiveSmartComponentInstance(node: CodeComponentNode, activeScopeId: NodeID): boolean {\n\tconst smartComponentId = moduleIdentifierToLocalComponentId(node.codeComponentIdentifier)\n\treturn activeScopeId === smartComponentId\n}\n\nexport function containsActiveSmartComponentInstance(node: CanvasNode, activeScopeId: NodeID): boolean {\n\treturn node.some(n => isCodeComponentNode(n) && isActiveSmartComponentInstance(n, activeScopeId))\n}\n", "import { isString } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../index.ts\"\n\n/**\n * This Trait does not have any effect on the nodes rendered on the canvas. Its\n * purpose is to allow CanvasNodes to render with custom HTML tags during code\n * generation for published sites, for accessibility and SEO benefits. No styling\n * is applied to nodes with a custom HTML tag set.\n */\nexport interface WithHTMLTag {\n\treadonly htmlTag?: HTMLTag\n}\n\n/**\n * Currently only supported for FrameNodes.\n * But it can theoretically be extended to any node.\n */\nexport enum HTMLTag {\n\tarticle = \"article\",\n\taside = \"aside\",\n\tbutton = \"button\",\n\tdiv = \"div\",\n\tfigcaption = \"figcaption\",\n\tfigure = \"figure\",\n\tfooter = \"footer\",\n\theader = \"header\",\n\tmain = \"main\",\n\tnav = \"nav\",\n\t/**\n\t * <ol> is provided as an option here in order to\n\t * provide SEO benefits only. No special <ol> styling is applied.\n\t * Default browser styles for <ol> are reset so\n\t * that we do not render numbers for nodes whose parents\n\t * are set to use <ol>.\n\t * Future versions of Framer which support styled ordered lists\n\t * cannot apply that styling based on this selection.\n\t * Doing so would cause old framer projects to be regenerated with unintended list styling\n\t */\n\tol = \"ol\",\n\tsection = \"section\",\n\t/**\n\t * <ul> is provided as an option here in order to\n\t * provide SEO benefits only. No special <ul> styling is applied.\n\t * Default browser styles for <ul> are reset so\n\t * that we do not render discs/bullets etc for nodes whose\n\t * parents are set to use <ul>\n\t * Future versions of Framer which support styled unordered lists\n\t * cannot apply that styling based on this selection.\n\t * Doing so would cause old framer projects to be regenerated with unintended list styling\n\t */\n\tul = \"ul\",\n\tlabel = \"label\",\n}\n\nexport const allHTMLTags = Object.values(HTMLTag)\n\nexport const htmlTagDefaults: WithHTMLTag = {\n\thtmlTag: undefined,\n}\n\nexport const htmlTagEnabledDefaults: WithHTMLTag = {\n\thtmlTag: HTMLTag.div,\n}\n\nexport const defaultHTMLTag = HTMLTag.div\nconst key: keyof WithHTMLTag = \"htmlTag\"\n\nexport function withHTMLTag<T extends CanvasNode>(node: T): node is T & WithHTMLTag {\n\treturn key in node\n}\n\nexport function isHTMLTag(value: unknown): value is HTMLTag {\n\treturn isString(value) && allHTMLTags.includes(value as HTMLTag)\n}\n\n/**\n * Returns true if the given HTMLTag is a list type tag (ul or ol).\n */\nexport function isListTag(value: HTMLTag | undefined): boolean {\n\tif (!value) return false\n\n\treturn value === HTMLTag.ul || value === HTMLTag.ol\n}\n\nexport function hasLabelTag<T extends CanvasNode>(node: T): node is T & WithHTMLTag & { htmlTag: HTMLTag.label } {\n\treturn withHTMLTag(node) && node.htmlTag === \"label\"\n}\n", "import { isUndefined } from \"utils/typeChecks.ts\"\nimport type { CanvasTree } from \"../CanvasTree.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport type CodeComponentNode from \"../nodes/CodeComponentNode.ts\"\nimport type { LoadedSmartComponentNode } from \"../nodes/SmartComponentNode.ts\"\nimport { TemplateHelper } from \"../nodes/TemplateHelper.ts\"\nimport { isCodeComponentNode } from \"../nodes/utils/nodeCheck.ts\"\nimport { getSmartComponentForCodeComponent } from \"../nodes/utils/smartComponentInstanceHelpers.ts\"\nimport type { WithHTMLTag } from \"./WithHTMLTag.ts\"\nimport { HTMLTag } from \"./WithHTMLTag.ts\"\nimport type { WithLink } from \"./WithLink.ts\"\nimport { isReplica } from \"./WithTemplate.ts\"\nimport type { IsVariant } from \"./WithVariant.ts\"\nimport { isVariant } from \"./WithVariant.ts\"\nimport { type WithFormContainer, isFormContainer } from \"./forms/WithFormContainer.ts\"\nimport type { ReducedRecord } from \"./utils/Reduced.ts\"\nimport { reduceProperty } from \"./utils/reduceProperty.ts\"\n\n/**\n * Allow code components to set variants based on the state of a form ancestor.\n */\nexport interface WithFormVariants {\n\tformButtonSuccessVariantEnabled: boolean | undefined\n\tformButtonPendingVariantEnabled: boolean | undefined\n\tformButtonErrorVariantEnabled: boolean | undefined\n\tformButtonIncompleteVariantEnabled: boolean | undefined\n\tformButtonSuccessVariant: string | undefined\n\tformButtonPendingVariant: string | undefined\n\tformButtonErrorVariant: string | undefined\n\tformButtonIncompleteVariant: string | undefined\n}\n\nexport const formVariantsDefaults: WithFormVariants = {\n\tformButtonSuccessVariantEnabled: undefined,\n\tformButtonPendingVariantEnabled: undefined,\n\tformButtonErrorVariantEnabled: undefined,\n\tformButtonIncompleteVariantEnabled: undefined,\n\tformButtonSuccessVariant: undefined,\n\tformButtonPendingVariant: undefined,\n\tformButtonErrorVariant: undefined,\n\tformButtonIncompleteVariant: undefined,\n}\n\nconst key: keyof WithFormVariants = \"formButtonSuccessVariant\"\n\nexport function withFormVariants<T extends CanvasNode>(node: T): node is T & WithFormVariants {\n\treturn key in node\n}\n\nexport function hasAnyFormVariants<T extends CanvasNode>(node: T): node is T & WithFormVariants {\n\tif (!withFormVariants(node)) return false\n\n\tif (node.formButtonSuccessVariantEnabled && node.formButtonSuccessVariant) return true\n\tif (node.formButtonPendingVariantEnabled && node.formButtonPendingVariant) return true\n\tif (node.formButtonErrorVariantEnabled && node.formButtonErrorVariant) return true\n\tif (node.formButtonIncompleteVariantEnabled && node.formButtonIncompleteVariant) return true\n\n\treturn false\n}\n\nexport interface ReducedFormVariants extends Omit<\n\tReducedRecord<WithFormVariants>,\n\t\"formButtonSuccessVariant\" | \"formButtonPendingVariant\" | \"formButtonErrorVariant\" | \"formButtonIncompleteVariant\"\n> {\n\tonlyNodesWithFormVariants: boolean\n\tformButtonSuccessVariant: Set<string | undefined>\n\tformButtonPendingVariant: Set<string | undefined>\n\tformButtonErrorVariant: Set<string | undefined>\n\tformButtonIncompleteVariant: Set<string | undefined>\n}\n\n/**\n * Check if a variant in a Smart Component is being used as a form button in the\n * project. If it is, it can't change it's html element type, and must be a\n * button. Will also return true if the document is still loading.\n */\nexport function isVariantFormButtonSource(tree: CanvasTree, node: CanvasNode): boolean {\n\tif (!isVariant(node) || !tree.isGroundNode(node)) return false\n\n\t// If the tree is still loading, we don't know if the variant is a form button. So we\n\t// return true to be conservative. When using data tree, isLoaded() is always true;\n\t// we we will try to find the form containers with it.\n\tif (!tree.isLoaded()) return true\n\n\tconst forms = tree.query().wherePropertyEquals<WithFormContainer>(\"isFormContainer\", true).iterate()\n\tconst scopeForNode = tree.getScopeNodeFor(node)\n\n\t// Iterate through all the form containers in the project, returning true as\n\t// soon as one of those forms specifies an instance of the smart component\n\t// that this variant is part of.\n\tfor (const form of forms) {\n\t\tconst button = tree.get(form.formSubmitButtonId)\n\t\tif (!isCodeComponentNode(button)) continue\n\t\tconst scope = getSmartComponentForCodeComponent(tree, button)\n\t\tif (scope?.id === scopeForNode?.id) return true\n\t}\n\n\treturn false\n}\n\n/**\n * Check if a variant in a Smart Component could be used, as is, when\n * code-generated into an instance, as a form submit button.\n */\nexport function requiresModificationsToBeFormButtonSource(\n\tnode: CanvasNode & IsVariant & WithLink & WithHTMLTag,\n): boolean {\n\treturn node.htmlTag !== HTMLTag.button || !isUndefined(node.link)\n}\n\nexport function canLoadedComponentBeFormButtonSource(component: LoadedSmartComponentNode): boolean {\n\tfor (const variant of component.getVariants()) {\n\t\tif (isReplica(variant)) {\n\t\t\tif (TemplateHelper.isAnyKeyOverridden(variant, variant.originalid, [\"htmlTag\", \"link\"])) return false\n\t\t} else if (requiresModificationsToBeFormButtonSource(variant)) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}\n\n/**\n * Check if a code component is it's form submit button. Use the cache to\n * quickly find the form container ancestor.\n */\nexport function isFormSubmitButtonInstance(tree: CanvasTree, node: CodeComponentNode): boolean {\n\tconst formId = node.cache.formContainerAncestorId\n\tif (!formId) return false\n\tconst formNode = tree.getNode(formId)\n\tconst originalFormNode = tree.get(formNode?.getPrimaryId())\n\tif (!isFormContainer(originalFormNode)) return false\n\treturn originalFormNode.formSubmitButtonId === node.getPrimaryId()\n}\n\nexport function reduceFormVariants(tree: CanvasTree, node: CanvasNode, result: ReducedFormVariants) {\n\tif (!withFormVariants(node) || !isCodeComponentNode(node) || !isFormSubmitButtonInstance(tree, node)) {\n\t\tresult.onlyNodesWithFormVariants = false\n\t\treturn\n\t}\n\n\treduceProperty(\"formButtonSuccessVariantEnabled\", result, node)\n\treduceProperty(\"formButtonPendingVariantEnabled\", result, node)\n\treduceProperty(\"formButtonErrorVariantEnabled\", result, node)\n\treduceProperty(\"formButtonIncompleteVariantEnabled\", result, node)\n\n\tresult.formButtonSuccessVariant.add(node.formButtonSuccessVariant)\n\tresult.formButtonPendingVariant.add(node.formButtonPendingVariant)\n\tresult.formButtonErrorVariant.add(node.formButtonErrorVariant)\n\tresult.formButtonIncompleteVariant.add(node.formButtonIncompleteVariant)\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\n\nexport interface WithIntrinsicSize {\n\t/** In CSS pixels. [More information](https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio). */\n\tintrinsicWidth: number | null\n\t/** In CSS pixels. [More information](https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio). */\n\tintrinsicHeight: number | null\n}\n\nexport const intrinsicSizeDefaults: WithIntrinsicSize = {\n\tintrinsicWidth: null,\n\tintrinsicHeight: null,\n}\n\nconst key: keyof WithIntrinsicSize = \"intrinsicWidth\"\n\nexport function withIntrinsicSize(node: CanvasNode): node is CanvasNode & WithIntrinsicSize {\n\treturn key in node\n}\n", "import type { NonUndefinedKeys } from \"utils/NonUndefined.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../index.ts\"\nimport type { NodeID } from \"../nodes/NodeID.ts\"\nimport type { ValueTransform } from \"./ValueTransform.ts\"\nimport type { VariableID } from \"./WithVariables.ts\"\n\nexport interface CollectionFilter {\n\tid: NodeID\n\t/** The key can be null when adding the filter, the filter won't be active until a key is set */\n\titemKey: string | null\n\t/** If transforms don't result in a boolean the filter is invalid and won't be active */\n\ttransforms: ValueTransform[]\n}\n\nexport interface CollectionFilterData {\n\tfilters: CollectionFilter[]\n}\n\nexport type CollectionFilterOperator = \"any\" | \"all\"\n\nexport const defaultFiltersOperator: CollectionFilterOperator = \"all\"\n\nexport type CollectionOrderDirection = \"asc\" | \"desc\"\n\nexport const defaultOrderDirection: CollectionOrderDirection = \"asc\"\n\nexport interface CollectionOrderItem {\n\tid: NodeID\n\titemKey: VariableID | null\n\tdirection: CollectionOrderDirection\n}\n\nexport type CollectionOrder = readonly CollectionOrderItem[]\n\nexport interface WithCollectionOptions {\n\tcollectionFilters: CollectionFilterData | undefined\n\tcollectionFiltersOperator: CollectionFilterOperator | undefined\n\tcollectionOrder: CollectionOrder | undefined\n\tcollectionStartOffset: number | undefined\n\tcollectionLimit: number | undefined\n\tcollectionPaginationPageSize: number | undefined\n\n\t/** @deprecated Use `repeatedItemId` instead. */\n\tcollectionRepeatedItemId: string | undefined\n\t/** When set, no other child will be repeated. */\n\trepeatedItemId: string | undefined\n\n\t/** @deprecated Use `collectionOrder` instead. */\n\tcollectionReverse: boolean | undefined\n}\n\nexport const collectionOptionDefaults: WithCollectionOptions = {\n\tcollectionFilters: undefined,\n\tcollectionFiltersOperator: undefined,\n\tcollectionOrder: undefined,\n\tcollectionReverse: undefined,\n\tcollectionStartOffset: undefined,\n\tcollectionLimit: undefined,\n\tcollectionPaginationPageSize: undefined,\n\tcollectionRepeatedItemId: undefined,\n\trepeatedItemId: undefined,\n}\n\nconst key: keyof WithCollectionOptions = \"collectionReverse\"\n\nexport function withCollectionOptions<T extends CanvasNode>(node: T): node is T & WithCollectionOptions {\n\treturn key in node\n}\n\nexport type HasPaginationEnabled = NonUndefinedKeys<WithCollectionOptions, \"collectionPaginationPageSize\">\n\nexport function hasPaginationEnabled<T extends CanvasNode>(node: T): node is T & HasPaginationEnabled {\n\treturn withCollectionOptions(node) && isNumber(node.collectionPaginationPageSize)\n}\n", "import { experiments } from \"app/experiments.ts\"\nimport type { Transition } from \"document/models/Transition.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\n\nexport interface WithFlowEffect {\n\tflowEffectEnabled: boolean | undefined\n\tflowEffectTransition: Transition | undefined\n}\n\nexport const flowEffectDefaults: WithFlowEffect = {\n\tflowEffectEnabled: undefined,\n\tflowEffectTransition: undefined,\n}\n\nexport const flowEffectEnabledDefaults = {\n\tflowEffectEnabled: true,\n\tflowEffectTransition: undefined,\n} as const satisfies WithFlowEffect\n\nconst key: keyof WithFlowEffect = \"flowEffectEnabled\"\n\nexport function withFlowEffect<T extends CanvasNode>(node: T): node is T & WithFlowEffect {\n\treturn key in node\n}\n\nexport function hasFlowEffect<T extends CanvasNode>(node: T): node is T & WithFlowEffect & { flowEffectEnabled: true } {\n\treturn withFlowEffect(node) && node.flowEffectEnabled === true\n}\n\n/**\n * If the node is a direct child of a layout group effect node.\n */\nexport function isNodeFlowEffectItem(node: CanvasNode): boolean {\n\treturn Boolean(node.cache.flowEffectAncestorId && node.parentid === node.cache.flowEffectAncestorId)\n}\n\nexport function isNodeInFlowEffect(node: CanvasNode): boolean {\n\treturn Boolean(node.cache.flowEffectAncestorId)\n}\n\nexport function isFlowEffectSupportedScopeType(scopeType: ScopeType | undefined): boolean {\n\treturn (\n\t\tscopeType === ScopeType.WebPage ||\n\t\t(experiments.isOn(\"flowEffectInLayoutTemplates\") && scopeType === ScopeType.LayoutTemplate)\n\t)\n}\n", "import type { Annotations, ParsedAnnotations, SupportedLayoutOption } from \"@framerjs/framer-runtime/crossorigin\"\nimport {\n\tAnnotationKey,\n\tcontractVersion,\n\tgetDefaultLayoutOption,\n\tisSupportedLayoutOption,\n} from \"@framerjs/framer-runtime/crossorigin\"\nimport type { GlobalModuleId, LocalModuleId } from \"@framerjs/shared\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isArray, isBoolean, isNumber, isObject, isString } from \"utils/typeChecks.ts\"\n\nexport interface SupportedLayoutOptions {\n\twidth: SupportedLayoutOption\n\theight: SupportedLayoutOption\n}\n\nexport function parseSupportedLayoutFromAnnotations(annotations: Annotations): SupportedLayoutOptions {\n\tconst defaultLayoutOption = getDefaultLayoutOption(contractVersion(annotations))\n\tconst widthAnnotation = annotations[AnnotationKey.FramerSupportedLayoutWidth]\n\tconst heightAnnotation = annotations[AnnotationKey.FramerSupportedLayoutHeight]\n\tconst width = isSupportedLayoutOption(widthAnnotation) ? widthAnnotation : defaultLayoutOption\n\tconst height = isSupportedLayoutOption(heightAnnotation) ? heightAnnotation : defaultLayoutOption\n\n\treturn { width, height }\n}\n\nexport function parseIntrinsicSizeFromAnnotations(annotations: Annotations | ParsedAnnotations) {\n\tconst size: { width: null | number; height: null | number } = { width: null, height: null }\n\n\tconst intrinsicWidth = annotations[AnnotationKey.FramerIntrinsicWidth]\n\tif (intrinsicWidth) {\n\t\tconst parsedWidth = Math.round(+intrinsicWidth)\n\t\tif (isNumber(parsedWidth)) {\n\t\t\tsize.width = parsedWidth\n\t\t}\n\t}\n\n\tconst intrinsicHeight = annotations[AnnotationKey.FramerIntrinsicHeight]\n\tif (intrinsicHeight) {\n\t\tconst parsedHeight = Math.round(+intrinsicHeight)\n\t\tif (isNumber(parsedHeight)) {\n\t\t\tsize.height = parsedHeight\n\t\t}\n\t}\n\n\treturn size\n}\n\nexport interface VectorColor {\n\ttype: \"static\" | \"variable\"\n\tvalue: string\n}\n\nexport interface FramerVectorInfo {\n\tname: string\n\tempty?: true\n\tcolor?: VectorColor\n\tset: {\n\t\tlocalId: LocalModuleId\n\t\tid: NodeID\n\t\tmoduleId: GlobalModuleId\n\t}\n}\n\nconst emptyKey = \"empty\" satisfies keyof FramerVectorInfo\nconst colorKey = \"color\" satisfies keyof FramerVectorInfo\n\nexport function isFramerVectorInfo(info: unknown): info is FramerVectorInfo {\n\tif (!isObject(info)) return false\n\tif (!isString(info.name)) return false\n\tif (!isObject(info.set)) return false\n\tif (!isString(info.set.localId)) return false\n\tif (!isString(info.set.id)) return false\n\tif (!isString(info.set.moduleId)) return false\n\tif (emptyKey in info && !isBoolean(info[emptyKey])) return false\n\tif (colorKey in info && !isVectorColor(info[colorKey])) return false\n\treturn true\n}\n\nfunction isVectorColor(info: unknown): info is VectorColor {\n\tif (!isObject(info)) return false\n\tif (!isString(info.value)) return false\n\tif (!isString(info.type) || !(info.type === \"static\" || info.type === \"variable\")) return false\n\treturn true\n}\n\nexport interface VectorSetItem {\n\tid: NodeID\n\tname: string\n\tmoduleId: GlobalModuleId\n\t/** Only present in published vector sets. */\n\tsaveId?: string\n}\n\nexport interface FramerVectorSetInfo {\n\tname: string\n\titems: VectorSetItem[]\n}\n\nfunction isVectorSetItem(item: unknown): item is VectorSetItem {\n\treturn isObject(item) && isString(item.id) && isString(item.name) && isString(item.moduleId)\n}\n\nexport function isFramerVectorSetInfo(info: unknown): info is FramerVectorSetInfo {\n\tif (!isObject(info)) return false\n\tif (!isString(info.name)) return false\n\tif (!isArray(info.items)) return false\n\treturn info.items.every(isVectorSetItem)\n}\n\n/**\n * A published vector set specifies the save ids of each item. Either all or none of the items must\n * have a save id -- .some() should return after the first item.\n */\nexport function isPublishedVectorSetInfo(info: FramerVectorSetInfo): boolean {\n\treturn info.items.some(item => isString(item.saveId))\n}\n\nexport function isFramerVectorSetsInfo(info: unknown): info is GlobalModuleId[] {\n\tif (!isArray(info)) return false\n\treturn info.every(isString)\n}\n", "import { triggerEvent } from \"../listeners\";\nfunction createEventActionCreateConsoleLogEvent(payload) {\n  console.warn(\"[DEPRECATED] Use triggerEventActionCreateConsoleLogEvent instead of createEventActionCreateConsoleLogEvent.\");\n  return {\n    ...payload,\n    event: \"event_action_create_console_log\"\n  };\n}\nconst meta = {\n  track: true\n};\nfunction triggerEventActionCreateConsoleLogEvent(payload) {\n  const event = {\n    ...payload,\n    event: \"event_action_create_console_log\"\n  };\n  triggerEvent(event, meta);\n}\nexport {\n  createEventActionCreateConsoleLogEvent,\n  triggerEventActionCreateConsoleLogEvent\n};\n", "import { triggerEvent } from \"../listeners\";\nfunction createEventActionCreateCustomEvent(payload) {\n  console.warn(\"[DEPRECATED] Use triggerEventActionCreateCustomEvent instead of createEventActionCreateCustomEvent.\");\n  return {\n    ...payload,\n    event: \"event_action_create_custom\"\n  };\n}\nconst meta = {\n  track: true\n};\nfunction triggerEventActionCreateCustomEvent(payload) {\n  const event = {\n    ...payload,\n    event: \"event_action_create_custom\"\n  };\n  triggerEvent(event, meta);\n}\nexport {\n  createEventActionCreateCustomEvent,\n  triggerEventActionCreateCustomEvent\n};\n", "import { triggerEvent } from \"../listeners\";\nfunction createEventActionCreateNavigateEvent(payload) {\n  console.warn(\"[DEPRECATED] Use triggerEventActionCreateNavigateEvent instead of createEventActionCreateNavigateEvent.\");\n  return {\n    ...payload,\n    event: \"event_action_create_navigate\"\n  };\n}\nconst meta = {\n  track: true\n};\nfunction triggerEventActionCreateNavigateEvent(payload) {\n  const event = {\n    ...payload,\n    event: \"event_action_create_navigate\"\n  };\n  triggerEvent(event, meta);\n}\nexport {\n  createEventActionCreateNavigateEvent,\n  triggerEventActionCreateNavigateEvent\n};\n", "import { triggerEvent } from \"../listeners\";\nfunction createEventActionCreateOpenUrlEvent(payload) {\n  console.warn(\"[DEPRECATED] Use triggerEventActionCreateOpenUrlEvent instead of createEventActionCreateOpenUrlEvent.\");\n  return {\n    ...payload,\n    event: \"event_action_create_open_url\"\n  };\n}\nconst meta = {\n  track: true\n};\nfunction triggerEventActionCreateOpenUrlEvent(payload) {\n  const event = {\n    ...payload,\n    event: \"event_action_create_open_url\"\n  };\n  triggerEvent(event, meta);\n}\nexport {\n  createEventActionCreateOpenUrlEvent,\n  triggerEventActionCreateOpenUrlEvent\n};\n", "import { triggerEvent } from \"../listeners\";\nfunction createEventActionUpdateConsoleLogEvent(payload) {\n  console.warn(\"[DEPRECATED] Use triggerEventActionUpdateConsoleLogEvent instead of createEventActionUpdateConsoleLogEvent.\");\n  return {\n    ...payload,\n    event: \"event_action_update_console_log\"\n  };\n}\nconst meta = {\n  track: true\n};\nfunction triggerEventActionUpdateConsoleLogEvent(payload) {\n  const event = {\n    ...payload,\n    event: \"event_action_update_console_log\"\n  };\n  triggerEvent(event, meta);\n}\nexport {\n  createEventActionUpdateConsoleLogEvent,\n  triggerEventActionUpdateConsoleLogEvent\n};\n", "import { triggerEvent } from \"../listeners\";\nfunction createEventActionUpdateCustomEvent(payload) {\n  console.warn(\"[DEPRECATED] Use triggerEventActionUpdateCustomEvent instead of createEventActionUpdateCustomEvent.\");\n  return {\n    ...payload,\n    event: \"event_action_update_custom\"\n  };\n}\nconst meta = {\n  track: true\n};\nfunction triggerEventActionUpdateCustomEvent(payload) {\n  const event = {\n    ...payload,\n    event: \"event_action_update_custom\"\n  };\n  triggerEvent(event, meta);\n}\nexport {\n  createEventActionUpdateCustomEvent,\n  triggerEventActionUpdateCustomEvent\n};\n", "import { triggerEvent } from \"../listeners\";\nfunction createEventActionUpdateNavigateEvent(payload) {\n  console.warn(\"[DEPRECATED] Use triggerEventActionUpdateNavigateEvent instead of createEventActionUpdateNavigateEvent.\");\n  return {\n    ...payload,\n    event: \"event_action_update_navigate\"\n  };\n}\nconst meta = {\n  track: true\n};\nfunction triggerEventActionUpdateNavigateEvent(payload) {\n  const event = {\n    ...payload,\n    event: \"event_action_update_navigate\"\n  };\n  triggerEvent(event, meta);\n}\nexport {\n  createEventActionUpdateNavigateEvent,\n  triggerEventActionUpdateNavigateEvent\n};\n", "import { triggerEvent } from \"../listeners\";\nfunction createEventActionUpdateOpenUrlEvent(payload) {\n  console.warn(\"[DEPRECATED] Use triggerEventActionUpdateOpenUrlEvent instead of createEventActionUpdateOpenUrlEvent.\");\n  return {\n    ...payload,\n    event: \"event_action_update_open_url\"\n  };\n}\nconst meta = {\n  track: true\n};\nfunction triggerEventActionUpdateOpenUrlEvent(payload) {\n  const event = {\n    ...payload,\n    event: \"event_action_update_open_url\"\n  };\n  triggerEvent(event, meta);\n}\nexport {\n  createEventActionUpdateOpenUrlEvent,\n  triggerEventActionUpdateOpenUrlEvent\n};\n", "import type { Annotations, ExportSpecifier, ParsedModuleAnnotations } from \"@framerjs/framer-runtime/crossorigin\"\nimport { AnnotationKey } from \"@framerjs/framer-runtime/crossorigin\"\nimport type { ExternalModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { ModuleType, emptyArray } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { isFramerVectorSetInfo } from \"code-generation/utils/annotations.ts\"\nimport { parseModuleAnnotations } from \"modules/utils.ts\"\nimport { isObject } from \"utils/typeChecks.ts\"\nimport { withClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { CanvasTree } from \"../CanvasTree.ts\"\nimport type { WithGetName } from \"../traits/WithGetName.ts\"\nimport { CanvasNode } from \"./CanvasNode.ts\"\nimport type { ChildList } from \"./ChildList.ts\"\nimport { setDefaults } from \"./MutableNode.ts\"\n\nexport const EXTERNAL_MODULES_LIST_ID = \"externalModules\"\n\n/**\n * This node type represents the list of the external modules used in the project.\n * This node can only be a child of the RootNode.\n */\nexport class ExternalModulesListNode extends withClassDiscriminator(\"ExternalModulesListNode\", CanvasNode) {\n\t/**\n\t * We are using a static value here to make sure our multiplayer protocol\n\t * always resolves to this one node and creates it if it doesn't exist.\n\t */\n\tdeclare readonly id: \"externalModules\"\n\tdeclare children?: ChildList<ExternalModuleNode>\n\n\tconstructor(properties?: Partial<ExternalModulesListNode>) {\n\t\tconst propsWithId = { ...properties, id: EXTERNAL_MODULES_LIST_ID } as const\n\t\tsuper(propsWithId)\n\t\tthis.assign(propsWithId)\n\t}\n\n\tstatic get(tree: CanvasTree) {\n\t\treturn tree.get<ExternalModulesListNode>(EXTERNAL_MODULES_LIST_ID)\n\t}\n\n\tstatic getModuleNodes(tree: CanvasTree) {\n\t\tconst listNode = ExternalModulesListNode.get(tree)\n\t\treturn listNode?.children?.toArray() ?? emptyArray()\n\t}\n}\n\nconst PARSED_ANNOTATION_MODULE_TYPES = new Set<string | undefined>([ModuleType.VectorSet, ModuleType.Vector])\nexport function isParsedAnnotationExternalModuleType(type: ModuleType | string | undefined) {\n\treturn PARSED_ANNOTATION_MODULE_TYPES.has(type)\n}\n/**\n * Represents an external module used in the project.\n * This node can only be a child of the ExternalModulesListNode.\n */\nexport class ExternalModuleNode\n\textends withClassDiscriminator(\"ExternalModuleNode\", CanvasNode)\n\timplements WithGetName\n{\n\t/**\n\t * `moduleId` of the corresponding module\n\t */\n\tdeclare readonly id: string\n\n\t// FIXME: A module could have multiple components, so this should be an array.\n\t// FIXME: This can also be undefined according to current initialization.\n\tdeclare codeComponentIdentifier: ExternalModuleExportIdentifierString\n\n\t/**\n\t * Module displayName OR title.\n\t */\n\tdeclare title: string\n\n\t/**\n\t * Version requirement in semver format.\n\t */\n\tdeclare version: \"latest\" | string\n\n\tdeclare intrinsicWidth: number\n\n\tdeclare intrinsicHeight: number\n\n\tdeclare annotations?: Annotations | ParsedModuleAnnotations[ExportSpecifier]\n\n\t/*\n      The fields below are optional because they were introduced into the schema later, so there might be existing nodes that don't have those fields set.\n    */\n\n\tdeclare ownerType?: \"project\" | \"team\" | string\n\n\tdeclare ownerId?: string\n\n\tdeclare type?: ModuleType | string\n\n\t/**\n\t * Node ID of the corresponding ScopeNode in the source project.\n\t * Used for linking smart components directly to the component isolation in the source project.\n\t */\n\tdeclare scopeNodeId?: string\n\n\tdeclare group?: {\n\t\tid: string\n\t\ttype: string\n\t\tname: string\n\t}\n\n\tdeclare updateSaveId: string\n\n\tdeclare namespaceId?: string\n\n\t/** See `ModuleMetadata.PluginId`. */\n\tdeclare pluginId?: string\n\n\tgetName() {\n\t\tswitch (this.type) {\n\t\t\tcase ModuleType.VectorSet: {\n\t\t\t\tconst annotation = this.annotation(AnnotationKey.FramerVectorSet)\n\t\t\t\tif (!isFramerVectorSetInfo(annotation)) return Dictionary.Vector\n\t\t\t\treturn annotation.name\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn this.title ?? Dictionary.Unknown\n\t\t}\n\t}\n\n\t/**\n\t * If the annotation exists in the partially parsed annotations, fully parse the annotations and\n\t * return the value for the annotation key. Assumes the export identifier is `default`.\n\t */\n\tannotation(key: AnnotationKey) {\n\t\tif (!isObject(this.annotations) || !(key in this.annotations)) return undefined\n\t\treturn isParsedAnnotationExternalModuleType(this.type)\n\t\t\t? this.annotations[key]\n\t\t\t: parseModuleAnnotations({ default: this.annotations as Annotations }).default?.[key]\n\t}\n\n\tconstructor(properties?: Partial<ExternalModuleNode>) {\n\t\tsuper(properties)\n\t\tsetDefaults<ExternalModuleNode>(\n\t\t\tthis,\n\t\t\t{\n\t\t\t\tversion: \"latest\",\n\t\t\t\ttitle: \"\",\n\t\t\t\tintrinsicWidth: 200,\n\t\t\t\tintrinsicHeight: 200,\n\n\t\t\t\t// These fields need to be set explicitly, otherwise deserialization (canvasNodeFromValue) won't set them.\n\t\t\t\tannotations: undefined,\n\t\t\t\tcodeComponentIdentifier: \"module:///:\",\n\t\t\t\townerType: undefined,\n\t\t\t\townerId: undefined,\n\t\t\t\ttype: undefined,\n\t\t\t\tscopeNodeId: undefined,\n\t\t\t\tgroup: undefined,\n\t\t\t\tupdateSaveId: \"\",\n\t\t\t\tnamespaceId: undefined,\n\t\t\t\tpluginId: undefined,\n\t\t\t} satisfies Partial<ExternalModuleNode>,\n\t\t\tproperties,\n\t\t)\n\t}\n}\n", "const slashWhitespaceRegex = /\\s*\\/\\s*/g\nconst multipleSlashesRegex = /\\/+/g\nconst leadingAndTrailingSlashRegex = /^\\/+|\\/+$/g\n\n/**\n * Normalizes an asset name that may contain a path by:\n * 1. Trimming whitespace from the entire path\n * 2. Normalizing spaces around slashes\n * 3. Normalizing multiple consecutive slashes\n * 4. Ensuring the path is not made up of only slashes\n *\n * @param path The path string to normalize\n * @returns The normalized path string, or empty string if invalid\n * @example\n * getNormalizedAssetNamePath(\"folder / component\") // \"folder/component\"\n * getNormalizedAssetNamePath(\" folder / component \") // \"folder/component\"\n * getNormalizedAssetNamePath(\"folder///component\") // \"folder/component\"\n * getNormalizedAssetNamePath(\"    /     \") // \"\"\n * getNormalizedAssetNamePath(\"    \") // \"\"\n * getNormalizedAssetNamePath(\"///\") // \"\"\n */\nexport function getNormalizedAssetNamePath(path: string): string {\n\tconst trimmed = path.trim()\n\tif (!trimmed) return \"\"\n\n\tconst normalized = trimmed\n\t\t.replace(slashWhitespaceRegex, \"/\") // Replace spaces around slashes with a single slash, e.g. \"folder / component\" -> \"folder/component\"\n\t\t.replace(multipleSlashesRegex, \"/\") // Normalize multiple slashes, e.g. \"folder///component\" -> \"folder/component\"\n\t\t.replace(leadingAndTrailingSlashRegex, \"\") // Remove leading and trailing slashes, e.g. \"///folder///component///\" -> \"folder/component\"\n\n\treturn normalized\n}\n", "import { getNormalizedAssetNamePath } from \"./getNormalizedAssetNamePath.ts\"\n\n/**\n * Splits a path string into segments.\n * Normalizes the path before splitting.\n *\n * @example\n * splitPathToSegments(\"folder/component\") // [\"folder\", \"component\"]\n * splitPathToSegments(\"  folder / component  \") // [\"folder\", \"component\"]\n * splitPathToSegments(\"\") // []\n */\nexport function splitPathToSegments(path: string): string[] {\n\tconst normalizedPath = getNormalizedAssetNamePath(path)\n\tif (normalizedPath === \"\") return []\n\n\treturn normalizedPath.split(\"/\")\n}\n\n/**\n * Gets the name (last segment) from a path string.\n *\n * @example\n * getNameFromPath(\"folder/component\") // \"component\"\n * getNameFromPath(\"component\") // \"component\"\n */\nexport function getNameFromPath(path: string) {\n\tconst normalizedPath = getNormalizedAssetNamePath(path)\n\tif (normalizedPath === \"\") return \"\"\n\n\tconst lastSlashIndex = normalizedPath.lastIndexOf(\"/\")\n\tif (lastSlashIndex >= 0) return normalizedPath.slice(lastSlashIndex + 1)\n\treturn normalizedPath\n}\n", "import type { ParsedModuleAnnotations } from \"@framerjs/framer-runtime/crossorigin\"\nimport { emptyArray } from \"@framerjs/shared\"\nimport { ModuleType } from \"@framerjs/shared/src/moduleIdentifiers.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { getNameFromPath } from \"document/utils/assetPath.ts\"\nimport { withClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { CanvasTree } from \"../CanvasTree.ts\"\nimport type { WithGetName } from \"../traits/WithGetName.ts\"\nimport { CanvasNode } from \"./CanvasNode.ts\"\nimport type { ChildList } from \"./ChildList.ts\"\nimport { setDefaults } from \"./MutableNode.ts\"\n\nexport const LOCAL_MODULES_LIST_ID = \"localModules\"\n\n/**\n * This node type represents the list of all the local modules used in the project. This node can\n * only be a child of the RootNode.\n */\nexport class LocalModulesListNode extends withClassDiscriminator(\"LocalModulesListNode\", CanvasNode) {\n\t/**\n\t * We are using a static value here to make sure our multiplayer protocol\n\t * always resolves to this one node and creates it if it doesn't exist.\n\t */\n\tdeclare readonly id: \"localModules\"\n\n\tdeclare children: ChildList<LocalModuleNode>\n\n\tconstructor(properties?: Partial<LocalModulesListNode>) {\n\t\tconst propsWithId = { ...properties, id: LOCAL_MODULES_LIST_ID } as const\n\t\tsuper(propsWithId)\n\t\tthis.assign(propsWithId)\n\t}\n\n\tstatic get(tree: CanvasTree) {\n\t\treturn tree.get<LocalModulesListNode>(LOCAL_MODULES_LIST_ID)\n\t}\n\n\tstatic getModuleNodes(tree: CanvasTree) {\n\t\tconst listNode = LocalModulesListNode.get(tree)\n\t\treturn listNode?.children.toArray() ?? emptyArray()\n\t}\n}\n\nexport interface ModuleSaveData {\n\t/** The treeVersion when the client started producing the new module data. Used to resolve\n\t * racing clients trying to update the same local module. Instead of \"last/slowest writer wins\",\n\t * this makes it \"most up to date writer wins\". */\n\ttreeVersion: number\n\t/**\n\t * The moduleRevision of the source node of the module at the time its\n\t * source code was generated.\n\t */\n\tsourceRevision?: number\n\n\t// moduleId and saveId together uniquely identify produced code that was compiled and processed\n\t// and uploaded to the backend.\n\tmoduleId: string\n\tsaveId: string\n\n\t/** ModulesAPI.Imports.relative. */\n\timports?: readonly string[]\n\n\t// Title, name, and type are captured to show asset information in the UI without downloading the module.\n\ttitle: string\n\t// Ideally, `name` should always be a string, but due to legacy trees that may still contain `null`,\n\t// we allow it here to prevent potential crashes until all trees are migrated.\n\tname: string | null\n\ttype: string\n\tannotations?: ParsedModuleAnnotations\n\n\t/** See `ModuleMetadata.PluginId`. */\n\tpluginId?: string\n}\n\nconst emptySaveData: Readonly<ModuleSaveData> = {\n\ttreeVersion: 0,\n\tmoduleId: \"\",\n\tsaveId: \"\",\n\ttitle: \"\",\n\tname: \"\",\n\ttype: \"\",\n}\n\n/**\n * Represents a local module used in the project. This node can only be a child of the\n * LocalModulesListNode.\n */\nexport class LocalModuleNode extends withClassDiscriminator(\"LocalModuleNode\", CanvasNode) implements WithGetName {\n\tdeclare children?: never\n\n\t/**\n\t * `localId` of the corresponding module\n\t */\n\tdeclare readonly id: string\n\n\t/**\n\t * The save data.\n\t */\n\tdeclare save: Readonly<ModuleSaveData>\n\n\tconstructor(properties?: Partial<LocalModuleNode>) {\n\t\tsuper(properties)\n\t\tsetDefaults<LocalModuleNode>(this, { save: emptySaveData }, properties)\n\t\tdelete this.children // See comment in `MutableNode.ts`\n\t}\n\n\tgetName() {\n\t\tconst shouldUseSaveName = this.save.type === ModuleType.Code || this.save.type === ModuleType.Shader\n\t\tconst correctName = shouldUseSaveName ? this.save.name : this.save.title\n\t\treturn correctName ? getNameFromPath(correctName) : Dictionary.Unknown\n\t}\n}\n\nexport function isLocalModulesListNode<T>(node: T): node is T & LocalModulesListNode {\n\treturn node instanceof LocalModulesListNode\n}\n\nexport function isLocalModuleNode<T>(node: T): node is T & LocalModuleNode {\n\treturn node instanceof LocalModuleNode\n}\n", "import { assert, List } from \"@framerjs/shared\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\ttype ArrayItemVariableDefinition,\n\ttype ArrayVariableDefinition,\n\ttype VariableDefinition,\n\ttype VariableID,\n\ttype VariableOrDivider,\n\ttype WithVariables,\n\tisArrayVariable,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { SelectedVariablePath } from \"document/stores/VariablesStore.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\n\nexport interface SelectedVariableInfo {\n\tnodeWithVariables: CanvasNode & WithVariables\n\tselectedVariableParent: ArrayVariableDefinition | null\n\tselectedVariable: VariableOrDivider | null\n}\n\nexport function getSelectedVariableInfo(\n\tnodeWithVariables: (CanvasNode & WithVariables) | null,\n\tselectedVariablePath: SelectedVariablePath | null,\n\ttemporaryVariable: VariableDefinition | null,\n): SelectedVariableInfo | null {\n\tif (!nodeWithVariables) return null\n\n\tif (temporaryVariable) {\n\t\treturn {\n\t\t\tnodeWithVariables,\n\t\t\tselectedVariableParent: null,\n\t\t\tselectedVariable: temporaryVariable,\n\t\t}\n\t}\n\n\tconst selectedVariableId = selectedVariablePath?.at(0)\n\n\tif (selectedVariablePath && selectedVariablePath.length === 2) {\n\t\tconst [variableId, arrayItemVariableId] = selectedVariablePath\n\t\tassert(variableId, \"Variable ID is required\")\n\n\t\t// Only return the item variable ID if the selected variable can be found.\n\t\tconst arrayVariable = findVariableWithId(nodeWithVariables.variables, variableId)\n\t\tif (arrayVariable && isArrayVariable(arrayVariable)) {\n\t\t\tconst selectedItemVariable = findVariableWithId(arrayVariable.itemVariables, arrayItemVariableId)\n\t\t\tif (selectedItemVariable) {\n\t\t\t\treturn {\n\t\t\t\t\tnodeWithVariables,\n\t\t\t\t\tselectedVariableParent: arrayVariable,\n\t\t\t\t\tselectedVariable: selectedItemVariable,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst firstItemVariable = arrayVariable.itemVariables.at(0)\n\t\t\treturn {\n\t\t\t\tnodeWithVariables,\n\t\t\t\tselectedVariableParent: arrayVariable,\n\t\t\t\tselectedVariable: firstItemVariable ?? null,\n\t\t\t}\n\t\t}\n\t}\n\n\tconst selectedVariable = findVariableWithId(nodeWithVariables.variables, selectedVariableId)\n\tconst firstVariable = nodeWithVariables.variables.at(0)\n\n\treturn {\n\t\tnodeWithVariables,\n\t\tselectedVariableParent: null,\n\t\tselectedVariable: selectedVariable ?? firstVariable ?? null,\n\t}\n}\n\nexport function getVariableListFromVariableParent(\n\tnodeWithVariables: CanvasNode & WithVariables,\n\tvariableParentId: VariableID,\n): readonly ArrayItemVariableDefinition[] | null {\n\tconst arrayVariable = findVariableWithId(nodeWithVariables.variables, variableParentId)\n\treturn arrayVariable?.type === ControlType.Array ? arrayVariable.itemVariables : null\n}\n\nexport function updateVariableListInVariableParent(\n\tnodeWithVariables: CanvasNode & WithVariables,\n\tvariableParentId: VariableID,\n\tarrayItemVariables: readonly ArrayItemVariableDefinition[],\n): void {\n\tconst indexOfArrayVariable = nodeWithVariables.variables.findIndex(({ id }) => id === variableParentId)\n\tconst arrayVariable = nodeWithVariables.variables[indexOfArrayVariable]\n\tif (arrayVariable?.type !== ControlType.Array) return\n\n\tconst newArrayVariable: ArrayVariableDefinition = { ...arrayVariable, itemVariables: arrayItemVariables }\n\tconst newVariables = List.replace(nodeWithVariables.variables, indexOfArrayVariable, newArrayVariable)\n\tnodeWithVariables.set({ variables: newVariables })\n}\n\nexport function getSelectedVariablePathFromInfo(\n\tinfo: SelectedVariableInfo | null,\n): readonly [VariableID] | readonly [VariableID, VariableID] | null {\n\tif (!info || !info.selectedVariable) return null\n\tif (info.selectedVariableParent) return [info.selectedVariableParent.id, info.selectedVariable.id]\n\treturn [info.selectedVariable.id]\n}\n\nfunction findVariableWithId(variables: readonly VariableOrDivider[], variableId: VariableID | undefined | null) {\n\tif (!variableId) return undefined\n\treturn variables.find(variable => variable.id === variableId)\n}\n", "import type { SortingOrder } from \"document/models/CanvasTree/nodes/CollectionNode.ts\"\n\nconst naturalSortCollator = new Intl.Collator(undefined, { numeric: true, sensitivity: \"base\" })\n\nexport const compareStringsNaturally = (a: string, b: string, direction: SortingOrder = \"ascending\") =>\n\tdirection === \"ascending\" ? naturalSortCollator.compare(a, b) : naturalSortCollator.compare(b, a)\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport { AnnotationKey } from \"@framerjs/framer-runtime/crossorigin\"\nimport type { ExportSpecifier } from \"@framerjs/framer-runtime/crossorigin\"\nimport {\n\ttype GlobalModuleId,\n\ttype LocalModuleExportIdentifierString,\n\ttype LocalModuleId,\n\ttype ModuleExportIdentifier,\n\ttype ModuleExportIdentifierString,\n\ttype ModuleIdentifierString,\n\tModuleType,\n\tasGlobalId,\n\tasLocalId,\n\tassertNever,\n\tgetServiceMap,\n\tisEmptyObject,\n\tisLocalModuleIdentifier,\n\tisMixed,\n\tisModuleExportIdentifier,\n\tlocalModuleIdentifier,\n\tlocalModuleIdentifierForStableName,\n\tparseModuleIdentifier,\n} from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport {\n\ttype FramerVectorInfo,\n\ttype FramerVectorSetInfo,\n\ttype VectorColor,\n\tisFramerVectorInfo,\n\tisFramerVectorSetInfo,\n\tisFramerVectorSetsInfo,\n\tparseIntrinsicSizeFromAnnotations,\n} from \"code-generation/utils/annotations.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport {\n\ttype SelectedVariableInfo,\n\tgetSelectedVariableInfo,\n} from \"document/components/chrome/shared/VariablesModal/getSelectedVariableInfo.ts\"\nimport type { CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport {\n\ttype ExternalModuleNode,\n\tExternalModulesListNode,\n} from \"document/models/CanvasTree/nodes/ExternalModuleNode.ts\"\nimport { LocalModulesListNode, isLocalModuleNode } from \"document/models/CanvasTree/nodes/LocalModuleNode.ts\"\nimport type { AnyVectorSetNode } from \"document/models/CanvasTree/nodes/VectorSetNode.ts\"\nimport {\n\tisExternalModuleNode,\n\tisVectorInstance,\n\tisVectorSetNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { CombinedVariableProviderValueMap } from \"document/models/CanvasTree/traits/VariableProvider.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { withCodeComponent } from \"document/models/CanvasTree/traits/WithCodeComponent.ts\"\nimport type { WithControlProps } from \"document/models/CanvasTree/traits/WithControlProps.ts\"\nimport type { VectorSetItemVariableDefinition, WithVariables } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { IsVectorSetItem } from \"document/models/CanvasTree/traits/WithVectorSetItem.ts\"\nimport { type Reduced, isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ModulesStore } from \"document/stores/ModulesStore.ts\"\nimport type { VectorsStore } from \"document/stores/VectorsStore.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport { ControlType, type VectorSetItemControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport type { ModuleHandle } from \"modules/ModulesStorage.ts\"\nimport type { ClipboardModuleData } from \"./clipboard/helpers/types.ts\"\nimport { compareStringsNaturally } from \"./compareStringsNaturally.ts\"\nimport { isPromise, isString, isUndefined } from \"./typeChecks.ts\"\n\nconst vectorExportSpecifier: ExportSpecifier = \"default\"\n\n/**\n * Determine the default identifier for a Vector Set Property Control.\n */\nexport function defaultIdentifierForControl(\n\tcontrol: VectorSetItemControlDescription,\n\ttree: CanvasTree,\n\tmodulesStore: ModulesStore,\n): ModuleExportIdentifierString | undefined {\n\t// If the control default value identifier is a local module in the project, it's safe to use\n\t// the local identifier.\n\tconst parsed = parseModuleIdentifier(control.defaultValue.identifier)\n\tif (isLocalModuleIdentifier(parsed)) {\n\t\tconst localModuleNode = tree.getNodeWithTrait(parsed.localId, isLocalModuleNode)\n\t\tif (localModuleNode) return control.defaultValue.identifier as LocalModuleExportIdentifierString\n\t}\n\n\t// If the control default value id is an external module, it's safe to use the external module\n\t// with that global id.\n\tconst externalModuleNode = tree.getNodeWithTrait(control.defaultValue.moduleId, isExternalModuleNode)\n\tif (externalModuleNode) return externalModuleNode.codeComponentIdentifier\n\n\t// If the default Vector is not available as a local or external module, but the Vector Set is\n\t// an external module, try to use the first available external Vector from the set info.\n\tconst externalSetModule = tree.getNodeWithTrait(control.setModuleId, isExternalModuleNode)\n\tif (externalSetModule) {\n\t\tconst setInfo = externalSetModule.annotation(AnnotationKey.FramerVectorSet)\n\t\tif (isFramerVectorSetInfo(setInfo)) {\n\t\t\t// Find the first item that has an external module.\n\t\t\tfor (const item of setInfo.items) {\n\t\t\t\tconst module = tree.getNodeWithTrait(item.moduleId, isExternalModuleNode)\n\t\t\t\tif (module) return module.codeComponentIdentifier\n\t\t\t}\n\t\t}\n\t}\n\n\t// Finally, if the Vector Set is not an external module, check if its a local module that is\n\t// just not yet available in the tree.\n\tconst localSetModule = modulesStore.getPersistedModuleByGlobalId(asGlobalId(control.setModuleId))\n\tif (!localSetModule) return\n\n\tconst module = modulesStore.forType(ModuleType.VectorSet).getByLocalId(localSetModule.localId)\n\tconst setInfo = module.annotations(null, vectorExportSpecifier)?.[AnnotationKey.FramerVectorSet]\n\tif (!isFramerVectorSetInfo(setInfo)) return\n\n\t// If the Vector Set is a local module, use the first available local module Vector from the set\n\t// info.\n\tconst firstItem = setInfo.items?.[0]\n\tif (!firstItem) return\n\n\treturn localModuleIdentifierForStableName(ModuleType.Vector, firstItem.id, vectorExportSpecifier)?.value\n}\n\n/**\n * When a Smart Component instance with a Vector Set control is pasted into an external project, the\n * values for the control will be a local module identifier that does not exist in the external\n * project. We can map to the external identifier and render the expected Vector.\n */\nexport function projectVectorSetIdentifier(\n\ttree: CanvasTree | undefined,\n\tcontrol: VectorSetItemControlDescription,\n\tidentifier: ModuleExportIdentifierString,\n): ModuleExportIdentifierString | undefined {\n\tconst parsed = parseModuleIdentifier(identifier)\n\n\tif (isLocalModuleIdentifier(parsed)) {\n\t\tif (!tree) return undefined\n\t\tconst localModuleNode = tree.getNodeWithTrait(parsed.localId, isLocalModuleNode)\n\t\tif (localModuleNode) return identifier\n\n\t\tconst set = tree.getNodeWithTrait(control.setModuleId, isExternalModuleNode)\n\t\tif (!set) return undefined\n\n\t\tconst setInfo = set.annotation(AnnotationKey.FramerVectorSet)\n\t\tif (!isFramerVectorSetInfo(setInfo)) return undefined\n\n\t\tconst info = setInfo.items.find(item => item.id === parsed.localIdName)\n\t\tif (!info) return undefined\n\n\t\tconst module = tree.getNodeWithTrait(info.moduleId, isExternalModuleNode)\n\t\treturn module?.codeComponentIdentifier\n\t}\n\n\treturn identifier\n}\n\nfunction identifierOrDefault(\n\tidentifier: Reduced<ModuleExportIdentifierString>,\n\ttree: CanvasTree,\n\tmodulesStore: ModulesStore,\n\tcontrol?: VectorSetItemControlDescription,\n): ModuleExportIdentifierString | undefined {\n\tif (isMixed(identifier) || isNotFound(identifier) || isUndefined(identifier)) {\n\t\t// If no control is provided, we can't create a variable, since we don't know the initial\n\t\t// value.\n\t\tif (!control) return\n\t\treturn defaultIdentifierForControl(control, tree, modulesStore)\n\t}\n\n\treturn identifier\n}\n\nexport function infoForVariableCreate(\n\tidentifier: Reduced<ModuleExportIdentifierString>,\n\ttree: CanvasTree,\n\tmodulesStore: ModulesStore,\n\t/**\n\t * When creating a variable for an existing Property Control, the control default value can be\n\t * used as a Variable Reference initial value if the identifier is Mixed.\n\t */\n\tcontrol?: VectorSetItemControlDescription,\n): Pick<VectorSetItemVariableDefinition, \"initialValue\" | \"setModuleId\"> | undefined {\n\tconst identifierWithDefault = identifierOrDefault(identifier, tree, modulesStore, control)\n\tif (!identifierWithDefault) return\n\n\tconst parsed = parseModuleIdentifier(identifierWithDefault)\n\tswitch (parsed.kind) {\n\t\tcase \"externalModuleExport\": {\n\t\t\tconst module = tree.getNodeWithTrait(parsed.moduleId, isExternalModuleNode)\n\t\t\tconst vectorInfo = module?.annotation(AnnotationKey.FramerVector)\n\t\t\tif (!module || !isFramerVectorInfo(vectorInfo)) return\n\n\t\t\treturn {\n\t\t\t\tsetModuleId: vectorInfo.set.moduleId,\n\t\t\t\tinitialValue: {\n\t\t\t\t\tidentifier: identifierWithDefault,\n\t\t\t\t\tmoduleId: asGlobalId(module.id),\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t\tcase \"localModuleExport\": {\n\t\t\tconst module = modulesStore.forType(ModuleType.Vector).getByStableName(parsed.localIdName)\n\t\t\tconst vectorInfo = module.annotations(null, vectorExportSpecifier)?.[AnnotationKey.FramerVector]\n\t\t\tif (!isFramerVectorInfo(vectorInfo)) return\n\n\t\t\tconst setModule = modulesStore.forType(ModuleType.VectorSet).getByLocalId(vectorInfo.set.localId)\n\t\t\tif (!setModule.isValid()) return\n\n\t\t\treturn {\n\t\t\t\tsetModuleId: setModule.id,\n\t\t\t\tinitialValue: {\n\t\t\t\t\tidentifier: identifierWithDefault,\n\t\t\t\t\tmoduleId: module.id,\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(parsed)\n\t}\n}\n\nexport function vectorSetIdentifierForVectorInfo(\n\tinfo: FramerVectorInfo,\n\ttree: CanvasTree,\n\tmodulesStore: ModulesStore,\n): ModuleExportIdentifierString | undefined {\n\tconst externalSet = tree.getNodeWithTrait(info.set.moduleId, isExternalModuleNode)\n\tif (externalSet) return externalSet.codeComponentIdentifier\n\n\tconst localSet = modulesStore.forType(ModuleType.VectorSet).getByLocalId(info.set.localId)\n\tif (localSet.isValid()) return localModuleIdentifier(localSet.localId, vectorExportSpecifier).value\n}\n\nexport function vectorSetIdentifierForGlobalModuleId(\n\tmoduleId: GlobalModuleId,\n\ttree: CanvasTree,\n\tmodulesStore: ModulesStore,\n): ModuleExportIdentifierString | undefined {\n\tconst localSet = modulesStore.getPersistedModuleByGlobalId(moduleId)\n\tif (localSet) return localModuleIdentifier(localSet.localId, vectorExportSpecifier).value\n\n\tconst externalSet = tree.getNodeWithTrait(moduleId, isExternalModuleNode)\n\tif (externalSet) return externalSet.codeComponentIdentifier\n}\n\nexport function vectorInfoForIdentifier(\n\tidentifier: ModuleExportIdentifier,\n\ttree: CanvasTree,\n\tmodulesStore: ModulesStore,\n\tvectorsStore?: VectorsStore,\n): FramerVectorInfo | undefined {\n\tswitch (identifier.kind) {\n\t\tcase \"externalModuleExport\": {\n\t\t\tconst module = tree.getNodeWithTrait(identifier.moduleId, isExternalModuleNode)\n\t\t\tconst value = module?.annotation(AnnotationKey.FramerVector)\n\t\t\treturn isFramerVectorInfo(value) ? value : undefined\n\t\t}\n\t\tcase \"localModuleExport\": {\n\t\t\tconst module = modulesStore.forType(identifier.type).getByStableName(identifier.localIdName)\n\t\t\tconst value = module.annotations(null, vectorExportSpecifier)?.[AnnotationKey.FramerVector]\n\t\t\tif (!isFramerVectorInfo(value)) return undefined\n\t\t\tconst cached = vectorsStore?.getByGlobalId(module.id)\n\t\t\tconst color = !isPromise(cached) ? cached?.color : undefined\n\t\t\treturn {\n\t\t\t\t...value,\n\t\t\t\tcolor: color ?? value.color,\n\t\t\t\tset: {\n\t\t\t\t\t...value.set,\n\t\t\t\t\tmoduleId: modulesStore.forType(ModuleType.VectorSet).getByLocalId(value.set.localId).id,\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(identifier)\n\t}\n}\n\nfunction vectorSetsForModuleIdentifier(\n\tidentifier: ModuleExportIdentifier,\n\ttree: CanvasTree,\n\tmodulesStore: ModulesStore,\n): GlobalModuleId[] | undefined {\n\tswitch (identifier.kind) {\n\t\tcase \"externalModuleExport\": {\n\t\t\tconst module = tree.getNodeWithTrait(identifier.moduleId, isExternalModuleNode)\n\t\t\tconst value = module?.annotation(AnnotationKey.FramerVectorSets)\n\t\t\treturn isFramerVectorSetsInfo(value) ? value : undefined\n\t\t}\n\t\tcase \"localModuleExport\": {\n\t\t\tconst module = modulesStore.forType(identifier.type).getByLocalId(identifier.localId)\n\t\t\tconst value = module.annotations(null, vectorExportSpecifier)?.[AnnotationKey.FramerVectorSets]\n\t\t\treturn isFramerVectorSetsInfo(value) ? value : undefined\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(identifier)\n\t}\n}\n\n/**\n * Smart Components can expose a ControlType.VectorSet control. When components with this control\n * are pasted into an external project, we need to import the VectorSet and the set Vectors. To make\n * this easier, these components have an annotation that lists the global ids of the set.\n *\n * For each Set in the current project, we collect external identifiers for the set and items into\n * the clipboard data.\n */\nfunction vectorSetIdentifiersForModuleIdentifier(\n\tidentifier: ModuleExportIdentifier,\n\ttree: CanvasTree,\n\tmodulesStore: ModulesStore,\n\tseenVectorSets: Set<GlobalModuleId>,\n): ClipboardModuleData | undefined {\n\tconst vectorSets = vectorSetsForModuleIdentifier(identifier, tree, modulesStore)\n\tif (isUndefined(vectorSets)) return\n\n\tconst result: ClipboardModuleData = {}\n\tfor (const globalModuleId of vectorSets) {\n\t\tif (seenVectorSets.has(globalModuleId)) continue\n\t\tseenVectorSets.add(globalModuleId)\n\n\t\t// First check if the global id corresponds to an external module.\n\t\tconst externalModule = tree.getNodeWithTrait(globalModuleId, isExternalModuleNode)\n\t\tif (externalModule) {\n\t\t\tcollectClipboardModuleDataForExternalVectorSet(externalModule, tree, result)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Otherwise try to find the local module for the global id.\n\t\tconst localModule = modulesStore.getPersistedModuleByGlobalId(globalModuleId)\n\t\tif (!localModule) continue\n\n\t\tconst handle = modulesStore.forType(ModuleType.VectorSet).getByLocalId(localModule.localId)\n\t\tcollectClipboardModuleDataForLocalVectorSet(handle, modulesStore, result)\n\t}\n\n\treturn result\n}\n\nexport function externalVectorSetInfo(tree: CanvasTree, vectorSetModuleId: NodeID) {\n\tconst set = tree.getNodeWithTrait(vectorSetModuleId, isExternalModuleNode)\n\tconst value = set?.annotation(AnnotationKey.FramerVectorSet)\n\treturn isFramerVectorSetInfo(value) ? value : undefined\n}\n\nexport function localVectorSetInfo(\n\tmodulesStore: ModulesStore,\n\tvectorSetLocalId: LocalModuleId,\n): FramerVectorSetInfo | undefined {\n\tconst set = modulesStore.forType(ModuleType.VectorSet).getByLocalId(vectorSetLocalId)\n\tconst value = set.annotations(null, vectorExportSpecifier)?.[AnnotationKey.FramerVectorSet]\n\tif (!isFramerVectorSetInfo(value)) return undefined\n\treturn {\n\t\t...value,\n\t\titems: value.items.map(item => ({\n\t\t\t...item,\n\t\t\tmoduleId: modulesStore.forType(ModuleType.Vector).getByStableName(item.id).id,\n\t\t})),\n\t}\n}\n\nexport function vectorSetInfoForIdentifier(\n\tidentifier: ModuleExportIdentifier,\n\tinfo: FramerVectorInfo,\n\ttree: CanvasTree,\n\tmodulesStore: ModulesStore,\n): FramerVectorSetInfo | undefined {\n\tswitch (identifier.kind) {\n\t\tcase \"externalModuleExport\":\n\t\t\treturn externalVectorSetInfo(tree, info.set.moduleId)\n\t\tcase \"localModuleExport\":\n\t\t\treturn localVectorSetInfo(modulesStore, info.set.localId)\n\t\tdefault:\n\t\t\tassertNever(identifier)\n\t}\n}\n\nexport interface VectorSetInfo {\n\tname: string\n\tmoduleId: GlobalModuleId\n}\n\nexport function getVectorSetInfo(\n\tmodulesStore: ModulesStore,\n\ttree: CanvasTree,\n\tidentifier: string,\n): VectorSetInfo | undefined {\n\tif (!isModuleExportIdentifier(identifier)) return\n\tconst parsed = parseModuleIdentifier(identifier)\n\tif (!parsed) return\n\n\tconst vector = vectorInfoForIdentifier(parsed, tree, modulesStore)\n\tif (!vector) return\n\n\tconst vectorSet = vectorSetInfoForIdentifier(parsed, vector, tree, modulesStore)\n\tif (!vectorSet) return\n\n\treturn { name: vectorSet.name, moduleId: vector.set.moduleId }\n}\n\nexport function defaultIdentifierForLocalVectorSet(\n\tid: NodeID,\n\tmodulesStore: ModulesStore,\n): ModuleExportIdentifierString | undefined {\n\tconst set = modulesStore.forType(ModuleType.VectorSet).getByStableName(id)\n\tconst value = set.annotations(null, vectorExportSpecifier)?.[AnnotationKey.FramerVectorSet]\n\tif (!isFramerVectorSetInfo(value)) return\n\n\tconst firstItem = value.items[0]\n\tif (!firstItem) return\n\n\treturn localModuleIdentifierForStableName(ModuleType.Vector, firstItem.id, vectorExportSpecifier).value\n}\n\nfunction collectClipboardModuleDataForExternalVectorSet(\n\tset: ExternalModuleNode,\n\ttree: CanvasTree,\n\tresult: ClipboardModuleData,\n): ClipboardModuleData {\n\tconst annotations = set.annotation(AnnotationKey.FramerVectorSet)\n\tif (!set || !isFramerVectorSetInfo(annotations)) return result\n\n\t// Add the set to the result.\n\tresult[set.codeComponentIdentifier] = parseModuleIdentifier(set.codeComponentIdentifier)\n\n\t// Add the set items to the result.\n\tfor (const item of annotations.items) {\n\t\t// Only add the item if it's an existing external module. Vectors should always be updated\n\t\t// at the same time a set is updated.\n\t\tconst module = tree.getNodeWithTrait(item.moduleId, isExternalModuleNode)\n\t\tif (module) result[module.codeComponentIdentifier] = parseModuleIdentifier(module.codeComponentIdentifier)\n\t}\n\n\treturn result\n}\n\nfunction collectClipboardModuleDataForLocalVectorSet(\n\tset: ModuleHandle<ModuleType.VectorSet>,\n\tmodulesStore: ModulesStore,\n\tresult: ClipboardModuleData,\n): ClipboardModuleData {\n\tconst annotations = set.annotations(null, vectorExportSpecifier)?.[AnnotationKey.FramerVectorSet]\n\tif (!isFramerVectorSetInfo(annotations)) return result\n\n\tconst localIdentifier = localModuleIdentifier(set.localId, vectorExportSpecifier).value\n\tresult[localIdentifier] = set.externalModuleIdentifier(vectorExportSpecifier)\n\n\tfor (const item of annotations.items) {\n\t\tconst handle = modulesStore.forType(ModuleType.Vector).getByStableName(item.id)\n\t\tif (!handle.isValid()) continue\n\n\t\tconst localIdentifier = localModuleIdentifierForStableName(ModuleType.Vector, item.id, vectorExportSpecifier).value\n\t\tresult[localIdentifier] = handle.externalModuleIdentifier(vectorExportSpecifier)\n\t}\n\n\treturn result\n}\n\nexport function vectorSetIdentifiersForClipboard(\n\tidentifier: ModuleExportIdentifierString,\n\ttree: CanvasTree,\n\tmodulesStore: ModulesStore,\n\tseenVectorSets: Set<GlobalModuleId>,\n) {\n\tconst parsed = parseModuleIdentifier(identifier)\n\tconst vectorInfo = vectorInfoForIdentifier(parsed, tree, modulesStore)\n\n\t// If the module is not a Vector instance, if it's a Component that has Vector Set controls, add\n\t// those Vector Sets.\n\tif (isUndefined(vectorInfo)) {\n\t\treturn vectorSetIdentifiersForModuleIdentifier(parsed, tree, modulesStore, seenVectorSets)\n\t}\n\n\tif (seenVectorSets.has(vectorInfo.set.moduleId)) return\n\tseenVectorSets.add(vectorInfo.set.moduleId)\n\n\tconst result: ClipboardModuleData = {}\n\n\t// Otherwise add the Set and all the items in the set to the result.\n\tswitch (parsed.kind) {\n\t\tcase \"externalModuleExport\": {\n\t\t\tconst set = tree.getNodeWithTrait(vectorInfo.set.moduleId, isExternalModuleNode)\n\t\t\tif (!set) return result\n\t\t\treturn collectClipboardModuleDataForExternalVectorSet(set, tree, result)\n\t\t}\n\t\tcase \"localModuleExport\": {\n\t\t\tconst set = modulesStore.forType(ModuleType.VectorSet).getByLocalId(vectorInfo.set.localId)\n\t\t\tif (!set.isValid()) return result\n\t\t\treturn collectClipboardModuleDataForLocalVectorSet(set, modulesStore, result)\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(parsed)\n\t}\n}\n\nexport interface VectorSetListItem {\n\tname: string\n\tmoduleId: GlobalModuleId\n\tmoduleIdentifier: ModuleExportIdentifierString\n\tsaveId: string\n\tcolor?: VectorColor\n}\n\nexport function itemsForIdentifier(\n\tidentifier: ModuleExportIdentifier,\n\tvectorSetInfo: FramerVectorSetInfo,\n\ttree: CanvasTree,\n\tmodulesStore: ModulesStore,\n\tvectorsStore: VectorsStore,\n) {\n\tconst items: Record<ModuleIdentifierString, VectorSetListItem> = {}\n\n\tfor (const item of vectorSetInfo.items) {\n\t\tswitch (identifier.kind) {\n\t\t\tcase \"externalModuleExport\": {\n\t\t\t\tconst module = tree.getNodeWithTrait(item.moduleId, isExternalModuleNode)\n\t\t\t\tif (!module) continue\n\n\t\t\t\tconst annotation = module.annotation(AnnotationKey.FramerVector)\n\t\t\t\t// Filter empty Vector Set Items from the list.\n\t\t\t\tif (!isFramerVectorInfo(annotation) || annotation.empty) continue\n\t\t\t\tconst saveId = parseModuleIdentifier(module.codeComponentIdentifier).saveId\n\n\t\t\t\titems[module.codeComponentIdentifier] = {\n\t\t\t\t\tmoduleId: item.moduleId,\n\t\t\t\t\tmoduleIdentifier: module.codeComponentIdentifier,\n\t\t\t\t\tname: annotation.name,\n\t\t\t\t\tsaveId,\n\t\t\t\t\tcolor: annotation.color,\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"localModuleExport\": {\n\t\t\t\tconst moduleIdentifier = localModuleIdentifierForStableName(\n\t\t\t\t\tModuleType.Vector,\n\t\t\t\t\titem.id,\n\t\t\t\t\tvectorExportSpecifier,\n\t\t\t\t)?.value\n\n\t\t\t\tconst handle = modulesStore.forType(ModuleType.Vector).getByStableName(item.id)\n\t\t\t\tif (!handle.isValid()) continue\n\n\t\t\t\tconst cached = vectorsStore.getByGlobalId(handle.id)\n\t\t\t\tconst cachedColor = !isPromise(cached) ? cached?.color : undefined\n\t\t\t\tconst annotation = handle.annotations(null, vectorExportSpecifier)?.[AnnotationKey.FramerVector]\n\t\t\t\t// Filter empty Vector Set Items from the list.\n\t\t\t\tif (!isFramerVectorInfo(annotation) || annotation.empty) continue\n\n\t\t\t\titems[moduleIdentifier] = {\n\t\t\t\t\tmoduleId: handle.id,\n\t\t\t\t\tmoduleIdentifier: moduleIdentifier,\n\t\t\t\t\tsaveId: handle.saveId,\n\t\t\t\t\tname: annotation.name,\n\t\t\t\t\tcolor: cachedColor ?? annotation.color,\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tassertNever(identifier)\n\t\t}\n\t}\n\n\treturn items\n}\n\nexport function vectorSetInfoForPopout(\n\tactiveIdentifier: Reduced<ModuleExportIdentifierString>,\n\tdefaultIdentifier: ModuleExportIdentifierString,\n\ttree: CanvasTree,\n\tmodulesStore: ModulesStore,\n\tvectorsStore: VectorsStore,\n) {\n\tconst identifier = isString(activeIdentifier) ? activeIdentifier : defaultIdentifier\n\tconst parsed = parseModuleIdentifier(identifier)\n\tconst vectorInfo = vectorInfoForIdentifier(parsed, tree, modulesStore, vectorsStore)\n\tif (isUndefined(vectorInfo)) return null\n\n\tconst vectorSetInfo = vectorSetInfoForIdentifier(parsed, vectorInfo, tree, modulesStore)\n\tif (isUndefined(vectorSetInfo)) return null\n\n\treturn {\n\t\tvectorSet: {\n\t\t\ttitle: vectorInfo.name,\n\t\t\tsetTitle: vectorSetInfo.name,\n\t\t\titems: itemsForIdentifier(parsed, vectorSetInfo, tree, modulesStore, vectorsStore),\n\t\t},\n\t\t// Provides a fallback to render in the UI if the selected vector is deleted in the source set.\n\t\tselectedItem: getSelectedVectorSetListItem(tree, modulesStore, identifier),\n\t\tcolor: vectorInfo.color,\n\t}\n}\n\nfunction getSelectedVectorSetListItem(\n\ttree: CanvasTree,\n\tmodulesStore: ModulesStore,\n\tidentifier: ModuleExportIdentifierString,\n): VectorSetListItem | undefined {\n\tconst parsed = parseModuleIdentifier(identifier)\n\n\tswitch (parsed.kind) {\n\t\tcase \"externalModuleExport\": {\n\t\t\tconst module = tree.getNodeWithTrait(parsed.moduleId, isExternalModuleNode)\n\t\t\tif (!module) return\n\t\t\treturn {\n\t\t\t\tname: module.title,\n\t\t\t\tmoduleId: asGlobalId(module.id),\n\t\t\t\tsaveId: parseModuleIdentifier(module.codeComponentIdentifier).saveId,\n\t\t\t\tmoduleIdentifier: identifier,\n\t\t\t}\n\t\t}\n\t\tcase \"localModuleExport\": {\n\t\t\tconst module = modulesStore.getPersistedModuleByLocalId(parsed.localId)\n\t\t\tif (!module) return\n\t\t\treturn {\n\t\t\t\tname: module.title,\n\t\t\t\tmoduleId: module.id,\n\t\t\t\tsaveId: module.saveId,\n\t\t\t\tmoduleIdentifier: identifier,\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(parsed)\n\t}\n}\n\n/**\n * Given a Vector Set Item node, return the latest SVG icon for the Vector.\n */\nexport async function iconForVectorSetItem(node: CanvasNode & IsVectorSetItem, engine: VekterEngine) {\n\tconst handle = engine.stores.modulesStore.forType(ModuleType.Vector).getByStableName(node.id)\n\tif (!handle.isValid()) return\n\n\tconst globalId = handle.id\n\tconst saveId = handle.saveId\n\tconst cached = engine.stores.vectorsStore.getByGlobalId(globalId)\n\tif (!isUndefined(cached)) {\n\t\tconst value = isPromise(cached) ? await cached : cached\n\t\treturn value.svg\n\t}\n\n\tconst response = await fetch(`${getServiceMap().modulesCDN}/${globalId}/${saveId}/icon.svg`)\n\tif (!response.ok) return\n\treturn response.text()\n}\n\nexport function getProjectVectorSetVariableCreateMenuOptions(\n\tengine: VekterEngine,\n\tnodeWithVariables: CanvasNode & WithVariables,\n\treadonly: boolean,\n\tcreateVariable: ({\n\t\tname,\n\t\tsetModuleId,\n\t\tinitialValue,\n\t\tinsertAfterVariable,\n\t}: Pick<VectorSetItemVariableDefinition, \"initialValue\" | \"setModuleId\"> & {\n\t\tname: string\n\t\tinsertAfterVariable: SelectedVariableInfo | null\n\t}) => void,\n) {\n\tconst project: MenuItemOptions[] = []\n\tfor (const node of engine.tree.root.children) {\n\t\tif (!isVectorSetNode(node)) continue\n\n\t\tconst parsed = parseModuleIdentifier(node.instanceIdentifier)\n\t\tconst module = engine.stores.modulesStore.forType(ModuleType.VectorSet).getByLocalId(parsed.localId)\n\t\tif (!module.isValid()) continue\n\n\t\tconst value = module.annotations(null, vectorExportSpecifier)?.[AnnotationKey.FramerVectorSet]\n\t\tif (!isFramerVectorSetInfo(value)) continue\n\n\t\tconst firstItem = value.items[0]\n\t\tif (!firstItem) continue\n\n\t\tconst firstItemModule = engine.stores.modulesStore.forType(ModuleType.Vector).getByStableName(firstItem.id)\n\t\tif (!firstItemModule.isValid()) continue\n\n\t\tconst name = node.resolveValue(\"name\") ?? Dictionary.VectorSet\n\n\t\tproject.push({\n\t\t\tlabel: name,\n\t\t\tenabled: !readonly,\n\t\t\tclick: () =>\n\t\t\t\tcreateVariable({\n\t\t\t\t\tname,\n\t\t\t\t\tsetModuleId: module.id,\n\t\t\t\t\tinitialValue: {\n\t\t\t\t\t\tidentifier: localModuleIdentifierForStableName(ModuleType.Vector, firstItem.id, vectorExportSpecifier)\n\t\t\t\t\t\t\t.value,\n\t\t\t\t\t\tmoduleId: firstItemModule.id,\n\t\t\t\t\t},\n\t\t\t\t\tinsertAfterVariable: getSelectedVariableInfo(\n\t\t\t\t\t\tnodeWithVariables,\n\t\t\t\t\t\tengine.stores.variablesStore.selectedVariablePath,\n\t\t\t\t\t\tnull,\n\t\t\t\t\t),\n\t\t\t\t}),\n\t\t})\n\t}\n\n\tconst externalModules = ExternalModulesListNode.get(engine.tree)\n\tif (!externalModules?.children) return project\n\n\tconst folders: Record<string, MenuItemOptions[]> = {}\n\tconst folderNames: Record<string, string> = {}\n\tfor (const node of externalModules.children) {\n\t\tif (node.type !== ModuleType.VectorSet) continue\n\n\t\tconst value = node?.annotation(AnnotationKey.FramerVectorSet)\n\t\tif (!isFramerVectorSetInfo(value)) continue\n\n\t\tconst firstItem = value.items[0]\n\t\tif (!firstItem) continue\n\n\t\tconst vector = engine.tree.getNodeWithTrait(firstItem.moduleId, isExternalModuleNode)\n\t\tif (!vector) continue\n\n\t\tconst folderId = node.group?.id ?? Dictionary.Other\n\n\t\tfolderNames[folderId] ??= node.group?.name ?? Dictionary.Other\n\n\t\tconst folder = folders[folderId] ?? []\n\n\t\tconst name = node.getName() ?? Dictionary.VectorSet\n\n\t\tfolder.push({\n\t\t\tlabel: name,\n\t\t\tenabled: !readonly,\n\t\t\tclick: () =>\n\t\t\t\tcreateVariable({\n\t\t\t\t\tname,\n\t\t\t\t\tsetModuleId: asGlobalId(node.id),\n\t\t\t\t\tinitialValue: {\n\t\t\t\t\t\tidentifier: vector.codeComponentIdentifier,\n\t\t\t\t\t\tmoduleId: firstItem.moduleId,\n\t\t\t\t\t},\n\t\t\t\t\tinsertAfterVariable: getSelectedVariableInfo(\n\t\t\t\t\t\tnodeWithVariables,\n\t\t\t\t\t\tengine.stores.variablesStore.selectedVariablePath,\n\t\t\t\t\t\tnull,\n\t\t\t\t\t),\n\t\t\t\t}),\n\t\t})\n\n\t\tfolders[folderId] = folder\n\t}\n\n\tif (isEmptyObject(folders)) return project\n\n\treturn [\n\t\t{ label: Dictionary.Project, submenu: project, visible: project.length > 0 },\n\t\t...Object.entries(folders)\n\t\t\t.map(([id, items]) => ({\n\t\t\t\tlabel: folderNames[id] ?? Dictionary.Other,\n\t\t\t\tsubmenu: items.sort((a, b) => {\n\t\t\t\t\treturn compareStringsNaturally(a.label ?? Dictionary.VectorSet, b.label ?? Dictionary.VectorSet)\n\t\t\t\t}),\n\t\t\t}))\n\t\t\t.sort((a, b) => compareStringsNaturally(a.label, b.label)),\n\t]\n}\n\nexport function componentUpdateForVectorSetItemControl(\n\tcontrol: VectorSetItemControlDescription,\n\ttree: CanvasTree,\n\tmodulesStore: ModulesStore,\n) {\n\tconst external = tree.getNodeWithTrait(control.setModuleId, isExternalModuleNode)\n\tif (external) {\n\t\tconst annotations = external.annotation(AnnotationKey.FramerVectorSet)\n\t\tif (!isFramerVectorSetInfo(annotations)) return\n\t\tconst firstItem = annotations.items[0]\n\t\tconst node = tree.getNodeWithTrait(firstItem?.moduleId, isExternalModuleNode)\n\t\tif (!node || !isModuleExportIdentifier(node.codeComponentIdentifier)) return\n\t\tconst size = node.annotations ? parseIntrinsicSizeFromAnnotations(node.annotations) : undefined\n\n\t\treturn {\n\t\t\twidth: size?.width ?? undefined,\n\t\t\theight: size?.height ?? undefined,\n\t\t\theightType: DimensionType.FixedNumber,\n\t\t\twidthType: DimensionType.FixedNumber,\n\t\t\tcodeComponentIdentifier: node.codeComponentIdentifier,\n\t\t}\n\t}\n\n\tconst localSetModule = modulesStore.getPersistedModuleByGlobalId(asGlobalId(control.setModuleId))\n\tif (!localSetModule) return\n\n\tconst module = modulesStore.forType(ModuleType.VectorSet).getByLocalId(localSetModule.localId)\n\tconst setInfo = module.annotations(null, vectorExportSpecifier)?.[AnnotationKey.FramerVectorSet]\n\tif (!isFramerVectorSetInfo(setInfo)) return\n\n\tconst firstItem = setInfo.items?.[0]\n\tif (!firstItem) return\n\n\tconst firstItemHandle = modulesStore.forType(ModuleType.Vector).getByStableName(firstItem.id)\n\tif (!firstItemHandle.isValid()) return\n\n\tconst identifier = localModuleIdentifierForStableName(ModuleType.Vector, firstItem.id, vectorExportSpecifier).value\n\tconst annotations = firstItemHandle.annotations(null, vectorExportSpecifier)\n\n\tconst size = annotations ? parseIntrinsicSizeFromAnnotations(annotations) : undefined\n\n\treturn {\n\t\twidth: size?.width ?? undefined,\n\t\theight: size?.height ?? undefined,\n\t\theightType: DimensionType.FixedNumber,\n\t\twidthType: DimensionType.FixedNumber,\n\t\tcodeComponentIdentifier: identifier,\n\t}\n}\n\nexport function getVectorSetItemControlPropIdentifiers(\n\tnode: CanvasNode & WithControlProps,\n\ttree: CanvasTree | undefined,\n\tidentifier: ModuleExportIdentifierString,\n\tcomponentLoader: AnyComponentLoader,\n\tvariableOverrides?: CombinedVariableProviderValueMap,\n): {\n\t[key: string]: ModuleExportIdentifierString | undefined\n} {\n\tconst result: { [key: string]: ModuleExportIdentifierString | undefined } = {}\n\n\tconst componentDefinition = componentLoader.reactComponentForIdentifier(identifier)\n\tif (!componentDefinition) return result\n\tconst { properties } = componentDefinition\n\tif (!properties) return result\n\n\tconst controlProps = node.getControlProps(componentDefinition.properties)\n\n\tfor (const propertyKey in properties) {\n\t\tconst control = properties[propertyKey]\n\t\tif (control?.type !== ControlType.VectorSetItem) continue\n\t\tconst prop = controlProps[propertyKey]\n\t\tif (!prop) continue\n\n\t\tconst identifier = isVariableReference(prop.value)\n\t\t\t? node.cache.getVariableReferenceValue(prop.value, variableOverrides)\n\t\t\t: prop.value\n\n\t\tif (!isString(identifier) || !isModuleExportIdentifier(identifier)) continue\n\n\t\tresult[propertyKey] = projectVectorSetIdentifier(tree, control, identifier)\n\t}\n\n\treturn result\n}\n\nexport function allVectorInstancesFromSameSet(\n\ttree: CanvasTree,\n\tnodes: CanvasNode[],\n\tmodulesStore: ModulesStore,\n): boolean {\n\tif (nodes.length === 0) return false\n\n\tlet commonVectorSetModuleId: string | undefined\n\n\tfor (const node of nodes) {\n\t\tif (!withCodeComponent(node) || !isVectorInstance(node)) {\n\t\t\treturn false\n\t\t}\n\n\t\tconst moduleIdentifier = parseModuleIdentifier(node.codeComponentIdentifier)\n\t\tif (!isModuleExportIdentifier(moduleIdentifier)) {\n\t\t\treturn false\n\t\t}\n\n\t\tconst info = vectorInfoForIdentifier(moduleIdentifier, tree, modulesStore)\n\t\tif (!info) {\n\t\t\treturn false\n\t\t}\n\n\t\tconst setModuleId = info.set.moduleId\n\t\tif (isUndefined(commonVectorSetModuleId)) {\n\t\t\tcommonVectorSetModuleId = setModuleId\n\t\t} else if (commonVectorSetModuleId !== setModuleId) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn isString(commonVectorSetModuleId)\n}\n\nexport function getVectorSetName(node: CanvasNode) {\n\tif (isExternalModuleNode(node)) {\n\t\treturn node.getName()\n\t}\n\n\tif (isVectorSetNode(node)) {\n\t\treturn node.resolveValue(\"name\") ?? Dictionary.Vector\n\t}\n\n\tthrow new Error(`Attempted to get the vector set name of a node of type: ${node.__class}`)\n}\n\n/**\n * Retrieves a set of all vector identifiers related to the given vector set id. Includes the set's own\n * identifier and identifiers of vector instances that exist in the project but were deleted from the vector set.\n */\nexport function getVectorSetIdentifiers(engine: VekterEngine, vectorSetOrModuleId: NodeID) {\n\tconst vectorSetOrModuleNode = engine.tree.get(vectorSetOrModuleId)\n\tif (!vectorSetOrModuleNode) return new Set<string>()\n\n\tif (isExternalModuleNode(vectorSetOrModuleNode)) {\n\t\treturn getExternalVectorSetIdentifiers(engine, vectorSetOrModuleNode)\n\t}\n\n\tif (isVectorSetNode(vectorSetOrModuleNode)) {\n\t\treturn getLocalVectorSetIdentifiers(engine, vectorSetOrModuleNode)\n\t}\n\n\tthrow new Error(`Attempted to get the vector set identifiers of a node of type: ${vectorSetOrModuleNode.__class}`)\n}\n\nfunction getLocalVectorSetIdentifiers(engine: VekterEngine, vectorSetNode: AnyVectorSetNode) {\n\tconst identifiers = new Set<string>()\n\tidentifiers.add(vectorSetNode.instanceIdentifier)\n\n\tLocalModulesListNode.getModuleNodes(engine.tree).forEach(node => {\n\t\tif (node.save.type !== ModuleType.Vector) return\n\t\tconst annotation = node.save.annotations?.default?.[AnnotationKey.FramerVector]\n\t\tif (!annotation || !isFramerVectorInfo(annotation)) return\n\t\tif (annotation.set.id !== vectorSetNode.id) return\n\t\tconst identifier = localModuleIdentifier(asLocalId(node.id), \"default\").value\n\t\tidentifiers.add(identifier)\n\t})\n\n\treturn identifiers\n}\n\nfunction getExternalVectorSetIdentifiers(engine: VekterEngine, vectorSetModuleNode: ExternalModuleNode) {\n\tconst identifiers = new Set<string>()\n\tidentifiers.add(vectorSetModuleNode.codeComponentIdentifier)\n\n\tExternalModulesListNode.getModuleNodes(engine.tree).forEach(node => {\n\t\tif (node.type !== ModuleType.Vector) return\n\t\tconst annotation = node.annotation(AnnotationKey.FramerVector)\n\t\tif (!annotation || !isFramerVectorInfo(annotation)) return\n\t\tif (annotation.set.moduleId !== vectorSetModuleNode.id) return\n\t\tidentifiers.add(node.codeComponentIdentifier)\n\t})\n\n\treturn identifiers\n}\n", "import type { VariableProviderMap } from \"../traits/VariableProvider.ts\"\nimport type { VariableID } from \"../traits/WithVariables.ts\"\n\nexport class MergedVariableProviderMap<Value> implements VariableProviderMap<Value> {\n\tconstructor(\n\t\tprivate readonly leftMap: VariableProviderMap<Value>,\n\t\tprivate readonly rightMap: VariableProviderMap<Value>,\n\t) {}\n\n\thas(variableId: VariableID): boolean {\n\t\tif (this.rightMap.has(variableId)) {\n\t\t\treturn true\n\t\t}\n\n\t\tif (this.leftMap.has(variableId)) {\n\t\t\treturn true\n\t\t}\n\n\t\treturn false\n\t}\n\n\tget(variableId: VariableID): Value | undefined {\n\t\tif (this.rightMap.has(variableId)) {\n\t\t\treturn this.rightMap.get(variableId)\n\t\t}\n\n\t\tif (this.leftMap.has(variableId)) {\n\t\t\treturn this.leftMap.get(variableId)\n\t\t}\n\n\t\treturn undefined\n\t}\n\n\t*[Symbol.iterator](): IterableIterator<[VariableID, Value]> {\n\t\tfor (const entry of this.leftMap) {\n\t\t\tconst variableId = entry[0]\n\t\t\tif (this.rightMap.has(variableId)) continue\n\t\t\tyield entry\n\t\t}\n\n\t\tyield* this.rightMap\n\t}\n}\n", "import type { VerifiedControlDescription } from \"@framerjs/framer-runtime\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { MergedVariableProviderMap } from \"document/models/CanvasTree/nodes/MergedVariableProviderMap.ts\"\nimport type {\n\tCombinedVariableProviderControlMap,\n\tCombinedVariableProviderValueMap,\n\tVariableProviderControlMap,\n\tVariableProviderValueMap,\n\tVariableProviderVariableMap,\n} from \"document/models/CanvasTree/traits/VariableProvider.ts\"\nimport {\n\ttype NumberVariableDefinition,\n\ttype VariableDefinition,\n\ttype VariableID,\n\tnumberControlDescription,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { EagerVariableProviderMap } from \"document/models/CanvasTree/traits/utils/EagerVariableProviderMap.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { ScopeType } from \"./scopeType.ts\"\n\nexport const repeaterItemIndexVariableId = \"repeater_item_index\"\nexport const repeaterItemCountVariableId = \"repeater_item_count\"\n\nconst repeaterItemIndexVariable: NumberVariableDefinition = {\n\tid: repeaterItemIndexVariableId,\n\tname: \"Item Index\",\n\ttype: ControlType.Number,\n\tinitialValue: 1,\n\toptions: { min: 1, step: 1 },\n}\n\nconst repeaterItemIndexVariableControl = numberControlDescription(repeaterItemIndexVariable, ScopeType.WebPage)\n\nconst repeaterItemCountVariable: NumberVariableDefinition = {\n\tid: repeaterItemCountVariableId,\n\tname: \"Visible Items\",\n\ttype: ControlType.Number,\n\tinitialValue: 0,\n\toptions: { min: 0, step: 1 },\n}\n\nexport const repeaterVariables = [repeaterItemIndexVariable, repeaterItemCountVariable]\n\nconst repeaterItemCountVariableControl = numberControlDescription(repeaterItemCountVariable, ScopeType.WebPage)\n\nexport function isRepeaterVariableId(variableId: VariableID) {\n\treturn variableId === repeaterItemIndexVariableId || variableId === repeaterItemCountVariableId\n}\n\nexport function isRepeaterVariableIdAvailableToNonRepeatedChildren(variableId: VariableID) {\n\treturn variableId === repeaterItemCountVariableId\n}\n\nexport class NonRepeatedChildVariableMap\n\textends MergedVariableProviderMap<VariableDefinition>\n\timplements VariableProviderVariableMap\n{\n\tconstructor(parentVariableMap: VariableProviderVariableMap) {\n\t\tconst variableMap = new EagerVariableProviderMap<VariableDefinition>()\n\t\tvariableMap.set(repeaterItemCountVariableId, repeaterItemCountVariable)\n\n\t\tsuper(parentVariableMap, variableMap)\n\t}\n}\n\nexport class NonRepeatedChildValueMap extends MergedVariableProviderMap<unknown> implements VariableProviderValueMap {\n\tconstructor(parentValueMap: VariableProviderValueMap, itemCount: number) {\n\t\tconst valueMap = new EagerVariableProviderMap<unknown>()\n\t\tvalueMap.set(repeaterItemCountVariableId, itemCount)\n\n\t\tsuper(parentValueMap, valueMap)\n\t}\n}\n\nexport class NonRepeatedChildControlMap\n\textends MergedVariableProviderMap<VerifiedControlDescription>\n\timplements VariableProviderControlMap\n{\n\tconstructor(parentControlMap: VariableProviderControlMap) {\n\t\tconst controlMap = new EagerVariableProviderMap<VerifiedControlDescription>()\n\t\tcontrolMap.set(repeaterItemCountVariableId, repeaterItemCountVariableControl)\n\n\t\tsuper(parentControlMap, controlMap)\n\t}\n}\n\nexport class RepeaterVariableMap\n\textends MergedVariableProviderMap<VariableDefinition>\n\timplements VariableProviderVariableMap\n{\n\tconstructor(parentVariableMap: VariableProviderVariableMap) {\n\t\tconst variableMap = new EagerVariableProviderMap<VariableDefinition>()\n\t\tvariableMap.set(repeaterItemIndexVariableId, repeaterItemIndexVariable)\n\t\tvariableMap.set(repeaterItemCountVariableId, repeaterItemCountVariable)\n\n\t\tsuper(parentVariableMap, variableMap)\n\t}\n}\n\nexport class RepeaterValueMap extends MergedVariableProviderMap<unknown> implements VariableProviderValueMap {\n\tconstructor(parentValueMap: VariableProviderValueMap, itemIndex: number, itemCount: number) {\n\t\tconst valueMap = new EagerVariableProviderMap<unknown>()\n\t\tvalueMap.set(repeaterItemIndexVariableId, itemIndex + 1)\n\t\tvalueMap.set(repeaterItemCountVariableId, itemCount)\n\n\t\tsuper(parentValueMap, valueMap)\n\t}\n}\n\nexport class RepeaterControlMap\n\textends MergedVariableProviderMap<VerifiedControlDescription>\n\timplements VariableProviderControlMap\n{\n\tconstructor(parentControlMap: VariableProviderControlMap) {\n\t\tconst controlMap = new EagerVariableProviderMap<VerifiedControlDescription>()\n\t\tcontrolMap.set(repeaterItemIndexVariableId, repeaterItemIndexVariableControl)\n\t\tcontrolMap.set(repeaterItemCountVariableId, repeaterItemCountVariableControl)\n\n\t\tsuper(parentControlMap, controlMap)\n\t}\n}\n\nexport function createNonRepeatedChildMapsFromRepeaterMaps(\n\tcombinedControlMap: CombinedVariableProviderControlMap | undefined,\n\tcombinedValueMap: CombinedVariableProviderValueMap | undefined,\n\trepeaterId: NodeID,\n\titemCount: number,\n): {\n\tnonRepeatedChildCombinedControlMap: CombinedVariableProviderControlMap\n\tnonRepeatedChildCombinedValueMap: CombinedVariableProviderValueMap\n} {\n\tconst nonRepeatedChildCombinedControlMap = new Map(combinedControlMap)\n\tconst nonRepeatedChildCombinedValueMap = new Map(combinedValueMap)\n\n\tconst variableControlMap = new EagerVariableProviderMap<VerifiedControlDescription>()\n\tconst variableValueMap = new EagerVariableProviderMap<unknown>()\n\n\tvariableControlMap.set(repeaterItemCountVariableId, repeaterItemCountVariableControl)\n\tvariableValueMap.set(repeaterItemCountVariableId, itemCount)\n\n\tnonRepeatedChildCombinedControlMap.set(repeaterId, variableControlMap)\n\tnonRepeatedChildCombinedValueMap.set(repeaterId, variableValueMap)\n\n\treturn {\n\t\tnonRepeatedChildCombinedControlMap,\n\t\tnonRepeatedChildCombinedValueMap,\n\t}\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport type { WithSizeConstraints } from \"document/models/CanvasTree/traits/WithSizeConstraints.ts\"\nimport { isCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport { isArray, isNull, isNumber, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { VariantSize } from \"./types.ts\"\n\ntype DimensionTypeString = \"auto\" | \"fixed\" | \"fit-image\"\n\n// VariantData is stored as JSON. That means any undefined values in an array\n// are coerced to null.\ntype SizeConstraints = [\n\tWithSizeConstraints[\"minWidth\"] | null,\n\tWithSizeConstraints[\"maxWidth\"] | null,\n\tWithSizeConstraints[\"minHeight\"] | null,\n\tWithSizeConstraints[\"maxHeight\"] | null,\n]\n\nexport interface VariantData {\n\tlayout?: [DimensionTypeString, DimensionTypeString]\n\tconstraints?: SizeConstraints\n}\nexport interface VariantDetails {\n\tpropertyName: string\n\tdata: {\n\t\t[key: string]: VariantData | undefined\n\t}\n}\n\nfunction isDimensionTypeString(dimensionType: unknown): dimensionType is DimensionTypeString {\n\treturn dimensionType === \"auto\" || dimensionType === \"fixed\" || dimensionType === \"fit-image\"\n}\n\nfunction isSizeConstraintValue(constraint: unknown) {\n\treturn isCSSDimension(constraint) || isNumber(constraint) || isNull(constraint)\n}\n\nexport function isVariantDetails(details: unknown): details is VariantDetails {\n\tif (!isObject(details)) return false\n\tconst { data, propertyName } = details\n\tif (!isString(propertyName) || !isObject(data)) return false\n\treturn Object.entries(data).every(([key, value]) => {\n\t\tif (!isString(key) || !isObject(value)) return false\n\t\tconst { layout, constraints } = value\n\t\tconst isValidLayoutValue =\n\t\t\tisUndefined(layout) || (isArray(layout) && layout.length === 2 && layout.every(isDimensionTypeString))\n\t\tconst isValidConstraintsValue =\n\t\t\tisUndefined(constraints) ||\n\t\t\t(isArray(constraints) && constraints.length === 4 && constraints.every(isSizeConstraintValue))\n\n\t\treturn isValidLayoutValue && isValidConstraintsValue\n\t})\n}\n\n// This function is specific to serializing the variantDetails for code\n// annotation. Because \"auto\" and \"fixed\" are the only options there, it will\n// ignore other enum types\nfunction dimensionTypeToString(dimensionType: DimensionType): DimensionTypeString | undefined {\n\tswitch (dimensionType) {\n\t\tcase DimensionType.Auto:\n\t\t\treturn \"auto\"\n\t\tcase DimensionType.FixedNumber:\n\t\t\treturn \"fixed\"\n\t\tcase DimensionType.FitImage:\n\t\t\treturn \"fit-image\"\n\t\tcase DimensionType.FractionOfFreeSpace:\n\t\tcase DimensionType.Percentage:\n\t\tcase DimensionType.Viewport:\n\t\t\treturn undefined\n\t\tdefault:\n\t\t\tassertNever(dimensionType)\n\t}\n}\n\nexport function dimensionTypeFromString(string: DimensionTypeString): DimensionType {\n\tswitch (string) {\n\t\tcase \"auto\":\n\t\t\treturn DimensionType.Auto\n\t\tcase \"fixed\":\n\t\t\treturn DimensionType.FixedNumber\n\t\tcase \"fit-image\":\n\t\t\treturn DimensionType.FitImage\n\t\tdefault:\n\t\t\tassertNever(string)\n\t}\n}\n\nfunction serializableVariantLayout(\n\tvariantSize: VariantSize | undefined,\n): [DimensionTypeString, DimensionTypeString] | undefined {\n\tif (isUndefined(variantSize)) return\n\tconst width = dimensionTypeToString(variantSize.widthType)\n\tconst height = dimensionTypeToString(variantSize.heightType)\n\tif (isUndefined(width) || isUndefined(height)) return undefined\n\treturn [width, height]\n}\n\nfunction serializableVariantConstraints(variantSize: VariantSize): SizeConstraints | undefined {\n\tconst { minWidth, maxWidth, minHeight, maxHeight } = variantSize\n\tconst constraints: SizeConstraints = [minWidth, maxWidth, minHeight, maxHeight]\n\tif (constraints.every(isUndefined)) return undefined\n\treturn constraints\n}\n\nexport function serializeVariantData(size: VariantSize): VariantData | undefined {\n\tconst layout = serializableVariantLayout(size)\n\tconst constraints = serializableVariantConstraints(size)\n\tif (!layout && !constraints) return undefined\n\n\treturn {\n\t\tlayout,\n\t\tconstraints,\n\t}\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { WithChildren } from \"../../traits/WithChildren.ts\"\n\n// WARNING: this function will return `null` if the node isn't in a tree,\n// instead of throwing an error, so make sure this is really what you want\n// before you use it. Always check if you can use `tree.getParent()`, instead.\nexport function unsafeGetParent(node: CanvasNode): (CanvasNode & WithChildren) | null {\n\treturn node.tree()?.get<CanvasNode & WithChildren>(node.parentid) ?? null\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { hasAnyLayout } from \"../../traits/WithLayout.ts\"\nimport { unsafeGetParent } from \"./unsafeGetParent.ts\"\n\nexport function isStackOrGridChild(node: CanvasNode): boolean {\n\tif (node.cache.parentDirected !== undefined) {\n\t\treturn Boolean(node.cache.parentDirected)\n\t}\n\n\tconst parent = unsafeGetParent(node)\n\n\treturn Boolean(parent && hasAnyLayout(parent))\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isStackOrGridChild } from \"document/models/CanvasTree/nodes/utils/isStackOrGridChild.ts\"\nimport { isPinnable } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport { isOverlayNode } from \"./nodeCheck.ts\"\n\nexport function nodeLayoutDependsOnParent(node: CanvasNode) {\n\t// An overlayNode's layout depends on the viewport not the parent.\n\tif (isOverlayNode(node)) return false\n\n\t// In a stack or grid, parent size always matters.\n\tif (isStackOrGridChild(node)) return true\n\n\t// Otherwise the node might depend on the parent due to pinning.\n\tif (!isPinnable(node)) return false\n\n\t// The width/height might depend on the parent size.\n\tconst sizeDependsOnParent =\n\t\tnode.widthType === DimensionType.Percentage ||\n\t\tnode.heightType === DimensionType.Percentage ||\n\t\tnode.widthType === DimensionType.FractionOfFreeSpace ||\n\t\tnode.heightType === DimensionType.FractionOfFreeSpace\n\tif (sizeDependsOnParent) return true\n\n\t// If not pinned to the top/left, then the layer is either stuck to the bottom/right or centers,\n\t// moving as the parent resizes. Otherwise if the node is pinned to both the top and left, but\n\t// also to the bottom or right, then it resizes.\n\tconst pinsDependOnParent = node.top === null || node.left === null || node.bottom !== null || node.right !== null\n\treturn pinsDependOnParent\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isPinnable } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport { isAutoDimensionType } from \"library/render/types/Constraints.ts\"\n\nexport function isAutoSizedOnBothDimensions(node: CanvasNode) {\n\treturn isPinnable(node) && isAutoDimensionType(node.widthType) && isAutoDimensionType(node.heightType)\n}\n\nexport function isAutoSizedOnAnyDimension(node: CanvasNode) {\n\tif (!isPinnable(node)) return false\n\treturn isAutoDimensionType(node.widthType) || isAutoDimensionType(node.heightType)\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isSlotPropertyNode } from \"../nodes/utils/nodeCheck.ts\"\n\nexport interface WithPosition {\n\tx: number\n\ty: number\n}\n\nexport const positionDefaults: WithPosition = {\n\tx: 0,\n\ty: 0,\n}\n\nconst key: keyof WithPosition = \"x\"\n\nexport function withPosition(node: CanvasNode): node is CanvasNode & WithPosition {\n\tif (isSlotPropertyNode(node)) return false\n\n\treturn key in node\n}\n", "import type { Rect } from \"library/render/types/Rect.ts\"\nimport type { CanvasNode } from \"../index.ts\"\nimport { withDOMLayout } from \"../traits/WithDOMLayout.ts\"\nimport { isOverflowVisuallyHidden } from \"../traits/WithOverflow.ts\"\nimport { isPinnable } from \"../traits/WithPins.ts\"\nimport { withPosition } from \"../traits/WithPosition.ts\"\nimport { withSize } from \"../traits/WithSize.ts\"\n\nexport function getGroundNodeRectWithPinnedPosition(node: CanvasNode): Rect {\n\tconst rect: Rect = { x: 0, y: 0, width: 200, height: 200 }\n\n\tif (withPosition(node)) {\n\t\trect.x = node.x\n\t\trect.y = node.y\n\t}\n\n\tif (withSize(node)) {\n\t\trect.width = node.width\n\t\trect.height = node.height\n\t}\n\n\tif (withDOMLayout(node) && node.usesDOMRectCached()) {\n\t\tconst domRect = node.cache.getRawDOMRect(node.id)\n\n\t\t// Can't use the getDOMRect() getter here, because it uses this function\n\t\t// internally to get ground node position\n\t\tif (domRect) {\n\t\t\t// Don't use the DOM rect for breakpoints rendering inside a Layout\n\t\t\t// Template instance. Since the breakpoint Frame element is display:\n\t\t\t// contents, the Fixed width will not be measurable so the DOM rect\n\t\t\t// may be smaller or larger than the actual size, and not change\n\t\t\t// when manually resizing.\n\t\t\tif (!node.usesLayoutTemplateRectForModuleIdentifierCached()) rect.width = domRect.width\n\t\t\trect.height = domRect.height\n\t\t}\n\t}\n\n\tif (isPinnable(node)) {\n\t\trect.x = node.left ? node.left : 0\n\t\trect.y = node.top ? node.top : 0\n\t}\n\n\treturn rect\n}\n\nexport function getGroundNodeOverflowRect(node: CanvasNode): Rect {\n\tif (!isOverflowVisuallyHidden(node) && Number.isFinite(node.cache.minX)) {\n\t\treturn {\n\t\t\tx: node.cache.minX,\n\t\t\ty: node.cache.minY,\n\t\t\twidth: node.cache.maxX - node.cache.minX,\n\t\t\theight: node.cache.maxY - node.cache.minY,\n\t\t}\n\t}\n\n\treturn getGroundNodeRectWithPinnedPosition(node)\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../../index.ts\"\nimport { isLayoutTemplateNode, isVectorInstance } from \"../../nodes/utils/nodeCheck.ts\"\nimport { unsafeGetParent } from \"../../nodes/utils/unsafeGetParent.ts\"\nimport type { WithAspectRatio } from \"../WithAspectRatio.ts\"\nimport { withAspectRatio } from \"../WithAspectRatio.ts\"\nimport { isBreakpointWithLayoutTemplate } from \"../WithLayoutTemplate.ts\"\nimport type { WithConstraints, WithPins } from \"../WithPins.ts\"\nimport { isPinnable } from \"../WithPins.ts\"\nimport { isBreakpointVariant, isSmartComponentVariant } from \"../WithVariant.ts\"\nimport { isAutoSizedOnAnyDimension } from \"./autoSizeHelpers.ts\"\n\nexport function aspectRatioForNode(node: CanvasNode): number | null {\n\tif (!withAspectRatio(node)) return null\n\tif (isVectorInstance(node) && node.usesDOMRectCached()) {\n\t\t// Directly use the DOM rect here. Using `node.rect` creates an endless loop.\n\t\tconst rect = node.getDOMRect()\n\t\t// Vector instances are always measured, and the aspect-ratio is not available on the node,\n\t\t// because it can change when the instance is updated. To avoid needing access to the\n\t\t// component loader, determine it via the measured rect. If its not available, don't worry\n\t\t// about it. If the width or height is 0, the aspect ratio cannot be valid.\n\t\tif (isNull(rect) || rect.width === 0 || rect.height === 0) return null\n\t\treturn rect.width / rect.height\n\t}\n\n\tconst aspectRatio = node.aspectRatio\n\t// Aspect ratios cannot be zero or smaller.\n\tif (!aspectRatio || aspectRatio <= 0) return null\n\treturn layoutSupportsAspectRatio(node) ? aspectRatio : null\n}\n\nexport function hasLockedAspectRatio<T extends CanvasNode>(node: T): node is T & WithAspectRatio {\n\tif (!withAspectRatio(node)) return false\n\tif (isVectorInstance(node)) return true\n\n\tconst aspectRatio = node.aspectRatio\n\t// Aspect ratios cannot be zero or smaller.\n\tif (!aspectRatio || aspectRatio <= 0) return false\n\treturn layoutSupportsAspectRatio(node)\n}\n\nexport function layoutSupportsAspectRatio(node: CanvasNode) {\n\tif (isVectorInstance(node)) return true\n\n\tif (isAutoSizedOnAnyDimension(node)) {\n\t\treturn false\n\t}\n\n\tif (isBreakpointWithLayoutTemplate(node)) return false\n\n\tif (isBreakpointVariant(node)) {\n\t\tconst scope = unsafeGetParent(node)\n\t\tif (isLayoutTemplateNode(scope)) return false\n\t}\n\n\tif (isSmartComponentVariant(node)) return false\n\n\treturn true\n}\n\n/**\n * When updating a node to have a relative axis, check if that change requires\n * the opposing axis to be set to a FixedNumber. This is required when aspect ratio is locked. We used the measured size\n * for the UI, and as a fallback value if aspect-ratio is not supported.\n */\nexport function relativeAxisRequiresFixedOpposingAxis<T extends CanvasNode>(\n\tnode: T,\n\trelativeAxis: \"width\" | \"height\",\n): node is T & WithAspectRatio & { aspectRatio: number } & WithPins & WithConstraints {\n\tif (!withAspectRatio(node) || !isPinnable(node) || !hasLockedAspectRatio(node)) {\n\t\treturn false\n\t}\n\n\tswitch (relativeAxis) {\n\t\tcase \"width\":\n\t\t\treturn node.heightType !== DimensionType.FixedNumber\n\t\tcase \"height\":\n\t\t\treturn node.widthType !== DimensionType.FixedNumber\n\t\tdefault:\n\t\t\tassertNever(relativeAxis)\n\t}\n}\n", "import type { AnyComponentLoader, ComponentLoader } from \"@framerjs/framer-runtime\"\nimport type { LocalModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { isEditorBar } from \"@framerjs/shared\"\nimport type { CanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isStackOrGridChild } from \"document/models/CanvasTree/nodes/utils/isStackOrGridChild.ts\"\nimport { nodeLayoutDependsOnParent } from \"document/models/CanvasTree/nodes/utils/nodeLayoutDependsOnParent.ts\"\nimport { unsafeGetParent } from \"document/models/CanvasTree/nodes/utils/unsafeGetParent.ts\"\nimport type { WithDOMLayout } from \"document/models/CanvasTree/traits/WithDOMLayout.ts\"\nimport { withDOMLayout } from \"document/models/CanvasTree/traits/WithDOMLayout.ts\"\nimport { isAutoSizedOnAnyDimension } from \"document/models/CanvasTree/traits/utils/autoSizeHelpers.ts\"\nimport { getGroundNodeRectWithPinnedPosition } from \"document/models/CanvasTree/utils/getGroundNodeRect.ts\"\nimport type { RenderId } from \"document/utils/RenderId.ts\"\nimport type { LayerProps } from \"library/render/presentation/Layer.tsx\"\nimport type { Rect } from \"library/render/types/Rect.ts\"\nimport { RenderTarget } from \"library/render/types/RenderEnvironment.ts\"\nimport { hasFloatingPosition } from \"../WithFloatingPosition.ts\"\nimport { hasAnyLayout } from \"../WithLayout.ts\"\nimport { withLayoutTemplate } from \"../WithLayoutTemplate.ts\"\nimport type { ParentSizeInfo } from \"../WithRect.ts\"\nimport { withShape } from \"../WithShape.ts\"\nimport { isBreakpointVariant } from \"../WithVariant.ts\"\nimport { hasLockedAspectRatio } from \"../utils/layoutSupportsAspectRatio.ts\"\n\nexport function withDOMLayoutTrait<T extends new (...args: any[]) => CanvasNode>(Base: T) {\n\treturn class WithDOMLayoutTrait extends Base implements WithDOMLayout {\n\t\tusesDOMRectCached() {\n\t\t\tif (this.cache.usesDOMRect !== undefined) {\n\t\t\t\treturn this.cache.usesDOMRect\n\t\t\t}\n\n\t\t\treturn (this.cache.usesDOMRect = this.usesDOMRect())\n\t\t}\n\n\t\tusesDOMRect() {\n\t\t\tif (isAutoSizedOnAnyDimension(this)) return true\n\t\t\tif (isStackOrGridChild(this)) return true\n\t\t\tif (hasAnyLayout(this)) return true\n\t\t\tif (\n\t\t\t\thasLockedAspectRatio(this) &&\n\t\t\t\t// Vector nodes nested in a shape container (or group) are not measured. If they\n\t\t\t\t// have aspect ratio on, they would be considered using the DOM rect but without a\n\t\t\t\t// measurement.\n\t\t\t\t!withShape(this)\n\t\t\t) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (hasFloatingPosition(this)) return true\n\t\t\t// For the on-page canvas, we have to use the DOM rect for breakpoint nodes because we\n\t\t\t// render them at 100vw. As most of the time breakpoint nodes use stack layout anyway,\n\t\t\t// we also measure them on the normal canvas as the performance impact is negligible.\n\t\t\t// This makes the logic simpler and more consistent, as we don't have to check for the\n\t\t\t// environment.\n\t\t\tif (isBreakpointVariant(this)) return true\n\n\t\t\tconst parent = unsafeGetParent(this)\n\t\t\tconst parentUsesDOMRect = Boolean(parent && withDOMLayout(parent) && parent.usesDOMRectCached())\n\t\t\tconst layoutDependsOnParent = nodeLayoutDependsOnParent(this)\n\t\t\treturn layoutDependsOnParent && parentUsesDOMRect\n\t\t}\n\n\t\tusesLayoutTemplateRectForModuleIdentifier(): LocalModuleExportIdentifierString | undefined {\n\t\t\tif (!isBreakpointVariant(this)) return undefined\n\t\t\tconst parent = this.tree()?.getScopeNodeFor(this)\n\t\t\treturn withLayoutTemplate(parent) ? (parent.layoutTemplateIdentifier ?? undefined) : undefined\n\t\t}\n\n\t\tusesLayoutTemplateRectForModuleIdentifierCached(): LocalModuleExportIdentifierString | undefined {\n\t\t\tif (this.cache.usesLayoutTemplateRectForModuleIdentifier !== null) {\n\t\t\t\treturn this.cache.usesLayoutTemplateRectForModuleIdentifier\n\t\t\t}\n\n\t\t\treturn (this.cache.usesLayoutTemplateRectForModuleIdentifier = this.usesLayoutTemplateRectForModuleIdentifier())\n\t\t}\n\n\t\tinvalidateDOMRect() {\n\t\t\t// In a DOM Layout Stack the DOM rect will also be cached as the\n\t\t\t// parentDirectedRect, so it also needs to be null'ed out\n\t\t\tif (this.cache.parentDirected && this.cache.usesDOMRect) {\n\t\t\t\tthis.cache.parentDirectedRect = undefined\n\t\t\t}\n\t\t\tthis.cache.usesDOMRect = undefined\n\t\t\tthis.cache.domRects = null\n\t\t\tthis.cache.layoutTemplateRects = undefined\n\t\t}\n\n\t\tgetDOMRect(renderId: RenderId = this.id): Rect | null {\n\t\t\tconst domRect = this.cache.getRawDOMRect(renderId)\n\t\t\tif (!domRect) return null\n\n\t\t\t// Ground nodes are special-cased to always use the x/y from the information stored\n\t\t\t// directly on the node. This is because if we rely on DOM layout for\n\t\t\t// measurements/positioning of ground nodes, we can end up in a situation where the user\n\t\t\t// enters in a position outside of the current viewport, where the ground node will be\n\t\t\t// hidden by the renderer, and its position won't be able to be measured, because we\n\t\t\t// can't measure hidden nodes.\n\t\t\t// The on-page canvas always renders a breakpoint at the origin of the window, so we can't use the canvas\n\t\t\t// position for it.\n\t\t\tif (!isEditorBar() && this.__unsafeIsGroundNode()) {\n\t\t\t\treturn {\n\t\t\t\t\t...getGroundNodeRectWithPinnedPosition(this),\n\t\t\t\t\twidth: domRect.width,\n\t\t\t\t\theight: domRect.height,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn { ...domRect }\n\t\t}\n\n\t\toverride rect(\n\t\t\tparentSizeInfo: ParentSizeInfo | null = null,\n\t\t\tpixelAlign = true,\n\t\t\tcomponentLoader?: ComponentLoader,\n\t\t\trenderId: RenderId = this.id,\n\t\t) {\n\t\t\tif (this.usesDOMRectCached()) {\n\t\t\t\tconst domRect = this.getDOMRect(renderId)\n\t\t\t\tif (domRect) return domRect\n\t\t\t}\n\n\t\t\treturn super.rect(parentSizeInfo, pixelAlign, componentLoader, renderId)\n\t\t}\n\n\t\toverride getProps(componentLoader: AnyComponentLoader): Partial<LayerProps> {\n\t\t\tconst props = super.getProps(componentLoader)\n\n\t\t\t// If we are not on the canvas or exporting, don't measure either.\n\t\t\tconst renderTarget = RenderTarget.current()\n\t\t\tif (renderTarget !== RenderTarget.canvas && renderTarget !== RenderTarget.export) return props\n\n\t\t\tprops._needsMeasure = true\n\n\t\t\tif (this.usesDOMRectCached()) {\n\t\t\t\tprops._usesDOMRect = true\n\t\t\t\tprops._domRect = this.getDOMRect()\n\t\t\t}\n\n\t\t\treturn props\n\t\t}\n\t}\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { BorderStyle } from \"library/render/style/BorderComponent.tsx\"\nimport type { ExplicitPartial } from \"utils/ExplicitPartial.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\nimport type { Reduced } from \"./utils/Reduced.ts\"\nimport { isFound } from \"./utils/Reduced.ts\"\nimport { isStylableNode } from \"./utils/hardCodedCodeComponentIdentifierChecks.ts\"\n\nexport const borderStyles: readonly BorderStyle[] = [\"solid\", \"dashed\", \"dotted\", \"double\"]\n\n/**\n * BorderValues is used as our internal data model for storing border values in control properties.\n * The corresponding public API that is exposed to the React world is Border.\n */\nexport interface BorderValues {\n\tborderWidth: number\n\tborderColor: string\n\tborderStyle: BorderStyle\n\tborderPerSide: boolean\n\tborderTop: number\n\tborderRight: number\n\tborderBottom: number\n\tborderLeft: number\n}\n\nexport interface WithBorder extends ExplicitPartial<BorderValues> {\n\tborderEnabled: boolean | DynamicValue | undefined\n}\n\nexport const borderDefaults: WithBorder = {\n\tborderEnabled: undefined,\n\tborderWidth: undefined,\n\tborderColor: undefined,\n\tborderStyle: undefined,\n\tborderPerSide: undefined,\n\tborderTop: undefined,\n\tborderRight: undefined,\n\tborderBottom: undefined,\n\tborderLeft: undefined,\n}\n\nexport const browserDefaultForBorderStyle = \"solid\"\n\nconst key: keyof WithBorder = \"borderWidth\"\n\nexport const withBorder = <T extends CanvasNode>(node: T): node is T & WithBorder => {\n\treturn key in node && isStylableNode(node)\n}\n\nexport function isBorderOptional(\n\tborderEnabled: Reduced<WithBorder[\"borderEnabled\"]>,\n\tonlyBreakpointNodes: boolean,\n): boolean {\n\treturn isFound(borderEnabled) && onlyBreakpointNodes\n}\n\nexport function isOptionalBorderVisible(borderEnabled: Reduced<WithBorder[\"borderEnabled\"]>): boolean {\n\treturn borderEnabled === true\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { BorderValues } from \"document/models/CanvasTree/traits/WithBorder.ts\"\nimport { withBorder } from \"document/models/CanvasTree/traits/WithBorder.ts\"\nimport {\n\tfromBorderReactCSSProperties,\n\tisBorderValues,\n\tisValidBorderReactCSSProperties,\n\ttoBorderComponentProps,\n} from \"document/models/controlProps/BorderControlPropValue.ts\"\nimport type { BorderComponentProps } from \"library/render/style/BorderComponent.tsx\"\nimport { isDynamicValue } from \"../DynamicValue.ts\"\n\nexport function borderPropsForNode(node: CanvasNode): Partial<BorderComponentProps> {\n\tif (!withBorder(node) || !node.borderEnabled) return {}\n\n\t// If the border is a variable, then all of the child border properties are\n\t// stored within node.borderEnabled as a variable reference.\n\tif (isDynamicValue(node.borderEnabled)) {\n\t\tconst resolvedValue = node.resolveValue(\"borderEnabled\") as BorderValues | undefined\n\n\t\tif (isBorderValues(resolvedValue)) {\n\t\t\treturn toBorderComponentProps(resolvedValue)\n\t\t} else if (isValidBorderReactCSSProperties(resolvedValue)) {\n\t\t\treturn toBorderComponentProps(fromBorderReactCSSProperties(resolvedValue))\n\t\t}\n\n\t\treturn {}\n\t}\n\n\tlet borderTop = node.borderWidth\n\tlet borderBottom = node.borderWidth\n\tlet borderLeft = node.borderWidth\n\tlet borderRight = node.borderWidth\n\n\tif (node.borderPerSide) {\n\t\tborderTop = node.borderTop\n\t\tborderBottom = node.borderBottom\n\t\tborderLeft = node.borderLeft\n\t\tborderRight = node.borderRight\n\t}\n\n\tif (borderTop === 0 && borderBottom === 0 && borderLeft === 0 && borderRight === 0) return {}\n\tlet borderWidth: number | Partial<{ top: number; bottom: number; left: number; right: number }> | undefined\n\tif (borderTop === borderBottom && borderTop === borderLeft && borderTop === borderRight) {\n\t\tborderWidth = borderTop\n\t} else {\n\t\tborderWidth = {\n\t\t\ttop: borderTop,\n\t\t\tright: borderRight,\n\t\t\tbottom: borderBottom,\n\t\t\tleft: borderLeft,\n\t\t}\n\t}\n\treturn {\n\t\tborderWidth,\n\t\tborderStyle: node.borderStyle,\n\t\tborderColor: node.borderColor,\n\t}\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { BaseFrameProps } from \"library/render/presentation/Frame/types.ts\"\n\nexport function collectNameForNode(node: CanvasNode, props: Partial<BaseFrameProps>) {\n\tconst name = node.resolveValue(\"name\")\n\tif (props.name === undefined && name) {\n\t\tprops.name = name\n\t}\n}\n", "import { assertNever } from \"@framerjs/shared\"\n// actually more like ConstraintFixer\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { Point } from \"library/index.ts\"\nimport type { ConstraintMask } from \"library/render/types/Constraints.ts\"\nimport { ConstraintValues, DimensionType, isAutoDimensionType } from \"library/render/types/Constraints.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\nimport type { Size } from \"library/render/types/Size.ts\"\nimport { commonValue } from \"utils/commonValue.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { isShapeContainerNode, isVectorInstance } from \"./CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { NonDynamicValueRecord } from \"./CanvasTree/traits/DynamicValue.ts\"\nimport type { WithAspectRatio } from \"./CanvasTree/traits/WithAspectRatio.ts\"\nimport type { WithFloatingPosition } from \"./CanvasTree/traits/WithFloatingPosition.ts\"\nimport { getRelativeOffsetX, getRelativeOffsetY } from \"./CanvasTree/traits/WithFloatingPosition.ts\"\nimport type { WithConstraints, WithPins } from \"./CanvasTree/traits/WithPins.ts\"\nimport type { ParentSizeInfo } from \"./CanvasTree/traits/WithRect.ts\"\nimport type { WithSizeConstraints } from \"./CanvasTree/traits/WithSizeConstraints.ts\"\nimport { isCSSDimension } from \"./CanvasTree/traits/utils/CSSDimension.ts\"\n\nexport interface Pins {\n\tleft: number | null\n\tright: number | null\n\ttop: number | null\n\tbottom: number | null\n}\n\nexport type PinPosition = keyof Pins\n\n/**\n * These properties might be undefined due to a bug in the past and was solved in https://github.com/framer/FramerStudio/pull/20208.\n * This might happen on relative overlays that weren't repositioned after this bug was fixed.\n *\n * If this presents a problem in future we can easily create a migration to permanently make the data match the types here\n * by migrating Frame and CodeComponent nodes that have `floatingPositionEnabled: true` to have `centerAnchorX: 0; centerAnchorY: 0;`.\n */\nexport interface CenterPins {\n\tcenterAnchorX: number\n\tcenterAnchorY: number\n}\n\ninterface UpdateConstrainedFrameOptions {\n\trect: Rect\n\tparentSizeInfo: ParentSizeInfo | null\n\tcurrentConstraints: ConstraintMask | undefined\n\tconstraintsLocked: boolean\n\tshouldGuessPinToBottom: boolean\n\tshouldGuessPinToRight: boolean\n\tpixelAlign?: boolean\n\tupdateSize?: boolean\n\tfloatingPosition: WithFloatingPosition | null\n}\n\nexport const updateConstrainedFrame = ({\n\trect: incomingRect,\n\tparentSizeInfo,\n\tcurrentConstraints,\n\tconstraintsLocked,\n\tshouldGuessPinToBottom,\n\tshouldGuessPinToRight,\n\tpixelAlign = true,\n\tupdateSize,\n\tfloatingPosition,\n}: UpdateConstrainedFrameOptions): Partial<WithPins> => {\n\tconst rect = pixelAlign ? Rect.pixelAligned(incomingRect) : incomingRect\n\tif (currentConstraints && (floatingPosition?.floatingPositionEnabled || constraintsLocked)) {\n\t\treturn constrainedFrame(currentConstraints, rect, parentSizeInfo, floatingPosition)\n\t} else {\n\t\treturn guessConstrainedFrame(\n\t\t\trect,\n\t\t\tparentSizeInfo,\n\t\t\tfloatingPosition,\n\t\t\t{\n\t\t\t\tshouldGuessPinToBottom,\n\t\t\t\tshouldGuessPinToRight,\n\t\t\t\tcurrentConstraints,\n\t\t\t},\n\t\t\tupdateSize,\n\t\t)\n\t}\n}\n\nconst pinValues = (rect: Rect, parentSize: Size) => {\n\treturn {\n\t\ttop: rect.y,\n\t\tbottom: parentSize.height - rect.y - rect.height,\n\t\tleft: rect.x,\n\t\tright: parentSize.width - rect.x - rect.width,\n\t}\n}\n\nexport const updateConstrainedSize = (\n\tsize: Partial<Size>,\n\tparentSizeInfo: ParentSizeInfo | null,\n\tconstraintValues: ConstraintValues,\n): Partial<WithPins> => {\n\t// TODO: use autoSize and freeSpace ??\n\t// When a node is using vw/vh, its size should be calculated with the viewport size, while its position should\n\t// be calculated with the parent size. But we are interested only in the size here, so we can use the same parent\n\t// size for both. Even though we pixel-align the width/height based on x/y, the x/y diff between the two parent sizes\n\t// is the viewport height, which is always an integer, so it shouldn't affect the rounded width/height.\n\tconst currentRect = ConstraintValues.toRect(constraintValues, parentSizeInfo, null, true)\n\n\tconst result: Partial<WithPins> = {}\n\n\tif (isNumber(constraintValues.aspectRatio)) {\n\t\tif (isNumber(size.width)) {\n\t\t\tsize.height = size.width / constraintValues.aspectRatio\n\t\t} else if (isNumber(size.height)) {\n\t\t\tsize.width = size.height * constraintValues.aspectRatio\n\t\t}\n\t}\n\n\tif (isNumber(size.width)) {\n\t\tif (parentSizeInfo?.sizing && constraintValues.widthType === DimensionType.Percentage) {\n\t\t\tresult.width = size.width / parentSizeInfo.sizing.width\n\t\t} else {\n\t\t\tresult.widthType = DimensionType.FixedNumber\n\t\t\tresult.width = size.width\n\t\t}\n\t}\n\n\tif (isNumber(size.height)) {\n\t\tif (parentSizeInfo?.sizing && constraintValues.heightType === DimensionType.Percentage) {\n\t\t\tresult.height = size.height / parentSizeInfo.sizing.height\n\t\t} else {\n\t\t\tresult.heightType = DimensionType.FixedNumber\n\t\t\tresult.height = size.height\n\t\t}\n\t}\n\n\tif (isNumber(result.width) && constraintValues.left !== null && constraintValues.right !== null) {\n\t\tresult.right = constraintValues.right - (result.width - currentRect.width)\n\t\tresult.widthType = DimensionType.FixedNumber\n\t}\n\n\tif (isNumber(result.height) && constraintValues.top !== null && constraintValues.bottom !== null) {\n\t\tresult.bottom = constraintValues.bottom - (result.height - currentRect.height)\n\t\tresult.heightType = DimensionType.FixedNumber\n\t}\n\n\treturn result\n}\n\ninterface GuessConstraintOptions {\n\tshouldGuessPinToBottom: boolean\n\tshouldGuessPinToRight: boolean\n\tshouldGuessWidth100percent?: boolean\n\tcurrentConstraints?: ConstraintMask\n\tusesIntrinsicSize?: boolean\n\taspectRatio?: number | null\n}\n\nexport const guessConstrainedFrame = (\n\tframe: Rect,\n\tparentSizeInfo: ParentSizeInfo | null,\n\tfloatingPosition: WithFloatingPosition | null,\n\toptions: GuessConstraintOptions,\n\tupdateSize?: boolean,\n): Partial<NonDynamicValueRecord<WithPins & WithSizeConstraints & WithFloatingPosition>> => {\n\tconst constraints = guessConstraints(frame, parentSizeInfo, options)\n\treturn constrainedFrame(constraints, frame, parentSizeInfo, floatingPosition, updateSize)\n}\n\nconst isFlex = (constraints: ConstraintMask) => {\n\treturn (\n\t\tconstraints.left === false &&\n\t\tconstraints.right === false &&\n\t\tconstraints.top === false &&\n\t\tconstraints.bottom === false &&\n\t\tconstraints.widthType === DimensionType.Percentage &&\n\t\tconstraints.heightType === DimensionType.Percentage\n\t)\n}\n\nexport const guessConstraints = (\n\trect: Rect,\n\tparentSizeInfo: ParentSizeInfo | null,\n\t{\n\t\tshouldGuessPinToBottom,\n\t\tshouldGuessPinToRight,\n\t\tshouldGuessWidth100percent = false,\n\t\tcurrentConstraints,\n\t\tusesIntrinsicSize = currentConstraints?.fixedSize ?? false,\n\t\taspectRatio = currentConstraints?.aspectRatio ?? null,\n\t}: GuessConstraintOptions,\n): ConstraintMask => {\n\tconst parentSizeForPositioning = parentSizeInfo?.positioning\n\tif (!parentSizeForPositioning) {\n\t\tconst {\n\t\t\twidthType = DimensionType.FixedNumber,\n\t\t\theightType = DimensionType.FixedNumber,\n\t\t\tmaxHeight,\n\t\t\tminHeight,\n\t\t\tmaxWidth,\n\t\t\tminWidth,\n\t\t} = currentConstraints ?? {}\n\n\t\treturn {\n\t\t\tleft: true,\n\t\t\ttop: true,\n\t\t\tbottom: false,\n\t\t\tright: false,\n\t\t\twidthType: widthType === DimensionType.Auto ? widthType : DimensionType.FixedNumber,\n\t\t\theightType: heightType === DimensionType.Auto ? heightType : DimensionType.FixedNumber,\n\t\t\taspectRatio,\n\t\t\tfixedSize: usesIntrinsicSize,\n\t\t\tmaxHeight: isValidConstraintValue(parentSizeInfo, maxHeight, \"height\") ? maxHeight : undefined,\n\t\t\tminHeight: isValidConstraintValue(parentSizeInfo, minHeight, \"height\") ? minHeight : undefined,\n\t\t\tmaxWidth: isValidConstraintValue(parentSizeInfo, maxWidth, \"width\") ? maxWidth : undefined,\n\t\t\tminWidth: isValidConstraintValue(parentSizeInfo, minWidth, \"width\") ? minWidth : undefined,\n\t\t}\n\t}\n\n\tif (currentConstraints !== undefined && isFlex(currentConstraints)) {\n\t\treturn currentConstraints\n\t}\n\n\tconst horizontalCenterThreshold = parentSizeForPositioning.width * 0.05\n\tconst verticalCenterThreshold = parentSizeForPositioning.height * 0.05\n\tconst horizontalEdgeThreshold = 0\n\tconst verticalEdgeThreshold = 0\n\n\tconst center = Rect.center(rect)\n\tconst centerX = Math.abs(center.x - parentSizeForPositioning.width / 2) < horizontalCenterThreshold\n\tconst centerY = Math.abs(center.y - parentSizeForPositioning.height / 2) < verticalCenterThreshold\n\n\tconst pins = pinValues(rect, parentSizeForPositioning)\n\tlet left = (pins.left || 0) <= horizontalEdgeThreshold\n\tlet right = (pins.right || 0) <= horizontalEdgeThreshold\n\tlet top = (pins.top || 0) <= verticalEdgeThreshold\n\tlet bottom = (pins.bottom || 0) <= verticalEdgeThreshold\n\n\tif (!shouldGuessPinToBottom) {\n\t\ttop = true\n\t\tbottom = false\n\t}\n\n\tif (!(left || right) && !centerX) {\n\t\tif ((pins.left || 0) <= (pins.right || 0) || !shouldGuessPinToRight) {\n\t\t\tleft = true\n\t\t} else {\n\t\t\tright = true\n\t\t}\n\t}\n\n\tif (!(top || bottom) && !centerY) {\n\t\tif ((pins.top || 0) <= (pins.bottom || 0)) {\n\t\t\ttop = true\n\t\t} else {\n\t\t\tbottom = true\n\t\t}\n\t}\n\n\tlet widthType = currentConstraints ? currentConstraints.widthType : DimensionType.FixedNumber\n\tconst heightType = currentConstraints ? currentConstraints.heightType : DimensionType.FixedNumber\n\tif (shouldGuessWidth100percent && pins.left === 0 && pins.right === 0) {\n\t\twidthType = DimensionType.Percentage\n\t}\n\n\tconst widthIsFlexible = widthType !== DimensionType.FixedNumber\n\tconst heightIsFlexible = heightType !== DimensionType.FixedNumber\n\n\tif (widthIsFlexible && left && right) {\n\t\tif (centerX) {\n\t\t\tright = left = false\n\t\t} else {\n\t\t\tpins.left <= pins.right ? (right = false) : (left = false)\n\t\t}\n\t}\n\n\tif (heightIsFlexible && top && bottom) {\n\t\tif (centerY) {\n\t\t\tbottom = top = false\n\t\t} else {\n\t\t\tpins.top <= pins.bottom ? (bottom = false) : (top = false)\n\t\t}\n\t}\n\n\tif (usesIntrinsicSize && left && right) {\n\t\tright = false\n\t\tleft = false\n\t}\n\tif (usesIntrinsicSize && top && bottom) {\n\t\tbottom = false\n\t\ttop = false\n\t}\n\tif (isNumber(aspectRatio) && top && bottom && left && right) {\n\t\tif ((pins.top || 0) <= (pins.bottom || 0)) {\n\t\t\tbottom = false\n\t\t} else {\n\t\t\ttop = false\n\t\t}\n\t}\n\n\tconst { maxHeight, minHeight, maxWidth, minWidth } = currentConstraints ?? {}\n\treturn {\n\t\tleft,\n\t\ttop,\n\t\tright,\n\t\tbottom,\n\t\twidthType,\n\t\theightType,\n\t\taspectRatio,\n\t\tfixedSize: usesIntrinsicSize,\n\t\tmaxHeight: isValidConstraintValue(parentSizeInfo, maxHeight, \"height\") ? maxHeight : undefined,\n\t\tminHeight: isValidConstraintValue(parentSizeInfo, minHeight, \"height\") ? minHeight : undefined,\n\t\tmaxWidth: isValidConstraintValue(parentSizeInfo, maxWidth, \"width\") ? maxWidth : undefined,\n\t\tminWidth: isValidConstraintValue(parentSizeInfo, minWidth, \"width\") ? minWidth : undefined,\n\t}\n}\n\nfunction isPixelConstraintValue(constraint: string | undefined): constraint is `${number}px` {\n\treturn isCSSDimension(constraint) && constraint.endsWith(\"px\")\n}\n\nfunction isPercentageConstraintValue(constraint: string | undefined): constraint is `${number}%` {\n\treturn isCSSDimension(constraint) && constraint.endsWith(\"%\")\n}\n\nfunction isViewportConstraintValue(constraint: string | undefined): constraint is `${number}vh` {\n\treturn isCSSDimension(constraint) && constraint.endsWith(\"vh\")\n}\n\nfunction isValidConstraintValue(\n\tparentSizeInfo: ParentSizeInfo | null,\n\tconstraint: string | number | undefined,\n\tdimension: \"width\",\n): constraint is number | `${number}%` | `${number}px`\nfunction isValidConstraintValue(\n\tparentSizeInfo: ParentSizeInfo | null,\n\tconstraint: string | number | undefined,\n\tdimension: \"height\",\n): constraint is number | `${number}%` | `${number}px` | `${number}vh`\nfunction isValidConstraintValue(\n\tparentSizeInfo: ParentSizeInfo | null,\n\tconstraint: string | number | undefined,\n\tdimension: \"width\" | \"height\",\n): constraint is number | `${number}%` | `${number}px` | `${number}vh` {\n\tif (isNumber(constraint)) return true\n\tif (isPixelConstraintValue(constraint)) return true\n\tif (isPercentageConstraintValue(constraint)) return !!parentSizeInfo?.sizing\n\tif (isViewportConstraintValue(constraint)) return !!parentSizeInfo?.viewport && dimension === \"height\"\n\treturn false\n}\n\nexport const constrainedFrame = (\n\tconstraints: ConstraintMask,\n\trect: Rect,\n\tparentSizeInfo: ParentSizeInfo | null,\n\tfloatingPosition: WithFloatingPosition | null,\n\tupdateSize: boolean = true,\n): Partial<NonDynamicValueRecord<WithPins & WithSizeConstraints & WithFloatingPosition & WithAspectRatio>> => {\n\tconst { width, height } = rect\n\tconst { widthType, heightType, maxHeight, minHeight, maxWidth, minWidth, aspectRatio } = constraints\n\n\tif (!parentSizeInfo || !parentSizeInfo.sizing || !parentSizeInfo.positioning) {\n\t\treturn {\n\t\t\twidth,\n\t\t\theight,\n\t\t\taspectRatio,\n\t\t\tleft: rect.x,\n\t\t\ttop: rect.y,\n\t\t\tright: null,\n\t\t\tbottom: null,\n\t\t\twidthType: widthType === DimensionType.Auto ? widthType : DimensionType.FixedNumber,\n\t\t\theightType: heightType === DimensionType.Auto ? heightType : DimensionType.FixedNumber,\n\t\t\t// When parentSizeInfo is missing, remove relative size constraints.\n\t\t\tmaxHeight: isValidConstraintValue(parentSizeInfo, maxHeight, \"height\") ? maxHeight : undefined,\n\t\t\tminHeight: isValidConstraintValue(parentSizeInfo, minHeight, \"height\") ? minHeight : undefined,\n\t\t\tmaxWidth: isValidConstraintValue(parentSizeInfo, maxWidth, \"width\") ? maxWidth : undefined,\n\t\t\tminWidth: isValidConstraintValue(parentSizeInfo, minWidth, \"width\") ? minWidth : undefined,\n\t\t}\n\t}\n\n\tconst { sizing: parentSizeForSizing, positioning: parentSizeForPositioning } = parentSizeInfo\n\tconst pins = pinValues(rect, parentSizeForPositioning)\n\n\tlet update: Partial<NonDynamicValueRecord<WithPins & WithSizeConstraints & WithFloatingPosition & WithAspectRatio>> =\n\t\t{\n\t\t\taspectRatio,\n\t\t\tcenterAnchorX: 0,\n\t\t\tcenterAnchorY: 0,\n\t\t\ttop: null,\n\t\t\tbottom: null,\n\t\t\tleft: null,\n\t\t\tright: null,\n\t\t\twidthType,\n\t\t\theightType,\n\t\t\tmaxHeight: isValidConstraintValue(parentSizeInfo, maxHeight, \"height\") ? maxHeight : undefined,\n\t\t\tminHeight: isValidConstraintValue(parentSizeInfo, minHeight, \"height\") ? minHeight : undefined,\n\t\t\tmaxWidth: isValidConstraintValue(parentSizeInfo, maxWidth, \"width\") ? maxWidth : undefined,\n\t\t\tminWidth: isValidConstraintValue(parentSizeInfo, minWidth, \"width\") ? minWidth : undefined,\n\t\t}\n\n\t// If the node is using floating position, any position update should update its offset instead of the pins\n\tif (floatingPosition) {\n\t\tupdate.floatingOffsetX = getRelativeOffsetX(\n\t\t\tpins.left,\n\t\t\twidth,\n\t\t\tparentSizeForPositioning.width,\n\t\t\tfloatingPosition.floatingPlacement,\n\t\t\tfloatingPosition.floatingAlignment,\n\t\t)\n\t\tupdate.floatingOffsetY = getRelativeOffsetY(\n\t\t\tpins.top,\n\t\t\theight,\n\t\t\tparentSizeForPositioning.height,\n\t\t\tfloatingPosition.floatingPlacement,\n\t\t\tfloatingPosition.floatingAlignment,\n\t\t)\n\t} else {\n\t\tconst anchor = centerAnchor(Rect.halfPixelAligned(rect), parentSizeForPositioning)\n\t\tupdate = {\n\t\t\t...update,\n\t\t\tcenterAnchorX: anchor.x,\n\t\t\tcenterAnchorY: anchor.y,\n\t\t\ttop: constraints.top ? pins.top : null,\n\t\t\tbottom: constraints.bottom ? pins.bottom : null,\n\t\t\tleft: constraints.left ? pins.left : null,\n\t\t\tright: constraints.right ? pins.right : null,\n\t\t}\n\t}\n\n\tif (parentSizeInfo.layout === null) {\n\t\tif (widthType === DimensionType.FractionOfFreeSpace) {\n\t\t\tupdate.widthType = DimensionType.FixedNumber\n\t\t\tupdate.width = width\n\t\t}\n\n\t\tif (heightType === DimensionType.FractionOfFreeSpace) {\n\t\t\tupdate.heightType = DimensionType.FixedNumber\n\t\t\tupdate.height = height\n\t\t}\n\t}\n\n\t// Size update\n\tif (updateSize === false) return update\n\n\tswitch (widthType) {\n\t\t// FIXME: Auto-sized dimensions shouldn't need to have their value updated\n\t\t// by this function, but legacy auto-sized text depends on having a measured\n\t\t// size always available. Auto-sized text used to be defined as widthType:\n\t\t// DimensionType.FixedNumber and autoSize: true, which is why the\n\t\t// conditional below would set the width for an autoSized text node.\n\t\t// When text stops relying on Draft's size calculations, the part that tests\n\t\t// for the auto dimension type can be removed.\n\t\tcase DimensionType.FixedNumber:\n\t\tcase DimensionType.Auto: {\n\t\t\tupdate.width = width\n\t\t\tbreak\n\t\t}\n\t\tcase DimensionType.Percentage: {\n\t\t\t// A relative grid descendant size depends on the column and span settings, which gets complex to calculate.\n\t\t\t// Therefore if we encounter a percentage sized node in a grid, we just let it carry over whatever size it\n\t\t\t// has.\n\t\t\tif (parentSizeInfo.layout === \"grid\") break\n\t\t\tupdate.width = rect.width / parentSizeForSizing.width\n\t\t\tbreak\n\t\t}\n\t\tcase DimensionType.Viewport: {\n\t\t\tupdate.width = rect.width / parentSizeForSizing.width\n\t\t\tbreak\n\t\t}\n\t\tcase DimensionType.FractionOfFreeSpace:\n\t\tcase DimensionType.FitImage:\n\t\t\tbreak\n\t\tdefault:\n\t\t\tassertNever(widthType)\n\t}\n\n\tswitch (heightType) {\n\t\tcase DimensionType.FixedNumber:\n\t\tcase DimensionType.Auto: {\n\t\t\tupdate.height = height\n\t\t\tbreak\n\t\t}\n\t\tcase DimensionType.Percentage: {\n\t\t\t// A relative grid descendant size depends on the column and span settings, which gets complex to calculate.\n\t\t\t// Therefore if we encounter a percentage sized node in a grid, we just let it carry over whatever size it\n\t\t\t// has.\n\t\t\tif (parentSizeInfo.layout === \"grid\") break\n\t\t\tupdate.height = rect.height / parentSizeForSizing.height\n\t\t\tbreak\n\t\t}\n\t\tcase DimensionType.Viewport: {\n\t\t\tupdate.height = rect.height / parentSizeForSizing.height\n\t\t\tbreak\n\t\t}\n\t\tcase DimensionType.FractionOfFreeSpace:\n\t\tcase DimensionType.FitImage:\n\t\t\tbreak\n\t\tdefault:\n\t\t\tassertNever(heightType)\n\t}\n\n\treturn update\n}\n\nexport const canSetConstraint = (constraints: ConstraintMask, constraintKey: keyof ConstraintMask): boolean => {\n\tif (constraints.fixedSize) {\n\t\tif ([\"widthFactor\", \"heightFactor\", \"aspectRatio\"].includes(constraintKey)) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}\n\nconst opposingSides = {\n\tx: [\"left\", \"right\"],\n\ty: [\"top\", \"bottom\"],\n}\n\nexport const setConstraint = (\n\tnode: CanvasNode & WithPins & WithConstraints,\n\tconstraintKey: \"left\" | \"right\" | \"top\" | \"bottom\",\n\tenable: boolean,\n): ConstraintMask => {\n\tconst constraints = node.constraints()\n\tif (!canSetConstraint(constraints, constraintKey)) {\n\t\tthrow Error(\"Trying to solve constraint that can't be solved\")\n\t}\n\n\tconst result = { ...constraints, [constraintKey]: enable }\n\n\tif (!enable) {\n\t\treturn result\n\t}\n\n\tconst widthIsFlexible = constraints.widthType !== DimensionType.FixedNumber\n\tconst heightIsFlexible = constraints.heightType !== DimensionType.FixedNumber\n\n\tif (\n\t\t// Nodes that are sized by their contents cannot be constrained on\n\t\t// opposing sides.\n\t\t(isAutoDimensionType(result.widthType) && opposingSides.x.includes(constraintKey)) ||\n\t\t(isAutoDimensionType(result.heightType) && opposingSides.y.includes(constraintKey)) ||\n\t\t// Nodes that have max sizes cannot be constrained on opposing sides.\n\t\t(isNumber(result.maxWidth) && opposingSides.x.includes(constraintKey)) ||\n\t\t(isNumber(result.maxHeight) && opposingSides.y.includes(constraintKey)) ||\n\t\t// Vector instances can't be pinned top & bottom. Instances can be serialized to render with\n\t\t// an <img>, <div>, or <svg> tag. The browser requires <img> and <svg> tags to have an\n\t\t// intrinsic size. If they are given top/left/bottom pins, the browser assumes a right of 0\n\t\t// to create an intrinsic width, since width must be auto to allow it to be informed by the\n\t\t// aspect ratio and vertical pins. This causes instances to behave incorrectly when\n\t\t// repositioned: instead of moving to the left or right, the instance grows or shrinks as if\n\t\t// it were pinned to the right as well as the left.\n\t\t(isVectorInstance(node) && opposingSides.y.includes(constraintKey)) ||\n\t\tresult.fixedSize\n\t) {\n\t\tinactivateOpposingPin(result, constraintKey)\n\t} else if (isNumber(result.aspectRatio)) {\n\t\t// if other three pins are active, fix by flipping opposing pin\n\t\tif (otherThreePinsAreActive(result, constraintKey)) {\n\t\t\tinactivateOpposingPin(result, constraintKey)\n\t\t}\n\t}\n\tif (result.left && result.right && widthIsFlexible) {\n\t\tresult.widthType = DimensionType.FixedNumber\n\t}\n\tif (result.top && result.bottom && heightIsFlexible) {\n\t\tresult.heightType = DimensionType.FixedNumber\n\t}\n\n\tif (result.aspectRatio !== null) {\n\t\tconst widthControlsSize = widthIsFlexible || (result.left && result.right)\n\t\tconst heightControlsSize = heightIsFlexible || (result.top && result.bottom)\n\n\t\t// when aspect ratio is enabled, only one of both axis is allowed to control size\n\t\tif (widthControlsSize && heightControlsSize) {\n\t\t\tinactivateOpposingPin(result, constraintKey)\n\t\t}\n\t}\n\n\treturn result\n}\n\n// Helpers\nconst opposingSide: Record<PinPosition, PinPosition> = {\n\tleft: \"right\",\n\tright: \"left\",\n\ttop: \"bottom\",\n\tbottom: \"top\",\n}\n\nexport const canSetPins = (node: CanvasNode & WithPins & WithConstraints, pins: PinPosition[]) => {\n\tif (isShapeContainerNode(node)) {\n\t\treturn pins.every(pin => !pins.includes(opposingSide[pin]))\n\t}\n\n\tlet canSetVertical = true\n\tlet canSetHorizontal = true\n\tif (isAutoDimensionType(node.heightType)) {\n\t\tcanSetVertical = !(pins.includes(\"top\") && pins.includes(\"bottom\"))\n\t}\n\tif (isAutoDimensionType(node.widthType)) {\n\t\tcanSetHorizontal = !(pins.includes(\"left\") && pins.includes(\"right\"))\n\t}\n\n\treturn canSetVertical && canSetHorizontal\n}\n\nexport const inactivateOpposingPin = (constraints: ConstraintMask, constraintKey: keyof ConstraintMask) => {\n\tconst opposingKey = opposingSide[constraintKey]\n\tif (!opposingKey) return constraints\n\n\tconstraints[opposingKey] = false\n\n\treturn constraints\n}\n\nexport const allPinsAreActive = (constraints: ConstraintMask) => {\n\treturn [\"top\", \"bottom\", \"left\", \"right\"].every(side => !!constraints[side])\n}\n\nconst otherThreePinsAreActive = (constraints: ConstraintMask, constraintKey: keyof ConstraintMask): boolean => {\n\tconst sides = [\"top\", \"bottom\", \"left\", \"right\"].filter(side => {\n\t\treturn side !== constraintKey\n\t})\n\tconst values = sides.map(side => {\n\t\treturn constraints[side]\n\t})\n\treturn commonValue(values) === true\n}\n\n/**\n * Round the center point to the nearest pixel, unless it is a half pixel.\n * For half pixels we want to round towards 0 to avoid shifting positions.\n * e.g\n *   centerAnchor({x: 34.5, y: 34.51})   // {x: 34, y: 35}\n *   centerAnchor({x: 12, y: -12.5})   // {x: 12, y: -12}\n *   centerAnchor({x: 1.4, y: 18.71882})   // {x: 1, y: 19}\n */\nfunction roundCenterPoint(point: Point) {\n\tif (isHalfPixel(point.x)) {\n\t\tpoint.x = Math.trunc(point.x)\n\t} else {\n\t\tpoint.x = Math.round(point.x)\n\t}\n\n\tif (isHalfPixel(point.y)) {\n\t\tpoint.y = Math.trunc(point.y)\n\t} else {\n\t\tpoint.y = Math.round(point.y)\n\t}\n}\n\nfunction isHalfPixel(value: number) {\n\treturn Math.abs((value % 1) - 0.5) <= Number.EPSILON\n}\n\nexport const centerAnchor = (rect: Rect, parentSize: Size) => {\n\tconst centerPoint = Rect.center(rect)\n\n\t// When a DOM layout-enabled node is centered, it will use the center anchor\n\t// for a left/top absolute position. In this case, it's not preferable to\n\t// have the center point sit on a half-pixel, because this could result in a\n\t// shift in position AND size between layout and painted rect. To minimize\n\t// the chance of this happening, we round the center point.\n\troundCenterPoint(centerPoint)\n\n\t// Protect against parent size possibly having zero width or height. Or we run into trouble\n\t// later with matrixes that have Inifity in them.\n\tconst parentWidth = parentSize.width !== 0 ? parentSize.width : centerPoint.x * 2\n\tconst parentHeight = parentSize.height !== 0 ? parentSize.height : centerPoint.y * 2\n\n\t// The calculated center anchor needs to have epsilon added, because later\n\t// it will go through multiplication by 100 to turn it into a percentage,\n\t// which will cause it to lose enough precision to make it unusable when\n\t// pixel-aligning rects computed using this anchor.\n\t//\n\t// Here's a concrete example:\n\t//\n\t// The center anchor for a frame with width: 43, positioned at x: 80 in a\n\t// parent of width: 186 is 0.43010752688172044. When that gets turned into a\n\t// string later, it will be multiplied by 100, which will result in the\n\t// string \"43.01075268817204%\". Notice that the last 4 is now missing. When\n\t// this gets parsed back into a float and divided by 100, it will result in\n\t// 0.4301075268817204, which is ever so slightly smaller than the original\n\t// number. When we compute a position based on this number, we do the\n\t// following:\n\t//      x = round(centerAnchorX * parentWidth - width / 2)\n\t// For the numbers we have above, this yields:\n\t//      x = round(79.99999999999999 - 43 / 2) = round(58.499999999999986)\n\t// Since this number is under 58.5, it will get rounded to 58, not 59. If we\n\t// do the same math using the original numbers, we'll get 58.5, which will\n\t// get rounded to 59. To prevent this situation, we add epsilon to the\n\t// anchor values, which will increase them just enough for the loss in\n\t// precision not to matter.\n\treturn {\n\t\tx: centerPoint.x / parentWidth + Number.EPSILON,\n\t\ty: centerPoint.y / parentHeight + Number.EPSILON,\n\t}\n}\n", "import { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isArray, isObject, isString } from \"utils/typeChecks.ts\"\nimport type { CanvasTree, CodeComponentNode, NodeID } from \"../CanvasTree/index.ts\"\nimport { isRawControlProp } from \"./RawControlProp.ts\"\n\nfunction linkSlotChanges(tree: CanvasTree, slotContentId: NodeID, codeComponentNode: CodeComponentNode) {\n\tconst slotContent = tree.get(slotContentId)\n\tif (!slotContent) return\n\n\tslotContent.linkTo(codeComponentNode.id)\n}\n\n/** Make sure the code component re-renders when the slot content nodes update. */\nexport function linkSlotContentChanges(tree: CanvasTree, codeComponentNode: CodeComponentNode) {\n\tconst rawControlProps = codeComponentNode.getRawControlProps()\n\n\tfor (const key in rawControlProps) {\n\t\tconst rawControlProp = rawControlProps[key]\n\t\tif (!rawControlProp) continue\n\n\t\tif (rawControlProp.type === ControlType.Slot && isArray(rawControlProp.value)) {\n\t\t\tfor (const slotItem of rawControlProp.value) {\n\t\t\t\tif (!isObject(slotItem)) continue\n\t\t\t\tconst referenceKey: keyof typeof slotItem = \"reference\"\n\t\t\t\tconst reference = slotItem[referenceKey]\n\t\t\t\tif (!isString(reference)) continue\n\t\t\t\tlinkSlotChanges(tree, reference, codeComponentNode)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif (rawControlProp.type === ControlType.ComponentInstance && isString(rawControlProp.value)) {\n\t\t\tlinkSlotChanges(tree, rawControlProp.value, codeComponentNode)\n\t\t\tcontinue\n\t\t}\n\n\t\tif (isArray(rawControlProp.value)) {\n\t\t\tswitch (rawControlProp.type) {\n\t\t\t\tcase null:\n\t\t\t\tcase ControlType.Array:\n\t\t\t\tcase ControlType.ComponentInstance:\n\t\t\t\t\tfor (const arrayItem of rawControlProp.value) {\n\t\t\t\t\t\tif (!isRawControlProp(arrayItem)) continue\n\t\t\t\t\t\tif (arrayItem.type !== ControlType.ComponentInstance) continue\n\t\t\t\t\t\tif (!isString(arrayItem.value)) continue\n\t\t\t\t\t\tlinkSlotChanges(tree, arrayItem.value, codeComponentNode)\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n", "import type { WithBoxShadow } from \"./WithBoxShadow.ts\"\n\nexport const boxShadowDefaults: WithBoxShadow = {\n\tboxShadows: undefined,\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { ExportOptions } from \"document/models/CanvasTree/nodes/ExportOptions.ts\"\nimport type { Reduced } from \"./utils/Reduced.ts\"\n\nexport type ExportType = \"png\" | \"jpg\" | \"svg\"\nexport type ExportScale = 0.5 | 1 | 1.5 | 2 | 3 | 4\nexport type ExportExtensionMode = \"Suffix\" | \"Prefix\" | \"Folder\"\n\nexport interface Export {\n\tid: string\n\t/** @deprecated TODO: Remove with migration */\n\tenabled: boolean\n\ttype: ExportType\n\tscale: ExportScale\n\tnameExtension: string\n\tnameExtensionMode: ExportExtensionMode\n}\n\nexport interface WithExport {\n\texportOptions: readonly ExportOptions[]\n}\n\nexport interface WithExportIncludesBackground extends WithExport {\n\texportIncludesBackground: boolean\n}\n\nexport const withExportDefaults = {\n\texportOptions: [],\n}\n\nexport const withExportIncludesBackgroundDefaults = {\n\texportIncludesBackground: false,\n}\n\nconst exportKey: keyof WithExport = \"exportOptions\"\n\nexport function withExport(node: CanvasNode): node is CanvasNode & WithExport {\n\treturn exportKey in node\n}\n\nconst includeBackgroundKey: keyof WithExportIncludesBackground = \"exportIncludesBackground\"\n\nexport function withExportIncludesBackground(node: CanvasNode): node is CanvasNode & WithExportIncludesBackground {\n\treturn includeBackgroundKey in node\n}\n\nexport interface ExportOptionRow {\n\tid: string\n\tuid: string\n\tidOccurrence: number\n\tenabled: Reduced<boolean>\n\ttype: ExportType\n\tscale: ExportScale\n\tnameExtension: Reduced<string>\n\tnameExtensionMode: ExportExtensionMode\n}\n", "import type {\n\tWithFill,\n\tWithFillImageAlts,\n\tWithFillImageLocalized,\n\tWithInputFill,\n\tWithOptionalFill,\n} from \"document/models/CanvasTree/traits/WithFill.ts\"\n\nexport const fillDefaults: WithOptionalFill = {\n\tfillEnabled: true,\n\tfillType: \"color\",\n\tfillColor: \"rgba(255,255,255,1)\",\n\tfillLinearGradient: undefined,\n\tfillRadialGradient: undefined,\n\tfillConicGradient: undefined,\n\tfillImage: null,\n\tfillImageOriginalName: null,\n\tfillImageResize: \"fill\",\n\tfillImagePixelWidth: null,\n\tfillImagePixelHeight: null,\n\tfillImagePositionX: undefined,\n\tfillImagePositionY: undefined,\n\tfillImageTileSize: undefined,\n}\n\nexport const frameFillDefaults: WithOptionalFill & WithFillImageLocalized & WithFillImageAlts = {\n\t...fillDefaults,\n\tfillImageLocalized: undefined,\n\tfillImageAlts: undefined,\n}\n\nexport const inputFillDefaults: WithInputFill = {\n\tfillEnabled: undefined,\n\tfillColor: undefined,\n\tfillType: undefined,\n\tfillLinearGradient: undefined,\n\tfillRadialGradient: undefined,\n\tfillConicGradient: undefined,\n}\n\nexport const codeComponentFillDefaults: WithOptionalFill = {\n\t...fillDefaults,\n\tfillEnabled: false,\n}\n\nexport const svgFillDefaults: WithFill = {\n\tfillType: \"color\",\n\tfillColor: \"rgba(0,0,0,1)\",\n\tfillLinearGradient: undefined,\n\tfillRadialGradient: undefined,\n\tfillConicGradient: undefined,\n\tfillImage: null,\n\tfillImageOriginalName: null,\n\tfillImageResize: \"fill\",\n\tfillImagePixelWidth: null,\n\tfillImagePixelHeight: null,\n\tfillImagePositionX: undefined,\n\tfillImagePositionY: undefined,\n\tfillImageTileSize: undefined,\n}\n\nexport const pathFillDefaults: WithOptionalFill = {\n\tfillEnabled: false,\n\tfillType: \"color\",\n\tfillColor: \"rgba(0,170,255,0.5)\",\n\tfillLinearGradient: undefined,\n\tfillRadialGradient: undefined,\n\tfillConicGradient: undefined,\n\tfillImage: null,\n\tfillImageOriginalName: null,\n\tfillImageResize: \"fill\",\n\tfillImagePixelWidth: null,\n\tfillImagePixelHeight: null,\n\tfillImagePositionX: undefined,\n\tfillImagePositionY: undefined,\n\tfillImageTileSize: undefined,\n}\n\nexport const shapeFillDefaults = {\n\tfillEnabled: true,\n\tfillType: \"color\",\n\tfillColor: \"#CCC\",\n\tfillLinearGradient: undefined,\n\tfillRadialGradient: undefined,\n\tfillConicGradient: undefined,\n\tfillImage: null,\n\tfillImageOriginalName: null,\n\tfillImageResize: \"fill\",\n\tfillImagePixelWidth: null,\n\tfillImagePixelHeight: null,\n\tfillImagePositionX: undefined,\n\tfillImagePositionY: undefined,\n\tfillImageTileSize: undefined,\n} as const satisfies WithOptionalFill\n\nexport const shapeContainerFillDefaults: WithOptionalFill = {\n\tfillEnabled: true,\n\tfillType: \"color\",\n\tfillColor: \"#FFF\",\n\tfillLinearGradient: undefined,\n\tfillRadialGradient: undefined,\n\tfillConicGradient: undefined,\n\tfillImage: null,\n\tfillImageOriginalName: null,\n\tfillImageResize: \"fill\",\n\tfillImagePixelWidth: null,\n\tfillImagePixelHeight: null,\n\tfillImagePositionX: undefined,\n\tfillImagePositionY: undefined,\n\tfillImageTileSize: undefined,\n}\n", "import { Mixed, isMixed } from \"@framerjs/shared\"\nimport type { AnySmartComponentNode, CanvasNode, CanvasTree } from \"document/models/CanvasTree/index.ts\"\nimport type { PrefixedControlPropKey } from \"document/models/controlProps/controlPropKey.ts\"\nimport { isEqual } from \"library/render/utils/isEqual.ts\"\nimport { isCodeComponentNode } from \"../nodes/utils/nodeCheck.ts\"\nimport { getSmartComponentForCodeComponent } from \"../nodes/utils/smartComponentInstanceHelpers.ts\"\nimport { type Generated, getGeneratedValue } from \"./Generated.ts\"\nimport { isReplicaVariantOrReplicaVariantChild } from \"./WithVariant.ts\"\nimport type { Reduced } from \"./utils/Reduced.ts\"\nimport { isNotFound } from \"./utils/Reduced.ts\"\nimport { reduceProperty } from \"./utils/reduceProperty.ts\"\n\nexport const defaultCustomizationCategories = [\n\t\"404\",\n\t\"About\",\n\t\"Blog\",\n\t\"CTA\",\n\t\"FAQ\",\n\t\"Features\",\n\t\"Footer\",\n\t\"Grid\",\n\t\"Hero\",\n\t\"Navigation\",\n\t\"Pricing\",\n\t\"Paragraph\",\n\t\"Portfolio\",\n\t\"Testimonials\",\n] as const\n\nexport const defaultLayoutTemplateCategories = [\"layout-navigation-footer\", \"layout-sidebar\"] as const\n\ntype NestedPrefixedControlPropKey = `${PrefixedControlPropKey}${string}`\n\ntype CustomizationContentProperty = \"textContent\" | PrefixedControlPropKey | NestedPrefixedControlPropKey\nexport type CustomizationFieldType = \"text\" | \"icon\" | \"image\"\n\nexport interface Customization {\n\tid: string\n\ttype: \"content\"\n\tproperty: CustomizationContentProperty\n\tfieldType: CustomizationFieldType\n\tfieldPath: string\n\tfieldOptions?: Record<string, string>\n}\n\nexport interface WithCustomizations {\n\t// Currently an array for potential future extensibility, but only one customization is supported per node.\n\tcustomizations: readonly Customization[] | undefined\n\t/** Since kits this description is AI generated */\n\tcustomizationsDescription: string | undefined\n\t/** @deprecated Use kitSectionSource.section instead. That value will use the kit section node id. */\n\tcustomizationsSectionId: string | undefined\n\tcustomizationsCategory: string | Generated<string> | undefined\n\tcustomizationsRules: readonly string[] | undefined\n\tisApplyingCustomizations: true | undefined\n}\n\nexport const withCustomizationsKey: keyof WithCustomizations = \"customizations\"\n\nexport const customizationsDefaults: WithCustomizations = {\n\tcustomizations: undefined,\n\tcustomizationsDescription: undefined,\n\tcustomizationsSectionId: undefined,\n\tcustomizationsCategory: undefined,\n\tcustomizationsRules: undefined,\n\tisApplyingCustomizations: undefined,\n}\n\nexport function isCustomizable<T extends CanvasNode>(node: T | null | undefined): node is T & WithCustomizations {\n\tif (!node) return false\n\t// We don't allow replicas to be customizable for now, maybe in the future.\n\treturn withCustomizations(node) && !isReplicaVariantOrReplicaVariantChild(node)\n}\n\nexport function withCustomizations<T extends CanvasNode>(node: T): node is T & WithCustomizations {\n\treturn withCustomizationsKey in node\n}\n\nexport interface HasCustomizations extends WithCustomizations {\n\tcustomizations: readonly Customization[]\n}\n\nexport function hasCustomizations<T extends CanvasNode>(node: T | null | undefined): node is T & HasCustomizations {\n\treturn isCustomizable(node) && Array.isArray(node.customizations) && node.customizations.length > 0\n}\n\nexport interface ReducedCustomizations {\n\tonlyNodesWithCustomizations: boolean\n\tcustomizations: Reduced<readonly Customization[]>\n\tcustomizationsDescription: Reduced<string | undefined>\n\tcustomizationsSectionId: Reduced<string | undefined>\n\tcustomizationsCategory: Reduced<string | undefined>\n\tcustomizationsRules: Reduced<readonly string[] | undefined>\n}\n\nexport function reduceCustomizations(tree: CanvasTree, node: CanvasNode, result: ReducedCustomizations) {\n\t// We ignore variants (breakpoints) because we don't want to support overrides at this time.\n\tif (!isCustomizable(node) || isReplicaVariantOrReplicaVariantChild(node)) {\n\t\tresult.onlyNodesWithCustomizations = false\n\t\treturn\n\t}\n\n\treduceCustomizationsValue(node, result)\n\treduceProperty(\"customizationsSectionId\", result, node)\n\treduceProperty(\"customizationsRules\", result, node)\n\treduceProperty(\"customizationsDescription\", result, node)\n\n\tconst sourceNode = getSourceNodeForSection(tree, node)\n\tconst category = getGeneratedValue(sourceNode.customizationsCategory)\n\tif (isNotFound(result.customizationsCategory)) {\n\t\tresult.customizationsCategory = category\n\t} else if (result.customizationsCategory !== category) {\n\t\tresult.customizationsCategory = Mixed\n\t}\n}\n\nexport function isSmartComponentSourceNode<T extends AnySmartComponentNode>(node: T | undefined | null): node is T {\n\treturn !!(node && node.variables.length === 0)\n}\n\nexport function getSourceNodeForSection<T extends CanvasNode & WithCustomizations>(\n\ttree: CanvasTree,\n\tnode: T,\n): T | AnySmartComponentNode {\n\tif (isCodeComponentNode(node)) {\n\t\tconst smartComponent = getSmartComponentForCodeComponent(tree, node)\n\t\tif (isSmartComponentSourceNode(smartComponent)) return smartComponent\n\t}\n\treturn node\n}\n\nconst emptyCustomizations: readonly Customization[] = []\nfunction reduceCustomizationsValue(node: CanvasNode & WithCustomizations, result: ReducedCustomizations) {\n\tconst reducedValue = result.customizations\n\tif (isMixed(reducedValue)) return\n\n\tconst nodeValue = node.customizations ?? emptyCustomizations\n\tif (isNotFound(reducedValue)) {\n\t\tresult.customizations = nodeValue\n\t} else if (!isEqual(nodeValue, reducedValue)) {\n\t\tresult.customizations = Mixed\n\t}\n}\n\n/**\n * This util is used to subset the customization type to the AI v2 needs (only text content customizations).\n */\nexport function isTextContentCustomization(customization: Customization): boolean {\n\treturn customization.fieldType === \"text\"\n}\n\n/**\n * This util is used to subset the customization type to the AI v2 needs (only icon content customizations).\n */\nexport function isIconContentCustomization(customization: Customization): boolean {\n\treturn customization.fieldType === \"icon\"\n}\n", "import type {\n\tAnyComponentLoader,\n\tNavigateActionAppearsFrom,\n\tNavigateActionTransitionType,\n\tNavigateOptions,\n} from \"@framerjs/framer-runtime\"\nimport { navigateActionControlTypes, navigateActionDefaults } from \"@framerjs/framer-runtime\"\nimport type { EventAction } from \"document/models/EventAction.ts\"\nimport { isEventAction } from \"document/models/EventAction.ts\"\nimport { isObject, isString } from \"utils/typeChecks.ts\"\nimport { v4 as uuid } from \"uuid\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport type { MaybeNodeID } from \"../nodes/NodeID.ts\"\nimport { keyDownKey } from \"../traits/WithFrameEvents.ts\"\nimport { HardCodedCodeIdentifier } from \"../traits/utils/hardCodedCodeComponentIdentifiers.ts\"\nimport type { ActionControlValues, OverrideType } from \"./actions.ts\"\nimport { containsActionsOfType, getActionsOfType } from \"./actions.ts\"\n\ntype NavigationActionModel = OverrideType<NavigateOptions, { target: string }>\ntype NavigationActionControls = ActionControlValues<NavigationActionModel>\n\nconst controlDefaults: NavigationActionControls = {\n\ttype: {\n\t\ttype: navigateActionControlTypes.type,\n\t\tvalue: navigateActionDefaults.type,\n\t},\n\ttarget: {\n\t\ttype: navigateActionControlTypes.target,\n\t\tvalue: \"\",\n\t},\n\ttransition: {\n\t\ttype: navigateActionControlTypes.transition,\n\t\tvalue: navigateActionDefaults.transition,\n\t},\n\tappearsFrom: {\n\t\ttype: navigateActionControlTypes.appearsFrom,\n\t\tvalue: navigateActionDefaults.appearsFrom,\n\t},\n\tbackdropColor: {\n\t\ttype: navigateActionControlTypes.backdropColor,\n\t\tvalue: navigateActionDefaults.backdropColor,\n\t},\n\tanimation: {\n\t\ttype: navigateActionControlTypes.animation,\n\t\tvalue: navigateActionDefaults.animation,\n\t},\n}\n\nexport const navigationActionKeys: { [Key in keyof NavigationActionModel]: Key } = {\n\ttype: \"type\",\n\ttarget: \"target\",\n\ttransition: \"transition\",\n\tappearsFrom: \"appearsFrom\",\n\tbackdropColor: \"backdropColor\",\n\tanimation: \"animation\",\n}\n\nexport interface NavigationAction extends EventAction {\n\tcontrols: NavigationActionControls\n}\n\nconst transitionMap: { [key in NavigateActionTransitionType]: true } = {\n\tfade: true,\n\tflip: true,\n\tinstant: true,\n\tmagicMotion: true,\n\tmodal: true,\n\toverlay: true,\n\tpush: true,\n}\n\nconst appearsFromMap: { [key in NavigateActionAppearsFrom]: true } = {\n\tleft: true,\n\tright: true,\n\ttop: true,\n\tbottom: true,\n}\n\nexport function isNavigateTransition(value: unknown): value is NavigateActionTransitionType {\n\treturn isString(value) && value in transitionMap\n}\n\nexport function isNavigateAppearsFrom(value: unknown): value is NavigateActionAppearsFrom {\n\treturn isString(value) && value in appearsFromMap\n}\n\nexport function isNavigationAction(value: unknown): value is NavigationAction {\n\treturn isEventAction(value) && value.actionIdentifier === HardCodedCodeIdentifier.navigationAction\n}\n\nexport function getNavigationTarget(action: NavigationAction): MaybeNodeID {\n\tif (action.controls.type?.value !== \"next\") return null\n\treturn action.controls.target?.value ?? null\n}\n\nexport function containsNavigationActionWithoutTarget(value: unknown) {\n\treturn (\n\t\tArray.isArray(value) &&\n\t\tvalue.some(\n\t\t\taction => isNavigationAction(action) && action.controls.type?.value === \"next\" && !action.controls.target?.value,\n\t\t)\n\t)\n}\n\nexport function hasNavigationLinks(node: CanvasNode, componentLoader: AnyComponentLoader): boolean {\n\treturn containsActionsOfType(node, isNavigationAction, componentLoader)\n}\n\nexport function getNavigationActions(node: CanvasNode, componentLoader: AnyComponentLoader): NavigationAction[] {\n\treturn getActionsOfType(node, isNavigationAction, componentLoader)\n}\n\nexport function getNavigateOptionsFromActionControls(controls: NavigationAction[\"controls\"]): Partial<NavigateOptions> {\n\tconst options: Partial<NavigateOptions> = {}\n\n\tObject.entries(controls).forEach(([key, control]) => {\n\t\toptions[key] = control?.value\n\t})\n\n\treturn options\n}\n\nexport type UpdateNavigationTargetOptions = Partial<NavigationActionModel>\n\nexport function isNavigationTargetOptions(value: unknown): value is UpdateNavigationTargetOptions {\n\tif (!isObject(value)) return false\n\tif (!(\"target\" in value && isString(value.target))) return false\n\tif (!(\"transition\" in value && isNavigateTransition(value.transition))) return false\n\treturn true\n}\n\nexport function updateNavigationTarget(\n\teventKey: string,\n\tactions: unknown,\n\tcontrolOverrides: UpdateNavigationTargetOptions,\n\tmeta?: NavigationAction[\"meta\"],\n): EventAction[] {\n\tconst result: EventAction[] = Array.isArray(actions) ? [...actions] : []\n\n\tconst navigationActionIndex = result.findIndex(isNavigationAction)\n\tconst existingNavigationAction = result[navigationActionIndex]\n\tif (isNavigationAction(existingNavigationAction) && eventKey !== keyDownKey) {\n\t\tconst controls: Readonly<NavigationActionControls> = {\n\t\t\t...existingNavigationAction.controls,\n\t\t\t...addControlTypesToModel({\n\t\t\t\ttype: \"next\",\n\t\t\t\t...controlOverrides,\n\t\t\t}),\n\t\t}\n\t\tconst newAction: EventAction = {\n\t\t\t...existingNavigationAction,\n\t\t\tcontrols: controls,\n\t\t\tmeta: { ...existingNavigationAction.meta, ...meta },\n\t\t}\n\t\tresult[navigationActionIndex] = newAction\n\t} else {\n\t\tconst action = createNavigationAction(controlOverrides, meta)\n\t\tresult.push(action)\n\t}\n\n\treturn result\n}\n\nfunction addControlTypesToModel(model: Partial<NavigationActionModel>): Partial<NavigationActionControls> {\n\tconst modelWithTypes: Partial<NavigationActionControls> = {}\n\n\tObject.entries(model).forEach(([key, value]) => {\n\t\tmodelWithTypes[key] = {\n\t\t\ttype: navigateActionControlTypes[key],\n\t\t\tvalue,\n\t\t}\n\t})\n\n\treturn modelWithTypes\n}\n\nexport function createNavigationAction(\n\tcontrolOverrides?: Partial<NavigationActionModel>,\n\tmeta?: NavigationAction[\"meta\"],\n\tid?: string,\n) {\n\tconst modelWithTypes = addControlTypesToModel({ ...controlOverrides })\n\n\tconst newAction: NavigationAction = {\n\t\tidentifier: id ? id : uuid(),\n\t\tactionIdentifier: HardCodedCodeIdentifier.navigationAction,\n\t\tcontrols: {\n\t\t\t...controlDefaults,\n\t\t\t...modelWithTypes,\n\t\t},\n\t\tmeta,\n\t}\n\n\treturn newAction\n}\n\nexport function updatedNavigationAction(\n\taction: NavigationAction,\n\tcontrolOverrides: Partial<NavigationActionControls>,\n): NavigationAction {\n\tconst controls = {\n\t\t...action.controls,\n\t\t...controlOverrides,\n\t}\n\treturn { ...action, controls }\n}\n", "import {\n\ttriggerEventActionCreateConsoleLogEvent,\n\ttriggerEventActionCreateCustomEvent,\n\ttriggerEventActionCreateNavigateEvent,\n\ttriggerEventActionCreateOpenUrlEvent,\n\ttriggerEventActionUpdateConsoleLogEvent,\n\ttriggerEventActionUpdateCustomEvent,\n\ttriggerEventActionUpdateNavigateEvent,\n\ttriggerEventActionUpdateOpenUrlEvent,\n} from \"@framerjs/framer-events\"\nimport { isNavigationAction } from \"document/models/CanvasTree/actions/navigationActions.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isCodeComponentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { HardCodedCodeIdentifier } from \"document/models/CanvasTree/traits/utils/hardCodedCodeComponentIdentifiers.ts\"\nimport type { EventAction } from \"document/models/EventAction.ts\"\nimport { isEventAction, isRecordedGamepadKey } from \"document/models/EventAction.ts\"\n\nfunction actionTrackingBase(action: EventAction, eventKey: string, node: CanvasNode) {\n\treturn {\n\t\tidentifier: action.identifier,\n\t\tactionIdentifier: action.actionIdentifier,\n\t\teventHandler: eventKey,\n\t\tnodeType: node.__class,\n\t\tcodeComponentIdentifier: isCodeComponentNode(node) ? node.codeComponentIdentifier : undefined,\n\t}\n}\n\nexport function trackActionCreation({\n\taction,\n\teventKey,\n\tnode,\n}: {\n\taction: EventAction\n\teventKey: string\n\tnode: CanvasNode\n}) {\n\tif (!isEventAction(action)) return\n\n\tswitch (action.actionIdentifier) {\n\t\tcase HardCodedCodeIdentifier.navigationAction: {\n\t\t\tif (isNavigationAction(action)) {\n\t\t\t\ttriggerEventActionCreateNavigateEvent({\n\t\t\t\t\t...actionTrackingBase(action, eventKey, node),\n\t\t\t\t\ttransitionType: action.controls.transition?.value,\n\t\t\t\t\ttarget: action.controls.type?.value === \"next\" ? \"next\" : \"previous\",\n\t\t\t\t\tdelay: action.meta?.delay,\n\t\t\t\t\tkey: generateKeyInputStringForAction(action),\n\t\t\t\t})\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tcase HardCodedCodeIdentifier.openURLAction: {\n\t\t\tconst url = action.controls?.url?.value\n\t\t\ttriggerEventActionCreateOpenUrlEvent({\n\t\t\t\t...actionTrackingBase(action, eventKey, node),\n\t\t\t\turl: typeof url === \"string\" ? url : undefined,\n\t\t\t})\n\t\t\tbreak\n\t\t}\n\t\tcase HardCodedCodeIdentifier.consoleLogAction:\n\t\t\ttriggerEventActionCreateConsoleLogEvent({\n\t\t\t\t...actionTrackingBase(action, eventKey, node),\n\t\t\t})\n\t\t\tbreak\n\t\tdefault: {\n\t\t\ttriggerEventActionCreateCustomEvent(actionTrackingBase(action, eventKey, node))\n\t\t\tbreak\n\t\t}\n\t}\n}\n\nexport function trackActionUpdate({\n\tnewAction,\n\toldAction,\n\teventKey,\n\tnode,\n}: {\n\tnewAction: EventAction\n\toldAction: EventAction\n\teventKey: string\n\tnode: CanvasNode\n}) {\n\tif (!isEventAction(newAction) || !isEventAction(oldAction)) return\n\n\tswitch (newAction.actionIdentifier) {\n\t\tcase HardCodedCodeIdentifier.navigationAction: {\n\t\t\tif (isNavigationAction(newAction) && isNavigationAction(oldAction)) {\n\t\t\t\ttriggerEventActionUpdateNavigateEvent({\n\t\t\t\t\t...actionTrackingBase(newAction, eventKey, node),\n\t\t\t\t\toldTransitionType: oldAction.controls.transition?.value,\n\t\t\t\t\tnewTransitionType: newAction.controls.transition?.value,\n\t\t\t\t\toldTarget: oldAction.controls.type?.value === \"next\" ? \"next\" : \"previous\",\n\t\t\t\t\tnewTarget: newAction.controls.type?.value === \"next\" ? \"next\" : \"previous\",\n\t\t\t\t\toldDelay: oldAction.meta?.delay,\n\t\t\t\t\tnewDelay: newAction.meta?.delay,\n\t\t\t\t\toldKey: generateKeyInputStringForAction(oldAction),\n\t\t\t\t\tnewKey: generateKeyInputStringForAction(newAction),\n\t\t\t\t})\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tcase HardCodedCodeIdentifier.openURLAction: {\n\t\t\tconst url = newAction.controls?.url?.value\n\t\t\ttriggerEventActionUpdateOpenUrlEvent({\n\t\t\t\t...actionTrackingBase(newAction, eventKey, node),\n\t\t\t\turl: typeof url === \"string\" ? url : undefined,\n\t\t\t})\n\t\t\tbreak\n\t\t}\n\t\tcase HardCodedCodeIdentifier.consoleLogAction:\n\t\t\ttriggerEventActionUpdateConsoleLogEvent(actionTrackingBase(newAction, eventKey, node))\n\t\t\tbreak\n\t\tdefault: {\n\t\t\ttriggerEventActionUpdateCustomEvent(actionTrackingBase(newAction, eventKey, node))\n\t\t\tbreak\n\t\t}\n\t}\n}\n\nconst modifiersMap = {\n\taltKey: \"alt\",\n\tctrlKey: \"ctrl\",\n\tmetaKey: \"meta\",\n\tshiftKey: \"shift\",\n}\n\nfunction generateKeyInputStringForAction(action: EventAction): string | undefined {\n\tconst keyInput = action.meta?.key\n\tif (!keyInput) return undefined\n\n\tif (isRecordedGamepadKey(keyInput)) {\n\t\tconst { gamepadId, mapping, key } = keyInput\n\t\treturn `${gamepadId}-${mapping}-${key}`\n\t}\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tconst { key, code, keyCode, ...modifiers } = keyInput\n\tconst keys: string[] = []\n\tfor (const modifier in modifiers) {\n\t\tif (modifiersMap[modifier] && keyInput[modifier] === true) {\n\t\t\tkeys.push(modifiersMap[modifier])\n\t\t}\n\t}\n\tif (keyCode) keys.push(keyCode.toString())\n\treturn keys.join(\"+\")\n}\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport type { EventAction } from \"document/models/EventAction.ts\"\nimport type { CanvasNode } from \"../index.ts\"\n\nexport interface EventActionMap {\n\t[eventKey: string]: EventAction[] | undefined\n}\n\nexport interface WithEventActions {\n\tgetActions(componentLoader: AnyComponentLoader): EventActionMap\n}\n\nconst key: keyof WithEventActions = \"getActions\"\n\nexport function withEventActions(node: CanvasNode): node is CanvasNode & WithEventActions {\n\treturn key in node\n}\n", "import type { AnyComponentLoader, EntityDefinition } from \"@framerjs/framer-runtime\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport {\n\ttrackActionCreation,\n\ttrackActionUpdate,\n} from \"document/components/chrome/properties/panels/utils/eventActionTracking.ts\"\nimport { isTriggerEventAction } from \"document/models/CanvasTree/actions/triggerEventActions.ts\"\nimport type {\n\tAnyScopeNode,\n\tCanvasNode,\n\tCanvasTree,\n\tCodeComponentNode,\n\tNodeID,\n} from \"document/models/CanvasTree/index.ts\"\nimport { generateReplicaChildId, TemplateHelper } from \"document/models/CanvasTree/nodes/TemplateHelper.ts\"\nimport {\n\tisCodeComponentNode,\n\tisDesignPageNode,\n\tisSmartComponentNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { type WithEventActions, withEventActions } from \"document/models/CanvasTree/traits/WithEventActions.ts\"\nimport type { WithFrameEvents } from \"document/models/CanvasTree/traits/WithFrameEvents.ts\"\nimport { getFrameEventKeys, withFrameEvents } from \"document/models/CanvasTree/traits/WithFrameEvents.ts\"\nimport type { IsReplica } from \"document/models/CanvasTree/traits/WithTemplate.ts\"\nimport type { VariableDefinition } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { isVariableDefinition } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { WithFormInputEvents } from \"document/models/CanvasTree/traits/forms/WithFormInputEvents.ts\"\nimport { formInputEventKeys, withFormInputEvents } from \"document/models/CanvasTree/traits/forms/WithFormInputEvents.ts\"\nimport type { EventAction } from \"document/models/EventAction.ts\"\nimport { isEventAction } from \"document/models/EventAction.ts\"\nimport type { ControlProps } from \"document/models/controlProps/ControlProp.ts\"\nimport { prefixControlPropKey, prefixControlProps } from \"document/models/controlProps/controlPropKey.ts\"\nimport { getControlProps } from \"document/models/controlProps/getControlProps.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isArray } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport { v4 as uuid } from \"uuid\"\n\ninterface NodeEvents {\n\t[key: string]: EventAction[]\n}\n\nexport function eventsForNode(componentLoader: AnyComponentLoader, node: CanvasNode): Readonly<NodeEvents> {\n\tconst result: NodeEvents = {}\n\tif (withFrameEvents(node)) {\n\t\tgetFrameEventKeys(node).forEach(eventKey => {\n\t\t\tresult[eventKey] = (node[eventKey as keyof typeof node] || []) as EventAction[]\n\t\t})\n\t} else if (withFormInputEvents(node)) {\n\t\tformInputEventKeys.forEach(eventKey => {\n\t\t\tresult[eventKey] = (node[eventKey] || []) as EventAction[]\n\t\t})\n\t} else if (isCodeComponentNode(node)) {\n\t\tconst component = componentLoader.reactComponentForIdentifier(node.codeComponentIdentifier)\n\n\t\tif (component) {\n\t\t\tfor (const controlKey in component.properties) {\n\t\t\t\tconst control = component.properties[controlKey]\n\t\t\t\tif (control?.type !== ControlType.EventHandler) continue\n\n\t\t\t\tconst controlProp = node.getRawControlProp(controlKey)\n\t\t\t\tresult[controlKey] = controlProp && Array.isArray(controlProp.value) ? controlProp.value : []\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}\n\n// Add a new action to the given event key, return the added action.\nexport const addActionToEventKey = (\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tnode: CodeComponentNode | (CanvasNode & WithFrameEvents) | (CanvasNode & WithFormInputEvents),\n\teventKey: string,\n\taction: EntityDefinition,\n\tcontrolOverrides?: ControlProps,\n\tskipTracking?: boolean,\n): EventAction => {\n\tconst nodeEvents = eventsForNode(componentLoader, node)\n\tconst eventActions = nodeEvents[eventKey] ?? []\n\n\tconst newAction: EventAction = {\n\t\tidentifier: uuid(),\n\t\tactionIdentifier: action.identifier,\n\t\tcontrols: {\n\t\t\t// Unfortunately we can't pass the control overrides into `getControlProps` here,\n\t\t\t// because some custom first class actions are misbehaving and haven't defined all of\n\t\t\t// their controls. And otherwise the overrides would immediately be lost.\n\t\t\t...getControlProps(action.properties, {}),\n\t\t\t...controlOverrides,\n\t\t},\n\t}\n\n\tconst actions: EventAction[] = [...eventActions, newAction]\n\n\tif (!skipTracking) {\n\t\ttrackActionCreation({ action: newAction, node, eventKey })\n\t}\n\n\tif (isCodeComponentNode(node)) {\n\t\tconst update = prefixControlProps({\n\t\t\t[eventKey]: { type: ControlType.EventHandler, value: actions },\n\t\t})\n\t\ttree.current(node)?.set(update)\n\t} else {\n\t\ttree.current(node)?.set({ [eventKey]: actions })\n\t}\n\n\treturn newAction\n}\n\n// Add the new action to the corresponding replica node only if the given event key is overridden\nexport function addActionToReplicaOverrides(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\treplica: CanvasNode & IsReplica,\n\toriginalNodeId: NodeID,\n\teventKey: string,\n\taction: EntityDefinition,\n\tcontrolOverrides?: ControlProps,\n) {\n\tconst originalNode = tree.get(originalNodeId)\n\tif (!originalNode) return\n\n\tif (!TemplateHelper.isAnyKeyOverridden(replica, originalNodeId, eventKey)) return\n\n\tconst isReplicaChild = replica.replicaInfo.master !== originalNodeId\n\tconst replicaNodeId = isReplicaChild ? generateReplicaChildId(replica.id, originalNodeId) : replica.id\n\tconst replicaNode = tree.get(replicaNodeId)\n\tif (!replicaNode || !(withFrameEvents(replicaNode) || isCodeComponentNode(replicaNode))) return\n\n\taddActionToEventKey(tree, componentLoader, replicaNode, eventKey, action, controlOverrides)\n}\n\n/** Only contains event keys that have actions assigned. Event keys are prefixed. */\nexport function getActionsForNode(\n\tcomponentLoader: AnyComponentLoader,\n\tnode: CanvasNode,\n): { [key: string]: EventAction[] } {\n\tconst result: { [key: string]: EventAction[] } = {}\n\tif (withFrameEvents(node)) {\n\t\tgetFrameEventKeys(node).forEach(eventKey => {\n\t\t\tconst actions = node[eventKey as keyof typeof node] as EventAction[] | undefined\n\t\t\tif (isArray(actions) && actions.length > 0) {\n\t\t\t\tresult[eventKey] = actions\n\t\t\t}\n\t\t})\n\t} else if (isCodeComponentNode(node)) {\n\t\tconst component = componentLoader.reactComponentForIdentifier(node.codeComponentIdentifier)\n\t\tif (component) {\n\t\t\tfor (const controlKey in component.properties) {\n\t\t\t\tconst control = component.properties[controlKey]\n\t\t\t\tif (control?.type !== ControlType.EventHandler) continue\n\n\t\t\t\tconst rawControlProp = node.getRawControlProp(controlKey)\n\t\t\t\tif (rawControlProp?.type !== ControlType.EventHandler) continue\n\t\t\t\tif (!isArray(rawControlProp.value)) continue\n\t\t\t\tif (rawControlProp.value.length === 0) continue\n\n\t\t\t\tconst actions = rawControlProp.value as EventAction[]\n\t\t\t\tresult[prefixControlPropKey(controlKey)] = actions\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}\n\nfunction getNodeActions<T extends CanvasNode>(\n\tnode: CodeComponentNode | (T & WithFrameEvents) | (T & WithFormInputEvents),\n\teventKey: string,\n): EventAction[] {\n\tif (isCodeComponentNode(node)) {\n\t\tconst controlProp = node.getRawControlProp(eventKey)\n\t\tif (!controlProp || !Array.isArray(controlProp.value)) return []\n\t\treturn controlProp.value\n\t} else {\n\t\tconst value = node[eventKey as keyof typeof node] as EventAction[] | undefined\n\t\treturn isArray(value) ? value : []\n\t}\n}\n\nexport const updateEventAction = (\n\tengine: VekterEngine,\n\tupdatedAction: EventAction,\n\tnodeId: NodeID,\n\teventKey: string,\n\titemIndex: number,\n) => {\n\tconst node = engine.tree.getNode(nodeId)\n\tif (!node) return\n\tconst nodeEvents = eventsForNode(engine.componentLoader, node)\n\tconst eventActions = nodeEvents[eventKey]\n\tconst actions: EventAction[] = isArray(eventActions) ? [...eventActions] : []\n\n\tconst oldAction = actions[itemIndex]\n\tif (oldAction) {\n\t\ttrackActionUpdate({ newAction: updatedAction, oldAction, eventKey, node })\n\t}\n\n\tactions[itemIndex] = updatedAction\n\n\tif (isCodeComponentNode(node)) {\n\t\tconst update = prefixControlProps({ [eventKey]: { type: ControlType.EventHandler, value: actions } })\n\t\tnode.set(update)\n\t} else {\n\t\tnode.set({ [eventKey]: actions })\n\t}\n}\n\nfunction triggerEventOrAction(value: EventAction | VariableDefinition) {\n\tif (isEventAction(value)) {\n\t\tif (isTriggerEventAction(value)) {\n\t\t\treturn value.controls.id.value\n\t\t}\n\t} else if (isVariableDefinition(value)) {\n\t\tif (value.type === ControlType.EventHandler) {\n\t\t\treturn value.id\n\t\t}\n\t}\n\n\treturn undefined\n}\n\nexport async function promptIfTriggerEventActionIsUsed(\n\tengine: VekterEngine,\n\tvalue: EventAction | VariableDefinition,\n\tonRemove: () => void,\n\tsource: \"interactions\" | \"variables\" = \"interactions\",\n) {\n\tconst variableId = triggerEventOrAction(value)\n\tif (!variableId) {\n\t\tonRemove()\n\t\treturn\n\t}\n\n\tconst scope = engine.stores.scopeStore.active\n\tif (!scope || !isSmartComponentNode(scope)) {\n\t\tonRemove()\n\t\treturn\n\t}\n\n\tconst variable = scope.getVariable(variableId)\n\tif (!variable) {\n\t\tonRemove()\n\t\treturn\n\t}\n\tif (!engine.stores.treeStore.getDataTree()) {\n\t\tawait engine.runWithFullyLoadedTreeAsync({ name: \"promptIfTriggerEventActionIsUsed\" })\n\t}\n\tconst tree = engine.stores.treeStore.getDataTreeOrLoadedTree()\n\tconst codeComponentIdentifier = scope.instanceIdentifier\n\tconst codeComponents = tree\n\t\t.query()\n\t\t.whereClassName<CodeComponentNode>(ClassDiscriminator.CodeComponentNode)\n\t\t.wherePropertyEquals(\"codeComponentIdentifier\", codeComponentIdentifier)\n\t\t.iterate()\n\n\tlet instancesCount = 0\n\n\tfor (const node of codeComponents) {\n\t\tif (getNodeActions(node, variableId).length > 0) {\n\t\t\tinstancesCount++\n\t\t}\n\t}\n\n\tif (instancesCount === 0) {\n\t\tengine.scheduler.processWhenReady(onRemove)\n\t\treturn\n\t}\n\n\tconst noun = source === \"interactions\" ? \"layer\" : Dictionary.SmartComponent\n\tconst type = source === \"interactions\" ? \"Event\" : Dictionary.Variable\n\n\tconst description =\n\t\tinstancesCount > 1\n\t\t\t? `Removing ${variable.name} from this ${noun} may prevent ${instancesCount} instances of this Smart Component from triggering existing events, like Overlays.`\n\t\t\t: `Removing ${variable.name} from this ${noun} may prevent one instance of this Smart Component from triggering existing events, like Overlays.`\n\n\tengine.stores.modalStore.push({\n\t\tsource: \"properties\",\n\t\ttype: ModalType.ConfirmRemoveTriggerEvent,\n\t\ttitle: `Remove ${type}`,\n\t\tdescription,\n\t\tconfirmLabel: Dictionary.Confirm,\n\t\tkeyboardConfirmMode: \"Enter\",\n\t\tonConfirm: onRemove,\n\t})\n}\n\nexport const removeEventAction = (engine: VekterEngine, nodeId: NodeID, eventKey: string, itemIndex: number) => {\n\tconst node = engine.tree.getNode(nodeId)\n\tif (!node) return\n\tif (!(isCodeComponentNode(node) || withFrameEvents(node) || withFormInputEvents(node))) return\n\tconst actions = [...getNodeActions(node, eventKey)]\n\tconst action = actions[itemIndex]\n\tif (!action) return\n\n\tvoid promptIfTriggerEventActionIsUsed(engine, action, () => {\n\t\tconst latest = engine.tree.get(node.id)\n\t\tif (!latest) return\n\n\t\tactions.splice(itemIndex, 1)\n\t\tif (isCodeComponentNode(latest)) {\n\t\t\tconst update = prefixControlProps({ [eventKey]: { type: ControlType.EventHandler, value: actions } })\n\t\t\tlatest.set(update)\n\t\t} else {\n\t\t\tconst update = { [eventKey]: actions }\n\t\t\tlatest.set(update)\n\t\t}\n\t})\n}\n\nexport const changeActionEventKey = (\n\tengine: VekterEngine,\n\tnodeId: string,\n\tcurrentEventKey: string,\n\tnewEventKey: string,\n\titemIndex: number,\n) => {\n\tif (currentEventKey === newEventKey) return\n\n\tconst node = engine.tree.getNode(nodeId)\n\tif (!node) return\n\tif (!(isCodeComponentNode(node) || withFrameEvents(node) || withFormInputEvents(node))) return\n\n\tconst fromActions = [...getNodeActions(node, currentEventKey)]\n\n\tconst action = fromActions.splice(itemIndex, 1)[0]\n\tif (!action) return\n\n\tconst toActions: EventAction[] = [...getNodeActions(node, newEventKey), action]\n\ttrackActionUpdate({ newAction: action, oldAction: action, eventKey: newEventKey, node })\n\n\tif (isCodeComponentNode(node)) {\n\t\tconst update = prefixControlProps({\n\t\t\t[currentEventKey]: { type: ControlType.EventHandler, value: fromActions },\n\t\t\t[newEventKey]: { type: ControlType.EventHandler, value: toActions },\n\t\t})\n\t\tnode.set(update)\n\t} else {\n\t\tconst update: { [key: string]: EventAction[] } = {\n\t\t\t[currentEventKey]: fromActions,\n\t\t\t[newEventKey]: toActions,\n\t\t}\n\t\tnode.set(update)\n\t}\n}\n\n/**\n * Returns the first found action and its index\n */\nexport function findActionOnNodeEvent<T extends EventAction>(\n\tevents: Readonly<NodeEvents>,\n\teventKey: string,\n\tcallback: (action: EventAction) => action is T,\n) {\n\tconst actions = events[eventKey]\n\tif (!isArray(actions) || actions.length === 0) return\n\n\tconst foundActionIndex = actions.findIndex(action => {\n\t\tif (!isEventAction(action)) return false\n\t\treturn callback(action)\n\t})\n\tconst foundAction = actions[foundActionIndex] as T\n\tif (foundActionIndex < 0 || !foundAction) return\n\n\treturn { action: foundAction, index: foundActionIndex }\n}\n\n/**\n * Returns the first found action, its index, and the event key\n */\nexport function findActionOnNode<T extends EventAction>(\n\tcomponentLoader: AnyComponentLoader,\n\tnode: CanvasNode,\n\tcallback: (action: EventAction) => action is T,\n) {\n\tconst nodeEvents = eventsForNode(componentLoader, node)\n\tfor (const eventKey in nodeEvents) {\n\t\tconst foundAction = findActionOnNodeEvent(nodeEvents, eventKey, callback)\n\t\tif (foundAction) return { ...foundAction, eventKey }\n\t}\n}\n\nexport function scopeSupportsEventActions(scope: AnyScopeNode | null | undefined): boolean {\n\treturn !isDesignPageNode(scope)\n}\n\nexport function nodeSupportsEventActions(tree: CanvasTree, node: CanvasNode): node is CanvasNode & WithEventActions {\n\tif (!withEventActions(node)) return false\n\n\tconst scope = tree.getScopeNodeFor(node)\n\treturn scopeSupportsEventActions(scope)\n}\n", "import type { CanvasNode, CanvasTree } from \"document/models/CanvasTree/index.ts\"\nimport { TemplateHelper } from \"document/models/CanvasTree/nodes/TemplateHelper.ts\"\nimport { isReplicaOrReplicaChild } from \"document/models/CanvasTree/traits/WithTemplate.ts\"\n\n/** Checks if the key has been set and isn't just inherited as a replica */\nexport function isKeySetAndNotInherited(tree: CanvasTree, node: CanvasNode, key: string): boolean {\n\tif (!isReplicaOrReplicaChild(node)) return true\n\tconst replica = TemplateHelper.getReplicaForTemplateNode(tree, node)\n\tif (!replica) return false\n\treturn TemplateHelper.isAnyKeyOverridden(replica, node.originalid, key)\n}\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport { eventsForNode } from \"document/components/chrome/properties/utils/eventActions.ts\"\nimport type { EventAction } from \"document/models/EventAction.ts\"\nimport { isEventAction } from \"document/models/EventAction.ts\"\nimport { v4 as uuid } from \"uuid\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport { HardCodedCodeIdentifier } from \"../traits/utils/hardCodedCodeComponentIdentifiers.ts\"\nimport type { ActionControlValues } from \"./actions.ts\"\n\nexport function createLoadMoreAction() {\n\treturn {\n\t\tidentifier: uuid(),\n\t\tactionIdentifier: HardCodedCodeIdentifier.loadMoreAction,\n\t\tcontrols: {},\n\t}\n}\n\ninterface LoadMoreAction extends EventAction {\n\tcontrols: ActionControlValues<Record<string, never>>\n}\n\nexport function isLoadMoreAction(value: EventAction): value is LoadMoreAction {\n\treturn isEventAction(value) && value.actionIdentifier === HardCodedCodeIdentifier.loadMoreAction\n}\n\nexport function hasLoadMoreActions(componentLoader: AnyComponentLoader, node: CanvasNode): boolean {\n\tconst events = eventsForNode(componentLoader, node)\n\n\tfor (const eventKey in events) {\n\t\tconst actions = events[eventKey]\n\t\tif (!actions) continue\n\t\tfor (const action of actions) {\n\t\t\tif (isLoadMoreAction(action)) return true\n\t\t}\n\t}\n\treturn false\n}\n", "import type { ComponentLoader } from \"@framerjs/framer-runtime\"\nimport { eventsForNode } from \"document/components/chrome/properties/utils/eventActions.ts\"\nimport { prefixControlProps } from \"document/models/controlProps/controlPropKey.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isKeySetAndNotInherited } from \"utils/isKeySetAndNotInherited.ts\"\nimport { getParentCollectionRepeater } from \"utils/repeaterUtils.ts\"\nimport type { CanvasTree } from \"../CanvasTree.ts\"\nimport { hasLoadMoreActions, isLoadMoreAction } from \"../actions/paginationActions.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport { isCodeComponentNode, isCollectionRepeater } from \"../nodes/utils/nodeCheck.ts\"\nimport type { ReducedRecord } from \"./utils/Reduced.ts\"\nimport { reduceProperty } from \"./utils/reduceProperty.ts\"\n\n/**\n * Allow code components to set variants based on the state of loading data.\n */\nexport interface WithDataLoaderVariants {\n\tdataLoaderLoadingVariantEnabled: boolean | undefined\n\tdataLoaderDisabledVariantEnabled: boolean | undefined\n\tdataLoaderLoadingVariant: string | undefined\n\tdataLoaderDisabledVariant: string | undefined\n}\n\nexport const dataLoaderVariantsDefaults: WithDataLoaderVariants = {\n\tdataLoaderLoadingVariantEnabled: undefined,\n\tdataLoaderDisabledVariantEnabled: undefined,\n\tdataLoaderLoadingVariant: undefined,\n\tdataLoaderDisabledVariant: undefined,\n}\n\nconst key: keyof WithDataLoaderVariants = \"dataLoaderLoadingVariantEnabled\"\n\nexport function withDataLoaderVariants<T extends CanvasNode>(node: T): node is T & WithDataLoaderVariants {\n\treturn key in node\n}\n\nfunction hasDataLoaderLoadingVariant<T extends CanvasNode>(node: T): node is T & WithDataLoaderVariants {\n\tif (!withDataLoaderVariants(node)) return false\n\n\treturn !!(node.dataLoaderLoadingVariantEnabled && node.dataLoaderLoadingVariant)\n}\n\nexport function hasDataLoaderDisabledVariant<T extends CanvasNode>(node: T): node is T & WithDataLoaderVariants {\n\tif (!withDataLoaderVariants(node)) return false\n\n\treturn !!(node.dataLoaderDisabledVariantEnabled && node.dataLoaderDisabledVariant)\n}\n\nexport function hasAnyDataLoaderVariants<T extends CanvasNode>(node: T): node is T & WithDataLoaderVariants {\n\treturn hasDataLoaderLoadingVariant(node) || hasDataLoaderDisabledVariant(node)\n}\n\nexport interface ReducedDataLoaderVariants extends Omit<\n\tReducedRecord<WithDataLoaderVariants>,\n\t\"dataLoaderLoadingVariant\" | \"dataLoaderDisabledVariant\"\n> {\n\tonlyNodesWithDataLoaderVariants: boolean\n\tdataLoaderLoadingVariant: Set<string | undefined>\n\tdataLoaderDisabledVariant: Set<string | undefined>\n}\n\n/**\n * Check if a code component is a data loader for a data repeater.\n */\nexport function isRepeaterLoaderInstance(node: CanvasNode, repeaterNode: CanvasNode): boolean {\n\tif (!isCollectionRepeater(repeaterNode)) return false\n\treturn repeaterNode.dataSourceLoaderId === node.getPrimaryId()\n}\n\nexport function removeLoadMoreActions(tree: CanvasTree, componentLoader: ComponentLoader, node: CanvasNode) {\n\tconst events = eventsForNode(componentLoader, node)\n\n\tfor (const eventKey in events) {\n\t\tconst actions = events[eventKey]\n\t\tif (!actions) continue\n\n\t\tif (!isKeySetAndNotInherited(tree, node, eventKey)) continue\n\n\t\tconst hasAnyLoadMoreActions = actions.some(isLoadMoreAction)\n\n\t\tif (hasAnyLoadMoreActions) {\n\t\t\tconst filteredActions = actions.filter(action => !isLoadMoreAction(action))\n\n\t\t\tif (isCodeComponentNode(node)) {\n\t\t\t\tconst update = prefixControlProps({\n\t\t\t\t\t[eventKey]: { type: ControlType.EventHandler, value: filteredActions },\n\t\t\t\t})\n\t\t\t\tnode.set(update)\n\t\t\t} else {\n\t\t\t\tconst update = { [eventKey]: filteredActions }\n\t\t\t\tnode.set(update)\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function reduceDataLoaderVariants(\n\ttree: CanvasTree,\n\tcomponentLoader: ComponentLoader,\n\tnode: CanvasNode,\n\tresult: ReducedDataLoaderVariants,\n) {\n\tconst collectionRepeater = getParentCollectionRepeater(tree, node)\n\n\tif (\n\t\t!withDataLoaderVariants(node) ||\n\t\t!isCodeComponentNode(node) ||\n\t\t// Must be a loader, or have a load more action.\n\t\t!(\n\t\t\tcollectionRepeater &&\n\t\t\t(isRepeaterLoaderInstance(node, collectionRepeater) || hasLoadMoreActions(componentLoader, node))\n\t\t)\n\t) {\n\t\tresult.onlyNodesWithDataLoaderVariants = false\n\t\treturn\n\t}\n\n\treduceProperty(\"dataLoaderLoadingVariantEnabled\", result, node)\n\treduceProperty(\"dataLoaderDisabledVariantEnabled\", result, node)\n\n\tresult.dataLoaderLoadingVariant.add(node.dataLoaderLoadingVariant)\n\tresult.dataLoaderDisabledVariant.add(node.dataLoaderDisabledVariant)\n}\n", "import type { Transition } from \"document/models/Transition.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport type { NodeID } from \"../nodes/NodeID.ts\"\nimport type { VariableReference } from \"./VariableReference.ts\"\nimport type { ResolvedCollectionItemSelector } from \"./utils/ResolvedCollectionItemSelector.ts\"\n\nexport interface WithDragEffect {\n\tdragEffectEnabled: boolean | undefined\n\tdragEffectFreeform: boolean | undefined\n\tdragEffectSnapBack: boolean | undefined\n\tdragEffectMomentum: boolean | undefined\n\tdragEffectTransition: Transition | undefined\n\tdragEffectConstraintElement: NodeID | undefined\n\tdragEffectConstraintItem: VariableReference | ResolvedCollectionItemSelector | undefined\n}\n\nexport const dragEffectDefaults: WithDragEffect = {\n\tdragEffectEnabled: undefined,\n\tdragEffectFreeform: undefined,\n\tdragEffectSnapBack: undefined,\n\tdragEffectMomentum: undefined,\n\tdragEffectTransition: undefined,\n\tdragEffectConstraintElement: undefined,\n\tdragEffectConstraintItem: undefined,\n}\n\nconst defaultInertiaTransition: Transition = {\n\tstiffness: 400,\n\tdamping: 30,\n\ttype: \"inertia\",\n\t// The props below don't matter for an inertia transition, but they are required in our Transition interface.\n\tease: [0.44, 0, 0.56, 1],\n\tduration: 0.4,\n\tdelay: 0,\n\tmass: 1,\n}\n\nObject.freeze(defaultInertiaTransition)\n\nexport const dragEffectEnabledDefaults: WithDragEffect = {\n\tdragEffectEnabled: true,\n\tdragEffectFreeform: true,\n\tdragEffectSnapBack: true,\n\tdragEffectMomentum: false,\n\tdragEffectTransition: { ...defaultInertiaTransition },\n\tdragEffectConstraintElement: undefined,\n\tdragEffectConstraintItem: undefined,\n}\n\nconst key: keyof WithDragEffect = \"dragEffectEnabled\"\n\nexport function withDragEffect<T extends CanvasNode>(node: T): node is T & WithDragEffect {\n\treturn key in node\n}\n\nexport function hasDragEffect<T extends CanvasNode>(node: T): node is T & WithDragEffect & { dragEffectEnabled: true } {\n\treturn withDragEffect(node) && node.dragEffectEnabled === true\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\nimport { hasImageFill } from \"./WithFill.ts\"\nimport { hasLink } from \"./WithLink.ts\"\nimport { type WithTickerEffect, isNodeInTickerEffect } from \"./WithTickerEffect.ts\"\n\nexport interface WithDraggable {\n\tdraggable: undefined | boolean | DynamicValue\n}\n\nexport const draggableDefaults: WithDraggable = {\n\tdraggable: undefined,\n}\n\nconst key = \"draggable\" satisfies keyof WithDraggable\n\nexport function withDraggable(node: CanvasNode): node is CanvasNode & WithDraggable {\n\treturn key in node\n}\n\n/**\n * The default value that is applied to the rendered element if no value is set.\n * For ticker descendants that can interrupt ticker dragging behaviour we default to false.\n */\nexport function draggableDefaultValueFor(node: CanvasNode): boolean | undefined {\n\tif (!isNodeInTickerEffect(node)) return undefined\n\tif (!hasLink(node) && !hasImageFill(node)) return undefined\n\n\tconst tickerEffect = node.cache.tickerAncestorId\n\t\t? node.tree()?.get<CanvasNode & WithTickerEffect>(node.cache.tickerAncestorId)\n\t\t: undefined\n\tif (!tickerEffect?.tickerEffectDraggable) return undefined\n\n\t// default to false so that the node is not draggable by default\n\treturn false\n}\n\nexport function draggableDefaultEnabledValueFor(node: CanvasNode): boolean | undefined {\n\treturn draggableDefaultValueFor(node) === false\n}\n", "import type { CanvasNode } from \"../nodes/CanvasNode.ts\"\n\nexport interface WithKitSectionHash {\n\t/**\n\t * A hash of this node and it's descendants at the time it was last formatted for the local kit.\n\t * Used to determine if the customizations need to be regenerated.\n\t */\n\tkitSectionHash: number | undefined\n}\n\nexport const kitSectionHashDefaults: WithKitSectionHash = {\n\tkitSectionHash: undefined,\n}\n\nconst key = \"kitSectionHash\" satisfies keyof WithKitSectionHash\nexport function withKitSectionHash<T extends CanvasNode>(node: T): node is T & WithKitSectionHash {\n\treturn key in node\n}\n", "import type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\n\nexport interface KitSectionSource {\n\tkit: string\n\tsection: NodeID\n}\n\n/**\n * Trait used to mark a node as a generated section node.\n * A node that was generated based on a kit section through Wireframer.\n * Stores relevant data of the source kit section.\n */\nexport interface WithKitSectionSource {\n\tkitSectionSource: KitSectionSource | undefined\n}\n\nexport const kitSectionSourceDefaults: WithKitSectionSource = {\n\tkitSectionSource: undefined,\n}\n\nconst key = \"kitSectionSource\" satisfies keyof WithKitSectionSource\n\nexport function withKitSectionSource<T extends CanvasNode>(node: T): node is T & WithKitSectionSource {\n\treturn key in node\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isBoolean } from \"utils/typeChecks.ts\"\n\nexport interface WithLock {\n\t/** undefined means that the lock is inherited from the parent */\n\tlocked: boolean | undefined\n}\n\nexport const lockDefaults: WithLock = {\n\tlocked: undefined,\n}\n\nconst key: keyof WithLock = \"locked\"\n\nexport function withLock(node: CanvasNode): node is CanvasNode & WithLock {\n\treturn key in node\n}\n\nexport function isLockedOrLockedByParent(node: CanvasNode): boolean {\n\tif (withLock(node) && isBoolean(node.locked)) {\n\t\treturn node.locked\n\t}\n\treturn node.cache.lockedByParent\n}\n", "import type { Transition } from \"document/models/Transition.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport type { Transforms } from \"./WithTransforms.ts\"\n\nexport type LoopEffectRepeatType = \"mirror\" | \"loop\"\nexport interface WithLoopEffect {\n\tloopEffectEnabled: boolean | undefined\n\tloopEffectRepeatType: LoopEffectRepeatType | undefined\n\tloopEffectRepeatDelay: number | undefined\n\tloopEffectOpacity: number | undefined\n\tloopEffectX: number | undefined\n\tloopEffectY: number | undefined\n\tloopEffectScale: number | undefined\n\tloopEffectRotate3d: boolean | undefined\n\tloopEffectRotate: number | undefined\n\tloopEffectRotateX: number | undefined\n\tloopEffectRotateY: number | undefined\n\tloopEffectSkewX: number | undefined\n\tloopEffectSkewY: number | undefined\n\tloopEffectTransition: Transition | undefined\n\tloopEffectPauseOffscreen: boolean | undefined\n}\n\nexport const loopEffectDefaults: WithLoopEffect = {\n\tloopEffectEnabled: undefined,\n\tloopEffectRepeatType: undefined,\n\tloopEffectRepeatDelay: undefined,\n\tloopEffectOpacity: undefined,\n\tloopEffectX: undefined,\n\tloopEffectY: undefined,\n\tloopEffectScale: undefined,\n\tloopEffectRotate3d: undefined,\n\tloopEffectRotate: undefined,\n\tloopEffectRotateX: undefined,\n\tloopEffectRotateY: undefined,\n\tloopEffectSkewX: undefined,\n\tloopEffectSkewY: undefined,\n\tloopEffectTransition: undefined,\n\tloopEffectPauseOffscreen: undefined,\n}\n\nconst defaultLoopTransition: Transition = {\n\tdamping: 30,\n\tdelay: 0,\n\tduration: 1,\n\tease: [0, 0, 1, 1],\n\tmass: 1,\n\tstiffness: 400,\n\ttype: \"tween\",\n\tdurationBasedSpring: true,\n\tbounce: 0.25,\n}\n\nObject.freeze(defaultLoopTransition)\n\nexport const loopEffectEnabledDefaults: WithLoopEffect = {\n\tloopEffectEnabled: true,\n\tloopEffectRepeatType: \"loop\",\n\tloopEffectRepeatDelay: 0,\n\tloopEffectOpacity: 1,\n\tloopEffectX: 0,\n\tloopEffectY: 0,\n\tloopEffectScale: 1,\n\tloopEffectRotate3d: false,\n\tloopEffectRotate: 360,\n\tloopEffectRotateX: 0,\n\tloopEffectRotateY: 0,\n\tloopEffectSkewX: 0,\n\tloopEffectSkewY: 0,\n\tloopEffectTransition: {\n\t\t...defaultLoopTransition,\n\t},\n\tloopEffectPauseOffscreen: true,\n}\n\nconst key: keyof WithLoopEffect = \"loopEffectEnabled\"\n\nexport function withLoopEffect<T extends CanvasNode>(node: T): node is T & WithLoopEffect {\n\treturn key in node\n}\n\nexport function hasLoopEffect<T extends CanvasNode>(node: T): node is T & WithLoopEffect & { loopEffectEnabled: true } {\n\treturn withLoopEffect(node) && node.loopEffectEnabled === true\n}\n\nexport function loopTransforms(node: WithLoopEffect): Transforms {\n\treturn {\n\t\tscale: node.loopEffectScale ?? 1,\n\t\tskewX: node.loopEffectSkewX ?? 0,\n\t\tskewY: node.loopEffectSkewY ?? 0,\n\t\trotate: node.loopEffectRotate ?? 0,\n\t\trotateX: node.loopEffectRotate3d ? (node.loopEffectRotateX ?? 0) : 0,\n\t\trotateY: node.loopEffectRotate3d ? (node.loopEffectRotateY ?? 0) : 0,\n\t\tx: node.loopEffectX ?? 0,\n\t\ty: node.loopEffectY ?? 0,\n\t\ttranslateZ: 0,\n\t}\n}\n", "import { assert, ValueObject } from \"@framerjs/shared\"\nimport { ConvertColor } from \"library/render/types/Color/index.ts\"\nimport { withClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport { randomID } from \"./CanvasTree/nodes/NodeID.ts\"\n\nexport class GradientColorStop extends withClassDiscriminator(\"GradientColorStop\") {\n\t// Safely using a non-null assertion operator (`!`) here because this field\n\t// is set in the constructor via ValueObject.writeOnce\n\treadonly id!: string\n\treadonly value: string = \"black\"\n\treadonly position: number = 0\n\n\tconstructor(values: Partial<GradientColorStop> = {}) {\n\t\tsuper()\n\n\t\t// We don't store any gradient stop information in the JSON for a RichTextNode, in every text fill edit session,\n\t\t// we parse the fill from the HTML, and construct new GradientColorStops. Using a random ID each time\n\t\t// introduces some problems when editing gradient stops on a text node. We (will) tackle this by compiling the\n\t\t// list of stop ids in the HTML as well as a data attribute data-stopIds. When parsing a gradient fill, we will\n\t\t// reassign these ids to the gradient stops in order. Therefore, the GradientColorStop class should accept\n\t\t// whatever id that's given to the constructor.\n\t\tValueObject.writeOnce(this, { ...values, id: values.id ?? randomID() })\n\t}\n\n\tmerge(values: Partial<GradientColorStop>): GradientColorStop {\n\t\treturn ValueObject.update(this, values)\n\t}\n}\n\nexport function equalColorStops(a: readonly GradientColorStop[], b: readonly GradientColorStop[]) {\n\treturn (\n\t\ta.length === b.length &&\n\t\ta.every((stop: GradientColorStop, idx: number) => {\n\t\t\tconst otherStop = b[idx]\n\t\t\tassert(otherStop, \"a and b must have matching gradient color stops\")\n\n\t\t\tif (stop.position !== otherStop.position) return false\n\n\t\t\t// Shared colors should only be equal if the value is equal as ConvertColor will return true\n\t\t\tif (stop.value.startsWith(\"var(\") || otherStop.value.startsWith(\"var(\")) {\n\t\t\t\treturn stop.value === otherStop.value\n\t\t\t}\n\n\t\t\treturn stop.value === otherStop.value || ConvertColor.equals(stop.value, otherStop.value)\n\t\t})\n\t)\n}\n", "import type { ConicGradient, Gradient, LinearGradient, RadialGradient } from \"document/models/Gradient.ts\"\nimport { GradientColorStop } from \"document/models/GradientColorStop.ts\"\nimport { ConvertColor } from \"library/index.ts\"\nimport { isObject } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport type { NodeID } from \"../nodes/NodeID.ts\"\nimport { randomID } from \"../nodes/NodeID.ts\"\nimport type { FillType } from \"./WithFill.ts\"\n\nexport type MaskType = Exclude<FillType, \"color\">\ntype MaskImage = string | null\nexport type MaskValueTypeForMaskType = LinearGradient | RadialGradient | ConicGradient | MaskImage\n\nexport type MaskSize = \"contain\" | \"cover\" | number\nexport type MaskMode = \"luminance\" | \"alpha\"\nexport type MaskRepeat = \"repeat\" | \"no-repeat\"\nexport type MaskComposite = \"add\" | \"subtract\" | \"intersect\" | \"exclude\"\nexport type MaskPosition =\n\t| \"center\"\n\t| \"top\"\n\t| \"right\"\n\t| \"bottom\"\n\t| \"left\"\n\t| \"top right\"\n\t| \"top left\"\n\t| \"bottom right\"\n\t| \"bottom left\"\n\nconst maskKeys: (keyof Mask)[] = [\n\t\"id\",\n\t\"maskType\",\n\t\"maskLinearGradient\",\n\t\"maskRadialGradient\",\n\t\"maskConicGradient\",\n\t\"maskImage\",\n\t\"maskMode\",\n\t\"maskImageResize\",\n\t\"maskRepeat\",\n\t\"maskPosition\",\n\t\"maskComposite\",\n]\n\nexport const MASK_POPOUT_ID = \"mask\"\n\nexport type MaskID = NodeID\n\nexport interface Mask {\n\tid: MaskID\n\tmaskType: MaskType\n\tmaskLinearGradient: LinearGradient\n\tmaskRadialGradient: RadialGradient\n\tmaskConicGradient: ConicGradient\n\tmaskComposite: MaskComposite\n\tmaskImage: MaskImage\n\tmaskMode: MaskMode | undefined\n\tmaskImageResize: MaskSize | undefined\n\tmaskRepeat: MaskRepeat | undefined\n\tmaskPosition: MaskPosition | undefined\n}\n\nexport interface WithMasks {\n\tmasks: readonly Mask[] | undefined\n}\n\nexport const masksDefaults: WithMasks = {\n\tmasks: undefined,\n}\n\nexport const maskAddedImageDefaults: Pick<Mask, \"maskMode\" | \"maskImageResize\" | \"maskRepeat\" | \"maskPosition\"> = {\n\tmaskMode: \"luminance\",\n\tmaskImageResize: \"cover\",\n\tmaskRepeat: \"no-repeat\",\n\tmaskPosition: \"center\",\n}\n\ninterface WithSupportsMaskGradient extends WithMasks {\n\tsupportsMaskGradient(): boolean\n}\n\nconst supportsMaskGradientKey = \"supportsMaskGradient\" satisfies keyof WithSupportsMaskGradient\n\nconst maskKey = \"masks\" satisfies keyof WithMasks\nexport function withMasks<T extends CanvasNode>(target: T): target is T & WithMasks {\n\treturn maskKey in target\n}\n\nexport function isMask(mask: unknown): mask is Mask {\n\tif (!isObject(mask)) return false\n\treturn mask && maskKeys.every(key => key in mask)\n}\n\nexport function getDuplicatedMask(mask: Mask): Mask {\n\treturn {\n\t\t...mask,\n\t\tid: randomID(),\n\t}\n}\n\nfunction withSupportsMaskGradient(node: CanvasNode): node is CanvasNode & WithSupportsMaskGradient {\n\treturn supportsMaskGradientKey in node\n}\n\nexport function supportsMaskGradientProps(node: CanvasNode): node is CanvasNode & WithMasks {\n\treturn withSupportsMaskGradient(node) ? node.supportsMaskGradient() : withMasks(node)\n}\n\nexport function isGradientMaskType(maskType: MaskType | undefined): maskType is Exclude<MaskType, \"image\"> {\n\treturn maskType === \"linear-gradient\" || maskType === \"radial-gradient\" || maskType === \"conic-gradient\"\n}\n\nexport function convertMaskGradientStopToTheme(stop: GradientColorStop, isDarkMode: boolean): GradientColorStop {\n\tconst alpha = ConvertColor.getAlpha(stop.value)\n\tconst colorToDisplay = isDarkMode ? \"#ffffff\" : \"#000000\"\n\treturn new GradientColorStop({ ...stop, value: ConvertColor.setAlpha(colorToDisplay, alpha) })\n}\n\nexport function convertMaskGradientToTheme(gradient: Gradient, isDarkMode: boolean): Gradient {\n\tconst stops = gradient.stops.map(stop => convertMaskGradientStopToTheme(stop, isDarkMode))\n\treturn gradient.updated({ stops })\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { Generated } from \"./Generated.ts\"\n\nexport interface WithName {\n\tname: string | Generated<string> | null\n}\n\nexport const nameDefaults = {\n\tname: null,\n} satisfies WithName\n\nconst key: keyof WithName = \"name\"\n\nexport function withName<T extends CanvasNode>(node: T): node is T & WithName {\n\treturn key in node\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\n\nexport interface WithParallax {\n\tparallaxEnabled: boolean | undefined\n\tparallaxSpeed: number | undefined\n\t/**\n\t * parallaxAdjustPosition: true (Position: Scroll in the UI), tried to\n\t * reposition the layer after mount based on the current scroll position.\n\t * This meant that the starting position changed depending on the browsers\n\t * scroll restoration heuristics. This resulted in numerous support requests\n\t * where we had to recommend turning this feature off. To avoid continuing\n\t * to have to provide that support, this feature is turned off for new\n\t * effects.\n\t *\n\t * @deprecated\n\t */\n\tparallaxAdjustPosition: boolean | undefined\n\tparallaxOffset: number | undefined\n}\n\nexport const parallaxDefaults: WithParallax = {\n\tparallaxEnabled: undefined,\n\tparallaxSpeed: undefined,\n\tparallaxAdjustPosition: undefined,\n\tparallaxOffset: undefined,\n}\n\nexport const parallaxEnabledDefaults: WithParallax = {\n\tparallaxEnabled: true,\n\tparallaxSpeed: 110,\n\tparallaxAdjustPosition: false,\n\tparallaxOffset: 0,\n}\n\nconst key: keyof WithParallax = \"parallaxEnabled\"\n\nexport function withParallax<T extends CanvasNode>(node: T): node is T & WithParallax {\n\treturn key in node\n}\n\nexport function hasParallaxEffect<T extends CanvasNode>(node: T): node is T & WithParallax & { parallaxEnabled: true } {\n\treturn withParallax(node) && !!node.parallaxEnabled\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { PreviewSettings } from \"preview-module/utils/PreviewSettings.ts\"\n\nexport interface WithPreviewSettings {\n\tpreviewSettings: PreviewSettings | null\n}\n\nexport const previewSettingsDefaults: WithPreviewSettings = {\n\tpreviewSettings: null,\n}\n\nconst key: keyof WithPreviewSettings = \"previewSettings\"\n\nexport function withPreviewSettings(node: CanvasNode): node is CanvasNode & WithPreviewSettings {\n\treturn key in node\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\nimport { isBreakpointVariant } from \"./WithVariant.ts\"\nimport type { ReducedRecord } from \"./utils/Reduced.ts\"\nimport { isDeviceNode } from \"./utils/hardCodedCodeComponentIdentifierChecks.ts\"\nimport { reduceProperty } from \"./utils/reduceProperty.ts\"\n\nexport interface WithRotation {\n\trotation: number | DynamicValue | undefined\n}\n\nexport const rotationDefaults: WithRotation = {\n\trotation: undefined,\n}\n\nconst key: keyof WithRotation = \"rotation\"\n\nexport function withRotation<T extends CanvasNode>(node: T): node is T & WithRotation {\n\treturn key in node && !isDeviceNode(node) && !isBreakpointVariant(node) // Webpages can't be rotated.\n}\n\n/** Might be rotated, but only in 90 degree increments. */\nexport function isRotatedAndNotAxisAligned(node: CanvasNode): boolean {\n\tif (!withRotation(node)) return false\n\tif (node.cache && node.cache.matrix) {\n\t\tconst angle = getRotationAngleFromMatrix(node.cache.matrix)\n\t\treturn angle % 90 !== 0\n\t}\n\n\tconst resolvedRotation = node.resolveValue(\"rotation\")\n\treturn resolvedRotation % 90 !== 0\n}\n\nexport function isRotated(node: CanvasNode): boolean {\n\tif (!withRotation(node)) return false\n\tif (node.cache && node.cache.matrix) {\n\t\tconst angle = getRotationAngleFromMatrix(node.cache.matrix)\n\t\treturn angle !== 0\n\t}\n\n\tconst resolvedRotation = node.resolveValue(\"rotation\")\n\treturn resolvedRotation !== 0\n}\n\nfunction getRotationAngleFromMatrix(matrix: DOMMatrixReadOnly) {\n\tconst { a, b } = matrix\n\treturn Math.round(Math.atan2(b, a) * (180 / Math.PI))\n}\n\nexport interface ReducedRotation extends ReducedRecord<WithRotation> {\n\tonlyNodesWithRotation: boolean\n}\n\nexport function reduceRotation(node: CanvasNode, result: ReducedRotation) {\n\tif (!withRotation(node)) {\n\t\tresult.onlyNodesWithRotation = false\n\t\treturn\n\t}\n\n\treduceProperty(\"rotation\", result, node)\n}\n", "export const enum EffectTrigger {\n\tOnInView = \"onInView\",\n\tOnMount = \"onMount\",\n\tOnScroll = \"onScroll\",\n\tOnScrollTarget = \"onScrollTarget\",\n\tOnScrollDirection = \"onScrollDirection\",\n}\n\n/**\n * Initially there was only one trigger, which triggered when the layer scrolled\n * into view. Later, we added a trigger for when the layer mounted. Those\n * triggers were identified as `scroll` and `load`. More recently, we added\n * support for triggering effects based on the scroll position of another layer,\n * which we identified as `scroll-target`.\n *\n * Soon we will implement a 4th trigger, which is truly based on the page\n * scroll, rather then when an element scrolls into view.\n *\n * Rather than create a confusing situation by adding `page-scroll` next to\n * `scroll`. This helper allows converting the old, pragmatic values into an\n * enum that is accurate to the expected outcome.\n *\n * This is safe because the enum members do not overlap with the original string\n * values.\n *\n * @TODO - Consider a migration to remove this conversion.\n */\nexport function effectTriggerStringToEnumMember(\n\tstring: \"scroll\" | \"load\" | \"scroll-target\" | EffectTrigger | undefined,\n): EffectTrigger | undefined {\n\tswitch (string) {\n\t\tcase \"scroll\":\n\t\t\treturn EffectTrigger.OnInView\n\t\tcase \"load\":\n\t\t\treturn EffectTrigger.OnMount\n\t\tcase \"scroll-target\":\n\t\t\treturn EffectTrigger.OnScrollTarget\n\t\tdefault:\n\t\t\treturn string\n\t}\n}\n\n/**\n * To avoid breaking historical metrics, for tracking we convert back to safe\n * strings.\n */\nexport function convertTriggerToStringForTracking(trigger: EffectTrigger | undefined) {\n\tswitch (trigger) {\n\t\tcase EffectTrigger.OnInView:\n\t\t\treturn \"scroll\"\n\t\tcase EffectTrigger.OnMount:\n\t\t\treturn \"load\"\n\t\tcase EffectTrigger.OnScrollTarget:\n\t\t\treturn \"scroll_target\"\n\t\tcase EffectTrigger.OnScroll:\n\t\t\treturn \"page_scroll\"\n\t\tdefault:\n\t\t\treturn trigger\n\t}\n}\n", "import type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { isDynamicValue } from \"../DynamicValue.ts\"\nimport { withRotation } from \"../WithRotation.ts\"\n\n/**\n * In the past, rotation used to be additive in webpages for motion gesture\n * effects (appear, hover, tap). We migrated these effects to add the base\n * rotation to the effect rotation so that we no longer had to support additive\n * rotation.\n *\n * Some nodes may have had rotation variables. To update those nodes without\n * breaking changes, we added a flag that the effects rotation should be\n * additive. In those cases, we will add the base rotation to the effect\n * rotation.\n */\nexport function getEffectRotate(\n\tnode: CanvasNode,\n\tadditiveDynamicValueRotation: boolean | undefined,\n\teffectRotation: number | undefined = 0,\n): number {\n\tif (!additiveDynamicValueRotation) return effectRotation\n\tif (!withRotation(node) || !isDynamicValue(node.rotation)) return effectRotation\n\treturn node.resolveValue(\"rotation\") + effectRotation\n}\n", "import type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { Transition } from \"document/models/Transition.ts\"\nimport {\n\tdefaultDurationBasedSpringTransition,\n\tfallbackPhysicsBasedSpringTransition,\n} from \"document/models/Transition.ts\"\nimport type { ScrollDirection } from \"library/modules/createTransformInputRange.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport type { VariableReference } from \"./VariableReference.ts\"\nimport type { Transforms } from \"./WithTransforms.ts\"\nimport { identity } from \"./WithTransforms.ts\"\nimport { EffectTrigger, effectTriggerStringToEnumMember } from \"./utils/EffectTrigger.ts\"\nimport type { ResolvedCollectionItemSelector } from \"./utils/ResolvedCollectionItemSelector.ts\"\nimport { getEffectRotate } from \"./utils/getEffectRotate.ts\"\n\nexport interface ExitEffect {\n\texitEffectEnabled: boolean | undefined\n\texitEffectOpacity: number | undefined\n\texitEffectX: number | undefined\n\texitEffectY: number | undefined\n\texitEffectScale: number | undefined\n\texitEffectRotate3d: boolean | undefined\n\texitEffectRotate: number | undefined\n\texitEffectRotateAdditiveDynamicValue: boolean | undefined\n\texitEffectRotateX: number | undefined\n\texitEffectRotateY: number | undefined\n\texitEffectSkewX: number | undefined\n\texitEffectSkewY: number | undefined\n\texitEffectTransition: Transition | undefined\n\t/** @deprecated */\n\texitEffectPerspective?: number | undefined\n}\n\nexport interface EnterEffect {\n\tenterEffectEnabled: boolean | undefined\n\tenterEffectOpacity: number | undefined\n\tenterEffectX: number | undefined\n\tenterEffectY: number | undefined\n\tenterEffectScale: number | undefined\n\tenterEffectRotate3d: boolean | undefined\n\tenterEffectRotate: number | undefined\n\tenterEffectRotateAdditiveDynamicValue: boolean | undefined\n\tenterEffectRotateX: number | undefined\n\tenterEffectRotateY: number | undefined\n\tenterEffectSkewX: number | undefined\n\tenterEffectSkewY: number | undefined\n\tenterEffectTransition: Transition | undefined\n\t/** @deprecated */\n\tenterEffectPerspective?: number | undefined\n}\n\nexport type StyleAppearEffectTrigger = Extract<\n\tEffectTrigger,\n\tEffectTrigger.OnInView | EffectTrigger.OnMount | EffectTrigger.OnScrollTarget | EffectTrigger.OnScrollDirection\n>\n\nexport interface WithStyleAppearEffect extends EnterEffect, ExitEffect {\n\tstyleAppearEffectEnabled: boolean | undefined\n\tstyleAppearEffectThreshold: number | undefined\n\tstyleAppearEffectAnimateOnce: boolean | undefined\n\tstyleAppearEffectLocked: boolean | undefined\n\tstyleAppearEffectTrigger: StyleAppearEffectTrigger | undefined\n\tstyleAppearEffectScrollTarget: NodeID | VariableReference | undefined\n\tstyleAppearEffectScrollTargetCollectionItem: ResolvedCollectionItemSelector | VariableReference | undefined\n\tstyleAppearEffectScrollDirection: ScrollDirection | undefined\n\n\t// These keys have been replaced by EnterEffect. To avoid a migration, they\n\t// have not been removed, but instead any missing EnterEffect values will fallback\n\t// to the related styleAppearEffect value.\n\t// @FIXME - migrate these to EnterEffect.\n\t/** @deprecated */\n\tstyleAppearEffectOpacity: number | undefined\n\t/** @deprecated */\n\tstyleAppearEffectX: number | undefined\n\t/** @deprecated */\n\tstyleAppearEffectY: number | undefined\n\t/** @deprecated */\n\tstyleAppearEffectScale: number | undefined\n\t/** @deprecated */\n\tstyleAppearEffectRotate: number | undefined\n\t/** @deprecated */\n\tstyleAppearEffectRotateX: number | undefined\n\t/** @deprecated */\n\tstyleAppearEffectRotateY: number | undefined\n\t/** @deprecated */\n\tstyleAppearEffectPerspective: number | undefined\n\t/** @deprecated */\n\tstyleAppearEffectTransition: Transition | undefined\n}\n\n// Fallback value for edge cases where an effect does not have a transition defined. This value should remain unchanged\n// so that the transitions on such nodes don't change sneakily on regen.\nexport const fallbackEffectTransition = {\n\t...fallbackPhysicsBasedSpringTransition,\n\tstiffness: 400,\n\tdamping: 30,\n}\n\nexport const exitEffectDefaults: Readonly<ExitEffect> = {\n\texitEffectEnabled: undefined,\n\texitEffectOpacity: undefined,\n\texitEffectX: undefined,\n\texitEffectY: undefined,\n\texitEffectScale: undefined,\n\texitEffectRotate3d: undefined,\n\texitEffectRotate: undefined,\n\texitEffectRotateAdditiveDynamicValue: undefined,\n\texitEffectRotateX: undefined,\n\texitEffectRotateY: undefined,\n\texitEffectSkewX: undefined,\n\texitEffectSkewY: undefined,\n\texitEffectPerspective: undefined,\n\texitEffectTransition: undefined,\n}\n\nconst enterEffectDefaults: Readonly<EnterEffect> = {\n\tenterEffectEnabled: undefined,\n\tenterEffectOpacity: undefined,\n\tenterEffectX: undefined,\n\tenterEffectY: undefined,\n\tenterEffectScale: undefined,\n\tenterEffectTransition: undefined,\n\tenterEffectRotate3d: undefined,\n\tenterEffectRotate: undefined,\n\tenterEffectRotateAdditiveDynamicValue: undefined,\n\tenterEffectRotateX: undefined,\n\tenterEffectRotateY: undefined,\n\tenterEffectSkewX: undefined,\n\tenterEffectSkewY: undefined,\n\tenterEffectPerspective: undefined,\n}\n\nexport const styleAppearEffectDefaults: Readonly<WithStyleAppearEffect> = {\n\tstyleAppearEffectEnabled: undefined,\n\tstyleAppearEffectThreshold: undefined,\n\tstyleAppearEffectAnimateOnce: undefined,\n\tstyleAppearEffectOpacity: undefined,\n\tstyleAppearEffectX: undefined,\n\tstyleAppearEffectY: undefined,\n\tstyleAppearEffectScale: undefined,\n\tstyleAppearEffectTransition: undefined,\n\tstyleAppearEffectRotate: undefined,\n\tstyleAppearEffectRotateX: undefined,\n\tstyleAppearEffectRotateY: undefined,\n\tstyleAppearEffectPerspective: undefined,\n\tstyleAppearEffectLocked: undefined,\n\tstyleAppearEffectTrigger: undefined,\n\tstyleAppearEffectScrollTarget: undefined,\n\tstyleAppearEffectScrollTargetCollectionItem: undefined,\n\tstyleAppearEffectScrollDirection: undefined,\n\n\t...enterEffectDefaults,\n\t...exitEffectDefaults,\n}\n\ntype PresetKey =\n\t| \"fadeIn\"\n\t| \"scaleIn\"\n\t| \"scaleInBottom\"\n\t| \"flipHorizontal\"\n\t| \"flipVertical\"\n\t| \"slideInTop\"\n\t| \"slideInRight\"\n\t| \"slideInLeft\"\n\t| \"slideInBottom\"\ntype Presets = Readonly<\n\tRecord<\n\t\tPresetKey,\n\t\t() => Omit<EnterEffect, \"enterEffectPerspective\"> &\n\t\t\tPick<WithStyleAppearEffect, \"exitEffectEnabled\" | \"styleAppearEffectLocked\">\n\t>\n>\n// The ordering of the keys for each effect must be identical. This allow us to\n// stringify and hash the preset and compare the hash to user values hashed in\n// the same order. If the ordering changes, the hashes generated from the\n// presets and from the user values won't match even if all the values are\n// identical.\nexport const effectPresets: Presets = {\n\tfadeIn: () => ({\n\t\tstyleAppearEffectLocked: true,\n\t\texitEffectEnabled: true,\n\t\tenterEffectEnabled: true,\n\t\tenterEffectX: 0,\n\t\tenterEffectY: 0,\n\t\tenterEffectOpacity: 0,\n\t\tenterEffectRotate3d: false,\n\t\tenterEffectRotate: 0,\n\t\tenterEffectRotateAdditiveDynamicValue: undefined,\n\t\tenterEffectRotateX: 0,\n\t\tenterEffectRotateY: 0,\n\t\tenterEffectScale: 1,\n\t\tenterEffectSkewX: 0,\n\t\tenterEffectSkewY: 0,\n\t\tenterEffectTransition: defaultDurationBasedSpringTransition,\n\t}),\n\tscaleIn: () => ({\n\t\tstyleAppearEffectLocked: true,\n\t\texitEffectEnabled: true,\n\t\tenterEffectEnabled: true,\n\t\tenterEffectX: 0,\n\t\tenterEffectY: 0,\n\t\tenterEffectOpacity: 0,\n\t\tenterEffectRotate3d: false,\n\t\tenterEffectRotate: 0,\n\t\tenterEffectRotateAdditiveDynamicValue: undefined,\n\t\tenterEffectRotateX: 0,\n\t\tenterEffectRotateY: 0,\n\t\tenterEffectScale: 0.5,\n\t\tenterEffectSkewX: 0,\n\t\tenterEffectSkewY: 0,\n\t\tenterEffectTransition: defaultDurationBasedSpringTransition,\n\t}),\n\tscaleInBottom: () => ({\n\t\tstyleAppearEffectLocked: true,\n\t\texitEffectEnabled: true,\n\t\tenterEffectEnabled: true,\n\t\tenterEffectX: 0,\n\t\tenterEffectY: 50,\n\t\tenterEffectOpacity: 0,\n\t\tenterEffectRotate3d: false,\n\t\tenterEffectRotate: 0,\n\t\tenterEffectRotateAdditiveDynamicValue: undefined,\n\t\tenterEffectRotateX: 0,\n\t\tenterEffectRotateY: 0,\n\t\tenterEffectScale: 0.5,\n\t\tenterEffectSkewX: 0,\n\t\tenterEffectSkewY: 0,\n\t\tenterEffectTransition: defaultDurationBasedSpringTransition,\n\t}),\n\tflipHorizontal: () => ({\n\t\tstyleAppearEffectLocked: true,\n\t\texitEffectEnabled: true,\n\t\tenterEffectEnabled: true,\n\t\tenterEffectX: 0,\n\t\tenterEffectY: 0,\n\t\tenterEffectOpacity: 1,\n\t\tenterEffectRotate3d: true,\n\t\tenterEffectRotate: 0,\n\t\tenterEffectRotateAdditiveDynamicValue: undefined,\n\t\tenterEffectRotateX: 0,\n\t\tenterEffectRotateY: -180,\n\t\tenterEffectScale: 1,\n\t\tenterEffectSkewX: 0,\n\t\tenterEffectSkewY: 0,\n\t\tenterEffectTransition: defaultDurationBasedSpringTransition,\n\t}),\n\tflipVertical: () => ({\n\t\tstyleAppearEffectLocked: true,\n\t\texitEffectEnabled: true,\n\t\tenterEffectEnabled: true,\n\t\tenterEffectX: 0,\n\t\tenterEffectY: 0,\n\t\tenterEffectOpacity: 1,\n\t\tenterEffectRotate3d: true,\n\t\tenterEffectRotate: 0,\n\t\tenterEffectRotateAdditiveDynamicValue: undefined,\n\t\tenterEffectRotateX: -180,\n\t\tenterEffectRotateY: 0,\n\t\tenterEffectScale: 1,\n\t\tenterEffectSkewX: 0,\n\t\tenterEffectSkewY: 0,\n\t\tenterEffectTransition: defaultDurationBasedSpringTransition,\n\t}),\n\tslideInTop: () => ({\n\t\tstyleAppearEffectLocked: true,\n\t\texitEffectEnabled: true,\n\t\tenterEffectEnabled: true,\n\t\tenterEffectX: 0,\n\t\tenterEffectY: -150,\n\t\tenterEffectOpacity: 0,\n\t\tenterEffectRotate3d: false,\n\t\tenterEffectRotate: 0,\n\t\tenterEffectRotateAdditiveDynamicValue: undefined,\n\t\tenterEffectRotateX: 0,\n\t\tenterEffectRotateY: 0,\n\t\tenterEffectScale: 1,\n\t\tenterEffectSkewX: 0,\n\t\tenterEffectSkewY: 0,\n\t\tenterEffectTransition: defaultDurationBasedSpringTransition,\n\t}),\n\tslideInLeft: () => ({\n\t\tstyleAppearEffectLocked: true,\n\t\texitEffectEnabled: true,\n\t\tenterEffectEnabled: true,\n\t\tenterEffectX: -150,\n\t\tenterEffectY: 0,\n\t\tenterEffectOpacity: 0,\n\t\tenterEffectRotate3d: false,\n\t\tenterEffectRotate: 0,\n\t\tenterEffectRotateAdditiveDynamicValue: undefined,\n\t\tenterEffectRotateX: 0,\n\t\tenterEffectRotateY: 0,\n\t\tenterEffectScale: 1,\n\t\tenterEffectSkewX: 0,\n\t\tenterEffectSkewY: 0,\n\t\tenterEffectTransition: defaultDurationBasedSpringTransition,\n\t}),\n\tslideInRight: () => ({\n\t\tstyleAppearEffectLocked: true,\n\t\texitEffectEnabled: true,\n\t\tenterEffectEnabled: true,\n\t\tenterEffectX: 150,\n\t\tenterEffectY: 0,\n\t\tenterEffectOpacity: 0,\n\t\tenterEffectRotate3d: false,\n\t\tenterEffectRotate: 0,\n\t\tenterEffectRotateAdditiveDynamicValue: undefined,\n\t\tenterEffectRotateX: 0,\n\t\tenterEffectRotateY: 0,\n\t\tenterEffectScale: 1,\n\t\tenterEffectSkewX: 0,\n\t\tenterEffectSkewY: 0,\n\t\tenterEffectTransition: defaultDurationBasedSpringTransition,\n\t}),\n\tslideInBottom: () => ({\n\t\tstyleAppearEffectLocked: true,\n\t\texitEffectEnabled: true,\n\t\tenterEffectEnabled: true,\n\t\tenterEffectX: 0,\n\t\tenterEffectY: 150,\n\t\tenterEffectOpacity: 0,\n\t\tenterEffectRotate3d: false,\n\t\tenterEffectRotate: 0,\n\t\tenterEffectRotateAdditiveDynamicValue: undefined,\n\t\tenterEffectRotateX: 0,\n\t\tenterEffectRotateY: 0,\n\t\tenterEffectScale: 1,\n\t\tenterEffectSkewX: 0,\n\t\tenterEffectSkewY: 0,\n\t\tenterEffectTransition: defaultDurationBasedSpringTransition,\n\t}),\n} as const\n\nexport const floatingPositionPresets = new Set<PresetKey>([\"fadeIn\", \"scaleIn\"])\n\nconst legacyStyleAppearEffectDefaults = {\n\tstyleAppearEffectOpacity: 0.5,\n\tstyleAppearEffectX: 0,\n\tstyleAppearEffectY: 0,\n\tstyleAppearEffectScale: 0.5,\n\tstyleAppearEffectTransition: defaultDurationBasedSpringTransition,\n\tstyleAppearEffectRotate: 0,\n\tstyleAppearEffectRotateX: 0,\n\tstyleAppearEffectRotateY: 0,\n\tstyleAppearEffectPerspective: undefined,\n} as const\n\nexport const styleAppearEffectEnabledDefaults: WithStyleAppearEffect = {\n\tstyleAppearEffectEnabled: true,\n\tstyleAppearEffectThreshold: 0.5,\n\tstyleAppearEffectAnimateOnce: false,\n\tstyleAppearEffectTrigger: EffectTrigger.OnMount,\n\tstyleAppearEffectScrollTarget: undefined,\n\tstyleAppearEffectScrollTargetCollectionItem: undefined,\n\tstyleAppearEffectScrollDirection: undefined,\n\n\t...legacyStyleAppearEffectDefaults,\n\t...exitEffectDefaults,\n\t...effectPresets.fadeIn(),\n}\n\nconst key: keyof WithStyleAppearEffect = \"styleAppearEffectEnabled\"\n\nexport function withStyleAppearPageEffect<T extends CanvasNode>(node: T): node is T & WithStyleAppearEffect {\n\treturn key in node\n}\n\nexport function hasStyleAppearEffect<T extends CanvasNode>(\n\tnode: T,\n): node is T & WithStyleAppearEffect & { styleAppearEffectEnabled: true } {\n\treturn withStyleAppearPageEffect(node) && !!node.styleAppearEffectEnabled\n}\n\nexport function initialTransforms(node: CanvasNode): Transforms {\n\tif (!withStyleAppearPageEffect(node)) return identity\n\n\treturn {\n\t\tx: node.enterEffectX ?? node.styleAppearEffectX ?? 0,\n\t\ty: node.enterEffectY ?? node.styleAppearEffectY ?? 0,\n\t\tscale: node.enterEffectScale ?? node.styleAppearEffectScale ?? 1,\n\t\trotate: getEffectRotate(\n\t\t\tnode,\n\t\t\tnode.enterEffectRotateAdditiveDynamicValue,\n\t\t\tnode.enterEffectRotate ?? node.styleAppearEffectRotate,\n\t\t),\n\t\trotateX: node.enterEffectRotate3d ? (node.enterEffectRotateX ?? node.styleAppearEffectRotateX ?? 0) : 0,\n\t\trotateY: node.enterEffectRotate3d ? (node.enterEffectRotateY ?? node.styleAppearEffectRotateY ?? 0) : 0,\n\t\tskewX: node.enterEffectSkewX ?? 0,\n\t\tskewY: node.enterEffectSkewY ?? 0,\n\t\ttranslateZ: 0,\n\t}\n}\n\nexport function exitTransforms(node: CanvasNode): Transforms {\n\tif (!withStyleAppearPageEffect(node)) return identity\n\tif (node.styleAppearEffectLocked) return initialTransforms(node)\n\n\treturn {\n\t\tscale: node.exitEffectScale ?? 1,\n\t\tskewX: node.exitEffectSkewX ?? 0,\n\t\tskewY: node.exitEffectSkewY ?? 0,\n\t\trotate: getEffectRotate(node, node.exitEffectRotateAdditiveDynamicValue, node.exitEffectRotate),\n\t\trotateX: node.exitEffectRotate3d ? (node.exitEffectRotateX ?? 0) : 0,\n\t\trotateY: node.exitEffectRotate3d ? (node.exitEffectRotateY ?? 0) : 0,\n\t\tx: node.exitEffectX ?? 0,\n\t\ty: node.exitEffectY ?? 0,\n\t\ttranslateZ: 0,\n\t}\n}\n\nexport function isPresenceEffect(node: CanvasNode) {\n\tif (!withStyleAppearPageEffect(node)) return false\n\treturn effectTriggerStringToEnumMember(node.styleAppearEffectTrigger) === EffectTrigger.OnMount\n}\n\n/**\n * We added enterEffect* and exitEffect* without a migration. That means that\n * existing effects will have undefined values for some new keys, that should be\n * assumed to be the previous defaults.\n *\n * These helpers help avoid accidentally making incorrect assumptions about\n * those properties.\n *\n * @FIXME - Remove these helpers when a migration lands as they will not be\n * necessary.\n */\n\nexport function isScrollEffect(node: CanvasNode & WithStyleAppearEffect): boolean {\n\treturn effectTriggerStringToEnumMember(node.styleAppearEffectTrigger) !== EffectTrigger.OnMount\n}\n\nexport function isEnterLoadEffect(node: CanvasNode & WithStyleAppearEffect): boolean {\n\treturn (\n\t\tnode.enterEffectEnabled !== false &&\n\t\teffectTriggerStringToEnumMember(node.styleAppearEffectTrigger) === EffectTrigger.OnMount\n\t)\n}\n\nexport function isExitLoadEffect(node: CanvasNode & WithStyleAppearEffect): boolean {\n\treturn (\n\t\t((node.styleAppearEffectLocked && node.enterEffectEnabled === true) || node.exitEffectEnabled === true) &&\n\t\teffectTriggerStringToEnumMember(node.styleAppearEffectTrigger) === EffectTrigger.OnMount\n\t)\n}\n\nexport const supportedEffectTriggers = new Set<EffectTrigger>([\n\tEffectTrigger.OnScrollTarget,\n\tEffectTrigger.OnInView,\n\tEffectTrigger.OnMount,\n\tEffectTrigger.OnScrollDirection,\n])\n\nexport function isSupportedTrigger(trigger: unknown): trigger is StyleAppearEffectTrigger {\n\tif (!isString(trigger)) return false\n\treturn supportedEffectTriggers.has(trigger as EffectTrigger)\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { Transition } from \"document/models/Transition.ts\"\nimport { randomID } from \"../nodes/NodeID.ts\"\nimport type { Transforms } from \"./WithTransforms.ts\"\nimport type { EffectScrollTarget } from \"./utils/EffectScrollTarget.ts\"\nimport { EffectTrigger } from \"./utils/EffectTrigger.ts\"\nimport type { StyleEffect } from \"./utils/StyleEffect.ts\"\n\nexport type ScrollStyle = Omit<StyleEffect, \"transition\" | \"boxShadow\">\n\nexport interface EffectStyleScrollTarget extends EffectScrollTarget {\n\tstyle: ScrollStyle\n}\n\nexport type StyleTransformEffectTrigger = Extract<\n\tEffectTrigger,\n\tEffectTrigger.OnScroll | EffectTrigger.OnInView | EffectTrigger.OnScrollTarget\n>\n\nexport interface WithStyleTransformEffect {\n\tstyleTransformEffectEnabled: boolean | undefined\n\tstyleTransformEffectViewportThreshold: number | undefined\n\tstyleTransformEffectTrigger: StyleTransformEffectTrigger | undefined\n\tstyleTransformEffectScrollTargets: EffectStyleScrollTarget[] | undefined\n\tstyleTransformEffectTransitionEnabled: boolean | undefined\n\tstyleTransformEffectTransition: Transition | undefined\n}\n\nexport const styleTransformEffectDefaults: WithStyleTransformEffect = {\n\tstyleTransformEffectEnabled: undefined,\n\tstyleTransformEffectViewportThreshold: undefined,\n\tstyleTransformEffectScrollTargets: undefined,\n\tstyleTransformEffectTrigger: undefined,\n\tstyleTransformEffectTransitionEnabled: undefined,\n\tstyleTransformEffectTransition: undefined,\n}\n\nexport function defaultStyle(additionalStyle?: Partial<ScrollStyle>): ScrollStyle {\n\treturn {\n\t\tx: 0,\n\t\ty: 0,\n\t\topacity: 1,\n\t\trotate3d: false,\n\t\trotate: 0,\n\t\tscale: 1,\n\t\trotateX: 0,\n\t\trotateY: 0,\n\t\tskewX: 0,\n\t\tskewY: 0,\n\t\t...additionalStyle,\n\t}\n}\n\nexport function defaultEffect(additionalStyle?: Partial<ScrollStyle>): EffectStyleScrollTarget {\n\treturn { id: randomID(), target: undefined, style: defaultStyle(additionalStyle) }\n}\n\nexport const styleTransformEffectEnabledDefaults: WithStyleTransformEffect = {\n\tstyleTransformEffectEnabled: true,\n\tstyleTransformEffectViewportThreshold: 0,\n\tstyleTransformEffectTrigger: EffectTrigger.OnScroll,\n\tstyleTransformEffectScrollTargets: undefined,\n\tstyleTransformEffectTransitionEnabled: undefined,\n\tstyleTransformEffectTransition: undefined,\n}\n\nconst key: keyof WithStyleTransformEffect = \"styleTransformEffectEnabled\"\n\nexport function withStyleTransformEffect<T extends CanvasNode>(node: T): node is T & WithStyleTransformEffect {\n\treturn key in node\n}\n\nexport function hasStyleTransformEffect<T extends CanvasNode>(\n\tnode: T,\n): node is T & WithStyleTransformEffect & { styleTransformEffectEnabled: true } {\n\treturn withStyleTransformEffect(node) && !!node.styleTransformEffectEnabled\n}\n\nexport function transformEffectTransforms(style: ScrollStyle): Transforms {\n\treturn {\n\t\tscale: style.scale ?? 1,\n\t\tskewX: style.skewX ?? 0,\n\t\tskewY: style.skewY ?? 0,\n\t\trotate: style.rotate ?? 0,\n\t\trotateX: style.rotate3d ? (style.rotateX ?? 0) : 0,\n\t\trotateY: style.rotate3d ? (style.rotateY ?? 0) : 0,\n\t\tx: style.x ?? 0,\n\t\ty: style.y ?? 0,\n\t\ttranslateZ: 0,\n\t}\n}\n", "import type { CSSVariableName } from \"prosemirror/variables.ts\"\nimport type { CanvasNode } from \"../index.ts\"\n\nexport type TokenOverrides = Record<CSSVariableName, string>\n\n/**\n * Interface for CanvasNode instances that want to be able to override any\n * style tokens.\n * KITS @TODO: Deprecate this trait when we migrate the fAI Wireframer kit to an actual kit.\n */\nexport interface WithTokenOverrides {\n\ttokenOverrides: TokenOverrides | undefined\n}\n\nexport const tokenOverridesDefaults: WithTokenOverrides = {\n\ttokenOverrides: undefined,\n}\n\nconst key: keyof WithTokenOverrides = \"tokenOverrides\"\n\nexport function withTokenOverrides(node: CanvasNode): node is CanvasNode & WithTokenOverrides {\n\treturn key in node\n}\n", "import type { Transition } from \"document/models/Transition.ts\"\nimport { isTransition } from \"document/models/Transition.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\nimport { isDynamicValue } from \"./DynamicValue.ts\"\nimport type { WithVariant } from \"./WithVariant.ts\"\nimport { isVariant } from \"./WithVariant.ts\"\n\nexport interface WithTransition {\n\ttransition: Transition | DynamicValue | undefined\n}\n\nexport const transitionDefaults: WithTransition = {\n\ttransition: undefined,\n}\n\nconst transitionKey: keyof WithTransition = \"transition\"\nexport function withTransition<T extends CanvasNode>(node: T): node is T & WithTransition {\n\treturn transitionKey in node\n}\n\nexport function hasTransition<T extends CanvasNode>(node: T): node is T & WithTransition & { transition: Transition } {\n\tif (!withTransition(node)) return false\n\treturn isTransition(node.transition) || isDynamicValue(node.transition)\n}\n\nconst variantTransitionKey = \"variantTransition\" satisfies keyof WithVariant\n\n/**\n * Nodes which are variants store their transitions under the variantTransition\n * key instead of using 'transition'.\n */\nexport function getDefaultNodeTransitionKey(node: CanvasNode) {\n\treturn isVariant(node) ? variantTransitionKey : transitionKey\n}\n", "import type { ReactComponentDefinition } from \"@framerjs/framer-runtime\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { ScrollDirection } from \"library/modules/createTransformInputRange.ts\"\nimport type { EffectScrollTarget } from \"./utils/EffectScrollTarget.ts\"\nimport { EffectTrigger } from \"./utils/EffectTrigger.ts\"\n\nexport interface EffectVariantScrollTarget extends EffectScrollTarget {\n\tvariant: NodeID | undefined\n}\n\nexport type VariantAppearEffectTrigger = Extract<\n\tEffectTrigger,\n\tEffectTrigger.OnInView | EffectTrigger.OnScrollTarget | EffectTrigger.OnScrollDirection\n>\n\nexport interface WithVariantAppearEffect {\n\tappearEffectEnabled: boolean | undefined\n\tappearEffectVisibleVariantId: string | undefined\n\tappearEffectObscuredVariantId: string | undefined\n\tappearEffectThreshold: number | undefined\n\tappearEffectAnimateOnce: boolean | undefined\n\tappearEffectTrigger: VariantAppearEffectTrigger | undefined\n\tappearEffectScrollTargets: EffectVariantScrollTarget[] | undefined\n\tappearEffectScrollDirection: ScrollDirection | undefined\n\tappearEffectScrollDirectionTarget: string | undefined\n}\n\nexport const appearEffectDefaults: WithVariantAppearEffect = {\n\tappearEffectEnabled: undefined,\n\tappearEffectVisibleVariantId: undefined,\n\tappearEffectObscuredVariantId: undefined,\n\tappearEffectThreshold: undefined,\n\tappearEffectAnimateOnce: undefined,\n\tappearEffectScrollTargets: undefined,\n\tappearEffectTrigger: undefined,\n\tappearEffectScrollDirection: undefined,\n\tappearEffectScrollDirectionTarget: undefined,\n}\n\nexport const appearEffectEnabledDefaults: WithVariantAppearEffect = {\n\tappearEffectEnabled: true,\n\tappearEffectVisibleVariantId: undefined,\n\tappearEffectObscuredVariantId: undefined,\n\tappearEffectThreshold: 0.5,\n\tappearEffectAnimateOnce: false,\n\tappearEffectTrigger: EffectTrigger.OnInView,\n\tappearEffectScrollTargets: undefined,\n\tappearEffectScrollDirection: undefined,\n\tappearEffectScrollDirectionTarget: undefined,\n}\n\nconst key: keyof WithVariantAppearEffect = \"appearEffectEnabled\"\n\nexport function withVariantAppearPageEffect<T extends CanvasNode>(node: T): node is T & WithVariantAppearEffect {\n\treturn key in node\n}\n\nconst variantKey = \"variant\"\nexport function hasVariantControl(definition: ReactComponentDefinition) {\n\treturn variantKey in definition.properties\n}\n\nexport function hasVariantAppearEffect<T extends CanvasNode>(\n\tnode: T,\n): node is T & WithVariantAppearEffect & { appearEffectEnabled: true } {\n\treturn withVariantAppearPageEffect(node) && !!node.appearEffectEnabled\n}\n", "import type { CanvasNode, CanvasTree } from \"document/models/CanvasTree/index.ts\"\nimport { isBreakpointVariant } from \"./WithVariant.ts\"\nimport type { ReducedRecord } from \"./utils/Reduced.ts\"\nimport { reduceProperty } from \"./utils/reduceProperty.ts\"\n\nexport interface WithViewTransitionNone {\n\t/**\n\t * When viewTransitionNone is true, the node will be excluded from view\n\t * transitions, receiving a animation: none; declaration.\n\t */\n\tviewTransitionNone: boolean | undefined\n}\n\nexport const viewTransitionNoneDefaults: WithViewTransitionNone = {\n\tviewTransitionNone: undefined,\n}\n\nconst key: keyof WithViewTransitionNone = \"viewTransitionNone\"\n\nexport function withViewTransitionNone<T extends CanvasNode>(node: T): node is T & WithViewTransitionNone {\n\treturn key in node\n}\n\nexport type ReducedViewTransitionNone = ReducedRecord<WithViewTransitionNone> & {\n\tonlyNodesWithViewTransitionNone: boolean\n}\n\nexport function reduceViewTransitionNone(tree: CanvasTree, node: CanvasNode, result: ReducedViewTransitionNone): void {\n\tif (!withViewTransitionNone(node)) {\n\t\tresult.onlyNodesWithViewTransitionNone = false\n\t\treturn\n\t}\n\n\tconst parent = tree.getParent(node.id)\n\tif (!isBreakpointVariant(parent)) {\n\t\tresult.onlyNodesWithViewTransitionNone = false\n\t\treturn\n\t}\n\n\treduceProperty(key, result, node)\n}\n", "import type { BoxShadow } from \"document/models/Shadow.ts\"\nimport { type Transition, defaultDurationBasedSpringTransition } from \"document/models/Transition.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport type { Transforms } from \"./WithTransforms.ts\"\nimport { identity } from \"./WithTransforms.ts\"\nimport { getEffectRotate } from \"./utils/getEffectRotate.ts\"\n\nexport interface WithWhileHover {\n\twhileHoverEnabled: boolean | undefined\n\twhileHoverOpacity: number | undefined\n\twhileHoverX: number | undefined\n\twhileHoverY: number | undefined\n\twhileHoverScale: number | undefined\n\twhileHoverRotate3d: boolean | undefined\n\twhileHoverRotate: number | undefined\n\twhileHoverRotateAdditiveDynamicValue: boolean | undefined\n\twhileHoverRotateX: number | undefined\n\twhileHoverRotateY: number | undefined\n\twhileHoverSkewX: number | undefined\n\twhileHoverSkewY: number | undefined\n\twhileHoverBackgroundColor: string | undefined\n\twhileHoverBoxShadow: BoxShadow | undefined\n\twhileHoverTransition: Transition | undefined\n}\n\nexport const whileHoverDefaults: WithWhileHover = {\n\twhileHoverEnabled: undefined,\n\twhileHoverOpacity: undefined,\n\twhileHoverX: undefined,\n\twhileHoverY: undefined,\n\twhileHoverScale: undefined,\n\twhileHoverRotate3d: undefined,\n\twhileHoverRotate: undefined,\n\twhileHoverRotateAdditiveDynamicValue: undefined,\n\twhileHoverRotateX: undefined,\n\twhileHoverRotateY: undefined,\n\twhileHoverSkewX: undefined,\n\twhileHoverSkewY: undefined,\n\twhileHoverBackgroundColor: undefined,\n\twhileHoverBoxShadow: undefined,\n\twhileHoverTransition: undefined,\n}\n\nexport const whileHoverEnabledDefaults: WithWhileHover = {\n\twhileHoverEnabled: true,\n\twhileHoverOpacity: 1,\n\twhileHoverX: 0,\n\twhileHoverY: 0,\n\twhileHoverScale: 1.1,\n\twhileHoverRotate3d: false,\n\twhileHoverRotate: 0,\n\twhileHoverRotateAdditiveDynamicValue: undefined,\n\twhileHoverRotateX: 0,\n\twhileHoverRotateY: 0,\n\twhileHoverSkewX: 0,\n\twhileHoverSkewY: 0,\n\twhileHoverBackgroundColor: undefined,\n\twhileHoverBoxShadow: undefined,\n\twhileHoverTransition: defaultDurationBasedSpringTransition,\n}\n\nconst key: keyof WithWhileHover = \"whileHoverEnabled\"\n\nexport function withWhileHover<T extends CanvasNode>(node: T): node is T & WithWhileHover {\n\treturn key in node\n}\n\nexport function hasWhileHover<T extends CanvasNode>(\n\tnode: T,\n): node is T & WithWhileHover & { hoverEffectEnabled: true } {\n\treturn withWhileHover(node) && node.whileHoverEnabled === true\n}\n\nexport function whileHoverTransforms(node: CanvasNode): Transforms {\n\tif (!withWhileHover(node)) return identity\n\treturn {\n\t\tscale: node.whileHoverScale ?? 1,\n\t\tskewX: node.whileHoverSkewX ?? 0,\n\t\tskewY: node.whileHoverSkewY ?? 0,\n\t\trotate: getEffectRotate(node, node.whileHoverRotateAdditiveDynamicValue, node.whileHoverRotate),\n\t\trotateX: node.whileHoverRotate3d ? (node.whileHoverRotateX ?? 0) : 0,\n\t\trotateY: node.whileHoverRotate3d ? (node.whileHoverRotateY ?? 0) : 0,\n\t\tx: node.whileHoverX ?? 0,\n\t\ty: node.whileHoverY ?? 0,\n\t\ttranslateZ: 0,\n\t}\n}\n", "import { isString } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport type { NodeID } from \"../nodes/NodeID.ts\"\nimport type { ReducedRecord } from \"./utils/Reduced.ts\"\nimport { reduceProperty } from \"./utils/reduceProperty.ts\"\n\nexport interface WithWhileOpenEffect {\n\twhileOpenEffectEnabled: boolean | undefined\n\twhileOpenEffectVariant: string | undefined\n}\n\nexport const whileOpenEffectDefaults: WithWhileOpenEffect = {\n\twhileOpenEffectEnabled: undefined,\n\twhileOpenEffectVariant: undefined,\n}\n\nconst key: keyof WithWhileOpenEffect = \"whileOpenEffectEnabled\"\nexport function withWhileOpenEffect<T extends CanvasNode>(node: T): node is T & WithWhileOpenEffect {\n\treturn key in node\n}\n\nexport function hasWhileOpenEffect<T extends CanvasNode>(\n\tnode: T,\n): node is T & WithWhileOpenEffect & { whileOpenEffectEnabled: true; whileOpenEffectVariant: string } {\n\treturn withWhileOpenEffect(node) && node.whileOpenEffectEnabled === true && isString(node.whileOpenEffectVariant)\n}\n\nexport interface ReducedWhileOpenEffect extends Omit<ReducedRecord<WithWhileOpenEffect>, \"whileOpenEffectVariant\"> {\n\twhileOpenEffectVariant: Set<NodeID | undefined>\n}\n\nexport function reduceWhileOpenEffect(node: CanvasNode, result: ReducedWhileOpenEffect) {\n\tif (!withWhileOpenEffect(node)) return\n\n\treduceProperty(\"whileOpenEffectEnabled\", result, node, value => value || false)\n\n\tresult.whileOpenEffectVariant.add(node.whileOpenEffectVariant)\n}\n", "import type { BoxShadow } from \"document/models/Shadow.ts\"\nimport { type Transition, defaultDurationBasedSpringTransition } from \"document/models/Transition.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport type { Transforms } from \"./WithTransforms.ts\"\nimport { identity } from \"./WithTransforms.ts\"\nimport { getEffectRotate } from \"./utils/getEffectRotate.ts\"\n\nexport interface WithWhileTap {\n\twhileTapEnabled: boolean | undefined\n\twhileTapOpacity: number | undefined\n\twhileTapX: number | undefined\n\twhileTapY: number | undefined\n\twhileTapScale: number | undefined\n\twhileTapRotate3d: boolean | undefined\n\twhileTapRotate: number | undefined\n\twhileTapRotateAdditiveDynamicValue: boolean | undefined\n\twhileTapRotateX: number | undefined\n\twhileTapRotateY: number | undefined\n\twhileTapSkewX: number | undefined\n\twhileTapSkewY: number | undefined\n\twhileTapBackgroundColor: string | undefined\n\twhileTapBoxShadow: BoxShadow | undefined\n\twhileTapTransition: Transition | undefined\n}\n\nexport const whileTapDefaults: WithWhileTap = {\n\twhileTapEnabled: undefined,\n\twhileTapOpacity: undefined,\n\twhileTapX: undefined,\n\twhileTapY: undefined,\n\twhileTapScale: undefined,\n\twhileTapRotate3d: undefined,\n\twhileTapRotate: undefined,\n\twhileTapRotateAdditiveDynamicValue: undefined,\n\twhileTapRotateX: undefined,\n\twhileTapRotateY: undefined,\n\twhileTapSkewX: undefined,\n\twhileTapSkewY: undefined,\n\twhileTapBackgroundColor: undefined,\n\twhileTapBoxShadow: undefined,\n\twhileTapTransition: undefined,\n}\n\nexport const whileTapEnabledDefaults: WithWhileTap = {\n\twhileTapEnabled: true,\n\twhileTapOpacity: 1,\n\twhileTapX: 0,\n\twhileTapY: 0,\n\twhileTapScale: 0.9,\n\twhileTapRotate3d: false,\n\twhileTapRotate: 0,\n\twhileTapRotateAdditiveDynamicValue: undefined,\n\twhileTapRotateX: 0,\n\twhileTapRotateY: 0,\n\twhileTapSkewX: 0,\n\twhileTapSkewY: 0,\n\twhileTapBackgroundColor: undefined,\n\twhileTapBoxShadow: undefined,\n\twhileTapTransition: defaultDurationBasedSpringTransition,\n}\n\nconst key: keyof WithWhileTap = \"whileTapEnabled\"\n\nexport function withWhileTap<T extends CanvasNode>(node: T): node is T & WithWhileTap {\n\treturn key in node\n}\n\nexport function hasWhileTap<T extends CanvasNode>(node: T): node is T & WithWhileTap & { whileTapEnabled: true } {\n\treturn withWhileTap(node) && node.whileTapEnabled === true\n}\n\nexport function whileTapTransforms(node: CanvasNode): Transforms {\n\tif (!withWhileTap(node)) return identity\n\treturn {\n\t\tscale: node.whileTapScale ?? 1,\n\t\tskewX: node.whileTapSkewX ?? 0,\n\t\tskewY: node.whileTapSkewY ?? 0,\n\t\trotate: getEffectRotate(node, node.whileTapRotateAdditiveDynamicValue, node.whileTapRotate),\n\t\trotateX: node.whileTapRotate3d ? (node.whileTapRotateX ?? 0) : 0,\n\t\trotateY: node.whileTapRotate3d ? (node.whileTapRotateY ?? 0) : 0,\n\t\tx: node.whileTapX ?? 0,\n\t\ty: node.whileTapY ?? 0,\n\t\ttranslateZ: 0,\n\t}\n}\n", "export function memoRecord<T extends object>(createRecord: () => T) {\n\tlet record: T | undefined\n\n\treturn () => {\n\t\tif (record === undefined) {\n\t\t\trecord = createRecord()\n\t\t}\n\n\t\treturn record\n\t}\n}\n", "import { borderDefaults } from \"document/models/CanvasTree/traits/WithBorder.ts\"\nimport { boxShadowDefaults } from \"document/models/CanvasTree/traits/WithBoxShadowDefaults.ts\"\nimport { withExportDefaults } from \"document/models/CanvasTree/traits/WithExport.ts\"\nimport { codeComponentFillDefaults } from \"document/models/CanvasTree/traits/WithFillDefaults.ts\"\nimport { filterDefaults } from \"document/models/CanvasTree/traits/WithFilters.ts\"\nimport { relativeRadiusDefaults } from \"document/models/CanvasTree/traits/WithRadius.ts\"\nimport { radiusPerCornerDefaults } from \"document/models/CanvasTree/traits/WithRadiusPerCorner.ts\"\nimport { aspectRatioDefaults } from \"../traits/WithAspectRatio.ts\"\nimport { blendingDefaults } from \"../traits/WithBlending.ts\"\nimport { codeComponentDefaults } from \"../traits/WithCodeComponent.ts\"\nimport { codeOverrideDefaults } from \"../traits/WithCodeOverride.ts\"\nimport { cursorDefaults } from \"../traits/WithCursor.ts\"\nimport { customizationsDefaults } from \"../traits/WithCustomizations.ts\"\nimport { dataLoaderVariantsDefaults } from \"../traits/WithDataLoaderVariants.ts\"\nimport { dragEffectDefaults } from \"../traits/WithDragEffect.ts\"\nimport { draggableDefaults } from \"../traits/WithDraggable.ts\"\nimport { floatingPositionDefaults } from \"../traits/WithFloatingPosition.ts\"\nimport { formVariantsDefaults } from \"../traits/WithFormVariants.ts\"\nimport { gridItemSizeDefaults } from \"../traits/WithGridItemSize.ts\"\nimport { intrinsicSizeDefaults } from \"../traits/WithIntrinsicSize.ts\"\nimport { kitSectionHashDefaults } from \"../traits/WithKitSectionHash.ts\"\nimport { kitSectionSourceDefaults } from \"../traits/WithKitSectionSource.ts\"\nimport { lockDefaults } from \"../traits/WithLock.ts\"\nimport { loopEffectDefaults } from \"../traits/WithLoopEffect.ts\"\nimport { masksDefaults } from \"../traits/WithMasks.ts\"\nimport { nameDefaults } from \"../traits/WithName.ts\"\nimport { opacityDefaults } from \"../traits/WithOpacity.ts\"\nimport { parallaxDefaults } from \"../traits/WithParallax.ts\"\nimport { pinDefaults } from \"../traits/WithPins.ts\"\nimport { pointerEventsDefaults } from \"../traits/WithPointerEvents.ts\"\nimport { positionTypeDefaults } from \"../traits/WithPositionType.ts\"\nimport { previewSettingsDefaults } from \"../traits/WithPreviewSettings.ts\"\nimport { repeatArrayDefaults } from \"../traits/WithRepeatArray.ts\"\nimport { rotationDefaults } from \"../traits/WithRotation.ts\"\nimport { scrollTargetDefaults } from \"../traits/WithScrollTarget.ts\"\nimport { sizeDefaults } from \"../traits/WithSize.ts\"\nimport { sizeConstraintsDefaults } from \"../traits/WithSizeConstraints.ts\"\nimport { styleAppearEffectDefaults } from \"../traits/WithStyleAppearEffect.ts\"\nimport { styleTransformEffectDefaults } from \"../traits/WithStyleTransformEffect.ts\"\nimport { tokenOverridesDefaults } from \"../traits/WithTokenOverrides.ts\"\nimport { transformDefaults } from \"../traits/WithTransforms.ts\"\nimport { transitionDefaults } from \"../traits/WithTransition.ts\"\nimport { triggerActionsDefaults } from \"../traits/WithTriggerActions.ts\"\nimport { userSelectDefaults } from \"../traits/WithUserSelect.ts\"\nimport { appearEffectDefaults } from \"../traits/WithVariantAppearEffect.ts\"\nimport { viewTransitionNoneDefaults } from \"../traits/WithViewTransitionNone.ts\"\nimport { visibilityDefaults } from \"../traits/WithVisibility.ts\"\nimport { whileHoverDefaults } from \"../traits/WithWhileHover.ts\"\nimport { whileOpenEffectDefaults } from \"../traits/WithWhileOpenEffect.ts\"\nimport { whileTapDefaults } from \"../traits/WithWhileTap.ts\"\nimport { zIndexDefaults } from \"../traits/WithZIndex.ts\"\nimport { memoRecord } from \"./memoRecord.ts\"\n\nexport const getCodeComponentRecord = memoRecord(() => {\n\treturn {\n\t\t...appearEffectDefaults,\n\t\t...aspectRatioDefaults,\n\t\t...blendingDefaults,\n\t\t...borderDefaults,\n\t\t...boxShadowDefaults,\n\t\t...codeComponentDefaults,\n\t\t...codeComponentFillDefaults,\n\t\t...codeOverrideDefaults,\n\t\t...cursorDefaults,\n\t\t...customizationsDefaults,\n\t\t...kitSectionHashDefaults,\n\t\t...kitSectionSourceDefaults,\n\t\t...draggableDefaults,\n\t\t...dragEffectDefaults,\n\t\t...filterDefaults,\n\t\t...floatingPositionDefaults,\n\t\t...formVariantsDefaults,\n\t\t...dataLoaderVariantsDefaults,\n\t\t...gridItemSizeDefaults,\n\t\t...intrinsicSizeDefaults,\n\t\t...lockDefaults,\n\t\t...loopEffectDefaults,\n\t\t...masksDefaults,\n\t\t...nameDefaults,\n\t\t...opacityDefaults,\n\t\t...parallaxDefaults,\n\t\t...pinDefaults,\n\t\t...pointerEventsDefaults,\n\t\t...positionTypeDefaults,\n\t\t...previewSettingsDefaults,\n\t\t...radiusPerCornerDefaults,\n\t\t...relativeRadiusDefaults,\n\t\t...repeatArrayDefaults,\n\t\t...rotationDefaults,\n\t\t...scrollTargetDefaults,\n\t\t...sizeConstraintsDefaults,\n\t\t...sizeDefaults,\n\t\t...styleAppearEffectDefaults,\n\t\t...styleTransformEffectDefaults,\n\t\t...tokenOverridesDefaults,\n\t\t...transformDefaults,\n\t\t...transitionDefaults,\n\t\t...triggerActionsDefaults,\n\t\t...userSelectDefaults,\n\t\t...viewTransitionNoneDefaults,\n\t\t...visibilityDefaults,\n\t\t...whileHoverDefaults,\n\t\t...whileOpenEffectDefaults,\n\t\t...whileTapDefaults,\n\t\t...withExportDefaults,\n\t\t...zIndexDefaults,\n\t\tcodeComponentPackageVersion: null,\n\t\tslotsAreChildNodes: undefined,\n\t}\n})\n", "import { propCollector } from \"code-generation/utils/collector.ts\"\nimport { stringFromNodeID } from \"../../nodes/NodeID.ts\"\nimport { hasFloatingPosition } from \"../WithFloatingPosition.ts\"\n\nexport const collectCanvasFloatingPosition = propCollector((node, props) => {\n\tif (!node.parentid || !hasFloatingPosition(node)) return\n\n\tprops[\"data-framer-offset-parent-id\"] = stringFromNodeID(node.parentid)\n\tprops.left = 0\n\tprops.top = 0\n\tprops.position = \"relative\"\n})\n", "import type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport type { UnknownProps } from \"../utils/UnknownProps.ts\"\n\nexport function collectGroundNodeLayout(node: CanvasNode, props: UnknownProps) {\n\tif (!node.__unsafeIsGroundNode()) return\n\n\t// Ground Nodes are positioned with X/Y transforms so we need to rewrite top/left position\n\t// to be pinned to the top/left of the wrapper.\n\tprops.left = 0\n\tprops.top = 0\n}\n", "import { js } from \"code-generation/js/js.ts\"\n\n/**\n * If we create a variable in generated code, we need to ensure that generated\n * variables based on user input don't attempt to use the same names, so we use\n * this map to reference all hardcoded bindings in the code generation template,\n * and then consume it when generating variables.\n */\nexport const Var = {\n\tactiveLocale: js`activeLocale`,\n\tactiveVariantCallback: js`activeVariantCallback`,\n\taddVariantProps: js`addVariantProps`,\n\tbaseVariant: js`baseVariant`,\n\tbreakpoints: js`breakpoints`,\n\tchildren: js`children`,\n\tclassName: js`className`,\n\t/**\n\t * These are the variant classNames that select the correct styles based on\n\t * the active Smart Component Variants, a key of the `useVariantState`\n\t * return value.\n\t */\n\tclassNames: js`classNames`,\n\tComponent: js`Component`,\n\tcomponentViewport: js`componentViewport`,\n\tcss: js`css`,\n\tcurrentPathVariables: js`currentPathVariables`,\n\tcurrentRouteData: js`currentRouteData`,\n\tcycleOrder: js`cycleOrder`,\n\tdefaultLayoutId: js`defaultLayoutId`,\n\tdefaultVariant: js`defaultVariant`,\n\tdelay: js`delay`,\n\tenabledGestures: js`enabledGestures`,\n\tgestureVariant: js`gestureVariant`,\n\tgetFromCurrentRouteData: js`getFromCurrentRouteData`,\n\thydratedBaseVariant: js`hydratedBaseVariant`,\n\tisBrowser: js`isBrowser`,\n\tlayoutDependency: js`layoutDependency`,\n\tlayoutDirection: js`layoutDirection`,\n\tlayoutId: js`layoutId`,\n\ttransformTemplate: js`transformTemplate`,\n\touterVariant: js`outerVariant`,\n\touterVariantId: js`outerVariantId`,\n\tref: js`ref`,\n\trefBinding: js`refBinding`,\n\tsharedStyleClassNames: js`sharedStyleClassNames`,\n\tserializationHash: js`serializationHash`,\n\tsetGestureState: js`setGestureState`,\n\tgestureHandlers: js`gestureHandlers`,\n\tsetLocale: js`setLocale`,\n\tstyle: js`style`,\n\tprops: js`props`,\n\ttransition: js`transition`,\n\ttransitions: js`transitions`,\n\tvariant: js`variant`,\n\tvariantClassNames: js`variantClassNames`,\n\tvariantProps: js`variantProps`,\n\tvariants: js`variants`,\n\tqueryParamNames: js`queryParamNames`,\n\trestProps: js`restProps`,\n\tclearLoadingGesture: js`clearLoadingGesture`,\n\tisLoading: js`isLoading`,\n} as const\n", "import type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isArray, isObject, isString } from \"utils/typeChecks.ts\"\nimport type { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { RenderConditions } from \"../types.ts\"\nimport type { ConditionalRenderingCollector } from \"../utils/ConditionalRenderingCollector.ts\"\nimport type { SafeJS, SerializableObject } from \"./serializeJS.ts\"\n\nexport type JSXAttributes = SerializableObject\n\ninterface JSXText {\n\ttext: string\n}\ninterface JSXVariable {\n\tvariableName: string\n}\nexport type TemplateFn = (jsx: SafeJS) => SafeJS\ninterface TagTransform {\n\t/** Receives the tag's JSX and can return any valid JavaScript to replace/wrap it. */\n\ttemplate?: TemplateFn\n}\n\nexport interface SerializeJSXOptions {\n\tcreateRenderCondition?: ConditionalRenderingCollector[\"create\"]\n\tcreateTagUpdate?: CreateTagUpdateFunction\n}\n\ninterface TagTransformAttributes {\n\tattributes?: JSXAttributes\n}\n\ninterface FramerProperties {\n\tprimaryRenderCondition?: SafeJS | boolean\n\tvariantRenderConditions?: RenderConditions\n\ttransformElement?: (element: JSXElement, options: SerializeJSXOptions) => TagTransform & TagTransformAttributes\n\ttransformChildren?: (element: JSXElement, options: SerializeJSXOptions) => TagTransform\n\thiddenInVariants?: HiddenInVariants\n}\nexport interface JSXTag extends FramerProperties {\n\tid: NodeID\n\tname: SafeJS\n\tattributes: JSXAttributes\n\tchildren: JSXElement[]\n\ttype?: ClassDiscriminator | ComponentTagType\n}\n\nexport function isJSXText(value: unknown): value is JSXText {\n\treturn isObject(value) && \"text\" in value && isString(value.text)\n}\nexport function isJSXVariable(value: unknown): value is JSXVariable {\n\treturn isObject(value) && \"variableName\" in value && isString(value.variableName)\n}\nexport function isJSXTag(value: unknown): value is JSXTag {\n\treturn isObject(value) && \"name\" in value && \"children\" in value && \"attributes\" in value\n}\n\nexport function isJSXTagArray(value: unknown): value is JSXTag[] {\n\treturn isArray(value) && value.every(isJSXTag)\n}\n\nexport type JSXElement = JSXTag | JSXText | JSXVariable | SafeJS\n\ninterface Replace {\n\ttype: \"replace\"\n\ttag: JSXTag\n}\n\nexport interface Patch extends FramerProperties {\n\ttype: \"patch\"\n\tname?: SafeJS\n\tattributes?: JSXAttributes\n\thiddenInVariants?: HiddenInVariants\n}\n\nexport type TagUpdate = Replace | Patch | undefined\n/** @deprecated */\nexport type CreateTagUpdateFunction = (tag: JSXTag, hiddenInVariants?: HiddenInVariants) => TagUpdate\n\nexport const enum ComponentTagType {\n\tAnimatePresence = \"animate-presence\",\n\tFragment = \"fragment\",\n\tOverlay = \"overlay\",\n}\n\nexport type HiddenInVariants = Set<string>\n", "import { getLogger } from \"@framerjs/shared\"\nimport { isArray, isBoolean, isNull, isNumber, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { JSXTag } from \"./jsxTypes.ts\"\nimport { isJSXTagArray } from \"./jsxTypes.ts\"\nimport { SafeJS, SerializableObject, serializeJS } from \"./serializeJS.ts\"\n\nconst log = getLogger(\"SerializableValue\")\n\nexport interface SerializableRecord {\n\t[key: string]: SerializableValue | undefined\n}\n\nexport type SerializableValue =\n\t| boolean\n\t| null\n\t| number\n\t| string\n\t| SerializableObject\n\t| SafeJS\n\t| readonly SerializableValue[]\n\t| JSXTag[]\n\t| SerializableRecord\n\nexport function isSerializableValue(value: unknown): value is SerializableValue {\n\tif (isBoolean(value) || isNull(value) || isNumber(value) || isString(value)) return true\n\tif (value instanceof SerializableObject) return true\n\tif (value instanceof SafeJS) return true\n\tif (isUndefined(value)) return false\n\tif (isJSXTagArray(value)) return true\n\tif (isArray(value) && value.every(isSerializableValue)) return true\n\tif (isObject(value)) {\n\t\tlet isSerializable = true\n\t\tfor (const key in value) {\n\t\t\tconst v = value[key]\n\t\t\tif (!isUndefined(v) && !isSerializableValue(v)) {\n\t\t\t\tisSerializable = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif (isSerializable) return true\n\t}\n\tlog.reportError(`Encountered non-serializable value`, { value, serialized: serializeJS(value) })\n\treturn false\n}\n", "export function getFirstItemFromIterable<T>(items: Iterable<T>): T | undefined {\n\tfor (const item of items) {\n\t\treturn item\n\t}\n\treturn undefined\n}\n", "import type { SafeJS } from \"code-generation/js/serializeJS.ts\"\n\nexport function toCSSCustomPropertyName(name: string | SafeJS): `--${string}` {\n\treturn `--${name}`\n}\n", "import hash from \"@emotion/hash\"\nimport { assert, assertNever } from \"@framerjs/shared\"\nimport type { SerializableValue } from \"code-generation/js/SerializableValue.ts\"\nimport { isSerializableValue } from \"code-generation/js/SerializableValue.ts\"\nimport { js, jst } from \"code-generation/js/js.ts\"\nimport type { SafeJS } from \"code-generation/js/serializeJS.ts\"\nimport { isSafeJS } from \"code-generation/js/serializeJS.ts\"\nimport type { CreateDeduplicatedDynamicValueBinding } from \"code-generation/jsx/createDeduplicatedDynamicValueBinding.ts\"\nimport type { CanvasNode, CanvasTree, NodeID, ScopeNode } from \"document/models/CanvasTree/index.ts\"\nimport type { VectorSetNode } from \"document/models/CanvasTree/nodes/VectorSetNode.ts\"\nimport {\n\tisLayoutTemplateNode,\n\tisSmartComponentNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { WithLayout } from \"document/models/CanvasTree/traits/WithLayout.ts\"\nimport type { WithRichText } from \"document/models/CanvasTree/traits/WithRichText.ts\"\nimport type { KeysSupportingVariables } from \"document/models/CanvasTree/utils/allVariableKeys.ts\"\nimport {\n\tgetNodePropertyControlDescription,\n\tisNodePropertyControlKey,\n} from \"document/models/CanvasTree/utils/nodePropertyControlDefinitions.ts\"\nimport { isTokenCSSVariable, stripMetadataFromCSSVariable } from \"document/models/CanvasTree/utils/tokens.ts\"\nimport { Color, ConvertColor } from \"library/index.ts\"\nimport { P3Color } from \"library/render/types/Color/Color.ts\"\nimport { type CSSVariableName, getRichTextVariables, serializeVariableName } from \"prosemirror/variables.ts\"\nimport { getFirstItemFromIterable } from \"utils/getFirstItemFromIterable.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport type { VariableCollector } from \"./VariableCollector.ts\"\nimport { toCSSCustomPropertyName } from \"./toCSSCustomPropertyName.ts\"\nimport type { ValueTransformCollector } from \"./valueTransformCollector/ValueTransformCollector.ts\"\n\nexport type CSSCalcExpression = `calc(${string})`\n\ntype KeysRequiringCSSVariableBinding =\n\t| Extract<\n\t\t\tKeysSupportingVariables,\n\t\t\t| \"fillColor\"\n\t\t\t| \"opacity\"\n\t\t\t| \"backdropFill\"\n\t\t\t| \"radius\"\n\t\t\t| \"cornerShape\"\n\t\t\t| \"rotation\"\n\t\t\t| \"stackDirection\"\n\t\t\t| \"stackDistribution\"\n\t\t\t| \"stackAlignment\"\n\t\t\t| \"gap\"\n\t\t\t| \"gridItemColumnSpan\"\n\t\t\t| \"gridItemRowSpan\"\n\t\t\t| \"padding\"\n\t\t\t| \"zIndex\"\n\t\t\t| \"userSelect\"\n\t\t\t| \"overscrollBehavior\"\n\t\t\t| \"overflow\"\n\t\t\t| \"overflowX\"\n\t\t\t| \"overflowY\"\n\t\t\t| \"pointerEvents\"\n\t\t\t| \"blendingMode\"\n\t\t\t| \"perspective\"\n\t\t\t| \"cursor\"\n\t\t\t| \"boxShadows\"\n\t\t\t| \"formTextAreaResizable\"\n\t\t\t| \"tapHighlightColor\"\n\t\t\t| \"imageRendering\"\n\t\t\t| \"strokeColor\"\n\t\t\t| \"strokeWidth\"\n\t\t\t| \"fillOpacity\"\n\t\t\t| \"textTruncation\"\n\t  >\n\t| \"borderColor\"\n\t| \"borderStyle\"\n\t| \"borderTopWidth\"\n\t| \"borderBottomWidth\"\n\t| \"borderLeftWidth\"\n\t| \"borderRightWidth\"\n\nexport type CSSVariableReference = `var(${CSSVariableName})`\n\nconst svgColorKeys = {\n\tfillColor: true,\n\tstrokeColor: true,\n}\n\nexport class SVGVariableDefinitionCollector {\n\tbindings: Map<CSSVariableName, SafeJS> = new Map()\n\n\tconstructor(\n\t\tprivate readonly vectorSet: VectorSetNode,\n\t\tprivate readonly variables: VariableCollector,\n\t\tprivate readonly colors: ColorCollector,\n\t) {}\n\n\tcreate<T extends CanvasNode, K extends KeysRequiringCSSVariableBinding & keyof T>(\n\t\t/** The node to create the CSS variable for. */\n\t\tnode: T,\n\t\t/** The key on the node to create the CSS variable for. */\n\t\tkey: K,\n\t): CSSVariableReference {\n\t\tconst value = node[key]\n\t\tassert(isVariableReference(value), \"Must be a variable reference value.\")\n\t\tif (key in svgColorKeys) this.colors.recordVariableColor(value)\n\t\tconst defaultValue = this.vectorSet.variables.find(variable => variable.id === value.id)?.initialValue\n\t\tconst binding = this.variables.create(value)\n\t\tconst name = variableToCSSVariableName(binding)\n\n\t\tthis.bindings.set(name, binding)\n\n\t\treturn `var(${name}, ${isTokenCSSVariable(defaultValue) ? stripMetadataFromCSSVariable(defaultValue) : defaultValue})`\n\t}\n\n\tget singleVariableName() {\n\t\treturn this.bindings.keys().next().value\n\t}\n}\n\n/**\n * When serializing colors in the color(display-p3 ...) syntax, we need to generate values that can\n * be rendered in browsers that don't support it. To do that we replace the color with a css custom\n * property reference with an rgb fallback. The custom property reference will only be set in\n * browsers that support it.\n */\nexport class ColorCollector {\n\tprivate wideGamutColors = new Set<string>()\n\tprivate tokenColors = new Set<string>()\n\tprivate srgbColors = new Set<string | NodeID>()\n\tprivate variableColors = new Set<string>()\n\n\twideGamutColorVariables = new Map<string, string>()\n\twideGamutColorVariablesByNode = new Map<string, [string, string][]>()\n\tresolveColor(value: string | undefined): string | undefined {\n\t\tif (!value) return value\n\t\tif (isTokenCSSVariable(value)) return stripMetadataFromCSSVariable(value)\n\t\tif (!Color.isP3String(value)) return ConvertColor.toRgbString(value)\n\n\t\tconst rgbString = P3Color.fromString(value)?.toString(\"srgb\")\n\t\tif (!rgbString) return value\n\n\t\tconst binding = variableToCSSVariableName(value)\n\n\t\tthis.wideGamutColorVariables.set(binding, value)\n\n\t\treturn variableNameToCSSVariableReference(binding, rgbString)\n\t}\n\n\trecordVariableColor(value: VariableReference) {\n\t\tthis.variableColors.add(value.id)\n\t}\n\n\t// VECTOR @TODO - We should also track fully opaque colors here. As long as only the alpha\n\t// changes, we can still use a mask.\n\taddColor(value: string | undefined) {\n\t\tif (!value) return value\n\t\tif (isTokenCSSVariable(value)) {\n\t\t\tconst token = stripMetadataFromCSSVariable(value)\n\t\t\tif (!token) return value\n\n\t\t\tthis.tokenColors.add(token)\n\t\t\treturn token\n\t\t}\n\t\tif (!Color.isP3String(value)) {\n\t\t\tthis.srgbColors.add(value)\n\t\t\treturn ConvertColor.toRgbString(value)\n\t\t}\n\t\tthis.wideGamutColors.add(value)\n\t\treturn value\n\t}\n\n\tget uniqueColorCount() {\n\t\treturn this.srgbColors.size + this.wideGamutColors.size + this.variableColors.size + this.tokenColors.size\n\t}\n\n\tget singleTokenColor() {\n\t\treturn getFirstItemFromIterable(this.tokenColors)\n\t}\n\n\tget singleWideGamutColor() {\n\t\treturn getFirstItemFromIterable(this.wideGamutColors)\n\t}\n\n\tget singleVariableColor() {\n\t\treturn getFirstItemFromIterable(this.variableColors)\n\t}\n\n\tget singleColor() {\n\t\treturn this.singleTokenColor ?? this.singleWideGamutColor ?? getFirstItemFromIterable(this.srgbColors)\n\t}\n\n\thasColorsOfType(type: \"srgb\" | \"wideGamut\" | \"variable\" | \"token\") {\n\t\tswitch (type) {\n\t\t\tcase \"srgb\":\n\t\t\t\treturn this.srgbColors.size > 0\n\t\t\tcase \"wideGamut\":\n\t\t\t\treturn this.wideGamutColors.size > 0\n\t\t\tcase \"variable\":\n\t\t\t\treturn this.variableColors.size > 0\n\t\t\tcase \"token\":\n\t\t\t\treturn this.tokenColors.size > 0\n\t\t\tdefault:\n\t\t\t\tassertNever(type)\n\t\t}\n\t}\n\n\tgetWideGamutColorRules(selector: string, selectorsByNodeId?: Map<NodeID, string>) {\n\t\tconst colors: string[] = []\n\t\tconst rules: string[] = []\n\n\t\t// Most values are color strings. They can be inlined in a single rule scoped to the\n\t\t// serialization id.\n\t\tfor (const [binding, value] of this.wideGamutColorVariables) {\n\t\t\tcolors.push(`${binding}: ${value};`)\n\t\t}\n\n\t\t// Colors for Dynamic Values from the CMS are scoped to the node's selector because the wide\n\t\t// gamut color may only be available in the closure of the node. We need to create a pointer\n\t\t// from the variable declaration on the node's style, to the variable reference.\n\t\tfor (const [id, values] of this.wideGamutColorVariablesByNode) {\n\t\t\tconst nodeSelector = selectorsByNodeId?.get(id)\n\t\t\tif (!nodeSelector) continue\n\n\t\t\tconst cmsColors: string[] = []\n\t\t\tfor (const [binding, value] of values) {\n\t\t\t\tcmsColors.push(`${binding}: ${value};`)\n\t\t\t}\n\n\t\t\trules.push(`${nodeSelector} { ${cmsColors.join(\" \")} }`)\n\t\t}\n\n\t\t// If we have any color values, we can create a single rule.\n\t\tif (colors.length > 0) rules.push(`${selector} { ${colors.join(\" \")} }`)\n\n\t\treturn rules\n\t}\n}\n\nexport class CSSVariableDefinitionCollector extends ColorCollector {\n\tprivate definitions: Map<NodeID, Record<CSSVariableName, SafeJS | string>> = new Map()\n\tprivate bindingsByDynamicValue: Map<DynamicValue, SafeJS> = new Map()\n\n\tconstructor(\n\t\tprivate readonly entryNode: ScopeNode,\n\t\tprivate readonly variables: VariableCollector,\n\t\tprivate readonly tree: CanvasTree,\n\t\tprivate readonly valueTransforms: ValueTransformCollector,\n\t\tprivate readonly createDeduplicatedDynamicValueBinding: CreateDeduplicatedDynamicValueBinding,\n\t) {\n\t\tsuper()\n\t}\n\n\tgetDefinitionsForNode(node: CanvasNode) {\n\t\treturn this.definitions.get(node.getPrimaryId())\n\t}\n\n\tgetBindingForDynamicValue(value: DynamicValue) {\n\t\treturn this.bindingsByDynamicValue.get(value)\n\t}\n\n\tcreateRichTextVariable(richTextNode: CanvasNode & WithRichText) {\n\t\tconst result: Record<string, SafeJS | CSSVariableReference> = {}\n\t\tconst variables = getRichTextVariables(richTextNode.html)\n\t\tfor (const variable of variables) {\n\t\t\tconst variableName = serializeVariableName(variable)\n\t\t\tconst binding = this.variables.create(variable)\n\t\t\tthis.addToNodeDefinitions(richTextNode, binding, variableName)\n\t\t\tthis.bindingsByDynamicValue.set(variable, binding)\n\n\t\t\tresult[variableName] =\n\t\t\t\t// @TODO LAYOUT_TEMPLATE: Make a union for this type that\n\t\t\t\t// doesn't lose loaded status.\n\t\t\t\tisLayoutTemplateNode(this.entryNode) || isWebPageNode(this.entryNode)\n\t\t\t\t\t? variableNameToCSSVariableReference(variableToCSSVariableName(binding))\n\t\t\t\t\t: binding\n\t\t}\n\n\t\treturn result\n\t}\n\n\ttransformForKey(key: KeysRequiringCSSVariableBinding, args: SerializableValue[]) {\n\t\tswitch (key) {\n\t\t\tcase \"zIndex\":\n\t\t\t\t// Transform all zIndex css variable values to be within Framer's range.\n\t\t\t\treturn (value: SafeJS) => this.valueTransforms.wrapInToZIndex(value)\n\t\t\tcase \"overflow\":\n\t\t\t\t// Apply overflow clip fallback for Safari 15 compatibility\n\t\t\t\treturn (value: SafeJS) => this.valueTransforms.wrapInToOverflowWithClipFallback(value)\n\t\t\tcase \"overflowX\":\n\t\t\tcase \"overflowY\": {\n\t\t\t\tconst overflow = args[0]\n\t\t\t\tassert(isSerializableValue(overflow), \"overflow argument is not a serializable value\")\n\t\t\t\treturn (value: SafeJS) => {\n\t\t\t\t\t// First apply axis overflow logic, then apply clip fallback\n\t\t\t\t\tconst axisValue = this.valueTransforms.wrapInToAxisOverflow(value, overflow)\n\t\t\t\t\treturn this.valueTransforms.wrapInToOverflowWithClipFallback(axisValue)\n\t\t\t\t}\n\t\t\t}\n\t\t\tcase \"padding\":\n\t\t\tcase \"gap\":\n\t\t\t\treturn (value: SafeJS) => this.valueTransforms.wrapInNumberToPixelString(value)\n\t\t\tcase \"radius\": {\n\t\t\t\tconst cornerIndex = args[0]\n\t\t\t\tassert(isNumber(cornerIndex), \"cornerIndex argument is not a number\")\n\t\t\t\treturn (value: SafeJS) => this.valueTransforms.wrapInRadiusForCorner(value, cornerIndex)\n\t\t\t}\n\t\t\tcase \"cornerShape\":\n\t\t\t\treturn (value: SafeJS) => this.valueTransforms.wrapInPercentageToCornerShape(value)\n\t\t\tcase \"formTextAreaResizable\":\n\t\t\t\treturn (value: SafeJS) => js`${value} ? \"vertical\" : undefined`\n\t\t\tcase \"gridItemColumnSpan\": {\n\t\t\t\tconst columnCount = args[0]\n\t\t\t\treturn (value: SafeJS) => this.valueTransforms.wrapInGetGridColumnCSSValue(value, columnCount)\n\t\t\t}\n\t\t\tcase \"gridItemRowSpan\":\n\t\t\t\treturn (value: SafeJS) => this.valueTransforms.wrapInGetGridRowCSSValue(value)\n\t\t\tdefault:\n\t\t\t\treturn undefined\n\t\t}\n\t}\n\n\t/**\n\t * Creates a CSS variable for a dynamic value on a node.\n\t */\n\tcreate<T extends CanvasNode, K extends KeysRequiringCSSVariableBinding & keyof T>(\n\t\t/** The node to create the CSS variable for. */\n\t\tnode: T,\n\t\t/** The key on the node to create the CSS variable for. */\n\t\tkey: K,\n\t\t/** Any extra arguments to pass to the custom transformer function (if defined). */\n\t\t...args: SerializableValue[]\n\t) {\n\t\tconst value = node[key]\n\t\tassert(isDynamicValue(value), \"Must be a dynamic value.\")\n\n\t\tconst outputControl = isNodePropertyControlKey(key) ? getNodePropertyControlDescription(key) : undefined\n\t\tconst transform = this.transformForKey(key, args)\n\t\tconst binding = this.createDeduplicatedDynamicValueBinding(value, node, key, transform, outputControl)\n\t\tthis.bindingsByDynamicValue.set(value, binding)\n\t\treturn this.createCSSVariableFromBinding(node, key, binding, this.isDynamicValueProvidedByProps(value))\n\t}\n\n\tcreateNegativeColumnGap(node: CanvasNode & WithLayout, gap: DynamicValue) {\n\t\tconst key = \"gap\" as const satisfies keyof WithLayout\n\t\tconst transform = (value: SafeJS) => js`${jst`-${this.valueTransforms.wrapInGetNumericColumnGap(value)}px`}`\n\t\tconst binding = this.createDeduplicatedDynamicValueBinding(gap, node, key, transform, undefined)\n\t\tthis.bindingsByDynamicValue.set(gap, binding)\n\t\treturn this.createCSSVariableFromBinding(node, key, binding, this.isDynamicValueProvidedByProps(gap))\n\t}\n\n\t/**\n\t * Dynamic Values that are provided by Layout Templates or Smart Components are provided via\n\t * React props. Colors provided by these variables can be assumed to already be formatted to\n\t * fallback to rgb syntax.\n\t */\n\tprivate isDynamicValueProvidedByProps(value: DynamicValue): boolean {\n\t\tconst providerId = variableReferenceProviderIdForDynamicValue(value) ?? this.entryNode.id\n\t\tconst provider = this.tree.get(providerId)\n\t\treturn isSmartComponentNode(provider) || isLayoutTemplateNode(provider)\n\t}\n\n\tcreateConditionVariable(\n\t\tdefinitionProviderId: NodeID,\n\t\tcondition: SafeJS,\n\t\ttruthyValue: string | number | undefined,\n\t\tfalsyValue: string | number | undefined,\n\t) {\n\t\tif (truthyValue === falsyValue) {\n\t\t\treturn String(truthyValue)\n\t\t}\n\n\t\tconst conditionalBinding = js`${condition} ? ${truthyValue ?? js`undefined`} : ${falsyValue ?? js`undefined`}`\n\t\tconst definitionProviderNode = this.tree.get(definitionProviderId)\n\t\tconst originalDefinitionProviderId = definitionProviderNode?.getPrimaryId()\n\t\tif (!originalDefinitionProviderId) return undefined\n\n\t\tthis.addToDefinitions(originalDefinitionProviderId, conditionalBinding)\n\t\tconst variableName = variableToCSSVariableName(conditionalBinding)\n\t\treturn variableNameToCSSVariableReference(variableName)\n\t}\n\n\tcreateCSSVariableFromBinding<T extends CanvasNode, K extends KeysRequiringCSSVariableBinding>(\n\t\tnode: T,\n\t\tkey: K,\n\t\tbinding: SafeJS,\n\t\tprovidedBySmartComponent: boolean = false,\n\t): SafeJS | CSSVariableReference | CSSCalcExpression {\n\t\tconst isUsingCSS = isVariableKeyUsingCSS(key, this.entryNode)\n\t\tconst variableName = variableToCSSVariableName(binding)\n\t\tif (isUsingCSS) {\n\t\t\tthis.addToNodeDefinitions(node, binding, variableName)\n\n\t\t\tswitch (key) {\n\t\t\t\tcase \"borderColor\":\n\t\t\t\tcase \"fillColor\":\n\t\t\t\tcase \"strokeColor\": {\n\t\t\t\t\t// Computed Colors provided by the CMS may need a fallback for browsers that don't\n\t\t\t\t\t// support the P3 color syntax at runtime.\n\t\t\t\t\tif (providedBySmartComponent) break\n\t\t\t\t\tconst supportedBinding = variableToCSSVariableName(variableName)\n\n\t\t\t\t\tconst id = node.getPrimaryId()\n\t\t\t\t\tconst existing = this.wideGamutColorVariablesByNode.get(id) ?? []\n\t\t\t\t\texisting.push([supportedBinding, variableNameToCSSVariableReference(variableName)])\n\t\t\t\t\tthis.wideGamutColorVariablesByNode.set(id, existing)\n\n\t\t\t\t\t// The fallback is a clamped rgb value. It is another variable reference if the\n\t\t\t\t\t// property being bound is in css declarations.\n\t\t\t\t\tconst fallbackValue = this.valueTransforms.wrapInClampRGB(binding)\n\t\t\t\t\tconst fallbackReference = variableToCSSVariableName(fallbackValue)\n\t\t\t\t\tthis.addToNodeDefinitions(node, fallbackValue, fallbackReference)\n\n\t\t\t\t\treturn variableNameToCSSVariableReference(\n\t\t\t\t\t\tsupportedBinding,\n\t\t\t\t\t\tvariableNameToCSSVariableReference(fallbackReference),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst variable = isUsingCSS ? variableNameToCSSVariableReference(variableName) : binding\n\t\treturn addCSSUnitConversionIfNeeded(variable, key)\n\t}\n\n\tprivate addToNodeDefinitions(\n\t\tnode: CanvasNode,\n\t\tvariable: SafeJS | string,\n\t\t/**\n\t\t * The name of the CSS variable. By default, the name is not required, and a CSS variable is created by hashing\n\t\t * the variable name. If the CSS variable name requires a specific convention (e.g., RichTexts create variables\n\t\t * like '--variable-reference-...'), provide it as 'name' to be used directly instead.\n\t\t */\n\t\tname?: CSSVariableName,\n\t) {\n\t\tconst originalId = node.getPrimaryId()\n\t\tthis.addToDefinitions(originalId, variable, name)\n\t}\n\n\tprivate addToDefinitions(\n\t\toriginalId: NodeID,\n\t\tvariable: SafeJS | string,\n\t\t/**\n\t\t * The name of the CSS variable. By default, the name is not required, and a CSS variable is created by hashing\n\t\t * the variable name. If the CSS variable name requires a specific convention (e.g., RichTexts create variables\n\t\t * like '--variable-reference-...'), provide it as 'name' to be used directly instead.\n\t\t */\n\t\tname?: CSSVariableName,\n\t) {\n\t\tconst variableName = name ?? variableToCSSVariableName(variable)\n\t\tconst currentDefinitions = this.definitions.get(originalId) ?? {}\n\t\tcurrentDefinitions[variableName] = variable\n\t\tthis.definitions.set(originalId, currentDefinitions)\n\t}\n}\n\n/**\n * If a prop maybe animated with framer-motion variants, we collect them as inline styles when generating for a Smart\n * Component. If they will never be animated, they will be included in a CSS class. (See collectStaticStyle v.s.\n * collectAnimatableStyle in code-generation/jsx/styleForNode)\n */\nfunction isVariableKeyUsingCSS(key: KeysRequiringCSSVariableBinding, entryNode: ScopeNode) {\n\tswitch (key) {\n\t\t// Border styles are hardcoded to use CSS variables (e.g. --framer-border-color) in the shared border rules for\n\t\t// the data-border::after pseudo-element. When generating them for Smart Components, we don't want to reference\n\t\t// it as yet another CSS variable because that would break variant animations.\n\t\tcase \"borderColor\":\n\t\tcase \"borderStyle\":\n\t\tcase \"borderTopWidth\":\n\t\tcase \"borderBottomWidth\":\n\t\tcase \"borderLeftWidth\":\n\t\tcase \"borderRightWidth\":\n\t\t\treturn isLayoutTemplateNode(entryNode) || isWebPageNode(entryNode)\n\t\tcase \"opacity\":\n\t\tcase \"fillColor\":\n\t\tcase \"radius\":\n\t\tcase \"cornerShape\":\n\t\tcase \"rotation\":\n\t\tcase \"backdropFill\":\n\t\t\t// @TODO LAYOUT_TEMPLATE: Make a union for this type that doesn't\n\t\t\t// lose loaded status.\n\t\t\t//\n\t\t\t// These keys are inline styles in Smart Components, only use CSS\n\t\t\t// when they are from a web page.\n\t\t\treturn isLayoutTemplateNode(entryNode) || isWebPageNode(entryNode)\n\t\tcase \"blendingMode\":\n\t\tcase \"boxShadows\":\n\t\tcase \"cursor\":\n\t\tcase \"fillOpacity\":\n\t\tcase \"formTextAreaResizable\":\n\t\tcase \"gap\":\n\t\tcase \"gridItemColumnSpan\":\n\t\tcase \"gridItemRowSpan\":\n\t\tcase \"imageRendering\":\n\t\tcase \"overflow\":\n\t\tcase \"overflowX\":\n\t\tcase \"overflowY\":\n\t\tcase \"overscrollBehavior\":\n\t\tcase \"padding\":\n\t\tcase \"perspective\":\n\t\tcase \"pointerEvents\":\n\t\tcase \"stackAlignment\":\n\t\tcase \"stackDirection\":\n\t\tcase \"stackDistribution\":\n\t\tcase \"strokeColor\":\n\t\tcase \"strokeWidth\":\n\t\tcase \"tapHighlightColor\":\n\t\tcase \"userSelect\":\n\t\tcase \"zIndex\":\n\t\tcase \"textTruncation\":\n\t\t\treturn true\n\t\tdefault:\n\t\t\tassertNever(key)\n\t}\n}\n/**\n * Variable from the CMS don't include a unit. This allows them to be used\n * across many properties. For example a single variable can be used for opacity\n * and border-radius. Since CSS requires units, we can use calc expressions to\n * add units.\n */\nfunction addCSSUnitConversionIfNeeded(\n\tvariable: CSSVariableReference | SafeJS,\n\tproperty: KeysRequiringCSSVariableBinding,\n): CSSVariableReference | CSSCalcExpression | SafeJS {\n\tif (isSafeJS(variable)) return variable\n\n\tswitch (property) {\n\t\tcase \"perspective\":\n\t\t\treturn `calc(${variable} * 1px)`\n\t\tcase \"rotation\":\n\t\t\treturn `calc(${variable} * 1deg)`\n\t\tdefault:\n\t\t\treturn variable\n\t}\n}\n\nexport function variableToCSSVariableName(variable: SafeJS | string) {\n\treturn toCSSCustomPropertyName(hash(variable.toString()))\n}\n\nfunction variableNameToCSSVariableReference(\n\tvariableName: CSSVariableName,\n\tfallback?: SafeJS | string,\n): CSSVariableReference {\n\tif (fallback) return `var(${variableName}, ${fallback})`\n\treturn `var(${variableName})`\n}\n\nfunction variableReferenceProviderIdForDynamicValue(value: DynamicValue): NodeID | undefined {\n\tif (isVariableReference(value)) return value.providerId\n\tif (isVariableReference(value.startValue)) return variableReferenceProviderIdForDynamicValue(value.startValue)\n\treturn undefined\n}\n", "import hash from \"@emotion/hash\"\nimport { assert } from \"@framerjs/shared\"\nimport type { SerializableValue } from \"code-generation/js/SerializableValue.ts\"\nimport { js } from \"code-generation/js/js.ts\"\nimport { SafeJS, isSafeJS, serializeJS } from \"code-generation/js/serializeJS.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isArray, isObject, isString } from \"utils/typeChecks.ts\"\nimport type { BindingCollector } from \"./BindingCollector.ts\"\n\nfunction isTypeSafe(existing: unknown, candidate: unknown) {\n\tif (isSafeJS(existing)) return isString(candidate)\n\tif (isArray(existing)) return isArray(candidate) && candidate.length === existing.length\n\t// A candidate object can be a subset of the existing keys, but not a\n\t// superset.\n\tif (isObject(existing)) return isObject(candidate) && !Object.keys(candidate).some(key => !(key in existing))\n\treturn false\n}\n\ntype Bindings = SafeJS | SafeJS[] | Record<string, SafeJS>\ntype BindingsByHashedInitializer = Map<string, Bindings>\n\ntype DeclarationCollectorGroup = \"file\" | \"component\" | \"font\" | \"node\"\n\n/**\n * Collect declarations that are to be defined in the generated code, returning\n * a unique binding for callers.\n */\nabstract class DeclarationCollector<Group extends DeclarationCollectorGroup = DeclarationCollectorGroup> {\n\t/**\n\t * This property is intentionally unused, it simply allows strongly typing\n\t * where the declarations should be listed in the generated output. This\n\t * prevents accidentally collecting declarations to the wrong scope, which\n\t * in the case of React components, could result in errors if a hook is\n\t * evaluated outside of a component.\n\t */\n\t#group?: Group\n\n\t#extracted = false\n\t#declarations: SafeJS[] = []\n\t#bindingsByHashedInitializer: BindingsByHashedInitializer = new Map()\n\n\t#hoisted = false\n\t#hoistedDeclarations: DeclarationCollector[] = []\n\n\tget declarationsByteSize() {\n\t\tlet result = 0\n\n\t\tfor (const declaration of this.#declarations) {\n\t\t\tresult += declaration.length\n\t\t}\n\n\t\treturn result\n\t}\n\n\tconstructor(private readonly bindings: BindingCollector) {}\n\n\tprivate getBindings(hashedInitializer: string) {\n\t\treturn this.#bindingsByHashedInitializer.get(hashedInitializer)\n\t}\n\n\tprivate setBindings(hashedInitializer: string, bindings: Bindings) {\n\t\tthis.#bindingsByHashedInitializer.set(hashedInitializer, bindings)\n\t}\n\n\t/**\n\t * Create and initialize a const declaration, deduplicating it based on the\n\t * contents of the initializer, and returning the original declaration\n\t * binding.\n\t *\n\t * Destructured objects:\n\t * ```javascript\n\t * const { tap, delay } = declarations.dedupe(\n\t *      { tap: undefined, delay: \"aliasedDelay\" },\n\t *      js`() => { console.log(\"tap!\") }`\n\t * )\n\t * ```\n\t *\n\t * Destructured arrays:\n\t * ```javascript\n\t * const [tap, delay] = declarations.dedupe([\"tap\", \"delay\"], js`() => { console.log(\"tap!\") }`)\n\t * ```\n\t *\n\t * Constants:\n\t * ```javascript\n\t * const tap = declarations.dedupe(`tap`, js`() => { console.log(\"tap!\") }`)\n\t * ```\n\t */\n\tdedupe<T extends Record<string, string | undefined>>(name: T, initializer: SerializableValue): Record<keyof T, SafeJS>\n\tdedupe(name: string[], initializer: SerializableValue): SafeJS[]\n\tdedupe(name: string, initializer: SerializableValue): SafeJS\n\tdedupe(name: unknown, initializer: SerializableValue): SafeJS | SafeJS[] | Record<string, SafeJS> {\n\t\tconst hashedInitializer = hash(serializeJS(initializer))\n\t\tconst existingBindings = this.getBindings(hashedInitializer)\n\n\t\tif (existingBindings) {\n\t\t\t// In the case where we have already created a declaration with an\n\t\t\t// identical initializer value, we can reuse it. However, if the\n\t\t\t// name of the bindings changes type, e.g. from a single variable to\n\t\t\t// a destructured object, then that is invalid. Additionally, while\n\t\t\t// technically it could be valid for a second call to add keys to an\n\t\t\t// existing object, or entries to an existing array, for now we will\n\t\t\t// error to avoid that complexity.\n\t\t\tassert(\n\t\t\t\tisTypeSafe(existingBindings, name),\n\t\t\t\t\"DeclarationCollector: Names must be identical to previously recorded declarations of the same initializer.\",\n\t\t\t)\n\n\t\t\treturn existingBindings\n\t\t}\n\n\t\tconst { bindings, parameters } = this.bindingsFromName(name)\n\t\tconst declaration = js`const ${parameters} = ${initializer}`\n\t\tthis.create(declaration)\n\t\tthis.setBindings(hashedInitializer, bindings)\n\n\t\treturn bindings\n\t}\n\n\tcreate(declarationAndInitializer: SafeJS) {\n\t\tassert(!this.#extracted, \"DeclarationCollector: Cannot add declarations after extracting them.\")\n\t\tthis.#declarations.push(declarationAndInitializer)\n\t}\n\n\t/**\n\t * List all collected declarations. This finalizes the collector, preventing further collection.\n\t */\n\tlist(): SafeJS[] {\n\t\tassert(\n\t\t\t!this.#hoisted,\n\t\t\t\"DeclarationCollector: Cannot extract hoisted declarations. They can be extracted from the collector hoisted to.\",\n\t\t)\n\t\treturn this.#list()\n\t}\n\t#list(): SafeJS[] {\n\t\tif (!this.#extracted) {\n\t\t\tthis.#extracted = true\n\t\t\tthis.#declarations.push(...this.#hoistedDeclarations.flatMap(hoistedCollector => hoistedCollector.#list()))\n\t\t}\n\t\treturn this.#declarations\n\t}\n\n\t/**\n\t * Hoist all collected declarations to the collector of an ancestor scope. This finalizes the collector, preventing further collection.\n\t * Like when adding declarations, you must be sure the target collector has everything in scope to run the initializers.\n\t */\n\thoistTo(ancestor: DeclarationCollector): void {\n\t\tassert(!ancestor.#extracted, \"DeclarationCollector: Cannot add hoisted declarations after extracting them.\")\n\n\t\tassert(!this.#hoisted, \"DeclarationCollector: Already hoisted to another collector.\")\n\t\tthis.#hoisted = true\n\n\t\tancestor.#hoistedDeclarations.push(this)\n\t}\n\n\tprivate bindingsFromName(name: unknown) {\n\t\tif (isArray(name)) {\n\t\t\tconst bindings: SafeJS[] = []\n\t\t\tfor (const binding of name) {\n\t\t\t\tif (!isString(binding)) continue\n\t\t\t\tbindings.push(this.bindings.create(binding))\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tbindings,\n\t\t\t\tparameters: js`[${new SafeJS(bindings.map(serializeJS).join(\", \"))}]`,\n\t\t\t}\n\t\t}\n\n\t\tif (isObject(name)) {\n\t\t\tconst bindings: Record<string, SafeJS> = {}\n\t\t\t// Object keys are fixed, but the binding assigned to them can be\n\t\t\t// aliased if the key would clash with an existing binding.\n\t\t\tconst parameters: SafeJS[] = []\n\n\t\t\tfor (const key in name) {\n\t\t\t\tconst nameValue = name[key]\n\t\t\t\tconst binding = this.bindings.create(isString(nameValue) ? nameValue : key)\n\t\t\t\tparameters.push(serializeJS(binding) === key ? binding : js`${new SafeJS(key)}: ${binding}`)\n\t\t\t\tbindings[key] = binding\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tbindings,\n\t\t\t\tparameters: js`{ ${new SafeJS(parameters.map(serializeJS).join(\", \"))} }`,\n\t\t\t}\n\t\t}\n\n\t\tif (isString(name)) {\n\t\t\tconst binding = this.bindings.create(name)\n\t\t\treturn {\n\t\t\t\tbindings: binding,\n\t\t\t\tparameters: binding,\n\t\t\t}\n\t\t}\n\n\t\tthrow new Error(\"DeclarationCollector: declaration name is an invalid type (object/array/string).\")\n\t}\n}\n\nexport class FileDeclarationCollector extends DeclarationCollector<\"file\"> {}\nexport class ComponentDeclarationCollector extends DeclarationCollector<\"component\"> {}\nexport class FontDeclarationCollector extends DeclarationCollector<\"font\"> {}\nexport class NodeDeclarationCollector extends DeclarationCollector<\"node\"> {}\n\ntype DeclarationScopeName = \"repeater\" | \"repeater-item\"\n\n/**\n * Collect declarations that are to be defined in the generated code, returning\n * a unique binding for callers. Declarations are organized by whether they\n * belong to the file scope, or if they are required to be in the component\n * scope, e.g. if they are call hooks.\n */\nexport class JSXDeclarationCollector {\n\tfile: FileDeclarationCollector\n\tcomponent: ComponentDeclarationCollector\n\tfont: FontDeclarationCollector\n\n\tconstructor(private readonly bindings: BindingCollector) {\n\t\tthis.file = new FileDeclarationCollector(this.bindings)\n\t\tthis.component = new ComponentDeclarationCollector(this.bindings)\n\t\tthis.font = new FontDeclarationCollector(this.bindings)\n\t}\n\n\t#nodeCollectors = new Map<string, NodeDeclarationCollector>()\n\n\tforScope(nodeId: NodeID, scope: DeclarationScopeName): NodeDeclarationCollector {\n\t\tconst key = `${scope}-${nodeId}`\n\t\tconst existingCollector = this.#nodeCollectors.get(key)\n\t\tif (existingCollector) return existingCollector\n\n\t\tconst newCollector = new NodeDeclarationCollector(this.bindings)\n\t\tthis.#nodeCollectors.set(key, newCollector)\n\t\treturn newCollector\n\t}\n}\n", "import { Var } from \"code-generation/components/GeneratedVariantComponentVars.ts\"\nimport { js } from \"code-generation/js/js.ts\"\nimport type { CollectorEntryNode } from \"code-generation/types.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { defaultLocaleId } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport {\n\tisProvidingLocaleVariable,\n\tlayoutDirectionVariableId,\n\tleftToRightName,\n\tlocaleVariableId,\n\trightToLeftName,\n} from \"document/utils/LocaleVariable.ts\"\nimport type { MarkOptional } from \"utils/MarkOptional.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { SafeJS } from \"../js/serializeJS.ts\"\nimport type { BindingCollector } from \"./BindingCollector.ts\"\n\nfunction getVariableName(entryId: NodeID, providerId: NodeID, variableId: VariableID) {\n\tconst variableName = variableId.replaceAll(\".\", \"_\")\n\tif (entryId === providerId) return variableName\n\treturn variableName + providerId\n}\n\nexport type VariableBindings = Map<VariableID, SafeJS>\nexport type ReadonlyVariableBindings = ReadonlyMap<VariableID, SafeJS>\n\nconst emptyVariableBindings: ReadonlyVariableBindings = new Map()\n\nexport class VariableCollector {\n\tprivate readonly variableBindingsByProvider = new Map<NodeID, VariableBindings>()\n\tprivate readonly variableSetterBindings = new Map<VariableID, SafeJS>()\n\n\tconstructor(\n\t\t/**\n\t\t * Variable references originally didn't contain the provider id. In\n\t\t * cases where the provider id is missing the scope id should be used,\n\t\t * because those were the only providers at that time.\n\t\t */\n\t\tprivate readonly entryNode: CollectorEntryNode,\n\t\tprivate readonly bindings: BindingCollector,\n\t) {}\n\n\tget size() {\n\t\tlet result = 0\n\n\t\tfor (const [, variableBindings] of this.variableBindingsByProvider) {\n\t\t\tresult += variableBindings.size\n\t\t}\n\n\t\treturn result\n\t}\n\n\t*[Symbol.iterator]() {\n\t\tfor (const [providerId, variableBindings] of this.variableBindingsByProvider) {\n\t\t\tfor (const [variableId, variableBinding] of variableBindings) {\n\t\t\t\tconst variableReference: VariableReference = {\n\t\t\t\t\ttype: \"variableReference\",\n\t\t\t\t\tid: variableId,\n\t\t\t\t\tproviderId,\n\t\t\t\t}\n\n\t\t\t\tyield [variableReference, variableBinding] as const\n\t\t\t}\n\t\t}\n\t}\n\n\tcreate(variable: MarkOptional<VariableReference, \"type\">): SafeJS {\n\t\tswitch (variable.id) {\n\t\t\tcase localeVariableId:\n\t\t\t\treturn this.getLocaleId()\n\t\t\tcase layoutDirectionVariableId:\n\t\t\t\treturn this.getLayoutDirection()\n\t\t}\n\n\t\tconst providerId = variable.providerId ?? this.entryNode.id\n\n\t\tlet variableBindings = this.variableBindingsByProvider.get(providerId)\n\t\tif (isUndefined(variableBindings)) {\n\t\t\tvariableBindings = new Map()\n\t\t\tthis.variableBindingsByProvider.set(providerId, variableBindings)\n\t\t}\n\n\t\tlet variableBinding = variableBindings.get(variable.id)\n\t\tif (isUndefined(variableBinding)) {\n\t\t\tconst variableName = getVariableName(this.entryNode.id, providerId, variable.id)\n\t\t\tvariableBinding = this.bindings.create(variableName)\n\t\t\tvariableBindings.set(variable.id, variableBinding)\n\t\t}\n\n\t\treturn variableBinding\n\t}\n\n\tgetBindings(providerId: NodeID): ReadonlyVariableBindings {\n\t\treturn this.variableBindingsByProvider.get(providerId) ?? emptyVariableBindings\n\t}\n\n\tgetBinding(providerId: NodeID, variableId: VariableID): SafeJS | undefined {\n\t\treturn this.getBindings(providerId).get(variableId)\n\t}\n\n\tcreateSetter(variableId: VariableID): SafeJS {\n\t\tlet setterBinding = this.variableSetterBindings.get(variableId)\n\t\tif (isUndefined(setterBinding)) {\n\t\t\tsetterBinding = this.bindings.create(`set${variableId}`)\n\t\t\tthis.variableSetterBindings.set(variableId, setterBinding)\n\t\t}\n\n\t\treturn setterBinding\n\t}\n\n\tgetSetterBinding(variableId: VariableID): SafeJS | undefined {\n\t\treturn this.variableSetterBindings.get(variableId)\n\t}\n\n\t/**\n\t * When generating code, creates fallback variable declarations for all collected variables.\n\t * This will prevent runtime errors when a node references a variable that doesn't exist\n\t * anymore.\n\t */\n\tfallbackDeclarations() {\n\t\tconst declarations: SafeJS[] = []\n\n\t\tfor (const [_, binding] of this) {\n\t\t\tdeclarations.push(js`const ${binding} = undefined`)\n\t\t}\n\n\t\tfor (const [_, binding] of this.variableSetterBindings) {\n\t\t\tdeclarations.push(js`const ${binding} = undefined`)\n\t\t}\n\n\t\treturn declarations\n\t}\n\n\t// MARK: Locale\n\n\tgetLocale(): SafeJS {\n\t\tif (!isProvidingLocaleVariable(this.entryNode)) return js`undefined`\n\t\treturn Var.activeLocale\n\t}\n\n\tgetLocaleId(): SafeJS {\n\t\tconst locale = this.getLocale()\n\t\tif (SafeJS.isUndefined(locale)) return js`${defaultLocaleId}`\n\t\treturn js`${locale}?.id`\n\t}\n\n\tgetLocaleName(): SafeJS {\n\t\tconst locale = this.getLocale()\n\t\tif (SafeJS.isUndefined(locale)) return js`undefined`\n\t\treturn js`${locale}?.name`\n\t}\n\n\t// MARK: Layout Direction\n\n\tprivate _shouldProvideLayoutDirection = false\n\n\tget shouldProvideLayoutDirection() {\n\t\treturn this._shouldProvideLayoutDirection\n\t}\n\n\tgetLayoutDirection(): SafeJS {\n\t\tif (!isProvidingLocaleVariable(this.entryNode)) return js`undefined`\n\t\tthis._shouldProvideLayoutDirection = true\n\t\treturn Var.layoutDirection\n\t}\n\n\tgetLayoutDirectionName(): SafeJS {\n\t\tconst layoutDirection = this.getLayoutDirection()\n\t\treturn js`(${layoutDirection} === \"ltr\" ? ${leftToRightName} : (${layoutDirection} === \"rtl\" ? ${rightToLeftName} : undefined))`\n\t}\n}\n", "import { roundedNumber } from \"library/render/utils/roundedNumber.ts\"\nimport { isNumber, isString } from \"utils/typeChecks.ts\"\n\nexport function isRelativeCSSValue(value: any) {\n\tif (!isString(value)) return false\n\tif (/calc/u.test(value)) return false\n\n\t// check if the value ends with \"%\"\n\treturn /%$/u.test(value)\n}\n\nexport function sizeValueToCSSValue(value: number | string): string\nexport function sizeValueToCSSValue(value: null | number | string | undefined): string | null\nexport function sizeValueToCSSValue(value: null | number | string | undefined): string | null {\n\tif (value === null || value === undefined) return null\n\tif (isNumber(value)) return roundedNumber(value, 0) + \"px\"\n\tif (isRelativeCSSValue(value)) {\n\t\tconst num = parseFloat(value.replace(/%/u, \"\"))\n\t\treturn roundedNumber(num, 0) + \"%\"\n\t}\n\treturn value\n}\n", "import type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\n\nexport enum CodeType {\n\tCSS = \"css\",\n\tSVG = \"svg\",\n\tCode = \"code\",\n}\n\nexport enum CSSExportType {\n\tCSS = \"CSS\",\n\tJSX = \"JSX\",\n}\n\nexport enum SVGExportType {\n\tSVG = \"SVG\",\n\tJSX = \"JSX\",\n}\n\nexport enum TransitionExportType {\n\tMotion = \"Framer Motion\",\n\tSwift = \"Swift\",\n}\n\nexport function isCSSExportType(value: unknown): value is CSSExportType {\n\treturn isString(value) && value in CSSExportType\n}\nexport function isSVGExportType(value: unknown): value is SVGExportType {\n\treturn isString(value) && value in SVGExportType\n}\n\nexport enum Syntax {\n\tString = \"code-string\",\n\tNumber = \"code-number\",\n\tTag = \"code-tag\",\n\tPunctuation = \"code-punctuation\",\n\tClass = \"code-class\",\n\tKeyword = \"code-keyword\",\n\tStorage = \"code-storage\",\n\tIdentifier = \"code-identifier\",\n\tSelector = \"code-selector\",\n\tComment = \"code-comment\",\n}\n\n/**\n * Code Component Handoff\n */\ninterface BaseDisplayProperty {\n\tcontrolType: ControlType\n}\n\ninterface NumberDisplayProperty extends BaseDisplayProperty {\n\tcontrolType: ControlType.Number | ControlType.FusedNumber\n\tvalue: number | undefined\n}\n\ninterface BooleanDisplayProperty extends BaseDisplayProperty {\n\tcontrolType: ControlType.Boolean\n\tvalue: boolean | undefined\n}\n\ninterface ComponentInstanceDisplayProperty extends BaseDisplayProperty {\n\tcontrolType: ControlType.ComponentInstance\n\tid: NodeID | undefined\n\tname: string | undefined\n}\n\ninterface StringDisplayProperty extends BaseDisplayProperty {\n\tcontrolType:\n\t\t| ControlType.String\n\t\t| ControlType.RichText\n\t\t| ControlType.Color\n\t\t| ControlType.Enum\n\t\t| ControlType.SegmentedEnum\n\tvalue: string | undefined\n}\n\ninterface FileDisplayProperty extends BaseDisplayProperty {\n\tcontrolType: ControlType.Image | ControlType.ResponsiveImage | ControlType.File\n\toriginalFilename: string | undefined\n\tvalue: string | undefined\n}\n\nexport interface EventHandler {\n\tpackageIdentifier: string\n\tfile: string\n\tvalue: string\n}\n\ninterface EventHandlerDisplayProperty extends BaseDisplayProperty {\n\tcontrolType: ControlType.EventHandler\n\thandlers: EventHandler[] | undefined\n}\n\ninterface ArrayDisplayProperty extends BaseDisplayProperty {\n\tcontrolType: ControlType.Array\n\titems: ArrayItemDisplayProperty[] | undefined\n}\n\ninterface ObjectDisplayProperty extends BaseDisplayProperty {\n\tcontrolType: ControlType.Object\n\tproperties: Record<string, ObjectPropertyDisplayProperty>\n}\n\nexport type ArrayItemDisplayProperty =\n\t| NumberDisplayProperty\n\t| BooleanDisplayProperty\n\t| StringDisplayProperty\n\t| FileDisplayProperty\n\t| ComponentInstanceDisplayProperty\n\t| ObjectDisplayProperty\n\nexport type ObjectPropertyDisplayProperty =\n\t| NumberDisplayProperty\n\t| BooleanDisplayProperty\n\t| StringDisplayProperty\n\t| FileDisplayProperty\n\nexport type DisplayProperty =\n\t| NumberDisplayProperty\n\t| BooleanDisplayProperty\n\t| StringDisplayProperty\n\t| FileDisplayProperty\n\t| ComponentInstanceDisplayProperty\n\t| EventHandlerDisplayProperty\n\t| ArrayDisplayProperty\n\t| ObjectDisplayProperty\n", "import type { SerializableMotionStyle } from \"code-generation/types.ts\"\nimport { CSSExportType } from \"document/components/chrome/properties/panels/types.ts\"\nimport type { MotionStyle } from \"framer-motion\"\nimport { ConvertColor } from \"library/render/types/Color/index.ts\"\nimport type { ReactText } from \"react\"\nimport { camelCaseToCSS } from \"utils/names.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { isRelativeCSSValue, sizeValueToCSSValue } from \"./cssValues.ts\"\n\nconst ignoredKeys = [\"tabSize\"]\n\n/**\n * @FIXME - Check what properties we weren't including here because we didn't\n * need them, e.g. opacity, font variable values.\n */\nconst NON_PIXEL_NUMBER_PROPERTIES = new Set([\n\t\"--framer-code-font-weight\",\n\t\"--framer-blockquote-font-weight-bold-italic\",\n\t\"--framer-blockquote-font-weight-bold\",\n\t\"--framer-blockquote-font-weight-italic\",\n\t\"--framer-blockquote-font-weight\",\n\t\"--framer-font-size-scale\",\n\t\"--framer-font-weight-bold-italic\",\n\t\"--framer-font-weight-bold\",\n\t\"--framer-font-weight-italic\",\n\t\"--framer-font-weight\",\n\t\"--framer-input-font-weight\",\n\t\"aspect-ratio\",\n\t\"flex-grow\",\n\t\"flex-shrink\",\n\t\"opacity\",\n\t\"order\",\n\t\"transform-origin\",\n\t\"z-index\",\n])\n\ninterface CSSDeclaration {\n\ttype: \"string\" | \"number\" | \"bigint\" | \"boolean\" | \"symbol\" | \"undefined\" | \"object\" | \"function\"\n\tprop: string\n\tvalue: ReactText\n\tcomment?: ReactText\n}\n\nexport type CSSDeclarationBlock = CSSDeclaration[]\n\nexport type CSSComments = Partial<Record<keyof React.CSSProperties, ReactText>>\n\n// maskImage can include colors in encoded SVGs. Those can't use the # symbol, so we can't replace\n// RGB values with hex.\nconst NON_HEX_COLOR_PROPERTIES = new Set([\"maskImage\", \"mask\"])\n\nfunction convertColorInCSSValue(value: string | number, propName: string) {\n\tif (NON_HEX_COLOR_PROPERTIES.has(propName)) return value\n\tif (typeof value === \"string\") {\n\t\t// Simplify color strings (also within values like shadows)\n\t\treturn value.replace(/\\b(?:rgb|hsv|hsl)a?\\([^)]+\\)/u, match => {\n\t\t\tconst simpleColor = ConvertColor.toHexOrRgbaString(match)\n\t\t\tif (simpleColor) {\n\t\t\t\treturn simpleColor\n\t\t\t} else {\n\t\t\t\treturn match\n\t\t\t}\n\t\t})\n\t}\n\treturn value\n}\n\nfunction processReactCSSValue(value: ReactText, type: CSSExportType, valueType: CSSDeclaration[\"type\"]) {\n\tif (type !== CSSExportType.JSX) return value\n\tif (typeof value !== \"string\") return value\n\n\tif (valueType === \"number\" && isPixelValue(value) && !hasSpaces(value)) {\n\t\treturn value.replace(/px/gu, \"\")\n\t}\n\n\tif (value.includes('\"')) {\n\t\treturn `\\`${value}\\``\n\t}\n\treturn `\"${value}\"`\n}\n\nfunction getCSSValueType(value: unknown, cssType: CSSExportType) {\n\tconst cssValueType = typeof value\n\tconst isNumericCSSValue = isString(value) && (isPixelValue(value) || isRelativeCSSValue(value))\n\tif (!isNumericCSSValue) return cssValueType\n\n\tif (cssType === CSSExportType.CSS) return \"number\"\n\tif (cssType === CSSExportType.JSX && !hasSpaces(value) && !isRelativeCSSValue(value)) return \"number\"\n\n\treturn cssValueType\n}\n\nexport function getCSSDeclarationBlock(\n\tcss: React.CSSProperties | MotionStyle | SerializableMotionStyle,\n\tcssType: CSSExportType = CSSExportType.CSS,\n\tcomments?: CSSComments,\n): CSSDeclarationBlock {\n\tconst result: CSSDeclarationBlock = []\n\tfor (const property of Object.keys(css)) {\n\t\tconst value = css[property]\n\t\tif (!isUndefined(value) && !ignoredKeys.includes(property)) {\n\t\t\tconst cssPropName = cssType === CSSExportType.CSS ? camelCaseToCSS(property) : property\n\t\t\tconst cssValueType = getCSSValueType(value, cssType)\n\t\t\tconst cssValue = processReactCSSValue(convertColorInCSSValue(value, property), cssType, cssValueType)\n\t\t\tconst comment = comments?.[property]\n\n\t\t\tresult.push({\n\t\t\t\ttype: cssValueType,\n\t\t\t\tprop: cssPropName,\n\t\t\t\tvalue: cssValue,\n\t\t\t\tcomment,\n\t\t\t})\n\t\t}\n\t}\n\n\treturn result\n}\n\nexport function isNonPixelNumberProperty(property: string) {\n\tif (NON_PIXEL_NUMBER_PROPERTIES.has(property)) return true\n\treturn property.startsWith(\"--\")\n}\n\nexport function createCSSDeclarationBlock(style: MotionStyle | SerializableMotionStyle) {\n\treturn getCSSDeclarationBlock(style)\n\t\t.sort(sortDeclarationsAlphabetically)\n\t\t.map(rule => `${rule.prop}: ${isNonPixelNumberProperty(rule.prop) ? rule.value : sizeValueToCSSValue(rule.value)};`)\n\t\t.join(\" \")\n}\n\nconst endsWithPxRegex = /px$/u\n\nfunction isPixelValue(value: unknown) {\n\tif (!isString(value)) return false\n\t// check if the value ends with \"px\"\n\treturn endsWithPxRegex.test(value)\n}\n\nfunction hasSpaces(text: string) {\n\treturn text.includes(\" \")\n}\n\n// Creating a compare function ahead of time is a performance recommendation\n// when sorting lists:\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare#performance\nconst compare = new Intl.Collator(\"en\", { sensitivity: \"base\" }).compare\n\n// Lifted from\n// https://github.com/hudochenkov/postcss-sorting/blob/master/lib/properties-order/sortDeclarationsAlphabetically.js.\n// Since our api supports converting style objects to css declarations, we can\n// drop the need to check vendor prefixes since they will safely be sorted to\n// the top based on alphabetical sorting and don't really need to be grouped.\nexport function sortDeclarationsAlphabetically(a: CSSDeclaration, b: CSSDeclaration) {\n\tif (isShorthand(a.prop, b.prop)) {\n\t\treturn -1\n\t}\n\n\tif (isShorthand(b.prop, a.prop)) {\n\t\treturn 1\n\t}\n\n\treturn compare(a.prop, b.prop)\n}\n\nfunction isShorthand(a: CSSDeclaration[\"prop\"], b: CSSDeclaration[\"prop\"]) {\n\tconst longHandCSSProperties = shortHandCSSProperties[a]\n\tif (!longHandCSSProperties) return false\n\n\treturn longHandCSSProperties.has(b)\n}\n\n// See https://github.com/stylelint/stylelint/blob/10.1.0/lib/reference/shorthandData.js\nconst shortHandCSSProperties = {\n\tmargin: new Set([\"margin-top\", \"margin-bottom\", \"margin-left\", \"margin-right\"]),\n\tpadding: new Set([\"padding-top\", \"padding-bottom\", \"padding-left\", \"padding-right\"]),\n\tbackground: new Set([\n\t\t\"background-image\",\n\t\t\"background-size\",\n\t\t\"background-position\",\n\t\t\"background-repeat\",\n\t\t\"background-origin\",\n\t\t\"background-clip\",\n\t\t\"background-attachment\",\n\t\t\"background-color\",\n\t]),\n\tfont: new Set([\n\t\t\"font-style\",\n\t\t\"font-variant\",\n\t\t\"font-weight\",\n\t\t\"font-stretch\",\n\t\t\"font-size\",\n\t\t\"font-family\",\n\t\t\"line-height\",\n\t]),\n\tborder: new Set([\n\t\t\"border-top-width\",\n\t\t\"border-bottom-width\",\n\t\t\"border-left-width\",\n\t\t\"border-right-width\",\n\t\t\"border-top-style\",\n\t\t\"border-bottom-style\",\n\t\t\"border-left-style\",\n\t\t\"border-right-style\",\n\t\t\"border-top-color\",\n\t\t\"border-bottom-color\",\n\t\t\"border-left-color\",\n\t\t\"border-right-color\",\n\t]),\n\t\"border-top\": new Set([\"border-top-width\", \"border-top-style\", \"border-top-color\"]),\n\t\"border-bottom\": new Set([\"border-bottom-width\", \"border-bottom-style\", \"border-bottom-color\"]),\n\t\"border-left\": new Set([\"border-left-width\", \"border-left-style\", \"border-left-color\"]),\n\t\"border-right\": new Set([\"border-right-width\", \"border-right-style\", \"border-right-color\"]),\n\t\"border-width\": new Set([\"border-top-width\", \"border-bottom-width\", \"border-left-width\", \"border-right-width\"]),\n\t\"border-style\": new Set([\"border-top-style\", \"border-bottom-style\", \"border-left-style\", \"border-right-style\"]),\n\t\"border-color\": new Set([\"border-top-color\", \"border-bottom-color\", \"border-left-color\", \"border-right-color\"]),\n\t\"list-style\": new Set([\"list-style-type\", \"list-style-position\", \"list-style-image\"]),\n\t\"border-radius\": new Set([\n\t\t\"border-top-right-radius\",\n\t\t\"border-top-left-radius\",\n\t\t\"border-bottom-right-radius\",\n\t\t\"border-bottom-left-radius\",\n\t]),\n\ttransition: new Set([\"transition-delay\", \"transition-duration\", \"transition-property\", \"transition-timing-function\"]),\n\tanimation: new Set([\n\t\t\"animation-name\",\n\t\t\"animation-duration\",\n\t\t\"animation-timing-function\",\n\t\t\"animation-delay\",\n\t\t\"animation-iteration-count\",\n\t\t\"animation-direction\",\n\t\t\"animation-fill-mode\",\n\t\t\"animation-play-state\",\n\t]),\n\t\"border-block-end\": new Set([\"border-block-end-width\", \"border-block-end-style\", \"border-block-end-color\"]),\n\t\"border-block-start\": new Set([\"border-block-start-width\", \"border-block-start-style\", \"border-block-start-color\"]),\n\t\"border-image\": new Set([\n\t\t\"border-image-source\",\n\t\t\"border-image-slice\",\n\t\t\"border-image-width\",\n\t\t\"border-image-outset\",\n\t\t\"border-image-repeat\",\n\t]),\n\t\"border-inline-end\": new Set([\"border-inline-end-width\", \"border-inline-end-style\", \"border-inline-end-color\"]),\n\t\"border-inline-start\": new Set([\n\t\t\"border-inline-start-width\",\n\t\t\"border-inline-start-style\",\n\t\t\"border-inline-start-color\",\n\t]),\n\t\"column-rule\": new Set([\"column-rule-width\", \"column-rule-style\", \"column-rule-color\"]),\n\tcolumns: new Set([\"column-width\", \"column-count\"]),\n\tflex: new Set([\"flex-grow\", \"flex-shrink\", \"flex-basis\"]),\n\t\"flex-flow\": new Set([\"flex-direction\", \"flex-wrap\"]),\n\tgrid: new Set([\n\t\t\"grid-template-rows\",\n\t\t\"grid-template-columns\",\n\t\t\"grid-template-areas\",\n\t\t\"grid-auto-rows\",\n\t\t\"grid-auto-columns\",\n\t\t\"grid-auto-flow\",\n\t\t\"grid-column-gap\",\n\t\t\"grid-row-gap\",\n\t]),\n\t\"grid-area\": new Set([\"grid-row-start\", \"grid-column-start\", \"grid-row-end\", \"grid-column-end\"]),\n\t\"grid-column\": new Set([\"grid-column-start\", \"grid-column-end\"]),\n\t\"grid-gap\": new Set([\"grid-row-gap\", \"grid-column-gap\"]),\n\t\"grid-row\": new Set([\"grid-row-start\", \"grid-row-end\"]),\n\t\"grid-template\": new Set([\"grid-template-columns\", \"grid-template-rows\", \"grid-template-areas\"]),\n\toutline: new Set([\"outline-color\", \"outline-style\", \"outline-width\"]),\n\t\"text-decoration\": new Set([\"text-decoration-color\", \"text-decoration-style\", \"text-decoration-line\"]),\n\t\"text-emphasis\": new Set([\"text-emphasis-style\", \"text-emphasis-color\"]),\n\tmask: new Set([\n\t\t\"mask-image\",\n\t\t\"mask-mode\",\n\t\t\"mask-position\",\n\t\t\"mask-size\",\n\t\t\"mask-repeat\",\n\t\t\"mask-origin\",\n\t\t\"mask-clip\",\n\t\t\"mask-composite\",\n\t]),\n}\n", "import { ModuleType, assertNever } from \"@framerjs/shared\"\nimport { jst, jsx, svg as svgSerializer } from \"code-generation/js/js.ts\"\nimport { type SafeJS, SerializableObject } from \"code-generation/js/serializeJS.ts\"\nimport type { SVG } from \"code-generation/js/svg.ts\"\nimport type { SerializableMotionStyle } from \"code-generation/types.ts\"\nimport { BindingCollector } from \"code-generation/utils/BindingCollector.ts\"\nimport { ColorCollector, SVGVariableDefinitionCollector } from \"code-generation/utils/CSSVariableDefinitionCollector.ts\"\nimport { JSXDeclarationCollector } from \"code-generation/utils/DeclarationCollector.ts\"\nimport { ImportCollector } from \"code-generation/utils/ImportCollector.ts\"\nimport { VariableCollector } from \"code-generation/utils/VariableCollector.ts\"\nimport type { CanvasTree, NodeID, ShapeContainerNode } from \"document/models/CanvasTree/index.ts\"\nimport type { VectorSetNode } from \"document/models/CanvasTree/nodes/VectorSetNode.ts\"\nimport type { Loaded } from \"document/models/CanvasTree/traits/WithScopeLoader.ts\"\nimport type { IsVectorSetItem } from \"document/models/CanvasTree/traits/WithVectorSetItem.ts\"\nimport { sizeValueToCSSValue } from \"document/models/CanvasTree/traits/utils/cssValues.ts\"\nimport {\n\tgetCSSDeclarationBlock,\n\tisNonPixelNumberProperty,\n\tsortDeclarationsAlphabetically,\n} from \"document/models/CanvasTree/traits/utils/getCSSDeclarationBlock.ts\"\nimport type { JSXEngineDependencies } from \"../types.ts\"\n\nexport type SerializationTarget = \"svg\" | \"jsx\"\n\n/**\n * An Vector is always serialized as an svg file to create a thumbnail that we can render in the\n * editor without a sandbox. However, it can also be serialized as JSX. The difference is purely in\n * the formatting. Injecting the appropriate serializer allows us to reuse the general serialization\n * but swap out the formatting.\n */\nexport type XMLSerializer = typeof jsx | typeof svgSerializer\n\nexport function serializerForTarget(target: SerializationTarget): XMLSerializer {\n\tswitch (target) {\n\t\tcase \"svg\":\n\t\t\treturn svgSerializer\n\t\tcase \"jsx\":\n\t\t\treturn jsx\n\t\tdefault:\n\t\t\tassertNever(target)\n\t}\n}\n\nexport function svg<T extends SVG.Tag>(\n\txml: XMLSerializer,\n\tname: T,\n\tattributes?: Partial<SVG.Attributes<T>>,\n\tchildren?: SafeJS,\n): SafeJS {\n\treturn xml.tag(name, new SerializableObject({ ...attributes }), children)\n}\n\nexport const ANIMATED_PROP_NAME = \"animated\"\n\n/**\n * A Vector is serialized to use the most optimized rendering based on its contents.\n */\nexport enum RenderElement {\n\t// When the Vector has no Variables, and no Color Styles (which require css custom property\n\t// references), we can render with an img using an encoded src.\n\tImg,\n\t// When the Vector has only a single color (a Variable or a Color Style), we can render with a\n\t// div that uses a mask image. The single color becomes the background-color. This should handle\n\t// the majority of Icons that have a color control.\n\tMask,\n\t// When the Vector doesn't have animations, but it has multiple controls or multiple colors we\n\t// have to render with an inline SVG. However, we can reduce the impact on the document size by\n\t// using a template referenced by a use tag, using the SharedSVGManager.\n\tTemplate,\n\t// When the Vector has animations we have to render with an inline SVG.\n\tSvg,\n}\n\nexport interface SVGContext {\n\trevision: number\n\tbindings: BindingCollector\n\tcolors: ColorCollector\n\tcss: CSSCollector\n\tcssVariableDefinitions: SVGVariableDefinitionCollector\n\tdeclarations: JSXDeclarationCollector\n\tdefs: SafeJS[]\n\teffectNodes: Set<NodeID>\n\timports: ImportCollector\n\ttarget: SerializationTarget\n\ttree: CanvasTree\n\ttype?: RenderElement\n\tvariables: VariableCollector\n}\n\nclass CSSCollector {\n\trules: (string | SafeJS)[] = []\n\taddRule(style: SerializableMotionStyle, className: string) {\n\t\tconst rule = jst`.${className} { ${jst.join(\n\t\t\tgetCSSDeclarationBlock(style)\n\t\t\t\t.sort(sortDeclarationsAlphabetically)\n\t\t\t\t.map(declaration => {\n\t\t\t\t\tconst value = isNonPixelNumberProperty(declaration.prop)\n\t\t\t\t\t\t? declaration.value\n\t\t\t\t\t\t: sizeValueToCSSValue(declaration.value)\n\n\t\t\t\t\treturn jst`${declaration.prop}: ${value};`\n\t\t\t\t}),\n\t\t\t\" \",\n\t\t)} }`\n\n\t\tthis.rules.push(rule)\n\t\treturn className\n\t}\n}\n\nexport function createSVGTagContext(\n\tentryNode: Loaded<VectorSetNode>,\n\tsourceNode: ShapeContainerNode & IsVectorSetItem,\n\tdeps: JSXEngineDependencies,\n\ttarget: SerializationTarget,\n\treserved: string[],\n): SVGContext {\n\tconst defs: SafeJS[] = []\n\tconst bindings = new BindingCollector(...reserved, ANIMATED_PROP_NAME)\n\tconst variables = new VariableCollector(entryNode, bindings)\n\tconst colors = new ColorCollector()\n\tconst cssVariableDefinitions = new SVGVariableDefinitionCollector(entryNode, variables, colors)\n\tconst imports = new ImportCollector(ModuleType.Vector, deps.componentLoader, deps.modulesStore, bindings)\n\tconst declarations = new JSXDeclarationCollector(bindings)\n\tconst effectNodes = new Set<NodeID>()\n\tconst css = new CSSCollector()\n\n\treturn {\n\t\trevision: sourceNode.moduleSourceRevision ?? -1,\n\t\tbindings,\n\t\tcolors,\n\t\tcss,\n\t\tcssVariableDefinitions,\n\t\tdeclarations,\n\t\tdefs,\n\t\teffectNodes,\n\t\timports,\n\t\ttarget,\n\t\ttree: deps.tree,\n\t\tvariables,\n\t}\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport { js } from \"code-generation/js/js.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { withFill, withFillOpacity, withOptionalFill } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport { type IsVectorSetItem, isVectorSetItem } from \"document/models/CanvasTree/traits/WithVectorSetItem.ts\"\nimport type { LinearGradient } from \"document/models/LinearGradientClass.ts\"\nimport type { RadialGradient } from \"document/models/RadialGradientClass.ts\"\nimport { Line, type WithShape, interpolate } from \"library/index.ts\"\nimport { getRadialGradientTransform } from \"library/render/presentation/GradientElement.tsx\"\nimport { linearGradientLine } from \"library/render/utils/elementPropertiesForGradient.ts\"\nimport { type SVGContext, serializerForTarget, svg } from \"./svgContext.ts\"\n\nfunction linearGradient(node: CanvasNode, gradient: LinearGradient, ctx: SVGContext) {\n\tconst xml = serializerForTarget(ctx.target)\n\tconst line = linearGradientLine(gradient.angle)\n\n\tconst startPosition = gradient.stops[0]?.position ?? 0\n\tconst endPosition = gradient.stops[gradient.stops.length - 1]?.position ?? 1\n\n\tconst startPoint = Line.pointAtPercentDistance(line, startPosition)\n\tconst endPoint = Line.pointAtPercentDistance(line, endPosition)\n\n\t// Since the gradient will be positioned by the coordinates of the start and\n\t// end point, we normalize the other points into that range.\n\tconst interpolator = interpolate([startPosition, endPosition], [0, 1])\n\n\tconst id = `${node.id}-${ctx.revision}-linear-gradient`\n\tconst def = svg(\n\t\txml,\n\t\t\"linearGradient\",\n\t\t{\n\t\t\tid,\n\t\t\tx1: startPoint.x,\n\t\t\ty1: startPoint.y,\n\t\t\tx2: endPoint.x,\n\t\t\ty2: endPoint.y,\n\t\t},\n\t\txml`${js.joinLines(\n\t\t\t...gradient.stops.map(stop =>\n\t\t\t\tsvg(xml, \"stop\", { offset: interpolator(stop.position), stopColor: ctx.colors.addColor(stop.value) }),\n\t\t\t),\n\t\t)}`,\n\t)\n\n\tctx.defs.push(def)\n\n\treturn `url(#${id})`\n}\n\nfunction radialGradient(node: CanvasNode, gradient: RadialGradient, ctx: SVGContext) {\n\tconst xml = serializerForTarget(ctx.target)\n\tconst id = `${node.id}-${ctx.revision}-radial-gradient`\n\n\tconst centerAnchorX = gradient.centerAnchorX\n\tconst centerAnchorY = gradient.centerAnchorY\n\tconst widthFactor = gradient.widthFactor\n\tconst heightFactor = gradient.heightFactor\n\n\tconst def = svg(\n\t\txml,\n\t\t\"radialGradient\",\n\t\t{\n\t\t\tid,\n\t\t\tcy: centerAnchorY,\n\t\t\tcx: centerAnchorX,\n\t\t\tr: widthFactor,\n\t\t\tgradientTransform: getRadialGradientTransform(heightFactor, widthFactor, centerAnchorX, centerAnchorY),\n\t\t},\n\t\txml`${js.joinLines(\n\t\t\t...gradient.stops.map(stop =>\n\t\t\t\tsvg(xml, \"stop\", { offset: stop.position, stopColor: ctx.colors.addColor(stop.value) }),\n\t\t\t),\n\t\t)}`,\n\t)\n\n\tctx.defs.push(def)\n\n\treturn `url(#${id})`\n}\n\nexport function collectFill(\n\tnode: (CanvasNode & IsVectorSetItem) | (CanvasNode & WithShape),\n\tprops: Record<string, unknown>,\n\tctx: SVGContext,\n) {\n\t// Fills on vector set items (svg) are canvas-only for designing.\n\tif (isVectorSetItem(node)) return\n\n\t// Fill value for shapes are by default \"black\"\n\tprops.fill = \"transparent\"\n\n\tif (!withFill(node) || (withOptionalFill(node) && !node.fillEnabled) || !node.fillType) return\n\n\tif (withFillOpacity(node)) {\n\t\tprops.fillOpacity = isVariableReference(node.fillOpacity)\n\t\t\t? ctx.cssVariableDefinitions.create(node, \"fillOpacity\")\n\t\t\t: node.fillOpacity\n\t}\n\n\tif (isVariableReference(node.fillColor)) {\n\t\tprops.fill = ctx.cssVariableDefinitions.create(node, \"fillColor\")\n\t\treturn\n\t}\n\n\tswitch (node.fillType) {\n\t\tcase \"color\": {\n\t\t\tconst color = node.fillColor\n\t\t\tif (!color || isDynamicValue(color)) return\n\t\t\tprops.fill = ctx.colors.addColor(color)\n\t\t\tbreak\n\t\t}\n\t\tcase \"linear-gradient\":\n\t\t\tif (!node.fillLinearGradient) return\n\t\t\tprops.fill = linearGradient(node, node.fillLinearGradient, ctx)\n\t\t\tbreak\n\t\tcase \"radial-gradient\":\n\t\t\tif (!node.fillRadialGradient) return\n\t\t\tprops.fill = radialGradient(node, node.fillRadialGradient, ctx)\n\t\t\tbreak\n\t\tcase \"conic-gradient\":\n\t\tcase \"image\":\n\t\t\t// Unsupported fill types.\n\t\t\treturn\n\t\tdefault:\n\t\t\tassertNever(node.fillType)\n\t}\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { LineCap, LineJoin } from \"library/render/types/Stroke.ts\"\nimport type { StrokeAlignment } from \"library/render/types/StrokeAlignment.ts\"\nimport { type DynamicValue, isDynamicValue } from \"./DynamicValue.ts\"\nimport type { VariableReference } from \"./VariableReference.ts\"\n\nexport interface StrokeWidth {\n\tstrokeWidth: number | VariableReference | undefined\n}\n\nexport interface StrokeDash {\n\tstrokeDashArray: string | undefined\n\tstrokeDashOffset: number | undefined\n}\n\nexport interface WithStroke extends StrokeWidth, StrokeDash {\n\tstrokeEnabled: boolean | undefined\n\tstrokeAlignment: StrokeAlignment | undefined\n\tstrokeColor: string | DynamicValue | undefined\n\tlineJoin: LineJoin | undefined\n\tlineCap: LineCap | undefined\n\tstrokeMiterLimit: number | undefined\n}\n\nexport const strokeDefaults: WithStroke = {\n\tstrokeEnabled: true,\n\tstrokeAlignment: \"center\",\n\tstrokeWidth: 1,\n\tstrokeColor: \"#AAA\",\n\tlineJoin: \"miter\",\n\tlineCap: \"butt\",\n\tstrokeMiterLimit: 4,\n\tstrokeDashArray: \"0\",\n\tstrokeDashOffset: 0,\n}\n\nexport const shapeStrokeDefaults: WithStroke = {\n\tstrokeEnabled: undefined,\n\tstrokeAlignment: undefined,\n\tstrokeWidth: undefined,\n\tstrokeColor: undefined,\n\tlineJoin: undefined,\n\tlineCap: undefined,\n\tstrokeMiterLimit: undefined,\n\tstrokeDashArray: undefined,\n\tstrokeDashOffset: undefined,\n}\n\nconst key: keyof WithStroke = \"strokeEnabled\"\n\nexport const withStroke = (node: CanvasNode): node is CanvasNode & WithStroke => {\n\treturn key in node\n}\n\nexport function hasDynamicStrokeWidth(node: CanvasNode): boolean {\n\treturn Boolean(withStroke(node) && node.strokeEnabled && isDynamicValue(node.strokeWidth))\n}\n", "import { assert, List, Mixed } from \"@framerjs/shared\"\nimport Bezier from \"bezier-js\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { reverseSegment } from \"document/models/CanvasTree/utils/reverseSegment.ts\"\nimport type { WithPath, WithPaths } from \"library/render/traits/Path.ts\"\nimport { isStraightCurve } from \"library/render/traits/Path.ts\"\nimport { PathSegment } from \"library/render/types/PathSegment.ts\"\nimport { Point } from \"library/render/types/Point.ts\"\nimport type { Rect } from \"library/render/types/Rect.ts\"\nimport { commonPropertyValue } from \"utils/commonValue.ts\"\nimport type { CanvasNodeCache } from \"./CanvasTree/nodes/CanvasNodeCache.ts\"\nimport type { Reduced } from \"./CanvasTree/traits/utils/Reduced.ts\"\nimport { isNotFound } from \"./CanvasTree/traits/utils/Reduced.ts\"\n\n// Returns an integer if the passed in number is an integer or very very close to it.\nexport function snapInt(n: number) {\n\tif (Number.isInteger(n)) return n\n\tconst rounded = Math.round(n)\n\treturn Math.abs(rounded - n) < 0.000_000_1 ? rounded : n\n}\n\nexport namespace Path {\n\texport function toBezierJS(withPaths: WithPaths | WithPath, node?: CanvasNode) {\n\t\tlet cache: CanvasNodeCache | null = null\n\t\tif (node && !node.mutable) {\n\t\t\tcache = node.cache\n\t\t\tif (cache.bezier) return cache.bezier\n\t\t}\n\n\t\tconst bezierCurves: Bezier[] = []\n\n\t\tlet paths: WithPath[] = []\n\t\tif (Array.isArray(withPaths)) {\n\t\t\tpaths = withPaths\n\t\t} else {\n\t\t\tpaths = [withPaths]\n\t\t}\n\n\t\tpaths.forEach(({ pathSegments, pathClosed }) => {\n\t\t\tpathSegments.forEach((currentPoint, i) => {\n\t\t\t\tlet nextPoint: PathSegment | undefined\n\n\t\t\t\tconst isLastPoint = i === pathSegments.length - 1\n\t\t\t\tif (isLastPoint) {\n\t\t\t\t\tif (pathClosed && pathSegments.length > 1) {\n\t\t\t\t\t\tnextPoint = pathSegments[0]\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tnextPoint = pathSegments[i + 1]\n\t\t\t\t}\n\n\t\t\t\tif (nextPoint) {\n\t\t\t\t\tconst curvePoints = [\n\t\t\t\t\t\tPathSegment.point(currentPoint),\n\t\t\t\t\t\tPathSegment.calculatedHandleOut(currentPoint),\n\t\t\t\t\t\tPathSegment.calculatedHandleIn(nextPoint),\n\t\t\t\t\t\tPathSegment.point(nextPoint),\n\t\t\t\t\t]\n\t\t\t\t\tconst bezier = new Bezier(curvePoints)\n\t\t\t\t\tbezierCurves.push(bezier)\n\t\t\t\t}\n\t\t\t})\n\t\t})\n\n\t\tif (cache && !(node && node.mutable)) cache.bezier = bezierCurves\n\t\treturn bezierCurves\n\t}\n\n\texport function isClosed(withPaths: WithPaths | WithPath): boolean {\n\t\tif (Array.isArray(withPaths)) {\n\t\t\treturn commonPropertyValue(withPaths, \"pathClosed\") === true\n\t\t} else {\n\t\t\treturn withPaths.pathClosed\n\t\t}\n\t}\n\n\texport function boundingBox(withPaths: WithPaths | WithPath, minPathSize: number = 1): Rect {\n\t\tconst bezierJS = toBezierJS(withPaths)\n\n\t\tconst xs: number[] = []\n\t\tconst ys: number[] = []\n\n\t\tfor (let i = 0, il = bezierJS.length; i < il; i++) {\n\t\t\tconst bezierCurve = bezierJS[i]\n\t\t\tconst bezierBoundingBox = bezierCurve.bbox()\n\t\t\txs.push(bezierBoundingBox.x.min, bezierBoundingBox.x.max)\n\t\t\tys.push(bezierBoundingBox.y.min, bezierBoundingBox.y.max)\n\t\t}\n\n\t\tif (xs.length === 0) {\n\t\t\tlet x = 0\n\t\t\tlet y = 0\n\n\t\t\t// if we have just one open segment, we can still extract the x/y\n\t\t\t// information from it\n\t\t\tconst paths = Array.isArray(withPaths) ? withPaths : [withPaths]\n\t\t\tconst segment = paths[0] ? paths[0].pathSegments[0] : null\n\n\t\t\tif (segment) {\n\t\t\t\tx = segment.x\n\t\t\t\ty = segment.y\n\t\t\t}\n\n\t\t\treturn { x, y, width: 0, height: 0 }\n\t\t}\n\n\t\tconst minX = snapInt(Math.min(...xs))\n\t\tconst minY = snapInt(Math.min(...ys))\n\t\tconst maxX = snapInt(Math.max(...xs))\n\t\tconst maxY = snapInt(Math.max(...ys))\n\n\t\treturn {\n\t\t\tx: minX,\n\t\t\ty: minY,\n\t\t\twidth: Math.max(maxX - minX, minPathSize),\n\t\t\theight: Math.max(maxY - minY, minPathSize),\n\t\t}\n\t}\n\n\texport function anchorBoundingBox(pathSegments: readonly PathSegment[]) {\n\t\tconst xs: number[] = []\n\t\tconst ys: number[] = []\n\t\tfor (const segment of pathSegments) {\n\t\t\txs.push(segment.x)\n\t\t\tys.push(segment.y)\n\t\t}\n\t\tconst minX = snapInt(Math.min(...xs))\n\t\tconst maxX = snapInt(Math.max(...xs))\n\t\tconst minY = snapInt(Math.min(...ys))\n\t\tconst maxY = snapInt(Math.max(...ys))\n\t\treturn {\n\t\t\tx: minX,\n\t\t\ty: minY,\n\t\t\twidth: maxX - minX,\n\t\t\theight: maxY - minY,\n\t\t}\n\t}\n\n\texport function offset(withPath: WithPath, delta: Point) {\n\t\treturn {\n\t\t\tpathSegments: withPath.pathSegments.map((segment: PathSegment) => {\n\t\t\t\treturn segment.merge(Point.add(segment, delta))\n\t\t\t}),\n\t\t\tpathClosed: withPath.pathClosed,\n\t\t}\n\t}\n\n\texport function split(pathSegments: readonly PathSegment[], pathClosed: boolean, segmentIndex: number, t: number) {\n\t\tconst bezierCurve = toBezierJS([{ pathSegments, pathClosed }])[segmentIndex]\n\t\tconst splitPointResult = bezierCurve.split(t)\n\t\tlet nextPointIndex = segmentIndex + 1\n\t\tif (segmentIndex === pathSegments.length - 1) {\n\t\t\tnextPointIndex = 0\n\t\t}\n\n\t\tconst fromSegment = pathSegments[segmentIndex]\n\t\tassert(fromSegment, \"fromSegment must be defined\")\n\t\tconst toSegment = pathSegments[nextPointIndex]\n\t\tassert(toSegment, \"toSegment must be defined\")\n\t\tconst straight = isStraightCurve(fromSegment, toSegment)\n\n\t\tconst leftPointCtrlPoint = splitPointResult.left.points[1] as Point\n\t\tlet newPoints = List.update(pathSegments, segmentIndex, currentFromPoint => {\n\t\t\tif (straight) {\n\t\t\t\treturn currentFromPoint\n\t\t\t}\n\t\t\treturn currentFromPoint.merge({\n\t\t\t\thandleOutX: leftPointCtrlPoint.x - currentFromPoint.x,\n\t\t\t\thandleOutY: leftPointCtrlPoint.y - currentFromPoint.y,\n\t\t\t\thandleMirroring: \"asymmetric\",\n\t\t\t})\n\t\t})\n\n\t\tconst rightPointCtrlPoint = splitPointResult.right.points[2] as Point\n\t\tnewPoints = List.update(newPoints, nextPointIndex, currentToPoint => {\n\t\t\tif (straight) {\n\t\t\t\treturn currentToPoint\n\t\t\t}\n\t\t\treturn currentToPoint.merge({\n\t\t\t\thandleInX: rightPointCtrlPoint.x - currentToPoint.x,\n\t\t\t\thandleInY: rightPointCtrlPoint.y - currentToPoint.y,\n\t\t\t\thandleMirroring: \"asymmetric\",\n\t\t\t})\n\t\t})\n\n\t\tconst splitPointLocation = splitPointResult.left.points[3] as Point\n\t\tconst splitControlPoint1 = splitPointResult.left.points[2] as Point\n\t\tconst splitControlPoint2 = splitPointResult.right.points[1] as Point\n\t\tconst vecSplitPoint = new PathSegment({\n\t\t\tx: splitPointLocation.x,\n\t\t\ty: splitPointLocation.y,\n\t\t\thandleInX: straight ? 0 : splitControlPoint1.x - splitPointLocation.x,\n\t\t\thandleInY: straight ? 0 : splitControlPoint1.y - splitPointLocation.y,\n\t\t\thandleOutX: straight ? 0 : splitControlPoint2.x - splitPointLocation.x,\n\t\t\thandleOutY: straight ? 0 : splitControlPoint2.y - splitPointLocation.y,\n\t\t\thandleMirroring: straight ? \"straight\" : \"asymmetric\",\n\t\t})\n\n\t\treturn List.insert(newPoints, segmentIndex + 1, vecSplitPoint)\n\t}\n\n\texport function isFirstSegment(pathSegments: readonly PathSegment[], closed: boolean, segmentIndex: number) {\n\t\tif (closed) return false\n\t\treturn segmentIndex === 0\n\t}\n\n\texport function isLastSegment(pathSegments: readonly PathSegment[], closed: boolean, segmentIndex: number) {\n\t\tif (closed) return false\n\t\treturn segmentIndex === pathSegments.length - 1\n\t}\n\n\texport function isEndSegment(pathSegments: readonly PathSegment[], closed: boolean, segmentIndex: number) {\n\t\treturn isFirstSegment(pathSegments, closed, segmentIndex) || isLastSegment(pathSegments, closed, segmentIndex)\n\t}\n\n\texport function reverse(pathSegments: readonly PathSegment[]) {\n\t\treturn pathSegments\n\t\t\t.slice()\n\t\t\t.reverse()\n\t\t\t.map(segment => reverseSegment(segment))\n\t}\n\n\texport function canClose(\n\t\tpathSegments: readonly PathSegment[],\n\t\tclosed: boolean,\n\t\tselectedSegment: number,\n\t\thoveringSegment: number,\n\t) {\n\t\tif (pathSegments.length === 1) {\n\t\t\treturn false\n\t\t}\n\t\tconst selectedIsFirst = isFirstSegment(pathSegments, closed, selectedSegment)\n\t\tconst selectedIsLast = isLastSegment(pathSegments, closed, selectedSegment)\n\t\tconst hoveringIsFirst = isFirstSegment(pathSegments, closed, hoveringSegment)\n\t\tconst hoveringIsLast = isLastSegment(pathSegments, closed, hoveringSegment)\n\t\treturn (selectedIsFirst && hoveringIsLast) || (selectedIsLast && hoveringIsFirst)\n\t}\n\n\texport function segmentIndexesToDelete(\n\t\tpathSegments: readonly PathSegment[],\n\t\tclosed: boolean,\n\t\tcurveIndexesToRemove: number[],\n\t) {\n\t\tconst segmentCount = pathSegments.length\n\t\tconst pathClosedCurveRemoved = !closed || curveIndexesToRemove.includes(segmentCount - 1)\n\t\treturn pathSegments.map((map: PathSegment, index: number) => {\n\t\t\tconst isFirst = index === 0\n\t\t\tconst isLast = index === segmentCount - 1\n\t\t\tconst nextCurveRemoved = curveIndexesToRemove.includes(index)\n\t\t\tconst prevCurveRemoved = curveIndexesToRemove.includes(index - 1)\n\n\t\t\tif (isFirst) {\n\t\t\t\treturn nextCurveRemoved && pathClosedCurveRemoved\n\t\t\t} else if (isLast) {\n\t\t\t\treturn prevCurveRemoved && pathClosedCurveRemoved\n\t\t\t} else {\n\t\t\t\treturn nextCurveRemoved && prevCurveRemoved\n\t\t\t}\n\t\t})\n\t}\n\n\texport function radiusEnabledSegments(pathSegments: readonly PathSegment[], closed: boolean) {\n\t\tconst result: boolean[] = []\n\t\tpathSegments.forEach((segment, i) => {\n\t\t\tif (pathSegments.length < 3) {\n\t\t\t\tresult.push(false)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst isFirst = i === 0\n\t\t\tconst isLast = i === pathSegments.length - 1\n\t\t\tif (isFirst && !closed) {\n\t\t\t\tresult.push(false)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (isLast && !closed) {\n\t\t\t\tresult.push(false)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst prevSegment = isFirst ? pathSegments[pathSegments.length - 1] : pathSegments[i - 1]\n\t\t\tassert(prevSegment, \"prevSegment must be defined\")\n\t\t\tconst nextSegment = isLast ? pathSegments[0] : pathSegments[i + 1]\n\t\t\tassert(nextSegment, \"nextSegment must be defined\")\n\t\t\tconst enabled = isStraightCurve(prevSegment, segment) && isStraightCurve(segment, nextSegment)\n\t\t\tresult.push(enabled)\n\t\t})\n\n\t\treturn result\n\t}\n\n\texport function reduceRadius(\n\t\tpathSegments: readonly PathSegment[],\n\t\tclosed: boolean,\n\t\tresult: { radius: Reduced<number> },\n\t\tselectedIndexes?: number[],\n\t) {\n\t\tif (result.radius === Mixed) {\n\t\t\treturn\n\t\t}\n\t\tconst enabledIndexes = radiusEnabledSegments(pathSegments, closed)\n\n\t\tfor (let i = 0, il = pathSegments.length; i < il; i++) {\n\t\t\tconst enabled = enabledIndexes[i]\n\t\t\tif (!enabled) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tconst segment = pathSegments[i]\n\t\t\tif (!segment) continue\n\t\t\tif (selectedIndexes && !selectedIndexes.includes(i)) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (isNotFound(result.radius)) {\n\t\t\t\tresult.radius = segment.radius\n\t\t\t} else if (result.radius !== segment.radius) {\n\t\t\t\tresult.radius = Mixed\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\texport function applyRadius(pathSegments: readonly PathSegment[], pathClosed: boolean, zoom: number = 1): WithPath {\n\t\tconst enabledIndexes = radiusEnabledSegments(pathSegments, pathClosed)\n\t\tconst pathSegmentResult: PathSegment[] = []\n\t\tpathSegments.forEach((segment, i) => {\n\t\t\tconst enabled = enabledIndexes[i]\n\t\t\t// Apply zoom to the radius for proper scaling\n\t\t\tconst scaledRadius = segment.radius * zoom\n\t\t\tif (!enabled || scaledRadius === 0) {\n\t\t\t\tpathSegmentResult.push(segment)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst isFirst = i === 0\n\t\t\tconst isLast = i === pathSegments.length - 1\n\t\t\tconst prevSegment = isFirst ? pathSegments[pathSegments.length - 1] : pathSegments[i - 1]\n\t\t\tassert(prevSegment, \"prevSegment must be defined\")\n\t\t\tconst nextSegment = isLast ? pathSegments[0] : pathSegments[i + 1]\n\t\t\tassert(nextSegment, \"nextSegment must be defined\")\n\n\t\t\tlet prevRatio = 1\n\t\t\tlet nextRatio = 1\n\n\t\t\tconst prevSegmentRadiusEnabled =\n\t\t\t\t(isFirst ? enabledIndexes[pathSegments.length - 1] : enabledIndexes[i - 1]) && prevSegment.radius !== 0\n\t\t\tconst nextSegmentRadiusEnabled = isLast ? enabledIndexes[0] : enabledIndexes[i + 1] && nextSegment.radius !== 0\n\n\t\t\tif (prevSegmentRadiusEnabled) {\n\t\t\t\tconst prevScaledRadius = prevSegment.radius * zoom\n\t\t\t\tprevRatio = scaledRadius / nonZero(prevScaledRadius + scaledRadius)\n\t\t\t}\n\t\t\tif (nextSegmentRadiusEnabled) {\n\t\t\t\tconst nextScaledRadius = nextSegment.radius * zoom\n\t\t\t\tnextRatio = scaledRadius / nonZero(nextScaledRadius + scaledRadius)\n\t\t\t}\n\n\t\t\tconst prevMaxDistance = Point.distance(prevSegment, segment) * prevRatio\n\t\t\tconst nextMaxDistance = Point.distance(segment, nextSegment) * nextRatio\n\t\t\tconst maxDistance = Math.min(prevMaxDistance, nextMaxDistance)\n\n\t\t\tif (maxDistance === 0) {\n\t\t\t\tpathSegmentResult.push(segment)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst angle = curveAngle(segment, prevSegment, nextSegment)\n\t\t\tconst maxR = maxRadius(angle, maxDistance)\n\t\t\tconst radius = Math.min(scaledRadius, maxR)\n\n\t\t\tconst distance = radius / nonZero(Math.tan(angle / 2))\n\n\t\t\tconst from = movePoint(segment, prevSegment, distance)\n\t\t\tconst to = movePoint(segment, nextSegment, distance)\n\n\t\t\tconst angleInDegrees = (angle * 180) / Math.PI\n\t\t\tconst circleAngle = 180 - angleInDegrees\n\t\t\tconst n = (2 * 360) / nonZero(circleAngle)\n\n\t\t\tconst handleDistance = (4 / 3) * Math.tan(Math.PI / n)\n\n\t\t\tconst fromHandle = movePoint(from, segment, handleDistance * radius)\n\t\t\tconst toHandle = movePoint(to, segment, handleDistance * radius)\n\n\t\t\tconst fromRel = Point.subtract(fromHandle, from)\n\t\t\tconst toRel = Point.subtract(toHandle, to)\n\n\t\t\tconst fromSegment = new PathSegment({\n\t\t\t\t...from,\n\t\t\t\thandleMirroring: \"disconnected\",\n\t\t\t\thandleOutX: fromRel.x,\n\t\t\t\thandleOutY: fromRel.y,\n\t\t\t})\n\t\t\tconst toSegment = new PathSegment({\n\t\t\t\t...to,\n\t\t\t\thandleMirroring: \"disconnected\",\n\t\t\t\thandleInX: toRel.x,\n\t\t\t\thandleInY: toRel.y,\n\t\t\t})\n\n\t\t\tpathSegmentResult.push(fromSegment, toSegment)\n\t\t})\n\n\t\treturn { pathSegments: pathSegmentResult, pathClosed }\n\t}\n}\n\nfunction curveAngle(intersection: Point, a: Point, b: Point) {\n\tconst angle =\n\t\tMath.atan2(b.y - intersection.y, b.x - intersection.x) - Math.atan2(a.y - intersection.y, a.x - intersection.x)\n\tconst angle2 = angle >= 0 ? angle : 2 * Math.PI + angle\n\treturn angle2 < Math.PI ? angle2 : 2 * Math.PI - angle2\n}\n\nfunction maxRadius(angle: number, maxDistance: number) {\n\treturn maxDistance * Math.tan(angle / 2)\n}\n\nfunction movePoint(from: Point, to: Point, distance: number) {\n\tconst toEndDistance = Point.distance(from, to)\n\tif (distance === 0 || toEndDistance === 0) {\n\t\treturn from\n\t}\n\tconst deltaX = to.x - from.x\n\tconst deltaY = to.y - from.y\n\tconst times = distance / toEndDistance\n\treturn { x: from.x + times * deltaX, y: from.y + times * deltaY }\n}\n\n/** To prevent division by zero */\nfunction nonZero(value: number) {\n\treturn value === 0 ? 1 : value\n}\n", "import type { PathSegment } from \"library/render/types/PathSegment.ts\"\n\nexport function reverseSegment(segment: PathSegment) {\n\treturn segment.merge({\n\t\thandleOutX: segment.handleInX,\n\t\thandleOutY: segment.handleInY,\n\t\thandleInX: segment.handleOutX,\n\t\thandleInY: segment.handleOutY,\n\t})\n}\n", "import type { Transition } from \"document/models/Transition.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\n\nexport interface WithStrokeEffect {\n\tstrokeEffectEnabled: boolean | undefined\n\tstrokeEffectLength: number | undefined\n\tstrokeEffectGap: number | undefined\n\tstrokeEffectOffset: number | undefined\n\tstrokeEffectTransition: Transition | undefined\n\tstrokeEffectLoop: boolean | undefined\n\tstrokeEffectLoopType: \"repeat\" | \"mirror\" | \"continuous\" | undefined\n}\n\nexport const strokeEffectDefaults: WithStrokeEffect = {\n\tstrokeEffectEnabled: undefined,\n\tstrokeEffectLength: undefined,\n\tstrokeEffectGap: undefined,\n\tstrokeEffectOffset: undefined,\n\tstrokeEffectTransition: undefined,\n\tstrokeEffectLoop: undefined,\n\tstrokeEffectLoopType: undefined,\n}\n\nexport const defaultStrokeEffectTransition: Transition = {\n\ttype: \"tween\",\n\tease: [0.44, 0, 0.56, 1],\n\tduration: 2,\n\tdelay: 0,\n\tstiffness: 400,\n\tdamping: 30,\n\tmass: 1,\n\tdurationBasedSpring: true,\n\tbounce: 0.2,\n}\n\nexport const strokeEffectEnabledDefaults = {\n\tstrokeEffectEnabled: true,\n\tstrokeEffectLength: 1,\n\tstrokeEffectGap: 1,\n\tstrokeEffectOffset: 0,\n\tstrokeEffectTransition: { ...defaultStrokeEffectTransition },\n\tstrokeEffectLoop: false,\n\tstrokeEffectLoopType: \"repeat\",\n} as const satisfies WithStrokeEffect\n\nconst key: keyof WithStrokeEffect = \"strokeEffectEnabled\"\n\nexport function withStrokeEffect<T extends CanvasNode>(node: T): node is T & WithStrokeEffect {\n\treturn key in node\n}\n\nexport function hasStrokeEffect<T extends CanvasNode>(\n\tnode: T,\n): node is T & WithStrokeEffect & { strokeEffectEnabled: true } {\n\treturn withStrokeEffect(node) && node.strokeEffectEnabled === true\n}\n", "import { js } from \"code-generation/js/js.ts\"\nimport type { SVG } from \"code-generation/js/svg.ts\"\nimport type { MakeSerializable } from \"code-generation/types.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tdefaultStrokeEffectTransition,\n\tstrokeEffectEnabledDefaults,\n\twithStrokeEffect,\n} from \"document/models/CanvasTree/traits/WithStrokeEffect.ts\"\nimport { toMotionTransition } from \"document/models/Transition.ts\"\nimport { RenderTarget } from \"library/index.ts\"\nimport type { Props as VectorFXProps } from \"library/modules/withStrokeFX.tsx\"\nimport { toSVGPath } from \"library/render/traits/Path.ts\"\nimport type { WithShape } from \"library/render/traits/Shape.ts\"\nimport { withShape } from \"library/render/traits/Shape.ts\"\nimport type { SVGContext } from \"./svgContext.ts\"\n\nexport function hasAnyEffect(node: CanvasNode, ctx: SVGContext) {\n\tif (ctx.target !== \"jsx\") return false\n\treturn withStrokeEffect(node) && node.strokeEffectEnabled\n}\n\nexport function effectsForNode(node: CanvasNode, ctx: SVGContext) {\n\tif (!withStrokeEffect(node) || !withShape(node) || !node.strokeEffectEnabled) return\n\n\tif (ctx.target !== \"jsx\") {\n\t\tctx.effectNodes.add(node.id)\n\t\treturn\n\t}\n\n\tconst update: MakeSerializable<VectorFXProps> = {\n\t\tstrokeEffectLength: node.strokeEffectLength ?? strokeEffectEnabledDefaults.strokeEffectLength,\n\t\tstrokeEffectGap: node.strokeEffectGap ?? strokeEffectEnabledDefaults.strokeEffectGap,\n\t\tstrokeEffectOffset: node.strokeEffectOffset ?? strokeEffectEnabledDefaults.strokeEffectOffset,\n\t\tstrokeEffectTotalLength: getPathLength(node),\n\t\tstrokeEffectLoop: node.strokeEffectLoop ?? strokeEffectEnabledDefaults.strokeEffectLoop,\n\t\tstrokeEffectLoopType: node.strokeEffectLoopType ?? strokeEffectEnabledDefaults.strokeEffectLoopType,\n\t\tpathLengthTransition: ctx.declarations.file.dedupe(\n\t\t\t\"transition\",\n\t\t\ttoMotionTransition(node.strokeEffectTransition ?? defaultStrokeEffectTransition),\n\t\t),\n\t}\n\n\treturn update\n}\n\nexport function tagWithEffect<T extends SVG.Tag>(node: CanvasNode, tag: T, ctx: SVGContext) {\n\treturn hasAnyEffect(node, ctx)\n\t\t? (js`${ctx.imports.addImport(\"framer\", {\n\t\t\t\texportSpecifier: `motion.${tag}`,\n\t\t\t\tcomposeWithImports: [ctx.imports.addImport(\"framer\", { exportSpecifier: \"withV1StrokeFX\" })],\n\t\t\t\t// VECTOR @TODO - Figure out types.\n\t\t\t})}` as unknown as T)\n\t\t: tag\n}\n\n/**\n * Get the precise total length of the path.\n *\n * Alternatively implement our own by vendoring:\n * https://github.com/thednp/svg-path-commander/blob/master/src/util/getTotalLength.ts\n */\nfunction getPathLength(node: CanvasNode & WithShape) {\n\t// Create a temporary SVG path element\n\tconst path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\")\n\tpath.setAttribute(\"d\", toSVGPath(node.calculatedPaths(), undefined, RenderTarget.export))\n\t// The path must be in the DOM to work in some browsers, but not all.\n\t// We'll try without appending for performance.\n\treturn path.getTotalLength()\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport { type TagTransform, js } from \"code-generation/js/js.ts\"\nimport type { SafeJS } from \"code-generation/js/serializeJS.ts\"\nimport type { SVG } from \"code-generation/js/svg.ts\"\nimport type { MakeSerializable } from \"code-generation/types.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { hasBoxShadow } from \"document/models/CanvasTree/traits/WithBoxShadow.ts\"\nimport { withOptionalFill } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport { type WithStroke, hasDynamicStrokeWidth, withStroke } from \"document/models/CanvasTree/traits/WithStroke.ts\"\nimport type { IsVectorSetItem } from \"document/models/CanvasTree/traits/WithVectorSetItem.ts\"\nimport { Path } from \"document/models/Path.ts\"\nimport { isBoxShadow } from \"document/models/Shadow.ts\"\nimport { type BoxShadow, Rect, type WithShape, isFiniteNumber, localShadowFrame, withShape } from \"library/index.ts\"\nimport type { Props as VectorFXProps } from \"library/modules/withStrokeFX.tsx\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { effectsForNode, tagWithEffect } from \"./effects.ts\"\nimport { type SVGContext, type XMLSerializer, serializerForTarget, svg } from \"./svgContext.ts\"\n\nfunction filterElementsForOutsetShadow(ctx: SVGContext, shadow: BoxShadow, out: string, xml: XMLSerializer) {\n\tconst offset = `${out}-offset`\n\tconst blur = `${out}-blur`\n\tconst flood = `${out}-flood`\n\n\treturn xml`${js.joinLines(\n\t\tsvg(xml, \"feOffset\", { dx: shadow.x, dy: shadow.y, in: \"SourceAlpha\", result: offset }),\n\t\tsvg(xml, \"feGaussianBlur\", { stdDeviation: shadow.blur / 2, in: offset, result: blur }),\n\t\tsvg(xml, \"feFlood\", { floodColor: ctx.colors.addColor(shadow.color), result: flood }),\n\t\tsvg(xml, \"feComposite\", { in: flood, operator: \"in\", in2: blur, result: out }),\n\t)}`\n}\n\nfunction filterElementsForInsetShadow(ctx: SVGContext, shadow: BoxShadow, out: string, xml: XMLSerializer) {\n\tconst flood = `${out}-flood`\n\tconst blur = `${out}-blur`\n\tconst offset = `${out}-offset`\n\tconst composite = `${out}-composite`\n\n\treturn xml`${js.joinLines(\n\t\tsvg(xml, \"feGaussianBlur\", { stdDeviation: shadow.blur / 2, in: \"SourceAlpha\", result: blur }),\n\t\tsvg(xml, \"feOffset\", { dx: shadow.x, dy: shadow.y, in: blur, result: offset }),\n\t\tsvg(xml, \"feComposite\", {\n\t\t\tin: offset,\n\t\t\tin2: \"SourceAlpha\",\n\t\t\toperator: \"arithmetic\",\n\t\t\tk2: -1,\n\t\t\tk3: 1,\n\t\t\tresult: composite,\n\t\t}),\n\t\tsvg(xml, \"feFlood\", { floodColor: ctx.colors.addColor(shadow.color), result: flood }),\n\t\tsvg(xml, \"feComposite\", { in: flood, operator: \"in\", in2: composite, result: out }),\n\t)}`\n}\n\nfunction mask(useId: string, id: string, attributes: SVG.Attributes<\"mask\">, fillEnabled: boolean, xml: XMLSerializer) {\n\treturn svg(\n\t\txml,\n\t\t\"mask\",\n\t\t{ id, ...attributes },\n\t\txml`${js.joinLines(\n\t\t\tsvg(xml, \"rect\", { width: \"100%\", height: \"100%\", fill: \"white\" }),\n\t\t\tsvg(xml, \"use\", { fill: \"black\", fillOpacity: fillEnabled ? undefined : 0, href: `#${useId}` }),\n\t\t)}`,\n\t)\n}\n\nfunction outsetTransform(\n\tshapeId: string,\n\tsvgRect: SVG.RectAttributes,\n\tstroke: Stroke | undefined,\n\tfillEnabled: boolean,\n\txml: XMLSerializer,\n) {\n\tconst maskId = `${shapeId}-shadow-mask`\n\n\tconst tag = svg(\n\t\txml,\n\t\t\"g\",\n\t\t{ filter: `url(#${shapeId}-shadow-${ShadowType.Outset})`, mask: `url(#${maskId})` },\n\t\tsvg(xml, \"use\", {\n\t\t\t// Stroke width defaults to 1px. Set to to 0 to avoid cropping shadows when there's no stroke.\n\t\t\tstrokeWidth: 0,\n\t\t\t...stroke?.attributes,\n\t\t\tfill: \"black\",\n\t\t\tfillOpacity: fillEnabled ? undefined : 0,\n\t\t\tstroke: \"black\",\n\t\t\tstrokeOpacity: stroke ? undefined : 0,\n\t\t\thref: `#${shapeId}`,\n\t\t\tclipPath: stroke?.url ? `url(#${stroke?.url})` : undefined,\n\t\t}),\n\t)\n\n\treturn (children: SafeJS) => xml`${js.joinLines(mask(shapeId, maskId, svgRect, fillEnabled, xml), tag, children)}`\n}\n\nfunction insetTransform(shapeId: string, stroke: Stroke | undefined, xml: XMLSerializer) {\n\tconst tag = svg(xml, \"use\", {\n\t\tfilter: `url(#${shapeId}-shadow-${ShadowType.Inset})`,\n\t\thref: `#${shapeId}`,\n\t\tclipPath: stroke?.url ? `url(#${stroke.url})` : undefined,\n\t})\n\n\treturn (children: SafeJS) => xml`${js.joinLines(children, tag)}`\n}\n\nenum ShadowType {\n\tOutset = \"outset\",\n\tInset = \"inset\",\n}\n\nfunction createShadows(\n\tnode: CanvasNode & WithShape,\n\tshapeId: string,\n\tshadows: BoxShadow[],\n\tctx: SVGContext,\n\ttype: ShadowType,\n\tstroke: Stroke | undefined,\n) {\n\tif (shadows.length === 0) return\n\t// Shadow filter uses 'objectBoundingBox' as filter units, so calculations should be\n\t// relative to the referenced object itself (path), instead of the node rect, which\n\t// can be larger than the path bounding box.\n\tconst calculatedPathBoundingBox = Path.boundingBox(node.calculatedPaths())\n\tconst rect = Rect.atOrigin(calculatedPathBoundingBox)\n\tconst rects = [rect]\n\n\tlet maxBlur = 0\n\tconst filterElements: SafeJS[] = []\n\tconst mergeElements: SafeJS[] = []\n\n\tconst fn = type === ShadowType.Outset ? filterElementsForOutsetShadow : filterElementsForInsetShadow\n\tconst xml = serializerForTarget(ctx.target)\n\n\tfor (let i = shadows.length; i >= 0; i--) {\n\t\tconst shadow = shadows[i]\n\t\tif (!isBoxShadow(shadow)) continue\n\n\t\tconst shadowRect = localShadowFrame(shadow, rect, true)\n\t\tif (shadowRect) rects.push(shadowRect)\n\n\t\tif (type === ShadowType.Outset) maxBlur = Math.max(maxBlur, shadow.blur)\n\n\t\tconst id = `${shapeId}-shadow-${type}-${i}`\n\t\tfilterElements.push(fn(ctx, shadow, id, xml))\n\t\tmergeElements.push(svg(xml, \"feMergeNode\", { in: id }))\n\t}\n\n\tconst { strokeWidth, strokeMiterlimit } = stroke?.attributes ?? {}\n\tconst expandStrokeWidth = type === ShadowType.Outset && isFiniteNumber(strokeWidth) ? strokeWidth : 0\n\tconst miter = isFiniteNumber(strokeMiterlimit) ? strokeMiterlimit : 4\n\tconst shadowRect = Rect.inflate(Rect.merge(...rects), ((expandStrokeWidth * miter) / 2 + maxBlur) * 1.1)\n\n\tconst calculatedStrokeWidth = expandStrokeWidth ? expandStrokeWidth / 2 : 0\n\n\t// Calculate percentage of shadow frame compared to node frame\n\tconst width = rect.width + calculatedStrokeWidth\n\tconst height = rect.height + calculatedStrokeWidth\n\tconst filterX = (shadowRect.x / width) * 100\n\tconst filterY = (shadowRect.y / height) * 100\n\tconst filterWidth = (shadowRect.width / width) * 100\n\tconst filterHeight = (shadowRect.height / height) * 100\n\n\tconst svgRect: SVG.RectAttributes = {\n\t\tx: `${filterX.toFixed(1)}%`,\n\t\ty: `${filterY.toFixed(1)}%`,\n\t\twidth: `${filterWidth.toFixed(1)}%`,\n\t\theight: `${filterHeight.toFixed(1)}%`,\n\t}\n\n\tctx.defs.push(\n\t\tsvg(\n\t\t\txml,\n\t\t\t\"filter\",\n\t\t\t{\n\t\t\t\tid: `${shapeId}-shadow-${type}`,\n\t\t\t\t...svgRect,\n\t\t\t\tfilterUnits: \"objectBoundingBox\",\n\t\t\t},\n\t\t\txml`${js.joinLines(\n\t\t\t\t...filterElements,\n\t\t\t\tshadows.length > 1 && svg(xml, \"feMerge\", undefined, xml`${js.joinLines(...mergeElements)}`),\n\t\t\t)}`,\n\t\t),\n\t)\n\n\tswitch (type) {\n\t\tcase ShadowType.Outset:\n\t\t\treturn outsetTransform(shapeId, svgRect, stroke, Boolean(withOptionalFill(node) && node.fillEnabled), xml)\n\t\tcase ShadowType.Inset:\n\t\t\treturn insetTransform(shapeId, stroke, xml)\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\ninterface Stroke {\n\turl: string | undefined\n\tattributes: SVG.StrokeAttributes\n}\n\nfunction hasVisibleStroke<T extends CanvasNode>(node: T): node is T & WithStroke & WithShape & { strokeWidth: number } {\n\tif (!withShape(node)) return false\n\tif (!withStroke(node) || !node.strokeEnabled) return false\n\tif (isNumber(node.strokeWidth)) return node.strokeWidth > 0\n\treturn isVariableReference(node.strokeWidth)\n}\n\nfunction hasInsideStroke(node: CanvasNode): boolean {\n\tif (!hasVisibleStroke(node)) return false\n\n\tconst calculatedPath = node.calculatedPaths()\n\tconst pathClosed = Path.isClosed(calculatedPath)\n\treturn pathClosed && node.strokeAlignment === \"inside\"\n}\n\nfunction strokeForNode(\n\tnode: (CanvasNode & IsVectorSetItem) | (CanvasNode & WithShape),\n\tshapeId: string,\n\tctx: SVGContext,\n\txml: XMLSerializer,\n): Stroke | undefined {\n\tif (!hasVisibleStroke(node)) return undefined\n\n\tconst insideStroke = hasInsideStroke(node)\n\n\tconst url = insideStroke ? `${shapeId}-stroke` : undefined\n\n\tif (insideStroke) {\n\t\tconst clipPath = svg(xml, \"clipPath\", { id: url }, svg(xml, \"use\", { href: `#${shapeId}` }))\n\t\tctx.defs.push(clipPath)\n\t}\n\n\tlet value: string | number | undefined\n\tif (isVariableReference(node.strokeWidth)) {\n\t\tconst variable = ctx.cssVariableDefinitions.create(node, \"strokeWidth\")\n\t\t// Specifically include the px unit in the calc. Otherwise `calc(0 * N)` resolves to `0%`,\n\t\t// which still renders a stroke artefact in Chrome (as of v136.0.7103.114).\n\t\tvalue = insideStroke ? `calc(${variable} * 2px)` : variable\n\t} else {\n\t\tvalue = node.strokeWidth\n\t}\n\n\treturn {\n\t\turl,\n\t\tattributes: {\n\t\t\tstrokeWidth: value,\n\t\t\tstroke: isDynamicValue(node.strokeColor)\n\t\t\t\t? ctx.cssVariableDefinitions.create(node, \"strokeColor\")\n\t\t\t\t: ctx.colors.addColor(node.strokeColor),\n\t\t\tstrokeLinecap: node.lineCap,\n\t\t\tstrokeLinejoin: node.lineJoin,\n\t\t\tstrokeMiterlimit: node.lineJoin === \"miter\" ? node.strokeMiterLimit : undefined,\n\t\t\tstrokeDasharray: node.strokeDashArray,\n\t\t\tstrokeDashoffset: node.strokeDashOffset !== 0 ? node.strokeDashOffset : undefined,\n\t\t},\n\t}\n}\n\n/**\n *  VECTOR @TODO - Document this.\n */\nfunction createInsetShadowClip(\n\tnode: CanvasNode,\n\tinsetShadows: BoxShadow[],\n\tstroke: Stroke | undefined,\n\teffects: MakeSerializable<VectorFXProps> | undefined,\n\tctx: SVGContext,\n) {\n\tif (!stroke) return undefined\n\n\tif (!stroke?.url && insetShadows.length === 0) return undefined\n\n\tconst xml = serializerForTarget(ctx.target)\n\tconst shapeId = shapeIdForNode(node, ctx)\n\n\tconst props = {\n\t\t...stroke.attributes,\n\t\t...effects,\n\t\thref: `#${shapeId}`,\n\t\tclipPath: stroke.url ? `url(#${stroke.url})` : undefined,\n\t\tfill: \"transparent\",\n\t}\n\n\tconst tag = tagWithEffect(node, \"use\", ctx)\n\tconst use = svg(xml, tag, props)\n\n\treturn (children: SafeJS) => xml`${js.joinLines(children, use)}`\n}\n\nfunction shapeIdForNode(node: CanvasNode, ctx: SVGContext) {\n\treturn `${node.id}-${ctx.revision}`\n}\n\nfunction asTemplatePath<T extends SVG.Tag>(\n\tnode: CanvasNode & WithShape,\n\tctx: SVGContext,\n\ttag: T,\n\t{ d, ...props }: SVG.Attributes<T>,\n\teffects: MakeSerializable<VectorFXProps> | undefined,\n\ttransforms: (TagTransform | undefined)[],\n) {\n\tconst xml = serializerForTarget(ctx.target)\n\n\tconst {\n\t\t// We want the shadow element and the shape have the identical transform, hence putting it on\n\t\t// the template.\n\t\ttransform,\n\t\tdisplay,\n\t\t...restProps\n\t} = props\n\n\tconst shapeId = shapeIdForNode(node, ctx)\n\n\tctx.defs.push(svg(xml, tag, { d, id: shapeId, transform, display }))\n\n\tconst insideStroke = hasInsideStroke(node)\n\n\treturn (children: SafeJS) =>\n\t\txml.applyTransforms(\n\t\t\tsvg(\n\t\t\t\txml,\n\t\t\t\tinsideStroke ? \"use\" : tagWithEffect(node, \"use\", ctx),\n\t\t\t\t{ href: `#${shapeId}`, ...restProps, ...(!insideStroke ? effects : undefined) },\n\t\t\t\tchildren,\n\t\t\t),\n\t\t\ttransforms,\n\t\t)\n}\n\nexport function withShadows<T extends SVG.Tag>(\n\tnode: (CanvasNode & IsVectorSetItem) | (CanvasNode & WithShape),\n\ttag: T,\n\tprops: SVG.Attributes<T>,\n\tctx: SVGContext,\n) {\n\tconst shapeId = shapeIdForNode(node, ctx)\n\tconst xml = serializerForTarget(ctx.target)\n\tconst stroke = strokeForNode(node, shapeId, ctx, xml)\n\tconst effects = effectsForNode(node, ctx)\n\n\tif (\n\t\t!withShape(node) ||\n\t\t!hasBoxShadow(node) ||\n\t\t// Stroke Width variables and shadows are incompatible, because SVG <filter> does not support calculated size.\n\t\thasDynamicStrokeWidth(node) ||\n\t\tisDynamicValue(node.boxShadows)\n\t) {\n\t\treturn withShape(node) && stroke?.url\n\t\t\t? asTemplatePath(node, ctx, tag, props, effects, [createInsetShadowClip(node, [], stroke, effects, ctx)])\n\t\t\t: (children: SafeJS) =>\n\t\t\t\t\tsvg(\n\t\t\t\t\t\txml,\n\t\t\t\t\t\ttagWithEffect(node, tag, ctx),\n\t\t\t\t\t\t{ id: shapeId, ...stroke?.attributes, ...props, ...effects },\n\t\t\t\t\t\tchildren,\n\t\t\t\t\t)\n\t}\n\n\tconst insetShadows: BoxShadow[] = []\n\tconst outsetShadows: BoxShadow[] = []\n\n\tfor (const shadow of node.boxShadows) {\n\t\tconst group = shadow.inset ? insetShadows : outsetShadows\n\t\tgroup.push(shadow)\n\t}\n\n\tconst transforms: (TagTransform | undefined)[] = [\n\t\tcreateShadows(node, shapeId, outsetShadows, ctx, ShadowType.Outset, stroke),\n\t\tcreateShadows(node, shapeId, insetShadows, ctx, ShadowType.Inset, stroke),\n\t\tcreateInsetShadowClip(node, insetShadows, stroke, effects, ctx),\n\t]\n\n\t// When there is stroke, and its inside we use a clip & a use\n\t// When there is stroke, and there's inset shadows, we use a use (but no clip)\n\t// Otherwise it goes on the shape\n\tprops = stroke?.url ? props : { ...props, ...stroke?.attributes }\n\n\tconst anyFilters = outsetShadows.length > 0 || insetShadows.length > 0\n\n\treturn anyFilters\n\t\t? asTemplatePath(node, ctx, tag, props, effects, transforms)\n\t\t: (children: SafeJS) =>\n\t\t\t\txml.applyTransforms(\n\t\t\t\t\tsvg(xml, tagWithEffect(node, tag, ctx), { id: shapeId, ...props, ...effects }, children),\n\t\t\t\t\ttransforms,\n\t\t\t\t)\n}\n", "import type { SVG } from \"code-generation/js/svg.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { type IsVectorSetItem, isVectorSetItem } from \"document/models/CanvasTree/traits/WithVectorSetItem.ts\"\nimport { type WithShape, transformString } from \"library/index.ts\"\nimport { transformValues } from \"library/render/utils/createTransformValues.ts\"\n\nexport function collectTransform(\n\tnode: (CanvasNode & IsVectorSetItem) | (CanvasNode & WithShape),\n\tprops: SVG.AnyAttributes,\n) {\n\tconst frame = node.rect()\n\n\tif (isVectorSetItem(node)) return\n\n\tconst rotate = node.resolveValue(\"rotation\")\n\n\tprops.transform = transformString(transformValues(frame, rotate, false))\n\tprops.width = `${frame.width}px`\n\tprops.height = `${frame.height}px`\n}\n", "import type { SVG } from \"code-generation/js/svg.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isVectorSetItem } from \"document/models/CanvasTree/traits/WithVectorSetItem.ts\"\n\nexport function collectVisibility(node: CanvasNode, props: SVG.AnyAttributes) {\n\tif (isVectorSetItem(node)) return\n\tif (!node.resolveValue(\"visible\")) props.display = \"none\"\n}\n", "import { assert, assertNever } from \"@framerjs/shared\"\nimport { Var } from \"code-generation/components/GeneratedVariantComponentVars.ts\"\nimport type { SerializableValue } from \"code-generation/js/SerializableValue.ts\"\nimport { js, jst, jsx } from \"code-generation/js/js.ts\"\nimport { SafeJS, SerializableObject, serializeJS } from \"code-generation/js/serializeJS.ts\"\nimport type { SVG } from \"code-generation/js/svg.ts\"\nimport type { SerializableMotionStyle } from \"code-generation/types.ts\"\nimport type { ShapeContainerNode } from \"document/models/CanvasTree/index.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { VectorSetNode } from \"document/models/CanvasTree/nodes/VectorSetNode.ts\"\nimport { isBooleanShapeNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { withOpacity } from \"document/models/CanvasTree/traits/WithOpacity.ts\"\nimport type { Loaded } from \"document/models/CanvasTree/traits/WithScopeLoader.ts\"\nimport { withShape } from \"document/models/CanvasTree/traits/WithShape.ts\"\nimport { type IsVectorSetItem, isVectorSetItem } from \"document/models/CanvasTree/traits/WithVectorSetItem.ts\"\nimport { RenderTarget, type WithShape, toSVGPath } from \"library/index.ts\"\nimport { isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { JSXEngineDependencies } from \"../types.ts\"\nimport { collectFill } from \"./fills.ts\"\nimport { withShadows } from \"./shadows.ts\"\nimport {\n\tANIMATED_PROP_NAME,\n\tRenderElement,\n\ttype SVGContext,\n\tcreateSVGTagContext,\n\tserializerForTarget,\n\tsvg,\n} from \"./svgContext.ts\"\nimport { collectTransform } from \"./transforms.ts\"\nimport { collectVisibility } from \"./visibility.ts\"\n\nfunction childrenForNode(node: (CanvasNode & IsVectorSetItem) | (CanvasNode & WithShape)): (CanvasNode & WithShape)[] {\n\tif (isBooleanShapeNode(node)) return []\n\t// VECTOR @TODO - make serializing type safe to only vector nodes.\n\t// @ts-expect-error: children is probably with shape\n\treturn node.children ?? []\n}\n\ntype SerializableClassDiscriminator =\n\t| ClassDiscriminator.ShapeContainerNode\n\t| ClassDiscriminator.StarShapeNode\n\t| ClassDiscriminator.RectangleShapeNode\n\t| ClassDiscriminator.PolygonShapeNode\n\t| ClassDiscriminator.OvalShapeNode\n\t| ClassDiscriminator.PathNode\n\t| ClassDiscriminator.BooleanShapeNode\n\t| ClassDiscriminator.ShapeGroupNode\n\nfunction isSerializableClassDiscriminator(\n\tclassDiscriminator: ClassDiscriminator,\n): classDiscriminator is SerializableClassDiscriminator {\n\tswitch (classDiscriminator) {\n\t\tcase ClassDiscriminator.ShapeContainerNode:\n\t\tcase ClassDiscriminator.StarShapeNode:\n\t\tcase ClassDiscriminator.RectangleShapeNode:\n\t\tcase ClassDiscriminator.PolygonShapeNode:\n\t\tcase ClassDiscriminator.OvalShapeNode:\n\t\tcase ClassDiscriminator.PathNode:\n\t\tcase ClassDiscriminator.BooleanShapeNode:\n\t\tcase ClassDiscriminator.ShapeGroupNode: {\n\t\t\t// This check is there to make sure that all the cases in\n\t\t\t// SerializableClassDiscriminator are present in the above switch\n\t\t\tconst _: SerializableClassDiscriminator = classDiscriminator\n\t\t\treturn true\n\t\t}\n\t\tcase ClassDiscriminator.AbTestsEntityTypeRootNode:\n\t\tcase ClassDiscriminator.AgentPanelTool:\n\t\tcase ClassDiscriminator.AgentDragSelectTool:\n\t\tcase ClassDiscriminator.AgentSelectTool:\n\t\tcase ClassDiscriminator.AnalyticsScopeNode:\n\t\tcase ClassDiscriminator.BlockquoteEntityTypeRootNode:\n\t\tcase ClassDiscriminator.BlockquoteStylePresetNode:\n\t\tcase ClassDiscriminator.BoxShadow:\n\t\tcase ClassDiscriminator.BranchNode:\n\t\tcase ClassDiscriminator.BranchesNode:\n\t\tcase ClassDiscriminator.CMSEntityTypeRootNode:\n\t\tcase ClassDiscriminator.CanvasNode:\n\t\tcase ClassDiscriminator.CanvasPageNode:\n\t\tcase ClassDiscriminator.CanvasScopeNode:\n\t\tcase ClassDiscriminator.ChatTool:\n\t\tcase ClassDiscriminator.CodeComponentNode:\n\t\tcase ClassDiscriminator.CodeFileEntityTypeRootNode:\n\t\tcase ClassDiscriminator.CollectionReferenceVariableEditTool:\n\t\tcase ClassDiscriminator.ContentManagementEntityTypeRootNode:\n\t\tcase ClassDiscriminator.CollectionItemNode:\n\t\tcase ClassDiscriminator.CollectionNode:\n\t\tcase ClassDiscriminator.Color:\n\t\tcase ClassDiscriminator.ColorEntityTypeRootNode:\n\t\tcase ClassDiscriminator.ColorStyleTokenListNode:\n\t\tcase ClassDiscriminator.ColorStyleTokenNode:\n\t\tcase ClassDiscriminator.ComponentEntityTypeRootNode:\n\t\tcase ClassDiscriminator.ComponentPresetNode:\n\t\tcase ClassDiscriminator.ConicGradient:\n\t\tcase ClassDiscriminator.ContentManagementNode:\n\t\tcase ClassDiscriminator.CreateCodeComponentBaseTool:\n\t\tcase ClassDiscriminator.CreateFrameBaseTool:\n\t\tcase ClassDiscriminator.CreateShapeBaseTool:\n\t\tcase ClassDiscriminator.CreateTextTool:\n\t\tcase ClassDiscriminator.CustomCodeScopeNode:\n\t\tcase ClassDiscriminator.CustomCodeNode:\n\t\tcase ClassDiscriminator.DateVariableEditTool:\n\t\tcase ClassDiscriminator.DesignPageNode:\n\t\tcase ClassDiscriminator.EntityFolderNode:\n\t\tcase ClassDiscriminator.EntityReferenceNode:\n\t\tcase ClassDiscriminator.EntityRootNode:\n\t\tcase ClassDiscriminator.ErrorListNode:\n\t\tcase ClassDiscriminator.ErrorNode:\n\t\tcase ClassDiscriminator.ExportOptions:\n\t\tcase ClassDiscriminator.EnumVariableEditTool:\n\t\tcase ClassDiscriminator.ExternalModuleNode:\n\t\tcase ClassDiscriminator.ExternalModulesListNode:\n\t\tcase ClassDiscriminator.FeedbackTool:\n\t\tcase ClassDiscriminator.FormBooleanInputNode:\n\t\tcase ClassDiscriminator.FormPlainTextInputNode:\n\t\tcase ClassDiscriminator.FormSelectNode:\n\t\tcase ClassDiscriminator.FrameNode:\n\t\tcase ClassDiscriminator.FunnelNode:\n\t\tcase ClassDiscriminator.FunnelStepNode:\n\t\tcase ClassDiscriminator.FunnelsEntityTypeRootNode:\n\t\tcase ClassDiscriminator.GapTool:\n\t\tcase ClassDiscriminator.GradientColorStop:\n\t\tcase ClassDiscriminator.GradientToolManagerTool:\n\t\tcase ClassDiscriminator.GuideMoveTool:\n\t\tcase ClassDiscriminator.HeaderRouteNode:\n\t\tcase ClassDiscriminator.HighlightStackItemTool:\n\t\tcase ClassDiscriminator.HighlightTool:\n\t\tcase ClassDiscriminator.ImageStylePresetNode:\n\t\tcase ClassDiscriminator.InitialTool:\n\t\tcase ClassDiscriminator.InlineCodeEntityTypeRootNode:\n\t\tcase ClassDiscriminator.InlineCodeStylePresetNode:\n\t\tcase ClassDiscriminator.LayoutTemplateEntityTypeRootNode:\n\t\tcase ClassDiscriminator.LayoutTemplateNode:\n\t\tcase ClassDiscriminator.LineAnchorMoveTool:\n\t\tcase ClassDiscriminator.LinearGradient:\n\t\tcase ClassDiscriminator.LinkEntityTypeRootNode:\n\t\tcase ClassDiscriminator.LinkStylePresetNode:\n\t\tcase ClassDiscriminator.LinkTool:\n\t\tcase ClassDiscriminator.LoadingShieldTool:\n\t\tcase ClassDiscriminator.LocalizationGlossaryItemNode:\n\t\tcase ClassDiscriminator.LocalizationGlossaryNode:\n\t\tcase ClassDiscriminator.LocalModuleNode:\n\t\tcase ClassDiscriminator.LocalModulesListNode:\n\t\tcase ClassDiscriminator.MoveTool:\n\t\tcase ClassDiscriminator.MutableNode:\n\t\tcase ClassDiscriminator.OverlayNode:\n\t\tcase ClassDiscriminator.PaddingTool:\n\t\tcase ClassDiscriminator.PageLinkTool:\n\t\tcase ClassDiscriminator.PanTool:\n\t\tcase ClassDiscriminator.PathCurveBendTool:\n\t\tcase ClassDiscriminator.PathDefaultTool:\n\t\tcase ClassDiscriminator.PathSegment:\n\t\tcase ClassDiscriminator.PathSegmentAdditionTool:\n\t\tcase ClassDiscriminator.PathSegmentHandleMoveTool:\n\t\tcase ClassDiscriminator.PathSegmentMoveTool:\n\t\tcase ClassDiscriminator.PathSegmentSelectTool:\n\t\tcase ClassDiscriminator.PresetsListNode:\n\t\tcase ClassDiscriminator.PreviewSettings:\n\t\tcase ClassDiscriminator.ProxyRouteNode:\n\t\tcase ClassDiscriminator.RadialGradient:\n\t\tcase ClassDiscriminator.RadiusTool:\n\t\tcase ClassDiscriminator.RecoveryTool:\n\t\tcase ClassDiscriminator.RedirectRouteNode:\n\t\tcase ClassDiscriminator.ResizeTool:\n\t\tcase ClassDiscriminator.RichTextEditTool:\n\t\tcase ClassDiscriminator.RichTextVariableEditTool:\n\t\tcase ClassDiscriminator.RewriteRouteNode:\n\t\tcase ClassDiscriminator.RichTextNode:\n\t\tcase ClassDiscriminator.RootNode:\n\t\tcase ClassDiscriminator.RotateTool:\n\t\tcase ClassDiscriminator.RouteNode:\n\t\tcase ClassDiscriminator.RouteLocaleNode:\n\t\tcase ClassDiscriminator.RouteSegmentNode:\n\t\tcase ClassDiscriminator.RouteSegmentRootNode:\n\t\tcase ClassDiscriminator.RoutesNode:\n\t\tcase ClassDiscriminator.SVGNode:\n\t\tcase ClassDiscriminator.SampleColorTool:\n\t\tcase ClassDiscriminator.ScaleTool:\n\t\tcase ClassDiscriminator.ScopeNode:\n\t\tcase ClassDiscriminator.SelectTool:\n\t\tcase ClassDiscriminator.ShaderNode:\n\t\tcase ClassDiscriminator.Shadow:\n\t\tcase ClassDiscriminator.SlotConnectTool:\n\t\tcase ClassDiscriminator.SlotNode:\n\t\tcase ClassDiscriminator.SlotPropertyNode:\n\t\tcase ClassDiscriminator.SmartComponentNode:\n\t\tcase ClassDiscriminator.StringVariableEditTool:\n\t\tcase ClassDiscriminator.StyledTextDraft:\n\t\tcase ClassDiscriminator.TableStylePresetNode:\n\t\tcase ClassDiscriminator.TestTool:\n\t\tcase ClassDiscriminator.TextEditTool:\n\t\tcase ClassDiscriminator.TextEntityTypeRootNode:\n\t\tcase ClassDiscriminator.TextNode:\n\t\tcase ClassDiscriminator.TextStylePresetNode:\n\t\tcase ClassDiscriminator.FunnelStepActionNode:\n\t\tcase ClassDiscriminator.VectorSetEntityTypeRootNode:\n\t\tcase ClassDiscriminator.VectorSetNode:\n\t\tcase ClassDiscriminator.VekterGradientTool:\n\t\tcase ClassDiscriminator.VekterPathEngine:\n\t\tcase ClassDiscriminator.VekterTool:\n\t\tcase ClassDiscriminator.ViewportResizeTool:\n\t\tcase ClassDiscriminator.WebPageNode:\n\t\tcase ClassDiscriminator.ZoomSelectTool:\n\t\tcase ClassDiscriminator.ZoomTool: {\n\t\t\t// This check is there to make sure that all the cases in not\n\t\t\t// included in SerializableClassDiscriminator are present in the\n\t\t\t// above switch\n\t\t\tconst _: Exclude<ClassDiscriminator, SerializableClassDiscriminator> = classDiscriminator\n\t\t\treturn false\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(classDiscriminator)\n\t}\n}\n\nfunction svgTagNameForNode(node: (CanvasNode & IsVectorSetItem) | (CanvasNode & WithShape)): SVG.Tag {\n\tassert(isSerializableClassDiscriminator(node.__class), \"Node is not serializable to SVG\")\n\n\tswitch (node.__class) {\n\t\tcase ClassDiscriminator.ShapeContainerNode:\n\t\t\treturn \"svg\"\n\t\tcase ClassDiscriminator.StarShapeNode:\n\t\tcase ClassDiscriminator.RectangleShapeNode:\n\t\tcase ClassDiscriminator.PolygonShapeNode:\n\t\tcase ClassDiscriminator.OvalShapeNode:\n\t\tcase ClassDiscriminator.PathNode:\n\t\tcase ClassDiscriminator.BooleanShapeNode:\n\t\t\treturn \"path\"\n\t\tcase ClassDiscriminator.ShapeGroupNode:\n\t\t\treturn \"g\"\n\t\tdefault:\n\t\t\tassertNever(node.__class)\n\t}\n}\n\nfunction withSVGDefs(\n\tnode: (CanvasNode & IsVectorSetItem) | (CanvasNode & WithShape),\n\tctx: SVGContext,\n\tchildren: SafeJS,\n) {\n\tif (!isVectorSetItem(node) || ctx.defs.length === 0) return children\n\tconst xml = serializerForTarget(ctx.target)\n\treturn xml`${js.joinLines(svg(xml, \"defs\", undefined, xml`${js.joinLines(...ctx.defs)}`), children)}`\n}\n\nfunction xmlForNode(\n\tnode: (CanvasNode & IsVectorSetItem) | (CanvasNode & WithShape),\n\tctx: SVGContext,\n\tchildren: SafeJS,\n): SafeJS {\n\tconst xml = serializerForTarget(ctx.target)\n\n\tconst props: Record<string, string | number | undefined> = {\n\t\tid: !isVectorSetItem(node) ? node.id : undefined,\n\t\td: withShape(node)\n\t\t\t? // Round to 3 decimal places.\n\t\t\t\ttoSVGPath(node.calculatedPaths(), undefined, RenderTarget.export)\n\t\t\t: undefined,\n\t}\n\n\tif (isVectorSetItem(node)) {\n\t\t// <svg>s are inline-block elements that sit on the text baseline. Setting them to block\n\t\t// prevents browsers from reserving extra space for character descenders (e.g., the\n\t\t// tails on 'y' and 'g').\n\t\tprops.display = \"block\"\n\t\tprops.role = \"presentation\"\n\n\t\tconst frame = node.rect()\n\t\tprops.viewBox = `0 0 ${frame.width} ${frame.height}`\n\t\tprops.xmlns = \"http://www.w3.org/2000/svg\"\n\t}\n\n\t// Collect all props.\n\tcollectFill(node, props, ctx)\n\tcollectTransform(node, props)\n\tcollectVisibility(node, props)\n\n\tif (isVectorSetItem(node)) {\n\t\treturn svg(\n\t\t\txml,\n\t\t\tsvgTagNameForNode(node),\n\t\t\tprops,\n\t\t\t// Add all defs to the SVG.\n\t\t\twithSVGDefs(node, ctx, children),\n\t\t)\n\t}\n\n\t// Create all defs.\n\tconst tagWithShadows = withShadows(node, svgTagNameForNode(node), props, ctx)\n\n\tconst opacity = withOpacity(node)\n\t\t? isVariableReference(node.opacity)\n\t\t\t? ctx.cssVariableDefinitions.create(node, \"opacity\")\n\t\t\t: node.resolveValue(\"opacity\")\n\t\t: undefined\n\n\tif (isUndefined(opacity) || opacity === 1) {\n\t\treturn tagWithShadows(children)\n\t}\n\t// Apply opacity as a whole on a group around all shape elements. This makes sure any filters\n\t// (shadows) referencing the shape won't be impacted by the alpha channel of the input source.\n\treturn svg(\n\t\txml,\n\t\t\"g\",\n\t\t{\n\t\t\topacity,\n\t\t},\n\t\ttagWithShadows(children),\n\t)\n}\n\nfunction serializeNodeToSVG(node: (CanvasNode & WithShape) | (CanvasNode & IsVectorSetItem), ctx: SVGContext): SafeJS {\n\tconst xml = serializerForTarget(ctx.target)\n\n\t// Recursively call this function on the children for the node, creating a single XML string. It\n\t// could be JSX or SVG.\n\tlet children = \"\"\n\tfor (const child of childrenForNode(node)) {\n\t\tconst childJSX = serializeNodeToSVG(child, ctx)\n\t\tif (childJSX) children += serializeJS(xml.children(childJSX))\n\t}\n\n\treturn xmlForNode(node, ctx, xml.fromTrustedString(children))\n}\n\nfunction renderAsTemplate(ctx: SVGContext) {\n\treturn ctx.effectNodes.size === 0\n}\n\nfunction renderAsImg(ctx: SVGContext) {\n\tif (!renderAsTemplate(ctx)) return false\n\tif (ctx.variables.size > 0) return false\n\tif (ctx.colors.hasColorsOfType(\"token\")) return false\n\tif (ctx.colors.hasColorsOfType(\"wideGamut\")) return false\n\treturn true\n}\n\nfunction renderAsMask(ctx: SVGContext) {\n\tif (!renderAsTemplate(ctx)) return false\n\t// If we have more than 1 variable, we can't render as a mask.\n\tif (ctx.variables.size > 1) return false\n\t// If we have a variable and its not a color, we can't render as a mask.\n\tif (ctx.variables.size === 1 && !ctx.colors.hasColorsOfType(\"variable\")) return false\n\t// We can render as a mask, if we have a single color.\n\treturn ctx.colors.uniqueColorCount === 1\n}\n\nfunction renderType(ctx: SVGContext): RenderElement {\n\t// Determine how we can render based on the content of the SVG, falling back from most\n\t// optimized, to least optimized.\n\tif (renderAsImg(ctx)) return RenderElement.Img\n\tif (renderAsMask(ctx)) return RenderElement.Mask\n\tif (renderAsTemplate(ctx)) return RenderElement.Template\n\treturn RenderElement.Svg\n}\n\nfunction spreadRestProps(props: Record<string, SerializableValue | undefined>) {\n\tconst serializableProps = new SerializableObject(props)\n\tSerializableObject.addSpreadAtStart(serializableProps, Var.restProps)\n\treturn serializableProps\n}\n\nconst animated = new SafeJS(ANIMATED_PROP_NAME)\n\nconst tagForRenderElement = {\n\t[RenderElement.Img]: \"img\",\n\t[RenderElement.Mask]: \"div\",\n\t[RenderElement.Svg]: \"svg\",\n\t[RenderElement.Template]: \"svg\",\n} satisfies Record<RenderElement, string>\n\nfunction tagForType(ctx: SVGContext, type: RenderElement) {\n\tconst rest = js`props`\n\n\tconst spread = new SerializableObject()\n\tSerializableObject.addSpreadAtEnd(spread, rest)\n\n\tconst motion = ctx.imports.addImport(\"framer\", { exportSpecifier: \"motion\" })\n\n\tswitch (type) {\n\t\tcase RenderElement.Img:\n\t\tcase RenderElement.Mask: {\n\t\t\tconst tag = new SafeJS(tagForRenderElement[type])\n\t\t\tconst motionTag = js`${motion}.${tag}`\n\t\t\treturn ctx.declarations.file.dedupe(\n\t\t\t\t\"SVG\",\n\t\t\t\tSafeJS.fn(\n\t\t\t\t\tctx.imports.addImport(\"react\", { exportSpecifier: \"forwardRef\" }),\n\t\t\t\t\tjs`(props, ref) => {${js.joinLines(\n\t\t\t\t\t\t// Destructure out layoutId so that it's only applied when we are using a motion\n\t\t\t\t\t\t// element.\n\t\t\t\t\t\tjs`const { ${animated}, layoutId, children, ...rest } = props`,\n\t\t\t\t\t\tjs`return ${animated} ? <${motionTag} {...rest} layoutId={layoutId} ref={ref}/> : <${tag} {...rest} ref={ref}/>`,\n\t\t\t\t\t)}}`,\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\t\tcase RenderElement.Template:\n\t\tcase RenderElement.Svg: {\n\t\t\t// Create a custom motion component to give the SVG element the features of a motion\n\t\t\t// div. Otherwise motion.svg behaves differently, animating viewbox changes and ignoring\n\t\t\t// style and layout.\n\t\t\tconst Base = ctx.declarations.file.dedupe(\n\t\t\t\t\"Base\",\n\t\t\t\tSafeJS.fn(\n\t\t\t\t\tctx.imports.addImport(\"react\", { exportSpecifier: \"forwardRef\" }),\n\t\t\t\t\tjs`function(props, ref) { return (<svg {...props} ref={ref}>{props.children}</svg>) }`,\n\t\t\t\t),\n\t\t\t)\n\n\t\t\t// Create a component that only uses motion when the instance needs to animate.\n\t\t\tconst MotionSVG = ctx.declarations.file.dedupe(\"MotionSVG\", SafeJS.fn(js`${motion}.create`, Base))\n\t\t\treturn ctx.declarations.file.dedupe(\n\t\t\t\t\"SVG\",\n\t\t\t\tSafeJS.fn(\n\t\t\t\t\tctx.imports.addImport(\"react\", { exportSpecifier: \"forwardRef\" }),\n\t\t\t\t\tjs`(props, ref) => {${js.joinLines(\n\t\t\t\t\t\t// Destructure out layoutId so that it's only applied when we are using a motion\n\t\t\t\t\t\t// element.\n\t\t\t\t\t\tjs`const { ${animated}, layoutId, children, ...rest } = props`,\n\t\t\t\t\t\tjs`return ${animated} ? <${MotionSVG} {...rest} layoutId={layoutId} ref={ref}>{children}</${MotionSVG}> : <svg {...rest} ref={ref}>{children}</svg>`,\n\t\t\t\t\t)}}`,\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\n/** https://www.phpied.com/truth-encoding-svg-data-uris */\nfunction encodeSVG(string: string) {\n\treturn string.replaceAll(\"#\", \"%23\").replaceAll(\"\\n\", \"\")\n}\n\n// These variables are used to manage the stack of masks on vector instances. They are\n// code-generated into vectors and also in dependents that render the vectors. They cannot be\n// changed.\nexport const VECTOR_MASK_CUSTOM_PROPERTY = \"--framer-icon-mask\"\nexport const VECTOR_MASK_MODE_CUSTOM_PROPERTY = \"--framer-icon-mask-mode\"\n\nfunction styleForNode(\n\tctx: SVGContext & { type: RenderElement },\n\tnode: CanvasNode,\n\ticon: SafeJS,\n): SerializableMotionStyle {\n\tconst rect = ctx.tree.getRect(node)\n\tconst aspectRatio = rect.width / rect.height\n\tswitch (ctx.type) {\n\t\tcase RenderElement.Img: {\n\t\t\t// Since dependents of the Vector don't know if it's rendering as a mask, svg, or img,\n\t\t\t// we need to always respond to the custom property.\n\t\t\tconst mask = ctx.declarations.file.dedupe(\"mask\", `var(${VECTOR_MASK_CUSTOM_PROPERTY})`)\n\n\t\t\treturn {\n\t\t\t\twidth: rect.width,\n\t\t\t\taspectRatio,\n\t\t\t\t// <img>s are inline-block elements that sit on the text baseline. Setting them to\n\t\t\t\t// block prevents browsers from reserving extra space for character descenders\n\t\t\t\t// (e.g., the tails on 'y' and 'g'). This would otherwise cause the vector preview\n\t\t\t\t// to be scrollable even if the image size is correct.\n\t\t\t\tdisplay: \"block\",\n\t\t\t\tuserSelect: \"none\",\n\t\t\t\tmask: mask,\n\t\t\t\tWebkitMask: mask,\n\t\t\t}\n\t\t}\n\t\tcase RenderElement.Svg:\n\t\tcase RenderElement.Template: {\n\t\t\tconst mask = ctx.declarations.file.dedupe(\"mask\", `var(${VECTOR_MASK_CUSTOM_PROPERTY})`)\n\n\t\t\treturn {\n\t\t\t\tdisplay: \"block\",\n\t\t\t\twidth: rect.width,\n\t\t\t\taspectRatio,\n\t\t\t\tmask: mask,\n\t\t\t\tWebkitMask: mask,\n\t\t\t}\n\t\t}\n\t\tcase RenderElement.Mask: {\n\t\t\tconst mask = ctx.declarations.file.dedupe(\n\t\t\t\t\"mask\",\n\t\t\t\t// To support stacking masks on vector instances that happen to use a mask to render\n\t\t\t\t// the icon, we manage the stack explicitly.\n\t\t\t\tjst`url('data:image/svg+xml,${encodeSVG(serializeJS(icon))}') alpha no-repeat center / auto var(${VECTOR_MASK_MODE_CUSTOM_PROPERTY}, add), var(${VECTOR_MASK_CUSTOM_PROPERTY}, none)`,\n\t\t\t)\n\n\t\t\treturn {\n\t\t\t\tmask: mask,\n\t\t\t\tWebkitMask: mask,\n\t\t\t\tbackgroundColor:\n\t\t\t\t\tctx.colors.singleTokenColor ??\n\t\t\t\t\tctx.colors.singleWideGamutColor ??\n\t\t\t\t\t`var(${ctx.cssVariableDefinitions.singleVariableName})`,\n\t\t\t\twidth: rect.width,\n\t\t\t\taspectRatio,\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(ctx.type)\n\t}\n}\n\nfunction serializeNodeToJSX(\n\tnode: ShapeContainerNode & IsVectorSetItem,\n\tctx: SVGContext & { type: RenderElement },\n\ticon: SafeJS,\n\tserializationClassName: string,\n): SafeJS {\n\tconst className = SafeJS.fn(\n\t\tctx.imports.addImport(\"framer\", { exportSpecifier: \"cx\" }),\n\t\tctx.css.addRule(styleForNode(ctx, node, icon), serializationClassName),\n\t\tVar.className,\n\t)\n\n\tconst style = SerializableObject.fromEntries(ctx.cssVariableDefinitions.bindings.entries())\n\tSerializableObject.addSpreadAtEnd(style, Var.style)\n\n\tconst rect = ctx.tree.getRect(node)\n\n\tconst tag = tagForType(ctx, ctx.type)\n\tswitch (ctx.type) {\n\t\tcase RenderElement.Img:\n\t\t\treturn jsx.tag(\n\t\t\t\ttag,\n\t\t\t\tspreadRestProps({\n\t\t\t\t\tclassName,\n\t\t\t\t\tlayoutId: Var.layoutId,\n\t\t\t\t\tref: Var.ref,\n\t\t\t\t\tsrc: jst`data:image/svg+xml,${encodeSVG(serializeJS(icon))}`,\n\t\t\t\t\tstyle,\n\t\t\t\t\talt: \"\",\n\t\t\t\t}),\n\t\t\t)\n\t\tcase RenderElement.Mask:\n\t\t\treturn jsx.tag(\n\t\t\t\ttag,\n\t\t\t\tspreadRestProps({\n\t\t\t\t\tclassName,\n\t\t\t\t\tlayoutId: Var.layoutId,\n\t\t\t\t\tref: Var.ref,\n\t\t\t\t\tstyle,\n\t\t\t\t}),\n\t\t\t)\n\t\tcase RenderElement.Template: {\n\t\t\tconst content = ctx.declarations.file.dedupe(\"svg\", serializeJS(icon))\n\t\t\tconst useSVGTemplate = ctx.imports.addImport(\"framer\", { exportSpecifier: \"useSVGTemplate\" })\n\t\t\tconst revision = node.moduleSourceRevision\n\t\t\tassert(isNumber(revision), \"Vector Set Item should have a revision\")\n\n\t\t\tconst href = ctx.declarations.component.dedupe(\"href\", SafeJS.fn(useSVGTemplate, revision.toString(), content))\n\t\t\treturn jsx.tag(\n\t\t\t\ttag,\n\t\t\t\tspreadRestProps({\n\t\t\t\t\tviewBox: `0 0 ${rect.width} ${rect.height}`,\n\t\t\t\t\tclassName,\n\t\t\t\t\tlayoutId: Var.layoutId,\n\t\t\t\t\tref: Var.ref,\n\t\t\t\t\tstyle,\n\t\t\t\t\trole: \"presentation\",\n\t\t\t\t}),\n\t\t\t\tjsx`<use href={${href}} />`,\n\t\t\t)\n\t\t}\n\t\tcase RenderElement.Svg: {\n\t\t\t// Recursively call this function on the children for the node, creating a single JSX string.\n\t\t\tlet children = \"\"\n\t\t\tfor (const child of childrenForNode(node)) {\n\t\t\t\tconst childJSX = serializeNodeToSVG(child, ctx)\n\t\t\t\tif (childJSX) children += serializeJS(jsx.children(childJSX))\n\t\t\t}\n\n\t\t\treturn jsx.tag(\n\t\t\t\ttag,\n\t\t\t\tspreadRestProps({\n\t\t\t\t\tclassName,\n\t\t\t\t\tviewBox: `0 0 ${rect.width} ${rect.height}`,\n\t\t\t\t\tlayoutId: Var.layoutId,\n\t\t\t\t\tref: Var.ref,\n\t\t\t\t\tstyle,\n\t\t\t\t\trole: \"presentation\",\n\t\t\t\t}),\n\t\t\t\twithSVGDefs(node, ctx, jsx.fromTrustedString(children)),\n\t\t\t)\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(ctx.type)\n\t}\n}\n\n/**\n * Serialize a node and its subtree to a SafeJS jsx string, tracking all dependencies and metadata\n * required.\n */\nexport function svgForNode(\n\tsourceNode: ShapeContainerNode & IsVectorSetItem,\n\tscopeNode: Loaded<VectorSetNode>,\n\tdeps: JSXEngineDependencies,\n\tserializationClassName: string,\n\treserved: string[],\n) {\n\tconst ctx = createSVGTagContext(scopeNode, sourceNode, deps, \"svg\", reserved)\n\tconst icon = serializeNodeToSVG(sourceNode, ctx)\n\tconst type = renderType(ctx)\n\n\treturn {\n\t\tctx,\n\t\ttype,\n\t\tsvg: icon,\n\t\tjsx: serializeNodeToJSX(\n\t\t\tsourceNode,\n\t\t\t// Reset defs to collect them again as JSX, reusing the same context.\n\t\t\t{ ...ctx, defs: [], target: \"jsx\", type },\n\t\t\ticon,\n\t\t\tserializationClassName,\n\t\t),\n\t} as const\n}\n", "import { createAbsoluteImageAssetURL, parseAssetReference } from \"@framerjs/assets\"\nimport { assertNever } from \"@framerjs/shared\"\nimport { VECTOR_MASK_CUSTOM_PROPERTY, VECTOR_MASK_MODE_CUSTOM_PROPERTY } from \"code-generation/jsx/svg/svgForNode.ts\"\nimport type { CollectorContext } from \"code-generation/utils/collector.ts\"\nimport { styleCollector } from \"code-generation/utils/collector.ts\"\nimport { isArray, isNumber, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { isVectorInstance } from \"../../nodes/utils/nodeCheck.ts\"\nimport { withIntrinsicSize } from \"../WithIntrinsicSize.ts\"\nimport type { MaskComposite, MaskMode, MaskPosition, MaskRepeat, MaskSize } from \"../WithMasks.ts\"\nimport { withMasks } from \"../WithMasks.ts\"\n\nexport const collectMasks = styleCollector((node, style, context) => {\n\tif (!withMasks(node)) return\n\n\t// We set the mask property to undefined because otherwise the generated CSS will\n\t// result in an empty string which is not valid CSS. This is specifically needed\n\t// for variants that have override on masks that removes the mask.\n\tif ((isArray(node.masks) && node.masks.length === 0) || isUndefined(node.masks)) {\n\t\tif (isVectorInstance(node)) {\n\t\t\tstyle[VECTOR_MASK_CUSTOM_PROPERTY] = style[VECTOR_MASK_MODE_CUSTOM_PROPERTY] = undefined\n\t\t} else {\n\t\t\tstyle.mask = style.WebkitMask = undefined\n\t\t}\n\t\treturn\n\t}\n\n\tconst masks: string[] = []\n\tfor (const mask of node.masks) {\n\t\tconst {\n\t\t\tmaskType,\n\t\t\tmaskLinearGradient,\n\t\t\tmaskRadialGradient,\n\t\t\tmaskConicGradient,\n\t\t\tmaskImage,\n\t\t\tmaskImageResize,\n\t\t\tmaskMode,\n\t\t\tmaskRepeat,\n\t\t\tmaskPosition,\n\t\t\tmaskComposite,\n\t\t} = mask\n\n\t\tswitch (maskType) {\n\t\t\tcase \"linear-gradient\": {\n\t\t\t\tconst maskCSS = maskLinearGradient.toCSS()\n\t\t\t\tmasks.push(`${maskCSS} ${maskComposite}`)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"radial-gradient\": {\n\t\t\t\tconst maskCSS = maskRadialGradient.toCSS()\n\t\t\t\tmasks.push(`${maskCSS} ${maskComposite}`)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"conic-gradient\": {\n\t\t\t\tconst maskCSS = maskConicGradient.toCSS()\n\t\t\t\tmasks.push(`${maskCSS} ${maskComposite}`)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"image\": {\n\t\t\t\tif (!isString(maskImage)) return\n\t\t\t\tconst resolvedMaskAsset = resolveAssetReferenceForMask(maskImage, context)\n\t\t\t\tif (!resolvedMaskAsset) break\n\t\t\t\tif (\n\t\t\t\t\tisUndefined(maskMode) ||\n\t\t\t\t\tisUndefined(maskRepeat) ||\n\t\t\t\t\tisUndefined(maskPosition) ||\n\t\t\t\t\tisUndefined(maskImageResize) ||\n\t\t\t\t\tisUndefined(maskComposite)\n\t\t\t\t) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tconst imageMask = maskImagePropsToCSS(\n\t\t\t\t\tmaskImageAssetURLToCSS(resolvedMaskAsset),\n\t\t\t\t\tmaskMode,\n\t\t\t\t\tmaskRepeat,\n\t\t\t\t\tmaskPosition,\n\t\t\t\t\tmaskSizeToCSS(node, maskImageResize),\n\t\t\t\t\tmaskComposite,\n\t\t\t\t)\n\n\t\t\t\tmasks.push(imageMask)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tassertNever(maskType, \"Unsupported or missing mask type for node.\")\n\t\t}\n\t}\n\n\t// Vectors can use a mask to render the icon. As a result, adding additional masks to a vector\n\t// instance means we have to stack them specifically. To do this we use a custom property that\n\t// Vectors append to their mask. We must also change the mask mode of the vector to intersect to\n\t// get the expected result.\n\tif (isVectorInstance(node)) {\n\t\tstyle[VECTOR_MASK_CUSTOM_PROPERTY] = masks.join(\", \")\n\t\tstyle[VECTOR_MASK_MODE_CUSTOM_PROPERTY] = \"intersect\" satisfies MaskComposite\n\t} else {\n\t\tstyle.mask = style.WebkitMask = masks.join(\", \")\n\t}\n})\n\nfunction resolveAssetReferenceForMask(maskImage: string, context: CollectorContext | undefined): string | undefined {\n\tconst assetsCollector = context?.assets\n\tif (!assetsCollector) {\n\t\tconst parsedReference = parseAssetReference(maskImage)\n\t\tif (!parsedReference) return\n\t\treturn createAbsoluteImageAssetURL(parsedReference.identifier)\n\t}\n\treturn assetsCollector.resolveResponsiveImage(maskImage)?.src\n}\n\ntype MaskImageSourceCSS = `url('${string}')`\ntype MaskImageSizeCSS = \"cover\" | \"contain\" | \"auto\" | `${number}px ${number}px`\ntype MaskImageShorthandCSS =\n\t`${MaskImageSourceCSS} ${MaskMode} ${MaskRepeat} ${MaskPosition} / ${MaskImageSizeCSS} ${MaskComposite}`\n\nfunction maskImageAssetURLToCSS(value: string): MaskImageSourceCSS {\n\treturn `url('${value}')`\n}\n\nfunction maskSizeToCSS(node: CanvasNode, maskSize: MaskSize): MaskImageSizeCSS {\n\tif (maskSize === \"contain\" || maskSize === \"cover\") return maskSize\n\n\t// Mask size is a percentage. We need to calculate the size of the image in pixels based on the intrinsic size of the image.\n\tlet intrinsicWidth: number | undefined\n\tlet intrinsicHeight: number | undefined\n\tif (withIntrinsicSize(node)) {\n\t\tif (isNumber(node.intrinsicWidth)) intrinsicWidth = node.intrinsicWidth / 2\n\t\tif (isNumber(node.intrinsicHeight)) intrinsicHeight = node.intrinsicHeight / 2\n\t}\n\n\tif (isUndefined(intrinsicWidth) || isUndefined(intrinsicHeight)) return \"auto\"\n\n\tconst widthInPx = intrinsicWidth * (maskSize / 100)\n\tconst heightInPx = intrinsicHeight * (maskSize / 100)\n\n\treturn `${widthInPx}px ${heightInPx}px`\n}\n\nfunction maskImagePropsToCSS(\n\timageSource: MaskImageSourceCSS,\n\tmode: MaskMode,\n\trepeat: MaskRepeat,\n\tposition: MaskPosition,\n\tsize: MaskImageSizeCSS,\n\tcomposite: MaskComposite,\n): MaskImageShorthandCSS {\n\treturn `${imageSource} ${mode} ${repeat} ${position} / ${size} ${composite}`\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { hasFloatingPosition } from \"../WithFloatingPosition.ts\"\nimport { withPositionType } from \"../WithPositionType.ts\"\nimport type { UnknownProps } from \"../utils/UnknownProps.ts\"\nimport { canBePositionAbsolute, canBePositionFixed, canBePositionSticky } from \"../utils/positionTypeHelpers.ts\"\n\nexport function collectPositionType(node: CanvasNode, props: UnknownProps): void {\n\tif (!withPositionType(node)) return\n\n\tif (isUndefined(node.position) || hasFloatingPosition(node)) return\n\tif (node.__unsafeIsSlotPropertyChildNode()) return\n\n\tswitch (node.position) {\n\t\tcase \"sticky\":\n\t\t\tif (!canBePositionSticky(node)) return\n\t\t\tprops.positionSticky = true\n\t\t\tprops.positionStickyTop = node.positionStickyTop\n\t\t\tprops.positionStickyRight = node.positionStickyRight\n\t\t\tprops.positionStickyBottom = node.positionStickyBottom\n\t\t\tprops.positionStickyLeft = node.positionStickyLeft\n\t\t\tbreak\n\t\tcase \"fixed\": {\n\t\t\tconst tree = node.tree()\n\t\t\tif (!tree || !canBePositionFixed(tree, node)) return\n\t\t\tprops.positionFixed = true\n\t\t\tbreak\n\t\t}\n\t\tcase \"absolute\":\n\t\t\tif (!canBePositionAbsolute(node)) return\n\t\t\tprops.positionAbsolute = true\n\t\t\tbreak\n\t\tdefault:\n\t\t\tassertNever(node.position)\n\t}\n}\n", "import type { AnnotationKey } from \"@framerjs/framer-runtime/crossorigin\"\nimport { getLogger } from \"@framerjs/shared\"\nimport { isBoolean, isNumber, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { SafeJS } from \"./serializeJS.ts\"\n\nconst logger = getLogger(\"jsdoc\")\n\nexport type InputAnnotations = Partial<Record<AnnotationKey, boolean | number | string>>\n\nexport function jsdoc(message: string, annotations: InputAnnotations = {}): SafeJS {\n\tlet rawJS = \"/**\"\n\tif (message) {\n\t\trawJS += `\\n * ${message}`\n\t}\n\tfor (const key in annotations) {\n\t\tconst value = annotations[key as AnnotationKey]\n\t\tif (isUndefined(value)) continue\n\t\tif (!validateAnnotation(key, value)) continue\n\n\t\trawJS += `\\n * @${key}`\n\t\tif (isString(value)) {\n\t\t\tconst trimmedValue = value.trim()\n\t\t\tif (trimmedValue) {\n\t\t\t\trawJS += ` ${trimmedValue}`\n\t\t\t}\n\t\t} else if (isBoolean(value) || isNumber(value)) {\n\t\t\trawJS += ` ${value}`\n\t\t}\n\t}\n\n\treturn new SafeJS(rawJS + \"\\n */\")\n}\n\nfunction validateAnnotation(key: string, value: InputAnnotations[AnnotationKey]) {\n\tif (isBoolean(value) || isNumber(value)) return true\n\t// https://github.com/framer/company/issues/35436\n\tif (isString(value) && value.trim() !== \"\") return true\n\n\tlogger.reportError(\n\t\tnew Error(\n\t\t\t`Annotation ${key} must be a boolean, number, or non-empty string, but found \"${value}\" it will be omitted from the generated code. Use undefined if intentional.`,\n\t\t),\n\t)\n\treturn false\n}\n", "import { js, jst } from \"code-generation/js/js.ts\"\nimport type { InputAnnotations } from \"code-generation/js/jsdoc.ts\"\nimport { jsdoc } from \"code-generation/js/jsdoc.ts\"\nimport { SafeJS } from \"code-generation/js/serializeJS.ts\"\nimport type { CollectedVariantCSS } from \"code-generation/utils/CSSCollector.ts\"\nimport type { ImportCollector } from \"code-generation/utils/ImportCollector.ts\"\nimport { join } from \"utils/join.ts\"\n\n/**\n * When the browser client supports aspect ratio, this css property is set to\n * \"auto\". This effectively unsets width, height, or bottom (depending on the\n * setup), meaning that the css aspect ratio property can work in conjunction\n * with *other* layout properties to dynamically set the size of the element.\n * When this property is *not* set, width, height or bottom use their individual\n * css variable fallback values, which are always set to the on canvas pixel\n * values. This means that elements that use aspect ratio will always have a\n * width and height if aspect ratio is not supported, ensuring that elements do\n * not collapse to 0px.\n */\nexport const aspectRatioSupportedCSSVariable = \"--framer-aspect-ratio-supported\"\nexport const aspectRatioEnhancementRules = `@supports (aspect-ratio: 1) { body { ${aspectRatioSupportedCSSVariable}: auto; } }`\n\ntype Selector = string | SafeJS\ntype Declaration = string\n/**\n * A map of a css declaration string (e.g. 'width: 1px; display: flex;'), to a\n * list of selectors that share that declaration, (e.g. ['.framer-1 .framer-2',\n * '.framer-1 .framer-3']).\n */\ntype SharedCSSRules = Map<Declaration, Selector[]>\n\n/**\n * Iterate through the rules collected in a CSSCollector, and organize them into\n * a SharedCSSRules Map, so that many selectors can share a declaration.\n * Additionally prefix the selector with the serialization id based on the\n * collector type.\n *\n * @TODO - Consider moving this into CSSCollector.get().\n */\nexport function addCSSCollectorRulesToTarget(variantCSS: CollectedVariantCSS, target: SharedCSSRules): void {\n\tfor (const [selector, declaration] of variantCSS.rules) {\n\t\tconst existing = target.get(declaration)\n\t\tif (existing) {\n\t\t\texisting.push(selector)\n\t\t} else {\n\t\t\ttarget.set(declaration, [selector])\n\t\t}\n\t}\n}\n\n/**\n * Transform SharedCSSRules into an array of css rule strings, including the\n * default rules.\n */\nexport function convertSharedRulesToCSS(sharedRules: SharedCSSRules): (string | SafeJS)[] {\n\tconst css: (string | SafeJS)[] = []\n\n\tfor (const [declaration, selectors] of sharedRules) {\n\t\tcss.push(jst`${jst.join(selectors, \", \")} { ${declaration} }`)\n\t}\n\treturn css\n}\n\nexport function defaultExportWithAnnotationsAndCSS(\n\tname: SafeJS,\n\tserializationId: string,\n\tcomponentBinding: SafeJS,\n\tcssBinding: SafeJS,\n\tannotations: InputAnnotations,\n\timports: ImportCollector,\n) {\n\treturn join.lines(\n\t\tjsdoc(\"This is a generated Framer component.\", annotations),\n\t\tjs`const ${name}: React.ComponentType<Props> = ${SafeJS.fn(\n\t\t\timports.addImport(\"framer\", { exportSpecifier: \"withCSS\" }),\n\t\t\tcomponentBinding,\n\t\t\tcssBinding,\n\t\t\tserializationId,\n\t\t)} as typeof ${componentBinding};`,\n\t\tjs`export default ${name};`,\n\t)\n}\n", "import { aspectRatioSupportedCSSVariable } from \"code-generation/components/shared.ts\"\nimport { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport type { SerializableMotionStyle } from \"code-generation/types.ts\"\nimport { type CollectorContext, styleCollector } from \"code-generation/utils/collector.ts\"\nimport type { UnknownProps } from \"library/modules/GeneratedComponentContext.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport type { WithAspectRatio } from \"../WithAspectRatio.ts\"\nimport { withAspectRatio } from \"../WithAspectRatio.ts\"\nimport type { WithPins } from \"../WithPins.ts\"\nimport { isPinnable } from \"../WithPins.ts\"\nimport { sizeValueToCSSValue } from \"../utils/cssValues.ts\"\nimport { hasLockedAspectRatio } from \"../utils/layoutSupportsAspectRatio.ts\"\n\n/**\n * If a node has aspect ratio, we need to ensure that the aspect ratio is\n * respected by browsers. This means that it can only have a defined size on one\n * axis, allowing the browser to use the ratio to define the size of the\n * opposing axis.\n *\n * We prioritize axes that are relative to their parent to be preserved, and\n * prefer to preserve relative widths. So if the width is relative, the height\n * will be auto, and have its value computed by the browser based on the width\n * and ratio.\n */\nexport function autoAxisForAspectRatio(node: CanvasNode & WithAspectRatio & WithPins): \"width\" | \"height\" {\n\tconst constraints = isPinnable(node) ? node.constraints() : undefined\n\tif (\n\t\t(node.widthType !== DimensionType.FixedNumber && node.widthType !== DimensionType.Auto) ||\n\t\tnode.heightType === DimensionType.Auto ||\n\t\t(constraints?.left && isNumber(node.left) && constraints.right && isNumber(node.right))\n\t) {\n\t\treturn \"height\"\n\t} else if (\n\t\tnode.heightType !== DimensionType.FixedNumber ||\n\t\tnode.widthType === DimensionType.Auto ||\n\t\t(constraints?.top && isNumber(node.top) && constraints.bottom && isNumber(node.bottom))\n\t) {\n\t\treturn \"width\"\n\t} else {\n\t\t// If both axes are fixed numbers, always use height as the auto axis.\n\t\treturn \"height\"\n\t}\n}\n\nexport const collectAspectRatio = styleCollector((node, style, ctx) => {\n\tif (!withAspectRatio(node)) return\n\n\tif (!hasLockedAspectRatio(node)) {\n\t\tstyle.aspectRatio = undefined\n\t\treturn\n\t}\n\n\t// The typing of aspect ratio is weird because the syntax is designed for\n\t// fractions e.g. 16/9, but the property **also** accepts a single decimal\n\t// value. If a decimal value is provided, browsers automatically turn it\n\t// into a fraction by adding a denominator of 1. To work around those typing\n\t// issues, we manually set the automatic denominator.\n\tstyle.aspectRatio = isNumber(node.aspectRatio) ? `${node.aspectRatio} / 1` : undefined\n\n\tif (!isPinnable(node)) return\n\n\t// Set the auto axis to ensure that the browser uses aspect ratio to\n\t// calculate the secondary dimension. If style has already been set for the\n\t// opposing coordinates in collectLayout.ts, ensure the opposing sizes can\n\t// be unset if the browser supports the css aspect-ratio property. If the\n\t// css variable is defined, the value will be \"auto\". If the css variable is\n\t// never defined because the browser does not support css aspect-ratio, the\n\t// px value fallback will be used.\n\n\tif (!isJSXContext(ctx)) return\n\n\t// If a node has aspect ratio, we always used the measured rect. Therefore, we don't need the parentSize to\n\t// calculate the size or position.\n\tconst { height, width } = node.rect()\n\tif (autoAxisForAspectRatio(node) === \"height\") {\n\t\t// This should only be the case if the width is a relative dimension, or\n\t\t// if the node is pinned on all 4 sides.\n\t\tif (isNumber(node.top) && isNumber(node.bottom) && !node.cache.parentDirected) {\n\t\t\tstyle.bottom = `var(${aspectRatioSupportedCSSVariable}, ${sizeValueToCSSValue(node.bottom)})`\n\t\t} else if (isNumber(height)) {\n\t\t\tstyle.height = `var(${aspectRatioSupportedCSSVariable}, ${sizeValueToCSSValue(height)})`\n\t\t}\n\t} else {\n\t\tif (isNumber(width)) {\n\t\t\tstyle.width = `var(${aspectRatioSupportedCSSVariable}, ${sizeValueToCSSValue(width)})`\n\t\t}\n\t\t// We don't need to unset \"style.right\" here because since we prioritize\n\t\t// relative widths, we will never use width as the auto axis if left and\n\t\t// right are pinned.\n\t}\n})\n\n/**\n * If we are setting aspect ratio on a node on the canvas, we need to unset one\n * of it's dimensions so that the aspect ratio can be applied, following the\n * same priority as code generation above.\n */\nfunction preserveAspectRatio(node: CanvasNode, props: UnknownProps) {\n\tif (!withAspectRatio(node) || !isPinnable(node) || !hasLockedAspectRatio(node)) {\n\t\treturn\n\t}\n\n\tif (autoAxisForAspectRatio(node) === \"height\") {\n\t\tprops.height = \"auto\"\n\t\tprops.heightType = DimensionType.Auto\n\t\t// This should only be the case if the width is a relative dimension, or\n\t\t// if the node is pinned on all 4 sides.\n\t\tif (isNumber(node.top) && isNumber(node.bottom)) props.bottom = undefined\n\t} else {\n\t\tprops.width = \"auto\"\n\t\tprops.widthType = DimensionType.Auto\n\t\t// We don't need to unset \"props.right\" here because since we prioritize\n\t\t// relative widths, we will never use width as the auto axis if left and\n\t\t// right are pinned.\n\t}\n}\n\nexport function collectAspectRatioProps(\n\tnode: CanvasNode,\n\tprops: UnknownProps & { style: SerializableMotionStyle },\n\tcontext: CollectorContext,\n) {\n\tcollectAspectRatio(node, props.style, context)\n\t// Aspect ratio is set as a css prop on style. To ensure the browser can\n\t// apply it, set width or height to \"auto\".\n\tpreserveAspectRatio(node, props)\n}\n", "import { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport { styleCollector } from \"code-generation/utils/collector.ts\"\nimport { isBlendingModeValue, withBlending } from \"document/models/CanvasTree/traits/WithBlending.ts\"\nimport { isDynamicValue } from \"../DynamicValue.ts\"\n\nexport const collectBlending = styleCollector((node, style, context) => {\n\tif (!withBlending(node)) return\n\n\tif (isDynamicValue(node.blendingMode) && isJSXContext(context)) {\n\t\tstyle.mixBlendMode = context.cssVariableDefinitions.create(node, \"blendingMode\")\n\t\treturn\n\t}\n\n\tstyle.mixBlendMode =\n\t\tisBlendingModeValue(node.blendingMode) && node.blendingMode !== \"normal\"\n\t\t\t? node.resolveValue(\"blendingMode\", context.variableOverrides)\n\t\t\t: undefined\n})\n", "import { assertNever } from \"@framerjs/shared\"\nimport { styleCollector } from \"code-generation/utils/collector.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { isOverlayNode } from \"../../nodes/utils/nodeCheck.ts\"\nimport { hasFloatingPosition } from \"../WithFloatingPosition.ts\"\nimport { withLayout } from \"../WithLayout.ts\"\nimport { positionTypeDefaults, withPositionType } from \"../WithPositionType.ts\"\nimport { canBePositionAbsolute, canBePositionFixed, canBePositionSticky } from \"../utils/positionTypeHelpers.ts\"\nimport { CANVAS_FIXED_POSITION_PROPERTY } from \"../utils/viewportHelpers.ts\"\n\nfunction getDefaultNodePosition(node: CanvasNode, parent?: CanvasNode): \"relative\" | \"absolute\" | \"fixed\" {\n\tif (node.cache.overlayAncestorId) {\n\t\tconst overlayDescendantParent = parent ?? node.tree()?.getParent(node.id)\n\t\tif (overlayDescendantParent && isOverlayNode(overlayDescendantParent)) return \"fixed\"\n\t}\n\n\tconst parentLayout = parent && withLayout(parent) ? parent.layout : node.cache.parentDirected\n\tswitch (parentLayout) {\n\t\tcase \"stack\":\n\t\tcase \"grid\":\n\t\t\treturn \"relative\"\n\t\tdefault:\n\t\t\treturn \"absolute\"\n\t}\n}\n\nexport const collectPosition = styleCollector((node, style, ctx) => {\n\tif (!withPositionType(node)) return\n\tif (hasFloatingPosition(node)) {\n\t\tstyle.position = \"relative\"\n\t\treturn\n\t}\n\tif (node.__unsafeIsSlotPropertyChildNode(ctx.tree)) {\n\t\tstyle.position = \"relative\"\n\t\treturn\n\t}\n\n\tconst position = node.position\n\n\tif (isUndefined(position) || position === positionTypeDefaults.position) {\n\t\tstyle.position = getDefaultNodePosition(node)\n\t\treturn\n\t}\n\n\tswitch (position) {\n\t\tcase \"sticky\":\n\t\t\tif (!canBePositionSticky(node)) return\n\n\t\t\tstyle.position = \"sticky\"\n\t\t\tstyle.willChange = \"transform\"\n\n\t\t\tif (isNumber(node.positionStickyTop)) style.top = node.positionStickyTop\n\t\t\tif (isNumber(node.positionStickyRight)) style.right = node.positionStickyRight\n\t\t\tif (isNumber(node.positionStickyBottom)) style.bottom = node.positionStickyBottom\n\t\t\tif (isNumber(node.positionStickyLeft)) style.left = node.positionStickyLeft\n\n\t\t\tbreak\n\t\tcase \"fixed\": {\n\t\t\tconst tree = node.tree()\n\t\t\tif (!tree || !canBePositionFixed(tree, node)) return\n\n\t\t\tstyle.position =\n\t\t\t\tctx.scopeType === ScopeType.LayoutTemplate ? `var(${CANVAS_FIXED_POSITION_PROPERTY}, fixed)` : \"fixed\"\n\n\t\t\tbreak\n\t\t}\n\t\tcase \"absolute\":\n\t\t\tif (!canBePositionAbsolute(node)) return\n\n\t\t\tstyle.position = \"absolute\"\n\n\t\t\tbreak\n\t\tdefault:\n\t\t\tassertNever(position)\n\t}\n})\n", "import type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport type { WithStyleAppearEffect } from \"../WithStyleAppearEffect.ts\"\n\n/**\n * Returns the stagger value for a node.\n * @param node - The node with an appear effect to get the stagger value for.\n * @returns The stagger value as a number.\n */\nexport function getStaggerValueForNode(node: CanvasNode & WithStyleAppearEffect): number {\n\treturn node.enterEffectTransition?.stagger ?? node.styleAppearEffectTransition?.stagger ?? 0\n}\n", "import { js } from \"code-generation/js/js.ts\"\nimport { SafeJS } from \"code-generation/js/serializeJS.ts\"\nimport type { JSXContext } from \"code-generation/jsx/types.ts\"\nimport { getAncestorRepeaterIds } from \"code-generation/utils/elementIdPatternForNode.ts\"\nimport { getOriginalRepeatedItemOfDataRepeater } from \"utils/repeaterUtils.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport type { CanvasTree } from \"../../CanvasTree.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { hasPaginationEnabled } from \"../WithCollectionOptions.ts\"\nimport { withStyleAppearPageEffect } from \"../WithStyleAppearEffect.ts\"\nimport { getStaggerValueForNode } from \"./getStaggerValueForNode.ts\"\n\nexport const cumulativeStaggerFunctionName = \"cumulativeStagger\"\n\n/**\n * Calculates the cumulative stagger delay for a node.\n * This is used to calculate stagger delays for repeaters nested within other repeaters,\n * in order to correctly offset the staggered animations relative to the parent's stagger value.\n *\n * @param node - The node to calculate the cumulative stagger delay for.\n * @param context - The JSXContext to use to calculate the cumulative stagger delay.\n * @returns The cumulative stagger delay as a SafeJS object or zero if no stagger is found.\n */\nexport function calculateCumulativeStaggerDelay(node: CanvasNode, context: JSXContext): SafeJS | null {\n\tif (!withStyleAppearPageEffect(node)) return null\n\n\tconst ancestorRepeaterIds = getAncestorRepeaterIds(node, context.tree)\n\tif (ancestorRepeaterIds.length === 0) return null\n\n\t// Calculate stagger delay for one or more nested repeaters\n\tconst staggerValue = getStaggerValueForNode(node)\n\tif (staggerValue === 0) return null\n\n\tconst staggerCalculations: SafeJS[] = []\n\n\tfor (let i = 0; i < ancestorRepeaterIds.length; i++) {\n\t\tconst repeaterId = ancestorRepeaterIds[i]\n\t\tconst repeater = context.tree.get(repeaterId)\n\t\tif (!repeater) continue\n\n\t\tconst bindingIndex = context.bindings.createWithNode(\"index\", repeater)\n\t\tconst indexExpression = paginationAwareIndexExpression(repeater, bindingIndex)\n\n\t\t// For the innermost repeater (current node's direct parent), use the node's stagger value\n\t\tif (i === ancestorRepeaterIds.length - 1) {\n\t\t\tstaggerCalculations.push(js`${indexExpression} * ${staggerValue}`)\n\t\t} else {\n\t\t\t// For outer repeaters, check if they have their own stagger effects\n\t\t\tconst parentStaggerValue = getParentStaggerValue(repeater, context.tree)\n\t\t\tif (parentStaggerValue > 0) {\n\t\t\t\tstaggerCalculations.push(js`${indexExpression} * ${parentStaggerValue}`)\n\t\t\t}\n\t\t}\n\t}\n\n\tif (staggerCalculations.length === 0) return null\n\tif (staggerCalculations.length === 1) {\n\t\tconst firstCalculation = staggerCalculations[0]\n\t\treturn firstCalculation ?? null\n\t}\n\n\treturn SafeJS.fn(\n\t\tcontext.declarations.file.dedupe(\n\t\t\tcumulativeStaggerFunctionName,\n\t\t\tjs`(...delays) => delays.reduce((sum, delay) => sum + delay, 0)`,\n\t\t),\n\t\t...staggerCalculations,\n\t)\n}\n\n/**\n * Returns an index expression that respects collection pagination. When pagination is enabled we\n * stagger **per page** so the delay resets on each new page.\n */\nfunction paginationAwareIndexExpression(repeater: CanvasNode, bindingIndex: SafeJS): SafeJS {\n\tif (!hasPaginationEnabled(repeater)) return bindingIndex\n\tconst pageSize = repeater.collectionPaginationPageSize\n\tif (isNumber(pageSize) && pageSize > 0) {\n\t\treturn js`(${bindingIndex} % ${pageSize})`\n\t}\n\treturn bindingIndex\n}\n\nfunction getParentStaggerValue(repeater: CanvasNode, tree: CanvasTree): number {\n\tconst repeatedItem = getOriginalRepeatedItemOfDataRepeater(tree, repeater)\n\tif (!repeatedItem || !withStyleAppearPageEffect(repeatedItem)) return 0\n\treturn getStaggerValueForNode(repeatedItem)\n}\n", "import { js } from \"code-generation/js/js.ts\"\nimport { SafeJS, isSafeJS } from \"code-generation/js/serializeJS.ts\"\nimport type { JSXContext } from \"code-generation/jsx/types.ts\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport type { WithStyleAppearEffect } from \"../WithStyleAppearEffect.ts\"\nimport { calculateCumulativeStaggerDelay } from \"./calculateCumulativeStaggerDelay.ts\"\nimport { getStaggerValueForNode } from \"./getStaggerValueForNode.ts\"\n\n/**\n * Creates a staggered transition if a valid stagger value is defined.\n * Accounts for cumulative stagger delays of nested repeaters.\n * @returns The staggered transition as a SafeJS object and a boolean indicating if an index binding is required.\n * Note: Index bindings are dynamic values and can't be lifted to file scope.\n */\nexport function createStaggerTransition(\n\tnode: CanvasNode & WithStyleAppearEffect,\n\tbaseTransition: SafeJS,\n\tcontext: JSXContext,\n): { transition: SafeJS; needsIndexBinding: boolean } {\n\tif (getStaggerValueForNode(node) === 0) return { transition: baseTransition, needsIndexBinding: false }\n\n\tconst cumulativeDelay = calculateCumulativeStaggerDelay(node, context)\n\tif (isNull(cumulativeDelay)) return { transition: baseTransition, needsIndexBinding: false }\n\n\tconst needsIndexBinding = isSafeJS(cumulativeDelay)\n\tconst stagger = context.declarations.file.dedupe(\n\t\t\"stagger\",\n\t\tjs`(transition, value) => ({ ...transition, delay: (transition.delay ?? 0) + value })`,\n\t)\n\n\treturn { transition: SafeJS.fn(stagger, baseTransition, cumulativeDelay), needsIndexBinding }\n}\n", "import type { ReducedShadow, ReducedShadowList } from \"document/models/CanvasTree/traits/utils/reduceShadows.ts\"\nimport type { BoxShadow } from \"document/models/Shadow.ts\"\nimport { createBoxShadow } from \"document/models/Shadow.ts\"\nimport { isArray, isBoolean, isNumber, isString } from \"utils/typeChecks.ts\"\n\nexport function getBoxShadowFromReduced(reducedShadow: ReducedShadow): BoxShadow {\n\tconst values: Partial<BoxShadow> = {}\n\n\tif (isString(reducedShadow.type)) {\n\t\tvalues.type = reducedShadow.type\n\t}\n\tif (isString(reducedShadow.color)) {\n\t\tvalues.color = reducedShadow.color\n\t}\n\tif (isNumber(reducedShadow.x)) {\n\t\tvalues.x = reducedShadow.x\n\t}\n\tif (isNumber(reducedShadow.y)) {\n\t\tvalues.y = reducedShadow.y\n\t}\n\tif (isNumber(reducedShadow.blur)) {\n\t\tvalues.blur = reducedShadow.blur\n\t}\n\tif (isNumber(reducedShadow.spread)) {\n\t\tvalues.spread = reducedShadow.spread\n\t}\n\tif (isNumber(reducedShadow.diffusion)) {\n\t\tvalues.diffusion = reducedShadow.diffusion\n\t}\n\tif (isNumber(reducedShadow.focus)) {\n\t\tvalues.focus = reducedShadow.focus\n\t}\n\tif (isBoolean(reducedShadow.inset)) {\n\t\tvalues.inset = reducedShadow.inset\n\t}\n\n\treturn createBoxShadow(values)\n}\n\nexport function getInitialBoxShadowValueFromReducedShadows(shadows: ReducedShadowList): readonly BoxShadow[] {\n\tif (!isArray(shadows) || shadows.length === 0) return [createBoxShadow({})]\n\n\treturn shadows.map(getBoxShadowFromReduced)\n}\n", "import { type Transition, defaultDurationBasedSpringTransition } from \"document/models/Transition.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\nimport { maxZIndex } from \"./WithZIndex.ts\"\n\nexport interface WithLightboxEffect {\n\tlightboxEffectEnabled: boolean | undefined\n\tlightboxEffectPadding: number | undefined\n\tlightboxEffectPaddingPerSide: boolean | undefined\n\tlightboxEffectPaddingTop: number | undefined\n\tlightboxEffectPaddingRight: number | undefined\n\tlightboxEffectPaddingBottom: number | undefined\n\tlightboxEffectPaddingLeft: number | undefined\n\tlightboxEffectMaxWidth: number | undefined\n\tlightboxEffectZIndex: number | undefined\n\tlightboxEffectBackdrop: string | DynamicValue | undefined\n\tlightboxEffectTransition: Transition | undefined\n}\n\nexport const lightboxEffectDefaults: WithLightboxEffect = {\n\tlightboxEffectEnabled: undefined,\n\tlightboxEffectPadding: undefined,\n\tlightboxEffectPaddingPerSide: undefined,\n\tlightboxEffectPaddingTop: undefined,\n\tlightboxEffectPaddingRight: undefined,\n\tlightboxEffectPaddingBottom: undefined,\n\tlightboxEffectPaddingLeft: undefined,\n\tlightboxEffectMaxWidth: undefined,\n\tlightboxEffectZIndex: undefined,\n\tlightboxEffectBackdrop: undefined,\n\tlightboxEffectTransition: undefined,\n}\n\nconst key: keyof WithLightboxEffect = \"lightboxEffectEnabled\"\n\nexport function withLightboxEffect<T extends CanvasNode>(node: T): node is T & WithLightboxEffect {\n\treturn key in node\n}\n\nexport function hasLightboxEffect<T extends CanvasNode>(\n\tnode: T,\n): node is T & WithLightboxEffect & { lightboxEffectEnabled: true } {\n\treturn withLightboxEffect(node) && node.lightboxEffectEnabled === true\n}\nconst defaultPadding = 20\nexport const lightboxEffectEnabledDefaults = {\n\tlightboxEffectEnabled: true,\n\tlightboxEffectPadding: defaultPadding,\n\tlightboxEffectPaddingPerSide: false,\n\tlightboxEffectMaxWidth: 800,\n\tlightboxEffectZIndex: maxZIndex,\n\tlightboxEffectBackdrop: \"rgba(0, 0, 0, 0.8)\",\n\tlightboxEffectPaddingTop: defaultPadding,\n\tlightboxEffectPaddingRight: defaultPadding,\n\tlightboxEffectPaddingBottom: defaultPadding,\n\tlightboxEffectPaddingLeft: defaultPadding,\n\tlightboxEffectTransition: defaultDurationBasedSpringTransition,\n} satisfies WithLightboxEffect\n", "import type { Transition } from \"document/models/Transition.ts\"\nimport { fallbackPhysicsBasedSpringTransition } from \"document/models/Transition.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport type { NodeID } from \"../nodes/NodeID.ts\"\nimport type { VariableReference } from \"./VariableReference.ts\"\nimport { EffectTrigger } from \"./utils/EffectTrigger.ts\"\nimport type { ResolvedCollectionItemSelector } from \"./utils/ResolvedCollectionItemSelector.ts\"\n\nexport type TextEffectTrigger = Extract<\n\tEffectTrigger,\n\tEffectTrigger.OnInView | EffectTrigger.OnMount | EffectTrigger.OnScrollTarget\n>\n\nexport interface TextEffectStyle {\n\ttextEffectOpacity: number | undefined\n\ttextEffectX: number | undefined\n\ttextEffectY: number | undefined\n\ttextEffectScale: number | undefined\n\ttextEffectRotate3d: boolean | undefined\n\ttextEffectRotate: number | undefined\n\ttextEffectRotateX: number | undefined\n\ttextEffectRotateY: number | undefined\n\ttextEffectSkewX: number | undefined\n\ttextEffectSkewY: number | undefined\n\ttextEffectBlur: number | undefined\n\ttextEffectTransition: Transition | undefined\n}\n\nexport const tokenizationOptions = [\"character\", \"word\", \"line\", \"element\"] as const\ntype TextEffectTokenizationOption = (typeof tokenizationOptions)[number]\n\nexport interface WithTextEffect extends TextEffectStyle {\n\ttextEffectEnabled: boolean | undefined\n\t// Text effects cannot be additive, so we must have a type enum so that in\n\t// the future, we can add more types.\n\ttextEffectType: \"appear\" | undefined\n\ttextEffectTokenization: TextEffectTokenizationOption | undefined\n\n\t// Trigger Configuration\n\ttextEffectTrigger: TextEffectTrigger | undefined\n\ttextEffectThreshold: number | undefined\n\ttextEffectScrollTarget: NodeID | VariableReference | undefined\n\ttextEffectScrollTargetCollectionItem: ResolvedCollectionItemSelector | VariableReference | undefined\n\ttextEffectReplay: boolean | undefined\n\ttextEffectDelay: number | undefined\n}\n\nexport const textEffectDefaults: WithTextEffect = {\n\ttextEffectEnabled: undefined,\n\ttextEffectType: undefined,\n\ttextEffectTokenization: undefined,\n\ttextEffectTrigger: undefined,\n\ttextEffectThreshold: undefined,\n\ttextEffectScrollTarget: undefined,\n\ttextEffectScrollTargetCollectionItem: undefined,\n\ttextEffectOpacity: undefined,\n\ttextEffectX: undefined,\n\ttextEffectY: undefined,\n\ttextEffectScale: undefined,\n\ttextEffectRotate3d: undefined,\n\ttextEffectRotate: undefined,\n\ttextEffectRotateX: undefined,\n\ttextEffectRotateY: undefined,\n\ttextEffectSkewX: undefined,\n\ttextEffectSkewY: undefined,\n\ttextEffectBlur: undefined,\n\ttextEffectTransition: undefined,\n\ttextEffectReplay: undefined,\n\ttextEffectDelay: undefined,\n}\n\nconst key = \"textEffectEnabled\" satisfies keyof WithTextEffect\n\nexport function withTextEffect<T extends CanvasNode>(node: T): node is T & WithTextEffect {\n\treturn key in node\n}\n\n// Fallback value for edge cases where an effect does not have a transition defined. This value should remain unchanged\n// so that the transitions on such nodes don't change sneakily on regen.\nexport const fallbackTextEffectTransition: Transition = {\n\t...fallbackPhysicsBasedSpringTransition,\n\tstiffness: 400,\n\tdamping: 30,\n\tdelay: 0.2,\n}\n\nexport function hasTextEffect<T extends CanvasNode>(\n\tnode: T,\n): node is T & WithTextEffect & { textEffectEnabled: true; textEffectType: \"appear\" } {\n\treturn withTextEffect(node) && node.textEffectEnabled === true && node.textEffectType === \"appear\"\n}\n\ntype PresetKey = \"blur\" | \"flip\" | \"shake\" | \"shoot\" | \"rotate\" | \"scale\" | \"stagger\"\n\ninterface TextEffectPresetValues extends TextEffectStyle {\n\ttextEffectTokenization: TextEffectTokenizationOption\n}\n\ntype Presets = Readonly<Record<PresetKey, () => TextEffectPresetValues>>\n\nexport const textEffectPresets: Presets = {\n\tblur: () => ({\n\t\ttextEffectTokenization: \"character\",\n\t\ttextEffectOpacity: 0,\n\t\ttextEffectX: 0,\n\t\ttextEffectY: 10,\n\t\ttextEffectScale: 1,\n\t\ttextEffectRotate3d: false,\n\t\ttextEffectRotate: 0,\n\t\ttextEffectRotateX: 0,\n\t\ttextEffectRotateY: 0,\n\t\ttextEffectSkewX: 0,\n\t\ttextEffectSkewY: 0,\n\t\ttextEffectBlur: 10,\n\t\ttextEffectTransition: {\n\t\t\tbounce: 0,\n\t\t\tdamping: 40,\n\t\t\tdelay: 0.05,\n\t\t\tduration: 0.4,\n\t\t\tdurationBasedSpring: true,\n\t\t\tease: [0.44, 0, 0.56, 1],\n\t\t\tmass: 1,\n\t\t\tstiffness: 400,\n\t\t\ttype: \"spring\",\n\t\t},\n\t}),\n\tflip: () => ({\n\t\ttextEffectTokenization: \"character\",\n\t\ttextEffectOpacity: 0,\n\t\ttextEffectX: 0,\n\t\ttextEffectY: 0,\n\t\ttextEffectScale: 1,\n\t\ttextEffectRotate3d: true,\n\t\ttextEffectRotate: 0,\n\t\ttextEffectRotateX: 0,\n\t\ttextEffectRotateY: 90,\n\t\ttextEffectSkewX: 0,\n\t\ttextEffectSkewY: 0,\n\t\ttextEffectBlur: 0,\n\t\ttextEffectTransition: {\n\t\t\tbounce: 0,\n\t\t\tdamping: 40,\n\t\t\tdelay: 0.05,\n\t\t\tduration: 0.4,\n\t\t\tdurationBasedSpring: true,\n\t\t\tease: [0.44, 0, 0.56, 1],\n\t\t\tmass: 1,\n\t\t\tstiffness: 400,\n\t\t\ttype: \"spring\",\n\t\t},\n\t}),\n\tshake: () => ({\n\t\ttextEffectTokenization: \"line\",\n\t\ttextEffectOpacity: 1,\n\t\ttextEffectX: 10,\n\t\ttextEffectY: 0,\n\t\ttextEffectScale: 1,\n\t\ttextEffectRotate3d: false,\n\t\ttextEffectRotate: 0,\n\t\ttextEffectRotateX: 0,\n\t\ttextEffectRotateY: 0,\n\t\ttextEffectSkewX: 0,\n\t\ttextEffectSkewY: 0,\n\t\ttextEffectBlur: 0,\n\t\ttextEffectTransition: {\n\t\t\tbounce: 0.85,\n\t\t\tdamping: 10,\n\t\t\tdelay: 0.2,\n\t\t\tduration: 1.1,\n\t\t\tdurationBasedSpring: true,\n\t\t\tease: [0.44, 0, 0.56, 1],\n\t\t\tmass: 1,\n\t\t\tstiffness: 1000,\n\t\t\ttype: \"spring\",\n\t\t},\n\t}),\n\tshoot: () => ({\n\t\ttextEffectTokenization: \"character\",\n\t\ttextEffectOpacity: 0,\n\t\ttextEffectX: 50,\n\t\ttextEffectY: 0,\n\t\ttextEffectScale: 1,\n\t\ttextEffectRotate3d: false,\n\t\ttextEffectRotate: 0,\n\t\ttextEffectRotateX: 0,\n\t\ttextEffectRotateY: 0,\n\t\ttextEffectSkewX: 0,\n\t\ttextEffectSkewY: 0,\n\t\ttextEffectBlur: 0,\n\t\ttextEffectTransition: {\n\t\t\tbounce: 0.25,\n\t\t\tdamping: 30,\n\t\t\tdelay: 0.1,\n\t\t\tduration: 0.45,\n\t\t\tdurationBasedSpring: true,\n\t\t\tease: [0.44, 0, 0.56, 1],\n\t\t\tmass: 1,\n\t\t\tstiffness: 400,\n\t\t\ttype: \"spring\",\n\t\t},\n\t}),\n\trotate: () => ({\n\t\ttextEffectTokenization: \"character\",\n\t\ttextEffectOpacity: 0,\n\t\ttextEffectX: 0,\n\t\ttextEffectY: 0,\n\t\ttextEffectScale: 1,\n\t\ttextEffectRotate3d: false,\n\t\ttextEffectRotate: 45,\n\t\ttextEffectRotateX: 0,\n\t\ttextEffectRotateY: 0,\n\t\ttextEffectSkewX: 0,\n\t\ttextEffectSkewY: 0,\n\t\ttextEffectBlur: 0,\n\t\ttextEffectTransition: {\n\t\t\tbounce: 0.25,\n\t\t\tdamping: 30,\n\t\t\tdelay: 0.1,\n\t\t\tduration: 0.45,\n\t\t\tdurationBasedSpring: true,\n\t\t\tease: [0.44, 0, 0.56, 1],\n\t\t\tmass: 1,\n\t\t\tstiffness: 400,\n\t\t\ttype: \"spring\",\n\t\t},\n\t}),\n\tscale: () => ({\n\t\ttextEffectTokenization: \"character\",\n\t\ttextEffectOpacity: 0,\n\t\ttextEffectX: 0,\n\t\ttextEffectY: 0,\n\t\ttextEffectScale: 2,\n\t\ttextEffectRotate3d: false,\n\t\ttextEffectRotate: 0,\n\t\ttextEffectRotateX: 0,\n\t\ttextEffectRotateY: 0,\n\t\ttextEffectSkewX: 0,\n\t\ttextEffectSkewY: 0,\n\t\ttextEffectBlur: 10,\n\t\ttextEffectTransition: {\n\t\t\tbounce: 0.25,\n\t\t\tdamping: 30,\n\t\t\tdelay: 0.05,\n\t\t\tduration: 0.45,\n\t\t\tdurationBasedSpring: true,\n\t\t\tease: [0.44, 0, 0.56, 1],\n\t\t\tmass: 1,\n\t\t\tstiffness: 400,\n\t\t\ttype: \"spring\",\n\t\t},\n\t}),\n\tstagger: () => ({\n\t\ttextEffectTokenization: \"word\",\n\t\ttextEffectOpacity: 0,\n\t\ttextEffectX: 0,\n\t\ttextEffectY: 10,\n\t\ttextEffectScale: 1,\n\t\ttextEffectRotate3d: false,\n\t\ttextEffectRotate: 0,\n\t\ttextEffectRotateX: 0,\n\t\ttextEffectRotateY: 0,\n\t\ttextEffectSkewX: 0,\n\t\ttextEffectSkewY: 0,\n\t\ttextEffectBlur: 0,\n\t\ttextEffectTransition: {\n\t\t\tbounce: 0,\n\t\t\tdamping: 40,\n\t\t\tdelay: 0.075,\n\t\t\tduration: 0.4,\n\t\t\tdurationBasedSpring: true,\n\t\t\tease: [0.44, 0, 0.56, 1],\n\t\t\tmass: 1,\n\t\t\tstiffness: 400,\n\t\t\ttype: \"spring\",\n\t\t},\n\t}),\n}\n\nexport const textEffectEnabledDefaults: WithTextEffect = {\n\t...textEffectDefaults,\n\ttextEffectEnabled: true,\n\ttextEffectType: \"appear\",\n\ttextEffectTrigger: EffectTrigger.OnMount,\n\t...textEffectPresets.blur(),\n}\n\nexport const textEffectTriggers = [\n\tEffectTrigger.OnInView,\n\tEffectTrigger.OnMount,\n\tEffectTrigger.OnScrollTarget,\n] satisfies TextEffectTrigger[]\nconst supportedTextEffectTriggers = new Set<string>(textEffectTriggers)\nexport function isSupportedTrigger(trigger: string): trigger is TextEffectTrigger {\n\treturn supportedTextEffectTriggers.has(trigger)\n}\n", "import { assertNever, isMixed } from \"@framerjs/shared\"\nimport { experiments } from \"app/experiments.ts\"\nimport { js } from \"code-generation/js/js.ts\"\nimport type { SafeJS } from \"code-generation/js/serializeJS.ts\"\nimport { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport type { CollectorContext } from \"code-generation/utils/collector.ts\"\nimport { getBoxShadowFromReduced } from \"document/components/chrome/properties/panels/getInitialBoxShadowValueFromReducedShadows.ts\"\nimport type { CanvasNode, CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type { WithDragEffect } from \"document/models/CanvasTree/traits/WithDragEffect.ts\"\nimport {\n\tdragEffectDefaults,\n\tdragEffectEnabledDefaults,\n\thasDragEffect,\n\twithDragEffect,\n} from \"document/models/CanvasTree/traits/WithDragEffect.ts\"\nimport type { WithFlowEffect } from \"document/models/CanvasTree/traits/WithFlowEffect.ts\"\nimport {\n\tflowEffectDefaults,\n\tflowEffectEnabledDefaults,\n\thasFlowEffect,\n\twithFlowEffect,\n} from \"document/models/CanvasTree/traits/WithFlowEffect.ts\"\nimport type { WithLoopEffect } from \"document/models/CanvasTree/traits/WithLoopEffect.ts\"\nimport {\n\thasLoopEffect,\n\tloopEffectDefaults,\n\tloopEffectEnabledDefaults,\n\twithLoopEffect,\n} from \"document/models/CanvasTree/traits/WithLoopEffect.ts\"\nimport type { WithParallax } from \"document/models/CanvasTree/traits/WithParallax.ts\"\nimport {\n\thasParallaxEffect,\n\tparallaxDefaults,\n\tparallaxEnabledDefaults,\n\twithParallax,\n} from \"document/models/CanvasTree/traits/WithParallax.ts\"\nimport type { WithStyleAppearEffect } from \"document/models/CanvasTree/traits/WithStyleAppearEffect.ts\"\nimport {\n\thasStyleAppearEffect,\n\tstyleAppearEffectDefaults,\n\tstyleAppearEffectEnabledDefaults,\n\twithStyleAppearPageEffect,\n} from \"document/models/CanvasTree/traits/WithStyleAppearEffect.ts\"\nimport type {\n\tEffectStyleScrollTarget,\n\tScrollStyle,\n\tWithStyleTransformEffect,\n} from \"document/models/CanvasTree/traits/WithStyleTransformEffect.ts\"\nimport {\n\tdefaultStyle,\n\thasStyleTransformEffect,\n\tstyleTransformEffectDefaults,\n\tstyleTransformEffectEnabledDefaults,\n\twithStyleTransformEffect,\n} from \"document/models/CanvasTree/traits/WithStyleTransformEffect.ts\"\nimport type {\n\tEffectVariantScrollTarget,\n\tWithVariantAppearEffect,\n} from \"document/models/CanvasTree/traits/WithVariantAppearEffect.ts\"\nimport {\n\tappearEffectDefaults,\n\tappearEffectEnabledDefaults,\n\thasVariantAppearEffect,\n\twithVariantAppearPageEffect,\n} from \"document/models/CanvasTree/traits/WithVariantAppearEffect.ts\"\nimport type { WithWhileHover } from \"document/models/CanvasTree/traits/WithWhileHover.ts\"\nimport {\n\thasWhileHover,\n\twhileHoverDefaults,\n\twhileHoverEnabledDefaults,\n\twithWhileHover,\n} from \"document/models/CanvasTree/traits/WithWhileHover.ts\"\nimport type { WithWhileTap } from \"document/models/CanvasTree/traits/WithWhileTap.ts\"\nimport {\n\thasWhileTap,\n\twhileTapDefaults,\n\twhileTapEnabledDefaults,\n\twithWhileTap,\n} from \"document/models/CanvasTree/traits/WithWhileTap.ts\"\nimport {\n\ttype NotFound,\n\ttype Reduced,\n\ttype ReducedSubPropertyRecord,\n\tisNotFound,\n} from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedDragEffect } from \"document/models/CanvasTree/traits/utils/reduceDragEffect.ts\"\nimport type { ReducedFlowEffect } from \"document/models/CanvasTree/traits/utils/reduceFlowEffect.ts\"\nimport type { ReducedLoopEffect } from \"document/models/CanvasTree/traits/utils/reduceLoopEffect.ts\"\nimport type { ReducedParallax } from \"document/models/CanvasTree/traits/utils/reduceParallax.ts\"\nimport type { ReducedStrokeEffect } from \"document/models/CanvasTree/traits/utils/reduceStrokeEffect.ts\"\nimport type { ReducedStyleAppearEffect } from \"document/models/CanvasTree/traits/utils/reduceStyleAppearEffect.ts\"\nimport type {\n\tReducedEffectStyleScrollTarget,\n\tReducedStyleTransformEffect,\n} from \"document/models/CanvasTree/traits/utils/reduceStyleTransformEffect.ts\"\nimport type {\n\tReducedEffectVariantScrollTarget,\n\tReducedVariantAppearEffect,\n} from \"document/models/CanvasTree/traits/utils/reduceVariantAppearEffect.ts\"\nimport type { ReducedHoverEffect } from \"document/models/CanvasTree/traits/utils/reduceWhileHover.ts\"\nimport type { ReducedPressEffect } from \"document/models/CanvasTree/traits/utils/reduceWhileTap.ts\"\nimport type { BoxShadow } from \"document/models/Shadow.ts\"\nimport {\n\ttype Transition,\n\tdefaultDurationBasedSpringTransition,\n\tfallbackPhysicsBasedSpringTransition,\n} from \"document/models/Transition.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { canReadClipboardWithoutPromptingUser } from \"utils/clipboard/clipboard.ts\"\nimport { clipboardReadType } from \"utils/clipboard/index.ts\"\nimport { commonValue } from \"utils/commonValue.ts\"\nimport { getKeys } from \"utils/getKeys.ts\"\nimport { isArray, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { isFixedOrRelativeOverlay } from \"../../nodes/utils/overlayHelpers.ts\"\nimport { isDynamicValue } from \"../DynamicValue.ts\"\nimport type { WithLightboxEffect } from \"../WithLightboxEffect.ts\"\nimport {\n\thasLightboxEffect,\n\tlightboxEffectDefaults,\n\tlightboxEffectEnabledDefaults,\n\twithLightboxEffect,\n} from \"../WithLightboxEffect.ts\"\nimport { withRotation } from \"../WithRotation.ts\"\nimport type { WithStrokeEffect } from \"../WithStrokeEffect.ts\"\nimport {\n\thasStrokeEffect,\n\tstrokeEffectDefaults,\n\tstrokeEffectEnabledDefaults,\n\twithStrokeEffect,\n} from \"../WithStrokeEffect.ts\"\nimport type { WithTextEffect } from \"../WithTextEffect.ts\"\nimport { hasTextEffect, textEffectDefaults, textEffectEnabledDefaults, withTextEffect } from \"../WithTextEffect.ts\"\nimport {\n\ttype WithTickerEffect,\n\thasTickerEffect,\n\ttickerEffectDefaults,\n\ttickerEffectEnabledDefaults,\n\twithTickerEffect,\n} from \"../WithTickerEffect.ts\"\nimport { isVariant } from \"../WithVariant.ts\"\nimport type { ReducedEffectTransition } from \"./reduceEffectTransition.ts\"\nimport type { ReducedLightboxEffect } from \"./reduceLightboxEffect.ts\"\nimport type { ReducedShadow } from \"./reduceShadows.ts\"\nimport type { ReducedTextEffect } from \"./reduceTextEffect.ts\"\nimport type { ReducedTickerEffect } from \"./reduceTickerEffect.ts\"\n\nfunction getCommonOrUndefined<T>(value: Reduced<T | NotFound | undefined>): T | undefined {\n\tif (isNotFound(value)) return undefined\n\tif (isMixed(value)) return undefined\n\treturn value\n}\n\nfunction getCommonFromSetOrUndefined<T>(value: Set<T | undefined> | undefined): T | undefined {\n\tif (!value) return undefined\n\n\tconst common = commonValue(value)\n\tif (isNotFound(common)) return undefined\n\tif (isMixed(common)) return undefined\n\treturn common\n}\n\nfunction getCommonShadowOrUndefined(value: NotFound | ReducedShadow | undefined): BoxShadow | undefined {\n\tif (isNotFound(value)) return undefined\n\tif (isUndefined(value)) return undefined\n\treturn getBoxShadowFromReduced(value)\n}\n\nfunction commonScrollStyleValues(record: ReducedSubPropertyRecord<ScrollStyle>) {\n\treturn withoutUndefinedProperties<ScrollStyle>({\n\t\tx: getCommonOrUndefined(record.x),\n\t\ty: getCommonOrUndefined(record.y),\n\t\tscale: getCommonOrUndefined(record.scale),\n\t\topacity: getCommonOrUndefined(record.opacity),\n\t\trotate3d: getCommonOrUndefined(record.rotate3d),\n\t\trotate: getCommonOrUndefined(record.rotate),\n\t\trotateX: getCommonOrUndefined(record.rotateX),\n\t\trotateY: getCommonOrUndefined(record.rotateY),\n\t\tskewX: getCommonOrUndefined(record.skewX),\n\t\tskewY: getCommonOrUndefined(record.skewY),\n\t\tbackgroundColor: getCommonOrUndefined(record.backgroundColor),\n\t\tblur: getCommonOrUndefined(record.blur),\n\t\ttransformPerspective: getCommonOrUndefined(record.transformPerspective),\n\t})\n}\n\n/**\n * Given a reduced transition, return a transition object with any ambiguous values replaced with fallback values.\n */\nexport function getCommonEffectTransitionOrUndefined(\n\treducedTransition: Reduced<ReducedEffectTransition | undefined>,\n): Transition | undefined {\n\tif (isNotFound(reducedTransition)) return undefined\n\tif (isMixed(reducedTransition)) return undefined\n\tif (isUndefined(reducedTransition)) return undefined\n\n\tconst fallback =\n\t\treducedTransition.durationBasedSpring === true\n\t\t\t? defaultDurationBasedSpringTransition\n\t\t\t: fallbackPhysicsBasedSpringTransition\n\n\treturn {\n\t\ttype: !isMixed(reducedTransition.type) ? reducedTransition.type : fallback.type,\n\t\tease: !isMixed(reducedTransition.ease) ? reducedTransition.ease : fallback.ease,\n\t\tduration: !isMixed(reducedTransition.duration) ? reducedTransition.duration : fallback.duration,\n\t\tdelay: !isMixed(reducedTransition.delay) ? reducedTransition.delay : fallback.delay,\n\t\tstiffness: !isMixed(reducedTransition.stiffness) ? reducedTransition.stiffness : fallback.stiffness,\n\t\tdamping: !isMixed(reducedTransition.damping) ? reducedTransition.damping : fallback.damping,\n\t\tmass: !isMixed(reducedTransition.mass) ? reducedTransition.mass : fallback.mass,\n\t\tbounce: !isMixed(reducedTransition.bounce) ? reducedTransition.bounce : fallback.bounce,\n\t\tdurationBasedSpring: !isMixed(reducedTransition.durationBasedSpring)\n\t\t\t? reducedTransition.durationBasedSpring\n\t\t\t: fallback.durationBasedSpring,\n\t\tstagger: !isMixed(reducedTransition.stagger) ? reducedTransition.stagger : fallback.stagger,\n\t}\n}\n\nfunction getSharedStyleTargets(\n\treducedScrollTargets?: ReducedEffectStyleScrollTarget[],\n): EffectStyleScrollTarget[] | undefined {\n\tif (!isArray(reducedScrollTargets)) return undefined\n\tif (reducedScrollTargets.length === 0) return undefined\n\n\treturn reducedScrollTargets.map(({ style, targets }) => {\n\t\tconst target = commonValue(targets)\n\t\treturn {\n\t\t\tid: randomID(),\n\t\t\tstyle: { ...defaultStyle(), ...commonScrollStyleValues(style) },\n\t\t\ttarget: isString(target) ? target : undefined,\n\t\t}\n\t})\n}\n\nfunction getSharedVariantTargets(\n\treducedScrollTargets?: ReducedEffectVariantScrollTarget[],\n): EffectVariantScrollTarget[] | undefined {\n\tif (!isArray(reducedScrollTargets)) return undefined\n\tif (reducedScrollTargets.length === 0) return undefined\n\n\treturn reducedScrollTargets.map(({ variants, targets }) => {\n\t\tconst target = commonValue(targets)\n\t\tconst variant = commonValue(variants)\n\n\t\treturn {\n\t\t\tid: randomID(),\n\t\t\ttarget: isString(target) ? target : undefined,\n\t\t\tvariant: isString(variant) ? variant : undefined,\n\t\t}\n\t})\n}\n\nfunction withoutUndefinedProperties<T>(input: T): Partial<T> {\n\tconst output: Partial<T> = {}\n\tfor (const key in input) {\n\t\tconst value = input[key]\n\t\tif (isUndefined(value)) continue\n\t\toutput[key] = value\n\t}\n\treturn output\n}\n\nfunction getStyleAppearEffectForCopy(reducedValues: Partial<AllReducedEffects>) {\n\treturn withoutUndefinedProperties<WithStyleAppearEffect>({\n\t\tstyleAppearEffectEnabled: getCommonOrUndefined(reducedValues.styleAppearEffectEnabled),\n\t\tstyleAppearEffectThreshold: getCommonOrUndefined(reducedValues.styleAppearEffectThreshold),\n\t\tstyleAppearEffectAnimateOnce: getCommonOrUndefined(reducedValues.styleAppearEffectAnimateOnce),\n\t\tstyleAppearEffectOpacity: getCommonOrUndefined(reducedValues.styleAppearEffectOpacity),\n\t\tstyleAppearEffectX: getCommonOrUndefined(reducedValues.styleAppearEffectX),\n\t\tstyleAppearEffectY: getCommonOrUndefined(reducedValues.styleAppearEffectY),\n\t\tstyleAppearEffectScale: getCommonOrUndefined(reducedValues.styleAppearEffectScale),\n\t\tstyleAppearEffectTransition: getCommonEffectTransitionOrUndefined(reducedValues.styleAppearEffectTransition),\n\t\tstyleAppearEffectRotate: getCommonOrUndefined(reducedValues.styleAppearEffectRotate),\n\t\tstyleAppearEffectRotateX: getCommonOrUndefined(reducedValues.styleAppearEffectRotateX),\n\t\tstyleAppearEffectRotateY: getCommonOrUndefined(reducedValues.styleAppearEffectRotateY),\n\t\tstyleAppearEffectPerspective: getCommonOrUndefined(reducedValues.styleAppearEffectPerspective),\n\t\tstyleAppearEffectLocked: getCommonOrUndefined(reducedValues.styleAppearEffectLocked),\n\t\tstyleAppearEffectTrigger: getCommonFromSetOrUndefined(reducedValues.styleAppearEffectTrigger),\n\t\tstyleAppearEffectScrollTarget: getCommonFromSetOrUndefined(reducedValues.styleAppearEffectScrollTarget),\n\t\tstyleAppearEffectScrollTargetCollectionItem: undefined,\n\t\tstyleAppearEffectScrollDirection: getCommonOrUndefined(reducedValues.styleAppearEffectScrollDirection),\n\n\t\texitEffectEnabled: getCommonOrUndefined(reducedValues.exitEffectEnabled),\n\t\texitEffectOpacity: getCommonOrUndefined(reducedValues.exitEffectOpacity),\n\t\texitEffectX: getCommonOrUndefined(reducedValues.exitEffectX),\n\t\texitEffectY: getCommonOrUndefined(reducedValues.exitEffectY),\n\t\texitEffectScale: getCommonOrUndefined(reducedValues.exitEffectScale),\n\t\texitEffectRotate3d: getCommonOrUndefined(reducedValues.exitEffectRotate3d),\n\t\texitEffectRotate: getCommonOrUndefined(reducedValues.exitEffectRotate),\n\t\texitEffectRotateAdditiveDynamicValue: undefined,\n\t\texitEffectRotateX: getCommonOrUndefined(reducedValues.exitEffectRotateX),\n\t\texitEffectRotateY: getCommonOrUndefined(reducedValues.exitEffectRotateY),\n\t\texitEffectSkewX: getCommonOrUndefined(reducedValues.exitEffectSkewX),\n\t\texitEffectSkewY: getCommonOrUndefined(reducedValues.exitEffectSkewY),\n\t\texitEffectPerspective: undefined,\n\t\texitEffectTransition: getCommonEffectTransitionOrUndefined(reducedValues.exitEffectTransition),\n\n\t\tenterEffectEnabled: getCommonOrUndefined(reducedValues.enterEffectEnabled),\n\t\tenterEffectOpacity: getCommonOrUndefined(reducedValues.enterEffectOpacity),\n\t\tenterEffectX: getCommonOrUndefined(reducedValues.enterEffectX),\n\t\tenterEffectY: getCommonOrUndefined(reducedValues.enterEffectY),\n\t\tenterEffectScale: getCommonOrUndefined(reducedValues.enterEffectScale),\n\t\tenterEffectTransition: getCommonEffectTransitionOrUndefined(reducedValues.enterEffectTransition),\n\t\tenterEffectRotate3d: getCommonOrUndefined(reducedValues.enterEffectRotate3d),\n\t\tenterEffectRotate: getCommonOrUndefined(reducedValues.enterEffectRotate),\n\t\tenterEffectRotateAdditiveDynamicValue: undefined,\n\t\tenterEffectRotateX: getCommonOrUndefined(reducedValues.enterEffectRotateX),\n\t\tenterEffectRotateY: getCommonOrUndefined(reducedValues.enterEffectRotateY),\n\t\tenterEffectSkewX: getCommonOrUndefined(reducedValues.enterEffectSkewX),\n\t\tenterEffectSkewY: getCommonOrUndefined(reducedValues.enterEffectSkewY),\n\t\tenterEffectPerspective: undefined,\n\t})\n}\n\nfunction getDragEffectForCopy(reducedValues: Partial<AllReducedEffects>) {\n\treturn withoutUndefinedProperties<WithDragEffect>({\n\t\tdragEffectEnabled: getCommonOrUndefined(reducedValues.dragEffectEnabled),\n\t\tdragEffectFreeform: getCommonOrUndefined(reducedValues.dragEffectFreeform),\n\t\tdragEffectSnapBack: getCommonOrUndefined(reducedValues.dragEffectSnapBack),\n\t\tdragEffectMomentum: getCommonOrUndefined(reducedValues.dragEffectMomentum),\n\t\tdragEffectTransition: getCommonEffectTransitionOrUndefined(reducedValues.dragEffectTransition),\n\t\tdragEffectConstraintElement: getCommonOrUndefined(reducedValues.dragEffectConstraintElement),\n\t\tdragEffectConstraintItem: getCommonOrUndefined(reducedValues.dragEffectConstraintItem),\n\t})\n}\n\nfunction getWhileHoverEffectForCopy(reducedValues: Partial<AllReducedEffects>) {\n\treturn withoutUndefinedProperties<WithWhileHover>({\n\t\twhileHoverEnabled: getCommonOrUndefined(reducedValues.whileHoverEnabled),\n\t\twhileHoverOpacity: getCommonOrUndefined(reducedValues.whileHoverOpacity),\n\t\twhileHoverX: getCommonOrUndefined(reducedValues.whileHoverX),\n\t\twhileHoverY: getCommonOrUndefined(reducedValues.whileHoverY),\n\t\twhileHoverScale: getCommonOrUndefined(reducedValues.whileHoverScale),\n\t\twhileHoverRotate3d: getCommonOrUndefined(reducedValues.whileHoverRotate3d),\n\t\twhileHoverRotate: getCommonOrUndefined(reducedValues.whileHoverRotate),\n\t\twhileHoverRotateAdditiveDynamicValue: undefined,\n\t\twhileHoverRotateX: getCommonOrUndefined(reducedValues.whileHoverRotateX),\n\t\twhileHoverRotateY: getCommonOrUndefined(reducedValues.whileHoverRotateY),\n\t\twhileHoverSkewX: getCommonOrUndefined(reducedValues.whileHoverSkewX),\n\t\twhileHoverSkewY: getCommonOrUndefined(reducedValues.whileHoverSkewY),\n\t\twhileHoverBackgroundColor: getCommonOrUndefined(reducedValues.whileHoverBackgroundColor),\n\t\twhileHoverBoxShadow: getCommonShadowOrUndefined(reducedValues.whileHoverBoxShadow),\n\t\twhileHoverTransition: getCommonEffectTransitionOrUndefined(reducedValues.whileHoverTransition),\n\t})\n}\n\nfunction getFlowEffectForCopy(reducedValues: Partial<AllReducedEffects>) {\n\treturn withoutUndefinedProperties<WithFlowEffect>({\n\t\tflowEffectEnabled: getCommonOrUndefined(reducedValues.flowEffectEnabled),\n\t\tflowEffectTransition: getCommonEffectTransitionOrUndefined(reducedValues.flowEffectTransition),\n\t})\n}\n\nfunction getLoopEffectForCopy(reducedValues: Partial<AllReducedEffects>) {\n\treturn withoutUndefinedProperties<WithLoopEffect>({\n\t\tloopEffectEnabled: getCommonOrUndefined(reducedValues.loopEffectEnabled),\n\t\tloopEffectRepeatType: getCommonOrUndefined(reducedValues.loopEffectRepeatType),\n\t\tloopEffectRepeatDelay: getCommonOrUndefined(reducedValues.loopEffectRepeatDelay),\n\t\tloopEffectOpacity: getCommonOrUndefined(reducedValues.loopEffectOpacity),\n\t\tloopEffectX: getCommonOrUndefined(reducedValues.loopEffectX),\n\t\tloopEffectY: getCommonOrUndefined(reducedValues.loopEffectY),\n\t\tloopEffectScale: getCommonOrUndefined(reducedValues.loopEffectScale),\n\t\tloopEffectRotate3d: getCommonOrUndefined(reducedValues.loopEffectRotate3d),\n\t\tloopEffectRotate: getCommonOrUndefined(reducedValues.loopEffectRotate),\n\t\tloopEffectRotateX: getCommonOrUndefined(reducedValues.loopEffectRotateX),\n\t\tloopEffectRotateY: getCommonOrUndefined(reducedValues.loopEffectRotateY),\n\t\tloopEffectSkewX: getCommonOrUndefined(reducedValues.loopEffectSkewX),\n\t\tloopEffectSkewY: getCommonOrUndefined(reducedValues.loopEffectSkewY),\n\t\tloopEffectTransition: getCommonEffectTransitionOrUndefined(reducedValues.loopEffectTransition),\n\t\tloopEffectPauseOffscreen: getCommonOrUndefined(reducedValues.loopEffectPauseOffscreen),\n\t})\n}\n\nfunction getParallaxEffectForCopy(reducedValues: Partial<AllReducedEffects>) {\n\treturn withoutUndefinedProperties<WithParallax>({\n\t\tparallaxEnabled: getCommonOrUndefined(reducedValues.parallaxEnabled),\n\t\tparallaxSpeed: getCommonOrUndefined(reducedValues.parallaxSpeed),\n\t\tparallaxAdjustPosition: getCommonOrUndefined(reducedValues.parallaxAdjustPosition),\n\t\tparallaxOffset: getCommonOrUndefined(reducedValues.parallaxOffset),\n\t})\n}\n\nfunction getAppearEffectForCopy(reducedValues: Partial<AllReducedEffects>) {\n\treturn withoutUndefinedProperties<WithVariantAppearEffect>({\n\t\tappearEffectEnabled: getCommonOrUndefined(reducedValues.appearEffectEnabled),\n\t\tappearEffectVisibleVariantId: getCommonFromSetOrUndefined(reducedValues.appearEffectVisibleVariantId),\n\t\tappearEffectObscuredVariantId: getCommonFromSetOrUndefined(reducedValues.appearEffectObscuredVariantId),\n\t\tappearEffectThreshold: getCommonOrUndefined(reducedValues.appearEffectThreshold),\n\t\tappearEffectAnimateOnce: getCommonOrUndefined(reducedValues.appearEffectAnimateOnce),\n\t\tappearEffectTrigger: getCommonFromSetOrUndefined(reducedValues.appearEffectTrigger),\n\t\tappearEffectScrollTargets: getSharedVariantTargets(reducedValues.appearEffectScrollTargets),\n\t\tappearEffectScrollDirection: getCommonOrUndefined(reducedValues.appearEffectScrollDirection),\n\t\tappearEffectScrollDirectionTarget: getCommonFromSetOrUndefined(reducedValues.appearEffectScrollDirectionTarget),\n\t})\n}\n\nfunction getStyleTransformEffectForCopy(reducedValues: Partial<AllReducedEffects>) {\n\treturn withoutUndefinedProperties<WithStyleTransformEffect>({\n\t\tstyleTransformEffectEnabled: getCommonOrUndefined(reducedValues.styleTransformEffectEnabled),\n\t\tstyleTransformEffectViewportThreshold: getCommonOrUndefined(reducedValues.styleTransformEffectViewportThreshold),\n\t\tstyleTransformEffectTransitionEnabled: getCommonOrUndefined(reducedValues.styleTransformEffectTransitionEnabled),\n\t\tstyleTransformEffectScrollTargets: getSharedStyleTargets(reducedValues.styleTransformEffectScrollTargets),\n\t\tstyleTransformEffectTrigger: getCommonFromSetOrUndefined(reducedValues.styleTransformEffectTrigger),\n\t\tstyleTransformEffectTransition: getCommonEffectTransitionOrUndefined(reducedValues.styleTransformEffectTransition),\n\t})\n}\n\nfunction getWhileTapForCopy(reducedValues: Partial<AllReducedEffects>) {\n\treturn withoutUndefinedProperties<WithWhileTap>({\n\t\twhileTapEnabled: getCommonOrUndefined(reducedValues.whileTapEnabled),\n\t\twhileTapOpacity: getCommonOrUndefined(reducedValues.whileTapOpacity),\n\t\twhileTapX: getCommonOrUndefined(reducedValues.whileTapX),\n\t\twhileTapY: getCommonOrUndefined(reducedValues.whileTapY),\n\t\twhileTapScale: getCommonOrUndefined(reducedValues.whileTapScale),\n\t\twhileTapRotate3d: getCommonOrUndefined(reducedValues.whileTapRotate3d),\n\t\twhileTapRotate: getCommonOrUndefined(reducedValues.whileTapRotate),\n\t\twhileTapRotateAdditiveDynamicValue: undefined,\n\t\twhileTapRotateX: getCommonOrUndefined(reducedValues.whileTapRotateX),\n\t\twhileTapRotateY: getCommonOrUndefined(reducedValues.whileTapRotateY),\n\t\twhileTapSkewX: getCommonOrUndefined(reducedValues.whileTapSkewX),\n\t\twhileTapSkewY: getCommonOrUndefined(reducedValues.whileTapSkewY),\n\t\twhileTapBackgroundColor: getCommonOrUndefined(reducedValues.whileTapBackgroundColor),\n\t\twhileTapBoxShadow: getCommonShadowOrUndefined(reducedValues.whileTapBoxShadow),\n\t\twhileTapTransition: getCommonEffectTransitionOrUndefined(reducedValues.whileTapTransition),\n\t})\n}\n\nfunction getTextEffectForCopy(reducedValues: Partial<AllReducedEffects>) {\n\treturn withoutUndefinedProperties<WithTextEffect>({\n\t\ttextEffectEnabled: getCommonOrUndefined(reducedValues.textEffectEnabled),\n\t\ttextEffectType: getCommonOrUndefined(reducedValues.textEffectType),\n\t\ttextEffectTokenization: getCommonOrUndefined(reducedValues.textEffectTokenization),\n\t\ttextEffectTrigger: getCommonFromSetOrUndefined(reducedValues.textEffectTrigger),\n\t\ttextEffectThreshold: getCommonOrUndefined(reducedValues.textEffectThreshold),\n\t\ttextEffectScrollTarget: getCommonFromSetOrUndefined(reducedValues.textEffectScrollTarget),\n\t\ttextEffectScrollTargetCollectionItem: getCommonOrUndefined(reducedValues.textEffectScrollTargetCollectionItem),\n\t\ttextEffectOpacity: getCommonOrUndefined(reducedValues.textEffectOpacity),\n\t\ttextEffectX: getCommonOrUndefined(reducedValues.textEffectX),\n\t\ttextEffectY: getCommonOrUndefined(reducedValues.textEffectY),\n\t\ttextEffectScale: getCommonOrUndefined(reducedValues.textEffectScale),\n\t\ttextEffectRotate3d: getCommonOrUndefined(reducedValues.textEffectRotate3d),\n\t\ttextEffectRotate: getCommonOrUndefined(reducedValues.textEffectRotate),\n\t\ttextEffectRotateX: getCommonOrUndefined(reducedValues.textEffectRotateX),\n\t\ttextEffectRotateY: getCommonOrUndefined(reducedValues.textEffectRotateY),\n\t\ttextEffectSkewX: getCommonOrUndefined(reducedValues.textEffectSkewX),\n\t\ttextEffectSkewY: getCommonOrUndefined(reducedValues.textEffectSkewY),\n\t\ttextEffectBlur: getCommonOrUndefined(reducedValues.textEffectBlur),\n\t\ttextEffectTransition: getCommonEffectTransitionOrUndefined(reducedValues.textEffectTransition),\n\t\ttextEffectReplay: getCommonOrUndefined(reducedValues.textEffectReplay),\n\t\ttextEffectDelay: getCommonOrUndefined(reducedValues.textEffectDelay),\n\t})\n}\n\nfunction getPathLengthEffectForCopy(reducedValues: Partial<AllReducedEffects>) {\n\treturn withoutUndefinedProperties<WithStrokeEffect>({\n\t\tstrokeEffectEnabled: getCommonOrUndefined(reducedValues.strokeEffectEnabled),\n\t\tstrokeEffectLength: getCommonOrUndefined(reducedValues.strokeEffectLength),\n\t\tstrokeEffectGap: getCommonOrUndefined(reducedValues.strokeEffectGap),\n\t\tstrokeEffectOffset: getCommonOrUndefined(reducedValues.strokeEffectOffset),\n\t\tstrokeEffectTransition: getCommonEffectTransitionOrUndefined(reducedValues.strokeEffectTransition),\n\t\tstrokeEffectLoop: getCommonOrUndefined(reducedValues.strokeEffectLoop),\n\t\tstrokeEffectLoopType: getCommonOrUndefined(reducedValues.strokeEffectLoopType),\n\t})\n}\n\nfunction getLightboxEffectForCopy(reducedValues: Partial<AllReducedEffects>) {\n\treturn withoutUndefinedProperties<WithLightboxEffect>({\n\t\tlightboxEffectEnabled: getCommonOrUndefined(reducedValues.lightboxEffectEnabled),\n\t\tlightboxEffectPadding: getCommonOrUndefined(reducedValues.lightboxEffectPadding),\n\t\tlightboxEffectPaddingPerSide: getCommonOrUndefined(reducedValues.lightboxEffectPaddingPerSide),\n\t\tlightboxEffectPaddingTop: getCommonOrUndefined(reducedValues.lightboxEffectPaddingTop),\n\t\tlightboxEffectPaddingRight: getCommonOrUndefined(reducedValues.lightboxEffectPaddingRight),\n\t\tlightboxEffectPaddingBottom: getCommonOrUndefined(reducedValues.lightboxEffectPaddingBottom),\n\t\tlightboxEffectPaddingLeft: getCommonOrUndefined(reducedValues.lightboxEffectPaddingLeft),\n\t\tlightboxEffectMaxWidth: getCommonOrUndefined(reducedValues.lightboxEffectMaxWidth),\n\t\tlightboxEffectZIndex: getCommonOrUndefined(reducedValues.lightboxEffectZIndex),\n\t\tlightboxEffectBackdrop: getCommonOrUndefined(reducedValues.lightboxEffectBackdrop),\n\t\tlightboxEffectTransition: getCommonEffectTransitionOrUndefined(reducedValues.lightboxEffectTransition),\n\t})\n}\n\nfunction getTickerEffectForCopy(reducedValues: Partial<AllReducedEffects>) {\n\treturn withoutUndefinedProperties<WithTickerEffect>({\n\t\ttickerEffectEnabled: getCommonOrUndefined(reducedValues.tickerEffectEnabled),\n\t\ttickerEffectVelocity: getCommonOrUndefined(reducedValues.tickerEffectVelocity),\n\t\ttickerEffectHoverModifier: getCommonOrUndefined(reducedValues.tickerEffectHoverModifier),\n\t\ttickerEffectDirectionModifier: getCommonOrUndefined(reducedValues.tickerEffectDirectionModifier),\n\t\ttickerEffectDraggable: getCommonOrUndefined(reducedValues.tickerEffectDraggable),\n\t})\n}\n\ninterface EffectConfig<WithTrait> {\n\treadonly defaults: WithTrait\n\treadonly enabledDefaults: WithTrait\n\treadonly traitKeys: readonly (keyof WithTrait)[]\n\treadonly withEffect: (node: CanvasNode) => node is CanvasNode & WithTrait\n\treadonly hasEffect: <T extends CanvasNode>(node: T) => node is T & WithTrait\n\treadonly recordHasEffect: <T extends Record<string, unknown>>(record: T) => record is T & WithTrait\n\treadonly getEffectForCopy: (reducedValues: Partial<AllReducedEffects>) => Partial<WithTrait>\n\treadonly collectEffectValuesFromNode: (node: CanvasNode, collectedEffectValues: Partial<WithTrait>) => void\n\n\t/**\n\t * To ensure type safety the EffectConfig implements its own method to set a\n\t * partial payload of trait values. This allows us to safely update any\n\t * effect while satisfying typescript.\n\t */\n\treadonly setNodeEffectValues: (node: CanvasNode, values: Partial<WithTrait>) => void\n}\n\n/**\n * Create an `EffectConfig` for a given effect trait. This config ensure that\n * all effects can be copy/pasted, updated, removed, etc in a type safe manner.\n */\nfunction createEffectConfig<Trait extends AnyEffect>(\n\t/**\n\t * The trait defaults that would also be included on the node \"record\", aka\n\t * an object mapping keys to undefined.\n\t */\n\tdefaults: Trait,\n\t/**\n\t * The trait defaults that we ideally set when enabling the effect on the\n\t * node.\n\t */\n\tenabledDefaults: Trait,\n\t/**\n\t * The `with*Effect` trait that we use to determine if the node supports the trait.\n\t */\n\twithEffect: (node: CanvasNode) => node is CanvasNode & Trait,\n\t/**\n\t * The `has*Trait` check that determines if the node supports the trait, and\n\t * has the required values that enable the effect on the node.\n\t */\n\thasEffect: <T extends CanvasNode>(node: T) => node is T & Trait,\n\tgetEffectForCopy: (reducedValues: Partial<AllReducedEffects>) => Partial<Trait>,\n): EffectConfig<Trait> {\n\tconst traitKeys = getKeys<keyof Trait & string>(defaults)\n\treturn {\n\t\tdefaults,\n\t\ttraitKeys,\n\t\tenabledDefaults,\n\t\twithEffect,\n\t\thasEffect,\n\t\trecordHasEffect: <T extends Record<string, unknown>>(record: T): record is T & Trait => {\n\t\t\treturn hasEffect(record as unknown as CanvasNode)\n\t\t},\n\t\tsetNodeEffectValues: (node, values) => {\n\t\t\t/**\n\t\t\t * To ensure type safety the EffectConfig implements its own method\n\t\t\t * to set a partial payload of trait values. This allows us to\n\t\t\t * safely update any effect while satisfying typescript.\n\t\t\t */\n\t\t\tif (!withEffect(node)) return\n\n\t\t\tconst update: Partial<Trait> = {}\n\n\t\t\tfor (const key of traitKeys) {\n\t\t\t\t// Only set values provided by `effects`, but include undefined values.\n\t\t\t\tif (!(key in values)) continue\n\t\t\t\tupdate[key] = values[key]\n\t\t\t}\n\n\t\t\tnode.set(update as Partial<CanvasNode & Trait>)\n\t\t},\n\t\tgetEffectForCopy,\n\t\tcollectEffectValuesFromNode: (node, collectedEffectValues) => {\n\t\t\tif (!withEffect(node)) return\n\t\t\tfor (const key of traitKeys) {\n\t\t\t\tcollectedEffectValues[key] = node[key]\n\t\t\t}\n\t\t},\n\t}\n}\n\nexport enum EffectType {\n\tAppear = \"withStyleAppearEffect\",\n\tDrag = \"withDragEffect\",\n\tFlow = \"withFlowEffect\",\n\tHover = \"withWhileHover\",\n\tLightbox = \"withLightboxEffect\",\n\tLoop = \"withLoopEffect\",\n\tParallax = \"withParallax\",\n\tSetVariant = \"withAppearEffect\",\n\tStroke = \"withStrokeEffect\",\n\tStyleTransform = \"withStyleTransformEffect\",\n\tTap = \"withWhileTap\",\n\tText = \"withTextEffect\",\n\tTicker = \"withTickerEffect\",\n}\n\nconst effectNames: readonly EffectType[] = [\n\tEffectType.Appear,\n\tEffectType.Drag,\n\tEffectType.Flow,\n\tEffectType.Hover,\n\tEffectType.Lightbox,\n\tEffectType.Loop,\n\tEffectType.Parallax,\n\tEffectType.SetVariant,\n\tEffectType.Stroke,\n\tEffectType.StyleTransform,\n\tEffectType.Tap,\n\tEffectType.Text,\n\tEffectType.Ticker,\n] as const\n\n/**\n * This config maps each effect name to an `EffectConfig` for it. This allows\n * easily handling all effects generically without special casing each effect.\n * It's important that new effects are added to this object so that these\n * utilities continue to work as expected.\n */\nexport const effectConfig = {\n\t[EffectType.Appear]: createEffectConfig(\n\t\tstyleAppearEffectDefaults,\n\t\tstyleAppearEffectEnabledDefaults,\n\t\twithStyleAppearPageEffect,\n\t\thasStyleAppearEffect,\n\t\tgetStyleAppearEffectForCopy,\n\t),\n\t[EffectType.Drag]: createEffectConfig(\n\t\tdragEffectDefaults,\n\t\tdragEffectEnabledDefaults,\n\t\twithDragEffect,\n\t\thasDragEffect,\n\t\tgetDragEffectForCopy,\n\t),\n\t[EffectType.Flow]: createEffectConfig(\n\t\tflowEffectDefaults,\n\t\tflowEffectEnabledDefaults,\n\t\twithFlowEffect,\n\t\thasFlowEffect,\n\t\tgetFlowEffectForCopy,\n\t),\n\t[EffectType.Hover]: createEffectConfig(\n\t\twhileHoverDefaults,\n\t\twhileHoverEnabledDefaults,\n\t\twithWhileHover,\n\t\thasWhileHover,\n\t\tgetWhileHoverEffectForCopy,\n\t),\n\t[EffectType.Loop]: createEffectConfig(\n\t\tloopEffectDefaults,\n\t\tloopEffectEnabledDefaults,\n\t\twithLoopEffect,\n\t\thasLoopEffect,\n\t\tgetLoopEffectForCopy,\n\t),\n\t[EffectType.Parallax]: createEffectConfig(\n\t\tparallaxDefaults,\n\t\tparallaxEnabledDefaults,\n\t\twithParallax,\n\t\thasParallaxEffect,\n\t\tgetParallaxEffectForCopy,\n\t),\n\t[EffectType.SetVariant]: createEffectConfig(\n\t\tappearEffectDefaults,\n\t\tappearEffectEnabledDefaults,\n\t\twithVariantAppearPageEffect,\n\t\thasVariantAppearEffect,\n\t\tgetAppearEffectForCopy,\n\t),\n\t[EffectType.StyleTransform]: createEffectConfig(\n\t\tstyleTransformEffectDefaults,\n\t\tstyleTransformEffectEnabledDefaults,\n\t\twithStyleTransformEffect,\n\t\thasStyleTransformEffect,\n\t\tgetStyleTransformEffectForCopy,\n\t),\n\t[EffectType.Tap]: createEffectConfig(\n\t\twhileTapDefaults,\n\t\twhileTapEnabledDefaults,\n\t\twithWhileTap,\n\t\thasWhileTap,\n\t\tgetWhileTapForCopy,\n\t),\n\t[EffectType.Text]: createEffectConfig(\n\t\ttextEffectDefaults,\n\t\ttextEffectEnabledDefaults,\n\t\twithTextEffect,\n\t\thasTextEffect,\n\t\tgetTextEffectForCopy,\n\t),\n\t[EffectType.Stroke]: createEffectConfig(\n\t\tstrokeEffectDefaults,\n\t\tstrokeEffectEnabledDefaults,\n\t\twithStrokeEffect,\n\t\thasStrokeEffect,\n\t\tgetPathLengthEffectForCopy,\n\t),\n\t[EffectType.Lightbox]: createEffectConfig(\n\t\tlightboxEffectDefaults,\n\t\tlightboxEffectEnabledDefaults,\n\t\twithLightboxEffect,\n\t\thasLightboxEffect,\n\t\tgetLightboxEffectForCopy,\n\t),\n\t[EffectType.Ticker]: createEffectConfig(\n\t\ttickerEffectDefaults,\n\t\ttickerEffectEnabledDefaults,\n\t\twithTickerEffect,\n\t\thasTickerEffect,\n\t\tgetTickerEffectForCopy,\n\t),\n} as const\n\nexport type AllReducedEffects = ReducedDragEffect &\n\tReducedHoverEffect &\n\tReducedFlowEffect &\n\tReducedLoopEffect &\n\tReducedParallax &\n\tReducedPressEffect &\n\tReducedStyleTransformEffect &\n\tReducedVariantAppearEffect &\n\tReducedStyleAppearEffect &\n\tReducedTextEffect &\n\tReducedStrokeEffect &\n\tReducedLightboxEffect &\n\tReducedTickerEffect\n\nexport type AllEffects = WithDragEffect &\n\tWithFlowEffect &\n\tWithLoopEffect &\n\tWithParallax &\n\tWithStyleTransformEffect &\n\tWithVariantAppearEffect &\n\tWithTextEffect &\n\tWithStrokeEffect &\n\tWithLightboxEffect &\n\tWithTickerEffect &\n\tOmit<WithWhileHover, \"whileHoverRotateAdditiveDynamicValue\"> &\n\tOmit<WithWhileTap, \"whileTapRotateAdditiveDynamicValue\"> &\n\tOmit<WithStyleAppearEffect, \"enterEffectRotateAdditiveDynamicValue\" | \"exitEffectRotateAdditiveDynamicValue\">\n\ntype AnyEffect =\n\t| WithDragEffect\n\t| WithFlowEffect\n\t| WithLoopEffect\n\t| WithParallax\n\t| WithVariantAppearEffect\n\t| WithStyleTransformEffect\n\t| WithTextEffect\n\t| WithStrokeEffect\n\t| WithLightboxEffect\n\t| WithTickerEffect\n\t| Omit<WithWhileHover, \"whileHoverRotateAdditiveDynamicValue\">\n\t| Omit<WithWhileTap, \"whileTapRotateAdditiveDynamicValue\">\n\t| Omit<WithStyleAppearEffect, \"enterEffectRotateAdditiveDynamicValue\" | \"exitEffectRotateAdditiveDynamicValue\">\n\n/**\n * Get all supported effect values off of a node.\n */\nexport function nodeEffects(node: CanvasNode): Partial<AllEffects> {\n\tconst effects: Partial<AllEffects> = {}\n\n\tfor (const effect of effectNames) {\n\t\tconst { collectEffectValuesFromNode } = effectConfig[effect]\n\t\tcollectEffectValuesFromNode(node, effects)\n\t}\n\n\treturn effects\n}\n\n/**\n * Check if the node supports at least one of our effects, and has at least one\n * enabled.\n */\nexport function hasAnyEffect<T extends CanvasNode>(node: T): node is T & AnyEffect {\n\tfor (const effect of effectNames) {\n\t\tconst { hasEffect } = effectConfig[effect]\n\t\tif (hasEffect(node)) return true\n\t}\n\n\treturn false\n}\n\n/**\n * Check if the node supports at least one of our effects.\n */\nexport function withAnyEffect<T extends CanvasNode>(node: T): node is T & AnyEffect {\n\tfor (const effect of effectNames) {\n\t\tconst { withEffect } = effectConfig[effect]\n\t\tif (withEffect(node)) return true\n\t}\n\n\treturn false\n}\n\n/**\n * Given an object of any of our effect values, set only values for traits\n * supported by the target node.\n */\nexport function setEffects(tree: CanvasTree, selection: NodeID[], effects: Partial<AllEffects>) {\n\tfor (const nodeId of selection) {\n\t\tconst node = tree.get(nodeId)\n\t\tif (!node) continue\n\n\t\tfor (const effectName of effectNames) {\n\t\t\tconst { setNodeEffectValues } = effectConfig[effectName]\n\t\t\tsetNodeEffectValues(node, effects)\n\t\t}\n\t}\n}\n\nexport function getSupportedEffects<T extends CanvasNode>(node: T, effects: Partial<AllEffects>): Partial<T> {\n\tconst update: Partial<T> = {}\n\tfor (const effect of effectNames) {\n\t\tconst { withEffect, defaults } = effectConfig[effect]\n\t\tif (!withEffect(node)) continue\n\t\tfor (const key in defaults) {\n\t\t\tconst typedKey = key as keyof AllEffects\n\t\t\tupdate[typedKey] = effects[typedKey]\n\t\t}\n\t}\n\treturn update\n}\n\nfunction isSupportedVariantNodeEffect(effectType: EffectType): boolean {\n\tswitch (effectType) {\n\t\tcase EffectType.Drag:\n\t\tcase EffectType.Flow:\n\t\tcase EffectType.Loop:\n\t\tcase EffectType.Parallax:\n\t\tcase EffectType.SetVariant:\n\t\tcase EffectType.StyleTransform:\n\t\tcase EffectType.Appear:\n\t\tcase EffectType.Text:\n\t\tcase EffectType.Stroke:\n\t\tcase EffectType.Lightbox:\n\t\tcase EffectType.Ticker:\n\t\t\treturn true\n\t\tcase EffectType.Hover:\n\t\tcase EffectType.Tap:\n\t\t\treturn false\n\t\tdefault:\n\t\t\tassertNever(effectType)\n\t}\n}\n\nexport function liftEffectsOnComponentCreation<T extends CanvasNode>(node: T, tree: CanvasTree): Partial<AllEffects> {\n\tconst effects: Partial<AllEffects> = {}\n\n\tfor (const effect of effectNames) {\n\t\tconst { defaults, withEffect, setNodeEffectValues, collectEffectValuesFromNode } = effectConfig[effect]\n\t\tif (!withEffect(node)) continue\n\n\t\t// If the source node is not a fixed or relative overlay (in which case\n\t\t// we lift all effects), and the effect is supported on the ground node\n\t\t// of a variant, don't lift the effect.\n\t\tif (isSupportedVariantNodeEffect(effect) && !isFixedOrRelativeOverlay(node)) continue\n\n\t\t// Otherwise copy all of the effect values from the node for lifting.\n\t\tcollectEffectValuesFromNode(node, effects)\n\n\t\tconst latestNode = tree.current(node)\n\t\tif (!latestNode) continue\n\n\t\t// And remove the values from the source.\n\t\tsetNodeEffectValues(latestNode, defaults)\n\t}\n\n\treturn effects\n}\n\nexport async function canPasteAnyCompatibleEffects(tree: CanvasTree, selection: NodeID[]) {\n\t// In Safari we cannot access the clipboard on right-click, that's why we assume the\n\t// happy flow here, and enable pasting even if we cannot read the clipboard.\n\tif (!(await canReadClipboardWithoutPromptingUser())) return true\n\tconst values = await clipboardReadType(\"application/x-framer-effects\")\n\tif (!isObject(values)) return false\n\n\tfor (const effect of effectNames) {\n\t\tconst { withEffect, recordHasEffect } = effectConfig[effect]\n\n\t\t// Check if the values from the clipboard contain an effect\n\t\tif (!recordHasEffect(values)) continue\n\n\t\t// Effect is in pasteboard, check if all nodes support the effect.\n\t\tconst allNodesSupportEffect = selection.every(id => {\n\t\t\tconst node = tree.get(id)\n\t\t\treturn node ? withEffect(node) : true\n\t\t})\n\n\t\tif (allNodesSupportEffect) return true\n\t}\n\n\t// Otherwise return false, not all the nodes support any of the effects in\n\t// the pasteboard.\n\treturn false\n}\n\nexport function isSupportedEffectScopeType(scopeType: ScopeType | undefined): boolean {\n\treturn (\n\t\tscopeType === ScopeType.WebPage ||\n\t\tscopeType === ScopeType.SmartComponent ||\n\t\tscopeType === ScopeType.LayoutTemplate ||\n\t\tscopeType === ScopeType.VectorSet ||\n\t\t(scopeType === ScopeType.DesignPage && experiments.isOn(\"effectsInDesignPages\"))\n\t)\n}\n\nexport function nodeSupportsGestureEffects(node: CanvasNode) {\n\treturn !isVariant(node) && !isFixedOrRelativeOverlay(node)\n}\n\n/**\n * In the past, rotation used to be additive in webpages for motion gesture\n * effects (appear, hover, tap). We migrated these effects to add the base\n * rotation to the effect rotation so that we no longer had to support additive\n * rotation.\n *\n * Some nodes may have had rotation variables. To update those nodes without\n * breaking changes, we added a flag that the effects rotation should be\n * additive. In those cases, we will add the base rotation to the effect\n * rotation.\n */\nexport function getAdditiveEffectRotation(\n\tnode: CanvasNode,\n\tadditive: boolean | undefined,\n\toptionalEffectRotation: number | undefined,\n\tctx: CollectorContext | undefined,\n): SafeJS | number | undefined {\n\tconst effectRotation = optionalEffectRotation ?? 0\n\n\tif (!withRotation(node) || !isDynamicValue(node.rotation)) return effectRotation\n\tif (!additive) return effectRotation\n\n\tconst baseRotation = isJSXContext(ctx)\n\t\t? ctx.createDeduplicatedDynamicValueBinding(node.rotation, node, \"rotation\")\n\t\t: node.resolveValue(\"rotation\")\n\n\tif (!effectRotation) return baseRotation\n\n\treturn js`(${baseRotation} ?? 0) + ${effectRotation}`\n}\n\n/**\n * In the past, all 3 rotation values (x, y, z) were all exposed in a panel. In\n * an update, we hid x and y behind a toggle whose value was saved to the node.\n * To avoid a migration, that toggle was assumed to be true if undefined. To\n * ensure backwards compatibility with those projects that hadn't set rotate3d,\n * we must always assume undefined values may set 3D rotation.\n */\nexport function effectHas3DRotation(rotate3D: boolean | undefined) {\n\treturn rotate3D !== false\n}\n\nexport function supportsScrollSectionRefControls(scopeType: ScopeType): boolean {\n\tswitch (scopeType) {\n\t\tcase ScopeType.SmartComponent:\n\t\tcase ScopeType.LayoutTemplate:\n\t\tcase ScopeType.VectorSet:\n\t\t\treturn true\n\t\tcase ScopeType.Analytics:\n\t\tcase ScopeType.CanvasPage:\n\t\tcase ScopeType.ContentManagement:\n\t\tcase ScopeType.DesignPage:\n\t\tcase ScopeType.LocalizationGlossary:\n\t\tcase ScopeType.Routes:\n\t\tcase ScopeType.WebPage:\n\t\tcase ScopeType.CustomCode:\n\t\t\treturn false\n\t\tdefault:\n\t\t\tassertNever(scopeType)\n\t}\n}\n", "import { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport type { MakeSerializable } from \"code-generation/types.ts\"\nimport { propCollector } from \"code-generation/utils/collector.ts\"\nimport { toMotionTransition } from \"document/models/Transition.ts\"\nimport type { LightboxEffectProps } from \"library/render/presentation/withLightbox.tsx\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { isDynamicValue } from \"../DynamicValue.ts\"\nimport { withFill } from \"../WithFill.ts\"\nimport {\n\ttype WithLightboxEffect,\n\thasLightboxEffect,\n\tlightboxEffectEnabledDefaults,\n\twithLightboxEffect,\n} from \"../WithLightboxEffect.ts\"\nimport { isSupportedEffectScopeType } from \"../utils/effects.ts\"\n\nfunction sidePaddingsAreIdentical(node: CanvasNode & WithLightboxEffect) {\n\treturn (\n\t\tnode.lightboxEffectPaddingTop === node.lightboxEffectPaddingBottom &&\n\t\tnode.lightboxEffectPaddingTop === node.lightboxEffectPaddingRight &&\n\t\tnode.lightboxEffectPaddingTop === node.lightboxEffectPaddingLeft\n\t)\n}\n\nfunction getPaddings(node: CanvasNode & WithLightboxEffect) {\n\tif (!node.lightboxEffectPaddingPerSide || sidePaddingsAreIdentical(node)) {\n\t\treturn { padding: node.lightboxEffectPaddingTop }\n\t}\n\n\treturn {\n\t\tpaddingTop: node.lightboxEffectPaddingTop,\n\t\tpaddingRight: node.lightboxEffectPaddingRight,\n\t\tpaddingBottom: node.lightboxEffectPaddingBottom,\n\t\tpaddingLeft: node.lightboxEffectPaddingLeft,\n\t}\n}\n\ntype SerializableLightboxEffectProps = MakeSerializable<\n\tPick<\n\t\tLightboxEffectProps,\n\t\t| \"transition\"\n\t\t| \"zIndex\"\n\t\t| \"backdrop\"\n\t\t| \"maxWidth\"\n\t\t| \"padding\"\n\t\t| \"paddingTop\"\n\t\t| \"paddingRight\"\n\t\t| \"paddingBottom\"\n\t\t| \"paddingLeft\"\n\t>\n>\n\nexport const collectLightboxEffect = propCollector((node, props, ctx) => {\n\tif (!withLightboxEffect(node) || !isJSXContext(ctx) || !isSupportedEffectScopeType(ctx.scopeType)) return\n\tif (!hasLightboxEffect(node) || !withFill(node) || node.fillType !== \"image\") {\n\t\tprops.lightbox = undefined\n\t\treturn\n\t}\n\n\tconst lightbox: SerializableLightboxEffectProps = {\n\t\t...getPaddings(node),\n\t\tmaxWidth: node.lightboxEffectMaxWidth ?? lightboxEffectEnabledDefaults.lightboxEffectMaxWidth,\n\t\tzIndex: node.lightboxEffectZIndex ?? lightboxEffectEnabledDefaults.lightboxEffectZIndex,\n\t\ttransition: ctx.declarations?.file.dedupe(\n\t\t\t\"transition\",\n\t\t\ttoMotionTransition(node.lightboxEffectTransition ?? lightboxEffectEnabledDefaults.lightboxEffectTransition),\n\t\t),\n\t\tbackdrop: isDynamicValue(node.lightboxEffectBackdrop)\n\t\t\t? ctx.createDeduplicatedDynamicValueBinding(node.lightboxEffectBackdrop, node, \"backdrop\")\n\t\t\t: (ctx.cssVariableDefinitions.resolveColor(node.lightboxEffectBackdrop) ?? node.lightboxEffectBackdrop),\n\t}\n\n\tObject.assign(props, { lightbox })\n})\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\n\nexport interface WithTextContent {\n\ttextContent: DynamicValue | undefined\n}\n\nexport const textContentDefaults: WithTextContent = {\n\ttextContent: undefined,\n}\n\nconst key: keyof WithTextContent = \"textContent\"\n\nexport function withTextContent<T extends CanvasNode>(node: T): node is T & WithTextContent {\n\treturn key in node\n}\n", "import { withTextContent } from \"../../traits/WithTextContent.ts\"\nimport type { CanvasNode } from \"../CanvasNode.ts\"\nimport type { RichTextNode } from \"../RichTextNode.ts\"\nimport type { TextNode } from \"../TextNode.ts\"\n\nexport type AnyTextNode = TextNode<any> | RichTextNode\n\nexport function isAnyTextNode<T extends CanvasNode>(node: T | null | undefined): node is T & AnyTextNode {\n\tif (!node) return false\n\treturn withTextContent(node)\n}\n", "import { DimensionType } from \"library/render/types/Constraints.ts\"\nimport { assertNever } from \"library/utils/assert.ts\"\nimport type { WithSize } from \"../WithSize.ts\"\nimport { viewportUnitForDimension } from \"../WithSizeDimensionType.ts\"\n\nexport function sizeValue(value: number, dimensionType: DimensionType, dimension: keyof WithSize) {\n\tswitch (dimensionType) {\n\t\tcase DimensionType.FixedNumber:\n\t\t\treturn value\n\t\tcase DimensionType.Percentage:\n\t\t\treturn `${value * 100}%`\n\t\tcase DimensionType.FractionOfFreeSpace:\n\t\t\treturn `${value}fr`\n\t\tcase DimensionType.Auto:\n\t\tcase DimensionType.FitImage:\n\t\t\treturn \"auto\"\n\t\tcase DimensionType.Viewport:\n\t\t\treturn `${value * 100}${viewportUnitForDimension(dimension)}`\n\t\tdefault:\n\t\t\tassertNever(dimensionType)\n\t}\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { withDOMLayout } from \"document/models/CanvasTree/traits/WithDOMLayout.ts\"\nimport { isPositionRelative } from \"document/models/CanvasTree/traits/utils/positionTypeHelpers.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport type { NewConstraintProperties } from \"library/render/types/NewConstraints.tsx\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { isGridChildFillingCellHeight, isGridChildFillingCellWidth, withGridItemSize } from \"../WithGridItemSize.ts\"\nimport type { WithConstraints, WithPins } from \"../WithPins.ts\"\nimport type { WithSize } from \"../WithSize.ts\"\nimport { getSizeConstraints } from \"../WithSizeConstraints.ts\"\nimport { isMaster, isReplica } from \"../WithTemplate.ts\"\nimport { sizeValue } from \"../utils/sizeValue.ts\"\n\nfunction nullToUndefined<T>(value: T | null): T | undefined {\n\tif (value === null) {\n\t\treturn undefined\n\t}\n\treturn value\n}\n\n// @FIXME: we should refactor the code to make this function obsolete.\n// We now go from node -> constraints -> css, but we should be able to easily\n// write a function that directly goes node -> css.\nexport function newConstraintProperties(\n\tnode: CanvasNode & WithPins & WithSize & WithConstraints,\n): NewConstraintProperties {\n\tif (node.cache.newConstraintProps) return node.cache.newConstraintProps\n\tconst constraints = node.constraints()\n\tconst { left, right, top, bottom, centerAnchorX, centerAnchorY, width, height } = node\n\n\tconst constraintProps: NewConstraintProperties = {\n\t\t_constraints: { enabled: true },\n\t\t...getSizeConstraints(node),\n\t}\n\tconstraintProps.width = sizeValue(width, constraints.widthType, \"width\")\n\tconstraintProps.height = sizeValue(height, constraints.heightType, \"height\")\n\tconstraintProps.widthType = constraints.widthType\n\tconstraintProps.heightType = constraints.heightType\n\t// parentDirected is set here: https://github.com/framer/FramerStudio/blob/6abb6ef4e0e441c0311c0e422aa3dba6447302fa/Source/Vekter/src/renderer/render.tsx#L171-L173\n\tif (isPositionRelative(node)) {\n\t\tif (node.cache.parentDirected === \"grid\" && withGridItemSize(node)) {\n\t\t\tif (isGridChildFillingCellWidth(node)) {\n\t\t\t\tconstraintProps.widthType = DimensionType.Percentage\n\t\t\t\tconstraintProps.width = \"100%\"\n\t\t\t} else if (node.widthType === DimensionType.Auto) {\n\t\t\t\tconstraintProps.width = \"fit-content\"\n\t\t\t}\n\n\t\t\tif (isGridChildFillingCellHeight(node)) {\n\t\t\t\tconstraintProps.heightType = DimensionType.Percentage\n\t\t\t\tconstraintProps.height = \"100%\"\n\t\t\t} else if (node.height === DimensionType.Auto) {\n\t\t\t\tconstraintProps.height = \"fit-content\"\n\t\t\t}\n\t\t}\n\t\treturn (node.cache.newConstraintProps = constraintProps)\n\t}\n\n\tconst updateSizeToCalculatedValues = isNumber(constraints.aspectRatio) || isMaster(node) || isReplica(node)\n\tif (updateSizeToCalculatedValues) {\n\t\tif (withDOMLayout(node) && node.usesDOMRectCached()) {\n\t\t\t// Nodes using DOM layout can't pre-calculate the\n\t\t\t// aspect-ratio-constrained size, so it needs to be passed in as\n\t\t\t// part of the constraints\n\t\t\tconstraintProps._constraints.aspectRatio = constraints.aspectRatio\n\t\t} else {\n\t\t\t// We don't pass the aspect ratio because that results in the rect being recalculated\n\t\t\t// during rendering, while it is already pixelaligned by node.rect()\n\t\t\t// constraintProps._constraints.aspectRatio = constraints.aspectRatio\n\n\t\t\tconst parentRect = node.cache.parentRect ?? null\n\t\t\t// This dependency on node.rect is scary, because it might feel logical\n\t\t\t// to calculate the rect using this function (newConstraintProperties),\n\t\t\t// but that would create an infinite loop.\n\t\t\t// Currently all node.rect's are using the old constraints to calculate the size\n\n\t\t\t// When a node is using vw/vh, its size should be calculated with the viewport size, while its position\n\t\t\t// should be calculated with the parent size. But we are interested only in the size here, so we can use the\n\t\t\t// same parent size for both. Even though we pixel-align the width/height based on x/y, the x/y diff between\n\t\t\t// both parent sizes is the viewport height, which is always an integer, so it shouldn't affect the rounded\n\t\t\t// width/height\n\t\t\tconst size = node.rect({\n\t\t\t\tsizing: parentRect,\n\t\t\t\tpositioning: parentRect,\n\t\t\t\tviewport: node.cache.viewportRect,\n\t\t\t\tlayout: node.cache.parentDirected || null,\n\t\t\t})\n\t\t\tconstraintProps._constraints.intrinsicWidth = size.width\n\t\t\tconstraintProps._constraints.intrinsicHeight = size.height\n\t\t\t// XXX do we still need to set them on the constraintProps?\n\t\t\tif (constraints.widthType === DimensionType.FixedNumber) {\n\t\t\t\tconstraintProps.width = size.width\n\t\t\t}\n\t\t\tif (constraints.heightType === DimensionType.FixedNumber) {\n\t\t\t\tconstraintProps.height = size.height\n\t\t\t}\n\t\t}\n\t}\n\n\tif (node.__unsafeIsSlotPropertyChildNode()) {\n\t\tconstraintProps.top = undefined\n\t\tconstraintProps.right = undefined\n\t\tconstraintProps.bottom = undefined\n\t\tconstraintProps.left = undefined\n\t\tconstraintProps.center = undefined\n\t\treturn (node.cache.newConstraintProps = constraintProps)\n\t}\n\n\tconstraintProps.left = constraints.left ? nullToUndefined(left) : undefined\n\tconstraintProps.right = constraints.right ? nullToUndefined(right) : undefined\n\tconstraintProps.top = constraints.top ? nullToUndefined(top) : undefined\n\tconstraintProps.bottom = constraints.bottom ? nullToUndefined(bottom) : undefined\n\n\t// Width takes precedence CSS, so when left and right are set, we have to set width to undefined\n\tif (constraints.left && constraints.right) {\n\t\tconstraintProps.width = undefined\n\t}\n\t// Height takes precedence CSS, so when top and bottom are set, we have to set height to undefined\n\tif (constraints.top && constraints.bottom) {\n\t\tconstraintProps.height = undefined\n\t}\n\n\tif (!constraints.left && !constraints.right) {\n\t\tconstraintProps.center = \"x\"\n\t\tconstraintProps.left = percentage(centerAnchorX)\n\t}\n\tif (!constraints.top && !constraints.bottom) {\n\t\tconstraintProps.center = \"y\"\n\t\tconstraintProps.top = percentage(centerAnchorY)\n\t}\n\tif (!constraints.left && !constraints.right && !constraints.top && !constraints.bottom) {\n\t\tconstraintProps.center = true\n\t}\n\n\treturn (node.cache.newConstraintProps = constraintProps)\n}\n\nexport function percentage(fractionalValue: number): `${number}%` {\n\treturn `${fractionalValue * 100}%`\n}\n\nexport function pixels(value: number): `${number}px` {\n\treturn `${value}px`\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { withChildren } from \"document/models/CanvasTree/traits/WithChildren.ts\"\nimport { isDataRepeater } from \"../../nodes/utils/nodeCheck.ts\"\nimport { isPositionRelative } from \"./positionTypeHelpers.ts\"\n\nexport function needsMinSize(node: CanvasNode) {\n\tif (!withChildren(node)) return false\n\n\t// Data repeaters display an empty state, so we don't need a min size\n\tif (isDataRepeater(node)) return false\n\n\tconst hasPlaceholders = Boolean(node.cache.placeholders)\n\n\tif (hasPlaceholders) return false\n\n\tfor (const child of node.children) {\n\t\t// When layer is hidden with conditional logic, we don't want to use a min size because that\n\t\t// can be confusing.\n\t\tif (child.visible !== false && isPositionRelative(child, node)) return false\n\t}\n\n\treturn true\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport type { SerializableMotionStyle } from \"code-generation/types.ts\"\nimport type { CollectorContext } from \"code-generation/utils/collector.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { withGridItemSize } from \"../WithGridItemSize.ts\"\nimport { hasAnyLayout } from \"../WithLayout.ts\"\nimport type { WithConstraints, WithPins } from \"../WithPins.ts\"\nimport { isPinnable } from \"../WithPins.ts\"\nimport { withPositionType } from \"../WithPositionType.ts\"\nimport { withSize } from \"../WithSize.ts\"\nimport { supportsSizeConstraints } from \"../WithSizeConstraints.ts\"\nimport { hasTickerEffect } from \"../WithTickerEffect.ts\"\nimport { needsMinSize } from \"../utils/needsMinSize.ts\"\nimport { collectPosition } from \"./collectPosition.ts\"\n\nfunction needsMinContent(node: CanvasNode & WithPins & WithConstraints, axis: \"width\" | \"height\") {\n\tswitch (axis) {\n\t\tcase \"width\":\n\t\t\tif (node.cache.parentDirected === \"grid\" && withGridItemSize(node) && node.gridItemFillCellWidth === true) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn node.widthType === DimensionType.Auto\n\t\tcase \"height\":\n\t\t\tif (node.cache.parentDirected === \"grid\" && withGridItemSize(node) && node.gridItemFillCellHeight === true) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn node.heightType === DimensionType.Auto\n\t\tdefault:\n\t\t\tassertNever(axis)\n\t}\n}\n\n// When auto-sized, stacks need to use the `min-content` value for the\n// width and height properties, instead of the `auto` value. This is\n// because `auto` does not sufficiently constrain nested auto-sized text\n// nodes, which would typically just stretch to their maximum width if\n// left at `auto`. This is undesirable in the cases where a text node is\n// set to \"fill parent\", because then its size shouldn't be determining\n// the overall size of the container. Applying \"min-content\" will place\n// an additional constraint on the text nodes, making them shrink and\n// take advantage of any soft-wrapping opportunities in the \"fill\n// parent\" case, letting other fixed-size elements dictate overall\n// size.\nexport function collectStackAndGridAutoSize(\n\tnode: CanvasNode,\n\tstyle: SerializableMotionStyle,\n\tcontext: CollectorContext,\n) {\n\tif (!isPinnable(node) || !withSize(node)) return\n\tif (!hasAnyLayout(node)) return\n\t// Prevent layout collapse on Safari, min-content has no benefit in this scenario so we can omit it for all browsers\n\t// https://github.com/framer/company/issues/35328\n\tif (isAbsolutePositionedTicker(node, context)) return\n\n\tif (needsMinContent(node, \"width\")) {\n\t\tstyle.width = \"min-content\"\n\t\tif (needsMinSize(node) && (!supportsSizeConstraints(node) || node.minWidth === undefined)) {\n\t\t\tstyle.minWidth = node.width\n\t\t}\n\t}\n\n\tif (needsMinContent(node, \"height\")) {\n\t\tstyle.height = \"min-content\"\n\t\tif (needsMinSize(node) && (!supportsSizeConstraints(node) || node.minHeight === undefined)) {\n\t\t\tstyle.minHeight = node.height\n\t\t}\n\t}\n}\n\nfunction isAbsolutePositionedTicker(node: CanvasNode & WithPins & WithConstraints, context: CollectorContext) {\n\tif (!hasTickerEffect(node) || !withPositionType(node)) return false\n\t// We have to collect the position to know the real value for the node. It is generally collected after layout\n\t// so we can't expect it to be present in the style\n\tconst style: SerializableMotionStyle = {}\n\tcollectPosition(node, style, context)\n\n\treturn style.position === \"absolute\"\n}\n", "import { SafeJS } from \"code-generation/js/serializeJS.ts\"\nimport { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport type { SerializableMotionStyle } from \"code-generation/types.ts\"\nimport { styleCollector } from \"code-generation/utils/collector.ts\"\nimport type { MotionStyle } from \"framer-motion\"\nimport { fraction, isFractionDimension } from \"library/components/index.ts\"\nimport { DimensionType } from \"library/index.ts\"\nimport { isDynamicValue } from \"../DynamicValue.ts\"\nimport { withDOMLayout } from \"../WithDOMLayout.ts\"\nimport { isPinnable } from \"../WithPins.ts\"\nimport { withSize } from \"../WithSize.ts\"\nimport type { UnknownProps } from \"../utils/UnknownProps.ts\"\nimport { newConstraintProperties, percentage } from \"../utils/newConstraintProperties.ts\"\nimport { isPositionRelative } from \"../utils/positionTypeHelpers.ts\"\n\nexport const collectPositionRelative = styleCollector((node, style) => {\n\tif (!withDOMLayout(node)) return\n\tif (!withSize(node) || !isPositionRelative(node)) return\n\n\tconst parentIsStackOrGrid = node.cache.parentDirected === \"stack\" || node.cache.parentDirected === \"grid\"\n\tif (parentIsStackOrGrid || node.__unsafeIsSlotPropertyChildNode()) {\n\t\tstyle.position = \"relative\"\n\t}\n})\n\nexport const collectStackItemLayout = styleCollector((node, style, context) => {\n\tif (!isPinnable(node) || !withSize(node) || !node.parentid) return\n\tif (node.cache.parentDirected !== \"stack\") return\n\n\tconst constraints = newConstraintProperties(node)\n\tconst { width, height } = constraints\n\n\tstyle.alignSelf = undefined\n\n\t/**\n\t * The layout of the stack item depends on the stack direction. When the direction is dynamic, we gather both\n\t * layouts, associating them with different stack directions. This allows nodes to adapt to the appropriate layout\n\t * based on the stack direction variable. For example:\n\t * ```\n\t * // inline style\n\t * --stack-direction-var: stackDirectionVar\n\t * --width-var: stack-direction-var === \"column\" ? \"50%\" : \"1px\"\n\t *\n\t * // css\n\t * width: var(--width-var),\n\t * ```\n\t */\n\tif (isDynamicValue(node.cache.parentDirection) && isJSXContext(context)) {\n\t\tconst dynamicStackDirection = node.cache.parentDirection\n\t\tconst stackDirectionBinding = context.cssVariableDefinitions.getBindingForDynamicValue(dynamicStackDirection)\n\t\tif (!stackDirectionBinding) return\n\n\t\tif (isFractionDimension(width)) {\n\t\t\tconst condition = new SafeJS(`${stackDirectionBinding} === \"column\"`)\n\t\t\tif (node.cache.parentWidthType === DimensionType.Auto) {\n\t\t\t\tstyle.width = context.cssVariableDefinitions.createConditionVariable(node.parentid, condition, \"auto\", \"1px\")\n\t\t\t} else {\n\t\t\t\tstyle.width = context.cssVariableDefinitions.createConditionVariable(\n\t\t\t\t\tnode.parentid,\n\t\t\t\t\tcondition,\n\t\t\t\t\tpercentage(fraction(width)),\n\t\t\t\t\t\"1px\",\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\tif (isFractionDimension(height)) {\n\t\t\tconst condition = new SafeJS(`${stackDirectionBinding} === \"row\"`)\n\n\t\t\tif (node.cache.parentHeightType === DimensionType.Auto) {\n\t\t\t\tstyle.height = context.cssVariableDefinitions.createConditionVariable(node.parentid, condition, \"auto\", \"1px\")\n\t\t\t} else {\n\t\t\t\tstyle.height = context.cssVariableDefinitions.createConditionVariable(\n\t\t\t\t\tnode.parentid,\n\t\t\t\t\tcondition,\n\t\t\t\t\tpercentage(fraction(height)),\n\t\t\t\t\t\"1px\",\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\t// flex and alignSelf are collected in both fractional dimensions, they need to keep both the horizontal and\n\t\t// vertical values, instead of overwriting them.\n\n\t\tif (isFractionDimension(width) || isFractionDimension(height)) {\n\t\t\tconst condition = new SafeJS(`${stackDirectionBinding} === \"column\"`)\n\t\t\tstyle.flex = context.cssVariableDefinitions.createConditionVariable(\n\t\t\t\tnode.parentid,\n\t\t\t\tcondition,\n\t\t\t\tisFractionDimension(height) ? `${fraction(height)} 0 0px` : undefined,\n\t\t\t\tisFractionDimension(width) ? `${fraction(width)} 0 0px` : undefined,\n\t\t\t)\n\n\t\t\tconst alignSelfHorizontally = isFractionDimension(width) && node.cache.parentWidthType === DimensionType.Auto\n\t\t\tconst alignSelfVertically = isFractionDimension(height) && node.cache.parentHeightType === DimensionType.Auto\n\t\t\tif (alignSelfHorizontally && alignSelfVertically) {\n\t\t\t\tstyle.alignSelf = \"stretch\"\n\t\t\t} else if (!alignSelfHorizontally && !alignSelfVertically) {\n\t\t\t\tstyle.alignSelf = undefined\n\t\t\t} else {\n\t\t\t\tstyle.alignSelf = context.cssVariableDefinitions.createConditionVariable(\n\t\t\t\t\tnode.parentid,\n\t\t\t\t\tcondition,\n\t\t\t\t\talignSelfHorizontally ? \"stretch\" : undefined,\n\t\t\t\t\talignSelfVertically ? \"stretch\" : undefined,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\n\t// node.cache.parentDirection should be resolved outside of code generation\n\tif (isFractionDimension(width)) {\n\t\tif (node.cache.parentDirection === \"vertical\") {\n\t\t\t// \"Fill parent\" on an auto-sized axis\n\t\t\tif (node.cache.parentWidthType === DimensionType.Auto) {\n\t\t\t\tstyle.alignSelf = \"stretch\"\n\t\t\t\tstyle.width = \"auto\"\n\t\t\t} else {\n\t\t\t\tstyle.width = percentage(fraction(width))\n\t\t\t}\n\t\t} else {\n\t\t\tstyle.width = \"1px\"\n\t\t\tstyle.flex = `${fraction(width)} 0 0px`\n\t\t}\n\t}\n\n\tif (isFractionDimension(height)) {\n\t\tif (node.cache.parentDirection === \"horizontal\") {\n\t\t\t// \"Fill parent\" on an auto-sized axis\n\t\t\tif (node.cache.parentHeightType === DimensionType.Auto) {\n\t\t\t\tstyle.alignSelf = \"stretch\"\n\t\t\t\tstyle.height = \"auto\"\n\t\t\t} else {\n\t\t\t\tstyle.height = percentage(fraction(height))\n\t\t\t}\n\t\t} else {\n\t\t\tstyle.height = \"1px\"\n\t\t\tstyle.flex = `${fraction(height)} 0 0px`\n\t\t}\n\t}\n})\n\n/**\n * When rendering in the preview in legacy (non-sites) projects, the Frame API\n * is used. This means that width and height are passed to layers directly,\n * straight from the node, in unconverted format. For example `1fr` is passed\n * straight in as a string value for width/height. Previously this worked,\n * because the <Stack> component iterated through its children and checked for\n * fractional sizes, and converted that into valid CSS. With the css flexbox\n * rendering this is no longer the case.\n *\n * While this is not a problem generally, since in `FrameWithMotion`, values set\n * on `style` are the highest priority styles, in the specific case where a\n * layer has an event action or a code override, we remap `style` to\n * `_initialStyle`. Then in FrameWithMotion, we allow `_initialStyle` to be\n * overwritten by the Frame api props. This allows overrides to use the Frame\n * api consistently (at the expense of `style`):\n * https://github.com/framer/company/issues/12081\n *\n * This results in the `style.width` we set in the above\n * `collectStackItemLayout` being overwritten to `1fr` when rendering in the\n * preview, causing the width to be unset (since `1fr` is not valid css).\n *\n * This is only a problem in legacy-project preview where we don't generate and\n * compile code in the browser. In this case, we need to change potentially\n * incorrect width values that may be overridden when an override is applied to\n * the values we expect to be rendered via the provided `style` prop in all\n * other cases.\n *\n * If we at some point do one of these things, we could remove this function:\n * 1. remove the non-compiled preview\n * 2. deprecate the Frame API\n * 3. render all Frame positioning as plain css on style\n * 4. render Frames with a plain motion.div instead of a <FrameWithMotion>\n */\nexport function cleanupFramePropsForStackItemLayoutStyle(\n\tstyle: MotionStyle | SerializableMotionStyle | undefined,\n\tprops: UnknownProps,\n) {\n\tif (style?.width) props.width = style.width\n\tif (style?.height) props.height = style.height\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { isFoundAndNotUndefined } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { DynamicValue } from \"./DynamicValue.ts\"\n\nexport type TextTruncation = number | DynamicValue | undefined\nexport interface WithTextTruncation {\n\ttextTruncation: TextTruncation\n}\n\nconst key: keyof WithTextTruncation = \"textTruncation\"\n\nexport const textTruncationDefaults = {\n\ttextTruncation: undefined,\n} as const satisfies WithTextTruncation\n\nexport const textTruncationAddedDefaults = {\n\ttextTruncation: 1,\n} as const satisfies WithTextTruncation\n\nexport function withTextTruncation(node: CanvasNode): node is CanvasNode & WithTextTruncation {\n\treturn key in node\n}\n\nexport function hasTextTruncation(textTruncation: Reduced<TextTruncation | undefined>) {\n\treturn isFoundAndNotUndefined(textTruncation)\n}\n", "import type { LocalizedSize } from \"document/models/LocalizedValue.ts\"\nimport type { Size } from \"library/render/types/Size.ts\"\nimport type { CanvasNode } from \"../index.ts\"\n\nexport interface WithTextFit {\n\ttextFitViewBoxSize: Size | undefined\n\ttextFitViewBoxSizeLocalized: LocalizedSize | undefined\n\ttextFitScale: number | undefined\n}\n\nexport const textFitDefaults = {\n\ttextFitViewBoxSize: undefined,\n\ttextFitViewBoxSizeLocalized: undefined,\n\ttextFitScale: undefined,\n} satisfies WithTextFit\n\nconst key: keyof WithTextFit = \"textFitViewBoxSize\"\n\nexport function withTextFit<T extends CanvasNode>(node: T): node is T & WithTextFit {\n\treturn key in node\n}\n\nexport function hasTextFit<T extends CanvasNode>(node: T): node is T & WithTextFit & { textFitViewBoxSize: Size } {\n\treturn withTextFit(node) && Boolean(node.textFitViewBoxSize)\n}\n\nexport function svgViewBoxFromSize(size: Size) {\n\treturn `0 0 ${size.width} ${size.height}`\n}\n", "import type { CanvasNode } from \"../nodes/CanvasNode.ts\"\n\nexport interface WithTextWrapBalance {\n\ttextWrapBalance: boolean | undefined\n}\n\nexport const textWrapBalanceDefaults: WithTextWrapBalance = {\n\ttextWrapBalance: undefined,\n}\n\nexport const textWrapBalanceAddedDefaults: WithTextWrapBalance = {\n\ttextWrapBalance: true,\n}\n\nconst textWrapBalanceKey: keyof WithTextWrapBalance = \"textWrapBalance\"\n\nexport function withTextWrapBalance<T extends CanvasNode>(node: T): node is T & WithTextWrapBalance {\n\treturn textWrapBalanceKey in node\n}\n", "import { styleCollector } from \"code-generation/utils/collector.ts\"\nimport { isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { hasTextTruncation, withTextTruncation } from \"document/models/CanvasTree/traits/WithTextTruncation.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { isAnyTextNode } from \"../../nodes/utils/isAnyTextNode.ts\"\nimport { isVariableReference } from \"../VariableReference.ts\"\nimport { supportsSizeConstraints } from \"../WithSizeConstraints.ts\"\nimport { withTextFit } from \"../WithTextFit.ts\"\nimport { withTextWrapBalance } from \"../WithTextWrapBalance.ts\"\n\nexport const collectTextWrapBalance = styleCollector((node, style) => {\n\tif (!withTextWrapBalance(node)) return\n\tif (isRichTextNode(node) && isVariableReference(node.htmlContent)) return\n\tstyle[\"--framer-text-wrap\"] = node.textWrapBalance ? \"balance\" : undefined\n})\n\nexport const collectTextWrap = styleCollector((node, style) => {\n\tif (!isAnyTextNode(node)) return\n\n\tconst hasRichTextVariable = isRichTextNode(node) && isVariableReference(node.htmlContent)\n\n\tif (!hasRichTextVariable) {\n\t\t// If text is fit text, its whitespace is always pre.\n\t\tif (withTextFit(node) && node.textFitViewBoxSize) {\n\t\t\tstyle.whiteSpace = \"pre\"\n\t\t\treturn\n\t\t}\n\n\t\tstyle.textWrap = undefined\n\t\tif (withTextWrapBalance(node)) {\n\t\t\tconst hasTextWrapBalance =\n\t\t\t\t!isUndefined(node.textWrapBalance) &&\n\t\t\t\tisRichTextNode(node) &&\n\t\t\t\t// This method is expensive, so we only call it if we need to.\n\t\t\t\tnode.hasTextStylePresets(false)\n\n\t\t\tif (hasTextWrapBalance) {\n\t\t\t\tstyle[\"--framer-text-wrap-override\"] = node.textWrapBalance ? \"balance\" : \"none\"\n\t\t\t} else {\n\t\t\t\tstyle[\"--framer-text-wrap\"] = node.textWrapBalance ? \"balance\" : undefined\n\t\t\t}\n\n\t\t\tif (hasTextWrapBalance) return\n\t\t}\n\t}\n\n\tconst isWidthConstrained = supportsSizeConstraints(node) && node.maxWidth !== undefined\n\n\t// Text shouldn't wrap when it's set to auto-width, but is allowed to break\n\t// a word in the middle otherwise\n\tif (isWidthConstrained || node.widthType !== DimensionType.Auto) {\n\t\tif (withTextTruncation(node) && hasTextTruncation(node.textTruncation)) {\n\t\t\t/**\n\t\t\t * If text is truncated, disable whitespace preservation due to ellipsis misalignment,\n\t\t\t * but allow text to wrap, at least until this is improved in the CSS spec. This is a\n\t\t\t * trade-off since we would like to retain whitespace preservation, so that the editor\n\t\t\t * always matches the rendered text.\n\t\t\t * @see https://github.com/w3c/csswg-drafts/issues/12008\n\t\t\t * @see https://developer.mozilla.org/en-US/docs/Web/CSS/white-space#values\n\t\t\t * */\n\t\t\tstyle.whiteSpace = \"pre-line\"\n\t\t} else {\n\t\t\t// Otherwise, preserve whitespaces and wrap the text.\n\t\t\tstyle.whiteSpace = \"pre-wrap\"\n\t\t}\n\n\t\tstyle.wordWrap = \"break-word\"\n\n\t\t// Needed by WebKit to force resizing behavior similar to\n\t\t// `overflow-wrap: anywhere`, which isn't supported by WebKit\n\t\tstyle.wordBreak = \"break-word\"\n\t} else {\n\t\t// Still need to preserve white-space runs in case people use tabs /\n\t\t// multiple spaces in a row\n\t\tstyle.whiteSpace = \"pre\"\n\t}\n})\n", "/**\n * Returns a css calculation for 1fr type units when used on ticker children.\n */\nexport function tickerItemFractionalUnitFallback(length: number) {\n\treturn `calc((100% - var(--ticker-total-not-fr,0px) - (var(--ticker-gap,0px) * (var(--ticker-cms-total-children, var(--ticker-total-children,1)) - 1))) / (var(--ticker-total-fr,1) * var(--ticker-cms-total-children,1)) * ${length})`\n}\n", "import { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport { styleCollector } from \"code-generation/utils/collector.ts\"\nimport { DimensionType } from \"library/index.ts\"\nimport { withSize } from \"../WithSize.ts\"\nimport { withSizeDimensionType } from \"../WithSizeDimensionType.ts\"\nimport { isNodeTickerItem } from \"../WithTickerEffect.ts\"\nimport { tickerItemFractionalUnitFallback } from \"../utils/tickerItemFractionalUnitFallback.ts\"\n\n/**\n * Ticker items are rendered as children of TickerItem, so width and height may be hoisted from the generated element\n * to TickerItem. In the case that dimensions are hoisted we have to override the collected properties to maintain the\n * expected layout.\n */\nexport const collectTickerItemLayoutOverrides = styleCollector((node, style, context) => {\n\tif (!isNodeTickerItem(node)) return\n\tif (!withSize(node) || !withSizeDimensionType(node)) return\n\n\tif (!isJSXContext(context)) {\n\t\t// on canvas we apply the converted fractional sizing to the element itself so that the rendering is more representative of\n\t\t// the actual sizing in the preview even though we are just rendering the ticker as a regular stack\n\t\tif (node.widthType === DimensionType.FractionOfFreeSpace && node.cache.parentDirection === \"horizontal\") {\n\t\t\tstyle.width = tickerItemFractionalUnitFallback(node.width)\n\t\t\t// kill the standard flex growth behavior\n\t\t\tstyle.flex = \"0 0 auto\"\n\t\t}\n\n\t\tif (node.heightType === DimensionType.FractionOfFreeSpace && node.cache.parentDirection === \"vertical\") {\n\t\t\tstyle.height = tickerItemFractionalUnitFallback(node.height)\n\t\t\t// kill the standard flex growth behavior\n\t\t\tstyle.flex = \"0 0 auto\"\n\t\t}\n\t\treturn\n\t}\n\n\t// ticker items will be wrapped in TickerItem which will handle the sizing if using percentage or fractional units, so we set the size to 100% to fill the\n\t// element rendered by TickerItem. For other units the TickerItem element will size based on the contents instead.\n\tif (node.widthType === DimensionType.Percentage || node.widthType === DimensionType.FractionOfFreeSpace) {\n\t\tstyle.width = \"100%\"\n\t}\n\tif (node.heightType === DimensionType.Percentage || node.heightType === DimensionType.FractionOfFreeSpace) {\n\t\tstyle.height = \"100%\"\n\t}\n})\n", "import { assertNever } from \"@framerjs/shared\"\nimport type { SerializableValue } from \"code-generation/js/SerializableValue.ts\"\nimport { jst } from \"code-generation/js/js.ts\"\nimport { styleCollector } from \"code-generation/utils/collector.ts\"\nimport type { WithPins } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport { isPinnable } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport type { WithSize } from \"document/models/CanvasTree/traits/WithSize.ts\"\nimport { withSize } from \"document/models/CanvasTree/traits/WithSize.ts\"\nimport { collectPosition } from \"document/models/CanvasTree/traits/collectStyles/collectPosition.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { FormInputStyleVariableNames } from \"library/render/presentation/Forms/shared.ts\"\nimport { DimensionType, isAutoDimensionType } from \"library/render/types/Constraints.ts\"\nimport { isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { isVectorNode } from \"../../nodes/TreeNode.ts\"\nimport { isAnyTextNode } from \"../../nodes/utils/isAnyTextNode.ts\"\nimport { isVectorInstance } from \"../../nodes/utils/nodeCheck.ts\"\nimport { hasFloatingPosition } from \"../WithFloatingPosition.ts\"\nimport { supportsSizeConstraints } from \"../WithSizeConstraints.ts\"\nimport { withFormInput } from \"../forms/WithFormInput.ts\"\nimport type { CSSDimension } from \"../utils/CSSDimension.ts\"\nimport { hasLockedAspectRatio } from \"../utils/layoutSupportsAspectRatio.ts\"\nimport { newConstraintProperties, pixels } from \"../utils/newConstraintProperties.ts\"\nimport { isPositionFixed } from \"../utils/positionTypeHelpers.ts\"\nimport { VIEWPORT_HEIGHT_CSS_PROPERTY, getCalculatedVHWithFallback } from \"../utils/viewportHelpers.ts\"\nimport { collectAspectRatio } from \"./collectAspectRatio.ts\"\nimport { collectStackAndGridAutoSize } from \"./collectStackAndGridAutoSize.ts\"\nimport { collectStackItemLayout } from \"./collectStackItemLayout.ts\"\nimport { collectTextWrap } from \"./collectTextWrap.ts\"\nimport { collectTickerItemLayoutOverrides } from \"./collectTickerItemLayoutOverrides.ts\"\n\nfunction valueOrDefault(value: string | number | undefined, defaultValue?: string | number) {\n\tif (isUndefined(value)) return defaultValue\n\treturn value\n}\n\nexport const collectLayout = styleCollector((node, style, context) => {\n\tif (!withSize(node)) return\n\n\tconst isRoot = node.id === context.rootId\n\tconst isGroundNode = isRoot || node.__unsafeIsGroundNode() || node.__unsafeIsSlotPropertyChildNode()\n\n\tif (isVectorNode(node)) {\n\t\tconst props = node.getProps(context.componentLoader)\n\t\tObject.assign(style, {\n\t\t\twidth: props.width,\n\t\t\theight: props.height,\n\t\t\tleft: props.left,\n\t\t\ttop: props.top,\n\t\t})\n\n\t\t// VECTOR @TODO: cover tests\n\t\tif (!isGroundNode) collectPosition(node, style, context)\n\t\treturn\n\t}\n\n\tif (!isPinnable(node)) return\n\tconst constraints = newConstraintProperties(node)\n\tconst defaultValue = undefined\n\tconst { center, width, height, top, right, bottom, left } = constraints\n\n\t// Normally we can just collect vh unit as idiomatic CSS value, but vh nodes\n\t// in a generated smart component need to response to the viewport height\n\t// provided by the closest provider (variant/breakpoint) on the canvas.\n\t// Therefore, we collect the height incorporating the possible canvas\n\t// viewport height only for smart component descendants.\n\tconst isSmartComponent = context.scopeType === ScopeType.SmartComponent\n\tconst size: React.CSSProperties = {\n\t\twidth: valueOrDefault(width, defaultValue),\n\t\theight: valueOrDefault(isSmartComponent ? getCalculatedVHWithFallback(height) : height, defaultValue),\n\t}\n\n\tif (isGroundNode && context.scopeType === ScopeType.LayoutTemplate) {\n\t\tsize.height = \"min-content\"\n\t\tsize.width = \"100%\"\n\t}\n\n\tObject.assign(style, size)\n\n\t// When the input wrapper element is fixed-height, the input should stretch to fill the wrapper (with height: 100%,\n\t// which we use as the fallback for the variable). If the wrapper is auto-height, the input should not have 100%\n\t// height, otherwise plain text inputs won't grow with the line-height. We use the css variable to achieve this.\n\tif (withFormInput(node)) Object.assign(style, getFormInputWrapperHeight(size.height))\n\n\t// Auto-sized stacks use `width: min-content`, instead of `width:\n\t// auto`, so we'll override the `width/height` from\n\t// `newConstraintProperties` here (see the function itself for more\n\t// detail about why this is needed).\n\tcollectStackAndGridAutoSize(node, style, context)\n\n\tif (!isGroundNode && !hasFloatingPosition(node)) {\n\t\tObject.assign(style, {\n\t\t\tright: valueOrDefault(right, defaultValue),\n\t\t\tbottom: valueOrDefault(bottom, defaultValue),\n\t\t\tleft: valueOrDefault(left, defaultValue),\n\t\t\ttop: valueOrDefault(top, defaultValue),\n\t\t\tflex: \"none\", // same as flex: \"0 0 auto\", but shorter\n\t\t})\n\n\t\t// Elements with \"auto\" dimensions cannot be centered with CSS calc, since\n\t\t// calc(left - auto/2) is not valid.\n\t\tif (!centersWithTransforms(node) && center !== undefined) {\n\t\t\tif (center === true || center === \"x\") {\n\t\t\t\tconst calcWidth = typeof width === \"number\" ? pixels(width) : width\n\t\t\t\tconst [min, max] = supportsSizeConstraints(node) ? [node.minWidth, node.maxWidth] : []\n\t\t\t\tstyle.left = createCenteringCalc(left, calcWidth, min, max)\n\t\t\t}\n\t\t\tif (center === true || center === \"y\") {\n\t\t\t\tconst calcHeight = typeof height === \"number\" ? pixels(height) : height\n\t\t\t\tconst [min, max] = supportsSizeConstraints(node) ? [node.minHeight, node.maxHeight] : []\n\t\t\t\tstyle.top = createCenteringCalc(top, calcHeight, min, max)\n\t\t\t}\n\t\t}\n\n\t\t// Rotation, perspective, and transform centering are included together\n\t\t// in webpages and in plain HTML elements.\n\t\tstyle.transform =\n\t\t\tcontext.scopeType === ScopeType.WebPage || context.nodeRendersWithMotion?.get(node) === false\n\t\t\t\t? transformForLayout(centersWithTransforms(node) ? center : undefined)\n\t\t\t\t: undefined\n\n\t\tcollectStackItemLayout(node, style, context)\n\n\t\tif (isAnyTextNode(node)) collectTextWrap(node, style, context)\n\n\t\t// Ensure that position:fixed layers in Layout Templates pin to the\n\t\t// viewport line on the canvas.\n\t\tif (context.scopeType === ScopeType.LayoutTemplate) collectFixedPositionCustomPropertyOverrides(node, style)\n\n\t\tif (isVectorInstance(node)) {\n\t\t\t// Vector instances don't have a container, rendering the `svg` element directly. The\n\t\t\t// SVG has its own size in its style, so we have to remove the auto value to allow the\n\t\t\t// actual auto size to be applied.\n\t\t\tif (style.width === \"auto\") style.width = undefined\n\t\t\tif (style.height === \"auto\") style.height = undefined\n\t\t\t// SVG elements must have a width value, otherwise will render at 100%. To guarantee\n\t\t\t// this works with opposing x axis pins, we have to create a calculated width.\n\t\t\tif (isNumber(left) && isNumber(right)) style.width = `calc(100% - ${left + right}px)`\n\t\t}\n\t}\n\n\t// Position must be collected after layout, as position: sticky layers can\n\t// modify top/left/right/bottom.\n\tif (!isGroundNode) collectPosition(node, style, context)\n\n\t// Ensure aspect ratio is always collected after all other layout styles to ensure it can safely\n\t// remove width, height, or bottom depending on which axis is determined by the ratio. Checking\n\t// if it's a root node here because doing it in `layoutSupportsAspectRatio` was resulting in a\n\t// crash as of 2026-01-28.\n\tif ((node.originalid ?? node.id) !== context.rootId) collectAspectRatio(node, style, context)\n\n\t// Ensure overrides for ticker items are collected after all other layout styles as they can modify the collected dimensions\n\tcollectTickerItemLayoutOverrides(node, style, context)\n})\n\n/**\n * On the canvas position:fixed; layers are rendered with position: absolute;\n * and sizes/inset values that are relative to the size of the viewport are\n * instead relative to the viewport line that users can reposition on the canvas\n * to simulated different viewport sizes. Normally these special calculated\n * values are only used on the canvas and not in code generation. However in\n * Layout Templates, these values are code-generated so that the layout template\n * instance rendered around a webpage breakpoint on the canvas reacts to the\n * viewport line like other layers.\n */\nexport function collectFixedPositionCustomPropertyOverrides(node: CanvasNode, target: Record<string, unknown>) {\n\tif (!isPositionFixed(node) || !isPinnable(node)) return\n\tconst constraints = newConstraintProperties(node)\n\n\tif (isNumber(constraints.bottom)) target.bottom = canvasCalculatedBottom(constraints.bottom)\n\tconst centeredOnYAxis = constraints.center === true || constraints.center === \"y\"\n\tif (centeredOnYAxis) target.top = canvasCalculatedTopOrRelativeHeight(node.centerAnchorY)\n\tif (node.heightType === DimensionType.Percentage) target.height = canvasCalculatedTopOrRelativeHeight(node.height)\n\tif (node.heightType === DimensionType.Viewport) target.height = canvasCalculatedViewHeight(node.height)\n}\n\nconst viewportHeight = VIEWPORT_HEIGHT_CSS_PROPERTY\nfunction canvasCalculatedBottom(bottom: number) {\n\t// On the canvas, VIEWPORT_HEIGHT_CSS_PROPERTY will be defined and evaluate\n\t// to the offset from the top of the ground node where the viewport would\n\t// end.\n\tconst canvasVar = `var(${viewportHeight}, 100%)`\n\t// To ensure the viewport is never larger than the ground node, clamp it to\n\t// be max 100% of the ground node.\n\tconst clampViewportHeightToPageHeight = `min(${canvasVar}, 100%)`\n\t// The above value is only appropriate to use for top, but we want to use it\n\t// for bottom. To make that work subtract that number again from 100% of the\n\t// ground node height. Outside of the canvas -- where `canvasVar` evaluates\n\t// to 100% -- this will resolve to 0.\n\tconst offsetViewportHeightFromBottom = `calc(100% - ${clampViewportHeightToPageHeight})`\n\t// Finally add the desired offset from the bottom to the calculated value.\n\t// Outside the canvas this will just evaluate to `{bottom}px`.\n\treturn `calc(${offsetViewportHeightFromBottom} + ${bottom}px)`\n}\n\nfunction canvasCalculatedTopOrRelativeHeight(value: number) {\n\tconst canvasVar = `var(${viewportHeight}, 100%)`\n\tconst clamp = `min(${canvasVar}, 100%)`\n\treturn `calc(${clamp} * ${value})`\n}\n\nfunction canvasCalculatedViewHeight(height: number) {\n\tconst canvasVar = `var(${viewportHeight}, 100vh)`\n\tconst clamp = `min(${canvasVar}, 100%)`\n\treturn `calc(${clamp} * ${height})`\n}\n\nfunction constrainMinSize(min: CSSDimension | number | undefined, value: unknown) {\n\tif (isUndefined(min)) return value\n\tif (isNumber(min)) return `max(${min}px, ${value})`\n\n\treturn `max(${min}, ${value})`\n}\n\nfunction constrainMaxSize(max: CSSDimension | number | undefined, value: unknown) {\n\tif (isUndefined(max)) return value\n\tif (isNumber(max)) return `min(${max}px, ${value})`\n\n\treturn `min(${max}, ${value})`\n}\n\n// We cannot simply divide the size by 2 to get half the size of the element.\n// The element may be constrained by min/max, and thus may not be rendering at\n// the prescribed size. However, we can use css min and max functions to clamp\n// that value the same way the element is being rendered, letting us properly\n// divide it by 2 to determine half its rendered size for centering.\nfunction createCenteringCalc(\n\tcoordinate: string | number | undefined,\n\tsize: string | number | undefined,\n\tmin: CSSDimension | number | undefined,\n\tmax: CSSDimension | number | undefined,\n) {\n\tconst trueSize = constrainMaxSize(max, constrainMinSize(min, size))\n\treturn `calc(${coordinate} - ${trueSize} / 2)`\n}\n\nexport function centersWithTransforms(node: CanvasNode & WithSize & WithPins): boolean {\n\treturn isAutoDimensionType(node.widthType) || isAutoDimensionType(node.heightType) || hasLockedAspectRatio(node)\n}\n\nexport function createCenteringTransform(center: true | \"x\" | \"y\"): string {\n\tswitch (center) {\n\t\tcase true:\n\t\t\treturn `translate(-50%, -50%)`\n\t\tcase \"x\":\n\t\t\treturn `translateX(-50%)`\n\t\tcase \"y\":\n\t\t\treturn `translateY(-50%)`\n\t\tdefault:\n\t\t\tassertNever(center)\n\t}\n}\n\nfunction transformForLayout(centerType: \"x\" | \"y\" | boolean | undefined) {\n\tconst transforms: SerializableValue[] = []\n\tif (centerType) transforms.push(createCenteringTransform(centerType))\n\n\tif (transforms.length > 0) return jst.join(transforms, \" \")\n\treturn undefined\n}\n\nexport function getFormInputWrapperHeight(height: unknown) {\n\t// When the input wrapper element is fixed-height, the input should stretch to fill the wrapper (with height: 100%,\n\t// which we use as the fallback for the variable). If the wrapper is auto-height, the input should not have 100%\n\t// height, otherwise plain text inputs won't grow with the line-height. We use the css variable to achieve this.\n\treturn { [FormInputStyleVariableNames.WrapperHeight]: height === \"auto\" ? \"auto\" : undefined }\n}\n", "import { isArray, isNumber } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { withStyleAppearPageEffect } from \"../WithStyleAppearEffect.ts\"\nimport { withStyleTransformEffect } from \"../WithStyleTransformEffect.ts\"\n\n/**\n * Perspective used to be defined across multiple effect configurations. This\n * created problems when multiple effects set perspective, because we wouldn't\n * know which to choose.\n *\n * We can move this logic to a migration.\n */\nexport function getFallbackPerspective(node: CanvasNode) {\n\tif (withStyleAppearPageEffect(node) && node.styleAppearEffectEnabled) {\n\t\tconst enterEffectPerspective = node.enterEffectPerspective\n\t\tif (isNumber(enterEffectPerspective) && enterEffectPerspective > 0) {\n\t\t\treturn enterEffectPerspective\n\t\t}\n\t\tconst styleAppearEffectPerspective = node.styleAppearEffectPerspective\n\t\tif (isNumber(styleAppearEffectPerspective) && styleAppearEffectPerspective > 0) {\n\t\t\treturn styleAppearEffectPerspective\n\t\t}\n\t\tconst exitEffectPerspective = node.exitEffectPerspective\n\t\tif (isNumber(exitEffectPerspective) && exitEffectPerspective > 0) {\n\t\t\treturn exitEffectPerspective\n\t\t}\n\t}\n\n\tif (\n\t\twithStyleTransformEffect(node) &&\n\t\tnode.styleTransformEffectEnabled &&\n\t\tisArray(node.styleTransformEffectScrollTargets)\n\t) {\n\t\tfor (const target of node.styleTransformEffectScrollTargets) {\n\t\t\tconst value = target.style.transformPerspective\n\t\t\tif (isNumber(value) && value > 0) return value\n\t\t}\n\t}\n\n\treturn undefined\n}\n", "import type { JSXContext } from \"code-generation/jsx/types.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { hasFloatingPosition } from \"../WithFloatingPosition.ts\"\nimport { hasStyleAppearEffect, isEnterLoadEffect } from \"../WithStyleAppearEffect.ts\"\nimport { isSupportedEffectScopeType } from \"./effects.ts\"\n\nexport function supportsAppearEffectOptimization(node: CanvasNode, context: JSXContext) {\n\t// We don't optimize appear animations on/in overlays yet, since overlays\n\t// cannot be visible until after React hydrates, meaning the \"optimization\"\n\t// would not provide any benefits.\n\tif (node.cache.overlayAncestorId) return false\n\tif (!isSupportedEffectScopeType(context.scopeType)) return false\n\tif (hasFloatingPosition(node)) return false\n\treturn true\n}\n\nexport function hasOptimizedAppearEffect(node: CanvasNode, ctx: JSXContext) {\n\treturn supportsAppearEffectOptimization(node, ctx) && hasStyleAppearEffect(node) && isEnterLoadEffect(node)\n}\n", "import { isNumber } from \"@framerjs/assets/src/utils.ts\"\nimport { Var } from \"code-generation/components/GeneratedVariantComponentVars.ts\"\nimport { js, jst } from \"code-generation/js/js.ts\"\nimport type { SafeJS } from \"code-generation/js/serializeJS.ts\"\nimport { isSafeJS } from \"code-generation/js/serializeJS.ts\"\nimport type { JSXContext } from \"code-generation/jsx/types.ts\"\nimport { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport type { SerializableMotionStyle } from \"code-generation/types.ts\"\nimport type { CollectorContext } from \"code-generation/utils/collector.ts\"\nimport { propCollector } from \"code-generation/utils/collector.ts\"\nimport { toMotionTransition } from \"document/models/Transition.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { upperCaseFirstChar } from \"utils/names.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { isDynamicValue } from \"../DynamicValue.ts\"\nimport { withOpacity } from \"../WithOpacity.ts\"\nimport { isPinnable } from \"../WithPins.ts\"\nimport { withRotation } from \"../WithRotation.ts\"\nimport { withSize } from \"../WithSize.ts\"\nimport type { WithStyleAppearEffect } from \"../WithStyleAppearEffect.ts\"\nimport {\n\tfallbackEffectTransition,\n\thasStyleAppearEffect,\n\tisEnterLoadEffect,\n\twithStyleAppearPageEffect,\n} from \"../WithStyleAppearEffect.ts\"\nimport { withTransforms } from \"../WithTransforms.ts\"\nimport { isVariant } from \"../WithVariant.ts\"\nimport { centersWithTransforms, createCenteringTransform } from \"../collectStyles/collectLayout.ts\"\nimport { EffectTrigger, effectTriggerStringToEnumMember } from \"../utils/EffectTrigger.ts\"\nimport { createStaggerTransition } from \"../utils/createStaggerTransition.ts\"\nimport { effectHas3DRotation, getAdditiveEffectRotation, isSupportedEffectScopeType } from \"../utils/effects.ts\"\nimport { getFallbackPerspective } from \"../utils/getFallbackPerspective.ts\"\nimport { newConstraintProperties } from \"../utils/newConstraintProperties.ts\"\nimport {\n\thasOptimizedAppearEffect,\n\tsupportsAppearEffectOptimization,\n} from \"../utils/supportsAppearEffectOptimization.ts\"\n\nfunction opacity(node: CanvasNode, ctx: JSXContext) {\n\tif (!withOpacity(node)) return 1\n\treturn isDynamicValue(node.opacity)\n\t\t? ctx.createDeduplicatedDynamicValueBinding(node.opacity, node, \"opacity\")\n\t\t: (node.resolveValue(\"opacity\") ?? 1)\n}\n\nfunction rotate(node: CanvasNode, ctx: JSXContext) {\n\tif (!withRotation(node)) return 0\n\treturn isDynamicValue(node.rotation)\n\t\t? ctx.createDeduplicatedDynamicValueBinding(node.rotation, node, \"rotation\")\n\t\t: node.resolveValue(\"rotation\")\n}\n\n/**\n * Normally, perspectives are applied via inline style, which Motion then applies to the transform. Therefore,\n * collecting transformPerspective here is usually a no-op. However, for optimized appear animations, we need to\n * generate the perspective into the transform keyframe, as the style transform will be overwritten by the generated\n * keyframe.\n */\nfunction transformPerspective(node: CanvasNode, ctx: CollectorContext | undefined) {\n\tif (!withTransforms(node)) return\n\tif (isNumber(node.perspective)) return node.perspective\n\n\tif (isDynamicValue(node.perspective) && isJSXContext(ctx)) {\n\t\treturn ctx.createDeduplicatedDynamicValueBinding(node.perspective, node, \"perspective\")\n\t}\n\n\tconst fallbackPerspective = getFallbackPerspective(node)\n\tif (isNumber(fallbackPerspective)) {\n\t\treturn fallbackPerspective\n\t}\n}\n\nfunction effectIdentity(node: CanvasNode, ctx: JSXContext, transition: SafeJS | undefined): SerializableMotionStyle {\n\tconst isGroundNode = node.id === ctx.rootId || node.__unsafeIsGroundNode()\n\n\treturn {\n\t\tx: 0,\n\t\ty: 0,\n\t\topacity: opacity(node, ctx),\n\t\trotate: rotate(node, ctx),\n\t\tscale: withTransforms(node) && !isGroundNode ? (node.scale ?? 1) : 1,\n\t\trotateX: withTransforms(node) && !isGroundNode ? (node.rotate3d ? (node.rotateX ?? 0) : 0) : 0,\n\t\trotateY: withTransforms(node) && !isGroundNode ? (node.rotate3d ? (node.rotateY ?? 0) : 0) : 0,\n\t\tskewX: withTransforms(node) && !isGroundNode ? (node.skewX ?? 0) : 0,\n\t\tskewY: withTransforms(node) && !isGroundNode ? (node.skewY ?? 0) : 0,\n\t\ttransformPerspective: transformPerspective(node, ctx),\n\t\ttransition,\n\t}\n}\n\nfunction createTransformTemplate(node: CanvasNode, context: JSXContext): SafeJS | undefined {\n\tlet center: boolean | \"x\" | \"y\" | undefined = undefined\n\tif (isPinnable(node) && withSize(node) && centersWithTransforms(node)) {\n\t\tcenter = newConstraintProperties(node).center\n\t}\n\n\t// If all of the transformed values are falsy, a transform template is not\n\t// required.\n\tif (!center) return undefined\n\n\tconst t = js`t`\n\tconst items: (SafeJS | string)[] = []\n\t// Add the transforms in a specific order to match framer-motion's transform\n\t// string creation.\n\n\t// 1. If we are creating a transformTemplate for the root element,\n\t//    incorporate any transformTemplate that may be provided as a prop first\n\t//    by calling the provided function, and inlining the value as an\n\t//    expression to the template string.\n\tif (isVariant(node)) {\n\t\tconst externalTransforms = context.declarations.component.dedupe(\n\t\t\t\"transforms\",\n\t\t\tjs`${Var.restProps}.${Var.transformTemplate}?.(undefined, \"\") ?? \"\"`,\n\t\t)\n\t\titems.push(externalTransforms)\n\t}\n\t// 2. Add centering transforms.\n\titems.push(createCenteringTransform(center))\n\t// 3. Inject the transforms provided by framer-motion into the template string.\n\titems.push(t)\n\n\tconst transformTemplate = js`(_, ${t}) => ${jst.join(items, \" \")}`\n\n\t// If rotation is a variable, we must inline the transform template because\n\t// we need the binding to be in scope. It could come from a Data Repeater,\n\t// not the props of the component.\n\tif (isVariant(node)) return transformTemplate\n\n\t// Otherwise we can lift the transformTemplate function to the file, and\n\t// deduplicate identical functions to save on file size.\n\treturn context.declarations.file.dedupe(\"transformTemplate\", transformTemplate)\n}\n\nfunction createAnimate(node: CanvasNode, context: JSXContext) {\n\tif (\n\t\t!isSupportedEffectScopeType(context.scopeType) ||\n\t\t!hasStyleAppearEffect(node) ||\n\t\teffectTriggerStringToEnumMember(node.styleAppearEffectTrigger) !== EffectTrigger.OnMount\n\t) {\n\t\treturn undefined\n\t}\n\n\tconst baseTransition = context.declarations.file.dedupe(\n\t\t\"transition\",\n\t\ttoMotionTransition(node.enterEffectTransition ?? node.styleAppearEffectTransition ?? fallbackEffectTransition),\n\t)\n\n\tconst { transition, needsIndexBinding } = createStaggerTransition(node, baseTransition, context)\n\n\tconst identity = effectIdentity(node, context, transition)\n\n\t// If opacity, rotation, or perspective are variables we can't lift the animation to\n\t// a constant in the file.\n\tif (isSafeJS(identity.opacity)) return identity\n\tif (isSafeJS(identity.rotate)) return identity\n\tif (isSafeJS(identity.transformPerspective)) return identity\n\n\t// Transitions with index bindings can't be lifted to file scope\n\tif (needsIndexBinding && isSafeJS(identity.transition)) return identity\n\n\treturn context.declarations.file.dedupe(\"animation\", identity)\n}\n\nfunction overrideOpacityTo0001(animationProps: SerializableMotionStyle) {\n\tif (animationProps.opacity === 0) {\n\t\t// As of end of 2022, Google Chrome delays LCP for fully transparent elements (until they transition into full visibility): https://bugs.chromium.org/p/chromium/issues/detail?id=1092473#c29:\n\t\t// > Tue, Aug 4, 2020\n\t\t// > [LCP] Ignore paints with opacity 0\n\t\t//\n\t\t// To work around this, we set the opacity to 0.001 instead of 0.\n\t\t// THIS IS A HACK:\n\t\t// - It doesn\u2019t improve the user experience, but merely plays metrics (which may still be useful for customers\u2019 SEO)\n\t\t// - It may stop working later if Chrome catches up with this\n\t\t//\n\t\t// opacity: 0.001 is a manually picked value that makes a black rectangle fully invisible on a white background. (opacity: 0.1 and opacity: 0.01 are not enough for that.)\n\n\t\t// This hack also fixes a WAAPI bug in chrome where the on mount appear animation can finish before the browser\n\t\t// is able to paint the element. https://bugs.chromium.org/p/chromium/issues/detail?id=1406850\n\t\tanimationProps.opacity = 0.001\n\t}\n}\n\nexport function getMotionInitialStyle(\n\tnode: CanvasNode & WithStyleAppearEffect,\n\tctx?: CollectorContext,\n): SerializableMotionStyle {\n\tconst rotate = getAdditiveEffectRotation(\n\t\tnode,\n\t\tnode.enterEffectRotateAdditiveDynamicValue,\n\t\tnode.enterEffectRotate ?? node.styleAppearEffectRotate,\n\t\tctx,\n\t)\n\n\tconst rotate3d = effectHas3DRotation(node.enterEffectRotate3d)\n\n\treturn {\n\t\tx: node.enterEffectX ?? node.styleAppearEffectX ?? 0,\n\t\ty: node.enterEffectY ?? node.styleAppearEffectY ?? 0,\n\t\tscale: node.enterEffectScale ?? node.styleAppearEffectScale ?? 1,\n\t\topacity: node.enterEffectOpacity ?? node.styleAppearEffectOpacity ?? 1,\n\t\tskewX: node.enterEffectSkewX ?? 0,\n\t\tskewY: node.enterEffectSkewY ?? 0,\n\t\trotate,\n\t\trotateX: rotate3d ? (node.enterEffectRotateX ?? node.styleAppearEffectRotateX ?? 0) : 0,\n\t\trotateY: rotate3d ? (node.enterEffectRotateY ?? node.styleAppearEffectRotateY ?? 0) : 0,\n\t\ttransformPerspective: transformPerspective(node, ctx),\n\t}\n}\n\nfunction createInitial(node: CanvasNode, context: JSXContext) {\n\tif (\n\t\t!isJSXContext(context) ||\n\t\t!isSupportedEffectScopeType(context.scopeType) ||\n\t\t!hasStyleAppearEffect(node) ||\n\t\t!isEnterLoadEffect(node)\n\t) {\n\t\treturn undefined\n\t}\n\n\tconst initial = getMotionInitialStyle(node, context)\n\tif (supportsAppearEffectOptimization(node, context)) overrideOpacityTo0001(initial)\n\n\tif (isSafeJS(initial.rotate)) return initial\n\tif (isSafeJS(initial.transformPerspective)) return initial\n\treturn context.declarations.file.dedupe(\"animation\", initial)\n}\n\n/**\n * When a Smart Component ground node has an appear effect, we have to prefix\n * the key with __framer__presence* to avoid overwriting the `initial` and `animate`\n * props that control the Smart Component variants.\n */\nexport function prefixIncompatibleMotionKey(\n\tnode: CanvasNode,\n\tcontext: JSXContext,\n\tkey: \"animate\" | \"initial\" | \"exit\",\n): string {\n\tif (context.scopeType === ScopeType.SmartComponent && isVariant(node)) {\n\t\treturn `__framer__presence${upperCaseFirstChar(key)}`\n\t}\n\n\treturn key\n}\n\n/**\n * Collect all motion props that require collection to support optimized appear\n * effects.\n *\n * These are currently: `initial`, `animate`, and `transformTemplate`.\n */\nexport const collectOptimizedMotionProps = propCollector((node, props, context) => {\n\tif (!isJSXContext(context)) return\n\tif (context.nodeRendersWithMotion.get(node) === false) return\n\n\tprops.transformTemplate = createTransformTemplate(node, context)\n\n\tif (!withStyleAppearPageEffect(node)) return\n\n\tprops[prefixIncompatibleMotionKey(node, context, \"animate\")] = createAnimate(node, context)\n\tprops[prefixIncompatibleMotionKey(node, context, \"initial\")] = createInitial(node, context)\n\tprops.optimized = hasOptimizedAppearEffect(node, context) ? true : undefined\n})\n", "import { isSafeJS } from \"code-generation/js/serializeJS.ts\"\nimport { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport type { SerializableMotionStyle } from \"code-generation/types.ts\"\nimport type { CollectorContext } from \"code-generation/utils/collector.ts\"\nimport { propCollector } from \"code-generation/utils/collector.ts\"\nimport { toMotionTransition } from \"document/models/Transition.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { nodeIsInOverlay } from \"../../nodes/utils/overlayHelpers.ts\"\nimport { hasFloatingPosition } from \"../WithFloatingPosition.ts\"\nimport type { WithStyleAppearEffect } from \"../WithStyleAppearEffect.ts\"\nimport { isExitLoadEffect, withStyleAppearPageEffect } from \"../WithStyleAppearEffect.ts\"\nimport { effectHas3DRotation, getAdditiveEffectRotation, isSupportedEffectScopeType } from \"../utils/effects.ts\"\nimport { getMotionInitialStyle, prefixIncompatibleMotionKey } from \"./collectOptimizedMotionProps.ts\"\n\nexport function getMotionExitStyle(\n\tnode: CanvasNode & WithStyleAppearEffect,\n\tctx?: CollectorContext,\n): SerializableMotionStyle {\n\tif (node.styleAppearEffectLocked !== false) return getMotionInitialStyle(node)\n\n\tconst rotate = getAdditiveEffectRotation(node, node.exitEffectRotateAdditiveDynamicValue, node.exitEffectRotate, ctx)\n\n\tconst rotate3d = effectHas3DRotation(node.exitEffectRotate3d)\n\n\treturn {\n\t\tx: node.exitEffectX ?? 0,\n\t\ty: node.exitEffectY ?? 0,\n\t\tscale: node.exitEffectScale ?? 1,\n\t\topacity: node.exitEffectOpacity ?? 1,\n\t\tskewX: node.exitEffectSkewX ?? 0,\n\t\tskewY: node.exitEffectSkewY ?? 0,\n\t\trotate,\n\t\trotateX: rotate3d ? (node.exitEffectRotateX ?? 0) : 0,\n\t\trotateY: rotate3d ? (node.exitEffectRotateY ?? 0) : 0,\n\t}\n}\n\nfunction isOrInOverlay(node: CanvasNode) {\n\treturn nodeIsInOverlay(node) || hasFloatingPosition(node)\n}\n\nexport const collectMotionExit = propCollector((node, props, context) => {\n\tif (!withStyleAppearPageEffect(node) || !isJSXContext(context) || !isSupportedEffectScopeType(context.scopeType)) {\n\t\treturn\n\t}\n\n\tif (!node.styleAppearEffectEnabled || !isExitLoadEffect(node) || !isOrInOverlay(node)) {\n\t\tprops.exit = undefined\n\t\treturn\n\t}\n\n\tconst transition =\n\t\tnode.styleAppearEffectLocked !== false\n\t\t\t? (node.enterEffectTransition ?? node.styleAppearEffectTransition)\n\t\t\t: node.exitEffectTransition\n\n\tconst value = {\n\t\t...getMotionExitStyle(node, context),\n\t\ttransition: transition ? context.declarations.file.dedupe(\"transition\", toMotionTransition(transition)) : undefined,\n\t}\n\n\tprops[prefixIncompatibleMotionKey(node, context, \"exit\")] = isSafeJS(value.rotate)\n\t\t? value\n\t\t: context.declarations.file.dedupe(\"animation\", value)\n})\n", "import type { SerializableValue } from \"code-generation/js/SerializableValue.ts\"\nimport type { SafeJS } from \"code-generation/js/serializeJS.ts\"\nimport type { JSXContext } from \"code-generation/jsx/types.ts\"\nimport { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport type { MakeSerializable, RecordWithSafeJS, SerializableMotionStyle } from \"code-generation/types.ts\"\nimport type { ElementIdCollector } from \"code-generation/utils/ElementIdCollector.ts\"\nimport { mergeCollectors, propCollector } from \"code-generation/utils/collector.ts\"\nimport type { MotionTransition, Transition } from \"document/models/Transition.ts\"\nimport { fallbackPhysicsBasedSpringTransition, toMotionTransition } from \"document/models/Transition.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport type { EffectScrollTarget } from \"library/modules/createTransformInputRange.ts\"\nimport type { PrefixedParallaxTransformOptions } from \"library/modules/useParallax.ts\"\nimport type { PrefixedStyleAppearEffectOptions } from \"library/modules/useStyleAppearEffect.ts\"\nimport type { PrefixedStyleTransformEffectOptions } from \"library/modules/useStyleTransformEffect.ts\"\nimport type {\n\tEffectVariantScrollTarget,\n\tPrefixedVariantAppearEffectOptions,\n} from \"library/modules/withVariantAppearEffect.tsx\"\nimport type { TickerEffectProps } from \"library/render/presentation/Ticker.tsx\"\nimport { isArray, isNumber, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { isDataRepeater } from \"../../nodes/utils/nodeCheck.ts\"\nimport { nodeIsInOverlay } from \"../../nodes/utils/overlayHelpers.ts\"\nimport { isDynamicValue } from \"../DynamicValue.ts\"\nimport { isVariableReference } from \"../VariableReference.ts\"\nimport { hasDragEffect } from \"../WithDragEffect.ts\"\nimport { hasFloatingPosition } from \"../WithFloatingPosition.ts\"\nimport { toFlexDirection, withLayout } from \"../WithLayout.ts\"\nimport { hasLoopEffect } from \"../WithLoopEffect.ts\"\nimport { withOpacity } from \"../WithOpacity.ts\"\nimport { withOverflow } from \"../WithOverflow.ts\"\nimport { hasParallaxEffect, withParallax } from \"../WithParallax.ts\"\nimport type { WithStyleAppearEffect } from \"../WithStyleAppearEffect.ts\"\nimport {\n\tfallbackEffectTransition,\n\thasStyleAppearEffect,\n\tisEnterLoadEffect,\n\tisScrollEffect,\n\twithStyleAppearPageEffect,\n} from \"../WithStyleAppearEffect.ts\"\nimport type { ScrollStyle, WithStyleTransformEffect } from \"../WithStyleTransformEffect.ts\"\nimport { hasStyleTransformEffect, withStyleTransformEffect } from \"../WithStyleTransformEffect.ts\"\nimport { type WithTickerEffect, hasTickerEffect, withTickerEffect } from \"../WithTickerEffect.ts\"\nimport type { WithVariantAppearEffect } from \"../WithVariantAppearEffect.ts\"\nimport { hasVariantAppearEffect, withVariantAppearPageEffect } from \"../WithVariantAppearEffect.ts\"\nimport { collectPosition } from \"../collectStyles/collectPosition.ts\"\nimport { EffectTrigger, effectTriggerStringToEnumMember } from \"../utils/EffectTrigger.ts\"\nimport { createStaggerTransition } from \"../utils/createStaggerTransition.ts\"\nimport { effectHas3DRotation, isSupportedEffectScopeType } from \"../utils/effects.ts\"\nimport { getStaggerValueForNode } from \"../utils/getStaggerValueForNode.ts\"\nimport { collectLightboxEffect } from \"./collectLightboxEffect.ts\"\nimport { getMotionExitStyle } from \"./collectMotionExit.ts\"\nimport { getMotionInitialStyle } from \"./collectOptimizedMotionProps.ts\"\n\nfunction isScrollTargetEffect(node: CanvasNode & WithVariantAppearEffect) {\n\treturn (\n\t\teffectTriggerStringToEnumMember(node.appearEffectTrigger) === EffectTrigger.OnScrollTarget &&\n\t\tnode.appearEffectScrollTargets &&\n\t\tisArray(node.appearEffectScrollTargets) &&\n\t\tnode.appearEffectScrollTargets.length > 0\n\t)\n}\n\nfunction isInViewEffect(node: CanvasNode & WithVariantAppearEffect) {\n\tconst effectTrigger = effectTriggerStringToEnumMember(node.appearEffectTrigger)\n\treturn (\n\t\t// @FIXME - consider an exhaustive switch, but be sure to ensure that an undefined trigger\n\t\t// is handled correctly in the case of old documents where there may have been an assumption\n\t\t// about the kind of effect before the trigger type was introduced.\n\t\teffectTrigger !== EffectTrigger.OnScrollTarget &&\n\t\teffectTrigger !== EffectTrigger.OnScrollDirection &&\n\t\tisString(node.appearEffectObscuredVariantId) &&\n\t\tisString(node.appearEffectVisibleVariantId)\n\t)\n}\n\nexport function hasAnyHOCEffect(node: CanvasNode, scopeType?: ScopeType) {\n\t// These effects always require a higher order component, no matter the scope.\n\tif (hasParallaxEffect(node) || hasStyleTransformEffect(node) || hasLoopEffect(node) || hasDragEffect(node)) {\n\t\treturn true\n\t}\n\n\t// If we are in a Web Page or Layout Template, the layer only needs a higher order component if\n\t// it has an appear effect that isn't handled by motion's `initial/appear` props.\n\tif (scopeType === ScopeType.WebPage || scopeType === ScopeType.LayoutTemplate) {\n\t\treturn hasStyleAppearEffect(node) && !isEnterLoadEffect(node)\n\t}\n\n\t// Otherwise an appear effect requires a higher order component in Smart\n\t// Components.\n\treturn hasStyleAppearEffect(node) && isSupportedEffectScopeType(scopeType)\n}\n\nexport function hasSmartComponentPresenceEffect(node: CanvasNode) {\n\treturn Boolean(\n\t\thasStyleAppearEffect(node) &&\n\t\tnode.styleAppearEffectTrigger === EffectTrigger.OnMount &&\n\t\t(node.enterEffectEnabled || node.exitEffectEnabled) &&\n\t\t(hasFloatingPosition(node) || nodeIsInOverlay(node)),\n\t)\n}\n\nexport type SerializableEffect<T extends Record<string, unknown>> = {\n\t[K in keyof T]: SerializableValue | Transition | undefined\n}\n\nfunction createAppearEffectScrollTargets(\n\tnode: CanvasNode & WithStyleAppearEffect,\n\telementIds: ElementIdCollector,\n): MakeSerializable<EffectVariantScrollTarget>[] | undefined {\n\tconst isScrollTarget = effectTriggerStringToEnumMember(node.styleAppearEffectTrigger) === EffectTrigger.OnScrollTarget\n\n\tif (!isScrollTarget || !node.styleAppearEffectScrollTarget) return\n\n\tconst info = elementIds.scrollTargetInfo({\n\t\ttarget: node.styleAppearEffectScrollTarget,\n\t\tcollectionItem: node.styleAppearEffectScrollTargetCollectionItem,\n\t})\n\tif (!info) return\n\n\treturn [\n\t\t{\n\t\t\t...info,\n\t\t\ttarget: \"animate\",\n\t\t},\n\t]\n}\n\n/**\n * If a node is wrapped in the `withFX` HOC, we must provide the opacity of the\n * layer, as well as flag that the HOC doesn't need to control perspective.\n */\nconst collectAnyFXProps = propCollector((node, props, context) => {\n\tif (!hasAnyHOCEffect(node, context.scopeType)) return\n\n\tconst opacity = withOpacity(node)\n\t\t? isVariableReference(node.opacity)\n\t\t\t? context.variables?.create(node.opacity)\n\t\t\t: node.resolveValue(\"opacity\")\n\t\t: 1\n\n\tprops.__targetOpacity = opacity\n\tprops.__perspectiveFX = false\n\tif (context.scopeType === ScopeType.SmartComponent) props.__smartComponentFX = true\n})\n\nexport const collectAppearEffect = propCollector((node, props, context) => {\n\tif (!withStyleAppearPageEffect(node) || !isJSXContext(context) || !isSupportedEffectScopeType(context.scopeType)) {\n\t\treturn\n\t}\n\n\tif (!hasStyleAppearEffect(node) || !node.styleAppearEffectEnabled || !isScrollEffect(node)) {\n\t\tprops.__framer__styleAppearEffectEnabled = undefined\n\t\treturn\n\t}\n\n\tconst isScrollDirectionEffect = node.styleAppearEffectTrigger === EffectTrigger.OnScrollDirection\n\tconst hasEnterEffect = node.enterEffectEnabled !== false\n\tconst hasExitEffect = node.exitEffectEnabled !== false\n\t// It is not possible to NOT define a transition for an effect. The UI uses fallbackEffectTransition if\n\t// node.transition is undefined, this keeps the generated code in sync with the canvas.\n\tconst transition = withStyleAppearPageEffect(node)\n\t\t? toMotionTransition(node.enterEffectTransition ?? node.styleAppearEffectTransition ?? fallbackEffectTransition)\n\t\t: undefined\n\n\tconst exitTransition =\n\t\t(node.styleAppearEffectLocked !== false\n\t\t\t? (node.enterEffectTransition ?? node.styleAppearEffectTransition)\n\t\t\t: node.exitEffectTransition) ?? fallbackEffectTransition\n\n\tconst appearEffectArguments: Partial<SerializableEffect<PrefixedStyleAppearEffectOptions>> = {\n\t\t__framer__styleAppearEffectEnabled: true,\n\t\t__framer__threshold: node.styleAppearEffectThreshold,\n\t\t__framer__animateOnce: node.styleAppearEffectAnimateOnce,\n\t\t__framer__enter:\n\t\t\thasEnterEffect && !isScrollDirectionEffect\n\t\t\t\t? context.declarations?.file.dedupe(\"animation\", getMotionInitialStyle(node))\n\t\t\t\t: undefined,\n\t\t__framer__animate: {\n\t\t\ttransition: createAnimationTransition(transition, context, node),\n\t\t},\n\t\t__framer__exit:\n\t\t\thasExitEffect && !isScrollDirectionEffect\n\t\t\t\t? context.declarations?.file.dedupe(\"animation\", {\n\t\t\t\t\t\t...getMotionExitStyle(node),\n\t\t\t\t\t\ttransition: transition\n\t\t\t\t\t\t\t? context.declarations.file.dedupe(\"transition\", toMotionTransition(exitTransition))\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t})\n\t\t\t\t: undefined,\n\t\t__framer__targets: createAppearEffectScrollTargets(node, context.elementIds),\n\t\t__framer__scrollDirection: isScrollDirectionEffect\n\t\t\t? {\n\t\t\t\t\tdirection: node.styleAppearEffectScrollDirection ?? \"down\",\n\t\t\t\t\ttarget: context.declarations?.file.dedupe(\"animation\", getMotionInitialStyle(node)),\n\t\t\t\t}\n\t\t\t: undefined,\n\t}\n\n\tObject.assign(props, appearEffectArguments)\n})\n\ntype SerializableScrollTarget = Partial<\n\tRecord<keyof EffectScrollTarget<SerializableMotionStyle>, SerializableValue | undefined>\n>\n\nexport function prepareStyleTarget(style: ScrollStyle, ctx?: JSXContext): SerializableMotionStyle {\n\tconst rotate3d = effectHas3DRotation(style.rotate3d)\n\treturn {\n\t\trotate: style.rotate ?? 0,\n\t\trotateX: rotate3d ? (style.rotateX ?? 0) : 0,\n\t\trotateY: rotate3d ? (style.rotateY ?? 0) : 0,\n\t\tskewX: style.skewX ?? 0,\n\t\tskewY: style.skewY ?? 0,\n\t\tscale: style.scale ?? 1,\n\t\tx: style.x ?? 0,\n\t\ty: style.y ?? 0,\n\t\topacity: style.opacity ?? 1,\n\t\tbackgroundColor: ctx?.cssVariableDefinitions.resolveColor(style.backgroundColor) ?? style.backgroundColor,\n\t}\n}\n\nfunction createTransformTargets(node: CanvasNode & WithStyleTransformEffect, ctx: JSXContext) {\n\tif (!node.styleTransformEffectScrollTargets || !isArray(node.styleTransformEffectScrollTargets)) {\n\t\treturn undefined\n\t}\n\tconst [fromEffect, toEffect, ...scrollTargets] = node.styleTransformEffectScrollTargets\n\tif (!fromEffect || !toEffect) return undefined\n\n\tconst supportsScrollTargets = node.styleTransformEffectTrigger === EffectTrigger.OnScrollTarget\n\tconst info = supportsScrollTargets && toEffect.target ? ctx.elementIds.scrollTargetInfo(toEffect) : undefined\n\n\t// If the ref is missing, return early, as this isn't a valid effect.\n\tif (node.styleTransformEffectTrigger === EffectTrigger.OnScrollTarget && !info?.ref) return undefined\n\n\tconst targets: SerializableScrollTarget[] = [\n\t\t{\n\t\t\ttarget: prepareStyleTarget(fromEffect.style, ctx),\n\t\t},\n\t\t{\n\t\t\ttarget: prepareStyleTarget(toEffect.style, ctx),\n\t\t\t...info,\n\t\t},\n\t]\n\n\tif (!supportsScrollTargets) return targets\n\n\tfor (const scrollEffect of scrollTargets) {\n\t\tconst scrollInfo = ctx.elementIds.scrollTargetInfo(scrollEffect)\n\t\tif (scrollInfo) targets.push({ ...scrollInfo, target: prepareStyleTarget(scrollEffect.style, ctx) })\n\t}\n\n\tif (targets.length > 0) return targets\n}\n\nconst collectTransformEffect = propCollector((node, props, ctx) => {\n\tif (!isSupportedEffectScopeType(ctx.scopeType) || !withStyleTransformEffect(node) || !isJSXContext(ctx)) {\n\t\treturn\n\t}\n\n\tif (!node.styleTransformEffectEnabled) {\n\t\tprops.__framer__styleTransformEffectEnabled = undefined\n\t\treturn\n\t}\n\n\tconst targets = createTransformTargets(node, ctx)\n\tif (!targets) return\n\n\tconst transformEffectProps: Partial<SerializableEffect<PrefixedStyleTransformEffectOptions>> = {\n\t\t__framer__styleTransformEffectEnabled: true,\n\t\t__framer__transformViewportThreshold:\n\t\t\tnode.styleTransformEffectTrigger === EffectTrigger.OnScrollTarget\n\t\t\t\t? node.styleTransformEffectViewportThreshold\n\t\t\t\t: undefined,\n\t\t__framer__spring: node.styleTransformEffectTransitionEnabled\n\t\t\t? (node.styleTransformEffectTransition ?? fallbackPhysicsBasedSpringTransition)\n\t\t\t: undefined,\n\t\t__framer__transformTrigger: node.styleTransformEffectTrigger,\n\t\t__framer__transformTargets: targets,\n\t}\n\n\tObject.assign(props, transformEffectProps)\n})\n\nfunction createVariantScrollTargets(\n\tnode: CanvasNode & WithVariantAppearEffect,\n\telementIds: ElementIdCollector,\n): MakeSerializable<EffectVariantScrollTarget>[] | undefined {\n\tif (!isScrollTargetEffect(node) || !node.appearEffectScrollTargets) return undefined\n\n\tconst targets: MakeSerializable<EffectVariantScrollTarget>[] = []\n\n\tfor (const scrollTarget of node.appearEffectScrollTargets) {\n\t\tif (isUndefined(scrollTarget.variant)) continue\n\t\tconst info = elementIds.scrollTargetInfo(scrollTarget)\n\t\tif (!info) continue\n\n\t\ttargets.push({ ...info, target: scrollTarget.variant })\n\t}\n\n\tif (targets.length === 0) return undefined\n\n\treturn targets\n}\n\nexport const collectVariantAppearEffect = propCollector((node, props, context) => {\n\tif (!withVariantAppearPageEffect(node) || !isJSXContext(context) || !isSupportedEffectScopeType(context.scopeType)) {\n\t\treturn\n\t}\n\n\tif (!hasVariantAppearEffect(node)) {\n\t\tprops.__framer__variantAppearEffectEnabled = undefined\n\t\treturn\n\t}\n\n\tconst targets = createVariantScrollTargets(node, context.elementIds)\n\tconst firstTarget = node.appearEffectScrollTargets?.[0]\n\tconst shouldExit =\n\t\t(isArray(targets) && targets.length === 1 && firstTarget && isVariableReference(firstTarget.collectionItem)) ||\n\t\tundefined // Coerce false to undefined to avoid unnecessary `false` props.\n\n\tconst appearEffectArguments: Partial<SerializableEffect<PrefixedVariantAppearEffectOptions>> = {\n\t\t__framer__variantAppearEffectEnabled: true,\n\t\t__framer__threshold: node.appearEffectThreshold,\n\t\t__framer__animateOnce: !!node.appearEffectAnimateOnce,\n\t\t__framer__visibleVariantId: isInViewEffect(node) ? node.appearEffectVisibleVariantId : undefined,\n\t\t__framer__obscuredVariantId: isInViewEffect(node) ? node.appearEffectObscuredVariantId : undefined,\n\t\t__framer__targets: targets,\n\t\t__framer__exitTarget: shouldExit,\n\t\t__framer__scrollDirection:\n\t\t\tnode.appearEffectTrigger === EffectTrigger.OnScrollDirection\n\t\t\t\t? {\n\t\t\t\t\t\tdirection: node.appearEffectScrollDirection ?? \"down\",\n\t\t\t\t\t\ttarget: node.appearEffectScrollDirectionTarget,\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t}\n\n\tObject.assign(props, appearEffectArguments)\n})\n\nexport const collectParallaxEffect = propCollector((node, props, context) => {\n\tif (!withParallax(node) || !isJSXContext(context) || !isSupportedEffectScopeType(context.scopeType)) return\n\tif (!hasParallaxEffect(node) || !isNumber(node.parallaxSpeed) || !isNumber(node.parallaxOffset)) {\n\t\tprops.__framer__parallaxTransformEnabled = undefined\n\t\treturn\n\t}\n\n\tconst parallaxArguments: PrefixedParallaxTransformOptions = {\n\t\t__framer__parallaxTransformEnabled: true,\n\t\t__framer__speed: node.parallaxSpeed,\n\t\t__framer__adjustPosition: !!node.parallaxAdjustPosition,\n\t\t__framer__offset: node.parallaxOffset,\n\t}\n\n\tObject.assign(props, parallaxArguments)\n})\n\ntype SerializableTickerEffectProps = RecordWithSafeJS<\n\tTickerEffectProps & Pick<WithTickerEffect, \"tickerEffectEnabled\"> & Record<string, unknown>\n>\nexport const collectTickerEffect = propCollector((node, props, context) => {\n\tif (!withTickerEffect(node) || !withLayout(node) || !withOverflow(node)) return\n\tif (!hasTickerEffect(node)) {\n\t\tprops.tickerEffectEnabled = undefined\n\t\treturn\n\t}\n\n\tconst collected: SerializableMotionStyle = {}\n\tcollectPosition(node, collected, context)\n\n\tconst tickerEffectProps: Partial<SerializableTickerEffectProps> = {\n\t\ttickerEffectEnabled: true,\n\t\ttickerEffectVelocity:\n\t\t\tisJSXContext(context) && isDynamicValue(node.tickerEffectVelocity)\n\t\t\t\t? context.createDeduplicatedDynamicValueBinding(node.tickerEffectVelocity, node, \"tickerEffectVelocity\")\n\t\t\t\t: node.resolveValue(\"tickerEffectVelocity\"),\n\t\ttickerEffectHoverModifier:\n\t\t\tisJSXContext(context) && isDynamicValue(node.tickerEffectHoverModifier)\n\t\t\t\t? context.createDeduplicatedDynamicValueBinding(\n\t\t\t\t\t\tnode.tickerEffectHoverModifier,\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\"tickerEffectHoverModifier\",\n\t\t\t\t\t)\n\t\t\t\t: node.resolveValue(\"tickerEffectHoverModifier\"),\n\t\ttickerEffectDirectionModifier:\n\t\t\tisJSXContext(context) && isDynamicValue(node.tickerEffectDirectionModifier)\n\t\t\t\t? context.createDeduplicatedDynamicValueBinding(\n\t\t\t\t\t\tnode.tickerEffectDirectionModifier,\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\"tickerEffectDirectionModifier\",\n\t\t\t\t\t)\n\t\t\t\t: node.resolveValue(\"tickerEffectDirectionModifier\"),\n\t\ttickerEffectDraggable:\n\t\t\tisJSXContext(context) && isDynamicValue(node.tickerEffectDraggable)\n\t\t\t\t? context.createDeduplicatedDynamicValueBinding(node.tickerEffectDraggable, node, \"tickerEffectDraggable\")\n\t\t\t\t: node.resolveValue(\"tickerEffectDraggable\"),\n\t\ttickerEffectXOverflow:\n\t\t\tisJSXContext(context) && isDynamicValue(node.overflowX)\n\t\t\t\t? context.createDeduplicatedDynamicValueBinding(node.overflowX, node, \"overflowX\")\n\t\t\t\t: node.resolveValue(\"overflowX\"),\n\t\ttickerEffectYOverflow:\n\t\t\tisJSXContext(context) && isDynamicValue(node.overflowY)\n\t\t\t\t? context.createDeduplicatedDynamicValueBinding(node.overflowY, node, \"overflowY\")\n\t\t\t\t: node.resolveValue(\"overflowY\"),\n\t\ttickerEffectOverflow:\n\t\t\tisJSXContext(context) && isDynamicValue(node.overflow)\n\t\t\t\t? context.createDeduplicatedDynamicValueBinding(node.overflow, node, \"overflow\")\n\t\t\t\t: node.resolveValue(\"overflow\"),\n\t\ttickerEffectAlign:\n\t\t\tisJSXContext(context) && isDynamicValue(node.stackAlignment)\n\t\t\t\t? context.createDeduplicatedDynamicValueBinding(node.stackAlignment, node, \"stackAlignment\")\n\t\t\t\t: node?.resolveValue(\"stackAlignment\"),\n\t\ttickerEffectGap:\n\t\t\tisJSXContext(context) && isDynamicValue(node.gap)\n\t\t\t\t? context.createDeduplicatedDynamicValueBinding(node.gap, node, \"gap\")\n\t\t\t\t: node.resolveValue(\"gap\"),\n\t\ttickerEffectPosition: collected.position as \"relative\" | \"absolute\" | \"sticky\" | \"fixed\" | undefined,\n\t\ttickerEffectIsDataRepeater: isDataRepeater(node) ? true : undefined,\n\t}\n\n\tif (isJSXContext(context) && isDynamicValue(node.stackDirection)) {\n\t\ttickerEffectProps.tickerEffectStackDirection = context.createDeduplicatedDynamicValueBinding(\n\t\t\tnode.stackDirection,\n\t\t\tnode,\n\t\t\t\"stackDirection\",\n\t\t)\n\t} else {\n\t\tconst stackDirection = node?.resolveValue(\"stackDirection\")\n\t\ttickerEffectProps.tickerEffectStackDirection = stackDirection ? toFlexDirection(stackDirection) : undefined\n\t}\n\n\tObject.assign(props, tickerEffectProps)\n})\n\nexport const collectFX = mergeCollectors(\n\tcollectAnyFXProps,\n\tcollectAppearEffect,\n\tcollectParallaxEffect,\n\tcollectTransformEffect,\n\tcollectLightboxEffect,\n\tcollectTickerEffect,\n)\n\n/**\n * Prepares the transition in SafeJS format.\n * In case there's a stagger value defined, it will be applied to the transition.\n */\nfunction createAnimationTransition(\n\ttransition: MotionTransition | undefined,\n\tcontext: JSXContext,\n\tnode: CanvasNode & WithStyleAppearEffect,\n): SafeJS | undefined {\n\tif (!transition) return\n\n\tconst dedupedTransition = context.declarations.file.dedupe(\"transition\", transition)\n\n\tconst trigger = effectTriggerStringToEnumMember(node.styleAppearEffectTrigger)\n\t// We don't check for OnMount (\"On Appear\") as that trigger type is handled in the optimized collector.\n\tconst triggerIsStaggerable = trigger === EffectTrigger.OnScrollTarget || trigger === EffectTrigger.OnInView\n\n\tif (triggerIsStaggerable && getStaggerValueForNode(node) !== 0) {\n\t\tconst { transition: staggered } = createStaggerTransition(node, dedupedTransition, context)\n\t\treturn staggered\n\t}\n\n\treturn dedupedTransition\n}\n", "import { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport type { SerializableMotionStyle } from \"code-generation/types.ts\"\nimport { propCollector } from \"code-generation/utils/collector.ts\"\nimport { toMotionTransition } from \"document/models/Transition.ts\"\nimport type { PrefixedLoopEffectOptions } from \"library/modules/useLoopEffect.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { isFixedOrRelativeOverlay } from \"../../nodes/utils/overlayHelpers.ts\"\nimport type { WithLoopEffect } from \"../WithLoopEffect.ts\"\nimport { hasLoopEffect, withLoopEffect } from \"../WithLoopEffect.ts\"\nimport { isSupportedEffectScopeType } from \"../utils/effects.ts\"\nimport type { SerializableEffect } from \"./collectEffects.ts\"\n\nexport function getLoopStyle(node: CanvasNode & WithLoopEffect): SerializableMotionStyle {\n\treturn {\n\t\tscale: node.loopEffectScale ?? 1,\n\t\topacity: node.loopEffectOpacity ?? 1,\n\t\tx: node.loopEffectX ?? 0,\n\t\ty: node.loopEffectY ?? 0,\n\t\tskewX: node.loopEffectSkewX ?? 0,\n\t\tskewY: node.loopEffectSkewY ?? 0,\n\t\trotate: node.loopEffectRotate ?? 0,\n\t\trotateX: node.loopEffectRotate3d ? (node.loopEffectRotateX ?? 0) : 0,\n\t\trotateY: node.loopEffectRotate3d ? (node.loopEffectRotateY ?? 0) : 0,\n\t}\n}\n\nexport const collectLoopEffect = propCollector((node, props, context) => {\n\tif (\n\t\t!withLoopEffect(node) ||\n\t\t!isJSXContext(context) ||\n\t\t!isSupportedEffectScopeType(context.scopeType) ||\n\t\tisFixedOrRelativeOverlay(node)\n\t) {\n\t\treturn\n\t}\n\tif (!hasLoopEffect(node)) {\n\t\tprops.__framer__loopEffectEnabled = undefined\n\t\treturn\n\t}\n\n\tconst transition = node.loopEffectTransition\n\t\t? context.declarations.file.dedupe(\"transition\", toMotionTransition(node.loopEffectTransition))\n\t\t: undefined\n\n\tconst loopEffectProps: Partial<SerializableEffect<PrefixedLoopEffectOptions>> = {\n\t\t__framer__loopEffectEnabled: true,\n\t\t__framer__loopRepeatType: node.loopEffectRepeatType,\n\t\t__framer__loopRepeatDelay: node.loopEffectRepeatDelay,\n\t\t__framer__loopTransition: transition,\n\t\t__framer__loop: context.declarations.file.dedupe(\"animation\", getLoopStyle(node)),\n\t\t__framer__loopPauseOffscreen: node.loopEffectPauseOffscreen,\n\t}\n\n\tObject.assign(props, loopEffectProps)\n})\n", "import { isSafeJS } from \"code-generation/js/serializeJS.ts\"\nimport { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport type { SerializableMotionStyle } from \"code-generation/types.ts\"\nimport type { CollectorContext } from \"code-generation/utils/collector.ts\"\nimport { propCollector } from \"code-generation/utils/collector.ts\"\nimport { toMotionTransition } from \"document/models/Transition.ts\"\nimport { singleBoxShadowToCSS } from \"utils/boxShadowToCSS.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { isFrameNode } from \"../../nodes/utils/nodeCheck.ts\"\nimport type { WithWhileHover } from \"../WithWhileHover.ts\"\nimport { hasWhileHover, withWhileHover } from \"../WithWhileHover.ts\"\nimport { getAdditiveEffectRotation, isSupportedEffectScopeType, nodeSupportsGestureEffects } from \"../utils/effects.ts\"\n\nexport function getMotionWhileHoverStyle(node: CanvasNode & WithWhileHover, ctx?: CollectorContext) {\n\t// CodeComponentNodes, RichTextNodes and FrameNodes all support the WithWhileHover trait,\n\t// however only FrameNode's support animating background color.\n\tconst color = isFrameNode(node) ? node.whileHoverBackgroundColor : undefined\n\tconst backgroundColor = ctx?.cssVariableDefinitions?.resolveColor(color) ?? color\n\n\tconst boxShadow = node.whileHoverBoxShadow\n\t\t? singleBoxShadowToCSS(node.whileHoverBoxShadow, color => ctx?.cssVariableDefinitions?.resolveColor(color))\n\t\t: undefined\n\tconst rotate = getAdditiveEffectRotation(node, node.whileHoverRotateAdditiveDynamicValue, node.whileHoverRotate, ctx)\n\n\tconst whileHover: SerializableMotionStyle = {\n\t\topacity: node.whileHoverOpacity ?? 1,\n\t\tscale: node.whileHoverScale ?? 1,\n\t\tskewX: node.whileHoverSkewX ?? 0,\n\t\tskewY: node.whileHoverSkewY ?? 0,\n\t\trotate,\n\t\trotateX: node.whileHoverRotate3d ? (node.whileHoverRotateX ?? 0) : 0,\n\t\trotateY: node.whileHoverRotate3d ? (node.whileHoverRotateY ?? 0) : 0,\n\t}\n\n\t// Conditionally add x/y styles only if non-0 to avoid clashes with\n\t// dragging.\n\tif (isNumber(node.whileHoverX) && node.whileHoverX !== 0) whileHover.x = node.whileHoverX\n\tif (isNumber(node.whileHoverY) && node.whileHoverY !== 0) whileHover.y = node.whileHoverY\n\n\tif (backgroundColor) whileHover.backgroundColor = backgroundColor\n\tif (boxShadow) whileHover.boxShadow = boxShadow\n\n\treturn whileHover\n}\n\nexport const collectMotionWhileHover = propCollector((node, props, context) => {\n\tif (\n\t\t!isSupportedEffectScopeType(context.scopeType) ||\n\t\t!isJSXContext(context) ||\n\t\t!withWhileHover(node) ||\n\t\t!nodeSupportsGestureEffects(node)\n\t) {\n\t\treturn\n\t}\n\n\tif (!hasWhileHover(node)) {\n\t\tprops.whileHover = undefined\n\t\treturn\n\t}\n\n\tconst transition = node.whileHoverTransition\n\t\t? context.declarations?.file.dedupe(\"transition\", toMotionTransition(node.whileHoverTransition))\n\t\t: undefined\n\n\tconst value = {\n\t\t...getMotionWhileHoverStyle(node, context),\n\t\ttransition,\n\t}\n\n\tprops.whileHover = isSafeJS(value.rotate) ? value : context.declarations?.file?.dedupe(\"animation\", value)\n})\n", "import { isSafeJS } from \"code-generation/js/serializeJS.ts\"\nimport { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport type { SerializableMotionStyle } from \"code-generation/types.ts\"\nimport type { CollectorContext } from \"code-generation/utils/collector.ts\"\nimport { propCollector } from \"code-generation/utils/collector.ts\"\nimport { toMotionTransition } from \"document/models/Transition.ts\"\nimport { singleBoxShadowToCSS } from \"utils/boxShadowToCSS.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { isFrameNode } from \"../../nodes/utils/nodeCheck.ts\"\nimport { withCursor } from \"../WithCursor.ts\"\nimport { hasDragEffect, withDragEffect } from \"../WithDragEffect.ts\"\nimport type { WithWhileTap } from \"../WithWhileTap.ts\"\nimport { hasWhileTap, withWhileTap } from \"../WithWhileTap.ts\"\nimport { getAdditiveEffectRotation, isSupportedEffectScopeType, nodeSupportsGestureEffects } from \"../utils/effects.ts\"\n\nconst cursorStyles: SerializableMotionStyle = { cursor: \"grabbing\" }\n\nexport function getMotionWhileTapStyle(node: CanvasNode & WithWhileTap, ctx?: CollectorContext) {\n\t// CodeComponentNodes, RichTextNodes and FrameNodes all support the WithWhileTap trait, however\n\t// only FrameNode's support animating background color.\n\tconst color = isFrameNode(node) ? node.whileTapBackgroundColor : undefined\n\tconst backgroundColor = ctx?.cssVariableDefinitions?.resolveColor(color) ?? color\n\n\tconst boxShadow = node.whileTapBoxShadow\n\t\t? singleBoxShadowToCSS(node.whileTapBoxShadow, color => ctx?.cssVariableDefinitions?.resolveColor?.(color))\n\t\t: undefined\n\n\tconst rotate = getAdditiveEffectRotation(node, node.whileTapRotateAdditiveDynamicValue, node.whileTapRotate, ctx)\n\tconst whileTap: SerializableMotionStyle = {\n\t\topacity: node.whileTapOpacity ?? 1,\n\t\tscale: node.whileTapScale ?? 1,\n\t\tskewX: node.whileTapSkewX ?? 0,\n\t\tskewY: node.whileTapSkewY ?? 0,\n\t\trotate,\n\t\trotateX: node.whileTapRotate3d ? (node.whileTapRotateX ?? 0) : 0,\n\t\trotateY: node.whileTapRotate3d ? (node.whileTapRotateY ?? 0) : 0,\n\t}\n\n\t// Conditionally add x/y styles only if non-0 to avoid clashes with\n\t// dragging.\n\tif (isNumber(node.whileTapX) && node.whileTapX !== 0) whileTap.x = node.whileTapX\n\tif (isNumber(node.whileTapY) && node.whileTapY !== 0) whileTap.y = node.whileTapY\n\n\tif (backgroundColor) whileTap.backgroundColor = backgroundColor\n\tif (boxShadow) whileTap.boxShadow = boxShadow\n\n\treturn whileTap\n}\n\nexport const collectMotionWhileTap = propCollector((node, props, context) => {\n\tif (!isJSXContext(context) || !isSupportedEffectScopeType(context.scopeType) || !nodeSupportsGestureEffects(node)) {\n\t\treturn\n\t}\n\n\tif (!withWhileTap(node) && !withDragEffect(node)) return\n\n\tif (!hasWhileTap(node) && !hasDragEffect(node)) {\n\t\tprops.whileTap = undefined\n\t\treturn\n\t}\n\n\tconst whileTap: SerializableMotionStyle = {}\n\tlet hasWhileTapStyle = false\n\n\t// Automatically apply a \"grabbing\" cursor on mouse down if the current\n\t// cursor is \"grab\" and we also have a drag effect.\n\tif (hasDragEffect(node) && withCursor(node) && node.cursor && node.cursor === \"grab\") {\n\t\tObject.assign(whileTap, cursorStyles)\n\t\thasWhileTapStyle = true\n\t}\n\n\tif (hasWhileTap(node)) {\n\t\tconst transition = node.whileTapTransition\n\t\t\t? context.declarations.file.dedupe(\"transition\", toMotionTransition(node.whileTapTransition))\n\t\t\t: undefined\n\n\t\tObject.assign(whileTap, getMotionWhileTapStyle(node, context), { transition })\n\t\thasWhileTapStyle = true\n\t}\n\n\tprops.whileTap = hasWhileTapStyle\n\t\t? isSafeJS(whileTap.rotate)\n\t\t\t? whileTap\n\t\t\t: context.declarations.file.dedupe(\"animation\", whileTap)\n\t\t: undefined\n})\n", "import { assertNever } from \"@framerjs/shared\"\nimport type { SerializableMotionStyle } from \"code-generation/types.ts\"\nimport { EffectPreviewType } from \"document/utils/EffectPreviewType.ts\"\nimport type { MotionStyle } from \"framer-motion\"\nimport { isNull, isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { hasLoopEffect } from \"../WithLoopEffect.ts\"\nimport { withOpacity } from \"../WithOpacity.ts\"\nimport { withRotation } from \"../WithRotation.ts\"\nimport { hasStyleAppearEffect, isPresenceEffect } from \"../WithStyleAppearEffect.ts\"\nimport { hasStyleTransformEffect } from \"../WithStyleTransformEffect.ts\"\nimport { withTransforms } from \"../WithTransforms.ts\"\nimport { hasWhileHover } from \"../WithWhileHover.ts\"\nimport { hasWhileTap } from \"../WithWhileTap.ts\"\nimport { prepareStyleTarget } from \"../collectProps/collectEffects.ts\"\nimport { getLoopStyle } from \"../collectProps/collectLoopEffect.ts\"\nimport { getMotionExitStyle } from \"../collectProps/collectMotionExit.ts\"\nimport { getMotionWhileHoverStyle } from \"../collectProps/collectMotionWhileHover.ts\"\nimport { getMotionWhileTapStyle } from \"../collectProps/collectMotionWhileTap.ts\"\nimport { getMotionInitialStyle } from \"../collectProps/collectOptimizedMotionProps.ts\"\nimport { getFallbackPerspective } from \"../utils/getFallbackPerspective.ts\"\n\n/**\n * Our tree stores unset properties as `undefined`, however when rendering style\n * with React, any undefined keys will unset existing values, which is not what\n * we want. To avoid this, prune any undefined values from the style before\n * assigning it to the style we will render to the canvas.\n */\nfunction withoutUndefined(style: SerializableMotionStyle | undefined) {\n\tif (!style) return undefined\n\tfor (const key in style) {\n\t\tif (isUndefined(style[key])) delete style[key]\n\t}\n\treturn style\n}\n\n/**\n * When previewing effects on the canvas, the effect may need to be combined\n * with the existing properties on the node. For example, scale and opacity will\n * be multiplied, while all other properties will be added. Combining properties\n * in this way ensures that the on-canvas preview will match the behavior in\n * the site.\n */\nfunction combineAdditiveEffect<T extends Record<string, unknown>>(a: T, b?: T): T {\n\tif (!b) return a\n\n\tconst output: T = { ...a }\n\tfor (const key in b) {\n\t\tconst bValue = b[key]\n\t\tif (!isNumber(bValue)) continue\n\n\t\tconst aValue = a[key]\n\t\tswitch (key) {\n\t\t\tcase \"scale\":\n\t\t\tcase \"opacity\":\n\t\t\t\toutput[key] = (isNumber(aValue) ? aValue * bValue : bValue) as T[typeof key]\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\toutput[key] = (isNumber(aValue) ? aValue + bValue : bValue) as T[typeof key]\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\treturn output\n}\n\n/**\n * Different effects combine with the base styles of the node in different ways.\n * Ensure we run the correct combination for the effect.\n */\nfunction combineEffect(\n\teffectType: EffectPreviewType,\n\tnode: CanvasNode,\n\tstyle: SerializableMotionStyle,\n\tidentity: Record<string, number>,\n) {\n\tswitch (effectType) {\n\t\tcase EffectPreviewType.Exit:\n\t\tcase EffectPreviewType.Enter:\n\t\t\treturn isPresenceEffect(node) ? style : combineAdditiveEffect(style, identity)\n\t\tcase EffectPreviewType.Hover:\n\t\tcase EffectPreviewType.Tap:\n\t\tcase EffectPreviewType.Focus:\n\t\tcase EffectPreviewType.Checked:\n\t\t\treturn style\n\t\tcase EffectPreviewType.Loop:\n\t\tcase EffectPreviewType.Target: {\n\t\t\treturn combineAdditiveEffect(style, identity)\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(effectType)\n\t}\n}\n\n/**\n * Extract styles from the active effect, combining the style with any existing\n * values on the node. This ensures that the preview on the canvas matches the\n * behavior in the site.\n */\nfunction effectStyle(effectType: EffectPreviewType, node: CanvasNode): SerializableMotionStyle | undefined {\n\tswitch (effectType) {\n\t\tcase EffectPreviewType.Exit:\n\t\t\tif (!hasStyleAppearEffect(node)) break\n\t\t\treturn getMotionExitStyle(node)\n\t\tcase EffectPreviewType.Enter:\n\t\t\tif (!hasStyleAppearEffect(node)) break\n\t\t\treturn getMotionInitialStyle(node)\n\t\tcase EffectPreviewType.Hover:\n\t\t\tif (!hasWhileHover(node)) break\n\t\t\treturn getMotionWhileHoverStyle(node)\n\t\tcase EffectPreviewType.Tap:\n\t\t\tif (!hasWhileTap(node)) break\n\t\t\treturn getMotionWhileTapStyle(node)\n\t\tcase EffectPreviewType.Loop:\n\t\t\tif (!hasLoopEffect(node)) break\n\t\t\treturn getLoopStyle(node)\n\t\tcase EffectPreviewType.Target: {\n\t\t\tif (!hasStyleTransformEffect(node)) break\n\t\t\tif (isNull(node.cache.effectIds) || node.cache.effectIds.size === 0) break\n\t\t\tconst variant = node.styleTransformEffectScrollTargets?.find(fx => node.cache.effectIds?.has(fx.id))\n\t\t\tif (!variant?.style) break\n\t\t\treturn prepareStyleTarget(variant.style)\n\t\t}\n\t\tcase EffectPreviewType.Checked:\n\t\tcase EffectPreviewType.Focus:\n\t\t\t// We don't need to collect these styles for the canvas preview, but rather pass down the preview type to\n\t\t\t// the canvas form elements so that they can apply the correct css classes.\n\t\t\treturn undefined\n\t\tdefault:\n\t\t\tassertNever(effectType)\n\t}\n}\n\n/**\n * Collect styles for the active effect preview. This is only applicable on the\n * canvas.\n */\nexport function collectEphemeralEffectPreviewStyle(node: CanvasNode, style: MotionStyle) {\n\tif (!node.cache.isEffectPreview) return\n\tconst effectType = node.cache.effectType\n\tif (isUndefined(effectType) || isNull(effectType)) return\n\n\tconst effect = effectStyle(effectType, node)\n\tif (!effect) return\n\n\t// Create the effect preview by combining it with any existing styles on the\n\t// node.\n\tconst preview = combineEffect(effectType, node, effect, {\n\t\tx: 0,\n\t\ty: 0,\n\t\topacity: withOpacity(node) ? (node.resolveValue(\"opacity\") ?? 1) : 1,\n\t\tscale: withTransforms(node) ? (node.scale ?? 1) : 1,\n\t\tskewX: withTransforms(node) ? (node.skewX ?? 0) : 0,\n\t\tskewY: withTransforms(node) ? (node.skewY ?? 0) : 0,\n\t\trotate: withRotation(node) ? (node.resolveValue(\"rotation\") ?? 0) : 0,\n\t\trotateX: withTransforms(node) && node.rotate3d ? (node.rotateX ?? 0) : 0,\n\t\trotateY: withTransforms(node) && node.rotate3d ? (node.rotateY ?? 0) : 0,\n\t})\n\n\tObject.assign(style, withoutUndefined(preview))\n\n\t// In the future, we won't need to apply perspective in effect preview.\n\tif (withTransforms(node)) {\n\t\tconst transformPerspective = isNumber(node.resolveValue(\"perspective\"))\n\t\t\t? node.resolveValue(\"perspective\")\n\t\t\t: getFallbackPerspective(node)\n\n\t\tObject.assign(style, { transformPerspective })\n\t}\n}\n", "export function getFilterBlurForBoxBlur(blur: number): number {\n\t// Unlike box-shadows, filter drop-shadows are defined as gaussian blurs, which are usually approximated by box blurs. See https://stackoverflow.com/questions/36781067/svg-fegaussianblur-correlation-between-stddeviation-and-size or https://drafts.fxtf.org/filter-effects/#elementdef-fegaussianblur for the source of the magic reverse calculation number\n\treturn Math.ceil(blur / 2.37997)\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\n\nexport interface WithSVG {\n\treadonly svg: string\n}\n\nexport const svgDefaults: WithSVG = {\n\tsvg: \"\",\n}\n\nconst key: keyof WithSVG = \"svg\"\n\nexport function withSVG(node: CanvasNode): node is CanvasNode & WithSVG {\n\treturn key in node\n}\n", "import { withFill, withOptionalFill } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { isVectorNode } from \"../../nodes/TreeNode.ts\"\nimport { isDynamicValue } from \"../DynamicValue.ts\"\nimport { supportsBoxShadow } from \"../WithBoxShadow.ts\"\nimport { withRadius } from \"../WithRadius.ts\"\nimport { withRadiusPerCorner } from \"../WithRadiusPerCorner.ts\"\nimport { withSVG } from \"../WithSVG.ts\"\n\nexport function shouldRenderShadowUsingFilter(node: CanvasNode) {\n\tif (isVectorNode(node)) return false\n\n\tif (withSVG(node)) return true\n\n\t// Only use filter shadows when the node \"is\" an image\n\tif (!withFill(node) || node.fillType !== \"image\" || (withOptionalFill(node) && !node.fillEnabled)) return false\n\n\t// When specifying a radius, assume a box shadow makes more sense\n\tif (withRadius(node) && node.radius) {\n\t\treturn false\n\t} else if (\n\t\twithRadiusPerCorner(node) &&\n\t\t(node.radiusTopLeft || node.radiusTopRight || node.radiusBottomLeft || node.radiusBottomLeft)\n\t) {\n\t\treturn false\n\t}\n\n\t// Because most browsers don't support the spread value for filter: drop-shadow, default to a box shadow if a spread is specified\n\tif (supportsBoxShadow(node) && node.boxShadows) {\n\t\tif (isDynamicValue(node.boxShadows)) return false\n\t\tfor (const shadow of node.boxShadows) {\n\t\t\tif (shadow.spread > 0 || shadow.type === \"realistic\") return false\n\t\t}\n\t}\n\n\treturn true\n}\n", "import type { SerializableValue } from \"code-generation/js/SerializableValue.ts\"\nimport { js, jst } from \"code-generation/js/js.ts\"\nimport { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport { styleCollector } from \"code-generation/utils/collector.ts\"\nimport { supportsBoxShadow } from \"document/models/CanvasTree/traits/WithBoxShadow.ts\"\nimport type { WithFilters } from \"document/models/CanvasTree/traits/WithFilters.ts\"\nimport { withFilters } from \"document/models/CanvasTree/traits/WithFilters.ts\"\nimport { withShadow } from \"document/models/CanvasTree/traits/WithShadow.ts\"\nimport { getFilterBlurForBoxBlur } from \"document/models/CanvasTree/traits/utils/getFilterBlurForBoxBlur.ts\"\nimport { shouldRenderShadowUsingFilter } from \"document/models/CanvasTree/traits/utils/wantsFilterShadow.ts\"\nimport type { BoxShadow } from \"document/models/Shadow.ts\"\nimport { getUpdatedShadow } from \"document/models/Shadow.ts\"\nimport type { Shadow } from \"library/render/types/Shadow.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { isDynamicValue } from \"../DynamicValue.ts\"\n\nconst makeDropShadow = ({ x, y, blur, color }: BoxShadow | Shadow) => `drop-shadow(${x}px ${y}px ${blur}px ${color})`\n\nfunction createShadowFilters(node: CanvasNode & WithFilters): string[] {\n\tconst dropShadows: string[] = []\n\n\tif (supportsBoxShadow(node) && node.boxShadows) {\n\t\tconst nodeBoxShadows = node.resolveValue(\"boxShadows\") ?? []\n\t\tfor (const shadow of nodeBoxShadows) {\n\t\t\tif (shadow.inset) continue\n\t\t\tconst migratedShadow = getUpdatedShadow(shadow, { blur: getFilterBlurForBoxBlur(shadow.blur) })\n\t\t\tdropShadows.push(makeDropShadow(migratedShadow))\n\t\t}\n\t} else if (withShadow(node) && node.shadows) {\n\t\tfor (const shadow of node.shadows) {\n\t\t\tdropShadows.push(makeDropShadow(shadow))\n\t\t}\n\t}\n\n\treturn dropShadows\n}\n\nconst enum Unit {\n\tPercent = \"%\",\n\tDegrees = \"deg\",\n\tPixels = \"px\",\n}\n\ntype FiltersExcludeBgBlur = keyof Omit<WithFilters, \"backgroundBlur\">\nexport const filterUnitMap: Map<FiltersExcludeBgBlur, Unit> = new Map([\n\t[\"brightness\", Unit.Percent],\n\t[\"contrast\", Unit.Percent],\n\t[\"grayscale\", Unit.Percent],\n\t[\"hueRotate\", Unit.Degrees],\n\t[\"invert\", Unit.Percent],\n\t[\"saturate\", Unit.Percent],\n\t[\"sepia\", Unit.Percent],\n\t[\"blur\", Unit.Pixels],\n])\n\nexport const collectFilters = styleCollector((node, style, context) => {\n\tif (!withFilters(node)) return\n\n\tconst filters: SerializableValue[] = []\n\tfor (const [filterKey, unit] of filterUnitMap) {\n\t\tconst cssProp = filterKey === \"hueRotate\" ? \"hue-rotate\" : filterKey\n\n\t\tconst value = node[filterKey]\n\t\tif (isJSXContext(context) && isDynamicValue(value)) {\n\t\t\tconst name = context.createDeduplicatedDynamicValueBinding(value, node, filterKey)\n\n\t\t\tfilters.push(\n\t\t\t\tunit === Unit.Percent ? jst`${cssProp}(${js`parseFloat(${name})/100`})` : jst`${cssProp}(${name}${unit})`,\n\t\t\t)\n\t\t\tcontinue\n\t\t}\n\n\t\tconst resolvedValue = node.resolveValue(filterKey)\n\t\tif (isNumber(resolvedValue)) {\n\t\t\t/**\n\t\t\t * number-percentage types are set as numbers, as when filters are read from the DOM\n\t\t\t * they are returned as numbers rather than percentages. This makes it simpler for Motion\n\t\t\t * to animate from filters read from the DOM.\n\t\t\t */\n\t\t\tfilters.push(\n\t\t\t\tunit === Unit.Percent ? jst`${cssProp}(${resolvedValue / 100})` : jst`${cssProp}(${resolvedValue}${unit})`,\n\t\t\t)\n\t\t}\n\t}\n\n\tif (shouldRenderShadowUsingFilter(node)) {\n\t\tfilters.push(...createShadowFilters(node))\n\t}\n\n\tif (filters.length === 0) {\n\t\tstyle.filter = style.WebkitFilter = undefined\n\t\treturn\n\t}\n\n\tstyle.filter = style.WebkitFilter = jst.join(filters, \" \")\n})\n", "import { experiments } from \"app/experiments.ts\"\nimport { js } from \"code-generation/js/js.ts\"\nimport { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport { styleCollector } from \"code-generation/utils/collector.ts\"\nimport { isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport { isDynamicValue } from \"../DynamicValue.ts\"\nimport { withGridItemLayout } from \"../WithGridItemLayout.ts\"\nimport { isPositionRelative } from \"../utils/positionTypeHelpers.ts\"\n\nexport const collectGridItemLayout = styleCollector((node, style, context) => {\n\tif (!withGridItemLayout(node)) return\n\tif (node.cache.parentDirected !== \"grid\") return\n\tif (!isPositionRelative(node)) return\n\n\tcollectGridItemColumnSpan(node, style, context)\n\tcollectGridItemRowSpan(node, style, context)\n\tcollectGridItemHAlignment(node, style, context)\n\tcollectGridItemVAlignment(node, style, context)\n})\n\nconst collectGridItemColumnSpan = styleCollector((node, style, context) => {\n\tif (!withGridItemLayout(node)) return\n\tif (node.cache.parentDirected !== \"grid\") return\n\tif (!isPositionRelative(node)) return\n\n\tif (isUndefined(node.gridItemColumnSpan) || node.gridItemColumnSpan === 1) {\n\t\tstyle.gridColumn = undefined\n\t\treturn\n\t}\n\n\tif (isNumber(node.gridItemColumnSpan)) {\n\t\tconst value = isNumber(node.cache.parentDirectedColumnCount)\n\t\t\t? Math.min(node.cache.parentDirectedColumnCount, node.gridItemColumnSpan)\n\t\t\t: node.gridItemColumnSpan\n\t\tstyle.gridColumn = `span ${value}`\n\t} else if (node.gridItemColumnSpan === \"all\") {\n\t\tstyle.gridColumn = `1 / -1`\n\t} else if (isDynamicValue(node.gridItemColumnSpan)) {\n\t\tconst columnCount = node.cache.parentDirectedColumnCount\n\t\tif (isJSXContext(context)) {\n\t\t\tstyle.gridColumn = context.cssVariableDefinitions.create(\n\t\t\t\tnode,\n\t\t\t\t\"gridItemColumnSpan\",\n\t\t\t\tisNumber(columnCount) ? columnCount : js`undefined`,\n\t\t\t)\n\t\t} else {\n\t\t\tconst resolvedGridItemColumnSpan = node.resolveValue(\"gridItemColumnSpan\", context.variableOverrides)\n\t\t\tif (resolvedGridItemColumnSpan === \"all\") {\n\t\t\t\tstyle.gridColumn = `1 / -1`\n\t\t\t} else if (isNumber(resolvedGridItemColumnSpan)) {\n\t\t\t\tif (isNumber(columnCount)) {\n\t\t\t\t\tconst constrainedSpan = Math.min(resolvedGridItemColumnSpan, columnCount)\n\t\t\t\t\tstyle.gridColumn = `span ${constrainedSpan}`\n\t\t\t\t} else {\n\t\t\t\t\tstyle.gridColumn = `span ${resolvedGridItemColumnSpan}`\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n})\n\nconst collectGridItemRowSpan = styleCollector((node, style, context) => {\n\tif (!withGridItemLayout(node)) return\n\tif (!isPositionRelative(node)) return\n\tif (node.cache.parentDirected !== \"grid\") return\n\tif (!experiments.isOn(\"gridBentoFit\") && node.cache.parentDirectedRowHeightType === \"fit\") {\n\t\tstyle.gridRow = undefined\n\t\treturn\n\t}\n\n\tif (isUndefined(node.gridItemRowSpan) || node.gridItemRowSpan === 1) {\n\t\tstyle.gridRow = undefined\n\t\treturn\n\t}\n\n\tif (isNumber(node.gridItemRowSpan)) {\n\t\tstyle.gridRow = `span ${node.gridItemRowSpan}`\n\t} else if (isDynamicValue(node.gridItemRowSpan)) {\n\t\tif (isJSXContext(context)) {\n\t\t\tstyle.gridRow = context.cssVariableDefinitions.create(node, \"gridItemRowSpan\")\n\t\t} else {\n\t\t\tconst resolvedGridItemRowSpan = node.resolveValue(\"gridItemRowSpan\", context.variableOverrides)\n\t\t\tif (!isNumber(resolvedGridItemRowSpan)) return\n\t\t\tstyle.gridRow = `span ${resolvedGridItemRowSpan}`\n\t\t}\n\t}\n})\n\nconst collectGridItemHAlignment = styleCollector((node, style) => {\n\tif (!withGridItemLayout(node)) return\n\tif (!isPositionRelative(node)) return\n\tif (node.cache.parentDirected !== \"grid\") return\n\tstyle.justifySelf = node.gridItemHorizontalAlignment ?? \"start\"\n})\n\nconst collectGridItemVAlignment = styleCollector((node, style) => {\n\tif (!withGridItemLayout(node)) return\n\tif (!isPositionRelative(node)) return\n\tif (node.cache.parentDirected !== \"grid\") return\n\tstyle.alignSelf = node.gridItemVerticalAlignment ?? \"start\"\n})\n", "import type { MotionStyle } from \"framer-motion\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { createCSSDimension } from \"../utils/CSSDimension.ts\"\nimport { ROOT_FONT_SIZE_CSS_PROPERTY } from \"../utils/rootFontSizeHelpers.ts\"\n\n/**\n * This property will exist when the Move Tool is active. We use it to provide\n * a relative font size in case RichTextNodes with `rem` units are being moved.\n * Without this, `rem` units will show relative to the browser default, not the\n * actual root font size of the breakpoint it was a child of. This means that the\n * font size will \"jump\" on screen until the RichTextNode is released. Therefore,\n * any node when being move will temporarily have the `--framer-root-font-size`\n * variable on it in order to correctly render on the canvas.\n */\nexport function collectMoveToolRootFontSize(node: CanvasNode, style: MotionStyle) {\n\tif (isNumber(node.cache.rootFontSizeOverride)) {\n\t\tstyle[ROOT_FONT_SIZE_CSS_PROPERTY] = createCSSDimension(node.cache.rootFontSizeOverride, \"px\")\n\t}\n}\n", "import { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport { styleCollector } from \"code-generation/utils/collector.ts\"\nimport { opacityDefaults, withOpacity } from \"document/models/CanvasTree/traits/WithOpacity.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { isVectorNode } from \"../../nodes/TreeNode.ts\"\nimport { isDynamicValue } from \"../DynamicValue.ts\"\n\nexport const collectOpacity = styleCollector((node, style, context) => {\n\tif (!withOpacity(node)) return\n\t// Inline shape nodes collect their opacity through props for the SVG component. And shapes in a\n\t// vector set serialize their opacity into the svg. So we don't need to collect it into css.\n\tif (isVectorNode(node)) return\n\n\tif (isDynamicValue(node.opacity) && isJSXContext(context)) {\n\t\tstyle.opacity = context.cssVariableDefinitions.create(node, \"opacity\")\n\t\treturn\n\t}\n\n\tconst opacity = node.resolveValue(\"opacity\", context.variableOverrides)\n\n\tstyle.opacity = isNumber(opacity) && opacity !== opacityDefaults.opacity ? opacity : undefined\n})\n", "import { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport { styleCollector } from \"code-generation/utils/collector.ts\"\nimport { isDynamicValue } from \"../DynamicValue.ts\"\nimport { hasPointerEvents, withPointerEvents } from \"../WithPointerEvents.ts\"\nimport { isVariant } from \"../WithVariant.ts\"\n\nexport const collectPointerEvents = styleCollector((node, style, context) => {\n\tif (!withPointerEvents(node) || isVariant(node)) return\n\n\tif (isDynamicValue(node.pointerEvents) && isJSXContext(context)) {\n\t\tstyle.pointerEvents = context.cssVariableDefinitions.create(node, \"pointerEvents\")\n\t\treturn\n\t}\n\tstyle.pointerEvents = hasPointerEvents(node)\n\t\t? node.resolveValue(\"pointerEvents\", context.variableOverrides)\n\t\t: undefined\n})\n", "import { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport { styleCollector } from \"code-generation/utils/collector.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { isDynamicValue } from \"../DynamicValue.ts\"\nimport { withRotation } from \"../WithRotation.ts\"\n\nexport const collectRotate = styleCollector((node, style, context) => {\n\tif (!withRotation(node)) return\n\n\tif (isDynamicValue(node.rotation) && isJSXContext(context)) {\n\t\tstyle.rotate = context.createDeduplicatedDynamicValueBinding(node.rotation, node, \"rotation\")\n\t\treturn\n\t}\n\n\tconst value = node.resolveValue(\"rotation\", context.variableOverrides)\n\tstyle.rotate = isNumber(value) && value !== 0 ? value : undefined\n})\n", "import { isNumber } from \"@framerjs/assets/src/utils.ts\"\nimport type { SerializableMotionStyle } from \"code-generation/types.ts\"\nimport { styleCollector } from \"code-generation/utils/collector.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport type { WithSizeConstraints } from \"../WithSizeConstraints.ts\"\nimport { supportsSizeConstraints } from \"../WithSizeConstraints.ts\"\nimport { createCSSDimension, isCSSDimension } from \"../utils/CSSDimension.ts\"\nimport { getCalculatedVHWithFallback } from \"../utils/viewportHelpers.ts\"\n\nexport const collectSizeConstraints = styleCollector((node, style, context) => {\n\tif (!supportsSizeConstraints(node)) return\n\n\tsetSizeConstraint(node, \"maxWidth\", style, context.scopeType)\n\tsetSizeConstraint(node, \"minWidth\", style, context.scopeType)\n\tsetSizeConstraint(node, \"maxHeight\", style, context.scopeType)\n\tsetSizeConstraint(node, \"minHeight\", style, context.scopeType)\n})\n\nfunction setSizeConstraint(\n\tnode: CanvasNode & WithSizeConstraints,\n\tconstraint: keyof WithSizeConstraints,\n\tstyle: SerializableMotionStyle,\n\tscopeType?: ScopeType,\n) {\n\tconst value = node[constraint]\n\n\tif (isCSSDimension(value)) {\n\t\tconst needsCalculatedVHFallback =\n\t\t\t!scopeType || scopeType === ScopeType.LayoutTemplate || scopeType === ScopeType.SmartComponent\n\t\tif (needsCalculatedVHFallback && value.endsWith(\"vh\")) {\n\t\t\t// vh can't be rendered natively on the canvas. To work around this, we use this calc to\n\t\t\t// render a value based on a user defined viewport size on the canvas, and otherwise use the\n\t\t\t// actual vh set by the user when the generated code is in a site or prototype.\n\t\t\t//\n\t\t\t// We don't need to do this in compiled webpages/design pages however, since they are never\n\t\t\t// rendered on the canvas. It's worthwhile to handle this specially because css variables\n\t\t\t// are not free.\n\n\t\t\tstyle[constraint] = getCalculatedVHWithFallback(value)\n\t\t\treturn\n\t\t}\n\t\tstyle[constraint] = value\n\t} else if (isNumber(value)) {\n\t\tstyle[constraint] = createCSSDimension(value, \"px\")\n\t} else if (!style[constraint]) {\n\t\t// Minimum sizes may be already set if the node doesn't have a min size,\n\t\t// but is an autosizing stack that has all of its contents hidden. This\n\t\t// allows the stack to not shrink past the last measured size of the\n\t\t// auto sized stack. In that case, even if we are unsetting size\n\t\t// constraints because they were removed in a replica, we do not want to\n\t\t// unset the value to `undefined`\n\t\tstyle[constraint] = undefined\n\t}\n}\n", "import { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport type { SerializableMotionStyle } from \"code-generation/types.ts\"\nimport { styleCollector } from \"code-generation/utils/collector.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { withTextTruncation } from \"document/models/CanvasTree/traits/WithTextTruncation.ts\"\nimport {\n\ttextTruncationDisplayInlineVariableForSafari16,\n\ttextTruncationDisplayNoneVariableForSafari16,\n\ttextTruncationLineBreakVariableForSafari16,\n} from \"library/render/utils/injectRichTextRules.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\n\nexport const collectTextTruncation = styleCollector((node, style, context) => {\n\tif (!withTextTruncation(node)) return\n\n\t// Handle dynamic values during code generation\n\tif (isDynamicValue(node.textTruncation) && isJSXContext(context)) {\n\t\tconst cssVariableReference = context.cssVariableDefinitions.create(node, \"textTruncation\")\n\t\tassignTruncationCSSProperties(style, cssVariableReference)\n\t\treturn\n\t}\n\n\tconst resolvedTextTruncation = node.resolveValue(\"textTruncation\", context.variableOverrides)\n\tif (isNumber(resolvedTextTruncation)) {\n\t\tassignTruncationCSSProperties(style, String(resolvedTextTruncation))\n\t} else {\n\t\t// When truncation is disabled, explicitly set properties to undefined so that variant\n\t\t// overrides can properly reset the truncation styles. Without this, the difference\n\t\t// function won't detect that truncation was removed, and the base variant's truncation\n\t\t// CSS will continue to apply.\n\t\tunsetTruncationCSSProperties(style)\n\t}\n})\n\nfunction assignTruncationCSSProperties(\n\tstyle: SerializableMotionStyle,\n\tvalue: SerializableMotionStyle[keyof SerializableMotionStyle],\n) {\n\t// We use `-webkit-line-clamp` because, as of Aug 2025, the `line-clamp` property is still in\n\t// Working Draft stage. In the future, the `-webkit-*` version will still be supported for\n\t// backwards compatibility.\n\t// @see https://www.w3.org/TR/css-overflow-4/#webkit-line-clamp\n\tstyle.WebkitLineClamp = value\n\tstyle.WebkitBoxOrient = \"vertical\"\n\n\t// `display: -webkit-box` is required for `-webkit-line-clamp` to work, and overrides the\n\t// default inline `display` value of the @link{RichTextContainer} component.\n\t// NOTE: `-webkit-box` doesn't support all the features of `flex`, but it is similar enough to\n\t// work for text truncation purposes. For example, `justify-content` is not supported, but\n\t// truncated text is used with auto height, so vertical alignment makes no sense.\n\tstyle.display = \"-webkit-box\"\n\n\t// These variables are used in all RichTextContainer nodes when Safari <= 16 to fix truncation\n\t// issues. When text truncation is not enabled, these variables are undefined, the browser\n\t// defaults are used, so this fix doesn't interfere with text that doesn't have truncation.\n\tstyle[textTruncationDisplayInlineVariableForSafari16] = \"inline\"\n\tstyle[textTruncationDisplayNoneVariableForSafari16] = \"none\"\n\n\t//  \\A, \\a, or \\00000a are all valid line-break characters in the CSS content property. The\n\t//  extra \"\" and \\ were needed to escape the character when set in the collector, but are\n\t//  normally not needed if set directly in CSS.\n\tstyle[textTruncationLineBreakVariableForSafari16] = '\"\\\\A\"'\n}\n\nfunction unsetTruncationCSSProperties(style: SerializableMotionStyle) {\n\t// Setting these to undefined allows the difference function to detect that truncation was\n\t// removed and output the appropriate CSS (e.g., `unset`).\n\tstyle.WebkitLineClamp = undefined\n\tstyle.WebkitBoxOrient = undefined\n\tstyle.display = undefined\n\n\t// Reset Safari 16 fix variables\n\tstyle[textTruncationDisplayInlineVariableForSafari16] = undefined\n\tstyle[textTruncationDisplayNoneVariableForSafari16] = undefined\n\tstyle[textTruncationLineBreakVariableForSafari16] = undefined\n}\n", "import { ValueObject } from \"@framerjs/shared\"\nimport type { WithTokenVariables } from \"document/models/CanvasTree/traits/WithTokenVariables.ts\"\nimport type { MultiStopGradient } from \"library/render/types/MultiStopGradient.ts\"\nimport { gradientColorStops } from \"library/render/utils/gradientColorStops.ts\"\nimport { withClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport { findValueForTokenCSSVariable } from \"./CanvasTree/utils/tokens.ts\"\nimport { GradientColorStop, equalColorStops } from \"./GradientColorStop.ts\"\n\nexport function isConicGradient(node: unknown): node is ConicGradient {\n\treturn node instanceof ConicGradient\n}\n\nconst defaultGradientStops: readonly GradientColorStop[] = [\n\tnew GradientColorStop({ value: \"rgba(0,0,0,0)\", position: 0 }),\n\tnew GradientColorStop({ value: \"rgba(0,0,0,1)\", position: 1 }),\n]\n\nexport class ConicGradient\n\textends withClassDiscriminator(\"ConicGradient\")\n\timplements\n\t\tWithTokenVariables<\n\t\t\tMultiStopGradient & { centerAnchorX: number; centerAnchorY: number; angle: number; alpha: number }\n\t\t>\n{\n\t/** @deprecated No longer editable from UI */\n\treadonly alpha: number = 1\n\treadonly angle: number = 0\n\treadonly centerAnchorX: number = 0.5\n\treadonly centerAnchorY: number = 0.5\n\treadonly stops: readonly GradientColorStop[] = defaultGradientStops\n\n\tconstructor(values?: Partial<ConicGradient>) {\n\t\tsuper()\n\t\tValueObject.writeOnce(this, values)\n\t}\n\n\tupdated(values: Partial<ConicGradient>): ConicGradient {\n\t\treturn ValueObject.update(this, values)\n\t}\n\n\ttoCSS(_overrideAngle?: number, getStopValue?: (value: string) => string | undefined) {\n\t\tconst { alpha, angle, centerAnchorX, centerAnchorY } = this\n\t\t// Ensure integer angles in CSS output, matching `GradientAngleTool.update()`.\n\t\tconst roundedAngle = Math.round(angle)\n\t\tconst stops = gradientColorStops(this, alpha)\n\t\tconst cssStops = stops\n\t\t\t.map(stop => `${getStopValue?.(stop.value) ?? stop.value} ${stop.position * 360}deg`)\n\t\t\t.join(\", \")\n\t\treturn `conic-gradient(from ${roundedAngle}deg at ${centerAnchorX * 100}% ${centerAnchorY * 100}%, ${cssStops})`\n\t}\n\n\tequals(other: ConicGradient): boolean {\n\t\treturn (\n\t\t\tthis.angle === other.angle &&\n\t\t\tthis.centerAnchorX === other.centerAnchorX &&\n\t\t\tthis.centerAnchorY === other.centerAnchorY &&\n\t\t\tthis.equalColors(other)\n\t\t)\n\t}\n\n\tequalColors(other: ConicGradient): boolean {\n\t\treturn this.alpha === other.alpha && equalColorStops(this.stops, other.stops)\n\t}\n\n\t// WithTokenVariables\n\n\tremoveTokenVariables(variables: { [tokenId: string]: string }): ConicGradient | undefined {\n\t\tlet changed = false\n\n\t\tconst stops = this.stops.map((stop: GradientColorStop) => {\n\t\t\tconst replacement = findValueForTokenCSSVariable(stop.value, variables)\n\t\t\tif (replacement) {\n\t\t\t\tchanged = true\n\t\t\t\treturn stop.merge({ value: replacement })\n\t\t\t} else {\n\t\t\t\treturn stop\n\t\t\t}\n\t\t})\n\n\t\tif (changed) {\n\t\t\treturn this.updated({ stops })\n\t\t}\n\t}\n}\n", "import { ValueObject } from \"@framerjs/shared\"\nimport type { WithTokenVariables } from \"document/models/CanvasTree/traits/WithTokenVariables.ts\"\nimport { findValueForTokenCSSVariable, isTokenCSSVariable } from \"document/models/CanvasTree/utils/tokens.ts\"\nimport type { LinearGradientBase } from \"library/render/types/Gradient.ts\"\nimport { LinearGradient as LinearGradientInterface } from \"library/render/types/Gradient.ts\"\nimport { withClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport { GradientColorStop, equalColorStops } from \"./GradientColorStop.ts\"\n\nexport function isLinearGradient(node: unknown): node is LinearGradient {\n\treturn node instanceof LinearGradient\n}\n\nconst defaultGradientStops: readonly GradientColorStop[] = [\n\tnew GradientColorStop({ value: \"rgba(0,0,0,0)\", position: 0 }),\n\tnew GradientColorStop({ value: \"rgba(0,0,0,1)\", position: 1 }),\n]\n\nexport class LinearGradient\n\textends withClassDiscriminator(\"LinearGradient\")\n\timplements LinearGradientBase, WithTokenVariables<LinearGradient>\n{\n\t/** @deprecated No longer editable from UI */\n\treadonly alpha: number = 1\n\t// follows CSS linear-gradient angle, where 180\u00B0 means the top is more masked & 90\u00B0 means the left is more masked\n\treadonly angle: number = 180\n\treadonly stops: readonly GradientColorStop[] = defaultGradientStops\n\n\tconstructor(value?: Partial<LinearGradient>) {\n\t\tsuper()\n\t\tValueObject.writeOnce(this, value)\n\t}\n\n\tupdated(value: Partial<LinearGradient>): LinearGradient {\n\t\t// Alpha isn't compatible with variables\n\t\tconst hasAlphaOne = value.alpha === 1 || (value.alpha === undefined && this.alpha === 1)\n\t\tif (!hasAlphaOne && value.stops?.some((stop: GradientColorStop) => isTokenCSSVariable(stop.value))) {\n\t\t\tvalue = { ...value, alpha: 1 }\n\t\t}\n\t\treturn ValueObject.update(this, value)\n\t}\n\n\ttoCSS(overrideAngle?: number, getStopValue?: (value: string) => string | undefined) {\n\t\t// TODO we used to cache this\n\t\treturn LinearGradientInterface.toCSS(this, overrideAngle, getStopValue)\n\t}\n\n\tequals(other: LinearGradient): boolean {\n\t\treturn this.angle === other.angle && this.equalColors(other)\n\t}\n\n\tequalColors(other: LinearGradient): boolean {\n\t\treturn this.alpha === other.alpha && equalColorStops(this.stops, other.stops)\n\t}\n\n\tremoveTokenVariables(variables: { [tokenId: string]: string }): LinearGradient | undefined {\n\t\tlet changed = false\n\n\t\tconst stops = this.stops.map((stop: GradientColorStop) => {\n\t\t\tconst replacement = findValueForTokenCSSVariable(stop.value, variables)\n\t\t\tif (replacement) {\n\t\t\t\tchanged = true\n\t\t\t\treturn stop.merge({ value: replacement })\n\t\t\t} else {\n\t\t\t\treturn stop\n\t\t\t}\n\t\t})\n\n\t\tif (changed) {\n\t\t\treturn this.updated({ stops })\n\t\t}\n\t}\n}\n", "import { ValueObject } from \"@framerjs/shared\"\nimport type { WithTokenVariables } from \"document/models/CanvasTree/traits/WithTokenVariables.ts\"\nimport type { RadialGradientBase } from \"library/render/types/Gradient.ts\"\nimport { RadialGradient as RadialGradientInterface } from \"library/render/types/Gradient.ts\"\nimport { withClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport { findValueForTokenCSSVariable } from \"./CanvasTree/utils/tokens.ts\"\nimport { GradientColorStop, equalColorStops } from \"./GradientColorStop.ts\"\n\nexport function isRadialGradient(node: unknown): node is RadialGradient {\n\treturn node instanceof RadialGradient\n}\n\nconst defaultGradientStops: readonly GradientColorStop[] = [\n\tnew GradientColorStop({ value: \"rgba(0,0,0,0)\", position: 0 }),\n\tnew GradientColorStop({ value: \"black\", position: 1 }),\n]\n\nexport class RadialGradient\n\textends withClassDiscriminator(\"RadialGradient\")\n\timplements RadialGradientBase, WithTokenVariables<RadialGradient>\n{\n\t/** @deprecated No longer editable from UI */\n\treadonly alpha: number = 1\n\treadonly widthFactor: number = 0.5\n\treadonly heightFactor: number = 0.5\n\treadonly centerAnchorX: number = 0.5\n\treadonly centerAnchorY: number = 0.5\n\treadonly stops: readonly GradientColorStop[] = defaultGradientStops\n\n\tconstructor(values?: Partial<RadialGradient>) {\n\t\tsuper()\n\t\tValueObject.writeOnce(this, values)\n\t}\n\n\tupdated(values: Partial<RadialGradient>): RadialGradient {\n\t\treturn ValueObject.update(this, values)\n\t}\n\n\ttoCSS(_overrideAngle?: number, getStopValue?: (value: string) => string | undefined) {\n\t\treturn RadialGradientInterface.toCSS(this, getStopValue)\n\t}\n\n\tequals(other: RadialGradient): boolean {\n\t\treturn (\n\t\t\tthis.widthFactor === other.widthFactor &&\n\t\t\tthis.heightFactor === other.heightFactor &&\n\t\t\tthis.centerAnchorX === other.centerAnchorX &&\n\t\t\tthis.centerAnchorY === other.centerAnchorY &&\n\t\t\tthis.equalColors(other)\n\t\t)\n\t}\n\n\tequalColors(other: RadialGradient): boolean {\n\t\treturn this.alpha === other.alpha && equalColorStops(this.stops, other.stops)\n\t}\n\n\t// WithTokenVariables\n\n\tremoveTokenVariables(variables: { [tokenId: string]: string }): RadialGradient | undefined {\n\t\tlet changed = false\n\n\t\tconst stops = this.stops.map((stop: GradientColorStop) => {\n\t\t\tconst replacement = findValueForTokenCSSVariable(stop.value, variables)\n\t\t\tif (replacement) {\n\t\t\t\tchanged = true\n\t\t\t\treturn stop.merge({ value: replacement })\n\t\t\t} else {\n\t\t\t\treturn stop\n\t\t\t}\n\t\t})\n\n\t\tif (changed) {\n\t\t\treturn this.updated({ stops })\n\t\t}\n\t}\n}\n", "import { assert, List, assertNever } from \"@framerjs/shared\"\nimport type { GradientToolManagerToolType } from \"document/components/tools/gradient/GradientToolManagerTool.tsx\"\nimport { Tools } from \"document/stores/ToolEnum.ts\"\nimport { isNull, isUndefined } from \"utils/typeChecks.ts\"\nimport type { NodeID } from \"./CanvasTree/index.ts\"\nimport type { CanvasNode } from \"./CanvasTree/nodes/CanvasNode.ts\"\nimport type { RichTextNode } from \"./CanvasTree/nodes/RichTextNode.ts\"\nimport { isRichTextNode } from \"./CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { FillType, GradientFillType, WithFill } from \"./CanvasTree/traits/WithFill.ts\"\nimport { withFill } from \"./CanvasTree/traits/WithFill.ts\"\nimport type { Mask, WithMasks } from \"./CanvasTree/traits/WithMasks.ts\"\nimport { withMasks } from \"./CanvasTree/traits/WithMasks.ts\"\nimport { ConicGradient, isConicGradient } from \"./ConicGradientClass.ts\"\nimport { LinearGradient, isLinearGradient } from \"./LinearGradientClass.ts\"\nimport { RadialGradient, isRadialGradient } from \"./RadialGradientClass.ts\"\n\nexport { ConicGradient, LinearGradient, RadialGradient }\n\nexport type GradientTool = Tools.FillGradient | Tools.MaskGradient\nexport type Gradient = LinearGradient | RadialGradient | ConicGradient\n\nexport function isGradient(value: unknown): value is Gradient {\n\treturn isLinearGradient(value) || isRadialGradient(value) || isConicGradient(value)\n}\n\nexport function getActiveGradient(\n\tnode: CanvasNode | null | undefined,\n\tgradientEngine: GradientToolManagerToolType,\n): Gradient | null {\n\tif (!node) return null\n\tconst type = gradientEngine.enum\n\tswitch (type) {\n\t\tcase Tools.FillGradient: {\n\t\t\tif (isRichTextNode(node)) return getGradientFromRichTextNode(node)\n\t\t\tif (!withFill(node) || !node.fillType) return null\n\t\t\tswitch (node.fillType) {\n\t\t\t\tcase \"linear-gradient\":\n\t\t\t\t\treturn node.fillLinearGradient ?? null\n\t\t\t\tcase \"radial-gradient\":\n\t\t\t\t\treturn node.fillRadialGradient ?? null\n\t\t\t\tcase \"conic-gradient\":\n\t\t\t\t\treturn node.fillConicGradient ?? null\n\t\t\t\tcase \"color\":\n\t\t\t\tcase \"image\":\n\t\t\t\t\treturn null\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(node.fillType)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tcase Tools.MaskGradient: {\n\t\t\tif (!withMasks(node) || !node.masks) return null\n\t\t\tconst maskId = gradientEngine.maskIds?.[node.id]\n\t\t\tif (!maskId) return null\n\t\t\tconst mask = node.masks.find(maskItem => maskItem.id === maskId)\n\t\t\tif (!mask) return null\n\n\t\t\tswitch (mask.maskType) {\n\t\t\t\tcase \"linear-gradient\":\n\t\t\t\t\treturn mask.maskLinearGradient ?? null\n\t\t\t\tcase \"radial-gradient\":\n\t\t\t\t\treturn mask.maskRadialGradient ?? null\n\t\t\t\tcase \"conic-gradient\":\n\t\t\t\t\treturn mask.maskConicGradient ?? null\n\t\t\t\tcase \"image\":\n\t\t\t\t\treturn null\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(mask.maskType)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\nexport function gradientFillType(gradient: unknown): GradientFillType | undefined {\n\tif (isLinearGradient(gradient)) return \"linear-gradient\"\n\tif (isRadialGradient(gradient)) return \"radial-gradient\"\n\tif (isConicGradient(gradient)) return \"conic-gradient\"\n\treturn undefined\n}\n\nfunction getGradientPropsForNode<T extends WithFill | WithMasks>(\n\tnode: CanvasNode & T,\n\ttype: GradientTool,\n\tmaskId: string | null = null,\n) {\n\tswitch (type) {\n\t\tcase Tools.FillGradient:\n\t\t\tassert(withFill(node))\n\t\t\treturn {\n\t\t\t\tlinearGradient: node.fillLinearGradient,\n\t\t\t\tradialGradient: node.fillRadialGradient,\n\t\t\t\tconicGradient: node.fillConicGradient,\n\t\t\t}\n\n\t\tcase Tools.MaskGradient: {\n\t\t\tassert(withMasks(node) && node.masks !== undefined)\n\t\t\tif (!maskId) return {}\n\t\t\tconst mask = getNodeMaskForMaskId(node, maskId)\n\t\t\tif (!mask) return {}\n\n\t\t\treturn {\n\t\t\t\tlinearGradient: mask.value.maskLinearGradient,\n\t\t\t\tradialGradient: mask.value.maskRadialGradient,\n\t\t\t\tconicGradient: mask.value.maskConicGradient,\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\nexport function linearGradientUpdate<T extends WithFill | WithMasks>(\n\tnode: CanvasNode & T,\n\tupdate: Partial<LinearGradient>,\n\ttype: GradientTool,\n\tmaskId: string | null = null,\n): LinearGradient {\n\tconst nodeGradientProps = getGradientPropsForNode(node, type, maskId)\n\tconst gradient = nodeGradientProps.linearGradient || new LinearGradient()\n\treturn gradient.updated(update)\n}\n\nexport function radialGradientUpdate<T extends WithFill | WithMasks>(\n\tnode: CanvasNode & T,\n\tupdate: Partial<RadialGradient>,\n\ttype: GradientTool,\n\tmaskId: string | null = null,\n): RadialGradient {\n\tconst nodeGradientProps = getGradientPropsForNode(node, type, maskId)\n\tconst gradient = nodeGradientProps.radialGradient || new RadialGradient()\n\treturn gradient.updated(update)\n}\n\nexport function conicGradientUpdate<T extends WithFill | WithMasks>(\n\tnode: CanvasNode & T,\n\tupdate: Partial<ConicGradient>,\n\ttype: GradientTool,\n\tmaskId: string | null = null,\n): ConicGradient {\n\tconst nodeGradientProps = getGradientPropsForNode(node, type, maskId)\n\tconst gradient = nodeGradientProps.conicGradient || new ConicGradient()\n\treturn gradient.updated(update)\n}\n\nexport function getGradientType(\n\tnode: RichTextNode | (CanvasNode & (WithFill | WithMasks)),\n\tgradientEngine: GradientToolManagerToolType,\n): FillType | undefined {\n\tconst type = gradientEngine.enum\n\tswitch (type) {\n\t\tcase Tools.FillGradient:\n\t\t\tif (isRichTextNode(node)) return getGradientTypeFromRichNode(node)\n\t\t\treturn withFill(node) ? node.fillType : undefined\n\t\tcase Tools.MaskGradient: {\n\t\t\tconst maskId = gradientEngine.maskIds?.[node.id]\n\t\t\tif (!maskId) return undefined\n\t\t\tconst mask = getNodeMaskForMaskId(node, maskId)\n\t\t\tif (!mask) return undefined\n\t\t\treturn mask.value.maskType\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\nexport function getNodeMaskForMaskId(node: CanvasNode, maskId: NodeID): { value: Mask; index: number } | undefined {\n\tif (!withMasks(node) || !node.masks) return undefined\n\tif (isNull(maskId)) return undefined\n\n\tconst index = node.masks.findIndex(m => maskId === m.id)\n\n\tif (index === -1) return undefined\n\n\tconst mask = node.masks[index]\n\tif (isUndefined(mask)) return undefined\n\n\treturn { value: mask, index }\n}\n\nfunction getGradientTypeFromRichNode(node: RichTextNode): FillType | undefined {\n\tlet [fill] = node.getFills()\n\tif (!fill) return undefined\n\n\tif (isGradient(fill)) {\n\t\tfill = fill.toCSS()\n\t}\n\n\tif (fill.startsWith(\"linear-gradient\")) return \"linear-gradient\"\n\tif (fill.startsWith(\"radial-gradient\")) return \"radial-gradient\"\n\tif (fill.startsWith(\"conic-gradient\")) return \"conic-gradient\"\n\treturn undefined\n}\n\nfunction getGradientFromRichTextNode(node: RichTextNode) {\n\tconst fills = node.getFills()\n\tconst [fill] = fills\n\n\treturn isGradient(fill) ? fill : null\n}\n\ninterface MaskGradientUpdate {\n\tmaskLinearGradient?: Partial<LinearGradient>\n\tmaskRadialGradient?: Partial<RadialGradient>\n\tmaskConicGradient?: Partial<ConicGradient>\n}\n\nexport function updateMaskGradientForNode(\n\tnode: CanvasNode & WithMasks,\n\tmaskId: string | null,\n\tupdate: MaskGradientUpdate,\n) {\n\tif (isUndefined(node.masks)) return\n\tconst mask = node.masks.find(maskItem => maskItem.id === maskId)\n\tif (!mask) return\n\tconst updatedValues: Mask = { ...mask }\n\n\tif (update.maskLinearGradient) {\n\t\tupdatedValues.maskLinearGradient = linearGradientUpdate(node, update.maskLinearGradient, Tools.MaskGradient, maskId)\n\t}\n\n\tif (update.maskRadialGradient) {\n\t\tupdatedValues.maskRadialGradient = radialGradientUpdate(node, update.maskRadialGradient, Tools.MaskGradient, maskId)\n\t}\n\n\tif (update.maskConicGradient) {\n\t\tupdatedValues.maskConicGradient = conicGradientUpdate(node, update.maskConicGradient, Tools.MaskGradient, maskId)\n\t}\n\n\tnode.set({\n\t\tmasks: List.replace(node.masks, node.masks.indexOf(mask), updatedValues),\n\t})\n}\n", "import { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport { type CollectorContext, isStylePresetContext } from \"code-generation/utils/collector.ts\"\nimport { ConvertColor } from \"library/index.ts\"\nimport { valueOrTokenWithoutMetadata } from \"./tokens.ts\"\n\nexport function resolveColor(color: string | undefined, context: CollectorContext | undefined) {\n\tif (!color) return color\n\n\tif (isJSXContext(context)) {\n\t\treturn context.cssVariableDefinitions.resolveColor(color)\n\t}\n\tif (isStylePresetContext(context)) {\n\t\treturn context.colors.resolveColor(color)\n\t}\n\n\treturn valueOrTokenWithoutMetadata(color, ConvertColor.toFormatString)\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport { jst } from \"code-generation/js/js.ts\"\nimport { type SafeJS, isSafeJS } from \"code-generation/js/serializeJS.ts\"\nimport { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport type { SerializableMotionStyle } from \"code-generation/types.ts\"\nimport { styleCollector } from \"code-generation/utils/collector.ts\"\nimport { withSVG } from \"document/models/CanvasTree/traits/WithSVG.ts\"\nimport { withShape } from \"document/models/CanvasTree/traits/WithShape.ts\"\nimport { ConicGradient, LinearGradient, RadialGradient } from \"document/models/Gradient.ts\"\nimport { GradientColorStop } from \"document/models/GradientColorStop.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { FormInputStyleVariableNames } from \"library/render/presentation/Forms/shared.ts\"\nimport { ConvertColor } from \"library/render/types/Color/index.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { resolveColor } from \"../../utils/resolveColor.ts\"\nimport { isTokenCSSVariable, stripMetadataFromCSSVariable } from \"../../utils/tokens.ts\"\nimport { isDynamicValue } from \"../DynamicValue.ts\"\nimport type { CombinedVariableProviderValueMap } from \"../VariableProvider.ts\"\nimport {\n\ttype VariantGradientInfo,\n\ttype WithFill,\n\tgenerateGradientStopsSafeJS,\n\twithFill,\n\twithOptionalFill,\n} from \"../WithFill.ts\"\nimport { withFormInput } from \"../forms/WithFormInput.ts\"\nimport { isStylableNode } from \"../utils/hardCodedCodeComponentIdentifierChecks.ts\"\n\nexport function getCSSBackgroundValue(\n\tnode: CanvasNode,\n\tvariableOverrides?: CombinedVariableProviderValueMap,\n\tgetStopValue?: (value: string) => string | undefined,\n) {\n\tif (!withFill(node) || (withOptionalFill(node) && !node.fillEnabled)) return undefined\n\n\tswitch (node.fillType) {\n\t\tcase \"color\": {\n\t\t\tconst color = node.resolveValue(\"fillColor\", variableOverrides)\n\t\t\tif (!color) return undefined\n\n\t\t\t// For rendering we don't need to include the metadata. It\n\t\t\t// could result in confusing code generation results.\n\t\t\treturn isTokenCSSVariable(color) ? stripMetadataFromCSSVariable(color) : ConvertColor.toFormatString(color)\n\t\t}\n\t\tcase \"linear-gradient\":\n\t\t\treturn node.fillLinearGradient ? node.fillLinearGradient.toCSS(undefined, getStopValue) : undefined\n\t\tcase \"radial-gradient\":\n\t\t\treturn node.fillRadialGradient ? node.fillRadialGradient.toCSS(undefined, getStopValue) : undefined\n\t\tcase \"conic-gradient\":\n\t\t\treturn node.fillConicGradient ? node.fillConicGradient.toCSS(undefined, getStopValue) : undefined\n\t\tdefault:\n\t\t\treturn undefined\n\t}\n}\n\nexport const collectBackgroundFill = styleCollector((node, style, ctx) => {\n\tif (withShape(node) || withSVG(node)) {\n\t\t// Currently this does not support SVG or Shape nodes, because they\n\t\t// render the background using a separate element and need the props\n\t\treturn\n\t}\n\n\t// Code Components support the WithFilters trait, but only to support Page\n\t// and Scroll which are style-able. If this node is not one of those\n\t// components, don't collect background fill.\n\tif (!isStylableNode(node)) return\n\n\tif (withOptionalFill(node) && !node.fillEnabled) {\n\t\tstyle.backgroundColor = undefined\n\t\t// Since we apply gradient to `background` property, we need to unset it when disabling\n\t\t// fill. Otherwise, the `background` set on possibly a primary node will take precedence\n\t\t// even if a replica disables fill. See https://github.com/framer/company/issues/35629\n\t\tstyle.background = undefined\n\t\treturn\n\t}\n\n\tif (!withFill(node)) return\n\n\tconst values: SerializableMotionStyle = {\n\t\tbackgroundColor: undefined,\n\t}\n\n\tconst color = getCSSBackgroundValue(node, ctx.variableOverrides, (value: string) => resolveColor(value, ctx))\n\n\tswitch (node.fillType) {\n\t\tcase \"color\":\n\t\t\tif (node.fillColor) {\n\t\t\t\tconst value =\n\t\t\t\t\tisJSXContext(ctx) && isDynamicValue(node.fillColor)\n\t\t\t\t\t\t? ctx.cssVariableDefinitions.create(node, \"fillColor\")\n\t\t\t\t\t\t: resolveColor(color, ctx)\n\n\t\t\t\tvalues.backgroundColor = value\n\n\t\t\t\tif (!isJSXContext(ctx) || !ctx.nodesWithAnyGradientFill) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tconst variantGradient = ctx.nodesWithAnyGradientFill.get(node.getPrimaryId())\n\t\t\t\tif (variantGradient) {\n\t\t\t\t\t// Since we apply gradient to `background` property, we need to unset it to the\n\t\t\t\t\t// solid color if any of the variants has a gradient. Otherwise, the `background`\n\t\t\t\t\t// set on possibly a primary node will take precedence over the solid color set on a\n\t\t\t\t\t// replica. See https://github.com/framer/company/issues/35629. If it's a smart\n\t\t\t\t\t// component, we assign the converted gradient to the background property since we\n\t\t\t\t\t// can't animate background color in Framer Motion.\n\t\t\t\t\tvalues.background =\n\t\t\t\t\t\tctx.scopeType === ScopeType.SmartComponent ? createVariantGradientFill(variantGradient, value) : value\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tbreak\n\t\tcase \"linear-gradient\":\n\t\tcase \"radial-gradient\":\n\t\tcase \"conic-gradient\":\n\t\t\tvalues.background = color\n\t\t\tbreak\n\t\tcase \"image\": {\n\t\t\tif (!isJSXContext(ctx) || !ctx.nodesWithAnyGradientFill) {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tconst variantGradient = ctx.nodesWithAnyGradientFill.get(node.getPrimaryId())\n\t\t\tif (variantGradient) {\n\t\t\t\t// If any of the variants has a gradient fill, it might collect a `background`\n\t\t\t\t// color/gradient. We need to unset it if the fill type is image, otherwise when the\n\t\t\t\t// fill switches to something else in a different variant, the image disappears\n\t\t\t\t// instantly, but the stale background might still be visible (e.g. if the new image\n\t\t\t\t// is still loading, or if it animates out in a smart component).\n\t\t\t\tvalues.background = undefined\n\t\t\t\tvalues.backgroundColor = undefined\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\n\tObject.assign(style, transformValues(values, node))\n})\n\nfunction transformValues(values: SerializableMotionStyle, node: CanvasNode & WithFill) {\n\tif (!withFormInput(node)) return values\n\treturn {\n\t\t[FormInputStyleVariableNames.Background]: values.backgroundColor ?? values.background,\n\t}\n}\n\n/**\n * Converts the solid color to a gradient if one of the variants has a gradient fill.\n */\nfunction createVariantGradientFill(\n\tvariantGradient: VariantGradientInfo | undefined,\n\tvalue: SafeJS | string | undefined,\n) {\n\tif (!variantGradient || !value) return undefined\n\n\tconst stopCount = variantGradient.stops\n\tconst { type, angle } = variantGradient.info\n\n\t/**\n\t * If one of the variants has a gradient fill, we need to create a linear gradient from the color.\n\t * Otherwise, the variant with the solid color displays the gradient fill as well. We only do this in\n\t * Smart Components since we can inline styles to framer-motion variants and don't need to use css-variables\n\t * to inject dynamic values into css rules, and because only smart components can animate background color.\n\t */\n\tif (isSafeJS(value)) {\n\t\tconst stops = generateGradientStopsSafeJS(stopCount, value, type)\n\n\t\tswitch (type) {\n\t\t\tcase \"linear-gradient\":\n\t\t\t\treturn jst`linear-gradient(${angle}deg, ${stops})`\n\t\t\tcase \"radial-gradient\":\n\t\t\t\treturn jst`radial-gradient(50% 50% at 50% 50%, ${stops})`\n\t\t\tcase \"conic-gradient\":\n\t\t\t\treturn jst`conic-gradient(from ${angle}deg at 50% 50%, ${stops})`\n\t\t\tdefault:\n\t\t\t\tassertNever(type)\n\t\t}\n\t}\n\n\tconst stops: GradientColorStop[] = Array.from(\n\t\t{ length: stopCount },\n\t\t(_, i) =>\n\t\t\tnew GradientColorStop({\n\t\t\t\tvalue,\n\t\t\t\tposition: Math.round((i / (stopCount - 1)) * 100) / 100,\n\t\t\t}),\n\t)\n\t/**\n\t * If one of the variants has a gradient fill, we need to create a gradient from the color.\n\t * Otherwise, the variant with the solid color displays the gradient fill as well.\n\t */\n\tswitch (type) {\n\t\tcase \"linear-gradient\":\n\t\t\treturn new LinearGradient({ stops, angle }).toCSS()\n\t\tcase \"radial-gradient\":\n\t\t\treturn new RadialGradient({ stops }).toCSS()\n\t\tcase \"conic-gradient\": {\n\t\t\treturn new ConicGradient({ stops, angle }).toCSS()\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n", "import { js } from \"code-generation/js/js.ts\"\nimport { styleCollector } from \"code-generation/utils/collector.ts\"\nimport { isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport { isVariableReference } from \"../VariableReference.ts\"\nimport { withFilters } from \"../WithFilters.ts\"\nimport { isStylableNode } from \"../utils/hardCodedCodeComponentIdentifierChecks.ts\"\n\nexport const collectBackgroundFilters = styleCollector((node, style, context) => {\n\tif (!withFilters(node)) return\n\t// Code Components support the WithFilters trait, but only to support Page\n\t// and Scroll which are style-able. If this node is not one of those\n\t// components, don't collect filters.\n\tif (!isStylableNode(node)) return\n\tif (isUndefined(node.backgroundBlur)) {\n\t\tstyle.backdropFilter = style.WebkitBackdropFilter = undefined\n\t\treturn\n\t}\n\n\tif (context.variables && isVariableReference(node.backgroundBlur)) {\n\t\tconst binding = context.variables.create(node.backgroundBlur)\n\t\tstyle.backdropFilter = style.WebkitBackdropFilter = js`${binding} === 0 ? undefined : \"blur(\" + ${binding} + \"px)\"`\n\t\treturn\n\t}\n\n\tconst value = node.resolveValue(\"backgroundBlur\")\n\tif (isNumber(value)) {\n\t\tstyle.backdropFilter = style.WebkitBackdropFilter = value === 0 ? undefined : `blur(${value}px)`\n\t}\n})\n", "import { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport { type CollectorContext, styleCollector } from \"code-generation/utils/collector.ts\"\nimport type { WithBoxShadow } from \"document/models/CanvasTree/traits/WithBoxShadow.ts\"\nimport { withBoxShadow } from \"document/models/CanvasTree/traits/WithBoxShadow.ts\"\nimport { FormInputStyleVariableNames } from \"library/render/presentation/Forms/shared.ts\"\nimport { boxShadowToCSS } from \"utils/boxShadowToCSS.ts\"\nimport { isArray, isString } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { isVectorNode } from \"../../nodes/TreeNode.ts\"\nimport { isAnyTextNode } from \"../../nodes/utils/isAnyTextNode.ts\"\nimport { isDynamicValue } from \"../DynamicValue.ts\"\nimport { withFormInput } from \"../forms/WithFormInput.ts\"\nimport { isStylableNode } from \"../utils/hardCodedCodeComponentIdentifierChecks.ts\"\nimport { shouldRenderShadowUsingFilter } from \"../utils/wantsFilterShadow.ts\"\n\nfunction resolveShadow(node: CanvasNode & WithBoxShadow, ctx: CollectorContext) {\n\tif (isDynamicValue(node.boxShadows) && isJSXContext(ctx)) {\n\t\treturn ctx.cssVariableDefinitions.create(node, \"boxShadows\")\n\t}\n\n\tconst resolvedBoxShadows = node.resolveValue(\"boxShadows\", ctx.variableOverrides)\n\tif (!isArray(resolvedBoxShadows)) return isString(resolvedBoxShadows) ? resolvedBoxShadows : undefined\n\n\treturn shouldRenderShadowUsingFilter(node)\n\t\t? boxShadowToCSS(\n\t\t\t\tresolvedBoxShadows.filter(shadow => shadow.inset),\n\t\t\t\t\"undefinedWhenEmpty\",\n\t\t\t\tcolor => ctx.cssVariableDefinitions?.resolveColor?.(color),\n\t\t\t)\n\t\t: boxShadowToCSS(resolvedBoxShadows, \"undefinedWhenEmpty\", color =>\n\t\t\t\tctx.cssVariableDefinitions?.resolveColor?.(color),\n\t\t\t)\n}\n\nexport const collectBoxShadow = styleCollector((node, style, ctx) => {\n\tif (!withBoxShadow(node) || isAnyTextNode(node) || isVectorNode(node)) return\n\n\t// Code Components support the WithBoxShadow trait, but only to support Page and Scroll which\n\t// are style-able. If this node is not one of those components, don't collect shadows.\n\tif (!isStylableNode(node)) return\n\n\tconst value = resolveShadow(node, ctx)\n\tconst key = withFormInput(node) ? FormInputStyleVariableNames.BoxShadow : \"boxShadow\"\n\tstyle[key] = value\n})\n", "import { js } from \"code-generation/js/js.ts\"\nimport { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport type { SerializableMotionStyle } from \"code-generation/types.ts\"\nimport type { CollectorContext } from \"code-generation/utils/collector.ts\"\nimport { styleCollector } from \"code-generation/utils/collector.ts\"\nimport { hasTextTruncation, withTextTruncation } from \"document/models/CanvasTree/traits/WithTextTruncation.ts\"\nimport { isAutoSizedOnBothDimensions } from \"document/models/CanvasTree/traits/utils/autoSizeHelpers.ts\"\nimport { overflowClipFallbackCSSVariable } from \"library/render/utils/injectComponentCSSRules.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { isAnyTextNode } from \"../../nodes/utils/isAnyTextNode.ts\"\nimport { isDynamicValue } from \"../DynamicValue.ts\"\nimport type { AxisOverflowKeys, Overflow, WithOverflow } from \"../WithOverflow.ts\"\nimport { isAxisOverflowCompatible, isClippingOverflowValue, withOverflow } from \"../WithOverflow.ts\"\n\nfunction collectAxisOverflow(\n\tkey: AxisOverflowKeys,\n\tnode: CanvasNode & WithOverflow,\n\tstyle: SerializableMotionStyle,\n\tcontext: CollectorContext,\n) {\n\tconst value = node[key]\n\tif (isUndefined(value) || value === style.overflow) return\n\n\tif (isDynamicValue(node[key]) && isJSXContext(context)) {\n\t\tconst overflow = isDynamicValue(node.overflow)\n\t\t\t? context.createDeduplicatedDynamicValueBinding(node.overflow, node, \"overflow\")\n\t\t\t: node.overflow\n\t\tstyle[key] = context.cssVariableDefinitions.create(node, key, overflow ?? js`undefined`)\n\n\t\treturn\n\t}\n\n\tconst resolvedAxisOverflow = node.resolveValue(key, context.variableOverrides)\n\n\t// Don't collect incompatible axis overflows. This is consistent with the behavior that existed\n\t// before overflow:clip was introduced, where all overflow[X|Y] values were ignored when the\n\t// main overflow was set to \"visible\".\n\tconst mainOverflow = node.resolveValue(\"overflow\", context.variableOverrides)\n\tif (!isAxisOverflowCompatible(mainOverflow, resolvedAxisOverflow)) return\n\n\tstyle[key] = wrapInClipFallback(resolvedAxisOverflow)\n}\n\n/**\n * Collect overflow and axis overrides. Avoid ever having only overflow-x and\n * overflow-y, and instead prioritize having a primary overflow for the vertical\n * axis, and an overflow-x override for the horizontal axis.\n */\nexport const collectOverflow = styleCollector((node, style, context) => {\n\tif (!withOverflow(node)) return\n\n\tconst isAutoSizingTextNode = isAnyTextNode(node) && isAutoSizedOnBothDimensions(node)\n\tconst isAnyOverflowHidden =\n\t\tisClippingOverflowValue(node.overflow) ||\n\t\tisClippingOverflowValue(node.overflowX) ||\n\t\tisClippingOverflowValue(node.overflowY)\n\n\tif (\n\t\tisAnyOverflowHidden &&\n\t\tisAutoSizingTextNode &&\n\t\t/**\n\t\t * If text is truncated, we don't want to set overflow to visible, because it will break the\n\t\t * text truncation. NOTE: To be determined why the overflow needs to be visible when width\n\t\t * and height are auto, but we decided to keep this behavior for now to avoid breaking\n\t\t * changes.\n\t\t * @see https://framer-team.slack.com/archives/CR3CYA1D4/p1756120172921969\n\t\t */\n\t\t(!withTextTruncation(node) || !hasTextTruncation(node.textTruncation))\n\t) {\n\t\tstyle.overflow = \"visible\"\n\t} else if (isDynamicValue(node.overflow) && isJSXContext(context)) {\n\t\tstyle.overflow = context.cssVariableDefinitions.create(node, \"overflow\")\n\t} else {\n\t\tstyle.overflow = wrapInClipFallback(node.resolveValue(\"overflow\", context.variableOverrides))\n\t}\n\n\t// When overflowX and overflowY are equal and nothing is set for overflow,\n\t// we can combine them into a single overflow property.\n\tif (\n\t\t!isUndefined(node.overflowX) &&\n\t\t!isDynamicValue(node.overflowX) &&\n\t\tnode.overflowX === node.overflowY &&\n\t\tstyle.overflow === undefined\n\t) {\n\t\tstyle.overflow = wrapInClipFallback(node.overflowX)\n\t\treturn\n\t}\n\n\tcollectAxisOverflow(\"overflowX\", node, style, context)\n\tcollectAxisOverflow(\"overflowY\", node, style, context)\n})\n\n/**\n * Wraps \"clip\" overflow[X|Y] values in a fallback to support older browsers like Safari 15.\n *  `--overflow-clip-fallback` is set in injectComponentCSSRules.ts to \"hidden\" when needed.\n */\nfunction wrapInClipFallback(value: Overflow | undefined) {\n\tif (value !== \"clip\") return value\n\treturn `var(${overflowClipFallbackCSSVariable}, clip)` as `var(--${string}, clip))`\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\n\nexport interface WithParagraphSpacing {\n\tparagraphSpacing: number | undefined\n}\n\nexport const paragraphSpacingDefaults = {\n\tparagraphSpacing: undefined,\n} satisfies WithParagraphSpacing\n\nexport const paragraphSpacingAddedDefaults: WithParagraphSpacing = {\n\tparagraphSpacing: 0,\n}\n\nconst key: keyof WithParagraphSpacing = \"paragraphSpacing\"\n\nexport function withParagraphSpacing(node: CanvasNode): node is CanvasNode & WithParagraphSpacing {\n\treturn key in node\n}\n", "import { styleCollector } from \"code-generation/utils/collector.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { withParagraphSpacing } from \"../WithParagraphSpacing.ts\"\n\nconst getCollectParagraphSpacing = (cssVarPrefix: string) => {\n\treturn styleCollector((node, style) => {\n\t\tif (!withParagraphSpacing(node)) return\n\n\t\tstyle[`${cssVarPrefix}-paragraph-spacing`] = isNumber(node.paragraphSpacing)\n\t\t\t? `${node.paragraphSpacing}px`\n\t\t\t: undefined\n\t})\n}\n\nexport const collectParagraphSpacing = getCollectParagraphSpacing(\"--framer\")\nexport const collectBlockquoteParagraphSpacing = getCollectParagraphSpacing(\"--framer-blockquote\")\n", "import { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport { styleCollector } from \"code-generation/utils/collector.ts\"\nimport { type CSSVariableName, getRichTextVariables, serializeVariableName } from \"prosemirror/variables.ts\"\nimport { isVariableReference } from \"../VariableReference.ts\"\nimport { withRichText } from \"../WithRichText.ts\"\n\nexport const collectRichTextVariables = styleCollector((node, style, context) => {\n\tif (!withRichText(node)) return\n\tif (isVariableReference(node.htmlContent)) return\n\n\tif (isJSXContext(context)) {\n\t\tconst textVariables = context.cssVariableDefinitions.createRichTextVariable(node)\n\t\tfor (const [propertyName, value] of Object.entries(textVariables)) {\n\t\t\tstyle[propertyName as CSSVariableName] = value\n\t\t}\n\t} else {\n\t\tfor (const variable of getRichTextVariables(node.html)) {\n\t\t\tconst variableName = serializeVariableName(variable)\n\t\t\tstyle[variableName] = node.cache.getVariableReferenceValue(\n\t\t\t\tvariable,\n\t\t\t\tcontext.variableOverrides,\n\t\t\t\t// @FIXME - the value should be checked to be serializable.\n\t\t\t) as keyof typeof style\n\t\t}\n\t}\n})\n", "import { styleCollector } from \"code-generation/utils/collector.ts\"\nimport { withShadow } from \"document/models/CanvasTree/traits/WithShadow.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { isAnyTextNode } from \"../../nodes/utils/isAnyTextNode.ts\"\n\nexport const collectTextShadow = styleCollector((node, style) => {\n\tif (!withShadow(node) || !isAnyTextNode(node)) return\n\tif (isUndefined(node.shadows)) {\n\t\tstyle.textShadow = undefined\n\t\treturn\n\t}\n\n\tconst shadows: string[] = []\n\tfor (const shadow of node.shadows) {\n\t\tshadows.push(`${shadow.x}px ${shadow.y}px ${shadow.blur}px ${shadow.color}`)\n\t}\n\n\tif (!shadows.length) {\n\t\tstyle.textShadow = undefined\n\t\treturn\n\t}\n\n\tstyle.textShadow = shadows.join(\", \")\n})\n", "import { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport { styleCollector } from \"code-generation/utils/collector.ts\"\nimport type { MotionStyle } from \"framer-motion\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { isDynamicValue } from \"../DynamicValue.ts\"\nimport { hasFloatingPosition } from \"../WithFloatingPosition.ts\"\nimport type { WithTransforms } from \"../WithTransforms.ts\"\nimport { DEFAULT_ORIGIN, DEFAULT_ROTATION, DEFAULT_SCALE, DEFAULT_SKEW, withTransforms } from \"../WithTransforms.ts\"\nimport { getFallbackPerspective } from \"../utils/getFallbackPerspective.ts\"\n\nexport const collectTransformStyle = styleCollector((node, style, ctx) => {\n\tif (!withTransforms(node)) return\n\n\tstyle.backfaceVisibility = node.backfaceVisibility === false ? \"hidden\" : undefined\n\tstyle.transformStyle = node.transformStylePreserve3d ? \"preserve-3d\" : undefined\n})\n\nconst defaults: MotionStyle = {\n\tscale: undefined,\n\trotateX: undefined,\n\trotateY: undefined,\n\tskewX: undefined,\n\tskewY: undefined,\n\ttranslateZ: undefined,\n\ttransformPerspective: undefined,\n\toriginX: undefined,\n\toriginY: undefined,\n}\n\nconst identity: WithTransforms = {\n\tscale: DEFAULT_SCALE,\n\trotateX: DEFAULT_ROTATION,\n\trotateY: DEFAULT_ROTATION,\n\trotate3d: false,\n\tskewX: DEFAULT_SKEW,\n\tskewY: DEFAULT_SKEW,\n\ttranslateZ: 0,\n\ttransformStylePreserve3d: false,\n\tbackfaceVisibility: false,\n\tperspective: 0,\n\ttransformOriginX: DEFAULT_ORIGIN,\n\ttransformOriginY: DEFAULT_ORIGIN,\n}\n\nfunction hasNonIdentityValue(node: CanvasNode & WithTransforms, key: keyof WithTransforms): boolean {\n\tconst value = node[key]\n\tif (isUndefined(value)) return false\n\n\treturn value !== identity[key]\n}\n\nexport const collectTransforms = styleCollector((node, style, ctx) => {\n\tif (!withTransforms(node)) return\n\tconst isGroundNode = node.id === ctx.rootId || node.__unsafeIsGroundNode()\n\tif (isGroundNode) return\n\n\t// Code generation needs all keys to be set, even if they are undefined, to\n\t// properly diff with replicas.\n\tif (isJSXContext(ctx)) Object.assign(style, defaults)\n\n\t// Set non-identity values. In code-generation this will be on top of\n\t// default undefined values, so replicas will still remove any values that\n\t// they need to when identity. On the canvas, undefined values will\n\t// interfere with rendering.\n\tif (hasNonIdentityValue(node, \"scale\")) style.scale = node.scale\n\tif (hasNonIdentityValue(node, \"skewX\")) style.skewX = node.skewX\n\tif (hasNonIdentityValue(node, \"skewY\")) style.skewY = node.skewY\n\tif (hasNonIdentityValue(node, \"translateZ\")) style.z = node.translateZ\n\tif (node.rotate3d && hasNonIdentityValue(node, \"rotateX\")) style.rotateX = node.rotateX\n\tif (node.rotate3d && hasNonIdentityValue(node, \"rotateY\")) style.rotateY = node.rotateY\n\n\tconst perspective =\n\t\tisJSXContext(ctx) && isDynamicValue(node.perspective)\n\t\t\t? ctx.createDeduplicatedDynamicValueBinding(node.perspective, node, \"perspective\")\n\t\t\t: (node.resolveValue(\"perspective\") ?? getFallbackPerspective(node))\n\tif (perspective) style.transformPerspective = perspective\n\n\t// Relative overlays don't set origin as they determine it at runtime based\n\t// on their placement and alignment.\n\tif (hasFloatingPosition(node)) return\n\tif (hasNonIdentityValue(node, \"transformOriginX\")) style.originX = node.transformOriginX\n\tif (hasNonIdentityValue(node, \"transformOriginY\")) style.originY = node.transformOriginY\n})\n", "import type { SerializableMotionStyle } from \"code-generation/types.ts\"\nimport type { CollectorContext } from \"code-generation/utils/collector.ts\"\nimport { collectTextTruncation } from \"document/models/CanvasTree/traits/collectStyles/collectTextTruncation.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { collectBackgroundFill } from \"./collectBackgroundFill.ts\"\nimport { collectBackgroundFilters } from \"./collectBackgroundFilters.ts\"\nimport { collectBlending } from \"./collectBlending.ts\"\nimport { collectBoxShadow } from \"./collectBoxShadow.ts\"\nimport { collectCorner } from \"./collectCorner.ts\"\nimport { collectFilters } from \"./collectFilters.ts\"\nimport { collectOpacity } from \"./collectOpacity.ts\"\nimport { collectOverflow } from \"./collectOverflow.ts\"\nimport { collectParagraphSpacing } from \"./collectParagraphSpacing.ts\"\nimport { collectRichTextVariables } from \"./collectRichTextVariables.ts\"\nimport { collectRotate } from \"./collectRotate.ts\"\nimport { collectSizeConstraints } from \"./collectSizeConstraints.ts\"\nimport { collectTextShadow } from \"./collectTextShadow.ts\"\nimport { collectTransformStyle } from \"./collectTransforms.ts\"\n\ntype CollectStyleOptions = CollectorContext & {\n\texcludeOpacity?: boolean\n\texcludeRotation?: boolean\n\texcludeOverflow?: boolean\n\texcludeSizeConstraints?: boolean\n}\n\n/**\n * @FIXME -- Replace with a method in `code-generation/nodes/styleForNode.ts`.\n */\nexport function collectStyle(\n\tnode: CanvasNode,\n\tstyle: SerializableMotionStyle,\n\t{\n\t\texcludeOpacity = false,\n\t\texcludeRotation = false,\n\t\texcludeOverflow = false,\n\t\texcludeSizeConstraints = false,\n\t\t...options\n\t}: CollectStyleOptions,\n) {\n\tcollectCorner(node, style, options)\n\tcollectFilters(node, style, options)\n\tcollectBlending(node, style, options)\n\tcollectBackgroundFilters(node, style, options)\n\tcollectBoxShadow(node, style, options)\n\tcollectTextShadow(node, style, options)\n\tcollectBackgroundFill(node, style, options)\n\tcollectRichTextVariables(node, style, options)\n\tcollectParagraphSpacing(node, style, options)\n\tcollectTransformStyle(node, style, options)\n\tcollectTextTruncation(node, style, options)\n\n\tif (!excludeSizeConstraints) collectSizeConstraints(node, style, options)\n\tif (!excludeOverflow) collectOverflow(node, style, options)\n\tif (!excludeOpacity) collectOpacity(node, style, options)\n\tif (!excludeRotation) collectRotate(node, style, options)\n}\n", "import { styleCollector } from \"code-generation/utils/collector.ts\"\nimport { isCSSVariableName } from \"prosemirror/variables.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { withTokenOverrides } from \"../WithTokenOverrides.ts\"\n\nexport const collectTokenOverrides = styleCollector((node, style) => {\n\tif (!withTokenOverrides(node)) return\n\n\tconst overrides = node.tokenOverrides\n\tif (isUndefined(overrides)) return\n\n\tfor (const key in overrides) {\n\t\tif (!isCSSVariableName(key)) continue\n\n\t\tstyle[key] = overrides[key]\n\t}\n})\n", "import { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport type { CollectorContext } from \"code-generation/utils/collector.ts\"\nimport { styleCollector } from \"code-generation/utils/collector.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { isDynamicValue } from \"../DynamicValue.ts\"\nimport { hasFloatingPosition } from \"../WithFloatingPosition.ts\"\nimport type { WithZIndex } from \"../WithZIndex.ts\"\nimport { hasZIndex, withZIndex } from \"../WithZIndex.ts\"\n\nexport const getZIndex = (node: CanvasNode & WithZIndex, context: CollectorContext) => {\n\tif (hasFloatingPosition(node)) return undefined\n\tif (isDynamicValue(node.zIndex) && isJSXContext(context)) {\n\t\treturn context.cssVariableDefinitions.create(node, \"zIndex\")\n\t}\n\n\treturn hasZIndex(node) ? node.resolveValue(\"zIndex\", context.variableOverrides) : undefined\n}\n\nexport const collectZIndex = styleCollector((node, style, context) => {\n\tif (!withZIndex(node)) return undefined\n\t// Don't remove existing zIndex set by some other collector.\n\tif (!isUndefined(style.zIndex) && isUndefined(node.zIndex)) return\n\n\tstyle.zIndex = getZIndex(node, context)\n})\n", "import { assertNever } from \"@framerjs/shared\"\nimport type { CanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { Matrix } from \"document/models/Matrix.ts\"\nimport { EffectPreviewType } from \"document/utils/EffectPreviewType.ts\"\nimport type { RenderId } from \"document/utils/RenderId.ts\"\nimport type { Rect } from \"library/render/types/Rect.ts\"\nimport { isNull, isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport type { DynamicValue } from \"../DynamicValue.ts\"\nimport { hasLoopEffect, loopTransforms } from \"../WithLoopEffect.ts\"\nimport type { ParentSizeInfo } from \"../WithRect.ts\"\nimport { withRotation } from \"../WithRotation.ts\"\nimport { exitTransforms, hasStyleAppearEffect, initialTransforms, isPresenceEffect } from \"../WithStyleAppearEffect.ts\"\nimport { hasStyleTransformEffect, transformEffectTransforms } from \"../WithStyleTransformEffect.ts\"\nimport type { Transforms, WithTransforms } from \"../WithTransforms.ts\"\nimport { DEFAULT_ORIGIN } from \"../WithTransforms.ts\"\nimport { hasWhileHover, whileHoverTransforms } from \"../WithWhileHover.ts\"\nimport { hasWhileTap, whileTapTransforms } from \"../WithWhileTap.ts\"\nimport { getFallbackPerspective } from \"../utils/getFallbackPerspective.ts\"\n\n/**\n * All the transforms of effects that can all run at the same time, like Loop,\n * Scroll Appear, and Scroll Transform need to be combined with the identity\n * transforms to give an accurate preview of the effect.\n */\nfunction combineAdditiveTransforms(a: Transforms, b: Transforms): Transforms {\n\treturn {\n\t\tscale: a.scale * b.scale,\n\t\tx: a.x + b.x,\n\t\ty: a.y + b.y,\n\t\trotate: a.rotate + b.rotate,\n\t\trotateX: a.rotateX + b.rotateX,\n\t\trotateY: a.rotateY + b.rotateY,\n\t\tskewX: a.skewX + b.skewX,\n\t\tskewY: a.skewY + b.skewY,\n\t\ttranslateZ: a.translateZ + b.translateZ,\n\t}\n}\n\n/**\n * Combine the identity transforms with the effect transforms, based on the way\n * the type of effect is combined in the live site.\n */\nfunction combineTransforms(node: CanvasNode, effectType: EffectPreviewType, identity: Transforms, effect: Transforms) {\n\tswitch (effectType) {\n\t\tcase EffectPreviewType.Exit:\n\t\tcase EffectPreviewType.Enter:\n\t\t\treturn isPresenceEffect(node) ? effect : combineAdditiveTransforms(effect, identity)\n\t\tcase EffectPreviewType.Hover:\n\t\tcase EffectPreviewType.Tap:\n\t\tcase EffectPreviewType.Checked:\n\t\tcase EffectPreviewType.Focus:\n\t\t\treturn effect\n\t\tcase EffectPreviewType.Loop:\n\t\tcase EffectPreviewType.Target:\n\t\t\treturn combineAdditiveTransforms(effect, identity)\n\t\tdefault:\n\t\t\tassertNever(effectType)\n\t}\n}\n\nexport function with3DTransformsTrait<T extends new (...args: any[]) => CanvasNode>(Base: T) {\n\treturn class With3DTransformsTrait extends Base implements WithTransforms {\n\t\tdeclare scale: number | undefined\n\t\tdeclare rotateX: number | undefined\n\t\tdeclare rotateY: number | undefined\n\t\tdeclare rotate3d: boolean | undefined\n\t\tdeclare skewX: number | undefined\n\t\tdeclare skewY: number | undefined\n\t\tdeclare translateZ: number | undefined\n\t\tdeclare transformStylePreserve3d: boolean | undefined\n\t\tdeclare backfaceVisibility: boolean | undefined\n\t\tdeclare perspective: number | DynamicValue | undefined\n\n\t\tdeclare transformOriginX: number | undefined\n\t\tdeclare transformOriginY: number | undefined\n\n\t\t/**\n\t\t * Get the raw transforms for a node. When the node is in an effect\n\t\t * preview, these transforms will reflect the effect values so that the\n\t\t * bounding box is drawn around the transforms applied by the effect.\n\t\t */\n\t\tprivate transforms(identity: Transforms): Transforms {\n\t\t\tconst type = this.cache.effectType\n\t\t\tif (!this.cache.isEffectPreview || isUndefined(type) || isNull(type)) {\n\t\t\t\treturn identity\n\t\t\t}\n\n\t\t\tswitch (type) {\n\t\t\t\tcase EffectPreviewType.Exit:\n\t\t\t\t\tif (!hasStyleAppearEffect(this)) break\n\t\t\t\t\treturn combineTransforms(this, type, identity, exitTransforms(this))\n\t\t\t\tcase EffectPreviewType.Enter:\n\t\t\t\t\tif (!hasStyleAppearEffect(this)) break\n\t\t\t\t\treturn combineTransforms(this, type, identity, initialTransforms(this))\n\t\t\t\tcase EffectPreviewType.Hover:\n\t\t\t\t\tif (!hasWhileHover(this)) break\n\t\t\t\t\treturn combineTransforms(this, type, identity, whileHoverTransforms(this))\n\t\t\t\tcase EffectPreviewType.Tap:\n\t\t\t\t\tif (!hasWhileTap(this)) break\n\t\t\t\t\treturn combineTransforms(this, type, identity, whileTapTransforms(this))\n\t\t\t\tcase EffectPreviewType.Loop:\n\t\t\t\t\tif (!hasLoopEffect(this)) break\n\t\t\t\t\treturn combineTransforms(this, type, identity, loopTransforms(this))\n\t\t\t\tcase EffectPreviewType.Target: {\n\t\t\t\t\tif (!hasStyleTransformEffect(this) || !this.styleTransformEffectEnabled) break\n\t\t\t\t\tif (isNull(this.cache.effectIds) || this.cache.effectIds.size === 0) break\n\t\t\t\t\tconst variant = this.styleTransformEffectScrollTargets?.find(fx => this.cache.effectIds?.has(fx.id))\n\t\t\t\t\tif (!variant?.style) break\n\t\t\t\t\treturn combineTransforms(this, type, identity, transformEffectTransforms(variant.style))\n\t\t\t\t}\n\t\t\t\tcase EffectPreviewType.Checked:\n\t\t\t\tcase EffectPreviewType.Focus:\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(type)\n\t\t\t}\n\n\t\t\treturn identity\n\t\t}\n\n\t\toverride matrix(parentSizeInfo: ParentSizeInfo | null, frame?: Rect, renderId: RenderId = this.id): DOMMatrix {\n\t\t\t// Ground nodes don't support transforms.\n\t\t\tif (this.__unsafeIsGroundNode()) return super.matrix(parentSizeInfo, frame, renderId)\n\t\t\tif (!frame && parentSizeInfo !== undefined) frame = this.rect(parentSizeInfo)\n\t\t\tif (!frame) throw Error(\"Could not determine frame to build matrix from\")\n\n\t\t\tconst perspectiveValue = this.resolveValue(\"perspective\") ?? getFallbackPerspective(this)\n\t\t\tconst perspective = isNumber(perspectiveValue) ? Matrix.perspective(perspectiveValue) : Matrix.identity()\n\n\t\t\tconst transforms = this.transforms({\n\t\t\t\trotateX: this.rotate3d ? (this.rotateX ?? 0) : 0,\n\t\t\t\trotateY: this.rotate3d ? (this.rotateY ?? 0) : 0,\n\t\t\t\trotate: withRotation(this) ? this.resolveValue(\"rotation\") : 0,\n\t\t\t\tscale: this.scale ?? 1,\n\t\t\t\tskewX: this.skewX ?? 0,\n\t\t\t\tskewY: this.skewY ?? 0,\n\t\t\t\ttranslateZ: this.translateZ ?? 0,\n\t\t\t\tx: 0,\n\t\t\t\ty: 0,\n\t\t\t})\n\n\t\t\treturn (\n\t\t\t\tMatrix.identity()\n\t\t\t\t\t.translate(frame.x || 0, frame.y || 0)\n\t\t\t\t\t.multiplySelf(perspective)\n\t\t\t\t\t.translateSelf(transforms.x, transforms.y, transforms.translateZ)\n\t\t\t\t\t.scaleSelf(transforms.scale, transforms.scale, 1)\n\t\t\t\t\t// Perform the rotations one by one to ensure they are\n\t\t\t\t\t// performed in the same order that framer-motion is going\n\t\t\t\t\t// to combine them on the canvas.\n\t\t\t\t\t.rotateSelf(0, 0, transforms.rotate)\n\t\t\t\t\t.rotateSelf(transforms.rotateX, 0, 0)\n\t\t\t\t\t.rotateSelf(0, transforms.rotateY, 0)\n\t\t\t\t\t.skewXSelf(transforms.skewX)\n\t\t\t\t\t.skewYSelf(transforms.skewY)\n\t\t\t)\n\t\t}\n\n\t\toverride originAdjustedMatrix(\n\t\t\tparentSizeInfo: ParentSizeInfo | null,\n\t\t\tframe?: Rect,\n\t\t\trenderId: RenderId = this.id,\n\t\t): DOMMatrix {\n\t\t\tif (this.__unsafeIsGroundNode()) return super.originAdjustedMatrix(parentSizeInfo, frame, renderId)\n\t\t\tif (!frame) frame = this.rect(parentSizeInfo, undefined, undefined, renderId)\n\t\t\tif (!frame) throw Error(\"Could not determine frame to build matrix from\")\n\n\t\t\tconst originX = this.transformOriginX ?? DEFAULT_ORIGIN\n\t\t\tconst originY = this.transformOriginY ?? DEFAULT_ORIGIN\n\n\t\t\treturn Matrix.identity()\n\t\t\t\t.translate(originX * frame.width, originY * frame.height)\n\t\t\t\t.multiplySelf(this.matrix(parentSizeInfo, frame, renderId))\n\t\t\t\t.translateSelf(-originX * frame.width, -originY * frame.height)\n\t\t}\n\t}\n}\n", "import type { AnyComponentLoader, VerifiedPropertyControls } from \"@framerjs/framer-runtime\"\nimport type { ControlProp, ControlProps } from \"document/models/controlProps/ControlProp.ts\"\nimport type { RawControlProp, RawControlProps } from \"document/models/controlProps/RawControlProp.ts\"\nimport type { Locale } from \"library/router/types.ts\"\nimport type { AssetResolverWithHash } from \"renderer/getAssetResolver.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport type { RawControlPropsCache } from \"../../nodes/RawControlPropsCache.ts\"\nimport type { FetchDataValueResolver } from \"../FetchDataValue.ts\"\nimport type { CombinedVariableProviderValueMap } from \"../VariableProvider.ts\"\nimport type {\n\tComponentVectorSetChildren,\n\tResolvedControlPropValues,\n\tRichTextControlKeys,\n\tWithControlProps,\n} from \"../WithControlProps.ts\"\nimport type { VariableID } from \"../WithVariables.ts\"\n\nimport { AnnotationKey, type Annotations } from \"@framerjs/framer-runtime/crossorigin\"\nimport { emptyArray, getLogger, isModuleExportIdentifier } from \"@framerjs/shared\"\nimport {\n\ttype PrefixedControlPropKey,\n\tremoveControlPropKeyPrefix,\n\tisPrefixedControlPropKey,\n\tprefixControlPropKey,\n} from \"document/models/controlProps/controlPropKey.ts\"\nimport {\n\tgetControlPropValueResolvers,\n\tgetResolvedControlPropValues,\n} from \"document/models/controlProps/getResolvedControlPropValues.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport type { Mutable } from \"utils/Mutable.ts\"\nimport { getVectorSetItemControlPropIdentifiers } from \"utils/vectorSets.ts\"\nimport { isScopeNode } from \"../../nodes/ScopeNode.ts\"\n\nconst log = getLogger(\"withControlPropsTrait\")\n\nconst emptyResolvedControlPropValues: ResolvedControlPropValues = {}\nconst emptyVectorSetChildren: ComponentVectorSetChildren = {}\n\n// biome-ignore lint/suspicious/noExplicitAny: mixin base pattern\nexport function withControlPropsTrait<T extends new (...args: any[]) => CanvasNode>(Base: T) {\n\tabstract class WithControlPropsTrait extends Base implements WithControlProps {\n\t\t[key: PrefixedControlPropKey]: RawControlProp | undefined\n\n\t\tdeclare cache: RawControlPropsCache\n\n\t\tabstract getControlPropSourceIdentifier(): string | undefined\n\n\t\tprotected hasControlProps(): boolean {\n\t\t\treturn true\n\t\t}\n\n\t\tprotected getControlPropCacheVersion(): number {\n\t\t\treturn this.update\n\t\t}\n\n\t\tprotected getControlPropFontPreview() {\n\t\t\treturn this.cache.fontPreview\n\t\t}\n\n\t\tgetRawControlProps(): RawControlProps {\n\t\t\tconst cacheVersion = this.getControlPropCacheVersion()\n\t\t\tif (!this.mutable) {\n\t\t\t\tconst cachedValue = this.cache.getRawControlProps(cacheVersion)\n\t\t\t\tif (cachedValue) return cachedValue\n\t\t\t}\n\n\t\t\tconst controlProps: Mutable<RawControlProps> = {}\n\t\t\tfor (const key in this) {\n\t\t\t\tif (!isPrefixedControlPropKey(key)) continue\n\t\t\t\tconst rawControlProp = this[key]\n\t\t\t\tcontrolProps[removeControlPropKeyPrefix(key)] = rawControlProp\n\t\t\t}\n\n\t\t\tif (this.mutable) return controlProps\n\n\t\t\treturn this.cache.setRawControlProps(cacheVersion, controlProps)\n\t\t}\n\n\t\tgetRawControlProp(propKey: string): RawControlProp | undefined {\n\t\t\treturn this[prefixControlPropKey(propKey)]\n\t\t}\n\n\t\tsetControlProp(this: CanvasNode & WithControlProps, propKey: string, value: ControlProp | undefined): void {\n\t\t\tthis.set({ [prefixControlPropKey(propKey)]: value })\n\t\t}\n\n\t\tgetControlProps(controls: VerifiedPropertyControls): ControlProps {\n\t\t\treturn this.cache.getControlProps(controls, this.getRawControlProps(), !this.mutable)\n\t\t}\n\n\t\tgetResolvedControlPropValues(\n\t\t\tcomponentLoader: AnyComponentLoader,\n\t\t\tassetResolverWithHash: AssetResolverWithHash | null = null,\n\t\t\tvariableOverrides?: CombinedVariableProviderValueMap,\n\t\t\tactiveLocale?: Locale,\n\t\t\tgetResolvedFetchDataValue?: FetchDataValueResolver,\n\t\t): ResolvedControlPropValues {\n\t\t\tconst identifier = this.getControlPropSourceIdentifier()\n\t\t\tif (!identifier) return emptyResolvedControlPropValues\n\t\t\tif (!this.hasControlProps()) return emptyResolvedControlPropValues\n\n\t\t\tconst propertyControls = componentLoader.getPropertyControlsForIdentifier(identifier)\n\t\t\tif (!propertyControls) return emptyResolvedControlPropValues\n\n\t\t\treturn getResolvedControlPropValues(\n\t\t\t\tpropertyControls,\n\t\t\t\tthis.getControlProps(propertyControls),\n\t\t\t\tgetControlPropValueResolvers({\n\t\t\t\t\tassetResolverWithHash,\n\t\t\t\t\tvariableOverrides,\n\t\t\t\t\tvariableValueResolver: this.cache,\n\t\t\t\t\tgetVariableControlByReference: ref => this.cache.getVariableControlByReference(ref),\n\t\t\t\t\tgetResolvedFetchDataValue,\n\t\t\t\t\tgetCanvasTree: () => this.tree(),\n\t\t\t\t\tactiveLocale,\n\t\t\t\t\tcomponentLoader,\n\t\t\t\t\tscopeId: isScopeNode(this) ? this.id : undefined,\n\t\t\t\t\tfontPreview: this.getControlPropFontPreview() ?? undefined,\n\t\t\t\t}),\n\t\t\t)\n\t\t}\n\n\t\tgetRichTextControlKeys(componentLoader: AnyComponentLoader): RichTextControlKeys {\n\t\t\tconst identifier = this.getControlPropSourceIdentifier()\n\t\t\tif (!identifier || !isModuleExportIdentifier(identifier)) return emptyArray()\n\t\t\tif (!this.hasControlProps()) return emptyArray()\n\n\t\t\tconst propertyControls = componentLoader.getPropertyControlsForIdentifier(identifier)\n\t\t\tif (!propertyControls) return emptyArray()\n\n\t\t\tconst result: string[] = []\n\t\t\tconst propertyVariables = getHumanReadableReactPropMap(componentLoader, identifier)\n\t\t\tfor (const propertyKey in propertyControls) {\n\t\t\t\tconst control = propertyControls[propertyKey]\n\t\t\t\tif (control?.type !== ControlType.RichText) continue\n\n\t\t\t\tresult.push(propertyVariables?.[propertyKey] ?? propertyKey)\n\t\t\t}\n\t\t\treturn result\n\t\t}\n\n\t\tgetComponentVectorSetChildren(\n\t\t\tcomponentLoader: AnyComponentLoader,\n\t\t\tvariableOverrides?: CombinedVariableProviderValueMap,\n\t\t): ComponentVectorSetChildren {\n\t\t\tconst identifier = this.getControlPropSourceIdentifier()\n\n\t\t\tif (!identifier || !isModuleExportIdentifier(identifier)) return emptyVectorSetChildren\n\t\t\tif (!this.hasControlProps()) return emptyVectorSetChildren\n\n\t\t\treturn getVectorSetItemControlPropIdentifiers(this, this.tree(), identifier, componentLoader, variableOverrides)\n\t\t}\n\t}\n\n\treturn WithControlPropsTrait\n}\n\nfunction propertyVariablesFromAnnotations(annotations: Annotations): Record<VariableID, string> | undefined {\n\tconst value = annotations[AnnotationKey.FramerVariables] || annotations[AnnotationKey.FramerVariablesDeprecated]\n\tif (!value) return undefined\n\n\ttry {\n\t\treturn JSON.parse(value)\n\t} catch (err) {\n\t\tlog.reportError(err)\n\t\treturn undefined\n\t}\n}\n\nexport function getHumanReadableReactPropMap(componentLoader: AnyComponentLoader, codeComponentIdentifier: string) {\n\tconst definition = componentLoader.reactComponentForIdentifier(codeComponentIdentifier)\n\tif (!definition) return null\n\n\tconst { annotations } = definition\n\tif (!annotations) return null\n\n\t// If the component has immutable variables it does not need mapping.\n\tif (annotations[AnnotationKey.FramerImmutableVariables]) return null\n\n\treturn propertyVariablesFromAnnotations(annotations) ?? null\n}\n\nexport function getHumanReadableKey(propertyVariables: Record<VariableID, string>, key: string): string {\n\treturn propertyVariables[key] ?? key\n}\n", "import type { ComponentLoader } from \"@framerjs/framer-runtime\"\nimport { assert } from \"@framerjs/shared\"\nimport { experiments } from \"app/experiments.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { ConstraintProperties, DimensionType } from \"library/render/types/Constraints.ts\"\nimport { ConstraintMask, ConstraintValues } from \"library/render/types/Constraints.ts\"\nimport type { NewConstraintProperties } from \"library/render/types/NewConstraints.tsx\"\nimport type { Rect } from \"library/render/types/Rect.ts\"\nimport { isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport type { DynamicValue } from \"../DynamicValue.ts\"\nimport type { WithAspectRatio } from \"../WithAspectRatio.ts\"\nimport { getRebasedInsetX, getRebasedInsetY, hasFloatingPosition } from \"../WithFloatingPosition.ts\"\nimport type { GridItemAlignment, GridItemColumnSpan, WithGridItemLayout } from \"../WithGridItemLayout.ts\"\nimport type { WithGridItemSize } from \"../WithGridItemSize.ts\"\nimport type { WithPins } from \"../WithPins.ts\"\nimport type { ParentSizeInfo } from \"../WithRect.ts\"\nimport { withRotation } from \"../WithRotation.ts\"\nimport type { WithSize } from \"../WithSize.ts\"\nimport type {\n\tHeightConstraintDimension,\n\tWidthConstraintDimension,\n\tWithSizeConstraints,\n} from \"../WithSizeConstraints.ts\"\nimport { constrainRect, getSizeConstraints } from \"../WithSizeConstraints.ts\"\nimport { DEFAULT_ORIGIN } from \"../WithTransforms.ts\"\nimport type { VekterConstraintValues } from \"../utils/VekterConstraintValues.ts\"\nimport { aspectRatioForNode } from \"../utils/layoutSupportsAspectRatio.ts\"\nimport { newConstraintProperties } from \"../utils/newConstraintProperties.ts\"\nimport { isPositionRelative } from \"../utils/positionTypeHelpers.ts\"\nimport { sizeValue } from \"../utils/sizeValue.ts\"\n\nexport function withPinsSizeRatioConstraints<T extends new (...args: any[]) => CanvasNode>(Base: T) {\n\treturn class WithPinsSizeRatioConstraints\n\t\textends Base\n\t\timplements WithPins, WithSize, WithAspectRatio, WithSizeConstraints, WithGridItemLayout, WithGridItemSize\n\t{\n\t\t// WithPins\n\t\tdeclare constraintsLocked: boolean\n\t\tdeclare left: number | null\n\t\tdeclare right: number | null\n\t\tdeclare top: number | null\n\t\tdeclare bottom: number | null\n\t\tdeclare centerAnchorX: number\n\t\tdeclare centerAnchorY: number\n\t\tdeclare widthType: DimensionType\n\t\tdeclare heightType: DimensionType\n\n\t\t// WithSize\n\t\tdeclare width: number\n\t\tdeclare height: number\n\n\t\t// With GridItemLayout\n\t\tdeclare gridItemFillCellWidth: boolean | undefined\n\t\tdeclare gridItemFillCellHeight: boolean | undefined\n\t\tdeclare gridItemHorizontalAlignment: GridItemAlignment | undefined\n\t\tdeclare gridItemVerticalAlignment: GridItemAlignment | undefined\n\t\tdeclare gridItemColumnSpan: GridItemColumnSpan | DynamicValue | undefined\n\t\tdeclare gridItemRowSpan: number | DynamicValue | undefined\n\n\t\t// WithSizeConstraints\n\t\tdeclare maxWidth: WidthConstraintDimension | number | undefined\n\t\tdeclare minWidth: WidthConstraintDimension | number | undefined\n\t\tdeclare maxHeight: HeightConstraintDimension | number | undefined\n\t\tdeclare minHeight: HeightConstraintDimension | number | undefined\n\n\t\t// WithAspectRatioLock\n\t\tdeclare aspectRatio: number | null\n\n\t\tconstraintProperties(): ConstraintProperties {\n\t\t\tif (this.cache.constraintProps) return this.cache.constraintProps\n\t\t\tconst constraints = this.constraints()\n\n\t\t\tif (experiments.isOn(\"assertCenterAnchorPresent\")) {\n\t\t\t\tassert(!isUndefined(this.centerAnchorX), `A node withPinsSizeRatioConstraints must have centerAnchorX`)\n\t\t\t\tassert(!isUndefined(this.centerAnchorY), `A node withPinsSizeRatioConstraints must have centerAnchorY`)\n\t\t\t}\n\n\t\t\treturn (this.cache.constraintProps = {\n\t\t\t\tleft: constraints.left ? this.left : null,\n\t\t\t\tright: constraints.right ? this.right : null,\n\t\t\t\ttop: constraints.top ? this.top : null,\n\t\t\t\tbottom: constraints.bottom ? this.bottom : null,\n\t\t\t\twidth: sizeValue(this.width, constraints.widthType, \"width\"),\n\t\t\t\theight: sizeValue(this.height, constraints.heightType, \"height\"),\n\t\t\t\taspectRatio: constraints.aspectRatio,\n\t\t\t\tcenterX: `${this.centerAnchorX * 100}%`,\n\t\t\t\tcenterY: `${this.centerAnchorY * 100}%`,\n\t\t\t\tparentSize: null,\n\t\t\t})\n\t\t}\n\n\t\tnewConstraintProperties(): NewConstraintProperties {\n\t\t\treturn newConstraintProperties(this)\n\t\t}\n\n\t\tconstraints(): ConstraintMask {\n\t\t\tconst aspectRatio = aspectRatioForNode(this)\n\t\t\tconst floatingPosition = hasFloatingPosition(this)\n\t\t\tif (isPositionRelative(this) || floatingPosition) {\n\t\t\t\treturn ConstraintMask.quickfix({\n\t\t\t\t\tleft: floatingPosition,\n\t\t\t\t\tright: false,\n\t\t\t\t\ttop: floatingPosition,\n\t\t\t\t\tbottom: false,\n\t\t\t\t\twidthType: this.widthType,\n\t\t\t\t\theightType: this.heightType,\n\t\t\t\t\taspectRatio,\n\t\t\t\t\tfixedSize: false,\n\t\t\t\t\t...getSizeConstraints(this),\n\t\t\t\t})\n\t\t\t}\n\n\t\t\treturn ConstraintMask.quickfix({\n\t\t\t\tleft: isNumber(this.left),\n\t\t\t\tright: isNumber(this.right),\n\t\t\t\ttop: isNumber(this.top),\n\t\t\t\tbottom: isNumber(this.bottom),\n\t\t\t\twidthType: this.widthType,\n\t\t\t\theightType: this.heightType,\n\t\t\t\taspectRatio,\n\t\t\t\tfixedSize: false,\n\t\t\t\t...getSizeConstraints(this),\n\t\t\t})\n\t\t}\n\n\t\tconstraintValues(): VekterConstraintValues {\n\t\t\tconst constraints = this.constraints()\n\n\t\t\tif (experiments.isOn(\"assertCenterAnchorPresent\")) {\n\t\t\t\tassert(!isUndefined(this.centerAnchorX), `A node withPinsSizeRatioConstraints must have centerAnchorX`)\n\t\t\t\tassert(!isUndefined(this.centerAnchorY), `A node withPinsSizeRatioConstraints must have centerAnchorY`)\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tleft: constraints.left ? this.left : null,\n\t\t\t\tright: constraints.right ? this.right : null,\n\t\t\t\ttop: constraints.top ? this.top : null,\n\t\t\t\tbottom: constraints.bottom ? this.bottom : null,\n\t\t\t\twidthType: this.widthType,\n\t\t\t\theightType: this.heightType,\n\t\t\t\twidth: this.width,\n\t\t\t\theight: this.height,\n\t\t\t\taspectRatio: constraints.aspectRatio,\n\t\t\t\tcenterAnchorX: this.centerAnchorX,\n\t\t\t\tcenterAnchorY: this.centerAnchorY,\n\t\t\t\t...getSizeConstraints(this),\n\t\t\t\tfloatingOffsetX: hasFloatingPosition(this) ? this.floatingOffsetX : undefined,\n\t\t\t\tfloatingOffsetY: hasFloatingPosition(this) ? this.floatingOffsetY : undefined,\n\t\t\t}\n\t\t}\n\n\t\toverride rect(\n\t\t\tparentSizeInfo: ParentSizeInfo | null,\n\t\t\tpixelAlign = true,\n\t\t\t/**\n\t\t\t * Optionally provide a component loader instance if you are getting\n\t\t\t * the rect of a code component node, and want optional size\n\t\t\t * constraints that may be included in that components annotations to\n\t\t\t * be incorporated into the constrained rect.\n\t\t\t */\n\t\t\tcomponentLoader?: ComponentLoader,\n\t\t): Rect {\n\t\t\tif (isPositionRelative(this) && this.cache.parentDirectedRect) {\n\t\t\t\treturn { ...this.cache.parentDirectedRect }\n\t\t\t}\n\t\t\tconst constraints = ConstraintValues.toRect(this.constraintValues(), parentSizeInfo, null, pixelAlign, null)\n\n\t\t\tif (hasFloatingPosition(this) && parentSizeInfo?.positioning) {\n\t\t\t\tconstraints.x = getRebasedInsetX(\n\t\t\t\t\tconstraints.width,\n\t\t\t\t\tparentSizeInfo.positioning.width,\n\t\t\t\t\tthis.floatingPlacement,\n\t\t\t\t\tthis.floatingAlignment,\n\t\t\t\t\tthis.floatingOffsetX,\n\t\t\t\t)\n\t\t\t\tconstraints.y = getRebasedInsetY(\n\t\t\t\t\tconstraints.height,\n\t\t\t\t\tparentSizeInfo.positioning.height,\n\t\t\t\t\tthis.floatingPlacement,\n\t\t\t\t\tthis.floatingAlignment,\n\t\t\t\t\tthis.floatingOffsetY,\n\t\t\t\t)\n\n\t\t\t\tif (pixelAlign) {\n\t\t\t\t\tconstraints.x = Math.round(constraints.x)\n\t\t\t\t\tconstraints.y = Math.round(constraints.y)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn constrainRect(constraints, this, componentLoader, parentSizeInfo ?? undefined)\n\t\t}\n\n\t\toverride matrix(parentSizeInfo: ParentSizeInfo | null, frame?: Rect): DOMMatrix {\n\t\t\tif (!frame && parentSizeInfo !== undefined) {\n\t\t\t\tframe = this.rect(parentSizeInfo)\n\t\t\t}\n\t\t\tif (!frame) {\n\t\t\t\tthrow Error(\"Could not determine frame to build matrix from\")\n\t\t\t}\n\t\t\treturn new DOMMatrix()\n\t\t\t\t.translateSelf(frame.x || 0, frame.y || 0)\n\t\t\t\t.rotateSelf(0, 0, withRotation(this) ? this.resolveValue(\"rotation\") : 0)\n\t\t}\n\n\t\toverride originAdjustedMatrix(parentSizeInfo: ParentSizeInfo | null, frame?: Rect): DOMMatrix {\n\t\t\tif (!frame) {\n\t\t\t\tframe = this.rect(parentSizeInfo)\n\t\t\t}\n\t\t\tif (!frame) {\n\t\t\t\tthrow Error(\"Could not determine frame to build matrix from\")\n\t\t\t}\n\t\t\treturn new DOMMatrix()\n\t\t\t\t.translateSelf(DEFAULT_ORIGIN * frame.width, DEFAULT_ORIGIN * frame.height)\n\t\t\t\t.multiplySelf(this.matrix(parentSizeInfo, frame))\n\t\t\t\t.translateSelf(-DEFAULT_ORIGIN * frame.width, -DEFAULT_ORIGIN * frame.height)\n\t\t}\n\n\t\tisRotated(): boolean {\n\t\t\tif (withRotation(this)) {\n\t\t\t\treturn this.resolveValue(\"rotation\") % 360 !== 0\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t}\n}\n", "import { isPinnable } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport { isNullish } from \"utils/typeChecks.ts\"\nimport type { CanvasTree } from \"../../CanvasTree.ts\"\nimport type { CanvasNode } from \"../../nodes/CanvasNode.ts\"\nimport { isLayoutTemplateNode, isSmartComponentNode, isWebPageNode } from \"../../nodes/utils/nodeCheck.ts\"\nimport { withSizeDimensionType } from \"../WithSizeDimensionType.ts\"\n\n/**\n * Returns whether a node has fixed size\n *\n * Supported scopes: WebPage, LayoutTemplate, Smart Component\n * Unsupported scopes: Canvas page\n */\n// The function has a check ground node.\n// On web pages, layout templates, and smart components, the ground node is always resizeable.\n// - Web pages & layout templates: always 100vw.\n// - Smart components: can be resized by the user of the component.\n// So, passing a ground node from another scope (canvas page, design page, etc.) will return a false negative\nexport function hasFixedSize(node: CanvasNode, tree?: CanvasTree) {\n\tif (!withSizeDimensionType(node)) return\n\tif (tree && !isSupportedScope(node, tree)) return\n\n\t// Ground nodes (web page root or a smart component root) are resizeable.\n\tif (tree?.isGroundNode(node)) return false\n\n\tif (!isPossiblyFixedDimension(node.widthType) || !isPossiblyFixedDimension(node.heightType)) return false\n\tif (isLeftRightPinned(node) || isTopBottomPinned(node)) return false\n\n\treturn true\n}\n\nfunction isPossiblyFixedDimension(dimensionType: DimensionType): boolean {\n\treturn dimensionType === DimensionType.FixedNumber || dimensionType === DimensionType.FitImage\n}\n\nfunction isLeftRightPinned(node: CanvasNode) {\n\treturn isPinnable(node) && !isNullish(node.left) && !isNullish(node.right)\n}\n\nfunction isTopBottomPinned(node: CanvasNode) {\n\treturn isPinnable(node) && !isNullish(node.top) && !isNullish(node.bottom)\n}\n\nfunction isSupportedScope(node: CanvasNode, tree: CanvasTree) {\n\tconst scopeNode = tree.getScopeNodeFor(node)\n\tif (!scopeNode) return false\n\tif (isLayoutTemplateNode(scopeNode)) return true\n\tif (isSmartComponentNode(scopeNode)) return true\n\tif (isWebPageNode(scopeNode)) return true\n\treturn false\n}\n", "import { experiments } from \"app/experiments.ts\"\nimport { js } from \"code-generation/js/js.ts\"\nimport { SafeJS, SerializableObject } from \"code-generation/js/serializeJS.ts\"\nimport { isJSXContext } from \"code-generation/jsx/types.ts\"\nimport type { RecordWithSafeJS } from \"code-generation/types.ts\"\nimport type { ResolvedAsset } from \"code-generation/utils/AssetCollector.ts\"\nimport type { CollectorContext } from \"code-generation/utils/collector.ts\"\nimport { getLocalizedValueForActiveLocale } from \"document/components/chrome/localization/getValueForActiveLocale.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { WithFill } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport { withFillImageLocalized } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport { type NonNullLocalizedValue, isNonNullLocalizedValue } from \"document/models/LocalizedValue.ts\"\nimport { type WithControlFocalPoint, hasControlFocalPoint } from \"document/models/controlProps/WithControlFocalPoint.ts\"\nimport type { BackgroundImage } from \"library/render/types/BackgroundImage.ts\"\nimport { isRelativeNumber } from \"library/render/types/RelativeNumber.ts\"\nimport type { Locale } from \"library/router/types.ts\"\nimport { assert } from \"library/utils/assert.ts\"\nimport { isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport { nodeIsInOverlay } from \"../../nodes/utils/overlayHelpers.ts\"\nimport { isComputedValue } from \"../ComputedValue.ts\"\nimport { isDynamicValue } from \"../DynamicValue.ts\"\nimport { type ResponsiveImage, isResponsiveImage } from \"../ResponsiveImage.ts\"\nimport { isVariableReference } from \"../VariableReference.ts\"\nimport { fallbackAltText, withAltText } from \"../WithAltText.ts\"\nimport { withIntrinsicSize } from \"../WithIntrinsicSize.ts\"\nimport { isPinnable } from \"../WithPins.ts\"\nimport { withPositionType } from \"../WithPositionType.ts\"\nimport { withSize } from \"../WithSize.ts\"\nimport { hasFixedSize } from \"./fixedSizeHelpers.ts\"\nimport { getPixelDimensionsFromImageSrc } from \"./getPixelDimensionsFromImageSrc.ts\"\n\ntype MaybeLocalizedImage = NonNullLocalizedValue | null | undefined\nconst centerFocalPoint: WithControlFocalPoint = { positionX: \"50%\", positionY: \"50%\" }\nObject.freeze(centerFocalPoint)\n\nexport function createBackgroundImage(\n\tnode: CanvasNode & WithFill,\n\tcontext?: CollectorContext,\n\tactiveLocale?: Locale,\n): RecordWithSafeJS<BackgroundImage> | undefined {\n\tconst localizedImage = getLocalizedImage(node, activeLocale)\n\tconst baseProperties = getBaseProperties(node)\n\tconst resolvedImage =\n\t\tlocalizedImage?.value ??\n\t\tnode.resolveValue(\"fillImage\", context?.variableOverrides, context?.getResolvedFetchDataValue) ??\n\t\tundefined\n\n\tconst resolvedPosition = getResolvedPosition(\n\t\tnode,\n\t\tlocalizedImage,\n\t\tisResponsiveImage(resolvedImage) && !isJSXContext(context) ? resolvedImage : undefined,\n\t)\n\n\tconst responsiveImage = isResponsiveImage(resolvedImage) ? resolvedImage : undefined\n\tconst resolvedImageSrc = isResponsiveImage(resolvedImage) ? resolvedImage.src : resolvedImage\n\tconst pixelDimensionsFromSrc = getPixelDimensionsFromSrc(resolvedImageSrc)\n\tconst responsiveImageVariable = getResponsiveImageVariableJS(node, context)\n\n\t// Resolve the responsive image from the asset map only if we haven't already resolved it, if it was already resolved\n\t// then we have enough information to render.\n\tconst propertiesFromAssetMap =\n\t\t!isResponsiveImage(resolvedImage) && resolvedImageSrc && !responsiveImageVariable\n\t\t\t? getPropertiesFromAssetMap(\n\t\t\t\t\tnode,\n\t\t\t\t\tcontext,\n\t\t\t\t\tbaseProperties,\n\t\t\t\t\tresolvedImageSrc,\n\t\t\t\t\tisRelativeNumber(resolvedPosition.positionX) || isRelativeNumber(resolvedPosition.positionY),\n\t\t\t\t)\n\t\t\t: undefined\n\n\tconst src = propertiesFromAssetMap?.src ?? resolvedImageSrc\n\tconst alt = propertiesFromAssetMap?.alt ?? responsiveImage?.alt ?? baseProperties.alt\n\t// Handle deprecated srcSet\n\tconst srcSet = propertiesFromAssetMap?.srcSet ?? responsiveImage?.srcSet ?? undefined\n\t// We prioritise dimensions from the src where possible to move towards a future without an asset map.\n\t// We can fallback to the asset map for any src without dimensions included.\n\t// Finally we fall back to fillImagePixelWidth/Height because any vectors with image fill rely on it currently.\n\tconst pixelWidth =\n\t\tpixelDimensionsFromSrc?.width ?? propertiesFromAssetMap?.pixelWidth ?? node.fillImagePixelWidth ?? undefined\n\tconst pixelHeight =\n\t\tpixelDimensionsFromSrc?.height ?? propertiesFromAssetMap?.pixelHeight ?? node.fillImagePixelHeight ?? undefined\n\tconst hasDynamicImage = Boolean(responsiveImageVariable || propertiesFromAssetMap?.localizedImage)\n\n\tconst preferredSize = propertiesFromAssetMap?.preferredSize\n\tconst nodeHasFixedSize = experiments.isOn(\"fixedSizeImageSrcset\") ? hasFixedSize(node, context?.tree) : undefined\n\n\tconst properties: RecordWithSafeJS<BackgroundImage> = {\n\t\t...baseProperties,\n\t\tsrc: hasDynamicImage ? undefined : src,\n\t\talt,\n\t\tpixelWidth,\n\t\tpixelHeight,\n\t\tloading: hasDynamicImage || src ? getLoadingAttribute(node, context) : undefined,\n\t\tsizes:\n\t\t\tisJSXContext(context) && isPinnable(node) && withSize(node) ? context.simulatedDOM.getCSSWidth(node) : undefined,\n\t}\n\n\tif (experiments.isOn(\"fixedSizeImageSrcset\")) {\n\t\tproperties.nodeFixedSize =\n\t\t\tnodeHasFixedSize && withSize(node) ? { width: node.width, height: node.height } : undefined\n\t\tproperties.preferredSize = preferredSize\n\t} else {\n\t\tproperties.srcSet = srcSet\n\t}\n\n\tconst backgroundImage = new SerializableObject(properties)\n\tspreadJSVariables(backgroundImage, resolvedPosition, responsiveImageVariable, propertiesFromAssetMap?.localizedImage)\n\n\t// Safe cast because we know which values the serializable object contains\n\treturn backgroundImage as unknown as RecordWithSafeJS<BackgroundImage>\n}\n\ntype BaseProperties = Pick<BackgroundImage, \"intrinsicWidth\" | \"intrinsicHeight\" | \"fit\" | \"backgroundSize\" | \"alt\">\nfunction getBaseProperties(node: CanvasNode & WithFill): BaseProperties {\n\treturn {\n\t\tintrinsicWidth: withIntrinsicSize(node) && isNumber(node.intrinsicWidth) ? node.intrinsicWidth : undefined,\n\t\tintrinsicHeight: withIntrinsicSize(node) && isNumber(node.intrinsicHeight) ? node.intrinsicHeight : undefined,\n\t\tfit: node.fillImageResize ?? \"fill\",\n\t\tbackgroundSize: node.fillImageResize === \"tile\" ? node.fillImageTileSize || 1 : undefined,\n\t\talt: (withAltText(node) ? node.altAttribute : undefined) ?? fallbackAltText,\n\t}\n}\n\nfunction getLocalizedImage(node: CanvasNode & WithFill, activeLocale?: Locale): MaybeLocalizedImage {\n\tif (!activeLocale || isDynamicValue(node.fillImage) || !withFillImageLocalized(node)) return undefined\n\treturn getLocalizedValueForActiveLocale(activeLocale, node.fillImageLocalized)\n}\n\nfunction getResolvedPosition(\n\tnode: CanvasNode & WithFill,\n\tlocalizedImage: MaybeLocalizedImage,\n\tresponsiveImage: ResponsiveImage | undefined,\n): Pick<BackgroundImage, \"positionX\" | \"positionY\"> {\n\tconst resize = node.fillImageResize ?? \"fill\"\n\tconst nodeHasPosition = !isUndefined(node.fillImagePositionX) || !isUndefined(node.fillImagePositionY)\n\t// The default for fill is treated as a focal point, so any dynamic focal point can override it\n\t// otherwise we only know the node is using a custom focal point if the positions are relative.\n\tconst nodeHasFocalPoint =\n\t\t(resize === \"fill\" && !nodeHasPosition) ||\n\t\tisRelativeNumber(node.fillImagePositionX) ||\n\t\tisRelativeNumber(node.fillImagePositionY)\n\tconst resetFocalPointForDynamicImage =\n\t\tnodeHasFocalPoint && nodeHasPosition && isDynamicValue(node.fillImage) && !hasControlFocalPoint(responsiveImage)\n\tconst resetFocalPointForLocalizedImage =\n\t\tnodeHasFocalPoint && nodeHasPosition && localizedImage && !hasControlFocalPoint(localizedImage.imageFocalPoint)\n\n\tif (resetFocalPointForDynamicImage || resetFocalPointForLocalizedImage) {\n\t\t// If we have a dynamic or localized image without a focal point we need to reset the focal point\n\t\t// from the node otherwise the focal point will probably be wrong.\n\t\treturn {\n\t\t\tpositionX: \"center\",\n\t\t\tpositionY: \"center\",\n\t\t}\n\t}\n\n\tif (!nodeHasFocalPoint) {\n\t\t// If the node doesn't have a focal point we can use the node's position directly because we don't want\n\t\t// any dynamic focal point to override it\n\t\treturn {\n\t\t\tpositionX: node.fillImagePositionX ?? (resize === \"tile\" ? \"left\" : \"center\"),\n\t\t\tpositionY: node.fillImagePositionY ?? (resize === \"tile\" ? \"top\" : \"center\"),\n\t\t}\n\t}\n\n\tconst positionX = localizedImage?.imageFocalPoint?.positionX ?? responsiveImage?.positionX ?? node.fillImagePositionX\n\tconst positionY = localizedImage?.imageFocalPoint?.positionY ?? responsiveImage?.positionY ?? node.fillImagePositionY\n\tconst hasFocalPoint = isRelativeNumber(positionX) || isRelativeNumber(positionY)\n\n\tif (!canUseFocalPoint(node) && hasFocalPoint) {\n\t\treturn {\n\t\t\tpositionX: resize === \"tile\" ? \"left\" : \"center\",\n\t\t\tpositionY: resize === \"tile\" ? \"top\" : \"center\",\n\t\t}\n\t} else if (resize !== \"fill\") {\n\t\treturn {\n\t\t\tpositionX: positionX ?? \"center\",\n\t\t\tpositionY: positionY ?? \"center\",\n\t\t}\n\t}\n\n\treturn { positionX, positionY }\n}\n\nfunction getPixelDimensionsFromSrc(resolvedImageSrc: string | undefined) {\n\treturn resolvedImageSrc ? getPixelDimensionsFromImageSrc(resolvedImageSrc) : undefined\n}\n\nfunction canUseFocalPoint(node: CanvasNode & WithFill) {\n\t// A custom focal point should only be possible if fit is set to fill or undefined (defaults to fill)\n\treturn !node.fillImageResize || node.fillImageResize === \"fill\"\n}\n\nfunction getLoadingAttribute(\n\tnode: CanvasNode & WithFill,\n\tcontext: CollectorContext | undefined,\n): SafeJS | \"lazy\" | undefined {\n\tif (!isJSXContext(context)) return\n\n\t// Save CPU cycles by not computing loading=lazy for images inside overlays. There\u2019s no practical benefit to lazy-loading images\n\t// that aren\u2019t in DOM during page load.\n\tif (nodeIsInOverlay(node)) return\n\n\tif (!isPinnable(node) || !withPositionType(node)) return\n\n\tconst nodeYPosition = context.simulatedDOM.getYPosition(node)\n\tif (isUndefined(nodeYPosition)) return\n\n\treturn SafeJS.fn(context.imports.addImport(\"framer\", { exportSpecifier: \"getLoadingLazyAtYPosition\" }), nodeYPosition)\n}\n\nfunction getPropertiesFromAssetMap(\n\tnode: CanvasNode & WithFill,\n\tcontext: CollectorContext | undefined,\n\tbaseProperties: BaseProperties,\n\tresolvedImageSrc: string,\n\tdefaultLocaleHasFocalPoint: boolean,\n) {\n\tif (!context?.assets) return undefined\n\tconst assetsCollector = context.assets\n\n\tconst resolvedAsset = assetsCollector.resolveResponsiveImage(resolvedImageSrc)\n\n\tconst localizedAlt =\n\t\twithAltText(node) && context.localizedValues\n\t\t\t? SafeJS.fromValue(\n\t\t\t\t\tcontext.localizedValues.add(\n\t\t\t\t\t\tbaseProperties.alt,\n\t\t\t\t\t\tnode.altAttributeLocalized,\n\t\t\t\t\t\tlocaleId => node.altAttributeLocalized?.[localeId]?.value,\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t: undefined\n\n\tconst localizedImage = getLocalizedImageFromAssetMap(node, context, resolvedAsset, defaultLocaleHasFocalPoint)\n\n\treturn {\n\t\tsrc: localizedImage ? undefined : resolvedAsset?.src,\n\t\tsrcSet: localizedImage ? undefined : resolvedAsset?.srcSet,\n\t\tpreferredSize: resolvedAsset?.preferredSize,\n\t\talt: localizedAlt,\n\t\tpixelWidth: resolvedAsset?.pixelWidth,\n\t\tpixelHeight: resolvedAsset?.pixelHeight,\n\t\tlocalizedImage,\n\t}\n}\n\nfunction getLocalizedImageFromAssetMap(\n\tnode: CanvasNode & WithFill,\n\tcontext: CollectorContext | undefined,\n\tresolvedAsset: ResolvedAsset | undefined,\n\tdefaultLocaleHasFocalPoint: boolean,\n) {\n\tif (!withFillImageLocalized(node) || !isJSXContext(context) || !node.fillImageLocalized) return undefined\n\n\treturn SafeJS.fromValue(\n\t\tcontext.localizedValues.add(resolvedAsset, node.fillImageLocalized, localeId => {\n\t\t\tconst localizedValue = node.fillImageLocalized?.[localeId]\n\t\t\tif (!isNonNullLocalizedValue(localizedValue)) return\n\t\t\tlet localizedFocalPoint: WithControlFocalPoint | undefined\n\t\t\tif (canUseFocalPoint(node)) {\n\t\t\t\tlocalizedFocalPoint = localizedValue.imageFocalPoint\n\t\t\t\t// If the default locale has a focal point we need to override it because it\n\t\t\t\t// is specific to the corresponding image.\n\t\t\t\tif (defaultLocaleHasFocalPoint && !localizedFocalPoint) {\n\t\t\t\t\tlocalizedFocalPoint = centerFocalPoint\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn context.assets.resolveResponsiveImage(localizedValue.value, {\n\t\t\t\tfocalPoint: localizedFocalPoint || undefined,\n\t\t\t})\n\t\t}),\n\t)\n}\n\nfunction getResponsiveImageVariableJS(\n\tnode: CanvasNode & WithFill,\n\tcontext: CollectorContext | undefined,\n): SafeJS | undefined {\n\tif (!isJSXContext(context)) return undefined\n\n\tif (isComputedValue(node.fillImage)) {\n\t\tconst value = context.createDeduplicatedDynamicValueBinding(node.fillImage, node, \"fillImage\")\n\t\treturn context.valueTransforms.wrapInToResponsiveImage(value)\n\t}\n\n\tif (context.variables && context.valueTransforms && isVariableReference(node.fillImage)) {\n\t\tconst variableSrc = context.variables.create(node.fillImage)\n\t\tassert(variableSrc instanceof SafeJS)\n\t\treturn context.valueTransforms.wrapInToResponsiveImage(variableSrc)\n\t}\n\n\treturn undefined\n}\n\nfunction spreadJSVariables(\n\tbackgroundImage: SerializableObject,\n\t{ positionX, positionY }: Pick<BackgroundImage, \"positionX\" | \"positionY\">,\n\tresponsiveImageVariable: SafeJS | undefined,\n\tlocalizedImage: SafeJS | undefined,\n) {\n\tif (responsiveImageVariable) {\n\t\tSerializableObject.addSpreadAtEnd(backgroundImage, responsiveImageVariable)\n\t}\n\n\tif (positionX && positionY) {\n\t\t// If an image variable has been spread into the object we need to make sure that we\n\t\t// override the position using a spread as well.\n\t\tif (SerializableObject.hasSpreads(backgroundImage)) {\n\t\t\tconst position = js`{ positionX: ${positionX}, positionY: ${positionY} }`\n\t\t\tSerializableObject.addSpreadAtEnd(backgroundImage, position)\n\t\t} else {\n\t\t\tSerializableObject.assign(backgroundImage, { positionX, positionY })\n\t\t}\n\t}\n\n\t// We merge the localized image after position, because the focal point of the localized image\n\t// should override the image position. If the current image size doesn't support focal points,\n\t// the localized image has already excluded its focal point.\n\tif (localizedImage) {\n\t\tSerializableObject.addSpreadAtEnd(backgroundImage, localizedImage)\n\t}\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport type { RecordWithSafeJS } from \"code-generation/types.ts\"\nimport type { CollectorContext } from \"code-generation/utils/collector.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { WithFill } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport { withFill, withOptionalFill } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport type { WithControlFocalPoint } from \"document/models/controlProps/WithControlFocalPoint.ts\"\nimport { DimensionType } from \"library/index.ts\"\nimport type { DeprecatedCoreFrameProps as CoreFrameProps } from \"library/render/presentation/Frame/DeprecatedFrame.tsx\"\nimport type { FillProperties } from \"library/render/traits/Fill.ts\"\nimport type { BackgroundImage, FitImageDimensionType } from \"library/render/types/BackgroundImage.ts\"\nimport type { LinearGradient, RadialGradient } from \"library/render/types/Gradient.ts\"\nimport type { Locale } from \"library/router/types.ts\"\nimport { withShape } from \"../WithShape.ts\"\nimport { withSizeDimensionType } from \"../WithSizeDimensionType.ts\"\nimport { createBackgroundImage } from \"./createBackgroundImage.ts\"\n\nconst centerFocalPoint: WithControlFocalPoint = { positionX: \"50%\", positionY: \"50%\" }\nObject.freeze(centerFocalPoint)\n\nexport function getBackgroundAttributes(\n\tnode: CanvasNode & WithFill,\n\tonlyBackgroundImage = false,\n\tcontext?: CollectorContext,\n\tactiveLocale?: Locale,\n): RecordWithSafeJS<BackgroundImage> | LinearGradient | RadialGradient | string | undefined {\n\tif (onlyBackgroundImage && node.fillType !== \"image\") return\n\n\tswitch (node.fillType) {\n\t\tcase \"image\": {\n\t\t\treturn createBackgroundImage(node, context, activeLocale)\n\t\t}\n\t\tcase \"linear-gradient\": {\n\t\t\treturn node.fillLinearGradient\n\t\t}\n\t\tcase \"radial-gradient\": {\n\t\t\treturn node.fillRadialGradient\n\t\t}\n\t\tcase \"conic-gradient\": {\n\t\t\treturn node.fillConicGradient\n\t\t}\n\t\tcase \"color\":\n\t\tcase undefined: {\n\t\t\treturn node.fillColor ? node.resolveValue(\"fillColor\", context?.variableOverrides) : undefined\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(node.fillType)\n\t}\n}\n\nexport function collectBackgroundPropsForNode(\n\tnode: CanvasNode,\n\tprops: {\n\t\tbackground?: RecordWithSafeJS<CoreFrameProps[\"background\"]>\n\t\tfitImageDimension?: FitImageDimensionType\n\t},\n\tonlyBackgroundImage = false,\n\tcontext?: CollectorContext,\n\tactiveLocale?: Locale,\n) {\n\tif (withShape(node)) return\n\n\tif (withOptionalFill(node) && !node.fillEnabled) {\n\t\tprops.background = null\n\t\treturn\n\t}\n\n\tif (withFill(node)) {\n\t\tconst background = getBackgroundAttributes(node, onlyBackgroundImage, context, activeLocale)\n\t\tif (background) {\n\t\t\tprops.background = background\n\t\t\tif (node.fillType === \"image\") {\n\t\t\t\tif (withSizeDimensionType(node) && node.heightType === DimensionType.FitImage) {\n\t\t\t\t\tprops.fitImageDimension = \"height\"\n\t\t\t\t} else if (withSizeDimensionType(node) && node.widthType === DimensionType.FitImage) {\n\t\t\t\t\tprops.fitImageDimension = \"width\"\n\t\t\t\t} else {\n\t\t\t\t\tprops.fitImageDimension = undefined\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function collectFillPropsForNode(\n\tnode: CanvasNode,\n\tprops: { fill?: RecordWithSafeJS<FillProperties[\"fill\"]> },\n\tcontext: CollectorContext,\n) {\n\tif (withOptionalFill(node) && !node.fillEnabled) {\n\t\tprops.fill = null\n\t\treturn\n\t}\n\tif (withFill(node)) {\n\t\tprops.fill = getBackgroundAttributes(node, undefined, context) ?? null\n\t}\n}\n", "import type { CanvasNode } from \"../../index.ts\"\nimport type { VariableReference } from \"../VariableReference.ts\"\nimport { type WithVariableProvider, withVariableProvider } from \"../WithVariableProvider.ts\"\n\n/**\n * Array variable providers must come from an ancestor in the current scope.\n */\nexport function getArrayProviderNodeInAncestorScope(\n\tnode: CanvasNode,\n\tproviderId: VariableReference[\"providerId\"],\n): (CanvasNode & WithVariableProvider) | undefined {\n\tif (!providerId) return\n\n\tfor (const ancestor of node.ancestors()) {\n\t\tif (ancestor.getPrimaryId() !== providerId) continue\n\t\tif (!withVariableProvider(ancestor)) return\n\t\treturn ancestor\n\t}\n\n\treturn undefined\n}\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport { SupportedLayoutOption, supportsAutoSizing, supportsFixedSizing } from \"@framerjs/framer-runtime/crossorigin\"\nimport type { SerializableMotionStyle } from \"code-generation/types.ts\"\nimport { type DimensionType, isAutoDimensionType } from \"library/render/types/Constraints.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport type { CodeComponentNode } from \"../index.ts\"\nimport { supportsSizeConstraints } from \"../traits/WithSizeConstraints.ts\"\n\n/**\n * Set width/height to 100% if the component size is controlled by Framer (aka\n * fixed) as opposed to auto sized. Note that legacy components do not get this\n * treatment (see `shouldSetFillStyle` below).\n */\nexport function getStyleForSupportedLayout(\n\tnode: CodeComponentNode,\n\tcomponentLoader: AnyComponentLoader,\n): SerializableMotionStyle | undefined {\n\tif (node.isVectorInstance) return\n\t// If the component has a property control for \"style\", we cannot hijack it\n\t// and assume it's a valid React.CSSProperties object for styling.\n\tconst definition = componentLoader.reactComponentForIdentifier(node.codeComponentIdentifier)\n\tif (definition?.properties?.style) return\n\n\tconst supportedLayout = node.getSupportedLayout(componentLoader)\n\tconst style: React.CSSProperties = {}\n\tif (shouldSetFillStyle(supportedLayout.width, node.widthType)) {\n\t\tstyle.width = \"100%\"\n\t}\n\tif (shouldSetFillStyle(supportedLayout.height, node.heightType)) {\n\t\tstyle.height = \"100%\"\n\t}\n\t// Code components size constraints are applied to their container (along\n\t// with other layout styles). If the code component is expected to be\n\t// constrained by a max size, we need to ensure that it doesn't grow larger\n\t// than its container. To do this we need to set its max sizes to 100% on\n\t// each axis it is constrained.\n\tif (supportsSizeConstraints(node)) {\n\t\tif (!isUndefined(node.maxWidth)) style.maxWidth = \"100%\"\n\t\tif (!isUndefined(node.maxHeight)) style.maxHeight = \"100%\"\n\t}\n\n\treturn style\n}\n\nfunction shouldSetFillStyle(supportedLayout: SupportedLayoutOption, dimensionType: DimensionType) {\n\tif (supportedLayout === SupportedLayoutOption.Legacy) {\n\t\t// We didn't set 100% width/height on old code components, so maintain that behavior.\n\t\treturn false\n\t}\n\t// Note: We prioritize the definition support over the actual tree node value (it can be outdated).\n\tif (!supportsAutoSizing(supportedLayout)) {\n\t\t// Components that don't support auto sizing will always get the 100% dimension.\n\t\treturn true\n\t}\n\tif (!supportsFixedSizing(supportedLayout)) {\n\t\t// The component only supports auto, and we should not set 100%.\n\t\treturn false\n\t}\n\t// If we get here, the component can be either auto or fixed, so we need to check the node.\n\tif (isAutoDimensionType(dimensionType)) {\n\t\t// We don't set 100% on nodes that are auto sizing.\n\t\treturn false\n\t}\n\t// The node is currently set to fixed, so we need to set 100%.\n\treturn true\n}\n", "import type { VerifiedControlDescription, VerifiedObjectPropertyControlDescription } from \"@framerjs/framer-runtime\"\nimport { assert } from \"@framerjs/shared\"\nimport { experiments } from \"app/experiments.ts\"\nimport {\n\ttype VariableProviderControlMap,\n\ttype VariableProviderVariableMap,\n\temptyControlMap,\n\temptyVariableMap,\n} from \"../traits/VariableProvider.ts\"\nimport { type VariableDefinition, type VariableID, isArrayOfObjectControlDescription } from \"../traits/WithVariables.ts\"\nimport { EagerVariableProviderMap } from \"../traits/utils/EagerVariableProviderMap.ts\"\nimport { LazyVariableMapFromControlMap } from \"./utils/LazyVariableMapFromControlMap.ts\"\nimport { getVariableFromControlDescription } from \"./utils/getVariableFromControlDescription.ts\"\n\nexport function getArraySourceVariablesFromControlDescription(arrayControl: VerifiedControlDescription | undefined): {\n\tvariableMap: VariableProviderVariableMap\n\tcontrolMap: VariableProviderControlMap\n} {\n\tif (!arrayControl) {\n\t\treturn {\n\t\t\tvariableMap: emptyVariableMap,\n\t\t\tcontrolMap: emptyControlMap,\n\t\t}\n\t}\n\n\tif (experiments.isOn(\"lazyProviderMaps\")) {\n\t\tconst controlMap = new LazyArraySourceControlMap(arrayControl)\n\t\tconst variableMap = new LazyVariableMapFromControlMap(controlMap)\n\n\t\treturn {\n\t\t\tvariableMap,\n\t\t\tcontrolMap,\n\t\t}\n\t}\n\n\tconst variableMap = new EagerVariableProviderMap<VariableDefinition>()\n\tconst controlMap = new EagerVariableProviderMap<VerifiedControlDescription>()\n\n\tassert(isArrayOfObjectControlDescription(arrayControl), \"Expected array of object control\")\n\n\tconst objectControl = arrayControl.control\n\n\tfor (const key in objectControl.controls) {\n\t\tconst control = objectControl.controls[key]\n\t\tif (!control) continue\n\n\t\tconst variable = getVariableFromControlDescription(control, key)\n\t\tif (!variable) continue\n\n\t\tvariableMap.set(variable.id, variable)\n\t\tcontrolMap.set(variable.id, control)\n\t}\n\n\treturn { variableMap, controlMap }\n}\n\nexport class LazyArraySourceControlMap implements VariableProviderControlMap {\n\tprivate readonly controls: Record<string, VerifiedObjectPropertyControlDescription>\n\n\tconstructor(arrayControl: VerifiedControlDescription) {\n\t\tassert(isArrayOfObjectControlDescription(arrayControl), \"Expected array of object control\")\n\t\tthis.controls = arrayControl.control.controls\n\t}\n\n\thas(variableId: VariableID): boolean {\n\t\tconst control = this.get(variableId)\n\t\treturn Boolean(control)\n\t}\n\n\tget(variableId: VariableID): VerifiedControlDescription | undefined {\n\t\treturn this.controls[variableId]\n\t}\n\n\t*[Symbol.iterator](): IterableIterator<[VariableID, VerifiedControlDescription]> {\n\t\tfor (const variableId in this.controls) {\n\t\t\tconst control = this.get(variableId)\n\t\t\tassert(control, \"Control must exist\")\n\n\t\t\tyield [variableId, control]\n\t\t}\n\t}\n}\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport type { SandboxRepeaterData } from \"document/SandboxRepeaterData.ts\"\nimport { RepeaterControlMap, RepeaterValueMap, RepeaterVariableMap } from \"document/utils/RepeaterVariables.ts\"\nimport type { CanvasTree } from \"../CanvasTree.ts\"\nimport {\n\ttype VariableProviderControlMap,\n\ttype VariableProviderValueMap,\n\ttype VariableProviderVariableMap,\n\temptyValueMap,\n} from \"../traits/VariableProvider.ts\"\nimport type { VariableReference } from \"../traits/VariableReference.ts\"\nimport { hasRepeatArray } from \"../traits/WithRepeatArray.ts\"\nimport type { WithVariableProvider } from \"../traits/WithVariableProvider.ts\"\nimport { getArrayProviderNodeInAncestorScope } from \"../traits/utils/getArrayProviderNodeInAncestorScope.ts\"\nimport type { CanvasNode } from \"./CanvasNode.ts\"\nimport { DataSourceValueMap } from \"./DataSourceValueMap.ts\"\nimport { getArraySourceVariablesFromControlDescription } from \"./getArraySourceVariablesFromControlDescription.ts\"\nimport { isDataRepeater } from \"./utils/nodeCheck.ts\"\n\nexport class ArraySourceVariableProviderCache {\n\tprivate arraySourceVariableMapCache?: {\n\t\tvariableMap: VariableProviderVariableMap\n\t\tcontrolMap: VariableProviderControlMap\n\n\t\tcacheKey: {\n\t\t\tdataRepeaterArray: VariableReference\n\t\t\tproviderControlMap: VariableProviderControlMap | undefined\n\t\t}\n\t}\n\n\tprivate arraySourceValueMapCache?: {\n\t\tvalueMap: VariableProviderValueMap\n\n\t\tcacheKey: {\n\t\t\tarrayValues: Record<string, unknown>[] | undefined\n\t\t\tcontrolMap: VariableProviderControlMap | undefined\n\t\t}\n\t}\n\n\tretrieveArrayProviderNode(\n\t\tnode: CanvasNode,\n\t\tdataRepeaterArray: VariableReference,\n\t): (CanvasNode & WithVariableProvider) | undefined {\n\t\tconst providerNode = getArrayProviderNodeInAncestorScope(node, dataRepeaterArray.providerId)\n\t\tif (!providerNode) {\n\t\t\tthis.arraySourceVariableMapCache = undefined\n\t\t\tthis.arraySourceValueMapCache = undefined\n\t\t\treturn undefined\n\t\t}\n\t\treturn providerNode\n\t}\n\n\tretrieveArrayValues(\n\t\tnode: CanvasNode,\n\t\ttree: CanvasTree,\n\t\tchild: CanvasNode | undefined,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tdataRepeaterArray: VariableReference,\n\t\tsandboxRepeaterData: SandboxRepeaterData,\n\t\tcomponentLoaderHash: string | undefined,\n\t): Record<string, unknown>[] | undefined {\n\t\tconst providerNode = this.retrieveArrayProviderNode(node, dataRepeaterArray)\n\n\t\tconst providerValueMap = providerNode?.getProvidedValueMap(\n\t\t\ttree,\n\t\t\tchild,\n\t\t\tcomponentLoader,\n\t\t\tsandboxRepeaterData,\n\t\t\tcomponentLoaderHash,\n\t\t)\n\n\t\treturn providerValueMap?.get(dataRepeaterArray.id) as Record<string, unknown>[] | undefined\n\t}\n\n\tprivate computeArraySourceVariableMapIfNeeded(\n\t\tnode: CanvasNode,\n\t\ttree: CanvasTree,\n\t\tchild: CanvasNode | undefined,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tdataRepeaterArray: VariableReference,\n\t\tcomponentLoaderHash: string | undefined,\n\t): void {\n\t\tconst providerNode = this.retrieveArrayProviderNode(node, dataRepeaterArray)\n\t\tif (!providerNode) return\n\n\t\tconst providerControlMap = providerNode.getProvidedControlMap(tree, child, componentLoader, componentLoaderHash)\n\n\t\tconst { arraySourceVariableMapCache } = this\n\t\tif (\n\t\t\tarraySourceVariableMapCache &&\n\t\t\tdataRepeaterArray === arraySourceVariableMapCache.cacheKey.dataRepeaterArray &&\n\t\t\tproviderControlMap === arraySourceVariableMapCache.cacheKey.providerControlMap\n\t\t) {\n\t\t\treturn\n\t\t}\n\n\t\tconst arrayControlDescription = providerControlMap?.get(dataRepeaterArray.id)\n\n\t\tlet { variableMap, controlMap } = getArraySourceVariablesFromControlDescription(arrayControlDescription)\n\n\t\tif (isDataRepeater(node) || hasRepeatArray(node)) {\n\t\t\tvariableMap = new RepeaterVariableMap(variableMap)\n\t\t\tcontrolMap = new RepeaterControlMap(controlMap)\n\t\t}\n\n\t\tthis.arraySourceVariableMapCache = {\n\t\t\tvariableMap,\n\t\t\tcontrolMap,\n\t\t\tcacheKey: {\n\t\t\t\tdataRepeaterArray,\n\t\t\t\tproviderControlMap,\n\t\t\t},\n\t\t}\n\t}\n\n\tprivate computeArraySourceValueMapIfNeeded(\n\t\tnode: CanvasNode,\n\t\ttree: CanvasTree,\n\t\tchild: CanvasNode | undefined,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tdataRepeaterArray: VariableReference,\n\t\tsandboxRepeaterData: SandboxRepeaterData,\n\t\tcomponentLoaderHash: string | undefined,\n\t): void {\n\t\tconst arrayValues = this.retrieveArrayValues(\n\t\t\tnode,\n\t\t\ttree,\n\t\t\tchild,\n\t\t\tcomponentLoader,\n\t\t\tdataRepeaterArray,\n\t\t\tsandboxRepeaterData,\n\t\t\tcomponentLoaderHash,\n\t\t)\n\n\t\tconst controlMap = this.getArraySourceVariableControlMap(\n\t\t\tnode,\n\t\t\ttree,\n\t\t\tchild,\n\t\t\tcomponentLoader,\n\t\t\tdataRepeaterArray,\n\t\t\tcomponentLoaderHash,\n\t\t)\n\n\t\tconst { arraySourceValueMapCache } = this\n\t\tif (\n\t\t\tarraySourceValueMapCache &&\n\t\t\tarrayValues === arraySourceValueMapCache.cacheKey.arrayValues &&\n\t\t\tcontrolMap === arraySourceValueMapCache.cacheKey.controlMap\n\t\t) {\n\t\t\treturn\n\t\t}\n\n\t\tlet valueMap: VariableProviderValueMap = emptyValueMap\n\n\t\tif (controlMap) {\n\t\t\tconst firstValue = arrayValues?.[0]\n\t\t\tvalueMap = new DataSourceValueMap(tree, controlMap, firstValue)\n\t\t}\n\n\t\tif (isDataRepeater(node) || hasRepeatArray(node)) {\n\t\t\tconst itemCount = arrayValues?.length ?? 0\n\t\t\tvalueMap = new RepeaterValueMap(valueMap, 0, itemCount)\n\t\t}\n\n\t\tthis.arraySourceValueMapCache = {\n\t\t\tvalueMap,\n\t\t\tcacheKey: {\n\t\t\t\tarrayValues,\n\t\t\t\tcontrolMap,\n\t\t\t},\n\t\t}\n\t}\n\n\tgetArraySourceVariableMap(\n\t\tnode: CanvasNode,\n\t\ttree: CanvasTree,\n\t\tchild: CanvasNode | undefined,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tdataRepeaterArray: VariableReference,\n\t\tcomponentLoaderHash: string | undefined,\n\t): VariableProviderVariableMap | undefined {\n\t\tthis.computeArraySourceVariableMapIfNeeded(\n\t\t\tnode,\n\t\t\ttree,\n\t\t\tchild,\n\t\t\tcomponentLoader,\n\t\t\tdataRepeaterArray,\n\t\t\tcomponentLoaderHash,\n\t\t)\n\t\treturn this.arraySourceVariableMapCache?.variableMap\n\t}\n\n\tgetArraySourceValueMap(\n\t\tnode: CanvasNode,\n\t\ttree: CanvasTree,\n\t\tchild: CanvasNode | undefined,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tdataRepeaterArray: VariableReference,\n\t\tsandboxRepeaterData: SandboxRepeaterData,\n\t\tcomponentLoaderHash: string | undefined,\n\t): VariableProviderValueMap | undefined {\n\t\tthis.computeArraySourceValueMapIfNeeded(\n\t\t\tnode,\n\t\t\ttree,\n\t\t\tchild,\n\t\t\tcomponentLoader,\n\t\t\tdataRepeaterArray,\n\t\t\tsandboxRepeaterData,\n\t\t\tcomponentLoaderHash,\n\t\t)\n\t\treturn this.arraySourceValueMapCache?.valueMap\n\t}\n\n\tgetArraySourceVariableControlMap(\n\t\tnode: CanvasNode,\n\t\ttree: CanvasTree,\n\t\tchild: CanvasNode | undefined,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tdataRepeaterArray: VariableReference,\n\t\tcomponentLoaderHash: string | undefined,\n\t): VariableProviderControlMap | undefined {\n\t\tthis.computeArraySourceVariableMapIfNeeded(\n\t\t\tnode,\n\t\t\ttree,\n\t\t\tchild,\n\t\t\tcomponentLoader,\n\t\t\tdataRepeaterArray,\n\t\t\tcomponentLoaderHash,\n\t\t)\n\t\treturn this.arraySourceVariableMapCache?.controlMap\n\t}\n}\n", "import type { VerifiedPropertyControls } from \"@framerjs/framer-runtime\"\nimport type { ControlProps } from \"document/models/controlProps/ControlProp.ts\"\nimport type { RawControlProps } from \"document/models/controlProps/RawControlProp.ts\"\nimport { isPrefixedControlPropKey } from \"document/models/controlProps/controlPropKey.ts\"\nimport { getControlProps } from \"document/models/controlProps/getControlProps.ts\"\nimport type { PropertyControls } from \"library/index.ts\"\nimport { isShallowEqual } from \"utils/isShallowEqual.ts\"\nimport { CanvasNodeCache } from \"./CanvasNodeCache.ts\"\n\n/**\n * Control Props have their own separate caching mechanism.\n */\nexport class RawControlPropsCache extends CanvasNodeCache {\n\tprivate rawControlPropsCurrentVersion: number = -1\n\tprivate rawControlPropsCurrentCache: RawControlProps | null = null\n\tprivate rawControlPropsPreviousVersion: number = -1\n\tprivate rawControlPropsPreviousCache: RawControlProps | null = null\n\n\t/**\n\t * `version` is the node update count.\n\t */\n\tsetRawControlProps(version: number, value: RawControlProps): RawControlProps {\n\t\tconst canUpdateCache = version > this.rawControlPropsCurrentVersion\n\t\tif (!canUpdateCache) return value\n\n\t\tthis.rawControlPropsPreviousVersion = this.rawControlPropsCurrentVersion\n\t\tthis.rawControlPropsPreviousCache = this.rawControlPropsCurrentCache\n\t\tthis.rawControlPropsCurrentVersion = version\n\n\t\tif (this.rawControlPropsCurrentCache && isShallowEqual(this.rawControlPropsCurrentCache, value)) {\n\t\t\treturn this.rawControlPropsCurrentCache\n\t\t} else {\n\t\t\tthis.rawControlPropsCurrentCache = value\n\t\t\treturn value\n\t\t}\n\t}\n\n\t/**\n\t * @param version - Cache version number, derived from either node.update or node.cache.controlPropUpdate. Used to\n\t *                 validate and invalidate the cached control props.\n\t */\n\tgetRawControlProps(version: number): RawControlProps | null {\n\t\tswitch (version) {\n\t\t\tcase this.rawControlPropsCurrentVersion:\n\t\t\t\treturn this.rawControlPropsCurrentCache\n\t\t\tcase this.rawControlPropsPreviousVersion:\n\t\t\t\treturn this.rawControlPropsPreviousCache\n\t\t\tdefault:\n\t\t\t\treturn null\n\t\t}\n\t}\n\n\tclearRawControlProps() {\n\t\tthis.rawControlPropsCurrentVersion = -1\n\t\tthis.rawControlPropsCurrentCache = null\n\t\tthis.rawControlPropsPreviousVersion = -1\n\t\tthis.rawControlPropsPreviousCache = null\n\t}\n\n\tprivate getControlPropsCache:\n\t\t| {\n\t\t\t\tcontrols: PropertyControls\n\t\t\t\trawControlProps: Record<string, unknown>\n\t\t\t\tresult: ControlProps\n\t\t  }\n\t\t| undefined\n\n\tgetControlProps(\n\t\tcontrols: VerifiedPropertyControls,\n\t\trawControlProps: Record<string, unknown>,\n\t\tcanUseCache: boolean,\n\t): ControlProps {\n\t\tif (\n\t\t\tcanUseCache &&\n\t\t\tthis.getControlPropsCache &&\n\t\t\tcontrols === this.getControlPropsCache.controls &&\n\t\t\trawControlProps === this.getControlPropsCache.rawControlProps\n\t\t) {\n\t\t\treturn this.getControlPropsCache.result\n\t\t}\n\n\t\tconst result = getControlProps(controls, rawControlProps)\n\t\tif (!canUseCache) return result\n\n\t\tthis.getControlPropsCache = { result, controls, rawControlProps }\n\t\treturn result\n\t}\n\n\t/**\n\t * Increments every time a control prop is updated on the node. Currently used only by WebPageNode. Consider\n\t * applying it for CodeComponentNode as well if this approach is successful.\n\t */\n\tcontrolPropVersion: number = -1\n\tupdateControlPropVersion(properties: { [key: string]: unknown }) {\n\t\tlet updatingControlProps = false\n\t\tfor (const key in properties) {\n\t\t\tif (isPrefixedControlPropKey(key)) {\n\t\t\t\tupdatingControlProps = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif (updatingControlProps) {\n\t\t\tthis.controlPropVersion++\n\t\t}\n\t}\n}\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport { type ModuleExportIdentifierString, ModuleType, assertNever, parseModuleIdentifier } from \"@framerjs/shared\"\nimport type { VariantDetails } from \"code-generation/variantDetails.ts\"\nimport type { SandboxRepeaterData } from \"document/SandboxRepeaterData.ts\"\nimport { isBoolean } from \"utils/typeChecks.ts\"\nimport type { CanvasTree } from \"../CanvasTree.ts\"\nimport type {\n\tVariableProviderControlMap,\n\tVariableProviderValueMap,\n\tVariableProviderVariableMap,\n} from \"../traits/VariableProvider.ts\"\nimport type { VariableReference } from \"../traits/VariableReference.ts\"\nimport { ArraySourceVariableProviderCache } from \"./ArraySourceVariableProviderCache.ts\"\nimport type { CanvasNode } from \"./CanvasNode.ts\"\nimport { RawControlPropsCache } from \"./RawControlPropsCache.ts\"\nimport { isExternalModuleNode } from \"./utils/nodeCheck.ts\"\n\nexport class CodeComponentNodeCache extends RawControlPropsCache {\n\tprivate arraySourceCache: ArraySourceVariableProviderCache | undefined\n\n\t/**\n\t * VariantDetails cache that is based on the activeBundleHash\n\t */\n\tdeclare variantDetails: VariantDetails\n\tdeclare activeBundleHash: string\n\n\tprivate getArraySourceCache(): ArraySourceVariableProviderCache {\n\t\treturn (this.arraySourceCache ??= new ArraySourceVariableProviderCache())\n\t}\n\n\tgetVariantDetails(activeBundleHash?: string): VariantDetails | undefined {\n\t\tif (this.activeBundleHash !== activeBundleHash) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn this.variantDetails\n\t}\n\n\tsetVariantDetails(variantDetails: VariantDetails, activeBundleHash: string) {\n\t\tthis.activeBundleHash = activeBundleHash\n\t\tthis.variantDetails = variantDetails\n\t}\n\n\tprivate isVectorInstance: boolean | undefined\n\tprivate lastIdentifier: ModuleExportIdentifierString | undefined\n\n\t/**\n\t * Returns true if the identifier is a vector instance, caching the result until the identifier\n\t * changes.\n\t */\n\tgetIsVectorInstance(identifier: ModuleExportIdentifierString, tree: CanvasTree | undefined): boolean {\n\t\tif (this.lastIdentifier === identifier && isBoolean(this.isVectorInstance)) return this.isVectorInstance\n\n\t\tthis.lastIdentifier = identifier\n\t\tconst parsed = parseModuleIdentifier(identifier)\n\n\t\tswitch (parsed.kind) {\n\t\t\tcase \"localModuleExport\":\n\t\t\t\treturn (this.isVectorInstance = parsed.type === ModuleType.Vector)\n\t\t\tcase \"externalModuleExport\":\n\t\t\t\tif (!tree) return false\n\t\t\t\treturn (this.isVectorInstance =\n\t\t\t\t\ttree.getNodeWithTrait(parsed.moduleId, isExternalModuleNode)?.type === ModuleType.Vector)\n\t\t\tdefault:\n\t\t\t\tassertNever(parsed)\n\t\t}\n\t}\n\n\tgetArraySourceVariableMap(\n\t\tnode: CanvasNode,\n\t\ttree: CanvasTree,\n\t\tchild: CanvasNode | undefined,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tdataRepeaterArray: VariableReference,\n\t\tcomponentLoaderHash: string | undefined,\n\t): VariableProviderVariableMap | undefined {\n\t\treturn this.getArraySourceCache().getArraySourceVariableMap(\n\t\t\tnode,\n\t\t\ttree,\n\t\t\tchild,\n\t\t\tcomponentLoader,\n\t\t\tdataRepeaterArray,\n\t\t\tcomponentLoaderHash,\n\t\t)\n\t}\n\n\tgetArraySourceValueMap(\n\t\tnode: CanvasNode,\n\t\ttree: CanvasTree,\n\t\tchild: CanvasNode | undefined,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tdataRepeaterArray: VariableReference,\n\t\tsandboxRepeaterData: SandboxRepeaterData,\n\t\tcomponentLoaderHash: string | undefined,\n\t): VariableProviderValueMap | undefined {\n\t\treturn this.getArraySourceCache().getArraySourceValueMap(\n\t\t\tnode,\n\t\t\ttree,\n\t\t\tchild,\n\t\t\tcomponentLoader,\n\t\t\tdataRepeaterArray,\n\t\t\tsandboxRepeaterData,\n\t\t\tcomponentLoaderHash,\n\t\t)\n\t}\n\n\tgetArraySourceVariableControlMap(\n\t\tnode: CanvasNode,\n\t\ttree: CanvasTree,\n\t\tchild: CanvasNode | undefined,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tdataRepeaterArray: VariableReference,\n\t\tcomponentLoaderHash: string | undefined,\n\t): VariableProviderControlMap | undefined {\n\t\treturn this.getArraySourceCache().getArraySourceVariableControlMap(\n\t\t\tnode,\n\t\t\ttree,\n\t\t\tchild,\n\t\t\tcomponentLoader,\n\t\t\tdataRepeaterArray,\n\t\t\tcomponentLoaderHash,\n\t\t)\n\t}\n}\n", "import type { AnyComponentLoader, ComponentLoader } from \"@framerjs/framer-runtime\"\nimport { AnnotationKey, SupportedLayoutOption, prefersAutoSizing } from \"@framerjs/framer-runtime/crossorigin\"\nimport {\n\ttype ModuleExportIdentifierString,\n\tassert,\n\tgetLogger,\n\tisEmptyObject,\n\tisModuleExportIdentifier,\n\tisModuleIdentifier,\n} from \"@framerjs/shared\"\nimport type { SerializableMotionStyle, VariantSize } from \"code-generation/types.ts\"\nimport type { SupportedLayoutOptions } from \"code-generation/utils/annotations.ts\"\nimport { parseSupportedLayoutFromAnnotations } from \"code-generation/utils/annotations.ts\"\nimport type { CollectorContext } from \"code-generation/utils/collector.ts\"\nimport type { VariantData, VariantDetails } from \"code-generation/variantDetails.ts\"\nimport { dimensionTypeFromString, isVariantDetails } from \"code-generation/variantDetails.ts\"\nimport type { SandboxRepeaterData } from \"document/SandboxRepeaterData.ts\"\nimport type { CanvasTree, OverlayNode } from \"document/models/CanvasTree/index.ts\"\nimport type { WithBorder } from \"document/models/CanvasTree/traits/WithBorder.ts\"\nimport type { WithBoxShadow } from \"document/models/CanvasTree/traits/WithBoxShadow.ts\"\nimport type { WithExport } from \"document/models/CanvasTree/traits/WithExport.ts\"\nimport type {\n\tFillImagePositionX,\n\tFillImagePositionY,\n\tFillImageType,\n\tFillType,\n\tWithFill,\n\tWithOptionalFill,\n} from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport type { WithFilters } from \"document/models/CanvasTree/traits/WithFilters.ts\"\nimport type { WithIntrinsicSize } from \"document/models/CanvasTree/traits/WithIntrinsicSize.ts\"\nimport type { WithLock } from \"document/models/CanvasTree/traits/WithLock.ts\"\nimport type { WithName } from \"document/models/CanvasTree/traits/WithName.ts\"\nimport type { WithRelativeRadius } from \"document/models/CanvasTree/traits/WithRadius.ts\"\nimport type { WithRadiusPerCorner } from \"document/models/CanvasTree/traits/WithRadiusPerCorner.ts\"\nimport type { WithRotation } from \"document/models/CanvasTree/traits/WithRotation.ts\"\nimport type { WithVisibility } from \"document/models/CanvasTree/traits/WithVisibility.ts\"\nimport { withDOMLayoutTrait } from \"document/models/CanvasTree/traits/mixins/withDOMLayoutTrait.ts\"\nimport { borderPropsForNode } from \"document/models/CanvasTree/traits/utils/borderForNode.ts\"\nimport { collectNameForNode } from \"document/models/CanvasTree/traits/utils/collectNameForNode.ts\"\nimport { ALL_BUILT_IN_IDENTIFIERS } from \"document/models/CanvasTree/traits/utils/hardCodedCodeComponentIdentifiers.ts\"\nimport { updateConstrainedFrame, updateConstrainedSize } from \"document/models/ConstraintSolver.ts\"\nimport type { ConicGradient, LinearGradient, RadialGradient } from \"document/models/Gradient.ts\"\nimport type { BoxShadow } from \"document/models/Shadow.ts\"\nimport type { Transition } from \"document/models/Transition.ts\"\nimport type { ControlProp, ControlProps, EnumControlPropValue } from \"document/models/controlProps/ControlProp.ts\"\nimport { prefixControlPropKey, prefixControlProps } from \"document/models/controlProps/controlPropKey.ts\"\nimport { linkSlotContentChanges } from \"document/models/controlProps/linkSlotContentChanges.ts\"\nimport type { ScrollDirection } from \"library/modules/createTransformInputRange.ts\"\nimport type { LayerProps } from \"library/render/presentation/Layer.tsx\"\nimport type { BorderStyle } from \"library/render/style/BorderComponent.tsx\"\nimport type { DeprecatedVisualProperties } from \"library/render/style/collectVisualStyleFromProps.ts\"\nimport type { BlendingMode } from \"library/render/traits/Blending.ts\"\nimport type { ImageFit } from \"library/render/types/BackgroundImage.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { RenderTarget } from \"library/render/types/RenderEnvironment.ts\"\nimport type { Size } from \"library/render/types/Size.ts\"\nimport type { Locale } from \"library/router/types.ts\"\nimport type { PreviewSettings } from \"preview-module/utils/PreviewSettings.ts\"\nimport type { ComponentContainerProperties } from \"renderer/ComponentContainer.tsx\"\nimport type { AssetResolverWithHash } from \"renderer/getAssetResolver.ts\"\nimport type { Mutable } from \"utils/Mutable.ts\"\nimport { deepClone } from \"utils/deepClone.ts\"\nimport { isNumber, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { withClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport { getCodeComponentRecord } from \"../records/CodeComponentRecord.ts\"\nimport type { DynamicValue } from \"../traits/DynamicValue.ts\"\nimport type { FetchDataValueResolver } from \"../traits/FetchDataValue.ts\"\nimport type { Generated } from \"../traits/Generated.ts\"\nimport type {\n\tCombinedVariableProviderValueMap,\n\tVariableProviderControlMap,\n\tVariableProviderValueMap,\n\tVariableProviderVariableMap,\n} from \"../traits/VariableProvider.ts\"\nimport type { VariableReference } from \"../traits/VariableReference.ts\"\nimport type { WithBlending } from \"../traits/WithBlending.ts\"\nimport type { WithChildren } from \"../traits/WithChildren.ts\"\nimport type { WithCodeComponent } from \"../traits/WithCodeComponent.ts\"\nimport type { WithCodeOverride } from \"../traits/WithCodeOverride.ts\"\nimport type { WithControlProps } from \"../traits/WithControlProps.ts\"\nimport type { CSSCursor, CustomCursorType, WithCursor } from \"../traits/WithCursor.ts\"\nimport type { Customization, WithCustomizations } from \"../traits/WithCustomizations.ts\"\nimport type { WithDataLoaderVariants } from \"../traits/WithDataLoaderVariants.ts\"\nimport type { WithDragEffect } from \"../traits/WithDragEffect.ts\"\nimport type { WithDraggable } from \"../traits/WithDraggable.ts\"\nimport type { EventActionMap, WithEventActions } from \"../traits/WithEventActions.ts\"\nimport type { FloatingAlignment, FloatingPlacement, WithFloatingPosition } from \"../traits/WithFloatingPosition.ts\"\nimport { getFloatingPositionProps, hasFloatingPosition } from \"../traits/WithFloatingPosition.ts\"\nimport type { WithFormVariants } from \"../traits/WithFormVariants.ts\"\nimport type { WithKitSectionHash } from \"../traits/WithKitSectionHash.ts\"\nimport type { KitSectionSource, WithKitSectionSource } from \"../traits/WithKitSectionSource.ts\"\nimport type { LoopEffectRepeatType, WithLoopEffect } from \"../traits/WithLoopEffect.ts\"\nimport type { Mask, WithMasks } from \"../traits/WithMasks.ts\"\nimport type { WithOpacity } from \"../traits/WithOpacity.ts\"\nimport type { WithParallax } from \"../traits/WithParallax.ts\"\nimport type { PluginDataValue, PrefixedPluginDataKey, WithPluginData } from \"../traits/WithPluginData.ts\"\nimport type { PointerEventsValue, WithPointerEvents } from \"../traits/WithPointerEvents.ts\"\nimport type { PositionType, WithPositionType } from \"../traits/WithPositionType.ts\"\nimport type { WithPreviewSettings } from \"../traits/WithPreviewSettings.ts\"\nimport type { ParentSizeInfo, UpdateForRectOptions, WithRect } from \"../traits/WithRect.ts\"\nimport type { WithRepeatArray } from \"../traits/WithRepeatArray.ts\"\nimport type { WithScrollTarget } from \"../traits/WithScrollTarget.ts\"\nimport type { WithSizeConstraints } from \"../traits/WithSizeConstraints.ts\"\nimport type { StyleAppearEffectTrigger, WithStyleAppearEffect } from \"../traits/WithStyleAppearEffect.ts\"\nimport type {\n\tEffectStyleScrollTarget,\n\tStyleTransformEffectTrigger,\n\tWithStyleTransformEffect,\n} from \"../traits/WithStyleTransformEffect.ts\"\nimport { isReplicaChild, isReplicaOrReplicaChild } from \"../traits/WithTemplate.ts\"\nimport type { TokenOverrides, WithTokenOverrides } from \"../traits/WithTokenOverrides.ts\"\nimport type { WithTransforms } from \"../traits/WithTransforms.ts\"\nimport type { WithTransition } from \"../traits/WithTransition.ts\"\nimport type { WithTriggerActions } from \"../traits/WithTriggerActions.ts\"\nimport type { UserSelectValue, WithUserSelect } from \"../traits/WithUserSelect.ts\"\nimport type { WithVariableProvider } from \"../traits/WithVariableProvider.ts\"\nimport type {\n\tEffectVariantScrollTarget,\n\tVariantAppearEffectTrigger,\n\tWithVariantAppearEffect,\n} from \"../traits/WithVariantAppearEffect.ts\"\nimport type { WithViewTransitionNone } from \"../traits/WithViewTransitionNone.ts\"\nimport type { WithWhileHover } from \"../traits/WithWhileHover.ts\"\nimport type { WithWhileOpenEffect } from \"../traits/WithWhileOpenEffect.ts\"\nimport type { WithWhileTap } from \"../traits/WithWhileTap.ts\"\nimport type { WithZIndex } from \"../traits/WithZIndex.ts\"\nimport { collectCanvasFloatingPosition } from \"../traits/collectProps/collectCanvasFloatingPosition.ts\"\nimport { collectGroundNodeLayout } from \"../traits/collectProps/collectGroundNodeLayout.ts\"\nimport { collectMasks } from \"../traits/collectProps/collectMasks.ts\"\nimport { collectPositionType } from \"../traits/collectProps/collectPositionType.ts\"\nimport { collectAspectRatioProps } from \"../traits/collectStyles/collectAspectRatio.ts\"\nimport { collectBlending } from \"../traits/collectStyles/collectBlending.ts\"\nimport { collectEphemeralEffectPreviewStyle } from \"../traits/collectStyles/collectEphemeralEffectPreviewStyle.ts\"\nimport { collectFilters } from \"../traits/collectStyles/collectFilters.ts\"\nimport { collectGridItemLayout } from \"../traits/collectStyles/collectGridItemLayout.ts\"\nimport { collectMoveToolRootFontSize } from \"../traits/collectStyles/collectMoveToolRootFontSize.ts\"\nimport { collectOpacity } from \"../traits/collectStyles/collectOpacity.ts\"\nimport { collectPointerEvents } from \"../traits/collectStyles/collectPointerEvents.ts\"\nimport { collectRotate } from \"../traits/collectStyles/collectRotate.ts\"\nimport { collectSizeConstraints } from \"../traits/collectStyles/collectSizeConstraints.ts\"\nimport {\n\tcleanupFramePropsForStackItemLayoutStyle,\n\tcollectPositionRelative,\n\tcollectStackItemLayout,\n} from \"../traits/collectStyles/collectStackItemLayout.ts\"\nimport { collectStyle } from \"../traits/collectStyles/collectStyle.ts\"\nimport { collectTokenOverrides } from \"../traits/collectStyles/collectTokenOverrides.ts\"\nimport { collectTransforms } from \"../traits/collectStyles/collectTransforms.ts\"\nimport { collectZIndex } from \"../traits/collectStyles/collectZIndex.ts\"\nimport { with3DTransformsTrait } from \"../traits/mixins/with3DTransformsTrait.ts\"\nimport {\n\tgetHumanReadableKey,\n\tgetHumanReadableReactPropMap,\n\twithControlPropsTrait,\n} from \"../traits/mixins/withControlPropsTrait.ts\"\nimport { withPinsSizeRatioConstraints } from \"../traits/mixins/withPinsSizeRatioConstraints.ts\"\nimport type { ResolvedCollectionItemSelector } from \"../traits/utils/ResolvedCollectionItemSelector.ts\"\nimport type { VekterConstraintValues } from \"../traits/utils/VekterConstraintValues.ts\"\nimport { collectBackgroundPropsForNode } from \"../traits/utils/collectBackgroundForNode.ts\"\nimport { getArrayProviderNodeInAncestorScope } from \"../traits/utils/getArrayProviderNodeInAncestorScope.ts\"\nimport { isStylableNode } from \"../traits/utils/hardCodedCodeComponentIdentifierChecks.ts\"\nimport { getStyleForSupportedLayout } from \"../utils/getStyleForSupportedLayout.ts\"\nimport { CanvasNode } from \"./CanvasNode.ts\"\nimport type { ChildList } from \"./ChildList.ts\"\nimport { CodeComponentNodeCache } from \"./CodeComponentNodeCache.ts\"\nimport type { ExportOptions } from \"./ExportOptions.ts\"\nimport { setDefaults } from \"./MutableNode.ts\"\nimport type { NodeID } from \"./NodeID.ts\"\nimport type { SlotPropertyNode } from \"./SlotPropertyNode.ts\"\nimport { moduleIdentifierToLocalComponentId } from \"./utils/moduleIdentifierToLocalComponentId.ts\"\n\nconst log = getLogger(\"CodeComponentNode\")\n\n/** Code components have an optional preferred size that is either fixed or auto. */\ninterface PreferredSize {\n\twidth: \"auto\" | number | null\n\theight: \"auto\" | number | null\n}\n\ntype CodeComponentNodeProps = Partial<ComponentContainerProperties> & { style: SerializableMotionStyle }\n\nexport type CodeComponentNodeChild = OverlayNode | (CanvasNode & WithFloatingPosition) | SlotPropertyNode\n\n/**\n * A node that renders a module that can be either an exported React component from code or a SmartComponent.\n * The module can either be local to the project or external.\n */\n// biome-ignore lint/style/noDefaultExport: needed here\nexport default class CodeComponentNode\n\textends withClassDiscriminator(\n\t\t\"CodeComponentNode\",\n\t\twithControlPropsTrait(withDOMLayoutTrait(with3DTransformsTrait(withPinsSizeRatioConstraints(CanvasNode)))),\n\t)\n\timplements\n\t\tWithBlending,\n\t\tWithBorder,\n\t\tWithBoxShadow,\n\t\tWithChildren<CodeComponentNodeChild>,\n\t\tWithCodeComponent,\n\t\tWithControlProps,\n\t\tWithCodeOverride,\n\t\tWithTokenOverrides,\n\t\tWithCursor,\n\t\tWithCustomizations,\n\t\tWithKitSectionHash,\n\t\tWithKitSectionSource,\n\t\tWithDraggable,\n\t\tWithDragEffect,\n\t\tWithEventActions,\n\t\tWithExport,\n\t\tWithFill,\n\t\tWithFilters,\n\t\tWithFloatingPosition,\n\t\tWithFormVariants,\n\t\tWithDataLoaderVariants,\n\t\tWithIntrinsicSize,\n\t\tWithLock,\n\t\tWithLoopEffect,\n\t\tWithMasks,\n\t\tWithName,\n\t\tWithOpacity,\n\t\tWithOptionalFill,\n\t\tWithParallax,\n\t\tWithPointerEvents,\n\t\tWithPluginData,\n\t\tWithPositionType,\n\t\tWithPreviewSettings,\n\t\tWithRadiusPerCorner,\n\t\tWithRect,\n\t\tWithRelativeRadius,\n\t\tWithRepeatArray,\n\t\tWithRotation,\n\t\tWithScrollTarget,\n\t\tWithStyleAppearEffect,\n\t\tWithStyleTransformEffect,\n\t\tWithTransforms,\n\t\tWithTransition,\n\t\tWithTriggerActions,\n\t\tWithUserSelect,\n\t\tWithVariantAppearEffect,\n\t\tWithViewTransitionNone,\n\t\tWithVariableProvider,\n\t\tWithVisibility,\n\t\tWithWhileHover,\n\t\tWithWhileOpenEffect,\n\t\tWithWhileTap,\n\t\tWithZIndex\n{\n\t[key: PrefixedPluginDataKey]: PluginDataValue | undefined\n\n\tdeclare cache: CodeComponentNodeCache\n\n\tdeclare children: ChildList<CodeComponentNodeChild>\n\n\tdeclare name: string | Generated<string> | null\n\tdeclare visible: boolean | DynamicValue\n\tdeclare locked: boolean | undefined\n\tdeclare previewSettings: PreviewSettings | null\n\n\tdeclare rotation: number | DynamicValue | undefined\n\tdeclare opacity: number | DynamicValue\n\n\tdeclare intrinsicWidth: number | null\n\tdeclare intrinsicHeight: number | null\n\n\tdeclare exportOptions: readonly ExportOptions[]\n\n\t/** Identifier that represents either a local or external module, built-in library component, legacy code component (deprecated) or package (deprecated). */\n\tdeclare codeComponentIdentifier: string\n\t/**\n\t * When a code component is a Vector module, the vector can be a variable which can become any\n\t * vector from the set. Using a separate property than codeComponentIdentifier prevents having\n\t * to tackle existing assumptions that codeComponentIdentifier is always a static string.\n\t */\n\tdeclare dynamicVectorSetIdentifier: VariableReference | undefined\n\t/** @deprecated This field is not used anywhere but removing it would require a document version bump */\n\tdeclare codeComponentPackageVersion: string | null\n\n\tdeclare codeOverrideEnabled: boolean\n\tdeclare codeOverrideIdentifier: string | undefined\n\n\tdeclare position: PositionType\n\tdeclare positionStickyTop: number | undefined\n\tdeclare positionStickyRight: number | undefined\n\tdeclare positionStickyBottom: number | undefined\n\tdeclare positionStickyLeft: number | undefined\n\n\tdeclare fillEnabled: boolean\n\tdeclare fillType: FillType\n\tdeclare fillColor: string | DynamicValue\n\tdeclare fillLinearGradient: LinearGradient | undefined\n\tdeclare fillRadialGradient: RadialGradient | undefined\n\tdeclare fillConicGradient: ConicGradient | undefined\n\tdeclare fillImage: FillImageType\n\tdeclare fillImageOriginalName: string | null\n\tdeclare fillImageResize: ImageFit\n\tdeclare fillImagePixelWidth: number | null\n\tdeclare fillImagePixelHeight: number | null\n\tdeclare fillImagePositionX: FillImagePositionX | undefined\n\tdeclare fillImagePositionY: FillImagePositionY | undefined\n\tdeclare fillImageTileSize: number | undefined\n\n\tdeclare blur: number | DynamicValue | undefined\n\tdeclare backgroundBlur: number | DynamicValue | undefined\n\tdeclare brightness: number | DynamicValue | undefined\n\tdeclare contrast: number | DynamicValue | undefined\n\tdeclare grayscale: number | DynamicValue | undefined\n\tdeclare hueRotate: number | DynamicValue | undefined\n\tdeclare invert: number | DynamicValue | undefined\n\tdeclare saturate: number | DynamicValue | undefined\n\tdeclare sepia: number | DynamicValue | undefined\n\n\tdeclare radiusPerCorner: boolean\n\tdeclare radius: number | DynamicValue | undefined\n\tdeclare radiusIsRelative: boolean\n\tdeclare radiusTopLeft: number\n\tdeclare radiusTopRight: number\n\tdeclare radiusBottomLeft: number\n\tdeclare radiusBottomRight: number\n\n\tdeclare borderEnabled: boolean | DynamicValue | undefined\n\tdeclare borderColor: string | undefined\n\tdeclare borderWidth: number | undefined\n\tdeclare borderStyle: BorderStyle | undefined\n\tdeclare borderPerSide: boolean | undefined\n\tdeclare borderTop: number | undefined\n\tdeclare borderRight: number | undefined\n\tdeclare borderBottom: number | undefined\n\tdeclare borderLeft: number | undefined\n\n\tdeclare boxShadows: readonly BoxShadow[] | DynamicValue | undefined\n\n\tdeclare parallaxEnabled: boolean | undefined\n\tdeclare parallaxSpeed: number | undefined\n\tdeclare parallaxAdjustPosition: boolean | undefined\n\tdeclare parallaxOffset: number | undefined\n\n\tdeclare appearEffectEnabled: boolean | undefined\n\tdeclare appearEffectVisibleVariantId: string | undefined\n\tdeclare appearEffectObscuredVariantId: string | undefined\n\tdeclare appearEffectThreshold: number | undefined\n\tdeclare appearEffectAnimateOnce: boolean | undefined\n\tdeclare appearEffectTrigger: VariantAppearEffectTrigger | undefined\n\tdeclare appearEffectScrollTargets: EffectVariantScrollTarget[] | undefined\n\tdeclare appearEffectScrollDirection: ScrollDirection | undefined\n\tdeclare appearEffectScrollDirectionTarget: string | undefined\n\n\tdeclare styleAppearEffectEnabled: boolean | undefined\n\tdeclare styleAppearEffectThreshold: number | undefined\n\tdeclare styleAppearEffectAnimateOnce: boolean | undefined\n\tdeclare styleAppearEffectOpacity: number | undefined\n\tdeclare styleAppearEffectX: number | undefined\n\tdeclare styleAppearEffectY: number | undefined\n\tdeclare styleAppearEffectScale: number | undefined\n\tdeclare styleAppearEffectRotate: number | undefined\n\tdeclare styleAppearEffectRotateX: number | undefined\n\tdeclare styleAppearEffectRotateY: number | undefined\n\tdeclare styleAppearEffectPerspective: number | undefined\n\tdeclare styleAppearEffectTransition: Transition | undefined\n\tdeclare styleAppearEffectLocked: boolean | undefined\n\tdeclare styleAppearEffectTrigger: StyleAppearEffectTrigger | undefined\n\tdeclare styleAppearEffectScrollTarget: NodeID | VariableReference | undefined\n\tdeclare styleAppearEffectScrollTargetCollectionItem: VariableReference | ResolvedCollectionItemSelector | undefined\n\tdeclare styleAppearEffectScrollDirection: ScrollDirection | undefined\n\n\tdeclare styleTransformEffectEnabled: boolean | undefined\n\tdeclare styleTransformEffectViewportThreshold: number | undefined\n\tdeclare styleTransformEffectTrigger: StyleTransformEffectTrigger | undefined\n\tdeclare styleTransformEffectScrollTargets: EffectStyleScrollTarget[] | undefined\n\tdeclare styleTransformEffectTransition: Transition | undefined\n\tdeclare styleTransformEffectTransitionEnabled: boolean | undefined\n\n\tdeclare exitEffectEnabled: boolean | undefined\n\tdeclare exitEffectOpacity: number | undefined\n\tdeclare exitEffectX: number | undefined\n\tdeclare exitEffectY: number | undefined\n\tdeclare exitEffectScale: number | undefined\n\tdeclare exitEffectRotate3d: boolean | undefined\n\tdeclare exitEffectRotate: number | undefined\n\tdeclare exitEffectRotateAdditiveDynamicValue: boolean | undefined\n\tdeclare exitEffectRotateX: number | undefined\n\tdeclare exitEffectRotateY: number | undefined\n\tdeclare exitEffectSkewX: number | undefined\n\tdeclare exitEffectSkewY: number | undefined\n\tdeclare exitEffectPerspective: number | undefined\n\tdeclare exitEffectTransition: Transition | undefined\n\n\tdeclare enterEffectEnabled: boolean | undefined\n\tdeclare enterEffectOpacity: number | undefined\n\tdeclare enterEffectX: number | undefined\n\tdeclare enterEffectY: number | undefined\n\tdeclare enterEffectScale: number | undefined\n\tdeclare enterEffectRotate3d: boolean | undefined\n\tdeclare enterEffectRotate: number | undefined\n\tdeclare enterEffectRotateAdditiveDynamicValue: boolean | undefined\n\tdeclare enterEffectRotateX: number | undefined\n\tdeclare enterEffectRotateY: number | undefined\n\tdeclare enterEffectSkewX: number | undefined\n\tdeclare enterEffectSkewY: number | undefined\n\tdeclare enterEffectPerspective: number | undefined\n\tdeclare enterEffectTransition: Transition | undefined\n\n\tdeclare dragEffectEnabled: boolean | undefined\n\tdeclare dragEffectFreeform: boolean | undefined\n\tdeclare dragEffectSnapBack: boolean | undefined\n\tdeclare dragEffectMomentum: boolean | undefined\n\tdeclare dragEffectConstraintElement: NodeID | undefined\n\tdeclare dragEffectConstraintItem: ResolvedCollectionItemSelector | VariableReference | undefined\n\tdeclare dragEffectTransition: Transition | undefined\n\n\tdeclare loopEffectEnabled: boolean | undefined\n\tdeclare loopEffectRepeatDelay: number | undefined\n\tdeclare loopEffectRepeatType: LoopEffectRepeatType | undefined\n\tdeclare loopEffectOpacity: number | undefined\n\tdeclare loopEffectX: number | undefined\n\tdeclare loopEffectY: number | undefined\n\tdeclare loopEffectScale: number | undefined\n\tdeclare loopEffectRotate3d: boolean | undefined\n\tdeclare loopEffectRotate: number | undefined\n\tdeclare loopEffectRotateX: number | undefined\n\tdeclare loopEffectRotateY: number | undefined\n\tdeclare loopEffectSkewX: number | undefined\n\tdeclare loopEffectSkewY: number | undefined\n\tdeclare loopEffectTransition: Transition | undefined\n\tdeclare loopEffectPauseOffscreen: boolean | undefined\n\n\tdeclare whileTapEnabled: boolean | undefined\n\tdeclare whileTapOpacity: number | undefined\n\tdeclare whileTapX: number | undefined\n\tdeclare whileTapY: number | undefined\n\tdeclare whileTapScale: number | undefined\n\tdeclare whileTapRotate3d: boolean | undefined\n\tdeclare whileTapRotate: number | undefined\n\tdeclare whileTapRotateAdditiveDynamicValue: boolean | undefined\n\tdeclare whileTapRotateX: number | undefined\n\tdeclare whileTapRotateY: number | undefined\n\tdeclare whileTapSkewX: number | undefined\n\tdeclare whileTapSkewY: number | undefined\n\tdeclare whileTapBackgroundColor: string | undefined\n\tdeclare whileTapBoxShadow: BoxShadow | undefined\n\tdeclare whileTapTransition: Transition | undefined\n\n\tdeclare whileHoverEnabled: boolean | undefined\n\tdeclare whileHoverOpacity: number | undefined\n\tdeclare whileHoverX: number | undefined\n\tdeclare whileHoverY: number | undefined\n\tdeclare whileHoverScale: number | undefined\n\tdeclare whileHoverRotate3d: boolean | undefined\n\tdeclare whileHoverRotate: number | undefined\n\tdeclare whileHoverRotateAdditiveDynamicValue: boolean | undefined\n\tdeclare whileHoverRotateX: number | undefined\n\tdeclare whileHoverRotateY: number | undefined\n\tdeclare whileHoverSkewX: number | undefined\n\tdeclare whileHoverSkewY: number | undefined\n\tdeclare whileHoverBackgroundColor: string | undefined\n\tdeclare whileHoverBoxShadow: BoxShadow | undefined\n\tdeclare whileHoverTransition: Transition | undefined\n\n\tdeclare whileOpenEffectEnabled: boolean | undefined\n\tdeclare whileOpenEffectVariant: NodeID | undefined\n\n\tdeclare elementId: string | undefined\n\tdeclare scrollMarginTop: number | undefined\n\tdeclare scrollTargetEnabled: boolean | undefined\n\n\tdeclare pointerEvents: PointerEventsValue | DynamicValue | undefined\n\tdeclare zIndex: number | DynamicValue | undefined\n\tdeclare blendingMode: BlendingMode | DynamicValue | undefined\n\tdeclare cursor: CSSCursor | DynamicValue | undefined\n\n\tdeclare userSelect: UserSelectValue | DynamicValue | undefined\n\n\tdeclare draggable: boolean | DynamicValue | undefined\n\n\tdeclare customCursorSmartComponentId: NodeID | undefined\n\tdeclare customCursorType: CustomCursorType | VariableReference | undefined\n\tdeclare customCursorFollow: boolean | undefined\n\tdeclare customCursorOffsetX: number | undefined\n\tdeclare customCursorOffsetY: number | undefined\n\tdeclare customCursorVariant: string | undefined\n\tdeclare customCursorTransitionEnabled: boolean | undefined\n\tdeclare customCursorTransition: Transition | undefined\n\tdeclare customCursorPlacement: FloatingPlacement | undefined\n\tdeclare customCursorAlignment: FloatingAlignment | undefined\n\n\tdeclare customizations: readonly Customization[] | undefined\n\tdeclare customizationsDescription: string | undefined\n\tdeclare customizationsSectionId: string | undefined\n\tdeclare customizationsCategory: string | Generated<string> | undefined\n\tdeclare customizationsRules: readonly string[] | undefined\n\tdeclare isApplyingCustomizations: true | undefined\n\tdeclare kitSectionSource: KitSectionSource | undefined\n\tdeclare kitSectionHash: number | undefined\n\n\tdeclare transition: Transition | DynamicValue | undefined\n\n\tdeclare floatingPositionEnabled: boolean | undefined\n\tdeclare floatingPlacement: FloatingPlacement | undefined\n\tdeclare floatingAlignment: FloatingAlignment | undefined\n\tdeclare floatingOffsetX: number | undefined\n\tdeclare floatingOffsetY: number | undefined\n\tdeclare floatingSafeArea: boolean | undefined\n\tdeclare floatingCollisionDetection: boolean | undefined\n\tdeclare floatingCollisionPadding: number | undefined\n\n\tdeclare masks: readonly Mask[] | undefined\n\n\tdeclare formButtonSuccessVariantEnabled: boolean | undefined\n\tdeclare formButtonSuccessVariant: string | undefined\n\tdeclare formButtonPendingVariantEnabled: boolean | undefined\n\tdeclare formButtonPendingVariant: string | undefined\n\tdeclare formButtonErrorVariantEnabled: boolean | undefined\n\tdeclare formButtonErrorVariant: string | undefined\n\tdeclare formButtonIncompleteVariantEnabled: boolean | undefined\n\tdeclare formButtonIncompleteVariant: string | undefined\n\n\tdeclare dataLoaderDisabledVariantEnabled: boolean | undefined\n\tdeclare dataLoaderDisabledVariant: string | undefined\n\tdeclare dataLoaderLoadingVariantEnabled: boolean | undefined\n\tdeclare dataLoaderLoadingVariant: string | undefined\n\n\tdeclare repeatArray: VariableReference | undefined\n\n\t// WithViewTransitionNone\n\tdeclare viewTransitionNone: boolean | undefined\n\n\tdeclare slotsAreChildNodes: boolean | undefined\n\n\tdeclare tokenOverrides: TokenOverrides | undefined\n\n\tdeclare triggerActions: WithTriggerActions[\"triggerActions\"]\n\n\tconstructor(properties?: Partial<CodeComponentNode>, cache: CodeComponentNodeCache = new CodeComponentNodeCache()) {\n\t\tsuper(properties, cache)\n\t\tsetDefaults<CodeComponentNode>(this, getCodeComponentRecord(), properties)\n\t}\n\n\toverride updateForRect({\n\t\trect,\n\t\tparentSizeInfo,\n\t\tconstraintsLocked,\n\t\tshouldGuessPinToBottom,\n\t\tshouldGuessPinToRight,\n\t\tupdateSize,\n\t}: UpdateForRectOptions) {\n\t\treturn updateConstrainedFrame({\n\t\t\trect,\n\t\t\tparentSizeInfo,\n\t\t\tcurrentConstraints: this.constraints(),\n\t\t\tconstraintsLocked,\n\t\t\tpixelAlign: this.__unsafeIsGroundNode() || !this.usesDOMRectCached(),\n\t\t\tshouldGuessPinToBottom,\n\t\t\tshouldGuessPinToRight,\n\t\t\tupdateSize,\n\t\t\tfloatingPosition: hasFloatingPosition(this) ? getFloatingPositionProps(this) : null,\n\t\t})\n\t}\n\n\toverride updateForSize(size: Partial<Size>, parentSizeInfo: ParentSizeInfo | null): Partial<VekterConstraintValues> {\n\t\treturn updateConstrainedSize(size, parentSizeInfo, this.constraintValues())\n\t}\n\n\toverride getControlPropSourceIdentifier(): string {\n\t\treturn this.codeComponentIdentifier\n\t}\n\n\tsetControlPropIgnoringReplicas(propKey: string, value: ControlProp): void {\n\t\t// @ts-expect-error Control props do not exist in node\n\t\tthis.setProp(prefixControlPropKey(propKey), value)\n\t}\n\n\t// TODO: cache code component props\n\tgetCodeComponentProps(\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tassetResolverWithHash: AssetResolverWithHash | null = null,\n\t\tvariableOverrides?: CombinedVariableProviderValueMap,\n\t\tactiveLocale?: Locale,\n\t\tgetResolvedFetchDataValue?: FetchDataValueResolver,\n\t) {\n\t\tconst controlPropValues = this.getResolvedControlPropValues(\n\t\t\tcomponentLoader,\n\t\t\tassetResolverWithHash,\n\t\t\tvariableOverrides,\n\t\t\tactiveLocale,\n\t\t\tgetResolvedFetchDataValue,\n\t\t)\n\n\t\tconst customCodeComponentProps = mapVariableProps(componentLoader, this.codeComponentIdentifier, controlPropValues)\n\t\t// Because customCodeComponentProps are cached, we would be modifying\n\t\t// that cache if we do not copy the object here\n\t\tconst codeComponentProps: { [key: string]: unknown } = { ...customCodeComponentProps }\n\n\t\tif (RenderTarget.current() === RenderTarget.export) {\n\t\t\t// FIXME: Get rid of this when exporting stops using\n\t\t\t// `renderToStaticMarkup`.\n\t\t\t//\n\t\t\t// We'd usually use the `withMeasuredSize` HOC to provide a width\n\t\t\t// and height to code components. This approach doesn't work when\n\t\t\t// exporting from the desktop app, because exporting uses\n\t\t\t// `renderToStaticMarkup`, which doesn't run layout effects. This\n\t\t\t// means that we can't really provide a proper size to code\n\t\t\t// components that expect it. The code below tries to reduce the\n\t\t\t// number of cases in which we pass in a default size by at least\n\t\t\t// passing in a width and height if it's a fixed number. These sizes\n\t\t\t// will then be picked up by the `withMeasuredSize` wrapper and\n\t\t\t// forwarded to the component.\n\t\t\tif (this.widthType === DimensionType.FixedNumber) {\n\t\t\t\tcodeComponentProps.width = this.width\n\t\t\t}\n\n\t\t\tif (this.heightType === DimensionType.FixedNumber) {\n\t\t\t\tcodeComponentProps.height = this.height\n\t\t\t}\n\t\t}\n\n\t\tconst style = getStyleForSupportedLayout(this, componentLoader)\n\t\tif (style) {\n\t\t\tcollectPointerEvents(this, style, { componentLoader, variableOverrides })\n\t\t}\n\n\t\tif (isStylableNode(this)) {\n\t\t\t// Pass in the existing style here so we don't override it in\n\t\t\t// getStylingProps\n\t\t\tObject.assign(codeComponentProps, this.getStylingProps(componentLoader, style))\n\t\t} else if (isObject(style) && Object.keys(style).length > 0) {\n\t\t\tcodeComponentProps.style = style\n\t\t}\n\n\t\treturn codeComponentProps\n\t}\n\n\tgetStylingProps(\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tcomponentStyle: SerializableMotionStyle = {},\n\t\tincludeStyle: boolean = true,\n\t) {\n\t\tconst stylingProps: any = {}\n\t\tconst collectStyleTarget: DeprecatedVisualProperties = {}\n\t\tcollectBackgroundPropsForNode(this, collectStyleTarget, true)\n\t\t// We do not collect opacity and rotation because it is already applied\n\t\t// to the container (see CodeComponentNode.getProps())\n\t\tstylingProps.background = collectStyleTarget.background\n\t\tstylingProps._border = borderPropsForNode(this)\n\t\tif (includeStyle) {\n\t\t\tcollectStyle(this, componentStyle, { componentLoader, excludeOpacity: true, excludeRotation: true })\n\t\t\tstylingProps.style = componentStyle\n\t\t}\n\t\treturn stylingProps\n\t}\n\n\toverride getProps(\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tvariableOverrides?: CombinedVariableProviderValueMap,\n\t): Partial<ComponentContainerProperties> & LayerProps {\n\t\t// Ensure that we don't override display to undefined, which would cause\n\t\t// `<FrameWithMotion>` to drop display: block from its styles.\n\t\tconst style: React.CSSProperties = { display: \"block\" }\n\t\tconst context: CollectorContext = { componentLoader, variableOverrides }\n\n\t\tconst props: CodeComponentNodeProps = {\n\t\t\t...super.getProps(componentLoader),\n\t\t\t...this.newConstraintProperties(),\n\t\t\tcomponentIdentifier: this.codeComponentIdentifier,\n\t\t\tvisible: this.resolveValue(\"visible\", variableOverrides),\n\t\t\tstyle,\n\t\t}\n\n\t\tif (this.__unsafeIsSlotPropertyChildNode()) {\n\t\t\tprops._constraints = undefined\n\t\t}\n\n\t\t// Override opacity for customization on canvas only\n\t\tif (this.isApplyingCustomizations) {\n\t\t\tstyle.opacity = 0.1\n\t\t} else {\n\t\t\tcollectOpacity(this, style, context)\n\t\t}\n\n\t\tcollectRotate(this, style, context)\n\t\tcollectFilters(this, style, context)\n\t\tcollectPositionType(this, props)\n\t\tcollectGroundNodeLayout(this, props)\n\t\tcollectNameForNode(this, props)\n\t\tcollectGridItemLayout(this, style, context)\n\t\tcollectZIndex(this, style, context)\n\t\tcollectBlending(this, style, context)\n\t\tcollectStackItemLayout(this, style, context)\n\t\tcollectPositionRelative(this, style, context)\n\t\tcollectSizeConstraints(this, style, context)\n\t\tcleanupFramePropsForStackItemLayoutStyle(style, props)\n\t\tcollectCanvasFloatingPosition(this, props, context)\n\t\tcollectTransforms(this, style, context)\n\t\tcollectMasks(this, style, context)\n\t\tcollectTokenOverrides(this, style, context)\n\n\t\tif (this.cache.isEffectPreview) collectEphemeralEffectPreviewStyle(this, style)\n\n\t\tcollectMoveToolRootFontSize(this, style)\n\n\t\tcollectAspectRatioProps(this, props, context)\n\n\t\treturn props\n\t}\n\n\tremoveNodeFromSlotContent(\n\t\tthis: CodeComponentNode,\n\t\ttree: CanvasTree,\n\t\tidToRemove: NodeID,\n\t\tcomponentLoader: AnyComponentLoader,\n\t) {\n\t\t// We don't support overrides for component instance properties. So we let the regular master replica logic handle this case.\n\t\tif (isReplicaOrReplicaChild(this)) return\n\n\t\tconst component = componentLoader.reactComponentForIdentifier(this.codeComponentIdentifier)\n\t\tif (!component) return\n\n\t\tconst controlProps = this.getControlProps(component.properties)\n\t\tconst update: Mutable<ControlProps> = {}\n\n\t\tfor (const controlKey in controlProps) {\n\t\t\tconst controlProp = controlProps[controlKey]\n\t\t\tif (controlProp?.type !== ControlType.Slot) continue\n\n\t\t\tconst containsNode = controlProp.value.some(slotItem => slotItem.reference === idToRemove)\n\t\t\tif (!containsNode) continue\n\n\t\t\tconst filteredNodeReferences = controlProp.value.filter(slotItem => slotItem.reference !== idToRemove)\n\t\t\tupdate[controlKey] = { type: ControlType.Slot, value: filteredNodeReferences }\n\t\t}\n\n\t\tif (isEmptyObject(update)) return\n\n\t\ttree.current(this)?.set(prefixControlProps(update))\n\t}\n\n\tisBuiltInComponent(): boolean {\n\t\treturn ALL_BUILT_IN_IDENTIFIERS.has(this.codeComponentIdentifier)\n\t}\n\n\tgetActions(componentLoader: AnyComponentLoader): EventActionMap {\n\t\tconst componentDefinition = componentLoader.reactComponentForIdentifier(this.codeComponentIdentifier)\n\t\tif (!componentDefinition) return {}\n\t\tif (!componentDefinition.properties) return {}\n\n\t\tconst actions: EventActionMap = {}\n\t\tconst keys = Object.keys(componentDefinition.properties)\n\t\tfor (let i = 0, il = keys.length; i < il; i++) {\n\t\t\tconst key = keys[i]\n\t\t\tif (isUndefined(key)) continue\n\n\t\t\tconst control = componentDefinition.properties[key]\n\t\t\tif (!control || control.type !== ControlType.EventHandler) continue\n\n\t\t\tconst controlProp = this.getRawControlProp(key)\n\t\t\tif (!controlProp) continue\n\t\t\tconst { value } = controlProp\n\t\t\tif (!Array.isArray(value) || value.length === 0) {\n\t\t\t\tactions[key] = undefined\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tactions[key] = deepClone(value)\n\t\t}\n\n\t\treturn mapVariableProps(componentLoader, this.codeComponentIdentifier, actions)\n\t}\n\n\tresetActions(componentLoader: AnyComponentLoader): void {\n\t\t/**\n\t\t * @TODO\n\t\t * No need for the component definition here since the control props\n\t\t * have a type.\n\t\t */\n\t\tconst componentDefinition = componentLoader.reactComponentForIdentifier(this.codeComponentIdentifier)\n\t\tif (!componentDefinition) return\n\t\tif (!componentDefinition.properties) return\n\n\t\tfor (const key in componentDefinition.properties) {\n\t\t\tconst control = componentDefinition.properties[key]\n\t\t\tif (!control || control.type !== ControlType.EventHandler) continue\n\t\t\tdelete this.asDraft()[prefixControlPropKey(key)]\n\t\t}\n\t}\n\n\tgetSupportedLayout(componentLoader: AnyComponentLoader) {\n\t\treturn getSupportedLayoutForCodeComponent(componentLoader, this.codeComponentIdentifier)\n\t}\n\n\t/** The intrinsic size is optional meta data that comes from the component definition. */\n\tgetIntrinsicSize(componentLoader: ComponentLoader): { width: number | null; height: number | null } {\n\t\tlet width: number | null = null\n\t\tlet height: number | null = null\n\n\t\tconst definition = componentLoader.reactComponentForIdentifier(this.codeComponentIdentifier)\n\t\tif (!definition) return { width, height }\n\n\t\tconst { annotations } = definition\n\t\tif (annotations) {\n\t\t\tconst intrinsicWidth = annotations[AnnotationKey.FramerIntrinsicWidth]\n\t\t\tif (intrinsicWidth) {\n\t\t\t\tconst parsedWidth = parseInt(intrinsicWidth, 10)\n\t\t\t\tif (isNumber(parsedWidth)) {\n\t\t\t\t\twidth = parsedWidth\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst intrinsicHeight = annotations[AnnotationKey.FramerIntrinsicHeight]\n\t\t\tif (intrinsicHeight) {\n\t\t\t\tconst parsedHeight = parseInt(intrinsicHeight, 10)\n\t\t\t\tif (isNumber(parsedHeight)) {\n\t\t\t\t\theight = parsedHeight\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst defaultProps = definition.defaultProps\n\t\tif (defaultProps) {\n\t\t\tif (!isNumber(width) && isNumber(defaultProps.width)) {\n\t\t\t\twidth = defaultProps.width\n\t\t\t}\n\t\t\tif (!isNumber(height) && isNumber(defaultProps.height)) {\n\t\t\t\theight = defaultProps.height\n\t\t\t}\n\t\t}\n\n\t\treturn { width, height }\n\t}\n\n\t/**\n\t * The preferred size is auto if the current variant or node supports it,\n\t * else we use the optional intrinsic (fixed) size.\n\t */\n\tgetPreferredSize(componentLoader: ComponentLoader): PreferredSize {\n\t\tlet { width, height }: PreferredSize = this.getIntrinsicSize(componentLoader)\n\n\t\tconst variantSize = this.getCurrentVariantSize(componentLoader)\n\t\tif (variantSize) {\n\t\t\tif (variantSize.widthType === DimensionType.Auto) {\n\t\t\t\twidth = \"auto\"\n\t\t\t}\n\t\t\tif (variantSize.heightType === DimensionType.Auto) {\n\t\t\t\theight = \"auto\"\n\t\t\t}\n\t\t} else {\n\t\t\tconst supportedLayout = this.getSupportedLayout(componentLoader)\n\t\t\tif (prefersAutoSizing(supportedLayout.width)) {\n\t\t\t\twidth = \"auto\"\n\t\t\t}\n\t\t\tif (prefersAutoSizing(supportedLayout.height)) {\n\t\t\t\theight = \"auto\"\n\t\t\t}\n\t\t}\n\n\t\treturn { width, height }\n\t}\n\n\t/** Check if the node its size is equal to the preferred size. */\n\thasPreferredSize(componentLoader: ComponentLoader): boolean {\n\t\tconst { width, height } = this.getPreferredSize(componentLoader)\n\n\t\tlet widthIsEqualToPreferred = true\n\t\tlet heightIsEqualToPreferred = true\n\n\t\tif (width === \"auto\") {\n\t\t\twidthIsEqualToPreferred = this.widthType === DimensionType.Auto\n\t\t} else if (isNumber(width)) {\n\t\t\twidthIsEqualToPreferred = this.widthType === DimensionType.FixedNumber && this.width === width\n\t\t}\n\t\tif (height === \"auto\") {\n\t\t\theightIsEqualToPreferred = this.heightType === DimensionType.Auto\n\t\t} else if (isNumber(width)) {\n\t\t\theightIsEqualToPreferred = this.heightType === DimensionType.FixedNumber && this.height === height\n\t\t}\n\t\treturn widthIsEqualToPreferred && heightIsEqualToPreferred\n\t}\n\n\tgetCurrentVariantData(componentLoader: ComponentLoader): VariantData | undefined {\n\t\tconst definition = componentLoader.reactComponentForIdentifier(this.codeComponentIdentifier)\n\t\tif (!definition) return\n\n\t\tconst cachedVariantDetails = this.cache.getVariantDetails(componentLoader.activeBundleHash)\n\t\tlet variantDetails: VariantDetails | undefined\n\n\t\tif (cachedVariantDetails) {\n\t\t\tvariantDetails = cachedVariantDetails\n\t\t} else {\n\t\t\tconst { annotations } = definition\n\t\t\tif (!annotations) return\n\n\t\t\tconst variantDetailsJSON = annotations[AnnotationKey.FramerCanvasComponentVariantDetails]\n\t\t\tif (!variantDetailsJSON) return\n\n\t\t\ttry {\n\t\t\t\tvariantDetails = JSON.parse(variantDetailsJSON)\n\t\t\t} catch (err) {\n\t\t\t\tlog.reportError(err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (!isVariantDetails(variantDetails)) return\n\t\t\tconst activeBundleHash = componentLoader.activeBundleHash\n\t\t\tassert(activeBundleHash, \"componentLoader.activeBundleHash should be set when it contains components\")\n\t\t\tthis.cache.setVariantDetails(variantDetails, activeBundleHash)\n\t\t}\n\n\t\tlet currentVariant: EnumControlPropValue | undefined\n\n\t\tconst controlProps = this.getControlProps(definition.properties)\n\t\tconst variantControlProp = controlProps[variantDetails.propertyName]\n\t\tif (variantControlProp && variantControlProp.type === ControlType.Enum) {\n\t\t\tcurrentVariant = variantControlProp.value\n\t\t}\n\n\t\tlet variantData = variantDetails.data.default\n\t\tif (isString(currentVariant) && !isUndefined(variantDetails.data[currentVariant])) {\n\t\t\tvariantData = variantDetails.data[currentVariant]\n\t\t}\n\n\t\treturn variantData\n\t}\n\n\tgetCurrentVariantSize(componentLoader: ComponentLoader): Pick<VariantSize, \"widthType\" | \"heightType\"> | undefined {\n\t\tconst variantData = this.getCurrentVariantData(componentLoader)\n\t\tif (!variantData?.layout) return\n\n\t\tconst widthTypeString = variantData.layout[0]\n\t\tconst heightTypeString = variantData.layout[1]\n\n\t\treturn {\n\t\t\twidthType: dimensionTypeFromString(widthTypeString),\n\t\t\theightType: dimensionTypeFromString(heightTypeString),\n\t\t}\n\t}\n\n\tgetCurrentVariantConstraints(componentLoader: ComponentLoader): WithSizeConstraints | undefined {\n\t\tconst variantData = this.getCurrentVariantData(componentLoader)\n\t\tif (!variantData?.constraints) return\n\n\t\tconst [minWidth, maxWidth, minHeight, maxHeight] = variantData.constraints\n\n\t\treturn {\n\t\t\tminWidth: minWidth ?? undefined,\n\t\t\tmaxWidth: maxWidth ?? undefined,\n\t\t\tminHeight: minHeight ?? undefined,\n\t\t\tmaxHeight: maxHeight ?? undefined,\n\t\t}\n\t}\n\n\tgetLocalSmartComponentNodeId(): string | null {\n\t\treturn moduleIdentifierToLocalComponentId(this.codeComponentIdentifier)\n\t}\n\n\t// Data source variables\n\n\tgetVariableSourceIdentifier(): ModuleExportIdentifierString | undefined {\n\t\tif (this.repeatArray) {\n\t\t\treturn this.getVariableSourceIdentifierFromArrayProvider(this.repeatArray)\n\t\t}\n\t}\n\n\tgetProvidedVariableMap(\n\t\tthis: CodeComponentNode,\n\t\ttree: CanvasTree,\n\t\tchild: CanvasNode | undefined,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tcomponentLoaderHash: string | undefined,\n\t): VariableProviderVariableMap | undefined {\n\t\tif (!this.repeatArray) return\n\n\t\treturn this.cache.getArraySourceVariableMap(\n\t\t\tthis,\n\t\t\ttree,\n\t\t\tchild,\n\t\t\tcomponentLoader,\n\t\t\tthis.repeatArray,\n\t\t\tcomponentLoaderHash,\n\t\t)\n\t}\n\n\tgetProvidedValueMap(\n\t\tthis: CodeComponentNode,\n\t\ttree: CanvasTree,\n\t\tchild: CanvasNode | undefined,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tsandboxRepeaterData: SandboxRepeaterData,\n\t\tcomponentLoaderHash: string | undefined,\n\t): VariableProviderValueMap | undefined {\n\t\tif (!this.repeatArray) return\n\n\t\treturn this.cache.getArraySourceValueMap(\n\t\t\tthis,\n\t\t\ttree,\n\t\t\tchild,\n\t\t\tcomponentLoader,\n\t\t\tthis.repeatArray,\n\t\t\tsandboxRepeaterData,\n\t\t\tcomponentLoaderHash,\n\t\t)\n\t}\n\n\tgetProvidedControlMap(\n\t\tthis: CodeComponentNode,\n\t\ttree: CanvasTree,\n\t\tchild: CanvasNode | undefined,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tcomponentLoaderHash: string | undefined,\n\t): VariableProviderControlMap | undefined {\n\t\tif (!this.repeatArray) return\n\n\t\treturn this.cache.getArraySourceVariableControlMap(\n\t\t\tthis,\n\t\t\ttree,\n\t\t\tchild,\n\t\t\tcomponentLoader,\n\t\t\tthis.repeatArray,\n\t\t\tcomponentLoaderHash,\n\t\t)\n\t}\n\n\tprivate getVariableSourceIdentifierFromArrayProvider(\n\t\tarrayVariableReference: VariableReference,\n\t): ModuleExportIdentifierString | undefined {\n\t\tconst providerNode = getArrayProviderNodeInAncestorScope(this, arrayVariableReference.providerId)\n\t\treturn providerNode?.getVariableSourceIdentifier()\n\t}\n\n\toverride preCommit(tree: CanvasTree, componentLoader: AnyComponentLoader) {\n\t\tsuper.preCommit(tree, componentLoader)\n\t\tlinkSlotContentChanges(tree, this)\n\t}\n\n\toverride supportsDynamicValues(): boolean {\n\t\treturn true\n\t}\n\n\toverride supportsPluginData(): this is this & WithPluginData {\n\t\treturn true\n\t}\n\n\toverride set(properties: Partial<this>, optionalTree?: CanvasTree, force = false, updateUpstream = true): this {\n\t\tif (!this.isVectorInstance && isReplicaChild(this) && \"codeComponentIdentifier\" in properties) {\n\t\t\tlog.reportError(\n\t\t\t\t\"CodeComponentNode: codeComponentIdentifier is not allowed to be set on non-vector replica child instances\",\n\t\t\t\t{ id: this.id },\n\t\t\t)\n\n\t\t\tconst { codeComponentIdentifier, ...propertiesWithoutCodeComponentIdentifier } = properties\n\t\t\treturn super.set(propertiesWithoutCodeComponentIdentifier as Partial<this>, optionalTree, force, updateUpstream)\n\t\t}\n\t\treturn super.set(properties, optionalTree, force, updateUpstream)\n\t}\n\n\tget isVectorInstance(): boolean {\n\t\t// Vector instances must have module identifiers.\n\t\tif (!isModuleIdentifier(this.codeComponentIdentifier) || !isModuleExportIdentifier(this.codeComponentIdentifier)) {\n\t\t\treturn false\n\t\t}\n\n\t\treturn this.cache.getIsVectorInstance(this.codeComponentIdentifier, this.tree())\n\t}\n}\n\n/**\n * If a CodeComponentNode is a Smart Component instance generated before 18\n * September 2023, its custom properties are keyed by the VariableID used on the\n * Variant Canvas --> Record<VariableID, Control>. However, to render this\n * instance we need to render the component with the human-readable React\n * properties that it expects. Here, we use a mapping provided via an annotation\n * if it is provided to map the resolve code component props, to the actual\n * React prop names. We must continue using this function for code component\n * instances that have the FramerVariables annotation. Code generated without\n * this annotation does not requires this mapping.\n */\nexport function mapVariableProps<T extends Record<string, unknown>>(\n\tcomponentLoader: AnyComponentLoader,\n\tcodeComponentIdentifier: string,\n\tresolvedCustomProps: T,\n): Partial<T> {\n\tconst mappedResolvedCustomProps: Partial<T> = {}\n\tconst propertyVariables = getHumanReadableReactPropMap(componentLoader, codeComponentIdentifier)\n\n\tif (propertyVariables === null || isEmptyObject(propertyVariables)) {\n\t\treturn resolvedCustomProps\n\t}\n\n\tfor (const key in resolvedCustomProps) {\n\t\tconst mappedKey = getHumanReadableKey(propertyVariables, key) as keyof T\n\t\tconst value = resolvedCustomProps[key] as T[keyof T]\n\t\tmappedResolvedCustomProps[mappedKey] = value\n\t}\n\n\treturn mappedResolvedCustomProps\n}\n\nexport function getSupportedLayoutForCodeComponent(\n\tcomponentLoader: AnyComponentLoader,\n\tcodeComponentIdentifier: string,\n): SupportedLayoutOptions {\n\tconst legacyLayout = { width: SupportedLayoutOption.Legacy, height: SupportedLayoutOption.Legacy }\n\n\tconst definition = componentLoader.reactComponentForIdentifier(codeComponentIdentifier)\n\tif (!definition) return legacyLayout\n\n\tconst { annotations } = definition\n\tif (!annotations) return legacyLayout\n\n\tconst supportedLayouts = parseSupportedLayoutFromAnnotations(annotations)\n\treturn supportedLayouts\n}\n", "import type { ReactComponentDefinition, VerifiedPropertyControls } from \"@framerjs/framer-runtime\"\nimport { AnnotationKey } from \"@framerjs/framer-runtime/crossorigin\"\nimport type { SandboxReactComponentDefinition } from \"@framerjs/framer-runtime/sandbox\"\ntype ComponentDefinition = ReactComponentDefinition | SandboxReactComponentDefinition\n\nexport function getComponentPresetControlKeys(component: {\n\tannotations?: Partial<Record<AnnotationKey, string>> | null\n}): Set<string> {\n\tconst annotation = component.annotations?.[AnnotationKey.FramerComponentPresetProps]\n\tif (!annotation) return new Set()\n\treturn new Set(\n\t\tannotation\n\t\t\t.split(\",\")\n\t\t\t.map(key => key.trim())\n\t\t\t.filter(Boolean),\n\t)\n}\n\n/** Get controls based on the `framerComponentPresetProps` annotation. */\nexport function filterComponentPresetControls(\n\tcomponent: ComponentDefinition | null,\n\tfilter: \"onlyPresets\" | \"onlyNonPresets\",\n): VerifiedPropertyControls {\n\tif (!component) return {}\n\n\tconst onlyPresets = filter === \"onlyPresets\"\n\n\tconst presetControlKeys = getComponentPresetControlKeys(component)\n\tif (presetControlKeys.size === 0) return onlyPresets ? {} : component.properties\n\n\tconst result: VerifiedPropertyControls = {}\n\n\tfor (const controlKey in component.properties) {\n\t\tconst isPreset = presetControlKeys.has(controlKey)\n\t\tif (isPreset !== onlyPresets) continue\n\t\tconst control = component.properties[controlKey]\n\t\tif (!control) continue\n\t\tresult[controlKey] = control\n\t}\n\n\treturn result\n}\n", "/* eslint-disable regexp/no-unused-capturing-group */\nimport { assert, assertNever } from \"@framerjs/shared\"\nimport { stripMetadataFromCSSVariable } from \"document/models/CanvasTree/utils/tokens.ts\"\nimport { ConicGradient } from \"document/models/ConicGradientClass.ts\"\nimport { GradientColorStop } from \"document/models/GradientColorStop.ts\"\nimport { LinearGradient } from \"document/models/LinearGradientClass.ts\"\nimport { RadialGradient } from \"document/models/RadialGradientClass.ts\"\nimport { progress } from \"framer-motion\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\n\n/**\n * Gradient parsing adapted from https://github.com/oceangravity/webskit-gradient-parser/blob/master/src/index.js\n */\nconst gradientArgsRegex = /.*gradient\\s*\\(((?:\\([^)]*\\)|[^)(])*)\\)/\nconst webColorRegexp =\n\t/#[\\da-fA-F]{3,6}|(rgb|rgba|hsl|hsla) ?\\([ \\d.%,]+\\)|color\\([^)]*\\)|([Tt]ransparent|[Aa]lice[Bb]lue|[Aa]ntique[Ww]hite|[Aa]qua(marine)?|[Aa]zure|[Bb]eige|[Bb]isque|[Bb]lack|[Bb]lanched[Aa]lmond|[Bb]lue([Vv]iolet)?|[Bb]rown|[Bb]urly[Ww]ood|[Cc]adet[Bb]lue|[Cc]hartreuse|[Cc]hocolate|[Cc]oral|[Cc]ornflower[Bb]lue|[Cc]ornsilk|[Cc]rimson|[Cc]yan|[Dd]ark([Bb]lue|[Cc]yan|[Gg]olden[Rr]od|[Gg]ray|[Gg]rey|[Gg]reen|[Kk]haki|[Mm]agenta|[Oo]live[Gg]reen|[Oo]range|[Oo]rchid|[Rr]ed|[Ss]almon|[Ss]ea[Gg]reen|[Ss]late[Bb]lue|[Ss]late[Gg]ray|[Ss]late[Gg]rey|[Tt]urquoise|[Vv]iolet)?|[Dd]eep([Pp]ink|[Ss]ky[Bb]lue)?|[Dd]im([Gg]ray|[Gg]rey)?|[Dd]odger[Bb]lue|[Ff]ire[Bb]rick|[Ff]loral[Ww]hite|[Ff]orest[Gg]reen|[Ff]uchsia|[Gg]ainsboro|[Gg]host[Ww]hite|[Gg]old(en[Rr]od)?|[Gg]ray|[Gg]rey|[Gg]reen([Yy]ellow)?|[Hh]oney[Dd]ew|[Hh]ot[Pp]ink|[Ii]ndian[Rr]ed|[Ii]ndigo|[Ii]vory|[Kk]haki|[Ll]avender([Bb]lush)?|[Ll]awn[Gg]reen|[Ll]emon[Cc]hiffon|[Ll]ight([Bb]lue|[Cc]oral|[Cc]yan|[Gg]olden[Rr]od[Yy]ellow|[Gg]ray|[Gg]rey|[Gg]reen|[Pp]ink|[Ss]almon|[Ss]ea[Gg]reen|[Ss]ky[Bb]lue|[Ss]late[Gg]ray|[Ss]late[Gg]rey|[Ss]teel[Bb]lue|[Yy]ellow)?|[Ll]ime([Gg]reen)?|[Ll]inen|[Mm]agenta|[Mm]aroon|[Mm]edium([Aa]qua[Mm]arine|[Bb]lue|[Oo]rchid|[Pp]urple|[Ss]ea[Gg]reen|[Ss]late[Bb]lue|[Ss]pring[Gg]reen|[Tt]urquoise|[Vv]iolet[Rr]ed)?|[Mm]idnight[Bb]lue|[Mm]int[Cc]ream|[Mm]isty[Rr]ose|[Mm]occasin|[Nn]avajo[Ww]hite|[Nn]avy|[Oo]ld[Ll]ace|[Oo]live([Dd]rab)?|[Oo]range([Rr]ed)?|[Oo]rchid|[Pp]ale[Gg]olden[Rr]od|[Pp]ale([Gg]reen|[Tt]urquoise|[Vv]iolet[Rr]ed)?|[Pp]apaya[Ww]hip|[Pp]each[Pp]uff|[Pp]eru|[Pp]ink|[Pp]lum|[Pp]owder[Bb]lue|[Pp]urple|[Rr]ebecca[Pp]urple|[Rr]ed|[Rr]osy[Bb]rown|[Rr]oyal[Bb]lue|[Ss]addle[Bb]rown|[Ss]almon|[Ss]andy[Bb]rown|[Ss]ea([Gg]reen|[Ss]hell)?|[Ss]ienna|[Ss]ilver|[Ss]ky[Bb]lue|[Ss]late([Bb]lue|[Gg]ray|[Gg]rey)?|[Ss]now|[Ss]pring[Gg]reen|[Ss]teel[Bb]lue|[Tt]an|[Tt]eal|[Tt]histle|[Tt]omato|[Tt]urquoise|[Vv]iolet|[Ww]heat|[Ww]hite([Ss]moke)?|[Yy]ellow([Gg]reen)?)/u\nexport const supportedGradientColorRegex = /(?:rgb|rgba|hsl|hsla) ?\\([ \\d.%,]+\\)|color\\([^)]*\\)/gu\nconst varWithMetadataRegex = /var\\(.[^()]+\\)(?:.\\/\\*.+?\\*\\/)?/g\nconst webColor = new RegExp(webColorRegexp.source, \"g\")\nconst isValue = /[+-]?\\d*\\.?\\d+(?:%|[a-z]+)?/gu\nconst degTurn = /(?<degree>\\d+)(?:deg|turn|rad|grad)/u // If the `g` flag is used, named capturing groups are not included\nconst toDirection = /to (?:left(?: top| bottom)|right(?: top| bottom)|top(?: right| left)?|bottom(?: right| left)?)?/gu\nconst sizeReg = /farthest-(?:corner|side)?|closest-(?:corner|side)?/gu\n\ntype GradientType = \"linear-gradient\" | \"radial-gradient\" | \"conic-gradient\"\nconst supportedGradientTypes: Set<GradientType> = new Set([\"linear-gradient\", \"radial-gradient\", \"conic-gradient\"])\n\nfunction getPosition(definition: string) {\n\tlet x = \"50%\"\n\tlet y = \"50%\"\n\n\tif (definition.match(/at/gu)) {\n\t\tdefinition = definition.slice(definition.indexOf(\"at\"), definition.length)\n\t\tdefinition = definition.replace(\"at \", \"\")\n\t\tconst split = definition.split(\" \")\n\n\t\tif (split.length === 4) {\n\t\t\tif (split[0] === \"left\") {\n\t\t\t\tassert(!isUndefined(split[1]), \"Invalid gradient stop definition:\", definition)\n\t\t\t\tx = split[1]\n\t\t\t} else {\n\t\t\t\tx = `calc(100% - ${split[1]})`\n\t\t\t}\n\n\t\t\tif (split[2] === \"top\") {\n\t\t\t\tassert(!isUndefined(split[3]), \"Invalid gradient stop definition:\", definition)\n\t\t\t\ty = split[3]\n\t\t\t} else {\n\t\t\t\ty = `calc(100% - ${split[3]})`\n\t\t\t}\n\t\t} else if (split.length === 1 || split.length === 2) {\n\t\t\tswitch (definition) {\n\t\t\t\tcase \"center\":\n\t\t\t\tcase \"center center\":\n\t\t\t\t\tx = \"50%\"\n\t\t\t\t\ty = \"50%\"\n\t\t\t\t\tbreak\n\t\t\t\tcase \"right top\":\n\t\t\t\tcase \"top right\":\n\t\t\t\t\tx = \"100%\"\n\t\t\t\t\ty = \"0%\"\n\t\t\t\t\tbreak\n\t\t\t\tcase \"left top\":\n\t\t\t\tcase \"top left\":\n\t\t\t\t\tx = \"0%\"\n\t\t\t\t\ty = \"0%\"\n\t\t\t\t\tbreak\n\t\t\t\tcase \"right bottom\":\n\t\t\t\tcase \"bottom right\":\n\t\t\t\t\tx = \"100%\"\n\t\t\t\t\ty = \"100%\"\n\t\t\t\t\tbreak\n\t\t\t\tcase \"left bottom\":\n\t\t\t\tcase \"bottom left\":\n\t\t\t\t\tx = \"0%\"\n\t\t\t\t\ty = \"100%\"\n\t\t\t\t\tbreak\n\t\t\t\tcase \"top\":\n\t\t\t\tcase \"center top\":\n\t\t\t\tcase \"top center\":\n\t\t\t\t\tx = \"50%\"\n\t\t\t\t\ty = \"0%\"\n\t\t\t\t\tbreak\n\t\t\t\tcase \"left\":\n\t\t\t\tcase \"center left\":\n\t\t\t\tcase \"left center\":\n\t\t\t\t\tx = \"0%\"\n\t\t\t\t\ty = \"50%\"\n\t\t\t\t\tbreak\n\t\t\t\tcase \"right\":\n\t\t\t\tcase \"center right\":\n\t\t\t\tcase \"right center\":\n\t\t\t\t\tx = \"100%\"\n\t\t\t\t\ty = \"50%\"\n\t\t\t\t\tbreak\n\t\t\t\tcase \"bottom\":\n\t\t\t\tcase \"center bottom\":\n\t\t\t\tcase \"bottom center\":\n\t\t\t\t\tx = \"50%\"\n\t\t\t\t\ty = \"100%\"\n\t\t\t\t\tbreak\n\t\t\t\tdefault: {\n\t\t\t\t\tconst values = definition.split(\" \")\n\t\t\t\t\tx = values[0]\n\t\t\t\t\ty = values[1] || \"50%\"\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn { x, y }\n}\n\nfunction getAngle(definition: string): number {\n\tconst degTurnMatches = definition.match(degTurn)\n\tif (degTurnMatches && degTurnMatches.groups && isString(degTurnMatches.groups.degree)) {\n\t\treturn parseInt(degTurnMatches.groups.degree)\n\t}\n\n\tconst direction = definition.match(toDirection)?.[0]\n\n\tswitch (direction) {\n\t\tcase \"to top\":\n\t\t\treturn 0\n\t\tcase \"to bottom\":\n\t\t\treturn 180\n\t\tcase \"to left\":\n\t\t\treturn 270\n\t\tcase \"to right\":\n\t\t\treturn 90\n\t\tcase \"to right top\":\n\t\tcase \"to top right\":\n\t\t\treturn 45\n\t\tcase \"to left top\":\n\t\tcase \"to top left\":\n\t\t\treturn 315\n\t\tcase \"to right bottom\":\n\t\tcase \"to bottom right\":\n\t\t\treturn 135\n\t\tcase \"to left bottom\":\n\t\tcase \"to bottom left\":\n\t\t\treturn 225\n\t\tdefault:\n\t\t\treturn 0\n\t}\n}\n\nfunction getSize(definition: string): string | [string, string] {\n\tif (definition.match(/at/gu)) {\n\t\tdefinition = definition.split(\"at\")[0]\n\t}\n\n\tdefinition = definition.replace(/ellipse |circle /gu, \"\").trim()\n\n\tif (definition.includes(\" \")) {\n\t\treturn definition.split(\" \") as [string, string]\n\t} else if (definition.match(isValue)) {\n\t\treturn definition\n\t} else {\n\t\tconst size = definition.match(sizeReg)\n\t\tif (size?.[0]) return size[0]\n\t}\n\n\treturn [\"50%\", \"50%\"]\n}\n\nconst COLOR_TOKEN_PREFIX = \"COLOR_TOKEN_\"\nconst VAR_TOKEN_PREFIX = \"VAR_TOKEN_\"\nexport function tokenise(value: string) {\n\tconst colorTokens = {}\n\tconst varTokens = {}\n\n\tconst colors = value.match(supportedGradientColorRegex)\n\n\tif (colors) {\n\t\tcolors.forEach((color, index) => {\n\t\t\tvalue = value.replace(color, COLOR_TOKEN_PREFIX + index)\n\t\t\tcolorTokens[COLOR_TOKEN_PREFIX + index] = color\n\t\t})\n\t}\n\n\tconst vars = value.match(varWithMetadataRegex)\n\tif (vars) {\n\t\tvars.forEach((varValue, index) => {\n\t\t\tconst replaceTokenKey = VAR_TOKEN_PREFIX + index\n\t\t\tvalue = value.replace(varValue, replaceTokenKey)\n\t\t\tvarTokens[replaceTokenKey] = stripMetadataFromCSSVariable(varValue)\n\t\t})\n\t}\n\n\treturn { value, colorTokens, varTokens }\n}\n\nfunction isSupportedGradientType(type: string): type is GradientType {\n\treturn supportedGradientTypes.has(type as GradientType)\n}\n\nexport function parseGradient(style: string): LinearGradient | RadialGradient | ConicGradient | null {\n\tconst { colorTokens, varTokens, value } = tokenise(style)\n\n\t// Currently only support a single gradient\n\tconst [type] = value.split(\"(\")\n\tif (!isSupportedGradientType(type)) return null\n\n\tconst [_, argsString] = value.match(gradientArgsRegex) || []\n\tif (!argsString) return null\n\n\t// argsString is not empty, so argsString.split must produce an array with at least one non-empty string.\n\tconst args = argsString.split(\",\").map(str => str.trim())\n\tconst firstArgString = args[0]\n\tassert(firstArgString)\n\n\t/**\n\t * If first argument of the gradient is a size/position\n\t */\n\n\tlet positionDefinition: string = \"\"\n\tlet colorStopIndex = 0\n\tconst isFirstArgStop =\n\t\tfirstArgString.match(webColor) ||\n\t\tfirstArgString.startsWith(VAR_TOKEN_PREFIX) ||\n\t\tfirstArgString.startsWith(COLOR_TOKEN_PREFIX)\n\tif (!isFirstArgStop) {\n\t\tpositionDefinition = firstArgString\n\t\tcolorStopIndex = 1\n\t}\n\n\tconst positionDenominator = type === \"conic-gradient\" ? 360 : 100\n\tconst stops: GradientColorStop[] = []\n\tfor (let i = colorStopIndex; i < args.length; i++) {\n\t\tconst stopDefinition = args[i]\n\t\tassert(stopDefinition, \"Gradient color stop index is out of bound:\", i, args)\n\t\tlet [color, position, positionB] = stopDefinition.split(\" \")\n\n\t\tif (!color) continue\n\n\t\tcolor = color.replace(/VAR_TOKEN_[\\d+]/u, val => varTokens[val])\n\t\tcolor = color.replace(/COLOR_TOKEN_[\\d+]/u, val => colorTokens[val])\n\n\t\tstops.push(\n\t\t\tnew GradientColorStop({\n\t\t\t\tvalue: color,\n\t\t\t\tposition: position\n\t\t\t\t\t? normalizePercentageString(position, positionDenominator)\n\t\t\t\t\t: progress(colorStopIndex, args.length - 1, i),\n\t\t\t}),\n\t\t)\n\n\t\t// green 10% 70% -> green 10%, green 70%\n\t\tif (positionB) {\n\t\t\tstops.push(\n\t\t\t\tnew GradientColorStop({\n\t\t\t\t\tvalue: color,\n\t\t\t\t\tposition: normalizePercentageString(positionB, positionDenominator),\n\t\t\t\t}),\n\t\t\t)\n\t\t}\n\t}\n\n\tswitch (type) {\n\t\tcase \"linear-gradient\": {\n\t\t\tconst angle = getAngle(positionDefinition)\n\t\t\treturn new LinearGradient({ angle, stops })\n\t\t}\n\t\tcase \"radial-gradient\": {\n\t\t\tconst position = getPosition(positionDefinition)\n\t\t\tconst size = getSize(positionDefinition)\n\n\t\t\treturn new RadialGradient({\n\t\t\t\tstops,\n\t\t\t\twidthFactor: typeof size === \"string\" ? 0.5 : normalizePercentageString(size[0], 100),\n\t\t\t\theightFactor: typeof size === \"string\" ? 0.5 : normalizePercentageString(size[1], 100),\n\t\t\t\tcenterAnchorX: normalizePercentageString(position.x, 100),\n\t\t\t\tcenterAnchorY: normalizePercentageString(position.y, 100),\n\t\t\t})\n\t\t}\n\t\tcase \"conic-gradient\": {\n\t\t\tconst position = getPosition(positionDefinition)\n\t\t\tconst angle = getAngle(positionDefinition)\n\t\t\treturn new ConicGradient({\n\t\t\t\tangle,\n\t\t\t\tcenterAnchorX: normalizePercentageString(position.x, 100),\n\t\t\t\tcenterAnchorY: normalizePercentageString(position.y, 100),\n\t\t\t\tstops,\n\t\t\t})\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\nconst normalizePercentageString = (percent: string, denominator: number) => parseFloat(percent) / denominator\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AK,YAAY,CAAC;AAC1B;AAYA,SAAS,iCACR,oBACuD;AACvD,UAAQ,oBAAoB;AAAA,IAC3B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,4CAAwC;AAGvC,YAAM,IAAoC;AAC1C,aAAO;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AA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WAAW,MAAM,0BAA0B,KAAK,CAAC,GAAG,GAAG;AAAA,QACrF,eAAe,0BAA0B,SAAS,GAAG,GAAG;AAAA,QACxD,eAAe,0BAA0B,SAAS,GAAG,GAAG;AAAA,MACzD,CAAC;AAAA,IACF;AAAA,IACA,KAAK,kBAAkB;AACtB,YAAM,WAAW,YAAY,kBAAkB;AAC/C,YAAM,QAAQ,SAAS,kBAAkB;AACzC,aAAO,IAAI,cAAc;AAAA,QACxB;AAAA,QACA,eAAe,0BAA0B,SAAS,GAAG,GAAG;AAAA,QACxD,eAAe,0BAA0B,SAAS,GAAG,GAAG;AAAA,QACxD;AAAA,MACD,CAAC;AAAA,IACF;AAAA,IACA;AACC,kBAAY,IAAI;AAAA,EAClB;AACD;AAEA,IAAM,4BAA4B,CAAC,SAAiB,gBAAwB,WAAW,OAAO,IAAI;",
  "names": ["global", "key", "is", "imul", "hash", "Map", "map", "collection", "List", "values", "list", "separator", "steps", "Record", "Set", "OrderedSet", "Map", "OrderedSet", "CharacterMetadata", "List", "Map", "OrderedSet", "decorateCharacterList", "ContentBlock", "List", "Map", "OrderedSet", "haveEqualStyle", "haveEqualEntity", "decorateCharacterList", "ContentBlockNode", "Map", "segment", "key", "key", "randomizeContentBlockNodeKeys", "key", "randomizeContentBlockKeys", "randomizeBlockMapKeys", "getContentStateFragment", "List", "updateExistingBlock", "updateHead", "updateTail", "getRootBlocks", "updateBlockMapLinks", "insertFragment", "insertFragmentIntoContentState", "key", "Map", "getNextDelimiterBlockKey", "List", "Map", "transformBlock", "key", "getAncestorsKeys", "getNextDelimitersBlockKeys", "getNextValidSibling", "getPrevValidSibling", "updateBlockMapLinks", "removeRangeFromContentState", "removeFromList", "List", "Map", "transformBlock", "key", "updateBlockMapLinks", "splitBlockInContentState", "OrderedSet", "List", "returnTrue", "inlineStyles", "DraftEntityInstance", "key", "Map", "SelectionState", "key", "SelectionState", "List", "ContentState", "key", "key", "UnicodeBidiService", "nullthrows", "key", "ContentState", "SelectionState", "OrderedSet", "EditorState", "map", "List", "transformBlock", "key", "updateBlockMapLinks", "moveBlockInContentState", "key", "EditorState", "List", "key", "List", "CompositeDraftDecorator", "callback", "Map", "window", "undefined", "regexes", "map", "ua", "range", "isNumber", "compare", "hasOwnProperty", "compare", "key", "key", "Map", "DOMObserver", "key", "EditorState", "key", "EditorState", "key", "DraftEditorDecoratedLeaves", "self", "key", "NEWLINE_A", "NEWLINE_B", "DraftEditorTextNode", "doc", "doc", "n", "self", "key", "DraftEditorLeaf", "map", "List", "DraftEditorNode", "doc", "doc", "getViewportHeight", "key", "List", "isBlockOnSelectionEdge", "shouldNotAddWrapperElement", "applyWrapperElementToSiblings", "Element", "getDraftRenderConfig", "getCustomRenderConfig", "getElementPropsConfig", "DraftEditorBlockNode", "viewportHeight", "offsetKey", "customConfig", "Component", "elementProps", "key", "DraftEditorContentsExperimental", "key", "self", "isBlockOnSelectionEdge", "DraftEditorBlock", "viewportHeight", "start", "end", "key", "getListItemClasses", "DraftEditorContents", "Element", "emptyFunction", "DataTransfer", "isLink", "getLink", "isImage", "type", "EditorState", "global", "undefined", "doc", "require_setImmediate", "EditorState", "EditorState", "EditorState", "EditorState", "EditorState", "key", "key", "EditorState", "selection", "key", "EditorState", "EditorState", "EditorState", "EditorState", "key", "key", "EditorState", "key", "EditorState", "EditorState", "EditorState", "EditorState", "selection", "key", "EditorState", "EditorState", "EditorState", "key", "URI", "doc", "key", "List", "Map", "OrderedSet", "buildBlockTypeMap", "getListItemDepth", "isValidAnchor", "isValidImage", "styleFromNodeAttributes", "style", "isListNode", "ContentBlocksBuilder", "image", "convertFromHTMLToContentBlocks", "disambiguate", "key", "List", "EditorState", "key", "EditorState", "editorState", "character", "currentBlockType", "text", "DraftEditorPlaceholder", "key", "self", "EditorState", "UpdateDraftEditorFlags", "DraftEditor", "key", "key", "areEqual", "isTruthy", "key", "createRawBlock", "insertRawBlock", "encodeRawBlocks", "encodeRawEntityMap", "convertFromDraftStateToRaw", "key", "traverseInDepthOrder", "isListBlock", "addDepthToChildren", "key", "List", "inlineStyles", "OrderedSet", "key", "ContentState", "SelectionState", "List", "Map", "decodeBlockNodeConfig", "decodeCharacterList", "addKeyIfMissing", "updateNodeStack", "decodeContentBlockNodes", "decodeContentBlocks", "decodeRawBlocks", "decodeRawEntityMap", "convertFromRawToDraftState", "global", "ContentState", "EditorState", "SelectionState", "require_immutable", "global", "key", "is", "imul", "hash", "Map", "map", "collection", "List", "values", "list", "separator", "steps", "Record", "Set", "OrderedSet", "n", "Bezier", "self", "t", "Bezier", "values", "Bezier", "point", "points", "n", "steps", "pi", "ret", "d", "tlen", "alen", "slen", "self", "key", "ModuleAlignment", "ModuleWidth", "key", "resolvedHash", "link", "key", "link", "values", "index", "key", "map", "map", "n", "doc", "map", "doc", "key", "defaultStyles", "key", "doc", "key", "key", "isNumber", "key", "inlineStyles", "doc", "doc", "doc", "key", "key", "import_draft_js", "key", "link", "cursorStyles", "key", "key", "key", "key", "key", "key", "isEmpty", "isObject", "isEmptyObject", "isObject", "key", "isEmptyObject", "key", "key", "n", "keep", "TemplateHelper", "htmlKey", "key", "key", "key", "key", "assertNever", "key", "key", "isNumber", "key", "isNumber", "viewportProvider", "key", "key", "FramePoint", "Matrix", "n", "key", "isNumber", "key", "key", "isNumber", "viewport", "parentRect", "sizing", "positioning", "log", "key", "link", "key", "key", "log", "controls", "slugKey", "name", "controlMap", "variableMap", "key", "dataSourceVariables", "log", "key", "log", "key", "isNumber", "key", "key", "Tools", "withShape", "key", "link", "moduleNode", "n", "HTMLTag", "key", "key", "key", "withIntrinsicSize", "key", "isNumber", "key", "isNumber", "isVectorSetItem", "meta", "meta", "meta", "meta", "meta", "meta", "meta", "key", "setInfo", "module", "localIdentifier", "annotations", "firstItem", "size", "identifier", "isNumber", "key", "key", "withShape", "key", "isNumber", "widthType", "heightType", "maxHeight", "minHeight", "maxWidth", "minWidth", "values", "key", "key", "meta", "key", "key", "isReplicaChild", "key", "key", "key", "key", "key", "key", "key", "key", "values", "mask", "key", "key", "key", "key", "key", "key", "key", "key", "key", "key", "key", "key", "key", "log", "isNumber", "key", "key", "values", "isNumber", "key", "isNumber", "CSSExportType", "SVGExportType", "svg", "svg", "key", "n", "Path", "Bezier", "map", "key", "svg", "shadowRect", "svg", "isNumber", "rotate", "svg", "withShape", "opacity", "mask", "isNumber", "mask", "withIntrinsicSize", "isNumber", "key", "isNumber", "isNumber", "isNumber", "isNumber", "values", "isNumber", "key", "key", "isSupportedTrigger", "key", "defaults", "values", "hasAnyEffect", "defaults", "key", "values", "key", "assertNever", "isNumber", "key", "key", "isNumber", "isNumber", "identity", "rotate", "key", "rotate", "opacity", "isNumber", "color", "rotate", "isNumber", "color", "rotate", "isNumber", "key", "isNumber", "identity", "transformPerspective", "key", "isNumber", "isNumber", "isNumber", "opacity", "isNumber", "isNumber", "isNumber", "values", "LinearGradient", "defaultGradientStops", "RadialGradient", "defaultGradientStops", "values", "mask", "LinearGradient", "RadialGradient", "withShape", "values", "transformValues", "stops", "LinearGradient", "RadialGradient", "isNumber", "key", "key", "key", "isNumber", "identity", "key", "key", "identity", "isNumber", "log", "key", "isNumber", "withIntrinsicSize", "isNumber", "hasFocalPoint", "assert", "centerFocalPoint", "withShape", "controlMap", "variableMap", "key", "key", "log", "key", "isNumber", "key", "values", "LinearGradient", "RadialGradient"]
}
