text:
/*
Attempting to make the list of views show up in intelisense while maintaining prorotypal inheritance.
Make an object that instantiates an empty function.
Apply logic to the prototypes of the functions that were defined in the Views object
*/

// Make sure any views that are present here and are also intended to be selected by the user
// are also in the Models.uiSelector object.

var Views =
{
    // I think I want this to contain the functionality that allows the user to
    // manipulate the way the data is rendered via clicking and dragging or something like that
    // The idea is to allow a user to choose to render two DataBoundUIContainers side by side or top and bottom.
    // looks like JQuery has this done.
    dataBoundUIContainer: (function (target) {

        function Constructor(target) {
            _init.apply(this, [target, templates.dataBoundUIContainer]);
        }

        // I think I want this to contain the functionality that allows the user to
        // manipulate the way the data is rendered via clicking and dragging or something like that
        // The idea is to allow a user to choose to render two DataBoundUIContainers side by side or top and bottom.
        // looks like JQuery has this done.
        // todo need to add handles on the top, bottom, left, and right
        // that allow the user to resize, move and reposition the container
        Constructor.dataBoundUIContainer.prototype.render = function () {
            console.log("Views.dataBoundUIContainer.prototype.render");
            var that = this;
            that.target.insertAdjacentHTML(constants.InsertHTML.AfterBegin, that.template.render());

            return that.target;
        }

        return {
            getInstance: function (target) {
                return new Constructor(target);
            }
        };

    })(),

    //this will allow the user to select a view and a template for rendering the data,
    uiSelector: (function (target) {

        function Constructor(target) {
            _init.apply(this, [target, templates.uiSelector]);
        }

        var events = {
            //this will allow the user to select a view and a template for rendering the data
            bindDdlSelectUI_SelectedIndexChanged: function (handler) {
                console.log("Views.uiSelector.prototype.bindDdlSelectUI_SelectedIndexChanged");
                var that = this;
                var selector = Helper.GetAttributeSelector("data-id", "ddlSelectUI");

                Helper.$on(that.target.querySelector(selector), 'click', function () {
                    that.renderView(handler(this.value));
                });
            },
            render: function (model) {
                var that = this;
                console.log("uiSelector.prototype.render");
                that.target.insertAdjacentHTML(constants.InsertHTML.AfterBegin, that.template.render(model));

                return that.target;
            },
            renderView: function (html) {
                console.log("Views.uiSelector.prototype.renderView");
                var that = this;
                var selector = Helper.GetAttributeSelector("data-id", "view");

                document.querySelector(selector).innerHTML = html;
            }
        };

        Helper.mix(events, Constructor);

        return {
            getInstance: function (target) {
                return new Constructor(target);
            }
        };
    })(),

    // This will render the data in a format that looks similar to a table,
    // however it uses divs and styles to accomplish this.
    divList: (function (target) {

        function Constructor(target) {
            var that = this;
            //todo maybe implement a selectable attribute
            //that.Selectable = true;
            _init.apply(that, [target, templates.divList]);

            //that.target = document.querySelector(target);
            // todo
            // should be setting the guid of the model before this point
            // that.target.dataset.id = Helper.GenerateGUID();
            //that.render(model);
            // that.renderList({});
            //that._storeReferences(that.target);

        }

        var events = {
            /*
    I insert a new row at the beginning of the list
    @param {object} item I am a list item to insert
    */
            addRow: function (item) {
                console.log("divList.prototype.addRow");
                var that = this;
                var row = that.template.item(item, item.checked);
                var body = that.target.querySelector(constants.divList.ids.body);
                body.insertBefore(row, body[0]);
            },
            bind: function () {
                if (that.deleteButton) {
                    that.deleteButton.style.display = "none";
                }

                that.bindTextBoxDoubleClick();
                that.bindTextAreaDoubleClick();
            },
            /*
            I count the boxes in the list that are checked
            @return {number} I am the number of checked boxes
            */
            countCheckedRows: function () {
                console.log("divList.prototype.countCheckedRows");
                var boxes = this.list.querySelectorAll(constants.divList.ids.rowCheckboxes);
                var count = 0;

                boxes.forEach(function (box) {
                    if (box.checked) {
                        count += 1;
                    }
                });

                return count;
            },
            /*
            I count the number of rows in the list
            @return {number} I am the return value comment template
            */
            countRows: function () {
                console.log("divList.prototype.countRows");
                return this.list.querySelectorAll(constants.divList.selectors.Rows).length;
            },
            /*
            I set the visibility of the Delete button
            @param {boolean} visible
            */
            showDeleteButton: function (visible) {
                console.log("divList.prototype.showDeleteButton");
                var that = this;
                that.target.querySelector(constants.divList.ids.removeSelectedRowsButton).style.display = visible ? 'inline' : 'none';
            },
            /*
            I remove an item from the list
            @param {string} id I am the value of the data-id attribute of the target
            */
            removeRow: function (id) {
                console.log("divList.prototype.removeRow");
                var that = this;
                var target = that.getItemById(id);

                if (target) {
                    that.target.querySelector(constants.divList.ids.body).removeChild(target);
                }
            },
            render: function (model) {
                console.log("divList.prototype.render");
                var that = this;
                that.target.insertAdjacentHTML(constants.InsertHTML.AfterBegin, that.template.render(model));
            },
            /*
            I render the list without refresing the headers.  That way the header events remain intact.
            @param {array} list I am the array of data to be rendered
            @return {number} I am the return value comment template
            */
            renderList: function (model) {
                // todo maybe revisit this and see why i needed that conditional stuff
                console.log("divList.prototype.renderList");
                var that = this;

                var target = that.target.querySelector(constants.divList.ids.body);

                if (target) {
                    target.innerHTML = that.template.body(model).innerHTML;
                }
                else {
                    that.self.appendChild(that.template.body(model));
                }
            },
            /*
            I render the target list item
            @param {string} id I am the value of the data-id attribute of the target
            @param {object} value I am the object to render
            @param {boolean} editable I determine which controls are rendered (textboxes or divs)
            */
            renderRow: function (id, value, editable) {
                console.log("divList.prototype.renderRow");
                var that = this;
                var target = that.getItemById(id);

                if (target) {
                    target.innerHTML = that.template.item(value, editable).innerHTML;
                }
            },
            /*
            I toggle the checkbox for the given id
            @param {string} id I am the value of the data-id attribute of the target
            @param {boolean} checked I indicate the presence of absence of a checked attribute
            */
            toggle: function (id, checked) {
                console.log("divList.prototype.toggle");
                var that = this;
                var listItem = that.getItemById(id);

                if (!listItem) {
                    return;
                }

                // In case it was toggled from an event and not by clicking the checkbox
                listItem.querySelector(constants.divList.ids.ToggleRow).checked = checked;
            },
            /*
            I toggle all of the checkboxes in the list
            @param {boolean} checked I indicate the presence of absence of a checked attribute
            */
            toggleAll: function (checked) {
                console.log("divList.prototype.toggleAll");

                var that = this;

                that.target.querySelector(constants.divList.ids.body)
                    .querySelectorAll(constants.divList.ids.ToggleRow)
                        .forEach(function (item) {
                            that.toggle(that.itemId(item), checked);
                        });
            },
            /*
            I toggle the select all checkbox
            @param {boolean} checked I indicate the presence of absence of a checked attribute
            */
            toggleAllSelector: function (checked) {
                console.log("divList.prototype.toggleAllSelector");
                var that = this;
                that.target.querySelector(constants.divList.ids.selectAll).checked = checked;
            },
            /*
            I toggle the visibility of the help div
            */
            toggleHelp: function () {
                var that = this;
                var visible = that.help.style.display === "inline";
                that.help.style.display = !visible ? 'inline' : 'none';
            },
            /*
            I set the value of the selected item counter
            @param {string} value I am the new count
            */
            updateCount: function (value) {
                console.log("divList.prototype.updateCount");
                var that = this;
                that.target.querySelector(constants.divList.selectors.SelectedItems).textContent = value;
            },
            /*
            I update the UI to show the number of selected items,
            display the delete button when appropriate,
            and update the status of the select all checkbox
            */
            updateUI: function (totals) {
                console.log("divList.prototype.updateUI");
                var that = this;
                var checked = that.countCheckedRows();
                var rows = that.countRows();
                that.updateCount(checked + "/" + rows);
                that.toggleAllSelector(checked === rows);
                that.showDeleteButton(checked > 0);
                that.updateTotals(totals);
            },
            /*
            I update the headers with the sum of the values contained in their columns
            @param {object} totals I am a collection of key value pairs that correspond to the keys in the headers
            */
            updateTotals: function (totals) {
                console.log("divList.prototype.updateTotals");
                var that = this;

                that.target.querySelectorAll(constants.divList.selectors.headers)
                    .forEach(function (header) {
                        // just in case the browser is old, let's offer the getAttribute method
                        var key = header.dataset.id || header.getAttribute("data-id");
                        var val = totals[key] || "";
                        header.textContent = key + " " + val;
                    });
            }
        },
        bindings = {
            /*
            I bind an event to the add button's click event
            @param {function} handler I will run when the button is clicked
            */
            bindAddButtonClick: function (handler) {
                console.log("divList.prototype.bindAddButtonClick");
                var that = this;
                Helper.$on(that.target.querySelector(constants.divList.ids.add), 'click', function () {
                    var addMe = Helper.getKeyValuePairs(that.filter, true);
                    handler(addMe);
                });
            },
            /*
            I bind the click event for checkboxes
            @param {function} handler I will run when the box is clicked,
            using the row's values
            */
            bindRowCheckboxClick: function (handler) {
                console.log("divList.prototype.bindRowCheckboxClick");
                var that = this;

                Helper.$delegate(that.target.querySelector(constants.divList.ids.body), constants.divList.selectors.rowCheckboxes, 'click', function () {
                    var id = that._itemId(this);
                    handler(that._getRowValues(id), this.checked);
                });
            },
            /*
            I bind an event to the edited divs' keyup
            @param {function} handler I will run when the escape key is pressed
            */
            bindRowKeyUp: function (handler) {
                console.log("divList.prototype.bindRowKeyUp");
                var that = this;
                Helper.$delegate(that.target.querySelector(constants.divList.ids.body), constants.divList.selectors.EditedRows, 'keyup', function (event) {
                    if (event.keyCode === KeyCodes.ESCAPE_Store) {
                        console.log("edit escape");
                        this.blur();

                        handler({ id: that._itemId(this) });
                    }
                });
            },
            /*
            I bind an event to the delete button's click event
            @param {function} handler I will run when the button is clicked
            */
            bindRowRemoveButtonClick: function (handler) {
                console.log("divList.prototype.bindRowRemoveButtonClick");
                var that = this;

                Helper.$delegate
                (
                    that.target.querySelector(constants.divList.ids.body),
                    constants.divList.ids.RemoveRow, 'click', function () {
                        handler(that._itemId(this));
                    }
                );
            },
            /*
            I bind an event to each item's delete button's click event
            @param {function} handler I will run when the button is clicked
            */
            bindRemoveSelectedRowsButtonClick: function (handler) {
                console.log("divList.prototype.bindRemoveSelectedRowsButtonClick");
                var that = this;

                Helper.$on
                (
                    that.target.querySelector(constants.divList.ids.RemoveSelectedRow),
                    'click',
                    function () {
                        console.log("deletebutton click");
                        var ids = [];
                        var controls = that.target.querySelector(constants.divList.ids.body)
                            .querySelectorAll(constants.divList.selectors.CheckedRows);

                        controls.forEach(function (thing) {
                            ids.push(
                            {
                                id: that._itemId(thing)
                            });
                        });

                        handler(ids);
                    }
                );
            },
            /*
            I bind a search function to each filter textbox's keyup and change events
            @param {function} handler I will run when the key is released,
            using the values from all of the filter fields
            */
            bindFilterKeyUp: function (handler) {
                console.log("divList.prototype.bindFilterKeyUp");
                var that = this;

                function doSearch() {
                    var query = Helper.getKeyValuePairs(that.filter);
                    handler(query);
                }

                that.filter.forEach(function (item) {
                    Helper.$on(item, 'keyup', doSearch);
                    Helper.$on(item, 'change', doSearch);
                });
            },
            /*
            I bind the click events for the headers
            @param {function} handler I will run when the header is clicked
            */
            bindHeaderClick: function (handler) {
                console.log("divList.prototype.bindHeaderClick");
                var that = this;
                var sorters = that.target.querySelectorAll(constants.divList.ids.headersort);

                sorters.forEach(function (header) {
                    Helper.$on(header, 'click', function () {
                        var self = this;

                        // flip between "asc" and "desc"
                        self.dataset.sort = (self.dataset.sort === constants.divList.SortNone) ? constants.divList.SortAscending
                            : (self.dataset.sort === constants.divList.SortAscending) ? constants.divList.SortDescending
                                : constants.divList.SortAscending;

                        sorters.forEach(function (header) {
                            header.dataset.sort = "none";
                        });

                        // sort should not be "none" by this point
                        var sortDirection = (self.dataset.sort === constants.divList.SortAscending) ? 1 : -1;
                        handler(self.getAttribute("key"), sortDirection);
                    });
                });
            },
            /*
            I bind doubleclick for textareas to redraw them as textboxes
            // todo maybe abstract the templateHelper from this
            */
            bindTextAreaDoubleClick: function () {
                var that = this;

                Helper.$delegate(that.target.querySelector(constants.divList.ids.body), constants.divList.selectors.Textareas, 'dblclick', function () {
                    // todo make a function for this in templates
                    var self = this;
                    var attr =
                    [
                        { "class": self.className },
                        { "type": "text" },
                        { "key": self.getAttribute("key") },
                        { "value": self.value }
                    ];

                    var control = templateHelper.getInput(attr, "text", "");
                    self.outerHTML = control;
                });
            },
            // Bind doubleclick to all input=text to add textmode=multiline and change the dimensions
            /*
            I bind doubleclick for input type = text to redraw them as textareas
            // todo maybe abstract the templateHelper from this
            */
            bindTextBoxDoubleClick: function () {
                var that = this;

                Helper.$delegate(that.target.querySelector(constants.divList.ids.body), constants.divList.selectors.textboxes, 'dblclick', function () {
                    var self = this;
                    var attr =
                    [
                        { "class": self.className },
                        { "type": "text" },
                        { "key": self.getAttribute("key") },
                        { "value": self.value },
                        { "onmouseup": "Helper.TextareaMouseUp(this)" },
                        { "onkeyup": "Helper.TextareaResize(this)" }
                    ];

                    var control = templateHelper.getTextArea(attr);
                    this.outerHTML = control;
                });
            },
            /*
            I bind the click event for the select all checkboxe
            @param {function} handler I will run when the box is clicked,
            using all list items
            */
            bindRowCheckboxClickAll: function (handler) {
                console.log("divList.prototype.bindRowCheckboxClickAll");
                var that = this;
                Helper.$on(that.target.querySelector(constants.divList.ids.selectAll), 'click', function () {
                    console.log("toggleAll click");

                    try {
                        handler(this.checked, that._getAllItems());
                    }
                    catch (e) {
                        console.log(e);
                    }
                });
            },
            /*
            I bind the textboxes' change events
            @param {function} handler I will run when the value is changed, using the row's values
            */
            bindCellChange: function (handler) {
                console.log("divList.prototype.bindCellChange");
                var that = this;

                Helper.$delegate(that.target.querySelector(constants.divList.ids.body), constants.divList.selectors.textboxes, 'change', function () {
                    try {
                        var id = that._itemId(this);
                        console.log("cell " + id + " value changed");
                        handler(that._getRowValues(id));
                    }
                    catch (e) {
                        console.log(e);
                    }
                });
            },
        };

        Helper.mix(events, Constructor);
        Helper.mix(bindings, Constructor);

        /*
        I return every list item
        @return {array} I am an array of objects containing all of the items in the list
        */
        function _getAllItems() {
            console.log("divList.prototype._getAllItems");
            var that = this;
            var rows = that.target.querySelector(constants.divList.ids.body)
                .querySelectorAll("div [data-id]");
            var items = [];

            rows.forEach(function (row) {
                items.push(that._getRowValues(row.dataset.id));
            });

            return items;
        };
        /*
        I get the values for an item
        @param {string} id I am the value that matches the data-id attribute of the target
        @return {object} I am the item's values
        */
        function _getRowValues(id) {
            console.log("divList.prototype._getRowValues");

            var row = this._getItemById(id);
            var elements = row.querySelectorAll(constants.divList.selectors.RowValues);
            var returnMe = {};
            returnMe.id = id;

            elements.forEach(function (element) {
                var text = this._getDisplayedValue(element)
                var key = element.dataset.key;
                returnMe[key] = text;
            });

            return returnMe;
        };
        /**
        * I get the displayed value from an element based on the nodeName
        because for some reason HTML likes to store the displayed value in different places for different types of elements.
        @return {string} I am the value that is displayed to the user via the given element
        */
        function _getDisplayedValue(element) {
            if (element.nodeName === "TEXTAREA") {
                return element.value;
            }
            if (element.nodeName === "INPUT") {
                if (element.type === "text") {
                    return element.value;
                }
                if (element.type === "checkbox") {
                    return element.checked;
                }
            }
            else if ((element.nodeName === "LABEL")
            || (element.nodeName === "DIV")) {
                return element.textContent;
            }
        };
        /*
        I get an element from the list
        @param {string} id I am the value that matches the data-id attribute of the target
        @return {element} I am the list item
        */
        function _getItemById(id) {
            console.log("divList.prototype._getItemById");
            console.log(id);
            return this.list.querySelector("[data-id=\"" + id + "\"]");
        };
        /*
        I recursively search up the heirarchy for a data-id attribute in a div tag
        @param {object} element I am the starting point of the search
        @return {number} I am the data-id attribute of the div containing element
        */
        function _itemId(element) {
            console.log("divList.prototype._itemId");

            var that = this;
            var parent;
            var returnMe;

            if (element) {
                parent = Helper.$parent(element, 'div');
                returnMe = Helper.getId(element);

                if (!returnMe) {
                    if (!!parent) {
                        var parentId = that._itemId(parent);

                        if (!!parentId) {
                            returnMe = parentId;
                        }
                    }
                }
            }
            else {
                console.log("recursive node search reached root");
            }

            console.log("divList.prototype._itemId returning");
            console.log(returnMe);

            return returnMe;
        };
        /*
        I store a reference to all controls in the view that will be referenced
        @param {object} target I am the control that will contain the view
        */
        function _storeReferences(target) {
            this.addButton = target.querySelector(constants.divList.selectors.addRowButton);
            this.count = target.querySelector(constants.divList.selectors.selectedItemCounter);
            this.deleteButton = target.querySelector(constants.divList.ids.RemoveSelectedRow);
            this.filters = target.querySelectorAll(constants.divList.selectors.filters);
            this.headers = target.querySelectorAll(constants.divList.selectors.headers);
            this.list = target.querySelector(constants.divList.ids.body);
            this.sort = target.querySelectorAll(constants.divList.selectors.headersort);
            this.toggleAllCheckbox = target.querySelector(constants.divList.ids.selectAll);
        };

        return {
            getInstance: function (target) {
                return new Constructor(target);
            }
        };
    })(),

    /*
        dataSourceSelector allows the user to select a data source to populate a given UI template,
        shows the IndexedIndexedDB Save and Load buttons,
        the Blob Api Import and Export buttons,
        and the GenerateJSON and ParseJSON buttons
    */
    dataSourceSelector: function (target) {

        /**/
        _init = function (target) {
            console.log("Views.dataSourceSelector.prototype._init");
            this.Selectable = true;
            _init.apply(this, [target, templates.dataSourceSelector]);
        }
        /*
        I store a reference to all controls in the view that will be referenced
        */
        _storeReferences = function () {
            console.log("Views.dataSourceSelector.prototype._storeReferences");
            console.log("target", this.target);
            var that = this;
            var dataId = "data-id";

            that.exportButton = that.target.querySelector(Helper.GetAttributeSelector(dataId, constants.dataSourceSelector.ids.Export));
            that.fileSelector = that.target.querySelector(Helper.GetAttributeSelector(dataId, constants.dataSourceSelector.ids.File));
            that.importButton = that.target.querySelector(Helper.GetAttributeSelector(dataId, constants.dataSourceSelector.ids.Import));
            that.loadButton = that.target.querySelector(Helper.GetAttributeSelector(dataId, constants.dataSourceSelector.ids.Load));
            that.saveButton = that.target.querySelector(Helper.GetAttributeSelector(dataId, constants.dataSourceSelector.ids.Save));
            that.storeName = that.target.querySelector(Helper.GetAttributeSelector(dataId, constants.dataSourceSelector.ids.StoreName));
            that.parseJSONButton = that.target.querySelector(Helper.GetAttributeSelector(dataId, constants.dataSourceSelector.ids.ParseJson));
            that.generateJSONButton = that.target.querySelector(Helper.GetAttributeSelector(dataId, constants.dataSourceSelector.ids.GenerateJson));
            that.txtJSON = that.target.querySelector(Helper.GetAttributeSelector(dataId, constants.dataSourceSelector.ids.Json));

            console.log("exportButton", that.exportButton);
        }

        var events = {
            render: function (model) {
                console.log("Views.dataSourceSelector.prototype.render");
                var that = this;
                var html = this.template.render(model);

                that.target.insertAdjacentHTML(constants.InsertHTML.AfterBegin, html);

                //return that.target;
            },
            /*
            I check for blob support and update the UI accordingly
            */
            checkFileSupport: function (isSupported) {
                console.log("Views.dataSourceSelector.prototype.checkFileSupport");
                var that = this;

                if (!isSupported) {
                    console.log("no blob support");

                    that.exportButton.setAttribute("style", "display: none");
                    that.fileSelector.setAttribute("style", "display: none");
                    that.importButton.setAttribute("style", "display: none");
                }
            },
            /*
            I check for indexedDB support and update the UI accordingly
            */
            checkDbSupport: function (isSupported) {
                console.log("Views.dataSourceSelector.prototype.checkDbSupport");
                var that = this;
                if (!isSupported) {
                    console.log("no indexed db support");

                    that.loadButton.setAttribute("style", "display: none");
                    that.saveButton.setAttribute("style", "display: none");
                    that.storeName.setAttribute("style", "display: none");
                }
            },
            /*
            I display the given value in the json textbox
            @param {string} value I am a string value that goes into the textbox
            */
            showJSON: function (value) {
                console.log("dataSourceSelector.prototype.showJSON");
                var that = this;
                that.target.querySelector(constants.dataSourceSelector.ids.Json).value = value;
            }
        },
        bindings = {
            /*
            I bind an event to the Import button click
            @param {function} handler I am the logic that will go in the click event
            */
            bindImport: function (handler) {
                console.log("dataSourceSelector.prototype.bindImport");
                var that = this;
                Helper.$on(that.target.querySelector(constants.dataSourceSelector.ids.Import), 'click', function () {
                    var name = that.target.querySelector(constants.dataSourceSelector.ids.File).files;
                    handler(name);
                });
            },
            /*
            I bind an event to the Export button click
            @param {function} handler I am the logic that will go in the click event
            */
            bindExport: function (handler) {
                console.log("dataSourceSelector.prototype.bindExport");
                var that = this;
                Helper.$on(that.target.querySelector(constants.dataSourceSelector.ids.Export), 'click', function () {
                    var name = that.target.querySelector(constants.dataSourceSelector.ids.File).textContent
                    || that.target.querySelector(constants.dataSourceSelector.ids.File).value;
                    handler(name);
                });
            },
            /*
            I bind an event to the Load button click
            @param {function} handler I am the logic that will go in the click event
            */
            bindLoad: function (handler) {
                console.log("dataSourceSelector.prototype.bindLoad");
                var that = this;

                Helper.$on
                (
                that.target.querySelector(constants.dataSourceSelector.ids.Load),
                'click',
                function () {
                    var name = that.target.querySelector(constants.dataSourceSelector.ids.Name).textContent
                    || that.target.querySelector(constants.dataSourceSelector.ids.Name).value;
                    handler(name);
                }
                );
            },
            /*
            I bind an event to the Save button click
            @param {function} handler I am the logic that will go in the click event
            */
            bindSave: function (handler) {
                console.log("dataSourceSelector.prototype.bindLoad");
                var that = this;

                Helper.$on
                (
                that.target.querySelector(constants.dataSourceSelector.ids.Save),
                'click',
                function () {
                    var name = that.target.querySelector(constants.dataSourceSelector.ids.Name).textContent
                    || that.target.querySelector(constants.dataSourceSelector.ids.Name).value;
                    handler(name);
                }
                );
            },
            /*
            I bind an event to the File Select control
            @param {function} handler I am the logic that will go in the change event
            */
            bindSelectFile: function (handler) {
                console.log("dataSourceSelector.prototype.bindSelectFile");
                var that = this;

                Helper.$on
                (
                that.target.querySelector(constants.dataSourceSelector.ids.File),
                'change',
                function () {
                    handler();
                }
                );
            },
            /*
            I bind an event to the GenerateJson button
            @param {function} handler I am the logic that will go in the click event
            */
            bindGenerateJSON: function (handler) {
                console.log("dataSourceSelector.prototype.bindGenerateJSON");
                var that = this;
                Helper.$on
                (
                that.target.querySelector(constants.dataSourceSelector.ids.GenerateJson),
                'click',
                function () {
                    console.log("Generate JSON click");
                    handler();
                }
                );
            },
            /*
            I bind an event to the ParseJson button
            @param {function} handler I am the logic that will go in the click event
            */
            bindParseJSON: function (handler) {
                console.log("dataSourceSelector.prototype.bindParseJSON");
                var that = this;
                Helper.$on
                (
                    that.target.querySelector(constants.dataSourceSelector.ids.ParseJson),
                    'click',
                    function () {
                        console.log("Parse JSON click");
                        handler(that.target.querySelector(constants.dataSourceSelector.ids.Json).value);
                    }
                );
            }
        };

        Helper.mix(events, Constructor);
        Helper.mix(bindings, Constructor);

        return {
            getInstance: function (target) {
                return new Constructor(target);
            }
        };
    },
    /**/

    Help: function (target) {

        /*
        I am a constructor
        target points to the HTMLElement that will contain the Help View
        */
        //function Help(target)
        //{
        //    this.init(target);
        //}
        /*
        I set the view up before use
        @param {object} target I point to the control that will contain the view
        */
        Views.Help.prototype._init = function (target) {
            console.log("Views.Help.prototype._init");
            var that = this;

            //that.Selectable = true;
            _init.apply(this, [target, templates.Help]);
        };

        /**/
        Views.Help.prototype.render = function () {
            console.log("Views.Help.prototype.render");
            var that = this;

            that.target.insertAdjacentHTML(constants.InsertHTML.AfterBegin, that.template.render);
            //that._storeReferences(target);
            this.help.style.display = "none";
        };

        this._init(target);
        return this;
    }
};

/*
I store a reference to all controls in the view that will be referenced
@param {object} target I am the control that will contain the view
*/
//HelpView.prototype._storeReferences = function (target)
//{
//    this.self = target;
//    this.helpToggle = self.querySelector(constants.Help.selectors.Toggle);
//    this.help = self.querySelector(constants.Help.selectors.Narrative);
//}
/*
I bind an event to the show help link
@param {function} handler I am the logic that will go in the click event
*/
//HelpView.prototype.bindToggleHelp = function (handler)
//{
//    console.log("HelpView.prototype.bindToggleHelp");
//    var that = this;
//    Helper.$on
//    (
//        target.querySelector(constants.Help.selectors.Toggle)
//        , 'click'
//        , function ()
//        {
//            console.log("toggleHelp click");
//            handler();
//        }
//    );
//};

/*
    Assigns a template for rendering and a target in which to render
    @param {object} target can be a string selector or a HTMLElement object
    @param {object} template should contain render()
*/
function _init(target, template) {
    console.log("_init");
    var that = this;

    _setTemplate.apply(that, [template]);
    _setTarget.apply(that, [target]);

    return that.target;
}

/**/
function _setTemplate(template) {
    console.log("_setTemplate");
    var that = this;

    that.template = template;
}

/**/
function _setTarget(target) {
    console.log("_setTarget");
    var that = this;

    if (typeof target === 'string') {
        that.target = document.querySelector(target);
    }
    else if (typeof target === 'object') {
        that.target = target;
    }

    if (!that.target) {
        var insertMe = document.createElement("div");
        document.body.insertAdjacentHTML(constants.InsertHTML.BeforeEnd, insertMe);
        that.target = insertMe;
    }
}


text:
/**
 */
package substationStandard.Dataclasses;

import org.eclipse.emf.ecore.EObject;

/**
 *
 * A representation of the model object 'Detail Qual'.
 *
 *
 *

 * The following features are supported:
 *

 *

 *
{@link substationStandard.Dataclasses.DetailQual#isOverflow Overflow}

 *
{@link substationStandard.Dataclasses.DetailQual#isOutOfRange Out Of Range}

 *
{@link substationStandard.Dataclasses.DetailQual#isBadReference Bad Reference}

 *
{@link substationStandard.Dataclasses.DetailQual#isOscillatory Oscillatory}

 *
{@link substationStandard.Dataclasses.DetailQual#isFailure Failure}

 *
{@link substationStandard.Dataclasses.DetailQual#isOldData Old Data}

 *
{@link substationStandard.Dataclasses.DetailQual#isInconsistent Inconsistent}

 *
{@link substationStandard.Dataclasses.DetailQual#isInaccurate Inaccurate}

 *

 *
 * @see substationStandard.Dataclasses.DataclassesPackage#getDetailQual()
 * @model
 * @generated
 */
public interface DetailQual extends EObject {
	/**
	 * Returns the value of the 'Overflow' attribute.
	 *
	 *

	 * If the meaning of the 'Overflow' attribute isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Overflow' attribute.
	 * @see #setOverflow(boolean)
	 * @see substationStandard.Dataclasses.DataclassesPackage#getDetailQual_Overflow()
	 * @model
	 * @generated
	 */
	boolean isOverflow();

	/**
	 * Sets the value of the '{@link substationStandard.Dataclasses.DetailQual#isOverflow Overflow}' attribute.
	 *
	 *
	 * @param value the new value of the 'Overflow' attribute.
	 * @see #isOverflow()
	 * @generated
	 */
	void setOverflow(boolean value);

	/**
	 * Returns the value of the 'Out Of Range' attribute.
	 *
	 *

	 * If the meaning of the 'Out Of Range' attribute isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Out Of Range' attribute.
	 * @see #setOutOfRange(boolean)
	 * @see substationStandard.Dataclasses.DataclassesPackage#getDetailQual_OutOfRange()
	 * @model
	 * @generated
	 */
	boolean isOutOfRange();

	/**
	 * Sets the value of the '{@link substationStandard.Dataclasses.DetailQual#isOutOfRange Out Of Range}' attribute.
	 *
	 *
	 * @param value the new value of the 'Out Of Range' attribute.
	 * @see #isOutOfRange()
	 * @generated
	 */
	void setOutOfRange(boolean value);

	/**
	 * Returns the value of the 'Bad Reference' attribute.
	 *
	 *

	 * If the meaning of the 'Bad Reference' attribute isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Bad Reference' attribute.
	 * @see #setBadReference(boolean)
	 * @see substationStandard.Dataclasses.DataclassesPackage#getDetailQual_BadReference()
	 * @model
	 * @generated
	 */
	boolean isBadReference();

	/**
	 * Sets the value of the '{@link substationStandard.Dataclasses.DetailQual#isBadReference Bad Reference}' attribute.
	 *
	 *
	 * @param value the new value of the 'Bad Reference' attribute.
	 * @see #isBadReference()
	 * @generated
	 */
	void setBadReference(boolean value);

	/**
	 * Returns the value of the 'Oscillatory' attribute.
	 *
	 *

	 * If the meaning of the 'Oscillatory' attribute isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Oscillatory' attribute.
	 * @see #setOscillatory(boolean)
	 * @see substationStandard.Dataclasses.DataclassesPackage#getDetailQual_Oscillatory()
	 * @model
	 * @generated
	 */
	boolean isOscillatory();

	/**
	 * Sets the value of the '{@link substationStandard.Dataclasses.DetailQual#isOscillatory Oscillatory}' attribute.
	 *
	 *
	 * @param value the new value of the 'Oscillatory' attribute.
	 * @see #isOscillatory()
	 * @generated
	 */
	void setOscillatory(boolean value);

	/**
	 * Returns the value of the 'Failure' attribute.
	 *
	 *

	 * If the meaning of the 'Failure' attribute isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Failure' attribute.
	 * @see #setFailure(boolean)
	 * @see substationStandard.Dataclasses.DataclassesPackage#getDetailQual_Failure()
	 * @model
	 * @generated
	 */
	boolean isFailure();

	/**
	 * Sets the value of the '{@link substationStandard.Dataclasses.DetailQual#isFailure Failure}' attribute.
	 *
	 *
	 * @param value the new value of the 'Failure' attribute.
	 * @see #isFailure()
	 * @generated
	 */
	void setFailure(boolean value);

	/**
	 * Returns the value of the 'Old Data' attribute.
	 *
	 *

	 * If the meaning of the 'Old Data' attribute isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Old Data' attribute.
	 * @see #setOldData(boolean)
	 * @see substationStandard.Dataclasses.DataclassesPackage#getDetailQual_OldData()
	 * @model
	 * @generated
	 */
	boolean isOldData();

	/**
	 * Sets the value of the '{@link substationStandard.Dataclasses.DetailQual#isOldData Old Data}' attribute.
	 *
	 *
	 * @param value the new value of the 'Old Data' attribute.
	 * @see #isOldData()
	 * @generated
	 */
	void setOldData(boolean value);

	/**
	 * Returns the value of the 'Inconsistent' attribute.
	 *
	 *

	 * If the meaning of the 'Inconsistent' attribute isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Inconsistent' attribute.
	 * @see #setInconsistent(boolean)
	 * @see substationStandard.Dataclasses.DataclassesPackage#getDetailQual_Inconsistent()
	 * @model
	 * @generated
	 */
	boolean isInconsistent();

	/**
	 * Sets the value of the '{@link substationStandard.Dataclasses.DetailQual#isInconsistent Inconsistent}' attribute.
	 *
	 *
	 * @param value the new value of the 'Inconsistent' attribute.
	 * @see #isInconsistent()
	 * @generated
	 */
	void setInconsistent(boolean value);

	/**
	 * Returns the value of the 'Inaccurate' attribute.
	 *
	 *

	 * If the meaning of the 'Inaccurate' attribute isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Inaccurate' attribute.
	 * @see #setInaccurate(boolean)
	 * @see substationStandard.Dataclasses.DataclassesPackage#getDetailQual_Inaccurate()
	 * @model
	 * @generated
	 */
	boolean isInaccurate();

	/**
	 * Sets the value of the '{@link substationStandard.Dataclasses.DetailQual#isInaccurate Inaccurate}' attribute.
	 *
	 *
	 * @param value the new value of the 'Inaccurate' attribute.
	 * @see #isInaccurate()
	 * @generated
	 */
	void setInaccurate(boolean value);

} // DetailQual

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Acme\TwigDemoBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class AcmeTwigDemoBundle extends Bundle
{
}


text:
package org.apache.druid.utils;

import com.google.inject.Inject;

import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;

public class JvmUtils
{
  @Inject
  private static RuntimeInfo runtimeInfo = new RuntimeInfo();

  public static RuntimeInfo getRuntimeInfo()
  {
    return runtimeInfo;
  }

  private static final ThreadMXBean THREAD_MX_BEAN = ManagementFactory.getThreadMXBean();

  public static boolean isThreadCpuTimeEnabled()
  {
    return THREAD_MX_BEAN.isThreadCpuTimeSupported() && THREAD_MX_BEAN.isThreadCpuTimeEnabled();
  }

  public static long safeGetThreadCpuTime()
  {
    if (!isThreadCpuTimeEnabled()) {
      return 0L;
    } else {
      return getCurrentThreadCpuTime();
    }
  }

  /**
   * Returns the total CPU time for current thread.
   * This method should be called after verifying that cpu time measurement for current thread is supported by JVM
   *
   * @return total CPU time for the current thread in nanoseconds.
   *
   * @throws UnsupportedOperationException if the Java virtual machine does not support CPU time measurement for
   * the current thread.
   */
  public static long getCurrentThreadCpuTime()
  {
    return THREAD_MX_BEAN.getCurrentThreadCpuTime();
  }
}


text:
from module import (foo, bar)
from module import (foo, bar, )
from module import (
    foo, bar, baz, quux
)
from module import (
    foo,
    bar
)
from module import (
    foo,
    bar,
)
from module import (
    foo,
    bar
)


text:
#ifndef SkPictureImageFilter_DEFINED
#define SkPictureImageFilter_DEFINED

#include "SkImageFilter.h"
#include "SkPicture.h"

class SK_API SkPictureImageFilter : public SkImageFilter {
public:
    /**
     *  Refs the passed-in picture.
     */
    explicit SkPictureImageFilter(SkPicture* picture);

    /**
     *  Refs the passed-in picture. rect can be used to crop or expand the destination rect when
     *  the picture is drawn. (No scaling is implied by the dest rect; only the CTM is applied.)
     */
    SkPictureImageFilter(SkPicture* picture, const SkRect& rect);

    SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureImageFilter)

protected:
    virtual ~SkPictureImageFilter();
    explicit SkPictureImageFilter(SkFlattenableReadBuffer& buffer);
    virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
                               SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;

private:
    SkPicture* fPicture;
    SkRect     fRect;
    typedef SkImageFilter INHERITED;
};

#endif


text:
package com.feedback.resources;

import com.feedback.entities.api.ErrorEntity;

import javax.ws.rs.core.Response;

/**
 * Created by Samarth Bhargav on 8/7/15.
 */
public class ResourceUtil
{
    public static final Response buildErrorEntity( String message, Response.Status status )
    {
        return Response.status( status ).entity( new ErrorEntity( message, status.getStatusCode() ) ).build();
    }

}


text:
package com.btcgarden.bitcoin.jsonrpcclient;

import java.util.Date;
import java.util.Map;

class MapWrapper {

    public final Map m;

    public MapWrapper(Map m) {
        this.m = m;
    }

    public boolean mapBool(String key) {
        return mapBool(m, key);
    }

    public float mapFloat(String key) {
        return mapFloat(m, key);
    }

    public double mapDouble(String key) {
        return mapDouble(m, key);
    }

    public int mapInt(String key) {
        return mapInt(m, key);
    }

    public long mapLong(String key) {
        return mapLong(m, key);
    }

    public String mapStr(String key) {
        return mapStr(m, key);
    }

    public Date mapCTime(String key) {
        return mapCTime(m, key);
    }

    public static boolean mapBool(Map m, String key) {
        return ((Boolean)m.get(key)).booleanValue();
    }

    public static float mapFloat(Map m, String key) {
        return ((Number)m.get(key)).floatValue();
    }

    public static double mapDouble(Map m, String key) {
        return ((Number)m.get(key)).doubleValue();
    }

    public static int mapInt(Map m, String key) {
        return ((Number)m.get(key)).intValue();
    }

    public static long mapLong(Map m, String key) {
        return ((Number)m.get(key)).longValue();
    }

    public static String mapStr(Map m, String key) {
        Object v = m.get(key);
        return v == null ? null : String.valueOf(v);
    }

    public static Date mapCTime(Map m, String key) {
        Object v = m.get(key);
        return v == null ? null : new Date(mapLong(m, key) * 1000);
    }

}


text:
package com.facebook.buck.rules.query;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;

import com.facebook.buck.android.AndroidLibraryBuilder;
import com.facebook.buck.jvm.java.JavaBinaryRuleBuilder;
import com.facebook.buck.jvm.java.JavaLibraryBuilder;
import com.facebook.buck.model.BuildTarget;
import com.facebook.buck.model.BuildTargetFactory;
import com.facebook.buck.parser.BuildTargetPatternParser;
import com.facebook.buck.query.QueryBuildTarget;
import com.facebook.buck.query.QueryException;
import com.facebook.buck.query.QueryExpression;
import com.facebook.buck.rules.BuildRuleResolver;
import com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer;
import com.facebook.buck.rules.TargetGraph;
import com.facebook.buck.rules.TargetNode;
import com.facebook.buck.rules.TestCellPathResolver;
import com.facebook.buck.testutil.FakeProjectFilesystem;
import com.facebook.buck.testutil.TargetGraphFactory;
import com.google.common.collect.ImmutableSet;
import java.util.Optional;
import java.util.concurrent.ExecutionException;
import org.hamcrest.Matchers;
import org.junit.Test;

public class QueryCacheTest {

  @Test
  public void cacheQueryResults() throws ExecutionException, QueryException {
    Query q1 = Query.of("deps(:a) union deps(:c) except (deps(:a) intersect classpath(deps(:f)))");
    Query q2 = Query.of("deps(:a) ^ classpath(deps(:f))");
    Query q3 = Query.of("kind(binary, deps(:a))");
    Query q4 = Query.of("attrfilter(deps, :e, set(:b :c :f :g))");
    Query q5 = Query.of("kind(library, deps(:a) + deps(:c))");
    Query q6 = Query.of("deps(:c)");

    BuildTarget foo = BuildTargetFactory.newInstance("//:foo");
    BuildTarget bar = BuildTargetFactory.newInstance("//:bar");
    BuildTarget baz = BuildTargetFactory.newInstance("//:baz");

    BuildTarget targetA = BuildTargetFactory.newInstance("//app:a");
    BuildTarget targetB = BuildTargetFactory.newInstance("//app:b");
    BuildTarget targetC = BuildTargetFactory.newInstance("//app:c");
    BuildTarget targetD = BuildTargetFactory.newInstance("//app:d");
    BuildTarget targetE = BuildTargetFactory.newInstance("//app:e");
    BuildTarget targetF = BuildTargetFactory.newInstance("//app:f");
    BuildTarget targetG = BuildTargetFactory.newInstance("//app:g");
    BuildTarget targetH = BuildTargetFactory.newInstance("//app:h");

    /*
     *   a       f
     *  / \     / \
     * b   c   g   h
     *  \ / \ /
     *   d   e
     */
    TargetGraph targetGraph =
        TargetGraphFactory.newInstance(
            AndroidLibraryBuilder.createBuilder(foo)
                .setDepsQuery(q1)
                .setProvidedDepsQuery(q2)
                .build(),
            AndroidLibraryBuilder.createBuilder(bar)
                .setDepsQuery(q3)
                .setProvidedDepsQuery(q4)
                .build(),
            AndroidLibraryBuilder.createBuilder(baz)
                .setDepsQuery(q5)
                .setProvidedDepsQuery(q6)
                .build(),
            JavaLibraryBuilder.createBuilder(targetA).addDep(targetB).addDep(targetC).build(),
            JavaLibraryBuilder.createBuilder(targetB).addDep(targetD).build(),
            JavaLibraryBuilder.createBuilder(targetC).addDep(targetD).addDep(targetE).build(),
            new JavaBinaryRuleBuilder(targetD).build(),
            new JavaBinaryRuleBuilder(targetE).build(),
            JavaLibraryBuilder.createBuilder(targetF).addDep(targetG).addDep(targetH).build(),
            JavaLibraryBuilder.createBuilder(targetG).addDep(targetE).build(),
            JavaLibraryBuilder.createBuilder(targetH).build());

    BuildRuleResolver resolver =
        new BuildRuleResolver(targetGraph, new DefaultTargetNodeToBuildRuleTransformer());

    GraphEnhancementQueryEnvironment env =
        new GraphEnhancementQueryEnvironment(
            Optional.of(resolver),
            Optional.of(targetGraph),
            TestCellPathResolver.get(new FakeProjectFilesystem()),
            BuildTargetPatternParser.forBaseName(targetA.getBaseName()),
            ImmutableSet.of());

    QueryCache cache = new QueryCache();

    assertFalse(cache.isPresent(targetGraph, env, q1));
    assertFalse(cache.isPresent(targetGraph, env, q2));
    assertFalse(cache.isPresent(targetGraph, env, q3));
    assertFalse(cache.isPresent(targetGraph, env, q4));
    assertFalse(cache.isPresent(targetGraph, env, q5));
    assertFalse(cache.isPresent(targetGraph, env, q6));

    assertThat(
        cache.getQueryEvaluator(targetGraph).eval(QueryExpression.parse(q1.getQuery(), env), env),
        Matchers.containsInAnyOrder(
            QueryBuildTarget.of(targetA),
            QueryBuildTarget.of(targetB),
            QueryBuildTarget.of(targetC),
            QueryBuildTarget.of(targetD)));

    assertTrue(cache.isPresent(targetGraph, env, q1));
    assertTrue(cache.isPresent(targetGraph, env, q2));
    assertFalse(cache.isPresent(targetGraph, env, q3));
    assertFalse(cache.isPresent(targetGraph, env, q4));
    assertFalse(cache.isPresent(targetGraph, env, q5));
    assertTrue(cache.isPresent(targetGraph, env, q6));
  }

  @Test
  public void dynamicDeps() throws ExecutionException, QueryException {
    Query declared = Query.of("$declared_deps");

    BuildTarget fooTarget = BuildTargetFactory.newInstance("//:foo");
    BuildTarget barTarget = BuildTargetFactory.newInstance("//:bar");

    BuildTarget targetA = BuildTargetFactory.newInstance("//app:a");
    BuildTarget targetB = BuildTargetFactory.newInstance("//app:b");

    TargetNode<?, ?> foo =
        AndroidLibraryBuilder.createBuilder(fooTarget)
            .addDep(targetA)
            .setDepsQuery(declared)
            .build();
    TargetNode<?, ?> bar =
        AndroidLibraryBuilder.createBuilder(barTarget)
            .addDep(targetB)
            .setDepsQuery(declared)
            .build();

    TargetGraph targetGraph =
        TargetGraphFactory.newInstance(
            foo,
            bar,
            JavaLibraryBuilder.createBuilder(targetA).build(),
            JavaLibraryBuilder.createBuilder(targetB).build());

    BuildRuleResolver resolver =
        new BuildRuleResolver(targetGraph, new DefaultTargetNodeToBuildRuleTransformer());

    GraphEnhancementQueryEnvironment fooEnv =
        new GraphEnhancementQueryEnvironment(
            Optional.of(resolver),
            Optional.of(targetGraph),
            TestCellPathResolver.get(new FakeProjectFilesystem()),
            BuildTargetPatternParser.forBaseName(fooTarget.getBaseName()),
            foo.getDeclaredDeps());

    GraphEnhancementQueryEnvironment barEnv =
        new GraphEnhancementQueryEnvironment(
            Optional.of(resolver),
            Optional.of(targetGraph),
            TestCellPathResolver.get(new FakeProjectFilesystem()),
            BuildTargetPatternParser.forBaseName(barTarget.getBaseName()),
            bar.getDeclaredDeps());

    QueryCache cache = new QueryCache();

    assertFalse(cache.isPresent(targetGraph, fooEnv, declared));
    assertFalse(cache.isPresent(targetGraph, barEnv, declared));

    assertThat(
        cache
            .getQueryEvaluator(targetGraph)
            .eval(QueryExpression.parse(declared.getQuery(), fooEnv), fooEnv),
        Matchers.contains(QueryBuildTarget.of(targetA)));

    assertTrue(cache.isPresent(targetGraph, fooEnv, declared));
    assertFalse(cache.isPresent(targetGraph, barEnv, declared));

    assertThat(
        cache
            .getQueryEvaluator(targetGraph)
            .eval(QueryExpression.parse(declared.getQuery(), barEnv), barEnv),
        Matchers.contains(QueryBuildTarget.of(targetB)));

    assertTrue(cache.isPresent(targetGraph, fooEnv, declared));
    assertTrue(cache.isPresent(targetGraph, barEnv, declared));
  }
}


text:
import TYPE from './type';
import SelectorBuilder from '../../client-functions/selectors/selector-builder';
import ClientFunctionBuilder from '../../client-functions/client-function-builder';
import functionBuilderSymbol from '../../client-functions/builder-symbol';
import { ActionCommandBase, CommandBase } from './base';
import {
    ActionOptions,
    ClickOptions,
    MouseOptions,
    TypeOptions,
    PressOptions,
    DragToElementOptions,
    OffsetOptions,
    CookieOptions,
    GetProxyUrlOptions,
    RequestOptions,
    SkipJsErrorsOptions,
    SkipJsErrorsCallbackWithOptions,
} from './options';

import {
    initSelector,
    initTypeSelector,
    initUploadSelector,
} from './validations/initializers';
import { executeJsExpression } from '../execute-js-expression';
import { isJSExpression } from './utils';

import {
    actionOptions,
    integerArgument,
    positiveIntegerArgument,
    stringArgument,
    nonEmptyStringArgument,
    nullableStringArgument,
    pageUrlArgument,
    stringOrStringArrayArgument,
    setSpeedArgument,
    actionRoleArgument,
    booleanArgument,
    functionArgument,
    cookiesArgument,
    setCookiesArgument,
    urlsArgument,
    urlArgument,
    skipJsErrorOptions,
} from './validations/argument';

import { SetNativeDialogHandlerCodeWrongTypeError } from '../../errors/test-run';
import { ExecuteClientFunctionCommand } from './observation';
import { camelCase } from 'lodash';
import {
    prepareSkipJsErrorsOptions,
    isSkipJsErrorsOptionsObject,
    isSkipJsErrorsCallbackWithOptionsObject,
} from '../../api/skip-js-errors';

// Initializers
function initActionOptions (name, val, initOptions, validate = true) {
    return new ActionOptions(val, validate);
}

function initClickOptions (name, val, initOptions, validate = true) {
    return new ClickOptions(val, validate);
}

function initMouseOptions (name, val, initOptions, validate = true) {
    return new MouseOptions(val, validate);
}

function initOffsetOptions (name, val, initOptions, validate = true) {
    return new OffsetOptions(val, validate);
}

function initTypeOptions (name, val, initOptions, validate = true) {
    return new TypeOptions(val, validate);
}

function initDragToElementOptions (name, val, initOptions, validate = true) {
    return new DragToElementOptions(val, validate);
}

function initPressOptions (name, val, initOptions, validate = true) {
    return new PressOptions(val, validate);
}

function initDialogHandler (name, val, { skipVisibilityCheck, testRun }) {
    let fn;

    if (isJSExpression(val))
        fn = executeJsExpression(val.value, testRun, { skipVisibilityCheck });
    else
        fn = val.fn;

    if (fn === null || fn instanceof ExecuteClientFunctionCommand)
        return fn;

    const options      = val.options;
    const methodName   = 'setNativeDialogHandler';
    const functionType = typeof fn;

    let builder = fn && fn[functionBuilderSymbol];

    const isSelector       = builder instanceof SelectorBuilder;
    const isClientFunction = builder instanceof ClientFunctionBuilder;

    if (functionType !== 'function' || isSelector)
        throw new SetNativeDialogHandlerCodeWrongTypeError(isSelector ? 'Selector' : functionType);

    if (isClientFunction)
        builder = fn.with(options)[functionBuilderSymbol];
    else
        builder = new ClientFunctionBuilder(fn, options, { instantiation: methodName, execution: methodName });

    return builder.getCommand();
}

function initCookiesOption (name, val, initOptions, validate = true) {
    return val.map(cookie => new CookieOptions(cookie, validate));
}

function initRequestOption (name, val, initOptions, validate = true) {
    return new RequestOptions(val, validate);
}

function initGetProxyUrlOptions (name, val, initOptions, validate = true) {
    return new GetProxyUrlOptions(val, validate);
}

function initSkipJsErrorsOptions (name, val, initOptions, validate = true) {
    if (val === void 0)
        return true;

    if (isSkipJsErrorsCallbackWithOptionsObject(val))
        val = new SkipJsErrorsCallbackWithOptions(val, validate);

    else if (isSkipJsErrorsOptionsObject(val))
        val = new SkipJsErrorsOptions(val, validate);

    return prepareSkipJsErrorsOptions(val);
}

// Commands
export class DispatchEventCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.dispatchEvent);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.dispatchEvent, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'selector', init: initSelector, required: true },
            { name: 'eventName', type: nonEmptyStringArgument, required: true },
            { name: 'options', type: actionOptions },
            { name: 'relatedTarget', init: initSelector, required: false },
        ];
    }
}

export class ClickCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.click);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.click, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'selector', init: initSelector, required: true },
            { name: 'options', type: actionOptions, init: initClickOptions, required: true },
        ];
    }
}

export class RightClickCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.rightClick);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.rightClick, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'selector', init: initSelector, required: true },
            { name: 'options', type: actionOptions, init: initClickOptions, required: true },
        ];
    }
}

export class ExecuteExpressionCommand extends CommandBase {
    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.executeExpression, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'expression', type: nonEmptyStringArgument, required: true },
            { name: 'resultVariableName', type: nonEmptyStringArgument, defaultValue: null },
        ];
    }
}

export class ExecuteAsyncExpressionCommand extends CommandBase {
    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.executeAsyncExpression, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'expression', type: stringArgument, required: true },
        ];
    }
}

export class DoubleClickCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.doubleClick);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.doubleClick, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'selector', init: initSelector, required: true },
            { name: 'options', type: actionOptions, init: initClickOptions, required: true },
        ];
    }
}

export class HoverCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.hover);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.hover, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'selector', init: initSelector, required: true },
            { name: 'options', type: actionOptions, init: initMouseOptions, required: true },
        ];
    }
}

export class TypeTextCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.typeText);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.typeText, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'selector', init: initTypeSelector, required: true },
            { name: 'text', type: nonEmptyStringArgument, required: true },
            { name: 'options', type: actionOptions, init: initTypeOptions, required: true },
        ];
    }
}

export class DragCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.drag);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.drag, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'selector', init: initSelector, required: true },
            { name: 'dragOffsetX', type: integerArgument, required: true },
            { name: 'dragOffsetY', type: integerArgument, required: true },
            { name: 'options', type: actionOptions, init: initMouseOptions, required: true },
        ];
    }
}

export class DragToElementCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.dragToElement);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.dragToElement, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'selector', init: initSelector, required: true },
            { name: 'destinationSelector', init: initSelector, required: true },
            { name: 'options', type: actionOptions, init: initDragToElementOptions, required: true },
        ];
    }
}

export class ScrollCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.scroll);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.scroll, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'selector', init: initSelector, required: false },
            { name: 'position', type: nullableStringArgument, required: false },
            { name: 'x', type: positiveIntegerArgument, defaultValue: null },
            { name: 'y', type: positiveIntegerArgument, defaultValue: null },
            { name: 'options', type: actionOptions, init: initOffsetOptions, required: true },
        ];
    }
}

export class ScrollByCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.scrollBy);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.scrollBy, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'selector', init: initSelector, required: false },
            { name: 'byX', type: integerArgument, defaultValue: 0 },
            { name: 'byY', type: integerArgument, defaultValue: 0 },
            { name: 'options', type: actionOptions, init: initOffsetOptions, required: true },
        ];
    }
}

export class ScrollIntoViewCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.scrollIntoView);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.scrollIntoView, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'selector', init: initSelector, required: true },
            { name: 'options', type: actionOptions, init: initOffsetOptions, required: true },
        ];
    }
}

export class SelectTextCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.selectText);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.selectText, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'selector', init: initSelector, required: true },
            { name: 'startPos', type: positiveIntegerArgument, defaultValue: null },
            { name: 'endPos', type: positiveIntegerArgument, defaultValue: null },
            { name: 'options', type: actionOptions, init: initActionOptions, required: true },
        ];
    }
}

export class SelectEditableContentCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.selectEditableContent);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.selectEditableContent, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'startSelector', init: initSelector, required: true },
            { name: 'endSelector', init: initSelector, defaultValue: null },
            { name: 'options', type: actionOptions, init: initActionOptions, required: true },
        ];
    }
}

export class SelectTextAreaContentCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.selectTextAreaContent);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.selectTextAreaContent, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'selector', init: initSelector, required: true },
            { name: 'startLine', type: positiveIntegerArgument, defaultValue: null },
            { name: 'startPos', type: positiveIntegerArgument, defaultValue: null },
            { name: 'endLine', type: positiveIntegerArgument, defaultValue: null },
            { name: 'endPos', type: positiveIntegerArgument, defaultValue: null },
            { name: 'options', type: actionOptions, init: initActionOptions, required: true },
        ];
    }
}

export class PressKeyCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.pressKey);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.pressKey, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'keys', type: nonEmptyStringArgument, required: true },
            { name: 'options', type: actionOptions, init: initPressOptions, required: true },
        ];
    }
}

export class NavigateToCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.navigateTo);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.navigateTo, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'url', type: pageUrlArgument, required: true },
            { name: 'stateSnapshot', type: nullableStringArgument, defaultValue: null },
            { name: 'forceReload', type: booleanArgument, defaultValue: false },
        ];
    }
}

export class SetFilesToUploadCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.setFilesToUpload);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.setFilesToUpload, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'selector', init: initUploadSelector, required: true },
            { name: 'filePath', type: stringOrStringArrayArgument, required: true },
        ];
    }
}

export class ClearUploadCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.clearUpload);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.clearUpload, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'selector', init: initUploadSelector, required: true },
        ];
    }
}

export class SwitchToIframeCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.switchToIframe);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.switchToIframe, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'selector', init: initSelector, required: true },
        ];
    }
}

export class SwitchToMainWindowCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.switchToMainWindow);

    constructor () {
        super();
        this.type = TYPE.switchToMainWindow;
    }
}

export class OpenWindowCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.openWindow);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.openWindow, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'url', type: pageUrlArgument },
        ];
    }
}

export class CloseWindowCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.closeWindow);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.closeWindow, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'windowId', type: nullableStringArgument, required: true },
        ];
    }
}

export class GetCurrentWindowCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.getCurrentWindow);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.getCurrentWindow, validateProperties);
    }

    _getAssignableProperties () {
        return [
        ];
    }
}

export class GetCurrentWindowsCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.getCurrentWindows);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.getCurrentWindows, validateProperties);
    }

    _getAssignableProperties () {
        return [
        ];
    }
}

export class SwitchToWindowCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.switchToWindow);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.switchToWindow, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'windowId', type: nonEmptyStringArgument, required: true },
        ];
    }
}

export class SwitchToWindowByPredicateCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.switchToWindow);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.switchToWindowByPredicate, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'id', type: nonEmptyStringArgument, required: false },
            { name: 'checkWindow', type: functionArgument, required: true },
        ];
    }
}

export class SwitchToParentWindowCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.switchToParentWindow);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.switchToParentWindow, validateProperties);
    }

    _getAssignableProperties () {
        return [
        ];
    }
}

export class SwitchToPreviousWindowCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.switchToPreviousWindow);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.switchToPreviousWindow, validateProperties);
    }

    _getAssignableProperties () {
        return [];
    }
}

export class SetNativeDialogHandlerCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.setNativeDialogHandler);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.setNativeDialogHandler, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'dialogHandler', init: initDialogHandler, required: true },
        ];
    }

    static from (val) {
        const dialogHandlerStub = {
            dialogHandler: { fn: null },
        };

        const command = new SetNativeDialogHandlerCommand(dialogHandlerStub);

        command.dialogHandler = val.dialogHandler;

        return command;
    }
}

export class GetNativeDialogHistoryCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.getNativeDialogHistory);

    constructor () {
        super();
        this.type = TYPE.getNativeDialogHistory;
    }
}

export class GetBrowserConsoleMessagesCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.getBrowserConsoleMessages);

    constructor () {
        super();
        this.type = TYPE.getBrowserConsoleMessages;
    }
}

export class SetTestSpeedCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.setTestSpeed);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.setTestSpeed, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'speed', type: setSpeedArgument, required: true },
        ];
    }
}

export class SetPageLoadTimeoutCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.setPageLoadTimeout);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.setPageLoadTimeout, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'duration', type: positiveIntegerArgument, required: true },
        ];
    }
}

export class UseRoleCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.useRole);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.useRole, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'role', type: actionRoleArgument, required: true },
        ];
    }
}

export class CloseChildWindowOnFileDownloading extends ActionCommandBase {
    static methodName = camelCase(TYPE.closeChildWindowOnFileDownloading);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.closeChildWindowOnFileDownloading, validateProperties);
    }
}

export class RecorderCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.recorder);

    constructor (obj, testRun) {
        super(obj, testRun, TYPE.recorder);
    }

    _getAssignableProperties () {
        return [
            { name: 'subtype', type: nonEmptyStringArgument, required: true },
            { name: 'forceExecutionInTopWindowOnly', type: booleanArgument, defaultValue: false },
        ];
    }
}

export class GetCookiesCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.getCookies);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.getCookies, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'urls', type: urlsArgument, required: false },
            { name: 'cookies', type: cookiesArgument, init: initCookiesOption, required: false },
        ];
    }
}

export class SetCookiesCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.setCookies);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.setCookies, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'url', type: urlsArgument, required: false },
            { name: 'cookies', type: setCookiesArgument, init: initCookiesOption, required: true },
        ];
    }
}

export class DeleteCookiesCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.deleteCookies);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.deleteCookies, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'urls', type: urlsArgument, required: false },
            { name: 'cookies', type: cookiesArgument, init: initCookiesOption, required: false },
        ];
    }
}

export class RequestCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.request);
    static extendedMethods = ['get', 'post', 'delete', 'put', 'patch', 'head'];
    static resultGetters = ['status', 'statusText', 'headers', 'body'];

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.request, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'url', type: urlArgument, required: false },
            { name: 'options', type: actionOptions, init: initRequestOption, required: false },
        ];
    }
}

export class GetProxyUrlCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.getProxyUrl);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.getProxyUrl, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'url', type: urlArgument, required: true },
            { name: 'options', init: initGetProxyUrlOptions, required: false },
        ];
    }
}

export class SkipJsErrorsCommand extends ActionCommandBase {
    static methodName = camelCase(TYPE.skipJsErrors);

    constructor (obj, testRun, validateProperties) {
        super(obj, testRun, TYPE.skipJsErrors, validateProperties);
    }

    _getAssignableProperties () {
        return [
            { name: 'options', type: skipJsErrorOptions, init: initSkipJsErrorsOptions, required: false },
        ];
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectModuleManager">
    <modules>
      <module fileurl="file://$PROJECT_DIR$/AndroidWithReactNative.iml" filepath="$PROJECT_DIR$/AndroidWithReactNative.iml" />
      <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
    </modules>
  </component>
</project>


text:
/// Copyright (c) 2012 Ecma International.  All rights reserved.
/**
 * @path ch15/15.2/15.2.3/15.2.3.6/15.2.3.6-4-361.js
 * @description ES5 Attributes - property ([[Writable]] is false, [[Enumerable]] is true, [[Configurable]] is false) is unwritable
 */

function testcase() {
        var obj = {};

        Object.defineProperty(obj, "prop", {
            value: 2010,
            writable: false,
            enumerable: true,
            configurable: false
        });
        var propertyDefineCorrect = (obj.prop === 2010);
        obj.prop = 1001;

        return propertyDefineCorrect && obj.prop === 2010;
    }
runTestCase(testcase);


text:
const path = require('path');
const merge = require('webpack-merge');

module.exports = merge(require('./webpack.base'), {
    context: __dirname,

    entry: './src/index.js',

    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: 'index.js',
        library: 'vuebbble',
        libraryTarget: 'umd',
    },

    externals: {
        vue: 'vue',
    },
});


text:
layout: feature
title: 'PartType'
shortdef: 'particle type'
udver: '2'
---

  Values:
  Emp
  Inf
  Int
  Mod
  Neg
  Vbp
  Exs

Types of particles are found in various tagsets and are highly language-specific. The list here
is not exhaustive. Language-specific documentation should provide a version of this page tailored
to the given language.

### `Mod`: modal particle

Examples: [bg] _май_ (possibly), _нека_ (let), [cs] _ať, kéž, nechť_ (let)

### `Emp`: particle of emphasis

Examples: [bg] _даже_ (even)

### `Inf`: infinitive marker

Examples: [en] _to_, [de] _zu_, [da] _at_, [sv] _att_

### `Int`: question particle

Required in some languages to form a yes-no question.

Examples: [pl] _czy_

### `Neg`: negation particle

Negates a clause or a smaller phrase.

Examples: [en] _not_, [de] _nicht_

### `Vbp`: separated verb prefix in German

They are analogous to verbal particles in other Germanic languages,
which again overlap with adpositions and adverbs. Do we want to tag
them as adpositions/adverbs and add this feature?

Examples: [de] _vor_ (in _stellen Sie sich vor_)

### `Exs`: existential particle in Nheengatu

The existential particle typically states the existence of an entity and/or introduces a discourse referent (Cruz, 2011).

Examples:

[yrl] _aikwé_ (in _Aikwé siiya yawaraté iké._ "There are many jaguars here.")

#### References

Cruz, A. (2011). **Fonologia e gramática do nheengatú: A língua falada pelos povos Baré, Warekena e Baniwa**. LOT.


text:
from repofish.github import count_extensions, names_from_url
import pickle
import pandas
import sys
import os

pmid = sys.argv[1]
repo_url = sys.argv[2]
output_folder = sys.argv[3]

# We are also interested in these "special files" (note that leaving out the extensions specifies that capitalization and extension are not important)
special_files = ["README","LICENSE","circle.yml",".travis.yml","AUTHORS","CONTRIBUTING","appveyor.yml"]

user_name,repo_name = names_from_url(repo_url)
output_file = "%s/%s_%s_%s_extcounts.tsv" %(output_folder,pmid,user_name,repo_name)
if not os.path.exists(output_file):
    counts = count_extensions(repo_url,special_files=special_files)
    counts.to_csv(output_file,sep="\t")


text:
@interface CARExportor : NSObject

+ (void)exportCarFileAtPath:(NSString *)carPath outputDirectoryPath:(NSString *)outputDirectoryPath;

@end


text:
<!DOCTYPE HTML>
<title>Testcase, bug 428810</title>