{
  "version": 3,
  "sources": ["../../../../src/lib/shapes/note/NoteShapeUtil.tsx"],
  "sourcesContent": ["/* eslint-disable react-hooks/rules-of-hooks */\nimport {\n\tBox,\n\tDefaultFontFamilies,\n\tEMPTY_ARRAY,\n\tEditor,\n\tGroup2d,\n\tIndexKey,\n\tRectangle2d,\n\tSafeId,\n\tShapeUtil,\n\tSvgExportContext,\n\tTLHandle,\n\tTLNoteShape,\n\tTLNoteShapeProps,\n\tTLResizeInfo,\n\tTLShape,\n\tTLShapeId,\n\tVec,\n\tWeakCache,\n\texhaustiveSwitchError,\n\tgetColorValue,\n\tgetFontsFromRichText,\n\tisEqual,\n\tlerp,\n\tnoteShapeMigrations,\n\tnoteShapeProps,\n\tresizeScaled,\n\trng,\n\ttoRichText,\n\tuseColorMode,\n\tuseEditor,\n\tuseValue,\n} from '@tldraw/editor'\nimport { useCallback, useContext } from 'react'\nimport { startEditingShapeWithRichText } from '../../tools/SelectTool/selectHelpers'\nimport { TldrawUiTooltip } from '../../ui/components/primitives/TldrawUiTooltip'\nimport { TranslationsContext } from '../../ui/hooks/useTranslation/useTranslation'\nimport {\n\tisEmptyRichText,\n\trenderHtmlFromRichTextForMeasurement,\n\trenderPlaintextFromRichText,\n} from '../../utils/text/richText'\nimport { isRightToLeftLanguage } from '../../utils/text/text'\nimport {\n\tLABEL_FONT_SIZES,\n\tLABEL_PADDING,\n\tTEXT_PROPS,\n\tgetFontFamily,\n} from '../shared/default-shape-constants'\nimport { DefaultFontFaces, getThemeFontFaces } from '../shared/defaultFonts'\nimport { ShapeOptionsWithDisplayValues, getDisplayValues } from '../shared/getDisplayValues'\nimport { HyperlinkButton } from '../shared/HyperlinkButton'\nimport { RichTextLabel, RichTextSVG } from '../shared/RichTextLabel'\nimport { useIsReadyForEditing } from '../shared/useEditablePlainText'\nimport { useEfficientZoomThreshold } from '../shared/useEfficientZoomThreshold'\nimport { CLONE_HANDLE_MARGIN, getNoteShapeForAdjacentPosition } from './noteHelpers'\n\nconst NOTE_SHAPE_HORIZONTAL_ALIGNS = Object.freeze({\n\tstart: 'start',\n\tmiddle: 'center',\n\tend: 'end',\n\t'start-legacy': 'start',\n\t'end-legacy': 'end',\n\t'middle-legacy': 'center',\n} as const)\n\nconst NOTE_SHAPE_VERTICAL_ALIGNS = Object.freeze({\n\tstart: 'start',\n\tmiddle: 'middle',\n\tend: 'end',\n} as const)\n\n/** @public */\nexport interface NoteShapeUtilDisplayValues {\n\tnoteWidth: number\n\tnoteHeight: number\n\tnoteBackgroundColor: string\n\tborderColor: string\n\tborderWidth: number\n\tlabelColor: string\n\tlabelFontFamily: string\n\tlabelFontSize: number\n\tlabelLineHeight: number\n\tlabelFontWeight: string\n\tlabelFontVariant: string\n\tlabelFontStyle: string\n\tlabelPadding: number\n\tlabelHorizontalAlign: 'start' | 'center' | 'end'\n\tlabelVerticalAlign: 'start' | 'middle' | 'end'\n}\n\n/** @public */\nexport interface NoteShapeOptions extends ShapeOptionsWithDisplayValues<\n\tTLNoteShape,\n\tNoteShapeUtilDisplayValues\n> {\n\t/**\n\t * How should the note shape resize? By default it does not resize (except automatically based on its text content),\n\t * but you can set it to be user-resizable using scale.\n\t */\n\tresizeMode: 'none' | 'scale'\n}\n\n/** @public */\nexport class NoteShapeUtil extends ShapeUtil<TLNoteShape> {\n\tstatic override type = 'note' as const\n\tstatic override props = noteShapeProps\n\tstatic override migrations = noteShapeMigrations\n\n\toverride options: NoteShapeOptions = {\n\t\tresizeMode: 'none',\n\t\tgetDefaultDisplayValues(_editor, shape, theme, colorMode): NoteShapeUtilDisplayValues {\n\t\t\tconst { color, labelColor, font, size, align, verticalAlign } = shape.props\n\t\t\tconst colors = theme.colors[colorMode]\n\t\t\treturn {\n\t\t\t\tnoteWidth: 200,\n\t\t\t\tnoteHeight: 200,\n\t\t\t\tnoteBackgroundColor: getColorValue(colors, color, 'noteFill'),\n\t\t\t\tborderColor: colors.noteBorder,\n\t\t\t\tborderWidth: 2,\n\t\t\t\tlabelColor:\n\t\t\t\t\tlabelColor === 'black'\n\t\t\t\t\t\t? getColorValue(colors, color, 'noteText')\n\t\t\t\t\t\t: getColorValue(colors, labelColor, 'fill'),\n\t\t\t\tlabelFontFamily: getFontFamily(theme, font),\n\t\t\t\tlabelFontSize: theme.fontSize * LABEL_FONT_SIZES[size],\n\t\t\t\tlabelLineHeight: theme.lineHeight,\n\t\t\t\tlabelFontWeight: TEXT_PROPS.fontWeight,\n\t\t\t\tlabelFontVariant: TEXT_PROPS.fontVariant,\n\t\t\t\tlabelFontStyle: TEXT_PROPS.fontStyle,\n\t\t\t\tlabelPadding: LABEL_PADDING,\n\t\t\t\tlabelHorizontalAlign: NOTE_SHAPE_HORIZONTAL_ALIGNS[align],\n\t\t\t\tlabelVerticalAlign: NOTE_SHAPE_VERTICAL_ALIGNS[verticalAlign],\n\t\t\t}\n\t\t},\n\t\tgetCustomDisplayValues(): Partial<NoteShapeUtilDisplayValues> {\n\t\t\treturn {}\n\t\t},\n\t}\n\n\toverride canEdit(shape: TLNoteShape) {\n\t\treturn true\n\t}\n\toverride hideResizeHandles(shape: TLNoteShape) {\n\t\tconst { resizeMode } = this.options\n\t\tswitch (resizeMode) {\n\t\t\tcase 'none': {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tcase 'scale': {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow exhaustiveSwitchError(resizeMode)\n\t\t\t}\n\t\t}\n\t}\n\n\toverride isAspectRatioLocked(shape: TLNoteShape) {\n\t\treturn this.options.resizeMode === 'scale'\n\t}\n\n\toverride hideSelectionBoundsFg(shape: TLNoteShape) {\n\t\treturn false\n\t}\n\n\tgetDefaultProps(): TLNoteShape['props'] {\n\t\treturn {\n\t\t\tcolor: 'black',\n\t\t\trichText: toRichText(''),\n\t\t\tsize: 'm',\n\t\t\tfont: 'draw',\n\t\t\talign: 'middle',\n\t\t\tverticalAlign: 'middle',\n\t\t\tlabelColor: 'black',\n\t\t\tgrowY: 0,\n\t\t\tfontSizeAdjustment: 1,\n\t\t\turl: '',\n\t\t\tscale: 1,\n\t\t\ttextFirstEditedBy: null,\n\t\t}\n\t}\n\n\tgetGeometry(shape: TLNoteShape) {\n\t\tconst { labelHeight, labelWidth } = this.getLabelSize(shape)\n\t\tconst { scale } = shape.props\n\n\t\tconst dv = getDisplayValues(this, shape)\n\n\t\tconst lh = labelHeight * scale\n\t\tconst lw = labelWidth * scale\n\t\tconst nw = dv.noteWidth * scale\n\t\tconst nh = getNoteHeight(shape, dv.noteHeight)\n\n\t\treturn new Group2d({\n\t\t\tchildren: [\n\t\t\t\tnew Rectangle2d({ width: nw, height: nh, isFilled: true }),\n\t\t\t\tnew Rectangle2d({\n\t\t\t\t\tx:\n\t\t\t\t\t\tdv.labelHorizontalAlign === 'start'\n\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t: dv.labelHorizontalAlign === 'end'\n\t\t\t\t\t\t\t\t? nw - lw\n\t\t\t\t\t\t\t\t: (nw - lw) / 2,\n\t\t\t\t\ty:\n\t\t\t\t\t\tdv.labelVerticalAlign === 'start'\n\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t: dv.labelVerticalAlign === 'end'\n\t\t\t\t\t\t\t\t? nh - lh\n\t\t\t\t\t\t\t\t: (nh - lh) / 2,\n\t\t\t\t\twidth: lw,\n\t\t\t\t\theight: lh,\n\t\t\t\t\tisFilled: true,\n\t\t\t\t\tisLabel: true,\n\t\t\t\t\texcludeFromShapeBounds: true,\n\t\t\t\t}),\n\t\t\t],\n\t\t})\n\t}\n\n\toverride getHandles(shape: TLNoteShape): TLHandle[] {\n\t\tconst { scale } = shape.props\n\t\tconst isCoarsePointer = this.editor.getInstanceState().isCoarsePointer\n\t\tif (isCoarsePointer) return []\n\n\t\tconst zoom = this.editor.getEfficientZoomLevel()\n\t\tif (zoom * scale < 0.25) return []\n\n\t\tconst dv = getDisplayValues(this, shape)\n\t\tconst nh = getNoteHeight(shape, dv.noteHeight)\n\t\tconst nw = dv.noteWidth * scale\n\t\tconst offset = (CLONE_HANDLE_MARGIN / zoom) * scale\n\n\t\tif (zoom * scale < 0.5) {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tid: 'bottom',\n\t\t\t\t\tindex: 'a3' as IndexKey,\n\t\t\t\t\ttype: 'clone',\n\t\t\t\t\tx: nw / 2,\n\t\t\t\t\ty: nh + offset,\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tid: 'top',\n\t\t\t\tindex: 'a1' as IndexKey,\n\t\t\t\ttype: 'clone',\n\t\t\t\tx: nw / 2,\n\t\t\t\ty: -offset,\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: 'right',\n\t\t\t\tindex: 'a2' as IndexKey,\n\t\t\t\ttype: 'clone',\n\t\t\t\tx: nw + offset,\n\t\t\t\ty: nh / 2,\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: 'bottom',\n\t\t\t\tindex: 'a3' as IndexKey,\n\t\t\t\ttype: 'clone',\n\t\t\t\tx: nw / 2,\n\t\t\t\ty: nh + offset,\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: 'left',\n\t\t\t\tindex: 'a4' as IndexKey,\n\t\t\t\ttype: 'clone',\n\t\t\t\tx: -offset,\n\t\t\t\ty: nh / 2,\n\t\t\t},\n\t\t]\n\t}\n\n\toverride onResize(shape: any, info: TLResizeInfo<any>) {\n\t\tconst { resizeMode } = this.options\n\t\tswitch (resizeMode) {\n\t\t\tcase 'none': {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tcase 'scale': {\n\t\t\t\treturn resizeScaled(shape, info)\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow exhaustiveSwitchError(resizeMode)\n\t\t\t}\n\t\t}\n\t}\n\n\toverride getText(shape: TLNoteShape) {\n\t\treturn renderPlaintextFromRichText(this.editor, shape.props.richText)\n\t}\n\n\toverride getReferencedUserIds(shape: TLNoteShape) {\n\t\treturn shape.props.textFirstEditedBy ? [shape.props.textFirstEditedBy] : []\n\t}\n\n\toverride getFontFaces(shape: TLNoteShape) {\n\t\tconst fonts = isEmptyRichText(shape.props.richText)\n\t\t\t? []\n\t\t\t: getFontsFromRichText(this.editor, shape.props.richText, {\n\t\t\t\t\tfamily: `tldraw_${shape.props.font}`,\n\t\t\t\t\tweight: 'normal',\n\t\t\t\t\tstyle: 'normal',\n\t\t\t\t})\n\n\t\tif (shape.props.textFirstEditedBy && !isEmptyRichText(shape.props.richText)) {\n\t\t\treturn [...fonts, DefaultFontFaces.tldraw_sans.normal.normal]\n\t\t}\n\t\tconst themeFaces = getThemeFontFaces(this.editor.getCurrentTheme(), shape.props.font)\n\t\tif (themeFaces) return [...themeFaces, ...fonts]\n\n\t\treturn fonts.length ? fonts : EMPTY_ARRAY\n\t}\n\n\tcomponent(shape: TLNoteShape) {\n\t\tconst { id, type, props } = shape\n\t\tconst { scale, richText, fontSizeAdjustment, textFirstEditedBy } = props\n\n\t\tconst handleKeyDown = useNoteKeydownHandler(id)\n\n\t\tconst rotation = useValue(\n\t\t\t'shape rotation',\n\t\t\t() => this.editor.getShapePageTransform(id)?.rotation() ?? 0,\n\t\t\t[this.editor]\n\t\t)\n\n\t\tconst colorMode = useColorMode()\n\t\tconst dv = getDisplayValues(this, shape, colorMode)\n\n\t\tconst nw = dv.noteWidth * scale\n\t\tconst nh = getNoteHeight(shape, dv.noteHeight)\n\n\t\t// Shadows are hidden when zoomed out far enough; the cheap borderBottom takes over.\n\t\tconst hideShadows = useEfficientZoomThreshold(0.25 / scale)\n\n\t\tconst isSelected = shape.id === this.editor.getOnlySelectedShapeId()\n\n\t\tconst isReadyForEditing = useIsReadyForEditing(this.editor, shape.id)\n\t\tconst isEmpty = isEmptyRichText(richText)\n\n\t\tconst attribution = useValue(\n\t\t\t'attribution',\n\t\t\t() => {\n\t\t\t\tif (!textFirstEditedBy || isEmpty) return null\n\t\t\t\tconst name = this.editor.getAttributionDisplayName(textFirstEditedBy)\n\t\t\t\tif (!name) return null\n\t\t\t\treturn { short: name.split(' ')[0], full: name }\n\t\t\t},\n\t\t\t[textFirstEditedBy, isEmpty, this.editor]\n\t\t)\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div\n\t\t\t\t\tid={id}\n\t\t\t\t\tclassName=\"tl-note__container\"\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\twidth: nw,\n\t\t\t\t\t\theight: nh,\n\t\t\t\t\t\tbackgroundColor: dv.noteBackgroundColor,\n\t\t\t\t\t\tborderBottom: hideShadows\n\t\t\t\t\t\t\t? `${dv.borderWidth * scale}px solid ${dv.borderColor}`\n\t\t\t\t\t\t\t: 'none',\n\t\t\t\t\t\tboxShadow: hideShadows ? 'none' : getNoteShadow(shape.id, rotation, scale),\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{attribution && (\n\t\t\t\t\t\t<TldrawUiTooltip content={attribution.full} side=\"bottom\">\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName=\"tl-note__attribution\"\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t['--note-attribution-scale' as string]: scale,\n\t\t\t\t\t\t\t\t\tfontSize: 11 * scale,\n\t\t\t\t\t\t\t\t\tcolor: dv.labelColor,\n\t\t\t\t\t\t\t\t\topacity: 0.6,\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{attribution.short}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</TldrawUiTooltip>\n\t\t\t\t\t)}\n\t\t\t\t\t{(isSelected || isReadyForEditing || !isEmpty) && (\n\t\t\t\t\t\t<RichTextLabel\n\t\t\t\t\t\t\tshapeId={id}\n\t\t\t\t\t\t\ttype={type}\n\t\t\t\t\t\t\tfontFamily={dv.labelFontFamily}\n\t\t\t\t\t\t\tfontSize={(fontSizeAdjustment ?? 1) * dv.labelFontSize}\n\t\t\t\t\t\t\tlineHeight={dv.labelLineHeight}\n\t\t\t\t\t\t\ttextAlign={dv.labelHorizontalAlign}\n\t\t\t\t\t\t\tverticalAlign={dv.labelVerticalAlign}\n\t\t\t\t\t\t\trichText={richText}\n\t\t\t\t\t\t\tisSelected={isSelected}\n\t\t\t\t\t\t\tlabelColor={dv.labelColor}\n\t\t\t\t\t\t\twrap\n\t\t\t\t\t\t\tpadding={dv.labelPadding}\n\t\t\t\t\t\t\thasCustomTabBehavior\n\t\t\t\t\t\t\tshowTextOutline={false}\n\t\t\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\ttransform: `scale(${scale})`,\n\t\t\t\t\t\t\t\t\t\t\ttransformOrigin: 'top left',\n\t\t\t\t\t\t\t\t\t\t\twidth: dv.noteWidth,\n\t\t\t\t\t\t\t\t\t\t\theight: dv.noteHeight + shape.props.growY,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t\t{'url' in shape.props && shape.props.url && <HyperlinkButton url={shape.props.url} />}\n\t\t\t</>\n\t\t)\n\t}\n\n\toverride getIndicatorPath(shape: TLNoteShape): Path2D {\n\t\tconst { scale } = shape.props\n\t\tconst dv = getDisplayValues(this, shape)\n\t\tconst path = new Path2D()\n\t\tpath.rect(0, 0, dv.noteWidth * scale, getNoteHeight(shape, dv.noteHeight))\n\t\treturn path\n\t}\n\n\toverride toSvg(shape: TLNoteShape, ctx: SvgExportContext) {\n\t\tconst dv = getDisplayValues(this, shape, ctx.colorMode)\n\t\tconst bounds = new Box(0, 0, dv.noteWidth, dv.noteHeight + shape.props.growY)\n\n\t\tconst filterId = `note-shadow-${shape.id.replace(/:/g, '_')}` as SafeId\n\n\t\tctx.addExportDef({\n\t\t\tkey: filterId,\n\t\t\tgetElement: () => (\n\t\t\t\t<filter id={filterId} x=\"-10%\" y=\"-10%\" width=\"130%\" height=\"150%\">\n\t\t\t\t\t<feMorphology in=\"SourceAlpha\" operator=\"erode\" radius=\"3\" result=\"erode1\" />\n\t\t\t\t\t<feGaussianBlur in=\"erode1\" stdDeviation=\"3\" result=\"blur1\" />\n\t\t\t\t\t<feOffset in=\"blur1\" dy=\"3\" result=\"offsetBlur1\" />\n\t\t\t\t\t<feComponentTransfer in=\"offsetBlur1\" result=\"shadow1\">\n\t\t\t\t\t\t<feFuncA type=\"linear\" slope=\"0.5\" />\n\t\t\t\t\t</feComponentTransfer>\n\t\t\t\t\t<feMorphology in=\"SourceAlpha\" operator=\"erode\" radius=\"10\" result=\"erode2\" />\n\t\t\t\t\t<feGaussianBlur in=\"erode2\" stdDeviation=\"6\" result=\"blur2\" />\n\t\t\t\t\t<feOffset in=\"blur2\" dy=\"6\" result=\"offsetBlur2\" />\n\t\t\t\t\t<feComponentTransfer in=\"offsetBlur2\" result=\"shadow2\">\n\t\t\t\t\t\t<feFuncA type=\"linear\" slope=\"0.5\" />\n\t\t\t\t\t</feComponentTransfer>\n\t\t\t\t\t<feMerge>\n\t\t\t\t\t\t<feMergeNode in=\"shadow1\" />\n\t\t\t\t\t\t<feMergeNode in=\"shadow2\" />\n\t\t\t\t\t\t<feMergeNode in=\"SourceGraphic\" />\n\t\t\t\t\t</feMerge>\n\t\t\t\t</filter>\n\t\t\t),\n\t\t})\n\n\t\tconst { textFirstEditedBy } = shape.props\n\t\tconst attributionFirstName =\n\t\t\ttextFirstEditedBy && !isEmptyRichText(shape.props.richText)\n\t\t\t\t? this.editor.getAttributionDisplayName(textFirstEditedBy)?.split(' ')[0]\n\t\t\t\t: null\n\t\tconst attributionName = attributionFirstName\n\t\t\t? truncateAttributionForSvg(this.editor, attributionFirstName, dv.noteWidth)\n\t\t\t: null\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ctx.isDarkMode ? null : (\n\t\t\t\t\t<rect\n\t\t\t\t\t\trx={1}\n\t\t\t\t\t\twidth={dv.noteWidth}\n\t\t\t\t\t\theight={bounds.h}\n\t\t\t\t\t\tfill={dv.noteBackgroundColor}\n\t\t\t\t\t\tfilter={`url(#${filterId})`}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t<rect rx={1} width={dv.noteWidth} height={bounds.h} fill={dv.noteBackgroundColor} />\n\t\t\t\t<RichTextSVG\n\t\t\t\t\tfontSize={(shape.props.fontSizeAdjustment ?? 1) * dv.labelFontSize}\n\t\t\t\t\tfontFamily={dv.labelFontFamily}\n\t\t\t\t\tlineHeight={dv.labelLineHeight}\n\t\t\t\t\ttextAlign={dv.labelHorizontalAlign}\n\t\t\t\t\tverticalAlign={dv.labelVerticalAlign}\n\t\t\t\t\trichText={shape.props.richText}\n\t\t\t\t\tlabelColor={dv.labelColor}\n\t\t\t\t\tbounds={bounds}\n\t\t\t\t\tpadding={dv.labelPadding}\n\t\t\t\t\tshowTextOutline={false}\n\t\t\t\t/>\n\t\t\t\t{attributionName && (\n\t\t\t\t\t<text\n\t\t\t\t\t\tx={dv.noteWidth - 8}\n\t\t\t\t\t\ty={bounds.h - 6}\n\t\t\t\t\t\ttextAnchor=\"end\"\n\t\t\t\t\t\tfontFamily={DefaultFontFamilies['sans']}\n\t\t\t\t\t\tfontSize={11}\n\t\t\t\t\t\tfill={dv.labelColor}\n\t\t\t\t\t\topacity={0.6}\n\t\t\t\t\t>\n\t\t\t\t\t\t{attributionName}\n\t\t\t\t\t</text>\n\t\t\t\t)}\n\t\t\t</>\n\t\t)\n\t}\n\n\toverride onBeforeCreate(next: TLNoteShape) {\n\t\treturn this.getNoteSizeAdjustments(next)\n\t}\n\n\toverride onBeforeUpdate(prev: TLNoteShape, next: TLNoteShape) {\n\t\tconst richTextChanged = !isEqual(prev.props.richText, next.props.richText)\n\n\t\tif (\n\t\t\t!richTextChanged &&\n\t\t\tprev.props.font === next.props.font &&\n\t\t\tprev.props.size === next.props.size\n\t\t) {\n\t\t\treturn\n\t\t}\n\n\t\tlet shape = next\n\t\tif (richTextChanged) {\n\t\t\tif (isEmptyRichText(next.props.richText)) {\n\t\t\t\tshape = {\n\t\t\t\t\t...shape,\n\t\t\t\t\tprops: { ...shape.props, textFirstEditedBy: null },\n\t\t\t\t}\n\t\t\t} else if (!prev.props.textFirstEditedBy) {\n\t\t\t\tshape = {\n\t\t\t\t\t...shape,\n\t\t\t\t\tprops: { ...shape.props, textFirstEditedBy: this.editor.getAttributionUserId() },\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn this.getNoteSizeAdjustments(shape) ?? (richTextChanged ? shape : undefined)\n\t}\n\n\toverride getInterpolatedProps(\n\t\tstartShape: TLNoteShape,\n\t\tendShape: TLNoteShape,\n\t\tt: number\n\t): TLNoteShapeProps {\n\t\treturn {\n\t\t\t...(t > 0.5 ? endShape.props : startShape.props),\n\t\t\tscale: lerp(startShape.props.scale, endShape.props.scale, t),\n\t\t}\n\t}\n\n\t/**\n\t * Get the growY and fontSizeAdjustment for a shape.\n\t */\n\tprivate getNoteSizeAdjustments(shape: TLNoteShape) {\n\t\tconst dv = getDisplayValues(this, shape)\n\t\tconst { labelHeight, fontSizeAdjustment } = this.getLabelSize(shape)\n\t\t// When the label height is more than the height of the shape, we add extra height to it\n\t\tconst growY = Math.max(0, labelHeight - dv.noteHeight)\n\n\t\tif (growY !== shape.props.growY || fontSizeAdjustment !== shape.props.fontSizeAdjustment) {\n\t\t\treturn {\n\t\t\t\t...shape,\n\t\t\t\tprops: {\n\t\t\t\t\t...shape.props,\n\t\t\t\t\tgrowY,\n\t\t\t\t\tfontSizeAdjustment,\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\n\t\treturn undefined\n\t}\n\n\tprivate _labelSizesForNoteCache = new WeakCache<\n\t\tTLShape,\n\t\t{ labelHeight: number; labelWidth: number; fontSizeAdjustment: number }\n\t>()\n\n\t/**\n\t * Get the cached label size for the shape.\n\t */\n\tprivate getLabelSize(shape: TLNoteShape) {\n\t\treturn this._labelSizesForNoteCache.get(shape, () => this.measureNoteLabelSize(shape))\n\t}\n\n\t/**\n\t * Expensively measure the label size for a note shape.\n\t */\n\tprivate measureNoteLabelSize(shape: TLNoteShape) {\n\t\tconst dv = getDisplayValues(this, shape)\n\t\tconst { richText } = shape.props\n\n\t\tif (isEmptyRichText(richText)) {\n\t\t\tconst minHeight = dv.labelFontSize * dv.labelLineHeight + dv.labelPadding * 2\n\t\t\treturn { labelHeight: minHeight, labelWidth: 100, fontSizeAdjustment: 1 }\n\t\t}\n\n\t\tconst unadjustedFontSize = dv.labelFontSize\n\n\t\tlet fontSizeAdjustment = unadjustedFontSize\n\t\tlet iterations = 0\n\t\tlet labelHeight = dv.noteHeight\n\t\tlet labelWidth = dv.noteWidth\n\n\t\t// N.B. For some note shapes with text like 'hjhjhjhjhjhjhjhj', you'll run into\n\t\t// some text measurement fuzziness where the browser swears there's no overflow (scrollWidth === width)\n\t\t// but really there is when you enable overflow-wrap again. This helps account for that little bit\n\t\t// of give.\n\t\tconst FUZZ = 1\n\n\t\t// We slightly make the font smaller if the text is too big for the note, width-wise.\n\t\tdo {\n\t\t\tfontSizeAdjustment = Math.min(unadjustedFontSize, unadjustedFontSize - iterations)\n\t\t\tconst html = renderHtmlFromRichTextForMeasurement(this.editor, richText)\n\t\t\tconst nextTextSize = this.editor.textMeasure.measureHtml(html, {\n\t\t\t\t...TEXT_PROPS,\n\t\t\t\tlineHeight: dv.labelLineHeight,\n\t\t\t\tfontFamily: dv.labelFontFamily,\n\t\t\t\tfontSize: fontSizeAdjustment,\n\t\t\t\tmaxWidth: dv.noteWidth - dv.labelPadding * 2 - FUZZ,\n\t\t\t\tdisableOverflowWrapBreaking: true,\n\t\t\t\tmeasureScrollWidth: true,\n\t\t\t})\n\n\t\t\tlabelHeight = nextTextSize.h + dv.labelPadding * 2\n\t\t\tlabelWidth = nextTextSize.w + dv.labelPadding * 2\n\n\t\t\tif (fontSizeAdjustment <= 14) {\n\t\t\t\t// Too small, just rely now on CSS `overflow-wrap: break-word`\n\t\t\t\t// We need to recalculate the text measurement here with break-word enabled.\n\t\t\t\tconst html = renderHtmlFromRichTextForMeasurement(this.editor, richText)\n\t\t\t\tconst nextTextSizeWithOverflowBreak = this.editor.textMeasure.measureHtml(html, {\n\t\t\t\t\t...TEXT_PROPS,\n\t\t\t\t\tlineHeight: dv.labelLineHeight,\n\t\t\t\t\tfontFamily: dv.labelFontFamily,\n\t\t\t\t\tfontSize: fontSizeAdjustment,\n\t\t\t\t\tmaxWidth: dv.noteWidth - dv.labelPadding * 2 - FUZZ,\n\t\t\t\t})\n\t\t\t\tlabelHeight = nextTextSizeWithOverflowBreak.h + dv.labelPadding * 2\n\t\t\t\tlabelWidth = nextTextSizeWithOverflowBreak.w + dv.labelPadding * 2\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif (nextTextSize.scrollWidth.toFixed(0) === nextTextSize.w.toFixed(0)) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t} while (iterations++ < 50)\n\n\t\treturn {\n\t\t\tlabelHeight: labelHeight,\n\t\t\tlabelWidth: labelWidth,\n\t\t\tfontSizeAdjustment:\n\t\t\t\tfontSizeAdjustment === unadjustedFontSize ? 1 : fontSizeAdjustment / unadjustedFontSize,\n\t\t}\n\t}\n}\n\nfunction useNoteKeydownHandler(id: TLShapeId) {\n\tconst editor = useEditor()\n\t// Try to get the translation context, but fallback to ltr if it doesn't exist\n\tconst translation = useContext(TranslationsContext)\n\n\treturn useCallback(\n\t\t(e: KeyboardEvent) => {\n\t\t\tconst shape = editor.getShape<TLNoteShape>(id)\n\t\t\tif (!shape) return\n\n\t\t\tconst isTab = e.key === 'Tab'\n\t\t\tconst isCmdEnter = (e.metaKey || e.ctrlKey) && e.key === 'Enter'\n\t\t\tif (isTab || isCmdEnter) {\n\t\t\t\te.preventDefault()\n\n\t\t\t\tconst pageTransform = editor.getShapePageTransform(id)\n\t\t\t\tconst pageRotation = pageTransform.rotation()\n\n\t\t\t\t// Based on the inputs, calculate the offset to the next note\n\t\t\t\t// tab controls x axis (shift inverts direction set by RTL)\n\t\t\t\t// cmd enter is the y axis (shift inverts direction)\n\t\t\t\tconst isRTL = !!(\n\t\t\t\t\ttranslation?.dir === 'rtl' ||\n\t\t\t\t\t// todo: can we check a partial of the text, so that we don't have to render the whole thing?\n\t\t\t\t\tisRightToLeftLanguage(renderPlaintextFromRichText(editor, shape.props.richText))\n\t\t\t\t)\n\n\t\t\t\tconst noteUtil = editor.getShapeUtil(shape) as NoteShapeUtil\n\t\t\t\tconst dv = getDisplayValues(noteUtil, shape)\n\n\t\t\t\tconst noteOffset = isTab\n\t\t\t\t\t? dv.noteWidth + editor.options.adjacentShapeMargin\n\t\t\t\t\t: dv.noteHeight +\n\t\t\t\t\t\teditor.options.adjacentShapeMargin +\n\t\t\t\t\t\t// If we're growing down, we need to account for the current shape's growY\n\t\t\t\t\t\t(isCmdEnter && !e.shiftKey ? shape.props.growY : 0)\n\t\t\t\tconst offsetLength = noteOffset * shape.props.scale\n\n\t\t\t\tconst adjacentCenter = new Vec(\n\t\t\t\t\tisTab ? (e.shiftKey != isRTL ? -1 : 1) : 0,\n\t\t\t\t\tisCmdEnter ? (e.shiftKey ? -1 : 1) : 0\n\t\t\t\t)\n\t\t\t\t\t.mul(offsetLength)\n\t\t\t\t\t.add(new Vec(dv.noteWidth / 2, dv.noteHeight / 2).mul(shape.props.scale))\n\t\t\t\t\t.rot(pageRotation)\n\t\t\t\t\t.add(pageTransform.point())\n\n\t\t\t\tconst newNote = getNoteShapeForAdjacentPosition(editor, {\n\t\t\t\t\tshape,\n\t\t\t\t\tcenter: adjacentCenter,\n\t\t\t\t\tpageRotation,\n\t\t\t\t\tnoteWidth: dv.noteWidth,\n\t\t\t\t\tnoteHeight: dv.noteHeight,\n\t\t\t\t})\n\n\t\t\t\tif (newNote) {\n\t\t\t\t\tstartEditingShapeWithRichText(editor, newNote, { selectAll: true })\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[id, editor, translation?.dir]\n\t)\n}\n\nfunction getNoteHeight(shape: TLNoteShape, noteHeight: number) {\n\treturn (noteHeight + shape.props.growY) * shape.props.scale\n}\n\n// Matches `.tl-note__attribution { max-width: 60% }` so SVG export truncates the same way.\nconst ATTRIBUTION_MAX_WIDTH_RATIO = 0.6\n\nfunction truncateAttributionForSvg(editor: Editor, name: string, noteWidth: number) {\n\tif (process.env.NODE_ENV === 'test') return name\n\tconst spans = editor.textMeasure.measureTextSpans(name, {\n\t\tfontSize: 11,\n\t\tfontFamily: DefaultFontFamilies['sans'],\n\t\ttextAlign: 'end',\n\t\twidth: noteWidth * ATTRIBUTION_MAX_WIDTH_RATIO,\n\t\theight: 16,\n\t\tpadding: 0,\n\t\tlineHeight: 1,\n\t\tfontStyle: 'normal',\n\t\tfontWeight: 'normal',\n\t\toverflow: 'truncate-ellipsis',\n\t})\n\tif (spans.length === 0) return name\n\treturn spans.map((s) => s.text).join('')\n}\n\nfunction getNoteShadow(id: string, rotation: number, scale: number) {\n\tconst random = rng(id) // seeded based on id\n\tconst lift = Math.abs(random()) + 0.5 // 0 to 1.5\n\tconst oy = Math.cos(rotation)\n\tconst a = 5 * scale\n\tconst b = 4 * scale\n\tconst c = 6 * scale\n\tconst d = 7 * scale\n\t// Clamped so shadow never goes above the note at small scales (e.g. dynamic size mode at high zoom)\n\treturn `0px ${Math.max(0, a - lift)}px ${a}px -${a}px rgba(15, 23, 31, .6),\n\t0px ${(b + lift * d) * Math.max(0, oy)}px ${c + lift * d}px -${b + lift * c}px rgba(15, 23, 31, ${(0.3 + lift * 0.1).toFixed(2)}),\n\t0px ${48 * scale}px ${10 * scale}px -${10 * scale}px inset rgba(15, 23, 44, ${((0.022 + random() * 0.005) * ((1 + oy) / 2)).toFixed(2)})`\n}\n"],
  "mappings": "AAqWG,mBAgBI,KAfH,YADD;AApWH;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EAEA;AA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