{
  "version": 3,
  "sources": ["../../src/shapes/TLVideoShape.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 * Configuration interface defining properties for video shapes in tldraw.\n * Video shapes can display video content from URLs or asset references,\n * with controls for playback state, timing, and accessibility.\n *\n * @public\n * @example\n * ```ts\n * const videoProps: TLVideoShapeProps = {\n *   w: 640,\n *   h: 480,\n *   time: 0,\n *   playing: false,\n *   autoplay: true,\n *   url: 'https://example.com/video.mp4',\n *   assetId: 'asset:video123',\n *   altText: 'Educational video about shapes'\n * }\n * ```\n */\nexport interface TLVideoShapeProps {\n\tw: number\n\th: number\n\ttime: number\n\tplaying: boolean\n\tautoplay: boolean\n\turl: string\n\tassetId: TLAssetId | null\n\taltText: string\n}\n\n/**\n * A video shape that can display video content with playback controls and timing.\n * Video shapes support both direct URL references and asset-based video storage,\n * with accessibility features and playback state management.\n *\n * @public\n * @example\n * ```ts\n * const videoShape: TLVideoShape = {\n *   id: 'shape:video123',\n *   typeName: 'shape',\n *   type: 'video',\n *   x: 100,\n *   y: 100,\n *   rotation: 0,\n *   index: 'a1',\n *   parentId: 'page:main',\n *   isLocked: false,\n *   opacity: 1,\n *   props: {\n *     w: 640,\n *     h: 480,\n *     time: 15.5,\n *     playing: false,\n *     autoplay: false,\n *     url: 'https://example.com/video.mp4',\n *     assetId: 'asset:video123',\n *     altText: 'Product demo video'\n *   },\n *   meta: {}\n * }\n * ```\n */\nexport type TLVideoShape = TLBaseShape<'video', TLVideoShapeProps>\n\n/**\n * Validation schema for video shape properties. This defines the runtime validation\n * rules that ensure video shape data integrity, including URL validation, numeric\n * constraints, and proper asset ID formatting.\n *\n * @public\n * @example\n * ```ts\n * import { videoShapeProps } from '@tldraw/tlschema'\n *\n * // Validate video URL\n * const isValidUrl = videoShapeProps.url.isValid('https://example.com/video.mp4')\n * const isValidTime = videoShapeProps.time.isValid(42.5)\n *\n * if (isValidUrl && isValidTime) {\n *   // Video properties are valid\n * }\n * ```\n */\nexport const videoShapeProps: RecordProps<TLVideoShape> = {\n\tw: T.nonZeroNumber,\n\th: T.nonZeroNumber,\n\ttime: T.number,\n\tplaying: T.boolean,\n\tautoplay: T.boolean,\n\turl: T.linkUrl,\n\tassetId: assetIdValidator.nullable(),\n\taltText: T.string,\n}\n\nconst Versions = createShapePropsMigrationIds('video', {\n\tAddUrlProp: 1,\n\tMakeUrlsValid: 2,\n\tAddAltText: 3,\n\tAddAutoplay: 4,\n})\n\n/**\n * Version identifiers for video shape migrations. These constants track\n * the evolution of the video shape schema over time.\n *\n * @public\n * @example\n * ```ts\n * import { videoShapeVersions } from '@tldraw/tlschema'\n *\n * // Check if shape data needs migration\n * if (shapeVersion < videoShapeVersions.AddAltText) {\n *   // Apply alt text migration for accessibility\n * }\n * ```\n */\nexport { Versions as videoShapeVersions }\n\n/**\n * Migration sequence for video shape schema evolution. This handles transforming\n * video shape data between different versions as the schema evolves over time.\n *\n * Key migrations include:\n * - AddUrlProp: Added URL property for direct video links\n * - MakeUrlsValid: Ensured all URLs conform to link URL validation\n * - AddAltText: Added accessibility support with alternative text\n * - AddAutoplay: Added autoplay control for video playback\n *\n * @public\n */\nexport const videoShapeMigrations = createShapePropsMigrationSequence({\n\tsequence: [\n\t\t{\n\t\t\tid: Versions.AddUrlProp,\n\t\t\tup: (props) => {\n\t\t\t\tprops.url = ''\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\t{\n\t\t\tid: Versions.AddAltText,\n\t\t\tup: (props) => {\n\t\t\t\tprops.altText = ''\n\t\t\t},\n\t\t\tdown: (props) => {\n\t\t\t\tdelete props.altText\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: Versions.AddAutoplay,\n\t\t\tup: (props) => {\n\t\t\t\tprops.autoplay = true\n\t\t\t},\n\t\t\tdown: (props) => {\n\t\t\t\tdelete props.autoplay\n\t\t\t},\n\t\t},\n\t],\n})\n"],
  "mappings": "AAAA,SAAS,SAAS;AAClB,SAAS,wBAAwB;AAEjC,SAAS,8BAA8B,yCAAyC;AAyFzE,MAAM,kBAA6C;AAAA,EACzD,GAAG,EAAE;AAAA,EACL,GAAG,EAAE;AAAA,EACL,MAAM,EAAE;AAAA,EACR,SAAS,EAAE;AAAA,EACX,UAAU,EAAE;AAAA,EACZ,KAAK,EAAE;AAAA,EACP,SAAS,iBAAiB,SAAS;AAAA,EACnC,SAAS,EAAE;AACZ;AAEA,MAAM,WAAW,6BAA6B,SAAS;AAAA,EACtD,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,aAAa;AACd,CAAC;AA+BM,MAAM,uBAAuB,kCAAkC;AAAA,EACrE,UAAU;AAAA,IACT;AAAA,MACC,IAAI,SAAS;AAAA,MACb,IAAI,CAAC,UAAU;AACd,cAAM,MAAM;AAAA,MACb;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,IACA;AAAA,MACC,IAAI,SAAS;AAAA,MACb,IAAI,CAAC,UAAU;AACd,cAAM,UAAU;AAAA,MACjB;AAAA,MACA,MAAM,CAAC,UAAU;AAChB,eAAO,MAAM;AAAA,MACd;AAAA,IACD;AAAA,IACA;AAAA,MACC,IAAI,SAAS;AAAA,MACb,IAAI,CAAC,UAAU;AACd,cAAM,WAAW;AAAA,MAClB;AAAA,MACA,MAAM,CAAC,UAAU;AAChB,eAAO,MAAM;AAAA,MACd;AAAA,IACD;AAAA,EACD;AACD,CAAC;",
  "names": []
}
