{
  "version": 3,
  "sources": ["../../src/shapes/TLBookmarkShape.ts"],
  "sourcesContent": ["import { T } from '@tldraw/validate'\nimport { assetIdValidator } from '../assets/TLBaseAsset'\nimport { TLAssetId } from '../records/TLAsset'\nimport { createShapePropsMigrationIds, createShapePropsMigrationSequence } from '../records/TLShape'\nimport { RecordProps } from '../recordsWithProps'\nimport { TLBaseShape } from './TLBaseShape'\n\n/**\n * Properties for the bookmark shape, which displays website bookmarks as interactive cards.\n *\n * @public\n */\nexport interface TLBookmarkShapeProps {\n\t/** Width of the bookmark shape in pixels */\n\tw: number\n\t/** Height of the bookmark shape in pixels */\n\th: number\n\t/** Asset ID for the bookmark's preview image, or null if no image is available */\n\tassetId: TLAssetId | null\n\t/** The URL that this bookmark points to */\n\turl: string\n}\n\n/**\n * A bookmark shape represents a website link with optional preview content.\n * Bookmark shapes display as cards showing the page title, description, and preview image.\n *\n * @public\n * @example\n * ```ts\n * const bookmarkShape: TLBookmarkShape = {\n *   id: createShapeId(),\n *   typeName: 'shape',\n *   type: 'bookmark',\n *   x: 100,\n *   y: 100,\n *   rotation: 0,\n *   index: 'a1',\n *   parentId: 'page:page1',\n *   isLocked: false,\n *   opacity: 1,\n *   props: {\n *     w: 300,\n *     h: 320,\n *     assetId: 'asset:bookmark123',\n *     url: 'https://www.example.com'\n *   },\n *   meta: {}\n * }\n * ```\n */\nexport type TLBookmarkShape = TLBaseShape<'bookmark', TLBookmarkShapeProps>\n\n/**\n * Validation schema for bookmark shape properties.\n *\n * @public\n * @example\n * ```ts\n * // Validates bookmark shape properties\n * const isValid = bookmarkShapeProps.url.isValid('https://example.com')\n * ```\n */\nexport const bookmarkShapeProps: RecordProps<TLBookmarkShape> = {\n\tw: T.nonZeroNumber,\n\th: T.nonZeroNumber,\n\tassetId: assetIdValidator.nullable(),\n\turl: T.linkUrl,\n}\n\nconst Versions = createShapePropsMigrationIds('bookmark', {\n\tNullAssetId: 1,\n\tMakeUrlsValid: 2,\n})\n\n/**\n * Version identifiers for bookmark shape migrations.\n *\n * @public\n */\nexport { Versions as bookmarkShapeVersions }\n\n/**\n * Migration sequence for bookmark shape properties across different schema versions.\n * Handles backwards compatibility when bookmark shape structure changes.\n *\n * @public\n */\nexport const bookmarkShapeMigrations = createShapePropsMigrationSequence({\n\tsequence: [\n\t\t{\n\t\t\tid: Versions.NullAssetId,\n\t\t\tup: (props) => {\n\t\t\t\tif (props.assetId === undefined) {\n\t\t\t\t\tprops.assetId = null\n\t\t\t\t}\n\t\t\t},\n\t\t\tdown: 'retired',\n\t\t},\n\t\t{\n\t\t\tid: Versions.MakeUrlsValid,\n\t\t\tup: (props) => {\n\t\t\t\tif (!T.linkUrl.isValid(props.url)) {\n\t\t\t\t\tprops.url = ''\n\t\t\t\t}\n\t\t\t},\n\t\t\tdown: (_props) => {\n\t\t\t\t// noop\n\t\t\t},\n\t\t},\n\t],\n})\n"],
  "mappings": "AAAA,SAAS,SAAS;AAClB,SAAS,wBAAwB;AAEjC,SAAS,8BAA8B,yCAAyC;AA4DzE,MAAM,qBAAmD;AAAA,EAC/D,GAAG,EAAE;AAAA,EACL,GAAG,EAAE;AAAA,EACL,SAAS,iBAAiB,SAAS;AAAA,EACnC,KAAK,EAAE;AACR;AAEA,MAAM,WAAW,6BAA6B,YAAY;AAAA,EACzD,aAAa;AAAA,EACb,eAAe;AAChB,CAAC;AAeM,MAAM,0BAA0B,kCAAkC;AAAA,EACxE,UAAU;AAAA,IACT;AAAA,MACC,IAAI,SAAS;AAAA,MACb,IAAI,CAAC,UAAU;AACd,YAAI,MAAM,YAAY,QAAW;AAChC,gBAAM,UAAU;AAAA,QACjB;AAAA,MACD;AAAA,MACA,MAAM;AAAA,IACP;AAAA,IACA;AAAA,MACC,IAAI,SAAS;AAAA,MACb,IAAI,CAAC,UAAU;AACd,YAAI,CAAC,EAAE,QAAQ,QAAQ,MAAM,GAAG,GAAG;AAClC,gBAAM,MAAM;AAAA,QACb;AAAA,MACD;AAAA,MACA,MAAM,CAAC,WAAW;AAAA,MAElB;AAAA,IACD;AAAA,EACD;AACD,CAAC;",
  "names": []
}
