{
  "version": 3,
  "sources": ["../../src/shapes/TLDrawShape.ts"],
  "sourcesContent": ["import { defineMigrations } from '@bigbluebutton/store'\nimport { T } from '@bigbluebutton/validate'\nimport { vec2dModelValidator } from '../misc/geometry-types'\nimport { DefaultColorStyle } from '../styles/TLColorStyle'\nimport { DefaultDashStyle } from '../styles/TLDashStyle'\nimport { DefaultFillStyle } from '../styles/TLFillStyle'\nimport { DefaultSizeStyle } from '../styles/TLSizeStyle'\nimport { ShapePropsType, TLBaseShape } from './TLBaseShape'\n\nexport const DrawShapeSegment = T.object({\n\ttype: T.literalEnum('free', 'straight'),\n\tpoints: T.arrayOf(vec2dModelValidator),\n})\n\n/** @public */\nexport type TLDrawShapeSegment = T.TypeOf<typeof DrawShapeSegment>\n\n/** @public */\nexport const drawShapeProps = {\n\tcolor: DefaultColorStyle,\n\tfill: DefaultFillStyle,\n\tdash: DefaultDashStyle,\n\tsize: DefaultSizeStyle,\n\tsegments: T.arrayOf(DrawShapeSegment),\n\tisComplete: T.boolean,\n\tisClosed: T.boolean,\n\tisPen: T.boolean,\n}\n\n/** @public */\nexport type TLDrawShapeProps = ShapePropsType<typeof drawShapeProps>\n\n/** @public */\nexport type TLDrawShape = TLBaseShape<'draw', TLDrawShapeProps>\n\nconst Versions = {\n\tAddInPen: 1,\n} as const\n\n/** @internal */\nexport const drawShapeMigrations = defineMigrations({\n\tcurrentVersion: Versions.AddInPen,\n\tmigrators: {\n\t\t[Versions.AddInPen]: {\n\t\t\tup: (shape) => {\n\t\t\t\t// Rather than checking to see whether the shape is a pen at runtime,\n\t\t\t\t// from now on we're going to use the type of device reported to us\n\t\t\t\t// as well as the pressure data received; but for existing shapes we\n\t\t\t\t// need to check the pressure data to see if it's a pen or not.\n\n\t\t\t\tconst { points } = shape.props.segments[0]\n\n\t\t\t\tif (points.length === 0) {\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\t...shape.props,\n\t\t\t\t\t\t\tisPen: false,\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlet isPen = !(points[0].z === 0 || points[0].z === 0.5)\n\n\t\t\t\tif (points[1]) {\n\t\t\t\t\t// Double check if we have a second point (we probably should)\n\t\t\t\t\tisPen = isPen && !(points[1].z === 0 || points[1].z === 0.5)\n\t\t\t\t}\n\n\t\t\t\treturn {\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\tisPen,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t},\n\t\t\tdown: (shape) => {\n\t\t\t\tconst { isPen: _isPen, ...propsWithOutIsPen } = shape.props\n\t\t\t\treturn {\n\t\t\t\t\t...shape,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t...propsWithOutIsPen,\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,yBAAyB;AAClC,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AAG1B,MAAM,mBAAmB,EAAE,OAAO;AAAA,EACxC,MAAM,EAAE,YAAY,QAAQ,UAAU;AAAA,EACtC,QAAQ,EAAE,QAAQ,mBAAmB;AACtC,CAAC;AAMM,MAAM,iBAAiB;AAAA,EAC7B,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,UAAU,EAAE,QAAQ,gBAAgB;AAAA,EACpC,YAAY,EAAE;AAAA,EACd,UAAU,EAAE;AAAA,EACZ,OAAO,EAAE;AACV;AAQA,MAAM,WAAW;AAAA,EAChB,UAAU;AACX;AAGO,MAAM,sBAAsB,iBAAiB;AAAA,EACnD,gBAAgB,SAAS;AAAA,EACzB,WAAW;AAAA,IACV,CAAC,SAAS,QAAQ,GAAG;AAAA,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