{"version":3,"file":"interacto.mjs","sources":["../src/api/binder/BaseBinderBuilder.ts","../src/api/binder/When.ts","../src/api/binding/Bindings.ts","../src/api/fsm/EventType.ts","../src/api/fsm/OutputState.ts","../src/api/undo/TreeUndoHistory.ts","../src/api/undo/UndoHistory.ts","../src/api/undo/Undoable.ts","../src/impl/animation/DwellSpringAnimation.ts","../src/impl/command/CommandBase.ts","../src/impl/command/AnonCmd.ts","../src/impl/binder/Binder.ts","../src/impl/binding/MustBeUndoableCmdError.ts","../src/impl/binding/BindingImpl.ts","../src/impl/fsm/CancelFSMError.ts","../src/impl/binding/AnonBinding.ts","../src/impl/binder/UpdateBinder.ts","../src/impl/interaction/InteractionDataBase.ts","../src/impl/interaction/KeyDataImpl.ts","../src/impl/interaction/KeysDataImpl.ts","../src/impl/binder/KeysBinder.ts","../src/impl/fsm/TransitionBase.ts","../src/impl/fsm/MouseTransition.ts","../src/impl/fsm/ClickTransition.ts","../src/impl/fsm/StateBase.ts","../src/impl/fsm/CancellingState.ts","../src/impl/fsm/Events.ts","../src/impl/fsm/OutputStateBase.ts","../src/impl/fsm/InitState.ts","../src/impl/fsm/StdState.ts","../src/impl/fsm/TerminalState.ts","../src/impl/fsm/TimeoutTransition.ts","../src/impl/util/ArrayUtil.ts","../src/impl/fsm/FSMImpl.ts","../src/impl/interaction/InteractionBase.ts","../src/impl/interaction/PointingDataBase.ts","../src/impl/interaction/PointDataImpl.ts","../src/impl/interaction/library/Click.ts","../src/impl/interaction/PointsDataImpl.ts","../src/impl/interaction/MousePointsDataImpl.ts","../src/impl/interaction/library/Clicks.ts","../src/impl/fsm/SubFSMTransition.ts","../src/impl/interaction/library/DoubleClick.ts","../src/impl/fsm/KeyTransition.ts","../src/impl/fsm/EscapeKeyPressureTransition.ts","../src/impl/interaction/SrcTgtDataBase.ts","../src/impl/interaction/SrcTgtPointsDataImpl.ts","../src/impl/interaction/library/DragLock.ts","../src/impl/interaction/library/KeyDown.ts","../src/impl/interaction/library/KeysTyped.ts","../src/impl/interaction/library/KeyTyped.ts","../src/impl/interaction/library/KeyUp.ts","../src/impl/interaction/library/LongMouseDown.ts","../src/impl/interaction/library/MouseDown.ts","../src/impl/interaction/library/MouseUp.ts","../src/impl/fsm/TouchTransition.ts","../src/impl/interaction/TouchDataImpl.ts","../src/impl/interaction/SrcTgtTouchDataImpl.ts","../src/impl/interaction/library/TouchDnD.ts","../src/impl/fsm/ConcurrentAndFSM.ts","../src/impl/interaction/ConcurrentInteraction.ts","../src/impl/interaction/MultiTouchDataImpl.ts","../src/impl/interaction/library/MultiTouch.ts","../src/impl/interaction/InteractionBuilderImpl.ts","../src/impl/interaction/library/Pans.ts","../src/impl/interaction/TwoTouchDataImpl.ts","../src/impl/interaction/RotationTouchDataImpl.ts","../src/impl/interaction/ScaleTouchDataImpl.ts","../src/impl/interaction/TwoPanDataImpl.ts","../src/impl/interaction/GeneralTwoTouchDataImpl.ts","../src/impl/interaction/ThreeTouchDataImpl.ts","../src/impl/interaction/FourTouchDataImpl.ts","../src/impl/interaction/library/XTouch.ts","../src/impl/interaction/library/TwoPans.ts","../src/impl/checker/CheckerImpl.ts","../src/impl/binding/BindingsContext.ts","../src/impl/command/library/Redo.ts","../src/impl/command/library/Undo.ts","../src/impl/fsm/BoxCheckPressedTransition.ts","../src/impl/interaction/WidgetDataImpl.ts","../src/impl/interaction/library/BoxChecked.ts","../src/impl/fsm/ButtonPressedTransition.ts","../src/impl/interaction/library/ButtonPressed.ts","../src/impl/fsm/ColorPickedTransition.ts","../src/impl/interaction/library/ColorPicked.ts","../src/impl/fsm/ComboBoxTransition.ts","../src/impl/interaction/library/ComboBoxSelected.ts","../src/impl/fsm/DatePickedTransition.ts","../src/impl/interaction/library/DatePicked.ts","../src/impl/interaction/library/DnD.ts","../src/impl/fsm/HyperLinkTransition.ts","../src/impl/interaction/library/HyperLinkClicked.ts","../src/impl/interaction/library/KeysDown.ts","../src/impl/interaction/library/LongTouch.ts","../src/impl/interaction/library/MouseEnter.ts","../src/impl/interaction/library/MouseLeave.ts","../src/impl/interaction/library/MouseMove.ts","../src/impl/fsm/ScrollTransition.ts","../src/impl/interaction/ScrollDataImpl.ts","../src/impl/interaction/library/Scroll.ts","../src/impl/fsm/SpinnerChangedTransition.ts","../src/impl/interaction/library/SpinnerChanged.ts","../src/impl/interaction/library/Tap.ts","../src/impl/interaction/TapsDataImpl.ts","../src/impl/interaction/library/Taps.ts","../src/impl/fsm/TextInputChangedTransition.ts","../src/impl/interaction/library/TextInputChanged.ts","../src/impl/interaction/library/TouchStart.ts","../src/impl/interaction/library/TwoTouch.ts","../src/impl/fsm/WheelTransition.ts","../src/impl/interaction/WheelDataImpl.ts","../src/impl/interaction/library/Wheel.ts","../src/impl/fsm/ConcurrentXOrFSM.ts","../src/impl/interaction/Or.ts","../src/impl/interaction/ThenDataImpl.ts","../src/impl/fsm/ThenFSM.ts","../src/impl/interaction/Then.ts","../src/impl/logging/LoggerImpl.ts","../src/impl/binding/BindingsImpl.ts","../src/impl/command/UndoableCommand.ts","../src/impl/command/library/FocusHTMLElement.ts","../src/impl/command/library/RedoNTimes.ts","../src/impl/command/library/SetProperty.ts","../src/impl/command/library/SetProperties.ts","../src/impl/command/library/TransferArrayItem.ts","../src/impl/command/library/UndoNTimes.ts","../src/impl/fsm/NotFSM.ts","../src/impl/fsm/VisitorFSMDepthFirst.ts","../src/impl/interaction/Not.ts","../src/impl/interaction/library/TimedClick.ts","../src/impl/interaction/library/TimedTaps.ts","../src/impl/logging/FittsLaw.ts","../src/impl/undo/TreeUndoHistoryImpl.ts","../src/impl/undo/UndoHistoryImpl.ts"],"sourcesContent":["/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\nimport type {WhenType} from \"./When\";\nimport type {RuleName, Severity} from \"../checker/Checker\";\nimport type {LogLevel} from \"../logging/LogLevel\";\n\n/**\n * For supporting Angular ElementReference without any dependency to Angular.\n * @category Helper\n */\nexport interface EltRef<T> {\n    /**\n     * The native element that refers to the widget.\n     */\n    nativeElement: T;\n}\n\n/**\n * Checks whether the given object matches the EltRef structure.\n * @param obj - The object to check\n * @returns The casted object if is an EltRef.\n * @category Helper\n */\nexport function isEltRef(obj: unknown): obj is EltRef<EventTarget> {\n    if (obj === undefined || obj === null) {\n        return false;\n    }\n    return (obj as EltRef<unknown>).nativeElement instanceof EventTarget;\n}\n\n/**\n * This alias refers to either an EvenTarget object or a reference to an EvenTarget object.\n * @category Helper\n */\nexport type Widget<T> = EltRef<T> | T;\n\n/**\n * The base interface for building bindings (what we call in Interacto a binder).\n * @category Helper\n */\nexport interface BaseBinderBuilder {\n    /**\n     * Specifies the widgets on which the binding will operate.\n     * When a widget is added to this list, this widget is binded to this binding.\n     * When widget is removed from this list, this widget is unbinded from this binding.\n     * @param widget - The mandatory first widget\n     * @param widgets - The list of the widgets involved in the bindings.\n     * @returns A clone of the current binder to chain the building configuration.\n     */\n    on<W>(widget: ReadonlyArray<Widget<W>> | Widget<W>, ...widgets: ReadonlyArray<Widget<W>>): BaseBinderBuilder;\n\n    /**\n     * Specifies the node the binding will observe its children.\n     * The binding observes its children list, so that additions and removals from it are managed by the binding.\n     * @param node - The binding will observe the children of this node.\n     * @returns A clone of the current binder to chain the building configuration.\n     */\n    onDynamic(node: Widget<Node>): BaseBinderBuilder;\n\n    /**\n     * Specifies the conditions to fulfill to initialise, update, or execute the command while the interaction is running.\n     * A binder can have several cummulative 'when' routines.\n     * @param fn - The predicate that checks whether the command can be initialised, updated, or executed.\n     * @param mode -- The execution mode of the 'when' predicate. If not defined, the non-strict mode will be used.\n     * @returns A clone of the current binder to chain the building configuration.\n     */\n    when(fn: () => boolean, mode?: WhenType): BaseBinderBuilder;\n\n    /**\n     * Defines actions to perform when a binding ends.\n     * A binder can have several cummulative 'end' routines.\n     * @param fn - The command to execute on each binding end.\n     * @returns A clone of the current builder to chain the building configuration.\n     */\n    end(fn: () => void): BaseBinderBuilder;\n\n    /**\n     * Specifies the logging level to use.\n     * A binder can have several cummulative 'log' routines, eg:\n     * log(LogLevel.INTERACTION).log(LogLevel.COMMAND)\n     * @param level - The logging level to use.\n     * @returns A clone of the current binder to chain the building configuration.\n     */\n    log(...level: ReadonlyArray<LogLevel>): BaseBinderBuilder;\n\n    /**\n     * If called, all the events the interaction will process will be consumed and\n     * not propagated to next listeners.\n     * @returns A clone of the current binder to chain the building configuration.\n     */\n    stopImmediatePropagation(): BaseBinderBuilder;\n\n    /**\n     * The default behavior associated to the event will be ignored.\n     * @returns A clone of the current binder to chain the building configuration.\n     */\n    preventDefault(): BaseBinderBuilder;\n\n    /**\n     * Allows the processing of errors during the execution of the binding.\n     * Errors reported here are errors thrown in arrow functions provided to the\n     * the different routines of the binder and errors triggered by the command.\n     * A binder can have several cummulative 'catch' routines.\n     * @param fn - The function to process the error caught by the binding during its execution\n     * @returns A clone of the current binder to chain the building configuration.\n     */\n    catch(fn: (ex: unknown) => void): BaseBinderBuilder;\n\n    /**\n     * Specifies the name of the Interacto binding.\n     * This name will be used in the logging system.\n     * It should be unique, but no mechanism will check that.\n     * @param name - The name of the binding\n     * @returns A clone of the current binder to chain the building configuration.\n     */\n    name(name: string): BaseBinderBuilder;\n\n    /**\n     * Configures a linter rule specifically for the binding.\n     * @param ruleName - The name of the rule.\n     * @param severity - The severity level of the rule.\n     * @returns A clone of the current binder to chain the building configuration.\n     */\n    configureRules(ruleName: RuleName, severity: Severity): BaseBinderBuilder;\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\n/**\n * The different mode that define when the 'when' predicate must be executed.\n * Note that there is no 'strictEnd' since the end of a binding execution is by default strict.\n * Note that there is no 'start' (just 'strictStart') since 'then' encompasses 'start'.\n * Strict modes cancel the binding execution, while non-strict modes just prevent the creation/execution of the\n * command at a given instant.\n * @category API Binding\n */\nexport type WhenType =\n/** The predicate will be executed at the end and will cancel the binding execution if not fulfilled. */\n  \"end\" |\n/** The predicate will be executed at start/then/end without cancelling the binding execution. */\n  \"nonStrict\" |\n/** The predicate will be executed at start/then/end and will cancel the binding execution if not fulfilled. */\n  \"strict\" |\n/** The predicate will be executed at start and will cancel the binding execution if not fulfilled. */\n  \"strictStart\" |\n/** The predicate will be executed at start and at each update and will cancel the binding execution if not fulfilled. */\n  \"strictThen\" |\n/** The predicate will be executed at start and at each update without cancelling the binding execution. */\n  \"then\";\n\n/**\n * States whether the WhenType concerns the beginning of a binding execution (at start).\n * Not that 'then' is included since 'then' is called at start. This includes both strict and non strict mode.\n * @param type -- The WhenType to test\n * @returns True: when executed at start\n * @category Helper\n */\nexport function isWhenAtStart(type: WhenType): boolean {\n    // 'then' is triggered at 'start' so used here\n    return type === \"strictStart\" || type === \"then\" || type === \"nonStrict\" || type === \"strict\";\n}\n\n/**\n * States whether the WhenType concerns the running of a binding execution.\n * This includes both strict and non strict mode.\n * @param type -- The WhenType to test\n * @returns True: when executed at then\n * @category Helper\n */\nexport function isWhenAtThen(type: WhenType): boolean {\n    return type === \"strictThen\" || type === \"then\" || type === \"nonStrict\" || type === \"strict\";\n}\n\n/**\n * States whether the WhenType concerns the end of a binding execution.\n * This includes both strict and non strict mode.\n * @param type -- The WhenType to test\n * @returns True: when executed at end\n * @category Helper\n */\nexport function isWhenAtEnd(type: WhenType): boolean {\n    return type === \"end\" || type === \"nonStrict\" || type === \"strict\";\n}\n\n/**\n * States whether the WhenType is a strict mode.\n * @param type -- The WhenType to test\n * @returns True: when is strict\n * @category Helper\n */\nexport function isWhenStrict(type: WhenType): boolean {\n    // 'end' is always strict\n    return type === \"end\" || type === \"strict\" || type === \"strictThen\" || type === \"strictStart\";\n}\n\n/**\n * The type of a when condition: it contains both the predicate and the mode (ie when the predicate must be checked).\n * @typeParam D -- The interaction data type\n * @category API Binding\n */\nexport interface When<D, A> {\n    /**\n     * The predicate.\n     * @param i -- The interaction data.\n     */\n    fn: (i: D, acc: Readonly<A>) => boolean;\n\n    /**\n     * The type of the when\n     */\n    type: WhenType;\n}\n\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General export function License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General export function License for more details.\n * You should have received a copy of the GNU General export function License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport type {Binding} from \"./Binding\";\nimport type {BindingsObserver} from \"./BindingsObserver\";\nimport type {VisitorBinding} from \"./VisitorBinding\";\nimport type {EltRef, Widget} from \"../binder/BaseBinderBuilder\";\nimport type {BaseUpdateBinder} from \"../binder/BaseUpdateBinder\";\nimport type {InteractionBinder} from \"../binder/InteractionBinder\";\nimport type {InteractionUpdateBinder} from \"../binder/InteractionUpdateBinder\";\nimport type {KeyInteractionBinder} from \"../binder/KeyInteractionBinder\";\nimport type {KeyInteractionUpdateBinder} from \"../binder/KeyInteractionUpdateBinder\";\nimport type {Command} from \"../command/Command\";\nimport type {FourTouchData} from \"../interaction/FourTouchData\";\nimport type {Interaction, InteractionsDataTypes} from \"../interaction/Interaction\";\nimport type {KeyData} from \"../interaction/KeyData\";\nimport type {KeysData} from \"../interaction/KeysData\";\nimport type {LineTouchData} from \"../interaction/LineTouchData\";\nimport type {MousePointsData} from \"../interaction/MousePointsData\";\nimport type {MultiTouchData} from \"../interaction/MultiTouchData\";\nimport type {PointData} from \"../interaction/PointData\";\nimport type {PointsData} from \"../interaction/PointsData\";\nimport type {RotationTouchData} from \"../interaction/RotationTouchData\";\nimport type {ScaleTouchData} from \"../interaction/ScaleTouchData\";\nimport type {ScrollData} from \"../interaction/ScrollData\";\nimport type {SrcTgtPointsData} from \"../interaction/SrcTgtPointsData\";\nimport type {TapsData} from \"../interaction/TapsData\";\nimport type {ThenData} from \"../interaction/ThenData\";\nimport type {ThreeTouchData} from \"../interaction/ThreeTouchData\";\nimport type {TouchData} from \"../interaction/TouchData\";\nimport type {GeneralTwoTouchData, TwoTouchData} from \"../interaction/TwoTouchData\";\nimport type {WheelData} from \"../interaction/WheelData\";\nimport type {WidgetData} from \"../interaction/WidgetData\";\nimport type {Logger} from \"../logging/Logger\";\nimport type {UndoHistoryBase} from \"../undo/UndoHistoryBase\";\n\n/**\n * Defines a partly defined binder for buttons\n * @category API Binding\n */\nexport type PartialButtonTypedBinder<A = unknown> = InteractionBinder<Interaction<WidgetData<HTMLButtonElement>>, A>;\n/**\n * Defines a partly defined binder for inputs\n * @category API Binding\n */\nexport type PartialInputTypedBinder<A = unknown> = InteractionBinder<Interaction<WidgetData<HTMLInputElement>>, A>;\n/**\n * Defines a partly defined binder for selects\n * @category API Binding\n */\nexport type PartialSelectTypedBinder<A = unknown> = InteractionBinder<Interaction<WidgetData<HTMLSelectElement>>, A>;\n/**\n * Defines a partly defined binder for spinners\n * @category API Binding\n */\nexport type PartialSpinnerTypedBinder<A = unknown> = InteractionUpdateBinder<Interaction<WidgetData<HTMLInputElement>>, A>;\n/**\n * Defines a partly defined binder for anchors\n * @category API Binding\n */\nexport type PartialAnchorTypedBinder<A = unknown> = InteractionBinder<Interaction<WidgetData<HTMLAnchorElement>>, A>;\n/**\n * Defines a partly defined binder for text inputs\n * @category API Binding\n */\nexport type PartialTextInputTypedBinder<A = unknown> = InteractionUpdateBinder<Interaction<WidgetData<HTMLInputElement | HTMLTextAreaElement>>, A>;\n/**\n * Defines a partly defined binder for touch rotations\n * @category API Binding\n */\nexport type PartialRotateTypedBinder<A = unknown> = InteractionUpdateBinder<Interaction<RotationTouchData>, A>;\n/**\n * Defines a partly defined binder for touch scalings\n * @category API Binding\n */\nexport type PartialScaleTypedBinder<A = unknown> = InteractionUpdateBinder<Interaction<ScaleTouchData>, A>;\n/**\n * Defines a partly defined binder for two-touch pans\n * @category API Binding\n */\nexport type PartialTwoPanTypedBinder<A = unknown> = InteractionUpdateBinder<Interaction<LineTouchData & TwoTouchData>, A>;\n/**\n * Defines a partly defined binder for two touch interactions\n * @category API Binding\n */\nexport type PartialTwoTouchTypedBinder<A = unknown> = InteractionUpdateBinder<Interaction<GeneralTwoTouchData>, A>;\n/**\n * Defines a partly defined binder for three touch interactions\n * @category API Binding\n */\nexport type PartialThreeTouchTypedBinder<A = unknown> = InteractionUpdateBinder<Interaction<ThreeTouchData>, A>;\n/**\n * Defines a partly defined binder for four touch interactions\n * @category API Binding\n */\nexport type PartialFourTouchTypedBinder<A = unknown> = InteractionUpdateBinder<Interaction<FourTouchData>, A>;\n/**\n * Defines a partly defined binder for DnD touch interactions\n * @category API Binding\n */\nexport type PartialTouchSrcTgtTypedBinder<A = unknown> = InteractionUpdateBinder<Interaction<SrcTgtPointsData<TouchData>>, A>;\n/**\n * Defines a partly defined binder for multi-touch interactions\n * @category API Binding\n */\nexport type PartialMultiTouchTypedBinder<A = unknown> = InteractionUpdateBinder<Interaction<MultiTouchData>, A>;\n/**\n * Defines a partly defined binder for taps\n * @category API Binding\n */\nexport type PartialTapsTypedBinder<A = unknown> = InteractionUpdateBinder<Interaction<TapsData>, A>;\n/**\n * Defines a partly defined binder for tap\n * @category API Binding\n */\nexport type PartialTapTypedBinder<A = unknown> = InteractionUpdateBinder<Interaction<TouchData>, A>;\n/**\n * Defines a partly defined binder for touch types\n * @category API Binding\n */\nexport type PartialTouchTypedBinder<A = unknown> = InteractionUpdateBinder<Interaction<TouchData>, A>;\n/**\n * Defines a partly defined binder for one point interactions\n * @category API Binding\n */\nexport type PartialPointTypedBinder<A = unknown> = InteractionBinder<Interaction<PointData>, A>;\n/**\n * Defines a partly defined binder for wheel interactions\n * @category API Binding\n */\nexport type PartialWheelTypedBinder<A = unknown> = InteractionBinder<Interaction<WheelData>, A>;\n/**\n * Defines a partly defined binder for scroll interactions\n * @category API Binding\n */\nexport type PartialScrollTypedBinder<A = unknown> = InteractionBinder<Interaction<ScrollData>, A>;\n/**\n * Defines a partly defined binder for one point interactions that updates in time\n * @category API Binding\n */\nexport type PartialUpdatePointTypedBinder<A = unknown> = InteractionUpdateBinder<Interaction<PointData>, A>;\n/**\n * Defines a partly defined binder for multi-point interactions\n * @category API Binding\n */\nexport type PartialPointsTypedBinder<A = unknown> = InteractionUpdateBinder<Interaction<MousePointsData>, A>;\n/**\n * Defines a partly defined binder for DnD-like interactions\n * @category API Binding\n */\nexport type PartialPointSrcTgtTypedBinder<A = unknown> = InteractionUpdateBinder<Interaction<SrcTgtPointsData<PointData>>, A>;\n/**\n * Defines a partly defined binder for key interactions\n * @category API Binding\n */\nexport type PartialKeyTypedBinder<A = unknown> = KeyInteractionBinder<Interaction<KeyData>, A>;\n/**\n * Defines a partly defined binder for keys interactions\n * @category API Binding\n */\nexport type PartialKeysTypedBinder<A = unknown> = KeyInteractionUpdateBinder<Interaction<KeysData>, A>;\n/**\n * Defines a partly defined binder for mouse or touch interactions\n * @category API Binding\n */\nexport type PartialPointOrTouchTypedBinder<A = unknown> = InteractionBinder<Interaction<PointData | TouchData>, A>;\n/**\n * Defines a partly defined binder for mouse or touch tap interactions\n * @category API Binding\n */\nexport type PartialPointsOrTapsTypedBinder<A = unknown> = InteractionUpdateBinder<Interaction<MousePointsData | PointsData<TouchData>>, A>;\n/**\n * Defines a partly defined binder for mouse or touch DnD interactions\n * @category API Binding\n */\nexport type PartialTouchMouseDnDTypedBinder<A = unknown> = InteractionUpdateBinder<Interaction<SrcTgtPointsData<PointData | TouchData>>, A>;\n/**\n * Defines a partly defined binder for sequence of user interactions.\n * @category API Binding\n */\nexport type PartialThenBinder<XS extends Array<Interaction<object>>, A = unknown> =\n    InteractionUpdateBinder<Interaction<ThenData<InteractionsDataTypes<XS>>>, A, ThenData<InteractionsDataTypes<XS>>>;\n\n/**\n * A contextual object for creating binders and thus bindings.\n * allows the observation of the created bindings.\n * Provides an undo/redo history.\n * Why a pure abstract class and not an interface?\n * Because interfaces are not retained at runtime in TS and we want DI (that thus cannot inject interface types).\n * @typeParam H -- The undo history algorithm\n * @category API Binding\n */\nexport abstract class Bindings<H extends UndoHistoryBase> {\n    /**\n     * The undo/redo history of the current binding context\n     */\n    public abstract readonly undoHistory: H;\n\n    public abstract readonly logger: Logger;\n\n    public abstract nodeBinder<A>(accInit?: A): BaseUpdateBinder;\n\n    /**\n     * Creates binding builder to build a binding between a button interaction and the given command type.\n     * Do not forget to call bind() at the end of the build to execute the builder.\n     * @returns The binding builder.\n     */\n    public abstract buttonBinder<A>(accInit?: A): PartialButtonTypedBinder<A>;\n\n    public abstract checkboxBinder<A>(accInit?: A): PartialInputTypedBinder<A>;\n\n    public abstract colorPickerBinder<A>(accInit?: A): PartialInputTypedBinder<A>;\n\n    public abstract comboBoxBinder<A>(accInit?: A): PartialSelectTypedBinder<A>;\n\n    public abstract spinnerBinder<A>(accInit?: A): PartialSpinnerTypedBinder<A>;\n\n    public abstract dateBinder<A>(accInit?: A): PartialInputTypedBinder<A>;\n\n    public abstract hyperlinkBinder<A>(accInit?: A): PartialAnchorTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses a text interaction. This binder takes as argument a timeout value:\n     * using this text writing interaction, a user can write a sequence of letters and then stops for\n     * more than x milliseconds (x is the value of timeout). After this delay the binding executes the command.\n     * This is a mainstream optimisation that many text processing tools implement to limit the number of editing actions.\n     * @param timeout - The timeout in milliseconds after which the interaction stops and the command produced.\n     */\n    public abstract textInputBinder<A>(timeout?: number, accInit?: A): PartialTextInputTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the touch DnD interaction (a DnD interaction that uses one touch).\n     * This interaction works as a Drag-and-Drop interaction.\n     */\n    public abstract touchDnDBinder<A>(cancellable: boolean, accInit?: A): PartialTouchSrcTgtTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the Reciprocal DnD interaction with a touch.\n     * A spring handle can be pressed on a long click to return the element back to its previous position.\n     * @param handle - The selectable part of the spring widget.\n     * @param spring - The line between the handle and the previous position of the element.\n     */\n    public abstract reciprocalTouchDnDBinder<A>(handle: EltRef<SVGCircleElement>, spring: EltRef<SVGLineElement>, accInit?: A):\n    PartialTouchSrcTgtTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the multi-touch user interaction.\n     * @param nbTouches - The number of required touches.\n     * A multi-touch starts when all its touches have started.\n     * A multi-touch ends when the number of required touches is greater than the number of touches.\n     */\n    public abstract multiTouchBinder<A>(nbTouches: number, accInit?: A): PartialMultiTouchTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses two (DnD) touches.\n     */\n    public abstract twoTouchBinder<A>(accInit?: A): PartialTwoTouchTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses three (DnD) touches.\n     */\n    public abstract threeTouchBinder<A>(accInit?: A): PartialThreeTouchTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses four (DnD) touches.\n     */\n    public abstract fourTouchBinder<A>(accInit?: A): PartialFourTouchTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the taps user interaction.\n     * @param tapsCount - The number of required taps.\n     * If this number is not reached after a timeout, the interaction is cancelled.\n     */\n    public abstract tapsBinder<A>(tapsCount: number, accInit?: A): PartialTapsTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the tap user interaction (single tap).\n     */\n    public abstract tapBinder<A>(accInit?: A): PartialTapTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the MouseDown (mouse button pressed) interaction.\n     */\n    public abstract touchStartBinder<A>(accInit?: A): PartialTouchTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the long touch interaction.\n     * @param duration - The duration of the touch to end the user interaction.\n     * If this duration is not reached, the interaction is cancelled.\n     */\n    public abstract longTouchBinder<A>(duration: number, accInit?: A): PartialTouchTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the pan interaction (in all direction, one touch).\n     * The involved user interaction is TouchDnD.\n     * @param cancellable - Whether the DnD can be cancelled by interacting with a dwell-and-spring element.\n     */\n    public abstract panBinder<A>(cancellable: boolean, accInit?: A): PartialTouchSrcTgtTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses a vertical pan (or swipe if minVelocity is used) interaction (one-touch).\n     * @param minLength - The minimal distance from the starting point to the release point for validating the pan\n     * @param minVelocity - The pan while be a swipe: the minimal minVelocity to reach for validating the swipe. In pixels per second.\n     * @param pxTolerance - The tolerance rate in pixels accepted while executing the pan\n     * @param cancellable - Whether the DnD can be cancelled by interacting with a dwell-and-spring element.\n     */\n    public abstract panVerticalBinder<A>(pxTolerance: number, cancellable: boolean, minLength?: number, minVelocity?: number, accInit?: A):\n    PartialTouchSrcTgtTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses a vertical pan interaction (or swipe if minVelocity is used) interaction (one-touch).\n     * @param minLength - The minimal distance from the starting point to the release point for validating the pan\n     * @param minVelocity - The pan while be a swipe: the minimal minVelocity to reach for validating the swipe. In pixels per second.\n     * @param pxTolerance - The tolerance rate in pixels accepted while executing the pan\n     * @param cancellable - Whether the DnD can be cancelled by interacting with a dwell-and-spring element.\n     */\n    public abstract panHorizontalBinder<A>(pxTolerance: number, cancellable: boolean, minLength?: number, minVelocity?: number, accInit?: A):\n    PartialTouchSrcTgtTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses a left pan interaction (or swipe if minVelocity is used) interaction (one-touch).\n     * @param minLength - The minimal distance from the starting point to the release point for validating the pan\n     * @param minVelocity - The pan while be a swipe: the minimal minVelocity to reach for validating the swipe. In pixels per second.\n     * @param pxTolerance - The tolerance rate in pixels accepted while executing the pan\n     * @param cancellable - Whether the DnD can be cancelled by interacting with a dwell-and-spring element.\n     */\n    public abstract panLeftBinder<A>(pxTolerance: number, cancellable: boolean, minLength?: number, minVelocity?: number, accInit?: A):\n    PartialTouchSrcTgtTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses a right pan interaction (or swipe if minVelocity is used) interaction (one-touch).\n     * @param minLength - The minimal distance from the starting point to the release point for validating the pan\n     * @param minVelocity - The pan while be a swipe: the minimal minVelocity to reach for validating the swipe. In pixels per second.\n     * @param pxTolerance - The tolerance rate in pixels accepted while executing the pan\n     * @param cancellable - Whether the DnD can be cancelled by interacting with a dwell-and-spring element.\n     */\n    public abstract panRightBinder<A>(pxTolerance: number, cancellable: boolean, minLength?: number, minVelocity?: number, accInit?: A):\n    PartialTouchSrcTgtTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses a top pan interaction (or swipe if minVelocity is used) interaction (one-touch).\n     * @param minLength - The minimal distance from the starting point to the release point for validating the pan\n     * @param minVelocity - The pan while be a swipe: the minimal minVelocity to reach for validating the swipe. In pixels per second.\n     * @param pxTolerance - The tolerance rate in pixels accepted while executing the pan\n     * @param cancellable - Whether the DnD can be cancelled by interacting with a dwell-and-spring element.\n     */\n    public abstract panTopBinder<A>(pxTolerance: number, cancellable: boolean, minLength?: number, minVelocity?: number, accInit?: A):\n    PartialTouchSrcTgtTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses a bottom pan interaction (or swipe if minVelocity is used) interaction (one-touch).\n     * @param minLength - The minimal distance from the starting point to the release point for validating the pan\n     * @param minVelocity - The pan while be a swipe: the minimal minVelocity to reach for validating the swipe. In pixels per second.\n     * @param pxTolerance - The tolerance rate in pixels accepted while executing the pan\n     * @param cancellable - Whether the DnD can be cancelled by interacting with a dwell-and-spring element.\n     */\n    public abstract panBottomBinder<A>(pxTolerance: number, cancellable: boolean, minLength?: number, minVelocity?: number, accInit?: A):\n    PartialTouchSrcTgtTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses a vertical pan interaction (two-touch).\n     * @param minLength - The minimal distance from the starting point to the release point for validating the pan\n     * @param minVelocity - The pan while be a swipe: the minimal minVelocity to reach for validating the swipe. In pixels per second.\n     * @param pxTolerance - The tolerance rate in pixels accepted while executing the pan\n     */\n    public abstract twoPanVerticalBinder<A>(pxTolerance: number, minLength?: number, minVelocity?: number, accInit?: A):\n    PartialTwoPanTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses a vertical pan interaction (two-touch).\n     * @param minLength - The minimal distance from the starting point to the release point for validating the pan\n     * @param minVelocity - The pan while be a swipe: the minimal minVelocity to reach for validating the swipe. In pixels per second.\n     * @param pxTolerance - The tolerance rate in pixels accepted while executing the pan\n     */\n    public abstract twoPanHorizontalBinder<A>(pxTolerance: number, minLength?: number, minVelocity?: number, accInit?: A):\n    PartialTwoPanTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses a left pan interaction (two-touch).\n     * @param minLength - The minimal distance from the starting point to the release point for validating the pan\n     * @param minVelocity - The pan while be a swipe: the minimal minVelocity to reach for validating the swipe. In pixels per second.\n     * @param pxTolerance - The tolerance rate in pixels accepted while executing the pan\n     */\n    public abstract twoPanLeftBinder<A>(pxTolerance: number, minLength?: number, minVelocity?: number, accInit?: A):\n    PartialTwoPanTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses a right pan interaction (two-touch).\n     * @param minLength - The minimal distance from the starting point to the release point for validating the pan\n     * @param minVelocity - The pan while be a swipe: the minimal minVelocity to reach for validating the swipe. In pixels per second.\n     * @param pxTolerance - The tolerance rate in pixels accepted while executing the pan\n     */\n    public abstract twoPanRightBinder<A>(pxTolerance: number, minLength?: number, minVelocity?: number, accInit?: A):\n    PartialTwoPanTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses a top pan interaction (two-touch).\n     * @param minLength - The minimal distance from the starting point to the release point for validating the pan\n     * @param minVelocity - The pan while be a swipe: the minimal minVelocity to reach for validating the swipe. In pixels per second.\n     * @param pxTolerance - The tolerance rate in pixels accepted while executing the pan\n     */\n    public abstract twoPanTopBinder<A>(pxTolerance: number, minLength?: number, minVelocity?: number, accInit?: A):\n    PartialTwoPanTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses a bottom pan interaction (two-touch).\n     * @param minLength - The minimal distance from the starting point to the release point for validating the pan\n     * @param minVelocity - The pan while be a swipe: the minimal minVelocity to reach for validating the swipe. In pixels per second.\n     * @param pxTolerance - The tolerance rate in pixels accepted while executing the pan\n     */\n    public abstract twoPanBottomBinder<A>(pxTolerance: number, minLength?: number, minVelocity?: number, accInit?: A):\n    PartialTwoPanTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the rotate interaction (two-touch interaction, with the first point\n     * that must remain static).\n     * @param pxTolerance - The tolerance rate in pixels accepted while executing the rotation (i.e.\n     * the acceptance rate when moving the fixation/first point).\n     */\n    public abstract rotateBinder<A>(pxTolerance: number, accInit?: A): PartialRotateTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the scale/pinch touch interaction.\n     * @param pxTolerance - The tolerance rate in pixels accepted while executing the scale/pinch gesture\n     */\n    public abstract scaleBinder<A>(pxTolerance: number, accInit?: A): PartialScaleTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the click interaction.\n     */\n    public abstract clickBinder<A>(accInit?: A): PartialPointTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the Wheel (user uses a mouse scrolling wheel) interaction.\n     */\n    public abstract wheelBinder<A>(accInit?: A): PartialWheelTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the double click interaction.\n     */\n    public abstract dbleClickBinder<A>(accInit?: A): PartialUpdatePointTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the MouseDown (mouse button pressed) interaction.\n     */\n    public abstract mouseDownBinder<A>(accInit?: A): PartialPointTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the MouseUp (mouse button released) interaction.\n     */\n    public abstract mouseUpBinder<A>(accInit?: A): PartialPointTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the LongMouseDown\n     * (mouse button pressed for a certain amount of time) interaction.\n     * @param duration - The duration of the pressure to end the user interaction.\n     * If this duration is not reached, the interaction is cancelled.\n     */\n    public abstract longMouseDownBinder<A>(duration: number, accInit?: A): PartialUpdatePointTypedBinder<A>;\n\n    /**\n     * Creates a binding for clicking n times.\n     * @param nbClicks - The number of clicks to do.\n     * If this number is not reached, the interaction is cancelled after a timeout of 1s.\n     */\n    public abstract clicksBinder<A>(nbClicks: number, accInit?: A): PartialPointsTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the MouseEnter (mouse cursor enters the element) interaction.\n     * @param withBubbling - True: event bubbling is enabled and events on child elements will be registered\n     */\n    public abstract mouseEnterBinder<A>(withBubbling: boolean, accInit?: A): PartialPointTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the MouseLeave (mouse cursor leaves the element) interaction.\n     * @param withBubbling - True: event bubbling is enabled and events on child elements will be registered\n     */\n    public abstract mouseLeaveBinder<A>(withBubbling: boolean, accInit?: A): PartialPointTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the MouseMove (mouse cursor moves) interaction.\n     */\n    public abstract mouseMoveBinder<A>(accInit?: A): PartialPointTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the mouse scroll interaction.\n     */\n    public abstract scrollBinder<A>(accInit?: A): PartialScrollTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the DnD interaction.\n     * @param cancellable - True: the escape key will cancels the DnD.\n     */\n    public abstract dndBinder<A>(cancellable: boolean, accInit?: A): PartialPointSrcTgtTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the Reciprocal DnD interaction.\n     * A spring handle can be pressed on a long click to return the element back to its previous position.\n     * @param handle - The selectable part of the spring widget.\n     * @param spring - The line between the handle and the previous position of the element.\n     */\n    public abstract reciprocalDndBinder<A>(handle: EltRef<SVGCircleElement>, spring: EltRef<SVGLineElement>, accInit?: A):\n    PartialPointSrcTgtTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the drag lock interaction.\n     */\n    public abstract dragLockBinder<A>(accInit?: A): PartialPointSrcTgtTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the KeyDown (key pressed) interaction.\n     * @param modifierAccepted - True: the interaction will consider key modifiers.\n     */\n    public abstract keyDownBinder<A>(modifierAccepted: boolean, accInit?: A): PartialKeyTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the KeysDown (multiple keys pressed) interaction.\n     */\n    public abstract keysDownBinder<A>(accInit?: A): PartialKeysTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the KeyUp (key released) interaction.\n     * @param modifierAccepted - True: the interaction will consider key modifiers.\n     */\n    public abstract keyUpBinder<A>(modifierAccepted: boolean, accInit?: A): PartialKeyTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the KeysType (multiple keys pressed then released) interaction.\n     */\n    public abstract keysTypeBinder<A>(accInit?: A): PartialKeysTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses the KeyTyped (key pressed then released) interaction.\n     */\n    public abstract keyTypeBinder<A>(accInit?: A): PartialKeyTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses either a mouse down or a touch start interaction.\n     */\n    public abstract mouseDownOrTouchStartBinder<A>(accInit?: A): PartialPointOrTouchTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses either a taps or a clicks interaction.\n     */\n    public abstract tapsOrClicksBinder<A>(nbTap: number, accInit?: A): PartialPointsOrTapsTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses either a tap or a click interaction.\n     */\n    public abstract tapOrClickBinder<A>(accInit?: A): PartialPointOrTouchTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses either a longpress or a longtouch interaction.\n     */\n    public abstract longpressOrTouchBinder<A>(duration: number, accInit?: A): PartialPointOrTouchTypedBinder<A>;\n\n    /**\n     * Creates a binding that uses either a longpress or a longtouch interaction.\n     */\n    public abstract reciprocalMouseOrTouchDnD<A>(handle: EltRef<SVGCircleElement>, spring: EltRef<SVGLineElement>,\n        accInit?: A): PartialTouchMouseDnDTypedBinder<A>;\n\n    /**\n     * Creates two bindings for undo and redo operations with buttons.\n     * @param undo - The undo button\n     * @param redo - The redo button\n     * @param catchFn - The function that will treat the errors for both undo and redo bindings\n     */\n    public abstract undoRedoBinder(undo: Widget<HTMLButtonElement>, redo: Widget<HTMLButtonElement>, catchFn?: ((err: unknown) => void)):\n    [Binding<Command, Interaction<WidgetData<HTMLButtonElement>>, unknown>,\n        Binding<Command, Interaction<WidgetData<HTMLButtonElement>>, unknown>];\n\n    /**\n     * Create a binding that uses an ordered sequence of user interactions\n     * @param interactions - The sequence of user interaction\n     */\n    public abstract combine<XS extends Array<Interaction<object>>, A>(interactions: XS, accInit?: A):\n    PartialThenBinder<XS, A>;\n\n    /**\n     * Clears all the data of this binding context:\n     * the possible current `BindingsObserver` object;\n     * the undo/redo history.\n     */\n    public abstract clear(): void;\n\n    /**\n     * Sets the current `BindingsObserver` object. Cleans the potential former global `BindingsObserver` object.\n     * @param obs - The new `BindingsObserver` object to consider. Can be undefined.\n     */\n    public abstract setBindingObserver(obs?: BindingsObserver): void;\n\n    /**\n     * Visiting the binding.\n     * @param visitor - The visitor.\n     */\n    public abstract acceptVisitor(visitor: VisitorBinding): void;\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\n/**\n * @category Helper\n */\nexport const mouseEventTypes = [\n    \"mousedown\",\n    \"mouseup\",\n    \"mousemove\",\n    \"mouseover\",\n    \"mouseout\",\n    \"mouseenter\",\n    \"mouseleave\",\n    \"click\",\n    \"auxclick\"\n] as const;\n\n/**\n * @category Helper\n */\nexport const touchEventTypes = [\n    \"touchstart\",\n    \"touchend\",\n    \"touchmove\"\n] as const;\n\n/**\n * @category Helper\n */\nexport const keyEventTypes = [\n    \"keydown\",\n    \"keyup\"\n] as const;\n\n/**\n * The supported event types.\n * @category Helper\n */\nexport const eventTypes = [\n    ...mouseEventTypes,\n    ...touchEventTypes,\n    ...keyEventTypes,\n    \"input\",\n    \"scroll\",\n    \"change\",\n    \"wheel\"\n] as const;\n\n/**\n * The supported event types as a type\n * @category Helper\n */\nexport type EventType = typeof eventTypes[number];\n\n/**\n * The mouse event type\n * @category Helper\n */\nexport type MouseEventType = typeof mouseEventTypes[number];\n\n/**\n * The touch event type\n * @category Helper\n */\nexport type TouchEventType = typeof touchEventTypes[number];\n\n/**\n * The key event type\n * @category Helper\n */\nexport type KeyEventType = typeof keyEventTypes[number];\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport type {State} from \"./State\";\nimport type {Transition} from \"./Transition\";\n\n/**\n * Defines a type of state that can produce as output events.\n * @typeParam E - The type of events the FSM processes.\n * @category API FSM\n */\nexport interface OutputState extends State {\n    /**\n     * The list of outgoing transitions of the state.\n     */\n    readonly transitions: ReadonlyArray<Transition<Event>>;\n\n    /**\n     * Actions done when a transition of the state is executed so\n     * that this state is left.\n     * @throws CancelFSMException If leaving the state leads to a cancelling of the FSM execution.\n     */\n    exit(): void;\n\n    /**\n     * Asks to the state to process of the given event.\n     * @param event - The event to process. Can be null.\n     */\n    process(event: Event): boolean;\n\n    /**\n     * Adds the given transitions to the list of outgoing transitions of the state.\n     * @param tr - The transition to add.\n     */\n    addTransition(tr: Transition<Event>): void;\n}\n\n/**\n * Tests whether the given object is an OutputState.\n * @param obj - The object to test.\n * @returns True: the object is an OutputState\n * @category Helper\n */\nexport function isOutputStateType(obj: State | undefined): obj is OutputState {\n    if (obj === undefined) {\n        return false;\n    }\n\n    return \"exit\" in obj && \"addTransition\" in obj && \"process\" in obj && \"transitions\" in obj;\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport type {Undoable, UndoableSnapshot} from \"./Undoable\";\nimport type {UndoHistoryBase} from \"./UndoHistoryBase\";\nimport type {Observable} from \"rxjs\";\n\n/**\n * The interface for nodes in a tree-based history.\n * @category API History\n */\nexport interface UndoableTreeNode {\n    /**\n     * Among the children of the node, iidentifies the one that was undone recently.\n     */\n    lastChildUndone: UndoableTreeNode | undefined;\n\n    /**\n     * The unique ID of the node among the tree.\n     */\n    readonly id: number;\n\n    /**\n     * The undoable object contained in the node.\n     */\n    readonly undoable: Undoable;\n\n    /**\n     * The possible parent node.\n     */\n    readonly parent: UndoableTreeNode | undefined;\n\n    /**\n     * The children of the node.\n     */\n    readonly children: Array<UndoableTreeNode>;\n\n    /**\n     * The visual snapshot of the node. Used to render the tree history.\n     */\n    readonly visualSnapshot: UndoableSnapshot;\n\n    /**\n     * Undoes the undoable object of this node.\n     */\n    undo(): void;\n\n    /**\n     * Redoes the undoable object of this node.\n     */\n    redo(): void;\n}\n\n/**\n * The DTO interface used when exporting a tree-based history.\n * @category Helper\n */\nexport interface UndoableTreeNodeDTO {\n    /**\n     * The unique ID of the node among the tree.\n     */\n    readonly id: number;\n\n    /**\n     * The undoable object contained in the node, in an unkown format as\n     * the format is defined by the developer while exporting the history.\n     */\n    readonly undoable: unknown;\n\n    /**\n     * The children of the node, in their DTO format.\n     */\n    readonly children: ReadonlyArray<UndoableTreeNodeDTO>;\n}\n\n/**\n * The DTO for tree nodes used while exporting a tree-based history.\n * @category Helper\n */\nexport interface TreeUndoHistoryDTO {\n    /**\n     * The current history path in the tree\n     */\n    readonly path: ReadonlyArray<number>;\n\n    /**\n     * The different roots of the tree.\n     */\n    readonly roots: ReadonlyArray<UndoableTreeNodeDTO>;\n}\n\n/**\n * Tree-based undo history.\n * On adding undoables after an undo operation, the redoable objects are no more flush but\n * kept in the history as a granch of the graph.\n * Useful for exploration.\n * @category API History\n */\nexport abstract class TreeUndoHistory implements UndoHistoryBase {\n    /**\n     * States whether the path of kept. If kept, users cannot delete\n     * nodes.\n     */\n    public abstract get keepPath(): boolean;\n\n    /**\n     * Returns the ordered sequence of undoable's ID that the user performed.\n     * This permits to keep traces of what the users did and how they arrived\n     * to the final state.\n     */\n    public abstract get path(): ReadonlyArray<number>;\n\n    /**\n     * The root node of the history. It is a fake node (it does not refer\n     * to any undoable object).\n     */\n    public abstract get root(): UndoableTreeNode;\n\n    /**\n     * All the nodes of the tree.\n     */\n    public abstract get undoableNodes(): Array<UndoableTreeNode | undefined>;\n\n    /**\n     * The current node. As the history is a tree in which one can navigate using\n     * undo, redo, gotTo, this current node refers to the node\n     * where the system state is.\n     */\n    public abstract get currentNode(): UndoableTreeNode;\n\n    /**\n     * Moves to the given node ID.\n     * @param id - The node ID contained in the tree. Moves to it if correct.\n     */\n    public abstract goTo(id: number): void;\n\n    /**\n     * Deletes the targeted node. Works only if the history does not keep the\n     * usage path (see path()).\n     * @param id - The node ID to remove. It removes all the branch from this node.\n     * Does not remove the branch if the current node is in it.\n     */\n    public abstract delete(id: number): void;\n\n    /**\n     * Computes the position (in the large) of each node.\n     * Useful for layouting.\n     */\n    public abstract getPositions(): Map<number, number>;\n\n    public abstract add(undoable: Undoable): void;\n\n    public abstract clear(): void;\n\n    public abstract getLastOrEmptyRedoMessage(): string;\n\n    public abstract getLastOrEmptyUndoMessage(): string;\n\n    public abstract getLastRedo(): Undoable | undefined;\n\n    public abstract getLastRedoMessage(): string | undefined;\n\n    public abstract getLastUndo(): Undoable | undefined;\n\n    public abstract getLastUndoMessage(): string | undefined;\n\n    public abstract redo(): void;\n\n    public abstract redosObservable(): Observable<Undoable | undefined>;\n\n    public abstract undo(): void;\n\n    public abstract undosObservable(): Observable<Undoable | undefined>;\n\n    /**\n     * Exports the history.\n     * @param fn - The function that converts undoable objects into ad-hoc formats.\n     */\n    public abstract export(fn: (undoable: Undoable) => unknown): TreeUndoHistoryDTO;\n\n    /**\n     * Imports the given DTO history. Flushes the current history.\n     * @param dtoHistory - The DTO history to import.\n     * @param fn - The convertion fonction that transforms undoable DTO (of nodes) into Undoable.\n     */\n    public abstract import(dtoHistory: TreeUndoHistoryDTO, fn: (dtoUndoable: unknown) => Undoable): void;\n\n    public abstract get considersEqualCmds(): boolean;\n\n    /**\n     * The number of elements the history contains in all the branches\n     */\n    public abstract size(): number;\n\n    /**\n     * An RX object to observe the number of elements in the history.\n     */\n    public abstract sizeObservable(): Observable<number>;\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport type {Undoable} from \"./Undoable\";\nimport type {UndoHistoryBase} from \"./UndoHistoryBase\";\nimport type {Observable} from \"rxjs\";\n\n/**\n * A history of undone/redone objects.\n * Why a pure abstract class and not an interface?\n * Because interfaces are not retained at runtime in TS and we want DI (that thus cannot inject interface types).\n * @category API History\n */\nexport abstract class UndoHistory implements UndoHistoryBase {\n    public abstract add(undoable: Undoable): void;\n\n    public abstract clear(): void;\n\n    public abstract undo(): void;\n\n    public abstract redo(): void;\n\n    /**\n     * @returns The stack of saved undoable objects.\n     */\n    public abstract getUndo(): ReadonlyArray<Undoable>;\n\n    /**\n     * @returns The stack of saved redoable objects\n     */\n    public abstract getRedo(): ReadonlyArray<Undoable>;\n\n    public abstract undosObservable(): Observable<Undoable | undefined>;\n\n    public abstract redosObservable(): Observable<Undoable | undefined>;\n\n    public abstract getLastUndo(): Undoable | undefined;\n\n    public abstract getLastRedo(): Undoable | undefined;\n\n    public abstract getLastUndoMessage(): string | undefined;\n\n    public abstract getLastRedoMessage(): string | undefined;\n\n    public abstract getLastOrEmptyUndoMessage(): string;\n\n    public abstract getLastOrEmptyRedoMessage(): string;\n\n    /**\n     * @returns The max number of saved undoable objects.\n     */\n    public abstract getSizeMax(): number;\n\n    /**\n     * @param max - The max number of saved undoable objects. Must be great than 0.\n     */\n    public abstract setSizeMax(max: number): void;\n\n    public abstract get considersEqualCmds(): boolean;\n\n    /**\n     * The number of elements the history contains.\n     * Provide both the size of the undo and the redo stacks in the produced tuple.\n     */\n    public abstract size(): [undos: number, redos: number];\n\n    /**\n     * An RX object to observe the number of elements in the history.\n     */\n    public abstract sizeObservable(): Observable<[undos: number, redos: number]>;\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\n/**\n * The basic accepted types for producing snapshots of undoable commands\n * @category API History\n */\nexport type PrimitiveUndoableSnapshot = HTMLElement | SVGElement | string;\n\n/**\n * The type of the visual snpashot that an undoable command can produce\n * @category API History\n */\nexport type UndoableSnapshot = PrimitiveUndoableSnapshot | Promise<PrimitiveUndoableSnapshot> | undefined;\n\n/**\n * An interface for undoable objects.\n * @category API History\n */\nexport interface Undoable {\n    /**\n     * Cancels the command.\n     */\n    undo(): void;\n\n    /**\n     * Redoes the cancelled command.\n     */\n    redo(): void;\n\n    /**\n     * @returns The name of the undo command.\n     */\n    getUndoName(): string;\n\n    /**\n     * Gives some information about the impact of a command.\n     * @returns Information about the impact of the commmand as an SVG element or text.\n     */\n    getVisualSnapshot(): UndoableSnapshot;\n\n    /**\n     * States whether the two commands are equals.\n     * By default, if `cmd` is the same object that `this`,\n     * the method returns true. Developers can override this\n     * method to defined their own implementation to be used,\n     * for example, in a command history to merge equivalent commands.\n     * @param undoable - The command to compare with 'this'.\n     */\n    equals(undoable: Undoable): boolean;\n}\n\n/**\n * Tests whether the given object is an Undoable.\n * @param obj - The object to test.\n * @returns True: the object is an Undoable\n * @category Helper\n */\nexport function isUndoableType(obj: unknown): obj is Undoable {\n    if (typeof obj !== \"object\" || obj === null) {\n        return false;\n    }\n\n    return \"undo\" in obj && \"redo\" in obj && \"getUndoName\" in obj;\n}\n\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General export function License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General export function License for more details.\n * You should have received a copy of the GNU General export function License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport type {EltRef} from \"../../api/binder/BaseBinderBuilder\";\nimport type {PointData} from \"../../api/interaction/PointData\";\nimport type {SrcTgtPointsData} from \"../../api/interaction/SrcTgtPointsData\";\nimport type {TouchData} from \"../../api/interaction/TouchData\";\n\n/**\n * Controls the dwell and spring animation.\n * See the reciprocal DnD binders.\n * @category Helper\n */\nexport class DwellSpringAnimation {\n    private displaySpring = false;\n\n    private interval: number | undefined;\n\n    private positionSpring: {\"x\": number; \"y\": number};\n\n    private readonly radius: number;\n\n    private readonly handle: EltRef<SVGCircleElement>;\n\n    private readonly spring: EltRef<SVGLineElement>;\n\n    public constructor(handle: Readonly<EltRef<SVGCircleElement>>, spring: Readonly<EltRef<SVGLineElement>>) {\n        this.interval = undefined;\n        this.radius = Number.parseInt(handle.nativeElement.getAttribute(\"r\") ?? \"20\", 10);\n        this.handle = handle;\n        this.spring = spring;\n        this.positionSpring = {\n            \"x\": 0,\n            \"y\": 0\n        };\n    }\n\n    public process(i: SrcTgtPointsData<PointData | TouchData>): void {\n        /*\n         * Management of the dwell and spring\n         * The element to use for this interaction (handle) must have the \"ioDwellSpring\" class\n         */\n        if (this.displaySpring) {\n            const distance = Math.hypot((i.tgt.clientX - this.positionSpring.x), (i.tgt.clientY - this.positionSpring.y));\n            if (Math.abs(distance) > (this.radius * 4)) {\n                this.spring.nativeElement.setAttribute(\"display\", \"none\");\n                this.handle.nativeElement.setAttribute(\"display\", \"none\");\n                this.displaySpring = false;\n            }\n        } else {\n            clearInterval(this.interval);\n            this.interval = globalThis.window.setInterval(() => {\n                clearInterval(this.interval);\n                this.displaySpring = true;\n                this.positionSpring = {\n                    \"x\": i.tgt.clientX < this.radius ? this.radius : i.tgt.clientX - this.radius * 2,\n                    \"y\": i.tgt.clientY\n                };\n                this.spring.nativeElement.setAttribute(\"display\", \"block\");\n                this.handle.nativeElement.setAttribute(\"display\", \"block\");\n                this.handle.nativeElement.setAttribute(\"cx\", String(this.positionSpring.x));\n                this.handle.nativeElement.setAttribute(\"cy\", String(this.positionSpring.y));\n                this.spring.nativeElement.setAttribute(\"x1\", String(i.src.clientX));\n                this.spring.nativeElement.setAttribute(\"y1\", String(i.src.clientY));\n                this.spring.nativeElement.setAttribute(\"x2\", String(this.positionSpring.x));\n                this.spring.nativeElement.setAttribute(\"y2\", String(i.tgt.clientY));\n            }, 1000);\n        }\n    }\n\n    public end(): void {\n        clearInterval(this.interval);\n        this.displaySpring = false;\n        this.spring.nativeElement.setAttribute(\"display\", \"none\");\n        this.handle.nativeElement.setAttribute(\"display\", \"none\");\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport type {Command, CmdStatus} from \"../../api/command/Command\";\n\n/**\n * The base implementation class for coding UI commands.\n * @category Command\n */\nexport abstract class CommandBase implements Command {\n    /**\n     * The state of the command.\n     */\n    protected status: CmdStatus;\n\n    /**\n     * Creates the command with the status 'created'.\n     */\n    public constructor() {\n        this.status = \"created\";\n    }\n\n    /**\n     * Flushes the UI command.\n     * The command must not be used after that.\n     */\n    public flush(): void {\n        this.status = \"flushed\";\n    }\n\n    /**\n     * Actions may need to create a memento before their first execution.\n     * This is the goal of the operation that should be overridden.\n     * This operator is called a single time before the first execution of the command.\n     */\n    protected createMemento(): void {}\n\n    public execute(): Promise<boolean> | boolean {\n        let ok: boolean;\n        if ((this.status === \"created\" || this.status === \"executed\") && this.canExecute()) {\n            if (this.status === \"created\") {\n                this.createMemento();\n            }\n            ok = true;\n\n            try {\n                const result = this.execution();\n                if (result instanceof Promise) {\n                    return result\n                        .then(() => {\n                            this.status = \"executed\";\n                            return true;\n                        })\n                        .catch(() => {\n                            this.status = \"executed\";\n                            return false;\n                        });\n                }\n            } catch (error: unknown) {\n                this.status = \"executed\";\n                throw error;\n            }\n            this.status = \"executed\";\n        } else {\n            ok = false;\n        }\n\n        return ok;\n    }\n\n    /**\n     * This method contains the statements to execute the command.\n     * This method is automatically called by 'execute' and must not be called explicitly.\n     */\n    protected abstract execution(): Promise<void> | void;\n\n    public hadEffect(): boolean {\n        return this.isDone();\n    }\n\n    public done(): void {\n        if (this.status === \"created\" || this.status === \"executed\") {\n            this.status = \"done\";\n        }\n    }\n\n    public isDone(): boolean {\n        return this.status === \"done\";\n    }\n\n    public cancel(): void {\n        this.status = \"cancelled\";\n    }\n\n    public getStatus(): CmdStatus {\n        return this.status;\n    }\n\n    public canExecute(): boolean {\n        return true;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {CommandBase} from \"./CommandBase\";\n\n/**\n * An anonymous command that takes an anonymous function as a parameter corresponding to the command to execute.\n * The goal of this command is to avoid the creation of a command class for a small command.\n * @category Command\n */\nexport class AnonCmd extends CommandBase {\n    private readonly exec: () => void;\n\n    public constructor(fct: () => void) {\n        super();\n        this.exec = fct;\n    }\n\n    public override canExecute(): boolean {\n        return true;\n    }\n\n    protected execution(): void {\n        this.exec();\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {isEltRef} from \"../../api/binder/BaseBinderBuilder\";\nimport {AnonCmd} from \"../command/AnonCmd\";\nimport type {Widget} from \"../../api/binder/BaseBinderBuilder\";\nimport type {CmdBinder} from \"../../api/binder/CmdBinder\";\nimport type {InteractionBinder} from \"../../api/binder/InteractionBinder\";\nimport type {InteractionCmdBinder} from \"../../api/binder/InteractionCmdBinder\";\nimport type {When, WhenType} from \"../../api/binder/When\";\nimport type {Binding} from \"../../api/binding/Binding\";\nimport type {BindingsObserver} from \"../../api/binding/BindingsObserver\";\nimport type {RuleName, Severity} from \"../../api/checker/Checker\";\nimport type {Command} from \"../../api/command/Command\";\nimport type {Interaction, InteractionDataType} from \"../../api/interaction/Interaction\";\nimport type {Logger} from \"../../api/logging/Logger\";\nimport type {LogLevel} from \"../../api/logging/LogLevel\";\nimport type {UndoHistoryBase} from \"../../api/undo/UndoHistoryBase\";\n\n/**\n * The base class that defines the concept of binding builder (called binder).\n * @typeParam C - The type of the action to produce.\n * @typeParam I - The type of the user interaction to bind.\n * @category Binding\n */\n// eslint-disable-next-line no-use-before-define\nexport abstract class Binder<C extends Command, I extends Interaction<D>, A, D extends object = InteractionDataType<I>>\nimplements CmdBinder<C>, InteractionBinder<I, A, D>, InteractionCmdBinder<C, I, A, D> {\n\n    protected firstFn?: (c: C, i: D, acc: A) => void;\n\n    protected produceFn?: (i: D | undefined) => C;\n\n    protected widgets: ReadonlyArray<unknown>;\n\n    protected dynamicNodes: ReadonlyArray<Node>;\n\n    protected usingFn?: () => I;\n\n    protected hadEffectsFn?: (c: C, i: D, acc: A) => void;\n\n    protected hadNoEffectFn?: (c: C, i: D, acc: A) => void;\n\n    protected cannotExecFn?: (c: C, i: D, acc: A) => void;\n\n    protected endFn?: (c: C, i: D, acc: A) => void;\n\n    protected onErrFn?: (ex: unknown) => void;\n\n    protected logLevels: ReadonlyArray<LogLevel>;\n\n    protected stopPropagation: boolean;\n\n    protected prevDefault: boolean;\n\n    protected bindingName: string | undefined;\n\n    protected observer: BindingsObserver | undefined;\n\n    protected undoHistory: UndoHistoryBase;\n\n    protected logger: Logger;\n\n    protected whenFnArray: Array<When<D, A>> = [];\n\n    protected firstFnArray: Array<(c: C, i: D, acc: A) => void> = [];\n\n    protected endFnArray: Array<(c: C, i: D, acc: A) => void> = [];\n\n    protected hadEffectsFnArray: Array<(c: C, i: D, acc: A) => void> = [];\n\n    protected hadNoEffectFnArray: Array<(c: C, i: D, acc: A) => void> = [];\n\n    protected cannotExecFnArray: Array<(c: C, i: D, acc: A) => void> = [];\n\n    protected onErrFnArray: Array<(ex: unknown) => void> = [];\n\n    protected accInit: A | undefined;\n\n    protected linterRules: Map<RuleName, Severity>;\n\n    protected constructor(undoHistory: UndoHistoryBase, logger: Logger, observer?: BindingsObserver,\n                          binder?: Partial<Binder<C, I, A, D>>, acc?: A) {\n        this.widgets = [];\n        this.dynamicNodes = [];\n        this.logLevels = [];\n        this.linterRules = new Map();\n        this.stopPropagation = false;\n        this.prevDefault = false;\n\n        Object.assign(this, binder);\n\n        this.accInit = acc;\n        this.undoHistory = undoHistory;\n        this.logger = logger;\n        this.observer = observer;\n\n        this.copyFnArrays();\n    }\n\n    protected abstract duplicate(): Binder<C, I, A, D>;\n\n    /**\n     * Clones the arrays containing the routine functions after a binder is copied.\n     */\n    protected copyFnArrays(): void {\n        // Clones the arrays (instead of just copying the reference from the previous binder)\n        this.whenFnArray = Array.from(this.whenFnArray);\n\n        this.firstFnArray = Array.from(this.firstFnArray);\n        this.firstFn = (c: C, i: D, acc: A): void => {\n            for (const fn of this.firstFnArray) {\n                fn(c, i, acc);\n            }\n        };\n        this.endFnArray = Array.from(this.endFnArray);\n        this.endFn = (c: C, i: D, acc: A): void => {\n            for (const fn of this.endFnArray) {\n                fn(c, i, acc);\n            }\n        };\n        this.hadEffectsFnArray = Array.from(this.hadEffectsFnArray);\n        this.hadEffectsFn = (c: C, i: D, acc: A): void => {\n            for (const fn of this.hadEffectsFnArray) {\n                fn(c, i, acc);\n            }\n        };\n        this.hadNoEffectFnArray = Array.from(this.hadNoEffectFnArray);\n        this.hadNoEffectFn = (c: C, i: D, acc: A): void => {\n            for (const fn of this.hadNoEffectFnArray) {\n                fn(c, i, acc);\n            }\n        };\n        this.cannotExecFnArray = Array.from(this.cannotExecFnArray);\n        this.cannotExecFn = (c: C, i: D, acc: A): void => {\n            for (const fn of this.cannotExecFnArray) {\n                fn(c, i, acc);\n            }\n        };\n        this.onErrFnArray = Array.from(this.onErrFnArray);\n        this.onErrFn = (ex: unknown): void => {\n            for (const fn of this.onErrFnArray) {\n                fn(ex);\n            }\n        };\n    }\n\n    public on<W>(widget: ReadonlyArray<Widget<W>> | Widget<W>, ...widgets: ReadonlyArray<Widget<W>>): Binder<C, I, A, D> {\n        const ws = Array\n            .from(widgets)\n            .concat(widget)\n            .map(currWidget => {\n                if (isEltRef(currWidget)) {\n                    return currWidget.nativeElement;\n                }\n                return currWidget;\n            });\n        const currWidget: ReadonlyArray<unknown> = this.widgets.length === 0 ? ws : Array.from(this.widgets).concat(ws);\n        const dup = this.duplicate();\n        dup.widgets = currWidget;\n        return dup;\n    }\n\n    public onDynamic(node: Widget<Node>): Binder<C, I, A, D> {\n        const dup = this.duplicate();\n        const nodeEvt = isEltRef(node) ? node.nativeElement : node;\n        dup.dynamicNodes = Array.from(this.dynamicNodes).concat(nodeEvt);\n        return dup;\n    }\n\n    public first(fn: (c: C, i: D, acc: A) => void): Binder<C, I, A, D> {\n        const dup = this.duplicate();\n        dup.firstFnArray.push(fn);\n        return dup;\n    }\n\n    public when(fn: (i: D, acc: Readonly<A>) => boolean, mode: WhenType = \"nonStrict\"): Binder<C, I, A, D> {\n        const dup = this.duplicate();\n        dup.whenFnArray.push({\n            fn,\n            \"type\": mode\n        });\n        return dup;\n    }\n\n    public ifHadEffects(fn: (c: C, i: D, acc: A) => void): Binder<C, I, A, D> {\n        const dup = this.duplicate();\n        dup.hadEffectsFnArray.push(fn);\n        return dup;\n    }\n\n    public ifHadNoEffect(fn: (c: C, i: D, acc: A) => void): Binder<C, I, A, D> {\n        const dup = this.duplicate();\n        dup.hadNoEffectFnArray.push(fn);\n        return dup;\n    }\n\n    public ifCannotExecute(fn: (c: C, i: D, acc: A) => void): Binder<C, I, A, D> {\n        const dup = this.duplicate();\n        dup.cannotExecFnArray.push(fn);\n        return dup;\n    }\n\n    public end(fn: (c: C, i: D, acc: A) => void): Binder<C, I, A, D> {\n        const dup = this.duplicate();\n        dup.endFnArray.push(fn);\n        return dup;\n    }\n\n    public log(...level: ReadonlyArray<LogLevel>): Binder<C, I, A, D> {\n        const dup = this.duplicate();\n        dup.logLevels = Array.from(level);\n        return dup;\n    }\n\n    public stopImmediatePropagation(): Binder<C, I, A, D> {\n        const dup = this.duplicate();\n        dup.stopPropagation = true;\n        return dup;\n    }\n\n    public preventDefault(): Binder<C, I, A, D> {\n        const dup = this.duplicate();\n        dup.prevDefault = true;\n        return dup;\n    }\n\n    public catch(fn: (ex: unknown) => void): Binder<C, I, A, D> {\n        const dup = this.duplicate();\n        dup.onErrFnArray.push(fn);\n        return dup;\n    }\n\n    public name(name: string): Binder<C, I, A, D> {\n        const dup = this.duplicate();\n        dup.bindingName = name;\n        return dup;\n    }\n\n    public configureRules(ruleName: RuleName, severity: Severity): Binder<C, I, A, D> {\n        const dup = this.duplicate();\n        dup.linterRules.set(ruleName, severity);\n        return dup;\n    }\n\n    // eslint-disable-next-line no-use-before-define\n    public usingInteraction<I2 extends Interaction<D2>, A2, D2 extends object = InteractionDataType<I2>>\n    (fn: () => I2): Binder<C, I2, A2, D2> {\n        const dup = this.duplicate();\n        dup.usingFn = fn as unknown as () => I;\n        return dup as unknown as Binder<C, I2, A2, D2>;\n    }\n\n    public toProduce<C2 extends Command>(fn: (i: D) => C2): Binder<C2, I, A, D> {\n        const dup = this.duplicate();\n        dup.produceFn = fn as unknown as (i: D | undefined) => C;\n        return dup as unknown as Binder<C2, I, A, D>;\n    }\n\n    public toProduceAnon(fn: () => void): Binder<Command, I, A, D> {\n        const dup = this.duplicate();\n        dup.produceFn = ((): Command => new AnonCmd(fn)) as unknown as (i: D | undefined) => C;\n        return dup as unknown as Binder<Command, I, A, D>;\n    }\n\n    public abstract bind(): Binding<C, I, A, D>;\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\n/**\n * The error to use when the command being processsed should be undoable.\n * @category Helper\n */\nexport class MustBeUndoableCmdError extends Error {\n    public constructor(cmdProducer: unknown) {\n        super(`The following command must be undoable: ${String(cmdProducer)}`);\n        this.name = \"MustBeUndoableCmdError\";\n    }\n}\n\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {MustBeUndoableCmdError} from \"./MustBeUndoableCmdError\";\nimport {isUndoableType} from \"../../api/undo/Undoable\";\nimport {Subject} from \"rxjs\";\nimport type {Binding} from \"../../api/binding/Binding\";\nimport type {VisitorBinding} from \"../../api/binding/VisitorBinding\";\nimport type {RuleName, Severity} from \"../../api/checker/Checker\";\nimport type {Command} from \"../../api/command/Command\";\nimport type {Interaction, InteractionDataType} from \"../../api/interaction/Interaction\";\nimport type {Logger} from \"../../api/logging/Logger\";\nimport type {UndoHistoryBase} from \"../../api/undo/UndoHistoryBase\";\nimport type {Observable} from \"rxjs\";\n\n/**\n * The base class to do bindings, i.e. bindings between user interactions and (undoable) commands.\n * @typeParam C - The type of the command that will produce this binding.\n * @typeParam I - The type of the interaction that will use this binding.\n * @typeParam A - The type of the accumulator.\n * @typeParam D - The interaction data type (infered from the interaction type)\n * @category Binding\n */\n// eslint-disable-next-line no-use-before-define\nexport class BindingImpl<C extends Command, I extends Interaction<D>, A, D extends object = InteractionDataType<I>>\nimplements Binding<C, I, A, D> {\n\n    protected _name: string | undefined;\n\n    protected _timeEnded: number;\n\n    protected _timeCancelled: number;\n\n    protected _activated: boolean;\n\n    /**\n     * The source interaction.\n     */\n    protected readonly _interaction: I;\n\n    public accumulator: A;\n\n    public readonly linterRules: ReadonlyMap<RuleName, Severity>;\n\n    /**\n     * The current action in progress.\n     */\n    protected _cmd: C | undefined;\n\n    public readonly continuousCmdExecution: boolean;\n\n    /**\n     * The command class to instantiate.\n     */\n    protected readonly cmdProducer: (i?: D) => C;\n\n    protected readonly cmdsProduced: Subject<C>;\n\n    protected readonly accumulatorInit: A | undefined;\n\n    protected undoHistory: UndoHistoryBase;\n\n    protected logger: Logger;\n\n    public logBinding: boolean;\n\n    /**\n     * Logs binding usage information, to perform data analysis on usage\n     */\n    public logCmd: boolean;\n\n    public logUsage: boolean;\n\n    /**\n     * Creates a binding.\n     * @param continuousExecution - Specifies whether the command must be executed on each step of the interaction.\n     * @param interaction - The user interaction of the binding.\n     * @param cmdProducer - The type of the command that will be created. Used to instantiate the command by reflexivity.\n     * The class must be public and must have a constructor with no parameter.\n     * @param widgets - The widgets on which the binding will operate.\n     * @param undoHistory - The undo/redo history.\n     * @param logger - The logger to use\n     * @param linterRules - The linting rules to use\n     * @param name - The optional name of the binding. If not provided, computed based on the interaction and command names\n     * @param accInit - The initial accumulator to use during the binding execution.\n     */\n    public constructor(continuousExecution: boolean, interaction: I, cmdProducer: (i?: D) => C,\n                       widgets: ReadonlyArray<unknown>, undoHistory: UndoHistoryBase, logger: Logger,\n                       linterRules: ReadonlyMap<RuleName, Severity>, name?: string, accInit?: A) {\n        // The name is partial until the binding procudes its first command\n        this._name = name;\n        this.linterRules = linterRules;\n        this.accumulatorInit = accInit;\n        this.logBinding = false;\n        this.logCmd = false;\n        this.logUsage = false;\n        this._timeCancelled = 0;\n        this._timeEnded = 0;\n        this.accumulator = {...this.accumulatorInit} as A;\n        this.cmdsProduced = new Subject();\n        this.cmdProducer = cmdProducer;\n        this._interaction = interaction;\n        this._cmd = undefined;\n        this.continuousCmdExecution = continuousExecution;\n        this._activated = true;\n        this.undoHistory = undoHistory;\n        this.logger = logger;\n        this._interaction.fsm.addHandler({\n            \"fsmStarts\": () => {\n                this.fsmStarts();\n            },\n            \"fsmUpdates\": () => {\n                this.fsmUpdates();\n            },\n            \"fsmStops\": () => {\n                this.fsmStops();\n            },\n            \"fsmCancels\": () => {\n                this.fsmCancels();\n            },\n            \"fsmError\": (err: unknown) => {\n                this.fsmError(err);\n            }\n        });\n        interaction.registerToNodes(widgets);\n    }\n\n    private reinitAccumulator(): void {\n        this.accumulator = {...this.accumulatorInit} as A;\n    }\n\n    public get name(): string {\n        return this._name ?? this._interaction.constructor.name;\n    }\n\n    protected whenStart(): boolean {\n        return true;\n    }\n\n    protected whenUpdate(): boolean {\n        return true;\n    }\n\n    protected whenStop(): boolean {\n        return true;\n    }\n\n    /**\n     * Stops the interaction and clears all its events waiting for a process.\n     */\n    public clearEvents(): void {\n        this._interaction.fullReinit();\n    }\n\n    /**\n     * creates the command of the binding. If the attribute 'cmd' is not null, nothing will be done.\n     * @returns The created command or undefined if an error occurred\n     */\n    protected createCommand(): C | undefined {\n        try {\n            const cmd = this.cmdProducer(this.interaction.data);\n            /*\n             * Updating the name of the binding according to the name of the command.\n             * Cannot be done elsewhere since we cannot access the concrete type of the command.\n             */\n            if (this._name === undefined) {\n                this._name = `${this._interaction.constructor.name}:${cmd.constructor.name}`;\n            }\n            return cmd;\n        } catch (error: unknown) {\n            this.logger.logBindingErr(\"Error while creating a command\", error);\n            this.catch(error);\n            return undefined;\n        }\n    }\n\n    public isWhenDefined(): boolean {\n        return false;\n    }\n\n    /**\n     * Called when an error appeared during the execution of the binding. To override.\n     * @param _err - The error.\n     */\n    public catch(_err: unknown): void {\n        // To override.\n    }\n\n    /**\n     * After being created, this method initialises the command. To override.\n     */\n    public first(): void {\n        // To override.\n    }\n\n    /**\n     * Updates the current command. To override.\n     */\n    public then(): void {\n        // To override.\n    }\n\n    /**\n     * When the interaction ends. To override.\n     */\n    public end(): void {\n        // To override.\n    }\n\n    /**\n     * When the interaction is cancelled. To override.\n     */\n    public cancel(): void {\n        // To override.\n    }\n\n    /**\n     * When the interaction ends or is cancelled. To override.\n     */\n    public endOrCancel(): void {\n        // To override.\n    }\n\n    /**\n     * Called when an executed command did not had effect. To override.\n     */\n    public ifCmdHadNoEffect(): void {\n        // To override.\n    }\n\n    /**\n     * Called when an executed command had effects. To override.\n     */\n    public ifCmdHadEffects(): void {\n        // to override.\n    }\n\n    /**\n     * Called when an ongoing command cannot be executed. To override.\n     */\n    public ifCannotExecuteCmd(): void {\n        // to override.\n    }\n\n    public get interaction(): I {\n        return this._interaction;\n    }\n\n    public get command(): C | undefined {\n        return this._cmd;\n    }\n\n    public get activated(): boolean {\n        return this._activated;\n    }\n\n    public set activated(activated: boolean) {\n        if (this.logBinding) {\n            this.logger.logBindingMsg(`Binding Activated: ${String(activated)}`);\n        }\n        this._activated = activated;\n        this._interaction.setActivated(activated);\n        if (!this._activated && this._cmd !== undefined) {\n            this._cmd.flush();\n            this._cmd = undefined;\n        }\n        this.reinitAccumulator();\n    }\n\n    public get running(): boolean {\n        return this._interaction.isRunning();\n    }\n\n    protected fsmError(err: unknown): void {\n        if (this.logBinding) {\n            this.logger.logBindingErr(\"\", err);\n        }\n        this.catch(err);\n    }\n\n    protected fsmCancels(): void {\n        if (this._cmd !== undefined) {\n            if (this.logBinding) {\n                this.logger.logBindingMsg(\"Binding cancelled\");\n            }\n            this._cmd.cancel();\n            if (this.logCmd) {\n                this.logger.logCmdMsg(\"Cancelling command\", this._cmd.constructor.name);\n            }\n\n            try {\n                if (this.continuousCmdExecution) {\n                    this.cancelContinousWithEffectsCmd(this._cmd);\n                }\n            } finally {\n                this._cmd = undefined;\n                this.cancel();\n                this.endOrCancel();\n                this._timeCancelled++;\n            }\n        }\n\n        this.reinitAccumulator();\n\n        if (this.logUsage) {\n            this.logger.logBindingEnd(this.name, true);\n        }\n    }\n\n    private cancelContinousWithEffectsCmd(cmd: C): void {\n        if (isUndoableType(cmd)) {\n            cmd.undo();\n            if (this.logCmd) {\n                this.logger.logCmdMsg(\"Command undone\", cmd.constructor.name);\n            }\n        } else {\n            throw new MustBeUndoableCmdError(cmd);\n        }\n    }\n\n    protected fsmStarts(): void {\n        if (!this._activated) {\n            return;\n        }\n\n        const ok: boolean = this.whenStart();\n\n        if (this.logBinding) {\n            this.logger.logBindingMsg(`Starting binding: ${String(ok)}`);\n        }\n        if (ok) {\n            this.reinitAccumulator();\n            this._cmd = this.createCommand();\n            if (this._cmd !== undefined) {\n                this.first();\n                if (this.logCmd) {\n                    this.logger.logCmdMsg(\"Command created and init\", this._cmd.constructor.name);\n                }\n            }\n        }\n\n        if (this.logUsage) {\n            this.logger.logBindingStart(this.name);\n        }\n    }\n\n    protected fsmUpdates(): void {\n        if (!this._activated) {\n            return;\n        }\n\n        if (this.logBinding) {\n            this.logger.logBindingMsg(\"Binding updates\");\n        }\n\n        const cmd = this.createAndInitCommand(this.whenUpdate());\n        if (cmd !== undefined) {\n            if (this.logCmd) {\n                this.logger.logCmdMsg(\"Command update\");\n            }\n\n            this.then();\n\n            if (this.continuousCmdExecution) {\n                this.continuousExecutionOnFSMUpdate(cmd);\n            }\n        }\n    }\n\n    private continuousExecutionOnFSMUpdate(cmd: C): void {\n        const ok = cmd.execute();\n\n        if (this.logCmd) {\n            this.logger.logCmdMsg(`Try to execute command (continuous execution), is cmd undefined? ${String(this._cmd === undefined)}`);\n        }\n\n        if (ok instanceof Promise) {\n            ok.then(executed => {\n                if (!executed) {\n                    this.ifCannotExecuteCmd();\n                }\n\n                if (this.logCmd) {\n                    this.logger.logCmdMsg(`Continuous command execution had this result: ${String(executed)}`);\n                }\n            }).catch((error: unknown) => {\n                this.logger.logCmdErr(\"Error while executing the command continuously\", error);\n            });\n        } else {\n            if (!ok) {\n                this.ifCannotExecuteCmd();\n            }\n\n            if (this.logCmd) {\n                this.logger.logCmdMsg(`Continuous command execution had this result: ${String(ok)}`);\n            }\n        }\n    }\n\n    protected fsmStops(): void {\n        if (!this._activated) {\n            return;\n        }\n\n        if (this.logBinding) {\n            this.logger.logBindingMsg(\"Binding stops\");\n        }\n\n        let cancelled = false;\n        const cmd = this.createAndInitCommand(this.whenStop());\n\n        if (cmd === undefined) {\n            if (this._cmd !== undefined) {\n                if (this.logCmd) {\n                    this.logger.logCmdMsg(\"Cancelling the command\");\n                }\n                this._cmd.cancel();\n\n                try {\n                    if (this.continuousCmdExecution) {\n                        this.cancelContinousWithEffectsCmd(this._cmd);\n                    }\n                } finally {\n                    this._cmd = undefined;\n                    this.cancel();\n                    this.endOrCancel();\n                    this._timeCancelled++;\n                    cancelled = true;\n                }\n            }\n        } else {\n            this.executeCommandOnFSMStop(cmd);\n        }\n\n        this.reinitAccumulator();\n\n        if (this.logUsage) {\n            this.logger.logBindingEnd(this.name, cancelled);\n        }\n    }\n\n    private executeCommandOnFSMStop(cmd: C): void {\n        if (!this.continuousCmdExecution) {\n            this.then();\n            if (this.logCmd) {\n                this.logger.logCmdMsg(\"Command updated\");\n            }\n        }\n\n        /*\n         * Required to keep the command as because of async it may be set\n         * to undefined right after\n         */\n        const result = cmd.execute();\n\n        if (result instanceof Promise) {\n            result.then(executed => {\n                this._cmd = cmd;\n                this.afterCmdExecuted(cmd, executed);\n                /*\n                 * Cannot put these two lines in a finally block:\n                 * tests will failed as finally is called *after* the promise is resolved\n                 * provoking sync issues (treatments are done as soon as the promise is resolved)\n                 */\n                this._cmd = undefined;\n                this._timeEnded++;\n            }).catch((error: unknown) => {\n                this.logger.logCmdErr(\"Error while executing the command\", error);\n                this._cmd = undefined;\n                this._timeEnded++;\n            });\n        } else {\n            this.afterCmdExecuted(cmd, result);\n            this._cmd = undefined;\n            this._timeEnded++;\n        }\n    }\n\n    private createAndInitCommand(whenOk: boolean): C | undefined {\n        if (this.logBinding) {\n            this.logger.logBindingMsg(`when predicate is ${String(whenOk)}`);\n        }\n\n        if (whenOk) {\n            if (this._cmd === undefined) {\n                if (this.logCmd) {\n                    this.logger.logCmdMsg(\"Command creation\");\n                }\n                this._cmd = this.createCommand();\n                if (this._cmd !== undefined) {\n                    this.first();\n                }\n            }\n\n            return this._cmd;\n        }\n\n        return undefined;\n    }\n\n    private afterCmdExecuted(cmd: C, ok: boolean): void {\n        if (this.logCmd) {\n            this.logger.logCmdMsg(`Command execution had this result: ${String(ok)}`);\n        }\n        if (ok) {\n            this.end();\n            this.endOrCancel();\n        } else {\n            this.ifCannotExecuteCmd();\n        }\n\n        // In continuous mode, a command may have been executed in the update routine\n        if (cmd.getStatus() !== \"executed\") {\n            return;\n        }\n\n        // For commands executed at least one time\n        cmd.done();\n        this.cmdsProduced.next(cmd);\n\n        const hadEffect: boolean = cmd.hadEffect();\n\n        if (this.logCmd) {\n            this.logger.logCmdMsg(`Command execution had effect: ${String(hadEffect)}`);\n        }\n\n        if (hadEffect) {\n            if (isUndoableType(cmd)) {\n                this.undoHistory.add(cmd);\n            }\n            this.ifCmdHadEffects();\n        } else {\n            this.ifCmdHadNoEffect();\n        }\n    }\n\n    public uninstallBinding(): void {\n        this.activated = false;\n        this.cmdsProduced.complete();\n        this.logBinding = false;\n        this.logCmd = false;\n        this.logUsage = false;\n        this._interaction.uninstall();\n    }\n\n    public get produces(): Observable<C> {\n        return this.cmdsProduced;\n    }\n\n    public get timesEnded(): number {\n        return this._timeEnded;\n    }\n\n    public get timesCancelled(): number {\n        return this._timeCancelled;\n    }\n\n    public acceptVisitor(visitor: VisitorBinding): void {\n        visitor.visitBinding(this);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\n/**\n * The error an FSM will throw to cancel the user interaction.\n * @category FSM\n */\nexport class CancelFSMError extends Error {\n    public constructor() {\n        super();\n        this.name = \"CancelFSMError\";\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {BindingImpl} from \"./BindingImpl\";\nimport {isWhenAtEnd, isWhenAtStart, isWhenAtThen, isWhenStrict} from \"../../api/binder/When\";\nimport {CancelFSMError} from \"../fsm/CancelFSMError\";\nimport type {When} from \"../../api/binder/When\";\nimport type {RuleName, Severity} from \"../../api/checker/Checker\";\nimport type {Command} from \"../../api/command/Command\";\nimport type {Interaction, InteractionDataType} from \"../../api/interaction/Interaction\";\nimport type {Logger} from \"../../api/logging/Logger\";\nimport type {LogLevel} from \"../../api/logging/LogLevel\";\nimport type {UndoHistoryBase} from \"../../api/undo/UndoHistoryBase\";\n\n/**\n * A special implementation of a binding to be used in binders.\n * @typeParam C - The type of the command that will produce this binding.\n * @typeParam I - The type of the interaction that will use this binding.\n * @typeParam A - The type of the accumulator.\n * @typeParam D - The interaction data type (infered from the interaction type)\n * @category Binding\n */\n// eslint-disable-next-line no-use-before-define\nexport class AnonBinding<C extends Command, I extends Interaction<D>, A, D extends object = InteractionDataType<I>>\n    extends BindingImpl<C, I, A, D> {\n\n    private readonly firstFn: ((c: C, i: D, acc: A) => void) | undefined;\n\n    private readonly thenFn: ((c: C, i: D, acc: A) => void) | undefined;\n\n    private readonly whenFn: Array<When<D, A>> | undefined;\n\n    private readonly cancelFn: ((i: D, acc: A) => void) | undefined;\n\n    private readonly endOrCancelFn: ((i: D, acc: A) => void) | undefined;\n\n    private readonly hadEffectsFn: ((c: C, i: D, acc: A) => void) | undefined;\n\n    private readonly hadNoEffectFn: ((c: C, i: D, acc: A) => void) | undefined;\n\n    private readonly cannotExecFn: ((c: C, i: D, acc: A) => void) | undefined;\n\n    private readonly onEndFn: ((c: C, i: D, acc: A) => void) | undefined;\n\n    private readonly onErrFn: ((ex: unknown) => void) | undefined;\n\n    public constructor(continuousExec: boolean, interaction: I, undoHistory: UndoHistoryBase,\n                       logger: Logger, cmdSupplierFn: (d: D | undefined) => C,\n                       widgets: ReadonlyArray<unknown>, dynamicNodes: ReadonlyArray<Node>,\n                       loggers: ReadonlyArray<LogLevel>, timeoutThrottle: number,\n                       stopPropagation: boolean, prevDefault: boolean, linterRules: ReadonlyMap<RuleName, Severity>,\n                       firstFn?: (c: C, i: D, acc: A) => void,\n                       thenFn?: (c: C, i: D, acc: A) => void, whenFn?: Array<When<D, A>>,\n                       endFn?: (c: C, i: D, acc: A) => void, cancelFn?: (i: D, acc: A) => void,\n                       endOrCancelFn?: (i: D, acc: A) => void, hadEffectsFn?: (c: C, i: D, acc: A) => void,\n                       hadNoEffectFn?: (c: C, i: D, acc: A) => void, cannotExecFn?: (c: C, i: D, acc: A) => void,\n                       onErrFn?: (ex: unknown) => void, name?: string, accInit?: A) {\n        super(continuousExec, interaction, cmdSupplierFn, widgets, undoHistory, logger, linterRules, name, accInit);\n        this.configureLoggers(loggers);\n        this.firstFn = firstFn;\n        this.thenFn = thenFn;\n        this.cancelFn = cancelFn;\n        this.endOrCancelFn = endOrCancelFn;\n        this.whenFn = whenFn;\n        this.onEndFn = endFn;\n        this.hadEffectsFn = hadEffectsFn;\n        this.hadNoEffectFn = hadNoEffectFn;\n        this.cannotExecFn = cannotExecFn;\n        this.onErrFn = onErrFn;\n\n        this.interaction.stopImmediatePropagation = stopPropagation;\n        this.interaction.preventDefault = prevDefault;\n        this.interaction.setThrottleTimeout(timeoutThrottle);\n        for (const node of dynamicNodes) {\n            interaction.registerToNodeChildren(node);\n        }\n    }\n\n    private configureLoggers(loggers: ReadonlyArray<LogLevel>): void {\n        if (loggers.length > 0) {\n            this.logCmd = loggers.includes(\"command\");\n            this.logBinding = loggers.includes(\"binding\");\n            this.logUsage = loggers.includes(\"usage\");\n            this.interaction.log(loggers.includes(\"interaction\"));\n        }\n    }\n\n    public override first(): void {\n        const cmd = this.command;\n        if (this.firstFn !== undefined && cmd !== undefined) {\n            try {\n                this.firstFn(cmd, this.interaction.data, this.accumulator);\n            } catch (error: unknown) {\n                this.catch(error);\n                this.logger.logBindingErr(\"Crash in 'first'\", error);\n            }\n        }\n    }\n\n    public override then(): void {\n        const cmd = this.command;\n        if (this.thenFn !== undefined && cmd !== undefined) {\n            try {\n                this.thenFn(cmd, this.interaction.data, this.accumulator);\n            } catch (error: unknown) {\n                this.catch(error);\n                this.logger.logBindingErr(\"Crash in 'then'\", error);\n            }\n        }\n    }\n\n    public override end(): void {\n        const cmd = this.command;\n        if (this.onEndFn !== undefined && cmd !== undefined) {\n            try {\n                this.onEndFn(cmd, this.interaction.data, this.accumulator);\n            } catch (error: unknown) {\n                this.catch(error);\n                this.logger.logBindingErr(\"Crash in 'end'\", error);\n            }\n        }\n    }\n\n    public override cancel(): void {\n        if (this.cancelFn !== undefined) {\n            try {\n                this.cancelFn(this.interaction.data, this.accumulator);\n            } catch (error: unknown) {\n                this.catch(error);\n                this.logger.logBindingErr(\"Crash in 'cancel'\", error);\n            }\n        }\n    }\n\n    public override endOrCancel(): void {\n        if (this.endOrCancelFn !== undefined) {\n            try {\n                this.endOrCancelFn(this.interaction.data, this.accumulator);\n            } catch (error: unknown) {\n                this.catch(error);\n                this.logger.logBindingErr(\"Crash in 'endOrCancel'\", error);\n            }\n        }\n    }\n\n    public override ifCmdHadNoEffect(): void {\n        const cmd = this.command;\n        if (this.hadNoEffectFn !== undefined && cmd !== undefined) {\n            try {\n                this.hadNoEffectFn(cmd, this.interaction.data, this.accumulator);\n            } catch (error: unknown) {\n                this.catch(error);\n                this.logger.logBindingErr(\"Crash in 'ifHadNoEffect'\", error);\n            }\n        }\n    }\n\n    public override ifCmdHadEffects(): void {\n        const cmd = this.command;\n        if (this.hadEffectsFn !== undefined && cmd !== undefined) {\n            try {\n                this.hadEffectsFn(cmd, this.interaction.data, this.accumulator);\n            } catch (error: unknown) {\n                this.catch(error);\n                this.logger.logBindingErr(\"Crash in 'ifHadEffects'\", error);\n            }\n        }\n    }\n\n    public override ifCannotExecuteCmd(): void {\n        const cmd = this.command;\n        if (this.cannotExecFn !== undefined && cmd !== undefined) {\n            try {\n                this.cannotExecFn(cmd, this.interaction.data, this.accumulator);\n            } catch (error: unknown) {\n                this.catch(error);\n                this.logger.logBindingErr(\"Crash in 'ifCannotExecute'\", error);\n            }\n        }\n    }\n\n    protected override whenStart(): boolean {\n        return this.whenChecker(when => isWhenAtStart(when.type));\n    }\n\n    protected override whenUpdate(): boolean {\n        return this.whenChecker(when => isWhenAtThen(when.type));\n    }\n\n    protected override whenStop(): boolean {\n        return this.whenChecker(when => isWhenAtEnd(when.type));\n    }\n\n    private whenChecker(filterPredicate: (when: When<D, A>) => boolean): boolean {\n        const ok = this.whenFn\n            ?.filter(filterPredicate)\n            .every(when => this.executeWhen(when)) ?? false;\n        if (this.logBinding) {\n            this.logger.logBindingMsg(`Checking condition: ${String(ok)}`);\n        }\n        return ok;\n    }\n\n    private executeWhen(when: When<D, A>): boolean {\n        let res: boolean;\n        try {\n            res = when.fn(this.interaction.data, this.accumulator);\n        } catch (error: unknown) {\n            res = false;\n            this.catch(error);\n            this.logger.logBindingErr(\"Crash in checking condition\", error);\n        }\n        if (!res && isWhenStrict(when.type)) {\n            if (this.logBinding) {\n                this.logger.logBindingMsg(`Cancelling interaction: ${this._interaction.constructor.name}`);\n            }\n            throw new CancelFSMError();\n        }\n\n        return res;\n    }\n\n    public override catch(err: unknown): void {\n        if (this.onErrFn !== undefined) {\n            try {\n                this.onErrFn(err);\n            } catch (error: unknown) {\n                this.logger.logBindingErr(\"Crash in 'catch'\", error);\n            }\n        }\n    }\n\n    public override isWhenDefined(): boolean {\n        return this.whenFn !== undefined && this.whenFn.length > 0;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {Binder} from \"./Binder\";\nimport {AnonBinding} from \"../binding/AnonBinding\";\nimport type {Widget} from \"../../api/binder/BaseBinderBuilder\";\nimport type {CmdUpdateBinder} from \"../../api/binder/CmdUpdateBinder\";\nimport type {InteractionCmdUpdateBinder} from \"../../api/binder/InteractionCmdUpdateBinder\";\nimport type {WhenType} from \"../../api/binder/When\";\nimport type {Binding} from \"../../api/binding/Binding\";\nimport type {BindingsObserver} from \"../../api/binding/BindingsObserver\";\nimport type {RuleName, Severity} from \"../../api/checker/Checker\";\nimport type {Command} from \"../../api/command/Command\";\nimport type {Interaction, InteractionDataType} from \"../../api/interaction/Interaction\";\nimport type {Logger} from \"../../api/logging/Logger\";\nimport type {LogLevel} from \"../../api/logging/LogLevel\";\nimport type {UndoHistoryBase} from \"../../api/undo/UndoHistoryBase\";\n\n/**\n * The base binding builder for bindings where commands can be updated while the user interaction is running.\n * @typeParam C - The type of the command to produce.\n * @category Binding\n */\n// eslint-disable-next-line no-use-before-define\nexport class UpdateBinder<C extends Command, I extends Interaction<D>, A, D extends object = InteractionDataType<I>>\n    extends Binder<C, I, A, D> implements CmdUpdateBinder<C>, InteractionCmdUpdateBinder<C, I, A, D> {\n\n    protected thenFn?: (c: C, i: D, acc: A) => void;\n\n    protected cancelFn?: (i: D, acc: A) => void;\n\n    protected endOrCancelFn?: (i: D, acc: A) => void;\n\n    protected continuousCmdExecution: boolean;\n\n    protected throttleTimeout: number;\n\n    protected thenFnArray: Array<(c: C, i: D, acc: A) => void> = [];\n\n    protected cancelFnArray: Array<(i: D, acc: A) => void> = [];\n\n    protected endOrCancelFnArray: Array<(i: D, acc: A) => void> = [];\n\n    public constructor(undoHistory: UndoHistoryBase, logger: Logger, observer?: BindingsObserver,\n                       binder?: Partial<UpdateBinder<C, I, A, D>>, acc?: A) {\n        super(undoHistory, logger, observer, binder, acc);\n\n        this.continuousCmdExecution = false;\n        this.throttleTimeout = 0;\n        Object.assign(this, binder);\n\n        // Arrays have to be cloned again in each subclass of Binder after Object.assign() since it undoes the changes\n        this.copyFnArraysUpdate();\n    }\n\n    protected copyFnArraysUpdate(): void {\n        super.copyFnArrays();\n        this.thenFnArray = Array.from(this.thenFnArray);\n        this.thenFn = (c: C, i: D, acc: A): void => {\n            for (const fn of this.thenFnArray) {\n                fn(c, i, acc);\n            }\n        };\n        this.cancelFnArray = Array.from(this.cancelFnArray);\n        this.cancelFn = (i: D, acc: A): void => {\n            for (const fn of this.cancelFnArray) {\n                fn(i, acc);\n            }\n        };\n        this.endOrCancelFnArray = Array.from(this.endOrCancelFnArray);\n        this.endOrCancelFn = (i: D, acc: A): void => {\n            for (const fn of this.endOrCancelFnArray) {\n                fn(i, acc);\n            }\n        };\n    }\n\n    public then(fn: (c: C, i: D, acc: A) => void): UpdateBinder<C, I, A, D> {\n        const dup = this.duplicate();\n        dup.thenFnArray.push(fn);\n        return dup;\n    }\n\n    public continuousExecution(): UpdateBinder<C, I, A, D> {\n        const dup = this.duplicate();\n        dup.continuousCmdExecution = true;\n        return dup;\n    }\n\n    public cancel(fn: (i: D, acc: A) => void): UpdateBinder<C, I, A, D> {\n        const dup = this.duplicate();\n        dup.cancelFnArray.push(fn);\n        return dup;\n    }\n\n    public endOrCancel(fn: (i: D, acc: A) => void): UpdateBinder<C, I, A, D> {\n        const dup = this.duplicate();\n        dup.endOrCancelFnArray.push(fn);\n        return dup;\n    }\n\n    public throttle(timeout: number): UpdateBinder<C, I, A, D> {\n        const dup = this.duplicate();\n        dup.throttleTimeout = timeout;\n        return dup;\n    }\n\n    public override on<W>(widget: ReadonlyArray<Widget<W>> | Widget<W>, ...widgets: ReadonlyArray<Widget<W>>): UpdateBinder<C, I, A, D> {\n        return super.on(widget, ...widgets) as UpdateBinder<C, I, A, D>;\n    }\n\n    public override onDynamic(node: Widget<Node>): UpdateBinder<C, I, A, D> {\n        return super.onDynamic(node) as UpdateBinder<C, I, A, D>;\n    }\n\n    public override first(fn: (c: C, i: D, acc: A) => void): UpdateBinder<C, I, A, D> {\n        return super.first(fn) as UpdateBinder<C, I, A, D>;\n    }\n\n    public override when(fn: (i: D, acc: Readonly<A>) => boolean, mode?: WhenType): UpdateBinder<C, I, A, D> {\n        return super.when(fn, mode) as UpdateBinder<C, I, A, D>;\n    }\n\n    public override ifHadEffects(fn: (c: C, i: D, acc: A) => void): UpdateBinder<C, I, A, D> {\n        return super.ifHadEffects(fn) as UpdateBinder<C, I, A, D>;\n    }\n\n    public override ifHadNoEffect(fn: (c: C, i: D, acc: A) => void): UpdateBinder<C, I, A, D> {\n        return super.ifHadNoEffect(fn) as UpdateBinder<C, I, A, D>;\n    }\n\n    public override ifCannotExecute(fn: (c: C, i: D, acc: A) => void): UpdateBinder<C, I, A, D> {\n        return super.ifCannotExecute(fn) as UpdateBinder<C, I, A, D>;\n    }\n\n    public override end(fn: (c: C, i: D, acc: A) => void): UpdateBinder<C, I, A, D> {\n        return super.end(fn) as UpdateBinder<C, I, A, D>;\n    }\n\n    public override log(...level: ReadonlyArray<LogLevel>): UpdateBinder<C, I, A, D> {\n        return super.log(...level) as UpdateBinder<C, I, A, D>;\n    }\n\n    public override stopImmediatePropagation(): UpdateBinder<C, I, A, D> {\n        return super.stopImmediatePropagation() as UpdateBinder<C, I, A, D>;\n    }\n\n    public override preventDefault(): UpdateBinder<C, I, A, D> {\n        return super.preventDefault() as UpdateBinder<C, I, A, D>;\n    }\n\n    public override catch(fn: (ex: unknown) => void): UpdateBinder<C, I, A, D> {\n        return super.catch(fn) as UpdateBinder<C, I, A, D>;\n    }\n\n    public override name(name: string): UpdateBinder<C, I, A, D> {\n        return super.name(name) as UpdateBinder<C, I, A, D>;\n    }\n\n    public override configureRules(ruleName: RuleName, severity: Severity): UpdateBinder<C, I, A, D> {\n        return super.configureRules(ruleName, severity) as UpdateBinder<C, I, A, D>;\n    }\n\n    // eslint-disable-next-line no-use-before-define\n    public override usingInteraction<I2 extends Interaction<D2>, A2, D2 extends object = InteractionDataType<I2>>\n    (fn: () => I2): UpdateBinder<C, I2, A2, D2> {\n        return super.usingInteraction(fn) as UpdateBinder<C, I2, A2, D2>;\n    }\n\n    public override toProduce<C2 extends Command>(fn: (i: D) => C2): UpdateBinder<C2, I, A, D> {\n        return super.toProduce(fn) as UpdateBinder<C2, I, A, D>;\n    }\n\n    public override toProduceAnon(fn: () => void): UpdateBinder<Command, I, A, D> {\n        return super.toProduceAnon(fn) as UpdateBinder<Command, I, A, D>;\n    }\n\n    protected duplicate(): UpdateBinder<C, I, A, D> {\n        return new UpdateBinder<C, I, A, D>(this.undoHistory, this.logger, this.observer, this);\n    }\n\n    public bind(): Binding<C, I, A, D> {\n        if (this.usingFn === undefined) {\n            throw new Error(\"The interaction supplier cannot be undefined here\");\n        }\n\n        if (this.produceFn === undefined) {\n            throw new Error(\"The command supplier cannot be undefined here\");\n        }\n\n        const binding = new AnonBinding(this.continuousCmdExecution, this.usingFn(), this.undoHistory, this.logger, this.produceFn,\n            Array.from(this.widgets), Array.from(this.dynamicNodes), Array.from(this.logLevels),\n            this.throttleTimeout, this.stopPropagation, this.prevDefault, new Map(this.linterRules), this.firstFn, this.thenFn,\n            Array.from(this.whenFnArray), this.endFn, this.cancelFn, this.endOrCancelFn, this.hadEffectsFn,\n            this.hadNoEffectFn, this.cannotExecFn, this.onErrFn, this.bindingName, this.accInit);\n\n        this.observer?.observeBinding(binding);\n\n        return binding;\n    }\n}\n","/* eslint-disable unicorn/no-null */\nimport type {Flushable} from \"./Flushable\";\nimport type {UnitInteractionData} from \"../../api/interaction/UnitInteractionData\";\n\n/**\n * The base implementation class for most of interaction data.\n * Contains basic information.\n * @category Interaction Data\n */\nexport abstract class InteractionDataBase implements UnitInteractionData, Flushable {\n    protected currentTargetData: EventTarget | null = null;\n\n    protected targetData: EventTarget | null = null;\n\n    protected timeStampData = 0;\n\n    public copy(data: UnitInteractionData): void {\n        /*\n         * Cannot use Object.assign because of a strange implementation of Event\n         * that prevents accessing the properties\n         */\n        this.currentTargetData = data.currentTarget;\n        this.targetData = data.target;\n        this.timeStampData = data.timeStamp;\n    }\n\n    public flush(): void {\n        this.currentTargetData = null;\n        this.targetData = null;\n        this.timeStampData = 0;\n    }\n\n    public get currentTarget(): EventTarget | null {\n        return this.currentTargetData;\n    }\n\n    public get target(): EventTarget | null {\n        return this.targetData;\n    }\n\n    public get timeStamp(): number {\n        return this.timeStampData;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {InteractionDataBase} from \"./InteractionDataBase\";\nimport type {Flushable} from \"./Flushable\";\nimport type {KeyData} from \"../../api/interaction/KeyData\";\n\n/**\n * The interaction data that stores a single key.\n * @category Interaction Data\n */\nexport class KeyDataImpl extends InteractionDataBase implements KeyData, Flushable {\n    private codeData = \"\";\n\n    private keyData = \"\";\n\n    private locationData = 0;\n\n    private repeatData = false;\n\n    private altKeyData = false;\n\n    private ctrlKeyData = false;\n\n    private metaKeyData = false;\n\n    private shiftKeyData = false;\n\n    public override flush(): void {\n        super.flush();\n        this.codeData = \"\";\n        this.keyData = \"\";\n        this.locationData = 0;\n        this.repeatData = false;\n        this.altKeyData = false;\n        this.ctrlKeyData = false;\n        this.metaKeyData = false;\n        this.shiftKeyData = false;\n    }\n\n    public override copy(data: KeyData): void {\n        super.copy(data);\n        /*\n         * Cannot use Object.assign because of a strange implementation of Event\n         * that prevents accessing the properties\n         */\n        this.codeData = data.code;\n        this.keyData = data.key;\n        this.locationData = data.location;\n        this.repeatData = data.repeat;\n        this.altKeyData = data.altKey;\n        this.ctrlKeyData = data.ctrlKey;\n        this.metaKeyData = data.metaKey;\n        this.shiftKeyData = data.shiftKey;\n    }\n\n    public get altKey(): boolean {\n        return this.altKeyData;\n    }\n\n    public get code(): string {\n        return this.codeData;\n    }\n\n    public get ctrlKey(): boolean {\n        return this.ctrlKeyData;\n    }\n\n    public get key(): string {\n        return this.keyData;\n    }\n\n    public get location(): number {\n        return this.locationData;\n    }\n\n    public get metaKey(): boolean {\n        return this.metaKeyData;\n    }\n\n    public get repeat(): boolean {\n        return this.repeatData;\n    }\n\n    public get shiftKey(): boolean {\n        return this.shiftKeyData;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport type {Flushable} from \"./Flushable\";\nimport type {KeyData} from \"../../api/interaction/KeyData\";\nimport type {KeysData} from \"../../api/interaction/KeysData\";\n\n/**\n * The user interaction data that stores a sequence of used keys.\n * @category Interaction Data\n */\nexport class KeysDataImpl implements KeysData, Flushable {\n    private readonly keysData: Array<KeyData> = [];\n\n    public flush(): void {\n        this.keysData.length = 0;\n    }\n\n    public get keys(): ReadonlyArray<KeyData> {\n        return this.keysData;\n    }\n\n    public addKey(key: KeyData): void {\n        this.keysData.push(key);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {UpdateBinder} from \"./UpdateBinder\";\nimport {AnonBinding} from \"../binding/AnonBinding\";\nimport {KeyDataImpl} from \"../interaction/KeyDataImpl\";\nimport {KeysDataImpl} from \"../interaction/KeysDataImpl\";\nimport type {Widget} from \"../../api/binder/BaseBinderBuilder\";\nimport type {KeyInteractionCmdUpdateBinder} from \"../../api/binder/KeyInteractionCmdUpdateBinder\";\nimport type {WhenType} from \"../../api/binder/When\";\nimport type {Binding} from \"../../api/binding/Binding\";\nimport type {BindingsObserver} from \"../../api/binding/BindingsObserver\";\nimport type {RuleName, Severity} from \"../../api/checker/Checker\";\nimport type {Command} from \"../../api/command/Command\";\nimport type {Interaction, InteractionDataType} from \"../../api/interaction/Interaction\";\nimport type {Logger} from \"../../api/logging/Logger\";\nimport type {LogLevel} from \"../../api/logging/LogLevel\";\nimport type {UndoHistoryBase} from \"../../api/undo/UndoHistoryBase\";\n\n/**\n * The base binding builder to create bindings between a keys pressure interaction and a given command.\n * @typeParam C - The type of the command to produce.\n * @category Binding\n */\n// eslint-disable-next-line no-use-before-define\nexport class KeysBinder<C extends Command, I extends Interaction<D>, A, D extends object = InteractionDataType<I>>\n    extends UpdateBinder<C, I, A, D> implements KeyInteractionCmdUpdateBinder<C, I, A, D> {\n\n    private keysOrCodes: ReadonlyArray<string>;\n\n    private isCode: boolean;\n\n    // private readonly checkCodeFn: (i: InteractionData) => boolean;\n\n    public constructor(undoHistory: UndoHistoryBase, logger: Logger, observer?: BindingsObserver,\n                       binder?: Partial<KeysBinder<C, I, A, D>>, acc?: A) {\n        super(undoHistory, logger, observer, binder, acc);\n\n        this.isCode = false;\n        this.keysOrCodes = [];\n\n        Object.assign(this, binder);\n\n        // Arrays have to be cloned again in each subclass of Binder after Object.assign() since it undoes the changes\n        this.copyFnArraysUpdate();\n\n        // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n        this.keysOrCodes = this.keysOrCodes === undefined ? [] : Array.from(this.keysOrCodes);\n        this.completeWhenWithKeysPredicates();\n    }\n\n    private completeWhenWithKeysPredicates(): void {\n        const checkCodeFn = (i: D): boolean => {\n            let currentKeys: ReadonlyArray<string> = [];\n\n            if (this.isCode) {\n                if (i instanceof KeysDataImpl) {\n                    currentKeys = i.keys.map(key => key.code);\n                } else {\n                    if (i instanceof KeyDataImpl) {\n                        currentKeys = [i.code];\n                    }\n                }\n            } else {\n                if (i instanceof KeysDataImpl) {\n                    currentKeys = i.keys.map(key => key.key);\n                } else {\n                    if (i instanceof KeyDataImpl) {\n                        currentKeys = [i.key];\n                    }\n                }\n            }\n\n            return (this.keysOrCodes.length === 0 || this.keysOrCodes.length === currentKeys.length &&\n              currentKeys.every((key: string) => this.keysOrCodes.includes(key)));\n        };\n\n        this.whenFnArray.push({\n            \"fn\": checkCodeFn,\n            \"type\": \"nonStrict\"\n        });\n    }\n\n    public with(isCode: boolean, ...keysOrCodes: ReadonlyArray<string>): KeysBinder<C, I, A, D> {\n        const dup = this.duplicate();\n        dup.keysOrCodes = Array.from(keysOrCodes);\n        dup.isCode = isCode;\n        return dup;\n    }\n\n    public override on<W>(widget: ReadonlyArray<Widget<W>> | Widget<W>, ...widgets: ReadonlyArray<Widget<W>>): KeysBinder<C, I, A, D> {\n        return super.on(widget, ...widgets) as KeysBinder<C, I, A, D>;\n    }\n\n    public override onDynamic(node: Widget<Node>): KeysBinder<C, I, A, D> {\n        return super.onDynamic(node) as KeysBinder<C, I, A, D>;\n    }\n\n    public override first(fn: (c: C, i: D, acc: A) => void): KeysBinder<C, I, A, D> {\n        return super.first(fn) as KeysBinder<C, I, A, D>;\n    }\n\n    public override when(fn: (() => boolean) | ((i: D, acc: Readonly<A>) => boolean), mode?: WhenType): KeysBinder<C, I, A, D> {\n        return super.when(fn, mode) as KeysBinder<C, I, A, D>;\n    }\n\n    public override ifHadEffects(fn: (c: C, i: D, acc: A) => void): KeysBinder<C, I, A, D> {\n        return super.ifHadEffects(fn) as KeysBinder<C, I, A, D>;\n    }\n\n    public override ifHadNoEffect(fn: (c: C, i: D, acc: A) => void): KeysBinder<C, I, A, D> {\n        return super.ifHadNoEffect(fn) as KeysBinder<C, I, A, D>;\n    }\n\n    public override ifCannotExecute(fn: (c: C, i: D, acc: A) => void): KeysBinder<C, I, A, D> {\n        return super.ifCannotExecute(fn) as KeysBinder<C, I, A, D>;\n    }\n\n    public override end(fn: (c: C, i: D, acc: A) => void): KeysBinder<C, I, A, D> {\n        return super.end(fn) as KeysBinder<C, I, A, D>;\n    }\n\n    public override log(...level: ReadonlyArray<LogLevel>): KeysBinder<C, I, A, D> {\n        return super.log(...level) as KeysBinder<C, I, A, D>;\n    }\n\n    public override stopImmediatePropagation(): KeysBinder<C, I, A, D> {\n        return super.stopImmediatePropagation() as KeysBinder<C, I, A, D>;\n    }\n\n    public override preventDefault(): KeysBinder<C, I, A, D> {\n        return super.preventDefault() as KeysBinder<C, I, A, D>;\n    }\n\n    public override then(fn: ((c: C, i: D, acc: A) => void) | ((c: C) => void)): KeysBinder<C, I, A, D> {\n        return super.then(fn) as KeysBinder<C, I, A, D>;\n    }\n\n    public override continuousExecution(): KeysBinder<C, I, A, D> {\n        return super.continuousExecution() as KeysBinder<C, I, A, D>;\n    }\n\n    public override throttle(timeout: number): KeysBinder<C, I, A, D> {\n        return super.throttle(timeout) as KeysBinder<C, I, A, D>;\n    }\n\n    public override cancel(fn: (i: D, acc: A) => void): KeysBinder<C, I, A, D> {\n        return super.cancel(fn) as KeysBinder<C, I, A, D>;\n    }\n\n    public override endOrCancel(fn: (i: D, acc: A) => void): KeysBinder<C, I, A, D> {\n        return super.endOrCancel(fn) as KeysBinder<C, I, A, D>;\n    }\n\n    public override catch(fn: (ex: unknown) => void): KeysBinder<C, I, A, D> {\n        return super.catch(fn) as KeysBinder<C, I, A, D>;\n    }\n\n    public override name(name: string): KeysBinder<C, I, A, D> {\n        return super.name(name) as KeysBinder<C, I, A, D>;\n    }\n\n    public override configureRules(ruleName: RuleName, severity: Severity): KeysBinder<C, I, A, D> {\n        return super.configureRules(ruleName, severity) as KeysBinder<C, I, A, D>;\n    }\n\n    public override toProduce<C2 extends Command>(fn: (i: D) => C2): KeysBinder<C2, I, A, D> {\n        return super.toProduce(fn) as KeysBinder<C2, I, A, D>;\n    }\n\n    public override toProduceAnon(fn: () => void): KeysBinder<Command, I, A, D> {\n        return super.toProduceAnon(fn) as KeysBinder<Command, I, A, D>;\n    }\n\n    // eslint-disable-next-line no-use-before-define\n    public override usingInteraction<I2 extends Interaction<D2>, A2, D2 extends object = InteractionDataType<I2>>\n    (fn: () => I2): KeysBinder<C, I2, A2, D2> {\n        return super.usingInteraction(fn as unknown as () => Interaction<InteractionDataType<I2>>) as unknown as KeysBinder<C, I2, A2, D2>;\n    }\n\n    protected override duplicate(): KeysBinder<C, I, A, D> {\n        return new KeysBinder(this.undoHistory, this.logger, this.observer, this);\n    }\n\n    public override bind(): Binding<C, I, A, D> {\n        if (this.usingFn === undefined) {\n            throw new Error(\"The interaction supplier cannot be undefined here\");\n        }\n\n        if (this.produceFn === undefined) {\n            throw new Error(\"The command supplier cannot be undefined here\");\n        }\n\n        const binding = new AnonBinding(this.continuousCmdExecution, this.usingFn(), this.undoHistory,\n            this.logger, this.produceFn, Array.from(this.widgets), Array.from(this.dynamicNodes),\n            Array.from(this.logLevels), this.throttleTimeout, this.stopPropagation, this.prevDefault,\n            new Map(this.linterRules), this.firstFn, this.thenFn, Array.from(this.whenFnArray),\n            this.endFn, this.cancelFn, this.endOrCancelFn, this.hadEffectsFn,\n            this.hadNoEffectFn, this.cannotExecFn, this.onErrFn, this.bindingName, this.accInit);\n\n        this.observer?.observeBinding(binding);\n\n        return binding;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport type {EventType} from \"../../api/fsm/EventType\";\nimport type {InputState} from \"../../api/fsm/InputState\";\nimport type {OutputState} from \"../../api/fsm/OutputState\";\nimport type {Transition} from \"../../api/fsm/Transition\";\nimport type {VisitorFSM} from \"../../api/fsm/VisitorFSM\";\n\n/**\n * The base implementation of a FSM transition.\n * @category FSM Transition\n */\nexport abstract class TransitionBase<E extends Event> implements Transition<E> {\n    public readonly src: OutputState;\n\n    public readonly tgt: InputState;\n\n    public readonly action: (evt: E) => void;\n\n    public readonly guard: (evt: E) => boolean;\n\n    /**\n     * Creates the transition.\n     * @param srcState - The source state of the transition\n     * @param tgtState - The output state of the transition\n     * @param action - The action to execute when going through the transition\n     * @param guard - The guard to fulfil to execute the transition\n     */\n    public constructor(srcState: OutputState, tgtState: InputState,\n                       action?: (evt: E) => void, guard?: (evt: E) => boolean) {\n        this.src = srcState;\n        this.tgt = tgtState;\n        this.action = action ?? ((): void => {});\n        this.guard = guard ?? ((): boolean => true);\n        this.src.addTransition(this);\n    }\n\n    public execute(event: Event): InputState | undefined {\n        if (this.accept(event) && this.guard(event)) {\n            this.src.fsm.stopCurrentTimeout();\n            this.action(event);\n            this.src.exit();\n            this.tgt.enter();\n            return this.tgt;\n        }\n        return undefined;\n    }\n\n    public abstract accept(event: Event): event is E;\n\n    public acceptVisitor(visitor: VisitorFSM): void {\n        visitor.visitTransition(this);\n    }\n\n    public abstract getAcceptedEvents(): ReadonlySet<EventType>;\n\n    public get target(): InputState {\n        return this.tgt;\n    }\n\n    public uninstall(): void {}\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {TransitionBase} from \"./TransitionBase\";\nimport type {EventType, MouseEventType} from \"../../api/fsm/EventType\";\nimport type {InputState} from \"../../api/fsm/InputState\";\nimport type {OutputState} from \"../../api/fsm/OutputState\";\n\n/**\n * The base transition for mouse events.\n * @category FSM Transition\n */\nexport class MouseTransition extends TransitionBase<MouseEvent> {\n    private readonly acceptedEvents: ReadonlySet<EventType>;\n\n    /**\n     * Creates the transition.\n     * @param srcState - The source state of the transition\n     * @param tgtState - The output state of the transition\n     * @param types - The type of mouse event\n     * @param action - The action to execute when going through the transition\n     * @param guard - The guard to fulfil to execute the transition\n     */\n    public constructor(srcState: OutputState, tgtState: InputState, types: MouseEventType | ReadonlyArray<MouseEventType>,\n                       action?: (evt: MouseEvent) => void, guard?: (evt: MouseEvent) => boolean) {\n        super(srcState, tgtState, action, guard);\n        this.acceptedEvents = new Set(typeof types === \"string\" ? [types] : types);\n    }\n\n    public accept(event: Event): event is MouseEvent {\n        return event instanceof MouseEvent && this.getAcceptedEvents().has(event.type as EventType);\n    }\n\n    public getAcceptedEvents(): ReadonlySet<EventType> {\n        return this.acceptedEvents;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {MouseTransition} from \"./MouseTransition\";\nimport type {InputState} from \"../../api/fsm/InputState\";\nimport type {OutputState} from \"../../api/fsm/OutputState\";\n\n/**\n * This transition corresponds to a pressure of a button of a pointing device.\n * @category FSM Transition\n */\nexport class ClickTransition extends MouseTransition {\n    /**\n     * Creates the transition.\n     * @param srcState - The source state of the transition\n     * @param tgtState - The output state of the transition\n     * @param action - The action to execute when going through the transition\n     * @param guard - The guard to fulfil to execute the transition\n     */\n    public constructor(srcState: OutputState, tgtState: InputState,\n                       action?: (evt: MouseEvent) => void, guard?: (evt: MouseEvent) => boolean) {\n        super(srcState, tgtState, [\"click\", \"auxclick\"], action, guard);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport type {FSM} from \"../../api/fsm/FSM\";\nimport type {State} from \"../../api/fsm/State\";\nimport type {VisitorFSM} from \"../../api/fsm/VisitorFSM\";\n\n/**\n * The base implementation of the State interface.\n * @category FSM\n */\nexport abstract class StateBase implements State {\n    public readonly fsm: FSM;\n\n    public readonly name: string;\n\n    /**\n     * Creates the state.\n     * @param stateMachine - The FSM that will contain the state.\n     * @param stateName - The name of this state.\n     */\n    public constructor(stateMachine: FSM, stateName: string) {\n        this.fsm = stateMachine;\n        this.name = stateName;\n    }\n\n    public checkStartingState(): void {\n        if (!this.fsm.started && this.fsm.startingState === this) {\n            this.fsm.onStarting();\n        }\n    }\n\n    public uninstall(): void {}\n\n    public abstract acceptVisitor(visitor: VisitorFSM): void;\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {StateBase} from \"./StateBase\";\nimport type {InputState} from \"../../api/fsm/InputState\";\nimport type {VisitorFSM} from \"../../api/fsm/VisitorFSM\";\n\n/**\n * A state of an FSM.\n * A cancelling state cancels the FSM of a user interaction.\n * @category FSM\n */\nexport class CancellingState extends StateBase implements InputState {\n    public enter(): void {\n        this.fsm.onCancelling();\n    }\n\n    public override uninstall(): void {}\n\n    public override acceptVisitor(visitor: VisitorFSM): void {\n        visitor.visitCancellingState(this);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\n/**\n * Searches for a touch.\n * @param touches - The list of touches to search in.\n * @param idToFind - The ID of the touch to find.\n * @returns The found touch or nothing.\n * @category Helper\n */\nexport function getTouch(touches: TouchList, idToFind?: number): Touch | undefined {\n    for (const touch of touches) {\n        if (touch.identifier === idToFind) {\n            return touch;\n        }\n    }\n    return undefined;\n}\n\n/**\n * Tests whether the given object is a HTML button.\n * @param target - The object to test.\n * @returns True: the object is a HTML button\n * @category Helper\n */\nexport function isButton(target: EventTarget): target is HTMLButtonElement {\n    return target instanceof HTMLButtonElement;\n}\n\n/**\n * Tests whether the given object is a HTML checkbox.\n * @param target - The object to test.\n * @returns True: the object is a HTML checkbox.\n * @category Helper\n */\nexport function isCheckBox(target: EventTarget): target is HTMLInputElement {\n    return target instanceof HTMLInputElement && target.getAttribute(\"type\") === \"checkbox\";\n}\n\n/**\n * Tests whether the given object is a HTML ColorChoice.\n * @param target - The object to test.\n * @returns True: the object is a HTML ColorChoice.\n * @category Helper\n */\nexport function isColorChoice(target: EventTarget): target is HTMLInputElement {\n    return target instanceof HTMLInputElement && target.getAttribute(\"type\") === \"color\";\n}\n\n/**\n * Tests whether the given object is a HTML ComboBox.\n * @param target - The object to test.\n * @returns True: the object is a HTML ComboBox\n * @category Helper\n */\nexport function isComboBox(target: EventTarget): target is HTMLSelectElement {\n    return target instanceof HTMLSelectElement;\n}\n\n/**\n * Tests whether the given object is a HTML DatePicker.\n * @param target - The object to test.\n * @returns True: the object is a HTML DatePicker\n * @category Helper\n */\nexport function isDatePicker(target: EventTarget): target is HTMLInputElement {\n    return target instanceof HTMLInputElement && target.getAttribute(\"type\") === \"date\";\n}\n\n/**\n * Tests whether the given object is a HTML spinner.\n * @param target - The object to test.\n * @returns True: the object is a HTML spinner\n * @category Helper\n */\nexport function isSpinner(target: EventTarget): target is HTMLInputElement {\n    return target instanceof HTMLInputElement && target.getAttribute(\"type\") === \"number\";\n}\n\n/**\n * Tests whether the given object is a HTML hyperlink.\n * @param target - The object to test.\n * @returns True: the object is a HTML hyperlink\n * @category Helper\n */\nexport function isHyperLink(target: EventTarget): target is HTMLAnchorElement {\n    return target instanceof HTMLAnchorElement;\n}\n\n/**\n * Tests whether the given object is a HTML text input.\n * @param target - The object to test.\n * @returns True: the object is a HTML text input\n * @category Helper\n */\nexport function isTextInput(target: EventTarget): target is HTMLInputElement | HTMLTextAreaElement {\n    return (target instanceof HTMLInputElement && target.getAttribute(\"type\") === \"text\") ||\n      target instanceof HTMLTextAreaElement;\n}\n\n/**\n * Tests whether the given object is a keydown event.\n * @param event - The object to test.\n * @returns True: the object is a keydown event\n * @category Helper\n */\nexport function isKeyDownEvent(event: Event): event is KeyboardEvent {\n    return event instanceof KeyboardEvent && event.type === \"keydown\";\n}\n\n/**\n * Tests whether the given object is a keyup event.\n * @param event - The object to test.\n * @returns True: the object is a keyup event\n * @category Helper\n */\nexport function isKeyUpEvent(event: Event): event is KeyboardEvent {\n    return event instanceof KeyboardEvent && event.type === \"keyup\";\n}\n\n/**\n * A list of key codes.\n * @category Helper\n */\nexport enum KeyCode {\n    escape = 27\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {CancelFSMError} from \"./CancelFSMError\";\nimport {StateBase} from \"./StateBase\";\nimport type {FSM} from \"../../api/fsm/FSM\";\nimport type {OutputState} from \"../../api/fsm/OutputState\";\nimport type {Transition} from \"../../api/fsm/Transition\";\n\n/**\n * Base implementation of the OutputState interface.\n * @category FSM\n */\nexport abstract class OutputStateBase extends StateBase implements OutputState {\n    protected readonly _transitions: Array<Transition<Event>>;\n\n    /**\n     * Creates the state.\n     * @param stateMachine - The FSM that will contain the state.\n     * @param stateName - The name of this state.\n     */\n    public constructor(stateMachine: FSM, stateName: string) {\n        super(stateMachine, stateName);\n        this._transitions = [];\n    }\n\n    public process(event: Event): boolean {\n        return this.transitions.some(tr => {\n            try {\n                return tr.execute(event) !== undefined;\n            } catch (error: unknown) {\n                if (error instanceof CancelFSMError) {\n                    // Already processed\n                    return false;\n                }\n                throw error;\n            }\n        });\n    }\n\n    public clearTransitions(): void {\n        this._transitions.length = 0;\n    }\n\n    public get transitions(): ReadonlyArray<Transition<Event>> {\n        return Array.from(this._transitions);\n    }\n\n    public addTransition(tr: Transition<Event>): void {\n        this._transitions.push(tr);\n    }\n\n    public abstract exit(): void;\n\n    public override uninstall(): void {\n        super.uninstall();\n        for (const tr of this.transitions) {\n            tr.uninstall();\n        }\n        this._transitions.length = 0;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {OutputStateBase} from \"./OutputStateBase\";\nimport type {VisitorFSM} from \"../../api/fsm/VisitorFSM\";\n\n/**\n * An FSM state.\n * An initial state is the unique state that can start an FSM.\n * @category FSM\n */\nexport class InitState extends OutputStateBase {\n    public exit(): void {\n        this.checkStartingState();\n    }\n\n    public acceptVisitor(visitor: VisitorFSM): void {\n        visitor.visitInitState(this);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {OutputStateBase} from \"./OutputStateBase\";\nimport type {InputState} from \"../../api/fsm/InputState\";\nimport type {VisitorFSM} from \"../../api/fsm/VisitorFSM\";\n\n/**\n * An FSM state.\n * A standard state can compose an FSM.\n * They do not start, stop, cancel an FSM.\n * They accept input and output events.\n * @category FSM\n */\nexport class StdState extends OutputStateBase implements InputState {\n    public enter(): void {\n        this.checkStartingState();\n        this.fsm.enterStdState(this);\n    }\n\n    public exit(): void {}\n\n    public acceptVisitor(visitor: VisitorFSM): void {\n        visitor.visitState(this);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {StateBase} from \"./StateBase\";\nimport type {InputState} from \"../../api/fsm/InputState\";\nimport type {VisitorFSM} from \"../../api/fsm/VisitorFSM\";\n\n/**\n * An FSM state.\n * A terminal state ends normally an FSM.\n * @typeParam E - The type of events the FSM processes.\n * @category FSM\n */\nexport class TerminalState extends StateBase implements InputState {\n    public enter(): void {\n        this.checkStartingState();\n        this.fsm.onTerminating();\n    }\n\n    public override acceptVisitor(visitor: VisitorFSM): void {\n        visitor.visitTerminalState(this);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {TransitionBase} from \"./TransitionBase\";\nimport type {EventType} from \"../../api/fsm/EventType\";\nimport type {InputState} from \"../../api/fsm/InputState\";\nimport type {OutputState} from \"../../api/fsm/OutputState\";\nimport type {VisitorFSM} from \"../../api/fsm/VisitorFSM\";\nimport type {Logger} from \"../../api/logging/Logger\";\n\n/**\n * A timeout transition is an FSM transition that is not executed by an event:\n * the FSM goes through such a transition on a timeout.\n * @category FSM Transition\n */\nexport class TimeoutTransition extends TransitionBase<Event> {\n    /**\n     * The timeoutDuration in ms.\n     */\n    private readonly timeoutDuration: () => number;\n\n    private readonly logger: Logger | undefined;\n\n    /**\n     * The current thread in progress.\n     */\n    private timeoutThread: number | undefined;\n\n    private timeouted: boolean;\n\n    /**\n     * Creates the timeout transition.\n     * @param srcState - The source state of the transition.\n     * @param tgtState - The output state of the transition.\n     * @param timeout - The function that returns the timeout value in ms.\n     * @param logger - The logger to use.\n     * @param action - The action to execute when going through the transition\n     */\n    public constructor(srcState: OutputState, tgtState: InputState, timeout: () => number, logger?: Logger,\n                       action?: (evt: Event) => void) {\n        super(srcState, tgtState, action, () => this.timeouted);\n        this.logger = logger;\n        this.timeouted = false;\n        this.timeoutDuration = timeout;\n        this.timeouted = false;\n    }\n\n    /**\n     * Launches the timer.\n     */\n    public startTimeout(): void {\n        if (this.timeoutThread === undefined) {\n            const time = this.timeoutDuration();\n            // If incorrect duration value, no thread created\n            if (time <= 0) {\n                this.src.fsm.onTimeout();\n                return;\n            }\n\n            this.timeoutThread = globalThis.window.setTimeout(() => {\n                try {\n                    this.timeouted = true;\n                    this.src.fsm.onTimeout();\n                } catch (error: unknown) {\n                    this.logger?.logInteractionErr(\"Exception on timeout of a timeout transition\", error);\n                }\n            }, time);\n        }\n    }\n\n    /**\n     * Stops the timer.\n     */\n    public stopTimeout(): void {\n        if (this.timeoutThread !== undefined) {\n            clearTimeout(this.timeoutThread);\n            this.timeoutThread = undefined;\n        }\n    }\n\n    public accept(_event?: Event): _event is Event {\n        return this.timeouted;\n    }\n\n    public override execute(event?: Event): InputState | undefined {\n        try {\n            if (this.accept(event) && this.guard(event)) {\n                this.src.exit();\n                this.action(event);\n                this.tgt.enter();\n                this.timeouted = false;\n                return this.tgt;\n            }\n            return undefined;\n        } catch (error: unknown) {\n            this.timeouted = false;\n            throw error;\n        }\n    }\n\n    public getAcceptedEvents(): ReadonlySet<EventType> {\n        return new Set();\n    }\n\n    public override acceptVisitor(visitor: VisitorFSM): void {\n        visitor.visitTimeoutTransition(this);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\n/**\n * Removes the given element from the array.\n * @param array - The array to mutate.\n * @param elt - The element to remove.\n * @category Helper\n */\nexport function remove<T>(array: Array<T>, elt: T): void {\n    const index = array.indexOf(elt);\n    if (index !== -1) {\n        array.splice(index, 1);\n    }\n}\n\n/**\n * Removes the element at the given position.\n * @param array - The array to mutate.\n * @param index - The index where to remove\n * @returns The removed element or nothing.\n * @category Helper\n */\nexport function removeAt<T>(array: Array<T>, index: number): T | undefined {\n    if (index > -1) {\n        return array.splice(index, 1)[0];\n    }\n    return undefined;\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {CancelFSMError} from \"./CancelFSMError\";\nimport {CancellingState} from \"./CancellingState\";\nimport {isKeyDownEvent, isKeyUpEvent} from \"./Events\";\nimport {InitState} from \"./InitState\";\nimport {StdState} from \"./StdState\";\nimport {TerminalState} from \"./TerminalState\";\nimport {TimeoutTransition} from \"./TimeoutTransition\";\nimport {isOutputStateType} from \"../../api/fsm/OutputState\";\nimport {MustBeUndoableCmdError} from \"../binding/MustBeUndoableCmdError\";\nimport {remove, removeAt} from \"../util/ArrayUtil\";\nimport {Subject} from \"rxjs\";\nimport type {FSM} from \"../../api/fsm/FSM\";\nimport type {FSMHandler} from \"../../api/fsm/FSMHandler\";\nimport type {InputState} from \"../../api/fsm/InputState\";\nimport type {OutputState} from \"../../api/fsm/OutputState\";\nimport type {State} from \"../../api/fsm/State\";\nimport type {VisitorFSM} from \"../../api/fsm/VisitorFSM\";\nimport type {Logger} from \"../../api/logging/Logger\";\nimport type {Observable} from \"rxjs\";\n\n/**\n * A finite state machine that defines the behavior of a user interaction.\n * @category FSM\n */\nexport class FSMImpl implements FSM {\n    protected readonly logger: Logger;\n\n    public _log: boolean;\n\n    public inner: boolean;\n\n    public startingState: State;\n\n    /**\n     * Goes with 'startingState'. It permits to know whether the FSM has started, ie whether the 'starting state'\n     * has been reached.\n     */\n    protected _started: boolean;\n\n    public readonly initState: InitState;\n\n    protected _currentState: OutputState;\n\n    protected readonly currentStatePublisher: Subject<[OutputState, OutputState]>;\n\n    /**\n     * The states that compose the finite state machine.\n     */\n    protected readonly _states: Array<State>;\n\n    /**\n     * The handlers to be notified on FSM state changes.\n     */\n    protected readonly handlers: Array<FSMHandler>;\n\n    /**\n     * The events still in process. For example when the user press key ctrl and scroll one time using\n     * the wheel of the mouse, the interaction scrolling is\n     * finished but the event keyPressed 'ctrl' is still in process. At the end of the interaction, these events\n     * are re-introduced into the\n     * state machine of the interaction for processing.\n     */\n    protected readonly eventsToProcess: Array<Event>;\n\n    /**\n     * The current timeout in progress.\n     */\n    protected currentTimeout: TimeoutTransition | undefined;\n\n    public currentSubFSM: FSM | undefined;\n\n    /**\n     * Creates the FSM.\n     * @param logger - The logger to use for logging FSM messages\n     */\n    public constructor(logger: Logger) {\n        this.logger = logger;\n        this.inner = false;\n        this._started = false;\n        this.initState = new InitState(this, \"init\");\n        this._states = [this.initState];\n        this.startingState = this.initState;\n        this._currentState = this.initState;\n        this.currentStatePublisher = new Subject();\n        this.handlers = [];\n        this.eventsToProcess = [];\n        this.currentSubFSM = undefined;\n        this._log = false;\n    }\n\n    public get currentState(): OutputState {\n        return this._currentState;\n    }\n\n    public set currentState(state: OutputState) {\n        const old = this._currentState;\n        this._currentState = state;\n        this.currentStatePublisher.next([old, this._currentState]);\n    }\n\n    public get currentStateObservable(): Observable<[OutputState, OutputState]> {\n        return this.currentStatePublisher;\n    }\n\n    public process(event: Event): boolean {\n        // Removing the possible corresponding and pending key pressed event\n        if (isKeyUpEvent(event)) {\n            this.removeKeyEvent(event.code);\n        }\n\n        // Processing the event\n        const processed: boolean = this.processEvent(event);\n\n        // Recycling events\n        if (processed && isKeyDownEvent(event) && !(this._currentState instanceof InitState) &&\n          !this.eventsToProcess.some(evt => isKeyDownEvent(evt) && evt.code === event.code)) {\n            this.addRemaningEventsToProcess(event);\n        }\n\n        return processed;\n    }\n\n    private processEvent(event: Event): boolean {\n        if (this.currentSubFSM !== undefined) {\n            if (this.log) {\n                this.logger.logInteractionMsg(`processing event ${String(event.type)} in a sub-FSM`, this.constructor.name);\n            }\n            return this.currentSubFSM.process(event);\n        }\n        if (this.log) {\n            this.logger.logInteractionMsg(`processing event ${String(event.type)} at state\n            ${this.currentState.name}: ${this.constructor.name}`, this.constructor.name);\n        }\n\n        try {\n            return this.currentState.process(event);\n        } catch (error: unknown) {\n            this.notifyHandlerOnError(error);\n            return false;\n        }\n    }\n\n    public acceptVisitor(visitor: VisitorFSM): void {\n        visitor.visitFSM(this);\n    }\n\n    public get log(): boolean {\n        return this._log;\n    }\n\n    public set log(log: boolean) {\n        this._log = log;\n    }\n\n    /**\n     * Removes the given KeyPress event from the events 'still in process' list.\n     * @param key - The key code of the event to remove.\n     */\n    private removeKeyEvent(key: string): void {\n        let removed = false;\n\n        for (let i = 0, size = this.eventsToProcess.length; i < size && !removed; i++) {\n            const event = this.eventsToProcess[i];\n\n            if (event instanceof KeyboardEvent && event.code === key) {\n                removed = true;\n                removeAt(this.eventsToProcess, i);\n            }\n        }\n    }\n\n    public enterStdState(state: InputState & OutputState): void {\n        this.currentState = state;\n        this.checkTimeoutTransition();\n        if (this.started) {\n            this.onUpdating();\n        }\n    }\n\n    public get started(): boolean {\n        return this._started;\n    }\n\n    /**\n     * The end of the FSM execution, the events still (eg keyPress) in process must be recycled to be reused in the FSM.\n     */\n    protected processRemainingEvents(): void {\n        const list: ReadonlyArray<Event> = Array.from(this.eventsToProcess);\n\n        for (const event of list) {\n            removeAt(this.eventsToProcess, 0);\n            if (this.log) {\n                this.logger.logInteractionMsg(\"Recycling event\", this.constructor.name);\n            }\n            this.process(event);\n        }\n    }\n\n    public addRemaningEventsToProcess(event: Event): void {\n        this.eventsToProcess.push(event);\n    }\n\n    public onError(err: unknown): void {\n        this.notifyHandlerOnError(err);\n    }\n\n    public onTerminating(): void {\n        if (this.log) {\n            this.logger.logInteractionMsg(\"FSM ended\", this.constructor.name);\n        }\n        if (this.started) {\n            this.notifyHandlerOnStop();\n        }\n        this.reinit();\n        this.processRemainingEvents();\n    }\n\n    public onCancelling(): void {\n        if (this.log) {\n            this.logger.logInteractionMsg(\"FSM cancelled\", this.constructor.name);\n        }\n        if (this.started) {\n            this.notifyHandlerOnCancel();\n        }\n        this.fullReinit();\n    }\n\n    public onStarting(): void {\n        if (this.log) {\n            this.logger.logInteractionMsg(\"FSM started\", this.constructor.name);\n        }\n        this._started = true;\n        this.notifyHandlerOnStart();\n    }\n\n    /**\n     * Updates the state machine.\n     */\n    public onUpdating(): void {\n        if (this.started) {\n            if (this.log) {\n                this.logger.logInteractionMsg(\"FSM updated\", this.constructor.name);\n            }\n            this.notifyHandlerOnUpdate();\n        }\n    }\n\n    /**\n     * Adds a standard state to the state machine.\n     * @param name - The name of the state to add.\n     * @param startingState - States whether the new state is the one that starts the FSM.\n     * @returns The created state.\n     */\n    public addStdState(name: string, startingState = false): StdState {\n        const state = new StdState(this, name);\n        this.addState(state, startingState);\n        return state;\n    }\n\n    /**\n     * Adds a terminal state to the state machine.\n     * @param name - The name of the state to add.\n     * @param startingState - States whether the new state is the one that starts the FSM.\n     * @returns The created state.\n     */\n    public addTerminalState(name: string, startingState = false): TerminalState {\n        const state = new TerminalState(this, name);\n        this.addState(state, startingState);\n        return state;\n    }\n\n    /**\n     * Adds a cancelling state to the state machine.\n     * @param name - The name of the state to add.\n     * @returns The created state.\n     */\n    public addCancellingState(name: string): CancellingState {\n        const state = new CancellingState(this, name);\n        this.addState(state);\n        return state;\n    }\n\n    private addState(state: InputState, startingState = false): void {\n        this._states.push(state);\n        if (startingState) {\n            this.startingState = state;\n        }\n    }\n\n    public reinit(): void {\n        if (this.log) {\n            this.logger.logInteractionMsg(\"FSM reinitialised\", this.constructor.name);\n        }\n        this.currentTimeout?.stopTimeout();\n        this._started = false;\n        this.currentState = this.initState;\n        this.currentTimeout = undefined;\n        this.currentSubFSM?.reinit();\n\n        if (!this.inner) {\n            for (const handler of this.handlers) {\n                handler.fsmReinit?.();\n            }\n        }\n    }\n\n    public fullReinit(): void {\n        this.eventsToProcess.length = 0;\n        this.reinit();\n        this.currentSubFSM?.fullReinit();\n    }\n\n    public onTimeout(): void {\n        if (this.currentTimeout !== undefined) {\n            if (this.log) {\n                this.logger.logInteractionMsg(\"Timeout\", this.constructor.name);\n            }\n            const state = this.currentTimeout.execute();\n            if (isOutputStateType(state)) {\n                this.currentState = state;\n                this.checkTimeoutTransition();\n            }\n        }\n    }\n\n    public stopCurrentTimeout(): void {\n        if (this.currentTimeout !== undefined) {\n            if (this.log) {\n                this.logger.logInteractionMsg(\"Timeout stopped\", this.constructor.name);\n            }\n            this.currentTimeout.stopTimeout();\n            this.currentTimeout = undefined;\n        }\n    }\n\n    /**\n     * Checks whether the current state has a timeout transition.\n     * If it is the case, the timeout transition is launched.\n     */\n    protected checkTimeoutTransition(): void {\n        const tr = this.currentState.transitions.find(trans => trans instanceof TimeoutTransition);\n\n        if (tr !== undefined) {\n            if (this.log) {\n                this.logger.logInteractionMsg(\"Timeout starting\", this.constructor.name);\n            }\n            this.currentTimeout = tr;\n            this.currentTimeout.startTimeout();\n        }\n    }\n\n    public addHandler(handler: FSMHandler): void {\n        this.handlers.push(handler);\n    }\n\n    public removeHandler(handler: FSMHandler): void {\n        remove(this.handlers, handler);\n    }\n\n    /**\n     * Notifies handler that the interaction starts.\n     */\n    protected notifyHandlerOnStart(): void {\n        try {\n            const hs = Array.from(this.handlers);\n\n            for (const handler of hs) {\n                handler.preFsmStart?.();\n            }\n\n            for (const handler of hs) {\n                handler.fsmStarts?.();\n            }\n        } catch (error: unknown) {\n            if (!(error instanceof CancelFSMError || error instanceof MustBeUndoableCmdError)) {\n                this.logger.logInteractionErr(\"An 'fsmStarts' produced an error\", error, this.constructor.name);\n            }\n            this.onCancelling();\n            throw error;\n        }\n    }\n\n    /**\n     * Notifies handler that the interaction updates.\n     */\n    protected notifyHandlerOnUpdate(): void {\n        try {\n            const hs = Array.from(this.handlers);\n\n            for (const handler of hs) {\n                handler.preFsmUpdate?.();\n            }\n\n            for (const handler of hs) {\n                handler.fsmUpdates?.();\n            }\n        } catch (error: unknown) {\n            if (!(error instanceof CancelFSMError || error instanceof MustBeUndoableCmdError)) {\n                this.logger.logInteractionErr(\"An 'fsmUpdates' produced an error\", error, this.constructor.name);\n            }\n            this.onCancelling();\n            throw error;\n        }\n    }\n\n    /**\n     * Notifies handler that the interaction stops.\n     */\n    public notifyHandlerOnStop(): void {\n        try {\n            const hs = Array.from(this.handlers);\n\n            for (const handler of hs) {\n                handler.preFsmStop?.();\n            }\n\n            for (const handler of hs) {\n                handler.fsmStops?.();\n            }\n        } catch (error: unknown) {\n            if (!(error instanceof CancelFSMError || error instanceof MustBeUndoableCmdError)) {\n                this.logger.logInteractionErr(\"An 'fsmStops' produced an error\", error, this.constructor.name);\n            }\n            this.onCancelling();\n            throw error;\n        }\n    }\n\n    /**\n     * Notifies handler that the interaction is cancelled.\n     */\n    protected notifyHandlerOnCancel(): void {\n        try {\n            for (const handler of Array.from(this.handlers)) {\n                handler.fsmCancels?.();\n            }\n        } catch (error: unknown) {\n            if (!(error instanceof MustBeUndoableCmdError)) {\n                this.logger.logInteractionErr(\"An 'fsmCancels' produced an error\", error, this.constructor.name);\n            }\n            throw error;\n        }\n    }\n\n    /**\n     * Notifies handlers that an error occured.\n     * @param err - The error to handle\n     */\n    protected notifyHandlerOnError(err: unknown): void {\n        try {\n            for (const handler of Array.from(this.handlers)) {\n                handler.fsmError?.(err);\n            }\n        } catch (error: unknown) {\n            this.logger.logInteractionErr(\"An 'fsmError' produced an error\", error, this.constructor.name);\n        }\n    }\n\n    public get states(): ReadonlyArray<State> {\n        return Array.from(this._states);\n    }\n\n    public getEventsToProcess(): ReadonlyArray<Event> {\n        return Array.from(this.eventsToProcess);\n    }\n\n    public uninstall(): void {\n        this.fullReinit();\n        this.log = false;\n        this.currentStatePublisher.complete();\n        this.currentSubFSM = undefined;\n        for (const state of this._states) {\n            state.uninstall();\n        }\n        this._states.length = 0;\n        this.handlers.length = 0;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {keyEventTypes, mouseEventTypes, touchEventTypes} from \"../../api/fsm/EventType\";\nimport {InitState} from \"../fsm/InitState\";\nimport type {Flushable} from \"./Flushable\";\nimport type {EventType, KeyEventType, MouseEventType, TouchEventType} from \"../../api/fsm/EventType\";\nimport type {FSM} from \"../../api/fsm/FSM\";\nimport type {OutputState} from \"../../api/fsm/OutputState\";\nimport type {Interaction} from \"../../api/interaction/Interaction\";\nimport type {VisitorInteraction} from \"../../api/interaction/VisitorInteraction\";\nimport type {Logger} from \"../../api/logging/Logger\";\nimport type {Subscription} from \"rxjs\";\n\n/**\n * A promise that is cancellable.\n */\nexport interface CancellablePromise extends Promise<void> {\n    /**\n     * Called when the promise is cancelled.\n     */\n    cancel: () => void;\n}\n\n/**\n * The base implementation of a user interaction.\n * @typeParam D - The type of the interaction data.\n * @typeParam F - The type of the FSM.\n * @category Interaction\n */\nexport abstract class InteractionBase<D extends object, DImpl extends D & Flushable, F extends FSM = FSM> implements Interaction<D> {\n    /**\n     * The current nodes that the interaction works on\n     */\n    protected readonly _registeredNodes: Set<unknown>;\n\n    protected readonly _dynamicRegisteredNodes: Set<unknown>;\n\n    protected readonly _fsm: F;\n\n    protected readonly _name: string;\n\n    protected _log: boolean;\n\n    /** The current list of mutation observers. Used for listening changes in node lists. */\n    protected readonly mutationObservers: Array<MutationObserver>;\n\n    /** The interaction data */\n    protected readonly _data: DImpl;\n\n    protected readonly logger: Logger;\n\n    private mouseHandler?: (e: MouseEvent) => void;\n\n    private touchHandler?: (e: TouchEvent) => void;\n\n    private keyHandler?: (e: KeyboardEvent) => void;\n\n    private uiHandler?: (e: UIEvent) => void;\n\n    private actionHandler?: EventListener;\n\n    private readonly disposable: Subscription;\n\n    private stopImmediatePropag: boolean;\n\n    private preventDef: boolean;\n\n    /**\n     * Defines if the interaction is activated or not. If not, the interaction will not\n     * change on events.\n     */\n    protected activated: boolean;\n\n    protected throttleTimeout: number;\n\n    protected currentThrottling: CancellablePromise | undefined;\n\n    protected latestThrottledEvent: Event | undefined;\n\n    /**\n     * Creates the interaction.\n     * @param fsm - The FSM that defines the behavior of the user interaction.\n     * @param data - The interaction data.\n     * @param logger - The logger to use for this interaction\n     * @param name - The real name of the interaction\n     * @param reinitDataOnFSMReinit - Reinits the interaction data when the FSM is reinitialized. True by default\n     */\n    protected constructor(fsm: F, data: DImpl, logger: Logger, name: string, reinitDataOnFSMReinit = true) {\n        this._name = name;\n        this.logger = logger;\n        this.activated = false;\n        this.stopImmediatePropag = false;\n        this.preventDef = false;\n        this._data = data;\n        this._fsm = fsm;\n        this.disposable = this._fsm.currentStateObservable.subscribe(current => {\n            this.updateEventsRegistered(current[1], current[0]);\n        });\n        this.activated = true;\n        this._log = false;\n        this._registeredNodes = new Set<unknown>();\n        this._dynamicRegisteredNodes = new Set<unknown>();\n        this.mutationObservers = [];\n        this.throttleTimeout = 0;\n\n        if (reinitDataOnFSMReinit) {\n            this.fsm.addHandler({\n                \"fsmReinit\": () => {\n                    this.reinitData();\n                }\n            });\n        }\n    }\n\n    public reinitData(): void {\n        this._data.flush();\n    }\n\n    public get data(): D {\n        return this._data;\n    }\n\n    public get name(): string {\n        return this._name;\n    }\n\n    public setThrottleTimeout(timeout: number): void {\n        this.throttleTimeout = timeout;\n    }\n\n    private createThrottleTimeout(): void {\n        this.currentThrottling?.cancel();\n        this.currentThrottling = undefined;\n\n        const currTimeout = this.throttleTimeout;\n        let rejection: (reason?: unknown) => void;\n        let timeout: NodeJS.Timeout;\n\n        this.currentThrottling = new Promise<void>(\n            (resolve, reject) => {\n                rejection = reject;\n                timeout = setTimeout(() => {\n                    try {\n                        /*\n                         * Do not put this code into the then block\n                         * as it must be executed BEFORE resolving the promise.\n                         */\n                        const evt: Event | undefined = this.latestThrottledEvent;\n                        this.latestThrottledEvent = undefined;\n                        if (evt !== undefined) {\n                            this.directEventProcess(evt);\n                        }\n                        resolve();\n                    } catch (error: unknown) {\n                        rejection(error);\n                    }\n                }, currTimeout);\n            }\n        ).catch((error: unknown) => {\n            this.logger.logInteractionErr(\"Error during the throttling process\", error, this.constructor.name);\n        }) as CancellablePromise;\n\n        this.currentThrottling.cancel = (): void => {\n            clearTimeout(timeout);\n            rejection(new Error(\"cancellation\"));\n        };\n    }\n\n    private checkThrottlingEvent(event: Event): void {\n        const latestEvt = this.latestThrottledEvent;\n\n        if (latestEvt === undefined || latestEvt.type !== event.type) {\n            if (latestEvt !== undefined) {\n                this.directEventProcess(latestEvt);\n            }\n            this.latestThrottledEvent = event;\n            this.createThrottleTimeout();\n        } else {\n            // The previous throttled event is ignored\n            this.latestThrottledEvent = event;\n        }\n    }\n\n    protected updateEventsRegistered(newState: OutputState, oldState: OutputState): void {\n        // Do nothing when the interaction has only two nodes: init node and terminal node (this is a single-event interaction).\n        if (newState === oldState || this._fsm.states.length === 2) {\n            return;\n        }\n\n        const currEvents: ReadonlyArray<EventType> = this.getCurrentAcceptedEvents(newState);\n        const events: ReadonlyArray<EventType> = Array.from(this.getEventTypesOf(oldState));\n        const eventsToRemove: ReadonlyArray<EventType> = events.filter(evt => !currEvents.includes(evt));\n        const eventsToAdd: ReadonlyArray<EventType> = currEvents.filter(evt => !events.includes(evt));\n        for (const node of this._registeredNodes) {\n            for (const type of eventsToRemove) {\n                this.unregisterEventToNode(type, node);\n            }\n            for (const type of eventsToAdd) {\n                this.registerEventToNode(type, node);\n            }\n        }\n    }\n\n    protected getCurrentAcceptedEvents(state: OutputState): ReadonlyArray<EventType> {\n        return Array.from(this.getEventTypesOf(state));\n    }\n\n    private callBackMutationObserver(mutationList: ReadonlyArray<MutationRecord>): void {\n        for (const mutation of mutationList) {\n            for (const node of mutation.addedNodes) {\n                this.registerToNodes([node]);\n            }\n            for (const node of mutation.removedNodes) {\n                this.unregisterFromNodes([node]);\n            }\n        }\n    }\n\n    protected getEventTypesOf(state: OutputState): ReadonlySet<EventType> {\n        // Optimisation to avoid map and reduce\n        const result = new Set<EventType>();\n        for (const trans of state.transitions) {\n            for (const evt of trans.getAcceptedEvents()) {\n                result.add(evt);\n            }\n        }\n        return result;\n    }\n\n    public registerToNodes(widgets: ReadonlyArray<unknown>): void {\n        for (const widget of widgets) {\n            this._registeredNodes.add(widget);\n            this.onNewNodeRegistered(widget);\n        }\n    }\n\n    protected unregisterFromNodes(widgets: ReadonlyArray<unknown>): void {\n        for (const widget of widgets) {\n            this._registeredNodes.delete(widget);\n            this.onNodeUnregistered(widget);\n        }\n    }\n\n    public onNodeUnregistered(node: unknown): void {\n        for (const type of this.getEventTypesOf(this._fsm.currentState)) {\n            this.unregisterEventToNode(type, node);\n        }\n    }\n\n    public onNewNodeRegistered(node: unknown): void {\n        for (const type of this.getEventTypesOf(this._fsm.currentState)) {\n            this.registerEventToNode(type, node);\n        }\n    }\n\n    public registerToNodeChildren(elementToObserve: Node): void {\n        this._dynamicRegisteredNodes.add(elementToObserve);\n\n        for (const node of elementToObserve.childNodes) {\n            this.registerToNodes([node]);\n        }\n\n        const newMutationObserver = new MutationObserver(mutations => {\n            this.callBackMutationObserver(mutations);\n        });\n        newMutationObserver.observe(elementToObserve, {\"childList\": true});\n        this.mutationObservers.push(newMutationObserver);\n    }\n\n    protected registerEventToNode(eventType: EventType, node: unknown): void {\n        if (!(node instanceof EventTarget)) {\n            return;\n        }\n\n        if (mouseEventTypes.includes(eventType as MouseEventType) || eventType === (\"wheel\" satisfies EventType)) {\n            node.addEventListener(eventType, this.getMouseHandler());\n            return;\n        }\n        if (touchEventTypes.includes(eventType as TouchEventType)) {\n            node.addEventListener(eventType, this.getTouchHandler());\n            return;\n        }\n        if (keyEventTypes.includes(eventType as KeyEventType)) {\n            node.addEventListener(eventType, this.getKeyHandler());\n            return;\n        }\n        if (eventType === (\"scroll\" satisfies EventType)) {\n            node.addEventListener(eventType, this.getUIHandler());\n\n        }\n    }\n\n    protected unregisterEventToNode(eventType: EventType, node: unknown): void {\n        if (!(node instanceof EventTarget)) {\n            return;\n        }\n        if (mouseEventTypes.includes(eventType as MouseEventType) || eventType === (\"wheel\" satisfies EventType)) {\n            node.removeEventListener(eventType, this.getMouseHandler());\n            return;\n        }\n        if (touchEventTypes.includes(eventType as TouchEventType)) {\n            node.removeEventListener(eventType, this.getTouchHandler());\n            return;\n        }\n        if (keyEventTypes.includes(eventType as KeyEventType)) {\n            node.removeEventListener(eventType, this.getKeyHandler());\n            return;\n        }\n        if (eventType === (\"scroll\" satisfies EventType)) {\n            node.removeEventListener(eventType, this.getUIHandler());\n\n        }\n    }\n\n    protected registerActionHandlerClick(node: EventTarget): void {\n        node.addEventListener(\"click\" satisfies EventType, this.getActionHandler());\n        node.addEventListener(\"auxclick\" satisfies EventType, this.getActionHandler());\n    }\n\n    protected unregisterActionHandlerClick(node: EventTarget): void {\n        node.removeEventListener(\"click\" satisfies EventType, this.getActionHandler());\n        node.removeEventListener(\"auxclick\" satisfies EventType, this.getActionHandler());\n    }\n\n    protected registerActionHandlerInput(node: EventTarget): void {\n        node.addEventListener(\"input\" satisfies EventType, this.getActionHandler());\n    }\n\n    protected unregisterActionHandlerInput(node: EventTarget): void {\n        node.removeEventListener(\"input\" satisfies EventType, this.getActionHandler());\n    }\n\n    protected getActionHandler(): EventListener {\n        if (this.actionHandler === undefined) {\n            this.actionHandler = (evt): void => {\n                this.processEvent(evt);\n            };\n        }\n        return this.actionHandler;\n    }\n\n    protected getMouseHandler(): EventListener {\n        if (this.mouseHandler === undefined) {\n            this.mouseHandler = (evt: MouseEvent): void => {\n                this.processEvent(evt);\n            };\n        }\n        return this.mouseHandler as EventListener;\n    }\n\n    protected getTouchHandler(): EventListener {\n        if (this.touchHandler === undefined) {\n            this.touchHandler = (evt: TouchEvent): void => {\n                this.processEvent(evt);\n            };\n        }\n        return this.touchHandler as EventListener;\n    }\n\n    protected getKeyHandler(): EventListener {\n        if (this.keyHandler === undefined) {\n            this.keyHandler = (evt: KeyboardEvent): void => {\n                this.processEvent(evt);\n            };\n        }\n        return this.keyHandler as EventListener;\n    }\n\n    protected getUIHandler(): EventListener {\n        if (this.uiHandler === undefined) {\n            this.uiHandler = (evt: UIEvent): void => {\n                this.processEvent(evt);\n            };\n        }\n        return this.uiHandler as EventListener;\n    }\n\n    public isRunning(): boolean {\n        return this.activated && !(this._fsm.currentState instanceof InitState);\n    }\n\n    public fullReinit(): void {\n        this._fsm.fullReinit();\n    }\n\n    public set stopImmediatePropagation(stop: boolean) {\n        this.stopImmediatePropag = stop;\n    }\n\n    /**\n     * @returns True if the user interaction will stop immediately the propagation\n     * of events processed by this user interaction to others listeners.\n     */\n    public get stopImmediatePropagation(): boolean {\n        return this.stopImmediatePropag;\n    }\n\n    public set preventDefault(prevent: boolean) {\n        this.preventDef = prevent;\n    }\n\n    /**\n     * @returns True if the default behavior associated to the event will be executed.\n     */\n    public get preventDefault(): boolean {\n        return this.preventDef;\n    }\n\n    /**\n     * Processes the given UI event.\n     * @param event - The event to process.\n     */\n    public processEvent(event: Event): void {\n        if (this.isActivated()) {\n            if (this.throttleTimeout <= 0) {\n                this.directEventProcess(event);\n            } else {\n                this.checkThrottlingEvent(event);\n            }\n        }\n    }\n\n    private directEventProcess(event: Event): void {\n        const processed = this._fsm.process(event);\n\n        // preventdefault or stopPropa only if the event is processed by the FSM\n        if (processed) {\n            if (this.preventDef) {\n                event.preventDefault();\n            }\n            if (this.stopImmediatePropag) {\n                event.stopImmediatePropagation();\n            }\n        }\n    }\n\n    public log(log: boolean): void {\n        this._log = log;\n        this._fsm.log = log;\n    }\n\n    public isActivated(): boolean {\n        return this.activated;\n    }\n\n    public setActivated(activated: boolean): void {\n        if (this._log) {\n            this.logger.logInteractionMsg(`Interaction activation: ${String(activated)}`, this.constructor.name);\n        }\n        this.activated = activated;\n        if (!activated) {\n            this._fsm.fullReinit();\n        }\n    }\n\n    public get fsm(): F {\n        return this._fsm;\n    }\n\n    public reinit(): void {\n        this._fsm.reinit();\n        this.reinitData();\n    }\n\n    public uninstall(): void {\n        this.disposable.unsubscribe();\n        for (const node of this._registeredNodes) {\n            this.onNodeUnregistered(node);\n        }\n        this._registeredNodes.clear();\n        for (const obs of this.mutationObservers) {\n            obs.disconnect();\n        }\n        this.mutationObservers.length = 0;\n        this.setActivated(false);\n    }\n\n    public acceptVisitor(visitor: VisitorInteraction): void {\n        visitor.visitInteraction(this);\n    }\n\n    public get registeredNodes(): ReadonlySet<unknown> {\n        return this._registeredNodes;\n    }\n\n    public get dynamicRegisteredNodes(): ReadonlySet<unknown> {\n        return this._dynamicRegisteredNodes;\n    }\n}\n\n/**\n * Infers the type of the involved interaction data implementation\n * @category Interaction\n */\nexport type InteractionDataImplType<T> = T extends InteractionBase<object, infer DImpl> ? DImpl : never;\n\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {InteractionDataBase} from \"./InteractionDataBase\";\nimport type {PointBaseData} from \"../../api/interaction/PointBaseData\";\n\n/**\n * The base implementation class for single point interaction data.\n * @category Interaction Data\n */\nexport abstract class PointingDataBase extends InteractionDataBase implements PointBaseData {\n    protected clientXData = 0;\n\n    protected clientYData = 0;\n\n    protected pageXData = 0;\n\n    protected pageYData = 0;\n\n    protected screenXData = 0;\n\n    protected screenYData = 0;\n\n    protected altKeyData = false;\n\n    protected ctrlKeyData = false;\n\n    protected metaKeyData = false;\n\n    protected shiftKeyData = false;\n\n    public override flush(): void {\n        super.flush();\n        this.clientXData = 0;\n        this.clientYData = 0;\n        this.pageXData = 0;\n        this.pageYData = 0;\n        this.screenXData = 0;\n        this.screenYData = 0;\n        this.altKeyData = false;\n        this.ctrlKeyData = false;\n        this.metaKeyData = false;\n        this.shiftKeyData = false;\n    }\n\n    public override copy(data: PointBaseData): void {\n        super.copy(data);\n        /*\n         * Cannot use Object.assign because of a strange implementation of Event\n         * that prevents accessing the properties\n         */\n        this.clientXData = data.clientX;\n        this.clientYData = data.clientY;\n        this.pageXData = data.pageX;\n        this.pageYData = data.pageY;\n        this.screenXData = data.screenX;\n        this.screenYData = data.screenY;\n        this.altKeyData = data.altKey;\n        this.ctrlKeyData = data.ctrlKey;\n        this.metaKeyData = data.metaKey;\n        this.shiftKeyData = data.shiftKey;\n    }\n\n    public get clientX(): number {\n        return this.clientXData;\n    }\n\n    public get clientY(): number {\n        return this.clientYData;\n    }\n\n    public get pageX(): number {\n        return this.pageXData;\n    }\n\n    public get pageY(): number {\n        return this.pageYData;\n    }\n\n    public get screenX(): number {\n        return this.screenXData;\n    }\n\n    public get screenY(): number {\n        return this.screenYData;\n    }\n\n    public get altKey(): boolean {\n        return this.altKeyData;\n    }\n\n    public get ctrlKey(): boolean {\n        return this.ctrlKeyData;\n    }\n\n    public get metaKey(): boolean {\n        return this.metaKeyData;\n    }\n\n    public get shiftKey(): boolean {\n        return this.shiftKeyData;\n    }\n}\n","/* eslint-disable unicorn/no-null */\n/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {PointingDataBase} from \"./PointingDataBase\";\nimport type {PointData} from \"../../api/interaction/PointData\";\n\n/**\n * Single point interaction data implementation with write accesses.\n * @category Interaction Data\n */\nexport class PointDataImpl extends PointingDataBase implements PointData {\n    protected buttonData = 0;\n\n    protected buttonsData = 0;\n\n    protected movementXData = 0;\n\n    protected movementYData = 0;\n\n    protected offsetXData = 0;\n\n    protected offsetYData = 0;\n\n    protected relatedTargetData: EventTarget | null = null;\n\n    public override flush(): void {\n        super.flush();\n        this.buttonData = 0;\n        this.buttonsData = 0;\n        this.movementXData = 0;\n        this.movementYData = 0;\n        this.offsetXData = 0;\n        this.offsetYData = 0;\n        this.relatedTargetData = null;\n    }\n\n    public override copy(data: PointData): void {\n        super.copy(data);\n        /*\n         * Cannot use Object.assign because of a strange implementation of Event\n         * that prevents accessing the properties\n         */\n        this.buttonData = data.button;\n        this.buttonsData = data.buttons;\n        this.movementXData = data.movementX;\n        this.movementYData = data.movementY;\n        this.offsetXData = data.offsetX;\n        this.offsetYData = data.offsetY;\n        this.relatedTargetData = data.relatedTarget;\n    }\n\n    public get button(): number {\n        return this.buttonData;\n    }\n\n    public get buttons(): number {\n        return this.buttonsData;\n    }\n\n    public get movementX(): number {\n        return this.movementXData;\n    }\n\n    public get movementY(): number {\n        return this.movementYData;\n    }\n\n    public get offsetX(): number {\n        return this.offsetXData;\n    }\n\n    public get offsetY(): number {\n        return this.offsetYData;\n    }\n\n    public get relatedTarget(): EventTarget | null {\n        return this.relatedTargetData;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {ClickTransition} from \"../../fsm/ClickTransition\";\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {PointDataImpl} from \"../PointDataImpl\";\nimport type {PointData} from \"../../../api/interaction/PointData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\n/**\n * The FSM for click interactions\n * @category FSM\n */\nexport class ClickFSM extends FSMImpl {\n    private checkButton: number | undefined;\n\n    /**\n     * Creates the FSM\n     * @param logger - The logger to use for this interaction\n     * @param action - The action executed on a click\n     */\n    public constructor(logger: Logger, action?: (evt: MouseEvent) => void) {\n        super(logger);\n\n        new ClickTransition(this.initState, this.addTerminalState(\"clicked\"),\n            (evt: MouseEvent): void => {\n                this.setCheckButton(evt.button);\n                action?.(evt);\n            },\n            (evt: MouseEvent): boolean => this.checkButton === undefined || evt.button === this.checkButton);\n    }\n\n    public getCheckButton(): number {\n        return this.checkButton ?? -1;\n    }\n\n    public setCheckButton(buttonToCheck: number): void {\n        if (this.checkButton === undefined) {\n            this.checkButton = buttonToCheck;\n        }\n    }\n\n    public override reinit(): void {\n        super.reinit();\n        this.checkButton = undefined;\n    }\n}\n\n/**\n * The click interaction.\n * @category Interaction Library\n */\nexport class Click extends InteractionBase<PointData, PointDataImpl> {\n    /**\n     * Creates the interaction.\n     * @param logger - The logger to use for this interaction\n     * @param fsm - The optional FSM provided for the interaction\n     * @param data - The interaction data to use\n     * @param name - The name of the user interaction\n     */\n    public constructor(logger: Logger, fsm?: ClickFSM, data?: PointDataImpl, name?: string) {\n        const theFSM = fsm ?? new ClickFSM(logger, (evt: MouseEvent): void => {\n            this._data.copy(evt);\n        });\n        super(theFSM, data ?? new PointDataImpl(), logger, name ?? Click.name);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport type {PointBaseData} from \"../../api/interaction/PointBaseData\";\nimport type {PointsData} from \"../../api/interaction/PointsData\";\n\n/**\n * The base implementation class for interaction data that stores points.\n * @category Interaction Data\n */\nexport abstract class PointsDataImpl<D extends PointBaseData> implements PointsData<D> {\n    protected readonly pointsData: Array<D>;\n\n    public constructor() {\n        this.pointsData = [];\n    }\n\n    public get points(): ReadonlyArray<D> {\n        return Array.from(this.pointsData);\n    }\n\n    public addPoint(ptData: D): void {\n        this.pointsData.push(ptData);\n    }\n\n    public flush(): void {\n        this.pointsData.length = 0;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {PointsDataImpl} from \"./PointsDataImpl\";\nimport type {PointData} from \"../../api/interaction/PointData\";\n\n/**\n * Tapping interaction data implementation\n * @category Interaction Data\n */\nexport class MousePointsDataImpl extends PointsDataImpl<PointData> {\n    private currentPositionData: PointData | undefined;\n\n    public get currentPosition(): PointData | undefined {\n        return this.currentPositionData;\n    }\n\n    public set currentPosition(position: PointData | undefined) {\n        this.currentPositionData = position;\n    }\n\n    public get lastButton(): number | undefined {\n        return this.pointsData.at(-1)?.button;\n    }\n\n    public override flush(): void {\n        super.flush();\n        this.currentPositionData = undefined;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {ClickTransition} from \"../../fsm/ClickTransition\";\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {TimeoutTransition} from \"../../fsm/TimeoutTransition\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {MousePointsDataImpl} from \"../MousePointsDataImpl\";\nimport {PointDataImpl} from \"../PointDataImpl\";\nimport type {MousePointsData} from \"../../../api/interaction/MousePointsData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\n/**\n * The FSM that defines the behavior of the clicks interaction\n * @category FSM\n */\nexport class ClicksFSM extends FSMImpl {\n    private countClicks: number;\n\n    private readonly nbClicks: number;\n\n    /**\n     * Creates the Clicks FSM\n     * @param nbClicks - The number of clicks to manage\n     * @param logger - The logger to use for this interaction\n     * @param action - The action executed on a click\n     */\n    public constructor(nbClicks: number, logger: Logger, action: (evt: MouseEvent) => void) {\n        super(logger);\n\n        if (nbClicks <= 0) {\n            throw new Error(\"The number of clicks must be greater than 1\");\n        }\n\n        if (nbClicks === 1) {\n            throw new Error(\"For a number of clicks that equals 1, use the Click interaction\");\n        }\n\n        this.countClicks = 0;\n        this.nbClicks = nbClicks;\n\n        const clicked = this.addStdState(\"clicked\");\n\n        new ClickTransition(this.initState, clicked,\n            (evt: MouseEvent): void => {\n                this.countClicks++;\n                action(evt);\n            });\n\n        new ClickTransition(clicked, clicked,\n            (evt: MouseEvent): void => {\n                this.countClicks++;\n                action(evt);\n            },\n            (): boolean => (this.countClicks + 1) < this.nbClicks);\n\n        new ClickTransition(clicked, this.addTerminalState(\"ended\"),\n            (evt: MouseEvent): void => {\n                action(evt);\n            },\n            (): boolean => (this.countClicks + 1) === this.nbClicks);\n\n        new TimeoutTransition(clicked, this.addCancellingState(\"timeouted\"), () => 1000);\n    }\n\n    public override reinit(): void {\n        super.reinit();\n        this.countClicks = 0;\n    }\n}\n\n/**\n * The clicks interaction. A user can click several times in different places.\n * @category Interaction Library\n */\nexport class Clicks extends InteractionBase<MousePointsData, MousePointsDataImpl> {\n    /**\n     * Creates the clicks interaction\n     * @param numberClicks - The number of clicks expected to end the interaction.\n     * If this number is not reached after a timeout, the interaction is cancelled.\n     * @param logger - The logger to use for this interaction\n     * @param name - The name of the user interaction\n     */\n    public constructor(numberClicks: number, logger: Logger, name?: string) {\n        const action = (evt: MouseEvent): void => {\n            const pt = new PointDataImpl();\n            pt.copy(evt);\n            this._data.addPoint(pt);\n        };\n        super(new ClicksFSM(numberClicks, logger, action), new MousePointsDataImpl(), logger, name ?? Clicks.name);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {CancellingState} from \"./CancellingState\";\nimport {TerminalState} from \"./TerminalState\";\nimport {TransitionBase} from \"./TransitionBase\";\nimport {isOutputStateType} from \"../../api/fsm/OutputState\";\nimport type {EventType} from \"../../api/fsm/EventType\";\nimport type {FSM} from \"../../api/fsm/FSM\";\nimport type {FSMHandler} from \"../../api/fsm/FSMHandler\";\nimport type {InputState} from \"../../api/fsm/InputState\";\nimport type {OutputState} from \"../../api/fsm/OutputState\";\nimport type {Transition} from \"../../api/fsm/Transition\";\nimport type {Subscription} from \"rxjs\";\n\n/**\n * A transition that refers to another FSM.\n * Entering this transition starts the underlying sub-FSM.\n * To leave the transition, the sub-FSM must end.\n * @category FSM Transition\n */\nexport class SubFSMTransition extends TransitionBase<Event> {\n    private readonly subFSM: FSM;\n\n    private readonly subFSMHandler: FSMHandler;\n\n    /**\n     * Temporary subscription to the current state of the sub-FSM.\n     */\n    private subStateSubscription?: Subscription;\n\n    /**\n     * Creates the transition.\n     * @param srcState - The source state of the transition.\n     * @param tgtState - The output state of the transition.\n     * @param fsm - The inner FSM that composes the transition.\n     * @param action - The action to execute when going through the transition\n     */\n    public constructor(srcState: OutputState, tgtState: InputState, fsm: FSM,\n                       action?: (evt: Event) => void) {\n        super(srcState, tgtState, action, (evt: Event) => this.findTransition(evt)?.guard(evt) ?? false);\n        this.subFSM = fsm;\n        this.subFSM.inner = true;\n        this.subFSMHandler = {\n            \"fsmStarts\": (): void => {\n                this.src.exit();\n            },\n            \"fsmUpdates\": (): void => {\n                this.src.fsm.onUpdating();\n            },\n            \"fsmStops\": (): void => {\n                this.action(new Event(\"\"));\n                this.unsetFSMHandler();\n                if (this.tgt instanceof TerminalState) {\n                    this.tgt.enter();\n                    return;\n                }\n                if (this.tgt instanceof CancellingState) {\n                    this.cancelsFSM();\n                    return;\n                }\n                if (isOutputStateType(this.tgt)) {\n                    this.src.fsm.currentState = this.tgt;\n                    this.tgt.enter();\n                }\n            },\n            \"fsmCancels\": (): void => {\n                this.cancelsFSM();\n            },\n            \"fsmError\": (err: unknown): void => {\n                this.src.fsm.onError(err);\n            }\n        };\n    }\n\n    /**\n     * When has to setting up the subFSM\n     */\n    private setUpFSMHandler(): void {\n        this.subFSM.addHandler(this.subFSMHandler);\n        this.src.fsm.currentSubFSM = this.subFSM;\n        this.subStateSubscription = this.subFSM.currentStateObservable\n            .subscribe(value => {\n                // eslint-disable-next-line @typescript-eslint/prefer-destructuring\n                this.src.fsm.currentState = value[1];\n            });\n    }\n\n    /**\n     * If the subFSM is not more used to should be unset.\n     */\n    private unsetFSMHandler(): void {\n        this.subFSM.removeHandler(this.subFSMHandler);\n        this.src.fsm.currentSubFSM = undefined;\n        this.subStateSubscription?.unsubscribe();\n    }\n\n    private cancelsFSM(): void {\n        this.unsetFSMHandler();\n        this.src.fsm.onCancelling();\n    }\n\n    public override execute(event: Event): InputState | undefined {\n        const transition: Transition<Event> | undefined = this.findTransition(event);\n\n        if (transition === undefined) {\n            return undefined;\n        }\n\n        this.src.fsm.stopCurrentTimeout();\n        this.setUpFSMHandler();\n        this.subFSM.process(event);\n        return transition.target;\n    }\n\n    public accept(event: Event): event is Event {\n        return this.findTransition(event) !== undefined;\n    }\n\n    private findTransition(event: Event): Transition<Event> | undefined {\n        return this.subFSM\n            .initState\n            .transitions\n            .find(tr => tr.accept(event));\n    }\n\n    public getAcceptedEvents(): ReadonlySet<EventType> {\n        // Optimisation to avoid map and reduce\n        const result = new Set<EventType>();\n        for (const trans of this.subFSM.initState.transitions) {\n            for (const evt of trans.getAcceptedEvents()) {\n                result.add(evt);\n            }\n        }\n        return result;\n    }\n\n    public override uninstall(): void {\n        this.unsetFSMHandler();\n        this.subFSM.uninstall();\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {Click, ClickFSM} from \"./Click\";\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {MouseTransition} from \"../../fsm/MouseTransition\";\nimport {SubFSMTransition} from \"../../fsm/SubFSMTransition\";\nimport {TimeoutTransition} from \"../../fsm/TimeoutTransition\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {PointDataImpl} from \"../PointDataImpl\";\nimport type {PointData} from \"../../../api/interaction/PointData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\n/**\n * The FSM for the mouse double click interaction\n * @category FSM\n */\nexport class DoubleClickFSM extends FSMImpl {\n    /** The time gap between the two spinner events. */\n    private static timeGap = 300;\n\n    /**\n     * The supplier that provides the time gap.\n     * @returns The time gap\n     */\n    private static readonly timeGapSupplier: () => number = () => DoubleClickFSM.getTimeGap();\n\n    /**\n     * @returns The time gap between the two spinner events.\n     */\n    public static getTimeGap(): number {\n        return DoubleClickFSM.timeGap;\n    }\n\n    /**\n     * Sets The time gap between the two spinner events.\n     * @param timeGapBetweenClicks - The time gap between the two spinner events. Not done if negative.\n     */\n    public static setTimeGap(timeGapBetweenClicks: number): void {\n        if (timeGapBetweenClicks > 0) {\n            DoubleClickFSM.timeGap = timeGapBetweenClicks;\n        }\n    }\n\n    public readonly firstClickFSM: ClickFSM;\n\n    private readonly sndClickFSM: ClickFSM;\n\n    private checkButton: number | undefined;\n\n    public constructor(logger: Logger, subAction?: (evt: MouseEvent) => void) {\n        super(logger);\n        this.firstClickFSM = new ClickFSM(logger, subAction);\n        this.sndClickFSM = new ClickFSM(logger);\n\n        const errorHandler = {\n            \"fsmError\": (err: unknown): void => {\n                this.notifyHandlerOnError(err);\n            }\n        };\n\n        this.firstClickFSM.addHandler(errorHandler);\n        this.sndClickFSM.addHandler(errorHandler);\n\n        const cancelled = this.addCancellingState(\"cancelled\");\n        const clicked = this.addStdState(\"clicked\");\n\n        new SubFSMTransition(this.initState, clicked, this.firstClickFSM,\n            (): void => {\n                this.setCheckButton(this.firstClickFSM.getCheckButton());\n            });\n\n        new MouseTransition(clicked, cancelled, \"mousemove\", undefined,\n            (ev: Event): boolean => (this.checkButton === undefined || ev instanceof MouseEvent && ev.button === this.checkButton));\n\n        new TimeoutTransition(clicked, cancelled, DoubleClickFSM.timeGapSupplier);\n        new SubFSMTransition(clicked, this.addTerminalState(\"dbleclicked\", true), this.sndClickFSM);\n    }\n\n    // eslint-disable-next-line accessor-pairs\n    public override set log(log: boolean) {\n        super.log = log;\n        this.firstClickFSM.log = log;\n        this.sndClickFSM.log = log;\n    }\n\n    public setCheckButton(buttonToCheck: number): void {\n        if (this.checkButton === undefined) {\n            this.checkButton = buttonToCheck;\n        }\n        this.sndClickFSM.setCheckButton(buttonToCheck);\n    }\n\n    public getCheckButton(): number {\n        return this.checkButton ?? -1;\n    }\n\n    public override fullReinit(): void {\n        super.fullReinit();\n        this.firstClickFSM.fullReinit();\n        this.sndClickFSM.fullReinit();\n    }\n\n    public override reinit(): void {\n        super.reinit();\n        this.firstClickFSM.reinit();\n        this.sndClickFSM.reinit();\n        this.checkButton = undefined;\n    }\n}\n\n/**\n * The mouse double click interaction\n * @category Interaction Library\n */\nexport class DoubleClick extends InteractionBase<PointData, PointDataImpl> {\n    public constructor(logger: Logger, fsm?: DoubleClickFSM, data?: PointDataImpl, name?: string) {\n        const theFSM = fsm ?? new DoubleClickFSM(logger, (evt: MouseEvent): void => {\n            this._data.copy(evt);\n        });\n        super(theFSM, data ?? new PointDataImpl(), logger, name ?? DoubleClick.name);\n        /*\n         * We give the interaction to the first click as this click interaction\n         * will contain the data: so that this interaction will fill the data\n         * of the double-click.\n         */\n        new Click(logger, theFSM.firstClickFSM, this._data);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {TransitionBase} from \"./TransitionBase\";\nimport type {EventType, KeyEventType} from \"../../api/fsm/EventType\";\nimport type {InputState} from \"../../api/fsm/InputState\";\nimport type {OutputState} from \"../../api/fsm/OutputState\";\n\n/**\n * A transition for a keys.\n * @category FSM Transition\n */\nexport class KeyTransition extends TransitionBase<KeyboardEvent> {\n    private readonly acceptedEvents: ReadonlySet<EventType> = new Set([\"wheel\"]);\n\n    /**\n     * Creates the transition.\n     * @param srcState - The source state of the transition\n     * @param tgtState - The output state of the transition\n     * @param keyType - The type of key event\n     * @param action - The action to execute when going through the transition\n     * @param guard - The guard to fulfil to execute the transition\n     */\n    public constructor(srcState: OutputState, tgtState: InputState, keyType: KeyEventType,\n                       action?: (evt: KeyboardEvent) => void, guard?: (evt: KeyboardEvent) => boolean) {\n        super(srcState, tgtState, action, guard);\n        this.acceptedEvents = new Set([keyType]);\n    }\n\n    public accept(event: Event): event is KeyboardEvent {\n        return event instanceof KeyboardEvent && this.getAcceptedEvents().has(event.type as EventType);\n    }\n\n    public getAcceptedEvents(): ReadonlySet<EventType> {\n        return this.acceptedEvents;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {KeyCode} from \"./Events\";\nimport {KeyTransition} from \"./KeyTransition\";\nimport type {InputState} from \"../../api/fsm/InputState\";\nimport type {OutputState} from \"../../api/fsm/OutputState\";\n\n/**\n * This transition should be used to cancel an interaction using key ESCAPE.\n * @category FSM Transition\n */\nexport class EscapeKeyPressureTransition extends KeyTransition {\n    public constructor(srcState: OutputState, tgtState: InputState, action?: (evt: KeyboardEvent) => void) {\n        super(srcState, tgtState, \"keydown\", action,\n            (evt: KeyboardEvent) => evt.code === \"Escape\" || evt.code === String(KeyCode.escape));\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport type {Flushable} from \"./Flushable\";\nimport type {PointBaseData} from \"../../api/interaction/PointBaseData\";\nimport type {SrcTgtPointsData} from \"../../api/interaction/SrcTgtPointsData\";\n\n/**\n * The user interaction base data for DnD-like interactions\n * @typeParam T - The interface of the point interaction data\n * @typeParam S - The class of the point interaction data\n * @category Interaction Data\n */\nexport abstract class SrcTgtDataBase<T extends PointBaseData, S extends Flushable & T> implements SrcTgtPointsData<T> {\n    protected readonly srcData: S;\n\n    protected readonly tgtData: S;\n\n    protected constructor(src: S, tgt: S) {\n        this.srcData = src;\n        this.tgtData = tgt;\n    }\n\n    public get src(): T {\n        return this.srcData;\n    }\n\n    public get tgt(): T {\n        return this.tgtData;\n    }\n\n    public get diffClientX(): number {\n        return this.tgt.clientX - this.src.clientX;\n    }\n\n    public get diffClientY(): number {\n        return this.tgt.clientY - this.src.clientY;\n    }\n\n    public get diffPageX(): number {\n        return this.tgt.pageX - this.src.pageX;\n    }\n\n    public get diffPageY(): number {\n        return this.tgt.pageY - this.src.pageY;\n    }\n\n    public get diffScreenX(): number {\n        return this.tgt.screenX - this.src.screenX;\n    }\n\n    public get diffScreenY(): number {\n        return this.tgt.screenY - this.src.screenY;\n    }\n\n    public get duration(): number {\n        return this.tgtData.timeStamp - this.srcData.timeStamp;\n    }\n\n    public velocity(direction: \"all\" | \"horiz\" | \"vert\"): number {\n        switch (direction) {\n            case \"all\":\n                return (Math.hypot(this.diffScreenX, this.diffScreenY) / this.duration) * 1000;\n            case \"horiz\":\n                return (Math.abs(this.diffScreenX) / this.duration) * 1000;\n            case \"vert\":\n                return (Math.abs(this.diffScreenY) / this.duration) * 1000;\n            default:\n                return 0;\n        }\n    }\n\n    public isHorizontal(pxTolerance: number): boolean {\n        return Math.abs(this.diffScreenY) <= pxTolerance && this.diffScreenX !== 0;\n    }\n\n    public isVertical(pxTolerance: number): boolean {\n        return Math.abs(this.diffScreenX) <= pxTolerance && this.diffScreenY !== 0;\n    }\n\n    public isLeft(pxTolerance: number): boolean {\n        return this.isHorizontal(pxTolerance) && this.tgt.screenX < this.src.screenX;\n    }\n\n    public isRight(pxTolerance: number): boolean {\n        return this.isHorizontal(pxTolerance) && this.tgt.screenX > this.src.screenX;\n    }\n\n    public isTop(pxTolerance: number): boolean {\n        return this.isVertical(pxTolerance) && this.tgt.screenY < this.src.screenY;\n    }\n\n    public isBottom(pxTolerance: number): boolean {\n        return this.isVertical(pxTolerance) && this.tgt.screenY > this.src.screenY;\n    }\n\n    public flush(): void {\n        this.srcData.flush();\n        this.tgtData.flush();\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {PointDataImpl} from \"./PointDataImpl\";\nimport {SrcTgtDataBase} from \"./SrcTgtDataBase\";\nimport type {PointData} from \"../../api/interaction/PointData\";\n\n/**\n * The user interaction data for mouse-based DnD interactions\n * @category Interaction Data\n */\nexport class SrcTgtPointsDataImpl extends SrcTgtDataBase<PointData, PointDataImpl> {\n    public constructor() {\n        super(new PointDataImpl(), new PointDataImpl());\n    }\n\n    public copySrc(data: PointData): void {\n        this.srcData.copy(data);\n    }\n\n    public copyTgt(data: PointData): void {\n        this.tgtData.copy(data);\n    }\n\n    public override get src(): PointDataImpl {\n        return this.srcData;\n    }\n\n    public override get tgt(): PointDataImpl {\n        return this.tgtData;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {DoubleClick, DoubleClickFSM} from \"./DoubleClick\";\nimport {EscapeKeyPressureTransition} from \"../../fsm/EscapeKeyPressureTransition\";\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {MouseTransition} from \"../../fsm/MouseTransition\";\nimport {SubFSMTransition} from \"../../fsm/SubFSMTransition\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {SrcTgtPointsDataImpl} from \"../SrcTgtPointsDataImpl\";\nimport type {PointData} from \"../../../api/interaction/PointData\";\nimport type {SrcTgtPointsData} from \"../../../api/interaction/SrcTgtPointsData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\ninterface DragLockFSMHandler {\n    onMove(event: MouseEvent): void;\n    onFirstDbleClick(): void;\n}\n\nclass DragLockFSM extends FSMImpl {\n    public readonly firstDbleClick: DoubleClickFSM;\n\n    public readonly sndDbleClick: DoubleClickFSM;\n\n    protected checkButton: number | undefined;\n\n    public constructor(logger: Logger, handler: DragLockFSMHandler,\n                       dbleClick1Action: (evt: MouseEvent) => void, dbleClick2Action: (evt: MouseEvent) => void) {\n        super(logger);\n        this.firstDbleClick = new DoubleClickFSM(logger, dbleClick1Action);\n        this.sndDbleClick = new DoubleClickFSM(logger, dbleClick2Action);\n\n        const cancelDbleClick = new DoubleClickFSM(logger);\n        const errorHandler = {\n            \"fsmError\": (err: unknown): void => {\n                this.notifyHandlerOnError(err);\n            }\n        };\n\n        this.firstDbleClick.addHandler(errorHandler);\n        this.sndDbleClick.addHandler(errorHandler);\n        cancelDbleClick.addHandler(errorHandler);\n\n        const cancelled = this.addCancellingState(\"cancelled\");\n        const locked = this.addStdState(\"locked\");\n        const moved = this.addStdState(\"moved\");\n\n        new SubFSMTransition(this.initState, locked, this.firstDbleClick,\n            (): void => {\n                const checkButton = this.firstDbleClick.getCheckButton();\n                this.sndDbleClick.setCheckButton(checkButton);\n                cancelDbleClick.setCheckButton(checkButton);\n                handler.onFirstDbleClick();\n            });\n\n        new SubFSMTransition(locked, cancelled, cancelDbleClick);\n\n        const move = new MouseTransition(locked, moved, \"mousemove\",\n            (event: MouseEvent): void => {\n                handler.onMove(event);\n            });\n\n        new MouseTransition(moved, moved, \"mousemove\", move.action);\n\n        new EscapeKeyPressureTransition(locked, cancelled);\n        new EscapeKeyPressureTransition(moved, cancelled);\n        new SubFSMTransition(moved, this.addTerminalState(\"dropped\"), this.sndDbleClick);\n    }\n\n    // eslint-disable-next-line accessor-pairs\n    public override set log(log: boolean) {\n        super.log = log;\n        this.firstDbleClick.log = log;\n        this.sndDbleClick.log = log;\n    }\n\n    public override reinit(): void {\n        super.reinit();\n        this.firstDbleClick.reinit();\n        this.sndDbleClick.reinit();\n        this.checkButton = undefined;\n    }\n\n    public override fullReinit(): void {\n        super.fullReinit();\n        this.firstDbleClick.fullReinit();\n        this.sndDbleClick.fullReinit();\n    }\n}\n\n/**\n * The drag-lock user interaction\n * @category Interaction Library\n */\nexport class DragLock extends InteractionBase<SrcTgtPointsData<PointData>, SrcTgtPointsDataImpl> {\n    /**\n     * Creates a drag lock.\n     * @param logger - The logger to use for this interaction\n     * @param name - The name of the user interaction\n     */\n    public constructor(logger: Logger, name?: string) {\n        const handler: DragLockFSMHandler = {\n            \"onMove\": (evt: MouseEvent): void => {\n                this._data.tgt.copy(evt);\n            },\n            \"onFirstDbleClick\": (): void => {\n                // On the first double-click we have to set the tgt point by copying the src data.\n                this._data.tgt.copy(this.data.src);\n            }\n        };\n\n        const theFSM = new DragLockFSM(logger, handler, (evt: MouseEvent): void => {\n            this._data.src.copy(evt);\n        }, (evt: MouseEvent): void => {\n            this._data.tgt.copy(evt);\n        });\n\n        super(theFSM, new SrcTgtPointsDataImpl(), logger, name ?? DragLock.name);\n\n        /*\n         * We give the interactions to the initial and final double-clicks as these interactions\n         * will contain the data: so that these interactions will fill the data with the draglock.\n         */\n        new DoubleClick(logger, theFSM.firstDbleClick, this._data.src);\n        new DoubleClick(logger, theFSM.sndDbleClick, this._data.tgt);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {KeyTransition} from \"../../fsm/KeyTransition\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {KeyDataImpl} from \"../KeyDataImpl\";\nimport type {KeyData} from \"../../../api/interaction/KeyData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\n/**\n * An FSM for a single key pressure.\n * @category FSM\n */\nexport class KeyDownFSM extends FSMImpl {\n    private readonly modifiersAccepted: boolean;\n\n    /**\n     * Creates the FSM.\n     * @param modifierAccepted - True: the FSM will consider key modifiers.\n     * @param logger - The logger to use for this interaction\n     * @param action - The action executed on a key down\n     * @param key - The optional accepted key code\n     */\n    public constructor(modifierAccepted: boolean, logger: Logger, action: (evt: KeyboardEvent) => void, key?: string) {\n        super(logger);\n        this.modifiersAccepted = modifierAccepted;\n\n        new KeyTransition(this.initState, this.addTerminalState(\"pressed\"), \"keydown\", action,\n            (evt: KeyboardEvent): boolean => (key === undefined || key === evt.code) &&\n              (this.modifiersAccepted || (!evt.altKey && !evt.ctrlKey && !evt.shiftKey && !evt.metaKey)));\n    }\n}\n\n/**\n * A user interaction for pressing a key on a keyboard\n * @category Interaction Library\n */\nexport class KeyDown extends InteractionBase<KeyData, KeyDataImpl> {\n    public constructor(logger: Logger, modifierAccepted: boolean, key?: string, fsm?: KeyDownFSM, name?: string) {\n        const action = (event: KeyboardEvent): void => {\n            this._data.copy(event);\n        };\n        super(fsm ?? new KeyDownFSM(modifierAccepted, logger, action, key), new KeyDataImpl(), logger, name ?? KeyDown.name);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {KeyTransition} from \"../../fsm/KeyTransition\";\nimport {TimeoutTransition} from \"../../fsm/TimeoutTransition\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {KeysDataImpl} from \"../KeysDataImpl\";\nimport type {KeysData} from \"../../../api/interaction/KeysData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\n/**\n * An FSM for typing several keyboard touches.\n * One can type on multiple keys. The FSM ends after a timeout (a delay after the latest\n * typed key).\n * @category FSM\n */\nexport class KeysTypedFSM extends FSMImpl {\n    /** The time gap between the two spinner events. */\n    private static readonly timeGap: number = 1000;\n\n    /**\n     * The supplier that provides the time gap.\n     * @returns The time gap.\n     */\n    private static readonly timeGapSupplier: () => number = () => KeysTypedFSM.getTimeGap();\n\n    private static getTimeGap(): number {\n        return KeysTypedFSM.timeGap;\n    }\n\n    /**\n     * Creates the FSM.\n     * @param logger - The logger to use for this interaction\n     * @param action - The action executed on a key typed\n     */\n    public constructor(logger: Logger, action: (event: KeyboardEvent) => void) {\n        super(logger);\n        const keyup = this.addStdState(\"keyup\");\n        new KeyTransition(this.initState, keyup, \"keyup\", action);\n        new KeyTransition(keyup, keyup, \"keyup\", action);\n        new TimeoutTransition(keyup, this.addTerminalState(\"timeouted\"), KeysTypedFSM.timeGapSupplier);\n    }\n}\n\n/**\n * A user interaction for typing several keyboard keys.\n * One can type on multiple keys. The interaction ends after a timeout (a delay after the latest\n * typed key).\n * @category Interaction Library\n */\nexport class KeysTyped extends InteractionBase<KeysData, KeysDataImpl> {\n    /**\n     * Creates the user interaction.\n     * @param logger - The logger to use for this interaction\n     * @param name - The name of the user interaction\n     */\n    public constructor(logger: Logger, name?: string) {\n        const action = (event: KeyboardEvent): void => {\n            this._data.addKey(event);\n        };\n        super(new KeysTypedFSM(logger, action), new KeysDataImpl(), logger, name ?? KeysTyped.name);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {KeyTransition} from \"../../fsm/KeyTransition\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {KeyDataImpl} from \"../KeyDataImpl\";\nimport type {KeyData} from \"../../../api/interaction/KeyData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\n/**\n * The FSM that describes a keyboard touch typed.\n * @category FSM\n */\nexport class KeyTypedFSM extends FSMImpl {\n    private checkKey: string | undefined;\n\n    public constructor(logger: Logger, action: (event: KeyboardEvent) => void, key?: string) {\n        super(logger);\n\n        this.checkKey = key;\n        const pressed = this.addStdState(\"pressed\");\n\n        new KeyTransition(this.initState, pressed, \"keydown\",\n            (event: KeyboardEvent): void => {\n                if (this.checkKey === undefined) {\n                    this.checkKey = event.code;\n                }\n            });\n\n        new KeyTransition(pressed, this.addTerminalState(\"typed\", true), \"keyup\", action,\n            (evt: KeyboardEvent): boolean => this.checkKey === undefined || evt.code === this.checkKey);\n    }\n\n    public override reinit(): void {\n        super.reinit();\n        this.checkKey = undefined;\n    }\n}\n\n/**\n * A user interaction for pressing, then releasing a keyboard key\n * @category Interaction Library\n */\nexport class KeyTyped extends InteractionBase<KeyData, KeyDataImpl> {\n    /**\n     * Creates the user interaction.\n     * @param logger - The logger to use for this interaction\n     * @param key - The expected key. Do nothing if the involved key is different\n     * @param name - The name of the user interaction\n     */\n    public constructor(logger: Logger, key?: string, name?: string) {\n        const action = (event: KeyboardEvent): void => {\n            this._data.copy(event);\n        };\n        super(new KeyTypedFSM(logger, action, key), new KeyDataImpl(), logger, name ?? KeyTyped.name);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {KeyTransition} from \"../../fsm/KeyTransition\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {KeyDataImpl} from \"../KeyDataImpl\";\nimport type {KeyData} from \"../../../api/interaction/KeyData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\n/**\n * An FSM for a single key release.\n * @category FSM\n */\nexport class KeyUpFSM extends FSMImpl {\n    private readonly modifiersAccepted: boolean;\n\n    /**\n     * Creates the FSM.\n     * @param modifierAccepted - True: the FSM will consider key modifiers.\n     * @param logger - The logger to use for this interaction\n     * @param action - The action executed on a key up\n     */\n    public constructor(modifierAccepted: boolean, logger: Logger, action: (evt: KeyboardEvent) => void) {\n        super(logger);\n        this.modifiersAccepted = modifierAccepted;\n\n        new KeyTransition(this.initState, this.addTerminalState(\"released\"), \"keyup\", action,\n            (ev: KeyboardEvent): boolean => this.modifiersAccepted || (!ev.altKey && !ev.ctrlKey && !ev.shiftKey && !ev.metaKey));\n    }\n}\n\n/**\n * A user interaction for releasing a key on a keyboard\n * @category Interaction Library\n */\nexport class KeyUp extends InteractionBase<KeyData, KeyDataImpl> {\n    public constructor(logger: Logger, modifierAccepted: boolean, fsm?: KeyUpFSM, name?: string) {\n        const action = (event: KeyboardEvent): void => {\n            this._data.copy(event);\n        };\n        super(fsm ?? new KeyUpFSM(modifierAccepted, logger, action), new KeyDataImpl(), logger, name ?? KeyUp.name);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {MouseTransition} from \"../../fsm/MouseTransition\";\nimport {TimeoutTransition} from \"../../fsm/TimeoutTransition\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {PointDataImpl} from \"../PointDataImpl\";\nimport type {PointData} from \"../../../api/interaction/PointData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\n/**\n * The FSM for the LongPress interaction\n * @category FSM\n */\nexport class LongMouseDownFSM extends FSMImpl {\n    private readonly duration: number;\n\n    private currentButton: number | undefined;\n\n    /**\n     * Creates the long press FSM\n     * @param duration - Defines the duration of the long press interaction (in ms).\n     * @param logger - The logger to use for this interaction\n     * @param action - The action executed on long mouse down\n     */\n    public constructor(duration: number, logger: Logger, action: (evt: MouseEvent) => void) {\n        super(logger);\n\n        if (duration <= 0) {\n            throw new Error(\"Incorrect duration\");\n        }\n\n        this.duration = duration;\n        this.currentButton = undefined;\n\n        const down = this.addStdState(\"down\");\n        const cancelled = this.addCancellingState(\"cancelled\");\n        const timeouted = this.addTerminalState(\"timeouted\");\n\n        new MouseTransition(this.initState, down, \"mousedown\",\n            (evt: MouseEvent): void => {\n                this.currentButton = evt.button;\n                action(evt);\n            });\n\n        const move = new MouseTransition(down, cancelled, \"mousemove\", undefined,\n            (evt: MouseEvent): boolean => evt.button === this.currentButton);\n\n        new MouseTransition(down, cancelled, \"mouseup\", undefined, move.guard);\n\n        new TimeoutTransition(down, timeouted, () => this.duration);\n    }\n\n    public override reinit(): void {\n        super.reinit();\n        this.currentButton = undefined;\n    }\n}\n\n/**\n * The long mouse down interaction. The interaction ends after a delay after having a mouse down (with no mouse up)\n * @category Interaction Library\n */\nexport class LongMouseDown extends InteractionBase<PointData, PointDataImpl> {\n    /**\n     * Creates the long press interaction\n     * @param duration - The duration of the pressure required to end the user interaction (in ms)\n     * If this duration is not reached, the interaction is cancelled.\n     * @param logger - The logger to use for this interaction\n     * @param name - The name of the user interaction\n     */\n    public constructor(duration: number, logger: Logger, name?: string) {\n        const action = (evt: MouseEvent): void => {\n            this._data.copy(evt);\n        };\n        super(new LongMouseDownFSM(duration, logger, action), new PointDataImpl(), logger, name ?? LongMouseDown.name);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {MouseTransition} from \"../../fsm/MouseTransition\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {PointDataImpl} from \"../PointDataImpl\";\nimport type {PointData} from \"../../../api/interaction/PointData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\nclass MouseDownFSM extends FSMImpl {\n    public constructor(logger: Logger, action: (event: MouseEvent) => void) {\n        super(logger);\n        new MouseTransition(this.initState, this.addTerminalState(\"pressed\"), \"mousedown\", action);\n    }\n}\n\n/**\n * A user interaction for pressing down a mouse button.\n * @category Interaction Library\n */\nexport class MouseDown extends InteractionBase<PointData, PointDataImpl> {\n    /**\n     * Creates the interaction.\n     * @param logger - The logger to use for this interaction\n     * @param name - The name of the user interaction\n     */\n    public constructor(logger: Logger, name?: string) {\n        const action = (evt: MouseEvent): void => {\n            this._data.copy(evt);\n        };\n        super(new MouseDownFSM(logger, action), new PointDataImpl(), logger, name ?? MouseDown.name);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {MouseTransition} from \"../../fsm/MouseTransition\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {PointDataImpl} from \"../PointDataImpl\";\nimport type {PointData} from \"../../../api/interaction/PointData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\n/**\n * The FSM of the mouse up interaction\n * @category FSM\n */\nexport class MouseUpFSM extends FSMImpl {\n    /**\n     * Creates the FSM\n     * @param logger - The logger to use for this interaction\n     * @param action - The action executed on a mouse up\n     */\n    public constructor(logger: Logger, action: (event: MouseEvent) => void) {\n        super(logger);\n        new MouseTransition(this.initState, this.addTerminalState(\"released\"), \"mouseup\", action);\n    }\n}\n\n/**\n * A user interaction for releasing a mouse button.\n * @category Interaction Library\n */\nexport class MouseUp extends InteractionBase<PointData, PointDataImpl> {\n    /**\n     * Creates the interaction.\n     * @param logger - The logger to use for this interaction\n     * @param name - The name of the user interaction\n     */\n    public constructor(logger: Logger, name?: string) {\n        const action = (evt: MouseEvent): void => {\n            this._data.copy(evt);\n        };\n        super(new MouseUpFSM(logger, action), new PointDataImpl(), logger, name ?? MouseUp.name);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {TransitionBase} from \"./TransitionBase\";\nimport type {EventType, TouchEventType} from \"../../api/fsm/EventType\";\nimport type {InputState} from \"../../api/fsm/InputState\";\nimport type {OutputState} from \"../../api/fsm/OutputState\";\n\n/**\n * This transition defines a touch move.\n * @category FSM Transition\n */\nexport class TouchTransition extends TransitionBase<TouchEvent> {\n    private readonly acceptedEvents: ReadonlySet<EventType>;\n\n    /**\n     * Defines a transition.\n     * @param srcState - The source state of the transition.\n     * @param tgtState - The srcObject state of the transition.\n     * @param eventType - The type of touch event\n     * @param action - The action to execute when going through the transition\n     * @param guard - The guard to fulfil to execute the transition\n     */\n    public constructor(srcState: OutputState, tgtState: InputState, eventType: TouchEventType,\n                       action?: (evt: TouchEvent) => void, guard?: (evt: TouchEvent) => boolean) {\n        super(srcState, tgtState, action, guard);\n        this.acceptedEvents = new Set([eventType]);\n    }\n\n    public accept(evt: Event): evt is TouchEvent {\n        return evt instanceof TouchEvent && this.getAcceptedEvents().has(evt.type as EventType);\n    }\n\n    public getAcceptedEvents(): ReadonlySet<EventType> {\n        return this.acceptedEvents;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {PointDataImpl} from \"./PointDataImpl\";\nimport {PointingDataBase} from \"./PointingDataBase\";\nimport type {EventModifierData} from \"../../api/interaction/EventModifierData\";\nimport type {PointData} from \"../../api/interaction/PointData\";\nimport type {TouchData} from \"../../api/interaction/TouchData\";\nimport type {UnitInteractionData} from \"../../api/interaction/UnitInteractionData\";\n\n/**\n * The user interaction data for touch-based interactions\n * @category Interaction Data\n */\nexport class TouchDataImpl extends PointingDataBase implements TouchData {\n    private _allTouches: Array<TouchData> = [];\n\n    private forceData = 0;\n\n    private identifierData = -1;\n\n    private radiusXData = 0;\n\n    private radiusYData = 0;\n\n    private rotationAngleData = 0;\n\n    public get allTouches(): ReadonlyArray<TouchData> {\n        return this._allTouches;\n    }\n\n    public get force(): number {\n        return this.forceData;\n    }\n\n    public get identifier(): number {\n        return this.identifierData;\n    }\n\n    public get radiusX(): number {\n        return this.radiusXData;\n    }\n\n    public get radiusY(): number {\n        return this.radiusYData;\n    }\n\n    public get rotationAngle(): number {\n        return this.rotationAngleData;\n    }\n\n    public override copy(data: TouchData): void {\n        super.copy(data);\n        this.forceData = data.force;\n        this.identifierData = data.identifier;\n        this.radiusXData = data.radiusX;\n        this.radiusYData = data.radiusY;\n        this.rotationAngleData = data.rotationAngle;\n        this._allTouches = data.allTouches.map(touch => {\n            const newT = new TouchDataImpl();\n            newT.copy(touch);\n            return newT;\n        });\n    }\n\n    public override flush(): void {\n        super.flush();\n        this.forceData = 0;\n        this.identifierData = -1;\n        this.radiusXData = 0;\n        this.radiusYData = 0;\n        this.rotationAngleData = 0;\n        this._allTouches = [];\n    }\n\n    public static mergeTouchEventData(touch: Touch, evt: EventModifierData & UnitInteractionData, allTouches: Array<Touch>): TouchData {\n        const data = new TouchDataImpl();\n        /*\n         * Not beautiful code but other tries did not work\n         * 'assign' and spread do not work with events (polyfill concern? Or front interfaces for legacy back API?).\n         */\n        data.copy({\n            \"clientX\": touch.clientX,\n            \"clientY\": touch.clientY,\n            \"force\": touch.force,\n            \"identifier\": touch.identifier,\n            \"pageX\": touch.pageX,\n            \"pageY\": touch.pageY,\n            \"radiusX\": touch.radiusX,\n            \"radiusY\": touch.radiusY,\n            \"rotationAngle\": touch.rotationAngle,\n            \"screenX\": touch.screenX,\n            \"screenY\": touch.screenY,\n            \"target\": touch.target,\n            \"allTouches\": allTouches.map(currTouch => TouchDataImpl.mergeTouchEventData(currTouch, evt, [])),\n            \"timeStamp\": evt.timeStamp,\n            \"altKey\": evt.altKey,\n            \"shiftKey\": evt.shiftKey,\n            \"ctrlKey\": evt.ctrlKey,\n            \"metaKey\": evt.metaKey,\n            \"currentTarget\": evt.currentTarget\n        });\n        return data;\n    }\n\n    public toPointData(): PointData {\n        const point = new PointDataImpl();\n        point.copy({\n            \"button\": this.identifier,\n            \"buttons\": 0,\n            \"movementX\": 0,\n            \"movementY\": 0,\n            \"offsetX\": 0,\n            \"offsetY\": 0,\n            \"relatedTarget\": this.target,\n            \"clientX\": this.clientX,\n            \"clientY\": this.clientY,\n            \"pageX\": this.pageX,\n            \"pageY\": this.pageY,\n            \"screenX\": this.screenX,\n            \"screenY\": this.screenY,\n            \"altKey\": this.altKey,\n            \"ctrlKey\": this.ctrlKey,\n            \"metaKey\": this.metaKey,\n            \"shiftKey\": this.shiftKey,\n            \"timeStamp\": this.timeStamp,\n            \"target\": this.target,\n            \"currentTarget\": this.currentTarget\n        });\n        return point;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {SrcTgtDataBase} from \"./SrcTgtDataBase\";\nimport {TouchDataImpl} from \"./TouchDataImpl\";\nimport type {EventModifierData} from \"../../api/interaction/EventModifierData\";\nimport type {TouchData} from \"../../api/interaction/TouchData\";\nimport type {UnitInteractionData} from \"../../api/interaction/UnitInteractionData\";\n\n/**\n * The user interaction data for touch-DnD interactions\n * @category Interaction Data\n */\nexport class SrcTgtTouchDataImpl extends SrcTgtDataBase<TouchData, TouchDataImpl> {\n    public constructor() {\n        super(new TouchDataImpl(), new TouchDataImpl());\n    }\n\n    public copySrc(data: Touch, evt: EventModifierData & UnitInteractionData, allTouches: Array<Touch>): void {\n        this.srcData.copy(TouchDataImpl.mergeTouchEventData(data, evt, allTouches));\n    }\n\n    public copyTgt(data: Touch, evt: EventModifierData & UnitInteractionData, allTouches: Array<Touch>): void {\n        this.tgtData.copy(TouchDataImpl.mergeTouchEventData(data, evt, allTouches));\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {getTouch} from \"../../fsm/Events\";\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {TouchTransition} from \"../../fsm/TouchTransition\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {SrcTgtTouchDataImpl} from \"../SrcTgtTouchDataImpl\";\nimport type {SrcTgtPointsData} from \"../../../api/interaction/SrcTgtPointsData\";\nimport type {TouchData} from \"../../../api/interaction/TouchData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\nimport type {CancellingState} from \"../../fsm/CancellingState\";\nimport type {StdState} from \"../../fsm/StdState\";\n\n/**\n * The data handler for the touch DnD interaction\n * @category Helper\n */\nexport interface TouchDnDFSMHandler {\n    /**\n     * On a touch\n     * @param event - The event to process.\n     */\n    onTouch(event: TouchEvent): void;\n\n    /**\n     * On a move\n     * @param event - The event to process.\n     */\n    onMove(event: TouchEvent): void;\n\n    /**\n     * On a release\n     * @param event - The event to process.\n     */\n    onRelease(event: TouchEvent): void;\n}\n\n/**\n * The FSM that defines a touch interaction (that works like a DnD)\n * @category FSM\n */\nexport class TouchDnDFSM extends FSMImpl {\n    protected touchID: number | undefined;\n\n    protected readonly cancellable;\n\n    protected readonly movementRequired;\n\n    protected readonly cancelled: CancellingState;\n\n    protected readonly moved: StdState;\n\n    protected readonly touched: StdState;\n\n    /**\n     * Creates the FSM.\n     * @param cancellable - Whether the DnD can be cancelled by interacting with a dwell-and-spring element.\n     * @param logger - The logger to use for this interaction\n     * @param dataHandler - The data handler the FSM will use\n     * @param movementRequired - Whether the DnD starts after the touch point has begun moving (default)\n     * or as soon as the screen is touched. The latter is used for the MultiTouch interaction.\n     */\n    public constructor(cancellable: boolean, logger: Logger, dataHandler: TouchDnDFSMHandler, movementRequired = true) {\n        super(logger);\n        this.touchID = undefined;\n        this.cancellable = cancellable;\n        this.movementRequired = movementRequired;\n        this.cancelled = this.addCancellingState(\"cancelled\");\n        this.moved = this.addStdState(\"moved\");\n        this.touched = this.addStdState(\"touched\");\n        this.buildFSM(dataHandler);\n    }\n\n    // eslint-disable-next-line max-lines-per-function\n    protected buildFSM(dataHandler: TouchDnDFSMHandler): void {\n        const released = this.addTerminalState(\"released\");\n\n        const touchDown = (event: TouchEvent): void => {\n            this.touchID = event.changedTouches[0]?.identifier;\n            dataHandler.onTouch(event);\n        };\n\n        const fixTouchDownCheck = (event: TouchEvent): boolean =>\n            !Array.from(event.touches).some(touch => touch.identifier === this.touchID);\n\n        new TouchTransition(this.initState, this.touched, \"touchstart\", touchDown);\n\n        /*\n         * If the touch up event is lost by the browser and another touch down occurs\n         * we must restart the interaction\n         */\n        new TouchTransition(this.touched, this.touched, \"touchstart\", touchDown, fixTouchDownCheck);\n\n        if (this.movementRequired) {\n            this.startingState = this.moved;\n            new TouchTransition(this.touched, this.cancelled, \"touchend\", undefined,\n                (event: TouchEvent): boolean => event.changedTouches[0] !== undefined && event.changedTouches[0].identifier === this.touchID);\n        } else {\n            new TouchTransition(this.touched, released, \"touchend\",\n                (event: TouchEvent): void => {\n                    dataHandler.onRelease(event);\n                },\n                (event: TouchEvent): boolean => event.changedTouches[0] !== undefined && event.changedTouches[0].identifier === this.touchID);\n        }\n\n        const moved = (event: TouchEvent): void => {\n            dataHandler.onMove(event);\n        };\n        const movedPredicate = (event: TouchEvent): boolean => event.changedTouches[0]?.identifier === this.touchID;\n\n        new TouchTransition(this.touched, this.moved, \"touchmove\", moved, movedPredicate);\n        new TouchTransition(this.moved, this.moved, \"touchmove\", moved, movedPredicate);\n\n        /*\n         * If the touch up event is lost by the browser and another touch down occurs\n         * we must restart the interaction\n         */\n        new TouchTransition(this.moved, this.touched, \"touchstart\", touchDown, fixTouchDownCheck);\n\n        // Transitions used if the DnD can be cancelled by releasing the touch on a dwell spring element\n        if (this.cancellable) {\n            new TouchTransition(this.moved, released, \"touchend\",\n                (event: TouchEvent): void => {\n                    dataHandler.onRelease(event);\n                },\n                (event: TouchEvent): boolean => {\n                /*\n                 * Touch event behaviour is not consistent with mouse events: event.tgt.target points to the original element, not to the one\n                 * currently targeted. So we have to retrieve the current target manually.\n                 */\n                    // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n                    const touch = event.changedTouches[0]!;\n                    const tgt = document.elementFromPoint(touch.clientX, touch.clientY);\n                    return touch.identifier === this.touchID &&\n                      (!(tgt instanceof Element) || !tgt.classList.contains(\"ioDwellSpring\"));\n                });\n\n            new TouchTransition(this.moved, this.cancelled, \"touchend\", undefined,\n                (ev: TouchEvent): boolean => {\n                    // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n                    const touch = ev.changedTouches[0]!;\n                    const tgt = document.elementFromPoint(touch.clientX, touch.clientY);\n                    return touch.identifier === this.touchID && tgt instanceof Element && tgt.classList.contains(\"ioDwellSpring\");\n                });\n        } else {\n            new TouchTransition(this.moved, released, \"touchend\",\n                (event: TouchEvent): void => {\n                    dataHandler.onRelease(event);\n                },\n                (event: TouchEvent): boolean => event.changedTouches[0]?.identifier === this.touchID);\n        }\n    }\n\n    public getTouchId(): number | undefined {\n        return this.touchID;\n    }\n\n    public override reinit(): void {\n        super.reinit();\n        this.touchID = undefined;\n    }\n}\n\n/**\n * The FSM of the one touch DnD interaction\n * @category FSM\n */\nexport class OneTouchDnDFSM extends TouchDnDFSM {\n    /**\n     * Creates a DnD touch FSM that only works with one touch.\n     * @param cancellable - Whether the DnD can be cancelled by interacting with a dwell-and-spring element.\n     * @param logger - The logger to use for this interaction\n     * @param dataHandler - The data handler the FSM will use\n     */\n    public constructor(cancellable: boolean, logger: Logger, dataHandler: TouchDnDFSMHandler) {\n        super(cancellable, logger, dataHandler, true);\n    }\n\n    protected override buildFSM(dataHandler: TouchDnDFSMHandler): void {\n        super.buildFSM(dataHandler);\n\n        const check = (event: TouchEvent): boolean => event.changedTouches[0] !== undefined && event.changedTouches[0].identifier !== this.touchID;\n\n        new TouchTransition(this.moved, this.cancelled, \"touchstart\", undefined, check);\n        new TouchTransition(this.touched, this.cancelled, \"touchstart\", undefined, check);\n    }\n}\n\n/**\n * A touch interaction (that works as a DnD)\n * @category Interaction Library\n */\nexport class TouchDnD extends InteractionBase<SrcTgtPointsData<TouchData>, SrcTgtTouchDataImpl> {\n    /**\n     * Creates the interaction.\n     * @param logger - The logger to use for this interaction\n     * @param cancellable - Whether the DnD can be cancelled by interacting with a dwell-and-spring element.\n     * @param fsm - The optional FSM provided for the interaction\n     * @param name - The name of the user interaction\n     */\n    public constructor(logger: Logger, cancellable: boolean, fsm?: OneTouchDnDFSM, name?: string) {\n        const handler: TouchDnDFSMHandler = {\n            \"onTouch\": (evt: TouchEvent): void => {\n                if (evt.changedTouches[0] !== undefined) {\n                    const touch: Touch = evt.changedTouches[0];\n                    const all = Array.from(evt.touches);\n                    this._data.copySrc(touch, evt, all);\n                    this._data.copyTgt(touch, evt, all);\n                }\n            },\n            \"onMove\": (evt: TouchEvent): void => {\n                this.setTgtData(evt);\n            },\n            \"onRelease\": (evt: TouchEvent): void => {\n                this.setTgtData(evt);\n            }\n        };\n\n        super(fsm ?? new OneTouchDnDFSM(cancellable, logger, handler), new SrcTgtTouchDataImpl(), logger, name ?? TouchDnD.name);\n    }\n\n    private setTgtData(evt: TouchEvent): void {\n        const touch: Touch | undefined = getTouch(evt.changedTouches, this.data.src.identifier);\n        if (touch !== undefined) {\n            this._data.copyTgt(touch, evt, Array.from(evt.touches));\n        }\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {FSMImpl} from \"./FSMImpl\";\nimport type {ConcurrentFSM} from \"../../api/fsm/ConcurrentFSM\";\nimport type {FSM} from \"../../api/fsm/FSM\";\nimport type {FSMHandler} from \"../../api/fsm/FSMHandler\";\nimport type {VisitorFSM} from \"../../api/fsm/VisitorFSM\";\nimport type {Logger} from \"../../api/logging/Logger\";\n\n/**\n * A concurrent FSM: an FSM that contains multiple FSMs that run concurrently.\n * Using this FSM all the sub FSMs must have started to start the main FSM:\n * this is a AND concurrent FSM as all the sub FSMs must run.\n * This FSM can have secondary FSMs that are optionals, i.e. not mandatory for the main\n * FSM to start.\n * @category FSM\n */\nexport class ConcurrentAndFSM<F extends FSM> extends FSMImpl implements ConcurrentFSM<F> {\n    /**\n     * The main fsms\n     */\n    private readonly _conccurFSMs: ReadonlyArray<F>;\n\n    /**\n     * Secondary fsms. These fsms are not considered to determine whether the interaction has started\n     */\n    private readonly _secondaryFSMs: ReadonlyArray<F>;\n\n    private readonly totalReinit: boolean;\n\n    /**\n     * Creates the FSM\n     * @param fsms - The main concurrent FSMs\n     * @param logger - The logger to use\n     * @param secondaries - The secondary FSMs. Not considered in some steps.\n     * @param totalReinit - Defines whether a cancellation of one of the fsms, reinits all the fsms.\n     */\n    public constructor(fsms: ReadonlyArray<F>, logger: Logger, secondaries: ReadonlyArray<F> = [], totalReinit = false) {\n        super(logger);\n\n        this.totalReinit = totalReinit;\n\n        const handler: FSMHandler = {\n            \"fsmStarts\": (): void => {\n                if (this.started) {\n                    this.onStarting();\n                }\n            },\n            \"fsmUpdates\": (): void => {\n                this.onUpdating();\n            },\n            \"fsmStops\": (): void => {\n                this.onTerminating();\n            },\n            \"fsmCancels\": (): void => {\n                this.onCancelling();\n            },\n            \"fsmError\": (err: unknown): void => {\n                this.notifyHandlerOnError(err);\n            }\n        };\n        this._conccurFSMs = Array.from(fsms);\n        this._secondaryFSMs = Array.from(secondaries);\n        for (const fsm of this.conccurFSMs) {\n            fsm.addHandler(handler);\n        }\n    }\n\n    public getAllConccurFSMs(): ReadonlyArray<F> {\n        return [...this._conccurFSMs, ...this._secondaryFSMs];\n    }\n\n    /**\n     * @returns The main FSMs\n     */\n    public get conccurFSMs(): ReadonlyArray<F> {\n        return Array.from(this._conccurFSMs);\n    }\n\n    /**\n     * @returns The secondary FSMs\n     */\n    public get secondaryFSMs(): ReadonlyArray<FSM> {\n        return Array.from(this._secondaryFSMs);\n    }\n\n    public override process(event: Event): boolean {\n        return this.getAllConccurFSMs().some(conccurFSM => conccurFSM.process(event));\n    }\n\n    public override acceptVisitor(visitor: VisitorFSM): void {\n        visitor.visitAndConcurrentFSM(this);\n    }\n\n    public override get started(): boolean {\n        return this.conccurFSMs.every(fsm => fsm.started);\n    }\n\n    // eslint-disable-next-line accessor-pairs\n    public override set log(log: boolean) {\n        super.log = log;\n        for (const fsm of this.conccurFSMs) {\n            fsm.log = log;\n        }\n        for (const fsm of this.secondaryFSMs) {\n            fsm.log = log;\n        }\n    }\n\n    public override uninstall(): void {\n        super.uninstall();\n        for (const fsm of this.conccurFSMs) {\n            fsm.uninstall();\n        }\n        for (const fsm of this.secondaryFSMs) {\n            fsm.uninstall();\n        }\n    }\n\n    public override fullReinit(): void {\n        if (this.totalReinit) {\n            for (const fsm of this.conccurFSMs) {\n                fsm.fullReinit();\n            }\n            for (const fsm of this.secondaryFSMs) {\n                fsm.fullReinit();\n            }\n        }\n        super.fullReinit();\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {InteractionBase} from \"./InteractionBase\";\nimport type {Flushable} from \"./Flushable\";\nimport type {ConcurrentFSM} from \"../../api/fsm/ConcurrentFSM\";\nimport type {EventType} from \"../../api/fsm/EventType\";\nimport type {FSM} from \"../../api/fsm/FSM\";\nimport type {OutputState} from \"../../api/fsm/OutputState\";\nimport type {Logger} from \"../../api/logging/Logger\";\nimport type {Subscription} from \"rxjs/internal/Subscription\";\n\n/**\n * The base implementation of a user interaction that uses concurrent FSMs.\n * @typeParam D - The type of the interaction data.\n * @typeParam F - The type of the FSM.\n * @category Interaction\n */\nexport abstract class ConcurrentInteraction<D extends object, DImpl extends D & Flushable, F extends ConcurrentFSM<FSM> = ConcurrentFSM<FSM>>\n    extends InteractionBase<D, DImpl, F> {\n    private readonly subscriptions: Array<Subscription>;\n\n    /**\n     * Creates the concurrent interaction.\n     * @param fsm - The concurrent FSM that defines the behavior of the user interaction.\n     * @param data - The interaction data.\n     * @param logger - The logger to use for this interaction\n     * @param name - The real name of the interaction\n     * @param reinitDataOnFSMReinit - Reinits the interaction data when the FSM is reinitialized. True by default\n     */\n    protected constructor(fsm: F, data: DImpl, logger: Logger, name: string, reinitDataOnFSMReinit = true) {\n        super(fsm, data, logger, name, reinitDataOnFSMReinit);\n        this.subscriptions = this.fsm.getAllConccurFSMs()\n            .map(conc => conc.currentStateObservable\n                .subscribe(current => {\n                    this.updateEventsRegistered(current[1], current[0]);\n                }));\n    }\n\n    public override isRunning(): boolean {\n        return this.isActivated() && this.fsm.started;\n    }\n\n    public override onNodeUnregistered(node: EventTarget): void {\n        for (const type of this.getCurrentAcceptedEvents()) {\n            this.unregisterEventToNode(type, node);\n        }\n    }\n\n    public override onNewNodeRegistered(node: EventTarget): void {\n        for (const type of this.getCurrentAcceptedEvents()) {\n            this.registerEventToNode(type, node);\n        }\n    }\n\n    public override getCurrentAcceptedEvents(_state?: OutputState): ReadonlyArray<EventType> {\n        return this.fsm.getAllConccurFSMs().flatMap(concFSM => Array.from(this.getEventTypesOf(concFSM.currentState)));\n    }\n\n    public override uninstall(): void {\n        super.uninstall();\n        for (const sub of this.subscriptions) {\n            sub.unsubscribe();\n        }\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport type {Flushable} from \"./Flushable\";\nimport type {SrcTgtTouchDataImpl} from \"./SrcTgtTouchDataImpl\";\nimport type {MultiTouchData} from \"../../api/interaction/MultiTouchData\";\nimport type {SrcTgtPointsData} from \"../../api/interaction/SrcTgtPointsData\";\nimport type {TouchData} from \"../../api/interaction/TouchData\";\n\n/**\n * Base class for multi-touch data.\n * @category Interaction Data\n */\nexport abstract class MultiTouchDataBase implements MultiTouchData {\n    public readonly abstract touches: ReadonlyArray<SrcTgtPointsData<TouchData>>;\n\n    public velocity(direction: \"all\" | \"horiz\" | \"vert\"): number {\n        return this.touches.reduce((sum, touch) => sum + touch.velocity(direction), 0) / this.touches.length;\n    }\n}\n\n/**\n * Multi-touch interaction data implementation\n * @category Interaction Data\n */\nexport class MultiTouchDataImpl extends MultiTouchDataBase implements Flushable {\n    protected readonly touchesData: Map<number, SrcTgtTouchDataImpl>;\n\n    /**\n     * Creates the interaction data\n     */\n    public constructor() {\n        super();\n        this.touchesData = new Map<number, SrcTgtTouchDataImpl>();\n    }\n\n    public get touches(): ReadonlyArray<SrcTgtPointsData<TouchData>> {\n        return Array.from(this.touchesData.values());\n    }\n\n    /**\n     * Adds a touch data to this multi-touch data\n     * @param data - The touch data to add\n     */\n    public addTouchData(data: SrcTgtTouchDataImpl): void {\n        this.touchesData.set(data.src.identifier, data);\n    }\n\n    public removeTouchData(id: number): void {\n        const tdata = this.touchesData.get(id);\n        if (tdata !== undefined) {\n            this.touchesData.delete(id);\n            tdata.flush();\n        }\n    }\n\n    public flush(): void {\n        for (const data of this.touchesData.values()) {\n            data.flush();\n        }\n        this.touchesData.clear();\n    }\n\n    /**\n     * Sets new value for the given touch point.\n     * The identifier of the given event point is used to find the corresponding\n     * touch data.\n     * @param tp - The touch event data to use.\n     * @param evt - The touch event\n     */\n    public setTouch(tp: Touch, evt: TouchEvent): void {\n        const tdata = this.touchesData.get(tp.identifier);\n        if (tdata !== undefined) {\n            tdata.copyTgt(tp, evt, Array.from(evt.touches));\n        }\n    }\n\n    /**\n     * @param pxTolerance - The pixel tolerance for considering the line horizontal.\n     * @returns True if the line of each touch is relatively horizontal and in the same direction.\n     */\n    public isHorizontal(pxTolerance: number): boolean {\n        // Direction of the touches, every touch must go in the same direction\n        let direction = 0;\n\n        for (const touch of this.touchesData) {\n            // Initial touch decides the direction for this interaction, either -1 or 1\n            if (direction === 0) {\n                direction = touch[1].diffScreenX / Math.abs(touch[1].diffScreenX);\n            }\n            if (!touch[1].isHorizontal(pxTolerance) || (touch[1].diffScreenX / Math.abs(touch[1].diffScreenX) !== direction)) {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    /**\n     * @param pxTolerance - The pixel tolerance for considering the lines vertical.\n     * @returns True if the line of each touch is relatively vertical and in the same direction.\n     */\n    public isVertical(pxTolerance: number): boolean {\n        // Direction of the touches, every touch must go in the same direction\n        let direction = 0;\n\n        for (const touch of this.touchesData) {\n            // Initial touch decides the direction for this interaction, either -1 or 1\n            if (direction === 0) {\n                direction = touch[1].diffScreenY / Math.abs(touch[1].diffScreenY);\n            }\n            if (!touch[1].isVertical(pxTolerance) || (touch[1].diffScreenY / Math.abs(touch[1].diffScreenY) !== direction)) {\n                return false;\n            }\n        }\n        return true;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {TouchDnDFSM} from \"./TouchDnD\";\nimport {ConcurrentAndFSM} from \"../../fsm/ConcurrentAndFSM\";\nimport {ConcurrentInteraction} from \"../ConcurrentInteraction\";\nimport {MultiTouchDataImpl} from \"../MultiTouchDataImpl\";\nimport {SrcTgtTouchDataImpl} from \"../SrcTgtTouchDataImpl\";\nimport type {TouchDnDFSMHandler} from \"./TouchDnD\";\nimport type {FSMHandler} from \"../../../api/fsm/FSMHandler\";\nimport type {MultiTouchData} from \"../../../api/interaction/MultiTouchData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\n/**\n * The FSM that defines a multi-touch interaction (that works like a DnD)\n * @category FSM\n */\nexport class MultiTouchFSM extends ConcurrentAndFSM<TouchDnDFSM> {\n    /**\n     * Creates the FSM.\n     * @param nbTouch - The number of touches of the interaction\n     * @param totalReinit - Defines whether a cancellation of one of the fsms, reinits all the fsms.\n     * @param logger - The logger to use for this interaction\n     * @param dataHandler - The data handler the FSM will use\n     * @param movementRequired - Whether the DnD starts after the touch point has begun moving (default)\n     * or as soon as the screen is touched. The latter is used for the MultiTouch interaction.\n     */\n    public constructor(nbTouch: number, totalReinit: boolean, logger: Logger, dataHandler: TouchDnDFSMHandler, movementRequired = false) {\n        super(Array.from(Array.from({\"length\": nbTouch}).keys(), () => new TouchDnDFSM(false, logger, dataHandler, movementRequired)),\n            logger, totalReinit ? [new TouchDnDFSM(false, logger, dataHandler, movementRequired)] : [], totalReinit);\n    }\n\n    public override process(event: Event): boolean {\n        if (!(event instanceof TouchEvent)) {\n            return false;\n        }\n\n        let processed = false;\n        let res = false;\n\n        // checking lost touch event\n        if (event.type === \"touchstart\") {\n            const ids = new Set(Array.from(event.touches, touch => touch.identifier));\n            const losts = this.conccurFSMs.filter(fsm => {\n                const id = fsm.getTouchId();\n                return id !== undefined && !ids.has(id);\n            });\n            for (const lost of losts) {\n                lost.reinit();\n            }\n        }\n\n        // eslint-disable-next-line @typescript-eslint/prefer-for-of\n        for (let i = 0; i < event.changedTouches.length; i++) {\n            // Finding an FSM that is currently running with this ID\n            const first: TouchDnDFSM | undefined = this.conccurFSMs\n                .find(fsm => fsm.getTouchId() !== undefined && fsm.getTouchId() === event.changedTouches[i]?.identifier);\n\n            if (first === undefined) {\n                /*\n                 * If no FSM found, two meanings:\n                 * 1/ the touch event is unexpected since all the FSMs are running, so cancelling\n                 */\n                const remainingFSM = this.conccurFSMs.find(fsm => fsm.getTouchId() === undefined);\n                if (remainingFSM === undefined) {\n                    this.onCancelling();\n                    res = false;\n                } else {\n                    // 2/ There exists an FSM that is free to process the new touch\n                    res = remainingFSM.process(event) || res;\n                }\n            } else {\n                processed = true;\n                res = first.process(event) || res;\n            }\n        }\n\n        return processed && res;\n    }\n}\n\n/**\n * A multi-touch user interaction.\n * A multi-touch starts when all its touches have started.\n * A multi-touch ends when the number of required touches is greater than the number of touches.\n * @category Interaction\n */\nexport class MultiTouch extends ConcurrentInteraction<MultiTouchData, MultiTouchDataImpl> {\n    /**\n     * Creates the multi-touch interaction\n     * @param nbTouches - The number of touches.\n     * @param strict - Defines whether too many touches than expected cancelled the ongoing interaction\n     * @param logger - The logger to use for this interaction\n     * @param name - The name of the user interaction\n     * @category Interaction Library\n     */\n    public constructor(nbTouches: number, strict: boolean, logger: Logger, name?: string) {\n        const multiData = new MultiTouchDataImpl();\n        const theFSM = new MultiTouchFSM(nbTouches, strict, logger, {\n            \"onTouch\": (event: TouchEvent): void => {\n                const all = Array.from(event.touches);\n                for (const touch of Array.from(event.changedTouches)) {\n                    const data = new SrcTgtTouchDataImpl();\n                    data.copySrc(touch, event, all);\n                    data.copyTgt(touch, event, all);\n                    this._data.addTouchData(data);\n                }\n            },\n            \"onMove\": (event: TouchEvent): void => {\n                for (const touch of Array.from(event.changedTouches)) {\n                    this._data.setTouch(touch, event);\n                }\n            },\n\n            \"onRelease\": (event: TouchEvent): void => {\n                for (const touch of Array.from(event.changedTouches)) {\n                    this._data.setTouch(touch, event);\n                }\n            }\n        });\n\n        const reinitHandler: FSMHandler = {\n            \"fsmReinit\": (): void => {\n                const currentIDs = new Set(theFSM.conccurFSMs\n                    .filter(fsm => fsm.started)\n                    .map(fsm => fsm.getTouchId()));\n\n                this.data\n                    .touches\n                    .filter(data => !currentIDs.has(data.src.identifier))\n                    // eslint-disable-next-line unicorn/no-array-for-each\n                    .forEach(data => {\n                        multiData.removeTouchData(data.src.identifier);\n                    });\n            }\n        };\n\n        // Have to add a reinit handler for each concc FSM\n        for (const concc of theFSM.conccurFSMs) {\n            concc.addHandler(reinitHandler);\n        }\n\n        super(theFSM, multiData, logger, name ?? MultiTouch.name, false);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {CancelFSMError} from \"../fsm/CancelFSMError\";\nimport type {Interaction, InteractionDataType} from \"../../api/interaction/Interaction\";\nimport type {InteractionBuilder} from \"../../api/interaction/InteractionBuilder\";\n\n/**\n * An implementation of `InteractionBuilder`.\n * @category Interaction\n */\n// eslint-disable-next-line no-use-before-define\nexport class InteractionBuilderImpl<I extends Interaction<D>, D extends object = InteractionDataType<I>>\nimplements InteractionBuilder<I, D> {\n    private readonly iCtor: (name?: string) => I;\n\n    private startPredicate: ((i: D) => boolean) | undefined;\n\n    private thenPredicate: ((i: D) => boolean) | undefined;\n\n    private endPredicate: ((i: D) => boolean) | undefined;\n\n    private interactionName: string | undefined;\n\n    /**\n     * @param interactionSupplier - The command that provides an instance of the\n     * user interaction to customize.\n     */\n    public constructor(interactionSupplier: (name?: string) => I) {\n        this.iCtor = interactionSupplier;\n        this.startPredicate = undefined;\n        this.thenPredicate = undefined;\n        this.endPredicate = undefined;\n        this.interactionName = undefined;\n    }\n\n    public first(predicate: (i: D) => boolean): this {\n        this.startPredicate = predicate;\n        return this;\n    }\n\n    public then(predicate: (i: D) => boolean): this {\n        this.thenPredicate = predicate;\n        return this;\n    }\n\n    public firstAndThen(predicate: (i: D) => boolean): this {\n        this.first(predicate);\n        this.then(predicate);\n        return this;\n    }\n\n    public end(predicate: (i: D) => boolean): this {\n        this.endPredicate = predicate;\n        return this;\n    }\n\n    public name(name: string): this {\n        this.interactionName = name;\n        return this;\n    }\n\n    public build(): () => I {\n        return () => {\n            const i = this.iCtor(this.interactionName);\n            i.fsm.addHandler({\n                \"preFsmStart\": () => {\n                    this.process(i, this.startPredicate);\n                },\n                \"preFsmUpdate\": () => {\n                    this.process(i, this.thenPredicate);\n                },\n                \"preFsmStop\": () => {\n                    this.process(i, this.endPredicate);\n                }\n            });\n            return i;\n        };\n    }\n\n    private process(i: I, predicate?: (d: D) => boolean): void {\n        if (predicate !== undefined && !predicate(i.data)) {\n            throw new CancelFSMError();\n        }\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {TouchDnD} from \"./TouchDnD\";\nimport {InteractionBuilderImpl} from \"../InteractionBuilderImpl\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\n/**\n * Creates the horizontal pan (or a swipe if minVelocity is used).\n * @param logger - The logger to use for this interaction\n * @param cancellable - Whether the DnD can be cancelled by interacting with a dwell-and-spring element.\n * @param pxTolerance - The pixel tolerance for considering the line horizontal.\n * @param minLength - The minimal distance from the starting point to the release point for validating the pan\n * @param minVelocity - The minimal minVelocity to reach for validating the swipe. In pixels per second.\n * @returns The supplier that will produce the interaction when called\n * @category Interaction Library\n */\nexport function hPan(logger: Logger, cancellable: boolean,\n                     pxTolerance: number, minLength?: number, minVelocity?: number): () => TouchDnD {\n    return new InteractionBuilderImpl(name => new TouchDnD(logger, cancellable, undefined, name))\n        .firstAndThen(data => data.isHorizontal(pxTolerance))\n        .end(data => (minLength === undefined || Math.abs(data.diffScreenX) >= minLength) &&\n          (minVelocity === undefined || data.velocity(\"horiz\") >= minVelocity))\n        .name(hPan.name)\n        .build();\n}\n\n/**\n * Creates the vertical pan (or a swipe if minVelocity is used).\n * @param logger - The logger to use for this interaction\n * @param cancellable - Whether the DnD can be cancelled by interacting with a dwell-and-spring element.\n * @param pxTolerance - The pixel tolerance for considering the line vertical.\n * @param minLength - The minimal distance from the starting point to the release point for validating the pan\n * @param minVelocity - The minimal minVelocity to reach for validating the swipe. In pixels per second.\n * @returns The supplier that will produce the interaction when called\n * @category Interaction Library\n */\nexport function vPan(logger: Logger, cancellable: boolean,\n                     pxTolerance: number, minLength?: number, minVelocity?: number): () => TouchDnD {\n    return new InteractionBuilderImpl(name => new TouchDnD(logger, cancellable, undefined, name))\n        .firstAndThen(data => data.isVertical(pxTolerance))\n        .end(data => (minLength === undefined || Math.abs(data.diffScreenY) >= minLength) &&\n          (minVelocity === undefined || data.velocity(\"vert\") >= minVelocity))\n        .name(vPan.name)\n        .build();\n}\n\n/**\n * Creates a left pan (or a swipe if minVelocity is used).\n * @param logger - The logger to use for this interaction\n * @param cancellable - Whether the DnD can be cancelled by interacting with a dwell-and-spring element.\n * @param pxTolerance - The pixel tolerance for considering the line to the left.\n * @param minLength - The minimal distance from the starting point to the release point for validating the pan\n * @param minVelocity - The minimal minVelocity to reach for validating the swipe. In pixels per second.\n * @returns The supplier that will produce the interaction when called\n * @category Interaction Library\n */\nexport function leftPan(logger: Logger, cancellable: boolean,\n                        pxTolerance: number, minLength?: number, minVelocity?: number): () => TouchDnD {\n    return new InteractionBuilderImpl(name => new TouchDnD(logger, cancellable, undefined, name))\n        .firstAndThen(data => data.isLeft(pxTolerance))\n        .end(data => (minLength === undefined || Math.abs(data.diffScreenX) >= minLength) &&\n          (minVelocity === undefined || data.velocity(\"horiz\") >= minVelocity))\n        .name(leftPan.name)\n        .build();\n}\n\n/**\n * Creates a right pan (or a swipe if minVelocity is used).\n * @param logger - The logger to use for this interaction\n * @param cancellable - Whether the DnD can be cancelled by interacting with a dwell-and-spring element.\n * @param pxTolerance - The pixel tolerance for considering the line to the right.\n * @param minLength - The minimal distance from the starting point to the release point for validating the pan\n * @param minVelocity - The minimal minVelocity to reach for validating the swipe. In pixels per second.\n * @returns The supplier that will produce the interaction when called\n * @category Interaction Library\n */\nexport function rightPan(logger: Logger, cancellable: boolean,\n                         pxTolerance: number, minLength?: number, minVelocity?: number): () => TouchDnD {\n    return new InteractionBuilderImpl(name => new TouchDnD(logger, cancellable, undefined, name))\n        .firstAndThen(data => data.isRight(pxTolerance))\n        .end(data => (minLength === undefined || Math.abs(data.diffScreenX) >= minLength) &&\n          (minVelocity === undefined || data.velocity(\"horiz\") >= minVelocity))\n        .name(rightPan.name)\n        .build();\n}\n\n/**\n * Creates a top pan (or a swipe if minVelocity is used).\n * @param logger - The logger to use for this interaction\n * @param cancellable - Whether the DnD can be cancelled by interacting with a dwell-and-spring element.\n * @param pxTolerance - The pixel tolerance for considering the line to the top.\n * @param minLength - The minimal distance from the starting point to the release point for validating the pan\n * @param minVelocity - The minimal minVelocity to reach for validating the swipe. In pixels per second.\n * @returns The supplier that will produce the interaction when called\n * @category Interaction Library\n */\nexport function topPan(logger: Logger, cancellable: boolean,\n                       pxTolerance: number, minLength?: number, minVelocity?: number): () => TouchDnD {\n    return new InteractionBuilderImpl(name => new TouchDnD(logger, cancellable, undefined, name))\n        .firstAndThen(data => data.isTop(pxTolerance))\n        .end(data => (minLength === undefined || Math.abs(data.diffScreenY) >= minLength) &&\n          (minVelocity === undefined || data.velocity(\"vert\") >= minVelocity))\n        .name(topPan.name)\n        .build();\n}\n\n/**\n * Creates a bottom pan (or a swipe if minVelocity is used).\n * @param logger - The logger to use for this interaction\n * @param cancellable - Whether the DnD can be cancelled by interacting with a dwell-and-spring element.\n * @param pxTolerance - The pixel tolerance for considering the line to the bottom.\n * @param minLength - The minimal distance from the starting point to the release point for validating the pan\n * @param minVelocity - The minimal minVelocity to reach for validating the swipe. In pixels per second.\n * @returns The supplier that will produce the interaction when called\n * @category Interaction Library\n */\nexport function bottomPan(logger: Logger, cancellable: boolean,\n                          pxTolerance: number, minLength?: number, minVelocity?: number): () => TouchDnD {\n    return new InteractionBuilderImpl(name => new TouchDnD(logger, cancellable, undefined, name))\n        .firstAndThen(data => data.isBottom(pxTolerance))\n        .end(data => (minLength === undefined || Math.abs(data.diffScreenY) >= minLength) &&\n          (minVelocity === undefined || data.velocity(\"vert\") >= minVelocity))\n        .name(bottomPan.name)\n        .build();\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {MultiTouchDataBase} from \"./MultiTouchDataImpl\";\nimport {SrcTgtTouchDataImpl} from \"./SrcTgtTouchDataImpl\";\nimport type {EventModifierData} from \"../../api/interaction/EventModifierData\";\nimport type {SrcTgtPointsData} from \"../../api/interaction/SrcTgtPointsData\";\nimport type {TouchData} from \"../../api/interaction/TouchData\";\nimport type {TwoTouchData} from \"../../api/interaction/TwoTouchData\";\nimport type {UnitInteractionData} from \"../../api/interaction/UnitInteractionData\";\n\n/**\n * The implementation class of TwoTouchData\n * @category Interaction Data\n */\nexport abstract class TwoTouchDataImpl extends MultiTouchDataBase implements TwoTouchData {\n    protected readonly t1: SrcTgtTouchDataImpl;\n\n    protected readonly t2: SrcTgtTouchDataImpl;\n\n    public constructor() {\n        super();\n        this.t1 = new SrcTgtTouchDataImpl();\n        this.t2 = new SrcTgtTouchDataImpl();\n    }\n\n    public get touch1(): SrcTgtPointsData<TouchData> {\n        return this.t1;\n    }\n\n    public get touch2(): SrcTgtPointsData<TouchData> {\n        return this.t2;\n    }\n\n    public get touches(): ReadonlyArray<SrcTgtPointsData<TouchData>> {\n        return [this.t1, this.t2];\n    }\n\n    public flush(): void {\n        this.t1.flush();\n        this.t2.flush();\n    }\n\n    public initTouch(data: Touch, evt: EventModifierData & UnitInteractionData, allTouches: Array<Touch>): void {\n        if (this.t1.src.identifier === -1) {\n            this.t1.copySrc(data, evt, allTouches);\n            this.t1.copyTgt(data, evt, allTouches);\n        } else {\n            if (this.t2.src.identifier === -1) {\n                this.t2.copySrc(data, evt, allTouches);\n                this.t2.copyTgt(data, evt, allTouches);\n            }\n        }\n    }\n\n    public copyTouch(data: Touch, evt: EventModifierData & UnitInteractionData, allTouches: Array<Touch>): void {\n        if (this.t1.src.identifier === data.identifier) {\n            this.t1.copyTgt(data, evt, allTouches);\n        } else {\n            if (this.t2.src.identifier === data.identifier) {\n                this.t2.copyTgt(data, evt, allTouches);\n            }\n        }\n    }\n\n    public get diffClientX(): number {\n        return (this.t1.diffClientX + this.t2.diffClientX) / 2;\n    }\n\n    public get diffClientY(): number {\n        return (this.t1.diffClientY + this.t2.diffClientY) / 2;\n    }\n\n    public get diffPageX(): number {\n        return (this.t1.diffPageX + this.t2.diffPageX) / 2;\n    }\n\n    public get diffPageY(): number {\n        return (this.t1.diffPageY + this.t2.diffPageY) / 2;\n    }\n\n    public get diffScreenX(): number {\n        return (this.t1.diffScreenX + this.t2.diffScreenX) / 2;\n    }\n\n    public get diffScreenY(): number {\n        return (this.t1.diffScreenY + this.t2.diffScreenY) / 2;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {TwoTouchDataImpl} from \"./TwoTouchDataImpl\";\nimport type {RotationTouchData} from \"../../api/interaction/RotationTouchData\";\nimport type {TouchData} from \"../../api/interaction/TouchData\";\n\n/**\n * The implementation of the rotation interaction data.\n * @category Interaction Data\n */\nexport class RotationTouchDataImpl extends TwoTouchDataImpl implements RotationTouchData {\n    public get rotationAngle(): number {\n        return this.computeAngle(this.t1.src, this.t2.src) - this.computeAngle(this.t1.src, this.t2.tgt);\n    }\n\n    private computeAngle(t1: TouchData, t2: TouchData): number {\n        return Math.atan2(t2.clientX - t1.clientX, t1.clientY - t2.clientY);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {TwoTouchDataImpl} from \"./TwoTouchDataImpl\";\nimport type {ScaleTouchData} from \"../../api/interaction/ScaleTouchData\";\n\n/**\n * The implementation of the scale/pinch interaction data.\n * @category Interaction Data\n */\nexport class ScaleTouchDataImpl extends TwoTouchDataImpl implements ScaleTouchData {\n    public scalingRatio(pxTolerance: number): number {\n        // 1. Check that there are 2 touches\n        const t0 = this.t1;\n        const t1 = this.t2;\n\n        if (t0.src.identifier === -1 || t1.src.identifier === -1) {\n            return 0;\n        }\n\n        const tgt1: [number, number] = [t0.tgt.screenX, t0.tgt.screenY];\n        const tgt2: [number, number] = [t1.tgt.screenX, t1.tgt.screenY];\n\n        const src1: [number, number] = [t0.src.screenX, t0.src.screenY];\n        const src2: [number, number] = [t1.src.screenX, t1.src.screenY];\n\n        const vector1: [number, number] = [t0.diffScreenX, t0.diffScreenY];\n        const vector2: [number, number] = [t1.diffScreenX, t1.diffScreenY];\n\n        // 2. Define the line between the 2 sources\n        const lineVector: [number, number] = [tgt2[0] - tgt1[0], tgt2[1] - tgt1[1]];\n\n        // 3. For each touch, define the projection of the target on the line\n        const projection1 = ScaleTouchDataImpl.project(vector1, lineVector);\n        const projectionVector1: [number, number] = [projection1 * lineVector[0], projection1 * lineVector[1]];\n\n        const projection2 = ScaleTouchDataImpl.project(vector2, lineVector);\n        const projectionVector2: [number, number] = [projection2 * lineVector[0], projection2 * lineVector[1]];\n\n        // 4. Check that the projections have opposite signs\n        if (projection1 / Math.abs(projection1) === projection2 / Math.abs(projection2)) {\n            return 0;\n        }\n\n        // 5. Calculate the distances between the targets and the projected points and check they are < pxTolerance\n        const distance1 = ScaleTouchDataImpl.distance(projectionVector1, vector1);\n        const distance2 = ScaleTouchDataImpl.distance(projectionVector2, vector2);\n\n        if (distance1 > pxTolerance || distance2 > pxTolerance || Number.isNaN(distance1) || Number.isNaN(distance2)) {\n            return 0;\n        }\n\n        /*\n         * 6. Calculate the ratio between the distance between the end position of the touches\n         * and the distance between the starting position of the touches\n         */\n        return ScaleTouchDataImpl.distance(tgt1, tgt2) / ScaleTouchDataImpl.distance(src1, src2);\n    }\n\n    /**\n     * @param vector1 - The first vector of the projection\n     * @param vector2 -The second vector of the projection\n     * @returns The value of the projection of vector1 on vector2\n     */\n    public static project(vector1: [number, number], vector2: [number, number]): number {\n        return (vector1[0] * vector2[0] + vector1[1] * vector2[1]) / (vector2[0] ** 2 + vector2[1] ** 2);\n    }\n\n    /**\n     * @param point1 - The first point\n     * @param point2 - The second point\n     * @returns the distance between point1 and point2\n     */\n    public static distance(point1: [number, number], point2: [number, number]): number {\n        return Math.hypot((point2[0] - point1[0]), (point2[1] - point1[1]));\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {TwoTouchDataImpl} from \"./TwoTouchDataImpl\";\nimport type {LineTouchData} from \"../../api/interaction/LineTouchData\";\n\n/**\n * The user interaction data for two-touch pan interactions\n * @category Interaction Data\n */\nexport class TwoPanDataImpl extends TwoTouchDataImpl implements LineTouchData {\n    public isVertical(pxTolerance: number): boolean {\n        return this.isTop(pxTolerance) || this.isBottom(pxTolerance);\n    }\n\n    public isHorizontal(pxTolerance: number): boolean {\n        return this.isLeft(pxTolerance) || this.isRight(pxTolerance);\n    }\n\n    public isLeft(pxTolerance: number): boolean {\n        return this.t1.isLeft(pxTolerance) && this.t2.isLeft(pxTolerance);\n    }\n\n    public isRight(pxTolerance: number): boolean {\n        return this.t1.isRight(pxTolerance) && this.t2.isRight(pxTolerance);\n    }\n\n    public isTop(pxTolerance: number): boolean {\n        return this.t1.isTop(pxTolerance) && this.t2.isTop(pxTolerance);\n    }\n\n    public isBottom(pxTolerance: number): boolean {\n        return this.t1.isBottom(pxTolerance) && this.t2.isBottom(pxTolerance);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {RotationTouchDataImpl} from \"./RotationTouchDataImpl\";\nimport {ScaleTouchDataImpl} from \"./ScaleTouchDataImpl\";\nimport {TwoPanDataImpl} from \"./TwoPanDataImpl\";\nimport {TwoTouchDataImpl} from \"./TwoTouchDataImpl\";\nimport type {LineTouchData} from \"../../api/interaction/LineTouchData\";\nimport type {RotationTouchData} from \"../../api/interaction/RotationTouchData\";\nimport type {ScaleTouchData} from \"../../api/interaction/ScaleTouchData\";\nimport type {GeneralTwoTouchData} from \"../../api/interaction/TwoTouchData\";\n\n/**\n * The interaction data that stores all information related to two-touch based user\n * interactions.\n * @category Interaction Data\n */\nexport class GeneralTwoTouchDataImpl extends TwoTouchDataImpl implements GeneralTwoTouchData {\n    private readonly rotateData: RotationTouchData;\n\n    private readonly panData: LineTouchData;\n\n    private readonly scaleData: ScaleTouchData;\n\n    public constructor() {\n        super();\n        this.rotateData = new RotationTouchDataImpl();\n        this.panData = new TwoPanDataImpl();\n        this.scaleData = new ScaleTouchDataImpl();\n    }\n\n    public isVertical(pxTolerance: number): boolean {\n        return this.panData.isVertical(pxTolerance);\n    }\n\n    public isHorizontal(pxTolerance: number): boolean {\n        return this.panData.isHorizontal(pxTolerance);\n    }\n\n    public isLeft(pxTolerance: number): boolean {\n        return this.panData.isLeft(pxTolerance);\n    }\n\n    public isRight(pxTolerance: number): boolean {\n        return this.panData.isRight(pxTolerance);\n    }\n\n    public isTop(pxTolerance: number): boolean {\n        return this.panData.isTop(pxTolerance);\n    }\n\n    public isBottom(pxTolerance: number): boolean {\n        return this.panData.isBottom(pxTolerance);\n    }\n\n    public get rotationAngle(): number {\n        return this.rotateData.rotationAngle;\n    }\n\n    public scalingRatio(pxTolerance: number): number {\n        return this.scaleData.scalingRatio(pxTolerance);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {GeneralTwoTouchDataImpl} from \"./GeneralTwoTouchDataImpl\";\nimport {SrcTgtTouchDataImpl} from \"./SrcTgtTouchDataImpl\";\nimport type {EventModifierData} from \"../../api/interaction/EventModifierData\";\nimport type {SrcTgtPointsData} from \"../../api/interaction/SrcTgtPointsData\";\nimport type {ThreeTouchData} from \"../../api/interaction/ThreeTouchData\";\nimport type {TouchData} from \"../../api/interaction/TouchData\";\nimport type {UnitInteractionData} from \"../../api/interaction/UnitInteractionData\";\n\n/**\n * The user interaction data for three-touch interactions\n * @category Interaction Data\n */\nexport class ThreeTouchDataImpl extends GeneralTwoTouchDataImpl implements ThreeTouchData {\n    protected readonly t3: SrcTgtTouchDataImpl;\n\n    public constructor() {\n        super();\n        this.t3 = new SrcTgtTouchDataImpl();\n    }\n\n    public get touch3(): SrcTgtPointsData<TouchData> {\n        return this.t3;\n    }\n\n    public override get touches(): ReadonlyArray<SrcTgtPointsData<TouchData>> {\n        return [this.t1, this.t2, this.t3];\n    }\n\n    public override flush(): void {\n        super.flush();\n        this.t3.flush();\n    }\n\n    public override initTouch(data: Touch, evt: EventModifierData & UnitInteractionData, allTouches: Array<Touch>): void {\n        // If only t3 is not initialised\n        if (this.t3.src.identifier === -1 && this.t2.src.identifier !== -1) {\n            this.t3.copySrc(data, evt, allTouches);\n            this.t3.copyTgt(data, evt, allTouches);\n        } else {\n            super.initTouch(data, evt, allTouches);\n        }\n    }\n\n    public override copyTouch(data: Touch, evt: EventModifierData & UnitInteractionData, allTouches: Array<Touch>): void {\n        if (this.t3.src.identifier === data.identifier) {\n            this.t3.copyTgt(data, evt, allTouches);\n        } else {\n            super.copyTouch(data, evt, allTouches);\n        }\n    }\n\n    public override isLeft(pxTolerance: number): boolean {\n        return super.isLeft(pxTolerance) && this.t3.isLeft(pxTolerance);\n    }\n\n    public override isRight(pxTolerance: number): boolean {\n        return super.isRight(pxTolerance) && this.t3.isRight(pxTolerance);\n    }\n\n    public override isTop(pxTolerance: number): boolean {\n        return super.isTop(pxTolerance) && this.t3.isTop(pxTolerance);\n    }\n\n    public override isBottom(pxTolerance: number): boolean {\n        return super.isBottom(pxTolerance) && this.t3.isBottom(pxTolerance);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {SrcTgtTouchDataImpl} from \"./SrcTgtTouchDataImpl\";\nimport {ThreeTouchDataImpl} from \"./ThreeTouchDataImpl\";\nimport type {EventModifierData} from \"../../api/interaction/EventModifierData\";\nimport type {FourTouchData} from \"../../api/interaction/FourTouchData\";\nimport type {SrcTgtPointsData} from \"../../api/interaction/SrcTgtPointsData\";\nimport type {TouchData} from \"../../api/interaction/TouchData\";\nimport type {UnitInteractionData} from \"../../api/interaction/UnitInteractionData\";\n\n/**\n * The interaction data for four-touch user interactions.\n * @category Interaction Data\n */\nexport class FourTouchDataImpl extends ThreeTouchDataImpl implements FourTouchData {\n    private readonly t4: SrcTgtTouchDataImpl;\n\n    public constructor() {\n        super();\n        this.t4 = new SrcTgtTouchDataImpl();\n    }\n\n    public get touch4(): SrcTgtPointsData<TouchData> {\n        return this.t4;\n    }\n\n    public override get touches(): ReadonlyArray<SrcTgtPointsData<TouchData>> {\n        return [this.t1, this.t2, this.t3, this.t4];\n    }\n\n    public override initTouch(data: Touch, evt: EventModifierData & UnitInteractionData, allTouches: Array<Touch>): void {\n        // If only t4 is not initialised\n        if (this.t4.src.identifier === -1 && this.t3.src.identifier !== -1) {\n            this.t4.copySrc(data, evt, allTouches);\n            this.t4.copyTgt(data, evt, allTouches);\n        } else {\n            super.initTouch(data, evt, allTouches);\n        }\n    }\n\n    public override copyTouch(data: Touch, evt: EventModifierData & UnitInteractionData, allTouches: Array<Touch>): void {\n        if (this.t4.src.identifier === data.identifier) {\n            this.t4.copyTgt(data, evt, allTouches);\n        } else {\n            super.copyTouch(data, evt, allTouches);\n        }\n    }\n\n    public override flush(): void {\n        super.flush();\n        this.t4.flush();\n    }\n\n    public override isLeft(pxTolerance: number): boolean {\n        return super.isLeft(pxTolerance) && this.t4.isLeft(pxTolerance);\n    }\n\n    public override isRight(pxTolerance: number): boolean {\n        return super.isRight(pxTolerance) && this.t4.isRight(pxTolerance);\n    }\n\n    public override isTop(pxTolerance: number): boolean {\n        return super.isTop(pxTolerance) && this.t4.isTop(pxTolerance);\n    }\n\n    public override isBottom(pxTolerance: number): boolean {\n        return super.isBottom(pxTolerance) && this.t4.isBottom(pxTolerance);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {MultiTouchFSM} from \"./MultiTouch\";\nimport {ConcurrentInteraction} from \"../ConcurrentInteraction\";\nimport {FourTouchDataImpl} from \"../FourTouchDataImpl\";\nimport {GeneralTwoTouchDataImpl} from \"../GeneralTwoTouchDataImpl\";\nimport {InteractionBuilderImpl} from \"../InteractionBuilderImpl\";\nimport {ThreeTouchDataImpl} from \"../ThreeTouchDataImpl\";\nimport type {TouchDnDFSMHandler} from \"./TouchDnD\";\nimport type {FourTouchData} from \"../../../api/interaction/FourTouchData\";\nimport type {ThreeTouchData} from \"../../../api/interaction/ThreeTouchData\";\nimport type {GeneralTwoTouchData, TwoTouchData} from \"../../../api/interaction/TwoTouchData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\nimport type {TwoTouchDataImpl} from \"../TwoTouchDataImpl\";\n\n/**\n * The X-touch represents any touch interaction that involve more than one touch.\n * This class is usually used to build more complex touch interactions.\n * @category Interaction Library\n */\nexport class XTouchDnD<T extends TwoTouchData, S extends T & TwoTouchDataImpl> extends ConcurrentInteraction<T, S> {\n    /**\n     * Creates the interaction.\n     * @param nbTouches - The number of touches of the interaction\n     * @param logger - The logger to use for this interaction\n     * @param dataImpl - The interaction data instance to use.\n     * @param name - The name of the user interaction\n     * @param fsm - The optional FSM provided for the interaction\n     * @param movementRequired - Whether the DnD starts after the touch point has begun moving (default)\n     * or as soon as the screen is touched. The latter is used for the MultiTouch interaction.\n     */\n    public constructor(nbTouches: number, logger: Logger, dataImpl: S, name?: string, fsm?: MultiTouchFSM, movementRequired?: boolean) {\n        const handler: TouchDnDFSMHandler = {\n            \"onTouch\": (evt: TouchEvent): void => {\n                const all = Array.from(evt.touches);\n                for (const touch of Array.from(evt.changedTouches)) {\n                    this._data.initTouch(touch, evt, all);\n                }\n            },\n            \"onMove\": (evt: TouchEvent): void => {\n                this.setTgtData(evt);\n            },\n            \"onRelease\": (evt: TouchEvent): void => {\n                this.setTgtData(evt);\n            }\n        };\n\n        super(fsm ?? new MultiTouchFSM(nbTouches, true, logger, handler, movementRequired), dataImpl, logger, name ?? XTouchDnD.name);\n    }\n\n    protected setTgtData(evt: TouchEvent): void {\n        const all = Array.from(evt.touches);\n        for (const touch of Array.from(evt.changedTouches)) {\n            this._data.copyTouch(touch, evt, all);\n        }\n    }\n}\n\n/**\n * A shortcut that defines a two-touch interactions.\n * @category Interaction Library\n */\nexport type TwoTouch = XTouchDnD<GeneralTwoTouchData, GeneralTwoTouchDataImpl>;\n\n/**\n * Creates a two-touch user interaction\n * @param logger - The logger to use for this interaction\n * @returns A supplier that produces an interaction instance when called\n * @category Interaction Library\n */\nexport function twoTouch(logger: Logger): () => TwoTouch {\n    return new InteractionBuilderImpl(name => new XTouchDnD<GeneralTwoTouchData, GeneralTwoTouchDataImpl>(2, logger,\n        new GeneralTwoTouchDataImpl(), name, undefined, false))\n        .name(twoTouch.name)\n        .build();\n}\n\n/**\n * A touch interaction that involves three touches exactly.\n * @category Interaction Library\n */\nexport class ThreeTouchDnD extends XTouchDnD<ThreeTouchData, ThreeTouchDataImpl> {\n    public constructor(logger: Logger, name?: string, movementRequired?: boolean) {\n        super(3, logger, new ThreeTouchDataImpl(), name ?? ThreeTouchDnD.name, undefined, movementRequired);\n    }\n}\n\n/**\n * A touch interaction that involves four touches exactly.\n * @category Interaction Library\n */\nexport class FourTouchDnD extends XTouchDnD<FourTouchData, FourTouchDataImpl> {\n    public constructor(logger: Logger, name?: string, movementRequired?: boolean) {\n        super(4, logger, new FourTouchDataImpl(), name ?? FourTouchDnD.name, undefined, movementRequired);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {XTouchDnD} from \"./XTouch\";\nimport {InteractionBuilderImpl} from \"../InteractionBuilderImpl\";\nimport {TwoPanDataImpl} from \"../TwoPanDataImpl\";\nimport type {LineTouchData} from \"../../../api/interaction/LineTouchData\";\nimport type {TwoTouchData} from \"../../../api/interaction/TwoTouchData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\n/**\n * A type for two-touch pan user interactions\n * @category Interaction Library\n */\nexport type TwoPan = XTouchDnD<LineTouchData & TwoTouchData, TwoPanDataImpl>;\n\n/**\n * Creates the horizontal pan that uses two touches.\n * @param logger - The logger to use for this interaction\n * @param pxTolerance - The pixel tolerance for considering the line horizontal.\n * @param minLength - The minimal distance from the starting point to the release point for validating the pan\n * @param minVelocity - The minimal minVelocity to reach for validating the swipe. In pixels per second.\n * @returns The supplier that will produce the interaction when called\n * @category Interaction Library\n */\nexport function twoHPan(logger: Logger, pxTolerance: number, minLength?: number, minVelocity?: number): () => TwoPan {\n    return new InteractionBuilderImpl(name => new XTouchDnD<LineTouchData & TwoTouchData, TwoPanDataImpl>(2, logger,\n        new TwoPanDataImpl(), name, undefined, true))\n        .firstAndThen(data => data.isHorizontal(pxTolerance))\n        .end(data => (minLength === undefined || Math.abs(data.diffScreenX) >= minLength) &&\n          (minVelocity === undefined || data.velocity(\"horiz\") >= minVelocity))\n        .name(twoHPan.name)\n        .build();\n}\n\n/**\n * Creates the vertical pan that uses two touches.\n * @param logger - The logger to use for this interaction\n * @param pxTolerance - The pixel tolerance for considering the line vertical.\n * @param minLength - The minimal distance from the starting point to the release point for validating the pan\n * @param minVelocity - The minimal minVelocity to reach for validating the swipe. In pixels per second.\n * @returns The supplier that will produce the interaction when called\n * @category Interaction Library\n */\nexport function twoVPan(logger: Logger, pxTolerance: number, minLength?: number, minVelocity?: number): () => TwoPan {\n    return new InteractionBuilderImpl(name => new XTouchDnD<LineTouchData & TwoTouchData, TwoPanDataImpl>(2, logger,\n        new TwoPanDataImpl(), name, undefined, true))\n        .firstAndThen(data => data.isVertical(pxTolerance))\n        .end(data => (minLength === undefined || Math.abs(data.diffScreenY) >= minLength) &&\n          (minVelocity === undefined || data.velocity(\"horiz\") >= minVelocity))\n        .name(twoVPan.name)\n        .build();\n}\n\n/**\n * Creates a left pan that uses two touches.\n * @param logger - The logger to use for this interaction\n * @param pxTolerance - The pixel tolerance for considering the line to the left.\n * @param minLength - The minimal distance from the starting point to the release point for validating the pan\n * @param minVelocity - The minimal minVelocity to reach for validating the swipe. In pixels per second.\n * @returns The supplier that will produce the interaction when called\n * @category Interaction Library\n */\nexport function twoLeftPan(logger: Logger, pxTolerance: number, minLength?: number, minVelocity?: number): () => TwoPan {\n    return new InteractionBuilderImpl(name => new XTouchDnD<LineTouchData & TwoTouchData, TwoPanDataImpl>(2, logger,\n        new TwoPanDataImpl(), name, undefined, true))\n        .firstAndThen(data => data.isLeft(pxTolerance))\n        .end(data => (minLength === undefined || Math.abs(data.diffScreenX) >= minLength) &&\n          (minVelocity === undefined || data.velocity(\"horiz\") >= minVelocity))\n        .name(twoLeftPan.name)\n        .build();\n}\n\n/**\n * Creates a right pan that uses two touches.\n * @param logger - The logger to use for this interaction\n * @param pxTolerance - The pixel tolerance for considering the line to the right.\n * @param minLength - The minimal distance from the starting point to the release point for validating the pan\n * @param minVelocity - The minimal minVelocity to reach for validating the swipe. In pixels per second.\n * @returns The supplier that will produce the interaction when called\n * @category Interaction Library\n */\nexport function twoRightPan(logger: Logger, pxTolerance: number, minLength?: number, minVelocity?: number): () => TwoPan {\n    return new InteractionBuilderImpl(name => new XTouchDnD<LineTouchData & TwoTouchData, TwoPanDataImpl>(2, logger,\n        new TwoPanDataImpl(), name, undefined, true))\n        .firstAndThen(data => data.isRight(pxTolerance))\n        .end(data => (minLength === undefined || Math.abs(data.diffScreenX) >= minLength) &&\n          (minVelocity === undefined || data.velocity(\"horiz\") >= minVelocity))\n        .name(twoRightPan.name)\n        .build();\n}\n\n/**\n * Creates a top pan that uses two touches.\n * @param logger - The logger to use for this interaction\n * @param pxTolerance - The pixel tolerance for considering the line to the top.\n * @param minLength - The minimal distance from the starting point to the release point for validating the pan\n * @param minVelocity - The minimal minVelocity to reach for validating the swipe. In pixels per second.\n * @returns The supplier that will produce the interaction when called\n * @category Interaction Library\n */\nexport function twoTopPan(logger: Logger, pxTolerance: number, minLength?: number, minVelocity?: number): () => TwoPan {\n    return new InteractionBuilderImpl(name => new XTouchDnD<LineTouchData & TwoTouchData, TwoPanDataImpl>(2, logger,\n        new TwoPanDataImpl(), name, undefined, true))\n        .firstAndThen(data => data.isTop(pxTolerance))\n        .end(data => (minLength === undefined || Math.abs(data.diffScreenY) >= minLength) &&\n          (minVelocity === undefined || data.velocity(\"horiz\") >= minVelocity))\n        .name(twoTopPan.name)\n        .build();\n}\n\n/**\n * Creates a bottom pan that uses two touches.\n * @param logger - The logger to use for this interaction\n * @param pxTolerance - The pixel tolerance for considering the line to the bottom.\n * @param minLength - The minimal distance from the starting point to the release point for validating the pan\n * @param minVelocity - The minimal minVelocity to reach for validating the swipe. In pixels per second.\n * @returns The supplier that will produce the interaction when called\n * @category Interaction Library\n */\nexport function twoBottomPan(logger: Logger, pxTolerance: number, minLength?: number, minVelocity?: number): () => TwoPan {\n    return new InteractionBuilderImpl(name => new XTouchDnD<LineTouchData & TwoTouchData, TwoPanDataImpl>(2, logger,\n        new TwoPanDataImpl(), name, undefined, true))\n        .firstAndThen(data => data.isBottom(pxTolerance))\n        .end(data => (minLength === undefined || Math.abs(data.diffScreenY) >= minLength) &&\n          (minVelocity === undefined || data.velocity(\"horiz\") >= minVelocity))\n        .name(twoBottomPan.name)\n        .build();\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {Click} from \"../interaction/library/Click\";\nimport {Clicks} from \"../interaction/library/Clicks\";\nimport {DoubleClick} from \"../interaction/library/DoubleClick\";\nimport {DragLock} from \"../interaction/library/DragLock\";\nimport {KeyDown} from \"../interaction/library/KeyDown\";\nimport {KeysTyped} from \"../interaction/library/KeysTyped\";\nimport {KeyTyped} from \"../interaction/library/KeyTyped\";\nimport {KeyUp} from \"../interaction/library/KeyUp\";\nimport {LongMouseDown} from \"../interaction/library/LongMouseDown\";\nimport {MouseDown} from \"../interaction/library/MouseDown\";\nimport {MouseUp} from \"../interaction/library/MouseUp\";\nimport {MultiTouch} from \"../interaction/library/MultiTouch\";\nimport {leftPan, rightPan, vPan, hPan, topPan, bottomPan} from \"../interaction/library/Pans\";\nimport {TouchDnD} from \"../interaction/library/TouchDnD\";\nimport {twoBottomPan, twoHPan, twoLeftPan, twoRightPan, twoTopPan, twoVPan} from \"../interaction/library/TwoPans\";\nimport type {Binding} from \"../../api/binding/Binding\";\nimport type {Checker, LinterRule, RuleName, Severity} from \"../../api/checker/Checker\";\nimport type {Command} from \"../../api/command/Command\";\nimport type {Interaction} from \"../../api/interaction/Interaction\";\n\n/**\n * An implementation of the Checker API\n * @category Checker\n */\nexport class CheckerImpl implements Checker {\n    private readonly linterRules: Map<RuleName, Severity>;\n\n    private readonly cacheIncluded: Map<string, Set<string>>;\n\n    public constructor() {\n        this.linterRules = new Map();\n        this.linterRules.set(\"same-interactions\", \"ignore\");\n        this.linterRules.set(\"same-data\", \"ignore\");\n        this.linterRules.set(\"included\", \"ignore\");\n        this.cacheIncluded = new Map();\n    }\n\n    public setLinterRules(...rules: ReadonlyArray<LinterRule>): void {\n        for (const rule of rules) {\n            this.linterRules.set(rule[0], rule[1]);\n        }\n        if (this.getIncludedSeverity() !== \"ignore\") {\n            this.fillCacheIncluded();\n        }\n    }\n\n    public checkRules(binding: Binding<Command, Interaction<object>, unknown>,\n                      binds: ReadonlyArray<Binding<Command, Interaction<object>, unknown>>): void {\n        this.checkSameData(binding, binds);\n        // Do not check same-interaction if already checked same-data with the same severity\n        if (this.getSameDataSeverity() !== this.getSameInteractionSeverity()) {\n            this.checkSameInteractions(binding, binds);\n        }\n        this.checkIncluded(binding, binds);\n    }\n\n    public checkSameInteractions(binding: Binding<Command, Interaction<object>, unknown>,\n                                 binds: ReadonlyArray<Binding<Command, Interaction<object>, unknown>>): void {\n        // support OR by splitting name with -\n        this.checkRule(\"same-interactions\", this.getSameInteractionSeverity(binding), binding, binds,\n            currBinding => binding.interaction.name === currBinding.interaction.name,\n            \"[same-interactions] Two bindings use the same user interaction on same widget.\");\n    }\n\n    public checkSameData(binding: Binding<Command, Interaction<object>, unknown>,\n                         binds: ReadonlyArray<Binding<Command, Interaction<object>, unknown>>): void {\n        this.checkRule(\"same-data\", this.getSameDataSeverity(binding), binding, binds,\n            currBinding => binding.interaction.data.constructor === currBinding.interaction.data.constructor,\n            \"[same-data] Two bindings use the same user interaction data type on same widget.\");\n    }\n\n    public checkIncluded(binding: Binding<Command, Interaction<object>, unknown>,\n                         binds: ReadonlyArray<Binding<Command, Interaction<object>, unknown>>): void {\n        // support OR\n        this.checkRule(\"included\", this.getIncludedSeverity(binding), binding, binds,\n            currBinding => this.isIncluded(binding.interaction.name, currBinding.interaction.name),\n            \"[included] The interaction of the first binding is included into the interaction of a second one.\");\n    }\n\n    private checkRule(ruleName: RuleName, severity: Severity,\n                      binding: Binding<Command, Interaction<object>, unknown>,\n                      binds: ReadonlyArray<Binding<Command, Interaction<object>, unknown>>,\n                      predicate: (b: Binding<Command, Interaction<object>, unknown>) => boolean, msg: string): void {\n        if (severity !== \"ignore\" && !binding.isWhenDefined() &&\n          binds\n              .filter(currBinding => currBinding.linterRules.get(ruleName) !== \"ignore\" && !currBinding.isWhenDefined())\n              .some(currBinding => predicate(currBinding) &&\n                this.isWidgetSetsIntersecting(binding.interaction.registeredNodes, currBinding.interaction.registeredNodes))\n        ) {\n            this.printLinterMsg(severity, msg);\n        }\n    }\n\n    private isIncluded(i1: string, i2: string): boolean {\n        return (this.cacheIncluded.get(i1)?.has(i2) ?? false) || (this.cacheIncluded.get(i2)?.has(i1) ?? false);\n    }\n\n    private getSameDataSeverity(binding?: Binding<Command, Interaction<object>, unknown>): Severity {\n        return binding?.linterRules.get(\"same-data\") ?? this.linterRules.get(\"same-data\") ?? \"err\";\n    }\n\n    private getSameInteractionSeverity(binding?: Binding<Command, Interaction<object>, unknown>): Severity {\n        return binding?.linterRules.get(\"same-interactions\") ?? this.linterRules.get(\"same-interactions\") ?? \"err\";\n    }\n\n    private getIncludedSeverity(binding?: Binding<Command, Interaction<object>, unknown>): Severity {\n        return binding?.linterRules.get(\"included\") ?? this.linterRules.get(\"included\") ?? \"err\";\n    }\n\n    private isWidgetSetsIntersecting(w1: ReadonlySet<unknown>, w2: ReadonlySet<unknown>): boolean {\n        return Array.from(w1.values()).some(widget => w2.has(widget));\n    }\n\n    private printLinterMsg(severity: Severity, msg: string): void {\n        if (severity === \"err\") {\n            throw new Error(msg);\n        } else {\n            // eslint-disable-next-line no-console\n            console.warn(msg);\n        }\n    }\n\n    private fillCacheIncluded(): void {\n        if (this.cacheIncluded.size === 0) {\n            this.cacheIncluded.set(Click.name, new Set([DragLock.name, DoubleClick.name, Clicks.name]));\n            this.cacheIncluded.set(DoubleClick.name, new Set([DragLock.name]));\n            this.cacheIncluded.set(KeyDown.name, new Set([KeyTyped.name]));\n            this.cacheIncluded.set(KeyUp.name, new Set([KeyTyped.name]));\n            this.cacheIncluded.set(KeyTyped.name, new Set([KeysTyped.name]));\n            this.cacheIncluded.set(LongMouseDown.name, new Set([Click.name, DoubleClick.name, Clicks.name]));\n            this.cacheIncluded.set(MouseDown.name, new Set([LongMouseDown.name, Click.name, DoubleClick.name, Clicks.name]));\n            this.cacheIncluded.set(MouseUp.name, new Set([Click.name, DoubleClick.name, Clicks.name]));\n            this.cacheIncluded.set(leftPan.name, new Set([hPan.name, TouchDnD.name]));\n            this.cacheIncluded.set(rightPan.name, new Set([hPan.name, TouchDnD.name]));\n            this.cacheIncluded.set(topPan.name, new Set([vPan.name, TouchDnD.name]));\n            this.cacheIncluded.set(bottomPan.name, new Set([vPan.name, TouchDnD.name]));\n            this.cacheIncluded.set(hPan.name, new Set([TouchDnD.name]));\n            this.cacheIncluded.set(vPan.name, new Set([TouchDnD.name]));\n            this.cacheIncluded.set(twoHPan.name, new Set([MultiTouch.name]));\n            this.cacheIncluded.set(twoVPan.name, new Set([MultiTouch.name]));\n            this.cacheIncluded.set(twoLeftPan.name, new Set([twoHPan.name, MultiTouch.name]));\n            this.cacheIncluded.set(twoRightPan.name, new Set([twoHPan.name, MultiTouch.name]));\n            this.cacheIncluded.set(twoTopPan.name, new Set([twoVPan.name, MultiTouch.name]));\n            this.cacheIncluded.set(twoBottomPan.name, new Set([twoVPan.name, MultiTouch.name]));\n        }\n    }\n}\n\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {CheckerImpl} from \"../checker/CheckerImpl\";\nimport type {Binding} from \"../../api/binding/Binding\";\nimport type {BindingsObserver} from \"../../api/binding/BindingsObserver\";\nimport type {Checker} from \"../../api/checker/Checker\";\nimport type {Command} from \"../../api/command/Command\";\nimport type {Interaction} from \"../../api/interaction/Interaction\";\nimport type {Subscription} from \"rxjs/internal/Subscription\";\n\n/**\n * An object for observing creates bindings.\n * Can be used with `Bindings.setBindingObserver` to set the global bindings observer\n * @category Binding\n */\nexport class BindingsContext implements BindingsObserver {\n    /**\n     * The bindings gathered when created using `Bindings` routines\n     */\n    private readonly binds: Array<Binding<Command, Interaction<object>, unknown>>;\n\n    /**\n     * For each gathered binding, listening the produced commands\n     */\n    private readonly disposables: Array<Subscription>;\n\n    /**\n     * The commands produced by the gathered bindings\n     */\n    private readonly cmds: Array<[Command, Binding<Command, Interaction<object>, unknown>]>;\n\n    public readonly checker: Checker;\n\n    public constructor() {\n        this.binds = [];\n        this.disposables = [];\n        this.cmds = [];\n        this.checker = new CheckerImpl();\n    }\n\n    public observeBinding(binding: Binding<Command, Interaction<object>, unknown>): void {\n        this.checker.checkRules(binding, this.binds);\n\n        this.binds.push(binding);\n        this.disposables.push(binding.produces.subscribe(cmd => this.cmds.push([cmd, binding])));\n    }\n\n    public clearObservedBindings(): void {\n        for (const dispos of this.disposables) {\n            dispos.unsubscribe();\n        }\n        for (const bind of this.binds) {\n            bind.uninstallBinding();\n        }\n    }\n\n    /**\n     * @returns A read-only array of the gathered bindings.\n     */\n    public get bindings(): ReadonlyArray<Binding<Command, Interaction<object>, unknown>> {\n        return this.binds;\n    }\n\n    /**\n     * @returns A read-only array of the commands produced by the gathered bindings.\n     */\n    public get commands(): ReadonlyArray<Command> {\n        return this.cmds.map(tuple => tuple[0]);\n    }\n\n    /**\n     * @param index - The index of the command (in the order of production)\n     * @returns The command at the given index. The command is cast into the provided generic type.\n     * @typeParam C - The type of the command to return.\n     */\n    public getCmd<C extends Command>(index: number): C | undefined {\n        return this.cmds[index]?.[0] as C | undefined;\n    }\n\n    /**\n     * @param binding - binding The binding to consider\n     * @returns The commands produced by the given binding.\n     */\n    public getCmdsProducedBy(binding: Binding<Command, Interaction<object>, unknown>): ReadonlyArray<Command> {\n        return this.cmds\n            .filter(cmd => cmd[1] === binding)\n            .map(cmd => cmd[0]);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {CommandBase} from \"../CommandBase\";\nimport type {UndoHistoryBase} from \"../../../api/undo/UndoHistoryBase\";\n\n/**\n * A Redo action.\n * @category Command\n */\nexport class Redo extends CommandBase {\n    protected readonly history: UndoHistoryBase;\n\n    public constructor(undoHistory: UndoHistoryBase) {\n        super();\n        this.history = undoHistory;\n    }\n\n    public override canExecute(): boolean {\n        return this.history.getLastRedo() !== undefined;\n    }\n\n    protected execution(): void {\n        this.history.redo();\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {CommandBase} from \"../CommandBase\";\nimport type {UndoHistoryBase} from \"../../../api/undo/UndoHistoryBase\";\n\n/**\n * An Undo command.\n * @category Command\n */\nexport class Undo extends CommandBase {\n    protected readonly history: UndoHistoryBase;\n\n    public constructor(undoHistory: UndoHistoryBase) {\n        super();\n        this.history = undoHistory;\n    }\n\n    public override canExecute(): boolean {\n        return this.history.getLastUndo() !== undefined;\n    }\n\n    protected execution(): void {\n        this.history.undo();\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {isCheckBox} from \"./Events\";\nimport {TransitionBase} from \"./TransitionBase\";\nimport type {EventType} from \"../../api/fsm/EventType\";\n\n/**\n * An FSM transition for the CheckBox HTML element.\n * @category FSM Transition\n */\nexport class BoxCheckPressedTransition extends TransitionBase<InputEvent> {\n    private static readonly acceptedEvents: ReadonlySet<EventType> = new Set([\"input\"]);\n\n    public accept(event: Event): event is InputEvent {\n        return event.currentTarget !== null && isCheckBox(event.currentTarget);\n    }\n\n    public getAcceptedEvents(): ReadonlySet<EventType> {\n        return BoxCheckPressedTransition.acceptedEvents;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {InteractionDataBase} from \"./InteractionDataBase\";\nimport type {Flushable} from \"./Flushable\";\nimport type {WidgetData} from \"../../api/interaction/WidgetData\";\n\n/**\n * The user interaction data for widget based interaction\n * @category Interaction Data\n */\nexport class WidgetDataImpl<T> extends InteractionDataBase implements WidgetData<T>, Flushable {\n    public get widget(): T | undefined {\n        return this.targetData as unknown as T;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {BoxCheckPressedTransition} from \"../../fsm/BoxCheckPressedTransition\";\nimport {isCheckBox} from \"../../fsm/Events\";\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {WidgetDataImpl} from \"../WidgetDataImpl\";\nimport type {WidgetData} from \"../../../api/interaction/WidgetData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\nclass BoxCheckedFSM extends FSMImpl {\n    public constructor(logger: Logger, action: (event: InputEvent) => void) {\n        super(logger);\n        new BoxCheckPressedTransition(this.initState, this.addTerminalState(\"checked\"), action);\n    }\n}\n\n/**\n * A user interaction for CheckBox.\n * @category Interaction Library\n */\nexport class BoxChecked extends InteractionBase<WidgetData<HTMLInputElement>, WidgetDataImpl<HTMLInputElement>> {\n    /**\n     * Creates the interaction.\n     * @param logger - The logger to use for this interaction\n     * @param name - The name of the user interaction\n     */\n    public constructor(logger: Logger, name?: string) {\n        const action = (event: Event): void => {\n            this._data.copy(event);\n        };\n        super(new BoxCheckedFSM(logger, action), new WidgetDataImpl<HTMLInputElement>(), logger, name ?? BoxChecked.name);\n    }\n\n    public override onNewNodeRegistered(node: EventTarget): void {\n        if (isCheckBox(node)) {\n            this.registerActionHandlerInput(node);\n        }\n    }\n\n    public override onNodeUnregistered(node: EventTarget): void {\n        if (isCheckBox(node)) {\n            this.unregisterActionHandlerInput(node);\n        }\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {isButton} from \"./Events\";\nimport {TransitionBase} from \"./TransitionBase\";\nimport type {EventType} from \"../../api/fsm/EventType\";\n\n/**\n * An FSM transition for the Button HTML element.\n * @category FSM Transition\n */\nexport class ButtonPressedTransition extends TransitionBase<InputEvent> {\n    private static readonly acceptedEvents: ReadonlySet<EventType> = new Set([\"click\", \"auxclick\"]);\n\n    public accept(evt: Event): evt is InputEvent {\n        return evt.currentTarget !== null && isButton(evt.currentTarget);\n    }\n\n    public getAcceptedEvents(): ReadonlySet<EventType> {\n        return ButtonPressedTransition.acceptedEvents;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {ButtonPressedTransition} from \"../../fsm/ButtonPressedTransition\";\nimport {isButton} from \"../../fsm/Events\";\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {WidgetDataImpl} from \"../WidgetDataImpl\";\nimport type {WidgetData} from \"../../../api/interaction/WidgetData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\n/**\n * The FSM for button pressures.\n * @category Interaction Library\n */\nclass ButtonPressedFSM extends FSMImpl {\n    /**\n     * Creates the FSM\n     * @param logger - The logger to use for this interaction\n     * @param action - The action to perform on the button pressure.\n     */\n    public constructor(logger: Logger, action: (evt: InputEvent) => void) {\n        super(logger);\n        new ButtonPressedTransition(this.initState, this.addTerminalState(\"pressed\"), action);\n    }\n}\n\n/**\n * A user interaction for buttons.\n * @category Interaction\n */\nexport class ButtonPressed extends InteractionBase<WidgetData<HTMLButtonElement>, WidgetDataImpl<HTMLButtonElement>> {\n    /**\n     * Creates the interaction.\n     * @param logger - The logger to use for this interaction\n     * @param name - The name of the user interaction\n     */\n    public constructor(logger: Logger, name?: string) {\n        const action = (event: InputEvent): void => {\n            this._data.copy(event);\n        };\n        super(new ButtonPressedFSM(logger, action), new WidgetDataImpl<HTMLButtonElement>(), logger, name ?? ButtonPressed.name);\n    }\n\n    public override onNewNodeRegistered(node: EventTarget): void {\n        if (isButton(node)) {\n            this.registerActionHandlerClick(node);\n        }\n    }\n\n    public override onNodeUnregistered(node: EventTarget): void {\n        if (isButton(node)) {\n            this.unregisterActionHandlerClick(node);\n        }\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {isColorChoice} from \"./Events\";\nimport {TransitionBase} from \"./TransitionBase\";\nimport type {EventType} from \"../../api/fsm/EventType\";\n\n/**\n * An FSM transition for the ColorPicked HTML element.\n * @category FSM Transition\n */\nexport class ColorPickedTransition extends TransitionBase<Event> {\n    private static readonly acceptedEvents: ReadonlySet<EventType> = new Set([\"input\"]);\n\n    public accept(event: Event): event is Event {\n        return event.currentTarget !== null && isColorChoice(event.currentTarget);\n    }\n\n    public getAcceptedEvents(): ReadonlySet<EventType> {\n        return ColorPickedTransition.acceptedEvents;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\nimport {ColorPickedTransition} from \"../../fsm/ColorPickedTransition\";\nimport {isColorChoice} from \"../../fsm/Events\";\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {WidgetDataImpl} from \"../WidgetDataImpl\";\nimport type {WidgetData} from \"../../../api/interaction/WidgetData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\nclass ColorPickedFSM extends FSMImpl {\n    public constructor(logger: Logger, action: (evt: Event) => void) {\n        super(logger);\n        new ColorPickedTransition(this.initState, this.addTerminalState(\"picked\"), action);\n    }\n}\n\n/**\n * A user interaction for CheckBox\n * @category Interaction Library\n */\nexport class ColorPicked extends InteractionBase<WidgetData<HTMLInputElement>, WidgetDataImpl<HTMLInputElement>> {\n    /**\n     * Creates the interaction.\n     * @param logger - The logger to use for this interaction\n     * @param name - The name of the user interaction\n     */\n    public constructor(logger: Logger, name?: string) {\n        const action = (event: Event): void => {\n            this._data.copy(event);\n        };\n        super(new ColorPickedFSM(logger, action), new WidgetDataImpl<HTMLInputElement>(), logger, name ?? ColorPicked.name);\n    }\n\n    public override onNewNodeRegistered(node: EventTarget): void {\n        if (isColorChoice(node)) {\n            this.registerActionHandlerInput(node);\n        }\n    }\n\n    public override onNodeUnregistered(node: EventTarget): void {\n        if (isColorChoice(node)) {\n            this.unregisterActionHandlerInput(node);\n        }\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {isComboBox} from \"./Events\";\nimport {TransitionBase} from \"./TransitionBase\";\nimport type {EventType} from \"../../api/fsm/EventType\";\n\n/**\n * An FSM transition for the ComboBox HTML element.\n * @category FSM Transition\n */\nexport class ComboBoxTransition extends TransitionBase<Event> {\n    private static readonly acceptedEvents: ReadonlySet<EventType> = new Set([\"input\"]);\n\n    public accept(event: Event): event is Event {\n        return event.currentTarget !== null && isComboBox(event.currentTarget);\n    }\n\n    public getAcceptedEvents(): ReadonlySet<EventType> {\n        return ComboBoxTransition.acceptedEvents;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {ComboBoxTransition} from \"../../fsm/ComboBoxTransition\";\nimport {isComboBox} from \"../../fsm/Events\";\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {WidgetDataImpl} from \"../WidgetDataImpl\";\nimport type {WidgetData} from \"../../../api/interaction/WidgetData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\nclass ComboBoxSelectedFSM extends FSMImpl {\n    public constructor(logger: Logger, action: (evt: Event) => void) {\n        super(logger);\n        new ComboBoxTransition(this.initState, this.addTerminalState(\"selected\"), action);\n    }\n}\n\n/**\n * A user interaction for CheckBox\n * @category Interaction Library\n */\nexport class ComboBoxSelected extends InteractionBase<WidgetData<HTMLSelectElement>, WidgetDataImpl<HTMLSelectElement>> {\n    /**\n     * Creates the interaction.\n     * @param logger - The logger to use for this interaction\n     * @param name - The name of the user interaction\n     */\n    public constructor(logger: Logger, name?: string) {\n        const action = (event: Event): void => {\n            this._data.copy(event);\n        };\n        super(new ComboBoxSelectedFSM(logger, action), new WidgetDataImpl<HTMLSelectElement>(), logger, name ?? ComboBoxSelected.name);\n    }\n\n    public override onNewNodeRegistered(node: EventTarget): void {\n        if (isComboBox(node)) {\n            this.registerActionHandlerInput(node);\n        }\n    }\n\n    public override onNodeUnregistered(node: EventTarget): void {\n        if (isComboBox(node)) {\n            this.unregisterActionHandlerInput(node);\n        }\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {isDatePicker} from \"./Events\";\nimport {TransitionBase} from \"./TransitionBase\";\nimport type {EventType} from \"../../api/fsm/EventType\";\n\n/**\n * An FSM transition for the DatePicker HTML element.\n * @category FSM Transition\n */\nexport class DatePickedTransition extends TransitionBase<Event> {\n    private static readonly acceptedEvents: ReadonlySet<EventType> = new Set([\"input\"]);\n\n    public accept(event: Event): event is Event {\n        return event.currentTarget !== null && isDatePicker(event.currentTarget);\n    }\n\n    public getAcceptedEvents(): ReadonlySet<EventType> {\n        return DatePickedTransition.acceptedEvents;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {DatePickedTransition} from \"../../fsm/DatePickedTransition\";\nimport {isDatePicker} from \"../../fsm/Events\";\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {WidgetDataImpl} from \"../WidgetDataImpl\";\nimport type {WidgetData} from \"../../../api/interaction/WidgetData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\nclass DatePickedFSM extends FSMImpl {\n    public constructor(logger: Logger, action: (event: Event) => void) {\n        super(logger);\n        new DatePickedTransition(this.initState, this.addTerminalState(\"picked\"), action);\n    }\n}\n\n/**\n * A user interaction for Date input.\n * @category Interaction Library\n */\nexport class DatePicked extends InteractionBase<WidgetData<HTMLInputElement>, WidgetDataImpl<HTMLInputElement>> {\n    /**\n     * Creates the interaction.\n     * @param logger - The logger to use for this interaction\n     * @param name - The name of the user interaction\n     */\n    public constructor(logger: Logger, name?: string) {\n        const action = (event: Event): void => {\n            this._data.copy(event);\n        };\n\n        super(new DatePickedFSM(logger, action), new WidgetDataImpl<HTMLInputElement>(), logger, name ?? DatePicked.name);\n    }\n\n    public override onNewNodeRegistered(node: EventTarget): void {\n        if (isDatePicker(node)) {\n            this.registerActionHandlerInput(node);\n        }\n    }\n\n    public override onNodeUnregistered(node: EventTarget): void {\n        if (isDatePicker(node)) {\n            this.unregisterActionHandlerInput(node);\n        }\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {EscapeKeyPressureTransition} from \"../../fsm/EscapeKeyPressureTransition\";\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {MouseTransition} from \"../../fsm/MouseTransition\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {SrcTgtPointsDataImpl} from \"../SrcTgtPointsDataImpl\";\nimport type {PointData} from \"../../../api/interaction/PointData\";\nimport type {SrcTgtPointsData} from \"../../../api/interaction/SrcTgtPointsData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\ninterface DnDFSMHandler {\n    onPress(event: Event): void;\n    onDrag(event: Event): void;\n    onRelease(event: Event): void;\n}\n\n/**\n * The FSM for DnD interactions.\n */\nclass DnDFSM extends FSMImpl {\n    private readonly cancellable: boolean;\n\n    private buttonToCheck: number | undefined;\n\n    /**\n     * Creates the FSM\n     * @param cancellable - True: the FSM can be cancelled using the ESC key.\n     * @param logger - The logger to use\n     * @param handler - The handler that will receive notifications from the FSM.\n     */\n    public constructor(cancellable: boolean, logger: Logger, handler: DnDFSMHandler) {\n        super(logger);\n        this.cancellable = cancellable;\n\n        const pressed = this.addStdState(\"pressed\");\n        const dragged = this.addStdState(\"dragged\", true);\n        const cancelled = this.addCancellingState(\"cancelled\");\n\n        new MouseTransition(this.initState, pressed, \"mousedown\",\n            (evt: MouseEvent): void => {\n                this.buttonToCheck = evt.button;\n                handler.onPress(evt);\n            });\n\n        new MouseTransition(pressed, cancelled, \"mouseup\", (evt: MouseEvent): boolean => evt.button === this.buttonToCheck);\n\n        const move = new MouseTransition(pressed, dragged, \"mousemove\",\n            (evt: MouseEvent): void => {\n                handler.onDrag(evt);\n            },\n            (evt: MouseEvent): boolean => evt.button === this.buttonToCheck);\n\n        new MouseTransition(dragged, dragged, \"mousemove\", move.action, move.guard);\n\n        new MouseTransition(dragged, this.addTerminalState(\"released\"), \"mouseup\",\n            (event: MouseEvent): void => {\n                handler.onRelease(event);\n            },\n            (event: MouseEvent): boolean => {\n                const tgt = event.currentTarget;\n                return event.button === this.buttonToCheck && (!(tgt instanceof Element) || !tgt.classList.contains(\"ioDwellSpring\"));\n            });\n\n        if (this.cancellable) {\n            new EscapeKeyPressureTransition(pressed, cancelled);\n            new EscapeKeyPressureTransition(dragged, cancelled);\n            new MouseTransition(dragged, cancelled, \"mouseup\",\n                (evt: MouseEvent): boolean => {\n                    const tgt = evt.currentTarget;\n                    return evt.button === this.buttonToCheck && tgt instanceof Element && tgt.classList.contains(\"ioDwellSpring\");\n                });\n        }\n    }\n\n    public override reinit(): void {\n        super.reinit();\n        this.buttonToCheck = undefined;\n    }\n}\n\n/**\n * A user interaction for Drag and Drop\n * @category Interaction Library\n */\nexport class DnD extends InteractionBase<SrcTgtPointsData<PointData>, SrcTgtPointsDataImpl> {\n    /**\n     * Creates the interaction.\n     * @param cancellable - True: the interaction can be cancelled\n     * @param logger - The logger to use for this interaction\n     * @param name - The name of the user interaction\n     */\n    public constructor(cancellable: boolean, logger: Logger, name?: string) {\n        const handler: DnDFSMHandler = {\n            \"onPress\": (evt: MouseEvent): void => {\n                this._data.copySrc(evt);\n                this._data.copyTgt(evt);\n            },\n            \"onDrag\": (evt: MouseEvent): void => {\n                this._data.copyTgt(evt);\n            },\n            \"onRelease\": (evt: MouseEvent): void => {\n                this._data.copyTgt(evt);\n            }\n        };\n\n        super(new DnDFSM(cancellable, logger, handler), new SrcTgtPointsDataImpl(), logger, name ?? DnD.name);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {isHyperLink} from \"./Events\";\nimport {TransitionBase} from \"./TransitionBase\";\nimport type {EventType} from \"../../api/fsm/EventType\";\n\n/**\n * An FSM transition for the Hyperlink.\n * @category FSM Transition\n */\nexport class HyperLinkTransition extends TransitionBase<Event> {\n    private static readonly acceptedEvents: ReadonlySet<EventType> = new Set([\"click\", \"auxclick\"]);\n\n    public accept(event: Event): event is Event {\n        return event.currentTarget !== null && isHyperLink(event.currentTarget);\n    }\n\n    public getAcceptedEvents(): ReadonlySet<EventType> {\n        return HyperLinkTransition.acceptedEvents;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {isHyperLink} from \"../../fsm/Events\";\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {HyperLinkTransition} from \"../../fsm/HyperLinkTransition\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {WidgetDataImpl} from \"../WidgetDataImpl\";\nimport type {WidgetData} from \"../../../api/interaction/WidgetData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\nclass HyperLinkClickedFSM extends FSMImpl {\n    public constructor(logger: Logger, action: (evt: Event) => void) {\n        super(logger);\n        new HyperLinkTransition(this.initState, this.addTerminalState(\"clicked\"), action);\n    }\n}\n\n/**\n * A user interaction for CheckBox\n * @category Interaction Library\n */\nexport class HyperLinkClicked extends InteractionBase<WidgetData<HTMLAnchorElement>, WidgetDataImpl<HTMLAnchorElement>> {\n    /**\n     * Creates the interaction.\n     * @param logger - The logger to use for this interaction\n     * @param name - The name of the user interaction\n     */\n    public constructor(logger: Logger, name?: string) {\n        const action = (event: Event): void => {\n            this._data.copy(event);\n        };\n        super(new HyperLinkClickedFSM(logger, action), new WidgetDataImpl<HTMLAnchorElement>(), logger, name ?? HyperLinkClicked.name);\n    }\n\n    public override onNewNodeRegistered(node: EventTarget): void {\n        if (isHyperLink(node)) {\n            this.registerActionHandlerInput(node);\n        }\n    }\n\n    public override onNodeUnregistered(node: EventTarget): void {\n        if (isHyperLink(node)) {\n            this.unregisterActionHandlerInput(node);\n        }\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {KeyTransition} from \"../../fsm/KeyTransition\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {KeysDataImpl} from \"../KeysDataImpl\";\nimport type {KeysData} from \"../../../api/interaction/KeysData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\n/**\n * This interaction permits to define combo a key pressed that can be used to define shortcuts, etc.\n * @category FSM\n */\nexport class KeysDownFSM extends FSMImpl {\n    private readonly currentCodes: Array<string>;\n\n    /**\n     * Creates the FSM.\n     * @param logger - The logger to use for this interaction\n     * @param action - The action executed on keys down\n     */\n    public constructor(logger: Logger, action: (evt: KeyboardEvent) => void) {\n        super(logger);\n        this.currentCodes = [];\n\n        const pressed = this.addStdState(\"pressed\");\n\n        const actionkp = (evt: KeyboardEvent): void => {\n            this.currentCodes.push(evt.code);\n            action(evt);\n        };\n        new KeyTransition(this.initState, pressed, \"keydown\", actionkp);\n\n        new KeyTransition(pressed, pressed, \"keydown\", actionkp);\n\n        new KeyTransition(pressed, this.addTerminalState(\"ended\"), \"keyup\", undefined,\n            (evt: KeyboardEvent): boolean => this.currentCodes.includes(evt.code));\n    }\n\n    public override reinit(): void {\n        this.currentCodes.length = 0;\n        super.reinit();\n    }\n}\n\n/**\n * Several keys pressed at the same time.\n * Starts on a key pressure. Ends as soon as one of the pressed keys is released.\n * @category Interaction Library\n */\nexport class KeysDown extends InteractionBase<KeysData, KeysDataImpl> {\n    /**\n     * Creates the user interaction.\n     * @param logger - The logger to use for this interaction\n     * @param name - The name of the user interaction\n     */\n    public constructor(logger: Logger, name?: string) {\n        const action = (event: KeyboardEvent): void => {\n            this._data.addKey(event);\n        };\n        super(new KeysDownFSM(logger, action), new KeysDataImpl(), logger, name ?? KeysDown.name);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {TimeoutTransition} from \"../../fsm/TimeoutTransition\";\nimport {TouchTransition} from \"../../fsm/TouchTransition\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {TouchDataImpl} from \"../TouchDataImpl\";\nimport type {TouchData} from \"../../../api/interaction/TouchData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\n/**\n * The FSM for the LongTouch interaction\n */\nclass LongTouchFSM extends FSMImpl {\n    private readonly duration: number;\n\n    private currentTouchID: number | undefined;\n\n    /**\n     * Creates the long touch FSM\n     * @param duration - Defines the duration of the touch interaction.\n     * @param logger - The logger to use for this interaction\n     * @param action - The action executed on a long touch\n     */\n    public constructor(duration: number, logger: Logger, action: (event: TouchEvent) => void) {\n        super(logger);\n\n        if (duration <= 0) {\n            throw new Error(\"Incorrect duration\");\n        }\n\n        this.duration = duration;\n        this.currentTouchID = undefined;\n\n        const touched = this.addStdState(\"touched\");\n        const cancelled = this.addCancellingState(\"cancelled\");\n\n        new TouchTransition(this.initState, touched, \"touchstart\",\n            (event: TouchEvent): void => {\n                if (event.changedTouches[0] !== undefined) {\n                    this.currentTouchID = event.changedTouches[0].identifier;\n                    action(event);\n                }\n            });\n\n        new TouchTransition(touched, cancelled, \"touchmove\", undefined,\n            (ev: TouchEvent): boolean => ev.changedTouches[0] !== undefined && ev.changedTouches[0].identifier === this.currentTouchID);\n\n        new TouchTransition(touched, cancelled, \"touchend\", undefined,\n            (ev: TouchEvent): boolean => ev.changedTouches[0] !== undefined && ev.changedTouches[0].identifier === this.currentTouchID);\n\n        new TimeoutTransition(touched, this.addTerminalState(\"timeouted\"), () => this.duration);\n    }\n\n    public override reinit(): void {\n        super.reinit();\n        this.currentTouchID = undefined;\n    }\n}\n\n/**\n * The long touch interaction.\n * @category Interaction Library\n */\nexport class LongTouch extends InteractionBase<TouchData, TouchDataImpl> {\n    /**\n     * Creates the long tap interaction\n     * @param duration - The duration of the touch required to ends the user interaction\n     * If this duration is not reached, the interaction is cancelled.\n     * @param logger - The logger to use for this interaction\n     * @param name - The name of the user interaction\n     */\n    public constructor(duration: number, logger: Logger, name?: string) {\n        const action = (evt: TouchEvent): void => {\n            if (evt.changedTouches[0] !== undefined) {\n                this._data.copy(TouchDataImpl.mergeTouchEventData(evt.changedTouches[0], evt, Array.from(evt.touches)));\n            }\n        };\n\n        super(new LongTouchFSM(duration, logger, action), new TouchDataImpl(), logger, name ?? LongTouch.name);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {MouseTransition} from \"../../fsm/MouseTransition\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {PointDataImpl} from \"../PointDataImpl\";\nimport type {PointData} from \"../../../api/interaction/PointData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\n/**\n * The FSM for mouseover interactions\n * @category FSM\n */\nexport class MouseEnterFSM extends FSMImpl {\n    /**\n     * Indicates if event bubbling is enabled for the interaction\n     */\n    private readonly withBubbling: boolean;\n\n    /**\n     * Creates the FSM\n     * @param withBubbling - True: event bubbling will be done\n     * @param logger - The logger to use for this interaction\n     * @param action - The action executed on a mouse enter\n     */\n    public constructor(withBubbling: boolean, logger: Logger, action: (event: MouseEvent) => void) {\n        super(logger);\n        this.withBubbling = withBubbling;\n\n        const entered = this.addTerminalState(\"entered\");\n\n        if (this.withBubbling) {\n            new MouseTransition(this.initState, entered, \"mouseover\", action);\n        } else {\n            new MouseTransition(this.initState, entered, \"mouseenter\", action);\n        }\n    }\n}\n\n/**\n * The mouse enter interaction. Corresponds to the single event mouseEnter\n * @category Interaction Library\n */\nexport class MouseEnter extends InteractionBase<PointData, PointDataImpl> {\n    /**\n     * Creates the interaction.\n     * @param withBubbling - True: the event bubbling will be done\n     * @param logger - The logger to use for this interaction\n     * @param name - The name of the user interaction\n     */\n    public constructor(withBubbling: boolean, logger: Logger, name?: string) {\n        const action = (evt: MouseEvent): void => {\n            this._data.copy(evt);\n        };\n\n        super(new MouseEnterFSM(withBubbling, logger, action), new PointDataImpl(), logger, name ?? MouseEnter.name);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {MouseTransition} from \"../../fsm/MouseTransition\";\nimport {TerminalState} from \"../../fsm/TerminalState\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {PointDataImpl} from \"../PointDataImpl\";\nimport type {PointData} from \"../../../api/interaction/PointData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\n/**\n * The FSM for mouseout interactions\n * @category FSM\n */\nexport class MouseLeaveFSM extends FSMImpl {\n    /**\n     * Indicates if event bubbling is enabled for the interaction\n     */\n    private readonly withBubbling: boolean;\n\n    /**\n     * Creates the FSM\n     * @param withBubbling - True: event bubbling will be done\n     * @param logger - The logger to use for this interaction\n     * @param action - The action executed on a mouse leave\n     */\n    public constructor(withBubbling: boolean, logger: Logger, action: (event: MouseEvent) => void) {\n        super(logger);\n        this.withBubbling = withBubbling;\n\n        const exited = new TerminalState(this, \"exited\");\n\n        if (this.withBubbling) {\n            new MouseTransition(this.initState, exited, \"mouseout\", action);\n        } else {\n            new MouseTransition(this.initState, exited, \"mouseleave\", action);\n        }\n    }\n}\n\n/**\n * The mouse leave interaction. Corresponds to the single event MouseLeave\n * @category Interaction Library\n */\nexport class MouseLeave extends InteractionBase<PointData, PointDataImpl> {\n    /**\n     * Creates the interaction.\n     * @param withBubbling - True: the event bubbling will be done\n     * @param logger - The logger to use for this interaction\n     * @param name - The name of the user interaction\n     */\n    public constructor(withBubbling: boolean, logger: Logger, name?: string) {\n        const action = (evt: MouseEvent): void => {\n            this._data.copy(evt);\n        };\n\n        super(new MouseLeaveFSM(withBubbling, logger, action), new PointDataImpl(), logger, name ?? MouseLeave.name);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {MouseTransition} from \"../../fsm/MouseTransition\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {PointDataImpl} from \"../PointDataImpl\";\nimport type {PointData} from \"../../../api/interaction/PointData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\n/**\n * The FSM for mouseover interactions\n * @category FSM\n */\nexport class MouseMoveFSM extends FSMImpl {\n    /**\n     * Creates the FSM\n     * @param logger - The logger to use for this interaction\n     * @param action - The action executed on a move\n     */\n    public constructor(logger: Logger, action: (event: MouseEvent) => void) {\n        super(logger);\n        new MouseTransition(this.initState, this.addTerminalState(\"moved\"), \"mousemove\", action);\n    }\n}\n\n/**\n * The mouse move interaction. Corresponds to the single event MouseMove\n * @category Interaction Library\n */\nexport class MouseMove extends InteractionBase<PointData, PointDataImpl> {\n    /**\n     * Creates the interaction.\n     * @param logger - The logger to use for this interaction\n     * @param name - The name of the user interaction\n     */\n    public constructor(logger: Logger, name?: string) {\n        const action = (evt: MouseEvent): void => {\n            this._data.copy(evt);\n        };\n\n        super(new MouseMoveFSM(logger, action), new PointDataImpl(), logger, name ?? MouseMove.name);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {TransitionBase} from \"./TransitionBase\";\nimport type {EventType} from \"../../api/fsm/EventType\";\n\n/**\n * This transition corresponds to the scroll of a window\n * @category FSM Transition\n */\nexport class ScrollTransition extends TransitionBase<Event> {\n    private static readonly acceptedEvents: ReadonlySet<EventType> = new Set([\"scroll\"]);\n\n    public accept(event: Event): event is Event {\n        return event.type === \"scroll\";\n    }\n\n    public getAcceptedEvents(): ReadonlySet<EventType> {\n        return ScrollTransition.acceptedEvents;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {InteractionDataBase} from \"./InteractionDataBase\";\nimport type {Flushable} from \"./Flushable\";\nimport type {ScrollData} from \"../../api/interaction/ScrollData\";\n\n/**\n * Scrolling interaction data implementation with write access.\n * @category Interaction Data\n */\nexport class ScrollDataImpl extends InteractionDataBase implements ScrollData, Flushable {\n    protected scrollXData = 0;\n\n    protected scrollYData = 0;\n\n    public override flush(): void {\n        super.flush();\n        this.scrollXData = 0;\n        this.scrollYData = 0;\n    }\n\n    public get scrollX(): number {\n        return this.scrollXData;\n    }\n\n    public get scrollY(): number {\n        return this.scrollYData;\n    }\n\n    public setScrollData(event: Event): void {\n        super.copy(event);\n\n        this.scrollXData = window.scrollX;\n        this.scrollYData = window.scrollY;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {ScrollTransition} from \"../../fsm/ScrollTransition\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {ScrollDataImpl} from \"../ScrollDataImpl\";\nimport type {ScrollData} from \"../../../api/interaction/ScrollData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\n/**\n * An FSM for scrolling.\n * @category FSM\n */\nexport class ScrollFSM extends FSMImpl {\n    /**\n     * Creates the scroll FSM\n     * @param logger - The logger to use for this interaction\n     * @param action - The action executed on a scroll\n     */\n    public constructor(logger: Logger, action: (evt: Event) => void) {\n        super(logger);\n        new ScrollTransition(this.initState, this.addTerminalState(\"scrolled\"), action);\n    }\n}\n\n/**\n * A user interaction for scrolling using a mouse wheel. Consists of a single scroll.\n * @category Interaction Library\n */\nexport class Scroll extends InteractionBase<ScrollData, ScrollDataImpl> {\n    /**\n     * Creates the interaction.\n     * @param logger - The logger to use for this interaction\n     * @param name - The name of the user interaction\n     */\n    public constructor(logger: Logger, name?: string) {\n        const action = (event: Event): void => {\n            this._data.setScrollData(event);\n        };\n\n        super(new ScrollFSM(logger, action), new ScrollDataImpl(), logger, name ?? Scroll.name);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {isSpinner} from \"./Events\";\nimport {TransitionBase} from \"./TransitionBase\";\nimport type {EventType} from \"../../api/fsm/EventType\";\n\n/**\n * An FSM transition for the Spinner HTML element.\n * @category FSM Transition\n */\nexport class SpinnerChangedTransition extends TransitionBase<Event> {\n    private static readonly acceptedEvents: ReadonlySet<EventType> = new Set([\"input\"]);\n\n    public accept(event: Event): event is Event {\n        return event.currentTarget !== null && isSpinner(event.currentTarget);\n    }\n\n    public getAcceptedEvents(): ReadonlySet<EventType> {\n        return SpinnerChangedTransition.acceptedEvents;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {isSpinner} from \"../../fsm/Events\";\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {SpinnerChangedTransition} from \"../../fsm/SpinnerChangedTransition\";\nimport {TimeoutTransition} from \"../../fsm/TimeoutTransition\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {WidgetDataImpl} from \"../WidgetDataImpl\";\nimport type {WidgetData} from \"../../../api/interaction/WidgetData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\n/**\n * The FSM of the spinner interaction\n * @category FSM\n */\nexport class SpinnerChangedFSM extends FSMImpl {\n    /** The time gap between the two spinner events. */\n    private static timeGap = 300;\n\n    /**\n     * The supplier that provides the time gap.\n     * @returns The time gap\n     */\n    private static readonly timeGapSupplier: () => number = () => SpinnerChangedFSM.getTimeGap();\n\n    /**\n     * @returns The time gap between the two spinner events.\n     */\n    public static getTimeGap(): number {\n        return SpinnerChangedFSM.timeGap;\n    }\n\n    /**\n     * Sets The time gap between the two spinner events.\n     * @param timeGapBetweenClicks - The time gap between the two spinner events. Not done if negative.\n     */\n    public static setTimeGap(timeGapBetweenClicks: number): void {\n        if (timeGapBetweenClicks > 0) {\n            SpinnerChangedFSM.timeGap = timeGapBetweenClicks;\n        }\n    }\n\n    public constructor(logger: Logger, action: (evt: Event) => void) {\n        super(logger);\n\n        const changed = this.addStdState(\"changed\");\n\n        new SpinnerChangedTransition(this.initState, changed, action);\n        new SpinnerChangedTransition(changed, changed, action);\n        new TimeoutTransition(changed, this.addTerminalState(\"ended\"), SpinnerChangedFSM.timeGapSupplier);\n    }\n}\n\n/**\n * A user interaction for Number input.\n * @category Interaction Library\n */\nexport class SpinnerChanged extends InteractionBase<WidgetData<HTMLInputElement>, WidgetDataImpl<HTMLInputElement>> {\n    /**\n     * Creates the interaction.\n     * @param logger - The logger to use for this interaction\n     * @param name - The name of the user interaction\n     */\n    public constructor(logger: Logger, name?: string) {\n        const action = (event: Event): void => {\n            this._data.copy(event);\n        };\n        super(new SpinnerChangedFSM(logger, action), new WidgetDataImpl<HTMLInputElement>(), logger, name ?? SpinnerChanged.name);\n    }\n\n    public override onNewNodeRegistered(node: EventTarget): void {\n        if (isSpinner(node)) {\n            this.registerActionHandlerInput(node);\n        }\n    }\n\n    public override onNodeUnregistered(node: EventTarget): void {\n        if (isSpinner(node)) {\n            this.unregisterActionHandlerInput(node);\n        }\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {TouchTransition} from \"../../fsm/TouchTransition\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {TouchDataImpl} from \"../TouchDataImpl\";\nimport type {TouchData} from \"../../../api/interaction/TouchData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\nimport type {CancellingState} from \"../../fsm/CancellingState\";\nimport type {StdState} from \"../../fsm/StdState\";\n\n/**\n * The FSM for the Tap interaction\n * @category FSM\n */\nexport class TapFSM extends FSMImpl {\n    protected readonly downState: StdState;\n\n    protected readonly cancelState: CancellingState;\n\n    private touchID?: number;\n\n    /**\n     * Creates the Tap FSM\n     * @param logger - The logger to use for this interaction\n     * @param handler - The action executed on a tap.\n     */\n    public constructor(logger: Logger, handler: (event: TouchEvent) => void) {\n        super(logger);\n\n        this.downState = this.addStdState(\"down\");\n        const up = this.addTerminalState(\"up\");\n        this.cancelState = this.addCancellingState(\"cancelled\");\n\n        const action = (event: TouchEvent): void => {\n            // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n            this.touchID = event.changedTouches[0]!.identifier;\n            handler(event);\n        };\n\n        new TouchTransition(this.initState, this.downState, \"touchstart\", action);\n\n        new TouchTransition(this.downState, this.cancelState, \"touchmove\", undefined,\n            // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n            (evt: TouchEvent): boolean => evt.changedTouches[0]!.identifier === this.touchID);\n\n        // No multi-touch\n        new TouchTransition(this.downState, this.cancelState, \"touchstart\", undefined,\n            (evt: TouchEvent): boolean => Array.from(evt.touches).some(touch => touch.identifier === this.touchID));\n\n        // Required to clean touch events lost by the browser\n        new TouchTransition(this.downState, this.downState, \"touchstart\",\n            // Replacing the current tap\n            action,\n            // To detect the event is lost, checking it is not part of the touches any more\n            (evt: TouchEvent): boolean => Array.from(evt.touches).filter(touch => touch.identifier === this.touchID).length === 0);\n\n        new TouchTransition(this.downState, up, \"touchend\", undefined,\n            // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n            (evt: TouchEvent): boolean => evt.changedTouches[0]!.identifier === this.touchID);\n    }\n}\n\n/**\n * A tap user interaction. Manage a single tap. For multiple taps, use the taps interaction.\n * @category Interaction Library\n */\nexport class Tap extends InteractionBase<TouchData, TouchDataImpl> {\n    /**\n     * Creates the tap interaction\n     * @param logger - The logger to use for this interaction\n     * @param name - The name of the user interaction\n     */\n    public constructor(logger: Logger, name?: string) {\n        const action = (evt: TouchEvent): void => {\n            if (evt.changedTouches.length > 0) {\n                const touch = new TouchDataImpl();\n                // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n                touch.copy(TouchDataImpl.mergeTouchEventData(evt.changedTouches[0]!, evt, Array.from(evt.touches)));\n                this._data.copy(touch);\n            }\n        };\n\n        super(new TapFSM(logger, action), new TouchDataImpl(), logger, name ?? Tap.name);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {PointsDataImpl} from \"./PointsDataImpl\";\nimport type {TouchData} from \"../../api/interaction/TouchData\";\n\n/**\n * Tapping interaction data implementation\n * @category Interaction Data\n */\nexport class TapsDataImpl extends PointsDataImpl<TouchData> {\n    public get lastId(): number | undefined {\n        return this.pointsData.at(-1)?.identifier;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {TimeoutTransition} from \"../../fsm/TimeoutTransition\";\nimport {TouchTransition} from \"../../fsm/TouchTransition\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {TapsDataImpl} from \"../TapsDataImpl\";\nimport {TouchDataImpl} from \"../TouchDataImpl\";\nimport type {PointsData} from \"../../../api/interaction/PointsData\";\nimport type {TouchData} from \"../../../api/interaction/TouchData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\nimport type {CancellingState} from \"../../fsm/CancellingState\";\nimport type {StdState} from \"../../fsm/StdState\";\n\n/**\n * The FSM for the Taps interaction\n * @category FSM\n */\nexport class TapsFSM extends FSMImpl {\n    private countTaps: number;\n\n    private readonly nbTaps: number;\n\n    private touchID?: number;\n\n    protected readonly downState: StdState;\n\n    protected readonly cancelState: CancellingState;\n\n    /**\n     * Creates the Tap FSM\n     * @param nbTaps - The number of taps to support\n     * @param logger - The logger to use for this interaction\n     * @param handler - The action executed on a tap.\n     */\n    public constructor(nbTaps: number, logger: Logger, handler: (event: TouchEvent) => void) {\n        super(logger);\n        this.nbTaps = nbTaps;\n        this.countTaps = 0;\n\n        this.downState = this.addStdState(\"down\");\n        const up = this.addStdState(\"up\");\n        this.cancelState = this.addCancellingState(\"cancelled\");\n        const action = (event: TouchEvent): void => {\n            // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n            this.touchID = event.changedTouches[0]!.identifier;\n            this.countTaps++;\n            handler(event);\n        };\n\n        new TouchTransition(this.initState, this.downState, \"touchstart\", action);\n        new TouchTransition(up, this.downState, \"touchstart\", action);\n\n        new TouchTransition(this.downState, this.cancelState, \"touchmove\", undefined,\n            // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n            (evt: TouchEvent): boolean => evt.changedTouches[0]!.identifier === this.touchID);\n\n        // No multi-touch\n        new TouchTransition(this.downState, this.cancelState, \"touchstart\", undefined,\n            (evt: TouchEvent): boolean => Array.from(evt.touches).some(touch => touch.identifier === this.touchID));\n\n        // Required to clean touch events lost by the browser\n        new TouchTransition(this.downState, this.downState, \"touchstart\",\n            // Replacing the current tap (but not increment)\n            (event: TouchEvent): void => {\n                // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n                this.touchID = event.changedTouches[0]!.identifier;\n                handler(event);\n            },\n            // To detect the event is lost, checking it is not part of the touches any more\n            (evt: TouchEvent): boolean => Array.from(evt.touches).filter(touch => touch.identifier === this.touchID).length === 0);\n\n        new TouchTransition(this.downState, this.addTerminalState(\"ended\"), \"touchend\", undefined,\n            // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n            (evt: TouchEvent): boolean => evt.changedTouches[0]!.identifier === this.touchID && this.nbTaps === this.countTaps);\n\n        new TouchTransition(this.downState, up, \"touchend\", undefined,\n            // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n            (evt: TouchEvent): boolean => evt.changedTouches[0]!.identifier === this.touchID && this.nbTaps !== this.countTaps);\n\n        new TouchTransition(up, this.cancelState, \"touchmove\");\n        new TimeoutTransition(up, this.cancelState, () => 1000);\n    }\n\n    public override reinit(): void {\n        super.reinit();\n        this.countTaps = 0;\n    }\n}\n\n/**\n * A tap user interaction. Manage several taps. For single tap, use the tap interaction.\n * This touch interaction takes as input the number of taps expected to end the interaction.\n * If this number is not reached after a timeout, the interaction is cancelled.\n * @category Interaction Library\n */\nexport class Taps extends InteractionBase<PointsData<TouchData>, TapsDataImpl> {\n    /**\n     * Creates the tap interaction\n     * @param numberTaps - The number of taps expected to end the interaction. Must be greater than 1.\n     * If this number is not reached after a timeout, the interaction is cancelled.\n     * @param logger - The logger to use for this interaction\n     * @param name - The name of the user interaction\n     */\n    public constructor(numberTaps: number, logger: Logger, name?: string) {\n        const action = (evt: TouchEvent): void => {\n            if (evt.changedTouches.length > 0) {\n                const touch = new TouchDataImpl();\n                // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n                touch.copy(TouchDataImpl.mergeTouchEventData(evt.changedTouches[0]!, evt, Array.from(evt.touches)));\n                this._data.addPoint(touch);\n            }\n        };\n\n        super(new TapsFSM(numberTaps, logger, action), new TapsDataImpl(), logger, name ?? Taps.name);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {isTextInput} from \"./Events\";\nimport {TransitionBase} from \"./TransitionBase\";\nimport type {EventType} from \"../../api/fsm/EventType\";\n\n/**\n * An FSM transition for the different text input HTML element.\n * @category FSM Transition\n */\nexport class TextInputChangedTransition extends TransitionBase<Event> {\n    private static readonly acceptedEvents: ReadonlySet<EventType> = new Set([\"input\"]);\n\n    public accept(event: Event): event is Event {\n        return event.currentTarget !== null && isTextInput(event.currentTarget);\n    }\n\n    public getAcceptedEvents(): ReadonlySet<EventType> {\n        return TextInputChangedTransition.acceptedEvents;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {isTextInput} from \"../../fsm/Events\";\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {TextInputChangedTransition} from \"../../fsm/TextInputChangedTransition\";\nimport {TimeoutTransition} from \"../../fsm/TimeoutTransition\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {WidgetDataImpl} from \"../WidgetDataImpl\";\nimport type {WidgetData} from \"../../../api/interaction/WidgetData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\nclass TextInputChangedFSM extends FSMImpl {\n    /** The time gap between the two spinner events. */\n    private readonly _timeGap: number = 1000;\n\n    /**\n     * The supplier that provides the time gap.\n     * @returns The time gap\n     */\n    private readonly timeGapSupplier: () => number = () => this.getTimeGap();\n\n    /**\n     * @returns The time gap between the two spinner events.\n     */\n    public getTimeGap(): number {\n        return this._timeGap;\n    }\n\n    public constructor(logger: Logger, action: (evt: Event) => void, timeSet?: number) {\n        super(logger);\n        if (timeSet !== undefined) {\n            this._timeGap = timeSet;\n        }\n\n        const changed = this.addStdState(\"changed\");\n\n        new TextInputChangedTransition(this.initState, changed, action);\n        new TextInputChangedTransition(changed, changed, action);\n        new TimeoutTransition(changed, this.addTerminalState(\"ended\"), this.timeGapSupplier);\n    }\n}\n\n/**\n * A user interaction for Number input.\n * @category Interaction Library\n */\nexport class TextInputChanged extends InteractionBase<WidgetData<HTMLInputElement | HTMLTextAreaElement>,\n    WidgetDataImpl<HTMLInputElement | HTMLTextAreaElement>> {\n\n    public constructor(logger: Logger, timeGap?: number, name?: string) {\n        const action = (event: Event): void => {\n            this._data.copy(event);\n        };\n\n        super(new TextInputChangedFSM(logger, action, timeGap),\n            new WidgetDataImpl<HTMLInputElement | HTMLTextAreaElement>(), logger, name ?? TextInputChanged.name);\n    }\n\n    public override onNewNodeRegistered(node: EventTarget): void {\n        if (isTextInput(node)) {\n            this.registerActionHandlerInput(node);\n        }\n    }\n\n    public override onNodeUnregistered(node: EventTarget): void {\n        if (isTextInput(node)) {\n            this.unregisterActionHandlerInput(node);\n        }\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {TouchTransition} from \"../../fsm/TouchTransition\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {TouchDataImpl} from \"../TouchDataImpl\";\nimport type {TouchData} from \"../../../api/interaction/TouchData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\nclass TouchStartFSM extends FSMImpl {\n    public constructor(logger: Logger, action: (event: TouchEvent) => void) {\n        super(logger);\n        new TouchTransition(this.initState, this.addTerminalState(\"touched\"), \"touchstart\", action);\n    }\n}\n\n/**\n * A user interaction for touching down\n * @category Interaction Library\n */\nexport class TouchStart extends InteractionBase<TouchData, TouchDataImpl> {\n    /**\n     * Creates the interaction.\n     * @param logger - The logger to use for this interaction\n     * @param name - The name of the user interaction\n     */\n    public constructor(logger: Logger, name?: string) {\n        const action = (evt: TouchEvent): void => {\n            // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n            this._data.copy(TouchDataImpl.mergeTouchEventData(evt.changedTouches[0]!, evt, Array.from(evt.touches)));\n        };\n        super(new TouchStartFSM(logger, action), new TouchDataImpl(), logger, name ?? TouchStart.name);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {XTouchDnD} from \"./XTouch\";\nimport {InteractionBuilderImpl} from \"../InteractionBuilderImpl\";\nimport {RotationTouchDataImpl} from \"../RotationTouchDataImpl\";\nimport {ScaleTouchDataImpl} from \"../ScaleTouchDataImpl\";\nimport type {RotationTouchData} from \"../../../api/interaction/RotationTouchData\";\nimport type {ScaleTouchData} from \"../../../api/interaction/ScaleTouchData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\n/**\n * Define a type for touch interactions performing a rotation.\n * @category Interaction Library\n */\nexport type Rotate = XTouchDnD<RotationTouchData, RotationTouchDataImpl>;\n\n/**\n * Define a type for touch interactions performing a scale/pinch.\n * @category Interaction Library\n */\nexport type Scale = XTouchDnD<ScaleTouchData, ScaleTouchDataImpl>;\n\n/**\n * Creates a touch-based rotation interaction (two-touch).\n * @param logger - The logger to use for this interaction\n * @param pxTolerance - The pixel tolerance for considering the rotation (tolerance while moving the fixation point).\n * @returns The supplier that will produce the interaction when called\n * @category Interaction Library\n */\nexport function rotate(logger: Logger, pxTolerance: number): () => Rotate {\n    return new InteractionBuilderImpl(name => new XTouchDnD<RotationTouchData, RotationTouchDataImpl>(2, logger,\n        new RotationTouchDataImpl(), name, undefined, true))\n        .then(data => data.touch1.diffClientX < pxTolerance && data.touch1.diffClientY < pxTolerance)\n        .name(rotate.name)\n        .build();\n}\n\n/**\n * Creates a touch-based scale/pinch interaction (two-touch).\n * @param logger - The logger to use for this interaction\n * @param pxTolerance - The pixel tolerance for considering the scale/pinch (tolerance as the two\n * points must be on the same line).\n * @returns The supplier that will produce the interaction when called\n * @category Interaction Library\n */\nexport function scale(logger: Logger, pxTolerance: number): () => Scale {\n    return new InteractionBuilderImpl(name => new XTouchDnD<ScaleTouchData, ScaleTouchDataImpl>(2, logger,\n        new ScaleTouchDataImpl(), name, undefined, true))\n        .then(data => data.scalingRatio(pxTolerance) !== 0)\n        .name(scale.name)\n        .build();\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {TransitionBase} from \"./TransitionBase\";\nimport type {EventType} from \"../../api/fsm/EventType\";\n\n/**\n * This transition corresponds to the user moving a mouse wheel or a similar input device.\n * @category FSM Transition\n */\nexport class WheelTransition extends TransitionBase<WheelEvent> {\n    private static readonly acceptedEvents: ReadonlySet<EventType> = new Set([\"wheel\"]);\n\n    public accept(event: Event): event is WheelEvent {\n        return event instanceof WheelEvent && this.getAcceptedEvents().has(event.type as EventType);\n    }\n\n    public getAcceptedEvents(): ReadonlySet<EventType> {\n        return WheelTransition.acceptedEvents;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {PointDataImpl} from \"./PointDataImpl\";\nimport type {WheelData} from \"../../api/interaction/WheelData\";\n\n/**\n * Single point interaction data whith mousewheel implementation with write accesses.\n * @category Interaction Data\n */\nexport class WheelDataImpl extends PointDataImpl implements WheelData {\n    private deltaModeData = 0;\n\n    private deltaXData = 0;\n\n    private deltaYData = 0;\n\n    private deltaZData = 0;\n\n    public override flush(): void {\n        super.flush();\n        this.deltaModeData = 0;\n        this.deltaXData = 0;\n        this.deltaYData = 0;\n        this.deltaZData = 0;\n    }\n\n    public override copy(data: WheelData): void {\n        super.copy(data);\n        /*\n         * Cannot use Object.assign because of a strange implementation of Event\n         * that prevents accessing the properties\n         */\n        this.deltaXData = data.deltaX;\n        this.deltaYData = data.deltaY;\n        this.deltaZData = data.deltaZ;\n        this.deltaModeData = data.deltaMode;\n    }\n\n    public get deltaMode(): number {\n        return this.deltaModeData;\n    }\n\n    public get deltaX(): number {\n        return this.deltaXData;\n    }\n\n    public get deltaY(): number {\n        return this.deltaYData;\n    }\n\n    public get deltaZ(): number {\n        return this.deltaZData;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {WheelTransition} from \"../../fsm/WheelTransition\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {WheelDataImpl} from \"../WheelDataImpl\";\nimport type {WheelData} from \"../../../api/interaction/WheelData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\n/**\n * The FSM for wheel interactions\n * @category FSM\n */\nclass WheelFSM extends FSMImpl {\n    /**\n     * Creates the FSM\n     * @param logger - The logger to use for this interaction\n     * @param action - The action executed on a wheel\n     */\n    public constructor(logger: Logger, action: (evt: WheelEvent) => void) {\n        super(logger);\n        new WheelTransition(this.initState, this.addTerminalState(\"moved\"), action);\n    }\n}\n\n/**\n * The mouse wheel interaction\n * @category Interaction Library\n */\nexport class Wheel extends InteractionBase<WheelData, WheelDataImpl> {\n    /**\n     * Creates the interaction.\n     * @param logger - The logger to use for this interaction\n     * @param data - The interaction data to use\n     * @param name - The name of the user interaction\n     */\n    public constructor(logger: Logger, data?: WheelDataImpl, name?: string) {\n        const action = (evt: WheelEvent): void => {\n            this._data.copy(evt);\n        };\n        super(new WheelFSM(logger, action), data ?? new WheelDataImpl(), logger, name ?? Wheel.name);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {FSMImpl} from \"./FSMImpl\";\nimport type {ConcurrentFSM} from \"../../api/fsm/ConcurrentFSM\";\nimport type {FSM} from \"../../api/fsm/FSM\";\nimport type {FSMHandler} from \"../../api/fsm/FSMHandler\";\nimport type {VisitorFSM} from \"../../api/fsm/VisitorFSM\";\nimport type {Logger} from \"../../api/logging/Logger\";\n\n/**\n * A concurrent FSM: an FSM that contains multiple FSMs where only one of them can run at\n * the same time. This is thus a XOR concurrent FSM.\n * If one FSM has started, the other ones cannot start.\n * @category FSM\n */\nexport class ConcurrentXOrFSM<F extends FSM> extends FSMImpl implements ConcurrentFSM<F> {\n    /**\n     * The main fsms\n     */\n    private readonly _conccurFSMs: ReadonlyArray<F>;\n\n    /**\n     * Creates the FSM\n     * @param fsms - The main concurrent FSMs\n     * @param logger - The logger to use for logging FSM messages\n     */\n    public constructor(fsms: ReadonlyArray<F>, logger: Logger) {\n        if (new Set(fsms.map(fsm => fsm.constructor.name)).size !== fsms.length) {\n            throw new Error(\"Cannot create an XOR interaction using two interactions of the same type\");\n        }\n\n        super(logger);\n\n        const handler: FSMHandler = {\n            \"fsmStarts\": (): void => {\n                this.onStarting();\n            },\n            \"fsmUpdates\": (): void => {\n                this.onUpdating();\n            },\n            \"fsmStops\": (): void => {\n                this.onTerminating();\n            },\n            \"fsmCancels\": (): void => {\n                this.onCancelling();\n            },\n            \"fsmError\": (err: unknown): void => {\n                this.notifyHandlerOnError(err);\n            }\n        };\n        this._conccurFSMs = Array.from(fsms);\n        for (const fsm of this._conccurFSMs) {\n            fsm.addHandler(handler);\n        }\n    }\n\n    public override process(event: Event): boolean {\n        const startedFSM = this._conccurFSMs.find(fsm => fsm.started);\n        if (startedFSM === undefined) {\n            return this._conccurFSMs.some(conccurFSM => conccurFSM.process(event));\n        }\n        return startedFSM.process(event);\n    }\n\n    public getAllConccurFSMs(): ReadonlyArray<F> {\n        return Array.from(this._conccurFSMs);\n    }\n\n    public override get started(): boolean {\n        return this._conccurFSMs.some(fsm => fsm.started);\n    }\n\n    // eslint-disable-next-line accessor-pairs\n    public override set log(log: boolean) {\n        super.log = log;\n        for (const fsm of this._conccurFSMs) {\n            fsm.log = log;\n        }\n    }\n\n    public override uninstall(): void {\n        super.uninstall();\n        for (const fsm of this._conccurFSMs) {\n            fsm.uninstall();\n        }\n    }\n\n    public override fullReinit(): void {\n        for (const fsm of this._conccurFSMs) {\n            fsm.fullReinit();\n        }\n        super.fullReinit();\n    }\n\n    public override reinit(): void {\n        for (const fsm of this._conccurFSMs) {\n            fsm.reinit();\n        }\n        super.reinit();\n    }\n\n    public override acceptVisitor(visitor: VisitorFSM): void {\n        visitor.visitXOrConcurrentFSM(this);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {ConcurrentInteraction} from \"./ConcurrentInteraction\";\nimport {ConcurrentXOrFSM} from \"../fsm/ConcurrentXOrFSM\";\nimport type {Flushable} from \"./Flushable\";\nimport type {InteractionBase, InteractionDataImplType} from \"./InteractionBase\";\nimport type {FSM} from \"../../api/fsm/FSM\";\nimport type {InteractionDataType} from \"../../api/interaction/Interaction\";\nimport type {Logger} from \"../../api/logging/Logger\";\n\n/**\n * The Or user interaction. This is an XOr. Either one of the two interactions\n * can run at a given instant.\n * @typeParam I1 - The type of the first interaction\n * @typeParam I2 - The type of the second interaction\n * @typeParam D1 - The type of the first interaction data\n * @typeParam D1Impl - The class of the first interaction data\n * @typeParam D2Impl - The class of the second interaction data\n * @category Interaction Library\n */\nexport class Or<\n    // eslint-disable-next-line no-use-before-define\n    I1 extends InteractionBase<D1, D1Impl>,\n    // eslint-disable-next-line no-use-before-define\n    I2 extends InteractionBase<D2, D2Impl>,\n    D1 extends object = InteractionDataType<I1>,\n    D2 extends object = InteractionDataType<I2>,\n    D1Impl extends D1 & Flushable = InteractionDataImplType<I1>,\n    D2Impl extends D2 & Flushable = InteractionDataImplType<I2>>\n    extends ConcurrentInteraction<D1 | D2, D1Impl | D2Impl, ConcurrentXOrFSM<FSM>> {\n    private readonly i1: I1;\n\n    private readonly i2: I2;\n\n    public constructor(i1: I1, i2: I2, logger: Logger) {\n        super(new ConcurrentXOrFSM([i1.fsm, i2.fsm], logger), {\n            \"flush\": () => {}\n        } as D1Impl | D2Impl, logger, `${i1.name}-${i2.name}`, false);\n        this.i1 = i1;\n        this.i2 = i2;\n    }\n\n    public override get data(): D1 | D2 {\n        return this.i1.fsm.started ? this.i1.data : this.i2.data;\n    }\n\n    public override uninstall(): void {\n        this.i1.uninstall();\n        this.i2.uninstall();\n    }\n\n    public override reinit(): void {\n        this.i1.reinit();\n        this.i2.reinit();\n        super.reinit();\n    }\n\n    public override fullReinit(): void {\n        this.i1.fullReinit();\n        this.i2.fullReinit();\n        super.fullReinit();\n    }\n\n    public override reinitData(): void {\n        this.i1.reinitData();\n        this.i2.reinitData();\n        super.reinitData();\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\nimport type {Flushable} from \"./Flushable\";\nimport type {ThenData} from \"../../api/interaction/ThenData\";\n\n/**\n * The implementation of ThenData\n * @typeParam DX - The types of the sub interaction data.\n * @category Interaction Data\n */\nexport class ThenDataImpl<DX extends Array<Flushable>> implements ThenData<DX>, Flushable {\n    public readonly dx: DX;\n\n    public constructor(dx: DX) {\n        this.dx = dx;\n    }\n\n    public flush(): void {\n        for (const data of this.dx) {\n            data.flush();\n        }\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {FSMImpl} from \"./FSMImpl\";\nimport {StdState} from \"./StdState\";\nimport {SubFSMTransition} from \"./SubFSMTransition\";\nimport {TerminalState} from \"./TerminalState\";\nimport type {FSM} from \"../../api/fsm/FSM\";\nimport type {OutputState} from \"../../api/fsm/OutputState\";\nimport type {Logger} from \"../../api/logging/Logger\";\n\n/**\n * An FSM that executes a serie of sub-FSMs.\n * @category FSM\n */\nexport class ThenFSM extends FSMImpl {\n    public constructor(fsms: Array<FSM>, logger: Logger) {\n        super(logger);\n\n        let currentState: OutputState = this.initState;\n        const last = fsms.length - 1;\n\n        for (const [i, fsm] of fsms.entries()) {\n            if (i === last) {\n                new SubFSMTransition(currentState, new TerminalState(this, i.toString()), fsm);\n            } else {\n                const state = new StdState(this, i.toString());\n                new SubFSMTransition(currentState, state, fsm);\n                currentState = state;\n            }\n        }\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {InteractionBase} from \"./InteractionBase\";\nimport {ThenDataImpl} from \"./ThenDataImpl\";\nimport {ThenFSM} from \"../fsm/ThenFSM\";\nimport type {Flushable} from \"./Flushable\";\nimport type {Interaction, InteractionsDataTypes} from \"../../api/interaction/Interaction\";\nimport type {ThenData} from \"../../api/interaction/ThenData\";\nimport type {Logger} from \"../../api/logging/Logger\";\n\n/**\n * A user interaction composed of a serie of sub user interactions.\n * @category Interaction Library\n */\nexport class Then<\n    IX extends Array<Interaction<object>>,\n    DX extends Array<object> = InteractionsDataTypes<IX>>\n    extends InteractionBase<ThenData<DX>, ThenDataImpl<Array<Flushable> & DX>> {\n\n    private readonly ix: IX;\n\n    public constructor(ix: IX, logger: Logger) {\n        super(new ThenFSM(ix.map(inter => inter.fsm), logger),\n            new ThenDataImpl(ix.map(inter => inter.data) as unknown as Array<Flushable> & DX), logger, \"\");\n        this.ix = ix;\n    }\n\n    public override uninstall(): void {\n        super.uninstall();\n        for (const inter of this.ix) {\n            inter.uninstall();\n        }\n    }\n\n    public override reinit(): void {\n        super.reinit();\n        for (const inter of this.ix) {\n            inter.reinit();\n        }\n    }\n\n    public override fullReinit(): void {\n        super.fullReinit();\n        for (const inter of this.ix) {\n            inter.fullReinit();\n        }\n    }\n\n    public override reinitData(): void {\n        super.reinitData();\n        for (const inter of this.ix) {\n            inter.reinitData();\n        }\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport type {Logger} from \"../../api/logging/Logger\";\nimport type {LogLevel} from \"../../api/logging/LogLevel\";\n\n/**\n * The logging item\n * @category Logging\n */\nexport class LoggingData {\n    public readonly name: string;\n\n    public readonly sessionID: string;\n\n    public readonly date: number;\n\n    public readonly msg: string;\n\n    public readonly level: LogLevel;\n\n    public readonly type: \"ERR\" | \"INFO\";\n\n    public readonly stack: string | undefined;\n\n    public readonly frontVersion: string | undefined;\n\n    public constructor(date: number, msg: string, level: LogLevel, name: string, type: \"ERR\" | \"INFO\",\n                       sessionID: string, stack?: string, frontVersion?: string) {\n        this.frontVersion = frontVersion;\n        this.stack = stack;\n        this.sessionID = sessionID;\n        this.type = type;\n        this.name = name;\n        this.level = level;\n        this.msg = msg;\n        this.date = date;\n    }\n\n    public toString(): string {\n        const withstack = this.stack === undefined ? \"\" : `, ${this.stack}`;\n        const withversion = this.frontVersion === undefined ? \"\" : ` ${this.frontVersion}`;\n        return `${this.type}${withversion} [${this.sessionID}] [${this.level}:${this.name}] at ${this.date.toString()}: '${this.msg}'${withstack}`;\n    }\n}\n\n/**\n * A logging usage item\n * @category Logging\n */\nexport class UsageLog {\n    public name: string;\n\n    public readonly sessionID: string;\n\n    public readonly date: number;\n\n    public duration: number;\n\n    public cancelled: boolean;\n\n    public readonly frontVersion: string | undefined;\n\n    public constructor(name: string, sessionID: string, date: number, frontVersion?: string) {\n        this.frontVersion = frontVersion;\n        this.date = date;\n        this.sessionID = sessionID;\n        this.name = name;\n        this.duration = 0;\n        this.cancelled = false;\n    }\n\n    public toString(): string {\n        const withversion = this.frontVersion === undefined ? \"\" : ` v:${this.frontVersion}`;\n        return `Usage.${withversion} id:${this.sessionID} binding:${this.name} ` +\n          `date:${this.date.toString()} duration:${this.duration.toString()} cancelled:${String(this.cancelled)}`;\n    }\n}\n\n/**\n * An implementation of the logger\n * @category Logging\n */\nexport class LoggerImpl implements Logger {\n    public writeConsole: boolean;\n\n    public serverAddress: string | undefined;\n\n    public readonly sessionID: string;\n\n    public readonly frontVersion: string | undefined;\n\n    public ongoingBindings: Array<UsageLog>;\n\n    public constructor(version?: string) {\n        this.frontVersion = version;\n        this.ongoingBindings = [];\n        this.serverAddress = undefined;\n        this.writeConsole = true;\n        this.sessionID = Date.now().toString(36) + Math.random().toString(36)\n            .slice(2, 8);\n    }\n\n    private processLoggingData(data: LoggingData): void {\n        if (this.writeConsole) {\n            // eslint-disable-next-line no-console\n            console.log(data.toString());\n        }\n\n        if (this.serverAddress !== undefined && data.type === \"ERR\") {\n            const rq = new XMLHttpRequest();\n            rq.open(\"POST\", `${this.serverAddress}/api/err`, true);\n            rq.setRequestHeader(\"Content-Type\", \"application/json;charset=UTF-8\");\n            rq.send(JSON.stringify(data));\n        }\n    }\n\n    private formatError(ex: unknown): string {\n        if (ex instanceof Error) {\n            return `${ex.message} ${ex.stack ?? \"\"}`;\n        }\n        return String(ex);\n    }\n\n    public logBindingErr(msg: string, ex: unknown, bindingName = \"\"): void {\n        this.processLoggingData(new LoggingData(performance.now(), msg,\n            \"binding\", bindingName, \"ERR\", this.sessionID, this.formatError(ex), this.frontVersion));\n    }\n\n    public logBindingMsg(msg: string, bindingName = \"\"): void {\n        this.processLoggingData(new LoggingData(performance.now(), msg, \"binding\", bindingName, \"INFO\",\n            this.sessionID, undefined, this.frontVersion));\n    }\n\n    public logCmdErr(msg: string, ex: unknown, cmdName = \"\"): void {\n        this.processLoggingData(new LoggingData(performance.now(), msg,\n            \"command\", cmdName, \"ERR\", this.sessionID, this.formatError(ex), this.frontVersion));\n    }\n\n    public logCmdMsg(msg: string, cmdName = \"\"): void {\n        this.processLoggingData(new LoggingData(performance.now(), msg, \"command\", cmdName, \"INFO\",\n            this.sessionID, undefined, this.frontVersion));\n    }\n\n    public logInteractionErr(msg: string, ex: unknown, interactionName = \"\"): void {\n        this.processLoggingData(new LoggingData(performance.now(), msg,\n            \"interaction\", interactionName, \"ERR\", this.sessionID, this.formatError(ex), this.frontVersion));\n    }\n\n    public logInteractionMsg(msg: string, interactionName = \"\"): void {\n        this.processLoggingData(new LoggingData(performance.now(), msg, \"interaction\", interactionName, \"INFO\",\n            this.sessionID, undefined, this.frontVersion));\n    }\n\n    public logBindingStart(bindingName: string): void {\n        this.ongoingBindings.push(new UsageLog(bindingName, this.sessionID, performance.now(), this.frontVersion));\n    }\n\n    public logBindingEnd(bindingName: string, cancelled: boolean): void {\n        const logs = this.ongoingBindings.filter(bind => bindingName.includes(bind.name));\n\n        // Removing these logs\n        this.ongoingBindings = this.ongoingBindings.filter(bind => !logs.includes(bind));\n\n        if (logs.length === 1) {\n            // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n            const log = logs[0]!;\n            log.name = bindingName;\n            log.duration = performance.now() - log.date;\n            log.cancelled = cancelled;\n\n            if (this.writeConsole) {\n                // eslint-disable-next-line no-console\n                console.log(log.toString());\n            }\n\n            if (this.serverAddress !== undefined) {\n                const rq = new XMLHttpRequest();\n                rq.open(\"POST\", `${this.serverAddress}/api/usage`, true);\n                rq.setRequestHeader(\"Content-Type\", \"application/json;charset=UTF-8\");\n                rq.send(JSON.stringify(log));\n            }\n        }\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General export function License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General export function License for more details.\n * You should have received a copy of the GNU General export function License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {Bindings} from \"../../api/binding/Bindings\";\nimport {DwellSpringAnimation} from \"../animation/DwellSpringAnimation\";\nimport {KeysBinder} from \"../binder/KeysBinder\";\nimport {UpdateBinder} from \"../binder/UpdateBinder\";\nimport {Redo} from \"../command/library/Redo\";\nimport {Undo} from \"../command/library/Undo\";\nimport {BoxChecked} from \"../interaction/library/BoxChecked\";\nimport {ButtonPressed} from \"../interaction/library/ButtonPressed\";\nimport {Click} from \"../interaction/library/Click\";\nimport {Clicks} from \"../interaction/library/Clicks\";\nimport {ColorPicked} from \"../interaction/library/ColorPicked\";\nimport {ComboBoxSelected} from \"../interaction/library/ComboBoxSelected\";\nimport {DatePicked} from \"../interaction/library/DatePicked\";\nimport {DnD} from \"../interaction/library/DnD\";\nimport {DoubleClick} from \"../interaction/library/DoubleClick\";\nimport {DragLock} from \"../interaction/library/DragLock\";\nimport {HyperLinkClicked} from \"../interaction/library/HyperLinkClicked\";\nimport {KeyDown} from \"../interaction/library/KeyDown\";\nimport {KeysDown} from \"../interaction/library/KeysDown\";\nimport {KeysTyped} from \"../interaction/library/KeysTyped\";\nimport {KeyTyped} from \"../interaction/library/KeyTyped\";\nimport {KeyUp} from \"../interaction/library/KeyUp\";\nimport {LongMouseDown} from \"../interaction/library/LongMouseDown\";\nimport {LongTouch} from \"../interaction/library/LongTouch\";\nimport {MouseDown} from \"../interaction/library/MouseDown\";\nimport {MouseEnter} from \"../interaction/library/MouseEnter\";\nimport {MouseLeave} from \"../interaction/library/MouseLeave\";\nimport {MouseMove} from \"../interaction/library/MouseMove\";\nimport {MouseUp} from \"../interaction/library/MouseUp\";\nimport {MultiTouch} from \"../interaction/library/MultiTouch\";\nimport {bottomPan, hPan, leftPan, rightPan, topPan, vPan} from \"../interaction/library/Pans\";\nimport {Scroll} from \"../interaction/library/Scroll\";\nimport {SpinnerChanged} from \"../interaction/library/SpinnerChanged\";\nimport {Tap} from \"../interaction/library/Tap\";\nimport {Taps} from \"../interaction/library/Taps\";\nimport {TextInputChanged} from \"../interaction/library/TextInputChanged\";\nimport {TouchDnD} from \"../interaction/library/TouchDnD\";\nimport {TouchStart} from \"../interaction/library/TouchStart\";\nimport {twoBottomPan, twoHPan, twoLeftPan, twoRightPan, twoTopPan, twoVPan} from \"../interaction/library/TwoPans\";\nimport {rotate, scale} from \"../interaction/library/TwoTouch\";\nimport {Wheel} from \"../interaction/library/Wheel\";\nimport {ThreeTouchDnD, FourTouchDnD, twoTouch} from \"../interaction/library/XTouch\";\nimport {Or} from \"../interaction/Or\";\nimport {Then} from \"../interaction/Then\";\nimport {LoggerImpl} from \"../logging/LoggerImpl\";\nimport type {EltRef, Widget} from \"../../api/binder/BaseBinderBuilder\";\nimport type {BaseUpdateBinder} from \"../../api/binder/BaseUpdateBinder\";\nimport type {Binding} from \"../../api/binding/Binding\";\nimport type {\n    PartialAnchorTypedBinder,\n    PartialButtonTypedBinder,\n    PartialInputTypedBinder,\n    PartialKeyTypedBinder,\n    PartialKeysTypedBinder,\n    PartialMultiTouchTypedBinder,\n    PartialPointTypedBinder,\n    PartialPointsTypedBinder,\n    PartialPointSrcTgtTypedBinder,\n    PartialScrollTypedBinder,\n    PartialSelectTypedBinder,\n    PartialSpinnerTypedBinder,\n    PartialTapsTypedBinder,\n    PartialTextInputTypedBinder,\n    PartialTouchTypedBinder,\n    PartialTouchSrcTgtTypedBinder,\n    PartialUpdatePointTypedBinder,\n    PartialWheelTypedBinder,\n    PartialPointOrTouchTypedBinder,\n    PartialTwoTouchTypedBinder,\n    PartialThreeTouchTypedBinder,\n    PartialFourTouchTypedBinder,\n    PartialRotateTypedBinder,\n    PartialTwoPanTypedBinder,\n    PartialScaleTypedBinder,\n    PartialThenBinder,\n    PartialPointsOrTapsTypedBinder,\n    PartialTouchMouseDnDTypedBinder,\n    PartialTapTypedBinder\n} from \"../../api/binding/Bindings\";\nimport type {BindingsObserver} from \"../../api/binding/BindingsObserver\";\nimport type {VisitorBinding} from \"../../api/binding/VisitorBinding\";\nimport type {LinterRule} from \"../../api/checker/Checker\";\nimport type {Interaction} from \"../../api/interaction/Interaction\";\nimport type {GeneralTwoTouchData} from \"../../api/interaction/TwoTouchData\";\nimport type {WidgetData} from \"../../api/interaction/WidgetData\";\nimport type {Logger} from \"../../api/logging/Logger\";\nimport type {UndoHistoryBase} from \"../../api/undo/UndoHistoryBase\";\nimport type {CommandBase} from \"../command/CommandBase\";\nimport type {GeneralTwoTouchDataImpl} from \"../interaction/GeneralTwoTouchDataImpl\";\nimport type {TwoPan} from \"../interaction/library/TwoPans\";\nimport type {Rotate, Scale} from \"../interaction/library/TwoTouch\";\nimport type {XTouchDnD} from \"../interaction/library/XTouch\";\n\n/**\n * Implementation of Bindings. This class to be used in DI\n * for creating binders and bindings.\n * @category Binding\n */\nexport class BindingsImpl<H extends UndoHistoryBase> extends Bindings<H> {\n    protected observer: BindingsObserver | undefined;\n\n    protected readonly undoHistoryData: H;\n\n    public readonly logger: Logger;\n\n    public constructor(history: H, logger?: Logger) {\n        super();\n        this.undoHistoryData = history;\n        this.logger = logger ?? new LoggerImpl();\n    }\n\n    public setLinterRules(...rules: ReadonlyArray<LinterRule>): void {\n        this.observer?.checker.setLinterRules(...rules);\n    }\n\n    public get undoHistory(): H {\n        return this.undoHistoryData;\n    }\n\n    public nodeBinder<A>(accInit?: A): BaseUpdateBinder {\n        return new UpdateBinder<CommandBase, Interaction<object>, A>(this.undoHistory,\n            this.logger, this.observer, undefined, accInit) as BaseUpdateBinder;\n    }\n\n    public buttonBinder<A>(accInit?: A): PartialButtonTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<ButtonPressed, A>(() => new ButtonPressed(this.logger));\n    }\n\n    public checkboxBinder<A>(accInit?: A): PartialInputTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<BoxChecked, A>(() => new BoxChecked(this.logger));\n    }\n\n    public colorPickerBinder<A>(accInit?: A): PartialInputTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<ColorPicked, A>(() => new ColorPicked(this.logger));\n    }\n\n    public comboBoxBinder<A>(accInit?: A): PartialSelectTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<ComboBoxSelected, A>(() => new ComboBoxSelected(this.logger));\n    }\n\n    public spinnerBinder<A>(accInit?: A): PartialSpinnerTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<SpinnerChanged, A>(() => new SpinnerChanged(this.logger));\n    }\n\n    public dateBinder<A>(accInit?: A): PartialInputTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<DatePicked, A>(() => new DatePicked(this.logger));\n    }\n\n    public hyperlinkBinder<A>(accInit?: A): PartialAnchorTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<HyperLinkClicked, A>(() => new HyperLinkClicked(this.logger));\n    }\n\n    public textInputBinder<A>(timeout?: number, accInit?: A): PartialTextInputTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<TextInputChanged, A>(() => new TextInputChanged(this.logger, timeout));\n    }\n\n    public touchDnDBinder<A>(cancellable: boolean, accInit?: A): PartialTouchSrcTgtTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<TouchDnD, A>(() => new TouchDnD(this.logger, cancellable));\n    }\n\n    public override touchStartBinder<A>(accInit?: A): PartialTouchTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<TouchStart, A>(() => new TouchStart(this.logger));\n    }\n\n    public reciprocalTouchDnDBinder<A>(handle: EltRef<SVGCircleElement>, spring: EltRef<SVGLineElement>, accInit?: A):\n    PartialTouchSrcTgtTypedBinder<A> {\n        const anim = new DwellSpringAnimation(handle, spring);\n\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<TouchDnD, A>(() => new TouchDnD(this.logger, true))\n            .on(handle)\n            .then((_c, i) => {\n                anim.process(i);\n            })\n            .endOrCancel(() => {\n                anim.end();\n            });\n    }\n\n    public reciprocalMouseOrTouchDnD<A>(handle: EltRef<SVGCircleElement>, spring: EltRef<SVGLineElement>,\n                                        accInit?: A): PartialTouchMouseDnDTypedBinder<A> {\n        const anim = new DwellSpringAnimation(handle, spring);\n\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<Or<TouchDnD, DnD>, A>(() => new Or<TouchDnD, DnD>(\n                new TouchDnD(this.logger, true), new DnD(true, this.logger), this.logger))\n            .on(handle)\n            .then((_c, i) => {\n                anim.process(i);\n            })\n            .endOrCancel(() => {\n                anim.end();\n            });\n    }\n\n    public multiTouchBinder<A>(nbTouches: number, accInit?: A): PartialMultiTouchTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<MultiTouch, A>(() => new MultiTouch(nbTouches, false, this.logger));\n    }\n\n    public twoTouchBinder<A>(accInit?: A): PartialTwoTouchTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<XTouchDnD<GeneralTwoTouchData, GeneralTwoTouchDataImpl>, A>(twoTouch(this.logger));\n    }\n\n    public threeTouchBinder<A>(accInit?: A): PartialThreeTouchTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<ThreeTouchDnD, A>(() => new ThreeTouchDnD(this.logger));\n    }\n\n    public fourTouchBinder<A>(accInit?: A): PartialFourTouchTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<FourTouchDnD, A>(() => new FourTouchDnD(this.logger));\n    }\n\n    public tapsBinder<A>(tapsCount: number, accInit?: A): PartialTapsTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<Taps, A>(() => new Taps(tapsCount, this.logger));\n    }\n\n    public tapBinder<A>(accInit?: A): PartialTapTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<Tap, A>(() => new Tap(this.logger));\n    }\n\n    public longTouchBinder<A>(duration: number, accInit?: A): PartialTouchTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<LongTouch, A>(() => new LongTouch(duration, this.logger));\n    }\n\n    public panBinder<A>(cancellable: boolean, accInit?: A): PartialTouchSrcTgtTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<TouchDnD, A>(() => new TouchDnD(this.logger, cancellable));\n    }\n\n    public panVerticalBinder<A>(pxTolerance: number, cancellable: boolean, minLength?: number, minVelocity?: number, accInit?: A):\n    PartialTouchSrcTgtTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<TouchDnD, A>(vPan(this.logger, cancellable, pxTolerance, minLength, minVelocity));\n    }\n\n    public panHorizontalBinder<A>(pxTolerance: number, cancellable: boolean, minLength?: number, minVelocity?: number, accInit?: A):\n    PartialTouchSrcTgtTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<TouchDnD, A>(hPan(this.logger, cancellable, pxTolerance, minLength, minVelocity));\n    }\n\n    public panLeftBinder<A>(pxTolerance: number, cancellable: boolean, minLength?: number, minVelocity?: number, accInit?: A):\n    PartialTouchSrcTgtTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<TouchDnD, A>(leftPan(this.logger, cancellable, pxTolerance, minLength, minVelocity));\n    }\n\n    public panRightBinder<A>(pxTolerance: number, cancellable: boolean, minLength?: number, minVelocity?: number, accInit?: A):\n    PartialTouchSrcTgtTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<TouchDnD, A>(rightPan(this.logger, cancellable, pxTolerance, minLength, minVelocity));\n    }\n\n    public panTopBinder<A>(pxTolerance: number, cancellable: boolean, minLength?: number, minVelocity?: number, accInit?: A):\n    PartialTouchSrcTgtTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<TouchDnD, A>(topPan(this.logger, cancellable, pxTolerance, minLength, minVelocity));\n    }\n\n    public panBottomBinder<A>(pxTolerance: number, cancellable: boolean, minLength?: number, minVelocity?: number, accInit?: A):\n    PartialTouchSrcTgtTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<TouchDnD, A>(bottomPan(this.logger, cancellable, pxTolerance, minLength, minVelocity));\n    }\n\n    public twoPanVerticalBinder<A>(pxTolerance: number, minLength?: number, minVelocity?: number, accInit?: A):\n    PartialTwoPanTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<TwoPan, A>(twoVPan(this.logger, pxTolerance, minLength, minVelocity));\n    }\n\n    public twoPanHorizontalBinder<A>(pxTolerance: number, minLength?: number, minVelocity?: number, accInit?: A):\n    PartialTwoPanTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<TwoPan, A>(twoHPan(this.logger, pxTolerance, minLength, minVelocity));\n    }\n\n    public twoPanLeftBinder<A>(pxTolerance: number, minLength?: number, minVelocity?: number, accInit?: A):\n    PartialTwoPanTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<TwoPan, A>(twoLeftPan(this.logger, pxTolerance, minLength, minVelocity));\n    }\n\n    public twoPanRightBinder<A>(pxTolerance: number, minLength?: number, minVelocity?: number, accInit?: A):\n    PartialTwoPanTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<TwoPan, A>(twoRightPan(this.logger, pxTolerance, minLength, minVelocity));\n    }\n\n    public twoPanTopBinder<A>(pxTolerance: number, minLength?: number, minVelocity?: number, accInit?: A):\n    PartialTwoPanTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<TwoPan, A>(twoTopPan(this.logger, pxTolerance, minLength, minVelocity));\n    }\n\n    public twoPanBottomBinder<A>(pxTolerance: number, minLength?: number, minVelocity?: number, accInit?: A):\n    PartialTwoPanTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<TwoPan, A>(twoBottomPan(this.logger, pxTolerance, minLength, minVelocity));\n    }\n\n    public rotateBinder<A>(pxTolerance: number, accInit?: A): PartialRotateTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<Rotate, A>(rotate(this.logger, pxTolerance));\n    }\n\n    public scaleBinder<A>(pxTolerance: number, accInit?: A): PartialScaleTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<Scale, A>(scale(this.logger, pxTolerance));\n    }\n\n    public clickBinder<A>(accInit?: A): PartialPointTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<Click, A>(() => new Click(this.logger));\n    }\n\n    public dbleClickBinder<A>(accInit?: A): PartialUpdatePointTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<DoubleClick, A>(() => new DoubleClick(this.logger));\n    }\n\n    public mouseUpBinder<A>(accInit?: A): PartialPointTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<MouseUp, A>(() => new MouseUp(this.logger));\n    }\n\n    public mouseDownBinder<A>(accInit?: A): PartialPointTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<MouseDown, A>(() => new MouseDown(this.logger));\n    }\n\n    public longMouseDownBinder<A>(duration: number, accInit?: A): PartialUpdatePointTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<LongMouseDown, A>(() => new LongMouseDown(duration, this.logger));\n    }\n\n    public clicksBinder<A>(nbClicks: number, accInit?: A): PartialPointsTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<Clicks, A>(() => new Clicks(nbClicks, this.logger));\n    }\n\n    public mouseLeaveBinder<A>(withBubbling: boolean, accInit?: A): PartialPointTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<MouseLeave, A>(() => new MouseLeave(withBubbling, this.logger));\n    }\n\n    public mouseEnterBinder<A>(withBubbling: boolean, accInit?: A): PartialPointTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<MouseEnter, A>(() => new MouseEnter(withBubbling, this.logger));\n    }\n\n    public mouseMoveBinder<A>(accInit?: A): PartialPointTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<MouseMove, A>(() => new MouseMove(this.logger));\n    }\n\n    public wheelBinder<A>(accInit?: A): PartialWheelTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<Wheel, A>(() => new Wheel(this.logger));\n    }\n\n    public scrollBinder<A>(accInit?: A): PartialScrollTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<Scroll, A>(() => new Scroll(this.logger));\n    }\n\n    public dndBinder<A>(cancellable: boolean, accInit?: A): PartialPointSrcTgtTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<DnD, A>(() => new DnD(cancellable, this.logger));\n    }\n\n    public reciprocalDndBinder<A>(handle: EltRef<SVGCircleElement>, spring: EltRef<SVGLineElement>, accInit?: A): PartialPointSrcTgtTypedBinder<A> {\n        const anim = new DwellSpringAnimation(handle, spring);\n\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<DnD, A>(() => new DnD(true, this.logger))\n            .on(handle)\n            .then((_c, i) => {\n                anim.process(i);\n            })\n            .endOrCancel(() => {\n                anim.end();\n            });\n    }\n\n    public dragLockBinder<A>(accInit?: A): PartialPointSrcTgtTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<DragLock, A>(() => new DragLock(this.logger));\n    }\n\n    public keyUpBinder<A>(modifierAccepted: boolean, accInit?: A): PartialKeyTypedBinder<A> {\n        return new KeysBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<KeyUp, A>(() => new KeyUp(this.logger, modifierAccepted));\n    }\n\n    public keyDownBinder<A>(modifierAccepted: boolean, accInit?: A): PartialKeyTypedBinder<A> {\n        return new KeysBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<KeyDown, A>(() => new KeyDown(this.logger, modifierAccepted));\n    }\n\n    public keysDownBinder<A>(accInit?: A): PartialKeysTypedBinder<A> {\n        return new KeysBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<KeysDown, A>(() => new KeysDown(this.logger));\n    }\n\n    public keysTypeBinder<A>(accInit?: A): PartialKeysTypedBinder<A> {\n        return new KeysBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<KeysTyped, A>(() => new KeysTyped(this.logger));\n    }\n\n    public keyTypeBinder<A>(accInit?: A): PartialKeyTypedBinder<A> {\n        return new KeysBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<KeyTyped, A>(() => new KeyTyped(this.logger));\n    }\n\n    public mouseDownOrTouchStartBinder<A>(accInit?: A): PartialPointOrTouchTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<Or<MouseDown, TouchStart>, A>(() => new Or(new MouseDown(this.logger), new TouchStart(this.logger), this.logger));\n    }\n\n    public tapsOrClicksBinder<A>(nbTap: number, accInit?: A): PartialPointsOrTapsTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<Or<Taps, Clicks>, A>(() => new Or(new Taps(nbTap, this.logger), new Clicks(nbTap, this.logger), this.logger));\n    }\n\n    public tapOrClickBinder<A>(accInit?: A): PartialPointOrTouchTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<Or<Tap, Click>, A>(() => new Or(new Tap(this.logger), new Click(this.logger), this.logger));\n    }\n\n    public longpressOrTouchBinder<A>(duration: number, accInit?: A): PartialPointOrTouchTypedBinder<A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<Or<LongMouseDown, LongTouch>, A>(\n                () => new Or(new LongMouseDown(duration, this.logger), new LongTouch(duration, this.logger), this.logger));\n    }\n\n    public combine<IX extends Array<Interaction<object>>, A>(interactions: IX, accInit?: A): PartialThenBinder<IX, A> {\n        return new UpdateBinder(this.undoHistory, this.logger, this.observer, undefined, accInit)\n            .usingInteraction<Then<IX>, A>(() => new Then<IX>(interactions, this.logger));\n    }\n\n    public undoRedoBinder(undo: Widget<HTMLButtonElement>, redo: Widget<HTMLButtonElement>,\n                          catchFn: ((err: unknown) => void) = ((): void => {})):\n        [Binding<Undo, Interaction<WidgetData<HTMLButtonElement>>, unknown>,\n            Binding<Redo, Interaction<WidgetData<HTMLButtonElement>>, unknown>] {\n        return [\n            this.buttonBinder()\n                .on(undo)\n                .toProduce(() => new Undo(this.undoHistory))\n                .catch(catchFn)\n                .bind(),\n            this.buttonBinder()\n                .on(redo)\n                .toProduce(() => new Redo(this.undoHistory))\n                .catch(catchFn)\n                .bind()\n        ];\n    }\n\n    public clear(): void {\n        this.observer?.clearObservedBindings();\n        this.undoHistory.clear();\n    }\n\n    public setBindingObserver(obs?: BindingsObserver): void {\n        this.observer?.clearObservedBindings();\n        this.observer = obs;\n    }\n\n    public override acceptVisitor(visitor: VisitorBinding): void {\n        visitor.visitBindings(this);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {CommandBase} from \"./CommandBase\";\nimport type {Undoable, UndoableSnapshot} from \"../../api/undo/Undoable\";\n\n/**\n * The base class for undoable UI commands.\n * @category Command\n */\nexport abstract class UndoableCommand extends CommandBase implements Undoable {\n    public getUndoName(): string {\n        return this.constructor.name;\n    }\n\n    public getVisualSnapshot(): UndoableSnapshot {\n        return undefined;\n    }\n\n    public equals(undoable: Undoable): boolean {\n        return this === undoable;\n    }\n\n    public abstract redo(): void;\n\n    public abstract undo(): void;\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\nimport {CommandBase} from \"../CommandBase\";\n\n/**\n * A predefined command for focusing a given element\n * @category Command\n */\nexport class FocusHTMLElement extends CommandBase {\n    private readonly element: unknown;\n\n    public constructor(elt: unknown) {\n        super();\n        this.element = elt;\n    }\n\n    protected execution(): void {\n        (this.element as HTMLElement).focus();\n    }\n\n    public override canExecute(): boolean {\n        return this.element instanceof HTMLElement;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {CommandBase} from \"../CommandBase\";\nimport type {UndoHistory} from \"../../../api/undo/UndoHistory\";\n\n/**\n * An Redo command that redoes the last N commands.\n * @category Command\n */\nexport class RedoNTimes extends CommandBase {\n    protected readonly history: UndoHistory;\n\n    protected readonly numberOfRedos: number;\n\n    public constructor(undoHistory: UndoHistory, numberOfRedos: number) {\n        super();\n        this.history = undoHistory;\n        this.numberOfRedos = numberOfRedos;\n    }\n\n    public override canExecute(): boolean {\n        return this.history.getRedo().length >= this.numberOfRedos;\n    }\n\n    protected execution(): void {\n        for (let i = 0; i < this.numberOfRedos; i++) {\n            this.history.redo();\n        }\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {UndoableCommand} from \"../UndoableCommand\";\n\n/**\n * An undoable command that changes the value of an object property.\n * @typeParam T - The type of the object to change\n * @typeParam S - The property of T to set\n * @category Command\n */\nexport class SetProperty<T, S extends keyof T> extends UndoableCommand {\n    protected readonly obj: T;\n\n    protected readonly prop: S;\n\n    public newvalue: T[S];\n\n    protected mementoValue: T[S] | undefined;\n\n    public constructor(obj: T, prop: S, newvalue: T[S]) {\n        super();\n        this.obj = obj;\n        this.prop = prop;\n        this.newvalue = newvalue;\n        this.mementoValue = undefined;\n    }\n\n    protected override createMemento(): void {\n        this.mementoValue = this.obj[this.prop];\n    }\n\n    protected execution(): void {\n        this.obj[this.prop] = this.newvalue;\n    }\n\n    public redo(): void {\n        this.execution();\n    }\n\n    public undo(): void {\n        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n        this.obj[this.prop] = this.mementoValue!;\n    }\n\n    public override getUndoName(): string {\n        return `Set '${String(this.prop)}' value: ${String(this.newvalue)}`;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {SetProperty} from \"./SetProperty\";\nimport {UndoableCommand} from \"../UndoableCommand\";\n\n/**\n * An undoable command that changes the value of a set of object properties.\n * @typeParam T - The type of the object to change\n * @category Command\n */\nexport class SetProperties<T> extends UndoableCommand {\n    public readonly obj: T;\n\n    protected _newvalues: Partial<T>;\n\n    public readonly compositeCmds: Array<SetProperty<T, keyof T>>;\n\n    public constructor(obj: T, newvalues: Partial<T>) {\n        super();\n        this.obj = obj;\n\n        this.compositeCmds = [];\n        this._newvalues = newvalues;\n        this.newvalues = newvalues;\n    }\n\n    public get newvalues(): Partial<T> {\n        return this._newvalues;\n    }\n\n    public set newvalues(value: Partial<T>) {\n        this._newvalues = value;\n\n        // eslint-disable-next-line guard-for-in,no-restricted-syntax\n        for (const key in value) {\n            this.compositeCmds.push(new SetProperty<T, keyof T>(this.obj, key, value[key] as T[keyof T]));\n        }\n    }\n\n    public override execute(): Promise<boolean> | boolean {\n        for (const cmd of this.compositeCmds) {\n            // eslint-disable-next-line no-void\n            void cmd.execute();\n        }\n        return super.execute();\n    }\n\n    protected execution(): void {}\n\n    public redo(): void {\n        for (const cmd of this.compositeCmds) {\n            cmd.redo();\n        }\n    }\n\n    public undo(): void {\n        for (const cmd of this.compositeCmds) {\n            cmd.undo();\n        }\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {UndoableCommand} from \"../UndoableCommand\";\n\n/**\n * An undoable command that transfers an element from one array to another.\n * @category Command\n */\nexport class TransferArrayItem<T> extends UndoableCommand {\n    /**\n     * The array to take the transferred element from.\n     */\n    protected _srcArray: Array<T>;\n\n    /**\n     * The array to put the transferred element in.\n     */\n    protected _tgtArray: Array<T>;\n\n    /**\n     * The index at which the element is located in the source array.\n     */\n    protected _srcIndex: number;\n\n    /**\n     * The index at which the element must be put in the target array.\n     */\n    protected _tgtIndex: number;\n\n    /**\n     * The name of the command.\n     */\n    protected readonly cmdName: string;\n\n    /**\n     * Creates the command.\n     * @param srcArray - The array to take the transferred element from.\n     * @param tgtArray - The array to put the transferred element in.\n     * @param srcIndex - The index at which the element is located in the source array.\n     * @param tgtIndex - The index at which the element must be put in the destination array.\n     * @param cmdName - The name of the command.\n     */\n    public constructor(srcArray: Array<T>,\n                       tgtArray: Array<T>,\n                       srcIndex: number,\n                       tgtIndex: number,\n                       cmdName: string) {\n        super();\n        this._srcArray = srcArray;\n        this._tgtArray = tgtArray;\n        this._srcIndex = srcIndex;\n        this._tgtIndex = tgtIndex;\n        this.cmdName = cmdName;\n    }\n\n    protected execution(): void {\n        this.redo();\n    }\n\n    public override canExecute(): boolean {\n        return (this._srcIndex >= 0 && this._srcIndex < this._srcArray.length) &&\n          (this._tgtIndex >= 0 && this._tgtIndex <= this._tgtArray.length);\n    }\n\n    public override getUndoName(): string {\n        return this.cmdName;\n    }\n\n    public redo(): void {\n        const elt = this._srcArray[this._srcIndex];\n        if (elt !== undefined) {\n            this._srcArray.splice(this._srcIndex, 1);\n            this._tgtArray.splice(this._tgtIndex, 0, elt);\n        }\n    }\n\n    public undo(): void {\n        const elt = this._tgtArray[this._tgtIndex];\n        if (elt !== undefined) {\n            this._tgtArray.splice(this._tgtIndex, 1);\n            this._srcArray.splice(this._srcIndex, 0, elt);\n        }\n    }\n\n    public get srcArray(): Array<T> {\n        return this._srcArray;\n    }\n\n    public set srcArray(value: Array<T>) {\n        this._srcArray = value;\n    }\n\n    public get tgtArray(): Array<T> {\n        return this._tgtArray;\n    }\n\n    public set tgtArray(value: Array<T>) {\n        this._tgtArray = value;\n    }\n\n    public get srcIndex(): number {\n        return this._srcIndex;\n    }\n\n    public set srcIndex(value: number) {\n        this._srcIndex = value;\n    }\n\n    public get tgtIndex(): number {\n        return this._tgtIndex;\n    }\n\n    public set tgtIndex(value: number) {\n        this._tgtIndex = value;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {CommandBase} from \"../CommandBase\";\nimport type {UndoHistory} from \"../../../api/undo/UndoHistory\";\n\n/**\n * An Undo command that undoes the last N commands.\n * @category Command\n */\nexport class UndoNTimes extends CommandBase {\n    protected readonly history: UndoHistory;\n\n    protected readonly numberOfUndos: number;\n\n    public constructor(undoHistory: UndoHistory, numberOfUndos: number) {\n        super();\n        this.history = undoHistory;\n        this.numberOfUndos = numberOfUndos;\n    }\n\n    public override canExecute(): boolean {\n        return this.history.getUndo().length >= this.numberOfUndos;\n    }\n\n    protected execution(): void {\n        for (let i = 0; i < this.numberOfUndos; i++) {\n            this.history.undo();\n        }\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {CancelFSMError} from \"./CancelFSMError\";\nimport {ConcurrentAndFSM} from \"./ConcurrentAndFSM\";\nimport type {FSM} from \"../../api/fsm/FSM\";\nimport type {Logger} from \"../../api/logging/Logger\";\n\n/**\n * An FSM that corresponds to the ! operator.\n * DnD ! KeyTyped(\"ESC\")  uses a NotFSM where DnD gives is the main FSM\n * and KeyTyped the FSM that can cancel the FSMs.\n * @category FSM\n */\nexport class NotFSM extends ConcurrentAndFSM<FSM> {\n    private readonly mainFSM: FSM;\n\n    public constructor(mainFSM: FSM, negFSM: FSM, logger: Logger) {\n        super([mainFSM], logger, [negFSM]);\n        this.mainFSM = mainFSM;\n\n        negFSM.addHandler({\n            \"fsmStops\": () => {\n                this.mainFSM.onCancelling();\n                throw new CancelFSMError();\n            }\n        });\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\nimport type {ConcurrentFSM} from \"../../api/fsm/ConcurrentFSM\";\nimport type {FSM} from \"../../api/fsm/FSM\";\nimport type {InputState} from \"../../api/fsm/InputState\";\nimport type {OutputState} from \"../../api/fsm/OutputState\";\nimport type {State} from \"../../api/fsm/State\";\nimport type {Transition} from \"../../api/fsm/Transition\";\nimport type {VisitorFSM} from \"../../api/fsm/VisitorFSM\";\n\n/**\n * A depth-first implementation of the FSM visitor. No treatment here, just visiting.\n * To customize this visitor, extends it and override the different methods.\n * @category FSM\n */\nexport class VisitorFSMDepthFirst implements VisitorFSM {\n    private readonly visited: Set<State>;\n\n    public constructor() {\n        this.visited = new Set();\n    }\n\n    public visitAndConcurrentFSM(fsm: ConcurrentFSM<FSM>): void {\n        for (const concFSM of fsm.getAllConccurFSMs()) {\n            concFSM.acceptVisitor(this);\n        }\n    }\n\n    public visitXOrConcurrentFSM(fsm: ConcurrentFSM<FSM>): void {\n        for (const concFSM of fsm.getAllConccurFSMs()) {\n            concFSM.acceptVisitor(this);\n        }\n    }\n\n    public visitInitState(state: OutputState & State): void {\n        if (this.alreadyVisited(state)) {\n            return;\n        }\n        for (const tr of state.transitions) {\n            tr.acceptVisitor(this);\n        }\n    }\n\n    public visitState(state: OutputState & State): void {\n        if (this.alreadyVisited(state)) {\n            return;\n        }\n        for (const tr of state.transitions) {\n            tr.acceptVisitor(this);\n        }\n    }\n\n    public visitCancellingState(_state: InputState & State): void {}\n\n    public visitTerminalState(_state: InputState & State): void {}\n\n    public visitFSM(fsm: FSM): void {\n        fsm.initState.acceptVisitor(this);\n    }\n\n    public visitTransition(transition: Transition<Event>): void {\n        transition.target.acceptVisitor(this);\n    }\n\n    public visitTimeoutTransition(transition: Transition<Event>): void {\n        transition.target.acceptVisitor(this);\n    }\n\n    public clear(): void {\n        this.visited.clear();\n    }\n\n    protected alreadyVisited(state: State): boolean {\n        const already = this.visited.has(state);\n        if (!already) {\n            this.visited.add(state);\n        }\n        return already;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {ConcurrentInteraction} from \"./ConcurrentInteraction\";\nimport {NotFSM} from \"../fsm/NotFSM\";\nimport type {Flushable} from \"./Flushable\";\nimport type {InteractionBase, InteractionDataImplType} from \"./InteractionBase\";\nimport type {Interaction, InteractionDataType} from \"../../api/interaction/Interaction\";\nimport type {Logger} from \"../../api/logging/Logger\";\n\n/**\n * An interaction that corresponds to the ! operator.\n * DnD ! KeyTyped(\"ESC\")  uses a Not interaction where DnD is the main interaction\n * and KeyTyped the one that can cancel the interactions.\n * @category Interaction Library\n */\n// eslint-disable-next-line no-use-before-define\nexport class Not<I extends InteractionBase<DI & object, DI & DImpl & Flushable>, N extends Interaction<object>,\n    DI = InteractionDataType<I>, DImpl = InteractionDataImplType<I>>\n    extends ConcurrentInteraction<DI & object, DI & DImpl & Flushable, NotFSM> {\n\n    private readonly mainInteraction: I;\n\n    private readonly negInteraction: N;\n\n    public constructor(i1: I, not: N, logger: Logger, name: string) {\n        super(new NotFSM(i1.fsm, not.fsm, logger), i1.data as (DI & DImpl & Flushable), logger, name);\n        this.mainInteraction = i1;\n        this.negInteraction = not;\n    }\n\n    public override uninstall(): void {\n        this.mainInteraction.uninstall();\n        this.negInteraction.uninstall();\n        super.uninstall();\n    }\n\n    public override reinit(): void {\n        this.mainInteraction.reinit();\n        this.negInteraction.reinit();\n        super.reinit();\n    }\n\n    public override fullReinit(): void {\n        this.mainInteraction.fullReinit();\n        this.negInteraction.fullReinit();\n        super.fullReinit();\n    }\n\n    public override reinitData(): void {\n        this.mainInteraction.reinitData();\n        this.negInteraction.reinitData();\n        super.reinitData();\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {FSMImpl} from \"../../fsm/FSMImpl\";\nimport {MouseTransition} from \"../../fsm/MouseTransition\";\nimport {TimeoutTransition} from \"../../fsm/TimeoutTransition\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {PointDataImpl} from \"../PointDataImpl\";\nimport type {PointData} from \"../../../api/interaction/PointData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\n/**\n * The FSM of the timed click interaction\n * @category FSM\n */\nexport class TimedClickFSM extends FSMImpl {\n    private currentButton: number | undefined;\n\n    private readonly buttonToConsider: number | undefined;\n\n    /**\n     * Creates the FSM\n     * @param duration - The max duration of the click\n     * @param logger - The logger to use for this interaction\n     * @param button - The button to be used\n     * @param action - The action executed on a click\n     */\n    public constructor(duration: number, logger: Logger, button?: number, action?: (evt: MouseEvent) => void) {\n        super(logger);\n\n        if (duration <= 0) {\n            throw new Error(\"Incorrect duration\");\n        }\n\n        this.buttonToConsider = button;\n\n        const pressed = this.addStdState(\"pressed\");\n        const cancelled = this.addCancellingState(\"cancelled\");\n\n        new MouseTransition(this.initState, pressed, \"mousedown\",\n            (evt: MouseEvent): void => {\n                this.setButtonToCheck(evt.button);\n                action?.(evt);\n            },\n            (evt: MouseEvent): boolean => this.buttonToConsider === undefined || evt.button === this.buttonToConsider);\n\n        new MouseTransition(pressed, this.addTerminalState(\"clicked\", true), \"mouseup\",\n            (evt: MouseEvent): void => {\n                action?.(evt);\n            },\n            (evt: MouseEvent): boolean => this.currentButton === undefined || evt.button === this.currentButton);\n\n        new MouseTransition(pressed, cancelled, \"mousemove\");\n        new TimeoutTransition(pressed, cancelled, () => duration);\n    }\n\n    private setButtonToCheck(evtButton: number): void {\n        this.currentButton = this.buttonToConsider ?? evtButton;\n    }\n\n    public override reinit(): void {\n        super.reinit();\n        this.currentButton = undefined;\n    }\n}\n\n/**\n * A click interaction that is cancelled if the mouse up is not done before a given delay\n * @category Interaction Library\n */\nexport class TimedClick extends InteractionBase<PointData, PointDataImpl> {\n    /**\n     * Creates the interaction.\n     * @param duration - The duration of the touch required to ends the user interaction\n     * If this duration is not reached, the interaction is cancelled.\n     * @param logger - The logger to use for this interaction\n     * @param button - The mouse button to use\n     * @param fsm - The optional FSM provided for the interaction\n     * @param data - The interaction data to use\n     * @param name - The name of the user interaction\n     */\n    public constructor(duration: number, logger: Logger, button?: number, fsm?: TimedClickFSM, data?: PointDataImpl, name?: string) {\n        const theFSM = fsm ?? new TimedClickFSM(duration, logger, button, (evt: MouseEvent): void => {\n            this._data.copy(evt);\n        });\n        super(theFSM, data ?? new PointDataImpl(), logger, name ?? TimedClick.name);\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {TapsFSM} from \"./Taps\";\nimport {TimeoutTransition} from \"../../fsm/TimeoutTransition\";\nimport {InteractionBase} from \"../InteractionBase\";\nimport {TapsDataImpl} from \"../TapsDataImpl\";\nimport {TouchDataImpl} from \"../TouchDataImpl\";\nimport type {PointsData} from \"../../../api/interaction/PointsData\";\nimport type {TouchData} from \"../../../api/interaction/TouchData\";\nimport type {Logger} from \"../../../api/logging/Logger\";\n\nclass TimedTapsFSM extends TapsFSM {\n    public constructor(duration: number, nbTaps: number, logger: Logger, dataHandler: (event: TouchEvent) => void) {\n        super(nbTaps, logger, dataHandler);\n\n        if (duration <= 0) {\n            throw new Error(\"Incorrect duration\");\n        }\n\n        new TimeoutTransition(this.downState, this.cancelState, () => duration);\n    }\n}\n\n/**\n * A tap user interaction that has a timeout:\n * while touching, if the timeout is reached the interaction is cancelled.\n * This touch interaction takes as input the timeout (in ms) the number of taps expected to end the interaction.\n * If this number is not reached after a timeout, the interaction is cancelled.\n * @category Interaction Library\n */\nexport class TimedTaps extends InteractionBase<PointsData<TouchData>, TapsDataImpl> {\n    /**\n     * Creates the timed tap interaction\n     * @param duration - The max duration before a timeout while touching.\n     * @param numberTaps - The number of taps expected to end the interaction.\n     * If this number is not reached after a timeout, the interaction is cancelled.\n     * @param logger - The logger to use for this interaction\n     * @param name - The name of the user interaction\n     */\n    public constructor(duration: number, numberTaps: number, logger: Logger, name?: string) {\n        const action = (evt: TouchEvent): void => {\n            if (evt.changedTouches.length > 0) {\n                const touch = new TouchDataImpl();\n                // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n                touch.copy(TouchDataImpl.mergeTouchEventData(evt.changedTouches[0]!, evt, Array.from(evt.touches)));\n                this._data.addPoint(touch);\n            }\n        };\n\n        super(new TimedTapsFSM(duration, numberTaps, logger, action), new TapsDataImpl(), logger, name ?? TimedTaps.name);\n    }\n}\n","/* eslint-disable id-length */\n/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport type {Binding} from \"../../api/binding/Binding\";\nimport type {Command} from \"../../api/command/Command\";\nimport type {Interaction} from \"../../api/interaction/Interaction\";\nimport type {Subscription} from \"rxjs\";\n\n/**\n * Fitt's Law data. Immutable.\n * @category Logging\n */\nexport class FittsLawDataImpl {\n    public readonly t: number;\n\n    public readonly w: number;\n\n    public readonly h: number;\n\n    public readonly d: number;\n\n    /**\n     * Creates the data.\n     * @param t - The time in ms. Be careful about fingerprinting protection:\n     * https://developer.mozilla.org/en-US/docs/Web/API/Performance/now#reduced_time_precision\n     * @param w - The width of the target object\n     * @param h - The height of the target object\n     * @param d - the distance from the first mouse event to the center of the target object\n     */\n    public constructor(t: number, w: number, h: number, d: number) {\n        this.d = d;\n        this.h = h;\n        this.w = w;\n        this.t = t;\n    }\n\n    /**\n     * The ID part of the Fitt's law.\n     * @param we - Effective target width (std dev on distances), to be used instead of the classical distance.\n     * @returns The ID\n     */\n    public getID(we?: number): number {\n        return Math.log2((this.d / (we ?? this.w)) + 1);\n    }\n}\n\n/**\n * Permits to compute Fitt's law data based on the usage of two Interacto bindings.\n * @category Logging\n */\nexport class FittsLaw {\n    private readonly obsSrc: Subscription;\n\n    private readonly providedTarget: Element | undefined;\n\n    private readonly data: Array<FittsLawDataImpl>;\n\n    private _startX: number | undefined;\n\n    private _startY: number | undefined;\n\n    private _target: Element | undefined;\n\n    private readonly handler: (evt: MouseEvent) => void;\n\n    /**\n     * @param bSrc - The source binding.\n     * @param bTgt - The target binding.\n     * @param target - The optional target object. If not provided, the target object will be inferred\n     * from event data.\n     */\n    public constructor(bSrc: Binding<Command, Interaction<object>, unknown>,\n                       bTgt: Binding<Command, Interaction<object>, unknown>,\n                       target?: Element) {\n        this.data = [];\n        this.providedTarget = target;\n\n        this.handler = (evt: MouseEvent): void => {\n            if (this._startX === undefined) {\n                this._startX = evt.screenX;\n                this._startY = evt.screenY;\n            }\n            this._target = this.providedTarget ?? (evt.target instanceof Element ? evt.target : undefined);\n        };\n\n        this.obsSrc = bSrc.produces.subscribe(() => {\n            this.reinit();\n            document.body.addEventListener(\"mousemove\", this.handler);\n            const t0 = performance.now();\n            const obsTgt = bTgt.produces.subscribe(() => {\n                const t1 = performance.now();\n                this.data.push(new FittsLawDataImpl(\n                    t1 - t0,\n                    this._target?.clientWidth ?? Number.NaN,\n                    this._target?.clientHeight ?? Number.NaN,\n                    this.computeD()));\n                obsTgt.unsubscribe();\n                document.body.removeEventListener(\"mousemove\", this.handler);\n            });\n        });\n    }\n\n    private computeD(): number {\n        if (this._startX === undefined || this.providedTarget === undefined) {\n            return Number.NaN;\n        }\n\n        const a = this.providedTarget.clientLeft + this.providedTarget.clientWidth / 2 + this._startX;\n        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n        const b = this.providedTarget.clientTop + this.providedTarget.clientHeight / 2 + this._startY!;\n\n        return Math.hypot(a, b);\n    }\n\n    /**\n     * Computes the effective target width (std dev on distances).\n     * @returns The effective target width.\n     */\n    public get we(): number {\n        const ds = this.data.map(d => d.d);\n\n        const mean = ds.reduce((a, b) => a + b) / ds.length;\n        return Math.sqrt(ds.map(x => (x - mean) ** 2).reduce((a, b) => a + b) / ds.length);\n    }\n\n    /**\n     * Computes the a and b coefficent of the regression line.\n     * @param effectiveTargetW - If true, will consider the effective target width. Otherwise will consider\n     * the computed distances.\n     * @returns the regression lien coefficients.\n     */\n    public getAB(effectiveTargetW = false): [a: number, b: number, r: number] {\n        // Linear regression\n\n        // do we consider effective target width\n        const w = effectiveTargetW ? this.we : undefined;\n        // 'id' are the x values\n        const xs = this.data.map(d => d.getID(w));\n        // 't' are the y values\n        const ys = this.data.map(d => d.t);\n        let sumx = 0;\n        let sumy = 0;\n        let sumxy = 0;\n        let sumxx = 0;\n        let sumyy = 0;\n\n        for (const [i, y] of ys.entries()) {\n            sumx += xs[i] ?? 0;\n            sumy += y;\n            sumxy += (xs[i] ?? 0) * y;\n            sumxx += (xs[i] ?? 0) ** 2;\n            sumyy += y * y;\n        }\n\n        const tmp = (ys.length * sumxy) - (sumx * sumy);\n        const tmp2 = (ys.length * sumxx) - (sumx ** 2);\n        // 'a' is the slope\n        const a = tmp / tmp2;\n        // 'b' is the intercept\n        const b = (sumy - a * sumx) / ys.length;\n        // Correlation coefficient 'r'\n        const r = (tmp / Math.sqrt(tmp2 * (ys.length * sumyy - sumy ** 2))) ** 2;\n\n        return [a, b, r];\n    }\n\n    /**\n     * Cleans the object\n     */\n    public uninstall(): void {\n        this.obsSrc.unsubscribe();\n        this.data.length = 0;\n    }\n\n    private reinit(): void {\n        this._startX = undefined;\n        this._startY = undefined;\n        this._target = undefined;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {TreeUndoHistory} from \"../../api/undo/TreeUndoHistory\";\nimport {remove} from \"../util/ArrayUtil\";\nimport {Subject} from \"rxjs\";\nimport type {UndoableTreeNode, UndoableTreeNodeDTO, TreeUndoHistoryDTO} from \"../../api/undo/TreeUndoHistory\";\nimport type {Undoable, UndoableSnapshot} from \"../../api/undo/Undoable\";\nimport type {Observable} from \"rxjs\";\n\n/**\n * Implementation of UndoableTreeNode\n * @category History\n */\nclass UndoableTreeNodeImpl implements UndoableTreeNode {\n    public lastChildUndone: UndoableTreeNode | undefined;\n\n    public readonly children: Array<UndoableTreeNode>;\n\n    public readonly id: number;\n\n    public readonly parent: UndoableTreeNode | undefined;\n\n    public readonly undoable: Undoable;\n\n    private readonly cacheVisualSnap: UndoableSnapshot;\n\n    public constructor(undoable: Undoable, id: number, parent: UndoableTreeNode | undefined) {\n        this.undoable = undoable;\n        this.id = id;\n        this.children = [];\n        this.parent = parent;\n        this.cacheVisualSnap = undoable.getVisualSnapshot();\n    }\n\n    public undo(): void {\n        if (this.parent !== undefined) {\n            this.parent.lastChildUndone = this;\n        }\n        this.undoable.undo();\n    }\n\n    public redo(): void {\n        this.undoable.redo();\n    }\n\n    public get visualSnapshot(): UndoableSnapshot {\n        return this.cacheVisualSnap;\n    }\n}\n\nclass UndoableTreeNodeDTOImpl implements UndoableTreeNodeDTO {\n    public readonly children: ReadonlyArray<UndoableTreeNodeDTO>;\n\n    public readonly id: number;\n\n    public readonly undoable: unknown;\n\n    public constructor(node: UndoableTreeNode, fn: (undoable: Undoable) => unknown) {\n        this.id = node.id;\n        this.undoable = fn(node.undoable);\n        this.children = node.children.map(child => new UndoableTreeNodeDTOImpl(child, fn));\n    }\n\n    /**\n     * Produces a tree node from the DTO node. This operates recursively on\n     * children, so that it converts all the tree node.\n     * @param dto - The DTO to convert\n     * @param fn - The conversion method for the undoable.\n     * @param parent - The parent node of the one to create.\n     * @returns The created tree node (and its children) and the list of created nodes.\n     */\n    public static toNode(dto: UndoableTreeNodeDTO, fn: (dtoUndoable: unknown) => Undoable, parent: UndoableTreeNode):\n    [UndoableTreeNode, Array<UndoableTreeNode>] {\n        const node = new UndoableTreeNodeImpl(fn(dto.undoable), dto.id, parent);\n        const res = dto.children.map(child => UndoableTreeNodeDTOImpl.toNode(child, fn, node));\n\n        node.children.push(...res.map(currNodeTree => currNodeTree[0]));\n        const nodes = [node, ...res.flatMap(currNodeTree => currNodeTree[1])];\n\n        return [node, nodes];\n    }\n}\n\n/**\n * An implementation of the TreeUndoHistory interface\n * @category History\n */\nexport class TreeUndoHistoryImpl extends TreeUndoHistory {\n    private idCounter: number;\n\n    private _currentNode: UndoableTreeNode;\n\n    public readonly undoableNodes: Array<UndoableTreeNode | undefined>;\n\n    private readonly undoPublisher: Subject<Undoable | undefined>;\n\n    private readonly redoPublisher: Subject<Undoable | undefined>;\n\n    private readonly sizePublisher: Subject<number>;\n\n    public readonly root: UndoableTreeNode;\n\n    public readonly considersEqualCmds: boolean;\n\n    private readonly _path: Array<number>;\n\n    private readonly _keepPath: boolean;\n\n    /**\n     * Create the undo history\n     * @param keepPath - If true, cannot delete branches. Keeps all the paths (branches).\n     * @param considerEqualCmd - By default, executing a command erases the redoable commands.\n     * When executing a command (and adding this command in the history), this option adds a new check:\n     * if the newly executed command equals the next redoable one, then the redoable stack is not clear\n     * but the history moves to the next redoable command (i.e., perform a redo instead of really adding the command).\n     */\n    public constructor(keepPath = false, considerEqualCmd = false) {\n        super();\n        this._keepPath = keepPath;\n        this.considersEqualCmds = considerEqualCmd;\n        this._path = [];\n        this.undoableNodes = [];\n        this.idCounter = 0;\n        this.root = new UndoableTreeNodeImpl({\n            getUndoName(): string {\n                return \"\";\n            },\n            getVisualSnapshot(): UndoableSnapshot {\n                return \"root\";\n            },\n            redo(): void {},\n            undo(): void {},\n            equals(): boolean {\n                return false;\n            }\n        }, -1, undefined);\n        this._currentNode = this.root;\n        this.undoPublisher = new Subject();\n        this.redoPublisher = new Subject();\n        this.sizePublisher = new Subject();\n    }\n\n    public add(undoable: Undoable): void {\n        let equalCmd: UndoableTreeNode | undefined;\n\n        if (this.considersEqualCmds) {\n            equalCmd = this._currentNode.children.find(child => child.undoable.equals(undoable));\n        }\n\n        if (equalCmd === undefined) {\n            const node = new UndoableTreeNodeImpl(undoable, this.idCounter, this.currentNode);\n            this.undoableNodes[this.idCounter] = node;\n            this.currentNode.children.push(node);\n            this._currentNode = node;\n            this.addToPath();\n            this.idCounter++;\n            this.undoPublisher.next(undoable);\n            this.redoPublisher.next(undefined);\n            this.sizePublisher.next(this.size());\n        } else {\n            this.goTo(equalCmd.id);\n        }\n    }\n\n    public get currentNode(): UndoableTreeNode {\n        return this._currentNode;\n    }\n\n    public clear(): void {\n        this.root.children.length = 0;\n        this._currentNode = this.root;\n        this._path.length = 0;\n        this.undoableNodes.length = 0;\n        this.idCounter = 0;\n        this.undoPublisher.next(undefined);\n        this.redoPublisher.next(undefined);\n        this.sizePublisher.next(0);\n    }\n\n    public delete(id: number): void {\n        // Cannot delete if keeping path\n        if (this.keepPath) {\n            return;\n        }\n\n        const node = this.undoableNodes[id];\n\n        if (node === undefined) {\n            return;\n        }\n\n        let nodeBranch = this.currentNode;\n\n        while (nodeBranch !== this.root) {\n            // cannot remove the current branch (older or current undoables)\n            if (nodeBranch.id === id) {\n                return;\n            }\n            nodeBranch = nodeBranch.parent ?? this.root;\n        }\n\n        this.undoableNodes[id] = undefined;\n\n        if (node.parent !== undefined) {\n            remove(node.parent.children, node);\n            if (node.parent.lastChildUndone === node) {\n                node.parent.lastChildUndone = undefined;\n            }\n            this.sizePublisher.next(this.size());\n        }\n\n        // Cloning the array since 'delete' may alter the children list.\n        for (const child of Array.from(node.children)) {\n            this.delete(child.id);\n        }\n\n        if (this.currentNode === node) {\n            this._currentNode = this.root;\n        }\n    }\n\n    public goTo(id: number): void {\n        if (this.currentNode.id === id || this.undoableNodes.length === 0 || id >= this.undoableNodes.length || id < -1) {\n            return;\n        }\n\n        if (this.currentNode === this.root) {\n            this.goToFromRoot(id);\n        } else {\n            this.goFromOneNodeToAnotherOne(id);\n        }\n\n        this._currentNode = this.undoableNodes[id] ?? this.root;\n        this.addToPath();\n        this.undoPublisher.next(this.getLastUndo());\n        this.redoPublisher.next(this.getLastRedo());\n    }\n\n    private goToFromRoot(id: number): void {\n        const undoables = this.gatherToRoot(this.undoableNodes[id]);\n        for (const undoable of undoables) {\n            undoable.redo();\n        }\n    }\n\n    private gatherToRoot(node: UndoableTreeNode | undefined): Array<UndoableTreeNode> {\n        const path: Array<UndoableTreeNode> = [];\n        let currentNode = node;\n        while (currentNode !== this.root && currentNode !== undefined) {\n            path.push(currentNode);\n            currentNode = currentNode.parent;\n        }\n        return path.reverse();\n    }\n\n    private goFromOneNodeToAnotherOne(id: number): void {\n        // Go to root\n        const pathSrc = this.gatherToRoot(this.currentNode);\n        const pathTo = id === -1 ? [] : this.gatherToRoot(this.undoableNodes[id]);\n\n        // Following the common path\n        let i = 0;\n        while (pathSrc[i] === pathTo[i]) {\n            i++;\n        }\n\n        /*\n         * When taking different paths,\n         * we undo from the source path to the common node,\n         */\n        for (let j = pathSrc.length - 1; j > i; j--) {\n            pathSrc[j]?.undo();\n        }\n        if (i < pathSrc.length) {\n            pathSrc[i]?.undo();\n        }\n        // to then redo the target path to the targeted node\n        for (let j = i; j < pathTo.length; j++) {\n            pathTo[j]?.redo();\n        }\n    }\n\n    public redo(): void {\n        const node = this.currentNode.lastChildUndone;\n\n        if (node !== undefined) {\n            node.undoable.redo();\n            this._currentNode = node;\n            this.addToPath();\n            this.undoPublisher.next(node.undoable);\n            this.redoPublisher.next(this.getLastRedo());\n        }\n    }\n\n    public undo(): void {\n        if (this.currentNode !== this.root) {\n            const currentUndoable = this.currentNode.undoable;\n            this.currentNode.undo();\n            this._currentNode = this.currentNode.parent ?? this.root;\n            this.addToPath();\n            this.undoPublisher.next(this.getLastUndo());\n            this.redoPublisher.next(currentUndoable);\n        }\n    }\n\n    public getPositions(): Map<number, number> {\n        const positions = new Map<number, number>();\n        this.getPositionNode(this.root, positions, 0);\n        return positions;\n    }\n\n    private getPositionNode(node: UndoableTreeNode, positions: Map<number, number>, counter: number): number {\n        const [child0, child1] = node.children;\n\n        // length === 0\n        if (child0 === undefined) {\n            positions.set(node.id, counter);\n            return counter + 1;\n        }\n\n        // length === 1\n        if (child1 === undefined) {\n            const newCounter = this.getPositionNode(child0, positions, counter);\n            positions.set(node.id, positions.get(child0.id) ?? -1);\n            return newCounter;\n        }\n\n        let newCounter = counter;\n        for (let i = 0; i < Math.floor(node.children.length / 2); i++) {\n            // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n            newCounter = this.getPositionNode(node.children[i]!, positions, newCounter);\n        }\n\n        if (node.children.length % 2 === 0) {\n            positions.set(node.id, newCounter);\n            newCounter++;\n        } else {\n            // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n            const value = node.children[Math.floor(node.children.length / 2)]!;\n            newCounter = this.getPositionNode(value, positions, newCounter);\n            positions.set(node.id, positions.get(value.id) ?? -1);\n        }\n\n        for (let i = Math.ceil(node.children.length / 2); i < node.children.length; i++) {\n            // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n            newCounter = this.getPositionNode(node.children[i]!, positions, newCounter);\n        }\n\n        return newCounter;\n    }\n\n    public getLastOrEmptyRedoMessage(): string {\n        return this.getLastRedoMessage() ?? \"\";\n    }\n\n    public getLastOrEmptyUndoMessage(): string {\n        return this.getLastUndoMessage() ?? \"\";\n    }\n\n    public getLastRedo(): Undoable | undefined {\n        if (this.currentNode.lastChildUndone !== undefined) {\n            return this.currentNode.lastChildUndone.undoable;\n        }\n\n        return this.currentNode.children[0]?.undoable;\n    }\n\n    public getLastRedoMessage(): string | undefined {\n        return this.getLastRedo()?.getUndoName();\n    }\n\n    public getLastUndo(): Undoable | undefined {\n        return this.currentNode === this.root ? undefined : this.currentNode.undoable;\n    }\n\n    public getLastUndoMessage(): string | undefined {\n        return this.getLastUndo()?.getUndoName();\n    }\n\n    public undosObservable(): Observable<Undoable | undefined> {\n        return this.undoPublisher;\n    }\n\n    public redosObservable(): Observable<Undoable | undefined> {\n        return this.redoPublisher;\n    }\n\n    public get path(): ReadonlyArray<number> {\n        return this._path;\n    }\n\n    public get keepPath(): boolean {\n        return this._keepPath;\n    }\n\n    private addToPath(): void {\n        if (this.keepPath) {\n            this._path.push(this._currentNode.id);\n        }\n    }\n\n    public override export(fn: (undoable: Undoable) => unknown): TreeUndoHistoryDTO {\n        return {\n            \"roots\": this.root.children.map(child => new UndoableTreeNodeDTOImpl(child, fn)),\n            \"path\": this.path\n        };\n    }\n\n    public override import(dtoHistory: TreeUndoHistoryDTO, fn: (dtoUndoable: unknown) => Undoable): void {\n        this.clear();\n\n        if (this.keepPath) {\n            this._path.push(...dtoHistory.path);\n        }\n\n        const res = dtoHistory.roots.map(root => UndoableTreeNodeDTOImpl.toNode(root, fn, this.root));\n        this.root.children.push(...res.map(currRoot => currRoot[0]));\n\n        for (const currNode of res.flatMap(currRoot => currRoot[1])) {\n            this.undoableNodes[currNode.id] = currNode;\n        }\n\n        this._currentNode = this.root;\n        this.idCounter = Math.max(...this._path) + 1;\n        const gotoId = this.path.at(-1);\n\n        // Executing the nominal path\n        if (gotoId !== undefined) {\n            this.goTo(gotoId);\n            this.goTo(-1);\n        }\n\n        this.undoPublisher.next(this.getLastUndo());\n        this.redoPublisher.next(this.getLastRedo());\n    }\n\n    public override size(): number {\n        return this.childrenNode(this.root);\n    }\n\n    private childrenNode(node: UndoableTreeNode): number {\n        return node.children\n            .map(child => this.childrenNode(child))\n            .reduce((x, y) => x + y, 0) + node.children.length;\n    }\n\n    public override sizeObservable(): Observable<number> {\n        return this.sizePublisher;\n    }\n}\n","/*\n * This file is part of Interacto.\n * Interacto is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n * Interacto is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with Interacto.  If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport {UndoHistory} from \"../../api/undo/UndoHistory\";\nimport {Subject} from \"rxjs\";\nimport type {Undoable} from \"../../api/undo/Undoable\";\nimport type {Observable} from \"rxjs\";\n\n/**\n * Implementation of the undo history (linear)\n * @category History\n */\nexport class UndoHistoryImpl extends UndoHistory {\n    /**\n     * Contains the undoable objects.\n     */\n    private readonly undos: Array<Undoable>;\n\n    /**\n     * Contains the redoable objects.\n     */\n    private readonly redos: Array<Undoable>;\n\n    public readonly considersEqualCmds: boolean;\n\n    /**\n     * The maximal number of undo.\n     */\n    private sizeMax: number;\n\n    private readonly undoPublisher: Subject<Undoable | undefined>;\n\n    private readonly redoPublisher: Subject<Undoable | undefined>;\n\n    private readonly sizePublisher: Subject<[number, number]>;\n\n    /**\n     * Create the undo history\n     * @param considerEqualCmd - By default, executing a command erases the redoable commands.\n     * When executing a command (and adding this command in the history), this option adds a new check:\n     * if the newly executed command equals the next redoable one, then the redoable stack is not clear\n     * but the history moves to the next redoable command (i.e., perform a redo instead of really adding the command).\n     */\n    public constructor(considerEqualCmd = false) {\n        super();\n        this.sizeMax = 0;\n        this.undos = [];\n        this.redos = [];\n        this.sizeMax = 20;\n        this.undoPublisher = new Subject();\n        this.redoPublisher = new Subject();\n        this.sizePublisher = new Subject();\n        this.considersEqualCmds = considerEqualCmd;\n    }\n\n    public undosObservable(): Observable<Undoable | undefined> {\n        return this.undoPublisher;\n    }\n\n    public redosObservable(): Observable<Undoable | undefined> {\n        return this.redoPublisher;\n    }\n\n    public clear(): void {\n        if (this.undos.length > 0) {\n            this.undos.length = 0;\n            this.undoPublisher.next(undefined);\n        }\n        this.clearRedo();\n        this.publishSize();\n    }\n\n    private clearRedo(): void {\n        if (this.redos.length > 0) {\n            this.redos.length = 0;\n            this.redoPublisher.next(undefined);\n        }\n    }\n\n    public add(undoable: Undoable): void {\n        if (this.sizeMax > 0) {\n            if (this.undos.length === this.sizeMax) {\n                this.undos.shift();\n            }\n\n            const lastRedo = this.redos.at(-1);\n            if (this.considersEqualCmds && lastRedo !== undefined && lastRedo.equals(undoable)) {\n                this.redo();\n            } else {\n                this.undos.push(undoable);\n                this.undoPublisher.next(undoable);\n                this.clearRedo();\n                this.publishSize();\n            }\n        }\n    }\n\n    public undo(): void {\n        const undoable = this.undos.pop();\n\n        if (undoable !== undefined) {\n            try {\n                undoable.undo();\n            } finally {\n                this.redos.push(undoable);\n                this.undoPublisher.next(this.getLastUndo());\n                this.redoPublisher.next(undoable);\n                this.publishSize();\n            }\n        }\n    }\n\n    public redo(): void {\n        const undoable = this.redos.pop();\n\n        if (undoable !== undefined) {\n            try {\n                undoable.redo();\n            } finally {\n                this.undos.push(undoable);\n                this.undoPublisher.next(undoable);\n                this.redoPublisher.next(this.getLastRedo());\n                this.publishSize();\n            }\n        }\n    }\n\n    public getLastUndoMessage(): string | undefined {\n        return this.undos.at(-1)?.getUndoName();\n    }\n\n    public getLastRedoMessage(): string | undefined {\n        return this.redos.at(-1)?.getUndoName();\n    }\n\n    public getLastOrEmptyUndoMessage(): string {\n        return this.getLastUndoMessage() ?? \"\";\n    }\n\n    public getLastOrEmptyRedoMessage(): string {\n        return this.getLastRedoMessage() ?? \"\";\n    }\n\n    public getLastUndo(): Undoable | undefined {\n        return this.undos.at(-1);\n    }\n\n    public getLastRedo(): Undoable | undefined {\n        return this.redos.at(-1);\n    }\n\n    public getSizeMax(): number {\n        return this.sizeMax;\n    }\n\n    public setSizeMax(max: number): void {\n        if (max >= 0) {\n            const removed = this.undos.splice(0, this.undos.length - max);\n            const willRemoved = removed.length > 0 || this.redos.length > 0;\n            if (removed.length > 0 && this.undos.length === 0) {\n                this.undoPublisher.next(undefined);\n            }\n            this.clearRedo();\n            if (willRemoved) {\n                this.publishSize();\n            }\n            this.sizeMax = max;\n        }\n    }\n\n    public getUndo(): ReadonlyArray<Undoable> {\n        return this.undos;\n    }\n\n    public getRedo(): ReadonlyArray<Undoable> {\n        return this.redos;\n    }\n\n    public override size(): [number, number] {\n        return [this.undos.length, this.redos.length];\n    }\n\n    public override sizeObservable(): Observable<[number, number]> {\n        return this.sizePublisher;\n    }\n\n    private publishSize(): void {\n        this.sizePublisher.next(this.size());\n    }\n}\n"],"names":["isEltRef","obj","nativeElement","EventTarget","isWhenAtStart","type","isWhenAtThen","isWhenAtEnd","isWhenStrict","Bindings","mouseEventTypes","touchEventTypes","keyEventTypes","eventTypes","isOutputStateType","TreeUndoHistory","UndoHistory","isUndoableType","DwellSpringAnimation","constructor","handle","spring","__publicField","this","interval","radius","Number","parseInt","getAttribute","positionSpring","x","y","process","i","displaySpring","distance","Math","hypot","tgt","clientX","clientY","abs","setAttribute","clearInterval","globalThis","window","setInterval","String","src","end","CommandBase","status","flush","createMemento","execute","ok","canExecute","result","execution","Promise","then","catch","error","hadEffect","isDone","done","cancel","getStatus","AnonCmd","fct","super","exec","Binder","undoHistory","logger","observer","binder","acc","widgets","dynamicNodes","logLevels","linterRules","Map","stopPropagation","prevDefault","Object","assign","accInit","copyFnArrays","whenFnArray","Array","from","firstFnArray","firstFn","c","fn","endFnArray","endFn","hadEffectsFnArray","hadEffectsFn","hadNoEffectFnArray","hadNoEffectFn","cannotExecFnArray","cannotExecFn","onErrFnArray","onErrFn","ex","on","widget","ws","concat","map","currWidget","length","dup","duplicate","onDynamic","node","nodeEvt","first","push","when","mode","ifHadEffects","ifHadNoEffect","ifCannotExecute","log","level","stopImmediatePropagation","preventDefault","name","bindingName","configureRules","ruleName","severity","set","usingInteraction","usingFn","toProduce","produceFn","toProduceAnon","MustBeUndoableCmdError","Error","cmdProducer","BindingImpl","continuousExecution","interaction","_name","accumulatorInit","logBinding","logCmd","logUsage","_timeCancelled","_timeEnded","accumulator","cmdsProduced","Subject","_interaction","_cmd","continuousCmdExecution","_activated","fsm","addHandler","fsmStarts","fsmUpdates","fsmStops","fsmCancels","fsmError","err","registerToNodes","reinitAccumulator","whenStart","whenUpdate","whenStop","clearEvents","fullReinit","createCommand","cmd","data","logBindingErr","isWhenDefined","_err","endOrCancel","ifCmdHadNoEffect","ifCmdHadEffects","ifCannotExecuteCmd","command","activated","logBindingMsg","setActivated","running","isRunning","logCmdMsg","cancelContinousWithEffectsCmd","logBindingEnd","undo","logBindingStart","createAndInitCommand","continuousExecutionOnFSMUpdate","executed","logCmdErr","cancelled","executeCommandOnFSMStop","afterCmdExecuted","whenOk","next","add","uninstallBinding","complete","uninstall","produces","timesEnded","timesCancelled","acceptVisitor","visitor","visitBinding","CancelFSMError","AnonBinding","continuousExec","cmdSupplierFn","loggers","timeoutThrottle","thenFn","whenFn","cancelFn","endOrCancelFn","configureLoggers","onEndFn","setThrottleTimeout","registerToNodeChildren","includes","whenChecker","filterPredicate","filter","every","executeWhen","res","UpdateBinder","throttleTimeout","copyFnArraysUpdate","thenFnArray","cancelFnArray","endOrCancelFnArray","throttle","timeout","bind","binding","observeBinding","InteractionDataBase","copy","currentTargetData","currentTarget","targetData","target","timeStampData","timeStamp","KeyDataImpl","arguments","codeData","keyData","locationData","repeatData","altKeyData","ctrlKeyData","metaKeyData","shiftKeyData","code","key","location","repeat","altKey","ctrlKey","metaKey","shiftKey","KeysDataImpl","keysData","keys","addKey","KeysBinder","isCode","keysOrCodes","completeWhenWithKeysPredicates","currentKeys","TransitionBase","srcState","tgtState","action","guard","addTransition","event","accept","stopCurrentTimeout","exit","enter","visitTransition","MouseTransition","types","acceptedEvents","Set","MouseEvent","getAcceptedEvents","has","ClickTransition","StateBase","stateMachine","stateName","checkStartingState","started","startingState","onStarting","CancellingState","onCancelling","visitCancellingState","getTouch","touches","idToFind","touch","identifier","isButton","HTMLButtonElement","isCheckBox","HTMLInputElement","isColorChoice","isComboBox","HTMLSelectElement","isDatePicker","isSpinner","isHyperLink","HTMLAnchorElement","isTextInput","HTMLTextAreaElement","isKeyDownEvent","KeyboardEvent","isKeyUpEvent","KeyCode","OutputStateBase","_transitions","transitions","some","tr","clearTransitions","InitState","visitInitState","StdState","enterStdState","visitState","TerminalState","onTerminating","visitTerminalState","TimeoutTransition","timeouted","timeoutDuration","startTimeout","timeoutThread","time","onTimeout","setTimeout","logInteractionErr","stopTimeout","clearTimeout","_event","visitTimeoutTransition","remove","array","elt","index","indexOf","splice","removeAt","FSMImpl","inner","_started","initState","_states","_currentState","currentStatePublisher","handlers","eventsToProcess","currentSubFSM","_log","currentState","state","old","currentStateObservable","removeKeyEvent","processed","processEvent","evt","addRemaningEventsToProcess","logInteractionMsg","notifyHandlerOnError","visitFSM","removed","size","checkTimeoutTransition","onUpdating","processRemainingEvents","list","onError","notifyHandlerOnStop","reinit","notifyHandlerOnCancel","notifyHandlerOnStart","notifyHandlerOnUpdate","addStdState","addState","addTerminalState","addCancellingState","currentTimeout","handler","fsmReinit","find","trans","removeHandler","hs","preFsmStart","preFsmUpdate","preFsmStop","states","getEventsToProcess","InteractionBase","reinitDataOnFSMReinit","stopImmediatePropag","preventDef","_data","_fsm","disposable","subscribe","current","updateEventsRegistered","_registeredNodes","_dynamicRegisteredNodes","mutationObservers","reinitData","createThrottleTimeout","currentThrottling","currTimeout","rejection","resolve","reject","latestThrottledEvent","directEventProcess","checkThrottlingEvent","latestEvt","newState","oldState","currEvents","getCurrentAcceptedEvents","events","getEventTypesOf","eventsToRemove","eventsToAdd","unregisterEventToNode","registerEventToNode","callBackMutationObserver","mutationList","mutation","addedNodes","removedNodes","unregisterFromNodes","onNewNodeRegistered","delete","onNodeUnregistered","elementToObserve","childNodes","newMutationObserver","MutationObserver","mutations","observe","childList","eventType","addEventListener","getMouseHandler","getTouchHandler","getKeyHandler","getUIHandler","removeEventListener","registerActionHandlerClick","getActionHandler","unregisterActionHandlerClick","registerActionHandlerInput","unregisterActionHandlerInput","actionHandler","mouseHandler","touchHandler","keyHandler","uiHandler","stop","prevent","isActivated","unsubscribe","clear","obs","disconnect","visitInteraction","registeredNodes","dynamicRegisteredNodes","PointingDataBase","clientXData","clientYData","pageXData","pageYData","screenXData","screenYData","pageX","pageY","screenX","screenY","PointDataImpl","buttonData","buttonsData","movementXData","movementYData","offsetXData","offsetYData","relatedTargetData","button","buttons","movementX","movementY","offsetX","offsetY","relatedTarget","ClickFSM","setCheckButton","checkButton","getCheckButton","buttonToCheck","Click","PointsDataImpl","pointsData","points","addPoint","ptData","MousePointsDataImpl","currentPosition","currentPositionData","position","lastButton","at","ClicksFSM","nbClicks","countClicks","clicked","Clicks","numberClicks","pt","SubFSMTransition","findTransition","subFSM","subFSMHandler","Event","unsetFSMHandler","cancelsFSM","setUpFSMHandler","subStateSubscription","value","transition","_DoubleClickFSM","subAction","firstClickFSM","sndClickFSM","errorHandler","ev","timeGapSupplier","getTimeGap","timeGap","setTimeGap","timeGapBetweenClicks","DoubleClickFSM","DoubleClick","theFSM","KeyTransition","keyType","EscapeKeyPressureTransition","escape","SrcTgtDataBase","srcData","tgtData","diffClientX","diffClientY","diffPageX","diffPageY","diffScreenX","diffScreenY","duration","velocity","direction","isHorizontal","pxTolerance","isVertical","isLeft","isRight","isTop","isBottom","SrcTgtPointsDataImpl","copySrc","copyTgt","DragLockFSM","dbleClick1Action","dbleClick2Action","firstDbleClick","sndDbleClick","cancelDbleClick","locked","moved","onFirstDbleClick","move","onMove","DragLock","KeyDownFSM","modifierAccepted","modifiersAccepted","KeyDown","_KeysTypedFSM","keyup","KeysTypedFSM","KeysTyped","KeyTypedFSM","checkKey","pressed","KeyTyped","KeyUpFSM","KeyUp","LongMouseDownFSM","currentButton","down","LongMouseDown","MouseDownFSM","MouseDown","MouseUpFSM","MouseUp","TouchTransition","TouchEvent","TouchDataImpl","allTouches","_allTouches","force","forceData","identifierData","radiusX","radiusXData","radiusY","radiusYData","rotationAngle","rotationAngleData","newT","mergeTouchEventData","currTouch","toPointData","point","SrcTgtTouchDataImpl","TouchDnDFSM","cancellable","dataHandler","movementRequired","touchID","touched","buildFSM","released","touchDown","changedTouches","onTouch","fixTouchDownCheck","onRelease","movedPredicate","document","elementFromPoint","Element","classList","contains","getTouchId","OneTouchDnDFSM","check","TouchDnD","all","setTgtData","ConcurrentAndFSM","fsms","secondaries","totalReinit","_conccurFSMs","_secondaryFSMs","conccurFSMs","getAllConccurFSMs","secondaryFSMs","conccurFSM","visitAndConcurrentFSM","ConcurrentInteraction","subscriptions","conc","_state","flatMap","concFSM","sub","MultiTouchDataBase","reduce","sum","MultiTouchDataImpl","touchesData","values","addTouchData","removeTouchData","id","tdata","get","setTouch","tp","MultiTouchFSM","nbTouch","ids","losts","lost","remainingFSM","MultiTouch","nbTouches","strict","multiData","reinitHandler","currentIDs","forEach","concc","InteractionBuilderImpl","interactionSupplier","iCtor","startPredicate","thenPredicate","endPredicate","interactionName","predicate","firstAndThen","build","hPan","minLength","minVelocity","vPan","leftPan","rightPan","topPan","bottomPan","TwoTouchDataImpl","t1","t2","touch1","touch2","initTouch","copyTouch","RotationTouchDataImpl","computeAngle","atan2","ScaleTouchDataImpl","scalingRatio","t0","tgt1","tgt2","src1","src2","vector1","vector2","lineVector","projection1","project","projectionVector1","projection2","projectionVector2","distance1","distance2","isNaN","point1","point2","TwoPanDataImpl","GeneralTwoTouchDataImpl","rotateData","panData","scaleData","ThreeTouchDataImpl","t3","touch3","FourTouchDataImpl","t4","touch4","XTouchDnD","dataImpl","twoTouch","ThreeTouchDnD","FourTouchDnD","twoHPan","twoVPan","twoLeftPan","twoRightPan","twoTopPan","twoBottomPan","CheckerImpl","cacheIncluded","setLinterRules","rules","rule","getIncludedSeverity","fillCacheIncluded","checkRules","binds","checkSameData","getSameDataSeverity","getSameInteractionSeverity","checkSameInteractions","checkIncluded","checkRule","currBinding","isIncluded","msg","isWidgetSetsIntersecting","printLinterMsg","i1","i2","w1","w2","console","warn","BindingsContext","disposables","cmds","checker","clearObservedBindings","dispos","bindings","commands","tuple","getCmd","getCmdsProducedBy","Redo","history","getLastRedo","redo","Undo","getLastUndo","_BoxCheckPressedTransition","BoxCheckPressedTransition","WidgetDataImpl","BoxCheckedFSM","BoxChecked","_ButtonPressedTransition","ButtonPressedTransition","ButtonPressedFSM","ButtonPressed","_ColorPickedTransition","ColorPickedTransition","ColorPickedFSM","ColorPicked","_ComboBoxTransition","ComboBoxTransition","ComboBoxSelectedFSM","ComboBoxSelected","_DatePickedTransition","DatePickedTransition","DatePickedFSM","DatePicked","DnDFSM","dragged","onPress","onDrag","DnD","_HyperLinkTransition","HyperLinkTransition","HyperLinkClickedFSM","HyperLinkClicked","KeysDownFSM","currentCodes","actionkp","KeysDown","LongTouchFSM","currentTouchID","LongTouch","MouseEnterFSM","withBubbling","entered","MouseEnter","MouseLeaveFSM","exited","MouseLeave","MouseMoveFSM","MouseMove","_ScrollTransition","ScrollTransition","ScrollDataImpl","scrollXData","scrollYData","scrollX","scrollY","setScrollData","ScrollFSM","Scroll","_SpinnerChangedTransition","SpinnerChangedTransition","_SpinnerChangedFSM","changed","SpinnerChangedFSM","SpinnerChanged","TapFSM","downState","up","cancelState","Tap","TapsDataImpl","lastId","TapsFSM","nbTaps","countTaps","Taps","numberTaps","_TextInputChangedTransition","TextInputChangedTransition","TextInputChangedFSM","timeSet","_timeGap","TextInputChanged","TouchStartFSM","TouchStart","rotate","scale","_WheelTransition","WheelEvent","WheelTransition","WheelDataImpl","deltaModeData","deltaXData","deltaYData","deltaZData","deltaX","deltaY","deltaZ","deltaMode","WheelFSM","Wheel","ConcurrentXOrFSM","startedFSM","visitXOrConcurrentFSM","Or","ThenDataImpl","dx","ThenFSM","last","entries","toString","Then","ix","inter","LoggingData","date","sessionID","stack","frontVersion","withstack","withversion","UsageLog","LoggerImpl","version","ongoingBindings","serverAddress","writeConsole","Date","now","random","slice","processLoggingData","rq","XMLHttpRequest","open","setRequestHeader","send","JSON","stringify","formatError","message","performance","cmdName","logs","BindingsImpl","undoHistoryData","nodeBinder","buttonBinder","checkboxBinder","colorPickerBinder","comboBoxBinder","spinnerBinder","dateBinder","hyperlinkBinder","textInputBinder","touchDnDBinder","touchStartBinder","reciprocalTouchDnDBinder","anim","_c","reciprocalMouseOrTouchDnD","multiTouchBinder","twoTouchBinder","threeTouchBinder","fourTouchBinder","tapsBinder","tapsCount","tapBinder","longTouchBinder","panBinder","panVerticalBinder","panHorizontalBinder","panLeftBinder","panRightBinder","panTopBinder","panBottomBinder","twoPanVerticalBinder","twoPanHorizontalBinder","twoPanLeftBinder","twoPanRightBinder","twoPanTopBinder","twoPanBottomBinder","rotateBinder","scaleBinder","clickBinder","dbleClickBinder","mouseUpBinder","mouseDownBinder","longMouseDownBinder","clicksBinder","mouseLeaveBinder","mouseEnterBinder","mouseMoveBinder","wheelBinder","scrollBinder","dndBinder","reciprocalDndBinder","dragLockBinder","keyUpBinder","keyDownBinder","keysDownBinder","keysTypeBinder","keyTypeBinder","mouseDownOrTouchStartBinder","tapsOrClicksBinder","nbTap","tapOrClickBinder","longpressOrTouchBinder","combine","interactions","undoRedoBinder","catchFn","setBindingObserver","visitBindings","UndoableCommand","getUndoName","getVisualSnapshot","equals","undoable","FocusHTMLElement","element","focus","HTMLElement","RedoNTimes","numberOfRedos","getRedo","SetProperty","prop","newvalue","mementoValue","SetProperties","newvalues","compositeCmds","_newvalues","TransferArrayItem","srcArray","tgtArray","srcIndex","tgtIndex","_srcArray","_tgtArray","_srcIndex","_tgtIndex","UndoNTimes","numberOfUndos","getUndo","NotFSM","mainFSM","negFSM","VisitorFSMDepthFirst","visited","alreadyVisited","already","Not","not","mainInteraction","negInteraction","TimedClickFSM","buttonToConsider","setButtonToCheck","evtButton","TimedClick","TimedTapsFSM","TimedTaps","FittsLawDataImpl","t","w","h","d","getID","we","log2","FittsLaw","bSrc","bTgt","providedTarget","_startX","_startY","_target","obsSrc","body","obsTgt","clientWidth","NaN","clientHeight","computeD","a","clientLeft","b","clientTop","ds","mean","sqrt","getAB","effectiveTargetW","xs","ys","sumx","sumy","sumxy","sumxx","sumyy","tmp","tmp2","UndoableTreeNodeImpl","parent","children","cacheVisualSnap","lastChildUndone","visualSnapshot","UndoableTreeNodeDTOImpl","child","toNode","dto","currNodeTree","nodes","TreeUndoHistoryImpl","keepPath","considerEqualCmd","_keepPath","considersEqualCmds","_path","undoableNodes","idCounter","root","_currentNode","undoPublisher","redoPublisher","sizePublisher","equalCmd","currentNode","addToPath","goTo","nodeBranch","goToFromRoot","goFromOneNodeToAnotherOne","undoables","gatherToRoot","path","reverse","pathSrc","pathTo","j","currentUndoable","getPositions","positions","getPositionNode","counter","child0","child1","newCounter","floor","ceil","getLastOrEmptyRedoMessage","getLastRedoMessage","getLastOrEmptyUndoMessage","getLastUndoMessage","undosObservable","redosObservable","roots","import","dtoHistory","currRoot","currNode","max","gotoId","childrenNode","sizeObservable","UndoHistoryImpl","sizeMax","undos","redos","clearRedo","publishSize","shift","lastRedo","pop","getSizeMax","setSizeMax","willRemoved"],"mappings":"+BAkCO,SAASA,EAASC,GACjB,OAAAA,SAGIA,EAAwBC,yBAAyBC,WAC7D,CCIO,SAASC,EAAcC,GAE1B,MAAgB,gBAATA,GAAmC,SAATA,GAA4B,cAATA,GAAiC,WAATA,CAChF,CASO,SAASC,EAAaD,GACzB,MAAgB,eAATA,GAAkC,SAATA,GAA4B,cAATA,GAAiC,WAATA,CAC/E,CASO,SAASE,EAAYF,GACxB,MAAgB,QAATA,GAA2B,cAATA,GAAiC,WAATA,CACrD,CAQO,S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