{
  "version": 3,
  "sources": ["../../../../src/lib/shapes/geo/GeoShapeUtil.tsx"],
  "sourcesContent": ["/* eslint-disable react-hooks/rules-of-hooks */\nimport {\n\tBaseBoxShapeUtil,\n\tBox,\n\tEMPTY_ARRAY,\n\tEditor,\n\tGeoShapeGeoStyle,\n\tGroup2d,\n\tHTMLContainer,\n\tHandleSnapGeometry,\n\tRectangle2d,\n\tSVGContainer,\n\tSvgExportContext,\n\tTLGeoShape,\n\tTLGeoShapeProps,\n\tTLMeasureTextOpts,\n\tTLResizeInfo,\n\tTLShape,\n\tTLShapeId,\n\tTLShapeUtilCanvasSvgDef,\n\tTLShapeUtilConstructor,\n\tVec,\n\tVecLike,\n\tWeakCache,\n\tapproximately,\n\tareAnglesCompatible,\n\tgeoShapeMigrations,\n\tgeoShapeProps,\n\tgetColorValue,\n\tgetFontsFromRichText,\n\tisEqual,\n\tlerp,\n\ttoRichText,\n\tuseColorMode,\n\tuseValue,\n} from '@tldraw/editor'\nimport {\n\tisEmptyRichText,\n\trenderHtmlFromRichTextForMeasurement,\n\trenderPlaintextFromRichText,\n} from '../../utils/text/richText'\nimport {\n\tLABEL_FONT_SIZES,\n\tLABEL_PADDING,\n\tSTROKE_SIZES,\n\tTEXT_PROPS,\n\tgetFontFamily,\n} from '../shared/default-shape-constants'\nimport { DEFAULT_FILL_COLOR_NAMES } from '../shared/defaultFills'\nimport { getThemeFontFaces } from '../shared/defaultFonts'\nimport { getFillDefForCanvas, getFillDefForExport } from '../shared/defaultStyleDefs'\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 { GeoShapeBody } from './GeoShapeBody'\nimport {\n\tdefaultGeoTypeDefinitions,\n\ttype GeoTypeDefinition,\n\tgetGeoShapePath,\n\tgetGeoTypeDefinition,\n} from './getGeoShapePath'\n\n// imperfect but good enough, should be the width of the W in the font / size combo\nconst GEO_SHAPE_MIN_WIDTHS = Object.freeze({\n\ts: 12,\n\tm: 14,\n\tl: 16,\n\txl: 20,\n})\n\n// Extra padding for geo shape labels matches the stroke width\n// Computed dynamically in getDisplayValues via theme.strokeWidth * STROKE_SIZES[size]\n\nconst GEO_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 GEO_SHAPE_VERTICAL_ALIGNS = Object.freeze({\n\tstart: 'start',\n\tmiddle: 'middle',\n\tend: 'end',\n} as const)\n\nconst GEO_SHAPE_EMPTY_LABEL_SIZE = Object.freeze({ w: 0, h: 0 })\n\n// Snapshot the built-in geo types at module init so that collision detection\n// in `configure()` only fires against the built-ins, not against keys added\n// by previous `configure()` calls. This lets repeat `configure()` calls reuse\n// the same custom key (e.g. when wrapping/extending the util) without having\n// the entry stripped from `options.customGeoTypes`.\nconst BUILTIN_GEO_TYPES: ReadonlySet<string> = new Set(Object.keys(defaultGeoTypeDefinitions))\n\n/** @public */\nexport interface GeoShapeUtilDisplayValues {\n\tstrokeColor: string\n\tstrokeRoundness: number\n\tstrokeWidth: number\n\tfillColor: string\n\tpatternFillFallbackColor: string\n\tlabelColor: string\n\tlabelFontFamily: string\n\tlabelFontSize: number\n\tlabelMinWidth: number\n\tlabelExtraPadding: number\n\tlabelLineHeight: number\n\tlabelFontWeight: string\n\tlabelFontVariant: string\n\tlabelFontStyle: string\n\tlabelHorizontalAlign: 'start' | 'center' | 'end'\n\tlabelVerticalAlign: 'start' | 'middle' | 'end'\n\tlabelPadding: number\n\tlabelEdgeMargin: number\n\tminSizeWithLabel: number\n}\n\n/** @public */\nexport interface GeoShapeOptions extends ShapeOptionsWithDisplayValues<\n\tTLGeoShape,\n\tGeoShapeUtilDisplayValues\n> {\n\tshowTextOutline: boolean\n\t/**\n\t * A map of custom geo type definitions. Each key becomes a new value for\n\t * {@link @tldraw/editor#GeoShapeGeoStyle} that can be used in the style panel\n\t * and on shapes. Custom geo types inherit all standard geo shape behavior\n\t * (labels, resizing, styling, etc.).\n\t *\n\t * @example\n\t * ```ts\n\t * const MyGeoShapeUtil = GeoShapeUtil.configure({\n\t *   customGeoTypes: {\n\t *     'my-shape': {\n\t *       getPath: (w, h) => new PathBuilder().moveTo(0, 0).lineTo(w, 0).lineTo(w, h).lineTo(0, h).close(),\n\t *       snapType: 'polygon',\n\t *       icon: 'geo-rectangle',\n\t *     },\n\t *   },\n\t * })\n\t * ```\n\t */\n\tcustomGeoTypes?: Record<string, GeoTypeDefinition>\n}\n\n/** @public */\nexport class GeoShapeUtil extends BaseBoxShapeUtil<TLGeoShape> {\n\tstatic override type = 'geo' as const\n\tstatic override props = geoShapeProps\n\tstatic override migrations = geoShapeMigrations\n\n\tstatic override configure<T extends TLShapeUtilConstructor<any, any>>(\n\t\tthis: T,\n\t\toptions: T extends new (...args: any[]) => { options: infer Options } ? Partial<Options> : never\n\t): T {\n\t\tconst opts = options as Partial<GeoShapeOptions>\n\t\tif (opts.customGeoTypes) {\n\t\t\tconst validEntries: Array<[string, GeoTypeDefinition]> = []\n\t\t\tfor (const [key, def] of Object.entries(opts.customGeoTypes)) {\n\t\t\t\tif (BUILTIN_GEO_TYPES.has(key)) {\n\t\t\t\t\tif (process.env.NODE_ENV !== 'production') {\n\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t`[GeoShapeUtil.configure] customGeoTypes key \"${key}\" collides with a built-in geo type and will be ignored. Please use a unique name.`\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tvalidEntries.push([key, def])\n\t\t\t}\n\t\t\tif (validEntries.length > 0) {\n\t\t\t\tGeoShapeGeoStyle.addValues(\n\t\t\t\t\t...(validEntries.map(([k]) => k) as Parameters<typeof GeoShapeGeoStyle.addValues>)\n\t\t\t\t)\n\t\t\t}\n\t\t\t// Strip colliding entries from the options so runtime lookups (tool\n\t\t\t// defaultSize, style panel icons, double-click handlers) don't see them.\n\t\t\tconst filtered = { ...opts, customGeoTypes: Object.fromEntries(validEntries) }\n\t\t\treturn super.configure(filtered as unknown as typeof options) as T\n\t\t}\n\t\treturn super.configure(options) as T\n\t}\n\n\toverride options: GeoShapeOptions = {\n\t\tshowTextOutline: true,\n\t\tgetDefaultDisplayValues(_editor, shape, theme, colorMode): GeoShapeUtilDisplayValues {\n\t\t\tconst { color, size, labelColor, fill, align, verticalAlign, font } = shape.props\n\t\t\tconst colors = theme.colors[colorMode]\n\n\t\t\treturn {\n\t\t\t\tstrokeColor: getColorValue(colors, color, 'solid'),\n\t\t\t\tstrokeRoundness: theme.strokeWidth * STROKE_SIZES[size] * 2,\n\t\t\t\tstrokeWidth: theme.strokeWidth * STROKE_SIZES[size],\n\t\t\t\tfillColor:\n\t\t\t\t\tfill === 'none'\n\t\t\t\t\t\t? 'transparent'\n\t\t\t\t\t\t: fill === 'semi'\n\t\t\t\t\t\t\t? colors.solid\n\t\t\t\t\t\t\t: getColorValue(colors, color, DEFAULT_FILL_COLOR_NAMES[fill]),\n\t\t\t\tpatternFillFallbackColor: getColorValue(colors, color, 'semi'),\n\t\t\t\tlabelColor: getColorValue(colors, labelColor, 'solid'), // todo: separate from the solid color (or create more named colors in the palette so that these could be configured separately)\n\t\t\t\tlabelFontFamily: getFontFamily(theme, font),\n\t\t\t\tlabelFontSize: theme.fontSize * LABEL_FONT_SIZES[size],\n\t\t\t\tlabelMinWidth: GEO_SHAPE_MIN_WIDTHS[size],\n\t\t\t\tlabelExtraPadding: theme.strokeWidth * STROKE_SIZES[size],\n\t\t\t\tlabelLineHeight: theme.lineHeight,\n\t\t\t\tlabelFontWeight: 'normal',\n\t\t\t\tlabelFontVariant: 'normal',\n\t\t\t\tlabelFontStyle: 'normal',\n\t\t\t\tlabelHorizontalAlign: GEO_SHAPE_HORIZONTAL_ALIGNS[align],\n\t\t\t\tlabelVerticalAlign: GEO_SHAPE_VERTICAL_ALIGNS[verticalAlign],\n\t\t\t\tlabelPadding: LABEL_PADDING,\n\t\t\t\t// Margin between label edge and shape edge (in unscaled units)\n\t\t\t\tlabelEdgeMargin: 8,\n\t\t\t\t// Minimum size of the shape to fit a label, based on font size and padding (in unscaled units)\n\t\t\t\tminSizeWithLabel: (LABEL_PADDING + 1) * 3,\n\t\t\t}\n\t\t},\n\t\tgetCustomDisplayValues(_editor, _shape): Partial<GeoShapeUtilDisplayValues> {\n\t\t\treturn {}\n\t\t},\n\t}\n\n\toverride canEdit(shape: TLGeoShape) {\n\t\treturn true\n\t}\n\n\toverride getDefaultProps(): TLGeoShape['props'] {\n\t\treturn {\n\t\t\tw: 100,\n\t\t\th: 100,\n\t\t\tgeo: 'rectangle',\n\t\t\tdash: 'draw',\n\t\t\tgrowY: 0,\n\t\t\turl: '',\n\t\t\tscale: 1,\n\n\t\t\t// Text properties\n\t\t\tcolor: 'black',\n\t\t\tlabelColor: 'black',\n\t\t\tfill: 'none',\n\t\t\tsize: 'm',\n\t\t\tfont: 'draw',\n\t\t\talign: 'middle',\n\t\t\tverticalAlign: 'middle',\n\t\t\trichText: toRichText(''),\n\t\t}\n\t}\n\n\toverride getGeometry(shape: TLGeoShape) {\n\t\tconst { props } = shape\n\t\tconst { scale } = props\n\t\tconst dv = getDisplayValues(this, shape)\n\t\tconst path = getGeoShapePath(shape, dv.strokeWidth, this.options.customGeoTypes)\n\t\tconst pathGeometry = path.toGeometry()\n\n\t\tconst scaledW = Math.max(1, props.w)\n\t\tconst scaledH = Math.max(1, props.h + props.growY)\n\t\tconst unscaledShapeW = scaledW / scale\n\t\tconst unscaledShapeH = scaledH / scale\n\n\t\tconst isEmptyLabel = isEmptyRichText(props.richText)\n\t\tconst unscaledLabelSize = isEmptyLabel\n\t\t\t? GEO_SHAPE_EMPTY_LABEL_SIZE\n\t\t\t: this.getUnscaledLabelSize(shape)\n\n\t\t// Calculate minimum label dimensions based on font size and shape size\n\t\tconst unscaledMinWidth = Math.min(100, unscaledShapeW / 2)\n\t\tconst unscaledMinHeight = Math.min(\n\t\t\tdv.labelFontSize * dv.labelLineHeight + dv.labelPadding * 2,\n\t\t\tunscaledShapeH / 2\n\t\t)\n\n\t\t// Label dimensions: at least the measured size, but constrained to shape bounds\n\t\tconst unscaledLabelW = Math.min(\n\t\t\tunscaledShapeW,\n\t\t\tMath.max(\n\t\t\t\tunscaledLabelSize.w,\n\t\t\t\tMath.min(unscaledMinWidth, Math.max(1, unscaledShapeW - dv.labelEdgeMargin))\n\t\t\t)\n\t\t)\n\t\tconst unscaledLabelH = Math.min(\n\t\t\tunscaledShapeH,\n\t\t\tMath.max(\n\t\t\t\tunscaledLabelSize.h,\n\t\t\t\tMath.min(unscaledMinHeight, Math.max(1, unscaledShapeH - dv.labelEdgeMargin))\n\t\t\t)\n\t\t)\n\n\t\t// Calculate position based on alignment\n\t\tconst unscaledX =\n\t\t\tdv.labelHorizontalAlign === 'start'\n\t\t\t\t? 0\n\t\t\t\t: dv.labelHorizontalAlign === 'end'\n\t\t\t\t\t? unscaledShapeW - unscaledLabelW\n\t\t\t\t\t: (unscaledShapeW - unscaledLabelW) / 2\n\n\t\tconst unscaledY =\n\t\t\tdv.labelVerticalAlign === 'start'\n\t\t\t\t? 0\n\t\t\t\t: dv.labelVerticalAlign === 'end'\n\t\t\t\t\t? unscaledShapeH - unscaledLabelH\n\t\t\t\t\t: (unscaledShapeH - unscaledLabelH) / 2\n\n\t\tconst labelBounds = {\n\t\t\tx: unscaledX * scale,\n\t\t\ty: unscaledY * scale,\n\t\t\twidth: unscaledLabelW * scale,\n\t\t\theight: unscaledLabelH * scale,\n\t\t}\n\n\t\treturn new Group2d({\n\t\t\tchildren: [\n\t\t\t\tpathGeometry,\n\t\t\t\tnew Rectangle2d({\n\t\t\t\t\t...labelBounds,\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\tisEmptyLabel: isEmptyLabel,\n\t\t\t\t}),\n\t\t\t],\n\t\t})\n\t}\n\n\toverride getHandleSnapGeometry(shape: TLGeoShape): HandleSnapGeometry {\n\t\tconst geometry = this.getGeometry(shape)\n\t\t// we only want to snap handles to the outline of the shape - not to its label etc.\n\t\tconst outline = geometry.children[0]\n\t\tconst def = getGeoTypeDefinition(shape.props.geo, this.options.customGeoTypes)\n\t\tif (!def) {\n\t\t\tthrow new Error(`Unknown geo type: ${shape.props.geo}`)\n\t\t}\n\t\t// blobby shapes only snap to the center; polygon shapes snap to vertices + center.\n\t\tif (def.snapType === 'blobby') {\n\t\t\treturn { outline: outline, points: [geometry.bounds.center] }\n\t\t}\n\t\treturn { outline: outline, points: [...outline.vertices, geometry.bounds.center] }\n\t}\n\n\toverride getText(shape: TLGeoShape) {\n\t\treturn renderPlaintextFromRichText(this.editor, shape.props.richText)\n\t}\n\n\toverride getFontFaces(shape: TLGeoShape) {\n\t\tif (isEmptyRichText(shape.props.richText)) {\n\t\t\treturn EMPTY_ARRAY\n\t\t}\n\t\tconst themeFaces = getThemeFontFaces(this.editor.getCurrentTheme(), shape.props.font)\n\t\tif (themeFaces) return themeFaces\n\t\treturn getFontsFromRichText(this.editor, shape.props.richText, {\n\t\t\tfamily: `tldraw_${shape.props.font}`,\n\t\t\tweight: 'normal',\n\t\t\tstyle: 'normal',\n\t\t})\n\t}\n\n\tcomponent(shape: TLGeoShape) {\n\t\tconst { id, type, props } = shape\n\t\tconst { editor } = this\n\t\tconst isOnlySelected = useValue(\n\t\t\t'isGeoOnlySelected',\n\t\t\t() => shape.id === editor.getOnlySelectedShapeId(),\n\t\t\t[editor]\n\t\t)\n\t\tconst isReadyForEditing = useIsReadyForEditing(editor, shape.id)\n\t\tconst isForceSolid = useEfficientZoomThreshold(0.25 / shape.props.scale)\n\t\tconst colorMode = useColorMode()\n\t\tconst dv = getDisplayValues(this, shape, colorMode)\n\n\t\tconst { w, h, richText, url } = props\n\n\t\tconst isEmpty = isEmptyRichText(richText)\n\t\tconst showHtmlContainer = isReadyForEditing || !isEmpty\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<SVGContainer>\n\t\t\t\t\t<GeoShapeBody\n\t\t\t\t\t\tshape={shape}\n\t\t\t\t\t\tshouldScale={true}\n\t\t\t\t\t\tforceSolid={isForceSolid}\n\t\t\t\t\t\tstrokeColor={dv.strokeColor}\n\t\t\t\t\t\tstrokeWidth={dv.strokeWidth}\n\t\t\t\t\t\tfillColor={dv.fillColor}\n\t\t\t\t\t\tpatternFillFallbackColor={dv.patternFillFallbackColor}\n\t\t\t\t\t\tcustomGeoTypes={this.options.customGeoTypes}\n\t\t\t\t\t/>\n\t\t\t\t</SVGContainer>\n\t\t\t\t{showHtmlContainer && (\n\t\t\t\t\t<HTMLContainer\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\twidth: w,\n\t\t\t\t\t\t\theight: h + props.growY,\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\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={dv.labelFontSize}\n\t\t\t\t\t\t\tlineHeight={dv.labelLineHeight}\n\t\t\t\t\t\t\tpadding={dv.labelPadding}\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={isOnlySelected}\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\tshowTextOutline={this.options.showTextOutline}\n\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\tshape.props.scale !== 1\n\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\ttransform: `scale(${shape.props.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: shape.props.w / shape.props.scale,\n\t\t\t\t\t\t\t\t\t\t\theight: (shape.props.h + props.growY) / shape.props.scale,\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</HTMLContainer>\n\t\t\t\t)}\n\t\t\t\t{url && <HyperlinkButton url={url} />}\n\t\t\t</>\n\t\t)\n\t}\n\n\toverride getIndicatorPath(shape: TLGeoShape): Path2D | undefined {\n\t\tconst isForceSolid = this.editor.getEfficientZoomLevel() < 0.25 / shape.props.scale\n\n\t\tconst { dash, scale } = shape.props\n\t\tconst dv = getDisplayValues(this, shape)\n\n\t\tconst path = getGeoShapePath(shape, dv.strokeWidth, this.options.customGeoTypes)\n\n\t\treturn path.toPath2D({\n\t\t\tstyle: dash === 'draw' ? 'draw' : 'solid',\n\t\t\tstrokeWidth: 1,\n\t\t\tpasses: 1,\n\t\t\trandomSeed: shape.id,\n\t\t\toffset: 0,\n\t\t\troundness: dv.strokeRoundness * scale,\n\t\t\tforceSolid: isForceSolid,\n\t\t})\n\t}\n\n\toverride toSvg(shape: TLGeoShape, ctx: SvgExportContext) {\n\t\tconst dv = getDisplayValues(this, shape, ctx.colorMode)\n\t\tconst { richText, fill, scale, growY, w, h } = shape.props\n\t\t// We need to scale the shape to 1x for export\n\t\tconst newShape = {\n\t\t\t...shape,\n\t\t\tprops: {\n\t\t\t\t...shape.props,\n\t\t\t\tw: w / scale,\n\t\t\t\th: (h + growY) / scale,\n\t\t\t\tgrowY: 0, // growY throws off the path calculations, so we set it to 0\n\t\t\t},\n\t\t}\n\t\tctx.addExportDef(getFillDefForExport(fill))\n\n\t\tlet textEl\n\t\tif (!isEmptyRichText(richText)) {\n\t\t\tconst bounds = new Box(0, 0, newShape.props.w, (h + growY) / scale)\n\t\t\ttextEl = (\n\t\t\t\t<RichTextSVG\n\t\t\t\t\tfontSize={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\tlabelColor={dv.labelColor}\n\t\t\t\t\tpadding={dv.labelPadding}\n\t\t\t\t\tshowTextOutline={this.options.showTextOutline}\n\t\t\t\t\tbounds={bounds}\n\t\t\t\t\trichText={richText}\n\t\t\t\t/>\n\t\t\t)\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<GeoShapeBody\n\t\t\t\t\tshouldScale={false}\n\t\t\t\t\tshape={newShape}\n\t\t\t\t\tforceSolid={false}\n\t\t\t\t\tstrokeColor={dv.strokeColor}\n\t\t\t\t\tstrokeWidth={dv.strokeWidth}\n\t\t\t\t\tfillColor={dv.fillColor}\n\t\t\t\t\tpatternFillFallbackColor={dv.patternFillFallbackColor}\n\t\t\t\t\tcustomGeoTypes={this.options.customGeoTypes}\n\t\t\t\t/>\n\t\t\t\t{textEl}\n\t\t\t</>\n\t\t)\n\t}\n\n\toverride getCanvasSvgDefs(): TLShapeUtilCanvasSvgDef[] {\n\t\treturn [getFillDefForCanvas()]\n\t}\n\n\toverride onResize(\n\t\tshape: TLGeoShape,\n\t\t{ handle, newPoint, scaleX, scaleY, initialShape }: TLResizeInfo<TLGeoShape>\n\t) {\n\t\tconst unscaledInitial = this.getUnscaledGeoProps(initialShape.props)\n\t\t// use the w/h from props here instead of the initialBounds here,\n\t\t// since cloud shapes calculated bounds can differ from the props w/h.\n\t\tlet unscaledW = unscaledInitial.w * scaleX\n\t\tlet unscaledH = (unscaledInitial.h + unscaledInitial.growY) * scaleY\n\t\tlet overShrinkX = 0\n\t\tlet overShrinkY = 0\n\n\t\tconst dv = getDisplayValues(this, shape)\n\n\t\tif (!isEmptyRichText(shape.props.richText)) {\n\t\t\tconst absUnscaledW = Math.abs(unscaledW)\n\t\t\tconst absUnscaledH = Math.abs(unscaledH)\n\t\t\t// Check the batch cache first (set by Resizing.ts during multi-shape resize).\n\t\t\t// If not cached, measure the label at the constrained target dimensions so text\n\t\t\t// wrapping is accounted for. We call measureUnscaledLabelSize directly (bypassing\n\t\t\t// WeakCache) since temp shapes with resize dimensions change every frame.\n\t\t\tconst cached = getBatchLabelSizeCache(this.editor)?.get(shape.id)\n\t\t\tlet unscaledLabelSize: { w: number; h: number }\n\t\t\tif (cached) {\n\t\t\t\tunscaledLabelSize = cached\n\t\t\t} else {\n\t\t\t\tconst measureW = Math.max(absUnscaledW, dv.minSizeWithLabel)\n\t\t\t\tconst measureH = Math.max(absUnscaledH, dv.minSizeWithLabel)\n\t\t\t\tunscaledLabelSize = this.measureUnscaledLabelSize({\n\t\t\t\t\t...shape,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t...shape.props,\n\t\t\t\t\t\tw: measureW * shape.props.scale,\n\t\t\t\t\t\th: measureH * shape.props.scale,\n\t\t\t\t\t},\n\t\t\t\t} as TLGeoShape)\n\t\t\t}\n\n\t\t\tconst constrainedW = Math.max(absUnscaledW, unscaledLabelSize.w)\n\t\t\tconst constrainedH = Math.max(absUnscaledH, unscaledLabelSize.h)\n\n\t\t\toverShrinkX = constrainedW - absUnscaledW\n\t\t\toverShrinkY = constrainedH - absUnscaledH\n\n\t\t\tunscaledW = constrainedW * Math.sign(unscaledW || 1)\n\t\t\tunscaledH = constrainedH * Math.sign(unscaledH || 1)\n\t\t}\n\n\t\tconst scaledW = unscaledW * shape.props.scale\n\t\tconst scaledH = unscaledH * shape.props.scale\n\n\t\tconst offset = new Vec(0, 0)\n\n\t\t// x offsets\n\n\t\tif (scaleX < 0) {\n\t\t\toffset.x += scaledW\n\t\t}\n\n\t\tif (handle === 'left' || handle === 'top_left' || handle === 'bottom_left') {\n\t\t\toffset.x += scaleX < 0 ? overShrinkX : -overShrinkX\n\t\t}\n\n\t\t// y offsets\n\n\t\tif (scaleY < 0) {\n\t\t\toffset.y += scaledH\n\t\t}\n\n\t\tif (handle === 'top' || handle === 'top_left' || handle === 'top_right') {\n\t\t\toffset.y += scaleY < 0 ? overShrinkY : -overShrinkY\n\t\t}\n\n\t\tconst { x, y } = offset.rot(shape.rotation).add(newPoint)\n\n\t\treturn {\n\t\t\tx,\n\t\t\ty,\n\t\t\tprops: {\n\t\t\t\tw: Math.max(Math.abs(scaledW), 1),\n\t\t\t\th: Math.max(Math.abs(scaledH), 1),\n\t\t\t\tgrowY: 0,\n\t\t\t},\n\t\t}\n\t}\n\n\toverride onBeforeCreate(shape: TLGeoShape) {\n\t\tconst { props } = shape\n\n\t\t// No text - ensure growY is 0\n\t\tif (isEmptyRichText(props.richText)) {\n\t\t\treturn props.growY !== 0 ? { ...shape, props: { ...props, growY: 0 } } : undefined\n\t\t}\n\n\t\t// Has text - calculate growY needed to fit label\n\t\tconst unscaledShapeH = props.h / props.scale\n\t\tconst unscaledLabelH = this.getUnscaledLabelSize(shape).h\n\t\tconst unscaledGrowY = this.calculateGrowY(\n\t\t\tunscaledShapeH,\n\t\t\tunscaledLabelH,\n\t\t\tprops.growY / props.scale\n\t\t)\n\n\t\tif (unscaledGrowY !== null) {\n\t\t\treturn {\n\t\t\t\t...shape,\n\t\t\t\tprops: { ...props, growY: unscaledGrowY * props.scale },\n\t\t\t}\n\t\t}\n\n\t\treturn undefined\n\t}\n\n\toverride onBeforeUpdate(prev: TLGeoShape, next: TLGeoShape) {\n\t\tconst { props: prevProps } = prev\n\t\tconst { props: nextProps } = next\n\n\t\t// No change to text, font, or size - no update needed\n\t\tif (\n\t\t\tisEqual(prevProps.richText, nextProps.richText) &&\n\t\t\tprevProps.font === nextProps.font &&\n\t\t\tprevProps.size === nextProps.size\n\t\t) {\n\t\t\treturn undefined\n\t\t}\n\n\t\tconst wasEmpty = isEmptyRichText(prevProps.richText)\n\t\tconst isEmpty = isEmptyRichText(nextProps.richText)\n\n\t\t// If label is empty and used to be empty, skip label measurement and dimension adjustment\n\t\tif (wasEmpty && isEmpty) {\n\t\t\treturn undefined\n\t\t}\n\n\t\t// Text was removed - reset growY\n\t\tif (isEmpty) {\n\t\t\treturn nextProps.growY !== 0 ? { ...next, props: { ...nextProps, growY: 0 } } : undefined\n\t\t}\n\n\t\tconst unscaledPrev = this.getUnscaledGeoProps(prevProps)\n\t\tconst unscaledLabelSize = this.getUnscaledLabelSize(next)\n\t\tconst { scale } = nextProps\n\n\t\t// Text was added for the first time - expand shape to fit (if wasEmpty and now there's text...\n\t\t// It might be just whitespace but it is faster to assume that it is NOT just whitespace and expand\n\t\t// the shape in either case (a label with just spaces text will be less performant but that's acceptable)\n\t\tif (wasEmpty && !isEmpty) {\n\t\t\tconst expanded = this.expandShapeForFirstLabel(\n\t\t\t\tnext,\n\t\t\t\tunscaledPrev.w,\n\t\t\t\tunscaledPrev.h,\n\t\t\t\tunscaledLabelSize\n\t\t\t)\n\t\t\treturn {\n\t\t\t\t...next,\n\t\t\t\tprops: {\n\t\t\t\t\t...nextProps,\n\t\t\t\t\tw: expanded.w * scale,\n\t\t\t\t\th: expanded.h * scale,\n\t\t\t\t\tgrowY: 0,\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\n\t\t// Text was modified - adjust dimensions to fit new label\n\t\tconst unscaledNextW = next.props.w / scale\n\t\tconst needsWidthExpand = unscaledLabelSize.w > unscaledNextW\n\t\tconst unscaledGrowY = this.calculateGrowY(\n\t\t\tunscaledPrev.h,\n\t\t\tunscaledLabelSize.h,\n\t\t\tunscaledPrev.growY\n\t\t)\n\n\t\tif (unscaledGrowY !== null || needsWidthExpand) {\n\t\t\treturn {\n\t\t\t\t...next,\n\t\t\t\tprops: {\n\t\t\t\t\t...nextProps,\n\t\t\t\t\tgrowY: (unscaledGrowY ?? unscaledPrev.growY) * scale,\n\t\t\t\t\tw: Math.max(unscaledNextW, unscaledLabelSize.w) * scale,\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\n\t\treturn undefined\n\t}\n\n\toverride onDoubleClick(shape: TLGeoShape) {\n\t\t// Little easter egg: double-clicking a rectangle / checkbox while\n\t\t// holding alt will toggle between check-box and rectangle\n\t\tif (this.editor.inputs.getAltKey()) {\n\t\t\tswitch (shape.props.geo) {\n\t\t\t\tcase 'rectangle': {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...shape,\n\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\tgeo: 'check-box' as const,\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcase 'check-box': {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...shape,\n\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\tgeo: 'rectangle' as const,\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst def = getGeoTypeDefinition(shape.props.geo, this.options.customGeoTypes)\n\t\tif (def?.onDoubleClick) {\n\t\t\tconst result = def.onDoubleClick(shape)\n\t\t\tif (result) {\n\t\t\t\treturn { ...shape, props: { ...shape.props, ...result.props } }\n\t\t\t}\n\t\t}\n\n\t\treturn\n\t}\n\n\toverride getInterpolatedProps(\n\t\tstartShape: TLGeoShape,\n\t\tendShape: TLGeoShape,\n\t\tt: number\n\t): TLGeoShapeProps {\n\t\treturn {\n\t\t\t...(t > 0.5 ? endShape.props : startShape.props),\n\t\t\tw: lerp(startShape.props.w, endShape.props.w, t),\n\t\t\th: lerp(startShape.props.h, endShape.props.h, t),\n\t\t\tscale: lerp(startShape.props.scale, endShape.props.scale, t),\n\t\t}\n\t}\n\n\t/**\n\t * Get the unscaled dimensions from a geo shape's props\n\t */\n\tprivate getUnscaledGeoProps(props: TLGeoShapeProps) {\n\t\tconst { w, h, growY, scale } = props\n\t\treturn {\n\t\t\tw: w / scale,\n\t\t\th: h / scale,\n\t\t\tgrowY: growY / scale,\n\t\t}\n\t}\n\n\t/**\n\t * Calculate the growY needed to fit a label within a shape.\n\t * Returns null if no change is needed, otherwise returns the new unscaled growY value.\n\t */\n\tprivate calculateGrowY(\n\t\tunscaledShapeH: number,\n\t\tunscaledLabelH: number,\n\t\tunscaledCurrentGrowY: number\n\t): number | null {\n\t\tif (unscaledLabelH > unscaledShapeH) {\n\t\t\t// Label is taller than shape - need to grow\n\t\t\treturn unscaledLabelH - unscaledShapeH\n\t\t}\n\t\tif (unscaledCurrentGrowY > 0) {\n\t\t\t// Label fits and we have existing growY - reset it\n\t\t\treturn 0\n\t\t}\n\t\t// No change needed\n\t\treturn null\n\t}\n\n\t/**\n\t * Calculate expanded dimensions when adding a label to a shape for the first time.\n\t * Ensures the shape meets minimum size requirements and is square if originally small.\n\t */\n\tprivate expandShapeForFirstLabel(\n\t\tshape: TLGeoShape,\n\t\tunscaledW: number,\n\t\tunscaledH: number,\n\t\tunscaledLabelSize: { w: number; h: number }\n\t): { w: number; h: number } {\n\t\tlet w = Math.max(unscaledW, unscaledLabelSize.w)\n\t\tlet h = Math.max(unscaledH, unscaledLabelSize.h)\n\n\t\tconst dv = getDisplayValues(this, shape)\n\n\t\t// If shape was smaller than min size in both dimensions, make it square\n\t\tif (unscaledW < dv.minSizeWithLabel && unscaledH < dv.minSizeWithLabel) {\n\t\t\tw = Math.max(w, dv.minSizeWithLabel)\n\t\t\th = Math.max(h, dv.minSizeWithLabel)\n\t\t\t// Make square by using the larger dimension\n\t\t\tconst maxDim = Math.max(w, h)\n\t\t\tw = maxDim\n\t\t\th = maxDim\n\t\t}\n\n\t\treturn { w, h }\n\t}\n\n\tprivate _labelSizesForGeoCache = new WeakCache<TLGeoShape, { w: number; h: number }>()\n\n\t/**\n\t * Get the cached label size for the shape. Don't call with empty rich text.\n\t */\n\tprivate getUnscaledLabelSize(shape: TLGeoShape) {\n\t\tconst batchCached = getBatchLabelSizeCache(this.editor)?.get(shape.id)\n\t\tif (batchCached) return batchCached\n\n\t\treturn this._labelSizesForGeoCache.get(shape, () => {\n\t\t\treturn this.measureUnscaledLabelSize(shape)\n\t\t})\n\t}\n\n\t/**\n\t * Expensively measure the unscaled label size for the shape. Avoid using it if we can.\n\t */\n\tprivate measureUnscaledLabelSize(shape: TLGeoShape) {\n\t\tconst dv = getDisplayValues(this, shape)\n\n\t\tconst html = renderHtmlFromRichTextForMeasurement(this.editor, shape.props.richText)\n\n\t\tconst textSize = this.editor.textMeasure.measureHtml(html, {\n\t\t\t...TEXT_PROPS,\n\t\t\tfontFamily: dv.labelFontFamily,\n\t\t\tfontSize: dv.labelFontSize,\n\t\t\tlineHeight: dv.labelLineHeight,\n\t\t\tminWidth: dv.labelMinWidth,\n\t\t\tmaxWidth: Math.max(\n\t\t\t\t// Guard because a DOM nodes can't be less 0\n\t\t\t\t0,\n\t\t\t\t// A 'w' width that we're setting as the min-width\n\t\t\t\tMath.ceil(dv.labelMinWidth + dv.labelExtraPadding),\n\t\t\t\t// The actual text size\n\t\t\t\tMath.ceil(shape.props.w / shape.props.scale - dv.labelPadding * 2)\n\t\t\t),\n\t\t})\n\n\t\treturn {\n\t\t\tw: textSize.w + dv.labelPadding * 2,\n\t\t\th: textSize.h + dv.labelPadding * 2,\n\t\t}\n\t}\n}\n\nconst MIN_SIZE_WITH_LABEL = (LABEL_PADDING + 1) * 3\nconst MIN_WIDTHS = GEO_SHAPE_MIN_WIDTHS\n\n// Per-editor batch cache, set by batchMeasureGeoLabels before the resize loop and cleared after.\n// When set, onResize will use pre-computed label sizes instead of measuring individually.\n// Uses a WeakMap keyed by editor to avoid issues with multiple editors on the same page.\nconst _batchLabelSizeCaches = new WeakMap<Editor, Map<TLShapeId, { w: number; h: number }>>()\n\n/** @internal */\nexport function setBatchLabelSizeCache(\n\teditor: Editor,\n\tcache: Map<TLShapeId, { w: number; h: number }> | null\n) {\n\tif (cache) {\n\t\t_batchLabelSizeCaches.set(editor, cache)\n\t} else {\n\t\t_batchLabelSizeCaches.delete(editor)\n\t}\n}\n\nfunction getBatchLabelSizeCache(editor: Editor) {\n\treturn _batchLabelSizeCaches.get(editor)\n}\n\n/**\n * Build the measurement request params (html + opts) for a geo shape's label\n * without actually performing the measurement. Used by batch measurement.\n */\nfunction getGeoLabelMeasurementRequest(\n\teditor: Editor,\n\tshape: TLGeoShape\n): { html: string; opts: TLMeasureTextOpts } {\n\tconst { richText, font, size, w } = shape.props\n\tconst theme = editor.getCurrentTheme()\n\tconst minWidth = MIN_WIDTHS[size]\n\tconst html = renderHtmlFromRichTextForMeasurement(editor, richText)\n\tconst opts: TLMeasureTextOpts = {\n\t\t...TEXT_PROPS,\n\t\tfontFamily: getFontFamily(theme, font),\n\t\tfontSize: theme.fontSize * LABEL_FONT_SIZES[size],\n\t\tlineHeight: theme.lineHeight,\n\t\tminWidth: minWidth,\n\t\tmaxWidth: Math.max(\n\t\t\t// Guard because a DOM node can't be less than 0\n\t\t\t0,\n\t\t\t// A 'w' width that we're setting as the min-width\n\t\t\tMath.ceil(minWidth + theme.strokeWidth * STROKE_SIZES[size]),\n\t\t\t// The actual text size\n\t\t\tMath.ceil(w / shape.props.scale - LABEL_PADDING * 2)\n\t\t),\n\t}\n\treturn { html, opts }\n}\n\n/**\n * Compute the target unscaled width for label measurement during resize.\n * This replicates the measureW computation from onResize so batch measurement can\n * build measurement requests without duplicating GeoShapeUtil internals.\n */\nfunction getGeoResizeTargetWidth(initialProps: TLGeoShapeProps, scaleX: number): number {\n\tconst unscaledInitialW = initialProps.w / initialProps.scale\n\tconst absUnscaledW = Math.abs(unscaledInitialW * scaleX)\n\treturn Math.max(absUnscaledW, MIN_SIZE_WITH_LABEL)\n}\n\n/**\n * Batch-measure all geo shape labels before the resize loop to avoid layout thrashing.\n * For each geo shape with a non-empty label that has compatible rotation, compute the\n * measurement request and batch all measurements in a single DOM pass.\n * Sets the per-editor batch cache so onResize and getGeometry can use pre-computed sizes.\n * @internal\n */\nexport function batchMeasureGeoLabels(\n\teditor: Editor,\n\tshapeSnapshots: Map<\n\t\tTLShapeId,\n\t\t{\n\t\t\tshape: TLShape\n\t\t\tpageRotation: number\n\t\t\tisAspectRatioLocked: boolean\n\t\t}\n\t>,\n\tscale: VecLike,\n\tselectionRotation: number,\n\tisAspectRatioLocked: boolean\n) {\n\tconst requests: Array<{ id: TLShapeId; html: string; opts: TLMeasureTextOpts }> = []\n\n\tfor (const [id, snapshot] of shapeSnapshots) {\n\t\t// Only process geo shapes with non-empty text labels\n\t\tif (!editor.isShapeOfType<TLGeoShape>(snapshot.shape, 'geo')) continue\n\t\tconst geoShape = snapshot.shape as TLGeoShape\n\t\tif (isEmptyRichText(geoShape.props.richText)) continue\n\n\t\t// Skip unaligned shapes \u2014 they take a different resize path (_resizeUnalignedShape)\n\t\t// and won't use the standard onResize, so caching wouldn't help.\n\t\tif (!areAnglesCompatible(snapshot.pageRotation, selectionRotation)) continue\n\n\t\t// Compute the effective scaleX for this shape, replicating Editor.resizeShape logic.\n\t\t// Shapes rotated 90\u00B0 from the selection axis have their x/y scale swapped.\n\t\tconst areWidthAndHeightAlignedWithCorrectAxis = approximately(\n\t\t\t(snapshot.pageRotation - selectionRotation) % Math.PI,\n\t\t\t0\n\t\t)\n\n\t\tlet effectiveScaleX: number\n\t\tif (isAspectRatioLocked || snapshot.isAspectRatioLocked) {\n\t\t\t// When aspect ratio is locked, both axes get the same absolute scale\n\t\t\tconst uniformScale = Math.max(Math.abs(scale.x), Math.abs(scale.y))\n\t\t\teffectiveScaleX = uniformScale\n\t\t} else {\n\t\t\teffectiveScaleX = Math.abs(areWidthAndHeightAlignedWithCorrectAxis ? scale.x : scale.y)\n\t\t}\n\n\t\t// Compute the target width for measurement (same logic as onResize)\n\t\tconst targetW = getGeoResizeTargetWidth(geoShape.props, effectiveScaleX)\n\n\t\t// Build a temporary shape with the target width for measurement\n\t\tconst tempShape = {\n\t\t\t...geoShape,\n\t\t\tprops: {\n\t\t\t\t...geoShape.props,\n\t\t\t\tw: targetW * geoShape.props.scale,\n\t\t\t},\n\t\t} as TLGeoShape\n\n\t\tconst { html, opts } = getGeoLabelMeasurementRequest(editor, tempShape)\n\t\trequests.push({ id, html, opts })\n\t}\n\n\tif (requests.length === 0) return\n\n\t// Batch measure all labels in one DOM pass\n\tconst results = editor.textMeasure.measureHtmlBatch(\n\t\trequests.map(({ html, opts }) => ({ html, opts }))\n\t)\n\n\t// Build the cache map with label sizes (adding padding)\n\tconst cache = new Map<TLShapeId, { w: number; h: number }>()\n\tfor (let i = 0; i < requests.length; i++) {\n\t\tcache.set(requests[i].id, {\n\t\t\tw: results[i].w + LABEL_PADDING * 2,\n\t\t\th: results[i].h + LABEL_PADDING * 2,\n\t\t})\n\t}\n\n\tsetBatchLabelSizeCache(editor, cache)\n}\n"],
  "mappings": "AA4XG,mBAEE,KAFF;AA3XH;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EAUA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,gCAAgC;AACzC,SAAS,yBAAyB;AAClC,SAAS,qBAAqB,2BAA2B;AACzD,SAAwC,wBAAwB;AAChE,SAAS,uBAAuB;AAChC,SAAS,eAAe,mBAAmB;AAC3C,SAAS,4BAA4B;AACrC,SAAS,iCAAiC;AAC1C,SAAS,oBAAoB;AAC7B;AAAA,EACC;AAAA,EAEA;AAAA,EACA;AAAA,OACM;AAGP,MAAM,uBAAuB,OAAO,OAAO;AAAA,EAC1C,GAAG;AAAA,EACH,GAAG;AAAA,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