@lavitre/apps 1.49.2 → 1.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -0
- package/dist/Common/Common.Model.d.ts +32 -2
- package/dist/Common/Common.Model.js.map +1 -1
- package/dist/Common/PreviewScaling.d.ts +62 -0
- package/dist/Common/PreviewScaling.js +132 -0
- package/dist/Common/PreviewScaling.js.map +1 -0
- package/dist/Common/index.d.ts +1 -0
- package/dist/Common/index.js +1 -0
- package/dist/Common/index.js.map +1 -1
- package/dist/CompanionFrame/CompanionFrame.d.ts +1 -1
- package/dist/CompanionFrame/CompanionFrame.js.map +1 -1
- package/dist/Connector/Connector.Model.d.ts +45 -2
- package/dist/Connector/Connector.Model.js.map +1 -1
- package/dist/Connector/Connector.js +6 -3
- package/dist/Connector/Connector.js.map +1 -1
- package/dist/Connector/SettingsSchema.d.ts +7 -0
- package/dist/Connector/SettingsSchema.js +19 -0
- package/dist/Connector/SettingsSchema.js.map +1 -0
- package/dist/Frame/Frame.Model.d.ts +10 -1
- package/dist/Frame/Frame.Model.js.map +1 -1
- package/dist/Frame/Frame.d.ts +31 -1
- package/dist/Frame/Frame.js +87 -2
- package/dist/Frame/Frame.js.map +1 -1
- package/dist/Frame/LocalPreview.d.ts +133 -0
- package/dist/Frame/LocalPreview.js +823 -0
- package/dist/Frame/LocalPreview.js.map +1 -0
- package/dist/Frame/ScaledStreamWorker.d.ts +9 -0
- package/dist/Frame/ScaledStreamWorker.js +34 -0
- package/dist/Frame/ScaledStreamWorker.js.map +1 -0
- package/dist/Frame/index.d.ts +1 -0
- package/dist/Frame/index.js +1 -0
- package/dist/Frame/index.js.map +1 -1
- package/dist/Version.d.ts +1 -1
- package/dist/Version.js +1 -1
- package/dist/Version.js.map +1 -1
- package/package.json +2 -1
package/dist/Frame/Frame.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Frame.js","sourceRoot":"","sources":["../../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D,KAAK,GAAG,IAAI,CAAC,WAAW,IAAI,KAAK,CAAC,CAChC,iBAAiB,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,EAChD,aAAa,EACb,OAAO,EACP,aAAa,CAAC,KAAK,CACf,CAAA;wBACN,OAAO,CAAC,KAAK,CAAC,CAAA;oBAChB,CAAC;oBACD,MAAK;gBACP;oBACE,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;oBAC3B,MAAK;YACT,CAAC;QACH,CAAC,CAAA;QAEH,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,cAAc,CACtC,CAAC,OAAe,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,QAAyB,EAAE,EAAE;YAC1D,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAA;QACpD,CAAC,CACF,CAAA;QAED,MAAM,CAAC,MAAM,CAAC,WAAW,CACvB;YACE,IAAI,EAAE,gCAAgC;YACtC,OAAO,EAAE,UAAU;SACpB,EACD,GAAG,EACH,CAAC,OAAO,CAAC,KAAK,CAAC,CAChB,CAAA;QAED,MAAM,CAAC,gBAAgB,CACrB,SAAS,EACT,cAAc,CACZ,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,QAAyB,EAAE,EAAE;YACzD,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;QACtD,CAAC,CACF,EACD,KAAK,CACN,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["/// <reference path=\"../Connector/insertable-streams.d.ts\" />\nimport { randomUuid } from '../Common/Uuid.js'\nimport type * as Y from 'yjs'\nimport { CrdtChannel, MIN_CRDT_HOST_VERSION } from '../Common/CrdtChannel.js'\nimport { BlobStore } from '../Common/BlobStore.js'\nimport { AiChannel, MIN_AI_HOST_VERSION } from '../Common/AiChannel.js'\nimport { isMinVersion } from '../Common/index.js'\nimport type {\n AppId,\n BluetoothFromApp,\n BluetoothToApp,\n BorderOptions,\n CompanionInformation,\n ConnectedMediaDevice,\n Device,\n DeviceFrameReference,\n DeviceFullscreenUpdated,\n DeviceMessageReceived,\n DeviceScalingUpdated,\n Field,\n FileData,\n FramePeer,\n HostInformation,\n KnockKnock,\n LayoutPosition,\n LoadedFrame,\n MessageTarget,\n NotificationButtonClicked,\n NotificationInfo,\n PositionUpdated,\n Privacy,\n Rect,\n ReplacedBy,\n RequestSerialPortAccess,\n RequestStreamSizeUpdate,\n SendKnockKnock,\n SendMessageTo,\n SendMessageToAll,\n SendToSerialPort,\n StateReplaced,\n StatsResponse,\n StreamCapture,\n UpdatedStateEntry,\n UpdateStateEntry,\n Visibility,\n VisibilityChanged,\n VitreSettings,\n VitreSettingsSetter,\n VoiceAction,\n VoiceActionDetection,\n} from '../Common/index.js'\nimport type {\n Connector,\n ShareStreamOptions,\n ShareStreamTrack,\n} from '../Connector/index.js'\nimport type { MediaTrackInfo } from '../Connector/Connector.Model.js'\nimport { apiVersion } from '../Version.js'\nimport type {\n ApplyStreamAdvancedConstraints,\n AvailableExportSource,\n ExportData,\n ExportRequest,\n FrameApiMessagesIn,\n FrameApiMessagesOut,\n FrameMenuEntry,\n IceServerConfig,\n InitFrameOptions,\n InitializeFrame,\n SharedStreamPlayState,\n ViewOptions,\n} from './Frame.Model.js'\n\ninterface RequestResolver {\n isHandled: (msg: FrameApiMessagesIn) => boolean\n}\n\nexport type SharedStreamState = {\n position: number\n duration: number\n volume: number\n state: SharedStreamPlayState\n}\n\nexport type SharedStream = {\n lastState: SharedStreamState\n play: () => void\n pause: () => void\n seek: (position: number, isRelative?: boolean) => void\n setVolume: (volume: number) => void\n}\n\nexport class Frame {\n public onDeviceJoined?: (device: Device) => void\n public onDeviceLeft?: (deviceId: string) => void\n public onDeviceMessageReceived?: (message: DeviceMessageReceived) => void\n public onLocalConnectorMessageReceived?: (\n message: any,\n from?: string,\n fileData?: FileData,\n ) => void\n public onMenuClicked?: (menuId: string, tag: any, isChecked: boolean) => void\n public onFieldUpdated?: (field: Field) => void\n public onInteractingChanged?: (isInteracting: boolean) => void\n public onPrivacyChanged?: (privacy: Privacy) => void\n public onFileProgress?: (bytes: number, totalBytes: number) => void\n public onFileLoaded?: (file: ArrayBufferLike) => void\n public onExportRequest?: (\n request: ExportRequest,\n resolve: (data: ExportData) => void,\n reject: (error: string) => void,\n ) => void\n public onKnockKnock?: (knockKnock: KnockKnock) => void\n public onSettingsUpdated?: (settings: any) => void\n public onVitreSettingsUpdated?: (settings: VitreSettings) => void\n public onConnectionCodeUpdated?: (companionCode?: string) => void\n public onNotificationDismissed?: (notificationId: string) => void\n public onNotificationButtonClicked?: (\n notificationButton: NotificationButtonClicked,\n ) => void\n public onDevicePrivacyChanged?: (device: Device) => void\n public onDeviceFrameLoaded?: (\n deviceFrameReference: DeviceFrameReference,\n ) => void\n public onDeviceFrameConnectorLoaded?: (\n deviceFrameReference: DeviceFrameReference,\n ) => void\n public onDeviceFrameUnloaded?: (\n deviceFrameReference: DeviceFrameReference,\n ) => void\n public onMessageReceived?: (msg: FrameApiMessagesIn) => void\n public onPendingDevicesConnectionRequested?: (\n pendingClients: Device[],\n ) => void\n /**\n * Peer-presence events for the companion frame. `onCompanionFramePeersUpdated`\n * is the AUTHORITATIVE full snapshot — it fires on every change with the\n * complete current peer set. `onCompanionFramePeerJoined` /\n * `onCompanionFramePeerLeft` are convenience incremental events derived\n * from the same underlying stream.\n *\n * Subscribe to ONE model, not both: either consume the snapshot and\n * recompute, or consume the incremental pair — wiring up both will\n * double-count every transition.\n */\n public onCompanionFramePeerJoined?: (peer: FramePeer) => void\n public onCompanionFramePeerLeft?: (peerId: string) => void\n public onCompanionFramePeersUpdated?: (peers: FramePeer[]) => void\n /**\n * @deprecated Use onBorderOptionsUpdated\n */\n public onBorderlessChanged?: (isBorderless: boolean) => void\n public onFullscreenChanged?: (isFullscreen: boolean) => void\n public onBorderOptionsUpdated?: (borderOptions: BorderOptions) => void\n public onVoiceActionDetected?: (voiceAction: VoiceActionDetection) => void\n public onStateReplaced?: (\n newState: Record<string, any>,\n oldState: Record<string, any>,\n replacedBy: ReplacedBy,\n delta: UpdatedStateEntry[],\n ) => void\n public onPositionUpdated?: (positionUpdate: PositionUpdated) => void\n public onDeviceFullscreenUpdated?: (\n deviceFullscreenUpdated: DeviceFullscreenUpdated,\n ) => void\n public onVisibilityChanged?: (msg: VisibilityChanged) => void\n public onDeviceScalingUpdated?: (msg: DeviceScalingUpdated) => void\n public onUpdateFrameName?: (name: string) => void\n public onSharedStreamUpdate?: (msg: SharedStreamState) => void\n /**\n * Reverse breakout box: fires when the Vitre host exposes a live\n * `MediaStream` it owns INTO this frame (e.g. a received shared camera, or a\n * companion stream routed to this frame for transformation). The stream is\n * rebuilt locally via `MediaStreamTrackGenerator` from transferred readables\n * — zero re-encode, same-site + Chromium only. `streamId` matches a later\n * `onSharedStreamRemoved`. Inverse of {@link shareStream}.\n */\n public onSharedStream?: (streamId: string, stream: MediaStream) => void\n public onSharedStreamRemoved?: (streamId: string) => void\n public onMediaDevicesChanged?: (devices: ConnectedMediaDevice[]) => void\n public onBluetoothMessage?: (msg: BluetoothToApp) => void\n /** @deprecated Use `crdt.onSynced` */\n public onYjsSynced?: () => void\n /** @deprecated Subscribe via `crdt.doc.on('update', ...)` instead. */\n public onYjsUpdate?: (update: Uint8Array) => void\n public hostInformation: HostInformation\n /**\n * The companion's own identity/runtime context, present only when this\n * frame is loaded by a la Vitre **companion** (`hostInformation.isCompanion`\n * is then true). Undefined on Vitre-side frames. Mirrors\n * `CompanionConnector.companionInformation`. Added 1.19.\n */\n public companionInformation?: CompanionInformation\n public initiator: Device\n public id: string\n public appId: string\n public initOptions: InitFrameOptions\n /**\n * @deprecated Use initOptions.border.modeinitOptions\n */\n public isBorderless: boolean\n public isFullscreen: boolean\n public state: Record<string, any> = {}\n\n /**\n * CRDT channel — Yjs doc + Awareness piped over the la Vitre transport.\n * Libraries (Carbone, …) can call `crdt.attach(doc, awareness)` to bring\n * their own; simple apps use `crdt.doc` / `crdt.awareness` directly.\n */\n public readonly crdt: CrdtChannel\n\n /**\n * CRDT-backed blob store built on `crdt.attachSubdoc` — see Connector.blobs.\n */\n public readonly blobs: BlobStore\n\n /**\n * AI tool channel — publish a catalog of tools the on-prem agent's LLM can call\n * on this frame: `ai.registerTools([{ name, description, parameters, sensitive }],\n * (name, args) => …)`. Register SIMPLE local names; the host namespaces them as\n * `<appId>__<name>`. Invocations run against the handler and reply automatically.\n */\n public readonly ai: AiChannel\n\n /** @deprecated Use `crdt.doc`. See Connector.yjsDoc for the setter\n * rationale (legacy field-assignment backward-compat). */\n get yjsDoc() {\n return this.crdt.doc\n }\n set yjsDoc(doc: Y.Doc) {\n this.crdt.attach(doc)\n }\n\n public position: Rect\n public zIndex: number\n\n constructor(\n // `protected` (not `private`) so the companion-only subclass\n // `CompanionFrameImpl` (CompanionFrame.ts) can post its companion-frame\n // messages while keeping those methods off the Vitre `Frame` surface.\n protected readonly postMessage: PostMessageFrameApiOut,\n initMessage: InitializeFrame,\n public options: ViewOptions,\n initState?: Record<string, any>,\n ) {\n this.hostInformation = initMessage.hostInfo\n this.companionInformation = initMessage.companionInfo\n this.initiator = initMessage.initiator\n this.id = initMessage.id\n this.appId = initMessage.appId ?? ''\n this.initOptions = initMessage.options\n this.isBorderless = initMessage.isBorderless\n this.isFullscreen = initMessage.isFullscreen\n this.position = initMessage.position\n this.zIndex = 0\n this.isFullscreen = initMessage.isFullscreen\n\n this.postMessage({\n type: 'frameInitialized',\n options,\n })\n\n const w = window as any\n w.frameConnector = this\n w.connector = this\n this.state = initState ?? {}\n\n // Mirror of the Connector guard — both connectors must behave\n // identically. See MIN_CRDT_HOST_VERSION for the rationale.\n //\n // Exception: a companion frame (`hostInformation.isCompanion`) is never\n // gated. Its host is the la-Vitre companion, which is deployed centrally\n // and always runs HEAD, so it always carries the CRDT relay. Gating it is\n // also actively harmful: the version it advertises is the companion's OWN\n // build version, and a misconfigured deploy can ship a stale placeholder\n // (a preview build shipped `1.2.0.0`), which silently disables Yjs sync\n // for every companion frame. The real sync peer is the Vitre, whose own\n // gate still applies on its side.\n const crdtSupported =\n this.hostInformation.isCompanion === true ||\n isMinVersion(this.hostInformation.version, MIN_CRDT_HOST_VERSION)\n this.crdt = new CrdtChannel((message, transfer) => {\n // Same as Connector: `FrameApiMessagesOut` already includes the four\n // `crdt*` arms (Frame.Model.ts), so no cast is needed.\n if (!crdtSupported) return\n this.postMessage(message, transfer)\n })\n this.crdt.onSynced(() => this.onYjsSynced?.())\n this.crdt.onUpdate((update) => this.onYjsUpdate?.(update))\n this.blobs = new BlobStore(this.crdt)\n\n // AI tool channel — same companion-exception + version gate as CRDT (a host\n // that predates the ai bridge ignores the unknown arms and never invokes).\n const aiSupported =\n this.hostInformation.isCompanion === true ||\n isMinVersion(this.hostInformation.version, MIN_AI_HOST_VERSION)\n this.ai = new AiChannel((message) => {\n if (!aiSupported) return\n this.postMessage(message)\n })\n\n if (this.state['@sharedStreamState.state']) {\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n state: this.state['@sharedStreamState.state'] as SharedStreamPlayState,\n }\n }\n if (typeof this.state['@sharedStreamState.duration'] === 'number') {\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n duration: this.state['@sharedStreamState.duration'] as number,\n }\n }\n if (typeof this.state['@sharedStreamState.position'] === 'number') {\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n position: this.state['@sharedStreamState.position'] as number,\n }\n }\n }\n\n private resolveRequest(msg: FrameApiMessagesIn) {\n this.requestResolvers = this.requestResolvers.filter(\n (rr) => !rr.isHandled(msg),\n )\n }\n\n raiseMessage(msg: FrameApiMessagesIn) {\n this.resolveRequest(msg)\n\n switch (msg.type) {\n case 'privacyChanged':\n this.hostInformation = {\n ...this.hostInformation,\n device: { ...this.hostInformation.device, privacy: msg.privacy },\n }\n this.onPrivacyChanged?.(msg.privacy)\n break\n case 'deviceJoined':\n this.hostInformation = {\n ...this.hostInformation,\n devicesInSpace: [\n ...this.hostInformation.devicesInSpace.filter(\n (d) => d.id !== msg.device.id,\n ),\n msg.device,\n ],\n }\n this.onDeviceJoined?.(msg.device)\n break\n case 'deviceLeft':\n this.hostInformation = {\n ...this.hostInformation,\n devicesInSpace: this.hostInformation.devicesInSpace.filter(\n (d) => d.id !== msg.deviceId,\n ),\n }\n this.onDeviceLeft?.(msg.deviceId)\n break\n case 'deviceMessageReceived':\n this.onDeviceMessageReceived?.(msg)\n break\n case 'localConnectorMessageReceived':\n this.onLocalConnectorMessageReceived?.(msg.data, msg.from, msg.fileData)\n break\n case 'menuClicked':\n this.onMenuClicked?.(msg.menuId, msg.tag, msg.isChecked)\n break\n case 'fieldUpdated':\n this.onFieldUpdated?.(msg.field)\n break\n case 'isInteractingChanged':\n this.onInteractingChanged?.(msg.isInteracting)\n break\n case 'borderlessUpdated':\n this.isBorderless = msg.isBorderless\n this.onBorderlessChanged?.(msg.isBorderless)\n break\n case 'fullscreenUpdated':\n this.isFullscreen = msg.isFullscreen\n this.onFullscreenChanged?.(msg.isFullscreen)\n break\n case 'fileLoaded':\n this.onFileLoaded?.(msg.file)\n break\n case 'fileProgress':\n this.onFileProgress?.(msg.bytes, msg.totalBytes)\n break\n case 'exportRequest':\n {\n const resolve = (data: ExportData) => {\n this.postMessage({\n type: 'exportDone',\n request: msg,\n data,\n })\n }\n\n const reject = (error: string) => {\n this.postMessage({\n type: 'exportDone',\n request: msg,\n error,\n })\n }\n this.onExportRequest?.(msg, resolve, reject)\n }\n break\n case 'knockKnockReceived':\n this.onKnockKnock?.(msg)\n break\n case 'settingsUpdated':\n this.hostInformation = {\n ...this.hostInformation,\n settings: msg.settings,\n }\n this.onSettingsUpdated?.(msg.settings)\n break\n case 'vitreSettingsUpdated':\n this.hostInformation = {\n ...this.hostInformation,\n space: msg.currentSpace,\n vitreSettings: msg,\n device: {\n ...this.hostInformation.device,\n name: msg.name ?? this.hostInformation.device.name,\n color: msg.color,\n },\n }\n this.onVitreSettingsUpdated?.(msg)\n break\n case 'connectionCodeUpdated':\n this.hostInformation = {\n ...this.hostInformation,\n companionCode: msg.companionCode,\n }\n this.onConnectionCodeUpdated?.(msg.companionCode)\n break\n case 'notificationButtonClicked':\n this.onNotificationButtonClicked?.(msg)\n break\n case 'notificationDismissed':\n this.onNotificationDismissed?.(msg.id)\n break\n case 'devicePrivacyChanged':\n this.hostInformation = {\n ...this.hostInformation,\n devicesInSpace: [\n ...this.hostInformation.devicesInSpace.filter(\n (d) => d.id !== msg.device.id,\n ),\n msg.device,\n ],\n }\n this.onDevicePrivacyChanged?.(msg.device)\n break\n case 'deviceFrameLoaded':\n this.onDeviceFrameLoaded?.(msg)\n break\n case 'deviceFrameUnloaded':\n this.onDeviceFrameUnloaded?.(msg)\n break\n case 'deviceFrameConnectorLoaded':\n this.onDeviceFrameConnectorLoaded?.(msg)\n break\n case 'pendingDevicesConnectionRequested':\n this.onPendingDevicesConnectionRequested?.(msg.pendingDevices)\n break\n case 'borderOptionsUpdated':\n this.onBorderOptionsUpdated?.(msg)\n break\n case 'voiceActionDetected':\n this.onVoiceActionDetected?.(msg)\n break\n case 'stateReplaced':\n this._onStateReplaced(msg)\n break\n case 'positionUpdated':\n this.position = msg.position\n this.zIndex = msg.zIndex\n this.isFullscreen = msg.isFullscreen\n this.onPositionUpdated?.(msg)\n break\n case 'deviceFullscreenUpdated':\n this.hostInformation.devicesInSpace =\n this.hostInformation.devicesInSpace.map((d) =>\n d.id === msg.deviceId ? { ...d, fullscreen: msg.fullscreen } : d,\n )\n this.onDeviceFullscreenUpdated?.(msg)\n break\n case 'visibilityChanged':\n this.onVisibilityChanged?.(msg)\n break\n case 'deviceScalingUpdated':\n if (msg.deviceId === this.hostInformation.device.id) {\n this.hostInformation.device.sendingScaling = msg.sendingScaling\n this.hostInformation.device.orientation = msg.orientation\n this.hostInformation.device.orientationBy = msg.orientationBy\n }\n this.hostInformation.devicesInSpace =\n this.hostInformation.devicesInSpace.map((d) =>\n d.id === msg.deviceId\n ? {\n ...d,\n sendingScaling: msg.sendingScaling,\n orientation: msg.orientation,\n orientationBy: msg.orientationBy,\n }\n : d,\n )\n this.onDeviceScalingUpdated?.(msg)\n break\n case 'updateFrameName':\n this.options.name = msg.name\n this.onUpdateFrameName?.(msg.name)\n break\n case 'localSharedStreamUpdate':\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n volume: msg.volume,\n }\n this.onSharedStreamUpdate?.(this.sharedStream.lastState)\n break\n case 'sharedStreamAvailable': {\n // Reverse breakout box — rebuild a live MediaStream from the readables\n // the host transferred into this frame (one MediaStreamTrackGenerator\n // per track; pipe the readable into its writable). Mirrors the host's\n // tracksFromReadables / SDK toShareTracks on the share side.\n const tracks = msg.tracks.map((t) => {\n const generator = new MediaStreamTrackGenerator({ kind: t.kind })\n t.readable.pipeTo(generator.writable).catch(() => {})\n return generator as MediaStreamTrack\n })\n this.onSharedStream?.(msg.streamId, new MediaStream(tracks))\n break\n }\n case 'sharedStreamRemoved':\n this.onSharedStreamRemoved?.(msg.streamId)\n break\n case 'mediaDevicesChanged':\n this.hostInformation = {\n ...this.hostInformation,\n vitreSettings: {\n ...this.hostInformation.vitreSettings,\n availableMediaDevices: msg.devices,\n },\n }\n this.onMediaDevicesChanged?.(msg.devices)\n break\n case 'bluetooth':\n this.onBluetoothMessage?.(msg)\n break\n case 'crdtUpdate':\n case 'crdtSyncComplete':\n case 'crdtRequestSync':\n case 'crdtAwarenessUpdate':\n case 'crdtSubdocUpdate':\n case 'crdtSubdocSyncComplete':\n case 'crdtSubdocTransferProgress':\n case 'crdtSubdocRequestSync':\n this.crdt.handleMessage(msg)\n break\n case 'aiInvoke':\n void this.ai.handleInvoke(msg.id, msg.name, msg.args)\n break\n case 'companionFramePeerJoined':\n this.onCompanionFramePeerJoined?.(msg.peer)\n break\n case 'companionFramePeerLeft':\n this.onCompanionFramePeerLeft?.(msg.peerId)\n break\n case 'companionFramePeersUpdated':\n this.onCompanionFramePeersUpdated?.(msg.peers)\n break\n }\n\n this.onMessageReceived?.(msg)\n }\n\n private _onStateReplaced(msg: StateReplaced) {\n const oldState = this.state\n this.state = msg.state\n\n let hasSharedStreamUpdate = false\n\n msg.delta.forEach((update) => {\n if (\n update.key === '@sharedStreamState.state' &&\n update.action === 'add'\n ) {\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n state: update.value as SharedStreamPlayState,\n }\n hasSharedStreamUpdate = true\n } else if (\n update.key === '@sharedStreamState.duration' &&\n update.action === 'add'\n ) {\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n duration: update.value as number,\n }\n hasSharedStreamUpdate = true\n } else if (\n update.key === '@sharedStreamState.position' &&\n update.action === 'add'\n ) {\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n position: update.value as number,\n }\n hasSharedStreamUpdate = true\n }\n })\n\n if (hasSharedStreamUpdate) {\n this.onSharedStreamUpdate?.(this.sharedStream.lastState)\n }\n\n this.onStateReplaced?.(this.state, oldState, msg.replacedBy, msg.delta)\n }\n\n public sendMessageTo(message: SendMessageTo) {\n this.postMessage({ type: 'sendMessageTo', ...message })\n }\n\n public sendMessageToAll(message: SendMessageToAll) {\n this.postMessage({ type: 'sendMessageToAll', ...message })\n }\n\n public sendKnockKnock(message: SendKnockKnock) {\n this.postMessage({ type: 'sendKnockKnock', ...message })\n }\n\n /** Release the resources owned by this frame. Tears the CRDT channel\n * down (unbinds doc/awareness listeners, destroys the default Y.Doc +\n * Awareness). Safe to call multiple times. */\n public destroy(): void {\n this.crdt.destroy()\n }\n\n public setFullscreen() {\n this.postMessage({\n type: 'setFullscreen',\n })\n }\n\n public setMenu(menu: FrameMenuEntry[]) {\n this.postMessage({\n type: 'setFrameMenu',\n menu,\n })\n }\n\n /**\n * SDK 1.47 — replace the frame's export sources after initialization.\n *\n * The initial set comes from the `ViewOptions.exportSources` returned by\n * `initializeFrame`; this is the only way to change it afterwards, e.g.\n * when a document gains a format, or to flip `availableForCompanion` on a\n * source once it becomes too large to hand to a phone.\n *\n * The call REPLACES the whole list — pass every source you still want,\n * not just the new ones. The host rebuilds both its own export menu and\n * the companions' from it.\n */\n public setExportSources(exportSources: AvailableExportSource[]) {\n this.postMessage({\n type: 'setExportSources',\n exportSources,\n })\n }\n\n public applyStreamAdvancedConstraints(\n constraints: ApplyStreamAdvancedConstraints,\n ) {\n this.postMessage({\n ...constraints,\n type: 'applyStreamAdvancedConstraints',\n })\n }\n\n /**\n * Replace the video track of this frame's shared stream with a fresh\n * `getUserMedia` capture matching `constraints` (e.g. to switch camera),\n * keeping the same share alive (`replaceTrack` on the host, no\n * renegotiation). The host forces the requested `deviceId` as `{ exact }`.\n * Resolves with the new track infos so the frame can rebuild its menu.\n */\n public async requestReplaceStream(\n constraints: MediaStreamConstraints,\n ): Promise<MediaTrackInfo[]> {\n const requestId = randomUuid()\n return await this.postRequest<MediaTrackInfo[]>(\n { type: 'replaceFrameStream', requestId, constraints },\n (msg, resolve, reject) => {\n if (\n msg.type === 'replaceFrameStreamCompleted' &&\n msg.requestId === requestId\n ) {\n if (msg.error != null || msg.tracks == null) {\n reject(msg.error ?? 'replaceFrameStream failed')\n } else {\n resolve(msg.tracks)\n }\n }\n },\n )\n }\n\n public setWindowed() {\n this.postMessage({\n type: 'setWindowed',\n })\n }\n\n public close() {\n this.postMessage({\n type: 'close',\n })\n }\n\n public sendToLocalFrame(\n frameConnectorId: string,\n data: any,\n fileData?: FileData,\n ) {\n this.postMessage({\n type: 'sendToLocalFrame',\n frameConnectorId,\n data,\n fileData,\n })\n }\n\n public sendToLocalMainConnector(data: any, fileData?: FileData) {\n this.postMessage({\n type: 'sendToLocalFrame',\n frameConnectorId: undefined,\n data,\n fileData,\n })\n }\n\n /**\n * Convenience for companion frames: send a message to the paired Vitre\n * frame (same `frameConnectorId`). Wraps `sendToLocalFrame` with the\n * current frame's id so callers don't have to repeat it. The receiving\n * Vitre frame surfaces it on `onLocalConnectorMessageReceived` (data,\n * from, fileData). The same primitive works from a Vitre frame too,\n * but on the Vitre most apps want `sendMessageTo` / `sendMessageToAll`\n * to reach other devices instead — which the companion has no way to\n * address. See `CompanionFrame` for the trimmed surface intended for\n * apps running on a companion frame iframe.\n */\n public sendToVitreFrame(data: any, fileData?: FileData) {\n this.sendToLocalFrame(this.id, data, fileData)\n }\n\n // The companion-only send methods `sendMessageToVitreConnector` and\n // `closeOnCompanion` deliberately do NOT live on the Vitre `Frame`. They post\n // host messages (`sendToVitreConnector` / `closeOnCompanion`) that ONLY the\n // companion host decodes — a Vitre host rejects them with \"case type not\n // found\". They live on `CompanionFrame` (the subclass returned by\n // `initializeCompanionFrame`, see CompanionFrame.ts). A Vitre frame that needs\n // to reach its own connector uses `sendToLocalMainConnector` instead.\n\n public stopInteracting() {\n this.postMessage({\n type: 'stopInteracting',\n })\n }\n\n public setPosition(position: LayoutPosition) {\n this.postMessage({\n type: 'setPosition',\n ...position,\n })\n }\n\n public setVisibility(visibility: Visibility) {\n this.postMessage({\n type: 'setVisibility',\n visibility,\n })\n }\n\n public setReducedAudioMode(enabled: boolean) {\n this.postMessage({\n type: 'setReducedAudioMode',\n enabled,\n })\n }\n\n public startInteracting() {\n this.postMessage({ type: 'startInteracting' })\n }\n\n public sendToSerialPort(serialPort: SendToSerialPort) {\n this.postMessage({\n type: 'sendToSerialPort',\n ...serialPort,\n })\n }\n\n /// Request access to a serial port (see `Connector.requestSerialPortAccess`).\n /// Resolves with the granted port name (empty string if denied/cancelled).\n /// With `{ port }` the host pre-grants it; with no argument the host shows\n /// its port-picker and resolves with the chosen port.\n public async requestSerialPortAccess(\n request?: RequestSerialPortAccess,\n ): Promise<string> {\n const requestId = randomUuid()\n return await this.postRequest<string>(\n { type: 'requestSerialPortAccess', requestId, port: request?.port },\n (msg, resolve, reject) => {\n if (\n msg.type === 'serialPortAccessResult' &&\n msg.requestId === requestId\n ) {\n if (msg.port) {\n resolve(msg.port)\n } else {\n reject(msg.reason ?? 'cancelled')\n }\n }\n },\n )\n }\n\n public sendBluetoothMessage(msg: BluetoothFromApp) {\n this.postMessage({ ...msg, type: 'bluetooth' } as any)\n }\n\n public disconnectGuests(deviceIds: string[]) {\n this.postMessage({\n type: 'disconnectGuests',\n deviceIds,\n })\n }\n\n public requestStreamSizeUpdate(updates: RequestStreamSizeUpdate) {\n this.postMessage({\n type: 'requestStreamSizeUpdate',\n ...updates,\n })\n }\n\n public updateName(name: string) {\n this.postMessage({\n type: 'updateName',\n name,\n })\n }\n\n /**\n * Whether {@link shareStream} is available in this runtime (Chromium\n * Insertable Streams + same-site hosting). Same gate as\n * `Connector.canShareStream`.\n */\n public canShareStream(): boolean {\n return typeof MediaStreamTrackProcessor !== 'undefined'\n }\n\n private toShareTracks(stream: MediaStream): {\n tracks: ShareStreamTrack[]\n transfer: Transferable[]\n } {\n const tracks: ShareStreamTrack[] = []\n const transfer: Transferable[] = []\n for (const track of stream.getTracks()) {\n const { readable } = new MediaStreamTrackProcessor({ track })\n tracks.push({\n kind: track.kind as ShareStreamTrack['kind'],\n readable,\n settings: track.getSettings(),\n })\n transfer.push(readable)\n }\n return { tracks, transfer }\n }\n\n /**\n * Share a `MediaStream` the frame produced (e.g. a WebGL-transformed track,\n * or a camera the frame opened) TO the Vitre, which forwards it to the space\n * peers. Frame-context counterpart of `Connector.shareStream`: needed because\n * a transform frame builds its output track locally and must reshare it.\n * Handed over zero-copy via the breakout box. Returns a `sharedStreamId` for\n * {@link replaceShareStream} / {@link stopShareStream}.\n */\n public async shareStream(\n stream: MediaStream,\n options?: ShareStreamOptions,\n ): Promise<string> {\n if (!this.canShareStream()) {\n throw new Error(\n 'shareStream is not supported in this runtime (requires Chromium MediaStreamTrackProcessor and same-site hosting)',\n )\n }\n const sharedStreamId = randomUuid()\n const requestId = randomUuid()\n const { tracks, transfer } = this.toShareTracks(stream)\n await this.postRequest<void>(\n { type: 'shareStream', requestId, sharedStreamId, options, tracks },\n (msg, resolve, reject) => {\n if (msg.type === 'shareStreamCompleted' && msg.requestId === requestId) {\n if (msg.error != null) reject(msg.error)\n else resolve(undefined)\n }\n },\n transfer,\n )\n return sharedStreamId\n }\n\n /**\n * Swap the source of an open frame share WITHOUT closing it (no\n * renegotiation blip). `sharedStreamId` is the value returned by\n * {@link shareStream}. See `Connector.replaceShareStream`.\n */\n public async replaceShareStream(\n sharedStreamId: string,\n streamOrTrack: MediaStream | MediaStreamTrack,\n ): Promise<void> {\n if (!this.canShareStream()) {\n throw new Error('replaceShareStream is not supported in this runtime')\n }\n const stream =\n streamOrTrack instanceof MediaStream\n ? streamOrTrack\n : new MediaStream([streamOrTrack])\n const requestId = randomUuid()\n const { tracks, transfer } = this.toShareTracks(stream)\n await this.postRequest<void>(\n { type: 'replaceShareStream', requestId, sharedStreamId, tracks },\n (msg, resolve, reject) => {\n if (msg.type === 'shareStreamCompleted' && msg.requestId === requestId) {\n if (msg.error != null) reject(msg.error)\n else resolve(undefined)\n }\n },\n transfer,\n )\n }\n\n /** Stop a frame share. `sharedStreamId` is the value returned by {@link shareStream}. */\n public stopShareStream(sharedStreamId: string): void {\n this.postMessage({ type: 'stopShareStream', sharedStreamId })\n }\n\n /**\n * Attach a `MediaStream` produced by this frame to a target frame's standard\n * sharing slot, WITHOUT opening a new `SharedContent` or establishing a new\n * `RTCPeerConnection`. The stream is forwarded zero-copy (breakout box) from\n * this frame's vitre to the already-open instances of `targetFrameConnectorId`\n * on other vitres; those instances receive it via {@link onSharedStream} (the\n * existing `sharedStreamAvailable` delivery arm — no new protocol arm).\n *\n * - Requires Chromium Insertable Streams (same guard as {@link shareStream}).\n * - Default target: this frame's own `frameConnectorId`, i.e. the same app\n * type running on peer vitres. Pass `opts.targetFrameConnectorId` to route\n * to a different frame type.\n * - Resolves when the host confirms delivery (or rejects with the host error).\n *\n * **Delivery semantics:**\n * - When `targetFrameConnectorId` is absent (default, target == this frame\n * type), the stream is delivered to peer vitres' instances of this frame via\n * {@link onSharedStream}. The calling frame already holds `stream` and does\n * NOT receive it back via `onSharedStream` (no loopback — intentional).\n * - When `targetFrameConnectorId` designates a DIFFERENT frame type, that\n * frame — including its instance on the emitting vitre — receives the stream\n * via {@link onSharedStream}.\n */\n public async attachStream(\n stream: MediaStream,\n opts?: { targetFrameConnectorId?: string },\n ): Promise<void> {\n if (!this.canShareStream()) {\n throw new Error(\n 'attachStream is not supported in this runtime (requires Chromium MediaStreamTrackProcessor and same-site hosting)',\n )\n }\n const requestId = randomUuid()\n const { tracks, transfer } = this.toShareTracks(stream)\n await this.postRequest<void>(\n {\n type: 'attachStream',\n requestId,\n targetFrameConnectorId: opts?.targetFrameConnectorId,\n tracks,\n },\n (msg, resolve, reject) => {\n if (\n msg.type === 'attachStreamCompleted' &&\n msg.requestId === requestId\n ) {\n if (msg.error != null) reject(msg.error)\n else resolve(undefined)\n }\n },\n transfer,\n )\n }\n\n /**\n * Stop a stream previously attached with {@link attachStream} on the target\n * frame. Receivers see {@link onSharedStreamRemoved}. Default target: this\n * frame's own `frameConnectorId`.\n */\n public detachStream(opts?: { targetFrameConnectorId?: string }): void {\n this.postMessage({\n type: 'detachStream',\n targetFrameConnectorId: opts?.targetFrameConnectorId,\n })\n }\n\n /**\n * Fetch the ICE/TURN servers the HOST already uses for its own WebRTC P2P\n * (the Vitre's `StartWebRTCOffer` config, or the companion's `WebRTCOffer`\n * config — same relays, same credentials). The result feeds straight into\n * `new RTCPeerConnection({ iceServers })`, letting an app stand up its OWN\n * peer connection — e.g. a companion-camera frame connecting directly to its\n * paired Vitre transform frame — that traverses NAT through the platform's\n * TURN infrastructure without shipping its own credentials.\n *\n * Resolves to `[]` on hosts that predate this request (the caller should\n * race a timeout and fall back to a public STUN-only config). See\n * {@link IceServerConfig}.\n */\n public async getIceServers(): Promise<IceServerConfig[]> {\n const requestId = randomUuid()\n return await this.postRequest<IceServerConfig[]>(\n { type: 'getIceServers', requestId },\n (msg, resolve, _reject) => {\n if (msg.type === 'iceServersResponse' && msg.requestId === requestId) {\n resolve(msg.iceServers ?? [])\n }\n },\n )\n }\n\n private requestResolvers: RequestResolver[] = []\n private async postRequest<Data>(\n data: FrameApiMessagesOut,\n handler: (\n msg: FrameApiMessagesIn,\n resolve: (data: Data) => void,\n reject: (error: string) => void,\n ) => void,\n transfer?: Transferable[],\n ) {\n return await new Promise<Data>((resolve, reject) => {\n let isHandled = false\n const handleAndResolve = (data: Data) => {\n isHandled = true\n resolve(data)\n }\n\n const handleAndReject = (error: any) => {\n isHandled = true\n reject(error)\n }\n\n const resolver = {\n isHandled: (msg: FrameApiMessagesIn) => {\n try {\n handler(msg, handleAndResolve, handleAndReject)\n } catch (error) {\n handleAndReject(error)\n }\n return isHandled\n },\n }\n this.requestResolvers.push(resolver)\n this.postMessage(data, transfer)\n })\n }\n\n public async requestEnumerateLocalFrames(): Promise<LoadedFrame[]> {\n const requestId = randomUuid()\n return await this.postRequest<LoadedFrame[]>(\n { type: 'enumerateLoadedFrames', requestId },\n (msg, resolve, _reject) => {\n if (\n msg.type === 'enumerateLoadedFramesCompleted' &&\n msg.requestId === requestId\n ) {\n resolve(msg.frames)\n }\n },\n )\n }\n\n /** @deprecated Use sendMessageToEmbed */\n public sendExtensionMessage(\n data: any,\n target: MessageTarget,\n fileData?: FileData,\n ) {\n this.postMessage({\n type: 'extensionMessage',\n data,\n target,\n fileData,\n })\n }\n\n /** @deprecated Use sendMessageToEmbed */\n public sendAppMessage(data: any, target: MessageTarget, fileData?: FileData) {\n this.postMessage({\n type: 'appMessage',\n data,\n target,\n fileData,\n })\n }\n\n public sendMessageToEmbed(\n data: any,\n target: MessageTarget,\n fileData?: FileData,\n ) {\n this.postMessage({\n type: 'appMessage',\n data,\n target,\n fileData,\n })\n }\n\n public async requestVitreSettings() {\n return await this.postRequest<VitreSettings>(\n { type: 'getVitreSettings' },\n (msg, resolve, _reject) => {\n if (msg.type === 'vitreSettingsResponse') {\n resolve(msg as VitreSettings)\n }\n },\n )\n }\n\n public setVitreSettings(setters: VitreSettingsSetter) {\n this.postMessage({ type: 'setVitreSettings', ...setters })\n }\n\n /**\n * Share a URL/data with the host, which routes it to a matching app.\n * @param owner Optional device id (`HostInformation.devicesInSpace[].id`) to\n * attribute the resulting shared content to. Drives the languette colour/info\n * and the content appears already-owned on every vitre. Default: opener.\n */\n public shareData(url: string, targetAppId?: AppId, owner?: string) {\n this.postMessage({\n type: 'shareData',\n url,\n targetAppId,\n owner,\n })\n }\n\n /**\n * Share a file with the host, which routes it to a matching app.\n * @param owner Optional device id to attribute the share to. See {@link shareData}.\n */\n public shareFile(fileData: FileData, targetAppId: AppId, owner?: string) {\n this.postMessage({\n type: 'shareFile',\n fileData,\n targetAppId,\n owner,\n })\n }\n\n public saveSettings(settings: any) {\n this.postMessage({\n type: 'saveSettings',\n settings,\n })\n }\n\n public changeTeamSpace(space: string) {\n this.postMessage({\n type: 'changeTeamSpace',\n space,\n })\n }\n\n public changeTeamSpaceGuest(space: string, teamDomain: string) {\n this.postMessage({\n type: 'changeTeamSpaceGuest',\n space,\n teamDomain,\n })\n }\n\n public showNotification(notification: NotificationInfo) {\n this.postMessage({\n ...notification,\n type: 'showNotification',\n })\n }\n\n public hideNotification(notificationId: string) {\n this.postMessage({\n id: notificationId,\n type: 'hideNotification',\n })\n }\n\n public changePrivacy(privacy: Privacy) {\n this.postMessage({\n type: 'changePrivacy',\n privacy,\n })\n }\n\n public trackEvent(name: string, properties?: Record<string, any>) {\n this.postMessage({\n type: 'trackEvent',\n name,\n properties,\n })\n }\n\n public startTrackEvent(name: string) {\n this.postMessage({\n type: 'startTrackEvent',\n name,\n })\n }\n\n public stopTrackEvent(name: string, properties?: Record<string, any>) {\n this.postMessage({\n type: 'stopTrackEvent',\n name,\n properties,\n })\n }\n\n public getMainConnectorFrame(): Window | null {\n try {\n const mainFrameId = `${this.appId}|${this.appId}`\n return (window.parent.frames as any)[mainFrameId]\n } catch (_error) {\n return null\n }\n }\n\n public getMainConnector(): Connector | null {\n const mainFrame = this.getMainConnectorFrame() as any\n return mainFrame?.mainConnector as Connector\n }\n\n public setBorderOptions(borderOptions: BorderOptions) {\n this.postMessage({ type: 'setBorderOptions', ...borderOptions })\n }\n\n public setVoiceActions(actions: VoiceAction[]) {\n this.postMessage({\n type: 'setVoiceActions',\n actions,\n })\n }\n\n public async requestStreamCapture() {\n const requestId = randomUuid()\n return await this.postRequest<StreamCapture>(\n { type: 'streamFrameCaptureRequest', requestId },\n (msg, resolve, reject) => {\n if (\n msg.type === 'streamFrameCapturedResponse' &&\n msg.requestId === requestId\n ) {\n if (msg.response == null) {\n reject(msg.error ?? 'failed to get streamFrameCapturedResponse')\n } else {\n resolve(msg.response)\n }\n }\n },\n )\n }\n\n public async requestStats() {\n const requestId = randomUuid()\n return await this.postRequest<StatsResponse>(\n { type: 'getStats', requestId },\n (msg, resolve, _reject) => {\n if (msg.type === 'statsResponse' && msg.requestId === requestId) {\n resolve(msg)\n }\n },\n )\n }\n\n public updateState(updates: UpdateStateEntry[], forceApplyLocally = true) {\n updates.forEach((update) => {\n //Compat fix, add value for remove action\n if (update.action === 'remove') {\n ;(update as any).value = null\n }\n })\n\n this.postMessage({\n type: 'updateState',\n updates,\n })\n\n if (forceApplyLocally) {\n updates.forEach((update) => {\n if (update.action === 'add') {\n this.state[update.key] = update.value\n } else {\n delete this.state[update.key]\n }\n })\n }\n }\n\n public sharedStream: SharedStream = {\n lastState: {\n position: 0,\n duration: 0,\n volume: 1,\n state: 'paused',\n },\n play: () => {\n this.postMessage({\n type: 'sharedStreamAction',\n action: 'play',\n })\n },\n\n pause: () => {\n this.postMessage({\n type: 'sharedStreamAction',\n action: 'pause',\n })\n },\n\n seek: (position: number, isRelative: boolean = false) => {\n this.postMessage({\n type: 'sharedStreamAction',\n action: 'seek',\n position,\n isRelative,\n })\n },\n\n setVolume: (volume: number, muted: boolean = false) => {\n this.postMessage({\n type: 'sharedStreamAction',\n action: 'volume',\n volume,\n muted,\n })\n },\n }\n}\n\ntype PostMessageFrameApiOut = (\n message: FrameApiMessagesOut,\n transfer?: Transferable[],\n) => void\n\nexport async function initializeFrame<T extends Frame>(\n init: (\n info: HostInformation,\n initiator: Device,\n options: InitFrameOptions,\n state?: Record<string, any>,\n ) => ViewOptions,\n createFrame?: new (\n postMessage: PostMessageFrameApiOut,\n initMessage: InitializeFrame,\n options: ViewOptions,\n ) => T,\n) {\n return await new Promise<T>((resolve) => {\n const channel = new MessageChannel()\n let frame: T | null = null\n const messageHandler =\n (createPostMessage: (origin: string) => PostMessageFrameApiOut) =>\n (e: MessageEvent<FrameApiMessagesIn>): any => {\n switch (e.data.type) {\n case 'initialize':\n if (frame === null) {\n const initializeMsg = e.data\n const options = init(\n initializeMsg.hostInfo,\n initializeMsg.initiator,\n initializeMsg.options,\n initializeMsg.state,\n )\n frame = new (createFrame ?? Frame)(\n createPostMessage(initializeMsg.hostInfo.origin),\n initializeMsg,\n options,\n initializeMsg.state,\n ) as T\n resolve(frame)\n }\n break\n default:\n frame?.raiseMessage(e.data)\n break\n }\n }\n\n channel.port1.onmessage = messageHandler(\n (_origin: string) => (message, transfer?: Transferable[]) => {\n channel.port1.postMessage(message, transfer ?? [])\n },\n )\n\n window.parent.postMessage(\n {\n type: 'connectorInitializationRequest',\n version: apiVersion,\n },\n '*',\n [channel.port2],\n )\n\n window.addEventListener(\n 'message',\n messageHandler(\n (origin: string) => (message, transfer?: Transferable[]) => {\n window.parent.postMessage(message, origin, transfer)\n },\n ),\n false,\n )\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Frame.js","sourceRoot":"","sources":["../../Frame/Frame.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE9C,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AACvE,OAAO,EAAE,YAAY,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AC,IAAI,CAAA;wBAC5B,MAAM,OAAO,GAAG,IAAI,CAClB,aAAa,CAAC,QAAQ,EACtB,aAAa,CAAC,SAAS,EACvB,aAAa,CAAC,OAAO,EACrB,aAAa,CAAC,KAAK,CACpB,CAAA;wBACD,KAAK,GAAG,IAAI,CAAC,WAAW,IAAI,KAAK,CAAC,CAChC,iBAAiB,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,EAChD,aAAa,EACb,OAAO,EACP,aAAa,CAAC,KAAK,CACf,CAAA;wBACN,OAAO,CAAC,KAAK,CAAC,CAAA;oBAChB,CAAC;oBACD,MAAK;gBACP;oBACE,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;oBAC3B,MAAK;YACT,CAAC;QACH,CAAC,CAAA;QAEH,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,cAAc,CACtC,CAAC,OAAe,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,QAAyB,EAAE,EAAE;YAC1D,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAA;QACpD,CAAC,CACF,CAAA;QAED,MAAM,CAAC,MAAM,CAAC,WAAW,CACvB;YACE,IAAI,EAAE,gCAAgC;YACtC,OAAO,EAAE,UAAU;SACpB,EACD,GAAG,EACH,CAAC,OAAO,CAAC,KAAK,CAAC,CAChB,CAAA;QAED,MAAM,CAAC,gBAAgB,CACrB,SAAS,EACT,cAAc,CACZ,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,QAAyB,EAAE,EAAE;YACzD,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;QACtD,CAAC,CACF,EACD,KAAK,CACN,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["/// <reference path=\"../Connector/insertable-streams.d.ts\" />\nimport { randomUuid } from '../Common/Uuid.js'\nimport type * as Y from 'yjs'\nimport { CrdtChannel, MIN_CRDT_HOST_VERSION } from '../Common/CrdtChannel.js'\nimport { BlobStore } from '../Common/BlobStore.js'\nimport { AiChannel, MIN_AI_HOST_VERSION } from '../Common/AiChannel.js'\nimport { isMinVersion } from '../Common/index.js'\nimport type {\n AppId,\n BluetoothFromApp,\n BluetoothToApp,\n BorderOptions,\n CompanionInformation,\n ConnectedMediaDevice,\n Device,\n DeviceFrameReference,\n DeviceFullscreenUpdated,\n DeviceMessageReceived,\n DeviceScalingUpdated,\n Field,\n FileData,\n FramePeer,\n HostInformation,\n KnockKnock,\n LayoutPosition,\n LoadedFrame,\n MessageTarget,\n NotificationButtonClicked,\n NotificationInfo,\n PositionUpdated,\n SafeAreaInsets,\n SafeAreaInsetsUpdated,\n Privacy,\n Rect,\n ReplacedBy,\n RequestSerialPortAccess,\n RequestStreamSizeUpdate,\n SendKnockKnock,\n SendMessageTo,\n SendMessageToAll,\n SendToSerialPort,\n StateReplaced,\n StatsResponse,\n StreamCapture,\n UpdatedStateEntry,\n UpdateStateEntry,\n Visibility,\n VisibilityChanged,\n VitreSettings,\n VitreSettingsSetter,\n VoiceAction,\n VoiceActionDetection,\n} from '../Common/index.js'\nimport type {\n Connector,\n ShareStreamOptions,\n ShareStreamTrack,\n} from '../Connector/index.js'\nimport type { MediaTrackInfo } from '../Connector/Connector.Model.js'\nimport { apiVersion } from '../Version.js'\nimport type {\n ApplyStreamAdvancedConstraints,\n AvailableExportSource,\n ExportData,\n ExportRequest,\n FrameApiMessagesIn,\n FrameApiMessagesOut,\n FrameMenuEntry,\n IceServerConfig,\n InitFrameOptions,\n InitializeFrame,\n SharedStreamPlayState,\n ViewOptions,\n} from './Frame.Model.js'\n\ninterface RequestResolver {\n isHandled: (msg: FrameApiMessagesIn) => boolean\n}\n\nexport type SharedStreamState = {\n position: number\n duration: number\n volume: number\n state: SharedStreamPlayState\n}\n\nexport type SharedStream = {\n lastState: SharedStreamState\n play: () => void\n pause: () => void\n seek: (position: number, isRelative?: boolean) => void\n setVolume: (volume: number) => void\n}\n\nexport class Frame {\n public onDeviceJoined?: (device: Device) => void\n public onDeviceLeft?: (deviceId: string) => void\n public onDeviceMessageReceived?: (message: DeviceMessageReceived) => void\n public onLocalConnectorMessageReceived?: (\n message: any,\n from?: string,\n fileData?: FileData,\n ) => void\n public onMenuClicked?: (menuId: string, tag: any, isChecked: boolean) => void\n public onFieldUpdated?: (field: Field) => void\n public onInteractingChanged?: (isInteracting: boolean) => void\n public onPrivacyChanged?: (privacy: Privacy) => void\n public onFileProgress?: (bytes: number, totalBytes: number) => void\n public onFileLoaded?: (file: ArrayBufferLike) => void\n public onExportRequest?: (\n request: ExportRequest,\n resolve: (data: ExportData) => void,\n reject: (error: string) => void,\n ) => void\n public onKnockKnock?: (knockKnock: KnockKnock) => void\n public onSettingsUpdated?: (settings: any) => void\n public onVitreSettingsUpdated?: (settings: VitreSettings) => void\n public onConnectionCodeUpdated?: (companionCode?: string) => void\n public onNotificationDismissed?: (notificationId: string) => void\n public onNotificationButtonClicked?: (\n notificationButton: NotificationButtonClicked,\n ) => void\n public onDevicePrivacyChanged?: (device: Device) => void\n public onDeviceFrameLoaded?: (\n deviceFrameReference: DeviceFrameReference,\n ) => void\n public onDeviceFrameConnectorLoaded?: (\n deviceFrameReference: DeviceFrameReference,\n ) => void\n public onDeviceFrameUnloaded?: (\n deviceFrameReference: DeviceFrameReference,\n ) => void\n public onMessageReceived?: (msg: FrameApiMessagesIn) => void\n public onPendingDevicesConnectionRequested?: (\n pendingClients: Device[],\n ) => void\n /**\n * Peer-presence events for the companion frame. `onCompanionFramePeersUpdated`\n * is the AUTHORITATIVE full snapshot — it fires on every change with the\n * complete current peer set. `onCompanionFramePeerJoined` /\n * `onCompanionFramePeerLeft` are convenience incremental events derived\n * from the same underlying stream.\n *\n * Subscribe to ONE model, not both: either consume the snapshot and\n * recompute, or consume the incremental pair — wiring up both will\n * double-count every transition.\n */\n public onCompanionFramePeerJoined?: (peer: FramePeer) => void\n public onCompanionFramePeerLeft?: (peerId: string) => void\n public onCompanionFramePeersUpdated?: (peers: FramePeer[]) => void\n /**\n * @deprecated Use onBorderOptionsUpdated\n */\n public onBorderlessChanged?: (isBorderless: boolean) => void\n public onFullscreenChanged?: (isFullscreen: boolean) => void\n public onBorderOptionsUpdated?: (borderOptions: BorderOptions) => void\n public onVoiceActionDetected?: (voiceAction: VoiceActionDetection) => void\n public onStateReplaced?: (\n newState: Record<string, any>,\n oldState: Record<string, any>,\n replacedBy: ReplacedBy,\n delta: UpdatedStateEntry[],\n ) => void\n public onPositionUpdated?: (positionUpdate: PositionUpdated) => void\n /**\n * The host moved a system bar over an edge-to-edge frame (device rotated,\n * navigation mode switched). `safeAreaInsets` and the\n * `--lavitre-safe-area-inset-*` CSS variables are already updated when\n * this fires. Added 1.51.\n */\n public onSafeAreaInsetsUpdated?: (msg: SafeAreaInsetsUpdated) => void\n public onDeviceFullscreenUpdated?: (\n deviceFullscreenUpdated: DeviceFullscreenUpdated,\n ) => void\n public onVisibilityChanged?: (msg: VisibilityChanged) => void\n public onDeviceScalingUpdated?: (msg: DeviceScalingUpdated) => void\n public onUpdateFrameName?: (name: string) => void\n public onSharedStreamUpdate?: (msg: SharedStreamState) => void\n /**\n * Reverse breakout box: fires when the Vitre host exposes a live\n * `MediaStream` it owns INTO this frame (e.g. a received shared camera, or a\n * companion stream routed to this frame for transformation). The stream is\n * rebuilt locally via `MediaStreamTrackGenerator` from transferred readables\n * — zero re-encode, same-site + Chromium only. `streamId` matches a later\n * `onSharedStreamRemoved`. Inverse of {@link shareStream}.\n */\n public onSharedStream?: (streamId: string, stream: MediaStream) => void\n public onSharedStreamRemoved?: (streamId: string) => void\n public onMediaDevicesChanged?: (devices: ConnectedMediaDevice[]) => void\n public onBluetoothMessage?: (msg: BluetoothToApp) => void\n /** @deprecated Use `crdt.onSynced` */\n public onYjsSynced?: () => void\n /** @deprecated Subscribe via `crdt.doc.on('update', ...)` instead. */\n public onYjsUpdate?: (update: Uint8Array) => void\n public hostInformation: HostInformation\n /**\n * Distances from the frame's edges to the area free of system UI, in CSS\n * px. Non-zero only for a companion frame declared\n * `CompanionFrameOption.edgeToEdge`, on a host drawing under the system\n * bars (Android). Also exposed as `--lavitre-safe-area-inset-top|right|\n * bottom|left` on `document.documentElement`, so plain CSS can use them:\n * `padding-bottom: var(--lavitre-safe-area-inset-bottom, 0px)`. Updated in\n * place before `onSafeAreaInsetsUpdated` fires. Added 1.51.\n */\n public safeAreaInsets: SafeAreaInsets = {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n }\n /**\n * The companion's own identity/runtime context, present only when this\n * frame is loaded by a la Vitre **companion** (`hostInformation.isCompanion`\n * is then true). Undefined on Vitre-side frames. Mirrors\n * `CompanionConnector.companionInformation`. Added 1.19.\n */\n public companionInformation?: CompanionInformation\n public initiator: Device\n public id: string\n public appId: string\n public initOptions: InitFrameOptions\n /**\n * @deprecated Use initOptions.border.modeinitOptions\n */\n public isBorderless: boolean\n public isFullscreen: boolean\n public state: Record<string, any> = {}\n\n /**\n * CRDT channel — Yjs doc + Awareness piped over the la Vitre transport.\n * Libraries (Carbone, …) can call `crdt.attach(doc, awareness)` to bring\n * their own; simple apps use `crdt.doc` / `crdt.awareness` directly.\n */\n public readonly crdt: CrdtChannel\n\n /**\n * CRDT-backed blob store built on `crdt.attachSubdoc` — see Connector.blobs.\n */\n public readonly blobs: BlobStore\n\n /**\n * AI tool channel — publish a catalog of tools the on-prem agent's LLM can call\n * on this frame: `ai.registerTools([{ name, description, parameters, sensitive }],\n * (name, args) => …)`. Register SIMPLE local names; the host namespaces them as\n * `<appId>__<name>`. Invocations run against the handler and reply automatically.\n */\n public readonly ai: AiChannel\n\n /** @deprecated Use `crdt.doc`. See Connector.yjsDoc for the setter\n * rationale (legacy field-assignment backward-compat). */\n get yjsDoc() {\n return this.crdt.doc\n }\n set yjsDoc(doc: Y.Doc) {\n this.crdt.attach(doc)\n }\n\n public position: Rect\n public zIndex: number\n\n private deviceStateListeners = new Set<() => void>()\n\n /**\n * Called after any change of `hostInformation.device`,\n * `hostInformation.devicesInSpace` or the available media devices (device\n * joined or left, privacy, fullscreen, scaling, media devices, Vitre\n * settings), once the matching `on…` callback has run. Unlike those callbacks, several\n * listeners can coexist: SDK helpers use this so they never replace a\n * handler the app assigned. Returns the unsubscribe function. Added 1.52.\n */\n public addDeviceStateListener(listener: () => void): () => void {\n this.deviceStateListeners.add(listener)\n return () => this.deviceStateListeners.delete(listener)\n }\n\n private notifyDeviceState() {\n for (const listener of this.deviceStateListeners) {\n try {\n listener()\n } catch (error) {\n console.error('[Frame] device state listener failed', error)\n }\n }\n }\n\n constructor(\n // `protected` (not `private`) so the companion-only subclass\n // `CompanionFrameImpl` (CompanionFrame.ts) can post its companion-frame\n // messages while keeping those methods off the Vitre `Frame` surface.\n protected readonly postMessage: PostMessageFrameApiOut,\n initMessage: InitializeFrame,\n public options: ViewOptions,\n initState?: Record<string, any>,\n ) {\n this.hostInformation = initMessage.hostInfo\n this.companionInformation = initMessage.companionInfo\n this.initiator = initMessage.initiator\n this.id = initMessage.id\n this.appId = initMessage.appId ?? ''\n this.initOptions = initMessage.options\n this.isBorderless = initMessage.isBorderless\n this.isFullscreen = initMessage.isFullscreen\n this.position = initMessage.position\n this.zIndex = 0\n if (initMessage.safeAreaInsets)\n this.applySafeAreaInsets(initMessage.safeAreaInsets)\n this.isFullscreen = initMessage.isFullscreen\n\n this.postMessage({\n type: 'frameInitialized',\n options,\n })\n\n const w = window as any\n w.frameConnector = this\n w.connector = this\n this.state = initState ?? {}\n\n // Mirror of the Connector guard — both connectors must behave\n // identically. See MIN_CRDT_HOST_VERSION for the rationale.\n //\n // Exception: a companion frame (`hostInformation.isCompanion`) is never\n // gated. Its host is the la-Vitre companion, which is deployed centrally\n // and always runs HEAD, so it always carries the CRDT relay. Gating it is\n // also actively harmful: the version it advertises is the companion's OWN\n // build version, and a misconfigured deploy can ship a stale placeholder\n // (a preview build shipped `1.2.0.0`), which silently disables Yjs sync\n // for every companion frame. The real sync peer is the Vitre, whose own\n // gate still applies on its side.\n const crdtSupported =\n this.hostInformation.isCompanion === true ||\n isMinVersion(this.hostInformation.version, MIN_CRDT_HOST_VERSION)\n this.crdt = new CrdtChannel((message, transfer) => {\n // Same as Connector: `FrameApiMessagesOut` already includes the four\n // `crdt*` arms (Frame.Model.ts), so no cast is needed.\n if (!crdtSupported) return\n this.postMessage(message, transfer)\n })\n this.crdt.onSynced(() => this.onYjsSynced?.())\n this.crdt.onUpdate((update) => this.onYjsUpdate?.(update))\n this.blobs = new BlobStore(this.crdt)\n\n // AI tool channel — same companion-exception + version gate as CRDT (a host\n // that predates the ai bridge ignores the unknown arms and never invokes).\n const aiSupported =\n this.hostInformation.isCompanion === true ||\n isMinVersion(this.hostInformation.version, MIN_AI_HOST_VERSION)\n this.ai = new AiChannel((message) => {\n if (!aiSupported) return\n this.postMessage(message)\n })\n\n if (this.state['@sharedStreamState.state']) {\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n state: this.state['@sharedStreamState.state'] as SharedStreamPlayState,\n }\n }\n if (typeof this.state['@sharedStreamState.duration'] === 'number') {\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n duration: this.state['@sharedStreamState.duration'] as number,\n }\n }\n if (typeof this.state['@sharedStreamState.position'] === 'number') {\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n position: this.state['@sharedStreamState.position'] as number,\n }\n }\n }\n\n private resolveRequest(msg: FrameApiMessagesIn) {\n this.requestResolvers = this.requestResolvers.filter(\n (rr) => !rr.isHandled(msg),\n )\n }\n\n raiseMessage(msg: FrameApiMessagesIn) {\n this.resolveRequest(msg)\n\n switch (msg.type) {\n case 'privacyChanged':\n this.hostInformation = {\n ...this.hostInformation,\n device: { ...this.hostInformation.device, privacy: msg.privacy },\n }\n this.onPrivacyChanged?.(msg.privacy)\n break\n case 'deviceJoined':\n this.hostInformation = {\n ...this.hostInformation,\n devicesInSpace: [\n ...this.hostInformation.devicesInSpace.filter(\n (d) => d.id !== msg.device.id,\n ),\n msg.device,\n ],\n }\n this.onDeviceJoined?.(msg.device)\n this.notifyDeviceState()\n break\n case 'deviceLeft':\n this.hostInformation = {\n ...this.hostInformation,\n devicesInSpace: this.hostInformation.devicesInSpace.filter(\n (d) => d.id !== msg.deviceId,\n ),\n }\n this.onDeviceLeft?.(msg.deviceId)\n this.notifyDeviceState()\n break\n case 'deviceMessageReceived':\n this.onDeviceMessageReceived?.(msg)\n break\n case 'localConnectorMessageReceived':\n this.onLocalConnectorMessageReceived?.(msg.data, msg.from, msg.fileData)\n break\n case 'menuClicked':\n this.onMenuClicked?.(msg.menuId, msg.tag, msg.isChecked)\n break\n case 'fieldUpdated':\n this.onFieldUpdated?.(msg.field)\n break\n case 'isInteractingChanged':\n this.onInteractingChanged?.(msg.isInteracting)\n break\n case 'borderlessUpdated':\n this.isBorderless = msg.isBorderless\n this.onBorderlessChanged?.(msg.isBorderless)\n break\n case 'fullscreenUpdated':\n this.isFullscreen = msg.isFullscreen\n this.onFullscreenChanged?.(msg.isFullscreen)\n break\n case 'fileLoaded':\n this.onFileLoaded?.(msg.file)\n break\n case 'fileProgress':\n this.onFileProgress?.(msg.bytes, msg.totalBytes)\n break\n case 'exportRequest':\n {\n const resolve = (data: ExportData) => {\n this.postMessage({\n type: 'exportDone',\n request: msg,\n data,\n })\n }\n\n const reject = (error: string) => {\n this.postMessage({\n type: 'exportDone',\n request: msg,\n error,\n })\n }\n this.onExportRequest?.(msg, resolve, reject)\n }\n break\n case 'knockKnockReceived':\n this.onKnockKnock?.(msg)\n break\n case 'settingsUpdated':\n this.hostInformation = {\n ...this.hostInformation,\n settings: msg.settings,\n }\n this.onSettingsUpdated?.(msg.settings)\n break\n case 'vitreSettingsUpdated':\n this.hostInformation = {\n ...this.hostInformation,\n space: msg.currentSpace,\n vitreSettings: msg,\n device: {\n ...this.hostInformation.device,\n name: msg.name ?? this.hostInformation.device.name,\n color: msg.color,\n },\n }\n this.onVitreSettingsUpdated?.(msg)\n this.notifyDeviceState()\n break\n case 'connectionCodeUpdated':\n this.hostInformation = {\n ...this.hostInformation,\n companionCode: msg.companionCode,\n }\n this.onConnectionCodeUpdated?.(msg.companionCode)\n break\n case 'notificationButtonClicked':\n this.onNotificationButtonClicked?.(msg)\n break\n case 'notificationDismissed':\n this.onNotificationDismissed?.(msg.id)\n break\n case 'devicePrivacyChanged':\n this.hostInformation = {\n ...this.hostInformation,\n devicesInSpace: [\n ...this.hostInformation.devicesInSpace.filter(\n (d) => d.id !== msg.device.id,\n ),\n msg.device,\n ],\n }\n this.onDevicePrivacyChanged?.(msg.device)\n this.notifyDeviceState()\n break\n case 'deviceFrameLoaded':\n this.onDeviceFrameLoaded?.(msg)\n break\n case 'deviceFrameUnloaded':\n this.onDeviceFrameUnloaded?.(msg)\n break\n case 'deviceFrameConnectorLoaded':\n this.onDeviceFrameConnectorLoaded?.(msg)\n break\n case 'pendingDevicesConnectionRequested':\n this.onPendingDevicesConnectionRequested?.(msg.pendingDevices)\n break\n case 'borderOptionsUpdated':\n this.onBorderOptionsUpdated?.(msg)\n break\n case 'voiceActionDetected':\n this.onVoiceActionDetected?.(msg)\n break\n case 'stateReplaced':\n this._onStateReplaced(msg)\n break\n case 'positionUpdated':\n this.position = msg.position\n this.zIndex = msg.zIndex\n this.isFullscreen = msg.isFullscreen\n this.onPositionUpdated?.(msg)\n break\n case 'safeAreaInsetsUpdated':\n this.applySafeAreaInsets(msg.safeAreaInsets)\n this.onSafeAreaInsetsUpdated?.(msg)\n break\n case 'deviceFullscreenUpdated':\n this.hostInformation.devicesInSpace =\n this.hostInformation.devicesInSpace.map((d) =>\n d.id === msg.deviceId ? { ...d, fullscreen: msg.fullscreen } : d,\n )\n this.onDeviceFullscreenUpdated?.(msg)\n this.notifyDeviceState()\n break\n case 'visibilityChanged':\n this.onVisibilityChanged?.(msg)\n break\n case 'deviceScalingUpdated':\n if (msg.deviceId === this.hostInformation.device.id) {\n this.hostInformation.device.sendingScaling = msg.sendingScaling\n this.hostInformation.device.orientation = msg.orientation\n this.hostInformation.device.orientationBy = msg.orientationBy\n }\n this.hostInformation.devicesInSpace =\n this.hostInformation.devicesInSpace.map((d) =>\n d.id === msg.deviceId\n ? {\n ...d,\n sendingScaling: msg.sendingScaling,\n orientation: msg.orientation,\n orientationBy: msg.orientationBy,\n }\n : d,\n )\n this.onDeviceScalingUpdated?.(msg)\n this.notifyDeviceState()\n break\n case 'updateFrameName':\n this.options.name = msg.name\n this.onUpdateFrameName?.(msg.name)\n break\n case 'localSharedStreamUpdate':\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n volume: msg.volume,\n }\n this.onSharedStreamUpdate?.(this.sharedStream.lastState)\n break\n case 'sharedStreamAvailable': {\n // Reverse breakout box — rebuild a live MediaStream from the readables\n // the host transferred into this frame (one MediaStreamTrackGenerator\n // per track; pipe the readable into its writable). Mirrors the host's\n // tracksFromReadables / SDK toShareTracks on the share side.\n const tracks = msg.tracks.map((t) => {\n const generator = new MediaStreamTrackGenerator({ kind: t.kind })\n t.readable.pipeTo(generator.writable).catch(() => {})\n return generator as MediaStreamTrack\n })\n this.onSharedStream?.(msg.streamId, new MediaStream(tracks))\n break\n }\n case 'sharedStreamRemoved':\n this.onSharedStreamRemoved?.(msg.streamId)\n break\n case 'mediaDevicesChanged':\n this.hostInformation = {\n ...this.hostInformation,\n vitreSettings: {\n ...this.hostInformation.vitreSettings,\n availableMediaDevices: msg.devices,\n },\n }\n this.onMediaDevicesChanged?.(msg.devices)\n this.notifyDeviceState()\n break\n case 'bluetooth':\n this.onBluetoothMessage?.(msg)\n break\n case 'crdtUpdate':\n case 'crdtSyncComplete':\n case 'crdtRequestSync':\n case 'crdtAwarenessUpdate':\n case 'crdtSubdocUpdate':\n case 'crdtSubdocSyncComplete':\n case 'crdtSubdocTransferProgress':\n case 'crdtSubdocRequestSync':\n this.crdt.handleMessage(msg)\n break\n case 'aiInvoke':\n void this.ai.handleInvoke(msg.id, msg.name, msg.args)\n break\n case 'companionFramePeerJoined':\n this.onCompanionFramePeerJoined?.(msg.peer)\n break\n case 'companionFramePeerLeft':\n this.onCompanionFramePeerLeft?.(msg.peerId)\n break\n case 'companionFramePeersUpdated':\n this.onCompanionFramePeersUpdated?.(msg.peers)\n break\n }\n\n this.onMessageReceived?.(msg)\n }\n\n /** Stores the insets and mirrors them as `--lavitre-safe-area-inset-*` on `<html>`. */\n private applySafeAreaInsets(insets: SafeAreaInsets) {\n this.safeAreaInsets = insets\n const root =\n typeof document !== 'undefined' ? document.documentElement : undefined\n if (!root) return\n for (const edge of ['top', 'right', 'bottom', 'left'] as const) {\n root.style.setProperty(\n `--lavitre-safe-area-inset-${edge}`,\n `${insets[edge]}px`,\n )\n }\n }\n\n private _onStateReplaced(msg: StateReplaced) {\n const oldState = this.state\n this.state = msg.state\n\n let hasSharedStreamUpdate = false\n\n msg.delta.forEach((update) => {\n if (\n update.key === '@sharedStreamState.state' &&\n update.action === 'add'\n ) {\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n state: update.value as SharedStreamPlayState,\n }\n hasSharedStreamUpdate = true\n } else if (\n update.key === '@sharedStreamState.duration' &&\n update.action === 'add'\n ) {\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n duration: update.value as number,\n }\n hasSharedStreamUpdate = true\n } else if (\n update.key === '@sharedStreamState.position' &&\n update.action === 'add'\n ) {\n this.sharedStream.lastState = {\n ...this.sharedStream.lastState,\n position: update.value as number,\n }\n hasSharedStreamUpdate = true\n }\n })\n\n if (hasSharedStreamUpdate) {\n this.onSharedStreamUpdate?.(this.sharedStream.lastState)\n }\n\n this.onStateReplaced?.(this.state, oldState, msg.replacedBy, msg.delta)\n }\n\n public sendMessageTo(message: SendMessageTo) {\n this.postMessage({ type: 'sendMessageTo', ...message })\n }\n\n public sendMessageToAll(message: SendMessageToAll) {\n this.postMessage({ type: 'sendMessageToAll', ...message })\n }\n\n public sendKnockKnock(message: SendKnockKnock) {\n this.postMessage({ type: 'sendKnockKnock', ...message })\n }\n\n /** Release the resources owned by this frame. Tears the CRDT channel\n * down (unbinds doc/awareness listeners, destroys the default Y.Doc +\n * Awareness). Safe to call multiple times. */\n public destroy(): void {\n this.crdt.destroy()\n }\n\n public setFullscreen() {\n this.postMessage({\n type: 'setFullscreen',\n })\n }\n\n public setMenu(menu: FrameMenuEntry[]) {\n this.postMessage({\n type: 'setFrameMenu',\n menu,\n })\n }\n\n /**\n * SDK 1.47 — replace the frame's export sources after initialization.\n *\n * The initial set comes from the `ViewOptions.exportSources` returned by\n * `initializeFrame`; this is the only way to change it afterwards, e.g.\n * when a document gains a format, or to flip `availableForCompanion` on a\n * source once it becomes too large to hand to a phone.\n *\n * The call REPLACES the whole list — pass every source you still want,\n * not just the new ones. The host rebuilds both its own export menu and\n * the companions' from it.\n */\n public setExportSources(exportSources: AvailableExportSource[]) {\n this.postMessage({\n type: 'setExportSources',\n exportSources,\n })\n }\n\n public applyStreamAdvancedConstraints(\n constraints: ApplyStreamAdvancedConstraints,\n ) {\n this.postMessage({\n ...constraints,\n type: 'applyStreamAdvancedConstraints',\n })\n }\n\n /**\n * Replace the video track of this frame's shared stream with a fresh\n * `getUserMedia` capture matching `constraints` (e.g. to switch camera),\n * keeping the same share alive (`replaceTrack` on the host, no\n * renegotiation). The host forces the requested `deviceId` as `{ exact }`.\n * Resolves with the new track infos so the frame can rebuild its menu.\n */\n public async requestReplaceStream(\n constraints: MediaStreamConstraints,\n ): Promise<MediaTrackInfo[]> {\n const requestId = randomUuid()\n return await this.postRequest<MediaTrackInfo[]>(\n { type: 'replaceFrameStream', requestId, constraints },\n (msg, resolve, reject) => {\n if (\n msg.type === 'replaceFrameStreamCompleted' &&\n msg.requestId === requestId\n ) {\n if (msg.error != null || msg.tracks == null) {\n reject(msg.error ?? 'replaceFrameStream failed')\n } else {\n resolve(msg.tracks)\n }\n }\n },\n )\n }\n\n public setWindowed() {\n this.postMessage({\n type: 'setWindowed',\n })\n }\n\n public close() {\n this.postMessage({\n type: 'close',\n })\n }\n\n public sendToLocalFrame(\n frameConnectorId: string,\n data: any,\n fileData?: FileData,\n ) {\n this.postMessage({\n type: 'sendToLocalFrame',\n frameConnectorId,\n data,\n fileData,\n })\n }\n\n public sendToLocalMainConnector(data: any, fileData?: FileData) {\n this.postMessage({\n type: 'sendToLocalFrame',\n frameConnectorId: undefined,\n data,\n fileData,\n })\n }\n\n /**\n * Convenience for companion frames: send a message to the paired Vitre\n * frame (same `frameConnectorId`). Wraps `sendToLocalFrame` with the\n * current frame's id so callers don't have to repeat it. The receiving\n * Vitre frame surfaces it on `onLocalConnectorMessageReceived` (data,\n * from, fileData). The same primitive works from a Vitre frame too,\n * but on the Vitre most apps want `sendMessageTo` / `sendMessageToAll`\n * to reach other devices instead — which the companion has no way to\n * address. See `CompanionFrame` for the trimmed surface intended for\n * apps running on a companion frame iframe.\n */\n public sendToVitreFrame(data: any, fileData?: FileData) {\n this.sendToLocalFrame(this.id, data, fileData)\n }\n\n // The companion-only send methods `sendMessageToVitreConnector` and\n // `closeOnCompanion` deliberately do NOT live on the Vitre `Frame`. They post\n // host messages (`sendToVitreConnector` / `closeOnCompanion`) that ONLY the\n // companion host decodes — a Vitre host rejects them with \"case type not\n // found\". They live on `CompanionFrame` (the subclass returned by\n // `initializeCompanionFrame`, see CompanionFrame.ts). A Vitre frame that needs\n // to reach its own connector uses `sendToLocalMainConnector` instead.\n\n public stopInteracting() {\n this.postMessage({\n type: 'stopInteracting',\n })\n }\n\n public setPosition(position: LayoutPosition) {\n this.postMessage({\n type: 'setPosition',\n ...position,\n })\n }\n\n public setVisibility(visibility: Visibility) {\n this.postMessage({\n type: 'setVisibility',\n visibility,\n })\n }\n\n public setReducedAudioMode(enabled: boolean) {\n this.postMessage({\n type: 'setReducedAudioMode',\n enabled,\n })\n }\n\n public startInteracting() {\n this.postMessage({ type: 'startInteracting' })\n }\n\n public sendToSerialPort(serialPort: SendToSerialPort) {\n this.postMessage({\n type: 'sendToSerialPort',\n ...serialPort,\n })\n }\n\n /// Request access to a serial port (see `Connector.requestSerialPortAccess`).\n /// Resolves with the granted port name (empty string if denied/cancelled).\n /// With `{ port }` the host pre-grants it; with no argument the host shows\n /// its port-picker and resolves with the chosen port.\n public async requestSerialPortAccess(\n request?: RequestSerialPortAccess,\n ): Promise<string> {\n const requestId = randomUuid()\n return await this.postRequest<string>(\n { type: 'requestSerialPortAccess', requestId, port: request?.port },\n (msg, resolve, reject) => {\n if (\n msg.type === 'serialPortAccessResult' &&\n msg.requestId === requestId\n ) {\n if (msg.port) {\n resolve(msg.port)\n } else {\n reject(msg.reason ?? 'cancelled')\n }\n }\n },\n )\n }\n\n public sendBluetoothMessage(msg: BluetoothFromApp) {\n this.postMessage({ ...msg, type: 'bluetooth' } as any)\n }\n\n public disconnectGuests(deviceIds: string[]) {\n this.postMessage({\n type: 'disconnectGuests',\n deviceIds,\n })\n }\n\n public requestStreamSizeUpdate(updates: RequestStreamSizeUpdate) {\n this.postMessage({\n type: 'requestStreamSizeUpdate',\n ...updates,\n })\n }\n\n public updateName(name: string) {\n this.postMessage({\n type: 'updateName',\n name,\n })\n }\n\n /**\n * Whether {@link shareStream} is available in this runtime (Chromium\n * Insertable Streams + same-site hosting). Same gate as\n * `Connector.canShareStream`.\n */\n public canShareStream(): boolean {\n return typeof MediaStreamTrackProcessor !== 'undefined'\n }\n\n private toShareTracks(stream: MediaStream): {\n tracks: ShareStreamTrack[]\n transfer: Transferable[]\n } {\n const tracks: ShareStreamTrack[] = []\n const transfer: Transferable[] = []\n for (const track of stream.getTracks()) {\n const { readable } = new MediaStreamTrackProcessor({ track })\n tracks.push({\n kind: track.kind as ShareStreamTrack['kind'],\n readable,\n settings: track.getSettings(),\n })\n transfer.push(readable)\n }\n return { tracks, transfer }\n }\n\n /**\n * Share a `MediaStream` the frame produced (e.g. a WebGL-transformed track,\n * or a camera the frame opened) TO the Vitre, which forwards it to the space\n * peers. Frame-context counterpart of `Connector.shareStream`: needed because\n * a transform frame builds its output track locally and must reshare it.\n * Handed over zero-copy via the breakout box. Returns a `sharedStreamId` for\n * {@link replaceShareStream} / {@link stopShareStream}.\n */\n public async shareStream(\n stream: MediaStream,\n options?: ShareStreamOptions,\n ): Promise<string> {\n if (!this.canShareStream()) {\n throw new Error(\n 'shareStream is not supported in this runtime (requires Chromium MediaStreamTrackProcessor and same-site hosting)',\n )\n }\n const sharedStreamId = randomUuid()\n const requestId = randomUuid()\n const { tracks, transfer } = this.toShareTracks(stream)\n await this.postRequest<void>(\n { type: 'shareStream', requestId, sharedStreamId, options, tracks },\n (msg, resolve, reject) => {\n if (\n msg.type === 'shareStreamCompleted' &&\n msg.requestId === requestId\n ) {\n if (msg.error != null) reject(msg.error)\n else resolve(undefined)\n }\n },\n transfer,\n )\n return sharedStreamId\n }\n\n /**\n * Swap the source of an open frame share WITHOUT closing it (no\n * renegotiation blip). `sharedStreamId` is the value returned by\n * {@link shareStream}. See `Connector.replaceShareStream`.\n */\n public async replaceShareStream(\n sharedStreamId: string,\n streamOrTrack: MediaStream | MediaStreamTrack,\n ): Promise<void> {\n if (!this.canShareStream()) {\n throw new Error('replaceShareStream is not supported in this runtime')\n }\n const stream =\n streamOrTrack instanceof MediaStream\n ? streamOrTrack\n : new MediaStream([streamOrTrack])\n const requestId = randomUuid()\n const { tracks, transfer } = this.toShareTracks(stream)\n await this.postRequest<void>(\n { type: 'replaceShareStream', requestId, sharedStreamId, tracks },\n (msg, resolve, reject) => {\n if (\n msg.type === 'shareStreamCompleted' &&\n msg.requestId === requestId\n ) {\n if (msg.error != null) reject(msg.error)\n else resolve(undefined)\n }\n },\n transfer,\n )\n }\n\n /** Stop a frame share. `sharedStreamId` is the value returned by {@link shareStream}. */\n public stopShareStream(sharedStreamId: string): void {\n this.postMessage({ type: 'stopShareStream', sharedStreamId })\n }\n\n /**\n * Attach a `MediaStream` produced by this frame to a target frame's standard\n * sharing slot, WITHOUT opening a new `SharedContent` or establishing a new\n * `RTCPeerConnection`. The stream is forwarded zero-copy (breakout box) from\n * this frame's vitre to the already-open instances of `targetFrameConnectorId`\n * on other vitres; those instances receive it via {@link onSharedStream} (the\n * existing `sharedStreamAvailable` delivery arm — no new protocol arm).\n *\n * - Requires Chromium Insertable Streams (same guard as {@link shareStream}).\n * - Default target: this frame's own `frameConnectorId`, i.e. the same app\n * type running on peer vitres. Pass `opts.targetFrameConnectorId` to route\n * to a different frame type.\n * - Resolves when the host confirms delivery (or rejects with the host error).\n *\n * **Delivery semantics:**\n * - When `targetFrameConnectorId` is absent (default, target == this frame\n * type), the stream is delivered to peer vitres' instances of this frame via\n * {@link onSharedStream}. The calling frame already holds `stream` and does\n * NOT receive it back via `onSharedStream` (no loopback — intentional).\n * - When `targetFrameConnectorId` designates a DIFFERENT frame type, that\n * frame — including its instance on the emitting vitre — receives the stream\n * via {@link onSharedStream}.\n */\n public async attachStream(\n stream: MediaStream,\n opts?: { targetFrameConnectorId?: string },\n ): Promise<void> {\n if (!this.canShareStream()) {\n throw new Error(\n 'attachStream is not supported in this runtime (requires Chromium MediaStreamTrackProcessor and same-site hosting)',\n )\n }\n const requestId = randomUuid()\n const { tracks, transfer } = this.toShareTracks(stream)\n await this.postRequest<void>(\n {\n type: 'attachStream',\n requestId,\n targetFrameConnectorId: opts?.targetFrameConnectorId,\n tracks,\n },\n (msg, resolve, reject) => {\n if (\n msg.type === 'attachStreamCompleted' &&\n msg.requestId === requestId\n ) {\n if (msg.error != null) reject(msg.error)\n else resolve(undefined)\n }\n },\n transfer,\n )\n }\n\n /**\n * Stop a stream previously attached with {@link attachStream} on the target\n * frame. Receivers see {@link onSharedStreamRemoved}. Default target: this\n * frame's own `frameConnectorId`.\n */\n public detachStream(opts?: { targetFrameConnectorId?: string }): void {\n this.postMessage({\n type: 'detachStream',\n targetFrameConnectorId: opts?.targetFrameConnectorId,\n })\n }\n\n /**\n * Fetch the ICE/TURN servers the HOST already uses for its own WebRTC P2P\n * (the Vitre's `StartWebRTCOffer` config, or the companion's `WebRTCOffer`\n * config — same relays, same credentials). The result feeds straight into\n * `new RTCPeerConnection({ iceServers })`, letting an app stand up its OWN\n * peer connection — e.g. a companion-camera frame connecting directly to its\n * paired Vitre transform frame — that traverses NAT through the platform's\n * TURN infrastructure without shipping its own credentials.\n *\n * Resolves to `[]` on hosts that predate this request (the caller should\n * race a timeout and fall back to a public STUN-only config). See\n * {@link IceServerConfig}.\n */\n public async getIceServers(): Promise<IceServerConfig[]> {\n const requestId = randomUuid()\n return await this.postRequest<IceServerConfig[]>(\n { type: 'getIceServers', requestId },\n (msg, resolve, _reject) => {\n if (msg.type === 'iceServersResponse' && msg.requestId === requestId) {\n resolve(msg.iceServers ?? [])\n }\n },\n )\n }\n\n private requestResolvers: RequestResolver[] = []\n private async postRequest<Data>(\n data: FrameApiMessagesOut,\n handler: (\n msg: FrameApiMessagesIn,\n resolve: (data: Data) => void,\n reject: (error: string) => void,\n ) => void,\n transfer?: Transferable[],\n ) {\n return await new Promise<Data>((resolve, reject) => {\n let isHandled = false\n const handleAndResolve = (data: Data) => {\n isHandled = true\n resolve(data)\n }\n\n const handleAndReject = (error: any) => {\n isHandled = true\n reject(error)\n }\n\n const resolver = {\n isHandled: (msg: FrameApiMessagesIn) => {\n try {\n handler(msg, handleAndResolve, handleAndReject)\n } catch (error) {\n handleAndReject(error)\n }\n return isHandled\n },\n }\n this.requestResolvers.push(resolver)\n this.postMessage(data, transfer)\n })\n }\n\n public async requestEnumerateLocalFrames(): Promise<LoadedFrame[]> {\n const requestId = randomUuid()\n return await this.postRequest<LoadedFrame[]>(\n { type: 'enumerateLoadedFrames', requestId },\n (msg, resolve, _reject) => {\n if (\n msg.type === 'enumerateLoadedFramesCompleted' &&\n msg.requestId === requestId\n ) {\n resolve(msg.frames)\n }\n },\n )\n }\n\n /** @deprecated Use sendMessageToEmbed */\n public sendExtensionMessage(\n data: any,\n target: MessageTarget,\n fileData?: FileData,\n ) {\n this.postMessage({\n type: 'extensionMessage',\n data,\n target,\n fileData,\n })\n }\n\n /** @deprecated Use sendMessageToEmbed */\n public sendAppMessage(data: any, target: MessageTarget, fileData?: FileData) {\n this.postMessage({\n type: 'appMessage',\n data,\n target,\n fileData,\n })\n }\n\n public sendMessageToEmbed(\n data: any,\n target: MessageTarget,\n fileData?: FileData,\n ) {\n this.postMessage({\n type: 'appMessage',\n data,\n target,\n fileData,\n })\n }\n\n public async requestVitreSettings() {\n return await this.postRequest<VitreSettings>(\n { type: 'getVitreSettings' },\n (msg, resolve, _reject) => {\n if (msg.type === 'vitreSettingsResponse') {\n resolve(msg as VitreSettings)\n }\n },\n )\n }\n\n public setVitreSettings(setters: VitreSettingsSetter) {\n this.postMessage({ type: 'setVitreSettings', ...setters })\n }\n\n /**\n * Share a URL/data with the host, which routes it to a matching app.\n * @param owner Optional device id (`HostInformation.devicesInSpace[].id`) to\n * attribute the resulting shared content to. Drives the languette colour/info\n * and the content appears already-owned on every vitre. Default: opener.\n */\n public shareData(url: string, targetAppId?: AppId, owner?: string) {\n this.postMessage({\n type: 'shareData',\n url,\n targetAppId,\n owner,\n })\n }\n\n /**\n * Share a file with the host, which routes it to a matching app.\n * @param owner Optional device id to attribute the share to. See {@link shareData}.\n */\n public shareFile(fileData: FileData, targetAppId: AppId, owner?: string) {\n this.postMessage({\n type: 'shareFile',\n fileData,\n targetAppId,\n owner,\n })\n }\n\n public saveSettings(settings: any) {\n this.postMessage({\n type: 'saveSettings',\n settings,\n })\n }\n\n public changeTeamSpace(space: string) {\n this.postMessage({\n type: 'changeTeamSpace',\n space,\n })\n }\n\n public changeTeamSpaceGuest(space: string, teamDomain: string) {\n this.postMessage({\n type: 'changeTeamSpaceGuest',\n space,\n teamDomain,\n })\n }\n\n public showNotification(notification: NotificationInfo) {\n this.postMessage({\n ...notification,\n type: 'showNotification',\n })\n }\n\n public hideNotification(notificationId: string) {\n this.postMessage({\n id: notificationId,\n type: 'hideNotification',\n })\n }\n\n public changePrivacy(privacy: Privacy) {\n this.postMessage({\n type: 'changePrivacy',\n privacy,\n })\n }\n\n public trackEvent(name: string, properties?: Record<string, any>) {\n this.postMessage({\n type: 'trackEvent',\n name,\n properties,\n })\n }\n\n public startTrackEvent(name: string) {\n this.postMessage({\n type: 'startTrackEvent',\n name,\n })\n }\n\n public stopTrackEvent(name: string, properties?: Record<string, any>) {\n this.postMessage({\n type: 'stopTrackEvent',\n name,\n properties,\n })\n }\n\n public getMainConnectorFrame(): Window | null {\n try {\n const mainFrameId = `${this.appId}|${this.appId}`\n return (window.parent.frames as any)[mainFrameId]\n } catch (_error) {\n return null\n }\n }\n\n public getMainConnector(): Connector | null {\n const mainFrame = this.getMainConnectorFrame() as any\n return mainFrame?.mainConnector as Connector\n }\n\n public setBorderOptions(borderOptions: BorderOptions) {\n this.postMessage({ type: 'setBorderOptions', ...borderOptions })\n }\n\n public setVoiceActions(actions: VoiceAction[]) {\n this.postMessage({\n type: 'setVoiceActions',\n actions,\n })\n }\n\n public async requestStreamCapture() {\n const requestId = randomUuid()\n return await this.postRequest<StreamCapture>(\n { type: 'streamFrameCaptureRequest', requestId },\n (msg, resolve, reject) => {\n if (\n msg.type === 'streamFrameCapturedResponse' &&\n msg.requestId === requestId\n ) {\n if (msg.response == null) {\n reject(msg.error ?? 'failed to get streamFrameCapturedResponse')\n } else {\n resolve(msg.response)\n }\n }\n },\n )\n }\n\n public async requestStats() {\n const requestId = randomUuid()\n return await this.postRequest<StatsResponse>(\n { type: 'getStats', requestId },\n (msg, resolve, _reject) => {\n if (msg.type === 'statsResponse' && msg.requestId === requestId) {\n resolve(msg)\n }\n },\n )\n }\n\n public updateState(updates: UpdateStateEntry[], forceApplyLocally = true) {\n updates.forEach((update) => {\n //Compat fix, add value for remove action\n if (update.action === 'remove') {\n ;(update as any).value = null\n }\n })\n\n this.postMessage({\n type: 'updateState',\n updates,\n })\n\n if (forceApplyLocally) {\n updates.forEach((update) => {\n if (update.action === 'add') {\n this.state[update.key] = update.value\n } else {\n delete this.state[update.key]\n }\n })\n }\n }\n\n public sharedStream: SharedStream = {\n lastState: {\n position: 0,\n duration: 0,\n volume: 1,\n state: 'paused',\n },\n play: () => {\n this.postMessage({\n type: 'sharedStreamAction',\n action: 'play',\n })\n },\n\n pause: () => {\n this.postMessage({\n type: 'sharedStreamAction',\n action: 'pause',\n })\n },\n\n seek: (position: number, isRelative: boolean = false) => {\n this.postMessage({\n type: 'sharedStreamAction',\n action: 'seek',\n position,\n isRelative,\n })\n },\n\n setVolume: (volume: number, muted: boolean = false) => {\n this.postMessage({\n type: 'sharedStreamAction',\n action: 'volume',\n volume,\n muted,\n })\n },\n }\n}\n\ntype PostMessageFrameApiOut = (\n message: FrameApiMessagesOut,\n transfer?: Transferable[],\n) => void\n\nexport async function initializeFrame<T extends Frame>(\n init: (\n info: HostInformation,\n initiator: Device,\n options: InitFrameOptions,\n state?: Record<string, any>,\n ) => ViewOptions,\n createFrame?: new (\n postMessage: PostMessageFrameApiOut,\n initMessage: InitializeFrame,\n options: ViewOptions,\n ) => T,\n) {\n return await new Promise<T>((resolve) => {\n const channel = new MessageChannel()\n let frame: T | null = null\n const messageHandler =\n (createPostMessage: (origin: string) => PostMessageFrameApiOut) =>\n (e: MessageEvent<FrameApiMessagesIn>): any => {\n switch (e.data.type) {\n case 'initialize':\n if (frame === null) {\n const initializeMsg = e.data\n const options = init(\n initializeMsg.hostInfo,\n initializeMsg.initiator,\n initializeMsg.options,\n initializeMsg.state,\n )\n frame = new (createFrame ?? Frame)(\n createPostMessage(initializeMsg.hostInfo.origin),\n initializeMsg,\n options,\n initializeMsg.state,\n ) as T\n resolve(frame)\n }\n break\n default:\n frame?.raiseMessage(e.data)\n break\n }\n }\n\n channel.port1.onmessage = messageHandler(\n (_origin: string) => (message, transfer?: Transferable[]) => {\n channel.port1.postMessage(message, transfer ?? [])\n },\n )\n\n window.parent.postMessage(\n {\n type: 'connectorInitializationRequest',\n version: apiVersion,\n },\n '*',\n [channel.port2],\n )\n\n window.addEventListener(\n 'message',\n messageHandler(\n (origin: string) => (message, transfer?: Transferable[]) => {\n window.parent.postMessage(message, origin, transfer)\n },\n ),\n false,\n )\n })\n}\n"]}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type { ConnectedMediaDevice, DeviceScaling } from '../Common/index.js';
|
|
2
|
+
import { type PreviewLayout } from '../Common/PreviewScaling.js';
|
|
3
|
+
import type { Frame } from './Frame.js';
|
|
4
|
+
export type LocalPreviewOptions = {
|
|
5
|
+
/** Longest side requested from the camera and of `getScaledStream`. Default 1920. */
|
|
6
|
+
maxSize?: number;
|
|
7
|
+
/**
|
|
8
|
+
* First delay before reopening the camera after a failure; it doubles on
|
|
9
|
+
* each consecutive failure, up to 30 s. Also the period of the check for
|
|
10
|
+
* an ended camera. Default 1000 ms.
|
|
11
|
+
*/
|
|
12
|
+
retryDelayMs?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Resize the frame to the preview's orientation (portrait or landscape)
|
|
15
|
+
* each time the camera opens, keeping its long and short sides. Default
|
|
16
|
+
* false.
|
|
17
|
+
*/
|
|
18
|
+
fitFrame?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Lists the cameras, with ids `getUserMedia` accepts in this frame.
|
|
21
|
+
* Defaults to the main connector's `requestEnumerateDevices`, which maps
|
|
22
|
+
* the Vitre's device ids to this frame's.
|
|
23
|
+
*/
|
|
24
|
+
enumerateDevices?: () => Promise<ConnectedMediaDevice[]>;
|
|
25
|
+
};
|
|
26
|
+
/** Why the camera is not open: a `DOMException` name from `getUserMedia` (`NotAllowedError`, `NotFoundError`…) or `TimeoutError`. */
|
|
27
|
+
export type LocalPreviewError = {
|
|
28
|
+
name: string;
|
|
29
|
+
message: string;
|
|
30
|
+
};
|
|
31
|
+
export type LocalPreviewState = {
|
|
32
|
+
/** The raw camera stream, null until the camera is open. */
|
|
33
|
+
stream: MediaStream | null;
|
|
34
|
+
/** Resolved scaling: zoom/offsets seen by the fullscreen participant. */
|
|
35
|
+
scaling: DeviceScaling;
|
|
36
|
+
layout: PreviewLayout;
|
|
37
|
+
/** Last failure to open the camera, null once it is open. Retries go on meanwhile. */
|
|
38
|
+
error: LocalPreviewError | null;
|
|
39
|
+
};
|
|
40
|
+
export type AttachOptions = {
|
|
41
|
+
/** `contain` letterboxes the preview, `cover` fills the container. Default `contain`. */
|
|
42
|
+
fit?: 'contain' | 'cover';
|
|
43
|
+
};
|
|
44
|
+
export type ScaledStreamOptions = {
|
|
45
|
+
/** Frame rate of the canvas fallback (browsers without insertable streams). Default 30. */
|
|
46
|
+
frameRate?: number;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Local camera preview cropped, zoomed and oriented the way the participants
|
|
50
|
+
* of the space see it — the behavior of the core app's "local preview".
|
|
51
|
+
*
|
|
52
|
+
* ```ts
|
|
53
|
+
* const preview = new LocalPreview(frame)
|
|
54
|
+
* preview.attach(document.getElementById('view')!) // CSS rendering, no per-frame cost
|
|
55
|
+
* // or: video.srcObject = preview.getScaledStream() // already-cropped MediaStream
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* It opens the camera the Vitre uses as its main stream (retrying with a
|
|
59
|
+
* growing delay, reopening it when it ends or when the main camera changes)
|
|
60
|
+
* and follows the host's scaling updates through
|
|
61
|
+
* `Frame.addDeviceStateListener`, so the app's own `on…` callbacks stay
|
|
62
|
+
* untouched.
|
|
63
|
+
*/
|
|
64
|
+
export declare class LocalPreview {
|
|
65
|
+
private readonly frame;
|
|
66
|
+
private readonly options;
|
|
67
|
+
private currentStream;
|
|
68
|
+
private cameraDeviceId;
|
|
69
|
+
private currentScaling;
|
|
70
|
+
private currentLayout;
|
|
71
|
+
private currentError;
|
|
72
|
+
private failures;
|
|
73
|
+
private nextAttemptAt;
|
|
74
|
+
private seenMediaDevices;
|
|
75
|
+
private acquiring;
|
|
76
|
+
private checkingCamera;
|
|
77
|
+
private recheckCamera;
|
|
78
|
+
private disposed;
|
|
79
|
+
private readonly listeners;
|
|
80
|
+
private readonly cleanups;
|
|
81
|
+
private scaledStream;
|
|
82
|
+
private stopScaledStream;
|
|
83
|
+
constructor(frame: Frame, options?: LocalPreviewOptions);
|
|
84
|
+
get stream(): MediaStream | null;
|
|
85
|
+
get scaling(): DeviceScaling;
|
|
86
|
+
get layout(): PreviewLayout;
|
|
87
|
+
get error(): LocalPreviewError | null;
|
|
88
|
+
get state(): LocalPreviewState;
|
|
89
|
+
/** Called with the new state whenever the stream, the scaling or the error changes. Returns the unsubscribe function. */
|
|
90
|
+
addListener(listener: (state: LocalPreviewState) => void): () => void;
|
|
91
|
+
/**
|
|
92
|
+
* Renders the preview inside `container` with CSS transforms on a
|
|
93
|
+
* `<video>`: no per-frame work. Returns the detach function.
|
|
94
|
+
*/
|
|
95
|
+
attach(container: HTMLElement, options?: AttachOptions): () => void;
|
|
96
|
+
/**
|
|
97
|
+
* A `MediaStream` whose frames are already cropped, zoomed, rotated and
|
|
98
|
+
* mirrored: plug it into a `<video>`, WebGL, a recorder… On Chromium each
|
|
99
|
+
* frame goes through insertable streams and is redrawn in a worker — on
|
|
100
|
+
* the main thread while the worker starts, or for good if it cannot run
|
|
101
|
+
* (CSP without `blob:` in `worker-src`). Elsewhere a canvas redraws a
|
|
102
|
+
* hidden `<video>` (`options.frameRate`). It survives camera changes. The
|
|
103
|
+
* same stream is returned until its track ends (stopped by the app, or
|
|
104
|
+
* `dispose()`); the next call then builds a new one.
|
|
105
|
+
*/
|
|
106
|
+
getScaledStream(options?: ScaledStreamOptions): MediaStream;
|
|
107
|
+
/**
|
|
108
|
+
* Still image of the preview, as the participants see it. Rejects when the
|
|
109
|
+
* camera is not open or yields no image within 5 s.
|
|
110
|
+
*/
|
|
111
|
+
capture(type?: string, quality?: number): Promise<Blob>;
|
|
112
|
+
/** Stops the camera, the scaled stream and every attached rendering. */
|
|
113
|
+
dispose(): void;
|
|
114
|
+
private notify;
|
|
115
|
+
private setStream;
|
|
116
|
+
private setError;
|
|
117
|
+
/**
|
|
118
|
+
* The host's cameras as a comparable key: `vitreSettingsUpdated` replaces
|
|
119
|
+
* the whole list on any settings change, so its reference says nothing.
|
|
120
|
+
*/
|
|
121
|
+
private hostMediaDevices;
|
|
122
|
+
private onDeviceStateChanged;
|
|
123
|
+
private enumerate;
|
|
124
|
+
/** Reopens the camera when the main one is no longer the one open. */
|
|
125
|
+
private checkMainCamera;
|
|
126
|
+
private tick;
|
|
127
|
+
private openCamera;
|
|
128
|
+
private fitFrame;
|
|
129
|
+
/** Chromium: camera frames → transform (worker, else main thread) → generator track. */
|
|
130
|
+
private startFramePipeline;
|
|
131
|
+
/** Fallback: hidden `<video>` drawn into a canvas on every new camera frame. */
|
|
132
|
+
private startCanvasPipeline;
|
|
133
|
+
}
|