{
  "version": 3,
  "sources": ["../../../../src/lib/utils/shapes/shapes.ts"],
  "sourcesContent": ["import { Editor, ExtractShapeByProps, Geometry2d, Group2d, TLShape } from '@tldraw/editor'\n\n/**\n * A shape whose `url` prop holds a link: a geo, note, image, video, or bookmark shape, or a custom\n * shape that follows the same convention.\n *\n * @internal\n */\nexport type TLShapeWithLink = ExtractShapeByProps<{ url: string }>\n\n/**\n * Embed shapes are excluded: their `url` is the embedded content's source rather than a link\n * decorating the shape.\n *\n * @internal\n */\nexport function isShapeWithLink(shape: TLShape | null | undefined): shape is TLShapeWithLink {\n\treturn !!(\n\t\tshape &&\n\t\tshape.type !== 'embed' &&\n\t\t'url' in shape.props &&\n\t\ttypeof shape.props.url === 'string'\n\t)\n}\n\n/**\n * The shape a link would be set on. Both the \"Edit link\u2026\" action and pasting a url read this, so\n * that the shapes you can put a link on are the same either way.\n *\n * @internal\n */\nexport function getSelectedLinkShape(editor: Editor): TLShapeWithLink | undefined {\n\tconst shape = editor.getOnlySelectedShape()\n\tif (!isShapeWithLink(shape) || editor.isShapeOrAncestorLocked(shape)) return undefined\n\treturn shape\n}\n\n/**\n * Return all the text labels in a geometry.\n *\n * @param geometry - The geometry to get the text labels from.\n *\n * @public\n */\nexport function getTextLabels(geometry: Geometry2d) {\n\tif (geometry.isLabel) {\n\t\treturn [geometry]\n\t}\n\n\tif (geometry instanceof Group2d) {\n\t\treturn geometry.children.filter((child) => child.isLabel)\n\t}\n\n\treturn []\n}\n"],
  "mappings": "AAAA,SAAkD,eAAwB;AAgBnE,SAAS,gBAAgB,OAA6D;AAC5F,SAAO,CAAC,EACP,SACA,MAAM,SAAS,WACf,SAAS,MAAM,SACf,OAAO,MAAM,MAAM,QAAQ;AAE7B;AAQO,SAAS,qBAAqB,QAA6C;AACjF,QAAM,QAAQ,OAAO,qBAAqB;AAC1C,MAAI,CAAC,gBAAgB,KAAK,KAAK,OAAO,wBAAwB,KAAK,EAAG,QAAO;AAC7E,SAAO;AACR;AASO,SAAS,cAAc,UAAsB;AACnD,MAAI,SAAS,SAAS;AACrB,WAAO,CAAC,QAAQ;AAAA,EACjB;AAEA,MAAI,oBAAoB,SAAS;AAChC,WAAO,SAAS,SAAS,OAAO,CAAC,UAAU,MAAM,OAAO;AAAA,EACzD;AAEA,SAAO,CAAC;AACT;",
  "names": []
}
