{
  "version": 3,
  "sources": ["../../src/shapes/TLArrowShape.ts"],
  "sourcesContent": ["import { defineMigrations } from '@bigbluebutton/store'\nimport { T } from '@bigbluebutton/validate'\nimport { vec2dModelValidator } from '../misc/geometry-types'\nimport { StyleProp } from '../styles/StyleProp'\nimport { DefaultColorStyle, DefaultLabelColorStyle } from '../styles/TLColorStyle'\nimport { DefaultDashStyle } from '../styles/TLDashStyle'\nimport { DefaultFillStyle } from '../styles/TLFillStyle'\nimport { DefaultFontStyle } from '../styles/TLFontStyle'\nimport { DefaultSizeStyle } from '../styles/TLSizeStyle'\nimport { ShapePropsType, TLBaseShape, shapeIdValidator } from './TLBaseShape'\n\nconst arrowheadTypes = [\n\t'arrow',\n\t'triangle',\n\t'square',\n\t'dot',\n\t'pipe',\n\t'diamond',\n\t'inverted',\n\t'bar',\n\t'none',\n] as const\n\n/** @public */\nexport const ArrowShapeArrowheadStartStyle = StyleProp.defineEnum('tldraw:arrowheadStart', {\n\tdefaultValue: 'none',\n\tvalues: arrowheadTypes,\n})\n\n/** @public */\nexport const ArrowShapeArrowheadEndStyle = StyleProp.defineEnum('tldraw:arrowheadEnd', {\n\tdefaultValue: 'arrow',\n\tvalues: arrowheadTypes,\n})\n\n/** @public */\nexport type TLArrowShapeArrowheadStyle = T.TypeOf<typeof ArrowShapeArrowheadStartStyle>\n\n/** @public */\nconst ArrowShapeTerminal = T.union('type', {\n\tbinding: T.object({\n\t\ttype: T.literal('binding'),\n\t\tboundShapeId: shapeIdValidator,\n\t\tnormalizedAnchor: vec2dModelValidator,\n\t\tisExact: T.boolean,\n\t\tisPrecise: T.boolean,\n\t}),\n\tpoint: T.object({\n\t\ttype: T.literal('point'),\n\t\tx: T.number,\n\t\ty: T.number,\n\t}),\n})\n\n/** @public */\nexport type TLArrowShapeTerminal = T.TypeOf<typeof ArrowShapeTerminal>\n\n/** @public */\nexport const arrowShapeProps = {\n\tlabelColor: DefaultLabelColorStyle,\n\tcolor: DefaultColorStyle,\n\tfill: DefaultFillStyle,\n\tdash: DefaultDashStyle,\n\tsize: DefaultSizeStyle,\n\tarrowheadStart: ArrowShapeArrowheadStartStyle,\n\tarrowheadEnd: ArrowShapeArrowheadEndStyle,\n\tfont: DefaultFontStyle,\n\tstart: ArrowShapeTerminal,\n\tend: ArrowShapeTerminal,\n\tbend: T.number,\n\ttext: T.string,\n}\n\n/** @public */\nexport type TLArrowShapeProps = ShapePropsType<typeof arrowShapeProps>\n\n/** @public */\nexport type TLArrowShape = TLBaseShape<'arrow', TLArrowShapeProps>\n\nexport const ArrowMigrationVersions = {\n\tAddLabelColor: 1,\n\tAddIsPrecise: 2,\n} as const\n\n/** @internal */\nexport const arrowShapeMigrations = defineMigrations({\n\tcurrentVersion: ArrowMigrationVersions.AddIsPrecise,\n\tmigrators: {\n\t\t[ArrowMigrationVersions.AddLabelColor]: {\n\t\t\tup: (record) => {\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t...record.props,\n\t\t\t\t\t\tlabelColor: 'black',\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t},\n\t\t\tdown: (record) => {\n\t\t\t\tconst { labelColor: _, ...props } = record.props\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t\tprops,\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t[ArrowMigrationVersions.AddIsPrecise]: {\n\t\t\tup: (record) => {\n\t\t\t\tconst { start, end } = record.props\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t...record.props,\n\t\t\t\t\t\tstart:\n\t\t\t\t\t\t\t(start as TLArrowShapeTerminal).type === 'binding'\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t...start,\n\t\t\t\t\t\t\t\t\t\tisPrecise: !(\n\t\t\t\t\t\t\t\t\t\t\tstart.normalizedAnchor.x === 0.5 && start.normalizedAnchor.y === 0.5\n\t\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\t: start,\n\t\t\t\t\t\tend:\n\t\t\t\t\t\t\t(end as TLArrowShapeTerminal).type === 'binding'\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t...end,\n\t\t\t\t\t\t\t\t\t\tisPrecise: !(end.normalizedAnchor.x === 0.5 && end.normalizedAnchor.y === 0.5),\n\t\t\t\t\t\t\t\t  }\n\t\t\t\t\t\t\t\t: end,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t},\n\t\t\tdown: (record: any) => {\n\t\t\t\tconst { start, end } = record.props\n\t\t\t\tconst nStart = { ...start }\n\t\t\t\tconst nEnd = { ...end }\n\t\t\t\tif (nStart.type === 'binding') {\n\t\t\t\t\tif (!nStart.isPrecise) {\n\t\t\t\t\t\tnStart.normalizedAnchor = { x: 0.5, y: 0.5 }\n\t\t\t\t\t}\n\t\t\t\t\tdelete nStart.isPrecise\n\t\t\t\t}\n\t\t\t\tif (nEnd.type === 'binding') {\n\t\t\t\t\tif (!nEnd.isPrecise) {\n\t\t\t\t\t\tnEnd.normalizedAnchor = { x: 0.5, y: 0.5 }\n\t\t\t\t\t}\n\t\t\t\t\tdelete nEnd.isPrecise\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t...record.props,\n\t\t\t\t\t\tstart: nStart,\n\t\t\t\t\t\tend: nEnd,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n})\n"],
  "mappings": "AAAA,SAAS,wBAAwB;AACjC,SAAS,SAAS;AAClB,SAAS,2BAA2B;AACpC,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB,8BAA8B;AAC1D,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AACjC,SAAsC,wBAAwB;AAE9D,MAAM,iBAAiB;AAAA,EACtB;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