/*!
 * Copyright 2017 - 2020 by ChartIQ, Inc.
 * All rights reserved.
 */
/**
 * <h2>Deprecated: Drag and Drop Client (Finsemble Workspaces)</h2>
 *
 * The Drag and Drop Client has been DEPRECATED.
 *
 * The Drag and Drop Client acts as an API to share data between components via a user action i.e., drag and drop.
 * As an example, consider a user wanting to share a chart inside a chat - they can do so using the Drag and Drop Service.
 *
 * A component that shares data needs to publish the data types it can share by calling `setEmitters`.
 * The Window Manager automatically adds a draggable share icon to any component that calls `setEmitters`.
 * Similarly, a component that can receive data needs to publish that using `addReceivers`.
 * Since it is possible to have multiple components on a page receiving the data, you can add multiple receivers for the same data `type`.
 *
 * The Drag and Drop Client overlays a scrim on all windows once the user starts dragging a sharable item. The scrim displays which windows can and cannot receive that data.
 * However, this doesn't always work well, especially with complex third party components. You may need to add your own drop zone to the component and use `drop` as the handler.
 *
 * The Drag and Drop Client can also make use of the Linker Client to share data between linked windows using `openSharedData`.
 *
 * For more information, see the [Drag and Drop tutorial](/docs/deprecated/DragAndDropSharing).
 *
 * @deprecated The DragAndDropClient is deprecated
 * @module DragAndDropClient
 */
/** */
import { each as asyncEach } from "async";
import Logger from "../clients/logger";
import linkerClient from "./linkerClient";
import launcherClient from "../clients/launcherClient";
import windowClient from "../clients/windowClient";
import distributedStoreClient from "../clients/distributedStoreClient";
import { FinsembleWindow } from "../common/FinsembleWindow";
import { openSharedData } from "./deprecatedFunctions";
import { System } from "../common/system";
import { Startup } from "../clients/Startup/Startup";
import { RouterClient } from "../clients/routerClient";
/**
 * specifically use `to-string-loader`, prepend `!` to circumvent matching `style-loader` in webpack config
 */
const SCRIM_CSS = `
/**
 * The contents of this file are dynamically injected as a <style> tag
 * within the scrim container element.
 */
:root {
	--accent-primary-1: #36788b;
	--accent-negative: #f26666;
	--scrim-positive-background-color: var(--accent-primary-1);
	--scrim-negative-background-color: var(--accent-negative);
}

.fsbl-share-scrim {
	position: fixed;
	display: flex;
	height: 100%;
	width: 100%;
	z-index: 1000000;
	top: 0;
	left: 0;
	justify-content: center;
	align-content: center;
	flex-direction: column;
	align-items: center;
	transition: all 0.3s ease;
	opacity: 0.85;
	background-color: var(--scrim-positive-background-color);
}

.fsbl-share-scrim .error-message {
	display: flex;
	height: 100%;
	align-content: center;
	justify-content: center;
	align-items: center;
	padding: 1em;
	background-color: var(--scrim-negative-background-color);
}

.fsbl-share-scrim img {
	display: flex;
	height: 10%;
	width: 10%;
	z-index: 1000000;
	top: 0;
	left: 0;
	justify-content: center;
	align-content: center;
	flex-direction: column;
	align-items: center;
}

.fsbl-share-scrim.no {
	background-color: var(--scrim-negative-background-color);
}
`;
const canShareSVG = require("./dragAndDropAssets/ff-share.svg");
const canNotShareSVG = require("./dragAndDropAssets/ff-delete-circle.svg");
const PREPARE_DRAG_CHANNEL = "DragAndDropClient.prepareDrag";
const DRAG_START_CHANNEL = "DragAndDropClient.dragStart";
const DRAG_END_CHANNEL = "DragAndDropClient.dragEnd";
const SHARE_HIGHLIGHT_OPACITY = 1;
const SHARE_METHOD = {
    DROP: "drop",
    SPAWN: "spawn",
    LINKER: "linker",
};
/**
 * @phantom Don't display in Typedoc
 */
export class DragAndDropClient {
    constructor() {
        this.finsembleWindow = null;
        this.windowName = System.Window.getCurrent().name;
        this.emitters = {};
        this.sourceData = [];
        this.receivers = {};
        this.receiveResponder = false;
        this.linkerListener = false;
        /**
         * Default: true
         *
         * Set this to false to disable handling of linked data\
         * @type {boolean}
         */
        this.openLinkerDataByDefault = true;
        /**
         * This constant object contains all the share methods. You can use it in a receive handler to handle different share methods. Current share methods are
         *	* SHARE_METHOD.DROP
         *	* SHARE_METHOD.SPAWN
         *	* SHARE_METHOD.LINKER
         *
         * ```javascript
         * // Ignore data unless it was dropped
         * function shareHandler(err, response) {
         *	if(response.shareMethod != FSBL.Clients.DragAndDropClient.SHARE_METHOD.DROP) {
         *		return;
         * 	}
         *	// Handle dropped data below:
         * }
         * ```
         */
        this.SHARE_METHOD = SHARE_METHOD;
        this.bindAllFunctions();
    }
    bindAllFunctions() {
        const self = this;
        for (const name of Object.getOwnPropertyNames(Object.getPrototypeOf(self))) {
            const method = self[name];
            // skip constructor
            if (!(method instanceof Function) || method === DragAndDropClient)
                continue;
            self[name] = self[name].bind(self);
        }
    }
    /**
     * This sets all the data that can be shared by the component. There can only be one emitter for each data type.
     *
     * ```javascript
     * FSBL.Clients.DragAndDropClient.setEmitters({
     * 	emitters: [
     * 		{
     * 			type: "symbol",
     * 			data: getSymbol
     * 		},
     * 		{
     * 			type: "chartiq.chart",
     * 			data: getChart
     *		}
     * 	]
     * })
     * ```
     * @deprecated The DragAndDropClient is deprecated
     * @param params.emitters This is a list of objects (`{ type: string, data: function }`) which contain a type and a function to get the data.
     * @memberof DragAndDropClient
     */
    setEmitters(params) {
        Logger.deprecated("FSBL.Clients.DragAndDropClient is deprecated and will be removed.");
        if (!Array.isArray(params.emitters)) {
            return;
        }
        const self = this;
        params.emitters.forEach((emitter2) => {
            self.emitters[emitter2.type] = emitter2;
        });
        // Object.assign(this.emitters, params.emitters);
        RouterClient.publish(`${this.windowName}Finsemble.Sharer`, {
            emitterEnabled: !!Object.keys(self.emitters).length,
            receiverEnabled: !!Object.keys(self.receivers).length,
        });
        if (!this.receiveResponder) {
            RouterClient.addResponder(`${this.windowName}.Share`, (err, response) => {
                if (response)
                    self.emit.call(self, err, response);
            });
            this.receiveResponder = true;
        }
    }
    /**
     * @deprecated The DragAndDropClient is deprecated
     *
     * Adds receivers for the data that can be received by the component. There can be any number of receivers for each data type. You can also use regular expressions to specify the data that can be received.
     *
     * ```javascript
     * FSBL.Clients.DragAndDropClient.addReceivers({
     * 	receivers: [
     * 		{
     * 			type: "symbol",
     * 		 	handler: changeSymbol
     * 		}, {
     * 			type: "chartiq.chart",
     * 			handler: openChart
     * 		}
     * ])
     * FSBL.Clients.DragAndDropClient.addReceivers({
     * 	receivers: [
     *		{
     * 			type: &#47;.*&#47;,
     *	 		handler: getEverythingAComponentCanEmit
     * 		}
     * 	]
     * })
     * ```
     * @param params.receivers This is a list of objects (`{ type: string, handler: function }`), each containing a type and a handler function to call with the data once received. The receiver can take a regular expression as its type to provide the ability to receive multiple data types. Each type can have multiple handlers so you can use the same type multiple times in your call.
     * @memberof DragAndDropClient
     */
    addReceivers(params) {
        Logger.deprecated("FSBL.Clients.DragAndDropClient is deprecated and will be removed.");
        if (!Array.isArray(params.receivers)) {
            return;
        }
        const self = this;
        params.receivers.forEach((receiver2) => {
            const type = receiver2.type.toString(); // in case this is a regex
            // Each data type can have multiple receivers
            if (!self.receivers[type]) {
                self.receivers[type] = [receiver2];
            }
            else {
                self.receivers[type].push(receiver2);
            }
        });
        // Send info to windowTitle about receivers
        RouterClient.publish(`${this.windowName}Finsemble.Sharer`, {
            emitterEnabled: !!Object.keys(self.emitters).length,
            receiverEnabled: !!Object.keys(self.receivers).length,
        });
        // Deal with data received if the window is spawned with data. Component state prevents handling the data multiple times
        const spawnData = windowClient.getSpawnData();
        if (spawnData && spawnData.sharedData) {
            windowClient.getComponentState({ field: "Finsemble.DealtWithSpawnSharedData" }, (err, data) => {
                if (!data) {
                    windowClient.setComponentState({ field: "Finsemble.DealtWithSpawnSharedData", value: "done" }, () => {
                        self.handleSharedData(spawnData.sharedData, SHARE_METHOD.SPAWN);
                    });
                }
            });
        }
        // Setup linker for listening to shared data.
        if (!this.linkerListener && this.openLinkerDataByDefault) {
            linkerClient.subscribe("Finsemble.DragAndDropClient", (data, responseDetail) => {
                if (!responseDetail.originatedHere()) {
                    Object.keys(data).forEach((dataType) => {
                        if (self.canReceiveData(dataType)) {
                            const dataToHandle = {};
                            dataToHandle[dataType] = data[dataType];
                            self.handleSharedData(dataToHandle, SHARE_METHOD.LINKER);
                        }
                    });
                }
            });
            this.linkerListener = true;
        }
    }
    /**
     * @deprecated The DragAndDropClient is deprecated
     *
     * updateReceivers updates the handlers for the data that can be received by the component.
     *
     * ```javascript
     * DragAndDropClient.updateReceivers({
     * 	receivers: [
     * 		{
     * 			type: "symbol",
     *			oldHandler: updateSymbol,
     * 		 	handler: changeSymbol
     * 		}, {
     * 			type: "chartiq.chart",
     *			oldHandler: openChart_old,
     * 			handler: openChart_new
     * 		}
     * 	])
     * DragAndDropClient.updateReceivers({
     * 	receivers: [
     *		{
     * 			type: /.*&#47;,
     *	 		oldHandler: getEverythingAComponentCanEmit,
     *			handler: doSomethingWithAllThisData
     * 		}
     * 	])
     * ```
     * @param params.receivers This is a list of objects (`{ type: string, handler: Function, oldHandler: Function }`), each containing a type, the existing handler (oldHandler) and a handler function to replace the old handler with.
     * @private
     * @memberof DragAndDropClient
     */
    updateReceivers(params) {
        if (!Array.isArray(params.receivers)) {
            return;
        }
        const self = this;
        params.receivers.forEach((receiver2) => {
            const type = receiver2.type.toString();
            if (!self.receivers[type]) {
                self.receivers[type] = [];
            }
            const receivers = self.receivers[type];
            for (let i = 0; i < receivers.length; i++) {
                if (receivers[i].handler === receiver2.oldHandler) {
                    receivers[i].handler = receiver2.handler;
                }
            }
            self.receivers[type].push(receiver2.handler);
        });
        if (!self.linkerListener) {
            linkerClient.subscribe("Finsemble.DragAndDropClient", (data, responseDetail) => {
                if (!responseDetail.originatedHere()) {
                    self.handleSharedData(data, SHARE_METHOD.LINKER);
                }
            });
            self.linkerListener = true;
        }
    }
    /**
     * @deprecated The DragAndDropClient is deprecated
     *
     * removeReceivers removes the handlers for the data that can be received by the component.
     *
     * ```javascript
     * DragAndDropClient.removeReceivers({
     * 	receivers: [
     * 		{
     * 			type: "symbol",
     * 		 	handler: changeSymbol
     * 		}, {
     * 			type: "chartiq.chart",
     * 			handler: openChart
     * 		}
     * 	])
     * DragAndDropClient.removeReceivers({
     * 	receivers: [
     *		{
     * 			type: /.*&#47;,
     *	 		oldHandler: getEverythingAComponentCanEmit
     * 		}
     * 	])
     * ```
     * @param params.receivers This is a list of objects, each containing a type and the handler that needs to be removed.
     * @private
     * @memberof DragAndDropClient
     */
    removeReceivers(params) {
        if (!Array.isArray(params.receivers)) {
            return;
        }
        const self = this;
        params.receivers.forEach((receiver2) => {
            const type = receiver2.type.toString();
            if (!self.receivers[type]) {
                return;
            }
            const receivers = self.receivers[type];
            for (let i = 0; i < receivers.length; i++) {
                if (receivers[i].handler === receiver2.handler) {
                    receivers.splice(i, 1);
                    break;
                }
            }
        });
    }
    /**
     * @deprecated The DragAndDropClient is deprecated
     *
     * This is a drag event handler for an element that can be dragged to share data. Our sample Window Title Bar component uses this internally when the share icon is dragged.
     * This can be attached to any element that needs to be draggable. The data from all emitters that match receivers in the drop component is automatically shared.
     *
     * @param event The DragEvent fired from the native browser event.
     * @memberof DragAndDropClient
     */
    dragStart(event) {
        Logger.deprecated("FSBL.Clients.DragAndDropClient is deprecated and will be removed.");
        const data = {
            FSBL: true,
            window: this.windowName,
        };
        // Sends an intermediate event over the router. BrowserView windows will not have access to the emitters from the window where this function call initiates.
        // The intermediate event is will use this data, or get the proper emitters from the view to start the drag.
        RouterClient.transmit(PREPARE_DRAG_CHANNEL, {
            emitters: Object.keys(this.emitters),
            windowName: this.windowName,
        });
        event.dataTransfer.setData("text/plain", JSON.stringify(data));
    }
    /**
     * @deprecated The DragAndDropClient is deprecated
     *
     * This is a drag event handler to enable dragging specific data that is not tied to an emitter. For example, an item in a list.
     *
     * ```javascript
     * element.draggable = true;
     *
     * element.addEventListener('dragstart', function(event) {
     * 		var data = {
     * 			'rsrchx.report': {
     *				url: event.target.href,
     *			}
     * 		};
     * 		FSBL.Clients.DragAndDropClient.dragStartWithData(event, data);
     * })
     * ```
     * @param event The DragEvent fired from the native browser event.
     * @param data The data you wish to be transferred with the event.
     * @memberof DragAndDropClient
     */
    dragStartWithData(event, data) {
        RouterClient.transmit(DRAG_START_CHANNEL, Object.keys(data));
        const dragdata = {
            FSBL: true,
            containsData: true,
            window: this.windowName,
            data,
        };
        event.dataTransfer.setData("text/plain", JSON.stringify(dragdata));
    }
    /**
     * @private
     * @param sharedData
     * @param shareMethod
     */
    handleSharedData(sharedData, shareMethod) {
        const self = this;
        Object.keys(self.receivers).forEach((key) => {
            const receiver2 = self.receivers[key];
            const data = {};
            Object.keys(sharedData).forEach((value) => {
                Logger.system.info("DragAndDropClient:handleSharedData:Data value:", value);
                if (receiver2[0].type instanceof RegExp) {
                    if (value.match(receiver2.type)) {
                        data[value] = sharedData[value];
                    }
                }
                else if (receiver2[0].type == value) {
                    data[value] = sharedData[value];
                }
            });
            if (Object.keys(data).length) {
                receiver2.forEach((r) => {
                    // Each receiver can have multiple entries
                    r.handler(null, { data, shareMethod });
                });
            }
        });
    }
    /**
     * @deprecated The DragAndDropClient is deprecated
     *
     * This is a drop event handler that can be attached to any element that you want to be a drop zone for the Drag and Drop Client. It automatically requests data for all the data elements that are common between the receiver and the emitter.
     * @param event The DragEvent fired from the native browser event.
     * @memberof DragAndDropClient
     */
    drop(event) {
        const self = this;
        if (!event.dataTransfer) {
            event.dataTransfer = event.originalEvent.dataTransfer;
        } // deal with jQuery events not having dataTransfer
        let data = event.dataTransfer.getData("text/plain");
        if (data) {
            try {
                data = JSON.parse(data);
            }
            catch (e) {
                return;
            }
            if (data.FSBL) {
                event.preventDefault();
                event.stopPropagation();
                if (data.containsData) {
                    // the data is embedded into the request
                    self.handleSharedData(data.data, SHARE_METHOD.DROP);
                }
                else {
                    const sourceWindow = data.window;
                    const availableEmitters = this.sourceData;
                    const commonData = [];
                    // var receiverKeys = Object.keys(self.receivers);
                    for (let i = 0; i < availableEmitters.length; i++) {
                        // var addToCommon = false;
                        const emitter2 = availableEmitters[i];
                        if (self.canReceiveData(emitter2)) {
                            commonData.push(emitter2);
                        }
                    }
                    RouterClient.query(`${sourceWindow}.Share`, commonData, (err, response) => {
                        self.handleSharedData(response.data, SHARE_METHOD.DROP);
                    });
                }
            }
        }
    }
    /**
     * @param error
     * @param params This is a list of strands whose data is required
     * @private
     */
    emit(error, params) {
        const values = {};
        const self = this;
        asyncEach(params.data, (index, cb) => {
            const item = self.emitters[index];
            if (item.data && typeof item.data === "function") {
                values[index] = item.data();
                cb();
            }
            else {
                values[index] = item.data;
                cb();
            }
        }, () => {
            params.sendQueryResponse(null, values);
        });
    }
    /**
     * @deprecated The DragAndDropClient is deprecated
     *
     * This gets a list of components that can receive a specific type. It looks in the config for each componentType for an advertiseReceivers property.
     *
     * ```javascript
     * "Advanced Chart": {
     *		...
     * 		"component": {
     * 			"advertiseReceivers": ["chartiq.chart", "symbol"]
     * 		},
     *		...
     * ```
     *
     * ```javascript
     * DragAndDropClient.getComponentsThatCanReceiveType ({ type: "chartiq.chart"}, callback)
     * ```
     * @param cb callback to be invoked with the list of component types
     * @private
     */
    getComponentsThatCanReceiveType(dataType, cb) {
        Logger.deprecated("DragAndDropClient.getComponentsThatCanReceiveType has been deprecated. Use LauncherClient.getComponentsThatCanReceiveDataTypes instead.");
        launcherClient.getComponentsThatCanReceiveDataTypes({ dataTypes: [dataType] }, (err, response) => {
            cb(err, response && response[dataType] ? response[dataType].componentTypes : []);
        });
    }
    /**
     * @deprecated The DragAndDropClient is deprecated
     *
     * This will either open a component with the shared data or publish the shared data using the Linker Client if the window is linked.
     * @param params.data Data to pass to the opened component.
     * @param params.publishOnly if the component is linked, this will only publish the data, not force open a window if it does not exist. If the component is not linked, this is ignored.
     * @param params.multipleOpenerHandler Optional. This function is called with on object that contains a map of componentTypes to the data types they can open. It must return a list of components to be opened. If no handler is provided, the first found component will be chosen. It is possible that the component opened may not handle all the data provided.
     * @param cb Callback invoked with action taken.
     * @memberof DragAndDropClient
     */
    openSharedData(params, cb) {
        openSharedData(params, cb);
    }
    /**
     * @private
     */
    addWindowHighlight(canReceiveData) {
        var _a, _b, _c;
        const isBrowserView = System.isBrowserView();
        const isTitlebarWindow = System.isTitlebarWindow();
        const isTitleBar = !isBrowserView && isTitlebarWindow;
        // Don't add the scrim to the titlebar window (i.e. browser window). In past versions, the scrim was added to the titlebar but
        // incidentally was hidden due to CSS. This newer approach is more reliable.
        if (isTitleBar)
            return;
        const self = this;
        const scrim = document.createElement("div");
        scrim.id = "fsbl-share-scrim";
        scrim.className = "fsbl-share-scrim";
        const style = document.createElement("style");
        style.innerHTML = SCRIM_CSS;
        const icon = document.createElement("img");
        if (canReceiveData) {
            // The SVG_RULE compiles .svg files for use in react. This makes the raw data-url available on the "default" member.
            // However, if .svg is added to the IMAGE_RULE (pre 8.0 webpack configuration) then the module itself will become the data-url string.
            icon.src = (_a = canShareSVG.default) !== null && _a !== void 0 ? _a : canShareSVG;
            icon.className = "ff-share";
            // use capture to make sure this happens
            document.addEventListener("dragover", self.dragover);
            document.addEventListener("drop", self.drop);
        }
        else {
            scrim.className = "fsbl-share-scrim no";
            icon.src = (_b = canNotShareSVG.default) !== null && _b !== void 0 ? _b : canNotShareSVG;
            icon.className = "ff-delete-circle";
        }
        scrim.appendChild(style);
        scrim.appendChild(icon);
        document.body.appendChild(scrim);
        (_c = this.finsembleWindow) === null || _c === void 0 ? void 0 : _c.updateOptions({
            options: {
                opacity: SHARE_HIGHLIGHT_OPACITY,
            },
        });
    }
    /**
     * @private
     */
    removeWindowHighlight() {
        var _a, _b;
        const self = this;
        const scrim = document.getElementById("fsbl-share-scrim");
        if (scrim) {
            (_a = scrim === null || scrim === void 0 ? void 0 : scrim.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(scrim);
        }
        document.removeEventListener("dragover", self.dragover);
        document.removeEventListener("drop", self.drop);
        (_b = this.finsembleWindow) === null || _b === void 0 ? void 0 : _b.updateOptions({
            options: {
                opacity: 1,
            },
        });
    }
    /**
     * @private
     */
    canReceiveData(dataTypeArray, receiverKeys = null) {
        if (!Array.isArray(dataTypeArray)) {
            dataTypeArray = [dataTypeArray];
        }
        const self = this;
        let local = false;
        if (!receiverKeys) {
            receiverKeys = Object.keys(self.receivers);
            local = true;
        }
        for (let i = 0; i < dataTypeArray.length; i++) {
            const emitter2 = dataTypeArray[i];
            for (let j = 0; j < receiverKeys.length; j++) {
                if (!local) {
                    // this is if a string of data types is provided - used in getComponentsThatCanReceiveType
                    if (emitter2 === receiverKeys[j]) {
                        return true;
                    }
                    continue;
                }
                let receiver2 = self.receivers[receiverKeys[j]];
                if (!receiver2.length) {
                    continue;
                }
                else {
                    receiver2 = receiver2[0];
                }
                if (receiver2.type instanceof RegExp) {
                    // Is it a regex?
                    if (emitter2.match(receiver2.type)) {
                        return true;
                    }
                }
                else if (emitter2 === receiver2.type) {
                    return true;
                }
            }
        }
        return false;
    }
    /**
     * @private
     */
    dragover(e) {
        e.preventDefault();
        return false;
    }
    /**
     * @private
     */
    addListeners(cb) {
        const self = this;
        window.addEventListener("dragend", () => {
            RouterClient.transmit(DRAG_END_CHANNEL, {});
        });
        /**
         * An app's content page (the BrowserView section when using the Finsemble titlebar) waits to be told when it
         * should transmit its emitters. It is the act of dragging the share icon from within the titlebar that triggers
         * this action.
         */
        RouterClient.addListener(PREPARE_DRAG_CHANNEL, (err, message) => {
            if (message) {
                const emitterRequest = message.data;
                // The titlebar and content of an app (BrowserWindow and BrowserView) have the same window name. So
                // if the window Name from the request (usually the titlebar, from the icon being dragged) matches
                // the window name of this window (usually the content) then we know that we're the window emitting.
                const myWindowName = Startup.getInstance().currentStartupData.windowName;
                const triggedByMeOrMyTitleBar = emitterRequest.windowName === myWindowName;
                if (triggedByMeOrMyTitleBar) {
                    if (System.isBrowserView()) {
                        RouterClient.transmit(DRAG_START_CHANNEL, Object.keys(this.emitters));
                    }
                    else if (!System.isTitlebarWindow()) {
                        RouterClient.transmit(DRAG_START_CHANNEL, emitterRequest.emitters);
                    }
                }
            }
        });
        RouterClient.addListener(DRAG_START_CHANNEL, (err, message) => {
            if (message) {
                window.addEventListener("dragend", () => {
                    RouterClient.transmit(DRAG_END_CHANNEL, {});
                }, { once: true });
                this.sourceData = message.data;
                if (!self.canReceiveData(this.sourceData) || message.originatedHere()) {
                    self.addWindowHighlight(false);
                }
                else {
                    self.addWindowHighlight(true);
                }
            }
        });
        RouterClient.addListener(DRAG_END_CHANNEL, () => {
            self.removeWindowHighlight();
        });
        cb === null || cb === void 0 ? void 0 : cb();
        distributedStoreClient.createStore({ store: "Finsemble-Share", global: true }, (err, store) => {
            self.store = store;
        });
    }
    /**
     * @private
     * @ignore
     *
     * @param cb
     * @memberof DragAndDropClient
     */
    getFinsembleWindow(cb) {
        FinsembleWindow.getInstance({ name: this.windowName }, (err, response) => {
            this.finsembleWindow = response;
            cb();
        });
    }
}
var dragAndDropClient = new DragAndDropClient();
/**
 * @ignore
 */
export default dragAndDropClient;
//# sourceMappingURL=dragAndDropClient.js.map