import { PartialBot , BotsState , Bot , BotTags , BotSpace , BotTagMasks , PortalType , RecordSpace , Record , RecordReference , } from './Bot' ; import { Action , DeviceAction , RemoteAction , DeviceSelector , RemoteActionResult , RemoteActionError , DeviceActionResult , DeviceActionError , remoteResult , remoteError , } from '@casual-simulation/causal-trees' ; import { clamp } from '../utils' ; import { hasValue } from './BotCalculations' ; import { RecordFileFailure } from '@casual-simulation/aux-records' ; export type LocalActions = BotActions | ExtraActions | AsyncActions ; /**
 * Defines a union type for all the possible events that can be emitted from a bots channel.
 */ export type BotAction = BotActions | TransactionAction | ExtraActions | AsyncActions | RemoteAction | RemoteActionResult | RemoteActionError | DeviceAction ; /**
 * Defines a union type for all the possible actions that manipulate the bot state.
 */ export type BotActions = AddBotAction | RemoveBotAction | UpdateBotAction | CreateCertificateAction | SignTagAction | RevokeCertificateAction | ApplyStateAction ; /**
 * Defines a set of possible local event types.
 */ export type ExtraActions = ShoutAction | RejectAction | ShowToastAction | ShowHtmlAction | HideHtmlAction | OpenQRCodeScannerAction | OpenBarcodeScannerAction | ShowQRCodeAction | ShowBarcodeAction | LoadServerAction | UnloadServerAction | SuperShoutAction | SendWebhookAction | GoToDimensionAction | GoToURLAction | OpenURLAction | ImportAUXAction | ShowInputForTagAction | SetForcedOfflineAction | ShellAction | OpenConsoleAction | DownloadAction | BackupToGithubAction | BackupAsDownloadAction | StartCheckoutAction | CheckoutSubmittedAction | FinishCheckoutAction | PasteStateAction | ReplaceDragBotAction | SetClipboardAction | ShowChatBarAction | ShowUploadAuxFileAction | MarkHistoryAction | BrowseHistoryAction | RestoreHistoryMarkAction | LoadSpaceAction | EnableARAction | EnableVRAction | ShowJoinCodeAction | RequestFullscreenAction | ExitFullscreenAction | LocalFormAnimationAction | GetRemoteCountAction | AddDropSnapTargetsAction | EnableCustomDraggingAction | EnablePOVAction | GoToTagAction | UpdateHtmlAppAction | HtmlAppEventAction | SetAppOutputAction | UnregisterHtmlAppAction ; /**
 * Defines a set of possible async action types.
 */ export type AsyncActions = AsyncResultAction | AsyncErrorAction | ShowInputAction | ShareAction | RegisterBuiltinPortalAction | RegisterPrefixAction | RunScriptAction | LoadBotsAction | ClearSpaceAction | SendWebhookAction | AnimateTagAction | UnlockSpaceAction | SetSpacePasswordAction | LoadFileAction | SaveFileAction | SetupChannelAction | ExportGpioPinAction | UnexportGpioPinAction | SetGpioPinAction | GetGpioPinAction | RpioInitAction | RpioExitAction | RpioOpenAction | RpioModeAction | RpioReadAction | RpioReadSequenceAction | RpioWriteAction | RpioWriteSequenceAction | RpioReadpadAction | RpioWritepadAction | RpioPudAction | RpioPollAction | RpioCloseAction | RpioI2CBeginAction | RpioI2CSetSlaveAddressAction | RpioI2CSetBaudRateAction | RpioI2CSetClockDividerAction | RpioI2CReadAction | RpioI2CWriteAction | RpioI2CEndAction | RpioPWMSetClockDividerAction | RpioPWMSetRangeAction | RpioPWMSetDataAction | RpioSPIBeginAction | RpioSPIChipSelectAction | RpioSPISetCSPolarityAction | RpioSPISetClockDividerAction | RpioSPISetDataModeAction | RpioSPITransferAction | RpioSPIWriteAction | RpioSPIEndAction | SerialConnectAction | SerialStreamAction | SerialOpenAction | SerialUpdateAction | SerialWriteAction | SerialReadAction | SerialCloseAction | SerialFlushAction | SerialDrainAction | SerialPauseAction | SerialResumeAction | CreateCertificateAction | SignTagAction | RevokeCertificateAction | RemoteAction | RemoteActionResult | RemoteActionError | DeviceAction | DeviceActionResult | DeviceActionError | PlaySoundAction | BufferSoundAction | CancelSoundAction | LocalPositionTweenAction | LocalRotationTweenAction | ShowUploadFilesAction | OpenCircleWipeAction | FocusOnBotAction | FocusOnPositionAction | BeginAudioRecordingAction | EndAudioRecordingAction | CancelAnimationAction | BeginRecordingAction | EndRecordingAction | SpeakTextAction | GetVoicesAction | GetGeolocationAction | RegisterCustomAppAction | UnregisterCustomAppAction | RegisterHtmlAppAction | RequestAuthDataAction | DefineGlobalBotAction | ConvertGeolocationToWhat3WordsAction | GetPublicRecordKeyAction | RecordDataAction | GetRecordDataAction | RecordFileAction ; /**
 * Defines an interface for actions that represent asynchronous tasks.
 */ export interface AsyncAction extends Action { /**
     * The ID of the async task.
     */ taskId : number | string ; /**
     * The ID of the player that created this task.
     * Set by remote action handlers when a task is recieved from a remote player.
     */ playerId ? : string ; } /**
 * Defines an action that supplies a result for an AsyncRequestAction.
 */ export interface AsyncResultAction extends AsyncAction { type : 'async_result' ; /**
     * The result value.
     */ result : any ; /**
     * Whether to map any bots found in the result to their actual bot counterparts.
     * Defaults to false.
     */ mapBotsInResult ? : boolean ; } /**
 * Defines an action that supplies an error for an AsyncRequestAction.
 */ export interface AsyncErrorAction extends AsyncAction { type : 'async_error' ; /**
     * The error.
     */ error : any ; } /**
 * Defines a bot event that indicates a bot was added to the state.
 */ export interface AddBotAction extends Action { type : 'add_bot' ; id : string ; bot : Bot ; } /**
 * Defines a bot event that indicates a bot was removed from the state.
 */ export interface RemoveBotAction extends Action { type : 'remove_bot' ; id : string ; } /**
 * Defines a bot event that indicates a bot was updated.
 */ export interface UpdateBotAction extends Action { type : 'update_bot' ; id : string ; update : PartialBot ; } /**
 * Defines the set of options required for creating a certificate.
 */ export interface CreateCertificateOptions { /**
     * The keypair that should be used for the certificate.
     */ keypair : string ; /**
     * The ID of the certified bot that is signing the new certificate.
     */ signingBotId ? : string ; /**
     * The password that should be used to sign the new certificate.
     */ signingPassword : string ; } /**
 * Defines a bot event that creates a new certificate from the given keypair.
 */ export interface CreateCertificateAction extends AsyncAction , CreateCertificateOptions { type : 'create_certificate' ; } /**
 * Defines a bot event that creates a signature for the given tag on the given bot using the given certified bot and password.
 */ export interface SignTagAction extends AsyncAction { type : 'sign_tag' ; /**
     * The ID of the certified bot that is signing the tag value.
     */ signingBotId : string ; /**
     * The password that should be used to sign the value.
     */ signingPassword : string ; /**
     * The ID of the bot whose tag is being signed.
     */ botId : string ; /**
     * The tag that should be signed.
     */ tag : string ; /**
     * The value that should be signed.
     */ value : any ; } /**
 * Defines a bot event that revokes a certificate.
 */ export interface RevokeCertificateAction extends AsyncAction { type : 'revoke_certificate' ; /**
     * The ID of the bot that should be used to sign the revocation.
     */ signingBotId : string ; /**
     * The password that should be used to sign the revocation.
     */ signingPassword : string ; /**
     * The ID of the certificate that should be revoked.
     */ certificateBotId : string ; } /**
 * A set of bot events in one.
 */ export interface TransactionAction extends Action { type : 'transaction' ; events : BotAction [ ] ; } /**
 * An eventBotsStatesome generic BotsState to the current state.
 * This is useful when you have some generic bot state and want to just apply it to the
 * current state. An example of doing this is from the automatic merge system.
 */ export interface ApplyStateAction extends Action { type : 'apply_state' ; state : BotsState ; } /**
 * The options for pasting bots state into a channel.
 */ export interface PasteStateOptions { /**
     * The dimension that the state should be pasted into.
     */ dimension ? : string ; /**
     * The X position that the state should be pasted at.
     * If a dimension is provided then this is the X position inside the dimension.
     * If a dimension is not provided then this is the X position that the new dimension should be created at.
     */ x : number ; /**
     * The Y position that the state should be pasted at.
     * If a dimension is provided then this is the Y position inside the dimension.
     * If a dimension is not provided then this is the Y position that the new dimension should be created at.
     */ y : number ; /**
     * The Z position that the state should be pasted at.
     * If a dimension is provided then this is the Z position inside the dimension.
     * If a dimension is not provided then this is the Z position that the new dimension should be created at.
     */ z : number ; } /**
 * An event to paste the given bots state as a new worksurface at a position.
 */ export interface PasteStateAction extends Action { type : 'paste_state' ; state : BotsState ; /**
     * The options for the event.
     */ options : PasteStateOptions ; } /**
 * An event that is used to override dragging a bot.
 */ export interface ReplaceDragBotAction extends Action { type : 'replace_drag_bot' ; /**
     * The bot that should be used to drag.
     */ bot : Bot | BotTags ; } /**
 * An event that is used to request that the instance be backed up to github.
 */ export interface BackupToGithubAction extends Action { type : 'backup_to_github' ; /**
     * The authentication key to use.
     */ auth : string ; /**
     * The options that should be used for backing up.
     */ options ? : BackupOptions ; } /**
 * An event that is used to request that the instance be backed up to a zip bot and downloaded.
 */ export interface BackupAsDownloadAction extends Action { type : 'backup_as_download' ; /**
     * The options that should be used for backing up.
     */ options ? : BackupOptions ; /**
     * The device(s) that the download should be sent to.
     */ target : DeviceSelector ; } /**
 * Defines the list of possible options for backing up a instance.
 */ export interface BackupOptions { /**
     * Whether to include archived atoms.
     */ includeArchived ? : boolean ; } export interface StartCheckoutOptions { /**
     * The publishable API key that should be used for interfacing with the Stripe API.
     */ publishableKey : string ; /**
     * The ID of the product that is being checked out.
     */ productId : string ; /**
     * The title of the product.
     */ title : string ; /**
     * The description of the product.
     */ description : string ; /**
     * The instance that the payment processing should occur in.
     */ processingInst : string ; /**
     * Whether to request the payer's billing address.
     */ requestBillingAddress ? : boolean ; /**
     * Specifies the options that should be used for requesting payment from Apple Pay or the Payment Request API.
     */ paymentRequest ? : PaymentRequestOptions ; } /**
 * Defines an interface of payment request options.
 */ export interface PaymentRequestOptions { /**
     * The two letter country code of your payment processor account.
     */ country : string ; /**
     * The three character currency code.
     */ currency : string ; /**
     * The total that should be charged to the user.
     */ total : { /**
         * The label that should be displayed for the total.
         */ label : string ; /**
         * The amount in the currency's smallest unit. (cents, etc.)
         */ amount : number ; } ; } /**
 * An event that is used to initiate the checkout flow.
 */ export interface StartCheckoutAction extends Action , StartCheckoutOptions { type : 'start_checkout' ; } /**
 * An event that is used to indicate that the checkout was submitted.
 */ export interface CheckoutSubmittedAction extends Action { type : 'checkout_submitted' ; /**
     * The ID of the product that was checked out.
     */ productId : string ; /**
     * The token that allows payment.
     */ token : string ; /**
     * The inst that processing should happen in.
     */ processingInst : string ; } /**
 * An event that is used to finish the checkout process by charging the user's card/account.
 */ export interface FinishCheckoutAction extends Action { type : 'finish_checkout' ; /**
     * The Secret API Key that should be used to finish the checkout process.
     */ secretKey : string ; /**
     * The token that was created from the checkout process.
     * You should have recieved this from the onCheckout() event.
     */ token : string ; /**
     * The amount to charge in the smallest currency unit.
     * For USD, this is cents. So an amount of 100 equals $1.00.
     */ amount : number ; /**
     * The currency that the amount is in.
     */ currency : string ; /**
     * The description for the charge.
     */ description : string ; /**
     * The extra info that this event contains.
     */ extra : any ; } /**
 * An event that is used to run a shell script.
 */ export interface ShellAction extends Action { type : 'shell' ; /**
     * The script that should be run.
     */ script : string ; } /**
 * An event that is used to show a toast message to the user.
 */ export interface ShowToastAction extends Action { type : 'show_toast' ; message : string | number | boolean | object | Array < any > | null ; duration : number ; } /**
 * An event that is used to show some HTML to the user.
 */ export interface ShowHtmlAction extends Action { type : 'show_html' ; /**
     * Whether the HTML should be visible.
     */ visible : true ; /**
     * The HTML that should be shown.
     */ html : string ; } /**
 * An event that is used to hide the HTML from the user.
 */ export interface HideHtmlAction extends Action { type : 'show_html' ; visible : false ; } /**
 * Options for the os.tweenTo(), os.moveTo(), and os.focusOn() actions.
 */ export interface FocusOnOptions { zoom ? : number ; rotation ? : { x : number ; y : number ; /**
         * Whether to normalize the rotation values to between 0 and 2*PI.
         * Defaults to true. Setting this to false can be useful for rotating around a bot multiple times.
         */ normalize ? : boolean ; } ; /**
     * The duration in seconds that the tween should take.
     */ duration ? : number ; /**
     * The type of easing to use.
     * If not specified then "linear" "inout" will be used.
     */ easing ? : EaseType | Easing ; /**
     * The portal that the bot is in.
     * If not specified, then the bot will be focused in all portals.
     */ portal ? : PortalType ; } /**
 * An event that is used to focus on a given bot.
 */ export interface FocusOnBotAction extends AsyncAction , FocusOnOptions { type : 'focus_on' ; /**
     * The ID of the bot to focus on.
     */ botId : string ; } /**
 * An event that is used to focus on a given position.
 */ export interface FocusOnPositionAction extends AsyncAction , FocusOnOptions { type : 'focus_on_position' ; /**
     * The position to animate to.
     */ position : { x : number ; y : number ; } ; } /**
 * An event that is used to cancel the current camera animation.
 */ export interface CancelAnimationAction extends AsyncAction { type : 'cancel_animation' ; } /**
 * The possible camera types.
 */ export type CameraType = 'front' | 'rear' ; /**
 * An event that is used to show or hide the QR Code Scanner.
 */ export interface OpenQRCodeScannerAction extends Action { type : 'show_qr_code_scanner' ; /**
     * Whether the QR Code scanner should be visible.
     */ open : boolean ; /**
     * The camera that should be used.
     */ cameraType : CameraType ; } /**
 * An event that is used to show or hide the barcode scanner.
 */ export interface OpenBarcodeScannerAction extends Action { type : 'show_barcode_scanner' ; /**
     * Whether the barcode scanner should be visible.
     */ open : boolean ; /**
     * The camera that should be used.
     */ cameraType : CameraType ; } /**
 * An event that is used to toggle whether the console is open.
 */ export interface OpenConsoleAction extends Action { type : 'open_console' ; /**
     * Whether the console should be open.
     */ open : boolean ; } /**
 * An event that is used to show or hide a QR Code on screen.
 */ export interface ShowQRCodeAction extends Action { type : 'show_qr_code' ; /**
     * Whether the QR Code should be visible.
     */ open : boolean ; /**
     * The code to display.
     */ code : string ; } /**
 * The list of possible barcode formats.
 */ export type BarcodeFormat = 'code128' | 'code39' | 'ean13' | 'ean8' | 'upc' | 'itf14' | 'msi' | 'pharmacode' | 'codabar' ; /**
 * An event that is used to show or hide a barcode on screen.
 */ export interface ShowBarcodeAction extends Action { type : 'show_barcode' ; /**
     * Whether the barcode should be visible.
     */ open : boolean ; /**
     * The code to display.
     */ code : string ; /**
     * The format that the code should be displayed in.
     */ format : BarcodeFormat ; } /**
 * An event that is used to load a simulation.
 */ export interface LoadServerAction extends Action { type : 'load_server' ; /**
     * The ID of the simulation to load.
     */ id : string ; } /**
 * An event that is used to unload a simulation.
 */ export interface UnloadServerAction extends Action { type : 'unload_server' ; /**
     * The ID of the simulation to unload.
     */ id : string ; } /**
 * An event that is used to load an AUX from a remote location.
 */ export interface ImportAUXAction extends Action { type : 'import_aux' ; /**
     * The URL to load.
     */ url : string ; } /**
 * Defines an event for actions that are shouted to every current loaded simulation.
 */ export interface SuperShoutAction extends Action { type : 'super_shout' ; /**
     * The name of the event.
     */ eventName : string ; /**
     * The argument to pass as the "that" variable to scripts.
     */ argument ? : any ; } /**
 * Defines an event that sends a web request to a instance.
 */ export interface SendWebhookAction extends AsyncAction { type : 'send_webhook' ; /**
     * The options for the webhook.
     */ options : WebhookOptions ; } /**
 * Defines a set of options for a webhook.
 */ export interface WebhookOptions { /**
     * The HTTP Method that the request should use.
     */ method : string ; /**
     * The URL that the request should be made to.
     */ url : string ; /**
     * The headers to include in the request.
     */ headers ? : { [ key ] : string ; } ; /**
     * The data to send with the request.
     */ data ? : any ; /**
     * The shout that should be made when the request finishes.
     */ responseShout : string ; } /**
 * Defines an event that animates a tag on a bot over some time.
 */ export interface AnimateTagAction extends AsyncAction { type : 'animate_tag' ; /**
     * The ID of the bot to animate.
     */ botId : string ; /**
     * The tag to animate.
     */ tag : string ; /**
     * The options to use for the animation.
     */ options : AnimateTagOptions ; } /**
 * Defines the options that can be used to animate a tag.
 */ export interface AnimateTagOptions { /**
     * The value to animate from.
     */ fromValue : any ; /**
     * The value to animate to.
     */ toValue : any ; /**
     * The number of seconds that the animation executes over.
     */ duration : number ; /**
     * The easing that should be used.
     */ easing : Easing ; /**
     * The space that the tag should be animated in.
     * If set to false, then the tag on the bot will be modified.
     */ tagMaskSpace : BotSpace | false ; } /**
 * Defines an event that is used to load a file.
 */ export interface LoadFileAction extends AsyncAction { type : 'load_file' ; /**
     * The options for the action.
     */ options : LoadFileOptions ; } /**
 * Options for loading a file.
 */ export interface LoadFileOptions { /**
     * The file path that should be loaded.
     */ path ? : string ; /**
     * The shout that should be made when the request finishes.
     */ callbackShout ? : string ; } /**
 * Defines an event that is used to save a file to a drive.
 */ export interface SaveFileAction extends AsyncAction { type : 'save_file' ; /**
     * The options for the action.
     */ options : SaveFileOptions ; } /**
 * Options for saving a file.
 */ export interface SaveFileOptions { /**
     * The path that the mod should be saved.
     */ path : string ; /**
     * The data to save to the file.
     */ data : string ; /**
     * The shout that should be made when the request finishes.
     */ callbackShout ? : string ; /**
     * Whether to overwrite existing files.
     */ overwriteExistingFile ? : boolean ; } /**
 * Defines an event that is used to get the player count.
 */ export interface GetRemoteCountAction extends Action { type : 'get_remote_count' ; /**
     * The instance that the device count should be retrieved for.
     * If omitted, then the total device count will be returned.
     */ inst ? : string ; } /**
 * Defines an event that is used to get the list of instances from the server.
 */ export interface GetServersAction extends Action { type : 'get_servers' ; /**
     * Whether to get the instance statuses.
     */ includeStatuses ? : boolean ; } /**
 * Defines an event that is used to get the list of remote devices on the instance.
 */ export interface GetRemotesAction extends Action { type : 'get_remotes' ; } /**
 * Defines an event that is used to send the player to a dimension.
 */ export interface GoToDimensionAction extends Action { type : 'go_to_dimension' ; /**
     * The dimension that should be loaded.
     */ dimension : string ; } /**
 * Defines an event that is used to show an input box to edit a tag on a bot.
 */ export interface ShowInputForTagAction extends Action { type : 'show_input_for_tag' ; /**
     * The ID of the bot to edit.
     */ botId : string ; /**
     * The tag that should be edited on the bot.
     */ tag : string ; /**
     * The options for the input box.
     */ options : Partial < ShowInputOptions > ; } /**
 * Defines an event that is used to show an input box.
 */ export interface ShowInputAction extends AsyncAction { type : 'show_input' ; /**
     * The value that should be in the input box.
     */ currentValue ? : any ; /**
     * The options for the input box.
     */ options : Partial < ShowInputOptions > ; } /**
 * Defines an event that is used to set whether the connection is forced to be offline.
 */ export interface SetForcedOfflineAction extends Action { type : 'set_offline_state' ; /**
     * Whether the connection should be offline.
     */ offline : boolean ; } /**
 * Defines an event that is used to redirect the user to the given URL.
 * This should be equivalent to clicking a link with rel="noreferrer".
 */ export interface GoToURLAction extends Action { type : 'go_to_url' ; /**
     * The URL to open.
     */ url : string ; } /**
 * Defines an event that is used to open the given URL.
 * This should be equivalent to clicking a link with rel="noreferrer" and target="_blank".
 */ export interface OpenURLAction extends Action { type : 'open_url' ; /**
     * The URL to open.
     */ url : string ; } /**
 * Defines an event that is used to play a sound from the given url.
 */ export interface PlaySoundAction extends AsyncAction { type : 'play_sound' ; /**
     * The URL to open.
     */ url : string ; /**
     * The ID of the sound.
     */ soundID : number | string ; } /**
 * Defines an event that is used to pre-load a sound from the given URL.
 */ export interface BufferSoundAction extends AsyncAction { type : 'buffer_sound' ; /**
     * The URL to buffer.
     */ url : string ; } /**
 * Defines an event that is used to cancel a sound that is playing.
 */ export interface CancelSoundAction extends AsyncAction { type : 'cancel_sound' ; /**
     * The ID of the sound.
     */ soundID : number | string ; } /**
 * Defines an event that is used to download a file onto the device.
 */ export interface DownloadAction extends Action { type : 'download' ; /**
     * The data that should be included in the downloaded file.
     */ data : any ; /**
     * The name of the downloaded file. (includes the extension)
     */ filename : string ; /**
     * The MIME type of the downloaded file.
     */ mimeType : string ; } /**
 * Defines an interface for options that a show input event can use.
 */ export interface ShowInputOptions { /**
     * The type of input box to show.
     */ type : ShowInputType ; /**
     * The subtype of input box to show.
     */ subtype : ShowInputSubtype ; /**
     * The title that should be used for the input.
     */ title : string ; /**
     * The placeholder for the value.
     */ placeholder : string ; /**
     * The background color to use.
     */ backgroundColor : string ; /**
     * The foreground color to use.
     */ foregroundColor : string ; /**
     * Whether the text in the input box should be automatically selected.
     */ autoSelect : boolean ; } /**
 * Defines the possible input types.
 */ export type ShowInputType = 'text' | 'color' | 'secret' | 'date' ; /**
 * Defines the possible input types.
 */ export type ShowInputSubtype = 'basic' | 'swatch' | 'advanced' ; /**
 * Defines an event for actions.
 * Actions are basically user-defined events.
 */ export interface ShoutAction { type : 'action' ; /**
     * The IDs of the bots that the event is being sent to.
     * If null, then the action is sent to every bot.
     */ botIds : string [ ] | null ; /**
     * The Bot ID of the user.
     */ userId : string | null ; /**
     * The name of the event.
     */ eventName : string ; /**
     * The argument to pass as the "that" variable to scripts.
     */ argument ? : any ; /**
     * Whether the Bot IDs should be sorted before processing.
     */ sortBotIds ? : boolean ; } /**
 * Defines an event that prevents the execution of an action.
 */ export interface RejectAction { type : 'reject' ; /**
     * The actions to prevent.
     */ actions : Action [ ] ; } /**
 * Defines an event that creates a channel if it doesn't exist.
 */ export interface SetupChannelAction extends AsyncAction { type : 'setup_server' ; /**
     * The channel that should be created.
     */ channel : string ; /**
     * The bot or mod that should be cloned into the new channel.
     */ botOrMod ? : Bot | BotTags ; } /**
 * Export a pin (BCM) for use.
 */ export interface ExportGpioPinAction extends AsyncAction { type : 'export_gpio_pin' ; /**
     * The pin (BCM) that you want to export.
     */ pin : number ; /**
     * The mode you want to configure your pin (BCM) as.
     */ mode : 'in' | 'out' ; } /**
 * Unexport a pin (BCM) that is done being used.
 */ export interface UnexportGpioPinAction extends AsyncAction { type : 'unexport_gpio_pin' ; /**
     * The pin (BCM) that you want to unexport.
     */ pin : number ; } /**
 * Set the value of the provided pin (BCM).
 */ export interface SetGpioPinAction extends AsyncAction { type : 'set_gpio_pin' ; /**
     * The pin (BCM) that you want to use.
     */ pin : number ; /**
     * The value of the pin (BCM). Either High (0) or Low (1)
     */ value : 0 | 1 ; } /**
 * Get the value of the provided pin (BCM).
 */ export interface GetGpioPinAction extends AsyncAction { type : 'get_gpio_pin' ; /**
     * The pin (BCM) that you want to use.
     */ pin : number ; } /**
 * Initialize rpio with the provided settings.
 */ export interface RpioInitAction extends AsyncAction { type : 'rpio_init' ; /**
     * Defaults:
     * gpiomem: true            Use /dev/gpiomem
     *                          true | false
     * mapping: 'physical'      Use the P1-P40 numbering scheme
     *                          gpio | physical
     * mock: undefined          Emulate specific hardware in mock mode
     *                          raspi-b-r1 | raspi-a | raspi-b | raspi-a+ | raspi-b+ | raspi-2 | raspi-3 | raspi-zero | raspi-zero-w
     * close_on_exit: true      On node process exit automatically close rpio
     *                          true | false
     */ options : object ; } /**
 * Shuts down rpio, unmaps, and clears everything.
 */ export interface RpioExitAction extends AsyncAction { type : 'rpio_exit' ; } /**
 * Open a pin for use.
 */ export interface RpioOpenAction extends AsyncAction { type : 'rpio_open' ; /**
     * The pin that you want to configure.
     */ pin : number ; /**
     * The mode you want toconfigure your pin as.
     */ mode : 'INPUT' | 'OUTPUT' | 'PWM' ; /**
     * The state you want to initialize your pin as.
     */ options ? : 'HIGH' | 'LOW' | 'PULL_OFF' | 'PULL_DOWN' | 'PULL_UP' ; } /**
 * Set the mode of the provided pin.
 */ export interface RpioModeAction extends AsyncAction { type : 'rpio_mode' ; /**
     * The pin that you want to configure.
     */ pin : number ; /**
     * The mode you want to set your pin as.
     */ mode : 'INPUT' | 'OUTPUT' | 'PWM' ; /**
     * The state you want to initialize your pin as.
     */ options ? : 'HIGH' | 'LOW' | 'PULL_OFF' | 'PULL_DOWN' | 'PULL_UP' ; } /**
 * Read the value of the provided pin.
 */ export interface RpioReadAction extends AsyncAction { type : 'rpio_read' ; /**
     * The pin that you want to use.
     */ pin : number ; } /**
 * Read the buffer of the provided pin.
 */ export interface RpioReadSequenceAction extends AsyncAction { type : 'rpio_read_sequence' ; /**
     * The pin that you want to use.
     */ pin : number ; /**
     * The length of the buffer.
     */ length : number ; } /**
 * Write a new value for the provided pin.
 */ export interface RpioWriteAction extends AsyncAction { type : 'rpio_write' ; /**
     * The pin that you want to use.
     */ pin : number ; /**
     * The value of the pin. Either High (0) or Low (1)
     */ value : 'HIGH' | 'LOW' ; } /**
 * Write the buffer to the provided pin.
 */ export interface RpioWriteSequenceAction extends AsyncAction { type : 'rpio_write_sequence' ; /**
     * The pin that you want to use.
     */ pin : number ; /**
     * The buffer that you want write.
     */ buffer : number [ ] ; } /**
 * Read the current state of the GPIO pad control for the specified GPIO group.
 * On current models of Raspberry Pi there are three groups.
 */ export interface RpioReadpadAction extends AsyncAction { type : 'rpio_readpad' ; /**
     * 'PAD_GROUP_0_27' is GPIO0 - GPIO27. Use this for the main GPIO header.
     * 'PAD_GROUP_28_45' is GPIO28 - GPIO45. Use this to configure the P5 header.
     * 'PAD_GROUP_46_53' is GPIO46 - GPIO53. Internal, you probably won't need this.
     */ group : 'PAD_GROUP_0_27' | 'PAD_GROUP_28_45' | 'PAD_GROUP_46_53' ; /**
     * The bitmask you want to check.
     */ bitmask : 'slew' | 'hysteresis' | 'current' ; } /**
 * Write `control` settings to the pad control for `group`.
 */ export interface RpioWritepadAction extends AsyncAction { type : 'rpio_writepad' ; /**
     * 'PAD_GROUP_0_27' is GPIO0 - GPIO27. Use this for the main GPIO header.
     * 'PAD_GROUP_28_45' is GPIO28 - GPIO45. Use this to configure the P5 header.
     * 'PAD_GROUP_46_53' is GPIO46 - GPIO53. Internal, you probably won't need this.
     */ group : 'PAD_GROUP_0_27' | 'PAD_GROUP_28_45' | 'PAD_GROUP_46_53' ; /**
     * Slew rate unlimited if set to true.
     */ slew ? : boolean ; /**
     * Hysteresis is enabled if set to true.
     */ hysteresis ? : boolean ; /**
     * Drive current set in mA. Must be an even number 2-16.
     */ current ? : 2 | 4 | 6 | 8 | 10 | 12 | 14 | 16 ; } /**
 * Configure the pin's internal pullup or pulldown resistors.
 */ export interface RpioPudAction extends AsyncAction { type : 'rpio_pud' ; /**
     * The pin that you want to use.
     */ pin : number ; /**
     * Configure the pin's resistors as: 'PULL_OFF', 'PULL_DOWN' or 'PULL_UP'
     */ state : 'PULL_OFF' | 'PULL_DOWN' | 'PULL_UP' ; } /**
 * Watch `pin` for changes and execute the callback `cb()` on events.
 */ export interface RpioPollAction extends AsyncAction { type : 'rpio_poll' ; /**
     * The pin that you want to use.
     */ pin : number ; /**
     * The callback executed on events.
     */ cb : any ; /**
     * Optional. Used to watch for specific events.
     */ options ? : 'POLL_LOW' | 'POLL_HIGH' | 'POLL_BOTH' ; } /**
 * Close a pin to remove it from use.
 */ export interface RpioCloseAction extends AsyncAction { type : 'rpio_close' ; /**
     * The pin that you want to use.
     */ pin : number ; /**
     * The state you want to leave the pin in. Either PIN_RESET or PIN_PRESERVE
     */ options ? : 'PIN_RESET' | 'PIN_PRESERVE' ; } /**
 *Initializes i2c for use.
 */ export interface RpioI2CBeginAction extends AsyncAction { type : 'rpio_i2c_begin' ; } /**
 * Configure the slave address.
 */ export interface RpioI2CSetSlaveAddressAction extends AsyncAction { type : 'rpio_i2c_setslaveaddress' ; /**
     * The slave address to set.
     */ address : number ; } /**
 * Set the baud rate. Directly set the speed in hertz.
 */ export interface RpioI2CSetBaudRateAction extends AsyncAction { type : 'rpio_i2c_setbaudrate' ; /**
     * The i2c refresh rate in hertz.
     */ rate : number ; } /**
 * Set the baud rate. Set it based on a divisor of the base 250MHz rate.
 */ export interface RpioI2CSetClockDividerAction extends AsyncAction { type : 'rpio_i2c_setclockdivider' ; /**
     * The i2c refresh rate based on a divisor of the base 250MHz rate.
     */ rate : number ; } /**
 * Read from the i2c slave.
 */ export interface RpioI2CReadAction extends AsyncAction { type : 'rpio_i2c_read' ; /**
     * Buffer to read.
     */ rx : number [ ] ; /**
     * Optional. Length of the buffer to read.
     */ length ? : number ; } /**
 * Write to the i2c slave.
 */ export interface RpioI2CWriteAction extends AsyncAction { type : 'rpio_i2c_write' ; /**
     * Buffer to write.
     */ tx : number [ ] ; /**
     * Optional. Length of the buffer to write.
     */ length ? : number ; } /**
 *
 */ /**
 *
 */ /**
 * Turn off the i²c interface and return the pins to GPIO.
 */ export interface RpioI2CEndAction extends AsyncAction { type : 'rpio_i2c_end' ; } /**
 * This is a power-of-two divisor of the base 19.2MHz rate, with a maximum value of 4096 (4.6875kHz).
 */ export interface RpioPWMSetClockDividerAction extends AsyncAction { type : 'rpio_pwm_setclockdivider' ; /**
     * The PWM refresh rate.
     */ rate : number ; } /**
 * This determines the maximum pulse width.
 */ export interface RpioPWMSetRangeAction extends AsyncAction { type : 'rpio_pwm_setrange' ; /**
     * The pin that you want to use.
     */ pin : number ; /**
     * The PWM range for a pin.
     */ range : number ; } /**
 * Set the width for a given pin.
 */ export interface RpioPWMSetDataAction extends AsyncAction { type : 'rpio_pwm_setdata' ; /**
     * The pin that you want to use.
     */ pin : number ; /**
     * The PWM width for a pin.
     */ width : number ; } /**
 * Initiate SPI mode.
 */ export interface RpioSPIBeginAction extends AsyncAction { type : 'rpio_spi_begin' ; } /**
 * Choose which of the chip select / chip enable pins to control.
 */ export interface RpioSPIChipSelectAction extends AsyncAction { type : 'rpio_spi_chipselect' ; value : 0 | 1 | 2 ; } /**
 * If your device's CE pin is active high, use this to change the polarity.
 */ export interface RpioSPISetCSPolarityAction extends AsyncAction { type : 'rpio_spi_setcspolarity' ; value : 0 | 1 | 2 ; /**
     * Set the polarity it activates on. HIGH or LOW
     */ polarity : 'HIGH' | 'LOW' ; } /**
 * Set the SPI clock speed.
 */ export interface RpioSPISetClockDividerAction extends AsyncAction { type : 'rpio_spi_setclockdivider' ; /**
     * It is an even divisor of the base 250MHz rate ranging between 0 and 65536.
     */ rate : number ; } /**
 * Set the SPI Data Mode.
 */ export interface RpioSPISetDataModeAction extends AsyncAction { type : 'rpio_spi_setdatamode' ; /**
     *  Mode | CPOL | CPHA
     *  -----|------|-----
     *    0  |  0   |  0
     *    1  |  0   |  1
     *    2  |  1   |  0
     *    3  |  1   |  1
     */ mode : 0 | 1 | 2 | 3 ; } /**
 *
 */ export interface RpioSPITransferAction extends AsyncAction { type : 'rpio_spi_transfer' ; /**
     *
     */ tx : number [ ] ; } /**
 *
 */ export interface RpioSPIWriteAction extends AsyncAction { type : 'rpio_spi_write' ; /**
     *
     */ tx : number [ ] ; } /**
 * Release the pins back to general purpose use.
 */ export interface RpioSPIEndAction extends AsyncAction { type : 'rpio_spi_end' ; } /**
 * Establish the connection to the bluetooth serial device
 */ export interface SerialConnectAction extends AsyncAction { type : 'serial_connect' ; /**
     * A friendly device name. Example: Brush01
     */ name : string ; /**
     * The device path. Example: /dev/rfcomm0
     */ device : string ; /**
     * The device MAC address. Example: AA:BB:CC:DD:EE
     */ mac : string ; /**
     * The device channel. Example: 1
     */ channel : number ; /**
     * {boolean} [autoOpen=true] Automatically opens the port on `nextTick`.
     *
     * {number=} [baudRate=9600] The baud rate of the port to be opened. This should match one of the commonly available baud rates, such as 110, 300, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, or 115200. Custom rates are supported best effort per platform. The device connected to the serial port is not guaranteed to support the requested baud rate, even if the port itself supports that baud rate.
     *
     * {number} [dataBits=8] Must be one of these: 8, 7, 6, or 5.
     *
     * {number} [highWaterMark=65536] The size of the read and write buffers defaults to 64k.
     *
     * {boolean} [lock=true] Prevent other processes from opening the port. Windows does not currently support `false`.
     *
     * {number} [stopBits=1] Must be one of these: 1 or 2.
     *
     * {string} [parity=none] Must be one of these: 'none', 'even', 'mark', 'odd', 'space'.
     *
     * {boolean} [rtscts=false] flow control setting
     *
     * {boolean} [xon=false] flow control setting
     *
     * {boolean} [xoff=false] flow control setting
     *
     * {boolean} [xany=false] flow control setting
     *
     * {object=} bindingOptions sets binding-specific options
     *
     * {Binding=} Binding The hardware access binding. `Bindings` are how Node-Serialport talks to the underlying system. Will default to the static property `Serialport.Binding`.
     *
     * {number} [bindingOptions.vmin=1] see [`man termios`](http://linux.die.net/man/3/termios) LinuxBinding and DarwinBinding
     *
     * {number} [bindingOptions.vtime=0] see [`man termios`](http://linux.die.net/man/3/termios) LinuxBinding and DarwinBinding
     */ options ? : object ; } /**
 * Parses and returns the serial stream to the event tag 'onSerialData'.
 */ export interface SerialStreamAction extends AsyncAction { type : 'serial_stream' ; /**
     * The id of the bot you want data streamed to. The bot needs the 'onSerialData' tag.
     */ bot : string ; /**
     * A friendly device name. Example: Brush01
     */ name : string ; } /**
 * Opens the serial connection if you set the option in serialConnect to {autoOpen: false}
 */ export interface SerialOpenAction extends AsyncAction { type : 'serial_open' ; /**
     * A friendly device name. Example: Brush01
     */ name : string ; } /**
 * Updates the SerialPort object with a new baudRate.
 */ export interface SerialUpdateAction extends AsyncAction { type : 'serial_update' ; /**
     * A friendly device name. Example: Brush01
     */ name : string ; /**
     * {number=} [baudRate=9600] The baud rate of the port to be opened. This should match one of the commonly available baud rates, such as 110, 300, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, or 115200. Custom rates are supported best effort per platform. The device connected to the serial port is not guaranteed to support the requested baud rate, even if the port itself supports that baud rate.
     */ options : object ; /**
     *
     */ cb ? : any ; } /**
 * Writes the provided data/command to the device
 */ export interface SerialWriteAction extends AsyncAction { type : 'serial_write' ; /**
     * A friendly device name. Example: Brush01
     */ name : string ; /**
     * The data/command to send.
     */ data : string | number [ ] ; /**
     * The encoding, if chunk is a string. Defaults to 'utf8'. Also accepts 'utf16le', 'latin1', 'ascii', 'base64', 'binary', 'ucs2', and 'hex'
     */ encoding ? : string ; /**
     *
     */ cb ? : any ; } /**
 * Request a number of bytes from the SerialPort.
 */ export interface SerialReadAction extends AsyncAction { type : 'serial_read' ; /**
     * A friendly device name. Example: Brush01
     */ name : string ; /**
     * Specify how many bytes of data to return, if available
     */ size ? : number ; } /**
 * Closes an open connection.
 */ export interface SerialCloseAction extends AsyncAction { type : 'serial_close' ; /**
     * A friendly device name. Example: Brush01
     */ name : string ; /**
     * The device path. Example: /dev/rfcomm0
     */ device : string ; /**
     *
     */ cb ? : any ; } /**
 * Flush discards data that has been received but not read, or written but not transmitted by the operating system.
 */ export interface SerialFlushAction extends AsyncAction { type : 'serial_flush' ; /**
     * A friendly device name. Example: Brush01
     */ name : string ; } /**
 * Waits until all output data is transmitted to the serial port. After any pending write has completed, it calls `tcdrain()` or `FlushFileBuffers()` to ensure it has been written to the device.
 */ export interface SerialDrainAction extends AsyncAction { type : 'serial_drain' ; /**
     * A friendly device name. Example: Brush01
     */ name : string ; } /**
 * Causes a stream in flowing mode to stop emitting 'data' events, switching out of flowing mode. Any data that becomes available remains in the internal buffer.
 */ export interface SerialPauseAction extends AsyncAction { type : 'serial_pause' ; /**
     * A friendly device name. Example: Brush01
     */ name : string ; } /**
 * Causes an explicitly paused, Readable stream to resume emitting 'data' events, switching the stream into flowing mode.
 */ export interface SerialResumeAction extends AsyncAction { type : 'serial_resume' ; /**
     * A friendly device name. Example: Brush01
     */ name : string ; } /**
 * Defines an event that sets some text on the user's clipboard.
 */ export interface SetClipboardAction { type : 'set_clipboard' ; /**
     * The text that the clipboard should be set to.
     */ text : string ; } /**
 * Defines an event that shows the chat bar.
 */ export interface ShowChatBarAction { type : 'show_chat_bar' ; /**
     * Whether the chat bar should be visible.
     */ visible : boolean ; /**
     * The text that the bar should be filled with by default.
     */ prefill ? : string ; /**
     * The text that the bar should have as the placeholder.
     */ placeholder ? : string ; /**
     * The color to use for the placeholder.
     */ placeholderColor ? : string ; /**
     * The color to use for the background.
     */ backgroundColor ? : string ; /**
     * The color to use for the foreground (text).
     */ foregroundColor ? : string ; } /**
 * Defines the possible options for showing the chat bar.
 */ export interface ShowChatOptions { /**
     * The text that the bar should be filled with by default.
     */ prefill ? : string ; /**
     * The text that the bar should have as the placeholder.
     */ placeholder ? : string ; /**
     * The color to use for the placeholder.
     */ placeholderColor ? : string ; /**
     * The color to use for the background.
     */ backgroundColor ? : string ; /**
     * The color to use for the foreground (text).
     */ foregroundColor ? : string ; } /**
 * Defines an event that executes a script.
 */ export interface RunScriptAction extends AsyncAction { type : 'run_script' ; /**
     * The script that should be executed.
     */ script : string ; } /**
 * Defines an event that shows the "upload AUX file" dialog.
 */ export interface ShowUploadAuxFileAction { type : 'show_upload_aux_file' ; } /**
 * Defines an event that shows the "uplaod file" dialog.
 */ export interface ShowUploadFilesAction extends AsyncAction { type : 'show_upload_files' ; } /**
 * Defines an event that marks a specific point in history.
 */ export interface MarkHistoryAction { type : 'mark_history' ; /**
     * The message that the mark should contain.
     */ message : string ; } /**
 * Defines an event that loads the history into the instance.
 */ export interface BrowseHistoryAction { type : 'browse_history' ; } /**
 * Defines an event that restores the current state to a specific bookmark.
 */ export interface RestoreHistoryMarkAction { type : 'restore_history_mark' ; /**
     * The ID of the mark that should be restored.
     */ mark : string ; /**
     * The instance that the mark should be restored to.
     * If not specified, then the current instance will be used.
     */ inst ? : string ; } /**
 * Defines an event that loads a space into the instance.
 */ export interface LoadSpaceAction extends Partial < AsyncAction > { type : 'load_space' ; /**
     * The space that should be loaded.
     */ space : BotSpace ; /**
     * The config that should be used to load the space.
     */ config : any ; } /**
 * Defines an event that loads bots from the given space that match the given tags and values.
 */ export interface LoadBotsAction extends AsyncAction { type : 'load_bots' ; /**
     * The space that should be searched.
     */ space : string ; /**
     * The tags that the loaded bots should have.
     */ tags : TagFilter [ ] ; } /**
 * Defines an interface for objects that specify a tag and value
 * that a bot should have to be loaded.
 */ export interface TagFilter { /**
     * The tag that the bot should have.
     */ tag : string ; /**
     * The value that the bot should have.
     */ value ? : any ; } /**
 * Defines an event that clears all bots from a space.
 *
 * Only supported for the following spaces:
 * - error
 */ export interface ClearSpaceAction extends AsyncAction { type : 'clear_space' ; /**
     * The space to clear.
     */ space : string ; } /**
 * Defines an event that unlocks the given space for editing.
 * Once a space is unlocked, it cannot be locked for the remainder of the session.
 *
 * Only supported for the following spaces:
 * - admin
 */ export interface UnlockSpaceAction extends AsyncAction { type : 'unlock_space' ; /**
     * The space to unlock.
     */ space : BotSpace ; /**
     * The password to use to unlock the space.
     */ password : string ; } /**
 * Defines an event that sets the password used to unlock the given space for editing.
 */ export interface SetSpacePasswordAction extends AsyncAction { type : 'set_space_password' ; /**
     * The space to set the password for.
     */ space : BotSpace ; /**
     * The old password for the space.
     */ oldPassword : string ; /**
     * The new password for the space.
     */ newPassword : string ; } /**
 * Defines an event that runs an animation locally over
 * whatever existing animations are playing.
 */ export interface LocalFormAnimationAction { type : 'local_form_animation' ; /**
     * The bot to run the animation on.
     */ botId : string ; /**
     * The animation to run.
     */ animation : number | string ; } export type TweenType = 'position' | 'rotation' ; export type EaseType = 'linear' | 'quadratic' | 'cubic' | 'quartic' | 'quintic' | 'sinusoidal' | 'exponential' | 'circular' | 'elastic' ; export type EaseMode = 'in' | 'out' | 'inout' ; export interface Easing { type : EaseType ; mode : EaseMode ; } /**
 * The maximum allowed duration for tweens.
 */ export const MAX_TWEEN_DURATION = 60 * 60 * 24 ; /**
 * Defines an event that runs a tween locally.
 */ export interface LocalTweenAction extends AsyncAction { type : 'local_tween' ; /**
     * The bot to run the tween on.
     */ botId : string ; /**
     * The dimension that the bot should be tweened in.
     */ dimension : string ; /**
     * The type of the tween.
     */ tweenType : TweenType ; /**
     * The easing that should be used.
     */ easing : Easing ; /**
     * The duration of the tween in seconds.
     */ duration : number ; } /**
 * Defines an event that runs a position tween locally.
 */ export interface LocalPositionTweenAction extends LocalTweenAction { tweenType : 'position' ; /**
     * The target position of the tween.
     */ position : { x ? : number ; y ? : number ; z ? : number ; } ; } export interface LocalRotationTweenAction extends LocalTweenAction { tweenType : 'rotation' ; rotation : { x ? : number ; y ? : number ; z ? : number ; } ; } /**
 * Defines an event that enables AR on the device.
 */ export interface EnableARAction { type : 'enable_ar' ; /**
     * Whether AR features should be enabled.
     */ enabled : boolean ; } /**
 * Defines an event that enables VR on the device.
 */ export interface EnableVRAction { type : 'enable_vr' ; /**
     * Whether VR features should be enabled.
     */ enabled : boolean ; } /**
 * Defines an event that enables POV on the device.
 */ export interface EnablePOVAction { type : 'enable_pov' ; /**
     * Whether POV features should be enabled.
     */ enabled : boolean ; /**
     * The point that the camera should be placed at for POV.
     */ center ? : { x : number ; y : number ; z : number ; } ; /**
     * Whether IMU features should be enabled while in POV mode.
     */ imu ? : boolean ; } /**
 * Defines an event that shows a QR code that is a link to a instance & dimension.
 */ export interface ShowJoinCodeAction { type : 'show_join_code' ; /**
     * The instance that should be joined.
     */ inst ? : string ; /**
     * The dimension that should be joined.
     */ dimension ? : string ; } /**
 * Defines an event that requests that AUX enter fullscreen mode.
 * This can be denied by the user.
 */ export interface RequestFullscreenAction { type : 'request_fullscreen_mode' ; } /**
 * Defines an event that exits fullscreen mode.
 */ export interface ExitFullscreenAction { type : 'exit_fullscreen_mode' ; } /**
 * Defines the options that a share action can have.
 */ export interface ShareOptions { /**
     * The title of the document being shared.
     */ title ? : string ; /**
     * The text that should be shared.
     */ text ? : string ; /**
     * The URL of the document being shared.
     */ url ? : string ; } /**
 * Defines an event that shares the given information using the
 * device's native social sharing capabilities.
 */ export interface ShareAction extends AsyncAction , ShareOptions { type : 'share' ; } /**
 * Defines an event that ensures a portal bot has been created for a portal.
 */ export interface RegisterBuiltinPortalAction { type : 'register_builtin_portal' ; /**
     * The ID of the portal.
     */ portalId : string ; } /**
 * The list of types of output that custom portals support.
 */ export type CustomAppOutputType = 'html' ; /**
 * the list of modes that custom portals support.
 */ export type CustomPortalOutputMode = 'push' | 'pull' ; /**
 * Defines an event that registers a custom portal.
 */ export interface RegisterCustomAppAction extends AsyncAction { type : 'register_custom_app' ; /**
     * The ID of the app.
     */ appId : string ; /**
     * The ID of the bot that should be used to configure the portal.
     */ botId : string ; } /**
 * Defines an event that unregisters a custom app.
 */ export interface UnregisterCustomAppAction extends AsyncAction { type : 'unregister_custom_app' ; /**
     * The ID of the app.
     */ appId : string ; } /**
 * Defines an event that requests that a HTML app be created.
 */ export interface RegisterHtmlAppAction extends AsyncAction { type : 'register_html_app' ; /**
     * The ID of the app.
     */ appId : string ; /**
     * The ID of the app instance.
     * Used to distinguish between multiple instances of the same app.
     */ instanceId : string ; } /**
 * Defines an event that requests that a HTML app be deleted.
 */ export interface UnregisterHtmlAppAction extends Action { type : 'unregister_html_app' ; /**
     * The ID of the app.
     */ appId : string ; /**
     * The ID of the app instance.
     * Used to distinguish between multiple instances of the same app.
     */ instanceId : string ; } /**
 * Defines an event that notifies that the output of a app should be updated with the given data.
 */ export interface SetAppOutputAction extends Action { type : 'set_app_output' ; /**
     * The ID of the app.
     */ appId : string ; /**
     * The output that the app should show.
     */ output : any ; uncopiable : true ; } /**
 * Defines an event that notifies that a custom app has recieved a HTML update.
 */ export interface UpdateHtmlAppAction extends Action { type : 'update_html_app' ; /**
     * The ID of the app.
     */ appId : string ; /**
     * The array of mutation rectords that represent the changes to the HTML.
     */ updates : SerializableMutationRecord [ ] ; } /**
 * Defines an event that represents an event that was dispatched from HTML in a portal.
 */ export interface HtmlAppEventAction extends Action { type : 'html_app_event' ; /**
     * The ID of the app.
     */ appId : string ; /**
     * The event.
     */ event : any ; } /**
 * Defines a mutation record that can be serialized and sent over a web worker pipe.
 */ export interface SerializableMutationRecord { type : 'attributes' | 'characterData' | 'childList' | 'event_listener' ; target : NodeReference ; addedNodes : NodeReference [ ] ; removedNodes : NodeReference [ ] ; previousSibling : NodeReference ; nextSibling : NodeReference ; attributeName : string ; attributeNamespace : string ; oldValue : string ; /**
     * The name of the event listener.
     */ listenerName ? : string ; /**
     * The number of event listeners that were added (positive number) or removed (negative number).
     */ listenerDelta ? : number ; } export interface NodeReference { __id : string ; } /**
 * Defines an event that adds an entry point to a custom portal.
 */ export interface RegisterPrefixAction extends AsyncAction { type : 'register_prefix' ; /**
     * The prefix that should be registered.
     */ prefix : string ; /**
     * The options that should be used for the prefix.
     */ options : RegisterPrefixOptions ; } /**
 * Defines an interface that contains options for register prefix actions.
 */ export interface RegisterPrefixOptions { /**
     * The possible languages that prefixes can use.
     */ language ? : 'javascript' | 'typescript' | 'json' | 'jsx' | 'tsx' | 'text' ; } /**
 * An event that is used to show or hide the circle wipe.
 */ export interface OpenCircleWipeAction extends AsyncAction { type : 'show_circle_wipe' ; /**
     * Whether the circle wipe should be visible.
     */ open : boolean ; /**
     * The options for the circle wipe.
     */ options : OpenCircleWipeOptions ; } /**
 * The options for the circle wipe.
 */ export interface OpenCircleWipeOptions { /**
     * The duration of this half of the circle wipe animation in seconds.
     */ duration : number ; /**
     * The color that the circle wipe should be.
     */ color : string ; } /**
 * An event that is used to add some snap points for a drag operation.
 */ export interface AddDropSnapTargetsAction extends Action { type : 'add_drop_snap_targets' ; /**
     * The ID of the bot that, when it is a drop target, the snap points should be enabled.
     * If null, then the targets apply globally during the drag operation.
     */ botId ? : string ; /**
     * The list of snap targets that should be used.
     */ targets : SnapTarget [ ] ; } /**
 * Defines an interface that represents a snap point.
 * That is, a point in 3D space with an associated snap distance.
 */ export interface SnapPoint { /**
     * The 3D position for the point.
     */ position : { x : number ; y : number ; z : number ; } ; /**
     * The distance that the snap point should take effect at.
     */ distance : number ; } /**
 * Defines an interface that represents a snap axis.
 * That is, a ray in 3D space with an associated snap distance.
 */ export interface SnapAxis { /**
     * The 3D direction that the axis ray travels along.
     */ direction : { x : number ; y : number ; z : number ; } ; /**
     * The 3D position that the ray starts at.
     */ origin : { x : number ; y : number ; z : number ; } ; /**
     * The distance from the ray line that the snap point should take effect at.
     */ distance : number ; } /**
 * The list of possible snap targets.
 * - "ground" means that the dragged bot should snap to the ground plane. This option is overriden by "grid".
 * - "grid" means that the dragged bot should snap to grid tiles.
 * - "face" means that the dragged bot should snap to other bot faces.
 * - "bots" means that the dragged bot will snap to other bots.
 */ export type SnapTarget = 'ground' | 'grid' | 'face' | 'bots' | SnapPoint | SnapAxis ; /**
 * An event that is used to disable the default dragging logic (moving the bot) and enable
 * "onDragging" shouts and whispers.
 */ export interface EnableCustomDraggingAction extends Action { type : 'enable_custom_dragging' ; } /**
 * An event that is used to start audio recording.
 */ export interface BeginAudioRecordingAction extends AsyncAction { type : 'begin_audio_recording' ; /**
     * Whether to stream the audio recording.
     * If streaming is enabled, then @onAudioChunk will be triggered whenever a new
     * piece of audio is available.
     */ stream ? : boolean ; /**
     * The MIME type that should be produced.
     * Defaults to a containerized format (audio/mp3, audio/webm, etc.) if not specified.
     */ mimeType ? : string ; /**
     * The number of samples per second (Hz) that audio/x-raw recordings should use.
     * Defaults to 44100 if not specified.
     */ sampleRate ? : number ; } /**
 * An event that is used to finish audio recording.
 */ export interface EndAudioRecordingAction extends AsyncAction { type : 'end_audio_recording' ; } /**
 * An interface that represents the options that can be used for making recordings.
 */ export interface RecordingOptions { /**
     * Whether to record audio.
     */ audio : boolean ; /**
     * Whether to record video.
     */ video : boolean ; /**
     * Whether to record the screen.
     */ screen : boolean ; } /**
 * An event that is used to start audio recording.
 */ export interface BeginRecordingAction extends AsyncAction , RecordingOptions { type : 'begin_recording' ; } /**
 * An event that is used to finish audio recording.
 */ export interface EndRecordingAction extends AsyncAction { type : 'end_recording' ; } export interface SpeakTextOptions { /**
     * The pitch that the text should be spoken at.
     */ pitch ? : number ; /**
     * The rate that the text should be spoken at.
     */ rate ? : number ; /**
     * The name of the voice that the text should be spoken with.
     */ voice ? : string ; } /**
 * An event that is used to speak some text using the builtin text to speech engine.
 */ export interface SpeakTextAction extends AsyncAction , SpeakTextOptions { type : 'speak_text' ; /**
     * The text that should be spoken.
     */ text : string ; } /**
 * An event that is used to retrieve the synthetic voices that are supported by the current system.
 */ export interface GetVoicesAction extends AsyncAction { type : 'get_voices' ; } /**
 * Defines an interface that represents a synthetic voice.
 */ export interface SyntheticVoice { /**
     * Whether this voice is the default synthetic voice.
     */ default : boolean ; /**
     * The language that this voice can speak.
     */ language : string ; /**
     * The name of the voice.
     */ name : string ; } /**
 * An event that is used to retrieve the current geolocation of the device.
 */ export interface GetGeolocationAction extends AsyncAction { type : 'get_geolocation' ; } export interface SuccessfulGeolocation { success : true ; /**
     * The altitude that the device is near.
     * Null if the device does not support determining the altitude.
     */ altitude ? : number ; /**
     * The accuracy of the altitude in meters.
     * Null if the device does not support altitude.
     */ altitudeAccuracy ? : number ; /**
     * The latitude that the device is near.
     */ latitude ? : number ; /**
     * The longitude that the device is near.
     */ longitude ? : number ; /**
     * The accuracy of the positional location (latitude and longitude) in meters.
     */ positionalAccuracy ? : number ; /**
     * The heading of the device from north in radians.
     * 0 is true north, Math.PI/2 is east, Math.PI is south and 3/2*Math.PI is west.
     * This value is null if the device is unable to determine the heading.
     */ heading : number ; /**
     * The speed that the device is moving in meters per second.
     * Null if the device does not support calculating the speed.
     */ speed : number ; /**
     * The timestamp of the geolocation result.
     */ timestamp : number ; } export interface UnsuccessfulGeolocation { success : false ; /**
     * The code of the error that occurred.
     */ errorCode ? : 'permission_denied' | 'position_unavailable' | 'timeout' | 'unknown' ; /**
     * The message of the error that occurred.
     */ errorMessage ? : string ; } /**
 * Defines an interface that represents a geolocation result.
 */ export type Geolocation = SuccessfulGeolocation | UnsuccessfulGeolocation ; /**
 * Defines an interface that contains recorded data.
 */ export interface Recording { /**
     * The list of files that were produced when recording.
     */ files : RecordedFile [ ] ; } export interface RecordedFile { /**
     * Whether the file contains the recorded audio.
     */ containsAudio : boolean ; /**
     * Whether the file contains the recorded video.
     */ containsVideo : boolean ; /**
     * Whether the file contains the recorded screen data.
     */ containsScreen : boolean ; /**
     * The data that the file contains.
     */ data : Blob ; } /**
 * Defines an event that tells the IDE portal to open the given bot and tag.
 */ export interface GoToTagAction { type : 'go_to_tag' ; /**
     * The ID of the bot.
     */ botId : string ; /**
     * The tag to open.
     */ tag : string ; /**
     * The space to open.
     */ space : string | null ; } /**
 * Defines an event that requests a Auth data from the OS.
 */ export interface RequestAuthDataAction extends AsyncAction { type : 'request_auth_data' ; } /**
 * Defines an interface that represents a authenticated user.
 */ export interface AuthData { /**
     * The ID of the user.
     */ userId : string ; /**
     * The name of the user.
     * Null if the user has not set a name.
     */ name : string ; /**
     * The URL of the user's avatar.
     * Null if the user does not have an avatar.
     */ avatarUrl : string ; /**
     * The URL that the user's avatar portrait is at.
     * Null if the user does not have an avatar.
     */ avatarPortraitUrl : string ; } /**
 * Defines an event that defines a global variable that points to the given bot.
 */ export interface DefineGlobalBotAction extends AsyncAction { type : 'define_global_bot' ; /**
     * The ID of the bot that should be defined.
     */ botId : string ; /**
     * The name of the global variable that should reference the bot.
     */ name : string ; } /**
 * Defines an event that publishes data to a record.
 */ export interface RecordDataAction extends AsyncAction { type : 'record_data' ; /**
     * The record key that should be used to publish the data.
     */ recordKey : string ; /**
     * The address that the data should be recorded to.
     */ address : string ; /**
     * The data that should be recorded.
     */ data : any ; } /**
 * Defines an event that requests some data in a record.
 */ export interface GetRecordDataAction extends AsyncAction { type : 'get_record_data' ; /**
     * The name of the record.
     */ recordName : string ; /**
     * The address of the data that should be retrieved.
     */ address : string ; } /**
 * Defines an event that publishes a file to a record.
 */ export interface RecordFileAction extends AsyncAction { type : 'record_file' ; /**
     * The record key that should be used to publish the file.
     */ recordKey : string ; /**
     * The data that should be recorded.
     */ data : any ; /**
     * The description of the file.
     */ description : string ; /**
     * The MIME type of the uploaded file.
     */ mimeType ? : string ; } export type FileRecordedResult = FileRecordedSuccess | FileRecordedFailure ; export interface FileRecordedSuccess { success : true ; url : string ; sha256Hash : string ; } export interface FileRecordedFailure { success : false ; errorCode : RecordFileFailure [ 'errorCode' ] | 'upload_failed' ; errorMessage : string ; } export interface GetRecordsActionResult { records : Record [ ] ; hasMoreRecords : boolean ; totalCount : number ; cursor ? : string ; } /**
 * Defines an interface that represents options for converting a geolocation to a what3words address.
 */ export interface ConvertGeolocationToWhat3WordsOptions { /**
     * The latitude to convert.
     */ latitude : number ; /**
     * The longitude to convert.
     */ longitude : number ; /**
     * The identifier of the language that should be used for the resulting what3words address.
     */ language ? : string ; } /**
 * Defines an interface that represents an action that converts a geolocation (latitude and longitude) to a what3words address (see https://what3words.com/).
 */ export interface ConvertGeolocationToWhat3WordsAction extends AsyncAction , ConvertGeolocationToWhat3WordsOptions { type : 'convert_geolocation_to_w3w' ; } /**
 * Defines an interface that represents an action that requests a key to a public record.
 */ export interface GetPublicRecordKeyAction extends AsyncAction { type : 'get_public_record_key' ; /**
     * The name of the record.
     */ recordName : string ; } param bot export function botAdded ( bot ) { return { type : 'add_bot' , id : bot . id , bot : bot , } ; } param botId export function botRemoved ( botId ) { return { type : 'remove_bot' , id : botId , } ; } param id param update export function botUpdated ( id , update ) { return { type : 'update_bot' , id : id , update : update , } ; } param events export function transaction ( events ) { return { type : 'transaction' , events : events , } ; } param eventName param botIds param userId param arg param sortIds export function action ( eventName , botIds = null , userId = null , arg ? , sortIds = true ) { return { type : 'action' , botIds , eventName , userId , argument : arg , sortBotIds : sortIds , } ; } param event export function reject ( ... events ) { return { type : 'reject' , actions : events , } ; } param state export function addState ( state ) { return { type : 'apply_state' , state : state , } ; } param state param options export function pasteState ( state , options ) { return { type : 'paste_state' , state , options , } ; } param message export function toast ( message , duration ? ) { if ( duration != null ) { return { type : 'show_toast' , message : message , duration : duration * 1000 , } ; } return { type : 'show_toast' , message : message , duration : 2000 , } ; } param template export function html ( html ) { return { type : 'show_html' , visible : true , html : html , } ; } /**
 * Creates a new HideHtmlAction.
 */ export function hideHtml ( ) { return { type : 'show_html' , visible : false , } ; } param botId param zoomValue param rotX param rotY param duration export function tweenTo ( botId , options = { } , taskId ? ) { return { type : 'focus_on' , botId : botId , taskId , ... options , } ; } param position param options param taskId export function animateToPosition ( position , options = { } , taskId ? ) { return { type : 'focus_on_position' , position , taskId , ... options , } ; } param taskId export function cancelAnimation ( taskId ? ) { return { type : 'cancel_animation' , taskId , } ; } param open param cameraType export function openQRCodeScanner ( open , cameraType ? ) { return { type : 'show_qr_code_scanner' , open : open , cameraType : cameraType , } ; } param open param code export function showQRCode ( open , code ? ) { return { type : 'show_qr_code' , open : open , code : code , } ; } param open param cameraType export function openBarcodeScanner ( open , cameraType ? ) { return { type : 'show_barcode_scanner' , open : open , cameraType : cameraType , } ; } param open param code param format export function showBarcode ( open , code ? , format = 'code128' ) { return { type : 'show_barcode' , open : open , code : code , format : format , } ; } param options export function showChat ( options = { } ) { return { type : 'show_chat_bar' , visible : true , ... options , } ; } /**
 * Creates a new ShowRunBarAction that hides the run bar.
 */ export function hideChat ( ) { return { type : 'show_chat_bar' , visible : false , } ; } param id export function loadSimulation ( id ) { return { type : 'load_server' , id : id , } ; } param id export function unloadSimulation ( id ) { return { type : 'unload_server' , id : id , } ; } param eventName param arg export function superShout ( eventName , arg ? ) { return { type : 'super_shout' , eventName , argument : arg , } ; } param dimension export function goToDimension ( dimension ) { return { type : 'go_to_dimension' , dimension , } ; } param url export function importAUX ( url ) { return { type : 'import_aux' , url : url , } ; } param botId param tag export function showInputForTag ( botId , tag , options ? ) { return { type : 'show_input_for_tag' , botId : botId , tag : tag , options : options || { } , } ; } param currentValue param options param taskId export function showInput ( currentValue ? , options ? , taskId ? ) { return { type : 'show_input' , taskId , currentValue , options : options || { } , } ; } param offline export function setForcedOffline ( offline ) { return { type : 'set_offline_state' , offline : offline , } ; } param url export function goToURL ( url ) { return { type : 'go_to_url' , url : url , } ; } param url export function openURL ( url ) { return { type : 'open_url' , url : url , } ; } param url param soundID param taskId export function playSound ( url , soundID , taskId ? ) { return { type : 'play_sound' , url : url , soundID , taskId , } ; } param url param taskId export function bufferSound ( url , taskId ? ) { return { type : 'buffer_sound' , url : url , taskId , } ; } param soundId param taskId export function cancelSound ( soundID , taskId ? ) { return { type : 'cancel_sound' , soundID , taskId , } ; } param script export function shell ( script ) { return { type : 'shell' , script : script , } ; } /**
 * Creates a new ToggleConsoleEvent.
 */ export function openConsole ( ) { return { type : 'open_console' , open : true , } ; } param auth param options export function backupToGithub ( auth , options ? ) { return { type : 'backup_to_github' , auth , options , } ; } /**
 * Creates a new BackupAsDownload event.
 */ export function backupAsDownload ( target , options ? ) { return { type : 'backup_as_download' , target , options , } ; } param data param filename param mimeType export function download ( data , filename , mimeType ) { return { type : 'download' , data , filename , mimeType , } ; } param options export function checkout ( options ) { return { type : 'start_checkout' , ... options , } ; } /**
 * Creates a new CheckoutSubmittedAction.
 */ export function checkoutSubmitted ( productId , token , processingInst ) { return { type : 'checkout_submitted' , productId : productId , token : token , processingInst : processingInst , } ; } param secretKey param token param amount param currency param description param extra export function finishCheckout ( secretKey , token , amount , currency , description , extra ? ) { return { type : 'finish_checkout' , secretKey : secretKey , amount : amount , currency : currency , description : description , token : token , extra : extra , } ; } param options param taskId export function webhook ( options , taskId ? ) { return { type : 'send_webhook' , options : options , taskId , } ; } param botId param tag param options param taskId export function animateTag ( botId , tag , options , taskId ? ) { return { type : 'animate_tag' , botId , tag , options , taskId , } ; } param options param taskId export function loadFile ( options , taskId ? ) { return { type : 'load_file' , options : options , taskId , } ; } param options param taskId export function saveFile ( options , taskId ? ) { return { type : 'save_file' , options : options , taskId , } ; } param inst export function getRemoteCount ( inst ? ) { if ( hasValue ( inst ) ) { return { type : 'get_remote_count' , inst , } ; } else { return { type : 'get_remote_count' , } ; } } /**
 * Creates a new GetServersAction.
 */ export function getServers ( ) { return { type : 'get_servers' , } ; } /**
 * Creates a new GetServersAction that includes statuses.
 */ export function getServerStatuses ( ) { return { type : 'get_servers' , includeStatuses : true , } ; } /**
 * Creates a new GetRemotesAction.
 */ export function getRemotes ( ) { return { type : 'get_remotes' , } ; } param bot export function replaceDragBot ( bot ) { return { type : 'replace_drag_bot' , bot , } ; } param channel param botOrMod param taskId export function setupServer ( channel , botOrMod ? , taskId ? , playerId ? ) { return { type : 'setup_server' , channel , botOrMod , taskId , playerId , } ; } param pin param mode param taskId export function exportGpioPin ( pin , mode , taskId ? , playerId ? ) { return { type : 'export_gpio_pin' , pin , mode , taskId , playerId , } ; } param pin param taskId export function unexportGpioPin ( pin , taskId ? , playerId ? ) { return { type : 'unexport_gpio_pin' , pin , taskId , playerId , } ; } param pin param value param taskId export function setGpioPin ( pin , value , taskId ? , playerId ? ) { return { type : 'set_gpio_pin' , pin , value , taskId , playerId , } ; } param pin param taskId export function getGpioPin ( pin , taskId ? , playerId ? ) { return { type : 'get_gpio_pin' , pin , taskId , playerId , } ; } param options param taskId example export function rpioInitPin ( options , taskId ? , playerId ? ) { return { type : 'rpio_init' , options , taskId , playerId , } ; } param taskId export function rpioExitPin ( taskId ? , playerId ? ) { return { type : 'rpio_exit' , taskId , playerId , } ; } param pin param mode param taskId export function rpioOpenPin ( pin , mode , options ? , taskId ? , playerId ? ) { return { type : 'rpio_open' , pin , mode , options , taskId , playerId , } ; } param pin param mode param taskId export function rpioModePin ( pin , mode , options ? , taskId ? , playerId ? ) { return { type : 'rpio_mode' , pin , mode , options , taskId , playerId , } ; } param pin param taskId export function rpioReadPin ( pin , taskId ? , playerId ? ) { return { type : 'rpio_read' , pin , taskId , playerId , } ; } param pin param length param taskId export function rpioReadSequencePin ( pin , length , taskId ? , playerId ? ) { return { type : 'rpio_read_sequence' , pin , length , taskId , playerId , } ; } param pin param value param taskId export function rpioWritePin ( pin , value , taskId ? , playerId ? ) { return { type : 'rpio_write' , pin , value , taskId , playerId , } ; } param pin param buffer param taskId export function rpioWriteSequencePin ( pin , buffer , taskId ? , playerId ? ) { return { type : 'rpio_write_sequence' , pin , buffer , taskId , playerId , } ; } param group param bitmask param taskId export function rpioReadpadPin ( group , bitmask , taskId ? , playerId ? ) { return { group , bitmask , type : 'rpio_readpad' , taskId , playerId , } ; } param group param slew param hysteresis param current param taskId export function rpioWritepadPin ( group , slew ? , hysteresis ? , current ? , taskId ? , playerId ? ) { return { group , slew , hysteresis , current , type : 'rpio_writepad' , taskId , playerId , } ; } param pin param state param taskId export function rpioPudPin ( pin , state , taskId ? , playerId ? ) { return { pin , state , type : 'rpio_pud' , taskId , playerId , } ; } param pin param cb param options param taskId export function rpioPollPin ( pin , cb , options ? , taskId ? , playerId ? ) { return { pin , cb , options , type : 'rpio_poll' , taskId , playerId , } ; } param pin param options param taskId export function rpioClosePin ( pin , options ? , taskId ? , playerId ? ) { return { type : 'rpio_close' , pin , options , taskId , playerId , } ; } param taskId export function rpioI2CBeginPin ( taskId ? , playerId ? ) { return { type : 'rpio_i2c_begin' , taskId , playerId , } ; } param address param taskId export function rpioI2CSetSlaveAddressPin ( address , taskId ? , playerId ? ) { return { address , type : 'rpio_i2c_setslaveaddress' , taskId , playerId , } ; } param rate param taskId export function rpioI2CSetBaudRatePin ( rate , taskId ? , playerId ? ) { return { rate , type : 'rpio_i2c_setbaudrate' , taskId , playerId , } ; } param rate param taskId export function rpioI2CSetClockDividerPin ( rate , taskId ? , playerId ? ) { return { rate , type : 'rpio_i2c_setclockdivider' , taskId , playerId , } ; } param rx param length param taskId export function rpioI2CReadPin ( rx , length ? , taskId ? , playerId ? ) { return { rx , length , type : 'rpio_i2c_read' , taskId , playerId , } ; } param tx param length param taskId export function rpioI2CWritePin ( tx , length ? , taskId ? , playerId ? ) { return { tx , length , type : 'rpio_i2c_write' , taskId , playerId , } ; } param taskId param taskId param taskId export function rpioI2CEndPin ( taskId ? , playerId ? ) { return { type : 'rpio_i2c_end' , taskId , playerId , } ; } param rate param taskId export function rpioPWMSetClockDividerPin ( rate , taskId ? , playerId ? ) { return { type : 'rpio_pwm_setclockdivider' , rate , taskId , playerId , } ; } param pin param range param taskId export function rpioPWMSetRangePin ( pin , range , taskId ? , playerId ? ) { return { pin , range , type : 'rpio_pwm_setrange' , taskId , playerId , } ; } param pin param width param taskId export function rpioPWMSetDataPin ( pin , width , taskId ? , playerId ? ) { return { pin , width , type : 'rpio_pwm_setdata' , taskId , playerId , } ; } param taskId export function rpioSPIBeginPin ( taskId ? , playerId ? ) { return { type : 'rpio_spi_begin' , taskId , playerId , } ; } param value param taskId export function rpioSPIChipSelectPin ( value , taskId ? , playerId ? ) { return { value , type : 'rpio_spi_chipselect' , taskId , playerId , } ; } param value param polarity param taskId export function rpioSPISetCSPolarityPin ( value , polarity , taskId ? , playerId ? ) { return { value , polarity , type : 'rpio_spi_setcspolarity' , taskId , playerId , } ; } param rate param taskId export function rpioSPISetClockDividerPin ( rate , taskId ? , playerId ? ) { return { rate , type : 'rpio_spi_setclockdivider' , taskId , playerId , } ; } param mode param taskId export function rpioSPISetDataModePin ( mode , taskId ? , playerId ? ) { return { mode , type : 'rpio_spi_setdatamode' , taskId , playerId , } ; } param taskId export function rpioSPITransferPin ( tx , taskId ? , playerId ? ) { return { tx , type : 'rpio_spi_transfer' , taskId , playerId , } ; } param taskId export function rpioSPIWritePin ( tx , taskId ? , playerId ? ) { return { tx , type : 'rpio_spi_write' , taskId , playerId , } ; } param taskId export function rpioSPIEndPin ( taskId ? , playerId ? ) { return { type : 'rpio_spi_end' , taskId , playerId , } ; } /**
 */ param name param path param options { boolean } param taskId export function serialConnectPin ( name , device , mac , channel , options ? , taskId ? , playerId ? ) { return { name , device , mac , channel , options , type : 'serial_connect' , taskId , playerId , } ; } param bot param name param taskId export function serialStreamPin ( bot , name , taskId ? , playerId ? ) { return { bot , name , type : 'serial_stream' , taskId , playerId , } ; } param name param taskId export function serialOpenPin ( name , taskId ? , playerId ? ) { return { name , type : 'serial_open' , taskId , playerId , } ; } param name param options { number = } param cb param taskId export function serialUpdatePin ( name , options , cb ? , taskId ? , playerId ? ) { return { name , options , cb , type : 'serial_update' , taskId , playerId , } ; } param name param data param encoding param cb param taskId export function serialWritePin ( name , data , encoding ? , cb ? , taskId ? , playerId ? ) { return { name , data , encoding , cb , type : 'serial_write' , taskId , playerId , } ; } param name param size param taskId export function serialReadPin ( name , size ? , taskId ? , playerId ? ) { return { name , size , type : 'serial_read' , taskId , playerId , } ; } param name param cb param device param taskId export function serialClosePin ( name , device , cb ? , taskId ? , playerId ? ) { return { name , device , cb , type : 'serial_close' , taskId , playerId , } ; } param name param taskId export function serialFlushPin ( name , taskId ? , playerId ? ) { return { name , type : 'serial_flush' , taskId , playerId , } ; } param name param taskId export function serialDrainPin ( name , taskId ? , playerId ? ) { return { name , type : 'serial_drain' , taskId , playerId , } ; } param name param taskId export function serialPausePin ( name , taskId ? , playerId ? ) { return { name , type : 'serial_pause' , taskId , playerId , } ; } param name param taskId export function serialResumePin ( name , taskId ? , playerId ? ) { return { name , type : 'serial_resume' , taskId , playerId , } ; } param text export function setClipboard ( text ) { return { type : 'set_clipboard' , text , } ; } param script param taskId export function runScript ( script , taskId ? ) { return { type : 'run_script' , script , taskId , } ; } /**
 * Creates a showUploadAuxFileAction.
 */ export function showUploadAuxFile ( ) { return { type : 'show_upload_aux_file' , } ; } /**
 * Creates a ShowUploadFilesAction.
 */ export function showUploadFiles ( taskId ) { return { type : 'show_upload_files' , taskId , } ; } param options export function markHistory ( options ) { return { type : 'mark_history' , ... options , } ; } export interface MarkHistoryOptions { message : string ; } /**
 * Creates a BrowseHistoryAction.
 */ export function browseHistory ( ) { return { type : 'browse_history' , } ; } param mark param inst export function restoreHistoryMark ( mark , inst ? ) { if ( ! inst ) { return { type : 'restore_history_mark' , mark , } ; } else { return { type : 'restore_history_mark' , mark , inst , } ; } } param space param config param taskId export function loadSpace ( space , config , taskId ? ) { return { type : 'load_space' , space , config , taskId , } ; } /**
 * Creates a EnableARAction.
 */ export function enableAR ( ) { return { type : 'enable_ar' , enabled : true , } ; } /**
 * Creates a EnableVRAction.
 */ export function enableVR ( ) { return { type : 'enable_vr' , enabled : true , } ; } /**
 * Creates a EnableARAction that disables AR.
 */ export function disableAR ( ) { return { type : 'enable_ar' , enabled : false , } ; } /**
 * Creates a EnableVRAction that disables VR.
 */ export function disableVR ( ) { return { type : 'enable_vr' , enabled : false , } ; } param center returns export function enablePOV ( center , imu ? ) { return { type : 'enable_pov' , enabled : true , center , imu , } ; } /**
 * Creates a EnablePOVAction that disables point-of-view mode.
 */ export function disablePOV ( ) { return { type : 'enable_pov' , enabled : false , } ; } param inst param dimension export function showJoinCode ( inst ? , dimension ? ) { return { type : 'show_join_code' , inst , dimension , } ; } /**
 * Requests that the app go into fullscreen mode.
 */ export function requestFullscreen ( ) { return { type : 'request_fullscreen_mode' , } ; } /**
 * Exists fullscreen mode.
 */ export function exitFullscreen ( ) { return { type : 'exit_fullscreen_mode' , } ; } param space param tags param taskId export function loadBots ( space , tags , taskId ? ) { return { type : 'load_bots' , space : space , tags : tags , taskId , } ; } param space param taskId export function clearSpace ( space , taskId ? ) { return { type : 'clear_space' , space : space , taskId , } ; } param space param password param taskId export function unlockSpace ( space , password , taskId ? ) { return { type : 'unlock_space' , space , password , taskId , } ; } param space param oldPassword param newPassword param taskId export function setSpacePassword ( space , oldPassword , newPassword , taskId ? ) { return { type : 'set_space_password' , space , oldPassword , newPassword , taskId , } ; } param botId param animation export function localFormAnimation ( botId , animation ) { return { type : 'local_form_animation' , botId , animation , } ; } param botId param dimension param position param easing param duration export function localPositionTween ( botId , dimension , position , easing = { type : 'linear' , mode : 'inout' } , duration = 1 , taskId ? ) { return { type : 'local_tween' , tweenType : 'position' , botId , dimension , easing , position , duration : clamp ( duration , 0 , MAX_TWEEN_DURATION ) , taskId , } ; } param botId param dimension param position param easing param duration export function localRotationTween ( botId , dimension , rotation , easing = { type : 'linear' , mode : 'inout' } , duration = 1 , taskId ? ) { return { type : 'local_tween' , tweenType : 'rotation' , botId , dimension , easing , rotation , duration : clamp ( duration , 0 , MAX_TWEEN_DURATION ) , taskId , } ; } param list param event param result param mapBots export function enqueueAsyncResult ( list , event , result , mapBots ? ) { if ( hasValue ( event . taskId ) ) { if ( hasValue ( event . playerId ) ) { list . push ( remoteResult ( result , { sessionId : event . playerId , } , event . taskId ) ) ; } else { list . push ( asyncResult ( event . taskId , result , mapBots ) ) ; } } } param list param event param error export function enqueueAsyncError ( list , event , error ) { if ( hasValue ( event . taskId ) ) { if ( hasValue ( event . playerId ) ) { list . push ( remoteError ( error , { sessionId : event . playerId , } , event . taskId ) ) ; } else { list . push ( asyncError ( event . taskId , error ) ) ; } } } param taskId param result param mapBots export function asyncResult ( taskId , result , mapBots ? ) { return { type : 'async_result' , taskId , result , mapBotsInResult : mapBots , } ; } param taskId param error export function asyncError ( taskId , error ) { return { type : 'async_error' , taskId , error , } ; } param options param taskId export function share ( options , taskId ? ) { return { type : 'share' , taskId , ... options , } ; } param open param options param taskId export function circleWipe ( open , options , taskId ? ) { return { type : 'show_circle_wipe' , open , options , taskId , } ; } param botId param targets export function addDropSnap ( botId , targets ) { return { type : 'add_drop_snap_targets' , botId , targets , } ; } /**
 * Creates a EnableCustomDraggingAction.
 */ export function enableCustomDragging ( ) { return { type : 'enable_custom_dragging' , } ; } param portalId export function registerBuiltinPortal ( portalId ) { return { type : 'register_builtin_portal' , portalId , } ; } param prefix param taskId export function registerPrefix ( prefix , options , taskId ? ) { return { type : 'register_prefix' , prefix , options , taskId , } ; } param options param taskId export function createCertificate ( options , taskId ? ) { return { type : 'create_certificate' , ... options , taskId , } ; } param signingBotId param signingPassword param botId param tag param value export function signTag ( signingBotId , signingPassword , botId , tag , value , taskId ? ) { return { type : 'sign_tag' , signingBotId , signingPassword , botId , tag , value , taskId , } ; } param signingBotId param signingPassword param certificateBotId param taskId export function revokeCertificate ( signingBotId , signingPassword , certificateBotId , taskId ? ) { return { type : 'revoke_certificate' , signingBotId , signingPassword , certificateBotId , taskId , } ; } param options param taskId export function beginAudioRecording ( options , taskId ? ) { return { type : 'begin_audio_recording' , ... options , taskId , } ; } param taskId export function endAudioRecording ( taskId ? ) { return { type : 'end_audio_recording' , taskId , } ; } param options param taskId export function beginRecording ( options , taskId ? ) { return { type : 'begin_recording' , ... options , taskId , } ; } param taskId export function endRecording ( taskId ? ) { return { type : 'end_recording' , taskId , } ; } param text param options param taskId export function speakText ( text , options , taskId ? ) { return { type : 'speak_text' , text , ... options , taskId , } ; } param taskId export function getVoices ( taskId ? ) { return { type : 'get_voices' , taskId , } ; } param taskId export function getGeolocation ( taskId ? ) { return { type : 'get_geolocation' , taskId , } ; } param botId param tag export function goToTag ( botId , tag , space = null ) { return { type : 'go_to_tag' , botId , tag , space , } ; } param appId param botId export function registerCustomApp ( appId , botId , taskId ? ) { return { type : 'register_custom_app' , appId , botId , taskId , } ; } param appId param botId export function unregisterCustomApp ( appId , taskId ? ) { return { type : 'unregister_custom_app' , appId , taskId , } ; } param appId param output export function setAppOutput ( appId , output ) { return { type : 'set_app_output' , uncopiable : true , appId , output , } ; } /**
 * Creates a RegisterHtmlAppAction.
 */ export function registerHtmlApp ( appId , instanceId , taskId ? ) { return { type : 'register_html_app' , appId , instanceId , taskId , } ; } /**
 * Creates a UnregisterHtmlAppAction.
 */ export function unregisterHtmlApp ( appId , instanceId ) { return { type : 'unregister_html_app' , appId , instanceId , } ; } /**
 * Creates a UpdateHtmlAppAction.
 */ export function updateHtmlApp ( appId , updates ) { return { type : 'update_html_app' , appId , updates , } ; } param appId param event export function htmlAppEvent ( appId , event ) { return { type : 'html_app_event' , appId , event , } ; } /**
 * Creates a RequestAuthDataAction.
 */ export function requestAuthData ( taskId ? ) { return { type : 'request_auth_data' , taskId , } ; } /**
 * Creates a DefineGlobalBotAction.
 */ export function defineGlobalBot ( name , botId , taskId ? ) { return { type : 'define_global_bot' , name , botId , taskId , } ; } param options param taskId export function convertGeolocationToWhat3Words ( options , taskId ) { return { type : 'convert_geolocation_to_w3w' , ... options , taskId , } ; } param recordName param taskId export function getPublicRecordKey ( recordName , taskId ) { return { type : 'get_public_record_key' , recordName , taskId , } ; } param recordKey param address param data param taskId export function recordData ( recordKey , address , data , taskId ) { return { type : 'record_data' , recordKey , address , data , taskId , } ; } param recordName param address param taskId export function getRecordData ( recordName , address , taskId ? ) { return { type : 'get_record_data' , recordName , address , taskId , } ; } param recordKey param data param description param mimeType export function recordFile ( recordKey , data , description , mimeType , taskId ? ) { return { type : 'record_file' , recordKey , data , description , mimeType , taskId , } ; }