import { Cursor } from "loro-crdt"; //#region ../medeo-dsl/src/sandbox.d.ts /** Kinds a script can author. */ type EntityKind$1 = 'timeline' | 'track' | 'clip' | 'sequence-marker' | 'video' | 'audio' | 'voiceover-recording' | 'image' | 'voice' | 'audio-script' | 'phonetic-script' | 'caption'; type RelationKind$1 = 'contain' | 'marker' | 'clip-anchor' | 'voice-timbre' | 'derived-from'; /** One segment of an AudioScript, addressed by its index. */ interface ScriptSegment { text: string; language?: string; /** * A transcript's segment: where its words were spoken in the medium, as its transcription file * gave them. Both or neither, stated when the segment is added and never edited afterwards. */ startMs?: number; endMs?: number; } /** One segment of the base script by index, or a half-open code-point range inside it. */ interface SegmentSelection { segment: number; textRange?: { start: number; end: number; }; } /** * Sequence: content that can be placed on a Track. It always has a length; * `null` means it has none of its own, and the Clip's marker decides how long it shows. */ interface Sequence { durationMs: number | null; } /** The stored file a medium is. A document holds one medium per system and key. */ interface MediaFile { /** Speech results (ids starting `sph_`) are memota-speech; every other resource is memota. */ system: 'memota' | 'memota-speech'; /** The file's id in that store. */ key: string; /** Where the bytes live in storage; a fact the host records from the store, never written by a script. */ storageKey?: string; /** Fingerprint of the bytes; a fact the host records from the store, never written by a script. */ digest?: string; } /** * A variant names its base; every field it does not state reads through to * the base. Variants exist only where a variant relation is defined: a * PhoneticScript has exactly one AudioScript base, and a Caption has at most one — * none when it states its own `text`. `bases` alone links a variant to its base. */ interface Composed { bases: string[]; } /** Every style field a Caption may own; anything else is refused. */ interface CaptionStyle { font?: { system: 'font-library'; key: string; }; fontSize?: number; fontColor?: string; fontWeight?: number; entranceAnimation?: string; entranceAnimationDurationMs?: number; strokeColor?: string; strokeWidth?: number; /** The caption's center across the frame, from 0 at the left edge to 1 at the right. */ positionX?: number; /** The caption's center down the frame, from 0 at the top edge to 1 at the bottom. */ positionY?: number; } /** A kind, or a relation, with no fields of its own. */ type Empty = Record; /** Own fields by kind. A kind states these and nothing else. */ interface Payload { /** Structure only: its Tracks are its content. */ timeline: Empty; /** What the Track is for; the roles a document starts with come with its snapshot. */ track: { role: string; hidden?: boolean; }; /** Where it sits in its Track is the order of its contain Relation; a Marker startMs overrides where it begins. volume is decibels, -60 to 20, 0 the source's own level. */ clip: { volume?: number; }; 'sequence-marker': { /** In point on the source, from 0. */inMs: number; /** Out point on the source. outMs - inMs is how long this content runs. */ outMs: number; /** Where the Clip begins, overriding its order: on the Track, or inside the Clip named by clip-anchor. */ startMs?: number; /** Linear speed; omitted means 1. Played length is (outMs - inMs) / rate. Video and audio only. */ rate?: number; /** BGM only: run as long as the Timeline instead of the source. */ fillTimeline?: true; }; video: Sequence & MediaFile; /** Sound that carries no language: BGM, sound effects, a video's own track. Spoken language is a voiceover-recording. */ audio: Sequence & MediaFile; /** Speech. It states the PhoneticScript it was spoken from through derived-from. */ 'voiceover-recording': Sequence & MediaFile; /** An image has no length of its own: durationMs is null. */ image: Sequence & MediaFile; /** A timbre identity, never playable; the take rendered with it is a voiceover-recording. */ voice: { voice: { system: 'voice-library'; key: string; name?: string; }; }; /** * Segmented text. A written script names no file. One read off media states that media through * derived-from and names the transcription file (`system`, `key`) its words and times came from; * the file is fixed once named. */ 'audio-script': Partial & { segments: ScriptSegment[]; }; /** * What a take is synthesized from, for one segment of its base script or a run of it: its * phonemeScript where the voice takes markup, otherwise the selection's words. */ 'phonetic-script': Composed & { /** The segment it is written for; absent only once that segment is gone. */selection: SegmentSelection; /** * Phoneme content — markup — stated only where the voice takes it, and never empty. Without it * there is none, and TTS reads the selection's words from the base script. */ phonemeScript?: string; }; /** * Words on screen: a selection of its base script, or its own `text`. A Caption has no * length of its own (durationMs is null); its Clip's marker decides how long it shows. */ caption: Sequence & Composed & { selection?: SegmentSelection; /** The Caption's own words; stating them drops the selection and the base. */ text?: string; style?: CaptionStyle; }; } /** Stated in full, or stated by a variant over its base. */ type StoredPayload = Payload[K] | (Partial & Composed); interface Entity { entityId: string; entityKind: K; /** Assembled: a variant reads with its base already applied. */ payload: Payload[K]; } /** Endpoints keep their positions; each kind states what endpoint 0 and endpoint 1 are to each other. */ interface Relation { relationId: string; relationKind: K; endpoint0EntityId: string; endpoint1EntityId: string; } /** Starts at a payload field; a list member is addressed by its index. */ type FieldPath = readonly (string | number)[]; type FieldChange$1 = /** value is JSON-serializable; the field being set decides its shape. */{ op: 'set'; path: FieldPath; value: unknown; } | { op: 'unset'; path: FieldPath; } /** index and deleteCount count Unicode code points. */ | { op: 'text.splice'; path: FieldPath; index: number; deleteCount: number; text: string; } /** index is where the new member lands; the list's length appends. */ | { op: 'list.insert'; path: FieldPath; index: number; value: unknown; } | { op: 'list.move'; path: FieldPath; from: number; to: number; } | { op: 'list.remove'; path: FieldPath; index: number; }; interface ScriptEntities$1 { list(): Entity[]; get(entityId: string): Entity | null; create(entityKind: K, payload: StoredPayload): string; update(entityId: string, changes: FieldChange$1[]): void; /** Establish own fields or an override; not the normal way to edit inherited content. */ declareFields(entityId: string, payload: Partial): void; /** * Unlink its Relations first. A Clip takes its own sequence-marker with it — the one it holds, * or held until this run unlinked it; a marker linked to another Clip stays. */ delete(entityId: string): void; /** * Read a medium's own stored file, or the transcription file a transcript names. * `assetId` is the file's key. What the bytes hold is their own business and no * two kinds agree, so `content` is inspected, never assumed. Nothing of `content` * is filled in on the entity: state what it needs — a take's length, say — yourself. * Only `storageKey` and `digest` are recorded from the read, by the host. */ materialize(entityId: string): Promise<{ assetId: string; content: unknown; }>; } interface ScriptRelations$1 { list(): Relation[]; /** Ordered kinds come back in container order: a Track's Clips play in this order. */ of(entityId: string, relationKind?: RelationKind$1): Relation[]; /** * contain(container, contained), marker(marked, marker), clip-anchor(child, host), * voice-timbre(recording, voice), derived-from(product, source). voice-timbre names the Voice of * the voice the take was synthesized with; the plan is refused otherwise. derived-from is what a * product was made from: a recording from its PhoneticScript, a transcript from its media. * A variant's base is its `bases`, never a derived-from. */ link(relationKind: RelationKind$1, endpoint0EntityId: string, endpoint1EntityId: string): string; /** * Move an ordered Relation within its container: `beforeRelationId` names the * Relation it goes in front of, or null to put it last. */ move(relationId: string, beforeRelationId: string | null): void; unlink(relationId: string): void; } //#endregion //#region src/api/types.d.ts /** The contract's kinds and surfaces: what a script reads and writes (RFC 04 §7.6). */ type EntityKind = EntityKind$1; type RelationKind = RelationKind$1; type SandboxEntity = Entity; type SandboxRelation = Relation; type FieldChange = FieldChange$1; type ScriptEntities = ScriptEntities$1; type ScriptRelations = ScriptRelations$1; type JsonPrimitive = string | number | boolean | null; type JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue; }; type JsonObject = { [key: string]: JsonValue; }; /** What reading a stored file returns: a medium's own, or the transcription file a transcript names. */ interface EntityAssetContent { /** Whatever the store holds; a script inspects it. */ content: JsonValue; /** Where the bytes live, recorded on the entity when it states none. */ storageKey?: string; /** Fingerprint of the bytes, recorded on the entity when it states none. */ digest?: string; /** The voice a take was synthesized with, as its synthesis recorded it; its voice-timbre must name it (D193). */ voice?: { system: 'voice-library'; key: string; name?: string; }; } /** * Reads a medium's own file, or a transcript's transcription file; the host owns resource I/O. * Called for `materialize`, and before every plan for each file the plan names (D187). */ type EntityAssetLoader = (docId: string, entity: SandboxEntity) => Promise; //#endregion export { JsonObject as a, RelationKind as c, ScriptEntities as d, ScriptRelations as f, FieldChange as i, SandboxEntity as l, EntityAssetLoader as n, JsonPrimitive as o, EntityKind as r, JsonValue as s, EntityAssetContent as t, SandboxRelation as u }; //# sourceMappingURL=types-CjEJw7Bn.d.mts.map