import { AttributeChange, ParticipantChange, ScopeChange, State } from "@empirica/tajriba"; import { Writable } from "svelte/store"; import { JsonValue } from "./json"; export declare const hash: (s: string | undefined) => number | "" | undefined; export interface AttributeOptions { /** * Private indicates the attribute will not be visible to other Participants. */ private: boolean; /** * Protected indicates the attribute will not be updatable by other * Participants. */ protected: boolean; /** Immutable creates an Attribute that cannot be updated. */ immutable: boolean; /** Vector indicates the value is a vector. */ vector: boolean; /** * Index, only used if the Attribute is a vector, indicates which index to * update the value at. */ index: number | null; /** * Append, only used if the Attribute is a vector, indicates to append the * attribute to the vector. */ append: boolean | null; } export declare class EAttribute { scope: EScope; readonly key: string; attribute?: AttributeChange | undefined; value: JsonValue; ao?: Partial; private isCompoundC?; private compoundElementsC?; constructor(scope: EScope, key: string, attribute?: AttributeChange | undefined); get isCompound(): boolean | undefined; get compoundElements(): { cType: string; cKey: string; subType: string; subID: string; }; update(attribute: AttributeChange): this | undefined; } export interface getSetter { get: (key: string) => JsonValue; set: (key: string, val: JsonValue, ao?: Partial) => void; } export declare function scopedScope(scope: EScope, subType: string, subID: string): getSetter; export declare class EScope { store: Store; attributes: { [key: string]: EAttribute; }; scope?: ScopeChange; constructor(store: Store); get hash(): number | "" | undefined; get id(): string; get scopeID(): string | undefined; get kind(): string; get(key: string): JsonValue; set(key: string, val: JsonValue, ao?: Partial): void; removeAttribute(attribute: AttributeChange): void; updateAttribute(attribute: AttributeChange): EAttribute | undefined; } export declare class Player extends EScope { store: Store; games: Game[]; online: boolean; participant?: ParticipantChange; constructor(store: Store); get id(): string; get scopeID(): string | undefined; private get currentGame(); get game(): getSetter; get round(): getSetter; get stage(): getSetter; } export declare class Root extends EScope { batches: Batch[]; } export declare class Batch extends EScope { store: Store; games: Game[]; constructor(store: Store); get config(): { [key: string]: any; }; } export declare class Game extends EScope { store: Store; constructor(store: Store); get state(): string; get batch(): "" | Batch | undefined; get currentStage(): Stage | undefined; get players(): Player[]; get rounds(): Round[]; get treatment(): { [key: string]: any; }; } export declare class Round extends EScope { store: Store; stages: Stage[]; constructor(store: Store); get game(): "" | Game | undefined; } export declare class Stage extends EScope { store: Store; remaining: number | null; remainingW: Writable; timeoutID?: ReturnType; ended: boolean; state?: State; constructor(store: Store); get round(): "" | Round | undefined; get duration(): number; clearTimer(): void; clearTimout(): void; setTimer(from: Date, remaining: number): void; nextTimer(from: Date, remaining: number): void; private updateTime; } export declare class Store { scopes: { [key: string]: EScope; }; batches: { [key: string]: Batch; }; games: { [key: string]: Game; }; rounds: { [key: string]: Round; }; stages: { [key: string]: Stage; }; players: { [key: string]: Player; }; root?: Root; pushAttributeChange?: (attribute: EAttribute) => void; attributeChanged(attribute: EAttribute): void; updateParticipant(p: ParticipantChange, removed: boolean): Player | undefined; updateAttribute(a: AttributeChange, removed: boolean): void | EAttribute; updateScope(s: ScopeChange, removed: boolean): EScope | undefined; }