/* Minification failed. Returning unminified contents.
(2150,9,2158,10): run-time error JS1314: Implicit property name must be identifier: SetViewerRights() {
            if (Helper.GetCookie("IsViewer") == 1) {
                if (AppV.GetGlobals().ModuleName == enums.Modules.Processes) {
                    MainRibbon.GetItemByName("New").SetEnabled(true);
                } else {
                    MainRibbon.GetItemByName("New").SetEnabled(false);
                }
            }
        }
(18035,9,18049,10): run-time error JS1314: Implicit property name must be identifier: DisableContextMenuItems(s) {
            window["CtxMenuToDo" + s.cpModuleName].SetEnabled(s.cpHasValues);
            if (s.cpHasValues === false) {
                window["CtxMenuToDo" + s.cpModuleName].GetItemByName("newTask").SetEnabled(true);
                window["CtxMenuToDo" + s.cpModuleName].GetItemByName("refresh").SetEnabled(true);
            }

            if (s.cpModuleName === enums.Modules.Planning) {
                if (window[Planning.getGanttChartId()].getSelectedItems().length > 1) {
                    CtxMenuToDoPlanning.GetItemByName("newTask").SetEnabled(false);
                } else {
                    CtxMenuToDoPlanning.GetItemByName("newTask").SetEnabled(true);
                }
            }
        }
 */
var enums = {

    Theme: {
        Aqua : "Aqua",
        DevEx : "DevEx",
        SoftOrange : "SoftOrange",
        Youthful : "Youthful",
        Material : "Material",
        MaterialCompact : "MaterialCompact",
        Ios : "iOS",
        Moderno : "Moderno",
        Metropolis : "Metropolis",
        Office365 : "Office365",
        Default : "Default",
        SoftBlue : "SoftBlue",
    },

    FieldsName: {
        Separator: "-"
    },

    State: {
        ObjectId: "ObjectId",
        RecordId: "RecordId",
        ObjectGuid: "ObjectGuid",
        RecordGuid: "RecordGuid",
        SubObjectGuid: "SubObjectGuid",
        SubObjectId: "SubObjectId",
        UrlEncrypted: "UrlEncrypted",
        AddNewUrlEncrypted: "AddNewUrlEncrypted",
        SectionId: "SectionId",
        StageId: "StageId",
        ObjectType: "ObjectType",
        ModuleName: "ModuleName",
        isMainWindow: "isMainWindow"
    },
    RecordStatus: {
        UnDefined: -1,
        Released: 0,
        CheckedIn: 1,
        Editing: 2,
        CheckedOut: 3,
        In_Proccess: 4,
        History: 5,
        Under_Revision: 6,
        Non_Controlled: 7,
        Obsolete: 8,
        Deleted: 9,
        checkedOutByself: 10,
        Non_Controlled_editing: 11,
        Non_Controlled_editing_Self: 12,
        checkedOutBySelfDifferentPc: 14,
        Non_Controlled_editing_Self_SamePC: 16,
        Non_Controlled_editing_Self_DifferentPC: 17,
        Non_Controlled_editing_Other: 18,
        SW_Awaiting_Release: 19,
        Locked: 20
    },
    FileFormat: {
        word: 1,
        pdf: 2,
        excel: 3,
        powerpoint: 4,
        outlook: 5,
        access: 6,
        image: 7,
        rar: 8,
        zip: 9,
        sldprt: 10,
        audio: 11,
        video: 12,
        sldasm: 13,
        slddrw: 14,
        exe: 15,
        design: 16,
        invalid: 17
    },
    ObjectTypes: {
        //Recordss and documents
        Records: 0,
        Documents: 11,
        Inventor: 12,
        Template: 14,
        SWPDM: 22,

        //CRM and HR
        UsersAndGroupsHR: 1, //was UsersAndGroups
        CRM4: 2, //was Klienta - has some issues this object, does not remember well columns, etc
        CRM3: 3, //was Furnitore
        CRM2: 4, //was Publiku
        CRM1: 5, //was Bizneset

        //Projects and cases
        ProjectsNEW: 18, //was ProjectsGanttChart
        ProjectsStage: 19,
        ProjectsOLD1: 10, //was Projects  (other variation of DX charts)
        ProjectsOLD2: 13, //was Cases     (DX charts)
        TimeSheet: 20,
        TimeSheetItem: 21,
        CustomCases: 15, //Cases

        //Other
        Reports: 16,
        Processes: 17,
        SpecialObject: -1
    },
    Modules: {
        Documents: "ModuleName-Documents",
        Processes: "ModuleName-Processes",
        Projects: "ModuleName-Projects",
        Contacts: "ModuleName-Contacts",
        Home: "ModuleName-Home",
        SpecialObject: "ModuleName-SpecialObject",

        Planning: "Planning",
        TaskTemplates: "TaskTemplates",
        MyDashboard : "MyDashboard"
    },
    HomeModules: {
        MyDashboard: "MyDashboard",
        MyWork: "MyWork",
        Tasks: "Tasks",
        FavoriteReports: "FavoriteReports",
        Timesheets: "Timesheets"
    },
    Private: {
        key: "UVVNVE1RMVUlMDZRJTE1UzlSJTBDWiUwRFMlMDZVUVAlM0NSUFNTU1IlMDklMTAlMDclMEElMDIlMDQlMTElMDIlMEU="
    },
    RibbonNames: {
        Main: "MainRibbon",
        Properties: "ribbonPrpCard"
    },
    AppV: {
        SpecialObject: "SpecialObject",
        ReferencedField: "ReferencedField"
    },
    SpecialObject: {
        isSingle: 0,
        IsMultipleTemplate: 1,
        IsMultipleManual: 2
    },
    TOT: {
        All: 0,
        Objects: 1,
        Cases: 2,
        Process: 3,
        Reports: 4,
        Contacts: 5,
        Tasks: 6
    },
    FileStatusToShow: {
        TheSame: 0,
        Newer: 1,
        Older: 2,
        Any: 3
    },
    Paggination: {
        currentPage: 1,
        pageSizeItem: 35
    },
    CookieKey: {
        SHOWALLPROCESSES: "Cookies.Processes.ShowAll",
        SHOWALLCASES: "Cookies.Cases.ShowAll",
        SHOWALLRELATEDFILES: "Cookies.ShowAllRelatedFiles",
        SHOWIMAGESBILLOFMATERIAL: "Cookies.SHOWIMAGESBILLOFMATERIAL",
        SHOWIMAGESBOMWHEREUSED: "Cookies.SHOWIMAGESBOMWHEREUSED",
        SHOWCOMPLETEDTODO: "Cookies.SHOWCOMPLETEDTODO",
        SHOWAllSTAGESTODO: "Cookies.SHOWAllSTAGESTODO",
        SHOWAllSUBSTAGESTODO: "Cookies.SHOWAllSUBSTAGESTODO",
        SHOWCOMPLETEDTASKSHOME: "Cookies.SHOWCOMPLETEDTASKSHOME",
        SHOWRECORDIMAGE: "Cookies.SHOWRECORDIMAGE",
        SIMPLESEARCH: "Cookies.SIMPLESEARCH",
        SHOWALLDOCUMENTS: "Cookies.Documents.ShowAll",
        INCLUDESUBFOLDERS: "Cookies.IncludeSubfolders",
        LicenseServer: "Cookies.LicenseServer",
        SHOWUNSAVEDCONFIGURATION: "Cookies.SHOWUNSAVEDCONFIGURATION",
        SHOWVIRTUALCONFIGURATION: "Cookies.SHOWVIRTUALCONFIGURATION",
        ASOBJECTFIELDTYPE: "Cookies.ASOBJECTFIELDTYPE",
        ASLOOKUPFIELDTYPE: "Cookies.ASLOOKUPFIELDTYPE",
        EXPANDALLWHEREUSEDASFIELD: "Cookies.EXPANDALLWHEREUSEDASFIELD",
        MAXIMUMNUMBERWHEREUSEDASFIELD: "Cookies.MAXIMUMNUMBERWHEREUSEDASFIELD",
        SHOWVERTICALGRIDLINES: "Cookies.ShowVerticalGridLines",
        SHOWBANDEDROWS: "Cookies.ShowBandedRows"
    },
    ProcessTypes: {
        CommonProcesses: 1,
        Tasks: 2,
        Transmital: 3,
        Information: 4
    },
    FieldTypes: {
        text: 0,
        Number: 1,
        Number_Decimal: 2,
        Date_Type: 3,
        ListOfValuesString: 4,
        ListOfValuesNumeric: 5,
        ListOfValuesNumeric_Decimal: 6,
        DataSource: 7,
        NumberingSchemas: 8,
        YesNo: 9,
        HyperLink: 10,
        Memo: 11,
        ObjectType: 12,
        Material: 13,
        CalculatedFields: 14,
        LookUp: 15,
        Linkto3rdParty: 16,
        Concatenated: 17,
        Webservice: 18
    },
    Help: {
        Folder:"Help",
        IndexUrl: "SWM.WebUser.html"
    },
    ActionToPerform: {
        Default: 0,
        Save: 1,
        CheckIn: 2,
        CheckOut: 3,
        UndoCheckout: 4,
        NewFrom: 5,
        BomInlineEdit: 6,
        Preview: 7,
        Edit: 8,
        MainGridDisplay: 9,
        WhereUsed: 10,
        History: 11,
        SpecialObjects: 12,
        WhereUsedBom: 13,
        WhereUsedProcess: 14,
        WhereUsedReferenced: 15,
        SendToNextStage: 16,
        Download: 17,
        Copy: 18,
        PropertyCardDownload: 19,
        PropertyCardCheckIn: 20,
        PropertyCardCheckOut: 21,
        SWConfiguration: 22,
        ExportFiles: 23,
        Planning: 25,
        ProcessItemsInlineEdit: 26,
        GridInlineEdit: 27,
    },

    NotificationStatus: {
        Success: 'success',
        Warning: 'warning',
        Error: 'error'
    },

    SWConfigurationType: {
        Root: 0,
        Active: 1,
        Virtual: 2,
        Inactive: 3
    },
    TimeSheetState: {
        NEWTIMESHEET: 0,
        DRAFT: 1,
        REVIEWER: 2,
        APPROVED: 3
    },

    ErrorMessage: {
        RegisterSucess: 14
    },
    PasswordEncryptedKey: {
        Key: "UVVNVE1RMVUlMDZR"
    },

    ObjectTypeToAddTo:
    {
        TypeObject: 1,
        TypeProcess: 2,
        TypeCase: 3,
        TypeTask: 4,
        TypeSWPDM: 5,
        TypeProject: 6
    },

    Constants: {
        TaskTemplate: "TaskTemplate_"
    }
};
;
!function (e) { e(["jquery"], function (e) { return function () { function t(e, t, n) { return f({ type: O.error, iconClass: g().iconClasses.error, message: e, optionsOverride: n, title: t }) } function n(t, n) { return t || (t = g()), v = e("#" + t.containerId), v.length ? v : (n && (v = c(t)), v) } function i(e, t, n) { return f({ type: O.info, iconClass: g().iconClasses.info, message: e, optionsOverride: n, title: t }) } function o(e) { w = e } function s(e, t, n) { return f({ type: O.success, iconClass: g().iconClasses.success, message: e, optionsOverride: n, title: t }) } function a(e, t, n) { return f({ type: O.warning, iconClass: g().iconClasses.warning, message: e, optionsOverride: n, title: t }) } function r(e) { var t = g(); v || n(t), l(e, t) || u(t) } function d(t) { var i = g(); return v || n(i), t && 0 === e(":focus", t).length ? void h(t) : void (v.children().length && v.remove()) } function u(t) { for (var n = v.children(), i = n.length - 1; i >= 0; i--)l(e(n[i]), t) } function l(t, n) { return t && 0 === e(":focus", t).length ? (t[n.hideMethod]({ duration: n.hideDuration, easing: n.hideEasing, complete: function () { h(t) } }), !0) : !1 } function c(t) { return v = e("<div/>").attr("id", t.containerId).addClass(t.positionClass).attr("aria-live", "polite").attr("role", "alert"), v.appendTo(e(t.target)), v } function p() { return { tapToDismiss: !0, toastClass: "toast", containerId: "toast-container", debug: !1, showMethod: "fadeIn", showDuration: 300, showEasing: "swing", onShown: void 0, hideMethod: "fadeOut", hideDuration: 1e3, hideEasing: "swing", onHidden: void 0, extendedTimeOut: 1e3, iconClasses: { error: "toast-error", info: "toast-info", success: "toast-success", warning: "toast-warning" }, iconClass: "toast-info", positionClass: "toast-top-right", timeOut: 5e3, titleClass: "toast-title", messageClass: "toast-message", target: "body", closeHtml: '<button type="button">&times;</button>', newestOnTop: !0, preventDuplicates: !1, progressBar: !1 } } function m(e) { w && w(e) } function f(t) { function i(t) { return !e(":focus", l).length || t ? (clearTimeout(O.intervalId), l[r.hideMethod]({ duration: r.hideDuration, easing: r.hideEasing, complete: function () { h(l), r.onHidden && "hidden" !== b.state && r.onHidden(), b.state = "hidden", b.endTime = new Date, m(b) } })) : void 0 } function o() { (r.timeOut > 0 || r.extendedTimeOut > 0) && (u = setTimeout(i, r.extendedTimeOut), O.maxHideTime = parseFloat(r.extendedTimeOut), O.hideEta = (new Date).getTime() + O.maxHideTime) } function s() { clearTimeout(u), O.hideEta = 0, l.stop(!0, !0)[r.showMethod]({ duration: r.showDuration, easing: r.showEasing }) } function a() { var e = (O.hideEta - (new Date).getTime()) / O.maxHideTime * 100; f.width(e + "%") } var r = g(), d = t.iconClass || r.iconClass; if ("undefined" != typeof t.optionsOverride && (r = e.extend(r, t.optionsOverride), d = t.optionsOverride.iconClass || d), r.preventDuplicates) { if (t.message === C) return; C = t.message } T++ , v = n(r, !0); var u = null, l = e("<div/>"), c = e("<div/>"), p = e("<div/>"), f = e("<div/>"), w = e(r.closeHtml), O = { intervalId: null, hideEta: null, maxHideTime: null }, b = { toastId: T, state: "visible", startTime: new Date, options: r, map: t }; return t.iconClass && l.addClass(r.toastClass).addClass(d), t.title && (c.append(t.title).addClass(r.titleClass), l.append(c)), t.message && (p.append(t.message).addClass(r.messageClass), l.append(p)), r.closeButton && (w.addClass("toast-close-button").attr("role", "button"), l.prepend(w)), r.progressBar && (f.addClass("toast-progress"), l.prepend(f)), l.hide(), r.newestOnTop ? v.prepend(l) : v.append(l), l[r.showMethod]({ duration: r.showDuration, easing: r.showEasing, complete: r.onShown }), r.timeOut > 0 && (u = setTimeout(i, r.timeOut), O.maxHideTime = parseFloat(r.timeOut), O.hideEta = (new Date).getTime() + O.maxHideTime, r.progressBar && (O.intervalId = setInterval(a, 10))), l.hover(s, o), !r.onclick && r.tapToDismiss && l.click(i), r.closeButton && w && w.click(function (e) { e.stopPropagation ? e.stopPropagation() : void 0 !== e.cancelBubble && e.cancelBubble !== !0 && (e.cancelBubble = !0), i(!0) }), r.onclick && l.click(function () { r.onclick(), i() }), m(b), r.debug && console && console.log(b), l } function g() { return e.extend({}, p(), b.options) } function h(e) { v || (v = n()), e.is(":visible") || (e.remove(), e = null, 0 === v.children().length && (v.remove(), C = void 0)) } var v, w, C, T = 0, O = { error: "error", info: "info", success: "success", warning: "warning" }, b = { clear: r, remove: d, error: t, getContainer: n, info: i, options: {}, subscribe: o, success: s, version: "2.1.0", warning: a }; return b }() }) }("function" == typeof define && define.amd ? define : function (e, t) { "undefined" != typeof module && module.exports ? module.exports = t(require("jquery")) : window.toastr = t(window.jQuery) });
//# sourceMappingURL=toastr.js.map
;

var Main = {};
var strFileName = "";
var objectType = "";
window.mLinkedRecord = {};

Main.Global = {
    PanelClosedObj: {}
};

Main.LastmainSplPropertyPanelHeight = '';


document.addEventListener("DOMContentLoaded", function () {

    window.onresize = function () {
        // View.UpdateHeaderInformation(!(window.innerWidth < 780));
        if (AppV.GetGlobals().isMainWindow)
            App.Global.SplitterResize();
    }

    Main.Splitter = (function () {

        var _instances = [];

        function SplitterPrototype(_context, _var, _splitter = null) {
            if (_splitter != null)
                this.wObj = window[_splitter].GetPaneByName(_context);
            else
                this.wObj = mainSplFullScreenMode.GetPaneByName(_context);
            this.displayObj = document.getElementById(this.wObj.helper.GetSeparatorElementId());
            if (this.displayObj == null) {
                this.displayObj = {}; this.displayObj.style = {}; this.displayObj.style.display = "";
            }
            this.Hide = function () { if (this.isOpen) { this.Close(); } this.displayObj.style.display = "none"; };
            this.Show = function () { this.displayObj.style.display = ""; };
            this.Close = function () { this.wObj.CollapseForward(); };
            this.SetSize = function (_h) { this.wObj.SetSize(_h); };
            this.Open = function () { this.wObj.Expand(); };
            this.isOpen = function () { return !this.wObj.IsCollapsed(); };
            this.isVisible = function () { return this.displayObj.style.display == ""; };
            this.CloseAndHide = function () { this.Close(); this.Hide() };
            this.ShowAndOpen = function () { this.Show(); this.Open() };
            var _self = this;
            if (!_instances.includes(_var)) {
                this._defaultState = {
                    isOpen: _self.isOpen(),
                    isVisible: _self.isVisible()
                };
                _instances.push(_var);
            }

        }

        var conditionBoilerplate = {
            ReturnToDefault: function (el = null) {

                var context = Main.Splitter;
                if (el == null) {
                    _instances.forEach(function (elm) {
                        if (elm == "rightSplitter")
                            rightSplitter.tabs()[0].SetEnabled(true);
                        (context[elm]._defaultState.isOpen) ? context[elm].Open() : context[elm].Close();
                        (context[elm]._defaultState.isVisible) ? context[elm].Show() : context[elm].Hide();
                    });
                } else {
                    (context[elm]._defaultState.isOpen) ? context[elm].Open() : context[elm].Close();
                    (context[elm]._defaultState.isVisible) ? context[elm].Show() : context[elm].Hide();
                }
            },
            Home: {
                menuChanged: function () {
                    bottomSplitter.Hide();
                    rightSplitter.tabs()[0].SetEnabled(false);
                    if (AppV.GetHomeObjects().MenuSelected != enums.HomeModules.Tasks) {
                        //homeSplitter.Hide();
                    } else {
                        //homeSplitter.Show();
                    }
                },
                moduleClick: function () {
                    conditionBoilerplate.ReturnToDefault();
                    bottomSplitter.Hide();
                    conditionBoilerplate.Home.menuChanged();
                }
            }
        };
        var bottomSplitter = {}, rightSplitter = {}, centerSplitter = {}, specialObjectSplitter = {}, homeSplitter = {}, leftSplitter = {};
        if (typeof mainSplFullScreenMode != "undefined") {
            bottomSplitter = new SplitterPrototype("mainSplPropertyPanel", "bottomSplitter");
            bottomSplitter.lastHeight = 0;

            rightSplitter = new SplitterPrototype("mainSplRightPanel", "rightSplitter");
            rightSplitter.tabs = function () { return (RightPageControlPanel == null) ? [] : RightPageControlPanel.tabs; };


            centerSplitter = new SplitterPrototype("mainSplDataGridPanel", "centerSplitter");
            specialObjectSplitter = new SplitterPrototype("specialObjectSplitter", "specialObjectSplitter", "SectionSplitter");


            leftSplitter = new SplitterPrototype("splNavigationPane", "leftSplitter");
            leftSplitter.Close = function () { leftSplitter.wObj.CollapseBackward(); };
        } else if (typeof splFullScreenModePropertyCard != "undefined") {
            rightSplitter = new SplitterPrototype("pnlProcessInfo", "rightSplitter", "splFullScreenModePropertyCard");
            centerSplitter = new SplitterPrototype("centerPanel", "centerSplitter", "splFullScreenModePropertyCard");

            centerSplitter.Close = function () { Main.Splitter.centerSplitter.wObj.splitter.OnCollapseButtonClick(Main.Splitter.rightSplitter.wObj.helper.indexPath, false); }
            centerSplitter.Open = function () { Main.Splitter.centerSplitter.wObj.splitter.OnCollapseButtonClick(Main.Splitter.rightSplitter.wObj.helper.indexPath, true); }



            //rightSplitter.tabs = function () { return (RightPageControlPanel == null) ? [] : RightPageControlPanel.tabs; };0i0i1i1



        }


        var applyChangesOnModuleChange = function (MenuSelected = null) {
            if (AppV.GetGlobals().ModuleName == enums.Modules.Home) {
                (MenuSelected == null)
                    ? conditionBoilerplate.Home.moduleClick()
                    : conditionBoilerplate.Home.menuChanged();
            } else {
                bottomSplitter.SetSize(360);
                conditionBoilerplate.ReturnToDefault();
                //App.Global.SplitterResize();
            }
        };


        return {
            Init: applyChangesOnModuleChange,
            leftSplitter,
            centerSplitter,
            bottomSplitter,
            rightSplitter,
            homeSplitter,
            specialObjectSplitter,
            applyChangesOnModuleChange
        };
    })();

});


Main.checkIframeLoaded = function () {
    setTimeout(function () {
        Main.DesignPreviewLoad();
    }, 3000);
};

Main.DesignPreviewLoad = function () {
    try {
        var data = {
            fileName: cbpDocumentPreviewContent.cpFileName,
            fileBuffer: cbpDocumentPreviewContent.cpfileBuffer,
            files: getFiles(cbpDocumentPreviewContent.cpFileName, cbpDocumentPreviewContent.cpfileBuffer),
            idelement: "fileupload",
            type: "file",
            source: "Solidworks",
        };
        var iframe = document.getElementById('eDrawings');
        if (data !==null && iframe != null) {
            iframe.style.display = 'block';
            iframe.contentWindow.postMessage(data, '*');
        }
    } catch (err) {
           var iframeHide = document.getElementById('eDrawings');
            if (iframeHide != null) {
                iframeHide.style.display = 'none';
               }
            }
};

function simulateClick(data) {
    var el = document.getElementById(data.idelement);
    if (data !== null && el !== null) {
        el.files = data.files;
        var event = new Event('change');
        el.dispatchEvent(event);
    }
}

function getFiles(fileName, fileBuffer) {
    if (fileBuffer.length > 0) {
        var blob = new Blob([new Uint8Array(fileBuffer)], { type: "file" });
        var file = new File([blob], fileName, { lastModified: Date.now(), lastModifiedDate: Date.now(), name: fileName });
        return Helper.FileListItem(file);
    }
}

//Main Html frame js
//window.addEventListener('message', function (event) {
//    if (event.data !== null && event.data.source == "Solidworks") {
//        var el = document.getElementById(event.data.idelement);
//        if (el !== null) {
//            el.files = event.data.files;
//            var event = new Event('change');
//            el.dispatchEvent(event);
//        }
//    } else {
//        return;
//    }
//});



Main.DocPreviewHeightFixes = function (s, e) {
        try {
            var h = $('#RightPageControlPanel_C1').height() - 30;
            if (s.name == "wordPreview") {
                AppV.GetGlobals().isMainWindow ? wordPreview.SetHeight(h) : wordPreview.SetHeight(document.documentElement.clientHeight * 0.85);
            } else if (s.name == "excelPreview") {
                AppV.GetGlobals().isMainWindow ? excelPreview.SetHeight(h) : excelPreview.SetHeight(document.documentElement.clientHeight * 0.85);
            } else if (s.name == "pdfPreview") {
                AppV.GetGlobals().isMainWindow ? pdfPreview.SetHeight(h) : pdfPreview.SetHeight(document.documentElement.clientHeight * 0.85);
            } else {
                $('#imagePreviewDiv').css('max-height', h);
            }
        }
        catch (err) {
        }
    };

    Main.PDFDocPreviewHeightFixesEndCallback = function (s, e) {
        if (s.cpFileType == enums.FileFormat.pdf) {
            var PDFPreviewer = document.getElementById("PDFPreviewer");
            if (PDFPreviewer != null) {
                PDFPreviewer.style.height = (document.documentElement.clientHeight * 0.8) + "px";
            }
        } else if (s.cpFileType == enums.FileFormat.design) {
            var eViewer = document.getElementById("eViewer");
            if (eViewer != null) {
                eViewer.style.height = (document.documentElement.clientHeight * 0.8) + "px";
            }
        }
    };

Main.HandleMaximizeClick = function (s, e, fileFormat) {
    var _obj = {};
    switch (fileFormat) {
        //case enums.FileFormat.word:
        //    _obj = window["wordPreview"];
        //    _obj.SetFullscreenMode(true);
        //    Notification.SetNotification("Press F11 to exit!", "info", 1000);
        //    break;
        //case enums.FileFormat.excel:
        //    _obj = window["excelPreview"];
        //    _obj.SetFullscreenMode(true);
        //    Notification.SetNotification("Press F11 to exit!", "info", 1000);
        //    break;
        case enums.FileFormat.excel:
        case enums.FileFormat.word:
        case enums.FileFormat.image:
        case enums.FileFormat.pdf:
        case enums.FileFormat.design:
            if (AppV.GetGlobals().isMainWindow) {
                if (Main.Splitter.leftSplitter.isOpen() || Main.Splitter.centerSplitter.isOpen()) {
                    Main.Splitter.centerSplitter.Close();
                    Main.Splitter.leftSplitter.Close();
                    Main.SetSplitterImage("none",true);
                }
                else {
                    Main.Splitter.centerSplitter.Open();
                    Main.Splitter.leftSplitter.Open();
                    Main.SetSplitterImage("block",false);
                }
            } else {
                if (Main.Splitter.centerSplitter.isOpen()) {
                    Main.Splitter.centerSplitter.Close();
                }
                else {
                    Main.Splitter.centerSplitter.Open();
                }
                //PropertyCard Spliter
            }
            break;
    }
},

    Main.SetSplitterImage = function (display, isMax) {
        try {
            if (mainSplFullScreenMode_0i0i1i2_S_CF_Img != "undefined")
                mainSplFullScreenMode_0i0i1i2_S_CF_Img.style.display = display;
            if (mainSplFullScreenMode_0i0i1i1_S_CF_Img != "undefined")
                mainSplFullScreenMode_0i0i1i1_S_CF_Img.style.display = display;
            if (mainSplFullScreenMode_0i0i1i1_S_CB_Img != "undefined")
                mainSplFullScreenMode_0i0i1i1_S_CB_Img.style.display = display;
            var element = document.getElementById("enterFullScreenButtonPreviewImg");
            if (element != null) {
                if (isMax) {
                    element.classList.remove("fullscreen");
                    element.classList.add("delete");
                    if (typeof enterFullScreenButtonPreview != "undefined")
                        enterFullScreenButtonPreview.SetText(Helper.T("Minimize"));
                } else {
                    element.classList.remove("delete");
                    element.classList.add("fullscreen");
                    if (typeof enterFullScreenButtonPreview != "undefined")
                        enterFullScreenButtonPreview.SetText(SwResourceObject.Maximize);
                }
            }
        } catch (e) {
            console.log(e.message);
        }
    },


Main.HandleOpenPdmPreviewClick = function (s, e, WebViewerUrl) {
    window.open(WebViewerUrl, '_blank');
  };

    var DocumentPreviewClearCache = function (_shouldIRUn = true) {
        if (!AppV.GetGlobals().isMainWindow) {
            window.cbpDocumentPreviewContent.PerformCallback({ strFileName: "", objectId: -1, recordId: -1 });
        } else {
            recordID = window.gridViewDocuments.GetRowKey(window.gridViewDocuments.GetFocusedRowIndex());
            objectID = AppV.GetGlobals().ObjectId;
            var objectType = AppV.GetGlobals().ObjectType;
            if (objectID != -1) {//&& objectType != 22
                if (objectID != null && recordID != null && _shouldIRUn) {
                    window.cbpDocumentPreviewContent.PerformCallback({
                        strFileName: "",
                        objectId: objectID,
                        recordId: recordID
                    });
                }
            }
        }
    };

    function splFullScreenModeResizeCompleted(s, e) {
        if (e.pane.name === "mainSplPropertyPanel") {
            //applyHeightBom();
            window.App.Global.SplitterResize();
            if (typeof PropertyCardSection != "undefined")
                RzProperties.PerformHeightChanges(PropertyCardSection.GetActiveTab().name);
        }
        if (e.pane.name === "mainSplDataGridPanel") {
            MainGrid.Sharing.ResizeSharingData();
        }
    }
    function applyHeightBom(h = null) {
        //BOM 
        if (typeof billOfMaterials != 'undefined') {
            var bView = billOfMaterials.checkActiveDisplay();
            if (bView != null && document.getElementById(bView) != null) {
                RzProperties.CalculateHeightForBom();
                // if (Helper.IsElementVisible(document.getElementById(bView)))
                //     window[bView].SetHeight((h == null) ? mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight - billOfMaterials.InitialHeight : h);
                //     window[bView].AdjustControl();
            }

        }
    }
    function MainSplitterInit(s, e) {

        AppV.PushAdditionalInfo("jsBundles", JSON.parse(mainSplFullScreenMode.cpJsBundles));
        AppV.PushAdditionalInfo("minifyScripts", mainSplFullScreenMode.cpMinifyScripts);

        Main.Splitter.Init();
        var panel = mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel");
        var propertySeperator = panel.helper.GetSeparatorElement();
        ASPxClientUtils.AttachEventToElement(propertySeperator, "click", function (evt) {
            if (Helper.Contains("down", evt.srcElement.className)) {
                Main.Global.PanelClosedObj[AppV.GetGlobals().ObjectId] = false;
            } else {
                if (!Main.Global.PanelClosedObj[AppV.GetGlobals().ObjectId]) {
                    Main.Global.PanelClosedObj[AppV.GetGlobals().ObjectId] = true;

                    window.cbpPropertyCardSectionBottom.PerformCallback({
                        id: AppV.GetGlobals().ObjectId,
                        id2: AppV.GetGlobals().RecordId,
                        id3: AppV.GetGlobals().RecordGuid,
                        id4: AppV.GetGlobals().SubObjectGuid,
                        module: (AppV.GetHomeObjects().MenuSelected === enums.HomeModules.Tasks) ? "Tasks" : ""
                    });
                }
            }
        });
    }
    function MainSplitterResizing(s, e) {
        //if (e.pane.name === "mainSplPropertyPanel" || e.pane.name === "mainSplGridPanel") {

        //}
    }

    function splFullScreenExpanding(s, e) {
        if (e.pane.name === "mainSplPropertyPanel" && Helper.Contains("section", AppV.GetGlobals().SectionId)) {
            e.cancel = true;
        }
        SetRightSpliterButtonImage();
        SetBootomSpliterButtonImage();
    }

    function splFullScreenExpanded(s, e) {
        if (e.pane.name === "mainSplRightPanel") {
            if (AppV.GetGlobals().isMainWindow) {
                if (window.RightPageControlPanel.activeTabIndex === 0) {

                    window.cbpFilterContent.PerformCallback({
                        objectId: AppV.GetGlobals().ObjectId,
                        subObjectId: AppV.GetGlobals().SubObjectId
                    });
                } else if (window.RightPageControlPanel.activeTabIndex === 1) {
                    OnDocumentPreviewTabClick();
                }
                else if (window.RightPageControlPanel.activeTabIndex === 2) {
                    OnCallBackShortcutMenu();
                }
                else if (window.RightPageControlPanel.activeTabIndex === 3) {
                    cbpSearchAllContent.PerformCallback();
                }
                else if (window.RightPageControlPanel.activeTabIndex === 4) {
                    cbpInternalSharedFiles.PerformCallback({ reload: true });
                }
            } else {
                if (window.RightPageControlPanel.activeTabIndex === 2) {
                    OnCallBackShortcutMenu();
                }
                window.Filter.ClearFilterFields();
                window.Filter.DisableFilterFields();
            }

        } else {
            splFullScreenModeResizeCompleted(s, e);
        }
        SetRightSpliterButtonImage();
        SetBootomSpliterButtonImage();
    }

    function OnCallBackShortcutMenu() {
        window.cbpListContent.PerformCallback();
        window.cbpShortcutContent.PerformCallback();
        window.Filter.ClearFilterFields();
        window.Filter.DisableFilterFields();
    }


    function splFullScreenCollapsed(s, e) {
        if (e.pane.name === "mainSplRightPanel") {
            DocumentPreviewClearCache(false);
        } else if (e.pane.name === "mainSplGridPanel") {
            var a = mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel");
            var b = mainSplFullScreenMode.GetPaneByName("mainSplGridPanel");
            a.Expand(a);
            b.Expand(b);
        } else {
            splFullScreenModeResizeCompleted(s, e);
        }
        SetRightSpliterButtonImage();
        SetBootomSpliterButtonImage();
    }
    function SetRightSpliterButtonImage() {
        this.displayObj = document.getElementById("mainSplFullScreenMode_0i0i1i2_S_CB_Img");
        if (Main.Splitter.rightSplitter.isOpen()) {
            if (this.displayObj != null) this.displayObj.style.display = "none";
        } else {
            if (this.displayObj != null) this.displayObj.style.display = "";
        }
    }

    function SetBootomSpliterButtonImage() {
        this.displayObj = document.getElementById("mainSplFullScreenMode_0i0i1i1i1_S_CB_Img");
        if (Main.Splitter.bottomSplitter.isOpen()) {
            if (this.displayObj != null) this.displayObj.style.display = "none";
        } else {
            if (this.displayObj != null && AppV.GetGlobals().ObjectId>0) this.displayObj.style.display = "";
        }
    }
    function RightPageControlPanelTabCahanged(s, e) {

        if (e.tab.index === 0) {
            if (AppV.GetGlobals().ObjectId !== -1) {

                window.cbpFilterContent.PerformCallback({
                    objectId: AppV.GetFiltersState.ObjectId,
                    subObjectId: AppV.GetGlobals().GroupObjectId
                });
            }
        } else if (e.tab.index === 1) {
            OnDocumentPreviewTabClick();
            window.Filter.ClearFilterFields();
            window.Filter.DisableFilterFields();
        }
        else if (e.tab.index === 2) {
            OnCallBackShortcutMenu();
        }
        else if (e.tab.index === 3) {
            cbpSearchAllContent.PerformCallback();
        }
        else if (e.tab.index === 4) {
            cbpInternalSharedFiles.PerformCallback({ reload: true });
        }
        else {
            window.Filter.ClearFilterFields();
            window.Filter.DisableFilterFields();
        }

    }

    var OnDocumentPreviewTabClick = function (objId, recordId, strFileName, version = -1, objectType = "") {
        var recordID = recordId;
        if (AppV.GetGlobals().isMainWindow)
            recordID = recordId || window.gridViewDocuments.GetRowKey(window.gridViewDocuments.GetFocusedRowIndex());
        var objectID = objId || AppV.GetGlobals().ObjectId;
        //if (objectType == "") {
        //    objectType = AppV.GetGlobals().ObjectType;
        //}

        if (objectID != -1 && recordID != null)//&& objectType != 22
        {
            //if (objectType == enums.ObjectTypes.Documents ||
            //    objectType == enums.ObjectTypes.Template ||
            //    objectType == enums.ObjectTypes.Processes ||
            //    objectType == enums.ObjectTypes.SWPDM ||
            //    objectType == enums.ObjectTypes.Records) { //|| objectType == 22
            var fileName = strFileName; //||MainGrid.GetGridRowData().FileName;
            //if (fileName != null) {
            Request.ajax({
                type: "POST",
                url: '/File/CheckIfFileIsEncrypted/',
                data: {
                    strFileName: fileName,
                    objectId: objectID,
                    recordId: recordID,
                    version: version
                },
                dataType: "json"
            }).then(function (response) {
                //response = JSON.parse(response.data)
                if (response.Success) {
                    // View.load("ModalPasswordDocPreview",{
                    // strFileName: fileName,
                    // objectId: objectID,
                    // recordId: recordID
                    // });


                    Helper.ShowConfirmPopUp("SolidWorks", "This is a password protected file.\n" + "Do you want to download it?",
                        "RelatedFiles.DownloadEncryptedFile('" + response.FileName + "')");
                    $("#cbpDocumentPreviewContent").empty();
                }
                else {
                    fileName = response.OriginalFileName;
                    if (AppV.GetGlobals().isMainWindow) {
                        fileName = response.OriginalFileName
                        if (!Helper.IsNotEmpty(false, fileName)) {
                            if (typeof MainGrid.GetGridRowData() != "undefined")
                                fileName = MainGrid.GetGridRowData().FileName;
                        }
                    }
                    window.cbpDocumentPreviewContent.PerformCallback({
                        strFileName: fileName,
                        objectId: objectID,
                        recordId: recordID,
                        version: version
                    });
                }

            }).then(function () { window.loadingPanel.Hide(); });


            //}

            //} else {
            //    DocumentPreviewClearCache();
            //}
        }

    };

;

var MainGrid = (function () {

    var responseData;

    var _State = {
        _push: function (obj) {
            if (typeof obj !== "undefined") {
                this._validateSelected();
                this.lastKeyInserted.key = obj.RecordId;
                this.lastKeyInserted.index = obj.visibleIndex;
                this.data[obj.visibleIndex] = obj;
            }
        },
        _validateSelected: function () {
            if (Object.keys(this.lastKeyInserted).length !== 0) {
                if (gridViewDocuments.GetSelectedKeysOnPage().indexOf(String(this.lastKeyInserted.key)) === -1) {
                    this._pop(this.lastKeyInserted.index);
                }
            }
            lastKeyInserted = {};
        },
        _pop: function (key) {
            delete this.data[key];
        },
        _get: function () {
            return this.data;
        },
        _clear: function () {
            this.data = {};
            this.lastKeyInserted = {};
        },

        lastKeyInserted: {},
        data: {},
        reload: false,
        RowClick: {
            Delay: 300,
            clicks: 0,
            timer: null,
            senderArray: []
        },
        toolbarHasChanged: false
    };

    var _InternalFunctions = {
        GetFocusedRowKey: function (index) {
            return Helper.GetGridFocusedRowKey("gridViewDocuments", index);
        },
        OnGridViewRowClick: function (visibleIndex) {

            var recordId = MainGrid.GetGridRowData(visibleIndex).RecordId;
            var ObjectId = MainGrid.GetGridRowData(visibleIndex).ObjectId;
            var fileName = MainGrid.GetGridRowData(visibleIndex).FileName;
            // localStorage.getItem("Selected_ObjectId");

            //Open objectType pop up when object type cell clicked
            if (window.mGObjType.hasOwnProperty("name")) {

                $.ajax({
                    type: "POST",
                    url: '/Properties/GetObjectTypeGuid/',
                    data: {
                        "objectId": window.mGObjType.ObjectId,
                        "recordId": recordId,
                        "columnId": window.mGObjType.ColumnId,
                        "fieldSystemName": window.mGObjType.SystemName,
                        "allowMultipleItems": window.mGObjType.AllowMultipleItems
                    },
                    success: function (response) {
                        window.mGObjType.SelectedValues = response.recordGuidList;
                        if (window.mGObjType.SelectedValues !== "" && window.mGObjType.SelectedValues !== null) {
                            window.ObjectTypeField.onObjectTypeFieldFocusPreview({},
                                {},
                                ActionToPerform.MainGridDisplay,
                                true);
                        } else {
                            window.mGObjType = {};
                        }

                    }
                });

            } else if (window.mLinkedRecord.hasOwnProperty("name")) {
                var columnName = window.mLinkedRecord.SystemName;
                window.mLinkedRecord = {};
                $.ajax({
                    type: "POST",
                    url: '/Main/GetLinkedRecordsUrl/',
                    data: {
                        "objectId": AppV.GetGlobals().ObjectId,
                        "recordGuid": AppV.GetGlobals().RecordGuid,
                        "recordId": AppV.GetGlobals().RecordId,
                        "columnName": columnName
                    },
                    dataType: "json",
                    success: function (response) {
                        if (response !== "") {
                            Helper.open('/PropertyCard/Index/' + response, '_blank');
                        }
                    }
                });
            }
            else if (AppV.GetGlobals().ModuleName == enums.Modules.Home &&(AppV.GetHomeObjects().MenuSelected === enums.HomeModules.Tasks)) {
                _InternalFunctions.performSingleClick(ObjectId, recordId, visibleIndex, _InternalFunctions.callBackSingleClick);
            }
            else if (AppV.GetGlobals().ModuleName == enums.Modules.Home &&
                ( AppV.GetHomeObjects().MenuSelected === enums.HomeModules.MyWork)) {
                var menuPanel = window.mainSplFullScreenMode.GetPaneByName("mainSplRightPanel");
                if (!menuPanel.IsCollapsed()) {
                    if (window.RightPageControlPanel.activeTabIndex === 1) {
                        if (AppV.GetGlobals().ObjectType != enums.ObjectTypes.SWPDM) {
                            OnDocumentPreviewTabClick(ObjectId, recordId, fileName);
                        } else {
                            MainGrid.PDM.PdmIsConnectedAction(enums.ActionToPerform.Preview);
                        }
                    }
                }
            }
            else if (AppV.GetGlobals().ModuleName != enums.Modules.Home) {
                _InternalFunctions.performSingleClick(ObjectId, recordId, visibleIndex, _InternalFunctions.callBackSingleClick);
            }

        },
        OnGridViewDoubleRowClick: function (visibleIndex) {

            window.App.Global.ClearBottomTabStates();
            _InternalFunctions.callbackDoubleClick(visibleIndex);
        },
        callbackDoubleClick: function (visibleIndex) {
            broadcastV.create({ endPoint: "MainGrid" });
            if (AppV.GetGlobals().ModuleName === enums.Modules.Home &&
                AppV.GetHomeObjects().MenuSelected === enums.HomeModules.Tasks) {
                _InternalFunctions.OpenTask();
            }
            else if (AppV.GetGlobals().ModuleName === enums.Modules.Home
                && AppV.GetGlobals().MenuSelected === enums.Modules.Timesheets) {
                return;
            }
            else {

                //Helper.open('/PropertyCard/Index/' + MainGrid.GetGridRowData(visibleIndex).UrlEncrypted, '_blank');

                _InternalFunctions.openRecordMainGrid(visibleIndex);
            }
        },
        performSingleClick: function (objectId, recordId, focusedRowIndex, callback) {

            window.App.Global.ClearBottomTabStates();
            FieldVaildation.objectChanged = true;
            if (typeof callback === "function") {
                callback(objectId, recordId, MainGrid.GetGridRowData(focusedRowIndex).RecordGuid, focusedRowIndex);
            }
        },
        callBackSingleClick: function (objectId, recordId, recordGuid, focusedRowIndex) {
            //Need to update AppV because of the filter selection
            AppV.pushGlobalState("ObjectId", objectId);
            AppV.pushGlobalState("RecordId", recordId);

            FieldVaildation.mainGrid = true;
            var moduleCurrent = "";

            if (AppV.GetGlobals().ModuleName === enums.Modules.Home
                && AppV.GetHomeObjects().MenuSelected === enums.HomeModules.Tasks) {
                Main.Splitter.bottomSplitter.Show();
                Main.Splitter.bottomSplitter.SetSize(150);
                App.Global.SplitterResize();
                moduleCurrent = "Tasks";
            }

            //Check if record has rights on field group
            if (MainGrid.GetGridRowData(focusedRowIndex).HasFieldGroupRights === false) {
                Main.Splitter.bottomSplitter.CloseAndHide();
                return;
            }

            if (!window.Main.Global.PanelClosedObj.hasOwnProperty(AppV.GetGlobals().ObjectId)) {
                window.Main.Global.PanelClosedObj[AppV.GetGlobals().ObjectId] = true;
                if (Main.Splitter.bottomSplitter.isOpen()) {
                    RzProperties.cbpPropertyCardBottomSectionEndCallback();
                } else {

                    window.cbpPropertyCardSectionBottom.PerformCallback({
                        id: AppV.GetGlobals().ObjectId,
                        id2: recordId,
                        id3: recordGuid,
                        id4: AppV.GetGlobals().SubObjectGuid,
                        module: moduleCurrent
                    });
                }

            } else if (window.Main.Global.PanelClosedObj[AppV.GetGlobals().ObjectId]) {
                if (Main.Splitter.bottomSplitter.isOpen()) {

                    RzProperties.cbpPropertyCardBottomSectionEndCallback();
                } else {

                    window.cbpPropertyCardSectionBottom.PerformCallback({
                        id: AppV.GetGlobals().ObjectId,
                        id2: recordId,
                        id3: recordGuid,
                        id4: AppV.GetGlobals().SubObjectGuid,
                        module: moduleCurrent
                    });
                }
            }

            var menuPanel = window.mainSplFullScreenMode.GetPaneByName("mainSplRightPanel");
            if (!menuPanel.IsCollapsed()) {
                if (window.RightPageControlPanel.activeTabIndex === 1) {
                    if (AppV.GetGlobals().ObjectType != enums.ObjectTypes.SWPDM) {
                        OnDocumentPreviewTabClick();
                    } else {
                        MainGrid.PDM.PdmIsConnectedAction(enums.ActionToPerform.Preview);
                    }
                }
            }

        },
        setEnabledContextMenu: function (e) {

            if (AppV.GetGlobals().IsSpecialObject === true) {
                CtxSpecialObjectGridMain.SetEnabled(true);
            }
            else if (AppV.GetGlobals().ModuleName === enums.Modules.Documents) {
                CtxDocGrid.SetEnabled(true);

                CtxDocGrid.GetItemByName("CheckIn").SetEnabled(false);
                CtxDocGrid.GetItemByName("CheckOut").SetEnabled(false);
                //CtxDocGrid.GetItemByName("NewFrom").SetEnabled(AppV.GetGlobals().ObjectType !== enums.ObjectTypes.SWPDM);
                CtxDocGrid.GetItemByName("OpenFile").SetEnabled(AppV.GetGlobals().ObjectType !== enums.ObjectTypes.Records);
                CtxDocGrid.GetItemByName("Records").SetVisible(AppV.GetGlobals().ObjectType !== enums.ObjectTypes.Records);
                //Has Export Configuration Rights
                window.CtxDocGrid.GetItemByName("ExportFiles").SetEnabled(gridViewDocuments.cpHasExportConfigurations);
                var recordKeys = Object.keys(MainGrid.GetSelectedRowValues());

                var CheckStatus = enums.RecordStatus.UnDefined;
                var SCheckIn = false; var SCheckOut = false;
                //if (AppV.GetGlobals().ObjectType !== enums.ObjectTypes.SWPDM) {
                for (i = 0; i < recordKeys.length; i++) {
                    if (i > 0) {
                        var ItemCheckStatus = MainGrid.GetSelectedRowValues()[recordKeys[i]].CheckStatus;
                        if (ItemCheckStatus == enums.RecordStatus.checkedOutBySelfDifferentPc || ItemCheckStatus == enums.RecordStatus.checkedOutByself) {
                            SCheckIn = true;
                        }
                        if (ItemCheckStatus == enums.RecordStatus.CheckedIn || ItemCheckStatus == enums.RecordStatus.Non_Controlled) {
                            SCheckOut = true;
                        }
                        if (ItemCheckStatus != CheckStatus) {
                            CheckStatus = enums.RecordStatus.UnDefined;
                            // break;
                        }
                    } else {
                        CheckStatus = MainGrid.GetSelectedRowValues()[recordKeys[i]].CheckStatus;
                        if (CheckStatus == enums.RecordStatus.checkedOutBySelfDifferentPc || ItemCheckStatus == enums.RecordStatus.checkedOutByself) {
                            SCheckIn = true;
                        }
                        if (CheckStatus == enums.RecordStatus.CheckedIn || ItemCheckStatus == enums.RecordStatus.Non_Controlled) {
                            SCheckOut = true;
                        }
                    }
                }
                // }

                CtxDocGrid.GetItemByName("CheckIn").SetEnabled(SCheckIn);
                CtxDocGrid.GetItemByName("CheckOut").SetEnabled(SCheckOut);
                //if (CheckStatus !== enums.RecordStatus.UnDefined) {
                //    if (CheckStatus === enums.RecordStatus.CheckedIn || CheckStatus === enums.RecordStatus.Non_Controlled) {
                //        window.CtxDocGrid.GetItemByName("CheckOut").SetEnabled(true);
                //    } else if (CheckStatus === enums.RecordStatus.checkedOutBySelfDifferentPc ||
                //        CheckStatus === enums.RecordStatus.checkedOutByself) {
                //        window.CtxDocGrid.GetItemByName("CheckIn").SetEnabled(true);
                //    }
                //}
                //if (SCheckIn && SCheckOut) {
                //    CtxDocGrid.GetItemByName("CheckIn").SetEnabled(true);
                //    CtxDocGrid.GetItemByName("CheckOut").SetEnabled(true);
                //}

                //Has Primary Reference Rights
                window.CtxDocGrid.GetItemByName("PrimaryReference").SetVisible(gridViewDocuments.cpHasPrimaryReference);
                if (CheckStatus === enums.RecordStatus.CheckedOut ||
                    CheckStatus === enums.RecordStatus.checkedOutBySelfDifferentPc ||
                    CheckStatus === enums.RecordStatus.checkedOutByself) {
                    window.CtxDocGrid.GetItemByName("UpdateLinkedRecordValues").SetEnabled(true);
                } else {
                    window.CtxDocGrid.GetItemByName("UpdateLinkedRecordValues").SetEnabled(false);
                }

            }
            else if (AppV.GetHomeObjects().MenuSelected === enums.HomeModules.MyWork) {
                CtxMyWorkGrid.SetEnabled(true);
                if (AppV.GetMyWorkState().ModuleSelected === enums.TOT.Cases ||
                    AppV.GetMyWorkState().ModuleSelected === enums.TOT.Process ||
                    AppV.GetMyWorkState().ModuleSelected === enums.TOT.Reports) {
                    CtxMyWorkGrid.GetItemByName("CheckIn").SetVisible(false);
                    CtxMyWorkGrid.GetItemByName("OpenFile").SetVisible(false);
                } else {
                    CtxMyWorkGrid.GetItemByName("CheckIn").SetVisible(true);
                    CtxMyWorkGrid.GetItemByName("OpenFile").SetVisible(true);
                    //if (AppV.GetMyWorkState().ModuleSelected == enums.TOT.Objects) {
                    //    var result = Helper.FilterGridSelectedKeysOnPage("gridViewDocuments", "idRecord")[0];
                    //    if (result != null) {
                    //        if (result.ObjectType == enums.ObjectTypes.SWPDM) {
                    //            window.CtxMyWorkGrid.GetItemByName("CheckIn").SetEnabled(false);
                    //            window.CtxMyWorkGrid.GetItemByName("OpenFile").SetEnabled(false);
                    //        }
                    //    }
                    //}
                }
            }
            else if (AppV.GetHomeObjects().MenuSelected === enums.HomeModules.Tasks) {
                CtxMenuTaskMain.SetEnabled(true);
            }
            if (AppV.GetGlobals().ModuleName === enums.Modules.Projects) {
                var visible = AppV.GetGlobals().ObjectType === enums.ObjectTypes.CustomCases;
                CtxCasesGrid.GetItemByName("ProjectsPlanning").SetVisible(!visible);
            }

            _InternalFunctions.ShowContextMenu(e);
        },
        ShowContextMenu: function (e) {

            if (e.objectType === "row" || e.objectType === "emptyrow") {

                gridViewDocuments.SetFocusedRowIndex(e.index);


                var x = ASPxClientUtils.GetEventX(e.htmlEvent);
                var y = ASPxClientUtils.GetEventY(e.htmlEvent);

                setTimeout(function () {
                    if ((AppV.GetGlobals().ModuleName === enums.Modules.Documents ||
                        AppV.GetGlobals().ModuleName === enums.Modules.Processes ||
                        AppV.GetGlobals().ModuleName === enums.Modules.Projects) && (AppV.GetGlobals().IsSpecialObject === true)) {

                        window.CtxSpecialObjectGridMain.ShowAtPos(x, y);
                    }
                    else if (AppV.GetGlobals().ModuleName === enums.Modules.Documents) {
                        window.CtxDocGrid.ShowAtPos(x, y);
                    } else if (AppV.GetGlobals().ModuleName === enums.Modules.Processes) {
                        window.CtxProcessGrid.ShowAtPos(x, y);
                    } else if (AppV.GetGlobals().ModuleName === enums.Modules.Projects) {
                        window.CtxCasesGrid.ShowAtPos(x, y);
                    } else if (AppV.GetGlobals().ModuleName === enums.Modules.Contacts) {
                        window.CtxContactsGrid.ShowAtPos(x, y);
                    } else if (AppV.GetGlobals().ModuleName === enums.Modules.Home) {
                        if (AppV.GetHomeObjects().MenuSelected === enums.HomeModules.Tasks) {
                            window.CtxMenuTaskMain.ShowAtPos(x, y);
                        } else if (AppV.GetHomeObjects().MenuSelected === enums.HomeModules.MyWork) {
                            window.CtxMyWorkGrid.ShowAtPos(x, y);
                        }
                        else if (AppV.GetHomeObjects().MenuSelected === enums.HomeModules.Timesheets) {
                            window.CtxTimesheetsGrid.ShowAtPos(x, y);
                        }
                    }


                },
                    10);

                window.App.Global.ClearBottomTabStates();


                if ((AppV.GetGlobals().ModuleName !== enums.Modules.Home) &&
                    (AppV.GetHomeObjects().MenuSelected !== enums.HomeModules.Tasks) &&
                    (AppV.GetHomeObjects().MenuSelected !== enums.HomeModules.Timesheets) &&
                    (AppV.GetHomeObjects().MenuSelected !== enums.HomeModules.MyWork) && e.index !== -1) {
                    AppV.pushGlobalState("RecordId", gridViewDocuments.GetRowKey(e.index));
                    if (typeof MainGrid.GetGridRowData(e.index) === "undefined") {
                        Helper.FilterGridSelectedKeysOnPage("gridViewDocuments", "idRecord")
                            .forEach(function (result, index) {
                                _State._push({
                                    visibleIndex: index,
                                    RecordId: result.idRecord,
                                    RecordGuid: result.RecordGuid,
                                    CheckStatus: result.ChkStatus,
                                    PartNumber: result._System_objNBS,
                                    Description: result._System_objDescription,
                                    ObjectId: result.ObjectId,
                                    FileName: result.FileName,
                                    AutoNumber: result._System_ObjNbsAuto,
                                    UrlEncrypted: result.UrlEncrypted,
                                    UserCreatedId: result.UserCreatedId,
                                    UrlEncryptedParent: result.UrlEncryptedParent,
                                    ParentObjectId: result.ParentObjectId,
                                    ParentRecordId: result.ParentRecordId,
                                    SubObjectGuid: result.SubObjectGuid,
                                    HasFieldGroupRights: result.HasFieldGroupRights
                                });
                            });
                    }
                    AppV.pushGlobalState("RecordGuid", MainGrid.GetGridRowData(e.index).RecordGuid);
                }

            }
        },
        exportMainGridToExcel: function () {
            App.Exporting = true;
            gridViewDocuments.ExportTo(ASPxClientGridViewExportFormat.Xlsx);
        },
        openRecordMainGrid: function (visibleIndex = -1) {
            var recordKeys = Object.keys(MainGrid.GetSelectedRowValues());
            if (recordKeys.length > 0) {
                if (recordKeys.length > 5) {
                    Notification.SetNotification(Helper.T("Can not open more than 5 records at the same time"), 'warning', 2500);
                    return;
                }
                recordKeys.forEach(function (key, index) {
                    var selectedRow = MainGrid.GetSelectedRowValues()[key];
                    if (typeof selectedRow == "undefined" || selectedRow == null) {
                        Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
                        return;
                    }
                    if (selectedRow.HasFieldGroupRights == false) {
                        Notification.SetNotification(SwResourceObject.YouDoNotHavePermissionToViewThisRecord, 'warning', 2500);
                        return;
                    }

                    broadcastV.create({ endPoint: "MainGrid" });

                    Helper.open('/PropertyCard/Index/' + selectedRow.UrlEncrypted, '_blank');
                });
            } else {
                var selectedRow = (visibleIndex === -1 ? MainGrid.GetGridRowData() : MainGrid.GetGridRowData(visibleIndex));

                if (typeof selectedRow == "undefined" || selectedRow == null) {
                    Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
                    return;
                }
                if (selectedRow.HasFieldGroupRights == false) {
                    Notification.SetNotification(SwResourceObject.YouDoNotHavePermissionToViewThisRecord, 'warning', 2500);
                    return;
                }

                broadcastV.create({ endPoint: "MainGrid" });

                Helper.open('/PropertyCard/Index/' + selectedRow.UrlEncrypted, '_blank');
            }

        },

        NewFrom: function () {
            if ((typeof cbpPropertyCardSectionBottom != "undefined" ? cbpPropertyCardSectionBottom.InCallback() : false) || (typeof cbpPrpCardBtmSection != "undefined" ? cbpPrpCardBtmSection.InCallback() : false)) {
                setTimeout(function () {
                    MainGrid.ContextMenu.Documents.ItemClick({}, { item: { name: "NewFrom" } });
                }, 1000);
                return;
            }
            FieldVaildation.SetnewFrom(true);
            View.load("NewFrom",
                {
                    objectId: AppV.GetGlobals().ObjectId,
                    recordId: Number(AppV.GetGlobals().RecordId),
                    recordGuid: AppV.GetGlobals().RecordGuid,
                    subObjectGuid: AppV.GetGlobals().SubObjectGuid,
                    isPreviewMode: false,
                    hasEditRights: true,
                    keepNbs: false
                });

        },
        OpenFile: function (records = []) {
            var fields = [
                "RecordId",
                "FileName",
                "ObjectId",
                "RecordGuid"
            ];

            var filesJson = [];
            if (records.length > 0) {
                filesJson = records;
            } else {
                var recordKeys = Object.keys(MainGrid.GetSelectedRowValues());

                recordKeys.forEach(function (key, index) {

                    var singleItem = new Array(
                        MainGrid.GetSelectedRowValues()[key].RecordId,
                        MainGrid.GetSelectedRowValues()[key].FileName,
                        MainGrid.GetSelectedRowValues()[key].ObjectId,
                        MainGrid.GetSelectedRowValues()[key].RecordGuid
                    );

                    filesJson.push(singleItem);
                });
            }
            var downloadData = JSON.stringify(Helper.PrepareDownloadData(fields, filesJson));

            RelatedFiles.FileDownload.DownloadMultiplePrimaryFiles(downloadData);
        },
        OpenTask: function() {
            var focusedRow = Helper.FilterGridFocusedRowKey("gridViewDocuments", "idRecord");

            if (MainGrid.GetGridRowData() == undefined &&
                focusedRow == undefined) {
                Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
                return;
            }
            var taskId = -1;
            if (MainGrid.GetGridRowData() !== undefined) {
                taskId = MainGrid.GetGridRowData().RecordId;
            } else if (focusedRow !== undefined) {
                taskId = focusedRow[0].idRecord;
            } 

            if (taskId !== null && taskId !== -1) {

                //TODO: change this check
                if (typeof CreateTaskPopUp !== "undefined" && ASPxClientUtils.IsExists(CreateTaskPopUp)) {
                    CreateTaskPopUp.PerformCallback({
                        taskIdParam: taskId,
                        IsEditMode: true
                    });
                    CreateTaskPopUp.Show();
                }
                else {
                    View.load("CreateTaskPopUp",
                        {
                            taskIdParam: taskId,
                            IsEditMode: true
                        });
                }
            }
            else {
                Notification.SetNotification(SwResourceObject.PleaseSelectAnItem);
            }
        },
        UpdateLinkedRecordValues: function () {
            var selectedRecord = [];


            Helper.FilterGridSelectedKeysOnPage("gridViewDocuments", "idRecord")
                .forEach(function (result, index) {
                    if (result.ChkStatus === enums.RecordStatus.CheckedOut ||
                        result.ChkStatus === enums.RecordStatus.checkedOutBySelfDifferentPc ||
                        result.ChkStatus === enums.RecordStatus.checkedOutByself) {
                        selectedRecord.push(result.idRecord);
                    }
                });

            if (selectedRecord.length !== 0) {
                window.loadingPanel.Show();
                $.ajax({
                    type: "POST",
                    url: '/Main/UpdateLinkedRecordValues/',
                    data: {
                        "objectId": AppV.GetGlobals().ObjectId,
                        "selectedRecord": selectedRecord
                    },
                    dataType: "json",
                    success: function (response) {
                        response = JSON.parse(response.data);
                        if (response.Success) {
                            if (response.Message !== "") {
                                Notification.SetNotification(response.Message, 'warning', 2500);
                            }
                            MainGrid.PerformCallback(true);
                        } else {
                            if (response.Message !== "") {
                                Notification.SetNotification(response.Message, 'warning', 2500);
                            }
                        }
                        window.loadingPanel.Hide();
                    }
                });
            } else {
                Notification.SetNotification(window.SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
            }
        },
        CheckIn: function () {
            window.loadingPanel.Show();
            var listRecords = [];

            var hasItemsWithOtherStatus = false;
            var recordKeys = Object.keys(MainGrid.GetSelectedRowValues());
            if (recordKeys.length > 0) {
                recordKeys.forEach(function (key, index) {
                    var checkStatus = MainGrid.GetSelectedRowValues()[key].CheckStatus;
                    if (checkStatus == enums.RecordStatus.checkedOutBySelfDifferentPc || checkStatus == enums.RecordStatus.checkedOutByself) {
                        listRecords.push({
                            RecordId: MainGrid.GetSelectedRowValues()[key].RecordId,
                            RecordGuid: MainGrid.GetSelectedRowValues()[key].RecordGuid,
                            PartNumber: MainGrid.GetSelectedRowValues()[key].PartNumber,
                            StageId: Processes.State.StageId
                        });
                    } else {
                        hasItemsWithOtherStatus = true;
                    }
                });
                if (hasItemsWithOtherStatus) {
                    Notification.SetNotification(SwResourceObject.RecordsCheckedOutByOtherUsersWereIgnored, 'warning', 2500);
                }
                var objectId = AppV.GetGlobals().ObjectId;
                var subObjectGuid = AppV.GetGlobals().SubObjectGuid;
                if (AppV.GetHomeObjects().MenuSelected == enums.HomeModules.MyWork) {
                    var result = Helper.FilterGridSelectedKeysOnPage("gridViewDocuments", "idRecord")[0];
                    if (result != null) {
                        objectId = result.ObjectId;
                        subObjectGuid = "";
                    }
                }
                $.ajax({
                    type: "POST",
                    url: '/Properties/CheckIn/',
                    data: {
                        objectId: objectId,
                        subObjectGuid: subObjectGuid,
                        isContextmenu: true,
                        listRecords: JSON.stringify(listRecords)
                    },
                    // serializes the form's elements.
                    success: function (response) {

                        window.CheckIn.ResponseData = JSON.parse(response.data);
                        if (AppV.GetGlobals().ObjectType !== enums.ObjectTypes.SWPDM) {
                            var reloadGrid = false;
                            var listRecordsForModal = [];
                            CheckIn.ResponseData.forEach(function (entry) {

                                if (entry.CustomAction.showModal &&
                                    entry.CustomAttributes.workingObjectContext != null) {
                                    listRecordsForModal.push(entry.CustomAttributes.workingObjectContext);
                                } else if (entry.Success) {
                                    Notification.SetNotification(
                                        entry.CustomAttributes.PartNumber + ": " + SwResourceObject.CheckedIn,
                                        'success',
                                        3500);
                                    reloadGrid = true;
                                } else if (entry.Success === false) {
                                    DisableNeccesaryItemsOnAction(window.ActiveObjectsOnAction,
                                        false,
                                        enums.RibbonNames.Properties);
                                    Notification.SetNotification(
                                        entry.CustomAttributes.PartNumber + ": " + Helper.T(entry.Message),
                                        'warning',
                                        3500);
                                }

                            });
                            if (listRecordsForModal.length > 0) {
                                window.CheckIn.Events.check_in_modal(listRecordsForModal);
                            }
                            if (reloadGrid) {
                                MainGrid.PerformCbpCallback(true);
                            }

                        } else {
                            if (!CheckIn.ResponseData[0].CustomAction.showModal) {
                                View.loadDynamic("PDMPaswPopUp", { actionToPerform: enums.ActionToPerform.CheckIn }, enums.ActionToPerform.CheckIn, true);
                            }
                            else {
                                MainGrid.PerformCbpCallback(true);
                            }
                        }
                        window.loadingPanel.Hide();
                    }
                });

            } else {
                window.loadingPanel.Hide();
                Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
            }
        },
        CheckOut: function () {
            window.loadingPanel.Show();

            var listRecords = [];

            var recordKeys = Object.keys(MainGrid.GetSelectedRowValues());
            var hasItemsWithOtherStatus = false;

            if (recordKeys.length > 0) {

                recordKeys.forEach(function (key, index) {
                    var checkStatus = MainGrid.GetSelectedRowValues()[key].CheckStatus;
                    if (checkStatus == enums.RecordStatus.CheckedIn || checkStatus == enums.RecordStatus.Non_Controlled) {
                        listRecords.push({
                            RecordId: MainGrid.GetSelectedRowValues()[key].RecordId,
                            RecordGuid: MainGrid.GetSelectedRowValues()[key].RecordGuid,
                            PartNumber: MainGrid.GetSelectedRowValues()[key].PartNumber,
                            StageId: Processes.State.StageId,
                            SubObjectGuid: MainGrid.GetSelectedRowValues()[key].SubObjectGuid
                        });
                    } else {
                        hasItemsWithOtherStatus = true;
                    }
                });

                if (hasItemsWithOtherStatus) {
                    Notification.SetNotification(SwResourceObject.RecordsNotCheckedOutByYouWereIgnored, 'warning', 2500);
                }
                $.ajax({
                    type: "POST",
                    url: '/Properties/CheckOut/',
                    data: {
                        objectId: AppV.GetGlobals().ObjectId,
                        subObjectGuid: AppV.GetGlobals().SubObjectGuid,
                        isContextmenu: true,
                        listRecords: JSON.stringify(listRecords)
                    },
                    // serializes the form's elements.
                    success: function (response) {

                        window.CheckOut.ResponseData = JSON.parse(response.data);
                        if (AppV.GetGlobals().ObjectType !== enums.ObjectTypes.SWPDM) {
                            CheckOut.ResponseData.forEach(function (entry) {
                                if (entry.Success === false) {
                                    DisableNeccesaryItemsOnAction(window.ActiveObjectsOnAction, false, enums.RibbonNames.Properties);
                                    Notification.SetNotification(entry.CustomAttributes.PartNumber + ": " + Helper.T(entry.Message), 'warning', 3500);
                                }

                            });
                            if (window.CheckOut.ResponseData.length > 0) {
                                window.CheckOut.Events.check_out_modal(window.CheckOut.ResponseData);
                            }
                        } else {
                            if (!CheckOut.ResponseData[0].CustomAction.showModal) {
                                View.loadDynamic("PDMPaswPopUp", { actionToPerform: enums.ActionToPerform.CheckOut }, enums.ActionToPerform.CheckOut, true);
                            }
                            else {
                                MainGrid.PerformCbpCallback(true);
                            }
                        }
                        window.loadingPanel.Hide();
                    }
                });

            } else {
                window.loadingPanel.Hide();
                Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
            }
        },
        ExportDataFiles: function () {
            var selectedRecordId = [];
            var recordKeys = Object.keys(MainGrid.GetSelectedRowValues());
            if (recordKeys.length > 0) {
                recordKeys.forEach(function (key, index) {
                    selectedRecordId.push(MainGrid.GetSelectedRowValues()[key].RecordId);
                });
            } else {
                Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                return;
            }
            View.load("pcModalExportFilesDocuments", {
                objectId: AppV.GetGlobals().ObjectId,
                recordIds: selectedRecordId
            });
        }
    };

    return {


        GetSelectedRowValues: function () {
            return _State._get();
        },

        GetDataByRowKey: function (key) {
            return Object.keys(_State._get()).map(function (i) { return _State._get()[i]; })
                .filter(function (x) {
                    return String(x.RecordId) == String(key);
                })[0];
        },

        GetGridRowData: function (index) {
            return MainGrid.GetDataByRowKey(_InternalFunctions.GetFocusedRowKey(index));
        },

        ShouldReload: function (reload) {
            if (typeof reload !== 'undefined')
                _State.reload = reload;
            else
                return _State.reload;
        },
        UnSelectRow: function (key) {
            var row = MainGrid.GetGridRowData(key);
            _State._pop(row.visibleIndex);
        },
        ValidateSelectedRowsOnGrid: function () {
            _State._validateSelected();
        },

        ResetState: function () {
            _State._clear();
        },
        UiChanges: function (data) {
            switch (data.sender.name) {
                case View.Dom.ModuleMenu:
                    MainGrid.DashBoardViewer.ClearTimeInterval();
                    window[View.Dom.MainGrid].SetVisible(false);
                    break;
                case View.Dom.MainTree:
                    // if (!(AppV.GetGlobals().ModuleName == enums.Modules.Home)) {
                    //     if(typeof DocumentsShowAllCheckBox =="undefined"){
                    //         _State.toolbarHasChanged = true;
                    //     }else{
                    //         window.DocumentsShowAllCheckBox.SetChecked(JSON.parse(localStorage.getItem("showAllMainGrid"))[AppV.GetGlobals().ModuleName]);
                    //         window.IncludeSubfolders.SetChecked(JSON.parse(localStorage.getItem("includeSubFoldersMainGrid"))[AppV.GetGlobals().ModuleName]);
                    //     }
                    // }
                    break;
                //if(data.)


            }
        },
        Init: function (s, e) {
            UI.subscribe(MainGrid.UiChanges);
            if (AppV.GetHomeObjects().MenuSelected === enums.HomeModules.Tasks ||
                AppV.GetHomeObjects().MenuSelected === enums.HomeModules.MyWork ||
                AppV.GetHomeObjects().MenuSelected === enums.HomeModules.Timesheets ||
                AppV.GetHomeObjects().ModuleName === enums.Modules.Home ||
                AppV.GetGlobals().ModuleName === enums.Modules.Home
            ) { //|| AppV.GetHomeObjects().ModuleName == undefined
                window.App.Global.SplitterResize();
                var searchPanel = document.getElementById('gridViewDocuments_DXSearchPanel');
                var filterRow = document.getElementById('gridViewDocuments_DXFilterRow');
                if (searchPanel != null) {
                    document.getElementById('gridViewDocuments_DXSearchPanel').style.display = "none";
                }
                if (filterRow != null) {
                    document.getElementById('gridViewDocuments_DXFilterRow').style.display = "none";
                }
                gridViewDocuments.AdjustControl();
                //if (AppV.GetHomeObjects().MenuSelected == enums.HomeModules.MyWork
                //    || AppV.GetHomeObjects().MenuSelected == enums.HomeModules.Tasks) {
                //    window.cbpSimpleSearch.PerformCallback({
                //        objectId: -1,
                //        menuSelected: AppV.GetHomeObjects().MenuSelected
                //    });
                //}
                return;
            }
            if (AppV.GetGlobals().RecordId < 0 && AppV.GetAdditionalInfo().firstSystemLoad && typeof Helper.FilterTreelistFocusedNodeKey("MainTreeList", "SectionId")[0] != "undefined") {


                var result = Helper.FilterTreelistFocusedNodeKey("MainTreeList", "SectionId")[0];

                //    window.MainTreeList.GetNodeValues(window.MainTreeList.GetFocusedNodeKey(),'ObjectId;SectionId;UrlEncrypted;SubObjectGuid;SubObjectId;ObjectType',function (result) {
                AppV.pushGlobalState({
                    "ObjectId": result.ObjectId,
                    "SectionId": result.SectionId || "",
                    "AddNewUrlEncrypted": result.UrlEncrypted || "",
                    "SubObjectGuid": result.SubObjectGuid || "",
                    "SubObjectId": result.SubObjectId,
                    "ObjectType": result.ObjectType
                });

                //IF reload, or first click tree
                if (result.ObjectId > 0 &&
                    AppV.GetGlobals().RecordId < 0 &&
                    AppV.GetAdditionalInfo().firstSystemLoad &&
                    s.GetFocusedRowIndex() == -1) {
                    //AppV.PushAdditionalInfo("firstSystemLoad", false);

                    //SimpleSerach
                    window.cbpSimpleSearch.PerformCallback({
                        objectId: result.ObjectId
                    });


                    //Send To Process
                    if (AppV.GetGlobals().ModuleName === enums.Modules.Documents
                        || AppV.GetGlobals().ModuleName === enums.Modules.Cases || AppV.GetGlobals().ModuleName === enums.Modules.Projects) {
                        cbpSendToProcessCombo.PerformCallback({
                            actionToPerform: ActionToPerform.MainGridDisplay,
                            isPopUp: false,
                            objectId: AppV.GetGlobals().ObjectId
                        })
                    }

                    MainGrid.PerformCbpCallback(true);
                }
                AppV.PushAdditionalInfo("firstSystemLoad", false);

                //   });

            }


            // if ((gridViewDocuments.GetSelectedKeysOnPage().length == 1)) {
            //     MainGrid.ResetState();
            //     MainGrid.PushSelectedRowsToGridState(gridViewDocuments.focusedRowIndex, performSingleClick);
            // }
            window.App.Global.SplitterResize();
            if (gridViewDocuments.GetColumn(1).visible) {
                $(".HideImagesCss").show();
                $(".ShowImagesCss").hide();
            } else {
                $(".HideImagesCss").hide();
                $(".ShowImagesCss").show();
            }

            var itemShowVerticalGridLines = MainRibbon.GetItemByName('ShowVerticalGridLines');
            if (itemShowVerticalGridLines != "undefined" || itemShowVerticalGridLines != null) {
                itemShowVerticalGridLines.SetValue(Helper.stringToBoolean((Helper.GetCookie(enums.CookieKey.SHOWVERTICALGRIDLINES))));
            }
            var itemShowBandedRows = MainRibbon.GetItemByName('ShowBandedRows');
            if (itemShowBandedRows != "undefined" || itemShowBandedRows != null) {
                itemShowBandedRows.SetValue(Helper.stringToBoolean((Helper.GetCookie(enums.CookieKey.SHOWBANDEDROWS))));
            }
            MenuBar.SetDashboardVisibility();

            MainGrid.SetViewerRights();
            // if (Helper.stringToBoolean((Helper.GetCookie(enums.CookieKey.SHOWRECORDIMAGE)))) {
            //     MainRibbonV.showHideImageColumns("ShowImages", false);
            // } else {
            //     MainRibbonV.showHideImageColumns("HideImages", false);
            // }
        },

        PerformCallback: function (reload = false, filterId = -1) {
            if (typeof gridViewDocuments === "undefined")
                return;

            MainGrid.ShouldReload(reload);

            window.gridViewDocuments.PerformCallback({
                filterId: filterId
            });
        },

        PerformCbpCallback: function (reload = false, filterId = -1) {
            MainGrid.ShouldReload(reload);
            window.cbpDocumetGrid.PerformCallback({
                filterId: filterId
            });
        },

        BeginCallback: function (s, e) {

            e.customArgs["id"] = AppV.GetGlobals().ObjectId;
            e.customArgs["SectionId"] = AppV.GetGlobals().SectionId;
            e.customArgs["simpleSearchFor"] =
                (simpleSearch.ButtonClicked === 1) ? window.btnSimpleSearch.GetValue() : "";
            e.customArgs["SimpleSearchLimitRecords"] = window.SimpleSearchLimitRecords.GetValue();
            e.customArgs["IsExport"] = App.Exporting;

            if ((AppV.GetGlobals().ModuleName != enums.Modules.Home) &&
                (AppV.GetHomeObjects().MenuSelected != enums.HomeModules.Tasks) &&
                (AppV.GetHomeObjects().MenuSelected != enums.HomeModules.MyWork)) {
                e.customArgs["bShowAll"] = JSON.parse(localStorage.getItem("showAllMainGrid"))[AppV.GetGlobals().ModuleName];//window.DocumentsShowAllCheckBox.GetChecked();
                e.customArgs["subfolders"] = JSON.parse(localStorage.getItem("includeSubFoldersMainGrid"))[AppV.GetGlobals().ModuleName];//window.IncludeSubfolders.GetChecked();
            }

            e.customArgs["HomeModuleName"] = (AppV.GetGlobals().ModuleName == enums.Modules.Home)
                ? AppV.GetHomeObjects().MenuSelected
                : "";
            e.customArgs["myWorkingModule"] = AppV.GetMyWorkState().ModuleSelected;
            e.customArgs["docFilestatus"] = AppV.GetMyWorkState().FileStatusSelected;
            e.customArgs["onlyAssignedToMe"] = AppV.GetMyWorkState().AssignedToSelected;

            e.customArgs["showCompleted"] = AppV.GetTasksHomeState().ShowCompleted;
            e.customArgs["TaskFilterId"] = AppV.GetTasksHomeState().TreeSelected;
            e.customArgs["currentPage"] = AppV.GetGlobals().currentPage;
            e.customArgs["pageSizeItem"] = AppV.GetGlobals().pageSizeItem;

            e.customArgs["showApproved"] = AppV.GetTimesheetsHomeState().ShowApproved;
            e.customArgs["isUser"] = AppV.GetTimesheetsHomeState().isUser;
            e.customArgs["StageId"] = AppV.GetTimesheetsHomeState().StageId;
            e.customArgs["UserId"] = AppV.GetTimesheetsHomeState().UserId;

            //SpecialObject ids
            e.customArgs["GroupObjectId"] = AppV.GetGlobals().GroupObjectId;
            e.customArgs["RelatedObjectId"] = AppV.GetGlobals().RelatedObjectId;
            e.customArgs["IsSpecialObject"] = AppV.GetGlobals().IsSpecialObject;

            simpleSearch.ButtonClicked = 0;

            //if (e.command === "COLUMNMOVE" && window.showImageClicked === false) {
            //    e.customArgs["saveLayout"] = true;
            //}
            //window.showImageClicked = false;
            //MainRibbonV.SetShowHideImageClicked(false);

            e.customArgs["reloadGrid"] = MainGrid.ShouldReload();

            MainGrid.ShouldReload(false);
            if (AppV.GetGlobals().AddNewUrlEncrypted !== "") {
                var url = RootUrl + 'Main/Grid/' + AppV.GetGlobals().AddNewUrlEncrypted;
                window.history.pushState({ urlPath: url }, null, url);
            }
        },

        //Handles grid row click and double click. If double click is triggered click will not happen.
        OnGridViewRowClickHandle: function (s, e) {

            var grid = MVCxClientGridView.Cast(s);
            var key = grid.GetRowKey(e.visibleIndex);
            _State.RowClick.senderArray[_State.RowClick.clicks] = key;
            _State.RowClick.clicks++;
            if (_State.RowClick.clicks === 1 && _State.RowClick.senderArray[0] != _State.RowClick.senderArray[1]
            ) { //Single click
                _State.RowClick.timer = setTimeout(function () {

                    _State.RowClick.enderArray = [];
                    _State.RowClick.clicks = 0;
                    MainGrid.PushSelectedRowsToGridState(e.visibleIndex, _InternalFunctions.OnGridViewRowClick);

                },
                    _State.RowClick.Delay);

            } else if (_State.RowClick.senderArray.length > 0 &&
                _State.RowClick.senderArray[0] == _State.RowClick.senderArray[1]) { //Double click
                clearTimeout(_State.RowClick.timer);
                _State.RowClick.senderArray = [];
                _State.RowClick.clicks = 0;
                MainGrid.PushSelectedRowsToGridState(e.visibleIndex, _InternalFunctions.OnGridViewDoubleRowClick);

            }
        },

        PushSelectedRowsToGridState: function (visibleIndex, callback, e = null) {

            // IMPORTANT : DONT change anything here if you are not sure what you are doing!
            MainGrid.ShouldReload(false);
            if (visibleIndex == -1 && gridViewDocuments.GetSelectedKeysOnPage().length == 0) {
                MainGrid.ResetState();
                return;
            }

            //if select all
            if (visibleIndex == -1 && gridViewDocuments.GetSelectedKeysOnPage().length > 0) {
                MainGrid.ResetState();

                //JSON.parse(gridViewDocuments.cpAllRowData).forEach(function (result, index) {
                //    _State._push({
                //        visibleIndex: index,
                //        RecordId: result.idRecord,
                //        RecordGuid: result.RecordGuid,
                //        CheckStatus: result.ChkStatus,
                //        PartNumber: result._System_objNBS,
                //        Description: result._System_objDescription,
                //        ObjectId: result.ObjectId,
                //        FileName: result.FileName,
                //        AutoNumber: result._System_ObjNbsAuto,
                //        UrlEncrypted: result.UrlEncrypted,
                //        UserCreatedId: result.UserCreatedId,
                //        UrlEncryptedParent: result.UrlEncryptedParent,
                //        ParentObjectId : result.ParentObjectId
                //    });
                //});


                Helper.FilterGridSelectedKeysOnPage("gridViewDocuments", "idRecord")
                    .forEach(function (result, index) {
                        _State._push({
                            visibleIndex: index,
                            RecordId: result.idRecord,
                            RecordGuid: result.RecordGuid,
                            CheckStatus: result.ChkStatus,
                            PartNumber: result._System_objNBS,
                            Description: result._System_objDescription,
                            ObjectId: result.ObjectId,
                            FileName: result.FileName,
                            AutoNumber: result._System_ObjNbsAuto,
                            UrlEncrypted: result.UrlEncrypted,
                            UserCreatedId: result.UserCreatedId,
                            UrlEncryptedParent: result.UrlEncryptedParent,
                            ParentObjectId: result.ParentObjectId,
                            ParentRecordId: result.ParentRecordId,
                            SubObjectGuid: result.SubObjectGuid,
                            HasFieldGroupRights: result.HasFieldGroupRights
                        });
                    });


                // RecordGuid was empty
                if (gridViewDocuments.GetSelectedKeysOnPage().length == 1) {
                    if (gridViewDocuments.GetFocusedRowIndex() != visibleIndex
                        && e == null
                        && MainGrid.GetGridRowData(gridViewDocuments.GetFocusedRowIndex()) != undefined) {
                        AppV.pushState("Global",
                            {
                                RecordId: MainGrid.GetGridRowData(gridViewDocuments.GetFocusedRowIndex()).RecordId,
                                RecordGuid: MainGrid.GetGridRowData(gridViewDocuments.GetFocusedRowIndex()).RecordGuid
                            });

                        if (AppV.GetGlobals().ModuleName === enums.Modules.Home && AppV.GetHomeObjects().MenuSelected === enums.HomeModules.Timesheets) {
                            AppV.pushState("Global", {
                                ObjectId: MainGrid.GetGridRowData(gridViewDocuments.GetFocusedRowIndex()).ObjectId,
                                ObjectType: enums.ObjectTypes.TimeSheet
                            });
                        }
                    }
                }
            } else {
                var isFunctionCallback = (typeof callback === "function");
                //removes node from selected rows
                if (MainGrid.GetGridRowData(visibleIndex) != undefined) {
                    if (isFunctionCallback &&
                        (callback.name == "OnGridViewRowClick" || callback.name == "OnGridViewDoubleRowClick")) {
                        if (Object.keys(MainGrid.GetSelectedRowValues()).length < 2) {
                            callback(visibleIndex);
                            return;
                        }
                    } else {
                        MainGrid.UnSelectRow(visibleIndex);
                        MainGrid.ValidateSelectedRowsOnGrid();
                        return;
                    }

                }

                MainGrid.ShouldReload(false);

                if (!gridViewDocuments.GetSelectedKeysOnPage().includes(gridViewDocuments.GetRowKey(visibleIndex))) {
                    return;
                }

                if (gridViewDocuments.GetSelectedKeysOnPage().length == 1) {
                    if (gridViewDocuments.GetFocusedRowIndex() != visibleIndex && e == null) {
                        return;
                    }
                }

                MainGrid.ResetState();

                Helper.FilterGridSelectedKeysOnPage("gridViewDocuments", "idRecord")
                    .forEach(function (result, index) {
                        _State._push({
                            visibleIndex: index,
                            RecordId: result.idRecord,
                            RecordGuid: result.RecordGuid,
                            CheckStatus: result.ChkStatus,
                            PartNumber: result._System_objNBS,
                            Description: result._System_objDescription,
                            ObjectId: result.ObjectId,
                            FileName: result.FileName,
                            AutoNumber: result._System_ObjNbsAuto,
                            UrlEncrypted: result.UrlEncrypted,
                            UserCreatedId: result.UserCreatedId,
                            UrlEncryptedParent: result.UrlEncryptedParent,
                            ParentObjectId: result.ParentObjectId,
                            ParentRecordId: result.ParentRecordId,
                            SubObjectGuid: result.SubObjectGuid,
                            HasFieldGroupRights: result.HasFieldGroupRights
                        });
                    });



                AppV.pushState("Global",
                    {
                        RecordId: MainGrid.GetGridRowData(visibleIndex).RecordId,
                        RecordGuid: MainGrid.GetGridRowData(visibleIndex).RecordGuid
                    });

                if (isFunctionCallback) {

                    if (callback.name == "OnGridViewRowClick" || callback.name == "OnGridViewDoubleRowClick") {
                        if (Object.keys(MainGrid.GetSelectedRowValues()).length < 2) {
                            callback(visibleIndex);
                        }
                    } else if (callback.name == "performSingleClick") {

                        var focusedRecordId = parseInt(gridViewDocuments.GetRowKey(visibleIndex));
                        AppV.pushGlobalState("RecordId", focusedRecordId);
                        callback(AppV.GetGlobals().ObjectId, focusedRecordId, visibleIndex, null);

                    } else if (callback.name == "setEnabledContextMenu" ||
                        callback.name == "ShowProcessContextMenu") {
                        callback(e);
                    }
                }

            }
        },

        SelectionChanged: function (s, e) {
            MainGrid.PushSelectedRowsToGridState(e.visibleIndex, null);
        },

        ColumnResized: function (s, e) {
            simpleSearch.ButtonClicked = 1;
            MainGrid.PerformCallback(true);
        },

        EndCallback: function (s, e) {
            try {
                App.Exporting = false;
                if (AppV.GetGlobals().ModuleName == enums.Modules.Home) {
                    MainRibbon.GetItemByName("New").SetEnabled(false);
                    var searchPanel = document.getElementById('gridViewDocuments_DXSearchPanel');
                    var searchPanelRow = document.getElementById('gridViewDocuments_DXFilterRow');
                    //if (AppV.GetHomeObjects().MenuSelected == enums.HomeModules.MyWork) {
                    //    if (searchPanel != null) {
                    //        searchPanel.style.display = (AppV.GetMyWorkState().PanelSearchShow) ? "" : "none";
                    //    }
                    //    if (searchPanelRow != null) {
                    //        searchPanelRow.style.display =  (AppV.GetMyWorkState().RowFilterShow) ? "" : "none";
                    //    }
                    //}
                    //else if (AppV.GetHomeObjects().MenuSelected == enums.HomeModules.Tasks) {
                    //    if (searchPanel != null) {
                    //        //searchPanel.style.display = (AppV.GetTimesheetsHomeState().PanelSearchShow) ? "" : "none";
                    //    }
                    //}
                    //else
                    if (AppV.GetHomeObjects().MenuSelected == enums.HomeModules.Timesheets) {
                        if (searchPanel != null) {
                            searchPanel.style.display = (AppV.GetTimesheetsHomeState().PanelSearchShow) ? "" : "none";
                        }
                    }
                    gridViewDocuments.AdjustControl();
                    //MainRibbon.GetItemByName("")
                    if (!gridViewDocuments.clientVisible) {
                        window.gridViewDocuments.SetVisible(true);
                    }
                    if (AppV.GetHomeObjects().MenuSelected == enums.HomeModules.MyWork
                        || AppV.GetHomeObjects().MenuSelected == enums.HomeModules.Tasks
                        || AppV.GetHomeObjects().MenuSelected == enums.HomeModules.Timesheets) {
                        window.cbpSimpleSearch.PerformCallback({
                            objectId: -1,
                            menuSelected: AppV.GetHomeObjects().MenuSelected
                        });
                        // cbpSendToProcessCombo.PerformCallback({
                        //     actionToPerform: ActionToPerform.MainGridDisplay,
                        //     isPopUp: false,
                        //     objectId: -1
                        // })
                    }
                } else {

                    //if (AppV.GetGlobals().ObjectType == enums.ObjectTypes.SWPDM || AppV.GetGlobals().ObjectId < 0)
                    //    MainRibbon.GetItemByName("New").SetEnabled(false);
                    //else
                    MainRibbon.GetItemByName("New").SetEnabled(true);
                    //if(_State.toolbarHasChanged){
                    window.DocumentsShowAllCheckBox.SetChecked(
                        JSON.parse(localStorage.getItem("showAllMainGrid"))[AppV.GetGlobals().ModuleName]);
                    window.IncludeSubfolders.SetChecked(
                        JSON.parse(localStorage.getItem("includeSubFoldersMainGrid"))[AppV.GetGlobals()
                            .ModuleName]);
                    //}
                    if (AppV.GetGlobals().RecordId < 0) {
                        gridViewDocuments.SelectRowOnPage(gridViewDocuments.focusedRowIndex, true);
                        var focusedRecordId = parseInt(gridViewDocuments.GetRowKey(gridViewDocuments.focusedRowIndex));
                        AppV.pushGlobalState("RecordId", focusedRecordId);
                        _InternalFunctions.performSingleClick(AppV.GetGlobals().ObjectId, focusedRecordId, gridViewDocuments.focusedRowIndex, null);
                        //MainGrid.PushSelectedRowsToGridState(_InternalFunctions.performSingleClick);
                    }
                    window["RefreshMainGrid"].SetVisible(true);

                    if (!gridViewDocuments.clientVisible && AppV.GetGlobals().ObjectId != -1) {
                        window.gridViewDocuments.SetVisible(true);
                    }
                    MainGrid.SetViewerRights();
                }

                if (AppV.GetHomeObjects().MenuSelected == enums.HomeModules.Tasks
                    || AppV.GetHomeObjects().MenuSelected == enums.HomeModules.Timesheets) {
                    window.MainRibbon.GetItemByName("OpenRecord").SetEnabled(false);
                }
                else {
                    if (gridViewDocuments.pageRowCount > 0) {
                        window.MainRibbon.GetItemByName("OpenRecord").SetEnabled(true);
                    } else {
                        window.MainRibbon.GetItemByName("OpenRecord").SetEnabled(false);
                    }
                }

                MainGrid.ShouldReload(false);
                window.gridViewDocuments.SetHeight((window.mainSplFullScreenMode.GetPaneByName("mainSplGridPanel").lastHeight - 0.1));
                window.gridViewDocuments.SetHeight((window.mainSplFullScreenMode.GetPaneByName("mainSplGridPanel").lastHeight - 0.2));
            } catch (ex) {
                console.log(ex);
            } finally {
                //SimpleSerach
                if (AppV.GetGlobals().ModuleName !== enums.Modules.Home) {
                    window.cbpSimpleSearch.PerformCallback({
                        objectId: AppV.GetGlobals().ObjectId
                    });
                }
                if (AppV.GetGlobals().ModuleName === enums.Modules.Documents || AppV.GetGlobals().ModuleName === enums.Modules.Cases
                    || AppV.GetGlobals().ModuleName === enums.Modules.Projects || AppV.GetGlobals().ModuleName === enums.Modules.Contacts) {
                    cbpSendToProcessCombo.PerformCallback({
                        actionToPerform: ActionToPerform.MainGridDisplay,
                        isPopUp: false,
                        objectId: AppV.GetGlobals().ObjectId
                    });
                }
            }
        },
        SetViewerRights() {
            if (Helper.GetCookie("IsViewer") == 1) {
                if (AppV.GetGlobals().ModuleName == enums.Modules.Processes) {
                    MainRibbon.GetItemByName("New").SetEnabled(true);
                } else {
                    MainRibbon.GetItemByName("New").SetEnabled(false);
                }
            }
        },
        OnCallbackError: function (s, e) {
            console.log(SwResourceObject.TheFollowingErrorsOccured + ":\n\n" + e.message);
            e.handled = true;
        },
        // Set Cookies for Show All items in Document GridView
        ShowAllCheckedChanged: function (s, e) {

            //sessionStorage.setItem("showAllMainGrid", window.DocumentsShowAllCheckBox.GetChecked());

            var obj = JSON.parse(localStorage.getItem("showAllMainGrid"));
            obj[AppV.GetGlobals().ModuleName] = DocumentsShowAllCheckBox.GetChecked();
            localStorage.setItem("showAllMainGrid", JSON.stringify(obj));
            MainGrid.PerformCallback(true);

        },
        ShowAllCheckedInit: function (s, e) {
            var localS = localStorage.getItem("showAllMainGrid");
            if (localS == null) {
                var objectToBeStored = {
                    "ModuleName-Documents": false,
                    "ModuleName-Processes": false,
                    "ModuleName-Projects": false,
                    "ModuleName-Home": false,
                };
                localStorage.setItem("showAllMainGrid", JSON.stringify(objectToBeStored));
            } else {
                var obj = JSON.parse(localS);
                DocumentsShowAllCheckBox.SetChecked(obj[AppV.GetGlobals().ModuleName]);
            }
        },

        IncludeSubfoldersCheckedChanged: function (s, e) {

            //sessionStorage.setItem("includeSubFoldersMainGrid", window.IncludeSubfolders.GetChecked());

            var obj = JSON.parse(localStorage.getItem("includeSubFoldersMainGrid"));
            obj[AppV.GetGlobals().ModuleName] = IncludeSubfolders.GetChecked();
            localStorage.setItem("includeSubFoldersMainGrid", JSON.stringify(obj));
            MainGrid.PerformCallback(true);

        },
        IncludeSubfoldersCheckedInit: function (s, e) {
            if (AppV.GetGlobals().ModuleName == enums.Modules.Processes ||
                AppV.GetGlobals().ModuleName == enums.Modules.Projects ||
                AppV.GetGlobals().ModuleName == enums.Modules.Contacts) {
                IncludeSubfolders.SetVisible(false);
            }

            var localS = localStorage.getItem("includeSubFoldersMainGrid");
            if (localS == null) {
                var objectToBeStored = {
                    "ModuleName-Documents": false,
                    "ModuleName-Processes": false,
                    "ModuleName-Projects": false,
                    "ModuleName-Home": false
                };
                localStorage.setItem("includeSubFoldersMainGrid", JSON.stringify(objectToBeStored));
            } else {
                var obj = JSON.parse(localS);
                DocumentsShowAllCheckBox.SetChecked(obj[AppV.GetGlobals().ModuleName]);
            }
        },

        LinkedRecordsButtonClick: function (s, e, columnName) {
            window.mLinkedRecord.name = s.name;
            window.mLinkedRecord.SystemName = columnName;
        },

        Pagination: {
            PageClick: function (s, e, page) {
                AppV.pushGlobalState("currentPage", page);
                MainGrid.PerformCbpCallback(true);
            },
            SelectedIndexChanged: function (s, e) {
                AppV.pushGlobalState("pageSizeItem", Number(CmbPageSizeItem.GetSelectedItem().value), true);
                AppV.pushGlobalState("currentPage", enums.Paggination.currentPage);
                MainGrid.PerformCbpCallback(true);
            }
        },
        MyWork: {
            Toolbar: {
                Click: function (s, e, myWorkModule) {
                    switch (s.name) {
                        case "MyWorkDocuments":
                        case "MyWorkProjects":
                        case "MyWorkProcesses":
                        case "MyWorkReports":
                            AppV.PushStateMyWork("ModuleSelected", myWorkModule);
                            AssignedToMeMyWorkMainGrid.SetVisible(false);
                            AssignedToMyGroupMyWorkMainGrid.SetVisible(false);
                            if (myWorkModule === enums.TOT.Cases || myWorkModule === enums.TOT.Process) {
                                AssignedToMeMyWorkMainGrid.SetVisible(true);
                                AssignedToMyGroupMyWorkMainGrid.SetVisible(true);
                            }
                            MainGrid.PerformCbpCallback(true);
                            break;
                        case "MyWorkRefresh":
                            MainGrid.PerformCallback(true);
                            break;
                        case "MyWorkSearch":
                            var searchBar = document.getElementById('gridViewDocuments_DXSearchPanel');
                            if (searchBar.style.display === "none") {
                                AppV.PushStateMyWork("PanelSearchShow", true);
                                searchBar.style.display = "block";
                            } else {
                                AppV.PushStateMyWork("PanelSearchShow", false);
                                searchBar.style.display = "none";
                            }
                            gridViewDocuments.AdjustControl();
                            break;
                        case "MyWorkFilters":
                            var filterRow = document.getElementById('gridViewDocuments_DXFilterRow');
                            if (filterRow.style.display === "none") {
                                filterRow.style.display = null;
                                AppV.PushStateMyWork("RowFilterShow", true);
                            } else {
                                AppV.PushStateMyWork("RowFilterShow", false);
                                filterRow.style.display = "none";
                            }
                            gridViewDocuments.AdjustControl();
                            break;
                        case "MyWorkExport":
                            _InternalFunctions.exportMainGridToExcel();
                            break;
                    }

                },

                Click_AssignedToMe: function (assignedToMe) {
                    AppV.PushStateMyWork("AssignedToSelected", Boolean(assignedToMe));
                    MainGrid.PerformCbpCallback(true);
                },
                AssignedToMeInit: function () {
                    if (AppV.GetMyWorkState().AssignedToSelected) {
                        document.getElementById("AssignedToMeMyWorkMainGrid").style.border = "";
                        document.getElementById("AssignedToMyGroupMyWorkMainGrid").style.border = "none";
                    } else {
                        document.getElementById("AssignedToMeMyWorkMainGrid").style.border = "none";
                        document.getElementById("AssignedToMyGroupMyWorkMainGrid").style.border = "";
                    }
                },
                SelectedIndexChanged: function (s, e) {
                    AppV.PushStateMyWork("FileStatusSelected", FileStatusMyWork.GetValue());
                    MainGrid.PerformCbpCallback(true);
                }
            }
        },
        Tasks: {
            Toolbar: {
                Click: function (s, e) {
                    switch (s.name) {
                        case "btnMainTasksRefresh":
                            MainGrid.PerformCallback(true);
                            break;
                        case "btnMainTasksHideShowSearchBar":
                            var searchBar = document.getElementById('gridViewDocuments_DXSearchPanel');
                            if (searchBar.style.display === "none") {
                                AppV.PushStateTasksHome("PanelSearchShow", true);
                                searchBar.style.display = "block";
                            } else {
                                AppV.PushStateTasksHome("PanelSearchShow", false);
                                searchBar.style.display = "none";
                            }
                            gridViewDocuments.AdjustControl();
                            break;
                        case "btnMainTasksNew":
                            if (typeof CreateTaskPopUp !== "undefined" && ASPxClientUtils.IsExists(CreateTaskPopUp)) {
                                CreateTaskPopUp.PerformCallback({
                                    isMainModule: true
                                });
                                CreateTaskPopUp.Show();
                            }
                            else {
                                View.load("CreateTaskPopUp",
                                    {
                                        isMainModule: true
                                    });
                            }

                            break;

                        case "btnMainTasksGoToProperties":
                            _InternalFunctions.OpenTask();
                            break;

                        case "btnMainTasksShowHideCompleted":
                            if (s.GetText() === SwResourceObject.HideCompleted) {
                                s.SetText(SwResourceObject.ShowCompleted);
                                MainGrid.ContextMenu.ShowCompletedTasksHome(false);
                            } else {
                                s.SetText(SwResourceObject.HideCompleted);
                                MainGrid.ContextMenu.ShowCompletedTasksHome(true);
                            }
                            break;
                        case "btnMainTasksExportExcel":
                            _InternalFunctions.exportMainGridToExcel();
                            break;
                    }

                }
            },
            Filter: {
                Init: function (s, e) {
                    var result = Helper.FilterTreelistFocusedNodeKey("MainTaskFilterTree", "Id", e.nodeKey)[0];
                    if (result != null) {
                        if (AppV.GetHomeObjects().MenuSelected === enums.HomeModules.Tasks) {
                            AppV.PushStateTasksHome("TreeSelected", result.Id);
                            MainGrid.PerformCbpCallback(true);
                        }
                        else if (AppV.GetHomeObjects().MenuSelected === enums.HomeModules.Timesheets) {
                            AppV.PushStateTimesheetsHome({
                                "TreeSelected": result.Id,
                                "isUser": result.isUser,
                                "StageId": result.StageId,
                                "UserId": result.UserId
                            });
                            MainGrid.PerformCbpCallback(true);
                        }
                    }
                },
                NodeClick: function (s, e) {
                    AppV.PushStateTasksHome("TreeSelected", Number(e.nodeKey));

                    if (e.nodeKey === "-1") {

                        var url = RootUrl + '';
                        window.history.pushState({ urlPath: url }, null, url);

                        gridViewDocuments.SetEnabled(false);
                        window.gridViewDocuments.SetVisible(false);

                        Main.Splitter.bottomSplitter.Close();

                        return;
                    }

                    if (AppV.GetHomeObjects().MenuSelected === enums.HomeModules.Timesheets) {
                        var result = Helper.FilterTreelistFocusedNodeKey("MainTaskFilterTree", "Id", e.nodeKey)[0];
                        if (result != null) {
                            AppV.PushStateTimesheetsHome({
                                "isUser": result.isUser,
                                "StageId": result.StageId,
                                "UserId": result.UserId
                            });
                        }
                        if (!AppV.GetTimesheetsHomeState().isUser &&
                            AppV.GetTimesheetsHomeState().StageId < 1) {
                            gridViewDocuments.SetEnabled(false);
                            return;
                        }
                    }
                    MainGrid.PerformCbpCallback(true);
                }
            }
        },
        Timesheets: {
            Toolbar: {
                Click: function (s, e) {
                    switch (s.name) {
                        case "btnMainTimesheetsNew":
                            Timesheets.CreateNewTimesheets();
                            break;
                        case "btnMainTimesheetsGoToProperties":
                            Timesheets.OpenTimesheets();
                            break;
                        case "btnMainTimesheetsShowHideApproved":
                            if (s.GetText() === SwResourceObject.ShowApproved) {
                                AppV.PushStateTimesheetsHome("ShowApproved", true);
                            } else {
                                AppV.PushStateTimesheetsHome("ShowApproved", false);
                            }
                            MainGrid.PerformCallback(true);
                            break;
                        case "btnMainTimesheetsExportExcel":
                            _InternalFunctions.exportMainGridToExcel();
                            break;
                        case "btnMainTimesheetsRefresh":
                            MainGrid.PerformCallback(true);
                            break;
                        case "btnMainTimesheetsHideShowSearchBar":
                            var searchBar = document.getElementById('gridViewDocuments_DXSearchPanel');
                            if (searchBar.style.display === "none") {
                                AppV.PushStateTimesheetsHome("PanelSearchShow", true);
                                searchBar.style.display = "block";
                            } else {
                                AppV.PushStateTimesheetsHome("PanelSearchShow", false);
                                searchBar.style.display = "none";
                            }
                            gridViewDocuments.AdjustControl();
                            break;
                    }
                }
            }

        },
        Record: {
            NewFrom: function () {
                _InternalFunctions.NewFrom();
            },

            IsActive: function (objectId, recordId, action) {
                $.ajax({
                    type: "POST",
                    url: '/Main/IsRecordActive/',
                    data: {
                        "objectId": objectId,
                        "idRecord": recordId
                    },
                    dataType: "json",
                    success: function (response) {
                        if (!response.Success) {
                            Notification.SetNotification(response.Message, 'warning', 2500);
                            return;
                        } else {
                            if (action === "NewFrom") {
                                
                            }
                        }
                    }
                });
            },

            DisableItemsForDeletedRecord: function (success) {
                if (typeof CtxDocGrid != "undefined") {
                    CtxDocGrid.SetEnabled(false);
                    CtxDocGrid.GetItemByName("New").SetEnabled(true);
                }
            },
        },
        PDM: {
            PdmIsConnectedAction: function (actionToPerform) {
                var objectId = AppV.GetGlobals().ObjectId;
                if (AppV.GetHomeObjects().MenuSelected == enums.HomeModules.MyWork) {
                    var result = Helper.FilterGridSelectedKeysOnPage("gridViewDocuments", "idRecord")[0];
                    if (result != null) {
                        objectId = result.ObjectId;
                    }
                }
                Request.ajax({
                    type: "POST",
                    url: '/PDM/PdmIsConnected/',
                    data: {
                        objectId: objectId,
                        actionToPerform: Number(actionToPerform)
                    }
                }).then(MainGrid.PDM.PDM_success_callback);
            },
            PaswKeyPress: function (s, e) {
                if (e.htmlEvent.keyCode === 13)
                    MainGrid.PDM.PasswOkClick();
            },
            PasswCancelClick: function (s, e, actionToPerform) {
                window["PdmPaswPopUp" + actionToPerform].Hide();
            },
            PasswOkClick: function (s, e) {
                var username = pdmUserNamePasswPopUp.GetValue() == null ? "" : pdmUserNamePasswPopUp.GetValue();
                var PasswordData = pdmPasswordPopUp.GetValue() == null ? "" : pdmPasswordPopUp.GetValue();
                var actionToPerform = pdmActionToPerform.GetValue() == null ? -1 : pdmActionToPerform.GetValue();
                var objectId = AppV.GetGlobals().ObjectId;
                var recordGuid = AppV.GetGlobals().RecordGuid;
                if (AppV.GetHomeObjects().MenuSelected == enums.HomeModules.MyWork) {
                    var result = Helper.FilterGridSelectedKeysOnPage("gridViewDocuments", "idRecord")[0];
                    if (result != null) {
                        objectId = result.ObjectId;
                        recordGuid = result.RecordGuid;
                    }
                }
                Request.ajax({
                    type: "POST",
                    url: '/PDM/ConnectPdm/',
                    data: {
                        username: username,
                        PasswordData: PasswordData,
                        objectId: objectId,
                        recordGuid: recordGuid,
                        actionToPerform: Number(actionToPerform)
                    }
                }).then(MainGrid.PDM.PDM_success_callback);
            },
            PDM_success_callback: function (response) {
                var responseData = JSON.parse(response.data);
                AppV.pushGlobalState("PdmIsConnected", responseData.Success);
                if (responseData.Success) {
                    loadingPanel.Hide();
                    var PopUpName = "PdmPaswPopUp" + responseData.CustomAction.actionToPerform;
                    if (typeof window[PopUpName] != "undefined") { window[PopUpName].Hide(); }
                    if (responseData.CustomAction.actionToPerform === enums.ActionToPerform.CheckIn) {
                        _InternalFunctions.CheckIn();
                    }
                    else if (responseData.CustomAction.actionToPerform === enums.ActionToPerform.CheckOut) {
                        _InternalFunctions.CheckOut();
                    }
                    else if (responseData.CustomAction.actionToPerform === enums.ActionToPerform.Download) {
                        _InternalFunctions.OpenFile();
                    }
                    else if (responseData.CustomAction.actionToPerform === enums.ActionToPerform.SendToNextStage) {
                        Processes.sendToNextStageConfirmed();
                    }
                    else if (responseData.CustomAction.actionToPerform === enums.ActionToPerform.Save) {
                        PropertyCardSection.SetActiveTab(PropertyCardSection.tabs.filter(function (x) { return x.name == "Properties"; })[0]);
                        DisableItem(enums.RibbonNames.Properties, "SaveBom");
                        DisableNeccesaryItemsOnAction(ActiveObjectsOnAction, true, enums.RibbonNames.Properties);
                        FieldVaildation.blockEvaluationOfDF = true;
                        if (AppV.GetGlobals().RecordId === 0 || AppV.GetGlobals().RecordId == undefined) {
                            AjaxStatus.FormSubmit(window.ActionToPerform.Save, Action.New);
                        } else {
                            AjaxStatus.FormSubmit(window.ActionToPerform.Save, Action.Edit);
                        }
                    }
                    else if (responseData.CustomAction.actionToPerform === enums.ActionToPerform.PropertyCardDownload) {
                        RelatedFiles.FileDownload.DownloadPrimaryFile("", AppV.GetGlobals().RecordId, AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordGuid);
                    }
                    else if (responseData.CustomAction.actionToPerform === enums.ActionToPerform.PropertyCardCheckIn) {
                        PropertyCardSection.SetActiveTab(PropertyCardSection.tabs.filter(function (x) { return x.name == "Properties"; })[0]);
                        DisableNeccesaryItemsOnAction(ActiveObjectsOnAction, true, enums.RibbonNames.Properties);
                        AjaxStatus.FormSubmit(window.ActionToPerform.CheckIn, Action.Edit);
                    }
                    else if (responseData.CustomAction.actionToPerform === enums.ActionToPerform.PropertyCardCheckOut) {
                        PropertyCardSection.SetActiveTab(PropertyCardSection.tabs.filter(function (x) { return x.name == "Properties"; })[0]);
                        DisableNeccesaryItemsOnAction(ActiveObjectsOnAction, true, enums.RibbonNames.Properties);
                        AjaxStatus.FormSubmit(window.ActionToPerform.CheckOut, Action.Edit, false);
                    }
                    else if (responseData.CustomAction.actionToPerform === enums.ActionToPerform.UndoCheckout) {
                        AjaxStatus.FormSubmit(window.ActionToPerform.UndoCheckout, Action.Edit, false);
                    }
                    else if (responseData.CustomAction.actionToPerform === enums.ActionToPerform.NewFrom) {
                        AjaxStatus.FormSubmit(window.ActionToPerform.NewFrom, Action.New);
                    }
                    else if (responseData.CustomAction.actionToPerform === enums.ActionToPerform.Preview) {
                        OnDocumentPreviewTabClick();
                    }
                    else if (responseData.CustomAction.actionToPerform === enums.ActionToPerform.ExportFiles) {
                        _InternalFunctions.ExportDataFiles();
                    }
                }
                else {
                    if (responseData.CustomAction.showModal) {
                        View.loadDynamic("PDMPaswPopUp", { actionToPerform: responseData.CustomAction.actionToPerform }, responseData.CustomAction.actionToPerform, true);
                    }
                    loadingPanel.Hide();
                    Notification.SetNotification(responseData.Message, 'warning', 4500);
                }
            }

        },
        DashBoardViewer: {
            State: {
                reload: false
            },
            BeginCallback: function (s, e) {
                e.customArgs["dashboardId"] = DashboardItems.GetValue();
            },
            DefaultDashboard: {
                BeginCallback: function (s, e) {
                    e.customArgs["reload"] = MainGrid.DashBoardViewer.State.reload;
                },
                EndCallback: function (s, e) {
                    MainGrid.DashBoardViewer.State.reload = false;
                    if (typeof MainRibbon !== "undefined")
                        MainRibbon.GetItemByName("RefreshDashboard").SetEnabled(true);

                    s.SetHeight(splDefaultDashboard.GetPaneByName("mytasksPanel").lastHeight - 30);
                },
                DoubleClick: function (s, e) {
                    var visibleIndex = DashboardTaskGrid.GetFocusedRowIndex();
                    var key = DashboardTaskGrid.GetRowKey(visibleIndex);

                    if (typeof CreateTaskPopUp !== "undefined" && ASPxClientUtils.IsExists(CreateTaskPopUp)) {
                        CreateTaskPopUp.PerformCallback({
                            taskIdParam: key,
                            IsEditMode: true
                        });
                        CreateTaskPopUp.Show();
                    } else {
                        View.load("CreateTaskPopUp",
                            {
                                taskIdParam: key,
                                IsEditMode: true
                            });
                    }
                },
                Init: function (s, e) {
                    s.SetHeight(splDefaultDashboard.GetPaneByName("mytasksPanel").lastHeight - 30);
                }
            },
            trackDashboard: -1,
            ClearTimeInterval: function () {

                if (MainGrid.DashBoardViewer.trackDashboard !== -1)
                    clearInterval(MainGrid.DashBoardViewer.trackDashboard);

            },
            Items: {
                EndCallback: function (s, e) {
                    View.load('Dashboard',
                        {
                            dashboardId: DashboardItems.GetValue()
                        }, false);
                },
                SelectedIndexChanged: function () {
                    MainRibbonV.UpdateLastUpdatedRefreshField();
                    View.load('Dashboard', {
                        dashboardId: DashboardItems.GetValue(),
                        reload: true
                    }, false);
                },
                SelectedIndexChangedTimer: function () {
                    var val = AutomaticRefreshCombo.GetValue();
                    MainGrid.DashBoardViewer.ClearTimeInterval();

                    if (val == -1) {
                        MainGrid.DashBoardViewer.ClearTimeInterval();
                    } else {
                        MainGrid.DashBoardViewer.trackDashboard = setInterval(MainGrid.DashBoardViewer.Items.SelectedIndexChanged, val);
                    }
                }
            }
        },

        ContextMenu: {
            Display: function (s, e) {

                try {
                    if (gridViewDocuments.GetFocusedRowIndex() < 0) {
                        var itemsToEnable = ["New", "Refresh"];
                        menuContenxt = CtxDocGrid;
                        if (AppV.GetGlobals().ModuleName == enums.Modules.Projects)
                            menuContenxt = CtxCasesGrid;
                        else if (AppV.GetGlobals().ModuleName == enums.Modules.Processes)
                            menuContenxt = CtxProcessGrid;
                        else if (AppV.GetGlobals().ModuleName == enums.Modules.Home) {
                            if (AppV.GetHomeObjects().MenuSelected === enums.HomeModules.Tasks) {
                                menuContenxt = CtxMenuTaskMain;
                                itemsToEnable = ["newTask", "refreshTask"];
                            } else if (AppV.GetHomeObjects().MenuSelected === enums.HomeModules.MyWork) {
                                menuContenxt = CtxMyWorkGrid;
                                itemsToEnable = ["Refresh"];
                            }
                            else if (AppV.GetHomeObjects().MenuSelected === enums.HomeModules.Timesheets) {
                                menuContenxt = CtxTimesheetsGrid;
                            }
                        }

                        menuContenxt.SetEnabled(false);
                        itemsToEnable.forEach(function (item) {
                            menuContenxt.GetItemByName(item).SetEnabled(true);
                        });




                        if (AppV.GetGlobals().IsSpecialObject === true) {
                            CtxSpecialObjectGridMain.SetEnabled(false);
                        }

                        _InternalFunctions.ShowContextMenu(e);
                    } else {
                        if (gridViewDocuments.GetSelectedKeysOnPage().includes(gridViewDocuments.GetRowKey(e.index))) {
                            // if (MainGrid.GetSelectedRowValues().hasOwnProperty(e.index)) {
                            if (gridViewDocuments.GetFocusedRowIndex() != e.index) {
                                MainGrid.ValidateSelectedRowsOnGrid();
                            }
                            _InternalFunctions.setEnabledContextMenu(e);
                        } else {
                            gridViewDocuments.SelectRowOnPage(e.index, true);
                            _InternalFunctions.setEnabledContextMenu(e);
                            //   MainGrid.PushSelectedRowsToGridState(e.index, _InternalFunctions.setEnabledContextMenu, e);
                        }

                    }
                } catch (e) {
                    console.log(e);
                }
            },
            DisplayFromButton: function () {
                var e = {};
                var s = {};
                s = window["gridViewDocuments"];
                e.objectType = "row";
                e.index = gridViewDocuments.GetFocusedRowIndex();
                var offset = $("#MainGridMenuButton").offset();
                e.htmlEvent = { clientX: offset.left, clientY: offset.top };
                try {
                    MainGrid.ContextMenu.Display(s, e);
                } catch (e) {
                    console.log(e);
                }
            },


            Documents: {

                ItemClick: function (s, e) {
                    //var documentSenderName = s.name;
                    switch (e.item.name) {
                        case "New":
                            if (!AppV.GetGlobals().IsSpecialObject) {
                                Request.ajax({
                                    type: "POST",
                                    url: '/Properties/CheckForPermision/',
                                    data: {
                                        objectId: AppV.GetGlobals().ObjectId,
                                        subObjectGuid: AppV.GetGlobals().SubObjectGuid
                                    },
                                    dataType: "json"
                                }).then(function (response) {
                                    if (response.success) {
                                        Helper.open('/PropertyCard/AddNew/' + AppV.GetGlobals().AddNewUrlEncrypted, '_blank');
                                    } else {
                                        Notification.SetNotification(response.message, 'warning', 5000);
                                    }
                                }).then(function () { window.loadingPanel.Hide(); });
                            } else {
                                Notification.SetNotification(window.SwResourceObject.RecordsCannotBeCreatedInHerePleaseGoToTheMainGrid, 'warning', 5000);
                            }
                            break;
                        case "NewFrom":
                            MainGrid.Record.NewFrom();
                            break;
                        case "OpenRecord":
                            _InternalFunctions.openRecordMainGrid();
                            break;
                        case "CreateTask":
                            var recordGuids = [];
                            var subjectRecords = "";
                            var recordKeys = Object.keys(MainGrid.GetSelectedRowValues());

                            if (recordKeys.length > 0) {

                                var isLimitExtended = false;
                                recordKeys.forEach(function (key, index) {
                                    if (isLimitExtended == false) {
                                        var descToAdd = MainGrid.GetSelectedRowValues()[key].PartNumber + " " + (MainGrid.GetSelectedRowValues()[key].Description || "");
                                        if (subjectRecords.length + descToAdd.length < 100) {
                                            if (subjectRecords !== "") {
                                                subjectRecords += ";";
                                            }
                                            subjectRecords += descToAdd;
                                        } else {
                                            isLimitExtended = true;
                                        }
                                    }
                                    recordGuids.push(MainGrid.GetSelectedRowValues()[key].RecordGuid);

                                });

                                if (typeof CreateTaskPopUp !== "undefined" && ASPxClientUtils.IsExists(CreateTaskPopUp)) {
                                    CreateTaskPopUp.PerformCallback({
                                        partNumberAndDescription: subjectRecords,
                                        objectId: AppV.GetGlobals().ObjectId,
                                        recordGuid: recordGuids
                                    });
                                    CreateTaskPopUp.Show();
                                }
                                else {
                                    View.load("CreateTaskPopUp",
                                        {
                                            partNumberAndDescription: subjectRecords,
                                            objectId: AppV.GetGlobals().ObjectId,
                                            recordGuid: recordGuids
                                        });
                                }

                            } else {
                                Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                            }
                            break;
                        case "CreateShortcut":

                            View.load("addShortCutPopUp",
                                {
                                    "ObjectId": AppV.GetGlobals().ObjectId,
                                    "ObjectType": AppV.GetGlobals().ObjectType,
                                    "DisplayName": MainGrid.GetGridRowData().PartNumber + " " + MainGrid.GetGridRowData().Description,
                                    "RecordId": AppV.GetGlobals().RecordId
                                });
                            break;
                        case "ExportToExel":
                            _InternalFunctions.exportMainGridToExcel();
                            break;
                        case "CheckIn":
                            if (AppV.GetGlobals().ObjectType !== enums.ObjectTypes.SWPDM) {
                                _InternalFunctions.CheckIn();
                            } else {
                                MainGrid.PDM.PdmIsConnectedAction(enums.ActionToPerform.CheckIn);
                            }
                            break;
                        case "CheckOut":
                            if (AppV.GetGlobals().ObjectType !== enums.ObjectTypes.SWPDM) {
                                _InternalFunctions.CheckOut();
                            } else {
                                MainGrid.PDM.PdmIsConnectedAction(enums.ActionToPerform.CheckOut);
                            }
                            break;
                        case "Refresh":
                            MainGrid.PerformCallback(true);
                            break;

                        case "OpenFile":
                            if (AppV.GetGlobals().ObjectType !== enums.ObjectTypes.SWPDM) {
                                _InternalFunctions.OpenFile();
                            } else {
                                MainGrid.PDM.PdmIsConnectedAction(enums.ActionToPerform.Download);
                            }
                            break;

                        case "ShareFile":
                            MainGrid.Sharing.checkObjectFileSharing(AppV.GetGlobals().ObjectId, true);
                            break;
                        case "UpdateLinkedRecordValues":
                            _InternalFunctions.UpdateLinkedRecordValues();
                            break;
                        case "CreateLinkedRecords":
                            Helper.ShowConfirmPopUp("SolidWorks", Helper.T("AreYouSureYouWantToCreateLinkedRecordsForSelectedItems"),
                                "MainGrid.ContextMenu.Documents.CreateLinkedRecords()", "", "", "");
                            break;
                        case "PartNumber":
                            Helper.CopyTextToClipboard(MainGrid.GetGridRowData().PartNumber);
                            break;
                        case "Description":
                            Helper.CopyTextToClipboard(MainGrid.GetGridRowData().Description);
                            break;
                        case "PartNumberDescription":
                            Helper.CopyTextToClipboard(
                                MainGrid.GetGridRowData().PartNumber
                                + " "
                                + MainGrid.GetGridRowData().Description
                            );
                            break;
                        case "SendToProcess":
                            View.load('SendToProcessesMainGrid',
                                {
                                    objectId: AppV.GetGlobals().ObjectId,
                                    actionToPerform: window.ActionToPerform.MainGridDisplay
                                });
                            break;
                        case "Delete":
                            Helper.ShowConfirmPopUp("SolidWorks", Helper.T("AreYouSureYouWantToDeleteSelectedRecords"),
                                "MainGrid.ContextMenu.DeleteRecordsConfirmed()");
                            break;

                        case "ExportFiles":
                            if (AppV.GetGlobals().ObjectType !== enums.ObjectTypes.SWPDM) {
                                _InternalFunctions.ExportDataFiles();

                            } else {
                                MainGrid.PDM.PdmIsConnectedAction(enums.ActionToPerform.ExportFiles);
                            }
                            break;
                    }
                },

                CreateLinkedRecords: function () {
                    var selectedRecord = [];

                    var recordKeys = Object.keys(MainGrid.GetSelectedRowValues());
                    if (recordKeys.length > 0) {
                        recordKeys.forEach(function (key, index) {
                            selectedRecord.push(MainGrid.GetSelectedRowValues()[key].RecordId);
                        });
                    } else {
                        Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                        return;
                    }

                    if (selectedRecord.length !== 0) {
                        window.loadingPanel.Show();
                        $.ajax({
                            type: "POST",
                            url: '/Main/CreateLinkedRecords/',
                            data: {
                                "objectId": AppV.GetGlobals().ObjectId,
                                "selectedRecord": selectedRecord
                            },
                            dataType: "json",
                            success: function (response) {
                                var responseData = JSON.parse(response.data);
                                if (responseData.Success) {
                                    if (responseData.Message !== "") {
                                        Notification.SetNotification(responseData.Message, 'warning', 2500);
                                    }
                                    MainGrid.PerformCallback(true);
                                } else {
                                    Notification.SetNotification(responseData.Message, 'warning', 2500);
                                }
                                window.loadingPanel.Hide();
                                window.mainPopup.Hide();
                            }
                        });
                    } else {
                        Notification.SetNotification(window.SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
                    }
                },
                ExportFiles: function (s, e, recordsIds) {

                    window.loadingPanel.Show();

                    var exportTemplateId = window.cmbExportFilesTemplate.GetValue();

                    $.ajax({
                        type: "POST",
                        url: '/File/ExportFilesDocuments/',
                        data: {
                            "exportFilesTemplateId": exportTemplateId,
                            "objectId": AppV.GetGlobals().ObjectId,
                            "recordIds": recordsIds
                        },
                        dataType: "json",
                        success: function (response) {
                            if (response.Success) {
                                window.loadingPanel.Hide();
                                var filesToDownload = response.ZipName.split(";");
                                var i;
                                var filesJson = [];

                                for (i = 0; i < filesToDownload.length - 1; i++) {
                                    filesJson.push({
                                        download: RootUrl + "File/DownloadExportedFiles?fileName=" + filesToDownload[i] + '.zip',
                                        filename: filesToDownload[i] + '.zip'
                                    });
                                }

                                Helper.download_multiple_files(filesJson);

                                window.pcModalExportFilesDocuments.Hide();
                            }
                            else if (!response.Success) {
                                window.loadingPanel.Hide();
                                Notification.SetNotification(response.Message, 'warning', 3500);
                            }

                        }
                    });

                }
            },

            Processes: {
                ItemClick: function (s, e) {
                    //  var documentSenderName = s.name;
                    switch (e.item.name) {
                        case "New":
                            if (!AppV.GetGlobals().IsSpecialObject) {
                                Request.ajax({
                                    type: "POST",
                                    url: '/Properties/CheckForPermision/',
                                    data: {
                                        objectId: AppV.GetGlobals().ObjectId,
                                        subObjectGuid: AppV.GetGlobals().SubObjectGuid
                                    },
                                    dataType: "json"
                                }).then(function (response) {
                                    if (response.success) {
                                        Helper.open('/PropertyCard/AddNew/' + AppV.GetGlobals().AddNewUrlEncrypted, '_blank');
                                    } else {
                                        Notification.SetNotification(response.message, 'warning', 5000);
                                    }
                                }).then(function () { window.loadingPanel.Hide(); });
                            } else {
                                Notification.SetNotification(window.SwResourceObject.RecordsCannotBeCreatedInHerePleaseGoToTheMainGrid, 'warning', 5000);
                            }
                            break;
                        case "OpenRecord":
                            _InternalFunctions.openRecordMainGrid();
                            break;
                        case "CreateShortcut":
                            View.load("addShortCutPopUp",
                                {
                                    "ObjectId": AppV.GetGlobals().ObjectId,
                                    "ObjectType": AppV.GetGlobals().ObjectType,
                                    "DisplayName": MainGrid.GetGridRowData().PartNumber + " " + MainGrid.GetGridRowData().Description,
                                    "RecordId": AppV.GetGlobals().RecordId
                                });

                            break;
                        case "Delete":
                            Helper.ShowConfirmPopUp("SolidWorks", Helper.T("AreYouSureYouWantToDeleteSelectedRecords"),
                                "MainGrid.ContextMenu.DeleteRecordsConfirmed()");
                            break;
                        case "Refresh":
                            MainGrid.PerformCallback(true);
                            break;

                        case "RunReport":
                            break;
                        case "PartNumber":
                            Helper.CopyTextToClipboard(MainGrid.GetGridRowData().PartNumber);
                            break;
                        case "Description":
                            Helper.CopyTextToClipboard(MainGrid.GetGridRowData().Description);
                            break;
                        case "PartNumberDescription":
                            Helper.CopyTextToClipboard(
                                MainGrid.GetGridRowData().PartNumber
                                + " "
                                + MainGrid.GetGridRowData().Description
                            );
                            break;
                        case "ManageStagesAdministratorsOnly":

                            break;
                        case "CreateItemSInRecordS":

                            break;
                        case "ExportWithIconsAndFormatting":

                            break;
                        case "ExportDataOnly":

                            break;
                        case "ExportToExel":
                            _InternalFunctions.exportMainGridToExcel();
                            break;
                    }
                }
            },

            Cases: {
                ItemClick: function (s, e) {
                    //  var documentSenderName = s.name;
                    switch (e.item.name) {
                        case "New":
                            if (!AppV.GetGlobals().IsSpecialObject) {
                                Request.ajax({
                                    type: "POST",
                                    url: '/Properties/CheckForPermision/',
                                    data: {
                                        objectId: AppV.GetGlobals().ObjectId,
                                        subObjectGuid: AppV.GetGlobals().SubObjectGuid
                                    },
                                    dataType: "json"
                                }).then(function (response) {
                                    if (response.success) {
                                        Helper.open('/PropertyCard/AddNew/' + AppV.GetGlobals().AddNewUrlEncrypted, '_blank');
                                    } else {
                                        Notification.SetNotification(response.message, 'warning', 5000);
                                    }
                                }).then(function () { window.loadingPanel.Hide(); });
                            } else {
                                Notification.SetNotification(window.SwResourceObject.RecordsCannotBeCreatedInHerePleaseGoToTheMainGrid, 'warning', 5000);
                            }
                            break;
                        case "OpenRecord":

                            _InternalFunctions.openRecordMainGrid();
                            break;
                        case "ProjectsPlanning":
                            View.load("addPlanningView", {
                                "objectId": AppV.GetGlobals().ObjectId,
                                "recordId": AppV.GetGlobals().RecordId
                            });
                            break;
                        case "CreateShortcut":
                            View.load("addShortCutPopUp",
                                {
                                    "ObjectId": AppV.GetGlobals().ObjectId,
                                    "ObjectType": AppV.GetGlobals().ObjectType,
                                    "DisplayName": MainGrid.GetGridRowData().PartNumber + " " + MainGrid.GetGridRowData().Description,
                                    "RecordId": AppV.GetGlobals().RecordId
                                });

                            break;
                        case "CreateTask":
                            var recordGuids = [];
                            var subjectRecords = "";
                            var recordKeys = Object.keys(MainGrid.GetSelectedRowValues());

                            if (recordKeys !== 'undefined' && recordKeys.length > 0) {

                                var isLimitExtended = false;
                                recordKeys.forEach(function (key, index) {
                                    if (isLimitExtended == false) {
                                        var descToAdd = MainGrid.GetSelectedRowValues()[key].PartNumber + " " + (MainGrid.GetSelectedRowValues()[key].Description || "");
                                        if (subjectRecords.length + descToAdd.length < 100) {
                                            if (subjectRecords !== "") {
                                                subjectRecords += ";";
                                            }
                                            subjectRecords += descToAdd;
                                        } else {
                                            isLimitExtended = true;
                                        }
                                    }
                                    recordGuids.push(MainGrid.GetSelectedRowValues()[key].RecordGuid);

                                });

                                if (typeof CreateTaskPopUp !== "undefined" && ASPxClientUtils.IsExists(CreateTaskPopUp)) {
                                    CreateTaskPopUp.PerformCallback({
                                        partNumberAndDescription: subjectRecords,
                                        objectId: AppV.GetGlobals().ObjectId,
                                        recordGuid: recordGuids,
                                        assignToStage: false
                                    });
                                    CreateTaskPopUp.Show();
                                }
                                else {
                                    View.load("CreateTaskPopUp",
                                        {
                                            partNumberAndDescription: subjectRecords,
                                            objectId: AppV.GetGlobals().ObjectId,
                                            recordGuid: recordGuids,
                                            assignToStage: false
                                        });
                                }

                            } else {
                                Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                            }
                            break;
                        case "Delete":
                            Helper.ShowConfirmPopUp("SolidWorks", Helper.T("AreYouSureYouWantToDeleteSelectedRecords"),
                                "MainGrid.ContextMenu.DeleteRecordsConfirmed()");
                            break;
                        case "Refresh":
                            MainGrid.PerformCallback(true);
                            break;
                        case "SendToProcess":
                            View.load('SendToProcessesMainGrid',
                                {
                                    objectId: AppV.GetGlobals().ObjectId,
                                    actionToPerform: window.ActionToPerform.MainGridDisplay
                                });
                            break;
                        case "RunReport":
                            break;
                        case "PartNumber":
                            Helper.CopyTextToClipboard(MainGrid.GetGridRowData().PartNumber);
                            break;
                        case "Description":
                            Helper.CopyTextToClipboard(MainGrid.GetGridRowData().Description);
                            break;
                        case "PartNumberDescription":
                            Helper.CopyTextToClipboard(
                                MainGrid.GetGridRowData().PartNumber
                                + " "
                                + MainGrid.GetGridRowData().Description
                            );
                            break;
                        case "ManageStagesAdministratorsOnly":

                            break;
                        case "CreateItemSInRecordS":

                            break;
                        case "ExportWithIconsAndFormatting":

                            break;
                        case "ExportDataOnly":

                            break;
                        case "ExportToExel":
                            _InternalFunctions.exportMainGridToExcel();
                            break;
                    }
                }
            },

            Contacts: {
                ItemClick: function (s, e) {
                    switch (e.item.name) {
                        case "New":
                            if (!AppV.GetGlobals().IsSpecialObject) {
                                Request.ajax({
                                    type: "POST",
                                    url: '/Properties/CheckForPermision/',
                                    data: {
                                        objectId: AppV.GetGlobals().ObjectId,
                                        subObjectGuid: AppV.GetGlobals().SubObjectGuid
                                    },
                                    dataType: "json"
                                }).then(function (response) {
                                    if (response.success) {
                                        Helper.open('/PropertyCard/AddNew/' + AppV.GetGlobals().AddNewUrlEncrypted, '_blank');
                                    } else {
                                        Notification.SetNotification(response.message, 'warning', 5000);
                                    }
                                }).then(function () { window.loadingPanel.Hide(); });
                            } else {
                                Notification.SetNotification(window.SwResourceObject.RecordsCannotBeCreatedInHerePleaseGoToTheMainGrid, 'warning', 5000);
                            }
                            break;
                        case "NewFrom":
                            MainGrid.Record.NewFrom();
                            break;
                        case "OpenRecord":
                            _InternalFunctions.openRecordMainGrid();
                            break;
                        case "CreateShortcut":
                            View.load("addShortCutPopUp",
                                {
                                    "ObjectId": AppV.GetGlobals().ObjectId,
                                    "ObjectType": AppV.GetGlobals().ObjectType,
                                    "DisplayName": MainGrid.GetGridRowData().PartNumber + " " + MainGrid.GetGridRowData().Description,
                                    "RecordId": AppV.GetGlobals().RecordId
                                });

                            break;
                        case "CreateTask":
                            var recordGuids = [];
                            var subjectRecords = "";
                            var recordKeys = Object.keys(MainGrid.GetSelectedRowValues());

                            if (recordKeys !== 'undefined' && recordKeys.length > 0) {

                                var isLimitExtended = false;
                                recordKeys.forEach(function (key, index) {
                                    if (isLimitExtended == false) {
                                        var descToAdd = MainGrid.GetSelectedRowValues()[key].PartNumber + " " + (MainGrid.GetSelectedRowValues()[key].Description || "");
                                        if (subjectRecords.length + descToAdd.length < 100) {
                                            if (subjectRecords !== "") {
                                                subjectRecords += ";";
                                            }
                                            subjectRecords += descToAdd;
                                        } else {
                                            isLimitExtended = true;
                                        }
                                    }
                                    recordGuids.push(MainGrid.GetSelectedRowValues()[key].RecordGuid);

                                });

                                if (typeof CreateTaskPopUp !== "undefined" && ASPxClientUtils.IsExists(CreateTaskPopUp)) {
                                    CreateTaskPopUp.PerformCallback({
                                        partNumberAndDescription: subjectRecords,
                                        objectId: AppV.GetGlobals().ObjectId,
                                        recordGuid: recordGuids,
                                        assignToStage: false
                                    });
                                    CreateTaskPopUp.Show();
                                }
                                else {
                                    View.load("CreateTaskPopUp",
                                        {
                                            partNumberAndDescription: subjectRecords,
                                            objectId: AppV.GetGlobals().ObjectId,
                                            recordGuid: recordGuids,
                                            assignToStage: false
                                        });
                                }

                            } else {
                                Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                            }
                            break;
                        case "Delete":
                            Helper.ShowConfirmPopUp("SolidWorks", Helper.T("AreYouSureYouWantToDeleteSelectedRecords"),
                                "MainGrid.ContextMenu.DeleteRecordsConfirmed()");
                            break;
                        case "Refresh":
                            MainGrid.PerformCallback(true);
                            break;
                        case "PartNumber":
                            Helper.CopyTextToClipboard(MainGrid.GetGridRowData().PartNumber);
                            break;
                        case "Description":
                            Helper.CopyTextToClipboard(MainGrid.GetGridRowData().Description);
                            break;
                        case "PartNumberDescription":
                            Helper.CopyTextToClipboard(
                                MainGrid.GetGridRowData().PartNumber
                                + " "
                                + MainGrid.GetGridRowData().Description
                            );
                            break;
                        case "ExportToExel":
                            _InternalFunctions.exportMainGridToExcel();
                            break;
                    }
                }
            },


            MyWork: {
                ItemClick: function (s, e) {
                    switch (e.item.name) {
                        case "OpenRecord":
                            _InternalFunctions.openRecordMainGrid();
                            break;
                        case "CheckIn":
                            var recordKeys = Object.keys(MainGrid.GetSelectedRowValues());
                            if (recordKeys.length != 1) {
                                if (recordKeys.length == 0) {
                                    Notification.SetNotification(SwResourceObject.PleaseSelectAnItem);
                                } else {
                                    Notification.SetNotification(SwResourceObject.PleaseSelectOneItemOnly);
                                }
                            } else {
                                if (AppV.GetMyWorkState().ModuleSelected == enums.TOT.Objects) {
                                    var result = Helper.FilterGridSelectedKeysOnPage("gridViewDocuments", "idRecord")[0];
                                    if (result != null) {
                                        if (result.ObjectType !== enums.ObjectTypes.SWPDM) {
                                            _InternalFunctions.CheckIn();
                                        }
                                        else {
                                            MainGrid.PDM.PdmIsConnectedAction(enums.ActionToPerform.CheckIn);
                                        }
                                    }
                                }
                            }
                            break;
                        case "OpenFile":
                            var recordKeys = Object.keys(MainGrid.GetSelectedRowValues());
                            if (recordKeys.length != 1) {
                                if (recordKeys.length == 0) {
                                    Notification.SetNotification(SwResourceObject.PleaseSelectAnItem);
                                } else {
                                    Notification.SetNotification(SwResourceObject.PleaseSelectOneItemOnly);
                                }
                            } else {
                                if (AppV.GetMyWorkState().ModuleSelected == enums.TOT.Objects) {
                                    var result = Helper.FilterGridSelectedKeysOnPage("gridViewDocuments", "idRecord")[0];
                                    if (result != null) {
                                        if (result.ObjectType !== enums.ObjectTypes.SWPDM) {
                                            _InternalFunctions.OpenFile();
                                        }
                                        else {
                                            MainGrid.PDM.PdmIsConnectedAction(enums.ActionToPerform.Download);
                                        }
                                    }
                                }
                            }
                            break;
                        case "CopySelectedValue":
                            break;
                        case "Refresh":
                            MainGrid.PerformCallback(true);
                            break;
                        case "PartNumber":
                            Helper.CopyTextToClipboard(MainGrid.GetGridRowData().PartNumber);
                            break;
                        case "Description":
                            Helper.CopyTextToClipboard(MainGrid.GetGridRowData().Description);
                            break;
                        case "PartNumberDescription":
                            Helper.CopyTextToClipboard(
                                MainGrid.GetGridRowData().PartNumber
                                + " "
                                + MainGrid.GetGridRowData().Description
                            );
                            break;
                        case "DeleteLocalFiles":
                            break;
                        case "uploadNewerFileBtnCtx":
                            break;
                        case "ExportToExcel":
                            _InternalFunctions.exportMainGridToExcel();
                            break;
                    }
                }
            },

            Tasks: {
                ItemClick: function (s, e) {
                    switch (e.item.name) {
                        case "newTask":

                            if (typeof CreateTaskPopUp !== "undefined" && ASPxClientUtils.IsExists(CreateTaskPopUp)) {
                                CreateTaskPopUp.PerformCallback({
                                    isMainModule: true
                                });
                                CreateTaskPopUp.Show();
                            }
                            else {
                                View.load("CreateTaskPopUp",
                                    {
                                        isMainModule: true
                                    });
                            }

                            break;
                        case "openTask":
                            _InternalFunctions.OpenTask();
                            break;

                        case "assignToUser":
                            var valuesKeys = MainGrid.ContextMenu.GetTasksSelectedIds();
                            Tasks.AssignTaskToUsers(valuesKeys);
                            break;

                        case "changeUserTask":
                            var tasksIds = MainGrid.ContextMenu.GetTasksSelectedIds();
                            View.load("ChangeOwnerPopUp", {
                                tasksIds: tasksIds
                            }, true);
                            break;

                        case "markAsCompleted":
                            var valuesSelected = MainGrid.ContextMenu.GetTasksSelectedIds();

                            Helper.ShowConfirmPopUp("SolidWorks",
                                SwResourceObject.ATaskMarkedAsCompletedCanNoLongerBeEdited + "\n" + SwResourceObject.DoYouWantToContinue,
                                "Tasks.MarkAsCompletedCall( " + JSON.stringify(valuesSelected) + " )");

                            break;
                        case "markAsReadTask":
                            var valuesSelectedMr = MainGrid.ContextMenu.GetTasksSelectedIds();
                            Tasks.MarkAsReadUnRead(valuesSelectedMr, true);
                            break;
                        case "markAsUnreadTask":
                            var valuesSelectedMu = MainGrid.ContextMenu.GetTasksSelectedIds();
                            Tasks.MarkAsReadUnRead(valuesSelectedMu, false);
                            break;
                        case "flagTask":
                            Tasks.FlagUnFlagTask(MainGrid.GetGridRowData().RecordId);
                            break;

                        case "deleteTask":
                            Helper.ShowConfirmPopUp("SolidWorks",
                                SwResourceObject.AreYouSureYouWantToDeleteSelectedItem,
                                "Tasks.DeleteTaskHomeModule()");
                            break;

                        case "exportToExcelTask":
                            _InternalFunctions.exportMainGridToExcel();
                            break;
                        case "refreshTask":
                            MainGrid.PerformCallback(true);
                            break;
                    }
                }
            },

            Timesheets: {
                ItemClick: function (s, e) {
                    switch (e.item.name) {
                        case "New":
                            Timesheets.CreateNewTimesheets();
                            break;
                        case "NewFrom":
                            break;
                        case "OpenRecord":
                            Timesheets.OpenTimesheets();
                            break;
                        case "Refresh":
                            MainGrid.PerformCallback(true);
                            break;
                        case "ExportToExcel":
                            _InternalFunctions.exportMainGridToExcel();
                            break;
                        case "Delete":
                            Helper.ShowConfirmPopUp("SolidWorks",
                                SwResourceObject.AreYouSureYouWantToDeleteSelectedItem,
                                " Timesheets.RemoveTimesheet()");
                            break;
                    }
                }
            },
            Dashboard: {
                ItemClick: function (s, e) {
                    switch (e.item.name) {
                        case "OpenTask":
                            MainGrid.DashBoardViewer.DefaultDashboard.DoubleClick(s, e);
                            break;
                        case "NewTask":
                            if (typeof CreateTaskPopUp !== "undefined" && ASPxClientUtils.IsExists(CreateTaskPopUp)) {
                                CreateTaskPopUp.PerformCallback({
                                    isMainModule: true
                                });
                                CreateTaskPopUp.Show();
                            }
                            else {
                                View.load("CreateTaskPopUp",
                                    {
                                        isMainModule: true
                                    });
                            }
                            break;
                        case "assignToUser":
                            var valuesKeys = MainGrid.ContextMenu.Dashboard.GetSelectedTasksItemsIds();
                            if (valuesKeys.length === 0) {
                                MainGrid.ContextMenu.Dashboard.GetFocusedTaskItemsIds("Tasks.AssignTaskToUsers");
                            } else {
                                Tasks.AssignTaskToUsers(valuesKeys, enums.Modules.MyDashboard);
                            }
                            
                            break;
                        case "deleteTask":
                            var valueKeys = MainGrid.ContextMenu.Dashboard.GetSelectedTasksItemsIds();
                            if (valueKeys.length === 0) {
                                MainGrid.ContextMenu.Dashboard.GetFocusedTaskItemsIds("Tasks.DeleteTasksDashboardConfimation");
                            } else {
                                Tasks.DeleteTasksDashboardConfimation(valueKeys, enums.Modules.MyDashboard);
                            }
                            break;
                        case "markAsCompleted":
                            var tasksId = MainGrid.ContextMenu.Dashboard.GetSelectedTasksItemsIds();
                            if (tasksId.length === 0) {
                                MainGrid.ContextMenu.Dashboard.GetFocusedTaskItemsIds("Tasks.OpenMarkAsCompletedPopUp");
                            } else {
                                Tasks.OpenMarkAsCompletedPopUp(tasksId, enums.Modules.MyDashboard);
                            }
                            break;
                        case "changeOwner":
                            var tasksIds = MainGrid.ContextMenu.Dashboard.GetSelectedTasksItemsIds();
                            if (tasksIds.length === 0) {
                                MainGrid.ContextMenu.Dashboard.GetFocusedTaskItemsIds("Tasks.OpenAssignOwner");
                            } else {
                                Tasks.OpenAssignOwner(tasksIds);
                            }
                            break;
                        case "Refresh":
                            MainGrid.DashBoardViewer.State.reload = true;
                            cbpDocumetGridDashboard.PerformCallback();
                            break;
                        case "ExportToExcel":
                            App.Exporting = true;
                            DashboardTaskGrid.ExportTo(ASPxClientGridViewExportFormat.Xlsx);
                            break;
                    }
                },

                GetSelectedTasksItemsIds: function () {
                    var items = DashboardTaskGrid.GetSelectedKeysOnPage();
                    return items;
                },

                GetFocusedTaskItemsIds: function (OnGetGridViewValues = "") {
                    var visibleIndex = DashboardTaskGrid.GetFocusedRowIndex();
                    DashboardTaskGrid.GetRowValues(visibleIndex, "idRecord", function (result) {
                        eval(OnGetGridViewValues + "(" + result + " , enums.Modules.MyDashboard);");
                    });  
                }
            },

            SpecialObjects: {
                ItemClick: function (s, e) {
                    switch (e.item.name) {
                        case "NewFrom":

                            break;

                        case "OpenRecord":
                            _InternalFunctions.openRecordMainGrid();
                            break;

                        case "OpenRecordParent":
                            Request.ajax({
                                type: "POST",
                                url: '/Properties/CheckForGroupFieldPermision/',
                                data: {
                                    objectId: MainGrid.GetGridRowData().ParentObjectId,
                                    recordId: MainGrid.GetGridRowData().ParentRecordId
                                },
                                dataType: "json"
                            }).then(function (response) {
                                if (response.success) {

                                    broadcastV.create({ endPoint: "MainGrid" });
                                    Helper.open('/PropertyCard/Index/' + MainGrid.GetGridRowData().UrlEncryptedParent,
                                        '_blank');

                                } else {
                                    Notification.SetNotification(response.message, 'warning', 5000);
                                }
                            }).then(function () { window.loadingPanel.Hide(); });
                            break;

                        case "CreateShortcut":

                            View.load("addShortCutPopUp",
                                {
                                    "ObjectId": AppV.GetGlobals().ObjectId,
                                    "ObjectType": enums.ObjectTypes.SpecialObject,
                                    "DisplayName": MainGrid.GetGridRowData().PartNumber + " " + MainGrid.GetGridRowData().Description,
                                    "RecordId": MainGrid.GetGridRowData().RecordId
                                });
                            break;

                        case "CreateTask":
                            var recordGuids = [];
                            var subjectRecords = "";
                            var recordKeys = Object.keys(MainGrid.GetSelectedRowValues());

                            if (recordKeys.length > 0) {

                                var isLimitExtended = false;
                                recordKeys.forEach(function (key, index) {
                                    if (isLimitExtended == false) {
                                        var descToAdd = MainGrid.GetSelectedRowValues()[key].PartNumber + " " + (MainGrid.GetSelectedRowValues()[key].Description || "");
                                        if (subjectRecords.length + descToAdd.length < 100) {
                                            if (subjectRecords !== "") {
                                                subjectRecords += ";";
                                            }
                                            subjectRecords += descToAdd;
                                        } else {
                                            isLimitExtended = true;
                                        }
                                    }
                                    recordGuids.push(MainGrid.GetSelectedRowValues()[key].RecordGuid);

                                });

                                if (typeof CreateTaskPopUp !== "undefined" && ASPxClientUtils.IsExists(CreateTaskPopUp)) {
                                    CreateTaskPopUp.PerformCallback({
                                        partNumberAndDescription: subjectRecords,
                                        objectId: AppV.GetGlobals().ObjectId,
                                        recordGuid: recordGuids
                                    });
                                    CreateTaskPopUp.Show();
                                }
                                else {
                                    View.load("CreateTaskPopUp",
                                        {
                                            partNumberAndDescription: subjectRecords,
                                            objectId: AppV.GetGlobals().ObjectId,
                                            recordGuid: recordGuids
                                        });
                                }


                            } else {
                                Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                            }
                            break;

                        case "Delete":
                            var selectedRecordId = [];
                            var parentObjectId = -1;

                            var recordKeys = Object.keys(MainGrid.GetSelectedRowValues());
                            if (recordKeys.length > 0) {
                                selectedRecordId.push(MainGrid.GetSelectedRowValues()[recordKeys[0]].RecordId);
                                parentObjectId = MainGrid.GetSelectedRowValues()[recordKeys[0]].ParentObjectId;

                                //recordKeys.forEach(function (key, index) {
                                //    selectedRecordId.push(MainGrid.GetSelectedRowValues()[key].RecordId);
                                //    parentObjectId = MainGrid.GetSelectedRowValues()[key].ParentObjectId;
                                //});

                            } else {
                                Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                                return;
                            }

                            SpecialObjects.DeleteRecordsMain(
                                AppV.GetGlobals().ObjectId,
                                selectedRecordId,
                                enums.ObjectTypes.SpecialObject,
                                parentObjectId
                            );
                            break;

                        case "Refresh":
                            //Callbak of main grid
                            MainGrid.PerformCallback(true);
                            //MainGrid.ShouldReload(true);

                            //window.cbpDocumetGrid.PerformCallback({
                            //    id: AppV.GetGlobals().ObjectId,
                            //    sectionId: "",
                            //    filterId: AppV.GetGlobals().FilterId,
                            //    groupObjectId: AppV.GetGlobals().GroupObjectId,
                            //    parentObjectId: AppV.GetGlobals().RelatedObjectId
                            //});
                            break;

                        case "PartNumber":
                            Helper.CopyTextToClipboard(MainGrid.GetGridRowData().PartNumber);
                            break;
                        case "Description":
                            Helper.CopyTextToClipboard(MainGrid.GetGridRowData().Description);
                            break;
                        case "PartNumberDescription":
                            Helper.CopyTextToClipboard(
                                MainGrid.GetGridRowData().PartNumber
                                + " "
                                + MainGrid.GetGridRowData().Description
                            );
                            break;

                        case "ChangeType":
                            break;

                        case "ExportToExcel":
                            _InternalFunctions.exportMainGridToExcel();
                            break;

                        case "LockItem":

                            break;

                        case "UnLockItem":

                            break;

                    }
                }
            },


            DeleteRecordsConfirmed: function () {
                var selectedRecord = [], additionalInformation = [],
                    stopExecution = false,
                    tabs = [];
                AppV.GetTabsState().forEach(function (val) {
                    tabs.push(val.document.title);
                });
                var recordKeys = Object.keys(MainGrid.GetSelectedRowValues());

                if (recordKeys.length > 0) {

                    recordKeys.forEach(function (key, index) {
                        if (tabs.includes(MainGrid.GetSelectedRowValues()[key].PartNumber)) {
                            stopExecution = true;
                            Notification.SetNotification("Record " + MainGrid.GetSelectedRowValues()[key].PartNumber + " is open in another tab", "warning", 3500);
                            return;
                        }
                        selectedRecord.push(MainGrid.GetSelectedRowValues()[key].RecordId);
                        additionalInformation.push(MainGrid.GetSelectedRowValues()[key].PartNumber);

                    });
                } else {
                    Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                    return;
                }
                if (!stopExecution)
                    MainGrid.ContextMenu.DeleteRecords(selectedRecord, additionalInformation);

            },
            DeleteRecords: function (selectedRecord, additionalInformation) {
                if (selectedRecord.length !== 0) {
                    window.loadingPanel.Show();
                    $.ajax({
                        type: "POST",
                        url: '/Main/DeleteRecords/',
                        data: {
                            "objectId": AppV.GetGlobals().ObjectId,
                            "selectedRecord": selectedRecord,
                            additionalInformation
                        },
                        dataType: "json",
                        success: function (response) {
                            window.loadingPanel.Hide();
                            window.mainPopup.Hide();
                            responseData = JSON.parse(response.data);
                            if (!responseData.Success && responseData.CustomAction.AskForConfirmation) {
                                Helper.ShowConfirmPopUp("SolidWorks", responseData.Message, "MainGrid.ContextMenu.CheckHasConfiguration()");
                            } else if (responseData.Success) {
                                MainGrid.PerformCallback(true);
                            } else {
                                Notification.SetNotification(responseData.Message, 'warning', 2500);
                            }
                        }
                    });
                } else {
                    Notification.SetNotification(window.SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
                }
            },
            CheckHasConfiguration: function () {
                $.ajax({
                    type: "POST",
                    url: '/Main/CheckHasConfiguration/',
                    data: {
                        "objectId": AppV.GetGlobals().ObjectId,
                        "selectedRecord": responseData.CustomAttributes.selectedRecord
                    },
                    dataType: "json",
                    success: function (res) {
                        window.loadingPanel.Hide();
                        responseData = JSON.parse(res.data);
                        if (responseData.Success) {
                            MainGrid.PerformCallback(true);
                        } else {
                            if (!responseData.Success && responseData.CustomAction.AskForConfirmation) {
                                if (responseData.CustomAction.hasRoot) {
                                    Helper.ShowConfirmPopUp("SolidWorks",
                                        responseData.Message, "MainGrid.ContextMenu.ConfirmDeleteRecordsAccess('Yes')",
                                        "MainGrid.ContextMenu.ConfirmDeleteRecordsAccess('No')");
                                }
                                else if (responseData.CustomAction.hasMultiple) {
                                    Helper.ShowConfirmPopUp("SolidWorks",
                                        responseData.Message, "MainGrid.ContextMenu.ConfirmDeleteRecordsAccess('Yes')",
                                        "MainGrid.ContextMenu.ConfirmDeleteRecordsAccess('No')", "", 'true');
                                }
                            }
                        }
                    }
                });
            },
            ConfirmDeleteRecordsAccess: function (action) {
                if (responseData.CustomAction.hasConfiguration) {
                    $.ajax({
                        type: "POST",
                        url: '/Main/ConfirmDeleteRecordsAccess/',
                        data: {
                            "objectId": AppV.GetGlobals().ObjectId,
                            "selectedRecord": responseData.CustomAttributes.selectedRecord,
                            "action": action,
                            "hasConfiguration": true,
                            "hasRoot": responseData.CustomAction.hasRoot,
                            "hasMultiple": responseData.CustomAction.hasMultiple
                        },
                        dataType: "json",
                        success: function (res) {
                            window.loadingPanel.Hide();
                            responseData = JSON.parse(res.data);
                            if (responseData.Success) {
                                MainGrid.PerformCallback(true);
                            } else {
                                Notification.SetNotification(Helper.T(responseData.Message), 'warning', 2500);
                            }
                        }
                    });
                }
            },
            ShowCompletedTasksHome: function (showCompleted) {
                $.ajax({
                    type: "POST",
                    url: '/Tasks/ShowCompleted/',
                    data: {
                        "showCompleted": showCompleted
                    },
                    dataType: "json",
                    success: function (response) {
                        MainGrid.PerformCallback(true);
                    }
                });
            },
            GetTasksSelectedIds: function () {
                var valuesSelected = [];
                var keys = Object.keys(MainGrid.GetSelectedRowValues());

                if (keys.length === 0) {
                    Notification.SetNotification(SwResourceObject.PleaseSelectAnItem);
                    return;
                }

                keys.forEach(function (key, index) {
                    valuesSelected.push(MainGrid.GetSelectedRowValues()[key].RecordId);
                });

                return valuesSelected;
            }
        },

        Sharing: {
            checkObjectFileSharing: function (objectId, IsMainObject) {
                $.ajax({
                    type: "POST",
                    url: '/Sharing/checkObjectFileSharing/',
                    data: {
                        objectId: objectId
                    },
                    dataType: "json",
                    success: function (response) {
                        var responseData = JSON.parse(response.data);
                        if (responseData.Success) {
                            View.load('AddSharingFiles', { ObjectId: AppV.GetGlobals().ObjectId, IsMainObject: IsMainObject, linkID: "", IsEditMode: false });
                        } else {
                            Notification.SetNotification(SwResourceObject.PleaseContactYourSystemAdministratorIfYouNeedPermissionToPerformThisAction, 'warning', 5000);
                        }
                    }
                });
            },
            InternalFunction: {
                PropertiesSharedFiles: function () {
                    var objectId = -1;
                    var linkID = "";
                    var result = Helper.FilterTreelistFocusedNodeKey("InternalsharingFilesGrid", "ID")[0];
                    if (result !== null || typeof result != "undefined") {
                        linkID = result.LinkID;
                        objectId = result.ObjectId;
                    }
                    if (Helper.IsEmpty(null, linkID)) {
                        Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 4500);
                        return;
                    }
                    if (objectId < 0) {
                        Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 4500);
                        return;
                    }
                    $.ajax({
                        type: "POST",
                        url: '/Sharing/checkObjectFileSharing/',
                        data: {
                            objectId: objectId
                        },
                        dataType: "json",
                        success: function (response) {
                            var responseData = JSON.parse(response.data);
                            if (responseData.Success) {
                                View.load('AddSharingFiles', { ObjectId: objectId, IsMainObject: true, linkID: linkID, IsEditMode: true });
                            } else {
                                Notification.SetNotification(SwResourceObject.PleaseContactYourSystemAdministratorIfYouNeedPermissionToPerformThisAction, 'warning', 5000);
                            }
                        }
                    });
                },
                OpenRecordSharedFiles: function (openlink) {
                    var linkID = "";
                    var result = Helper.FilterTreelistFocusedNodeKey("InternalsharingFilesGrid", "ID")[0];
                    if (result !== null || typeof result != "undefined") {
                        linkID = result.LinkID;
                    }
                    if (Helper.IsEmpty(null, linkID)) {
                        Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 4500);
                        return;
                    }
                    $.ajax({
                        type: "POST",
                        url: '/Sharing/OpenLinkSharedFiles/',
                        data: {
                            linkID: linkID,
                            openlink: openlink
                        },
                        dataType: "json",
                        success: function (response) {
                            var responseData = JSON.parse(response.data);
                            if (responseData.Success) {
                                var encryptedUrl = responseData.CustomAttributes.encryptedUrl;
                                if (Helper.IsEmpty(null, encryptedUrl)) {
                                    Notification.SetNotification(SwResourceObject.PleaseTryAgain, 'warning', 4500);
                                    return;
                                }
                                if (openlink) {
                                    Helper.open(encryptedUrl, '_blank');
                                } else {
                                    Helper.CopyTextToClipboard(encryptedUrl);
                                    return;
                                }
                            } else {
                                Notification.SetNotification(responseData.Message, 'warning', 5000);
                            }
                        }
                    });

                },
                RemoveFromListSharedFiles: function () {
                    var sharedListIds = [];
                    var result;
                    result = Helper.FilterTreeListSelectedNodeKeys("InternalsharingFilesGrid", "ID");
                    if (result.length == 0) {
                        result = Helper.FilterTreelistFocusedNodeKey("InternalsharingFilesGrid", "ID")[0];
                        if (result !== null || typeof result != "undefined") {
                            if (result.ObjectId > 0 && result.SharingID > 0) {
                                sharedListIds.push(result.SharingID);
                            }
                        }
                    } else {
                        result.forEach(function (entry) {
                            if (entry.ObjectId > 0 && entry.SharingID > 0) {
                                sharedListIds.push(entry.SharingID);
                            }
                        });
                    }
                    if (sharedListIds.length == 0) {
                        Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 4500);
                        return;
                    }
                    $.ajax({
                        type: "POST",
                        url: '/Sharing/RemoveFromListSharedFiles/',
                        data: {
                            sharedListIds: sharedListIds
                        },
                        dataType: "json",
                        success: function (response) {
                            var responseData = JSON.parse(response.data);
                            if (responseData.Success) {
                                Notification.SetNotification(responseData.Message, 'success', 5000);
                                cbpInternalSharedFiles.PerformCallback({ reload: true });
                            } else {
                                Notification.SetNotification(SwResourceObject.FailedToApplyChanges, 'warning', 5000);
                            }
                        }
                    });
                },
                RemoveFromListAllExpireSharedFiles: function () {
                    $.ajax({
                        type: "POST",
                        url: '/Sharing/RemoveFromListAllExpireSharedFiles/',
                        data: {
                        },
                        dataType: "json",
                        success: function (response) {
                            var responseData = JSON.parse(response.data);
                            if (responseData.Success) {
                                Notification.SetNotification(responseData.Message, 'success', 5000);
                                cbpInternalSharedFiles.PerformCallback({ reload: true });
                            } else {
                                Notification.SetNotification(SwResourceObject.FailedToApplyChanges, 'warning', 5000);
                            }
                        }
                    });
                },
                SetPasswordSharedFiles: function () {
                    var sharedListIds = MainGrid.Sharing.InternalFunction.GetsharedListIds();
                    var password = _retypesharedPasswPopUp.GetText();
                    if (sharedListIds == null || sharedListIds.length == 0) {
                        Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 4500);
                        return;
                    }
                    if (Helper.IsEmpty(null, password)) {
                        Notification.SetNotification(SwResourceObject.Password + " " + SwResourceObject.IsRequired, 'warning', 4500);
                        return;
                    }
                    $.ajax({
                        type: "POST",
                        url: '/Sharing/SetPasswordSharedFiles/',
                        data: {
                            sharedListIds: sharedListIds,
                            password: password
                        },
                        dataType: "json",
                        success: function (response) {
                            var responseData = JSON.parse(response.data);
                            if (responseData.Success) {
                                pcSharedPaswPopUp.Hide();
                                Notification.SetNotification(responseData.Message, 'success', 5000);
                                cbpInternalSharedFiles.PerformCallback({ reload: true });
                            } else {
                                Notification.SetNotification(SwResourceObject.FailedToApplyChanges, 'warning', 5000);
                            }
                        }
                    });
                },

                SetActionSharedFiles: function (isPass) {
                    if (isPass == 1) {
                        MainGrid.Sharing.InternalFunction.SetPasswordSharedFiles();
                    } else {
                        MainGrid.Sharing.InternalFunction.SetExpiryDateSharedFiles();
                    }
                },

                RemovePasswordSharedFiles: function () {
                    var sharedListIds = MainGrid.Sharing.InternalFunction.GetsharedListIds();
                    if (sharedListIds == null || sharedListIds.length == 0) {
                        Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 4500);
                        return;
                    }
                    $.ajax({
                        type: "POST",
                        url: '/Sharing/RemovePasswordSharedFiles/',
                        data: {
                            sharedListIds: sharedListIds
                        },
                        dataType: "json",
                        success: function (response) {
                            var responseData = JSON.parse(response.data);
                            if (responseData.Success) {
                                Notification.SetNotification(responseData.Message, 'success', 5000);
                                cbpInternalSharedFiles.PerformCallback({ reload: true });
                            } else {
                                Notification.SetNotification(SwResourceObject.FailedToApplyChanges, 'warning', 5000);
                            }
                        }
                    });
                },
                SetExpiryDateSharedFiles: function () {
                    var sharedListIds = MainGrid.Sharing.InternalFunction.GetsharedListIds();
                    var expiryDate = TbExpiryDate.GetText();
                    if (sharedListIds == null || sharedListIds.length == 0) {
                        Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 4500);
                        return;
                    }
                    if (Helper.IsEmpty(null, expiryDate)) {
                        Notification.SetNotification(SwResourceObject.ExpiryDate + " " + SwResourceObject.IsRequired, 'warning', 4500);
                        return;
                    }
                    $.ajax({
                        type: "POST",
                        url: '/Sharing/SetExpiryDateSharedFiles/',
                        data: {
                            sharedListIds: sharedListIds,
                            expiryDate: expiryDate
                        },
                        dataType: "json",
                        success: function (response) {
                            var responseData = JSON.parse(response.data);
                            if (responseData.Success) {
                                pcSharedPaswPopUpExpire.Hide();
                                Notification.SetNotification(responseData.Message, 'success', 5000);
                                cbpInternalSharedFiles.PerformCallback({ reload: true });
                            } else {
                                Notification.SetNotification(SwResourceObject.FailedToApplyChanges, 'warning', 5000);
                            }
                        }
                    });
                },
                RemoveExpiryDateSharedFiles: function () {
                    var sharedListIds = MainGrid.Sharing.InternalFunction.GetsharedListIds();
                    if (sharedListIds == null || sharedListIds.length == 0) {
                        Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 4500);
                        return;
                    }
                    $.ajax({
                        type: "POST",
                        url: '/Sharing/RemoveExpiryDateSharedFiles/',
                        data: {
                            sharedListIds: sharedListIds
                        },
                        dataType: "json",
                        success: function (response) {
                            var responseData = JSON.parse(response.data);
                            if (responseData.Success) {
                                Notification.SetNotification(responseData.Message, 'success', 5000);
                                cbpInternalSharedFiles.PerformCallback({ reload: true });
                            } else {
                                Notification.SetNotification(SwResourceObject.FailedToApplyChanges, 'warning', 5000);
                            }
                        }
                    });
                },
                GetsharedListIds: function () {
                    var sharedListIds = [];
                    var result;
                    result = Helper.FilterTreeListSelectedNodeKeys("InternalsharingFilesGrid", "ID");
                    if (result.length == 0) {
                        result = Helper.FilterTreelistFocusedNodeKey("InternalsharingFilesGrid", "ID")[0];
                        if (result !== null || typeof result != "undefined") {
                            if (!Helper.IsEmpty(null, result.LinkID)) {
                                if (!sharedListIds.includes(result.LinkID)) {
                                    sharedListIds.push(result.LinkID);
                                }
                            }
                        }
                    } else {
                        result.forEach(function (entry) {
                            if (!Helper.IsEmpty(null, entry.LinkID)) {
                                if (!sharedListIds.includes(entry.LinkID)) {
                                    sharedListIds.push(entry.LinkID);
                                }
                            }
                        });
                    }
                    return sharedListIds;
                }
            },

            DisplayFromButtonContextMenu: function () {
                var s = {};
                var e = {};
                s = window["InternalsharingFilesGrid"];
                e.objectType = "Node";
                e.objectKey = InternalsharingFilesGrid.focusedKey;
                var offset = $("#MainSharedFilesMenuButton").offset();
                e.htmlEvent = { clientX: offset.left, clientY: offset.top };
                try {
                    MainGrid.Sharing.Display_ContextMenu(s, e);
                } catch (e) {
                    console.log(e);
                }
            },
            ShowAllSharedFiles_CheckedChanged: function (s, e) {
                cbpInternalSharedFiles.PerformCallback({ reload: true });
            },
            Display_ContextMenu: function (s, e) {
                if (e.objectType === "Node") {
                    var x = ASPxClientUtils.GetEventX(e.htmlEvent);
                    var y = ASPxClientUtils.GetEventY(e.htmlEvent);
                    MainGrid.Sharing.EnabledDisableSharingContextMenu();
                    CtxMenuMenuSharedFiles.ShowAtPos(x, y);
                }
            },

            EnabledDisableSharingContextMenu: function () {
                try {
                    var result = Helper.FilterTreeListSelectedNodeKeys("InternalsharingFilesGrid", "ID");
                    var enabled = true;
                    var linkIdIds = [];
                    if (result.length > 0) {
                        result.forEach(function (element) {
                            if (!linkIdIds.includes(element.LinkID)) {
                                linkIdIds.push(element.LinkID);
                            }
                            if (element.LinkID == null || element.LinkID =="undefined") {
                                enabled = false;
                            }
                        });
                        if (linkIdIds.length > 1)
                            enabled = false;
                    };
                    var CtxSharedProperties =window.CtxMenuMenuSharedFiles.GetItemByName("CtxSharedProperties");
                    if (typeof CtxSharedProperties != "undefined" && CtxSharedProperties!=null)
                        CtxSharedProperties.SetEnabled(enabled);
                    var CtxSharedopenRecord = window.CtxMenuMenuSharedFiles.GetItemByName("CtxSharedopenRecord");
                    if (typeof CtxSharedopenRecord != "undefined" && CtxSharedopenRecord != null)
                        CtxSharedopenRecord.SetEnabled(enabled);
                    var CtxSharedCopyLink = window.CtxMenuMenuSharedFiles.GetItemByName("CtxSharedCopyLink");
                    if (typeof CtxSharedCopyLink != "undefined" && CtxSharedCopyLink != null)
                            CtxSharedCopyLink.SetEnabled(enabled);

                } catch (e) {
                    console.log(e.message);
                }
            },
            OnItemClickCtxMenuSharedFiles_ItemClick: function (s, e) {
                switch (e.item.name) {
                    case "CtxSharedProperties":
                        MainGrid.Sharing.InternalFunction.PropertiesSharedFiles();
                        break;
                    case "CtxSharedopenRecord":
                        MainGrid.Sharing.InternalFunction.OpenRecordSharedFiles(true);
                        break;
                    case "CtxSharedCopyLink":
                        MainGrid.Sharing.InternalFunction.OpenRecordSharedFiles(false);
                        break;
                    case "CtxSharedRefresh":
                        cbpInternalSharedFiles.PerformCallback({ reload: true });
                        break;
                    case "CtxSharedRemoveFromList":
                        Helper.ShowConfirmPopUp("SolidWorks", SwResourceObject.AreYouSureYouWantToContinue,
                            "MainGrid.Sharing.InternalFunction.RemoveFromListSharedFiles()");
                        break;
                    case "CtxSharedRemoveFromListAllExpire":
                        Helper.ShowConfirmPopUp("SolidWorks", SwResourceObject.AreYouSureYouWantToContinue,
                            "MainGrid.Sharing.InternalFunction.RemoveFromListAllExpireSharedFiles()");
                        break;
                    case "CtxSharedExpandAll":
                        window["InternalsharingFilesGrid"].ExpandAll();
                        break;
                    case "CtxSharedCollapseAll":
                        window["InternalsharingFilesGrid"].CollapseAll();
                        break;
                    case "CtxSharedSetPassword":
                        View.load('AddSharedPasw', { isPass: true, isExternal: false });
                        break;
                    case "CtxSharedRemovePassword":
                        Helper.ShowConfirmPopUp("SolidWorks", SwResourceObject.AreYouSureYouWantToContinue,
                            "MainGrid.Sharing.InternalFunction.RemovePasswordSharedFiles()");
                        break;
                    case "CtxSharedSetExpiryDate":
                        View.load('AddSharedExpire', { isPass: false, isExternal: false });

                        break;
                    case "CtxSharedRemoveExpiryDate":
                        Helper.ShowConfirmPopUp("SolidWorks", SwResourceObject.AreYouSureYouWantToContinue,
                            "MainGrid.Sharing.InternalFunction.RemoveExpiryDateSharedFiles()");
                        break;
                }
            },

            SharingAction_Shown: function (isPass) {
                if (isPass == 1) {
                    _retypesharedPasswPopUp.SetText('');
                } else {
                    TbExpiryDate.SetText('');
                }
            },

            ResizeSharingData: function () {
                var hight = window.outerHeight;
                var difference = MainRibbon.GetHeight();
                var toolbar = 20;
                if (typeof InternalsharingFilesGrid !== "undefined") {
                    if (InternalsharingFilesGrid.GetToolbarByName("fileSharingToolbar") != null) {
                        toolbar = InternalsharingFilesGrid.GetToolbarByName("fileSharingToolbar").GetHeight();
                    }
                }
                difference += toolbar;
                var fileShare = RightPageControlPanel.GetTabByName("FileShare");
                if (fileShare !=null && typeof fileShare !="undefined") {
                    fileShare = fileShare.tabControl;
                    if (fileShare != null) {
                        hight = fileShare.adjustedSizes.height;
                    }
                }
                if (hight > 0) hight = hight - difference;
                if (typeof InternalsharingFilesGrid !== "undefined")
                    InternalsharingFilesGrid.SetHeight(hight);
            },
            SharingGrid_EndCallback: function (s, e) {
                MainGrid.Sharing.ResizeSharingData();
            },
            SharingGrid_BeginCallback: function (s, e) {
                var showAll = typeof SharedFilesShowAllCheckBox != "undefined" ? SharedFilesShowAllCheckBox.GetValue() : false;
                e.customArgs["showAll"] = showAll;
            },
            PassTypeSharing_Init: function (newPass, sendByEmail) {
                if (newPass != "" && newPass != null) {
                    var pass = Math.random().toString(36).substring(2);
                    var passStrong = pass.charAt(0).toUpperCase() + pass.substring(1);
                    TbObptionsPass.SetText(passStrong);
                }
                if (Boolean(sendByEmail)) {
                    BtnFileSharingOK.SetText("Send Email");
                } else {
                    BtnFileSharingOK.SetText("Copy Link");
                }
            },
            OpenSharingFiles_Shown: function (IsMainObject, IsEditMode) {
                var displayName = "";
                var count = 1;
                if (IsMainObject == 1) {
                    var recordKeys = Object.keys(MainGrid.GetSelectedRowValues());
                    recordKeys.forEach(function (key) {
                        if (recordKeys.length != count) {
                            displayName += MainGrid.GetSelectedRowValues()[key].PartNumber + " " + MainGrid.GetSelectedRowValues()[key].Description + " , ";
                        } else {
                            displayName += MainGrid.GetSelectedRowValues()[key].PartNumber + " " + MainGrid.GetSelectedRowValues()[key].Description;
                        }
                        count++;
                    });
                } else {
                    var result = Helper.FilterTreeListSelectedNodeKeys("relatedFilesRecords", "FileId");
                    result.forEach(function (item) {
                        if (result.length != count) {
                            displayName += item.FileName + " , ";
                        } else {
                            displayName += item.FileName;
                        }
                        count++;
                    });
                }
                TbSharedFiles.SetText(displayName);
                TbObptionsPass.SetText('');
                TbObptionsPass.SetEnabled(false);
                TbObptionsExpiryDate.SetText('');
                TbObptionsExpiryDate.SetEnabled(false);
                FileSharingOptions.SetValue(false);
                TbSharedFilesEmails.SetText('');
                CmbTemplateFileSharing.Clear();
            },
            TypeSharing_CheckedChanged: function (s, e) {
                var options = FileSharingOptions.GetValue();
                TbObptionsPass.SetEnabled(options);
                TbObptionsExpiryDate.SetEnabled(options);
                FileSharingGenerate.SetEnabled(options);
                FileSharingGenerate.SetValue(options);
                FileSharingShowPass.SetEnabled(options);
                if (!options) {
                    TbObptionsPass.SetText('');
                    TbObptionsExpiryDate.SetText('');
                    lblInfoPassword.SetVisible(false);
                } else {
                    var expiryDateSchedule = new Date(Date.now() + 12096e5);
                    TbObptionsExpiryDate.SetValue(expiryDateSchedule);
                }
                MainGrid.Sharing.TypeSharingGeneratePassword();
                MainGrid.Sharing.TypeSharingGenerateShow();
            },

            TypeSharing_KeyPress: function (s, e) {
                lblInfoPassword.SetVisible(true);
            },
            TypeSharingGeneratePassword: function (s, e) {
                var passGenerate = FileSharingGenerate.GetValue();
                if (passGenerate) {
                    var pass = Math.random().toString(36).substring(2);
                    var passStrong = pass.charAt(0).toUpperCase() + pass.substring(1);
                    TbObptionsPass.SetText(passStrong);
                } else {
                    TbObptionsPass.SetText('');
                }
            },
            TypeSharingGenerateShow: function () {
                var passShow = FileSharingShowPass.GetValue();
                if (passShow) {
                    TbObptionsPass.GetInputElement().type = 'text';
                } else {
                    TbObptionsPass.GetInputElement().type = 'password';
                }
            },
            TemplateFileSharing: function () {
                var useTemplate = useThisTemplateFileSharing.GetValue();
                CmbTemplateFileSharing.SetEnabled(useTemplate);
                if (!useTemplate) {
                    CmbTemplateFileSharing.Clear();
                }
            },

            TypeSharing_SelectedIndexChanged: function (type) {
                if (type == 0) {
                    TbSharedFilesEmails.SetEnabled(true);
                    sharefileCopyLink.SetValue(0);
                    BtnFileSharingOK.SetText("Send Email");
                } else {
                    TbSharedFilesEmails.SetEnabled(false);
                    sharefileEmail.SetValue(1);
                    BtnFileSharingOK.SetText("Copy Link");
                    TbSharedFilesEmails.SetText('');
                }
            },
            TbSharedFilesEmails_Validation: function (s, e, emailRegularExpression) {
                if (sharefileEmail.GetValue() == 0) {
                    if (e.value != "" && e.value != null) {
                        var validEmails = '';
                        var IncorrectEmails = '';
                        var isValid = true;
                        var emails = e.value.split(",");
                        emails.forEach(function (element) {
                            if (!emailRegularExpression.test(element)) {
                                isValid = false;
                                IncorrectEmails += element + ",";
                            } else {
                                validEmails += element + ",";
                            }
                        });
                        TbSharedFilesEmails.SetValue(validEmails);
                        if (!isValid) {
                            e.isValid = false;
                            e.errorText = "Email" + " " + IncorrectEmails.substring(0, IncorrectEmails.length - 1) + " is incorrec";
                        } else {
                            e.isValid = true;
                        }
                    }
                }
            },
            BtnFileSharingOK_Click: function (IsMainObject, IsEditMode, LinkID) {
                var sharedFilesEmail = sharefileEmail.GetValue();
                var sharedCopyLink = sharefileCopyLink.GetValue();

                var sendByEmail = true;
                if (sharedFilesEmail == 0) sendByEmail = true;
                if (sharedCopyLink == 1) sendByEmail = false;

                var displayName = TbSharedFiles.GetText();
                var options = FileSharingOptions.GetValue();

                var password = TbObptionsPass.GetText();
                var expiryDate = TbObptionsExpiryDate.GetText();
                var emailAdresses = TbSharedFilesEmails.GetText();


                var useThisTemplate = useThisTemplateFileSharing.GetValue();
                var templateID = Number(CmbTemplateFileSharing.GetValue());

                if (!Helper.IsNotEmpty(null, displayName)) {
                    Notification.SetNotification(SwResourceObject.PleaseEnterADisplayName, 'warning', 4500);
                    return;
                }

                if (sendByEmail && !Helper.IsNotEmpty(null, emailAdresses)) {
                    Notification.SetNotification(SwResourceObject.PleaseCheckYourData, 'warning', 4500);
                    return;
                }
                if (useThisTemplate && (templateID == null || templateID == "" || templateID <= 0)) {
                    Notification.SetNotification(SwResourceObject.ChooseFile + " " + SwResourceObject.Template, 'warning', 4500);
                    return;
                }
                var sharingData = {
                    objectId: AppV.GetGlobals().ObjectId,
                    emailAdresses: emailAdresses,
                    useThisTemplate: useThisTemplate,
                    templateID: templateID,
                    sharingSettings: {
                        displayName: displayName,
                        sendByEmail: sendByEmail,
                        options: options,
                        password: password,
                        expiryDate: expiryDate
                    },
                    filesData: []
                };
                if (!IsEditMode) {
                    if (IsMainObject == 1) {
                        var recordKeys = Object.keys(MainGrid.GetSelectedRowValues());
                        recordKeys.forEach(function (key, index) {
                            var item = {
                                FileId: -1,
                                FileName: MainGrid.GetSelectedRowValues()[key].FileName,
                                IsFolder: false,
                                IsPrimary: true,
                                Version: 0,
                                RecordId: MainGrid.GetSelectedRowValues()[key].RecordId,
                                ObjectId: MainGrid.GetSelectedRowValues()[key].ObjectId,
                                RecordGuid: MainGrid.GetSelectedRowValues()[key].RecordGuid,
                            };
                            sharingData.filesData.push(item);
                        });
                        if (sharingData.filesData.length === 0) {
                            var result = JSON.parse(window["gridViewDocuments"].cpAllRowData).filter(function (x) {
                                return x.idRecord == Number(Helper.GetGridFocusedRowKey("gridViewDocuments", gridViewDocuments.focusedRowIndex));
                            })[0];
                            var item = {
                                FileId: -1,
                                FileName: result.FileName,
                                IsFolder: false,
                                IsPrimary: true,
                                Version: 0,
                                RecordId: result.RecordId,
                                ObjectId: result.ObjectId,
                                RecordGuid: result.RecordGuid
                            };
                            sharingData.filesData.push(item);
                        }
                        if (sharingData.filesData.length === 0) {
                            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 4500);
                            return;
                        }
                    } else {
                        var resultFiles = Helper.FilterTreeListSelectedNodeKeys("relatedFilesRecords", "FileId");
                        if (typeof (resultFiles) === 'undefined' || resultFiles === null || resultFiles.length === 0) {
                            Notification.SetNotification(SwResourceObject.PleaseSelectAFile, 'warning', 3500);
                            return;
                        }
                        resultFiles.forEach(function (itemfiles) {
                            var item = {
                                FileId: itemfiles.FileId,
                                FileName: itemfiles.VersioningFileName,
                                IsFolder: itemfiles.IsFolder,
                                IsPrimary: itemfiles.IsPrimary,
                                Version: itemfiles.Version,
                                RecordId: AppV.GetGlobals().RecordId,
                                ObjectId: AppV.GetGlobals().ObjectId,
                                RecordGuid: AppV.GetGlobals().RecordGuid,
                            };
                            sharingData.filesData.push(item);
                        });
                    }
                }
                Request.ajax({
                    type: "POST",
                    url: '/Sharing/ShareRelatedFiles/',
                    data: {
                        sharingData: JSON.stringify(sharingData),
                        IsEditMode: Boolean(IsEditMode),
                        EditLinkID: LinkID

                    },
                    dataType: "json"
                }).then(function (response) {
                    window.loadingPanel.Hide();
                    var responseData = JSON.parse(response.data);
                    if (responseData.Success) {
                        pcModalSharingFiles.Hide();
                        Notification.SetNotification(responseData.Message, 'success', 5000);
                        if (IsEditMode == 1) {
                            cbpInternalSharedFiles.PerformCallback({ reload: true });
                        }
                        if (!sendByEmail) {
                            Helper.CopyTextToClipboard(responseData.CustomAttributes.encryptedUrl);
                            return;
                        }
                    } else {
                        Notification.SetNotification(responseData.Message, 'warning', 5000);
                    }

                }).then(function () { window.loadingPanel.Hide(); });

            }
        },
    };


})();


;
var App = {
    Exporting: false
};


App.Filters = {
    ObjectId: -1
};


window.onbeforeunload = function (e) {
    if (AppV.GetTabsState().length > 0 && !App.Exporting) {
        var dialogText = "There are open tabs: Do you want to continue?";
        e.returnValue = dialogText;
        return dialogText;
    }
    App.Exporting = false;
}



App.State = {
    NewFrom:
    {
        AutoNumber: "",
        fieldName: "",
        objNbs: ""
    },
    WhereUsed: {
        selectedGrid: 13
    }
};


App.ExludeMethodsFromObject = function (item = null) {
    if (Helper.GetCookie("IsViewer") != 1) return;

    var ObjectsToConsider = []; //'MainRibbon.GetItemByName("New")'

    if (item != null) {
        ObjectsToConsider = [];
        item.forEach(function (item) {
            ObjectsToConsider.push(item);
        });
    }

    ObjectsToConsider.forEach(function (itm) {
        if (typeof itm != "undefined") {
            itm = itm + ".SetEnabled = function () { }";
            eval(itm);
        }
    });
    ObjectsToConsider = [];
};

App.Global = {
    BottomTabStates: {
        Properties: false,
        ReleatedFiles: false,
        WhereUsed: false,
        BOM: false,
        TODO: false,
        ReferenceFiles: false,
        Items: false,
        Attachments: false,
        Notes: false,
        SubProcesses: false,
        Configuration: false,
        AuditTrail: false,
        WhereUsedAsField: false,
        Workflow: false,
        Emails: false,
        GanttChart: false,
        Notifications: false
    },

    ClearBottomTabStates: function () {
        this.BottomTabStates.Properties = false;
        this.BottomTabStates.ReleatedFiles = false;
        this.BottomTabStates.WhereUsed = false;
        this.BottomTabStates.BOM = false;
        this.BottomTabStates.ToDo = false;
        this.BottomTabStates.ReferenceFiles = false;
        this.BottomTabStates.Items = false;
        this.BottomTabStates.History = false;
        this.BottomTabStates.SpecialObjects = false;
        this.BottomTabStates.Attachments = false;
        this.BottomTabStates.Notes = false;
        this.BottomTabStates.SubProcesses = false;
        this.BottomTabStates.AuditTrail = false;
        this.BottomTabStates.Configuration = false;
        this.BottomTabStates.WhereUsedAsField = false;
        this.BottomTabStates.Workflow = false;
        this.BottomTabStates.ReferencedField = false;
        this.BottomTabStates.ProjectDeliverables = false;
        this.BottomTabStates.Emails = false;
        this.BottomTabStates.GanttChart = false;
        this.BottomTabStates.Notifications = false;
    },

    BottomPanelHeigh: 300,

    ResetBottomTabIndex: true,

    SplitterResize: function () {
        //var propHeight = window.mainSplFullScreenMode.GetPaneByName(
        //    "mainSplPropertyPanel"
        //).lastHeight;
        if (AppV.GetGlobals().isMainWindow) {
            var gridHeight = window.mainSplFullScreenMode.GetPaneByName(
                "mainSplGridPanel"
            ).lastHeight;
            var height = this.GetPropertyFieldHeight();
            //var heightGrid = gridHeight - propHeight - 70;
            window.gridViewDocuments.SetHeight(gridHeight);
            // window.gridViewDocuments.SetHeight(heightGrid);

            if (AppV.GetHomeObjects().MenuSelected === enums.HomeModules.Tasks) {
                document.getElementById("taskTreeHome").style.height = gridHeight + "px";
            }

            try {
                if (document.getElementById("DvpropertieFields") !== null) {
                    document.getElementById("DvpropertieFields").style.height = height;
                }


                if (document.getElementById("processHistorySplitter") !== null) {
                    processHistorySplitter.SetHeight(height.replace("px", ""));
                    RzHistory.ProcessHistoryPanelResize();
                }
                if (Helper.IsElementVisible("DvpropertieFields")) {
                    RzProperties.InitDocumentSection();

                }

                if (document.getElementById("DvBomFields") !== null)
                    document.getElementById("DvBomFields").style.height = height;
                if (document.getElementById("DvRelatedFilesBtm") !== null)
                    document.getElementById("DvRelatedFilesBtm").style.height = height;
                if (document.getElementById("DvWhereUsedBtm") !== null)
                    document.getElementById("DvWhereUsedBtm").style.height = height;


                // Should be in init or Endcallback and not all the tabs when we have only one selected

                //RzProperties.CalculateHeightForToDo();

                //RzProperties.CalculateHeightForSubProcesses();

                //RzProperties.CalculateHeightForNotes();

                //RzProperties.CalculateHeightForReferenceFiles();

                //RzProperties.CalculateHeightForSWConfiguration();

                //RzProperties.CalculateHeightForEmail();

                //RzProperties.CalculateHeightForWhereUsedAsField();

            } catch (e) {
                console.log(e.message);
            }
        }
    },

    GetPropertyFieldHeight: function () {
        var propHeight = window.mainSplFullScreenMode.GetPaneByName(
            "mainSplPropertyPanel"
        ).lastHeight;
        var height;
        if (propHeight > 0) {
            height = propHeight - 60;
            App.Global.BottomPanelHeigh = height;
        } else {
            height = App.Global.BottomPanelHeigh;
        }
        return height.toString().concat("px");
    },

    SetViewerRightsRibbonDisable: function (name) {
        try {
            if (!AppV.GetGlobals().isMainWindow) {
                if (Helper.GetCookie("IsViewer") == 1) {
                    window.DisableItem(enums.RibbonNames.Properties, name);
                }
            }
        } catch (e) {
            console.log(e.message);
        }
    },
    SetViewerRightsRibbonEnableDisable: function (name) {
        try {
            if (!AppV.GetGlobals().isMainWindow) {
                if (Helper.GetCookie("IsViewer") == 1) {
                    window.DisableItem(enums.RibbonNames.Properties, name);
                } else {
                    window.EnableItems(enums.RibbonNames.Properties, name);
                }
            }
        } catch (e) {
            console.log(e.message);
        }
    }
};

App.Controls = {
    Name: {
        FindFieldName: function (ctrlName, strExtension) {
            //returns fiel name (ex: ctrlname = fld1234callbackPanel, strExtension = callbackPanel , returns  fld1234)
            return ctrlName.replace(strExtension, "");
        },

        FindControlName: function (fieldName, strExtension) {
            //returns controlName  (ex: fieldName = fld1234, strExtension = callbackPanel , returns  fld1234callbackPanel)
            return fieldName.concat(strExtension);
        },

        FindSystemName: function (controlName) {
            //returns field System Name  (ex: fieldName = fld1234-3452, returns  fld1234)
            return controlName.split("-")[0];
        },

        GetControlName: function (fieldSystemName, objectId, strExtension = "") {
            return fieldSystemName + "-" + objectId + strExtension;
        }
    }
};

App.GridView = {
    Callback: {
        TreeView: function (topMenuSelected, clearCache = false) {

            if (AppV.GetGlobals().IsSpecialObject === true) {
                topMenuSelected = enums.Modules.SpecialObject;
            }

            window[AppV.GetFiltersState.TreeName].PerformCallback({
                topMenuSelected: topMenuSelected,
                clearCache: clearCache
            });
        }
    }
};

App.PropertyCard = {
    Callback: {
        Properties: function (objectId, recordId, isPreviewMode) {
            window.cbpPrpCardBtmSection.PerformCallback({
                objectId: objectId,
                recordId: recordId,
                isPreviewMode: isPreviewMode,
                hasEditRights: false,
                getFields: true,
                height: window.App.Global.GetPropertyFieldHeight()
            });
        },

        WhereUsed: function (objectId, recordId, recordGuid) {
            window.cbpWhereUsedSection.PerformCallback({
                objectId: objectId,
                recordId: recordId,
                recordGuid: recordGuid,
                isPreviewMode: AppV.GetGlobals().isMainWindow,
                selectedGrid: App.State.WhereUsed.selectedGrid
            });
        },

        RelatedFiles: function (objectId, recordId, recordGUID, objectType = -9999) {
            window.cbpRelatedFilesSection.PerformCallback({
                idObject: objectId,
                idRecord: recordId,
                isPreviewMode: false,
                recordGuid: recordGUID,
                objectType: objectType
            });
        },

        RelatedFilesPreview: function (objectId, recordId, recordGUID, objType) {
            window.cbpRelatedFilesSection.PerformCallback({
                idObject: objectId,
                idRecord: recordId,
                isPreviewMode: true,
                height: window.App.Global.GetPropertyFieldHeight(),
                recordGuid: recordGUID,
                objectType: objType
            });
        },

        ReferenceFiles: function (objectId, recordId) {
            window.cbpReferenceFilesSection.PerformCallback({
                objectId: objectId,
                recordId: recordId,
                isPreviewMode: false
            });
        },

        ReferenceFilesPreview: function (objId, recId) {
            window.cbpReferenceFilesSection.PerformCallback({
                objectId: objId,
                recordId: recId,
                isPreviewMode: true,
                height: window.App.Global.GetPropertyFieldHeight()
            });
        },

        BOM: function (objectId, recordId) {
            if (AppV.GetGlobals().isMainWindow) {
                window.cbpBomSection.PerformCallback({
                    objectId: objectId,
                    idRecord: recordId,
                    isPreviewMode: AppV.GetGlobals().isMainWindow,
                    height: window.App.Global.GetPropertyFieldHeight()
                });
            } else {
                window.cbpBomSection.PerformCallback({
                    objectId: objectId,
                    idRecord: recordId,
                    isPreviewMode: AppV.GetGlobals().isMainWindow
                });
            }
        },

        NotesPreview: function (objectId, recordGuid, objectType) {
            window.cbpNotesSection.PerformCallback({
                objectId: objectId,
                recordGuid: recordGuid,
                objectType: objectType
            });
        },

        Notes: function (objectId, recordGuid, objectType) {

            window.cbpNotesSection.PerformCallback({
                objectId: objectId,
                recordGuid: recordGuid,
                objectType: objectType
            });
        },
        AuditTrail: function (objectId, recordGuid, recordId) {
            window.cbpAuditTrial.PerformCallback({
                objectId: objectId,
                recordGuid: recordGuid,
                recordId: recordId
            });
        },
        History: function (objectId, recordId, recordGuid, IsPreviewMode) {
            window.cbpHistory.PerformCallback({
                objectId: objectId,
                idRecord: recordId,
                recordGuid: recordGuid,
                IsPreviewMode: IsPreviewMode,
                showMinorRevisions: typeof ShowMinorRevisionsChkb == 'undefined' ? false : window.ShowMinorRevisionsChkb.GetValue()
            });
        },
        PHistory: function (objectId, recordGuid) {
            window.ProcessesHistoryGrid.PerformCallback({
                objectId: objectId,
                recordGuid: recordGuid
            });
        },
        SpecialObject: function (objectId, recordId) {
            var so = AppV.GetPropertyTabsState().SpecialObject;
            if (!Helper.IsObjectEmpty(so)) {
                var performCallbackObj = "cbpSpecialObjects" + so.GroupObjectId;
                window[performCallbackObj].PerformCallback({
                    relatedObjectId: so.RelatedObjectId,
                    groupObjId: so.GroupObjectId,
                    objectId: objectId,
                    idRecord: recordId,
                    IsPreviewMode: AppV.GetGlobals().isMainWindow
                });
            }
        },

        ReferencedField: function (objectId, recordId, shouldReload = false) {
            var rf = AppV.GetPropertyTabsState().ReferencedField;
            if (!Helper.IsObjectEmpty(rf)) {
                var performCallbackObj = "cbpReferencedField" + rf.ObjectFieldPropertyTabId;
                window[performCallbackObj].PerformCallback({
                    objectFieldPropertyTabId: rf.ObjectFieldPropertyTabId,
                    //groupObjId: so.GroupObjectId,
                    objectId: objectId,
                    recordId: recordId,
                    shouldReload: shouldReload
                });
            }
        },

        Items: function (objectId, recordGuid, idRecord) {
            Processes.State.reload = true;
            window.ProcessRelatedItemGridcbPanel.PerformCallback({
                objectId: objectId,
                recordGuid: recordGuid,
                idRecord: idRecord,
                isPreviewMode: AppV.GetGlobals().isMainWindow
            });
        },

        ToDo: function (objectId, recordGuid) {
            window.cbpToDoSection.PerformCallback({
                objectId: objectId,
                recordGuid: recordGuid,
                stageId: window.Processes.State.StageId
            });
        },


        ToDoPreview: function (objectId, recordGuid) {
            window.cbpToDoSection.PerformCallback({
                objectId: objectId,
                recordGuid: recordGuid,
                stageId: window.Processes.State.StageId || -1
            });
        },

        AttachmentsPreview: function (taskId) {
            window.cbpTasksAttachements.PerformCallback({
                taskId: taskId,
                isHomeTask: true
            });
        },

        SubProcesses: function (objectId, recordGuid) {
            window.cbpSubProcessesSection.PerformCallback({
                objectId: objectId,
                recordGuid: recordGuid
            });
        },

        WhereUsedAsField: function (objectId, recordId, recordGuid) {
            window.cbpWhereUsedAsFieldSection.PerformCallback({
                objectId: objectId,
                recordId: recordId,
                recordGuid: recordGuid
            });
        },

        Configuration: function (objectId, recordId) {
            window.cbpConfigurationSection.PerformCallback({
                objectId: objectId,
                recordId: recordId
            });
        },

        ProjectDeliverables: function (objectId, recordId, recordGuid) {
            window.cbpProjectDeliverables.PerformCallback({
                objectId: objectId,
                recordGuid: recordGuid,
                recordId: recordId,
                stageId: window.Processes.State.StageId
            });
        }
    }
};
/*
class Observable {
    // each instance of the Observer class
    // starts with an empty array of things (observers)
    // that react to a state change
    constructor() {
      this.observers = [];
    }
  
    // add the ability to subscribe to a new object / DOM element
    // essentially, add something to the observers array
    subscribe(f) {
        if(!this.observers.includes(f))
            this.observers.push(f);
    }
  
    // add the ability to unsubscribe from a particular object
    // essentially, remove something from the observers array
    unsubscribe(f) {
      this.observers = this.observers.filter(subscriber => subscriber !== f);
    }
  
    // update all subscribed objects / DOM elements
    // and pass some data to each of them
    notify(data) {
      this.observers.forEach(observer => observer(data));
    }
}*/

//Compiled version of class 
"use strict";

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var Observable = function () {
    // each instance of the Observer class
    // starts with an empty array of things (observers)
    // that react to a state change
    function Observable() {
        _classCallCheck(this, Observable);

        this.observers = [];
    }

    // add the ability to subscribe to a new object / DOM element
    // essentially, add something to the observers array


    _createClass(Observable, [{
        key: "subscribe",
        value: function subscribe(f) {
            if (!this.observers.includes(f)) this.observers.push(f);
        }

        // add the ability to unsubscribe from a particular object
        // essentially, remove something from the observers array

    }, {
        key: "unsubscribe",
        value: function unsubscribe(f) {
            this.observers = this.observers.filter(function (subscriber) {
                return subscriber !== f;
            });
        }

        // update all subscribed objects / DOM elements
        // and pass some data to each of them

    }, {
        key: "notify",
        value: function notify(data) {
            this.observers.forEach(function (observer) {
                return observer(data);
            });
        }
    }]);

    return Observable;
}();


var UI = new Observable();

;
var AppV = (function () {

    _push = function (obj, _context, saveToCookie) {
        Object.keys(obj).forEach(function (key, index) {
            _context[key] = obj[key];
            if (saveToCookie)
                _createCookie(key, obj[key]);
        });
    }
    _pushValue = function (param, value, _context, saveToCookie) {
        _context[param] = value;
        if (saveToCookie)
            _createCookie(param, value);
    }
    _performClear = function (c) {
        var objectsToClear = objectDependency()[c];
        objectsToClear.forEach(function (obj) {
            _currentState[obj].clear();
        })
    }
    _createCookie = function (key, value) {
        Helper.CreateCookie(Core().keyToAdd(key), value);
    }

    function Core() {
        function dfObject(instanceName, defaultObj) {
            return {
                data: defaultObj().default,
                handler: defaultObj().handler,
                _proxy: function () {
                    return _proxyCreator(instanceName, this.data, this.handler);
                },
                push: function (obj) {
                    _push(obj, this._proxy());
                },
                pushValue: function (param, value) {
                    _pushValue(param, value, this._proxy());
                },
                _get: function () {
                    return this._proxy();
                }
            }
        }
        return {
            createInstance: (instanceName, defaultObj) => { return new dfObject(instanceName, defaultObj); },
            keyToAdd: function (key) {
                return key + "RZCookie";
            }
        }
    }

    globalObj = function () {
        return {
            default: {
                ObjectId: -1,
                RecordId: -1,
                ObjectGuid: "",
                RecordGuid: "",
                SubObjectGuid: "",
                SubObjectId: -1,
                UrlEncrypted: "",
                AddNewUrlEncrypted: "",
                SectionId: "",
                StageId: -1,
                ObjectType: "",
                ModuleName: enums.Modules.Documents,
                isMainWindow: false,
                currentPage: 1,
                pageSizeItem: enums.Paggination.pageSizeItem,
                GroupObjectId: -1,
                RelatedObjectId: -1,
                PdmIsConnected: false,
                ////Removethis
                IsSpecialObject: false,
                webFormId:-1

            },
            handler: {
                _current: "Global",
                get: function (obj, prop) {

                    if (!obj.hasOwnProperty(prop)) {
                        console.log(prop + " state does not exist!");
                    }

                    if (prop === 'ObjectId') {
                        if (obj[prop] == -1 && obj["ModuleName"] != enums.Modules.Home) {
                            if (typeof gridViewDocuments != "undefined")
                                gridViewDocuments.SetVisible(false);
                        }
                    }
                    if (prop === "pageSizeItem" && Helper.CookieExist(Core().keyToAdd('pageSizeItem')))
                        return Helper.GetCookie(Core().keyToAdd('pageSizeItem'));

                    return obj[prop];
                },

                set: function (obj, prop, value) {
                    if (arguments.callee.caller !== null) {
                        if (!obj.hasOwnProperty(prop)) {
                            console.log(prop + " state does not exist!");
                            return false;
                        }

                        if (prop === 'ModuleName') {
                            this.reset(obj, ['isMainWindow']);
                        }

                        if (prop === 'SectionId') {

                            if (Helper.Contains("section", value)) {
                                this.reset(obj, ['ModuleName', 'isMainWindow']);
                            }
                        }

                        if (prop === 'ObjectId') {

                            if (obj[prop] > 0 && obj[prop] != value) {
                                _performClear(this._current);
                                this.reset(obj, ['ModuleName', 'isMainWindow']);
                            }
                        }

                        obj[prop] = value;
                        return true;
                    }
                },
                reset: function (obj, statesToKeep = []) {
                    var newObj = globalObj().default;

                    Object.keys(newObj)
                        .filter(function (e) {
                            return this.indexOf(e) < 0;
                        },
                            statesToKeep).forEach(function (key, index) {
                                obj[key] = newObj[key];
                            });
                }
            }
        }

    };
    propertyTabObj = function () {
        return {
            default: {
                SpecialObject: {},
                ReferencedField: {},
                CheckStatus: -1,
                GroupObjectId: -1,
                IsCheckedOutBySelf:true,
                ActiveTab: ""
            },
            handler: {
                get: function (obj, prop) {
                    if (prop === enums.AppV.SpecialObject && Helper.Contains("_SpecialObject", obj.ActiveTab)) {
                        if (obj[prop].hasOwnProperty(obj.ActiveTab)) {
                            return obj[prop][obj.ActiveTab];
                        }
                    } else if (prop === enums.AppV.ReferencedField && Helper.Contains("_ReferencedField", obj.ActiveTab)) {
                        if (obj[prop].hasOwnProperty(obj.ActiveTab)) {
                            return obj[prop][obj.ActiveTab];
                        }
                    }
                    return obj[prop];
                },
                set: function (obj, prop, value) {
                    if (arguments.callee.caller !== null)
                        obj[prop] = value;
                },
                reset: function (obj, statesToKeep = []) {
                    var newObj = propertyTabObj().default;

                    Object.keys(newObj)
                        .filter(function (e) {
                            return this.indexOf(e) < 0;
                        },
                            statesToKeep).forEach(function (key, index) {
                                obj[key] = newObj[key];
                            });
                }
            }
        }
    };
    myWorkObj = function () {
        return {
            default: {
                ModuleSelected: enums.TOT.Objects,
                AssignedToSelected: true,
                FileStatusSelected: enums.FileStatusToShow.Any,
                RowFilterShow: false,
                PanelSearchShow: false
            },
            handler: {
                get: function (obj, prop) {
                    return obj[prop];
                },
                set: function set(obj, prop, value) {
                    if (arguments.callee.caller !== null)
                        obj[prop] = value;
                },
                reset: function (obj, statesToKeep = []) {
                    var newObj = myWorkObj().default;

                    Object.keys(newObj)
                        .filter(function (e) {
                            return this.indexOf(e) < 0;
                        },
                            statesToKeep).forEach(function (key, index) {
                                obj[key] = newObj[key];
                            });
                }
            }
        }
    };
    SpecialObject = function () {
        return {
            default: {
                GroupObjectId: -1,
                RelatedObjectId: -1,
                IsMulti: false
            },
            handler: {
                get: function (obj, prop) {
                    return obj[prop];
                },
                set: function (obj, prop, value) {
                    if (arguments.callee.caller !== null) {
                        if (prop == "clear") {
                            this.reset(obj);
                            return;
                        }
                        obj[prop] = value;
                    }
                },
                reset: function (obj, statesToKeep = []) {
                    var newObj = SpecialObject().default;
                    Object.keys(newObj)
                        .filter(function (e) {
                            return this.indexOf(e) < 0;
                        },
                            statesToKeep).forEach(function (key, index) {
                                obj[key] = newObj[key];
                            });
                }
            }
        }
    };
    ReferencedField = function () {
        return {
            default: {
                GroupObjectId: -1,
                RelatedObjectId: -1,
                ObjecFieldPropertyTabId: -1,
                RowFilterShow: false,
                PanelSearchShow: false
            },
            handler: {
                get: function (obj, prop) {
                    return obj[prop];
                },
                set: function (obj, prop, value) {
                    if (arguments.callee.caller !== null) {
                        if (prop == "clear") {
                            this.reset(obj);
                            return;
                        }
                        obj[prop] = value;
                    }
                },
                reset: function (obj, statesToKeep = []) {
                    var newObj = ReferencedField().default;
                    Object.keys(newObj)
                        .filter(function (e) {
                            return this.indexOf(e) < 0;
                        },
                            statesToKeep).forEach(function (key, index) {
                                obj[key] = newObj[key];
                            });
                }
            }
        }
    };
    objectDependency = function () {
        return {
            Global: ["SpecialObject"],
            SpecialObject: []
        }
    }
    mainGridObj = function () {
        return {
            default: {}
        }
    }
    HomeObject = function () {
        return {
            default: {
                MenuSelected: ""
            },
            handler: {
                get: function (obj, prop) {
                    return obj[prop];
                },
                set: function (obj, prop, value) {
                    if (arguments.callee.caller !== null) {
                        if (prop == "clear") {
                            this.reset(obj);
                            return;
                        }
                        obj[prop] = value;
                    }

                },
                reset: function (obj, statesToKeep = []) {
                    var newObj = HomeObject().default;

                    Object.keys(newObj)
                        .filter(function (e) {
                            return this.indexOf(e) < 0;
                        },
                            statesToKeep).forEach(function (key, index) {
                                obj[key] = newObj[key];
                            });
                }
            }
        }
    };
    TasksHomeObject = function () {
        return {
            default: {
                TreeSelected: 0,
                ShowCompleted: true,
                PanelSearchShow: false
            },
            handler: {
                get: function (obj, prop) {
                    return obj[prop];
                },
                set: function set(obj, prop, value) {
                    if (arguments.callee.caller !== null)
                        obj[prop] = value;
                },
                reset: function (obj, statesToKeep = []) {
                    var newObj = myWorkObj().default;

                    Object.keys(newObj)
                        .filter(function (e) {
                            return this.indexOf(e) < 0;
                        },
                            statesToKeep).forEach(function (key, index) {
                                obj[key] = newObj[key];
                            });
                }
            }
        }
    };
    TimesheetsHomeObject = function () {
        return {
            default: {
                isUser: false,
                StageId: -1,
                UserId: -1,
                TreeSelected: 0,
                ShowApproved: false,
                PanelSearchShow: false,
                isEdit: false,
                state:enums.TimeSheetState.NEWTIMESHEET
            },
            handler: {
                get: function (obj, prop) {
                    return obj[prop];
                },
                set: function set(obj, prop, value) {
                    if (arguments.callee.caller !== null)
                        obj[prop] = value;
                },
                reset: function (obj, statesToKeep = []) {
                    var newObj = myWorkObj().default;

                    Object.keys(newObj)
                        .filter(function (e) {
                            return this.indexOf(e) < 0;
                        },
                            statesToKeep).forEach(function (key, index) {
                                obj[key] = newObj[key];
                            });
                }
            }
        }
    };

    FiltersObject = function () {
        return {
            default: {
                ObjectId: -1,
                FilterId: -1,
                TreeName: "MainTreeList",
                GroupObjectId: -1,
                CalledFrom: enums.Modules.Documents
            },
            handler: {
                get: function (obj, prop) {
                    return obj[prop];
                },
                set: function set(obj, prop, value) {
                    if (arguments.callee.caller !== null)
                        obj[prop] = value;
                },
                reset: function (obj, statesToKeep = []) {
                    var newObj = FiltersObject().default;

                    Object.keys(newObj)
                        .filter(function (e) {
                            return this.indexOf(e) < 0;
                        }, statesToKeep).forEach(function (key, index) {
                            obj[key] = newObj[key];
                        });
                }
            }
        }
    };
    TaskFiltersObject = function () {
        return {
            default: {
                ObjectId: -1,
                FilterId: -1
            },
            handler: {
                get: function (obj, prop) {
                    return obj[prop];
                },
                set: function set(obj, prop, value) {
                    if (arguments.callee.caller !== null)
                        obj[prop] = value;
                },
                reset: function (obj, statesToKeep = []) {
                    var newObj = TaskFiltersObject().default;

                    Object.keys(newObj)
                        .filter(function (e) {
                            return this.indexOf(e) < 0;
                        }, statesToKeep).forEach(function (key, index) {
                            obj[key] = newObj[key];
                        });
                }
            }
        }
    };
    SpecialObjectTree = function () {
        return {
            default: {
                ObjectId: -1,
                GroupObjectId: -1,
                RelatedObjectId: -1,
                FilterId: -1
            },
            handler: {
                get: function (obj, prop) {
                    return obj[prop];
                },
                set: function set(obj, prop, value) {
                    if (arguments.callee.caller !== null)
                        obj[prop] = value;
                },
                reset: function (obj, statesToKeep = []) {
                    var newObj = SpecialObjectTree().default;

                    Object.keys(newObj)
                        .filter(function (e) {
                            return this.indexOf(e) < 0;
                        }, statesToKeep).forEach(function (key, index) {
                            obj[key] = newObj[key];
                        });
                }
            }
        }
    };

    var _proxy_instances = [],
        _proxyCreator = function (objToProxy, data, handler) {
            return (typeof _proxy_instances[objToProxy] === "undefined") ? _proxy_instances[objToProxy] = new Proxy(data, handler) : _proxy_instances[objToProxy];
        }

    var _currentState = {
        Global: {
            data: globalObj().default,
            handler: globalObj().handler,
            _proxy: function () {
                return _proxyCreator("Global", this.data, this.handler);
            },
            push: function (obj, saveToCookie) {
                _push(obj, this._proxy(), saveToCookie);
            },
            pushValue: function (param, value, saveToCookie) {
                _pushValue(param, value, this._proxy(), saveToCookie);
            },
            _get: function () {
                return this._proxy();
            }
        },
        PropertyTabs: {
            data: propertyTabObj().default,
            handler: propertyTabObj().handler,
            _proxy: function () {
                return _proxyCreator("PropertyTabs", this.data, this.handler);
            },
            push: function (obj) {
                if (typeof obj._action !== "undefined" && obj._action == enums.AppV.SpecialObject) {
                    _push(obj, this._proxy().SpecialObject["_SpecialObject" + "-" + obj.GroupObjectId + "-" + obj.RelatedObjectId + "-" + obj.IsMulti] = SpecialObject().default);
                } else if (typeof obj._action !== "undefined" && obj._action == enums.AppV.ReferencedField) {
                    _push(obj, this._proxy().ReferencedField["_ReferencedField" + "-" + obj.ObjectFieldPropertyTabId] = ReferencedField().default);
                }
                else {
                    _push(obj, this._proxy());
                }
            },
            pushValue: function (param, value) {
                _pushValue(param, value, this._proxy());
            },
            _get: function () {
                return this._proxy();
            },
            clear: function (obj) {
                if (obj)
                    Helper.findAndRemove(_proxy_instances, "PropertyTabs");
                else
                    this.data = propertyTabObj().default;
                //this.data[obj] = {};
            }
        },
        SpecialObject: {
            _action: enums.AppV.SpecialObject,
            data: SpecialObject().default,
            handler: SpecialObject().handler,
            _proxy: function () {
                return _proxyCreator("SpecialObject", this.data, this.handler);
            },
            push: function (obj) {
                obj._action = this._action;
                _currentState.PropertyTabs.push(obj);
                _push(obj, this._proxy());
            },
            pushValue: function (param, value) {
                _pushValue(param, value, this._proxy());
            },
            _get: function () {
                return this._proxy();
            },
            clear: function () {
                this.data = SpecialObject().default;
                _currentState.PropertyTabs.clear(this._action);
            }
        },
        ReferencedField: {
            _action: enums.AppV.ReferencedField,
            data: ReferencedField().default,
            handler: ReferencedField().handler,
            _proxy: function () {
                return _proxyCreator("ReferencedField", this.data, this.handler);
            },
            push: function (obj) {
                obj._action = this._action;
                _currentState.PropertyTabs.push(obj);
                _push(obj, this._proxy());
            },
            pushValue: function (param, value) {
                _pushValue(param, value, this._proxy());
            },
            _get: function () {
                return this._proxy();
            },
            clear: function () {
                this.data = ReferencedField().default;
                _currentState.PropertyTabs.clear(this._action);
            }
        },
        Bom: {

        },
        MyWork: {
            data: myWorkObj().default,
            handler: myWorkObj().handler,
            _proxy: function () {
                return _proxyCreator("MyWork", this.data, this.handler);
            },
            push: function (obj) {
                _push(obj, this._proxy());
            },
            pushValue: function (param, value) {
                _pushValue(param, value, this._proxy());
            },
            _get: function () {
                return this._proxy();
            }
        },
        TasksHome: Core().createInstance("TasksHome", TasksHomeObject),
        TimesheetsHome: Core().createInstance("TimesheetsHome", TimesheetsHomeObject),
        Filters: Core().createInstance("Filters", FiltersObject),
        TaskFilters: Core().createInstance("TaskFilters", TaskFiltersObject),
        SpecialObjectTree: Core().createInstance("SpecialObjectTree", SpecialObjectTree),
        Tabs: {
            push: function (obj) {
                this.data.push(obj.url);
            },
            clear: function () {

                $.ajax({
                    type: "POST",
                    url: "/Common/ClearTabCache"
                });

                this.data.forEach(function (el) {
                    el.close();
                });
                this.data = [];
            },
            data: []
        },
        AdditionalInformation: {
            selectedProcessHistoryZoom: 100,
            firstSystemLoad: true,
            minifyScripts: true,
            jsBundles: []
        },
        HomeObject: {
            data: HomeObject().default,
            handler: HomeObject().handler,
            _proxy: function () {
                return _proxyCreator("HomeObject", this.data, this.handler);
            },
            push: function (obj) {
                _push(obj, this._proxy());
            },
            pushValue: function (param, value) {
                _pushValue(param, value, this._proxy());
            },
            _get: function () {
                return this._proxy();
            },
            clear: function () {
                this.pushValue("clear", true);
            }
        }
    };

    return {
        GetGlobals: function () {
            return _currentState.Global._get();
        },
        GetPropertyTabsState: function () {
            return _currentState.PropertyTabs._get();
        },
        GetMyWorkState: function () {
            return _currentState.MyWork._get();
        },
        GetTasksHomeState: function () {
            return _currentState.TasksHome._get();
        },
        GetTimesheetsHomeState: function () {
            return _currentState.TimesheetsHome._get();
        },
        get GetFiltersState() {
            return _currentState.Filters._get();
        },
        get GetTaskFiltersState() {
            return _currentState.TaskFilters._get();
        },
        get GetSpecialObjectTree() {
            return _currentState.SpecialObjectTree._get();
        },
        GetTabsState: function () {
            var clearThisIndexes = [];
            _currentState.Tabs.data.forEach(function (val, index) {
                if (val == null) {
                    clearThisIndexes.push(index);
                }
                else {
                    if (val.closed || val.frames == null || val.opener == null) {
                        clearThisIndexes.push(index);
                    }
                }
            });
            for (var i = clearThisIndexes.length - 1; i >= 0; i--)
                _currentState.Tabs.data.splice(clearThisIndexes[i], 1);

            return _currentState.Tabs.data;

        },
        GetAdditionalInfo: function () {
            return _currentState.AdditionalInformation;
        },
        GetHomeObjects: function () {
            return _currentState.HomeObject._get();
        },
        GetReferencedFieldState: function () {
            return _currentState.ReferencedField._get();
        },
        PushAdditionalInfo: function (key, val) {
            _currentState.AdditionalInformation[key] = val;
        },
        PushStateMyWork: function (param, val) {
            _currentState.MyWork.pushValue(param, val);
        },
        PushStateTasksHome: function (param, val) {
            _currentState.TasksHome.pushValue(param, val);
        },
        PushStateTimesheetsHome: function (param, val) {
            if (typeof param == "object" && val == null) {
                _currentState.TimesheetsHome.push(param);
            }
            else {
                _currentState.TimesheetsHome.pushValue(param, val);
            }
        },
        PushStateFilters: function (param, val) {
            _currentState.Filters.pushValue(param, val);
        },
        PushStateReferencedField: function (param, val) {
            _currentState.ReferencedField.pushValue(param, val);
        },
        PushStateSpecialObjectTree: function (param, val) {
            _currentState.SpecialObjectTree.pushValue(param, val);
        },
        pushState: function (stateObj, objToPush) {
            if (typeof _currentState[stateObj] !== "undefined")
                _currentState[stateObj].push(objToPush);
        },
        clearState: function (stateObj) {
            if (typeof _currentState[stateObj] !== "undefined")
                _currentState[stateObj].clear();
        },
        /**
         * Clears Global Object
         */
        clearGlobalState: function () {
            _currentState.Global.clear();
        },
        /**
         * Closes all the tabs that where open from this current Tab
         * @example >AppV.closeOtherTabs();
         */
        closeOtherTabs: function () {
            _currentState.Tabs.clear();
        },
        /**
         * Changes the State of the Global object
         * @param {Object} format {"Key":"Value"} get the keys from const.js// enums.State OR {String} // enums.State
         * @param {String} values optional in case first param is an object else the value of a field
         * @example >AppV.pushGlobalState({[enums.State.RecordId]:123,[enums.State.RecordGuid:"1234"]})
         * @example >AppV.pushGlobalState([enums.State.RecordId],123) OR in case you do, you are confident of typos u can use
         * @example >AppV.pushGlobalState("ObjectId",123);
         */
        pushGlobalState: function (param, val = null, saveToCookie = false) {
            if (typeof param == "object" && val == null) {
                _currentState.Global.push(param, saveToCookie)
            }
            else {
                _currentState.Global.pushValue(param, val, saveToCookie);
            }
        }
    }
})();

;
var View = (function () {
    var lastRequestObj = {};
    var _ajax = function (options) {
        return new window.Promise(function (resolve, reject) {
            $.ajax(options)
                .done(resolve)
                .fail(reject);
        });
    }

    var loadNextView = function (el) {
        el.loadAsync.forEach(function (val) {
            setTimeout(function () { View.load(val); }, 200);
        });
    },

        renderNextView = function (el, data, continuousLoad = false, callback) {
            el.loadAsync.forEach(function (val) {
                setTimeout(function () { View.renderPartial(val, data, continuousLoad, callback); }, 200);
            });
        },

        popUpSucces = function (response, el, show) {
            $("#" + el.container).html(response);
            if (show) {
                try {
                    window[el.globalName].Show();// setTimeout(function () { window[el.globalName].Show(); }, 100);
                } catch (ex) {
                    if (lastRequestObj.shouldRetry)
                        View.load(lastRequestObj.el, lastRequestObj.data, lastRequestObj.show, lastRequestObj.callback, false);
                    else
                        loadingPanel.Hide();
                }
            }

        },

        // testFunc = function (el, show) {
        //     if (show)
        //         window[el.globalName].Show();
        // },

        cntxMenuSucess = function (response, el, x, y) {
            $("#" + el.container).html(response);
            window[el.globalName].ShowAtPos(x, y);
        },

        failure = function (err) {
            loadingPanel.Hide();
            console.log(err);
        }

    var saveLastRequest = function (el, data, show, callback) {
        lastRequestObj.shouldRetry = !(lastRequestObj.el === el);
        lastRequestObj.el = el;
        lastRequestObj.data = data;
        lastRequestObj.show = show;
        lastRequestObj.callback = callback;
    }
    var dependancyObject = {
        ChangePassword: function () {
            return {
                globalName: "ChangePasswordPopup",
                container: "_ChangePasswordPopup",
                url: "/Authentication/ChangePasswordLayout/"
            };
        },

        ModalPasswordDocPreview: function () {
            return {
                globalName: "ModalPasswordDocPreview",
                container: "_ModalPasswordDocPreview",
                url: "/File/ModalPasswordView/"
            };
        },

        ChangeTheme: function () {
            return {
                globalName: "pcModalTheme",
                container: "_popUpTheme",
                url: "/Common/ChangeTheme/"
            };
        },
        AboutPopUp: function () {
            return {
                globalName: "aboutPopup",
                container: "_aboutPopup",
                url: "/Common/AboutPopUp/"
            };
        },

        ExportFiles: function () {
            return {
                globalName: "pcModalExportFiles",
                container: "_pcModalExportFiles",
                url: "/ChangeData/ExportFiles/"
            };
        },
        CompareBom: function () {
            return {
                globalName: "pcModalCompare",
                container: "_pcModalCompare",
                url: "/Compare/GetCompareData/"
            };
        },
        BomInlineEdit: function () {
            return {
                globalName: "pcModalBomInlineEdit",
                container: "_pcModalBomInlineEdit",
                url: "/BillOfMaterials/BomInlineEdit/"
            };
        },
        ProcessItemsInlineEdit: function () {
            return {
                globalName: "pcModalProcessItemslineEdit",
                container: "_pcModalProcessItemslineEdit",
                url: "/ProcessItems/ProcessItemsInlineEdit/"
            };
        },
        ReloadLinkedFields: function () {
            return {
                globalName: "pcModalReloadLinkedFields",
                container: "_pcModalReloadLinkedFields",
                url: "/ChangeData/GetReloadLinkedFields/"
            };
        },
        ResetItemNumbers: function () {
            return {
                globalName: "pcModalResetItemNumbers",
                container: "_pcModalResetItemNumbers",
                url: "/ChangeData/GetResetItemNumbers/"
            };
        },
        ChangeQuantity: function () {
            return {
                globalName: "pcModalChangeQuantity",
                container: "_pcModalChangeQuantity",
                url: "/ChangeData/Quantity/"
            };
        },
        ImportFromExelFile: function () {
            return {
                globalName: "pcModalImportFromExelFile",
                container: "_pcModalImportFromExelFile",
                url: "/BillOfMaterials/GetImportFromExelFile/"
            };
        },
        ChangeConfiguration: function () {
            return {
                globalName: "pcModalChangeConfiguration",
                container: "_pcModalChangeConfiguration",
                url: "/ChangeData/Configuration/"
            };
        },
        Source: function () {
            return {
                globalName: "pcModalChangeSource",
                container: "_pcModalChangeSource",
                url: "/ChangeData/Source/"
            };
        },
        NumberingSchemes: function () {
            return {
                globalName: "pcModalNumberingSchemes",
                container: "_pcModalNumberingSchemes",
                url: "/ChangeData/NumberingSchemes/"
            };
        },
        ReplaceBOM: function () {
            return {
                globalName: "pcModalReplace",
                container: "_pcModalReplace",
                url: "/ChangeData/Replace/"
            };
        },
        AddSimple: function () {
            return {
                globalName: "pcModalAddSimple",
                container: "_pcModalAddSimple",
                url: "/AddSimple/AddSimple/"
            };
        },
        CopyFrom: function () {
            return {
                globalName: "pcModalCopyFrom",
                container: "_pcModalCopyFrom",
                url: "/CopyFrom/CopyFrom/"
            };
        },

        CopyFromGrid: function () {
            return {
                globalName: "pcModalCopyFromGrid",
                container: "_pcModalCopyFromGrid",
                url: "/CopyFrom/CopyFromGrid/"
            };
        },

        CompareAddSimpleBom: function () {
            return {
                globalName: "pcModalAddSimpeCompare",
                container: "_pcModalAddSimpeCompare",
                url: "/Compare/AddSimple/"
            };
        },

        CreateTaskPopUp: function () {
            return {
                globalName: "CreateTaskPopUp",
                container: "_CreateTaskPopUp",
                url: "/Tasks/ShowPopUpControl/"
            };
        },

        ModalRelatedItems: function () {
            return {
                globalName: "pcModalRelatedItems",
                container: "_pcModalRelatedItems",
                url: "/RelatedItems/ShowPopUp/"
            };
        },

        AssignUsersPopUp: function () {
            return {
                globalName: "AssignUsersPopUp",
                container: "_AssignUsersPopUp",
                url: "/Tasks/GetTaskUsersToAssign/"
            };
        },

        TaskTemplatePopUp: function () {
            return {
                globalName: "pcModalTaskTemplate",
                container: "_pcModalTaskTemplate",
                url: "/Tasks/GetTaskTemplateView/"
            };
        },

        TaskAddTemplatePopUp: function () {
            return {
                globalName: "pcModalAddTaskTemplate",
                container: "_pcModalAddTaskTemplate", 
                url: "/Tasks/GetAddTaskTemplate/"
            };
        },

        ObjectTypePreview: function () {
            return {
                globalName: "pcModalObjectTypePreview",
                container: "_pcModalObjectTypePreview",
                url: "/Properties/ObjectTypePreviewModal/"
            };
        },

        ObjectType: function () {
            return {
                globalName: "pcModalObjectType",
                container: "_pcModalObjectType",
                url: "/Properties/GetObjectTypeList/"
            };
        },

        ObjectTypeInlineEdit: function () {
            return {
                globalName: "pcModalObjectTypeInlineEdit",
                container: "_pcModalObjectType",
                url: "/GridInlineEdit/ObjectType/"
            };
        },

        //CbpRelatedItemsPreview: function () {
        //    return {
        //        globalName: "cbpRelatedFilesBottomSection",
        //        container: "_cbpRelatedFilesBottomSection",
        //        url: "/RelatedFiles/GetReleatedFilesConfiguration/"
        //    };
        //},
        
        CbpTaskAttachmentsPreview: function () {
            return {
                globalName: "cbpTasksAttachements",
                container: "_cbpTasksAttachements",
                url: "/Tasks/GetTaskAttachmentsList/"
            };
        },

        NewFrom: function () {
            return {
                globalName: "NewFromPopup",
                container: "_NewFromPopup",
                url: "/PropertyCard/ShowNewFromPopup/"
            };
        },
        pcModalDocumentFile: function () {
            return {
                globalName: "pcModalDocumentFile",
                container: "_pcModalDocumentFile",
                url: "/Properties/DocumentFile/"
            };
        },
        addShortCutPopUp: function () {
            return {
                globalName: "addShortCutPopUp",
                container: "_addShortCutPopUp",
                url: "/Shortcut/AddShortcutPopup/"
            };
        },
        UserDetailsPopUp: function () {
            return {
                globalName: "UserDetailsPopUp",
                container: "_UserDetailsPopUp",
                url: "/PropertyCard/ShowUserDetailsPopUp/"
            };
        },
        pcModalExportFilesDocuments: function () {
            return {
                globalName: "pcModalExportFilesDocuments",
                container: "_pcModalExportFilesDocuments",
                url: "/File/ExportFilesDocumentsCallback/"
            };
        },

        pcModalCheckIn: function () {
            return {
                globalName: "pcModalCheckIn",
                container: "_pcModalCheckIn",
                url: "/Properties/GetCheckInPopUp/"
            };
        },

        pcModalCheckOutSw: function () {
            return {
                globalName: "pcModalCheckOutSw",
                container: "_pcModalCheckOutSw",
                url: "/Properties/GetCheckOutModal/"
            };
        },

        pcModalUndoCheckOutSw: function () {
            return {
                globalName: "pcModalUndoCheckOutSw",
                container: "_pcModalUndoCheckOutSw",
                url: "/Properties/UndoCheckoutModal/"
            };
        },

        pcAddVirtualConfiguration: function () {
            return {
                globalName: "pcAddVirtualConfiguration",
                container: "_pcAddVirtualConfiguration",
                url: "/SWConfiguration/GetAddVirtual/"
            };
        },

        pcMakeActiveInactive: function () {
            return {
                globalName: "pcMakeActiveInactive",
                container: "_pcMakeActiveInactive",
                url: "/SWConfiguration/GetMakeActiveInactive/"
            };
        },

        reportPreviewPopup: function () {
            return {
                globalName: "reportPreviewPopup",
                container: "_reportPreviewPopup",
                url: "/Reports/ReportPreviewCallback/"
            };
        },

        notePreviewPopup: function () {
            return {
                globalName: "noteViewerPopup",
                container: "_noteViewerPopup",
                url: "/Notes/DocumentViewerPopUpCallback/"
            };
        },

        addUsersPopup: function () {
            return {
                globalName: "pcModalAddUsers",
                container: "_pcModalAddUsers",
                url: "/Resources/GetAddUsers/"
            };
        },

        addUsersToAllStagesPopup: function () {
            return {
                globalName: "pcModalAddToAllSubstagesPopUp",
                container: "_pcModalAddToAllSubstagesPopUp",
                url: "/Resources/GetAddToAllSubstages/"
            };
        },

        timeLimitsPopup: function () {
            return {
                globalName: "pcModalTimeLimit",
                container: "_pcModalTimeLimit",
                url: "/Resources/GetTimeLimits/"
            };
        },

        emailMovePopup: function () {
            return {
                globalName: "pcModalMoveEmail",
                container: "_pcModalMoveEmail",
                url: "/Email/GetMovePopUp/"
            };
        },

        // Function Name called on Js
        notificationNewPopup: function () {
            return {
                globalName: "pcModalNewNotification",               // PopUp Name
                container: "_pcModalNewNotification",               // <div> Name
                url: "/Notifications/GetNewNotificationPopUp/"      // Controller
            };
        },

        notificationAddContactPopup: function () {
            return {
                globalName: "pcModalAddContactNotification",              
                container: "_pcModalAddContactNotification",               
                url: "/Notifications/GetAddContacNotificationPopUp/"
            };
        },

        notificationAddManuallyPopup: function () {
            return {
                globalName: "pcModalAddManuallyNotification",
                container: "_pcModalAddManuallyNotification",
                url: "/Notifications/GetAddManuallyNotificationPopUp/"
            };
        },

        notificationSaveAsTemplate: function () {
            return {
                globalName: "pcModalSaveAsTemplate",
                container: "_pcModalSaveAsTemplate",
                url: "/Notifications/GetSaveAsTemplate/"
            };
        },


        AddCommentPopup: function () {
            return {
                globalName: "AddCommentPopup",
                container: "_AddCommentPopup",
                url: "/Notes/AddCommentPopupCallback/"
            };
        },

        pcModalEditFilter: function () {
            return {
                globalName: "pcModalEditFilter",
                container: "_pcModalEditFilter",
                url: "/Filter/GetEditFilter/"
            };
        },

        pcRemoveFilter: function () {
            return {
                globalName: "pcRemoveFilter",
                container: "_pcRemoveFilter",
                url: "/Filter/RemoveFilterModal/"
            };
        },

        AddTimeShiftPopUp: function () {
            return {
                globalName: "AddTimeShiftPopUp",
                container: "_AddTimeShiftPopUp",
                url: "/Tasks/GetTimeSheetItemById/"
            };
        },

        AddNotePopUp: function () {
            return {
                globalName: "AddNotePopUp",
                container: "_AddNotePopUp",
                url: "/Tasks/ShowPopUpNotes/"
            };
        },
        NotificationsSection: function () {
            return {
                globalName: "NotificationsSection",
                container: "_NotificationsSection",
                url: "/Tasks/GetSectionView/"
            };
        },
        UsersSection: function () {
            return {
                globalName: "UsersSection",
                container: "_UsersSection",
                url: "/Tasks/GetSectionView/"
            };
        },
        HistorySection: function () {
            return {
                globalName: "HistorySection",
                container: "_HistorySection",
                url: "/Tasks/GetSectionView/"
            };
        },
        ProgressSection: function () {
            return {
                globalName: "ProgressSection",
                container: "_ProgressSection",
                url: "/Tasks/GetSectionView/"
            };
        },
        HtmlEditorPopUpControl: function () {
            return {
                globalName: "HtmlEditorPopUpControl",
                container: "_HtmlEditorPopUpControl",
                url: "/Properties/MaximizeMemo/"
            };
        },
        GridInlineEditorPopUpControl: function () {
            return {
                globalName: "GridInlineEditorPopUpControl",
                container: "_HtmlEditorPopUpControl",
                url: "/GridInlineEdit/MaximizeMemo/"
            };
        },
        ChangeOwnerPopUp: function () {
            return {
                globalName: "ChangeOwnerPopUp",
                container: "_ChangeOwnerPopUp",
                url: "/Tasks/ChangeOwnerPopUp/"
            };
        },

        ChooseStagePopUp: function () {
            return {
                globalName: "ChooseStagePopUp",
                container: "_ChooseStagePopUp",
                url: "/ToDo/ChooseStagePopUp/"
            };
        },

        pcModalAddAttachement: function () {
            return {
                globalName: "pcModalAddAttachement",
                container: "_pcModalAddAttachement",
                url: "/Tasks/GetAllowedObject/"
            };
        },
        AddTaskItemPopUp: function () {
            return {
                globalName: "AddTaskItemPopUp",
                container: "_AddTaskItemPopUp",
                url: "/Tasks/GetTimeListItemById/"
            };
        },
        AddTaskItemPopUpTaskTemplates: function () {
            return {
                globalName: "AddTaskItemPopUpTaskTemplates",
                container: "_AddTaskItemPopUpTaskTemplates",
                url: "/Tasks/GetTimeListItemById/"
            };
        },
        Dashboard: function () {
            return {
                globalName: "cbpDashBoardViewer",
                container: "_cbpDashBoardViewer",
                url: "/DashBoardViewer/_CallbackPanel/"
            };
        },
        DashboardItems: function () {
            return {
                globalName: "cbpDashboardItems",
                container: "_cbpDashboardItems",
                url: "/DashBoardViewer/GetDashboardItems/"
            };
        },
        MainTaskFilters: function () {
            return {
                globalName: "cbpMainTaskFilters",
                container: "_cbpMainTaskFilters",
                url: "/Main/GetHomeFiltersMenuCallback/"
            };
        },
        pcModalAddReleatedItem: function () {
            return {
                globalName: "pcModalAddReleatedItem",
                container: "_pcModalAddReleatedItem",
                url: "/Processes/GetAllowedObject/"
            };
        },
        pcModalMoveToSubProcess: function () {
            return {
                globalName: "pcModalMoveToSubProcess",
                container: "_pcModalMoveToSubProcess",
                url: "/Processes/GetItemsSubProcess/"
            };
        },
        pcModalTimesheets: function () {
            return {
                globalName: "pcModalTimesheets",
                container: "_pcModalTimesheets",
                url: "/Timesheets/GetTimesheetsData/"
            };
        },
        pcModalAddNewTimesheets: function () {
            return {
                globalName: "pcModalAddNewTimesheets",
                container: "_pcModalAddNewTimesheets",
                url: "/Timesheets/GetAddNewData/"
            };
        },
        fileUploadPopupControl: function () {
            return {
                globalName: "fileUploadPopupControl",
                container: "_fileUploadPopupControl",
                url: "/File/FileUploadPopup/"
            };
        },
        uploadNewerFilePopupControl: function () {
            return {
                globalName: "uploadNewerFilePopupControl",
                container: "_uploadNewerFilePopupControl",
                url: "/RelatedFiles/UploadNewerFilePopup/"
            };
        },
        AddReferenceContentPopUp: function () {
            return {
                globalName: "AddReferenceContentPopUp",
                container: "_AddReferenceContentPopUp",
                url: "/ReferenceFiles/AddReference/"
            };
        },
        SendToProcessesWhereUsed: function () {
            return {
                globalName: "pcSendToProcesses" + window.ActionToPerform.WhereUsed,
                container: "_pcSendToProcesses" + window.ActionToPerform.WhereUsed,
                url: "/Processes/GetProcessPopUp/"
            };
        },
        SendToProcessesBom: function () {
            return {
                globalName: "pcSendToProcesses" + window.ActionToPerform.BomInlineEdit,
                container: "_pcSendToProcesses" + window.ActionToPerform.BomInlineEdit,
                url: "/Processes/GetProcessPopUp/"
            };
        },
        SendToProcessesMainGrid: function () {
            return {
                globalName: "pcSendToProcesses" + window.ActionToPerform.MainGridDisplay,
                container: "_pcSendToProcesses" + window.ActionToPerform.MainGridDisplay,
                url: "/Processes/GetProcessPopUp/"
            };
        },
        SendToProcessesPropertyCard: function () {
            return {
                globalName: "pcSendToProcesses" + window.ActionToPerform.Edit,
                container: "_pcSendToProcesses" + window.ActionToPerform.Edit,
                url: "/Processes/GetProcessPopUp/"
            };
        },
        cbpBillOfMaterials: function () {
            return {
                globalName: "cbpBillOfMaterials",
                container: "_cbpBillOfMaterials",
                url: "/BillOfMaterials/_CallbackPanel/"
            };
        },
        cbpGridBillOfMaterials: function () {
            return {
                globalName: "cbpGridBillOfMaterials",
                container: "_cbpGridBillOfMaterials",
                url: "/BillOfMaterials/_GridViewCallbackPanel/"
            };
        },
        ModalCascadingValues: function () {
            return {
                globalName: "pcModalCascadingValues",
                container: "_pcModalCascadingValues",
                url: "/CascadingFields/GetCascadeFields/"
            };
        },
        ProcessPaswPopUp: function () {
            return {
                globalName: "_ProcessPaswPopUp",
                container: "ProcessPaswPopUp",
                url: "/Processes/GetProcessPasswPopUp/"
            };
        },
        PDMPaswPopUp: function () {
            return {
                globalName: "PdmPaswPopUp",
                container: "_PdmPaswPopUp",
                url: "/Pdm/GetPdmPasswPopUp/"
            };
        },

        AddImportXML: function () {
            return {
                globalName: "pcModalImportXML",
                container: "_pcModalImportXML",
                url: "/Projects/GetImportXML/"
            };
        },

        AddPertChart: function () {
            return {
                globalName: "pcModalPertChart",
                container: "_pcModalPertChart",
                url: "/Projects/GetPertChart/"
            };
        },
        AddNetworkDiagram: function () {
            return {
                globalName: "pcModalNetworkDiagram",
                container: "_pcModalNetworkDiagram",
                url: "/Projects/GetNetworkDiagram/"
            };
        },
        AddPlanningOptions: function () {
            return {
                globalName: "pcModalPlanningOptions",
                container: "_pcModalPlanningOptions",
                url: "/Projects/GetPlanningOptions/"
            };
        },
        AddPlanningSplitStage: function () {
            return {
                globalName: "pcModalSplitStage",
                container: "_pcModalSplitStage",
                url: "/Projects/GetPlanningSplitStage/"
            };
        },
        AddPlanningMoveProject: function () {
            return {
                globalName: "pcModalMoveProject",
                container: "_pcModalMoveProject",
                url: "/Projects/GetMoveProject/"
            };
        },
        AddDeletePlanningItem: function () {
            return {
                globalName: "pcModalDeleteItem",
                container: "_pcModalDeleteItem",
                url: "/Projects/GetDeleteProject/"
            };
        },
        AddOpenProject: function () {
            return {
                globalName: "pcModalOpenProject",
                container: "_pcModalOpenProject",
                url: "/Projects/GetOpenProject/"
            };
        },
        AddSplitStageItem: function () {
            return {
                globalName: "pcModalSplitStageItem",
                container: "_pcModalSplitStageItem",
                url: "/Projects/GetPlanningSplitStageItem/"
            };
        },
        addPlanningView: function () {
            return {
                globalName: "pcModalPlanningView",
                container: "_pcModalPlanningView",
                url: "/Projects/GetPlanningView/"
            };
        },
        AddUpdateFromTasks: function () {
            return {
                globalName: "pcModalUpdateFromTasks",
                container: "_pcModalUpdateFromTasks",
                url: "/Projects/GetUpdateFromTasks/"
            };
        },

        AddSharingFiles: function () {
            return {
                globalName: "pcModalSharingFiles",
                container: "_pcModalSharingFiles",
                url: "/Sharing/GetSharingFiles/"
            };
        },
        AddSharedPasw: function () {
            return {
                globalName: "pcSharedPaswPopUp",
                container: "_pcSharedPaswPopUp",
                url: "/Sharing/GetSharedPaswPopUp/"
            };
        },
        AddSharedExpire: function () {
            return {
                globalName: "pcSharedPaswPopUpExpire",
                container: "_pcSharedPaswPopUpExpire",
                url: "/Sharing/GetSharedExpirePopUp/"
            };
        },
        AddSharedExternal: function () {
            return {
                globalName: "pcSharedPaswPopUpExternal",
                container: "_pcSharedPaswPopUpExternal",
                url: "/Sharing/GetSharedExpirePopUpExternal/"
            };
        },
        
    };

    return {
        load: function (el, data = {}, show = true, callback = true, showLoadingPanel = true) {
            if (typeof dependancyObject[el] !== "undefined") {
                el = dependancyObject[el]();
                saveLastRequest(el.globalName, data, show, callback);
                if (typeof window[el.globalName] !== "undefined" && window[el.globalName] !== null) {//Think about this condition  &&!window[el.globalName].InCallback()) {  && document.getElementById(el.globalName) != null
                    if (callback) window[el.globalName].PerformCallback(data);
                    if (show) window[el.globalName].Show();
                }
                else {
                    if (showLoadingPanel)
                        loadingPanel.Show();
                    _ajax({
                        type: el.type || "POST",
                        url: el.url,
                        data: data
                    }).then(function (response) { popUpSucces(response, el, show); loadingPanel.Hide(); }, failure);
                    //.then(function () { testFunc(el, show); });
                }
            }
        },

        loadContextMenu: function (el, data, x, y) {
            if (typeof dependancyObject[el] !== "undefined") {
                el = dependancyObject[el]();
                if (typeof window[el.globalName] !== "undefined" && document.getElementById(el.globalName) != null) {
                    window[el.globalName].ShowAtPos(x, y);
                }
                else {
                    _ajax({
                        type: el.type || "POST",
                        url: el.url,
                        data: data || {}
                    }).then(function (response) { cntxMenuSucess(response, el, x, y); }, failure);
                }
            }
        },

        loadDynamic: function (el, data, suffix, show = true, showLoadingPanel = true) {
            if (typeof dependancyObject[el] !== "undefined") {
                el = dependancyObject[el]();
                el.globalName = el.globalName + suffix;
                el.container = el.container + suffix;
                if (typeof window[el.globalName] !== "undefined" && document.getElementById(el.globalName) != null) {
                    if (typeof data !== undefined) {
                        window[el.globalName].PerformCallback(data);
                    }
                    if (show) window[el.globalName].Show();
                }
                else {
                    if (showLoadingPanel)
                        loadingPanel.Show();
                    _ajax({
                        type: el.type || "POST",
                        url: el.url,
                        data: data || {}
                    }).then(function (response) { popUpSucces(response, el, show); loadingPanel.Hide(); }, failure);
                }
            }
        },
        Dom: {
            ModuleMenu: "nbMenuRZ",
            MainGrid: "gridViewDocuments",
            MainTree: "MainTreeList"
        },
        UpdateHeaderInformation: function (_shouldAddSystemName = true) {
            try {
                var userName = Helper.GetCookie("FullName");
                var systemName = Helper.GetCookie("systemNameSW");
                var version = Helper.GetCookie("systemVersionSW");
                if (typeof version === "undefined") {
                    version = document.getElementById('loggedInUserRibbon').textContent;
                    Helper.CreateCookie("systemVersionSW", version);
                }

                if (typeof userName !== "undefined") {
                    var systemNameToBeAdded = "";
                    if (typeof systemName !== "undefined" && _shouldAddSystemName)
                        systemNameToBeAdded = SwResourceObject.SystemName + ": " + systemName + "&nbsp;&nbsp;&nbsp;&nbsp;";

                    var newText = SwResourceObject.LoggedInAs + ": " + userName + "&nbsp;&nbsp;&nbsp;&nbsp;" + systemNameToBeAdded + version;
                    //document.getElementById('loggedInUserRibbon').innerHTML = newText;
                }
            }
            catch (err) {
            }
        }
    }


})();


var LetterAvatar = (function (w, d) {


    function LetterAvatar(name, size) {

        name = name || '';
        size = size || 60;

        var colours = [
            "#1abc9c", "#2ecc71", "#3498db", "#9b59b6", "#34495e", "#16a085", "#27ae60", "#2980b9", "#8e44ad", "#2c3e50",
            "#f1c40f", "#e67e22", "#e74c3c", "#ecf0f1", "#95a5a6", "#f39c12", "#d35400", "#c0392b", "#bdc3c7", "#7f8c8d"
        ],

            nameSplit = String(name).toUpperCase().split(' '),
            initials, charIndex, colourIndex, canvas, context, dataURI;


        if (nameSplit.length === 1) {
            initials = nameSplit[0] ? nameSplit[0].charAt(0) : '?';
        } else {
            initials = nameSplit[0].charAt(0) + nameSplit[1].charAt(0);
        }

        if (w.devicePixelRatio) {
            size = (size * w.devicePixelRatio);
        }

        charIndex = (initials === '?' ? 72 : initials.charCodeAt(0)) - 64;
        colourIndex = charIndex % 20;
        canvas = d.createElement('canvas');
        canvas.width = size;
        canvas.height = size;
        context = canvas.getContext("2d");

        context.fillStyle = colours[colourIndex - 1];
        context.fillRect(0, 0, canvas.width, canvas.height);
        context.font = Math.round(canvas.width / 2) + "px Arial";
        context.textAlign = "center";
        context.fillStyle = "#FFF";
        context.fillText(initials, size / 2, size / 1.5);

        dataURI = canvas.toDataURL();
        canvas = null;

        return dataURI;
    }
    var updateMenuItems = function () {
        var userName = Helper.GetCookie("FullName");
        var systemName = Helper.GetCookie("systemNameSW");
        if (userName) {
            $('#loggedInUserText').text(SwResourceObject.LoggedInAs + ": " + userName);
        }
        if (systemName) {
            $('#loggedInSiteText').text(SwResourceObject.SystemName + ": " + systemName);
        }

    }

    return {
        init: function () {
            Array.prototype.forEach.call(d.querySelectorAll('img[avatar]'), function (img, name) {
                name = Helper.GetCookie("FullName");
                img.src = LetterAvatar(name, img.getAttribute('width'));
                img.removeAttribute('avatar');
                img.setAttribute('alt', name);
            });
            updateMenuItems();
        }

    }
})(window, document);





;
var Helper = {
    /*
       * @param { String } message the message
       */
    log: function (message) {
        if (window.console) window.console.log(message);
    },
    findAndRemove: function (arr, el) {
        var elIndex = arr.indexOf(el);
        if (elIndex > -1)
            arr.slice(elIndex, 1);
    },
    /*
      * @param { String } copies the text
      */
    CopyTextToClipboard: function (text) {
        var textArea = document.createElement("textarea");
        textArea.value = text;
        textArea.textContent = text;

        document.body.appendChild(textArea);
        //textArea.focus();
        textArea.select();
        document.execCommand("copy");
        textArea.remove();
    },

    CreateCookie: function (name, value, days = 2) {
        if (days) {
            var date = new Date();
            date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
            var expires = "; expires=" + date.toGMTString();
        } else {
            var expires = "";
        }
        document.cookie = name + "=" + value + expires + "; path=/";
    },

    CookieExist: function (name) {
        return document.cookie.match(new RegExp(name + "=([^;]+)"));
    },

    /*
       * @param { String } cookieName
       */
    deleteCookie: function (cookieName) {
        document.cookie = cookieName + '=; Max-Age=-99999999;';
    },


    GetCookie: function (name) {
        var match = Helper.CookieExist(name);
        if (match)
            return match[1];
    },

    IsObjectEmpty: function (_obj) {
        var b; for (b in _obj) return !1; return !0;
    },


    stringToBoolean: function (string) {

        if (string === null || string === "" || string === undefined)
            return false;

        switch (string.toLowerCase().trim()) {
            case "true": case "yes": case "1": return true;
            case "false": case "no": case "0": case null: return false;
            default: return Boolean(string);
        }
    },

    /**
     * Format the given string. The remaining arguments replace the format specifies in the given string.
     * The format specifiers are of the form '{0}', '{1}' ... '{xxxx}'.
     * The first remaining argument replaces all occurences of the format specifier '{0}' and so on ...
     *
     * @param {String} format the format string
     * @param {String...} values the format values
     * @returns the formated string
     * @example >helper.format('{0} {1} {0}', 'Hello', 'World');
     * 'Hello World Hello'
     */
    format: function (format) {
        var formatted = format;
        for (var i = 1; i < arguments.length; i++) {
            var arg = i - 1;
            var regexp = new RegExp("\\{" + arg + "\\}", "gi");
            formatted = formatted.replace(regexp, arguments[i]);
        }
        return formatted;
    },

    /*
    Takes All the arguments and returns a single object. Keep in mind that the first and the second paramenter should be sender and event!!!!
    */
    PrepareObject: function () {
        var data = {};
        for (var i = 0; i < arguments.length; i++) {
            if (i == 0)
                data.sender = arguments[i];
            else if (i == 1)
                data.event = arguments[i];
            else
                data.i = arguments[i];
        }
        return data;
    },
    locateTheLabelOfTheField: function (field) {
        //var a = FieldVaildation.newFrom ? field.replace("NewFrom", "") : field;
        var d = document.getElementById(field + "div");
        return d.getAttribute('value').replace(":", "");
    },
    /*
       * @param { String } get the translation
       */
    T: function (key, _replace = true) {
        if (key === "" || key === null) {
            return "";
        }
        if ((typeof SwResourceObject[key] === "undefined" || SwResourceObject[key] == "") && _replace) {
            var text = key.replace(/([A-Z])/g, " $1").trim();
            return text;
        }
        else if ((typeof SwResourceObject[key] === "undefined" ||
            SwResourceObject[key] == "") &&
            !_replace) {
            return key;
        } else {
            return SwResourceObject[key];
        }
    },

    FindFieldName: function (ctrlName, strExtension) {
        //returns fiel name (ex: ctrlname = fld1234callbackPanel, strExtension = callbackPanel , returns  fld1234)
        return ctrlName.replace(strExtension, "");
    },

    FindControlName: function (fieldName, strExtension) {
        //returns controlName  (ex: fieldName = fld1234, strExtension = callbackPanel , returns  fld1234callbackPanel)
        return fieldName.concat(strExtension);
    },

    FindSystemName: function (controlName) {
        //returns field System Name  (ex: fieldName = fld1234-3452, returns  fld1234)
        return controlName.split("-")[0];
    },

    GetControlName: function (fieldSystemName, objectId, strExtension = "") {
        return fieldSystemName + "-" + objectId + strExtension;
    },

    GetFieldName: function (fieldSystemName, columnId, strExtension = "") {
        return fieldSystemName + "-" + columnId + strExtension;
    },
    IsEmpty: function (dummy = null, val) {
        return val === undefined || val == null || val.length <= 0 || val <= 0;
    },
    IsNotEmpty: function (dummy = null, val) {
        return !(val === undefined || val == null || val.length <= 0 || val <= 0);
    },
    Contains: function (needle, haystack) {
        return Helper.IsEmpty("", haystack)
            ? false
            : haystack.indexOf(needle) !== -1
                ? true
                : false;
    },
    Equals: function (firstValue, secodValue) {
        return firstValue == secodValue;
    },
    GreaterThan: function (valOfCond, valOfField) {
        var v1 = parseInt(valOfCond.replace(/,(?=.*\.\d+)/g, ''));
        var v2 = parseInt(valOfField.replace(/,(?=.*\.\d+)/g, ''));
        return v2 > v1;
    },
    GreaterThanOrEqualTo: function (firstVal, secondVal) {
        var v1 = parseInt(firstVal.replace(/,(?=.*\.\d+)/g, ''));
        var v2 = parseInt(secondVal.replace(/,(?=.*\.\d+)/g, ''));
        return v2 >= v1;
    },
    SmallerThan: function (firstVal, secondVal) {
        var val1 = parseInt(firstVal.replace(/,(?=.*\.\d+)/g, '')),
            val2 = parseInt(secondVal.replace(/,(?=.*\.\d+)/g, ''));
        if (isNaN(val1))
            val1 = 0;

        if (isNaN(val2))
            val2 = 0;
        return val2 < val1;
        //TODO check if needs changes
        //return parseInt(firstVal) < parseInt(secondVal);
    },
    SmallerThanOrEqualTo: function (firstVal, secondVal) {
        var v1 = firstVal.replace(/,(?=.*\.\d+)/g, '');
        var v2 = secondVal.replace(/,(?=.*\.\d+)/g, '');
        var val1 = parseInt(v1),
            val2 = parseInt(v2);
        if (isNaN(val1))
            val1 = 0;

        if (isNaN(val2))
            val2 = 0;
        return val2 <= val1;
    },
    IsFunc: function (val1, val2) {
        return val1 == val2;
        // Implmement Later Error Service
    },
    ContainsAnyWord: function (arg1, arg2) {
        if (Helper.IsEmpty("", arg2)) return false;
        var arrayOfWords = arg1.split(" "),
            validateCond = false;
        arrayOfWords.forEach(function (res) {
            if (Helper.Contains(arg2, res)) validateCond = true;
        });
        return validateCond;
    },
    DoesNotContain: function (needle, haystack) {
        return !Helper.Contains(needle, haystack);
    },
    StartsWith: function (valOfCond, valOfField) {
        return Helper.IsEmpty("", valOfField)
            ? false
            : valOfField.startsWith(valOfCond);
    },
    DoesNotStartsWith: function (valOfCond, valOfField) {
        return Helper.IsEmpty("", valOfField)
            ? false
            : !valOfField.startsWith(valOfCond);
    },
    EndsWith: function (valOfCond, valOfField) {
        return Helper.IsEmpty("", valOfField)
            ? false
            : valOfField.endsWith(valOfCond);
    },
    DoesNotEndWith: function (valOfCond, valOfField) {
        return Helper.IsEmpty("", valOfField)
            ? false
            : !valOfField.endsWith(valOfCond);
    },
    IsExactly: function (valOfCond, valOfField) {
        return valOfCond === valOfField;
    },
    CheckFieldIfRequired: function (field) {
        return window[field].inputElement.required;
    },
    DateChecker: {
        IsInThePast: function (i, date) {
            return DateF.DateDiff(new Date(), date) >= 1;
        },
        IsInTheFuture: function (i, date) {
            return DateF.DateDiff(new Date(), date) <= -1;
        },
        Before: function (dateCond, date) {
            return Date.parse(date) < Date.parse(dateCond);
        },
        After: function (dateCond, date) {
            return Date.parse(date) > Date.parse(dateCond);
        },
        IsTomorrow: function (i, date) {
            return DateF.DateDiff(new Date(), date) == -1;
        },
        IsToday: function (i, date) {
            return DateF.DateDiff(new Date(), date) == 0;
        },
        IsYesterday: function (i, date) {
            return DateF.DateDiff(new Date(), date) == 1;
        },
        IsInTheLastSevenDays: function (i, date) {
            var diff = DateF.DateDiff(new Date(), date);
            return diff > 0 && diff < 8;
        },
        IsInTheLast30Days: function (i, date) {
            var diff = DateF.DateDiff(new Date(), date);
            return diff > 0 && diff < 31;
        },
        IsInTheLast180Days: function (i, date) {
            var diff = DateF.DateDiff(new Date(), date);
            return diff > 0 && diff < 181;
        },
        IsInTheLast365Days: function (i, date) {
            var diff = DateF.DateDiff(new Date(), date);
            return diff > 0 && diff < 366;
        },
        IsInTheNextSevenDays: function (i, date) {
            var diff = DateF.DateDiff(new Date(), date);
            return diff > -8 && diff < 0;
        },
        IsInTheNext30Days: function (i, date) {
            var diff = DateF.DateDiff(new Date(), date);
            return diff > -31 && diff < 0;
        },
        IsInTheNext180Days: function (i, date) {
            var diff = DateF.DateDiff(new Date(), date);
            return diff > -181 && diff < 0;
        },
        IsInTheNext365Days: function (i, date) {
            var diff = DateF.DateDiff(new Date(), date);
            return diff > -366 && diff < 0;
        },
        IsInTheNext8to30Days: function (i, date) {
            var diff = DateF.DateDiff(new Date(), date);
            return diff > -31 && diff < -7;
        },
        IsInTheNext31to180Days: function (i, date) {
            var diff = DateF.DateDiff(new Date(), date);
            return diff > -181 && diff < -30;
        },
        IsInTheNext181to365Days: function (i, date) {
            var diff = DateF.DateDiff(new Date(), date);
            return diff > -366 && diff < -180;
        }
    },
    RemoveObjectDuplicationInArray: function (myArr, prop) {
        return myArr.filter(function (obj, pos, arr) {
            return (
                arr
                    .map(function (mapObj) {
                        return mapObj[prop];
                    })
                    .indexOf(obj[prop]) === pos
            );
        });
    },
    SortAnArrayOfObject: function (arr, key) {
        if (key.constructor === Array) {
            return arr.sort(Helper.FieldSorterOptimized(key));
        }
        return arr.sort(function (a, b) {
            return b[key] - a[key];
        });
    },
    FieldSorterOptimized: function (fields) {
        var dir = [],
            i,
            l = fields.length;
        fields = fields.map(function (o, i) {
            if (o[0] === "-") {
                dir[i] = -1;
                o = o.substring(1);
            } else {
                dir[i] = 1;
            }
            return o;
        });

        return function (a, b) {
            for (i = 0; i < l; i++) {
                var o = fields[i];
                if (a[o] > b[o]) return dir[i];
                if (a[o] < b[o]) return -dir[i];
            }
            return 0;
        };
    }
};

/*
 * @param { object } an object that ajax needs to be executed {url: '/test',data:{d:2}}
 */

var Request = {
    ajax: function (options, showLoadingPanel = true) {
        if (showLoadingPanel) window.loadingPanel.Show();
        return new window.Promise(function (resolve, reject) {
            $.ajax(options)
                .done(resolve)
                .fail(reject);
        });
    },
    loadScript: function (url, options) {
        options = $.extend(options || {}, {
            dataType: "script",
            cache: true,
            url: url
        });
        return $.ajax(options);
    },
    loadBundle: function (bundleName, options, callback) {


        if (AppV.GetAdditionalInfo().minifyScripts) {

            if (document.getElementById(bundleName)) {
                //         //todo callback here or smth else return maybe
                return;
            }
            var scr = document.createElement('script');
            scr.src = window.location.protocol + "//" + window.location.host + RootUrl + "/Jsbundles/" + bundleName;
            scr.type = 'text/javascript';
            scr.async = false;
            scr.setAttribute("id", bundleName);
            document.body.appendChild(scr);

        } else {
            var scriptsArray = AppV.GetAdditionalInfo().jsBundles[bundleName].slice();
            createScriptTag(scriptsArray);
        }
    }
};

function createScriptTag(scriptsArray) {
    while (url = scriptsArray.shift()) {
        url = url.replace('~', '');
        var splitedUrl = url.split('/');
        var srcId = splitedUrl[splitedUrl.length - 1].split('.').join("");;

        if (document.getElementById(srcId)) {
            //todo callback here or smth else return maybe
            return;
        }
        var scr = document.createElement('script');
        scr.src = window.location.protocol + "//" + window.location.host + url;
        scr.type = 'text/javascript';
        scr.async = false;
        scr.setAttribute("id", srcId);
        scr.onload = function () {
            createScriptTag(scriptsArray);
        };

        document.body.appendChild(scr);

    }
}

var DateF = {
    // In ms
    Sec: 1000,
    Min: 60000,
    Hour: 3600000,
    Day: 86400000,
    DateDiff: function (d1, d2) {
        d1 = d1.toLocaleString().split(",")[0];
        d1 = Date.parse(d1);
        d2 = Date.parse(d2);
        return Math.round((d1 - d2) / DateF.Day);
    }
};

// Fix url
document.addEventListener("DOMContentLoaded", function () {
    // Your code to run since DOM is loaded and ready
    if (window.jQuery) {
        $.ajaxPrefilter(function (options) {
            //console.log(options);
            if (!Helper.Contains(RootUrl, options.url))
                options.url = RootUrl + options.url.substr(1);
            //console.log(options.data);
            if (options.type == "POST" && typeof options.data != "object") {
                options.data = options.hasOwnProperty("data")
                    ? options.data + "&" + "tabName=" + window.Helper.TabName()
                    : "tabName=" + window.Helper.TabName();
            }
            //console.log(options.data);
        });
    }
});
// Generates or Returns tabname
Helper.TabName = function () {

    //if (typeof enforcedTabName !== "undefined" && enforcedTabName !== null && enforcedTabName !== "") {
    //    window.CTabName.value = enforcedTabName;
    //    return window.CTabName;
    //}

    if (typeof window.CTabName === "undefined" || window.CTabName === null) {
        var d = new Date();
        window.CTabName = d.getTime();
    }

    return window.CTabName;
};

//Helper.GenerateNewTabName = function()
//{
//    var d = new Date();
//    return d.getTime();
//}


Helper.PageReload = function () {
    window.loadingPanel.Show();
    window.location.reload();
};

Helper.ShowConfirmPopUp = function (HeaderText, Message, YesAction, NoAction = "", CancelAction = "", IsCancelVisible = "", IsNoVisible = true) {
    if (IsCancelVisible === "") {
        IsCancelVisible = "false";
    }
    if (window.CallbackPanelPopUp.callbackUrl.includes("External")) { //For Exteranl Users
        window.CallbackPanelPopUp.callbackUrl = window.CallbackPanelPopUp.callbackUrl.replace("/External", "");
    }
    window.CallbackPanelPopUp.PerformCallback({
        HeaderText: HeaderText,
        Message: Message,
        YesAction: YesAction,
        NoAction: NoAction,
        CancelAction: CancelAction,
        IsCancelVisible: IsCancelVisible,
        IsNoVisible: IsNoVisible
    });
    //window.mainPopup.Show();
};
// $(document).ready(function () {

//   });

/*
1- Helper
2- Routes
3- Sections TreeView
*/

Helper.open = function (url, windowName = null, registerState = true) {
    var _break = false;
    if (!Helper.Contains(RootUrl, url))
        url = RootUrl + url.substr(1);

    /*var tabs = AppV.GetTabsState();

    tabs.forEach(function (tab) {
        if (Helper.Contains(url, tab.location.href)) {
            _break = true;
            tab.focus();
        }
    });
    if (!_break)*/
    if (registerState)
        AppV.pushState("Tabs", { url: window.open(url, windowName) });
    else
        window.open(url, windowName);
    /*else
        _break = false;*/
};

Helper.prepareBroadcast = function (brName, cb) {
    window.bc = new BroadcastChannel(brName);
    window.bc.onmessage = cb;
}
Helper.closeBroadcast = function (brName) {
    if (typeof BroadcastChannel != "undefined")
        new BroadcastChannel(brName).close();
}

Helper.ChangeUrlWithOutReloading = function (newUrl) {
    history.pushState(null, null, newUrl);
};

Helper.isJSON = function (str) {
    try {
        return JSON.parse(str) && !!str;
    } catch (e) {
        return false;
    }
};

Helper.IsEmptyObj = function (obj) {
    for (var prop in obj) {
        return false;
    }
    return true;
};

Helper.CheckIfElementIsInArray = function (arr, el) {
    return arr.findIndex(function (i) {
        return i == el;
    });
};

Helper.ConcatinateBasedOnSort = function (fieldA, fieldB) {
    return fieldA < fieldB ? fieldA + fieldB : fieldB + fieldA;
};



// Broadcast
var broadcastV = (function () {
    var state = {
        channelName: "RzChannel",
        isCompatible: !(window.navigator.userAgent.indexOf("Edge") > -1),
        bc: {}
    }
    return {
        create: function (options = {}) {

            state.channelName = options.channelName || state.channelName;
            if (state.isCompatible) {
                state.bc = new BroadcastChannel(state.channelName);

                state.bc.onmessage = Helper.decideWhereToBroadcast;

            } else {
                state.bc.postMessage = function () { };
                state.bc.onmessage = function () { };
            }

            return state;

        },
        checkOrigin: function (origin) {
            if (!Helper.IsEmpty("", origin)) {
                var found = false;
                AppV.GetTabsState().forEach(function (tab) {
                    if (tab.location.href == origin && !found)
                        found = true;
                });
                return found;
            }
            return false;
        }
    }
})();

Helper.decideWhereToBroadcast = function (options) {
    if (typeof options.data.endPoint != undefined && broadcastV.checkOrigin(options.data.origin)) {
        //console.log(options);
        switch (options.data.endPoint) {
            case "MainGrid":
                MainGrid.PerformCallback(true);
                break;
            case "ObjectTypeGridCallback":
                window[options.data.callbackObjectTypeGrid].PerformCallback();
                break;
            case "SpecialObjectGrid":
                //if (!AppV.GetGlobals().isMainWindow)
                SpecialObjects.GetSpecialObjectGrid();
                break;
            case "SwConfigurationAddVirtual":
                if (typeof ConfigurationTree !== "undefined" && ASPxClientUtils.IsExists(ConfigurationTree)) {
                    window.ConfigurationTree.PerformCallback({
                        shouldReload: true
                    });
                }
                break;

            case "ReferencedField":
                RzReferencedField.Default.GetReferencedFieldGrid();
                break;

        }
    }

}

Helper.download_multiple_files = function (files) {

    function download_next(i) {
        if (i >= files.length) {
            return;
        }
        var a = document.createElement('a');
        a.href = files[i].download;
        a.target = '_parent';

        // Use a.download if available, it prevents plugins from opening.
        if ('download' in a) {
            a.download = files[i].filename;
        }
        // Add a to the doc for click to work.
        (document.body || document.documentElement).appendChild(a);
        if (a.click) {
            a.click(); // The click method is supported by most browsers.
        } else {
            $(a).click(); // Backup using jquery
        }

        // Delete the temporary link.
        a.parentNode.removeChild(a);

        // Download the next file with a small timeout. The timeout is necessary
        // for IE, which will otherwise only download the first file.
        setTimeout(function () {
            download_next(i + 1);
        }, 500);
    }

    // Initiate the first download.
    download_next(0);
}

Helper.PrepareDownloadData = function (fields, fileData) {
    var jsonObj = {};
    var jsonChildData = {};
    var jsonParentData = [];
    //var sampleArray = [
    //    "FileId",
    //    "FileName",
    //    "IsFolder",
    //    "IsPrimary",
    //    "Version",
    //];
    for (var i = 0; i < fileData.length; i++) {
        for (var j = 0; j < fileData[i].length; j++) {
            jsonChildData[fields[j]] = fileData[i][j];
        }
        jsonObj["DownloadData"] = jsonChildData;
        jsonParentData.push(jsonObj["DownloadData"]);
        jsonChildData = {};
    }

    return jsonParentData;
}

Helper.DecideIfFilterRowHasToBeShown = function (s, e) {
    s.GetFilterRow().style.display = (s.GetVisibleRowsOnPage() == 0) ? "none" : "";
}
Helper.DecideIfColumnsCanSort = function (s, e) {
    if (s.GetVisibleRowsOnPage() == 0) e.cancel = true;
}

Helper.ScrollOnlyDiv = function (elementToScroll) {
    $("." + elementToScroll).mouseleave(function () {
        Helper.Scroll('scrollableDivDocs', false);
    });
    $("." + elementToScroll).mouseenter(function () {
        Helper.Scroll('scrollableDivDocs', true);
    });
}

Helper.ScrollOnlyElement = function (elementToScroll) {
    $("#" + elementToScroll).mouseleave(function () {
        Helper.Scroll('scrollableDivDocs', false);
    });
    $("#" + elementToScroll).mouseenter(function () {
        Helper.Scroll('scrollableDivDocs', true);
    });
}

Helper.Scroll = function (elClass, decision) {

    if (decision) {
        $('.' + elClass).off('scroll mousewheel touchmove');
    } else {
        $('.' + elClass).bind("mousewheel", function () {
            return false;
        });
    }
}

Helper.IsElementVisible = function (el) {
    if (typeof el !== "object")
        el = window[el];
    if (typeof el == "undefined" || el == null)
        return false;
    var rect = el.getBoundingClientRect(), top = rect.top, height = rect.height,
        el = el.parentNode;
    do {
        rect = el.getBoundingClientRect();
        if (top <= rect.bottom === false) return false;
        if ((top + height) <= rect.top) return false;
        el = el.parentNode;
    } while (el != document.body);
    return top <= document.documentElement.clientHeight;
};


Helper.TryParse = function (str, defaultValue) {
    var retValue = defaultValue;
    if (str !== null) {
        if (str.length > 0) {
            if (!isNaN(str)) {
                retValue = parseInt(str);
            }
        }
    }
    return retValue;
};
Helper.FileListItem = function (a) {
    a = [].slice.call(Array.isArray(a) ? a : arguments);
    for (var c, b = c = a.length, d = !0; b-- && d;) d = a[b] instanceof File;
    if (!d) throw new TypeError("expected argument to FileList is File or array of File objects");
    for (b = (new ClipboardEvent("")).clipboardData || new DataTransfer; c--;) b.items.add(a[c]);
    return b.files;
};

/**    
* @param {String} ControlName control to check
* @param {String...} keyFieldName keyFieldname
*/
Helper.FilterGridSelectedKeysOnPage = function (ControlName, keyFieldName) {
    var a = JSON.parse(window[ControlName].cpAllRowData);
    return a.filter(function (x) {
        return window[ControlName].GetSelectedKeysOnPage().includes(String(x[keyFieldName]));
    });
};


/**    
* @param {String} ControlName control to check
* @param {String...} keyFieldName keyFieldname
* @param {String...} value value to match the key name
*/
Helper.FilterTreelistFocusedNodeKey = function (ControlName, keyFieldName, value) {
    if (typeof value == 'undefined') {
        value = window[ControlName].GetFocusedNodeKey();
    }
    var a = JSON.parse(window[ControlName].cpAllRowData);
    return a.filter(function (x) {
        return x[keyFieldName] == value;
    });
};

/**
* @param {String} ControlName control to check
* @param {String...} keyFieldName keyFieldname
* @param {String...} value value to match the key name
*/
Helper.FilterGridFocusedRowKey = function (ControlName, keyFieldName, value) {
    if (typeof value == 'undefined') {
        value = window[ControlName].GetRowKey(window[ControlName].GetFocusedRowIndex());
    }
    var a = JSON.parse(window[ControlName].cpAllRowData);
    return a.filter(function (x) {
        return x[keyFieldName] == value;
    });
};

/**    
* @param {String} ControlName control to check
* @param {String...} keyFieldName keyFieldname
*/
Helper.FilterTreeListSelectedNodeKeys = function (ControlName, keyFieldName) {

    var a = JSON.parse(window[ControlName].cpAllRowData);
    return a.filter(function (x) {
        return window[ControlName].GetVisibleSelectedNodeKeys().includes(String(x[keyFieldName]));
    });
};

/**    
* @param {String} gridName control to check
* @param {String...} index index to get key if specified
*/
Helper.GetGridFocusedRowKey = function (gridName, index) {
    if (typeof index == 'undefined')
        index = window[gridName].GetFocusedRowIndex();
    return window[gridName].GetRowKey(index);
};

/**    
* @param {String} object To check if is defined also if there is a dom element
*/
Helper.IsDefined = function (_obj) {
    return typeof _obj != 'undefined';// && document.getElementById(_obj);
};

Helper.OnEndCallbackSearchBar = function (s, e) {
    var searchBar = document.getElementById(s.name + '_DXSearchPanel');
    var canShowSearchBar = Helper.GetCookie(s.name + '_Cookie');

    if (canShowSearchBar === null || canShowSearchBar === 'undefined' || canShowSearchBar !== 'true') {
        searchBar.style.display = "none";

    } else {
        searchBar.style.display = "block";
    }
};

Helper.HideShowSearchBar = function (s, e) {
    var searchBar = document.getElementById(s.name + '_DXSearchPanel');
    if (searchBar.style.display === "none") {
        searchBar.style.display = "block";
        Helper.CreateCookie(s.name + '_Cookie', true);
    }
    else {
        searchBar.style.display = "none";
        Helper.CreateCookie(s.name + '_Cookie', false);
    }
};

Helper.EnableDisableInputType = function (inputName, isDisabled) {

    window[inputName].GetInputElement().readOnly = isDisabled;

    if (isDisabled === true) {
        ASPxClientUtils.AttachEventToElement(window[inputName].GetMainElement(), "mousedown", OnMouseDown);
        window[inputName].GetInputElement().className = window[inputName].GetInputElement().className.concat(' dxeDisabled');
    }
    else {
        ASPxClientUtils.DetachEventFromElement(window[inputName].GetMainElement(), "mousedown", OnMouseDown);
        window[inputName].GetInputElement().className = window[inputName].GetInputElement().className.replace('dxeDisabled', '');
    }
};

function OnMouseDown(event) {
    ASPxClientUtils.PreventEventAndBubble(event);
}

Helper.encodeTxt = function (s) {
    var key = CryptoJS.enc.Utf8.parse('AMINHAKEYTEM32NYTES1234567891234');
    var iv = CryptoJS.enc.Utf8.parse('7061737323313233');
    var encrypted = CryptoJS.AES.encrypt(CryptoJS.enc.Utf8.parse(s), key,
        {
            keySize: 128 / 8,
            iv: iv,
            mode: CryptoJS.mode.CBC,
            padding: CryptoJS.pad.Pkcs7
        });  
    return encrypted;
};

Helper.getUTCDateFormat= function (date) {
    var now_utc = Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(),
        date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
    return new Date(now_utc);
};

Helper.ItemiUndefinedOrNull = function (name) {
    var result = false;
    if (typeof window[name] !== "undefined") {
        if (window[name] !== null) {
            result = true;
        }
    }
    return result;
};;
(function () {
    var FieldVaildation = {
        currentFieldOnAction: "",
        initialStage: true,
        mainGrid: false,
        currentObjectId: "",
        objectChanged: false,
        newFrom: false,
        blockEvaluationOfDF: false,
    },
        State = {
            prepareName: function (a, b) {
                return FieldVaildation.newFrom ?
                    Helper.GetFieldName(a, b) + "NewFrom"
                    : Helper.GetFieldName(a, b);
            },
            prepareObjectDF: function (s, e) {
                if (typeof s === "undefined") return {};
                if (!Helper.isJSON(s.cpConditionalDifferentValues))
                    return {};

                var objOfDf = JSON.parse(s.cpConditionalDifferentValues)[0],
                    fieldToCheck = [];
                if (typeof objOfDf == "undefined")
                    return {};
                objOfDf.fieldName = State.prepareName(objOfDf.SystemName, objOfDf.ColumnId);
                objOfDf.DependOnFields.forEach(function (el) {
                    fieldToCheck.push(State.prepareName(el.SystemName, el.ColumnId));
                });
                objOfDf.fieldToCheck = fieldToCheck;
                return objOfDf;
            },
            locateTheLabelOfTheField: function (field) {
                var a = FieldVaildation.newFrom ? field.replace("NewFrom", "") : field,
                    d = document.getElementById(a + "div");
                return d.getAttribute('value').replace(":", "");
            }
        }
    // State = function(){
    //     var _context = {
    //         nF:false
    //     },
    //     rulesBasedOnContext = {
    //         newFrom : function(){ 
    //         },
    //         objectChanged: function(){
    //             stateOfConditions = [];
    //         },
    //         mainGrid: function(){

    //         }
    //     },
    //     _currentObject = {
    //         name,
    //         affectedFields 
    //     };

    //     function setCurrentContext(context){
    //         this._context= context;
    //     }
    //     function getCurrentContext(){
    //         return this._context;
    //     }
    //     function setCurrentObject(s,e){
    //         chNF();
    //         this._currentObject = _context.nF?chN(s.)
    //         this._currentObject.affectedFields = s.cpAffectedConditionalFields;
    //     }
    //     function chN(i){
    //         return 
    //     }
    //     function chNF(){
    //         if(FieldVaildation.newFrom)
    //             _context.nF = true;
    //     }
    //     function getCurrentObject(){
    //         return _currentObject;
    //     }   

    //     return{
    //         setCurrentObject,
    //         getCurrentObject,
    //         currentObjectOnAction
    //     }
    // };

    FieldVaildation.stateOfConditions = [];
    var Debugger = false,
        fieldWithDifferentValues = [],
        lastCheckDF = [];

    var FieldTypes = {
        text: 0,
        Number: 1,
        Number_Decimal: 2,
        Date_Type: 3,
        ListOfValuesString: 4,
        ListOfValuesNumeric: 5,
        ListOfValuesNumeric_Decimal: 6,
        DataSource: 7,
        NumberingSchemas: 8,
        YesNo: 9,
        HyperLink: 10,
        Memo: 11,
        ObjectType: 12,
        Material: 13,
        CalculatedFields: 14,
        LookUp: 15,
        Linkto3rdParty: 16,
        Concatenated: 17,
        Webservice: 18
    }

    var ConditionalType = {

        Required: 0,
        ReadOnlyCondition: 1,
        InVisible: 2,
        DifferentFields: 3,
        SaveConditions: 4,
        ConditionalHighlighting: 10
    }


    FieldVaildation.GenericValidation = function (s, e) {
        FieldVaildation.initialStage = false;
        validationForDx(s, e);

        // Validate other fields 
        if (s.cpHasConditionalAffect && e.isValid)
            evaluateCondtitions(s, e);

        checkForDifferentValues(s, e);
        // new checks
        switch (s.cpFieldType) {
            case FieldTypes.Number:
            case FieldTypes.Number_Decimal:
                numberFieldValidation(s, e);
                break;
            case FieldTypes.ListOfValuesNumeric:
            case FieldTypes.ListOfValuesNumeric_Decimal:
            case FieldTypes.ListOfValuesString:
                listFieldValidation(s, e);
                break;

        }
        /*
    switch (s.cpFieldType) {
        case FieldTypes.text:
            textFieldValidation(s, e);
            break;
        case FieldTypes.Number:
        case FieldTypes.Number_Decimal:
            numberFieldValidation(s, e);
            break;
        case FieldTypes.YesNo:
            yesAndNoFieldValidation(s, e);
            break;
        case FieldTypes.NumberingSchemas:
            numberingSchemasFieldValidation(s, e);
            break;
        case FieldTypes.ListOfValuesNumeric:
        case FieldTypes.ListOfValuesNumeric_Decimal:
            numericListFieldValidation(s, e);
            break;
        case FieldTypes.ListOfValuesString:
            stringListFieldValidation(s, e);
        case FieldTypes.Linkto3rdParty:
            linkedToThirdPartyFieldValidation(s, e);
            break;
        case FieldTypes.CalculatedFields:
            calculatedFieldValidation(s, e);
            break;
        case FieldTypes.LookUp:
            lookUpFieldValidation(s, e);
            break;
        case FieldTypes.ObjectType:
            objectTypeFieldValidation(s, e);
            break;
        case FieldTypes.HyperLink:
            hyperLinkFieldValidation(s, e);
            break;
        case FieldTypes.DataSource:
            dataSourceFieldValidation(s, e);
            break;
        case FieldTypes.Concatenated:
            concatenatedFieldValidation(s, e);
        case FieldTypes.Date_Type:
            dataTypeFieldValidation(s, e);
            break;
    }*/
    }
    FieldVaildation.InitValidation = function (s, e) {
        if (FieldVaildation.objectChanged) {
            FieldVaildation.performClearData();
        }


        FieldVaildation.objectChanged = false;
        //since combox does not have a required property it is needed to validate it on client Side 
        // if(s.cpFieldType == enums.FieldTypes.ListOfValuesString || 
        //     s.cpFieldType == enums.FieldTypes.ListOfValuesNumeric || 
        //     s.cpFieldType == enums.FieldTypes.ListOfValuesNumeric_Decimal ){

        //         if(s.enabled && s.GetValue() == null && s.cpRequired){
        //            e.isValid = false;
        //            e.errorText = Helper.T("ThisFieldIsRequired");
        //         }
        //     }

        //FieldVaildation.GenericValidation(s,e);

        iterateAffectedFields(s.globalName);
        if (FieldVaildation.stateOfConditions.length > 0)
            applyConditions();
    }
    function evaluateCondtitions(s, e) {
        try {
            FieldVaildation.currentFieldOnAction = FieldVaildation.newFrom ? s.globalName.split('-')[1].replace("NewFrom", "") : s.globalName.split('-')[1];
            var fieldsToCheck = s.cpAffectedConditionalFields;
            fieldsToCheck.forEach(function (item) {
                if (FieldVaildation.newFrom)
                    item = item + "NewFrom";

                iterateAffectedFields(item);
            });

            if (FieldVaildation.stateOfConditions.length > 0)
                applyConditions();

        } catch (error) {
           // console.log(error);
        }
    }
    function checkForDifferentValues(s, e) {
        if (FieldVaildation.blockEvaluationOfDF)
            return;
        var _obj = State.prepareObjectDF(s, e);
        if (Helper.IsEmptyObj(_obj))
            return;
        evaluateCond(_obj);
    }
    function evaluateCond(_obj, lastCheck = false) {
        try {
        if (!Helper.IsDefined(window[_obj.fieldName]))
            return;
        var valueOfFieldChanged = window[_obj.fieldName].GetText().trim(),
            msg = "";
        if (!lastCheck) {
            var check = Helper.CheckIfElementIsInArray(fieldWithDifferentValues, _obj.fieldName);
            if (check == -1) {
                fieldWithDifferentValues.push(_obj.fieldName);
            }
        }

        if (valueOfFieldChanged != "") {
            _obj.fieldToCheck.forEach(function (item) {
                var currentFieldValue = window[item].GetText().trim();
                if (currentFieldValue != "") {
                    if (valueOfFieldChanged == currentFieldValue) {
                        msg += State.locateTheLabelOfTheField(_obj.fieldName) + " " +
                            Helper.T("And_") + " "
                            + State.locateTheLabelOfTheField(item) + "!<br />";
                        check = Helper.CheckIfElementIsInArray(fieldWithDifferentValues, item);
                        if (!lastCheck) {
                            if (check == -1) {
                                fieldWithDifferentValues.push(item);
                            }
                        } else {
                            lastCheckDF.push({
                                field1: State.locateTheLabelOfTheField(_obj.fieldName),
                                field2: State.locateTheLabelOfTheField(item),
                                concatF: Helper.ConcatinateBasedOnSort(State.locateTheLabelOfTheField(_obj.fieldName), State.locateTheLabelOfTheField(item))
                            });
                        }
                    }
                }
            });
            if (msg != "" && !lastCheck) {
                window.PropertyCard.Alert.Show(Helper.T("FieldsCannotHaveTheSameValue") + "<br /><br />" + msg);
                msg = "";
            }
            }
        } catch (error) {
           // console.log(error);
        }
    }
    FieldVaildation.checkBeforeSave = function () {
        lastCheckDF = [];
        fieldWithDifferentValues.forEach(function (el) {
            var _objLast = State.prepareObjectDF(window[el], "");
            evaluateCond(_objLast, true);
        });

        var ch = Helper.RemoveObjectDuplicationInArray(Helper.SortAnArrayOfObject(lastCheckDF, ["field1", "field2"]), 'concatF');
        var msgToReturn = Helper.T("FieldsCannotHaveTheSameValue") + "<br /><br />";

        ch.forEach(function (el) {
            msgToReturn += el.field1 + " " +
                Helper.T("And_") + " "
                + el.field2 + "!<br />";
        });

        var returnObj = {
            total: ch.length,
            msg: msgToReturn
        }
        return returnObj;
    }

    function iterateAffectedFields(field) {
        if (!handleUndefinedFields(field)) return;
        var fieldConditions = JSON.parse(window[field].cpConditionalFields);
        //fieldConditions = fieldConditions.filter(x => x.HasElseConditionsFields == false);
        //if (FieldVaildation.mainGrid && !FieldVaildation.newFrom)
         //   fieldConditions = fieldConditions.filter(x => x.Type == ConditionalType.ConditionalHighlighting);
        fieldConditions.forEach(iterateConditionsOfTheField);
    }
    function iterateConditionsOfTheField(result) {
        //if(FieldVaildation.DecideIfConditionsApply && result.Type != 10) return;
        if (result.FirstColumnId == FieldVaildation.currentFieldOnAction
            || result.SecondColumnId == FieldVaildation.currentFieldOnAction || FieldVaildation.initialStage) {

            var currentFieldName = FieldVaildation.newFrom ?
                Helper.GetFieldName(result.SystemName, result.ColumnId) + "NewFrom"
                : Helper.GetFieldName(result.SystemName, result.ColumnId),
                found = FieldVaildation.stateOfConditions.some(function (el) { return el.fieldName == currentFieldName; });
                returnResponseEval = evaluateCondition(result),
                currentFieldNameId = currentFieldName + result.ConditionalRequiredFieldListId;


            if (!result.HasElseConditionsFields) {

                if (!found) {
                    FieldVaildation.stateOfConditions.push({
                        fieldName: currentFieldName,
                        req: (result.Type == 0) ? returnResponseEval : false,
                        inv: (result.Type == 2) ? returnResponseEval : false,
                        ronly: (result.Type == 1) ? returnResponseEval : false,
                        condH: (result.Type == 10) ? (returnResponseEval ? result.BackColorRGB :
                            result.BackColorRGBElse) : result.BackColorRGB,
                        extras: {
                            stopHighlightingCond: (result.Type == 10) ? (returnResponseEval ? true : false) : false,
                            whoStoppedHighlighting: (result.Type == 10) ? (returnResponseEval ? currentFieldNameId : "") : ""
                        }
                    });

                    if (result.Type == 10 && returnResponseEval) {
                        var indexIn = FieldVaildation.stateOfConditions.findIndex(x => x.fieldName == currentFieldName);
                        FieldVaildation.stateOfConditions[indexIn].extras.stopHighlightingCond = true;
                        FieldVaildation.stateOfConditions[indexIn].extras.whoStoppedHighlighting = currentFieldNameId;
                    }
                } else {
                    var index = FieldVaildation.stateOfConditions.findIndex(x => x.fieldName == currentFieldName);
                    var invTrueStop = ((result.Type == 2) && returnResponseEval);
                    switch (result.Type) {
                        case 0:
                            FieldVaildation.stateOfConditions[index].req = returnResponseEval;
                            break;
                        case 1:
                            FieldVaildation.stateOfConditions[index].ronly = returnResponseEval;
                            break;
                        case 2:
                            if (invTrueStop)
                                 FieldVaildation.stateOfConditions[index].inv = returnResponseEval;
                            break;
                        case 10:
                            var checkIfItIsTheSameFieldCond = (currentFieldNameId == FieldVaildation.stateOfConditions[index].extras.whoStoppedHighlighting || FieldVaildation.stateOfConditions[index].extras.whoStoppedHighlighting == "");
                            if (!FieldVaildation.stateOfConditions[index].extras.stopHighlightingCond || checkIfItIsTheSameFieldCond) {
                                if (returnResponseEval) {

                                    FieldVaildation.stateOfConditions[index].extras.stopHighlightingCond = true;
                                    FieldVaildation.stateOfConditions[index].extras.whoStoppedHighlighting = currentFieldNameId;
                                    FieldVaildation.stateOfConditions[index].condH = result.BackColorRGB;

                                } else if (!returnResponseEval && checkIfItIsTheSameFieldCond) {

                                    FieldVaildation.stateOfConditions[index].extras.whoStoppedHighlighting = "";
                                    FieldVaildation.stateOfConditions[index].extras.stopHighlightingCond = false;
                                    FieldVaildation.stateOfConditions[index].condH = result.BackColorRGBElse;
                                }
                            }
                            // stateOfConditions[index].condH = returnResponseEval ? result.BackColorRGB : 
                            // (stateOfConditions[index].condH !=result.BackColorRGB?
                            //     stateOfConditions[index].condH:result.BackColorRGBElse);
                            break;
                    }
                }
            }
            //else{
            if (result.ObjectConditionalFieldsId != -1 && (!AppV.GetGlobals().isMainWindow || FieldVaildation.newFrom))
                updateGroupCond(result, returnResponseEval);
            //}
        }
    }
    function evaluateCondition(result) {
        try {

            var firstField = FieldVaildation.newFrom ?
                Helper.GetFieldName(result.FirstSystemName, result.FirstColumnId) + "NewFrom"
                : Helper.GetFieldName(result.FirstSystemName, result.FirstColumnId);
            var valueOfFirstField;
            if (Helper.Contains("-999", firstField)) {
                firstField = "fieldsGroup";
                if (typeof window[firstField] != "undefined")
                     valueOfFirstField = window[firstField].GetCurrentValue();
            } else {
                if (typeof window[firstField] !="undefined")
                    valueOfFirstField = window[firstField].GetText().toLowerCase();
            }
            var secondField = (result.SecondColumnId == -1) ? "" :
                (FieldVaildation.newFrom ?
                    Helper.GetFieldName(result.SecondSystemName, result.SecondColumnId) + "NewFrom"
                    : Helper.GetFieldName(result.SecondSystemName, result.SecondColumnId)),
                //Helper.GetFieldName(result.SecondSystemName, result.SecondColumnId),
                opEvaluationFirst = evaluateOpertaion(result.FirstOperator),
                checkEvaluationFirstField = opEvaluationFirst(result.FirstValue.toLowerCase(), valueOfFirstField);

            if (result.TwoValues) {
                var valueOfSecondField;// = window[secondField].GetText().toLowerCase();
                if (Helper.Contains("-999", secondField)) {
                    secondField = "fieldsGroup";
                    valueOfSecondField = window[secondField].GetCurrentValue();
                } else {
                    valueOfSecondField = window[secondField].GetText().toLowerCase();
                }

                var opEvaluationSecond = evaluateOpertaion(result.SecondOperator),
                    checkEvaluationSecondField = opEvaluationSecond(result.SecondValue.toLowerCase(), valueOfSecondField);
                return checkExpressionEvaluation = evaluateExpression(checkEvaluationFirstField, checkEvaluationSecondField, result.LogicalMerge);
            }
            return checkEvaluationFirstField;
        } catch (error) {
           // console.log(error);
        }
    }

    function addCondToRecorder(cond, result) {
        var el = new condObj();
        el.CondId = cond.ConditionalRequiredFieldListId;
        el.IsCondTrue = result;
        el.GroupCondId = cond.ObjectConditionalFieldsId;
        el.CondText = cond.ConditionText;
        var current = FieldVaildation.RecordCond.push(el) - 1;
        return FieldVaildation.RecordCond[current];
    }
    function updateGroupCond(cond, result) {

        var index = FieldVaildation.RecordCond.findIndex(function (l) {
            return l.CondId == cond.ConditionalRequiredFieldListId;
        });
        var field = (index != -1) ? FieldVaildation.RecordCond[index] : addCondToRecorder(cond, result);

        if (field.IsCondTrue != result) {
            field.IsCondTrue = result;
            performChangesOnAllConditionArray(field);
        }

        field.IsCondTrue = result;
    }

    function evaluateExpression(firstPart, secondPart, operation) {
        if (operation == "And")
            return firstPart && secondPart;
        else
            return firstPart || secondPart;
    }
    function handleUndefinedFields(field) {
        if (typeof window[field] !== "undefined")
            if (typeof window[field].cpConditionalFields !== "undefined" && !window[field].cpHasElseConditionsFields)
                return true;
        return false;
    }
    function applyConditions() {
        try {
            FieldVaildation.stateOfConditions.forEach(function (res) {
                // Peshimi i kushteve 
                // Inv -> Readonly -> Required
                res.ronly = (res.inv) ? false : res.ronly;
                res.req = (res.inv || res.ronly) ? false : res.req;
                if (typeof res.defaults === "undefined" && typeof window[res.fieldName] !== "undefined") {
                    res.defaults = {
                        isreq: window[res.fieldName].cpRequired,
                        ronly: !window[res.fieldName].clientEnabled,
                        inv: (document.getElementById(res.fieldName).style.display == "") ? true : false,
                        condH: window[res.fieldName].cpBackColorRgb
                    }
                }
            });
            reflectUpdatedState();
        } catch (e) {
           // console.log(e);
        }
    }
    function reflectUpdatedState() {
        try {
            FieldVaildation.stateOfConditions.forEach(function (res) {
                var actualField = res.fieldName,
                    returnToDeafult = !(res.inv || res.req || res.ronly);
                rgbColor = (res.condH != null && res.condH != "") ? 'rgb(' + res.condH.split(".").join(",") + ')' : "";
                if (typeof window[actualField] == "undefined") return;
                window[actualField].GetInputElement().required = (returnToDeafult) ? res.defaults.isreq : res.req;
                //window[actualField].SetEnabled((FieldVaildation.mainGrid && !FieldVaildation.newFrom) ? false : ((returnToDeafult) ? !res.defaults.ronly : !res.ronly));
                window[actualField].SetEnabled(((returnToDeafult) ? !res.defaults.ronly : !res.ronly));
                var hidden = ((returnToDeafult) ? res.defaults.inv : !res.inv);
                // FieldVaildation.newFrom ?
                //     window[actualField.replace("NewFrom", "callbackPanelNewFrom")].SetVisible((returnToDeafult) ? res.defaults.inv : !res.inv)
                //     : window[actualField + "callbackPanel"].SetVisible((returnToDeafult) ? res.defaults.inv : !res.inv);
                if (FieldVaildation.newFrom) {
                    if (!hidden)
                        $("#" + actualField.replace("NewFrom", "PropertyDivNewFrom")).hide();
                    else
                        $("#" + actualField.replace("NewFrom", "PropertyDivNewFrom")).show();
                } else {
                    if (!hidden)
                        $("#" + actualField + "PropertyDiv").hide();
                    else
                        $("#" + actualField + "PropertyDiv").show();
                }
                window[actualField].GetMainElement().style.backgroundColor = rgbColor;
                window[actualField].GetInputElement().style.backgroundColor = rgbColor;
                updateLabelDiv(actualField, window[actualField].GetInputElement().required);
                validationForDx("", "", actualField);
            });
        } catch (e) {
           // console.log(e);
        }
    }
    function updateLabelDiv(field, req) {
        // if (FieldVaildation.newFrom)
        //     field = field.replace("NewFrom", "");

        var d = document.getElementById(field + "div");
        if (req)
            d.innerHTML = "<img src='" + (RootUrl == "/" ? "" : RootUrl) + "\\Content\\Images\\SolidWorksImages\\star_required_16x16.png'/>" + d.getAttribute('value');
        else
            d.innerHTML = d.getAttribute('value');
    }
    FieldVaildation.performClearData = function () {
        FieldVaildation.initialStage = true;
        FieldVaildation.stateOfConditions = [];
        FieldVaildation.RecordCond = [];
        FieldVaildation.AllConditionArray = [];
    }
    function validationForDx(s, e, actualField = null) {
        var source = (actualField == null) ? true : false,
            condF = (source) ? s.cpIsConditionalField : window[actualField].cpIsConditionalField,
            gText = (source) ? e.value : window[actualField].GetText(),
            condR = (source) ? window[s.globalName].GetInputElement().required : window[actualField].GetInputElement().required;
        if (condF && (gText == null || gText == "") && condR) {
            (source) ? e.isValid = false : window[actualField].isValid = false;
            (source) ? e.errorText = Helper.T("ThisFieldIsRequired") : window[actualField].errorText = Helper.T("ThisFieldIsRequired");
        } else if (condF && (gText != null || gText != "") && condR) {
            (source) ? e.isValid = true : window[actualField].isValid = true;
        } else if (condF && !condR) {
            (source) ? e.isValid = true : window[actualField].isValid = true;
        }
    }

    FieldVaildation.SetnewFrom = function (isNewFrom) {
        if (FieldVaildation.newFrom != isNewFrom) {
            FieldVaildation.performClearData();
        }
        FieldVaildation.newFrom = isNewFrom;
    }


    function textFieldValidation(s, e) {

        validationForDx(s, e);

        // Validate other fields 
        if (s.cpHasConditionalAffect && e.isValid)
            evaluateCondtitions(s, e);

        checkForDifferentValues(s, e);

    }
    function numberFieldValidation(s, e) {
        var _fieldValue = s.GetValue();
        //check if value is inside the scope of min and max value
        if (_fieldValue < s.minValue) {
            e.isValid = false;
            e.errorText = SwResourceObject.MinimumNumberIs + " " + s.minValue;
        } else if (_fieldValue > s.maxValue) {
            e.isValid = false;
            e.errorText = SwResourceObject.MaximumNumberIs + " " + s.maxValue;
        }
        //
    }

    function listFieldValidation(s, e) {
        var _fieldText = s.GetText();
        if (s.cpRequired && _fieldText === "") {
            e.isValid = false;
            e.errorText = State.locateTheLabelOfTheField(s.name) + " " + SwResourceObject.IsRequired;
        }
    }


    FieldVaildation.storeConditions = function (conds) {
      try {
        conds.forEach(function (cond, idx, _allCond) {
            if (cond.ObjectConditionalFieldsId != -1) {

                var groupIndex = FieldVaildation.AllConditionArray.findIndex(function (el) {
                    return el.GroupId == cond.ObjectConditionalFieldsId;
                });
                var group = (groupIndex != -1) ? FieldVaildation.AllConditionArray[groupIndex] : addGroup(cond);
                //var isThisFieldOnElseCond = cond.BackColorRGB == null && cond.BackColorRGBElse == null;
                if (group.HasElseCondition && cond.HasElseConditionsFields) {
                    //checkIfFieldIsInsertedBefore
                    var isInserted = group.ElseAffectedFields.some(function (field) {
                        return field.ColumnId == cond.ColumnId && field.SystemName == cond.SystemName;
                    });
                    if (!isInserted) {
                        addField(group, cond);
                    }
                }
                //Take care of group conditions now
                var condIndex = group.GroupCond.findIndex(function (el) {
                    return el.CondId == cond.ConditionalRequiredFieldListId;
                });
                if (condIndex == -1)
                    addCond(group, cond);

                if (idx === _allCond.length - 1) {
                    // Here we decide if else will be applied
                    performValidationForElseCond();
                }
            }
            });
        } catch (error) {
            //console.log(error);
        }
    }
    function performValidationForElseCond(arr = []) {
        try {
            if (arr.length == 0)
                arr = FieldVaildation.AllConditionArray;

            arr.forEach(function (group) {
                if (group.HasElseCondition) {
                    var shouldTriggerElse = group.GroupCond.some(function (cond) {
                        return cond.IsCondTrue == true;
                    });
                    performElseCond(group, shouldTriggerElse);
                }

                });
            } catch (error) {
            //console.log(error);
        }
    }
    function performElseCond(group, reventCond) {
        try {
        var _type = group.Type;
        group.Evaluated = !reventCond;
            group.ElseAffectedFields.forEach(function (field) {
                var currentFieldName = FieldVaildation.newFrom ?
                    Helper.GetFieldName(field.SystemName, field.ColumnId) + "NewFrom"
                    : Helper.GetFieldName(field.SystemName, field.ColumnId),
                foundIndex = FieldVaildation.stateOfConditions.findIndex(function (el) { return el.fieldName == currentFieldName; });
            if (foundIndex != -1) {
                if (!reventCond) {
                    FieldVaildation.stateOfConditions.splice(foundIndex, 1);
                    FieldVaildation.stateOfConditions.push({
                        fieldName: currentFieldName,
                        req: (_type == 0),
                        inv: (_type == 2),
                        ronly: (_type == 1),
                        condH: null,
                        extras: {
                            stopHighlightingCond: null,
                            whoStoppedHighlighting: null
                        }
                    });
                }
                else {
                    var f = FieldVaildation.stateOfConditions[foundIndex];
                    f.req = f.inv = f.ronly = false;
                }
            } else if (foundIndex == -1 && !reventCond) {
                FieldVaildation.stateOfConditions.push({
                    fieldName: currentFieldName,
                    req: (_type == 0),
                    inv: (_type == 2),
                    ronly: (_type == 1),
                    condH: null,
                    extras: {
                        stopHighlightingCond: null,
                        whoStoppedHighlighting: null
                    }
                });
            }
        });
        applyConditions();
        } catch (error) {
            //console.log(error);
        }
    }
    function performChangesOnAllConditionArray(obj) {
        var getGroup = FieldVaildation.AllConditionArray.find(function (el) {
            return el.GroupId == obj.GroupCondId;
        });
        //update neccesary obj 
        var condRow = getGroup.GroupCond.find(function (el) {
            return el.CondId == obj.CondId;
        });
        condRow.IsCondTrue = obj.IsCondTrue;
        performValidationForElseCond([getGroup]);
    }
    function groupObj() {
        return {
            GroupId: -1,
            HasElseCondition: false,
            GroupCond: [],//[{mainObj},{mainObj}];
            ElseAffectedFields: [],//[{field},{field}];
            Type: 0,
            Evaluated: false
            //IsElseCondActivated: false
        }
    }
    function _field() {
        return {
            ColumnId: -1,
            SystemName: ""
        }

    }
    function condObj() {
        return {
            CondId: -1,
            GroupCondId: -1,
            IsCondTrue: false,
            CondText: "",
        }
    }
    function addGroup(cond) {
        var group = new groupObj();
        group.GroupId = cond.ObjectConditionalFieldsId;
        group.HasElseCondition = cond.HasElseConditions;
        group.Type = cond.Type;
        var l = FieldVaildation.AllConditionArray.push(group) - 1;
        return FieldVaildation.AllConditionArray[l];
    }
    function addField(group, cond) {
        var field = new _field();
        field.ColumnId = cond.ColumnId;
        field.SystemName = cond.SystemName;

        group.ElseAffectedFields.push(field);
    }
    function addCond(group, cond) {
        var _cond = new condObj();
        _cond.CondId = cond.ConditionalRequiredFieldListId;
        _cond.GroupCondId = cond.ObjectConditionalFieldsId;
        _cond.CondText = cond.ConditionText;
        var recoverRow = FieldVaildation.RecordCond.find(function (el) {
            return el.CondId == cond.ConditionalRequiredFieldListId;
        });
        if (recoverRow != undefined)
            _cond.IsCondTrue = recoverRow.IsCondTrue;
        else {
            //need to evaluateCondition
            var condEvalutation = evaluateCondition(cond);
            addCondToRecorder(cond, condEvalutation);
            _cond.IsCondTrue = condEvalutation;
        }

        var l = group.GroupCond.push(_cond) - 1;
        return group.GroupCond[l];
    }
    FieldVaildation.RecordCond = [];
    FieldVaildation.AllConditionArray = [];
    window.FieldVaildation = FieldVaildation;
    window.fieldWithDifferentValues = fieldWithDifferentValues;

    function dataTypeFieldValidation(s, e) {
        validationForDx(s, e);

        if (s.cpHasConditionalAffect && e.isValid)
            evaluateCondtitions(s, e);
    }

    function yesAndNoFieldValidation(s, e) {
        validationForDx(s, e);

        if (s.cpHasConditionalAffect && e.isValid)
            evaluateCondtitions(s, e);
    }

    function numberingSchemasFieldValidation(s, e) {
        validationForDx(s, e);

        if (s.cpHasConditionalAffect && e.isValid)
            evaluateCondtitions(s, e);
    }

    function numericListFieldValidation(s, e) {
        var number = parseInt(e.value);
        if (Number.isNaN(number)) {
            e.isValid = false;
            e.errorText = SwResourceObject.ThisCharacterIsNotAllowed;
        }

        validationForDx(s, e);

        if (s.cpHasConditionalAffect && e.isValid)
            evaluateCondtitions(s, e);
    }

    function stringListFieldValidation(s, e) {
        validationForDx(s, e);

        if (s.cpHasConditionalAffect && e.isValid)
            evaluateCondtitions(s, e);
    }

    function linkedToThirdPartyFieldValidation(s, e) {
        validationForDx(s, e);

        if (s.cpHasConditionalAffect && e.isValid)
            evaluateCondtitions(s, e);
    }

    function calculatedFieldValidation(s, e) {
        validationForDx(s, e);

        if (s.cpHasConditionalAffect && e.isValid)
            evaluateCondtitions(s, e);
    }

    function lookUpFieldValidation(s, e) {
        validationForDx(s, e);

        if (s.cpHasConditionalAffect && e.isValid)
            evaluateCondtitions(s, e);
    }

    function objectTypeFieldValidation(s, e) {
        validationForDx(s, e);

        if (s.cpHasConditionalAffect && e.isValid)
            evaluateCondtitions(s, e);
    }

    function hyperLinkFieldValidation(s, e) {
        validationForDx(s, e);

        if (s.cpHasConditionalAffect && e.isValid)
            evaluateCondtitions(s, e);
    }

    function dataSourceFieldValidation(s, e) {
        validationForDx(s, e);

        if (s.cpHasConditionalAffect && e.isValid)
            evaluateCondtitions(s, e);
    }

    function concatenatedFieldValidation(s, e) {
        validationForDx(s, e);

        if (s.cpHasConditionalAffect && e.isValid)
            evaluateCondtitions(s, e);
    }



    function comboBoxNumberValidation(s, e) {
        var number = parseInt(e.value);

        if (Number.isNaN(number)) {
            e.isValid = false;
            e.errorText = SwResourceObject.ThisCharacterIsNotAllowed;//"Allowed input is numbers only!";
        }

        validationForDx(s, e);

        if (s.cpHasConditionalAffect && e.isValid)
            evaluateCondtitions(s, e);
    }

    function evaluateOpertaion(op) {
        var functionToCall;// = function(){};
        switch (op) {
            case "Contains":
                functionToCall = Helper.Contains;
                break;
            case "Equals":
                functionToCall = Helper.Equals;
                break;
            case "Greater Than":
            case "GreaterThan":
                functionToCall = Helper.GreaterThan;
                break;
            case "Greater Than Or Equal To":
            case "GreaterThanOrEqualTo":
                functionToCall = Helper.GreaterThanOrEqualTo;
                break;
            case "Smaller Than":
            case "SmallerThan":
                functionToCall = Helper.SmallerThan;
                break;
            case "Smaller Than Or Equal To":
            case "SmallerThanOrEqualTo":
                functionToCall = Helper.SmallerThanOrEqualTo;
                break;
            case "Is Empty":
            case "IsEmpty":
                functionToCall = Helper.IsEmpty;
                break;
            case "Is Not Empty":
            case "IsNotEmpty":
                functionToCall = Helper.IsNotEmpty;
                break;
            case "Is":
            case "IS":
                functionToCall = Helper.IsFunc;
                break;
            case "Contains Any Words (separated by spaces)":
            case "ContainsAnyWordsSeparatedBySpaces":
                functionToCall = Helper.ContainsAnyWord;
                break;
            case "Does Not Contain":
            case "DoesNotContain":
                functionToCall = Helper.DoesNotContain;
                break;
            case "Starts With":
            case "StartsWith":
                functionToCall = Helper.StartsWith;
                break;
            case "Does Not Starts With":
            case "DoesNotStartsWith":
                functionToCall = Helper.DoesNotStartsWith;
                break;
            case "Ends With":
            case "EndsWith":
                functionToCall = Helper.EndsWith;
                break;
            case "Does Not End With":
            case "DoesNotEndWith":
                functionToCall = Helper.DoesNotEndWith;
                break;
            case "Is Exactly":
            case "IsExactly":
                functionToCall = Helper.IsExactly;
                break;
            case "Is in the past":
            case "Isinthepast":
            case "IsInThePast":
                functionToCall = Helper.DateChecker.IsInThePast;
                break;
            case "Before":
                functionToCall = Helper.DateChecker.Before;
                break;
            case "After":
                functionToCall = Helper.DateChecker.After;
                break;
            case "IsInTheFuture":
                functionToCall = Helper.DateChecker.IsInTheFuture;
                break;
            case "IsTomorrow":
                functionToCall = Helper.DateChecker.IsTomorrow;
                break;
            case "IsToday":
                functionToCall = Helper.DateChecker.IsToday;
                break;
            case "IsYesterday":
                functionToCall = Helper.DateChecker.IsYesterday;
                break;
            case "IsInTheLast7Days":
                functionToCall = Helper.DateChecker.IsInTheLastSevenDays;
                break;
            case "IsInTheLast30Days":
                functionToCall = Helper.DateChecker.IsInTheLast30Days;
                break;
            case "IsInTheLast180Days":
                functionToCall = Helper.DateChecker.IsInTheLast180Days;
                break;
            case "IsInTheLast365Days":
                functionToCall = Helper.DateChecker.IsInTheLast365Days;
                break;
            case "IsInTheNext7Days":
                functionToCall = Helper.DateChecker.IsInTheNextSevenDays;
                break;
            case "IsInTheNext30Days":
                functionToCall = Helper.DateChecker.IsInTheNext30Days;
                break;
            case "IsInTheNext180Days":
                functionToCall = Helper.DateChecker.IsInTheNext180Days;
                break;
            case "IsInTheNext365Days":
                functionToCall = Helper.DateChecker.IsInTheNext365Days;
                break;
            case "IsInTheNext8To30Days":
                functionToCall = Helper.DateChecker.IsInTheNext8to30Days;
                break;
            case "IsInTheNext31To180Days":
                functionToCall = Helper.DateChecker.IsInTheNext31to180Days;
                break;
            case "IsInTheNext181To365Days":
                functionToCall = Helper.DateChecker.IsInTheNext181to365Days;
                break;
        }
        return functionToCall;
    }
})();

;
window.onerror = function (msg, url, lineNo, columnNo, error) {
    return (Helper.Contains("DXR.axd", url));
    /*var stacktrace = "msg";
    if (typeof error === 'object') {
        stacktrace = error.stack;
    }

    if (error instanceof ReferenceError) {
        return true;
    }
        

    Notification.SetNotification("Please reload the page!!!");
    console.clear();
    //Notification.SetNotification("Msg:" + msg + ": Url:" + url + ": Line:" + line, "warning", 3500);    //if (encodeURIComponent) {
    //    return loadXMLDoc("/Error/JSErrorHandler", "msg=" + encodeURIComponent(msg) + '&url=' + encodeURIComponent(url) + "&line=" + line);
    //};
    return false;*/
};

// Ajax request
function loadXMLDoc(url, params) {
    var req;
    if (window.XMLHttpRequest) {
        try {
            req = new XMLHttpRequest();
        } catch (e) {
            req = false;
        }
    } else
        if (window.ActiveXObject) {
            try {
                req = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    req = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {
                    req = false;
                }
            }
        }

    if (req) {
        req.open("POST", url, true);
        req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        req.send(params);
        return true;
    }
    return false;
}
;
(function () {

    var Notification = {};

    //Notification Methods
    //TODO: To develop the functionality to add 2 or more messages in the same time 
   // var barNotificationTimeout;

    Notification.SetNotification = function (message, messagetype, timeout) {
        if (isEmpty(message))
            return;

        if (timeout == null) timeout = 2000;
        var options = {
            timeOut: timeout,
            closeButton: true,
            progressBar: true,
            preventDuplicates: true
        }
        if ((typeof message) == 'string') {
            switch (messagetype) {
                case "success":
                    toastr.success(message, '', options);
                    break;
                case "error":
                    toastr.error(message, '', options);
                    break;
                case "warning":
                    toastr.warning(message, '', options);
                    break;
                case "info":
                    toastr.info(message, '', options);
                    break;

                default:
                    toastr.success(message, '', options);
            }
        }
        else {
            message.forEach(function (value, index) {
                delete message[index];
                Notification.SetNotification(value, messagetype, timeout);
            });
        }
    }

    

    function isEmpty(val) {
        return (val === undefined || val == null || val.length <= 0 || val <= 0) ? true : false;
    }
    
    window.Notification = Notification;
})();;
var MainRibbonV = (function () {
    var items = ["New", "OpenRecord", "SimpleSearchIn", "SearchInTemplate", "SimpleSearchFor", "itemSearchInTextBox",
        "MaxRecordsPerObject", "itemSearchLimit", "ShowMainColumns", "ShowImages", "HideImages"];
    var itemObject = {};
    var DOM = function () {
        items.forEach(function (item) {
            itemObject[item] = MainRibbon.GetItemByName(item);
        });
        return itemObject;
    };

    var _State = {
        ShouldCheckHideShowCond: true
    }

    var actionBasedOnCondition = {

    }
    var onChange = function () {

    }

    var UiChanges = function (data) {
        switch (data.sender.name) {
            case View.Dom.ModuleMenu:
                UiControl(data.sender.GetSelectedItem().name);
                break;

        }
    };
    var UiControl = function (_name) {
        if (_name != enums.Modules.Home) {
            $("#SimpleSearchLimitRecords").hide();
            $("#" + MainRibbon.GetItemByName("MaxRecordsPerObject").getElement().id).hide();
        }
        else {
            $("#SimpleSearchLimitRecords").show();
            $("#" + MainRibbon.GetItemByName("MaxRecordsPerObject").getElement().id).show();
        }

        MainRibbon.GetItemByName("sendToProcessTemplate").SetEnabled((_name == enums.Modules.Documents || _name == enums.Modules.Processes || _name == enums.Modules.Projects || _name == enums.Modules.Contacts) && AppV.GetGlobals().ObjectId != -1);
    }

    var ActiveTabChanged = function (s, e) {
        MainRibbon.GetItemByName("RefreshDashboard").SetEnabled(e.tab.name == "Dashboard" && AppV.GetHomeObjects().MenuSelected == enums.HomeModules.MyDashboard);
        DashboardItems.SetEnabled(e.tab.name == "Dashboard" && AppV.GetHomeObjects().MenuSelected == enums.HomeModules.MyDashboard);
        AutomaticRefreshCombo.SetEnabled(e.tab.name == "Dashboard" && AppV.GetHomeObjects().MenuSelected == enums.HomeModules.MyDashboard);
    }

    var UpdateLastUpdatedRefreshField = function () {
        AutomaticRefreshCombo.SetEnabled(true);
        var dateStr = new Date();
        if (typeof MainRibbon !== "undefined") {
            $("#" + MainRibbon.GetItemByName("AutomaticRefreshDate").id).children().children().children().text(dateStr.toLocaleString());
        } else {
            $("#" + MainRibbonExternalDashboards.GetItemByName("AutomaticRefreshDate").id).children().children().children().text(dateStr.toLocaleString());
        }
    }

    var Init = function (s, e) {
        UI.subscribe(UiChanges);
        // View.UpdateHeaderInformation();
        AppV.pushGlobalState("isMainWindow", true);
        heightChange();
        App.ExludeMethodsFromObject();
    }

    var heightChange = function () {
        mainSplFullScreenMode.GetPaneByName("mainSplHeaderContent").SetSize(parseInt(MainRibbon.GetHeight()));
    }

    function showHideMainColumns() {
        resetShowHideImageColumns();
        window.cbpDocumetGrid.PerformCallback({
            showMainColumns: true
        });
    }
    var resetShowHideImageColumns = function () {
        _State.ShouldCheckHideShowCond = false;
        $(".HideImagesCss").hide();
        $(".ShowImagesCss").show();
        Helper.CreateCookie(enums.CookieKey.SHOWRECORDIMAGE, true);
    }
    var showHideImageColumns = function (name, moveColumn = true) {
        if (!_State.ShouldCheckHideShowCond) {
            _State.ShouldCheckHideShowCond = true;
            return;
        }
        var value = false;
        MainGrid.ShouldReload(false);



        if (name === "ShowImages") {
            value = true;
            if (moveColumn) {
                window.gridViewDocuments.MoveColumn("ImageRecord", 0, true);
            }
            $(".ShowImagesCss").hide();
            $(".HideImagesCss").show();
        } else {
            if (moveColumn) {
                window.gridViewDocuments.MoveColumn(1);
            }
            $(".HideImagesCss").hide();
            $(".ShowImagesCss").show();
        }

        Helper.CreateCookie(enums.CookieKey.SHOWRECORDIMAGE, value);
    }

    var onClick = function (s, e) {
        switch (e.item.name) {
            case "SearchAll":
                var menuPanel = window.mainSplFullScreenMode.GetPaneByName("mainSplRightPanel");
                if (menuPanel.IsCollapsed()) {
                    menuPanel.Expand();
                    cbpSearchAllContent.PerformCallback();
                }
                RightPageControlPanel.SetActiveTabIndex(3);
                document.getElementById("RightPageControlPanel_TC").style.left = "0px";
                break;
            case "New":
                if (!AppV.GetGlobals().IsSpecialObject) {
                    Request.ajax({
                        type: "POST",
                        url: '/Properties/CheckForPermision/',
                        data: {
                            objectId: AppV.GetGlobals().ObjectId,
                            subObjectGuid: AppV.GetGlobals().SubObjectGuid
                        },
                        dataType: "json"
                    }).then(function (response) {
                        if (response.success && AppV.GetGlobals().AddNewUrlEncrypted != "") {
                            Helper.open('/PropertyCard/AddNew/' + AppV.GetGlobals().AddNewUrlEncrypted, '_blank');
                        } else {
                            Notification.SetNotification(response.message, 'warning', 5000);
                        }
                    })
                        .then(function () { window.loadingPanel.Hide(); });
                } else {
                    Notification.SetNotification(window.SwResourceObject.RecordsCannotBeCreatedInHerePleaseGoToTheMainGrid, 'warning', 5000);
                }
                break;
            case "OpenRecord":
                openRecordMainGrid();
                //broadcastV.create({ endPoint: "MainGrid" });
                //if (typeof MainGrid.GetGridRowData() == "undefined")
                //    Notification.SetNotification(SwResourceObject.PleaseSelectAnItem);
                //else
                //    Helper.open('/PropertyCard/Index/' + MainGrid.GetGridRowData().UrlEncrypted, '_blank');
                break;

            case "Help":
                var culture = Helper.GetCookie("SolidWorksLanguage");
                if (Helper.IsEmpty(null, culture)) culture = "en";
                var url = RootUrl + enums.Help.Folder +"/"+ culture + "/" + enums.Help.IndexUrl;
                $.ajax({
                    type: "POST",
                    url: '/Main/CheckIfFileExist/',
                    data: {
                        "culture": culture
                    },
                    dataType: "json",
                    success: function (response) {
                        if (response.Success) {
                            if (!response.useOnlineHelp) {
                                Helper.open(response.HelpUrl, '_blank', "noRoot");
                            } else {
                                window.open(response.HelpUrl, '_blank');
                            }
                        }
                        else
                            Notification.SetNotification(SwResourceObject.FileDoesNotExist + "  " + SwResourceObject.PleaseContactYourSystemAdministrator, "info");
                    }
                });
                break;

            case "ChangeTheme":
                View.load("ChangeTheme", {}, true, false);
                break;

            case "ShowMainColumns":
                showHideMainColumns();
                break;

            case "ShowImages":
            case "HideImages":
                MainRibbonV.showHideImageColumns(e.item.name);
                break;
            case "ShowVerticalGridLines":
                var showVerticalGridLines = false;  
                var itemRibbonG = MainRibbon.GetItemByName('ShowVerticalGridLines');
                if (itemRibbonG != "undefined" || itemRibbonG != null) {
                    showVerticalGridLines = itemRibbonG.GetValue();
                }
                Helper.CreateCookie(enums.CookieKey.SHOWVERTICALGRIDLINES, showVerticalGridLines);
                break;
            case "ShowBandedRows":
                var showBandedRows = false;
                var itemRibbonR = MainRibbon.GetItemByName('ShowBandedRows');
                if (itemRibbonR !== "undefined" || itemRibbonR !== null) {
                    showBandedRows = itemRibbonR.GetValue();
                }
                Helper.CreateCookie(enums.CookieKey.SHOWBANDEDROWS, showBandedRows);
                break;
            case "About":
                View.load("AboutPopUp", {}, true, false);
                break;

            case "ChangePassword":
                View.load("ChangePassword", {}, true, false);
                break;

            case "LogOut":
                break;

            case "MyProfile":
                View.load("UserDetailsPopUp",
                    {
                        objectId: -1,
                        recordGuid: "",
                        userId: -1
                    });
                break;

            case "RefreshDashboard":
                View.load('Dashboard',
                    {
                        dashboardId: DashboardItems.GetValue(),
                        reload: true
                    }, false);
                break;
        }
    }

   var  openRecordMainGrid= function (visibleIndex = -1) {
       var recordKeys = Object.keys(MainGrid.GetSelectedRowValues());
       if (recordKeys.length > 0) {
           if (recordKeys.length > 5) {
               Notification.SetNotification(Helper.T("Can not open more than 5 records at the same time"), 'warning', 2500);
               return;
           }
           recordKeys.forEach(function (key, index) {
               var selectedRow = MainGrid.GetSelectedRowValues()[key];
               if (typeof selectedRow == "undefined" || selectedRow == null) {
                   Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
                   return;
               }
               if (selectedRow.HasFieldGroupRights == false) {
                   Notification.SetNotification(SwResourceObject.YouDoNotHavePermissionToViewThisRecord, 'warning', 2500);
                   return;
               }

               broadcastV.create({ endPoint: "MainGrid" });

               Helper.open('/PropertyCard/Index/' + selectedRow.UrlEncrypted, '_blank');
           });
       } else {
           var selectedRow = (visibleIndex === -1 ? MainGrid.GetGridRowData() : MainGrid.GetGridRowData(visibleIndex));

           if (typeof selectedRow == "undefined" || selectedRow == null) {
               Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
               return;
           }
           if (selectedRow.HasFieldGroupRights == false) {
               Notification.SetNotification(SwResourceObject.YouDoNotHavePermissionToViewThisRecord, 'warning', 2500);
               return;
           }

           broadcastV.create({ endPoint: "MainGrid" });

           Helper.open('/PropertyCard/Index/' + selectedRow.UrlEncrypted, '_blank');
       }
    }

    //change Password
    var errorText = '';
    var UpdateErrorWindow = function (checkVisible) {
        if (checkVisible && IsErrorWindowVisible()) return;


        if (!tbRetypePassword.GetIsValid()) {
            if (errorText != '')
                errorText += '<br /><br />';
            errorText += 'Passwords do not match!';
        }
        if (!tbPassword.GetIsValid() || tbPassword.GetText().trim() == "") {
            if (errorText != '')
                errorText += '<br /><br />';
            errorText += 'The new password has to be longer than 1 chars and different from the old password.';
        }
        if (tbRetypePassword.GetIsValid() && (tbPassword.GetIsValid() && tbPassword.GetText().trim() != "")) {
            SetWindowErrorVisible(false);
            $.ajax({
                type: "POST",
                url: '/Authentication/ChangePassword/',
                data: {
                    "oldPassword": oldPassword.GetValue(),
                    "Password": tbPassword.GetValue(),
                    "ConfirmPassword": tbRetypePassword.GetValue()
                },
                dataType: "json",
                success: function (response) {
                    var res = JSON.parse(response.data);
                    if (!res.Success)
                        Notification.SetNotification(res.Message, 'error', 3500);
                    else {
                        EmptyValuesPasswordModal();
                        Notification.SetNotification(res.Message, 'success', 3500);
                    }
                }
            });

        } else {
            SetWindowErrorString(errorText);
            SetWindowErrorVisible(true);
        }

    }
    var SetWindowErrorVisible = function (value) {
        if (value)
            pcError.Show();
        else
            pcError.Hide();
    }
    var SetWindowErrorString = function (text) {
        pcError.SetContentHTML(text);
    }
    var EmptyValuesPasswordModal = function () {
        oldPassword.SetValue('');
        tbPassword.SetValue('');
        tbRetypePassword.SetValue('');
        window.ChangePasswordPopup.Hide();
        SetWindowErrorVisible(false);

    }
    var IsErrorWindowVisible = function () {
        return pcError.IsVisible();
    }
    var RemoveErrorsAfterLostFocus = function () {
        errorText = '';
        SetWindowErrorVisible(false);
    }
    var OnPasswordValidate = function (s, e) {
        e.isValid = e.value != null && e.value.length >= 1 && e.value != oldPassword.GetValue();//Removed check with old password ;
    }
    var OnRetypeValidate = function (s, e) {
        e.isValid = e.value != null && e.value == tbPassword.GetValue();
    }

    var SetActiveTabSelectedMainRibbon = function (modulName) {
        RZMainTreeList.AdujstTaskTree(modulName);
        if (modulName === enums.HomeModules.MyDashboard) {
            if (typeof MainRibbon !== 'undefined')
                MainRibbon.SetActiveTab(MainRibbon.tabs[3]);
            if (typeof gridViewDocuments != 'undefined')
                window.gridViewDocuments.SetVisible(false);
            if (typeof cbpDashBoardViewer != 'undefined')
                window.cbpDashBoardViewer.SetVisible(true);
            if (typeof splDefaultDashboard != 'undefined')
                window.splDefaultDashboard.SetVisible(true);
        }
        else {
            if (typeof MainRibbon !== 'undefined')
                MainRibbon.SetActiveTab(MainRibbon.tabs[1]);
            if (typeof cbpDashBoardViewer != 'undefined')
                window.cbpDashBoardViewer.SetVisible(false);
            if (typeof splDefaultDashboard != 'undefined')
                window.splDefaultDashboard.SetVisible(false);
        }
    }



    return {
        ActiveTabChanged,
        UpdateLastUpdatedRefreshField,
        Init,
        onClick,
        heightChange,
        OnRetypeValidate,
        RemoveErrorsAfterLostFocus,
        OnPasswordValidate,
        UpdateErrorWindow,
        EmptyValuesPasswordModal,
        DOM,
        SetActiveTabSelectedMainRibbon,
        showHideImageColumns,
        openRecordMainGrid,
    }
}
)();;
(function () {

    var filter = {};

    window.filterObjectId = -1;


    filter.OncmbFieldSelectionChanged = function (s, e) {
        window.cbpOperationCombo.PerformCallback({
            systemName: s.GetValue(),
            dispalyName: s.GetText()
        });
    }

    filter.OnCopyFromFiltersChanged = function (s, e) {
        cbpFilterContent.PerformCallback({
            objectId: AppV.GetFiltersState.ObjectId,
            subObjectId: AppV.GetGlobals().GroupObjectId,
            filterId: s.GetValue(),
            isForProcess: AppV.GetGlobals().ModuleName == enums.Modules.Processes,
            ProcessType: window.ProcessType
        });
    }


    filter.OnbtnAddFilterClick = function (s, e) {

        var folderName = "";
        if (!window.IsForProcess) {
            folderName = window.cmbFolder.GetText();
        }

        var systemName = window.cmbField.GetValue();
        var operation = window.cmbOperation.GetValue();
        var value = window.cmbValue.GetText();
        var condition = window.cmbAndOr.GetText();

        var operationsNotToCheck = [
            "IsEmpty", "IsNotEmpty"
        ];

        if (value == null) {
            value = "";
        }
        var emptyfields = Helper.IsEmpty(null, systemName);
        var emptyToCheck = (operationsNotToCheck.indexOf(operation) >= 0) ? true : false;
        var emptyOperator = Helper.IsEmpty(null, operation);
        var emptyvalue = Helper.IsEmpty(null, value);
        if (emptyToCheck) emptyvalue = false;
        if (!emptyfields && (emptyOperator || emptyvalue)) {
            if (!window.IsForProcess) {
                Notification.SetNotification(SwResourceObject.PleaseCompleteAllFields, 'warning', 2500);
                return;
            } else if (Helper.IsEmpty(null, folderName)) {
                Notification.SetNotification(SwResourceObject.PleaseCompleteAllFields, 'warning', 2500);
                return;
            }
        }
        window.FilterTreelist.PerformCallback({
            folderName: folderName,
            systemName: systemName,
            condition: condition,
            operation: operation,
            value: value,
            clearAllRows: false,
            isAddNew: true,
            rowIndex: -1
        });
    };


    filter.OnbtnReplaceFilterClick = function (s, e) {

        var folderName = "";
        if (!window.IsForProcess) {
            folderName = window.cmbFolder.GetText();
        }

        var systemName = window.cmbField.GetValue();
        var operation = window.cmbOperation.GetValue();
        var value = window.cmbValue.GetText();
        var condition = window.cmbAndOr.GetText();

        var rowIndex = window.FilterTreelist.GetFocusedNodeKey();
        if (value == null) {
            value = "";
        }

        if (rowIndex === "0" || rowIndex === null) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
        }
        if ((operation === null
            || systemName === null
            || systemName === ""
            || operation === "")
            || (window.IsForProcess === false && folderName === "")) {

            Notification.SetNotification(SwResourceObject.PleaseCompleteAllFields, 'warning', 2500);
        } else {
            window.FilterTreelist.PerformCallback({
                folderName: folderName,
                systemName: systemName,
                condition: condition,
                operation: operation,
                value: value,
                clearAllRows: false,
                isAddNew: true,
                rowIndex: rowIndex
            });
        }

    }


    filter.OnbtnRemoveFilterClick = function (s, e) {
        var rowIndex = window.FilterTreelist.GetFocusedNodeKey();
        if (rowIndex === "0" || rowIndex === null) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
        } else {
            window.FilterTreelist.PerformCallback({
                clearAllRows: false,
                isAddNew: false,
                rowIndex: rowIndex
            });
        }
    }


    filter.cbpFilterTreelistEndCallback = function (s, e, objectId) {
        window.filterObjectId = objectId;
        // if (s.rowCount > 0)
        filter.ObtnSearchFilterClick(s, e);
    }

    filter.cbpFilterContentEndCallback = function (s, e) {
        window.IsForProcess = cbpFilterContent.cpIsForProcess === 1;
        window.IsEditingFilter = cbpFilterContent.cpIsEditing === 1;
        window.ProcessType = cbpFilterContent.cpProcessType;
    };

    window.lastSavedFilterId = -1;

    filter.ObtnSearchFilterClick = function (s, e) {

        var statusArray = window.filterStatusDropDowncheckListBox.GetSelectedValues();
        var filterName = window.txtFilterName.GetValue();
        var rowNumber = window.FilterTreelist.rowCount;
        var includeSubFolders = window.chkbIncludeSubFolders.GetValue();
        var displayAllRecords = window.chkbDislayAllrecords.GetValue();

        var objId = RZMainTreeList.GetCurrentNode().ObjectId;
        var subObjId = RZMainTreeList.GetCurrentNode().SubObjectId;


        $.ajax({
            type: "POST",
            url: "/Filter/SaveFilter",
            data: {
                objectId: objId,
                subObjectId: subObjId,
                filterName: filterName,
                includeSubFolders: includeSubFolders,
                isGlobalFilter: false,
                displayAllRecords: displayAllRecords,
                statusArray: JSON.stringify(statusArray),
                isForProcess: window.IsForProcess,
                processType: window.ProcessType
            },
            success: successSearchProccess,
            error: function () {
                Notification.SetNotification(SwResourceObject.FailedToSaveFilter, 'warning', 2500);
            }
        });


    };


    function successSearchProccess(result) {

        if (result.id != null) {
            MainGrid.PerformCallback(true, result.id);
        }

    }


    filter.OnbtnSaveFilterClick = function (s, e) {
        var statusArray = window.filterStatusDropDowncheckListBox.GetSelectedValues();
        var filterName = window.txtFilterName.GetValue();
        var includeSubFolders = window.chkbIncludeSubFolders.GetValue();
        var isGlobalFilter = window.chkbGlobalFilters.GetValue();
        var displayAllRecords = window.chkbDislayAllrecords.GetValue();

        var objId = RZMainTreeList.GetCurrentNode().ObjectId;
        var subObjId = RZMainTreeList.GetCurrentNode().SubObjectId;

        var isFilterEmpty = window.FilterTreelist.rowCount < 1 && statusArray.length < 1;

        var _continue = filterName !== null && filterName.trim() !== "" && isFilterEmpty === false;
        if (_continue) {
            $.ajax({
                type: "POST",
                url: "/Filter/SaveFilter",
                data: {
                    objectId: objId,
                    subObjectId: subObjId,
                    filterName: filterName,
                    includeSubFolders: includeSubFolders,
                    isGlobalFilter: isGlobalFilter,
                    displayAllRecords: displayAllRecords,
                    statusArray: JSON.stringify(statusArray),
                    isForProcess: window.IsForProcess,
                    processType: window.ProcessType
                },
                success: succesSavedFilter,
                error: function () {
                    Notification.SetNotification(SwResourceObject.PleaseSelectAFilter, 'warning', 2500);
                }
            });
        } else {
            if (filterName == null || filterName.trim() == "") {
                Notification.SetNotification(SwResourceObject.EnterANameIfYouWantToSaveAsFilter, 'warning', 2500);
            } else {
                Notification.SetNotification(SwResourceObject.FilterIsEmpty, 'warning', 2500);
            }

        }
    };



    function succesSavedFilter(result) {
        window.lastSavedFilterId = result.id;
        filter.ClearFilterFields();

        if (window.IsForProcess === true && window.ProcessType === enums.ProcessTypes.Tasks) {
            window.MainTaskFilterTree.PerformCallback();
        } else {

            // window.App.GridView.Callback.TreeView(AppV.GetGlobals().ModuleName, true);

            window.App.GridView.Callback.TreeView(AppV.GetFiltersState.CalledFrom, true);
        }

        window.cbpFilterContent.PerformCallback({
            objectId: AppV.GetFiltersState.ObjectId,
            subObjectId: AppV.GetGlobals().GroupObjectId
        });

        Notification.SetNotification(SwResourceObject.SavedSuccessfully, 'success', 2500);
    }

    filter.ClearFilterFields = function () {
        if (typeof filterEditStatusDropDowncheckListBox == "undefined")
            return;
        window.filterStatusDropDowncheckListBox.ClearItems();
        window.txtFilterName.SetValue("");
        window.cmbFolder.SetValue("");
        window.cmbField.SetValue("");
        window.cmbType.SetValue("");
        window.cmbOperation.SetValue("");
        window.filterStatusDropDown.SetValue("");
        window.cmbValue.SetValue(null);

        if (window.filterObjectId !== -1 || window.lastSavedFilterId !== -1) {
            window.lastSavedFilterId = -1;
            window.FilterTreelist.PerformCallback({
                clearAllRows: true,
                isAddNew: false
            });

        }

    };


    filter.DisableFilterFields = function () {
        if (typeof txtFilterName == "undefined")
            return;
        window.txtFilterName.SetEnabled(false);
        window.cmbFolder.SetEnabled(false);
        window.cmbField.SetEnabled(false);
        window.cmbOperation.SetEnabled(false);
        window.cmbType.SetEnabled(false);
        window.cmbValue.SetEnabled(false);
        window.cmbAndOr.SetEnabled(false);
        window.btnAddFilter.SetEnabled(false);
        window.btnReplace.SetEnabled(false);
        window.btnRemove.SetEnabled(false);
        window.cmbType.SetEnabled(false);
        window.chkbIncludeSubFolders.SetEnabled(false);
        window.chkbGlobalFilters.SetEnabled(false);
        window.chkbDislayAllrecords.SetEnabled(false);
        window.btnSearch.SetEnabled(false);
        window.btnSave.SetEnabled(false);
        window.filterStatusDropDown.SetEnabled(false);
    }


    window.IsEditingFilter = false;
    window.IsForProcess, window.FilterEditIsForProcess = false;
    window.ProcessType, window.FilterEditProcessType = 0;

    window.filterObjectId = -1;

    filter.Edit = {

        OncmbEditFieldSelectionChanged: function (s, e) {
            window.cbpEditOperationCombo.PerformCallback({
                systemName: s.GetValue()
            });
        },

        OnbtnAddFilterClick: function (s, e) {


            var folderName = "";
            if (!window.FilterEditIsForProcess) {
                folderName = window.cmbEditFolder.GetText();
            }

            var systemName = window.cmbEditField.GetValue();
            var operation = window.cmbEditOperation.GetValue();
            var value = window.cmbEditValue.GetText();
            var condition = window.cmbEditAndOr.GetText();

            var operationsNotToCheck = [
                "IsEmpty", "IsNotEmpty"
            ];

            if (value == null) {
                value = "";
            }
            var emptyfields = Helper.IsEmpty(null, systemName);
            var emptyToCheck = (operationsNotToCheck.indexOf(operation) >= 0) ? true : false;
            var emptyOperator = Helper.IsEmpty(null, operation);
            var emptyvalue = Helper.IsEmpty(null, value);
            if (emptyToCheck) emptyvalue = false;
            if (!emptyfields && (emptyOperator || emptyvalue)) {
                if (!window.IsForProcess) {
                    Notification.SetNotification(SwResourceObject.PleaseCompleteAllFields, 'warning', 2500);
                    return;
                } else if (Helper.IsEmpty(null, folderName)) {
                    Notification.SetNotification(SwResourceObject.PleaseCompleteAllFields, 'warning', 2500);
                    return;
                }
            }
            window.FilterEditTreelist.PerformCallback({
                folderName: folderName,
                systemName: systemName,
                condition: condition,
                operation: operation,
                value: value,
                clearAllRows: false,
                isAddNew: true,
                rowIndex: -1
            });

        },

        OnbtnReplaceFilterEditClick: function (s, e) {
            var folderName = "";

            if (!window.FilterEditIsForProcess) {
                folderName = typeof cmbFolder != "undefined" ? window.cmbFolder.GetText():"";
            }
            folderName = window.cmbEditFolder.GetText();
            var systemName = window.cmbEditField.GetValue();
            var operation = window.cmbEditOperation.GetValue();
            var value = window.cmbEditValue.GetText();
            var condition = window.cmbEditAndOr.GetText();
            var rowIndex = window.FilterEditTreelist.GetFocusedNodeKey();

            if (value == null) {
                value = "";
            }
            if (rowIndex === "0" || rowIndex === null) {
                Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
                return;
            }
            if (operation === null
                || systemName === null
                || (window.FilterEditIsForProcess === false && folderName === "")
                || systemName === ""
                || operation === "") {
                Notification.SetNotification(SwResourceObject.PleaseCompleteAllFields, 'warning', 2500);
                return;
            } else {
                window.FilterEditTreelist.PerformCallback({
                    folderName: folderName,
                    systemName: systemName,
                    condition: condition,
                    operation: operation,
                    value: value,
                    clearAllRows: false,
                    isAddNew: true,
                    rowIndex: rowIndex
                });
            }

        },

        OnbtnRemoveFilterClick: function (s, e) {
            var rowIndex = window.FilterEditTreelist.GetFocusedNodeKey();
            if (rowIndex === "0" || rowIndex === null) {
                Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
            } else {
                window.FilterEditTreelist.PerformCallback({
                    clearAllRows: false,
                    isAddNew: false,
                    rowIndex: rowIndex
                });
            }
        },

        OnbtnSaveFilterClick: function (s, e) {
            var statusArray = window.filterEditStatusDropDowncheckListBox.GetSelectedValues();
            var filterName = window.txtEditFilterName.GetValue();
            var includeSubFolders = window.chkbEditIncludeSubFolders.GetValue();
            var isGlobalFilter = window.chkbEditGlobalFilters.GetValue();
            var displayAllRecords = window.chkbEditDislayAllrecords.GetValue();

            var subObjId = RZMainTreeList.GetCurrentNode().SubObjectGuid || -1;


            if (filterName !== null && filterName.trim() !== "") {
                $.ajax({
                    type: "POST",
                    url: "/Filter/UpdateFilter",
                    data: {
                        objectId: window.filterEditObjectId.value,
                        subObjectId: subObjId,
                        filterName: filterName,
                        includeSubFolders: includeSubFolders,
                        isGlobalFilter: isGlobalFilter,
                        displayAllRecords: displayAllRecords,
                        statusArray: JSON.stringify(statusArray),
                        isForProcess: window.FilterEditIsForProcess,
                        processType: window.FilterEditProcessType
                    },
                    success: function (result) {
                        window.pcModalEditFilter.Hide();

                        if (window.FilterEditIsForProcess === true && window.FilterEditProcessType === enums.ProcessTypes.Tasks) {
                            window.MainTaskFilterTree.PerformCallback();
                        } else {
                            window.App.GridView.Callback.TreeView(AppV.GetFiltersState.CalledFrom, true);
                        }


                    },
                    error: function () {
                        Notification.SetNotification(SwResourceObject.FailedToSaveFilter, 'warning', 2500);
                    }
                });
            } else {
                Notification.SetNotification(SwResourceObject.PleaseSelectAFilter, 'warning', 2500);
            }
        },

        ClearFilterFields: function () {

            window.filterEditStatusDropDowncheckListBox.ClearItems();
            window.txtEditFilterName.SetValue("");
            window.cmbEditFolder.SetValue("");
            window.cmbEditField.SetValue("");
            window.cmbEditType.SetValue("");
            window.cmbEditOperation.SetValue("");
            window.filterEditStatusDropDown.SetValue("");
            window.cmbEditValue.SetValue(null);
            window.filterEditObjectId.value = null;

            if (window.filterObjectId !== -1 || window.lastSavedFilterId !== -1) {
                //  window.lastSavedFilterId = -1;
                window.FilterEditTreelist.PerformCallback({
                    clearAllRows: true,
                    isAddNew: false
                });

            }

        },

        cbpFilterContentEndCallback: function () {
            window.FilterEditIsForProcess = pcModalEditFilter.cpFilterEditIsForProcess === 1;
            window.FilterEditProcessType = pcModalEditFilter.cpFilterEditProcessType;
        },

        OnbtnSortFilterClick: function (s, e) {
            window.pcModalSortByColumns.PerformCallback();
            window.pcModalSortByColumns.Show();
        },

        ClearSortByColumnsFields: function (s, e) {
            window.field1.SetValue("");
            window.field2.SetValue("");
            window.field3.SetValue("");
            window.sortBy1.SetValue("");
            window.sortBy2.SetValue("");
            window.sortBy3.SetValue("");
        },

        SaveFilterSort: function (s, e) {
            var fld1 = filter.Edit.GetSelectedSortFieldColumnId(field1);
            var fld2 = filter.Edit.GetSelectedSortFieldColumnId(field2);
            var fld3 = filter.Edit.GetSelectedSortFieldColumnId(field3);
            var sysName1 = window.field1.GetValue();
            var sysName2 = window.field2.GetValue();
            var sysName3 = window.field3.GetValue();
            var srt1 = window.sortBy1.GetValue();
            var srt2 = window.sortBy2.GetValue();
            var srt3 = window.sortBy3.GetValue();

            //if (sysName1 !== null && sysName2 !== null && sysName3!==null) {
            $.ajax({
                type: "POST",
                url: "/Filter/SaveSort",
                data: {
                    field1Id: fld1,
                    field2Id: fld2,
                    field3Id: fld3,
                    systemName1: sysName1,
                    systemName2: sysName2,
                    systemName3: sysName3,
                    sort1Id: srt1,
                    sort2Id: srt2,
                    sort3Id: srt3,
                    filterId: AppV.GetFiltersState.FilterId,
                    objectId: window.filterEditObjectId.value,
                    processType: window.FilterEditProcessType
                },
                success: function (result) {
                    var response = JSON.parse(result.data);
                    if (response.Success) {
                        Notification.SetNotification(SwResourceObject.Success, 'success', 2500);
                        window.pcModalSortByColumns.Hide();
                    }
                    else {
                        Notification.SetNotification(response.Message, 'warning', 2500);
                    }

                },
                error: function () {
                    Notification.SetNotification(SwResourceObject.FailedToSaveChanges, 'warning', 2500);
                }
            });
            //} else {
            //    Notification.SetNotification(SwResourceObject.PleaseSelectAFilter, 'warning', 2500);
            //}
        },

        GetSelectedSortFieldColumnId: function (field) {

            var result = -1;

            var selectedField = field.GetSelectedIndex();

            if (selectedField > -1) {
                result = field.cpFieldListValues[selectedField].ColumnId;
            }

            return result;
        }
    };

    window.Filter = filter;
})();



(function () {

    var searchAll = {};
    var myWorkingModule = enums.TOT.Objects;

    searchAll.OnbtnSearchAllButtonClick = function (s, e) {
        if (e.buttonIndex === 0) {
            if (chkbDocumentsRecords.GetChecked() || chkbProcesses.GetChecked() || chkbProjects.GetChecked() || chkbReports.GetChecked()) {
                if (GridSearchAll.pageRowCount === 0) {
                    loadingPanel.Show();
                }
                searchAll.OnbtnSearchAllMaterialThemeHideOptions();
                cbpSearchGrid.PerformCallback();
            } else {
                Notification.SetNotification(SwResourceObject.PleaseSelectAtLeastOneFieldToSearchInto, 'warning', 2500);
            }
        } else {
            window.btnSearchAll.SetValue('');
        }
    };

    searchAll.OnbtnSearchAllKeyPress = function (s, e) {
        if (e.htmlEvent.keyCode === 13) {
            if (GridSearchAll.pageRowCount === 0) {
                loadingPanel.Show();
            }
            searchAll.OnbtnSearchAllMaterialThemeHideOptions();
            cbpSearchGrid.PerformCallback();
        }
    };
    searchAll.OnbtnSearchAllMaterialThemeHideOptions = function () {
        if (AppV.GetGlobals().isMainWindow) {
            var theme = Helper.GetCookie("theme");
            if (theme === enums.Theme.MaterialCompact) {
                if (SearchAllOptionsPanel != "undefined") {
                    SearchAllOptionsPanel.SetCollapsed(true);
                }
            }
        }
    };

    searchAll.OnbtnSearchAllOptionsClick = function (s, e) {
        $("#SearchOptions").each(function () {
            var element = document.getElementById("SearchAllOptionsImg");
            if ($(this).css("visibility") == "hidden") {
                element.classList.remove("rzicon_doublearrowup16");
                element.classList.add("rzicon_doublearrowdown16");
                $("#SearchOptions").css("visibility", "visible");
                document.getElementById("searchOptionsGroup").style.marginTop = "0px";
            } else {
                element.classList.remove("rzicon_doublearrowdown16");
                element.classList.add("rzicon_doublearrowup16");
                $("#SearchOptions").css("visibility", "hidden");
                document.getElementById("searchOptionsGroup").style.marginTop = "-300px";
            }
        });
    };

    searchAll.ModuleClick = function (s, e, module) {
        myWorkingModule = module;
        if (chkbshowResults.GetChecked()) {
            cbpSearchGrid.PerformCallback();
        }
    };

    searchAll.GridSearchAllBeginCallback = function (s, e) {
        switch (e.command) {
            case "PAGERONCLICK":
            case "APPLYCOLUMNFILTER":
            case "APPLYFILTER":
            case "APPLYHEADERCOLUMNFILTER":
            case "NEXTPAGE":
            case "SORT":
            case "EXPANDROW":
            case "COLLAPSEALL":
            case "EXPANDALL":
                e.customArgs["reload"] = false;
                break;
            default:
                e.customArgs["reload"] = true;
                break;
        }
        e.customArgs["TxtsearchAll"] = btnSearchAll.GetValue();
        e.customArgs["myWorkingModule"] = myWorkingModule;
        e.customArgs["limitRecords"] = SearchAllRecords.GetValue();

        var fields = window.SearchAllFieldsDropDown.GetValue();
        var fieldsSelected = "";
        if (fields !== null) {
            fieldsSelected = DropDownEdit.GetValuesByTexts(fields.split(","), DropDownEdit.ControlName("SearchAllFieldsDropDown")).toString();
        }
        e.customArgs["fieldsSelected"] = fieldsSelected;
        e.customArgs["cmbSTypeRequest"] = cmbSType.GetValue();

        var dateFields = window.SearchAllDatesDropDown.GetValue();
        var dateFieldsSelected = "";
        if (dateFields !== null) {
            dateFieldsSelected = DropDownEdit.GetValuesByTexts(dateFields.split(","), DropDownEdit.ControlName("SearchAllDatesDropDown")).toString();
        }
        e.customArgs["dateFieldsSelected"] = dateFieldsSelected;
        e.customArgs["cmbSWhenRequest"] = cmbSWhen.GetValue();
        e.customArgs["SearchDateFrom"] = SearchDateFrom.GetText();
        e.customArgs["SearchDateTo"] = SearchDateTo.GetText();

        var status = window.SearchAllStatusDropDown.GetValue();
        var statusSelected = "";
        if (status !== null) {
            statusSelected = DropDownEdit.GetValuesByTexts(status.split(","), DropDownEdit.ControlName("SearchAllStatusDropDown")).toString();
        }
        e.customArgs["statusSelected"] = statusSelected;

        e.customArgs["chkbDocumentsRecordsRequest"] = chkbDocumentsRecords.GetChecked();
        e.customArgs["chkbProcessesRequest"] = chkbProcesses.GetChecked();
        e.customArgs["chkbProjectsRequest"] = chkbProjects.GetChecked();
        e.customArgs["chkbReportsRequest"] = chkbReports.GetChecked();
    };

    searchAll.GridSearchAllInit = function (s, e) {
        var searchPanel = document.getElementById('GridSearchAll_DXSearchPanel');
        if (searchPanel != null) {
            document.getElementById('GridSearchAll_DXSearchPanel').style.display = "none";
        }
        //searchAll.setSerachAllGridHeight(200, true);
        document.getElementById('cbpSearchGrid').style.display = "none";
    };

    searchAll.GridSearchEndCallback = function (s, e) {
        document.getElementById('cbpSearchGrid').style.display = "block";
        searchAll.setSerachAllGridHeight(200, false);
        loadingPanel.Hide();
    };

    searchAll.OptionsCollapsedChanged = function (s, e) {
        searchAll.setSerachAllGridHeight(200, false);
    };

    searchAll.setSerachAllGridHeight = function (defaultHeight, pageControl) {
        var height = Math.max(0, document.documentElement.clientHeight);
        if (typeof chkbResultDocumentsRecords != "undefined") {
            defaultHeight = defaultHeight + chkbResultDocumentsRecords.GetHeight() * 2;
        }
        var tot = height - (MainRibbon.GetHeight() + btnSearchAll.GetHeight() + SearchAllOptionsPanel.GetHeight() + defaultHeight);
        GridSearchAll.SetHeight(tot);
        if (pageControl) {
            var rightPage = document.getElementById("RightPageControlPanel_C3");
            var allDivs = rightPage.getElementsByTagName('div');
            allDivs[0].style.height = height - (MainRibbon.GetHeight() + btnSearchAll.GetHeight() + SearchAllOptionsPanel.GetHeight() + 10) + "px";
        }
    };

    searchAll.VisibleGridSearchClick = function (s, e) {
        var searchBar = document.getElementById('GridSearchAll_DXSearchPanel');
        if (searchBar.style.display === "none") {
            AppV.PushStateMyWork("PanelSearchShow", true);
            searchBar.style.display = "block";
        } else {
            AppV.PushStateMyWork("PanelSearchShow", false);
            searchBar.style.display = "none";
        }
        GridSearchAll.AdjustControl();
    };

    searchAll.ExportSearchGridClick = function (s, e) {
        App.Exporting = true;
        GridSearchAll.ExportTo(ASPxClientGridViewExportFormat.Xlsx);
    };

    searchAll.GridSearchAllContextMenuDisplay = function (s, e) {
        var x = ASPxClientUtils.GetEventX(e.htmlEvent);
        var y = ASPxClientUtils.GetEventY(e.htmlEvent);
        if (e.objectType === "row" || e.objectType === "emptyrow") {
            s.SetFocusedRowIndex(e.index);
            setTimeout(function () {
                window.CtxSearchAllGrid.ShowAtPos(x, y);
            }, 10);
            rowKey = s.GetRowKey(e.index);
        }
    };

    searchAll.ContextMenuItemClick = function (s, e) {
        var result = JSON.parse(window["GridSearchAll"].cpAllRowData).filter(function (x) {
            return x.idRecord == Number(Helper.GetGridFocusedRowKey("GridSearchAll", GridSearchAll.focusedRowIndex));
        })[0];
        if (result == null || result == "undefined") {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
            return;
        }
        switch (e.item.name) {
            case "OpenRecord":
                Helper.open('/PropertyCard/Index/' + result.UrlEncrypted, '_blank');
                break;
            case "Refresh":
                cbpSearchGrid.PerformCallback();
                break;
            case "PartNumber":
                Helper.CopyTextToClipboard(result._System_objNBS);
                break;
            case "Description":
                Helper.CopyTextToClipboard(result._System_objDescription);
                break;
            case "PartNumberDescription":
                Helper.CopyTextToClipboard(result._System_objNBS + " " + result._System_objDescription);
                break;
            case "ExpandAll":
                GridSearchAll.ExpandAll();
                break;
            case "CollapseAll":
                GridSearchAll.CollapseAll();
                break;
        }
    };

    window.searchAll = searchAll;
})();

(function () {

    var simpleSearch = {};


    simpleSearch.buttonSimpleSearchCancel = function (s, e) {
        //TODO dont callback, perform clear on clientside
        window.cbpSimpleSearch.PerformCallback({
            objectId: AppV.GetGlobals().ObjectId
        });
    }

    simpleSearch.OnbtnSimpleSearchClick = function (s, e) {
        simpleSearch.ButtonClicked = 1;
        if (e.buttonIndex === 0) {
            if (AppV.GetHomeObjects().MenuSelected == enums.HomeModules.MyWork
                || AppV.GetHomeObjects().MenuSelected == enums.HomeModules.Tasks) {
                MainGrid.PerformCallback(true);
            } else {
                performSimpleSearch();
            }
        } else {
            window.btnSimpleSearch.SetValue('');
            MainGrid.PerformCallback(true);
        }
    }

    simpleSearch.KeyPressSimpleSearch = function (s, e) {
        simpleSearch.ButtonClicked = 1;
        if (e.htmlEvent.keyCode === 13) {
            performSimpleSearch();
        }
    }

    function performSimpleSearch() {
        var listName = DropDownEdit.ControlName("ListBoxSearchFields");
        var text = window.ListBoxSearchFields.GetValue();
        var simpleSearchIn;
        if (text !== null) {
            simpleSearchIn = DropDownEdit.GetValuesByTexts(text.split(","), listName);
        }
        var simpleSearchFor = window.btnSimpleSearch.GetValue();
        var limitRecords = window.SimpleSearchLimitRecords.GetValue();
        $.ajax({
            type: "POST",
            url: "/Filter/SearchSimpleSearch",
            data: {
                objectId: AppV.GetGlobals().ObjectId,
                simpleSearchIn: simpleSearchIn,
                simpleSearchFor: simpleSearchFor,
                limitRecords: limitRecords
            },
            success: function (result) {
                MainGrid.PerformCallback(true);
                //window.cbpSimpleSearch.PerformCallback({
                //    objectId: AppV.GetGlobals().ObjectId
                //});
            }
        });
    }

    window.simpleSearch = simpleSearch;
})();;

var PropertyCard = {};

ActionToPerform = {
    Default: 0,
    Save: 1,
    CheckIn: 2,
    CheckOut: 3,
    UndoCheckout: 4,
    NewFrom: 5,
    BomInlineEdit: 6,
    Preview: 7,
    Edit: 8,
    MainGridDisplay: 9,
    WhereUsed: 10,
    History: 11,
    SpecialObjects: 12,
    WhereUsedBom: 13,
    WhereUsedProcess: 14,
    WhereUsedReferenced: 15
};

Save = 1,
    CheckIn = 2,
    CheckOut = 3,
    UndoCheckout = 4,
    NewFrom = 5,


    PropertyCard.Global = {
        TabStates: {
            Properties: false,
            ReleatedFiles: false,
            WhereUsed: false,
            BOM: false,
            ToDo: false,
            ReferenceFiles: false,
            Notes: false,
            SubProcesses: false,
            Configuration: false,
            WhereUsedAsField: false,
            ProjectDeliverables: false,
            Notifications:false,
        },

        ClearTabStates: function () {
            this.TabStates.Properties = false;
            this.TabStates.ReleatedFiles = false;
            this.TabStates.WhereUsed = false;
            this.TabStates.BOM = false;
            this.TabStates.ToDo = false;
            this.TabStates.ReferenceFiles = false;
            this.TabStates.Notes = false;
            this.TabStates.SubProcesses = false;
            this.TabStates.Configuration = false;
            this.TabStates.WhereUsedAsField = false;
            this.TabStates.ProjectDeliverables = false;
            this.TabStates.Notifications= false;
        },


        ActionToPerform: 0
    };


PropertyCard.Splitter = {
    Resize: function (s, e) {
        if (AppV.GetGlobals().isMainWindow && typeof splFullScreenModePropertyCard != "undefined") {
            //var h = $("#PrecessInformationSections_C0").height()-$("#afftectedItemsRowDiv").height();  
            //ProcessRelatedItemGrid.SetHeight(h);    
            var splgridHeight = window.splFullScreenModePropertyCard.GetPaneByName("pnlRelatedItems").lastHeight;
            var heightGrid = splgridHeight - 46;

            window.ProcessRelatedItemGrid.SetHeight(heightGrid);
        }
        if (!AppV.GetGlobals().isMainWindow) {
            RzProperties.SetRightControlPanelVisibility(PropertyCardSection.GetActiveTab().name);
            PropertyCard.Splitter.SetSpliterPropertyCardButtonImage();
        }
    },
    Init: function (s, e) {
        AppV.PushAdditionalInfo("jsBundles", JSON.parse(splFullScreenModePropertyCard.cpJsBundles));
        AppV.PushAdditionalInfo("minifyScripts", splFullScreenModePropertyCard.cpMinifyScripts);
    },
    IsRightPanelOpen: function () {
        if (typeof splFullScreenModePropertyCard == 'undefined') return false;
        var rightpanel = window.splFullScreenModePropertyCard.GetPaneByName("pnlProcessInfo");
        if (rightpanel != null) {
            return rightpanel.IsCollapsed();
        }
        return false;
    },
    IsPreviewPanelOpen: function () {
        if (typeof splFullScreenModePropertyCard == 'undefined') return false;
        var menuPanelProperty = window.splFullScreenModePropertyCard.GetPaneByName("pnlProcessInfo");
        if (menuPanelProperty != null) {
            if (!menuPanelProperty.IsCollapsed()) {
                var activeTab = "";
                if (typeof PropertiesInformationSections != "undefined") {
                    activeTab = PropertiesInformationSections.GetActiveTab().name;
                }
                if (typeof PrecessInformationSections != "undefined") {
                    activeTab = PrecessInformationSections.GetActiveTab().name;
                }
                if (activeTab === "Preview") {
                    return true;
                }
            }
        }
        return false;
    },
    ExpandRightPanel: function () {
        if (typeof splFullScreenModePropertyCard == 'undefined') return false;
        var rightpanel = window.splFullScreenModePropertyCard.GetPaneByName("pnlProcessInfo");
        if (rightpanel != null) {
            rightpanel.Expand();
        }
    },
    CollapseRightPanel: function () {
        if (typeof splFullScreenModePropertyCard == 'undefined') return false;
        var rightpanel = window.splFullScreenModePropertyCard.GetPaneByName("pnlProcessInfo");
        if (rightpanel != null) {
            rightpanel.Collapse(rightpanel);
        }
        return false;
    },
    SetSpliterPropertyCardButtonImage: function () {
        this.displayObj = document.getElementById("splFullScreenModePropertyCard_0i0i1i1_S_CB_Img");
        if (PropertyCard.Splitter.IsRightPanelOpen()) {
            if (this.displayObj != null) this.displayObj.style.display = "";
        } else {
            if (this.displayObj != null) this.displayObj.style.display = "none";
        }
    }
};


PropertyCard.Alert = {
    Show: function (message) {
        window.pcMessageAlert.SetContentHTML(message);
        window.pcMessageAlert.Show();
    }
};

PropertyCard.LimitedList = {
    Events: {
        cmbSelectedIndexChange: function (s, e, limitingListData, isEditMode) {

            var parentListItemId = parseInt(s.GetValue());

            if (!Number.isNaN(parentListItemId)) {
                for (var i = 0; i < limitingListData.length; i++) {
                    var data = limitingListData[i];
                    var listControlName = window.App.Controls.Name.GetControlName(
                        data.ChildSystemName,
                        data.ChildColumnId);
                    //"callbackPanel");
                    if (PropertyCard.Global.ActionToPerform === ActionToPerform.NewFrom) {
                        listControlName += "NewFrom";
                    }

                    window[listControlName].PerformCallback(
                        {
                            parentListItemId: parentListItemId,
                            childColumnId: data.ChildColumnId
                        }
                    );
                }
            }
        }
    },
    LimitThisList: function (s, e, data, cond) {
        //FieldVaildation.newFrom
        RzProperties.ListTextFieldGotFocus(s, e);
        if (typeof s.GetItemCount == "undefined")
            s = window[s.globalName + "checkListBox"];

        this.StoreListData(s.globalName);
        cond = cond[0];
        var parentField = window.App.Controls.Name.GetControlName(cond.ParentSystemName, cond.ParentColumnId);
        if (FieldVaildation.newFrom)
            parentField += "NewFrom";
        if (typeof window[parentField].GetItemCount == "undefined")
            parentField = window[parentField + "checkListBox"];
        var valueSelectedOfParent = this.GetValueBasedOnTextSelected(parentField);
        var elementsToWorkOn = data.filter(function (x) { return x.id == valueSelectedOfParent; });
        if (elementsToWorkOn.length > 0) {
            var rowsToAdd = elementsToWorkOn[0].value;
            rowsToAdd = rowsToAdd.split(",");
            var newElements = this.AllListData[s.globalName].filter(function (x) { return rowsToAdd.indexOf(String(x.rowId)) >= 0 || x.rowId == -1; })
            //this.AllListData[s.globalName].filter(function (x) { return x.rowId });
            this.PerformChanges(s, newElements);
        } else {
            this.RemoveAllItems(s);
        }
        Helper.Scroll('scrollableDivDocs', false);
    },
    StoreListData: function (el) {
        if (!(el in this.AllListData)) {
            this.AllListData[el] = this.RetreiveElementsFromList(el);
        }
    },
    RetreiveElementsFromList: function (list) {
        if (typeof list == "string")
            list = window[list];

        var count = list.GetItemCount(), i, allValues = [];
        for (i = 0; i < count; i++) {
            var _current = list.GetItem(i);
            allValues.push({
                rowId: _current.value,
                texts: _current.texts,
                value: _current.value,
                imageUrl: _current.imageUrl,
                htmlContent: _current.htmlContent,
                cssClass: _current.cssClass,
                tooltip: _current.tooltip
            });
        }
        return allValues;

    },
    DestoryStorage: function () {
        this.AllListData = {};
    },

    GetValueBasedOnTextSelectedExtra: function (obj) {
        var _value = obj.GetValue();
        if (isNaN(_value)) {
            var _count = obj.GetItemCount(), i, _valueSelected, stopped = false;
            for (i = 0; i < _count; i++) {
                if (obj.GetItem(i).text == _value && !stopped) {
                    _valueSelected = obj.GetItem(i).value;
                    stopped = true;
                }
                //TODO stop execution!!
            }
            return _valueSelected.toString().trim();
        } else {
            return _value;
        }
    },
    GetValueBasedOnTextSelected: function (obj) {
        if (typeof obj == "string")
            obj = window[obj];
        //return obj.lastSuccessValue;
        if (typeof obj.GetSelectedItems != "undefined") {
            var howMany = obj.GetSelectedItems();
            if (howMany.length > 1)
                return "noCondition";
            else
                return this.GetValueBasedOnTextSelectedExtra(obj);
        } else {
            return this.GetValueBasedOnTextSelectedExtra(obj);
        }

    },
    PerformChanges: function (s, newElements) {
        this.RemoveAllItems(s);
        this.AddItems(s, newElements);
    },
    ReturnToDefault: function (s) {
        this.RemoveAllItems(s);
        this.AddItems(s, this.AllListData[s.globalName]);
    },
    RemoveAllItems: function (s) {
        var iterations = s.GetItemCount();
        for (i = 0; i < iterations; i++) {
            s.RemoveItem(0);
        }
    },
    AddItems: function (s, itemsToAdd) {
        for (i = 0; i < itemsToAdd.length; i++) {
            var _current = itemsToAdd[i];
            s.AddItem(_current.texts, _current.value, _current.imageUrl, _current.htmlContent, _current.cssClass, _current.tooltip);
        }
    },
    AllListData: {}
};

PropertyCard.ListBeginCallback = function (s, e) {
    e.customArgs["objectId"] = AppV.GetGlobals().ObjectId;
    e.customArgs["isEditMode"] = s.cpIsEditMode;
    e.customArgs["recordId"] = AppV.GetGlobals().RecordId;
    e.customArgs["actionToPerform"] = PropertyCard.Global.ActionToPerform;
    e.customArgs["fieldName"] = s.name;
};

function ClearPropertyCardServerCache() {

    $.ajax({
        type: "POST",
        url: "/Common/ClearTabCache"
    });
}

(function () {
    var RzProperties = {};
    var fieldGroupId = -1;
    var RichMemo = {};


    function updateSpecioObjectState(tabName) {
        var x = tabName.split("-");
        AppV.pushState('SpecialObject', { GroupObjectId: Number(x[1]), RelatedObjectId: Number(x[2]), IsMulti: Number(x[3]) });
    }

    function updateReferencedFieldState(tabName) {
        var x = tabName.split("-");
        AppV.pushState('ReferencedField', { ObjectFieldPropertyTabId: Number(x[1]) });
    }

    function PropertiesNoteTabClick() {
        var groupObjectId = AppV.GetPropertyTabsState().GroupObjectId;
        if (typeof fieldsGroup == "undefined") {
            groupObjectId = AppV.GetPropertyTabsState().GroupObjectId;
        } else {
            groupObjectId = Number(fieldsGroup.GetValue());
        }
        if (groupObjectId > 0) {
            window.PropertiesNotesCallBackPanel.PerformCallback({
                groupObjectId: groupObjectId
            });
        }
    };

    RzProperties.SetRightControlPanelVisibility = function (tabName, performCallback = false) {
        if (AppV.GetGlobals().ObjectType == enums.ObjectTypes.Processes) {
            if (window["PrecessInformationSections"] == null || window["PrecessInformationSections"] === undefined)
                return;
            var previewTabProcess = PrecessInformationSections.GetTabByName("Preview");
            if (tabName === "Properties" || tabName === "BOM" || tabName === "WhereUsed" || tabName === "RelatedFiles" || tabName === "ReferenceFiles" || tabName === "WhereUsed") {
                previewTabProcess.SetVisible(true);
            } else {
                previewTabProcess.SetVisible(false);
            }
        } else {
            if (window["PropertiesInformationSections"] == null || window["PropertiesInformationSections"] === undefined)
                return;
            var previewTab = PropertiesInformationSections.GetTabByName("Preview");
            var notesTab = PropertiesInformationSections.GetTabByName("Notes");
            if (tabName === "Properties") {
                previewTab.SetVisible(false);
                notesTab.SetVisible(true);
            } else if (tabName === "BOM") {
                previewTab.SetVisible(true);
                notesTab.SetVisible(true);
            } else if (tabName === "WhereUsed") {
                previewTab.SetVisible(true);
                notesTab.SetVisible(true);
            } else if (tabName === "RelatedFiles") {
                previewTab.SetVisible(true);
                notesTab.SetVisible(true);
                if (performCallback) {
                    RelatedFiles.OnDocumentPreviewRelatedFilesItemsClick();
                }
            } else if (tabName.startsWith('_SpecialObject')) {
                previewTab.SetVisible(false);
                notesTab.SetVisible(true);
            } else if (tabName == "ToDo") {
                previewTab.SetVisible(false);
                notesTab.SetVisible(true);
            } else if (tabName == "ReferenceFiles") {
                previewTab.SetVisible(true);
                notesTab.SetVisible(true);
            } else if (tabName == "Comments") {
                previewTab.SetVisible(false);
                notesTab.SetVisible(true);
            } else if (tabName == "SWConfigurations") {
                previewTab.SetVisible(false);
                notesTab.SetVisible(true);
            } else if (tabName == "WhereUsedAsField") {
                previewTab.SetVisible(false);
                notesTab.SetVisible(true);
            } else if (tabName.startsWith('_ReferencedField')) {
                previewTab.SetVisible(false);
                notesTab.SetVisible(true);
            } else if (tabName === "History") {
                previewTab.SetVisible(false);
                notesTab.SetVisible(true);
            }
        }
    };

    RzProperties.PageControlPanelTabChanged = function (s, e) {

        if (window["PropertiesInformationSections"] == null || window["PropertiesInformationSections"] === undefined || e === undefined || e === null)
            return;
        if (e.tab.name === "Notes") {
            PropertiesNoteTabClick();
        }
        else if (e.tab.name === "Preview") {
            RzProperties.SetRightControlPanelVisibility(PropertyCardSection.GetActiveTab().name, true);
        }
    };

    RzProperties.PaneResizeCompletedPropertiesRelatedItems = function () {
        var defaultH= 300;
        var ProcessItmes = document.getElementById("splProcessItmes_0i1");
        if (ProcessItmes !== null) {
            defaultH = (Number(ProcessItmes.style.height.replace("px", ""))) -50;
        }
        if (typeof ProcessRelatedItemGrid !== "undefined") {
            ProcessRelatedItemGrid.SetHeight(defaultH);
        }
        var defaultHP = 570;
        var properties = document.getElementById("splProcessItmes_0i0");
        if (properties != null) {
            defaultHP = (Number(properties.style.height.replace("px", ""))) - 82;
        }
        var els = document.getElementsByClassName("scrollableDivDocs"), i;
        for (i = 0; i < els.length; i++) {
            els[i].style.height = defaultHP +"px";
        }
    };
    RzProperties.TabClickPropertyCardSection = function (s, e) {
        RzProperties.SetRightControlPanelVisibility(e.tab.name);
        RzProperties.SetActivePropertyCardRibbonTab(e.tab.name);
    };
    RzProperties.ActiveTabChangedPropertyCardSection = function (s, e) {
        if (e.tab.name === "Properties") {
            RzProperties.CalculateHeightForProperties();
            if (AppV.GetGlobals().ObjectType ===enums.ObjectTypes.Processes) {
                RzProperties.PaneResizeCompletedPropertiesRelatedItems();
            }
        }
    };

    RzProperties.InitDocumentSection = function (s, e, conds) {
        try {

           // if (!AppV.GetGlobals().isMainWindow || FieldVaildation.newFrom) {
            
                if (FieldVaildation.AllConditionArray.length != 0)
                    FieldVaildation.performClearData();
                if (conds !== undefined) {
                    FieldVaildation.storeConditions(conds);
                }
          //  }
            RzProperties.CalculateHeightForProperties();
        }
        catch (err) {
            //Ignor error
        }
    };

    RzProperties.CalculateHeightForProperties = function () {
        try {
            var height = "570px";
            if (AppV.GetGlobals().isMainWindow && document.getElementById("DvpropertieFields") != null) {
                var propertyTabHeightMain = document.getElementById("PropertyCardGroup_WC") !== null ? document.getElementById("PropertyCardGroup_WC").offsetHeight : 28;
                height = Math.floor((document.getElementById("DvpropertieFields").offsetHeight -
                    propertyTabHeightMain) /
                    10) *
                    10 +
                    'px';
                var els = document.getElementsByClassName("scrollableDivDocs"), i;
                for (i = 0; i < els.length; i++) {
                    els[i].style.height = height;
                }
            } else if (!AppV.GetGlobals().isMainWindow) {
                var isProcess = false;
                var processBottomPanel = 0;
                if (typeof splFullScreenModePropertyCard !== "undefined") {
                    isProcess = (splFullScreenModePropertyCard.GetPaneByName("pnlRelatedItems") != null);
                    processBottomPanel = (isProcess) ? splFullScreenModePropertyCard.GetPaneByName("pnlRelatedItems").GetClientHeight() : 0;
                }
                var propertyTabHeight = document.getElementById("PropertyCardGroup_WC") !== null ? document.getElementById("PropertyCardGroup_WC").offsetHeight : 28;
                //if (propertyTabHeight == 0) propertyTabHeight = 28;
                var documentHeight = document.documentElement.clientHeight;
                var ribbonHeight =0;
                if (typeof ribbonPrpCard !== "undefined") {
                    ribbonHeight = ribbonPrpCard.GetHeight();
                }
                var FieldGroupHeight = document.getElementById("_FieldGroupComboH").offsetHeight;
                //if (FieldGroupHeight == 0) FieldGroupHeight = 34;
                var defaultrecordInfoHeight = 160;
                var recordInfoHeight = document.getElementById("_RecordInfoH") !== null ? document.getElementById("_RecordInfoH").offsetHeight : 0;
                if (recordInfoHeight > defaultrecordInfoHeight) recordInfoHeight = (defaultrecordInfoHeight-20);
                var paddingExtra = $(".scrollableDivDocs").height() - $(".dx-fieldset").height();
                paddingExtra = paddingExtra < 0 || !isProcess ? 0 : paddingExtra;
                var heightForPageControl = documentHeight - ribbonHeight - processBottomPanel - recordInfoHeight - propertyTabHeight - FieldGroupHeight - 30 - paddingExtra;
                //if (document.getElementById("splDocumentsProperties_0") != null) {
                // var heightForPageControl = document.getElementById("splDocumentsProperties_0").offsetHeight -
                //     document.getElementById("_FieldGroupComboH").offsetHeight -
                //     document.getElementById("_RecordInfoH").offsetHeight -
                //     document.getElementById("PropertyCardGroup_WC").offsetHeight;
                if (heightForPageControl != 0) {
                    if (AppV.GetGlobals().ObjectType === enums.ObjectTypes.Processes) {
                        height = ((Math.floor(heightForPageControl / 10) * 10) * 0.7) - 30 + 'px';
                    } else {
                        height = (Math.floor(heightForPageControl / 10) * 10) + 'px';
                    }
                }
                var els = document.getElementsByClassName("scrollableDivDocs"), i;
                for (i = 0; i < els.length; i++) {
                    els[i].style.height = height;
                }
                //document.getElementById("_FieldGroupComboH").scrollIntoView();
                //}
            }
        }
        catch (err) {
            //Ignor error
        }
    };

    RzProperties.CalculateHeightForBom = function () {

        if (typeof billOfMaterials != 'undefined') {
            var bView = billOfMaterials.checkActiveDisplay();
            if (bView != null) {
                var trueHeight = 0,
                    tabsHeight = 0;

                if (AppV.GetGlobals().isMainWindow) {
                    trueHeight = mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight;
                    tabsHeight = document.getElementById("PropertyCardSection_TC").clientHeight;
                } else {
                    trueHeight = splFullScreenModePropertyCard.GetPaneByName("pnlSections").lastHeight;
                }
                menuRibbonHeight = BomRibbon.GetHeight(),
                    BomTabsHeight = document.getElementById("BomConfigurationTabs_TC").clientHeight,
                    headerTreeHeight = window[bView].GetHeaderRow() ? window[bView].GetHeaderRow().clientHeight : window[bView + "_DXHeadersRow0"].clientHeight;
                var h = trueHeight - tabsHeight - menuRibbonHeight - BomTabsHeight - headerTreeHeight;
                window[bView].SetHeight(h);
                window[bView].AdjustControl();

                // window[bView].SetHeight(mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight -
                //     billOfMaterials.InitialHeight);
            }
        }
    };
    RzProperties.InitPropertyCardSectionBottom = function (s, e) {
        AppV.pushState('PropertyTabs', { ActiveTab: s.GetActiveTab().name });
    };
    RzProperties.CalculateHeightForSpecialObject = function () {
        var wobject = window["SpecialObjectsGrid" + AppV.GetPropertyTabsState().SpecialObject.GroupObjectId];
        if (typeof wobject != 'undefined') {
            //wobject.SetHeight($('#cbpSpecialObjects'+AppV.GetPropertyTabsState().SpecialObject.GroupObjectId).parent().height());
            if (AppV.GetGlobals().isMainWindow)
                wobject.SetHeight(mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight - document.getElementById("PropertyCardSection_TC").clientHeight - 20);
            else {
                var InstructionHe = 0;
                var element = document.getElementById("InstractionSO" + AppV.GetPropertyTabsState().SpecialObject.GroupObjectId);
                if (element != null) {
                    InstructionHe = element.clientHeight;
                }
                wobject.SetHeight(splFullScreenModePropertyCard.GetPaneByName("pnlSections").lastHeight - 20 - InstructionHe);
            }

        }
    };

    RzProperties.CalculateHeightForNotes = function () {
        if (AppV.GetGlobals().ObjectType === enums.ObjectTypes.Processes) {

            if (AppV.GetGlobals().isMainWindow) {
                $('#NoteItem').height(mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight - 70);
            }
            else {
                $('#NoteItem').height(splFullScreenModePropertyCard.GetPaneByName("pnlSections").lastHeight - 40);
            }

            return;
        }

        if (typeof NotesSplitter != 'undefined') {
            if (AppV.GetGlobals().isMainWindow) {
                NotesSplitter.SetHeight(mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight - 50);
            }
            else {
                NotesSplitter.SetHeight(splFullScreenModePropertyCard.GetPaneByName("pnlSections").lastHeight - 20);
            }

            RzNotes.Default.NotesPanelResize();
            RzNotes.Default.CommentContentInit();

        }

    };

    RzProperties.CalculateHeightForSubProcesses = function () {
        if (typeof SubProcessesTree != 'undefined')
            SubProcessesTree.SetHeight(mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight - 50);
    };


    RzProperties.CalculateHeightForToDo = function (modulName) {
        var name = "ToDoPropertyCardGrid" + modulName;
        if (typeof window[name] != 'undefined') {
            var height = 300;
            if (AppV.GetGlobals().isMainWindow) {
                height = (mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight -
                    document.getElementById("PropertyCardSection_TC").clientHeight -
                    parseInt(getComputedStyle(document.getElementById("PropertyCardSection_CC")).getPropertyValue('padding-bottom')) * 3);
                window[name].SetHeight(height);
            } else if (!AppV.GetGlobals().isMainWindow && modulName === enums.Modules.Planning) {
                height = mainProjectsSplFullScreenMode.GetPaneByName("mainProjectsSplPropertyPanel").lastHeight - 60;
                window[name].SetHeight(height);
            } else {
                height = (splFullScreenModePropertyCard.GetPaneByName("pnlSections").lastHeight
                    - parseInt(getComputedStyle(document.getElementById("PropertyCardSection_CC")).getPropertyValue('padding-bottom')) * 3);
                window[name].SetHeight(height);
            }
        }
    };

    RzProperties.CalculateHeightForEmail = function () {
        if (typeof EmailGrid != 'undefined') {
            var height = 300;
            if (AppV.GetGlobals().isMainWindow) {
                 height= (mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight -
                    document.getElementById("PropertyCardSection_TC").clientHeight -
                     parseInt(getComputedStyle(document.getElementById("PropertyCardSection_CC")).getPropertyValue('padding-bottom')) * 3);

                EmailGrid.SetHeight(height);
            } else {
                 height =  (splFullScreenModePropertyCard.GetPaneByName("pnlSections").lastHeight
                     - parseInt(getComputedStyle(document.getElementById("PropertyCardSection_CC")).getPropertyValue('padding-bottom')) * 3);
                EmailGrid.SetHeight(height);
            }
        }
    };
    RzProperties.CalculateHeightForNotifications = function (modulName) {
        var name = "NotificationsGrid" + modulName;
        if (typeof window[name] != 'undefined') {
            var height = 300;
            if (AppV.GetGlobals().isMainWindow) {
                height = (mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight -
                    document.getElementById("PropertyCardSection_TC").clientHeight -
                    parseInt(getComputedStyle(document.getElementById("PropertyCardSection_CC")).getPropertyValue('padding-bottom')) * 3);
                window[name].SetHeight(height);
            } else if (!AppV.GetGlobals().isMainWindow && modulName===enums.Modules.Planning){
                height = mainProjectsSplFullScreenMode.GetPaneByName("mainProjectsSplPropertyPanel").lastHeight - 50;
                window[name].SetHeight(height);
            } else {
                height = (splFullScreenModePropertyCard.GetPaneByName("pnlSections").lastHeight
                    - parseInt(getComputedStyle(document.getElementById("PropertyCardSection_CC")).getPropertyValue('padding-bottom')) * 3);
                window[name].SetHeight(height);
            }
        }
    };
    RzProperties.CalculateHeightForAudit = function () {
        if (typeof AuditTrialGrid != 'undefined') {
            var height = 300;
            if (AppV.GetGlobals().isMainWindow) {
                height = (mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight -
                    document.getElementById("PropertyCardSection_TC").clientHeight -
                    parseInt(getComputedStyle(document.getElementById("PropertyCardSection_CC")).getPropertyValue('padding-bottom')) * 3);
                AuditTrialGrid.SetHeight(height);
            } else {
                height = (splFullScreenModePropertyCard.GetPaneByName("pnlSections").lastHeight
                    - parseInt(getComputedStyle(document.getElementById("PropertyCardSection_CC")).getPropertyValue('padding-bottom')) * 3);
                AuditTrialGrid.SetHeight(height);
            }
        }
    };
    RzProperties.CalculateHeightForRelatedFiles = function () {
        if (typeof relatedFilesRecords != 'undefined') {
            var height = 300;
            if (AppV.GetGlobals().isMainWindow) {
                height = (mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight -
                    document.getElementById("PropertyCardSection_TC").clientHeight -
                    parseInt(getComputedStyle(document.getElementById("PropertyCardSection_CC")).getPropertyValue('padding-bottom')) * 3);
                relatedFilesRecords.SetHeight(height);
            } else {
                height = (splFullScreenModePropertyCard.GetPaneByName("pnlSections").lastHeight
                    - parseInt(getComputedStyle(document.getElementById("PropertyCardSection_CC")).getPropertyValue('padding-bottom')) * 3);
                relatedFilesRecords.SetHeight(height);
            }
        }
    };
    RzProperties.CalculateHeightForReferenceFiles = function () {
        if (typeof masterGridReferenceFiles != 'undefined')
            masterGridReferenceFiles.SetHeight(mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight - 100);
    };

    RzProperties.CalculateHeightForAffectedItems = function () {
        if (typeof ProcessRelatedItemGrid != 'undefined') {
            trueHeight = mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight;
            tabsHeight = document.getElementById("PropertyCardSection_TC").clientHeight;
            h = trueHeight - tabsHeight - ProcessRelatedItemRibbon.GetHeight() - 20;
            ProcessRelatedItemGrid.SetHeight(h);
        }
    };

    RzProperties.CalculateHeightForSWConfiguration = function () {
        if (typeof ConfigurationTree != 'undefined')
            ConfigurationTree.SetHeight(mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight - 50);
    };

    RzProperties.CalculateHeightForReferencedField = function () {
        var wobject = window["ReferencedFieldGrid" + AppV.GetPropertyTabsState().ReferencedField.ObjectFieldPropertyTabId];
        if (typeof wobject != 'undefined') {
            //wobject.SetHeight($('#cbpSpecialObjects'+AppV.GetPropertyTabsState().SpecialObject.GroupObjectId).parent().height());
            if (AppV.GetGlobals().isMainWindow)
                wobject.SetHeight(mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight - document.getElementById("PropertyCardSection_TC").clientHeight - 50);
            else {
                var InstructionHe = 0;
                var element = document.getElementById("InstractionSO" + AppV.GetPropertyTabsState().ReferencedField.ObjectFieldPropertyTabId);
                if (element != null) {
                    InstructionHe = element.clientHeight;
                }
                wobject.SetHeight(splFullScreenModePropertyCard.GetPaneByName("pnlSections").lastHeight - 50 - InstructionHe);
            }

        }
    };

    RzProperties.CalculateWhereUsedHeight = function () {
        if (typeof WhereUsedSection == "undefined")
            return;

        var whichTabAmI = WhereUsedSection.GetActiveTab().name;
        var _obj = {
            "BOM": {
                Grid: "whereUsedBomRecords",
                HeightCalculationFormula: function () {
                    var panel = document.getElementById("whereUsedBomMenuPanel");
                    var panelHeight = panel != null ? panel.clientHeight : 30;
                    if (AppV.GetGlobals().isMainWindow) {
                        return (mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight -
                            document.getElementById("PropertyCardSection_TC").clientHeight -
                            parseInt(getComputedStyle(document.getElementById("PropertyCardSection_CC")).getPropertyValue('padding-bottom')) * 3 -
                            panelHeight);

                    } else {
                        return (splFullScreenModePropertyCard.GetPaneByName("pnlSections").lastHeight
                            - parseInt(getComputedStyle(document.getElementById("PropertyCardSection_CC")).getPropertyValue('padding-bottom')) * 3 -
                            panelHeight);
                    }
                }
            },
            "Process": {
                Grid: "whereUsedProcessRecords",
                HeightCalculationFormula: function () {
                    if (AppV.GetGlobals().isMainWindow) {
                        return (mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight -
                            document.getElementById("PropertyCardSection_TC").clientHeight -
                            parseInt(getComputedStyle(document.getElementById("PropertyCardSection_CC")).getPropertyValue('padding-bottom')) * 3);
                    } else {
                        return (splFullScreenModePropertyCard.GetPaneByName("pnlSections").lastHeight
                            - parseInt(getComputedStyle(document.getElementById("PropertyCardSection_CC")).getPropertyValue('padding-bottom')) * 3);
                    }
                }
            },
            "Referenced": {
                Grid: "whereUsedReferencedRecords",
                HeightCalculationFormula: function () {
                    if (AppV.GetGlobals().isMainWindow) {
                        return (mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight -
                            document.getElementById("PropertyCardSection_TC").clientHeight -
                            parseInt(getComputedStyle(document.getElementById("PropertyCardSection_CC")).getPropertyValue('padding-bottom')) * 3);
                    } else {
                        return (splFullScreenModePropertyCard.GetPaneByName("pnlSections").lastHeight
                            - parseInt(getComputedStyle(document.getElementById("PropertyCardSection_CC")).getPropertyValue('padding-bottom')) * 3);
                    }
                }
            },
            "Projects": {
                Grid: "whereUsedProjects",
                HeightCalculationFormula: function () {
                    if (AppV.GetGlobals().isMainWindow) {
                        return (mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight -
                            document.getElementById("PropertyCardSection_TC").clientHeight -
                            parseInt(getComputedStyle(document.getElementById("PropertyCardSection_CC")).getPropertyValue('padding-bottom')) * 3);
                    } else {
                        return (splFullScreenModePropertyCard.GetPaneByName("pnlSections").lastHeight
                            - parseInt(getComputedStyle(document.getElementById("PropertyCardSection_CC")).getPropertyValue('padding-bottom')) * 3);
                    }
                }
            }
        }
        var _instance = _obj[whichTabAmI];
        window[_instance.Grid].SetHeight(_instance.HeightCalculationFormula());
    };


    RzProperties.CalculateHeightForWhereUsedAsField = function () {
        if (typeof WhereUsedAsFieldTree != 'undefined')
            WhereUsedAsFieldTree.SetHeight(mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight - 50);
    };

    RzProperties.CalculateHeightForHistoryDocument = function () {
        if (AppV.GetGlobals().isMainWindow) {
            if (typeof HistoryGrid != 'undefined') {
                var _h = mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight -
                    document.getElementById("PropertyCardSection_TC").clientHeight -
                    parseInt(getComputedStyle(document.getElementById("PropertyCardSection_CC")).getPropertyValue('padding-bottom')) * 2;
                HistoryGrid.SetHeight(_h);
            }
        } else {
            var _h = splFullScreenModePropertyCard.GetPaneByName("pnlSections").lastHeight
                - parseInt(getComputedStyle(document.getElementById("PropertyCardSection_CC")).getPropertyValue('padding-bottom')) * 2;
            HistoryGrid.SetHeight(_h);
        }
    };

    RzProperties.CalculateHeightForProjectDeliverables = function (modulName) {
        var name = "ProjectDeliverablesGrid" + modulName;
        if (typeof window[name] == 'undefined')
            name = "ProjectDeliverablesGrid";

        if (typeof window[name] != 'undefined') {
            var height = 300;
            if (AppV.GetGlobals().isMainWindow) {
                height = (mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight -
                    document.getElementById("PropertyCardSection_TC").clientHeight -
                    parseInt(getComputedStyle(document.getElementById("PropertyCardSection_CC")).getPropertyValue('padding-bottom')) * 3);
                window[name].SetHeight(height);
            } else if (!AppV.GetGlobals().isMainWindow && modulName === enums.Modules.Planning) {
                height = mainProjectsSplFullScreenMode.GetPaneByName("mainProjectsSplPropertyPanel").lastHeight - 50;
                window[name].SetHeight(height);
            } else {
                height = (splFullScreenModePropertyCard.GetPaneByName("pnlSections").lastHeight
                    - parseInt(getComputedStyle(document.getElementById("PropertyCardSection_CC")).getPropertyValue('padding-bottom')) * 3);
                window[name].SetHeight(height);
            }
        }
    };

    RzProperties.CalculateHeightForWorkflow = function () {
        if (AppV.GetGlobals().isMainWindow) {
            if (typeof StageInformationWorkflowSplitter != 'undefined') {
                var _h = mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight -
                    document.getElementById("PropertyCardSection_TC").clientHeight -
                    parseInt(getComputedStyle(document.getElementById("PropertyCardSection_CC")).getPropertyValue('padding-bottom')) * 2;
                StageInformationWorkflowSplitter.SetHeight(_h);
            }
        }
    };
    RzProperties.GetCHeightForGanttChart = function () {
        var _h = 320;
     
        if (AppV.GetGlobals().isMainWindow) {
            var propertyCardTC = 0;
            var propertyCardCC = 0;
            var isNotVisible = (document.getElementById("PropertyCardSection_TC") == 'undefined' || document.getElementById("PropertyCardSection_TC") == null);
            var isNotVisibleCC = (document.getElementById("PropertyCardSection_CC") == 'undefined' || document.getElementById("PropertyCardSection_CC") == null);
            if (!isNotVisible) propertyCardTC = document.getElementById("PropertyCardSection_TC").clientHeight;
            if (!isNotVisibleCC) propertyCardCC = parseInt(getComputedStyle(document.getElementById("PropertyCardSection_CC")).getPropertyValue('padding-bottom'));
            _h = mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight - propertyCardTC -  propertyCardCC * 2;
            return _h;
        } else {
            var themeH = 0;
            if (Helper.GetCookie("theme") === enums.Theme.MaterialCompact) themeH = 30;
            _h = document.body.clientHeight - (document.getElementById("ribbonPrpCard").clientHeight +
                (mainProjectsSplFullScreenMode.GetPaneByName("mainProjectsSplPropertyPanel").lastHeight - 50) + 90 + themeH);
            return _h;
        }
    }
    RzProperties.CalculateHeightForGanttChart = function () {
        var _h = RzProperties.GetCHeightForGanttChart();
        var Id = Planning.getGanttChartId();
        if (document.getElementById(Id) != null)
            document.getElementById(Id).style.height = _h + "px";
    };
    
    RzProperties.TabChangedPropertyCardSectionBottom = function (s, e) {
        var tabName = e.tab.name;
        RzProperties.PerformHeightChanges(tabName);
    };
    RzProperties.PerformHeightChanges = function (tabName) {
        var modulName = AppV.GetGlobals().ModuleName;
        if (tabName === "Properties") {
            RzProperties.InitDocumentSection();
        } else if (tabName === "BOM") {
            RzProperties.CalculateHeightForBom();
        } else if (tabName === "WhereUsed") {
            RzProperties.CalculateWhereUsedHeight();
        } else if (tabName.startsWith('_SpecialObject')) {
            RzProperties.CalculateHeightForSpecialObject();
        } else if (tabName == "ToDo") {
            RzProperties.CalculateHeightForToDo(""); //modulName
        } else if (tabName === "Emails") {
            RzProperties.CalculateHeightForEmail();
        } else if (tabName === "Notifications") {
            RzProperties.CalculateHeightForNotifications(modulName);
        } else if (tabName === "Audit" ) {
            RzProperties.CalculateHeightForAudit();
        } else if (tabName === "RelatedFiles") {
            RzProperties.CalculateHeightForRelatedFiles();
        } else if (tabName == "ReferenceFiles") {
            RzProperties.CalculateHeightForReferenceFiles();
        } else if (tabName == "Items") {
            RzProperties.CalculateHeightForAffectedItems();
        } else if (tabName == "Comments") {
            RzProperties.CalculateHeightForNotes();
        } else if (tabName == "SubProcesses") {
            RzProperties.CalculateHeightForSubProcesses();
        } else if (tabName == "SWConfigurations") {
            RzProperties.CalculateHeightForSWConfiguration();
        } else if (tabName == "WhereUsedAsField") {
            RzProperties.CalculateHeightForWhereUsedAsField();
        } else if (tabName.startsWith('_ReferencedField')) {
            RzProperties.CalculateHeightForReferencedField();
        } else if (tabName === "History") {
            RzProperties.CalculateHeightForHistoryDocument();
        } else if (tabName === "Chart") {
            RzProperties.CalculateHeightForWorkflow();
        } else if (tabName === "ProjectsDeliverables") {
            RzProperties.CalculateHeightForProjectDeliverables(modulName);
        } else if (tabName === "GanttChart") {
            RzProperties.CalculateHeightForGanttChart();
        }
        
    };
    RzProperties.TabClickPropertyCardSectionBottom = function (s, e) {
        var tabName = e.tab.name;
        AppV.pushState('PropertyTabs', { ActiveTab: tabName });
        var objId = AppV.GetGlobals().ObjectId;
        var recId = AppV.GetGlobals().RecordId;
        var recGuid = AppV.GetGlobals().RecordGuid;
        var objType = AppV.GetGlobals().ObjectType;

        if (tabName === "Properties" && !window.App.Global.BottomTabStates.Properties) {
            CpbRecordInfo.PerformCallback({
                objectId: objId,
                recordId: recId,
                isPrevieMode: AppV.GetGlobals().isMainWindow
            });
            window.App.Global.BottomTabStates.Properties = true;
            window.App.PropertyCard.Callback.Properties(objId, recId, true);

        } else if (tabName === "RelatedFiles" && !window.App.Global.BottomTabStates.ReleatedFiles) {
            window.App.Global.BottomTabStates.ReleatedFiles = true;
            window.App.PropertyCard.Callback.RelatedFilesPreview(objId, recId, recGuid, objType);

        } else if (tabName === "ReferenceFiles" && !window.App.Global.BottomTabStates.ReferenceFiles) {
            window.App.Global.BottomTabStates.ReferenceFiles = true;
            Request.loadBundle("ReferenceFiles");
            window.App.PropertyCard.Callback.ReferenceFilesPreview(objId, recId);

        } else if (tabName === "WhereUsed" && !window.App.Global.BottomTabStates.WhereUsed) {
            window.App.Global.BottomTabStates.WhereUsed = true;
            Request.loadBundle("WhereUsed");
            window.App.PropertyCard.Callback.WhereUsed(objId, recId, recGuid);

        } else if (tabName === "BOM" && !window.App.Global.BottomTabStates.BOM) {
            window.App.Global.BottomTabStates.BOM = true;
            Request.loadBundle("BOM");
            window.App.PropertyCard.Callback.BOM(objId, recId);
        } else if (tabName === "ToDo" && !window.App.Global.BottomTabStates.ToDo) {
            window.App.Global.BottomTabStates.ToDo = true;
            window.App.PropertyCard.Callback.ToDo(objId, recGuid);
        } else if (tabName === "Items" && !window.App.Global.BottomTabStates.Items) {
            window.App.Global.BottomTabStates.Items = true;
            window.App.PropertyCard.Callback.Items(objId, recGuid, recId);
        }
        else if (tabName === "Audit" && !window.App.Global.BottomTabStates.AuditTrail) {
            window.App.Global.BottomTabStates.AuditTrail = true;
            window.App.PropertyCard.Callback.AuditTrail(objId, recGuid, recId);
        }
        else if (tabName === "History" && !window.App.Global.BottomTabStates.History) {
            window.App.Global.BottomTabStates.History = true;
            if (AppV.GetGlobals().ObjectType == enums.ObjectTypes.Processes || AppV.GetGlobals().ObjectType == enums.ObjectTypes.CustomCases) {
                //Request.loadBundle("MindFusion");
                App.PropertyCard.Callback.PHistory(objId, recGuid);
            }
            else
                window.App.PropertyCard.Callback.History(objId, recId, recGuid, true);
        } else if (tabName.includes("_SpecialObject")) {
            updateSpecioObjectState(tabName);
            if (!window.PropertyCard.Global.TabStates.hasOwnProperty(AppV.GetPropertyTabsState().ActiveTab) && !window.PropertyCard.Global.TabStates[AppV.GetPropertyTabsState().ActiveTab]) {
                window.PropertyCard.Global.TabStates[AppV.GetPropertyTabsState().ActiveTab] = true;
                window.App.PropertyCard.Callback.SpecialObject(objId, recId);
            }

        }
        else if (tabName.includes("_ReferencedField")) {
            updateReferencedFieldState(tabName);
            if (!window.PropertyCard.Global.TabStates.hasOwnProperty(AppV.GetPropertyTabsState().ActiveTab) &&
                !window.PropertyCard.Global.TabStates[AppV.GetPropertyTabsState().ActiveTab]) {
                window.PropertyCard.Global.TabStates[AppV.GetPropertyTabsState().ActiveTab] = true;
                window.App.PropertyCard.Callback.ReferencedField(objId, recId);
            }

        }
        else if (tabName === "Comments" && !window.App.Global.BottomTabStates.Notes) {
            window.App.Global.BottomTabStates.Notes = true;

            window.App.PropertyCard.Callback.Notes(objId, recGuid, objType);
        }
        else if (tabName === "SubProcesses" && !window.App.Global.BottomTabStates.SubProcesses) {
            window.App.Global.BottomTabStates.SubProcesses = true;

            window.App.PropertyCard.Callback.SubProcesses(objId, recGuid);
        }
        else if (tabName === "SWConfigurations" && !window.App.Global.BottomTabStates.Configuration) {
            window.App.Global.BottomTabStates.Configuration = true;

            window.App.PropertyCard.Callback.Configuration(objId, recId);
        }
        else if (tabName === "WhereUsedAsField" && !window.App.Global.BottomTabStates.WhereUsedAsField) {
            window.App.Global.BottomTabStates.WhereUsedAsField = true;
            window.App.PropertyCard.Callback.WhereUsedAsField(objId, recId, recGuid);
        }
        else if (tabName === "Emails" && !window.App.Global.BottomTabStates.Emails) {
            window.App.Global.BottomTabStates.Emails = true;
            cpbSpliterCallback.PerformCallback({
                objectId: objId
            });
        }
        else if (tabName === "Notifications" && !window.App.Global.BottomTabStates.Notifications) {
            window.App.Global.BottomTabStates.Notifications = true;
            window["cbpNotifications" + AppV.GetGlobals().ModuleName].PerformCallback({
                objectId: objId,
                recordGuid: recGuid
            });
        }
        else if (tabName === "Chart" && !window.App.Global.BottomTabStates.Workflow) {
            window.App.Global.BottomTabStates.Workflow = true;
            MindFusionDiagram.init(null, null, null, 'diagramWorkflow');
        }
        else if (tabName === "GanttChart" && !window.App.Global.BottomTabStates.GanttChart) {
            window.App.Global.BottomTabStates.GanttChart = true;
            Planning.ProjectsPlanningPerformCallback(true);
        }
        else if (tabName === "ProjectsDeliverables" && !window.App.Global.BottomTabStates.ProjectDeliverables) {
            window.App.Global.BottomTabStates.ProjectDeliverables = true;
            window.App.PropertyCard.Callback.ProjectDeliverables(objId, recId, recGuid);
        }
    };
    
    RzProperties.InitPropertyCardSection = function (s, e, objId, recId, recGuid, subObjectGuid, objectType, webFormId) {
        var _index = PropertyCardSection.tabs.filter(function (x) { return x.name == "Properties" })[0];
        PropertyCardSection.SetActiveTab(_index);

        AppV.pushGlobalState({
            "ObjectId": objId,
            "RecordId": recId,
            "RecordGuid": recGuid || "",
            "SubObjectGuid": subObjectGuid || "",
            "ObjectType": enums.ObjectTypes[objectType],
            "webFormId": webFormId
        });
        window.PropertyCard.Global.ClearTabStates();
        if (enums.ObjectTypes.SpecialObject == enums.ObjectTypes[objectType])
            broadcastV.create({ endPoint: "SpecialObjectGrid" });

        var activeTabName = window.PropertyCardSection.GetActiveTab();
        RzProperties.SetActivePropertyCardRibbonTab(activeTabName.name);
    };


    PropertyCard.NewFromInit = function (s, e) {
        window.PropertyCard.Global.ActionToPerform = s.cpActionToPerform;
        if (AppV.GetGlobals().ObjectType === enums.ObjectTypes.SWPDM) {
            fieldsGroup.SetEnabled(false);
        }
    };

    PropertyCard.NewFromShow = function (s, e) {
        window.PropertyCard.Global.ClearTabStates();

        AppV.pushGlobalState("ObjectId", s.cpObjectId);

        AppV.pushGlobalState("RecordId", s.cpRecordId);

        AppV.pushGlobalState("RecordGuid", s.cpRecordGuid);

        AppV.pushGlobalState("SubObjectGuid", s.cpsubObjectGuid || "");
    };

    //Set the active ribbon tab on page control click
    RzProperties.SetActivePropertyCardRibbonTab = function (tabName) {
        AppV.pushState('PropertyTabs', { ActiveTab: tabName });
        window.ribbonPrpCard.SetContextTabCategoryVisible("Related Files", false);
        window.ribbonPrpCard.SetContextTabCategoryVisible("BOM", false);
        var itemPlanning = window.ribbonPrpCard.GetTabByName('Planning');
        if (itemPlanning !== null)
            itemPlanning.setVisible(false);
        window.ribbonPrpCard.SetContextTabCategoryVisible(window.SwResourceObject.SpecialObjects, false);

        var objId = AppV.GetGlobals().ObjectId;
        var recId = AppV.GetGlobals().RecordId;
        var recGuid = AppV.GetGlobals().RecordGuid;
        var objType = AppV.GetGlobals().ObjectType;

        if (tabName === "Properties") {        
            window.ribbonPrpCard.SetActiveTabIndex(0);
        } else if (tabName === "RelatedFiles") {
            window.ribbonPrpCard.SetContextTabCategoryVisible(window.SwResourceObject.RelatedFiles, true);

            var tabInfo = window.ribbonPrpCard.GetTabByName('RelatedFiles');

            window.ribbonPrpCard.SetActiveTabIndex(tabInfo.index);

            if (!window.PropertyCard.Global.TabStates.ReleatedFiles) {
                window.PropertyCard.Global.TabStates.ReleatedFiles = true;

                window.App.PropertyCard.Callback.RelatedFiles(objId, recId, recGuid, objType);
            }
        } else if (tabName === "ReferenceFiles") {
            //window.ribbonPrpCard.SetContextTabCategoryVisible("Related Files", true);
            window.ribbonPrpCard.SetActiveTabIndex(0);
            if (!window.PropertyCard.Global.TabStates.ReferenceFiles) {
                window.PropertyCard.Global.TabStates.ReferenceFiles = true;
                Request.loadBundle("ReferenceFiles");
                window.App.PropertyCard.Callback.ReferenceFiles(objId, recId);
            }
        } else if (tabName === "WhereUsed") {
            window.ribbonPrpCard.SetActiveTabIndex(0);
            if (!window.PropertyCard.Global.TabStates.WhereUsed) {
                window.PropertyCard.Global.TabStates.WhereUsed = true;
                Request.loadBundle("WhereUsed");
                window.App.PropertyCard.Callback.WhereUsed(objId, recId, recGuid);
            }
        } else if (tabName === "BOM") {
            window.ribbonPrpCard.SetContextTabCategoryVisible("BOM", true);
            var tabInfoBom = window.ribbonPrpCard.GetTabByName('BOM');
            window.ribbonPrpCard.SetActiveTabIndex(tabInfoBom.index);
            if (!window.PropertyCard.Global.TabStates.BOM) {
                Request.loadBundle("BOM");
                window.PropertyCard.Global.TabStates.BOM = true;
                window.App.PropertyCard.Callback.BOM(objId, recId);
            }
        } else if (tabName === "ToDo") {
            window.ribbonPrpCard.SetContextTabCategoryVisible("ToDo", true);
            window.ribbonPrpCard.SetActiveTabIndex(0);
            if (!window.PropertyCard.Global.TabStates.ToDo) {
                window.PropertyCard.Global.TabStates.ToDo = true;

                window.App.PropertyCard.Callback.ToDo(objId, recGuid);
            }
        } else if (tabName === "History") {
            window.ribbonPrpCard.SetActiveTabIndex(0);
            if (AppV.GetGlobals().ObjectType == enums.ObjectTypes.Processes || AppV.GetGlobals().ObjectType == enums.ObjectTypes.CustomCases) {
                //Request.loadBundle("MindFusion");
                App.PropertyCard.Callback.PHistory(objId, recGuid);
            }

            else
                window.App.PropertyCard.Callback.History(objId, recId, recGuid, false);
            // Here Changed//window.App.PropertyCard.Callback.History(objId, recId, recGuid, false);
        } else if (tabName.includes("_SpecialObject")) {
            updateSpecioObjectState(tabName);
            window.ribbonPrpCard.SetContextTabCategoryVisible(window.SwResourceObject.SpecialObjects, true);
            var tabInfoSo = window.ribbonPrpCard.GetTabByName('SpecialObjectsMenu');
            window.ribbonPrpCard.SetActiveTabIndex(tabInfoSo.index);
            SpecialObjects.SetEnableEditAll();
            var soName = "SpecialObjectsGrid" + AppV.GetPropertyTabsState().SpecialObject.GroupObjectId;
            if (!window.PropertyCard.Global.TabStates.hasOwnProperty(AppV.GetPropertyTabsState().ActiveTab)
                && !window.PropertyCard.Global.TabStates[AppV.GetPropertyTabsState().ActiveTab]
                || (typeof window[soName] == "undefined")) {
                window.PropertyCard.Global.TabStates[AppV.GetPropertyTabsState().ActiveTab] = true;
                window.App.PropertyCard.Callback.SpecialObject(objId, recId);
            }

        }
        else if (tabName.includes("_ReferencedField")) {
            updateReferencedFieldState(tabName);
            //window.ribbonPrpCard.SetContextTabCategoryVisible(window.SwResourceObject.SpecialObjects, true);
            //var tabInfoRf = window.ribbonPrpCard.GetTabByName('SpecialObjectsMenu');
            //window.ribbonPrpCard.SetActiveTabIndex(tabInfoRf.index);
            window.ribbonPrpCard.SetActiveTabIndex(0);

            var rFName = "ReferencedFieldGrid" + AppV.GetPropertyTabsState().ReferencedField.ObjectFieldPropertyTabId;

            if (!window.PropertyCard.Global.TabStates.hasOwnProperty(AppV.GetPropertyTabsState().ActiveTab)
                && !window.PropertyCard.Global.TabStates[AppV.GetPropertyTabsState().ActiveTab]
                || (typeof window[rFName] == "undefined")) {
                window.PropertyCard.Global.TabStates[AppV.GetPropertyTabsState().ActiveTab] = true;
                window.App.PropertyCard.Callback.ReferencedField(objId, recId);
            }

        }
        else if (tabName === "Comments") {
            window.ribbonPrpCard.SetActiveTabIndex(0);
            if (!window.PropertyCard.Global.TabStates.Notes) {
                window.PropertyCard.Global.TabStates.Notes = true;

                window.App.PropertyCard.Callback.Notes(objId, recGuid, objType);
            }
        }
        else if (tabName === "SubProcesses") {
            window.ribbonPrpCard.SetActiveTabIndex(0);
            if (!window.PropertyCard.Global.TabStates.SubProcesses) {
                window.PropertyCard.Global.TabStates.SubProcesses = true;

                window.App.PropertyCard.Callback.SubProcesses(objId, recGuid);
            }
        }
        else if (tabName === "SWConfigurations") {
            window.ribbonPrpCard.SetActiveTabIndex(0);
            if (!window.PropertyCard.Global.TabStates.Configuration) {
                window.PropertyCard.Global.TabStates.Configuration = true;

                window.App.PropertyCard.Callback.Configuration(objId, recId);
            }
        }
        else if (tabName === "WhereUsedAsField") {
            window.ribbonPrpCard.SetActiveTabIndex(0);
            if (!window.PropertyCard.Global.TabStates.WhereUsedAsField) {
                window.PropertyCard.Global.TabStates.WhereUsedAsField = true;

                window.App.PropertyCard.Callback.WhereUsedAsField(objId, recId, recGuid);
            }
        } else if (tabName === "GanttChart") {
            window.ribbonPrpCard.SetActiveTabIndex(0);
            // window.ribbonPrpCard.SetContextTabCategoryVisible(window.SwResourceObject.Planning, true);
            if (itemPlanning !== null) {
                itemPlanning.setVisible(true);
                window.ribbonPrpCard.SetActiveTabIndex(itemPlanning.index);
            }
            if (!window.PropertyCard.Global.TabStates.GanttChart) {
                Planning.PerformPlanningHeightChanges(tabName);
                window.PropertyCard.Global.TabStates.GanttChart = true;
                Planning.ProjectsPlanningPerformCallback(true);
                cbpBottomProjectsPlanning.PerformCallback({
                    id: AppV.GetGlobals().ObjectId
                });
            } else {
                if (window[Planning.getGanttChartId()] === undefined || window[Planning.getGanttChartId()] === null) {
                    Planning.PerformPlanningHeightChanges(tabName);
                    window.PropertyCard.Global.TabStates.GanttChart = true;
                    Planning.ProjectsPlanningPerformCallback(true);
                    cbpBottomProjectsPlanning.PerformCallback({
                        id: AppV.GetGlobals().ObjectId
                    });
                }
            }
           
        } else if (tabName === "ProjectsDeliverables") {
            window.ribbonPrpCard.SetActiveTabIndex(0);
            if (!window.PropertyCard.Global.TabStates.ProjectDeliverables) {
                window.PropertyCard.Global.TabStates.ProjectDeliverables = true;

                window.App.PropertyCard.Callback.ProjectDeliverables(objId, recId, recGuid);
            }
        }
        else if (tabName === "Notifications") {
            if (!window.PropertyCard.Global.TabStates.Notifications) {
                window.PropertyCard.Global.TabStates.Notifications = true;
                window["cbpNotifications" + AppV.GetGlobals().ModuleName].PerformCallback({
                    objectId: objId,
                    recordGuid: recGuid
                });
            }
        }
        else {
            window.ribbonPrpCard.SetActiveTabIndex(0);
        }

    };


    RzProperties.fieldGroupId;
    RzProperties.BeforeFieldGroupId;
    RzProperties.fieldsGroupIndexChange = function (s, e) {
        if (s.lastChangedValue != null) {
            RzProperties.BeforeFieldGroupId = s.lastChangedValue;
            RzProperties.fieldGroupId = s.GetValue();
            Helper.ShowConfirmPopUp("SolidWorks", SwResourceObject.AllExistingValuesWillBeCleared + " " + SwResourceObject.AreYouSure, "RzProperties.fieldsGroupIndexChangeAction()", "RzProperties.SetBeforeType()");
        } else {
            RzProperties.fieldsGroupIndexChangeAction(s);
        }
    };

    RzProperties.SetBeforeType = function () {
        if (RzProperties.BeforeFieldGroupId != undefined) {
            fieldsGroup.SetValue(RzProperties.BeforeFieldGroupId);
        }
    }

    RzProperties.fieldsGroupIndexChangeAction = function (s) {
        FieldVaildation.objectChanged = true;
        PropertyCard.LimitedList.DestoryStorage();
        var fieldGroupId;
        if (RzProperties.fieldGroupId === undefined)
            fieldGroupId = s.GetValue();
        else
            fieldGroupId = RzProperties.fieldGroupId;

        AppV.pushState('PropertyTabs', { GroupObjectId: fieldGroupId });
        var fieldName = "cbPropertiesTab";
        if (window.PropertyCard.Global.ActionToPerform === window.ActionToPerform.NewFrom) {
            fieldName += "NewFrom";
        }
        window[fieldName].PerformCallback({ getFields: true });
    }

    RzProperties.fieldsAccountTypeIndexChangeRegister = function (s, e) {
        FieldVaildation.objectChanged = true;

        $.ajax({
            type: "POST",
            url: '/Properties/GetExternalData/',
            data: {
                "objectId": Number(s.GetValue())
            },
            dataType: "json",
            success: function (response) {
                var url = RootUrl + 'Properties/Register/' + response.urlEncrypted;
                window.history.pushState({ urlPath: url }, null, url);
                AppV.pushGlobalState("ObjectId", response.objectId);
                window["cbpFieldGroupCombo"].PerformCallback({ objectId: response.objectId });
            }
        });
    };

    RzProperties.fieldsGroupEndCallbackRegister = function (s, e) {
        var accountType = accountTypeGroupRegister.GetValue();
        var fieldGroup = fieldsGroupRegister.GetValue();
        BtnRegister.SetVisible(true);
        if (accountType != null && fieldGroup != null) {
            window["cbPropertiesTab"].PerformCallback({ objectId: Number(accountType), groupObjIdSo: Number(fieldGroup), getFields: true });
        }
    };

    RzProperties.fieldsGroupIndexChangeRegister = function (s, e) {
        var accountType = accountTypeGroupRegister.GetValue();
        if (accountType != null) {
            window["cbPropertiesTab"].PerformCallback({ objectId: Number(accountType), groupObjIdSo: s.GetValue(), getFields: true });
        }
        else {
            Notification.SetNotification(Helper.T("PleaseSelectAccountType"), 'warning', 2500);
        }

    };

    RzProperties.SaveRegister = function (s, e) {
        AjaxStatus.FormSubmit(window.ActionToPerform.Save, Action.NewRegister);
    };


    
    RzProperties.DisplayContextMenuFromButton = function (s, e) {
        var tab = PropertyCardGroup.GetActiveTab();
        var index =1;
        if (tab != null) {
            index = tab.index;
        }
        var buttonName = "#PropertiesButtonContextMenu" + index;
        var offset = $(buttonName).offset();
        e.htmlEvent = { clientX: offset.left, clientY: offset.top };
        try {
            var x = ASPxClientUtils.GetEventX(e.htmlEvent);
            var y = ASPxClientUtils.GetEventY(e.htmlEvent);
            CtxMenuPropertyCard.ShowAtPos(x, y);
        } catch (e) {
            console.log(e);
        }
    };
    RzProperties.ContextMenuItemClick = function (s, e) {
        switch (e.item.name) {
            case "CtxReloadLinkedThirdParty":
                $.ajax({
                    type: "POST",
                    url: '/Properties/ReloadLinkedThirdParty/',
                    data: {
                        "objectId": AppV.GetGlobals().ObjectId,
                        "recordId":AppV.GetGlobals().RecordId
                    },
                    dataType: "json",
                    success: function (response) {
                        if (response.success) {
                            if (AppV.GetGlobals().isMainWindow) {
                                window.App.PropertyCard.Callback.Properties(AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordId, AppV.GetGlobals().isMainWindow);
                            } else {
                                cbPropertiesTab.PerformCallback({ getFields: true });
                            }
                        } else {
                            Notification.SetNotification(response.message, 'warning', 2500);
                        }
                    }
                });
                break;
            case "CtxPropertiesExpandAll":
                RzProperties.CtxPropertiesCollapseExpand(false);
                break;
            case "CtxPropertiesCollapseAll":
                RzProperties.CtxPropertiesCollapseExpand(true);
                break;
        }
    };
    RzProperties.CtxPropertiesCollapseExpand = function (expand) {
        var divC = document.getElementById('PropertyCardGroup');
        var divsC = divC.getElementsByClassName('dxrpCollapseButton');
        for (var i = 0; i < divsC.length; i++) {
            var foundC = divsC[i].id.includes("-");
            if (foundC) {
                if (typeof window[divsC[i].id] != "undefined") {
                    var idC = divsC[i].id.replace("_CB", "");
                    if (typeof window[idC] != "undefined") {
                        window[idC].SetCollapsed(expand);
                    }
                }
            }
        };
    };
    RzProperties.OnPropertyCardBeginCallback = function (s, e) {
        if (typeof fieldsGroup != 'undefined' && fieldsGroup.GetValue() != null) {
            e.customArgs["fieldGroupId"] = fieldsGroup.GetValue();
        }
    };

    RzProperties.cbPropertiesTabInit = function (s, e) {
        try {
            //RzProperties.InitDocumentSection();

            if (!s.cpIsPrevieMode) {
                if (s.cpActionToPerform !== ActionToPerform.NewFrom) {

                    if (s.cpIsEditMode) {
                        cbPropertiesTab.PerformCallback({ getFields: true });
                    } else {
                        if (fieldsGroup.GetValue() != null) {
                            cbPropertiesTab.PerformCallback({ getFields: true });
                        }
                    }

                } else {
                    cbPropertiesTabNewFrom.PerformCallback({ getFields: true });
                }
            }
            SetPropertyCardActiveTab();
        } catch (e) {

        } finally {
            window.Processes.State.StageId = s.cpStageId;
        }
    };

    function SetPropertyCardActiveTab() {
        if (typeof PropertyCardGroup !== 'undefined') {
            if (typeof PropertyCardGroup.tabs[0] !== 'undefined') {
                if (PropertyCardGroup.tabs[0].name == 'FileGroup')
                    PropertyCardGroup.SetActiveTab(PropertyCardGroup.tabs[1]);
                else {
                    PropertyCardGroup.SetActiveTab(PropertyCardGroup.tabs[0]);
                }

            }
        }
        App.Global.SplitterResize();
    }

    RzProperties.cbPropertiesTabEndCallback = function (s, e) {

        if (!s.cpIsPrevieMode) {
            if (s.cpActionToPerform !== ActionToPerform.NewFrom) {
                if (s.cpPageTitle !== null && s.cpActionToPerform !== enums.ActionToPerform.Planning) {
                    document.title = s.cpPageTitle;
                }
            }
        }

        window.Processes.State.StageId = s.cpStageId;
        if (s.cpActionToPerform === enums.ActionToPerform.Planning) {
            Planning.CalculatePropertiesSection();
            return;
        }
        if (s.cpActionToPerform == ActionToPerform.NewFrom) {
            cbPropertiesTabNewFrom.SetVisible(true);
        }
        if (document.activeElement != document.body) { setTimeout(function () { document.activeElement.blur(); }, 500); }
        SetPropertyCardActiveTab();

        if (!PropertyCard.Splitter.IsRightPanelOpen()) {
            if (typeof PrecessInformationSections !== "undefined") {
                Processes.PageControlPanelData(PrecessInformationSections.GetActiveTab().name);
            }
            RzProperties.PageControlPanelTabChanged();
        }
        if (AppV.GetGlobals().ObjectType === enums.ObjectTypes.Processes) {
            if (typeof ProcessRelatedItemGrid !== "undefined") {
                if (ProcessRelatedItemGrid.pageRowCount > 0) {
                    Processes.UpdateDescription();
                }
            }
        }
        if (localStorage.getItem("isNewWindowBom") !== null) {
            localStorage.removeItem("isNewWindowBom");
            var event = { tab: { name: "BOM" } };
            //TODO
        }
    };

    RzProperties.OnInitHyperLink = function (s, e) {
        FieldVaildation.InitValidation(s, e);
        s.GetInputElement().ondblclick = function () {
            var prefix = 'http://';
            var url = s.GetText();
            if (url.substr(0, prefix.length) !== prefix) {
                url = prefix + url;
            }
            Helper.open(url);
        };
    };

    RzProperties.ShowHideBiggerMemo = function (_id, toShow) {
        var _name = FieldVaildation.newFrom ? "showMemoBiggerNewFrom" + _id : "showMemoBigger" + _id;
        window[_name].SetVisible(toShow);
    }
    RzProperties.OpenMemoModal = function (s, e, _id, _sysName) {
        var _s = Helper.GetFieldName(_sysName, _id);
        _s = FieldVaildation.newFrom ? window[_s + "NewFrom"] : window[_s];
        var content = _s.GetHtml ? _s.GetHtml() : _s.GetText();
        View.load("HtmlEditorPopUpControl",
            {
                htmlContent: content,
                fieldName: Helper.locateTheLabelOfTheField(_s.name)
            });
    }
    RzProperties.FixModalHeight = function (s, e) {
        HtmlEditorContent.SetHeight($('#HtmlEditorPopUpControl_PWC-1').height() - 15);
    }

    RzProperties.cbpPropertyCardBottomSectionEndCallback = function () {

        if (typeof PropertyCardSection === "undefined") {
            return;
        }
        if (window.App.Global.ResetBottomTabIndex) {
            if (window.PropertyCardSection.GetTabByName("Properties") != null)
                window.PropertyCardSection.SetActiveTab(window.PropertyCardSection.GetTabByName("Properties"));

            window.App.Global.ResetBottomTabIndex = false;
        }

        var tabName = window.PropertyCardSection.GetActiveTab().name;

        var objId = AppV.GetGlobals().ObjectId;
        var recId = AppV.GetGlobals().RecordId;
        var recGuid = AppV.GetGlobals().RecordGuid;
        var objType = AppV.GetGlobals().ObjectType;
        
        if (tabName === "Properties") {

            window.App.Global.BottomTabStates.Properties = true;
            CpbRecordInfo.PerformCallback({
                objectId: objId,
                recordId: recId,
                isPrevieMode: AppV.GetGlobals().isMainWindow
            });
            window.App.PropertyCard.Callback.Properties(objId, recId, true);
        } else if (tabName === "RelatedFiles") {
            window.App.Global.BottomTabStates.ReleatedFiles = true;
            window.App.PropertyCard.Callback.RelatedFilesPreview(objId, recId, recGuid, objType);

        } else if (tabName === "WhereUsed") {
            window.App.Global.BottomTabStates.WhereUsed = true;
            Request.loadBundle("WhereUsed");
            window.App.PropertyCard.Callback.WhereUsed(objId, recId, recGuid);
        } else if (tabName === "BOM") {
            Request.loadBundle("BOM");
            window.App.Global.BottomTabStates.BOM = true;
            window.App.PropertyCard.Callback.BOM(objId, recId);
        } else if (tabName === "ToDo") {
            window.App.Global.BottomTabStates.ToDo = true;
            window.App.PropertyCard.Callback.ToDoPreview(objId, recGuid);
        } else if (tabName === "ReferenceFiles") {
            window.App.Global.BottomTabStates.ReferenceFiles = true;
            Request.loadBundle("ReferenceFiles");
            window.App.PropertyCard.Callback.ReferenceFilesPreview(objId, recId);
        } else if (tabName === "Items") {
            window.App.Global.BottomTabStates.Items = true;
            window.App.PropertyCard.Callback.Items(objId, recGuid, recId);
        }
        else if (tabName === "Audit" && !window.App.Global.BottomTabStates.AuditTrail) {
            window.App.Global.BottomTabStates.AuditTrail = true;
            window.App.PropertyCard.Callback.AuditTrail(objId, recGuid, recId);
        }
        else if (tabName === "History") {
            window.App.Global.BottomTabStates.History = true;
            if (AppV.GetGlobals().ObjectType == enums.ObjectTypes.Processes || AppV.GetGlobals().ObjectType == enums.ObjectTypes.CustomCases) {
                //Request.loadBundle("MindFusion");
                App.PropertyCard.Callback.PHistory(objId, recGuid);
            }
            else
                window.App.PropertyCard.Callback.History(objId, recId, recGuid, true);
            //Here Changed//window.App.PropertyCard.Callback.History(objId, recId, recGuid, false);
        } else if (tabName.includes("_SpecialObject")) {
            window.App.Global.BottomTabStates.SpecialObjects = true;
            window.App.PropertyCard.Callback.SpecialObject(objId, recId);
        }
        else if (tabName.includes("_ReferencedField")) {
            window.App.Global.BottomTabStates.ReferencedField = true;
            window.App.PropertyCard.Callback.ReferencedField(objId, recId);
        }
        else if (tabName === "Attachments") {

            window.App.Global.BottomTabStates.Attachments = true;
            window.App.PropertyCard.Callback.AttachmentsPreview(recId);
        }
        else if (tabName === "SubProcesses") {

            window.App.Global.BottomTabStates.SubProcesses = true;
            window.App.PropertyCard.Callback.SubProcesses(objId, recGuid);
        }
        else if (tabName === "SWConfigurations") {

            window.App.Global.BottomTabStates.Configuration = true;
            window.App.PropertyCard.Callback.Configuration(objId, recId);
        }
        else if (tabName === "Comments") {
            window.App.Global.BottomTabStates.Notes = true;
            window.App.PropertyCard.Callback.Notes(objId, recGuid, objType);
        }
        else if (tabName === "WhereUsedAsField") {
            window.App.Global.BottomTabStates.WhereUsedAsField = true;
            window.App.PropertyCard.Callback.WhereUsedAsField(objId, recId, recGuid);
        }
        else if (tabName === "Chart") {
            window.App.Global.BottomTabStates.Workflow = true;
            MindFusionDiagram.init(null, null, null, 'diagramWorkflow');
        }
        else if (tabName.includes("_ReferencedField")) {
            window.App.Global.BottomTabStates.ReferencedField = true;
            window.App.PropertyCard.Callback.ReferencedField(objId, recId);
        }
        else if (tabName === "ProjectsDeliverables") {
            window.App.Global.BottomTabStates.ProjectDeliverables = true;
            window.App.PropertyCard.Callback.ProjectDeliverables(objId, recId, recGuid);
        }
        else if (tabName === "Emails") {
            window.App.Global.BottomTabStates.Emails = true;
            cpbSpliterCallback.PerformCallback({
                objectId: objId
            });
        }
        else if (tabName === "Notifications") {
            window.App.Global.BottomTabStates.Notifications = true;
            window["cbpNotifications" + AppV.GetGlobals().ModuleName].PerformCallback({
                objectId: objId,
                recordGuid: recGuid
            });
        }
        else if (tabName === "GanttChart") {
            window.App.Global.BottomTabStates.GanttChart = true;
            Planning.ProjectsPlanningPerformCallback(true);
        }
        var menuPanel = window.mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel");
        menuPanel.Expand();


        window.App.Global.SplitterResize();
    };

    RzProperties.ShowUserDetails = function (s, e) {
        //window.UserDetailsPopUp.PerformCallback(
        //    {
        //        objectId: AppV.GetGlobals().ObjectId,
        //        recordGuid: AppV.GetGlobals().RecordGuid,
        //        userId: s.cpUserId
        //    });
        //window.UserDetailsPopUp.Show();
        View.load("UserDetailsPopUp",
            {
                objectId: AppV.GetGlobals().ObjectId,
                recordGuid: AppV.GetGlobals().RecordGuid,
                userId: s.cpUserId
            });
    };

    RzProperties.DataSourceGridViewBeginCallback = function (s, e) {
        e.customArgs["fieldId"] = s.cpFieldId;
        e.customArgs["systemName"] = s.cpSystemName;

    };

    RzProperties.DataSourceGridViewRowDblClick = function (s, e) {
        var name = s.name.replace("DsGridView", "");
        window[name].SetText(s.GetSelectedKeysOnPage());
        window[name].HideDropDown();
    };

    RzProperties.DataSourceGridViewInit = function (s, e) {
        Helper.ScrollOnlyElement(s.name);
    };

    RzProperties.DateFieldGotFocus = function (s, e) {
        Helper.Scroll('scrollableDivDocs', false);
        s.ShowDropDown();
    };

    RzProperties.DataSourceLostFocus = function (s, e, fieldName) {
        var gridName = fieldName + "DsGridView";
        var _key = window[gridName].GetSelectedKeysOnPage();
        var inputValue = window[fieldName].GetValue();

        if (_key != inputValue)
            window[fieldName].SetValue();
    };

    RzProperties.ListTextFieldGotFocus = function (s, e) {
        Helper.Scroll('scrollableDivDocs', false);
        s.ShowDropDown();
        Helper.ScrollOnlyDiv('dxpcDropDown');
    };

    RzProperties.ListNumberFieldGotFocus = function (s, e) {
        Helper.Scroll('scrollableDivDocs', false);
        s.ShowDropDown();
        Helper.ScrollOnlyDiv('dxpcDropDown');
    };


    RichMemo.onRichMemoFocused = function (s, e) {
        s.SetHeight(250);
        var currentToolbar = s.GetToolbarByName(s.name + "Toolbar");
        currentToolbar.SetVisible(true);
        window[s.name + "_isToolBarClicked"] = false;
    };

    RichMemo.onRichMemoNotFocused = function (s, e) {
        //if (window[s.name + "_Changing"] == true) {
            if (window[s.name + "_isToolBarClicked"] == false) {
                s.SetHeight(150);
                var currentToolbar = s.GetToolbarByName(s.name + "Toolbar");
                currentToolbar.SetVisible(false);
                window[s.name + "_Changing"] = false;
            }
            window[s.name + "_isToolBarClicked"] = false;
        //}
    };

    RichMemo.Init = function (s, e, conds) {
        s.SetHeight(150);
        s.cpConditionalFields = JSON.stringify(conds);
        var currentToolbar = s.GetToolbarByName(s.name + "Toolbar");
        currentToolbar.SetVisible(false);

        window[s.name + "_Changing"] = false;

        $('.toolbarMarker' + s.name).mousedown(function (event) {
            window[s.name + "_isToolBarClicked"] = true;
        });

    };

    RichMemo.onRichMemohtmlChanged = function (s,e) {
            window[s.name + "_Changing"] = true;
    };

    PropertyCard.OnImageUploadCompleted = function (s, e) {
        if (e.callbackData !== "")
            window.RecordInfoImageCallback.PerformCallback();
    };

    PropertyCard.OnImageUploadCbpInit = function (s, e) {
        if (document.getElementById('tabNameImageUpload').value == "")
            document.getElementById('tabNameImageUpload').value = window.Helper.TabName();
    };

    window.RichMemo = RichMemo;
    window.RzProperties = RzProperties;
})();
;
(function () {

    var ObjectTypeField = {};

    function internalObjectType() {
        return {
            objectTypeColumnId: -1,
            fieldObjectId: -1,
            allowMultipleItems: false,
            objectId: -1,
            selectedRecordGuid: [],
            idrecord: ""
        };
    }


    var privateObjectTypesState = {};


    window.publicObjectTypeState = {};

    function externalObjectType() {
        return {
            recordGuidlist: [],
            objectTypeFieldName: "",
            displayText: "",
            ObjectTypeCounter: -1,
            recordGuid: "",
            focusedIndex: -1
        };
    }


    window.ObjectTypeName = "";

    ObjectTypeField.InitializeObjectTypeStates = function () {
        var name = window.ObjectTypeName;

        if (!(window.ObjectTypeName in window.publicObjectTypeState)) {
            window.publicObjectTypeState[name] = externalObjectType();
        }
        if (!(window.ObjectTypeName in privateObjectTypesState)) {
            privateObjectTypesState[name] = internalObjectType();
        }
    }

    ObjectTypeField.onObjectTypeFieldInit = function (s, e, objectTypePopUpUsed) {

        FieldVaildation.InitValidation(s, e);
        if (s.cpIsEditMode == false && s.cpSelectedValues != "" && s.cpSelectedValues != "NULL,NULL") {

            //split list in objectId and recordId
            var arrayValues = s.cpSelectedValues ? s.cpSelectedValues.split(";") : [];
            var fieldObjectId = -1;
            var selectedRecordGuid = [];
            for (var i = 0; i < arrayValues.length; i++) {
                var array = arrayValues[i].split(",");
                fieldObjectId = array[0].trim();
                selectedRecordGuid.push(array[1].trim());
            }
            Request.ajax({
                type: "POST",
                url: '/Properties/SetDefaultValues/',
                data: {
                    ObjectId: fieldObjectId,
                    ColumnId: s.cpColumnId,
                    RecordGuidlist: selectedRecordGuid.toString(),
                    AllowMultipleItems: s.cpAllowMultipleItems,
                    objectTypePopUpUsed: objectTypePopUpUsed
                },
                dataType: "json"
            }).then(function (res) { })
                .then(function () { window.loadingPanel.Hide(); });


        }

    }

    ObjectTypeField.onObjectTypeFieldFocus = function (s, e, objectTypePopUpUsed) {
        var name = s.name;
        window.ObjectTypeName = name;

        var callbackObjectType = "pcModalObjectType" + objectTypePopUpUsed;
        ObjectTypeField.InitializeObjectTypeStates();

        privateObjectTypesState[name].allowMultipleItems = s.cpAllowMultipleItems;
        window.publicObjectTypeState[name].allowMultipleItems = s.cpAllowMultipleItems;
        window.publicObjectTypeState[name].ObjectTypeCounter++;
        privateObjectTypesState[name].ParentFieldSystemName = s.cpParentFieldSystemName;

        privateObjectTypesState[name].selectedRecordGuid = [];
        privateObjectTypesState[name].objectId = s.cpObjectId;
        if (publicObjectTypeState[name].ObjectTypeCounter > 0) {
            privateObjectTypesState[name].selectedRecordGuid = window.publicObjectTypeState[name].recordGuidlist;
        } else {
            privateObjectTypesState[name].objectTypeColumnId = s.cpColumnId;

            if (s.cpSelectedValues !== "" && typeof s.cpSelectedValues !== "undefined") {
                var arrayValues = s.cpSelectedValues ? s.cpSelectedValues.split(";") : [];

                for (var i = 0; i < arrayValues.length; i++) {
                    var array = arrayValues[i].split(",");
                    privateObjectTypesState[name].fieldObjectId = array[0].trim();
                    privateObjectTypesState[name].selectedRecordGuid.push(array[1].trim());
                }
                window.publicObjectTypeState[name].recordGuidlist = privateObjectTypesState[name].selectedRecordGuid;
            }

        }
        View.loadDynamic("ObjectType",
            {
                ObjectId: privateObjectTypesState[name].objectId,
                ColumnId: privateObjectTypesState[name].objectTypeColumnId,
                FieldName: window.publicObjectTypeState[name].objectTypeFieldName,
                objectTypePopUpUsed: objectTypePopUpUsed
            }, objectTypePopUpUsed);
        // window[callbackObjectType].PerformCallback();
        //window[callbackObjectType].Show();
    }



    window.mGObjType = {}
    ObjectTypeField.MainGridButtonClick = function (s, e, objectTypePopUpUsed) {
        window.mGObjType.name = s.name;
        window.mGObjType.objectTypePopUpUsed = objectTypePopUpUsed;
        window.mGObjType.ColumnId = s.cpColumnId;
        window.mGObjType.ObjectId = s.cpObjectId;
        window.mGObjType.AllowMultipleItems = s.cpAllowMultipleItems;
        window.mGObjType.SelectedValues = s.cpSelectedValues;
        window.mGObjType.SystemName = s.cpSystemName;
    }

    ObjectTypeField.onObjectTypeFieldFocusPreview = function (s, e, objectTypePopUpUsed, fromMainGrid = false) {

        if (s.Value == "-" || s.Value == "") {
            return;
        }

        if (fromMainGrid) {
            s.name = window.mGObjType.name;
            s.cpAllowMultipleItems = window.mGObjType.AllowMultipleItems;
            s.cpObjectId = window.mGObjType.ObjectId;
            s.cpColumnId = window.mGObjType.ColumnId;
            s.cpSelectedValues = window.mGObjType.SelectedValues;
            window.mGObjType = {};
        }

        var name = s.name;
        window.ObjectTypeName = name;
        //var callbackObjectTypePreview = "gridViewObjectTypePreview" + objectTypePopUpUsed;
        // var callbackObjectTypePreviewModal = "pcModalObjectTypePreview" + objectTypePopUpUsed;

        ObjectTypeField.InitializeObjectTypeStates();

        privateObjectTypesState[name].allowMultipleItems = s.cpAllowMultipleItems;
        window.publicObjectTypeState[name].allowMultipleItems = s.cpAllowMultipleItems;
        window.publicObjectTypeState[name].ObjectTypeCounter++;
        privateObjectTypesState[name].ParentFieldSystemName = s.cpParentFieldSystemName;
        privateObjectTypesState[name].selectedRecordGuid = [];
        privateObjectTypesState[name].objectId = s.cpObjectId;
        if (publicObjectTypeState[name].ObjectTypeCounter > 0) {
            privateObjectTypesState[name].selectedRecordGuid = window.publicObjectTypeState[name].recordGuidlist;
        } else {
            privateObjectTypesState[name].objectTypeColumnId = s.cpColumnId;

            if (s.cpSelectedValues !== "") {
                var values = s.cpSelectedValues;
                //split list in objectId and recordId
                var arrayValues = values.split(";");

                for (var i = 0; i < arrayValues.length; i++) {
                    var array = arrayValues[i].split(",");
                    privateObjectTypesState[name].fieldObjectId = array[0].trim();
                    privateObjectTypesState[name].selectedRecordGuid.push(array[1].trim());
                }
                window.publicObjectTypeState[name].recordGuidlist = privateObjectTypesState[name].selectedRecordGuid;
            }

        }
        if (privateObjectTypesState[name].selectedRecordGuid.length > 0) {
            if (privateObjectTypesState[name].selectedRecordGuid[0] !== 'NULL') {


                View.loadDynamic('ObjectTypePreview',
                    {
                        ObjectId: privateObjectTypesState[name].fieldObjectId,
                        ColumnId: privateObjectTypesState[name].objectTypeColumnId,
                        RecordGuidlist: privateObjectTypesState[name].selectedRecordGuid.toString(),
                        AllowMultipleItems: privateObjectTypesState[name].allowMultipleItems,
                        objectTypePopUpUsed: objectTypePopUpUsed
                    },
                    objectTypePopUpUsed);
                //  window[callbackObjectTypePreview].PerformCallback();
                //  window[callbackObjectTypePreviewModal].Show();
            }
        }
    }


    ObjectTypeField.OnStartCallbacModalObjectType = function (s, e, objectTypePopUpUsed) {
        var name = window.ObjectTypeName;
        e.customArgs["ObjectId"] = privateObjectTypesState[name].objectId;
        e.customArgs["GroupObjectId"] = AppV.GetPropertyTabsState().GroupObjectId;
        e.customArgs["RecordId"] = AppV.GetGlobals().RecordId;
        e.customArgs["ColumnId"] = privateObjectTypesState[name].objectTypeColumnId;
        e.customArgs["FieldName"] = window.publicObjectTypeState[name].objectTypeFieldName;
        e.customArgs["objectTypePopUpUsed"] = objectTypePopUpUsed;
    }

    ObjectTypeField.OnStartCallbacModalObjectTypePreview = function (s, e, objectTypePopUpUsed) {
        var name = window.ObjectTypeName;
        e.customArgs["ObjectId"] = privateObjectTypesState[name].fieldObjectId;
        e.customArgs["GroupObjectId"] = AppV.GetPropertyTabsState().GroupObjectId;
        e.customArgs["RecordId"] = AppV.GetGlobals().RecordId;
        e.customArgs["ColumnId"] = privateObjectTypesState[name].objectTypeColumnId;
        e.customArgs["RecordGuidlist"] = privateObjectTypesState[name].selectedRecordGuid.toString();
        e.customArgs["AllowMultipleItems"] = privateObjectTypesState[name].allowMultipleItems;
        e.customArgs["objectTypePopUpUsed"] = objectTypePopUpUsed;
    }


    ObjectTypeField.cmbObjectTypeOnInit = function (s, e, selectedObjectId, objectTypePopUpUsed) {
        var name = window.ObjectTypeName;
        var callbackObjectTypeGrid = "gridViewObjectType" + objectTypePopUpUsed;
        var callbackObjectcmbSelect = "cmbSelectTypeObject" + objectTypePopUpUsed;
        //if (s.cpObjectId !== 0 &&
        //    privateObjectTypesState[name].fieldObjectId !== "NULL" &&
        //    privateObjectTypesState[name].fieldObjectId !== -1) {
        //    privateObjectTypesState[name].objectId = s.cpObjectId;

        //    window.cmbSelectTypeObject.SetSelectedItem(
        //        window.cmbSelectTypeObject.FindItemByValue(privateObjectTypesState[name].fieldObjectId));


        //    window.gridViewObjectType.PerformCallback();
        //} else 
        if (selectedObjectId !== -1) {
            window[callbackObjectcmbSelect].SetSelectedItem(window[callbackObjectcmbSelect].FindItemByValue(selectedObjectId));
            privateObjectTypesState[name].fieldObjectId = selectedObjectId;
            window[callbackObjectTypeGrid].PerformCallback();

        } else if (name !== "") {

            window[callbackObjectcmbSelect].SetSelectedItem(window[callbackObjectcmbSelect].GetItem(0));
            privateObjectTypesState[name].fieldObjectId = window[callbackObjectcmbSelect].GetValue();
            window[callbackObjectTypeGrid].PerformCallback();
        }

    }

    ObjectTypeField.cmbSelectTypeObjectIndexChange = function (s, e, objectTypePopUpUsed) {
        var name = window.ObjectTypeName;
        var callbackObjectTypeGrid = "gridViewObjectType" + objectTypePopUpUsed;
        ObjectTypeField.InitializeObjectTypeStates();

        privateObjectTypesState[name].fieldObjectId = s.GetValue();
        privateObjectTypesState[name].objectId = s.cpObjectId;
        window[callbackObjectTypeGrid].PerformCallback();
    }
    ObjectTypeField.GetValueParentFieldSystemName = function () {
        var parentValue = "";
        try {
            var name = window.ObjectTypeName;
            var parentFieldSystemName = privateObjectTypesState[name].ParentFieldSystemName;
            if (Helper.IsNotEmpty(null, parentFieldSystemName)) {
                var parentFieldSystemNameElement = {};
                Object.keys(window).forEach(function (el) {
                    if (el.startsWith(parentFieldSystemName))
                        parentFieldSystemNameElement = window[el];
                });
                if (Object.getOwnPropertyNames(parentFieldSystemNameElement).length > 0) {
                    if (typeof window[parentFieldSystemNameElement.name] != "undefined") {
                        return window[parentFieldSystemNameElement.name].GetValue();
                    }
                }
            }
            return parentValue;
        }
        catch (err) {
            return parentValue;
        }
    }

    ObjectTypeField.gridViewObjectTypeBeginCallback = function (s, e, objectTypePopUpUsed) {
        var name = window.ObjectTypeName;
        var btnObjectTypeSimpleSearch = "btnObjectTypeSimpleSearch" + objectTypePopUpUsed;
        var objectTypeSearchLimitRecords = "ObjectTypeSearchLimitRecords" + objectTypePopUpUsed;
        e.customArgs["ColumnId"] = privateObjectTypesState[name].objectTypeColumnId;
        e.customArgs["ObjectId"] = privateObjectTypesState[name].objectId;
        e.customArgs["GroupObjectId"] = AppV.GetPropertyTabsState().GroupObjectId;
        e.customArgs["RecordId"] = AppV.GetGlobals().RecordId;
        e.customArgs["AllowMultipleItems"] = privateObjectTypesState[name].allowMultipleItems;
        e.customArgs["objectTypePopUpUsed"] = objectTypePopUpUsed;
        e.customArgs["ParentFieldSystemName"] = ObjectTypeField.GetValueParentFieldSystemName();
        e.customArgs["simpleSearchFor"] = window[btnObjectTypeSimpleSearch].GetValue();
        e.customArgs["limitRecord"] = window[objectTypeSearchLimitRecords].GetValue();
        if (privateObjectTypesState[name].fieldObjectId !== "NULL")
            e.customArgs["FieldObjectid"] = privateObjectTypesState[name].fieldObjectId;

    }
    ObjectTypeField.trackingSelectedRows = [];
    ObjectTypeField.trackingSelectedRowsExecuted = false;

    ObjectTypeField.SelectionChanged = function (s, e, objectTypePopUpUsed) {
        var arr = ObjectTypeField.trackingSelectedRows[objectTypePopUpUsed];
        // if (typeof arr == "undefined")
        //     arr = ObjectTypeField.trackingSelectedRows[objectTypePopUpUsed] = [];

        if (!privateObjectTypesState[window.ObjectTypeName].allowMultipleItems)
            ObjectTypeField.trackingSelectedRows[objectTypePopUpUsed] = [];
        var _val = s.GetRowKey(e.visibleIndex);
        if (e.isSelected) {
            if (ObjectTypeField.trackingSelectedRows[objectTypePopUpUsed].indexOf(_val) === -1)
                ObjectTypeField.trackingSelectedRows[objectTypePopUpUsed].push(_val)
        } else {
            var index = ObjectTypeField.trackingSelectedRows[objectTypePopUpUsed].indexOf(_val);
            if (index > -1) {
                ObjectTypeField.trackingSelectedRows[objectTypePopUpUsed].splice(index, 1);
            }
        }
    }
    ObjectTypeField.UpdateCheckedValues = function (s, e, objectTypePopUpUsed) {
        if (!ObjectTypeField.trackingSelectedRowsExecuted) {
            s.SelectRowsByKey(ObjectTypeField.trackingSelectedRows[objectTypePopUpUsed], true);
            ObjectTypeField.trackingSelectedRowsExecuted = true;
        }
    }

    ObjectTypeField.gridViewObjectTypeInit = function (s, e, objectTypePopUpUsed) {
        ObjectTypeField.trackingSelectedRows[objectTypePopUpUsed] = [];
        var name = window.ObjectTypeName;
        var callbackObjectTypeGrid = "gridViewObjectType" + objectTypePopUpUsed;
        ObjectTypeField.InitializeObjectTypeStates();

        if (privateObjectTypesState[name].selectedRecordGuid.length > 0)
            if (privateObjectTypesState[name].selectedRecordGuid[0] !== "NULL") {
                window[callbackObjectTypeGrid].SelectRowsByKey(privateObjectTypesState[name].selectedRecordGuid);
                ObjectTypeField.trackingSelectedRows[objectTypePopUpUsed] = privateObjectTypesState[name].selectedRecordGuid;
            }

        if (window.publicObjectTypeState[name].focusedIndex !== -1) {
            window[callbackObjectTypeGrid].SetFocusedRowIndex(window.publicObjectTypeState[name].focusedIndex);
        }

    }

    ObjectTypeField.gridViewObjectTypeRowDblClick = function (s, e, objectTypePopUpUsed) {
        var name = window.ObjectTypeName;
        if (!privateObjectTypesState[name].allowMultipleItems) {
            ObjectTypeField.btnAddObjectTypeClick(s, e, objectTypePopUpUsed);
        }
    }


    ObjectTypeField.btnAddObjectTypeClick = function (s, e, objectTypePopUpUsed) {
        var name = window.ObjectTypeName;
        var callbackObjectTypeGrid = "gridViewObjectType" + objectTypePopUpUsed;
        var callbackObjectTypeModal = "pcModalObjectType" + objectTypePopUpUsed;
        ObjectTypeField.InitializeObjectTypeStates();

        if (privateObjectTypesState[name].fieldObjectId !== "NULL") {
            var keyGrid = -1;
            if (objectTypePopUpUsed == enums.ActionToPerform.GridInlineEdit) {
                if (typeof window[name] !== undefined) {
                    keyGrid = Number(Helper.GetGridFocusedRowKey(name, window[name].focusedRowIndex));
                }
            } else if (objectTypePopUpUsed == enums.ActionToPerform.BomInlineEdit) {
                if (typeof window[name] !== undefined) {
                    if (name.includes("Tree")) {
                        keyGrid = Number(window[name].GetFocusedNodeKey());
                    } else {
                        keyGrid = Number(Helper.GetGridFocusedRowKey(name, window[name].focusedRowIndex))
                    }
                }
            }

            window.publicObjectTypeState[name].recordGuidlist = [];
            window.publicObjectTypeState[name].displayText = "";
            window.publicObjectTypeState[name].recordGuidlist = ObjectTypeField.trackingSelectedRows[objectTypePopUpUsed];
            $.ajax({
                type: "POST",
                url: '/Properties/GetSelectedValues/',
                data: {
                    "RecordGuidlist": ObjectTypeField.trackingSelectedRows[objectTypePopUpUsed].toString(),
                    "ObjectId": privateObjectTypesState[name].fieldObjectId,
                    "ColumnId": privateObjectTypesState[name].objectTypeColumnId,
                    "AllowMultipleItems": privateObjectTypesState[name].allowMultipleItems,
                    "objectTypePopUpUsed": objectTypePopUpUsed,
                    "keyGrid": keyGrid
                },
                dataType: "json",
                success: function (response) {
                    if (objectTypePopUpUsed == enums.ActionToPerform.GridInlineEdit) {
                        GridInlineEditor.SetInlineGridDataCell(response.toString());
                    } else if (objectTypePopUpUsed == enums.ActionToPerform.BomInlineEdit) {
                        GridInlineEditor.SetInlineGridDataCell(response.toString());
                    }
                    else {
                        if (typeof window[name].cpDisplayAsMemo != "undefined") {
                            if (window[name].cpDisplayAsMemo == true) {
                                window[name].SetHtml(response.toString());
                                window[name].Validate();
                            }
                        } else {
                            window[name].SetValue(response.toString());
                            window[name].Validate();
                        }
                    }
                }
            });

            // window[callbackObjectTypeGrid].GetSelectedFieldValues(
            //     "RecordGuid",
            //     function (result) {

            //         });
            //     });


            privateObjectTypesState[name].selectedRecordGuid = window.publicObjectTypeState[name].recordGuidlist;
        }

        window[callbackObjectTypeModal].Hide();
    }

    ObjectTypeField.ClearServerCache = function () {

        privateObjectTypesState = {};
        window.publicObjectTypeState = {};

        $.ajax({
            type: "POST",
            url: '/Properties/ClearObjecTypeCache/'
        });
    }

    ObjectTypeField.btnClearValuesObjectTypeClick = function (s, e, objectTypePopUpUsed) {
        var name = window.ObjectTypeName;
        var callbackObjectTypeGrid = "gridViewObjectType" + objectTypePopUpUsed;
        var callbackObjectTypeModal = "pcModalObjectType" + objectTypePopUpUsed;
        ObjectTypeField.InitializeObjectTypeStates();

        privateObjectTypesState[name].fieldObjectId = "NULL";
        window.publicObjectTypeState[name].recordGuidlist = [];
        window.publicObjectTypeState[name].focusedIndex = -1;

        privateObjectTypesState[name].objectId = -1;


        if (typeof window[name].cpDisplayAsMemo != "undefined") {
            if (window[name].cpDisplayAsMemo == true) {
                window[name].SetHtml();
            }
        } else {
            window[name].SetValue("");
        }
        
        window[name].Validate();

        window[callbackObjectTypeGrid].UnselectRows();

        var keyGrid = -1;
        if (objectTypePopUpUsed == enums.ActionToPerform.GridInlineEdit) {
            if (typeof window[name] !== undefined) {
                keyGrid = Number(Helper.GetGridFocusedRowKey(name, window[name].focusedRowIndex));
            }
        }
        $.ajax({
            type: "POST",
            url: '/Properties/ClearSpecificObjecTypeCache/',
            data: {
                "ColumnId": privateObjectTypesState[name].objectTypeColumnId,
                "keyGrid": keyGrid,
                "objectTypePopUpUsed": objectTypePopUpUsed
            },
            dataType: "json",
            success: function (response) {
                window[callbackObjectTypeModal].Hide();
            }
        });

    }
    ObjectTypeField.btnAddNewObjectTypeClick = function (s, e, actionToPerform) {
        var name = window.ObjectTypeName;

        if (privateObjectTypesState[name].fieldObjectId !== -1 && privateObjectTypesState[name].fieldObjectId !== "NULL") {
            var callbackObjectTypeGrid = "gridViewObjectType" + actionToPerform;
            // broadcastV.create({ endPoint: "ObjectTypeGridCallback", callbackObjectTypeGrid });
            Helper.open('/PropertyCard/AddNew/' + privateObjectTypesState[name].fieldObjectId, '_blank');
        } else {

            Notification.SetNotification(window.SwResourceObject.PleaseSelectType, 'warning', 3500);
        }
    }

    ObjectTypeField.gridViewObjectTypePreviewRowDblClick = function (s, e, objectTypePopUpUsed) {
        var callbackObjectTypeGridPreview = "gridViewObjectTypePreview" + objectTypePopUpUsed;
        window[callbackObjectTypeGridPreview].GetRowValues(
            e.visibleIndex,
            "RecordGuid;IdRecord",
            function (result) {
                callbackDoubleClick(result[1], result[0]);
            });
    }

    ObjectTypeField.gridViewObjectTypePreviewInit = function (s, e, objectTypePopUpUsed) {
        var callbackObjectTypeGridPreview = "gridViewObjectTypePreview" + objectTypePopUpUsed;
        var callbackObjectTypePreviewModal = "pcModalObjectTypePreview" + objectTypePopUpUsed;
        if (window[callbackObjectTypeGridPreview].GetVisibleRowsOnPage() == 1) {
            //perform double click automatically
            setTimeout(function () {
                window[callbackObjectTypePreviewModal].Hide();
            }, 500);
            window[callbackObjectTypeGridPreview].GetRowValues( 0,  "RecordGuid;IdRecord", function (result) {
                    callbackDoubleClick(result[1], result[0]);
            });
        }
    }
   
    
    function callbackDoubleClick(recordId, recordGuid) {
        var name = window.ObjectTypeName;

        if (privateObjectTypesState[name].fieldObjectId == "81") {

            //window.UserDetailsPopUp.PerformCallback(
            //    {
            //        objectId: privateObjectTypesState[name].fieldObjectId,
            //        recordGuid: recordGuid,
            //        userId: -1
            //    });
            //window.UserDetailsPopUp.Show();
            View.load("UserDetailsPopUp",
                {
                    objectId: privateObjectTypesState[name].fieldObjectId,
                    recordGuid: recordGuid,
                    userId: -1
                });
        } else {

            $.ajax({
                type: "POST",
                url: '/UrlDecrypt/GetEncryptedUrl/',
                data: {
                    "objectId": privateObjectTypesState[name].fieldObjectId,
                    "idRecord": recordId,
                    "recordGuid": recordGuid,
                    "subObjectGuid": AppV.GetGlobals().SubObjectGuid
                },
                dataType: "json",
                success: function (response) {
                    Helper.open('/PropertyCard/Index/' + response, '_blank');
                }
            });
        }
    }

    ObjectTypeField.btnCloseObjectType = function (s, e, objectTypePopUpUsed) {
        var callbackObjectTypeModal = "pcModalObjectType" + objectTypePopUpUsed;
        window[callbackObjectTypeModal].Hide();
    }


    ObjectTypeField.OnbtnObjectTypeSimpleSearchClick = function (s, e, objectTypePopUpUsed) {
        ObjectTypeField.trackingSelectedRowsExecuted = false;
        var callbackObjectTypeGrid = "gridViewObjectType" + objectTypePopUpUsed;
        var btnObjectTypeSimpleSearch = "btnObjectTypeSimpleSearch" + objectTypePopUpUsed;
        var cmbObjectType = "cmbSelectTypeObject" + objectTypePopUpUsed;
        var cmbSelectTypeObject = window[cmbObjectType].GetValue();
        if (e.buttonIndex === 0) {
            if (cmbSelectTypeObject !== null) {
                window[callbackObjectTypeGrid].PerformCallback();
            }
            else {
                Notification.SetNotification(window.SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            }
        } else {
            if (cmbSelectTypeObject !== null) {
                window[btnObjectTypeSimpleSearch].SetValue('');
                window[callbackObjectTypeGrid].PerformCallback();
            }
            else {
                window[btnObjectTypeSimpleSearch].SetValue('');
            }
        }
    }
    ObjectTypeField.KeyPressObjectTypeSimpleSearch = function (s, e, objectTypePopUpUsed) {
        var callbackObjectTypeGrid = "gridViewObjectType" + objectTypePopUpUsed;
        var cmbObjectType = "cmbSelectTypeObject" + objectTypePopUpUsed;
        var cmbSelectTypeObject = window[cmbObjectType].GetValue();
        if (cmbSelectTypeObject !== null) {
            if (e.htmlEvent.keyCode === 13) {
                ObjectTypeField.trackingSelectedRowsExecuted = false;
                window[callbackObjectTypeGrid].PerformCallback();
            }
        }
    }



    ObjectTypeField.GridBatchEditObjectType = function (s, objectId, columnId, fieldName, allowMultiple, objectTypePopUpUsed) {
        var name = s.name;
        window.ObjectTypeName = name;
        ObjectTypeField.InitializeObjectTypeStates();
        privateObjectTypesState[name].objectTypeColumnId = columnId;
        privateObjectTypesState[name].objectId = objectId
        privateObjectTypesState[name].allowMultipleItems = allowMultiple;
        View.loadDynamic("ObjectType", {
            ObjectId: objectId,
            ColumnId: columnId,
            FieldName: fieldName,
            objectTypePopUpUsed: objectTypePopUpUsed
        }, objectTypePopUpUsed);
    }

    var _heightDefault = 450; var _widthDefault = 600;
    ObjectTypeField.SetDefaultPosition = function (height, width) {
        _heightDefault = height;
        _widthDefault = width;
    };

    ObjectTypeField.AfterResizing = function (s, e, height, width, bottomSpace, grid, addBottomSpaceForMaterialTheme, panels, coef) {
        ObjectTypeField.SetDefaultPosition(height, width);
        var isMinimized = false;
        if (e.resizeState === 4) {
            ObjectTypeField.SetDefaultPosition(height, width);
            s.SetWidth(width);
            s.SetHeight(height);
            if (grid.name.includes("FilterEditTreelist")) {
                grid.SetWidth(width - 40);
                grid.SetHeight(300);
                isMinimized = true;
            }
            
        }else {
            if (s.GetWidth() >= _widthDefault && s.GetHeight() >= _heightDefault) {
                if (typeof e.resizeState == "undefined") {
                    s.isMaximized = false;
                    ObjectTypeField.SetDefaultPosition(_heightDefault, _widthDefault);
                } else {
                    ObjectTypeField.SetDefaultPosition(s.GetHeight(), s.GetWidth());
                }
            } else {
                ObjectTypeField.SetDefaultPosition(height, width);
            }
        }

        var theme = Helper.GetCookie("theme");
        if (theme == "MaterialCompact") {
            if (typeof coef != "undefined")
                coef = coef - 0.1;
        }

        if (typeof panels != "undefined") {
            if (panels.length > 0) {
                if (e.resizeState != 4)
                    ObjectTypeField.ResizeItems(panels, grid, _heightDefault, coef, _widthDefault);
                else
                    ObjectTypeField.ResizeItems(panels, grid, 937, 0.57, _widthDefault);
            }
        }

        if (addBottomSpaceForMaterialTheme) {
            if (theme == "MaterialCompact") {
                if (grid.name.includes("FilterEditTreelist")) {
                    _heightDefault = _heightDefault + 50;
                    bottomSpace = bottomSpace + 120;
                }
                bottomSpace = bottomSpace + 50;
            }
        }

        //var grid = ASPxClientControl.GetControlCollection().GetByName("gridViewObjectType" + actionToPerform);
        if (!isMinimized) {
            grid.SetWidth(_widthDefault - 40);
            grid.SetHeight(_heightDefault - bottomSpace);
        }
        s.SetWidth(_widthDefault);
        s.SetHeight(_heightDefault);

        s.UpdatePosition();
    };

    ObjectTypeField.ResizeItems = function (panels, grid, height, coef, width) {
        var popupName = "#_" + grid.name + " div";
        var contentData = document.querySelectorAll(popupName);
        var contentDataArr = [];
        for (var j = 0; j < panels.length; j++) {
            for (var i = 0; i < contentData.length; i++) {
                if (contentData[i].id.includes(panels[j])) {
                    contentDataArr.push(contentData[i]);
                }
            }
        }
        
        
        for (i = 0; i < contentDataArr.length; i++) {
            if (contentDataArr[i].clientHeight != 0) {
                contentDataArr[i].style.height = height * coef + "px";
            }

        }
    }
    //ObjectTypeField.AfterResizing = function (s, e, height, width, bottomSpace, grid) {
    //    ObjectTypeField.SetDefaultPosition(height, width);
    //    if (e.resizeState === 4) {
    //        ObjectTypeField.SetDefaultPosition(height, width);
    //        s.SetWidth(width);
    //        s.SetHeight(height);
    //    } else {
    //        if (s.GetWidth() >= _widthDefault && s.GetHeight() >= _heightDefault) {
    //            if (e.resizeState === 1 || e.resizeState === 2) {
    //                ObjectTypeField.SetDefaultPosition(_heightDefault, _widthDefault);
    //            } else {
    //                ObjectTypeField.SetDefaultPosition(s.GetHeight(), s.GetWidth());
    //            }
    //        } else {
    //            ObjectTypeField.SetDefaultPosition(height, width);
    //        }
    //    }
    //    //var grid = ASPxClientControl.GetControlCollection().GetByName("gridViewObjectType" + actionToPerform);
    //    grid.SetWidth(_widthDefault - 40);
    //    grid.SetHeight(_heightDefault - bottomSpace);
    //    s.SetWidth(_widthDefault);
    //    s.SetHeight(_heightDefault);

    //    s.UpdatePosition();
    //};

    

    window.ObjectTypeField = ObjectTypeField;

})();


;
(function () {

    var cascading = {};

    var selectedId = -1;
    window.cascfieldName = "";

    cascading.TextFieldGotFocus = function(s, e) {
        window.cascfieldName = s.name;
        View.load("ModalCascadingValues");
     //   window.pcModalCascadingValues.PerformCallback();
     //   window.pcModalCascadingValues.Show();
    };

    cascading.cmbCascadingOnInit = function(s, e) {
        selectedId = s.GetValue();
        window.CascadingTreelist.PerformCallback();
    };

    cascading.cmbSelectCascadingIndexChange = function(s, e) {
        cascading.cmbCascadingOnInit(s, e);
    };

    cascading.OnStartCallbacCascadingTreelist = function(s, e) {
        e.customArgs["casId"] = selectedId == null ? -1 : selectedId;
    };

    cascading.CascadingTreelistItemClick = function(s, e) {


        window.cbpCascadingTextField.PerformCallback({
            casId: window.cmbSelectCascading.GetValue(),
            nodeKey: e.nodeKey
        });

    };

    cascading.btnCopyToCellClick = function(s, e) {
        window[window.cascfieldName].SetValue(window.txtCascading.GetText());
        window.pcModalCascadingValues.Hide();
    };

    cascading.btnCopyToClipboardClick = function(s, e) {
        window.txtCascading.SelectAll();
        document.execCommand("Copy");
        window.pcModalCascadingValues.Hide();
    };


    cascading.cmbCascadingValuesCheckedChanged = function(s, e) {
        if (s.GetValue()) {
            window.CascadingTreelist.ExpandAll();
        } else {
            window.CascadingTreelist.CollapseAll();
        }
    };

    window.Cascading = cascading;
})();;

var DropDownEdit = (function () {

    //TODO get separator from args in Model
    var textSeparator = ",";

    function FindFieldName(ctrlname, prefix) {
        return ctrlname.replace("checkListBox", "");
    }
    function ControlName(fieldName) {
        return fieldName.concat("checkListBox");
    }


    function UpdateSelectAllItemState(checkListBox) {
        IsAllSelected(checkListBox) ? window[checkListBox].SelectIndices([0]) : window[checkListBox].UnselectIndices([0]);
    }
    function IsAllSelected(ctrlName) {
        for (var i = 1; i < window[ctrlName].GetItemCount(); i++)
            if (!window[ctrlName].GetItem(i).selected)
                return false;
        return true;
    }

    function UpdateText(checkListBox) {
        var selectedItems = window[checkListBox].GetSelectedItems();

        var dropDown = FindFieldName(checkListBox);

        window[dropDown].SetText(GetSelectedItemsText(selectedItems));
    }


    function GetValuesByTexts(texts, checkListBox) {
        var actualValues = [];
        var item;
        for (var i = 0; i < texts.length; i++) {
            item = window[checkListBox].FindItemByText(texts[i].trim());//replace(/ /g, ''));
            if (item !== null)
                actualValues.push(item.value);
        }
        return actualValues;
    }

    function GetSelectedItemsText(items) {
        var texts = [];
        for (var i = 0; i < items.length; i++)
            if (items[i].index != 0)
                (items[i].text.trim() === "") ? texts.push(items[i].text) : texts.push(" " + items[i].text);

        return texts.join(textSeparator);
    }

    return {

        OnListBoxSelectionChanged: function (listBox, args) {
            var name = listBox.name;
            if (args.index == 0)
                args.isSelected ? listBox.SelectAll() : listBox.UnselectAll();
            UpdateSelectAllItemState(name);
            UpdateText(name);
        },
        SynchronizeListBoxValues: function (dropDown, args) {
            var checkListBox = ControlName(dropDown.name);
            window[checkListBox].UnselectAll();
            var texts = dropDown.GetText().split(textSeparator);
            var values = GetValuesByTexts(texts, checkListBox);
            values.forEach(function (value) {
                if (typeof value != 'number') {
                    if (value.trim() === "") {
                        var item = window[checkListBox].FindItemByText(value);
                        window[checkListBox].SetSelectedIndex(item.index);
                    }
                }
            });
            window[checkListBox].SelectValues(values);
            UpdateSelectAllItemState(checkListBox);
            UpdateText(checkListBox); // for remove non-existing texts
        },

        ManualEntryTextChanged: function (dropDown, args) {
            if(dropDown.cpAllowManualEntry){
                return;
            }
            SynchronizeListBoxValues(dropDown,args)
        },

        SynchronizeListBoxValuesOnInit: function (dropDown, args) {
            var checkListBox = ControlName(dropDown.name);
            if(window[checkListBox].GetValue() == null)
                DropDownEdit.SynchronizeListBoxValues(dropDown);
            else
                UpdateText(checkListBox);
        },
        ControlName,
        GetValuesByTexts


    }

})();






;
(function () {

    var processes = {};
    processes.State = {
        isSendToNextStage: false,
        urlNavigate: "",
        ObjectId: -1,
        RecordId: -1,
        RecordGuid: "",
        selectedObjectId: -1,
        StageId: -1,
        NextStageId: -1,
        reload: false,
        actionName: "Save",
        tmpRecordGuid: ""
    };


    processes.AddReleatedItemToProcess = function (s, e) {
        processes.State.ObjectId = AppV.GetGlobals().ObjectId;
        processes.State.RecordGuid = AppV.GetGlobals().RecordGuid;

        View.load('pcModalAddReleatedItem',
            {
                objectId: processes.State.ObjectId,
                recordGuid: processes.State.RecordGuid
            });
    };

    processes.cmbSelectTypeObjectIndexChange = function (s, e) {

        processes.State.selectedObjectId = window.cmbSelectObject.GetValue();

        window.gridProcessViewReleatedItms.PerformCallback({
            objectId: processes.State.ObjectId,
            recordGuid: processes.State.RecordGuid,
            selectedObjectId: processes.State.selectedObjectId
        });
    };

    processes.gridViewProcessesReleatedItemBeginCallback = function (s, e) {
        e.customArgs["objectId"] = processes.State.ObjectId;
        e.customArgs["recordGuid"] = processes.State.RecordGuid;
        e.customArgs["selectedObjectId"] = processes.State.selectedObjectId;
        e.customArgs["simpleSearchFor"] = window.btnRelatedItemsSimpleSearch.GetValue();
        e.customArgs["limitRecord"] = window.AddRelatedItemsSearchLimitRecords.GetValue();

        switch (e.command) {
            case "PAGERONCLICK":
            case "APPLYCOLUMNFILTER":
            case "APPLYFILTER":
            case "APPLYHEADERCOLUMNFILTER":
            case "NEXTPAGE":
            case "SORT":
                e.customArgs["reloadGrid"] = false;
                break;
            default:
                e.customArgs["reloadGrid"] = true;
                break;
        }
    };

    processes.StageNotesInit = function (s, e) {
        document.getElementById(s.globalName).style.border = "thin";
        s.SetHeight(document.documentElement.clientHeight * 0.8);
    };
    processes.ProcessRelatedItemGridBeginCallback = function (s, e) {
        if (localStorage.getItem("MainGridTabName") !== null) {
            e.customArgs["mainGridTabName"] = localStorage.getItem("MainGridTabName");
            localStorage.removeItem("MainGridTabName");
        }
        e.customArgs["objectId"] = AppV.GetGlobals().ObjectId;
        e.customArgs["recordGuid"] = AppV.GetGlobals().RecordGuid;
        e.customArgs["reloadGrid"] = processes.State.reload;
        e.customArgs["idRecord"] = AppV.GetGlobals().RecordId;
        e.customArgs["showAll"] = window.cmbShowAllProcessItems.GetChecked();
        e.customArgs["actionName"] = Processes.State.actionName;
    };
    processes.UpdateDescription = function () {
        var docInfo = ProcessRelatedItemGrid.cpOriginObjectDisplayName;//document.getElementById("objectHeaderInformation").value;
        var descriptionElement = {};
        var itemsDescp = ProcessRelatedItemGrid.cpfullDescption;
        if (itemsDescp != "") {
            Object.keys(window).forEach(function (el) {
                if (el.startsWith("_System_objDescription"))
                    descriptionElement = window[el];
            });
            if (Object.getOwnPropertyNames(descriptionElement).length > 0) {
                if (descriptionElement.GetText() == "") {
                    var maxChar = descriptionElement.GetInputMaxLength();
                    if (itemsDescp.length > maxChar) {
                        var docInfoLength = 0;
                        if (docInfo != null) docInfoLength = docInfo.length;
                        itemsDescp = itemsDescp.substring(0, maxChar - docInfoLength - 3);
                    }
                    if (docInfo === null || docInfo === "") {
                        descriptionElement.SetText(itemsDescp);
                    } else {
                        descriptionElement.SetText(itemsDescp + " (" + docInfo + ")");
                    }
                    document.title = document.getElementById("objectHeaderInformation").value;
                }
            }
        }


    };
    processes.ProcessRelatedItemGridEndCallback = function (s, e) {
        processes.State.reload = false;
        var h = 200;
        if (!AppV.GetGlobals().isMainWindow) {
            h = (document.getElementById("PropertyCardSection_TC").clientHeight * 0.3) - 50;
            processes.UpdateDescription();
            RzProperties.PaneResizeCompletedPropertiesRelatedItems();
        } else {
            trueHeight = mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight;
            tabsHeight = document.getElementById("PropertyCardSection_TC").clientHeight;
            h = trueHeight - tabsHeight - ProcessRelatedItemRibbon.GetHeight() - 20;
            ProcessRelatedItemGrid.SetHeight(h);
        }
        if (!AppV.GetGlobals().isMainWindow)
            PrecessInformationSections.GetTabByName("StageNotes").SetEnabled(true);


        var hasItems = typeof ProcessRelatedItemGrid !="undefined"? ProcessRelatedItemGrid.GetVisibleRowsOnPage() == 0:true;
        if (GoToPropertiesProcessReleatedItem !="undefined") GoToPropertiesProcessReleatedItem.SetEnabled(!hasItems);  

        if (s.cpIsSaveInline) {
            Processes.State.tmpRecordGuid = s.cptmpRecordGuid;
            if (s.cpactionName == "SendToNextStage") {
                RZPropRibbon.Process.SendToNextStageOkClicked(AppV.GetGlobals().RecordId);
            } else {
                RZPropRibbon.Process.SaveProcessData();
            }
        }

        window.Processes.State.actionName = "Save";
        Processes.State.tmpRecordGuid = "";
    };

    processes.ProcessRelatedItemCbPCallback = function (reloadGrid = false, showAll = false) {
        if (typeof cmbShowAllProcessItems !== "undefined") {
            showAll = window.cmbShowAllProcessItems.GetChecked();
        }
        window.ProcessRelatedItemGridcbPanel.PerformCallback({
            objectId: AppV.GetGlobals().ObjectId,
            recordGuid: AppV.GetGlobals().RecordGuid,
            idRecord: AppV.GetGlobals().RecordId,
            reloadGrid: reloadGrid,
            showAll: showAll
        });
    };

    processes.ProcessRelatedItemGridInit = function (s, e, objectId, recordGuid, recordId) {
        window.PropertyCard.Splitter.Resize(s, e);
        if ((localStorage.getItem("MainGridTabName") !== null) || AppV.GetGlobals().isMainWindow == false) {
            processes.State.reload = true;
            var showAll = (typeof cmbShowAllProcessItems !== "undefined") ? window.cmbShowAllProcessItems.GetChecked() : false;
            window.ProcessRelatedItemGridcbPanel.PerformCallback({
                objectId: objectId,
                recordGuid: recordGuid,
                idRecord: recordId,
                reloadGrid: false,
                showAll: showAll
            });
        }
    };

    processes.RelatedItemContextMenuDisplay = function (s, e) {
        var x = ASPxClientUtils.GetEventX(e.htmlEvent);
        var y = ASPxClientUtils.GetEventY(e.htmlEvent);
        if (e.objectType === "row" || e.objectType === "emptyrow") {
            s.SetFocusedRowIndex(e.index);
            setTimeout(function () {
                window.CtxProcessRelatedItemsContextMenu.ShowAtPos(x, y);
                if (AppV.GetGlobals().isMainWindow) {
                    CtxProcessRelatedItemsContextMenu.GetItemByName("Add").SetEnabled(false);
                    CtxProcessRelatedItemsContextMenu.GetItemByName("MoveToSubProcess").SetEnabled(false);
                    CtxProcessRelatedItemsContextMenu.GetItemByName("RemoveAll").SetEnabled(false);
                    CtxProcessRelatedItemsContextMenu.GetItemByName("Remove").SetEnabled(false);
                }
            }, 10);
            rowKey = s.GetRowKey(e.index);
        }
    };
    processes.DisplayRelatedItemFromButtonContextMenu = function () {
        var gridName = "ProcessRelatedItemGrid";
        var s = {};
        var e = {};
        s = window[gridName];
        window[gridName].pageRowCount === 0 ? e.objectType = "emptyrow" : e.objectType = "row";
        e.index = window[gridName].GetFocusedRowIndex();
        var offset = $("#MainProcessRelatedItemGridMenuButton").offset();
        e.htmlEvent = { clientX: offset.left, clientY: offset.top };
        try {
            Processes.RelatedItemContextMenuDisplay(s, e);
        } catch (e) {
            console.log(e);
        }
    }
    processes.OpenRelatedItemOnGrid = function (s, e) {
        var index = ProcessRelatedItemGrid.focusedRowIndex - ProcessRelatedItemGrid.cpSkipped;
        var result = JSON.parse(ProcessRelatedItemGrid.cpAllRowData)[index];
        if (result == null) {
            Notification.SetNotification(window.SwResourceObject['PleaseSelectAnItem'], 'warning', 2500);
        } else {
            Helper.open('/PropertyCard/Index/' + result.UrlEncrypted, '_blank');
        }
    };
    processes.OnRelatedItemFocus = function (s, e) {
        if (AppV.GetGlobals().isMainWindow) {
            var menuPanel = window.mainSplFullScreenMode.GetPaneByName("mainSplRightPanel");
            if (menuPanel != null) {
                if (!menuPanel.IsCollapsed()) {
                    if (window.RightPageControlPanel.activeTabIndex === 1) {
                        Processes.OnDocumentPreviewRelatedItemsClick();
                    }
                }
            }
        } else {
            if (!PropertyCard.Splitter.IsRightPanelOpen()) {
                if (typeof PrecessInformationSections !== "undefined") {
                    if (PrecessInformationSections.GetActiveTab().name === "Preview") {
                        Processes.OnDocumentPreviewRelatedItemsClick();
                    }
                }
            }
        }
    };

    processes.OnRelatedItemRowDblClick = function () {
        var isEdit = (AppV.GetGlobals().RecordId > 0) ? true : false;
        var acceptedProcess = true;
        if (typeof ribbonPrpCard !== "undefined") {
            var acceptProcess = ribbonPrpCard.GetItemByName('AcceptProcess');
            if (acceptProcess != null) {
                acceptedProcess = !ribbonPrpCard.GetItemByName('AcceptProcess').enabled;
            }
        }
        if (!AppV.GetGlobals().isMainWindow && isEdit && acceptedProcess) {
            var result = JSON.parse(ProcessRelatedItemGrid.cpAllRowData)[ProcessRelatedItemGrid.focusedRowIndex];
            if (result != null) {
                if (result.ChildProcessGuid == "" || result.ChildProcessGuid == null) {
                    View.load('ProcessItemsInlineEdit', {
                        objectId: result.ObjectId,
                        idRecord: result.idRecord,
                        stageId: Processes.State.StageId,
                        parentObjectId: AppV.GetGlobals().ObjectId,
                        parentidRecord: AppV.GetGlobals().RecordId,
                        parentRecordGuid: AppV.GetGlobals().RecordGuid,
                    });
                } else {
                    Notification.SetNotification(window.SwResourceObject.YouMayNotHavePermissionToPerformThisAction, 'warning', 2500);
                }
            } else {
                Notification.SetNotification(window.SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
            }
        } else {
            Notification.SetNotification(window.SwResourceObject.YouMayNotHavePermissionToPerformThisAction, 'warning', 2500);
        }
    };

    processes.BntProcessItemsInlineEditSave = function (s, e) {
        var result = JSON.parse(ProcessRelatedItemGrid.cpAllRowData)[ProcessRelatedItemGrid.focusedRowIndex];
        if (result != null) {
            ajaxStatusProcessItemsInlineEdit.FormSubmit(result.idRecord, result.ObjectId);
        }
    };

    function createInput(name, value) {
        return $('<input >').attr({
            type: 'hidden',
            name: name,
            value: value
        });
    }
    function isValidForm() {
        return window.ASPxClientEdit.ValidateEditorsInContainerById('FormSubmitInlineEditProcessItems', '', true);
    }
    var _idRecord = -1;
    var _objectId = -1;
    var ajaxStatusProcessItemsInlineEdit = {
        frm: null,
        FormSubmit: function (idRecord, objectId) {
            _idRecord = idRecord;
            _objectId = objectId;
            // if (isValidForm() === true) {
            this.frm = $("#FormSubmitInlineEditProcessItems");
            this.frm.submit();
            //} else {
            //    window.PropertyCard.Alert.Show(SwResourceObject.PleaseCompleteRequiredFields);
            //}
        },
        OnFormSubmit: function (e) {
            e.preventDefault(); // avoid to execute the actual submit of the form.
            window.loadingPanel.Show();
            this.frm.append(createInput('stageId', Processes.State.StageId));
            this.frm.append(createInput('parentObjectId', AppV.GetGlobals().ObjectId));
            this.frm.append(createInput('parentRecordGuid', AppV.GetGlobals().RecordGuid));
            this.frm.append(createInput('idRecord', _idRecord));
            this.frm.append(createInput('objectId', _objectId));

            $.ajax({
                type: "POST",
                url: this.frm.attr('action'),
                data: this.frm.serialize(),
                success: function (response) {
                    var res = JSON.parse(response.data);
                    window.loadingPanel.Hide();
                    window.pcModalProcessItemslineEdit.Hide();
                    Processes.ProcessRelatedItemCbPCallback(true, window.cmbShowAllProcessItems.GetChecked());
                }
            });
        }
    };


    processes.OnDocumentPreviewRelatedItemsClick = function () {
        var result = JSON.parse(ProcessRelatedItemGrid.cpAllRowData)[ProcessRelatedItemGrid.focusedRowIndex];
        if (result != null) {
            if (typeof result === "undefined" || result.length === 0) {
                DocumentPreviewClearCache();
            }
            if (!Helper.IsEmpty("", result)) {
                OnDocumentPreviewTabClick(result.ObjectId, result.idRecord, "");
            } else {
                DocumentPreviewClearCache();
            }
        } else {
            DocumentPreviewClearCache();
        }
    };

    processes.btnAddMoveToSubProcessClick = function (s, e) {
        Helper.ShowConfirmPopUp("SolidWorks",
            SwResourceObject.ThisActionCannotBeUndone + " " + SwResourceObject.AreYouSureYouWantToContinue,
            "Processes.MoveToSubProcessClick()");
    };
    processes.MoveToSubProcessClick = function (s, e) {
        if (window["MoveToSubProcessWhatToCopy"].name != undefined) {
            window.MoveToSubProcessWhatToCopy.GetSelectedNodeValues("CopyName", function getDataFromCallback(values) {
                Processes.SaveSubProcessClick(values);
            });
        } else {
            var whatToCopyList = [];
            Processes.SaveSubProcessClick(whatToCopyList);
        }
    };
    processes.SaveSubProcessClick = function (values) {
        var result = Helper.FilterGridSelectedKeysOnPage("ProcessRelatedItemGrid", "idRecord");
        var recordGuidList = [];
        result.forEach(function (response) {
            recordGuidList.push(response.RecordGuid + ";" + response.ObjectId);
        });
        Request.ajax({
            type: "POST",
            url: '/Processes/MoveToSubProcess/',
            data: {
                objectId: AppV.GetGlobals().ObjectId,
                stageId: Processes.State.StageId,
                recordGuid: AppV.GetGlobals().RecordGuid,
                recordGuidList: recordGuidList,
                whatToCopy: values
            },
            dataType: "json"
        }).then(moveToSubProcess_success_callback, moveToSubProcess_success_callback)
            .then(function () { window.loadingPanel.Hide(); });
    };

    function moveToSubProcess_success_callback(response) {
        try {
            var responseData = JSON.parse(response.data);
            if (responseData.Success) {
                //var url = responseData.CustomAction.urlNavigate;
                //var result = Helper.FilterGridSelectedKeysOnPage("ProcessRelatedItemGrid", "idRecord");
                //var recordGuidList = [];
                //result.forEach(function (response) {
                //    recordGuidList.push(response.RecordGuid);
                //});
                //var cObjectId = result[0].ObjectId;
                //Processes.RemoveSelectedItemByGuidList(cObjectId, recordGuidList, false);
                Processes.ProcessRelatedItemCbPCallback(true, window.cmbShowAllProcessItems.GetChecked());
                Helper.open('/PropertyCard/Index/' + responseData.CustomAction.urlNavigate, '_blank');
                loadingPanel.Hide();
                window.pcModalMoveToSubProcess.Hide();
            } else {
                Notification.SetNotification(responseData.Message, 'warning', 2500);
            }

        }
        catch (err) {
            loadingPanel.Hide();
            window.pcModalMoveToSubProcess.Hide();
        }

    }

    processes.gridViewMoveToSubProcessBeginCallback = function (s, e) {
        var result = Helper.FilterGridSelectedKeysOnPage("ProcessRelatedItemGrid", "idRecord");
        var recordGuidList = [];
        result.forEach(function (response) {
            recordGuidList.push(response.RecordGuid + ";" + response.ObjectId);
        });
        var cObjectId = result[0].ObjectId;
        e.customArgs["objectId"] = AppV.GetGlobals().ObjectId;
        e.customArgs["processRecordGuid"] = AppV.GetGlobals().RecordGuid;
        e.customArgs["stageId"] = processes.State.StageId;
        e.customArgs["recordGuidList"] = recordGuidList;
        e.customArgs["reloadGrid"] = false;
        e.customArgs["isGrid"] = true;
        switch (e.command) {
            case "PAGERONCLICK":
            case "APPLYCOLUMNFILTER":
            case "APPLYFILTER":
            case "APPLYHEADERCOLUMNFILTER":
            case "NEXTPAGE":
            case "SORT":
                e.customArgs["reloadGrid"] = false;
                break;
            default:
                e.customArgs["reloadGrid"] = true;
                break;
        }
    };

    processes.gridViewWhatToCopySubProcessBeginCallback = function (s, e) {
        e.customArgs["objectId"] = AppV.GetGlobals().ObjectId;
        e.customArgs["recordGuid"] = AppV.GetGlobals().RecordGuid;
        e.customArgs["reloadGrid"] = false;
    };
    processes.AffectedItemsButtonClick = function (visibleIndex, fieldName) {
        var allowedCells = ["CurrentProcess", "SubProcess", "ParentProcess"];
        if (allowedCells.includes(fieldName)) {
            var result = JSON.parse(ProcessRelatedItemGrid.cpAllRowData)[visibleIndex][fieldName + "UrlEncrypted"];
            if (result != "") {
                Helper.open('/PropertyCard/Index/' + result, '_blank');
            }
        }
    }

    processes.RelatedItemGridContextMenuItemClick = function (s, e) {
        switch (e.item.name) {
            case "OpenRecord":
                Processes.OpenRelatedItemOnGrid();
                break;
            case "Add":
                Processes.AddReleatedItemToProcess();
                break;
            case "MoveToSubProcess":
                var result = Helper.FilterGridSelectedKeysOnPage("ProcessRelatedItemGrid", "idRecord");
                if (result.length == 0) {
                    Notification.SetNotification(window.SwResourceObject['PleaseSelectAnItem'], 'warning', 2500);
                } else {
                    var recordGuidList = [];
                    result.forEach(function (response) {
                        if (response.SubProcess === "" || response.SubProcess === null) {
                            recordGuidList.push(response.RecordGuid + ";" + response.ObjectId);
                        }
                    });
                    if (recordGuidList.length !== 0) {
                        View.load('pcModalMoveToSubProcess',
                            {
                                objectId: AppV.GetGlobals().ObjectId,
                                processRecordGuid: AppV.GetGlobals().RecordGuid,
                                stageId: processes.State.StageId,
                                recordGuidList: recordGuidList,
                            });
                    }
                    else {
                        Notification.SetNotification(Helper.T("RecordsAlreadyMovedToAnotherProcessCannotBeMovedAgainFromHere"), 'warning', 2500);
                    }
                }
                break;
            case "Remove":
                Processes.btnRemoveReleatedItemClick();
                break;
            case "RemoveAll":
                var resultAll = JSON.parse(window["ProcessRelatedItemGrid"].cpAllRowData);
                if (resultAll.length == 0) {
                    Notification.SetNotification(window.SwResourceObject['PleaseSelectAnItem'], 'warning', 2500);
                } else {
                    var recordGuidListData = [];
                    resultAll.forEach(function (response) {
                        recordGuidListData.push(response.RecordGuid);
                    });
                    var cObjectId = resultAll[0].ObjectId;
                    Processes.RemoveSelectedItemByGuidList(cObjectId, recordGuidListData, false);
                }
                break;
            case "RefreshProcessItems":
                Processes.ProcessRelatedItemCbPCallback(true, window.cmbShowAllProcessItems.GetChecked());
                break;
            case "ExportToExcel":
                App.Exporting = true;
                ProcessRelatedItemGrid.ExportTo(ASPxClientGridViewExportFormat.Xlsx);
                break;
            case "ApplyThisValueToAll":
                GridInlineEditor.ApplyAll(ProcessRelatedItemGrid);
                break;
            case "ApplyThisValueToAllAbove":
                GridInlineEditor.ApplyAbove(ProcessRelatedItemGrid);
                break;
            case "ApplyThisValueToAllBelow":
                GridInlineEditor.ApplyBelow(ProcessRelatedItemGrid);
                break;
            case "ApplyThisValueToAllSelected":
                GridInlineEditor.ApplySelected(ProcessRelatedItemGrid);
                break;
        }

    };

    processes.OnPropertiesClick = function (s, e) {
        Processes.OpenRelatedItemOnGrid();
    };


    var _heightDefault = 450; var _widthDefault = 600;
    processes.SetDefaultPosition = function (height, width) {
        _heightDefault = height;
        _widthDefault = width;
    };
    processes.AfterResizing = function (s, e) {
        if (e.resizeState === 4) {
            Processes.SetDefaultPosition(450, 600);
        } else {
            if (s.GetWidth() >= _widthDefault && s.GetHeight() >= _heightDefault) {
                if (e.resizeState === 1 || e.resizeState === 2) {
                    Processes.SetDefaultPosition(_heightDefault, _widthDefault);
                } else {
                    Processes.SetDefaultPosition(s.GetHeight(), s.GetWidth());
                }
            } else {
                Processes.SetDefaultPosition(450, 600);
            }
        }
        gridProcessViewReleatedItms.SetWidth(_widthDefault - 40);
        gridProcessViewReleatedItms.SetHeight(_heightDefault - 240);
        s.SetWidth(_widthDefault);
        s.SetHeight(_heightDefault);
    };



    processes.btnAddReleatedItemsClick = function () {

        if (gridProcessViewReleatedItms.pageRowCount == 0) {
            Notification.SetNotification(window.SwResourceObject['PleaseSelectAnItem'], 'warning', 2500);
            return;
        }

        window.gridProcessViewReleatedItms.GetSelectedFieldValues(
            "RecordGuid",
            function (result) {
                window.btnAddReleatedItem.SetEnabled(false);
                if (result == null) {
                    Notification.SetNotification(window.SwResourceObject['PleaseSelectAnItem'], 'warning', 2500);
                    return;
                }
                Request.ajax({
                    type: "POST",
                    url: '/Processes/SaveReleatedItems/',
                    data: {
                        objectId: processes.State.ObjectId,
                        recordGuid: processes.State.RecordGuid,
                        selectedObjectId: processes.State.selectedObjectId,
                        stageId: processes.State.StageId,
                        recordGuidList: result.toString()
                    },
                    dataType: "json"
                }).then(save_releated_items_success_callback, save_releated_items_error_callback)
                    .then(function () { window.loadingPanel.Hide(); });

            });

        function save_releated_items_success_callback(response) {
            window.btnAddReleatedItem.SetEnabled(true);
            window.pcModalAddReleatedItem.Hide();
            var responseData = JSON.parse(response.data);
            var message = [];
            responseData.forEach(function (response) {
                message.push(response.CustomAttributes.PartNumber +
                    ": " +
                    Helper.T(response.Message));
            });
            Notification.SetNotification(message, 'warning', 2500);
            processes.State.reload = true;
            window.ProcessRelatedItemGrid.PerformCallback({
                objectId: AppV.GetGlobals().ObjectId,
                recordGuid: AppV.GetGlobals().RecordGuid,
                idRecord: AppV.GetGlobals().RecordId
            });
        }

        function save_releated_items_error_callback(result) {
            window.pcModalAddReleatedItem.Hide();
        }
    };

    processes.btnRemoveReleatedItemClick = function () {
        processes.State.ObjectId = AppV.GetGlobals().ObjectId;
        processes.State.RecordGuid = AppV.GetGlobals().RecordGuid;

        if (ProcessRelatedItemGrid.GetSelectedKeysOnPage().length == 0) {
            Notification.SetNotification(window.SwResourceObject['PleaseSelectAnItem'], 'warning', 2500);
        } else {
            Helper.ShowConfirmPopUp("SolidWorks",
                SwResourceObject.AreYouSureYouWantToDeleteSelectedItem,
                "Processes.RemoveSelectedItem()");
        }

    };

    processes.RemoveSelectedItem = function (bAnswered = false) {

        var result = Helper.FilterGridSelectedKeysOnPage("ProcessRelatedItemGrid", "idRecord");
        if (result.length == 0) {
            Notification.SetNotification(window.SwResourceObject['PleaseSelectAnItem'], 'warning', 2500);
        } else {

            var recordGuidList = [];
            result.forEach(function (response) {
                recordGuidList.push(response.RecordGuid);
            });
            var cObjectId = result[0].ObjectId;

            Processes.RemoveSelectedItemByGuidList(cObjectId, recordGuidList, bAnswered);

        }
    };
    processes.RemoveSelectedItemByGuidList = function (cObjectId, recordGuidList, bAnswered = false) {
        Request.ajax({
            type: "POST",
            url: '/Processes/RemoveItemFromProcess/',
            data: {
                objectId: AppV.GetGlobals().ObjectId,
                recordGuid: AppV.GetGlobals().RecordGuid,
                stageId: processes.State.StageId,
                recordGuidList: recordGuidList.toString(),
                cObjectId: cObjectId,
                bAnswered: bAnswered
            },
            dataType: "json"
        }).then(remove_selected_success_callback, remove_selected_error_callback)
            .then(function () { window.loadingPanel.Hide(); });
    };

    function remove_selected_success_callback(response) {

        var responseData = JSON.parse(response.data);

        if (responseData.Success === false) {

            if (responseData.CustomAction.AskForRollback) {
                Helper.ShowConfirmPopUp("SolidWorks",
                    Helper.T(responseData.Message),
                    "Processes.RemoveSelectedItem(true)");
            } else {
                Notification.SetNotification(Helper.T(responseData.Message), 'warning', 2500);
            }
        }
        processes.State.reload = true;
        window.ProcessRelatedItemGrid.PerformCallback({
            objectId: AppV.GetGlobals().ObjectId,
            recordGuid: AppV.GetGlobals().RecordGuid,
            idRecord: AppV.GetGlobals().RecordId
        });
    }

    function remove_selected_error_callback(response) {
    }


    processes.ClearStates = function (s, e) {
        processes.State.selectedObjectId = -1;
        $.ajax({
            type: "POST",
            url: "/Processes/ClearState"
        });


    };


    processes.cmbDoNotChangeRevisonProcessItemsCheckChanged = function (s, e) {
        var doNotChangeRevision = window.cmbDoNotChangeRevisonProcessItems.GetChecked();
        processes.State.reload = true;
        window.ProcessRelatedItemGrid.PerformCallback({
            objectId: AppV.GetGlobals().ObjectId,
            recordGuid: AppV.GetGlobals().RecordGuid,
            idRecord: AppV.GetGlobals().RecordId,
            doNotChangeRevision: doNotChangeRevision
        });
    };
    processes.cmbShowAllProcessItemsCheckChanged = function (s, e) {
        processes.State.reload = true;
        Processes.ProcessRelatedItemCbPCallback(processes.State.reload);
    };


    //==============================AssignToOther==========START================//


    processes.AssignToOtherButtonClick = function (s, e) {
        processes.State.ObjectId = AppV.GetGlobals().ObjectId;
        processes.State.RecordGuid = AppV.GetGlobals().RecordGuid;
        processes.State.RecordId = AppV.GetGlobals().RecordId;
        processes.State.NextStageId = -1;

        window.pcModalAssignToOther.PerformCallback({
            objectId: processes.State.ObjectId,
            stageId: processes.State.StageId,
            nextStageId: processes.State.NextStageId,
            idRecord: processes.State.RecordId,
            isSendToNexStage: false
        });

        window.pcModalAssignToOther.Show();

    };

    processes.gridProcessAssignToUserBeginCallback = function (s, e) {

        e.customArgs["objectId"] = processes.State.ObjectId;
        if (processes.State.NextStageId > 0) {
            e.customArgs["stageId"] = processes.State.NextStageId;
        } else {
            e.customArgs["stageId"] = processes.State.StageId;
        }
        e.customArgs["idRecord"] = processes.State.RecordId;
    };

    processes.gridProcessAssignToUserEndCallback = function (s, e) {
        window.rdbParallelProcess.SetEnabled(s.cpDisableParallel);
        window.rdbSequentialProcess.SetEnabled(!s.cpDisableParallel);
    };


    processes.gridProcessAssignToUserInit = function (s, e) {
        window.rdbParallelProcess.SetEnabled(s.cpDisableParallel);
        window.rdbSequentialProcess.SetEnabled(!s.cpDisableParallel);
    };

    processes.btnAddUserInProcessConfirmClick = function (s, e) {
        Helper.ShowConfirmPopUp('SolidWorks',
            Helper.T('AreYouSure'), "Processes.btnAddUserInProcessClick(s,e)");
    };


    processes.btnAddUserInProcessClick = function (s, e) {
        if (window.cmbSelectUserOnStage.GetValue() != null) {
            Request.ajax({
                type: "POST",
                url: '/Processes/AddUserToProcess/',
                data: {
                    objectId: processes.State.ObjectId,
                    recordId: processes.State.RecordId,
                    stageId: processes.State.NextStageId > 0 ? processes.State.NextStageId : processes.State.StageId,
                    userId: window.cmbSelectUserOnStage.GetValue(),
                    optParallel: window.rdbParallelProcess.GetValue()
                }
            }).then(addUserToProcess_success_callback)
                .then(function () { window.loadingPanel.Hide(); });


        } else {
            Notification.SetNotification(window.SwResourceObject.PleaseSelectAUser, 'warning', 2500);
        }

        function addUserToProcess_success_callback(response) {
            if (response.success === false) {
                //TODO ENIDO replace message with resource after added key
                Notification.SetNotification(response.message, 'warning', 2500);
            } else {
                window.gridProcessAssignToUser.PerformCallback();
            }
        }
    };

    processes.btnRemoveUserInProcessConfirmClick = function (s, e) {
        Helper.ShowConfirmPopUp('SolidWorks',
            Helper.T('AreYouSure'), "Processes.btnRemoveUserFromProcessClick(s,e)");
    };
    processes.btnRemoveUserFromProcessClick = function (s, e) {
        window.gridProcessAssignToUser.GetSelectedFieldValues(
            "ChosenUserId;UserId;Name", function (result) {
                if (result.length > 0) {

                    Request.ajax({
                        type: "POST",
                        url: '/Processes/RemoveUserFromProcess/',
                        data: {
                            objectId: processes.State.ObjectId,
                            recordId: processes.State.RecordId,
                            stageId: processes.State.NextStageId > 0 ? processes.State.NextStageId : processes.State.StageId,
                            userId: result[0][1],
                            choosenUserId: result[0][0],
                            name: result[0][2]
                        }
                    }).then(removeUserFromProcess_success_callback, errorHandle)
                        .then(function () { window.loadingPanel.Hide(); });


                } else {
                    Notification.SetNotification(window.SwResourceObject.PleaseSelectAUser, 'warning', 2500);
                }

                function removeUserFromProcess_success_callback(response) {
                    if (response.success === false) {
                        //TODO ENIDO replace message with resource after added key
                        Notification.SetNotification(response.message, 'warning', 2500);
                    } else {
                        window.gridProcessAssignToUser.PerformCallback();
                    }
                }

                function errorHandle(error) {
                    console.log(error);
                }
            });
    };


    processes.btnMoveUpClick = function (s, e) {

        window.gridProcessAssignToUser.GetSelectedFieldValues(
            "ChosenUserId;OrderIndex", function (result) {
                if (result.length > 0) {

                    Request.ajax({
                        type: "POST",
                        url: '/Processes/MoveUpAndDown/',
                        data: {
                            objectId: processes.State.ObjectId,
                            idRecord: processes.State.RecordId,
                            stageId: processes.State.NextStageId > 0 ? processes.State.NextStageId : processes.State.StageId,
                            isUp: true,
                            orderIndex: result[0][1]
                        }
                    }).then(removeUserFromProcess_success_callback, errorHandle)
                        .then(function () { window.loadingPanel.Hide(); });


                } else {
                    Notification.SetNotification(window.SwResourceObject.PleaseSelectAUser, 'warning', 2500);
                }

                function removeUserFromProcess_success_callback(response) {
                    if (response.success === false) {
                        //TODO ENIDO replace message with resource after added key
                        Notification.SetNotification(response.message, 'warning', 2500);
                    } else {
                        window.gridProcessAssignToUser.PerformCallback();
                    }
                }
                function errorHandle(error) {
                    console.log(error);
                }
            });
    };
    processes.btnMoveDownClick = function (s, e) {

        window.gridProcessAssignToUser.GetSelectedFieldValues(
            "ChosenUserId;OrderIndex", function (result) {
                if (result.length > 0) {

                    Request.ajax({
                        type: "POST",
                        url: '/Processes/MoveUpAndDown/',
                        data: {
                            objectId: processes.State.ObjectId,
                            idRecord: processes.State.RecordId,
                            stageId: processes.State.NextStageId > 0 ? processes.State.NextStageId : processes.State.StageId,
                            isUp: false,
                            orderIndex: result[0][1]
                        }
                    }).then(removeUserFromProcess_success_callback)
                        .then(function () { window.loadingPanel.Hide(); });


                } else {
                    Notification.SetNotification(window.SwResourceObject.PleaseSelectAUser, 'warning', 2500);
                }

                function removeUserFromProcess_success_callback(response) {
                    if (response.success === false) {
                        //TODO ENIDO replace message with resource after added key
                        Notification.SetNotification(response.message, 'warning', 2500);
                    } else {
                        window.gridProcessAssignToUser.PerformCallback();
                    }
                }
            });
    };

    processes.rdbParallelProcessCheckChanged = function (s, e) {
        window.rdbSequentialProcess.SetChecked(false);
    };
    processes.rdbSequentialProcessCheckChanged = function (s, e) {
        window.rdbParallelProcess.SetChecked(false);
    };

    processes.btnAssignToOTherOKClick = function (s, e) {
        window.btnAssignToOTherOK.SetEnabled(false);

        Request.ajax({
            type: "POST",
            url: '/Processes/BtnOkAddUser/',
            data: {
                objectId: processes.State.ObjectId,
                recordId: processes.State.RecordId,
                stageId: processes.State.NextStageId > 0 ? processes.State.NextStageId : processes.State.StageId,
                optParallel: window.rdbParallelProcess.GetValue()
            }
        }).then(add_user_success_callback)
            .then(function () { window.loadingPanel.Hide(); });

        function add_user_success_callback(response) {
            if (response.success === false) {
                //TODO ENIDO replace message with resource after added key
                Notification.SetNotification(response.message, 'warning', 2500);
            } else {
                if (ribbonPrpCard.GetItemByName('AcceptProcess') !== null)
                    window.EnableItems(enums.RibbonNames.Properties, "AcceptProcess");
                window.pcModalAssignToOther.Hide();
            }
            window.btnAssignToOTherOK.SetEnabled(true);
            cbPropertiesTab.PerformCallback({ getFields: true });
        }

    };
    processes.btnAssignToOTherSendToNesxtOKClick = function (s, e) {
        window.btnAssignToOTherOK.SetEnabled(false);

        Request.ajax({
            type: "POST",
            url: '/Processes/BtnOkAddUser/',
            data: {
                objectId: processes.State.ObjectId,
                recordId: processes.State.RecordId,
                stageId: processes.State.StageId,
                optParallel: window.rdbParallelProcess.GetValue()
            }
        }).then(add_user_success_callback);
        //  .then(function () { window.loadingPanel.Hide(); });

        function add_user_success_callback(response) {
            if (response.success === false) {
                //TODO ENIDO replace message with resource after added key
                window.loadingPanel.Hide();
                Notification.SetNotification(response.message, 'warning', 2500);
            } else {
                window.EnableItems(enums.RibbonNames.Properties, "AcceptProcess");
                window.pcModalAssignToOther.Hide();
                Request.ajax({
                    type: "POST",
                    url: '/Processes/SendToAfterOkClick/',
                    data: {
                        objectId: processes.State.ObjectId,
                        recordId: processes.State.RecordId,
                        stageId: processes.State.StageId
                    }
                }).then(sendToNexStage_success_callback);
                // .then(function () { window.loadingPanel.Hide(); });
            }
            window.btnAssignToOTherOK.SetEnabled(true);
        }

    };




    //==============================AssignToOther=======END===================//



    processes.CancelProcessClick = function () {

        processes.State.ObjectId = AppV.GetGlobals().ObjectId;
        processes.State.RecordGuid = AppV.GetGlobals().RecordGuid;
        processes.State.RecordId = AppV.GetGlobals().RecordId;

        Request.ajax({
            type: "POST",
            url: '/Processes/CancelProcess/',
            data: {
                objectId: processes.State.ObjectId,
                recordId: processes.State.RecordId,
                stageId: processes.State.StageId
            }
        }).then(cancelProcessSuccess_callback)
            .then(function () { window.loadingPanel.Hide(); });

    };

    function cancelProcessSuccess_callback(response) {
        var responseData = JSON.parse(response.data);
        if (responseData.Success === false) {
            if (responseData.ShowConfirmationPrompt) {
                Helper.ShowConfirmPopUp("SolidWorks", Helper.T(responseData.Message)
                    , "Processes.CancelProcessClickWithRollbackItems(" + true + ")",
                    "Processes.CancelProcessClickWithRollbackItems(" + false + ")");

            }
            Notification.SetNotification(Helper.T(responseData.Message), 'warning', 2500);
        } else {
            Notification.SetNotification(Helper.T(responseData.Message));
            window.close();
        }

    }

    processes.CancelProcessClickWithRollbackItems = function (rollback) {

        Request.ajax({
            type: "POST",
            url: '/Processes/CancelWithRollbackItems/',
            data: {
                objectId: processes.State.ObjectId,
                recordId: processes.State.RecordId,
                rollback: rollback
            }
        }).then(cancelProcessSuccess_callback);
        // .then(function () { window.loadingPanel.Hide(); });
    };


    processes.SendToNextStageButtonClick = function (objectId = -1, recordGuid = "", recordId = -1) {
        if (objectId > 0) {
            processes.State.ObjectId = objectId;
            processes.State.RecordGuid = recordGuid;
            processes.State.RecordId = recordId;

            AppV.pushGlobalState("ObjectId", objectId);
            AppV.pushGlobalState("RecordGuid", recordGuid);
            AppV.pushGlobalState("RecordId", recordId);
        } else {
            processes.State.ObjectId = AppV.GetGlobals().ObjectId;
            processes.State.RecordGuid = AppV.GetGlobals().RecordGuid;
            processes.State.RecordId = AppV.GetGlobals().RecordId;
        }

        $.ajax({
            type: "POST",
            url: '/Processes/CheckItemsRequiredFields/',
            data: {
                stageId: processes.State.StageId,
                objectId: processes.State.ObjectId,
                recordGuid: processes.State.RecordGuid
            },
            dataType: "json",
            success: function (response) {
                var responseData = JSON.parse(response.data);
                if (!responseData.Success) {
                    Notification.SetNotification(Helper.T(responseData.Message, false), 'warning', 2500);
                    window.EnableItems(enums.RibbonNames.Properties, "SendToNextStage");
                    window.EnableItems(enums.RibbonNames.Properties, "Save");
                    window.loadingPanel.Hide();

                    if (Helper.IsNotEmpty(null, window.location.pathname)) {
                        var isAddNew = window.location.pathname.includes("AddNew");
                        if (isAddNew) {
                            if (Helper.IsNotEmpty(null, Processes.State.urlNavigate))
                                Helper.ChangeUrlWithOutReloading(RootUrl + 'PropertyCard/Index/' + Processes.State.urlNavigate);

                            cbpPropertyCardSection.PerformCallback({
                                id: AppV.GetGlobals().ObjectId,
                                id2: AppV.GetGlobals().RecordId,
                                id3: AppV.GetGlobals().RecordGuid,
                                id4: AppV.GetGlobals().SubObjectGuid,
                                id6: AppV.GetGlobals().webFormId
                            });
                        }
                    }
                } else {
                    window.loadingPanel.Hide();
                    Helper.ShowConfirmPopUp("SolidWorks",
                        Helper.T("AreYouSureYouWantToMoveItToNextStage"),
                        "Processes.sendToNextStageConfirmed()", "Processes.sendToNextStageRejected()");
                }
            }
        });
    };
    processes.sendToNextStageConfirmed = function () {
        Request.ajax({
            type: "POST",
            url: '/Processes/BtnSendToNextStage/',
            data: {
                objectId: processes.State.ObjectId,
                recordId: processes.State.RecordId,
                stageId: processes.State.StageId,
                recordGuid: processes.State.RecordGuid,
                SubObjectGuid: AppV.GetGlobals().SubObjectGuid,
                webFormId: AppV.GetGlobals().webFormId,
            }
        }).then(sendToNexStage_success_callback);
        // .then(function () { window.loadingPanel.Hide(); });
    };

    processes.sendToNextStageRejected = function () {
        if (Processes.State.isSendToNextStage) {
            Processes.State.isSendToNextStage = false;
            //Notification.SetNotification(Helper.T(responseData.Message));
            if (Helper.IsNotEmpty(null, Processes.State.urlNavigate))
                Helper.ChangeUrlWithOutReloading(RootUrl + 'PropertyCard/Index/' + Processes.State.urlNavigate);

        }
        cbpPropertyCardSection.PerformCallback({
            id: AppV.GetGlobals().ObjectId,
            id2: AppV.GetGlobals().RecordId,
            id3: AppV.GetGlobals().RecordGuid,
            id4: AppV.GetGlobals().SubObjectGuid,
            id6: AppV.GetGlobals().webFormId
        });
    };




    processes.onConfirmationMoveBackToStage = function () {

        Request.ajax({
            type: "POST",
            url: '/Processes/ConfirmGoBackToStage/',
            data: {
                objectId: processes.State.ObjectId,
                recordId: processes.State.RecordId,
                stageId: processes.State.StageId
            }
        }).then(sendToNexStage_success_callback);

    };

    processes.PageControlPanelTabChanged = function (s, e) {
        processes.PageControlPanelData(e.tab.name);
    };

    processes.PageControlPanelData = function (name) {
        if (name === "StageNotes") {
            StageNodesTabClick();
        }
        else if (name === "Preview") {
            RzProperties.SetRightControlPanelVisibility(PropertyCardSection.GetActiveTab().name, true);
            Processes.OnDocumentPreviewRelatedItemsClick();
        }
    };

    processes.HistoryPageControlPanelTabChanged = function (s, e) {
        if (e.tab.index === 1) {
            window.UserStageInfoGridCallback.PerformCallback(
                {
                    objectId: AppV.GetGlobals().ObjectId,
                    recordId: AppV.GetGlobals().RecordId
                });
            window.cbpStagesInformation.PerformCallback(
                {
                    objectId: AppV.GetGlobals().ObjectId,
                    recordId: AppV.GetGlobals().RecordId
                });
        }
    };


    StageNodesTabClick = function () {
        stageId = processes.State.StageId;

        window.StageNotesCallBackPanel.PerformCallback({
            stageId: stageId
        });
    };


    processes.shouldFinishAllStageTasks = function () {

        DisableNeccesaryItemsOnAction(window.ActiveObjectsOnAction, false, enums.RibbonNames.Properties);
    };

    function sendToNexStage_success_callback(response) {
        var responseData = JSON.parse(response.data);
        if (responseData.CustomAction.showModal) {
            View.loadDynamic("PDMPaswPopUp", { actionToPerform: enums.ActionToPerform.SendToNextStage }, enums.ActionToPerform.SendToNextStage, true);
        } else {
            if (Helper.IsNotEmpty(null, responseData.CustomAction.urlNavigate))
                Processes.State.urlNavigate = responseData.CustomAction.urlNavigate;

            if (responseData.Success === false) {
                if (responseData.CustomAction.OpenPasswordPrompt) {
                    window.loadingPanel.Hide();
                    View.load("ProcessPaswPopUp", {}, true, false);
                    // _ProcessPaswPopUp.Show();
                } else if (responseData.Message == "PasswordIsIncorrect") {
                    window.loadingPanel.Hide();
                    // _ProcessPaswPopUp.Show();
                    View.load("ProcessPaswPopUp", {}, true, false);
                    Notification.SetNotification(Helper.T(responseData.Message), 'warning', 3500);
                } else if (responseData.CustomAttributes.ShouldFinishTask) {
                    window.loadingPanel.Hide();
                    PropertyCardSection.SetActiveTab(PropertyCardSection.GetTabByName("ToDo"));
                    window.App.Global.BottomTabStates.ToDo = true;
                    window.App.PropertyCard.Callback.ToDo(AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordGuid);
                    Helper.ShowConfirmPopUp("SolidWorks",
                        Helper.T("AllTasksMustBeCompletedBeforeMovingToNextStage") + "\n" + Helper.T("IfYouCannotSeeTasksYouNeedToSaveTheRecordFirst"),
                        "Processes.shouldFinishAllStageTasks()",
                        "", "", 'false', false);
                } else if (responseData.ShowConfirmationPrompt) {
                    window.loadingPanel.Hide();
                    Helper.ShowConfirmPopUp("SolidWorks",
                        Helper.T(responseData.Message) + " "
                        + Helper.T("AreYouSure"),
                        "Processes.onConfirmationMoveBackToStage()", "DisableNeccesaryItemsOnAction(window.ActiveObjectsOnAction,false, enums.RibbonNames.Properties)");
                } else if (responseData.CustomAction.ChooseUsers) {
                    window.loadingPanel.Hide();
                    window.Processes.State.NextStageId = responseData.CustomAttributes.NextStageId;
                    window.pcModalAssignToOther.PerformCallback({
                        objectId: AppV.GetGlobals().ObjectId,
                        stageId: window.Processes.State.NextStageId,
                        nextStageId: window.Processes.State.NextStageId,
                        idRecord: AppV.GetGlobals().RecordId,
                        isSendToNexStage: true
                    });

                    window.pcModalAssignToOther.Show();

                }
                else {
                    DisableNeccesaryItemsOnAction(window.ActiveObjectsOnAction, false, enums.RibbonNames.Properties);
                    //Think about moving this line out of the conditions!!
                    if (Helper.IsNotEmpty(null, Processes.State.urlNavigate))
                        Helper.ChangeUrlWithOutReloading(RootUrl + 'PropertyCard/Index/' + Processes.State.urlNavigate);

                    cbpPropertyCardSection.PerformCallback({
                        id: AppV.GetGlobals().ObjectId,
                        id2: AppV.GetGlobals().RecordId,
                        id3: AppV.GetGlobals().RecordGuid,
                        id4: AppV.GetGlobals().SubObjectGuid,
                        id6: AppV.GetGlobals().webFormId
                    });
                    Notification.SetNotification(Helper.T(responseData.Message, false), 'warning', 2500);
                    window.loadingPanel.Hide();
                }
            } else {
                if (Processes.State.isSendToNextStage) {
                    Processes.State.isSendToNextStage = false;
                    Notification.SetNotification(Helper.T(responseData.Message));
                    if (Helper.IsNotEmpty(null, Processes.State.urlNavigate))
                        Helper.ChangeUrlWithOutReloading(RootUrl + 'PropertyCard/Index/' + Processes.State.urlNavigate);

                }
                cbpPropertyCardSection.PerformCallback({
                    id: AppV.GetGlobals().ObjectId,
                    id2: AppV.GetGlobals().RecordId,
                    id3: AppV.GetGlobals().RecordGuid,
                    id4: AppV.GetGlobals().SubObjectGuid,
                    id6: AppV.GetGlobals().webFormId
                });

                Processes.ProcessRelatedItemCbPCallback(true);
                Notification.SetNotification(Helper.T("MovedToNextStage"), 'success', 3500);
                FieldVaildation.objectChanged = true;
            }
        }

    }

    processes.PasswOkClick = function (s, e) {

        var pas = _retypePasswPopUp.GetValue();
        _ProcessPaswPopUp.Hide();
        Request.ajax({
            type: "POST",
            url: '/Processes/ValidatePaswForStage/',
            data: {
                objectId: processes.State.ObjectId,
                recordId: processes.State.RecordId,
                stageId: processes.State.StageId,
                password: pas
            }
        }).then(sendToNexStage_success_callback);
        // .then(function () { window.loadingPanel.Hide(); });

    };

    processes.PaswKeyPress = function (s, e) {
        if (e.htmlEvent.keyCode === 13)
            Processes.PasswOkClick(s, e);
    };
    processes.HandleClickOnRibbonProcess = function (s, e, objectId, actionToPerform, isExternal = false) {
        var _value = e.item.name;
        var acrtionToPerform = actionToPerform;//AppV.GetGlobals().isMainWindow ? window.ActionToPerform.MainGridDisplay : window.ActionToPerform.Edit;
        if (_value == -1) {
            if (AppV.GetGlobals().isMainWindow || isExternal) {
                View.load('SendToProcessesMainGrid', {
                    objectId: objectId,
                    actionToPerform: acrtionToPerform
                });
            } else {
                View.load('SendToProcessesPropertyCard', {
                    objectId: objectId,
                    actionToPerform: acrtionToPerform
                });
            }
        } else {
            SendToProcesses.mainGridSendToProcess(
                _value,
                objectId,
                acrtionToPerform
            );
        }

    }

    window.ajaxStatusProcessItemsInlineEdit = ajaxStatusProcessItemsInlineEdit;
    window.Processes = processes;

})();


(function () {

    var processesSimpleSearch = {};

    processesSimpleSearch.OnbtnSimpleSearchClick = function (s, e) {
        var cmbSelectObject = window.cmbSelectObject.GetValue();
        if (e.buttonIndex === 0) {
            if (cmbSelectObject !== null) {
                window.gridProcessViewReleatedItms.PerformCallback();
            }
            else {
                Notification.SetNotification(window.SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            }
        } else {
            if (cmbSelectObject !== null) {
                window.btnRelatedItemsSimpleSearch.SetValue('');
                window.gridProcessViewReleatedItms.PerformCallback();
            }
            else {
                window.btnRelatedItemsSimpleSearch.SetValue('');
            }
        }
    };

    processesSimpleSearch.KeyPressSimpleSearch = function (s, e) {
        var cmbSelectObject = window.cmbSelectObject.GetValue();
        if (cmbSelectObject !== null) {
            if (e.htmlEvent.keyCode === 13) {
                window.gridProcessViewReleatedItms.PerformCallback();
            }
        }
    };

    window.ProcessesSimpleSearch = processesSimpleSearch;
})();




(function () {

    var sendToProcesses = {};


    sendToProcesses.BtnSendToProcessesCancel = function (s, e, actionToPerform) {
        var modalProcesses = window["pcSendToProcesses" + actionToPerform];
        if (typeof modalProcesses != "undefined")
            modalProcesses.Hide();
    };

    sendToProcesses.BtnSendToProcessesOk = function (s, e, objectId, actionToPerform, isExternal = false) {
        var cmbSendToProcess = "cmbSendToProcess" + actionToPerform;
        var processObjectId = window[cmbSendToProcess].GetValue();
        if (processObjectId !== null) {
            if (actionToPerform === window.ActionToPerform.MainGridDisplay || actionToPerform === window.ActionToPerform.Edit) {
                sendToProcesses.mainGridSendToProcess(processObjectId, objectId, actionToPerform, isExternal);
            }
            else if (actionToPerform === window.ActionToPerform.BomInlineEdit) {
                var checkGt = window.billOfMaterials.checkActiveDisplay();
                if (checkGt.startsWith("Tree")) {
                    billOfMaterialTreeSendToProcess(processObjectId, actionToPerform);
                } else {
                    billOfMaterialGridSendToProcess(processObjectId, actionToPerform);
                }
            }
            else if (actionToPerform === window.ActionToPerform.WhereUsed) {
                whereUsedSendToProcess(processObjectId, actionToPerform);
            }
        } else {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
        }
    };

    sendToProcesses.mainGridSendToProcess = function (processObjectId, objectId, actionToPerform, isExternal) {
        var selectedRecordGuid = [];
        if (actionToPerform == window.ActionToPerform.MainGridDisplay) {
            if (isExternal == "False") isExternal = false;
            if (isExternal == "True") isExternal = true;
            if (isExternal) {
                if (typeof ExternalUsersGrid !== "undefined") {
                    var recordKeysE = ExternalUsersGrid.GetSelectedKeysOnPage();
                    if (recordKeysE.length > 0) {
                        recordKeysE.forEach(function (key, index) {
                            var item = JSON.parse(window["ExternalUsersGrid"].cpExternalAllRowData).filter(function (x) {
                                return x.RecordId == Number(key);
                            })[0];
                            if (item != null) {
                                selectedRecordGuid.push(item.RecordGuid + ";" + item.ObjectId);
                            }
                        });
                    } else {
                        Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                        return;
                    }
                }
            } else {
                var recordKeys = Object.keys(MainGrid.GetSelectedRowValues());
                if (recordKeys.length > 0) {
                    recordKeys.forEach(function (key, index) {
                        selectedRecordGuid.push(MainGrid.GetSelectedRowValues()[key].RecordGuid + ";" + MainGrid.GetSelectedRowValues()[key].ObjectId);
                    });
                } else {
                    Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                    return;
                }
            }

        } else {
            selectedRecordGuid.push(AppV.GetGlobals().RecordGuid + ";" + AppV.GetGlobals().ObjectId);
        }
        sendRecordToProcesses(processObjectId, selectedRecordGuid, actionToPerform);
    };

    function billOfMaterialTreeSendToProcess(processObjectId, actionToPerform) {
        var selectedRecordGuid = [];
        var checkGT = window.billOfMaterials.checkActiveDisplay();
        var result = Helper.FilterTreeListSelectedNodeKeys(checkGT, "KEYID");
        if (result.length === 0) {
            result = Helper.FilterTreelistFocusedNodeKey(checkGT, "KEYID")[0];
            if (result == null) {
                Notification.SetNotification(window.SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
                return;
            } else {
                selectedRecordGuid.push(result.RecordGuid + ";" + result.ChildObjId);
                sendRecordToProcesses(processObjectId, selectedRecordGuid, actionToPerform);
            }
        } else {
            result.forEach(function (entry) {
                selectedRecordGuid.push(entry.RecordGuid + ";" + entry.ChildObjId);
            });
            sendRecordToProcesses(processObjectId, selectedRecordGuid, actionToPerform);
        }
    }

    function billOfMaterialGridSendToProcess(processObjectId, actionToPerform) {
        var selectedRecordGuid = [];
        var checkGT = window.billOfMaterials.checkActiveDisplay();
        var result = Helper.FilterGridSelectedKeysOnPage(checkGT, "KEYID");
        if (result.length === 0) {
            result = JSON.parse(window[checkGT].cpAllRowData).filter(function (x) {
                return x.KEYID === Number(window[checkGT].GetRowKey(window[checkGT].GetFocusedRowIndex()));
            })[0];
            if (result == null) {
                Notification.SetNotification(window.SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
                return;
            } else {
                selectedRecordGuid.push(result.RecordGuid + ";" + result.ChildObjId);
                sendRecordToProcesses(processObjectId, selectedRecordGuid, actionToPerform);
            }
        } else {
            result.forEach(function (entry) {
                selectedRecordGuid.push(entry.RecordGuid + ";" + entry.ChildObjId);
            });
            sendRecordToProcesses(processObjectId, selectedRecordGuid, actionToPerform);
        }
    }

    function whereUsedSendToProcess(processObjectId, actionToPerform) {
        var selectedRecordGuid = [];
        window.whereUsedBomRecords.GetSelectedNodeValues("ParentGuid;ParentObjectID",
            function getSelectedFieldValuesCallback(result) {
                if (result.length !== 0) {
                    result.forEach(function (entry) {
                        selectedRecordGuid.push(entry[0] + ";" + entry[1]);
                    });
                    sendRecordToProcesses(processObjectId, selectedRecordGuid, actionToPerform);
                } else {
                    window.whereUsedBomRecords.GetNodeValues(window.whereUsedBomRecords.GetFocusedNodeKey(), 'ParentGuid;ParentObjectID',
                        function (focuseValues) {

                            if (typeof (focuseValues) === 'undefined' || focuseValues === null || focuseValues.length === 0) {
                                Notification.SetNotification(window.SwResourceObject.ChooseARecord, 'warning', 3500);
                                return;
                            }
                            selectedRecordGuid.push(focuseValues[0] + ";" + focuseValues[1]);
                            sendRecordToProcesses(processObjectId, selectedRecordGuid, actionToPerform);
                        });
                }
            });
    }

    var responseData;
    function sendRecordToProcesses(processObjectId, selectedRecordGuid, actionToPerform) {
        if (selectedRecordGuid !== null && selectedRecordGuid.length !== 0) {
            $.ajax({
                type: "POST",
                url: '/Processes/SendToProcesses/',
                data: {
                    "processObjectId": Number(processObjectId),
                    "selectedRecordGuid": selectedRecordGuid,
                    "tabname": window.Helper.TabName()
                },
                dataType: "json",
                success: function (response) {
                    responseData = JSON.parse(response.data);
                    if (responseData.Success) {
                        localStorage.setItem("MainGridTabName", window.Helper.TabName());
                        Notification.SetNotification(Helper.T(responseData.Message), 'warning', 4500);
                        Helper.open('/PropertyCard/AddNew/' + responseData.CustomAction.addNewUrlEncrypted,
                            '_blank');
                        sendToProcesses.BtnSendToProcessesCancel({}, {}, actionToPerform);
                    } else {
                        if (responseData.CustomAction.AskForConfirmation) {
                            Helper.ShowConfirmPopUp("SolidWorks", responseData.Message,
                                "SendToProcesses.ConfirmSendToProcess(" + actionToPerform + ")");
                            return;
                        } else {
                            Notification.SetNotification(responseData.Message, 'warning', 4500);
                        }
                    }
                }
            });
        } else {
            Notification.SetNotification(window.SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
        }

    }


    sendToProcesses.ConfirmSendToProcess = function (actionToPerform) {
        $.ajax({
            type: "POST",
            url: '/Processes/ConfirmSendToProcesses/',
            data: {
                "processObjectId": responseData.CustomAttributes.processObjectId,
                "selectedRecordGuid": responseData.CustomAttributes.selectedRecordGuid,
                "tabname": window.Helper.TabName()
            },
            dataType: "json",
            success: function (response) {
                var responseData = JSON.parse(response.data);
                if (responseData.Success) {
                    localStorage.setItem("MainGridTabName", window.Helper.TabName());
                    Helper.open('/PropertyCard/AddNew/' + responseData.CustomAction.addNewUrlEncrypted,
                        '_blank');
                    var modalProcesses = window["pcSendToProcesses" + actionToPerform];
                    if (typeof modalProcesses != "undefined")
                        modalProcesses.Hide();
                } else {
                    Notification.SetNotification(Helper.T(responseData.Message), 'warning', 4500);
                }
            }
        });
    };





    window.SendToProcesses = sendToProcesses;

})();
;


var RZMainTreeList = (function () {

    var _State = {
        reload: false
    };

    var _InternalFunctions = {
        PerformUpdateStateFilters: function (_res) {
            AppV.pushState("Filters", {
                ObjectId: _res.ObjectId,
                FilterId: parseInt(_res.SectionId.toString().replace("filter", "")),
                TreeName: 'MainTreeList'
            });
        }
    };

    var SpecialObject = {

        NodeClick: function (s, e) {
            if (cbpDocumetGrid.InCallback()
                || cbpPropertyCardSectionBottom.InCallback()) {
                e.cancel = true;
                return;
            }
            
            //Get values of selected item
            var result = Helper.FilterTreelistFocusedNodeKey("SpecialObjectTree", "SectionId", e.nodeKey)[0];
            
            if (result.ObjectId > 0) {
                AppV.pushState("Global",
                    {
                        ObjectId: result.ObjectId,
                        RecordId: -1,
                        ObjectGuid: "",
                        RecordGuid: "",
                        SubObjectGuid: result.SubObjectGuid || "",
                        SubObjectId: result.SubObjectId,
                        UrlEncrypted: "",
                        SectionId: 'filter' + result.FilterId,
                        AddNewUrlEncrypted: result.UrlEncrypted || "",
                        ObjectType: result.ObjectType,
                        GroupObjectId: result.GroupObjectId,
                        RelatedObjectId: result.RelatedObjectId
                    });

                AppV.pushState("Filters", {
                    ObjectId: result.ObjectId,
                    FilterId: result.FilterId,
                    TreeName: s.name,
                    IsTaskFilter: false,
                    CalledFrom: s.cpModuleCalledFrom
                });
            }

            FieldVaildation.objectChanged = true;

            //Removethis Tomi
            AppV.pushGlobalState("IsSpecialObject", true);

            window.mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").CollapseForward();
            window.App.Global.ResetBottomTabIndex = true;
            UI.notify(Helper.PrepareObject(s, e, result.ObjectId));
            MainRibbonV.SetActiveTabSelectedMainRibbon(AppV.GetGlobals().ModuleName);
            
            //Callbak of main grid
            MainGrid.PerformCallback(true);


            var menuPanel = window.mainSplFullScreenMode.GetPaneByName("mainSplRightPanel");
            if (!menuPanel.IsCollapsed()) {

                if (window.RightPageControlPanel.activeTabIndex === 0) {
                    
                    window.cbpFilterContent.PerformCallback({
                        objectId: AppV.GetGlobals().ObjectId,
                        subObjectId: AppV.GetGlobals().GroupObjectId
                    });
                }
                //Get preview of the document if tab is active
                if (window.RightPageControlPanel.activeTabIndex === 1) {
                    DocumentPreviewClearCache();
                }
            }

        },

        BeginCallback: function (s, e) {
            e.customArgs['topMenuSelected'] = enums.Modules.SpecialObject;
            e.customArgs['clearCache'] = _State.reload;
            e.customArgs['objectId'] = RZMainTreeList.GetCurrentNode("MainTreeList").ObjectId;
        }
    };

    return {

        GetCurrentNode: function (requestedTree = "") {
            var treeName = "";

            if (requestedTree !== "") {
                treeName = requestedTree;
            } else {
                treeName = ((AppV.GetFiltersState.TreeName == '') ? 'MainTreeList' : AppV.GetFiltersState.TreeName);
            }
            
            var result = JSON.parse(window[treeName].cpAllRowData).filter(function (x) {
                //return x.SectionId == MainTreeList.GetFocusedNodeKey();
                return x.SectionId == window[treeName].GetFocusedNodeKey();
            });
            if (typeof result != "undefined")
                return CurrentNode = result[0];
            else
                return JSON.parse(window[treeName].cpAllRowData)[0];
        },

        Init: function (s, e) {
            var cookie = Helper.GetCookie(s.name + '_focudedKey');
            if (cookie) {
                if (s.GetRowByNodeKey(cookie) != null)
                    s.SetFocusedNodeKey(cookie);
                else {
                    Helper.deleteCookie(s.name + '_focudedKey');
                }
            }
            if(typeof RZMainTreeList.GetCurrentNode()!= "undefined"){
                if (Helper.Contains("filter", RZMainTreeList.GetCurrentNode().SectionId))
                    _InternalFunctions.PerformUpdateStateFilters(RZMainTreeList.GetCurrentNode());

                if (RZMainTreeList.GetCurrentNode().hasSpecialObject) {
                    SpecialObjectTree.PerformCallback(
                        {
                            topMenuSelected: enums.Modules.SpecialObject,
                            objectId: RZMainTreeList.GetCurrentNode().ObjectId
                        });
                    Main.Splitter.specialObjectSplitter.ShowAndOpen();
                } else {
                    Main.Splitter.specialObjectSplitter.CloseAndHide();
                }
            }
            
        },
        BeginCallback: function (s, e) {
            e.customArgs['topMenuSelected'] = AppV.GetGlobals().ModuleName;
            e.customArgs['clearCache'] = _State.reload;
            e.customArgs['objectId'] = RZMainTreeList.GetCurrentNode().ObjectId;
        },
        FocusedNodeChanged: function (s, e) {
            ASPxClientUtils.SetCookie(s.name + '_focudedKey', s.GetFocusedNodeKey());
        },
        NodeClick: function (s, e) {

            if (cbpDocumetGrid.InCallback()
                || cbpPropertyCardSectionBottom.InCallback()) {
                e.cancel = true;
                return;
            }
            //TODO Renaldo specialobject condition
            //if(typeof s.hasSpecialObject == "undefined")
            //s.hasSpecialObject = Math.round((Math.random() * 1) + 0) === 0;
            //SectionMenu.LastSelectedVal = s.GetFocusedNodeKey();

            //Removethis Tomi
            AppV.pushGlobalState("IsSpecialObject", false);

            //StateOfConditions = [];
            FieldVaildation.objectChanged = true;
            MainGrid.ShouldReload(true);
            window.mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").CollapseForward();

            // var pane = ;
            // pane.Collapse(pane);
            window.App.Global.ResetBottomTabIndex = true;
            //    window.gridViewDocuments.ClearFilter();
            var result = Helper.FilterTreelistFocusedNodeKey("MainTreeList", "SectionId", e.nodeKey)[0];

            //var a = JSON.parse(MainTreeList.cpAllRowData);

            UI.notify(Helper.PrepareObject(s, e, result.ObjectId));
            AppV.clearState("PropertyTabs");

            if (AppV.GetGlobals().ModuleName === enums.Modules.Home) {
                MainGrid.DashBoardViewer.ClearTimeInterval();
                var homeModuleItemSelected = result.SectionId;
                MainRibbonV.SetActiveTabSelectedMainRibbon(homeModuleItemSelected);
                AppV.pushState("HomeObject", { MenuSelected: homeModuleItemSelected });
                if (homeModuleItemSelected === enums.HomeModules.Tasks
                    || homeModuleItemSelected === enums.HomeModules.Timesheets) {
                    //window.mainSplFullScreenMode.GetPaneByName("splFiltersPane").Expand();
                    View.load('MainTaskFilters', { homeModulesSelected: homeModuleItemSelected}, false);
                }
                if (homeModuleItemSelected === enums.HomeModules.Tasks
                    || homeModuleItemSelected === enums.HomeModules.MyWork
                    || homeModuleItemSelected === enums.HomeModules.Timesheets ) {
                    AppV.pushState("Global",
                        {
                            SectionId: result.SectionId,
                            AddNewUrlEncrypted: result.UrlEncrypted || "",
                        });
                    var url = RootUrl + '';
                    window.history.pushState({ urlPath: url }, null, url);
                    if (homeModuleItemSelected !== enums.HomeModules.Timesheets &&
                        homeModuleItemSelected !== enums.HomeModules.Tasks) {
                        window.cbpDocumetGrid.PerformCallback({
                            HomeModuleName: AppV.GetHomeObjects().MenuSelected
                        });
                    }
                }
                if (homeModuleItemSelected === enums.HomeModules.MyDashboard) {
                    AutomaticRefreshCombo.SetSelectedIndex(0);
                    MainRibbonV.UpdateLastUpdatedRefreshField();
                    cbpDashboardItems.PerformCallback();
                }
            } else {
                MainRibbonV.SetActiveTabSelectedMainRibbon(AppV.GetGlobals().ModuleName);
                AppV.pushGlobalState("currentPage", enums.Paggination.currentPage);
                AppV.pushGlobalState("pageSizeItem", enums.Paggination.pageSizeItem);
                AppV.clearState("HomeObject");

                var hasObjectIdChanged = result.ObjectId == AppV.GetGlobals().ObjectId ? false : true;

                if (result.ObjectId > 0) {
                    AppV.pushState("Global",
                        {
                            ObjectId: result.ObjectId,
                            RecordId: -1,
                            ObjectGuid: "",
                            RecordGuid: "",
                            SubObjectGuid: result.SubObjectGuid || "",
                            SubObjectId: result.SubObjectId,
                            UrlEncrypted: "",
                            SectionId: result.SectionId || "",
                            AddNewUrlEncrypted: result.UrlEncrypted || "",
                            ObjectType: result.ObjectType
                        });

                    AppV.pushState("Filters", {
                        ObjectId: result.ObjectId,
                        FilterId: parseInt(e.nodeKey.toString().replace("filter", "")),
                        TreeName: s.name,
                        IsTaskFilter: false,
                        CalledFrom: s.cpModuleCalledFrom
                    });


                    //callback of so section
                    if (result.hasSpecialObject) {
                        if (hasObjectIdChanged) {
                            SpecialObjectTree.PerformCallback(
                                {
                                    topMenuSelected: enums.Modules.SpecialObject,
                                    objectId: result.ObjectId
                                });
                            Main.Splitter.specialObjectSplitter.ShowAndOpen();
                        }
                    } else {
                        Main.Splitter.specialObjectSplitter.CloseAndHide();
                    }
                    
                    MainGrid.PerformCbpCallback(true);

                    //Removed because the call is made by another function    

                    var menuPanel = window.mainSplFullScreenMode.GetPaneByName("mainSplRightPanel");
                    if (!menuPanel.IsCollapsed()) {

                        if (window.RightPageControlPanel.activeTabIndex === 0) {
                            
                            window.cbpFilterContent.PerformCallback({
                                objectId: AppV.GetGlobals().ObjectId,
                                subObjectId: AppV.GetGlobals().GroupObjectId
                            });
                        }
                        //Get preview of the document if tab is active
                        if (window.RightPageControlPanel.activeTabIndex === 1) {
                            DocumentPreviewClearCache();
                        }
                    }
                    var spliterCol = document.getElementById("mainSplFullScreenMode_0i0i1i1i1_S_CB_Img");
                    if (spliterCol!=null) {
                        spliterCol.style.display = "";
                    }

                } else {
                    AppV.pushState("Global",
                        {
                            SectionId: result.SectionId,
                            AddNewUrlEncrypted: result.UrlEncrypted || ""
                        });

                    var url = RootUrl + '';
                    window.history.pushState({ urlPath: url }, null, url);
                    window.gridViewDocuments.SetVisible(false);
                    var spliterEx = document.getElementById("mainSplFullScreenMode_0i0i1i1i1_S_CB_Img");
                    if (spliterEx != null) {
                        spliterEx.style.display = "none";
                    }
                    
                    if (typeof FilterTreelist != 'undefined') {
                        window.Filter.ClearFilterFields();
                        window.Filter.DisableFilterFields();
                    }
                }
                objectID = result.ObjectId;
            }

            RZMainTreeList.EndCallback();
        },

        EndCallback: function () {
            //TODO FIX THIS ENIDO

            _State.reload = false;
            var items = ["New", "OpenRecord", "SimpleSearchIn", "SearchInTemplate", "SimpleSearchFor", "itemSearchInTextBox", "MaxRecordsPerObject", "itemSearchLimit", "ShowMainColumns", "ShowImages", "HideImages",];//"sendToProcessTemplate"];
            if (AppV.GetGlobals().ModuleName == enums.Modules.Home ||
                AppV.GetHomeObjects().MenuSelected === enums.HomeModules.MyWork) {
                var itemsMyWork = ["New","OpenRecord","SimpleSearchIn", "SearchInTemplate",
                 "SimpleSearchFor", "itemSearchInTextBox", "MaxRecordsPerObject", "itemSearchLimit", 
                 "ShowMainColumns", "ShowImages", "HideImages"];
                DisableNeccesaryItemsOnAction(itemsMyWork, false, enums.RibbonNames.Main);
                return;
            }

            if (AppV.GetGlobals().ModuleName == enums.Modules.Home) {
                var item = ["SimpleSearchIn", "SearchInTemplate", "SimpleSearchFor", "itemSearchInTextBox", "MaxRecordsPerObject", "itemSearchLimit","sendToProcessTemplate","New","OpenRecord"];
                DisableNeccesaryItemsOnAction(item, false, enums.RibbonNames.Main);

                if (gridViewDocuments.pageCount == 0) {
                    MainRibbon.GetItemByName("OpenRecord").SetEnabled(false);
                }
            }
            else {
                if (Helper.Contains("section", AppV.GetGlobals().SectionId) || AppV.GetGlobals().SectionId === "") {
                    var _newArray = items; _newArray.push("sendToProcessTemplate");
                    DisableNeccesaryItemsOnAction(items, true, enums.RibbonNames.Main);

                    if (typeof gridViewDocuments != undefined)
                        window.gridViewDocuments.SetVisible(false);

                } else {
                    DisableNeccesaryItemsOnAction(items, false, enums.RibbonNames.Main);

                    if (gridViewDocuments.pageCount == 0) {
                        MainRibbon.GetItemByName("OpenRecord").SetEnabled(false);
                    }

                    //if (AppV.GetGlobals().ObjectType === enums.ObjectTypes.SWPDM)
                    //    MainRibbon.GetItemByName("New").SetEnabled(false);
                    //else
                     MainRibbon.GetItemByName("New").SetEnabled(true);
                }
            }

        },

        DeleteFilter : function (s, e) {
            $.ajax({
                type: "POST",
                url: "/Filter/DeleteFilter",
                data: {
                    filterId: AppV.GetFiltersState.FilterId
                },
                success: function () {
                    Notification.SetNotification("Filter deleted!", 'success', 2500);
                    if (AppV.GetFiltersState.hasOwnProperty('IsTaskFilter') && AppV.GetFiltersState.IsTaskFilter === true) {
                        window.MainTaskFilterTree.PerformCallback();
                    }
                    else {
                        window.App.GridView.Callback.TreeView(AppV.GetFiltersState.CalledFrom, true);
                    }
                    
                    window.pcRemoveFilter.Hide();
                },
                error: function () {
                    Notification.SetNotification(SwResourceObject.AnErrorOccurred, 'warning', 2500);
                    window.pcRemoveFilter.Hide();
                }
            });
        },
        AdujstTaskTree: function (modulName = "") {
            if (modulName === enums.HomeModules.Tasks || modulName === enums.HomeModules.Timesheets) {
                $("#taskTreeHome").attr("class", "col-md-2");
                $("#taskTreeHome").attr("style", "overflow: auto;display:''");
                $("#mainContent").attr("class", "col-md-10");
            } else {
                $("#taskTreeHome").attr("class", "col-md-0");
                $("#taskTreeHome").attr("style", "overflow: auto;display:none");
                $("#mainContent").attr("class", "col-md-12");
            }
        },
        ContextMenu: {
            Display: function (s, e) {
                if (e.objectType === "Node") {
                    s.SetFocusedNodeKey(e.objectKey);
                    var x = ASPxClientUtils.GetEventX(e.htmlEvent);
                    var y = ASPxClientUtils.GetEventY(e.htmlEvent);
                    var sectionVisible = ["refreshTree", "collapseAllBtnCtx", "expandAllBtnCtx"];
                    var objectVisible = ["refreshTree", "collapseAllBtnCtx", "expandAllBtnCtx", "addFilter", "showRecords"];
                    var filterVisible = ["refreshTree", "collapseAllBtnCtx", "expandAllBtnCtx", "showRecords", "editFilter", "deleteFilter"];
                    CtxMenuTreeView.SetEnabled(false);

                    enableItems = function (item) {
                        eval('CtxMenuTreeView.GetItemByName("' + item + '").SetEnabled(true)');
                    }

                    if (e.objectKey.startsWith("section")) {
                        sectionVisible.forEach(enableItems);
                    } else if (e.objectKey.startsWith("object") || e.objectKey.startsWith("subobject")) {
                        objectVisible.forEach(enableItems);
                    } else if (e.objectKey.startsWith("filter")) {
                        filterVisible.forEach(enableItems);
                    }
                    CtxMenuTreeView.ShowAtPos(x, y);

                    nodeKey = e.objectKey;
                    var node = s.GetNodeHtmlElement(nodeKey);
                    var result = JSON.parse(window[s.name].cpAllRowData).filter(function (x) {
                        return x.SectionId == nodeKey;
                    })[0];
                    
                    if (result.ObjectId > 0) {

                        if (s.name == "SpecialObjectTree") {
                            RZMainTreeList.SpecialObject.NodeClick(s,e);
                        }
                        
                        AppV.pushState("Global",
                            {
                                ObjectId: result.ObjectId,
                                RecordId: -1,
                                ObjectGuid: "",
                                RecordGuid: "",
                                SubObjectGuid: result.SubObjectGuid || "",
                                SubObjectId: result.SubObjectId,
                                UrlEncrypted: "",
                                AddNewUrlEncrypted:result.UrlEncrypted,
                                SectionId: result.SectionId || "",
                                ObjectType: result.ObjectType,
                                GroupObjectId: result.GroupObjectId,
                                RelatedObjectId: result.RelatedObjectId
                            });

                        AppV.pushState("Filters",
                            {
                                ObjectId: result.ObjectId,
                                FilterId: parseInt(nodeKey.replace("filter", "")),
                                TreeName: s.name,
                                GroupObjectId: result.SubObjectId,
                                CalledFrom: s.cpModuleCalledFrom,
                                IsTaskFilter: false
                            });
                    } else {
                        AppV.pushState("Filters",{TreeName: s.name   });
                    }
                    

                    parentNodeKey = node.getAttribute("ParentNodeKey");
                }
            },
            OutSideCallForContextMenu: function () {
                var s = {};
                var e = {};
                s = window["MainTreeList"];
                e.objectType = "Node";
                e.objectKey = MainTreeList.focusedKey;
                var offset = $("#MainTreeMenuButton").offset();
                e.htmlEvent = { clientX: offset.left, clientY: offset.top };
                try {
                    RZMainTreeList.ContextMenu.Display(s, e);
                } catch (e) {
                    console.log(e);
                }
            },

            ItemClick: function (s, e) {
                switch (e.item.name) {
                    case "addFilter":
                        var menuPanel = window.mainSplFullScreenMode.GetPaneByName("mainSplRightPanel");
                        if (!isNaN(AppV.GetFiltersState.ObjectId)) {
                            if (menuPanel.IsCollapsed()) {
                                menuPanel.Expand();
                            }
                            RightPageControlPanel.SetActiveTabIndex(0);
                           
                            window.cbpFilterContent.PerformCallback({
                                objectId: AppV.GetFiltersState.ObjectId,
                                subObjectId: AppV.GetFiltersState.GroupObjectId
                            });
                        } else {
                            if (!menuPanel.IsCollapsed()) {
                                menuPanel.Collapse();
                                window.Filter.ClearFilterFields();
                                window.Filter.DisableFilterFields();
                            }
                        }

                        break;
                    case "editFilter":
                        if (!isNaN(AppV.GetFiltersState.FilterId)) {
                            View.load("pcModalEditFilter",
                                {
                                    filterId: AppV.GetFiltersState.FilterId
                                });
                        }
                        break;
                    case "deleteFilter":
                        if (!isNaN(AppV.GetFiltersState.FilterId)) {
                            View.load("pcRemoveFilter", {}, true, false);
                        }
                        break;
                    case "refreshTree":
                        _State.reload = true;
                        window[AppV.GetFiltersState.TreeName].PerformCallback();
                        break;
                    case "showRecords":

                        break;
                    case "addToFavorites":

                        break;
                    case "expandAllBtnCtx":
                        window[AppV.GetFiltersState.TreeName].ExpandAll();
                        break;
                    case "collapseAllBtnCtx":
                        window[AppV.GetFiltersState.TreeName].CollapseAll();
                        break;
                }

            }
        },
        SpecialObject: SpecialObject

    };
})();



;
(function () {
    var ShortcutRecent = {}
    ShortcutRecent.RecentObj = {};
    ShortcutRecent.ShortcutObj = {};
    //Recent
    ShortcutRecent.treeViewItemDoubleClick = function (s, e) {
        ShortcutRecent.RecentObj = window[s.globalName];
        s.GetNodeValues(e.nodeKey, 'UrlEncrypted;parentId;ObjectType;ObjectId;RecordGuid',function(res){
            res.origin = s;
            ShortcutRecent.CheckIfRecordNotDeleted(res);
        });
    }
    ShortcutRecent.OnContextMenuRecentTreeList = function (s, e) {
        if (e.objectType === "Node") {
            ShortcutRecent.RecentObj = window[s.globalName];
            s.SetFocusedNodeKey(e.objectKey);
            var x = ASPxClientUtils.GetEventX(e.htmlEvent);
            var y = ASPxClientUtils.GetEventY(e.htmlEvent);
            CtxMenuListRecentView.ShowAtPos(x, y);
        }
    }
    ShortcutRecent.Delete = function (key, deleteAll) {
        $.ajax({
            type: "POST",
            url: "/Recent/DeleteRecent",
            data: {
                RecentId: key,
                deleteAll: deleteAll
            },
            success: function () {
                Notification.SetNotification(SwResourceObject.RecordDeleted, 'success', 2500);

            if(ShortcutRecent.AreBothRecentTreesVisible())
                ShortcutRecent.RecentCpbBothPanels();
            else
                ShortcutRecent.GetRecentcpbObj().PerformCallback();

                mainPopup.Hide();
            },
            error: function () {
                Notification.SetNotification(SwResourceObject.ErrorDeletingItem, 'warning', 2500);
                mainPopup.Hide();
            }
        });
    }
    ShortcutRecent.OnItemClickCtxMenuRecentTreeView = function (s, e) {

        switch (e.item.name) {

            case "openRecord":
            ShortcutRecent.RecentObj.GetNodeValues(ShortcutRecent.RecentObj.GetFocusedNodeKey(),
                    "UrlEncrypted;parentId;ObjectType;ObjectId;RecordGuid", function(res){
                        res.origin = s;
                        ShortcutRecent.CheckIfRecordNotDeleted(res);
                    });
                break;

            case "remove":
                Helper.ShowConfirmPopUp("SolidWorks",
                    SwResourceObject.AreYouSureYouWantToDeleteSelectedItem,
                    "ShortcutRecent.Delete(" + ShortcutRecent.RecentObj.GetFocusedNodeKey() + ",false)");
                break;

            case "removeAll":
                Helper.ShowConfirmPopUp("SolidWorks",
                    SwResourceObject.AreYouSureYouWantToDeleteAllItems,
                    "ShortcutRecent.Delete('',true)");
                break;

            case "refreshTree":
                ShortcutRecent.GetRecentcpbObj().PerformCallback();
                break;
        }
    }


    // Shortcuts
    // ShortcutRecent.InitShortcutTree = function (s, e) {
    //     s.GetRowByNodeKey(parseInt(AppV.GetAdditionalInfo().selectedShortcutNodeKey));
    // }
    // ShortcutRecent.TreeClick = function (s, e) {
    //     AppV.PushAdditionalInfo("selectedShortcutNodeKey", e.nodeKey);
    // }
    ShortcutRecent.OnContextMenuShortcutTreeList = function (s, e) {
        if (e.objectType === "Node") {
            ShortcutRecent.ShortcutObj = window[s.globalName];
            s.SetFocusedNodeKey(e.objectKey);
            var x = ASPxClientUtils.GetEventX(e.htmlEvent);
            var y = ASPxClientUtils.GetEventY(e.htmlEvent);
            CtxMenuListShortcutView.ShowAtPos(x, y);
        }
    }
    ShortcutRecent.ShortcutTreeViewItemDoubleClick = function (s, e) {
        ShortcutRecent.ShortcutObj = window[s.globalName];
        s.GetNodeValues(e.nodeKey, 'UrlEncrypted;parentId;ObjectType;ObjectId;RecordGuid', ShortcutRecent.CheckIfRecordNotDeleted);
    }
    ShortcutRecent.CheckIfRecordNotDeleted = function (res) {
        if (res[3] == -1 || res[4] == -1)
            return;
        $.ajax({
            type: "POST",
            url: "/Shortcut/CheckIfShortcutIsDeleted",
            data: {
                objId: res[3],
                Recordguid: res[4]
            },
            success: function (result) {
                if (!result.checkedC) {
                    ShortcutRecent.OpenPropertyCard(res);
                } else {
                    if(typeof res.origin!="undefined"){
                        Helper.ShowConfirmPopUp("SolidWorks",
                        SwResourceObject.ThisShortcutIsNoLongerLinkedDoYouWantToDeleteIt,
                        "ShortcutRecent.Delete(" + ShortcutRecent.RecentObj.GetFocusedNodeKey() + ",false)");
                    }else{
                        Helper.ShowConfirmPopUp("SolidWorks",
                        SwResourceObject.ThisShortcutIsNoLongerLinkedDoYouWantToDeleteIt,
                        "ShortcutRecent.DeleteShortcut(" + ShortcutRecent.ShortcutObj.GetFocusedNodeKey() + ")");

                    }
                }
            },
            error: function () {
                Notification.SetNotification(SwResourceObject.ErrorDeletingItem, 'warning', 2500);
                mainPopup.Hide();
            }
        });
    }
    ShortcutRecent.DeleteShortcut = function (key) {
        $.ajax({
            type: "POST",
            url: "/Shortcut/DeleteShortcut",
            data: {
                ShortcutId: key
            },
            success: function () {
                Notification.SetNotification(SwResourceObject.RecordDeleted, 'success', 2500);
                if(ShortcutRecent.AreBothShortcutTreesVisible())
                    ShortcutRecent.ShortcutCpbBothPanels();
                else
                    ShortcutRecent.GetShortcutcpbObj().PerformCallback();
                mainPopup.Hide();
            },
            error: function () {
                Notification.SetNotification(SwResourceObject.ErrorDeletingItem, 'warning', 2500);
                mainPopup.Hide();
            }
        });
    }
    ShortcutRecent.OnItemClickCtxMenuShortcutTreeView = function (s, e) {

        switch (e.item.name) {

            case "openRecord":
            ShortcutRecent.ShortcutObj.GetNodeValues(ShortcutRecent.ShortcutObj.GetFocusedNodeKey(), 'UrlEncrypted;parentId;ObjectType;ObjectId;RecordGuid', ShortcutRecent.CheckIfRecordNotDeleted);
                //ShortcutContent.GetNodeValues(ShortcutContent.GetFocusedNodeKey(), 'UrlEncrypted;parentId;ObjectType', ShortcutRecent.OpenPropertyCard);
                break;

            case "remove":
            ShortcutRecent.ShortcutObj.GetNodeValues(ShortcutRecent.ShortcutObj.GetFocusedNodeKey(), 'parentId', function (result) {
                    if (result != -1 && ShortcutRecent.ShortcutObj.GetNodeState(ShortcutRecent.ShortcutObj.GetFocusedNodeKey()) == "Child")
                        Helper.ShowConfirmPopUp("SolidWorks",
                            SwResourceObject.AreYouSure,
                            "ShortcutRecent.DeleteShortcut(" + ShortcutRecent.ShortcutObj.GetFocusedNodeKey() + ")");
                    else
                        Notification.SetNotification(SwResourceObject.CannotDeleteRootFolders, "warning", 2500);
                });

                break;

            case "rename":
            ShortcutRecent.ShortcutObj.GetNodeValues(ShortcutRecent.ShortcutObj.GetFocusedNodeKey(), 'DisplayName;ShortcutId',
                    function (result) {
                        if (result === 'undefined' || result.length === 0) {
                            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                            return;
                        }
                        //addShortCutPopUp.PerformCallback({
                        //    "ObjectId": 0,
                        //    "ObjectType": 0,
                        //    "DisplayName": result[0],
                        //    "RecordId": 0,
                        //    "ShortcutId": result[1]
                        //});
                        //addShortCutPopUp.Show();
                        View.load("addShortCutPopUp",
                            {
                                "ObjectId": 0,
                                "ObjectType": 0,
                                "DisplayName": result[0],
                                "RecordId": 0,
                                "ShortcutId": result[1]
                            });
                    });

                break;

            case "refreshTree":
                ShortcutRecent.GetShortcutcpbObj().PerformCallback();
                break;

            case "expandAllBtnCtx":
                ShortcutRecent.ShortcutObj.ExpandAll();
                break;
        }
    }
    ShortcutRecent.AddShortcut = function (objectIdP,objectType,recordId) {
        var shortcut = 0;
        if (typeof ShortcutId !== "undefiend")
            shortcut = document.getElementById("ShortcutIdHiddenVal").value;//ShortcutId.GetValue();
        var objectId = objectIdP||AppV.GetGlobals().ObjectId;
        var ObjectType = objectType||AppV.GetGlobals().ObjectType;
        var RecordId = recordId||AppV.GetGlobals().RecordId;
        var displayName = ShortcutDisaplyName.GetValue();

        if (!displayName || 0 === displayName.length || displayName.trim() === "") {
            Notification.SetNotification(SwResourceObject.PleaseEnterADescription, 'warning', 3500);
            return;
        }

        if (shortcut != 0) {
            objectId = ObjectType = RecordId = 0;
        }

        $.ajax({
            type: "POST",
            url: '/Shortcut/AddNewShortcut/',
            data: {
                "ObjectId": objectId,
                "ObjectType": ObjectType,
                "DisplayName": displayName,
                "RecordId": RecordId,
                "ShortcutId": shortcut,
                "IsProcess": AppV.GetGlobals().ObjectType == enums.ObjectTypes.Processes
            },
            dataType: "json",
            success: function (response) {
                var res = JSON.parse(response.data);
                addShortCutPopUp.Hide();
                if (!res.Success) {
                    Notification.SetNotification(res.Message, 'error', 3500);
                } else {
                    Notification.SetNotification(res.Message, 'success', 3500);
                    if (ShortcutRecent.GetShortcutcpbObj().IsVisible()){
                        if(ShortcutRecent.AreBothShortcutTreesVisible())
                            ShortcutRecent.ShortcutCpbBothPanels();
                        else
                            ShortcutRecent.GetShortcutcpbObj().PerformCallback();
                    }
                        
                }
            },
            fail: function (response) {
                //alert(response);
            }
        });
    }

    //Open PropertyCard
    ShortcutRecent.OpenPropertyCard = function (result) {
        var objTypes = ["0", "11", "12", "14", "22", "17"];
        if (result[1] != -1)// && objTypes.includes(result[2].toString()))
            Helper.open('/PropertyCard/Index/' + result[0], '_blank');
        else
            Notification.SetNotification(SwResourceObject.OpensDocumentTypesOnly, "warning", 2500);

    }
    ShortcutRecent.GetShortcutcpbObj = function () {
        if (!Helper.IsObjectEmpty(ShortcutRecent.ShortcutObj)) {
            if (ShortcutRecent.ShortcutObj.name.endsWith(0))
                return cbpShortcutContentDashboard;
            else
                return cbpShortcutContent;
        } else {
            return cbpShortcutContent;
        }
        
    }
    ShortcutRecent.ShortcutCpbBothPanels= function(){
        cbpShortcutContentDashboard.PerformCallback();
        cbpShortcutContent.PerformCallback();
    }
    ShortcutRecent.RecentCpbBothPanels= function(){
        cbpListContentDashboard.PerformCallback();
        cbpListContent.PerformCallback();
    }
    ShortcutRecent.AreBothShortcutTreesVisible = function(){
        return Helper.IsElementVisible(document.getElementById("ShortcutContent0"))&&Helper.IsElementVisible(document.getElementById("ShortcutContent1"));
    }
    ShortcutRecent.AreBothRecentTreesVisible = function(){
        return Helper.IsElementVisible(document.getElementById("RecentListContent0"))&&Helper.IsElementVisible(document.getElementById("RecentListContent1"));
    }
    ShortcutRecent.GetRecentcpbObj = function(){
        if(ShortcutRecent.RecentObj.name.endsWith(0))
            return cbpListContentDashboard;
        else 
            return cbpListContent;
    } 

    window.ShortcutRecent = ShortcutRecent;

})();



;
(function () {
    var MenuBar = {};

    MenuBar.NbMenuViewItemClick = function (s, e) {
        UI.notify(Helper.PrepareObject(s, e));
        MainRibbonV.SetActiveTabSelectedMainRibbon(s.GetSelectedItem().name);
        if (s.GetSelectedItem().name == AppV.GetGlobals().ModuleName) {
            e.cancel = true;
            return;
        }

        //TODO: Uncomment and check if grid and tree is rendered
        if (MainTreeList.InCallback()
            || cbpDocumetGrid.InCallback()
            || gridViewDocuments.InCallback()
            || cbpPropertyCardSectionBottom.InCallback()) {
            e.cancel = true;
            //s.SetSelectedItem(MenuBar.LastSelectedVal);
            return;
        }

        //MenuBar.LastSelectedVal = s.GetSelectedItem();
        RZMainTreeList.AdujstTaskTree();

        AppV.clearState('HomeObject');

        AppV.pushGlobalState("ModuleName", s.GetSelectedItem().name);
        AppV.pushGlobalState("currentPage", enums.Paggination.currentPage);
        AppV.pushGlobalState("currentPage", enums.Paggination.currentPage);
        setmenuLabelText(s);

        RZMainTreeList.EndCallback();
        Helper.CreateCookie("ModuleName", AppV.GetGlobals().ModuleName, "365");
        Main.Splitter.applyChangesOnModuleChange();

        window.mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").CollapseForward();
        //window.mainSplFullScreenMode.GetPaneByName("splFiltersPane").CollapseForward();


        //window.gridViewDocuments.SetVisible(false);
        window.App.Global.SplitterResize();
        var url = RootUrl + '';
        window.history.pushState({ urlPath: url }, null, url);

        //window.App.GridView.Callback.TreeView(AppV.GetGlobals().ModuleName, true);
        window.cbpSectionCallback.PerformCallback(
            {
                topMenuSelected: AppV.GetGlobals().ModuleName,
                cache: true
            });

        MenuBar.SetDashboardVisibility();

    };
    MenuBar.SetDashboardVisibility = function () {
        var dashboard = MainRibbon.GetTabByName("Dashboard");
        var element = document.getElementById("MainRibbon_TC_T3T");
        if (AppV.GetGlobals().ModuleName === enums.Modules.Home) {
            if (dashboard != null && element != null) {
                dashboard.SetEnabled(true);
                element.style.visibility = 'visible';
                dashboard.getListElement().style.visibility = 'visible';
            
            }
        } else {
            if (dashboard != null && element != null) {
                dashboard.SetEnabled(false);
                dashboard.getListElement().style.visibility = 'hidden';
                element.style.visibility = 'hidden';
            }
        }
    };
    MenuBar.NbMenuViewInit = function (s, e) {
        var modul = nbMenuRZ.GetItemByName(s.cpSelectedMenuName);
        //MenuBar.LastSelectedVal = modul;
        nbMenuRZ.SetSelectedItem(modul);
        if (s.GetSelectedItem() !== null)
            AppV.pushGlobalState("ModuleName", s.GetSelectedItem().name);
        UI.notify(Helper.PrepareObject(s, e));
        setmenuLabelText(s);
        Main.Splitter.applyChangesOnModuleChange();
    }

    MenuBar.NbHomeMenuItemClick = function (s, e) {

        var homeModuleItemSelected = s.GetSelectedItem().name;



        AppV.pushState('HomeObject', { MenuSelected: homeModuleItemSelected });
        Main.Splitter.applyChangesOnModuleChange(homeModuleItemSelected);

        if (homeModuleItemSelected === enums.HomeModules.Tasks || homeModuleItemSelected === enums.HomeModules.Timesheets) {
            //window.mainSplFullScreenMode.GetPaneByName("splFiltersPane").Expand();
            View.load('MainTaskFilters', { homeModulesSelected: homeModuleItemSelected }, false);
        }
        if (homeModuleItemSelected === enums.HomeModules.Tasks || homeModuleItemSelected === enums.HomeModules.MyWork
            || homeModuleItemSelected === enums.HomeModules.Timesheets) {
            window.cbpDocumetGrid.PerformCallback({
                HomeModuleName: AppV.GetHomeObjects().MenuSelected
            });
        }

    }

    function setmenuLabelText(s) {
        //MenuBar.LastSelectedVal = s.GetSelectedItem();
        var nbMenuSelected = document.getElementById("nbMenuRZ").getElementsByClassName("dxnb-itemSelected");
        if (nbMenuSelected.length > 0) {
            document.getElementById("menuLabelDv").innerHTML = nbMenuSelected[0].innerHTML;
        }
    }

    window.MenuBar = MenuBar;
})();
;
(function () {

    var tasks = {};

    var State = {
        CommentSelectedId: -1,
        ShouldClosePopup: true
    };

    tasks.FormStatus = {
        NewTask: 0,
        NewFromTask: 1,
        OwnerTask: 2,
        AssignedTask: 3,
        OwnerAndAssigned: 4,
        AssignerTask: 5,
        Viewer: 6,
        SingleAssignerTask: 7
    };

    // Enable/Disable controls
    tasks.EnableDisableTasksControls = function (s, section = "") {
        try {
            switch (s.cpTaskFormStatus) {

                case window.Tasks.FormStatus.NewTask:
                case window.Tasks.FormStatus.NewFromTask:
                    tasks.viewFormForNew(s.cpIsUserAdmin, s.cpIsViewerLicense, s.cpTaskIsFinished, s.cpIsAssignedOnlyToMe, s.cpTaskFormStatus,
                        s.cpTaskDisabledComplete, section);
                    EnableDisableField("AddDetailsPropertiesTask", true);
                    EnableDisableField("RemoveDetailsPropertiesTask", true);
                    break;

                case window.Tasks.FormStatus.OwnerTask:
                    tasks.viewFormForOwner(s.cpIsUserAdmin, s.cpIsViewerLicense, s.cpTaskIsFinished, s.cpTaskDisabledComplete, s.cpTaskFormStatus, section);
                    EnableDisableField("AddDetailsPropertiesTask", true);
                    EnableDisableField("RemoveDetailsPropertiesTask", true);
                    break;

                case window.Tasks.FormStatus.AssignedTask:
                    tasks.viewFormForAssignedTask(s.cpIsUserAdmin, s.cpIsViewerLicense, s.cpTaskIsFinished,
                        s.cpIsAssignedOnlyToMe, s.cpTaskFormStatus, s.cpAssignedUsersCanAddAttachments, s.cpAssignedUsersCanRemoveAttachments, section);
                    EnableDisableField("AddDetailsPropertiesTask", false);
                    EnableDisableField("RemoveDetailsPropertiesTask", false);
                    break;

                case window.Tasks.FormStatus.OwnerAndAssigned:
                    tasks.viewFormForOwnerAndAssigner(s.cpIsUserAdmin, s.cpIsViewerLicense, s.cpTaskIsFinished,
                        s.cpIsAssignedOnlyToMe, s.cpTaskFormStatus, s.cpTaskDisabledComplete, section);
                    EnableDisableField("AddDetailsPropertiesTask", true);
                    EnableDisableField("RemoveDetailsPropertiesTask", true);
                    break;

                case window.Tasks.FormStatus.AssignerTask:
                    tasks.ViewFormForAssigner(s.cpIsUserAdmin, s.cpIsViewerLicense, s.cpTaskIsFinished, s.cpHasAssignment, section);
                    EnableDisableField("AddDetailsPropertiesTask", false);
                    EnableDisableField("RemoveDetailsPropertiesTask", false);
                    break;

                case window.Tasks.FormStatus.Viewer:
                    tasks.ViewFormForViewer(s.cpIsUserAdmin, s.cpIsViewerLicense, s.cpTaskIsFinished, section);
                    EnableDisableField("AddDetailsPropertiesTask", false);
                    EnableDisableField("RemoveDetailsPropertiesTask", false);
                    break;
            }

        } catch (ex) {
            console.log(ex);
        }
    };

    tasks.viewFormForNew = function (IsUserAdmin, IsViewerLicense, taskIsFinished, isAssignedToMeOnly, taskFormStatus, taskDisableComplete, section) {

        tasks.viewFormForOwnerAndAssigner(IsUserAdmin, IsViewerLicense, taskIsFinished, isAssignedToMeOnly, taskFormStatus, taskDisableComplete, section);

        if (section !== "" &&
            section !== null &&
            section !== undefined)
            switch (section) {
                case "UsersSection":
                    EnableDisableField("btnChangeOwner", false);
                    return;
                case "NotificationsSection":
                    return;
                default:
            }

        DisableTaskRibbonItems("deleteTask");
        DisableTaskRibbonItems("assignTo");
        DisableTaskRibbonItems("markAsComplete");

        tasks.EnableDisableReminders(window.reminderTask.GetValue(), taskFormStatus);

        EnableDisableField("AddNotesPropertiesTask", false);
        //window.RemoveNotesPropertiesTask.SetEnabled(false);

        //window.reminderTask.SetEnabled(true);
        EnableDisableInputType("reminderTask", false);

        EnableDisableInputType("completePercentage", false);
        EnableDisableField("calculateCompletionFromList", false);
    };

    tasks.viewFormForOwner = function (IsUserAdmin, IsViewerLicense, taskIsFinished, taskDisableComplete, taskFormStatus, section) {

        tasks.ViewFormForViewer(IsUserAdmin, IsViewerLicense, taskIsFinished, section);

        if (section !== "" &&
            section !== null &&
            section !== undefined)
            switch (section) {
                case "UsersSection":
                    if (IsViewerLicense == false) {
                        EnableDisableField("btnChangeOwner", true);
                    }
                    EnableDisableInputType("usersCheckListBoxDropDown", false);
                    return;
                case "NotificationsSection":
                    tasks.NotificationSectionRights(true);
                    return;
                default:
            }

        //barBtnStage.Enabled = True;

        EnableDisableField("AddAttachementPropertiesTask", true);
        EnableDisableField("RemoveAttachementPropertiesTask", true);

        //window.AddNotesPropertiesTask.SetEnabled(true);
        //window.RemoveNotesPropertiesTask.SetEnabled(true);

        EnableTaskRibbonItems("saveAndClose");
        EnableTaskRibbonItems("save");
        EnableTaskRibbonItems("markAsComplete");

        if (taskDisableComplete == true) {
            //window.statusTask.SetEnabled(true);
            EnableDisableInputType("statusTask", false);
        }

        var calculateCompletionFromTimeAllocated = window.calculateCompletionFromTimeAllocated.GetValue();

        if (calculateCompletionFromTimeAllocated == false) {
            //completePercentage.GetInputElement().readOnly = false;
            EnableDisableInputType("completePercentage", true);
            EnableDisableField("calculateCompletionFromList", false);
            //ASPxClientUtils.DetachEventFromElement(completePercentage.GetMainElement(), "mousedown", OnMouseDown);

            //window.statusTask.SetEnabled(true);
            EnableDisableInputType("statusTask", false);
        }

        var timeAllocated = window.timeAllocated.GetValue();
        if (timeAllocated == 0) {
            EnableTaskRibbonItems("markAsComplete");

            //completePercentage.GetInputElement().readOnly = false;
            EnableDisableInputType("completePercentage", true);
            EnableDisableField("calculateCompletionFromList", true);
            //ASPxClientUtils.DetachEventFromElement(completePercentage.GetMainElement(), "mousedown", OnMouseDown);

            //window.statusTask.SetEnabled(true);
            EnableDisableInputType("statusTask", false);
        }

        EnableTaskRibbonItems("assignTo");
        EnableTaskRibbonItems("deleteTask");
        EnableTaskRibbonItems("private");

        EnableDisableField("allDayChb", true);
        //window.allDayChb.SetEnabled(true);
        //EnableDisableInputType("allDayChb", false);

        tasks.EnableDisableReminders(window.reminderTask.GetValue(), taskFormStatus);

        window.subjectTask.GetInputElement().readOnly = false;

        //window.startDate.SetEnabled(true);
        EnableDisableInputType("startDate", false);
        //window.endDate.SetEnabled(true);
        EnableDisableInputType("endDate", false);

        //window.statusTask.SetEnabled(true);
        EnableDisableInputType("statusTask", false);
        //window.priorityTask.SetEnabled(true);
        EnableDisableInputType("priorityTask", false);

        //window.timeAllocated.SetEnabled(true);
        //EnableDisableInputType("timeAllocated", false);

        var enableCalculateFromTimeAllocated = !taskDisableComplete;
        EnableDisableField("calculateCompletionFromTimeAllocated", enableCalculateFromTimeAllocated);
        //window.calculateCompletionFromTimeAllocated.SetEnabled(enableCalculateFromTimeAllocated);
        //EnableDisableInputType("calculateCompletionFromTimeAllocated", !enableCalculateFromTimeAllocated);

        EnableDisableField("reminderTask", true);
        //window.reminderTask.SetEnabled(true);
        EnableDisableInputType("reminderTask", false);
    };

    tasks.viewFormForAssignedTask = function (IsUserAdmin, IsViewerLicense, taskIsFinished, isAssignedToMeOnly, taskFormStatus,
        assignedUsersCanAddAttachments, assignedUsersCanRemoveAttachments, section) {

        tasks.ViewFormForViewer(IsUserAdmin, IsViewerLicense, taskIsFinished, section);

        if (section !== "" &&
            section !== null &&
            section !== undefined)
            switch (section) {
                case "UsersSection":
                    if (IsUserAdmin) {
                        if (IsViewerLicense == false) {
                            window.btnChangeOwner.SetEnabled(true);
                        }
                        else {
                            window.btnChangeOwner.SetEnabled(false);
                        }
                    }
                    return;
                case "NotificationsSection":
                    EnableDisableField("NotifyAssignedToChb", true);
                    EnableDisableField("NotifyAssignedToEveryChb", true);
                    return;
                default:
            }

        EnableDisableField("AddAttachementPropertiesTask", true);
        EnableDisableField("RemoveAttachementPropertiesTask", true);
        //btnItemProperties.Enabled = True

        EnableDisableField("AddNotesPropertiesTask", true);
        //window.RemoveNotesPropertiesTask.SetEnabled(true);

        EnableTaskRibbonItems("saveAndClose");
        EnableTaskRibbonItems("save");

        EnableDisableField("AddTimeShiftProgressTask", true);
        EnableDisableField("RemoveTimeShiftProgressTask", true);
        EnableDisableField("GoToPropertiesTimeShiftProgressTask", true);
        EnableDisableField("AddShiftSaveAndClose", true);

        EnableTaskRibbonItems("assignTo");

        if (isAssignedToMeOnly) {
            var calculateCompletionFromTimeAllocated = window.calculateCompletionFromTimeAllocated.GetValue();
            var timeAllocated = window.timeAllocated.GetValue();

            if (calculateCompletionFromTimeAllocated == false || timeAllocated === 0) {

                //completePercentage.GetInputElement().readOnly = false;
                EnableDisableInputType("completePercentage", true);
                EnableDisableField("calculateCompletionFromList", false);
                ASPxClientUtils.DetachEventFromElement(completePercentage.GetMainElement(), "mousedown", OnMouseDown);

                EnableTaskRibbonItems("save");
                EnableTaskRibbonItems("saveAndClose");
                EnableTaskRibbonItems("markAsComplete");
            }
            EnableDisableField("reminderTask", true);
            //chkCboRemindUsers.Properties.Items(TaskRemindType.Assigned_To).Enabled = True
        }

        tasks.EnableDisableReminders(window.reminderTask.GetValue(), taskFormStatus);  

        EnableDisableField("AddAttachementPropertiesTask", assignedUsersCanAddAttachments);
        EnableDisableField("RemoveAttachementPropertiesTask", assignedUsersCanRemoveAttachments);
    };

    tasks.viewFormForOwnerAndAssigner = function (IsUserAdmin, IsViewerLicense, taskIsFinished, isAssignedToMeOnly, taskFormStatus, taskDisableComplete, assignedUsersCanAddAttachments, assignedUsersCanRemoveAttachments, section) {

        tasks.viewFormForAssignedTask(IsUserAdmin, IsViewerLicense, taskIsFinished, isAssignedToMeOnly, taskFormStatus, assignedUsersCanAddAttachments, assignedUsersCanRemoveAttachments);

        if (section !== "" &&
            section !== null &&
            section !== undefined)
            switch (section) {
                case "UsersSection":
                    if (IsUserAdmin) {
                        if (IsViewerLicense === false) {
                            EnableDisableField("btnChangeOwner", true);
                        }
                    } else {
                        EnableDisableField("btnChangeOwner", false);
                    }
                    
                    EnableDisableInputType("usersCheckListBoxDropDown", false);
                    return;
                case "NotificationsSection":
                    tasks.NotificationSectionRights(true);
                    return;
                default:
            }

        //window.AddNotesPropertiesTask.SetEnabled(true);
        //window.RemoveNotesPropertiesTask.SetEnabled(true);
        EnableDisableField("AddAttachementPropertiesTask", true);
        EnableDisableField("RemoveAttachementPropertiesTask", true);

        if (taskDisableComplete == false) {
            var calculateCompletionFromTimeAllocated = window.calculateCompletionFromTimeAllocated.GetValue();
            if (calculateCompletionFromTimeAllocated == false) {

                //window.completePercentage.SetEnabled(true);
                EnableDisableInputType("completePercentage", false);
                EnableDisableField("calculateCompletionFromList", true);
                //btnCompleteInfo.Visible = False
                EnableTaskRibbonItems("markAsComplete");

                //window.statusTask.SetEnabled(true);
                EnableDisableInputType("statusTask", false);
            }
        }
        var timeAllocated = window.timeAllocated.GetValue();
        if (timeAllocated == 0) {
            EnableTaskRibbonItems("markAsComplete");

            //window.completePercentage.SetEnabled(true);
            EnableDisableInputType("completePercentage", false);
            EnableDisableField("calculateCompletionFromList", true);
            //window.statusTask.SetEnabled(true);
            EnableDisableInputType("statusTask", false);
        }

        EnableTaskRibbonItems("assignTo");
        EnableTaskRibbonItems("deleteTask");
        EnableTaskRibbonItems("private");

        EnableDisableField("allDayChb", true);
        //EnableDisableInputType("allDayChb", false);
        
        window.subjectTask.GetInputElement().readOnly = false;

        //window.startDate.SetEnabled(true);
        EnableDisableInputType("startDate", false);

        //window.endDate.SetEnabled(true);
        EnableDisableInputType("endDate", false);

        //window.priorityTask.SetEnabled(true);
        EnableDisableInputType("priorityTask", false);

        //window.timeAllocated.SetEnabled(true);
        EnableDisableInputType("timeAllocated", false);

        var enableCalculateFromTimeAllocated = !taskDisableComplete;
        //EnableDisableInputType("calculateCompletionFromTimeAllocated", !enableCalculateFromTimeAllocated);
        EnableDisableField("calculateCompletionFromTimeAllocated", enableCalculateFromTimeAllocated);

        if ((!enableCalculateFromTimeAllocated) === true) {
            window.calculateCompletionFromTimeAllocated.SetValue(true);
            $("#AddTaskProgressViewModel_CalculateFromTimeAllocated").val(true);
        }

        //window.calculateCompletionFromTimeAllocated.SetEnabled(enableCalculateFromTimeAllocated);

        //if (enableCalculateFromTimeAllocated) {
        //    window.calculateCompletionFromTimeAllocated.SetValue(true);

        //}

        tasks.EnableDisableReminders(window.reminderTask.GetValue(), taskFormStatus);

        //chkCboRemindUsers.Properties.Items(TaskRemindType.Owner).Enabled = True
        //chkCboRemindUsers.Properties.Items(TaskRemindType.Creator).Enabled = True
        //chkCboRemindUsers.Properties.Items(TaskRemindType.Assigned_By).Enabled = True
        //chkCboRemindUsers.Properties.Items(TaskRemindType.Assigned_To).Enabled = True

        //window.reminderTask.SetEnabled(true);
        EnableDisableInputType("reminderTask", false);
    };

    tasks.ViewFormForAssigner = function (IsUserAdmin, IsViewerLicense, taskIsFinished, hasAssignment, section) {

        tasks.ViewFormForViewer(IsUserAdmin, IsViewerLicense, taskIsFinished);

        if (section !== "" &&
            section !== null &&
            section !== undefined)
            switch (section) {
                case "UsersSection":
                    return;
                case "NotificationsSection":
                    EnableDisableField("NotifyAssignedByChb", true);
                    EnableDisableField("NotifyAssignedByEveryChb", true);
                    return;
                default:
            }

        //window.reminderTask.SetEnabled(true);
        EnableDisableInputType("reminderTask", false);

        if (hasAssignment == true) {
            EnableTaskRibbonItems("assignTo");
        }
        //chkCboRemindUsers.Properties.Items(TaskRemindType.Assigned_By).Enabled = True

    };

    tasks.ViewFormForViewer = function (isAdmin, hasViewerLicense, taskIsFinished, section) {

        if (section !== "" &&
            section !== null &&
            section !== undefined)
            switch (section) {
                case "UsersSection":
                    if (isAdmin === true) {
                        if (!taskIsFinished) {
                            if (hasViewerLicense == false) {
                                EnableDisableField("btnChangeOwner", true);
                            }
                            EnableTaskRibbonItems("assignTo");
                        }
                    } else {
                        EnableDisableField("btnChangeOwner", false);
                    }

                    EnableDisableInputType("usersCheckListBoxDropDown", true);
                    return;
                case "NotificationsSection":
                    tasks.NotificationSectionRights(false);
                    return;
                default:
            }

        //Disable task ribbon items
        DisableTaskRibbonItems("saveAndClose");
        DisableTaskRibbonItems("save");
        DisableTaskRibbonItems("markAsComplete");
        DisableTaskRibbonItems("assignTo");
        DisableTaskRibbonItems("private");
        DisableTaskRibbonItems("deleteTask");
        
        window.subjectTask.GetInputElement().readOnly = true;

        AddAttachementPropertiesTask.SetEnabled(false);
        RemoveAttachementPropertiesTask.SetEnabled(false);

        //window.statusTask.SetEnabled(false);
        EnableDisableInputType("statusTask", true);

        //window.priorityTask.SetEnabled(false);
        EnableDisableInputType("priorityTask", true);

        //window.completePercentage.SetEnabled(false);
        EnableDisableInputType("completePercentage", true);
        EnableDisableField("calculateCompletionFromList", false);
        window.allDayChb.SetEnabled(false);
        //EnableDisableInputType("allDayChb", true);

        //window.startDate.SetEnabled(false);
        EnableDisableInputType("startDate", true);

        //window.endDate.SetEnabled(false);
        EnableDisableInputType("endDate", true);

        //window.timeAllocated.SetEnabled(false);
        EnableDisableInputType("timeAllocated", true);

        //window.AddNotesPropertiesTask.SetEnabled(false);
        //window.RemoveNotesPropertiesTask.SetEnabled(false);

        //window.AddDetailsPropertiesTask.SetEnabled(false);
        //window.RemoveDetailsPropertiesTask.SetEnabled(false);

        //window.RemoveAttachementPropertiesTask.SetEnabled(false);

        //window.btnSaveNotificationTask.SetEnabled(false);

        EnableDisableField("calculateCompletionFromTimeAllocated", false);
        //EnableDisableInputType("calculateCompletionFromTimeAllocated", true);
        EnableDisableField("AddTimeShiftProgressTask", false);
        EnableDisableField("RemoveTimeShiftProgressTask", false);
        EnableDisableField("GoToPropertiesTimeShiftProgressTask", false);
        EnableDisableField("AddShiftSaveAndClose", false);

        if (isAdmin === true) {
            if (!taskIsFinished) {
                EnableTaskRibbonItems("assignTo");
            }
        }
    };

    tasks.NotificationSectionRights = function (enable) {
        //Notifications
        EnableDisableField("NotifyOwnerChb", enable);
        EnableDisableField("NotifyCreatedByChb", enable);
        EnableDisableField("NotifyAssignedToChb", enable);
        EnableDisableField("NotifyAssignedByChb", enable);
        EnableDisableField("NotifyOwnerEveryChb", enable);
        EnableDisableField("NotifyCreatedByEveryChb", enable);
        EnableDisableField("NotifyAssignedToEveryChb", enable);
        EnableDisableField("NotifyAssignedByEveryChb", enable);
    };

    tasks.EnableDisableReminders = function (IsEnable, taskFormStatus) {
        switch (taskFormStatus) {
            case window.Tasks.FormStatus.AssignedTask:
            case window.Tasks.FormStatus.AssignerTask:
            case window.Tasks.FormStatus.SingleAssignerTask:
            case window.Tasks.FormStatus.NewTask:
            case window.Tasks.FormStatus.NewFromTask:
            case window.Tasks.FormStatus.OwnerAndAssigned:
            case window.Tasks.FormStatus.OwnerTask:
                //window.usersPropertiesCheckListBox.SetEnabled(true);
                EnableDisableInputType("usersPropertiesCheckListBoxDropDowncheckListBox", false);
                break;
            default:
                //window.usersPropertiesCheckListBox.SetEnabled(false);
                EnableDisableInputType("usersPropertiesCheckListBoxDropDowncheckListBox", true);
        }
    };

    tasks.ChangeHeaderText = function (s) {
        if (s.cpIsAddNew === false) {
            s.SetHeaderText(s.cpTaskSubject);
        } else {
            s.SetHeaderText(SwResourceObject.Task);
        }
    };

    function DisableTaskRibbonItems(name) {
        var item = window.tasksRibbon.GetItemByName(name);
        item.SetEnabled(false);
    }

    function EnableTaskRibbonItems(name) {
        var item = window.tasksRibbon.GetItemByName(name);
        item.SetEnabled(true);
    }

    function EnableDisableInputType(inputName, isDisabled) {

        //var elementControl = ASPxClientControl.GetControlCollection().GetByName(inputName);

        if (window[inputName] === undefined ||
            window[inputName] === null ||
            window[inputName].GetInputElement() === null)
            return;

        if (window[inputName].GetInputElement() === null)
            console.log(window[inputName]);

        window[inputName].GetInputElement().readOnly = isDisabled;

        if (isDisabled === true) {
            ASPxClientUtils.AttachEventToElement(window[inputName].GetMainElement(), "mousedown", OnMouseDown);
            window[inputName].GetInputElement().className = window[inputName].GetInputElement().className.concat(' dxeDisabled');

            // var control = window[inputName];
            //if (control instanceof ASPxClientCheckBox) {
            //    control.ReadOnly = true;
            //    //window[inputName].SetEnabled(false);
            //    var el = control.GetInputElement();
            //    el.setAttribute("onclick", "return false;");
            //    el.setAttribute("onkeydown", "return false;");
            //    window[inputName].GetInputElement().className = window[inputName].GetInputElement().className.concat(' aspNetDisabled');
            //}
        }
        else {
            ASPxClientUtils.DetachEventFromElement(window[inputName].GetMainElement(), "mousedown", OnMouseDown);
            window[inputName].GetInputElement().className = window[inputName].GetInputElement().className.replace('dxeDisabled', '');

            //var control = window[inputName];
            //if (control instanceof ASPxClientCheckBox) {
            //    window[inputName].GetInputElement().className = window[inputName].GetInputElement().className.replace('aspNetDisabled', '');
            //}
        }
    }

    function EnableDisableField(fieldName, isEnabled) {
        var item = window[fieldName];
        if (item === null ||
            typeof item === "undefined" ||
            item === undefined ||
            !ASPxClientUtils.IsExists(item)) {
            return;
        }

        if (item.disabled === null)
            return;

        item.SetEnabled(isEnabled);
    }

    tasks.CreateSingleTaskforMultipleItems = function (values, singleTask, objectId) {
        var selectedData = [];
        var objectId = -1;
        var recordGuid = '';

        for (var row = 0; row < values.length; row++) {
            objectId = -1;
            recordGuid = '';

            try {
                objectId = values[row].ParentObjectID;
            } catch (e) {

            }

            if (objectId === -1) {
                objectId = values[row].ParentObjectID;
            }

            if (objectId === -999) {
                continue;
            }

            recordGuid = values[row].ParentGuid;

            if (objectId > 0 && recordGuid !== "") {
                selectedData.push({
                    RecordGuid: recordGuid,
                    ObjectId: objectId
                });
            }
        }

        if (selectedData.length < values.length) {
            Notification.SetNotification(SwResourceObject.ThisIsNotAvailableForManualBomRows, 'warning', 3000);
            return;
        }

        if (singleTask == true) {

            if (typeof CreateTaskPopUp !== "undefined" && ASPxClientUtils.IsExists(CreateTaskPopUp)) {
                CreateTaskPopUp.PerformCallback({
                    objectId: objectId,
                    objectRecordGuidids: selectedData
                });
                CreateTaskPopUp.Show();
            }
            else {
                View.load("CreateTaskPopUp",
                    {
                        objectId: objectId,
                        objectRecordGuidids: selectedData
                    });
            }
        }
        else {
            //create one task per item (multiple tasks)
            //for (var recordItem = 0; recordItem < selectedData.length; recordItem++) {
            //    window.CreateTaskPopUp.Show();
            //    window.CreateTaskPopUp.PerformCallback(
            //        {
            //            objectRecordGuidids: selectedData[recordItem]
            //        });
            //}

        }
    };

    tasks.OnTasksRibbonInit = function (s, e) {

        tasks.ribbonStateChange(s, e);
        ShowTaskSection("Properties");
        var isPrivate = document.getElementById('AddTaskRibbonViewModel_IsPrivate').value;
        var ribbonIsPrivate = ((isPrivate === "True") ? true : false);
        tasksRibbon.GetItemByName('private').SetValue(ribbonIsPrivate);
    };

    tasks.ribbonStateChange = function (s, e) {
        var menuPanel = splFullScreenModeTasks.GetPaneByName("pltopMenuBarTasks");
        var minSize = parseInt(tasksRibbon.GetHeight());
        menuPanel.SetSize(minSize);
    };

    tasks.OnTasksActiveTabClick = function (s, e) {
        var sectionName = e.tab.name;
        ShowTaskSection(sectionName);
    };

    tasks.GoToPropertiesAttachementModalButtonClick = function (s, e) {

        if (window.HomeTaskAttachementsGrid.rowCount == 0) {
            return;
        }

        var hasFocusedNode = tasks.checkTreelistHasFocusedItem("HomeTaskAttachementsGrid");
        if (!hasFocusedNode) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }
        var result = Helper.FilterTreelistFocusedNodeKey
            ("HomeTaskAttachementsGrid", "TaskItemId", HomeTaskAttachementsGrid.GetFocusedNodeKey())[0];

        if (typeof (result) === 'undefined' || result == null) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }
        Helper.open('/PropertyCard/Index/' + result.UrlEncrypted, '_blank');

    };

    tasks.GoToPropertiesAttachement = function (s, e) {

        if (window.AddTaskAttachementsGrid.rowCount == 0) {
            return;
        }

        var hasFocusedNode = tasks.checkTreelistHasFocusedItem("AddTaskAttachementsGrid");
        if (!hasFocusedNode) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }

        window.AddTaskAttachementsGrid.GetNodeValues(window.AddTaskAttachementsGrid.GetFocusedNodeKey(), 'UrlEncrypted', function (result) {
            var idS = result;
            if (typeof (result) === 'undefined' || result == null) {
                Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                return;
            }
            Helper.open('/PropertyCard/Index/' + idS, '_blank');
        });
    };

    tasks.ShowRemoveAttachementModalButtonClick = function (s, e) {

        if (window.AddTaskAttachementsGrid.rowCount == 0) {
            return;
        }

        var hasFocusedNode = tasks.checkTreelistHasFocusedItem("AddTaskAttachementsGrid");
        if (!hasFocusedNode) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }

        Helper.ShowConfirmPopUp("SolidWorks",
            SwResourceObject.AreYouSure,
            "Tasks.RemoveAttachment()");
        return;
    };

    tasks.RemoveAttachment = function() {

        var taskItemId,
            taskIdentifier = $("#taskId").val(),
            objectType,
            partNumber;

        window.AddTaskAttachementsGrid.GetNodeValues(window.AddTaskAttachementsGrid.GetFocusedNodeKey(), 'TaskItemId;ObjectType;PartNumber',
            function(values) {
                if (typeof (values) === 'undefined' || values == null || values.length == 0 || values[0] == null || values[1] == null) {
                    Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                    return;
                }

                $.ajax({
                    type: "POST",
                    url: '/Tasks/RemoveAttachment/',
                    data: {
                        "taskItemId": values[0],
                        "taskId": taskIdentifier,
                        "objectType": values[1],
                        "partNumber": values[2]
                    },
                    dataType: "json",
                    success: function(response) {
                        var res = JSON.parse(response.data);
                        if (res.Success) {
                            window.AddTaskAttachementsGrid.PerformCallback();

                            if (typeof window["ToDoPropertyCardGrid"] !== 'undefined') {
                                ToDo.ShouldReload(true);
                                window["ToDoPropertyCardGrid"].PerformCallback();
                            }
                        } else {
                            Notification.SetNotification(res.Message, 'warning', 3500);
                        }
                    }
                });
            });
    };

    tasks.btnAddAttachementsItemsClick = function (s, e) {

        var cpRecordGuid = AppV.GetGlobals().RecordGuid;

        if (gridAddAttachments.pageRowCount == 0) {
            Notification.SetNotification(window.SwResourceObject['PleaseSelectAnItem'], 'warning', 2500);
            return;
        }

        window.gridAddAttachments.GetSelectedFieldValues(
            "RecordGuid",
            function (result) {
                if (result == null) {
                    Notification.SetNotification(window.SwResourceObject['PleaseSelectAnItem'], 'warning', 2500);
                    return;
                }
                var taskIdentifier = $("#taskId").val();
                var selectedValue = window.cmbSelectObjectAddAttachments.GetValue();

                Request.ajax({
                    type: "POST",
                    url: '/Tasks/SaveAttachements/',
                    data: {
                        taskId: taskIdentifier,
                        objectId: selectedValue,
                        recordGuid: cpRecordGuid,
                        recordGuidList: result.toString()
                    },
                    dataType: "json"
                }).then(save_releated_items_success_callback, save_releated_items_error_callback)
                    .then(function () { window.loadingPanel.Hide(); });

            });

        function save_releated_items_success_callback(response) {
            //
            var responseData = JSON.parse(response.data);

            if (responseData.Success) {
                window.AddTaskAttachementsGrid.PerformCallback();
                window.pcModalAddAttachement.Hide();

            }
            else {
                Notification.SetNotification(responseData.message, 'warning', 2500);
            }

        }

        function save_releated_items_error_callback(result) {
            window.pcModalAddAttachement.Hide();
        }
    };

    tasks.ShowTimeShiftModalButtonClick = function (s, e, taskId, timeAllocated) {
        window.AddTimeShiftPopUp.Show();
        window.AddTimeShiftPopUp.PerformCallback(
            {
                timeSheetId: -1,
                taskId: taskId,
                timeAllocated: timeAllocated
            });
    };

    tasks.GoToDataTimeShiftProgressButtonClick = function (s, e) {
        tasks.OnSheetTaskProgressGridDoubleClick();
    };

    tasks.ShowAddAttachementModalButtonClick = function (s, e) {

        View.load("pcModalAddAttachement",
            {
                objectId: s.cpObjectId,
                recordGuid: s.cpRecordGuid
            });
    };

    tasks.cmbSelectTypeObjectIndexChange = function (s, e) {

        var selectedValue =
            window.cmbSelectObjectAddAttachments.GetValue();

        window.gridAddAttachments.PerformCallback({
            objectId: s.cpObjectId,
            recordGuid: s.cpRecordGuid,
            selectedObjectId: selectedValue
        });
    };

    tasks.gridViewAddAttachmentsBeginCallback = function (s, e) {

        var selectedValue =
            window.cmbSelectObjectAddAttachments.GetValue();

        e.customArgs["objectId"] = s.cpObjectId;
        e.customArgs["recordGuid"] = s.cpRecordGuid;
        e.customArgs["selectedObjectId"] = selectedValue;
        e.customArgs["simpleSearchFor"] = window.btnAddAttachementsSimpleSearch.GetValue();
        e.customArgs["limitRecord"] = window.AddAttachementsSearchLimitRecords.GetValue();

    };

    tasks.OnbtnSimpleSearchClick = function (s, e) {
        var cmbSelectObject = window.cmbSelectObjectAddAttachments.GetValue();
        if (e.buttonIndex === 0) {
            if (cmbSelectObject !== null) {
                window.gridAddAttachments.PerformCallback();
            }
            else {
                Notification.SetNotification(window.SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            }
        } else {
            if (cmbSelectObject !== null) {
                window.btnAddAttachementsSimpleSearch.SetValue('');
                window.gridAddAttachments.PerformCallback();
            }
            else {
                window.btnAddAttachementsSimpleSearch.SetValue('');
            }
        }
    };

    tasks.KeyPressSimpleSearch = function (s, e) {
        var cmbSelectObject = window.cmbSelectObjectAddAttachments.GetValue();
        if (cmbSelectObject !== null) {
            if (e.htmlEvent.keyCode === 13) {
                window.gridAddAttachments.PerformCallback();
            }
        }
    };

    tasks.GetTaskListFocusedRow = function (s, e) {
        var result = [];
        var selectedRow;
        if (s.cpAllRowData != "") {
            var key = Helper.GetGridFocusedRowKey(s.name, e.visibleIndex);
            result = JSON.parse(s.cpAllRowData).filter(function (f) {
                return f.No == key;
            })[0];
            selectedRow = result;
        }
        return selectedRow;
    };

    tasks.OnTaskListItemGridDoubleClick = function (s, e) {

        if (window["AddDetailsPropertiesTask" + s.cpRenderedOn].GetEnabled() == false) {
            e.cancel = true;
            return;
        }

        $("#isEditTaskListItems").val(true);

        var selectedRow = tasks.GetTaskListFocusedRow(s, e);
        if (selectedRow !== undefined && selectedRow !== null) {

            View.load("AddTaskItemPopUp" + s.cpRenderedOn,
                {
                    taskItemName: selectedRow.ItemName,
                    taskId: selectedRow.TaskId,
                    isEditTaskListItems: true,
                    renderedOn: s.cpRenderedOn
                }, true);

        } else {
            Notification.SetNotification(SwResourceObject.ChooseARecord, 'warning', 3500);
        }

    };

    tasks.ShowAddNoteModalButtonClick = function (s, e) {
        var taskIdValue = $("#taskIdForNotes").val();

        if (s.cpRenderedOn === enums.Modules.TaskTemplates) {
            taskIdValue = $("#taskIdForTemplates").val();
        }

        View.load("AddNotePopUp",
            {
                taskId: taskIdValue,
                renderedOn: s.cpRenderedOn
            });
    };

    tasks.AddTaskItemButtonClick = function (s, e) {
        var taskIdValue = $("#taskIdForNotes").val();

        if (s.cpRenderedOn === enums.Modules.TaskTemplates) {
            taskIdValue = $("#taskIdForTemplates").val();
            $("#taskItemTaskId" + s.cpRenderedOn).val(taskIdValue);
        }
        $("#ItemName").val();
        $("#Finished").val();
        $("#isEditTaskListItems").val(false);
        // window.AddTaskItemPopUp.Show();
        View.load("AddTaskItemPopUp" + s.cpRenderedOn,
            {
                taskItemName: "",
                taskId: taskIdValue,
                isEditTaskListItems: false,
                renderedOn: s.cpRenderedOn
            }, true, false);
        //  View.load("AddTaskItemPopUp", {}, true, false);
    };

    tasks.RemoveTaskItemButtonClick = function (s, e) {

        var result = [];
        var selectedRow;
        var renderedOn = "";

        if (s.cpRenderedOn !== null && s.cpRenderedOn !== undefined) {
            renderedOn = s.cpRenderedOn;
        }

        var taskDetailsGrid = window["taskDetailsGrid" + renderedOn];
        if (taskDetailsGrid.cpAllRowData != "") {
            var key = Helper.GetGridFocusedRowKey("taskDetailsGrid" + s.cpRenderedOn);
            result = JSON.parse(taskDetailsGrid.cpAllRowData).filter(function (f) {
                return f.No == key;
            })[0];
            selectedRow = result;
        }

        if (isEmpty(selectedRow)) {
            return;
        }

        $.ajax({
            type: "POST",
            url: '/Tasks/RemoveTaskItem/',
            data: {
                "itemName": selectedRow.ItemName,
                "taskId": selectedRow.TaskId
            },
            dataType: "json",
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    window["taskDetailsGrid" + s.cpRenderedOn].PerformCallback({
                        taskId: selectedRow.TaskId
                    });
                } else {
                    Notification.SetNotification(res.Message, 'warning', 3500);
                }
            }
        });
    };

    tasks.OnSheetTaskProgressGridDoubleClick = function (s, e) {

        //select focused node on treelist
        //var taskTimerUserId = window.AddUserTaskProgressGrid.GetFocusedNodeKey();//e.nodeKey;
        var result = tasks.checkTreelistHasFocusedItem("AddUserTaskProgressGrid");
        if (result) {
            window.AddUserTaskProgressGrid.GetNodeValues(window.AddUserTaskProgressGrid.GetFocusedNodeKey(), 'TaskTimeUserId', function (result) {

                var taskTimerUserId = result;

                if (!isEmpty(taskTimerUserId)) {
                    $("#timeSheetUserId").val(taskTimerUserId);
                    $("#isEditTimeShift").val(true);

                    //open popup and edit item
                    window.AddTimeShiftPopUp.PerformCallback({
                        timeSheetId: taskTimerUserId
                    });
                    window.AddTimeShiftPopUp.Show();
                }
            });
        }
    };

    //ToDo: change this into a generic function to check all grids and trees
    tasks.checkTreelistHasFocusedItem = function(treeListToCheck) {
        var focusedNode = window[treeListToCheck].GetNodeState(window[treeListToCheck].GetFocusedNodeKey());
        if (focusedNode === "NotFound") {
            return false;
        } else {
            return true;
        }
    };

    tasks.RemoveTimeShiftButtonClick = function (s, e) {

        var hasFocusedNode = tasks.checkTreelistHasFocusedItem("AddUserTaskProgressGrid");

        if (!hasFocusedNode) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }

        var taskTimerUserId = window.AddUserTaskProgressGrid.GetFocusedNodeKey();

        if (!isEmpty(taskTimerUserId)) {
            Helper.ShowConfirmPopUp("SolidWorks",
                SwResourceObject.AreYouSureYouWantToDeleteSelectedItem,
                "Tasks.RemoveTimeShift(" + taskTimerUserId + ")");
        }
    };

    tasks.RemoveTimeShift = function (taskTimerUserId) {

        var taskIdentifier = $("#taskId").val();
        var allTimeAllocated = window.allocatedTimeProgressValues.GetValue(),
            shouldCalAutomatically = window.calculateCompletionFromTimeAllocated.GetValue(),
            completed = window.completePercentage.GetValue();

        $.ajax({
            type: "POST",
            url: '/Tasks/RemoveTimeShiftItem/',
            data: {
                "taskTimeUserId": taskTimerUserId,
                "taskId": taskIdentifier,
                "allTimeAllocated": allTimeAllocated,
                "shouldCalAutomatically": shouldCalAutomatically,
                "completed": completed
            },
            dataType: "json",
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    $("#AddTaskProgressViewModel_UsedTime").val(res.CustomAttributes.UsedTime);
                    usedTimeProgressValues.SetText(res.CustomAttributes.UsedTime);
                    leftTimeProgressValue.SetText(res.CustomAttributes.LeftTime);

                    completePercentage.SetValue(res.CustomAttributes.CompletePercentage);
                    window.AddUserTaskProgressGrid.PerformCallback();
                    //Notification.SetNotification(res.Message, 'success', 3500);
                } else {
                    Notification.SetNotification(res.Message, 'warning', 3500);
                }
            }
        });
    };

    tasks.OnTasksMenuButtonClick = function (s, e) {
        var moduleName = s.cpModuleName;

        switch (e.item.name) {
            case "saveAndClose":

                if (subjectTask.GetText() === "") {
                    Notification.SetNotification(SwResourceObject.SubjectCannotBeEmpty, 'warning', 3500);
                    break;
                }

                if (window.startDate.GetDate() === null || window.endDate.GetDate() === null) {
                    Notification.SetNotification(SwResourceObject.PleaseSelectStartDateAndDueDate, 'warning', 3500);
                    break;
                }

                tasks.SaveTasksData(true, "SaveTask");

                if (AppV.GetGlobals().ObjectId) {
                    if (typeof gridViewDocuments != 'undefined'
                        && AppV.GetHomeObjects().MenuSelected !== enums.HomeModules.MyDashboard) {
                        MainGrid.PerformCallback(true);
                    }
                }
                break;

            case "save":

                if (subjectTask.GetText() === "") {
                    Notification.SetNotification(SwResourceObject.SubjectCannotBeEmpty, 'warning', 3500);
                    break;
                }

                if (window.startDate.GetDate() === null || window.endDate.GetDate() === null) {
                    Notification.SetNotification(SwResourceObject.PleaseSelectStartDateAndDueDate, 'warning', 3500);
                    break;
                }

                tasks.SaveTasksData(false, "SaveTask");

                //Get the updated values
                var taskIdentifier = $("#taskId").val();
                var taskStageId = $("#TaskStageId").val();

                window.CreateTaskPopUp.PerformCallback(
                    {
                        taskIdParam: taskIdentifier,
                        IsEditMode: true,
                        objectId: AppV.GetGlobals().ObjectId,
                        stageId: taskStageId,
                        recordGuid: AppV.GetGlobals().RecordGuid,
                        moduleName: moduleName
                    });

                if (typeof gridViewDocuments != 'undefined'
                    && AppV.GetHomeObjects().MenuSelected !== enums.HomeModules.MyDashboard) {

                    MainGrid.PerformCallback(true);
                }

                break;

            case "deleteTask":
                Helper.ShowConfirmPopUp("SolidWorks",
                    SwResourceObject.AreYouSureYouWantToDeleteSelectedItemS,
                    "Tasks.DeleteTaskById()");
                break;

            case "markAsComplete":
                $('#actionToCall').val("1");
                Helper.ShowConfirmPopUp("SolidWorks",
                    SwResourceObject.ATaskMarkedAsCompletedCanNoLongerBeEdited + "\n" + SwResourceObject.DoYouWantToContinue,
                    "Tasks.MarkAsCompleted()");
                break;

            case "assignTo":
                //ToDo: Save task before change owner
                tasks.SaveTasksData(false, "SaveTask");

                var taskIdentifier = $("#taskId").val();
                View.load("AssignUsersPopUp",
                    {
                        taskIds: taskIdentifier,
                        module: moduleName
                    });
                break;

            case "private":
                var isPrivate = tasksRibbon.GetItemByName('private').GetValue();
                $("#AddTaskRibbonViewModel_IsPrivate").val(isPrivate);
                break;

            case "refreshNotifications":
                View.load("NotificationsSection",
                    {
                        taskId: $("#taskId").val(),
                        section: "NotificationsSection"
                    }, false, true);
                break;

            case "refreshHistory":
                if (typeof AddTaskHistoryGrid !== "undefined") {
                    AddTaskHistoryGrid.PerformCallback();
                }
                break;
            case "exportHistory":
                App.Exporting = true;
                window["AddTaskHistoryGrid"].ExportTo(ASPxClientGridViewExportFormat.Xlsx);
                break;
            case "taskTemplateConfigure":
                break;
        }
    };

    tasks.SaveNotificationsClick = function () {
        window.loadingPanel.Show();
        tasks.SaveTasksData(false, "SaveNotifications");
    };

    tasks.SaveNotificationsResponse = function (response) {
        var res = JSON.parse(response.data);
        if (res.Success) {

            Notification.SetNotification(SwResourceObject.SavedSuccessfully, 'success', 3500);

        } else {
            Notification.SetNotification(res.Message, 'warning', 3500);
        }
    };

    tasks.SaveTaskResponse = function (response, closePopUp) {
        var res = JSON.parse(response.data);
        if (res.Success) {

            if (closePopUp) {
                window.CreateTaskPopUp.Hide();
            }

            if (AppV.GetHomeObjects().MenuSelected == enums.HomeModules.MyDashboard) {
                MainGrid.DashBoardViewer.State.reload = true;
                cbpDocumetGridDashboard.PerformCallback();
                return;
            }

            var ToDoPropertyCardGrid = "ToDoPropertyCardGrid" + tasksRibbon.cpModuleName;
            if (typeof window[ToDoPropertyCardGrid] !== 'undefined') {

                if (typeof PropertyCardSection !== 'undefined') {
                    ToDo.ShouldReload(true);
                    window[ToDoPropertyCardGrid].PerformCallback({
                        objectId: AppV.GetGlobals().ObjectId,
                        recordGuid: AppV.GetGlobals().RecordGuid
                    });
                }
            }

            //update planning chart
            if (window['ResourcesPlanning'] !== undefined && window['ResourcesPlanning'].GetChecked() === true)
                Planning.ProjectsPlanningPerformCallback(true);

        } else {
            Notification.SetNotification(res.Message, 'warning', 3500);

        }
    };

    tasks.SaveTasksData = function (closePopUp, action) {

        this.frm = $("#FormSubmitTasks");

        $.ajax({
            type: "POST",
            url: '/Tasks/' + action + '/',
            data: this.frm.serialize(),// serializes the form's elements.
            success: function (response) {
                var res = JSON.parse(response.data);
                var actionPerformed = res.CustomAttributes.ActionPerformed;

                switch (actionPerformed) {
                    case "SaveNotifications":
                        window.loadingPanel.Hide();
                        tasks.SaveNotificationsResponse(response);
                        break;
                    default:
                        tasks.SaveTaskResponse(response, closePopUp);
                }
            }
        });
    };

    tasks.SaveTaskTemplatesData = function (e) {
        e.preventDefault();
        var addAttachments = addAttachmentsAddTemplate.GetChecked();
        var removeAttachments = removeAttachmentsAddTemplate.GetChecked();
        var changeDetailsList = changeDetailsListAddTemplate.GetChecked();

        this.frm = $("#FormSubmitTaskTemplates");

        $.ajax({
            type: "POST",
            url: '/Tasks/SaveTaskTemplate/',
            data: this.frm.serialize() + "&addAttachments=" + addAttachments + "&removeAttachments=" + removeAttachments + "&changeDetailsList=" + changeDetailsList +"",// serializes the form's elements.
            success: function (response) {
                var res = JSON.parse(response.data);
                var newTaskId = res.CustomAttributes.NewTaskId;

                if (res.Success === true) {
                    Notification.SetNotification(window.SwResourceObject.SavedSuccessfully, 'success', 3500);
                    $("#isAddNewModeTemplates").val(false);
                    AddNotesPropertiesTaskTaskTemplates.SetEnabled(true);
                    TaskTemplateGrid.PerformCallback();
                    
                    var renderedOn = $("#taskDetailsRenderedOn").val();

                    if (newTaskId !== undefined &&
                        newTaskId !== null) {
                        $("#taskItemTaskId" + renderedOn).val(newTaskId);
                        $("#taskIdForTemplates").val(newTaskId);
                        if (typeof window["taskDetailsGrid" + renderedOn] !== 'undefined') {
                            window["taskDetailsGrid" + renderedOn].PerformCallback({
                                taskId: newTaskId,
                                renderedOn: renderedOn
                            });
                        }
                    } 
                    cbpTaskTemplateMenu.PerformCallback();
                }
                    
            }
        });
    };

    tasks.ReminderTaskCheckedChange = function (s, e) {
        var checkBoxValue = s.GetChecked();
        window.reminderDate.SetEnabled(checkBoxValue);
        window.usersPropertiesCheckListBoxDropDown.SetEnabled(checkBoxValue);
    };

    tasks.IsAllDayEventCheckedChange = function (s, e) {
        var checkBoxValue = s.GetChecked();

        $("#IsAllDayEvent").val(checkBoxValue);

        var hoursNewValue = "09";
        if (checkBoxValue) {
            hoursNewValue = "00";
        }

        var startDateValue = window.startDate.GetDate();
        startDateValue.setHours(hoursNewValue);
        startDateValue.setMinutes("00");
        window.startDate.SetDate(startDateValue);

        var endDateValue = window.endDate.GetDate();
        endDateValue.setHours(hoursNewValue);
        endDateValue.setMinutes("00");
        window.endDate.SetDate(endDateValue);
    };

    tasks.PriorityTaskSelectionChanged = function (s, e) {
        var color = "white";
        var value = s.GetValue();

        if (value === 4) {
            color = "LightCoral";
        } else if (value === 1) {
            color = "Khaki";
        }

        var comboBoxMainElement = window[s.name].GetMainElement();
        comboBoxMainElement.style.backgroundColor = color;
        var comboBoxInputElement = window[s.name].GetInputElement();
        comboBoxInputElement.style.backgroundColor = color;
    };

    //ToDo: Change this on a generic ajax postback result handler
    tasks.onAddNoteSubmit = function (e) {
        e.preventDefault();
        window.loadingPanel.Show();
        this.frm = $("#SaveNoteId");

        $.ajax({
            type: "POST",
            url: this.frm.attr('action'),
            data: this.frm.serialize(),// serializes the form's elements.
            success:
                function (content) {
                    var res = JSON.parse(content.data);
                    if (res.Success) {
                        var renderedOn = $("#taskCommentsRenderedOn").val();
                        TasksAddNoteRichEdit.SetHtml("");
                        window.AddNotePopUp.Hide();

                        if (content.recordGuid !== "") {
                            window.cbpNotesSection.PerformCallback({
                                objectId: AppV.GetGlobals().ObjectId,
                                recordGuid: AppV.GetGlobals().RecordGuid,
                                objectType: $("#taskObjectType").val(),
                                shouldReload: true
                            });
                        } else
                            if (renderedOn === enums.Modules.TaskTemplates) {
                                var taskIdSaved = -1;
                                taskIdSaved = $("#taskIdForTemplates").val();
                                window["NotesTaskPanel" + renderedOn].PerformCallback({
                                    taskId: taskIdSaved
                                });
                            } else {
                                window["NotesTaskPanel" + renderedOn].PerformCallback();
                            }
                       
                    } else {
                        Notification.SetNotification(res.Message, 'warning', 3500);
                    }
                    window.loadingPanel.Hide();
                },
            error: function () {
                window.loadingPanel.Hide();
                Notification.SetNotification(SwResourceObject.AnErrorOccurred, 'error', 3500);
            }
        });
    };

    tasks.onAddTimeSheetSubmit = function (e) {
        e.preventDefault();

        //Get the value of calculated automatically checkbox
        var calculateAutomatically = window.calculateCompletionFromTimeAllocated.GetValue();
        // var usedTimeUntilNow = window.usedTimeProgressValues.GetValue();
        //var allocatedTime = window.allocatedTimeProgressValues.GetValue();
        var leftTime = window.leftTimeProgressValue.GetValue();
        var enteredTime = window.timeSpent.GetInputElement().value;

        if (calculateAutomatically === true) {
            if (Number(enteredTime) >= Number(leftTime)) {
                Helper.ShowConfirmPopUp("SolidWorks",
                    SwResourceObject.ATaskMarkedAsCompletedCanNoLongerBeEdited + "\n" + SwResourceObject.DoYouWantToContinue,
                    "Tasks.ContinueSavingTimeSheetItem()");
                return;
            }
            //tasks.ContinueSavingTimeSheetItem();
            //return;
        }
        tasks.ContinueSavingTimeSheetItem();
    };

    tasks.ContinueSavingTimeSheetItem = function () {
        var calculateAutomatically = window.calculateCompletionFromTimeAllocated.GetValue();
        $("#shouldCalculateAutomaticallyChk").val(calculateAutomatically);

        this.frm = $("#SaveTimeShiftProgressId");
        $.ajax({
            type: "POST",
            url: this.frm.attr('action'),
            data: this.frm.serialize(),// serializes the form's elements.
            success:
                function (content) {
                    var res = JSON.parse(content.data);
                    if (res.Success) {

                        window.AddTimeShiftPopUp.Hide();
                        window.AddUserTaskProgressGrid.PerformCallback();

                        Notification.SetNotification(res.Message, 'success', 3500);

                        $("#AddTaskProgressViewModel_UsedTime").val(res.CustomAttributes.UsedTime);
                        usedTimeProgressValues.SetText(res.CustomAttributes.UsedTime);
                        leftTimeProgressValue.SetText(res.CustomAttributes.LeftTime);

                        completePercentage.SetValue(res.CustomAttributes.CompletePercentage);

                        //save task to refresh the data
                        tasks.SaveTasksData(false, "SaveTask");

                        //Get the updated values
                        var taskIdentifier = $("#taskId").val();
                        window.CreateTaskPopUp.PerformCallback({
                            taskIdParam: taskIdentifier,
                            IsEditMode: true,
                            objectId: AppV.GetGlobals().ObjectId,
                            recordGuid: AppV.GetGlobals().RecordGuid,
                            stageId: window.Processes.State.StageId || -1
                        });

                        if (res.CustomAttributes.LeftTime < 0 && calculateAutomatically === true) {
                            Notification.SetNotification("Time entered exceeds available time for this task!", 'warning', 3500);
                        }

                        //ShowTaskSection("Progress");

                    } else {
                        Notification.SetNotification(res.Message, 'warning', 3500);
                    }
                },
            error: function () {
                Notification.SetNotification(SwResourceObject.AnErrorOccurred, 'error', 3500);
            }
        });
    };

    tasks.SetNoteEditorHeight = function () {
        TasksAddNoteRichEdit.SetHeight(AddNotePopUp.GetHeight() - 100);
    };

    tasks.ChangeOwnerButtonClick = function () {

        window.ChangeOwnerPopUp.Show();
    };

    tasks.OnStageDropDownSelectedIndexChange = function (s, e) {
        var selectedItem = s.GetValue();
        $("#TaskStageId").val(selectedItem);
    };

    tasks.ChangeOwnerOKClick = function () {
        //var taskIdentifier = $("#taskId").val(),
        selectedUserId = window.changeOwner.GetValue(),
            selectedUserUsername = window.changeOwner.GetText();

        var taskIdentifier = JSON.parse(ChangeOwnerPopUp.cpSelectedTasksIds);

        tasks.ChangeOwner(taskIdentifier,
            selectedUserUsername,
            selectedUserId);
    };

    tasks.ChangeOwner = function (taskIdentifier,
        selectedUserUsername,
        selectedUserId) {
        $.ajax({
            type: "POST",
            url: '/Tasks/SaveNotificationReminders/',
            data: {
                "taskId": taskIdentifier,
                "selectedUserUsername": selectedUserUsername,
                "selectedUserId": selectedUserId
            },
            dataType: "json",
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {

                    //Get the updated values

                    //var taskIdentifier = $("#taskId").val();

                    if (typeof CreateTaskPopUp !== "undefined" && CreateTaskPopUp.IsVisible()) {
                        View.load("CreateTaskPopUp",
                            {
                                taskIdParam: taskIdentifier,
                                IsEditMode: true,
                                objectId: AppV.GetGlobals().ObjectId,
                                recordGuid: AppV.GetGlobals().RecordGuid
                            });
                    }

                    window.ChangeOwnerPopUp.Hide();

                } else {
                    Notification.SetNotification(res.Message, 'warning', 3500);
                }
            }
        });
    };

    tasks.onAddTaskItemsSubmit = function (e) {
        e.preventDefault();
        var renderedOn = $("#taskDetailsRenderedOn").val();
        this.frm = $("#SaveTaskItemPropertiesId");
        $.ajax({
            type: "POST",
            url: this.frm.attr('action'),
            data: this.frm.serialize(),// serializes the form's elements.
            success:
                function (content) {
                    var res = JSON.parse(content.data);
                    if (res.Success) {
                        window["AddTaskItemPopUp" + renderedOn].Hide();
                        if (renderedOn === enums.Modules.TaskTemplates) {
                            var taskIdSaved = -1;
                            taskIdSaved = $("#taskIdForTemplates").val();
                            window["taskDetailsGrid" + renderedOn].PerformCallback({
                                taskId: taskIdSaved
                            });
                        } else {
                            window["taskDetailsGrid" + renderedOn].PerformCallback();
                        }
                        $("#isEditTaskListItems").val(false);

                        if (renderedOn === null || renderedOn === undefined || renderedOn === "") {
                            Tasks.OnCalculateCompletionFromListCheckedChange();
                        }

                    } else {
                        Notification.SetNotification(res.Message, 'warning', 3500);
                    }
                },
            error: function () {
                Notification.SetNotification(SwResourceObject.AnErrorOccurred, 'error', 3500);
            }
        });


    };

    tasks.TemplateMenuClick = function (s, e) {

        if (e.item.name.startsWith(enums.Constants.TaskTemplate)) {
            var templateId = e.item.name.split(enums.Constants.TaskTemplate).pop();
            var newTaskId = $("#taskId").val();
            Tasks.ApplyTemplate(templateId, newTaskId);
        }

        if (e.item.name === "taskTemplateConfigure") {
            View.load("TaskTemplatePopUp", {}, true, false);
        }
    };

    tasks.SaveUsersAssignToTask = function (s, e) {

        var stageID;
        stageID = $("#TaskStageId").val();

        var listTaskIds = AssignUsersPopUp.cptaskIdsAsString;
        var module = AssignUsersPopUp.cpModule;

        window.AssignUsersTasksGridView.GetSelectedFieldValues('UserId', function (values) {

            if (values === 'undefined' || values.length == 0) {
                Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                return;
            }

            $.ajax({
                type: "POST",
                url: '/Tasks/SaveUsersAssignToTask/',
                data: {
                    "taskIds": listTaskIds,
                    "usersIds": values,
                    "stageId": stageID,
                    "recordGuid": AppV.GetGlobals().RecordGuid,
                    "module": module,
                    "chkAddAttachments": addAttachmentsAssignUsers.GetChecked(),
                    "chkRemoveAttachments": removeAttachmentsAssignUsers.GetChecked(),
                    "chkChangeDetails": changeDetailsListAssignUsers.GetChecked()
                },
                dataType: "json",
                success: function (response) {
                    var res = JSON.parse(response.data);
                    if (res.Success) {
                        addAttachmentsAssignUsers.SetChecked(true);
                        removeAttachmentsAssignUsers.SetChecked(true);
                        changeDetailsListAssignUsers.SetChecked(false);

                        window.AssignUsersPopUp.Hide();

                        //Get the updated values
                        if (typeof CreateTaskPopUp !== 'undefined' && window.CreateTaskPopUp.IsVisible()) {
                            View.load("CreateTaskPopUp",
                                {
                                    taskIdParam: listTaskIds,
                                    IsEditMode: true,
                                    objectId: AppV.GetGlobals().ObjectId,
                                    stageId: stageID,
                                    recordGuid: AppV.GetGlobals().RecordGuid
                                });
                        }

                        //update planning chart
                        if (typeof ResourcesPlanning !== "undefined" &&
                            ResourcesPlanning !== undefined &&
                            ResourcesPlanning.GetChecked() === true)
                            Planning.ProjectsPlanningPerformCallback(true);

                        if (module === enums.Modules.MyDashboard) {
                            MainGrid.DashBoardViewer.State.reload = true;
                            DashboardTaskGrid.PerformCallback();
                        }

                        Notification.SetNotification(res.Message, 'success', 3500);
                    } else {
                        Notification.SetNotification(res.Message, 'error', 3500);
                    }
                }
            });
        });
    };

    tasks.ApplyTemplate = function (templateId, taskId) {

        var stageID;
        stageID = $("#TaskStageId").val();

        $.ajax({
            type: "POST",
            url: '/Tasks/ApplyTemplate/',
            data: {
                "templateId": templateId,
                "newTaskId": taskId
            },
            dataType: "json",
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    //Get the updated values
                    if (typeof CreateTaskPopUp !== 'undefined' && window.CreateTaskPopUp.IsVisible()) {
                        View.load("CreateTaskPopUp",
                            {
                                taskIdParam: taskId,
                                IsEditMode: true,
                                objectId: AppV.GetGlobals().ObjectId,
                                stageId: stageID,
                                recordGuid: AppV.GetGlobals().RecordGuid,
                                templateId: templateId
                            });
                    }

                } else {
                    Notification.SetNotification(res.Message, 'error', 3500);
                }
            }
        });
    };

    tasks.Delete = function (values, moduleName = "") {
        $.ajax({
            type: "POST",
            url: '/Tasks/DeleteTask/',
            data: {
                "tasksToDeleteData": values
            },
            dataType: "json",
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {

                    if (typeof window["ToDoPropertyCardGrid" + moduleName] !== 'undefined') {
                        ToDo.ShouldReload(true);
                        window["ToDoPropertyCardGrid" + moduleName].PerformCallback();
                    }

                    Notification.SetNotification(Helper.T(res.Message), 'success', 3500);

                    if (AppV.GetHomeObjects().MenuSelected == enums.HomeModules.MyDashboard) {
                        MainGrid.DashBoardViewer.State.reload = true;
                        DashboardTaskGrid.PerformCallback();
                        return;
                    }

                    if (typeof gridViewDocuments !== 'undefined') {
                        MainGrid.PerformCallback(true);
                    } 

                } else {
                    Notification.SetNotification(Helper.T(res.Message), 'warning', 3500);
                }
            }
        });
    };

    tasks.DeleteTaskContextMenu = function (moduleName = "") {

        if (moduleName === undefined)
            moduleName = "";

        window["ToDoPropertyCardGrid" + moduleName].GetSelectedFieldValues('TaskId;UserCreatedId',

            function (values) {
                if (typeof (values) === 'undefined' || values === null || values === 0) {
                    Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                    return;
                }

                var tasksToDeleteData = [];

                values.forEach(function (entry) {
                    tasksToDeleteData.push({
                        TaskId: entry[0],
                        UserCreatedId: entry[1]
                    });
                });

                tasks.Delete(tasksToDeleteData, moduleName);
            });
    };

    tasks.DeleteTaskById = function () {
        var taskIdentifier = $("#taskId").val();
        var taskCreator = $('#AddTaskUsersViewModel_CreatedById').val();

        var tasksToDeleteData = [];

        tasksToDeleteData.push({
            TaskId: taskIdentifier,
            UserCreatedId: taskCreator
        });

        $.ajax({
            type: 'POST',
            dataType: "json",
            url: '/Tasks/DeleteTask/',
            data: {
                "tasksToDeleteData": tasksToDeleteData
            },
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    window.CreateTaskPopUp.Hide();
                    if (typeof ToDoPropertyCardGrid != 'undefined') {
                        ToDo.ShouldReload(true);
                        window.ToDoPropertyCardGrid.PerformCallback();
                    }

                    if (typeof gridViewDocuments != 'undefined') {
                        MainGrid.PerformCallback(true);
                    }

                    if (AppV.GetHomeObjects().MenuSelected == enums.HomeModules.MyDashboard) {
                        MainGrid.DashBoardViewer.State.reload = true;
                        cbpDocumetGridDashboard.PerformCallback();
                    }

                    Notification.SetNotification(Helper.T(res.Message), 'success', 3500);
                } else {
                    Notification.SetNotification(Helper.T(res.Message), 'warning', 3500);
                }
            }
        });
    };

    tasks.MarkAsCompletedCall = function (values, moduleName = "") {
        $.ajax({
            type: "POST",
            url: '/ToDo/MarkAsCompletedFromContextMenu/',
            data: {
                "tasksId": values
            },
            dataType: "json",
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    if (typeof window["ToDoPropertyCardGrid" + moduleName] !== 'undefined') {
                        window["ToDoPropertyCardGrid" + moduleName].PerformCallback(
                            {
                                reloadGrid: true
                            });
                    }

                    Notification.SetNotification(res.Message, 'success', 3500);

                    if (moduleName === enums.Modules.MyDashboard) {
                        MainGrid.DashBoardViewer.State.reload = true;
                        DashboardTaskGrid.PerformCallback();
                        return;
                    }

                    if (typeof gridViewDocuments !== 'undefined') {
                        MainGrid.PerformCallback(true);
                    }

                } else {
                    Notification.SetNotification(res.Message, 'warning', 3500);
                }
            }
        });
    };

    tasks.MarkAsCompleteFromContextMenu = function (valuesList, moduleName = "") {

        if (typeof (valuesList) === 'undefined' || valuesList == null || valuesList == 0) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }

        tasks.MarkAsCompletedCall(valuesList, moduleName);

    };

    tasks.MarkAsReadUnRead = function (values, isRead) {
        $.ajax({
            type: "POST",
            url: '/ToDo/MarkAsReadUnReadTask/',
            data: {
                "tasksId": values,
                "isRead": isRead
            },
            dataType: "json",
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    if (typeof ToDoPropertyCardGrid !== 'undefined') {
                        window.ToDoPropertyCardGrid.PerformCallback();
                    }


                    if (typeof gridViewDocuments !== 'undefined') {
                        MainGrid.PerformCallback(true);
                    }


                    Notification.SetNotification(res.Message, 'success', 3500);
                } else {
                    Notification.SetNotification(res.Message, 'warning', 3500);
                }
            }
        });
    };

    tasks.RichEditAddNoteInit = function (s, e) {
        //window.TasksAddNoteRichEdit.ExecuteCommand(ASPxClientCommandConsts.FONTNAME_COMMAND, 'Calibri');
    };

    tasks.MarkAsCompleted = function () {
        this.frm = $("#FormSubmitTasks");
        $.ajax({
            type: "POST",
            url: this.frm.attr('action'),
            data: this.frm.serialize(),// serializes the form's elements.
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    window.CreateTaskPopUp.Hide();

                    var ToDoPropertyCardGrid = "ToDoPropertyCardGrid" + tasksRibbon.cpModuleName;

                    //check if grid is rendered
                    if (typeof window[ToDoPropertyCardGrid] !== 'undefined') {
                        ToDo.ShouldReload(true);
                        window[ToDoPropertyCardGrid].PerformCallback();
                    }

                    if (typeof gridViewDocuments !== 'undefined'
                        && AppV.GetHomeObjects().MenuSelected !== enums.HomeModules.MyDashboard) {
                        MainGrid.PerformCallback(true);
                    }

                    if (AppV.GetHomeObjects().MenuSelected == enums.HomeModules.MyDashboard) {
                        MainGrid.DashBoardViewer.State.reload = true;
                        cbpDocumetGridDashboard.PerformCallback();
                    }

                    Notification.SetNotification(res.Message, 'success', 3500);
                    $('#actionToCall').val("");
                } else {
                    Notification.SetNotification(res.Message, 'warning', 3500);
                }
            }
        });
    };

    tasks.OnPopUpCloseUp = function () {
        if (typeof gridViewDocuments !== 'undefined') {
            MainGrid.PerformCallback(true);
        }
    };

    tasks.OnPopUpClosing = function (s, e) {
        e.cancel = !State.ShouldClosePopup
            && e.closeReason == ASPxClientPopupControlCloseReason.CloseButton;
    };

    tasks.OnCloseButtonClick = function (s, e) {
        //if task is new and not saved yet
        var isNewTask = $('#IsAddNewMode').val();

        if (isNewTask === 'True') {
            State.ShouldClosePopup = false;

            Helper.ShowConfirmPopUp("SolidWorks",
                SwResourceObject.DoYouWantToSaveChanges,
                "Tasks.ContinueSavingOnPopUpClose()",
                "Tasks.ClosePopUp()", "", true);
        }

    };

    tasks.OnStartDateDateChanged = function (s, e, endDate = "") {
        var startDate = s.GetDate();
        window[endDate].SetDate(startDate);
    };

    tasks.ContinueSavingOnPopUpClose = function () {
        tasksRibbon.GetItemByName('saveAndClose').getElement().click();
    };

    tasks.ClosePopUp = function () {
        window.CreateTaskPopUp.Hide();
        State.ShouldClosePopup = true;
    };

    function ShowTaskSection(sectionName) {
        window.$('#taskSectionsContent').children().css("display","none");
        if (sectionName !== "Properties" && sectionName !== "Progress") {
            View.load(sectionName + "Section",
                {
                    taskId: $("#taskId").val(),
                    section: sectionName + "Section"
                }, false, false);
        }
        window.$('#_' + sectionName + "Section").show();
    }

    tasks.OnRemoveNoteItemClick = function (commentId) {
        State.CommentSelectedId = commentId;
        $("div[id^='NoteItem']").removeClass("taskNotesSelectItem");
        $("#NoteItem" + commentId).addClass("taskNotesSelectItem");
    };

    tasks.OnNoteItemDoubleClick = function (s, e, commentId) {
        var taskIdValue = $("#taskIdForNotes").val();

        if (s.cpRenderedOn === enums.Modules.TaskTemplates) {
            taskIdValue = $("#taskIdForTemplates").val();
        }
        View.load("AddNotePopUp",
            {
                taskId: taskIdValue,
                commentId: commentId,
                renderedOn: s.cpRenderedOn
            });
    };

    tasks.OnRemoveNoteButtonClick = function (id = -1) {
        if (id != -1)
            State.CommentSelectedId = id;

        if (State.CommentSelectedId === -1) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }

        $.ajax({
            type: "POST",
            url: '/Tasks/DeleteNote/',
            data: {
                "commentId": State.CommentSelectedId
            },
            dataType: "json",
            success: function (response) {
                var renderedOn = $("#taskCommentsRenderedOn").val();

                if (renderedOn === null ||
                    renderedOn === undefined) {
                    renderedOn = "";
                }
                var res = JSON.parse(response.data);
                if (res.Success) {
                    if (renderedOn === enums.Modules.TaskTemplates) {
                        var taskIdSaved = -1;
                        taskIdSaved = $("#taskIdForTemplates").val();
                        window["NotesTaskPanel" + renderedOn].PerformCallback({
                            taskId: taskIdSaved
                        });
                    } else {
                        window["NotesTaskPanel" + renderedOn].PerformCallback();
                    }
                    State.CommentSelectedId = -1;
                } else {
                    Notification.SetNotification(res.Message, 'warning', 3500);
                    State.CommentSelectedId = -1;
                }
            }
        });
    };

    tasks.FlagUnFlagTask = function (taskId, moduleName = "") {
        $.ajax({
            type: "POST",
            url: '/Tasks/FlagUnFlagTask/',
            data: {
                "tasksId": taskId
            },
            dataType: "json",
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    var ToDoPropertyCardGrid = "ToDoPropertyCardGrid" + moduleName;

                    if (typeof ToDoPropertyCardGrid !== 'undefined') {
                        ToDo.ShouldReload(true);
                        window["ToDoPropertyCardGrid" + moduleName].PerformCallback();
                    } else {
                        MainGrid.PerformCallback(true);
                    }

                    Notification.SetNotification(res.Message, 'success', 3500);
                } else {
                    Notification.SetNotification(res.Message, 'warning', 3500);
                }
            }
        });
    };

    tasks.FlagUnFlagTaskClick = function (moduleName = "") {
        window["ToDoPropertyCardGrid" + moduleName].GetRowValues(window["ToDoPropertyCardGrid" + moduleName].GetFocusedRowIndex(), 'TaskId',
            function (values) {
                if (typeof (values) === 'undefined' || values === null || values === 0) {
                    ToDo.ShouldReload(true);
                    window["ToDoPropertyCardGrid" + moduleName].PerformCallback();
                    Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                    return;
                }

                tasks.FlagUnFlagTask(values, moduleName);
            });
    };

    tasks.AssignToUsersCntxMenuClick = function (moduleName = "") {
        window["ToDoPropertyCardGrid" + moduleName].GetRowValues(window["ToDoPropertyCardGrid" + moduleName].GetFocusedRowIndex(), 'TaskId',
            function (values) {
                if (typeof (values) === 'undefined' || values == null || values == 0) {
                    ToDo.ShouldReload(true);
                    window["ToDoPropertyCardGrid" + moduleName].PerformCallback();
                    Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                    return;
                }

                tasks.AssignTaskToUsers(values, moduleName);
            });
    };

    tasks.OpenAssignOwner = function (tasksIds, module="") {
        View.load("ChangeOwnerPopUp", {
            tasksIds: tasksIds
        }, true);
    };

    tasks.OpenMarkAsCompletedPopUp = function (tasksIds, module = "") {
        Helper.ShowConfirmPopUp("SolidWorks",
            SwResourceObject.ATaskMarkedAsCompletedCanNoLongerBeEdited + "\n" + SwResourceObject.DoYouWantToContinue,
            "Tasks.MarkAsCompletedCall( " + JSON.stringify(tasksIds) + " , '" + module +"')");
    };

    tasks.AssignTaskToUsers = function (values, module = "") {
        $.ajax({
            type: "POST",
            url: '/Tasks/CheckIfCanAssignToUsers/',
            data: {
                "tasksId": values

            },
            dataType: "json",
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    //window.AssignUsersPopUp.Show();
                    //window.AssignUsersPopUp.PerformCallback(
                    //    {
                    //        taskIds: values
                    //    });

                    View.load("AssignUsersPopUp",
                        {
                            taskIds: values,
                            module: module
                        });
                } else {
                    Notification.SetNotification(Helper.T(res.Message), 'warning', 3500);
                }
            }
        });
    };

    tasks.AddNewTaskFromContextMenu = function (s, e) {
        var moduleName = s.cpModuleName;
        var stageId = window.Processes.State.StageId;

        if (s.cpModuleName === enums.Modules.Planning)
            stageId = window[Planning.getGanttChartId()].selectedItem.key;

        //TODO: change this check
        if (typeof CreateTaskPopUp !== "undefined" && ASPxClientUtils.IsExists(CreateTaskPopUp)) {
            CreateTaskPopUp.PerformCallback({
                contextMenuFunc: true,
                objectId: AppV.GetGlobals().ObjectId,
                recordGuid: AppV.GetGlobals().RecordGuid,
                stageId: window.Processes.State.StageId,
                moduleName: moduleName
            });
            CreateTaskPopUp.Show();
        }
        else {
            View.load("CreateTaskPopUp",
                {
                    contextMenuFunc: true,
                    objectId: AppV.GetGlobals().ObjectId,
                    recordGuid: AppV.GetGlobals().RecordGuid,
                    stageId: window.Processes.State.StageId,
                    moduleName: moduleName
                });
        }

    };

    var nodeKey, parentNodeKey;

    tasks.MyWorkTaskContextMenuDisplay = function (s, e) {
        s.SetFocusedRowIndex(e.index);
    };

    tasks.OnCalculateCompletionFromTimeAllocatedCheckedChange = function (s, e) {

        var isAutomaticCalc = window.calculateCompletionFromTimeAllocated.GetValue();

        $("#AddTaskProgressViewModel_CalculateFromTimeAllocated").val(isAutomaticCalc);

        if (s.cpAllowCalculateFromTimeAllocated) {
            Helper.EnableDisableInputType("completePercentage", true);
            EnableDisableField("calculateCompletionFromList", true);
        } else {
            Helper.EnableDisableInputType("completePercentage", isAutomaticCalc);
            EnableDisableField("calculateCompletionFromList", isAutomaticCalc);
            calculateCompletionFromList.SetValue(isAutomaticCalc);
        }
        calculateCompletionFromList.SetValue(false);
    };

    tasks.OnCalculateCompletionFromListCheckedChange = function () {
        var isCalcalatefromList = window["calculateCompletionFromList"].GetValue();

        if (isCalcalatefromList) {
            var iTotalRow = taskDetailsGrid.GetVisibleRowsOnPage();

            var selectedRow = [];
            if (taskDetailsGrid.cpAllRowData != "") {
                selectedRow = JSON.parse(taskDetailsGrid.cpAllRowData).filter(function (f) {
                    return f.Finished == true;
                });
            }

            if (iTotalRow > 0) {
                if (selectedRow.length > 0) {
                    var v1 = Math.round((100 * selectedRow.length / iTotalRow));
                    completePercentage.SetValue(v1);

                    if (v1 === 100) {
                        window.statusTask.SetSelectedIndex(2);
                    } else {
                        window.statusTask.SetSelectedIndex(1);
                    }

                } else if (selectedRow.length == 0) {
                    completePercentage.SetValue(0);
                } else {
                    completePercentage.SetValue(100);
                    window.statusTask.SetSelectedIndex(2);
                }
            }
        }
    };

    tasks.OnCompletePercentageIndexChange = function (s, e) {
        var completedValue = completePercentage.GetValue();

        if (completedValue === 100) {
            window.statusTask.SetSelectedIndex(2);
        } else {
            if (window.completePercentage.GetSelectedIndex() !== 0 && window.statusTask.GetSelectedIndex() === 0) {
                window.statusTask.SetSelectedIndex(1);
            }
        }
    };

    function OnMouseDown(event) {
        ASPxClientUtils.PreventEventAndBubble(event);
    }

    //Validations
    tasks.OnTimeShiftTimeSpentValidation = function (s, e) {
        //if (e.value == null || e.value == "")
        //    return;
        var timeSpent = Number(e.value);
        if (isNaN(timeSpent) || timeSpent <= 0)
            e.isValid = false;
    };

    tasks.OnTaskItemNameValidation = function (s, e) {
        if (isEmpty(e.value) || e.value.length >= 250)
            e.isValid = false;
    };

    tasks.TaskListItemsRoundPanelEndCallback = function (s, e) {

        var activation = (s.cpTaskListItemsItemNumber !== 0 && window["AddDetailsPropertiesTask" + s.cpRenderedOn].GetEnabled());
        window["RemoveDetailsPropertiesTask" + s.cpRenderedOn].SetEnabled(activation);

        s.SetHeight(180);

        if (s.cpRenderedOn !== enums.Modules.TaskTemplates) {
            Tasks.OnCalculateCompletionFromListCheckedChange();
        }

    };

    tasks.TaskAttachmentsEndCallback = function (s, e) {

        if (s.cpTaskAttachmentsList === 0) {
            RemoveAttachementPropertiesTask.SetEnabled(false);
            GoToPropertiesAttachementPropertiesTask.SetEnabled(false);
        }
        else {
            RemoveAttachementPropertiesTask.SetEnabled(true);
            GoToPropertiesAttachementPropertiesTask.SetEnabled(true);
        }
    };

    tasks.TaskAttachmentsOnContextMenu = function (s, e) {
        if (e.objectType === "Node") {
            var x = window.ASPxClientUtils.GetEventX(e.htmlEvent);
            var y = window.ASPxClientUtils.GetEventY(e.htmlEvent);
            window.CtxMenuTaskAttachments.ShowAtPos(x, y);

        }
    };

    tasks.AddTaskTemplateEndCallback = function (s, e) {
        if (s.cpIsTaskEditable !== undefined && s.cpIsTaskEditable !== null) {
            btnSaveAddTemplate.SetEnabled(s.cpIsTaskEditable);
        }

        addAttachmentsAddTemplate.SetChecked(s.cpAddAttachments);
        removeAttachmentsAddTemplate.SetChecked(s.cpRemoveAttachments);
        changeDetailsListAddTemplate.SetChecked(s.cpChangeDetailsList);
    };

    tasks.TimeShiftGridEndCallback = function (s, e) {

        if (s.cpTaskTimeShiftList === 0) {
            RemoveTimeShiftProgressTask.SetEnabled(false);
            GoToPropertiesTimeShiftProgressTask.SetEnabled(false);
        }
        else {
            RemoveTimeShiftProgressTask.SetEnabled(true);
            GoToPropertiesTimeShiftProgressTask.SetEnabled(true);
        }
    };

    tasks.AttachmentsItemClick = function (s, e) {
        switch (e.item.name) {
            case "openRecord":
                Tasks.GoToPropertiesAttachementModalButtonClick();
                break;
            case "createShortcut":
                var values = Helper.FilterTreelistFocusedNodeKey("HomeTaskAttachementsGrid", "TaskItemId")[0];
                View.load("addShortCutPopUp",
                    {
                        "ObjectId": values.ObjectId,
                        "ObjectType": values.ObjectType || 0,
                        "DisplayName": values.PartNumber,
                        "RecordId": values.IdRecord
                    });
                break;
            case "refresh":
                HomeTaskAttachementsGrid.PerformCallback(
                    {
                        isHomeTask: true,
                        shouldReload: true
                    });
                break;
        }
    };

    tasks.changeNotificationCheckboxValues = function (s, e) {
        var checkBoxValue = s.GetChecked();
        $("#" + s.name.replace("Chb", "")).val(checkBoxValue);
    };

    tasks.CtxMainTaskFilterTreeItemDisplay = function (s, e) {
        if (e.objectType === "Node") {
            s.SetFocusedNodeKey(e.objectKey);
            var x = ASPxClientUtils.GetEventX(e.htmlEvent);
            var y = ASPxClientUtils.GetEventY(e.htmlEvent);

            CtxMainTaskFilterTree.ShowAtPos(x, y);

            nodeKey = e.objectKey;
            var node = s.GetNodeHtmlElement(nodeKey);
            var result = JSON.parse(MainTaskFilterTree.cpAllRowData).filter(function (x) {
                return x.Id == nodeKey;
            })[0];

            AppV.pushState("Filters", {
                ObjectId: result.ObjectId,
                FilterId: result.Id,
                IsTaskFilter: true
            });

            //if others, disable context menu elements
            tasks.EnableDisableItemsOnOthers(!result.IsOtherUsers);

            //if it is not filter disable delete context menu item
            tasks.EnableDisableOnFilter(result.Id > 0);

            parentNodeKey = node.getAttribute("ParentNodeKey");
        }
    };

    tasks.EnableDisableItemsOnOthers = function (value) {
        var contextMenu = CtxMainTaskFilterTree;
        contextMenu.GetItemByName('addFilter').SetEnabled(value);
        contextMenu.GetItemByName('editFilter').SetEnabled(value);
        contextMenu.GetItemByName('deleteFilter').SetEnabled(value);
    };

    tasks.EnableDisableOnFilter = function (value) {
        var contextMenu = CtxMainTaskFilterTree;
        contextMenu.GetItemByName('deleteFilter').SetEnabled(value);
        contextMenu.GetItemByName('editFilter').SetEnabled(value);
    };

    tasks.CtxMainTaskFilterTreeItemClick = function (s, e) {
        switch (e.item.name) {
            case "addFilter":
                var menuPanel = window.mainSplFullScreenMode.GetPaneByName("mainSplRightPanel");
                if (!isNaN(AppV.GetFiltersState.ObjectId)) {
                    if (menuPanel.IsCollapsed()) {
                        menuPanel.Expand();
                    }
                    RightPageControlPanel.SetActiveTabIndex(0);
                    window.cbpFilterContent.PerformCallback({
                        objectId: AppV.GetFiltersState.ObjectId,
                        isForProcess: true,
                        processType: enums.ProcessTypes.Tasks
                    });
                } else {
                    if (!menuPanel.IsCollapsed()) {
                        menuPanel.Collapse();
                        window.Filter.ClearFilterFields();
                        window.Filter.DisableFilterFields();
                    }
                }

                break;
            case "editFilter":
                if (!isNaN(AppV.GetFiltersState.FilterId) && AppV.GetFiltersState.FilterId > 0) {
                    View.load("pcModalEditFilter",
                        {
                            filterId: AppV.GetFiltersState.FilterId
                        });
                }
                else {
                    Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3000);
                }
                break;
            case "deleteFilter":
                if (!isNaN(AppV.GetFiltersState.FilterId)) {
                    View.load("pcRemoveFilter", {}, true, false);
                }
                break;
            case "refreshTree":
                //_State.reload = true;
                window.MainTaskFilterTree.PerformCallback();
                break;
            case "showRecords":

                break;
            case "addToFavorites":

                break;
            case "expandAllBtnCtx":
                window.MainTaskFilterTree.ExpandAll();
                break;
            case "collapseAllBtnCtx":
                window.MainTaskFilterTree.CollapseAll();
                break;
        }

    }

    tasks.SaveTemplate = function (s, e) {

        if (taskTemplate.GetText() === "") {
            Notification.SetNotification(SwResourceObject.PleaseEnterADisplayName, 'warning', 3500);
            return;
        }

        if (subjectTaskTemplate.GetText() === "") {
            Notification.SetNotification(SwResourceObject.SubjectCannotBeEmpty, 'warning', 3500);
            return;
        }

        btnTaskTemplateSubmit.DoClick();
    };

    tasks.AddTemplateClick = function (s, e) {
        //pcModalAddTaskTemplate.PerformCallback();
        //pcModalAddTaskTemplate.Show();
        View.load("TaskAddTemplatePopUp", {}, true);
    };

    tasks.AssignUsersSelectAllClick = function() {
        AssignUsersTasksGridView.SelectRows();
    };
    
    tasks.EditTemplateClick = function (s, e) {
        var selectedRow = Helper.GetGridFocusedRowKey("TaskTemplateGrid", TaskTemplateGrid.GetFocusedRowIndex());

        if (selectedRow === null || selectedRow === undefined) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }

        //pcModalAddTaskTemplate.PerformCallback({
        //    taskId: selectedRow,
        //    isEdit: true
        //});
        //pcModalAddTaskTemplate.Show();

        View.load("TaskAddTemplatePopUp", {
            taskId: selectedRow,
            isEdit: true
        }, true);
    };

    tasks.DeleteTemplateClick = function (s, e) {
        Helper.ShowConfirmPopUp("SolidWorks",
            SwResourceObject.AreYouSureYouWantToDeleteSelectedItem,
            "Tasks.DeleteTemplate()");
    };

    tasks.DeleteTaskHomeModule = function () {
        var filesJson = [];
        var recordKeysToDelete = Object.keys(MainGrid.GetSelectedRowValues());

        recordKeysToDelete.forEach(function (key) {
            filesJson.push({
                TaskId: MainGrid.GetSelectedRowValues()[key].RecordId,
                UserCreatedId: MainGrid.GetSelectedRowValues()[key].UserCreatedId
            });
        });

        if (filesJson.length < 1)
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem);
        else
            Tasks.Delete(filesJson);
    };

    tasks.DeleteTasksDashboard = function (filesJson, module = "") {
        if (filesJson.length < 1)
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem);
        else
            Tasks.Delete(filesJson, module);
    };

    tasks.DeleteTasksDashboardConfimation = function (tasksToProcess , module = "") {
        var tasksIds = [];
        var filesJson = [];
        
        tasksIds = tasksIds.concat(tasksToProcess);

        if (DashboardTaskGrid.cpAllRowData != "") {

            tasksIds.forEach(function (k) {
                result = JSON.parse(DashboardTaskGrid.cpAllRowData).filter(function (f) {
                    return f.idRecord == k;
                })[0];

                filesJson.push({
                    TaskId: result.idRecord,
                    UserCreatedId: result.UserCreatedId
                });
            });
        }

        Helper.ShowConfirmPopUp("SolidWorks",
            SwResourceObject.AreYouSureYouWantToDeleteSelectedItem,
            "Tasks.DeleteTasksDashboard(" + JSON.stringify(filesJson) + ", '" + module +"')");
    };

    tasks.DeleteTemplate = function () {
        var selectedRow = Helper.GetGridFocusedRowKey("TaskTemplateGrid", TaskTemplateGrid.GetFocusedRowIndex());

        if (selectedRow === null || selectedRow === undefined) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }

        $.ajax({
            type: 'POST',
            dataType: "json",
            url: '/Tasks/DeleteTaskTemplate/',
            data: {
                "taskId": selectedRow
            },
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    window.TaskTemplateGrid.PerformCallback();
                    cbpTaskTemplateMenu.PerformCallback();

                    Notification.SetNotification(Helper.T(res.Message), 'success', 3500);
                } else {
                    Notification.SetNotification(Helper.T(res.Message), 'warning', 3500);
                }
            }
        });
    };

    function isEmpty(val) {
        return (val === undefined || val == null || val.length <= 0 || val <= 0) ? true : false;
    }

    window.Tasks = tasks;
})();;
var ToDo = (function () {

    var _State = {
        selectedIndex: -1,
        reload: false,
        GridNameSender: "ToDoPropertyCardGrid",
        ModuleName: ""
    };

    var _InternalFunctions = {

        OpenTask: function () {
            var selectedRow = Helper.FilterGridSelectedKeysOnPage("ToDoPropertyCardGrid" + _State.ModuleName, "TaskId")[0];
            var focusedRow = Helper.GetGridFocusedRowKey("ToDoPropertyCardGrid" + _State.ModuleName);

            if (selectedRow !== undefined && selectedRow !== null) {

                if (selectedRow !== null) {

                    View.load("CreateTaskPopUp",
                        {
                            taskIdParam: selectedRow.TaskId,
                            objectId: AppV.GetGlobals().ObjectId,
                            IsEditMode: true,
                            stageId: selectedRow.StageId,
                            recordGuid: AppV.GetGlobals().RecordGuid,
                            moduleName: _State.ModuleName
                        });
                    //TODO: change this check
                    //if (typeof CreateTaskPopUp !== "undefined" && ASPxClientUtils.IsExists(CreateTaskPopUp)) {
                    //    CreateTaskPopUp.PerformCallback({
                    //        taskIdParam: selectedRow.TaskId,
                    //        objectId: AppV.GetGlobals().ObjectId,
                    //        IsEditMode: true,
                    //        stageId: selectedRow.StageId,
                    //        recordGuid: AppV.GetGlobals().RecordGuid,
                    //        moduleName: _State.ModuleName
                    //    });
                    //    CreateTaskPopUp.Show();
                    //}
                    //else {
                    //    View.load("CreateTaskPopUp",
                    //        {
                    //            taskIdParam: selectedRow.TaskId,
                    //            objectId: AppV.GetGlobals().ObjectId,
                    //            IsEditMode: true,
                    //            stageId: selectedRow.StageId,
                    //            recordGuid: AppV.GetGlobals().RecordGuid,
                    //            moduleName: _State.ModuleName
                    //        });
                    //}

                } else {
                    ToDo.ShouldReload(true);
                    window["ToDoPropertyCardGrid" + _State.ModuleName].PerformCallback();
                }

            } else if (focusedRow !== undefined && focusedRow !== null) {
                var rowFocused = JSON.parse(window["ToDoPropertyCardGrid" + _State.ModuleName].cpAllRowData).filter(function (x) {
                    return x.TaskId == Number(focusedRow);
                })[0];

                View.load("CreateTaskPopUp",
                    {
                        taskIdParam: rowFocused.TaskId,
                        objectId: AppV.GetGlobals().ObjectId,
                        IsEditMode: true,
                        stageId: rowFocused.StageId,
                        recordGuid: AppV.GetGlobals().RecordGuid,
                        moduleName: _State.ModuleName
                    });
            }
            else {
                Notification.SetNotification(SwResourceObject.ChooseARecord, 'warning', 3500);
            }
        },

        DisableContextMenuItems(s) {
            window["CtxMenuToDo" + s.cpModuleName].SetEnabled(s.cpHasValues);
            if (s.cpHasValues === false) {
                window["CtxMenuToDo" + s.cpModuleName].GetItemByName("newTask").SetEnabled(true);
                window["CtxMenuToDo" + s.cpModuleName].GetItemByName("refresh").SetEnabled(true);
            }

            if (s.cpModuleName === enums.Modules.Planning) {
                if (window[Planning.getGanttChartId()].getSelectedItems().length > 1) {
                    CtxMenuToDoPlanning.GetItemByName("newTask").SetEnabled(false);
                } else {
                    CtxMenuToDoPlanning.GetItemByName("newTask").SetEnabled(true);
                }
            }
        },

        MoveToADifferentStage: function (module) {
            var selectedTasks = [];
            selectedTasks = Helper.FilterGridSelectedKeysOnPage("ToDoPropertyCardGrid"+ module, "TaskId");
            if (selectedTasks.length === 0 || selectedTasks === -1) {
                selectedTasks = Helper.FilterGridFocusedRowKey("ToDoPropertyCardGrid" + module, "TaskId");
            }
            if (selectedTasks.length === 0 || selectedTasks === -1) {
                Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                return;
            }

            View.load("ChooseStagePopUp",
                {
                    objectId: AppV.GetGlobals().ObjectId,
                    stageId: -1,
                    recordGuid: AppV.GetGlobals().RecordGuid,
                    isCopy: false,
                    moduleName: module,
                    taskItems: selectedTasks.map(a => a.TaskId)
                });
        }
    };

    return {
        ShouldReload: function (reload) {
            if (typeof reload !== 'undefined')
                _State.reload = reload;
            else
                return _State.reload;
        },

        ShowAllStagesChangedToDo: function (s, e) {
            Helper.CreateCookie(enums.CookieKey.SHOWAllSTAGESTODO, window[s.name].GetValue());

            ToDo.ShouldReload(true);

            var selectedItems = [];
            if (window[s.name].cpModuleName === enums.Modules.Planning) {
                var ShowAllSubStagesName = "ShowAllSubStagesToDoChkb" + window[s.name].cpModuleName;
                if (typeof ShowAllSubStagesName !== 'undefined') {
                    if (window[ShowAllSubStagesName].GetChecked() === true) {
                        selectedItems = Planning.ExtractChildrensSelectedStages();
                    }
                }
            }
            window["ToDoPropertyCardGrid" + window[s.name].cpModuleName].PerformCallback({
                objectId: AppV.GetGlobals().ObjectId,
                recordGuid: AppV.GetGlobals().RecordGuid,
                stageId: window.Processes.State.StageId,
                moduleName: window[s.name].cpModuleName,
                selectedStageIds: selectedItems
            });
        },

        ShowAllSubStagesChangedToDo: function (s, e) {
            Helper.CreateCookie(enums.CookieKey.SHOWAllSUBSTAGESTODO, window[s.name].GetValue());

            var selectedItems = [];
            var ShowAllSubStagesName = "ShowAllSubStagesToDoChkb" + window[s.name].cpModuleName;
            if (typeof ShowAllSubStagesName !== 'undefined') {
                if (window[ShowAllSubStagesName].GetChecked() === true) {
                    selectedItems = Planning.ExtractChildrensSelectedStages();
                }
            }

            ToDo.ShouldReload(true);
            window["ToDoPropertyCardGrid" + window[s.name].cpModuleName].PerformCallback({
                objectId: AppV.GetGlobals().ObjectId,
                recordGuid: AppV.GetGlobals().RecordGuid,
                stageId: window.Processes.State.StageId,
                moduleName: window[s.name].cpModuleName,
                selectedStageIds: selectedItems
            });
        },

        DisplayFromButtonContextMenu: function (sender, event) {
            //var sender = {};
            sender = window["ToDoPropertyCardGrid" + sender.cpModuleName];
            //var event = {};
            event.objectType = "Node";
            _State.ModuleName = sender.cpModuleName;
            event.index = window["ToDoPropertyCardGrid" + sender.cpModuleName].GetFocusedRowIndex();
            var offset = $("#MainToDoGridMenuButton" + sender.cpModuleName).offset();
            event.htmlEvent = { clientX: offset.left, clientY: offset.top };
            try {
                ToDo.ContextMenu.Display(sender, event);
                var x = window.ASPxClientUtils.GetEventX(event.htmlEvent);
                var y = window.ASPxClientUtils.GetEventY(event.htmlEvent);
                window["CtxMenuToDo" + sender.cpModuleName].ShowAtPos(x, y);
                if (window["ToDoPropertyCardGrid" + sender.cpModuleName].pageRowCount == 0) {
                    var itemsToDisable = ["openTask", "flagTask", "assignToUser", "markAsCompleted", "delete", "exportToExcel"];
                    itemsToDisable.forEach(function (entry) {
                        var itemContextMenu = window["CtxMenuToDo" + sender.cpModuleName].GetItemByName(entry);
                        if (itemContextMenu !== null) {
                            itemContextMenu.SetEnabled(false);
                        }
                    });
                }
            } catch (event) {
                console.log(event);
            }
        },

        ShowCompletedCheckedChangedToDo: function (s, e) {
            Helper.CreateCookie(enums.CookieKey.SHOWCOMPLETEDTODO, window[s.name].GetValue());

            var selectedItems = [];
            if (window[s.name].cpModuleName === enums.Modules.Planning) {
                var ShowAllSubStagesName = "ShowAllSubStagesToDoChkb" + window[s.name].cpModuleName;
                if (typeof ShowAllSubStagesName !== 'undefined') {
                    if (window[ShowAllSubStagesName].GetChecked() === true) {
                        selectedItems = Planning.ExtractChildrensSelectedStages();
                    }
                }
            }

            ToDo.ShouldReload(true);
            window["ToDoPropertyCardGrid" + s.cpModuleName].PerformCallback({
                objectId: AppV.GetGlobals().ObjectId,
                recordGuid: AppV.GetGlobals().RecordGuid,
                stageId: window.Processes.State.StageId,
                moduleName: s.cpModuleName,
                selectedStageIds: selectedItems
            });
        },

        TasksGridRefresh: function (s, e) {
            ToDo.ShouldReload(true);

            var selectedItems = [];
            if (window[s.name].cpModuleName === enums.Modules.Planning) {
                var ShowAllSubStagesName = "ShowAllSubStagesToDoChkb" + window[s.name].cpModuleName;
                if (typeof ShowAllSubStagesName !== 'undefined') {
                    if (window[ShowAllSubStagesName].GetChecked() === true) {
                        selectedItems = Planning.ExtractChildrensSelectedStages();
                    } else {
                        selectedItems = Planning.GetSelectedStages();
                    }
                }
            }

            window["ToDoPropertyCardGrid" + s.cpModuleName].PerformCallback(
                {
                    objectId: AppV.GetGlobals().ObjectId,
                    recordGuid: AppV.GetGlobals().RecordGuid,
                    stageId: window.Processes.State.StageId,
                    moduleName: s.cpModuleName,
                    selectedStageIds: selectedItems
                });
        },

        TasksGridNew: function (s, e) {
            Tasks.AddNewTaskFromContextMenu(s, e);
        },

        ChooseStageMoveClick: function (isFromProjectDeliverables) {
            var selectedItem = typeof chooseStage === "undefined" ? 0 : chooseStage.GetCurrentValue();
            var taskIdentifier = JSON.parse(ChooseStagePopUp.cpSelectedTasksIds);
            $.ajax({
                type: "POST",
                url: '/ToDo/SaveChooseStage/',
                data: {
                    "arrTaskIds": taskIdentifier,
                    "selectedStage": selectedItem,
                    "isCopy": false,
                    "isFromProjectDeliverables": isFromProjectDeliverables 
                },
                dataType: "json",
                success: function (response) {
                    var res = JSON.parse(response.data);
                    if (res.Success) {
                        ToDo.ShouldReload(true);
                        window["ToDoPropertyCardGrid" + ChooseStagePopUp.cpModuleName].PerformCallback();
                        window.ChooseStagePopUp.Hide();

                    } else {
                        Notification.SetNotification(res.Message, 'warning', 3500);
                    }
                }
            });
        },

        TasksGridOpen: function () {
            _InternalFunctions.OpenTask();
        },

        BeginCallback: function (s, e) {
            e.customArgs["reloadGrid"] = ToDo.ShouldReload();

            if (window[s.name].cpModuleName === enums.Modules.Planning) {
                var selectedItems = [];
                var ShowAllSubStagesName = "ShowAllSubStagesToDoChkb" + window[s.name].cpModuleName;
                if (typeof ShowAllSubStagesName !== 'undefined') {
                    //if (window[ShowAllSubStagesName].GetChecked() === true) {
                    //    selectedItems = Planning.ExtractChildrensSelectedStages();
                    //}
                    if (window[ShowAllSubStagesName].GetChecked() === true) {
                        selectedItems = Planning.ExtractChildrensSelectedStages();
                    } else {
                        selectedItems = Planning.GetSelectedStages();
                    }
                }
                e.customArgs["selectedStageIds"] = selectedItems;
            }
        },

        EndCallback: function (s, e) {
            ToDo.ShouldReload(false);

            if (AppV.GetGlobals().isMainWindow) {
                ToDo.Init(s, e);
            } else {
                if (s.cpModuleName === enums.Modules.Planning) {
                    if (window[Planning.getGanttChartId()].getSelectedItems().length > 1) {
                        btnTasksNewPlanning.SetEnabled(false);
                    } else {
                        btnTasksNewPlanning.SetEnabled(true);
                    }
                }
                window["btnTasksOpen" + s.cpModuleName].SetEnabled(s.cpHasValues);
            }
        },

        RowDblClick: function (s, e) {
            _InternalFunctions.OpenTask();
        },

        Init: function (s, e) {
            var todoGrid = s.name;
            var modulName = todoGrid.replace("ToDoPropertyCardGrid", "");
            RzProperties.CalculateHeightForToDo(modulName);

            _State.ModuleName = s.cpModuleName;

            if (s.cpModuleName === enums.Modules.Planning) {
                if (window[Planning.getGanttChartId()].getSelectedItems().length > 1) {
                    btnTasksNewPlanning.SetEnabled(false);
                } else {
                    btnTasksNewPlanning.SetEnabled(true);
                }
            }

            window["btnTasksOpen" + s.cpModuleName].SetEnabled(s.cpHasValues);
        },

        ContextMenu: {

            Display: function (s, e) {
                var x = window.ASPxClientUtils.GetEventX(e.htmlEvent);
                var y = window.ASPxClientUtils.GetEventY(e.htmlEvent);
                window["CtxMenuToDo" + s.cpModuleName].ShowAtPos(x, y);

                _State.selectedIndex = e.index;
                _State.GridNameSender = s.name;
                _State.ModuleName = s.cpModuleName;

                s.SelectRowOnPage(e.index);

                if (AppV.GetGlobals().ObjectType === enums.ObjectTypes.ProjectsOLD2 ||
                    AppV.GetGlobals().ObjectType === enums.ObjectTypes.ProjectsOLD1 ||
                    AppV.GetGlobals().ObjectType === enums.ObjectTypes.ProjectsNEW ||
                    AppV.GetGlobals().ObjectType === enums.ObjectTypes.Processes) {
                    window["CtxMenuToDo" + s.cpModuleName].GetItemByName("moveToStage").SetVisible(true);
                }

                _InternalFunctions.DisableContextMenuItems(s);
            },

            ItemClick: function (s, e) {
                window["ToDoPropertyCardGrid" + s.cpModuleName].SetFocusedRowIndex(_State.selectedIndex);

                switch (e.item.name) {
                    case "openTask":
                        _InternalFunctions.OpenTask();
                        break;

                    case "newTask":
                        Tasks.AddNewTaskFromContextMenu(s, e);
                        break;

                    case "flagTask":
                        Tasks.FlagUnFlagTaskClick(s.cpModuleName);
                        break;

                    case "assignToUser":
                        Tasks.AssignToUsersCntxMenuClick(s.cpModuleName);
                        break;

                    case "moveToStage":
                        _InternalFunctions.MoveToADifferentStage(s.cpModuleName);
                        break;

                    case "markAsCompleted":
                        var checkGT = window["ToDoPropertyCardGrid" + s.cpModuleName];

                        var result = Helper.FilterGridSelectedKeysOnPage("ToDoPropertyCardGrid" + s.cpModuleName, "TaskId");
                        if (result.length === 0) {
                            if (checkGT.GetFocusedRowIndex() === -1) {
                                Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                                return;
                            }
                            result = JSON.parse(checkGT.cpAllRowData)[checkGT.GetFocusedRowIndex()];
                            result = [result];
                        }

                        if (result == null || result.length == 0) {
                            ToDo.ShouldReload(true);
                            window["ToDoPropertyCardGrid" + s.cpModuleName].PerformCallback();
                            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                            return;
                        }

                        var idsToPost = [];
                        //Check if any of tasks is completed
                        result.forEach(function (entry) {
                            if (entry.Status.toLowerCase() != "completed") {
                                idsToPost.push(entry.TaskId);
                            }
                        });

                        if (result.length > idsToPost.length) {
                            //Some elements can not be completed
                            Notification.SetNotification(SwResourceObject.AtLeastOneTaskCannotBeCompletedYouMayNotBeTheOwnerAnAdministratorOrTheOnlyAssignedUserToIt,
                                'warning', 3500);
                        }

                        if (idsToPost.length > 0) {
                            Helper.ShowConfirmPopUp("SolidWorks",
                                SwResourceObject.ATaskMarkedAsCompletedCanNoLongerBeEdited + "\n" + SwResourceObject.DoYouWantToContinue,
                                "Tasks.MarkAsCompleteFromContextMenu(" + JSON.stringify(idsToPost) + ", '" + s.cpModuleName + "')");
                        }
                        break;

                    case "delete":
                        Helper.ShowConfirmPopUp("SolidWorks",
                            SwResourceObject.AreYouSureYouWantToDeleteSelectedItemS,
                            "Tasks.DeleteTaskContextMenu('" + s.cpModuleName + "')");
                        break;

                    case "refresh":
                        if (typeof window["ToDoPropertyCardGrid" + s.cpModuleName] != 'undefined') {
                            ToDo.ShouldReload(true);
                            window["ToDoPropertyCardGrid" + s.cpModuleName].PerformCallback();
                        }
                        break;

                    case "EnableDisableHorizontalScrollingToDoCtxMenu":
                        break;

                    case "SaveLayout(forAllUsers)ToDoCtxMenu":
                        break;

                    case "exportToExcel":
                        App.Exporting = true;
                        window["ToDoPropertyCardGrid" + s.cpModuleName].ExportTo(ASPxClientGridViewExportFormat.Xlsx);
                        break;
                }
            }
        }
    };
})();;
var RzNotes = (function () {

    var MaxLength = 2200;

    var _State = {
        reload: false,
        isFiltered: false,
        isProcessNote: false
    };

    var usersFilterIds = "";

    var _Internalfunctions = {
        GetNotesFocusedIndexRow: function () {
            var checkGT = "NotesGrid";

            var result = JSON.parse(window[checkGT].cpAllRowData)[window[checkGT].GetFocusedRowIndex()];

            return result;
        }
    };

    return {
        ShouldReload: function (reload) {
            if (typeof reload !== 'undefined')
                _State.reload = reload;
            else
                return _State.reload;
        },

        Default: {
            ExportNote: function () {
                if (typeof commentContent !== 'undefined')
                    window.commentContent.Export(1);
            },

            Delete: function (commentId, userId) {
                //var notesSelected = _Internalfunctions.GetNotesFocusedIndexRow();

                //if (typeof (notesSelected) === 'undefined' || notesSelected == null || notesSelected.length < 1)
                //    Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, enums.NotificationStatus.Warning, 3500);
                //else
                $.ajax({
                    type: "POST",
                    url: '/Notes/DeleteNote/',
                    data: {
                        "noteId": commentId,
                        "noteUserId": userId,
                        "objectId": AppV.GetGlobals().ObjectId,
                        "recordGuid": AppV.GetGlobals().RecordGuid,
                        "partNumber": ""
                    },
                    dataType: "json",
                    success: function (response) {
                        var res = JSON.parse(response.data);
                        if (res.Success) {

                            if (typeof NotesGrid !== 'undefined'
                                && AppV.GetGlobals().ObjectType !== enums.ObjectTypes.Processes) {
                                RzNotes.ShouldReload(true);
                                window.NotesGrid.PerformCallback();
                            }

                            //if (AppV.GetGlobals().ObjectType === enums.ObjectTypes.Processes
                            //    || AppV.GetGlobals().ObjectType === enums.ObjectTypes.TimeSheet
                            //    || AppV.GetGlobals().ObjectType === enums.ObjectTypes.ProjectsOLD1
                            //    || AppV.GetGlobals().ObjectType === enums.ObjectTypes.ProjectsOLD2
                            //    || AppV.GetGlobals().ObjectType === enums.ObjectTypes.ProjectsNEW) {
                            if (typeof cbpNotesSection !== 'undefined') {
                                window.cbpNotesSection.PerformCallback({
                                    objectId: AppV.GetGlobals().ObjectId,
                                    recordGuid: AppV.GetGlobals().RecordGuid,
                                    objectType: AppV.GetGlobals().ObjectType,
                                    shouldReload : true
                                });
                            }

                            //ToDo: if there is the last record deleted refresh main grid
                            //if (typeof gridViewDocuments !== 'undefined') {
                            //    MainGrid.PerformCallback(true);
                            //}

                            Notification.SetNotification(SwResourceObject.RecordDeleted, 'success', 3500);

                        } else {
                            Notification.SetNotification(Helper.T(res.Message), 'warning', 3500);
                        }
                    }
                });
            },

            OnCustomDataCallback: function () {
                AddCommentPopup.Hide();

                //if (typeof NotesGrid !== 'undefined') {
                //    window.NotesGrid.PerformCallback();
                //    NotesGrid.SetFocusedRowIndex(0);
                //}

                cbpNotesSection.PerformCallback(
                    {
                        recordGuid: AppV.GetGlobals().RecordGuid,
                        objectId: AppV.GetGlobals().ObjectId,
                        usersFilter: usersFilterIds,
                        shouldReload: true
                    });

                //ToDo: if it is the first record added refresh main grid
                //if (typeof gridViewDocuments !== 'undefined') {
                //    MainGrid.PerformCallback(true);
                //}
            },

            NotesPanelResize: function () {
                var panelGridHeight = NotesSplitter.GetPaneByName("noteGridContainer").lastHeight;
                NotesGrid.SetHeight(panelGridHeight - 20);

                if (typeof commentContent != 'undefined')
                    RzNotes.Default.CommentContentInit();
            },

            CommentContentInit: function () {

                var panelGridHeight = NotesSplitter.GetPaneByName("noteContentContainer").lastHeight;

                if (typeof commentContent != 'undefined' && NotesGrid.GetVisibleRowsOnPage() > 0)
                    commentContent.SetHeight(panelGridHeight - 20);
            },

            CommentHtmlEditorValidationHandler: function (s, e) {
                if (e.html.length > MaxLength) {
                    e.isValid = false;
                    e.errorText = 'Error..' + e.html.length;
                }

                if (e.html.length === "") {
                    e.isValid = false;
                    e.errorText = SwResourceObject.PleaseEnterAComment;
                    Notification.SetNotification(SwResourceObject.PleaseEnterAComment, enums.NotificationStatus.Warning, 3500);
                }
            }
        },

        Grid: {
            NoteBeginCallback: function (s, e) {
                e.customArgs["usersFilterIds"] = usersFilterIds;
                e.customArgs["shouldReload"] = _State.reload;
            },

            UsersFilterSelectionChange: function (s, e) {
                usersFilterIds = JSON.stringify(window.notesUsersCheckListBoxDropDowncheckListBox.GetSelectedValues());
            },

            RowClick: function () {

                var notesSelected = _Internalfunctions.GetNotesFocusedIndexRow();

                if (typeof (notesSelected) !== 'undefined' && typeof (cbpNotesPreviewContent) !== 'undefined')
                    window.cbpNotesPreviewContent.PerformCallback({
                        commentId: notesSelected.CommentId
                    });
            },

            Init: function () {
                //RzNotes.Default.NotesPanelResize();
                RzProperties.CalculateHeightForNotes();
            }
        },

        Menu: {
            NewNote: function () {

                //View.load("AddCommentPopup",
                //    {
                //        recordGuid: AppV.GetGlobals().RecordGuid,
                //        actionToPerform: enums.ActionToPerform.Save
                //    });

                AddCommentPopup.PerformCallback({
                    recordGuid: AppV.GetGlobals().RecordGuid,
                    actionToPerform: enums.ActionToPerform.Save
                });
                AddCommentPopup.Show();

            },

            CopyNote: function () {
                var notesSelected = _Internalfunctions.GetNotesFocusedIndexRow();

                if (typeof (notesSelected) !== 'undefined') {
                    //View.load("AddCommentPopup",
                    //    {
                    //        commentId: notesSelected.CommentId,
                    //        recordGuid: AppV.GetGlobals().RecordGuid,
                    //        actionToPerform: enums.ActionToPerform.Copy
                    //    });
                    AddCommentPopup.PerformCallback({
                        commentId: notesSelected.CommentId,
                        recordGuid: AppV.GetGlobals().RecordGuid,
                        actionToPerform: enums.ActionToPerform.Copy
                    });
                    AddCommentPopup.Show();
                } else {
                    Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, enums.NotificationStatus.Warning, 3500);
                }
            },

            Edit: function () {
                var notesSelected = _Internalfunctions.GetNotesFocusedIndexRow();

                if (typeof (notesSelected) !== 'undefined') {
                    if (notesSelected.UserId !== NotesGrid.cpUserId) {
                        Notification.SetNotification(SwResourceObject.YouDidNotCreateThisComment, enums.NotificationStatus.Warning, 3500);
                        return;
                    }
                    //View.load("AddCommentPopup",
                    //    {
                    //        commentId: notesSelected.CommentId,
                    //        recordGuid: AppV.GetGlobals().RecordGuid,
                    //        actionToPerform: enums.ActionToPerform.Edit
                    //    });
                    AddCommentPopup.PerformCallback({
                        commentId: notesSelected.CommentId,
                        recordGuid: AppV.GetGlobals().RecordGuid,
                        actionToPerform: enums.ActionToPerform.Edit
                    });
                    AddCommentPopup.Show();

                } else {
                    Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, enums.NotificationStatus.Warning, 3500);
                }
            },

            Refresh: function () {
                window.NotesGrid.PerformCallback({
                    shouldReload  :true
                });
            },

            Delete: function () {
                var notesSelected = _Internalfunctions.GetNotesFocusedIndexRow();

                if (typeof (notesSelected) === 'undefined' || notesSelected == null || notesSelected.length < 1) {
                    Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, enums.NotificationStatus.Warning, 3500);
                }
                else
                    Helper.ShowConfirmPopUp("SolidWorks",
                        SwResourceObject.AreYouSure,
                        "RzNotes.Default.Delete(" + notesSelected.CommentId + "," + notesSelected.UserId + ")");
            },

            Print: function () {

                var notesSelected = _Internalfunctions.GetNotesFocusedIndexRow();

                if (typeof (notesSelected) === 'undefined' || notesSelected == null || notesSelected.length < 1) {
                    Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, enums.NotificationStatus.Warning, 3500);
                }
                else
                    View.load("notePreviewPopup",
                        {
                            commentId: notesSelected.CommentId
                        });
            },

            Filter: function () {
                //Get filter selected values
                var filterArray = window.notesUsersCheckListBoxDropDowncheckListBox.GetSelectedValues();

                if (filterArray.length == 0)
                    return;

                //var filterExpression = "UserId in (" + filterArray + ")";
                //NotesGrid.ApplyFilter(filterExpression);

                window.NotesGrid.PerformCallback({
                    usersFilterIds: usersFilterIds,
                    shouldReload:true
                });

            },

            Export: function () {
                RzNotes.Default.ExportNote();
            }
        },

        Ribbon: {
            CommandExecutedHandler: function (s, e) {
                switch (e.item.name) {
                    case "SaveChanges":
                        window.CommentHtmlEditor.PerformDataCallback(
                            {
                                actionToPerform: s.cpNoteActionToPerform,
                                recordGuid: AppV.GetGlobals().RecordGuid
                            });
                        break;
                    case "CancelChanges":

                        break;
                }
            }
        },

        Processes: {
            AddCommentButtonClick: function (objectType = -1) {

                if (objectType === -1) {
                    objectType = AppV.GetGlobals().ObjectType;
                }

                View.load("AddNotePopUp",
                    {
                        taskId: -1,
                        recordGuid: AppV.GetGlobals().RecordGuid,
                        objectType: objectType
                    });
            },

            ShowComment: function (commentId) {
                View.load("AddNotePopUp",
                    {
                        taskId: commentId,
                        commentId: commentId,
                        recordGuid: AppV.GetGlobals().RecordGuid
                    });
            },

            Remove: function (commentId, userId) {
                Helper.ShowConfirmPopUp("SolidWorks",
                    SwResourceObject.AreYouSure,
                    "RzNotes.Default.Delete(" + commentId + "," + userId + ")");
            }

        }

    };

})();;
var RzSubProcesses = (function () {

    var gridSenderName;

    return {
        Default: {
            OnToolbarClick: function (s, e) {
                switch (e.item.name) {
                    case "tlbOpenRecord":
                        RzSubProcesses.Menu.OpenRecord();
                        break;
                    case "tlbFind":
                        RzSubProcesses.Menu.Find(s, e);
                        break;
                }

            },

            OnInit: function (s, e) {
                
                var subProcessesTree = window["SubProcessesTree"];
                if (typeof subProcessesTree != 'undefined') {

                    if (window["mainSplFullScreenMode"] == undefined) {
                        subProcessesTree.SetHeight(PropertyCardSection.GetHeight() - 20);
                    }
                    else {
                        subProcessesTree.SetHeight(mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight - 50);
                    }
                }

            },

            EndCallback: function (s, e) {
                if (AppV.GetGlobals().isMainWindow) {
                    RzSubProcesses.Default.OnInit();
                }
            }
        },

        Menu: {
            OpenRecord: function (s, e) {
                var selectedRow = Helper.FilterTreelistFocusedNodeKey("SubProcessesTree", "RecordGuid")[0];

                if (selectedRow !== undefined && selectedRow !== null) {

                    var value = selectedRow.UrlEncrypted;

                    if (!Helper.IsEmpty("", value)) {
                        Helper.open('/PropertyCard/Index/' + value, '_blank');
                    }
                    else {
                        Notification.SetNotification(SwResourceObject.ChooseARecord, 'warning', 3500);
                    }
                } else {
                    Notification.SetNotification(SwResourceObject.ChooseARecord, 'warning', 3500);
                }
              
            },

            Find: function (s, e) {
                Helper.HideShowSearchBar(s, e);
            }
        },

        ContextMenu: {

            Display: function (s, e) {
                if (e.objectType === "Node") {
                    var x = window.ASPxClientUtils.GetEventX(e.htmlEvent);
                    var y = window.ASPxClientUtils.GetEventY(e.htmlEvent);
                    window.CtxMenuSubProcesses.ShowAtPos(x, y);
                    gridSenderName = s.name;
                    //if (AppV.GetGlobals().ObjectType == enums.ObjectTypes.Processes)
                    SubProcessesTree.SetFocusedNodeKey(e.objectKey);  
                }
            },
            DisplayFromButtonContextMenu: function () {
                var s = {};
                var e = {};
                s = window["SubProcessesTree"];
                e.objectType = "Node";
                e.objectKey = SubProcessesTree.focusedKey;
                var offset = $("#MainSubProcessesTMenuButton").offset();
                e.htmlEvent = { clientX: offset.left, clientY: offset.top };
                try {
                    RzSubProcesses.ContextMenu.Display(s, e);
                } catch (e) {
                    console.log(e);
                }
            },
            ItemClick: function (s, e) {
                switch (e.item.name) {

                    case "openRecord":
                        RzSubProcesses.Menu.OpenRecord();
                        break;

                    case "copySelectedValue":
                        Helper.CopyTextToClipboard(RzSubProcesses.SubProcessesFieldValueToCopy);
                        break;

                    case "createShortcut":
                        var values = Helper.FilterTreelistFocusedNodeKey("SubProcessesTree", "RecordGuid")[0];
                        View.load("addShortCutPopUp",
                            {
                                "ObjectId": values.ObjectId,
                                "ObjectType": values.ObjectType || 0,
                                "DisplayName": values._System_objNBS + " " + values._System_objDescription,
                                "RecordId": values.idRecord
                            });
                        break;

                    case "createTask":
                        var selectedRow = Helper.FilterTreelistFocusedNodeKey("SubProcessesTree", "RecordGuid")[0];

                        if (selectedRow !== 'undefined' && selectedRow !== null) {

                            if (typeof CreateTaskPopUp !== "undefined" && ASPxClientUtils.IsExists(CreateTaskPopUp)) {
                                CreateTaskPopUp.PerformCallback({
                                    partNumberAndDescription: selectedRow._System_objNBS + " " +(selectedRow._System_objDescription || ""),
                                    objectId: selectedRow.ObjectId,
                                    recordGuid: selectedRow.RecordGuid
                                });
                                CreateTaskPopUp.Show();
                            }
                            else {
                                View.load("CreateTaskPopUp",
                                    {
                                        partNumberAndDescription: selectedRow._System_objNBS + " " + (selectedRow._System_objDescription || ""),
                                        objectId: selectedRow.ObjectId,
                                        recordGuid: selectedRow.RecordGuid
                                    });
                            }
                        }
                        
                        break;

                    case "refresh":
                        window.SubProcessesTree.PerformCallback({
                            shouldReload : true
                        });
                        break;

                    case "exportDataOnly":
                        App.Exporting = true;
                        window[gridSenderName].ExportTo(ASPxClientTreeListExportFormat.Xlsx);
                        break;
                }
            },

            ItemMouseOver: function (s, e) {
                if (e.item.name === "copySelectedValue" && SubProcessesTree.GetFocusedNodeKey() != null) {

                    window.SubProcessesTree.GetNodeValues(window.SubProcessesTree.GetFocusedNodeKey(), '_System_objNBS',
                        function (value) {
                            RzSubProcesses.SubProcessesFieldValueToCopy = value;
                        });
                }
            }
        }
    };
})();;
var RzSWConfiguration = (function () {
    
    var PartNumberOptionValues = {
        New: "0",
        CopyFrom: "1",
        UseRootPartNumber: "2"
    };

    var _Internalfunctions = {
        OpenMakeActiveOrInactive: function (isInActive) {

            var allowedConfigType = ((isInActive === true) ? enums.SWConfigurationType.Active : enums.SWConfigurationType.Inactive);
            var focusedRows = Helper.FilterTreelistFocusedNodeKey("ConfigurationTree", "IdRecord")[0];
            var selectedRows = Helper.FilterTreeListSelectedNodeKeys("ConfigurationTree", "IdRecord");

            var rowsToProcess = [];

            if (focusedRows === undefined && focusedRows === null &&
                selectedRows === undefined && selectedRows === null &&
                selectedRows.length === 0) {
                Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                return; 
            } 

            if (focusedRows.SystemObjConfigurationType === allowedConfigType) {
                rowsToProcess.push(focusedRows.IdRecord);
            }
            
            selectedRows.forEach(function (entry) {
                if (rowsToProcess.includes(entry.IdRecord) === false
                    && entry.SystemObjConfigurationType === allowedConfigType) {
                   rowsToProcess.push(entry.IdRecord);
                }
            });

            if (rowsToProcess == null || rowsToProcess.length === 0) {
                Notification.SetNotification(SwResourceObject.ThisOperationIsAvailableOnlyForActiveConfigurations, 'warning', 3500);
                return;
            }
            
            View.load("pcMakeActiveInactive",
                {
                    objectId: AppV.GetGlobals().ObjectId,
                    selectedRows: rowsToProcess,
                    isInactive: isInActive
                });

        }
    };
    
    return {
        Default: {
            OnToolbarClick: function (s, e) {
                switch (e.item.name) {
                    case "tlbRefresh":
                        window.ConfigurationTree.PerformCallback({
                            shouldReload: true
                        });
                        break;
                    case "tlbAddConfiguration":
                        
                        View.load("pcAddVirtualConfiguration",
                            {
                                objectId: AppV.GetGlobals().ObjectId,
                                recordId: AppV.GetGlobals().RecordId,
                                configGuid: ConfigurationTree.cpConfigurationGuid
                            });
                        break;
                    case "tlbOpenRecord":
                        RzSWConfiguration.Menu.OpenRecord();
                        break;
                    case "tlbFind":
                        RzSWConfiguration.Menu.Find(s, e);
                        break;
                }

            },

            OnInit: function (s, e) {
                
                var subConfigurationTree = window["ConfigurationTree"];
                if (typeof subConfigurationTree != 'undefined') {

                    if (window["mainSplFullScreenMode"] == undefined) {
                        subConfigurationTree.SetHeight(PropertyCardSection.GetHeight() - 20);
                    }
                    else {
                        subConfigurationTree.SetHeight(mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight - 50);
                    }
                }

                if (!s.cpIsTreeLoad) {
                    Helper.CreateCookie(enums.CookieKey.SHOWUNSAVEDCONFIGURATION, true);
                    Helper.CreateCookie(enums.CookieKey.SHOWVIRTUALCONFIGURATION, true);
                }
                

            },

            EndCallback: function (s, e) {
                if (AppV.GetGlobals().isMainWindow) {
                    RzSWConfiguration.Default.OnInit(s,e);
                }
            }
        },

        Menu: {
            OpenRecord: function (s, e) {
                var selectedRow = Helper.FilterTreelistFocusedNodeKey("ConfigurationTree", "IdRecord")[0];

                if (selectedRow !== undefined && selectedRow !== null) {

                    var value = selectedRow.UrlEncrypted;

                    if (!Helper.IsEmpty("", value)) {
                        Helper.open('/PropertyCard/Index/' + value, '_blank');
                    }
                    else {
                        Notification.SetNotification(SwResourceObject.ChooseARecord, 'warning', 3500);
                    }
                } else {
                    Notification.SetNotification(SwResourceObject.ChooseARecord, 'warning', 3500);
                }
              
            },

            Find: function (s, e) {
                Helper.HideShowSearchBar(s, e);
            },

            UnSavedConfigCheckedChanged: function () {
                Helper.CreateCookie(enums.CookieKey.SHOWUNSAVEDCONFIGURATION, UnSavedConfigChkb.GetValue());
                ConfigurationTree.PerformCallback();
            },

            VirtualConfigCheckedChanged: function () {
                Helper.CreateCookie(enums.CookieKey.SHOWVIRTUALCONFIGURATION, VirtualConfigChkb.GetValue());
                ConfigurationTree.PerformCallback();
            }
        },

        ContextMenu: {

            Display: function (s, e) {
                if (e.objectType === "Node") {
                    var x = window.ASPxClientUtils.GetEventX(e.htmlEvent);
                    var y = window.ASPxClientUtils.GetEventY(e.htmlEvent);

                    var rights = JSON.parse(ConfigurationTree.cpActionRights);
                    
                    window.CtxMenuConfiguration.ShowAtPos(x, y);
                    gridSenderName = s.name;
                    
                    ConfigurationTree.SetFocusedNodeKey(e.objectKey);  
                    
                    CtxMenuConfiguration.SetEnabled(true);
                    CtxMenuConfiguration.GetItemByName("makeActive").SetEnabled(rights.MakeActive);
                    CtxMenuConfiguration.GetItemByName("makeInActive").SetEnabled(rights.MakeInactive);
                    CtxMenuConfiguration.GetItemByName("addVirtualConfiguration").SetEnabled(rights.AddVirtual); 
                }
            },

            DisplayFromButtonContextMenu: function () {
                var s = {};
                s = window["ConfigurationTree"];
                var e = {};
                e.objectType = "Node";
                e.objectKey = ConfigurationTree.focusedKey;
                var offset = $("#MainConfigurationMenuButton").offset();
                e.htmlEvent = { clientX: offset.left, clientY: offset.top };
                try {
                    RzSWConfiguration.ContextMenu.Display(s, e);
                } catch (e) {
                    console.log(e);
                }
            },

            ItemClick: function (s, e) {
                switch (e.item.name) {

                    case "openRecord":
                        RzSWConfiguration.Menu.OpenRecord();
                        break;

                    case "addVirtualConfiguration":
                        
                        View.load("pcAddVirtualConfiguration",
                            {
                                objectId: AppV.GetGlobals().ObjectId,
                                recordId: AppV.GetGlobals().RecordId,
                                configGuid: ConfigurationTree.cpConfigurationGuid
                            });
                        break;

                    case "makeActive":
                        _Internalfunctions.OpenMakeActiveOrInactive(false);
                        break;

                    case "makeInActive":
                        _Internalfunctions.OpenMakeActiveOrInactive(true);
                        break;
                    
                    case "refresh":
                        window.ConfigurationTree.PerformCallback({
                            shouldReload : true
                        });
                        break;
                }
            }
        },

        AddVirtual: {
            PartNumberOptionIndexChange: function (s, e) {
                var value = rbPartNumberOption.GetValue();
                $("#useRootPartNumber").css("display", "none");
                Helper.EnableDisableInputType("cbConfigurationsList", true);

                switch (value) {
                    case PartNumberOptionValues.New:
                        break;
                    case PartNumberOptionValues.CopyFrom:
                        //enable drop down
                        Helper.EnableDisableInputType("cbConfigurationsList", false);
                        break;
                    case PartNumberOptionValues.UseRootPartNumber:
                        //enable div
                        $("#useRootPartNumber").css("display", "block");
                        break;
                    default:
                }
            },

            PartNumberOptionOnInit: function (s,e) {
                Helper.EnableDisableInputType("cbConfigurationsList", true);
            },

            AddClick: function (s, e) {
                //validations
                if (configurationNameTxt.GetText() === "") {
                    Notification.SetNotification(SwResourceObject.ConfigurationNameCannotBeEmpty, 'warning', 3500);
                    return;
                }

                //check selected command
                var value = rbPartNumberOption.GetValue();

                if (value === PartNumberOptionValues.CopyFrom) {
                    var recordToCopy = cbConfigurationsList.GetValue();
                    if (recordToCopy === null) {
                        Notification.SetNotification(SwResourceObject.PleaseSelectAConfiguration, 'warning', 3500);
                        return;
                    }
                }
                
                Request.ajax({
                    type: "POST",
                    url: '/SWConfiguration/AddVirtualConfiguration/',
                    data: {
                        objectId: AppV.GetGlobals().ObjectId,
                        subObjectGuid: AppV.GetGlobals().SubObjectGuid,
                        configurationName: configurationNameTxt.GetValue(),
                        configGuid: ConfigurationTree.cpConfigurationGuid,
                        recordId: AppV.GetGlobals().RecordId
                    },
                    dataType: "json"
                }).then(function (response) {
                    
                    if (response.success) {
                        broadcastV.create({ endPoint: "SwConfigurationAddVirtual" });

                        switch (value) {
                            case PartNumberOptionValues.New:
                                Helper.open('/PropertyCard/AddNew/' + response.addNewUrlEncrypted, '_blank');
                                window.pcAddVirtualConfiguration.Hide();
                                break;

                            case PartNumberOptionValues.CopyFrom:

                                FieldVaildation.SetnewFrom(true);
                                View.load("NewFrom",
                                    {
                                        objectId: AppV.GetGlobals().ObjectId,
                                        recordID: recordToCopy,
                                        recordGuid: AppV.GetGlobals().RecordGuid,
                                        SubObjectGuid: AppV.GetGlobals().SubObjectGuid,
                                        isPreviewMode: false,
                                        hasEditRights: true,
                                        keepNbs: false,
                                        parentRecordId : AppV.GetGlobals().RecordId
                                    });

                                pcAddVirtualConfiguration.Hide();
                                    
                                break;

                            case PartNumberOptionValues.UseRootPartNumber:

                                break;
                            default:
                        }
                    } else {
                        Notification.SetNotification(response.message, 'warning', 5000);
                    }
                  })
                    .then(function () { window.loadingPanel.Hide(); });
                
            }
        },

        MakeActiveInactive: {

            AddClick: function (s, e) {

                var recordIds = pcMakeActiveInactive.cpSelectedRows;
                var isInactive = pcMakeActiveInactive.cpIsInactive;
                var inActivationType = rbMakeActiveInactiveOption.GetValue();

                Request.ajax({
                    type: "POST",
                    url: '/SWConfiguration/DoActiveInactive/',
                    data: {
                        objectId: AppV.GetGlobals().ObjectId,
                        recordIds: recordIds,
                        isInactive: isInactive,
                        inActivationType: inActivationType
                    },
                    dataType: "json"
                }).then(function (response) {

                    var result = JSON.parse(response.data);
                    
                    if (result.Success) {

                        if (result.CustomAttributes.UrlEncryptedList.length > 0) {

                            result.CustomAttributes.UrlEncryptedList.forEach(function (entry) {
                                Helper.open('/PropertyCard/Index/' + entry, '_blank');
                            });
                            
                        } else {
                            window.ConfigurationTree.PerformCallback({
                                shouldReload: true
                            });
                        }
                        
                        pcMakeActiveInactive.Hide();

                        Notification.SetNotification(SwResourceObject.SavedSuccessfully, 'success', 3500);
                        
                    }
                        
                }).then(function () { window.loadingPanel.Hide(); });
            },

            MakeActiveInactiveOptionIndexChange: function (s,e) {

            }
        }
    };
})();;
var RzWhereUsedAsField = (function () {

    var PartNumerToCopy;

    var _Internalfunctions = {
        
        OnContextMenuOver : function (s, e) {

            if (e.item.name === "copySelectedValue") {

                var selectedRow = Helper.FilterGridSelectedKeysOnPage("WhereUsedAsFieldTree", "IdRecord")[0];
                RzWhereUsedAsField.PartNumerToCopy = selectedRow.PartNumber;

            }
        }
    };

    return {
        Default: {
            OnToolbarClick: function (s, e) {
                switch (e.item.name) {
                    //case "tlbRefresh":

                    //    break;
                    //case "tlbAddConfiguration":

                    //    break;
                    //case "tlbOpenRecord":
                    //    RzSWConfiguration.Menu.OpenRecord();
                    //    break;
                    case "tlbFind":
                        RzSWConfiguration.Menu.Find(s, e);
                        break;
                }

            },

            OnInit: function (s, e) {

                var subWhereUsedAsFieldTree = window["WhereUsedAsFieldTree"];
                if (typeof subWhereUsedAsFieldTree != 'undefined') {

                    if (window["mainSplFullScreenMode"] == undefined) {
                        subWhereUsedAsFieldTree.SetHeight(PropertyCardSection.GetHeight() - 20);
                    }
                    else {
                        subWhereUsedAsFieldTree.SetHeight(mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight - 50);
                    }
                }

            },

            EndCallback: function (s, e) {
                if (AppV.GetGlobals().isMainWindow) {
                    RzWhereUsedAsField.Default.OnInit();
                }
            },

            BeginCallback: function (s, e) {
                e.customArgs["maxNumbers"] = MaximumNumber.GetValue();
            }
        },

        Menu: {
            ExpandAllCheckedChanged: function (s, e) {

                Helper.CreateCookie(enums.CookieKey.EXPANDALLWHEREUSEDASFIELD, s.GetValue());

                if (s.GetChecked() === false) {
                    WhereUsedAsFieldTree.CollapseAll();
                } else {
                    WhereUsedAsFieldTree.ExpandAll();
                }
            },

            Find: function (s, e) {
                Helper.HideShowSearchBar(s, e);
            },

            OpenRecord: function (s, e) {
                var selectedRow = Helper.FilterGridSelectedKeysOnPage("WhereUsedAsFieldTree", "IdRecord")[0];

                if (selectedRow !== undefined && selectedRow !== null) {

                    var value = selectedRow.UrlEncrypted;

                    if (!Helper.IsEmpty("", value)) {
                        Helper.open('/PropertyCard/Index/' + value, '_blank');
                    }
                    else {
                        Notification.SetNotification(SwResourceObject.ChooseARecord, 'warning', 3500);
                    }
                } else {
                    Notification.SetNotification(SwResourceObject.ChooseARecord, 'warning', 3500);
                }

            },

            AsObjectFieldTypeCheckedChanged: function () {
                Helper.CreateCookie(enums.CookieKey.ASOBJECTFIELDTYPE, AsObjectFieldType.GetValue());
                window.WhereUsedAsFieldTree.PerformCallback();
            },

            AsLookupFieldTypeCheckedChanged: function () {
                Helper.CreateCookie(enums.CookieKey.ASLOOKUPFIELDTYPE, AsLookupFieldType.GetValue());
                window.WhereUsedAsFieldTree.PerformCallback();
            },

            MaximumNumberValueChanged: function () {
                Helper.CreateCookie(enums.CookieKey.MAXIMUMNUMBERWHEREUSEDASFIELD, MaximumNumber.GetValue());
            }
        },

        ContextMenu: {

            Display: function (s, e) {
                if (e.objectType === "row" || e.objectType === "emptyrow") {
                    var x = window.ASPxClientUtils.GetEventX(e.htmlEvent);
                    var y = window.ASPxClientUtils.GetEventY(e.htmlEvent);

                    window.CtxMenuWhereUsedAsField.ShowAtPos(x, y);

                    if (e.index !== -1) {
                        WhereUsedAsFieldTree.SetFocusedRowIndex(e.index);
                        WhereUsedAsFieldTree.SelectRowOnPage(e.index);
                    }

                    CtxMenuWhereUsedAsField.SetEnabled(true);

                    if (e.objectType === "emptyrow") {
                        CtxMenuWhereUsedAsField.SetEnabled(false);
                        CtxMenuWhereUsedAsField.GetItemByName("refresh").SetEnabled(true);
                    }
                }
            },

            DisplayFromButtonContextMenu: function () {
                var s = {};
                var e = {};
                s = window["WhereUsedAsFieldTree"];

                window["WhereUsedAsFieldTree"].pageRowCount === 0 ? e.objectType = "emptyrow" : e.objectType = "row";

                e.index = window["WhereUsedAsFieldTree"].GetFocusedRowIndex();
                var offset = $("#MainWhereUsedAsFieldTreeMenuButton").offset();
                e.htmlEvent = { clientX: offset.left, clientY: offset.top };
                try {
                    RzWhereUsedAsField.ContextMenu.Display(s, e);
                } catch (e) {
                    console.log(e);
                }
            },
            ItemClick: function (s, e) {
                switch (e.item.name) {

                    case "openRecord":
                        RzWhereUsedAsField.Menu.OpenRecord();
                        break;

                    case "createShortcut":
                        var selectedRow = Helper.FilterGridSelectedKeysOnPage("WhereUsedAsFieldTree", "IdRecord")[0];
                        
                        View.load("addShortCutPopUp",
                            {
                                "ObjectId": selectedRow.ObjectId,
                                "ObjectType": selectedRow.ObjectType,
                                "DisplayName": selectedRow.PartNumber + " " + selectedRow.Description,
                                "RecordId": selectedRow.IdRecord
                            });

                        break;

                    case "export":
                        App.Exporting = true;
                        WhereUsedAsFieldTree.ExportTo(ASPxClientGridViewExportFormat.Xlsx);
                        break;

                    case "copySelectedValue":
                        Helper.CopyTextToClipboard(RzWhereUsedAsField.PartNumerToCopy);
                        break;

                    case "refresh":
                        window.WhereUsedAsFieldTree.PerformCallback({
                            shouldReload: true
                        });
                        break;
                }
            },

            ItemMouseOver: function (s, e) {
                _Internalfunctions.OnContextMenuOver(s,e);
            }
        }
    };
})();;

var RelatedFiles = (function () {

    var State = {
        Related: {
            LastHeight: 0,
            reload: false
        }
    };

    function RelatedFilesContextMenuEnableItems(checkedStatus,
        specialAdministrationUploadNewerRelatedFiles,
        specialAdministrationDeleteRelatedFiles) {
        switch (checkedStatus) {

            case enums.RecordStatus.checkedOutByself:
            case enums.RecordStatus.Non_Controlled_editing:
            case enums.RecordStatus.Non_Controlled_editing_Self:
                EnableDisableItemsRelatedFiles('uploadNewerFileBtnCtx', true);
                EnableDisableItemsRelatedFiles('deleteBtnCtx', true);
                break;

            case enums.RecordStatus.CheckedOut:
                EnableDisableItemsRelatedFiles('uploadNewerFileBtnCtx', false);
                EnableDisableItemsRelatedFiles('deleteBtnCtx', false);
                break;

            default:
                if (specialAdministrationUploadNewerRelatedFiles === 0)
                    EnableDisableItemsRelatedFiles('uploadNewerFileBtnCtx', false);

                if (specialAdministrationDeleteRelatedFiles === 0)
                    EnableDisableItemsRelatedFiles('deleteBtnCtx', false);
                break;
        }

        if (AppV.GetGlobals().ObjectType === enums.ObjectTypes.TimeSheet) {
            EnableDisableItemsRelatedFiles('deleteBtnCtx', DeleteFileRelFile.GetEnabled());
        }
    }

    function EnableDisableItemsRelatedFiles(cntxMenuItem, value) {
        CtxMenuRelatedFiles.GetItemByName(cntxMenuItem).SetEnabled(value);
    }

    function GetFileExtension(fileName) {
        return fileName.substr(fileName.lastIndexOf('.'));
    }

    function CheckNewerFileIsUpload(fileName) {
        $.ajax({
            type: "POST",
            url: '/RelatedFiles/CheckNewerFileIsUpload/',
            data: { "fileName": fileName },
            dataType: "json",
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {

                    window.BtnNewerFileSelectionOK.SetEnabled(true);

                    //Hide loader
                    window.loadingPanel.Hide();

                    //Close popup
                    uploadNewerFilePopupControl.Hide();

                    //Refresh treelist
                    State.Related.reload = true;
                    relatedFilesRecords.PerformCallback();

                    Notification.SetNotification(SwResourceObject.CompletedSuccessfully, 'success', 3500);

                }
                else {
                    window.BtnNewerFileSelectionOK.SetEnabled(true);
                    //Hide loader
                    window.loadingPanel.Hide();
                    Notification.SetNotification(SwResourceObject[res.Message], 'warning', 3500);
                }
            }
        });
    }

    function GetFilesToDownload(entry) {
        window.location.href = "";
        window.location.href = RootUrl + 'File/DownloadFile?fileName=' + encodeURIComponent(entry);
    }


    return {

        OnDocumentPreviewRelatedFilesItemsClick: function () {
            var recordID = AppV.GetGlobals().RecordId,
                objectID = AppV.GetGlobals().ObjectId;
            //objectType = AppV.GetGlobals().ObjectType;

            if (objectID != -1) {
                //if (objectType == enums.ObjectTypes.Documents ||
                //    objectType == enums.ObjectTypes.SWPDM ||
                //    objectType == enums.ObjectTypes.Template ||
                //    objectType == enums.ObjectTypes.Processes ||
                //    objectType == enums.ObjectTypes.Records ||
                //    objectType == enums.ObjectTypes.CustomCases) {

                var result = Helper.FilterTreelistFocusedNodeKey("relatedFilesRecords", "FileId")[0];

                var strFileName = result.OriginalFileName;
                var isFolder = result.IsFolder;
                if (strFileName != null && objectID != null && recordID != null && isFolder !== true) {
                    OnDocumentPreviewTabClick(objectID, recordID, strFileName, result.Version, enums.ObjectTypes.Documents);
                    //}
                } else {
                    DocumentPreviewClearCache();
                }
            }
        },

        DecryptFile: function (s, e, objId, recordId) {
            $.ajax({
                type: "POST",
                url: '/File/DecryptFileAndShow/',
                data: {
                    "objectId": objId,
                    "recordId": recordId,
                    "password": passwordTextBox.GetText()
                },
                dataType: "json",
                success: function (response) {
                    var _res = JSON.parse(response.data);
                    if (_res.Success) {
                        window.cbpDocumentPreviewContent.PerformCallback({
                            strFileName: "",
                            objectId: objectID,
                            recordId: recordID
                        });
                        ModalPasswordDocPreview.Hide();
                    }
                    else {
                        ModalPasswordDocPreview.Show();
                        Notification.SetNotification("Incorrect Password", 'warning', 3500);
                    }
                }
            });
        },

        DownloadEncryptedFile: function (fileName) {
            Helper.download_multiple_files([{
                download: RootUrl + 'File/DownloadFilePreview?fileName=' + fileName,
                filename: fileName
            }]);
        },

        Init: function () { 
            RzProperties.CalculateHeightForRelatedFiles();
        },

        BeginCallback: function (s, e) {
            e.customArgs["reload"] = State.Related.reload;
            e.customArgs["idObject"] = AppV.GetGlobals().ObjectId;
            e.customArgs["idRecord"] = AppV.GetGlobals().RecordId;

        },

        ShowAllCheckBoxChkB_CheckedChanged: function (s, e) {
            Helper.CreateCookie(enums.CookieKey.SHOWALLRELATEDFILES, ShowAllCheckBoxChkB.GetValue());
            State.Related.reload = true;
            window.relatedFilesRecords.PerformCallback();
        },

        FocusedNodeChanged: function (s, e) {

            if (relatedFilesRecords.IsNodeSelected(s.focusedKey) !== true) {
                window.relatedFilesRecords.SelectNode();
            }
            RelatedFiles.NodeClick(s, e);
        },

        NodeClick: function (s, e) {
            if (AppV.GetGlobals().isMainWindow) {
                var menuPanel = window.mainSplFullScreenMode.GetPaneByName("mainSplRightPanel");
                if (!menuPanel.IsCollapsed()) {
                    if (window.RightPageControlPanel.activeTabIndex === 1) {
                        RelatedFiles.OnDocumentPreviewRelatedFilesItemsClick();
                    }
                }
            } else {
                if (PropertyCard.Splitter.IsPreviewPanelOpen()) {
                    RelatedFiles.OnDocumentPreviewRelatedFilesItemsClick();
                }
            }
        },

        EndCallback: function (s, e) {
            State.Related.reload = false;

        },

        AddNewerFileRelatedFiles: function (recordId, objectId, recordGUID) {

            var values = Helper.FilterTreelistFocusedNodeKey("relatedFilesRecords", "FileId")[0];

            if (typeof (values) === 'undefined' || values == null) {
                Notification.SetNotification(SwResourceObject.PleaseSelectAFolder, 'warning', 3500);
                return;
            }

            if (values.IsFolder === true) {
                Notification.SetNotification('You do not have access to write to this folder!', 'warning', 3500);
                return;
            }
            View.load('uploadNewerFilePopupControl',
                {
                    isPrimary: values.IsPrimary,
                    fileId: values.FileId,
                    isFolder: values.IsFolder,
                    recordId: recordId,
                    objectId: objectId,
                    primaryFileNameExtension: GetFileExtension(values.FileName),
                    recordGuid: recordGUID
                });
        },

        FileUpload: {

            Shown: function (s, e) {
                var windowInnerWidth = window.innerWidth;
                if (s.GetWidth() > windowInnerWidth) {
                    s.SetWidth(windowInnerWidth - 4);
                    s.UpdatePosition();
                }
            },

            BtnRelatedFileOK_Click: function (s, e) {
                if (window.ucMultiSelection.GetFileNames().length !== 0) {

                    //Disable Upload Button
                    window.BtnRelatedFileOK.SetEnabled(false);

                    //Show loader
                    window.loadingPanel.Show();

                    //Execute upload
                    window.ucMultiSelection.Upload();

                } else {
                    Notification.SetNotification(window.SwResourceObject.PleaseSelectAFile, 'warning', 3500);
                }
            },

            BtnRelatedFileCancel_Click: function (s, e) {
                DisableNeccesaryItemsOnAction(window.ActiveObjectsOnAction, false, enums.RibbonNames.Properties);
                fileUploadPopupControl.Hide();
            },

            FileUploadComplete: function (s, e) {
                if (e.callbackData) {
                    //Close popup
                    fileUploadPopupControl.Hide();

                    //Refresh treelist
                    State.Related.reload = true;
                    relatedFilesRecords.PerformCallback();

                    //Enable Upload Button
                    window.BtnRelatedFileOK.SetEnabled(true);

                    //Hide loader
                    window.loadingPanel.Hide();
                }
                else { Notification.SetNotification(SwResourceObject.AnErrorOccurred, 'error', 3500); }
            },

            Init: function (s, e) {
                //Show clearbox button 
                var clearBoxName = s.name + "_ClearBox";
                $('*[id^="' + clearBoxName + '"]').find('a:first').attr('style', 'visibility:visible;');

            },

            OnTextChanged: function (s, e) {
                var fileName = s.GetText();
                var extensions = [];
                var files = fileName.split(",");
                if (fileName.includes(",")) {
                    for (var i = 0; i < files.length; i++) {
                        extensions.push(files[i].substring(files[i].indexOf('.') + 1, files[i].length));
                    }
                } else {
                    extensions.push(fileName.substring(fileName.indexOf('.') + 1, fileName.length));
                };
                
                var notAllowedExtension = s.cpallowedFileSizes;
                var clearNotAllowedExtension = [];
                var alertExt = "";
                if (notAllowedExtension != undefined) {
                    for (var i = 0; i < notAllowedExtension.length; i++) {
                        var ext = notAllowedExtension[i].replace("-", "");
                        clearNotAllowedExtension.push(ext);
                        if (extensions.includes(ext.trim())) {
                            alertExt += ext + ", ";

                        }
                    }
                }
                

                if (alertExt.length > 0) {
                    var alertSplit = alertExt.split(",");
                    if (alertSplit.length >= 2) {
                        Notification.SetNotification(SwResourceObject.FileExtension_A_IsNotAllowed.replace("{0}", alertExt), 'warning', 3500);
                    } 
                    e.cancel = true;
                    s.ClearText();
                }
                    
            },

            OnValidationErrorOccurred: function (s, e) {
                e.showAlert = false;
                var extensions = [];
                var files = e.invalidFiles;
                for (var i = 0; i < files.length; i++) {
                    extensions.push(files[i].fileName.substring(files[i].fileName.indexOf('.') + 1, files[i].fileName.length));
                }
                if (extensions.length > 0) {
                    var alertExt = "";
                    for (var i = 0; i < extensions.length; i++) {
                        alertExt += extensions[i] + ","
                    }
                    Notification.SetNotification(SwResourceObject.FileExtension_A_IsNotAllowed.replace("{0}", alertExt), 'warning', 3500);
                }
            },
        },

        NewerFileUpload: {
            BtnNewerFileSelectionOK_Click: function (s, e) {
                if (window.ucNewerFileSelection.GetFileNames().length !== 0) {

                    window.BtnNewerFileSelectionOK.SetEnabled(false);
                    //Show loader
                    window.loadingPanel.Show();

                    window.ucNewerFileSelection.Upload();

                } else {
                    Notification.SetNotification(window.SwResourceObject.PleaseSelectAFile, 'warning', 3500);
                }
            },
            BtnNewerFileSelectionCancel_Click: function (s, e) {
                DisableNeccesaryItemsOnAction(window.ActiveObjectsOnAction, false, enums.RibbonNames.Properties);
                uploadNewerFilePopupControl.Hide();
            },
            FileUploadComplete: function (s, e) {
                if (e.callbackData) {
                    CheckNewerFileIsUpload(e.callbackData);
                }
                else { Notification.SetNotification(SwResourceObject.AnErrorOccurred, 'error', 3500); }
            }
        },

        FileDownload: {

            DownloadFiles: function (recordId, objectId, recordGuid, fileData = "") {
                var downloadData = "";
                if (fileData != "") {
                    downloadData = JSON.stringify(fileData);
                }

                loadingPanel.Show();
                $.ajax({
                    cache: false,
                    type: 'GET',
                    url: '/File/PostDownloadFile',
                    contentType: 'application/json; charset=utf-8',
                    data: {
                        "downloadData": downloadData,
                        "recordId": recordId,
                        "objectId": objectId,
                        "recordGuid": recordGuid
                    },
                    dataType: "json",
                    success: function (Data) {

                        loadingPanel.Hide();

                        if (Data === null || Data === "null") {
                            Notification.SetNotification(SwResourceObject.FailedToDownloadFile, 'warning', 3500);
                            return;
                        }

                        var responseData = JSON.parse(Data.data);//JSON.parse(Data);

                        if (responseData.Success !== false) {
                            //Download zip
                            //GetFilesToDownload(responseData);

                            if (responseData.CustomAttributes.FilesList == null) {
                                Notification.SetNotification(SwResourceObject.FailedToDownloadFile, 'warning', 3500);
                                return;
                            }

                            //Download one by on the files arrived
                            var filesToDownload = responseData.CustomAttributes.FilesList.split("|;");
                            var i;
                            var filesJson = [];

                            for (i = 0; i < filesToDownload.length - 1; i++) {
                                if (filesToDownload[i] === "") {
                                    Notification.SetNotification(SwResourceObject.FailedToDownloadFile, 'warning', 3500);
                                } else {
                                    filesJson.push({
                                        download: RootUrl + 'File/DownloadFile?fileName=' + encodeURIComponent(filesToDownload[i]),
                                        filename: filesToDownload[i]
                                    });
                                }
                            }
                            Helper.download_multiple_files(filesJson);
                        }
                        else {
                            Notification.SetNotification(SwResourceObject[responseData.Message], 'warning', 3500);
                        }
                    },
                    error: function (response) {
                        loadingPanel.Hide();
                        console.log(response);
                    }
                });
            },

            DownloadDocument: function (recordId, objectId, recordGuid) {

                var result = Helper.FilterTreeListSelectedNodeKeys("relatedFilesRecords", "FileId");

                //  window.relatedFilesRecords.GetSelectedNodeValues("FileID;FileName;IsFolder;IsPrimary;Version",function getSelectedFieldValuesCallback(values) {
                if (typeof (result) === 'undefined' || result === null || result.length === 0) {
                    Notification.SetNotification(SwResourceObject.PleaseSelectAFile, 'warning', 3500);
                    return;
                }
                RelatedFiles.FileDownload.DownloadFiles(recordId, objectId, recordGuid, result);
                // });
            },

            DownloadMultiplePrimaryFiles: function (downloadData) {

                loadingPanel.Show();

                $.ajax({
                    cache: false,
                    type: 'GET',
                    url: '/File/DownloadPrimaryFiles',
                    contentType: 'application/json; charset=utf-8',
                    data: {
                        "downloadData": downloadData
                    },
                    dataType: "json",
                    success: function (Data) {
                        loadingPanel.Hide();
                        var responseData = JSON.parse(Data.data);//JSON.parse(Data); 
                        if (responseData.Success !== false) {
                            //Download zip
                            //GetFilesToDownload(responseData);

                            //Download one by on the files arrived
                            var filesToDownload = responseData.CustomAttributes.FileName.split("|;");
                            var i;
                            var filesJson = [];

                            for (i = 0; i < filesToDownload.length - 1; i++) {
                                filesJson.push({
                                    download: RootUrl + 'File/DownloadFile?fileName=' + encodeURIComponent(filesToDownload[i]),
                                    filename: filesToDownload[i]
                                });
                            }

                            Helper.download_multiple_files(filesJson);
                        }
                        else {
                            Notification.SetNotification(SwResourceObject[responseData.Message], 'warning', 3500);
                        }
                    },
                    error: function (response) {
                        loadingPanel.Hide();
                    }
                });
            },

            DownloadPrimaryFile: function (strFileName, recordId, objectId, recordGuid) {
                loadingPanel.Show();
                $.ajax({
                    cache: false,
                    type: 'GET',
                    url: '/File/DownloadSingleFile',
                    contentType: 'application/json; charset=utf-8',
                    data: {
                        "strFileName": strFileName,
                        "recordId": recordId,
                        "objectId": objectId,
                        "recordGuid": recordGuid
                    },
                    dataType: "json",
                    success: function (response) {
                        loadingPanel.Hide();
                        var res = JSON.parse(response.data);
                        if (res.Success) {
                            //window.location.href = RootUrl + 'File/DownloadFile?fileName=' + encodeURIComponent(res.CustomAttributes.Filename);
                            //var file_path = RootUrl + 'File/DownloadFile?fileName=' + encodeURIComponent(res.CustomAttributes.Filename);
                            //var a = document.createElement('A');
                            //a.href = file_path;
                            //a.download = file_path.substr(file_path.lastIndexOf('/') + 1);
                            //document.body.appendChild(a);
                            //a.click();
                            //document.body.removeChild(a);
                            window.open(RootUrl + 'File/DownloadFile?fileName=' + encodeURIComponent(res.CustomAttributes.Filename), "_blank");
                        } else {
                            Notification.SetNotification(SwResourceObject[res.Message], 'warning', 3500);
                        }
                    },
                    error: function (response) {
                        loadingPanel.Hide();
                    }
                });
            }
        },

        OpenFile: function (idRecord, objectId, recordGuid) {

            if (relatedFilesRecords.GetVisibleSelectedNodeKeys().length == 0) {
                RelatedFiles.FileDownload.DownloadPrimaryFile("", idRecord, objectId, recordGuid);
            }
            else {
                RelatedFiles.FileDownload.DownloadDocument(idRecord, objectId, recordGuid);
            }
        },

        RemoveFile: function (objectId, recordId, recordGuid) {


            var values = Helper.FilterTreeListSelectedNodeKeys("relatedFilesRecords", "FileId");

            var selectedFileIds = [];

            if (typeof (values) === 'undefined' || values == null || values.length == 0) {
                Notification.SetNotification(SwResourceObject.PleaseSelectAFile, 'warning', 3500);
                return;
            }
            //TODO CHECK ALL LISt For Folders
            if (values[0].IsFolder === true) {
                Notification.SetNotification(SwResourceObject.PleaseSelectAFile, 'warning', 3500);
                return;
            }

            if (values[0].IsPrimary === true) {
                Notification.SetNotification(SwResourceObject.PrimaryFilesCannotBeChangedFromHere, 'warning', 3500);
                return;
            }
            values.forEach(function (entry) {
                selectedFileIds.push(entry.FileId);
            });
            $.ajax({
                type: "POST",
                url: '/File/RemoveDocument/',
                data: {
                    "selectedFileIds": selectedFileIds,
                    "objectId": objectId,
                    "recordId": recordId,
                    "recordGuid": recordGuid
                },
                dataType: "json",
                success: function (response) {
                    var responseData = JSON.parse(response.data);
                    if (responseData.Success !== false) {
                        Notification.SetNotification(SwResourceObject.RecordDeleted, 'success', 3500);
                        State.Related.reload = true;
                        relatedFilesRecords.PerformCallback();
                    } else {
                        Notification.SetNotification(SwResourceObject[responseData.Message], 'warning', 3500);
                    }

                }
            });
        },

        ContextMenu: {
            Display: function (s, e, checkedStatus, specialAdministrationAddRelatedFiles, specialAdministrationDeleteRelatedFiles) {
                if (e.objectType === "Node") {
                    var x = ASPxClientUtils.GetEventX(e.htmlEvent);
                    var y = ASPxClientUtils.GetEventY(e.htmlEvent);
                    CtxMenuRelatedFiles.ShowAtPos(x, y);
                    //  relatedSenderName = s.name;
                    //  var node = s.GetNodeHtmlElement(e.objectKey);
                    //  parentNodeKey = node.getAttribute("ParentNodeKey");

                    RelatedFilesContextMenuEnableItems(checkedStatus, specialAdministrationAddRelatedFiles, specialAdministrationDeleteRelatedFiles);

                    if (AppV.GetGlobals().ObjectType === enums.ObjectTypes.SpecialObject
                        && AppV.GetPropertyTabsState().CheckStatus === enums.RecordStatus.CheckedIn) {
                        EnableDisableItemsRelatedFiles('uploadNewerFileBtnCtx', false);
                    }
                }
            },
            DisplayFromButtonContextMenu: function () {
                var s = {};
                var e = {};
                s = window["relatedFilesRecords"];
                e.objectType = "Node";
                e.objectKey = relatedFilesRecords.focusedKey;
                var offset = $("#MainRelatedFilesMenuButton").offset();
                e.htmlEvent = { clientX: offset.left, clientY: offset.top };
                try {
                    RelatedFiles.ContextMenu.Display(s, e, s.cpRecordStatusId, s.cpSpecialAdministrationDeleteRelatedFiles, s.cpSpecialAdministrationUploadNewerRelatedFiles);
                } catch (e) {
                    console.log(e);
                }
            },
            ItemClick: function (s, e) {
                switch (e.item.name) {
                    case "downloadAllBtnCtx":
                        App.Exporting = true;
                        RelatedFiles.FileDownload.DownloadFiles(AppV.GetGlobals().RecordId, AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordGuid);
                        break;
                    case "downloadBtnCtx":
                        App.Exporting = true;
                        RelatedFiles.FileDownload.DownloadDocument(AppV.GetGlobals().RecordId, AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordGuid);
                        break;
                    case "uploadNewerFileBtnCtx":
                        RelatedFiles.AddNewerFileRelatedFiles(AppV.GetGlobals().RecordId, AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordGuid);
                        break;
                    case "refreshBtnCtx":
                        State.Related.reload = true;
                        window.relatedFilesRecords.PerformCallback();
                        break;
                    case "deleteBtnCtx":

                        Helper.ShowConfirmPopUp("SolidWorks",
                            Helper.T("AreYouSureYouWantToDeleteSelectedItemS"),
                            "RelatedFiles.RemoveFile(" + AppV.GetGlobals().ObjectId + "," + AppV.GetGlobals().RecordId + ",'" + AppV.GetGlobals().RecordGuid + "');");

                        break;
                    case "expandAllBtnCtx":
                        window.relatedFilesRecords.ExpandAll();
                        break;
                    case "collapseAllBtnCtx":
                        window.relatedFilesRecords.CollapseAll();
                        break;
                    case "ShareFileCtx":
                        MainGrid.Sharing.checkObjectFileSharing(AppV.GetGlobals().ObjectId,false);
                        break;
                    case "exportToExcel":
                        App.Exporting = true;
                        relatedFilesRecords.ExportTo(ASPxClientTreeListExportFormat.Xlsx);
                        break;
                }
            }
        },

        Menu: {
            AddFileRelFileClick: function (s, e) {
                AddFileRelatedFiles(AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordId);
            },

            DeleteFileRelFileClick: function (s, e) {
                Helper.ShowConfirmPopUp("SolidWorks",
                    Helper.T("AreYouSureYouWantToDeleteSelectedItemS"),
                    "RelatedFiles.RemoveFile(" + AppV.GetGlobals().ObjectId + "," + AppV.GetGlobals().RecordId + ", '" + AppV.GetGlobals().RecordGuid + "')");
            }
        }
    };
})();

;
var Reports = (function () {
    var selectedReportId = -1;
    var DisableEnable = function (_action) {
        ribbonPrpCard.GetItemByName("ReportsListCombo").SetEnabled(!_action);
        ribbonPrpCard.GetItemByName("Run").SetEnabled(!_action);
    };

    return {
        OpenDocumentPreview: function (reportId = -1) {

            if (reportId !== -1) {
                selectedReportId = reportId;
            }

            if (selectedReportId !== -1) {
                View.load("reportPreviewPopup",
                    {
                        objectId: AppV.GetGlobals().ObjectId,
                        idRecord: AppV.GetGlobals().RecordId,
                        reportId: selectedReportId
                    });
            } else {
                Notification.SetNotification(SwResourceObject.PleaseSelectAReport, 'warning', 2500);
            }
        },

        OnReportsListComboValueChanged: function (s, e) {
            selectedReportId = s.GetValue();
        },

        OnReportsListInit: function (s, e) {
            s.SetSelectedIndex(0);
        },

        DisableReportsFunc: function (s, e) {
            if (s.GetItemCount() > 0)
                DisableEnable(false);
            else
                DisableEnable(true);
        }
    };
})();


;

(function () {

    Action = {
        New: 4,
        Edit: 5,
        NewSaveAndClose: 6,
        NewSaveAndCreateNew: 7,
        NewRegister: 8,
        NewTimesheets: 9,
        EditTimesheets: 10,
        EditPlanning: 11,
    }
    var checkIn = {
        Params: {},
        Events: {},
        ResponseData: {}
    };
    var primaryFile = {};

    var checkOut = {
        Params: {},
        Events: {},
        ResponseData: {}
    };

    var newFrom = {
        Params: {},
        Events: {},
        ResponseData: {}
    };

    var isNewFrom = false;
    var isOpenAfterSave = false;
    var _action;
    var _isSendToNextStage = false;

    primaryFile.isCRMEdit = false;
    var _actionToPerform;
    var _whatToCopy;

    primaryFile.data = {};


    var specialObjects = {
        ResponseData: {}
    };

    function createInput(name, value) {
        return $('<input >').attr({
            type: 'hidden',
            name: name,
            value: value
        });
    }
    function isValidForm() {
        return window.ASPxClientEdit.ValidateEditorsInContainerById('FormSubmitGroupFields', '', true) && window.ASPxClientEdit.ValidateEditorsInContainerById('FormSubmitGroupFields', '', true);
    }

    window.objSendToNextStage = {
        isSendToNextStage: false,
        ObjectId: -1,
        RecordGuid: "",
        RecordId: -1
    }

    var ajaxStatus = {
        frm: null,
        FormSubmit: function (actionToPerform, action, validateForm = true, isSendToNextStage = false) {
            _actionToPerform = actionToPerform;
            _action = action;
            _isSendToNextStage = isSendToNextStage;
            (_action === Action.EditPlanning) ? this.frm = $("#FormSubmitGroupFieldsPlanning") : this.frm = $("#FormSubmitGroupFields");
            if (validateForm) {
                var obj = FieldVaildation.checkBeforeSave();
                if (isValidForm() && obj.total === 0) {
                    FieldVaildation.blockEvaluationOfDF = false;
                    this.frm.submit();
                } else {
                    DisableNeccesaryItemsOnAction(window.ActiveObjectsOnAction, false, enums.RibbonNames.Properties);
                    if (obj.total > 0) {
                        window.PropertyCard.Alert.Show(obj.msg);
                        FieldVaildation.blockEvaluationOfDF = false;
                    } else {
                        window.PropertyCard.Alert.Show(SwResourceObject.PleaseCompleteRequiredFields);
                    }

                }
            } else {
                this.frm.submit();
            }

        },

        OnFormSubmit: function (e) {
            e.preventDefault(); // avoid to execute the actual submit of the form.

            if (_actionToPerform === window.ActionToPerform.CheckIn) {
                window.loadingPanel.Show();
                DisableItem(enums.RibbonNames.Properties, "CheckIn");
                var listRecords = [];
                listRecords.push({
                    RecordId: AppV.GetGlobals().RecordId,
                    RecordGuid: AppV.GetGlobals().RecordGuid,
                    PartNumber: document.title
                });
                this.frm.append(createInput('listRecords', JSON.stringify(listRecords)));
                $.ajax({
                    type: "POST",
                    url: this.frm.attr('action').replace("Save", "CheckIn"),
                    data: this.frm.serialize(),
                    success: this.check_in_success_process
                });
            } else if (_actionToPerform === window.ActionToPerform.Save && _action === Action.Edit) {
                DisableItem(enums.RibbonNames.Properties, "Save");
                this.frm.append(createInput('stageId', -1));
                this.frm.append(createInput('webFormId', AppV.GetGlobals().webFormId));
                this.frm.append(createInput('checkCondition', _isSendToNextStage));
                Request.ajax({
                    type: "POST",
                    url: this.frm.attr('action'),
                    data: this.frm.serialize()
                }).then(this.save_edit_success_callback, this.save_edit_error_callback);
                // .then(function () { window.loadingPanel.Hide(); });

            } else if (_actionToPerform === window.ActionToPerform.Save && _action === Action.New) {
                DisableItem(enums.RibbonNames.Properties, "Save");
                this.frm.append(createInput('webFormId', AppV.GetGlobals().webFormId));
                this.frm.append(createInput('groupObjId', window.fieldsGroup.GetValue()));

                this.frm.append(createInput('tmpRecordGuid', Processes.State.tmpRecordGuid));
                this.frm.append(createInput('checkCondition', _isSendToNextStage));

                if (typeof cmbKeepCheckOut !== "undefined")
                    this.frm.append(createInput('keepCheckOut', window.cmbKeepCheckOut.GetValue()));

                Processes.State.isSendToNextStage = false;
                Request.ajax({
                    type: "POST",
                    url: this.frm.attr('action'),
                    data: this.frm.serialize()
                }).then(this.save_new_success_callback, this.save_new_error_callback)
                    .then(this.sendToNextStage);
                // .then(function () { window.loadingPanel.Hide(); });

            }
            else if (_actionToPerform === window.ActionToPerform.Save && _action === Action.NewTimesheets) {
                this.frm.append(createInput('groupObjId', -1));
                this.frm.append(createInput('recordId', -1));
                this.frm.append(createInput('recordGuid', ""));
                this.frm.append(createInput('objectId', AppV.GetGlobals().ObjectId));
                Request.ajax({
                    type: "POST",
                    url: this.frm.attr('action'),
                    data: this.frm.serialize()
                }).then(function (response) {
                    var responseData = JSON.parse(response.data);
                    Timesheets.btnConfirmSaveTimesheets(responseData);
                });
            }
            else if (_actionToPerform === window.ActionToPerform.Save && _action === Action.EditTimesheets) {
                this.frm.append(createInput('groupObjId', -1));
                this.frm.append(createInput('recordId', AppV.GetGlobals().RecordId));
                this.frm.append(createInput('recordGuid', AppV.GetGlobals().RecordGuid));
                this.frm.append(createInput('objectId', AppV.GetGlobals().ObjectId));
                Request.ajax({
                    type: "POST",
                    url: this.frm.attr('action'),
                    data: this.frm.serialize()
                }).then(function (response) {
                    var responseData = JSON.parse(response.data);
                    Timesheets.btnConfirmSaveTimesheets(responseData);
                });
            }
            else if (_actionToPerform === window.ActionToPerform.Save && _action === Action.NewRegister) {
                var groupObjId = window.fieldsGroupRegister.GetValue();
                if (groupObjId !== null) {
                    this.frm.append(createInput('groupObjId', Number(groupObjId)));
                    this.frm.append(createInput('objectId', AppV.GetGlobals().ObjectId));
                    this.frm.append(createInput('keepCheckOut', false));
                    Processes.State.isSendToNextStage = false;
                    Request.ajax({
                        type: "POST",
                        url: this.frm.attr('action'),
                        data: this.frm.serialize()
                    }).then(this.save_NewRegister_success_callback, this.save_new_error_callback)
                        .then(this.sendToNextStage);
                } else {
                    Notification.SetNotification(window.SwResourceObject.SelectFieldGroup, 'warning', 3500);
                }
            }
            else if (_actionToPerform === window.ActionToPerform.Save && _action === Action.EditPlanning) {
                var item = window[Planning.getGanttChartId()].selectedItem;
                if (item == null)
                    return;
                var stageId = item.key;
                this.frm.append(createInput('recordId', AppV.GetGlobals().RecordId));
                this.frm.append(createInput('recordGuid', AppV.GetGlobals().RecordGuid));
                this.frm.append(createInput('objectId', AppV.GetGlobals().ObjectId));
                this.frm.append(createInput('stageId', stageId));
                Request.ajax({
                    type: "POST",
                    url: this.frm.attr('action'),
                    data: this.frm.serialize()
                }).then(function (response) {
                    var responseData = JSON.parse(response.data);
                    window.loadingPanel.Hide();
                    if (responseData.Success) {
                        Planning.TabClickProjectsPlanningCardSection('Properties');
                        Notification.SetNotification(SwResourceObject.SavedSuccessfully, 'sucess', 3500);
                    } else {
                        Notification.SetNotification(window.SwResourceObject.FailedToSaveChanges, 'warning', 3500);
                    }
                });
            }
            else if (_actionToPerform === window.ActionToPerform.CheckOut) {
                DisableItem(enums.RibbonNames.Properties, "CheckOut");
                var listRecords = [];
                listRecords.push({
                    RecordId: AppV.GetGlobals().RecordId,
                    RecordGuid: AppV.GetGlobals().RecordGuid,
                    StageId: Processes.State.StageId
                });

                this.frm.append(createInput('listRecords', JSON.stringify(listRecords)));
                Request.ajax({
                    type: "POST",
                    url: this.frm.attr('action').replace("Save", "CheckOut"),
                    data: this.frm.serialize()
                }).then(this.check_out_success_process, this.check_out_error_process)
                    .then(function () { window.loadingPanel.Hide(); });
                //.then(function () { broadcastV.create("").bc.postMessage({ endPoint: "MainGrid" }); });

            } else if (_actionToPerform === window.ActionToPerform.UndoCheckout) {
                DisableItem(enums.RibbonNames.Properties, "UndoCheckOut");

                Request.ajax({
                    type: "POST",
                    url: this.frm.attr('action').replace("Save", "UndoCheckOut"),
                    data: this.frm.serialize()
                }).then(this.undo_check_out_success_process, this.undo_check_out_error_process)
                    .then(function () { window.loadingPanel.Hide(); });

            } else if (_actionToPerform === window.ActionToPerform.NewFrom) {

                var fromToPost = $('[name="NewFromSubmitForm"]'); //.attr('action')

                var groupObjId = window.fieldsGroup.GetValue();
                if (groupObjId !== null) {
                    //window.newFromButtonOK.SetEnabled(false);
                    window.loadingPanel.Show();
                    isNewFrom = true;
                    isOpenAfterSave = window.cmbOpenAfterSave.GetChecked()
                        ? window.cmbOpenAfterSave.GetChecked()
                        : false;
                    fromToPost.append(createInput('groupObjId', groupObjId));
                    fromToPost.append(createInput('keepCheckOut', window.cmbKeepCheckOut.GetValue()));
                    fromToPost.append(createInput('subObjectGuid', AppV.GetGlobals().SubObjectGuid));
                    var copyPrimaryFile = true;
                    var checkBoxAutonumber = false;
                    if (AppV.GetGlobals().ObjectType !== enums.ObjectTypes.SWPDM) {
                        checkBoxAutonumber = window.checkBoxAutonumber.GetValue();
                        copyPrimaryFile = window.checkBoxCopy.GetChecked();
                    }
                    fromToPost.append(createInput('copyPrimaryFile', copyPrimaryFile));
                    fromToPost.append(createInput('whatToCopy', _whatToCopy));
                    fromToPost.append(createInput('doNotIncrementAutoNumber', checkBoxAutonumber));
                    fromToPost.append(createInput('autoNumber', window.App.State.NewFrom.AutoNumber));

                    //var formToPost = this.frm.attr('action');
                    //if (formToPost.includes('/Save') === true) {
                    //    formToPost = formToPost.replace("/Save", "/NewFromSave");
                    //}

                    Request.ajax({
                        type: "POST",
                        url: fromToPost.attr('action'),
                        data: fromToPost.serialize(),
                        dataType: "json"
                    }).then(this.save_newfrom_success_process, this.save_newfrom_error_process)
                        .then(function () { FieldVaildation.SetnewFrom(false); window.loadingPanel.Hide(); });
                } else {
                    Notification.SetNotification(window.SwResourceObject.SelectFieldGroup, 'warning', 3500);
                }
            }
            else if (_actionToPerform === window.ActionToPerform.SpecialObjects) {
                if (typeof window.fieldsGroup != "undefined" && window.fieldsGroup.GetValue() != null) {
                    this.frm.append(createInput('groupObjId', window.fieldsGroup.GetValue()));
                }

                window.loadingPanel.Show();
                Request.ajax({
                    type: "POST",
                    url: this.frm.attr('action').replace("Save", "SaveSpecialObject"),
                    data: this.frm.serialize(),
                    dataType: "json"
                }).then(this.save_specialobjects_success_process, this.save_specialobjects_error_process)
                    .then(function () { window.loadingPanel.Hide(); });
            }
        },

        reloadPropertyCardSection: function (success, subObjectGuid, partNumber, successMessage, errorMessage) {
            if (success) {
                broadcastV.create("").bc.postMessage({ endPoint: "MainGrid", origin: window.location.href });
                cbpPropertyCardSection.PerformCallback({
                    id: AppV.GetGlobals().ObjectId,
                    id2: AppV.GetGlobals().RecordId,
                    id3: AppV.GetGlobals().RecordGuid,
                    id4: subObjectGuid,
                    id6: AppV.GetGlobals().webFormId
                });
                Notification.SetNotification(partNumber + ": " + successMessage, 'success', 3500);
            } else {
                if (checkIn.ResponseData[0].Message != null)
                    Notification.SetNotification(partNumber + ": " + errorMessage, 'warning', 3500);
                EnableItems(enums.RibbonNames.Properties, "Save");
                EnableItems(enums.RibbonNames.Properties, "CheckIn");
            }
        },

        sendToNextStage: function () {
            if (Processes.State.isSendToNextStage) {
                window.Processes.SendToNextStageButtonClick(
                    Processes.State.ObjectId,
                    Processes.State.RecordGuid,
                    Processes.State.RecordId
                );
            }
        },


        save_NewRegister_success_callback: function (response) {
            var res = JSON.parse(response.data);
            if (!res.Success) {
                Notification.SetNotification(res.Message, 'warning', 3500);
                loadingPanel.Hide();
            }
            else {
                loadingPanel.Hide();
                window.location = RootUrl + "" + "Handler/Message/?message=" + "" + enums.ErrorMessage.RegisterSucess;
            }
        },
        save_new_success_callback: function (response) {
            var res = JSON.parse(response.data);
            primaryFile.data = {};

            // for items used in other processess
            if (res.Message == "ItemsUnAllowed") {
                var message = [];
                res.CustomAttributes.listWithItemsUsedInAnotherProcess.forEach(function (response) {
                    message.push(response.CustomAttributes.PartNumber +
                        ": " +
                        Helper.T(response.Message));
                });
                Notification.SetNotification(message, 'warning', 2500);
                DisableNeccesaryItemsOnAction(window.ActiveObjectsOnAction, false, enums.RibbonNames.Properties);
                window.loadingPanel.Hide();
                return;
            }

            primaryFile.data = res;
            AppV.pushGlobalState("AddNewUrlEncrypted", res.CustomAction.addNewUrlEncrypted || "");
            if (!res.CustomAction.documents) {
                if (res.Success) {
                    if (_isSendToNextStage) {

                        Processes.State.isSendToNextStage = true;
                        Processes.State.ObjectId = res.CustomAttributes.workingObjectContext.ObjectId;
                        Processes.State.RecordGuid = res.CustomAttributes.workingObjectContext.RecordGuid;
                        Processes.State.RecordId = res.CustomAttributes.workingObjectContext.RecordId;
                        Processes.State.urlNavigate = res.CustomAction.urlNavigate;
                    } else {
                        if (typeof cmbSaveAndCreateNew !== "undefined") {
                            window.loadingPanel.Hide();
                            if (window.cmbSaveAndCreateNew.GetValue()) {
                                Helper.open('/PropertyCard/AddNew/' + AppV.GetGlobals().AddNewUrlEncrypted,
                                    '_blank', false);
                                window.close();
                            }
                        }
                        if (Helper.IsNotEmpty(null, res.CustomAction.urlNavigate))
                            Helper.ChangeUrlWithOutReloading(RootUrl + 'PropertyCard/Index/' + res.CustomAction.urlNavigate);

                        cbpPropertyCardSection.PerformCallback({
                            id: res.CustomAttributes.workingObjectContext.ObjectId,
                            id2: res.CustomAttributes.workingObjectContext.RecordId,
                            id3: res.CustomAttributes.workingObjectContext.RecordGuid,
                            id4: res.CustomAttributes.workingObjectContext.SubObjectGuid,
                            id6: AppV.GetGlobals().webFormId
                        });

                        broadcastV.create("").bc.postMessage({ endPoint: "SwConfigurationAddVirtual", origin: window.location.href });
                        broadcastV.create("").bc.postMessage({ endPoint: "ReferencedField", origin: window.location.href });

                        Notification.SetNotification(Helper.T("SavedSuccessfully"), 'success', 3500);

                        // broadcastV.create("").bc.postMessage({ endPoint: "ObjectTypeGridCallback" });
                        // cbPropertiesTab.PerformCallback({
                        //    objectId = 
                        // });
                        //window.location.href = "";
                        //  window.location.href = RootUrl+'PropertyCard/Index/' + res.CustomAction.urlNavigate;
                    }

                } else {
                    window.loadingPanel.Hide();
                    EnableItems(enums.RibbonNames.Properties, "Save");
                    if (_isSendToNextStage) {
                        EnableItems(enums.RibbonNames.Properties, "SendToNextStage");
                    }
                    Notification.SetNotification(res.Message, 'warning', 3500);
                }
            } else {
                window.loadingPanel.Hide();
                if (res.Success)
                    ajaxStatus.uploadfile_success_process(response);
                else {
                    Notification.SetNotification(res.Message, 'warning', 3500);
                    DisableNeccesaryItemsOnAction(window.ActiveObjectsOnAction, false, enums.RibbonNames.Properties);
                }

            }
        },

        save_new_error_callback: function (response) {
            console.log(response);
            //App.PageReload();
        },

        save_edit_success_callback: function (response) {
            var res = JSON.parse(response.data);

            if (res.Message == "ItemsUnAllowed") {
                var message = [];
                res.CustomAttributes.listWithItemsUsedInAnotherProcess.forEach(function (response) {
                    message.push(response.CustomAttributes.PartNumber +
                        ": " +
                        Helper.T(response.Message));
                });
                if (message.length == 0) {
                    Notification.SetNotification(Helper.T("ItemsUnAllowed"), 'warning', 2500);
                } else {
                    Notification.SetNotification(message, 'warning', 2500);
                }
                DisableNeccesaryItemsOnAction(window.ActiveObjectsOnAction, false, enums.RibbonNames.Properties);
                window.loadingPanel.Hide();
                return;
            }

            if (res.Success) {
                if (_isSendToNextStage) {
                    window.Processes.SendToNextStageButtonClick();
                } else {
                    cbpPropertyCardSection.PerformCallback({
                        id: AppV.GetGlobals().ObjectId,
                        id2: AppV.GetGlobals().RecordId,
                        id3: AppV.GetGlobals().RecordGuid,
                        id4: AppV.GetGlobals().SubObjectGuid,
                        id6: AppV.GetGlobals().webFormId
                    });
                    Notification.SetNotification(Helper.T("SavedSuccessfully"), 'success', 3500);
                    // App.PageReload();
                }
            } else {
                window.loadingPanel.Hide();
                EnableItems(enums.RibbonNames.Properties, "Save");
                if (_isSendToNextStage) {
                    EnableItems(enums.RibbonNames.Properties, "SendToNextStage");
                }
                Notification.SetNotification(res.Message, 'warning', 3500);
            }
        },

        save_edit_error_callback: function (error) {
            console.log(error);
            Helper.PageReload();
        },

        check_in_success_process: function (response) {
            checkIn.ResponseData = JSON.parse(response.data);
            var listRecordsForModal = [];

            if (AppV.GetGlobals().ObjectType != enums.ObjectTypes.SWPDM) {
                checkIn.ResponseData.forEach(function (entry) {
                    if (entry.CustomAction.showModal && entry.CustomAttributes.workingObjectContext != null) {
                        listRecordsForModal.push(entry.CustomAttributes.workingObjectContext);
                    }
                });

                AjaxStatus.reloadPropertyCardSection(checkIn.ResponseData[0].Success, response.subObjectGuid,
                    checkIn.ResponseData[0].CustomAttributes.PartNumber, SwResourceObject.CheckedIn, checkIn.ResponseData[0].Message);

                if (listRecordsForModal.length > 0) {
                    checkIn.Events.check_in_modal(listRecordsForModal);
                }
                window.loadingPanel.Hide();
            } else {
                AjaxStatus.reloadPropertyCardSection(checkIn.ResponseData[0].Success, checkIn.ResponseData[0].CustomAttributes.subObjectGuid,
                    checkIn.ResponseData[0].CustomAttributes.PartNumber, SwResourceObject.CheckedIn, checkIn.ResponseData[0].Message);
            }
        },

        check_out_success_process: function (response) {
            checkOut.ResponseData = JSON.parse(response.data);
            if (AppV.GetGlobals().ObjectType != enums.ObjectTypes.SWPDM) {
                if (checkOut.ResponseData[0].Success === false) {
                    DisableNeccesaryItemsOnAction(window.ActiveObjectsOnAction, false, enums.RibbonNames.Properties);
                    Notification.SetNotification(Helper.T(checkOut.ResponseData[0].Message), 'warning', 3500);
                }
                if (checkOut.ResponseData.length > 0) {
                    checkOut.Events.check_out_modal(checkOut.ResponseData);
                }
            }
            else {
                AjaxStatus.reloadPropertyCardSection(checkOut.ResponseData[0].Success, checkOut.ResponseData[0].CustomAttributes.subObjectGuid,
                    checkOut.ResponseData[0].CustomAttributes.PartNumber, SwResourceObject.CheckedOut, checkOut.ResponseData[0].Message);
            }
        },

        check_out_error_process: function (response) {
            Helper.PageReload(); //App.PageReload();
        },

        undo_check_out_success_process: function (response) {
            var responseData = JSON.parse(response.data);
            if (responseData.Success) {
                cbpPropertyCardSection.PerformCallback({
                    id: AppV.GetGlobals().ObjectId,
                    id2: AppV.GetGlobals().RecordId,
                    id3: AppV.GetGlobals().RecordGuid,
                    id4: AppV.GetGlobals().SubObjectGuid,
                    id6: AppV.GetGlobals().webFormId
                });
                pcModalUndoCheckOutSw.Hide();
                // location.reload();
            } else {
                Notification.SetNotification(responseData.Message, 'warning', 2500);
            }
        },
        undo_check_out_error_process: function (response) {
            console.log(error);
            Helper.PageReload();//App.PageReload();
        },

        save_new_success_process: function (response) {
            if (response.CustomAction.showModal) {
                //  window.pcModalDocumentFile.Show();
                View.load("pcModalDocumentFile", {}, true, false);
            }
        },

        save_newfrom_success_process: function (response) {
            var responseData = JSON.parse(response.data);
            var workingObjectContext = responseData.CustomAttributes.workingObjectContext;
            if (responseData.Success) {
                if ((!responseData.CustomAction.CopyPrimaryFile) && (workingObjectContext.ObjectType === 14
                    || workingObjectContext.ObjectType === 11
                    || workingObjectContext.ObjectType === 22)) {
                    primaryFile.data = {};
                    primaryFile.data = responseData;
                    // window.pcModalDocumentFile.Show();
                    View.load("pcModalDocumentFile", {}, true, false);
                }
                else {
                    window.NewFromPopup.Hide();
                    MainGrid.PerformCallback(true);
                    broadcastV.create("").bc.postMessage({ endPoint: "SwConfigurationAddVirtual", origin: window.location.href });
                    broadcastV.create("").bc.postMessage({ endPoint: "ReferencedField", origin: window.location.href });

                    if (isOpenAfterSave) {
                        Helper.open('/PropertyCard/Index/' + responseData.CustomAction.urlNavigate, '_blank');
                    }
                }
            } else {
                if (responseData.CustomAction.showModal) {
                    Notification.SetNotification(responseData.Message, 'warning', 2500);
                }
                else if (responseData.CustomAction.differentCondition) {
                    loadingPanel.Hide();
                    Notification.SetNotification(responseData.Message, 'warning', 2500);
                }
                else {
                    window.NewFromPopup.Hide();
                    Notification.SetNotification(responseData.Message, 'warning', 2500);
                }
            }
        },

        save_newfrom_error_process: function (error) {
            console.log(error);
            // Helper.PageReload();//App.PageReload();
        },

        uploadfile_success_process: function (response) {
            //window.pcModalDocumentFile.Show();
            var res = JSON.parse(response.data);
            View.load("pcModalDocumentFile", {
                recordId: res.CustomAttributes.workingObjectContext.RecordId,
                objectId: res.CustomAttributes.workingObjectContext.ObjectId,
                groupObjectId: AppV.GetPropertyTabsState().GroupObjectId,
                subObjectGuid: res.CustomAttributes.workingObjectContext.SubObjectGuid,
                objectType: res.CustomAttributes.workingObjectContext.ObjectType
            }, true, false);
        },

        save_specialobjects_success_process: function (response) {
            specialObjects.ResponseData = {};
            specialObjects.ResponseData = JSON.parse(response.data);
            if (specialObjects.ResponseData.Success) {
                if (_action === Action.NewSaveAndClose) {
                    window.close();
                }
                else if (_action === Action.New) {
                    window.loadingPanel.Hide();
                    Helper.ChangeUrlWithOutReloading(RootUrl + 'PropertyCard/Index/' + specialObjects.ResponseData.CustomAction.urlNavigate);
                    window.cbpPropertyCardSection.PerformCallback({
                        id: specialObjects.ResponseData.CustomAttributes.workingObjectContext.ObjectId,
                        id2: specialObjects.ResponseData.CustomAttributes.workingObjectContext.RecordId,
                        id3: specialObjects.ResponseData.CustomAttributes.workingObjectContext.RecordGuid,
                        id4: specialObjects.ResponseData.CustomAttributes.workingObjectContext.SubObjectGuid,
                        id6: AppV.GetGlobals().webFormId
                    });
                    Notification.SetNotification(Helper.T("SavedSuccessfully"), 'success', 3500);
                }
                else if (_action === Action.NewSaveAndCreateNew) {
                    window.loadingPanel.Hide();
                    Helper.open('/PropertyCard/AddNew/' + specialObjects.ResponseData.CustomAction.addNewUrlEncrypted,
                        '_blank', false);
                    window.close();
                }
            }
            else {
                Notification.SetNotification(specialObjects.ResponseData.Message, 'warning', 2500);
            }
        },

        save_specialobjects_error_process: function (error) {
            console.log(error);
            Helper.PageReload();//App.PageReload();
        }
    }

    newFrom.WhatToCopy = function (s, e) {
        window.newFromWhatToCopy.GetSelectedNodeValues("CopyName", function getDataFromCallback(values) {
            _whatToCopy = values;
        });

    }


    primaryFile.onPrimaryFileUploadBtnOk = function (e) {
        if (window.uPrimaryFileSelection.GetFileNames().length !== 0) {
            window.uPrimaryFileSelection.Upload();
        } else {
            Notification.SetNotification(window.SwResourceObject.PleaseSelectAFile, 'warning', 3500);
        }
    }
    primaryFile.onPrimaryFileUploadComplete = function (e) {
        if (e.callbackData) {
            primaryFile.btnOkSavePrimaryFileClick(e.callbackData);
        }
        else { Notification.SetNotification(window.SwResourceObject.UploadFileToServer, 'error', 3500); }
    }

    primaryFile.btnOkSavePrimaryFileClick = function (fileName) {
        window.loadingPanel.Show();
        var dataUpload = new FormData();
        dataUpload.append("jsonData", JSON.stringify(primaryFile.data.CustomAttributes.workingObjectContext));
        dataUpload.append('keepCheckOut', window.cmbKeepCheckOut.GetValue() ? window.cmbKeepCheckOut.GetValue() : false);
        dataUpload.append('tabName', window.Helper.TabName());
        dataUpload.append('fileName', fileName);
        $.ajax({
            url: '/Properties/UploadPrimaryFile',
            type: "POST",
            contentType: false, // Not to set any content header  
            processData: false, // Not to process data  
            data: dataUpload,
            success: function (response) {
                var res = JSON.parse(response.data);
                primaryFile.data = {};
                primaryFile.data = res;
                window.loadingPanel.Hide();
                if (res.Success) {
                    if (isNewFrom) {
                        if (isOpenAfterSave) {
                            Helper.open('/PropertyCard/Index/' + res.CustomAction.urlNavigate, '_blank');
                        }

                        window.pcModalDocumentFile.Hide();
                        window.NewFromPopup.Hide();
                        MainGrid.PerformCallback(true);
                        // window.pcModalDocumentFile.PerformCallback();
                        View.load("pcModalDocumentFile", {}, false, true);
                        window.loadingPanel.Hide();
                    } else {
                        window.pcModalDocumentFile.Hide();
                        if (typeof cmbSaveAndCreateNew !== "undefined") {
                            if (window.cmbSaveAndCreateNew.GetValue()) {
                                Helper.open('/PropertyCard/AddNew/' + AppV.GetGlobals().AddNewUrlEncrypted, '_blank');
                                //window.close();
                            }
                        }
                        Helper.ChangeUrlWithOutReloading(RootUrl + 'PropertyCard/Index/' + res.CustomAction.urlNavigate);
                        cbpPropertyCardSection.PerformCallback({
                            id: res.CustomAttributes.workingObjectContext.ObjectId,
                            id2: res.CustomAttributes.workingObjectContext.RecordId,
                            id3: res.CustomAttributes.workingObjectContext.RecordGuid,
                            id4: res.CustomAttributes.workingObjectContext.SubObjectGuid,
                            id6: AppV.GetGlobals().webFormId
                        });

                        Notification.SetNotification(Helper.T("SavedSuccessfully"), 'success', 3500);
                        broadcastV.create("").bc.postMessage({ endPoint: "SwConfigurationAddVirtual", origin: window.location.href });
                        broadcastV.create("").bc.postMessage({ endPoint: "ReferencedField", origin: window.location.href });

                        // broadcastV.create("").bc.postMessage({ endPoint: "ObjectTypeGridCallback" });
                        //  window.location.href = "";
                        //  window.location.href = RootUrl +'PropertyCard/Index/' + res.CustomAction.urlNavigate;
                    }
                } else {
                    window.loadingPanel.Hide();
                    Notification.SetNotification(res.Message, 'warning', 3500);
                }
            },
            error: function (response) {
                var res = JSON.parse(response.data);
                primaryFile.data = {};
                primaryFile.data = res;
                location.reload();
            }
        });
        //} else {
        //    window.BtnFileDocumentOK.SetEnabled(true);
        //    Notification.SetNotification(SwResourceObject.UploadFileToServer, 'warning', 3500);
        //}
    }



    checkIn.Events.ClosePopUp = function (s, e) {
        DisableNeccesaryItemsOnAction(window.ActiveObjectsOnAction, false, enums.RibbonNames.Properties);
        CheckInTreeList.SetVisible(false);
    }

    checkIn.Events.PopUp = function (s, e) {
        //window.loadingPanel.Show();
        window.btnOkCheckIn.SetEnabled(!CheckInTreeList.InCallback());

    }

    checkIn.Events.btnOkCheckInClick = function (s, e) {
        window.pcModalCheckIn.Hide();
        window.loadingPanel.Show();

        window.btnOkCheckIn.SetEnabled(false);
        var isCheckedInChecked = window.CheckCheckIn.GetChecked();
        if (!isCheckedInChecked) {
            checkIn.ResponseData = [];
            DisableNeccesaryItemsOnAction(window.ActiveObjectsOnAction, false, enums.RibbonNames.Properties);
            window.loadingPanel.Hide();
        } else {
            var jsonData = [];
            checkIn.ResponseData.forEach(function (entry) {
                if (entry.CustomAction.showModal) {
                    jsonData.push(entry.CustomAttributes.workingObjectContext);
                }
            });
            checkIn.ResponseData = [];
            $.ajax({
                type: "POST",
                url: "/Properties/CheckInListItems/",
                data: {
                    objectId: (AppV.GetGlobals().ModuleName == enums.Modules.Home) ? MainGrid.GetGridRowData().ObjectId : AppV.GetGlobals().ObjectId,
                    jsonData: JSON.stringify(jsonData)
                },
                // serializes the form's elements.
                success: function (response) {

                    var result = JSON.parse(response.data);
                    result.forEach(function (res) {
                        if (res.Success) {
                            Notification.SetNotification(res.CustomAttributes.PartNumber + ":" + Helper.T("CheckedIn"), 'success', 3500);
                        } else {
                            Notification.SetNotification(res.CustomAttributes.PartNumber + ":" + Helper.T(res.Message), 'warning', 3500);
                        }
                    });

                    if (typeof gridViewDocuments != 'undefined') {
                        MainGrid.PerformCbpCallback(true);
                    } else {

                        cbpPropertyCardSection.PerformCallback({
                            id: AppV.GetGlobals().ObjectId,
                            id2: AppV.GetGlobals().RecordId,
                            id3: AppV.GetGlobals().RecordGuid,
                            id4: AppV.GetGlobals().SubObjectGuid,
                            id6: AppV.GetGlobals().webFormId
                        });
                        broadcastV.create("").bc.postMessage({ endPoint: "MainGrid", origin: window.location.href });
                    }
                    window.loadingPanel.Hide();
                },
                error: function (result) {
                    window.loadingPanel.Hide();
                }
            });
        }

    }

    checkIn.Events.check_in_modal = function (workObjectContext) {
        if (typeof CheckInTreeList == "undefined") {
            View.load("pcModalCheckIn",
                {
                    objectId: (AppV.GetGlobals().ModuleName == enums.Modules.Home) ? MainGrid.GetGridRowData().ObjectId : AppV.GetGlobals().ObjectId,//AppV.GetGlobals().ObjectId,
                    jsonData: JSON.stringify(workObjectContext)
                });
        } else {
            window.CheckInTreeList.PerformCallback({
                objectId: (AppV.GetGlobals().ModuleName == enums.Modules.Home) ? MainGrid.GetGridRowData().ObjectId : AppV.GetGlobals().ObjectId,// AppV.GetGlobals().ObjectId,
                jsonData: JSON.stringify(workObjectContext)
            });
            window.pcModalCheckIn.Show();
        }

    }

    checkIn.Events.CheckInTreeListBeginCallback = function (s, e) {
        window.loadingPanel.Show();
        e.customArgs["objectId"] = AppV.GetGlobals().ObjectId;

    }

    checkOut.Events.CheckOutTreeListBeginCallback = function (s, e) {
        window.loadingPanel.Show();
        e.customArgs["objectId"] = AppV.GetGlobals().ObjectId;
    }

    checkOut.Revision = true;
    checkOut.Events.check_out_modal = function (responseData) {
        checkOut.Revision = true;
        //TODO Callback here
        var jsonData = [];
        responseData.forEach(function (entry) {
            if (entry.CustomAttributes.workingObjectContext != null) {
                jsonData.push(entry.CustomAttributes.workingObjectContext);
            }
        });

        if (responseData[0].CustomAttributes.recordStatus == enums.RecordStatus.Non_Controlled
            || responseData[0].CustomAttributes.recordStatus == enums.RecordStatus.Non_Controlled_editing_Self
            || responseData[0].CustomAttributes.recordStatus == enums.RecordStatus.Non_Controlled_editing
            || responseData[0].CustomAttributes.recordStatus == enums.RecordStatus.Non_Controlled_editing_Self_DifferentPC
            || responseData[0].CustomAttributes.recordStatus == enums.RecordStatus.Non_Controlled_editing_Other) {
            checkOut.Revision = false;
        }

        if (jsonData.length <= 0)
            return;

        if (typeof CheckOutTreeListSw == "undefined") {
            View.load("pcModalCheckOutSw",
                {
                    objectId: AppV.GetGlobals().ObjectId,
                    changeRevision: true,
                    jsonData: JSON.stringify(jsonData)
                });
        } else {
            window.CheckOutTreeListSw.PerformCallback({
                objectId: AppV.GetGlobals().ObjectId,
                changeRevision: true,
                jsonData: JSON.stringify(jsonData)
            });
            window.pcModalCheckOutSw.Show();
        }
    }

    checkOut.Events.ClosePopUp = function (s, e) {
        DisableNeccesaryItemsOnAction(window.ActiveObjectsOnAction, false, enums.RibbonNames.Properties);
        CheckOutTreeListSw.SetVisible(false);
        //checkOut.ResponseData = [];
        checkOut.Params = {};

    }

    checkOut.Events.CloseSwPopUp = function (s, e) {
        window.pcModalCheckOutSw.Hide();
    }

    var _heightDefault = 450; var _widthDefault = 700;
    checkOut.Events.SetDefaultPosition = function (height, width) {
        _heightDefault = height;
        _widthDefault = width;
    };
    checkOut.Events.AfterResizing = function (s, e) {
        if (e.resizeState === 4) {
            checkOut.Events.SetDefaultPosition(450, 700);
        } else {
            if (s.GetWidth() >= _widthDefault && s.GetHeight() >= _heightDefault) {
                if (e.resizeState === 1 || e.resizeState === 2) {
                    CheckOut.Events.SetDefaultPosition(_heightDefault, _widthDefault);
                } else {
                    CheckOut.Events.SetDefaultPosition(s.GetHeight(), s.GetWidth());
                }
            } else {
                CheckOut.Events.SetDefaultPosition(450, 700);
            }
        }
        CheckOutTreeListSw.SetWidth(_widthDefault - 26);
        CheckOutTreeListSw.SetHeight(_heightDefault - 150);
        s.SetWidth(_widthDefault);
        s.SetHeight(_heightDefault);

        s.UpdatePosition();
    };

    checkOut.Events.cmbRevisionCheckChanged = function (s, e) {
        var changeRevision = window.cmbChangeRevison.GetChecked();

        window.CheckOutTreeListSw.PerformCallback({
            objectId: AppV.GetGlobals().ObjectId,
            changeRevision: !changeRevision
        });
    }

    checkOut.Events.PopUp = function (s, e) {
        if (!checkOut.Revision) {
            cmbChangeRevison.SetVisible(false);
        } else {
            cmbChangeRevison.SetVisible(true);
        }
        window.btnOkCheckOutSw.SetEnabled(!CheckOutTreeListSw.InCallback());
    }

    checkOut.Events.btnOkCheckOutClick = function (s, e) {
        window.loadingPanel.Show();
        window.pcModalCheckOutSw.Hide();

        window.btnOkCheckOutSw.SetEnabled(false);
        var changeRevision = window.cmbChangeRevison.GetChecked();
        var isCheckedOutChecked = window.CheckCheckOutSw.GetChecked();
        if (!isCheckedOutChecked) {
            checkOut.ResponseData = {};
            checkOut.Params = {};
            DisableNeccesaryItemsOnAction(window.ActiveObjectsOnAction, false, enums.RibbonNames.Properties);
            window.loadingPanel.Hide();
        } else {
            var jsonData = [];
            checkOut.ResponseData.forEach(function (entry) {
                jsonData.push(entry.CustomAttributes.workingObjectContext);
            });
            checkOut.ResponseData = [];
            $.ajax({
                type: "POST",
                url: "/Properties/CheckOutItems/",
                data: {
                    objectId: AppV.GetGlobals().ObjectId,
                    changeRevision: !changeRevision,
                    jsonData: JSON.stringify(jsonData)
                },
                // serializes the form's elements.
                success: function (response) {
                    var result = JSON.parse(response.data);


                    result.forEach(function (res) {
                        if (res.Success) {
                            Notification.SetNotification(res.CustomAttributes.PartNumber + ":" + Helper.T("CheckedOut"), 'success', 3500);
                        } else {
                            Notification.SetNotification(res.CustomAttributes.PartNumber + ":" + Helper.T(res.Message), 'warning', 3500);
                        }
                    });

                    if (typeof gridViewDocuments != 'undefined') {
                        MainGrid.PerformCbpCallback(true);
                    } else {

                        cbpPropertyCardSection.PerformCallback({
                            id: AppV.GetGlobals().ObjectId,
                            id2: AppV.GetGlobals().RecordId,
                            id3: AppV.GetGlobals().RecordGuid,
                            id4: AppV.GetGlobals().SubObjectGuid,
                            id6: AppV.GetGlobals().webFormId
                        });
                        broadcastV.create("").bc.postMessage({ endPoint: "MainGrid", origin: window.location.href });
                    }

                    window.loadingPanel.Hide();
                },
                error: function (result) {
                    window.loadingPanel.Hide();
                }
            });

        }

    }

    checkOut.Events.btnOkUndoCheckOutClick = function (s, e) {
        if (AppV.GetGlobals().ObjectType != enums.ObjectTypes.SWPDM) {
            //s.SetEnabled(false);
            AjaxStatus.FormSubmit(window.ActionToPerform.UndoCheckout, Action.Edit, false);
        }
        else {
            MainGrid.PDM.PdmIsConnectedAction(enums.ActionToPerform.UndoCheckout);
        }

    }

    newFrom.Events.btnOkNewFromClick = function (s, e) {
        if (AppV.GetGlobals().ObjectType !== enums.ObjectTypes.SWPDM) {
            AjaxStatus.FormSubmit(window.ActionToPerform.NewFrom, Action.New);
        } else {
            MainGrid.PDM.PdmIsConnectedAction(enums.ActionToPerform.NewFrom);
        }
    }

    newFrom.Events.keepNbsChanged = function (s, e) {
        var checkBoxAutonumber = window.checkBoxAutonumber.GetValue();
        var groupObjId = window.fieldsGroup.GetValue();
        if (!checkBoxAutonumber) {
            $('#LblAutoNumber').hide();
            if (window.App.State.NewFrom.objNbs !== "") {
                window[window.App.State.NewFrom.fieldName].SetValue(window.App.State.NewFrom.objNbs);
            }
        } else {
            var autoNumber = MainGrid.GetGridRowData().AutoNumber;
            if (autoNumber === "") {
                $('#LblAutoNumber').show();
            }
            else {
                $('#LblAutoNumber').hide();
                $.ajax({
                    type: "POST",
                    url: "/Properties/DoNotIncrementAutonumber/",
                    data: {
                        recordId: AppV.GetGlobals().RecordId,
                        objectId: AppV.GetGlobals().ObjectId,
                        groupObjId: groupObjId,
                        subObjectGuid: AppV.GetGlobals().subObjectGuid,
                        autoNumber: autoNumber
                    },
                    success: function (response) {
                        var res = JSON.parse(response.data);
                        window.App.State.NewFrom.AutoNumber = autoNumber;
                        window.App.State.NewFrom.fieldName = "_System_objNBS-" + res.CustomAction.ColumnId + "NewFrom";
                        if (window.App.State.NewFrom.objNbs === "") {
                            window.App.State.NewFrom.objNbs = window[window.App.State.NewFrom.fieldName].GetValue();
                        }
                        window[window.App.State.NewFrom.fieldName].SetValue(res.CustomAction.objNbs);
                    }
                });
            }
        }

    }

    window.AjaxStatus = ajaxStatus;
    window.CheckIn = checkIn;
    window.PrimaryFile = primaryFile;
    window.CheckOut = checkOut;
    window.newFrom = newFrom;
})();


var RZPropRibbon = (function () {

    var _InternalFunctions = {
        Documents: {
            EnableDisableEditButtons: function (recordStatus, isCheckedOutBySelf) {
                try {

                    switch (recordStatus) {
                        case enums.RecordStatus.CheckedIn:
                        case enums.RecordStatus.Non_Controlled:
                            EnableItems(enums.RibbonNames.Properties, "CheckOut");
                            DisableItem(enums.RibbonNames.Properties, "CheckIn");
                            break;

                        case enums.RecordStatus.CheckedOut:
                            _InternalFunctions.Documents.DisableRelatedFiles(ribbonPrpCard.cpSpecialAdministrationDeleteRelatedFiles,
                                ribbonPrpCard.cpSpecialAdministrationAddRelatedFiles);
                            break;

                        case enums.RecordStatus.Non_Controlled_editing:
                        case enums.RecordStatus.Non_Controlled_editing_Self:
                        case enums.RecordStatus.checkedOutByself:
                            if (isCheckedOutBySelf) {
                                DisableItem(enums.RibbonNames.Properties, "CheckOut");
                                EnableItems(enums.RibbonNames.Properties, "UndoCheckOut");
                                EnableItems(enums.RibbonNames.Properties, "CheckIn");
                                EnableItems(enums.RibbonNames.Properties, "Edit");
                                EnableItems(enums.RibbonNames.Properties, "Save");
                                //EnableRelatedFiles();
                            }
                            break;
                        case enums.RecordStatus.Deleted:
                            window.close();
                            break;
                        case enums.RecordStatus.Editing:
                            DisableItem(enums.RibbonNames.Properties, "CheckOut");
                            EnableItems(enums.RibbonNames.Properties, "UndoCheckOut");
                            EnableItems(enums.RibbonNames.Properties, "CheckIn");
                            EnableItems(enums.RibbonNames.Properties, "Edit");
                            EnableItems(enums.RibbonNames.Properties, "Save");
                            //EnableRelatedFiles();
                            break;
                        case enums.RecordStatus.History:
                            //   lblHistory.Text = "This record is " & g_StatusINPROCESS & "!"
                            _InternalFunctions.Documents.DisableAllBom();
                            _InternalFunctions.Documents.DisableRelatedFiles(ribbonPrpCard.cpSpecialAdministrationDeleteRelatedFiles,
                                ribbonPrpCard.cpSpecialAdministrationAddRelatedFiles);
                            _InternalFunctions.Documents.DisableAll();
                            break;
                        case enums.RecordStatus.Obsolete:
                            //  lblHistory.Text = "This is an " & g_StatusOBSOLETE & " record!"
                            _InternalFunctions.Documents.DisableAllBom();
                            _InternalFunctions.Documents.DisableRelatedFiles(ribbonPrpCard.cpSpecialAdministrationDeleteRelatedFiles,
                                ribbonPrpCard.cpSpecialAdministrationAddRelatedFiles);
                            _InternalFunctions.Documents.DisableAll();
                            break;
                        case enums.RecordStatus.Released:
                            EnableItems(enums.RibbonNames.Properties, "CheckOut");
                            DisableItem(enums.RibbonNames.Properties, "CheckIn");
                            break;
                    }
                    EnableItems(enums.RibbonNames.Properties, "NewFrom");

                } catch (ex) {
                    console.log(ex);
                }

            },

            DisableAll: function () {
                try {
                    DisableItem(enums.RibbonNames.Properties, "OpenFile");
                    DisableItem(enums.RibbonNames.Properties, "UndoCheckOut");
                    DisableItem(enums.RibbonNames.Properties, "CheckOut");
                    DisableItem(enums.RibbonNames.Properties, "Save");
                    DisableItem(enums.RibbonNames.Properties, "CheckIn");
                    DisableItem(enums.RibbonNames.Properties, "NewFrom");
                } catch (e) {
                    console.log(e);
                }
            },
            EnableBomMenu: function () {
                DisableItem(enums.RibbonNames.Properties, "Edit");
                EnableItems(enums.RibbonNames.Properties, "CancelBom");
                EnableItems(enums.RibbonNames.Properties, "SaveBom");
                EnableItems(enums.RibbonNames.Properties, "AddSimple");
                EnableItems(enums.RibbonNames.Properties, "AddTextLineBom");
                EnableItems(enums.RibbonNames.Properties, "RemoveBom");
                EnableItems(enums.RibbonNames.Properties, "CopyFromBom");
                EnableItems(enums.RibbonNames.Properties, "upBom");
                EnableItems(enums.RibbonNames.Properties, "downBom");
                EnableItems(enums.RibbonNames.Properties, "ItemsNumbersBom");
                EnableItems(enums.RibbonNames.Properties, "Type");
                EnableItems(enums.RibbonNames.Properties, "ChangeBOMSource");
                EnableItems(enums.RibbonNames.Properties, "GenerateNumberingSchemes");

                _InternalFunctions.Documents.DisableAllBomTabs(true);
            },
            DisableAllBom: function () {
                _InternalFunctions.Documents.DisableBomMenu();
                DisableItem(enums.RibbonNames.Properties, "Edit");
            },
            DisableAllBomTabs: function (isEnabled) {
                if (!ribbonPrpCard.GetTabByName("BOM").GetVisible())
                    return;

                if (isEnabled) {
                    if (typeof BomMenuSettings != "undefined") {
                        BomMenuSettings.GetItemByIndexPath(0).items[2].SetEnabled(false);
                        BomMenuSettings.GetItemByIndexPath(0).items[3].items[2].SetEnabled(true);
                        BomMenuSettings.GetItemByIndexPath(0).items[3].items[3].SetEnabled(false);
                        BomMenuSettings.GetItemByIndexPath(0).items[3].items[4].SetEnabled(false);
                    }
                    if (typeof CmbConfiguration != "undefined") {
                        CmbConfiguration.SetEnabled(false);
                    }
                    if (typeof CmbRevision != "undefined") {
                        CmbRevision.SetEnabled(false);
                    }
                    if (typeof CmbConfigurationViewType != "undefined") {
                        CmbConfigurationViewType.SetEnabled(false);
                    }
                    if (typeof showLatestVersionBom != "undefined") {
                        showLatestVersionBom.SetEnabled(false);
                    }
                    if (typeof CmbViewName != "undefined") {
                        CmbViewName.SetEnabled(false);
                    }
                    if (typeof BomConfigurationTabs != "undefined") {
                        BomConfigurationTabs.tabs.forEach(
                            function (item, index) {
                                if (index != BomConfigurationTabs.GetActiveTabIndex()) {
                                    BomConfigurationTabs.tabs[index].SetEnabled(false);
                                }
                            }
                        );
                    }

                }
                else {
                    if (typeof BomMenuSettings != "undefined" && Helper.IsDefined(BomMenuSettings)) {
                        BomMenuSettings.GetItemByIndexPath(0).items[2].SetEnabled(true);
                        BomMenuSettings.GetItemByIndexPath(0).items[3].items[2].SetEnabled(false);
                        BomMenuSettings.GetItemByIndexPath(0).items[3].items[3].SetEnabled(true);
                        BomMenuSettings.GetItemByIndexPath(0).items[3].items[4].SetEnabled(true);
                    }
                    if (typeof CmbConfiguration != "undefined" && Helper.IsDefined(CmbConfiguration)) {
                        CmbConfiguration.SetEnabled(true);
                    }
                    if (typeof CmbRevision != "undefined" && Helper.IsDefined(CmbRevision)) {
                        CmbRevision.SetEnabled(true);
                    }
                    if (typeof CmbConfigurationViewType != "undefined" && Helper.IsDefined(CmbConfigurationViewType)) {
                        CmbConfigurationViewType.SetEnabled(true);
                    }
                    if (typeof showLatestVersionBom != "undefined" && Helper.IsDefined(showLatestVersionBom)) {
                        showLatestVersionBom.SetEnabled(true);
                    }
                    if (typeof CmbViewName != "undefined" && Helper.IsDefined(CmbViewName)) {
                        CmbViewName.SetEnabled(true);
                    }
                    if (typeof BomConfigurationTabs != "undefined" && Helper.IsDefined(BomConfigurationTabs)) {
                        BomConfigurationTabs.tabs.forEach(
                            function (item, index) {
                                BomConfigurationTabs.tabs[index].SetEnabled(true);
                            }
                        );
                    }
                }
                DisableFunctionalityContextMenuBom(isEnabled);
            },

            DisableBomMenu: function () {

                DisableItem(enums.RibbonNames.Properties, "CancelBom");
                DisableItem(enums.RibbonNames.Properties, "SaveBom");
                DisableItem(enums.RibbonNames.Properties, "AddSimple");
                DisableItem(enums.RibbonNames.Properties, "AddTextLineBom");
                DisableItem(enums.RibbonNames.Properties, "RemoveBom");
                DisableItem(enums.RibbonNames.Properties, "CopyFromBom");
                DisableItem(enums.RibbonNames.Properties, "upBom");
                DisableItem(enums.RibbonNames.Properties, "downBom");
                DisableItem(enums.RibbonNames.Properties, "ItemsNumbersBom");
                DisableItem(enums.RibbonNames.Properties, "Type");
                DisableItem(enums.RibbonNames.Properties, "ItemsNumbersBom");
                DisableItem(enums.RibbonNames.Properties, "ChangeBOMSource");
                DisableItem(enums.RibbonNames.Properties, "GenerateNumberingSchemes");

                _InternalFunctions.Documents.DisableAllBomTabs(false);

            },
            DisableRelatedFiles: function (specialAdministrationDelete, specialAdministrationAdd) {
                //DisableItem("OpenFileRelatedFiles");
                //DisableItem("DownloadALLfilesfromserver");
                //DisableItem("Upload ALL NEWER files to server");
                if (!specialAdministrationDelete)
                    DisableItem(enums.RibbonNames.Properties, "Remove");

                if (!specialAdministrationAdd)
                    DisableItem(enums.RibbonNames.Properties, "AddFile");
            },

            HideButtonRibbon: function () {
                var itemsToHide = [
                    "CheckIn", "AssignToOther", "StageInfo", "UndoCheckOut", "_System_objNBS", "Revision", "UserCreated", "IsEditMode", "CreatedDate"
                ];
                itemsToHide.forEach(function (value) {
                    var groupLine = document.getElementsByClassName("dxr-groupSep");
                    if (ribbonPrpCard.GetItemByName(value) !== undefined && ribbonPrpCard.GetItemByName(value) !== null) {
                        var element = document.getElementById(ribbonPrpCard.GetItemByName(value).id);
                        if (element != null) {
                            element.style.display = 'none';
                            if (groupLine.length > ribbonPrpCard.GetItemByName(value).group.index) {
                                groupLine[ribbonPrpCard.GetItemByName(value).group.index + 1].style.display = 'none';
                            }
                        }
                    }
                });
            },
            HideProjectsButtonRibbon: function () {
                var itemsToHideProjects = [
                    "UndoCheckOut", "OpenFile"
                ];
                itemsToHideProjects.forEach(function (value) {
                    var groupLine = document.getElementsByClassName("dxr-groupSep");
                    if (ribbonPrpCard.GetItemByName(value) !== undefined && ribbonPrpCard.GetItemByName(value) !== null) {
                        var element = document.getElementById(ribbonPrpCard.GetItemByName(value).id);
                        if (element != null) {
                            element.style.display = 'none';
                        }
                    }
                });
            },
            SetRightsProjectsPlanning: function (recordStatus, IsCheckedOutBySelf) {
                if (recordStatus === enums.RecordStatus.CheckedIn || !IsCheckedOutBySelf) {
                    DisableItem(enums.RibbonNames.Properties, "SavePlanning");
                    DisableItem("SettingsMenuPlanning", "ImportXmlPlanning");
                    DisableItem("SettingsMenuPlanning", "UpdateProgress");
                    DisableItem(enums.RibbonNames.Properties, "OpenPlanning");
                    DisableItem(enums.RibbonNames.Properties, "DeletePlanning");
                    DisableItem(enums.RibbonNames.Properties, "AddPlanning");
                    DisableItem(enums.RibbonNames.Properties, "InsertPlanning");
                    DisableItem(enums.RibbonNames.Properties, "IndentLeftPlanning");
                    DisableItem(enums.RibbonNames.Properties, "IndentRightPlanning");
                    DisableItem(enums.RibbonNames.Properties, "MoveUpPlanning");
                    DisableItem(enums.RibbonNames.Properties, "MoveDownPlanning");
                    DisableItem(enums.RibbonNames.Properties, "SplitStagePlanning");
                    DisableItem(enums.RibbonNames.Properties, "RemoveStagePlanning");
                    DisableItem(enums.RibbonNames.Properties, "SplitRemainingTimePlanning");
                    DisableItem(enums.RibbonNames.Properties, "MoveProjectPlanning");
                    DisableItem(enums.RibbonNames.Properties, "OptionsPlanning");

                }
                else {
                    EnableItems(enums.RibbonNames.Properties, "SavePlanning");
                    EnableItems("SettingsMenuPlanning", "ImportXmlPlanning");
                    EnableItems("SettingsMenuPlanning", "UpdateProgress");
                    EnableItems(enums.RibbonNames.Properties, "OpenPlanning");
                    EnableItems(enums.RibbonNames.Properties, "DeletePlanning");
                    EnableItems(enums.RibbonNames.Properties, "AddPlanning");
                    EnableItems(enums.RibbonNames.Properties, "InsertPlanning");
                    EnableItems(enums.RibbonNames.Properties, "IndentLeftPlanning");
                    EnableItems(enums.RibbonNames.Properties, "IndentRightPlanning");
                    EnableItems(enums.RibbonNames.Properties, "MoveUpPlanning");
                    EnableItems(enums.RibbonNames.Properties, "MoveDownPlanning");
                    EnableItems(enums.RibbonNames.Properties, "SplitStagePlanning");
                    EnableItems(enums.RibbonNames.Properties, "RemoveStagePlanning");
                    EnableItems(enums.RibbonNames.Properties, "SplitRemainingTimePlanning");
                    EnableItems(enums.RibbonNames.Properties, "MoveProjectPlanning");
                    EnableItems(enums.RibbonNames.Properties, "OptionsPlanning");
                }
            },
            SetModuleNameGlobalState: function (objectType) {
                if (objectType === enums.ObjectTypes.Documents || objectType === enums.ObjectTypes.Inventor
                    || objectType === enums.ObjectTypes.Records || objectType === enums.ObjectTypes.SWPDM || objectType === enums.ObjectTypes.Template) {
                    AppV.pushGlobalState("ModuleName", enums.Modules.Documents);
                }
                if (objectType === enums.ObjectTypes.ProjectsNEW || objectType === enums.ObjectTypes.ProjectsOLD1
                    || objectType === enums.ObjectTypes.ProjectsOLD2 || objectType === enums.ObjectTypes.ProjectsStage || objectType === enums.ObjectTypes.CustomCases) {
                    AppV.pushGlobalState("ModuleName", enums.Modules.Projects);
                }
                if (objectType === enums.ObjectTypes.Processes) {
                    AppV.pushGlobalState("ModuleName", enums.Modules.Processes);
                }
                if (objectType === enums.ObjectTypes.CRM1 || objectType=== enums.ObjectTypes.CRM2
                    || objectType === enums.ObjectTypes.CRM3 || objectType === enums.ObjectTypes.CRM4) {
                    AppV.pushGlobalState("ModuleName", enums.Modules.Contacts);
                } if (objectType === enums.ObjectTypes.SpecialObject) {
                    AppV.pushGlobalState("ModuleName", enums.Modules.SpecialObject);
                }
            }
        },

        Process: {

            AcceptProcess: {

                submit: function () {


                    Request.ajax({
                        type: "POST",
                        url: "/Processes/AcceptProcces/",
                        data: {
                            objectId: AppV.GetGlobals().ObjectId,
                            recordId: AppV.GetGlobals().RecordId,
                            recordGuid: AppV.GetGlobals().RecordGuid
                        }
                    }).then(_InternalFunctions.Process.AcceptProcess.accept_process_success);
                    //  .then(function () { window.loadingPanel.Hide(); });
                },

                accept_process_success: function (response) {
                    FieldVaildation.objectChanged = true;
                    var responseData = JSON.parse(response.data);
                    if (responseData.Success) {
                        Notification.SetNotification(Helper.T(responseData.Message), 'success', 2500);

                        cbpPropertyCardSection.PerformCallback({
                            id: AppV.GetGlobals().ObjectId,
                            id2: AppV.GetGlobals().RecordId,
                            id3: AppV.GetGlobals().RecordGuid,
                            id4: AppV.GetGlobals().SubObjectGuid,
                            id6: AppV.GetGlobals().webFormId
                        });
                        Notification.SetNotification(Helper.T("AcceptedByUser"), 'success', 3500);
                        // location.reload();
                    } else {
                        window.loadingPanel.Hide();
                        Notification.SetNotification(Helper.T(responseData.Message), 'warning', 2500);
                    }

                }

            },



            DisableAllRibbonItems: function (s) {

                if (s.cpObjectType == enums.ObjectTypes.Processes) {

                    window.DisableItem(enums.RibbonNames.Properties, "AcceptProcess");
                    window.DisableItem(enums.RibbonNames.Properties, "CancelProcess");
                    //todo cancelAccept
                }
                if (s.cpObjectType == enums.ObjectTypes.CustomCases) {
                    window.DisableItem(enums.RibbonNames.Properties, "CheckIn");
                    window.DisableItem(enums.RibbonNames.Properties, "CheckOut");
                }
                window.DisableItem(enums.RibbonNames.Properties, "Save");
                window.DisableItem(enums.RibbonNames.Properties, "SendToNextStage");

                window.DisableItem(enums.RibbonNames.Properties, "ReportsListCombo");
                window.DisableItem(enums.RibbonNames.Properties, "Run");
                // window.DisableItem(enums.RibbonNames.Properties, "History");

                //related files
                window.DisableItem(enums.RibbonNames.Properties, "AddFile");
                window.DisableItem(enums.RibbonNames.Properties, "Remove");

            },

            arrangeEditorsCheckOutProcess: function (s) {


                if (s.cpObjectType == enums.ObjectTypes.CustomCases) {

                    window.EnableItems(enums.RibbonNames.Properties, "CheckIn");
                }

                window.EnableItems(enums.RibbonNames.Properties, "Save");
                window.EnableItems(enums.RibbonNames.Properties, "SendToNextStage");
                EnableItems(enums.RibbonNames.Properties, "Edit");
                window.EnableItems(enums.RibbonNames.Properties, "ReportsListCombo");
                window.EnableItems(enums.RibbonNames.Properties, "Run");
                // window.EnableItems(enums.RibbonNames.Properties, "History");

                //related files
                window.EnableItems(enums.RibbonNames.Properties, "AddFile");
                window.EnableItems(enums.RibbonNames.Properties, "Remove");

                //TODO CtrComments1.Enabled = True

                if (s.cpCanBeCanceled) {
                    window.EnableItems(enums.RibbonNames.Properties, "CancelProcess");
                }
                _InternalFunctions.Process.arrangeEditorsForNewProcessItems(true, s);

            },

            arrangeEditorsCheckOutByOthersProcess: function (s) {

                if (s.cpObjectType == enums.ObjectTypes.CustomCases && s.cpHasEditRights) {

                    window.EnableItems(enums.RibbonNames.Properties, "CheckIn");
                }

                window.EnableItems(enums.RibbonNames.Properties, "ReportsListCombo");
                window.EnableItems(enums.RibbonNames.Properties, "Run");
                // window.EnableItems(enums.RibbonNames.Properties, "History");

                //TODO  CtrComments1.Enabled = True

                _InternalFunctions.Process.arrangeEditorsForNewProcessItems(false, s);

            },

            arrangeEditorsReleasedProcess: function (s) {

                window.EnableItems(enums.RibbonNames.Properties, "ReportsListCombo");
                window.EnableItems(enums.RibbonNames.Properties, "Run");
                // window.EnableItems(enums.RibbonNames.Properties, "History");

                //TODO  CtrComments1.Enabled = True

                _InternalFunctions.Process.arrangeEditorsForNewProcessItems(false, s);
            },

            arrangeEditorsCheckInProcess: function (s) {
                if (s.cpObjectType == enums.ObjectTypes.Processes) {
                    App.Global.SetViewerRightsRibbonEnableDisable("AcceptProcess");
                }
                if (s.cpObjectType == enums.ObjectTypes.CustomCases) {

                    window.EnableItems(enums.RibbonNames.Properties, "CheckOut");
                }
                //TODO barbtncancelAccept.Enabled = False

                //RelatedFiles
                window.DisableItem(enums.RibbonNames.Properties, "AddFile");
                window.DisableItem(enums.RibbonNames.Properties, "Remove");

                window.EnableItems(enums.RibbonNames.Properties, "ReportsListCombo");
                window.EnableItems(enums.RibbonNames.Properties, "Run");
                // window.EnableItems(enums.RibbonNames.Properties, "History");

                //TODO  CtrComments1.Enabled = True

                _InternalFunctions.Process.arrangeEditorsForNewProcessItems(false, s);

            },

            arrangeEditorsForNewProcess: function (s) {

                if (s.cpObjectType == enums.ObjectTypes.Processes) {

                    window.DisableItem(enums.RibbonNames.Properties, "AcceptProcess");
                    //todo cancelAccept
                    window.DisableItem(enums.RibbonNames.Properties, "CancelProcess");
                    //TODO   CtrComments1.Enabled = False
                }


                window.EnableItems(enums.RibbonNames.Properties, "Save");
                window.EnableItems(enums.RibbonNames.Properties, "SendToNextStage");
                EnableItems(enums.RibbonNames.Properties, "Edit");

                window.DisableItem(enums.RibbonNames.Properties, "ReportsListCombo");
                window.DisableItem(enums.RibbonNames.Properties, "Run");
                // window.DisableItem(enums.RibbonNames.Properties, "History");

                //Related Files
                window.EnableItems(enums.RibbonNames.Properties, "AddFile");
                window.EnableItems(enums.RibbonNames.Properties, "Remove");

                _InternalFunctions.Process.arrangeEditorsForNewProcessItems(true, s);
            },

            arrangeEditorsForNewProcessItems: function (enable, s) {

                try {

                    if (s.cpObjectType == enums.ObjectTypes.Processes) {

                        var bEnabled = enable && s.cpAllowToAddItems;
                        window.AddProcessReleatedItem.SetEnabled(bEnabled);
                        window.RemoveProcessReleatedItem.SetEnabled(bEnabled);
                        CtxProcessRelatedItemsContextMenu.GetItemByName("Add").SetEnabled(bEnabled);
                        var bEnableMove = enable && s.cpAllowProcessSplit;
                        CtxProcessRelatedItemsContextMenu.GetItemByName("MoveToSubProcess").SetEnabled(bEnableMove);
                        CtxProcessRelatedItemsContextMenu.GetItemByName("RemoveAll").SetEnabled(bEnabled);
                        CtxProcessRelatedItemsContextMenu.GetItemByName("Remove").SetEnabled(bEnabled);
                        //TODO TEST THIS DENIS
                        if (enable && (s.cpDoNotChangeItemsDuringProcess === false || s.cpHasChangeStatusOutput === true)) {
                            window.cmbDoNotChangeRevisonProcessItems.SetVisible(true);
                        } else {
                            window.cmbDoNotChangeRevisonProcessItems.SetVisible(false);
                        }
                    }
                } catch (e) {
                    console.log(e);
                }
                //TODO ADD MORE CONDITIONS
            },

        },

        SpecialObject: {
            EnableDisableSpecialObjects: function (hasEditRights) {
                var checkStatus = AppV.GetPropertyTabsState().CheckStatus;
                if (hasEditRights && (checkStatus === enums.RecordStatus.CheckedOut ||
                    checkStatus === enums.RecordStatus.checkedOutBySelfDifferentPc ||
                    checkStatus === enums.RecordStatus.checkedOutByself)) {
                    EnableItems(enums.RibbonNames.Properties, "NewSO");
                    EnableItems(enums.RibbonNames.Properties, "EditAllSO");
                    EnableItems(enums.RibbonNames.Properties, "PropertiesSO");
                    EnableItems(enums.RibbonNames.Properties, "DeleteSO");
                } else {
                    DisableItem(enums.RibbonNames.Properties, "NewSO");
                    DisableItem(enums.RibbonNames.Properties, "EditAllSO");
                    DisableItem(enums.RibbonNames.Properties, "PropertiesSO");
                    DisableItem(enums.RibbonNames.Properties, "DeleteSO");
                }
            }
        },

        BOM: {
            CommandExecuted: function (name) {
                if (typeof billOfMaterials != 'undefined') {
                    var configId;
                    window.billOfMaterials.RemoveFocusedIndex();
                    var hasFocusedItem = window.billOfMaterials.checkHasFocuseItem();
                    switch (name) {
                        case "Edit":
                            if (typeof BomConfigurationTabs == "undefined") {
                                return;
                            }
                            _InternalFunctions.Documents.EnableBomMenu();
                            window.billOfMaterials.EditBomSetConfiguration(name, AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordId);
                            break;
                        case "CancelBom":
                            _InternalFunctions.Documents.DisableBomMenu();
                            EnableItems(enums.RibbonNames.Properties, "Edit");
                            window.billOfMaterials.EditBomSetConfiguration(name, AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordId);
                            if (window.GridInlineEditor.CheckGridForChanges()) {
                                window.billOfMaterials.performCallBackBom(AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordId);
                            }

                            break;

                        case "SaveBom":
                            _InternalFunctions.Documents.DisableBomMenu();
                            EnableItems(enums.RibbonNames.Properties, "Edit");
                            window.billOfMaterials.EditBomSetConfiguration(name, AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordId);
                            window.GridInlineEditor.UpdateGrid();
                            break;

                        case "PropertiesBom":
                            if (hasFocusedItem) {
                                window.billOfMaterials.GoToParentProperties();
                            } else {
                                Notification.SetNotification(window.SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
                            }
                            break;
                        case "AddSimple":
                            configId = -1;
                            if (typeof BomConfigurationTabs != "undefined") {
                                configId = window.BomConfigurationTabs.GetActiveTab().name;
                            }
                            View.load('AddSimple',
                                {
                                    configId: Number(configId),
                                    objectId: AppV.GetGlobals().ObjectId,
                                    idRecord: AppV.GetGlobals().RecordId
                                });
                            break;
                        case "CopyFromBom":
                            configId = -1;
                            if (typeof BomConfigurationTabs != "undefined") {
                                configId = window.BomConfigurationTabs.GetActiveTab().name;
                            }
                            View.load('CopyFrom',
                                {
                                    configId: Number(configId),
                                    objectId: AppV.GetGlobals().ObjectId,
                                    idRecord: AppV.GetGlobals().RecordId,
                                    anotherRecord: false,
                                    boolSameRecord: true
                                });
                            break;
                        case "AddTextLineBom":
                            window.billOfMaterials.AddTextLineBom(AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordId);
                            break;
                        case "RemoveBom":
                            if (hasFocusedItem) {
                                var func = "BillOfMaterials.removeBom.BtnRemoveBomOK_Click(s,e," + AppV.GetGlobals().ObjectId + "," + AppV.GetGlobals().RecordId + ")";
                                Helper.ShowConfirmPopUp("SolidWorks", SwResourceObject.AreYouSureYouWantToDeleteSelectedItem, func);
                            } else {
                                Notification.SetNotification(window.SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
                            }
                            break;
                        case "Normal":
                        case "Phantom":
                        case "Reference":
                        case "Duplicate":
                            if (hasFocusedItem) {
                                window.billOfMaterials.ItemType(name, AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordId);
                            } else {
                                Notification.SetNotification(window.SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
                            }
                            break;
                        case "ItemsNumbersBom":
                            View.load('ResetItemNumbers',
                                {
                                    objectId: AppV.GetGlobals().ObjectId,
                                    idRecord: AppV.GetGlobals().RecordId
                                });
                            break;
                        case "upBom":
                            if (hasFocusedItem) {
                                window.billOfMaterials.BomMoveRowIndexUpDown(name, AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordId);
                            } else {
                                Notification.SetNotification(window.SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
                            }
                            break;
                        case "downBom":
                            if (hasFocusedItem) {
                                window.billOfMaterials.BomMoveRowIndexUpDown(name, AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordId);
                            } else {
                                Notification.SetNotification(window.SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
                            }
                            break;
                        case "ChangeBOMSource":
                            if (hasFocusedItem) {
                                window.billOfMaterials.changeBomSource(AppV.GetGlobals().RecordId);
                            } else {
                                Notification.SetNotification(window.SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
                            }
                            break;
                        case "GenerateNumberingSchemes":
                            if (hasFocusedItem) {
                                window.BillOfMaterials.numberingScheme.generateNumberingSchemes(AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordId);
                            } else {
                                Notification.SetNotification(window.SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
                            }
                            break;
                    }
                }
            }
        },

        Planning: {
            CommandExecuted: function (name) {
                //if (typeof billOfMaterials != 'undefined') {
                var objectId = AppV.GetGlobals().ObjectId;
                var recordId = AppV.GetGlobals().RecordId;
                switch (name) {
                    case "SavePlanning":
                        window.Planning.SaveAllPlanningItems();
                        break;
                    case "RefreshPlanning":
                        Planning.ProjectsPlanningPerformCallback(true);
                        break;
                    case "OpenPlanning":
                        var message = SwResourceObject.ThisWillReplaceExistingStages + " " + SwResourceObject.AreYouSure;
                        Helper.ShowConfirmPopUp("SolidWorks", message, "Planning.OpenPlanning()");
                        break;
                    case "DeletePlanning":
                        View.load('AddDeletePlanningItem', {});
                        break;
                    case "AddPlanning":
                        window.Planning.AddPlanning();
                        break;
                    case "InsertPlanning":
                        window.Planning.InsertPlanning();
                        break;
                    case "IndentLeftPlanning":
                        window.Planning.IndentLeftPlanning();
                        break;
                    case "IndentRightPlanning":
                        window.Planning.IndentRightPlanning();
                        break;
                    case "MoveUpPlanning":
                        window.Planning.MoveUpPlanning();
                        break;
                    case "MoveDownPlanning":
                        window.Planning.MoveDownPlanning();
                        break;
                    case "SplitStagePlanning":
                        Planning.PlanningSplitStage();
                        break;
                    case "RemoveStagePlanning":
                        var items = window[Planning.getGanttChartId()].getSelectedItems();
                        if (items.length == 0) {
                            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                            return;
                        }
                        Helper.ShowConfirmPopUp("SolidWorks", SwResourceObject.AreYouSure, "Planning.AddRemoveSplitItem('RemoveAll',1)");
                        break;
                    case "SplitRemainingTimePlanning":
                        Planning.SplitRemainingTimePlanning();
                        break;
                    case "MoveProjectPlanning":
                        var items = window[Planning.getGanttChartId()].getSelectedItems();
                        if (items.length == 0) {
                            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                            return;
                        }
                        View.load('AddPlanningMoveProject', {});
                        break;
                    case "OptionsPlanning":
                        View.load('AddPlanningOptions', {
                            objectId: objectId,
                            recordId: recordId
                        });
                        break;
                    case "ScheduleChartPlanning":
                        window.Planning.SetScheduleChartPlanning();
                        break;
                    case "LoadChartPlanning":
                        window.Planning.SetLoadChartPlanning();
                        break;
                    case "PertChartPlanning":
                        View.load('AddPertChart', {});
                        break;
                    case "NetworkDiagramPlanning":
                        View.load('AddNetworkDiagram', {});
                        break;
                }

                //  }
            }
        }
    };

    var Documents = {
        Init: function (s, e) {

            AppV.pushState('PropertyTabs', { CheckStatus: s.cpRecordStatus });

            _InternalFunctions.Documents.SetModuleNameGlobalState(s.cpObjectType);
           
            var groupObjectId = 0;
            if (s.cpGroupObjectId <= 0 && typeof fieldsGroup != "undefined" && fieldsGroup != null)
                groupObjectId = Number(fieldsGroup.GetValue());
            else
                groupObjectId = s.cpGroupObjectId;

            AppV.pushState('PropertyTabs', { GroupObjectId: groupObjectId });
            AppV.pushState('PropertyTabs', { IsCheckedOutBySelf: s.cpIsCheckedOutBySelf });

            PrimaryFile.isCRMEdit = s.cpIsCRMEdit;
            //TODO   lblHistory.Text
            RZPropRibbon.MinimizationStateChanged(s, e);

            //Adding username at ribon
            // View.UpdateHeaderInformation();

            var itemsToExlude = [
                'ribbonPrpCard.GetItemByName("Save")',
                'ribbonPrpCard.GetItemByName("CheckOut")',
                'ribbonPrpCard.GetItemByName("UndoCheckOut")',
                // 'ribbonPrpCard.GetItemByName("Release")',
                //'ribbonPrpCard.GetItemByName("Generate XML File")',
                'ribbonPrpCard.GetItemByName("DownloadALLfilesfromserver")',
                'ribbonPrpCard.GetItemByName("OpenFileRelatedFiles")',
                'ribbonPrpCard.GetItemByName("Edit")',
                'ribbonPrpCard.GetItemByName("CheckIn")'
            ];
            App.ExludeMethodsFromObject(itemsToExlude);

            var isCRM = (s.cpObjectType === enums.ObjectTypes.CRM1 || s.cpObjectType === enums.ObjectTypes.CRM2
                || s.cpObjectType === enums.ObjectTypes.CRM3 || s.cpObjectType === enums.ObjectTypes.CRM4);

            _InternalFunctions.Documents.DisableAllBom();
            _InternalFunctions.Documents.DisableRelatedFiles(s.cpSpecialAdministrationDeleteRelatedFiles,
                s.cpSpecialAdministrationAddRelatedFiles);
            _InternalFunctions.Documents.DisableAll();
            _InternalFunctions.SpecialObject.EnableDisableSpecialObjects(s.cpHasEditRights);
            //  if (!s.cpIsPdmRecord) {
            if (s.cpIsEditMode) {
                if (s.cpIsFormReadWritte) {
                    _InternalFunctions.Documents.EnableDisableEditButtons(s.cpRecordStatus, s.cpIsCheckedOutBySelf);
                }
                if (s.cpHasEditRights) {
                    // TODO enable all butons for edit except check ik check out etc

                }
                if (s.cpObjectType !== 0) {
                    EnableItems(enums.RibbonNames.Properties, "OpenFile");
                }
                //Send To Process Ribbon Documents/Projects
                if ((s.cpObjectType === enums.ObjectTypes.Documents || s.cpObjectType === enums.ObjectTypes.Records || s.cpObjectType === enums.ObjectTypes.SWPDM
                    || s.cpObjectType === enums.ObjectTypes.Template || s.cpObjectType === enums.ObjectTypes.ProjectsNEW
                    || s.cpObjectType === enums.ObjectTypes.ProjectsOLD1 || s.cpObjectType === enums.ObjectTypes.ProjectsOLD2
                    || s.cpObjectType === enums.ObjectTypes.CRM1 || s.cpObjectType === enums.ObjectTypes.CRM2
                    || s.cpObjectType === enums.ObjectTypes.CRM3 || s.cpObjectType === enums.ObjectTypes.CRM4)) {
                    cbpSendToProcessCombo.PerformCallback({
                        actionToPerform: ActionToPerform.Edit,
                        isPopUp: false,
                        objectId: s.cpObjectId
                    });
                }
            } else {
                _InternalFunctions.Documents.DisableAll();
                _InternalFunctions.Documents.DisableAllBom();
                EnableItems(enums.RibbonNames.Properties, "Save");
            }
            //    }

            //TODO just for project to remove later
            if (s.cpObjectType === enums.ObjectTypes.UsersAndGroupsHR && !s.cpIsExternalUser) {
                //BOM
                _InternalFunctions.Documents.DisableAllBom();
                _InternalFunctions.Documents.DisableRelatedFiles(ribbonPrpCard.cpSpecialAdministrationDeleteRelatedFiles,
                    ribbonPrpCard.cpSpecialAdministrationAddRelatedFiles);
                _InternalFunctions.Documents.DisableAll();
                //SO
                DisableItem(enums.RibbonNames.Properties, "NewSO");
                DisableItem(enums.RibbonNames.Properties, "EditAllSO");
                DisableItem(enums.RibbonNames.Properties, "PropertiesSO");
                DisableItem(enums.RibbonNames.Properties, "DeleteSO");
            }
            if (s.cpIsExternalUser && s.cpSingleRecordAllowed) {
                _InternalFunctions.Documents.HideButtonRibbon();
            }

            if ((s.cpObjectType === enums.ObjectTypes.ProjectsNEW
                || s.cpObjectType === enums.ObjectTypes.ProjectsOLD1
                || s.cpObjectType === enums.ObjectTypes.ProjectsOLD2)) {
                _InternalFunctions.Documents.HideProjectsButtonRibbon();
                _InternalFunctions.Documents.SetRightsProjectsPlanning(s.cpRecordStatus, s.cpIsCheckedOutBySelf);
            }

            if (isCRM && !s.cpIsCRMEdit) {
                EnableItems(enums.RibbonNames.Properties, "EditProperties");
                EnableItems(enums.RibbonNames.Properties, "NewFrom");
                DisableItem(enums.RibbonNames.Properties, "Save");
                DisableItem(enums.RibbonNames.Properties, "NewSO");
                DisableItem(enums.RibbonNames.Properties, "PropertiesSO");
                DisableItem(enums.RibbonNames.Properties, "DeleteSO");
                DisableItem(enums.RibbonNames.Properties, "Edit");
            } if (isCRM && s.cpIsCRMEdit) {
                DisableItem(enums.RibbonNames.Properties, "EditProperties");
                EnableItems(enums.RibbonNames.Properties, "NewFrom");
                EnableItems(enums.RibbonNames.Properties, "Save");
                EnableItems(enums.RibbonNames.Properties, "NewSO");
                EnableItems(enums.RibbonNames.Properties, "PropertiesSO");
                EnableItems(enums.RibbonNames.Properties, "DeleteSO");
                EnableItems(enums.RibbonNames.Properties, "Edit");
            }
            if (isCRM && !s.cpIsEditMode) {
                EnableItems(enums.RibbonNames.Properties, "Save");
                DisableItem(enums.RibbonNames.Properties, "EditProperties");
                DisableItem(enums.RibbonNames.Properties, "NewFrom");
                DisableItem(enums.RibbonNames.Properties, "NewSO");
                DisableItem(enums.RibbonNames.Properties, "PropertiesSO");
                DisableItem(enums.RibbonNames.Properties, "DeleteSO");
                DisableItem(enums.RibbonNames.Properties, "Edit");
            }

        },
        CommandExecuted: function (s, e) {
            var items = ["Save", "CheckIn", "CheckOut", "UndoCheckOut", "OpenFile"];
            window.ActiveObjectsOnAction = [];
            items.forEach(function (value) {
                if (ribbonPrpCard.GetItemByName(value) !== null && ribbonPrpCard.GetItemByName(value).enabled) {
                    window.ActiveObjectsOnAction.push(value.toString());
                }
            });

            switch (e.item.name) {
                case "Save":
                    if (typeof window.fieldsGroup != "undefined" && window.fieldsGroup.GetValue() == null) {
                        Notification.SetNotification(Helper.T("PleaseSelectType"), 'warning', 3500);
                        return;
                    }
                    if (AppV.GetGlobals().ObjectType != enums.ObjectTypes.SWPDM) {
                        PropertyCardSection.SetActiveTab(PropertyCardSection.tabs.filter(function (x) { return x.name == "Properties" })[0]);
                        DisableItem(enums.RibbonNames.Properties, "SaveBom");
                        DisableNeccesaryItemsOnAction(ActiveObjectsOnAction, true, enums.RibbonNames.Properties);
                        FieldVaildation.blockEvaluationOfDF = true;
                        if (AppV.GetGlobals().RecordId === 0 || AppV.GetGlobals().RecordId == undefined) {
                            AjaxStatus.FormSubmit(window.ActionToPerform.Save, Action.New);
                        } else {
                            AjaxStatus.FormSubmit(window.ActionToPerform.Save, Action.Edit);
                        }
                    }
                    else {
                        MainGrid.PDM.PdmIsConnectedAction(enums.ActionToPerform.Save);
                    }
                    break;

                case "OpenFile":
                    if (AppV.GetGlobals().ObjectType != enums.ObjectTypes.SWPDM) {
                        RelatedFiles.FileDownload.DownloadPrimaryFile("", AppV.GetGlobals().RecordId, AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordGuid);
                    }
                    else {
                        MainGrid.PDM.PdmIsConnectedAction(enums.ActionToPerform.PropertyCardDownload);
                    }
                    break;
                case "NewFrom":
                    MainGrid.Record.NewFrom();
                    break;
                case "CheckIn":
                    if (AppV.GetGlobals().ObjectType != enums.ObjectTypes.SWPDM) {
                        PropertyCardSection.SetActiveTab(PropertyCardSection.tabs.filter(function (x) { return x.name == "Properties" })[0]);
                        DisableNeccesaryItemsOnAction(ActiveObjectsOnAction, true, enums.RibbonNames.Properties);
                        AjaxStatus.FormSubmit(window.ActionToPerform.CheckIn, Action.Edit);
                    }
                    else {
                        MainGrid.PDM.PdmIsConnectedAction(enums.ActionToPerform.PropertyCardCheckIn);
                    }
                    break;

                case "CheckOut":
                    if (AppV.GetGlobals().ObjectType != enums.ObjectTypes.SWPDM) {
                        //ribbonPrpCard.GetItemByName("CheckOut").enabled;
                        PropertyCardSection.SetActiveTab(PropertyCardSection.tabs.filter(function (x) { return x.name == "Properties" })[0]);
                        DisableNeccesaryItemsOnAction(ActiveObjectsOnAction, true, enums.RibbonNames.Properties);
                        AjaxStatus.FormSubmit(window.ActionToPerform.CheckOut, Action.Edit, false);
                    }
                    else {
                        MainGrid.PDM.PdmIsConnectedAction(enums.ActionToPerform.PropertyCardCheckOut);
                    }
                    break;

                case "UndoCheckOut":
                    PropertyCardSection.SetActiveTab(PropertyCardSection.tabs.filter(function (x) { return x.name == "Properties" })[0]);
                    DisableNeccesaryItemsOnAction(ActiveObjectsOnAction, true, enums.RibbonNames.Properties);
                    // window.pcModalUndoCheckOutSw.Show();
                    View.load("pcModalUndoCheckOutSw", {}, true, false);
                    break;


                case "AddFile":
                    var chckStatus = AppV.GetPropertyTabsState().CheckStatus;

                    if (chckStatus === enums.RecordStatus.CheckedOut) {
                        Notification.SetNotification(window.SwResourceObject.ItemNeedsToBeCheckedInOrCheckedOutByYouToPerformThisAction, 'warning', 2500);
                        break;
                    }

                    AddFileRelatedFiles(AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordId);
                    break;

                case "Remove":
                    var checkStatus = AppV.GetPropertyTabsState().CheckStatus;

                    if (checkStatus === enums.RecordStatus.CheckedOut) {
                        Notification.SetNotification(window.SwResourceObject.ItemNeedsToBeCheckedInOrCheckedOutByYouToPerformThisAction, 'warning', 2500);
                        break;
                    }

                    Helper.ShowConfirmPopUp("SolidWorks",
                        Helper.T("AreYouSureYouWantToDeleteSelectedItemS"),
                        "RelatedFiles.RemoveFile(" + AppV.GetGlobals().ObjectId + ", " +
                        "" + AppV.GetGlobals().RecordId + ", '" + AppV.GetGlobals().RecordGuid + "')");
                    break;

                case "AddReference":
                    View.load('AddReferenceContentPopUp',
                        {
                            objectId: AppV.GetGlobals().ObjectId,
                            recordId: AppV.GetGlobals().RecordId
                        });
                    break;
                case "OpenFileRelatedFiles":
                    RelatedFiles.OpenFile(AppV.GetGlobals().RecordId, AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordGuid);
                    break;

                case "Run":
                    Reports.OpenDocumentPreview();
                    break;

                case "DownloadALLfilesfromserver":
                    RelatedFiles.FileDownload.DownloadFiles(AppV.GetGlobals().RecordId, AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordGuid);
                    break;

                case "RefreshSO":
                    window.SpecialObjects.GetSpecialObjectGrid(s, e);
                    break;
                case "NewSO":
                    window.SpecialObjects.OpenNewSpecialObject(s, e);
                    break;
                case "EditAllSO":
                    window.SpecialObjects.EditAllSpecialObject(s, e);
                    break;
                case "PropertiesSO":
                    window.SpecialObjects.GoToParentProperties(s, e);
                    break;
                case "DeleteSO":
                    var hasFocusedItemSo = window.SpecialObjects.checkHasFocuseItem(s, e);
                    if (hasFocusedItemSo) {
                        Helper.ShowConfirmPopUp("SolidWorks", Helper.T("AreYouSureYouWantToDeleteSelectedItemS"),
                            "SpecialObjects.DeleteRecordsSpecialObject(" + AppV.GetGlobals().RecordId + ", " + "" + AppV.GetGlobals().ObjectId + ")");
                    } else {
                        Notification.SetNotification(window.SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
                    }
                    break;
                case "EditProperties": //CRM
                    PrimaryFile.isCRMEdit = true;
                    cbpPropertyCardSection.PerformCallback({
                        id: AppV.GetGlobals().ObjectId,
                        id2: AppV.GetGlobals().RecordId,
                        id3: AppV.GetGlobals().RecordGuid,
                        id4: AppV.GetGlobals().SubObjectGuid,
                        id6: AppV.GetGlobals().webFormId,
                        isCRMEdit: true
                    });
                    break;
            }

            //BOM Items
            _InternalFunctions.BOM.CommandExecuted(e.item.name);

            //Planning
            _InternalFunctions.Planning.CommandExecuted(e.item.name);

        },
        FileTabClicked: function () {
            label.SetText(SwResourceObject.File);
        },
        ActiveTabChanged: function (s, e) {
            if (s.activeTab.name === "Reports") {
                if (!s.cpIsEditMode) {
                    s.SetActiveTabIndex(0);
                    Notification.SetNotification(SwResourceObject.YouNeedToSaveFirst, 'warning', 1500);
                }
            }
        }
    };

    var Process = {
        Init: function (s, e) {

            AppV.pushState('PropertyTabs', { CheckStatus: s.cpRecordStatus });

            _InternalFunctions.Documents.SetModuleNameGlobalState(s.cpObjectType);

            var groupObjectId = 0;
            if (s.cpGroupObjectId <= 0 && typeof fieldsGroup != "undefined" && fieldsGroup != null)
                groupObjectId = Number(fieldsGroup.GetValue());
            else
                groupObjectId = s.cpGroupObjectId;
            AppV.pushState('PropertyTabs', { GroupObjectId: groupObjectId });
            RZPropRibbon.MinimizationStateChanged(s, e);
            //Adding Username at Ribbon 
            // View.UpdateHeaderInformation();
            _InternalFunctions.Process.DisableAllRibbonItems(s);
            _InternalFunctions.Documents.DisableAllBom();
            _InternalFunctions.SpecialObject.EnableDisableSpecialObjects(s.cpHasEditRights);
            if (s.cpIsEditMode) {
                _InternalFunctions.Documents.DisableAllBom();

                if (s.cpCanSetActors) {
                    s.cpObjectType == enums.ObjectTypes.Processes ? $(".AssignToOtherCss").show() : window.EnableItems(enums.RibbonNames.Properties, "AssignToOther");
                } else {
                    s.cpObjectType == enums.ObjectTypes.Processes ? $(".AssignToOtherCss").hide() : window.DisableItem(enums.RibbonNames.Properties, "AssignToOther");
                }

                switch (s.cpRecordStatus) {
                    case enums.RecordStatus.checkedOutByself:
                        _InternalFunctions.Process.arrangeEditorsCheckOutProcess(s);
                        break;
                    case enums.RecordStatus.CheckedOut:
                        _InternalFunctions.Process.arrangeEditorsCheckOutByOthersProcess(s);
                        break;
                    case enums.RecordStatus.CheckedIn:
                        if (s.StageType === "DevidedEvent") {
                            _InternalFunctions.Process.arrangeEditorsCheckOutByOthersProcess(s);
                        } else {
                            _InternalFunctions.Process.arrangeEditorsCheckInProcess(s);
                        }
                        if (s.cpObjectType == enums.ObjectTypes.CustomCases) {
                            window.EnableItems(enums.RibbonNames.Properties, "SendToNextStage");
                            EnableItems(enums.RibbonNames.Properties, "EditSO");
                        }

                        break;
                    case enums.RecordStatus.Released:
                        s.cpObjectType == enums.ObjectTypes.Processes ? $(".AssignToOtherCss").hide() : window.DisableItem(enums.RibbonNames.Properties, "AssignToOther");
                        _InternalFunctions.Process.arrangeEditorsReleasedProcess(s);
                        break;
                    case enums.RecordStatus.Deleted:
                    case enums.RecordStatus.History:
                    case enums.RecordStatus.Obsolete:
                    case enums.RecordStatus.In_Proccess:
                        s.cpObjectType == enums.ObjectTypes.Processes ? $(".AssignToOtherCss").hide() : window.DisableItem(enums.RibbonNames.Properties, "AssignToOther");
                        _InternalFunctions.Process.arrangeEditorsCheckOutByOthersProcess(s);
                        break;
                    case window.App.RecordSatatus.SW_Awaiting_Release:
                        s.cpObjectType == enums.ObjectTypes.Processes ? $(".AssignToOtherCss").hide() : window.DisableItem(enums.RibbonNames.Properties, "AssignToOther");
                        break;
                }

            } else {
                s.cpObjectType == enums.ObjectTypes.Processes ? $(".AssignToOtherCss").hide() : window.DisableItem(enums.RibbonNames.Properties, "AssignToOther");
                _InternalFunctions.Process.arrangeEditorsForNewProcess(s);

            }
            if (s.cpIsExternalUser && s.cpSingleRecordAllowed) {
                _InternalFunctions.Documents.HideButtonRibbon();
            }
            //Send To Process Ribbon Casses/Projects
            if (s.cpIsEditMode && s.cpObjectType === enums.ObjectTypes.CustomCases) {
                cbpSendToProcessCombo.PerformCallback({
                    actionToPerform: ActionToPerform.Edit,
                    isPopUp: false,
                    objectId: s.cpObjectId
                });
            }
            App.Global.SetViewerRightsRibbonDisable("AssignToOther");
            App.Global.SetViewerRightsRibbonDisable("AddFile");
            App.Global.SetViewerRightsRibbonDisable("Remove");
            //TODO DISABLE TABS
        },
        CommandExecuted: function (s, e) {
            if (s.cpObjectType == enums.ObjectTypes.Processes) {
                var items = [
                    "Save", "AcceptProcess", "AssignToOther", "CancelProcess", "SendToNextStage", "AddFile", "Remove"
                ];
            } else {
                var items = [
                    "Save", "CheckIn", "AssignToOther", "CheckOut", "SendToNextStage", "AddFile", "Remove"
                ];
            }
            window.ActiveObjectsOnAction = [];
            items.forEach(function (value) {
                if (ribbonPrpCard.GetItemByName(value).enabled) {
                    window.ActiveObjectsOnAction.push(value.toString());
                }
            });

            switch (e.item.name) {
                case "ProcessInformation":
                    var pane = window.splFullScreenModePropertyCard.GetPaneByName("pnlProcessInfo");
                    if (pane.IsCollapsed()) {
                        //window.UserStageInfoGridCallback.PerformCallback(
                        //    {
                        //        objectId: AppV.GetGlobals().ObjectId,
                        //        recordId: AppV.GetGlobals().RecordId
                        //    });
                        //window.cbpStagesInformation.PerformCallback(
                        //    {
                        //        objectId: AppV.GetGlobals().ObjectId,
                        //        recordId: AppV.GetGlobals().RecordId
                        //    });
                        pane.Expand();
                        if (PrecessInformationSections.GetActiveTab().index == 1) {
                            //Request.loadBundle("MindFusion");
                            window.ProcessesHistoryGrid.PerformCallback({
                                objectId: AppV.GetGlobals().ObjectId,
                                recordGuid: AppV.GetGlobals().RecordGuid
                            });
                        }
                        StageNodesTabClick();
                    } else {
                        pane.Collapse(pane);
                    }
                    break;

                case "Save":
                    save_ProcessRelatedItemGrid(e.item.name);
                    //if (AppV.GetGlobals().RecordId === 0 || AppV.GetGlobals().RecordId === undefined) {
                    //    window.AjaxStatus.FormSubmit(ActionToPerform.Save, Action.New, false);
                    //} else {
                    //    save_ProcessRelatedItemGrid(e.item.name);
                    //}
                    break;
                case "AcceptProcess":
                    window.DisableItem(enums.RibbonNames.Properties, "AcceptProcess");
                    _InternalFunctions.Process.AcceptProcess.submit();
                    break;

                case "AssignToOther":
                    window.Processes.AssignToOtherButtonClick(s, e);
                    break;

                case "SendToNextStage":
                    if (typeof window.fieldsGroup != "undefined" && window.fieldsGroup.GetValue() == null) {
                        Notification.SetNotification(Helper.T("PleaseSelectType"), 'warning', 3500);
                        return;
                    }
                    window.DisableItem(enums.RibbonNames.Properties, "SendToNextStage");
                    if (Processes.State.StageId !== -1) {
                        save_ProcessRelatedItemGrid(e.item.name);
                    } else {
                        Notification.SetNotification(Helper.T("YouCannotMoveItToNextStage"), 'warning', 2500);
                    }
                    break;

                case "Run":
                    Reports.OpenDocumentPreview();
                    break;

                case "AddFile":
                    AddFileRelatedFiles(AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordId);
                    break;

                case "Remove":
                    Helper.ShowConfirmPopUp("SolidWorks",
                        Helper.T("AreYouSureYouWantToDeleteSelectedItemS"),
                        "RelatedFiles.RemoveFile(" + AppV.GetGlobals().ObjectId + "," + AppV.GetGlobals().RecordId + ", '" + AppV.GetGlobals().RecordGuid + "')");
                    break;

                case "CancelProcess":
                    Helper.ShowConfirmPopUp("SolidWorks",
                        Helper.T("AreYouSureYouWantToCancelThisProcess") + " " + Helper.T("ThisActionCannotBeUndone"),
                        "Processes.CancelProcessClick()");
                    break;
                case "CheckIn":
                    DisableNeccesaryItemsOnAction(ActiveObjectsOnAction, true, enums.RibbonNames.Properties);
                    AjaxStatus.FormSubmit(window.ActionToPerform.CheckIn, Action.Edit);
                    break;
                case "CheckOut":
                    //ribbonPrpCard.GetItemByName("CheckOut").enabled;
                    DisableNeccesaryItemsOnAction(ActiveObjectsOnAction, true, enums.RibbonNames.Properties);
                    AjaxStatus.FormSubmit(window.ActionToPerform.CheckOut, Action.Edit, false);
                    break;
                case "RefreshSO":
                    window.SpecialObjects.GetSpecialObjectGrid(s, e);
                    break;
                case "NewSO":
                    window.SpecialObjects.OpenNewSpecialObject(s, e);
                    break;
                case "EditAllSO":
                    window.SpecialObjects.EditAllSpecialObject(s, e);
                    break;
                case "PropertiesSO":
                    window.SpecialObjects.GoToParentProperties(s, e);
                    break;
                case "DeleteSO":
                    var hasFocusedItemSo = window.SpecialObjects.checkHasFocuseItem(s, e);
                    if (hasFocusedItemSo) {
                        Helper.ShowConfirmPopUp("SolidWorks", Helper.T("AreYouSureYouWantToDeleteSelectedItemS"),
                            "SpecialObjects.DeleteRecordsSpecialObject(" + AppV.GetGlobals().RecordId + ", " + "" + AppV.GetGlobals().ObjectId + ")");
                    } else {
                        Notification.SetNotification(window.SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
                    }
                    break;
            }
            //BOM Items
            _InternalFunctions.BOM.CommandExecuted(e.item.name);

        },
        SaveProcessData: function () {
            if (typeof window.fieldsGroup != "undefined" && window.fieldsGroup.GetValue() == null) {
                Notification.SetNotification(Helper.T("PleaseSelectType"), 'warning', 3500);
                return;
            }
            window.DisableItem(enums.RibbonNames.Properties, "Save");
            if (AppV.GetGlobals().RecordId === 0 || AppV.GetGlobals().RecordId === undefined) {
                window.AjaxStatus.FormSubmit(ActionToPerform.Save, Action.New, false);
            } else {
                window.AjaxStatus.FormSubmit(ActionToPerform.Save, Action.Edit, false);
            }
        },
        SendToNextStageOkClicked: function (idRecord) {
            window.EnableItems(enums.RibbonNames.Properties, "Save");
            window.EnableItems(enums.RibbonNames.Properties, "AddFile");
            window.EnableItems(enums.RibbonNames.Properties, "Remove");
            if (idRecord === 0 || idRecord === undefined) {
                window.AjaxStatus.FormSubmit(ActionToPerform.Save, Action.New, true, true);
            } else {
                window.AjaxStatus.FormSubmit(ActionToPerform.Save, Action.Edit, true, true);
            }
        },
    };

    var SpecialObjects = {
        Init: function (s, e) {

            AppV.pushState('PropertyTabs', { CheckStatus: s.cpRecordStatus });

            _InternalFunctions.Documents.SetModuleNameGlobalState(s.cpObjectType);

            var groupObjectId = 0;
            if (s.cpGroupObjectId <= 0 && typeof fieldsGroup != "undefined" && fieldsGroup != null)
                groupObjectId = Number(fieldsGroup.GetValue());
            else
                groupObjectId = s.cpGroupObjectId;

            AppV.pushState('PropertyTabs', { GroupObjectId: groupObjectId });
            RZPropRibbon.MinimizationStateChanged(s, e);
            // View.UpdateHeaderInformation();
            AppV.pushState('PropertyTabs', { CheckStatus: s.cpParentRecordStatus });

            _InternalFunctions.Documents.DisableAllBom();
            _InternalFunctions.Documents.DisableRelatedFiles
                (s.cpSpecialAdministrationDeleteRelatedFiles,
                    s.cpSpecialAdministrationAddRelatedFiles);

            if (!s.cpSpecialAdministrationAddRelatedFiles)
                DisableItem(enums.RibbonNames.Properties, "UploadLatest");

            _InternalFunctions.Documents.DisableAll();

            if (!s.cpIsEditMode) {
                DisableItem(enums.RibbonNames.Properties, "EditSO");
                EnableItems(enums.RibbonNames.Properties, "Save");
            }
            else if (s.cpRecordStatus === enums.RecordStatus.Locked || s.cpParentRecordStatus === enums.RecordStatus.CheckedIn
                || s.cpIsSoMulti) {
                DisableItem(enums.RibbonNames.Properties, "EditSO");
                DisableItem(enums.RibbonNames.Properties, "SaveAndClose");
                DisableItem(enums.RibbonNames.Properties, "Save");
                DisableItem(enums.RibbonNames.Properties, "SaveAndCreateNew");
            }
            else {
                if (s.cpParentRecordStatus !== enums.RecordStatus.CheckedOut ||
                    s.cpParentRecordStatus !== enums.RecordStatus.checkedOutBySelfDifferentPc ||
                    s.cpParentRecordStatus !== enums.RecordStatus.checkedOutByself) {
                    EnableItems(enums.RibbonNames.Properties, "EditSO");
                    DisableItem(enums.RibbonNames.Properties, "SaveAndClose");
                    DisableItem(enums.RibbonNames.Properties, "Save");
                    DisableItem(enums.RibbonNames.Properties, "SaveAndCreateNew");

                }
            }

        },
        CommandExecuted: function (s, e) {
            var checkStatus = AppV.GetPropertyTabsState().CheckStatus;
            switch (e.item.name) {
                case "SaveAndClose":
                    if (typeof window.fieldsGroup != "undefined" && window.fieldsGroup.GetValue() == null) {
                        Notification.SetNotification(Helper.T("PleaseSelectType"), 'warning', 3500);
                        return;
                    }

                    broadcastV.create("").bc.postMessage({ endPoint: "SpecialObjectGrid", origin: window.location.href });

                    FieldVaildation.blockEvaluationOfDF = true;
                    if (s.cpIdRecord === 0 || s.cpIdRecord == undefined) {
                        AjaxStatus.FormSubmit(window.ActionToPerform.SpecialObjects, Action.NewSaveAndClose);
                    } else {
                        AjaxStatus.FormSubmit(window.ActionToPerform.SpecialObjects, Action.NewSaveAndClose);
                    }
                    break;
                case "EditSO":
                    cbPropertiesTab.PerformCallback({ hasEditRights: true, getFields: true });
                    DisableItem(enums.RibbonNames.Properties, "EditSO");
                    EnableItems(enums.RibbonNames.Properties, "SaveAndClose");
                    EnableItems(enums.RibbonNames.Properties, "Save");
                    EnableItems(enums.RibbonNames.Properties, "SaveAndCreateNew");
                    EnableItems(enums.RibbonNames.Properties, "Edit");
                    EnableItems(enums.RibbonNames.Properties, "AddFile");
                    EnableItems(enums.RibbonNames.Properties, "Remove");

                    //if (checkStatus === enums.RecordStatus.CheckedOut ||
                    //    checkStatus === enums.RecordStatus.checkedOutBySelfDifferentPc ||
                    //    checkStatus === enums.RecordStatus.checkedOutByself) {
                    //} else {
                    //    Notification.SetNotification(window.SwResourceObject.RecordIsNotCheckedOutByYou, 'warning', 2500);
                    //}
                    break;
                case "Save":
                    if (typeof window.fieldsGroup != "undefined" && window.fieldsGroup.GetValue() == null) {
                        Notification.SetNotification(Helper.T("PleaseSelectType"), 'warning', 3500);
                        return;
                    }
                    broadcastV.create("").bc.postMessage({ endPoint: "SpecialObjectGrid", origin: window.location.href });

                    FieldVaildation.blockEvaluationOfDF = true;
                    if (s.cpIdRecord === 0 || s.cpIdRecord == undefined) {
                        AjaxStatus.FormSubmit(window.ActionToPerform.SpecialObjects, Action.New);
                    } else {
                        AjaxStatus.FormSubmit(window.ActionToPerform.SpecialObjects, Action.Edit);
                    }
                    break;
                case "SaveAndCreateNew":
                    if (typeof window.fieldsGroup != "undefined" && window.fieldsGroup.GetValue() == null) {
                        Notification.SetNotification(Helper.T("PleaseSelectType"), 'warning', 3500);
                        return;
                    }
                    broadcastV.create("").bc.postMessage({ endPoint: "SpecialObjectGrid", origin: window.location.href });

                    FieldVaildation.blockEvaluationOfDF = true;
                    if (s.cpIdRecord === 0 || s.cpIdRecord == undefined) {
                        AjaxStatus.FormSubmit(window.ActionToPerform.SpecialObjects, Action.NewSaveAndCreateNew);
                    } else {
                        AjaxStatus.FormSubmit(window.ActionToPerform.SpecialObjects, Action.NewSaveAndCreateNew);
                    }
                    break;
                case "AddFile":
                    AddFileRelatedFiles(
                        AppV.GetGlobals().ObjectId,
                        AppV.GetGlobals().RecordId,
                        AppV.GetGlobals().ObjectType);
                    break;

                case "Remove":
                    Helper.ShowConfirmPopUp("SolidWorks",
                        Helper.T("AreYouSureYouWantToDeleteSelectedItemS"),
                        "RelatedFiles.RemoveFile(" + AppV.GetGlobals().ObjectId + "," + AppV.GetGlobals().RecordId + ", '" + AppV.GetGlobals().RecordGuid + "')");
                    break;

                case "UploadLatest":
                    RelatedFiles.AddNewerFileRelatedFiles(AppV.GetGlobals().RecordId, AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordGuid);
                    break;

            }
            //BOM Items
            _InternalFunctions.BOM.CommandExecuted(e.item.name);
        }
    };

    return {
        Documents: Documents,
        Process: Process,
        SpecialObjects: SpecialObjects,

        MinimizationStateChanged: function (s, e) {
            // var isMinimized = ribbonPrpCard.GetMinimized();
            var menuPanel = splFullScreenModePropertyCard.GetPaneByName("pltopMenuBarPropertyCard");

            //if (isMinimized) {
            var minSize = parseInt(ribbonPrpCard.GetHeight());
            menuPanel.SetSize(minSize);
            //  } else {
            //     var maxSize = menuPanel.GetMaxSize();
            // menuPanel.SetSize(maxSize);
            // }
        }
    };

})();

function save_ProcessRelatedItemGrid(name) {
    var validateRows = false;
    if (typeof ProcessRelatedItemGrid !== "undefined")
        validateRows = ProcessRelatedItemGrid.batchEditApi.ValidateRows();

    if (name === "SendToNextStage") {
        var obj = FieldVaildation.checkBeforeSave();
        var isValidForm = window.ASPxClientEdit.ValidateEditorsInContainerById('FormSubmitGroupFields', '', true) && window.ASPxClientEdit.ValidateEditorsInContainerById('FormSubmitGroupFields', '', true);
        if (isValidForm && obj.total === 0) {
            FieldVaildation.blockEvaluationOfDF = false;
            if (validateRows) {
                if (ProcessRelatedItemGrid.batchEditApi.GetUpdatedRowIndices().length != 0) {
                    window.Processes.State.actionName = name;
                    window.ProcessRelatedItemGrid.UpdateEdit();
                } else {
                    RZPropRibbon.Process.SendToNextStageOkClicked(AppV.GetGlobals().RecordId);
                }
            } else {
                RZPropRibbon.Process.SendToNextStageOkClicked(AppV.GetGlobals().RecordId);
            }
        } else {
            DisableNeccesaryItemsOnAction(window.ActiveObjectsOnAction, false, enums.RibbonNames.Properties);
            if (obj.total > 0) {
                window.PropertyCard.Alert.Show(obj.msg);
                FieldVaildation.blockEvaluationOfDF = false;
            } else {
                window.PropertyCard.Alert.Show(SwResourceObject.PleaseCompleteRequiredFields);
            }
        }
    }
    else {
        if (validateRows) {
            if (ProcessRelatedItemGrid.batchEditApi.GetUpdatedRowIndices().length != 0) {
                window.Processes.State.actionName = name;
                window.ProcessRelatedItemGrid.UpdateEdit();
            } else {
                RZPropRibbon.Process.SaveProcessData();
            }
        } else {
            RZPropRibbon.Process.SaveProcessData();
        }
    }
}


function DisableFunctionalityContextMenuBom(isEnabled) {
    var items = [];
    if (typeof CtxMenuBillOfMaterials != "undefined") {

        for (var i = 0; i < CtxMenuBillOfMaterials.GetItemCount(); i++) {
            if (!CtxMenuBillOfMaterials.GetItem(i).clientEnabled)
                items.push(CtxMenuBillOfMaterials.GetItem(i));
        }
        if (items.length != 0)
            CtxMenuBillOfMaterials.DisabledItems = items;
        items = null;
        if (isEnabled)
            CtxMenuBillOfMaterials.SetEnabled(isEnabled);
        else {
            CtxMenuBillOfMaterials.DisabledItems.forEach(function (item, index) {
                CtxMenuBillOfMaterials.GetItem(item.index).SetEnabled(isEnabled);
            });
        }
    }
}


function AddFileRelatedFiles(objectId, recordId, objectType = -9999) {

    if (typeof relatedFilesRecords == "undefined")
        return;

    if (objectType === enums.ObjectTypes.SpecialObject) {
        View.load('fileUploadPopupControl',
            {
                recordId: recordId,
                objectId: objectId,
                isPrimary: false
            });
        return;
    }

    var a = JSON.parse(relatedFilesRecords.cpAllRowData);
    var values = a.filter(function (x) {
        return relatedFilesRecords.GetVisibleSelectedNodeKeys().includes(String(x.FileId)) && x.IsFolder;
    });

    if (typeof (values) === 'undefined' || values == null || values.length < 1) {
        Notification.SetNotification(SwResourceObject.PleaseSelectAFolder, 'warning', 3500);
        return;
    }

    values = values[0];
    if (values.IsFolder === false && values.IsPrimary === true) {
        Notification.SetNotification(SwResourceObject.PrimaryFilesCannotBeChangedFromHere, 'warning', 3500);
        return;
    }

    View.load('fileUploadPopupControl',
        {
            isPrimary: values.IsPrimary,
            fileID: values.FileId,
            recordId: recordId,
            objectId: objectId,
            allowedExtension: values.AllowedFileExtensions
        });
}


// function EnableRelatedFiles() {
//     //EnableItems("OpenFileRelatedFiles");
//     EnableItems(enums.RibbonNames.Properties, "DownloadALLfilesfromserver");
//     //EnableItems("Upload ALL NEWER files to server");
//     EnableItems(enums.RibbonNames.Properties, "Remove");
//     EnableItems(enums.RibbonNames.Properties, "AddFile");
// }



function DisableItem(ribbonName, name) {
    if (typeof window[ribbonName] != "undefined") {
        var item = window[ribbonName].GetItemByName(name);
        if (item != null) {
            item.SetEnabled(false);
        }
    }

}

function EnableItems(ribbonName, name) {
    if (typeof window[ribbonName] != "undefined") {
        var item = window[ribbonName].GetItemByName(name);
        if (item != null) {
            item.SetEnabled(true);
        }
    }
}

DisableNeccesaryItemsOnAction = function (items, action, ribbonName) {
    if (items !== undefined) {
        items.forEach(function (item) {
            (action) ? DisableItem(ribbonName, item) : EnableItems(ribbonName, item);
        });
    }
}
;

var AuditTrail = (function () {
    return {
        Grid: {
            AuditTrailGridInit: function (s, e) {
                RzProperties.CalculateHeightForAudit();
            },
            AuditTrailGridEndCallback: function (s, e) {
                window.loadingPanel.Hide();
                cbpAuditTrialFilter.PerformCallback();
            },
            AuditTrailGridBeginCallback: function (s, e) {
                e.customArgs["objectId"] = AppV.GetGlobals().ObjectId;
                e.customArgs["recordGuid"] = AppV.GetGlobals().RecordGuid;
                e.customArgs["recordId"] = AppV.GetGlobals().RecordId;
                e.customArgs["reloadGrid"] = true;

                e.customArgs["DateFrom"] = auditDateFrom.GetText();
                e.customArgs["DateTo"] = auditDateTo.GetText();
                var text = window.ListBoxUserFields.GetValue();
                var usersList="";
                if (text !== null) {
                    usersList = DropDownEdit.GetValuesByTexts(text.split(","), DropDownEdit.ControlName("ListBoxUserFields")).toString();
                }
                e.customArgs["usersList"] = usersList;

                switch (e.command) {
                    case "PAGERONCLICK":
                    case "APPLYCOLUMNFILTER":
                    case "APPLYFILTER":
                    case "APPLYHEADERCOLUMNFILTER":
                    case "NEXTPAGE":
                    case "SORT":
                        e.customArgs["reloadGrid"] = false;
                        break;
                    default:
                        e.customArgs["reloadGrid"] = true;
                        break;
                }
            },
        
        },
        Click: {
            ApplyFilter: function (s, e) {
                window.loadingPanel.Show();
                AuditTrialGrid.PerformCallback();
                window.loadingPanel.Hide();
            },
        },
        ContextMenu: {
            Display: function (s, e) {
                var x = ASPxClientUtils.GetEventX(e.htmlEvent);
                var y = ASPxClientUtils.GetEventY(e.htmlEvent);
                if (e.objectType === "row" || e.objectType === "emptyrow") {
                    s.SetFocusedRowIndex(e.index);
                    setTimeout(function () {
                        window.CtxAuditTrailContextMenu.ShowAtPos(x, y);
                    }, 10);
                    rowKey = s.GetRowKey(e.index);
                }
            },
            ItemClick: function (s, e) {
                switch (e.item.name) {
                    case "ExportToExcel":
                        App.Exporting = true;
                        AuditTrialGrid.ExportTo(ASPxClientGridViewExportFormat.Xlsx);
                        break;
                }
            },
        }
    }
})();;
var RzHistory = (function () {

    var _State = {

        Default: {
            reload: false
        },
        Process: {
            isFirstLoad: false,
            Grid: {
                reload: false
            }
        },

    };


    var _InternalFunctions = {
        Default: {

        },
        Process: {
            GenerateDiagram: function (s, e) {
                window.ProcessesHistoryGrid.GetRowValues(
                    e.visibleIndex,
                    "VersionIndex",
                    function (result) {
                        MindFusionDiagram.init(AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordGuid, result);
                    }
                );
            },
        },
        ExportToExcel: function () {
            App.Exporting = true;
            if (AppV.GetGlobals().ObjectType == enums.ObjectTypes.Processes)
                window["ProcessesHistoryGrid"].ExportTo(ASPxClientGridViewExportFormat.Xlsx);
            else
                window["HistoryGrid"].ExportTo(ASPxClientGridViewExportFormat.Xlsx);
        }
    }

    return {

        Default: {
            ShouldReload: function (reload) {
                if (typeof reload !== 'undefined')
                    _State.Default.reload = reload;
                else
                    return _State.Default.reload;
            },
            BeginCallback: function (s, e) {

            },
            EndCallback: function (s, e) {

            },
            RowDblClick: function () {
                if (AppV.GetGlobals().ObjectType == enums.ObjectTypes.Processes) {
                    ProcessesHistoryGrid.GetRowValues(window.ProcessesHistoryGrid.GetFocusedRowIndex(),
                        "IdRecord",
                        function (value) {
                            if (Helper.IsEmpty("", value)) {
                                Notification.SetNotification(SwResourceObject.ChooseARecord, "warning", 3500);
                                return;
                            }
                            $.ajax({
                                type: "POST",
                                url: '/UrlDecrypt/GetEncryptedUrl/',
                                data: {
                                    "objectId": AppV.GetGlobals().ObjectId,
                                    "idRecord": value,
                                    "recordGuid": AppV.GetGlobals().RecordGuid,
                                    "subObjectGuid": AppV.GetGlobals().SubObjectGuid,
                                    "actionToPerform": 11
                                },
                                dataType: "json",
                                success: function (response) {
                                    Helper.open('/PropertyCard/Index/' + response, '_blank');
                                }
                            });
                        }
                    );

                } else {
                    window.HistoryGrid.GetRowValues(window.HistoryGrid.GetFocusedRowIndex(),
                        "UrlEncrypted",
                        function (value) {
                            if (typeof value === "undefined" || value === null || value.length === 0) {
                                Notification.SetNotification(SwResourceObject.ChooseARecord, "warning", 3500);
                                return;
                            }
                            Helper.open("/PropertyCard/Index/" + value, "_blank");
                        }
                    );
                }

            },
            ShowMinorRevisionsHistory: function (s, e, objId, recId, recGuid, IsPreviewMode) {
                HistoryGrid.PerformCallback({
                    objectId: objId,
                    idRecord: recId,
                    recordGuid: recGuid,
                    IsPreviewMode: IsPreviewMode
                });
            },
            BeginCallback: function (s, e) {
                e.customArgs["showMinorRevisions"] = typeof ShowMinorRevisionsChkb == 'undefined' ? false : window.ShowMinorRevisionsChkb.GetValue();
            }
        },
        Process: {

            Grid: {
                ShouldReload: function (reload) {
                    if (typeof reload !== 'undefined')
                        _State.Process.Grid.reload = reload;
                    else
                        return _State.Process.Grid.reload;
                },
                Init: function (s, e) {
                    // var panel = processHistorySplitter.GetPaneByName("GridListPaneHistory");
                    //panel.SetSize(parseInt(processHistorySplitter.GetHeight()) * 0.4);
                    _State.Process.isFirstLoad = true;
                    RzHistory.ProcessHistoryPanelResize(s, e);
                },
                BeginCallback: function (s, e) {
                    e.customArgs["objectId"] = AppV.GetGlobals().ObjectId;
                    e.customArgs["recordGuid"] = AppV.GetGlobals().RecordGuid;
                },
                EndCallback: function (s, e) {
                    if (_State.Process.isFirstLoad) {
                        RzHistory.ProcessHistoryPanelResize(s, e);
                        var index = ProcessesHistoryGrid.pageRowCount - 1;
                        if (index < 0)
                            return;
                        ProcessesHistoryGrid.SetFocusedRowIndex(index);
                        ProcessesHistoryGrid.MakeRowVisible(index);
                        MindFusionDiagram.init(AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordGuid, index);
                    }
                    _State.Process.isFirstLoad = false;
                },

                RowClick: function (s, e) {
                    _InternalFunctions.Process.GenerateDiagram(s, e);
                },
            }
        },

        ContextMenu: {
            Display: function (s, e) {
                if (e.objectType === "row" || e.objectType === "emptyrow") {
                    var x = window.ASPxClientUtils.GetEventX(e.htmlEvent);
                    var y = window.ASPxClientUtils.GetEventY(e.htmlEvent);
                    window.CtxMenuHistory.ShowAtPos(x, y);
                    if (AppV.GetGlobals().ObjectType == enums.ObjectTypes.Processes)
                        ProcessesHistoryGrid.SetFocusedRowIndex(e.index);
                }
            },

            DisplayFromButtonContextMenu: function () {
                var s = {};
                s = window["HistoryGrid"];
                var e = {};
                window["HistoryGrid"].pageRowCount === 0 ? e.objectType = "emptyrow" : e.objectType = "row";
                e.index = window["HistoryGrid"].GetFocusedRowIndex();
                var offset = $("#MainHistoryGridMenuButton").offset();
                e.htmlEvent = { clientX: offset.left, clientY: offset.top };
                try {
                    RzHistory.ContextMenu.Display(s, e);
                } catch (e) {
                    console.log(e);
                }
            },
            ItemClick: function (s, e) {
                switch (e.item.name) {
                    case "openRecord":
                        RzHistory.Default.RowDblClick();
                        break;
                    case "exportListToExcel":
                        _InternalFunctions.ExportToExcel();
                        break;
                }
            }
        },

        ProcessHistoryPanelResize: function (s, e) {

            var panelGridHeight = processHistorySplitter.GetPaneByName("GridListPaneHistory").lastHeight;
            ////      height = panelGrid.GetHeight();
            ProcessesHistoryGrid.SetHeight(panelGridHeight - 20);
            // panelDiagram.SetSize(height * 0.6);
        }

    };

})();
;
(function () {
    var specialObjects = {}
    var referenceSenderName;

    specialObjects.SaveNewMulti = false;
    specialObjects.addNewItem = false;
    specialObjects.IsEditMode = false;
    specialObjects.SortFieldName = '';
    specialObjects.SortOrder = 0;


    specialObjects.OnShowCtxMenuSpecialObjects = function (s, e) {
        if (e.objectType === "row" || e.objectType === "emptyrow") {
            s.SetFocusedRowIndex(e.index);
            var x = ASPxClientUtils.GetEventX(e.htmlEvent);
            var y = ASPxClientUtils.GetEventY(e.htmlEvent);
            referenceSenderName = s.name;
            setTimeout(function () {
                window.CtxSpecialObjectGrid.ShowAtPos(x, y);
            }, 10);
            SpecialObjects.EnableDisableContextMenuEmptyGrid(s.pageRowCount);
            SpecialObjects.EnableDisableContextMenuItems(s.pageRowCount);
        }
    };
    specialObjects.OnColumnSorting = function (s, e) {
        specialObjects.SortFieldName = e.column.fieldName;
        specialObjects.SortOrder = e.column.sortOrder;
        
       
        //var grid = ASPxClientControl.GetControlCollection().GetByName(s.name);
        //grid.SortBy(e.column.fieldName, e.column.sortOrder, true, 0);
    }

    specialObjects.BeginCallbackSpecialObjectsGrid = function (s, e) {
        e.customArgs["SortFieldName"] = specialObjects.SortFieldName;
        e.customArgs["SortOrder"] = specialObjects.SortOrder;

    }

    specialObjects.EndCallbackSpecialObjectsGrid = function (s, e) {
        var kot = specialObjects.SortFieldName;
        var plot = specialObjects.SortOrder;
        var grid = ASPxClientControl.GetControlCollection().GetByName(s.name);
        
        //s.SortBy(kot, plot, true, 0)
    }
    

    specialObjects.DisplayFromButtonContextMenu = function () {
        var so = AppV.GetPropertyTabsState().SpecialObject;
        var specialObjectsGrid = "SpecialObjectsGrid" + so.GroupObjectId;
        var s = {};
        s = window[specialObjectsGrid];
        var e = {};
        window[specialObjectsGrid].pageRowCount === 0 ? e.objectType = "emptyrow" : e.objectType = "row";
        e.index = window[specialObjectsGrid].GetFocusedRowIndex();
        var idMenuButton = "#MainSOGridMenuButton" + so.GroupObjectId;
        var offset = $(idMenuButton).offset();
        e.htmlEvent = { clientX: offset.left, clientY: offset.top };
        try {
            SpecialObjects.OnShowCtxMenuSpecialObjects(s, e);
        } catch (e) {
            console.log(e);
        }
    };
    specialObjects.EnableDisableContextMenuEmptyGrid = function (pageRowCount) {
        if (pageRowCount === 0) {
            CtxSpecialObjectGrid.GetItemByName("Properties").SetEnabled(false);
            CtxSpecialObjectGrid.GetItemByName("Delete").SetEnabled(false);
            CtxSpecialObjectGrid.GetItemByName("Refresh").SetEnabled(false);
            CtxSpecialObjectGrid.GetItemByName("exportListToExcel").SetEnabled(false);
        } else {
            CtxSpecialObjectGrid.GetItemByName("Properties").SetEnabled(true);
            CtxSpecialObjectGrid.GetItemByName("Delete").SetEnabled(true);
            CtxSpecialObjectGrid.GetItemByName("Refresh").SetEnabled(true);
            CtxSpecialObjectGrid.GetItemByName("exportListToExcel").SetEnabled(true);
        }
    };
    specialObjects.EnableDisableContextMenuItems = function (pageRowCount) {
        var checkStatus = AppV.GetPropertyTabsState().CheckStatus;
        if (checkStatus === enums.RecordStatus.CheckedOut ||
            checkStatus === enums.RecordStatus.checkedOutBySelfDifferentPc ||
            checkStatus === enums.RecordStatus.checkedOutByself) {
            CtxSpecialObjectGrid.GetItemByName("New").SetEnabled(true);
            if (pageRowCount > 0) {
                CtxSpecialObjectGrid.GetItemByName("Delete").SetEnabled(true);
            }
        } else {
            CtxSpecialObjectGrid.GetItemByName("New").SetEnabled(false);
            CtxSpecialObjectGrid.GetItemByName("Delete").SetEnabled(false);
        }
    }
    specialObjects.checkHasFocuseItem = function (s, e) {
        var specialObjectsGrid = "SpecialObjectsGrid" + AppV.GetPropertyTabsState().SpecialObject.GroupObjectId;
        var focusedRow = window[specialObjectsGrid].GetFocusedRowIndex();
        if (focusedRow === -1) {
            return false;
        } else {
            return true;
        }
    };

    specialObjects.MultiSpecialObjectContextMenuDisplay = function (s, e) {
        var x = ASPxClientUtils.GetEventX(e.htmlEvent);
        var y = ASPxClientUtils.GetEventY(e.htmlEvent);
        // s.SetFocusedRowIndex(e.index);
        setTimeout(function () {
            window.CtxMultiSpecialObjectContextMenu.ShowAtPos(x, y);
        }, 10);

    }

    specialObjects.OnContextMenuMultiSpecialObjectItemClick = function (s, e) {
        var SoMultipleGrid = window["MultiSpecialObjectsGrid"];
        if (SoMultipleGrid !== null || SoMultipleGrid !== "undefined") {
            switch (e.item.name) {
                case "ApplyThisValueToAll":
                    GridInlineEditor.ApplyAll(SoMultipleGrid, s, e);
                    break;
                case "ApplyThisValueToAllAbove":
                    GridInlineEditor.ApplyAbove(SoMultipleGrid, s, e);
                    break;
                case "ApplyThisValueToAllBelow":
                    GridInlineEditor.ApplyBelow(SoMultipleGrid);
                    break;
                case "ApplyThisValueToAllSelected":
                    GridInlineEditor.ApplySelected(SoMultipleGrid);
                    break;
                case "RefreshMultiSpecialObject":
                    var so = AppV.GetPropertyTabsState().SpecialObject;
                    window.CpbpModalMultiSpecialObjects.PerformCallback({
                        relatedObjectId: so.RelatedObjectId,
                        groupObjId: so.GroupObjectId,
                        objectId: AppV.GetGlobals().ObjectId,
                        idRecord: AppV.GetGlobals().RecordId,
                        isMultiNew: so.IsMulti,
                        isEdit: specialObjects.IsEditMode
                    });
                    break;
                case "ExportToExcel":
                    App.Exporting = true;
                    MultiSpecialObjectsGrid.ExportTo(ASPxClientGridViewExportFormat.Xlsx);
            }
        } else {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
        }
    }

    specialObjects.OnContextMenuClickSpecialObjects = function (s, e) {
        var checkStatus;
        if (window.AppV.GetGlobals().isMainWindow) {
            if (typeof MainGrid.GetGridRowData() != "undefined") {
                checkStatus = MainGrid.GetGridRowData().CheckStatus;
            } else {
                Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
                return;
            }
        }
        else {
            checkStatus = AppV.GetPropertyTabsState().CheckStatus;
        }
        switch (e.item.name) {
            case "New":
                if (checkStatus === enums.RecordStatus.CheckedOut || checkStatus === enums.RecordStatus.checkedOutBySelfDifferentPc
                    || checkStatus === enums.RecordStatus.checkedOutByself || checkStatus === enums.RecordStatus.UnDefined) {
                    specialObjects.OpenNewSpecialObject(s, e);
                }
                else if (checkStatus === enums.RecordStatus.CheckedIn) {
                    window.loadingPanel.Show();

                    var listRecords = [];

                    var recordKeys = Object.keys(MainGrid.GetSelectedRowValues());

                    if (recordKeys.length > 0) {

                        recordKeys.forEach(function (key, index) {
                            listRecords.push({
                                RecordId: MainGrid.GetSelectedRowValues()[key].RecordId,
                                RecordGuid: MainGrid.GetSelectedRowValues()[key].RecordGuid,
                                PartNumber: MainGrid.GetSelectedRowValues()[key].PartNumber,
                                StageId: Processes.State.StageId
                            });

                        });

                        $.ajax({
                            type: "POST",
                            url: '/Properties/CheckOut/',
                            data: {
                                objectId: AppV.GetGlobals().ObjectId,
                                subObjectGuid: AppV.GetGlobals().SubObjectGuid,
                                isContextmenu: true,
                                listRecords: JSON.stringify(listRecords)
                            },
                            // serializes the form's elements.
                            success: function (response) {

                                window.CheckOut.ResponseData = JSON.parse(response.data);

                                CheckOut.ResponseData.forEach(function (entry) {
                                    if (entry.Success === false) {
                                        DisableNeccesaryItemsOnAction(window.ActiveObjectsOnAction, false, enums.RibbonNames.Properties);
                                        Notification.SetNotification(entry.CustomAttributes.PartNumber + ": " + Helper.T(entry.Message), 'warning', 3500);
                                    }
                                });
                                if (window.CheckOut.ResponseData.length > 0) {
                                    window.CheckOut.Events.check_out_modal(window.CheckOut.ResponseData);
                                }
                                window.loadingPanel.Hide();

                            }
                        });

                    } else {
                        window.loadingPanel.Hide();
                        Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
                    }
                }
                else {
                    Notification.SetNotification(window.SwResourceObject.RecordIsNotCheckedOutByYou, 'warning', 3500);
                }
                break;
            case "NewFrom":
                break;
            case "Properties":
                specialObjects.GoToParentProperties(s, e);
                break;
            case "EditSO":
                specialObjects.GoToParentProperties(s, e);
                break;
            case "ChangeType":
                break;
            case "Delete":
                var hasFocusedItemSo = window.SpecialObjects.checkHasFocuseItem(s, e);
                if (hasFocusedItemSo) {
                    Helper.ShowConfirmPopUp("SolidWorks", Helper.T("AreYouSureYouWantToDeleteSelectedItemS"),
                        "SpecialObjects.DeleteRecordsSpecialObject(" + AppV.GetGlobals().RecordId + ", " + "" + AppV.GetGlobals().ObjectId + ")");
                } else {
                    Notification.SetNotification(window.SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
                }
                break;
            case "OpenFile":
                break;
            case "CreateTask":
                break;
            case "Refresh":
                window.SpecialObjects.GetSpecialObjectGrid(s, e);
                break;
            case "exportListToExcel":
                App.Exporting = true;
                window[referenceSenderName].ExportTo(ASPxClientGridViewExportFormat.Xlsx);
                break;
        }
    }

    specialObjects.SetEnableEditAll = function () {
        var item = window.ribbonPrpCard.GetItemByName("EditAllSO");
        var so = AppV.GetPropertyTabsState().SpecialObject;
        if (item != null) {
            if (so.IsMulti === enums.SpecialObject.IsMultipleTemplate) {
                item.SetEnabled(true);
            } else if (so.IsMulti === enums.SpecialObject.isSingle) {
                item.SetEnabled(false);
            }
        }
    };

    specialObjects.OpenNewSpecialObject = function (s, e) {
        var so = AppV.GetPropertyTabsState().SpecialObject;
        var relatedObjectId = so.RelatedObjectId;
        var groupObjIdSo = so.GroupObjectId;
        var parentRecordId = AppV.GetGlobals().RecordId;
        var subObjectGuid = "";
        specialObjects.IsEditMode = false;
        window.btnAddNewMultiSpecialObject.SetVisible(false);
        if (so.IsMulti === enums.SpecialObject.isSingle) {
            $.ajax({
                type: "POST",
                url: '/SpecialObjects/GetEncryptedUrl/',
                data: {
                    "relatedObjectId": relatedObjectId,
                    "subObjectGuid": subObjectGuid,
                    "groupObjIdSo": groupObjIdSo,
                    "parentRecordId": parentRecordId,
                    "stageId": Processes.State.StageId
                },
                dataType: "json",
                success: function (response) {
                    broadcastV.create({ endPoint: "SpecialObjectGrid" });
                    Helper.open('/PropertyCard/AddNew/' + response, '_blank');
                }
            });
        } else if (so.IsMulti === enums.SpecialObject.IsMultipleTemplate) {
            var hasrow = window["SpecialObjectsGrid" + AppV.GetPropertyTabsState().SpecialObject.GroupObjectId]
                .GetVisibleRowsOnPage();
            if (hasrow === 0) {
                window.CpbpModalMultiSpecialObjects.PerformCallback({
                    relatedObjectId: relatedObjectId,
                    groupObjId: groupObjIdSo,
                    objectId: AppV.GetGlobals().ObjectId,
                    idRecord: AppV.GetGlobals().RecordId,
                    isMultiNew: so.IsMulti
                });
            } else {
                var messages = "This is a fixed table and dose not allow more records! Please use edit!";
                Notification.SetNotification(messages, 'warning', 2500);
            }
        } else if (so.IsMulti === enums.SpecialObject.IsMultipleManual) {
            window.btnAddNewMultiSpecialObject.SetVisible(true);
            var hasrow = window["SpecialObjectsGrid" + AppV.GetPropertyTabsState().SpecialObject.GroupObjectId]
                .GetVisibleRowsOnPage();
            if (hasrow === 0) {
                window.CpbpModalMultiSpecialObjects.PerformCallback({
                    relatedObjectId: relatedObjectId,
                    groupObjId: groupObjIdSo,
                    objectId: AppV.GetGlobals().ObjectId,
                    idRecord: AppV.GetGlobals().RecordId,
                    isMultiNew: so.IsMulti
                });
            } else {
                window.CpbpModalMultiSpecialObjects.PerformCallback({
                    relatedObjectId: so.RelatedObjectId,
                    groupObjId: so.GroupObjectId,
                    objectId: AppV.GetGlobals().ObjectId,
                    idRecord: AppV.GetGlobals().RecordId,
                    isMultiNew: so.IsMulti
                });
            }

        }
    };

    specialObjects.EditAllSpecialObject = function (s, e) {
        var checkStatus = AppV.GetPropertyTabsState().CheckStatus;
        var so = AppV.GetPropertyTabsState().SpecialObject;
        window.btnAddNewMultiSpecialObject.SetVisible(false);
        specialObjects.IsEditMode = true;
        if (checkStatus === enums.RecordStatus.CheckedOut ||
            checkStatus === enums.RecordStatus.checkedOutBySelfDifferentPc ||
            checkStatus === enums.RecordStatus.checkedOutByself) {
            var hasrow = window["SpecialObjectsGrid" + AppV.GetPropertyTabsState().SpecialObject.GroupObjectId]
                .GetVisibleRowsOnPage();
            if (hasrow > 0) {
                window.CpbpModalMultiSpecialObjects.PerformCallback({
                    relatedObjectId: so.RelatedObjectId,
                    groupObjId: so.GroupObjectId,
                    objectId: AppV.GetGlobals().ObjectId,
                    idRecord: AppV.GetGlobals().RecordId,
                    isMultiNew: so.IsMulti,
                    isEdit: true
                });
            } else {
                Notification.SetNotification(window.SwResourceObject.ThereAreNoRecordsToEditOnThisTable,
                    'warning',
                    2500);
            }
        } else {
            Notification.SetNotification(window.SwResourceObject.YouDoNotHavePermissionToPerformThisAction,
                'warning',
                2500);
        }
    };

    specialObjects.GoToParentProperties = function (s, e) {
        var groupObjId = AppV.GetPropertyTabsState().SpecialObject.GroupObjectId;
        var hasFocusedItem = specialObjects.checkHasFocuseItem(s, e);
        var specialObjectsGrid = "SpecialObjectsGrid" + groupObjId;
        if (hasFocusedItem) {
            window[specialObjectsGrid].GetRowValues(window[specialObjectsGrid].GetFocusedRowIndex(),
                'UrlEncrypted',
                function (value) {
                    if (typeof (value) === 'undefined' || value === null || value.length === 0) {
                        Notification.SetNotification(window.SwResourceObject.ChooseARecord, 'warning', 3500);
                        return;
                    }
                    Helper.open('/PropertyCard/Index/' + value, '_blank');
                    return;
                });
        } else {
            Notification.SetNotification(window.SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
        }
    };

    specialObjects.GetSpecialObjectGrid = function (s, e) {
        if (!AppV.GetGlobals().isMainWindow) {
            window.ribbonPrpCard.SetContextTabCategoryVisible(window.SwResourceObject.SpecialObjects, true);
            var tabInfoSo = window.ribbonPrpCard.GetTabByName('SpecialObjectsMenu');
            window.ribbonPrpCard.SetActiveTabIndex(tabInfoSo.index);
            Helper.closeBroadcast('special_object');
        }
        window.App.PropertyCard.Callback.SpecialObject(AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordId);
    };

    specialObjects.DeleteRecordsSpecialObject = function (parentIdRecord, parentObjectId) {
        var groupObjIdSo = AppV.GetPropertyTabsState().SpecialObject.GroupObjectId;
        var listIdRecords = [];
        var specialObjectsGrid = "SpecialObjectsGrid" + groupObjIdSo;
        window[specialObjectsGrid].GetSelectedFieldValues("idRecord",
            function onGetSelectedFieldValues(values) {
                if (values.length !== 0) {
                    values.forEach(function (entry) {
                        listIdRecords.push(entry);
                    });
                    SpecialObjects.SendDeleteRecords(groupObjIdSo, parentIdRecord, parentObjectId, listIdRecords);
                } else {
                    window[specialObjectsGrid].GetRowValues(window[specialObjectsGrid].GetFocusedRowIndex(),
                        'idRecord',
                        function (focuseValues) {
                            listIdRecords.push(focuseValues);
                            SpecialObjects.SendDeleteRecords(groupObjIdSo,
                                parentIdRecord,
                                parentObjectId,
                                listIdRecords);
                        });
                }
            });
    };

    specialObjects.SendDeleteRecords = function (groupObjIdSo, parentIdRecord, parentObjectId, listIdRecords) {
        var so = AppV.GetPropertyTabsState().SpecialObject;
        var objectId = so.RelatedObjectId;
        if (listIdRecords.length !== 0) {
            $.ajax({
                type: "POST",
                url: '/SpecialObjects/DeleteSpecialObjectsRecords/',
                data: {
                    "objectId": objectId,
                    "groupObjIdSo": groupObjIdSo,
                    "parentObjectId": parentObjectId,
                    "parentIdRecord": parentIdRecord,
                    "listIdRecords": listIdRecords
                },
                dataType: "json",
                success: function (response) {
                    var responseData = JSON.parse(response.data);
                    if (responseData.Success) {
                        window.App.PropertyCard.Callback.SpecialObject(parentObjectId, parentIdRecord);
                    } else {
                        Notification.SetNotification(responseData.Message, 'warning', 3500);
                    }
                }
            });
        } else {
            Notification.SetNotification(window.SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
        }
    };

    specialObjects.DeleteRecordsMain = function (objectId, listIdRecords, objectType, parentObjectId) {

        if (listIdRecords.length !== 0) {
            $.ajax({
                type: "POST",
                url: '/SpecialObjects/DeleteSpecialObjectsRecordsMain/',
                data: {
                    "objectId": objectId,
                    "listIdRecords": listIdRecords,
                    "parentObjectId": parentObjectId,
                    "objectType": objectType
                },
                dataType: "json",
                success: function (response) {
                    var responseData = JSON.parse(response.data);
                    if (responseData.Success) {
                        //TODO : Change this 
                        if (AppV.GetGlobals().IsSpecialObject) {
                            //Callbak of main grid
                            MainGrid.PerformCallback(true);
                        }
                    } else {
                        Notification.SetNotification(responseData.Message, 'warning', 3500);
                    }
                }
            });
        } else {
            Notification.SetNotification(window.SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
        }
    };

    specialObjects.btnAddNewMultiSpecialObjects = function (s, e) {
        var validateRows = MultiSpecialObjectsGrid.batchEditApi.ValidateRows();
        if (validateRows) {
            specialObjects.addNewItem = true;
            window.MultiSpecialObjectsGrid.UpdateEdit();
            var so = AppV.GetPropertyTabsState().SpecialObject;
            window.cbpMultiSpecialObjects.PerformCallback({
                relatedObjectId: so.RelatedObjectId,
                groupObjId: so.GroupObjectId,
                objectId: AppV.GetGlobals().ObjectId,
                idRecord: AppV.GetGlobals().RecordId,
                isMultiNew: so.IsMulti,
                addNewItem: true
            });
        }
    };

    specialObjects.btnSaveMultiSpecialObjects = function (s, e) {
        if (window["MultiSpecialObjectsGrid"] != undefined) {
            var validateRows = MultiSpecialObjectsGrid.batchEditApi.ValidateRows();
            if (validateRows) {
                if (MultiSpecialObjectsGrid.batchEditApi.GetUpdatedRowIndices().length != 0) {
                    window.MultiSpecialObjectsGrid.UpdateEdit();
                    loadingPanel.Show();
                    specialObjects.SaveNewMulti = true;
                    GridInlineEditor.ClearGridInlineState();
                }
                else {
                    Notification.SetNotification(window.SwResourceObject.PleaseEnterAValue, 'warning', 2500);
                }
            }
        } else {
            Notification.SetNotification(window.SwResourceObject.RecordCannotBeCreated, 'warning', 2500);
        }
    };

    specialObjects.MultiSpecialObjectsGridNew = function (s, e) {
        loadingPanel.Hide();
        if (specialObjects.SaveNewMulti) {
            pcModalMultiSpecialObjects.Hide();
            loadingPanel.Hide();
            window.App.PropertyCard.Callback.SpecialObject(AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordId);
        }
        specialObjects.SaveNewMulti = false;
        specialObjects.addNewItem = false;

    };

    specialObjects.BeginCallbackMultiSpecialObjectsGrid = function (s, e) {
        loadingPanel.Show();
        e.customArgs["addNewItem"] = specialObjects.addNewItem;
        e.customArgs["IsEditMode"] = specialObjects.IsEditMode;
    };


    var _height = 400; var _width = 900;
    specialObjects.SetDefaultPosition = function (s, width, height) {
        _width = width;
        _height = height;
        splMultiSpecialObjects.SetWidth(_width);
        splMultiSpecialObjects.SetHeight(_height + 26);
        MultiSpecialObjectsGrid.SetHeight(_height - 40);
        s.SetWidth(_width);
        s.SetHeight(_height + 95);
    };
    specialObjects.AfterResizing = function (s, e) {
        if (e.resizeState === 4) {
            specialObjects.SetDefaultPosition(s, 900, 400);
        } else {
            if (s.GetWidth() >= _width && s.GetHeight() >= _height) {
                if (e.resizeState === 1 || e.resizeState === 2) {
                    specialObjects.SetDefaultPosition(s, _width, _height);
                } else {
                    splMultiSpecialObjects.SetWidth(s.GetWidth() - 26);
                    splMultiSpecialObjects.SetHeight(s.GetHeight() - 93);
                    MultiSpecialObjectsGrid.SetHeight(s.GetHeight() - 144);
                    _width = s.GetWidth() + 1;
                    _height = s.GetHeight() + 1;
                }
            } else {
                specialObjects.SetDefaultPosition(s, 900, 400);
            }
        }
    };

    window.SpecialObjects = specialObjects;
})();
;
(function () {
    var timesheets = {};
    var _State = {
        reload: false,
        IsMove: false,
        focused: 0,
        Action: {
            Dublicate: 1,
            Remove: 2,
            RemoveAll: 3
        }
    };
    var _InternalFunctions = {
        PerformCallbackTimesheets: function () {
            var IdRecord = AppV.GetTimesheetsHomeState().isEdit === true ? AppV.GetGlobals().RecordId : -1;
            var showTasks = typeof ShowTaskTimesheets == "undefined" ? false : ShowTaskTimesheets.GetValue();
            window.cbpTimesheetsGrid.PerformCallback({
                IdRecord: IdRecord,
                UserId: AppV.GetTimesheetsHomeState().UserId,
                stageId: Planning.GetSlectedItemStageId(),
                isEdit: AppV.GetTimesheetsHomeState().isEdit,
                showTasks: showTasks
            });
        },
        AddRemoveLineTimesheets: function (action) {
            var IdRecord = Helper.GetGridFocusedRowKey("TimesheetsGrid", TimesheetsGrid.GetFocusedRowIndex());
            if (IdRecord != null) {
                Request.ajax({
                    type: "POST",
                    url: '/Timesheets/AddRemoveLineTimesheets/',
                    data: {
                        parentIdRecord: AppV.GetGlobals().RecordId,
                        IdRecord: Number(IdRecord),
                        Action: action,
                        isEdit: AppV.GetTimesheetsHomeState().isEdit
                    },
                    dataType: "json"
                }).then(function (response) {
                    var responseData = JSON.parse(response.data);
                    _State.reload = false;
                    _InternalFunctions.PerformCallbackTimesheets();
                });
            } else {
                Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
            }
        },
        MoveLineTimesheets: function (name) {
            var countEl = TimesheetsGrid.pageRowCount - 1;
            var focusedRowIndex = TimesheetsGrid.GetFocusedRowIndex();
            var focuses = focusedRowIndex;
            if (name === "MoveUp") {
                if (focusedRowIndex == 0) {
                    Notification.SetNotification(SwResourceObject.CannotMoveAnyFurther, 'warning', 2500);
                    return;
                }
                focuses = focusedRowIndex - 1;
            } else {
                if (focusedRowIndex >= countEl) {
                    Notification.SetNotification(SwResourceObject.CannotMoveAnyFurther, 'warning', 2500);
                    return;
                }
                focuses = focusedRowIndex + 1;
            }
            var IdRecord = Helper.GetGridFocusedRowKey("TimesheetsGrid", TimesheetsGrid.GetFocusedRowIndex());
            if (IdRecord != null) {
                Request.ajax({
                    type: "POST",
                    url: '/Timesheets/MoveLineTimesheets/',
                    data: {
                        parentIdRecord: AppV.GetGlobals().RecordId,
                        IdRecord: Number(IdRecord),
                        Action: name,
                        index: focusedRowIndex,
                        isEdit: AppV.GetTimesheetsHomeState().isEdit
                    },
                    dataType: "json"
                }).then(function (response) {
                    var responseData = JSON.parse(response.data);
                    _State.reload = false;
                    _State.IsMove = true;
                    _State.focused = focuses;
                    _InternalFunctions.PerformCallbackTimesheets();
                });
            } else {
                Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
            }
        }
    };
    timesheets.RemoveTimesheet = function () {

        //if (id === -1) {
        //    Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
        //    return;
        //}

        $.ajax({
            type: "POST",
            url: '/Timesheets/DeleteTimesheet/',
            data: {
                "objectId": AppV.GetGlobals().ObjectId,
                "recordId": AppV.GetGlobals().RecordId
            },
            dataType: "json",
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    MainGrid.PerformCallback(true);
                } else {
                    Notification.SetNotification(res.Message, 'warning', 3500);
                }
            }
        });
    };

    timesheets.DisplayContextMenu = function (s, e) {
        if (e.objectType === "row" || e.objectType === "emptyrow") {
            TimesheetsGrid.SetFocusedRowIndex(e.index);
            var x = ASPxClientUtils.GetEventX(e.htmlEvent);
            var y = ASPxClientUtils.GetEventY(e.htmlEvent);
            setTimeout(function () {
                window.CtxModalTimesheetsGrid.ShowAtPos(x, y);
            },
                10);
        }
    };
    timesheets.SetEnableDisable = function () {
        CmbTimesheetsReport.SetEnabled(AppV.GetTimesheetsHomeState().isEdit);
        BtntimesheetsReport.SetEnabled(AppV.GetTimesheetsHomeState().isEdit);
        var result = JSON.parse(window["gridViewDocuments"].cpAllRowData).filter(function (x) {
            return x.idRecord === AppV.GetGlobals().RecordId;
        })[0];
        cbPropertiesTab.SetEnabled(AppV.GetTimesheetsHomeState().isEdit);
        if (AppV.GetTimesheetsHomeState().isEdit) {
            if (result !== null && result !== undefined) {
                if (result.ChkStatus === enums.RecordStatus.In_Proccess || result.ChkStatus === enums.RecordStatus.Released) {
                    var itemsToDisable = ["btnSubimitForApprovalTimesheets", "btnSaveTimesheets", "TimesheetsPropertiesRefresh", "AddNew", "DublicateLine", "Remove", "RemoveAll", "MoveUp", "MoveDown", "AddFileRelFile","DeleteFileRelFile"];
                    itemsToDisable.forEach(function (entry) {
                        if (window[entry] !== null &&
                            window[entry] !== undefined) {
                            window[entry].SetEnabled(false);
                        }
                    });

                    cbPropertiesTab.SetEnabled(false);
                }
            }
        }
    };

    timesheets.PopupInit = function (s, e) {
        Timesheets.SetEnableDisable();
        TimeSheetsSectionTabs.SetActiveTabIndex(0);
        Timesheets.TimesheetsPropertiesRefresh();
    };
    timesheets.AddNewTimesheetsInit = function (s, e, isEdit) {
        var enable = isEdit == 1 ? true : false;
        CmbProject.SetEnabled(enable);
        CmbProjectStage.SetEnabled(enable);
    }
    
    timesheets.TimesheetsPropertiesRefresh = function () {
        window["cbPropertiesTab"].PerformCallback({ objectId: AppV.GetGlobals().ObjectId, groupObjIdSo: -1, getFields: true });
    };

    timesheets.CreateNewTimesheets = function () {
        AppV.PushStateTimesheetsHome({ "isEdit": false });
        View.load("pcModalTimesheets", {
            IdRecord: -1,
            UserId: AppV.GetTimesheetsHomeState().UserId,
            isEdit: AppV.GetTimesheetsHomeState().isEdit
        });
    };
    timesheets.OpenTimesheets = function () {
        AppV.PushStateTimesheetsHome({ "isEdit": true });
        View.load("pcModalTimesheets", {
            IdRecord: AppV.GetGlobals().RecordId,
            UserId: AppV.GetTimesheetsHomeState().UserId,
            isEdit: AppV.GetTimesheetsHomeState().isEdit
        });
    };
    timesheets.TabClickTimesheetsSection = function (s, e) {
        var objId = AppV.GetGlobals().ObjectId;
        var recId = AppV.GetGlobals().RecordId;
        var recGuid = AppV.GetGlobals().RecordGuid;
        var objType = AppV.GetGlobals().ObjectType;
        if (e.tab.name === "RelatedFiles") {
            window.App.PropertyCard.Callback.RelatedFiles(objId, recId, recGuid, objType);
        }
        else if (e.tab.name === "Comments") {
            window.App.PropertyCard.Callback.Notes(objId, recGuid, enums.ObjectTypes.Processes);
        }
        else if (e.tab.name === "Properties") {
            Timesheets.SetEnableDisable();
        }
    };

    timesheets.ContextMenuItemClick = function (s, e) {
        switch (e.item.name) {
            case "Refresh":
                _State.reload = true;
                _InternalFunctions.PerformCallbackTimesheets();
                break;
            case "ExportToExcel":
                App.Exporting = true;
                window["TimesheetsGrid"].ExportTo(ASPxClientGridViewExportFormat.Xlsx);
                break;
        }
    };
    timesheets.BeginCallbackTimesheetsGrid = function (s, e) {
        e.customArgs["reload"] = _State.reload;
        e.customArgs["IdRecord"] = AppV.GetTimesheetsHomeState().isEdit === true ? AppV.GetGlobals().RecordId : -1;
        e.customArgs["recordGuid"] = AppV.GetTimesheetsHomeState().isEdit === true ? AppV.GetGlobals().RecordGuid : "";
        e.customArgs["UserId"] = AppV.GetTimesheetsHomeState().UserId;
        e.customArgs["isEdit"] = AppV.GetTimesheetsHomeState().isEdit;
        e.customArgs["showTasks"] = typeof ShowTaskTimesheets == "undefined" ?false:ShowTaskTimesheets.GetValue();
        e.customArgs["state"] = AppV.GetTimesheetsHomeState().state;
        e.customArgs["stageId"] = Planning.GetSlectedItemStageId();
    };

    timesheets.TimesheetGridButtonClick = function (s, e) {
        if (AppV.GetGlobals().isMainWindow) {
        var IdRecord = Helper.GetGridFocusedRowKey("TimesheetsGrid", TimesheetsGrid.GetFocusedRowIndex());
        if (IdRecord != null) {
            View.load("pcModalAddNewTimesheets", {
                dtEnd: TimeFromDate.GetText(),
                dtStart: "",
                columnid: s.cpColumnId,
                IdRecord: Number(IdRecord),
                isEdit: true
            });
        } else {
            Notification.SetNotification(window.SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
            }
        }
    };

    timesheets.InitTimesheetsGrid = function (s, e) {
        if (!AppV.GetGlobals().isMainWindow) {
            Planning.PerformPlanningHeightChanges("Timesheets");
        }
    };

    timesheets.EndCallbackTimesheetsGrid = function (s, e) {
        loadingPanel.Hide();
        if (_State.IsMove) {
            window["TimesheetsGrid"].SetFocusedRowIndex(_State.focused);
            _State.focused = 0;
        }
    };
    timesheets.btnSaveApprovalTimesheets = function (s, e) {
        AppV.PushStateTimesheetsHome({ "state": enums.TimeSheetState.APPROVED });
        Helper.ShowConfirmPopUp("SolidWorks", Helper.T("AreYouSure"),
            "Timesheets.btnSaveTimesheets(s,e,1)", "", "", "");
    };

    timesheets.btnSaveTimesheets = function (s, e, action) {
        var validate = action == 1 ? true : false;
        if (AppV.GetTimesheetsHomeState().isEdit) {
            AppV.PushStateTimesheetsHome({ "state": enums.TimeSheetState.DRAFT });
            AjaxStatus.FormSubmit(window.ActionToPerform.Save, 10, validate);
        } else {
            AppV.PushStateTimesheetsHome({ "state": enums.TimeSheetState.NEWTIMESHEET });
            AjaxStatus.FormSubmit(window.ActionToPerform.Save, 9, validate);
        }
    };
    timesheets.btnConfirmSaveTimesheets = function (response) {
        if (response.Success) {
            if (!AppV.GetTimesheetsHomeState().isEdit) {
                AppV.pushGlobalState({
                    "RecordId": response.CustomAttributes.workingObjectContext.RecordId,
                    "RecordGuid": response.CustomAttributes.workingObjectContext.RecordGuid
                });
                AppV.PushStateTimesheetsHome({ "isEdit": true });
            }
            Timesheets.BatchEdit();
        }
        Notification.SetNotification(response.Message, 'warning', 2500);
        loadingPanel.Hide();
    };

    timesheets.BatchEditConfirmShowingGrid = function (s, e) {
        e.cancel = true;
    };

    timesheets.BatchEdit = function () {
      if (Timesheets.CheckBatchEdit()) {
            window.TimesheetsGrid.UpdateEdit();
            if (!AppV.GetTimesheetsHomeState().isEdit) {
                CpbModalTimesheets.PerformCallback({
                    IdRecord: AppV.GetGlobals().RecordId,
                    UserId: AppV.GetTimesheetsHomeState().UserId,
                    isEdit: AppV.GetTimesheetsHomeState().isEdit,
                    showTasks: ShowTaskTimesheets.GetValue(),
                    batchEdit: true
                });
            }
            loadingPanel.Show();
        } else {
            Notification.SetNotification(window.SwResourceObject.PleaseEnterAValue, 'warning', 2500);
        }
    };
    timesheets.CheckBatchEdit = function () {
        if (window["TimesheetsGrid"] != undefined) {
            var validateRows = TimesheetsGrid.batchEditApi.ValidateRows();
            if (validateRows) {
                if (TimesheetsGrid.batchEditApi.GetUpdatedRowIndices().length != 0) { return true; }
                else { return false; }
            }
        }
        else { return false; }
    };

    timesheets.ToolbarClick = function (s, e) {
        switch (s.name) {
            case "AddNew":
                View.load("pcModalAddNewTimesheets", {
                    dtEnd: TimeFromDate.GetText(),
                    dtStart: "",
                    columnid: -1,
                    IdRecord: -1,
                    isEdit: false
                });
                break;
            case "DublicateLine":
                _InternalFunctions.AddRemoveLineTimesheets(_State.Action.Dublicate);
                break;
            case "Remove":
                Helper.ShowConfirmPopUp("SolidWorks", Helper.T("AreYouSureYouWantToRemoveSelectedItemS"),
                    "Timesheets.ConfirmAddRemoveLineTimesheets(2)", "", "", "");
                break;
            case "RemoveAll":
                Helper.ShowConfirmPopUp("SolidWorks", Helper.T("AreYouSureYouWantToRemoveAllItems"),
                    "Timesheets.ConfirmAddRemoveLineTimesheets(3)", "", "", "");
                break;
            case "MoveUp":
                _InternalFunctions.MoveLineTimesheets(s.name);
                break;
            case "MoveDown":
                _InternalFunctions.MoveLineTimesheets(s.name);
                break;
        }
    };
    timesheets.CheckedChangedShowTask = function (s, e) {
        _State.reload = true;
        _InternalFunctions.PerformCallbackTimesheets();
    };
    timesheets.CmbProjectTypeSelectedIndexChanged = function (s, e) {
        CmbProject.SetEnabled(true);
        CpbProject.PerformCallback({
            isCallback: true,
            projectOid: Number(CmbProjectType.GetValue()),
            dtEnd: TimeFromDate.GetText(),
            dtStart: ""
        });
    };
    timesheets.CmbProjectSelectedIndexChanged = function (s, e) {
        CmbProjectStage.SetEnabled(true);
        CpbProjectsStage.PerformCallback({
            isCallback: true,
            projectOid: Number(CmbProjectType.GetValue()),
            recordGuid: CmbProject.GetValue(),
            dtEnd: TimeFromDate.GetText(),
            dtStart: ""
        });
    };
    timesheets.btnApplyNewTimesheets = function (s, e) {
        var projectType = CmbProjectType.GetValue();
        var project = CmbProject.GetValue();
        var projectStage = CmbProjectStage.GetValue();
        if (projectType == null) {
            Notification.SetNotification(window.SwResourceObject.PleaseSelectType, 'warning', 2500);
            return;
        }
        if (project == null) {
            Notification.SetNotification(window.SwResourceObject.PleaseSelectAProject, 'warning', 2500);
            return;
        }
        if (projectStage == null) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem + " " + SwResourceObject.ProjectStage, 'warning', 2500);
            return;
        }
        var IdRecord = AppV.GetTimesheetsHomeState().isEdit === true ? AppV.GetGlobals().RecordId : -1;
        Request.ajax({
            type: "POST",
            url: '/Timesheets/AddNewTimesheets/',
            data: {
                projectOid: Number(projectType),
                recordGuid: project,
                stageId: Number(projectStage),
                IdRecord: IdRecord,
                project: CmbProject.GetText(),
                dtEnd: TimeFromDate.GetText(),
                dtStart: "",
                UserId: AppV.GetTimesheetsHomeState().UserId,
                isEdit: AppV.GetTimesheetsHomeState().isEdit,
                showTasks: ShowTaskTimesheets.GetValue()
            },
            dataType: "json"
        }).then(function (response) {
            var responseData = JSON.parse(response.data);
            if (!responseData.Success) {
                _State.reload = false;
                _InternalFunctions.PerformCallbackTimesheets();
            }
            else {
                pcModalAddNewTimesheets.Hide();
                _State.reload = false;
                _InternalFunctions.PerformCallbackTimesheets(false);
            }
        });
    };
    timesheets.ConfirmAddRemoveLineTimesheets = function (action) {
        _InternalFunctions.AddRemoveLineTimesheets(action);
    };

    timesheets.timesheetsReportClick = function (s, e) {
        var timesheetsReport = CmbTimesheetsReport.GetValue();
        if (timesheetsReport == null) {
            Notification.SetNotification(window.SwResourceObject.PleaseSelectAnItem, 'warning', 2500);
            return;
        }

        Reports.OpenDocumentPreview(timesheetsReport);
    };

    window.Timesheets = timesheets;
})();
;
var RzReferencedField = (function () {

    var referenceSenderName;

    var _Internalfunctions = {
        OpenRecord: function (gridName) {
            var selectedRow = Helper.FilterGridSelectedKeysOnPage(gridName, "idRecord")[0];

            if (selectedRow !== undefined && selectedRow !== null) {

                var value = selectedRow.UrlEncrypted;

                if (!Helper.IsEmpty("", value)) {
                    Helper.open('/PropertyCard/Index/' + value, '_blank');
                }
                else {
                    Notification.SetNotification(SwResourceObject.ChooseARecord, 'warning', 3500);
                }
            } else {
                Notification.SetNotification(SwResourceObject.ChooseARecord, 'warning', 3500);
            }
            return;
        },

        NewFrom: function (gridName) {
            var selectedRow = Helper.FilterGridSelectedKeysOnPage(gridName, "idRecord")[0];

            if (selectedRow !== undefined && selectedRow !== null) {
                
                Request.ajax({
                    type: "POST",
                    url: '/ReferencedField/NewFrom/',
                    data: {
                        refObjectId: window[gridName].cpReferenceObjectId,
                        idRecord: selectedRow.idRecord,
                        objectType: window[gridName].cpObjectType,
                        groupObjId: selectedRow.GroupObjectId
                    },
                    dataType: "json"
                }).then(function (response) {

                    var result = response.data;

                    if (result.Success) {
                        
                        //open NewFrom popup
                        FieldVaildation.SetnewFrom(true);
                        View.load("NewFrom",
                            {
                                objectId: window[gridName].cpReferenceObjectId,
                                recordID: selectedRow.idRecord,
                                recordGuid: selectedRow.RecordGuid,
                                SubObjectGuid: selectedRow.SubObjectGuid,
                                isPreviewMode: false,
                                hasEditRights: true,
                                keepNbs: false
                            });

                    } else {
                        Notification.SetNotification(Helper.T(result.Message), 'warning', 3500);
                    }

                }).then(function () { window.loadingPanel.Hide(); });
               
            } else {
                Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            }
        }
    };

    return {
        Default: {
            OnInit: function (s, e) {
                var gridName = "ReferencedFieldGrid" + AppV.GetPropertyTabsState().ReferencedField.ObjectFieldPropertyTabId;

                var referencedGrid = window[gridName];

                if (typeof referencedGrid != 'undefined') {

                    if (window["mainSplFullScreenMode"] == undefined) {
                        referencedGrid.SetHeight(PropertyCardSection.GetHeight() - 50);
                    }
                    else {
                        referencedGrid.SetHeight(mainSplFullScreenMode.GetPaneByName("mainSplPropertyPanel").lastHeight - 80);
                    }
                }

            },

            EndCallback: function (s, e) {
                if (AppV.GetGlobals().isMainWindow) {
                    RzReferencedField.Default.OnInit();
                }

                document.getElementById(s.name + '_DXSearchPanel').style.display =
                    (AppV.GetReferencedFieldState().PanelSearchShow) ? "" : "none";

                document.getElementById(s.name + '_DXFilterRow').style.display =
                    (AppV.GetReferencedFieldState().RowFilterShow) ? "" : "none";

                window[s.name].AdjustControl();
            },

            GetReferencedFieldGrid : function (s, e) {
                if (!AppV.GetGlobals().isMainWindow) {
                    Helper.closeBroadcast('referencedField');
                }
                window.App.PropertyCard.Callback.ReferencedField(AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordId, true);
            }
        },

        Menu: {
            Filter: function () {
                var gridName = "ReferencedFieldGrid" + AppV.GetPropertyTabsState().ReferencedField.ObjectFieldPropertyTabId;

                var filterRow = document.getElementById(gridName + '_DXFilterRow');
                if (filterRow.style.display === "none") {
                    filterRow.style.display = null;
                    AppV.PushStateReferencedField("RowFilterShow", true);
                } else {
                    AppV.PushStateReferencedField("RowFilterShow", false);
                    filterRow.style.display = "none";
                }
                window[gridName].AdjustControl();
            },

            Find: function () {
                //Helper.HideShowSearchBar(s, e);
                var gridName = "ReferencedFieldGrid" + AppV.GetPropertyTabsState().ReferencedField.ObjectFieldPropertyTabId;
                var searchBar = document.getElementById(gridName + '_DXSearchPanel');
                if (searchBar.style.display === "none") {
                    AppV.PushStateReferencedField("PanelSearchShow", true);
                    searchBar.style.display = "block";
                } else {
                    AppV.PushStateReferencedField("PanelSearchShow", false);
                    searchBar.style.display = "none";
                }
                window[gridName].AdjustControl();
            }
        },

        ContextMenu: {

            Display: function (s, e) {
                if (e.objectType === "row" || e.objectType === "emptyrow") {
                    s.SetFocusedRowIndex(e.index);
                    var x = ASPxClientUtils.GetEventX(e.htmlEvent);
                    var y = ASPxClientUtils.GetEventY(e.htmlEvent);
                    referenceSenderName = s.name;
                    setTimeout(function () {
                        var gridName = "ReferencedFieldGrid" + AppV.GetPropertyTabsState().ReferencedField.ObjectFieldPropertyTabId;
                        var contextMenuName = "CtxReferencedFieldGrid" + AppV.GetPropertyTabsState().ReferencedField.ObjectFieldPropertyTabId;

                        window[contextMenuName].ShowAtPos(x, y);
                        
                        if (window[gridName].cpObjectType === enums.ObjectTypes.Processes ||
                            window[gridName].cpObjectType === enums.ObjectTypes.CustomCases ||
                            window[gridName].cpObjectType === enums.ObjectTypes.ProjectsOLD1 ||
                            window[gridName].cpObjectType === enums.ObjectTypes.ProjectsNEW ||
                            window[gridName].cpObjectType === enums.ObjectTypes.ProjectsOLD2) {
                            window[contextMenuName].GetItemByName("NewFrom").SetEnabled(false);
                        } else if (window[gridName].cpObjectType === enums.ObjectTypes.TimeSheet) {
                            window[contextMenuName].GetItemByName("New").SetEnabled(false);
                            window[contextMenuName].GetItemByName("NewFrom").SetEnabled(false);
                        } else if (window[gridName].cpObjectType === enums.ObjectTypes.TimeSheetItem) {
                            window[contextMenuName].GetItemByName("New").SetEnabled(false);
                            window[contextMenuName].GetItemByName("NewFrom").SetEnabled(false);
                            window[contextMenuName].GetItemByName("OpenRecord").SetEnabled(false);
                        } else {
                            window[contextMenuName].GetItemByName("New").SetEnabled(true);
                            window[contextMenuName].GetItemByName("NewFrom").SetEnabled(true);
                            window[contextMenuName].GetItemByName("OpenRecord").SetEnabled(true);
                        }
                    }, 10);
                }
            },
            DisplayReferencedFromButtonContextMenu: function () {
                var gridName = "ReferencedFieldGrid" + AppV.GetPropertyTabsState().ReferencedField.ObjectFieldPropertyTabId;
                var s = {};
                var e = {};
                s = window[gridName];
                window[gridName].pageRowCount === 0 ? e.objectType = "emptyrow" : e.objectType = "row";
                e.index = window[gridName].GetFocusedRowIndex();
                var idMenuButton = "#MainReferencedFieldGridMenuButton" + AppV.GetPropertyTabsState().ReferencedField.ObjectFieldPropertyTabId;
                var offset = $(idMenuButton).offset();
                e.htmlEvent = { clientX: offset.left, clientY: offset.top };
                try {
                    RzReferencedField.ContextMenu.Display(s, e);
                } catch (e) {
                    console.log(e);
                }
            },
            ItemClick: function (s, e) {
                switch (e.item.name) {

                    case "OpenRecord":
                        var gridName = "ReferencedFieldGrid" + AppV.GetPropertyTabsState().ReferencedField.ObjectFieldPropertyTabId;
                        _Internalfunctions.OpenRecord(gridName);
                        break;

                    case "New":
                        var grid = "ReferencedFieldGrid" + AppV.GetPropertyTabsState().ReferencedField.ObjectFieldPropertyTabId;

                        Request.ajax({
                            type: "POST",
                            url: '/ReferencedField/GetNewUrl/',
                            data: {
                                refObjectId: window[grid].cpReferenceObjectId,
                                objectId: window[grid].cpObjectId,
                                recordId: window[grid].cpRecordId,
                                objectType: window[grid].cpObjectType,
                                refColumnId: window[grid].cpRefColumnId
                            },
                            dataType: "json"
                        }).then(function (response) {
                            
                            if (response.success) {
                                broadcastV.create({ endPoint: "ReferencedField" });
                                Helper.open('/PropertyCard/AddNew/' + response.addNewUrl, '_blank');
                                
                            } else {
                                Notification.SetNotification(Helper.T(response.message), 'warning', 3500);
                            }

                        }).then(function () { window.loadingPanel.Hide(); });
                        break;

                    case "NewFrom":
                        var gridN = "ReferencedFieldGrid" + AppV.GetPropertyTabsState().ReferencedField.ObjectFieldPropertyTabId;
                        _Internalfunctions.NewFrom(gridN);
                        break;

                    case "exportListToExcel":
                        App.Exporting = true;
                        window[referenceSenderName].ExportTo(ASPxClientGridViewExportFormat.Xlsx);
                        break;

                    case "Refresh":
                        window[referenceSenderName].PerformCallback({
                            shouldReload: true
                        });
                        break;
                }
            }
        }
    };
})();;
(function () {
    var email = {};

    email.GetFolderId = function () {
        var FolderId = window.EmailFolderListRecords.GetFocusedNodeKey();
        if (FolderId === null || FolderId === "" || FolderId === 0 || FolderId === "undefined") {
            return -1;
        }
        return FolderId;
    };
    email.emailSelected = function () {
        var emailSelected = [];
         emailSelected = Helper.FilterGridSelectedKeysOnPage("EmailGrid", "EmailId");
        if (typeof (emailSelected) === 'undefined' || emailSelected === null || emailSelected.length < 1 || emailSelected === -1) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, enums.NotificationStatus.Warning, 3500);
            return;
        }
        return emailSelected;
    };
    email.GetSelectedEmailIds = function () {
        var EmailIds = [];
        var emailSelected = email.emailSelected();
        emailSelected.forEach(function (entry) {
            if (entry.Access === 1) {
                EmailIds.push(entry.EmailId);
            }
        });
        if (EmailIds.length === 0) {
            Notification.SetNotification(SwResourceObject.YouDoNotHavePermission, 'warning', 3500);
            return;
        }
        return EmailIds;
    };

    email.PerformCallback = function (FolderId) {
        EmailGrid.PerformCallback({
            objectId: AppV.GetGlobals().ObjectId,
            folderId: FolderId,
            recordId: AppV.GetGlobals().RecordId,
            reload: true
        });
    };

    email.OnShowCtxMenuEmail = function (s, e) {
        if (e.objectType === "row" || e.objectType === "emptyrow") {
            s.SetFocusedRowIndex(e.index);
            var x = ASPxClientUtils.GetEventX(e.htmlEvent);
            var y = ASPxClientUtils.GetEventY(e.htmlEvent);
            setTimeout(function () {
                if (AppV.GetGlobals().isMainWindow) {
                    CtxEmailGrid.GetItemByName("emailMove").SetEnabled(false);
                    CtxEmailGrid.GetItemByName("emailDelete").SetEnabled(false);
                }
                window.CtxEmailGrid.ShowAtPos(x, y);
            }, 10);
        }
    };

    email.DisplayFromButtonContextMenu = function () {
        var s = {};
        s = window["EmailGrid"];
        var e = {};
        window["EmailGrid"].pageRowCount === 0 ? e.objectType = "emptyrow" : e.objectType = "row";
        e.index = window["EmailGrid"].GetFocusedRowIndex();
        var offset = $("#MainEmailGridMenuButton").offset();
        e.htmlEvent = { clientX: offset.left, clientY: offset.top };
        try {
            Email.OnShowCtxMenuEmail(s, e);
        } catch (e) {
            console.log(e);
        }
    };

    email.ContextMenuItemClick = function (s, e) {
        switch (e.item.name) {
            case "emailOpenRecord":
                break;
            case "emailMove":
                email.GetMovePopUpCallBack();
                break;
            case "emailDelete":
                email.ShowDeletedConfirmation();
                break;
            case "emailExportListToExcel":
                email.ExportGridToExcel();
                break;
            case "emailRefresh":
                email.RefreshGrid();
                break;
        }
    };

    email.OnNodeClickEmail = function (e) {
        var FolderId = e.nodeKey;
        if (FolderId === null || FolderId === "") {
            Notification.SetNotification(SwResourceObject.PleaseSelectAFolder, 'warning', 3500);
            return;
        }
        email.PerformCallback(FolderId);
    };

    email.CallBackGrid = function (e) {
        e.customArgs["objectId"] = AppV.GetGlobals().ObjectId;
        e.customArgs["folderId"] = email.GetFolderId();
        e.customArgs["recordId"] = AppV.GetGlobals().RecordId;
    };

    email.HideFindPanel = function (s) {
        var searchBar = document.getElementById(s.name + '_DXSE');
        var searchButton = document.getElementById(s.name + '_DXCBtn0');
        var clearButton = document.getElementById(s.name + '_DXCBtn1');

        var canShowSearchBar = Helper.GetCookie(s.name + '_Cookie');

        if (canShowSearchBar === null || canShowSearchBar === 'undefined' || canShowSearchBar !== 'true') {
            searchBar.style.display = "none";
            searchButton.style.display = "none";
            clearButton.style.display = "none";
        } else {
            searchBar.style.display = "block";
            searchButton.style.display = "block";
            clearButton.style.display = "block";
        }
        Email.DeactivateButons();
    };
    email.ShowFindPanel = function (s) {
        var searchBar = document.getElementById(s.name + '_DXSE');
        var searchButton = document.getElementById(s.name + '_DXCBtn0');
        var clearButton = document.getElementById(s.name + '_DXCBtn1');
        if (searchBar.style.display === "none" && searchButton.style.display === "none" && clearButton.style.display === "none") {
            searchBar.style.display = "block";
            searchButton.style.display = "block";
            clearButton.style.display = "block";
            Helper.CreateCookie(s.name + '_Cookie', true);
        }
        else {
            searchBar.style.display = "none";
            searchButton.style.display = "none";
            clearButton.style.display = "none";
            Helper.CreateCookie(s.name + '_Cookie', false);
        }
    };
    email.DeactivateButons = function () {
        if (AppV.GetGlobals().isMainWindow) {
            btnEmailDelete.SetEnabled(false);
            btnEmailMove.SetEnabled(false);
        }
    };

    email.ExportGridToExcel = function () {
        if (email.GetFolderId() !==-1) {
            App.Exporting = true;
            window["EmailGrid"].ExportTo(ASPxClientGridViewExportFormat.Xlsx);
        }
        else {
            return;
        }
    };

    email.GetMovePopUpCallBack = function () {
        if (email.emailSelected()) {
            View.load("emailMovePopup",
                {
                    objectId: AppV.GetGlobals().ObjectId
                });
        }
    };
    email.PerformMoveAction = function myfunction(s, e) {
        var EmailIds = email.GetSelectedEmailIds();

        var FolderId = window.EmailMoveFolderList.GetFocusedNodeKey();
        if (FolderId === null || FolderId === "") {
            Notification.SetNotification(SwResourceObject.PleaseSelectAFolder, 'warning', 3500);
            return;
        }

        var LastFolderId = [];
        var LastFId = [];
        var emailSelected = Helper.FilterGridSelectedKeysOnPage("EmailGrid", "EmailId");
        if (typeof (emailSelected) === 'undefined' || emailSelected === null || emailSelected.length < 1 || emailSelected === -1) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, enums.NotificationStatus.Warning, 3500);
            return;
        }
        emailSelected.forEach(function (entry) {
            if (entry.Access === 1) {
                LastFolderId.push(entry.EmailFolderId);
            }
        });
        if (LastFolderId.length === 0) {
            Notification.SetNotification(SwResourceObject.YouDoNotHavePermission, 'warning', 3500);
            return;
        }
        else {
            LastFolderId.forEach(function (element) {
                if (element === FolderId) {
                    Notification.SetNotification(SwResourceObject.PleaseSelectADifferentFolder, 'warning', 3500);
                }
                else {
                    LastFId.push(element);
                }
            });
        }
        if (LastFId.length === 0) {
            return;
        }
        else {
            $.ajax({
                url: '/Email/EmailsMove',
                type: "POST",
                data: {
                    objectId: AppV.GetGlobals().ObjectId,
                    lastFolderId: LastFId,
                    folderId: FolderId,
                    recordId: AppV.GetGlobals().RecordId,
                    emailIds: EmailIds
                },
                success: function (response) {
                    var res = JSON.parse(response.data);
                    if (res.Success) {
                        email.RefreshGrid();
                    }
                    else {
                        Notification.SetNotification(SwResourceObject.FailedToApplyChanges, 'warning', 3500);
                    }
                    pcModalMoveEmail.Hide();
                },
                error: function (response) {
                    window.loadingPanel.Hide();
                }
            });
            pcModalMoveEmail.Hide();
        }
    };

    email.ShowDeletedConfirmation = function () {
        if (email.emailSelected()) {
            Helper.ShowConfirmPopUp("SolidWorks", SwResourceObject.AreYouSure, "Email.PerformDeleteAction()");
        }
    };
    email.PerformDeleteAction = function myfunction() {
        var FolderId = email.GetFolderId();

        var EmailIds = email.GetSelectedEmailIds();

        $.ajax({
            url: '/Email/EmailsDelete',
            type: "POST",
            data: {
                objectId: AppV.GetGlobals().ObjectId,
                folderId: FolderId,
                recordId: AppV.GetGlobals().RecordId,
                emailIds: EmailIds
            },
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    email.RefreshGrid();
                }
                else {
                    Notification.SetNotification(SwResourceObject.FailedToApplyChanges, 'warning', 3500);
                }
            },
            error: function (response) {
                window.loadingPanel.Hide();
            }
        });
    };

    email.RefreshGrid = function () {
        var FolderId = email.GetFolderId();
        email.PerformCallback(FolderId);
    };

    window.Email = email;
})();;
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1;};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p;}('(F(a,c,b){if(33 ia!="1M"){ia.l6=b()}1b{if(33 es=="F"&&33 es.l3=="hW"){es(a,c,b)}1b{o[a]=b()}}}("I.l4",[],F(){z dc={5i:F(7w){aI.5i(7w)},1X:F(1l,2V,1N,5O){if(1N=="57"){1N=5G.iP.57}if(5G.al&&5G.al[2V]){5G.al[2V]=1E}1b{if(5z.al&&5z.al[2V]){5z.al[2V]=1E}}z aW=[2V];if(1N!==1M){aW.1h(1N);if(5O){if(33 5O=="2p"){a4{5O=dr(5O);aW.1h(5O)}aj(iG){}}1b{aW.1h(5O)}}}aI.1q.1X.1T(1l,aW)},9Z:F(1g){5G.iO.9Z(1g)},5u:F(1l,1g,45){1l.5u(1g,45)},7I:F(1l,1g,2n,45){G 1l.7I(1g,2n,45)},9F:F(1l,1g){G 1l.9F(1g)},cP:F(2V){G aI.8Y(2V)},cD:F(1l,1N){G 1l.cD(1N)},aS:F(1l,af,5m,d5,13){G 5G.7n.7d(1l,af,5m,d5,13)},9h:F(id,4U){G 5G.iO.l7(id,4U)},bg:F(1g,2k,38){1g.3r.bg(2k,38)},bn:F(1g,2k){G 1g.3r.bn(2k)},8I:F(1g,2k,38){if(!1g){G}if(1g.3r){1g.3r.8I(2k,38)}1b{if(1g.la){$8I(1g,2k,38)}}},b7:F(){G O 5G.hL()},8H:F(13,5m,fq,fp){$8H(13,5m)},cm:F(13){$cm(13)},4Y:F(1g,4B){G 8Z.4Y(1g,4B)},bz:F(4B,H){G 8Z.bz(4B,H)},2N:F(13){z J=5G.iP.lb.2N(13);G O I.14.1n(J.x,J.y,J.P,J.V)},5Z:F(4n){G 5G.iQ.iL.l8(4n)},ak:F(1g){G 5G.iQ.iL.l9(1g)},ft:F(6D,6g,2O,ac){z 3X=O gf();2E=6D;3X.jl=F(){if(3X.jb==4&&3X.eA==c0){z a8=1L.5Z(1L.5Z(3X.ez).d);ac.1T(6D,[a8])}};3X.gq("fl",6g);3X.j1("j2-aI","ff/4n; fg=fd-8");3X.e3(2O)}};z iY={5i:F(7w){z 8a=5z;z 9c=7w.1V(".");1i(z i=0;i<9c.W;i++){z 3l=9c[i];z ns=8a[3l];if(!ns){ns=8a[3l]={}}8a=ns}},1X:F(1l,2V,1N,5O){if(1N=="57"){1N=I.as.57}1l.1q.5n=1l;1l.4X=2V;if(1N){1l.4x=1N;1i(z 7B in 1N.1q){z dl=1N.1q[7B];if(!1l.1q[7B]){1l.1q[7B]=dl}}}},9Z:F(1g){$(5z).on("iy",F(){1g.8M()})},5u:F(1l,1g,45){z 1N=1l.4x;if(1N){if(!45){1N.1T(1g)}1b{1N.1T(1g,45)}}},7I:F(1l,1g,2n,45){z 1N=1l.4x;if(1N){z 7V=1N.1q[2n];if(7V){if(!45){G 7V.1T(1g)}1b{G 7V.1T(1g,45)}}}},9F:F(1l,1g){if(!1g){G 1E}if(1g 6d 1l){G 1Q}z 1N=1g.5n.4x;3z(1N){if(1N===1l){G 1Q}1N=1N.4x}G 1E},cP:F(2V){if(!2V){G 1c}z fn=dr(2V);if(33(fn)=="F"){G fn}},cD:F(1l,1N){z 6j=1l.4x;3z(6j){if(6j===1N){G 1Q}6j=6j.4x}G 1E},aS:F(1l,af,5m,d5,13){z 4R=O 1l(13,af);4R.am=13;o.9Z(4R);$(13).2O("I",4R);4R.9j();G 4R},9h:F(id,4U){z 13;if(4U){13=$(4U).9U("#"+id)}1b{13=$("#"+id)}if(13){G 13.2O("I")}G 1c},7Y:F(1g,2k,7d){if(1g.3r[2k]==1M){if(!7d){G 1c}1g.3r[2k]=[]}G 1g.3r[2k]},bg:F(1g,2k,38){if(!1g.3r){1g.3r=o.b7()}z d4=o.7Y(1g,2k,1Q);d4.1h(38)},bn:F(1g,2k){z 3H=o.7Y(1g,2k);if(!3H||(3H.W===0)){G 1c}G F(cJ,35){z i=3H.W;3z(i--){3H[i](cJ,35)}}},8I:F(1g,2k,38){if(!1g){G}if(1g.3r){z 3H=o.7Y(1g,2k);if(!3H){G}z 2g=3H.2u(38);if(2g>-1){3H.5Q(2g,1)}}1b{$(1g).iM(2k,38)}},b7:F(){G O I.2h.3J()},8H:F(13,5m,fq,fp){1i(z e in 5m){$(13).kU(e,5m[e])}},cm:F(13){$(13).iM()},4Y:F(1g,4B){G $.e6(4B,1g)},bz:F(4B,H){G F(){z l=3S.W;if(l>0){z 35=[];1i(z i=0;i<l;i++){35[i]=3S[i]}35[l]=H;G $.e6(4B.1T(o,35),H)}G $.e6(4B,H)}},2N:F(13){z bs=$(13).bb();z iN=$.fn.kV;z 5M=iN.1V(".");if((5M[0]==1&&5M[1]<9)){z iW=iR($.iV(3p.8B,"kT"))||0;z iX=iR($.iV(3p.8B,"kZ"))||0;bs.1F+=iW;bs.1z+=iX}G O I.14.1n(bs.1z,bs.1F,$(13).P(),$(13).V())},5Z:F(4n){if(5p){G 5p.8Y(4n)}1b{6F O 6I("5p is 1M.")}},ak:F(1g){if(5p){G 5p.jm(1g)}1b{6F O 6I("5p is 1M.")}},ft:F(6D,6g,2O,ac){$.kX({1l:"fl",6g:6g,2O:2O,kY:"ff/4n; fg=fd-8",ld:"4n",H:6D,lq:F(2O){z a8=1L.5Z(2O.d);ac.1T(o,[a8])},iK:F(){lr("lo iK")}})}};z iZ={5i:F(7w){z 8a=5z;z 9c=7w.1V(".");1i(z i=0;i<9c.W;i++){z 3l=9c[i];z ns=8a[3l];if(!ns){ns=8a[3l]={}}8a=ns}},1X:F(1l,2V,1N,5O){if(1N=="57"){1N=I.as.57}1l.1q.5n=1l;1l.4X=2V;if(1N){1l.4x=1N;1i(z 7B in 1N.1q){z dl=1N.1q[7B];if(!1l.1q[7B]){1l.1q[7B]=dl}}}},9Z:F(1g){5z.a7("iy",F(){1g.8M()})},5u:F(1l,1g,45){z 1N=1l.4x;if(1N){if(!45){1N.1T(1g)}1b{1N.1T(1g,45)}}},7I:F(1l,1g,2n,45){z 1N=1l.4x;if(1N){z 7V=1N.1q[2n];if(7V){if(!45){G 7V.1T(1g)}1b{G 7V.1T(1g,45)}}}},9F:F(1l,1g){if(!1g){G 1E}if(1g 6d 1l){G 1Q}z 1N=1g.5n.4x;3z(1N){if(1N===1l){G 1Q}1N=1N.4x}G 1E},cP:F(2V){if(!2V){G 1c}z fn=dr(2V);if(33(fn)=="F"){G fn}},cD:F(1l,1N){z 6j=1l.4x;3z(6j){if(6j===1N){G 1Q}6j=6j.4x}G 1E},aS:F(1l,af,5m,d5,13){if(!o.di){o.di=O I.2h.3J()}z 4R=O 1l(13,af);4R.am=13;o.9Z(4R);o.di.61(13.id,4R);4R.9j();G 4R},9h:F(id,4U){z 13=3p.bU(id);if(13){a4{z 4R=o.di.5k(13.id);G 4R}aj(iG){G 1c}}G 1c},7Y:F(1g,2k,7d){if(1g.3r[2k]==1M){if(!7d){G 1c}1g.3r[2k]=[]}G 1g.3r[2k]},bg:F(1g,2k,38){if(!1g.3r){1g.3r=o.b7()}z d4=o.7Y(1g,2k,1Q);d4.1h(38)},bn:F(1g,2k){z 3H=o.7Y(1g,2k);if(!3H||(3H.W===0)){G 1c}G F(cJ,35){z i=3H.W;3z(i--){3H[i](cJ,35)}}},8I:F(1g,2k,38){if(!1g){G}if(1g.3r){z 3H=o.7Y(1g,2k);if(!3H){G}z 2g=3H.2u(38);if(2g>-1){3H.5Q(2g,1)}}1b{1g.jd(2k,38)}},b7:F(){G O I.2h.3J()},8H:F(13,5m,fq,fp){1i(z e in 5m){13.a7(e,5m[e])}},cm:F(13){1i(z e in 13.3r){13.jd(13.3r[e],13.3r[e])}},4Y:F(1g,4B){z je=F(){G 4B.1T(1g,3S)};G je},bz:F(4B,H){z 2E=o;G F(){z l=3S.W;if(l>0){z 35=[];1i(z i=0;i<l;i++){35[i]=3S[i]}35[l]=H;G 2E.4Y(H,4B.1T(o,35))}G 2E.4Y(H,4B)}},2N:F(13){z K=13.eh();z 9C=13.ji.9C;z fo=13.ji.8B;z x=S.8z(K.1z)+(9C.3o||fo.3o);z y=S.8z(K.1F)+(9C.2W||fo.2W);G O I.14.1n(x,y,K.P,K.V)},5Z:F(4n){if(5p){G 5p.8Y(4n)}1b{6F O 6I("5p is 1M.")}},ak:F(1g){if(5p){G 5p.jm(1g)}1b{6F O 6I("5p is 1M.")}},ft:F(6D,6g,2O,ac){z 3X=O gf();2E=6D;3X.jl=F(){if(3X.jb==4&&3X.eA==c0){z a8=1L.5Z(1L.5Z(3X.ez).d);ac.1T(6D,[a8])}};3X.gq("fl",6g);3X.j1("j2-aI","ff/4n; fg=fd-8");3X.e3(2O)}};if(33 $1m=="1M"){$1m={}}if(33 5Y=="1M"){5Y="j3"}z fH=F(d8){1i(z f in dc){if(dc[f]6d 8Z){if(d8[f]==1M||!(d8[f]6d 8Z)){6F O 6I("lu lh d8 li fs le lg lm "+f)}}}G 1Q};if(5Y=="ln"){1L=dc}1b{if(5Y=="j3"){1L=iY}1b{if(5Y=="ll"){1L=iZ}1b{if(5Y 6d cV){if(fH(5Y)){1L=5Y}}1b{if(33 5Y=="2p"){z fE=dr(5Y);if(fH(fE)){1L=fE}}}}}}1L.5i("I");I.cF=1L;I.5i=F(7w){I.cF.5i(7w)};I.1X=F(1l,2V,1N,5O){I.cF.1X(1l,2V,1N,5O)};I.dX=F(id){G I.cF.9h(id)};I.5i("I.as");(F(j9){z 57=j9.57=F(13){o.am=13};57.1q={8M:F(){},2S:F(){G o.am}};I.1X(57,"I.as.57")})(I.as);if(!I.59||!I.59.4X){I.59=F(){1L.5u(I.59,o)};I.59.1q={};I.1X(I.59,"I.59");I.59.gj=O I.59()}if(!I.8K||!I.8K.4X){I.8K=F(){1L.5u(I.8K,o)};I.8K.1q={kA:F(){G o.ja},kC:F(T){o.ja=T}};I.1X(I.8K,"I.8K",I.59)}if(!I.5q||!I.5q.4X){I.5q=F(bx,cO,1g){1L.5u(I.5q,o);o.bx=bx;o.cO=cO;o.1g=1g;o.j5()};I.5q.1q={j5:F(){z 9N=cV.8S(o.bx);9N=9N.d9(F(2G){G I.5q.hR(9N,2G)});z kK={};1i(z 1A in 9N){z 2n=9N[1A].1V("5k")[1];z 4J=2n.5t(0).aT()+2n.6t(1);z 9E="z ae = \'"+4J+"\' + \'ad\'; z ab = \'"+4J+"\' + \'8X\'; z 9d = \'61\' + \'"+2n+"\'; o[ae] = T; o[ab] = 1Q; if (o.1g != 1c) 	o.1g[9d](T); G o;";o[4J]=O 8Z("T",9E);if(4J=="1R"){9E="z ae = \'"+4J+"\' + \'ad\'; z ab = \'"+4J+"\' + \'8X\'; z 9d = \'61\' + \'"+2n+"\'; if (3S.W == 2) { T = O I.14.4Q(2n, 1G); }1b T = 3S[0]; o[ae] = T; o[ab] = 1Q; if (o.1g != 1c) 	o.1g[9d](T); G o;";o[4J]=O 8Z("2n","1G",9E)}if(4J=="1p"){9E="z ae = \'"+4J+"\' + \'ad\'; z ab = \'"+4J+"\' + \'8X\'; z 9d = \'61\' + \'"+2n+"\'; if (3S.W == 3) { T = {1l:\'79\', 4d:4d, 4c: 4c, 1B:fx};}1b if (3S.W == 4) { T = {1l:\'jy\', 4d:4d, 4c: 4c, aU: fx, aQ: hP};}1b T = 3S[0]; o[ae] = T; o[ab] = 1Q; if (o.1g != 1c) 	o.1g[9d](T); G o;";o[4J]=O 8Z("4d","4c","fx","hP",9E)}}},7d:F(){z 2V=o.bx.6W();z 1l=1L.cP(2V);if(!1l){G 1c}z 2B=O 1l(o.cO);z 5h=cV.8S(o);5h=5h.d9(F(2G){G I.5q.fB(5h,2G)});1i(z 1A in 5h){z 2n=5h[1A].1V("8X")[0];z T=o[2n+"ad"];z 3b="61"+2n.5t(0).bG()+2n.6t(1);if(2B[3b]){2B[3b](T)}}G 2B},kG:F(1g){o.1g=1g;z 5h=cV.8S(o);5h=5h.d9(F(2G){G I.5q.fB(5h,2G)});1i(z 1A in 5h){z 2n=5h[1A].1V("8X")[0];hQ o[5h[1A]];hQ o[2n+"ad"]}}};I.5q.hR=F(cE,2G){if(2G.2u("5k")!==0){G 1E}z 2n=2G.1V("5k")[1];z hM="61"+2n;G cE.2u(hM)>-1};I.5q.fB=F(cE,2G){if(2G.2u("8X")==-1){G 1E}z 2n=2G.1V("8X")[0];z 4J=2n+"ad";G cE.2u(4J)>-1};I.1X(I.5q,"I.5q")}I.5i("I.2h");(F(3c){z 2f=3c.2f=F(){z 2i=O bh();z 6f=3c.6f;2i.2u=6f.2u;2i.5L=6f.5L;2i.5W=6f.5W;2i.eR=6f.eR;2i.aR=6f.aR;2i.41=6f.41;2i.eS=6f.eS;G 2i};2f.2u=F(2i,13){G 2i.2u(13)};2f.4s=F(2i,13){2i.1h(13)};2f.kN=F(2i,2g,13){2i.5Q(2g,0,13)};2f.5L=F(2i,13){z 2g=2i.2u(13);if(2g>-1){2i.5Q(2g,1);G 1Q}G 1E};2f.kL=F(2i,2g){if(2g>-1){2i.5Q(2g,1);G 1Q}G 1E};2f.5W=F(2i,13){G 2i.2u(13)>-1};2f.41=F(2i,3b,1g){1i(z i=0,l=2i.W;i<l;i++){z 13=2i[i];if(33(13)!=="1M"){3b.7b(1g,13,i,2i)}}};2f.3a=F(2i){G 2i.6t(0)};2f.kM=F(2i,fC){1i(z i=0,l=fC.W;i<l;i++){2i.1h(fC[i])}}})(I.2h);(F(3c){z 3J=3c.3J=F(){o.3M=O 3c.3A()};3J.1q.61=F(1A,T){z 27=o.3M.5k(1A);if(27==1c){27=o.3M.4s(1A)}27.T=T};3J.1q.5k=F(1A){z 27=o.3M.5k(1A);if(27!=1c){G 27.T}6F O 6I("kI dX 1A "+1A)};3J.1q.5W=F(1A){G o.3M.5W(1A)};3J.1q.5L=F(1A){G o.3M.5L(1A)};3J.1q.hB=F(){G o.3M.be};3J.1q.41=F(3b,48){o.3M.41(F(27){3b.7b(48,27.1A,27.T)})};3J.1q.kJ=F(3b,48){o.3M.41(F(27){3b.7b(48,27.T)})};3J.1q.hN=F(3b,48){o.3M.41(F(27){3b.7b(48,27.1A)})};3J.1q.8S=F(){z 8S=O bh();o.hN(F(1A){8S.1h(1A)});G 8S};I.1X(3J,"I.2h.3J")})(I.2h);(F(3c){z 9S=3c.9S=F(4g,58){o.hO();if(4g>0&&58>0){o.a6(4g,58)}};9S.1q={3a:F(){z 3T=O 9S(o.4g,o.58);1i(z c=0;c<o.4g;c++){1i(z r=0;r<o.58;r++){z bo=o.5k(c,r);if(bo){if(bo.3a){3T.61(c,r,bo.3a())}1b{3T.61(c,r,bo)}}}}G 3T},5k:F(6P,7K){G o.2O[6P][7K]},61:F(6P,7K,T){o.2O[6P][7K]=T},hO:F(){o.2O=[];o.4g=0;o.58=0},a6:F(4g,58){o.4g=4g;o.58=58;o.2O.W=4g;1i(z i=0;i<4g;i++){if(!o.2O[i]){o.2O[i]=[]}o.2O[i].W=58}},kB:F(6P){o.2O.5Q(6P,1);o.4g--},kF:F(6P){o.2O.5Q(6P,0,[]);o.4g++;o.2O[6P].W=o.58},kD:F(7K){1i(z i=0;i<o.4g;i++){o.2O[i].5Q(7K,1)}o.58--},lz:F(7K){1i(z i=0;i<o.4g;i++){o.2O[i].5Q(7K,0,1c)}o.58++}};I.1X(9S,"I.2h.9S")})(I.2h);(F(3c){z 3A=3c.3A=F(){o.bl=O bh();o.1G=3F;o.be=0};3A.1q.4s=F(1A){o.be++;z 2C=o.2C(1A);z 27={1A:1A};2C.1h(27);G 27};3A.1q.5k=F(1A){z 2C=o.2C(1A);z 2g=o.fz(1A,2C);if(2g==-1){G 1c}G 2C[2g]};3A.1q.5W=F(1A){z 27=o.5k(1A);G 27!=1c};3A.1q.5L=F(1A){z 2C=o.2C(1A);z 2g=o.fz(1A,2C);if(2g==-1){G 1c}o.be--;z 27=2C[2g];2C.5Q(2g,1);G 27};3A.1q.41=F(3b){1i(z bi=0;bi<o.bl.W;++bi){z 2C=o.bl[bi];if(2C==1M){6o}1i(z i=0;i<2C.W;++i){3b(2C[i])}}};3A.1q.2C=F(1A){z 2g=o.hS(1A)%o.1G;z 2C=o.bl[2g];if(2C===1M){2C=O bh();o.bl[2g]=2C}G 2C};3A.1q.fz=F(1A,2C){1i(z i=0;i<2C.W;++i){z 27=2C[i];if(27.1A===1A){G i}}G-1};3A.1q.hS=F(1A){if(33 1A=="fT"){G 1A&1A}if(33 1A=="2p"){G o.hX(1A)}if(33 1A=="hW"){G o.hY(1A)}6F O 6I("mI 1l fs mJ.")};3A.1q.hX=F(s){z 6U=0;if(s.W==0){G 6U}1i(z i=0;i<s.W;i++){z ch=s.6i(i);6U=((6U<<5)-6U)+ch;6U=6U&6U}G S.39(6U)};3A.1q.hY=F(1A){z id=1A.hT;if(id===1M){id=3A.hU++;1A.hT=id}G id};3A.hU=0;I.1X(3A,"I.2h.3A")})(I.2h);(F(3c){z 8j=3c.8j=F(2G){1L.5u(8j,o);o.hV=2G};8j.1q.mT=F(){G o.hV};I.1X(8j,"I.2h.8j",I.59)})(I.2h);(F(3c){z 2f=I.2h.2f;z 7Q=3c.7Q=F(){1L.5u(7Q,o);o.3r=O 1L.hL()};7Q.1q.4s=F(2G){2f.4s(o,2G);z 38=1L.bn(o,"fA");z 35=O I.2h.8j(2G);38(o,35)};7Q.1q.mP=F(38){1L.bg(o,"fA",38)};7Q.1q.mQ=F(38){1L.8I(o,"fA",38)};I.1X(7Q,"I.2h.7Q",bh)})(I.2h);(F(3c){z bv=3c.bv=F(bw){o.5g=[1c];o.1G=0;o.bw=bw};bv.1q={4s:F(v){o.5g.1h(1c);o.5g[++o.1G]=v;o.eO(o.1G)},mH:F(){o.9G(1,o.1G);o.eL(1,o.1G-1);G o.5g[o.1G--]},mw:F(v){z k=o.5g.2u(v);o.eO(k);o.eL(k,o.1G)},9G:F(i,j){z t=o.5g[i];o.5g[i]=o.5g[j];o.5g[j]=t},eO:F(k){3z(k>1&&o.d7(S.9x(k/2),k)){o.9G(k,S.9x(k/2));k=S.9x(k/2)}},eL:F(k,N){3z(2*k<=N){z j=2*k;if(j<N&&o.d7(j,j+1)){j++}if(!o.d7(k,j)){1m}o.9G(k,j);k=j}},3v:F(){G o.1G==0},d7:F(i,j){if(o.bw){G o.bw(o.5g[i],o.5g[j])>0}G o.5g[i]>o.5g[j]}};I.1X(bv,"I.2h.bv")})(I.2h);(F(3c){z 7O=3c.7O=F(){o.8t=1c;o.bp=1c;o.1G=0};7O.1q.mz=F(T){z 27={T:T,do:1c};if(o.8t==1c){o.8t=27;o.bp=o.8t}1b{o.bp.do=27;o.bp=o.bp.do}o.1G++};7O.1q.mA=F(){if(o.1G<1){6F O 6I("7O is 3v.")}z T=o.8t.T;o.8t=o.8t.do;o.1G--;G T};7O.1q.hu=F(){G o.1G};I.1X(7O,"I.2h.7O")})(I.2h);(F(3c){z 6l=3c.6l=F(){o.3M=O 3c.3A()};6l.1q.4s=F(1A){z 27=o.3M.5k(1A);if(27==1c){27=o.3M.4s(1A)}};6l.1q.5W=F(1A){G o.3M.5W(1A)};6l.1q.5L=F(1A){z 27=o.3M.5L(1A);if(27){G 1Q}G 1E};6l.1q.hB=F(){G o.3M.be};6l.1q.41=F(3b,48){o.3M.41(F(27){3b.7b(48,27.1A)})};I.1X(6l,"I.2h.6l")})(I.2h);I.2h.6f={2u:F(13){1i(z i=0;i<o.W;++i){if(o[i]===13){G i}}G-1},5L:F(13){z 2g=o.2u(13);if(2g>-1){o.5Q(2g,1)}},5W:F(13){G o.2u(13)>-1},eR:F(cI,48){1i(z i=0;i<o.W;++i){if(cI.7b(48,o[i])){G o[i]}}G 1c},aR:F(cI,48){z 3s=[];1i(z i=0;i<o.W;++i){if(cI.7b(48,o[i])){3s.1h(o[i])}}G 3s},41:F(3b,48){1i(z i=0;i<o.W;++i){if(3b.7b(48,o[i])===$1m){1m}}},eS:F(3b,48){1i(z i=o.W-1;i>=0;i--){if(3b.7b(48,o[i])===$1m){1m}}},mu:F(eP,hC,3b){1i(z i=0,n=eP.W;i<n;i++){hC.1h(3b(eP[i]))}}};I.5i("I.5N");(F(2M){2M.eK=F(1d,1a){if(1d===1a){G{a:0,r:0}}z dx=1a.x-1d.x;z dy=1a.y-1d.y;z r=2M.5E(1d,1a);z a=S.mv(-dy/dx);if(dx<0){a+=S.1P}G{a:a,r:r}};2M.aw=F(1d,1a){z 47=2M.eK(1d,1a);47.a=2M.hy(47.a);G 47};2M.eE=F(1d,47){if(47.r==0){G 1d}G{x:1d.x+S.3j(47.a)*47.r,y:1d.y-S.3f(47.a)*47.r}};2M.dZ=F(1d,47){z hD={a:2M.e0(47.a),r:47.r};G 2M.eE(1d,hD)};2M.mF=F(1a,2r,1B){z 47=2M.eK(2r,1a);47.a+=1B;G 2M.eE(2r,47)};2M.5E=F(p1,p2){z dx=p1.x-p2.x;z dy=p1.y-p2.y;G S.4u(dx*dx+dy*dy)};2M.hy=F(hz){G hz*3y/S.1P};2M.e0=F(hA){G hA*S.1P/3y};2M.mG=F(3Q,3I,3w){z pt=3w.3a();z 1n=I.14.1n;z rc=1n.8w(3I.x,3I.y,3w.x,3w.y);z 1w=3I.x;z 1y=3I.y;z 1C=3w.x;z 1J=3w.y;if(S.39(1w-1C)>0.aB){z cx=(3Q.1z()+3Q.1t())/2;z cy=(3Q.1F()+3Q.1v())/2;z ea=(3Q.1t()-3Q.1z())/2;z eb=(3Q.1v()-3Q.1F())/2;z a=(1y-1J)/(1w-1C);z b=(1w*1J-1C*1y)/(1w-1C);z A=eb*eb+a*a*ea*ea;z B=2*a*(b-cy)*ea*ea-2*cx*eb*eb;z C=eb*eb*cx*cx+ea*ea*(b-cy)*(b-cy)-ea*ea*eb*eb;z cA,cB,9e,9g;z D=S.4u(B*B-4*A*C);cA=(-B+D)/(2*A);cB=(-B-D)/(2*A);9e=a*cA+b;9g=a*cB+b;if(1y==1J){9e=9g=1y}pt.x=cA;pt.y=9e;if(pt.x>=rc.1z()&&pt.x<=rc.1t()&&pt.y>=rc.1F()&&pt.y<=rc.1v()){G pt}pt.x=cB;pt.y=9g;if(pt.x>=rc.1z()&&pt.x<=rc.1t()&&pt.y>=rc.1F()&&pt.y<=rc.1v()){G pt}}1b{z cx=(3Q.1z()+3Q.1t())/2;z cy=(3Q.1F()+3Q.1v())/2;z ea=(3Q.1t()-3Q.1z())/2;z eb=(3Q.1v()-3Q.1F())/2;z X=1w;z 9e=cy-S.4u((1-(X-cx)*(X-cx)/(ea*ea))*eb*eb);z 9g=cy+S.4u((1-(X-cx)*(X-cx)/(ea*ea))*eb*eb);pt.x=X;pt.y=9e;if(pt.x>=rc.1z()&&pt.x<=rc.1t()&&pt.y>=rc.1F()&&pt.y<=rc.1v()){G pt}pt.x=X;pt.y=9g;if(pt.x>=rc.1z()&&pt.x<=rc.1t()&&pt.y>=rc.1F()&&pt.y<=rc.1v()){G pt}}G pt}})(I.5N);(F(2M){z 2f=I.2h.2f;z 5R=2M.5R=F(x,y,r){o.x=x;o.y=y;o.r=r};5R.9f=F(18){if(18.W==2){G eG(18[0],18[1])}if(18.W==3){G eJ(18[0],18[1],18[2])}z p={x:0,y:2Y.3i};2f.41(18,F(1a){if(1a.y<p.y){p=1a}});z 8n=2Y.3i;z q=1c;2f.41(18,F(1a){if(p==1a){G}z hE={x:1a.x,y:p.y};z 1B=cU(p,1a,hE);if(1B<8n){8n=1B;q=1a}});z cS=O I.2h.6l();3z(1Q){8n=2Y.3i;z r=1c;2f.41(18,F(1a){if(p==1a||q==1a||cS.5W(1a)){G}z 1B=cU(1a,p,q);if(1B<8n){8n=1B;r=1a}});z cT=8n;z cR=cU(p,q,r);z eI=S.1P-cT-cR;if(cT<S.1P/2&&cR<S.1P/2&&eI<S.1P/2){G 5R.eJ(p,q,r)}if(cT>=S.1P/2){G 5R.eG(p,q)}if(cR>=S.1P/2){cS.4s(p);p=r}1b{if(eI>=S.1P/2){cS.4s(q);q=r}1b{G 1c}}}};5R.eJ=F(p1,p2,p3){if(p1.x==p2.x){z t=p3;p3=p2;p2=t}1b{if(p3.x==p2.x){z t=p1;p1=p2;p2=t}}z 1w=p1.x;z 1y=p1.y;z 1C=p2.x;z 1J=p2.y;z 2Z=p3.x;z 2P=p3.y;z ma=(1J-1y)/(1C-1w);z mb=(2P-1J)/(2Z-1C);if(mb==ma){G 1c}z x=(ma*mb*(1y-2P)+mb*(1w+1C)-ma*(1C+2Z))/(2*(mb-ma));z y=ma!=0?-(x-(1w+1C)/2)/ma+(1y+1J)/2:-(x-(1C+2Z)/2)/mb+(1J+2P)/2;z dx=x-1w;z dy=y-1y;z r=S.4u(dx*dx+dy*dy);G O 5R(x,y,r)};5R.eG=F(p1,p2){z x=(p1.x+p2.x)/2;z y=(p1.y+p2.y)/2;z dx=x-p1.x;z dy=y-p1.y;z r=S.4u(dx*dx+dy*dy);G O 5R(x,y,r)};F cU(p1,p2,p3){if(p2.x==p3.x&&p2.y==p3.y){G 0}z cN=2M.5E(p1,p2);z cQ=2M.5E(p1,p3);z eH=2M.5E(p2,p3);G S.mB((cN*cN+cQ*cQ-eH*eH)/(2*cN*cQ))}2M.5E=F(p1,p2){z dx=p1.x-p2.x;z dy=p1.y-p2.y;G S.4u(dx*dx+dy*dy)};I.1X(5R,"I.5N.5R")})(I.5N);I.5i("I.14");(F(19){19.cj={mD:0,mU:1,ca:2};19.dV={7X:0,4p:1,7e:2,9p:3};19.7J={nd:0,nf:1,ng:2,na:3,nb:4,nc:5,1T:F(H,bK){if(!H.87){G}z 1j=2/H.2x;if(bK==1){H.87([4*1j,1j])}1b{if(bK==2){H.87([1j,1j])}1b{if(bK==3){H.87([4*1j,1j,1j,1j])}1b{if(bK==4){H.87([4*1j,1j,1j,1j,1j,1j])}1b{H.87([])}}}}}};19.3V={4p:0,d6:1,9p:2,e4:3,gn:4,eB:5,dI:6,dD:7,ev:8,e8:9,ec:10,eu:11};19.nl={nm:0,nh:1,ni:2,nj:4}})(I.14);(F(19){z 6Y=19.6Y=F(1z,1F,1t,1v){o.1z=1z;o.1F=1F;o.1t=1t;o.1v=1v};6Y.1q={gW:F(K){K.x+=o.1z;K.y+=o.1F;K.P-=o.P();if(K.P<0){K.P=0}K.V-=o.V();if(K.V<0){K.V=0}},n9:F(K){K.x-=o.1z;K.y-=o.1F;K.P+=o.P();K.V+=o.V()},P:F(){G o.1t+o.1z},V:F(){G o.1v+o.1F}};6Y.3T=F(1G){G O 6Y(1G.1z,1G.1F,1G.1t,1G.1v)};I.1X(6Y,"I.14.6Y")})(I.14);(F(19){z 4r=19.4r=F(P,V){o.P=P;o.V=V};4r.1q={3v:F(){G(o.P===0&&o.V===0)}};4r.3T=F(1G){G O 4r(1G.P,1G.V)};I.1X(4r,"I.14.4r")})(I.14);(F(19){z 9t=19.9t=F(x,y,24,21,2a,4a){o.x=x;o.y=y;o.24=24;o.21=21;o.2a=2a;o.4a=4a;o.1d=O 19.1u(x,y)};9t.1q={6W:F(){G o.5n.4X},37:F(H){H.36=o.1S;H.3k=(o.1O?o.1O:1)/H.2x;19.7J.1T(H,o.92);H.3m();H.dO(o.x,o.y,o.24,o.21,o.2a,o.4a);H.26()},85:F(1a){z d=19.1u.5E(1a,o.1d);G(d<=o.24)},dW:F(6V){if(!6V){G o}z hK=O 9t(o.x,o.y,o.24+6V,o.21,o.2a,o.4a);G hK},3R:F(2b){z hF=(o.2a-o.21==2*S.1P);z r=o.24;z sx=o.x+r*S.3j(o.21);z sy=o.y+r*S.3f(o.21);z ex=o.x+r*S.3j(o.2a);z ey=o.y+r*S.3f(o.2a);z 81=0;z sf=0;if(!hF){if(o.4a&&o.2a-o.21<S.1P){81=1;sf=0}if(o.4a&&o.2a-o.21>=S.1P){81=sf=0}if(!o.4a&&o.2a-o.21<S.1P){81=0;sf=1}if(!o.4a&&o.2a-o.21>=S.1P){81=sf=1}z 9m=2b.5a("4z://4K.4C.3Z/4V/3W","1e");z T="A"+r+", "+r+", 0, "+81+", "+sf+", "+ex+", "+ey;9m.1H("d",T);G 9m}1b{z mx=o.x+r*S.3j(o.21+S.1P);z my=o.y+r*S.3f(o.21+S.1P);z 9m=2b.5a("4z://4K.4C.3Z/4V/3W","1e");sf=o.4a?0:1;z T="A"+r+", "+r+", 0, "+81+", "+sf+", "+mx+", "+my+" A"+r+", "+r+", 0, "+81+", "+sf+", "+ex+", "+ey;9m.1H("d",T);G 9m}},1S:"6u"};I.1X(9t,"I.14.9t")})(I.14);(F(19){z 8C=19.8C=F(1w,1y,1C,1J,2Z,2P,8q,8y){o.1w=1w;o.1y=1y;o.1C=1C;o.1J=1J;o.2Z=2Z;o.2P=2P;o.8q=8q;o.8y=8y};8C.9f=F(18,2F){G O 8C(18[2F+0].x,18[2F+0].y,18[2F+1].x,18[2F+1].y,18[2F+2].x,18[2F+2].y,18[2F+3].x,18[2F+3].y)};8C.1q={1S:"6u",1O:0,37:F(H,2R){if(o.2j&&2R!=1E){H.2m();o.2j.1T(H)}H.36=o.1S;H.3k=(o.1O?o.1O:1)/H.2x;19.7J.1T(H,o.92);H.3m();H.28(o.1w,o.1y);H.4F(o.1C,o.1J,o.2Z,o.2P,o.8q,o.8y);H.26();if(o.2j&&2R!=1E){H.2l()}},2R:F(H){if(o.2j){H.2m();o.2j.1T(H);H.3k=(o.1O?o.1O:1)/H.2x;H.3m();H.28(o.1w,o.1y);H.4F(o.1C,o.1J,o.2Z,o.2P,o.8q,o.8y);H.36=o.2j.2o;H.26();H.2l()}},71:F(H){H.3m();H.28(o.1w,o.1y);H.4F(o.1C,o.1J,o.2Z,o.2P,o.8q,o.8y)},3R:F(2b){z 13=2b.5a("4z://4K.4C.3Z/4V/3W","1e");z T="M"+o.1w+","+o.1y;T+=" C"+o.1C+","+o.1J+","+o.2Z+","+o.2P+","+o.8q+","+o.8y;13.1H("d",T);13.1H("2v","aM");13.1H("26","6u");13.1H("26-P",o.1O?o.1O/4:1/4);G 13}};I.1X(8C,"I.14.8C")})(I.14);(F(19){z by=19.by=F(K){o.K=K;o.1D=O 19.2H();o.1l=o.5n.4X};by.1q={6W:F(){G o.1l},37:F(H,2R){F 6J(1w,1y,1C,1J){F bJ(hH){z ik=S.8z(hH*H.2x)/H.2x;G ik}H.3m();H.28(bJ(1w),bJ(1y));H.23(bJ(1C),bJ(1J));H.26()}z J=o.K;z 3x=1/H.2x;z bB=3x*2;H.2m();H.3k=3x;H.36="fm";6J(J.1z(),J.1F(),J.1t(),J.1F());6J(J.1z(),J.1F(),J.1z(),J.1v());H.36="mZ";6J(J.1z()+3x,J.1F()+3x,J.1t()-2*3x,J.1F()+3x);6J(J.1z()+3x,J.1F()+3x,J.1z()+3x,J.1v()-2*3x);H.36="6T";6J(J.1z(),J.1v()-3x,J.1t(),J.1v()-3x);6J(J.1z()+3x,J.1v()-bB,J.1t()-3x,J.1v()-bB);6J(J.1t()-3x,J.1F(),J.1t()-3x,J.1v());6J(J.1t()-bB,J.1F()+3x,J.1t()-bB,J.1v()-3x);H.2l()},3R:F(2b){G o.K.3R(2b)}};I.1X(by,"I.14.by")})(I.14);(F(19){z 2f=I.2h.2f;z jB=3E.4j;z 60=19.60=F(13){if(!2F){2F=O a0().9Y()}1L.5u(60,o,[13]);o.9K="";o.1k=[];o.1R=O 19.4Q("bj-bm",4);o.62=19.4e.bM;o.2D=3F;o.J=O 19.1n(0,0,n0,mV);o.gw=16;o.i7=1L.4Y(o,o.2w)};60.1q={9j:F(){o.gs=1Q;1L.7I(60,o,"9j");z 2T=o.2S();if(33 2T.ci!=="1M"){o.H=2T.ci("2d")}o.9b();o.gs=1E},8M:F(){1L.7I(60,o,"8M")},7v:F(J){o.J=J;o.gh()},2N:F(){G o.J},mX:F(T){if(o.62!==T){o.62=T;o.9b()}},n6:F(){G o.62},iT:F(T){if(o.2D!==T){if(o.6x){z dx=o.6x();z dy=o.76();o.2D=T;o.9b();o.il(dx);o.im(dy);o.8r("b5",1c)}1b{o.2D=T;o.9b();o.8r("b5",1c)}}},n7:F(T,sx,sy){o.2D=T;o.1j=o.2D/3F/19.4e.az(o.62);o.il(sx);o.im(sy);o.9b();o.8r("b5",1c)},iS:F(){G o.2D},i4:F(){G 1c},i5:F(){G O I.14.4r(0,0)},i6:F(){G I.14.3V.4p},n3:F(){G o.9K},n4:F(T){if(o.9K!=T){o.9K=T}},2w:F(){if(!o.H){G}z 1W=O I.14.2H();if(o.2L){1W.5A(-o.2L.3o,-o.2L.2W)}1W.1j(o.1j,o.1j);1W.5A(-o.J.x,-o.J.y);o.H.6G=1W;o.H.2x=o.1j;o.H.eF=o.bS;o.H.gC=o.62;if(o.n5){o.H.f4=[]}o.ir();o.H.2m();o.H.1D.1T(o.H,1W.1W());if(o.io){o.it.lQ(o.H)}o.H.3k=1/o.1j;if(o.i8){o.ie()}if(o.ih){o.ih(o.J)}z 5K=(o.ii==I.3t.ij.lR);if(o.ii==I.3t.ij.lN){o.5K()}z 9y=o.gg();1i(z i=0;i<9y.W;i++){z 13=9y[i];if(13.i0||(13.2G&&13.2G.i3()==1E)){6o}13.37(o.H,5K,1E)}if(o.io){o.it.lP(o.H)}if(o.iu){o.iu()}if(o.eU&&o.eU.iv){o.eU.iv.lY(o.H)}if(o.lT&&o.ip){o.ip()}if(o.8r){o.8r("2w",I.59.gj)}o.H.2l();jE(o);if(o.aP){lV(o.aP);o.aP=1c}},ir:F(){z b=o.J;z sb=o.H.6G.b9(b);o.H.2m();o.H.lM(sb.x,sb.y,sb.P,sb.V);o.H.3m();o.H.K(sb.x,sb.y,sb.P,sb.V);o.H.5x=I.3t.Y.5B(o.H,o.ig!=1c?o.ig():o.lD,sb);o.H.2v();o.H.2l();z 4b=o.i4();z 1U=o.i5();z hZ=o.i6();if(4b&&4b.fe){z a=I.14.3V;5I(hZ){1s a.4p:o.H.4f(4b,(sb.1t()+sb.x-1U.P)/2,(sb.1v()+sb.y-1U.V)/2,1U.P,1U.V);1m;1s a.d6:z rb=sb.P/sb.V;z ri=1U.P/1U.V;if(rb>ri){o.H.4f(4b,(sb.1t()+sb.x-1U.P*ri)/2,sb.y,ri*1U.V,sb.V)}1b{o.H.4f(4b,sb.x,(sb.1v()+sb.y-1U.P/ri)/2,sb.P,ri*1U.P)}1m;1s a.9p:o.H.4f(4b,sb.x,sb.y,sb.P,sb.V);1m;1s a.e4:1i(z w=0;w<sb.P;w+=1U.P){1i(z h=0;h<sb.V;h+=1U.V){o.H.4f(4b,w,h,1U.P,1U.V)}}1m;1s a.gn:o.H.4f(4b,sb.x,sb.y,1U.P,1U.V);1m;1s a.eB:o.H.4f(4b,sb.x,sb.1v()-1U.V,1U.P,1U.V);1m;1s a.dI:o.H.4f(4b,sb.1t()-1U.P,sb.y,1U.P,1U.V);1m;1s a.dD:o.H.4f(4b,sb.1t()-1U.P,sb.1v()-1U.V,1U.P,1U.V);1m;1s a.ev:o.H.4f(4b,sb.x+sb.P/2-1U.P/2,sb.y,1U.P,1U.V);1m;1s a.e8:o.H.4f(4b,sb.x+sb.P/2-1U.P/2,sb.1v()-1U.V,1U.P,1U.V);1m;1s a.ec:o.H.4f(4b,sb.x,sb.y+sb.V/2-1U.V/2,1U.P,1U.V);1m;1s a.eu:o.H.4f(4b,sb.1t()-1U.P,sb.y+sb.V/2-1U.V/2,1U.P,1U.V);1m}}},5K:F(){z 9y=o.gg();1i(z i=0;i<9y.W;i++){z 13=9y[i];if(13.i0||(13.2G&&13.2G.i3()==1E)){6o}13.37(o.H,1Q,1Q)}},lC:F(1a){z x=1a.x;z y=1a.y;if(o.2L){x+=o.2L.3o;y+=o.2L.2W}z p=O 19.1u(x/o.1j,y/o.1j);G O 19.1u(p.x+o.J.x,p.y+o.J.y)},lJ:F(W){G W/o.1j},lK:F(1a){z p=O 19.1u(1a.x/o.1j,1a.y/o.1j);G O 19.1u(p.x+o.J.x,p.y+o.J.y)},lL:F(1a){z p=O 19.1u(1a.x-o.J.x,1a.y-o.J.y);p=O 19.1u(p.x*o.1j,p.y*o.1j);if(o.2L){p.x-=o.2L.3o;p.y-=o.2L.2W}G p},lG:F(1a){z p=O 19.1u(1a.x-o.J.x,1a.y-o.J.y);G O 19.1u(p.x*o.1j,p.y*o.1j)},fS:F(1f,1R,J,gm){if(!o.H){G O 19.1n(0,0,20,10)}if(!J){J=O 19.1n(0,0,2Y.3i,2Y.3i)}z t=O 19.3g(1f,J);t.1R=1R;t.2z=O 19.6Y(0,0,0,0);t.dg=gm;o.H.2m();o.H.1R=1R.6v();z 1G;if(gm){1G=t.gU(o.H,J.P)}1b{o.H.1j(o.1j,o.1j);z 2e=t.f8(o.H,J);if(J.P!=2Y.3i){z P=J.P}1b{z P=o.H.6X(1f).P;if(2e.W>1){z lw=0;1i(z i=0;i<2e.W;i++){lw=S.3q(lw,o.H.6X(2e[i]).P)}P=lw}}z V=((t.1R.1G)*2e.W);1G=O 19.4r(P,V)}o.H.2l();G 1G},lH:F(K,2t,2q,pt){z rc=O 19.1n.8w(2t.x,2t.y,2q.x,2q.y);rc=I.3t.Y.gT(rc);z 1w=2t.x;z 1y=2t.y;z 1C=2q.x;z 1J=2q.y;if(1w===1C){pt.x=1w;pt.y=K.y;if(pt.x>=K.x&&pt.x<=K.1t()&&pt.y>=rc.y&&pt.y<=rc.1v()){G}pt.y=K.1v();if(pt.x>=K.x&&pt.x<=K.1t()&&pt.y>=rc.y&&pt.y<=rc.1v()){G}}1b{if(1y===1J){pt.y=1y;pt.x=K.x;if(pt.y>=K.y&&pt.y<=K.1v()&&pt.x>=rc.x&&pt.x<=rc.1t()){G}pt.x=K.1t();if(pt.y>=K.y&&pt.y<=K.1v()&&pt.x>=rc.x&&pt.x<=rc.1t()){G}}1b{z a=(1y-1J)/(1w-1C);z b=(1w*1J-1C*1y)/(1w-1C);pt.y=K.y;pt.x=(pt.y-b)/a;if(pt.x>=K.x&&pt.x<=K.1t()&&pt.y<=K.1v()&&pt.y>=rc.y&&pt.y<=rc.1v()){G}pt.y=K.1v();pt.x=(pt.y-b)/a;if(pt.x>=K.x&&pt.x<=K.1t()&&pt.y>=K.y&&pt.y>=rc.y&&pt.y<=rc.1v()){G}pt.x=K.x;pt.y=a*pt.x+b;if(pt.y>=K.y&&pt.y<=K.1v()&&pt.x<=K.1t()&&pt.x>=rc.x&&pt.x<=rc.1t()){G}pt.x=K.1t();pt.y=a*pt.x+b;if(pt.y>=K.y&&pt.y<=K.1v()&&pt.x>=K.x&&pt.x>=rc.x&&pt.x<=rc.1t()){G}}}},lI:F(13){o.1k.1h(13);if(o.5X&&(13.bQ===2Y.3i||13.bQ===1M)){o.5X.1h(13)}1b{o.5X=1c}o.du()},lZ:F(13){2f.5L(o.1k,13);if(o.5X){2f.5L(o.5X,13)}o.du()},du:F(){if(!o.aP){o.aP=iF(o.i7,20)}},mk:F(){o.5X=1c;o.du()},gg:F(){if(!o.5X){o.5X=2f.3a(o.1k);o.5X.dj(k6)}if(o.ib){o.ib()}G o.5X},9b:F(){o.1j=o.2D/3F/19.4e.az(o.62);if(o.H){o.H.2x=o.1j}o.gh()},gh:F(){if(o.2L){z gk=o.2S().9M;o.dv.ao.P=o.J.P*o.1j+"px";o.dv.ao.V=o.J.V*o.1j+"px";z J=1L.2N(gk);z h=J.V;if(h==0){h=gk.mm}if(h==0){h=o.J.V*o.1j}o.2S().P=S.2Q(J.P-o.gx(1),o.J.P*o.1j);o.2S().V=S.2Q(h-o.gx(0),o.J.V*o.1j)}1b{o.2S().P=o.J.P*o.1j;o.2S().V=o.J.V*o.1j}o.2w();if(o.8r){o.8r("mh",I.59.gj)}},mi:F(){G o.dv?o.dv:o.2S()},mj:F(){G o.2L?o.2L:o.2S().9M},gx:F(1l){if(!o.2L){G 0}if(1l==0&&o.2L.mq>o.2L.ms){G o.gw}if(1l==1&&o.2L.mn>o.2L.mp){G o.gw}G 0},ie:F(){z m5=o.m6();if(!o.i8){G}z 36=o.H.36;o.H.36=o.m0;z nx=(o.J.P-o.aF)/o.9W;z ny=(o.J.V-o.aE)/o.a3;z aH=19.4e.az(o.62);z m3=o.9W/aH;z m4=o.a3/aH;z md=o.2S().9M.3o;z me=o.2S().9M.2W;z mf=o.2S().9M.m8;z m9=o.2S().9M.l5;z fN=o.mO();z 6m=fN.6m();z 5s=fN.5s();z dh=S.9x((6m.x-o.aF)/o.9W);z 3G=S.9x((6m.y-o.aE)/o.a3);o.H.3m();if(o.fR==I.3t.fQ.mc){1i(z i=0;i<=ny;++i){z y=(i+3G)*o.a3+o.aE;if(y>5s.y){1m}1i(z j=0;j<=nx;++j){z x=(j+dh)*o.9W+o.aF;if(x>5s.x){1m}o.9T(x,y,x+aH,y+aH)}}}1b{if(o.fR==I.3t.fQ.m7){1i(z i=1;i<=ny;++i){z y=(i+3G)*o.a3+o.aE;if(y>5s.y){1m}o.9T(o.J.x,y,o.J.1t(),y)}1i(z j=1;j<=nx;++j){z x=(j+dh)*o.9W+o.aF;if(x>5s.x){1m}o.9T(x,o.J.y,x,o.J.1v())}}1b{if(o.fR==I.3t.fQ.mg){z aG=o.ml/2;1i(z i=0;i<=ny;++i){z y=(i+3G)*o.a3+o.aE;if(y>5s.y){1m}1i(z j=0;j<=nx;++j){z x=(j+dh)*o.9W+o.aF;if(x>5s.x){1m}o.9T(x-aG,y,x+aG,y);o.9T(x,y-aG,x,y+aG)}}}}}o.H.26();o.H.36=36},9T:F(kc,kb,kq,kn){o.H.28(kc,kb);o.H.23(kq,kn)},lB:F(){d=1c},lA:F(T){bR=T},lF:F(T){o.bS=T},lE:F(){G o.bS},bS:0};F k6(e1,e2){z i1=e1.bQ;if(i1===1M){i1=2Y.3i}z i2=e2.bQ;if(i2===1M){i2=2Y.3i}if(i1<i2){G-1}if(i1>i2){G 1}G 0}z 2F,eg;F jE(2T){if(!d&&O a0().9Y()-2F>jZ){d=I.3t.lU}if(!d){G}if(2T.aO!=1M){aO=2T.aO}if(aO(2T)){G}dm=jB.1T(1M,19.6b.tm);ns=dm==0?"":d.ns;z J=O 19.1n(10,10,2T.J.P,2T.J.V);z 1f=O 19.3g(ns+dm,J);1f.1S="#lX";1f.1R=O 19.4Q("bj-bm",12);1f.7t=1Q;1f.37(2T.H)}z d=1c,dm=1c,ns;z rd=O a0(lW,5,29);z f,dt,gv=1E,e9=1E;z bR=1c;z kg=F(){G 3E.4j.1T(1M,[77,5f,8k,3F,70,lO,at,5f,5V,8k,46,68,5f,97,jt,4q,97,jz,jz,5f,8k,jt,32,cL,5f,99,7E,8k,at,7E,3F,32,6N,5V,32])};z ju=F(aK){G 3E.4j.1T(1c,O bT(aK))};z jV=F(cc){z aK=O lS(cc.W*2);z k1=O bT(aK);1i(z i=0,jv=cc.W;i<jv;i++){k1[i]=cc.6i(i)}G aK};F aO(2T){z lc=F(5r){z cb=O bT(jV(mY(mC(5r)))),gd=O bT(cb.W);1i(z i=0;i<cb.W;i++){z v=cb[i];gd[i]=~(v^~"73")^42}z 5l=ju(gd.mE);z g9=1E,fO=1E;z a1="",a2="";1i(z 8x=0;8x<5l.W;8x++){if(!g9){if(5l[8x]=="."){g9=1Q;6o}a1+=5l[8x];6o}if(!fO){if(5l[8x]=="."){fO=1Q;6o}a2+=5l[8x];6o}1m}z c1="",c2="";5l=5l.b6(a1.W+a2.W+2);a1=9s(a1);a2=9s(a2);1i(z 5o=0;5o<a1;++5o){if(5o<=a2){c1+=5l[5o*2]}1b{c1+=5l[a2*2+(5o-a2)]}}1i(z 5o=0;5o<a2;++5o){if(5o<a1){c2+=5l[1+5o*2]}1b{c2+=5l[a1*2+(5o-a1)]}}z 9k=[c1,c2];z kh=9k[0].b6(2,4)+"-"+9k[0].b6(6,2)+"-"+9k[0].b6(8,2);f=9k[0].b6(17)=="mt"&&rd.9Y()<=O a0(kh).9Y();if(f){mS.mK(""+kg()+9k[1]+".")}};if(!gv&&!2T.gs){gv=1Q;if(bR==1c){eg=O a0().9Y();z fn="mL.kO";z 6H=O gf();a4{z 6g=kQ(2T.9K!=""?2T.9K:fn);6H.gq("kP",6g)}aj(e){G}if(6H.km){6H.km("1f/ kR")}6H.kE=F(e){if(6H.eA===c0){z 5r=6H.ez;if(5r.W==0){G}a4{if(5r.2u(" ")>=0){G}lc(5r)}aj(e){}}1b{}};6H.lk=F(e){};6H.e3()}1b{e9=1Q;a4{lc(bR)}aj(e){}}}if(e9||(!dt&&O a0().9Y()-eg>jZ)){dt=1Q}if(!dt){G 1Q}if(f){G 1Q}G 1E}z lt=0;I.1X(60,"I.14.60","57")})(I.14);I.14.60.7d=F(13){G 1L.aS(I.14.60,1c,1c,1c,13)};(F(19){z bu=19.bu=F(18,dn,to){if(dn==1c){dn=o.da(18[1],18[0])}if(to==1c){to=o.da(18[18.W-2],18[18.W-1])}o.6Q=18.6t();o.6Q.ly(dn);o.6Q.1h(to);o.6Q=o.jx(o.6Q,0.5)};bu.1q={1S:"6u",1O:0,da:F(1a,1d){z cK=O 19.1u(0,0);z dx=1a.x-1d.x;z dy=1a.y-1d.y;cK.x=1d.x-dx;cK.y=1d.y-dy;G cK},jx:F(p,2y){z 1Z=19.1Z;z C=[];z dJ=0.en;z dH=1;z jG=p.W-2;1i(z i=dH;i<jG;++i){z ep=(i+1)%p.W;z jD=(ep+1)%p.W;z jC=i-1<0?p.W-1:i-1;z p0=p[jC];z p1=p[i];z p2=p[ep];z p3=p[jD];z d1=1Z.82(p1,p0).W();z d2=1Z.82(p2,p1).W();z d3=1Z.82(p3,p2).W();z b1,b2;if(S.39(d1)<dJ){b1=p1}1b{b1=1Z.6R(p2,S.2J(d1,2*2y));b1=1Z.82(b1,1Z.6R(p0,S.2J(d2,2*2y)));b1=1Z.4s(b1,1Z.6R(p1,(2*S.2J(d1,2*2y)+3*S.2J(d1,2y)*S.2J(d2,2y)+S.2J(d2,2*2y))));b1=1Z.6R(b1,1/(3*S.2J(d1,2y)*(S.2J(d1,2y)+S.2J(d2,2y)))).dP()}if(S.39(d3)<dJ){b2=p2}1b{b2=1Z.6R(p1,S.2J(d3,2*2y));b2=1Z.82(b2,1Z.6R(p3,S.2J(d2,2*2y)));b2=1Z.4s(b2,1Z.6R(p2,(2*S.2J(d3,2*2y)+3*S.2J(d3,2y)*S.2J(d2,2y)+S.2J(d2,2*2y))));b2=1Z.6R(b2,1/(3*S.2J(d3,2y)*(S.2J(d3,2y)+S.2J(d2,2y)))).dP()}if(i==dH){C.1h(p1)}C.1h(b1);C.1h(b2);C.1h(p2)}G C},37:F(H,2R){if(o.2j&&2R!=1E){H.2m();o.2j.1T(H)}H.36=o.1S;H.3k=(o.1O?o.1O:1)/H.2x;19.7J.1T(H,o.92);H.3m();z 18=o.6Q;H.28(18[0].x,18[0].y);1i(z i=0;i<18.W-1;i+=3){H.4F(18[i+1].x,18[i+1].y,18[i+2].x,18[i+2].y,18[i+3].x,18[i+3].y)}H.26();if(o.2j&&2R!=1E){H.2l()}},2R:F(H){if(o.2j){H.2m();o.2j.1T(H);H.3k=(o.1O?o.1O:1)/H.2x;H.3m();z 18=o.6Q;H.28(18[0].x,18[0].y);1i(z i=0;i<18.W-1;i+=3){H.4F(18[i+1].x,18[i+1].y,18[i+2].x,18[i+2].y,18[i+3].x,18[i+3].y)}H.36=o.2j.2o;H.26();H.2l()}},71:F(H){H.3m();z 18=o.6Q;H.28(18[0].x,18[0].y);1i(z i=0;i<18.W-1;i+=3){H.4F(18[i+1].x,18[i+1].y,18[i+2].x,18[i+2].y,18[i+3].x,18[i+3].y)}},3R:F(2b){z 13=2b.5a("4z://4K.4C.3Z/4V/3W","1e");z 18=o.6Q;z T="M"+18[0].x+","+18[0].y;1i(z i=0;i<18.W-1;i+=3){T+=" C"+18[i+1].x+","+18[i+1].y+","+18[i+2].x+","+18[i+2].y+","+18[i+3].x+","+18[i+3].y}13.1H("d",T);13.1H("2v","aM");13.1H("26","6u");13.1H("26-P",o.1O?o.1O/4:1/4);G 13}};I.1X(bu,"I.14.bu")})(I.14);(F(19){z 7n=19.7n=F(){};7n.1q={ls:F(x,y,w,h){o.x=x;o.y=y;o.kx=w;o.ky=h},g0:F(){G(o.P!=1c)?o.P:o.an},ga:F(){G(o.V!=1c)?o.V:o.aJ},4s:F(7C,7F){if(7C==1c){G 7F}if(7F==1c){G 7C}G 7C+7F},3q:F(7C,7F){if(7C==1c){G 7F}if(7F==1c){G 7C}G S.3q(7C,7F)},fM:F(1a){if(1a.x<o.x||1a.x>o.x+o.kx||1a.y<o.y||1a.y>o.y+o.ky){G 1c}G o},3R:F(2b){G 1c},9I:19.cj.ca};I.1X(7n,"I.14.7n")})(I.14);(F(19){z 9H=19.9H=F(x,y){1L.5u(9H,o);o.x=x;o.y=y;o.5r=[]};9H.1q={37:F(H,5K,8P){z ki=H.cX;if(o.2G){H.cX=o.2G}if(o.ej){o.ej.l0();o.ej=1c}if(o.x||o.y||o.2I||o.3h){H.2m();z ds;if(o.x!==1M){H.5A(o.x,o.y);ds=H.6G.3a();H.6G.5A(o.x,o.y)}if(o.3h){H.2m();H.5A(o.2r.x,o.2r.y);H.aA(o.3h*S.1P/3y);H.5A(-o.2r.x,-o.2r.y)}if(o.2I){if(1L.9F(I.14.1n,o.2I)){H.3m();o.2I.hh(H);H.2I()}1b{if(1L.9F(I.14.2s,o.2I)){o.2I.71(H,1E);H.2I()}}}o.e7(H,5K,8P);if(o.3h){H.2l()}if(o.dw){o.dw(H,5K,8P)}if(ds){H.6G=ds}H.2l()}1b{o.e7(H,5K,8P);if(o.dw){o.dw(H,5K,8P)}}H.cX=ki},e7:F(H,5K,8P){1i(z i=0;i<o.5r.W;i++){z 8f=o.5r[i];z 9I=8f.9I;if(33 9I=="1M"){9I=19.cj.ca}if(9I==19.cj.ca){if(8P&&8f.2R){8f.2R(H)}1b{8f.37(H,5K)}}}},3R:F(2b){z g=2b.5a("4z://4K.4C.3Z/4V/3W","g");if(o.x||o.y||o.3h){z 1D="";if(o.x||o.y){1D="5A("+o.x+" "+o.y+")"}if(o.3h){1D+=" aA("+o.3h+" "+o.2r.x+" "+o.2r.y+")"}g.1H("1D",1D)}if(o.2I){z dQ="2I"+ ++2b.kS;z 2I=2b.5a("4z://4K.4C.3Z/4V/3W","4m");2I.1H("id",dQ);2b.kW.aN(2I);z gN=o.2I.3R(2b);2I.aN(gN);g.1H("2I-1e","6g(#"+dQ+")")}z 3v=1Q;1i(z i=0;i<o.5r.W;i++){if(o.5r[i].3R){z 13=o.5r[i].3R(2b);if(13!=1c){g.aN(13);3v=1E}}}if(3v){G 1c}G g}};I.1X(9H,"I.14.9H",19.7n)})(I.14);I.14.bD=F(p,a,b){o.p=p;o.a=a;o.b=b};I.14.bD.1q={lp:F(){G S.4u(o.ew())},ew:F(){if(o.a===o.b){G o.bk(o.p,o.a)}z dx=o.b.x-o.a.x;z dy=o.b.y-o.a.y;z 7G=(o.p.x-o.a.x)*dx+(o.p.y-o.a.y)*dy;if(7G<0){G o.bk(o.a,o.p)}7G=(o.b.x-o.p.x)*dx+(o.b.y-o.p.y)*dy;if(7G<0){G o.bk(o.b,o.p)}G o.he(o.p,o.a,o.b)},bk:F(3I,3w){G(3I.x-3w.x)*(3I.x-3w.x)+(3I.y-3w.y)*(3I.y-3w.y)},he:F(p,a,b){if(a===b){G o.bk(p,a)}z dx=b.x-a.x;z dy=b.y-a.y;z dU=(p.y-a.y)*dx-(p.x-a.x)*dy;G dU*dU/(dx*dx+dy*dy)}};I.1X(I.14.bD,"I.14.bD");(F(19){z 93=19.93=F(x,y,P,V){if(3S.W==1){z K=x;x=K.x;y=K.y;P=K.P;V=K.V}o.x=x;o.y=y;o.P=P;o.V=V;o.1D=O 19.2H()};93.1q={3a:F(){G O 93(o.x,o.y,o.P,o.V)},37:F(H){H.2m();H.1D.1T(H,o.1D.1W());H.5x=I.3t.Y.5B(H,o.1p,o.2N());H.36=o.1S;H.3k=(o.1O?o.1O:1)/H.2x;19.7J.1T(H,o.92);z x=o.x;z y=o.y;z w=o.P;z h=o.V;z eq=0.lv;ox=(w/2)*eq,oy=(h/2)*eq,de=x+w,df=y+h,8h=x+w/2,7A=y+h/2;H.3m();H.28(x,7A);H.4F(x,7A-oy,8h-ox,y,8h,y);H.4F(8h+ox,y,de,7A-oy,de,7A);H.4F(de,7A+oy,8h+ox,df,8h,df);H.4F(8h-ox,df,x,7A+oy,x,7A);H.cs();H.2v();H.26();H.2l()},2N:F(K){G O I.14.1n(o.x,o.y,o.P,o.V)},6v:F(){G o.x+", "+o.y+", "+o.P+", "+o.V},3R:F(2b){z cx=o.x+o.P/2;z cy=o.y+o.V/2;z rx=o.P/2;z ry=o.V/2;z 7L=2b.5a("4z://4K.4C.3Z/4V/3W","7L");if(o.1D){7L.1H("1D",o.1D.9Q())}7L.1H("cx",cx);7L.1H("cy",cy);7L.1H("rx",rx);7L.1H("ry",ry);G 7L},1D:1c,1S:"6u",1p:"6y"};I.1X(93,"I.14.93")})(I.14);(F(19){z 4Q=19.4Q=F(2n,1G,7l,7k,8m){o.2n=2n;o.1G=1G;o.7l=7l;o.7k=7k;o.8m=8m};4Q.1q.6v=F(1j){z 1G=o.1G;if(1j){1G*=1j}z 1R="";if(o.7l){1R+="7l "}if(o.7k){1R+="7k "}1R+=1G+"px "+o.2n;G 1R};4Q.3T=F(1R){G O 4Q(1R.2n,1R.1G,1R.7l,1R.7k,1R.8m)};4Q.mR=O 4Q("bj-bm",3);I.1X(4Q,"I.14.4Q")})(I.14);I.14.6b=F(ht,hv,hx){o.4d=ht;o.4c=hv;o.1B=hx};I.14.6b.tm=[32,9B,5V,4q,32,74,97,9l,97,83,99,4q,5f,gS,6N,44,32,6N,4q,5f,97,cL,32,9l,7E,4q,at,5f,5V,8k];I.14.6b.mo=[32,9B,5V,4q,32,65,83,80,46,78,69,84,32,77,86,67,44,32,6N,4q,5f,97,cL,32,9l,7E,4q,at,5f,5V,8k];I.14.6b.mr=[32,9B,5V,4q,32,65,83,80,46,78,69,84,44,32,6N,4q,5f,97,cL,32,9l,7E,4q,at,5f,5V,8k];I.14.6b.n8=[32,9B,5V,4q,32,65,83,80,46,78,69,84,44,32,9l,53,46,52,46,49,32,98,7E,6N,97];I.14.6b.mW=[32,9B,5V,4q,32,74,97,9l,97,83,99,4q,5f,gS,6N,44,32,86,50,46,51,46,49,32,98,7E,6N,97];I.14.6b.nk=[32,9B,5V,4q,32,65,83,80,46,78,69,84,32,77,86,67,44,32,49,46,55,32,98,7E,6N,97,32];I.1X(I.14.6b,"I.14.6b");I.14.4e={mN:0,hf:1,b4:2,1u:3,fj:4,hm:5,bM:6,hk:7,mM:8,hi:9,fy:F(6q){5I(6q){1s o.hf:G 3F;1s o.hm:G kH;1s o.fj:G 1;1s o.bM:G 25.4;1s o.1u:G 72;1s o.b4:G 96;1s o.hk:G 96;1s o.hi:G 2.54}G 1},9z:F(hj,gK,gD){G hj*o.fy(gD)/o.fy(gK)},az:F(6q){G o.9z(1,o.b4,6q)},kr:F(6q){G o.9z(1,o.bM,6q)},lj:F(6q){if(6q==o.fj){G 8}G 10}};(F(19){19.bc=F(J){o.fe=1E;o.3B=O bc();o.J=J;o.1D=O 19.2H();o.4m=O 19.2s();o.1l=o.5n.4X;o.3W=1E;o.ck=19.3V.d6};19.bc.1q={6W:F(){G o.1l},7v:F(J,1B){o.J=J;z 1W=O 19.2H();if(1B!==0){1W.8o(1B,o.J.x+o.J.P/2,o.J.y+o.J.V/2)}o.3h=1B;o.1D=1W},2N:F(){G o.J},37:F(H){if(o.3B==1c){G}if(o.3B.cM!==""&&o.fe){if(!o.4m.3v()){H.2m();o.4m.71(H);H.2l();H.2m();H.2I()}z 1j=19.4e.az(H.gC);z gA=o.3W?{x:o.J.P*1j,y:o.J.V*1j}:{x:o.3B.P*1j,y:o.3B.V*1j};z 7u=o.e5(o.J,gA);H.2m();if(o.3W){z 7a=o.hw(H,7u);H.gt(1,0,0,1,0,0);z 1W=O 19.2H();if(o.3h!==0){1W.8o(o.3h,7a.x+7a.P/2,7a.y+7a.V/2)}H.1D.1T(H,1W.1W());H.4f(o.3B,7a.x,7a.y,7a.P,7a.V)}1b{H.1D.1T(H,o.1D.1W());H.4f(o.3B,7u.x,7u.y,7u.P,7u.V)}H.2l();if(!o.4m.3v()){H.2l()}}},hw:F(H,7u){z J=7u.3a();z 1W=H.6G;z p=J.6m();1W.8d(p);J.x=p.x;J.y=p.y;J.P*=H.2x;J.V*=H.2x;G J},3d:F(3L,ho){z 4e=19.4e;z 9L=19.7n.H;o.an=o.3B.P?4e.9z(o.3B.P,4e.b4,9L.62):1c;o.aJ=o.3B.V?4e.9z(o.3B.V,4e.b4,9L.62):1c},g0:F(){G o.an},ga:F(){G o.aJ},e5:F(gJ,1U){z ck=o.ck;z 4l=0,4h=0,4S=1U.x,4T=1U.y,K=gJ;5I(ck){1s 19.3V.gn:4l=K.1z();4h=K.1F();1m;1s 19.3V.eB:4l=K.1z();4h=K.1v()-4T;1m;1s 19.3V.dI:4l=K.1t()-4S;4h=K.1F();1m;1s 19.3V.dD:4l=K.1t()-4S;4h=K.1v()-4T;1m;1s 19.3V.4p:4l=(K.1t()+K.1z()-4S)/2;4h=(K.1v()+K.1F()-4T)/2;1m;1s 19.3V.ev:4l=K.x+K.P/2-4S/2;4h=K.y;1m;1s 19.3V.e8:4l=K.x+K.P/2-4S/2;4h=K.1v()-4T;1m;1s 19.3V.ec:4l=K.x;4h=K.y+K.V/2-4T/2;1m;1s 19.3V.eu:4l=K.1t()-4S;4h=K.y+K.V/2-4T/2;1m;1s 19.3V.d6:z h=K.V;z w=K.P;if(h==0){1m}z gY=w/h;z ba=4S/4T;if(gY>ba){4T=h;4S=(ba*4T);4h=K.1F();4l=(K.1t()+K.1z()-4S)/2}1b{4S=w;if(ba==0){1m}4T=(4S/ba);4l=K.1z();4h=(K.1v()+K.1F()-4T)/2}1m;1s 19.3V.9p:4S=K.1t()-K.1z();4T=K.1v()-K.1F();4l=K.1z();4h=K.1F();1m;1s 19.3V.e4:4l=K.1z();4h=K.1F();1m}G O 19.1n(4l,4h,4S,4T)},gX:F(){G o.3B.cM},hc:F(T){o.3B.cM=T},hr:F(){G""},3R:F(2b){z 13=2b.5a("4z://4K.4C.3Z/4V/3W","3B");13.uf("4z://4K.4C.3Z/ut/v0","av",o.3B.cM);z 1U={x:o.3B.P,y:o.3B.V};z ay=o.e5(o.J,1U);13.1H("x",ay.x+"px");13.1H("y",ay.y+"px");13.1H("P",ay.P+"px");13.1H("V",ay.V+"px");if(o.1D){13.1H("1D",o.1D.9Q())}G 13},J:1c,1D:1c,3B:1c,ux:19.dV.9p,uA:19.dV.9p};I.1X(19.bc,"I.14.bc")})(I.14);(F(19){z bd=19.bd=F(1w,1y,1C,1J){o.1w=1w;o.1y=1y;o.1C=1C;o.1J=1J;o.1D=O 19.2H();o.1S="6u";o.1O=0};bd.1q={37:F(H,2R){if(o.4m&&!o.4m.3v()){o.4m.71(H);H.2m();H.2I()}if(o.2j&&2R!=1E){H.2m();o.2j.1T(H)}H.36=o.1S;H.3k=(o.1O?o.1O:1)/H.2x;19.7J.1T(H,o.92);H.3m();H.28(o.1w,o.1y);H.23(o.1C,o.1J);H.26();if(o.2j&&2R!=1E){H.2l()}if(o.4m&&!o.4m.3v()){H.2l()}},2R:F(H){if(o.2j){H.2m();o.2j.1T(H);H.3k=(o.1O?o.1O:1)/H.2x;H.3m();H.28(o.1w,o.1y);H.23(o.1C,o.1J);H.36=o.2j.2o;H.26();H.2l()}},7v:F(2t,2q){o.1w=2t.x;o.1y=2t.y;o.1C=2q.x;o.1J=2q.y},gy:F(1S){o.1S=1S},3R:F(2b){z 2c=2b.5a("4z://4K.4C.3Z/4V/3W","2c");if(o.1D){2c.1H("1D",o.1D.9Q())}2c.1H("1w",o.1w);2c.1H("1C",o.1C);2c.1H("1y",o.1y);2c.1H("1J",o.1J);if(o.1S){2c.1H("26",o.1S)}2c.1H("26-P",o.1O?o.1O/4:1/4);G 2c}};I.1X(bd,"I.14.bd")})(I.14);I.14.2H=F(){o.1k=[];o.1k[0]=1;o.1k[1]=0;o.1k[2]=0;o.1k[3]=1;o.1k[4]=0;o.1k[5]=0};I.14.2H.kd=F(gH){z m=O I.14.2H();m.1k=gH;G m};I.14.2H.1q={1W:F(){G o.1k},uN:F(){if(o.1k[0]==1&&o.1k[1]==0&&o.1k[2]==0&&o.1k[3]==1&&o.1k[4]==0&&o.1k[5]==0){G 1Q}G 1E},3a:F(){z 1W=O I.14.2H();1W.1k=o.1k.6t(0);G 1W},5A:F(x,y){o.1k[4]+=o.1k[0]*x+o.1k[2]*y;o.1k[5]+=o.1k[1]*x+o.1k[3]*y},1j:F(sx,sy){o.1k[0]*=sx;o.1k[1]*=sx;o.1k[2]*=sy;o.1k[3]*=sy},uK:F(sx,sy,K){z x=K.x+K.P/2;z y=K.y+K.V/2;o.5A(x,y);o.1j(sx,sy);o.5A(-x,-y)},aA:F(1B){1B=(1B*S.1P)/3y;z 3f=S.3f(1B).bV(3);z 3j=S.3j(1B).bV(3);z a=o.1k[0];z b=o.1k[1];z c=o.1k[2];z d=o.1k[3];o.1k[0]=a*3j-b*3f;o.1k[1]=a*3f+b*3j;o.1k[2]=c*3j-d*3f;o.1k[3]=c*3f+d*3j},8o:F(1B,x,y){if(x 6d I.14.1u){y=x.y;x=x.x}1B=1B*S.1P/3y;o.5A(x,y);z 3f=S.3f(1B).bV(3);z 3j=S.3j(1B).bV(3);z a=o.1k[0];z b=o.1k[1];z c=o.1k[2];z d=o.1k[3];o.1k[0]=a*3j-b*3f;o.1k[1]=a*3f+b*3j;o.1k[2]=c*3j-d*3f;o.1k[3]=c*3f+d*3j;o.5A(-x,-y)},gG:F(){z gM=o.1k[0]*(o.1k[3]*1-o.1k[5]*0)-o.1k[1]*(o.1k[2]*1-0*o.1k[4])+0*(o.1k[2]*o.1k[5]-o.1k[3]*o.1k[4]);z 8i=1/gM;z 3s=O I.14.2H();3s.1k[0]=(o.1k[3]*1-o.1k[5]*0)*8i;3s.1k[1]=(o.1k[4]*o.1k[5]-o.1k[1]*1)*8i;3s.1k[2]=(0*o.1k[4]-o.1k[2]*1)*8i;3s.1k[3]=(o.1k[0]*1-0*o.1k[4])*8i;3s.1k[4]=(o.1k[2]*o.1k[5]-o.1k[4]*o.1k[3])*8i;3s.1k[5]=(o.1k[4]*o.1k[1]-o.1k[0]*o.1k[5])*8i;G 3s},8d:F(1a){z x=1a.x;z y=1a.y;1a.x=o.1k[0]*x+o.1k[2]*y+o.1k[4];1a.y=o.1k[1]*x+o.1k[3]*y+o.1k[5]},bX:F(18){1i(z i=0;i<18.W;i++){o.8d(18[i])}},b9:F(K){z 18=K.hg();o.bX(18);G I.14.1n.hl(18)},9Q:F(){z 1D="1W(";1i(z i=0;i<o.1k.W;i++){1D+=o.1k[i];if(i<o.1k.W-1){1D+=","}1b{1D+=")"}}G 1D}};I.1X(I.14.2H,"I.14.2H");(F(19){z 2s=19.2s=F(95){o.tP=1c;o.1x=1c;o.1e=1c;o.1p=1c;o.1S=1c;o.1f=1c;o.8c=1c;o.89=1c;o.8R=2Y.3i;o.8U=2Y.3i;o.4W=0;o.9n=0;o.1O=0;o.aX="sS";o.1D=O 19.2H();o.fu=95;o.bZ();if(95!=1c){z gu=["M","L","B","Q","A","Z","C","E","R","U"];z i=0;3z(i<gu.W){z g8=gu[i];95=95.5F(O fP(g8,"g"),":"+g8);i++}z hq=95.1V(":");o.9J=hq.d9(3E);o.8Y();o.fr()}};2s.1q={7v:F(J){o.J=J;o.gO()},bZ:F(){o.1x=[]},3a:F(){z 1e=O 2s();1e.8R=o.8R;1e.8U=o.8U;1e.4W=o.4W;1e.9n=o.9n;1e.1x=o.1x;1e.1S=o.1S;1e.1p=o.1p;1e.1D=O 19.2H();G 1e},6W:F(){G o.5n.4X},3v:F(){if(o.1x.W===0){G 1Q}G 1E},8Y:F(){19.ah.8Y(o.9J,o)},71:F(H,eD){if(eD==1E){H.2m()}if(o.1D){H.1D.1T(H,o.1D.1W())}H.3m();z p=o.1x;z l=p.W;if(l>0){z i=0;3z(i<l){5I(p[i]){1s"M":H.28(p[i+1],p[i+3]);i+=4;1m;1s"L":H.23(p[i+1],p[i+3]);i+=4;1m;1s"C":H.4F(p[i+1],p[i+3],p[i+5],p[i+7],p[i+9],p[i+11]);i+=12;1m;1s"Q":H.7f(p[i+1],p[i+3],p[i+5],p[i+7]);i+=8;1m;1s"A":H.dO(p[i+1],p[i+3],p[i+5],p[i+7],p[i+9],p[i+11]);i+=12;1m;1s"R":H.K(p[i+1],p[i+3],p[i+5],p[i+7]);i+=8;1m;1s"E":H.28(p[i+1],p[i+3]-p[i+7]/2);H.4F(p[i+1]+p[i+5]/2,p[i+3]-p[i+7]/2,p[i+1]+p[i+5]/2,p[i+3]+p[i+7]/2,p[i+1],p[i+3]+p[i+7]/2);H.4F(p[i+1]-p[i+5]/2,p[i+3]+p[i+7]/2,p[i+1]-p[i+5]/2,p[i+3]-p[i+7]/2,p[i+1],p[i+3]-p[i+7]/2);i+=8;1m;1s"U":H.fw(p[i+1],p[i+3],p[i+5],p[i+7],p[i+9]);i+=10;1m;1s"Z":if(H.cs){H.cs()}j0:i+=1}}}if(eD==1E){H.2l()}},37:F(H,2R){H.2m();o.71(H);if(o.2j&&2R!=1E){o.2j.1T(H)}if(o.1p){H.5x=I.3t.Y.5B(H,o.1p,o.2N());H.2v()}H.2l();if(o.1S){H.36=I.3t.Y.5B(H,o.1S,o.2N(),1Q);H.3k=(o.1O?o.1O:1)/H.2x;19.7J.1T(H,o.92);H.aX=o.aX;H.26()}},2R:F(H){if(o.2j){H.2m();o.71(H);o.2j.1T(H);if(o.1p){H.5x=o.2j.2o;H.2v()}1b{if(o.1S){H.36=o.2j.2o;H.3k=(o.1O?o.1O:1)/H.2x;H.aX=o.aX;H.26()}}H.2l()}},fr:F(){if(o.1x){o.1e=o.1x.sM("")}o.aL()},28:F(x,y){o.1x.1h("M");o.1x.1h(x);o.1x.1h(",");o.1x.1h(y);o.8c=x;o.89=y;o.4E(x,y)},23:F(x,y){o.1x.1h("L");o.1x.1h(x);o.1x.1h(",");o.1x.1h(y);o.8c=x;o.89=y;o.4E(x,y)},fk:F(1w,1y,1C,1J,2Z,2P){o.1x.1h("C");o.1x.1h(1w);o.1x.1h(",");o.1x.1h(1y);o.1x.1h(",");o.1x.1h(1C);o.1x.1h(",");o.1x.1h(1J);o.1x.1h(",");o.1x.1h(2Z);o.1x.1h(",");o.1x.1h(2P);o.8c=2Z;o.89=2P;o.4E(1w,1y);o.4E(1C,1J);o.4E(2Z,2P)},8O:F(x,y,24,21,2a,4a){o.1x.1h("A");o.1x.1h(x);o.1x.1h(",");o.1x.1h(y);o.1x.1h(",");o.1x.1h(24);o.1x.1h(",");o.1x.1h(21);o.1x.1h(",");o.1x.1h(2a);o.1x.1h(",");o.1x.1h(4a);o.8c=x;o.89=y;z r=+24;o.4E(+x-r,+y-r);o.4E(+x+r,+y+r)},7f:F(1w,1y,x,y){o.1x.1h("Q");o.1x.1h(1w);o.1x.1h(",");o.1x.1h(1y);o.1x.1h(",");o.1x.1h(x);o.1x.1h(",");o.1x.1h(y);o.8c=x;o.89=y;o.4E(1w,1y);o.4E(x,y)},fL:F(x,y,P,V){o.1x.1h("R");o.1x.1h(x);o.1x.1h(",");o.1x.1h(y);o.1x.1h(",");o.1x.1h(P);o.1x.1h(",");o.1x.1h(V);o.8c=x+P;o.89=y+V;o.4E(x,y);o.4E(x+P,y+V)},aD:F(J,2U){o.28(J.x,J.y+2U);o.23(J.x,J.y+J.V-2U);o.7f(J.x,J.y+J.V,J.x+2U,J.y+J.V);o.23(J.x+J.P-2U,J.y+J.V);o.7f(J.x+J.P,J.y+J.V,J.x+J.P,J.y+J.V-2U);o.23(J.x+J.P,J.y+2U);o.7f(J.x+J.P,J.y,J.x+J.P-2U,J.y);o.23(J.x+2U,J.y);o.7f(J.x,J.y,J.x,J.y+2U)},fw:F(1w,1y,1C,1J,24){z J=I.14.1n.9f(O I.14.1u(1w,1y),O I.14.1u(1C,1J));o.aD(J,24)},t2:F(x,y,P,V){o.1x.1h("E");o.1x.1h(x);o.1x.1h(",");o.1x.1h(y);o.1x.1h(",");o.1x.1h(P);o.1x.1h(",");o.1x.1h(V);o.8c=x;o.89=y;o.4E(x-P,y-V);o.4E(x+P,y+V)},9A:F(){o.1x.1h("Z")},t3:F(1p){o.1p=1p;o.aL()},gy:F(1S){o.1S=1S;o.aL()},gR:F(1f){o.1f=1f;o.aL()},7d:F(t4){},2N:F(){G O 19.1n(o.8R,o.8U,o.4W-o.8R,o.9n-o.8U)},4E:F(x,y){o.8R=S.2Q(o.8R,x);o.8U=S.2Q(o.8U,y);o.4W=S.3q(o.4W,x);o.9n=S.3q(o.9n,y)},gO:F(){},aL:F(){},3R:F(2b){z 13=2b.5a("4z://4K.4C.3Z/4V/3W","1e");if(o.1D){13.1H("1D",o.1D.9Q())}if(o.fu){13.1H("d",o.fu||o.1e)}1b{if(!o.1e){o.fr()}13.1H("d",o.1e)}if(o.1p){13.1H("2v",I.3t.Y.5B(1c,o.1p,o.2N()))}1b{13.1H("2v","aM")}if(o.1S){13.1H("26",o.1S)}13.1H("26-P",o.1O?o.1O/4:1/4);G 13},1D:1c};2s.9f=F(18){z 1e=O 2s(1c);1i(z i=0;i<18.W;i++){1e.28(18[i].x,18[i].y)}G 1e};I.1X(2s,"I.14.2s")})(I.14);(F(19){z ah=19.ah=F(){};ah.8Y=F(9J,7c){z 6E=0;z 6O=0;1i(z i=0;i<9J.W;i++){z 1K=9J[i];z c=9J[i][0];5I(c){1s"M":1K=1K.3e(1,1K.W);z x=+1K.1V(",")[0];z y=+1K.1V(",")[1];7c.28(x,y);6E=x;6O=y;1m;1s"L":1K=1K.3e(1,1K.W);z x=+1K.1V(",")[0];z y=+1K.1V(",")[1];7c.23(x,y);6E=x;6O=y;1m;1s"B":1K=1K.3e(1,1K.W);z 1w=+1K.1V(",")[0];z 1y=+1K.1V(",")[1];z 1C=+1K.1V(",")[2];z 1J=+1K.1V(",")[3];z 2Z=+1K.1V(",")[4];z 2P=+1K.1V(",")[5];7c.fk(1C,1J,2Z,2P,1w,1y);6E=1w;6O=1y;1m;1s"C":1K=1K.3e(1,1K.W);z 1w=+1K.1V(",")[0];z 1y=+1K.1V(",")[1];z 1C=+1K.1V(",")[2];z 1J=+1K.1V(",")[3];z 2Z=+1K.1V(",")[4];z 2P=+1K.1V(",")[5];7c.fk(1w,1y,1C,1J,2Z,2P);6E=2Z;6O=2P;1m;1s"Q":1K=1K.3e(1,1K.W);z 1w=+1K.1V(",")[0];z 1y=+1K.1V(",")[1];z x=+1K.1V(",")[2];z y=+1K.1V(",")[3];7c.7f(1w,1y,x,y);6E=x;6O=y;1m;1s"A":1K=1K.3e(1,1K.W);z fD=+1K.1V(",")[0];z db=+1K.1V(",")[1];z gz=+1K.1V(",")[2];z fI=+1K.1V(",")[3];z 8W=+1K.1V(",")[4];8W=8W==0?1:0;z x=+1K.1V(",")[5];z y=+1K.1V(",")[6];z 3I=O I.14.1u(6E,6O);z 3w=O I.14.1u(x,y);z 88=O I.14.2H();88.aA(-gz);88.1j(db/fD,1);88.8d(3I);88.8d(3w);z fi=O I.14.1u((3I.x+3w.x)/2,(3I.y+3w.y)/2);z aa=O I.14.1Z(3w.x-3I.x,3w.y-3I.y);z fh=aa.W()/2;z 7h;if(fI==8W){7h=O I.14.1Z(-aa.y,aa.x)}1b{7h=O I.14.1Z(aa.y,-aa.x)}if(7h.x!=0||7h.y!=0){7h=7h.gB()}z d2=db*db-fh*fh;z fG=d2>0?S.4u(d2):0;z 1d=O I.14.1u(fi.x+fG*7h.x,fi.y+fG*7h.y);z 6r=S.dq(3I.y-1d.y,3I.x-1d.x);z 6s=S.dq(3w.y-1d.y,3w.x-1d.x);if(fI==(S.39(6s-6r)<S.1P)){if(6r<6s){6r+=2*S.1P}1b{6s+=2*S.1P}}21=(6r*3y/S.1P)%7U;if(8W){6r=(6r<0)?2*S.1P-S.39(6r):6r;6s=(6s<0)?2*S.1P-S.39(6s):6s}z 2a=(6s*3y/S.1P)%7U;au=((6s-6r)*3y/S.1P)%7U;21=(21<0)?(7U-S.39(21)):21;if(!8W){au=(au<0)?(7U-S.39(au)):au}88=88.gG();88.8d(1d);21=21*S.1P/3y;2a=2a*S.1P/3y;if(21==2a){2a+=2*S.1P}7c.8O(1d.x,1d.y,fD,21,2a,8W);6E=x;6O=y;1m;1s"U":1K=1K.3e(1,1K.W);z 1w=+1K.1V(",")[0];z 1y=+1K.1V(",")[1];z 1C=+1K.1V(",")[2];z 1J=+1K.1V(",")[3];z 24=+1K.1V(",")[4];7c.fw(1w,1y,1C,1J,24);6E=1w;6O=1y;1m;1s"Z":7c.9A();1m}}};I.1X(ah,"I.14.ah")})(I.14);I.14.1u=F(x,y){o.x=x;o.y=y;o.1l=o.5n.4X};I.14.1u.5E=F(2t,2q){G S.4u(S.2J((2q.x-2t.x),2)+S.2J((2q.y-2t.y),2))};I.14.1u.gQ=F(2t,2q){z dy=2q.y-2t.y;z dx=2q.x-2t.x;G S.dq(dy,dx)/S.1P*3y};I.14.1u.dk=F(1a,4G){z p=1a.3a();p.dk(4G);G p};I.14.1u.1q={6W:F(){G o.1l},3v:F(){G(o.x===0&&o.y===0)},5E:F(1a){G S.4u(S.2J((o.x-1a.x),2)+S.2J((o.y-1a.y),2))},gQ:F(1a){z dy=1a.y-o.y;z dx=1a.x-o.x;G S.dq(dy,dx)/S.1P*3y},dk:F(4G){o.x+=4G.x;o.y+=4G.y;G o},sB:F(dx,dy){z p=o.3a();p.x+=dx;p.y+=dy;G p},ef:F(1a){if(!1a){G 1E}G(o.x===1a.x&&o.y===1a.y)},3a:F(){z 1a=O I.14.1u(o.x,o.y);G 1a}};I.1X(I.14.1u,"I.14.1u");(F(19){z 2f=I.2h.2f;z 1n=19.1n=F(x,y,P,V){if(y 6d I.14.4r){P=y.P;V=y.V}if(x 6d I.14.1u){y=x.y;x=x.x}o.x=x;o.y=y;o.P=P;o.V=V;o.1D=O 19.2H();o.1l=o.5n.4X};1n.8w=F(l,t,r,b){G O 1n(S.2Q(l,r),S.2Q(t,b),S.39(r-l),S.39(b-t))};1n.sp=F(35){G O 1n(35[0],35[1],35[2],35[3])};1n.9f=F(2t,2q){G 1n.8w(2t.x,2t.y,2q.x,2q.y)};1n.st=F(1a,1G){z w=1G.P;z h=1G.V;G O 1n(1a.x-w/2,1a.y-h/2,w,h)};1n.tE=F(1a,1G){G O 1n(1a.x,1a.y,1G.P,1G.V)};1n.tu=F(v){z w=v.P;z h=v.V;G O 1n(v.x-w/2,v.y-h/2,w,h)};1n.hl=F(18){z l=2Y.3i;z t=2Y.3i;z r=2Y.hd;z b=2Y.hd;2f.41(18,F(1a){l=S.2Q(l,1a.x);t=S.2Q(t,1a.y);r=S.3q(r,1a.x);b=S.3q(b,1a.y)});G 1n.8w(l,t,r,b)};1n.1q={6W:F(){G o.1l},tz:F(){G(o.P===0&&o.V===0)},1t:F(){G S.3q(o.x,o.x+o.P)},1z:F(){G S.2Q(o.x,o.x+o.P)},1v:F(){G S.3q(o.y,o.y+o.V)},1F:F(){G S.2Q(o.y,o.y+o.V)},1d:F(){G O 19.1u(o.1z()+o.P/2,o.1F()+o.V/2)},6m:F(){G O 19.1u(o.1z(),o.1F())},cv:F(){G O 19.1u(o.1t(),o.1F())},tH:F(){G O 19.1u(o.x+o.P/2,o.1F())},cz:F(){G O 19.1u(o.1z(),o.1v())},5s:F(){G O 19.1u(o.1t(),o.1v())},tJ:F(K){G!(o.el(K)===1n.3v)},tI:F(K){if(o.1v()<=K.1F()){G 1E}if(o.1F()>=K.1v()){G 1E}if(o.1z()>=K.1t()){G 1E}if(o.1t()<=K.1z()){G 1E}G 1Q},5W:F(K){if(K){if(K 6d I.14.1n){if(o.85(K.cz())&&o.85(K.5s())&&o.85(K.6m())&&o.85(K.cv())){G 1Q}}1b{if(K 6d I.14.1u){if(o.85(K)){G 1Q}}}}G 1E},85:F(1a){G o.1z()<=1a.x&&o.1t()>=1a.x&&o.1F()<=1a.y&&o.1v()>=1a.y},h0:F(K){if(!K){G o}z 1z=S.2Q(o.1z(),K.1z());z 1t=S.3q(o.1t(),K.1t());z 1F=S.2Q(o.1F(),K.1F());z 1v=S.3q(o.1v(),K.1v());G O 1n(1z,1F,1t-1z,1v-1F)},el:F(K){if(o.1v()<K.1F()){G 1n.3v}if(o.1F()>K.1v()){G 1n.3v}if(o.1z()>K.1t()){G 1n.3v}if(o.1t()<K.1z()){G 1n.3v}z 1z=S.3q(o.1z(),K.1z());z 1t=S.2Q(o.1t(),K.1t());z 1v=S.2Q(o.1v(),K.1v());z 1F=S.3q(o.1F(),K.1F());G O 1n(1z,1F,1t-1z,1v-1F)},3a:F(){G O 1n(o.x,o.y,o.P,o.V)},37:F(H,2R){H.2m();H.1D.1T(H,o.1D.1W());H.3m();H.K(o.x,o.y,o.P,o.V);H.2m();if(o.2j&&2R!=1E){o.2j.1T(H)}if(o.1p){H.5x=I.3t.Y.5B(H,o.1p,o.2N());H.2v()}H.2l();if(o.1S){H.36=o.1S;H.3k=(o.1O?o.1O:1)/H.2x;19.7J.1T(H,o.92);H.26()}H.2l()},2R:F(H){if(o.2j){H.2m();o.2j.1T(H);H.1D.1T(H,o.1D.1W());H.3m();H.K(o.x,o.y,o.P,o.V);H.5x=o.2j.2o;H.2v();H.2l()}},hh:F(H){H.K(o.x,o.y,o.P,o.V)},2N:F(K){G O I.14.1n(o.x,o.y,o.P,o.V)},7v:F(K){o.x=K.x;o.y=K.y;o.P=K.P;o.V=K.V},ku:F(1a){o.x=1a.x;o.y=1a.y},te:F(1a){o.x=1a.x-o.P/2;o.y=1a.y-o.V/2},dW:F(6V){if(!6V){G o}z ge=1n.8w(o.x-6V,o.y-6V,o.1t()+6V,o.1v()+6V);G ge},bb:F(x,y){o.x+=x;o.y+=y},hg:F(){G[o.6m(),o.cv(),o.5s(),o.cz()]},tb:F(){G O 1n(0,0,o.P,o.V)},ef:F(K){if(!K){G 1E}G(o.x===K.x&&o.y===K.y&&o.P===K.P&&o.V===K.V)},tN:F(K){G o.P==K.P&&o.V==K.V},6v:F(){G o.x+", "+o.y+", "+o.P+", "+o.V},hu:F(){G O 19.4r(o.P,o.V)},3R:F(2b){z K=2b.5a("4z://4K.4C.3Z/4V/3W","K");K.1H("x",o.x);K.1H("y",o.y);K.1H("P",o.P);K.1H("V",o.V);K.1H("rx",0);K.1H("ry",0);z eN=o.1p;z eM=o.1S;if(eN){K.1H("2v",I.3t.Y.5B(1c,eN,o.2N()))}1b{K.1H("2v","aM")}if(eM){K.1H("26",eM)}K.1H("26-P",o.1O?o.1O/4:1/4);if(o.1D){K.1H("1D",o.1D.9Q())}G K},1D:1c,1S:"6u",1O:0,1p:"6y"};I.1X(1n,"I.14.1n");1n.3v=O 1n(0,0,0,0)})(I.14);(F(19){z b0=19.b0=F(2o,cH,cG){o.2o=2o;o.cH=cH;o.cG=cG};b0.1q={1T:F(H){H.jj=o.cH;H.jo=o.cG;H.jn=4;H.5D=o.2o},3R:F(2b){G 1c}};I.1X(b0,"I.14.b0")})(I.14);(F(19){z 2f=I.2h.2f;z eX={};z 3g=19.3g=F(1f,J){o.1f=1f;if(33 o.1f=="1M"){o.1f=""}if(!J){J=O 19.1n(0,0,1c,1c)}o.J=J;o.x=J.x;o.y=J.y;o.P=J.P;o.V=J.V;o.4m=O 19.2s();o.6a=2K.7X;o.9V=2K.7X;o.hs="cr";o.2z=O 19.6Y(1,1,1,1);o.1l=o.5n.4X};3g.1q={6W:F(){G o.1l},3a:F(){z 3T=O 3g(o.1f,o.J);3T.3h=o.3h;3T.4m=o.4m.3a();3T.6a=o.6a;3T.9V=o.9V;3T.2z=o.2z;3T.f7=o.f7;if(o.26){3T.26=o.26}if(o.1O){3T.1O=o.1O}G 3T},f8:F(H,K){o.2e=3g.gP(H,o.1f,K.P);G o.2e},37:F(H,2R){if(o.1f===""){G}z 1j=o.7t?1:H.2x;if(H.eF!=1M&&o.1R.1G*1j<H.eF){G}o.1j=1j;H.2m();if(!o.4m.3v()){o.4m.71(H);H.2I()}H.fb=o.hs;H.5x=o.1S;if(o.26){if(o.1O!==1M){H.3k=o.1O*1j}H.36=I.3t.Y.5B(H,o.26,o.J,1Q)}o.4D=o.1R.1G*1j;z 2A=o.J.3a();o.2z.gW(2A);if(!o.7t){if(H.6G){2A=H.6G.b9(2A)}H.gt(1,0,0,1,0,0);H.3k=H.3k*1j}if(o.3h){H.1D.1T(H,o.f6(2A).1W())}if(o.dg){z 3O=o.fW(o.1f);o.gV(H,3O,2A,o.6a,o.9V)}1b{H.1R=o.1R.6v(1j);if(o.f7){o.f8(H,2A);o.gZ(H,2A)}1b{if(o.6a==2K.7X){H.7T="1z"}1b{if(o.6a==2K.4p){H.7T="1d"}1b{if(o.6a==2K.7e){H.7T="1t"}}}if(o.26){if(o.1O!==1M){H.3k=o.1O*1j}H.eV(o.1f,2A.x,2A.y)}H.8b(o.1f,2A.x,2A.y)}}o.2A=2A;H.2l()},gZ:F(H,K){if(o.2e.W===0){G}z V=(K.V>0)?K.V:o.4D;z 8E=S.9x(V/(o.4D)+0.en);if(8E==0&&V>o.4D*0.9){8E=1}8E=S.2Q(8E,o.2e.W);z f5=8E*o.4D;z y=K.y;5I(o.9V){1s 2K.4p:y+=K.V/2-f5/2;1m;1s 2K.7e:y+=K.V-f5;1m}z x=K.x;5I(o.6a){1s 2K.7X:H.7T="1z";1m;1s 2K.4p:x+=K.P/2;H.7T="1d";1m;1s 2K.7e:x+=K.P;H.7T="1t";1m}if(H.fb=="cr"){y+=o.4D/2}1i(z i=0;i<8E;i++){z 2c=o.2e[i];if(!2c){6o}z 3G=y+o.4D*i;if(o.26){if(o.1O!==1M){H.3k=o.1O*H.2x}H.eV(2c,x,3G)}H.8b(2c,x,3G);if(o.1R.8m){3G+=o.4D/2;z 3d=H.6X(2c);5I(o.6a){1s 2K.7X:o.ar(H,x,3G,3d.P);1m;1s 2K.4p:o.ar(H,x-3d.P/2,3G,3d.P);1m;1s 2K.7e:o.ar(H,x-3d.P,3G,3d.P);1m}}}},tO:F(){z a=O 19.1u(o.x,o.y);z d=O 19.1u(o.x+o.P,o.y+o.V);z p=[a,d];z 1W=o.f6(o.J);1W.bX(p);G 19.1n.8w(p[0].x,p[0].y,p[1].x,p[1].y)},7v:F(J,1B){o.J=J;o.x=J.x;o.y=J.y;o.P=J.P;o.V=J.V;o.3h=1B||0},2N:F(){G o.J},tM:F(){G o.3h},tL:F(){G o.1R},tv:F(T){if(o.1R==T){G}o.1R=T},tD:F(){G o.1f},gR:F(T){if(o.1f==T){G}o.1f=T;if(33 o.1f=="1M"){o.1f=""}},f6:F(K){z 1W=O 19.2H();if(o.3h&&o.3h!==0){1W.8o(o.3h,K.x+K.P/2,K.y+K.V/2)}G 1W},gV:F(H,3O,2A,f9,fc){z x=2A.x;z y=2A.y;z P=2A.P;z V=2A.V;z 2e=o.fZ(H,3O,P);z fa=1c;z 7W=o.4D;z 9w=7W;if(H.fb=="cr"){9w/=2}if(fc==2K.4p){9w+=V/2-7W*2e.W/2}if(fc==2K.7e){9w+=V-7W*2e.W}9w+=y;H.7T="1z";z 2I=o.tC&&2e.W>1;if(2I){H.2m();H.3m();H.K(2A.x,2A.y,2A.P,2A.V);H.2I()}1i(z i=0;i<2e.W;i++){z 2c=2e[i];z lx=0;if(f9==2K.4p){lx=P/2-2c.P/2}if(f9==2K.7e){lx=P-2c.P}1i(z j=0;j<2c.W;j++){z bC=1c;z 3l=2c[j];if(3l.22!=fa){o.gr(H,3l.22);fa=3l.22;if(H.f4&&3l.22.aC){bC={aC:3l.22.aC,2G:H.cX};H.f4.1h(bC)}}z 8u=3l.22.8u;z cY=8u===0?0:o.1R.1G*H.2x*(8u>0?-1:1)/3;1i(z h=1;h<S.39(8u);h++){cY+=cY/3}z 3G=9w+3l.dy+cY;if(!2I&&(3G<y+7W/4||3G>y+V-7W/4)){6o}z tx=x+lx+3l.dx;if(o.26){if(o.1O!==1M){H.3k=o.1O*H.2x}H.eV(3l.1f,tx,3G)}H.8b(3l.1f,tx,3G);if(bC){z K=O 19.1n(tx,3G,3l.7y,7W);if(o.7t){K=6G.b9(K)}bC.K=K}if(3l.22.8m){o.ar(H,tx,3G+7W/2,3l.7y)}}}if(2I){H.2l()}},fW:F(1f){if(o.h1==1f&&o.eW){G o.eW}o.h1=1f;1f=1f.5F(/\\r\\n/g,"<br />").5F(/[\\r\\n]/g,"<br />");1f=1f.5F(/<2o=/g,"<2o T=");1f=1f.5F(/<a=/g,"<a av=");if(!3g.a5){3g.a5=3p.dB("5j")}z a5=3g.a5;a5.fK=1f;z 3O=[];o.eT(a5,3O,{});o.eW=3O;G 3O},eT:F(8l,3O,bI){z 6k=8l.6k.aT();if(6k=="#1f"){z T=8l.j4;z 4H=o.h9(T,bI);3O.1h(4H)}1b{if(6k=="br"){3O.1h(eX)}1b{if(6k=="2o"){6k+="="+8l.h8("T")}if(6k=="a"){6k+="="+8l.h8("av")}o.h2(6k,bI);1i(z i=0;i<8l.dp.W;i++){z h7=8l.dp[i];o.eT(h7,3O,bI)}o.h4(6k,bI)}}},h9:F(1f,22){G{1f:1f,7k:22.i>0,7l:22.b>0,8m:22.u>0||22.a,8u:22.h3?22.h3:0-(22.82?22.82:0),aC:22.a?22.a:1c,2o:22.4I?22.4I[22.4I.W-1]:1c}},h2:F(5C,22){if(5C.2u("2o")==0){if(!22.4I){22.4I=[]}z 2o=5C.1V("=")[1];22.4I.1h(2o);G}if(5C.2u("a=")==0){if(!22.4I){22.4I=[]}22.4I.1h("9P");z av=5C.1V("=")[1];22.a=av;G}z T=22[5C];if(!T){T=0}T++;22[5C]=T},h4:F(5C,22){if(5C.2u("2o")==0){22.4I.h6();G}if(5C.2u("a")==0){22.4I.h6();22.a=1c;G}22[5C]--},ar:F(H,x,y,W){if(!o.26){if(o.1O!==1M){H.3k=o.1O*H.2x}H.36=H.5x}if(H.87){H.87([])}H.3m();H.28(x,y);H.23(x+W,y);H.26()},fZ:F(H,3O,P){z 2e=[];z 2c=[];2c.P=0;z 5J=1Q;z cx=0;z cy=0;z 4D=o.4D;F eY(){2e.1h(2c);2c=[];2c.P=0;cy+=4D;cx=0;5J=1Q}1i(z i=0;i<3O.W;i++){z 4H=3O[i];if(4H===eX){eY();6o}o.gr(H,4H);z 6c=4H.1f;3z(6c.W>0){z 9r=o.gF(H,6c,cx,cy,P,5J);9r.22=4H;2c.1h(9r);2c.P+=9r.7y;6c=9r.6c;if(6c.W>0){eY()}1b{cx+=9r.7y;5J=1E}}}if(2c.W>0){2e.1h(2c)}G 2e},h5:F(1f,2F){z 2g=1f.3e(2F).t1(/\\s+/);G 2g>-1?2g+2F:1f.W},gF:F(H,1f,x,y,4W,5J){if(5J){3z(1f.W>0&&/\\s/.fX(1f.5t(0))){1f=1f.3e(1)}}z 3d=H.6X(1f);if(x+3d.P>4W){z go=0;z 8g=0;1i(z i=0;i<=1f.W;){z dz=o.h5(1f,i);3d=H.6X(1f.3e(0,dz));if(x+3d.P>4W){z 7o=1f.3e(0,go);if(7o.W==0&&5J){G o.ha(H,1f,x,y,4W,5J)}G{6c:1f.3e(7o.W),7y:8g,1f:7o,dx:x,dy:y}}go=dz;8g=3d.P;i=dz+1}}G{6c:"",7y:3d.P,1f:1f,dx:x,dy:y}},ha:F(H,1f,x,y,4W,5J){if(5J){3z(1f.W>0&&/\\s/.fX(1f.5t(0))){1f=1f.3e(1)}}z 3d=H.6X(1f);if(x+3d.P>4W){z 8g=0;1i(z i=1;i<=1f.W;i++){3d=H.6X(1f.3e(0,i));if(x+3d.P>4W){z 7o=1f.3e(0,i-1);if(7o.W==0&&5J){7o=1f.3e(0,1);8g=3d.P}G{6c:1f.3e(7o.W),7y:8g,1f:7o,dx:x,dy:y}}8g=3d.P}}G{6c:"",7y:3d.P,1f:1f,dx:x,dy:y}},gr:F(H,4H){z 1R="";z 1j=H.2x;1i(z i=0;i<S.39(4H.8u);i++){1j*=66/3F}if(4H.7l){1R="7l "+1R}if(4H.7k){1R="7k "+1R}1R+=o.1R.6v(1j);H.1R=1R;if(4H.2o){H.5x=4H.2o}1b{H.5x=o.1S}H.sN=4H.aC},gU:F(H,3L){z m=o.2z;if(o.1f===""){G O 19.4r(m.1z+m.1t,m.1F+m.1v)}z 1j=o.7t?1:H.2x;H.2m();o.4D=o.1R.1G*1j;if(3L!=2Y.3i){3L*=1j}if(!o.7t){H.gt(1,0,0,1,0,0)}z 3O=o.fW(o.1f);z 2e=o.fZ(H,3O,3L);H.2l();z V=o.4D*2e.W;z P=0;1i(z i=0;i<2e.W;i++){P=S.3q(P,2e[i].P)}if(!o.7t){P+=1}G O 19.4r(P/1j+m.1z+m.1t,V/1j+m.1F+m.1v)},gX:F(){G o.1f},hc:F(T){o.1f=T},hr:F(){G""},3d:F(3L,ho){z 9L=19.7n.H;if(!o.1f){G O 19.4r(o.2z.P(),o.2z.V())}if(3L){3L-=o.2z.P()}z 1G=9L.fS(o.1f,o.1R,1c,o.dg);if(3L&&1G.P>3L){z hp=3L?3L:2Y.3i;z 2A=O 19.1n(0,0,hp,2Y.3i);1G=9L.fS(o.1f,o.1R,2A,o.dg)}o.an=1G.P+o.2z.P();o.aJ=1G.V+o.2z.V()},g0:F(){G o.an},ga:F(){G o.aJ},3R:F(2b){if(o.1f==""){G 1c}z H=2b.v2;z 8b=H.8b;z 1j=H.2x;z g7=8;z g5=4;if(o.7t){g7=0;g5=-1;1j=1}z g=2b.5a("4z://4K.4C.3Z/4V/3W","g");z 1d=o.J.1d();z 1D="";if(o.3h){1D+="aA("+o.3h+" "+1d.x+" "+1d.y+")"}1D+="1j("+(1/1j)+")";g.1H("1D",1D);a4{H.8b=F(1f,x,y){z 5H=2b.5a("4z://4K.4C.3Z/4V/3W","1f");5H.sQ=1f;5H.1H("26","aM");5H.1H("2v",H.5x);5H.1H("ao","1R: "+H.1R);5H.1H("x",x-g7);5H.1H("y",y-g5);5I(H.7T){1s"1z":5H.1H("1f-g2","2F");1m;1s"1d":5H.1H("1f-g2","cr");1m;1s"1t":5H.1H("1f-g2","8s");1m}g.aN(5H)};o.37(H,1E)}aj(e){}H.8b=8b;G g},1S:"6u",J:1c,2e:1c,1R:O 19.4Q("bj-bm",4)};3g.gP=F(H,1f,3L){z 2e=1f.1V("\\n");if(3L==2Y.3i){G 2e}z fY=[];2f.41(2e,F(2c){3g.gE(H,2c,3L,fY)});G fY};3g.gE=F(H,1f,3L,2e){z 8p=1f.1V(" ");z 7M="";1i(z i=0;i<8p.W;i++){z aY=8p[i];z m=H.6X(7M+aY).P;if(m<3L){if(i==0){7M+=(aY)}1b{7M+=(" "+aY)}}1b{if(7M!=""){2e.1h(7M)}7M=aY}if(i==8p.W-1){2e.1h(7M);1m}}};3g.t0=F(1f,1R,H,1j){H.2m();H.1j(1j,1j);H.1R=1R;z 8p=1f.1V(/\\s{1,}/);z w=0;z P=0;1i(z i=0;i<8p.W;i++){w=H.6X(8p[i]).P;if(w>P){P=w}}H.2l();G P};I.1X(3g,"I.14.3g");z 2K={7X:0,4p:1,7e:2}})(I.14);I.14.1Z=F(x,y){o.x=x;o.y=y;o.1l=o.5n.4X};I.14.1Z.1q={6W:F(){G o.1l},3a:F(){G O I.14.1Z(o.x,o.y)},W:F(){G S.4u(I.14.1Z.dR(o,o))},sv:F(){G I.14.1Z.dR(o,o)},su:F(){G O I.14.1Z(-o.x,-o.y)},gB:F(){G O I.14.1Z(o.x/o.W(),o.y/o.W())},dP:F(){G O I.14.1u(o.x,o.y)}};I.14.1Z.9f=F(2t,2q){G O I.14.1Z(2q.x-2t.x,2q.y-2t.y)};I.14.1Z.dR=F(7p,7m){G(7p.x*7m.x)+(7p.y*7m.y)};I.14.1Z.6R=F(4G,T){G O I.14.1Z(4G.x*T,4G.y*T)};I.14.1Z.sz=F(4G,T){G O I.14.1Z(4G.x*(1/T),4G.y*(1/T))};I.14.1Z.4s=F(7p,7m){G O I.14.1Z(7p.x+7m.x,7p.y+7m.y)};I.14.1Z.82=F(7p,7m){G O I.14.1Z(7p.x-7m.x,7p.y-7m.y)};I.1X(I.14.1Z,"I.14.1Z");I.5i("I.3t");(F(hn){z 1n=I.14.1n;z 1u=I.14.1u;z Y=hn.Y=F(){};Y.sr=F(1a,K){z p1=O 1u(50,50);if(K.P>0&&K.V>0){p1.x=(1a.x-K.x)*3F/K.P;p1.y=(1a.y-K.y)*3F/K.V}G p1};Y.sC=F(7P,ed){if(7P.P===0||7P.V===0){G ed}G 7P.h0(ed)};Y.gT=F(K){z 9i=O 1n(0,0,0,0);9i.x=S.2Q(K.x,K.1t());9i.P=S.39(K.P);9i.y=S.2Q(K.y,K.1v());9i.V=S.39(K.V);G 9i};Y.dW=F(K,x,y){if(K.P+2*x<0){x=-K.P/2}if(K.V+2*y<0){y=-K.V/2}G O 1n(K.x-x,K.y-y,K.P+2*x,K.V+2*y)};Y.sG=F(1a,er,hb,bL){z d0=2Y.3i;if(bL){bL.T=0}1i(z s=0;s<hb-1;++s){z p1=er[s];z p2=er[s+1];z d=O I.14.bD(1a,p1,p2);z ei=d.ew();if(ei<d0){d0=ei;if(bL){bL.T=s}}}G S.4u(d0)};Y.el=F(p1,p2,p3,p4){G(o.b8(p1,p2,p3)*o.b8(p1,p2,p4)<=0)&&(o.b8(p3,p4,p1)*o.b8(p3,p4,p2)<=0)};Y.b8=F(p0,p1,p2){z eo,dC;z dM,dE;eo=p1.x-p0.x;dC=p2.x-p0.x;dM=p1.y-p0.y;dE=p2.y-p0.y;G((eo*dE>dM*dC)?1:-1)};Y.ee=F(m1,m2,n1,n2){if(m1.x==m2.x&&n1.x==n2.x){G 1M}if(m1.x==m2.x){z a=(n1.y-n2.y)/(n1.x-n2.x);z b=(n1.x*n2.y-n2.x*n1.y)/(n1.x-n2.x);G O 1u(m1.x,a*m1.x+b)}if(n1.x==n2.x){if(m1.y==m2.y){G O 1u(n1.x,m1.y)}z a=(m1.y-m2.y)/(m1.x-m2.x);z b=(m1.x*m2.y-m2.x*m1.y)/(m1.x-m2.x);G O 1u(n1.x,a*n1.x+b)}z a1=(m1.y-m2.y)/(m1.x-m2.x);z b1=(m1.x*m2.y-m2.x*m1.y)/(m1.x-m2.x);z a2=(n1.y-n2.y)/(n1.x-n2.x);z b2=(n1.x*n2.y-n2.x*n1.y)/(n1.x-n2.x);if(a1==a2){G 1M}z ek=O 1u((b2-b1)/(a1-a2),a1*(b2-b1)/(a1-a2)+b1);if(m1.y==m2.y){ek.y=m1.y}G ek};Y.kf=F(s1,s2,l1,l2){z pt=Y.ee(s1,s2,l1,l2);if(!pt){G pt}z p1=(pt.x-s1.x)*(pt.x-s2.x);z p2=(pt.y-s1.y)*(pt.y-s2.y);if(p1>0.aB||p2>0.aB){G 1M}z gL=(pt.x-l1.x)*(pt.x-l2.x);z gI=(pt.y-l1.y)*(pt.y-l2.y);if(gL>0.aB||gI>0.aB){G 1M}G pt};Y.tG=F(1a,3K){z dT=0;3K=3K.6t(0);1i(z i=0;i<3K.W;++i){3K[i].x-=1a.x;3K[i].y-=1a.y}1i(z i=0;i<3K.W;++i){z j=(i+1)%3K.W;if(3K[i].y>0&&3K[j].y<=0||3K[j].y>0&&3K[i].y<=0){z x=(3K[i].x*3K[j].y-3K[j].x*3K[i].y)/(3K[j].y-3K[i].y);if(x>0){dT++}}}G dT%2==1};Y.tF=F(18,3Z,8s,3s){z cl,9a,c6=2Y.3i;1i(z i=0;i<18.W;i++){9a=Y.kf(18[i],18[(i+1)%18.W],3Z,8s);if(9a){cl=Y.ks(9a,8s);if(cl<c6){c6=cl;3s.x=9a.x;3s.y=9a.y}}}G c6<2Y.3i};Y.td=F(p,a,b){if(a.ef(b)){G a}z dx=b.x-a.x;z dy=b.y-a.y;z 7G=(p.x-a.x)*dx+(p.y-a.y)*dy;if(7G<0){G a}7G=(b.x-p.x)*dx+(b.y-p.y)*dy;if(7G<0){G b}z lf=Y.kj({x:a.x-b.x,y:a.y-b.y});z n=O 1u(p.x+lf.x,p.y+lf.y);G Y.ee(a,b,p,n)};Y.kj=F(4G){G{x:4G.y,y:-4G.x}};Y.da=F(1a,2r){z p=O 1u(2r.x-1a.x,2r.y-1a.y);z pp=O 1u(p.x+2r.x,p.y+2r.y);G pp};Y.tf=F(1a,K,5c){z 8G=K.x-1a.x;z 8F=K.1t()-1a.x;z 7r=K.y-1a.y;z 7s=K.1v()-1a.y;if(8F<0){if(7r>0){G(8F*8F+7r*7r<5c*5c)}1b{if(7s<0){G(8F*8F+7s*7s<5c*5c)}1b{G(S.39(8F)<5c)}}}1b{if(8G>0){if(7r>0){G(8G*8G+7r*7r<5c*5c)}1b{if(7s<0){G(8G*8G+7s*7s<5c*5c)}1b{G(S.39(8G)<5c)}}}1b{if(7r>0){G(S.39(7r)<5c)}1b{if(7s<0){G(S.39(7s)<5c)}1b{G 1Q}}}}};Y.t9=F(1a,K){z ke=Y.k9(1a,K);G 1u.5E(1a,ke)};Y.k9=F(1a,K){G O 1u(Y.et(1a.x,K.x,K.1t()),Y.et(1a.y,K.y,K.1v()))};Y.et=F(cC,k7,ka){z 5S,7R;z r=Y.5S(cC,k7,ka,5S,7R);5S=r.a;7R=r.b;if(Y.ko(cC,5S,7R)){G cC}1b{G 5S}};Y.dK=F(f1,f2){G S.39(f1-f2)<0.en};Y.ts=F(p1,p2){G Y.dK(p1.x,p2.x)&&Y.dK(p1.y,p2.y)};Y.ti=F(2t,2q){G O 1u((2t.x+2q.x)/2,(2t.y+2q.y)/2)};Y.5S=F(2r,8T,8Q,5S,7R){z r=Y.dj(8T,8Q);8T=r.a;8Q=r.b;z b3;if(2r<8T){b3=1Q}1b{if(2r>8Q){b3=1E}1b{b3=2r-8T<8Q-2r}}if(b3){5S=8T;7R=8Q}1b{5S=8Q;7R=8T}G{a:5S,b:7R}};Y.9G=F(a,b){z kz=a;a=b;b=kz;G{a:a,b:b}};Y.dj=F(a,b){if(b<a){z r=Y.9G(a,b);a=r.a;b=r.b}G{a:a,b:b}};Y.ko=F(n,7N,7z){z r=Y.dj(7N,7z);7N=r.a;7z=r.b;G Y.dS(n,7N,7z)};Y.dS=F(n,7N,7z){G 7N<=n&&n<=7z};Y.tk=F(p1,p2){G{x:p1.x-p2.x,y:p1.y-p2.y}};Y.sP=F(18,dG,bb){if(18.W!==dG.W){G}1i(z i=0;i<18.W;++i){z p=dG[i].3a();18[i]=p.dk(bb)}};Y.tl=F(1a,K){G O 1u(K.x+1a.x/3F*K.P,K.y+1a.y/3F*K.V)};Y.tj=F(K,7P){K.P=7P.P;K.V=7P.V;K.ku(7P.6m())};Y.dS=F(n,7N,7z){G 7N<=n&&n<=7z};Y.th=F(6q){G 5*I.14.4e.kr(6q)};Y.ks=F(2t,2q){G(2t.x-2q.x)*(2t.x-2q.x)+(2t.y-2q.y)*(2t.y-2q.y)};Y.bt=F(dN){G dN/3y*S.1P};Y.dN=F(bt){G bt/S.1P*3y};Y.tr=F(1a,2r,1B){z 1W=O I.14.2H();1W.8o(1B,2r.x,2r.y);1a=1a.3a();1W.8d(1a);G 1a};Y.tq=F(18,2r,1B){z 1W=O I.14.2H();1W.8o(1B,2r.x,2r.y);1i(z i=0,l=18.W;i<l;++i){1W.8d(18[i])}};Y.tn=F(K){G O 1u(K.x+K.P/2,K.y+K.V/2)};Y.tp=F(K,2r,1B){if(1B==0){G K}z 1W=O I.14.2H();1W.8o(1B,2r.x,2r.y);G 1W.b9(K)};Y.2N=F(13){z 3N=Y.cW();z J=1L.2N(13);if(jJ.jH.aT().2u("jF")>-1){if(3N.3o!=0||3N.2W!=0){z K=13.eh();if((J.x-K.1z)<1&&(J.y-K.1F)<1){J.x+=3N.3o;J.y+=3N.2W}}}G J};Y.cW=F(){z 3o=0;z 2W=0;if(5z.jA!=1M){3o=5z.jA}1b{if(3p.8B.2W!==0){3o=3p.8B.3o}1b{3o=3p.9C.3o}}if(5z.jI!=1M){2W=5z.jI}1b{if(3p.8B.2W!==0){2W=3p.8B.2W}1b{2W=3p.9C.2W}}G{3o:3o,2W:2W}};Y.cZ=F(e,13){z 3N=Y.cW();z J=1L.2N(13);z x=e.js-J.x+3N.3o;z y=e.jr-J.y+3N.2W;if(jJ.jH.aT().2u("jF")>-1){if(3N.3o!=0||3N.2W!=0){z K=13.eh();if((J.x-K.1z)<1&&(J.y-K.1F)<1){x-=3N.3o;y-=3N.2W}}}G O 1u(x,y)};Y.ui=F(e){z 3N=Y.cW();z x=e.js+3N.3o;z y=e.jr+3N.2W;G O 1u(x,y)};Y.jc=F(9X,13){z 3s=[];if(13==1M){13=3p}if(13.9X.bG()==9X.bG()){3s.1h(13)}z 9U=13.dp;1i(z i=0;i<9U.W;i++){if(9U[i].9X){if(9U[i].9X.bG()==9X.bG()){3s.1h(9U[i])}}}G 3s};Y.5B=F(H,1p,J,jp){if(!1p){G(jp)?"#9o":"#bE"}if(1p.1l=="ta"){if(33 1p.2o=="2p"){G 1p.2o}1b{if(1p.2o.T){G 1p.2o.T}}}1b{if(1p.1l=="79"){if(!H){G"#bE"}z 1w=1p.1w?1p.1w:J.x;z 1y=1p.1y?1p.1y:J.y+J.V/2;z 1C=1p.1C?1p.1C:J.x+J.P;z 1J=1p.1J?1p.1J:J.y+J.V/2;if(1p.1B){if(1p.1B===3y){1w=J.x+J.P/2;1y=J.y+J.V/2;1C=J.x;1J=J.y+J.V/2}1b{if(1p.1B===90){1w=J.x+J.P/2;1y=J.y;1C=J.x+J.P/2;1J=J.y+J.V}1b{if(1p.1B===fF){1w=J.x+J.P/2;1y=J.y+J.V;1C=J.x+J.P/2;1J=J.y}1b{z 1d=O 1u(J.x+J.P/2,J.y+J.V/2);z 1B=1p.1B;z 8D;1B=((1B%7U)+7U)%7U;if(1B>=0&&1B<90){z a1=I.5N.aw(1d,J.cv()).a;8D=1B-a1}1b{if(1B>=90&&1B<3y){z a1=I.5N.aw(1d,J.6m()).a;8D=1B-a1}1b{if(1B>=3y&&1B<fF){z a1=I.5N.aw(1d,J.cz()).a;8D=1B-a1}1b{z a1=I.5N.aw(1d,J.5s()).a;8D=1B-a1}}}z r=S.4u(J.P*J.P/4+J.V*J.V/4);if(8D!==0){r=r*S.3f(I.5N.e0(90-S.39(8D)))}z 2F=I.5N.dZ(1d,{a:1B,r:r});z 8s=I.5N.dZ(1d,{a:1B-3y,r:r});1w=2F.x;1y=2F.y;1C=8s.x;1J=8s.y}}}}z b=H.t7(1w,1y,1C,1J);if(1p.7S){1i(z i=0,l=1p.7S.W;i<l;i++){b.a9(1p.7S[i].9O,1p.7S[i].2o)}}1b{b.a9(0,1p.4d);b.a9(1,1p.4c)}G b}1b{if(1p.1l=="jy"){if(!H){G"#bE"}z 1w=(1p.1w!=1M)?1p.1w:J.1d().x;z 1y=(1p.1y!=1M)?1p.1y:J.1d().y;z 1C=(1p.1C!=1M)?1p.1C:J.1d().x;z 1J=(1p.1J!=1M)?1p.1J:J.1d().y;z aU=(1p.aU!=1M)?1p.aU:0;z aQ=(1p.aQ!=1M)?1p.aQ:S.3q(J.P,J.V)/2;z b=H.t8(1w,1y,aU,1C,1J,aQ);if(1p.7S){1i(z i=0,l=1p.7S.W;i<l;i++){b.a9(1p.7S[i].9O,1p.7S[i].2o)}}1b{b.a9(0,1p.4d);b.a9(1,1p.4c)}G b}1b{G 1p}}}};Y.tg=F(18,7i,t){z k0=18[7i*3+0].x;z jY=18[7i*3+0].y;z 1w=18[7i*3+1].x;z 1y=18[7i*3+1].y;z 1C=18[7i*3+2].x;z 1J=18[7i*3+2].y;z 2Z=18[7i*3+3].x;z 2P=18[7i*3+3].y;z tt=t;z q0=(1-tt)*(1-tt)*(1-tt);z q1=3*tt*(1-tt)*(1-tt);z q2=3*tt*tt*(1-tt);z q3=tt*tt*tt;z jW=q0*k0+q1*1w+q2*1C+q3*2Z;z jX=q0*jY+q1*1y+q2*1J+q3*2P;G O 1u(jW,jX)};Y.tc=F(18,6M,2F){if(2F==1M){2F=0}z dY=[];1i(z i=2F;i<18.W-3;i+=3){z p0=18[i];z p1=18[i+1];z p2=18[i+2];z p3=18[i+3];Y.em(dY,6M,p0.x,p0.y,p1.x,p1.y,p2.x,p2.y,p3.x,p3.y)}G dY};Y.em=F(18,6M,cn,bW,k4,k3,k5,jQ,bO,c4){z d=1/6M;1i(z t=0;t<=1;t+=d){z q1=S.2J(1-t,3);z q2=3*S.2J(1-t,2)*t;z q3=3*(1-t)*t*t;z q4=t*t*t;z x=q1*cn+q2*k4+q3*k5+q4*bO;z y=q1*bW+q2*k3+q3*jQ+q4*c4;18.1h(O 1u(x,y))}};Y.jN=F(18,6M,cn,bW,cx,cy,bO,c4){z d=1/6M;1i(z t=d;t<=1;t+=d){z q1=(1-t)*(1-t);z q2=2*(1-t)*t;z q3=t*t;z x=q1*cn+q2*cx+q3*bO;z y=q1*bW+q2*cy+q3*c4;18.1h(O 1u(x,y))}};Y.kv=F(18,6M,cx,cy,24,21,2a,4a){if(!4a){3z(2a<21){2a+=2*S.1P}}1b{3z(2a>21){2a-=2*S.1P}}z d=(2a-21)/6M;z a=21;1i(z i=0;i<=6M;i++){z x=cx+24*S.3j(a);z y=cy+24*S.3f(a);18.1h(O 1u(x,y));a+=d}};Y.tK=F(){G{18:[],3m:F(){},28:F(x,y){o.18.1h(O 1u(x,y))},23:F(x,y){o.bN();o.18.1h(O 1u(x,y))},4F:F(jR,jS,jT,jM,x,y){o.bN();z p1=o.dF();Y.em(o.18,20,p1.x,p1.y,jR,jS,jT,jM,x,y)},7f:F(kt,kw,x,y){o.bN();z p1=o.dF();Y.jN(o.18,20,p1.x,p1.y,kt,kw,x,y)},dO:F(x,y,24,21,2a,4a){Y.kv(o.18,20,x,y,24,21,2a,4a)},bN:F(){if(o.18.W==0){o.18.1h(O 1u(0,0))}},dF:F(){G o.18[o.18.W-1]},1D:{1T:F(H,1W){o.1W=I.14.2H.kd(1W)}},ty:F(){if(o.1D.1W){o.1D.1W.bX(o.18)}G o.18}}};Y.tw=F(x,y,w,h,a,sw){z 18=[];z 2a,21,e;z gl=sw>0;e=a+sw;a=o.bt(a);e=o.bt(e);21=a;1i(z i=0;i<4;i++){if(gl){if(21>=e){1m}2a=S.2Q(21+S.1P/2,e)}1b{if(21<=e){1m}2a=S.3q(21-S.1P/2,e)}z gp=o.kl(x,y,w,h,21,2a);1i(z j=0;j<gp.W;j++){18.1h(gp[j])}21+=S.1P/2*(gl?1:-1)}G 18};Y.kl=F(x,y,w,h,s,e){z rx=w/2,ry=h/2;z cx=x+rx,cy=y+ry;z ct=S.3j(s),co=S.3f(s);z cp=S.3j(e),cq=S.3f(e);z aZ=4/3*(1-S.3j((e-s)/2))/S.3f((e-s)/2);z 18=[O 1u(ct,co),O 1u(ct-aZ*co,co+aZ*ct),O 1u(cp+aZ*cq,cq-aZ*cp),O 1u(cp,cq)];1i(z i=0;i<18.W;i++){18[i].x*=rx;18[i].x+=cx;18[i].y*=ry;18[i].y+=cy}G 18};Y.ge=F(1d,1G){z fV=1G/2;G O 1n(1d.x-fV,1d.y-fV,1G,1G)};Y.tA=F(){z 8e=(33(3E)=="F")?3S[0]:o;1i(z i=0;i<3S.W;i++){z c5=O fP("\\\\{"+i+"\\\\}","gi");8e=8e.5F(c5,3S[i+1])}G 8e};Y.tB=F(2p){if(2p!=1c&&2p!=""){G 2p.5F(/\\n/g,"\\\\n")}1b{G 2p}};Y.kk=F(K,x,y){G O 1n(K.x+x,K.y+y,K.P,K.V)};Y.bb=F(K,1a){G Y.kk(K,1a.x,1a.y)};Y.t6=F(k8){G!fv(k8-0)};Y.sF=F(fT){G!/^-?\\d+$/.fX(3E(fT))};Y.sE=F(x){if(+x===x){G(x===0)?x:(x>0)?1:-1}G sD};Y.sK=F(kp){G I.14.4e.9z(0.4,kp,I.14.4e.bM)};Y.k2=F(){z 8e=3S[0];1i(z i=1;i<3S.W;i++){z c5=O fP("\\\\{"+(i-1)+"\\\\}","gi");8e=8e.5F(c5,3S[i])}G 8e};Y.sL=F(2p){z 4Z=Y.jw(2p);if(4Z){z 2y="sJ";if(33 4Z.2y!=="1M"){2y=("bY"+9s(4Z.2y*sH).6v(16)).6t(-2)}G"#"+2y+("bY"+4Z.bf.6v(16)).6t(-2)+("bY"+4Z.ap.6v(16)).6t(-2)+("bY"+4Z.9P.6v(16)).6t(-2)}G"#sI"};Y.jw=F(T){z jP="^#{0,1}?[A-ss-f0-9]{3,6}$";z 9R=T;z gc=Y.jK(9R);if(gc){9R=gc}if(9R.g4(jP)){z 4Z=Y.jU(9R);if(4Z){G 4Z}}1b{z 5j=3p.dB("5j");5j.ao.jL=9R;z 2o=5j.ao.jL;z 4Z=Y.jO(2o);if(4Z){G 4Z}}6F O 6I("sq 2o sA: "+T)};Y.jU=F(T){if(!T||T.W<3||T.W>7){G}T=T.5F("#","");z r,g,b;z W=2;if(T.W==3){T=T[0]+T[0]+T[1]+T[1]+T[2]+T[2]}z v=T.3e(T.W-W);b=9s(v,16);T=T.3e(0,T.W-W);W=T.W==1?1:2;v=T.3e(T.W-W);T=T.3e(0,T.W-W);g=9s(v,16);if(T.W==0){r=0}1b{r=9s(T,16)}G{bf:r,ap:g,9P:b}};Y.jO=F(2p){if(2p.W==0){G 1c}if(2p=="6y"){G{bf:9v,ap:9v,9P:9v,2y:0}}if(2p.g4(/[0-9,\\s]+/g)==1c){G 1c}z 5M=2p.g4(/(9q?)|(\\d+(\\.\\d+)?%?)|(\\.\\d+)/g);if(5M.W!=4&&5M.W!=5){G 1c}z r=+5M[1];z g=+5M[2];z b=+5M[3];z a=(5M.W==5)?+5M[4]:1;if((r>=0&&r<=9v)&&(g>=0&&g<=9v)&&(b>=0&&b<=9v)&&(a>=0&&a<=1)){G{bf:r,ap:g,9P:b,2y:a}}G 1c};Y.sZ=F(r,g,b,a){if(r!=1M&&g!=1M&&b!=1M){if(a==1M){a=1}G Y.k2("9q({0},{1},{2},{3})",r,g,b,a)}G"9q(0,0,0,1)"};Y.jK=F(T){z 4I=Y.jq;z v=T.aT();1i(z 1A in 4I){if(v==1A){G 4I[1A]}}G 1c};Y.jq={sY:"#sW",sX:"#t5",sO:"#i9",sU:"#sV",sT:"#sR",uT:"#v4",uP:"#uC",6u:"#9o",uF:"#uy",9P:"#uz",uM:"#uO",uH:"#uG",uI:"#uJ",uL:"#uB",uE:"#uD",uZ:"#v1",v3:"#uY",uQ:"#uR",uW:"#uX",uU:"#uV",uS:"#i9",u4:"#u5",u3:"#u1",u2:"#u9",ua:"#u8",u6:"#u7",u0:"#tT",tU:"#tS",tQ:"#tR",tY:"#tZ",tX:"#tV",tW:"#ub",uq:"#ur",up:"#un",uo:"#uv",uw:"#ic",uu:"#ic",us:"#um",ug:"#ue",uc:"#ud",uk:"#ul",uj:"#uh",so:"#oZ",oY:"#p6",p5:"#oV",oU:"#oX",oW:"#p7",pd:"#hI",pc:"#pf",pe:"#p9",p8:"#pb",pa:"#oT",fm:"#iq",oH:"#iq",ap:"#oG",oJ:"#oI",oD:"#oC",oF:"#oE",oK:"#oQ",oP:"#oS",oR:"#oM",oL:"#oO",oN:"#pG",pF:"#pI",pH:"#pC",pB:"#pE",pD:"#pJ",pP:"#pO",pR:"#pQ",pL:"#pK",pN:"#hG",pM:"#hG",pA:"#pl",pk:"#pn",pm:"#ph",pg:"#pj",pi:"#po",pw:"#pv",pz:"#hJ",py:"#hJ",pr:"#pq",pu:"#ps",nO:"#nN",nQ:"#nP",nK:"#nJ",nM:"#hI",nL:"#nR",nX:"#nW",nZ:"#nY",nT:"#nS",nV:"#nU",nI:"#nt",nr:"#nv",nu:"#no",nn:"#nq",np:"#nz",nF:"#nE",nH:"#nG",nB:"#nA",nD:"#nC",oo:"#om",oq:"#op",oj:"#oi",ol:"#ok",or:"#oz",jk:"#ow",oB:"#oA",ot:"#os",ov:"#ou",oh:"#o5",o4:"#o7",o6:"#o1",o0:"#o3",o2:"#o8",oe:"#od",og:"#of",oa:"#o9",oc:"#ob",pS:"#rz",bf:"#rw",rB:"#rA",rt:"#rs",rv:"#ru",rC:"#rI",rH:"#rK",rJ:"#rE",rD:"#rG",rF:"#rr",re:"#ra",rg:"#rf",r7:"#r6",r9:"#r8",rh:"#ro",rn:"#rq",rp:"#rk",rj:"#rm",rl:"#sa",s9:"#sd",sc:"#s6",s5:"#s8",s7:"#se",sl:"#sk",sn:"#sm",6T:"#sh",sg:"#sj",si:"#s4",rQ:"#rP"};Y.5P={6B:"rS+/=",rR:F(4k){z 4w="";z 8V,7Z,7H,9D,8L,6L,6K;z i=0;4k=Y.5P.iw(4k);3z(i<4k.W){8V=4k.6i(i++);7Z=4k.6i(i++);7H=4k.6i(i++);9D=8V>>2;8L=((8V&3)<<4)|(7Z>>4);6L=((7Z&15)<<2)|(7H>>6);6K=7H&63;if(fv(7Z)){6L=6K=64}1b{if(fv(7H)){6K=64}}4w=4w+Y.5P.6B.5t(9D)+Y.5P.6B.5t(8L)+Y.5P.6B.5t(6L)+Y.5P.6B.5t(6K)}G 4w},rM:F(4k){z 4w="";z 8V,7Z,7H;z 9D,8L,6L,6K;z i=0;4k=4k.5F(/[^A-rL-rO-9\\+\\/\\=]/g,"");3z(i<4k.W){9D=Y.5P.6B.2u(4k.5t(i++));8L=Y.5P.6B.2u(4k.5t(i++));6L=Y.5P.6B.2u(4k.5t(i++));6K=Y.5P.6B.2u(4k.5t(i++));8V=(9D<<2)|(8L>>4);7Z=((8L&15)<<4)|(6L>>2);7H=((6L&3)<<6)|6K;4w=4w+3E.4j(8V);if(6L!=64){4w=4w+3E.4j(7Z)}if(6K!=64){4w=4w+3E.4j(7H)}}4w=Y.5P.j7(4w);G 4w},iw:F(2p){2p=2p.5F(/\\r\\n/g,"\\n");z 4v="";1i(z n=0;n<2p.W;n++){z c=2p.6i(n);if(c<bH){4v+=3E.4j(c)}1b{if((c>rN)&&(c<rT)){4v+=3E.4j((c>>6)|rZ);4v+=3E.4j((c&63)|bH)}1b{4v+=3E.4j((c>>12)|j6);4v+=3E.4j(((c>>6)&63)|bH);4v+=3E.4j((c&63)|bH)}}}G 4v},j7:F(4v){z 2p="";z i=0;z c=c1=c2=0;3z(i<4v.W){c=4v.6i(i);if(c<bH){2p+=3E.4j(c);i++}1b{if((c>rY)&&(c<j6)){c2=4v.6i(i+1);2p+=3E.4j(((c&31)<<6)|(c2&63));i+=2}1b{c2=4v.6i(i+1);c3=4v.6i(i+2);2p+=3E.4j(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3}}}G 2p}};Y.s3=F(2p){z 5j=3p.dB("5j");5j.aN(3p.s0(2p));G 5j.fK};Y.rV=F(j8){z 5j=3p.dB("5j");5j.fK=j8;z 8f=5j.dp[0];G 8f?8f.j4:""};I.1X(Y,"I.3t.Y")})(I.3t);I.5i("I.4A");I.4A.rU={rX:"rW",ql:"qk",qn:"j0",qm:"qh",qg:"qj",qi:"e-a6",qo:"ne-a6",qu:"nw-a6",qt:"n-a6",3g:"1f",qw:"qv",qq:"qp",qs:"qr",qf:"pY",pX:"aR-3N",q5:"1c",pZ:"fs-pU",pT:"aR-3N"};I.4A.2X={c7:0,cf:1,cg:2,cd:3,g6:4,g1:5,g3:6,eC:7};I.4A.4y={jg:0,5d:1};I.4A.6h={jf:0,cu:1,fJ:2,bF:3};I.4A.2K={7X:0,4p:1,7e:2};(F(1I){z Y=I.3t.Y;z 4M=1I.4M=F(4U,1l){o.4U=4U;o.1l=1l;o.1S="#9o";o.1p="6y";o.6C="#9o";o.8N="6y";o.6n="#9o";o.6p="jk";o.6Z="#9o";o.8J="6y"};4M.1q={37:F(H){H.2m();z aq=o==o.4U.bA;if(o.3C){o.3C.1S=aq?o.6n:o.1S;o.3C.1p=Y.5B(H,aq?o.6p:o.1p,o.3C.2N());H.2m();H.jj=1;H.jo=1;H.jn=2;H.5D=o.4U.5D;o.3C.37(H);H.cs();H.2l()}if(o.3P){o.3P.1S=aq?o.6Z:o.6C;o.3P.1p=Y.5B(H,aq?o.8J:o.8N,o.3P.2N());o.3P.37(H)}H.2l()},fM:F(dA){if(o.J.85(dA)){G o}G 1c},7v:F(J){if(o.J!=J){o.J=J}},pW:F(3C){if(o.3C!=3C){o.3C=3C}},pV:F(3P){if(o.3P!=3P){o.3P=3P}}};I.1X(4M,"I.4A.4M")})(I.4A);(F(1I){z 1n=I.14.1n;z 2s=I.14.2s;z 3g=I.14.3g;z Y=I.3t.Y;z 2K=I.4A.2K;z 5U=1I.5U=F(13){1L.5u(5U,o,[13]);o.7q={};o.ax=[];o.2z=5;o.3n=0;o.40=c0;o.56=10;o.75=1Q;o.2D=3F;o.43=10;o.5T=1Q;o.2U=4;o.2z=2;o.3Y=1I.6h.cu;o.2U=2;o.2v="#bE";o.7j="#bE";o.4o="q6";o.5v="9q(77,83,94,1)";o.5w="9q(91,91,91,1)";o.5D="fm";o.6z="9q(77,83,94,1)";o.6S=1Q;o.bZ()};5U.1q={9j:F(){1L.7I(5U,o,"9j");o.c8=3p.bU(o.2S().id+"qc");z 2T=Y.jc("2T",o.2S())[0];if(33 2T.ci!=="1M"){o.2T=2T;o.H=2T.ci("2d")}1L.8H(o.am,{qb:1L.4Y(o,o.iJ)});1L.8H(o.am,{qe:1L.4Y(o,o.iI)});o.dL=1L.4Y(o,o.iH);1L.8H(3p,{jh:o.dL})},8M:F(){1L.8I(3p,"jh",o.dL);1L.7I(5U,o,"8M")},qd:F(id){z ag=3p.bU(id);if(ag){z bP=ag.bP;if(bP){bP.a7("q8",1L.4Y(o,1L.bz(o.fU,{id:id})))}}},fU:F(6D,35){z ag=3p.bU(35.id);if(ag){ag.T=o.ak()}},iB:F(){if(o.2S()){5z.q7(o.2S().id,o.c8)}},bZ:F(){z J=1L.2N(o.2S());z P=J.P;z V=J.V;o.J=O 1n(0,0,P,V);o.5y=P>V?1I.4y.jg:1I.4y.5d;o.1r=(o.5y==1I.4y.5d)?o.J.P:o.J.V;o.4t=(o.5y==1I.4y.5d)?o.J.V:o.J.P;o.24=(o.1r-2*o.2z)/2;o.1d=o.1r/2;o.1o=o.3u=o.1r/5;o.34=o.1r/10},3D:F(){z 2L=O 1I.4M(o,1I.2X.jf);z 1e=O 2s();1e.8O(o.1r/2,o.1r/2,(o.1r-o.2z*2)/2,0,2*S.1P,1E);2L.3C=1e;2L.1S=o.5v;2L.1p=o.2v;z 4N=O 1I.4M(o,1I.2X.cf);4N.J=O 1n(o.1d-o.24/4,o.1d-o.24,o.24/2,o.24);1e=O 2s();1e.8O(o.1r/2,o.1r/2,(o.1r-o.2z*2)/2,(5*S.1P)/4,(7*S.1P)/4,1E);1e.23(o.1d,o.1r/2);1e.9A();4N.3C=1e;1e=O 2s();1e.28(o.1d-o.34,o.34*3);1e.23(o.1d,o.34*2);1e.23(o.1d+o.34,o.34*3);4N.3P=1e;z 4O=O 1I.4M(o,1I.2X.c7);4O.J=O 1n(o.1d-o.24,o.1d-o.24/4,o.24,o.24/2);1e=O 2s();1e.8O(o.1r/2,o.1r/2,(o.1r-o.2z*2)/2,(3*S.1P)/4,(5*S.1P)/4,1E);1e.23(o.1d,o.1r/2);1e.9A();4O.3C=1e;1e=O 2s();1e.28(o.34*3,o.1d-o.34);1e.23(o.34*2,o.1d);1e.23(o.34*3,o.1d+o.34);4O.3P=1e;z 4P=O 1I.4M(o,1I.2X.cd);4P.J=O 1n(o.1d-o.24/4,o.1d,o.24/2,o.24);1e=O 2s();1e.8O(o.1r/2,o.1r/2,(o.1r-o.2z*2)/2,S.1P/4,(3*S.1P)/4,1E);1e.23(o.1d,o.1r/2);1e.9A();1e.7f(o.1d,o.1r,o.1o,o.1r-o.1o);4P.3C=1e;1e=O 2s();1e.28(o.1d-o.34,o.1r-o.34*3);1e.23(o.1d,o.1r-o.34*2);1e.23(o.1d+o.34,o.1r-o.34*3);4P.3P=1e;z 4L=O 1I.4M(o,1I.2X.cg);4L.J=O 1n(o.1d,o.1d-o.24/4,o.24,o.24/2);1e=O 2s();1e.8O(o.1r/2,o.1r/2,(o.1r-o.2z*2)/2,(7*S.1P)/4,S.1P/4,1E);1e.23(o.1d,o.1r/2);1e.9A();4L.3C=1e;1e=O 2s();1e.28(o.1r-o.34*3,o.1d-o.34);1e.23(o.1r-o.34*2,o.1d);1e.23(o.1r-o.34*3,o.1d+o.34);4L.3P=1e;4N.1S=4N.6n=4P.1S=4P.6n=4O.1S=4O.6n=4L.1S=4L.6n="6y";4N.6p={1l:"79",4d:o.4o,4c:"6T",1B:fF};4L.6p={1l:"79",4d:o.4o,4c:"6T",1B:0};4O.6p={1l:"79",4d:o.4o,4c:"6T",1B:3y};4P.6p={1l:"79",4d:o.4o,4c:"6T",1B:90};4N.8N=4N.8J=4O.8N=4O.8J=4P.8N=4P.8J=4L.8N=4L.8J="6y";4N.6C=4N.6Z=4O.6C=4O.6Z=4P.6C=4P.6Z=4L.6C=4L.6Z=o.5w;z 5b=O 1I.4M(o,1I.2X.g6);z J=O 1n(o.4t-o.1r-o.1o,o.1d-o.1o,o.1o*2,o.1o*2);if(o.5y==1I.4y.5d){J=O 1n(o.1d-o.1o,o.1r+o.1o,o.1o*2,o.1o*2)}5b.J=J;1e=O 2s();1e.aD(J,o.2U);5b.3C=1e;1e=O 2s();if(o.5y==1I.4y.5d){1e.28(o.1d-o.3u/2,o.1r+o.3u*2);1e.23(o.1d+o.3u/2,o.1r+o.3u*2);1e.28(o.1d,o.1r+o.3u*2-o.3u/2);1e.23(o.1d,o.1r+o.3u*2+o.3u/2)}1b{1e.28(o.4t-o.1r,o.1d+o.3u/2);1e.23(o.4t-o.1r,o.1d-o.3u/2);1e.28(o.4t-o.1r-o.3u/2,o.1d);1e.23(o.4t-o.1r+o.3u/2,o.1d)}5b.3P=1e;5b.1S=5b.6n=o.5v;5b.1p=o.2v;5b.6C=5b.6Z=o.5w;5b.6p={1l:"79",4d:o.4o,4c:"6T",1B:30};z 5e=O 1I.4M(o,1I.2X.g1);J=O 1n(o.1r+o.1o,o.1d-o.1o,o.1o*2,o.1o*2);if(o.5y==1I.4y.5d){J=O 1n(o.1d-o.1o,o.4t-o.1r-o.1o,o.1o*2,o.1o*2)}5e.J=J;1e=O 2s();1e.aD(J,o.2U);5e.3C=1e;1e=O 2s();if(o.5y==1I.4y.5d){1e.28(o.1d-o.3u/2,o.4t-o.1r);1e.23(o.1d+o.3u/2,o.4t-o.1r)}1b{1e.28(o.1r+o.3u*2-o.3u/2,o.1d);1e.23(o.1r+o.3u*2+o.3u/2,o.1d)}5e.3P=1e;5e.1S=5e.6n=o.5v;5e.1p=o.2v;5e.6C=5e.6Z=o.5w;5e.6p={1l:"79",4d:o.4o,4c:"6T",1B:30};z 1j=O 1I.4M(o,1I.2X.g3);z 9u=S.8z((o.40-o.3n)/o.56)+2;z 4i=o.4t-o.1r*2-o.1o*4;z 6A=(4i-o.1o)/(9u-2);J=O 1n(o.1r+o.1o*3,o.1d-o.1o,4i,o.1o*2);if(o.5y==1I.4y.5d){J=O 1n(o.1d-o.1o,o.1r+o.1o*3,o.1o*2,4i)}1j.J=J;1e=O 2s();if(o.5y==1I.4y.5d){1e.fL(o.1d-o.1o/4,o.1r+o.1o*3,o.1o/2,4i);if(o.3Y==1I.6h.cu||o.3Y==1I.6h.bF){1i(z i=0;i<9u-1;i++){1e.28(o.1d-o.1o/2,o.1r+o.1o*3+o.1o/2+6A*i);1e.23(o.1d-o.1o,o.1r+o.1o*3+o.1o/2+6A*i)}}if(o.3Y==1I.6h.fJ||o.3Y==1I.6h.bF){1i(z i=0;i<9u-1;i++){1e.28(o.1d+o.1o/2,o.1r+o.1o*3+o.1o/2+6A*i);1e.23(o.1d+o.1o,o.1r+o.1o*3+o.1o/2+6A*i)}}}1b{1e.fL(o.1r+o.1o*3,o.1d-o.1o/4,4i,o.1o/2);if(o.3Y==1I.6h.cu||o.3Y==1I.6h.bF){1i(z i=0;i<9u-1;i++){1e.28(o.1r+o.1o*3+o.1o/2+6A*i,o.1d-o.1o/2);1e.23(o.1r+o.1o*3+o.1o/2+6A*i,o.1d-o.1o)}}if(o.3Y==1I.6h.fJ||o.3Y==1I.6h.bF){1i(z i=0;i<9u-1;i++){1e.28(o.1r+o.1o*3+o.1o/2+6A*i,o.1d+o.1o/2);1e.23(o.1r+o.1o*3+o.1o/2+6A*i,o.1d+o.1o)}}}1j.3P=1e;1j.1S=1j.6n=1j.6p="6y";1j.8N=1j.8J=o.2v;1j.6C=1j.6Z=o.5w;z 6w=O 1I.4M(o,1I.2X.eC);6w.1S=6w.6n=o.5v;6w.1p=o.2v;6w.6p={1l:"79",4d:o.4o,4c:"6T",1B:30};z 7g;if(o.5T){z J=O 1n(o.4t-o.1r/2+o.1o/2,o.1d,o.1r,o.1r);if(o.5y==1I.4y.5d){J=O 1n(o.1d,o.4t-o.1r/2+o.1o/2,o.1r,o.1r)}7g=O 3g(o.2D+"%",J);7g.1R=O I.14.4Q("bj-bm",10);7g.6a=2K.4p;7g.9V=2K.4p;7g.1S=o.6z}o.7q={2L:2L,4N:4N,4O:4O,4P:4P,4L:4L,5b:5b,5e:5e,1j:1j,6w:6w};if(o.5T){o.7q.7g=7g}o.ax=[4N,4O,4P,4L,5b,5e,6w,1j]},2w:F(){if(!o.H){G}o.2T.P=o.2T.P;o.H.K(o.J.x,o.J.y,o.J.P,o.J.V);o.H.5x=o.7j;o.H.2v();1i(z c in o.7q){if(o.7q[c].37){o.7q[c].37(o.H)}}},5Z:F(4n){if(4n>""){z 2B=1L.5Z(4n);o.bq=2B.bq;o.2z=2B.2z;o.3n=2B.3n;o.40=2B.40;o.56=2B.56;o.43=2B.43;o.75=2B.75;o.5T=2B.5T;o.3Y=2B.3Y;o.2U=2B.2U;o.2v=2B.2v;o.7j=2B.7j;o.4o=2B.4o;o.5v=2B.5v;o.5w=2B.5w;o.5D=2B.5D;o.6z=2B.6z;o.3D();o.7D(2B.2D,1Q,1E);o.iA(2B.6S);o.iU(2B.ai);z 2E=o;iF(F(){G 2E.iE()},3F)}},iE:F(){z 1Y=1L.9h(o.bq);if(1Y){o.1Y=1Y;if(1Y.a7){1Y.a7("b5",1L.4Y(o,o.eQ))}o.2w()}},ak:F(){z 4n={id:o.2S().id,bq:o.bq,2z:o.2z,3n:o.3n,40:o.40,2D:o.2D,56:o.56,43:o.43,75:o.75,5T:o.5T,3Y:o.3Y,2U:o.2U,2v:o.2v,7j:o.7j,4o:o.4o,5v:o.5v,5w:o.5w,5D:o.5D,6z:o.6z,6S:o.6S,ai:o.ai};G 1L.ak(4n)},qa:F(1Y){o.3D();o.7D(o.2D,1Q,1E);o.1Y=1Y;if(1Y){1Y.a7("b5",1L.4Y(o,o.eQ))}o.2w()},eQ:F(){o.7D(o.1Y.2D,1Q,1E)},iJ:F(e){if(!o.6S){G}o.8v=Y.cZ(e,o.2S());z 6e=o.f3(o.8v);if(6e){o.ix(e,6e)}o.bA=6e;o.2w()},iI:F(e){if(!o.6S){G}if(o.8v){if(o.bA){if(o.bA.1l==1I.2X.eC){o.gb(e)}}}},iH:F(e){if(!o.6S){G}z dd=Y.cZ(e,o.2S());q9(o.aV);if(o.8v!=1c){if(dd.5E(o.8v)<2){z 6e=o.f3(o.8v);if(6e){o.iC(e,6e)}}}o.8v=1c;o.bA=1c;o.2w()},gb:F(e){z dd=Y.cZ(e,o.2S());z eZ=o.1r+o.1o*3;z 4i=o.4t-o.1r*2-o.1o*5;z 1a=dd;1a.x-=o.1o/2;1a.y-=o.1o/2;if(o.5y==1I.4y.5d){z cw=S.2Q(4i,S.3q(1a.y-eZ,0));z 8A=cw/4i;z T=S.8z((o.40-o.3n)-(o.40-o.3n)*8A)}1b{z cw=S.2Q(4i,S.3q(1a.x-eZ,0));z 8A=cw/4i;z T=S.8z((o.40-o.3n)*8A)}o.7D(o.3n+T,1Q)},f3:F(dA){if(!o.ax){G 1E}1i(z i=0;i<o.ax.W;i++){z 6e=o.ax[i];if(6e.fM(dA)){G 6e}}G 1c},7D:F(T,iD,iz){if(!iD){o.2D=T}1b{if(o.75&&T>o.3n&&T<o.40){z 3s=o.3n+(S.8z((T-o.3n)/o.56)*o.56);o.2D=S.2Q(o.40,S.3q(o.3n,3s))}1b{o.2D=S.2Q(o.40,S.3q(o.3n,T))}}o.3U();o.2w();if(iz!=1E){if(o.1Y!=1c){o.1Y.qU(o.2D)}}},3U:F(){z 4i=o.4t-o.1r*2-o.1o*5;z 8A=(o.2D-o.3n)/(o.40-o.3n);z 9O=(4i*8A)+o.1o/2;z J=O 1n(o.1r+o.1o*2+o.1o/2+9O,o.1d-o.1o,o.1o,o.1o*2);if(o.5y==1I.4y.5d){9O=4i-(4i*8A)+o.1o/2;J=O 1n(o.1d-o.1o,o.1r+o.1o*2+o.1o/2+9O,o.1o*2,o.1o)}o.7q.6w.7v(J);z 1e=O 2s();1e.aD(J,o.2U);o.7q.6w.3C=1e;if(o.5T){o.7q.7g.1f=o.2D+"%"}o.2w()},ix:F(e,ce){if(!o.1Y){G}2E=o;5I(ce.1l){1s 1I.2X.c7:o.aV=c9(F(){2E.1Y.7x(2E.1Y.6x()-2E.43,2E.1Y.76())},3F);1m;1s 1I.2X.cf:o.aV=c9(F(){2E.1Y.7x(2E.1Y.6x(),2E.1Y.76()-2E.43)},3F);1m;1s 1I.2X.cg:o.aV=c9(F(){2E.1Y.7x(2E.1Y.6x()+2E.43,2E.1Y.76())},3F);1m;1s 1I.2X.cd:o.aV=c9(F(){2E.1Y.7x(2E.1Y.6x(),2E.1Y.76()+2E.43)},3F);1m}},iC:F(e,ce){5I(ce.1l){1s 1I.2X.g6:o.7D(o.2D+o.56,1Q);1m;1s 1I.2X.g1:o.7D(o.2D-o.56,1Q);1m;1s 1I.2X.g3:o.gb(e);1m;1s 1I.2X.c7:if(o.1Y){o.1Y.7x(o.1Y.6x()-o.43,o.1Y.76())}1m;1s 1I.2X.cf:if(o.1Y){o.1Y.7x(o.1Y.6x(),o.1Y.76()-o.43)}1m;1s 1I.2X.cg:if(o.1Y){o.1Y.7x(o.1Y.6x()+o.43,o.1Y.76())}1m;1s 1I.2X.cd:if(o.1Y){o.1Y.7x(o.1Y.6x(),o.1Y.76()+o.43)}1m}if(o.c8){o.fU(o,o.c8.id);if(o.ai){o.iB()}}},iA:F(T){o.6S=T},qT:F(){G o.6S},qW:F(){G o.ai},iU:F(T){o.ai=T},iT:F(T){if(o.2D!==T){o.7D(T)}},iS:F(){G o.2D},qV:F(T){if(o.3n!==T){o.3n=T;o.3D();o.3U();o.2w()}},qQ:F(){G o.3n},qP:F(T){if(o.40!==T){o.40=T;o.3D();o.3U();o.2w()}},qS:F(){G o.40},qR:F(T){if(o.56!==T){o.56=T;o.3D();o.3U();o.2w()}},qX:F(){G o.56},r3:F(T){if(o.43!==T){o.43=T;o.3D();o.3U();o.2w()}},r2:F(){G o.43},r5:F(T){if(o.7j!==T){o.7j=T;o.2w()}},r4:F(){G o.7j},qZ:F(T){if(o.2v!==T){o.2v=T;o.3D();o.3U();o.2w()}},qY:F(){G o.2v},r1:F(T){if(o.4o!==T){o.4o=T;o.3D();o.3U();o.2w()}},r0:F(){G o.4o},qO:F(T){if(o.5v!==T){o.5v=T;o.3D();o.3U();o.2w()}},qC:F(){G o.5v},qB:F(T){if(o.5w!==T){o.5w=T;o.3D();o.3U();o.2w()}},qE:F(){G o.5w},qD:F(T){if(o.5D!==T){o.5D=T;o.3D();o.3U();o.2w()}},qy:F(){G o.5D},qx:F(T){if(o.6z!==T){o.6z=T;o.3D();o.3U();o.2w()}},qA:F(){G o.6z},qz:F(T){if(o.5T!==T){o.5T=T;o.3D();o.3U();o.2w()}},qF:F(){G o.5T},qL:F(T){if(o.3Y!==T){o.3Y=T;o.3D();o.3U();o.2w()}},qK:F(){G o.3Y},qN:F(T){if(o.75!==T){o.75=T;o.3D();o.3U();o.2w()}},qM:F(){G o.75},qH:F(T){if(o.2z!==T){o.2z=T;o.3D();o.3U();o.2w()}},qG:F(){G o.2z},qJ:F(T){if(o.2U!==T){o.2U=T;o.3D();o.3U();o.2w()}},qI:F(){G o.2U}};I.4A.5U.7d=F(13){G 1L.aS(I.4A.5U,1c,1c,1c,13)};I.4A.5U.dX=F(13,4U){G 1L.9h(13,4U)};I.1X(5U,"I.4A.5U","57")})(I.4A);z ex=I;ex.3J=I.2h.3J;G ex}));',62,1927,'||||||||||||||||||||||||this|||||||||||var||||||function|return|context|MindFusion|bounds|rect||||new|width|||Math|value||height|length||Utils|||||element|Drawing||||points|mdraw|point|else|null|center|path|text|instance|push|for|scale|elements|type|break|Rect|spacing|brush|prototype|minDim|case|right|Point|bottom|x1|builder|y1|left|key|angle|x2|transform|false|top|size|setAttribute|con|y2|command|mflayer|undefined|baseType|strokeThickness|PI|true|font|pen|apply|imgSize|split|matrix|registerClass|target|Vector||startAngle|format|lineTo|radius||stroke|entry|moveTo||endAngle|svgdoc|line||lines|ArrayList|index|Collections|array|shadow|eventName|restore|save|name|color|string|point2|pivot|Path|point1|indexOf|fill|repaint|_mf_scale|alpha|padding|layoutRect|obj|bucket|zoomFactor|thisObj|start|item|Matrix|clip|pow|Alignment|scroller|mgeo|getBounds|data|y3|min|drawShadow|get_element|canvas|cornerRadius|typeName|scrollTop|ButtonType|Number|x3||||typeof|decorationSize|args|strokeStyle|draw|handler|abs|clone|func|mcol|measure|substring|sin|Text|rotationAngle|MAX_VALUE|cos|lineWidth|part|beginPath|minZoomFactor|scrollLeft|document|max|eventHandlers|result|Diagramming|buttonSize|empty|pt2|pixel|180|while|HashTable|image|shape|createControls|String|100|lineY|event|pt1|Dictionary|polygon|maxWidth|table|scroll|sequences|decoration|rcBox|createSvgElement|arguments|copy|updateControls|ImageAlign|svg|request|tickPosition|org|maxZoomFactor|forEach||scrollStep||baseArguments||polar|thisRef||anticlockwise|img|color2|color1|GraphicsUnit|drawImage|columns|yoff|scaleLen|fromCharCode|input|xoff|clipPath|json|activeColor|Center|114|Size|add|maxDim|sqrt|utftext|output|__baseType|Orientation|http|Controls|method|w3|lineHeight|expandRect|bezierCurveTo|vector|sequence|colors|prop|www|rightButton|Button|upButton|leftButton|downButton|Font|control|picw|pich|parent|2000|maxX|__typeName|createDelegate|rgb|||||||zoomStep|Control|rows|EventArgs|createElementNS|zoomInButton|rad|Vertical|zoomOutButton|105|heap|assignedValues|registerNamespace|div|get|strl|events|constructor|arg|JSON|Builder|content|bottomRight|charAt|initializeBase|borderColor|innerColor|fillStyle|orientation|window|translate|getBrush|specifier|shadowColor|distance|replace|Sys|textElement|switch|lineStart|drawShadows|remove|arr|Geometry|interfaceTypes|Base64|splice|Circle|closer|showLabel|ZoomControl|111|contains|cachedZOrder|MindFusionImpl|fromJson|Canvas|set|measureUnit||||||||textAlignment|Gradient|remaining|instanceof|mnp|Utilities|url|TickPosition|charCodeAt|bType|nodeName|Set|topLeft|hotPen|continue|hotBrush|unit|angle1|angle2|slice|black|toString|slider|getScrollX|transparent|textColor|tickLen|_keyStr|decorationPen|sender|currentX|throw|_mf_transform|xhr_1|Error|drawLine|enc4|enc3|quality|116|currentY|col|splinePoints|multiplyScalar|enabled|white|hash|halfIncrement|getType|measureText|Thickness|hotDecorationPen||addToContext||||snapToZoomStep|getScrollY|||LinearGradientBrush|imageBounds|call|renderer|create|Far|quadraticCurveTo|label|vectRotated|segment|backColor|italic|bold|vector2|Component|fits|vector1|controls|topY|bottomY|ignoreTransform|imgDocRect|setBounds|namespace|setScroll|advance|boundary2|ym|memberName|value1|setZoomFactorInternal|101|value2|dotProduct|chr3|callBaseMethod|DashStyle|row|ellipse|lastWord|boundary1|Queue|rect1|ObservableCollection|farther|colorStops|textAlign|360|baseMethod|lineSize|Near|getEvent|chr2||lasf|sub|||containsPoint||setLineDash|matx|positionY|root|fillText|positionX|transformPoint|formatted|child|prevWidth|xm|invdet|ItemEventArgs|110|node|underline|minAngle|rotateAt|words|x4|raiseEvent|end|head|scriptOffset|mouseDownPoint|fromLTRB|strli|y4|round|percent|body|Bezier|diff|maxLines|rightX|leftX|addHandlers|removeHandler|hotDecorationBrush|CancelEventArgs|enc2|dispose|decorationBrush|arcTo|shadowsOnly|choice2|minX|keys|choice1|minY|chr1|isCounterclockwise|Assigned|parse|Function|||strokeDashStyle|Ellipse||pathString|||||currentIntersection|updateScale|parts|funcName|Y1|fromPoints|Y2|findControl|temp|initialize|cj_1|118|arcPath|maxY|000000|Stretch|rgba|fittingPart|parseInt|Arc|ticks|255|startY|floor|zOrder|convert|close|102|documentElement|enc1|fbody|isInstanceOfType|swap|Container|visibility|commands|licenseLocation|ctx|parentNode|getters|position|blue|svgMatrix|colorString|Grid|drawDashLine|children|lineAlignment|gridSizeX|tagName|getTime|registerDisposableObject|Date|||gridSizeY|try|parser|resize|addEventListener|responseData|addColorStop|vect|prop2Name|callback|Value|propName|properties|field|PathParser|autoPostBack|catch|toJson|__registeredTypes|_element|desiredWidth|style|green|isHot|drawUnderline|Dom|115|sweepAngle|href|cartesianToPolarDegrees|manipulators|imgRect|getPixel|rotate|0001|link|addRoundRect|gridOffsetY|gridOffsetX|pointOffset|pixelSize|Type|desiredHeight|buf|updatePathDefinition|none|appendChild|req|repaintId|radius2|all|createControl|toLowerCase|radius1|timer|prms|lineJoin|word|coef|Shadow|||choice1Closer|Pixel|zoomChanged|substr|eventHandlerList|ccw|transformRect|ratioPic|offset|Image|Line|count|red|addHandler|Array||sans|distanceSq|buckets|serif|getHandler|cell|tail|targetId||location|radians|CardinalSpline|PriorityQueue|compareFunction|prototypeClass|Border3D|createCallback|currentManipulator|px2|linkAdded|DistanceToSegment|FFFFFF|Both|toUpperCase|128|currentFormat|alignToPixel|dashStyle|refSegment|Millimeter|ensureStart|p2x|form|zIndex|licenseKey|minVisibleFontSize|Uint16Array|getElementById|toFixed|p1y|transformPoints|00|init|200||||p2y|regexp|nearestDistanceSq|ScrollLeft|postDataField|setInterval|Visible||str|ScrollDown|button|ScrollUp|ScrollRight||getContext|Visibility|imageAlign|currentDistanceSq|clearHandlers|p1x|sSin|eCos|eSin|middle|closePath|sCos|Left|topRight|pos|||bottomLeft|X1|X2|pointX|inheritsFrom|list|AbstractionLayer|offsetY|offsetX|predicate|source|ptRes|108|src|d12|diagram|parseType|d13|pAngle|testedPoints|rAngle|angleFromPoints|Object|getPageScroll|_mf_itemRef|yOffset|getCursorPos|minDistSquared||||eventList|references|Fit|more|implementation|filter|symmetricPoint|radiusY|MsAjaxImpl|currentPoint|xe|ye|enableStyledText|lineX|MindFusionControls|sort|addVector|memberValue||from|next|childNodes|atan2|eval|savedTransform||invalidate|innerScroller|drawCallback|||wspos|mousePosition|createElement|dx2|BottomRight|dy2|lastPoint|originalPoints|startIndex|TopRight|epsilon|equalEpsilon|mouseUpDelegate|dy1|degrees|arc|toPoint|clipId|dot|betweenOrEqualSorted|crossings|area|LayoutAlignment|inflate|find|approximation|polarToCartesianDegrees|degreeToRadian|||send|Tile|getImageRect|proxy|drawChildren|BottomCenter|nowait|||MiddleLeft|rect2|getIntersectionPoint|equals|startXhr|getBoundingClientRect|distSquared|invalidParent|res|intersect|addCubicBezierPoints|00001|dx1|nextii|kappa|ppoints|define|distToRectSelect|MiddleRight|TopCenter|distanceToSegmentSquared|||responseText|status|BottomLeft|ZoomSlider|addTransform|polarToCartesian|_mf_minVisibleFontSize|fromTwoPoints|d23|qAngle|fromThreePoints|cartesianToPolar|fixDown|rectPen|rectBrush|fixUp|srcList|onZoomChanged|any|forReverse|collectSequences|mouseInputDispatcher|strokeText|cachedSequences|LineBreak|newLine|scaleStart||||hitTestManipulators|_mf_links|textHeight|rotationTransform|fitInBounds|getLines|halign|lastFormat|textBaseline|valign|utf|loaded|application|charset|halfChord|midPoint|Inch|bezierTo|POST|gray||bodyElement|autoRemove|handlerOwner|done|not|ajaxRequest|svgPath|isNaN|roundRect|coord1|unitsPerInch|indexInBucket|itemAdded|isAssignment|items|radiusX|impl|270|centerDistance|checkImplementation|isLargeArc|Right|innerHTML|addRect|hitTest|viewport|flag2|RegExp|GridStyle|gridStyle|measureString|number|preparePostback|half|parseStyledText|test|wrappedLines|getStyledLines|effectiveMeasuredWidth|ZoomOut|anchor|ZoomScale|match|adjustY|ZoomIn|adjustX|sep|flag1|effectiveMeasuredHeight|onSliderMove|knownColor|cc_1|newRect|XMLHttpRequest|getZOrder|updateCanvasSize||Empty|parentDiv|clockwise|styled|TopLeft|prevWspos|bezier|open|applyFormat|suppressPaint|setTransform|separators|checked|scrollbarSize|getScrollbarSize|setPen|angleRotation|imgDocSize|normalize|_mf_measureUnit|targetUnit|wrapLine|fitInLine|invert|values|pl2|parentRect|sourceUnit|pl1|det|clipShape|updatePosition|wrapText|angleBetween|setText|112|normalizeRect|measureStyledText|drawStyledText|applyTo|getDefaultProperty|ratioCtrl|drawLines|union|cachedText|addToFormat|sup|removeFromFormat|findWhitespace|pop|childNode|getAttribute|createSequence|fitInLineWrapByChar|npoints|setDefaultProperty|MIN_VALUE|distanceToLineSquared|Display|getCornerPoints|drawPath|Centimeter|amount|WpfPoint|boundingRect|Document|mdiag|maxHeight|layoutWidth|cmdStrings|getDefaultValue|baseline|col1|getSize|col2|applyDiagramTransform|ang|radianToDegree|radian|degree|getCount|destList|polar2|proj|isCircle|d3d3d3|val|ff00ff|778899|newArc|EventHandlerList|setter|forEachKey|clear|coord2|delete|isGetSetter|hashCode|_mf_autoId|objectIdCounter|_item|object|hashString|objectId|align|invisible|||getTopLevel|getBackgroundImage|getBackgroundImageSize|getBackgroundImageAlign|repaintDelegate|showGrid|00ffff|module|updateContainersZOrder|2f4f4f||drawGrid||getEffectiveBackBrush|updateLabelLayout|shadowsStyle|ShadowsStyle|aligned|setScrollX|setScrollY||showLaneGrid|drawMagnifier|808080|drawBackground||laneGrid|drawForeground|currentController|_utf8_encode|onButtonMouseDown|unload|updateTarget|setEnabled|postback|onButtonClick|applyConstraints|prepare|setTimeout|err|onMouseUp|onMouseMove|onMouseDown|error|JavaScriptSerializer|unbind|jqVersion|Application|UI|Serialization|parseFloat|getZoomFactor|setZoomFactor|setAutoPostBack|css|bodyBorderTop|bodyBorderLeft|JQueryImpl|StandAloneImpl|default|setRequestHeader|Content|JQuery|nodeValue|generate|224|_utf8_decode|escapedString|mdom|_cancel|readyState|getChildrenByTagName|removeEventListener|delegate|None|Horizontal|mouseup|ownerDocument|shadowOffsetX|orange|onreadystatechange|stringify|shadowBlur|shadowOffsetY|isPen|knownColors|clientY|clientX|103|ab2str|strLen|parseColor|CatmullRomToBezier|RadialGradientBrush|109|pageXOffset|dec|previi|nextnextii|drawMessage|chrome|endIndex|userAgent|pageYOffset|navigator|checkKnownColor|backgroundColor|cp2y|addQuadraticBezierPoints|stringToRgb|colorRegEx|c2y|cp1x|cp1y|cp2x|hexToRgb|str2ab|xt|yt|y0|8000|x0|bufView|formatString|c1y|c1x|c2x|compareZ|rectX1|num|distToRectPoint|rectX2|fromY|fromX|fromValues|nearest|getSegmentIntersection|logMeInConsole|expDate|itemRefStack|getLeftVector|offset1|arcSegmentToBezier|overrideMimeType|toY|betweenOrEqual|currUnit|toX|getMillimeter|DistanceSq|cpx|setLocation|addArcPoints|cpy|actualWidth|actualHeight|tmp|get_cancel|deleteColumn|set_cancel|deleteRow|onload|insertColumn|setInstance|300|Cannot|forEachValue|funcs|removeAt|addRange|insert|txt|GET|encodeURI|plain|_mf_clipCounter|borderTopWidth|bind|jquery|_mf_defsElement|ajax|contentType|borderLeftWidth|updateCanvasElements|||amd|Common|offsetHeight|exports|findComponent|deserialize|serialize|_events|DomElement||dataType|implement||interface|layer|does|getStandardDivisions|onerror|StandAlone|member|MsAjax|Ajax|distanceToSegment|success|alert|arrange|calculatedScrollSize|Abstract|5522848|||unshift|insertRow|setLicenseKey|onLoad|clientToDoc|backBrush|getMinVisibleFontSize|setMinVisibleFontSize|docToClientOverflow|getRectIntersection|addElement|clientToDocLength|clientToDocOverflow|docToClient|clearRect|OneLevel|117|drawLast|drawFirst|ZOrder|ArrayBuffer|magnifierEnabled|Diagram|clearTimeout|2018|FC1010|drawInteraction|removeElement|gridColor|||gridSizeXInPixels|gridSizeYInPixels|pointSize|getGridPointSize|Lines|offsetWidth|diagClientH|||Points|scrLeft|scrTop|diagClientW|Crosses|sizeChanged|sizeElement|scrollElement|invalidateZOrder|gridPointSize|_mf_originalHeight|scrollHeight|tm2|clientHeight|scrollWidth|tm3|clientWidth|jsdiagram|mapTo|atan|changePriority|||enqueue|dequeue|acos|atob|Hidden|buffer|rotatePoint|getEllipseIntr|popMin|Key|supported|log|diagram_lic|Percent|World|getViewport|add_itemAdded|remove_itemAdded|defaultFont|console|get_item|Collapsed|297|tm5|setMeasureUnit|decodeURIComponent|darkGray|210|||getLicenseLocation|setLicenseLocation|collectHyperlinks|getMeasureUnit|setZoomFactorAndScroll|tm4|addToRect|DashDot|DashDotDot|Custom|Solid||Dash|Dot|Bold|Italic|Underline|tm6|FontStyle|Regular|mediumturquoise|00fa9a|mediumvioletred|48d1cc|mediumslateblue||3cb371|mediumspringgreen|7b68ee||||c71585|ffe4e1|mistyrose|ffe4b5|moccasin|191970|midnightblue|f5fffa|mintcream|mediumseagreen|faf0e6|linen|maroon|magenta|00ff00|lime|32cd32|limegreen|800000|ba55d3|mediumorchid|9370d8|mediumpurple|66cdaa|mediumaquamarine|0000cd|mediumblue|papayawhip|d87093|peachpuff|ffefd5|paleturquoise|98fb98|palevioletred|afeeee|ffdab9|dda0dd|plum|b0e0e6|powderblue|cd853f|peru|ffc0cb|pink|palegreen|fdf5e6|oldlace|808000|olive|ffdead||navajowhite|000080|navy|olivedrab|da70d6|orchid|eee8aa|palegoldenrod|ffa500|||6b8e23|ff4500|orangered|f0fff0|honeydew|ff69b4|hotpink|008000|grey|adff2f|greenyellow|indianred|khaki|fffff0|lavender|f0e68c|indigo|cd5c5c|ivory|4b0082|daa520|floralwhite|b22222|forestgreen|fffaf0|feldspar|1e90ff||||||firebrick|d19275|228b22|gold|f8f8ff|goldenrod|ffd700|gainsboro|fuchsia|ghostwhite|dcdcdc|lightseagreen|ffa07a|lightskyblue|20b2aa|lightpink|90ee90|lightsalmon|ffb6c1|87cefa||b0c4de|lightsteelblue|ffffe0||lightyellow|8470ff|lightslateblue||lightslategrey|lightslategray|lightgreen|lemonchiffon|7cfc00|lightblue|fffacd|lavenderblush|e6e6fa|lawngreen|fff0f5|add8e6|fafad2|lightgoldenrodyellow|lightgrey|lightgray|f08080|lightcoral|e0ffff|lightcyan|purple|Pan|allowed|setDecoration|setShape|Rotate|inherit|NotAllowed||||||Nothing|skyBlue|__doPostBack|submit|clearInterval|setTarget|mousedown|_PostData|registerForSubmit|mousemove|Inherit|Move|pointer|HorizontalResize|move|crosshair|Crosshair|Pointer|Default|CounterDiagonalResize|help|Help|progress|Progress|VerticalResize|DiagonalResize|wait|Wait|setTextColor|getShadowColor|setShowLabel|getTextColor|setInnerColor|getBorderColor|setShadowColor|getInnerColor|getShowLabel|getPadding|setPadding|getCornerRadius|setCornerRadius|getTickPosition|setTickPosition|getSnapToZoomStep|setSnapToZoomStep|setBorderColor|setMaxZoomFactor|getMinZoomFactor|setZoomStep|getMaxZoomFactor|getEnabled|setZoomLevel|setMinZoomFactor|getAutoPostBack|getZoomStep|getFill|setFill|getActiveColor|setActiveColor|getScrollStep|setScrollStep|getBackColor|setBackColor|6a5acd|slateblue|708090|slategray|c0c0c0||||silver|87ceeb|skyblue|snow||tan|4682b4|teal|d2b48c|springgreen|fffafa|steelblue|00ff7f|a0522d|4169e1|royalblue|8b4513|saddlebrown|ff0000|||800080|bc8f8f|rosybrown|salmon|seashell|2e8b57|sienna|fff5ee|sandybrown|fa8072|seagreen|f4a460|Za|decode|127|z0|9acd32|yellowgreen|encode|ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789|2048|MouseCursors|unescapeHtml|auto|Auto|191|192|createTextNode|||escapeHtml|ffff00|turquoise|ff6347|violet|40e0d0|thistle|008080||tomato|d8bfd8|ee82ee||whitesmoke|ffffff|yellow|f5f5f5|d02090|violetred|f5deb3|wheat|dodgerblue|fromArgs|Unknown|getRectPtPercent|Fa|fromCenterAndSize|negate|lengthSquared||||divideScalar|code|newWithOffset|unionRects|NaN|sign|isFloat|distToPolyline|256|FFFFFFFF|FF|getFitTextStep|colorStringToHex|join|_mf_currentLink|aqua|offsetPointCollection|textContent|f0ffff|miter|azure|aquamarine|7fffd4|f0f8ff|antiquewhite|aliceblue|rgbToString|getMinWidth|search|addEllipse|setBrush|container|faebd7|isNumber|createLinearGradient|createRadialGradient|minDistToRect|SolidBrush|getSizeRect|approximateBezier|getClosestSegmentPoint|setCenter|checkIntersect|getBezierPt|getLineHitTest|mid|setRect|subtract|rectPtFromPercent||getCenter||rotateRect|rotatePointsAt|rotatePointAt|pointEqualEpsilon||fromVertex|setFont|arcToBezierCurves||transformAndGetPoints|isEmpty|stringFormat|escapeNewLine|clipToBounds|getText|fromPositionAndSize|getPolygonIntersection|pointInPolygon|topMiddle|intersectsInc|intersectsWith|getApproximatingContext|getFont|getRotationAngle|sameSize|getRotatedBounds|shapeImpl|darkolivegreen|556b2f|8b008b|bdb76b|darkmagenta|9932cc|darkred|darkorchid|darkorange|ff8c00|darkkhaki|008b8b|darkgoldenrod|darkcyan|darkblue|00008b|darkgreen|006400|a9a9a9|b8860b|darkgray|8b0000|deeppink|ff1493|9400d3|setAttributeNS|darkviolet|696969|getClientPos|dimgray|deepskyblue|00bfff|00ced1|8fbc8f|darkslateblue|darkseagreen|darksalmon|e9967a|darkturquoise|1999|darkslategrey|483d8b|darkslategray|horizontalAlignment|ffebcd|0000ff|verticalAlignment|5f9ea0|ffe4c4|7fff00|chartreuse|blanchedalmond|a52a2a|brown|burlywood|deb887|scaleAtCenter|cadetblue|blueviolet|isIdentity|8a2be2|bisque|cornflowerblue|6495ed|cyan|beige|crimson|dc143c|cornsilk|fff8dc|ff7f50|chocolate|xlink|d2691e|_mf_context|coral|f5f5dc'.split('|'),0,{}))
;
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1;};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p;}('(H(b,a){if(5P 14E!="1F"){14E.1nh=a(J)}1k{if(5P Ux=="H"&&5P Ux.1ni=="jk"){Ux(b,a)}1k{I a(J)}}}(["J.1nj"],H(J){J.10O("J.mS");J.mS.gf={Vb:0,Vm:1,Vj:2,145:3,Vi:4,14l:5,UW:6,vk:7};J.mS.AU={WO:0,17V:1,18a:2,19u:3};(H(aU){G gN=aU.gN=H(1g,5d,14t,14x){F.1g=1g;F.ba=zy;F.5E=1c;F.6U=1c;F.9I=aU.gf.Vb;F.cZ=1c;F.bh=aU.AU.WO;F.pZ=1x;F.gH=1x;F.D7=1n.4C(F,14t||F.19L);F.15t=1n.4C(F,14x||F.14Z);if(5d){if(5d.ba!=1c){F.ba=5d.ba}if(5d.5E!=1c){F.5E=5d.5E}if(5d.6U!=1c){F.6U=5d.6U}if(5d.9I){F.9I=5d.9I}if(5d.cZ!=1c){F.cZ=5d.cZ}1k{if(F.9I==aU.gf.Vm){F.cZ=2}1k{if(F.9I==aU.gf.Vi){F.cZ=1.5}1k{if(F.9I==aU.gf.UW){F.cZ=0.5}1k{if(F.9I==aU.gf.Vj){F.cZ=10}}}}}if(5d.bh){F.bh=5d.bh}if(5d.pZ!=1c){F.pZ=5d.pZ}if(5d.gH!=1c){F.gH=5d.gH}}F.ww=0;F.4S=0;F.w1=1c;F.zk=1n.zl();1n.1ng(F)};gN.1s={gT:H(){F.VM()},7V:H(6d,5V){1n.zT(F,6d,5V)},LE:H(6d,5V){1n.j0(F,6d,5V)},3n:H(6d,1W){G 5V=1n.oH(F,6d);if(5V!=1c){5V(F,1W)}},2I:H(){F.mQ=1a fo().BL();F.w1=gN.Lv(F.TQ.zW(F))},VM:H(){if(F.w1!=1c){gN.Vu(F.w1);F.w1=1c;F.3n(aU.2q.J5,J.nK.z9)}},14O:H(){I F.w1!=1c},1nk:H(){if(F.14O()){I F.4S}I 0},TP:H(4S){if(4S===0){I 0}if(4S===1){I 1}6m(F.9I){2k aU.gf.Vb:I 4S;2k aU.gf.Vm:I 1w.a5(4S,F.cZ);2k aU.gf.Vj:I(1w.a5(1w.E,F.cZ*4S)-1)/(1w.a5(1w.E,F.cZ)-1);2k aU.gf.145:I 1-1w.nk(1w.1nl(4S));2k aU.gf.Vi:I 1w.a5(4S,2)*((F.cZ+1)*4S-F.cZ);2k aU.gf.14l:G a=0,b=1;3v(1t){if(4S>=(7-4*a)/11){I-1w.a5((11-6*a-11*4S)/4,2)+1w.a5(b,2)}a+=b;b/=2}2k aU.gf.UW:I 1w.a5(2,10*(4S-1))*1w.Gt(20*1w.PI*F.cZ*4S);2k aU.gf.vk:I F.15t(4S,F.cZ)}},14Z:H(4S,1n5){I 4S},Lk:H(4S){I F.TP(4S)},JA:H(4S){I 1-F.TP(1-4S)},188:H(4S){if(4S<=0.5){I F.Lk(4S*2)/2}1k{I F.JA((4S-0.5)*2)/2+0.5}},19M:H(4S){if(4S<=0.5){I F.JA(4S*2)/2}1k{I F.Lk((4S-0.5)*2)/2+0.5}},TQ:H(){F.w1=gN.Lv(F.TQ.zW(F));F.ww=1a fo().BL();F.4S=(F.ww-F.mQ)/F.ba;if(F.4S>=1){F.4S=1}6m(F.bh){2k aU.AU.WO:F.D7(F,F.Lk(F.4S));2i;2k aU.AU.17V:F.D7(F,F.JA(F.4S));2i;2k aU.AU.18a:F.D7(F,F.188(F.4S));2i;2k aU.AU.19u:F.D7(F,F.19M(F.4S));2i}if(F.4S==1){if(F.pZ){F.4S=0;F.mQ=1a fo().BL()}1k{F.VM()}if(F.gH){G 5f=F.6U;F.6U=F.5E;F.5E=5f}}},19L:H(ep,Aj){if(ep.1g.Kl){ep.1g.Kl(ep,Aj)}},1n9:H(){I F.ba},1na:H(N){if(F.ba!=N){F.ba=N}},pT:H(){I F.5E},1nH:H(N){if(F.5E!=N){F.5E=N}},uh:H(){I F.6U},1nI:H(N){if(F.6U!=N){F.6U=N}},1nJ:H(){I F.9I},1nE:H(N){if(F.9I!=N){F.9I=N}},1nF:H(){I F.cZ},1nG:H(N){if(F.cZ!=N){F.cZ=N}},1nO:H(){I F.bh},1nP:H(N){if(F.bh!=N){F.bh=N}},1nQ:H(){I F.pZ},1nL:H(N){if(F.pZ!=N){F.pZ=N}},1nM:H(){I F.gH},1nN:H(N){if(F.gH!=N){F.gH=N}}};gN.Lv=(H(){if(5P 6V==="1F"){I}G 199=6V.Lv||6V.1nv||6V.1nw||6V.1nr||6V.1ns||H(ab){I 6V.h3(ab,zy/60)};I 199.zW(6V)})();gN.Vu=(H(){if(5P 6V==="1F"){I}G 18W=6V.Vu||6V.1nt||6V.1nx||6V.1nB||6V.1nC||H(id){6V.mB(id)};I 18W.zW(6V)})();J.2x(gN,"J.mS.gN",1c,"1nD.1ny")})(J.mS);J.mS.2q={J5:"J5"};J.10O("J.4j");if(5P $ue=="1F"){$ue={}}(H(mg){G 1E=J.3X.1E;G 3o=J.3X.3o;G 9x=J.3X.9x;G 6l=mg.6l=H(){F.lw=10;F.6K=10;F.nH=1x;F.7v=mg.7o.nN;F.ir=mg.kt.f2;F.8D=mg.lK.Aw;F.cO=1x;F.fZ=mg.lN.6M};6l.1s.uX=1t;6l.1s.mp=1t;6l.1s.xN=1t;6l.1s.us=1x;6l.1s.cv=10;6l.1s.uU=H(){I F.ir==mg.kt.bZ};6l.1s.eQ=H(){I F.nH};6l.1s.a4=H(2s){G 3H;2s.2M.1U(H(v){if(v.aP.T==0){3H=v;I $2i}});if(!3H){I $ue}F.3u=2s.3u(3H);if(!F.3u){I $ue}G LO=3H.x+3H.1l/2;G Ma=3H.y+3H.1o/2;F.x=0;F.y=0;F.Wc(3H);G nC=1a 1E();1h(G i=0;i<F.3u.cC.T;i++){G 9H=F.3u.cC[i];G sz=0;1h(G j=0;j<9H.T;j++){if(F.bm()){sz=1w.2n(sz,9H[j].1l)}1k{sz=1w.2n(sz,9H[j].1o)}}nC.1f(sz)}G 7m=0;G 1Y=0;1h(G l=1;l<nC.T;l++){1Y+=nC[l];1Y+=F.lw}1Y+=F.cv;if(!F.BV()){7m=1Y}1h(G i=0;i<F.3u.cC.T;i++){G 9H=F.3u.cC[i];1h(G j=0;j<9H.T;j++){G S=9H[j];if(F.bm()){S.x+=7m}1k{S.y+=7m}}if(F.BV()){7m+=F.lw+nC[i]}1k{7m+=-(F.lw+nC[i])}}if(F.nH){G LP=3H.x;G M7=3H.y;G iY=LO-LP;G iB=Ma-M7;F.et(3H,iY,iB)}if(F.ir!=mg.kt.f2){6m(F.ir){2k mg.kt.mi:6m(F.7v){2k mg.7o.nN:F.3u.2Y.1U(H(e){e.1b=[{x:e.1O.x+e.1O.1l/2,y:e.1O.y},{x:e.1H.x,y:e.1H.y-e.1H.1o/2}]});2i;2k mg.7o.uw:F.3u.2Y.1U(H(e){e.1b=[{x:e.1O.x+e.1O.1l/2,y:e.1O.y},{x:e.1H.x,y:e.1H.y+e.1H.1o/2}]});2i;2k mg.7o.oG:F.3u.2Y.1U(H(e){e.1b=[{x:e.1O.x,y:e.1O.y+e.1O.1o/2},{x:e.1H.x-e.1H.1l/2,y:e.1H.y}]});2i;2k mg.7o.oA:F.3u.2Y.1U(H(e){e.1b=[{x:e.1O.x,y:e.1O.y+e.1O.1o/2},{x:e.1H.x+e.1H.1l/2,y:e.1H.y}]});2i}2i;2k mg.kt.bZ:6m(F.7v){2k mg.7o.nN:F.3u.2Y.1U(H(e){e.1b=[{x:e.1O.x+e.1O.1l/2,y:e.1O.y},{x:e.1H.x,y:e.1O.y},{x:e.1H.x,y:e.1H.y-e.1H.1o/2}]});2i;2k mg.7o.uw:F.3u.2Y.1U(H(e){e.1b=[{x:e.1O.x+e.1O.1l/2,y:e.1O.y},{x:e.1H.x,y:e.1O.y},{x:e.1H.x,y:e.1H.y+e.1H.1o/2}]});2i;2k mg.7o.oG:F.3u.2Y.1U(H(e){e.1b=[{x:e.1O.x,y:e.1O.y+e.1O.1o/2},{x:e.1O.x,y:e.1H.y},{x:e.1H.x-e.1H.1l/2,y:e.1H.y}]});2i;2k mg.7o.oA:F.3u.2Y.1U(H(e){e.1b=[{x:e.1O.x,y:e.1O.y+e.1O.1o/2},{x:e.1O.x,y:e.1H.y},{x:e.1H.x+e.1H.1l/2,y:e.1H.y}]});2i}2i}}};6l.1s.Wc=H(S){G rc=1a J.1B.1I.lG(S);rc.x=F.x;rc.y=F.y;if(F.7v==mg.7o.oA){G IO=J.1B.1I.lG(F.3u.3H);G s=rc.1l;rc=1a 1I(IO.2Z()-s,rc.3c(),rc.1l,rc.1o)}1k{if(F.7v==mg.7o.uw){G IO=J.1B.1I.lG(F.3u.3H);G s=rc.1o;rc=1a 1I(rc.3R(),IO.3F()-s,rc.1l,rc.1o)}}S.x=rc.x+rc.1l/2;S.y=rc.y+rc.1o/2;if(F.bm()){F.y+=rc.1o+F.6K}1k{F.x+=rc.1l+F.6K}G 191=F;u7(S).1U(H(2c){191.Wc(2c)})};6l.1s.et=H(P6,iY,iB){G P5=H(S,1D){S.x+=1D[0];S.y+=1D[1]};uH(P6,P5,[iY,iB])};6l.1s.bm=H(){I F.7v==mg.7o.oG||F.7v==mg.7o.oA};6l.1s.BV=H(){I F.7v==mg.7o.oG||F.7v==mg.7o.nN};H u7(S){G 2C=1a 1E();S.6a.1U(H(e){2C.1f(e.1H)});I 2C}H uH(S,9v,1D){9v.oI(F,S,1D);G 2C=u7(S);2C.1U(H(2c){uH(2c,9v,1D)})}6l.hG=H(){if(!mg.q4){mg.q4=1a J.8Q(6l.1s)}1k{mg.q4.8M(1c)}I mg.q4};6l.1s.aL=H(){if(!mg.q4){mg.q4=1a J.8Q(6l.1s,1c,F)}1k{mg.q4.8M(F)}I mg.q4};6l.1s.gY=H(){I F.7i.ek};mg.q4=1c;6l.1s.15V=H(){I F.lw};6l.1s.15Y=H(N){F.lw=N};6l.1s.O8=H(){I F.6K};6l.1s.Oa=H(N){F.6K=N};6l.1s.15U=H(){I F.nH};6l.1s.16G=H(N){F.nH=N};6l.1s.SO=H(){I F.7v};6l.1s.SP=H(N){F.7v=N};6l.1s.16l=H(){I F.ir};6l.1s.16g=H(N){F.ir=N};6l.1s.FD=H(){I F.8D};6l.1s.FC=H(N){F.8D=N};6l.1s.Fn=H(){I F.cO};6l.1s.Fa=H(N){F.cO=N};6l.1s.LN=H(){I F.fZ};6l.1s.M8=H(N){F.fZ=N};J.2x(6l,"J.4j.6l")})(J.4j);(H(mg){G aI=mg.aI=H(1O,1H){F.1O=1O;F.1H=1H};aI.1s.cr=H(2S){I F.1O==2S?F.1H:F.1O};aI.1s.1mr=H(2U){if(F.1O==2U.1O||F.1O==2U.1H){I F.1O}if(F.1H==2U.1O||F.1H==2U.1H){I F.1H}I 1c};aI.1s.1ms=H(v1,v2){if(F.1O==v1&&F.1H==v2||F.1O==v2&&F.1H==v1){I 1t}I 1x};aI.1s.137=H(){I[F.1O,F.1H]};aI.1s.187=H(2S){I F.1O==2S||F.1H==2S};aI.1s.18j=H(2U){I F.1O.2Y.2O(2U)||F.1H.2Y.2O(2U)};aI.1s.Ew=H(v){F.1O.2Y.54(F);F.1O.6a.54(F);v.2Y.1f(F);v.6a.1f(F);F.1O=v};aI.1s.19e=H(v){F.1H.2Y.54(F);F.1H.aP.54(F);v.2Y.1f(F);v.aP.1f(F);F.1H=v};aI.1s.zu=H(v,w){if(F.1O==v){F.Ew(w)}1k{if(F.1H==v){F.19e(w)}}};aI.1s.gH=H(){G Wi=F.1O;G QW=F.1H;F.1O=QW;Wi.6a.54(F);F.1O.6a.1f(F);F.1H=Wi;QW.aP.54(F);F.1H.aP.1f(F)};aI.1s.1mq=H(1H){if(F.1H!=1H){F.gH()}};aI.1s.1mu=H(){G r=1a aI(1H,1O,F);r.1my=1t;I r};J.2x(aI,"J.4j.aI")})(J.4j);J.4j.8X={ex:1,nz:2};J.4j.ye={17L:1,ex:2,nz:3};J.4j.lK={Aw:0,117:1,13f:2};J.4j.7o={nN:0,oG:1,uw:2,oA:3};J.4j.kt={f2:0,mi:1,bZ:2};J.4j.lN={hg:0,6M:1};J.4j.5U=J.4j.lN;(H(mg){G 3o=J.3X.3o;G 1E=J.3X.1E;G 9l=mg.9l=H(){F.8D=mg.lK.Aw;F.cO=1x;F.3H=1c;F.fZ=mg.lN.6M};9l.1s.uX=1x;9l.1s.mp=1x;9l.1s.xN=1t;9l.1s.us=1t;9l.1s.cv=10;9l.1s.a4=H(2s){G 3H=F.3H&&F.3H.2S&&2s.2M.2O(F.3H.2S)?F.3H.2S:2s.2M[0];3H.ID=1t;F.KW=1a 3o();F.Rh(3H);G 16z=F.KW.1V(3H);F.11m(16z,{x:0,y:0},0)};9l.1s.Rh=H(S){G w=S.1l;G h=S.1o;G kB={};G 5h=1w.i7(w*w+h*h)/2;kB.S=S;F.KW.2X(S,kB);G jS=[];G AE=0;S.WA().1U(H(2c){if(F.KW.2O(2c)){I}G 9G=F.Rh(2c);jS.1f(9G);AE+=9G.5h},F);jS.8F(17d);if(!S.ID){AE=AE*72/71}G Sm=[{x:-w/2,y:-h/2},{x:w/2,y:-h/2},{x:w/2,y:h/2},{x:-w/2,y:h/2}];G Fw=0;if(!S.ID){Fw+=1w.PI/72}G Rz=2*1w.PI;1h(G i=0;i<jS.T;++i){G 9G=jS[i];G AF=Rz*9G.5h/AE;if(AF>1w.PI){AF=1w.PI;Rz=1w.PI;AE-=9G.5h}9G.AF=AF}1h(G i=0;i<jS.T;++i){G 9G=jS[i];G Fq=9G.AF/2;Fw+=Fq;9G.4J=Fw;Fw+=Fq;G FY=1w.2n(5h+9G.5h,9G.5h/1w.nk(Fq));9G.FY=FY;G Sl=1w.2n(5h+2*9G.5h,9G.5h+9G.5h/1w.nk(Fq));G fD={x:Sl*1w.Gt(9G.4J),y:Sl*1w.nk(9G.4J)};Sm.1f(fD)}if(jS.T>0){G HF=J.c7.hx.gK(Sm);kB.5h=HF.r;kB.Rn=HF.x;kB.R1=HF.y}1k{kB.5h=5h;kB.Rn=kB.R1=0}kB.jS=jS;I kB};9l.1s.11m=H(tc,2N,4J){G G5=4J;if(!tc.S.ID){G5+=1w.PI-tc.4J}G v0={x:2N.x-tc.Rn,y:2N.y-tc.R1};1E.1U(tc.jS,H(9G){G IY={x:v0.x+9G.FY*1w.Gt(9G.4J),y:v0.y+9G.FY*1w.nk(9G.4J)};IY=J.c7.17f(IY,2N,G5);F.11m(9G,IY,G5)},F);v0=J.c7.17f(v0,2N,G5);tc.S.x=v0.x;tc.S.y=v0.y};H 17d(e1,e2){G r1=e1.5h;G r2=e2.5h;if(r1<r2){I 1}if(r1>r2){I-1}I 0}9l.hG=H(){if(!mg.qn){mg.qn=1a J.8Q(9l.1s)}1k{mg.qn.8M(1c)}I mg.qn};9l.1s.aL=H(){if(!mg.qn){mg.qn=1a J.8Q(9l.1s,1c,F)}1k{mg.qn.8M(F)}I mg.qn};9l.1s.gY=H(){I F.7i.ek};mg.qn=1c;9l.1s.FD=H(){I F.8D};9l.1s.FC=H(N){F.8D=N};9l.1s.Fn=H(){I F.cO};9l.1s.Fa=H(N){F.cO=N};9l.1s.1mi=H(){I F.3H};9l.1s.1mj=H(N){F.3H=N};9l.1s.LN=H(){I F.fZ};9l.1s.M8=H(N){F.fZ=N};J.2x(9l,"J.4j.9l")})(J.4j);(H(mg){G 1E=J.3X.1E;G 3o=J.3X.3o;G 8X=J.4j.8X;G ye=J.4j.ye;G 6O=mg.6O=H(){F.2M=1a 1E();F.2Y=1a 1E()};6O.1s.1T=H(Hb){G 1K=1a 6O();if(Hb){1K.12Z=1a 3o();1K.16P=1a 3o()}G yh=1a 3o();F.2M.1U(H(v){G H4=v.1T();yh.2X(v,H4);1K.2M.1f(H4);if(Hb){1K.12Z.2X(H4,v)}});F.2Y.1U(H(e){if(yh.2O(e.1O)&&yh.2O(e.1H)){G 16Z=1K.qX(yh.1V(e.1O),yh.1V(e.1H));if(Hb){1K.16P.2X(16Z,e)}}});I 1K};6O.1s.3u=H(3H,ic,qJ){G 3u=1a 6O();3H.3x=0;3u.3H=3H;G 6T=1a 1E();G ok=1a 1E();3u.2M.1f(3H);6T.1f(3H);ok.1f(3H);G Fe=1;3v(ok.T>0){G 56=ok.dq();56.6a.1U(H(e){if(6T.2O(e.1H)){I}G 1O=e.1O;G 1H=e.1H;1H.3x=1O.3x+1;1H.1j=1O;if(Fe<1H.3x+1){Fe=1H.3x+1}ok.1f(1H);6T.1f(1H);3u.2M.1f(1H);3u.2Y.1f(e)})}if(ic){ok.1f(3H);6T=1a 1E();6T.1f(3H);3v(ok.T>0){G 56=ok.dq();G eH=8X.nz;1h(G i=0;i<56.6a.T;i++){G 2c=56.6a[i].1H;if(6T.2O(2c)){2V}ok.1f(2c);6T.1f(2c);6m(2c.4a.vg().yV){2k ye.ex:2c.bP=8X.ex;2i;2k ye.nz:2c.bP=8X.nz;2i;2k ye.17L:if(eH===8X.ex){2c.bP=8X.nz}1k{2c.bP=8X.ex}2i;fI:2V}eH=2c.bP}}6T=1a 1E();Fe=F.12J(6T,3H,qJ)+1}G cC=1a 1E();1h(G i=0;i<Fe;i++){cC.1f(1a 1E())}3u.2M.1U(H(v){cC[v.3x].1f(v)});3u.cC=cC;I 3u};6O.1s.12J=H(6T,1j,qJ){G tQ=1j.3x;G uR=1j.3x;G zE=1j.3x;G Ku=-1;G p4=1a 1E();1h(G i=0;i<1j.6a.T;i++){p4.1f(1j.6a[i].1H)}p4.8F(H(a,b){G 10T=a.4a.vg().yV;G 10S=b.4a.vg().yV;if(10T&&!10S){I-1}if(!10T&&10S){I 1}I a.1y-b.1y});1h(G i=0;i<p4.T;i++){G 2c=p4[i];if(6T.2O(2c)){2V}6T.1f(2c);if(2c.4a.vg().yV){if(2c.bP===8X.ex){if(qJ){2c.3x=tQ+1}1k{2c.3x=1w.2n(tQ,uR)+1}}1k{if(2c.bP===8X.nz){if(qJ){2c.3x=uR+1}1k{2c.3x=zE+1}}}}1k{if(Ku===-1){Ku=1w.2n(tQ,uR)+1}2c.3x=Ku}G Le=F.12J(6T,2c,qJ);if(2c.4a.vg().yV){if(2c.bP===8X.ex){tQ=1w.2n(tQ,Le)}1k{uR=1w.2n(uR,Le);zE=1w.2n(tQ,uR)}}1k{zE=1w.2n(zE,Le)}}I 1w.2n(zE,tQ)};6O.1s.qX=H(1O,1H,4a){G 2U=1a mg.aI(1O,1H);F.2Y.1f(2U);2U.1O.6a.1f(2U);2U.1O.2Y.1f(2U);2U.1H.aP.1f(2U);2U.1H.2Y.1f(2U);if(4a){2U.4a=4a}I 2U};6O.1s.MF=H(2U){F.2Y.1f(2U);2U.1O.6a.1f(2U);2U.1O.2Y.1f(2U);2U.1H.aP.1f(2U);2U.1H.2Y.1f(2U)};6O.1s.vQ=H(2U){F.2Y.54(2U);1E.54(2U.1O.6a,2U);1E.54(2U.1O.2Y,2U);1E.54(2U.1H.aP,2U);1E.54(2U.1H.2Y,2U)};6O.1s.qG=H(zt,4a){G 2S=1a mg.bR();F.2M.1f(2S);if(zt){2S.x=zt.x;2S.y=zt.y;2S.1l=zt.1l;2S.1o=zt.1o}if(4a){2S.4a=4a}I 2S};6O.1s.Gs=H(2S){F.2M.1f(2S);1E.1U(2S.6a,H(2U){F.2Y.1f(2U)},F)};6O.1s.wo=H(){1h(G i=0;i<F.2M.T;++i){G 2S=F.2M[i];2S.1y=i}1h(G i=0;i<F.2Y.T;++i){G 2U=F.2Y[i];2U.1y=i}};6O.1s.Ev=H(){F.uW=0;F.wo();G pi=15n(F.2M.T,-1);1h(G v=0;v<F.2M.T;v++){if(pi[v]==-1){F.129(pi,v);F.uW++}}G jN=[];1h(G i=0;i<F.uW;++i){jN[i]=1a 6O()}1h(G i=0;i<pi.T;++i){G 2s=jN[pi[i]];2s.Gs(F.2M[i])}I jN};6O.1s.129=H(pi,126){pi[126]=F.uW;G 2S=F.2M[126];1E.1U(2S.2Y,H(2U){G 56=2U.cr(2S);G 12n=56.1y;if(pi[12n]==-1){F.129(pi,12n)}},F)};6O.1s.1mX=H(){G IG=[];F.wo();F.2Y.1U(H(2U){5M 2U.yw});G uW=0;G g6=[];G rG=[];G nS=[];1h(G v=0;v<F.2M.T;v++){G 2S=F.2M[v];if(g6[2S.1y]!==1F){2V}if(2S.2Y.T==0){G 3l=1a 6O();3l.Gs(2S);IG.1f(3l.1T(1t));2V}G jX=[];G r5=[];g6[2S.1y]=uW++;nS[2S.1y]=g6[2S.1y];jX.1f(2S);r5.1f(2S.2Y.9D(0));3v(1t){3v(r5[r5.T-1].T>0){G FJ=jX[jX.T-1];G 2U=r5[r5.T-1].kK();G qP=2U.cr(FJ);if(2U.yw){2V}rG.1f(2U);2U.yw=1t;if(g6[qP.1y]===1F){g6[qP.1y]=uW++;jX.1f(qP);r5.1f(qP.2Y.9D(0));nS[qP.1y]=g6[FJ.1y]}1k{if(g6[qP.1y]<nS[FJ.1y]){nS[FJ.1y]=g6[qP.1y]}}}if(jX.T>1){G 3c=jX[jX.T-1];G 56=jX[jX.T-2];if(nS[3c.1y]==g6[56.1y]){G 3l=1a 6O();G rj=rG[rG.T-1];3v(g6[rj.1O.1y]>=g6[56.1y]&&g6[rj.1H.1y]>=g6[56.1y]){rG.dq();if(!3l.2M.2O(rj.1O)){3l.Gs(rj.1O)}if(!3l.2M.2O(rj.1H)){3l.Gs(rj.1H)}if(rG.T==0){2i}rj=rG[rG.T-1]}IG.1f(3l.1T(1t))}1k{if(nS[56.1y]>nS[3c.1y]){nS[56.1y]=nS[3c.1y]}}jX.dq();r5.dq()}1k{2i}}}I IG};6O.1s.1mI=H(){I F.Xt(1x)};6O.1s.14i=H(){I F.Xt(1t)};6O.1s.Xt=H(K3){if(F.2M.T<2){I K3?1a 1E():[F]}if(F.2M[0].1y===1F){F.wo()}F.2Y.1U(H(e){5M e.JW;5M e.Cv});G w8=1a 1E();G 18T=0;G 3T=[];G nd=[];G hU=[];G pA=[];G jx=[];G al=[];G Cp=[];G gC=[];G CK=[];G D3=1a 3o();H XU(v,vp){G vi=v.1y;3T[vi]=18T++;CK[vi]=v;nd[vi]=1;hU[vi]=3T[vi];pA[vi]=v;jx[vi]=3T[vi];al[vi]=v;if(gC[vi]===1F){gC[vi]=[]}v.2Y.1U(H(e){if(e==vp){I}G w=e.cr(v);G wi=w.1y;if(3T[wi]===1F){e.Cv=1t;e.2c=w;XU(w,e);G s=gC[wi];G 3c=s.T>0?s[s.T-1]:1c;if(3c!=1c&&w==3c.q){s.dq();w8.1f([e,3c.2U]);e.JW=1t;3c.2U.JW=1t;if(K3){if(!D3.2O(3c.2U)){D3.2X(3c.2U,1a 1E())}D3.1V(3c.2U).1f(e)}if(v!=3c.p){s.1f({2U:3c.2U,p:3c.p,q:v})}if(3c.2U.Cv){G y=3c.2U.2c.1y;CK[y]=v}}nd[vi]=nd[vi]+nd[wi];if(hU[wi]<hU[vi]){jx[vi]=hU[vi];hU[vi]=hU[wi];al[vi]=pA[vi];pA[vi]=pA[wi];gC[vi]=gC[wi].9D(0);Cp[vi]=e}1k{if(hU[wi]<jx[vi]){jx[vi]=hU[wi];al[vi]=pA[wi];gC[wi]=[]}}}1k{if(3T[vi]>3T[wi]){if(3T[wi]<=hU[vi]){jx[vi]=hU[vi];hU[vi]=3T[wi];al[vi]=pA[vi];pA[vi]=w;gC[vi]=[];Cp[vi]=e}1k{if(3T[wi]<jx[vi]){jx[vi]=3T[wi];al[vi]=w}}}}});G s=gC[vi];G 3c=s.T>0?s[s.T-1]:1c;if(3c==1c){if(jx[vi]>hU[vi]){s.1f({2U:Cp[vi],p:pA[vi],q:al[vi]})}}1k{if(jx[vi]>3T[3c.q.1y]){s.1f({2U:Cp[vi],p:3c.q,q:al[vi]})}1k{3v(s.T>0&&jx[vi]<=3T[s[s.T-1].p.1y]){s.dq()}if(s.T>0&&jx[vi]<3T[s[s.T-1].q.1y]){G se=s.dq();s.1f({2U:se.2U,p:se.p,q:al[vi]})}}}v.2Y.1U(H(e){G u=e.cr(v);G ui=u.1y;if(e.Cv||3T[vi]>3T[ui]){I}G 3c=s.T>0?s[s.T-1]:1c;G y=3c==1c?1c:3c.2U.2c;G yi=y?y.1y:0;3v(3c!=1c&&3c.2U.Cv&&3T[yi]<=3T[ui]&&3T[ui]<=3T[yi]+nd[yi]-1){s.dq();3c=s.T>0?s[s.T-1]:1c;y=3c==1c?1c:3c.2U.2c;yi=y?y.1y:0}})}XU(F.2M[0],1c);if(K3){D3.1U(H(1p1,2Y){1h(G i=0;i<2Y.T;i++){1h(G j=i+1;j<2Y.T;j++){if(!w8.yO(H(p){I p[0]==2Y[i]&&p[1]==2Y[j]})){w8.1f([2Y[i],2Y[j]])}}}});I w8}G K8=1a 1E();F.2Y.1U(H(e){if(e.JW){K8.1f(e)}});K8.1U(H(e){F.vQ(e)},F);G 10u=[];F.2M.1U(H(v){if(CK[v.1y]!=v){G e=F.qX(v,CK[v.1y]);10u.1f(e)}},F);G 186=F.Ev();10u.1U(H(e){F.vQ(e)},F);K8.1U(H(e){F.MF(e)},F);I 186};6O.1s.1p3=H(){G va=F.2M;if(va.T<4){I[]}H 18P(v1,v2){G h2=[];G 6T=[];G yw=1;va.1U(H(v){if(v!=v1&&v!=v2){h2.1f(v);6T[v.1y]=1t;I $2i}});3v(h2.T>0){G v=h2.kK();v.WA().1U(H(n){if(6T[n.1y]||v1==n||v2==n){I}h2.1f(n);6T[n.1y]=1t;yw++})}I yw==va.T-2}F.wo();G pU=[];1h(G i=0;i<va.T-1;i++){1h(G j=i+1;j<va.T;j++){if(!18P(va[i],va[j])){pU.1f([va[i],va[j]])}}}I pU};6O.1s.1p4=H(){G 18C=0;G 3T=[];G ZB=[];G 9j=[];G al=[];G 1j=[];G 2C=[];G nd=[];G Zz=[];G pU=1a 1E();G Hf=1a 1E();G gZ=F;G 12l=gZ.2M.T;F.2Y.1U(H(e){5M e.hj});H Xq(V,P){G v=V.1y;2C[v]=[];3T[v]=18C++;ZB[3T[v]]=V;1j[v]=P;9j[v]=al[v]=3T[v];nd[v]=1;V.2Y.1U(H(e){G W=e.cr(V);G w=W.1y;if(3T[w]===1F){e.hj=1t;2C[v].1f(W);Xq(W,V);if(9j[w]<9j[v]){al[v]=1w.2H(9j[v],al[w]);9j[v]=9j[w]}1k{if(9j[w]==9j[v]){al[v]=1w.2H(al[v],al[w])}1k{al[v]=1w.2H(al[v],9j[w])}}nd[v]+=nd[w]}1k{if(3T[w]<3T[v]&&(w!=P.1y||Zz[v])){if(3T[w]<9j[v]){al[v]=9j[v];9j[v]=3T[w]}1k{if(3T[w]>9j[v]){al[v]=1w.2H(al[v],3T[w])}}}}if(W==P){Zz[v]=1t}});if(P){G X=ZB[9j[v]];G xF=nd[v];if(X!=P&&al[v]>=3T[P.1y]&&xF<12l-2){pU.1f([X,P])}1k{if(3T[X.1y]>0&&13p(X,P,V)){pU.1f([X,P])}}}G Zy=1x;Zk(V).1U(H(Q){if(9j[v]==9j[Q.1y]){Zy=1t;I $2i}});if(nd[v]>1&&!Zy){G vc=gZ.qG();vc.1y=gZ.2M.T-1;1E.1U(V.2Y.9D(0),H(e){if(!e.hj){G W=e.cr(V);if(3T[v]>3T[W.1y]){e.zu(V,vc)}}});G ce=gZ.qX(V,vc);ce.1y=gZ.2Y.T-1;ce.hj=1t;3T[vc.1y]=3T[v];9j[vc.1y]=9j[v];nd[vc.1y]=1;1j[vc.1y]=V;Zc(vc,V);Hf.1f(vc)}G Zx=0;V.2Y.1U(H(e){if(!e.hj){Zx++}});if(Zx>1){Zc(V,V);Hf.1f(V)}}H 13n(a,d){G 2u=1a 1E();3v(1j[d.1y]!=a){2u.1f(1j[d.1y]);d=1j[d.1y]}I 2u}H 13p(a,d,v){G 13w=13n(a,d);G vn=1t;13w.1U(H(S){S.2Y.1U(H(e){G w=e.cr(S);if(w==a||w==d){I}if(3T[w.1y]===1F){vn=1x}1k{if(3T[w.1y]<3T[a.1y]){vn=1x}1k{if(3T[w.1y]>3T[d.1y]&&3T[w.1y]<3T[v.1y]){vn=1x}1k{if(9j[w.1y]<3T[a.1y]){vn=1x}}}}});if(!vn){I $2i}});I vn}H Zk(V){G v=V.1y;G 2C=1a 1E();V.2Y.1U(H(e){if(e.hj){G W=e.cr(V);if(3T[v]<3T[W.1y]){2C.1f(W)}}});I 2C}H Zc(V,A7){G v=V.1y;G vZ=1a 1E();G vU=1a 1E();V.2Y.1U(H(e){if(e.hj){I}G W=e.cr(V);if(3T[v]>3T[W.1y]){if(!vZ.2O(W)){vZ.1f(W)}}1k{if(!vU.2O(W)){vU.1f(W)}}});vZ.8F(E1);vU.8F(E1);G zv=1a 1E();vZ.1U(H(n){G r=gZ.qG();r.pS=A7;r.1y=gZ.2M.T-1;nd[r.1y]=nd[v];zv.1f(r)});G zp=1a 1E();vU.1U(H(n){G r=gZ.qG();r.pS=A7;r.1y=gZ.2M.T-1;nd[r.1y]=nd[v];zp.1f(r)});G nx=[];zv.13V(H(v){nx.1f(v)});zp.13V(H(v){nx.1f(v)});1h(G i=0;i<nx.T-1;i++){G e=gZ.qX(nx[i],nx[i+1]);e.1y=gZ.2Y.T-1;e.pS=A7;e.hj=1t}G vp=1c;G Zd=1a 1E();V.2Y.1U(H(e){if(e.hj){G W=e.cr(V);if(3T[v]<3T[W.1y]){Zd.1f(e)}1k{if(3T[v]>=3T[W.1y]){vp=e}}}});if(vp){vp.zu(V,nx[0]);vp.pS=A7}Zd.1U(H(Zl){Zl.zu(V,nx[nx.T-1]);Zl.pS=A7});1j[nx[0].1y]=1j[v];1h(G i=0;i<vZ.T;i++){G u=vZ[i];G 153=V.WB(u);153.1U(H(e){if(!e.hj){e.zu(V,zv[i])}});9j[zv[i].1y]=9j[v];3T[zv[i].1y]=3T[v]}1h(G i=0;i<vU.T;i++){G w=vU[i];G 15x=V.WB(w);15x.1U(H(e){if(!e.hj){e.zu(V,zp[i])}});9j[zp[i].1y]=9j[v];3T[zp[i].1y]=3T[v]}}H E1(v1,v2){if(3T[v1.1y]<3T[v2.1y]){I-1}if(3T[v1.1y]>3T[v2.1y]){I 1}I 0}H 13r(a,d){3v(1j[d.1y]!=a){d=1j[d.1y]}I d}F.wo();Xq(F.2M[0],1c);Hf.1U(H(V){gZ.2M.54(V)});G 125=1a 1E();G w8=F.14i();w8.1U(H(8w){if(!(8w[0].hj&&8w[1].hj)){I}G I5=8w[0].137();G IW=8w[1].137();I5.8F(E1);IW.8F(E1);if(!1j[I5[0].1y]&&nd[IW[1].1y]===1){I}if(!1j[IW[0].1y]&&nd[I5[1].1y]===1){I}G xV=[];xV.1f(8w[0].1O);xV.1f(8w[0].1H);G xZ=[];xZ.1f(8w[1].1O);xZ.1f(8w[1].1H);1h(G i=0;i<xV.T;i++){1h(G j=0;j<xZ.T;j++){if(xV[i]!=xZ[j]){125.1f([xV[i],xZ[j]])}}}});125.1U(H(8w){G a,d;if(3T[8w[0].1y]<3T[8w[1].1y]){a=8w[0];d=8w[1]}1k{d=8w[0];a=8w[1]}if(a.pS){a=a.pS}if(d.pS){d=d.pS}if(a==d){I}G xF=15b(a,d,2C[d.1y][0],2C[d.1y]);if(xF[1]!=0&&xF[0]+xF[2]!=0&&!pU.yO(H(e){I e[0]==a&&e[1]==d})){pU.1f([a,d])}});H 15b(a,d,v,2C){G Q4=2C.T==0?0:nd[v.1y];G U=13r(a,d);G Qc=nd[U.1y]-Q4-1;2C.1U(H(W){if(W==v){I}if(9j[W.1y]<3T[a.1y]){Qc-=nd[W.1y]}});G 13T=12l-Qc-Q4-2;I[13T,Qc,Q4]}I pU};6O.1s.14e=H(){if(F.2M.T<=1||F.2Y.T<=1){I[]}if(F.2M.T==2){G 2W=[];G 2U=F.2Y[0];2U.gH();2W.1f(2U);I 2W}G 1K=F.1T(1t);G n=F.2M.T;G cq=1a 3o();1K.2M.1U(H(v){Dz(v,n,cq)});G sl=[];G sr=[];3v(1K.2M.T>0){if(cq.2O(2-n)){G Dj=cq.1V(2-n);3v(Dj.T>0){G DC=Dj.dq();DC.2Y.1U(H(e){G 7a=e.cr(DC);G eP=EL(7a,n);cq.1V(eP).54(7a);7a.vQ(e);Dz(7a,n,cq)});1K.2M.54(DC);sr.Wb(DC)}}if(cq.2O(n-2)){G 13c=cq.1V(n-2);3v(13c.T>0){G Df=13c.dq();Df.2Y.1U(H(e){G 7a=e.cr(Df);G eP=EL(7a,n);cq.1V(eP).54(7a);7a.vQ(e);Dz(7a,n,cq)});1K.2M.54(Df);sl.1f(Df)}}if(1K.2M.T>0){1h(G i=n-3;i>2-n;i--){if(cq.2O(i)&&cq.1V(i).T>0){G 144=cq.1V(i);G v=144.dq();v.2Y.1U(H(e){G 7a=e.cr(v);G eP=EL(7a,n);cq.1V(eP).54(7a);7a.vQ(e);Dz(7a,n,cq)});1K.2M.54(v);sl.1f(v);2i}}}}1E.h4(sl,sr);G Py=1a 3o();1h(G i=0;i<F.2M.T;i++){Py.2X(1K.12Z.1V(sl[i]),i)}G E0=1a 1E();F.2Y.1U(H(e){if(Py.1V(e.1O)>Py.1V(e.1H)){e.gH();E0.1f(e)}});I E0};H EL(2S,n){if(2S.6a.T==0){I 2-n}1k{if(2S.aP.T==0){I n-2}1k{I 2S.6a.T-2S.aP.T}}}H Dz(2S,n,cq){G eP=EL(2S,n);if(!cq.2O(eP)){cq.2X(eP,1a 1E())}cq.1V(eP).1f(2S)}H 15n(1Y,N){G kL=[];1h(G i=0;i<1Y;++i){kL[i]=N}I kL}J.2x(6O,"J.4j.6O")})(J.4j);(H(mg){G 1E=J.3X.1E;G 3U=mg.3U=H(2B){if(2B){F.2u=1E.1T(2B.2u);F.1X=1E.1T(2B.1X);F.1R=1E.1T(2B.1R)}1k{F.2u=1a 1E();F.1X=1a 1E();F.1R=1a 1E()}};3U.1s={2O:H(1g){if(1n.2D(J.1e.3m,1g)){if(1E.2O(F.2u,1g)){I 1t}I 1x}1k{if(1E.2O(F.1X,1g)){I 1t}I 1x}},rK:H(JI,JJ){G 5B=0;if(JI){F.2u.1U(H(S){5B+=S.5B})}if(JJ){F.1X.1U(H(1i){5B+=1i.5B})}I 5B},4K:H(1i,S){if(1i&&1n.2D(J.1e.4c,1i.4a)){F.1X.1f(1i);F.1R.1f(1i)}if(S&&1n.2D(J.1e.3m,S.4a)){F.2u.1f(S);F.1R.1f(S)}if(1i&&1n.2D(J.1e.3m,1i.4a)){F.2u.1f(1i);F.1R.1f(1i)}},};J.2x(3U,"J.4j.3U")})(J.4j);(H(mg){G 1E=J.3X.1E;G 10C=J.3X.10C;G 3o=J.3X.3o;G 3t=mg.3t=H(){};J.4j.3t.Zr=H(2s,9y,to){I 3t.wZ(2s,9y,to,1x,0)};J.4j.3t.wZ=H(2s,9y,to,10x,Ci){G 2W=[];if(9y==to&&10x){G 2B=1a mg.3U();2B.4K(9y);2W.1f(2B);I 2W}G Ex=1a 10C();G nQ=1a mg.3U();nQ.4K(9y);Ex.13W(nQ);G 10t=1x;3v(1t){G 1Y=Ex.m8();if(1Y==0){2i}if(10t&&10x){2i}1h(G i=0;i<1Y;i++){nQ=Ex.1py();G 13l=nQ.2u[nQ.2u.T-1];G 1X=13l.6a;1h(G k=0;k<1X.T;k++){G 1i=1X[k];G Ej=1i.1H;if(nQ.2O(1i)){2V}if(Ej==to){G yH=1a mg.3U(nQ);yH.4K(1i,Ej);2W.1f(yH);if(Ci!=0&&2W.T>=Ci){I 2W}10t=1t;2V}if(!nQ.2O(Ej)){G yH=1a mg.3U(nQ);yH.4K(1i,Ej);Ex.13W(yH)}}}}I 2W};J.4j.3t.Zv=H(2s,9y,to,Cj,Cd){if(!Cj&&!Cd){G cV=J.4j.3t.wZ(2s,9y,to,1t);if(cV.T>0){I cV[0]}1k{I 1c}}G cV=J.4j.3t.wZ(2s,9y,to,1x);if(cV.T==0){I 1c}G ZA=5O.7T;G Zw=1c;1h(G i=0;i<cV.T;i++){G 5B=cV[i].rK(Cj,Cd);if(5B<ZA){ZA=5B;Zw=cV[i]}}I Zw};J.4j.3t.ZC=H(2s,9y,to){G cV=J.4j.3t.wZ(2s,9y,to,1x);if(cV.T>0){I cV[cV.T-1]}1k{I 1c}};J.4j.3t.ZJ=H(2s,vR){if(vR){G yF=J.4j.3t.wZ(2s,vR,vR,1x);if(yF.T>0){G 2B=yF[0];1E.xa(2B.2u,2B.2u.T-1);1E.xa(2B.1R,2B.1R.T-1);I 2B}I 1c}1k{1h(G i=0;i<F.2s.2M.T;i++){G yF=J.4j.3t.wZ(2s,F.2s.2M[i],F.2s.2M[i],1x);if(yF.T>0){G 2B=yF[0];1E.xa(2B.2u,2B.2u.T-1);1E.xa(2B.1R,2B.1R.T-1);I 2B}}I 1c}};3t.1c5=H(2s){G 2W=[];G ab=H(c){2W.1f(c)};3t.19s(2s,ab);I 2W};3t.19s=H(2s,19x){3t.z5=1a 3o();3t.wI=1a 1E();3t.qK=1a 1E();3t.F1=1a 3o();3t.GH=1a 3o();G 1y=0;G vs=2s.2M;vs.1U(H(v){3t.F1.2X(v,1y++)});G ab=H(c){3v(3t.wI.T!=0){3t.z5.54(3t.wI.dq())}I 19x(c)};vs.1U(H(v){J.4j.3t.10B(v,v,ab)})};3t.10B=H(2I,2S,ab,Oi){G O7=1x;G Oi=H(c){O7=1t;I ab(c)};3t.qK.1f(2S);3t.z5.2X(2S,1t);3t.wI.1f(2S);G 2Y=2S.6a;2Y.1U(H(2U){G z7=2U.1H;if(!3t.108(2S).2O(z7)){G jO=3t.F1.1V(z7)-3t.F1.1V(2I);if(jO<0){3t.108(2S).2X(z7,1t)}1k{if(jO==0){O7=1t;G 2B=1a mg.3U();G it=3t.qK.7g(2I);1h(G i=it;i<3t.qK.T;i++){2B.2u.1f(3t.qK[i])}1h(G i=0;i<2B.2u.T;i++){G n1=2B.2u[i];G n2=2B.2u[(i+1)%2B.2u.T];G l=1c;G Me=n1.6a;1h(G k=0;k<Me.T;k++){if(Me[k].cr(n1)==n2){l=Me[k];2i}}2B.1X.1f(l);2B.1R.1f(n1);2B.1R.1f(l)}Oi(2B);I $2i}1k{if(!3t.z5.2O(z7)){3t.10B(2I,z7,ab,Oi)}}}}});if(O7){3v(3t.wI.T>0){3t.z5.54(3t.wI.dq())}}1E.xa(3t.qK,3t.qK.T-1)};3t.108=H(v){G 2W=3t.GH.2O(v)?3t.GH.1V(v):1c;if(2W==1c){2W=1a 3o();3t.GH.2X(v,2W)}I 2W};3t.wI;3t.qK;3t.z5;3t.F1;3t.GH;J.2x(3t,"J.4j.3t")})(J.4j);(H(mg){G 1E=J.3X.1E;G 3o=J.3X.3o;G 9x=J.3X.9x;G 8X=J.4j.8X;G 5Z=mg.5Z=H(){F.lw=10;F.6K=10;F.nH=1x;F.7v=mg.7o.nN;F.ir=mg.kt.f2;F.8D=mg.lK.Aw;F.cO=1x;F.ic=1x;F.qJ=1x;F.fZ=mg.lN.6M};5Z.1s.uX=1t;5Z.1s.mp=1t;5Z.1s.xN=1t;5Z.1s.us=1x;5Z.1s.cv=10;5Z.1s.uU=H(){I F.ir==mg.kt.bZ};5Z.1s.eQ=H(){I F.nH};5Z.1s.a4=H(2s){G 3H;2s.2M.1U(H(v){if(v.aP.T==0){3H=v;I $2i}});if(!3H){I $ue}G 3u=2s.3u(3H,F.ic,F.qJ);if(!3u){I $ue}3u.2M.1U(H(v){v.kh=v.4a.vg().yV});G LO=3H.x+3H.1l/2;G Ma=3H.y+3H.1o/2;uH(3u,3H,H(S,1D){S.x=S.1l/2;S.y=S.1o/2},1c);G nC=1a 1E();1h(G i=0;i<3u.cC.T;i++){G 9H=3u.cC[i];G sz=0;1h(G j=0;j<9H.T;j++){if(F.bm()){sz=1w.2n(sz,9H[j].1l)}1k{sz=1w.2n(sz,9H[j].1o)}}nC.1f(sz)}G XB=3u.cC[3u.cC.T-1];G s=0;1h(G i=0;i<XB.T;i++){G S=XB[i];if(F.bm()){S.y=s+S.1o/2;s+=S.1o+F.6K}1k{S.x=s+S.1l/2;s+=S.1l+F.6K}}G OI=1a 3o();G Oh=1a 3o();1h(G i=3u.cC.T-1;i>=0;i--){G 9H=3u.cC[i];1h(G j=0;j<9H.T;j++){G S=9H[j];G 2C=u7(3u,S);if(2C.T>0){if(F.17B(S)&&F.ic){G yG=1F;G Fv=1F;2C.1U(H(2c){if(2c.bP===8X.ex){yG=2c}1k{if(2c.bP===8X.nz){Fv=2c}}});if(yG&&Fv){G GF=F.kg(yG);G Z0=F.kg(Fv);if(F.bm()){S.y+=GF.3F()+(Z0.3c()-GF.3F())/2-S.1o/2}1k{S.x+=GF.2Z()+(Z0.3R()-GF.2Z())/2-S.1l/2}}1k{if(yG){G zM=F.kg(yG);if(F.bm()){S.y=zM.3F()+F.6K/2}1k{S.x=zM.2Z()+F.6K/2}}1k{G zM=F.kg(Fv);if(F.bm()){S.y=zM.3c()-F.6K/2}1k{S.x=zM.3R()-F.6K/2}}}}1k{G cz=J.1B.1I.lG(2C[0]);1h(G c=1;c<2C.T;c++){cz=cz.8P(J.1B.1I.lG(2C[c]))}if(F.bm()){S.y+=(cz.3c()+cz.3F())/2-S.1o/2}1k{S.x+=(cz.3R()+cz.2Z())/2-S.1l/2}}}if(S.kh&&F.ic){G eL=[];if(S.1j){1h(G c=0;c<S.1j.6a.T;c++){G 2c=S.1j.6a[c].1H;if(2c.kh){2V}eL.1f(2c)}}if(eL.T>0){G cz=J.1B.1I.lG(eL[0]);1h(G c=1;c<eL.T;c++){cz=cz.8P(J.1B.1I.lG(eL[c]))}G rc=F.kg(S);if(F.bm()){G 4R=0;if(S.bP===8X.ex){4R=cz.y+cz.1o/2-rc.3F()-F.6K/2}1k{4R=cz.y+cz.1o/2-rc.3c()+F.6K/2}F.et(3u,S,0,4R)}1k{G 4R=0;if(S.bP===8X.ex){4R=cz.x+cz.1l/2-rc.2Z()-F.6K/2}1k{4R=cz.x+cz.1l/2-rc.3R()+F.6K/2}F.et(3u,S,4R,0)}}1k{if(S.1j){G uY=1F;if(OI.2O(S.1j)){uY=OI.1V(S.1j)}G uF=1F;if(Oh.2O(S.1j)){uF=Oh.1V(S.1j)}if(uY||uF){G cj=F.kg(S);if(S.bP===8X.nz){if(uF){G iu=F.kg(uF);if(F.bm()){G 4R=iu.3c()-cj.3c();F.et(3u,S,0,4R)}1k{G 4R=iu.3R()-cj.3R();F.et(3u,S,4R,0)}}1k{if(uY){G iu=F.kg(uY);if(F.bm()){G 4R=iu.3F()+F.6K-cj.3c();F.et(3u,S,0,4R)}1k{G 4R=iu.2Z()+F.6K-cj.3R();F.et(3u,S,4R,0)}}}}1k{if(uY){G iu=F.kg(uY);if(F.bm()){G 4R=iu.3F()-cj.3F();F.et(3u,S,0,4R)}1k{G 4R=iu.2Z()-cj.2Z();F.et(3u,S,4R,0)}}1k{if(uF){G iu=F.kg(uF);if(F.bm()){G 4R=iu.3c()-F.6K-cj.3F();F.et(3u,S,0,4R)}1k{G 4R=iu.3R()-F.6K-cj.2Z();F.et(3u,S,4R,0)}}}}}}}}if(S.kh&&F.ic){if(S.bP===8X.ex){OI.2X(S.1j,S)}1k{if(S.bP===8X.nz){Oh.2X(S.1j,S)}}}}1h(G j=0;j<9H.T-1;j++){1h(G k=j;k>=0;k--){if(9H[k].kh||9H[j+1].kh){2V}G 8I=F.16W(3u,9H[k],9H[j+1]);G 161=k!=j;if(161?8I<F.6K:1t){if(F.bm()){F.et(3u,9H[j+1],0,F.6K-8I)}1k{F.et(3u,9H[j+1],F.6K-8I,0)}}}}}G Mj;G F2;G Mv;if(F.BV()){Mj=0;F2=3u.cC.T;Mv=+1}1k{Mj=3u.cC.T-1;F2=-1;Mv=-1}G v7=0;1h(G i=Mj;F.BV()?i<F2:i>F2;i+=Mv){G zD=0;G 9H=3u.cC[i];1h(G j=0;j<9H.T;j++){G S=9H[j];G 1Y=0;if(F.bm()){1Y=S.1l;G iY=0;if(F.7v==mg.7o.oA){iY=nC[i]-1Y}S.x=v7+iY+F.cv+S.1l/2;S.y=S.y+F.cv}1k{1Y=S.1o;G iB=0;if(F.7v==mg.7o.uw){iB=nC[i]-1Y}S.x=S.x+F.cv;S.y=v7+iB+F.cv+S.1o/2}zD=1w.2n(zD,1Y)}v7+=zD+F.lw}if(F.nH){G LP=3H.x;G M7=3H.y;G iY=LO-LP;G iB=Ma-M7;F.et(3u,3H,iY,iB)}if(F.ir!=mg.kt.f2){6m(F.ir){2k mg.kt.mi:6m(F.7v){2k mg.7o.nN:3u.2Y.1U(H(e){e.1b=[{x:e.1O.x,y:e.1O.y+e.1O.1o/2},{x:e.1H.x,y:e.1H.y-e.1H.1o/2}]});2i;2k mg.7o.uw:3u.2Y.1U(H(e){e.1b=[{x:e.1O.x,y:e.1O.y-e.1O.1o/2},{x:e.1H.x,y:e.1H.y+e.1H.1o/2}]});2i;2k mg.7o.oG:3u.2Y.1U(H(e){e.1b=[{x:e.1O.x+e.1O.1l/2,y:e.1O.y},{x:e.1H.x-e.1H.1l/2,y:e.1H.y}]});2i;2k mg.7o.oA:3u.2Y.1U(H(e){e.1b=[{x:e.1O.x-e.1O.1l/2,y:e.1O.y},{x:e.1H.x+e.1H.1l/2,y:e.1H.y}]});2i}2i;2k mg.kt.bZ:G ic=F.ic;G od=F.lw/2;6m(F.7v){2k mg.7o.nN:3u.2Y.1U(H(e){if(ic&&e.1H.kh){e.1b=[{x:e.1O.x,y:e.1O.y+e.1O.1o/2},{x:e.1O.x,y:e.1H.y},e.1H.bP===8X.ex?{x:e.1H.x+e.1H.1l/2,y:e.1H.y}:{x:e.1H.x-e.1H.1l/2,y:e.1H.y}]}1k{e.1b=[{x:e.1O.x,y:e.1O.y+e.1O.1o/2},{x:e.1O.x,y:e.1H.y-e.1H.1o/2-od},{x:e.1H.x,y:e.1H.y-e.1H.1o/2-od},{x:e.1H.x,y:e.1H.y-e.1H.1o/2}]}});2i;2k mg.7o.uw:3u.2Y.1U(H(e){if(ic&&e.1H.kh){e.1b=[{x:e.1O.x,y:e.1O.y-e.1O.1o/2},{x:e.1O.x,y:e.1H.y},e.1H.bP===8X.ex?{x:e.1H.x+e.1H.1l/2,y:e.1H.y}:{x:e.1H.x-e.1H.1l/2,y:e.1H.y}]}1k{e.1b=[{x:e.1O.x,y:e.1O.y-e.1O.1o/2},{x:e.1O.x,y:e.1H.y+e.1H.1o/2+od},{x:e.1H.x,y:e.1H.y+e.1H.1o/2+od},{x:e.1H.x,y:e.1H.y+e.1H.1o/2}]}});2i;2k mg.7o.oG:3u.2Y.1U(H(e){if(ic&&e.1H.kh){e.1b=[{x:e.1O.x+e.1O.1l/2,y:e.1O.y},{x:e.1H.x,y:e.1O.y},e.1H.bP===8X.ex?{x:e.1H.x,y:e.1H.y+e.1H.1o/2}:{x:e.1H.x,y:e.1H.y-e.1H.1o/2}]}1k{e.1b=[{x:e.1O.x+e.1O.1l/2,y:e.1O.y},{x:e.1H.x-e.1H.1l/2-od,y:e.1O.y},{x:e.1H.x-e.1H.1l/2-od,y:e.1H.y},{x:e.1H.x-e.1H.1l/2,y:e.1H.y}]}});2i;2k mg.7o.oA:3u.2Y.1U(H(e){if(ic&&e.1H.kh){e.1b=[{x:e.1O.x-e.1O.1l/2,y:e.1O.y},{x:e.1H.x,y:e.1O.y},e.1H.bP===8X.ex?{x:e.1H.x,y:e.1H.y+e.1H.1o/2}:{x:e.1H.x,y:e.1H.y-e.1H.1o/2}]}1k{e.1b=[{x:e.1O.x-e.1O.1l/2,y:e.1O.y},{x:e.1H.x+e.1H.1l/2+od,y:e.1O.y},{x:e.1H.x+e.1H.1l/2+od,y:e.1H.y},{x:e.1H.x+e.1H.1l/2,y:e.1H.y}]}});2i}}}};5Z.1s.17B=H(S){1h(G i=0;i<S.6a.T;i++){if(S.6a[i].1H.kh){I 1t}}I 1x};5Z.1s.kg=H(3H){G 1I=J.1B.1I;G 5f=[];5f.1f(3H);G 6T=1a 1E();G 2W;3v(5f.T>0){G S=5f[0];5f.dg(0,1);6T.1f(S);if(!2W){2W=1I.lG(S)}1k{2W=2W.8P(1I.lG(S))}1h(G i=0;i<S.6a.T;i++){G 2c=S.6a[i].1H;if(!6T.2O(2c)){5f.1f(2c)}}}I 2W};5Z.1s.16W=H(3u,7X,7W){G 8I=F.3R(7W)-F.2Z(7X);G MX=1a 3o();G MW=1a 3o();PZ(3u,7X,MX);PZ(3u,7W,MW);G A0=MX.A0();1h(G i=0;i<A0.T;i++){G sk=A0[i];if(!MW.2O(sk)){2V}G MN=MX.1V(sk);G PV=MW.1V(sk);G r=0;1h(G j=0;j<MN.T;j++){r=1w.2n(r,F.2Z(MN[j]))}G l=5O.7T;1h(G j=0;j<PV.T;j++){l=1w.2H(l,F.3R(PV[j]))}if((l-r<8I)&&(MN.T>0&&PV.T>0)){8I=l-r}}I 8I};5Z.1s.2Z=H(2S){if(F.bm()){I 2S.y+2S.1o/2}1k{I 2S.x+2S.1l/2}};5Z.1s.3R=H(2S){if(F.bm()){I 2S.y-2S.1o/2}1k{I 2S.x-2S.1l/2}};H PZ(3u,S,Gi){G sk=S.3x;G 3x=1c;if(Gi.2O(sk)){3x=Gi.1V(sk)}1k{3x=1a 1E();Gi.2X(sk,3x)}3x.1f(S);u7(3u,S).1U(H(2c){PZ(3u,2c,Gi)})}5Z.1s.et=H(3u,P6,iY,iB){if(!iY&&!iB){I}G P5=H(S,1D){S.x+=1D[0];S.y+=1D[1]};uH(3u,P6,P5,[iY,iB])};5Z.1s.bm=H(){I F.7v==mg.7o.oG||F.7v==mg.7o.oA};5Z.1s.BV=H(){I F.7v==mg.7o.oG||F.7v==mg.7o.nN};H h5(As,BT){I(As-As%BT)/BT}H u7(3u,S){G 2C=1a 1E();S.6a.1U(H(e){if(3u.2Y.2O(e)){2C.1f(e.1H)}});I 2C}H uH(3u,S,9v,1D){9v.oI(F,S,1D);G 2C=u7(3u,S);2C.1U(H(2c){uH(3u,2c,9v,1D)})}5Z.hG=H(){if(!mg.rs){mg.rs=1a J.8Q(5Z.1s)}1k{nB.8M(1c)}I mg.rs};5Z.1s.aL=H(){if(!mg.rs){mg.rs=1a J.8Q(5Z.1s,1c,F)}1k{mg.rs.8M(F)}I mg.rs};5Z.1s.gY=H(){I F.7i.ek};mg.rs=1c;5Z.1s.15V=H(){I F.lw};5Z.1s.15Y=H(N){F.lw=N};5Z.1s.O8=H(){I F.6K};5Z.1s.Oa=H(N){F.6K=N};5Z.1s.15U=H(){I F.nH};5Z.1s.16G=H(N){F.nH=N};5Z.1s.SO=H(){I F.7v};5Z.1s.SP=H(N){F.7v=N};5Z.1s.16l=H(){I F.ir};5Z.1s.16g=H(N){F.ir=N};5Z.1s.FD=H(){I F.8D};5Z.1s.FC=H(N){F.8D=N};5Z.1s.Fn=H(){I F.cO};5Z.1s.Fa=H(N){F.cO=N};J.2x(5Z,"J.4j.5Z")})(J.4j);(H(mg){G 1E=J.3X.1E;G 3o=J.3X.3o;G 9x=J.3X.9x;G 6p=mg.6p=H(){F.5L=mg.5U.hg;F.Mg=1t;F.6g=1;F.5e=1c;F.Mo=0;F.198=1};6p.1s.uX=1x;6p.1s.mp=1x;6p.1s.xN=1x;6p.1s.us=1x;6p.1s.FS=1t;6p.1s.cv=10;6p.1s.uU=H(){I 1x};6p.1s.eQ=H(){I 1x};6p.1s.a4=H(2s){if(F.5e==1c){F.5e=2s.5e}G Nr=[];F.en=1a 3o();G Ar=0;2s.2M.1U(H(2S){if(2S.3r==1c){Ar+=F.WU(2S);Nr.1f(2S)}},F);if(F.Mg){F.Vp(Nr,F.5e,[],Ar)}1k{F.VL(Nr,F.5e,F.5L==mg.5U.6M,Ar)}};6p.1s.Vp=H(2u,5e,1J,lA){G 2C=2u.9D();G en=F.en;2C.8F(H(n1,n2){I en.1V(n2)-en.1V(n1)});F.OD(2C,5e,1J,lA)};6p.1s.OD=H(2C,5e,1J,lA){G 5F=5e.1l>5e.1o;G nR=1w.2H(5e.1l,5e.1o);G Nt=0,Wm=0;G Cy=1J.9D();if(2C.T>0){G S=2C[0];Cy.1f(S);G kc=5e.1l*5e.1o;Nt=F.VJ(1J,nR,kc*F.5B(1J)/lA);Wm=F.VJ(Cy,nR,kc*F.5B(Cy)/lA)}if(2C.T>0&&(Nt==0||Nt>=Wm)){2C.kK();F.OD(2C,5e,Cy,lA)}1k{G 8y=F.193(5e,1J,!5F,lA);lA-=F.5B(1J);if(5F){5e.x+=8y;5e.1l-=8y}1k{5e.y+=8y;5e.1o-=8y}if(2C.T>0){F.OD(2C,5e,[],lA)}}};6p.1s.5B=H(1J){G 6A=0;1J.1U(H(S){6A+=F.en.1V(S)},F);I 6A};6p.1s.D1=H(1r){G hp=-F.6g/2;1r=1r.7u(hp);G mm=F.198;if(1r.1l<mm){1r.1l=mm}if(1r.1o<mm){1r.1o=mm}};6p.1s.193=H(5e,1J,5F,lA){G 1I=J.1B.1I;G 192=5e.1l*5e.1o;G nR=5F?5e.1l:5e.1o;G 6A=0;1J.1U(H(S){6A+=F.en.1V(S)},F);G lj=192*6A/lA;G 8y=lj/nR;G 3I=5F?5e.x:5e.y;1J.1U(H(S){G 5B=F.en.1V(S);G 1d=5F?1a 1I(3I,5e.y,lj*5B/6A/8y,8y):1a 1I(5e.x,3I,8y,lj*5B/6A/8y);F.D1(1d);4G(S,1d);3I+=lj*5B/6A/8y;if(S.eL!=1c){G 2C=S.eL.9D();G Bn=F.WV(S);F.D1(Bn);F.Vp(2C,Bn,[],5B)}},F);I 8y};6p.1s.VL=H(2u,5e,5F,Ar){G 1I=J.1B.1I;G 3I=5F?5e.x:5e.y;G T=5F?5e.1l:5e.1o;2u.1U(H(S){G Oe=T*F.en.1V(S)/Ar;G 1d=5F?1a 1I(3I,5e.y,Oe,5e.1o):1a 1I(5e.x,3I,5e.1l,Oe);F.D1(1d);4G(S,1d);if(S.eL!=1c){G 2C=S.eL.9D();G Bn=F.WV(S);F.D1(Bn);F.VL(2C,Bn,!5F,F.en.1V(S))}3I+=Oe},F)};6p.1s.VJ=H(1J,nR,lj){G Om=0;G 6A=0;1J.1U(H(S){G 5B=F.en.1V(S);6A+=5B},F);1J.1U(H(S){G 5B=F.en.1V(S);G kc=lj*5B/6A;Om=1w.2n(Om,1w.2n(nR*nR*kc/(lj*lj),lj*lj/(nR*nR*kc)))},F);I Om};6p.1s.WU=H(3H){if(F.en.2O(3H)){I F.en.1V(3H)}if(3H.eL==1c){F.en.2X(3H,3H.5B);I 3H.5B}G 5B=0;3H.eL.1U(H(2c){5B+=F.WU(2c)},F);F.en.2X(3H,5B);I 5B};6p.1s.WV=H(S){G 1I=J.1B.1I;G la=1I.lG(S);if(S.uz){G uz=S.uz;if(uz<la.1o){la.y+=uz;la.1o-=uz}1k{la.y+=la.1o/2;la.1o/=2}}if(S.eL!=1c){I la.7u(-F.Mo)}I la};H 4G(2S,1r){G c=1r.2N();2S.x=c.x;2S.y=c.y;2S.1l=1r.1l;2S.1o=1r.1o}6p.hG=H(){if(!mg.nB){mg.nB=1a J.8Q(6p.1s)}1k{mg.nB.8M(1c)}I mg.nB};6p.1s.aL=H(){if(!mg.nB){mg.nB=1a J.8Q(6p.1s,1c,F)}1k{mg.nB.8M(F)}I mg.nB};6p.1s.gY=H(){I F.7i.ek};mg.nB=1c;6p.1s.XA=H(){I F.5L};6p.1s.IM=H(N){F.5L=N};6p.1s.1oz=H(){I F.Mg};6p.1s.1oA=H(N){F.Mg=N};6p.1s.1cu=H(){I F.6g};6p.1s.1cr=H(N){F.6g=N};6p.1s.1ow=H(){I F.5e};6p.1s.1ox=H(N){F.5e=N};6p.1s.1oB=H(){I F.Mo};6p.1s.1oF=H(N){F.Mo=N};J.2x(6p,"J.4j.6p")})(J.4j);(H(mg){G 1E=J.3X.1E;G bR=mg.bR=H(){F.2Y=1a 1E();F.6a=1a 1E();F.aP=1a 1E();F.5B=1};bR.1s.1T=H(){G 1K=1a bR();if(F.2v!==1F){1K.2v=F.2v}if(F.5B!==1F){1K.5B=F.5B}if(F.Xa!==1F){1K.Xa=F.Xa}if(F.4a!==1F){1K.4a=F.4a}I 1K};bR.1s.vQ=H(2U){if(2U.1O==F){F.2Y.54(2U);F.6a.54(2U);2U.1O=1c}if(2U.1H==F){F.2Y.54(2U);F.aP.54(2U);2U.1H=1c}};bR.1s.187=H(2U){I F.2Y.2O(2U)};bR.1s.18j=H(2S){I F.11U(2S)!==1c};bR.1s.11U=H(2S){G 18l=F;I F.2Y.yO(H(2U){I 2U.cr(18l)===2S},F)};bR.1s.WB=H(2S){I F.2Y.1oD(H(2U){I 2U.cr(F)===2S},F)};bR.1s.1oE=H(2S){I F.6a.yO(H(2U){I 2U.1H==2S})};bR.1s.WA=H(){G 8W=1a 1E();F.aP.1U(H(e){8W.1f(e.cr(F))},F);F.6a.1U(H(e){8W.1f(e.cr(F))},F);I 8W};bR.1s.C1=H(){I F.2Y.T};J.2x(bR,"J.4j.bR")})(J.4j);(H(mg){G 8c=mg.8c=H(){F.6K=30;F.Ac=1ol;F.M4=1x;F.Cb=0;F.EU=0;F.8D=mg.lK.Aw;F.cO=1x;F.fZ=mg.lN.6M};8c.1s.us=1t;8c.1s.cv=10;8c.1s.a4=H(2s){F.Cb=F.6K*9;F.EU=F.Cb;F.2s=2s;G gI=14W(2s,P0(2s),1,4);F.1l=gI.1l;F.1o=gI.1o;1h(G fY=0;fY<F.Ac;fY++){F.M4=fY>=F.Ac*3/4;2s.2M.1U(H(v){F.18J(v)},F);2s.2Y.1U(H(e){F.18G(e)},F);2s.2M.1U(H(v){F.13s(v)},F);F.EU=F.M4?F.Cb/30:F.Cb*(1-fY/F.Ac/2)}};8c.1s.WP=H(v,5h){G a=1w.18f()*2*1w.PI;G l=5h*1w.18f();if(l==0){l=5h/2}v.x+=l*1w.Gt(a);v.y-=l*1w.nk(a)};8c.1s.WK=H(5y,vB,v1,v2){G a=0;if(F.M4){G vx=v1.x-v2.x;G vy=v1.y-v2.y;G 17U=v1.1l/2;G 17Z=v1.1o/2;G 17Q=v2.1l/2;G 181=v2.1o/2;a=(vx*vx)/1w.a5(17U+17Q+vB,2)+(vy*vy)/1w.a5(17Z+181+vB,2)}1k{a=5y*5y/vB/vB}I a*4/3};8c.1s.18E=H(5y,vB,v1,v2){I 1/F.WK(5y,vB,v1,v2)};8c.1s.18J=H(v){v.dx=0;v.dy=0;G By=F.6K;F.2s.2M.1U(H(v2){if(v2==v){I}3v(v.x==v2.x&&v.y==v2.y){F.WP(v2,By/4)}G vx=v.x-v2.x;G vy=v.y-v2.y;G 5y=1w.i7(vx*vx+vy*vy);G r=F.18E(5y,By,v,v2);v.dx+=(vx/5y)*r;v.dy+=(vy/5y)*r},F)};8c.1s.18G=H(e){G v1=e.1O;G v2=e.1H;G By=F.6K;3v(v1.x==v2.x&&v1.y==v2.y){F.WP(v2,By/4)}G vx=v1.x-v2.x;G vy=v1.y-v2.y;G 5y=1w.i7(vx*vx+vy*vy);G a=F.WK(5y,By,v1,v2);G dx=(vx/5y)*a;G dy=(vy/5y)*a;v1.dx-=dx;v1.dy-=dy;v2.dx+=dx;v2.dy+=dy};8c.1s.13s=H(v){G 4R=1w.i7(v.dx*v.dx+v.dy*v.dy);if(4R==0){I}v.x+=1w.2H(4R,F.EU)*v.dx/4R;v.y+=1w.2H(4R,F.EU)*v.dy/4R;v.x=1w.2H(F.1l,1w.2n(v.1l/2,v.x));v.y=1w.2H(F.1o,1w.2n(v.1o/2,v.y))};H P0(2s){G 1Y=0;if(2s.2M.T==0){I 1Y}2s.2M.1U(H(v){G kc=v.1l*v.1o;if(kc>0){1Y+=1w.i7(kc)}});I 1Y/2s.2M.T}H 14W(2s,P0,V4,UX){G V5=P0*1w.120(1w.i7(2s.2M.T));G 1l=V5*1w.i7(V4);G 1o=V5/1w.i7(V4);I{1l:1l*UX,1o:1o*UX}}8c.hG=H(){if(!mg.ol){mg.ol=1a J.8Q(8c.1s)}1k{mg.ol.8M(1c)}I mg.ol};8c.1s.aL=H(){if(!mg.ol){mg.ol=1a J.8Q(8c.1s,1c,F)}1k{mg.ol.8M(F)}I mg.ol};8c.1s.gY=H(){I F.7i.ek};mg.ol=1c;8c.1s.O8=H(){I F.6K};8c.1s.Oa=H(N){F.6K=N};8c.1s.1oq=H(){I F.Ac};8c.1s.1or=H(N){F.Ac=N};8c.1s.FD=H(){I F.8D};8c.1s.FC=H(N){F.8D=N};8c.1s.Fn=H(){I F.cO};8c.1s.Fa=H(N){F.cO=N};8c.1s.LN=H(){I F.fZ};8c.1s.M8=H(N){F.fZ=N};J.2x(8c,"J.4j.8c")})(J.4j);(H(mg){G 1E=J.3X.1E;G 3o=J.3X.3o;G 9x=J.3X.9x;G aI=J.4j.aI;G bR=J.4j.bR;G 4l=mg.4l=H(){F.6K=20;F.Os=25;F.7v=mg.7o.nN;F.Ml=1;F.8D=mg.lK.Aw;F.cO=1x;F.fZ=mg.lN.6M};4l.1s.uX=1t;4l.1s.xN=1t;4l.1s.us=1t;4l.1s.cv=10;4l.1s.a4=H(2s){2s.wo();F.2s=2s;G E0=2s.14e();1h(G n=0;n<2s.2M.T;n++){G S=2s.2M[n];S.2v=-1;S.ov=0;S.oq=0;S.lS=0;S.lV=0;S.w0=0;S.vX=0;S.4f=0;S.9U=1x}1h(G l=0;l<2s.2Y.T;l++){G 1i=2s.2Y[l];1i.mv=0}G Dj=[];G 3G=[];G fw=1a 3o();2s.2M.1U(H(S){if(S.aP.T==0){Dj.1f(S);fw.2X(S,0);3G.1f(S)}});3v(3G.T>0){G 56=3G.kK();56.6a.1U(H(1i){G bG=1i.1H;if(!fw.2O(bG)){fw.2X(bG,fw.1V(56)+1)}1k{fw.2X(bG,1w.2n(fw.1V(bG),fw.1V(56)+1))}if(!1E.2O(3G,bG)){3G.1f(bG)}})}G Pq=0;fw.UI(H(14b){Pq=1w.2n(Pq,14b)});G DU=[];1E.h4(DU,fw.A0());DU.8F(H(o1,o2){G Vc=fw.1V(o1);G Uv=fw.1V(o2);if(Vc<Uv){I 1}if(Vc>Uv){I-1}I 0});1h(G n=0;n<DU.T;++n){G S=DU[n];G DW=5O.7T;if(S.6a.T==0){2V}1h(G l=0;l<S.6a.T;++l){G 1i=S.6a[l];DW=1w.2H(DW,fw.1V(1i.1H))}if(DW>1){fw.2X(S,DW-1)}}F.3P=[];1h(G i=0;i<Pq+1;i++){F.3P.1f([])}fw.1U(H(S,2v){S.2v=2v;F.3P[2v].1f(S)},F);1h(G l=0;l<F.3P.T;l++){G 2v=F.3P[l];1h(G i=0;i<2v.T;i++){2v[i].4f=i}}F.13G();F.18S();F.19V();F.3Z();F.13S();F.18p();E0.1U(H(e){if(e.1b){e.1b.gH()}})};4l.1s.DE=H(m,n,tY){G l=m.2v;G i=m.dj;F.xd[l][i]=tY};4l.1s.dK=H(m,n){G l=m.2v;G i1=m.dj;G i2=n.dj;G 2H=1w.2H(i1,i2);G 2n=1w.2n(i1,i2);G 8I=0;1h(G i=2H;i<2n;++i){8I+=F.xd[l][i]}I 8I};4l.1s.140=H(){G Un={N:1c};G 2W=F.UM(Un,1);F.Du=Un.N;I 2W};4l.1s.13I=H(){G Ut={N:1c};G 2W=F.UM(Ut,-1);F.Do=Ut.N;I 2W};4l.1s.UM=H(15f,d){G Bt=15f.N=1a 3o();G DN=0;1h(G l=0;l<F.3P.T;++l){DN=l;G 2v=F.3P[l];1h(G n=d==1?0:2v.T-1;0<=n&&n<2v.T;n+=d){G S=2v[n];if(!Bt.2O(S)){Bt.2X(S,DN);if(S.9U){F.U4(S).1U(H(15h){Bt.2X(15h,DN)})}}1k{DN=Bt.1V(S)}}}G Bv=[];1h(G i=0;i<F.3P.T;i++){Bv.1f(1c)}Bt.1U(H(S,Qd){if(Bv[Qd]===1c){Bv[Qd]=[]}Bv[Qd].1f(S)});I Bv};4l.1s.13M=H(Qb){G dn=1a 3o();1h(G c=0;c<F.3P.T;++c){G bC=Qb[c];if(bC==1c){2V}1h(G n=0;n<bC.T;n++){G S=bC[n];if(!dn.2O(S)){F.UT(S,dn,c)}}G d=5O.Q3;1h(G n=0;n<bC.T;n++){G S=bC[n];G fC=F.fC(S);if(fC!=1c&&F.Du.1V(fC)!=c){d=1w.2H(d,dn.1V(fC)-dn.1V(S)-F.dK(S,fC))}}if(d==5O.Q3){G D=[];1h(G n=0;n<bC.T;n++){G S=bC[n];G 8W=[];1E.h4(8W,F.lT.1V(S));1E.h4(8W,F.jJ.1V(S));1h(G e=0;e<8W.T;e++){G 7a=8W[e];if(F.Du.1V(7a)<c){D.1f(dn.1V(7a)-dn.1V(S))}}}D.8F();if(D.T==0){d=0}1k{if(D.T%2==1){d=D[h5(D.T,2)]}1k{d=(D[h5(D.T,2)-1]+D[h5(D.T,2)])/2}}}1h(G n=0;n<bC.T;n++){G S=bC[n];dn.2X(S,dn.1V(S)+d)}}I dn};4l.1s.13k=H(Q2){G dD=1a 3o();1h(G c=0;c<F.3P.T;++c){G bC=Q2[c];if(bC==1c){2V}1h(G n=0;n<bC.T;n++){G S=bC[n];if(!dD.2O(S)){F.TG(S,dD,c)}}G d=5O.P1;1h(G n=0;n<bC.T;n++){G S=bC[n];G fK=F.fK(S);if(fK!=1c&&F.Do.1V(fK)!=c){d=1w.2n(d,dD.1V(fK)-dD.1V(S)+F.dK(fK,S))}}if(d==5O.P1){G D=[];1h(G n=0;n<bC.T;n++){G S=bC[n];G 8W=[];1E.h4(8W,F.lT.1V(S));1E.h4(8W,F.jJ.1V(S));1h(G e=0;e<8W.T;e++){G 7a=8W[e];if(F.Do.1V(7a)<c){D.1f(dD.1V(S)-dD.1V(7a))}}}D.8F();if(D.T==0){d=0}1k{if(D.T%2==1){d=D[h5(D.T,2)]}1k{d=(D[h5(D.T,2)-1]+D[h5(D.T,2)])/2}}}1h(G n=0;n<bC.T;n++){G S=bC[n];dD.2X(S,dD.1V(S)+d)}}I dD};4l.1s.13S=H(){1h(G l=0;l<F.3P.T;++l){G 2v=F.3P[l];2v.8F(ND)}F.xd=[];1h(G l=0;l<F.3P.T;++l){G 2v=F.3P[l];F.xd[l]=[];1h(G n=0;n<2v.T;++n){G S=2v[n];S.dj=n;F.xd[l][n]=F.6K;if(n<2v.T-1){if(F.7v%2==0){F.xd[l][n]+=(S.1l+2v[n+1].1l)/2}1k{F.xd[l][n]+=(S.1o+2v[n+1].1o)/2}}}}F.jJ=1a 3o();F.lT=1a 3o();F.2s.2M.1U(H(S){F.jJ.2X(S,[]);F.lT.2X(S,[])},F);F.2s.2Y.1U(H(1i){G 1O=1i.1O;G bG=1i.1H;G b0=1c,up=1c;if(1O.2v>bG.2v){b0=1i.1O;up=1i.1H}1k{up=1i.1O;b0=1i.1H}F.jJ.1V(up).1f(b0);F.lT.1V(b0).1f(up)},F);F.jJ.UI(H(hD){hD.8F(ND)});F.lT.UI(H(hD){hD.8F(ND)});1h(G l=0;l<F.3P.T-1;++l){G 2v=F.3P[l];1h(G u=0;u<2v.T-1;u++){G UJ=2v[u];if(!UJ.9U){2V}G sW=F.jJ.1V(UJ)[0];if(!sW.9U){2V}1h(G n=u+1;n<2v.T;++n){G S=2v[n];if(!S.9U){2V}G sT=F.jJ.1V(S)[0];if(!sT.9U){2V}if(sW.4f>sT.4f){G 3I=sW.4f;sW.4f=sT.4f;sT.4f=3I;G i1=sW.dj;G i2=sT.dj;F.3P[l+1][i1]=sT;F.3P[l+1][i2]=sW;sW.dj=i2;sT.dj=i1}}}}G Qb=F.140();G Q2=F.13I();G dn=F.13M(Qb);G dD=F.13k(Q2);G x=1a 3o();F.2s.2M.1U(H(S){x.2X(S,(dn.1V(S)+dD.1V(S))/2)});G jO=1a 3o();G pu=1a 3o();1h(G l=0;l<F.3P.T;++l){G 2v=F.3P[l];G jU=-1,15c=-1;1h(G n=0;n<2v.T;++n){G S=2v[n];jO.2X(S,0);pu.2X(S,1x);if(S.9U){if(jU==-1){jU=n}1k{if(jU==n-1){jU=n}1k{15c=n;jO.2X(2v[jU],0);if(x.1V(S)-x.1V(2v[jU])==F.dK(2v[jU],S)){pu.2X(2v[jU],1t)}1k{pu.2X(2v[jU],1x)}jU=n}}}}}G 156=[1,-1];1E.1U(156,H(d){G 2I=d==1?0:F.3P.T-1;G 4D=d==1?F.3P.T-1:0;1h(G l=2I;0<=l&&l<F.3P.T;l+=d){G 2v=F.3P[l];G sY=168(2v);G 7C=1c;G 3d=1c;if(sY!=-1){7C=2v[sY];3d=[];1h(G i=0;i<sY;i++){3d.1f(2v[i])}}1k{7C=1c;3d=2v}if(3d.T>0){F.Aq(x,1c,7C,d,3d);1h(G i=0;i<3d.T-1;++i){F.DE(3d[i],3d[i+1],x.1V(3d[i+1])-x.1V(3d[i]))}if(7C!=1c){F.DE(3d[3d.T-1],7C,x.1V(7C)-x.1V(3d[3d.T-1]))}}3v(7C!=1c){G dk=16e(2v,7C);if(dk==1c){sY=7C.dj;3d=[];1h(G i=sY+1;i<2v.T;i++){3d.1f(2v[i])}if(3d.T>0){F.Aq(x,7C,1c,d,3d);1h(G i=0;i<3d.T-1;++i){F.DE(3d[i],3d[i+1],x.1V(3d[i+1])-x.1V(3d[i]))}F.DE(7C,3d[0],x.1V(3d[0])-x.1V(7C))}}1k{if(jO.1V(7C)==d){sY=7C.dj;G 14X=dk.dj;3d=[];1h(G i=sY+1;i<14X;i++){3d.1f(2v[i])}if(3d.T>0){F.Aq(x,7C,dk,d,3d)}pu.2X(7C,1t)}}7C=dk}F.14f(l,d,jO,pu)}},F);G ri=F.cv;1h(G i=(F.7v<2?0:F.3P.T-1);F.7v<2?i<F.3P.T:i>=0;i+=(F.7v<2?1:-1)){G 2v=F.3P[i];G 1o=5O.1kf;1h(G n=0;n<2v.T;++n){G S=2v[n];if(F.7v%2==0){1o=1w.2n(1o,S.1o)}1k{1o=1w.2n(1o,S.1l)}}1h(G n=0;n<2v.T;++n){G S=2v[n];G 4f=S.4f;if(F.7v%2==0){S.x=x.1V(S);S.y=ri+1o/2}1k{S.x=ri+1o/2;S.y=x.1V(S)}}ri+=F.Os+1o}};4l.1s.14f=H(l,d,jO,pu){if(l+d<0||l+d>=F.3P.T){I}G DT=1c,PA=1c;G 2v=F.3P[l+d];1h(G n=0;n<2v.T;++n){G DV=2v[n];if(DV.9U){G PO=F.149(DV,l);if(PO.9U){if(DT!=1c){G p=pu.1V(PA);G Uz=F.3P[l];G i1=PA.dj;G i2=PO.dj;1h(G i=i1+1;i<i2;++i){if(Uz[i].9U){p=p&&pu.1V(Uz[i])}}if(p){jO.2X(DT,d);G j1=DT.dj;G j2=DV.dj;1h(G j=j1+1;j<j2;++j){if(2v[j].9U){jO.2X(2v[j],d)}}}}DT=DV;PA=PO}}}};4l.1s.149=H(S,l){G 7a=F.lT.1V(S)[0];if(7a.2v==l){I 7a}7a=F.jJ.1V(S)[0];if(7a.2v==l){I 7a}I 1c};4l.1s.Aq=H(x,7C,dk,jA,3d){if(3d.T==1){F.14d(x,7C,dk,jA,3d[0])}if(3d.T>1){G r=3d.T,t=h5(r,2);F.Aq(x,7C,dk,jA,3d.9D(0,t));F.Aq(x,7C,dk,jA,3d.9D(t));F.146(x,7C,dk,jA,3d)}};4l.1s.14d=H(x,7C,dk,jA,S){G 8W=jA==-1?F.jJ.1V(S):F.lT.1V(S);G n=8W.T;if(n!=0){if(n%2==1){x.2X(S,x.1V(8W[h5(n,2)]))}1k{x.2X(S,(x.1V(8W[h5(n,2)-1])+x.1V(8W[h5(n,2)]))/2)}if(7C!=1c){x.2X(S,1w.2n(x.1V(S),x.1V(7C)+F.dK(7C,S)))}if(dk!=1c){x.2X(S,1w.2H(x.1V(S),x.1V(dk)-F.dK(S,dk)))}}};4l.1s.146=H(x,7C,dk,jA,3d){G r=3d.T,t=h5(r,2);G wl=[];1h(G i=0;i<t;++i){G c=0;G 8W=jA==-1?F.jJ.1V(3d[i]):F.lT.1V(3d[i]);1h(G n=0;n<8W.T;++n){G 7a=8W[n];if(x.1V(7a)>=x.1V(3d[i])){c++}1k{c--;wl.1f({k:x.1V(7a)+F.dK(3d[i],3d[t-1]),v:2})}}wl.1f({k:x.1V(3d[i])+F.dK(3d[i],3d[t-1]),v:c})}if(7C!=1c){wl.1f({k:x.1V(7C)+F.dK(7C,3d[t-1]),v:5O.7T})}wl.8F(15P);G wn=[];1h(G i=t;i<r;++i){G c=0;G 8W=jA==-1?F.jJ.1V(3d[i]):F.lT.1V(3d[i]);1h(G n=0;n<8W.T;++n){G 7a=8W[n];if(x.1V(7a)<=x.1V(3d[i])){c++}1k{c--;wn.1f({k:x.1V(7a)-F.dK(3d[i],3d[t]),v:2})}}wn.1f({k:x.1V(3d[i])-F.dK(3d[i],3d[t]),v:c})}if(dk!=1c){wn.1f({k:x.1V(dk)-F.dK(dk,3d[t]),v:5O.7T})}wn.8F(15M);G PE=0,PK=0;G m=F.dK(3d[t-1],3d[t]);3v(x.1V(3d[t])-x.1V(3d[t-1])<m){if(PE<PK){if(wl.T==0){x.2X(3d[t-1],x.1V(3d[t])-m);2i}1k{G 8w=wl.kK();PE=PE+8w.v;x.2X(3d[t-1],8w.k);x.2X(3d[t-1],1w.2n(x.1V(3d[t-1]),x.1V(3d[t])-m))}}1k{if(wn.T==0){x.2X(3d[t],x.1V(3d[t-1])+m);2i}1k{G 8w=wn.kK();PK=PK+8w.v;x.2X(3d[t],8w.k);x.2X(3d[t],1w.2H(x.1V(3d[t]),x.1V(3d[t-1])+m))}}}1h(G i=t-2;i>=0;i--){x.2X(3d[i],1w.2H(x.1V(3d[i]),x.1V(3d[t-1])-F.dK(3d[i],3d[t-1])))}1h(G i=t+1;i<r;i++){x.2X(3d[i],1w.2n(x.1V(3d[i]),x.1V(3d[t])+F.dK(3d[i],3d[t])))}};4l.1s.UT=H(S,dn,15u){G 3I=5O.P1;F.L(S).1U(H(v){G fK=F.fK(v);if(fK!=1c&&F.Du.1V(fK)==F.Du.1V(v)){if(!dn.2O(fK)){F.UT(fK,dn,15u)}3I=1w.2n(3I,dn.1V(fK)+F.dK(fK,v))}},F);if(3I==5O.P1){3I=0}F.L(S).1U(H(v){dn.2X(v,3I)})};4l.1s.TG=H(S,dD,15a){G 3I=5O.Q3;F.L(S).1U(H(v){G fC=F.fC(v);if(fC!=1c&&F.Do.1V(fC)==F.Do.1V(v)){if(!dD.2O(fC)){F.TG(fC,dD,15a)}3I=1w.2H(3I,dD.1V(fC)-F.dK(v,fC))}},F);if(3I==5O.Q3){3I=0}F.L(S).1U(H(v){dD.2X(v,3I)})};4l.1s.fK=H(S){G 2v=F.3P[S.2v];G i=S.dj;if(i==0){I 1c}I 2v[i-1]};4l.1s.fC=H(S){G 2v=F.3P[S.2v];G i=S.dj;if(i==2v.T-1){I 1c}I 2v[i+1]};4l.1s.L=H(S){if(S.9U){I F.U4(S)}G hD=1a 1E();hD.1f(S);I hD};4l.1s.3Z=H(){1h(G l=0;l<F.3P.T;l++){G 2v=F.3P[l];1h(G ni=0;ni<2v.T;ni++){G S=2v[ni];S.w0=S.lS;S.vX=S.lV}}G 13L=2;1h(G it=0;it<13L;it++){1h(G i=F.3P.T-1;i>=1;i--){F.Tv(1x,i)}1h(G i=0;i<F.3P.T-1;i++){F.Tv(1t,i)}}G EA=5O.7T;1h(G l=0;l<F.3P.T;l++){G 2v=F.3P[l];1h(G ni=0;ni<2v.T;ni++){G S=2v[ni];EA=1w.2H(EA,S.4f)}}if(EA<0){1h(G l=0;l<F.3P.T;l++){G 2v=F.3P[l];1h(G ni=0;ni<2v.T;ni++){G S=2v[ni];S.4f=S.4f-EA}}}};4l.1s.Tv=H(b0,2v){G iO;G ad;if(b0){ad=F.3P[iO=2v+1]}1k{ad=F.3P[iO=2v-1]}G p4=[];1h(G n=0;n<ad.T;n++){p4.1f(ad[n])}p4.8F(H(n1,n2){G Ud=(n1.w0+n1.vX)/2;G Ue=(n2.w0+n2.vX)/2;if(1w.4L(Ud-Ue)<0.Bf){I 0}if(Ud<Ue){I 1}I-1});1E.1U(p4,H(S){G tU=S.4f;G B3=O3(S);G Ub=(S.w0+S.vX)/2;if(1w.4L(tU-B3)<0.Bf){I}if(1w.4L(tU-B3)<0.25+0.Bf){I}if(tU<B3){3v(tU<B3){if(!F.Uf(S,ad,Ub)){2i}tU=S.4f}}1k{3v(tU>B3){if(!F.TU(S,ad,Ub)){2i}tU=S.4f}}},F);if(iO>0){F.Oz(iO-1)}if(iO<F.3P.T-1){F.Ov(iO+1)}};4l.1s.Uf=H(S,2v,tM){G 1y=1E.7g(2v,S);if(1y==2v.T-1){S.4f=S.4f+0.5;I 1t}G F0=2v[1y+1];G Ua=(F0.w0+F0.vX)/2;if(F0.4f>S.4f+1){S.4f=S.4f+0.5;I 1t}if(Ua>tM||1w.4L(Ua-tM)<0.Bf){I 1x}if(F.Uf(F0,2v,tM)){S.4f=S.4f+0.5;I 1t}I 1x};4l.1s.TU=H(S,2v,tM){G 1y=1E.7g(2v,S);if(1y==0){S.4f=S.4f-0.5;I 1t}G ET=2v[1y-1];G TX=(ET.w0+ET.vX)/2;if(ET.4f<S.4f-1){S.4f=S.4f-0.5;I 1t}if(TX>tM||1w.4L(TX-tM)<0.Bf){I 1x}if(F.TU(ET,2v,tM)){S.4f=S.4f-0.5;I 1t}I 1x};4l.1s.U2=H(S,1i){F.U6.2X(S,1i);if(!F.Ee.2O(1i)){F.Ee.2X(1i,1a 1E())}F.Ee.1V(1i).1f(S)};4l.1s.U4=H(S){I F.Ee.1V(F.U6.1V(S))};4l.1s.13G=H(){F.Ee=1a 3o();F.U6=1a 3o();G 1X=F.2s.2Y.9D(0);1h(G l=0;l<1X.T;l++){G 1i=1X[l];G o=1i.1O;G d=1i.1H;G ku=o.2v;G eR=d.2v;G tE=o.4f;G B0=d.4f;G fY=(B0-tE)/1w.4L(eR-ku);G p=o;if(ku-eR>1){1h(G i=ku-1;i>eR;i--){G 5o=1a bR();5o.x=o.x;5o.y=o.y;5o.1l=o.1l/100;5o.1o=o.1o/100;G 2v=F.3P[i];G 3I=(i-eR)*fY+tE;if(3I>2v.T){3I=2v.T}if(tE>=F.3P[ku].T-1&&B0>=F.3P[eR].T-1){3I=2v.T}1k{if(tE==0&&B0==0){3I=0}}5o.2v=i;5o.ov=0;5o.oq=0;5o.lS=0;5o.lV=0;5o.4f=3I;5o.9U=1t;1E.nX(2v,3I,5o);1h(G r=3I+1;r<2v.T;r++){G S=2v[r];S.4f=S.4f+1}G Ah=1a aI(p,5o);Ah.mv=0;p=5o;F.2s.2M.1f(5o);F.2s.MF(Ah);5o.1y=F.2s.2M.T-1;F.U2(5o,1i)}1i.Ew(p);1i.mv=ku-eR-1}if(ku-eR<-1){1h(G i=ku+1;i<eR;i++){G 5o=1a bR();5o.x=o.x;5o.y=o.y;5o.1l=o.1l/100;5o.1o=o.1o/100;G 2v=F.3P[i];G 3I=(i-ku)*fY+tE;if(3I>2v.T){3I=2v.T}if(tE>=F.3P[ku].T-1&&B0>=F.3P[eR].T-1){3I=2v.T}1k{if(tE==0&&B0==0){3I=0}}5o.2v=i;5o.ov=0;5o.oq=0;5o.lS=0;5o.lV=0;5o.4f=3I;5o.9U=1t;3I=3I&3I;1E.nX(2v,3I,5o);1h(G r=3I+1;r<2v.T;r++){G S=2v[r];S.4f=S.4f+1}G Ah=1a aI(p,5o);Ah.mv=0;p=5o;F.2s.2M.1f(5o);F.2s.MF(Ah);5o.1y=F.2s.2M.T-1;F.U2(5o,1i)}1i.Ew(p);1i.mv=eR-ku-1}}};4l.1s.18p=H(){G Nd=1t;3v(Nd){Nd=1x;1h(G l=0;l<F.2s.2Y.T;l++){G 1i=F.2s.2Y[l];if(1i.mv==0){2V}G 1b=[];1E.nX(1b,0,{x:1i.1H.x,y:1i.1H.y});1E.nX(1b,0,{x:1i.1O.x,y:1i.1O.y});G 5f=1i;G mv=1i.mv;1h(G d=0;d<mv;d++){G S=5f.1O;G MH=S.aP[0];1E.nX(1b,0,{x:MH.1O.x,y:MH.1O.y});5f=MH}1i.Ew(5f.1O);1i.mv=0;1i.1b=1b;Nd=1t;2i}}};4l.1s.18S=H(){G o3=-1;G Oq=3;G pW=0;3v(o3!=0){if(pW++>Oq){2i}o3=0;1h(G i=F.3P.T-1;i>=1;i--){o3+=F.Wz(1x,i)}1h(G i=0;i<F.3P.T-1;i++){o3+=F.Wz(1t,i)}}};4l.1s.Ov=H(2v){if(2v==0){I}G ad=F.3P[2v];G Ne=1a 9x();G 5f=F.3P[2v-1];1h(G i=0;i<5f.T;i++){Ne.4K(5f[i])}1h(G i=0;i<ad.T;i++){G S=ad[i];G r3=0;G 6A=0;1h(G l=0;l<S.aP.T;l++){G 1i=S.aP[l];if(Ne.2O(1i.1O)){6A++;r3+=1i.1O.4f}}1h(G l=0;l<S.6a.T;l++){G 1i=S.6a[l];if(Ne.2O(1i.1H)){6A++;r3+=1i.1H.4f}}if(6A>0){S.ov=r3/6A;S.lS=6A}1k{S.ov=i;S.lS=0}}};4l.1s.Oz=H(2v){if(2v==F.3P.T-1){I}G ad=F.3P[2v];G Nc=1a 9x();G 5f=F.3P[2v+1];1h(G i=0;i<5f.T;i++){Nc.4K(5f[i])}1h(G i=0;i<ad.T;i++){G S=ad[i];G r3=0;G 6A=0;1h(G l=0;l<S.aP.T;l++){G 1i=S.aP[l];if(Nc.2O(1i.1O)){6A++;r3+=1i.1O.4f}}1h(G l=0;l<S.6a.T;l++){G 1i=S.6a[l];if(Nc.2O(1i.1H)){6A++;r3+=1i.1H.4f}}if(6A>0){S.oq=r3/6A;S.lV=6A}1k{S.oq=i;S.lV=0}}};4l.1s.Wz=H(b0,2v){G iO;G ad;if(b0){ad=F.3P[iO=2v+1]}1k{ad=F.3P[iO=2v-1]}G 19v=ad.9D(0);if(b0){F.Ov(iO)}1k{F.Oz(iO)}ad.8F(H(n1,n2){G X7=O3(n1);G Xk=O3(n2);if(1w.4L(X7-Xk)<0.Bf){if(n1.C1()==n2.C1()){I QN(n1,n2)}1k{if(n1.C1()<n2.C1()){I 1}}I-1}G WW=(Xk-X7)*zy;if(WW>0){I-1}1k{if(WW<0){I 1}}I QN(n1,n2)});G o3=0;1h(G i=0;i<ad.T;i++){if(ad[i]!=19v[i]){o3++}}if(o3>0){G 19O=0;1h(G i=0;i<ad.T;i++){G S=ad[i];S.4f=19O++}}I o3};4l.1s.19V=H(){G Oq=F.Ml;G pW=0;3v(1t){if(pW++>Oq){2i}G AV=(pW%4<=1);G 19H=(pW%4==1);1h(G l=(AV?0:F.3P.T-1);AV?l<=F.3P.T-1:l>=0;l+=(AV?1:-1)){G 2v=F.3P[l];G Vo=1x;G Ou=1t;G Vq=0;1h(G n=0;n<2v.T-1;n++){G up=0;G b0=0;G wy=0;if(Ou){if(l!=0){up=F.Cq(l-1,l)}if(l!=F.3P.T-1){b0=F.Cq(l,l+1)}if(AV){up*=2}1k{b0*=2}wy=up+b0}1k{wy=Vq}if(wy==0){2V}G 7X=2v[n];G 7W=2v[n+1];G Oy=7X.4f;G OP=7W.4f;2v[n]=7W;2v[n+1]=7X;7X.4f=OP;7W.4f=Oy;up=0;if(l!=0){up=F.Cq(l-1,l)}b0=0;if(l!=F.3P.T-1){b0=F.Cq(l,l+1)}if(AV){up*=2}1k{b0*=2}G VO=up+b0;G OL=1x;if(19H){OL=VO>=wy}1k{OL=VO>wy}if(OL){7X=2v[n];7W=2v[n+1];Oy=7X.4f;OP=7W.4f;2v[n]=7W;2v[n+1]=7X;7X.4f=OP;7W.4f=Oy;Vq=wy;Ou=1x}1k{Vo=1t;Ou=1t}}if(Vo){if(l!=F.3P.T-1){F.Ov(l+1)}if(l!=0){F.Oz(l-1)}}}}};4l.1s.Cq=H(18U,19n){G rA=0;G CB=1a 9x();G Vw=F.3P[18U];1h(G i=0;i<Vw.T;i++){CB.4K(Vw[i])}G eR=1a 9x();G Wf=F.3P[19n];1h(G i=0;i<Wf.T;i++){eR.4K(Wf[i])}G Nv=1a 9x();G 1X=[];G 5f=[];CB.1U(H(S){1E.h4(5f,S.aP);1E.h4(5f,S.6a)});1h(G ti=0;ti<5f.T;ti++){G 1i=5f[ti];if(CB.2O(1i.1O)&&eR.2O(1i.1H)){Nv.4K(1i);1X.1f(1i)}1k{if(eR.2O(1i.1O)&&CB.2O(1i.1H)){1X.1f(1i)}}}1h(G l1=0;l1<1X.T;l1++){G Bo=1X[l1];1h(G l2=0;l2<1X.T;l2++){if(l1==l2){2V}G Bs=1X[l2];G NJ,NN;G O0,O4;if(Nv.2O(Bo)){NJ=Bo.1O;NN=Bo.1H}1k{NJ=Bo.1H;NN=Bo.1O}if(Nv.2O(Bs)){O0=Bs.1O;O4=Bs.1H}1k{O0=Bs.1H;O4=Bs.1O}G 16D=NJ.4f;G 16B=NN.4f;G 16A=O0.4f;G 15T=O4.4f;if((16D-16A)*(16B-15T)<0){rA++}}}I rA/2};H O3(S){G lS=S.lS;G lV=S.lV;G ov=S.ov;G oq=S.oq;if(lS>0&&lV>0){I(ov+oq)/2}if(lS>0){I ov}if(lV>0){I oq}I 0}H ND(x,y){if(x.4f<y.4f){I-1}if(x.4f>y.4f){I 1}I 0}H 15M(x,y){if(x.k<y.k){I-1}if(x.k>y.k){I 1}I 0}H 15P(x,y){if(x.k<y.k){I 1}if(x.k>y.k){I-1}I 0}H 168(2v){1h(G c=0;c<2v.T;c++){if(2v[c].9U){I c}}I-1}H QN(o1,o2){G i1=o1.1y;G i2=o2.1y;if(i1<i2){I 1}if(i1>i2){I-1}I 0}H h5(As,BT){I(As-As%BT)/BT}H 16e(2v,S){G 16d=S.dj;1h(G i=16d+1;i<2v.T;++i){if(2v[i].9U){I 2v[i]}}I 1c}4l.hG=H(){if(!mg.oL){mg.oL=1a J.8Q(4l.1s)}1k{mg.oL.8M(1c)}I mg.oL};4l.1s.aL=H(){if(!mg.oL){mg.oL=1a J.8Q(4l.1s,1c,F)}1k{mg.oL.8M(F)}I mg.oL};4l.1s.gY=H(){I F.7i.ek};mg.oL=1c;4l.1s.O8=H(){I F.6K};4l.1s.Oa=H(N){F.6K=N};4l.1s.1lO=H(){I F.Os};4l.1s.1lP=H(N){F.Os=N};4l.1s.SO=H(){I F.7v};4l.1s.SP=H(N){F.7v=N};4l.1s.1lL=H(){I F.Ml};4l.1s.1lM=H(N){F.Ml=N};4l.1s.FD=H(){I F.8D};4l.1s.FC=H(N){F.8D=N};4l.1s.Fn=H(){I F.cO};4l.1s.Fa=H(N){F.cO=N};4l.1s.LN=H(){I F.fZ};4l.1s.M8=H(N){F.fZ=N};J.2x(4l,"J.4j.4l")})(J.4j);J.1e.aw=H(x,y,jh,jg,1A,4N,1Y){F.x=(x)?x:0;F.y=(y)?y:0;F.jh=(jh!=1F)?jh:1t;F.jg=(jg!=1F)?jg:1t;F.t1=(1A!==1F)?1A:J.1e.9R.Bw;F.4N=(4N)?4N:"#7f";F.4B=-1;F.5r=1c;F.1Y=(1Y)?1Y:3};J.1e.aw.1s={3q:H(){I{x:F.x,y:F.y,jh:F.jh,jg:F.jg,t1:F.t1,4N:F.4N,2r:F.4B,5r:F.5r,1Y:F.1Y}},3D:H(1q){F.17s(1q.x);F.17x(1q.y);F.17v(1q.jh);F.17w(1q.jg);F.16Y(1q.t1);F.17c(1q.4N);F.17y(1q.2r);F.kx(1q.5r);F.17b(1q.1Y)},5u:H(1v,O){O.4o(F.jh,"1gW",1v);O.4o(F.jg,"1gV",1v);O.hn(F.4N,"nq",1v);O.4r(F.4B,"zA",1v);O.4r(F.t1,"9R",1v);O.Dm(F,F.5r,"BQ",1v);O.c9(F.vM,"1lS",1v);O.5w(F.x,"X",1v);O.5w(F.y,"Y",1v)},1lT:H(aF){I 1a 1L(aF.x+aF.1l*F.x/100,aF.y+aF.1o*F.y/100)},16v:H(){I F.x},17s:H(N){F.x=N},16u:H(){I F.y},17x:H(N){F.y=N},9z:H(){I F.4B},17y:H(N){F.4B=N},15K:H(){I F.jh},17v:H(N){F.jh=N},15J:H(){I F.jg},17w:H(N){F.jg=N},16p:H(){I F.t1},16Y:H(N){F.t1=N},16q:H(){I F.4N},17c:H(N){F.4N=N},oY:H(){I F.5r},kx:H(N){F.5r=N},1kJ:H(){I F.vM},1kK:H(N){if(F.vM!=N){if(N==1c){F.vM=""}1k{F.vM=N}}},m8:H(){I F.1Y},17b:H(N){F.1Y=N},1kF:H(O,aF,4J,1kG,17e){G cX=aF.x+aF.1l*F.x/100;G cY=aF.y+aF.1o*F.y/100;G d=17e/2}};J.2x(J.1e.aw,"J.1e.aw");(H(K){G 2h=J.1B.2h;G 1I=J.1B.1I;G ie=K.ie=H(S){1n.2T(ie,F);F.S=S};ie.1s={dS:H(){},aY:H(2p){},mD:H(2p){},xr:H(2p){I 1x},bw:H(2p){},9Y:H(2p){},b4:H(2p){},9g:H(){},iH:H(2p){}};J.2x(ie,"J.1e.ie",J.1B.l0)})(J.1e);J.1e.vl={lL:0,Ep:1};J.1e.1kH={16H:0,1kL:1,1kP:2,1kQ:3,1kR:4,1kM:5,1kN:6,1kO:7,1kv:8,iN:9,136:10,f2:11};J.1e.hW=J.1B.hW;J.1e.4w={bi:0,7z:1,gE:2};J.1e.vK={7H:0,VZ:1,Xm:2};J.1e.6o={7H:0,JD:1,15X:2,15R:4,16C:8,Sx:16,ST:32,SS:64,SR:128,lD:1gR,iN:1kw,17O:1kx};J.1e.97={jw:0,14P:1,14I:2,V9:3,14Q:4,14R:5,14G:8,vk:9,14F:10,14N:11,pd:12,14u:15,14w:16,14A:17,14z:23,154:24,14y:25,14v:26};J.1e.9Q={7H:0,gF:1,jw:2,1ks:3};J.1e.GJ={Rr:0,Ef:1};J.1e.JB={7H:0,14L:1,YQ:2};J.1e.9R={7H:0,Bw:1,X:2,hx:3,az:4};J.1e.tK={19a:0,1kt:1,lL:2,19c:4};J.1e.Ke={t6:0,1ku:1,1ky:2};J.1e.iR={QR:0,Av:1};J.1e.6j={bV:0,xe:1,bZ:2,1kC:3};J.1e.n5={11d:0,12S:1,Kq:2};J.1e.oc={1br:0,1bq:1,12M:2};J.1e.9M={Bk:0,Br:1,1kD:2};J.1e.r9={Wt:0,1gD:1,1gJ:2,1gH:3};J.1e.5K={1ht:0,FW:1,1hq:2,1hx:3,IQ:4,1hz:5,QF:6,G4:7,B8:8,1hp:9,vk:10,QM:11,QK:12,QI:13};J.1e.kF={mi:0,QS:1,1kE:2};J.1e.11G={16k:0,16V:1};J.1e.pf={7H:0,16E:1,13J:2};J.1e.qU={7H:0,pd:1,tT:2,1cp:3,DR:4};J.1e.jn={7H:0,pd:1,16J:2,tT:4,Yo:8,DR:16};J.1e.jC={7z:0,iN:1,12r:2,1hR:3,1hm:4,1iu:5};J.1e.Di={7H:0,16F:1,1kz:2};J.1e.jZ={az:0,wG:1};J.1e.5U={lL:0,6M:1,hg:2};J.1e.Iw={16t:0,VV:1};J.1e.iE={yP:0,yv:1,1bN:2,};(H(K){G 1E=J.3X.1E;G 5T=J.1B.5T;G sE=J.1B.sE;G 7G=J.1B.7G;G ao=K.ao=H(1j){1n.2T(ao,F);F.1j=1j;F.1d=1a J.1B.1I(0,0,20,20);F.1P=1a J.1B.8n("",F.1d);if(ao.FE===1x){F.1N={2R:"ik",4N:"#sb"};F.2y="#7f";F.3p=0}F.aO=1x;F.dN=1x;F.bN="";F.ey="";F.i6=1a 7G(1,1,1,1);F.Jq=1t;F.6e=1a J.1B.l0(0,0)};ao.1s={gY:H(){I F.7i.ek},1T:H(){G 1K=1a F.7i(F.1j);1K.1d=F.1d.1T();1K.3e=F.3e;1K.nm=F.nm;1K.nn=F.nn;1K.Pe(7G.1K(F.i6));1K.2m=(F.2m)?5T.1K(F.2m):1F;1K.1N=F.1N;1K.2y=F.2y;1K.3p=F.3p;1K.4V=F.4V;1K.dN=F.dN;1K.ot=F.ot;1K.ME=F.ME;1K.fV=F.fV;1K.bN=F.bN;1K.ey=F.ey;1K.6L=F.6L;1K.9E=F.9E;1K.9A=F.9A;1K.1A=(F.1A)?F.1A.1T():1F;1K.b7(F.ec());1K.bq(F.ft());1K.AA(F.sJ());1K.kx(F.oY());1K.10L(F.NP());1K.jp(F.jj());1K.1S(1x);I 1K},3q:H(){G 1q={GA:F.gY(),8S:F.8S,gw:F.sJ(),ot:F.ot,1P:F.8V(),3e:F.3e,nm:F.nm,nn:F.nn,i6:F.i6,2m:F.2m,dN:F.dN,1N:F.1N,2y:F.2y,3p:F.3p,4V:F.4V,aO:F.aO,qk:F.jj(),fV:F.we(),bN:F.bN,ey:F.ey,6L:F.6L,9E:F.nh(),9A:F.nb(),4q:F.ec(),4i:F.ft(),1A:F.1A?F.1A.3q():1c};if(5P F.id!=="1F"){1q.id=F.id}if(5P F.5r!=="1F"){1q.5r=F.5r}I 1q},3D:H(1q){F.AA(1q.gw);F.kx(1q.5r);F.10L(1q.id);F.aJ(1q.1P);F.7A(1q.1N);F.9e(1q.2y);F.3p=1q.3p;F.4V=1q.4V;F.ot=1q.ot;F.3e=1q.3e;F.nm=1q.nm;F.nn=1q.nn;if(1q.i6){F.Pe(7G.1K(1q.i6))}if(1q.qk!==1F){F.jp(1q.qk)}if(1q.dN){F.dN=1t}if(1q.2m){F.2m=5T.1K(1q.2m)}if(1q.1A){F.1A=1a K.2E(1x);F.1A.3D(1q.1A)}if(1q.fV!==1F){F.fV=1q.fV}F.bN=1q.bN;F.ey=1q.ey;F.6L=1q.6L;F.9E=1q.9E;F.9A=1q.9A;if(1q.4q!==1F){F.b7(1q.4q)}if(1q.4i!==1F){F.bq(1q.4i)}},5g:H(1v,O){F.AA(O.3Q("16R",1v));F.ey=O.a7("16Q",1v);F.fV=O.4v("16T",1v);F.jp(O.4v("E3",1v,1t));F.1N=O.9r("ga",1v);F.1A=O.Tp("2E",1v);G ne=O.nF("1kA",1v);if(ne){F.2y=ne.1N;F.3p=ne.1l;F.4V=ne.6X}1k{F.2y=O.9r("MY",1v);F.3p=O.5k("N3",1v);F.4V=J.1B.jD[O.a7("Fi",1v)];if(F.4V===1F){F.4V=O.3Q("Fi",1v)}}F.2m=O.rZ("5T",1v);if(!F.2m){G AX=O.a7("Ni",1v);G 4U=O.5k("N1",1v);if(AX!=""&&4U>0){F.2m=1a 5T(AX,4U)}}F.aJ(O.a7("8n",1v));F.3e=O.9r("tR",1v);F.Pe(O.EB("16N",1v));F.dN=O.4v("16M",1v);F.bN=O.a7("JC",1v);F.6L=O.9r("N7",1v,F.6L);F.9E=O.5k("Ja",1v,O.1m.nh());F.9A=O.5k("Jd",1v,O.1m.nb());F.5r=O.Dv(F,"BQ",1v);F.id=O.Dv(F,"Id",1v)},5u:H(1v,O){O.4r(F.sJ(),"16R",1v);O.c9(F.ey,"16Q",1v);O.4o(F.we(),"16T",1v);O.4o(F.jj(),"E3",1v);if(F.1N){O.9k(F.1N,"ga",1v)}if(F.7i.sh){O.To(F.1A,"2E",1v,F.7i.sh.5R+"2E")}if(F.2y){O.9k(F.2y,"MY",1v)}if(F.3p!==1F){O.5w(F.3p,"N3",1v)}if(F.4V!==1F){O.4r(F.4V,"Fi",1v)}if(F.2m){O.qW(F.2m,"5T",1v)}O.c9(F.8V(),"8n",1v);O.9k(F.3e,"tR",1v);O.ER(F.16O(),"16N",1v);O.4o(F.dN,"16M",1v);if(F.bN){O.c9(F.bN,"JC",1v)}O.9k(F.6L,"N7",1v);if(F.9E!==1F){O.5w(F.9E,"Ja",1v)}if(F.9A!==1F){O.5w(F.9A,"Jd",1v)}O.Dm(F,F.5r,"BQ",1v);O.Dm(F,F.id,"Id",1v)},ig:H(1R){},4Y:H(){I F.1j},oU:H(N){F.1j=N},6I:H(){if(F.1j&&F.1j.4z){F.1j.4z(1t)}},aJ:H(N){if(N!=1F&&N!==F.1P.1P){F.1P.1P=N+"";F.1S()}},8V:H(){I F.1P.1P},iW:H(N){if(F.3e!==N){F.3e=N;F.1S()}},lo:H(){I F.3e},1la:H(N){if(F.nm!==N){F.nm=N;F.1S()}},1lb:H(){I F.nm},1l6:H(N){if(F.nn!==N){F.nn=N;F.1S()}},1l7:H(){I F.nn},Pe:H(N){if(F.i6!==N){F.i6=N;F.1P.6g=N;F.1S()}},16O:H(){I F.i6},Et:H(N){if(F.2m!==N){F.2m=N;F.1S()}},MB:H(){I F.2m},7A:H(N){if(F.1N!==N){F.1N=N;F.1S()}},bs:H(){I F.1N},9e:H(N){if(F.2y!==N){F.2y=N;F.1S()}},1l8:H(){I F.2y},WE:H(N){if(F.2y!==N){F.2y=N;F.1S()}},uE:H(){I F.2y},WD:H(N){if(F.3p!==N){F.3p=N;F.1S()}},uM:H(){I F.3p},1bD:H(N){if(F.4V!==N){F.4V=N;F.1S()}},T0:H(){I F.4V},kx:H(N){if(F.5r!==N){F.5r=N;F.6I()}},oY:H(){I F.5r},1lc:H(N){if(F.5B!==N){F.5B=N;F.6I()}},rK:H(){if(F.5B===1F){I 1}I F.5B},10L:H(N){if(F.id!==N){F.id=N;F.6I()}},NP:H(){I F.id},1lg:H(N){if(F.bN!==N){F.bN=N;F.6I()}},1lh:H(){I F.bN},1li:H(N){if(F.dN!==N){F.dN=N;F.6I()}},1ld:H(){I F.dN},vg:H(){if(!F.ot){F.ot={}}I F.ot},xh:H(){I F.dN||!F.jj()},AA:H(N){if(F.6e.gw!==N){F.6e.gw=N;if(F.1j&&F.1j.G8){F.1j.G8()}F.6I()}},sJ:H(){I F.6e.gw},Ze:H(){if(F.1j){I 1E.7g(F.1j.1R,F)}I 1c},OX:H(N){if(F.aO!=N){F.aO=N;F.1S()}},CG:H(N){if(F.1j&&F.aO!=N){if(N){F.1j.3h.9u(F)}1k{F.1j.3h.ml(F)}F.6I()}},kq:H(){I F.aO},1kW:H(N){if(F.ey!==N){F.ey=N||"";F.6I()}},1kX:H(){I F.ey||""},1jd:H(){I F.2K},cA:H(2A){},eW:H(2A){},ja:H(2A){},lJ:H(2A){I 1t},lY:H(){I 1c},tk:H(2A){},DQ:H(){if(F.1j){if(F.2K){F.2K.54(F,1t)}F.1j.17u(F);F.1j=1c}},3S:H(1p){I 1x},aY:H(1p,yD,w7,ve){if(F.1j!=1c&&!F.1j.wb(F)){I 1c}if(ve&&F.1j!=1c&&!F.1j.Ji(F)){I 1c}G 2O=yD>0?F.3S(1p,yD):F.3S(1p);I 2O?F:1c},gU:H(){I!F.jj()||F.fV},yr:H(){F.6e.1g=F;F.1j.z1(F.6e);F.1S(1x)},yR:H(){if(F.1j){F.1j.H5(F.6e)}},uD:H(){},kr:H(){},1S:H(nA){F.6e.pG=F;if(F.1j){F.1j.1S();if(nA===1F){nA=1t}if(nA&&F.1j.4z){F.1j.4z(1t)}}},jp:H(N){if(F.6e.Q8==!N){I}if(N){5M F.6e.Q8;if(F.XP){F.XP()}}1k{F.6e.Q8=1t;if(F.aO){F.CG(1x)}if(F.XO){F.XO()}}if(F.1j){F.1j.1S()}},jj:H(){I F.6e.Q8?1x:1t},1kT:H(N){if(F.fV!==N){F.fV=N;F.6I()}},we:H(){I F.fV?1t:1x},fA:H(){if(F.1j){G 2A=F.1j.7w;if(2A&&2A.4m){if(2A.4m.cB==F){I 1t}if(2A.4m.cB==F.1j.3h&&F.aO){I 1t}}}I F.Jq},Rb:H(N){F.Jq=N},mI:H(2p){I 1c},xB:H(1p){I F},vt:H(){I F},t4:H(){I F.1P.1P},yn:H(5W){F.aJ(5W)},WI:H(N){if(F.6L!==N){F.6L=N;F.1S()}},T8:H(){I F.6L},1i0:H(N){if(F.9E!==N){F.9E=N;F.1S()}},nh:H(){if(F.9E===1F){if(F.1j.nh){I F.1j.nh()}I 4}I F.9E},1hZ:H(N){if(F.9A!==N){F.9A=N;F.1S()}},nb:H(){if(F.9A===1F){if(F.1j.nb){I F.1j.nb()}I 4}I F.9A},n7:H(){G 6L=F.17F();I 6L?1a J.1B.xX(6L,F.nh(),F.nb()):1F},wk:H(N){if(F.1A!==N){F.1A=N;F.1S()}},l5:H(){I F.1A},b7:H(N){if(F.1P.4q!=N){F.1P.4q=N;F.1S()}},ec:H(){I F.1P.4q},bq:H(N){if(F.1P.4i!=N){F.1P.4i=N;F.1S()}},ft:H(){I F.1P.4i},1kU:H(){I F.6e.2w},e8:H(4g){if(F.1A&&4g.5j(F.1A)){I F.1A}if(F.1j){G sm=F.1j.1A;if(sm&&4g.5j(sm)){I sm}G 4H=F.1j.4H;if(4H){G qm=F.cD(4g,4H);if(qm){I qm}}}I F.cD(4g,K.f8.f2)},cD:H(4g,4H){G MO=4H.5I["4O:ao"];if(MO){if(4g.5j(MO)){I MO}}G eh=4H.5I["4O:4n"];if(eh){if(4g.5j(eh)){I eh}}I 1c},rd:H(){if(F.1N){I F.1N}G 1A=F.e8(K.2E.1s.N8);if(1A){I 1A.bs()}I"gp"},hk:H(){if(F.2y){I F.2y}G 1A=F.e8(K.2E.1s.T2);if(1A){I 1A.uE()}I"gp"},fi:H(){if(F.3p!==1F){I F.3p}G 1A=F.e8(K.2E.1s.T5);if(1A){I 1A.uM()}I 0},iA:H(){if(F.4V!==1F){I F.4V}G 1A=F.e8(K.2E.1s.SY);if(1A){I 1A.T0()}I 0},gu:H(){if(F.3e){I F.3e}G 1A=F.e8(K.2E.1s.Th);if(1A){I 1A.lo()}I"dM"},qN:H(){I F.nm},u8:H(){I F.nn||0},hH:H(){if(F.2m){I F.2m}G cu=F.17D();G ql=(cu&sE.Vk)!=0;G qh=(cu&sE.Vf)!=0;G BI=(cu&sE.Va)!=0;I 1a 5T(F.B1(),F.uI(),ql,qh,BI)},B1:H(){G 1A=F.e8(K.2E.1s.Tg);if(1A){I 1A.wK()}I"GE-Gy"},uI:H(){G 1A=F.e8(K.2E.1s.Tk);if(1A){I 1A.wM()}I 4},17D:H(){G 1A=F.e8(K.2E.1s.Ti);if(1A){I 1A.1bG()}I sE.1l4},17F:H(){if(F.6L){I F.6L}G 1A=F.e8(K.2E.1s.Td);if(1A){I 1A.T8()}I"MG"},pz:H(){if(F.ME){I F.ME}if(F.1j){I F.1j.14S()}I 2},1l0:H(){I F.1P},dQ:H(){G 1G={};1G.gw=F.sJ();1G.5r=F.5r;1G.1P=F.8V();1G.3e=F.3e;1G.2m=F.2m;1G.dN=F.dN;1G.1N=F.1N;1G.2y=F.2y;1G.3p=F.3p;1G.aO=F.aO;1G.qk=F.jj();1G.fV=F.we();1G.bN=F.bN;1G.ey=F.ey;1G.6L=F.6L;1G.9E=F.nh();1G.9A=F.nb();1G.1A=F.1A;1G.4q=F.ec();1G.4i=F.ft();I 1G},ee:H(1G){F.AA(1G.gw);F.kx(1G.5r);F.aJ(1G.1P);F.7A(1G.1N);F.9e(1G.2y);F.3p=1G.3p;F.3e=1G.3e;F.jp(1G.qk);F.dN=1G.dN;F.2m=1G.2m;F.1A=1G.1A;F.fV=1G.fV;F.bN=1G.bN;F.ey=1G.ey;F.6L=1G.6L;F.9E=1G.9E;F.9A=1G.9A;if(1G.4q){F.b7(1G.4q)}if(1G.4i){F.bq(1G.4i)}}};ao.FE=1t;J.2x(ao,"J.1e.ao")})(J.1e);(H(K){G 2h=J.1B.2h;G 1L=J.1B.1L;G 1I=J.1B.1I;G 1E=J.3X.1E;G 3m=K.3m=H(1j){1n.2T(3m,F,[1j]);F.3b=0;F.9c=K.6o.17O&~K.6o.iN;F.6h=K.5K.FW;F.eo=[];F.eu=[];F.bD=1t;F.bY=1t;F.aX=1t;F.5i=1c;F.kI=1a 1E();F.yZ=1x;F.iP=1x;F.an=1t;F.oE=1x;F.3M=[];F.b7(K.4w.7z);F.bq(K.4w.7z);if(1j&&1j.Bm){F.ze(1t)}};3m.vL=H(7X,7W){if(!7X.Ju()||!7W.Ju()){I 1x}G 1r=7X.1d.WR(7W.1d);if(1r.1o>0&&1r.1l>0){I 1t}I 1x};3m.1s={1T:H(){G 1K=1n.2o(3m,F,"1T",[]);1K.3b=F.3b;1K.9c=F.9c;1K.6h=F.6h;1K.bD=F.bD;1K.bY=F.bY;1K.aX=F.aX;1K.5i=F.5i;1K.ze(F.iP);1K.an=F.an;1K.bD=F.bD;1K.bY=F.bY;1K.aX=F.aX;1K.3M=F.3M.9D(0);1K.1P=F.1P.1T();1K.O1(F.oE);I 1K},3q:H(){G 1q=1n.2o(3m,F,"3q",[]);1q.1d=F.1d;if(F.5i){1q.5i=F.5i.3q()}1q.3b=F.3b;1q.9c=F.9c;1q.6h=F.6h;1q.an=F.an;1q.iP=F.iP;1q.bD=F.bD;1q.bY=F.bY;1q.aX=F.aX;1q.oE=F.oE;if(F.9s){1q.3r=F.9s.8S}if(F.2K){1q.2K=F.2K.8S}G 5q=[];1h(G i=0,l=F.3M.T;i<l;i++){if(F.3M[i]==1c){5q.1f(1c)}1k{5q.1f(F.3M[i].3q())}}1q.5q=5q;I 1q},3D:H(1q){1n.2o(3m,F,"3D",[1q]);F.4G(1a 1I(1q.1d.x,1q.1d.y,1q.1d.1l,1q.1d.1o));if(1q.5i){G id=1q.5i.id;G ap;if(id){ap=K.8a.2e(id)}1k{ap=1a K.8a();ap.3D(1q.5i)}ap.11S=1t;F.XY(ap)}F.ya(1q.3b);F.XV(1q.9c);if(1q.6h!==1F){F.6h=1q.6h}if(1q.an!==1F){F.an=1q.an}if(1q.iP!==1F){F.ze(1q.iP)}if(F.bI){F.bI.8E()}if(1q.oE!==1F){F.O1(1q.oE)}if(1q.bD!==1F){F.10e(1q.bD)}if(1q.bY!==1F){F.10g(1q.bY)}if(1q.aX!==1F){F.ZT(1q.aX)}if(1q.3r!==1F){F.CZ=1q.3r}if(1q.2K!==1F){F.CY=1q.2K}F.3M=[];if(1q.5q){1h(G i=0,l=1q.5q.T;i<l;i++){if(1q.5q[i]==1c){F.3M.1f(1c);2V}G 2R=1n.mY(1q.5q[i].Bb);if(2R){G 7E=1a 2R(F);7E.3D(1q.5q[i]);F.3M.1f(7E)}}}},5g:H(1v,O){1n.2o(3m,F,"5g",[1v,O]);F.4G(O.UP("JF",1v));F.ya(O.5k("17N",1v));F.5i=O.1gX("8a",1v);F.aX=O.4v("17I",1v,1t);F.bD=O.4v("17H",1v,1t);F.bY=O.4v("17K",1v,1t);F.O1(O.4v("17o",1v,1x));F.an=O.4v("17p",1v,1t);F.ze(O.4v("17t",1v));if(F.bI){F.bI.8E()}F.9c=O.3Q("165",1v,F.9c);F.6h=O.3Q("5K",1v,F.6h);G 4P=O.1h4("164",1v);if(4P){1h(G i=0;i<4P.c5.T;i++){4P.c5[i].Xv(F)}1h(G i=0;i<4P.2C.T;i++){F.4K(4P.2C[i])}}F.Kp("o9",1v,O)},5u:H(1v,O){1n.2o(3m,F,"5u",[1v,O]);O.PM(F.3a(),"JF",1v);O.5w(F.em(),"17N",1v);O.1gU(F.5i,"8a",1v);O.4o(F.aX,"17I",1v);O.4o(F.bD,"17H",1v);O.4o(F.bY,"17K",1v);O.4o(F.16L(),"17o",1v);O.4o(F.an,"17p",1v);O.4o(F.Yf(),"17t",1v);O.4r(F.9c,"165",1v);O.4r(F.6h,"5K",1v);G 4P={UB:F};if(F.c5&&F.c5.T>0){4P.c5=F.HN()}if(F.2C&&F.2C.T>0){4P.2C=F.2C}if(4P.c5||4P.2C){O.1gZ(4P,"164",1v)}F.Kt("o9",1v,O)},Kp:H(2l,2a,O){F.3M=[];G 1u=O.4k("o9",2a);if(!1u){I}G iz=1u.7U("ou");1h(G i=0;i<iz.T;i++){G bk=iz[i];F.3M.1f(O.Pf(bk))}},Kt:H(2l,2a,O){G TY=O.3i(2l,2a);1h(G i=0;i<F.3M.T;i++){O.Pg(F.3M[i],ou,2a)}},ig:H(1R){1n.2o(3m,F,"ig",[1R]);if(F.CZ!==1F){F.Xv(1R[F.CZ]);5M F.CZ}if(F.CY!==1F){G 2K=1R[F.CY];2K.2C.1f(F);F.2K=2K;5M F.CY}},1uc:H(){I F.eo},1u6:H(){I F.eu},10e:H(N){if(F.bD!==N){F.bD=N;F.6I()}},1tV:H(){I F.bD},10g:H(N){if(F.bY!==N){F.bY=N;F.6I()}},1uN:H(){I F.bY},F8:H(eG){if(eG&&!F.bY){I 1x}if(!eG&&!F.bD){I 1x}I 1t},ya:H(N,qj){if(F.3b!=N){F.3b=N;if(F.1j){if(qj){F.po()}if(F.5i){F.XH()}}if(F.Yf()){F.bI.dS()}F.1S()}},em:H(){I F.3b},ED:H(2p,5D){G 1W=1a K.6D({S:F,2p:2p,5D:5D});F.1j.3n(K.2q.Jo,1W);I 1W.h6()},EM:H(2p,5D){G 1W=1a K.6D({S:F,2p:2p,5D:5D});F.1j.3n(K.2q.Je,1W);I 1W.h6()},BJ:H(1i,1p,4X){G cp=1a K.rz(F,1i,4X);cp.4Z.1p=1p;I cp},QB:H(1i){if(!1E.2O(F.eo,1i)){F.eo.1f(1i)}},Rq:H(1i){if(!1E.2O(F.eu,1i)){F.eu.1f(1i)}},Rm:H(1i){1E.54(F.eo,1i)},Rk:H(1i){1E.54(F.eu,1i)},mO:H(1X){1h(G i=0;i<F.eo.T;i++){if(1X.7g(F.eo[i])===-1){1X.1f(F.eo[i])}}},mE:H(1X){1h(G i=0;i<F.eu.T;i++){if(1X.7g(F.eu[i])===-1){1X.1f(F.eu[i])}}},Jt:H(){G 1X=[];F.mO(1X);F.mE(1X);I 1X},17E:H(){if(F.1j){G 1X=[];F.mO(1X);F.mE(1X);1h(G i=0;i<1X.T;i++){F.1j.ml(1X[i])}}},eW:H(2A){G jL=2A.6b.1V(F);if(jL==1c){I}G t5=jL.1d;G zi=F.Ly(t5,F.1d,2A);F.4G(zi,1x);F.pM()},ja:H(2A){G jL=2A.6b.1V(F);if(jL==1c){I}G t5=jL.1d;if(F.aX){F.1j.TD([t5,F.1d])}if(F.2K){F.2K.10f(F,2A.3f.1y)}},lJ:H(2A){if(F.1j){I F.1j.GW(F,2A.ck)}I 1t},UD:H(1g){I 1x},19r:H(1g){},lY:H(){I{1d:F.1d,3b:F.3b}},tk:H(2A){G 1G=2A.6b.1V(F);if(1G!=1c){F.4G(1G.1d)}},po:H(){G 1X=F.Jt();1h(G i=0,l=1X.T;i<l;i++){G 1i=1X[i];1i.rP()}},4G:H(1d,qj){if(qj){F.wP(1d)}1k{F.12U(1d)}},wP:H(1d,fk){G hP=1a K.c6(F);if(fk){hP.fk=fk}F.12U(1d);hP.qj()},12V:H(1d,po,hh){if(po&&hh){F.4G(1d,1t)}1k{if(po){F.wP(1d,K.c6.Co)}1k{if(hh){F.wP(1d,K.c6.15w)}1k{F.4G(1d,1x)}}}},12U:H(1d){G XX=F.1d;F.1d=1d;F.XH();F.16K();F.1S();F.BH()},3a:H(){I F.1d},BH:H(){if(F.1j&&F.1j.LB){F.1j.LB()}},FQ:H(6G,dx,dy,po,hh){G w=6G.1l;G h=6G.1o;G 1r=1a 1I(6G.x-w/2+dx,6G.y-h/2+dy,w,h);F.12V(1r,po,hh)},6y:H(dx,dy,po,hh){G w=F.1d.1l;G h=F.1d.1o;G 1r=1a 1I(dx,dy,w,h);F.12V(1r,po,hh)},Ly:H(O6,3G,2A){G 1p=2A.ck.1T();G 2I=2A.9q.1T();if(2A.3f.1y===8){I F.16f(O6,1p,2A)}if(2A.8t==K.9Q.jw){G Fb=2A.3f.1g;if(Fb.3b){G jL=2A.6b;if(jL!=1c){G wC=jL.1V(Fb).1d;1p=K.1M.bO(1p,wC.2N(),-Fb.3b);2I=K.1M.bO(2I,wC.2N(),-Fb.3b)}}G 9b=K.1M.lO(1p,2I);G mm=2h.4T(F.1j.3z);G 16c=K.5X.u9(O6,mm);1p=16c[2A.3f.1y];1p.ki(9b)}if(F.1j.gy&&!F.3b){1p=F.1j.JE(F,1p,2A.3f)}G rc=O6;G 7p=rc.2N();6m(2A.3f.1y){2k 0:rc=F.pk(1p.x,1p.y,rc.2Z(),rc.3F());2i;2k 1:rc=F.pk(rc.x,1p.y,1p.x,rc.3F());2i;2k 2:rc=F.pk(rc.x,rc.y,1p.x,1p.y);2i;2k 3:rc=F.pk(1p.x,rc.y,rc.2Z(),1p.y);2i;2k 4:rc=F.pk(rc.x,1p.y,rc.2Z(),rc.3F());2i;2k 5:rc=F.pk(rc.x,rc.y,1p.x,rc.3F());2i;2k 6:rc=F.pk(rc.x,rc.y,rc.2Z(),1p.y);2i;2k 7:rc=F.pk(1p.x,rc.y,rc.2Z(),rc.3F());2i}if(rc.1l===0){rc.1l=F.1j.gy?F.1j.fG:2h.wD(F.1j.3z)}if(rc.1o===0){rc.1o=F.1j.gy?F.1j.fF:2h.wD(F.1j.3z)}if(F.3b!==0){G 4W=1a 1L(rc.x,rc.y);G 4Q=1a 1L(rc.2Z(),rc.3F());4W=K.1M.bO(4W,7p,F.3b);4Q=K.1M.bO(4Q,7p,F.3b);7p=1a 1L((4W.x+4Q.x)/2,(4W.y+4Q.y)/2);4W=K.1M.bO(4W,7p,-F.3b);4Q=K.1M.bO(4Q,7p,-F.3b);rc=1I.gK(4W,4Q)}I rc},16f:H(1r,1p,2A){if(F.1j.gy){G jL=2A.6b;if(jL==1c){I 1r}G wC=jL.1V(F).1d;G zj=K.1M.4R(wC,K.1M.lO(1p,2A.9q));G Od=1a 1L(0,0);if(F.3b!==0){G 12e=F.12o(zj,K.1M.9J(zj),F.3b);Od=K.1M.lO(12e.5H(),zj.5H());zj=12e}G OH=F.1j.15e(F,zj);OH.x-=Od.x;OH.y-=Od.y;G 5H=OH}1k{G 9b=K.1M.lO(1p,2A.9q);G 5H=1r.5H().ki(9b)}G IP=F.169();G zi=1a 1I(5H.x,5H.y,1r.1l,1r.1o);I(IP)?zi:F.1d},169:H(){I 1t},Dg:H(3L,1r){if(1r==1c){1r=F.1d}G Ow=F.15O(3L,1r);if(F.3b!==0){Ow=K.1M.bO(Ow,1r.2N(),F.3b)}I Ow},7F:H(1p){if(!F.1j){I 1c}if(F.6h==K.5K.vk){G 12C=F.1j.17r(F,1p);I 12C!==1F?{1g:F,1y:12C}:1c}I K.5X.1iv(1p,F)},15O:H(3L,1r){if(1r==1c){1r=F.1d}G tl=1r.5H();G br=1r.bc();G 2N=1r.2N();6m(3L){2k 0:I tl;2k 1:I 1a 1L(br.x,tl.y);2k 2:I br;2k 3:I 1a 1L(tl.x,br.y);2k 4:I 1a 1L(2N.x,tl.y);2k 5:I 1a 1L(br.x,2N.y);2k 6:I 1a 1L(2N.x,br.y);2k 7:I 1a 1L(tl.x,2N.y);2k 8:I 2N;2k 9:I 1a 1L(2N.x,tl.y-2h.wD(F.1j.3z)*6)}I 2N},3S:H(1p){I F.1d.3S(1p)},9J:H(){I 1a 1L((F.1d.x+(F.1d.x+F.1d.1l))/2,(F.1d.y+(F.1d.y+F.1d.1o))/2)},8m:H(){I F.12o(F.1d)},12o:H(1r){G p=[];p.1f(1r.5H());p.1f(1r.hc());p.1f(1r.bc());p.1f(1r.hi());K.1M.k7(p,K.1M.9J(1r),F.3b);G cJ=1w.2H(p[0].x,1w.2H(p[1].x,1w.2H(p[2].x,p[3].x)));G 8Z=1w.2H(p[0].y,1w.2H(p[1].y,1w.2H(p[2].y,p[3].y)));G eA=1w.2n(p[0].x,1w.2n(p[1].x,1w.2n(p[2].x,p[3].x)));G am=1w.2n(p[0].y,1w.2n(p[1].y,1w.2n(p[2].y,p[3].y)));I 1I.gQ(cJ,8Z,eA,am)},ez:H(6Q,7Y){if(6Q.dI(7Y)){I 6Q.1T()}G 2N=F.9J();if(F.1d.1l!==0&&F.1d.1o!==0){if(F.1d.3S(6Q)&&F.1d.3S(7Y)){I 2N}K.1M.1uS(F.9W(),6Q,7Y,2N)}I 2N},Vx:H(12s){G pl=F.8m();G 2N=1a 1L(pl.3R(),(pl.3c()+pl.3F())/2);2N.x+=12s*pl.1l;G 15Q=1a 1L(2N.x,2N.y-3*1w.4L(F.1d.1o));G OC=F.ez(15Q,2N);if(!pl.2O(OC)){OC=1a 1L(pl.3R()+pl.1l*12s,pl.3c())}I OC},je:H(1r){G r=F.8m();I r.hZ(1r)},pk:H(x1,y1,x2,y2){I 1a 1I.gQ(x1,y1,x2,y2)},Ju:H(){I 1t},15L:H(a,b){I a.d-b.d},E6:H(1p,1i,4X){G s0=F.kd(1p,1i,4X);if(s0.1y===-1){I 1c}I s0},TR:H(1y,4X){if(F.5i==1c){I}G A1=F.5i.uV();if(1y<0||1y>=A1.T){I}G mj=A1[1y];G pt=J.1e.1M.uK(1a 1L(mj.x,mj.y),F.1d);G 5J=[pt];if(F.3b!==0){G 5c=F.k0(F.1d);5c.FR(5J)}I{1y:1y,1p:5J[0],8u:K.1M.AI(5J[0],F.1d)}},kd:H(1p,1i,4X){G Fr=F.m5(1p);if(F.5i==1c){I{1y:0,1p:Fr,8u:Fr}}G 1b=[];G 5J=[];G Yv=[];G A1=F.5i.uV();1h(G i=0;i<A1.T;i++){G mj=A1[i];if(4X&&!mj.15K()){2V}if(!4X&&!mj.15J()){2V}G pt=J.1e.1M.uK(1a 1L(mj.x,mj.y),F.1d);5J.1f(pt);Yv.1f(i)}if(F.3b!==0){G 5c=F.k0(F.1d);5c.FR(5J)}1h(G i=0;i<5J.T;i++){G pp=5J[i];G 1y=Yv[i];1b.1f({p:pp,d:1p.5y(pp),i:1y})}1b.8F(F.15L);if(1b.T>0){I{1y:1b[0].i,1p:1b[0].p,8u:K.1M.AI(1b[0].p,F.1d)}}1k{I{1y:0,1p:Fr,8u:Fr}}},yR:H(){F.wR(F.kI);1n.2o(3m,F,"yR",[])},u9:H(){G 1d=F.1d;G tl=1d.5H();G br=1d.bc();G 2N=1d.2N();G 5J=[];if((F.9c&K.6o.JD)!==0){5J.1f(tl)}if((F.9c&K.6o.15X)!==0){5J.1f(1d.hc())}if((F.9c&K.6o.15R)!==0){5J.1f(br)}if((F.9c&K.6o.16C)!==0){5J.1f(1d.hi())}if((F.9c&K.6o.Sx)!==0){5J.1f(1a 1L(2N.x,tl.y))}if((F.9c&K.6o.ST)!==0){5J.1f(1a 1L(br.x,2N.y))}if((F.9c&K.6o.SS)!==0){5J.1f(1a 1L(2N.x,br.y))}if((F.9c&K.6o.SR)!==0){5J.1f(1a 1L(tl.x,2N.y))}if((F.9c&K.6o.lD)!==0){5J.1f(2N)}if((F.9c&K.6o.iN)!==0){5J.1f(1a 1L(2N.x,tl.y-2h.4T(F.1j.3z)*6))}if(F.3b!==0){G 5c=F.k0(F.1d);5c.FR(5J)}I 5J},k0:H(1r){G 3g=1a J.1B.9T();3g.nP(F.3b,1r.2N().x,1r.2N().y);I 3g},1fY:H(1p){if(F.3b!=0){G 7p=F.3a().2N();I K.1M.bO(1p,7p,-F.3b)}I 1p},BF:H(O){O.cM();G 1d=F.1d;O.a6(1d.x+1d.1l/2,1d.y+1d.1o/2);O.kS(K.1M.GL(F.3b));O.a6(-1d.x-1d.1l/2,-1d.y-1d.1o/2);if(F.6h==K.5K.vk){F.1j.17l(F,O)}1k{K.5X.BK(O,F)}O.cH()},XV:H(N){if(F.9c!=N){F.9c=N;F.1S()}},B9:H(){I F.9c},1tG:H(N){if(F.6h!=N){F.6h=N;F.1S()}},I2:H(){I F.6h},ZT:H(N){if(F.aX!==N){F.aX=N;F.6I()}},YU:H(){I F.aX},ze:H(N){if(F.iP!=N){F.iP=N;if(N){F.bI=1a K.v8(F);F.CE(F.bI)}1k{F.CF(F.bI);5M F.bI}}},Yf:H(){I F.iP},19I:H(N){if(F.an!=N){if(N){F.S2()}1k{F.uC()}}},1tb:H(){I F.an},O1:H(N){if(F.oE!=N){F.oE=N;if(N){F.NL=1a K.v9(F);F.CE(F.NL)}1k{F.CF(F.NL);5M F.NL}}},16L:H(){I F.oE},CE:H(9o){if(!F.jq){F.jq=1a 1E()}F.jq.1f(9o);F.6e.2w.1f(9o);if(F.1j){F.1j.1S()}},CF:H(9o){if(!F.jq){I}F.jq.54(9o);1E.54(F.6e.2w,9o);if(F.1j){F.1j.1S()}},16K:H(){if(!F.jq){I}F.jq.1U(H(Fu){Fu.dS()})},mI:H(2p){if(!F.jq){I 1c}1h(G i=0;i<F.jq.T;i++){G Fu=F.jq[i];if(Fu.aY(2p)){I Fu}}I 1c},D6:H(2w){if(F.jq){F.jq.1U(H(1g){2w.1f(1g)})}},uC:H(fz){if(fz){if(fz.2O(F)){I}fz.4K(F);F.jp(1x);if(F.aO&&F.1j){F.1j.3h.ml(F)}if(!F.an){I}}1k{fz=F.fz=1a J.3X.9x();fz.4K(F);F.an=1x;if(F.bI){F.bI.8E()}if(F.1j){F.1j.1S()}}G 1X=[];if(F.1j.fX){F.mO(1X)}1k{F.mE(1X)}1E.1U(1X,H(1i){1i.uC(fz)})},S2:H(){F.an=1t;if(F.bI){F.bI.8E()}if(F.1j){F.1j.1S()}if(F.fz){F.fz.1U(H(1g){1g.jp(1t)});5M F.fz}1k{G 1X=[];if(1j.fX){F.mO(1X);1E.1U(1X,H(1i){1i.jp(1t);G S=1i.kM();S.jp(1t);if(S.bI){S.an=1x;S.bI.8E()}})}1k{F.mE(1X);1E.1U(1X,H(1i){1i.jp(1t);G S=1i.kD();S.jp(1t);if(S.bI){S.an=1x;S.bI.8E()}})}}},16n:H(YR,BP,mP){6m(YR){fI:1n.2o(3m,F,"16n",[YR,BP,mP]);2i}},9W:H(){I F.1d.z2()},m5:H(1p){G 2b=F.9W();2b.1f(2b[0].1T());G 5v={N:0};K.1M.FT(1p,2b,2b.T,5v);I K.1M.1t9(1p,2b[5v.N],2b[5v.N+1])},1ta:H(){I F.5i},XY:H(N){if(F.5i!=1c){F.wR(F.kI)}F.5i=N;F.pM();F.1S()},O5:H(5i,16j,1te){if(5i==1c){I}F.yZ=1t;1h(G i=0;i<5i.uV().T;i++){G p=5i.uV()[i];G v=F.16s(p);if(!v){2V}F.1j.z1(v);16j.1f(v)}},wR:H(NK){if(NK==1c){I}F.yZ=1x;G v=NK.dq();3v(v){F.1j.H5(v);v=NK.dq()}},16s:H(1p){G 1d=F.1d;G 1l=1;if(1p){1l=1p.m8()}G pt=J.1e.1M.uK(1a 1L(1p.16v(),1p.16u()),1d);G 4R;if(F.3b!==0){G l4=K.1M.bO(pt,1d.2N(),F.3b);4R=J.1e.1M.zi(l4,1l)}1k{4R=J.1e.1M.zi(pt,1l)}G l=4R.x;G t=4R.y;G 1Y=1p.m8();G 5h=1Y/2;G 7K=J.1e.1M.7K;G 2B;6m(1p.16p()){2k J.1e.9R.Bw:G rV="M{0},{1} L{2},{1} M{3},{4} L{3},{5}";rV=7K(rV,l,(t+5h),(l+1Y),(l+5h),t,(t+1Y));2B=1a J.1B.3U(rV);2i;2k J.1e.9R.X:G rV="M{0},{1} L{2},{3} M{0},{3} L{2},{1}";rV=7K(rV,l,t,l+1Y,t+1Y);2B=1a J.1B.3U(rV);2i;2k J.1e.9R.hx:2B=1a J.1B.1tx(l+5h,t+5h,5h,0,f5,0);2i;2k J.1e.9R.az:2B=1a 1I(l,t,1Y,1Y);2i;2k J.1e.9R.7H:I}2B.2y=1p.16q();2B.1N="6W";I 2B},pM:H(){if(F.1j&&F.1j.Db){F.BE(F.1j.Db())}},19h:H(z3){F.17P(F.5i,F.kI,z3)},17P:H(19f,1sL,z3){if(F.5i==1c){I}G 1b=19f.uV();if(F.yZ&&!z3){F.wR(F.kI)}if(!F.yZ&&z3){F.O5(F.5i,F.kI,1t)}if(F.yZ&&z3){F.wR(F.kI);F.O5(F.5i,F.kI,1t)}},BE:H(Nq){F.19h(F.XJ(Nq))},XJ:H(Nq){if(F.1j==1c||!F.jj()){I 1x}G hl=F.1j.141();G qk=Nq==F||hl==J.1e.tK.19a||F.kq()&&hl==J.1e.tK.19c;I qk},XH:H(){if(F.5i==1c){I}F.wR(F.kI);if(!F.1j||!F.1j.Db){I}if(F.XJ(F.1j.Db())){F.O5(F.5i,F.kI,1t)}},1sN:H(1p){G 1l=1;if(19j){1l=19j.3a().1l}I J.1e.1M.uK(1a 1L(mj.x,mj.y),F.3a())},1sT:H(){I F.1d.1tK()},Xv:H(S){S.196(F)},17G:H(){if(F.9s){F.9s.ZG(F);F.6I()}},196:H(kH){if(!F.c5){F.c5=1a 1E()}F.c5.1f(kH);kH.m0={EZ:kH.1d.x-F.1d.x,EW:kH.1d.y-F.1d.y};kH.9s=F;F.6I()},ZG:H(kH){if(!F.c5){I}if(kH.9s==F){F.c5.54(kH);5M kH.m0;5M kH.9s}},I3:H(){I F.9s},HN:H(){if(!F.c5){I[]}G 2u=[];F.c5.1U(H(S){2u.1f(S)});I 2u},fA:H(){if(!J.1e.3B.rm){I 1t}G 3r=F.195();if(3r){I 1n.2o(3m,3r,"fA",[])}I 1n.2o(3m,F,"fA",[])},195:H(){G Y8=19t++;G 3r=F.9s;3v(3r!=1c&&3r.9s!=1c){if(3r==F){2i}if(3r.194==Y8){2i}3r.194=Y8;3r=3r.9s}I 3r},nu:H(1p){I F.8m()},pN:H(8e,5W){I 1a K.6D({S:F,8e:8e,5W:5W})},UE:H(1g){I 1x},XO:H(){F.wR(F.kI)},XP:H(){if(F.5i){F.pM()}},KR:H(oe){if(F.2K){I F.2K}if(oe&&F.9s){I F.9s}I 1c},cD:H(4g,4H){G 8l=4H.5I["4O:3m"];if(8l){if(4g.5j(8l)){I 8l}}I 1n.2o(3m,F,"cD",[4g,4H])},1uY:H(){if(F.3M===1F){F.3M=[]}I F.3M},19K:H(){if(F.3M&&F.3M.T){I F.3M}G 1A=F.e8(K.2E.1s.Mz);if(1A){I 1A.Mq()}I[]},pC:H(O,1D){if(!F.1j){I}1D.1gE=F.2g&&F.2g.YT&&F.2g.YT();1D.1gz=2h.wD(F.1j.3z);G 3M=F.19K();G 19N=3M.T>0&&3M[0]==1c;if(!19N){if(F.1j.12R){G 5q=F.1j.12R();1h(G i=0,l=5q.T;i<l;i++){if(5q[i]!=1c){5q[i].5j(F,O,1D)}}}}1h(G i=0,l=3M.T;i<l;i++){if(3M[i]!=1c){3M[i].5j(F,O,1D)}}},Kl:H(ep,Aj){G b=F.1d;G y=ep.pT()+(ep.uh()-ep.pT())*Aj;F.4G(1a 1I(b.x,y,b.1l,b.1o),1t)},dQ:H(){G 1G=1n.2o(3m,F,"dQ",[]);1G.1d=F.1d.1T();1G.5i=F.5i;1G.3b=F.3b;1G.9c=F.9c;1G.6h=F.6h;1G.an=F.an;1G.iP=F.iP;1G.bD=F.bD;1G.bY=F.bY;1G.aX=F.aX;1G.3r=F.9s;1G.2K=F.2K;1G.3M=F.3M;I 1G},ee:H(1G){1n.2o(3m,F,"ee",[1G]);F.4G(1G.1d);F.XY(1G.5i);F.ya(1G.3b);F.XV(1G.9c);F.6h=1G.6h;F.19I(1G.an);F.ze(1G.iP);F.10e(1G.bD);F.10g(1G.bY);F.ZT(1G.aX);F.CZ=1G.3r;F.CY=1G.2K;F.3M=1G.3M}};J.2x(3m,"J.1e.3m",K.ao);G 19t=0})(J.1e);(H(K){G l0=J.1B.l0;G 6F=J.1B.6F;G 1I=J.1B.1I;G aV=J.1B.aV;G 7G=J.1B.7G;G cN=J.1B.cN;G jP=K.jP=H(){1n.2T(jP,F);F.2w=F.2C=[]};jP.1s={1u4:H(){I F.2C},il:H(4F,6u){F.13K=4F;1h(G c=0;c<F.2C.T;c++){G 2c=F.2C[c];2c.1j=F}},Ek:H(2c,4F,6u){if(2c.il){2c.il(4F,6u);I 1a 6F(F.Q9(2c),F.Qa(2c))}I 1a 6F(1c,1c)},18e:H(2c,x,y,w,h){if(2c.a4){2c.a4(x,y,w,h)}1k{if(2c.4G){2c.4G(1a 1I(x,y,w,h))}}},10m:H(2c){I 2c.19E?2c.19E():1c},10v:H(2c){I 2c.19z?2c.19z():1c},Q9:H(2c){G w=F.10m(2c);G mw=0;if(2c.4E){mw=2c.4E.1l()}I w==1c?1c:w+mw},Qa:H(2c){G h=F.10v(2c);G mh=0;if(2c.4E){mh=2c.4E.1o()}I h==1c?1c:h+mh},19B:H(2c){I 2c.7i==J.1B.8n},E8:H(2c,x,y,w,h){G om=2c.4E?2c.4E:1a 7G(0,0,0,0);G A9=2c.A9||aV.bi;G A8=2c.A8||aV.bi;G 1l=w-om.1l();G mw=F.10m(2c);G 19A=mw!=1c&&mw>1l&&F.19B(2c);if(mw!=1c&&mw<1l&&A9!=aV.A2){1l=mw}G 1o=h-om.1o();G mh=F.10v(2c);if(mh!=1c&&mh<1o&&!19A&&A8!=aV.A2){1o=mh}G 3R=x;G 3c=y;6m(A9){2k aV.bi:3R+=om.3R;2i;2k aV.7z:3R+=w/2-1l/2;2i;2k aV.gE:3R+=w-1l-om.2Z;2i;2k aV.A2:3R+=om.3R;2i}6m(A8){2k aV.bi:3c+=om.3c;2i;2k aV.7z:3c+=h/2-1o/2;2i;2k aV.gE:3c+=h-1o-om.3F;2i;2k aV.A2:3c+=om.3c;2i}F.18e(2c,3R,3c,1l,1o)},aY:H(1p){G 2W=1n.2o(jP,F,"aY",[1p]);if(2W){G dB=1p.rS(-F.x,-F.y);1h(G c=F.2C.T-1;c>=0;c--){G 2c=F.2C[c];G bK=2c.bK;if(5P bK=="1F"){bK=cN.E3}if(bK==cN.E3){if(2c.aY){G Zf=2c.aY(dB);if(Zf){I Zf}}if(2c.3a){if(2c.3a().3S(dB)){I 2c}}}}}I 2W}};J.2x(jP,"J.1e.jP",l0)})(J.1e);(H(K){G aV=J.1B.aV;G 7G=J.1B.7G;G zm=K.zm=H(wY){F.ZY={};F.iJ={};F.wY=wY};zm.1s={18h:["3l","5n","2C","N6","Nj","M2","8u"],Y1:H(6P){G sK=6P.3l;G 3l=F.18v(sK);G 5n=6P.5n;if(5n){F.ZY[5n]=3l}if(sK=="hX"&&6P.8u){G wY=F.wY;if(wY){1n.7I(3l.4d,{uf:H(){3l.zo=1t;wY()}})}1k{3l.zo=1t}3l.4d.g7=6P.8u}G M2=6P.M2;if(M2&&5n){G h8="1V"+5n;G nI="2X"+5n;F.iJ[h8]=H(){I F.E5[5n].1qz()};F.iJ[nI]=H(N){F.E5[5n].1qD(N!=1c?N:F.E5[5n].1qC());F.1S()}}1h(G 7c in 6P){if(F.18h.7g(7c)>-1){2V}if(6P.1fT(7c)){if(7c=="5L"&&5P 6P[7c]=="av"){6m(6P[7c]){2k"6M":3l[7c]=K.5U.6M;2i;2k"hg":3l[7c]=K.5U.hg;2i}}1k{if(7c=="9Z"&&5P 6P[7c]=="av"){3l[7c]=J.1B.hW[6P[7c]]}1k{if(7c=="bK"&&5P 6P[7c]=="av"){3l[7c]=J.1B.cN[6P[7c]]}1k{if((7c=="A9"||7c=="A8")&&5P 6P[7c]=="av"){3l[7c]=J.1B.aV[6P[7c]]}1k{if((7c=="4E"||7c=="6g")&&5P 6P[7c]=="av"){G dA=6P[7c].cF(",");if(dA.T==1){G CQ=6s(dA[0]);3l[7c]=1a 7G(CQ,CQ,CQ,CQ)}1k{if(dA.T==4){G l=6s(dA[0]);G t=6s(dA[1]);G r=6s(dA[2]);G b=6s(dA[3]);3l[7c]=1a 7G(l,t,r,b)}}}1k{if(7c=="2m"&&5P 6P[7c]=="av"){G dA=6P[7c].cF(" ");G 5x=dA[0];G 1Y=4;G ql=1x;G qh=1x;1h(G p=1;p<dA.T;p++){if(dA[p]=="ql"){ql=1t}1k{if(dA[p]=="qh"){qh=1t}1k{1Y=6s(dA[p])}}}3l[7c]=1a J.1B.5T(5x,1Y,ql,qh)}1k{3l[7c]=6P[7c]}}}}}}}}if(6P.N6){G 2P=[];1h(G r=0;r<6P.N6.T;r++){G Nk=6P.N6[r];G 1J=1a K.vw();if(Nk=="*"){1J.nl=K.vl.Ep}1k{if(Nk!="lL"){1J.1o=6s(Nk)}}2P.1f(1J)}3l.2P=2P}if(6P.Nj){G lm=[];1h(G c=0;c<6P.Nj.T;c++){G Nb=6P.Nj[c];G 4B=1a K.vF();if(Nb=="*"){4B.nl=K.vl.Ep}1k{if(Nb!="lL"){4B.1l=6s(Nb)}}lm.1f(4B)}3l.3W=lm}if(6P.2C){1h(G ct=0;ct<6P.2C.T;ct++){G 18O=6P.2C[ct];G 18r=F.Y1(18O);3l.2C.1f(18r)}}F.18w(3l);I 3l},18w:H(3l){if(3l.7i==J.1B.8n){3l.qe=1t;3l.Ba=1t}},18v:H(5n){if(5n.7g("jP")!==-1){I 1a K[5n]()}if(5n.7g(".")==-1){I 1a J.1B[5n]()}I 1a F.13A(5n)},13A:H(5n){G dA=5n.cF(".");G 3G=(6V||F);1h(G i=0;i<dA.T;i++){3G=3G[dA[i]]}if(5P 3G!=="H"){7r 1a 7M("kb hS xo.")}I 3G}};J.2x(zm,"J.1e.zm")})(J.1e);(H(K){G vF=K.vF=H(){F.x=0;F.1l=1c;F.yM=1c;F.nl=K.vl.lL};vF.1s={13v:H(N){F.nl=N},13t:H(){I F.nl},fl:H(N){F.1l=N},8v:H(){I F.1l},rO:H(){I F.1l},vq:H(){I F.1l!=1c?F.1l:F.yM},Z7:H(3I,1Y){F.x=3I;F.ZF=1Y},Cc:H(){if(F.1l!=1c){I 1x}I F.yM==1c||F.nl==K.vl.Ep}};J.2x(vF,"J.1e.vF")})(J.1e);(H(K){G cN=J.1B.cN;G rH=K.rH=H(){1n.2T(rH,F);F.2P=[1a K.vw()];F.3W=[1a K.vF()]};rH.1s={1qr:H(){I F.2P},1qp:H(){I F.3W},il:H(4F,6u){1n.2o(rH,F,"il",[4F,6u]);1h(G r=0;r<F.2P.T;r++){G 1J=F.2P[r];1J.yK=1c}1h(G c=0;c<F.3W.T;c++){G 4B=F.3W[c];4B.yM=1c}1h(G c=0;c<F.2C.T;c++){G 2c=F.2C[c];if(2c.bK==cN.vu){2V}G oZ=F.Ek(2c,4F,6u);G hI=2c.hI;if(!hI){hI=0}if(hI<F.2P.T){G 1J=F.2P[hI];1J.yK=F.2n(1J.yK,oZ.1o)}G k9=2c.13D;if(!k9){k9=0}if(k9<F.3W.T){G 4B=F.3W[k9];4B.yM=F.2n(4B.yM,oZ.1l)}}F.ke=1c;1h(G r=0;r<F.2P.T;r++){G 1J=F.2P[r];F.ke=F.4K(F.ke,1J.vq())}F.km=1c;1h(G c=0;c<F.3W.T;c++){G 4B=F.3W[c];F.km=F.4K(F.km,4B.vq())}F.km=F.ke=1c},ZK:H(6n,Zt){G Zs=0;G Zq=0;1h(G i=0;i<6n.T;i++){G 1u=6n[i];G rO=1u.rO();if(rO){Zq+=rO}1k{if(!1u.Cc()){Zs+=1u.vq()}}}G ZL=Zs>Zt-Zq;G zQ=0;G MT=0;1h(G i=0;i<6n.T;i++){G 1u=6n[i];G 1Y=1u.vq();if(1u.rO()||!1u.Cc()&&!ZL){zQ+=1Y}1k{MT++}}G gI=0;if(MT>0){gI=(Zt-zQ)/MT}if(gI<0){gI=0}G 3I=0;1h(G i=0;i<6n.T;i++){G 1u=6n[i];G ms=1u.vq();G MV=gI;if(1u.rO()||!1u.Cc()&&!ZL){MV=ms}1u.Z7(3I,MV);3I=F.4K(3I,MV)}I gI},a4:H(x,y,w,h){1n.2o(rH,F,"a4",[x,y,w,h]);G 1qH=F.ZK(F.2P,h);G CT=F.ZK(F.3W,w);1h(G c=0;c<F.2C.T;c++){G 2c=F.2C[c];if(2c.bK==cN.vu){2V}G 1J=1c;G hI=2c.hI;if(!hI){hI=0}if(hI<F.2P.T){1J=F.2P[hI]}G 4B=1c;G k9=2c.13D;if(!k9){k9=0}if(k9<F.3W.T){4B=F.3W[k9]}if(4B!=1c&&1J!=1c){G Z9=1J.Z1;G 7Z=2c.7Z;if(!7Z){7Z=1}1h(G r=1;r<7Z;r++){G ZO=F.2P[hI+r];if(!ZO){2V}Z9+=ZO.Z1}G ZD=4B.ZF;G oo=2c.bz;if(!oo){oo=1}1h(G l=1;l<oo;l++){G ZN=F.3W[k9+l];if(!ZN){2V}ZD+=ZN.ZF}F.E8(2c,4B.x,1J.y,ZD,Z9)}}}};J.2x(rH,"J.1e.rH",K.jP)})(J.1e);(H(K){G vw=K.vw=H(){F.y=0;F.1o=1c;F.yK=1c;F.nl=K.vl.lL};vw.1s={13v:H(N){F.nl=N},13t:H(){I F.nl},fb:H(N){F.1o=N},8d:H(){I F.1o},rO:H(){I F.1o},vq:H(){I F.1o!=1c?F.1o:F.yK},Z7:H(3I,1Y){F.y=3I;F.Z1=1Y},Cc:H(){if(F.1o!=1c){I 1x}I F.yK==1c||F.nl==K.vl.Ep}};J.2x(vw,"J.1e.vw")})(J.1e);(H(K){G cN=J.1B.cN;G qu=K.qu=H(){1n.2T(qu,F)};qu.1s={il:H(4F,6u){1n.2o(qu,F,"il",[4F,6u]);G 1l=0;G 1o=0;1h(G c=0;c<F.2C.T;c++){G 2c=F.2C[c];if(2c.bK==cN.vu){2V}G oZ=F.Ek(2c,4F,6u);G w=oZ.1l==1c?0:oZ.1l;G h=oZ.1o==1c?0:oZ.1o;1l=1w.2n(w,1l);1o=1w.2n(h,1o)}F.km=1l;F.ke=1o},a4:H(x,y,w,h){1n.2o(qu,F,"a4",[x,y,w,h]);1h(G c=0;c<F.2C.T;c++){G 2c=F.2C[c];if(2c.bK==cN.vu){2V}F.E8(2c,0,0,w,h)}}};J.2x(qu,"J.1e.qu",K.jP)})(J.1e);(H(K){G cN=J.1B.cN;G aV=J.1B.aV;G tO=K.tO=H(){1n.2T(tO,F);F.5L=K.5U.6M};tO.1s={il:H(4F,6u){1n.2o(tO,F,"il",[4F,6u]);G r7=1c;G zU=1c;1h(G c=0;c<F.2C.T;c++){G 2c=F.2C[c];if(2c.bK==cN.vu){2V}G oZ=F.Ek(2c,4F,6u);G cp=F.r7(2c);r7=F.4K(r7,cp);G cs=F.zU(2c);zU=F.2n(zU,cs)}F.13i(r7,zU)},a4:H(x,y,w,h){1n.2o(tO,F,"a4",[x,y,w,h]);G zQ=0;G PW=0;1h(G c=0;c<F.2C.T;c++){G 2c=F.2C[c];if(2c.bK==cN.vu){2V}if(w<F.13K){F.Ek(2c,w,1c)}G cp=F.r7(2c);if(cp!==1c){zQ+=cp}1k{PW++}}G s=F.13P(F);G gI=0;if(PW>0){gI=(s-zQ)/PW}if(gI<0){gI=0}G zO=0;G Eh=F.13Q(F);1h(G c=0;c<F.2C.T;c++){G 2c=F.2C[c];if(2c.bK==cN.vu){2V}G cp=F.r7(2c);G zN=cp!==1c?cp:gI;F.13j(2c,zO,zN,0,Eh);zO+=zN}},XA:H(){I F.5L},IM:H(N){if(F.5L!=N){F.5L=N;F.mk()}},r7:H(3l){6m(F.5L){2k K.5U.6M:I F.Q9(3l);2k K.5U.hg:I F.Qa(3l)}I 0},zU:H(3l){6m(F.5L){2k K.5U.6M:I F.Qa(3l);2k K.5U.hg:I F.Q9(3l)}I 0},13P:H(3l){6m(F.5L){2k K.5U.6M:I 3l.13N;2k K.5U.hg:I 3l.13O}I 0},13Q:H(3l){6m(F.5L){2k K.5U.6M:I 3l.13O;2k K.5U.hg:I 3l.13N}I 0},13j:H(2c,zO,zN,10k,Eh){6m(F.5L){2k K.5U.6M:F.E8(2c,zO,10k,zN,Eh);2i;2k K.5U.hg:F.E8(2c,10k,zO,Eh,zN);2i}},13i:H(10D,10H){6m(F.5L){2k K.5U.6M:F.km=10D;F.ke=10H;2i;2k K.5U.hg:F.ke=10D;F.km=10H;2i}if(F.A9==aV.A2){F.km=1c}if(F.A8==aV.A2){F.ke=1c}}};J.2x(tO,"J.1e.tO",K.jP)})(J.1e);(H(K){G 2J=J.6Z.2J;G 1I=J.1B.1I;G 1L=J.1B.1L;G 2h=J.1B.2h;G 4u=J.1B.4u;G eE=K.eE=H(cB,3f){1n.2T(eE,F);F.cB=cB;F.3f=3f;F.158=3f==1c?1a J.1B.1L(0,0):cB.Dg(3f.1y);F.8t=K.9Q.jw;F.6b=1a J.3X.3o();if(cB){F.6b.2X(cB,cB.lY())}};eE.1s={2I:H(1Z){F.9q=1Z.1T();if(F.8t==K.9Q.jw&&F.6b.Dx()>0){G kT=F.6b.A0();G 1m=kT[0].4Y();1m.H8();1m.UU(kT);F.ES=1m}},6y:H(1Z){F.ck=1Z.1T()},qg:H(1Z){I 1t},bQ:H(1Z){if(F.ES){G 1m=F.ES;if(1m.gs!=K.pf.7H){1m.Hm(F.cB)}1m.oD()}},9g:H(1Z){F.6b.1U(H(1g,1G){1g.tk(F)},F);if(F.ES){F.ES.1iK()}},Cn:H(){F.o6=1t},kU:H(){I F.o6},yd:H(O){},9b:H(){I K.1M.lO(F.ck,F.158)},Qi:H(){I 1t},12a:H(){I 1t}};J.2x(eE,"J.1e.eE")})(J.1e);(H(K){G 2J=J.6Z.2J;G 1I=J.1B.1I;G 1L=J.1B.1L;G 2h=J.1B.2h;G 4u=J.1B.4u;G kJ=K.kJ=H(1m,1i){1n.2T(kJ,F,[1i,{1g:1i,1y:1i.1b.T-1}]);F.1m=1m;F.1i=1i;F.8t=K.9Q.gF};kJ.1s={2I:H(1Z){1n.2o(kJ,F,"2I",[1Z]);F.1i.cA(F)},6y:H(1Z){1n.2o(kJ,F,"6y",[1Z]);F.1i.eW(F);F.eH=1Z.1T()},qg:H(1Z){G 1i=F.1i;I 1i.1j.Cm(1i,F)&&1i.lJ(F)},bQ:H(1Z){if(!1Z.dI(F.eH)){F.6y(1Z)}G 1i=F.1i;1i.ja(F);F.1m.9u(1i);F.1m.HP(1i);1n.2o(kJ,F,"bQ",[1Z])},yd:H(O){F.1i.6e.lQ(O,1t,1x)}};J.2x(kJ,"J.1e.kJ",K.eE)})(J.1e);(H(K){G 2J=J.6Z.2J;G 1I=J.1B.1I;G 1L=J.1B.1L;G 2h=J.1B.2h;G 4u=J.1B.4u;G kP=K.kP=H(1m,S){1n.2T(kP,F,[S,{1g:S,1y:2}]);F.1m=1m;F.S=S;F.8t=K.9Q.gF};kP.1s={2I:H(1Z){1n.2o(kP,F,"2I",[1Z]);F.S.cA(F)},6y:H(1Z){1n.2o(kP,F,"6y",[1Z]);F.S.eW(F);F.eH=1Z.1T()},qg:H(1Z){G S=F.S;I S.1j.Cm(S,F)&&S.lJ(F)},bQ:H(1Z){if(!1Z.dI(F.eH)){F.6y(1Z)}G S=F.S;S.ja(F);S=F.159(S);G 1m=F.1m;1m.9u(S);1m.HP(S);1m.Cw(S,1Z);1n.2o(kP,F,"bQ",[1Z])},yd:H(O){F.S.6e.lQ(O,1t,1x)},1r1:H(6Q,7Y,du){G 1r=1I.gK(6Q,7Y);if(1r.1l<du){1r.1l=du}if(1r.1o<du){1r.1o=du}I 1r},159:H(1g){if(F.vb&&1g.SV){I 1g.SV(F.1m.qA,F.1m.cE)}I 1g}};J.2x(kP,"J.1e.kP",K.eE)})(J.1e);(H(K){G 2J=J.6Z.2J;G 1I=J.1B.1I;G 1L=J.1B.1L;G 2h=J.1B.2h;G 4u=J.1B.4u;G hY=K.hY=H(3h){1n.2T(hY,F,[3h]);F.3h=3h;F.8t=K.9Q.gF};hY.1s={2I:H(1Z){1n.2o(hY,F,"2I",[1Z]);F.3h.cA(F);F.EN=1a 1I(1Z.x,1Z.y,1,1);F.EN.2y="MG";F.EN.1N="hT(oT,oT,oT,0.5)"},6y:H(1Z){1n.2o(hY,F,"6y",[1Z]);F.3h.eW(F);F.eH=1Z.1T();K.1M.1rZ(F.EN,1I.gK(F.9q,1Z));F.3h.1j.1S(1x)},bQ:H(1Z){if(!1Z.dI(F.eH)){F.6y(1Z)}F.3h.ja(F);1n.2o(hY,F,"bQ",[1Z])},yd:H(O){F.EN.lQ(O,1x)}};J.2x(hY,"J.1e.hY",K.eE)})(J.1e);(H(K){G pY=K.pY={1G:{}};G m1=K.m1={aR:1c};G 15i=K.15i={14D:0,14B:2,vv:-1}})(J.1e);(H(K){G 2J=J.6Z.2J;G 1I=J.1B.1I;G 1L=J.1B.1L;G 2h=J.1B.2h;G 4u=J.1B.4u;G Xz={sv:H(3r){if(1n.2D(K.3B,3r)){I 3r.2C}I[]},zw:H(5G){I[5G.2K]},zx:H(5G){I 1n.2D(K.3m,5G)&&5G.2K!=1c},Ey:H(5G,6b){G 2K=5G.2K;G 14Y=2K.3a();G 14U=6b.1V(2K).1d;G p1=14Y.5H();G p2=14U.5H();G 151=K.1M.lO(p1,p2);G XX=6b.1V(5G).1d;5G.4G(K.1M.4R(XX,151))}};G Xy={sv:H(3r){G Ya=[];if(3r.c5){3r.c5.1U(H(S){if(!S.m0){S.m0={}}S.m0.EZ=S.1d.x-3r.1d.x;S.m0.EW=S.1d.y-3r.1d.y;Ya.1f(S)})}I Ya},zw:H(5G){I[5G.9s]},zx:H(5G){I 5G.9s!=1c},Ey:H(5G,6b){G 3r=5G.9s;G m0=5G.m0;if(3r){G 1d=5G.1d.1T();1d.x=3r.1d.x+m0.EZ;1d.y=3r.1d.y+m0.EW;5G.4G(1d)}}};G Xw={sv:H(3r){if(1n.2D(K.3m,3r)){I 3r.Jt()}I[]},zw:H(5G){I[5G.kM(),5G.kD()]},zx:H(5G){I 1n.2D(K.4c,5G)},Ey:H(5G,6b){5G.rP()}};G 15E={sv:H(3r){if(1n.2D(K.eU,3r)){I 3r.2u}I[]},zw:H(5G){I[5G.1j.3h]},zx:H(5G){I 5G.aO&&1n.2D(K.3m,5G)},Ey:H(5G,6b,2A){G 3h=5G.1j.3h;G 1G=6b.1V(3h);if(1G){if(!5G.1j.mF){G 9b=K.1M.lO(3h.1d.5H(),1G.1d.5H());G 1d=6b.1V(5G).1d.1T();1d.x+=9b.x;1d.y+=9b.y;5G.4G(1d)}1k{if(2A.3f.1y==9){G S=2A.3f.1g;G PB=6b.1V(5G).3b;5G.ya(PB+2A.YA)}1k{5G.eW(2A)}}}}};G c6=K.c6=H(OU){1n.2T(c6,F);F.OU=OU;G 1R=F.1R=[OU];F.14k();F.6b=1a J.3X.3o();1h(G i=0;i<1R.T;i++){G 1g=1R[i];F.6b.2X(1g,1g.lY())}};c6.15k=[15E,Xz,Xy,Xw];c6.Co=[Xw];c6.15w=[Xz,Xy];c6.1s={fk:c6.15k,qj:H(){G 1R=F.1R;G fk=F.fk;G Xs=0;G Xr=1R[1R.T-1];G h2=1R.9D(1);3v(h2.T>0){G 1g=h2.kK();G PH=1t;1h(G r=0;r<fk.T&&PH;r++){G f6=fk[r];if(!f6.zx(1g)){2V}G zB=f6.zw(1g);if(Xs<=r){1h(G m=0;m<zB.T;m++){if(h2.7g(zB[m])>=0){PH=1x;2i}}}}if(PH){1h(G r=0;r<fk.T;r++){G f6=fk[r];if(F.15s(f6,1g,h2)){f6.Ey(1g,F.6b,F.2A)}}}1k{h2.1f(1g)}if(1g==Xr){Xs++;Xr=h2[h2.T-1]}}if(F.2A&&5P F.2A.YA!="1F"){I}F.14p()},15s:H(f6,1g,14j){if(!f6.zx(1g)){I 1x}G zB=f6.zw(1g);1h(G m=0;m<zB.T;m++){G 3r=zB[m];if(F.1R.7g(3r)>=0&&14j.7g(3r)==-1){I 1t}}I 1x},14k:H(){G 1R=F.1R;G fk=F.fk;1h(G i=0;i<1R.T;i++){G 1g=1R[i];1h(G r=0;r<fk.T;r++){G f6=fk[r];G sv=f6.sv(1g);1h(G d=0;d<sv.T;d++){G 5G=sv[d];if(1R.7g(5G)===-1){1R.1f(5G)}}}}},14p:H(){1h(G i=0;i<F.1R.T;i++){if(!1n.2D(K.4c,F.1R[i])){2V}G 1i=F.1R[i];G 1O=1i.kM();G 1H=1i.kD();G 14m=1O!=1c&&1H!=1c&&F.1R.7g(1O)>-1&&F.1R.7g(1H)>-1;if(14m){G 4R=F.14n(1O,1H);if(4R){K.1M.1sa(1i.1b,F.6b.1V(1i).wx,4R);1i.6x(1x)}}}},14n:H(7X,7W){G YV=2h.4T(7X.1j.3z)/Xu;G YD=7X.1d;G YM=F.6b.1V(7X).1d;if(!YD.14o(YM)){I 1x}G YO=7W.1d;G YC=F.6b.1V(7W).1d;if(!YO.14o(YC)){I 1x}G PT=4u.gK(YM.5H(),YD.5H());G YW=4u.gK(YC.5H(),YO.5H());if(1w.4L(PT.x-YW.x)<YV&&1w.4L(PT.y-YW.y)<YV){I PT}I 1c}};J.2x(c6,"J.1e.c6")})(J.1e);(H(K){G 2J=J.6Z.2J;G 1I=J.1B.1I;G 2h=J.1B.2h;G 4u=J.1B.4u;G fN=K.fN=H(cB){1n.2T(fN,F);F.cB=cB;F.1m=F.cB.4Y?F.cB.4Y():F.cB.1j.3V.1j};fN.1s={2I:H(1p){G 1m=F.1m;G 1g=F.cB;G G1=F.qo=1g.xB(1p);G 1P=G1.t4();G 1r=G1.nu(1p);G PS=1c;G uP=1n.oH(1m,"uP");if(uP!=1c){G 1W=1a K.n3({1g:1g,cw:1c,1d:1m.xm(1r)});1m.3n(K.2q.uP,1W);PS=1W.cw}if(PS==1c){F.6Y=3O.hV("1rh");F.6Y.id=1m.2F().id+"1rf";F.6Y.N=1P;F.6Y.1A.1Z="oB";F.6Y.1A.gw=2;F.yk(1r);F.6Y.1A.NX="1px 175 #1rd";3O.aM.ae(F.6Y)}1k{F.6Y=PS}F.6Y.1ri=1n.4C(F,F.14J);1m.x7.PN(F.6Y);G 6S=F;h3(H(){6S.SD.5j(6S)},100);1m.3n(K.2q.Ky,1a K.n3({1g:1g,cw:F.6Y}))},SD:H(){if(F.6Y){F.6Y.IC()}},yk:H(1r){G 1d=F.1m.xm(1r);F.6Y.1A.3R=1d.x+"px";F.6Y.1A.3c=1d.y+"px";F.6Y.1A.1l=1d.1l+"px";F.6Y.1A.1o=1d.1o+"px"},qg:H(1Z){G 1m=F.1m;G 142=(F.6Y!=1c)&&1m.yo.3S(1Z);if(142){I 1x}I 1t},bQ:H(){G 1m=F.1m;1m.3n(K.2q.Fc,1a K.n3({1g:F.qo,cw:F.6Y}));G 8e=F.qo.t4();G 5W=F.6Y.N;F.6Y.1A.bK="wr";3O.aM.qz(F.6Y);F.6Y=1c;G hF=F.qo;F.qo=1c;G 6i=1c;G 1g=hF.vt();if(1g){6i=1m.1jM(hF.vt())}hF.yn(5W);if(1n.2D(K.3m,hF)){1m.3n(K.2q.Jz,hF.pN(8e,5W))}1k{if(1n.2D(K.4c,hF)){1m.3n(K.2q.Jr,hF.pN(8e,5W))}1k{if(1n.2D(K.x6,hF)){1m.3n(K.2q.KO,hF.pN(8e,5W))}1k{if(1n.2D(J.1e.6R.aT,hF)){1m.3n(K.2q.RU,hF.pN(8e,5W))}}}}if(6i){1m.1jv(6i)}1m.7w.4m=1c;1m.x7.PN(1m.zX())},9g:H(){G 1m=F.1m;1m.3n(K.2q.Fc,1a K.n3({1g:F.qo,cw:F.6Y}));F.6Y.1A.bK="wr";3O.aM.qz(F.6Y);F.6Y=1c;G hF=F.qo;F.qo=1c;1m.7w.4m=1c;1m.x7.PN(1m.zX())},14J:H(e){if(e.xJ==27){F.9g();F.1m.zX().IC()}},yd:H(O){},6y:H(1Z){},kU:H(){I 1x},Qi:H(){I 1x},12a:H(){I 1x}};J.2x(fN,"J.1e.fN")})(J.1e);(H(K){G 2J=J.6Z.2J;G 1I=J.1B.1I;G 2h=J.1B.2h;G 4u=J.1B.4u;G um=K.um=H(7d){1n.2T(um,F);F.7d=7d;F.6q=7d.2F();F.xz=7d.zX();F.i4=7d.sP;F.Yl=1n.4C(F,F.wN)};um.1s={uc:H(){1n.7I(F.xz,{14K:F.Yl})},PN:H(1u){if(1u!=F.xz){1n.j0(F.xz,"14K",F.Yl);F.xz=1u;F.uc()}},wN:H(e){F.i4.wN(F.xz.id,e.xJ,1c)}};J.2x(um,"J.1e.um")})(J.1e);(H(K){G 2J=J.6Z.2J;G 1I=J.1B.1I;G 2h=J.1B.2h;G 4u=J.1B.4u;G rJ=K.rJ=H(1m){1n.2T(rJ,F);F.1m=1m;F.11g={}};rJ.1s={wN:H(mT,xJ,14H,N){G 1m=F.1m;if(!1m.6c){I}G 4I=3O.iw(mT);if(4I==F.1m.zX()){if(xJ==46||xJ==127||(1r4.1r3.PG().7g("1rb")>-1&&xJ==8)){if(1m.7w.4m==1c){if(1m.qL==K.JB.14L){1m.Gd(1m.bT)}if(1m.qL==K.JB.YQ){1m.Uc()}}}}1k{if(14H){4I.N=N}}}};J.2x(rJ,"J.1e.rJ")})(J.1e);(H(K){G 2J=J.6Z.2J;G 1I=J.1B.1I;G 1L=J.1B.1L;G 2h=J.1B.2h;G 4u=J.1B.4u;G pF=K.pF=H(1m,1C,eF,9h){1n.2T(pF,F,[]);F.1m=1m;F.1C=1C;F.eF=eF;F.1r8=1a J.1B.6F(0,0);F.1r9=1a J.1B.1L(0,0);F.9h=9h};pF.1s={2I:H(1Z){1n.2o(pF,F,"2I",[1Z]);if(F.eF){F.3G=F.8Y=1Z.x}1k{F.3G=F.8Y=1Z.y}},6y:H(1Z){1n.2o(pF,F,"6y",[1Z]);if(F.eF){F.3G=1Z.x;G bW=F.9h.1l;G nO=1w.2n(2h.4T(F.1m.3z),F.9h.1l+(F.3G-F.8Y));F.fl(nO);if(!F.1m.10N(F.1C,F.eF)){F.fl(bW)}1k{F.cT=1t}if(bW!=F.9h.1l){F.8Y=F.3G}}1k{F.3G=1Z.y;G e6=F.9h.1o;G nr=1w.2n(2h.4T(F.1m.3z),F.9h.1o+(F.3G-F.8Y));F.fb(nr);if(!F.1m.10N(F.1C,F.eF)){F.fb(e6)}1k{F.cT=1t}if(e6!=F.9h.1o){F.8Y=F.3G}}F.1m.1S()},bQ:H(1Z){if(F.cT){F.1m.17k(F.1C,F.eF)}F.cT=1x},9g:H(1Z){},Yd:H(1C){G 2W=[];G 1j=1C.1j;if(1j.1j){1h(G i=0;i<1j.1j.3k.T;i++){G pp=1j.1j.3k[i];1h(G k=0;k<pp.3k.T;k++){2W.1f(pp.3k[k])}}}1k{1h(G i=0;i<1j.3k.T;i++){2W.1f(1j.3k[i])}}I 2W},fb:H(1o){if(F.1C.i3()){F.1C.fb(1o)}1k{G 3C=F.Yd(F.1C);1h(G i=0;i<3C.T;i++){3C[i].fb(1o)}}},fl:H(1l){if(F.1C.i3()){G 3C=F.Yd(F.1C);1h(G i=0;i<3C.T;i++){3C[i].fl(1l)}}1k{F.1C.fl(1l)}}};J.2x(pF,"J.1e.pF",K.eE)})(J.1e);(H(K){G 2J=J.6Z.2J;G 1I=J.1B.1I;G 1L=J.1B.1L;G 2h=J.1B.2h;G 4u=J.1B.4u;G nf=K.nf=H(1m){1n.2T(nf,F,[]);F.1m=1m};nf.1s={2I:H(1Z){1n.2o(nf,F,"2I",[1Z]);F.1m.1S()},6y:H(1Z){1n.2o(nf,F,"6y",[1Z]);F.1m.1S()},yd:H(O){F.1m.1hd(F.ck)}};J.2x(nf,"J.1e.nf",K.eE)})(J.1e);(H(K){G 2J=J.6Z.2J;G 1I=J.1B.1I;G 1L=J.1B.1L;G 2h=J.1B.2h;G 4u=J.1B.4u;G lW=K.lW=H(1m,9o){1n.2T(lW,F,[]);F.1m=1m;F.9o=9o};lW.1s={2I:H(1Z){1n.2o(lW,F,"2I",[1Z]);F.9o.bw(1Z)},6y:H(1Z){1n.2o(lW,F,"6y",[1Z]);F.9o.9Y(1Z);F.1m.1S()},bQ:H(1Z){if(!1Z.dI(F.eH)){F.6y(1Z)}F.9o.b4(1Z);1n.2o(lW,F,"bQ",[1Z])},9g:H(1Z){F.9o.9g()}};J.2x(lW,"J.1e.lW",K.eE)})(J.1e);(H(K){G 2J=J.6Z.2J;G 1I=J.1B.1I;G 1L=J.1B.1L;G 2h=J.1B.2h;G 4u=J.1B.4u;G m6=K.m6=H(1i,3f){1n.2T(m6,F,[1i,3f]);F.1i=1i};m6.1s={2I:H(1Z){F.hP=1a K.c6(F.1i);F.6b=F.hP.6b;1n.2o(m6,F,"2I",[1Z]);F.1i.cA(F)},6y:H(1Z){1n.2o(m6,F,"6y",[1Z]);F.1i.eW(F);F.hP.qj();F.eH=1Z.1T()},qg:H(1Z){G 1i=F.1i;I 1i.1j.KT(1i,F)&&1i.lJ(F)},bQ:H(1Z){if(!1Z.dI(F.eH)){F.6y(1Z)}G 1i=F.1i;1i.ja(F);1i.1j.Fl(1i,1Z,F.3f.1y);1n.2o(m6,F,"bQ",[1Z])}};J.2x(m6,"J.1e.m6",K.eE)})(J.1e);(H(K){G 2J=J.6Z.2J;G 1I=J.1B.1I;G 1L=J.1B.1L;G 2h=J.1B.2h;G 4u=J.1B.4u;G m7=K.m7=H(S,3f){1n.2T(m7,F,[S,3f]);F.S=S;F.12k=S.1d.1T()};m7.1s={2I:H(1Z){F.hP=1a K.c6(F.S);F.6b=F.hP.6b;1n.2o(m7,F,"2I",[1Z]);F.S.cA(F)},6y:H(1Z){1n.2o(m7,F,"6y",[1Z]);G S=F.S;G 3L=F.3f.1y;if(3L===9){G a=J.c7.LH(K.1M.9J(S.1d),1Z).a;S.ya(90-a*180/1w.PI,1x)}1k{S.eW(F)}F.hP.qj();F.eH=1Z.1T()},qg:H(1Z){G S=F.S;I S.1j.KT(S,F)&&S.lJ(F)},bQ:H(1Z){if(!1Z.dI(F.eH)){F.6y(1Z)}G S=F.S;S.ja(F);G 1m=S.1j;1m.Fl(S,1Z,F.3f.1y);1m.Cw(S,1Z);1n.2o(m7,F,"bQ",[1Z])}};J.2x(m7,"J.1e.m7",K.eE)})(J.1e);(H(K){G 2J=J.6Z.2J;G 1I=J.1B.1I;G 1L=J.1B.1L;G 2h=J.1B.2h;G 4u=J.1B.4u;G ma=K.ma=H(3h,3f){1n.2T(ma,F,[3h,3f]);F.3h=3h};ma.1s={2I:H(1Z){F.hP=1a K.c6(F.3h);F.hP.2A=F;F.6b=F.hP.6b;1n.2o(ma,F,"2I",[1Z]);F.3h.cA(F)},6y:H(1Z){1n.2o(ma,F,"6y",[1Z]);G 3L=F.3f.1y;if(3L===9){G S=F.3f.1g;G PB=F.6b.1V(S).3b;G a=J.c7.LH(K.1M.9J(S.1d),1Z).a;a=90-a*180/1w.PI;F.YA=a-PB}1k{F.3h.eW(F)}F.hP.qj();F.eH=1Z.1T()},qg:H(1Z){G 3h=F.3h;I 3h.1j.KT(3h,F)&&3h.lJ(F)},bQ:H(1Z){if(!1Z.dI(F.eH)){F.6y(1Z)}G 3h=F.3h;3h.ja(F);G 1m=3h.1j;1m.Fl(3h,1Z,F.3f.1y);1m.Cw(3h,1Z);1n.2o(ma,F,"bQ",[1Z])}};J.2x(ma,"J.1e.ma",K.eE)})(J.1e);(H(K){G 2J=J.6Z.2J;G 1I=J.1B.1I;G 1L=J.1B.1L;G 2h=J.1B.2h;G 4u=J.1B.4u;G uZ=K.uZ=H(7d){1n.2T(uZ,F);F.7d=7d;F.6q=7d.2F();F.i4=7d.7w};uZ.1s={uc:H(){G 6q=F.6q;1n.7I(6q,{Lh:1n.4C(F,F.bw)});1n.7I(6q,{sq:1n.4C(F,F.9Y)});1n.7I(6q,{wg:1n.4C(F,F.b4)})},bw:H(e){K.pY.1G=e;G 7d=F.7d;7d.H7=1x;if(K.m1.aR&&1a fo()-m1.aR<zF){I}if(!7d.6c){I}7d.162(e);G 6q=F.6q;if(6q.LK){6q.LK()}G 1Z=K.1M.gk(e,6q);F.i4.bw(1Z,e.5S)},9Y:H(e){K.pY.1G=e;G 7d=F.7d;if(!7d.6c){I}7d.16X();G 1Z=K.1M.gk(e,F.6q);F.i4.9Y(1Z)},b4:H(e){K.pY.1G=e;G 7d=F.7d;7d.H7=1x;7d.xb();if(K.m1.aR&&1a fo()-m1.aR<zF){I}if(!7d.6c){I}G 1Z=K.1M.gk(e,F.6q);F.i4.b4(1Z,e.5S);if(3O.KF){3O.KF()}}};J.2x(uZ,"J.1e.uZ")})(J.1e);(H(K){G 2J=J.6Z.2J;G 1I=J.1B.1I;G 2h=J.1B.2h;G 4u=J.1B.4u;G 14D=0;G 14B=2;G vv=-1;G qD=K.qD=H(1m){1n.2T(qD,F);F.1m=1m;F.dW=vv;F.11g={}};qD.1s={bw:H(1Z,5S){G 1m=F.1m;G af=1m.co(1Z);F.aD=1m.aD=af;G mm=2h.4T(1m.3z);if(F.dW==vv){G 14C=1a fo();G dc=F.12m;if(dc&&14C-dc.eD<zF&&dc.5S==5S&&K.1M.17q(af,dc.1Z)<mm){F.14M(dc.1Z,5S);F.12m=1c;I}F.dW=5S;F.E2=af;F.15m=F.15l();F.12m={1Z:af,5S:5S,eD:1a fo()}}},9Y:H(1Z){G 4m=F.4m;G 1m=F.1m;G mm=2h.4T(1m.3z);G af=1m.co(1Z);F.aD=1m.aD=af;F.ta=1c;if((1m.hl&K.tK.lL)!=0){1m.14a(1m.qT(af,1t,1t))}if(F.dW!=vv){if(4m==1c&&af.5y(F.E2)>=mm){4m=F.4m=F.148();if(4m){4m.2I(F.E2)}}}1k{1m.16U(af)}if(4m){if(1m.q8&&4m.Qi()){1m.10w(af)}4m.6y(af);if(4m.12a()){1m.2F().1A.7y=4m.qg(af)?1m.9f.bH:2J.1rt}if(4m.kU()){4m.9g(af);F.4m=1c;F.dW=vv}}},b4:H(1Z,5S){G 1m=F.1m;G mm=2h.4T(1m.3z);G af=1m.co(1Z);if(F.4m){if(F.dW==5S&&F.4m.qg(af)){F.4m.bQ(af);F.4m=1c}1k{if(!1n.2D(K.fN,F.4m)){F.4m.9g(af);F.4m=1c}}}1k{G Da=F.E2;if(!Da){Da=af}if(af.5y(Da)<mm){1m.mD(Da,5S)}}F.dW=vv},14M:H(1Z,5S){G 1m=F.1m;G af=1m.co(1Z);G yl=1m.pK(1Z,1t,1t);if(yl==1c){if(1m.I9()&&1m.l3.VC()){G jc={};G 2G=1m.l3.1eu(1Z,jc);if(2G!=1c){2G.yk(jc.jc);2G.1dM(jc.2r,jc.1J);F.4m=1a K.fN(2G);F.4m.2I(1Z)}}}1k{1m.EM(yl,1Z,5S);if(1m.pJ&&!yl.gU()&&yl.mI(af)==1c){F.4m=1a K.fN(yl);F.4m.2I(1Z)}}},148:H(){G 2A=F.11g;2A.dW=F.dW;2A.aD=F.E2;2A.ta=F.15m;2A.1rq=2A.ta?2A.ta.7F(2A.aD):1c;I F.1m.9f.g4(2A)},15l:H(){if(F.ta){I F.ta}F.ta=F.1m.pK(F.aD,1t,1t);I F.ta}};J.2x(qD,"J.1e.qD")})(J.1e);(H(K){G 2J=J.6Z.2J;G 1I=J.1B.1I;G 1L=J.1B.1L;G 2h=J.1B.2h;G 4u=J.1B.4u;G n9=K.n9=H(1m){1n.2T(n9,F,[]);F.1m=1m};n9.1s={2I:H(1Z){1n.2o(n9,F,"2I",[1Z]);F.11P=F.1m.Tm();F.11h=F.1m.gj(1Z);F.157=1x},6y:H(1Z){1n.2o(n9,F,"6y",[1Z]);G l4=F.1m.gj(1Z);G sx=F.11P.x-F.1m.15D(l4.x-F.11h.x);G sy=F.11P.y-F.1m.15D(l4.y-F.11h.y);G 9w=F.1m.lR();F.1m.CP(sx,sy,9w);F.157=1t},Qi:H(){I 1x}};J.2x(n9,"J.1e.n9",K.eE)})(J.1e);(H(K){G 2J=J.6Z.2J;G 1I=J.1B.1I;G 2h=J.1B.2h;G 4u=J.1B.4u;G tf=K.tf=H(1m,Ik){1n.2T(tf,F,[1m]);F.4e=[];F.mQ=Ik;F.mJ=1c};tf.1s={wN:H(mT,sS){1n.2o(tf,F,"wN",[mT,sS,1c]);F.xq("wN",mT,sS)},xq:H(9v,mT,sS){F.ww=1a fo().BL();G eD=(F.ww-F.mQ);G 4I=3O.iw(mT);F.4e.1f({9v:9v,eD:eD,mT:mT,sS:sS,N:4I.N});if(F.t0){mB(F.t0);F.t0=1c}}};J.2x(tf,"J.1e.tf",K.rJ)})(J.1e);(H(K){G 2J=J.6Z.2J;G 1I=J.1B.1I;G 2h=J.1B.2h;G 4u=J.1B.4u;G m3=K.m3=H(1m,Ik){1n.2T(m3,F,[1m]);F.4e=[];F.mQ=Ik;F.mJ=1c};m3.1s={bw:H(1Z,5S){1n.2o(m3,F,"bw",[1Z,5S]);F.xq("bw",1Z,5S)},9Y:H(1Z){1n.2o(m3,F,"9Y",[1Z]);if(!F.t0){G 6S=F;F.t0=h3(H(){6S.xq("9Y",1Z)},20)}},b4:H(1Z,5S){1n.2o(m3,F,"b4",[1Z,5S]);F.xq("b4",1Z,5S)},xq:H(9v,1Z,5S){F.ww=1a fo().BL();G eD=(F.ww-F.mQ);F.4e.1f({9v:9v,eD:eD,1Z:1Z,5S:5S});if(F.t0){mB(F.t0);F.t0=1c}}};J.2x(m3,"J.1e.m3",K.qD)})(J.1e);(H(K){G 2J=J.6Z.2J;G 1I=J.1B.1I;G 1L=J.1B.1L;G 2h=J.1B.2h;G 4u=J.1B.4u;G uv=K.uv=H(7d){1n.2T(uv,F);F.7d=7d;F.6q=7d.2F();F.i4=7d.7w};uv.1s={uc:H(){G 6q=F.6q;6q.7V("1cd",1n.4C(F,F.Hi),1x);6q.7V("1cg",1n.4C(F,F.Ht),1x);6q.7V("1cj",1n.4C(F,F.zd),1x);6q.7V("1ci",1n.4C(F,F.zd),1x)},zf:H(e){G cR=e.cR;G 15A={5S:0,Ho:cR[0].Ho,Hh:cR[0].Hh,qy:H(){}};I 15A},Hi:H(e){G 1m=F.7d;1m.pB=2.5*2h.4T(1m.3z);G i5=1m.i5;G 4m=F.i4.4m;G cR=e.cR;if(1m.py&&!4m){K.m1.aR=1c;F.aR=F.zf(e);i5.bw(F.aR);K.m1.aR=1a fo()}1k{if(1m.py&&4m&&cR.T>1){4m.9g();F.i4.4m=1c}}},Ht:H(e){G 1m=F.7d;G i5=1m.i5;G cR=e.cR;if(1m.py&&cR.T==1){F.aR=F.zf(e);i5.9Y(F.aR);e.qy()}},zd:H(e){G 1m=F.7d;G i5=1m.i5;if(1m.py){K.m1.aR=1c;i5.b4(F.aR);K.m1.aR=1a fo()}1m.pB=0}};J.2x(uv,"J.1e.uv")})(J.1e);(H(K){G aw=J.1e.aw;G 9R=J.1e.9R;G 8a=K.8a=H(1b,jm){F.1b=(1b)?1b:[];F.15F=-1;if(jm!=1F){F.11R(jm)}F.11S=1x};8a.1s={3q:H(){G 1q={id:F.jm};if(!1q.id||1q.id==""||!F.11S){1q.1b=F.15z()}I 1q},15z:H(){G 2W=[];G 8S=0;1h(G i=0,l=F.1b.T;i<l;i++){G 1p=F.1b[i];1p.8S=8S++;G 1q=1p.3q();2W.1f(1q)}I 2W},3D:H(1q){G 1b=[];1h(G i=0;i<1q.1b.T;i++){if(1q.1b[i]){G 1p=1a aw();1p.3D(1q.1b[i]);F.1b.1f(1p)}}},11R:H(id){if(8a.wW.2O(id)){7r 1a 1rm("p7 8a av 1re 1rg be 1rK.")}F.jm=id;8a.wW.2X(F.jm,F)},1se:H(eG,S,dv){if(F.1b==1c){I 1x}1h(i=0;i<F.1b.T;++i){G pt=F.1b[i];if(eG){if(pt.jg()&&S.13x(1c,1t,i,dv)){I 1t}}1k{if(pt.jh()&&S.13x(1c,1x,i,dv)){I 1t}}}I 1x},1sd:H(id){if(F.jm!=""){I}if(8a.wW.2O(id)){I}F.11R(id)},5j:H(hB){F.1b=[];1h(G i=0;i<hB.1b.T;i++){G 1p=hB.1b[i];F.1b.4K(1p.1T())}},1sh:H(){I F.15F},Gk:H(N){F.1b=N},uV:H(){I F.1b},NP:H(){I F.jm},1s7:H(){if(8a.wW.2O(F.jm)){I 1t}I 1x}};8a.wW=1a J.3X.3o();8a.1sb=1a 8a([1a aw(50,0,1t,1x,9R.hx,"bA"),1a aw(0,50,1t,1x,9R.hx,"bA"),1a aw(50,100,1x,1t,9R.az,"dT"),1a aw(100,50,1x,1t,9R.az,"cU")],"1sp");8a.1so=1a 8a([1a aw(50,0,1t,1x,9R.hx,"bA"),1a aw(0,50,1x,1t,9R.az,"cU"),1a aw(50,100,1x,1t,9R.az,"dT"),1a aw(100,50,1x,1t,9R.az,"cU")],"1sq");8a.1ss=1a 8a([1a aw(0,50,1t,1x,9R.hx,"bA"),1a aw(100,50,1x,1t,9R.az,"bA")],"1sn");8a.1sj=1a 8a([1a aw(50,0,1t,1x,9R.hx,"bA"),1a aw(50,100,1x,1t,9R.az,"dT")],"1si");8a.2e=H(id){if(8a.wW.2O(id)){I 8a.wW.1V(id)}};J.2x(8a,"J.1e.8a")})(J.1e);(H(K){G 2h=J.1B.2h;G 2J=J.6Z.2J;G gJ=K.gJ=H(1j){1n.2T(gJ,F);F.1m=1j;F.bH=2J.lD};gJ.1s={g4:H(1G){G 1m=F.1m;G 1p=1G.aD;G 114=1x;G sU=1m.mI(1p);if(sU!=1c){if(sU.xr(1p)){I 1a K.lW(1m,sU)}sU.mD(1p);I 1c}G 15v=1m.6c&&(1m.qi==K.97.pd||1m.u2(1G.dW,K.jn.pd)||(1G.dW==0&&1m.BO.Fx(K.qU.pd,K.pY.1G)));if(15v){I 1a K.n9(1m)}G 15q=1m.6c&&(1m.u2(1G.dW,K.jn.DR)||(1G.dW==0&&1m.BO.Fx(K.qU.DR,K.pY.1G)));if(15q){I 1a K.nf(1m)}if(1G.dW==0&&1m.I9()&&1m.Ha().jy){G 4e=1m.11s(1p);if(4e){I 1a K.pF(1m,4e.1C,4e.eF,4e.9h)}}if(!1m.u2(1G.dW,K.jn.Yo)){if(!1m.u2(1G.dW,K.jn.tT)){I 1c}114=1t}if((1G.dW==0&&1m.BO.Fx(K.qU.tT,K.pY.1G))||114){G 9a=1a K.hY(1m.3h);I 9a}G 1g=1c;if(1m.3h.2u.T>1){G 3f=1m.3h.7F(1p);if(3f&&!1n.2D(K.pD,3f)){1g=1m.3h;G 9a=1a K.ma(1m.3h,3f);I 9a}}G 3f=1m.vC(1p);1g=1m.bT;if(1g&&3f==1c){3f=1g.7F(1p)}if(3f){G 1g=3f.1g;if(1g==1m.ff){1m.3h.xY();1m.3h.9u(1g);1m.Dy(1c)}G 9a=1n.2D(K.3m,1g)?1a K.m7(1g,3f):1a K.m6(1g,3f);I 9a}I 1c},Ln:H(1O,1p){G 1i=1a K.4c(F.1m,1O,1p);1i.3A.F7(1p);I 1i},yQ:H(1p,3f){G 3L=3f.1y;G S=1n.2D(K.3m,3f.1g)?3f.1g:1c;if(S==1c||3L==8||1n.2D(K.pD,3f)){I F.h0(2J.lD)}if(3L==9){I F.h0(2J.iN)}if(S.em()!=0){G a=0,r=0;G d=f5/16;G Iy=J.c7.LH(S.9J(),1p);Iy.a=J.c7.1rQ(Iy.a);a=7e((f5-Iy.a)%f5);if(a>=1*d&&a<3*d){F.bH=2J.qH}1k{if(a>=3*d&&a<5*d){F.bH=2J.mz}1k{if(a>=5*d&&a<7*d){F.bH=2J.rM}1k{if(a>=7*d&&a<9*d){F.bH=2J.mt}1k{if(a>=9*d&&a<11*d){F.bH=2J.qH}1k{if(a>=11*d&&a<13*d){F.bH=2J.mz}1k{if(a>=13*d&&a<15*d){F.bH=2J.rM}1k{F.bH=2J.mt}}}}}}}}1k{if(3L==0||3L==2){F.bH=2J.qH}if(3L==1||3L==3){F.bH=2J.rM}if(3L==4||3L==6){F.bH=2J.mz}if(3L==5||3L==7){F.bH=2J.mt}}I F.bH},1ce:H(3L){if(3L==0||3L==2){I 2J.qH}if(3L==1||3L==3){I 2J.rM}if(3L==4||3L==6){I 2J.mz}if(3L==5||3L==7){I 2J.mt}I 1c},iH:H(1p,vE){},h0:H(N){F.bH=N;I N}};J.2x(gJ,"J.1e.gJ")})(J.1e);(H(K){G 1I=J.1B.1I;G x6=K.x6=H(6z,rF){F.6z=6z;F.2G=rF.2G;F.1r=rF.aE;F.2r=rF.2r;F.1J=rF.1J};x6.1s={t4:H(){I F.2G.8V()},nu:H(1p){if(F.6z.3b==0){I F.1r}1k{I K.1M.k0(F.1r.1T(),F.6z.3a().2N(),F.6z.3b)}},pN:H(8e,5W){I 1a K.nD({S:F.6z,2G:F.2G,8e:8e,5W:5W,2r:F.2r,1J:F.1J})},yn:H(5W){F.2G.aJ(5W)},vt:H(){I F.6z}};J.2x(x6,"J.1e.x6")})(J.1e);(H(K){G 2J=J.6Z.2J;G iR=J.1e.iR;G 2h=J.1B.2h;G vD=K.vD=H(S,qQ){1n.2T(vD,F,[S]);F.qQ=qQ;F.2r=F.S.9z(F.qQ);F.14s=F.2r.1l;F.CT=F.2r.ha==iR.Av};vD.1s={aY:H(2p){I 1x},xr:H(2p){I 1t},iH:H(2p){if(F.S.em()!=0){G a=F.S.em();if(a>=-180&&a<-135){I 2J.qH}1k{if(a>=-135&&a<-90){I 2J.mz}1k{if(a>=-90&&a<-45){I 2J.rM}1k{if(a>=-45&&a<0){I 2J.mt}1k{if(a>=0&&a<45){I 2J.qH}1k{if(a>=45&&a<90){I 2J.mz}1k{if(a>=90&&a<135){I 2J.rM}1k{I 2J.mt}}}}}}}}I 2J.mt},dB:H(1p){if(F.S.em()!=0){I K.1M.bO(1p,F.S.1d.2N(),-F.S.em())}I 1p.1T()},bw:H(2p){F.iy=1t;G dB=F.dB(2p);F.3G=F.8Y=dB.x},9Y:H(2p){if(!F.iy){I}G dB=F.dB(2p);F.3G=dB.x;G 1m=F.S.4Y();if(!F.cT){if(1w.4L(F.3G-F.8Y)>=2h.4T(1m.3z)*2){F.cT=1t;if(1m.g2()){F.zR=1a K.tN(1m,F.S,F.2r)}}}if(F.cT){if(F.2r.ha==iR.Av){F.S.Fy(F.2r,iR.QR)}G bW=F.2r.1l;F.S.AD(F.2r,1w.2n(2h.4T(1m.3z),F.2r.1l+(F.3G-F.8Y)));G au={N:1F};if(!1m.17m(F.S,F.qQ,2p,0,au)){F.S.AD(F.2r,bW)}if(au.N){F.9g()}if(bW!=F.2r.1l){F.8Y=F.3G}}},b4:H(2p){if(F.cT){G 1m=F.S.4Y();if(1m.g2()){1m.5A.f4(F.zR)}1m.17j(F.S,F.qQ,2p,0)}F.iy=1x;F.cT=1x},9g:H(){if(F.cT){F.iy=1x;F.cT=1x;F.S.AD(F.2r,F.14s);if(F.CT){F.2r.Fy(iR.Av)}F.zR=1c}}};J.2x(vD,"J.1e.vD",K.ie)})(J.1e);(H(K){G h9=K.h9=H(1m){F.1m=1m};h9.1s={l6:H(){},fR:H(){},fL:H(){}};J.2x(h9,"J.1e.h9")})(J.1e);(H(K){G 10q=J.1B.10q;G eZ=K.eZ=H(1j){1n.2T(eZ,F,[1j]);F.3H=1a K.qu()};eZ.YZ=H(GS,6P,aL){G Ym=GS;G ns=6V;G Dl=GS.cF(".");if(Dl.T>1){Ym=Dl[Dl.T-1];ns=1s4(Dl.9D(0,-1).1rY("."))}G sK=ns[Ym]=H(1j){1n.2T(sK,F,[1j]);F.15o(6P);if(aL){aL.5j(F,[1j])}};sK.1s={};J.2x(sK,GS,eZ);I sK};eZ.1s={1T:H(){K.4n.9L=1t;G 1K=1n.2o(eZ,F,"1T",[]);G aW=F.iJ;if(aW){1h(9C in aW){if(9C.c8(0,3)!="1V"){2V}G h8=aW[9C];G nI=aW["2X"+9C.c8(3)];nI.oI(1K,h8.oI(F))}}K.4n.9L=1x;I 1K},Ez:H(av){I av.16m(0).PG()+av.9D(1)},3q:H(){G 1q=1n.2o(eZ,F,"3q",[]);G aW=F.iJ;if(aW){1h(9C in aW){if(9C.c8(0,3)!="1V"){2V}G h8=aW[9C];G u1=F.Ez(9C.c8(3));1q[u1]=h8.oI(F)}}I 1q},3D:H(1q){1n.2o(eZ,F,"3D",[1q]);G aW=F.iJ;if(aW){1h(9C in aW){if(9C.c8(0,3)!="2X"){2V}G nI=aW[9C];G u1=F.Ez(9C.c8(3));nI.oI(F,1q[u1])}}},dQ:H(){G 1G=1n.2o(eZ,F,"dQ",[]);G aW=F.iJ;if(aW){1h(9C in aW){if(9C.c8(0,3)!="1V"){2V}G h8=aW[9C];G u1=F.Ez(9C.c8(3));1G[u1]=h8.oI(F)}}I 1G},ee:H(1G){1n.2o(eZ,F,"ee",[1G]);G aW=F.iJ;if(aW){1h(9C in aW){if(9C.c8(0,3)!="2X"){2V}G nI=aW[9C];G u1=F.Ez(9C.c8(3));nI.oI(F,1G[u1])}}},15o:H(6P){G zZ=1a K.zm(F.1S.zW(F));G 15d=zZ.Y1(6P);F.3H=15d;F.E5=zZ.ZY;F.iJ=zZ.iJ;G 1s=F.7i.1s;1h(9C in zZ.iJ){if(!1s[9C]){1s[9C]=zZ.iJ[9C]}}},1j8:H(5n){I F.E5[5n]},kr:H(){G 1r=F.1d;F.6e.2w=[F.3H];10q.O=F.1j;F.3H.il(1r.1l,1r.1o);F.3H.a4(1r.x,1r.y,1r.1l,1r.1o)},xB:H(1p){G 3l=F.3H.aY(1p);if(1n.2D(J.1B.8n,3l)){I 1a K.zS(F,3l)}I F},13H:H(3l){G 1d=3l.3a().1T();3v(3l.1j!=1c){3l=3l.1j;1d.x+=3l.x;1d.y+=3l.y}I 1d}};J.2x(eZ,"J.1e.eZ",K.3m);G zS=K.zS=H(S,3l){F.S=S;F.3l=3l};zS.1s={t4:H(){I F.3l.8V()},nu:H(1p){I F.S.13H(F.3l)},pN:H(8e,5W){I 1a K.uA({S:F.S,3l:F.3l,8e:8e,5W:5W})},yn:H(5W){F.3l.aJ(5W)},vt:H(){I F.S}};J.2x(zS,"J.1e.zS")})(J.1e);(H(K){G 1L=J.1B.1L;G rz=K.rz=H(S,1i,4X){F.S=S;F.1i=1i;F.4X=4X;F.4Z={1y:-1,1p:1a J.1B.1L(0,0)};F.2R=F.7i.ek};rz.1s={kR:H(){if(F.4X){F.S.QB(F.1i)}1k{F.S.Rq(F.1i)}},kW:H(){if(F.4X){F.S.Rm(F.1i)}1k{F.S.Rk(F.1i)}},1jr:H(JH){G S=JH.S;I(S!=1c&&S===F.S)},fO:H(Lm){if(Lm===1F){Lm=1t}G 1p=F.4X?F.1i.fB():F.1i.jt();G 4J=F.S.3b;if(4J!==0){G 7p=K.1M.9J(F.S.1d);1p=K.1M.bO(1p,7p,-4J)}if(Lm){G 2K=K.3B.oJ(F.S);if(2K){G nc=2K.3a();F.gm=K.1M.AI(1p,nc);I}}F.gm=K.1M.AI(1p,F.S.1d)},F7:H(1p){F.4Z=F.13Y(1p);if(!F.4Z){F.4Z=F.m5(1p)}},13Y:H(1p){if(!F.S.5i){I 1c}G s0=F.S.kd(1p,F.1i,F.4X);if(s0.1y===-1){I 1c}I s0},m5:H(1p){G Zb=F.S.m5(1p);G 13q=K.1M.AI(Zb,F.S.1d);I{1p:Zb,8u:13q,1y:-1}},Ft:H(1p){F.4Z=F.kd(1p,F.1i,F.4X)},Nx:H(1g,1p){I(F.S!==1g)},mf:H(){I F.S.9J()},vL:H(JH){I K.3m.vL(F.S,JH.S)},ez:H(6Q,7Y){I F.S.ez(6Q,7Y)},1pE:H(){I F.S.1d},Ed:H(){G 2K=K.3B.oJ(F.S);if(2K){G 8u=K.1M.uK(F.gm,2K.3a());I 8u}I F.fB()},fB:H(){G 1p=K.1M.uK(F.gm,F.S.1d);G 4J=F.S.3b;if(4J!==0){G 7p=K.1M.9J(F.S.1d);1p=K.1M.bO(1p,7p,4J)}I 1p},1pD:H(1p){I F.S.3S(1p)},gY:H(){I F.2R},kd:H(1p,1i,4X){I F.S.kd(1p,1i,4X)},1T:H(1i,S){G 1K=S.BJ(1i,1a 1L(),F.4X);if(!1n.2D(K.bS,S)&&S.5i&&S.5i.1b.T>F.4Z.1y){1K.4Z.1y=F.4Z.1y}1K.gm=F.gm;I 1K}};J.2x(rz,"J.1e.rz");G ts=K.ts=H(1i,4X,1p){1n.2T(ts,F,[1c,1i,4X]);F.1p=1p;F.S=F.1i.E9()};ts.1s={mf:H(){I F.1p},kd:H(1p,1i,4X){I{1y:0,1p:F.1p,8u:F.1p}},m5:H(1p){I{1y:0,1p:1p,8u:1p}}};J.2x(ts,"J.1e.ts",rz)})(J.1e);(H(K){G 1E=J.3X.1E;G 8C=J.1B.8C;G 3o=J.3X.3o;G 2h=J.1B.2h;G 1I=J.1B.1I;G 9M=J.1e.9M;G 3U=J.1B.3U;G 3B=K.3B=H(1j){K.4n.9L=1t;1n.2T(3B,F,[1j]);F.4t=6;F.1P.qe=1t;F.2C=[];F.4E=3;F.cS=1t;F.cf=1t;F.8b=[];F.jz=1t;3B.rm=1t;F.6e.1pS=1n.EJ(F.18H,F);K.4n.9L=1x};3B.1s={1T:H(){K.4n.9L=1t;G 1K=1n.2o(3B,F,"1T",[]);1K.4t=F.4t;1K.6N=F.6N;1K.2g=F.2g;1K.cS=F.cS;1K.cf=F.cf;1K.4E=F.4E;1K.dF=F.dF;1K.GK(F.yU());1K.AY(F.rW());1K.b8=F.b8;1K.2g=F.2g;K.4n.9L=1x;I 1K},3q:H(){G 1q=1n.2o(3B,F,"3q",[]);1q.4t=F.4t;1q.6N=F.6N;1q.cS=F.cS;1q.cf=F.cf;1q.4E=F.4E;1q.jz=F.jz;1q.dF=F.dF;1q.yW=F.yU();1q.aS=F.rW();1q.b8=F.b8;1q.2g=F.2g;I 1q},3D:H(1q){1n.2o(3B,F,"3D",[1q]);F.4t=1q.4t;F.6N=1q.6N;F.cS=1q.cS;F.cf=1q.cf;F.4E=1q.4E;if(1q.jz!=1F){F.jz=1q.jz}if(1q.dF!=1F){F.dF=1q.dF}F.GK(1q.yW);F.AY(1q.aS);if(1q.aS){F.4G(1a 1I(1q.1d.x,1q.1d.y,1q.1d.1l,1q.1d.1o))}if(1q.b8){F.b8=J.1B.6F.1K(1q.b8)}if(1q.2g){F.7N(1q.2g)}},5g:H(1v,O){1n.2o(3B,F,"5g",[1v,O]);if(F.8V()==""){F.aJ(O.a7("1aX",1v))}F.4t=O.5k("NU",1v);F.6N=O.9r("NV",1v);G rf=O.vo("1b0",1v);if(rf){F.b7(rf.dh);F.bq(rf.4i)}1k{F.b7(O.3Q("tA",1v));F.bq(O.3Q("tv",1v))}F.4E=O.5k("KJ",1v);F.dF=O.5k("18B",1v,1c);F.aS=O.4v("18z",1v);F.GK(O.4v("18o",1v));F.b8=O.1gK("18u",1v);F.2g=O.3Q("1Q",1v,K.jZ.az);F.cS=O.4v("18Q",1v,1t);F.cf=O.4v("18F",1v,1t);F.jz=O.4v("18K",1v,1t)},5u:H(1v,O){1n.2o(3B,F,"5u",[1v,O]);O.5w(F.4t,"NU",1v);O.9k(F.6N,"NV",1v);O.4r(F.ec(),"tA",1v);O.4r(F.ft(),"tv",1v);O.5w(F.4E,"KJ",1v);if(F.dF){O.5w(F.dF,"18B",1v)}O.4o(F.aS,"18z",1v);O.4o(F.yU(),"18o",1v);if(F.b8){O.1gL(F.b8,"18u",1v)}O.4r(F.qR(),"1Q",1v);O.4o(F.cS,"18Q",1v);O.4o(F.cf,"18F",1v);O.4o(F.jz,"18K",1v)},4K:H(S){if(S.ut&&S.ut(F)){I}G 3r=S.I3();if(3r){if(3r==F){I}3r.ZG(S)}3r=F.I3();if(3r==S){I}if(S.2K){if(S.2K==F){I}S.2K.54(S)}F.2C.1f(S);S.2K=F;F.6I()},54:H(S,3n){if(1E.54(F.2C,S)){F.6I();5M S.2K;if(3n){F.19p(S)}if(F.1j){F.1j.G8()}}},18H:H(O,184,17R,S){if(S.aS){I}O.cM();G kk=S.jz?S.17X():1c;if(kk){kk.sH(O,1x);O.kk()}1h(G i=0,l=S.8b.T;i<l;i++){G 2c=S.8b[i];if(2c.jj()&&!2c.fA()){2c.6e.lQ(O,184,17R)}}O.cH()},aY:H(1p,yD,w7,ve){if(F.1j!=1c&&!F.1j.wb(F)){I 1c}if(!F.aS){1h(G i=F.8b.T-1;i>=0;i--){G 1g=F.8b[i];if(w7&&1n.2D(K.4c,1g)){2V}G Z5=1g.aY(1p,yD,w7,ve);if(Z5!=1c){I Z5}}}I 1n.2o(3B,F,"aY",[1p,yD,w7,ve])},17X:H(){G 1r=F.1d.1T();1r.y+=F.4t;1r.1o-=F.4t;G BZ=1a 3U();if(1r.1l>0&&1r.1o>0){BZ.nU(1r.x,1r.y,1r.1l,1r.1o);G 3b=F.em();if(3b!=0){G 2N=F.9J();G 3g=1a J.1B.9T();3g.nP(3b,2N.x,2N.y);BZ.5c=3g}}1k{BZ.nU(F.1d.x,F.1d.y,0,0)}I BZ},1qY:H(){I F.jz},1r0:H(N){if(F.jz!==N){F.jz=N;F.6I()}},Zk:H(){I F.2C},Zi:H(1g){F.8b.1f(1g);1g.Rb(1x)},15W:H(){F.8b=[];F.18m();F.8b.8F(F.18i)},18i:H(a,b){I a.Ze()-b.Ze()},18m:H(){G 2u=F.2C;1h(G i=0,l=2u.T;i<l;i++){F.Zi(2u[i])}G 1X=1a 3o();F.IA(1X);1X.1U(H(1i){if(1X.1V(1i)==3){F.Zi(1i)}},F)},IA:H(1X){G 2u=F.2C;1h(G i=0,l=2u.T;i<l;i++){G S=2u[i];G eG=[];S.mE(eG);1h(G k=0;k<eG.T;k++){G 4x=0;if(1X.2O(eG[k])){4x=1X.1V(eG[k])}1X.2X(eG[k],4x+1)}G 4X=[];S.mO(4X);1h(G k=0;k<4X.T;k++){G 4x=0;if(1X.2O(4X[k])){4x=1X.1V(4X[k])}1X.2X(4X[k],4x+1)}if(1n.2D(3B,S)){G qB=1a 3o();S.IA(qB);qB.1U(H(1i){if(1X.2O(1i)){1X.2X(1i,1X.1V(1i)+qB.1V(1i))}1k{1X.2X(1i,qB.1V(1i))}})}}1X.1U(H(1i){if(1X.1V(1i)>=2){1X.2X(1i,1X.1V(1i)+1)}})},vH:H(1r,e9,ev,eB){if(F.aS||!F.1j.wb(F)){I}G rL=K.1M.Ce(1r);if(eB){1h(G i=0,l=F.8b.T;i<l;i++){G 1g=F.8b[i];if(!1g.gU()&&1g.je(1r)){e9.1f(1g);if(!ev){I}if(1n.2D(3B,1g)){if(1g.je(1r)){1g.vH(1r,e9,ev,eB)}}}}}1k{1h(G i=0,l=F.8b.T;i<l;i++){G 1g=F.8b[i];G rX=1g.8m();if(!1g.gU()&&rL.2O(rX)){e9.1f(1g);if(!ev){I}if(1n.2D(3B,1g)){if(1g.je(1r)){1g.vH(1r,e9,ev,eB)}}}}}},AG:H(1r,e9,ev,eB){if(F.aS||!F.1j.wb(F)){I}G 4x=0;G rL=K.1M.Ce(1r);if(eB){1h(G i=0,l=F.8b.T;i<l;i++){G 1g=F.8b[i];if(!1g.gU()&&1g.je(1r)){4x+=1;if(1n.2D(3B,1g)){if(1g.je(1r)){4x+=1g.AG(1r,e9,ev,eB)}}}}}1k{1h(G i=0,l=F.8b.T;i<l;i++){G 1g=F.8b[i];G rX=1g.8m();if(!1g.gU()&&rL.2O(rX)){4x+=1;if(1n.2D(3B,1g)){if(1g.je(1r)){4x+=1g.AG(1r,e9,ev,eB)}}}}}},3S:H(1p){G 1d=F.8m();if(!1d.3S(1p)){I 1x}if(K.1M.ML(1p,F.9W())){I 1t}if(F.aO&&F.7F(1p)){I 1t}I 1x},9W:H(){if(F.6e.pG){F.kr();F.6e.pG=1c}G p=[];p.1f(F.1d.5H());p.1f(F.1d.hc());p.1f(F.1d.bc());p.1f(F.1d.hi());K.1M.k7(p,K.1M.9J(F.1d),F.3b);I p},kr:H(){G 2w=F.6e.2w=[];G 3E=F.hk();G 9i=F.fi();G 6X=F.iA();G 1N=F.rd();G 1D={1N:1N,nT:9M.Bk};F.pC(2w,1D);if(1D.1N){1N=1D.1N}F.6e.3b=F.3b;F.6e.7p=F.1d.2N();G 1r=F.1d.1T();G 9t=1r;if(F.2g==K.jZ.wG){G mm=2h.4T(F.1j.3z);G bf=mm*2.5;9t=1a 3U();9t.1aT(1r,bf)}G nj=9t.1T();nj.2y=1c;nj.1N=1N;nj.9S=F.n7();2w.1f(nj);if(F.6N){G kV=1r.1T();kV.1o=F.4t;kV.1N=F.6N;kV.2y=1c;if(F.2g==K.jZ.wG){G rY=1a J.1B.l0();rY.kk=9t;rY.2w.1f(kV);2w.1f(rY)}1k{2w.1f(kV)}}F.pC(2w,{nT:9M.Br});if(F.4t>0&&F.4t<1r.1o){G y=1r.y+F.4t;G 8z=1a 8C(1r.x,y,1r.2Z(),y);8z.9e(3E);8z.3p=9i;8z.4V=6X;if(F.2g==K.jZ.wG&&(y<bf||y>1r.1o-bf)){8z.Cg=9t}2w.1f(8z)}1r=1r.1T();1r.1o=F.4t;if(F.eK){1r.1l-=F.4t}F.1P.4G(1r,0);F.1P.2m=F.hH();F.1P.2y=F.gu();F.1P.3E=F.qN();F.1P.3p=F.u8();F.1P.Ba=F.3b!=0;2w.1f(F.1P);9t.2y=3E;9t.3p=9i;9t.4V=6X;9t.1N=1c;2w.1f(9t);F.D6(2w);if(F.mq){F.mq(F)}},7N:H(N){if(F.2g!=N){F.2g=N;F.1S()}},qR:H(){if(F.2g===1F){I K.jZ.az}I F.2g},nu:H(1p){G 1r=F.1d.1T();1r.1o=F.4t;if(F.3b==0){I 1r}1k{G 3g=F.k0(F.1d.1T());I 3g.WY(1r)}},1aV:H(N){if(F.4t!==N){F.4t=N;F.1S()}},jb:H(){I F.4t},1g3:H(N){if(F.6N!==N){F.6N=N;F.1S()}},1g2:H(){I F.6N},19D:H(2u){G Km=1x;if(2u){G ZP=[];1E.1U(2u,H(S){if(S.2K!=F){F.4K(S);if(S.2K==F){Km=1t;ZP.1f(S)}}},F);if(Km){F.CA()}1E.1U(ZP,H(S){F.19o(S)},F)}I Km},ut:H(S){I S.2K==F||S.2K&&F.ut(S.2K)},UE:H(1g){if(1g.2K==F){I 1t}G p8=[];if(1n.2D(K.eU,1g)){G 3h=1g;if(F.aO){I 1x}1E.1U(3h.2u,H(S){if(!1E.2O(F.2C,S)){p8.1f(S)}},F)}1k{if(1n.2D(K.3m,1g)){G S=1g;if(!1E.2O(F.2C,S)){if(S.2K==F){I 1t}p8.1f(S)}}}if(F.cS&&p8.T>0){F.1j.UU(F);if(F.19D(p8)){I 1t}}I 1x},Bl:H(1p,10I,g9){if(!F.aS&&F.1j!=1c&&F.1j.wb(F)){1h(G i=F.8b.T-1;i>=0;i--){G S=F.8b[i];if(1n.2D(K.3m,S)){if(g9==S){2V}if(S!=1c&&F.1j.Ji(S)&&S.3S(1p)){if(1n.2D(K.3B,S)){G Ir=S.Bl(1p,10I,g9);if(Ir){I 1t}}G l9=10I(S,g9);if(l9){I 1t}}}}}I 1x},UD:H(1g){3B.UG=1t;if(!F.cS){I 1x}G 1W=1a K.6D({S:1g,2K:F});F.1j.3n(K.2q.LG,1W);if(1W.jG()){I 1x}if(1n.2D(K.3m,1g)||1n.2D(K.eU,1g)){F.1j.1S();I 1t}},19r:H(1g){F.1j.UO();F.1j.1S()},wA:H(106){G 1d=1c;G 1X=1a 3o();1E.1U(F.2C,H(S){1d=1d?1d.8P(S.8m()):S.8m();if(106){1E.1U(S.Jt(),H(1i){if(!1X.2O(1i)){1X.2X(1i,1)}1k{1X.2X(1i,1X.1V(1i)+1)}})}});if(106){1X.1U(H(1i,kZ){if(kZ==2){1d=1d.8P(1i.3a())}})}I 1d},19G:H(){G mm=2h.4T(F.1j.3z);G Lc=F.1d.1T();Lc.1o=F.4t;Lc.1l=50*mm;I Lc},CA:H(19T,4E){G 1r=F.wA(1t);if(!1r){I}if(4E===1F){4E=F.4E}1r=1r.7u(4E);1r.y-=F.4t;1r.1o+=F.4t;if(!19T){1r=1r.8P(F.1d)}F.wP(1r,K.c6.Co);if(F.2K){F.2K.10f(F,0)}},10f:H(S,3L){if(3L==8){G nc=F.1d;G Bj=S.8m();G 10j=!S.kq()||S.1j==1c||S.1j.3h.2u.T==1;if(10j&&!nc.2O(Bj)&&!nc.hZ(Bj)){if(F.cf){F.54(S,1t)}}1k{if(!10j&&S.kq()){G 10b=S.1j.3h.1d;if(F.cf&&!nc.2O(10b)&&!10b.hZ(nc)){F.54(S,1t)}}}}G 19J=!S.kq()||S.1j==1c||S==S.1j.3h.2u[S.1j.3h.2u.T-1];if(19J){F.CA()}},yU:H(){I F.eK?1t:1x},GK:H(N){G yW=F.yU();if(yW==N){I}if(N){F.eK=1a K.vd(F);F.CE(F.eK)}1k{F.CF(F.eK);5M F.eK}F.1S()},rW:H(){I F.aS?1t:1x},AY:H(N){if(F.rW()==N){I}if(N){F.OA()}1k{F.OE()}},Ss:H(){I F.dF},1qx:H(N){if(F.dF!=N){F.dF=N;if(F.eK){F.eK.8E();F.eK.dS()}F.1S()}},OA:H(){F.b8=F.1d.m8();F.XZ();F.aS=1t;F.wP(F.19G(),K.c6.Co);F.IL();if(F.eK){F.eK.8E()}},OE:H(){F.aS=1x;G 1r=1a 1I(F.1d.x,F.1d.y,F.b8.1l,F.b8.1o);F.wP(1r,K.c6.Co);F.H3();if(F.eK){F.eK.8E()}},XZ:H(){1E.1U(F.2C,H(S){S.CG(1x);G 1X=F.18V();1E.1U(1X,H(1i){1i.CG(1x)},F);if(S.2C){1E.1U(S.2C,H(2c){if(1n.2D(3B,2c)){2c.XZ()}2c.CG(1x)},F)}},F)},Xx:H(){G 2u=[];1E.1U(F.2C,H(2c){if(1n.2D(3B,2c)){2u=2u.YG(2c.Xx())}2u.1f(2c)},F);I 2u},18V:H(){G 1X=[];G 2u=F.Xx();1h(G i=0,l=2u.T;i<l;i++){G 4X=[];2u[i].mO(4X);1h(G k=0,m=4X.T;k<m;k++){if(1E.7g(2u,4X[k].1O)>-1){1X.1f(4X[k])}}G eG=[];2u[i].mE(eG);1h(G k=0,m=eG.T;k<m;k++){if(1E.7g(2u,eG[k].1H)>-1){1X.1f(eG[k])}}}I 1X},H3:H(){1E.1U(F.2C,H(S){G 1X=[];3B.GB(1X,S);1E.1U(1X,H(1i){1i.rP()});if(S.H3){S.H3()}},F)},IL:H(){1E.1U(F.2C,H(S){G 1X=[];3B.GB(1X,S);1E.1U(1X,H(1i){if(1i.kM().2K!=F||1i.kD().2K!=F){1i.rP()}},F);if(S.IL){S.IL()}},F)},1tO:H(){I F.cS},1tN:H(N){if(F.cS!==N){F.cS=N;F.6I()}},1tU:H(){I F.cf},1u3:H(N){if(F.cf!==N){F.cf=N;F.6I()}},1u2:H(){if(F.b8===1F){F.b8=F.1d.m8()}I F.b8},DQ:H(){1n.2o(3B,F,"DQ",[]);if(F.2C){1E.1U(F.2C,H(2c){5M 2c.2K})}},19o:H(2c){if(!F.1j){I}G 1W=1a K.6D({S:2c,2K:F});F.1j.3n(K.2q.Lg,1W);I 1W.h6()},19p:H(2c){if(!F.1j){I}G 1W=1a K.6D({S:2c,2K:F});F.1j.3n(K.2q.LL,1W);I 1W.h6()},1ir:H(){if(!F.1j){I}G 1W=1a K.6D({S:F,2K:F});F.1j.3n(K.2q.LM,1W);I 1W.h6()},1iJ:H(){if(!F.1j){I}G 1W=1a K.6D({S:F,2K:F});F.1j.3n(K.2q.LJ,1W);I 1W.h6()},cD:H(4g,4H){G 8l=4H.5I["4O:3B"];if(8l){if(4g.5j(8l)){I 8l}}I 1n.2o(3B,F,"cD",[4g,4H])},J3:H(){G qB=[];G 1X=1a 3o();F.IA(1X);1X.1U(H(1i){if(1X.1V(1i)==3){qB.1f(1i)}},F);I qB},vS:H(v5,ow,ym){I K.8K.vS(v5,ow,ym,F.2C,F.1X?F.1X:F.J3(),F)},a4:H(3Z){F.1X=F.J3();G 2W=K.8K.a4(3Z,F);5M F.1X;F.CA(1t,3Z.cv);I 2W},13X:H(3Z,ba,9I,bh){F.1X=F.J3();9I=9I||0;ba=ba||zF;bh=bh||0;G 2W=K.8K.a4(3Z,F,{9I:9I,ba:ba,bh:bh});I 2W},10J:H(3Z){5M F.1X;F.CA(1t,3Z.cv)},dQ:H(){G 1G=1n.2o(3B,F,"dQ",[]);1G.4t=F.4t;1G.6N=F.6N;1G.cS=F.cS;1G.cf=F.cf;1G.4E=F.4E;1G.dF=F.dF;1G.yW=F.yU();1G.aS=F.aS;1G.b8=F.b8||F.1d.m8();1G.2C=1E.1T(F.2C);I 1G},ee:H(1G){1n.2o(3B,F,"ee",[1G]);F.4t=1G.4t;F.6N=1G.6N;F.cS=1G.cS;F.cf=1G.cf;F.4E=1G.4E;F.b8=1G.b8;F.dF=1G.dF;F.GK(1G.yW);F.AY(1G.aS);1E.1U(F.2C,H(2c){F.54(2c)},F);1E.1U(1G.2C,H(2c){F.4K(2c)},F)},aL:H(){if(!K.pw){K.pw=1a J.8Q(3B.1s,1c,F)}1k{K.pw.8M(F)}I K.pw}};3B.hG=H(1m){if(!K.pw){K.pw=1a J.8Q(3B.1s,1m)}1k{K.pw.8M(1c)}I K.pw};K.pw=1c;3B.GB=H(Hd,S){S.mO(Hd);S.mE(Hd);if(S.GB){I}if(S.c5){1E.1U(S.HN(),H(2c){3B.GB(Hd,2c)})}};3B.oJ=H(S){G 2K=S.2K;if(2K){if(2K.rW()){I 2K}I 3B.oJ(2K)}I 1c};J.2x(3B,"J.1e.3B",K.3m)})(J.1e);(H(K){G 2h=J.1B.2h;G 8C=J.1B.8C;G 1I=J.1B.1I;G v9=K.v9=H(S){1n.2T(v9,F,[S]);F.8E();F.dS()};v9.1s={dS:H(){G f7=F.9p();F.x=f7.x;F.y=f7.y},mD:H(2p){G 1r=F.j9();if(!1r.3S(2p)){I}G S=F.S;S.1j.Gd(S)},aY:H(2p){I F.j9().3S(2p)},9p:H(){G S=F.S;G mm=2h.4T(S.1j.3z);G 1r=S.1d.1T();G 1Y=S.uI();G 16r=S.jb?S.jb():1Y+mm*2;I 1a 1I(1Y<5*mm?1r.2Z()-2.5*mm-1Y/2:1r.2Z()-1Y,1r.y+16r/2-1Y/2,1Y,1Y)},j9:H(){G 1r=F.9p();if(F.S.3b!=0){G p=[];p.1f(1r.5H());p.1f(1r.hc());p.1f(1r.bc());p.1f(1r.hi());K.1M.k7(p,K.1M.9J(F.S.1d),F.S.3b);G cJ=1w.2H(p[0].x,1w.2H(p[1].x,1w.2H(p[2].x,p[3].x)));G 8Z=1w.2H(p[0].y,1w.2H(p[1].y,1w.2H(p[2].y,p[3].y)));G eA=1w.2n(p[0].x,1w.2n(p[1].x,1w.2n(p[2].x,p[3].x)));G am=1w.2n(p[0].y,1w.2n(p[1].y,1w.2n(p[2].y,p[3].y)));I 1I.gQ(cJ,8Z,eA,am)}I 1r},8E:H(){G S=F.S;G 2y=S.gu();G 3p=S.fi();G mm=2h.4T(S.1j.3z);G 1r=F.9p();1r.x=1r.y=0;G GQ=1a 8C(1r.x+mm,1r.y+mm,1r.2Z()-mm,1r.3F()-mm);GQ.2y=2y;GQ.3p=3p;F.2w.1f(GQ);G HE=1a 8C(1r.2Z()-mm,1r.y+mm,1r.x+mm,1r.3F()-mm);HE.2y=2y;HE.3p=3p;F.2w.1f(HE)}};J.2x(v9,"J.1e.v9",K.ie)})(J.1e);(H(K){G 1E=J.3X.1E;G 3o=J.3X.3o;G 5T=J.1B.5T;G 2h=J.1B.2h;G 1L=J.1B.1L;G 1I=J.1B.1I;G 9x=J.3X.9x;G 4u=J.1B.4u;G 6F=J.1B.6F;G 8n=J.1B.8n;G 2J=J.6Z.2J;G 4n=K.4n=H(1u){1n.2T(4n,F,[1u]);F.7w=1a K.qD(F);F.sP=1a K.rJ(F);F.15Z=1a K.md(F);F.zk=1n.zl();F.9U=1a K.bS(F);F.l3=1a J.1e.6R.gl(F);F.1v0=1a fo();F.1uU=1x;F.1uT=1a 1L(0,0);F.1uI=1a 1L(0,0);F.1uv=1a 1L(0,0);F.1uu=1a 1L(0,0);F.1ux=1c;F.IJ=1a 1L(0,0);F.1uq=1a fo();F.6c=1t;F.1R=[];F.2u=[];F.1X=[];F.KL=20;F.3h=1a K.eU(F);F.bT=1c;F.s4=K.11G.16k;F.ff=1c;F.mF=1x;F.a9="";F.9X="#sb";F.j4="#sb";F.n8="#7f";F.mM="#sb";F.mW="#7f";F.g3=K.6j.xe;F.gB=1;F.j5=1t;F.FZ="#sb";F.iX=2;F.ky=1t;F.JY("az");F.CJ("DY");F.fE=1c;F.o5=5;F.nZ=5;F.hf=K.jC.7z;F.qL=K.JB.YQ;F.pg=1a K.x5(F);F.jI=1x;F.Ay=8;F.hl=K.tK.lL;F.sc=1c;F.dV=1x;F.gy=1t;F.qd="#1us";F.fG=4;F.fF=4;F.qc=K.Ke.t6;F.ij=0;F.j6=0;F.sN=1.5;F.k6=J.1B.hW.16H;F.IN(K.97.V9);F.fX=1x;F.py=1t;F.3M=[];F.gX=K.kF.mi;F.q6=1.5;F.oS=0;F.kQ=2;F.gs=K.pf.16E;F.bv=8;F.bp=0;F.q8=1t;F.hr=0;F.hv=0;F.qp=8;F.pI=5O.7T;F.qA=["az","PL","uo"];F.Uq("hx");F.iI=1x;F.mb=150;F.m4=30;F.m2=30;F.kY=1;F.sj=1t;F.o8="dM";F.lI="MG";F.jQ=K.Di.16F;F.BO=1a K.pn();F.1iH(K.jn.Yo);F.1iD(K.jn.7H);F.1i5(K.jn.16J);F.5A=1c;F.fp=[];F.hs=[];F.163();F.4z(1x);F.1uA=1t};4n.1s={e3:H(){1n.2o(4n,F,"e3");G 6q=F.2F();F.Yw=1n.4C(F,F.z6);1n.7I(6q.4p,{6E:F.Yw});F.ob=1n.4C(F,F.sf);1n.7I(6V,{q7:F.ob});F.15N();F.i5=1a K.uZ(F);F.i5.uc();F.16x=1a K.uv(F);F.16x.uc();F.x7=1a K.um(F);F.x7.uc();F.3n(K.2q.iF)},gT:H(){F.zg();1n.12N(F.2F());if(F.2F()){1n.j0(F.2F().4p,"6E",F.Yw)}1n.j0(6V,"q7",F.ob);1n.2o(4n,F,"gT")},zX:H(){I F.gr||F.2F()},15N:H(){if(F.gr){3O.aM.qz(F.gr)}F.gr=3O.hV("1t3");F.gr.id=F.2F().id+"1t5";F.gr.1A.1l="xQ";F.gr.1A.1o="xQ";F.gr.1A.1Z="oB";F.gr.1t4=GV;3O.aM.ae(F.gr)},162:H(e){if(F.gr){G 3I=K.1M.1bT(e);F.gr.1A.3R=3I.x+"px";F.gr.1A.3c=3I.y+"px";F.gr.IC();e.qy()}},Hn:H(id){G 9B=3O.iw(id);if(9B){G eI=9B.eI;if(eI){eI.7V("HM",1n.4C(F,1n.EJ(F.sI,{id:id})))}}},163:H(){4n.mZ(K.4c,"4O:4c",2);4n.mZ(K.5p,"4O:5p",1);4n.mZ(K.7B,"4O:7B",1);4n.mZ(K.3B,"4O:3B",3);4n.mZ(K.bL,"4O:bL",2);4n.mZ(K.6t,"4O:6t",1);4n.mZ(K.ny,"4O:ny",1);4n.mZ(K.nG,"4O:nG",1);4n.mZ(K.6R.cL,"4O:cL",1)},1sx:H(){I F.15Z},7V:H(6d,5V){1n.zT(F,6d,5V)},LE:H(6d,5V){1n.j0(F,6d,5V)},3n:H(6d,1W){G 5V=1n.oH(F,6d);if(5V!=1c){5V(F,1W)}},3Y:H(6d,ej){if(!ej||ej==""){I}G fn=1a y8("8k","1W","I "+ej+"(8k, 1W)");F.7V(6d,fn)},1sw:H(){if(F.ff!=1c){F.ff.BF(F.O)}G gd=F.3h.1R;1h(G i=0;i<gd.T;i++){G 1g=gd[i];1g.BF(F.O)}},1iR:H(){G 3K=F.2F();if(F.sL&&!F.4b){1n.12N(3K.4p);G 1d=1n.3a(3K.4p);G w=1d.1l;G h=1d.1o;if(h!=0){3K.4p.167=h}3K.4p.1A.Dt="";3K.1A.1Z="oB";3K.1A.gw=1;3K.1l=1w.2H(w-1-F.za(1),F.1d.1l*F.3w);3K.1o=1w.2H(h-1-F.za(0),F.1d.1o*F.3w);G 4b=3O.hV("d6");4b.1A.1l=(w-1)+"px";4b.1A.1o=(h-1)+"px";4b.1A.1Z="oB";4b.1A.Dt="CH";F.4b=4b;G Lt=3O.hV("d6");Lt.1A.1Z="oB";F.166=Lt;4b.ae(Lt);3K.4p.ae(4b);1n.7I(4b,{6E:1n.4C(F,F.z6)})}1k{if(!F.sL&&F.4b){3K.1A.gw="";3K.1A.1Z="";1n.12N(F.4b);3K.4p.1A.Dt="CH";3K.4p.qz(F.4b);5M F.4b;5M F.166;1n.7I(3K.4p,{6E:1n.4C(F,F.z6)})}}F.J8()},16S:H(){if(F.4b){G 3K=F.2F();G 1d=1n.3a(3K.4p);G w=1d.1l;G h=1d.1o;if(h==0){h=3K.4p.167}if(h==0){h=F.1d.1o*F.3w}3K.1l=1w.2H(w,F.1d.1l*F.3w);3K.1o=1w.2H(h,F.1d.1o*F.3w);F.4b.1A.1l=w+"px";F.4b.1A.1o=h+"px";F.J8()}},yx:H(N){F.6c=N},ZH:H(){I F.6c},VN:H(N){F.pJ=N},VC:H(){I F.pJ},15S:H(N){F.qL=N},1sF:H(){I F.qL},Eb:H(N){if(F.9X!=N){F.9X=N;F.1S();F.4z(1t)}},Ol:H(){I F.9X},yz:H(){if(F.9X){I F.9X}G 1A=F.e8(K.2E.1s.N8);if(1A){G 1N=1A.Ol();if(1N){I 1N}}I"gp"},e8:H(4g){if(F.1A&&4g.5j(F.1A)){I F.1A}G 4H=F.4H;if(4H){G qm=4H.5I["4O:4n"];if(qm){I qm}}I 1c},Mq:H(){if(!F.3M){F.3M=[]}I F.3M},12R:H(){if(F.3M){I F.3M}G 1A=F.e8(K.2E.1s.Mz);if(1A){G 5q=1A.Mq();if(5q){I 5q}}I[]},JY:H(N){if(5P N=="av"){N=K.1Q.2e(N)}if(F.cE!==N){F.cE=N;F.4z(1t)}},1tJ:H(){I F.cE},1tC:H(N){F.qA=N},1tB:H(){I F.qA},1tD:H(N){F.pI=N},1td:H(){I F.pI},1tc:H(N){F.qp=N},1tf:H(){I F.qp},VG:H(N){if(F.j4!==N){F.j4=N;F.4z(1t)}},1t8:H(){I F.j4},16w:H(N){if(F.n8!==N){F.n8=N;F.4z(1t)}},1t7:H(){I F.n8},VI:H(N){if(F.mM!==N){F.mM=N;F.4z(1t)}},1tg:H(){I F.mM},16y:H(N){if(F.mW!==N){F.mW=N;F.4z(1t)}},1tm:H(){I F.mW},VE:H(N){if(!N){N=K.6j.bV}if(F.g3!==N){F.g3=N;if(F.g3==K.6j.bZ&&F.gB==1){F.gB=2}F.4z(1t)}},1sX:H(){I F.g3},VD:H(N){if(!N){N=1}if(F.gB==N||N<=0){I}F.gB=N;if(F.g3==K.6j.bZ&&F.gB==1){F.gB=2}F.4z(1t)},1sQ:H(){I F.gB},CJ:H(N){if(5P N=="av"){N=K.1Q.2e(N)}if(F.gM!==N){F.gM=N;F.4z(1t)}},1uM:H(){I F.gM},Kx:H(N){if(5P N=="av"){N=K.1Q.2e(N)}if(F.fE!==N){F.fE=N;F.4z(1t)}},1ts:H(){I F.fE},Vs:H(N){if(F.o5!==N){F.o5=N;F.4z(1t)}},1uo:H(){I F.o5},VP:H(N){if(F.nZ!==N){F.nZ=N;F.4z(1t)}},1u0:H(){I F.nZ},1u1:H(N){if(F.j5!=N){F.j5=N;F.4z(1t)}},1tT:H(){I F.j5},1uh:H(N){if(F.k6!=N){F.k6=N;F.4z(1t);F.1S()}},Z8:H(){I F.k6},VK:H(N){if(N){if(F.p0!=N){F.p0=N;F.dH=1a hX();1n.7I(F.dH,{uf:1n.4C(F,F.oW)});F.dH.g7=N;F.4z(1t)}}1k{F.p0=N;F.dH=1c;F.4z(1t)}},1uf:H(){I F.p0},VF:H(N){if(F.vN!=N){F.vN=N;if(N){F.dH=1a hX();F.dH.1l=100;F.dH.1o=100;G qY="4e:4d/1ag;QV,"+F.vN;1n.7I(F.dH,{uf:1n.4C(F,F.oW)});F.dH.g7=qY;F.4z(1t)}}},1un:H(){I F.vN},Z3:H(){I F.dH},1cb:H(){if(F.dH){I 1a J.1B.6F(F.dH.1l,F.dH.1o)}I 1a J.1B.6F(0,0)},oW:H(){F.dH.zo=1t;F.1S()},AR:H(4d){G 1y=1E.7g(F.fp,4d);if(1y==-1){1E.4K(F.fp,4d)}I 1E.7g(F.fp,4d)},SH:H(e5){G 1y=1E.7g(F.hs,e5);if(1y==-1){1E.4K(F.hs,e5)}I 1E.7g(F.hs,e5)},1uk:H(1g){if(1n.2D(K.3m,1g)){F.3n(K.2q.Kk,1a K.6D({S:1g}))}if(1n.2D(K.4c,1g)){F.3n(K.2q.Kg,1a K.aq({1i:1g}))}},HP:H(1g){if(1n.2D(K.3m,1g)){F.3n(K.2q.Jb,1a K.6D({S:1g}))}if(1n.2D(K.4c,1g)){F.3n(K.2q.K9,1a K.aq({1i:1g}))}},Cm:H(1g,2A){G 1p=2A.ck.1T();G lu=1t;G au=1x;G e;if(1n.2D(K.3m,1g)){e=1a K.6D({S:1g,2p:1p});F.3n(K.2q.Ld,e)}if(1n.2D(K.4c,1g)){e=1a K.aq({1i:1g,2p:1p});F.3n(K.2q.Lr,e)}if(e){lu=!e.jG();au=e.kU()}if(au){2A.Cn();lu=1x}I lu},KT:H(1g,2A){G 1p=2A.ck.1T();G 3L=2A.3f.1y;G lu=1t;G au=1x;G e;if(1n.2D(K.3m,1g)){e=1a K.6D({S:1g,2p:1p,3f:3L});F.3n(K.2q.Li,e)}if(1n.2D(K.4c,1g)){e=1a K.aq({1i:1g,2p:1p,3f:3L});F.3n(K.2q.Lj,e)}if(1n.2D(K.eU,1g)){e=1a K.uy({2p:1p,3f:3L});F.3n(K.2q.Lu,e)}if(e){lu=!e.jG();au=e.kU()}if(au){2A.Cn();lu=1x}I lu},17M:H(1g){G lu=1t;G e;if(1n.2D(K.3m,1g)){e=1a K.6D({S:1g});F.3n(K.2q.La,e)}if(1n.2D(K.4c,1g)){e=1a K.aq({1i:1g});F.3n(K.2q.Lp,e)}if(e){lu=!e.jG()}I lu},Fl:H(1g,2p,3f){if(1n.2D(K.3m,1g)){F.3n(K.2q.Js,1a K.6D({S:1g,2p:2p,3f:3f}))}if(1n.2D(K.4c,1g)){F.3n(K.2q.Jn,1a K.aq({1i:1g,2p:2p,3f:3f}))}},1hO:H(3H){F.3n(K.2q.Ij,1a K.6D({S:3H}))},1hX:H(3H){F.3n(K.2q.Lw,1a K.6D({S:3H}))},1cN:H(){G gd=1E.1T(F.3h.1R);1E.1U(gd,H(1g){F.Fl(1g,1a 1L(0,0),-1)},F)},17u:H(1g){if(1n.2D(K.3m,1g)){F.3n(K.2q.Jh,1a K.6D({S:1g}))}if(1n.2D(K.4c,1g)){F.3n(K.2q.Ka,1a K.aq({1i:1g}))}},ED:H(1g,2p,5D){if(1g){I 1g.ED(2p,5D)}1k{G 1W=1a K.uB({2p:2p,5D:5D});F.3n(K.2q.KG,1W);I 1t}},EM:H(1g,2p,5D){I 1g.EM(2p,5D)},1cM:H(1g){if(1n.2D(K.3m,1g)){F.3n(K.2q.wU,1a K.6D({S:1g}))}if(1n.2D(K.4c,1g)){F.3n(K.2q.Lz,1a K.aq({1i:1g}))}},10Q:H(1g){if(1n.2D(K.3m,1g)){F.3n(K.2q.LC,1a K.6D({S:1g}))}if(1n.2D(K.4c,1g)){F.3n(K.2q.KB,1a K.aq({1i:1g}))}},17r:H(1g,2p){G e;if(1n.2D(K.3m,1g)){e=1a K.6D({S:1g,2p:2p})}1k{if(1n.2D(K.4c,1g)){e=1a K.aq({1i:1g,2p:2p})}}F.3n(K.2q.KA,e);I e.Ru()},17l:H(1g,O){G e;if(1n.2D(K.3m,1g)){e=1a K.6D({S:1g,O:O})}1k{if(1n.2D(K.4c,1g)){e=1a K.aq({1i:1g,O:O})}}F.3n(K.2q.BK,e)},177:H(1g,2p){G yB=K.6o.7H;G e;if(1n.2D(K.3m,1g)){e=1a K.6D({S:1g,2p:2p,3f:yB});F.3n(K.2q.FA,e)}1k{if(1n.2D(K.4c,1g)){e=1a K.aq({1i:1g,2p:2p,3f:yB});F.3n(K.2q.FH,e)}}},1gq:H(1D){G e=1a K.r8(1D);F.3n(K.2q.RP,e);I e.h6()},1gs:H(1D){G e=1a K.r8(1D);F.3n(K.2q.RV,e);1D.5r=e.oY();I e.h6()},17m:H(6z,2r,2p,5D,au){G 2G=6z.8s(2r,0);G 1W=1a K.ph({2G:2G,5D:5D,2p:2p,2r:2r,1J:-1});F.3n(K.2q.KP,1W);au.N=1W.kU();I!1W.jG()},17j:H(6z,2r,2p,5D){G 2G=6z.8s(2r,0);G 1W=1a K.nD({2G:2G,5D:5D,2p:2p,2r:2r,1J:-1});F.3n(K.2q.Hs,1W)},1c4:H(6z,1J,2p,5D,au){G 2G=6z.8s(0,1J);G 1W=1a K.ph({2G:2G,5D:5D,2p:2p,2r:-1,1J:1J});F.3n(K.2q.Hq,1W);au.N=1W.kU();I!1W.jG()},1c3:H(6z,1J,2p,5D){G 2G=6z.8s(0,1J);G 1W=1a K.ph({2G:2G,5D:5D,2p:2p,2r:-1,1J:1J});F.3n(K.2q.Hx,1W)},10N:H(1C,5F){G 1W=1a K.tz(1C,5F);F.3n(K.2q.Hj,1W);I!1W.jG()},17k:H(1C,5F){G 1W=1a K.tz(1C,5F);F.3n(K.2q.Hk,1W)},13R:H(1g){if(1n.2D(K.3m,1g)){F.3n(K.2q.Hw,1a K.6D({S:1g}))}if(1n.2D(K.4c,1g)){F.3n(K.2q.Hu,1a K.aq({1i:1g}))}},FN:H(1g){G 1W=1a K.6D({S:1c});if(1g&&1n.2D(K.3m,1g)){1W.S=1g}F.3n(K.2q.QL,1W)},z6:H(){if(F.7w.4m!=1c&&1n.2D(K.fN,F.7w.4m)){F.7w.4m.9g()}if(F.dV||F.4b){F.8p()}},10w:H(1p){G 5C=F.lR();if(5C.1l>F.bv*2){5C=K.1M.7u(5C,-F.bv,0)}if(5C.1o>F.bv*2){5C=K.1M.7u(5C,0,-F.bv)}G 6E=!5C.3S(1p);if(6E){G fu=F.bp>0?F.bp:(4*2h.4T(F.3z));F.hr=0;F.hv=0;if(1p.x<5C.3R()){F.hr=-fu}if(1p.y<5C.3c()){F.hv=-fu}if(1p.x>5C.2Z()){F.hr=fu}if(1p.y>5C.3F()){F.hv=fu}F.wz();if(!F.hq){G 6S=F;F.hq=K1(H(){6S.wz()},100)}}1k{if(F.hq){F.xb();F.1S()}}I 6E},xb:H(){if(F.hq){10p(F.hq);5M F.hq}},wz:H(){G 9w=F.lR();if(F.4b){9w.1l-=F.za(0);9w.1o-=F.za(1)}G cb=F.gR(),cd=F.gD();if(9w.1l<F.1d.1l){cb+=F.hr}if(9w.1o<F.1d.1o){cd+=F.hv}F.CP(cb,cd,9w,F.1d);G 4m=F.7w.4m;if(4m){4m.6y(F.aD);if(F.gs!=K.pf.7H){F.Hm(F.7w.4m.cB)}}F.1S()},171:H(KK){G 1g=F.pK(KK,1t,1t);if(1g==1c&&F.ff!=1c&&1n.2D(K.3m,F.ff)){G S=F.ff;G 17n=K.1M.1up(KK,S.1d);G 17J=K.1M.17q(KK,17n);G Hp=F.iX/2+7*2h.4T(F.3z);Hp*=Hp;if(17J<=Hp){1g=F.ff}}F.Dy(1g)},1i4:H(e){e.qy()},11s:H(1p){G 9h=1I.bo;G xv=1c;G eF=1x;G 3V=F.Ha();G 1C=3V.1eG(1p,9h,1a 1L(0,0));if(1C!=1c){G Ff=2*2h.4T(F.3z);G Fh=9h.9h.1T();Fh.y=Fh.3F()-Ff;Fh.1o=Ff;G FK=9h.9h.1T();FK.x=FK.2Z()-Ff;FK.1l=Ff;G xv=1c;G eF=1x;if(Fh.2O(1p)){xv=1C;eF=1x}1k{if(FK.2O(1p)){xv=1C;eF=1t}}if(xv!=1c){I{1C:xv,eF:eF,9h:9h.9h}}}I 1x},16X:H(){if(F.11x){mB(F.11x)}if(F.IR){3O.aM.qz(F.IR);F.IR=1c}},16U:H(1p){if(F.s4==K.11G.16V){F.171(1p)}if(F.17h()){F.17i(1p)}G 11B=F.2F();G mu=F.172(1p);if(mu==J.6Z.2J.11p){mu=F.9f.iH(1p)}if(11B!=1c&&F.H7!=1t&&mu!=J.6Z.2J.11p){11B.1A.7y=mu}G 11A=F.gj(1p);G 11C=1n.3a(F.1ug);F.174=11A.x+11C.x;F.173=11A.y+11C.y;F.17a=1p;G 6S=F;F.11x=h3(H(){I 6S.178()},F.n0);if(F.iI){F.1u7=h3(H(){I 6S.1S()},100)}},172:H(pt){G mu=J.6Z.2J.11p;1h(G i=F.1R.T-1;i>=0;i--){G 1g=F.1R[i];if(!F.Ji(1g)){2V}G 9o=1g.mI(pt);if(9o!=1c){if(9o.xr(pt)){9o.9Y(pt)}mu=9o.iH(pt)}}if(F.I9()&&F.Ha().jy){G 4e=F.11s(pt);if(4e){if(4e.eF){mu=2J.mt}1k{mu=2J.mz}}}I mu},u2:H(5S,8t){G Ga=K.jn.7H;if(5S==0&&F.6c){Ga=F.J6}if(5S==1&&F.6c){Ga=F.IE}if(5S==2&&F.6c){Ga=F.Ix}I(Ga&8t)!=0},17h:H(){I 1n.oH(F,"FA")||1n.oH(F,"FH")},17i:H(2p){if(F.uj){mB(F.uj);5M F.uj}G 6S=F;F.uj=h3(H(){I 6S.176(2p)},1qQ)},176:H(2p){if(F.uj){mB(F.uj);5M F.uj}F.177(F.pK(2p,1x),2p)},mD:H(1Z,5S){G sU=F.mI(1Z);if(sU!=1c){sU.mD(1Z);I}G R0=F.pK(1Z,1t);G 1g=R0;if(1g&&1g.we()){1g=F.pK(1Z,1t,1t)}G K0=F.BO.Fx(K.qU.tT,K.pY.1G);if(5S==0||F.u2(5S,K.jn.tT)){if(!(K0)||!F.3h.DS){if(!F.3h.10P(1g)){F.3h.xY()}}}if(1g!=1c){if(5S==0||F.u2(5S,K.jn.tT)){if(K0&&1g.kq()){F.3h.ml(1g)}1k{F.3h.9u(1g)}}}G It=F.O.1qK;if(5P It!="1F"){1h(G l=0;l<It.T;l++){G nY=It[l];if(nY.1r.3S(F.gj(1Z))){G 1W=1a K.6D({S:nY.1g,nY:nY.1i});F.3n(K.2q.RJ,1W);2i}}}F.ED(R0,1Z,5S)},178:H(){G 1g=F.pK(F.17a,1t,1x);if(1g&&1g.bN){G 179=F.2F().id+"1pU";G d6=F.IR=3O.hV("d6");3O.aM.ae(d6);d6.2Q("id",179);d6.1fC=1g.bN;d6.1A.3R=F.174+20+"px";d6.1A.3c=F.173+"px";d6.1A.1l="CH";d6.1A.1Z="oB";d6.1A.1pJ="1q9";d6.1A.qf="gp";d6.1A.NX="175 1px";d6.1A.gw=2}},1pZ:H(){F.1S()},1q0:H(1g,1p){G 6S=F;h3(H(){if(6S.7w.4m!=1c&&1n.2D(K.fN,6S.7w.4m)){I}G G1=1g;G 17g=1p||6S.co(6S.IJ);6S.7w.4m=1a K.fN(G1);6S.7w.4m.2I(17g)},1)},xm:H(1r){G 1d=1a 1I();G G2=K.1M.3a(F.2F());F.yo=1a 1I(G2.x-(F.4b?F.4b.8O:0)+F.3w*F.1d.x+F.3w*1r.x,G2.y-(F.4b?F.4b.8R:0)+F.3w*F.1d.y+F.3w*1r.y,F.3w*1r.1l,F.3w*1r.1o);G p=F.gj(1r.5H());1d.x=G2.x+p.x;1d.y=G2.y+p.y;1d.1l=F.yo.1l;1d.1o=F.yo.1o;I 1d},yk:H(1r){G 1d=F.xm(1r);F.6Y.1A.3R=1d.x+"px";F.6Y.1A.3c=1d.y+"px";F.6Y.1A.1l=1d.1l+"px";F.6Y.1A.1o=1d.1o+"px"},SD:H(){if(F.6Y){F.6Y.IC()}},1sl:H(IP){if(F.7w.4m!=1c&&1n.2D(K.fN,F.7w.4m)){G 1p=F.co(F.IJ);if(IP){F.7w.4m.bQ(1p)}1k{F.7w.4m.9g(1p)}F.7w.4m=1c}},sf:H(){F.16S();if(F.7w.4m!=1c&&1n.2D(K.fN,F.7w.4m)){G 1p=F.co(F.IJ);G 1r=F.7w.4m.qo.nu(1p);F.7w.4m.yk(1r)}},1df:H(){I F.1R},1ct:H(){I F.2u},1rk:H(){I F.1X},zg:H(){F.Dy(1c);F.3h.xY();1h(G i=0,l=F.1R.T;i<l;i++){G 1g=F.1R[0];1E.54(F.1R,1g);F.Ui(1g)}F.2u=[];F.1X=[];if(F.5A!=1c){F.5A=1a K.uQ(F)}},9u:H(1g){if(F.g2()){F.5A.B4();F.5A.f4(1a K.rC(F,1g));F.5A.BB()}1k{F.Gw(1g)}},Gw:H(1g){if(1E.2O(F.1R,1g)){I}if(1n.2D(K.3m,1g)){F.2u.1f(1g);1g.pM()}1k{if(!1E.2O(F.1R,1g.1O)&&(1g.1O==1c||!1n.2D(K.bS,1g.1O))){I}if(!1E.2O(F.1R,1g.1H)&&(1g.1H==1c||!1n.2D(K.bS,1g.1H))){I}F.1X.1f(1g);1g.1hC()}if(1g.sJ()===1F){1g.AA(F.1R.T)}1E.4K(F.1R,1g);F.13C(1g);if(F.gs!=K.pf.7H){F.Hm(1g)}if(1n.2D(K.4c,1g)){if(J.1e.3B.rm){if(1g.1O.2K!=1c||1g.1H.2K!=1c){F.G8()}}}F.3n(K.2q.HJ,1a K.mU({1g:1g}));F.4z(1t)},ml:H(1g){if(!1g){I}if(F.g2()){F.5A.B4();F.5A.f4(1a K.rk(F,1g));F.5A.BB()}1k{F.GM(1g,1t)}},GM:H(1g){if(F.ff==1g){F.Dy(1c)}F.3h.ml(1g);F.17A(1g);F.17z(1g);if(J.1e.3B.rm){F.G8()}if(1n.2D(K.3m,1g)){1g.17E();1g.17G();if(1g.aX){F.TD([1g.3a()])}}1k{if(1n.2D(K.4c,1g)){1g.Ch();1g.3J.kW();1g.3A.kW()}}1g.DQ();if(F.gs!=K.pf.7H){F.Ty()}F.3n(K.2q.HS,1a K.mU({1g:1g}));F.4z(1t)},17A:H(1g){if(1n.2D(K.3m,1g)){1E.54(F.2u,1g)}1k{1E.54(F.1X,1g)}},17z:H(1g){1E.54(F.1R,1g);F.Ui(1g)},Xi:H(17C,z){G Hz=[];G 8b=F.10y();if(z>8b.T){z=8b.T}if(17C){1h(G i=z-1;i>=0;i--){G 1g=8b[i].1g;if(1n.2D(K.4c,1g)){Hz.1f(1g)}}}1k{1h(G i=z+1;i<8b.T;i++){G 1g=8b[i].1g;if(1n.2D(K.4c,1g)){Hz.1f(1g)}}}I Hz},Gd:H(1g){if(1g!=1c&&F.17M(1g)){F.ml(1g)}},Uc:H(){F.H8();G HO=F.3h.1X;1h(G i=0,l=HO.T;i<l;i++){if(F.3h.1X.7g(HO[0])>-1){F.Gd(HO[0])}}G K4=F.3h.2u;1h(G i=0,l=K4.T;i<l;i++){if(F.3h.2u.7g(K4[0])>-1){F.Gd(K4[0])}}F.oD()},1rv:H(1p){I Dq(F.1R,1p)},1ru:H(1p){I Dq(F.2u,1p)},1rw:H(1p){I Dq(F.1X,1p)},pK:H(1p,sD,os){I GT(F.1R,1p,sD,os)},qT:H(1p,sD,os){I GT(F.2u,1p,sD,os,1t)},1ry:H(1p,sD,os){I GT(F.1X,1p,sD,os)},vC:H(1p,16b){G gd=F.3h.1R;1h(G i=0;i<gd.T;i++){G 3L=gd[i].7F(1p);if(3L!=1c){I 3L}}if(16b){I 1c}if(F.ff!=1c){G 3L=F.ff.7F(1p);if(3L!=1c){I 3L}}},1jz:H(1p,16a,xu,ve){G vY=5O.7T;G Rl=1c;1h(G i=0;i<F.2u.T;i++){G S=F.2u[i];if(ve&&S.gU()){2V}if(S===xu){2V}if(K.1M.1rz(1p,S.1d,16a)){G 8I=K.1M.1rC(1p,S.1d);if(8I<vY){Rl=S;vY=8I}}}I Rl},vH:H(1r,e9,ev,eB){G rL=K.1M.Ce(1r);if(eB){1h(G i=0,l=F.1R.T;i<l;i++){G 1g=F.1R[i];if(!1g.fA()){2V}if(!1g.gU()&&1g.je(1r)){e9.1f(1g);if(!ev){I}if(1n.2D(K.3B,1g)){1g.vH(1r,e9,ev,eB)}}}}1k{1h(G i=0,l=F.1R.T;i<l;i++){G 1g=F.1R[i];if(!1g.fA()){2V}G rX=1g.8m();if(!1g.gU()&&rL.2O(rX)){e9.1f(1g);if(!ev){I}if(1n.2D(K.3B,1g)){1g.vH(1r,e9,ev,eB)}}}}},AG:H(1r,e9,ev,eB){G 4x=0;G rL=K.1M.Ce(1r);if(eB){1h(G i=0,l=F.1R.T;i<l;i++){G 1g=F.1R[i];if(!1g.fA()){2V}if(!1g.gU()&&1g.je(1r)){4x+=1;if(1n.2D(K.3B,1g)){4x+=1g.AG(1r,e9,ev,eB)}}}}1k{1h(G i=0,l=F.1R.T;i<l;i++){G 1g=F.1R[i];if(!1g.fA()){2V}G rX=1g.8m();if(!F.1R[i].gU()&&rL.2O(rX)){4x+=1;if(1n.2D(K.3B,1g)){4x+=1g.AG(1r,e9,ev,eB)}}}}},UO:H(){if(J.1e.3B.rm){1h(G i=0,l=F.1R.T;i<l;i++){F.1R[i].Rb(1t)}1h(G i=0,l=F.2u.T;i<l;i++){if(1n.2D(J.1e.3B,F.2u[i])){F.2u[i].15W()}}}},wb:H(1g){if(!1g.jj()){I 1x}if(!1g.Jq){if(1n.2D(J.1e.3m,1g)){if(J.1e.3B.oJ(1g)!=1c){I 1x}}if(1n.2D(J.1e.4c,1g)){G c1=J.1e.3B.oJ(1g.1O);if(c1!=1c){G c2=J.1e.3B.oJ(1g.1H);if(c1==c2){I 1x}}}}I 1t},Ji:H(1g){if(1g.gU()){I 1x}I 1t},gY:H(){I F.7i.ek},sI:H(8k,1W){G 9B=3O.iw(1W.id);if(9B){9B.N=K.1M.1ch(F.3q())}},3q:H(){G rg=F.2F().4p;G 1d=1n.3a(rg);G 1q={AL:1,id:F.2F().id,1l:1d.1l,1o:1d.1o,9n:F.1d,6c:F.6c,3z:F.3z,pJ:F.pJ,2m:F.2m,cE:F.cE?F.cE.id:"x9",9X:F.9X,n8:F.n8,j4:F.j4,g3:F.g3,mW:F.mW,gB:F.gB,mM:F.mM,fE:(F.fE)?F.fE.id:1c,gM:(F.gM)?F.gM.id:1c,nZ:F.nZ,o5:F.o5,oS:F.oS,8O:F.2F().4p.8O,8R:F.2F().4p.8R,jI:F.jI,kO:F.kO,lU:F.lU,kQ:F.kQ,gX:F.gX,q6:F.q6,gS:F.gS,sL:F.sL,hl:F.hl,s4:F.s4,qL:F.qL,qc:F.qc,qd:F.qd,fG:F.fG,fF:F.fF,ij:F.ij,j6:F.j6,sN:F.sN,dV:F.dV,gy:F.gy,iI:F.iI,eN:(F.eN)?F.eN.id:1c,mb:F.mb,m4:F.m4,m2:F.m2,kY:F.kY,sj:F.sj,o8:F.o8,lI:F.lI,QH:F.g2(),qi:F.qi,fX:F.fX,iX:F.iX,ky:F.ky,gs:F.gs,q8:F.q8,bv:F.bv,bp:F.bp,mF:F.mF,iq:F.iq,hf:F.hf,5r:F.oY()||1c,1A:F.1A?F.1A.3q():1c,4H:F.4H?F.4H.3q():1c,p0:F.p0,k6:F.k6,9E:F.nh(),9A:F.nb(),jQ:F.1i3(),1R:F.HA(),l3:F.l3.3q(),pV:F.pV,fp:F.fp,hs:F.hs,n0:F.n0,a9:F.a9,pI:F.pI,qp:F.qp,qA:F.qA,j5:F.j5,fS:F.fS};G 5q=[];1h(G i=0,l=F.3M.T;i<l;i++){if(F.3M[i]!=1c){5q.1f(F.3M[i].3q())}}1q.5q=5q;if(F.vN){1q.W1=F.AR(F.vN)}I 1n.3q(1q)},HA:H(){G 2W=[];F.Wd();1h(G i=0,l=F.2u.T;i<l;i++){G 1q=F.2u[i].3q();2W.1f(1q)}1h(G i=0,l=F.1X.T;i<l;i++){G 1q=F.1X[i].3q();2W.1f(1q)}I 2W},Wd:H(){G 8S=0;1h(G i=0,l=F.2u.T;i<l;i++){F.2u[i].8S=8S++}1h(G i=0,l=F.1X.T;i<l;i++){F.1X[i].8S=8S++}},3D:H(1q){F.zg();if(1q>""){G 1z=1n.3D(1q);if(1z.a9!=1c&&1z.a9!=""){F.IH(1z.a9)}F.1d=1a J.1B.1I(1z.9n.x,1z.9n.y,1z.9n.1l,1z.9n.1o);F.yx(1z.6c);F.2m=1z.2m?5T.1K(1z.2m):1c;F.JY(1z.cE);F.1jl(1z.sL);F.YY(1z.3z);F.1qg();F.VN(1z.pJ);F.15S(1z.qL);F.14V(1z.jI);if(1z.pg=="th"){F.pg=1a K.th(F)}F.E4(1z.gS);F.14c(1z.hl);F.15p(1z.s4);F.155(1z.qc);F.15y(1z.qd);F.15C(1z.fG);F.15B(1z.fF);F.15j(1z.ij||0);F.152(1z.j6||0);if(1z.gs!==1F){F.1jw(1z.gs)}if(1z.q8!==1F){F.1jK(1z.q8)}F.1hI(1z.bv||8);F.Jk(1z.bp||0);if(1z.sN!==1F){F.14T(1z.sN)}F.15I(1z.dV);F.15H(1z.gy);F.Eb(1z.9X);F.16w(1z.n8);F.VG(1z.j4);F.16y(1z.mW);F.VI(1z.mM);F.VE(1z.g3);F.VD(1z.gB);F.Kx(1z.fE);F.CJ(1z.gM);F.VP(1z.nZ);F.Vs(1z.o5);F.1jA(1z.oS);if(1z.iI!==1F){F.1hG(1z.iI)}if(1z.eN!==1F){F.Uq(1z.eN)}if(1z.mb!==1F){F.1hK(1z.mb)}if(1z.m4!==1F){F.1hB(1z.m4)}if(1z.m2!==1F){F.1hF(1z.m2)}if(1z.kY!==1F){F.1hw(1z.kY)}if(1z.16I!==1F){J.1B.Um.tm=1z.16I}if(1z.sj!==1F){F.1hy(1z.sj)}if(1z.o8!==1F){F.1in(1z.o8)}if(1z.lI!==1F){F.1iE(1z.lI)}if(1z.QH!==1F){F.1i7(1z.QH)}if(1z.DB!==1F){F.1jp(1z.DB)}if(1z.DH!==1F){F.1jh(1z.DH)}if(1z.qi!==1F){F.IN(1z.qi)}if(1z.fX!==1F){F.fX=1z.fX}if(1z.iX!==1F){F.iX=1z.iX}if(1z.ky!==1F){F.ky=1z.ky}if(1z.kO!==1F){F.kO=1z.kO}if(1z.lU!==1F){F.lU=1z.lU}if(1z.kQ!==1F){F.kQ=1z.kQ}if(1z.gX!==1F){F.gX=1z.gX}if(1z.q6!==1F){F.q6=1z.q6}if(1z.mF!==1F){F.mF=1z.mF}if(1z.iq!==1F){F.iq=1z.iq}if(1z.hf!==1F){F.hf=1z.hf}if(1z.pI!==1F){F.pI=1z.pI}if(1z.qp!==1F){F.qp=1z.qp}if(1z.qA!==1F){F.qA=1z.qA}if(1z.5r!==1F){F.5r=1z.5r}if(1z.1A){F.1A=1a K.2E(1x);F.1A.3D(1z.1A)}if(1z.4H){F.4H=1a K.f8();F.4H.3D(1z.4H)}F.3M=[];if(1z.5q){1h(G i=0,l=1z.5q.T;i<l;i++){G 2R=1n.mY(1z.5q[i].Bb);if(2R){G 7E=1a 2R(F);7E.3D(1z.5q[i]);F.3M.1f(7E)}}}if(1z.fp!=1F){F.fp=1z.fp}if(1z.hs!=1F){F.hs=1z.hs}if(1z.k6!==1F){F.k6=1z.k6}if(1z.p0!==1F){F.VK(1z.p0)}if(1z.W1!=1F){F.VF(F.fp[1z.W1])}if(1z.9E!==1F){F.9E=1z.9E}if(1z.9A!==1F){F.9A=1z.9A}if(1z.jQ!==1F){F.jQ=1z.jQ}if(1z.n0!==1F){F.n0=1z.n0}if(1z.j5!==1F){F.j5=1z.j5}if(1z.fS!==1F){F.fS=1z.fS}F.3Y(K.2q.Jo,1z.1qJ);F.3Y(K.2q.Ko,1z.1qZ);F.3Y(K.2q.Jb,1z.1qR);F.3Y(K.2q.Ld,1z.1qq);F.3Y(K.2q.K9,1z.1qs);F.3Y(K.2q.Lr,1z.1qk);F.3Y(K.2q.Js,1z.1qn);F.3Y(K.2q.Li,1z.1qm);F.3Y(K.2q.Jn,1z.1qB);F.3Y(K.2q.Lj,1z.1qA);F.3Y(K.2q.Jh,1z.1tQ);F.3Y(K.2q.La,1z.1tS);F.3Y(K.2q.Ka,1z.1tM);F.3Y(K.2q.Lp,1z.1uV);F.3Y(K.2q.Jz,1z.1sU);F.3Y(K.2q.Jr,1z.1sR);F.3Y(K.2q.KO,1z.1t2);F.3Y(K.2q.8p,1z.1sZ);F.3Y(K.2q.KC,1z.1sz);F.3Y(K.2q.Lu,1z.1st);F.3Y(K.2q.Kk,1z.1t6);F.3Y(K.2q.Kg,1z.1tw);F.3Y(K.2q.Ij,1z.1ty);F.3Y(K.2q.Lw,1z.1tq);F.3Y(K.2q.wU,1z.1cA);F.3Y(K.2q.LC,1z.1to);F.3Y(K.2q.Lz,1z.1ti);F.3Y(K.2q.KB,1z.1tj);F.3Y(K.2q.Je,1z.1tH);F.3Y(K.2q.Jl,1z.1tu);F.3Y(K.2q.FA,1z.1sG);F.3Y(K.2q.FH,1z.1sH);F.3Y(K.2q.iF,1z.HB);F.3Y(K.2q.LM,1z.1t0);F.3Y(K.2q.LJ,1z.1t1);F.3Y(K.2q.Lg,1z.1sP);F.3Y(K.2q.LL,1z.1sO);F.3Y(K.2q.LG,1z.1uz);F.3Y(K.2q.LI,1z.1uH);F.3Y(K.2q.BK,1z.1uW);F.3Y(K.2q.KA,1z.1ua);F.3Y(K.2q.KG,1z.1ub);F.3Y(K.2q.Ky,1z.1u5);F.3Y(K.2q.Fc,1z.1tR);F.3Y(K.2q.uP,1z.1uX);F.3Y(K.2q.KP,1z.1ut);F.3Y(K.2q.Hq,1z.1sJ);F.3Y(K.2q.Hs,1z.1sK);F.3Y(K.2q.Hx,1z.1sE);F.3Y(K.2q.Hw,1z.1tr);F.3Y(K.2q.Hu,1z.1tA);F.3Y(K.2q.Hj,1z.1tt);F.3Y(K.2q.Hk,1z.1ud);F.3Y(K.2q.HJ,1z.1pz);F.3Y(K.2q.HS,1z.1l1);if(1z.8O){F.2F().4p.8O=1z.8O}if(1z.8R){F.2F().4p.8R=1z.8R}if(1z.yC){1h(G c in 1z.yC){G KY=1n.3D(1z.yC[c]);K.eZ.YZ(c,KY)}}G dd=[];if(1z.1R GI HL){1h(G i=0;i<1z.1R.T;i++){if(1z.1R[i]){if(F.Ul(1z.1R[i])){G 1g=F.v4(1z.1R[i],dd);dd[1z.1R[i].8S]=1g;F.9u(1g);if(1z.1R[i].aO){F.3h.9u(1g)}}}}1h(G i=0;i<1z.1R.T;i++){if(1z.1R[i]){if(F.Uk(1z.1R[i])){G 1g=F.v4(1z.1R[i],dd);dd[1z.1R[i].8S]=1g;F.9u(1g);if(1z.1R[i].aO){F.3h.9u(1g)}}}}}if(1z.l3!==1F){F.l3.3D(1z.l3)}if(1z.pV!=1F){F.pV=1z.pV}}1h(G i=0;i<dd.T;i++){dd[i].ig(dd)}if(F.ig){F.ig()}F.1S();F.4z(1x);F.3n(K.2q.iF)},Ul:H(BN){G 2R=1n.mY(BN.GA||BN.2R);if(!2R){I 1x}I 1n.wp(2R,K.3m)},Uk:H(BN){G 2R=1n.mY(BN.GA||BN.2R);if(!2R){I 1x}I 2R==K.4c||1n.wp(2R,K.4c)},v4:H(1z,1R){G 2R=1n.mY(1z.GA||1z.2R);if(!2R){I 1c}if(1n.wp(2R,K.3m)){G S=1a 2R(F);S.3D(1z);I S}if(2R==K.4c||1n.wp(2R,K.4c)){G 1O=1R[1z.1O];G 1H=1R[1z.1H];G 1i=1a 2R(F,1O,1H);1i.3D(1z);I 1i}I 1c},5g:H(NY,ig,tL){G 1m=F;G 9F=1a Yk();9F.1a9=H(){1m.VW(9F.1a8);if(ig){ig(1m)}};9F.19Y=H(){ud.Fo("7M 3v Ye Yh.");if(tL){tL(1m)}};9F.lq("19W",NY);9F.19Z="3O";9F.YB()},5u:H(qY){G 9F=1a Yk();9F.lq("1kZ",qY,1t);9F.1kY("RB-aK","1P/QJ");9F.YB(F.16i(K.Iw.VV))},1lf:H(J0){if(J0.16m(0)=="{"){F.3D(J0)}1k{G 16h=1a 1l9();F.VW(16h.1kS(J0,"1lj/QJ"))}},16i:H(J1){if(5P J1=="1F"){J1=K.Iw.16t}if(J1==K.Iw.VV){G 16o=1a 1bz();I 16o.1bC(F.19m())}1k{I F.3q()}},VW:H(3O){F.zg();G gL=3O.1m6;G O=1a K.s9(F,3O);O.Tr=7e(gL.4y("jf"));O.1g7(gL);F.197("18X",gL,O);G 19d=F.1d;F.Kp("o9",gL,O);G 2u=gL.7U("19i")[0];G 1u=2u.19g;3v(1u!=1c){G S=O.U5(1u);F.9u(S);1u=1u.19b}G 1X=gL.7U("19k")[0];G 1u=1X.19g;3v(1u!=1c){G 1i=O.U5(1u);F.9u(1i);1u=1u.19b}G wH=O.4k("eU",gL);if(wH){G gd=wH.7U("vm");1h(G i=0;i<gd.T;i++){G 1u=gd[i];G 1g=O.PC(1u);if(1g){F.3h.9u(1g)}}G bT=O.4k("18Z",wH);if(bT){F.bT=O.PC(bT)}}F.wk(O.Tp("2E",gL));F.1jo(O.1h8("f8",gL));F.13E("1m5",gL,O);F.4G(19d)},19m:H(){F.Wd();G CI=3O.1by.1bx("","",1c);G ko=CI.hV("4n");ko.2Q("jf","17");CI.ae(ko);G O=1a K.s9(F,CI);G 19l=O.3i("19i",ko);1h(G i=0;i<F.2u.T;i++){O.U1(F.2u[i],19l,"Rr")}G 18Y=O.3i("19k",ko);1h(G i=0;i<F.1X.T;i++){O.U1(F.1X[i],18Y,"1m1")}F.19S("18X",ko,O);F.Kt("o9",ko,O);G wH=O.3i("eU",ko);G gd=F.3h.1R;1h(G i=0;i<gd.T;i++){O.wQ(gd[i],"vm",wH)}O.wQ(F.bT,"18Z",wH);O.To(F.1A,"2E",ko,"4O:1lK");O.1h7(F.4H,"f8",ko);O.1g4(ko);F.4z(1x);I CI},197:H(2l,2a,O){G 1u=O.4k(2l,2a);if(!1u){7r 1a 7M("1lu to uf 1m 1lq.")}F.YY(O.3Q("18D",1u));if(O.Tr>13){F.CJ(O.wV("X3",1u));F.Kx(O.wV("WZ",1u))}1k{F.CJ(O.DX("X3",1u));F.Kx(O.DX("WZ",1u))}F.Vs(O.5k("19U",1u));F.VP(O.5k("19P",1u));F.gy=O.4v("19R",1u);F.dV=O.4v("19Q",1u);F.qc=O.3Q("Ke",1u);F.qd=O.hy("19w",1u);F.fG=O.5k("19q",1u);F.fF=O.5k("19C",1u);F.ij=O.5k("19F",1u);F.j6=O.5k("19y",1u);F.jQ=O.3Q("Di",1u);F.9E=O.5k("Ja",1u);F.9A=O.5k("Jd",1u);F.k6=O.3Q("hW",1u);F.VK(O.EI("17W",1u));F.VF(O.EI("18g",1u));F.VE(O.3Q("18c",1u));F.VD(O.3Q("18b",1u));F.1d=O.UP("JF",1u);F.Bm=O.4v("18d",1u);F.189=O.4v("18k",1u);F.vM=O.a7("JC",1u);F.2m=O.rZ("5T",1u);if(!F.2m){G AX=O.a7("Ni",1u);G 4U=O.5k("N1",1u);if(AX!=""&&4U>0){F.2m=1a 5T(AX,4U)}}F.JY(O.wV("17T",1u));F.n8=O.nF("17S",1u);F.mW=O.nF("183",1u);F.VG(O.9r("185",1u));F.VI(O.9r("17Y",1u));F.Eb(O.9r("ga",1u));F.iq=O.4v("182",1u);F.jI=O.4v("18I",1u);F.hf=O.3Q("jC",1u);F.18R=O.a7("18M",1u);F.18L=O.a7("18N",1u);F.gX=O.3Q("kF",1u);F.KL=O.5k("18s",1u,20);F.5r=O.Dv(F,"BQ",1u);F.lU=O.4v("18t",1u);F.kQ=O.5k("18n",1u);F.1jc(O.4v("18q",1u));G Es=O.4k("18A",1u);if(Es!=1c){F.l3.5g(Es,O)}F.gs=O.3Q("pf",1u);F.j5=O.4v("18y",1u,1t);F.fX=O.4v("18x",1u);F.hl=O.3Q("tK",1u,K.tK.lL);F.iX=O.5k("13B",1u,2);F.ky=O.4v("13z",1u,1t);F.kO=O.4v("13y",1u);F.3h.DS=O.4v("13F",1u)},19S:H(2l,2a,O){G 1u=O.3i(2l,2a);O.xf(F.gM,"X3",1u);O.xf(F.fE,"WZ",1u);O.5w(F.o5,"19U",1u);O.5w(F.nZ,"19P",1u);O.4o(F.gy,"19R",1u);O.4o(F.dV,"19Q",1u);O.4r(F.qc,"Ke",1u);O.hn(F.qd,"19w",1u);O.5w(F.fG,"19q",1u);O.5w(F.fF,"19C",1u);O.5w(F.ij,"19F",1u);O.5w(F.j6,"19y",1u);O.4r(F.jQ,"Di",1u);O.5w(F.nh(),"Ja",1u);O.5w(F.nb(),"Jd",1u);O.4r(F.g3,"18c",1u);O.4r(F.gB,"18b",1u);O.PM(F.1d,"JF",1u);O.4o(F.Bm,"18d",1u);O.4o(F.189,"18k",1u);O.c9(F.vM,"JC",1u);O.qW(F.2m,"5T",1u);O.MS(F.vN,"18g",1u);O.4r(F.k6,"hW",1u);O.c9(F.p0,"17W",1u);O.xf(F.cE,"17T",1u);O.wc(F.n8,"17S",1u);O.wc(F.mW,"183",1u);O.9k(F.j4,"185",1u);O.9k(F.mM,"17Y",1u);O.9k(F.9X,"ga",1u);O.4o(F.iq,"182",1u);O.4o(F.jI,"18I",1u);O.4r(F.hf,"jC",1u);O.4r(F.3z,"18D",1u);O.c9(F.18R,"18M",1u);O.c9(F.18L,"18N",1u);O.4r(F.gX,"kF",1u);O.5w(F.KL,"18s",1u);O.Dm(F,F.5r,"BQ",1u);O.4o(F.lU,"18t",1u);O.5w(F.kQ,"18n",1u);O.4o(F.pV,"18q",1u);G Es=O.3i("18A",1u);F.l3.5u(Es,O);O.4r(F.gs,"pf",1u);O.4o(F.j5,"18y",1u);O.4o(F.fX,"18x",1u);O.4r(F.hl,"tK",1u);O.5w(F.iX,"13B",1u);O.4o(F.ky,"13z",1u);O.4o(F.kO,"13y",1u);O.4o(F.3h.DS,"13F",1u)},Kp:H(2l,2a,O){F.3M=[];G 6n=2a.7U(2l);G 1u=1c;1h(G i=0;i<6n.T;i++){if(6n[i].4p!=2a){2V}1u=6n[i];2i}if(!1u){I}G iz=1u.7U("ou");1h(G i=0;i<iz.T;i++){G bk=iz[i];F.3M.1f(O.Pf(bk))}},Kt:H(2l,2a,O){G TY=O.3i(2l,2a);1h(G i=0;i<F.3M.T;i++){O.Pg(F.3M[i],"ou",TY)}},13E:H(2l,2a,O){G 1u=O.4k(2l,2a);if(!1u){I}F.IN(O.3Q("97",1u))},13C:H(1g){1g.1j=F;1g.yr()},Ui:H(1g){1g.yR()},4z:H(N){if(4n.9L){I}if(N===1F){N=1t}F.nA=N},1jR:H(){I F.nA},UR:H(13o){1h(G i=0,l=F.1R.T;i<l;i++){G 1g=F.1R[i];1g[13o]=1F}},13Z:H(AP){if(F.3h.1R.T==0){I}G 1q=F.3h.3q();if(AP&&6V.KM){6V.KM.1ki("1P",1q)}1k{6V.13u=1q}},1kl:H(EZ,EW,AP,13U){G 1q;if(AP&&6V.KM){1q=6V.KM.1k6("1P")}1k{1q=6V.13u}if(1q){G dx=EZ||0;G dy=EW||0;F.H8();F.3h.xY();G 1z=1n.3D(1q);G dd=[];G 1R=1z.1R;if(1R GI HL){1h(G i=0;i<1R.T;i++){if(F.Ul(1R[i])){G 1g=F.v4(1R[i],dd);dd[1R[i].8S]=1g;if(dx!=0||dy!=0){G b=1g.3a();1g.4G(1a 1I(b.x+dx,b.y+dy,b.1l,b.1o))}F.9u(1g);F.3h.9u(1g)}}1h(G i=0;i<1R.T;i++){if(F.Uk(1R[i])){if(!13U&&(1R[i].1O==-1||1R[i].1H==-1)){2V}G 1g=F.v4(1R[i],dd);dd[1R[i].8S]=1g;if(dx!=0||dy!=0){1h(G k=0;k<1g.1b.T;++k){G p=1g.1b[k];1g.1b[k]=1a 1L(p.x+dx,p.y+dy)}}F.9u(1g);F.3h.9u(1g);1g.6x()}}}1h(G i=0;i<dd.T;i++){dd[i].ig(dd)}F.oD();1h(G i=0;i<dd.T;i++){F.13R(dd[i])}}},1kd:H(AP){F.13Z(AP);F.Uc()},Et:H(N){if(F.2m!==N){F.2m=N;F.4z(1t)}},MB:H(){I F.2m},a4:H(3Z){F.zL();G 2W=K.8K.a4(3Z,F);F.oD();I 2W},13X:H(3Z,ba,9I,bh){F.zL();9I=9I||0;ba=ba||zF;bh=bh||0;G 2W=K.8K.a4(3Z,F,{9I:9I,ba:ba,bh:bh});F.oD();I 2W},vS:H(v5,ow,ym){I K.8K.vS(v5,ow,ym,F.2u,F.1X)},1k2:H(4E){if(4E===1F){4E=10}G 1r=F.wA();F.4G(1I.gQ(1r.3R()-4E,1r.3c()-4E,1r.2Z()+4E,1r.3F()+4E))},Hm:H(1g){if(1g==1c){F.Ty();I}if(1n.2D(K.eU,1g)||!1n.2D(K.ao,1g)){I}G iZ=1x;G Hl=F.1d.3R();G HK=F.1d.3c();G HR=F.1d.2Z();G HQ=F.1d.3F();G p9=1g.3a().1T();G pa=12*2h.4T(F.3z);if(F.gs==K.pf.13J){if(p9.3R()<Hl+pa){Hl=p9.3R()-pa;iZ=1t}if(p9.3c()<HK+pa){HK=p9.3c()-pa;iZ=1t}}if(p9.2Z()>HR-pa){HR=p9.2Z()+pa;iZ=1t}if(p9.3F()>HQ-pa){HQ=p9.3F()+pa;iZ=1t}if(iZ){F.4G(1I.gQ(Hl,HK,HR,HQ))}},Ty:H(){G su=F.1d.1T();G 13m=F.1d.1T();1E.1U(F.1R,H(1g){if(su==1I.bo){su=1g.3a().1T()}1k{su=su.8P(1g.3a())}});if(su!=13m){F.4G(1I.gQ(F.1d.3R(),F.1d.3c(),su.2Z(),su.3F()))}},wA:H(){G 1r=1I.bo;1E.1U(F.1R,H(1g){if(1r==1I.bo){1r=1g.3a().1T()}1k{1r=1r.8P(1g.3a())}});I 1r},Ds:H(x,y){G ox=F.gR();G oy=F.gD();G b9=F.EG(1a 1L(x,y));if(F.4b){F.4b.8O=b9.x;F.4b.8R=b9.y}1k{F.2F().4p.8O=b9.x;F.2F().4p.8R=b9.y}if(F.aD){F.aD.x+=F.gR()-ox;F.aD.y+=F.gD()-oy}},CP:H(cb,cd,9w,8L){if(!8L){8L=F.1d}if(cb<8L.3R()){cb=8L.3R()}if(cb>8L.2Z()-9w.1l){cb=1w.2n(8L.2Z()-9w.1l,8L.3R())}if(cd<8L.3c()){cd=8L.3c()}if(cd>8L.3F()-9w.1o){cd=1w.2n(8L.3F()-9w.1o,8L.3c())}F.Ds(cb,cd)},gR:H(){if(F.4b){G b9=1a 1L(F.4b.8O,F.4b.8R)}1k{G b9=1a 1L(F.2F().4p.8O,F.2F().4p.8R)}I F.AH(b9).x},1oo:H(N){G b9=F.EG(1a 1L(N,0));if(F.4b){F.4b.8O=b9.x}1k{F.2F().4p.8O=b9.x}},gD:H(){if(F.4b){G b9=1a 1L(F.4b.8O,F.4b.8R)}1k{G b9=1a 1L(F.2F().4p.8O,F.2F().4p.8R)}I F.AH(b9).y},1ok:H(N){G b9=F.EG(1a 1L(0,N));if(F.4b){F.4b.8R=b9.y}1k{F.2F().4p.8R=b9.y}},Tm:H(){if(F.4b){G b9=1a 1L(F.4b.8O,F.4b.8R)}1k{G b9=1a 1L(F.2F().4p.8O,F.2F().4p.8R)}I F.AH(b9)},lR:H(){G fQ=F.4b?F.4b:F.2F().4p;G 6Q=1a 1L(fQ.8O,fQ.8R);6Q=F.AH(6Q);G 7Y=1a 1L(fQ.8O+fQ.1bX,fQ.8R+fQ.ZU);7Y=F.AH(7Y);I 1I.gK(6Q,7Y)},1oj:H(gS,vr){G 7p=F.EG(vr);G 6E=F.EG(F.Tm());G 4R=K.1M.lO(7p,6E);F.E4(gS);4R=F.AH(4R);F.Ds(vr.x-4R.x,vr.y-4R.y)},13h:H(1r){F.E4(100);G 5C=F.lR();G 3w=1w.2H(5C.1l/1r.1l,5C.1o/1r.1o);F.E4(100*3w);G 2N=1r.2N();5C=F.lR();F.Ds(1w.2n(F.1d.x,2N.x-5C.1l/2),1w.2n(F.1d.y,2N.y-5C.1o/2))},1oC:H(){F.13h(F.wA())},1ov:H(N){F.E4(N)},1nX:H(x,y){F.Ds(x,y)},1nV:H(){I F.kO},1oe:H(N){F.kO=N},1od:H(){I F.jI},14V:H(N){F.jI=N},TD:H(TF){G GO=[];1h(G i=0;i<F.1X.T;i++){G 1i=F.1X[i];if(!1i.aH){2V}1h(G r=0;r<TF.T;r++){G 1r=TF[r];G 8I=F.Ay;G 15G=K.1M.7u(1r,8I,8I);if(15G.hZ(1i.3a())){GO.1f(1i);2i}}}F.pg.jI(GO);GO.1U(H(1i){1i.Jv()})},10z:H(){I F.bT},1oa:H(){I F.ff},Dy:H(N){if(N!=F.ff){F.ff=N;F.1S()}},1o9:H(){I F.s4},15p:H(N){if(F.s4!=N){F.s4=N;F.ff=1c}},1pg:H(){I F.pg},1pf:H(N){F.pg=N},1pk:H(){I F.Ay},1pj:H(N){F.Ay=N},1pi:H(){F.zL();F.pg.jI(F.1X);F.1X.1U(H(1i){1i.Jv()});F.oD()},1de:H(){I F.3h},1pa:H(){I F.mF},1p9:H(N){F.mF=N},1p8:H(){I F.iq},1pd:H(N){F.iq=N},1pc:H(){I F.hf},1pb:H(N){if(F.hf==N){I}F.hf=N;F.4z(1t)},14S:H(){I F.iX},1pu:H(N){if(F.iX==N){I}F.iX=N;F.8p()},R5:H(){I F.ky},1pt:H(N){if(F.ky==N){I}F.ky=N;F.8p();F.4z(1t)},141:H(){I F.hl},14c:H(N){if(F.hl==N){I}F.hl=N;F.BE();F.4z(1t)},BE:H(){1h(G i=0;i<F.2u.T;i++){F.2u[i].BE()}},Db:H(){I F.sc},14a:H(S){if(S!=F.sc){if(F.sc!=1c){F.sc.BE(S)}F.sc=S;if(F.sc!=1c){F.sc.pM()}}},1oT:H(){I F.qi},IN:H(N){if(F.qi==N){I}F.qi=N;F.4z(1t);G 97=K.97;6m(F.qi){2k 97.jw:F.9f=1a K.rU(F);2i;2k 97.14G:F.9f=1a K.uG(F);2i;2k 97.V9:F.9f=1a K.gn(F,H(1m){I 1a K.5p(F.1m)});2i;2k 97.14I:F.9f=1a K.rR(F);2i;2k 97.14P:F.9f=1a K.hd(F,H(1m){I 1a K.5p(F.1m)});2i;2k 97.14Q:F.9f=1a K.gn(F,H(1m){I 1a K.7B(F.1m)});2i;2k 97.14R:F.9f=1a K.hd(F,H(1m){I 1a K.7B(F.1m)});2i;2k 97.14N:F.9f=1a K.gn(F,H(1m){I 1a K.3B(F.1m)});2i;2k 97.14F:F.9f=1a K.hd(F,H(1m){I 1a K.3B(F.1m)});2i;2k 97.14w:F.9f=1a K.gn(F,H(1m){I 1a K.bL(F.1m)});2i;2k 97.14u:F.9f=1a K.hd(F,H(1m){I 1a K.bL(F.1m)});2i;2k 97.pd:F.9f=1a K.vG(F);2i;2k 97.14A:F.9f=1a K.ws(F);2i;2k 97.vk:F.9f=1a K.gn(F,H(1m){G 2R=1n.mY(F.1m.DB);if(!2R){I 1a K.5p(F.1m)}I 1a 2R(F.1m)},H(1m,1O,1H){G 2R=1n.mY(F.1m.DH);if(!2R){I 1a K.4c(F.1m,1O,1H)}I 1a 2R(F.1m,1O,1H)});2i;2k 97.154:F.9f=1a K.gn(F,H(1m){I 1a K.6t(F.1m)});2i;2k 97.14z:F.9f=1a K.hd(F,H(1m){I 1a K.6t(F.1m)});2i;2k 97.14v:F.9f=1a K.gn(F,H(1m){I 1a K.6t(F.1m)});F.9f.vb=1t;2i;2k 97.14y:F.9f=1a K.hd(F,H(1m){I 1a K.6t(F.1m)});F.9f.vb=1t;2i;2k 97.DR:F.9f=1a K.u0(F);2i}},1oN:H(){G mQ=1a fo().BL();G mJ=F.7w;G fM=1a K.m3(F,mQ);fM.mJ=mJ;F.7w=fM;F.i5.i4=fM;G mJ=F.sP;G fM=1a K.tf(F,mQ);fM.mJ=mJ;F.sP=fM;F.x7.i4=fM},1p2:H(){G fM=F.7w;G 14r=fM.4e;F.7w=fM.mJ;F.i5.i4=F.7w;G fM=F.sP;G 14q=fM.4e;F.sP=fM.mJ;F.x7.i4=F.sP;G 4e=14r.YG(14q);H 14h(a,b){if(a.eD<b.eD){I-1}if(a.eD>b.eD){I 1}I 0}4e.8F(14h);I 4e},1mL:H(dL,14g,Us,UC){if(!dL){7r 1a 7M("1mT is 1c.")}if(Us){F.3D(Us);F.8p()}F.6c=1x;G i=-1;if(14g){G 6S=F;if(UC){G Ur=K1(H(){++i;if(i==dL.T-1){F.6c=1t;10p(Ur);5M Ur}I 6S.DP(dL[i])},UC)}1k{F.DP(dL[0]);F.UN(F,dL,1)}}1k{3v(i<dL.T-1){++i;F.DP(dL[i])}F.6c=1t}},UN:H(6S,wB,1y){if(1y>=wB.T){I}G 15r=wB[1y].eD-wB[1y-1].eD;G id=h3(H(){6S.DP(wB[1y]);mB(id);id=1c;if(++1y<wB.T){6S.UN(6S,wB,1y)}1k{6S.6c=1t}},15r)},DP:H(dL){if(dL.9v.PG().7g("sS")>-1){F.sP[dL.9v](dL.mT,dL.sS,1t,dL.N)}1k{F.7w[dL.9v](dL.1Z,dL.5S)}F.UO()},1mf:H(){I F.dV},15I:H(N){if(F.dV==N){I}F.dV=N;F.8p();F.4z(1t)},FB:H(){I F.gy},15H:H(N){if(F.gy!==N){F.gy=N;F.4z(1t)}},1mw:H(){I F.qd},15y:H(N){if(F.qd==N){I}F.qd=N;F.4z(1t);if(F.dV){F.8p()}},12j:H(){I F.fG},15C:H(N){if(F.fG==N){I}F.fG=N;F.4z(1t);if(F.dV){F.8p()}},121:H(){I F.fF},15B:H(N){if(F.fF==N){I}F.fF=N;F.4z(1t);if(F.dV){F.8p()}},1mp:H(){I F.ij},15j:H(N){if(F.ij==N){I}F.ij=N;F.4z(1t);if(F.dV){F.8p()}},1mt:H(){I F.j6},152:H(N){if(F.j6==N){I}F.j6=N;F.4z(1t);if(F.dV){F.8p()}},1nb:H(){I F.qc},155:H(N){if(F.qc==N){I}F.qc=N;F.4z(1t);if(F.dV){F.8p()}},1n3:H(){I F.sN},14T:H(N){if(F.sN==N){I}F.sN=N;F.4z(1t);if(F.dV){F.8p()}},15e:H(1g,1r){I F.UH(1r.5H())},UH:H(1p){if(F.gy){G Ic=F.fG/2;if(K.1M.15g(F.ij)){Ic=F.ij-F.fG*1w.7J(F.ij/F.fG)}G Ii=F.fF/2;if(K.1M.15g(F.j6)){Ii=F.j6-F.fF*1w.7J(F.j6/F.fF)}I 1a 1L(Ic+F.fG*1w.he((1p.x-Ic)/F.fG),Ii+F.fF*1w.he((1p.y-Ii)/F.fF))}I 1p},JE:H(1g,1p,3L){I F.UH(1p)},I9:H(){I F.pV},1jc:H(N){if(F.pV==N){I}F.pV=N;F.8p();F.4z(1t)},mI:H(2p){1h(G i=0,l=F.1R.T;i<l;i++){G 1g=F.1R[i];G 9o=1g.mI(2p);if(9o!==1c){I 9o}}I 1c},1ne:H(N){if(F.fX!==N){F.fX=N;F.4z(1t)}},1nf:H(){I F.fX},1no:H(N){if(F.Bm!==N){F.Bm=N;F.4z(1t)}},1np:H(){I F.Bm},GW:H(1g,1p){if(K.3B.rm){K.3B.UG=1x;G Y6=F.Bl(1p,F.1j6,1g);if(K.3B.UG){I Y6}G 2K=1g.2K;if(2K){G nc=2K.1d;G Bj=1g.8m();if(!nc.2O(Bj)&&!nc.hZ(Bj)){if(!2K.cf){I 1x}G 1W=1a K.6D({S:1g,2K:2K});F.3n(K.2q.LI,1W);if(1W.jG()){I 1x}}}}I 1t},1j6:H(S,g9){if(S==g9){I 1x}I S.UD(g9)},Cw:H(1g,1p){F.Bl(1p,F.1j9,1g)},1j9:H(S,g9){if(S==g9){I 1x}I S.UE(g9)},Bl:H(1p,UF,g9){1h(G i=F.1R.T-1;i>=0;i--){G S=F.1R[i];if(g9==S){2V}if(1n.2D(K.3m,S)&&S.fA()&&!S.gU()&&S.3S(1p)){if(1n.2D(K.3B,S)){G Ir=S.Bl(1p,UF,g9);if(Ir){I 1t}}G l9=UF(S,g9);if(l9){I 1t}}}I 1x},wk:H(N){if(F.1A!==N){F.1A=N;F.1S();F.4z(1t)}},l5:H(){I F.1A},1jo:H(N){if(F.4H!=N){F.4H=N;1E.1U(F.1R,H(1g){1g.1S()});F.4z(1t)}},1n6:H(){I F.4H},kx:H(N){if(F.5r!=N){F.5r=N;F.4z(1t)}},oY:H(){I F.5r},1jp:H(N){F.DB=N},1n1:H(){I F.DB},1jh:H(N){F.DH=N},1n2:H(){I F.DH},1jl:H(N){if(F.sL!=N){F.sL=N;F.1iR()}},1n7:H(){I F.sL},1nc:H(N){if(F.n0!==N){F.n0=N;F.4z()}},1mo:H(){I F.n0!=1F?F.n0:zy},1mz:H(){I F.oS},1jA:H(N){if(F.oS!==N){F.oS=N||0;F.4z(1t)}},uT:H(){I F.gX},1mA:H(N){if(F.gX==N){I}F.gX=N;F.UR("AO");1h(G i=0;i<F.1X.T;i++){G 1i=F.1X[i];1i.1S()}F.1S();F.4z(1t)},1io:H(){I F.q6},1mv:H(N){if(F.q6==N){I}F.q6=N;F.UR("AO");F.1S();F.4z(1t)},GU:H(){I F.lU},1mx:H(N){if(F.lU!==N){F.lU=N;F.1S();F.4z(1t)}},W7:H(){I F.kQ},1me:H(N){if(F.kQ!==N){F.kQ=N;F.1S();F.4z(1t)}},1mg:H(){I F.gs},1jw:H(N){F.gs=N},1mb:H(){I F.q8},1jK:H(N){if(F.q8!=N){F.q8=N;F.xb()}},1md:H(){I F.bv},1hI:H(N){if(F.bv!=N){F.bv=N}},1c2:H(){I F.bp},Jk:H(N){if(F.bp!=N){F.bp=N}},1mh:H(){I F.iI},1hG:H(N){if(F.iI!=N){F.iI=N;F.1S()}},1mm:H(){I F.mb},1hK:H(N){if(F.mb!=N){F.mb=N}},1mn:H(){I F.m4},1hB:H(N){if(F.m4!=N){F.m4=N}},1mk:H(){I F.m2},1hF:H(N){if(F.m2!=N){F.m2=N}},1mM:H(){I F.kY},1hw:H(N){if(F.kY!=N){F.kY=N}},1mN:H(){I F.sj},1hy:H(N){if(F.iI!=N){F.sj=N}},1mJ:H(){I F.eN},Uq:H(N){if(5P N=="av"){N=K.1Q.2e(N)}if(F.eN!=N){F.eN=N;if(F.bM){F.bM.7N(F.eN)}}},1oV:H(){I F.o8},1in:H(N){if(F.o8==N){I}F.o8=N;if(F.iI){F.8p()}},1p7:H(){I F.lI},1iE:H(N){if(F.lI==N){I}F.lI=N;if(F.lI){F.8p()}},1oL:H(){I F.BO},1oM:H(){I F.J6},1iH:H(N){if(F.J6!=N){F.J6=N}},1oI:H(){I F.IE},1iD:H(N){if(F.IE!=N){F.IE=N}},1oJ:H(){I F.Ix},1i5:H(N){if(F.Ix!=N){F.Ix=N;if(N&&N!=K.jn.7H){F.2F().1i9=F.1i4}1k{F.2F().1i9=1c}}},g2:H(){I F.5A!=1c},1i7:H(N){if(F.g2()!=N){F.5A=N?1a K.uQ(F):1c;F.F9()}},1i0:H(N){if(F.9E!==N){F.9E=N;F.1S()}},nh:H(){if(F.9E===1F){I 4}I F.9E},1hZ:H(N){if(F.9A!==N){F.9A=N;F.1S()}},nb:H(){if(F.9A===1F){I 4}I F.9A},1oK:H(N){if(F.jQ!==N){F.jQ=N;F.1S()}},1i3:H(){if(F.jQ===1F){I K.Di.7H}I F.jQ},IH:H(N){if(F.a9!=N){F.a9=N;if(F.a9!=1c&&F.a9!=""){1cx{K.1Q.dt=1t;1a K.ia().5g(F.a9,1n.4C(F,F.GY),1n.4C(F,F.H0))}1cw(GZ){K.1Q.dt=1x;7r GZ}}1k{K.1Q.dt=1x}}},1cv:H(){I F.a9},GY:H(){K.1Q.dt=1x;F.Vd();F.1S()},tp:H(1bU){K.1Q.dt=1x;1E.1U(F.1R,H(1g){if(1g.uD){1g.uD()}})},H0:H(){K.1Q.dt=1x;F.Vd();F.1S()},Vd:H(){if(F.eN&&F.eN.tw()){F.eN=K.1Q.2e(F.eN.id);if(F.bM){F.bM.7N(F.eN)}}if(F.cE&&F.cE.tw()){F.cE=K.1Q.2e(F.cE.id)}if(F.gM&&F.gM.tw()){F.gM=K.1Q.2e(F.gM.id)}if(F.fE&&F.fE.tw()){F.fE=K.1Q.2e(F.fE.id)}},LB:H(){if(!F.LF){I}F.1S();F.Iz=1t},WM:H(1r){if(!F.Iz){I}if(!1r){1r=F.1d}F.1i1(1r);F.Iz=1x},1oO:H(){if(!F.LF){I}G 5e=F.wA();5e=5e.8P(F.1d);F.Iz=1t;F.WM(5e);F.1S()},1i1:H(1r){G kw=[];G 4A=[];1h(G i=0,l=F.2u.T;i<l;i++){if(1r.hZ(F.2u[i].1d)){kw.1f(F.2u[i].1d)}}1h(G i=0,l=F.1X.T;i<l;i++){if(F.1X[i].4A!=1F){1h(G k=0,m=F.1X[i].4A.T;k<m;k++){if(F.1X[i].4A[k].i9){if(1r.hZ(F.1X[i].4A[k].uJ())){4A.1f(F.1X[i].4A[k])}}1k{F.1X[i].4A[k].mk()}}}}1h(G i=0,l=4A.T;i<l;i++){G pt=F.1ih(4A[i],kw);G 1ii=4A[i].Ly(pt);4A[i].1i.1S();kw.1f(1ii)}},1ih:H(5m,kw){5m.mk();G 1r=5m.uJ();G 1d=F.1d.1T();1d=1d.7u(-1r.1l/2,-1r.1o/2);G De=5O.7T;G fY=4*2h.4T(F.3z);G Dc=1a 1L(1r.x+1r.1l/2,1r.y+1r.1o/2);G vr=Dc.1T();G 1i=5m.1i;G 1b=1i.F5(30);1h(G i=0,l=1b.T-1;i<l;i++){G 2I=1b[i];G 4D=1b[i+1];G mR=1a 4u(4D.x-2I.x,4D.y-2I.y);G 1ig=1w.7J(mR.T()/fY);mR=4u.V8(mR,(fY/mR.T()));G Ve=F.1hQ(2I,mR,4D,1ig);1h(G k=0,m=Ve.T;k<m;k++){G 1p=Ve[k];G lv=1a 4u(mR.y,-mR.x);G rv=1a 4u(-mR.y,mR.x);lv=4u.V8(4u.1il(lv,lv.T()),F.UY(1r,lv.1ik())+1);rv=4u.V8(4u.1il(rv,rv.T()),F.UY(1r,rv.1ik())+1);G lp=1p.1T().ki(lv);G rp=1p.1T().ki(rv);G le=F.V7(5m,kw,lp,lp.5y(vr)+((lp.y>rp.y)?1:0));G re=F.V7(5m,kw,rp,rp.5y(vr)+((rp.y>lp.y)?1:0));G 1iw=1a 1I(lp.x-1r.1l/2,lp.y-1r.1o/2,1r.1l,1r.1o);G 1it=1a 1I(rp.x-1r.1l/2,rp.y-1r.1o/2,1r.1l,1r.1o);if(1i.je(1iw)){le+=50}if(1i.je(1it)){re+=50}if(le<De&&1d.3S(lp)){Dc=lp;De=le}if(re<De&&1d.3S(rp)){Dc=rp;De=re}}}I Dc},1hd:H(aD){if(aD||1n.2D(K.u0,F.9f)||F.iI){G p=aD;if(!p){p=F.aD}if(p==1F){I}G c=F.gj(p);G w=1w.he(F.m4/(F.mb/100))*F.3w;G h=1w.he(F.m2/(F.mb/100))*F.3w;G g7=1a 1I(1w.he(c.x-w/2),1w.he(c.y-h/2),w,h);w=F.m4*(1/(F.gS/100));h=F.m2*(1/(F.gS/100));G bG=1a 1I(1w.he(p.x-w/2),1w.he(p.y-h/2),w,h);if(!F.bM){F.bM=1a K.ea(F.eN)}F.bM.uO(bG,0);F.bM.b6="6W";F.bM.b5="6W";F.bM.Fj(F.O);F.O.kk();F.O.1ps(F.2F(),1w.2n(g7.x,0),1w.2n(g7.y,0),1w.2n(g7.1l,1),1w.2n(g7.1o,1),1w.2n(bG.x,0),1w.2n(bG.y,0),1w.2n(bG.1l,1),1w.2n(bG.1o,1));if(F.sj){G 1N={2R:"GD",9P:[{1Z:0,4N:"hT(0,0,0,0)"},{1Z:0.8,4N:"hT(0,0,0,0.1)"},{1Z:0.9,4N:"hT(0,0,0,0.2)"}]};F.bM.b6=1N;F.bM.Fj(F.O)}if(F.kY>0){G 3w=F.3w/(F.gS/100);F.bM.b6="6W";F.bM.b5=F.lI;F.bM.3p=(F.kY+1)*3w;F.bM.Fj(F.O);F.bM.b5=F.o8;F.bM.3p=F.kY*3w;F.bM.Fj(F.O)}}},1hQ:H(2I,fm,4D,1b){G 2W=[];1h(G i=0;i<=1b;++i){2I=J.1B.1L.ki(2I,fm);2W.1f(2I)}if(2W.T==0||!2W[2W.T-1].dI(4D)){2W.1f(4D.1T())}I 2W},V7:H(5m,kw,1p,1hM){G 1r=5m.uJ();1r.DG(1p);1r.4R(-1r.1l/2,-1r.1o/2);G He=0;1h(G i=0,l=kw.T;i<l;i++){if(1r.hZ(kw[i])){G aN=1r.WR(kw[i]);G kc=aN.1l*aN.1o;He=1w.2n(He,kc)}}I He+1hM},UY:H(1r,fm){G 2N=1a 1L(1r.x+1r.1l/2,1r.y+1r.1o/2);G d1=4u.gK(2N,1a 1L(1r.x,1r.y));G d2=4u.gK(2N,1a 1L(1r.x+1r.1l,1r.y));G d3=4u.gK(2N,1a 1L(1r.x+1r.1l,1r.y+1r.1o));G d4=4u.gK(2N,1a 1L(1r.x,1r.y+1r.1o));G vT=[];vT.1f((d1.x*fm.x+d1.y*fm.y)/fm.T());vT.1f((d2.x*fm.x+d2.y*fm.y)/fm.T());vT.1f((d3.x*fm.x+d3.y*fm.y)/fm.T());vT.1f((d4.x*fm.x+d4.y*fm.y)/fm.T());vT.8F();I vT[3]},F9:H(){F.LX=F.g2()&&F.5A.LX();F.MA=F.g2()&&F.5A.MA()},fR:H(){if(F.5A!=1c){F.5A.fR();F.1S()}},fL:H(){if(F.5A!=1c){F.5A.fL();F.1S()}},H8:H(){if(F.5A!=1c){F.5A.B4()}},oD:H(){if(F.5A!=1c){F.5A.BB(1t)}},1iK:H(){if(F.5A!=1c){F.5A.BB(1x)}},UU:H(kT){if(F.5A!=1c){if(YF.1a3(kT)){1h(G i=0;i<kT.T;i++){G 1g=kT[i];G 6i=1a K.kE(F,1g);F.5A.f4(6i)}}1k{if(1n.2D(9x,kT)){kT.1U(H(1g){G 6i=1a K.kE(F,1g);F.5A.f4(6i)},F)}1k{if(1n.2D(K.ao,kT)){G 6i=1a K.kE(F,kT);F.5A.f4(6i)}}}}},f4:H(6i){if(F.5A!=1c){F.5A.f4(6i)}},1jM:H(1g){I F.5A==1c?1c:1a K.kE(F,1g)},1jv:H(6i){if(F.5A!=1c&&6i!=1c){F.5A.f4(6i)}},zL:H(){if(F.5A!=1c){F.5A.B4();1h(G i=0,l=F.1R.T;i<l;i++){G 6i=1a K.kE(F,F.1R[i]);F.5A.f4(6i)}}},Ha:H(){I F.l3}};H 1jx(1R,1p){I 1R.1bt(H(1g){I 1g.3S(1p)})}H Dq(1R,1p){G V6=1jx(1R,1p);V6.8F(1jC);I V6}H GT(1R,1p,sD,os,w7){G V1=Dq(1R,1p);1h(G i=V1.T-1;i>=0;i--){G 1g=V1[i];if(sD&&!1g.jj()){2V}if(os&&1g.we()){2V}if(1g.fA()){G TH=1g.aY(1p,0,w7,os);if(TH!=1c){I TH}}}I 1c}H 1jC(e1,e2){G i1=e1.sJ();if(i1===1F){i1=5O.7T}G i2=e2.sJ();if(i2===1F){i2=5O.7T}if(i1<i2){I-1}if(i1>i2){I 1}I 0}4n.ns="J.1e";J.2x(4n,"J.1e.4n",J.1B.Jp)})(J.1e);J.1e.4n.mZ=H(TE,5R,kn){J.1e.4n.U3[5R]=TE;TE.sh={5R:5R,kn:kn}};J.1e.4n.U3=1a J.3X.3o();J.1e.4n.Iv=H(1u){I 1n.DO(J.1e.4n,1c,1c,1c,1u)};J.1e.4n.uN=H(id,1j){I 1n.wS(id,1j)};(H(K){G 2h=J.1B.2h;G 1I=J.1B.1I;G 3U=J.1B.3U;G 1L=J.1B.1L;G 6F=J.1B.6F;G jD=J.1B.jD;G 1E=J.3X.1E;G 4w=J.1e.4w;G 4c=K.4c=H(1j,1O,1H){K.4n.9L=1t;1n.2T(4c,F,[1j]);F.2g=K.6j.xe;F.1b=[];F.1b.1f(1a 1L(0,0));F.1b.1f(1a 1L(20,20));F.gv=[];F.7t=5;F.7s=5;F.12x(aZ);F.1oc={};F.1nW={};F.rq(K.2j.DZ());F.1P="";F.4q=4w.7z;F.bF=K.jC.7z;F.7S=1a 6F(0,0);if(1j){if(1j.g3!==1F){F.7N(1j.g3)}if(1j.gB!==1F){F.Bg(1j.gB)}F.7t=1j.nZ;F.7s=1j.o5;if(1j.fE){F.wE(1j.fE)}if(1j.gM){F.rq(1j.gM)}if(1j.kO!=1F){F.de=1j.kO}if(1j.hf!=1F){F.bF=1j.hf}}F.Eo=1a J.1B.1I(F.1b[0].x-F.7t/2,F.1b[0].y-F.7t/2,F.7t,F.7t);F.Ca=1a J.1B.1I(F.1b[F.1b.T-1].x-F.7s/2,F.1b[F.1b.T-1].y-F.7s/2,F.7s,F.7s);if(1j&&4c.FE===1x){F.9e(1j.mW);F.CX(1j.mM);F.D0(1j.mM)}F.5N=1a J.1e.tG(F);F.5N.bF=F.bF;F.5N.4q=K.4w.7z;F.Bh();if(1j){F.aH=1j.jI}K.4n.9L=1x};4c.1s={1T:H(){K.4n.9L=1t;G 1K=1n.2o(4c,F,"1T",[]);1K.1b=1E.1T(F.1b);1K.2g=F.2g;1K.aH=F.aH;1K.de=F.de;1K.8r=F.8r;1K.5N=F.5N.1T();1K.1P=F.1P;1K.bF=F.bF;1K.7t=F.7t;1K.7s=F.7s;1K.wE(F.9d);1K.rq(F.7x);1K.CX(F.gb);1K.D0(F.g5);1K.hz=F.Ws();1K.hA=F.Wq();1K.fr=F.Wp();1K.6x();1K.Bh();if(F.4A!=1F){1K.4A=[];1h(G i=0,l=F.4A.T;i<l;i++){G 5m=F.4A[i].1T();5m.1i=1K;1K.4A.1f(5m)}}K.4n.9L=1x;I 1K},3q:H(){G 1q=1n.2o(4c,F,"3q",[]);1q.1O=(F.1O)?F.1O.8S:-1;1q.1H=(F.1H)?F.1H.8S:-1;1q.3A=F.3A.gm;1q.3J=F.3J.gm;1q.TL=F.Xc();1q.TM=F.Xd();1q.wx=F.1b;1q.2g=F.2g;1q.9d=(F.9d)?F.9d.id:1c;1q.7x=(F.7x)?F.7x.id:1c;1q.7t=F.7t;1q.7s=F.7s;1q.gb=F.1iz()||1c;1q.g5=F.1ia()||1c;1q.hz=F.Ws();1q.hA=F.Wq();1q.fr=F.Wp();1q.de=F.de;1q.8r=F.8r;1q.bF=F.bF;1q.aH=F.aH;if(F.3A.4Z){1q.jr=F.3A.4Z.1y}if(F.3J.4Z){1q.jv=F.3J.4Z.1y}if(F.4A!=1F){G 4A=[];1h(G i=0,l=F.4A.T;i<l;i++){4A.1f(F.4A[i].3q())}1q.4A=4A}I 1q},3D:H(1q){1n.2o(4c,F,"3D",[1q]);if(1q.2g!==1F){F.7N(1q.2g)}if(1q.bF!==1F){F.U9(1q.bF)}F.wE(1q.9d?K.1Q.2e(1q.9d):1c);if(1q.gb){F.CX(1q.gb)}if(1q.7t){F.WN(1q.7t)}F.rq(1q.7x?K.1Q.2e(1q.7x):1c);if(1q.g5){F.D0(1q.g5)}if(1q.7s){F.Kd(1q.7s)}if(1q.hz){F.1if(1q.hz)}if(1q.hA){F.1ie(1q.hA)}if(1q.fr!=1c){F.1id(1q.fr)}if(1q.TL!==1F){F.3A.kX(1q.TL,1x)}if(1q.TM!==1F){F.3J.kX(1q.TM,1x)}G TB=1a J.1B.1L(1q.3A.x,1q.3A.y);G Tq=1a J.1B.1L(1q.3J.x,1q.3J.y);if(!TB.bo()){F.3A.gm=TB}if(!Tq.bo()){F.3J.gm=Tq}F.Gk(1q.wx,1t);if(1q.jr!==1F){F.3A.4Z.1y=1q.jr}if(1q.jv!==1F){F.3J.4Z.1y=1q.jv}if(1q.4A){F.4A=[];1h(G i=0,l=1q.4A.T;i<l;i++){G 5m=1a K.tW(F);5m.3D(1q.4A[i]);F.4A.1f(5m)}}F.de=1q.de;F.8r=1q.8r;if(1q.aH!=1F){F.aH=1q.aH}},5g:H(1v,O){1n.2o(4c,F,"5g",[1v,O]);G g3=O.Tr<16?O.3Q("2E",1v,F.2g):O.3Q("1Q",1v,F.2g);F.7N(g3);F.1iX(O.1gP("t6",1v));if(F.3A.kX){F.3A.kX(O.3Q("1jk",1v),1t)}if(F.3J.kX){F.3J.kX(O.3Q("1ja",1v),1t)}F.3A.4Z.1y=O.3Q("1iL",1v);F.3A.4Z.1p=F.jt();F.3J.4Z.1y=O.3Q("1iU",1v);F.3J.4Z.1p=F.fB();F.de=O.4v("1j7",1v);F.aH=O.4v("1jf",1v);F.8r=O.4v("1j5",1v);F.U9(O.3Q("1jb",1v));if(O.kn>1){F.wE(O.wV("TA",1v));F.rq(O.wV("Tx",1v))}1k{F.wE(O.DX("TA",1v));F.rq(O.DX("Tx",1v))}F.Kd(O.5k("1jn",1v));F.WN(O.5k("1jm",1v));F.g5=O.9r("1ji",1v);F.gb=O.9r("1jj",1v);G ne=O.nF("1oy",1v);if(ne){F.hz=ne.1N;F.hA=ne.1l;F.fr=ne.6X}1k{F.hz=O.9r("1iN",1v);F.hA=O.5k("1j2",1v);F.fr=J.1B.jD[O.a7("Tw",1v)];if(F.fr===1F){F.fr=O.3Q("Tw",1v)}}G EE=O.PX(1v,"1j1");if(EE){F.4A=[];G Ts=EE.7U("1j3");1h(G i=0;i<Ts.T;++i){G Hy=Ts[i];G 5m=1a K.tW(F);5m.5g(Hy,O);4A.1f(5m)}}},5u:H(1v,O){1n.2o(4c,F,"5u",[1v,O]);O.wQ(1n.2D(K.bS,F.3A.S)?1c:F.3A.S,"1ge",1v);O.Q6(F.3A.gm,"1oH",1v);O.4r(F.HU(),"1iL",1v);O.wQ(1n.2D(K.bS,F.3J.S)?1c:F.3J.S,"1gh",1v);O.Q6(F.3J.gm,"1on",1v);O.4r(F.HT(),"1iU",1v);if(F.3A.kX){O.4r(F.3A.1J,"1jk",1v)}if(F.3J.kX){O.4r(F.3J.1J,"1ja",1v)}O.4r(F.qR(),"1Q",1v);O.4r(F.kl(),"1ou",1v);O.1gQ(F.1b,"t6",1v);O.4o(F.de,"1j7",1v);O.4o(F.aH,"1jf",1v);O.4o(1t,"1op",1v);O.4o(F.8r,"1j5",1v);O.4r(F.1iZ(),"1jb",1v);O.xf(F.1im(),"TA",1v);O.xf(F.1iI(),"Tx",1v);O.5w(F.1iA(),"1jn",1v);O.5w(F.1iq(),"1jm",1v);O.9k(F.g5,"1ji",1v);O.9k(F.gb,"1jj",1v);if(F.hz!==1F){O.9k(F.hz,"1iN",1v)}if(F.hA!==1F){O.5w(F.hA,"1j2",1v)}if(F.fr!==1F){O.4r(F.fr,"Tw",1v)}if(F.4A){G EE=O.3i("1j1",1v);4A.1U(H(5m){G Hy=O.3i("1j3",EE);5m.5u(Hy,O)})}},1S:H(){1n.2o(4c,F,"1S");if(F.4A){1h(G i=0,l=F.4A.T;i<l;i++){F.4A[i].1S()}}},7N:H(N){if(F.2g!=N){G dO=F.kl();F.2g=N;if(F.TT()&&F.2g==K.6j.bZ){F.Bg(3)}1k{if(F.2g==K.6j.bZ&&dO==1){F.Bg(2)}1k{F.Bg(dO)}}if(F.TT()){F.df().ur(F,1t)}if(!F.df().u6(F)){F.df().e3(F,F.jt(),F.fB())}F.Ch();F.1S()}},qR:H(){I F.2g},df:H(){I 2j[F.2g]},1iX:H(N){F.1b=N;F.6x();F.6I()},1ke:H(){I F.1b},U9:H(N){if(F.bF!=N){F.bF=N;F.Bh();F.1S();F.6I()}},1iZ:H(){I F.bF},b7:H(N){if(F.4q!=N){F.4q=N;F.Bh();F.1S();F.6I()}},ec:H(){I F.4q},t4:H(){I F.1P},aJ:H(N){if(N!=1F&&N!==F.1P){F.1P=N+"";F.1S()}},8V:H(){I F.1P},ED:H(2p,5D){G 1W=1a K.aq({1i:F,2p:2p,5D:5D});F.1j.3n(K.2q.Ko,1W);I 1W.h6()},EM:H(2p,5D){G 1W=1a K.aq({1i:F,2p:2p,5D:5D});F.1j.3n(K.2q.Jl,1W);I 1W.h6()},tC:H(){F.1b[0]=F.3A.mf();F.1b[F.1b.T-1]=F.3J.mf();if(!F.3A.vL(F.3J)){F.1b[0]=F.3A.ez(F.1b[0],F.1b[1]);F.1b[F.1b.T-1]=F.3J.ez(F.1b[F.1b.T-1],F.1b[F.1b.T-2])}F.3A.fO();F.3J.fO()},R9:H(){F.1b[0]=F.3A.mf();if(!F.3A.vL(F.3J)){F.1b[0]=F.3A.ez(F.1b[0],F.1b[1])}F.3A.fO();F.6x();if(F.aH){F.8N({6x:1x})}},Ra:H(){F.1b[F.1b.T-1]=F.3J.mf();if(!F.3A.vL(F.3J)){F.1b[F.1b.T-1]=F.3J.ez(F.1b[F.1b.T-1],F.1b[F.1b.T-2])}F.3J.fO();F.6x();if(F.aH){F.8N({6x:1x})}},1hJ:H(){1h(G i=0,l=F.1b.T-1;i<l;i++){G p1=F.1b[i];G p2=F.1b[i+1];F.1d=F.3a();F.gv.1f(1L.1kb(p1,p2));G 1ka=1L.ki(p1,{x:F.7t/2,y:F.7t/2});G 1k9=1L.ki(p2,{x:F.7t/2,y:F.7t/2});if(i===0){F.Eo=1a J.1B.1I(p1.x-F.7t/2,p1.y-F.7t/2,F.7t,F.7t)}if(i===F.1b.T-2){F.Ca=1a J.1B.1I(p2.x-F.7s/2,p2.y-F.7s/2,F.7s,F.7s)}}},cA:H(2A){1n.2o(4c,F,"cA",[2A]);if(2A.8t===K.9Q.gF&&F.3A!=1c){F.3A.F7(2A.9q);F.1b[0]=F.3A.4Z.1p;F.6x()}},eW:H(2A){G 3L=2A.3f.1y;G f9=2A.6b.1V(F).wx;G 1jI=1a 1L(f9[3L].x,f9[3L].y);G 1p=1jI.ki(2A.9b());G Uj=(3L===0||3L===F.1b.T-1);if(Uj){F.1js(1p,3L>0)}G 1jG=Uj&&F.es!=1c&&!1n.2D(K.bS,F.es.S);F.1b[3L]=1p=1jG?F.es.4Z.1p:1p;if(2A.8t===K.9Q.gF){F.Jf();if(!F.df().u6(F)){F.df().e3(F,F.jt(),F.fB())}}1k{F.df().CD(F,1p,2A)}if(F.de&&F.2g!=K.6j.bZ&&F.1b.T>2&&(3L==1||3L==F.1b.T-2)){F.rP()}F.6x(1t,f9)},ja:H(2A){G 1k8=1x;G 3L=2A.3f.1y;G ck=2A.ck;if(3L===0||3L===F.1b.T-1){if(3L===0){F.119(F.es)}1k{if(3L===F.1b.T-1){F.12H(F.es)}}F.3A.fO();F.3J.fO();F.1O=F.3A.S;F.1H=F.3J.S;if(2A.8t===K.9Q.gF){if(F.1O==F.1H&&!1n.2D(K.bS,F.1O)){F.11f()}1k{F.Jf();if(!F.df().u6(F)){F.df().e3(F,F.jt(),F.fB())}}}if(F.aH){F.8N({6x:1x})}}F.6x()},lJ:H(2A){G Bq=2A.3f.1y;if(Bq!==0&&Bq!==(F.1b.T-1)){I 1t}if(F.es==1c){I F.1j.iq}if(!F.es.S.bD&&Bq===F.1b.T-1){I 1x}if(!F.1j.j5){if(Bq==0&&F.1H==F.es.S){I 1x}if(Bq==F.1b.T-1&&F.1O==F.es.S){I 1x}}I 1t},lY:H(){I{wx:1E.1T(F.1b)}},tk:H(2A){G 1G=2A.6b.1V(F);if(1G!=1c){G 1jB=F.1b;F.1b=1G.wx;F.6x(1t,1jB)}},1js:H(1p,4X){G 4I=F.1j.qT(1p,1t,1t);if(4I==1c){4I=F.1j.1jz(1p,F.1j.KL,(4X)?F.1O:F.1H,1t)}if(4I!=1c){if(4X&&!4I.bD||!4X&&!4I.bY){4I=1c}}if(4I==1c&&F.1j.iq){4I=F.E9()}if(4I){if(F.es==1c||(F.es!=1c&&F.es.Nx(4I,1p))){F.es=4I.BJ(F,1p,4X)}if(F.es!=1c){F.es.F7(1p)}I}F.es=1c},nu:H(1p){G EQ=1a J.1B.6F(100,25/F.1j.3w);I 1a J.1B.1I(1p.x-EQ.1l/2,1p.y-EQ.1o/2,EQ.1l,EQ.1o)},1hA:H(1O,ai){G Kv=ai?1x:1t;if(F.3A!=1c){F.3A.kW();F.3A=1c}F.1O=1O;if(F.1O!=1c){if(!ai){ai=1O.E6(F.fB(),F,1x)}F.3A=F.1O.BJ(F,ai.1p,1x,1t);F.3A.4Z=ai;F.1b[0]=ai.1p}if(Kv){F.3A.kR();if(F.HU()==-1){F.tC()}F.df().pQ(F,1t);F.1S()}},kM:H(){I F.1O},Gr:H(1y){G ai=F.1O.TR(1y);if(!ai){I}F.3A.4Z=ai;F.1b[0]=ai.1p;F.df().pQ(F,1t);F.1S()},HU:H(){if(!F.3A.4Z){I-1}1k{I F.3A.4Z.1y}},1hE:H(1H,ai){G Kv=ai?1x:1t;if(F.3J!=1c){F.3J.kW();F.3J=1c}F.1H=1H;if(F.1H!=1c){if(!ai){ai=1H.E6(F.jt(),F,1t)}F.3J=F.1H.BJ(F,ai.1p,1t,1t);F.3J.4Z=ai;F.1b[F.1b.T-1]=ai.1p;F.3J.fO()}if(Kv){F.3J.kR();if(F.HT()==-1){F.tC()}F.df().pQ(F,1t);F.1S()}},kD:H(){I F.1H},Gp:H(1y){G ai=F.1H.TR(1y,1t);if(!ai){I}F.3J.4Z=ai;F.1b[F.1b.T-1]=ai.1p;F.df().pQ(F,1t);F.1S()},HT:H(){if(!F.3J.4Z){I-1}1k{I F.3J.4Z.1y}},1jV:H(){if(F.1O==1c||1n.2D(K.bS,F.1O)){I 1x}if(F.1H==1c||1n.2D(K.bS,F.1H)){I 1x}I 1t},TT:H(){I F.3A!=1c&&F.3J!=1c&&F.3A.1jr(F.3J)},Hr:H(){F.2g=K.6j.xe;F.1b.T=2;F.tC();F.6x()},sF:H(1b,dx,dy,tC,Jx){if(!1b){F.Hr();I}F.1b=[];1h(G i=0,l=1b.T;i<l;i++){G p=1b[i];F.1b.1f(1a 1L(p.x+dx,p.y+dy))}if(tC){F.tC();F.6x()}if(!Jx){F.df().GG(F)}},rP:H(){if(F.de&&F.1O!=F.1H){F.Wy(K.9Q.jw,1x);if(K.3B.rm){G 1hH=K.3B.oJ(F.kM());if(1hH!=1c){F.1b[0]=F.3A.Ed();if(F.2g==K.6j.bZ){Ap.IF(F)}}G 1hL=K.3B.oJ(F.kD());if(1hL!=1c){F.1b[F.1b.T-1]=F.3J.Ed();if(F.2g==K.6j.bZ){Ap.1jU(F)}}}}1k{F.1b[0]=F.3A.Ed();F.1b[F.1b.T-1]=F.3J.Ed()}F.df().pQ(F,1x)},6x:H(){G lB=1t;if(aZ.T>0){lB=aZ[0]}G KE=1c;if(aZ.T>1){KE=aZ[1]}F.gv=[];F.1hJ();if(lB){if(F.3A!=1c){F.3A.fO()}if(F.3J!=1c){F.3J.fO()}}if(F.9d){if(!F.9V){F.9V=1a K.ea(F.9d)}F.9V.uO(F.Eo,F.gv[0]+90)}if(F.7x){if(!F.7n){F.7n=1a K.ea(F.7x)}F.7n.uO(F.Ca,F.gv[F.gv.T-1]+90)}G 1j=F.4Y();if(1j&&1j.uT()!=K.kF.mi){if(KE){G ru=F.WJ(KE);ru=ru.8P(F.3a());F.Ch(ru)}1k{F.Ch()}}F.1S()},1hC:H(){if(F.3A!=1c){F.3A.kR()}if(F.3J!=1c){F.3J.kR()}},119:H(KH){G An=F.3A;F.3A=KH;if(An!=1c){An.kW()}F.3A.kR()},12H:H(KH){G An=F.3J;F.3J=KH;if(An!=1c){An.kW()}F.3J.kR()},7F:H(1p){if(!F.1j){I 1c}G 1Y=F.pz();G mm=2h.4T(F.1j.3z);G TZ=F.1b;G 1r=1a 1I(0,0,1Y,1Y);if(F.1j){1r=1r.7u(F.1j.pB)}1h(G i=0;i<TZ.T;++i){1r.1k1(TZ[i]);if(1r.3S(1p)){I{1g:F,1y:i}}}},12x:H(1D){if(1D.T===0){I}F.1j=1D[0];if(1D[1]&&1n.2D(K.3m,1D[1])){F.1O=1D[1];F.1hA(F.1O,F.1O.E6(F.1O.9J(),F,1x))}1k{G 1p=1D[1]&&1n.2D(1L,1D[1])?1D[1]:F.1b[0];F.3A=1a K.ts(F,1x,1p);F.1O=F.E9()}if(1D[2]&&1n.2D(K.3m,1D[2])){F.1H=1D[2];F.1hE(F.1H,F.1H.E6(F.1H.9J(),F,1t))}1k{G 1p=1D[2]&&1n.2D(1L,1D[2])?1D[2]:F.1b[F.1b.T-1];F.3J=1a K.ts(F,1t,1p);F.1H=F.E9()}F.tC();F.6x();F.Wy(K.9Q.jw,1x)},1jN:H(N){F.1b[0]=N},jt:H(){I F.1b[0].1T()},1jS:H(N){F.1b[F.1b.T-1]=N},fB:H(){I F.1b[F.1b.T-1].1T()},Dg:H(3L){I F.1b[3L]},1ac:H(){I F.7i.1ab.ek},E9:H(){if(F.1j){I F.1j.9U}I 1a K.bS()},3S:H(1p){G 1r=F.3a();G Er=-1;if(F.1j.oS!=0){Er=F.1j.oS}1k{Er=K.1M.1jQ(F.1j.3z)}G 7u=Er/2;G eb=Er*2/3;if(F.Xj(1p)!=1c){I 1t}1r=K.1M.7u(1r,7u,7u);if(!1r.3S(1p)){I 1x}if(F.df().3S(F,1p,eb)){I 1t}if(F.aO&&F.7F(1p)){I 1t}I 1x},3a:H(){I F.WJ(F.1b)},WJ:H(1b){G p1=1b[0];G p2=1b[1b.T-1];G l=1w.2H(p1.x,p2.x);G r=1w.2n(p1.x,p2.x);G t=1w.2H(p1.y,p2.y);G b=1w.2n(p1.y,p2.y);1h(G i=1;i<1b.T-1;++i){l=1w.2H(l,1b[i].x);t=1w.2H(t,1b[i].y);r=1w.2n(r,1b[i].x);b=1w.2n(b,1b[i].y)}I 1a J.1B.1I(l,t,r-l,b-t)},Bh:H(){if(!F.1j){I}G 5b=J.c7;F.5N.Ys();F.7S=F.1j.dG(F.1P,F.hH());G dO=F.kl();if(F.bF==K.jC.iN){G pt=1w.7J(F.1b.T/2-1);G mX=1;G Bi=pt;G r=0,a=0,Bd=0;if(F.2g!=K.6j.bV){if(F.2g==K.6j.bZ||(F.2g==K.6j.xe&&dO%2==1)){do{G ar=5b.LH(F.1b[pt],F.1b[pt+1]);a=ar.a;r=ar.r;if(r>Bd){Bd=r;Bi=pt}pt=pt+mX;mX=-K.1M.zs(mX)*(1w.4L(mX)+1);if(pt<0||pt>=F.1b.T-1){2i}}3v(F.7S.1l>r);pt=Bi;x=(F.1b[pt].x+F.1b[pt+1].x)/2;y=(F.1b[pt].y+F.1b[pt+1].y)/2}1k{pt=pt+1;x=F.1b[pt].x;y=F.1b[pt].y}}1k{if(dO%2==1){pt=1w.7J((pt+1)/4);G jF=K.1M.lM(F.1b,pt,0.5);x=jF.x;y=jF.y}1k{pt=1w.7J((pt+1)/4);G jF=F.1b[(pt+1)*3];x=jF.x;y=jF.y}}if(F.2g!=K.6j.bV){if(F.2g==K.6j.bZ||(F.2g==K.6j.xe&&dO%2==1)){G 4W=F.1b[pt];G 4Q=F.1b[pt+1];G ar=5b.dP(4W,4Q);a=ar.a;r=ar.r}1k{G r1=0,a1=0;G ar=5b.dP(F.1b[pt-1],F.1b[pt]);a=ar.a;r=ar.r;G ar=5b.dP(F.1b[pt],F.1b[pt+1]);a1=ar.a;r2=ar.r;a=(a+a1)/2}}1k{if(dO%2==1){G 4W=K.1M.lM(F.1b,pt,0.45);G 4Q=K.1M.lM(F.1b,pt,0.55);G ar=5b.dP(4W,4Q);a=ar.a;r=ar.r}1k{G 4W=K.1M.lM(F.1b,pt,0.95);G 4Q=K.1M.lM(F.1b,pt+1,0.Yt);G ar=5b.dP(4W,4Q);a=ar.a;r=ar.r}}a=180-a;if(a>90&&a<11z){a-=180}F.5N.na.1f(F.1P);F.5N.gv.1f(a);F.5N.gz.1f(1a 1I(x,y,F.7S.1l,F.7S.1o))}1k{if(F.bF==K.jC.7z){if(F.1b.T%2==1){x=F.1b[1w.7J(F.1b.T/2)].x;y=F.1b[1w.7J(F.1b.T/2)].y}1k{x=F.1b[F.1b.T/2-1].x+F.1b[F.1b.T/2].x;y=F.1b[F.1b.T/2-1].y+F.1b[F.1b.T/2].y;x/=2;y/=2}F.5N.na.1f(F.1P);F.5N.gv.1f(0);F.5N.gz.1f(1a 1I(x,y,F.7S.1l,F.7S.1o))}1k{if(F.bF==K.jC.12r){G 4q=4w.7z;G 4i=4w.7z;G xg=F.1hu();G hQ=F.1hg(xg).1T();G fD=F.1hc(xg).1T();G dx=1w.4L(hQ.x-fD.x);G dy=1w.4L(hQ.y-fD.y);if(dx>dy*1.3&&F.4q!=4w.7z){if(hQ.x<fD.x&&F.4q==4w.bi){4q=4w.bi;hQ.y-=F.7S.1o/2;hQ.x+=F.7s;F.5N.gz.1f(1a 1I(hQ.x,hQ.y,F.7S.1l,F.7S.1o))}1k{if(hQ.x>fD.x&&F.4q==4w.gE){4q=4w.bi;fD.y-=F.7S.1o/2;fD.x+=F.7s;F.5N.gz.1f(1a 1I(fD.x,fD.y,F.7S.1l,F.7S.1o))}1k{if(hQ.x<fD.x&&F.4q==4w.gE){4q=4w.gE;fD.x-=F.7s;F.5N.gz.1f(1a 1I(fD.x-F.7S.1l,fD.y-F.7S.1o/2,F.7S.1l,F.7S.1o))}1k{4q=4w.gE;hQ.x-=F.7s;F.5N.gz.1f(1a 1I(hQ.x-F.7S.1l,hQ.y-F.7S.1o/2,F.7S.1l,F.7S.1o))}}}}1k{G 2N=F.1hf(xg);F.5N.gz.1f(1a 1I(2N.x,2N.y,F.7S.1l,F.7S.1o))}F.5N.na.1f(F.1P);F.5N.gv.1f(0);F.5N.4q=4q;F.5N.4i=4i}1k{if(F.bF==K.jC.1hR){F.5N.4q=4w.bi;F.5N.4i=4w.bi;G bU=1E.1T(F.1b);G 2I=0;if(F.2g==K.6j.bV){G 2w=[];F.df().qE(F,2w);G zn=K.1M.1af();1h(G i=0;i<2w.T;i++){2w[i].sH(zn)}bU=zn.1ae();2I=1}if(bU[0].x>bU[bU.T-1].x){1h(G i=0;i<bU.T/2;i++){G t=bU[i];bU[i]=bU[bU.T-i-1];bU[bU.T-i-1]=t}}G qV=F.7S.1o;G 9q=bU[0];1h(G i=2I;i<bU.T-1;i++){G p=bU[i];G t=bU[i+1];G ar=5b.dP(t,p);G a=ar.a;G r=ar.r;G 4J=0;G a2=0;G r2=0;if(i<bU.T-2){G p2=bU[i+1];G t2=bU[i+2];G ar=5b.dP(p2,t2);a2=ar.a;r2=ar.r;if(a2<a){a2+=f5}4J=a2-a}G rr=0;G aa=0;G ar=5b.dP(9q,t);aa=ar.a;rr=ar.r;G d1=9q;G d2=t;G d3=1a 1L(0,0);G d4=1a 1L(0,0);G 1l;if(4J<180){d4=5b.fe(d1,{a:a-90,r:qV});d3=5b.fe(d2,{a:a-90,r:qV});1l=rr;9q=t}1k{d4=5b.fe(d1,{a:a-90,r:qV});G WF=(f5-4J)/2;G xx=qV/1w.nk(K.1M.GL(WF));G oO=1w.i7(1w.a5(xx,2)-1w.a5(qV,2));if(oO>rr){oO=rr;xx=1w.i7(1w.a5(oO,2)+1w.a5(qV,2))}d3=5b.fe(d2,{a:a-WF,r:xx});d2=5b.fe(d2,{a:a,r:oO});1l=rr-oO;if(oO>r2){oO=r2}9q=5b.fe(t,{a:a2,r:oO})}F.5N.gz.1f(1a 1I(d4.x,d4.y,1l,qV));F.5N.gv.1f(180-a)}G Em=F.1P;1h(G i=0;i<F.5N.gz.T;i++){G a0=F.5N.gz[i];G kp=F.kj(Em,a0.1l,F.hH());if(kp==0){F.5N.na.1f("");2V}G 1hi=Em.c8(0,kp);Em=Em.c8(kp);F.5N.na.1f(1hi)}}1k{if(F.bF==K.jC.1hm){if(F.1b.T%2==1){G Lb=1w.7J(F.1b.T/2);G cp=F.1b[Lb];G pp=F.1b[Lb-1];G np=F.1b[Lb+1];if(5b.5y(cp,pp)>5b.5y(cp,np)){x=(pp.x+cp.x)/2;y=(pp.y+cp.y)/2}1k{x=(np.x+cp.x)/2;y=(np.y+cp.y)/2}}1k{x=F.1b[F.1b.T/2-1].x+F.1b[F.1b.T/2].x;y=F.1b[F.1b.T/2-1].y+F.1b[F.1b.T/2].y;x/=2;y/=2}F.5N.na.1f(F.1P);F.5N.gv.1f(0);F.5N.gz.1f(1a 1I(x,y,F.7S.1l,F.7S.1o))}1k{if(F.bF==K.jC.1iu){G pt=1w.7J(F.1b.T/2-1);G mX=1;G Bi=pt;G r=0,a=0,Bd=0;if(F.2g!=K.6j.bV){do{G ar=5b.dP(F.1b[pt],F.1b[pt+1]);a=ar.a;r=ar.r;if(r>Bd){Bd=r;Bi=pt}pt=pt+mX;mX=-K.1M.zs(mX)*(1w.4L(mX)+1);if(pt<0||pt>=F.1b.T-1){2i}}3v(F.7S.1l>r);pt=Bi;x=(F.1b[pt].x+F.1b[pt+1].x)/2;y=(F.1b[pt].y+F.1b[pt+1].y)/2}1k{if(dO%2==1){pt=1w.7J((pt+1)/4);G jF=K.1M.lM(F.1b,pt,0.5);x=jF.x;y=jF.y}1k{pt=1w.7J((pt+1)/4);G jF=F.1b[(pt+1)*3];x=jF.x;y=jF.y}}if(F.2g!=K.6j.bV){G 4W=F.1b[pt];G 4Q=F.1b[pt+1];G ar=5b.dP(4W,4Q);a=ar.a;r=ar.r}1k{if(dO%2==1){G 4W=K.1M.lM(F.1b,pt,0.45);G 4Q=K.1M.lM(F.1b,pt,0.55);G ar=5b.dP(4W,4Q);a=ar.a;r=ar.r}1k{G 4W=K.1M.lM(F.1b,pt,0.95);G 4Q=K.1M.lM(F.1b,pt+1,0.Yt);G ar=5b.dP(4W,4Q);a=ar.a;r=ar.r}}a=180-a;if(a>90&&a<11z){a-=180}F.5N.na.1f(F.1P);F.5N.gv.1f(a);F.5N.gz.1f(1a 1I(x,y,F.7S.1l,F.7S.1o))}}}}}}},je:H(1r){G fP=F.3a();if(!fP.hZ(1r)){I 1x}if(1r.2O(fP)){I 1t}1h(G i=0,l=F.1b.T;i<l;i++){if(1r.3S(F.1b[i])){I 1t}}G vA=[];vA.1f(1a 1L(1r.x,1r.y));vA.1f(1a 1L(1r.2Z(),1r.y));vA.1f(1a 1L(1r.2Z(),1r.3F()));vA.1f(1a 1L(1r.x,1r.3F()));1h(G i=0,n=F.1b.T-1;i<n;++i){1h(G j=0;j<4;++j){G a1=F.1b[i];G a2=F.1b[i+1];G r1=vA[j];G r2=vA[(j+1)%4];if(K.1M.WR(a1,a2,r1,r2)){I 1t}}}I 1x},8m:H(){I F.3a()},uD:H(){F.6e.pG=F},kr:H(){G 2w=F.6e.2w=[];if(F.9d&&F.9d.tw()&&!K.1Q.dt){F.9d=K.1Q.2e(F.9d.id);if(F.9V){F.9V.7N(F.9d)}}if(F.7x&&F.7x.tw()&&!K.1Q.dt){F.7x=K.1Q.2e(F.7x.id);if(F.7n){F.7n.7N(F.7x)}}G 9i=F.fi();G 6X=F.iA();G 3E=F.hk();F.df().qE(F,2w);if(F.9d){if(!F.9V){F.9V=1a K.ea(F.9d)}F.9V.116(F.Eo,F.1b[0].1T(),F.1i2(F.1b));F.9V.3p=F.Wn();F.9V.b6=F.WC();F.9V.b5=F.vj();F.9V.j8=F.vj();F.9V.4V=F.Wu();2w.1f(F.9V)}if(F.7x){if(!F.7n){F.7n=1a K.ea(F.7x)}F.7n.116(F.Ca,F.1b[F.1b.T-1].1T(),F.1ij(F.1b));F.7n.3p=F.Wn();F.7n.b6=F.Wr();F.7n.b5=F.vj();F.7n.j8=F.vj();F.7n.4V=F.Wu();2w.1f(F.7n)}F.5N.2m=F.hH();F.5N.2y=F.gu();F.5N.3E=F.qN();F.5N.3p=F.fi();F.Bh();2w.1f(F.5N);if(F.4A){1h(G i=0,l=F.4A.T;i<l;i++){G 5m=F.4A[i];5m.1P.2m=5m.2m!=1F?5m.2m:F.hH();5m.1P.2y=5m.3e!=1F?5m.3e:F.gu();5m.1P.3E=5m.3e!=1F?5m.3e:F.qN();5m.1P.3p=F.u8();5m.uJ()}F.1j.WM();G mm=2h.4T(F.1j.3z);1h(G i=0,l=F.4A.T;i<l;i++){G 5m=F.4A[i];if(5m.1N){G 1r=5m.fU.7u(mm);1r.1N=1r.2y=5m.1N;2w.1f(1r)}2w.1f(5m.1P)}}if(F.mq){F.mq(F)}},BF:H(O){G 1m=F.1j;O.bE=K.1M.bs(O,1m.FZ,1m.3a());O.8f="dM";if(O.u3){O.u3([])}O.aQ=1/O.bn;G 1Y=F.pz();G e4=1Y/2;1h(G i=0;i<F.1b.T;i++){G 1p=F.1b[i];if(i%3>0||F.2g!=K.6j.bV){O.nv(1p.x-e4,1p.y-e4,1Y,1Y);O.Bp(1p.x-e4,1p.y-e4,1Y,1Y)}1k{K.5X.G0(O,1p,e4)}}},wE:H(N){if(5P N=="av"){N=K.1Q.2e(N)}if(F.9d!=N){F.9d=N;if(F.9V){if(F.9d){F.9V.7N(F.9d);F.9V.b6=F.WC();F.9V.b5=F.vj()}1k{F.9V=1c;5M F.9V}}F.1S()}},1im:H(){I F.9d},WN:H(N){if(N!=F.7t){F.7t=N;G p=F.1b[0];F.Eo=1a J.1B.1I(p.x-F.7t/2,p.y-F.7t/2,F.7t,F.7t);F.1S()}},1iq:H(){I F.7t},rq:H(N){if(5P N=="av"){N=K.1Q.2e(N)}if(F.7x!=N){F.7x=N;if(F.7n){if(F.7x){F.7n.7N(F.7x);F.7n.b6=F.Wr();F.7n.b5=F.vj()}1k{F.7n=1c;5M F.7n}}F.1S()}},1iI:H(){I F.7x},Kd:H(N){if(N!=F.7s){F.7s=N;G p=F.1b[F.1b.T-1];F.Ca=1a J.1B.1I(p.x-F.7s/2,p.y-F.7s/2,F.7s,F.7s);F.1S()}},1iA:H(){I F.7s},CX:H(N){if(F.gb!=N){F.gb=N;if(F.9d){if(!F.9V){F.9V=1a K.ea(F.9d)}F.9V.b6=N;F.1S()}1k{F.6I()}}},1iz:H(){I F.gb},WC:H(){if(F.gb){I F.gb}I F.rd()},D0:H(N){if(F.g5!=N){F.g5=N;if(F.7x){if(!F.7n){F.7n=1a K.ea(F.7x)}F.7n.b6=N;F.1S()}1k{F.6I()}}},1ia:H(){I F.g5},Wr:H(){if(F.g5){I F.g5}I F.rd()},1if:H(N){if(F.hz!=N){F.hz=N;if(F.7x){if(!F.7n){F.7n=1a K.ea(F.7x)}F.7n.b5=N;F.1S()}1k{F.6I()}}},Ws:H(){I F.hz},vj:H(){if(F.hz){I F.hz}I F.hk()},1ie:H(N){if(F.hA!=N){F.hA=N;if(F.7x){if(!F.7n){F.7n=1a K.ea(F.7x)}F.7n.3p=N;F.1S()}1k{F.6I()}}},Wq:H(){I F.hA},Wn:H(){if(F.hA){I F.hA}I F.fi()},1id:H(N){if(F.fr!=N){F.fr=N;if(F.7x){if(!F.7n){F.7n=1a K.ea(F.7x)}F.7n.4V=N;F.1S()}1k{F.6I()}}},Wp:H(){I F.fr},Wu:H(){if(F.fr!=1c){I F.fr}I F.iA()},Gk:H(N,Jx){F.sF(N,0,0,1x,Jx);F.6x(1x)},11f:H(){G eV=F.1O.1d.12p();G r=2h.4T(F.1j.3z)*8;F.2g=K.6j.bV;F.1b=[eV,eV.rS(-r,-1.5*r),eV.rS(+r,-1.5*r),eV.1T()];F.6x()},8N:H(1W){if(F.1j.pg){F.1j.pg.8N(F);F.Jv(1W)}},Jv:H(1W){if(!(1W&&1W.6x===1x)){F.6x()}},1lA:H(){I F.aH},1lB:H(N){F.aH=N;if(N){F.8N()}},1lC:H(){I F.de},1lx:H(N){if(F.de!==N){F.de=N;F.6I()}},Wy:H(8t,Wv){G 2I=F.3A.mf();G 4D=F.3J.mf();if(!F.3A.vL(F.3J)){2I=F.3A.ez(2I,8t==K.9Q.gF||Wv?4D:F.1b[1]);4D=F.3J.ez(4D,8t==K.9Q.gF||Wv?2I:F.1b[F.1b.T-2])}F.3A.Ft(2I);F.3J.Ft(4D);F.1b[0]=F.3A.4Z.1p;F.1b[F.1b.T-1]=F.3J.4Z.1p;F.3A.fO(1x);F.3J.fO(1x)},1ij:H(7h){G 8Y=7h[7h.T-1];1h(G i=7h.T-2;i>=0;--i){if(!K.1M.1iB(7h[i],8Y)){I 7h[i].1T()}}I 8Y.1T()},1i2:H(7h){G Ww=7h[0];1h(G i=1,n=7h.T;i<n;++i){if(!K.1M.1iB(7h[i],Ww)){I 7h[i].1T()}}I Ww.1T()},uC:H(fz){if(F.1j.fX){if(F.1O){F.1O.uC(fz)}}1k{if(F.1H){F.1H.uC(fz)}}fz.4K(F);F.jp(1x);if(F.aO&&F.1j){F.1j.3h.ml(F)}},1lz:H(N){F.3A.kX(N,1t)},Xc:H(){I F.3A.1J},1lD:H(N){F.3J.kX(N,1t)},Xd:H(){I F.3J.1J},131:H(){G oi=F.Xc();G di=F.Xd();if(oi!==1F&&oi>-1){F.R9();if(F.1b.T>2){F.8r=1t;Ap.IF(F)}}if(di!==1F&&di>-1){F.Ra();if(F.1b.T>2){Ap.Vv(F)}}},cD:H(4g,4H){G kv=4H.5I["4O:4c"];if(kv){if(4g.5j(kv)){I kv}}I 1n.2o(4c,F,"cD",[4g,4H])},kl:H(){if(F.2g==K.6j.bV){I(F.1b.T-1)/3}1k{I F.1b.T-1}},Bg:H(N){G 2I=F.jt();G 4D=F.fB();if(F.2g==K.6j.bV){F.1b.T=N*3+1}1k{F.1b.T=N+1}F.1b[0]=2I;F.1b[F.1b.T-1]=4D;F.Jf()},Jf:H(){G 2I=F.jt();G 4D=F.fB();G dx=(4D.x-2I.x)/(F.1b.T-1);G dy=(4D.y-2I.y)/(F.1b.T-1);1h(G i=0;i<F.1b.T;i++){F.1b[i]=1a 1L(2I.x+dx*i,2I.y+dy*i)}if(F.2g==K.6j.bZ){G N=F.kl();G Xb=1w.7J(N/2);G X8=1w.7J(N/2);F.8r=1w.4L(dx)>1w.4L(dy);if(F.8r&&N%2!=0){Xb++}if(!F.8r&&N%2!=0){X8++}G 1iF=(4D.x-2I.x)/Xb;G 1iG=(4D.y-2I.y)/X8;G J9=F.8r;1h(G i=1;i<F.1b.T;i++){if(J9){F.1b[i].x=F.1b[i-1].x+1iF;F.1b[i].y=F.1b[i-1].y}1k{F.1b[i].x=F.1b[i-1].x;F.1b[i].y=F.1b[i-1].y+1iG}J9=!J9}}F.6x()},F5:H(1ip){if(F.2g==K.6j.bV){I K.1M.Kr(F.1b,1ip)}I F.1b},1cl:H(Jc){G Cf=[];if(F.2g!=K.6j.bV){Cf.1f(F.1b[Jc]);Cf.1f(F.1b[Jc+1])}1k{Cf=K.1M.Kr(F.1b.9D(0),30,Jc*3)}I Cf},C2:H(5t){if(5t==1F){5t=F.F5(20)}G 6A=0;1h(G i=0;i<5t.T-1;++i){G 6Q=5t[i];G 7Y=5t[i+1];6A+=6Q.5y(7Y)}I 6A},Ks:H(xK,5t){if(5t==1F){5t=F.F5(20)}G xL=xK*F.C2(5t);G sC=0;1h(G i=0;i<5t.T-1;++i){G 6Q=5t[i];G 7Y=5t[i+1];G mG=6Q.5y(7Y);if(sC+mG>=xL){G KD=(7Y.x-6Q.x)/mG;G LA=(7Y.y-6Q.y)/mG;G yq=xL-sC;I 1a 1L(6Q.x+KD*yq,6Q.y+LA*yq)}sC+=mG}I 5t[0]},fA:H(){if(!K.3B.rm){I 1t}if(F.1O!=1c&&F.1O.fA()){I 1t}if(F.1H!=1c&&F.1H.fA()){I 1t}I 1n.2o(4c,F,"fA",[])},1lE:H(1P){G 5m=1a K.tW(F,1P);if(F.4A==1F){F.4A=[]}F.4A.1f(5m);F.1S();I 5m},1lF:H(5m){if(5m!=1F&&F.4A!=1F){1E.54(F.4A,5m)}F.1S()},Xj:H(1p){if(F.4A==1F){I 1c}1h(G i=0,l=F.4A.T;i<l;i++){if(F.4A[i].uJ().3S(1p)){I F.4A[i]}}I 1c},xB:H(1p){G 5m=F.Xj(1p);if(5m!=1c){I 5m}I F},pN:H(8e,5W){I 1a K.aq({1i:F,8e:8e,5W:5W})},WX:H(b0){G 1j=F.4Y();G 8b=1j.10y();G z=1F;1h(G i=0;i<8b.T;i++){G 1g=8b[i].1g;if(1g==F){z=i;2i}}if(z===1F){z=8b.T}I 1j.uT()==K.kF.QS?1j.Xi(b0,z):1j.Xi(!b0,z)},Ch:H(ru){G 1j=F.4Y();if(1j==1c||1j.uT()==K.kF.mi){I}if(!ru){ru=F.3a()}F.AO=1F;G 1X;if(1j.1bM==1c){1X=1j.1X}1k{1X=F.WX(1x)}1h(G i=0;i<1X.T;i++){G 1i=1X[i];G Kb=1i.3a();if(Kb.hZ(ru)){1i.AO=1F}}},1je:H(){G Kh=J.c7.Kh;G 1j=F.4Y();G mm=2h.4T(1j.3z);G a8=1j.1io();G 1ix=F.3a();G oM=[];G ac=F.AO;if(ac==1c){F.AO=ac=[];G 1X=F.WX(1t);G dO=F.kl();1h(G x8=0;x8<dO;++x8){G 4W=F.1b[x8];G 4Q=F.1b[x8+1];if(!4W.dI(4Q)){1h(G i=0;i<1X.T;++i){G 1i=1X[i];if(!1i.jj()||1i.qR()==K.6j.bV){2V}G Kb=1i.3a();if(!Kb.hZ(1ix)){2V}G 1is=1i.kl();1h(G BX=0;BX<1is;++BX){G K7=1i.1b[BX];G K6=1i.1b[BX+1];if(K7.dI(K6)){2V}G aN=K.1M.1ln(4W,4Q,K7,K6);if(aN&&4W.5y(aN)>a8&&4Q.5y(aN)>a8&&K7.5y(aN)>a8&&K6.5y(aN)>a8){G 1hr={8u:aN,5h:a8};oM.1f(1hr)}}}oM.8F(R3(4W))}G X4=R3(4W);G gq=ac[x8];if(!gq){gq=ac[x8]=[]}gq.1f({8u:4W,5h:0});1h(G Kn=0;Kn<oM.T;++Kn){G cp=oM[Kn];G pt=cp.8u;a8=cp.5h;G rc=1I.gQ(pt.x-a8,pt.y-a8,pt.x+a8,pt.y+a8);G 1hs=Kh(rc,4W,pt);G 1ho=Kh(rc,4Q,pt);G JT={8u:1hs,5h:a8};G JU={8u:1ho,5h:a8};if(X4(JT,JU)<0){gq.1f(JT);gq.1f(JU)}1k{gq.1f(JU);gq.1f(JT)}}gq.1f({8u:4Q,5h:0});1h(G i=1;i<gq.T-2;){G c1=gq[i];G c2=gq[i+1];if(X4(c1,c2)>0||c1.8u.5y(c2.8u)<mm/2){1E.xa(gq,i);1E.xa(gq,i)}1k{i++}}oM.T=0}}I ac},1hu:H(){G xg=0;G X0=0;G dO=F.kl();1h(G i=0;i<dO;++i){G T=F.1hv(i);if(T>X0){X0=T;xg=i}}I xg},1hv:H(1y){G 5b=J.c7;6m(F.2g){2k K.6j.xe:2k K.6j.bZ:I 5b.5y(F.1b[1y],F.1b[1y+1]);2k K.6j.bV:G kZ=1y*3;G Am=[];Am.1f(F.1b[kZ++]);Am.1f(F.1b[kZ++]);Am.1f(F.1b[kZ++]);Am.1f(F.1b[kZ]);G K2=K.1M.Kr(Am,30,0);G 6A=0;1h(G s=0;s<K2.T-1;++s){G 4W=K2[s];G 4Q=K2[s+1];G dx=4W.x-4Q.x;G dy=4W.y-4Q.y;6A+=1w.i7(dx*dx+dy*dy)}I 6A}I 0},1hf:H(1y){6m(F.2g){2k K.6j.bV:G qq=1y*3;G x0=F.1b[0+qq].x;G y0=F.1b[0+qq].y;G x1=F.1b[1+qq].x;G y1=F.1b[1+qq].y;G x2=F.1b[2+qq].x;G y2=F.1b[2+qq].y;G x3=F.1b[3+qq].x;G y3=F.1b[3+qq].y;G t=0.5;G q0=(1-t)*(1-t)*(1-t);G q1=3*t*(1-t)*(1-t);G q2=3*t*t*(1-t);G q3=t*t*t;G xt=q0*x0+q1*x1+q2*x2+q3*x3;G yt=q0*y0+q1*y1+q2*y2+q3*y3;I 1a 1L(xt,yt);fI:G 4W=F.1b[1y];G 4Q=F.1b[1y+1];I 1a 1L((4W.x+4Q.x)/2,(4W.y+4Q.y)/2)}},1hg:H(1y){if(F.2g==K.6j.bV){I F.1b[1y*3]}I F.1b[1y]},1hc:H(1y){if(F.2g==K.6j.bV){I F.1b[1y*3+3]}I F.1b[1y+1]},kj:H(1P,1l,2m){if(1P.T==0){I 0}G kp=0;G VQ=1P[kp];G 1r=1a 1I(0,0,5O.7T,5O.7T);G hR=0;3v(1t){hR+=F.1j.dG(VQ,2m,1r).1l;if(hR>1l){I 1w.2n(0,kp)}kp++;if(kp<1P.T){VQ=1P[kp]}1k{I kp}}},Kl:H(ep,Aj){F.Kd(ep.pT()+(ep.uh()-ep.pT())*Aj)},dQ:H(){G 1G=1n.2o(4c,F,"dQ",[]);1G.3A=F.3A.1T(F,F.1O);1G.3J=F.3J.1T(F,F.1H);1G.1b=1E.1T(F.1b);1G.2g=F.2g;1G.7t=F.7t;1G.7s=F.7s;1G.9d=F.9d;1G.7x=F.7x;1G.gb=F.gb;1G.g5=F.g5;1G.de=F.de;1G.aH=F.aH;1G.4A=F.4A;I 1G},ee:H(1G){1n.2o(4c,F,"ee",[1G]);F.3A.kW();F.3A=1G.3A.1T(F,F.1O);F.3A.kR();F.3J.kW();F.3J=1G.3J.1T(F,F.1H);F.3J.kR();F.Gk(1G.1b,1t);F.6x();F.7N(1G.2g);F.7t=1G.7t;F.7s=1G.7s;F.wE(1G.9d);F.CX(1G.gb);F.rq(1G.7x);F.D0(1G.g5);F.de=1G.de;F.aH=1G.aH;F.4A=1G.4A},aL:H(){if(!K.o7){K.o7=1a J.8Q(4c.1s,1c,F)}1k{K.o7.8M(F)}I K.o7},1lk:1a 1L(0,0)};G Kz={e3:H(1i,2I,4D){G 1b=1i.1b=[2I];G Vt=3;1h(G i=1;i<3;++i){1b[i]=1a 1L(2I.x+i*(4D.x-2I.x)/Vt,2I.y+i*(4D.y-2I.y)/Vt)}1i.1b.1f(4D)},qE:H(1i,mo){G 1b=1i.1b;if(1b.T<4){I Gu.qE(1i,mo)}G 3E=1i.hk();G 9i=1i.fi();G 6X=1i.iA();1h(G i=1,n=1b.T;i<n;i+=3){G lz=J.1B.bV.gK(1b,i-1);lz.2y=3E;lz.3p=9i;lz.4V=6X;lz.9S=1i.n7();mo.1f(lz)}},3S:H(1i,1p,eb){G Vn=K.1M.Kr(1i.1b,16);I K.1M.FT(1p,Vn,Vn.T)<eb},CD:H(1i,1p,mL){G 1b=1i.1b;if(1b.T<4){I}G f9=mL.6b.1V(1i).wx;G aB=mL.3f.1y;if(1b.T==f9.T){if((aB+1)%3==0&&aB<1b.T-3){1b[aB+2]=K.1M.1hl(1b[aB],1b[aB+1])}if((aB-1)%3==0&&aB>3){1b[aB-2]=K.1M.1hl(1b[aB],1b[aB-1])}if((aB%3==0)&&aB>0&&aB<1b.T-1){G 9b=mL.9b();1b[aB-1]=1L.ki(f9[aB-1],9b);1b[aB+1]=1L.ki(f9[aB+1],9b)}}},pQ:H(1i,lB){1i.6x(lB)},GG:H(1i){G 1b=1i.1b;G cK=[];G BG,Cx,mr,KI;cK.1f(1b[0]);G i=0;3v(i<1b.T-2){mr=1b[i+1];cK.1f(mr);cK.1f(mr);if(i!=1b.T-3){KI=1b[i+2];BG=1a 1L((mr.x+KI.x)/2,(mr.y+KI.y)/2);cK.1f(BG)}1k{cK.1f(1b[i+2])}i+=1}if(cK.T==1){cK=[];Cx=1b[0];mr=1b[1b.T-1];BG=1a 1L((Cx.x+mr.x)/2,(Cx.y+mr.y)/2);cK[0]=Cx;cK[1]=BG;cK[2]=BG.1T();cK[3]=mr}1i.1b=cK},u6:H(1i){I(1i.1b.T-1)%3==0},ur:H(1i,qS){G eV=1i.1O.1d.12p();G r=2h.4T(1i.1j.3z)*8;if(qS){1i.1b=[eV,eV.rS(-r,-1.5*r),eV.rS(+r,-1.5*r),eV.1T()]}1k{G 1b=1i.1b;1b[0]=eV;1b[1b.T-1]=eV.1T();1h(G i=0;i<1b.T/2-1;++i){1b[1+i]=eV.rS(-r,-1.5*r);1b[1b.T-2-i]=eV.rS(+r,-1.5*r)}if(1b.T%2==1){1b[1b.T/2]=eV.rS(0,-1.8*r)}}1i.6x()}};G Gu={e3:H(1i,2I,4D){1i.1b=[2I,4D]},qE:H(1i,mo){G HC=1i.4Y();if(HC&&(HC.GU()||HC.uT()!=K.kF.mi)){G 1hj=1a Wg(1i);mo.1f(1hj);I}G 3E=1i.hk();G 9i=1i.fi();G 6X=1i.iA();G 1b=1i.1b;1h(G i=0,l=1b.T-1;i<l;i++){G p1=1b[i];G p2=1b[i+1];G 8z=1a J.1B.8C(p1.x,p1.y,p2.x,p2.y);8z.9e(3E);8z.3p=9i;8z.4V=6X;8z.9S=1i.n7();mo.1f(8z)}},3S:H(1i,1p,eb){I K.1M.FT(1p,1i.1b,1i.1b.T)<eb},CD:H(1i,1p,mL){},pQ:H(1i,lB){1i.6x(lB)},GG:H(1i){},u6:H(1i){I 1t},ur:H(1i,qS){Kz.ur(1i,qS)}};G Ap={e3:H(1i,2I,4D){if(1i.1b.T<3){1E.nX(1i.1b,1,1a J.1B.1L(0,0))}F.VA(1i,2I,4D)},qE:H(1i,mo){Gu.qE(1i,mo)},3S:H(1i,1p,eb){I Gu.3S(1i,1p,eb)},CD:H(1i,1p,mL){G 1b=1i.1b;if(1b.T<3){I}G 3G=mL.ck;G aB=mL.3f.1y;G dX=1b[1b.T-1].x-1b[0].x;G dY=1b[1b.T-1].y-1b[0].y;if(mL.8t===K.9Q.gF&&(aB==0||aB==1b.T-1)&&((1i.8r&&1w.4L(dX)<1w.4L(dY))||(!1i.8r&&1w.4L(dX)>1w.4L(dY)))){1i.8r=1w.4L(dX)>1w.4L(dY);F.VA(1i,1b[0],1b[1b.T-1])}1k{F.1hD(1i,aB)}},VA:H(1i,2I,4D){1i.8r=1w.4L(2I.x-4D.x)>1w.4L(2I.y-4D.y);G 1b=1i.1b=[2I,2I,4D,4D];G 4x=1b.T;G dx=4D.x-2I.x;G dy=4D.y-2I.y;G ax,ay;1h(G i=1;i<4x-1;++i){if(1i.8r){if(i%2!=0){ax=dx/(4x/2);ay=0}1k{ax=0;ay=dy/((4x-1)/2)}}1k{if(i%2!=0){ax=0;ay=dy/(4x/2)}1k{ax=dx/((4x-1)/2);ay=0}}1b[i]=1a 1L(1b[i-1].x+ax,1b[i-1].y+ay)}i--;if((1i.8r&&(i%2!=0))||(!1i.8r&&!(i%2!=0))){1b[4x-2]=1a 1L(1b[4x-1].x,1b[4x-2].y)}1k{1b[4x-2]=1a 1L(1b[4x-2].x,1b[4x-1].y)}},1hD:H(1i,h){G 1b=1i.1b;G ip=h-1;G ix=h+1;if((1i.8r&&h%2!=0)||(!1i.8r&&!(h%2!=0))){if(ip==0){1b[h]=1a 1L(1b[h].x,1b[ip].y)}if(ix==1b.T-1){1b[h]=1a 1L(1b[ix].x,1b[h].y)}if(ip>=0&&ip<1b.T){1b[ip]=1a 1L(1b[ip].x,1b[h].y)}if(ix>=0&&ix<1b.T){1b[ix]=1a 1L(1b[h].x,1b[ix].y)}}1k{if(ip==0){1b[h]=1a 1L(1b[ip].x,1b[h].y)}if(ix==1b.T-1){1b[h]=1a 1L(1b[h].x,1b[ix].y)}if(ip>=0&&ip<1b.T){1b[ip]=1a 1L(1b[h].x,1b[ip].y)}if(ix>=0&&ix<1b.T){1b[ix]=1a 1L(1b[ix].x,1b[h].y)}}},pQ:H(1i,lB){F.IF(1i);F.Vv(1i);1i.6x(lB)},IF:H(1i){G 1b=1i.1b;G fx=1b[1].x;G fy=1b[1].y;if(1i.8r){fy=1b[0].y}1k{fx=1b[0].x}1b[1]=1a 1L(fx,fy)},Vv:H(1i){G 1b=1i.1b;G 7h=1b.T;G lx=1b[7h-2].x;G ly=1b[7h-2].y;if(7h%2!=0){if(1i.8r){lx=1b[7h-1].x}1k{ly=1b[7h-1].y}}1k{if(1i.8r){ly=1b[7h-1].y}1k{lx=1b[7h-1].x}}1b[7h-2]=1a 1L(lx,ly)},GG:H(1i){G 1b=1i.1b;1i.8r=1b[0].y==1b[1].y},u6:H(1i){if(1i.1b.T<3){I 1x}I 1t},ur:H(1i,qS){G 1b=1i.1b;if(qS&&1b.T%2==0){1i.Bg(3)}G rc=1i.1O.1d;G w=rc.1l;1b[0]=1i.1O.Vx(1/3);1b[1b.T-1]=1i.1O.Vx(2/3);1h(G i=0;i<1b.T/2-1;++i){1b[1+i]=1a 1L(1b[0].x,1b[0].y-w/3);1b[1b.T-2-i]=1a 1L(1b[1b.T-1].x,1b[0].y-w/3)}if(1b.T%2==1){1b[1b.T/2]=1a 1L(1b[1b.T-1].x,1b[0].y-w/3)}1i.8r=1x;1i.6x()}};G 1j0={e3:H(1i,2I,4D){1i.1b=[2I,4D]},qE:H(1i,mo){G 3E=1i.hk();G 9i=1i.fi();G 6X=1i.iA();G B7=1a J.1B.1m0(1i.1b);B7.2y=3E;B7.3p=9i;B7.4V=6X;B7.9S=1i.n7();mo.1f(B7)},1m8:H(7h){G Cz=0.5;G W8=16;G cn=[],IZ=[],x,y,W9,Wa,Wk,Wl,c1,c2,c3,c4,st,t,i;cn=7h.9D(0);cn.Wb(7h[1]);cn.Wb(7h[0]);cn.1f(7h[7h.T-2]);cn.1f(7h[7h.T-1]);1h(i=2;i<(cn.T-4);i+=2){1h(t=0;t<=W8;t++){W9=(cn[i+2]-cn[i-2])*Cz;Wa=(cn[i+4]-cn[i])*Cz;Wk=(cn[i+3]-cn[i-1])*Cz;Wl=(cn[i+5]-cn[i+1])*Cz;st=t/W8;c1=2*1w.a5(st,3)-3*1w.a5(st,2)+1;c2=-(2*1w.a5(st,3))+3*1w.a5(st,2);c3=1w.a5(st,3)-2*1w.a5(st,2)+st;c4=1w.a5(st,3)-1w.a5(st,2);x=c1*cn[i]+c2*cn[i+2]+c3*W9+c4*Wa;y=c1*cn[i+1]+c2*cn[i+3]+c3*Wk+c4*Wl;IZ.1f(x);IZ.1f(y)}}I IZ},3S:H(1i,1p,eb){I K.1M.FT(1p,1i.1b,1i.1b.T)<eb},CD:H(1i,1p,mL){},pQ:H(1i,lB){1i.6x(lB)},GG:H(1i){},u6:H(1i){I 1t},ur:H(1i,qS){Kz.ur(1i,qS)}};G Wg=H(1i){F.1i=1i};Wg.1s={lQ:H(O,o4){G 1i=F.1i;G 1j=1i.4Y();G 3E=1i.hk();G 9i=1i.fi();G 6X=1i.iA();G 1b=1i.1b;if(1b.T<2){I}G 9S=1i.n7();if(9S&&o4!=1x){O.cM();9S.5j(O)}O.8f=3E;O.aQ=(9i?9i:1)/O.bn;jD.5j(O,6X);F.Wh(O);if(9S&&o4!=1x){O.cH()}},o4:H(O){G 1i=F.1i;G 9i=1i.fi();G 6X=1i.iA();G 9S=1i.n7();if(9S){O.cM();9S.5j(O);O.8f=9S.4N;O.aQ=(9i?9i:1)/O.bn;jD.5j(O,6X);F.Wh(O);O.cH()}},Wh:H(O){G 1i=F.1i;G 1j=1i.4Y();G 1b=1i.1b;if(1b.T<2){I}G gX=1j?1j.uT():K.kF.mi;if(gX==K.kF.mi){if(1i.1j.GU()){F.QO(O,1b,1j.W7(),1t)}1k{F.Gx(O,1b)}}1k{F.1iT(O,1i,1b,1j.W7())}},Gx:H(O,1b){O.ed();O.6B(1b[0].x,1b[0].y);1h(G i=1,l=1b.T;i<l;i++){G p=1b[i];O.4M(p.x,p.y)}O.3E()},QO:H(O,1b,5h,Dh){G 5b=J.c7;if(5h<0.W2){F.Gx(O,1b);I 1b[1b.T-1]}if(1b.T<=2){F.Gx(O,1b);I 1b[1b.T-1]}G ii=1b[0];if(Dh){O.ed();O.6B(ii.x,ii.y)}G c,k1,k2,l2;1h(G i=0;i<1b.T-2;i++){c=1b[i+1];k1=1b[i];k2=1b[i+1];l2=1b[i+2];G VX=1x;3v(1w.4L(k2.x-l2.x)+1w.4L(k2.y-l2.y)<0.W2){i++;if(i>=1b.T-2){VX=1t;2i}l2=1b[i+2]}if(VX){2V}G VY=5b.dP(c,k1);G a1=VY.a;G r1=VY.r;G VS=5b.dP(c,l2);G a2=VS.a;G r2=VS.r;3v(a1<0){a1+=f5}3v(a2<0){a2+=f5}if(a2<a1){a2+=f5}G a=a2-a1;if(a==0||a==180){2V}G H2=1x;if(a>180){G 5f=a1;a1=a2;a2=5f;5f=r1;r1=r2;r2=5f;a=a2-a1;3v(a<0){a+=f5}H2=1t}G rr=5h;G VT=1w.nk(5b.r4(a/2));G VU=1w.nk(5b.r4(90-a/2));G xx=VU*rr/VT;G 8y=1w.2H(r1,r2);if(xx>1w.2H(8y/3,10)){xx=1w.2H(8y/3,10);rr=VT*xx/VU}G iK=5b.fe(c,{a:a1,r:xx});G iL=5b.fe(c,{a:a2,r:xx});G xc=1w.i7(1w.a5(xx,2)+1w.a5(rr,2));G 2N=5b.fe(c,{a:a1+a/2,r:xc});G W5=5b.dP(2N,iK);pE=W5.a;1lW=W5.r;G W6=5b.dP(2N,iL);rI=W6.a;1lU=W6.r;3v(1w.4L(rI-pE)>180){if(rI<pE){rI+=f5}1k{pE+=f5}}if(rI<pE){G 5f=rI;rI=pE;pE=5f}if(H2){G 5f=iK;iK=iL;iL=5f}O.4M(iK.x,iK.y);if(rr>0){G 2I=f5-pE;G aG=-(rI-pE);if(!H2){2I=2I+aG;aG=-aG}O.k3(2N.x,2N.y,rr,5b.r4(2I),5b.r4(2I+aG),aG<0)}ii=iL}if(Dh){G 8Y=1b[1b.T-1];O.4M(8Y.x,8Y.y);O.3E()}I ii},1iT:H(O,1i,1b,5h){G rA=1i.1je();if(!rA||rA.T==0){F.Gx(O,1b);I}G 5b=J.c7;O.ed();O.6B(1b[0].x,1b[0].y);G 9q=1c;G dO=1i.kl();G 1j=1i.4Y();G 6B=1x;1h(G i=0;i<dO;++i){G pc=rA[i];if(pc.T>0){1h(G j=0;j<pc.T-1;++j){G a8=pc[j].5h;G 4W=pc[j].8u;G 4Q=pc[j+1].8u;if(9q){4W=9q}if(6B){O.6B(4W.x,4W.y);6B=1x}9q=1c;if(j%2==0){if(1j.GU()){if(j==pc.T-2&&i!=dO-1){G ni=i+2;G 56=1b[ni];3v(1w.4L(56.x-4Q.x)+1w.4L(56.y-4Q.y)<0.W2){ni++;if(ni==1b.T){2i}56=1b[ni]}if(ni==1b.T){O.4M(4Q.x,4Q.y)}1k{G Tl=rA[ni-1];if(Tl.T>2){56=Tl[1].8u}G 1jy=[4W,4Q,56];9q=F.QO(O,1jy,5h,1x)}}1k{O.4M(4Q.x,4Q.y)}}1k{O.4M(4Q.x,4Q.y)}}1k{if(1j.uT()==K.kF.QS){G Ro=4W.5y(4Q)/2;G QD=5b.dP(4W,4Q);G aa=QD.a;G rr=QD.r;G vf=[5b.fe(4W,{a:aa,r:a8}),5b.fe(4W,{a:aa,r:2*Ro-a8})];G 1pV=[4W,5b.fe(4W,{a:aa,r:2*Ro-2*a8})];G 1qb=[5b.fe(4W,{a:aa,r:2*a8}),4Q];G 4J=aa;if(4J<90){4J+=180}G qI=0*90;if(aa<90){qI=90-qI}G 2I=180-4J-qI;G aG=-90;if(aa<90){2I+=aG;aG=-aG}O.k3(vf[0].x,vf[0].y,a8,5b.r4(2I),5b.r4(2I+aG),aG<0);G p1=5b.fe(vf[0],{a:4J-90,r:a8});G p2=5b.fe(vf[1],{a:4J-90,r:a8});O.4M(p2.x,p2.y);qI=1*90;if(aa<90){qI=90-qI}2I=180-4J-qI;aG=-90;if(aa<90){2I+=aG;aG=-aG}O.k3(vf[1].x,vf[1].y,a8,5b.r4(2I),5b.r4(2I+aG),aG<0)}1k{6B=1t}}}}1k{O.4M(1b[i+1].x,1b[i+1].y)}}G 8Y=1b[1b.T-1];O.4M(8Y.x,8Y.y);O.3E()}};4c.hG=H(1m){if(!K.o7){K.o7=1a J.8Q(4c.1s,1m)}1k{K.o7.8M(1c)}I K.o7};K.o7=1c;G 2j=[Kz,Gu,Ap,1j0];G R3=H(og){I H(a,b){G 3R=a.8u;G 2Z=b.8u;if(3R.dI(2Z)){I 0}G dl=(og.x-3R.x)*(og.x-3R.x);dl+=(og.y-3R.y)*(og.y-3R.y);G dr=(og.x-2Z.x)*(og.x-2Z.x);dr+=(og.y-2Z.y)*(og.y-2Z.y);if(dl==dr){I 0}I(dl<dr)?-1:1}};J.2x(4c,"J.1e.4c",K.ao)})(J.1e);(H(K){G uG=K.uG=H(1j){1n.2T(uG,F,[1j])};uG.1s={iH:H(1p,vE){F.bH=J.6Z.2J.f2;I F.bH},g4:H(1G){I 1c}};J.2x(uG,"J.1e.uG",K.gJ)})(J.1e);(H(K){G 2J=J.6Z.2J;G rR=K.rR=H(1j){1n.2T(rR,F,[1j])};rR.1s={iH:H(1p,vE){G 7F=F.1m.3h.7F(1p);if(7F){I F.h0(2J.lD)}G 3f=F.1m.vC(1p);if(3f){I F.yQ(1p,3f)}G S=F.1m.qT(1p,1t,1t);if(S!=1c&&S.F8(1t)){I F.h0(2J.136)}I F.h0(2J.f2)},g4:H(1G){G 9a=1n.2o(rR,F,"g4",[1G]);if(9a){I 9a}G 1m=F.1m;G pr=1m.qT(1G.aD,1t,1t);if(pr!=1c&&pr.F8(1t)||pr==1c&&1m.iq){G 1i=F.Ln(pr,1G.aD);G 3L={1g:1i,1y:1i.1b.T-1};I 1a K.kJ(1m,1i)}I 1a K.hY(1m.3h)}};J.2x(rR,"J.1e.rR",K.gJ)})(J.1e);(H(K){G 2J=J.6Z.2J;G hd=K.hd=H(1j,jB){1n.2T(hd,F,[1j]);F.jB=jB};hd.1s={iH:H(1p,vE){G 7F=F.1m.3h.7F(1p);if(7F){I F.h0(2J.lD)}G 3f=F.1m.vC(1p);if(3f){I F.yQ(1p,3f)}I F.h0(2J.f2)},JK:H(){I F.jB(F.1m)},g4:H(1G){G 9a=1n.2o(hd,F,"g4",[1G]);if(9a){I 9a}G 1m=F.1m;G w=1m.FB()?1m.12j():1;G h=1m.FB()?1m.121():1;G S=F.JK();G zq=1m.JE(S,1G.aD,K.6o.JD);S.4G(1a J.1B.1I(zq.x,zq.y,w,h));9a=1a K.kP(1m,S);9a.vb=F.vb;I 9a}};J.2x(hd,"J.1e.hd",K.gJ)})(J.1e);(H(K){G bS=K.bS=H(1j){1n.2T(bS,F,[1j])};bS.1s={Ju:H(){I 1x},ez:H(1iS,1pX){I 1iS}};J.2x(bS,"J.1e.bS",K.3m)})(J.1e);(H(K){G mU=K.mU=H(1W){1n.2T(mU,F);if(1W.8k){F.8k=1W.8k}if(1W.1d){F.1d=1W.1d}if(1W.2p){F.2p=1W.2p}if(1W.5D!==1F){F.5D=1W.5D}if(1W.3f!==1F){F.3f=1W.3f}if(1W.5W!==1F){F.5W=1W.5W}if(1W.8e!==1F){F.8e=1W.8e}if(1W.O!==1F){F.O=1W.O}if(1W.1g!==1F){F.1g=1W.1g}};mU.1s={Rt:H(){I F.2p},Rx:H(){I F.5D},Ru:H(){I F.3f},1s0:H(N){F.3f=N},1jq:H(){I F.5W},1iM:H(){I F.8e},zV:H(){I F.O},h6:H(){I F.l9},QE:H(N){F.l9=N},jG:H(){I F.9g},JP:H(N){F.9g=N},o6:H(){F.au=1t},kU:H(){I F.au},1jg:H(){I F.1g}};J.2x(mU,"J.1e.mU",J.Ri);G 6D=K.6D=H(1W){1n.2T(6D,F,[1W]);if(1W.S){F.S=1W.S}if(1W.2K!==1F){F.2K=1W.2K}if(1W.nY){F.nY=1W.nY}};6D.1s={1s1:H(){I F.S},1jd:H(){I F.2K},1s5:H(){I F.nY}};J.2x(6D,"J.1e.6D",mU);G aq=K.aq=H(1W){1n.2T(aq,F,[1W]);if(1W.1i){F.1i=1W.1i}};aq.1s={1s6:H(){I F.1i}};J.2x(aq,"J.1e.aq",mU);G uA=K.uA=H(1W){1n.2T(uA,F,[1W]);if(1W.3l){F.3l=1W.3l}};uA.1s={1j8:H(){I F.3l}};J.2x(uA,"J.1e.uA",6D);G uy=K.uy=H(1W){1n.2T(uy,F);if(1W.8k){F.8k=1W.8k}if(1W.2p){F.2p=1W.2p}if(1W.3f!==1F){F.3f=1W.3f}};uy.1s={Rt:H(){I F.2p},Ru:H(){I F.3f},jG:H(){I F.9g},JP:H(N){F.9g=N},o6:H(){F.au=1t},kU:H(){I F.au}};J.2x(uy,"J.1e.uy",J.Ri);G uB=K.uB=H(1W){1n.2T(uB,F);if(1W.8k){F.8k=1W.8k}if(1W.2p){F.2p=1W.2p}if(1W.5D!==1F){F.5D=1W.5D}};uB.1s={Rt:H(){I F.2p},Rx:H(){I F.5D}};J.2x(uB,"J.1e.uB",J.nK);G n3=K.n3=H(1W){1n.2T(n3,F);if(1W.1g){F.1g=1W.1g}if(1W.cw){F.cw=1W.cw}if(1W.1d){F.1d=1W.1d}};n3.1s={1jg:H(){I F.1g},1co:H(){I F.cw},1cf:H(N){F.cw=N},3a:H(){I F.1d}};J.2x(n3,"J.1e.n3",J.nK);G nD=K.nD=H(1W){1n.2T(nD,F);if(1W.8k){F.8k=1W.8k}if(1W.S){F.S=1W.S}if(1W.2G){F.2G=1W.2G}if(1W.2r!==1F){F.2r=1W.2r}if(1W.1J!==1F){F.1J=1W.1J}if(1W.5W!==1F){F.5W=1W.5W}if(1W.8e!==1F){F.8e=1W.8e}if(1W.O!==1F){F.O=1W.O}if(1W.5D!==1F){F.5D=1W.5D}if(1W.2p!==1F){F.2p=1W.2p}};nD.1s={8s:H(){I F.2G},Rx:H(){I F.5D},1jq:H(){I F.5W},1iM:H(){I F.8e},zV:H(){I F.O},h6:H(){I F.l9},QE:H(N){F.l9=N},jG:H(){I F.9g},JP:H(N){F.9g=N}};J.2x(nD,"J.1e.nD",J.Ri);G ph=K.ph=H(1W){1n.2T(ph,F,[1W]);F.o6=1x};ph.1s={o6:H(){F.o6=1t},kU:H(){I F.o6}};J.2x(ph,"J.1e.ph",J.1e.nD);G r8=K.r8=H(1W){1n.2T(r8,F);if(1W.1g!==1F){F.1g=1W.1g}if(1W.5r!==1F){F.5r=1W.5r}if(1W.1u!==1F){F.1u=1W.1u}if(1W.O!==1F){F.O=1W.O}if(1W.Al!==1F){F.Al=1W.Al}F.l9=1x};r8.1s={1rB:H(){I F.1g},oY:H(){I F.5r},kx:H(N){F.5r=N},1rA:H(){I F.1u},zV:H(){I F.O},1rE:H(){I F.Al},h6:H(){I F.l9},QE:H(N){F.l9=N}};J.2x(r8,"J.1e.r8",J.nK);G uu=K.uu=H(1C){1n.2T(uu,F);F.1C=1C};uu.1s={Cu:H(){I F.1C}};J.2x(uu,"J.1e.uu",J.nK);G tz=K.tz=H(1C,5F){1n.2T(tz,F,[1C]);F.5F=5F};tz.1s={1rx:H(){I F.5F},jG:H(){I F.9g},JP:H(N){F.9g=N},o6:H(){F.au=1t},kU:H(){I F.au}};J.2x(tz,"J.1e.tz",J.1e.uu)})(J.1e);J.1e.2q={Kg:"Kg",Kk:"Kk",Ko:"Ko",K9:"K9",Ka:"Ka",Jl:"Jl",Jn:"Jn",FH:"FH",Jr:"Jr",Jo:"Jo",Jb:"Jb",Jh:"Jh",Je:"Je",Js:"Js",FA:"FA",Jz:"Jz",Lr:"Lr",Lp:"Lp",Lj:"Lj",Ld:"Ld",La:"La",Li:"Li",Lg:"Lg",LG:"LG",LI:"LI",LL:"LL",LM:"LM",LJ:"LJ",Ij:"Ij",Lw:"Lw",Lu:"Lu",8p:"8p",KC:"KC",wU:"wU",LC:"LC",Lz:"Lz",KB:"KB",iF:"iF",KA:"KA",BK:"BK",KG:"KG",Ky:"Ky",Fc:"Fc",uP:"uP",KO:"KO",RU:"RU",RP:"RP",RV:"RV",KP:"KP",Hs:"Hs",Hq:"Hq",Hx:"Hx",Hw:"Hw",Hu:"Hu",Hj:"Hj",Hk:"Hk",HJ:"HJ",HS:"HS",QL:"QL",RJ:"RJ"};(H(K){G 2h=J.1B.2h;G 1I=J.1B.1I;G v8=K.v8=H(S){1n.2T(v8,F,[S]);F.8E();F.dS()};v8.1s={dS:H(){G f7=F.9p();F.x=f7.x;F.y=f7.y},mD:H(2p){if(!F.aY(2p)){I}if(F.S.1j!=1c){F.S.1j.zL()}G S=F.S;if(S.an){S.uC();S.1j.1hX(S)}1k{S.S2();S.1j.1hO(S)}if(F.S.1j!=1c){F.S.1j.oD()}},aY:H(2p){I F.9p().3S(2p)},9p:H(){G S=F.S;G aF=S.8m();G mm=2h.4T(S.1j.3z);G c=aF.2N();I 1I.gQ(aF.2Z()+mm,c.y-2*mm,aF.2Z()+5*mm,c.y+2*mm)},j9:H(){G 1r=F.9p();if(F.S.3b!=0){G p=[];p.1f(1r.5H());p.1f(1r.hc());p.1f(1r.bc());p.1f(1r.hi());K.1M.k7(p,K.1M.9J(F.S.1d),F.S.3b);G cJ=1w.2H(p[0].x,1w.2H(p[1].x,1w.2H(p[2].x,p[3].x)));G 8Z=1w.2H(p[0].y,1w.2H(p[1].y,1w.2H(p[2].y,p[3].y)));G eA=1w.2n(p[0].x,1w.2n(p[1].x,1w.2n(p[2].x,p[3].x)));G am=1w.2n(p[0].y,1w.2n(p[1].y,1w.2n(p[2].y,p[3].y)));I 1I.gQ(cJ,8Z,eA,am)}I 1r},Sg:H(1r,mm){1r.1N="gp";F.2w=[1r];G y=1r.y+1r.1o/2;G 8z=1a J.1B.8C(1r.x+mm,y,1r.2Z()-mm,y);F.2w.1f(8z)},1hN:H(1r,mm){F.Sg(1r,mm);G x=1r.x+1r.1l/2;G 8z=1a J.1B.8C(x,1r.y+mm,x,1r.3F()-mm);F.2w.1f(8z)},8E:H(){G mm=2h.4T(F.S.1j.3z);G 1r=F.9p();1r.x=1r.y=0;if(F.S.an){F.Sg(1r,mm)}1k{F.1hN(1r,mm)}}};J.2x(v8,"J.1e.v8",K.ie)})(J.1e);(H(K){G 1I=J.1B.1I;G md=K.md=H(1m){F.1m=1m};md.1s.1rs=H(){G S=1a K.5p(F.1m);if(aZ.T==1){S.4G(aZ[0])}1k{if(aZ.T==4){S.4G(1I.DM(aZ))}}F.1m.9u(S);I S};md.1s.1rJ=H(){G S=1a K.7B(F.1m);if(aZ.T==1){S.4G(aZ[0])}1k{if(aZ.T==4){S.4G(1I.DM(aZ))}}F.1m.9u(S);I S};md.1s.1rI=H(){G S=1a K.3B(F.1m);if(aZ.T==1){S.4G(aZ[0])}1k{if(aZ.T==4){S.4G(1I.DM(aZ))}}F.1m.9u(S);I S};md.1s.1rD=H(){G S=1a K.bL(F.1m);if(aZ.T==1){S.4G(aZ[0])}1k{if(aZ.T==4){S.4G(1I.DM(aZ))}}F.1m.9u(S);I S};md.1s.1ra=H(1O,1H){G 1i=1a K.4c(F.1m,1O,1H);F.1m.9u(1i);I 1i};J.2x(md,"J.1e.md")})(J.1e);(H(K){G 2h=J.1B.2h;G 1I=J.1B.1I;G uo=J.1B.uo;G 8C=J.1B.8C;G vd=K.vd=H(S){1n.2T(vd,F,[S]);F.8E();F.dS()};vd.1s={dS:H(){G f7=F.9p();F.x=f7.x;F.y=f7.y},mD:H(2p){if(!F.aY(2p)){I}G S=F.S;if(S.1j.g2()){S.1j.5A.B4();S.1j.5A.f4(1a K.qM(F,S));S.1j.5A.BB()}1k{S.AY(!S.rW())}if(S.rW()){S.1ir(S)}1k{S.1iJ(S)}},aY:H(2p){I F.j9().3S(2p)&&K.1M.ML(2p,F.9W())},9p:H(){G S=F.S;G mm=2h.4T(S.1j.3z);G v6=S.jb();if(S.Ss()!=1c){v6=S.Ss()}G 6g=mm;if(6g>v6/4){6g=v6/4}G 1r=S.1d.1T();1r.1o=v6;1r.x=1r.2Z()-v6;1r.1l=v6;1r=1r.7u(-6g,-6g);I 1r},j9:H(){G 1r=F.9p();if(F.S.3b!=0){G p=[];p.1f(1r.5H());p.1f(1r.hc());p.1f(1r.bc());p.1f(1r.hi());K.1M.k7(p,K.1M.9J(F.S.1d),F.S.3b);G cJ=1w.2H(p[0].x,1w.2H(p[1].x,1w.2H(p[2].x,p[3].x)));G 8Z=1w.2H(p[0].y,1w.2H(p[1].y,1w.2H(p[2].y,p[3].y)));G eA=1w.2n(p[0].x,1w.2n(p[1].x,1w.2n(p[2].x,p[3].x)));G am=1w.2n(p[0].y,1w.2n(p[1].y,1w.2n(p[2].y,p[3].y)));I 1I.gQ(cJ,8Z,eA,am)}I 1r},9W:H(){G 1r=F.9p();G p=[];p.1f(1r.5H());p.1f(1r.hc());p.1f(1r.bc());p.1f(1r.hi());K.1M.k7(p,K.1M.9J(F.S.1d),F.S.3b);I p},8E:H(){G S=F.S;G mm=2h.4T(S.1j.3z);G hm=3*mm/4;G kN=F.9p();kN.x=kN.y=0;G GP=1a uo(kN);GP.2y="jY";GP.1N="gp";F.2w=[GP];G 7m=kN.1l/5;G e0=kN.x+kN.1l/2;G Ak=kN.y+kN.1o/2-7m/2;G GN=mm/2;G lF=7m-GN;G Gn=Ak+GN;G Ag=kN.y+kN.1o/2+7m/2;G Gj=Ag-GN;if(!S.aS){G Ad=1a 8C(e0,Ak,e0-7m,Ak+7m);Ad.2y="jY";F.2w.1f(Ad);G Ae=1a 8C(e0,Ak,e0+7m,Ak+7m);Ae.2y="jY";F.2w.1f(Ae);if(lF>0){G Ao=1a 8C(e0,Gn,e0-lF,Gn+lF);Ao.2y="jY";F.2w.1f(Ao);G AB=1a 8C(e0,Gn,e0+lF,Gn+lF);AB.2y="jY";F.2w.1f(AB)}}1k{G Ad=1a 8C(e0,Ag,e0-7m,Ag-7m);Ad.2y="jY";F.2w.1f(Ad);G Ae=1a 8C(e0,Ag,e0+7m,Ag-7m);Ae.2y="jY";F.2w.1f(Ae);if(lF>0){G Ao=1a 8C(e0,Gj,e0-lF,Gj-lF);Ao.2y="jY";F.2w.1f(Ao);G AB=1a 8C(e0,Gj,e0+lF,Gj-lF);AB.2y="jY";F.2w.1f(AB)}}}};J.2x(vd,"J.1e.vd",K.ie)})(J.1e);(H(K){G 2h=J.1B.2h;G 1L=J.1B.1L;G 1I=J.1B.1I;G 9T=J.1B.9T;G 9M=J.1e.9M;G 6t=K.6t=H(1j){1n.2T(6t,F,[1j]);F.1b=[];F.2B=1a J.1B.3U();F.6k={S:F,9W:H(){I F.S.2B}};F.1P.qe=1t;F.1P.4q=K.4w.7z;F.1P.4i=K.4w.7z};6t.1s={1r2:H(){I F.bJ},1rl:H(N){if(F.bJ!=N){F.bJ=N;F.1S()}},uV:H(){I F.1b},Gk:H(N){if(F.1b!=N){F.1b=N;F.6x()}},1T:H(){G 1K=1n.2o(6t,F,"1T",[]);1K.bJ=F.bJ;1K.1b=FP(F.1b);1K.tg();I 1K},3q:H(){G 1q=1n.2o(6t,F,"3q",[]);1q.bJ=F.bJ;1q.1b=SG(F.1b);I 1q},3D:H(1q){1n.2o(6t,F,"3D",[1q]);F.bJ=1q.bJ;F.1b=SF(1q.1b);F.tg()},5g:H(1v,O){1n.2o(6t,F,"5g",[1v,O]);F.bJ=O.4v("1hY",1v);F.1b=SF(O.a7("t6",1v));F.tg()},5u:H(1v,O){1n.2o(6t,F,"5u",[1v,O]);O.4o(F.bJ,"1hY",1v);O.c9(SG(F.1b),"t6",1v)},kr:H(){G 2w=F.6e.2w=[];G 1r=F.1d;G 1N=F.rd();if(F.bJ){G 1D={1N:1N,nT:9M.Bk};F.pC(2w,1D);if(1D.1N){1N=1D.1N}}if(F.bJ){F.2B.1N=1N}1k{F.2B.1N=1c}F.2B.2y=F.hk();F.2B.3p=1;F.2B.4V=F.iA();F.2B.9S=F.n7();2w.1f(F.2B);if(F.bJ){F.pC(2w,{nT:9M.Br})}F.1P.2m=F.hH();F.1P.2y=F.gu();F.1P.3E=F.qN();F.1P.3p=F.u8();F.1P.4G(1r,(F.er)?F.3b:0);2w.1f(F.1P);F.D6(2w);if(F.mq){F.mq(F)}},cA:H(2A){if(2A.8t==K.9Q.gF){G 1p=2A.9q.1T();F.1b.1f(1p);F.2B.6B(1p.x,1p.y)}if(2A.8t==K.9Q.jw&&1n.2D(K.pD,2A.3f)){G Au=2A.3f;G 1ic=1w.2H(F.1d.1l/6,1w.2H(F.1d.1o/6,F.1j.qp));F.G6=[];G p=F.1b[Au.1y];1h(G Gl=-1;Gl<=1;Gl+=2){1h(G i=Au.1y+Gl;1t;i+=Gl){G 1y=i%F.1b.T;if(1y<0){1y=F.1b.T+1y}if(1y==Au.1y){F.G6=[];2i}G p2=F.1b[1y];G d=1L.5y(p,p2);if(d>1ic){2i}F.G6[1y]=d}}}1n.2o(6t,F,"cA",[2A])},eW:H(2A){if(2A.8t==K.9Q.gF){G 8Y=F.1b[F.1b.T-1];G 3G=2A.ck;if(!8Y.dI(3G)){G 1p=3G.1T();F.1b.1f(1p);F.2B.4M(1p.x,1p.y);F.6x(1x,1x)}I}if(2A.8t==K.9Q.jw&&1n.2D(K.pD,2A.3f)){G 1G=2A.6b.1V(F);G f9=1G.f9;G Au=2A.3f;G 1y=Au.1y;G dx=2A.ck.x-f9[1y].x;G dy=2A.ck.y-f9[1y].y;1h(G k=0;k<F.G6.T;k++){G v=F.G6[k];if(v===1F){2V}G p2=f9[k].1T();G d=2h.D9(v,2h.Xp,F.1j.3z);d=1w.2n(d/2,1);p2.x+=dx/(d*d);p2.y+=dy/(d*d);F.1b[k]=p2}F.1b[1y]=2A.ck.1T();if(!F.2z().dI(F.1d)){F.6x(1t,1x)}F.tg();F.1S();I}1n.2o(6t,F,"eW",[2A])},ja:H(2A){1n.2o(6t,F,"ja",[2A]);if(2A.8t==K.9Q.gF){if(1L.5y(2A.ck,F.1b[0])<F.1j.pI){F.bJ=1t;F.2B.vh();F.1S()}}},lY:H(){G 1G=1n.2o(6t,F,"lY",[]);1G.f9=F.1b.9D();I 1G},tk:H(2A){G 1G=2A.6b.1V(F);if(1G!=1c){if(1n.2D(K.pD,2A.3f)){F.1b=1G.f9.9D();F.6x(1x,1t)}}1n.2o(6t,F,"tk",[2A])},2z:H(1b){if(1b===1F){1b=F.1b}G 8P=1c;1h(G i=0;i<1b.T;i++){G 1p=1b[i];if(8P==1c){8P=1a 1I(1p.x,1p.y,0,0)}1k{8P=1iy(8P,1p)}}I 8P!=1c?8P:1I.bo},6x:H(II,2B){if(II===1F){II=1t}if(2B===1F){2B=1t}F.FU=1t;F.4G(F.2z(),II);F.FU=1x;if(2B){F.tg()}},tg:H(){F.2B=1a J.1B.3U();1h(G i=0;i<F.1b.T;i++){G 1p=F.1b[i];if(i==0){F.2B.6B(1p.x,1p.y)}1k{F.2B.4M(1p.x,1p.y)}}if(F.bJ){F.2B.vh()}},BH:H(){1n.2o(6t,F,"BH",[]);if(F.FU){I}G pH=F.2z();if(pH.dI(F.1d)){I}G w=F.1d.1l;G h=F.1d.1o;G mm=2h.4T(F.1j.3z);if(w>mm&&h>mm){if(w!=pH.1l||h!=pH.1o){G 3w=1a 9T();3w.NO(w/pH.1l,h/pH.1o,F.1d);3w.FR(F.1b)}G a6=1a 9T();pH=F.2z();a6.a6(F.1d.x-pH.x,F.1d.y-pH.y);a6.FR(F.1b);F.tg()}},7F:H(1p){G 1y=F.1ib(1p,4*2h.4T(F.1j.3z));if(1y!==1c){I 1a K.pD(F,1y)}I 1n.2o(6t,F,"7F",[1p])},1ib:H(1p,eb){G tY=5O.7T;G T4=1c;1h(G i=0;i<F.1b.T;i++){G sp=F.1b[i];if(1w.4L(sp.x-1p.x)>eb||1w.4L(sp.y-1p.y)>eb){2V}G 8I=1L.5y(1p,sp);if(8I<tY){T4=i;tY=8I}}I T4},3S:H(1p){I K.5p.1s.3S.5j(F,[1p])},BF:H(O){1n.2o(6t,F,"BF",[O]);G 1i8=F.pz();O.cM();O.aQ=1/O.bn;O.8f="dM";O.bE="1sg";1h(G i=0;i<F.1b.T;i++){G 1p=F.1b[i];O.ed();O.k3(1p.x,1p.y,1i8/4,0,2*1w.PI);O.bB();O.3E()}O.cH()},9W:H(){I FP(F.1b)},m5:H(1p){I 1n.2o(6t,F,"m5",[1p])},cD:H(4g,4H){G 8l=4H.5I["4O:6t"];if(8l){if(4g.5j(8l)){I 8l}}I 1n.2o(6t,F,"cD",[4g,4H])},dQ:H(){G 1G=1n.2o(6t,F,"dQ",[]);1G.bJ=F.bJ;1G.1b=FP(F.1b);I 1G},ee:H(1G){F.FU=1t;1n.2o(6t,F,"ee",[1G]);F.FU=1x;F.bJ=1G.bJ;F.1b=FP(1G.1b);F.tg()},SV:H(2f,cE){G 1r=F.3a();G Ta=1c;G IB=5O.7T;G 1i6=20*2h.4T(F.1j.3z);G Bx=1a K.5p(F.1j);Bx.4G(1r);1h(G i=0;i<2f.T;i++){G 2g=2f[i];Bx.7N(2g);G 2b=Bx.9W();G FM=0;1h(G p=0;p<F.1b.T;p++){G 1p=F.1b[p];G 5y=K.1M.FT(1p,2b,2b.T);FM+=5y}FM/=F.1b.T;if(FM<IB){Ta=2g;IB=FM}}Bx.7N(IB<1i6?Ta:cE);I Bx},aL:H(){if(!K.pv){K.pv=1a J.8Q(6t.1s,1c,F)}1k{K.pv.8M(F)}I K.pv}};6t.hG=H(1m){if(!K.pv){K.pv=1a J.8Q(6t.1s,1m)}1k{K.pv.8M(1c)}I K.pv};K.pv=1c;J.2x(6t,"J.1e.6t",K.3m);K.pD=H(S,1iC){F.1g=S;F.1y=1iC};J.2x(K.pD,"J.1e.pD");H 1iy(1d,l4){if(1d.3S(l4)){I 1d}I 1I.gQ(1w.2H(1d.3R(),l4.x),1w.2H(1d.3c(),l4.y),1w.2n(1d.2Z(),l4.x),1w.2n(1d.3F(),l4.y))}H FP(1b){G 1K=[];1h(G i=0;i<1b.T;i++){1K[i]=1b[i].1T()}I 1K}H SG(1b){G 6G="";1h(G i=0;i<1b.T;i++){if(i>0){6G+=","}6G+=1b[i].x.7P();6G+=",";6G+=1b[i].y.7P()}I 6G}H SF(6G){G 1b=[];G J7=6G.cF(",");1h(G i=0;i<J7.T;i+=2){G xs=J7[i];G ys=J7[i+1];G 1p=1a 1L(5O(xs),5O(ys));1b.1f(1p)}I 1b}})(J.1e);(H(K){G 1L=J.1B.1L;G 2h=J.1B.2h;G 5X=K.5X={1iv:H(1p,1g){G 6o=K.6o;G 5K=K.5K;G 1d=1g.3a();G 3b=1g.em();G 1A=1g.I2();G cI=1g.B9();G 1m=1g.4Y();G 1Y=1g.pz();G pB=1m.pB;if(pB===1F){pB=0}if(3b){1p=K.1M.bO(1p,1d.2N(),-3b)}if(1A==5K.G4||1A==5K.QM){I 1d.3S(1p)&&(cI&6o.lD)!=0?{1g:1g,1y:8}:1c}G mm=2h.4T(1m.3z);if(1A==5K.FW||1A==5K.IQ||1A==5K.B8||1A==5K.QK||1A==5K.QI){G 7h=5X.u9(1d,mm);if(1A==5K.B8&&(1p.5y(7h[8])<1.5*1Y)){I 1c}1h(G i=0;i<10;++i){if(1w.4L(7h[i].x-1p.x)<=(1Y/2+pB)&&1w.4L(7h[i].y-1p.y)<=(1Y/2+pB)&&(cI&(1<<i))!=0){I{1g:1g,1y:i}}}if(1A==5K.B8&&1d.3S(1p)&&(cI&6o.lD)!=0){I{1g:1g,1y:8}}1d=1d.7u(1Y/2);if(1A==5K.IQ&&1d.3S(1p)&&(cI&6o.lD)!=0){1d=1d.7u(-1Y);I!1d.3S(1p)?{1g:1g,1y:8}:1c}}1k{G IT=5X.u9(1d,mm);1h(G i=0;i<4;++i){if(1w.4L(IT[i].x-1p.x)<=(1Y/2)&&1w.4L(IT[i].y-1p.y)<=(1Y/2)&&(cI&(1<<i))!=0){I{1g:1g,1y:i}}}G Sy=mm/2;1d=1d.7u(Sy);if(1d.3S(1p)){1d=1d.7u(-Sy);if(1w.4L(1d.3c()-1p.y)<=(1Y/2)&&(cI&6o.Sx)!=0){I{1g:1g,1y:4}}if(1w.4L(1d.2Z()-1p.x)<=(1Y/2)&&(cI&6o.ST)!=0){I{1g:1g,1y:5}}if(1w.4L(1d.3F()-1p.y)<=(1Y/2)&&(cI&6o.SS)!=0){I{1g:1g,1y:6}}if(1w.4L(1d.3R()-1p.x)<=(1Y/2)&&(cI&6o.SR)!=0){I{1g:1g,1y:7}}}G SJ=IT[9];if(1w.4L(SJ.x-1p.x)<=(1Y/2)&&1w.4L(SJ.y-1p.y)<=(1Y/2)&&(cI&6o.iN)!=0){I{1g:1g,1y:9}}G qa=1d.1T();G ht=1g.jb?1g.jb():0;if(ht!=0){qa.1o=ht}1k{qa=qa.7u(-1Y*2)}if((qa.1l<mm||qa.1o<mm)&&1d.3S(1p)){qa=qa.7u(1Y)}if(qa.3S(1p)&&(cI&6o.lD)!=0){I{1g:1g,1y:8}}}I 1c},BK:H(O,1g){G 6o=K.6o;G 5K=K.5K;G 1m=1g.4Y();G 6h=1g.I2();G cj=1g.3a();G 1Y=1g.pz();G mm=2h.4T(1m.3z);if(O.u3){O.u3([])}if(6h==5K.1ht||6h==5K.QM){I}if(6h==5K.FW||6h==5K.1hp||6h==5K.B8){5X.Rj(O,1g);I}if(6h==5K.QK||6h==5K.QI){5X.1hh(O,1g);I}G 2N=cj.2N();if(6h==5K.1hq){5X.1he(O,cj,mm);if((1g.B9()&6o.iN)!=0){5X.F3(O,1g)}I}if(6h==5K.1hx){5X.QX(O,cj,5X.12b(),1Y);if((1g.B9()&6o.iN)!=0){5X.F3(O,1g)}I}if(6h==5K.IQ||6h==5K.1hz||6h==5K.QF||6h==5K.G4){G Il=6h==5K.QF||6h==5K.G4?5X.1hP():5X.12b();5X.QX(O,cj,Il,1Y);if(6h==5K.G4){I}5X.Rj(O,1g);I}},Rj:H(O,1g){G 6o=K.6o;G 5K=K.5K;G 1d=1g.3a();G 1m=1g.4Y();G Ip=1m.R5();G 2N=1d.2N();G 1Y=1g.pz();G e4=1Y/2;G 1A=1g.I2();G cI=1g.B9();G mm=2h.4T(1m.3z);G In=5X.u9(1d,mm);O.bE=K.1M.bs(O,1m.FZ,1m.3a());O.8f="dM";O.aQ=1/O.bn;if((cI&6o.iN)!=0){5X.F3(O,1g)}1h(G h=0;h<9;h++){G HZ=(cI&(1<<h))==0;if(HZ&&!Ip){2V}G 1p=In[h];if(h==8){if(1A==5K.B8){5X.G0(O,1p,1Y);2V}if(1A!=5K.FW){2V}}O.nv(1p.x-e4,1p.y-e4,1Y,1Y);O.Bp(1p.x-e4,1p.y-e4,1Y,1Y)}},1hh:H(O,1g){G 6o=K.6o;G 1d=1g.3a();G 1m=1g.4Y();G Ip=1m.R5();G 2N=1d.2N();G 1Y=1g.pz();G e4=1Y/2;G cI=1g.B9();G mm=2h.4T(1m.3z);G In=5X.u9(1d,mm);O.bE=K.1M.bs(O,1m.FZ,1m.3a());O.8f="dM";O.aQ=1/O.bn;if((cI&6o.iN)!=0){5X.F3(O,1g)}1h(G h=0;h<9;h++){G HZ=(cI&(1<<h))==0;if(HZ&&!Ip){2V}G 1p=In[h];if(h<4){5X.G0(O,1p,e4*1.2)}1k{O.nv(1p.x-e4,1p.y-e4,1Y,1Y);O.Bp(1p.x-e4,1p.y-e4,1Y,1Y)}}},1he:H(O,1d,mm){O.aQ=1/O.bn;if(O.u3){O.8f="gp";O.Bp(1d.x,1d.y,1d.1l,1d.1o);G 1hn=O.1pN();O.u3([2*mm]);O.8f="dM";O.Bp(1d.x,1d.y,1d.1l,1d.1o);O.u3(1hn)}1k{O.8f="jY";O.ed();5X.xC(O,1d.5H(),1d.hc(),2*mm);5X.xC(O,1d.hc(),1d.bc(),2*mm);5X.xC(O,1d.bc(),1d.hi(),2*mm);5X.xC(O,1d.hi(),1d.5H(),2*mm);O.3E()}},xC:H(O,p1,p2,1hk){G Ih=1w.7J(p1.5y(p2)/1hk);G dx=(p2.x-p1.x)/Ih;G dy=(p2.y-p1.y)/Ih;O.6B(p1.x,p1.y);G x=p1.x,y=p1.y;1h(G i=0;i<Ih;i++){x+=dx;y+=dy;if(i%2==0){O.6B(x,y)}1k{O.4M(x,y)}}if(i%2==0){O.6B(p2.x,p2.y)}1k{O.4M(p2.x,p2.y)}},QX:H(O,1d,Il,1Y){G 3w=O.bn;O.cM();O.3w(1/3w,1/3w);G hB=O.If(Il,"pZ");O.8f=hB;O.aQ=3w*1Y/2;O.Bp(3w*1d.x,3w*1d.y,3w*1d.1l,3w*1d.1o);O.cH()},F3:H(O,1g){G 1m=1g.4Y();G mm=2h.4T(1m.3z);G 1d=1g.3a();G tl=1d.5H();G 2N=1d.2N();G 1p=1a 1L(2N.x,tl.y-6*mm);G 5h=1.4*1g.pz()/2;O.aQ=1/O.bn;O.8f="jY";O.ed();5X.xC(O,1p,1d.12p(),mm);O.3E();O.bE=K.1M.bs(O,1m.FZ,1m.3a());O.8f="dM";5X.G0(O,1p,5h)},u9:H(1d,mm){G tl=1d.5H();G br=1d.bc();G 2N=1d.2N();G 5J=[];5J.1f(tl);5J.1f(1d.hc());5J.1f(br);5J.1f(1d.hi());5J.1f(1a 1L(2N.x,tl.y));5J.1f(1a 1L(br.x,2N.y));5J.1f(1a 1L(2N.x,br.y));5J.1f(1a 1L(tl.x,2N.y));5J.1f(2N);5J.1f(1a 1L(2N.x,tl.y-6*mm));I 5J},G0:H(O,2N,5h){O.ed();O.k3(2N.x,2N.y,5h,0,2*1w.PI,1x);O.1bn();O.bB();O.3E()},12b:H(){if(!5X.Is){5X.Is=5X.If([1,0,0,0,0,0,1,1,0,0,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0,0,0,1,1,0,0,0,0,0,1])}I 5X.Is},1hP:H(){if(!5X.Iu){5X.Iu=5X.If([1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1])}I 5X.Iu},If:H(EX){G hB=3O.hV("3K");hB.1l=8;hB.1o=8;G O=hB.zV("2d");O.bE="MJ(qb,qb,qb)";O.nv(0,0,8,8);G 12f=O.1qF(1,1);G 4e=12f.4e;4e[0]=0;4e[1]=0;4e[2]=0;4e[3]=qb;1h(G y=0;y<8;y++){1h(G x=0;x<8;x++){G i=8*y+x;if(EX[i]){O.1qI(12f,x,y)}}}I hB},Is:1c,Iu:1c}})(J.1e);(H(K){G 1E=J.3X.1E;G 3o=J.3X.3o;G 9x=J.3X.9x;G 1I=J.1B.1I;G 1L=J.1B.1L;G 8K=K.8K={a4:H(3Z,a3,ep){G 2s=a3.vS(3Z.us,3Z.cO,3Z.FS);2s.5e=a3.3a();if(3Z.FS){8K.1jJ(2s)}G jN=3Z.xN?2s.Ev():[2s];G dx=3Z.cv+a3.1d.x;G dy=3Z.cv+a3.1d.y;if(a3.4t!==1F){dy+=a3.4t}1E.1U(jN,H(3l){G lN=J.4j.lN;G k4=8K.1hV(3l);if(3Z.a4(3l)===$ue){I}G 11c=ep!=1F?8K.1hW(3l,3Z,dx,dy,k4,a3,ep,2s):8K.1hT(3l,3Z,dx,dy,k4,a3);if(3Z.fZ==lN.6M){dx+=11c.1l+3Z.cv}1k{dy+=11c.1o+3Z.cv}});if(!ep){8K.11Q(2s)}},11Q:H(2s){2s.$GR.1U(H(2U){2U.11f()});2s.$y9.1U(H(1i,1X){1X.1U(H(r){r.2g=1i.2g;r.Hr()})})},1hV:H(2s){G 8D=1a 3o();2s.2Y.1U(H(e){G 1i=e.4a;if(1i){G jr=1i.HU();G jv=1i.HT();8D.2X(1i,{jr:jr,jv:jv})}});I{8D:8D}},1hW:H(2s,3Z,dx,dy,k4,a3,I7,1hS){G 1d=8K.11J(2s,a3.1d);G ul=[];2s.2M.1U(H(v){G 5d={9I:I7.9I,ba:I7.ba,bh:I7.bh};if(v.4a){if(3Z.cO){G xA=v.x-v.1l/2;G xG=v.y-v.1o/2;if(!(3Z.eQ&&3Z.eQ())){G b=v.4a.1d;5d.5E=1a 1L(b.x,b.y);5d.6U=1a 1L(xA+dx-1d.x,xG+dy-1d.y);if(5d.5E.x!=5d.6U.x||5d.5E.y!=5d.6U.y){ul.1f(1a J.mS.gN(v,5d,H(a,4S){G 1g=a.1g.4a;G 5E=a.pT();G 6U=a.uh();1g.6y(5E.x+(6U.x-5E.x)*4S,5E.y+(6U.y-5E.y)*4S,1t,1t)}))}}1k{G b=v.4a.1d;5d.5E=1a 1L(b.x,b.y);5d.6U=1a 1L(xA,xG);if(5d.5E.x!=5d.6U.x||5d.5E.y!=5d.6U.y){ul.1f(1a J.mS.gN(v,5d,H(a,4S){G 1g=a.1g.4a;G 5E=a.pT();G 6U=a.uh();1g.6y(5E.x+(6U.x-5E.x)*4S,5E.y+(6U.y-5E.y)*4S,1t,1t)}))}}}1k{G hh=3Z.FS?1x:1t;G 3r=v.4a.I3();if(!(3Z.eQ&&3Z.eQ())){G b=v.4a.1d;5d.5E=1a 1L(b.x+b.1l/2-(dx-1d.x),b.y+b.1o/2-(dy-1d.y));5d.6U=1a 1L(v.x,v.y);if(5d.5E.x!=5d.6U.x||5d.5E.y!=5d.6U.y||(3r!=1c&&8K.11j(2s.2M,3r,1a 1L(3r.1d.x+3r.1d.1l/2-(dx-1d.x),3r.1d.y+3r.1d.1o/2-(dy-1d.y))))){ul.1f(1a J.mS.gN(v.4a,5d,H(a,4S){G 1g=a.1g;G 5E=a.pT();G 6U=a.uh();v.x=5E.x+(6U.x-5E.x)*4S;v.y=5E.y+(6U.y-5E.y)*4S;1g.FQ(v,dx-1d.x,dy-1d.y,1t,hh)}))}}1k{G b=v.4a.1d;5d.5E=1a 1L(b.x+b.1l/2,b.y+b.1o/2);5d.6U=1a 1L(v.x,v.y);if(5d.5E.x!=5d.6U.x||5d.5E.y!=5d.6U.y||(3r!=1c&&8K.11j(2s.2M,3r,1a 1L(3r.1d.x+3r.1d.1l/2,3r.1d.y+3r.1d.1o/2)))){ul.1f(1a J.mS.gN(v,5d,H(a,4S){G 1g=a.1g.4a;G g=a.1g;G 5E=a.pT();G 6U=a.uh();v.x=5E.x+(6U.x-5E.x)*4S;v.y=5E.y+(6U.y-5E.y)*4S;1g.FQ(g,0,0,1t,hh)}))}}}}});G 11r=ul.T;1E.1U(ul,H(a){a.7V("J5",H(s,e){11r--;if(11r==0){if(!3Z.uX){8K.11K(a3.1X)}1k{2s.2Y.1U(H(e){G 1i=e.4a;if(1i){if(3Z.uU&&3Z.uU()){1i.7N(K.6j.bZ)}if(!(3Z.eQ&&3Z.eQ())){1i.sF(e.1b,dx-1d.x,dy-1d.y,!3Z.mp)}1k{1i.sF(e.1b,0,0,!3Z.mp)}if(3Z.mp){1i.6x()}1i.131()}})}2s.2Y.1U(H(e){G 1i=e.4a;if(1i){if(3Z.8D==J.4j.lK.13f){G H6=1i.1O.kd(1i.1b[0],1i,1x);G Hc=1i.1H.kd(1i.1b[1i.1b.T-1],1i,1t);1i.Gr(H6.1y);1i.Gp(Hc.1y)}1k{if(3Z.8D==J.4j.lK.117){if(k4&&k4.8D){G eJ=k4.8D.1V(1i);if(eJ){if(eJ.jr||eJ.jr===0){1i.Gr(eJ.jr)}if(eJ.jv||eJ.jv===0){1i.Gp(eJ.jv)}}}}}}});8K.11Q(1hS);if(a3.10J){a3.10J(3Z)}if(a3.FN){a3.FN()}1k{if(a3.1j&&a3.1j.FN){a3.1j.FN(a3)}}}});6V.h3(H(){a.2I()},10)});I 1d},11j:H(2M,3r,11a){G FL=1c;2M.1U(H(v){if(v.4a==3r){FL=v}});I FL!=1c&&(11a.x!=FL.x||11a.y!=FL.y)},1hT:H(2s,3Z,dx,dy,k4,a3){G 1d=8K.11J(2s,a3.1d);2s.2M.1U(H(v){if(v.4a){if(3Z.cO){G xA=v.x-v.1l/2;G xG=v.y-v.1o/2;if(!(3Z.eQ&&3Z.eQ())){v.4a.6y(xA+dx-1d.x,xG+dy-1d.y,1t,1t)}1k{v.4a.6y(xA,xG,1t,1t)}}1k{G hh=3Z.FS?1x:1t;if(!(3Z.eQ&&3Z.eQ())){v.4a.FQ(v,dx-1d.x,dy-1d.y,1t,hh)}1k{v.4a.FQ(v,0,0,1t,hh)}}}});if(!3Z.uX){8K.11K(a3.1X)}1k{2s.2Y.1U(H(e){G 1i=e.4a;if(1i){if(3Z.uU&&3Z.uU()){1i.7N(K.6j.bZ)}if(!(3Z.eQ&&3Z.eQ())){1i.sF(e.1b,dx-1d.x,dy-1d.y,!3Z.mp)}1k{1i.sF(e.1b,0,0,!3Z.mp)}if(3Z.mp){1i.6x()}1i.131()}})}2s.2Y.1U(H(e){G 1i=e.4a;if(1i){if(3Z.8D==J.4j.lK.13f){G H6=1i.1O.kd(1i.1b[0],1i,1x);G Hc=1i.1H.kd(1i.1b[1i.1b.T-1],1i,1t);1i.Gr(H6.1y);1i.Gp(Hc.1y)}1k{if(3Z.8D==J.4j.lK.117){if(k4&&k4.8D){G eJ=k4.8D.1V(1i);if(eJ){if(eJ.jr||eJ.jr===0){1i.Gr(eJ.jr)}if(eJ.jv||eJ.jv===0){1i.Gp(eJ.jv)}}}}}}});I 1d},vS:H(v5,ow,ym,2u,1X,2K){G 2s=1a J.4j.6O();G GR=2s.$GR=1a 1E();G y9=2s.$y9=1a 3o();if(ym){2u.1U(H(S){G 2S=2s.qG(S.3a(),S);2S.1hU=S.8V();2S.5B=S.rK();S.2S=2S});I 2s}G xw=1a 3o();G sG=1a 3o();K.8K.1jt(2u,xw,sG,ow,2K);xw.1U(H(3r){G 1d=8K.1ju(xw.1V(3r));G 2S=2s.qG(1d,3r);2S.1hU=3r.8V();2S.5B=3r.rK();3r.2S=2S});1E.1U(1X,H(1i){if(1i.xh()){I}if(!sG.2O(1i.1O)){I}if(!sG.2O(1i.1H)){I}G Gg=sG.1V(1i.1O);G Gc=sG.1V(1i.1H);if(v5){if(1i.1O==1i.1H){GR.1f(1i)}if(Gg==Gc){I}}G Gf;if(v5&&(Gf=Gg.2S.11U(Gc.2S))!=1c){if(!y9.2O(Gf.4a)){y9.2X(Gf.4a,1a 1E())}y9.1V(Gf.4a).1f(1i);I}if(1i.1O!=1i.1H&&Gg==Gc){I}G 2U=2s.qX(Gg.2S,Gc.2S,1i)});I 2s},1jH:H(S,oe,2K){G 5f=S;G Fg=5f.KR(oe);G 6T=1a 1E();6T.1f(5f);3v(Fg!=1c&&Fg!=2K){5f=Fg;if(6T.2O(5f)){G xu=1x;1E.1U(6T,H(n){if(n.xh()){xu=1t;I $2i}});if(xu){7r 1a 7M("1qj 1jD 1ql 1qE uL 1qv on 1ul 1um 1uj 1ui 1tP 1tL or 1tZ 1tW to 1uR 2u 1jD 1uJ xu.")}I S}6T.1f(5f);Fg=5f.KR(oe)}I 5f},Hv:H(S,4P,6T,oe){4P.4K(S);6T.1f(S);if(oe){1E.1U(S.HN(),H(bd){if(bd.xh()){I}8K.Hv(bd,4P,6T,oe)})}if(S.2C){1E.1U(S.2C,H(bd){if(bd.xh()){I}8K.Hv(bd,4P,6T,oe)})}},1jt:H(2u,xw,sG,ow,2K){G 6T=1a 1E();1E.1U(2u,H(S){if(6T.2O(S)){I}G 3r=8K.1jH(S,ow,2K);if(3r.xh()){I}G 4P=1a 9x();8K.Hv(3r,4P,6T,ow);xw.2X(3r,4P);4P.1U(H(n){sG.2X(n,3r)})})},1ju:H(2u){if(2u.Dx()==0){I 1I.bo}G 1d=1c;2u.1U(H(S){1d=S.1d.8P(1d)});I 1d},11K:H(1X){1E.1U(1X,H(1i){1i.Hr()})},11J:H(2s,xp){if(2s.2M.T==0){I xp}G 1d=1c;2s.2M.1U(H(v){1d=1I.lG(v).8P(1d)});I 1d},1jJ:H(2s){2s.2M.1U(H(v){G 4a=v.4a;if(1n.2D(K.3B,4a)){v.uz=4a.jb()}G 9s=4a.KR(1t);if(9s){G 3r=9s.2S;v.3r=3r;if(3r.eL==1c){3r.eL=[]}3r.eL.1f(v)}})}}})(J.1e);(H(K){G 1I=J.1B.1I;G 1L=J.1B.1L;G 7G=J.1B.7G;G 8n=J.1B.8n;G n5=J.1e.n5;G tW=K.tW=H(1i,1P){F.1i=1i;F.1P=1a J.1B.8n(1P||"",1a 1I(0,0,1,1));F.1P.1jL="3c";F.1P.6g=1a 7G(0,0,0,0);F.i8=K.4w.7z;F.gV=K.4w.gE;F.ih=n5.Kq;F.1y=0;F.f0=0.5;F.i0=0;F.4E=1a 7G(2,2,2,2);F.lX=1x;F.4F=5O.7T;F.fU=1I.bo;F.i9=1x};tW.1s={3D:H(1q){F.1P=1a J.1B.8n(1q.1P||"",1a 1I(0,0,1,1));F.1P.1jL="3c";F.1P.6g=1a 7G(0,0,0,0);F.ih=1q.ih;F.1y=1q.1y;F.f0=1q.f0;F.i0=1q.i0;if(5P 1q.4E=="wf"){F.4E=1a 7G(1q.4E,1q.4E,1q.4E,1q.4E)}1k{F.4E=7G.1K(1q.4E)}F.i8=1q.i8;F.gV=1q.gV;F.lX=1q.lX;if(1q.4F){F.4F=1q.4F}if(1q.2m){F.Et(5T.1K(1q.2m))}if(1q.3e){F.iW(1q.3e)}F.1ck(1q.i9);if(1q.1N!=1F){F.7A(1q.1N)}},3q:H(){G 1q={1P:F.1P.1P,ih:F.ih,1y:F.1y,f0:F.f0,i0:F.i0,4E:F.4E,i8:F.i8,gV:F.gV,lX:F.lX,4F:F.4F==5O.7T?1F:F.4F,i9:F.i9,2m:F.2m,3e:F.3e,1N:F.1N};I 1q},5u:H(1v,O){1v.2Q("jf","2");O.c9(F.8V(),"8n",1v);O.4r(F.ih,"1jF",1v);O.4r(F.1y,"jE",1v);O.5w(F.f0,"1jE",1v);O.5w(F.i0,"1iY",1v);O.ER(F.4E,"KJ",1v);O.4r(F.i8,"1iW",1v);O.4r(F.gV,"1j4",1v);O.4o(F.lX,"1iV",1v);O.5w(F.4F,"1iO",1v);O.9k(F.3e,"tR",1v);O.9k(F.1N,"ga",1v);O.qW(F.2m,"5T",1v);O.4o(F.i9,"1iP",1v)},5g:H(1v,O){F.aJ(O.a7("8n",1v));F.ih=O.3Q("1jF",1v);F.1y=O.3Q("jE",1v);F.f0=O.5k("1jE",1v);F.i0=O.5k("1iY",1v);F.4E=O.EB("KJ",1v);F.i8=O.3Q("1iW",1v);F.gV=O.3Q("1j4",1v);F.lX=O.4v("1iV",1v);F.4F=O.5k("1iO",1v);F.3e=O.9r("tR",1v);F.1N=O.9r("ga",1v);F.2m=O.rZ("5T",1v);F.i9=O.4v("1iP",1v)},1T:H(){G 1K=1a F.7i(F.1i);1K.1P=F.1P.1T();1K.ih=F.ih;1K.1y=F.1y;1K.f0=F.f0;1K.i0=F.i0;1K.4E=7G.1K(F.4E);1K.i8=F.i8;1K.gV=F.gV;1K.lX=F.lX;1K.4F=F.4F;1K.i9=F.i9;1K.2m=(F.2m)?5T.1K(F.2m):1F,1K.1N=F.1N;1K.3e=F.3e;I 1K},1sS:H(5v,dx,dy){F.ih=n5.11d;F.1y=5v;F.f0=dx;F.i0=dy;F.1S()},1sV:H(1iQ,dx,dy){F.ih=n5.12S;F.1y=1iQ;F.f0=dx;F.i0=dy;F.1S()},1tz:H(xK){F.ih=n5.Kq;F.f0=xK;F.1S()},uJ:H(){if(F.fU!=1I.bo){I F.fU}G 7p=F.1cm();G 2m=(F.2m!=1F)?F.2m:F.1i.hH();G 1Y=F.1i.1j.dG(F.1P.1P,2m,1a 1I(0,0,5O.7T,1));if(F.lX&&F.4F!=5O.7T){1Y=F.1i.1j.dG(F.1P.1P,2m,1a 1I(0,0,F.4F,1Y.1o));1Y.1l=8n.12O(F.1P.1P,F.1P.2m,F.1i.1j.O,F.1i.1j.3w);F.1P.qe=1t}G Rc=/\\r|\\n/.1u8(F.1P.1P);if(Rc){F.1P.qe=1t}G x=0;6m(F.i8){2k K.4w.bi:x=7p.x+F.4E.3R;2i;2k K.4w.7z:x=7p.x-1Y.1l/2;2i;2k K.4w.gE:x=7p.x-1Y.1l-F.4E.2Z;2i}G y=0;6m(F.gV){2k K.4w.bi:y=7p.y+F.4E.3c;2i;2k K.4w.7z:y=7p.y-1Y.1o/2;2i;2k K.4w.gE:y=7p.y-1Y.1o-F.4E.3F;2i}F.fU=1a 1I(x,y,1Y.1l,1Y.1o);F.1P.4G(F.fU,0);I F.fU},1cm:H(){6m(F.ih){2k n5.11d:G 5v=F.1y;if(5v<0){5v=1w.2n(0,F.1i.kl()+5v)}1k{5v=1w.2H(5v,F.1i.kl()-1)}G 1b=F.1i.1cl(5v);G p=F.Ks(0.5,1b);I 1a 1L(p.x+F.f0,p.y+F.i0);2k n5.12S:G 1p=F.1y;if(1p<0){1p=1w.2n(0,F.1i.1b.T+1p)}1k{1p=1w.2H(1p,F.1i.1b.T-1)}G p=F.1i.1b[1p];I 1a 1L(p.x+F.f0,p.y+F.i0);2k n5.Kq:I F.Ks(F.f0);fI:I 1a 1L()}},Ks:H(xK,5t){if(5t==1F){5t=F.1i.F5(20)}G xL=xK*F.C2(5t);G sC=0;1h(G i=0;i<5t.T-1;++i){G 6Q=5t[i];G 7Y=5t[i+1];G mG=6Q.5y(7Y);if(sC+mG>xL){G KD=(7Y.x-6Q.x)/mG;G LA=(7Y.y-6Q.y)/mG;G yq=xL-sC;I 1a 1L(6Q.x+KD*yq,6Q.y+LA*yq)}sC+=mG}I 5t[0]},C2:H(5t){G 6A=0;1h(G i=0;i<5t.T-1;++i){G 6Q=5t[i];G 7Y=5t[i+1];6A+=6Q.5y(7Y)}I 6A},mk:H(){F.fU=1I.bo},1S:H(){if(F.1i&&F.1i.1j&&F.1i.1j.LF){F.1i.1j.LB()}1k{F.fU=1I.bo}},Ly:H(2N){F.fU.DG(1a 1L(2N.x-F.fU.1l/2,2N.y-F.fU.1o/2));F.1P.4G(F.fU,0);I F.fU},t4:H(){I F.1P.1P},nu:H(){I F.uJ()},yn:H(5W){F.aJ(5W)},vt:H(){I F.1i},1sI:H(){I F.i9},1ck:H(N){if(F.i9!=N){F.i9=N;if(F.i9==1t){F.1i.1j.LF=1t}F.1S()}},iW:H(N){F.3e=N;F.1P.2y=N;F.1S()},lo:H(){I F.3e},Et:H(N){F.2m=N;F.1P.2m=N;F.1S()},MB:H(){I F.2m},aJ:H(N){if(F.1P.1P!=N){F.1P.1P=N;F.1S()}},8V:H(){I F.1P.1P},1sC:H(N){if(F.i8!=N){F.i8=N;F.1S()}},1sv:H(){I F.i8},1su:H(N){if(F.gV!=N){F.gV=N;F.1S()}},1sB:H(){I F.gV},1sM:H(N){if(F.4E!=N){F.4E=N;F.1S()}},1sY:H(){I F.4E},7A:H(N){if(F.1N!==N){F.1N=N;if(F.1i&&F.1i.1j){F.1i.1j.1S()}}},bs:H(){I F.1N}};J.2x(tW,"J.1e.tW")})(J.1e);(H(K){G 2J=J.6Z.2J;G gn=K.gn=H(1j,jB,Ls){1n.2T(gn,F,[1j]);F.jB=jB;F.Ls=Ls||H(1m,1O,1H){I 1a K.4c(1m,1O,1H)}};gn.1s={iH:H(1p,vE){G 7F=F.1m.3h.7F(1p);if(7F){I F.yQ(1p,7F)}G 3f=F.1m.vC(1p);if(3f){I F.yQ(1p,3f)}G S=F.1m.qT(1p,1t,1t);if(S!=1c&&S.F8(1t)){I F.h0(2J.136)}I F.h0(2J.f2)},JK:H(){I F.jB(F.1m)},Ln:H(1O,1p){G 1i=F.Ls(F.1m,1O,1p);1i.3A.F7(1p);I 1i},g4:H(1G){G 9a=1n.2o(gn,F,"g4",[1G]);if(9a){I 9a}G 3L=1c;G pr=F.1m.qT(1G.aD,1t,1t);if(pr!=1c&&pr.F8(1t)){G 1i=F.Ln(pr,1G.aD);3L={1g:1i,1y:1i.1b.T-1};9a=1a K.kJ(F.1m,1i)}1k{G w=F.1m.FB()?F.1m.12j():1;G h=F.1m.FB()?F.1m.121():1;G S=F.JK();G zq=F.1m.JE(S,1G.aD,K.6o.JD);S.4G(1a J.1B.1I(zq.x,zq.y,w,h));3L={1g:S,1y:2};9a=1a K.kP(F.1m,S);9a.vb=F.vb}I 9a}};J.2x(gn,"J.1e.gn",K.gJ)})(J.1e);(H(K){G 2h=J.1B.2h;G 9T=J.1B.9T;G 1E=J.3X.1E;G tG=K.tG=H(1i){1n.2T(tG,F);F.2R=F.7i.ek;F.1i=1i;F.Ys();F.5c=1a 9T();F.4q=K.4w.bi;F.4i=K.4w.bi};tG.1s={gY:H(){I F.2R},1T:H(){G 1K=1a tG(F.1i);1K.5c=F.5c.1T();1K.4q=F.4q;1K.4i=F.4i;I 1K},Yx:H(O,Jg){G 1M=J.1e.1M;G 3w=F.Ba?1:O.bn;O.2m=F.2m.7P(3w);O.bE=F.2y;if(F.3E){O.8f=1M.bs(O,F.3E,F.1d,1t)}O.IK="3R";O.1fh="3c";1h(G i=0;i<F.na.T;++i){G FI=F.na[i];if(FI.T==0){2V}G 1sW=1x;G 4J=F.gv[i];G a0=F.gz[i].1T();if(!F.Ba){if(O.YH){a0=O.YH.WY(a0)}O.1cq(1,0,0,1,0,0);O.aQ=O.aQ*3w}if(4J&&4J!==0){G 3g=1a 9T();3g.a6(a0.x,a0.y);3g.kS(4J);3g.a6(-a0.x,-a0.y);O.5c.5j(O,3g.3g())}if(F.1i.bF==K.jC.12r){G 1j=F.1i.1j;O.bE=1j?1M.bs(O,1j.yz(),a0):"gp";G 1Y=a0.m8();1Y.1l+=2h.4T(1j.3z);1Y.1o+=2h.4T(1j.3z);if(F.4q==K.4w.7z){O.nv(a0.x-1Y.1l/2,a0.y,1Y.1l,1Y.1o);O.bE=F.2y;Jg(FI,a0.x-1Y.1l/2,a0.y,O,3w,4J)}1k{O.nv(a0.x,a0.y,a0.1l,a0.1o);O.bE=F.2y;Jg(FI,a0.x,a0.y,O,3w,4J)}}1k{Jg(FI,a0.x,a0.y,O,3w,4J)}}},lQ:H(O){O.cM();F.Yx(O,F.Aa.zW(F));O.cH()},Aa:H(1P,x,y,O,3w){G f3=1P.cF("\\n");G 1cn=f3.T;G xR=F.2m.1Y*3w;1h(G i=0;i<1cn;i++){if(f3[i]){G FG=y+xR*i;if(F.3E){O.ZW(f3[i],x,FG)}O.1fg(f3[i],x,FG);if(F.2m.BI){FG+=xR*1.Yt;G il=O.11W(f3[i]);G Yu=J.1B.8n.1s.Yu;Yu.oI(F,O,x,FG,il.1l)}}}},Ys:H(){F.gz=1a 1E();F.gv=1a 1E();F.na=1a 1E()},Ok:H(fg){G 1u=fg.li("ls://ln.w3.gc/js/bx","g");G O={5c:H(){},1cq:H(){},nv:H(){}};G 4U=F.2m.1Y;F.Yx(O,H(1P,x,y,O,3w,4J){G oF=fg.li("ls://ln.w3.gc/js/bx","1P");oF.2Q("3E","yB");oF.2Q("bB",F.2y);oF.2Q("1A","2m: "+O.2m);oF.2Q("x",x);oF.2Q("y",y+4U);oF.2Q("5c","kS("+4J+" "+x+" "+y+")");oF.1a4=1P;1u.ae(oF)});I 1u}};J.2x(tG,"J.1e.tG")})(J.1e);(H(K){G u0=K.u0=H(1j,jB){1n.2T(u0,F,[1j])};u0.1s={bw:H(e){F.1m.1S()},9Y:H(e){F.1m.1S()},b4:H(e){F.1m.1S()},g4:H(1G){I 1a K.nf(F.1m)}};J.2x(u0,"J.1e.u0",K.gJ)})(J.1e);(H(K){G pn=J.1e.pn;G pn=K.pn=H(1j,jB){1n.2T(pn,F);F.cw=K.qU.tT;F.kK=K.qU.1cp;F.JZ=K.qU.pd};pn.1s={1co:H(){I F.cw},1cf:H(N){F.cw=N},1uB:H(){I F.kK},1uC:H(N){F.kK=N},1uD:H(){I F.JZ},1uG:H(N){F.JZ=N},Fx:H(8t,e){if((F.cw==8t)&&(e.K0)){I 1t}if((F.kK==8t)&&(e.1uF)){I 1t}if((F.JZ==8t)&&(e.1ur)){I 1t}I 1x}};J.2x(pn,"J.1e.pn")})(J.1e);(H(K){G 2J=J.6Z.2J;G rU=K.rU=H(1j){1n.2T(rU,F,[1j])};rU.1s={iH:H(1p,vE){G 7F=F.1m.3h.7F(1p);if(7F){if(1n.2D(K.3m,7F.1g)&&7F.1y<8){I F.h0(F.1ce(7F.1y))}1k{I F.h0(2J.lD)}}G 3f=F.1m.vC(1p);if(3f){I F.yQ(1p,3f)}I F.h0(2J.f2)},g4:H(1G){G 9a=1n.2o(rU,F,"g4",[1G]);if(9a){I 9a}I 1a K.hY(F.1m.3h)}};J.2x(rU,"J.1e.rU",K.gJ)})(J.1e);(H(K){G 1E=J.3X.1E;G 1I=J.1B.1I;G 6F=J.1B.6F;G 2h=J.1B.2h;G 5T=J.1B.5T;G 1L=J.1B.1L;G jW=K.jW=H(1u){1n.2T(jW,F,[1u]);F.1d=1a 1I(0,0,1u.1l,1u.1o);F.3z=J.1B.2h.Y0;F.6c=1t;F.1R=[];F.ag=[];F.iS=[];F.6g=5;F.dJ=1a 6F(24,24);F.hw=1a 6F(24,24);F.ch=1a J.1B.5T("GE-Gy",12);F.cE="az";F.py=1t;F.zk=1n.zl();F.5L=K.5U.hg;F.a9="";F.1cB=1n.4C(F,F.1cE)};jW.1s={e3:H(){1n.2o(jW,F,"e3");G 6q=F.2F();1n.7I(6q,{Lh:1n.4C(F,F.bw)});F.ss=1n.4C(F,F.9Y);1n.7I(3O,{sq:F.ss});F.r6=1n.4C(F,F.b4);1n.7I(3O,{wg:F.r6});6q.7V("1cd",1n.4C(F,F.Hi),1x);6q.7V("1cg",1n.4C(F,F.Ht),1x);6q.7V("1cj",1n.4C(F,F.zd),1x);6q.7V("1ci",1n.4C(F,F.zd),1x);F.3n(K.2q.iF)},gT:H(){1n.j0(3O,"sq",F.ss);1n.j0(3O,"wg",F.r6);1n.2o(jW,F,"gT")},Hn:H(id){G 9B=3O.iw(id);if(9B){G eI=9B.eI;if(eI){eI.7V("HM",1n.4C(F,1n.EJ(F.sI,{id:id})))}}},sI:H(8k,1W){G 9B=3O.iw(1W.id);if(9B){9B.N=K.1M.1ch(F.3q())}},3D:H(1q){F.zg();if(1q>""){G 1z=1n.3D(1q);if(!F.1q&&1z.a9!=1c&&1z.a9!=""){F.IH(1z.a9);F.1q=1q;I}if(1z.dJ!=1c){if(1z.dJ.1l==0&&1z.dJ.1o==0){F.dJ=1c}1k{F.dJ=1z.dJ}}if(1z.hw!=1c){if(1z.hw.1l==0&&1z.hw.1o==0){F.hw=1c}1k{F.hw=1z.hw}}F.6g=1z.6g;F.yx(1z.6c);F.YY(1z.3z);if(1z.8G!==1F){F.y6(1z.8G)}if(1z.5L!==1F){F.IM(1z.5L)}if(1z.fS!==1F){F.fS=1z.fS}F.3Y(K.2q.iF,1z.HB);F.3Y(K.2q.wU,1z.1cA);if(1z.yC){1h(G c in 1z.yC){G KY=1n.3D(1z.yC[c]);K.eZ.YZ(c,KY)}}if(1z.1R GI HL){1h(G i=0;i<1z.1R.T;i++){if(1z.1R[i]){G 1g=F.v4(1z.1R[i],i);G z4="";if(1z.iS GI HL){z4=1z.iS[i]||""}F.1cC(1g,z4)}}}}F.3n(K.2q.iF);F.1S()},v4:H(1z,1y){G 2R=1n.mY(1z.GA||1z.2R);if(!2R){I 1c}if(1n.wp(2R,K.3m)){G S=1a 2R(F);S.3D(1z);I S}},3q:H(){G rg=F.2F().4p;G 1d=1n.3a(rg);G 1q={id:F.2F().id,1l:1d.1l,1o:1d.1o,1R:F.HA(),iS:F.1cz(),dJ:F.dJ==1c?1a 6F(0,0):F.dJ,hw:F.hw==1c?1a 6F(0,0):F.hw,6c:F.6c,3z:F.3z,6g:F.6g,5L:F.5L,fS:F.fS};I 1n.3q(1q)},HA:H(){G 2W=[];1h(G i=0,l=F.1R.T;i<l;i++){G 1q=F.1R[i].3q();2W.1f(1q)}I 2W},1cz:H(){G 2W=[];1h(G i=0,l=F.iS.T;i<l;i++){G 1P=F.iS[i].1P;2W.1f(1P)}I 2W},3n:H(6d,1W){G 5V=1n.oH(F,6d);if(5V!=1c){5V(F,1W)}},zg:H(){F.1R=[];F.6n=[];F.iS=[];F.XF()},8p:H(){F.2F().1l=F.2F().1l;F.O.cM();G 3g=1a J.1B.9T();3g.3w(F.3w,F.3w);F.O.YH=3g;F.O.5c.5j(F.O,3g.3g());F.O.aQ=1/F.3w;F.O.bn=F.3w;F.O.1uZ=F.fS;1h(G i=0,l=F.6n.T;i<l;i++){F.6n[i].lQ(F.O)}F.O.cH();if(F.tS){mB(F.tS);F.tS=1c}},J8:H(){G GX=0;if(F.iS.T>0){1h(G i=0,l=F.iS.T;i<l;i++){G mC=F.mN(F.dG(F.iS[i].1P,F.ch));GX=1w.2n(GX,mC)}}G 1cy=F.mN(1n.3a(F.2F().4p));G mC=(F.mN(F.XG())+GX+F.6g*3)*F.3w;G YE=1w.2n(mC,1cy)-2;F.mN(F.2F(),YE);1h(G i=0,l=F.ag.T;i<l;i++){F.mN(F.ag[i],YE)}F.XF()},mk:H(){if(!F.GC){F.GC=h3(F.1cB,20)}},1cE:H(){G yY=1a 6F(0,0);1h(G i=0,l=F.1R.T;i<l;i++){G 1Y=F.dJ!=1c?F.dJ:F.1R[i].8m().m8();F.1R[i].yR();F.H5(F.ag[i]);F.H5(F.1R[i].1P);G b=1I.YK(F.HY(F.6g+(F.8y(yY)+i*F.6g*2),F.6g),1Y);if(F.dJ!=1c){F.1R[i].4G(b)}1k{F.1R[i].3a().DG(b.5H())}G 4J=F.1R[i].em();if(4J!=0){G ib=F.1R[i].3a();G YJ=J.1e.1M.k0(ib,ib.2N(),4J);G dx=YJ.x-b.x;G dy=YJ.y-b.y;G 1cD=1a 1L(b.x-dx,b.y-dy);F.1R[i].3a().DG(1cD)}G c=1I.YK(F.HY(F.6g+(F.8y(yY)+i*F.6g*2),F.mN(1Y)+F.6g*2),F.XL(F.8y(1Y),F.mN(F.2F())-(F.mN(1Y)+F.6g)));F.iS[i].4G(c);G b=1I.YK(F.HY((F.8y(yY)+i*F.6g*2),0),F.XL(F.8y(1Y)+F.6g*2,F.mN(F.2F())));F.ag[i].x=b.x;F.ag[i].y=b.y;F.ag[i].1l=b.1l;F.ag[i].1o=b.1o;F.1R[i].yr();F.z1(F.ag[i]);F.z1(F.1R[i].1P);yY.1l+=1Y.1l;yY.1o+=1Y.1o}F.J8();if(F.GC){mB(F.GC);F.GC=1c}},XF:H(){G 1Y=(F.dJ!=1c)?F.1R.T*F.3w*(F.8y(F.dJ)+2*F.6g):F.3w*(F.8y(F.XG())+F.1R.T*2*F.6g);F.8y(F.2F(),1Y);F.1S()},XG:H(){G 1Y=1a 6F(0,0);1h(G i=0,l=F.1R.T;i<l;i++){G 1d=F.1R[i].8m();1Y.1o+=1d.1o;1Y.1l+=1d.1l}I 1Y},1cC:H(S,z4){if(S!=1F){1E.4K(F.1R,S);S.1j=F;S.yr();G fs=1a 1I();fs.1N={2R:"ik",4N:"6W"};fs.2y="6W";F.ag.1f(fs);F.z1(fs);G mH=S.1P.1T();mH.1P=(z4!=1F)?z4:"";mH.2m=F.ch;if(F.5L==K.5U.6M){mH.4q=K.4w.7z;mH.4i=K.4w.bi}1k{mH.4q=K.4w.bi;mH.4i=K.4w.7z}mH.qe=1t;1E.4K(F.iS,mH);F.z1(mH);F.mk()}},HY:H(T,mC){I F.5L==K.5U.6M?{x:T,y:mC}:{x:mC,y:T}},XL:H(T,mC){I F.5L==K.5U.6M?{1l:T,1o:mC}:{1l:mC,1o:T}},8y:H(1Y,mP){if(mP===1F){I F.5L==K.5U.6M?1Y.1l:1Y.1o}1k{if(F.5L==K.5U.6M){1Y.1l=mP}1k{1Y.1o=mP}}},mN:H(1Y,mP){if(mP===1F){I F.5L==K.5U.6M?1Y.1o:1Y.1l}1k{if(F.5L==K.5U.6M){1Y.1o=mP}1k{1Y.1l=mP}}},Y3:H(1p){1h(G i=0;i<F.ag.T;i++){if(F.ag[i].3S(1p)){I F.ag[i]}}},qT:H(1p){G fs=F.Y3(1p);G 1y=1E.7g(F.ag,fs);I F.1R[1y]},Y4:H(fs){1h(G i=0,l=F.ag.T;i<l;i++){if(F.ag[i]===fs){F.wO=F.1R[i].1T();3O.aM.1A.7y="Y7";F.ag[i].2y="#1uK";F.ag[i].1N={2R:"ik",4N:"hT(51,102,Ll,0.2)"}}1k{F.ag[i].2y="6W";F.ag[i].1N={2R:"ik",4N:"6W"}}}F.1S()},1uQ:H(1g){G 1y=1E.7g(F.1R,1g);G fs=F.ag[1y];F.Y4(fs);F.3n(K.2q.wU,1a K.6D({S:1g}))},1ct:H(){I F.1R},1uO:H(N){F.hw=N;F.mk();F.1S()},1uP:H(){I F.hw},1tX:H(N){F.dJ=N;F.mk();F.1S()},1tY:H(){I F.dJ},IM:H(N){F.5L=N;F.mk();if(F.5L==K.5U.6M){F.2F().4p.1A.1cs="CH";F.2F().4p.1A.ZX="wr"}1k{F.2F().4p.1A.1cs="wr";F.2F().4p.1A.ZX="CH"}F.1S()},XA:H(){I F.5L},1cr:H(N){F.6g=N;F.mk();F.1S()},1cu:H(){I F.6g},yz:H(){I F.9X},yx:H(N){F.6c=N},ZH:H(){I F.6c},12G:H(){I F.8G},y6:H(N){F.8G=N;F.2F().4p.1A.J4=F.8G},IH:H(N){if(F.a9!=N){F.a9=N;if(F.a9!=1c&&F.a9!=""){1cx{K.1Q.dt=1t;1a K.ia().5g(F.a9,1n.4C(F,F.GY),1n.4C(F,F.H0))}1cw(GZ){K.1Q.dt=1x;7r GZ}}1k{K.1Q.dt=1x}}},1cv:H(){I F.a9},GY:H(){F.3D(F.1q);5M F.1q;K.1Q.dt=1x;F.1S()},tp:H(1bU){K.1Q.dt=1x;1E.1U(F.1R,H(1g){if(1g.uD){1g.uD()}})},H0:H(){F.3D(F.1q);5M F.1q;K.1Q.dt=1x;F.1S()},bw:H(e){if(!F.6c){I}if(e.5S===0){F.10d(e)}},10d:H(e){G 7y=J.1e.1M.gk(e,F.2F());F.wO=1c;G fs=F.Y3(F.co(7y));if(fs){F.Y4(fs);G 1y=1E.7g(F.ag,fs);F.3n(K.2q.wU,1a K.6D({S:F.1R[1y]}));e.qy()}F.1S()},XS:H(e){if(e.4I.El===1){if(e.4I.id){G 4I=1n.wS(e.4I.id);if(4I!=1c){if(1n.2D(K.4n,4I)){I 4I}}}}I 1c},9Y:H(e){if(!F.6c){I}G 7y=J.1e.1M.gk(e,F.2F());G 1p=F.co(7y);G S=F.wO;if(S!=1c){G 4I=F.XS(e);if(4I!=1c){4I.H7=1t;G 7y=J.1e.1M.gk(e,4I.2F());G 1p=4I.co(7y);if(!4I.Cm(S,{ck:1p,Cn:1a y8()})||!4I.GW(S,1p)){4I.2F().1A.7y="hS-Y6"}1k{4I.2F().1A.7y="Y7"}}3O.aM.1A.7y="Y7";G 3K=1n.wS(F.2F().id+"XQ");if(!3K){3K=F.1bS()}G 3I=K.1M.1bT(e);3K.2F().1A.3R=3I.x+5+"px";3K.2F().1A.3c=3I.y-20+"px"}1k{3O.aM.1A.7y="fI";F.XT()}},XT:H(){G 3K=1n.wS(F.2F().id+"XQ");if(3K){3K.2F().4p.qz(3K.2F());3K.gT()}},1bS:H(){G 1d=1a 1I(0,0,20,20);G 6q=3O.hV("3K");6q.id=F.2F().id+"XQ";6q.1l=1d.1l;6q.1o=1d.1o;6q.1A.1Z="oB";6q.1A.gw=GV;3O.aM.ae(6q);G 3K=1n.DO(J.1B.Jp,1c,1c,1c,6q);3K.3w=1;3K.8p=F.8p;3K.4G(1d);G S=F.wO.1T();S.6L="6W";S.1j=3K;S.4G(1d);S.yr();3K.8p();I 3K},b4:H(e){if(!F.6c){I}if(e.5S===0){F.10a(e)}},10a:H(e){if(F.wO==1c){I}G 4I=F.XS(e);if(4I!=1c){G S=F.wO;F.1bV(S,4I);F.1bY(S,4I);G 1Y=F.hw;if(1Y==1c){1Y=S.3a().m8()}G 7y=J.1e.1M.gk(e,4I.2F());G 1p=4I.co(7y);if(4I.GW(S,1p)&&4I.Cm(S,{ck:1p,Cn:1a y8()})){S.4G(1I.1ue(1p,1Y));S.oU(4I);if(S.bI){S.bI.8E();S.bI.dS()}if(S.4b){S.4b.8E();S.4b.dS()}if(S.eK){S.eK.8E();S.eK.dS()}4I.9u(S);4I.HP(S);4I.Cw(S,1p);4I.1S()}4I.2F().1A.7y="fI"}3O.aM.1A.7y="fI";F.wO=1c;F.XT()},1bV:H(S,4I){if(S.2m){if(S.2m.1Y){G 1Y=(S.2m.1Y*2h.wD(4I.3z));S.2m.1Y=1Y}}1k{if(S.1A){if(S.1A.4U){G 1Y=(S.1A.4U*2h.wD(4I.3z));S.2m=1a 5T(S.1A.5x||"GE-Gy",1Y,1x,1x)}}}},1bY:H(S,4I){if(S.1A){if(S.1A.3p){S.1A.3p=2h.D9(S.1A.3p,4I.3z,2h.Y0)}}},zf:H(e){G rg=F.2F().4p;G 1d=1n.3a(rg);G Fd=6V.1u9;G Fm=6V.1qy;G cR=e.cR;G me={5S:0,Ho:cR[0].Ho-Fd,Hh:cR[0].Hh-Fm};I me},Hi:H(e){G cR=e.cR;if(F.py&&F.Cs){F.aR=F.zf(e);F.10d(F.aR);e.qy()}},Ht:H(e){G cR=e.cR;if(F.py&&F.Cs){F.aR=F.zf(e);F.9Y(F.aR);e.qy()}},zd:H(e){if(F.py&&F.Cs){F.aR.4I=F.Cs;F.10a(F.aR);F.aR=1a fo()}},1qw:H(cW){F.Cs=cW},3Y:H(6d,ej){if(!ej||ej==""){I}G fn=1a y8("8k","1W","I "+ej+"(8k, 1W)");F.7V(6d,fn)},7V:H(6d,5V){1n.zT(F,6d,5V)}};J.1e.jW.Iv=H(1u){I 1n.DO(J.1e.jW,1c,1c,1c,1u)};J.1e.jW.uN=H(1u,1j){I 1n.wS(1u,1j)};J.2x(jW,"J.1e.jW",J.1B.Jp)})(J.1e);(H(K){G 1E=J.3X.1E;G 1L=J.1B.1L;G 1I=J.1B.1I;G ka=K.ka=H(1u){1n.2T(ka,F,[1u]);F.6c=1t;F.iv="";F.8G="#sb";F.gg=0.3;F.dC=K.iE.yP;F.kf=1x;F.JM=1x;F.Jj=0.3;F.zk=1n.zl();F.bv=25;F.bp=0};ka.1s={e3:H(){1n.2o(ka,F,"e3");F.ss=1n.4C(F,F.9Y);1n.7I(3O,{sq:F.ss});F.r6=1n.4C(F,F.b4);1n.7I(3O,{wg:F.r6});F.ob=1n.4C(F,F.sf);1n.7I(6V,{q7:F.ob});1n.7I(F.2F(),{sq:1n.4C(F,F.9Y)});1n.7I(F.2F(),{Lh:1n.4C(F,F.bw)});1n.7I(F.2F(),{wg:1n.4C(F,F.b4)})},gT:H(){1n.j0(3O,"sq",F.ss);1n.j0(3O,"wg",F.r6);1n.j0(6V,"q7",F.ob);1n.2o(ka,F,"gT")},Hn:H(id){G 9B=3O.iw(id);if(9B){G eI=9B.eI;if(eI){eI.7V("HM",1n.4C(F,1n.EJ(F.sI,{id:id})))}}},HG:H(1m){F.1m=1m;if(1m){F.iv=1m.2F().id;1m.7V(K.2q.8p,1n.4C(F,F.10A));1m.7V(K.2q.KC,1n.4C(F,F.sf));F.aL()}},sI:H(8k,1W){G 9B=3O.iw(1W.id);if(9B){9B.N=F.3q()}},3D:H(1q){if(1q>""){G 1z=1n.3D(1q);if(1z.cW){F.iv=1z.cW;F.1ca(1z.yy);F.y6(1z.8G);F.yx(1z.6c);F.1c0(1z.dC);F.1c1(1z.gg);F.1bZ(1z.kf);F.Jk(1z.bp);F.1qu(1z.fS);F.3Y(K.2q.iF,1z.HB);G 6S=F;h3(H(){I 6S.HI()},100)}}},HI:H(){F.HG(K.4n.uN(F.iv));F.1m.1S();F.1S()},3q:H(){G rg=F.2F().4p;G 1d=1n.3a(rg);G 1q={id:F.2F().id,1l:1d.1l,1o:1d.1o,6c:F.6c,cW:F.iv,yy:F.yy,8G:F.8G,dC:F.dC,gg:F.gg*100,kf:F.kf,bp:F.bp,fS:F.fS};I 1n.3q(1q)},lR:H(){G fQ=F.2F().4p;G 6Q=1a 1L(fQ.8O,fQ.8R);G 7Y=1a 1L(fQ.8O+fQ.1bX,fQ.8R+fQ.ZU);I 1I.gK(6Q,7Y)},kj:H(){if(F.dC!=K.iE.yP){I}if(F.1m==1c){I}G 9n=1n.3a(F.1m.ZZ());9n.1l=9n.1l*100/F.1m.gS;9n.1o=9n.1o*100/F.1m.gS;G ro=1a J.1B.6F(F.2F().4p.1bW,F.2F().4p.ZV);F.gg=1w.2H(ro.1l/9n.1l,ro.1o/9n.1o)},aL:H(){if(F.1m==1c){I}G cW=3O.iw(F.iv).4p;G ZQ=1n.3a(cW);G 9n=1n.3a(F.1m.ZZ());F.1d=1a J.1B.1I(F.1m.1d.x,F.1m.1d.y,9n.1l/F.1m.3w,9n.1o/F.1m.3w);9n.1l=9n.1l*100/F.1m.gS;9n.1o=9n.1o*100/F.1m.gS;G ro=1a J.1B.6F(F.2F().4p.1bW,F.2F().4p.ZV);G wt=F.1bO(9n.1l,9n.1o,ro.1l,ro.1o);G 3K=F.2F();3K.1l=wt.1l;3K.1o=wt.1o;3K.1A.1l=wt.1l+"px";3K.1A.1o=wt.1o+"px";3K.1A.Dd=(ro.1l-wt.1l)/2+"px";3K.1A.xU=(ro.1o-wt.1o)/2+"px";F.kj();if(F.dC!=K.iE.yP){F.ZE()}G ZR=cW.ZU-cW.ZV;G ZS={1l:(ZQ.1l-ZR)/F.1m.3w,1o:(ZQ.1o-ZR)/F.1m.3w};F.5Q=1a J.1B.1I(0,0,ZS.1l,ZS.1o);F.5Q.1N={2R:"ik",4N:"hT(Ll,Ll,Ll,0.2)"};F.5Q.2y="#7f";F.5Q.Jw=F;F.K5=12;F.CR=12;1n.7I(F.1m.w4(),{6E:1n.4C(F,F.z6)});F.Zo();F.10A(F.1m);F.3n(K.2q.iF)},ZE:H(){if(!F.1m){I}G 9n=1n.3a(F.1m.ZZ());G 3K=F.2F();3K.1l=9n.1l*F.gg;3K.1o=9n.1o*F.gg;if(F.dC==K.iE.1bN){3K.1l/=F.1m.yu()/100;3K.1o/=F.1m.yu()/100}3K.1A.1l=3K.1l+"px";3K.1A.1o=3K.1o+"px";3K.4p.1A.Dt="6E";3K.4p.1A.ZX="6E"},10A:H(8k,1W){F.3w=1/J.1B.2h.wD(8k.3z)*F.gg;if(F.dC==K.iE.yv){F.3w*=F.1m.yu()/100}F.6n=F.1bM=1E.1T(8k.10y());if(F.5Q){F.6n.1f(F.5Q)}if(F.5Q){F.5Q.lQ=H(O,o4){O.cM();O.5c.5j(O,F.5c.3g());O.ed();O.1r(F.x,F.y,F.1l,F.1o);O.cM();if(F.9S&&o4!=1x){F.9S.5j(O)}if(F.1N){O.bE=J.1e.1M.bs(O,F.1N,F.3a());O.bB()}O.cH();if(F.2y){O.8f=F.2y;O.aQ=(F.3p?F.3p:1)/O.bn;J.1B.jD.5j(O,F.4V);O.3E()}G m9=F.Jw.JO();if(F.2y&&F.Jw.kf&&F.Jw.dC!=K.iE.yv){G rx=m9.x;G ry=m9.y;G rw=m9.1l;G rh=m9.1o;O.6B(rx+rw,ry);O.4M(rx,ry+rh);O.6B(rx+rw,ry+rh/3);O.4M(rx+rw/3,ry+rh);O.6B(rx+rw,ry+2*rh/3);O.4M(rx+2*rw/3,ry+rh);O.3E()}O.cH()}}F.1S()},JO:H(){G rw=F.K5/F.3w;G rh=F.CR/F.3w;I 1a J.1B.1I(F.5Q.2Z()-rw,F.5Q.3F()-rh,rw,rh)},3n:H(6d,1W){G 5V=1n.oH(F,6d);if(5V!=1c){5V(F,1W)}},bw:H(e){if(!F.6c){I}G 7y=F.gt=K.1M.gk(e,F.2F());G 1p=F.co(7y);G 6S=F;F.hq=K1(H(){6S.1bL()},100);G m9=F.JO();if(F.kf&&m9&&m9.3S(1p)&&F.dC!=K.iE.yv){F.xI=1t;F.Zm=F.5Q.1l;F.1c8=F.5Q.1o;F.1c7=F.1m.yu();F.Kc=1p.x-m9.x;F.Kf=1p.y-m9.y;F.1c9=F.1m.gR();F.1cc=F.1m.gD();e.qy()}1k{if(F.5Q&&F.5Q.3S(1p)){F.Kc=1p.x-F.5Q.x;F.Kf=1p.y-F.5Q.y;F.cA=1t;e.qy()}1k{G x=1w.7J(1p.x-F.5Q.1l/2);G y=1w.7J(1p.y-F.5Q.1o/2);F.JS(x,y);G 6E=F.Z2();if(F.1m){F.1m.w4().8O=6E.x;F.1m.w4().8R=6E.y}}}},9Y:H(e){if(!F.6c){I}F.10r(e);F.gt=K.1M.gk(e,F.2F());if(F.kf){G 1p=F.co(F.gt);if(F.xI){G dx=1p.x-F.Kc;G dy=1p.y-F.Kf;F.JM=1t;F.1bP(dx,dy);F.1S();F.JM=1x;I 1x}}F.10l()},10l:H(){if(F.5Q){if(F.cA){G 1p=F.co(F.gt);F.JS(1w.7J(1p.x-F.Kc),1w.7J(1p.y-F.Kf));G 6E=F.Z2();if(F.1m){F.1m.w4().8O=6E.x;F.1m.w4().8R=6E.y}I 1x}}},1qT:H(e){if(!F.6c){I}F.cA=1x;F.xI=1x},1bL:H(){G 5C=F.lR();if(5C.1l>F.bv*2){5C=K.1M.7u(5C,-F.bv,0)}if(5C.1o>F.bv*2){5C=K.1M.7u(5C,0,-F.bv)}G 6E=!5C.3S(F.gt);if(6E){G fu=F.bp>0?F.bp:4;F.hr=0;F.hv=0;if(F.gt.x<5C.3R()){F.hr=-fu}if(F.gt.y<5C.3c()){F.hv=-fu}if(F.gt.x>5C.2Z()){F.hr=fu}if(F.gt.y>5C.3F()){F.hv=fu}F.wz()}},z6:H(e){if(!F.6c){I}if(!F.cA&&!F.xI){F.Zo()}},10w:H(1p){G 5C=F.lR();if(5C.1l>F.bv*2){5C=K.1M.7u(5C,-F.bv,0)}if(5C.1o>F.bv*2){5C=K.1M.7u(5C,0,-F.bv)}G 6E=!5C.3S(1p);if(6E){G fu=F.bp>0?F.bp:4;F.hr=0;F.hv=0;if(1p.x<5C.3R()){F.hr=-fu}if(1p.y<5C.3c()){F.hv=-fu}if(1p.x>5C.2Z()){F.hr=fu}if(1p.y>5C.3F()){F.hv=fu}F.wz();if(!F.hq){G 6S=F;F.hq=K1(H(){6S.wz()},100)}}1k{if(F.hq){F.xb();F.1S()}}I 6E},xb:H(){if(F.hq){10p(F.hq);5M F.hq}},wz:H(){G 9w=F.lR();if(F.4b){9w.1l-=F.za(0);9w.1o-=F.za(1)}G cb=F.gR(),cd=F.gD();if(9w.1l<F.1d.1l){cb+=F.hr;F.gt.x+=F.hr}if(9w.1o<F.1d.1o){cd+=F.hv;F.gt.y+=F.hv}F.CP(cb,cd,9w,F.1d);F.10l();F.1S()},CP:H(cb,cd,9w,8L){if(!8L){8L=F.1d}if(cb<8L.3R()){cb=8L.3R()}if(cb>8L.2Z()-9w.1l){cb=1w.2n(8L.2Z()-9w.1l,8L.3R())}if(cd<8L.3c()){cd=8L.3c()}if(cd>8L.3F()-9w.1o){cd=1w.2n(8L.3F()-9w.1o,8L.3c())}G dx=F.2F().4p.8O-cb;G dy=F.2F().4p.8R-cd;F.2F().4p.8O=cb;F.2F().4p.8R=cd;if(F.gt){F.gt.x-=dx;F.gt.y-=dy}},b4:H(e){if(!F.6c){I}F.cA=1x;F.xI=1x;F.xb();F.10r(e)},10r:H(e){if(F.kf){G 7y=K.1M.gk(e,F.2F());G 1p=F.co(7y);if(F.5Q&&F.JO().3S(1p)||F.xI){F.2F().4p.1A.7y="1qS-q7"}1k{F.2F().4p.1A.7y="fI"}}},sf:H(e){if(!F.JM){if(F.5Q){F.aL();F.1S()}}},1bO:H(Zg,Zn,1bR,1bQ){G JR=0;G JQ=0;G JN=0;JQ=(1bR/Zg);JN=(1bQ/Zn);JR=(JN<JQ)?JN:JQ;G Gm=1w.7J(Zg*JR);G ua=1w.7J(Zn*JR);I 1a J.1B.6F(Gm,ua)},Zo:H(){if(!F.1m){I}G 4b=F.1m.w4();G 1p=1a J.1B.1L(4b.8O/F.1m.3w,4b.8R/F.1m.3w);if(!CC(1p.x)&&!CC(1p.y)){1p.x+=F.1d.x;1p.y+=F.1d.y;F.JS(1w.7J(1p.x),1w.7J(1p.y))}},JS:H(x,y){F.5Q.x=1w.2n(F.1d.x,1w.2H(x,F.1d.1l+F.1d.x-F.5Q.1l));F.5Q.y=1w.2n(F.1d.y,1w.2H(y,F.1d.1o+F.1d.y-F.5Q.1o));F.1S()},1bP:H(x,y){G Ki=1w.2n(F.1d.x,1w.2H(x,F.1d.1l+F.1d.x-F.K5));if(Ki<F.5Q.x){Ki=F.5Q.x}G Kj=1w.2n(F.1d.y,1w.2H(y,F.1d.1o+F.1d.y-F.CR));if(Kj<F.5Q.y){Kj=F.5Q.y}G q=F.Zm/F.1c8;G x1=F.5Q.x;G y1=F.5Q.y;G x2=F.5Q.x+F.5Q.1l-F.K5;G y2=F.5Q.y+F.5Q.1o-F.CR;if(1w.4L(y1-y2)<0.W3){y2=y1+0.ZI}G a=(y1-y2)/(x1-x2);G b=y2-a*x2;G 8Z=a*Ki+b;G cJ=(Kj-b)/a;G h=8Z+F.CR-F.5Q.y;G w=h*q;F.5Q.1l=w;F.5Q.1o=h;G 1c6=F.Zm/w;F.1m.1qW(F.1c7*1c6,F.1c9,F.1cc);F.1S()},Z2:H(){I 1a J.1B.1L((F.5Q.x-F.1d.x)*F.1m.3w,(F.5Q.y-F.1d.y)*F.1m.3w)},yz:H(){if(F.1m){I F.1m.yz!=1c?F.1m.yz():F.1m.9X}I F.yy},Z3:H(){if(F.1m){I F.1m.Z3()}I 1c},1cb:H(){if(F.1m){if(F.1m.dH){I 1a J.1B.6F(F.1m.dH.1l*F.gg*(F.dC==K.iE.yv?F.1m.yu()/100:1),F.1m.dH.1o*F.gg*(F.dC==K.iE.yv?F.1m.yu()/100:1))}}I 1a J.1B.6F(0,0)},Z8:H(){if(F.1m){I F.1m.Z8()}I J.1B.hW.7z},3Y:H(6d,ej){if(!ej||ej==""){I}G fn=1a y8("8k","1W","I "+ej+"(8k, 1W)");F.7V(6d,fn)},7V:H(6d,5V){1n.zT(F,6d,5V)},12G:H(){I F.8G},y6:H(N){F.8G=N;F.2F().4p.1A.J4=F.8G},1pP:H(){I F.yy},1ca:H(N){F.yy=N},yx:H(N){F.6c=N},ZH:H(){I F.6c},1c1:H(N){G vI=N/100;if(vI>1){vI=1}if(vI<0.ZI){vI=0.ZI}if(F.dC==K.iE.yP){F.Jj=vI}1k{F.gg=vI;F.ZE();F.1S()}},1pL:H(){I F.gg*100},1c0:H(N){if(F.dC==N){I}F.dC=N;if(F.dC==K.iE.yP){F.Jj=F.gg;F.kj()}1k{F.gg=F.Jj}F.1S()},1pM:H(){I F.dC},1pQ:H(){I F.kf},1bZ:H(N){if(F.kf==N){I}F.kf=N;F.1S()},1c2:H(){I F.bp},Jk:H(N){if(F.bp!=N){F.bp=N}},gR:H(){I F.2F().4p.8O},gD:H(){I F.2F().4p.8R}};J.1e.ka.Iv=H(1u){I 1n.DO(J.1e.ka,1c,1c,1c,1u)};J.1e.ka.uN=H(1u,1j){I 1n.wS(1u,1j)};J.2x(ka,"J.1e.ka",J.1B.Jp)})(J.1e);(H(K){G vG=K.vG=H(1j,jB){1n.2T(vG,F,[1j])};vG.1s={iH:H(1p,vE){F.bH=J.6Z.2J.pd;I F.bH},g4:H(1G){I 1a K.n9(F.1m)}};J.2x(vG,"J.1e.vG",K.gJ)})(J.1e);(H(K){G 3t=K.3t=H(1m){F.1m=1m;F.2s=F.1m.vS(1x,1x)};3t.1s.Zr=H(9y,to,Ci){G pm=1c;G ps=1c;1h(G i=0;i<F.2s.2M.T;i++){if(F.2s.2M[i].4a==9y){pm=F.2s.2M[i]}if(F.2s.2M[i].4a==to){ps=F.2s.2M[i]}}G cV=J.4j.3t.Zr(F.2s,pm,ps,1x,Ci);I 3t.ZM(cV)};3t.1s.Zv=H(9y,to,Cj,Cd){G pm=1c;G ps=1c;1h(G i=0;i<F.2s.2M.T;i++){if(F.2s.2M[i].4a==9y){pm=F.2s.2M[i]}if(F.2s.2M[i].4a==to){ps=F.2s.2M[i]}}G 2B=J.4j.3t.Zv(F.2s,pm,ps,Cj,Cd);I 3t.JL(2B)};3t.1s.ZC=H(9y,to){if(9y&&to){G pm=1c;G ps=1c;1h(G i=0;i<F.2s.2M.T;i++){if(F.2s.2M[i].4a==9y){pm=F.2s.2M[i]}if(F.2s.2M[i].4a==to){ps=F.2s.2M[i]}}G 2B=J.4j.3t.ZC(F.2s,pm,ps);I 3t.JL(2B)}};3t.1s.ZJ=H(vR){G JG=1c;if(vR){1h(G i=0;i<F.2s.2M.T;i++){if(F.2s.2M[i].4a==vR){JG=F.2s.2M[i]}}if(JG==1c){I 1c}}G 2B=J.4j.3t.ZJ(F.2s,JG);I 3t.JL(2B)};3t.1s.1pC=H(){I 3t.ZM(J.4j.3t.1c5(F.2s))};3t.JL=H(2B){if(2B){I 1a 3U(2B)}I 1c};3t.ZM=H(cV){G 2W=[];if(!cV){I 2W}if(cV.T>0){cV.1U(H(p){2W.1f(1a 3U(p))})}I 2W};J.2x(3t,"J.1e.3t");G 3U=K.3U=H(2B){F.2u=[];F.1X=[];F.1R=[];if(2B!=1c){2B.2u.1U(H(S){F.2u.1f(S.4a)},F);2B.1X.1U(H(1i){F.1X.1f(1i.4a)},F);2B.1R.1U(H(1g){F.1R.1f(1g.4a)},F)}};3U.1s.rK=H(JI,JJ){G 5B=0;if(JI){F.2u.1U(H(S){5B+=S.rK()})}if(JJ){F.1X.1U(H(1i){5B+=S.rK()})}I 5B};3U.1s.C2=H(){I F.1X.T};J.2x(3U,"J.1e.3U")})(J.1e);(H(K){G 2J=J.6Z.2J;G 2h=J.1B.2h;G vP=K.vP=H(S,dv){1n.2T(vP,F,[S]);F.dv=dv;F.1J=F.S.8i(F.dv);F.1dg=F.1J.1o};vP.1s={aY:H(2p){I 1x},xr:H(2p){I 1t},iH:H(2p){if(F.S.em()!=0){G a=F.S.em();if(a>=-180&&a<-135){I 2J.rM}1k{if(a>=-135&&a<-90){I 2J.mt}1k{if(a>=-90&&a<-45){I 2J.qH}1k{if(a>=-45&&a<0){I 2J.mz}1k{if(a>=0&&a<45){I 2J.rM}1k{if(a>=45&&a<90){I 2J.mt}1k{if(a>=90&&a<135){I 2J.qH}1k{I 2J.mz}}}}}}}}I 2J.mz},dB:H(1p){if(F.S.em()!=0){I K.1M.bO(1p,F.S.1d.2N(),-F.S.em())}I 1p.1T()},bw:H(2p){F.iy=1t;G dB=F.dB(2p);F.3G=F.8Y=dB.y},9Y:H(2p){if(!F.iy){I}G dB=F.dB(2p);F.3G=dB.y;G 1m=F.S.4Y();if(!F.cT){if(1w.4L(F.3G-F.8Y)>=2h.4T(1m.3z)){F.cT=1t;if(1m.g2()){F.zR=1a K.tP(1m,F.S,F.1J)}}}if(F.cT){G e6=F.1J.1o;F.S.AW(F.dv,1w.2n(2h.4T(1m.3z),F.1J.1o+(F.3G-F.8Y)));G au={N:1F};if(!1m.1c4(F.S,F.dv,2p,0,au)){F.S.AW(F.dv,e6)}if(au.N){F.9g()}if(e6!=F.1J.1o){F.8Y=F.3G}}},b4:H(2p){if(F.cT){G 1m=F.S.4Y();if(1m.g2()){1m.5A.f4(F.zR)}1m.1c3(F.S,F.dv,2p,0)}F.iy=1x;F.cT=1x},9g:H(){if(F.cT){F.iy=1x;F.cT=1x;F.S.AW(F.dv,F.1dg);F.zR=1c}}};J.2x(vP,"J.1e.vP",K.ie)})(J.1e);(H(K){G 1L=J.1B.1L;G 1I=J.1B.1I;G 3U=J.1B.3U;G 8n=J.1B.8n;G 1M=J.1e.1M;G 4w=J.1e.4w;G 5U=J.1e.5U;G 2h=J.1B.2h;G jM=K.jM={Zh:0,E7:1,Lx:2};G s8=K.s8=H(1u,1j,5L){1n.2T(s8,F,[1u]);F.1j=1j;F.5L=5L;F.dm=1j.dm;F.h7=1j.h7;F.8G=1j.8G;F.lk=1j.lk;F.ld=1j.ld;F.kC=1j.kC;F.3e=1j.3e;F.kG=1j.kG;F.A3=1x;F.hK=1a J.3X.3o();F.EF=1n.4C(F,F.8p);F.e3()};s8.1s={e3:H(){G 3K=F.2F();if(5P 3K.zV!=="1F"){F.3K=3K;F.O=3K.zV("2d")}1n.7I(3K,{Lh:1n.4C(F,F.bw)});1n.7I(3K,{sq:1n.4C(F,F.9Y)});F.r6=1n.4C(F,F.b4);1n.7I(3O,{wg:F.r6})},gT:H(){},1S:H(){if(!F.tS){F.tS=h3(F.EF,20)}},8p:H(){if(!F.O){I}F.3K.1l=F.3K.1l;G 1d=1n.3a(F.2F());F.O.8f=F.h7;F.O.aQ=(F.3p?F.3p:1)/F.O.bn;F.O.bE=F.8G;F.O.1r(0,0,1d.1l,1d.1o);F.O.bB();F.1dh(F.O);F.1dk(F.O);if(F.e!=1c){F.1di(F.e,F.O)}if(F.tS){mB(F.tS);F.tS=1c}},bw:H(e){if(!F.ld){I}if(e.5S!=0){I}G 1m=F.1j.1m;if(1m==1c){I}1m.zL();F.A3=1t;F.hK=1a J.3X.3o();if(F.2F().LK){F.2F().LK()}G 7y=K.1M.gk(e,1m.2F());F.zK=1m.co(7y);F.mK=F.zK;F.oX=jM.Lx},9Y:H(e){F.e=e;if(F.A3){G 1m=F.1j.1m;G 7y=K.1M.gk(e,1m.2F());G d9=1m.co(7y);if(F.oX==jM.Lx){if(F.5L==5U.6M){if(d9.x<F.zK.x){F.oX=jM.Zh}1k{if(d9.x>F.zK.x){F.oX=jM.E7}}}1k{if(d9.y<F.zK.y){F.oX=jM.Zh}1k{if(d9.y>F.zK.y){F.oX=jM.E7}}}if(F.oX==jM.Lx){I}}G 1R=1m.1df();1h(G i in 1R){G S=1R[i];if(S==1c){2V}if(!1n.2D(K.3m,S)){2V}if(!1m.wb(S)){2V}if(S.we()){2V}if(1m.1de().1R.T>0&&!S.kq()){2V}G 1d=S.3a();if(F.5L==5U.6M){if(F.oX==jM.E7){if(1d.x>=1w.2H(d9.x,F.mK.x)-F.p6()&&1d.x<=1w.2n(d9.x,F.mK.x)+F.p6()&&!F.hK.2O(S)){F.hK.2X(S,4w.bi)}}1k{if(1d.2Z()>=1w.2H(d9.x,F.mK.x)-F.p6()&&1d.2Z()<=1w.2n(d9.x,F.mK.x)+F.p6()&&!F.hK.2O(S)){F.hK.2X(S,4w.gE)}}}1k{if(F.oX==jM.E7){if(1d.y>=1w.2H(d9.y,F.mK.y)-F.p6()&&1d.y<=1w.2n(d9.y,F.mK.y)+F.p6()&&!F.hK.2O(S)){F.hK.2X(S,4w.bi)}}1k{if(1d.3F()>=1w.2H(d9.y,F.mK.y)-F.p6()&&1d.3F()<=1w.2n(d9.y,F.mK.y)+F.p6()&&!F.hK.2O(S)){F.hK.2X(S,4w.gE)}}}}F.hK.1U(H(S){G dh=F.hK.1V(S);G 1d=S.3a();if(F.5L==5U.6M){if(dh==4w.bi){1d.x=d9.x}1k{1d.x=d9.x-1d.1l}}1k{if(dh==4w.bi){1d.y=d9.y}1k{1d.y=d9.y-1d.1o}}S.4G(1d,1x)},F);1m.1S();F.mK=d9}},b4:H(e){if(F.A3){F.A3=1x;F.1j.1m.oD();F.1j.1m.1S();F.hK.1U(H(S){S.4G(S.3a(),1t)})}if(3O.KF){3O.KF()}},D8:H(e){F.e=e;F.1S()},Dk:H(){if(!F.A3){I}G 1m=F.1j.1m;G 7y=K.1M.gk(F.e,1m.2F());G 1p=1m.co(7y);G 1r=1m.3a();G O=1m.O;O.8f=F.kC;O.ed();if(F.5L==5U.6M){O.6B(1p.x,1r.y);O.4M(1p.x,1r.3F())}1k{O.6B(1r.x,1p.y);O.4M(1r.2Z(),1p.y)}O.3E()},1dh:H(O){G 1m=F.1j.1m;if(1m==1c){I}if(1m.10z()==1c){I}G S=1m.10z();if(!1n.2D(K.3m,S)){I}G 1d=F.1j.1dl()?S.8m():S.3a();G eY=1n.3a(F.2F());eY.x=eY.y=0;G lt=F.1j.1m.gj(1a 1L(1d.x,1d.y));G rb=F.1j.1m.gj(1a 1L(1d.2Z(),1d.3F()));G 6E=F.1j.1m.gj(1a 1L(F.1j.1m.gR(),F.1j.1m.gD()));lt.x-=6E.x;lt.y-=6E.y;rb.x-=6E.x;rb.y-=6E.y;F.O.bE=F.lk;if(F.5L==5U.6M){G 1r=eY;1r.y+=1;1r.1o-=2;1r.x=lt.x;1r.1l=rb.x-lt.x+1;if(1r.x<eY.x){1r.1l-=(eY.x-1r.x);1r.x=eY.x}if(1r.x+1r.1l>eY.2Z()){1r.1l=eY.2Z()-1r.x-1}O.nv(1r.x,1r.y,1r.1l,1r.1o)}1k{G 1r=eY;1r.x+=1;1r.1l-=2;1r.y=lt.y;1r.1o=rb.y-lt.y+1;if(1r.y<eY.y){1r.1o-=(eY.y-1r.y);1r.y=eY.y}if(1r.y+1r.1o>eY.3F()){1r.1o=eY.3F()-1r.y-1}O.nv(1r.x,1r.y,1r.1l,1r.1o)}},1dk:H(O){G 1m=F.1j.1m;if(1m==1c){I}G 1r=1n.3a(F.2F());1r.x=1r.y=0;G ci=F.1d9();G d8=F.1d8(ci);G wm;if(F.dm!=2h.1q7){wm=1m.gj(1a 1L(0,0))}1k{wm=1m.gj(1m.1d.8u())}G 6E=1m.gj(1a 1L(1m.gR(),1m.gD()));wm.x-=6E.x;wm.y-=6E.y;G EP=(1m.2m)?1m.2m.1Y:J.1B.5T.1qc.1Y;F.O.bE=F.8G;F.O.ed();if(F.5L==5U.6M){G x=wm.x;G iM=0;if(x<=1r.x){3v(x<1r.x){x+=d8*ci;iM++}x-=d8*ci;iM--}1k{if(x>1r.x){3v(x>1r.x){x-=d8*ci;iM--}}}G zs=F.1j.1dx()?-1:1;3v(x<1r.2Z()){G KX=zs*iM*d8;O.6B(x,1r.3c()+1);O.4M(x,1r.3c()+1r.1o);O.3E();O.8f=F.3e;O.ZW(KX,x+1,1r.1o/2+1);O.8f=F.h7;G bd=2h.1dj(F.dm);if(d8*ci>100){bd*=2}1k{if(d8*ci<=40){bd/=2}}G 8I=d8*ci/bd;1h(G i=1;i<bd;i++){G f=(bd%2==0&&i==bd/2)?3:0;O.6B(x+i*8I,1r.x+EP+1r.1o/2-f);O.4M(x+i*8I,1r.3F()-1);O.3E()}x+=d8*ci;iM++}}1k{G y=wm.y;G iM=0;if(y<=1r.y){3v(y<1r.y){y+=d8*ci;iM++}y-=d8*ci;iM--}1k{if(y>1r.y){3v(y>1r.y){y-=d8*ci;iM--}}}G zs=F.1j.1dn()?-1:1;3v(y<1r.3F()+ci*d8){G KX=zs*iM*d8;O.6B(1r.x+1,y);O.4M(1r.x+1r.1l-2,y);O.3E();O.cM();O.a6(1r.1l/2-EP,y+1);O.kS(90*1w.PI/180);O.8f=F.3e;O.ZW(KX,EP/2,0);O.8f=F.h7;O.cH();G bd=2h.1dj(F.dm);if(d8*ci>100){bd*=2}1k{if(d8*ci<=40){bd/=2}}G 8I=d8*ci/bd;1h(G i=1;i<bd;i++){G f=(bd%2==0&&i==bd/2)?3:0;O.6B(1r.x+EP+1r.1l/2-f,y+i*8I);O.4M(1r.2Z()-1,y+i*8I);O.3E()}y+=d8*ci;iM++}}},1di:H(e,O){G 1m=F.1j.1m;if(1m==1c){I}G 1r=1n.3a(F.2F());1r.x=1r.y=0;G 7y=K.1M.gk(e,1m.2F());G 1p=1m.co(7y);G 1p=1m.gj(1p);G 6E=1m.gj(1a 1L(1m.gR(),1m.gD()));1p.x-=6E.x;1p.y-=6E.y;O.ed();O.8f=F.kG;if(F.5L==5U.6M){O.6B(1p.x,1r.y);O.4M(1p.x,1r.3F())}1k{O.6B(1r.x,1p.y);O.4M(1r.2Z(),1p.y)}O.3E()},1d9:H(){G EX=2h.D9(1,F.dm,2h.Y0);if(F.1j.1m!=1c){EX*=F.1j.1m.gS/100}I EX},1d8:H(ci){G 1P="Xu";G 1l=F.O.11W(1P).1l;G zG=[1,2,5,10,20,50,100,oT,zF,zy,js,1pY,Xu];1h(G i=0;i<zG.T;i++){if(zG[i]*ci>1l){I zG[i]}}I zG[zG.T-1]},p6:H(){G d6=5;if(F.1j.1m==1c){I 1/d6}I 2h.D9(1,F.1j.1m.3z,2h.Xp)/d6}};J.2x(s8,"J.1e.s8","1do");G lh=K.lh=H(1u){1n.2T(lh,F,[1u]);F.sR=1t;F.sM=1t;F.iv="";F.mV=20;F.dm=2h.Xp;F.8G="#1pW";F.h7="#7f";F.lk="1q5";F.ld=1t;F.kC="#7f";F.3e="#7f";F.kG="cU";F.zk=1n.zl()};lh.1s={e3:H(){1n.2o(lh,F,"e3")},gT:H(){if(F.7L){F.7L.gT();F.2F().qz(F.7L.2F());F.7L=1c}if(F.7O){F.7O.gT();F.2F().qz(F.7O.2F());F.7O=1c}1n.j0(6V,"q7",F.ob);1n.2o(lh,F,"gT")},Hn:H(id){G 9B=3O.iw(id);if(9B){G eI=9B.eI;if(eI){eI.7V("HM",1n.4C(F,1n.EJ(F.sI,{id:id})))}}},HG:H(1m){F.1m=1m;if(1m){F.iv=1m.2F().id;F.EF=1n.4C(F,F.wv);1m.7V(K.2q.8p,F.EF);1m.7V(K.2q.8p,1n.4C(F,F.Dk));1m.7V("1q6",1n.4C(F,F.sf));1n.7I(F.1m.w4(),{6E:F.EF});F.ss=1n.4C(F,F.D8);1n.7I(F.1m.2F(),{sq:F.ss});F.ob=1n.4C(F,F.sf);1n.7I(6V,{q7:F.ob});F.aL()}},sI:H(8k,1W){G 9B=3O.iw(1W.id);if(9B){9B.N=F.3q()}},3D:H(1q){if(1q>""){G 1z=1n.3D(1q);if(1z.cW){F.iv=1z.cW;F.1da(1z.dm);F.y6(1z.8G);F.1dd(1z.h7);F.1dc(1z.lk);F.1db(1z.kC);F.iW(1z.3e);F.1du(1z.kG);F.1dt(1z.ld);F.1dy(1z.y5);F.1dw(1z.xP);F.1dm(1z.yb);F.1ds(1z.sR);F.1dv(1z.sM);F.3Y(K.2q.iF,1z.HB);G 6S=F;h3(H(){I 6S.HI()},100)}}},HI:H(){F.HG(K.4n.uN(F.iv));F.1m.1S();F.wv()},3q:H(){G 1q={id:F.2F().id,cW:F.iv,dm:F.dm,8G:F.8G,h7:F.h7,lk:F.lk,kC:F.kC,3e:F.3e,kG:F.kG,ld:F.ld,y5:F.y5,xP:F.xP,yb:F.yb,sR:F.sR,sM:F.sM,};I 1n.3q(1q)},aL:H(){if(F.1m==1c){I}G 3V=F.2F();3V.1A.J4=F.8G;3V.1A.Dt="wr";G vW=3O.hV("3K");vW.id=F.1m.2F().id+"1q4";vW.1o=F.mV;vW.1A.1Z="oB";vW.1A.gw=GV;3V.1d7(vW,3V.fH[0]);F.7L=1a s8(vW,F,5U.6M);G sa=3O.hV("3K");sa.id=F.1m.2F().id+"1q2";sa.1l=F.mV;sa.1A.xU=F.mV+"px";sa.1A.1Z="oB";sa.1A.gw=GV;3V.1d7(sa,3V.fH[0]);F.7O=1a s8(sa,F,5U.hg);F.DF();F.3n(K.2q.iF)},DF:H(){G cW=3O.iw(F.iv).4p;F.1d=1n.3a(cW);if(F.7L){G 1u=F.7L.2F();if(F.sR){1u.1A.bK="qk";cW.1A.xU=F.mV+"px"}1k{1u.1A.bK="wr";cW.1A.xU="xQ"}if(F.sM){1u.1A.Dd=F.mV+"px";1u.1l=F.1d.1l-F.mV}1k{1u.1A.Dd="xQ";1u.1l=F.1d.1l}}if(F.7O){G 1u=F.7O.2F();if(F.sM){1u.1A.bK="qk";cW.1A.Dd=F.mV+"px"}1k{1u.1A.bK="wr";cW.1A.Dd="xQ"}if(F.sR){1u.1A.xU=F.mV+"px";1u.1o=F.1d.1o-F.mV}1k{1u.1A.xU="xQ";1u.1o=F.1d.1o}}F.wv()},wv:H(){if(F.7L!=1c){F.7L.1S()}if(F.7O!=1c){F.7O.1S()}},3n:H(6d,1W){G 5V=1n.oH(F,6d);if(5V!=1c){5V(F,1W)}},D8:H(e){if(F.7L!=1c){F.7L.D8(e)}if(F.7O!=1c){F.7O.D8(e)}},Dk:H(e){if(F.7L!=1c){F.7L.Dk(e)}if(F.7O!=1c){F.7O.Dk(e)}},sf:H(e){F.DF()},3Y:H(6d,ej){if(!ej||ej==""){I}G fn=1a y8("8k","1W","I "+ej+"(8k, 1W)");F.7V(6d,fn)},7V:H(6d,5V){1n.zT(F,6d,5V)},1da:H(N){F.dm=N;if(F.7L){F.7L.dm=N}if(F.7O){F.7O.dm=N}},1s2:H(){I F.dm},y6:H(N){F.8G=N;F.2F().1A.J4=F.8G;if(F.7L){F.7L.8G=N}if(F.7O){F.7O.8G=N}},12G:H(){I F.8G},1dd:H(N){F.h7=N;if(F.7L){F.7L.h7=N}if(F.7O){F.7O.h7=N}},1rU:H(){I F.h7},1dc:H(N){F.lk=N;if(F.7L){F.7L.lk=N}if(F.7O){F.7O.lk=N}},1rT:H(){I F.lk},1db:H(N){F.kC=N;if(F.7L){F.7L.kC=N}if(F.7O){F.7O.kC=N}},1rR:H(){I F.kC},iW:H(N){F.3e=N;if(F.7L){F.7L.3e=N}if(F.7O){F.7O.3e=N}},lo:H(){I F.3e},1du:H(N){F.kG=N;if(F.7L){F.7L.kG=N}if(F.7O){F.7O.kG=N}},1sm:H(){I F.kG},1dt:H(N){F.ld=N;if(F.7L){F.7L.ld=N}if(F.7O){F.7O.ld=N}},1sk:H(){I F.ld},1ds:H(N){F.sR=N;F.DF()},1sf:H(){I F.sR},1dv:H(N){F.sM=N;F.DF()},1rn:H(){I F.sM},1dy:H(N){if(F.y5!=N){F.y5=N;F.wv()}},1dx:H(){I F.y5},1dw:H(N){if(F.xP!=N){F.xP=N;F.wv()}},1dn:H(){I F.xP},1dm:H(N){if(F.yb!=N){F.yb=N;F.wv()}},1dl:H(){I F.yb}};J.1e.lh.Iv=H(1u){I 1n.DO(J.1e.lh,1c,1c,1c,1u)};J.1e.lh.uN=H(1u,1j){I 1n.wS(1u,1j)};J.2x(lh,"J.1e.lh","1do")})(J.1e);(H(K){G 2h=J.1B.2h;G 3U=J.1B.3U;G 1I=J.1B.1I;G wJ=K.wJ=H(S){1n.2T(wJ,F,[S]);F.8E();F.dS()};wJ.1s={xr:H(2p){G iG=F.11k(F.S);I iG!=1c&&iG.3S(2p)},bw:H(2p){F.iy=1t},9Y:H(2p){if(!F.iy){I}F.S.AJ(F.1dr(2p))},b4:H(2p){F.iy=1x},9g:H(){F.iy=1x},dS:H(){G f7=F.9p();F.x=f7.x;F.y=f7.y},mD:H(2p){G 1r=F.j9();if(!1r.3S(2p)){I}G S=F.S;G mm=2h.4T(S.1j.3z);G ah=4*mm;G 6i=1a K.oR(F,S);if(2p.y<1r.y+ah){S.X2()}if(2p.y>1r.3F()-ah){S.VH()}if(S.1j.g2()){S.1j.5A.f4(6i)}},aY:H(2p){I F.j9().3S(2p)},9p:H(){G S=F.S;G mm=2h.4T(S.1j.3z);G 1r=S.1d;G 112=S.jb();I 1a 1I(1r.2Z()-5*mm,1r.y+112,5*mm,1r.1o-112)},j9:H(){G 1r=F.9p();if(F.S.3b!=0){G p=[];p.1f(1r.5H());p.1f(1r.hc());p.1f(1r.bc());p.1f(1r.hi());K.1M.k7(p,K.1M.9J(F.S.1d),F.S.3b);G cJ=1w.2H(p[0].x,1w.2H(p[1].x,1w.2H(p[2].x,p[3].x)));G 8Z=1w.2H(p[0].y,1w.2H(p[1].y,1w.2H(p[2].y,p[3].y)));G eA=1w.2n(p[0].x,1w.2n(p[1].x,1w.2n(p[2].x,p[3].x)));G am=1w.2n(p[0].y,1w.2n(p[1].y,1w.2n(p[2].y,p[3].y)));I 1I.gQ(cJ,8Z,eA,am)}I 1r},8E:H(){G S=F.S;G 1N=F.qf||J.1e.1M.ds(oT,oT,oT,0.5);G 2y=F.1r7||S.hk();G mm=2h.4T(S.1j.3z);G ah=4*mm;G hm=3*mm/4;G 1r=F.9p();1r.x=1r.y=0;1r.1N=1N;1r.2y=1F;F.2w=[1r];G 7l=1a 3U();7l.6B(1r.1l/2,hm);7l.4M(1r.1l-hm,ah-hm);7l.4M(hm,ah-hm);7l.vh();7l.Gv();7l.7A(2y);F.2w.1f(7l);G 7l=1a 3U();7l.6B(1r.1l/2,1r.1o-hm);7l.4M(1r.1l-hm,1r.1o-ah+hm);7l.4M(hm,1r.1o-ah+hm);7l.vh();7l.Gv();7l.7A(2y);F.2w.1f(7l);G iG=F.11k(S,1r);if(iG){iG.2y=1F;iG.1N=2y;F.2w.1f(iG)}},11k:H(S,1r){if(!1r){1r=F.9p()}if(S.2P.T>0){G fW=S.2P[0].1o;G xE=fW*S.2P.T;if(xE>1r.1o){G mm=2h.4T(S.1j.3z);G ah=4*mm;G sV=1r.1o-2*ah;G DK=1w.2n(4*mm,sV*1r.1o/xE);sV-=DK;G 3I=sV*S.8g/S.2P.T;G iG=1r.1T();iG.1o=DK;iG.y+=ah+3I;I iG}}I 1c},1dr:H(2p){G S=F.S;if(S.2P.T>0){G fW=S.2P[0].1o;G xE=fW*S.2P.T;G 1r=F.9p();if(xE>1r.1o){G mm=2h.4T(S.1j.3z);G ah=4*mm;G sV=1r.1o-2*ah;G DK=1w.2n(4*mm,sV*1r.1o/xE);sV-=DK;G 1dq=2p.y-1r.y-ah;G xy=7e(S.2P.T*1dq/sV);xy=1w.2n(0,xy);xy=1w.2H(xy,S.2P.T-1);I xy}}I 0}};J.2x(wJ,"J.1e.wJ",K.ie)})(J.1e);(H(K){G 2h=J.1B.2h;G 3U=J.1B.3U;G 1I=J.1B.1I;G wT=K.wT=H(S){1n.2T(wT,F,[S]);F.8E();F.dS()};wT.1s={dS:H(){G f7=F.9p();F.x=f7.x;F.y=f7.y},mD:H(2p){G 1r=F.j9();if(!1r.3S(2p)){I}G S=F.S;G 6i=1a K.oR(F,S);if(2p.y<1r.2N().y){S.X2()}1k{S.VH()}if(S.1j.g2()){S.1j.5A.f4(6i)}},aY:H(2p){I F.j9().3S(2p)},9p:H(){G S=F.S;G mm=2h.4T(S.1j.3z);G 1r=S.1d.1T();I 1a 1I(1r.2Z()-5*mm,1r.y,5*mm,S.jb())},j9:H(){G 1r=F.9p();if(F.S.3b!=0){G p=[];p.1f(1r.5H());p.1f(1r.hc());p.1f(1r.bc());p.1f(1r.hi());K.1M.k7(p,K.1M.9J(F.S.1d),F.S.3b);G cJ=1w.2H(p[0].x,1w.2H(p[1].x,1w.2H(p[2].x,p[3].x)));G 8Z=1w.2H(p[0].y,1w.2H(p[1].y,1w.2H(p[2].y,p[3].y)));G eA=1w.2n(p[0].x,1w.2n(p[1].x,1w.2n(p[2].x,p[3].x)));G am=1w.2n(p[0].y,1w.2n(p[1].y,1w.2n(p[2].y,p[3].y)));I 1I.gQ(cJ,8Z,eA,am)}I 1r},8E:H(){G S=F.S;G 2y=S.gu();G 1dp=S.hk();G 134=J.1e.1M.ds(100,100,100,0.2);G mm=2h.4T(S.1j.3z);G hm=3*mm/4;G 1r=F.9p();1r.x=1r.y=0;1r.2y=1dp;F.2w=[1r];G fP=1r.1T();fP.2y=2y;fP.1o=1r.1o/2;if(!S.1be()){fP.1N=134;F.2w.1f(fP)}G fP=fP.1T();fP.2y=2y;fP.y+=1r.1o/2;if(!S.1bh()){fP.1N=134;F.2w.1f(fP)}G 11y=2y;G 7l=1a 3U();7l.6B(1r.1l/2,hm);7l.4M(1r.1l-hm,1r.1o/2-hm);7l.4M(hm,1r.1o/2-hm);7l.vh();7l.Gv();7l.7A(11y);F.2w.1f(7l);G 7l=1a 3U();7l.6B(1r.1l/2,1r.1o-hm);7l.4M(1r.1l-hm,1r.1o/2+hm);7l.4M(hm,1r.1o/2+hm);7l.vh();7l.Gv();7l.7A(11y);F.2w.1f(7l)}};J.2x(wT,"J.1e.wT",K.ie)})(J.1e);(H(K){G ws=K.ws=H(1j,jB){1n.2T(ws,F,[1j])};ws.1s={g4:H(1G){I 1a K.hY(F.1m.3h)}};J.2x(ws,"J.1e.ws",K.gJ)})(J.1e);(H(K){G 1I=J.1B.1I;G 3o=J.3X.3o;G 1E=J.3X.1E;G eU=K.eU=H(1j){1n.2T(eU,F,[1j]);F.1R=[];F.2u=[];F.1X=[];F.DS=1t;F.1d=1a 1I(0,0,0,0)};eU.1s={cA:H(2A){1n.2o(eU,F,"cA",[2A]);F.wC=F.1d.1T()},eW:H(2A){if(2A.8t===K.9Q.jw){G 9b=K.1M.lO(2A.ck,2A.9q);G 1p=F.wC.5H().ki(9b);F.1d.DG(1p)}},ja:H(2A){if(2A.8t===K.9Q.gF){G 1cO=1I.gK(2A.9q,2A.ck);F.1cS(1cO);F.1j.1S()}1k{if(2A.8t===K.9Q.jw){F.1j.1cN()}}},lJ:H(2A){1h(G i=0,l=F.2u.T;i<l;i++){G S=F.2u[i];if(!S.lJ(2A)){I 1x}}I 1t},lY:H(){I{1d:F.1d.1T()}},9u:H(1g){if(!1g){I}F.11n(1g);F.1j.bT=1g},11n:H(1g){if(1g.kq()){I}F.1R.1f(1g);1g.OX(1t);if(1n.2D(K.3m,1g)){F.2u.1f(1g);1g.pM()}1k{F.1X.1f(1g)}F.1d=K.1M.1rG(F.1d,1g.8m());F.1j.1cM(1g)},ml:H(1g){if(!F.1cP(1g)){I 1x}if(!F.1j.bT.kq()){F.1j.bT=(F.1R.T>0)?F.1R[0]:1c}I 1t},1cP:H(1g){if(F.10P(1g)){1E.54(F.1R,1g);if(1n.2D(K.3m,1g)){1E.54(F.2u,1g)}1k{1E.54(F.1X,1g)}1g.OX(1x);if(1n.2D(K.3m,1g)){1g.pM()}F.1j.10Q(1g);I 1t}I 1x},xY:H(){F.P3();F.1j.bT=1c},P3:H(){1h(G i=0,l=F.1R.T;i<l;i++){F.1R[i].OX(1x);F.1j.10Q(F.1R[i]);if(1n.2D(K.3m,F.1R[i])){F.1R[i].pM()}}F.1R=[];F.2u=[];F.1X=[]},1ro:H(1g){F.P3();F.1R.1f(1g);1g.1S()},10P:H(1g){1h(G i=0;i<F.1R.T;i++){if(F.1R[i]===1g){I 1t}}I 1x},1cS:H(1r){F.P3();G PJ=[];F.1j.vH(1r,PJ,F.DS,1t);1h(G i=0,l=PJ.T;i<l;i++){F.11n(PJ[i])}if(F.1R.T===0){F.1j.bT=1c}1k{if(F.1j.bT==1c||!F.1j.bT.kq()){F.1j.bT=F.1R[0]}}},DQ:H(){},1cR:H(gP){G 2W=[];1h(G i=0,l=F.1R.T;i<l;i++){if(1n.2D(K.3m,F.1R[i])){G 1T=F.1R[i].1T();if(F.1R[i].2K!=1c&&gP.2O(F.1R[i].2K)){1T.2K=gP.1V(F.1R[i].2K)}if(F.1R[i].9s!=1c&&gP.2O(F.1R[i].9s)){1T.9s=gP.1V(F.1R[i].9s)}gP.2X(F.1R[i],1T);2W.1f(1T)}}I 2W},1cQ:H(gP){G 2W=[];1h(G i=0,l=F.1R.T;i<l;i++){if(1n.2D(K.4c,F.1R[i])){G 1i=F.1R[i];G 1T=1i.1T();if(F.1R[i].1O!=1c&&gP.2O(F.1R[i].1O)){1T.1O=gP.1V(F.1R[i].1O)}1k{1T.1O=1c}if(F.1R[i].1H!=1c&&gP.2O(F.1R[i].1H)){1T.1H=gP.1V(F.1R[i].1H)}1k{1T.1H=1c}1T.119(1i.3A.1T(1T,1T.1O==1c?1a K.bS():1T.1O));1T.12H(1i.3J.1T(1T,1T.1H==1c?1a K.bS():1T.1H));2W.1f(1T)}}I 2W},3q:H(){G 2W=[];G gP=1a 3o();G 2u=F.1cR(gP);G 1X=F.1cQ(gP);G 8S=0;1h(G i=0,l=2u.T;i<l;i++){2u[i].8S=8S++}1h(G i=0,l=2u.T;i<l;i++){G 1q=2u[i].3q();2W.1f(1q)}1h(G i=0,l=1X.T;i<l;i++){G 1i=1X[i];1i.8S=8S++;G 1q=1i.3q();2W.1f(1q)}I 1n.3q({1R:2W})},Dg:H(3L){if(1n.2D(K.3m,F.1j.bT)){I F.1j.bT.Dg(3L)}I F.1d.5H()},7F:H(1p){if(F.1R.T<=1){I 1c}G 1m=F.1j;G 3L=1m.vC(1p,1t);if(3L){if(1m.mF&&1n.2D(K.3m,3L.1g)){I 3L}I{1g:F,1y:8}}G 1g=F.1j.pK(1p);if(1g!=1c&&1g.kq()){I{1g:F,1y:8}}I 1c}};J.2x(eU,"J.1e.eU",K.ao)})(J.1e);(H(K){G 3U=J.1B.3U;G 9T=J.1B.9T;G 1L=J.1B.1L;G 1E=J.3X.1E;G 1Q=K.1Q=H(1D,9U){if(!1D){1D={}}F.1D=1D;if(!F.1D.5Y){F.1D.5Y="LW"}if(1D.id){F.id=1D.id;if(9U!==1t){Ps[1D.id]=F}}if(9U===1t){F.9U=1t}};G Ps=1Q.2f=[];Pn=1x;1Q.dt=1x;1Q.2e=H(id){if(1Q.dt){I 1Q.1cH(id)}if(!Pn){1Q.130()}I Ps[id]};1Q.1cH=H(id){I 1a 1Q({id:id,2b:"M0,0 2t,0 2t,100 L0,100 L0,0"},1t)};1Q.1a7=H(2g){if(!2g||!2g.id){I}if(!Pn){1Q.130()}Ps[2g.id]=2g};1Q.130=H(){Pn=1t;G 1D={};G 2f=[];2f.1f(1D={id:"11F",2b:"5s,20  yX, 10, 0, 0, 1, 50, 0 yX, 10, 0, 0, 1, 50, 20  aC,20  A5, 5, 0, 0, 1, 75, 25  cP,60 z8,60 z8,30 Qt,30 Qt,100 1cG,100 1cG,65 1cF,65 1cF,100 1cI,100 1cI,30 Eq,30 Eq,60 aj,60 aj,25  A5, 5, 0, 0, 1, 30, 20  2L,20"});2f.1f(1D={id:"11D",2b:"M0,100 2L,0 2t,100 L0,100"});2f.1f(1D={id:"DY",5Y:"cg",2b:"",4h:"Ec,95 2L,0 f1,95"});2f.1f(1D={id:"11E",2b:"k5,50 L0,0 6r,0 2t,50 6r,100 L0,100 8B,50"});2f.1f(1D={id:"11w",2b:"M0,0 aj,0 aj,40 6r,40 6r,0 2t,50 6r,100 6r,60 aj,60 aj,100 L0,100 L0,0"});2f.1f(1D={id:"11T",2b:"M0,30 6r,30 6r,0 2t,50 6r,100 6r,70 L0,70 L0,30"});2f.1f(1D={id:"11Z",2b:"M0,30 6r,30 6r,0 2t,50 6r,100 6r,70 L0,70 ak,50 L0,30"});2f.1f(1D={id:"11Y",2b:"10F,30 9N,0 L0,50 9N,100 9N,70 aC,70 aC,100 2t,50 aC,0 aC,30 9N,30"});2f.1f(1D={id:"11L",2b:"M0,100 1cU,66,50,33,0,0 2t,50 L0,100"});2f.1f(1D={id:"11I",2b:"M0,0 aC,0 2t,50 aC,100 L0,100 L0,0"});2f.1f(1D={id:"11N",2b:"k5,0 8B,35 L0,0 L0,100 8B,65 8B,100 2t,50 8B,0",4h:"k5,35 8B,65"});2f.1f(1D={id:"11O",2b:"M0,0 9N,50 L0,100 2t,50 L0,0"});2f.1f(1D={id:"Qr",5Y:"cg",2b:"",4h:"Qh,-37 hu,37"});2f.1f(1D={id:"10X",2b:"M0,25 L0,25 L0,100 2t,100 2t,25 cP,0 aj,0 L0,25"});2f.1f(1D={id:"OV",2b:"5s,0 1rp,95 6r,75 6r,95 8B,95 8B,75 L6,95 2L,0"});2f.1f(1D={id:"10M",2b:"5s,0 2t,50 2L,100 L0,50 2L,0",5l:[{2B:"lP,45 NE,45 aj,32 Eq,25 e7,38 e7,20 dz,20 dz,38 z8,25 cP,32 CV,45 8h,45 8h,55 CV,55 cP,68 z8,75 dz,62 dz,80 e7,80 e7,62 Eq,75 aj,68 NE,55 ak,55 ak,45"}]});2f.1f(1D={id:"10K",2b:"5s,0 2t,50 2L,100 L0,50 2L,0",5l:[{2B:"DA,50 zY,26 Cl,26 2L,40 yN,26 ng,26 dz,50 ng,74 yN,74 2L,60 Cl,74 zY,74 e7,50"}]});2f.1f(1D={id:"11i",2b:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q ",5l:[{2B:"DA,50 yf,28 yI,23 2L,45 Pw,23 Pv,28 dz,50 Pv,73 Pw,78 2L,55 yI,78 yf,73 e7,50"},{2B:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q  8T,50  6v, 40, 0, 0, 1, 10, 50.4s 6v, 40, 0, 0, 1, 90, 49.9m  2t,50",5Y:"cg"}]});2f.1f(1D={id:"11l",2b:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q ",5l:[{2B:"1cL,50 2L,30 2L,70 mA,50"},{2B:"1cK,50 9O,30 9O,70 1cJ,50"},{2B:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q  8T,50  6v, 40, 0, 0, 1, 10, 50.4s 6v, 40, 0, 0, 1, 90, 49.9m  2t,50",5Y:"cg"}]});2f.1f(1D={id:"12T",2b:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q ",4h:"gO,50  6v, 40, 0, 0, 1, 10, 50.4s 6v, 40, 0, 0, 1, 90, 49.9m ",5l:[{2B:"1d2,23 6r,65 Cl,45 yf,77 8B,35 yN,55 ew,23"},{2B:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q  8T,50  6v, 40, 0, 0, 1, 10, 50.4s 6v, 40, 0, 0, 1, 90, 49.9m  2t,50",5Y:"cg"}]});2f.1f(1D={id:"12X",2b:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q ",4h:"gO,50  6v, 40, 0, 0, 1, 10, 50.4s 6v, 40, 0, 0, 1, 90, 49.9m ",5l:[{2B:"lP,35 ew,35 ew,20 D5,50 ew,80 ew,65 ak,65 ak,35"},{2B:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q  8T,50  6v, 40, 0, 0, 1, 10, 50.4s 6v, 40, 0, 0, 1, 90, 49.9m  2t,50",5Y:"cg"}]});2f.1f(1D={id:"12K",2b:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q ",4h:"gO,50  6v, 40, 0, 0, 1, 10, 50.4s 6v, 40, 0, 0, 1, 90, 49.9m  Yg,30 9O,30 9O,70 jT,70 jT,30 2L,50 9O,30",5l:[{2B:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q  8T,50  6v, 40, 0, 0, 1, 10, 50.4s 6v, 40, 0, 0, 1, 90, 49.9m  2t,50",5Y:"cg"}]});2f.1f(1D={id:"12L",2b:"5a,50  3N, 50, 0, 1, 1, 99.1rr, 41.1rF ",5l:[{2B:"Yi,31 2L,12 h1,31 9O,31 yS,50 9O,69 h1,69 2L,88 im,69 CN,69 BY,50 jT,31 im,31"},{2B:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q  8T,50  6v, 40, 0, 0, 1, 10, 50.4s 6v, 40, 0, 0, 1, 90, 49.9m  2t,50",5Y:"cg"}]});2f.1f(1D={id:"12Y",2b:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q ",5l:[{2B:"Dp,50  n4, 30, 0, 0, 1, 20, 50.4s n4, 30, 0, 0, 1, 80, 49.9m "},{2B:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q  8T,50  6v, 40, 0, 0, 1, 10, 50.4s 6v, 40, 0, 0, 1, 90, 49.9m  2t,50",5Y:"cg"}]});2f.1f(1D={id:"139",2b:"5s,0 2t,50 2L,100 L0,50 2L,0",4h:"Dp,50  n4, 30, 0, 0, 1, 20, 50.4s n4, 30, 0, 0, 1, 80, 49.9m  EV,50  Px, 20, 0, 0, 1, 30, 50 Px, 20, 0, 0, 1, 70, 49.9m ",5l:[{2B:"1rH,41 2L,32 MP,41 Za,41 h1,50 Za,59 MP,59 2L,68 Mp,59 qO,59 im,50 qO,41 Mp,41"}]});2f.1f(1D={id:"13a",2b:"5s,0 2t,50 2L,100 L0,50 2L,0",5l:[{2B:"Dp,50  n4, 30, 0, 0, 1, 20, 50.4s n4, 30, 0, 0, 1, 80, 49.9m  aC,50  Px, 20, 0, 0, 1, 30, 50 Px, 20, 0, 0, 1, 70, 49.9m  8h,50",5Y:"cg"}]});2f.1f(1D={id:"13e",2b:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q ",4h:"gO,50  6v, 40, 0, 0, 1, 10, 50.4s 6v, 40, 0, 0, 1, 90, 49.9m ",5l:[{2B:"DA,50 yf,28 yI,23 2L,45 Pw,23 Pv,28 dz,50 Pv,73 Pw,78 2L,55 yI,78 yf,73 e7,50"}]});2f.1f(1D={id:"13b",2b:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q ",4h:"gO,50  6v, 40, 0, 0, 1, 10, 50.4s 6v, 40, 0, 0, 1, 90, 49.9m ",5l:[{2B:"1cL,50 2L,30 2L,70 mA,50"},{2B:"1cK,50 9O,30 9O,70 1cJ,50"}]});2f.1f(1D={id:"12i",2b:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q ",4h:"gO,50  6v, 40, 0, 0, 1, 10, 50.4s 6v, 40, 0, 0, 1, 90, 49.9m ",5l:[{2B:"1d2,23 6r,65 Cl,45 yf,77 8B,35 yN,55 ew,23"}]});2f.1f(1D={id:"123",2b:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q ",4h:"gO,50  6v, 40, 0, 0, 1, 10, 50.4s 6v, 40, 0, 0, 1, 90, 49.9m ",5l:[{2B:"lP,35 ew,35 ew,20 D5,50 ew,80 ew,65 ak,65 ak,35"}]});2f.1f(1D={id:"124",2b:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q ",4h:"gO,50  6v, 40, 0, 0, 1, 10, 50.4s 6v, 40, 0, 0, 1, 90, 49.9m  Yg,30 9O,30 9O,70 jT,70 jT,30 2L,50 9O,30"});2f.1f(1D={id:"122",2b:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q ",4h:"gO,50  6v, 40, 0, 0, 1, 10, 50.4s 6v, 40, 0, 0, 1, 90, 49.9m ",5l:[{2B:"Yi,31 2L,12 h1,31 9O,31 yS,50 9O,69 h1,69 2L,88 im,69 CN,69 BY,50 jT,31 im,31"}]});2f.1f(1D={id:"12y",2b:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q ",4h:"gO,50  6v, 40, 0, 0, 1, 10, 50.4s 6v, 40, 0, 0, 1, 90, 49.9m ",5l:[{2B:"1d1,20 cP,20 cP,80 aj,80 aj,20",1N:"#sb"},{2B:"DA,30 dz,30 dz,31 e7,31 e7,30",1N:"hT(jK,jK,xl,0)",2y:{1N:"#7f",6X:0,1l:1}},{2B:"k5,47 6r,47 6r,48 8B,48 8B,47",1N:"hT(jK,jK,xl,0)",2y:{1N:"#7f",6X:0,1l:1}},{2B:"k5,65 6r,65 6r,66 8B,66 8B,65",1N:"hT(jK,jK,xl,0)",2y:{1N:"#7f",6X:0,1l:1}}]});2f.1f(1D={id:"12F",2b:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q ",4h:"gO,50  6v, 40, 0, 0, 1, 10, 50.4s 6v, 40, 0, 0, 1, 90, 49.9m  Dp,50  n4, 30, 0, 0, 1, 20, 50.4s n4, 30, 0, 0, 1, 80, 49.9m  lP,50 9N,50 Pu,35 9N,39 Pr,24 im,30 5s,20 2L,30 Pt,24 h1,30 Po,35 aC,39 EV,50 8h,50 Po,65 aC,61 Pt,76 h1,70 5s,70 2L,80 Pu,65 9N,61 Pr,76 im,70 5s,50 Oj,24 5s,50 ng,50"});2f.1f(1D={id:"12w",2b:"5s,0 2t,50 2L,100 L0,50 2L,0",5l:[{2B:"lP,45 e7,45 e7,20 dz,20 dz,45 8h,45 8h,55 dz,55 dz,80 e7,80 e7,55 ak,55 ak,45"}]});2f.1f(1D={id:"12q",2b:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q ",5l:[{2B:"lP,35 ew,35 ew,20 D5,50 ew,80 ew,65 ak,65 ak,35"}]});2f.1f(1D={id:"12u",2b:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q ",4h:"Yg,30 9O,30 9O,70 jT,70 jT,30 2L,50 9O,30"});2f.1f(1D={id:"12v",2b:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q ",5l:[{2B:"Yi,31 2L,12 h1,31 9O,31 yS,50 9O,69 h1,69 2L,88 im,69 CN,69 BY,50 jT,31 im,31"}]});2f.1f(1D={id:"12t",2b:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q ",5l:[{2B:"1d1,20 cP,20 cP,80 aj,80 aj,20",1N:"#sb"},{2B:"DA,30 dz,30 dz,31 e7,31 e7,30",1N:"hT(jK,jK,xl,0)",2y:{1N:"#7f",6X:0,1l:1}},{2B:"k5,47 6r,47 6r,48 8B,48 8B,47",1N:"hT(jK,jK,xl,0)",2y:{1N:"#7f",6X:0,1l:1}},{2B:"k5,65 6r,65 6r,66 8B,66 8B,65",1N:"hT(jK,jK,xl,0)",2y:{1N:"#7f",6X:0,1l:1}}]});2f.1f(1D={id:"Xn",2b:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q ",4h:"Dp,50  n4, 30, 0, 0, 1, 20, 50.4s n4, 30, 0, 0, 1, 80, 49.9m  lP,50 9N,50 Pu,35 9N,39 Pr,24 im,30 5s,20 2L,30 Pt,24 h1,30 Po,35 aC,39 EV,50 8h,50 Po,65 aC,61 Pt,76 h1,70 5s,70 2L,80 Pu,65 9N,61 Pr,76 im,70 5s,50 Oj,24 5s,50 ng,50"});2f.1f(1D={id:"hx",5Y:"cg",2b:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q "});2f.1f(1D={id:"QG",2b:"1rc,0 1r6,2,61,7,60,19 1r5,11,51,8,43,14 1rj,19,40,25,41,33 1cT,24,27,13,13,21 10s,25,7,29,15,44 C5,47,0,50,0,63 C3,74,17,72,27,71 1sc,77,14,93,27,100 1s8,100,52,93,55,78 w2,93,81,87,88,80 1s9,69,87,63,79,57 1cX,52,100,43,100,24 1sr,7,77,0,67,0"});2f.1f(1D={id:"QU",2b:"5a,100 L0,100 2t,0 L0,0 2t,100"});2f.1f(1D={id:"QT",2b:"M0,80 C6,94,30,100,50,100 w2,100,94,94,100,80 2L,0 L0,80",4h:"M0,80 10s,65,30,60,50,60 w2,60,90,65,100,80"});2f.1f(1D={id:"QP",2b:"M0,80 C6,94,30,100,50,100 w2,100,94,94,100,80 2L,0 L0,80"});2f.1f(1D={id:"QY",2b:"M0,10 8B,50 L0,90 bg,100 2L,60 8T,100 2t,90 6r,50 2t,10 8T,0 2L,40 bg,0 L0,10"});2f.1f(1D={id:"R4",2b:"M0,100 2t,100 2t,0 L0,0 L0,100",4h:"M0,15 2t,15 M0,85 2t,85"});2f.1f(1D={id:"Bw",2b:"k5,40 8B,0 6r,0 6r,40 2t,40 2t,60 6r,60 6r,100 8B,100 8B,60 L0,60 L0,40 8B,40"});2f.1f(1D={id:"R8",2b:"EV,100 aC,100 L0,100 L0,30 aC,30 L0,30 9N,0 2t,0 aC,30 2t,0 2t,70 aC,100 aC,30 aC,100"});2f.1f(1D={id:"Rd",2b:"5a,20 2t,80 bu,95,70,100,50,100 p3,100,0,95,0,80 L0,20 C0,5,30,0,50,0 w2,0,100,5,100,20",4h:"5a,20 bu,35,70,40,50,40 p3,40,0,35,0,20"});2f.1f(1D={id:"Re",2b:"5a,20 2t,80 bu,95,70,100,50,100 p3,100,0,95,0,80 L0,20 C0,5,30,0,50,0 w2,0,100,5,100,20",4h:"5a,20 bu,35,70,40,50,40 p3,40,0,35,0,20 5a,30 bu,45,70,50,50,50 p3,50,0,45,0,30 5a,40 bu,55,70,60,50,60 p3,60,0,55,0,40"});2f.1f(1D={id:"R7",2b:"oV,100 cQ,100 2t,50 cQ,0 hC,0 L0,50 hC,100"});2f.1f(1D={id:"Rv",2b:"M0,100 ng,100 Pk,100,100,75,100,50 bu,25,85,0,67,0 L0,0 EC,0,33,25,33,50 zr,75,15,100,0,100"});2f.1f(1D={id:"PL",2b:"5s,0 2t,50 2L,100 L0,50 2L,0"});2f.1f(1D={id:"Ry",2b:"M0,50 aj,100 cP,100 2t,50 cP,0 aj,0 L0,50"});2f.1f(1D={id:"Q1",5Y:"cg",2b:"",4h:"Qh,111 hu,37"});2f.1f(1D={id:"Rp",2b:"M0,0 2L,0 1d6,0,100,30,100,50 bu,70,80,100,50,100 L0,100 L0,0"});2f.1f(1D={id:"Qy",2b:"M0,100 2t,100 Pk,100,67,75,67,50 1rS,25,85,0,100,0 L0,0 EC,0,33,25,33,50 zr,75,15,100,0,100"});2f.1f(1D={id:"QC",2b:"n6,0 8T,0 Qx.1d0,0,100,22.Y2,100,50 bu,77.OS,95.1d0,100,90,100 bg,100 C4.1rV,100,1.1rM-15,77.OS,0,50.4s C0,22.1rL,4.1rN,7.1rP-15,9.1rO,0",4h:"n6,0 EC.1d3,0,20,22.Y2,20,50 1s3,77.OS,15.1d3,100,10,100"});2f.1f(1D={id:"QQ",2b:"5a,20 2t,80 bu,95,70,100,50,100 p3,100,0,95,0,80 L0,20 C0,5,30,0,50,0 w2,0,100,5,100,20",4h:"5a,20 bu,35,70,40,50,40 p3,40,0,35,0,20 5a,30 bu,45,70,50,50,50 p3,50,0,45,0,30"});2f.1f(1D={id:"Qz",2b:"k5,100 EC,100,0,70,0,50 C0,30,15,0,40,0 cQ,0 bu,20,100,30,100,50 bu,70,100,80,85,100 8B,100"});2f.1f(1D={id:"SI",2b:"n6,100 8T,100 Qx,100,100,95,100,90 2t,10 bu,5,95,0,90,0 bg,0 C5,0,0,5,0,10 L0,90 C0,95,5,100,10,100",4h:"M0,15 2t,15"});2f.1f(1D={id:"SN",2b:"M0,100 2t,100 2t,0 L0,0 L0,100",4h:"M0,15 2t,15"});2f.1f(1D={id:"Sz",2b:"M0,90 L0,0 2t,0 2t,90 107,80,66,80,50,90 zr,100,16,100,0,90"});2f.1f(1D={id:"Pl",2b:"5s,0 hu,95 2L,95 hu,190 f1,190 2L,95 2L,95 f1,95 2L,0"});2f.1f(1D={id:"Sv",2b:"1cZ,100 ng,100 1d6,100,100,75,100,50 bu,25,85,0,67,0 zY,0 EC,0,0,25,0,50 C0,75,15,100,33,100"});2f.1f(1D={id:"uo",2b:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q "});2f.1f(1D={id:"Sw",2b:"5a,75 2t,0 L0,0 L0,75 aj,100 cP,100 2t,75"});2f.1f(1D={id:"SA",2b:"M0,0 2t,0 2t,100 L0,100 L0,0",4h:"n6,0 L0,10 gO,0 2t,10 gO,100 2t,90 M0,90 bg,100"});2f.1f(1D={id:"SE",2b:"5s,0 2t,50 2L,100 L0,50 2L,0",4h:"k5,10 6r,10 k5,90 6r,90 n6,40 bg,60 gO,40 8T,60"});2f.1f(1D={id:"SB",2b:"M0,0 L0,100 2t,100 2t,30 aC,0 L0,0",4h:"EV,0 aC,30 2t,30"});2f.1f(1D={id:"SC",2b:"M0,0 2t,0 2t,100 L0,100 L0,0",4h:"M5,5 1d5,5 1d5,95 L5,95 L5,5"});2f.1f(1D={id:"SU",2b:"M6.Yc-15,0 1cV.1d4,0,100,22.Y2,100,50 bu,77.OS,55.1d4,100,6.Yc-15,100 M0,100 1cV,75,55,25,0,0"});2f.1f(1D={id:"Tc",2b:"5s,20 1cU,5,65,0,75,0 Pk,0,100,10,100,25 bu,50,67,75,50,100 zr,75,0,50,0,25 C0,10,15,0,25,0 1cT,0,50,5,50,20"});2f.1f(1D={id:"T9",2b:"1rX,100 L0,70 bg,25 2L,0 8T,25 2t,70 yS,100 yI,100"});2f.1f(1D={id:"Te",2b:"M0,0 9N,50 L0,100 2t,100 aC,50 2t,0 L0,0"});2f.1f(1D={id:"Tj",2b:"M0,100 L0,100 2t,100 2t,0 L0,40 L0,100"});2f.1f(1D={id:"Tf",2b:"M0,100 2t,100 2t,0 L0,0 L0,100",4h:"M0,15 2t,15 oV,0 hC,100"});2f.1f(1D={id:"SZ",2b:"M0,0 L0,100 2t,50 2t,100 2t,0 2t,50 L0,0"});2f.1f(1D={id:"SW",2b:"M0,0 L0,100 8h,50 8h,20 2t,0 8h,20 8h,80 6r,100 8h,80 8h,50 L0,0"});2f.1f(1D={id:"T1",2b:"M0,0 cP,0 2t,50 cP,100 L0,100 aj,50 L0,0"});2f.1f(1D={id:"T6",2b:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q ",4h:"oV,15 cQ,85 Qv,15 hC,85"});2f.1f(1D={id:"T7",2b:"10F,0 9N,0 hC,40 e7,40 9N,100 yE,30 zY,27 MP,0 9N,0"});2f.1f(1D={id:"T3",2b:"M0,90 L0,0 2t,0 2t,90 107,80,66,80,50,90 zr,100,16,100,0,90",4h:"oV,0 hC,96"});2f.1f(1D={id:"St",2b:"5a,0 L0,0 ak,100 8h,100 2t,0"});2f.1f(1D={id:"RS",2b:"M0,0 2t,0 2L,100 L0,0"});2f.1f(1D={id:"RT",2b:"M0,100 2t,100 8h,50 2t,0 L0,0 L0,100"});2f.1f(1D={id:"RQ",2b:"5a,100 ak,100 L0,50 ak,0 2t,0 2t,100"});2f.1f(1D={id:"RR",2b:"M0,90 L0,10 1rW,20,33,20,50,10 1cW,0,83,0,100,10 2t,90 107,80,66,80,50,90 zr,100,16,100,0,90"});2f.1f(1D={id:"RZ",2b:"M0,100 2L,74 2t,100 2t,0 2L,25 L0,0 L0,100"});2f.1f(1D={id:"S0",2b:"M0,100 8h,75 2t,85 2t,15 8h,25 L0,0 L0,100"});2f.1f(1D={id:"RX",2b:"M0,92 L0,20 bg,20 bg,10 ak,10 ak,0 2t,0 2t,72 Qx,69,90,69,90,69 8T,82 Pk,79,80,79,80,79 8h,92 1cW,84,53,84,39,92 1q3,100,13,100,0,92",4h:"n6,20 8h,20 8h,79 lP,10 8T,10 8T,69"});2f.1f(1D={id:"RY",2b:"M0,100 8h,100 8h,90 8T,90 8T,80 2t,80 2t,0 ak,0 ak,10 bg,10 bg,20 L0,20 L0,100",4h:"n6,20 8h,20 8h,90 lP,10 8T,10 8T,80"});2f.1f(1D={id:"RD",2b:"1cZ,100 L0,67 L0,33 zY,0 ng,0 2t,33 2t,67 ng,100 zY,100"});2f.1f(1D={id:"RE",2b:"M0,0 2L,100 2t,0 L0,0",4h:"n6,20 8T,20"});2f.1f(1D={id:"RI",2b:"M0,0 2L,0 2t,50 2L,100 L0,100 L0,0"});2f.1f(1D={id:"RN",2b:"M0,70 L0,0 2t,0 2t,70 2L,100 L0,70"});2f.1f(1D={id:"Or",2b:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q ",4h:"5s,0 2L,100 M0,50 2t,50"});2f.1f(1D={id:"Sj",2b:"5s,0 L0,50 hC,100 cQ,100 2t,50 2L,0"});2f.1f(1D={id:"Ph",2b:"5s,0 hu,37 hu,95 f1,95 f1,37 2L,0"});2f.1f(1D={id:"OW",2b:"5s,0 hu,95 2L,60 f1,95 2L,0"});2f.1f(1D={id:"Sn",2b:"M0,100 2t,100 8h,50 2t,0 L0,0 L0,100",4h:"oV,0 hC,100"});2f.1f(1D={id:"So",2b:"5a,100 ak,100 L0,50 ak,0 2t,0 2t,100",4h:"Qv,0 cQ,100"});2f.1f(1D={id:"S4",2b:"M0,0 2t,0 2t,100 L0,100 L0,0",4h:"oV,0 hC,100 Qv,0 cQ,100"});2f.1f(1D={id:"Sc",2b:"M0,0 2t,0 2t,100 L0,100 L0,0",4h:"oV,0 hC,100"});2f.1f(1D={id:"Sb",2b:"5s,0 2t,20 2t,80 2L,100 2L,100 L0,80 L0,20 2L,0",4h:"M0,20 2L,40 2L,100 5s,40 2t,20"});2f.1f(1D={id:"Sa",2b:"M0,100 L0,100 L0,30 9N,0 2t,0 2t,100 L0,100"});2f.1f(1D={id:"Sf",2b:"5s,100 2t,80 2L,0 L0,80 2L,100",4h:"M0,80 2L,60 5s,0 2L,60 5a,80 2L,60"});2f.1f(1D={id:"Se",2b:"5s,100 2t,80 2L,0 L0,80 2L,100",4h:"5s,0 2L,100"});2f.1f(1D={id:"P8",2b:"5s,0 hu,37 hu,95 2L,58 f1,95 f1,37 2L,0"});2f.1f(1D={id:"az",2b:"M0,0 2t,0 2t,100 L0,100 L0,0"});2f.1f(1D={id:"Pa",5Y:"cg",2b:"",4h:"Ec,0 2L,95 f1,0"});2f.1f(1D={id:"P7",2b:"Ec,0 2L,95 f1,0 hu,0"});2f.1f(1D={id:"Qq",5Y:"cg",2b:"1q1,147  1cY, 37, 0, 0, 1, 10, 147 1cY, 37, 0, 0, 1, 84, 147 ",4h:"Ec,0 2L,95 f1,0"});2f.1f(1D={id:"Qk",5Y:"cg",2b:"",4h:"Ec,0 2L,95 f1,0 Qh,110 hu,110"});2f.1f(1D={id:"OY",2b:"5s,0 9O,55 2L,100 jT,55 2L,0"});2f.1f(1D={id:"x9",2b:"U0,0,100,100,2.5"});2f.1f(1D={id:"Sd",2b:"10F,100 2t,100 aC,0 L0,0 9N,100"});2f.1f(1D={id:"S9",2b:"M0,100 aj,0 2t,0 cP,100 L0,100"});2f.1f(1D={id:"Qf",5Y:"cg",2b:"",4h:"Qh,37 hu,-37"});2f.1f(1D={id:"S5",2b:"5s,0 2t,50 2L,100 L0,50 2L,0",4h:"M0,50 2t,50"});2f.1f(1D={id:"S3",2b:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q ",4h:"5s,0 1qe,25,25,75,50,100"});2f.1f(1D={id:"S8",2b:"5s,0 2L,0 8B,33 L0,30 9N,50 hC,100 2L,60 cQ,100 ng,50 2t,30 6r,33 2L,0"});2f.1f(1D={id:"S6",2b:"oV,100 C5,100,0,75,0,50 C0,25,5,0,15,0 cQ,0 Qx,0,100,25,100,50 bu,75,95,100,85,100 hC,100",4h:"oV,0 hC,100 Qv,0 cQ,100"});2f.1f(1D={id:"Sp",2b:"5s,100  3N, 50, 0, 1, 1, 74.1qd, 93.1qf  1qh,93.rN 2t,93.rN 2t,100 2L,100"});2f.1f(1D={id:"Sr",2b:"lP,100 8h,100 1cX,100,100,75,100,50 bu,25,90,0,80,0 ak,0 10s,0,0,25,0,50 C0,75,10,100,20,100"});2f.1f(1D={id:"OR",2b:"5s,0 9O,80 2L,100 jT,80 2L,0"});2f.1f(1D={id:"Sq",2b:"1q8,90 2t,100 2t,0 L0,0 L0,90 6r,90"});2f.1f(1D={id:"DZ",2b:"5s,0 hu,95 f1,95 2L,0"});2f.1f(1D={id:"Si",2b:"M0,0 2t,100 L0,100 L0,0"});2f.1f(1D={id:"Sh",2b:"5a,50 8T.yJ,80.1bK yE.yJ,100 qO.yL,100 L9.yL,80.1bK L0,50 L9.yL,19.1aw qO.yL,0.1ax yE.yJ,0.1ax 8T.yJ,19.1aw 2t,50"});2f.1f(1D={id:"Sk",2b:"n6,0 8T,0 2t,100 L0,100 bg,0"});2f.1f(1D={id:"RL",2b:"5s,0 Qt.Qu,35.Qg 2t,50 Qt.Qu,64.Qu 2L,100 1av.Qg,64.Qu L0,50 1av.Qg,35.Qg 2L,0"});2f.1f(1D={id:"RK",2b:"5s,0 6r.1qa,35.1aB 1pH.1pG,34.yL ng.1pI,55.1ay 1pK.1pF,90.yJ 2L,68 ak.1pB,90.yJ Eq.1pA,55.1ay L2.1pR,34.yL im.1pT,35.1aB 2L,0"});2f.1f(1D={id:"RO",2b:"5s,0 1aA,36.1aq N4.rN,25 Za,50 N4.rN,75 1aA,63.1az 2L,100 N2,63.1az L6.zb,75 qO,50 L6.zb,25 N2,36.1aq 2L,0"});2f.1f(1D={id:"RM",2b:"5s,0 MP.1pO,35.1as wF.1qi,18.1at yE.1qM,46.1au Z4.1qL,61.1ar CV.1qN,59.1ao 1qP.1qO,95.1ap 2L,66 yI.1qG,95.1ap 10o.1qX,59.1ao L1.1qV,61.1ar qO.1qU,46.1au bg.1qt,18.1at Cl.1qo,35.1as 2L,0"});2f.1f(1D={id:"RC",2b:"5s,0 yN.Na,10.MZ Mk.s3,3.qZ yS.MI,16.Nh cQ.j7,14.j3 9O.MK,27.Ng Mw.ra,30.qC wF.MC,42.N0 2t,50 wF.MC,57.Na Mw.ra,69.s3 9O.MK,72.MI cQ.j7,85.j7 yS.MI,83.MK Mk.s3,96.ra yN.Na,89.MC 2L,100 N2.N0,89.MC 9N.qC,96.ra BY.Ng,83.MK mA.j3,85.j7 1aL.Nh,72.MI L3.qZ,69.s3 bg.MZ,57.Na L0,50 bg.MZ,42.N0 L3.qZ,30.qC 1aL.Nh,27.Ng mA.j3,14.j3 BY.Ng,16.Nh 9N.qC,3.qZ N2.N0,10.MZ 2L,0"});2f.1f(1D={id:"RH",2b:"5s,0 dz.LR,10.My CV.LQ,1.Mr yE.LY,13.Ms cP,6.zb 1aM.M9,18.LT cQ.j7,14.j3 1aJ.Mc,25.LV N4.rN,25 1aK.LZ,34.LU Z4.M3,37.Mt wF.N5,44.Mu 2t,50 wF.N5,55.LR Z4.M3,62.LQ 1aK.LZ,65.LY N4.rN,75 1aJ.Mc,74.M9 cQ.j7,85.j7 1aM.M9,81.Mc cP,93.rN yE.LY,86.LZ CV.LQ,98.M3 dz.LR,89.N5 2L,100 Mp.Mu,89.N5 10o.Mt,98.M3 qO.LU,86.LZ aj,93.rN aj.LV,81.Mc mA.j3,85.j7 CN.LT,74.M9 L6.zb,75 f1.Ms,65.LY L1.Mr,62.LQ bg.My,55.LR L0,50 bg.My,44.Mu L1.Mr,37.Mt f1.Ms,34.LU L6.zb,25 CN.LT,25.LV mA.j3,14.j3 aj.LV,18.LT aj,6.zb qO.LU,13.Ms 10o.Mt,1.Mr Mp.Mu,10.My 2L,0"});2f.1f(1D={id:"RG",2b:"5s,0 Oj.ON,10.Nm 1aN.OM,0.Nn h1.OQ,11.No Mk.s3,3.qZ z8.OG,14.NF ew.OK,8.NC cP.Oc,19.NA cQ.j7,14.j3 8h.Of,24.OB 1aO.Ob,22.Ny cQ.O9,31.NH Mw.ra,30.qC D5.Op,38.Nw 1aP.Ot,40.Np wF.On,46.Nl 2t,50 wF.On,53.ON 1aP.Ot,59.OM D5.Op,61.OQ Mw.ra,69.s3 cQ.O9,68.OG 1aO.Ob,77.OK 8h.Of,75.Oc cQ.j7,85.j7 cP.Oc,80.Of ew.OK,91.Ob z8.OG,85.O9 Mk.s3,96.ra h1.OQ,88.Op 1aN.OM,99.Ot Oj.ON,89.On 2L,100 1aH.Nl,89.On 8B.Np,99.Ot NE.Nw,88.Op 9N.qC,96.ra 1aI.NH,85.O9 1aF.Ny,91.Ob 1aC.OB,80.Of mA.j3,85.j7 1aD.NA,75.Oc L8.NC,77.OK mA.NF,68.OG L3.qZ,69.s3 1aE.No,61.OQ L0.Nn,59.OM bg.Nm,53.ON L0,50 bg.Nm,46.Nl L0.Nn,40.Np 1aE.No,38.Nw L3.qZ,30.qC mA.NF,31.NH L8.NC,22.Ny 1aD.NA,24.OB mA.j3,14.j3 1aC.OB,19.NA 1aF.Ny,8.NC 1aI.NH,14.NF 9N.qC,3.qZ NE.Nw,11.No 8B.Np,0.Nn 1aH.Nl,10.Nm 2L,0"});2f.1f(1D={id:"RF",5Y:"cg",2b:"5a,50  3N, 50, 0, 0, 1, 0, 50.4s 3N, 50, 0, 0, 1, 100, 49.7q  1sy,50  1aG, 24, 0, 0, 1, 26, 50.4s 1aG, 24, 0, 0, 1, 74, 50 "});2f.1f(1D={id:"RW",2b:"n6,0 8T,0  yX, 10, 0, 0, 0, 100, 10  2t,90  yX, 10, 0, 0, 0, 90, 100  bg,100  yX, 10, 0, 0, 0, 6.Yc-16, 90  L0,10  yX, 10, 0, 0, 0, 10, 0 "});1h(G i=0;i<2f.T;i++){1a 1Q(2f[i])}};1Q.1s={5g:H(1v,O){F.1D={};F.1D.id=F.id=1v.4y("id");G 5Y=1v.4y("bB-1a5");if(5Y=="1sD"){F.1D.5Y="cg"}1k{F.1D.5Y="LW"}G t9=O.4k("2b",1v);if(t9){F.1D.2b=F.O2(t9,O)}G YI=O.4k("YN",1v);if(YI){F.1D.4h=F.O2(YI,O)}G dR=O.4k("2g-YN",1v);if(dR&&dR.fH.T>0){F.1D.5l=[];1h(G i=0;i<dR.fH.T;i++){G g1=dR.fH[i];if(g1.El!==1){2V}G ub=O.4k("YN",g1);G sd={};sd.2B=F.O2(ub,O);G 1N=O.4k("1N",g1);if(1N){sd.1N=O.MR(1N)}G 2y=O.4k("2y",g1);if(2y){sd.2y=O.nF("2y",g1)}sd.5Y="LW";G YL=O.4k("bB-1a5",g1);if(YL&&YL.1a4=="0"){sd.5Y="cg"}F.1D.5l.1f(sd)}}},O2:H(2a,O){G zc=[];1h(G i=0;i<2a.fH.T;i++){G 2c=2a.fH[i];if(2c.El!==1){2V}G 1z=F.1a6(2c);if(YF.1a3(1z[0])){zc=zc.YG(1z)}1k{if(1z[0]!="yB"){zc.1f(1z)}}}F.pt=1c;G 8x="";1h(G i=0;i<zc.T;i++){G 1z=zc[i];if(1z[0]GI YF){1h(G j=0;j<1z.T;j++){8x+=F.YX(1z[j]);8x+=" "}}1k{8x+=F.YX(1z);if(i==0&&1z[0]=="lz"&&8x.c8(0,1)!="M"){8x="M"+1z[1]+","+1z[2]+" "+8x}8x+=" "}}I 8x.1tI()},YX:H(1z){G 8x="";6m(1z[0]){2k"k3":if(F.pt==1c||F.pt.x!=1z[7]||F.pt.y!=1z[8]){8x+="M"+1z[7]+","+1z[8]+" "}G aG=1z[5]-1z[4];8x+="A"+1z[3]+","+1z[3]+",0,"+(1w.4L(aG)>=1w.PI?1:0)+","+(aG>0?1:0);F.pt=F.YP(1z[1],1z[2],1z[3],1z[5]);8x+=","+F.pt.x+","+F.pt.y;2i;2k"8z":if(F.pt==1c||F.pt.x!=1z[1]||F.pt.y!=1z[2]){8x+="M"+1z[1]+","+1z[2]+" L"+1z[3]+","+1z[4]}1k{8x+="L"+1z[3]+","+1z[4]}F.pt={x:1z[3],y:1z[4]};2i;2k"lz":if(F.pt==1c||F.pt.x!=1z[1]||F.pt.y!=1z[2]){8x+="M"+1z[1]+","+1z[2]+" "}8x+="C"+1z[3]+","+1z[4]+","+1z[5]+","+1z[6]+","+1z[7]+","+1z[8];F.pt={x:1z[7],y:1z[8]};2i;2k"1tF":if(F.pt==1c||F.pt.x!=1z[1]||F.pt.y!=1z[2]){8x+="M"+1z[1]+","+1z[2]+" "}8x+="Q"+1z[3]+","+1z[4]+","+1z[5]+","+1z[6];F.pt={x:1z[5],y:1z[6]};2i;2k"Gq":if(F.pt==1c||F.pt.x!=1z[1]||F.pt.y!=1z[2]){8x+="M"+1z[1]+","+1z[2]+" "}8x+="U"+1z[1]+","+1z[2]+","+1z[3]+","+1z[4]+","+1z[5];F.pt={x:1z[4],y:1z[5]};2i;fI:2i}I 8x},1a6:H(1u){6m(1u.1h0){2k"k3":G x=6s(1u.4y("x"));G y=7e(1u.4y("y"));G w=6s(1u.4y("k3-1l"));G h=6s(1u.4y("k3-1o"));G a=6s(1u.4y("2I"));G sw=6s(1u.4y("aG"));if(sw==f5){I[F.yA(x,y,w,h,a,180),F.yA(x,y,w,h,a+180,180)]}if(sw==-f5){I[F.yA(x,y,w,h,a,-180),F.yA(x,y,w,h,a-180,-180)]}I F.yA(x,y,w,h,a,sw);2k"8z":G 1b=1u.7U("1p");G x1=6s(1b[0].4y("x"));G x2=6s(1b[1].4y("x"));G y1=6s(1b[0].4y("y"));G y2=6s(1b[1].4y("y"));I["8z",x1,y1,x2,y2];2k"lz":G 1b=1u.7U("1p");G x1=6s(1b[0].4y("x"));G x2=6s(1b[1].4y("x"));G x3=6s(1b[2].4y("x"));G x4=6s(1b[3].4y("x"));G y1=6s(1b[0].4y("y"));G y2=6s(1b[1].4y("y"));G y3=6s(1b[2].4y("y"));G y4=6s(1b[3].4y("y"));I["lz",x1,y1,x2,y2,x3,y3,x4,y4];2k"he-wu":G x=6s(1u.4y("x"));G y=6s(1u.4y("y"));G w=6s(1u.4y("w"));G h=6s(1u.4y("h"));G r=6s(1u.4y("r"));I["Gq",x,y,x+w,y+h,r];fI:I["yB"]}},yA:H(x,y,w,h,a,sw){G rx=w/2;G ry=h/2;if(rx==ry){G sp=F.YP(x+w/2,y+h/2,rx,K.1M.GL(a));I["k3",x+rx,y+ry,rx,K.1M.GL(a),K.1M.GL(a+sw),sw<0?1:0,sp.x,sp.y]}G 1b=K.1M.1tn(x,y,w,h,a,sw);G 2W=[];1h(G i=0,kZ=0;i<1b.T;kZ++){2W.1f(["lz"]);1h(G j=0;j<4;j++){if(1b[i+j]==1c){2V}2W[kZ].1f(1b[i+j].x);2W[kZ].1f(1b[i+j].y)}i+=4}I 2W},YP:H(x,y,r,a){I{x:1w.he(x+1w.Gt(a)*r),y:1w.he(y+1w.nk(a)*r)}},5j:H(1g){1g.eO=1a 3U(F.1D.2b||"");1g.eO.9e(F.1D.b5||"#7f");1g.eO.7A(F.1D.b6||"#PY");1g.pb=1a 3U(F.1D.4h||"");1g.pb.9e(F.1D.j8||"#7f");1g.pb.7A(F.1D.pO||"6W");1g.pe=1a 3U(F.1D.g1||"");1g.pe.9e(F.1D.G9||"#7f");1g.pe.7A(F.1D.G7||"#7f")},uO:H(1g,1d,4J){if(1d.1l===0||1d.1o===0){I}G 2z=F.xp;G x=1d.1l/2z.1l;G y=1d.1o/2z.1o;G 3g=1a 9T();3g.a6(1d.x-1d.1l/2,1d.y-1d.1o/2);3g.3w(x,y);3g.a6(1d.1l/x-2z.x-2z.1l/2,1d.1o/y-2z.y-2z.1o/2);if(F.pR>0){3g.nP(F.pR,2z.x+2z.1l/2,2z.y+2z.1o/2)}if(4J!==0){3g.nP(4J,2z.x+2z.1l/2,2z.y+2z.1o/2)}1g.eO.5c=3g.1T();1g.pb.5c=3g.1T();1g.pe.5c=3g.1T()},yr:H(1g,6n,1y){if(1y!=1c){if(!1g.eO.bo()){1E.nX(6n,1y,1g.eO)}if(!1g.pb.bo()){1E.nX(6n,1y+1,1g.pb)}if(!1g.pe.bo()){1E.nX(6n,1y+2,1g.pe)}}1k{if(!1g.eO.bo()){1E.4K(6n,1g.eO)}if(!1g.pb.bo()){1E.4K(6n,1g.pb)}if(!1g.pe.bo()){1E.4K(6n,1g.pe)}}},yR:H(1g,6n){1E.54(6n,1g.eO);1E.54(6n,1g.pb);1E.54(6n,1g.pe)},1T:H(){G 2g=1a 1Q();2g.id=F.id;2g.1D=F.1D;I 2g},NP:H(){I F.id},YT:H(){G 2B=1a 3U(F.1D.2b);G p=2B.6C;if(p[0]=="A"){if(p[7]==0&&p[9]==6.Xg){I 1t}}I 1x},tw:H(){I F.9U===1t},id:"",pR:0,xp:1a J.1B.1I(0,0,100,100)};J.2x(1Q,"J.1e.1Q")})(J.1e);(H(K){G 1Q=J.1e.1Q;G 1E=J.3X.1E;G ia=K.ia=H(2f){F.2f=[];if(2f){1h(G 2g in 2f){F.2f.1f(2g)}}};ia.tp=H(){if(!3O){I}G YS=3O.7U("1tp");if(!YS){I}1E.1U(YS,H(1u){G cw=J.uN(1u.id);if(cw&&cw.tp){cw.tp()}})};ia.1s={5g:H(NY,ig,tL){G u4=F;G 9F=1a Yk();9F.1a9=H(){if(9F.1tl==4&&9F.Yp==oT){G gL=9F.1a8;G O=1a K.s9(u4,gL);u4.2f=[];G 2f=gL.7U("2f")[0];if(!2f){I}G 1u=2f.1tk;if(!1u){I}3v(1u!=1c){if(1u.El==1){G s=1a 1Q();s.5g(1u,O);1Q.1a7(s);u4.2f.1f(s)}1u=1u.1tE}ia.tp(1t);if(ig){ig(u4)}}1k{if(ud&&ud.Fo){ud.Fo("7M 3v Ye ia Yh. "+9F.Yp+" "+9F.19X)}ia.tp(1x);if(tL){tL(u4)}}};9F.19Y=H(){if(ud&&ud.Fo){ud.Fo("7M 3v Ye ia Yh. "+9F.Yp+" "+9F.19X)}ia.tp(1x);if(tL){tL(u4)}};9F.lq("19W",NY);9F.19Z="3O";9F.YB()},1sA:H(){if(!F.2f){F.2f=[]}I F.2f}};J.2x(ia,"J.1e.ia")})(J.1e);(H(K){G 1E=J.3X.1E;G 2h=J.1B.2h;G oc=J.1e.oc;G 8n=J.1B.8n;G 9M=J.1e.9M;G 7G=J.1B.7G;G 5p=K.5p=H(1j){K.4n.9L=1t;1n.2T(5p,F,[1j]);F.3b=0;if(K.ao.FE===1x){F.iW("dM")}F.1P.qe=1t;F.fq="";F.4d=1c;F.9Z=J.1B.hW.1ak;F.er=1t;F.fJ=1t;F.el=1x;F.7j=1x;F.7k=1x;if(1j&&K.ao.FE===1x){F.2y=1j.n8;F.1N=1j.j4}F.7N(1j&&1j.cE?1j.cE:"x9");F.6W=1x;K.4n.9L=1x};5p.1s={1T:H(){K.4n.9L=1t;G 1K=1n.2o(5p,F,"1T",[]);1K.7N(F.2g.id);1K.tH(F.fq);1K.Md(F.6W);1K.wd(F.9Z);1K.7Q=F.7Q;1K.Mf(F.er);1K.Mx(F.fJ);1K.k8(F.g8);1K.rE(F.mc());1K.F4(F.1an());1K.F6(F.1am());1K.12E(F.1al());K.4n.9L=1x;I 1K},3q:H(){G 1q=1n.2o(5p,F,"3q",[]);if(F.g8){if(F.1j.AR){1q.AS=F.1j.AR(F.g8)}1k{1q.B2=F.g8}}1q.2g=F.2g.id;1q.fq=F.fq||"";1q.6W=F.6W;1q.9Z=F.9Z;1q.7Q=F.7Q;1q.er=F.er;1q.fJ=F.fJ;1q.jV=F.mc();1q.7j=F.7j;1q.7k=F.7k;1q.el=F.el;I 1q},3D:H(1q){1n.2o(5p,F,"3D",[1q]);F.7N(J.1e.1Q.2e(1q.2g)||"x9");if(1q.AS!=1F){F.k8(F.1j.fp[1q.AS])}if(1q.B2!=1F){F.k8(1q.B2)}F.tH(1q.fq);F.Md(1q.6W);F.wd(1q.9Z);if(1q.7Q){F.Ea(7G.1K(1q.7Q))}F.Mf(1q.er);F.Mx(1q.fJ);F.rE(1q.jV);if(1q.7j!=1F){F.F4(1q.7j)}if(1q.7k!=1F){F.F6(1q.7k)}if(1q.el!=1F){F.12E(1q.el)}},5g:H(1v,O){1n.2o(5p,F,"5g",[1v,O]);F.rE(O.4v("NW",1v));F.7N(O.wV("1Q",1v));if(F.2g==1c){F.7N("az")}F.er=O.4v("1a2",1v,F.er);G so=O.vo("1gk",1v);if(so){F.b7(so.dh);F.bq(so.4i)}1k{F.b7(O.3Q("tA",1v));F.bq(O.3Q("tv",1v))}F.9Z=O.3Q("hW",1v);F.k8(O.EI("hX",1v));F.fJ=O.4v("1a1",1v,F.fJ);G Qm=O.PX(1v,"AN");if(Qm){F.7Q=O.EB("AN",1v)}F.6W=O.4v("1a0",1v);F.7j=O.4v("1aj",1v,F.7j);F.7k=O.4v("1ai",1v,F.7k);F.el=O.4v("1ah",1v,F.el)},5u:H(1v,O){1n.2o(5p,F,"5u",[1v,O]);O.4o(F.mc(),"NW",1v);O.xf(F.qR(),"1Q",1v);O.4o(F.er,"1a2",1v);O.4r(F.ec(),"tA",1v);O.4r(F.ft(),"tv",1v);O.4r(F.9Z,"hW",1v);O.MS(F.Eg(),"hX",1v);O.4o(F.fJ,"1a1",1v);if(F.7Q){O.ER(F.7Q,"AN",1v)}O.4o(F.6W,"1a0",1v);O.4o(F.7j,"1aj",1v);O.4o(F.7k,"1ai",1v);O.4o(F.el,"1ah",1v)},Mf:H(N){if(F.er!=N){F.er=N;F.1S()}},1uE:H(){I F.er},Mx:H(N){if(F.fJ!=N){F.fJ=N;F.1S()}},1uy:H(){I F.fJ},MU:H(N){if(!N){F.4d=1c}1k{F.4d=1a J.1B.hX(F.1d);F.4d.4d=N;F.4d.zo=1t}F.1S()},MM:H(){if(!F.4d){I 1c}I F.4d.4d},wd:H(N){if(F.9Z!=N){F.9Z=N;if(F.4d){F.1S()}1k{F.6I()}}},At:H(){if(F.9Z===1F){I J.1B.hW.1ak}I F.9Z},Ea:H(N){if(F.7Q!==N){F.7Q=N;F.1S()}},WH:H(){I F.7Q},Md:H(N){if(F.6W!=N){F.6W=N;F.1S()}},1uL:H(){I F.6W},F4:H(N){if(F.7j!=N){F.7j=N;if(F.6k){F.6k.Gh(F.7j,F.7k)}F.1S()}},1an:H(){I F.7j},F6:H(N){if(F.7k!=N){F.7k=N;if(F.6k){F.6k.Gh(F.7j,F.7k)}F.1S()}},1am:H(){I F.7k},12E:H(N){if(F.el!=N){F.el=N;F.1S()}},1al:H(){I F.el},12x:H(1D){if(1D.T===0){I}F.1j=1D[0]},1ac:H(){I F.7i.1ab.ek},3S:H(1p){G 1d=F.8m();if(!1d.3S(1p)){I 1x}if(K.1M.ML(1p,F.9W())){I 1t}if(F.aO&&F.7F(1p)){I 1t}I 1x},uD:H(){F.6e.pG=F},kr:H(){G 2w=F.6e.2w=[];if(F.2g.tw()&&!K.1Q.dt){F.2g=K.1Q.2e(F.2g.id);if(F.6k){F.6k.7N(F.2g)}}G 1r=F.1d;if(!F.6W){G 1N=F.rd();G 1D={1N:1N,nT:9M.Bk};F.pC(2w,1D);if(1D.1N){1N=1D.1N}}if(!F.6k){F.6k=1a K.ea(F.2g);F.6k.Gh(F.7j,F.7k)}F.6k.uO(F.1d,F.3b);if(!F.6W){F.6k.b6=F.rd();F.6k.b5=F.hk();F.6k.j8=F.6k.b5;F.6k.3p=F.fi();F.6k.4V=F.iA();F.6k.9S=F.n7();2w.1f(F.6k)}G 4d=F.4d;if(4d&&4d.zo){if(F.6W){F.6k.uO(F.1d,F.3b)}4d.Cg=F.6k.9W();G B6=1r.1T();if(F.7Q){F.7Q.W4(B6)}4d.4G(B6,F.fJ?F.3b:0);4d.9Z=F.9Z;2w.1f(4d)}if(!F.6W){F.pC(2w,{nT:9M.Br})}F.1P.2m=F.hH();F.1P.2y=F.gu();F.1P.3E=F.qN();F.1P.3p=F.u8();F.1P.4G(1r,(F.er)?F.3b:0);2w.1f(F.1P);F.D6(2w);if(F.mq){F.mq(F)}},eW:H(2A){1n.2o(5p,F,"eW",[2A]);G 1G=2A.6b.1V(F);if(1G==1c){I}G i=2A.3f.1y;if(F.el&&i<8){G 1aa=F.7j;G 1ad=F.7k;G 9b=2A.9b();if(9b.x!=0){if((9b.x<0&&(i==1||i==2||i==5))||(9b.x>0&&(i==0||i==3||i==7))){F.7j=2A.12k.1l-1w.4L(9b.x)<0?!1G.7j:1G.7j}}if(9b.y!=0){if((9b.y<0&&(i==2||i==3||i==6))||(9b.y>0&&(i==0||i==1||i==4))){F.7k=2A.12k.1o-1w.4L(9b.y)<0?!1G.7k:1G.7k}}if(F.6k&&(F.7j!=1aa||F.7k!=1ad)){F.6k.Gh(F.7j,F.7k)}}},7N:H(N){if(5P N=="av"){N=K.1Q.2e(N)}if(F.2g!=N){F.2g=N;if(F.6k){F.6k.7N(F.2g)}F.1S()}},qR:H(){I F.2g},tH:H(N){if(F.fq!=N){F.fq=N;if(N){F.4d=1a J.1B.hX(F.1d);1n.7I(F.4d.4d,{uf:1n.4C(F,F.oW)});F.4d.4d.g7=N}F.6I()}},Ei:H(){I F.fq},k8:H(N){if(F.g8!=N){F.g8=N;if(N){F.4d=1a J.1B.hX(F.1d);1n.7I(F.4d.4d,{uf:1n.4C(F,F.oW)});G qY="4e:4d/1ag;QV,"+F.g8;F.4d.4d.g7=qY}F.6I()}},Eg:H(){I F.g8},oW:H(){F.4d.zo=1t;if(F.1j){F.1S()}},rE:H(N){if(F.1P.jV!=N){F.1P.jV=N;F.1S()}},mc:H(){I F.1P.jV},9W:H(){if(F.6e.pG){F.kr();F.6e.pG=1c}G zn=K.1M.1af();F.6k.9W().sH(zn);I zn.1ae()},cD:H(4g,4H){G 8l=4H.5I["4O:5p"];if(8l){if(4g.5j(8l)){I 8l}}I 1n.2o(5p,F,"cD",[4g,4H])},1fR:H(kj){if(F.1P==1F||F.1P==""){I 1x}if(kj==1F){kj=oc.12M}G mm=2h.4T(F.1j.3z);G rc=F.1d.1T();F.i6.W4(rc);G lZ=K.1M.1th(F.1j.3z);G zC=lZ;G 1P=F.1P.1P;G 2m=F.hH();G bX=F.mc();if(kj==oc.1br){G 1Y=F.1j.dG(1P,2m,rc,bX);rc.1o=1Y.1o;F.i6.C9(rc);F.4G(rc,1t)}1k{if(kj==oc.1bq){if(bX){rc.1l=5O.7T;G 1Y=F.1j.dG(1P,2m,rc,bX);rc.1l=1Y.1l}1k{G 132=rc.1T();132.1l=5O.7T;G zD=F.1j.dG(1P,2m,132,bX);G 1Y=F.1j.dG(1P,2m,rc,bX);G jR=8n.12O(1P,2m,F.1j.O,F.1j.3w);if(rc.1l<jR){G c=jR-rc.1l;rc.1l=jR}if(1Y.1o>rc.1o){3v(1Y.1o>rc.1o&&rc.1l<zD.1l){rc.1l+=lZ;1Y=F.1j.dG(1P,2m,rc,bX);if(rc.1l<jR){2i}}}1k{3v(1Y.1o<rc.1o){rc.1l-=lZ;1Y=F.1j.dG(1P,2m,rc,bX);if(rc.1l<jR){2i}}rc.1l+=lZ}}F.i6.C9(rc);F.4G(rc,1t)}1k{if(kj==oc.12M){G zI=rc.1l/rc.1o;G zH=rc.1o/rc.1l;if(zI<zH){zH=1/zI;zI=1}1k{zI=1/zH;zH=1}lZ=zI*lZ;zC=zH*zC;G cx=0;G cy=0;G b=F.1d.1T();G 1Y=F.1j.dG(1P,2m,rc,bX);G jR=bX?20*mm:8n.12O(1P,2m,F.1j.O,F.1j.3w);if(b.1l<jR){G c=jR-rc.1l;b.1l=jR;b.1o=rc.1o+c}if(1Y.1o<rc.1o){do{cx-=lZ;cy-=zC;rc=b.1T();rc=K.1M.7u(rc,cx,cy);1Y=F.1j.dG(1P,2m,rc,bX);if(rc.1l<jR){2i}}3v(1Y.1o<rc.1o);cx+=lZ;cy+=zC;rc=b.1T();rc=K.1M.7u(rc,cx,cy)}1k{G 1Y=F.1j.dG(1P,2m,rc,bX);3v(1Y.1o>rc.1o){cx+=lZ;cy+=zC;rc=F.1d.1T();rc=K.1M.7u(rc,cx,cy);G 1Y=F.1j.dG(1P,2m,rc,bX);if(rc.1l>mm*zy){2i}}}F.i6.C9(rc);F.4G(rc,1t)}}}F.1S();I 1t},lY:H(){G 1G=1n.2o(5p,F,"lY",[]);1G.7j=F.7j;1G.7k=F.7k;I 1G},tk:H(2A){G 1G=2A.6b.1V(F);if(1G!=1c){F.F4(1G.7j);F.F6(1G.7k)}1n.2o(5p,F,"tk",[2A])},dQ:H(){G 1G=1n.2o(5p,F,"dQ",[]);1G.2g=F.2g;1G.fq=F.fq;1G.6W=F.6W;1G.9Z=F.9Z;1G.7Q=F.7Q;1G.er=F.er;1G.fJ=F.fJ;1G.el=F.el;1G.7j=F.7j;1G.7k=F.7k;I 1G},ee:H(1G){1n.2o(5p,F,"ee",[1G]);F.7N(1G.2g);F.tH(1G.fq);F.Md(1G.6W);F.wd(1G.9Z);F.7Q=1G.7Q;F.Mf(1G.er);F.Mx(1G.fJ);F.el=1G.el;F.F4(1G.7j);F.F6(1G.7k)},aL:H(){if(!K.oa){K.oa=1a J.8Q(5p.1s,1c,F)}1k{K.oa.8M(F)}I K.oa}};5p.hG=H(1m){if(!K.oa){K.oa=1a J.8Q(5p.1s,1m)}1k{K.oa.8M(1c)}I K.oa};K.oa=1c;J.2x(5p,"J.1e.5p",K.3m)})(J.1e);(H(K){G 1Q=J.1e.1Q;G 9T=J.1B.9T;G 10Z=J.1B.10Z;G 1I=J.1B.1I;G 3U=J.1B.3U;G ea=K.ea=H(2g){F.2g=2g;F.7j=1x;F.7k=1x;F.5c=1c;F.b5="#7f";F.b6="#PY";F.j8="#7f";F.pO="6W";F.G9="#7f";F.G7="#7f";F.4V=1F;F.3p=0;F.rn="1tv";F.dU=6H.7H;F.11M=1a 1I(0,0,100,100);F.13d=1x;F.1uw=F.2g.1D.2b;F.12W()};ea.1s={12W:H(){if(F.2g.1D.2b){F.2z=F.MQ();F.11t=[]}if(F.2g.1D.4h){F.Qn=F.MQ();F.11H=[]}if(F.2g.1D.5l){F.Ge=[];F.Q7=[];1h(G i=0;i<F.2g.1D.5l.T;i++){F.Ge.1f(F.MQ());F.Q7.1f([])}}F.1bk()},1bj:H(){5M F.2z;5M F.11t;5M F.Qn;5M F.11H;5M F.Ge;5M F.Q7;F.12W()},lQ:H(O,o4){F.dU=6H.7H;if(F.2g.1D.2b){F.dU=6H.sQ;O.cM();F.sH(O);if(F.9S&&o4!=1x){F.9S.5j(O)}O.bE=F.12D(O);O.bB(F.2g.1D.5Y);O.cH();O.8f=F.12B(O);O.aQ=(F.3p?F.3p:1)/O.bn;J.1B.jD.5j(O,F.4V);O.rn=F.rn;O.3E()}if(F.2g.1D.4h){F.dU=6H.sO;O.cM();F.sH(O);O.bE=F.12c(O);O.bB(F.2g.1D.5Y);O.cH();O.8f=F.13g(O);O.aQ=F.3p/O.bn;J.1B.jD.5j(O,F.4V);O.rn=F.rn;O.3E()}if(F.2g.1D.5l){1h(G i=0;i<F.2g.1D.5l.T;i++){G g1=F.2g.1D.5l[i];F.1bp(g1,O,i)}}F.dU=6H.7H},1bp:H(g1,O,1y){F.dU=6H.sX+1y;O.cM();F.sH(O);O.bE=F.OZ(O,1y);O.bB(g1.5Y||"LW");O.cH();O.8f=F.P2(O,1y);O.aQ=F.3p/O.bn;J.1B.jD.5j(O,(g1.2y?g1.2y.6X:F.4V));O.rn=F.rn;O.3E();F.dU=6H.7H},o4:H(O){if(F.9S){O.cM();F.dU=6H.xX;F.sH(O);F.9S.5j(O);O.bE=F.9S.4N;O.bB(F.2g.1D.5Y);O.cH();F.dU=6H.7H}},Fj:H(O){F.9W().7A(F.b6);F.eO.9e(F.b5);F.eO.3p=F.3p;F.eO.lQ(O)},sH:H(O,11b){if(11b==1x){O.cM()}if(F.5c){O.5c.5j(O,F.5c.3g())}O.ed();G 6C=F.qr();if(6C){1h(G i=0;i<6C.T;i++){if(6C[i].9v=="Gq"){F.1bs(O,6C[i])}1k{O[6C[i].9v].5j(O,6C[i].1W)}}}if(11b==1x){O.cH()}},1bs:H(O,6C){O.cM();O.5c.5j(O,F.1bv.3g());G 1d=F.11M;G x=1d.x+1d.1l*6C.1W[0]/100;G y=1d.y+1d.1o*6C.1W[1]/100;G 1l=1d.1l*6C.1W[2]/100;G 1o=1d.1o*6C.1W[3]/100;G bf=6C.1W[4];O.6B(x,y+bf);O.4M(x,y+1o-bf);O.yj(x,y+1o,x+bf,y+1o);O.4M(x+1l-bf,y+1o);O.yj(x+1l,y+1o,x+1l,y+1o-bf);O.4M(x+1l,y+bf);O.yj(x+1l,y,x+1l-bf,y);O.4M(x+bf,y);O.yj(x,y,x,y+bf);O.cH()},116:H(1d,3I,jA){if(1d.1l===0||1d.1o===0){I}G 2z=F.2g.xp;G 10Y=K.1M.lO(3I,jA);G 4J=90+K.1M.1jO(1w.1l2(10Y.y,10Y.x));G 10W=1d.1l/100;G 3g=1a 9T();3g.a6(3I.x,3I.y);3g.3w(10W,10W);3g.kS(4J);3g.a6(-50,0);F.5c=3g.1T();F.9W().5c=3g.1T()},uO:H(1d,3b){if(1d.1l===0||1d.1o===0){I}G 2z=F.2g.xp;G x=1d.1l/2z.1l;G y=1d.1o/2z.1o;G 3g=1a 9T();3g.a6(1d.x-1d.1l/2,1d.y-1d.1o/2);3g.3w(x,y);3g.a6(1d.1l/x-2z.x-2z.1l/2,1d.1o/y-2z.y-2z.1o/2);if(F.2g.pR>0){3g.nP(F.2g.pR,2z.x+2z.1l/2,2z.y+2z.1o/2)}if(3b!==0){3g.nP(3b,2z.x+2z.1l/2,2z.y+2z.1o/2)}if(F.7j||F.7k){3g.a6(2z.x+2z.1l/2,2z.y+2z.1o/2);3g.3w(F.7j?-1:1,F.7k?-1:1);3g.a6(-(2z.x+2z.1l/2),-(2z.y+2z.1o/2))}F.5c=3g.1T();F.9W().5c=3g.1T();if(F.13d){G 3g=1a 9T();3g.3w(1/x,1/y);F.1bv=3g;F.11M=1a 1I(0,0,1d.1l,1d.1o)}F.9S=1c;F.b5=F.b5||F.2g.1D.b5||"#7f";F.b6=F.b6||F.2g.1D.b6||"#PY";F.j8=F.j8||F.2g.1D.j8||"#7f";F.pO=F.pO||F.2g.1D.pO||"6W";F.G9=F.2g.1D.G9||"#7f";F.G7=F.2g.1D.G7||"#7f"},Qe:H(8x){if(8x!=1c){G 11V=["M","L","B","Q","A","Z","C","E","R","U"];G i=0;3v(i<11V.T){G 11o=11V[i];8x=8x.1l5(1a 1l3(11o,"g"),":"+11o);i++}G 1bu=8x.cF(":");I 1bu.1bt(1kV)}I[]},9W:H(){if(!F.eO){F.11X()}I F.eO},11X:H(){F.eO=1a 3U(F.2g.1D.2b||"")},3a:H(11v){G 1d;6m(11v){2k 6H.7H:I 1c;2k 6H.xX:2k 6H.sQ:1d=F.2z;2i;2k 6H.sO:1d=F.Qn;2i;fI:1d=F.Ge[11v-6H.sX];2i}I 1a 1I(1d.cJ,1d.8Z,1d.eA-1d.cJ,1d.am-1d.8Z)},MQ:H(){I{cJ:5O.7T,8Z:5O.7T,eA:0,am:0}},iV:H(x,y){G 1d=1c;6m(F.dU){2k 6H.7H:I;2k 6H.xX:2k 6H.sQ:1d=F.2z;2i;2k 6H.sO:1d=F.Qn;2i;fI:G 1y=F.dU-6H.sX;1d=F.Ge[1y];2i}if(!1d){I}1d.cJ=1w.2H(1d.cJ,x);1d.8Z=1w.2H(1d.8Z,y);1d.eA=1w.2n(1d.eA,x);1d.am=1w.2n(1d.am,y)},qr:H(){6m(F.dU){2k 6H.7H:I 1c;2k 6H.xX:2k 6H.sQ:I F.11t;2k 6H.sO:I F.11H;fI:I F.Q7[F.dU-6H.sX]}},12D:H(O){I J.1e.1M.bs(O,F.b6||"#PY",F.3a(6H.sQ))},12B:H(O){I J.1e.1M.bs(O,F.b5||"#7f",F.3a(6H.sQ),1t)},12c:H(O){I J.1e.1M.bs(O,F.pO||"6W",F.3a(6H.sO))},13g:H(O){I J.1e.1M.bs(O,F.j8||"#7f",F.3a(6H.sO),1t)},OZ:H(O,1y){I J.1e.1M.bs(O,F.2g.1D.5l[1y].1N||F.G7||"#7f",F.3a(6H.sX+1y))},P2:H(O,1y){I J.1e.1M.bs(O,(F.2g.1D.5l[1y].2y?F.2g.1D.5l[1y].2y.1N:(F.G9||"#7f")),F.3a(6H.sX+1y),1t)},1bk:H(){F.dU=6H.7H;if(F.2g.1D.2b){F.dU=6H.sQ;F.AK(F.Qe(F.2g.1D.2b))}if(F.2g.1D.4h){F.dU=6H.sO;F.AK(F.Qe(F.2g.1D.4h))}if(F.2g.1D.5l){1h(G i=0;i<F.2g.1D.5l.T;i++){F.dU=6H.sX+i;F.AK(F.Qe(F.2g.1D.5l[i].2B))}}},7N:H(2g){F.2g=2g;F.1bj();F.11X()},Gh:H(7j,7k){F.7j=7j;F.7k=7k},AK:H(pj){10Z.AK(pj,F)},6B:H(x,y){G 6C=F.qr();if(!6C){I}6C.1f({9v:"6B",1W:[x,y]});F.iV(x,y)},4M:H(x,y){G 6C=F.qr();if(!6C){I}6C.1f({9v:"4M",1W:[x,y]});F.iV(x,y)},Wx:H(x1,y1,x2,y2,x3,y3){G 6C=F.qr();if(!6C){I}6C.1f({9v:"1le",1W:[x1,y1,x2,y2,x3,y3]});F.iV(x1,y1);F.iV(x2,y2);F.iV(x3,y3)},Xl:H(x,y,5h,1bi,1bl,1bo){G 6C=F.qr();if(!6C){I}6C.1f({9v:"k3",1W:[x,y,5h,1bi,1bl,1bo]});G r=+5h;F.iV(+x-r,+y-r);F.iV(+x+r,+y+r)},yj:H(x1,y1,x,y){G 6C=F.qr();if(!6C){I}6C.1f({9v:"yj",1W:[x1,y1,x,y]});F.iV(x1,y1);F.iV(x,y)},Gq:H(x1,y1,x2,y2,bf){G 6C=F.qr();if(!6C){I}6C.1f({9v:"Gq",1W:[x1,y1,x2,y2,bf]});F.13d=1t;F.iV(x1,y1);F.iV(x2,y2)},vh:H(){G 6C=F.qr();if(!6C){I}6C.1f({9v:"1bn",1W:1c})},Ok:H(fg){G 2b=F.2g.1D.2b;G 4h=F.2g.1D.4h;G 5l=F.2g.1D.5l;G 5Y=F.2g.1D.5Y;G 1y=2b.1kB("U[0-9]");if(1y!=-1){G 6i=2b.c8(1);G x1=+6i.cF(",")[0];G y1=+6i.cF(",")[1];G x2=+6i.cF(",")[2];G y2=+6i.cF(",")[3];G 5h=+6i.cF(",")[4];G 1l=x2-x1;G 1o=y2-y1;G 1u=fg.li("ls://ln.w3.gc/js/bx","1r");1u.2Q("x",x1);1u.2Q("y",y1);1u.2Q("1l",1l);1u.2Q("1o",1o);1u.2Q("rx",5h);1u.2Q("ry",5h);if(F.5c){1u.2Q("5c",F.5c.1bm())}if(5Y){1u.2Q("bB-f6",5Y)}1u.2Q("3E-1l",F.3p?F.3p:1);I 1u}G 4P=fg.li("ls://ln.w3.gc/js/bx","g");if(F.5c){4P.2Q("5c",F.5c.1bm())}if(2b){G t9=fg.li("ls://ln.w3.gc/js/bx","2B");t9.2Q("d",2b);G b6=F.12D(1c);if(b6){t9.2Q("bB",b6)}G b5=F.12B(1c);if(b5){t9.2Q("3E",b5)}4P.ae(t9)}if(4h){G ub=fg.li("ls://ln.w3.gc/js/bx","2B");ub.2Q("d",4h);G pO=F.12c(1c);if(pO){ub.2Q("bB",pO)}G j8=F.13g(1c);if(j8){ub.2Q("3E",j8)}4P.ae(ub)}if(5l){if(5l.T==1){G dR=fg.li("ls://ln.w3.gc/js/bx","2B");dR.2Q("d",5l[0].2B);if(5l[0].5Y){dR.2Q("bB-f6",5l[0].5Y)}G yg=F.OZ(1c,0);if(yg){dR.2Q("bB",yg)}G yc=F.P2(1c,0);if(yc){dR.2Q("3E",yc)}4P.ae(dR)}1k{G 10R=fg.li("ls://ln.w3.gc/js/bx","g");1h(G i=0;i<5l.T;i++){G dR=fg.li("ls://ln.w3.gc/js/bx","2B");dR.2Q("d",5l[i].2B);if(5l[i].5Y){dR.2Q("bB-f6",5l[i].5Y)}G yg=F.OZ(1c,i);G yc=F.P2(1c,i);if(yg){dR.2Q("bB",yg)}if(yc){dR.2Q("3E",yc)}10R.ae(dR)}4P.ae(10R)}}if(5Y){4P.2Q("bB-f6",5Y)}G FV=1;if(F.5c){G m=F.5c.3g();FV=1w.i7(m[0]*m[0]+m[2]*m[2])}FV*=4;4P.2Q("id",F.2g.1D.id);4P.2Q("3E-1l",F.3p?F.3p/FV:1/FV);I 4P}};J.2x(ea,"J.1e.ea");G 6H={7H:-1,xX:0,sQ:1,sO:2,sX:3}})(J.1e);J.1e.2j=H(){};J.1e.2j.11F=H(){I J.1e.1Q.2e("11F")};J.1e.2j.11D=H(){I J.1e.1Q.2e("11D")};J.1e.2j.DY=H(){I J.1e.1Q.2e("DY")};J.1e.2j.11E=H(){I J.1e.1Q.2e("11E")};J.1e.2j.11w=H(){I J.1e.1Q.2e("11w")};J.1e.2j.11T=H(){I J.1e.1Q.2e("11T")};J.1e.2j.11Z=H(){I J.1e.1Q.2e("11Z")};J.1e.2j.11Y=H(){I J.1e.1Q.2e("11Y")};J.1e.2j.11L=H(){I J.1e.1Q.2e("11L")};J.1e.2j.11I=H(){I J.1e.1Q.2e("11I")};J.1e.2j.11N=H(){I J.1e.1Q.2e("11N")};J.1e.2j.11O=H(){I J.1e.1Q.2e("11O")};J.1e.2j.Qr=H(){I J.1e.1Q.2e("Qr")};J.1e.2j.10X=H(){I J.1e.1Q.2e("10X")};J.1e.2j.OV=H(){I J.1e.1Q.2e("OV")};J.1e.2j.10M=H(){I J.1e.1Q.2e("10M")};J.1e.2j.10K=H(){I J.1e.1Q.2e("10K")};J.1e.2j.11i=H(){I J.1e.1Q.2e("11i")};J.1e.2j.11l=H(){I J.1e.1Q.2e("11l")};J.1e.2j.12T=H(){I J.1e.1Q.2e("12T")};J.1e.2j.12X=H(){I J.1e.1Q.2e("12X")};J.1e.2j.12K=H(){I J.1e.1Q.2e("12K")};J.1e.2j.12L=H(){I J.1e.1Q.2e("12L")};J.1e.2j.12Y=H(){I J.1e.1Q.2e("12Y")};J.1e.2j.139=H(){I J.1e.1Q.2e("139")};J.1e.2j.13a=H(){I J.1e.1Q.2e("13a")};J.1e.2j.13e=H(){I J.1e.1Q.2e("13e")};J.1e.2j.13b=H(){I J.1e.1Q.2e("13b")};J.1e.2j.12i=H(){I J.1e.1Q.2e("12i")};J.1e.2j.123=H(){I J.1e.1Q.2e("123")};J.1e.2j.124=H(){I J.1e.1Q.2e("124")};J.1e.2j.122=H(){I J.1e.1Q.2e("122")};J.1e.2j.12y=H(){I J.1e.1Q.2e("12y")};J.1e.2j.12F=H(){I J.1e.1Q.2e("12F")};J.1e.2j.12w=H(){I J.1e.1Q.2e("12w")};J.1e.2j.12q=H(){I J.1e.1Q.2e("12q")};J.1e.2j.12u=H(){I J.1e.1Q.2e("12u")};J.1e.2j.12v=H(){I J.1e.1Q.2e("12v")};J.1e.2j.12t=H(){I J.1e.1Q.2e("12t")};J.1e.2j.Xn=H(){I J.1e.1Q.2e("Xn")};J.1e.2j.hx=H(){I J.1e.1Q.2e("hx")};J.1e.2j.QG=H(){I J.1e.1Q.2e("QG")};J.1e.2j.QU=H(){I J.1e.1Q.2e("QU")};J.1e.2j.QT=H(){I J.1e.1Q.2e("QT")};J.1e.2j.QP=H(){I J.1e.1Q.2e("QP")};J.1e.2j.QY=H(){I J.1e.1Q.2e("QY")};J.1e.2j.R4=H(){I J.1e.1Q.2e("R4")};J.1e.2j.Bw=H(){I J.1e.1Q.2e("Bw")};J.1e.2j.R8=H(){I J.1e.1Q.2e("R8")};J.1e.2j.Rd=H(){I J.1e.1Q.2e("Rd")};J.1e.2j.Re=H(){I J.1e.1Q.2e("Re")};J.1e.2j.R7=H(){I J.1e.1Q.2e("R7")};J.1e.2j.Rv=H(){I J.1e.1Q.2e("Rv")};J.1e.2j.PL=H(){I J.1e.1Q.2e("PL")};J.1e.2j.Ry=H(){I J.1e.1Q.2e("Ry")};J.1e.2j.Q1=H(){I J.1e.1Q.2e("Q1")};J.1e.2j.Rp=H(){I J.1e.1Q.2e("Rp")};J.1e.2j.Qy=H(){I J.1e.1Q.2e("Qy")};J.1e.2j.QC=H(){I J.1e.1Q.2e("QC")};J.1e.2j.QQ=H(){I J.1e.1Q.2e("QQ")};J.1e.2j.Qz=H(){I J.1e.1Q.2e("Qz")};J.1e.2j.SI=H(){I J.1e.1Q.2e("SI")};J.1e.2j.SN=H(){I J.1e.1Q.2e("SN")};J.1e.2j.Sz=H(){I J.1e.1Q.2e("Sz")};J.1e.2j.Pl=H(){I J.1e.1Q.2e("Pl")};J.1e.2j.Sv=H(){I J.1e.1Q.2e("Sv")};J.1e.2j.uo=H(){I J.1e.1Q.2e("uo")};J.1e.2j.Sw=H(){I J.1e.1Q.2e("Sw")};J.1e.2j.SA=H(){I J.1e.1Q.2e("SA")};J.1e.2j.SE=H(){I J.1e.1Q.2e("SE")};J.1e.2j.SB=H(){I J.1e.1Q.2e("SB")};J.1e.2j.SC=H(){I J.1e.1Q.2e("SC")};J.1e.2j.SU=H(){I J.1e.1Q.2e("SU")};J.1e.2j.Tc=H(){I J.1e.1Q.2e("Tc")};J.1e.2j.T9=H(){I J.1e.1Q.2e("T9")};J.1e.2j.Te=H(){I J.1e.1Q.2e("Te")};J.1e.2j.Tj=H(){I J.1e.1Q.2e("Tj")};J.1e.2j.Tf=H(){I J.1e.1Q.2e("Tf")};J.1e.2j.SZ=H(){I J.1e.1Q.2e("SZ")};J.1e.2j.SW=H(){I J.1e.1Q.2e("SW")};J.1e.2j.T1=H(){I J.1e.1Q.2e("T1")};J.1e.2j.T6=H(){I J.1e.1Q.2e("T6")};J.1e.2j.T7=H(){I J.1e.1Q.2e("T7")};J.1e.2j.T3=H(){I J.1e.1Q.2e("T3")};J.1e.2j.St=H(){I J.1e.1Q.2e("St")};J.1e.2j.RS=H(){I J.1e.1Q.2e("RS")};J.1e.2j.RT=H(){I J.1e.1Q.2e("RT")};J.1e.2j.RQ=H(){I J.1e.1Q.2e("RQ")};J.1e.2j.RR=H(){I J.1e.1Q.2e("RR")};J.1e.2j.RZ=H(){I J.1e.1Q.2e("RZ")};J.1e.2j.S0=H(){I J.1e.1Q.2e("S0")};J.1e.2j.RX=H(){I J.1e.1Q.2e("RX")};J.1e.2j.RY=H(){I J.1e.1Q.2e("RY")};J.1e.2j.RD=H(){I J.1e.1Q.2e("RD")};J.1e.2j.RE=H(){I J.1e.1Q.2e("RE")};J.1e.2j.RI=H(){I J.1e.1Q.2e("RI")};J.1e.2j.RN=H(){I J.1e.1Q.2e("RN")};J.1e.2j.Or=H(){I J.1e.1Q.2e("Or")};J.1e.2j.Sj=H(){I J.1e.1Q.2e("Sj")};J.1e.2j.Ph=H(){I J.1e.1Q.2e("Ph")};J.1e.2j.OW=H(){I J.1e.1Q.2e("OW")};J.1e.2j.Sn=H(){I J.1e.1Q.2e("Sn")};J.1e.2j.So=H(){I J.1e.1Q.2e("So")};J.1e.2j.S4=H(){I J.1e.1Q.2e("S4")};J.1e.2j.Sc=H(){I J.1e.1Q.2e("Sc")};J.1e.2j.Sb=H(){I J.1e.1Q.2e("Sb")};J.1e.2j.Sa=H(){I J.1e.1Q.2e("Sa")};J.1e.2j.Sf=H(){I J.1e.1Q.2e("Sf")};J.1e.2j.Se=H(){I J.1e.1Q.2e("Se")};J.1e.2j.P8=H(){I J.1e.1Q.2e("P8")};J.1e.2j.az=H(){I J.1e.1Q.2e("az")};J.1e.2j.Pa=H(){I J.1e.1Q.2e("Pa")};J.1e.2j.P7=H(){I J.1e.1Q.2e("P7")};J.1e.2j.Qq=H(){I J.1e.1Q.2e("Qq")};J.1e.2j.Qk=H(){I J.1e.1Q.2e("Qk")};J.1e.2j.OY=H(){I J.1e.1Q.2e("OY")};J.1e.2j.x9=H(){I J.1e.1Q.2e("x9")};J.1e.2j.Sd=H(){I J.1e.1Q.2e("Sd")};J.1e.2j.S9=H(){I J.1e.1Q.2e("S9")};J.1e.2j.Qf=H(){I J.1e.1Q.2e("Qf")};J.1e.2j.S5=H(){I J.1e.1Q.2e("S5")};J.1e.2j.S3=H(){I J.1e.1Q.2e("S3")};J.1e.2j.S8=H(){I J.1e.1Q.2e("S8")};J.1e.2j.S6=H(){I J.1e.1Q.2e("S6")};J.1e.2j.Sp=H(){I J.1e.1Q.2e("Sp")};J.1e.2j.Sr=H(){I J.1e.1Q.2e("Sr")};J.1e.2j.OR=H(){I J.1e.1Q.2e("OR")};J.1e.2j.Sq=H(){I J.1e.1Q.2e("Sq")};J.1e.2j.DZ=H(){I J.1e.1Q.2e("DZ")};J.1e.2j.Si=H(){I J.1e.1Q.2e("Si")};J.1e.2j.Sh=H(){I J.1e.1Q.2e("Sh")};J.1e.2j.Sk=H(){I J.1e.1Q.2e("Sk")};J.1e.2j.RL=H(){I J.1e.1Q.2e("RL")};J.1e.2j.RK=H(){I J.1e.1Q.2e("RK")};J.1e.2j.RO=H(){I J.1e.1Q.2e("RO")};J.1e.2j.RM=H(){I J.1e.1Q.2e("RM")};J.1e.2j.RC=H(){I J.1e.1Q.2e("RC")};J.1e.2j.RH=H(){I J.1e.1Q.2e("RH")};J.1e.2j.RG=H(){I J.1e.1Q.2e("RG")};J.1e.2j.RF=H(){I J.1e.1Q.2e("RF")};J.1e.2j.RW=H(){I J.1e.1Q.2e("RW")};J.1e.2j.1s={};J.2x(J.1e.2j,"J.1e.2j");(H(K){G 2E=K.2E=H(1s){1n.2T(2E,F);if(1s){F.1N=1s.1N;F.9X=1s.9X;F.3E=1s.3E;F.3p=1s.3p;F.4V=1s.4V;F.3e=1s.3e;F.5x=1s.5x;F.4U=1s.4U;F.cu=1s.cu;F.6L=1s.6L;F.3M=[];if(1s.3M){F.3M=1s.3M.9D(0)}if(1s.5q){1h(G i=0,l=1s.5q.T;i<l;i++){if(1s.5q[i]==1c){F.3M.1f(1c);2V}G 2R=1n.mY(1s.5q[i].Bb);if(2R){G 7E=1a 2R(F);7E.3D(1s.5q[i]);F.3M.1f(7E)}}}}};2E.1s={gY:H(){I F.7i.ek},3D:H(1q){F.1N=1q.1N;F.9X=1q.9X;F.3E=1q.3E;F.3p=1q.3p;F.4V=1q.4V;F.3e=1q.3e;F.5x=1q.5x;F.4U=1q.4U;F.cu=1q.cu;F.6L=1q.6L;F.3M=[];if(1q.5q){1h(G i=0,l=1q.5q.T;i<l;i++){if(1q.5q[i]==1c){F.3M.1f(1c);2V}G 2R=1n.mY(1q.5q[i].Bb);if(2R){G 7E=1a 2R(F);7E.3D(1q.5q[i]);F.3M.1f(7E)}}}},3q:H(){G 1q={1N:F.1N,9X:F.9X,3E:F.3E,3p:F.3p,4V:F.4V,3e:F.3e,5x:F.5x,4U:F.4U,cu:F.cu,6L:F.6L};G 5q=[];if(F.3M){1h(G i=0,l=F.3M.T;i<l;i++){if(F.3M[i]==1c){5q.1f(1c)}1k{5q.1f(F.3M[i].3q())}}}1q.5q=5q;I 1q},5u:H(1v,O){if(F.Tg()){G 5z=O.3i("lc",1v);5z.2Q("ho","Ni");O.c9(F.5x,"eg",5z).2Q("aK","1")}if(F.Tk()){G 5z=O.3i("lc",1v);5z.2Q("ho","N1");O.5w(F.4U,"eg",5z).2Q("aK","6")}if(F.Ti()){G 5z=O.3i("lc",1v);5z.2Q("ho","sE");O.4r(F.cu,"eg",5z).2Q("aK","8")}if(F.N8()){G 5z=O.3i("lc",1v);5z.2Q("ho","ga");F.9k(F.1N,5z,O).2Q("aK","100")}if(F.T2()){G 5z=O.3i("lc",1v);5z.2Q("ho","MY");F.9k(F.3E,5z,O).2Q("aK","100")}if(F.T5()){G 5z=O.3i("lc",1v);5z.2Q("ho","N3");O.5w(F.3p,"eg",5z).2Q("aK","6")}if(F.SY()){G 5z=O.3i("lc",1v);5z.2Q("ho","Fi");O.4r(F.4V,"eg",5z).2Q("aK","8")}if(F.Td()){G 5z=O.3i("lc",1v);5z.2Q("ho","N7");F.9k(F.6L,5z,O).2Q("aK","100")}if(F.Th()){G 5z=O.3i("lc",1v);5z.2Q("ho","tR");F.9k(F.3e,5z,O).2Q("aK","100")}if(F.Mz()){G 5z=O.3i("lc",1v);5z.2Q("ho","o9");F.Pb(5z,O)}},5g:H(1v,O){G S1=1v.7U("lc");1h(G i=0;i<S1.T;i++){G 5z=S1[i];G 5n=5z.4y("ho");6m(5n){2k"Ni":F.5x=O.a7("eg",5z);2i;2k"N1":F.4U=O.5k("eg",5z);2i;2k"sE":F.cu=O.3Q("eg",5z);2i;2k"ga":F.1N=F.9r(5z,O);2i;2k"MY":F.3E=F.9r(5z,O);2i;2k"N3":F.3p=O.5k("eg",5z);2i;2k"Fi":F.4V=O.3Q("eg",5z);2i;2k"N7":F.6L=F.9r(5z,O);2i;2k"tR":F.3e=F.9r(5z,O);2i;2k"o9":F.Pj(5z,O);2i}}},9k:H(1N,1v,O){G sB=O.3i("eg",1v);O.9k(1N,"ga",sB);I sB},9r:H(1v,O){G sB=O.4k("eg",1v);I O.9r("ga",sB)},Pb:H(1v,O){G 1u=O.3i("eg",1v);1u.2Q("aK","105");G 1bF=O.3i("1kI",1u);1h(G i=0;i<F.3M.T;i++){G fv=O.3i("vm",1bF);G sB=O.3i("eg",fv);sB.2Q("aK","103");G 1bE=F.3M[i];O.Pg(1bE,"ou",sB)}},Pj:H(1v,O){F.3M=[];G 1u=O.4k("eg",1v);G iz=1u.7U("ou");1h(G i=0;i<iz.T;i++){G bk=iz[i];F.3M.1f(O.Pf(bk))}},1T:H(){G 1K=1a F.7i();1K.1N=F.1N;1K.9X=F.9X;1K.3E=F.3E;1K.3p=F.3p;1K.4V=F.4V;1K.3e=F.3e;1K.5x=F.5x;1K.4U=F.4U;1K.cu=F.cu;1K.6L=F.6L;if(F.3M){1K.3M=F.3M.9D(0)}I 1K},bs:H(){I F.1N},7A:H(N){F.1N=N},N8:H(){I F.1N?1t:1x},Ol:H(){I F.9X},Eb:H(N){F.9X=N},1lX:H(){I F.9X?1t:1x},uE:H(){I F.3E},WE:H(N){F.3E=N},T2:H(){I F.3E?1t:1x},uM:H(){I F.3p},WD:H(N){F.3p=N},T5:H(){I F.3p?1t:1x},T0:H(){I F.4V},1bD:H(N){F.4V=N},SY:H(){I F.4V!==1F&&F.4V!==1c},lo:H(){I F.3e},iW:H(N){F.3e=N},Th:H(){I F.3e?1t:1x},wK:H(){I F.5x},DI:H(N){F.5x=N},Tg:H(){I F.5x?1t:1x},wM:H(){I F.4U},DJ:H(N){F.4U=N},Tk:H(){I F.4U?1t:1x},1bG:H(){I F.cu},1lV:H(N){F.cu=N},Ti:H(){I F.cu!==1F&&F.cu!==1c},T8:H(){I F.6L},WI:H(N){F.6L=N},Td:H(){I F.6L!==1F?1t:1x},Mq:H(){I F.3M},1lR:H(N){F.3M=N},Mz:H(){I F.3M?1t:1x},aL:H(){if(!K.pq){K.pq=1a J.8Q(2E.1s,1c,F)}1k{K.pq.8M(F)}I K.pq}};2E.hG=H(1m){if(!K.pq){K.pq=1a J.8Q(2E.1s)}1k{K.pq.8M(1c)}I K.pq};K.pq=1c;J.2x(2E,"J.1e.2E")})(J.1e);(H(K){G Fs=K.Fs=H(){};Fs.1s={1bw:H(1m,hb){if(!hb){hb=3O}hb.1bJ=1m.O;G by=hb.li("ls://ln.w3.gc/js/bx","bx");by.2Q("AL","1.1");G db=1m.3a();by.2Q("1l",7e(db.1l*1m.3w));by.2Q("1o",7e(db.1o*1m.3w));G Be="";Be+=db.x+" ";Be+=db.y+" ";Be+=db.1l+" ";Be+=db.1o;by.2Q("1lN",Be);G Su=hb.li("ls://ln.w3.gc/js/bx","1lQ");by.ae(Su);hb.1bI=Su;hb.1bH=0;G qf=1m.3a().1T();qf.1N=1m.Ol();qf.2y=1c;SQ=qf.Ok(hb);if(SQ){by.ae(SQ)}1h(G i=0;i<1m.1R.T;i++){G 1g=1m.1R[i];G 1u=1g.6e.Ok(hb);if(1u!=1c){G 6k=1g.6k;if(6k){1u.2Q("bB",6k.b6);1u.2Q("3E",6k.b5)}by.ae(1u)}}5M hb.1bJ;5M hb.1bI;5M hb.1bH;I by},1m7:H(1m){G fg=3O.1by.1bx("","",1c);G by=F.1bw(1m,fg);fg.ae(by);G 1bB=(1a 1bz()).1bC(fg);I 1bB}};J.2x(Fs,"J.1e.Fs")})(J.1e);(H(K){G 1E=J.3X.1E;G 8C=J.1B.8C;G 1L=J.1B.1L;G 1I=J.1B.1I;G 5T=J.1B.5T;G 9M=J.1e.9M;G 1M=J.1e.1M;G bL=K.bL=H(1j){K.4n.9L=1t;1n.2T(bL,F,[1j]);K.4n.9L=1x};bL.1s={1T:H(){K.4n.9L=1t;G 1K=1n.2o(bL,F,"1T",[]);1K.OJ(F.QA());K.4n.9L=1x;I 1K},3q:H(){G 1q=1n.2o(bL,F,"3q",[]);G 2w=F.QA();if(2w){if(2w.e5){if(F.1j.SH){1q.SM=F.1j.SH(2w.e5)}1k{1q.BU=2w.e5}}1k{1q.SL=2w.oN}}I 1q},3D:H(1q){1n.2o(bL,F,"3D",[1q]);G 2w=1a J.1e.v3();if(1q.SM!=1F){2w.e5=F.1j.hs[1q.SM]}1k{if(1q.SL){2w.oN=1q.SL}1k{if(1q.BU){2w.e5=1q.BU}}}F.OJ(2w)},5g:H(1v,O){1n.2o(bL,F,"5g",[1v,O]);G 2w=1a J.1e.v3();G BU=O.1gu("RB",1v);if(BU){2w.e5=1M.1bA.1ma(BU)}G SK=O.a7("1aZ",1v);if(SK){2w.oN=SK}F.OJ(2w)},5u:H(1v,O){1n.2o(bL,F,"5u",[1v,O]);if(F.2w.e5){O.1m9(1M.1bA.1m4(F.2w.e5),"RB",1v)}if(F.2w.oN){O.c9(F.2w.oN,"1aZ",1v)}},OJ:H(N){if(F.2w!=N){F.2w=N;if(N){F.4d=1a J.1B.hX(F.1d);F.4d.bx=1t;F.4d.4d.1l=100;F.4d.4d.1o=100;1n.7I(F.4d.4d,{uf:1n.4C(F,F.oW)});if(F.2w.e5){G qY="4e:4d/bx+QJ;QV,"+F.2w.e5;F.4d.4d.g7=qY}1k{if(F.2w.oN){F.4d.4d.g7=F.2w.oN}}}F.6I()}},QA:H(){I F.2w},tH:H(N){},Ei:H(){I 1c},aL:H(){if(!K.oC){K.oC=1a J.8Q(bL.1s,1c,F)}1k{K.oC.8M(F)}I K.oC}};bL.hG=H(1m){if(!K.oC){K.oC=1a J.8Q(bL.1s,1m)}1k{K.oC.8M(1c)}I K.oC};K.oC=1c;J.2x(bL,"J.1e.bL",K.5p);G v3=K.v3=H(){};v3.1s={AK:H(N){F.oN=N},1lZ:H(N){F.e5=N},oN:1c,e5:1c};J.2x(v3,"J.1e.v3")})(J.1e);(H(K){G 1L=J.1B.1L;G lE=K.lE=H(S,1i,4X,1J){1n.2T(lE,F,[S,1i,4X]);F.2R=F.7i.ek;F.S=S;F.1i=1i;F.4X=4X;F.4Z={1y:-1,1p:1a J.1B.1L(0,0)};if(1J===1F){1J=-1}F.1J=1J;if(1J>-1){F.4Z.1J=S.8i(1J)}};lE.1s={kR:H(){if(!F.4Z.1J){if(F.4X){F.S.QB(F.1i)}1k{F.S.Rq(F.1i)}}1k{if(F.4X){F.S.1bf(F.1J,F.1i)}1k{F.S.1b6(F.1J,F.1i)}}},kW:H(){if(!F.4Z.1J){if(F.4X){F.S.Rm(F.1i)}1k{F.S.Rk(F.1i)}I}if(F.4X){F.S.1b5(F.1J,F.1i)}1k{F.S.1b4(F.1J,F.1i)}},fO:H(){G 1p=F.4X?F.1i.fB():F.1i.jt();G 4J=F.S.3b;if(4J!==0){G 7p=K.1M.9J(F.S.1d);1p=K.1M.bO(1p,7p,-4J)}G rc=F.4Z.1J?F.S.p5(F.1J):F.S.1d;F.gm=K.1M.AI(1p,rc)},m5:H(1p){G 1J=F.S.da!=K.GJ.Rr?F.S.OO(1p):-1;if(1J==-1){I 1n.2o(lE,F,"m5",[1p])}F.1J=1J;G 1r=F.S.p5(1J);G cx=1r.x+1r.1l/2;G cy=1r.y+1r.1o/2;G s0={1J:F.S.8i(1J),1p:1p.x>cx?1a 1L(1r.2Z(),cy):1a 1L(1r.3R(),cy),8u:1p.x>cx?1a 1L(100,50):1a 1L(0,50),1y:-1};I s0},Ft:H(1p){if(F.4Z&&F.4Z.1J){G 1d=F.S.3a();G NB=F.S.p5(F.1J).2N();if(1p.x<NB.x){F.4Z.1p=1a 1L(1d.x,NB.y)}1k{F.4Z.1p=1a 1L(1d.2Z(),NB.y)}}1k{1n.2o(lE,F,"Ft",[1p])}},Nx:H(1g,1p){if(1g==F.S){I F.S.OO(1p)!=F.1J}I 1n.2o(lE,F,"Nx",[1g,1p])},1lY:H(){if(F.4Z&&F.4Z.1J){I F.4Z.1J}I 1c},mf:H(){I F.4Z.1J?F.S.p5(F.1J).2N():1n.2o(lE,F,"mf",[])},ez:H(6Q,7Y){G t=F.S;if(F.1J!=-1){I t.1b7(F.1J,6Q,7Y)}I t.ez(6Q,7Y)},fB:H(){G 1aY=F.gm;G rc=F.4Z.1J?F.S.p5(F.1J):F.S.1d;G 1p=K.1M.uK(1aY,rc);1p.x=1w.2H(1p.x,F.S.1d.2Z());1p.y=1w.2H(1p.y,F.S.1d.3F());G 4J=F.S.3b;if(4J!==0){G 7p=K.1M.9J(F.S.1d);1p=K.1M.bO(1p,7p,4J)}I 1p},kX:H(N,Rg){if(F.1J!=N){if(Rg){F.kW()}F.1J=N;F.4Z.1J=F.S.8i(N);if(Rg){F.kR();if(F.4X){F.1i.Ra()}1k{F.1i.R9()}}}}};J.2x(lE,"J.1e.lE",K.rz)})(J.1e);(H(K){G 1E=J.3X.1E;G 8C=J.1B.8C;G Wj=J.1B.Wj;G 1L=J.1B.1L;G 1I=J.1B.1I;G 5T=J.1B.5T;G 2h=J.1B.2h;G 3U=J.1B.3U;G 9M=J.1e.9M;G 6F=J.1B.6F;G oc=J.1e.oc;G 7B=K.7B=H(1j){K.4n.9L=1t;1n.2T(7B,F,[1j]);F.4t=6;F.1P.qe=1t;F.1P.4i=K.4w.7z;F.3s=1a J.3X.gl(1,1);F.2P=[F.Nz()];F.3W=[F.NG()];F.8g=0;F.da=K.GJ.Ef;K.4n.9L=1x;F.dw=K.vK.VZ;F.hO=1x;F.hN=1x};7B.1s={1T:H(){K.4n.9L=1t;G 1K=1n.2o(7B,F,"1T",[]);1K.4t=F.4t;1K.8g=F.8g;1K.da=F.da;1K.6N=F.6N;1K.ch=F.ch;1K.C7(F.Bz());1K.2g=F.2g;1K.dw=F.dw;1K.rE(F.mc());1K.hO=F.hO;1K.hN=F.hN;1K.3s=F.3s.1T();1K.2P=F.2P.9D(0);1h(G r=0;r<1K.2P.T;r++){G 1J=1K.2P[r];if(1J){1K.2P[r]=F.RA(1J)}}1K.3W=F.3W.9D(0);1h(G c=0;c<1K.3W.T;c++){G 2r=1K.3W[c];if(2r){1K.3W[c]=F.NR(2r)}}K.4n.9L=1x;I 1K},3q:H(){G 1q=1n.2o(7B,F,"3q",[]);1q.4t=F.4t;1q.8g=F.8g;1q.da=F.da;1q.6N=F.6N;1q.ch=F.ch;1q.BW=F.Bz();1q.dw=F.dw;1q.jV=F.mc();1q.hO=F.X9();1q.hN=F.Xe();1q.2g=F.2g;1q.2P=[];1h(G r=0;r<F.3s.2P;r++){G 1J=F.8i(r);1q.2P[r]={1o:1J.1o}}1q.3W=[];1h(G c=0;c<F.3s.3W;c++){G 2r=F.9z(c);1q.3W[c]=F.NR(2r)}1q.3s=[];1h(G r=0;r<F.3s.2P;r++){1h(G c=0;c<F.3s.3W;c++){1q.3s.1f(F.8s(c,r).3q())}}I 1q},3D:H(1q){1n.2o(7B,F,"3D",[1q]);F.4t=1q.4t;F.8g=1q.8g;F.da=1q.da;F.6N=1q.6N;if(1q.ch){F.ch=5T.1K(1q.ch)}F.C7(1q.BW);if(1q.dw!==1F){F.dw=1q.dw}F.rE(1q.jV);if(1q.hO){F.Mb(1q.hO)}if(1q.hN){F.M1(1q.hN)}if(1q.2g){F.7N(1q.2g)}F.2P=[];1h(G r=0;r<1q.2P.T;r++){F.2P[r]=F.RA(1q.2P[r])}F.3W=[];1h(G c=0;c<1q.3W.T;c++){F.3W[c]=F.NR(1q.3W[c])}F.3s=1a J.3X.gl(1q.3W.T,1q.2P.T);G 2G=0;1h(G r=0;r<F.3s.2P;r++){1h(G c=0;c<F.3s.3W;c++){F.8s(c,r).3D(1q.3s[2G++])}}},5g:H(1v,O){1n.2o(7B,F,"5g",[1v,O]);if(F.8V()==""){F.aJ(O.a7("1aX",1v))}F.rE(O.4v("NW",1v));F.4t=O.5k("NU",1v);F.6N=O.9r("NV",1v);G rf=O.vo("1b0",1v);if(rf){F.b7(rf.dh);F.bq(rf.4i)}1k{F.b7(O.3Q("tA",1v));F.bq(O.3Q("tv",1v))}F.2g=O.3Q("1Q",1v,K.jZ.az);F.da=O.3Q("GJ",1v,F.da);F.dw=O.3Q("vK",1v,F.dw);F.8g=O.3Q("1b3",1v);F.C7(O.4v("1b2",1v));F.Mb(O.4v("1b1",1v));F.M1(O.4v("1aS",1v));G Af=1v.7U("Hg");G ux=1v.7U("zA");G Rf=1v.7U("aT");if(Af.T*ux.T!=Rf.T){7r 1a 1m3("p7 wf of 2G 6n OT hS Rc s5 wf of 2P 1m2 3W in s5 6z.")}F.Nu(ux.T,Af.T);1h(G i=0;i<Af.T;++i){F.8i(i).1o=O.5k("AT",Af[i])}1h(G i=0;i<ux.T;++i){F.9z(i).1l=O.5k("rB",ux[i]);F.9z(i).ha=O.3Q("iR",ux[i])}G c=0;1h(G i=0;i<Af.T;++i){1h(G j=0;j<ux.T;++j){G 2G=F.8s(j,i);2G.5g(Rf[c++],O)}}},5u:H(1v,O){1n.2o(7B,F,"5u",[1v,O]);O.4o(F.mc(),"NW",1v);O.5w(F.4t,"NU",1v);O.9k(F.6N,"NV",1v);O.4r(F.ec(),"tA",1v);O.4r(F.ft(),"tv",1v);O.4r(F.2g,"1Q",1v);O.4r(F.da,"GJ",1v);O.4r(F.dw,"vK",1v);O.4r(F.8g,"1b3",1v);O.4o(F.Bz(),"1b2",1v);O.4o(F.X9(),"1b1",1v);O.4o(F.Xe(),"1aS",1v);G zJ=O.3i("10n",1v);1h(G i=0;i<F.2P.T;i++){1h(G j=0;j<F.3W.T;j++){G zz=O.3i("aT",zJ);G 2G=F.8s(j,i);2G.5u(zz,O)}}G A6=O.3i("Ef",1v);1h(G i=0;i<F.2P.T;i++){G 1aR=O.3i("Hg",A6);G 1J=F.8i(i);O.5w(1J.1o,"AT",1aR)}G A4=O.3i("10G",1v);1h(G i=0;i<F.3W.T;i++){G Rs=O.3i("zA",A4);G 2r=F.9z(i);O.5w(2r.1l,"rB",Rs);O.4r(2r.ha,"iR",Rs)}},8s:H(4B,1J){G 2G=F.3s.1V(4B,1J);if(!2G){2G=F.1aQ();F.3s.2X(4B,1J,2G)}I 2G},1aQ:H(){G 2G=1a K.aT();2G.1j=F;I 2G},8i:H(1J){if(1J>=F.2P.T){I 1F}G dZ=F.2P[1J];if(!dZ){dZ=F.Nz();F.2P[1J]=dZ}I dZ},AW:H(1J,N){G dv;if(5P 1J==="wf"){dv=1J;1J=F.8i(1J)}if(1J.1o==N){I}1J.1o=N;F.CL(dv||1E.7g(F.2P,1J));F.1S()},Nz:H(){I{1o:6,eo:[],eu:[]}},RA:H(1J){I{1o:1J.1o,eo:[],eu:[]}},9z:H(4B){G Gz=F.3W[4B];if(!Gz){Gz=F.NG();F.3W[4B]=Gz}I Gz},AD:H(4B,N){if(5P 4B==="wf"){4B=F.9z(4B)}if(4B.1l==N){I}4B.1l=N;F.CU();F.1S()},Fy:H(4B,N){if(5P 4B==="wf"){4B=F.9z(4B)}if(4B.ha==N){I}4B.ha=N;F.CU();F.1S()},NG:H(){I{1l:18,ha:K.iR.QR}},NR:H(2r){I{1l:2r.1l,ha:2r.ha}},oU:H(N){F.1j=N;1h(G r=0;r<F.3s.2P;r++){1h(G c=0;c<F.3s.3W;c++){F.8s(c,r).1j.1j=N}}},3S:H(1p){G 1d=F.8m();if(!1d.3S(1p)){I 1x}if(K.1M.ML(1p,F.9W())){I 1t}if(F.aO&&F.7F(1p)){I 1t}I 1x},9W:H(){if(F.6e.pG){F.kr();F.6e.pG=1c}G p=[];p.1f(F.1d.5H());p.1f(F.1d.hc());p.1f(F.1d.bc());p.1f(F.1d.hi());K.1M.k7(p,K.1M.9J(F.1d),F.3b);I p},kr:H(){if(F.CM){F.CM=1x;if(F.4b){F.4b.8E()}}G 2w=F.6e.2w=[];G 3E=F.hk();G 9i=F.fi();G 6X=F.iA();G 1N=F.rd();G 1D={1N:1N,nT:9M.Bk};F.pC(2w,1D);if(1D.1N){1N=1D.1N}F.6e.3b=F.3b;F.6e.7p=F.1d.2N();G 1r=F.1d.1T();G 9t=1r;if(F.2g==K.jZ.wG){G mm=2h.4T(F.1j.3z);G bf=mm*2.5;9t=1a 3U();9t.1aT(1r,bf);9t.Gv()}G nj=9t.1T();nj.2y=1c;nj.1N=1N;nj.9S=F.n7();2w.1f(nj);1r=1r.1T();1r.1o=F.4t;if(F.6N){G kV=1r.1T();kV.1N=F.6N;kV.2y=1c;if(F.2g==K.jZ.wG){G rY=1a J.1B.l0();rY.kk=9t;rY.2w.1f(kV);2w.1f(rY)}1k{2w.1f(kV)}}F.pC(2w,{nT:9M.Br});F.1P.4G(1r,0);F.1P.2m=F.ch?F.ch:F.hH();F.1P.2y=F.gu();F.1P.3E=F.qN();F.1P.3p=F.u8();F.1P.Ba=F.3b!=0;2w.1f(F.1P);G aM=1a J.1B.l0();aM.kk=9t;2w.1f(aM);G 2P=F.3s.2P;G lm=F.3s.3W;G y=1r.3F();G wX=1x;G bX=F.mc();F.CU();1h(G r=F.8g;r<2P;r++){G fW=F.8i(r).1o;G 1fX=r==2P-1||y+fW>F.1d.3F();G x=1r.x;1h(G c=0;c<lm;c++){G CS=c==lm-1;G 2G=F.8s(c,r);G iT=F.9z(c).1l;if(iT<=0){2V}G Bc=2G.bz>1||2G.7Z>1;if(Bc&&!wX){F.WT();wX=1t}if(CS){iT+=1r.2Z()-(x+iT)}G aE=1a 1I(x,y,iT,fW);if(Bc){G BM=F.WS(c,r);aE.1l=BM.1l;aE.1o=BM.1o}x+=iT;G 1aW=!(wX&&2G.X5);if(1aW){if(2G.1N){G NI=aE.1T();NI.2y=1c;NI.1N=2G.1N;aM.2w.1f(NI)}G 4d=2G.4d;if(4d){G B6=aE.1T();if(2G.7Q){2G.7Q.W4(B6)}4d.4G(B6,0);4d.9Z=2G.At();aM.2w.1f(4d)}if(2G.1P){2G.1P.4G(aE);2G.1P.2m=2G.2m?2G.2m:F.hH();2G.1P.qe=1t;2G.1P.2y=2G.3e?2G.3e:F.gu();2G.1P.3E=F.qN();2G.1P.3p=F.u8();2G.1P.Ba=F.3b!=0;2G.1P.jV=bX;2G.1P.1lt=bX;aM.2w.1f(2G.1P)}if(F.dw==K.vK.VZ){if(!CS){G NT=1a 8C(aE.2Z(),aE.y,aE.2Z(),aE.3F());NT.9e(3E);NT.4V=6X;aM.2w.1f(NT)}G NZ=1a 8C(aE.x,aE.3F(),aE.2Z(),aE.3F());NZ.9e(3E);NZ.4V=6X;aM.2w.1f(NZ)}if(F.dw==K.vK.Xm){G NX=1a Wj(aE);aM.2w.1f(NX)}}if(x>1r.2Z()){2i}}y+=fW;if(y>F.1d.3F()){2i}}9t.2y=3E;9t.3p=9i;9t.4V=6X;9t.1N=1c;2w.1f(9t);1r=F.1d;if(F.4t>0&&F.4t<1r.1o){G y=1r.y+F.4t;G 8z=1a 8C(1r.x,y,1r.2Z(),y);8z.9e(3E);8z.3p=9i;8z.4V=6X;if(F.2g==K.jZ.wG&&(y<bf||y>1r.1o-bf)){8z.Cg=9t}2w.1f(8z)}F.D6(2w);if(F.mq){F.mq(F)}},7N:H(N){if(F.2g!=N){F.2g=N;F.1S()}},qR:H(){if(F.2g===1F){I K.jZ.az}I F.2g},1aV:H(N){if(F.4t!=N){F.4t=N;F.1S()}},jb:H(){I F.4t},1ls:H(N){if(F.dw!=N){F.dw=N;F.1S()}},1lr:H(){I F.dw},1lw:H(N){if(F.da!=N){F.da=N;F.1S()}},1lv:H(){I F.da},Nu:H(3W,2P){if(2P<F.2P.T){F.Vz(2P,F.2P.T-1)}F.3s.q7(3W,2P);F.2P.T=2P;F.3W.T=3W;F.CM=1t;F.1S()},hJ:H(){I F.3s.2P},1eX:H(N){if(N<0){I}if(F.3s.2P==N){I}G 1aU=F.3s.3W;F.Nu(1aU,N)},ge:H(){I F.3s.3W},1f7:H(N){if(N<0){I}if(F.3s.3W==N){I}G 1bd=F.3s.2P;F.Nu(N,1bd)},1bc:H(4B){F.3s.1bc(4B);F.3W.dg(4B,1);F.1S()},Vy:H(4B){G We=F.NG();F.3s.Vy(4B);F.3W.dg(4B,0,We);F.1S();I We},1bb:H(1J){if(1J>=F.2P.T){I}F.Vz(1J,1J);F.3s.1bb(1J);F.2P.dg(1J,1);F.VR(1J);F.CL(1J);F.1S()},VB:H(1J){G Fp=F.Nz();F.3s.VB(1J);F.2P.dg(1J,0,Fp);F.VR(1J);F.CL(1J);F.CM=1t;F.1S();I Fp},1lm:H(){I F.Vy(F.3s.3W)},1ll:H(){I F.VB(F.3s.2P)},Vz:H(9y,to){if(F.1j){G 1X=[];1h(G r=9y;r<=to;r++){G 1J=F.2P[r];if(!1J){2V}F.CW(1J.eo,1X);F.CW(1J.eu,1X)}G 1j=F.1j;1E.1U(1X,H(1i){1j.ml(1i)})}},Bz:H(){I F.4b?1t:1x},C7:H(N){G BW=F.Bz();if(BW==N){I}if(N){F.4b=F.1fS?1a K.wJ(F):1a K.wT(F);F.CE(F.4b)}1k{F.CF(F.4b);5M F.4b}F.1S()},1be:H(){I F.8g>0},1bh:H(){I F.8g<F.3s.2P-1},BH:H(){1n.2o(7B,F,"BH",[]);if(F.4b){F.4b.8E()}},BJ:H(1i,1p,4X,1bg){G 1J=1bg?1F:F.OO(1p);G cp=1a K.lE(F,1i,4X,1J);if(cp.4Z.1J){cp.fO()}1k{cp.4Z.5i=F.5i;cp.4Z.1p=1p}I cp},1bf:H(1J,1i){G dZ=F.8i(1J);if(!dZ){I}G 1X=dZ.eo;if(!1E.2O(1X,1i)){1X.1f(1i)}},1b6:H(1J,1i){G dZ=F.8i(1J);if(!dZ){I}G 1X=dZ.eu;if(!1E.2O(1X,1i)){1X.1f(1i)}},1b5:H(1J,1i){G dZ=F.8i(1J);if(!dZ){I}G 1X=dZ.eo;1E.54(1X,1i)},1b4:H(1J,1i){G dZ=F.8i(1J);if(!dZ){I}G 1X=dZ.eu;1E.54(1X,1i)},CW:H(g7,bG){1E.1U(g7,H(1i){if(!1E.2O(bG,1i)){bG.1f(1i)}})},mO:H(1X){1n.2o(7B,F,"mO",[1X]);1h(G i=0;i<F.2P.T;i++){G 1J=F.8i(i);F.CW(1J.eo,1X)}},mE:H(1X){1n.2o(7B,F,"mE",[1X]);1h(G i=0;i<F.2P.T;i++){G 1J=F.8i(i);F.CW(1J.eu,1X)}},p5:H(1J){G rc=F.1d.1T();if(1J<F.8g){rc.1o=F.4t;I rc}G OF=F.1d.y;OF+=F.4t;1h(G i=F.8g;i<1J;i++){OF+=F.8i(i).1o}I 1a 1I(rc.x,OF,rc.1l,F.8i(1J).1o)},OO:H(1p){G y=1p.y-F.1d.y;if(F.1d.1o<y||F.2P.T==0){I-1}G h=F.4t;if(y<F.4t){I F.8g}1h(G i=F.8g;i<F.2P.T;++i){h+=F.8i(i).1o;if(y<h){I i}}I F.2P.T-1},1b7:H(1ba,gc,4D){G pt=F.p5(1ba).2N();G 1b9=1a 1L((4D.x+gc.x)/2,(4D.y+gc.y)/2);pt.x=pt.x<1b9.x?F.1d.2Z():F.1d.3R();I pt},CL:H(1b8){1h(G r=1b8;r<F.2P.T;++r){G 1J=F.8i(r);1E.1U(1J.eo,H(1i){1i.rP();if(1i.aH){1i.8N()}});1E.1U(1J.eu,H(1i){1i.rP();if(1i.aH){1i.8N()}})}},VR:H(2I){1h(G r=2I;r<F.2P.T;++r){G 1J=F.8i(r);1E.1U(1J.eo,H(1i){1i.3J.1J=r});1E.1U(1J.eu,H(1i){1i.3A.1J=r})}},AJ:H(1J){if(1J<0){I}if(1J>=F.2P.T){I}F.8g=1J;if(F.4b){F.4b.8E()}F.CL(0);F.CM=1t;F.1S()},VH:H(){F.AJ(F.8g+1);F.1S()},X2:H(){F.AJ(F.8g-1);F.1S(F)},CU:H(){G Oo=0;G X1=0;1h(G c=0;c<F.3W.T;c++){G 2r=F.9z(c);G 1A=2r.ha;if(1A==K.iR.Av){Oo++}1k{X1+=2r.1l}}if(Oo==0){I}G CT=(F.1d.1l-X1)/Oo;1h(G c=0;c<F.3W.T;c++){G 2r=F.9z(c);if(2r.ha==K.iR.Av){2r.1l=CT}}},WT:H(){G lm=F.3s.3W;G 2P=F.3s.2P;1h(G r=2P-1;r>=0;r--){1h(G c=lm-1;c>=0;c--){G 2G=F.8s(c,r);G oo=2G.bz;if(!oo){oo=1}G 7Z=2G.7Z;if(!7Z){7Z=1}2G.X5=1x;if(oo<=1&&7Z<=1){2V}1h(G rr=r;rr<r+7Z;rr++){1h(G cc=c;cc<c+oo;cc++){if(r==rr&&c==cc){2V}G 1fZ=F.8s(cc,rr);1fZ.X5=1t}}}}},WS:H(4B,1J){G 2G=F.8s(4B,1J);G bz=2G.bz;if(!bz){bz=1}G 1l=0;1h(G c=4B;c<4B+bz;c++){1l+=F.9z(c).1l}if(c==F.3s.3W){G 6A=0;1h(G c=0;c<F.3s.3W;c++){6A+=F.9z(c).1l}1l+=F.1d.1l-6A}G 7Z=2G.7Z;if(!7Z){7Z=1}G 1o=0;1h(G r=1J;r<1J+7Z;r++){1o+=F.8i(r).1o}I{1l:1l,1o:1o}},1g0:H(1p){1p=F.1fY(1p);G 1r=F.1d.1T();1r.1o=F.4t;G 2P=F.3s.2P;G lm=F.3s.3W;G y=1r.3F();G wX=1x;F.CU();1h(G r=F.8g;r<2P;r++){G fW=F.8i(r).1o;G 1fX=r==2P-1||y+fW>F.1d.3F();G x=1r.x;1h(G c=0;c<lm;c++){G CS=c==lm-1;G 2G=F.8s(c,r);G iT=F.9z(c).1l;if(iT<=0){2V}G Bc=2G.bz>1||2G.7Z>1;if(Bc&&!wX){F.WT();wX=1t}if(CS){iT+=1r.2Z()-(x+iT)}G aE=1a 1I(x,y,iT,fW);if(Bc){G BM=F.WS(c,r);aE.1l=BM.1l;aE.1o=BM.1o}x+=iT;if(aE.3S(1p)){I{2G:2G,aE:aE,2r:c,1J:r}}if(x>1r.2Z()){2i}}y+=fW;if(y>F.1d.3F()){2i}}I 1c},xB:H(1p){G rF=F.1g0(1p);if(rF){I 1a K.x6(F,rF)}I F},nu:H(1p){G 1r=F.1d.1T();1r.1o=F.4t;if(F.3b==0){I 1r}1k{G 3g=F.k0(F.1d.1T());I 3g.WY(1r)}},1g3:H(N){if(F.6N!==N){F.6N=N;F.1S()}},1g2:H(){I F.6N},1lp:H(N){if(F.ch!==N){F.ch=N;F.1S()}},1lo:H(){I F.ch},rE:H(N){if(F.1P.jV!=N){F.1P.jV=N;F.1S()}},mc:H(){I F.1P.jV},cD:H(4g,4H){G 8l=4H.5I["4O:7B"];if(8l){if(4g.5j(8l)){I 8l}}I 1n.2o(7B,F,"cD",[4g,4H])},1g1:H(4B){G rc=F.1d.1T();if(4B>=F.3W.T){I rc}G w=rc.3R();1h(G i=0;i<4B;++i){G c=F.9z(i);w+=c.1l}rc.x=w;rc.1l=F.9z(4B).1l;I rc},mI:H(2p){G 9o=1n.2o(7B,F,"mI",[2p]);if(9o!=1c){I 9o}G rc=K.1M.Ce(F.1d);G Xf=2h.4T(F.1j.3z)*(F.dw==K.vK.Xm?2:1);if(F.em()!=0){2p=K.1M.bO(2p,F.1d.2N(),-F.em())}if(F.hO){1h(G i=0;i<F.3s.3W-1;i++){G Ck=F.1g1(i);if(Ck.3R()>=rc.2Z()){2i}G hM=Ck.1T();hM.1l=Xf;hM.x=Ck.2Z()-hM.1l/2;hM.y+=F.jb();G h=0;1h(G j=F.2P.T-1;j>=0;j--){h=F.p5(j).3F();if(h!=0){2i}}if(h!=0){hM.1o=1w.2H(Ck.3F(),h)-hM.y}if(hM.3S(2p)){I 1a K.vD(F,i)}}}if(F.hN){1h(G i=F.8g;i<F.3s.2P;i++){G LS=F.p5(i);if(LS.3c()>=rc.3F()){2i}G hM=LS.1T();hM.1o=Xf;hM.y=LS.3F()-hM.1o/2;if(hM.3S(2p)){I 1a K.vP(F,i)}}}I 1c},X9:H(){I F.hO},Mb:H(N){if(N!=F.hO){F.hO=N}},Xe:H(){I F.hN},M1:H(N){if(N!=F.hN){F.hN=N}},dQ:H(){G 1G=1n.2o(7B,F,"dQ",[]);1G.4t=F.4t;1G.8g=F.8g;1G.da=F.da;1G.6N=F.6N;1G.ch=F.ch;1G.BW=F.Bz();1G.hO=F.hO;1G.hN=F.hN;1G.3s=F.3s.1T();I 1G},ee:H(1G){1n.2o(7B,F,"ee",[1G]);F.4t=1G.4t;F.8g=1G.8g;F.da=1G.da;F.6N=1G.6N;F.ch=1G.ch;F.C7(1G.BW);F.Mb(1G.hO);F.M1(1G.hN);F.3s=1G.3s},1fS:1x,aL:H(){if(!K.oQ){K.oQ=1a J.8Q(7B.1s,1c,F)}1k{K.oQ.8M(F)}I K.oQ},1fR:H(1fQ,1lG){if(F.3s.3W===0||F.3s.2P===0){I}G 1P;G 2m=F.hH();G bX;G rc;G B5=[];1h(G 2r=0;2r<F.3s.3W;++2r){B5.1f([]);1h(G 1J=0;1J<F.3s.2P;++1J){1P=F.8s(2r,1J).8V();rc=1a 1I(0,0,5O.7T,5O.7T);G mn=F.1j.dG(1P,2m,rc,bX);if(F.8s(2r,1J).Eu()==1){if(mn.1l!=0){F.8s(2r,1J).1P.6g.C9(mn);mn.1l+=F.8s(2r,1J).1P.6g.2Z+1}B5[2r].1f(1a 6F(mn.1l,mn.1o))}}}G En=0;G vz=[];1h(G 2r=0;2r<F.3W.T;++2r){G 4F=0;1h(G 1J=0;1J<F.2P.T;++1J){if(B5[2r][1J]){if(4F<B5[2r][1J].1l){4F=B5[2r][1J].1l}}}vz.1f(4F);F.9z(2r).1l=4F;En+=4F}1h(G 2r=0;2r<F.3W.T;++2r){1h(G 1J=0;1J<F.2P.T;++1J){if(F.8s(2r,1J).Eu()>1){G N9=0;G n=F.8s(2r,1J).Eu();1h(G c=2r;c<=2r+n-1;c++){N9+=vz[c];F.8s(c,1J).1P.6g}1P=F.8s(2r,1J).8V();G mn=F.1j.dG(1P,2m,1F,bX);F.8s(2r,1J).1P.6g.C9(mn);if(N9<mn.1l){G bW=vz[2r+n-1];En-=bW;vz[2r+n-1]=mn.1l-(N9-bW)+F.8s(2r,1J).1P.6g.3R+F.8s(2r,1J).1P.6g.2Z+1;En+=vz[2r+n-1];F.9z(2r+n-1).1l=vz[2r+n-1]}}}}G Nf=0;1h(G 1J=0;1J<F.2P.T;++1J){G 6u=0;1h(G 2r=0;2r<F.3s.3W;++2r){if(6u<F.2P[0].1o){6u=F.2P[0].1o}}F.2P.1o=6u;Nf+=6u}if(!1fQ){}Nf+=F.jb();F.1d=1a 1I(F.1d.x,F.1d.y,En,Nf);if(F.4b){F.4b.8E()}F.kr()}};7B.hG=H(1m){if(!K.oQ){K.oQ=1a J.8Q(7B.1s,1m)}1k{K.oQ.8M(1c)}I K.oQ};K.oQ=1c;J.2x(7B,"J.1e.7B",K.3m)})(J.1e);(H(K){G 3o=J.3X.3o;G f8=K.f8=H(){1n.2T(f8,F);F.5I={}};f8.1s={3D:H(1q){if(1q.kv){G kv=1a K.2E(1q.kv);F.5I["4O:4c"]=kv}if(1q.8l){G 8l=1a K.2E(1q.8l);F.5I["4O:3m"]=8l}if(1q.wh){G wh=1a K.2E(1q.wh);F.5I["4O:3B"]=wh}if(1q.tZ){G tZ=1a K.2E(1q.tZ);F.5I["4O:5p"]=tZ}if(1q.tB){G tB=1a K.2E(1q.tB);F.5I["4O:7B"]=tB}if(1q.tD){G tD=1a K.2E(1q.tD);F.5I["4O:6t"]=tD}if(1q.eh){G eh=1a K.2E(1q.eh);F.5I["4O:4n"]=eh}},3q:H(){I{kv:F.5I["4O:4c"]?F.5I["4O:4c"].3q():1c,8l:F.5I["4O:3m"]?F.5I["4O:3m"].3q():1c,wh:F.5I["4O:3B"]?F.5I["4O:3B"].3q():1c,tZ:F.5I["4O:5p"]?F.5I["4O:5p"].3q():1c,tB:F.5I["4O:7B"]?F.5I["4O:7B"].3q():1c,tD:F.5I["4O:6t"]?F.5I["4O:6t"].3q():1c,eh:F.5I["4O:4n"]?F.5I["4O:4n"].3q():1c}},5u:H(1u,O){1h(G 5R in F.5I){if(F.5I.1fT(5R)){G 8o=O.3i("2E",1u);8o.2Q("1fW",5R);O.Pc(8o,F.5I[5R],5R+"2E")}}},5g:H(1u,O){F.5I={};1h(G i=0;i<1u.fH.T;i++){G 8o=1u.fH[i];if(8o.El!==1){2V}G 1fV=8o.4y("1fW");G 1A=O.1fK(8o);F.5I[1fV]=1A}}};(H 1lJ(){f8.f2=1a f8();G tu=f8.f2.5I;G 1gd="gp";G WG="dM";G j4="MJ(1fU, 1fU, qb)";G 1gc="MJ(180, 160, 160)";G 1gb="MJ(170, 170, oT)";G eX=1a K.2E();eX.7A(1gd);eX.WE(WG);eX.WD(0);eX.iW(WG);eX.DI("GE-Gy");eX.DJ(4);eX.WI("MG");G kv=1a K.2E(eX);tu["4O:4c"]=kv;G 8l=1a K.2E(eX);tu["4O:3m"]=8l;G wh=1a K.2E(eX);tu["4O:3B"]=wh;G tZ=1a K.2E(eX);tZ.7A(j4);tu["4O:5p"]=tZ;G tD=1a K.2E(eX);tD.7A(j4);tu["4O:6t"]=tD;G tB=1a K.2E(eX);tB.7A(1gc);tu["4O:7B"]=tB;G eh=1a K.2E(eX);eh.Eb(1gb);tu["4O:4n"]=eh})();J.2x(f8,"J.1e.f8")})(J.1e);(H(K){G 1L=J.1B.1L;G 1I=J.1B.1I;G 2h=J.1B.2h;G 5T=J.1B.5T;G 7G=J.1B.7G;G 6F=J.1B.6F;G 3o=J.3X.3o;G s9=K.s9=H(1m,3O){F.1m=1m;F.3O=3O;F.1R=[];F.Uh=[];F.fp=[];F.5I=[];F.hs=[];F.5q=[];F.U7=1a 3o();F.PU=1a 3o();F.Tn=1a 3o();F.UZ=1a 3o();F.TJ=1a 3o()};s9.1s={U1:H(1g,MD,2l){G 1u=F.3O.hV(2l);MD.ae(1u);G c0=1g.7i.sh;if(c0!=1c){1u.2Q("kb",c0.5R);1u.2Q("Id",1g.8S.7P());1u.2Q("jf",c0.kn.7P());1g.5u(1u,F)}1k{7r 1a 7M("vm uL be s7 TI it OT hS V2 V0().")}},1et:H(1C,MD,2l){G 1u=F.3O.hV(2l);MD.ae(1u);G c0=1C.7i.sh;if(c0!=1c){1u.2Q("kb",c0.5R);1u.2Q("jf",c0.kn.7P());1C.5u(1u,F)}1k{7r 1a 7M("cL uL be s7 TI it OT hS V2 V0().")}},3i:H(2l,2a,7R){G 1u=F.3O.hV(2l);2a.ae(1u);if(1gt(7R)){1u.ae(F.3O.1lI(7R))}I 1u},TS:H(5R,1u){G 2R=K.4n.U3[5R];if(!2R){7r 1a 7M("vm 5R ["+5R+"] is hS 1lH.")}if(1n.wp(2R,K.3m)){G 1g=1a 2R(F.1m)}1k{if(2R==K.4c||1n.wp(2R,K.4c)){G 1gg=1u.7U("1ge")[0];G 1gf=1u.7U("1gh")[0];G 1O=F.1R[7e(1gg.4y("Id"))];G bG=F.1R[7e(1gf.4y("Id"))];G 1g=1a 2R(F.1m,1O,bG)}}1g.oU(F.1m);I 1g},1g6:H(5R){6m(5R){2k"4O:cL":I 1a K.6R.cL();fI:I 1c}},1fJ:H(5R){6m(5R){2k"4O:ny":G 7E=1a K.ny();2i;2k"4O:nG":G 7E=1a K.nG();2i;fI:I 1c}I 7E},U5:H(fv){G 5R=fv.4y("kb");G id=7e(fv.4y("Id"));G AL=7e(fv.4y("jf"));if(F.1R[id]!==1F){G 1g=F.1R[id]}1k{G 1g=F.TS(5R,fv);F.1R[id]=1g}F.kn=AL;1g.5g(fv,F);I 1g},1eO:H(AM){G 1C=1c;if(!AM.Dn("kb")){1C=1a K.6R.cL()}1k{G 5R=AM.4y("kb");G AL=1;if(AM.Dn("jf")){1ly=7e(AM.4y("jf"))}1C=F.1g6(5R);F.kn=AL}1C.5g(AM,F);I 1C},wQ:H(1g,2l,2a){if(1g==1c){I 1c}G 1u=F.3i(2l,2a);1u.2Q("Id",1g.8S.7P());G c0=1g.7i.sh;1u.2Q("1g5",c0.5R);1u.2Q("jf",c0.kn.7P());I 1u},PC:H(fv){G id=7e(fv.4y("Id"));G 1g=F.1R[id];if(1g){I 1g}G 5R=fv.4y("1g5");G 1g=F.TS(5R,fv);F.1R[id]=1g;I 1g},1g4:H(2a){if(!F.oz){G 1u=F.3i("1ga",2a);F.1g8(1u);F.1fo(1u);F.Pb(1u);F.1ft(1u);F.1fM(1u)}},1g7:H(2a){G wa=4k("1ga",2a);if(wa){F.1fx(wa);F.1fr(wa);F.Pj(wa);F.1fs(wa);F.1fP(wa)}},Dr:H(Bu,2l,2a,1g9,EO){if(Bu==1c){I 1c}G 1u=F.3i(2l,2a);if(F.oz){1g9.5j(F,[1u,Bu]);I 1u}G 1y=EO.Dx();if(EO.2O(Bu)){1y=EO.1V(Bu)}1k{EO.2X(Bu,1y)}1u.2Q("Id",1y.7P());I 1u},1g8:H(2a){if(F.oz){I}G 1u=F.3i("TW",2a);F.U7.1U(H(1N,1y){G b3=F.3i("ga",1u);b3.2Q("jE",1y);F.Ug(b3,1N)},F)},1fx:H(2a){G 1u=4k("TW",2a);if(!1u){7r 1a 7M("TW 1fu hS xo.")}G TV=1u.7U("ga");1h(G i=0;i<TV.T;i++){G b3=TV[i];G 1y=7e(b3.4y("jE"));G 1N=F.MR(b3);F.Uh[1y]=1N}},9k:H(1N,2l,2a){I F.Dr(1N,2l,2a,F.Ug,F.U7)},9r:H(2l,2a,8J){G 1u=4k(2l,2a);if(!1u){I 8J}if(!1u.Dn("Id")||F.oz){I F.MR(1u)}G 1y=7e(1u.4y("Id"));I F.Uh[1y]},Ug:H(b3,1N){if(1N.2R==="ik"||5P 1N==="av"){b3.2Q("aK","1fw");F.hn(1N.2R==="ik"?1N.4N:1N,"nq",b3)}1k{if(1N.2R==="no"){b3.2Q("aK","Um");F.5w(1N.4J,"1fv",b3);if(1N.9P.T==2){F.hn(1N.9P[0].4N,"1fq",b3);F.hn(1N.9P[1].4N,"1fp",b3)}1k{G w9=F.3i("1fy",b3);G AQ=[],5J=[];1h(G i=0;i<1N.9P.T;i++){1Z[i]=1N.9P[i].1Z;AQ[i]=1N.9P[i].4N}F.KQ(5J,"1fB","1fA",w9);F.1fG(AQ,"1fz","nq",w9)}}}},MR:H(b3){G 1N="hT(qb, 0, 0, 0.4)";G 2R=b3.4y("aK");6m(2R){2k"1fw":1N=F.hy("nq",b3);2i;2k"Um":1N={2R:"no",9P:[]};1N.4J=F.5k("1fv",b3);G w9=4k("1fy",b3);if(w9){G 5J=F.L7("1fB","1fA",w9);G AQ=F.1gT("1fz","nq",w9);if(5J&&AQ){1h(G i=0;i<5J.T;i++){1N.9P.1f({1Z:5J[i],4N:AQ[i]})}}}1k{G c1=F.hy("1fq",b3);G c2=F.hy("1fp",b3);1N.9P.1f({1Z:0,4N:c1});1N.9P.1f({1Z:1,4N:c2})}2i}I 1N},1fo:H(2a){if(F.oz){I}G 1u=F.3i("Tu",2a);1u.2Q("KN",F.PU.Dx());F.PU.1U(H(g8,1y){G EK=F.3i("hX",1u,g8);EK.2Q("jE",1y.7P())},F)},1fr:H(2a){G 1u=4k("Tu",2a);if(!1u){7r 1a 7M("Tu 1fu hS xo.")}G Tz=1u.7U("hX");1h(G i=0;i<Tz.T;i++){G EK=Tz[i];G 1y=7e(EK.4y("jE"));G 4d=F.7R(EK);if(4d){F.fp[1y]=4d}}},MS:H(4d,2l,2a){I F.Dr(4d,2l,2a,F.1k4,F.PU)},EI:H(2l,2a){G 1u=4k(2l,2a);if(!1u){I 1c}G 1y=7e(1u.4y("Id"));I F.fp[1y]},1ft:H(2a){if(F.oz){I}G 1u=F.3i("1fL",2a);F.Tn.1U(H(1A,1y){G 8o=F.3i("2E",1u);if(1y>=0){8o.2Q("jE",1y.7P())}F.Pc(8o,1A)},F)},1fs:H(2a){G 1u=4k("1fL",2a);if(!1u){I}G Tt=1u.7U("2E");1h(G i=0;i<Tt.T;i++){G 8o=Tt[i];G 1y=7e(8o.4y("jE"));G 1A=1a K.2E();1A.5g(8o,F);F.5I[1y]=1A}},To:H(1A,2l,2a,5R){if(1A!=1c){1A.5R=5R}I F.Dr(1A,2l,2a,F.Pc,F.Tn)},Tp:H(2l,2a){G 1u=4k(2l,2a);if(!1u){I 1F}G 1y=7e(1u.4y("Id"));I F.5I[1y]},Pc:H(8o,1A,5R){if(!5R){5R=1A.5R}8o.2Q("kb",5R);8o.2Q("jf","1");1A.5u(8o,F)},1fK:H(8o){G 1A=1a K.2E();1A.5g(8o,F);I 1A},Pb:H(2a){if(F.oz){I}G 1u=F.3i("o9",2a);F.TJ.1U(H(7E,1y){G bk=F.3i("ou",1u);if(1y>=0){bk.2Q("jE",1y.7P())}F.TC(bk,7E)},F)},Pj:H(2a){G 1u=4k("o9",2a);if(!1u){I}G iz=1u.7U("ou");1h(G i=0;i<iz.T;i++){G bk=iz[i];G 1y=7e(bk.4y("jE"));G 7E=F.V3(bk);if(7E){F.5q[1y]=7E}}},Pg:H(7E,2l,2a){if(7E==1c){I F.3i(2l,2a)}I F.Dr(7E,2l,2a,F.TC,F.TJ)},Pf:H(1u){if(!1u.Dn("Id")||F.oz){I F.V3(1u)}G 1y=7e(1u.4y("Id"));if(F.5q.T<=1y){I 1c}I F.5q[1y]},TC:H(bk,7E){G c0=7E.7i.sh;if(c0){bk.2Q("kb",c0.5R);bk.2Q("jf",c0.kn);7E.5u(bk,F)}1k{7r 1a 7M("ou uL be s7 TI it OT hS V2 V0().")}},V3:H(bk){if(!bk.Dn("kb")){I 1c}G 5R=bk.4y("kb");G 7E=F.1fJ(5R);if(!7E){I 1c}7E.5g(bk,F);I 7E},nF:H(2l,2a){G 1u=4k(2l,2a);if(!1u){I 1F}G 1N=F.9r("ga",1u);if(!1N){1N=F.hy("nq",1u)}G 6X=F.3Q("jD",1u);G 1l=F.5k("rB",1u);I{1N:1N,6X:6X,1l:1l}},wc:H(2y,2l,2a){G Ai=F.3i(2l,2a);if(2y){if(5P 2y=="av"){F.9k(2y,"nq",Ai)}1k{if(2y.1N){F.9k(2y.1N,"ga",Ai)}if(2y.6X){F.4r(2y.6X,"jD",Ai)}if(2y.1l){F.5w(2y.1l,"rB",Ai)}}}I Ai},1fM:H(2a){if(F.oz){I}G 1u=F.3i("1fO",2a);1u.2Q("KN",F.UZ.Dx());F.UZ.1U(H(bx,1y){G by=F.3i("1fN",1u);if(1y>=0){by.1kq("jE",1y.7P())}F.1fE(by,bx)},F)},1fP:H(2a){G 1u=4k("1fO",2a);if(!1u){I}G US=1u.7U("1fN");1h(G i=0;i<US.T;i++){G by=US[i];G 1y=7e(by.4y("jE"));G bx=F.1fD(by);F.hs[1y]=bx}},1fE:H(by,bx){by.ae(F.3O.1jT(bx.by,1t))},1fD:H(1u){if(1u.2C.T==0){I 1c}I 1u.1fC},vo:H(2l,2a){G 1u=4k(2l,2a);if(!1u){I 1F}G dh=F.3Q("4w",1u);G 4i=F.3Q("1fF",1u);I{dh:dh,4i:4i}},X6:H(7K,2l,2a){G 1u=F.3i(2l,2a);if(7K){if(7K.dh){F.4r(7K.dh,"4w",1u)}if(7K.4i){F.4r(7K.4i,"1fF",1u)}}I 1u},c9:H(1fI,2l,2a){I F.3i(2l,2a,1fI)},a7:H(2l,2a,8J){if(8J===1F){8J=""}G 1u=4k(2l,2a);if(!1u){I 8J}I F.7R(1u)},5w:H(1fH,2l,2a){I F.3i(2l,2a,1fH.7P())},5k:H(2l,2a,8J){if(8J===1F){8J=0}G 1u=4k(2l,2a);if(!1u){I 8J}I 6s(F.7R(1u))},4r:H(Vh,2l,2a){G 7R=Vh.7P();if(7R.7g(".")!=-1){7R=1w.he(Vh).7P()}I F.3i(2l,2a,7R)},3Q:H(2l,2a,8J){if(8J===1F){8J=0}G 1u=4k(2l,2a);if(!1u){I 8J}I 7e(F.7R(1u))},4o:H(Dw,2l,2a){if(5P Dw==="1F"||Dw===1c){Dw=1x}I F.3i(2l,2a,Dw.7P())},4v:H(2l,2a,8J){if(8J===1F){8J=1x}G 1u=4k(2l,2a);if(!1u){I 8J}I F.7R(1u).PG()=="1t"},KQ:H(PF,2l,sn,2a){if(PF==1c){I 1c}G 1u=F.3i(2l,2a);1h(G i=0;i<PF.T;i++){F.5w(PF[i],sn,1u)}I 1u},L7:H(2l,sn,2a){G 1u=4k(2l,2a);if(!1u){I 1c}G Ax=1u.7U(sn);G kL=[];1h(G i=0;i<Ax.T;i++){kL[i]=6s(F.7R(Ax[i]))}I kL},1fG:H(PR,2l,sn,2a){if(PR==1c){I 1c}G 1u=F.3i(2l,2a);1h(G i=0;i<PR.T;i++){F.hn(PR[i],sn,1u)}I 1u},1gT:H(2l,sn,2a){G 1u=4k(2l,2a);if(!1u){I 1c}G Ax=1u.7U(sn);G kL=[];1h(G i=0;i<Ax.T;i++){kL[i]=F.Vg(Ax[i],"gp")}I kL},hn:H(1gS,2l,2a){I F.3i(2l,2a,K.1M.1jY(1gS))},hy:H(2l,2a,8J){if(8J===1F){8J="dM"}G 1u=4k(2l,2a);if(!1u){I 8J}I F.Vg(1u,8J)},Vg:H(1u,8J){G s=F.7R(1u);if(s.T!=9){I 8J}if(s[0]!="#"){I 8J}G Vl=s.c8(1,3);if(Vl=="FF"){I"#"+s.c8(3)}G a=7e(Vl,16)/1gR;G r=7e(s.c8(3,5),16);G g=7e(s.c8(5,7),16);G b=7e(s.c8(7,9),16);I K.1M.ds(r,g,b,a)},qW:H(2m,2l,2a){G wj=F.3i(2l,2a);if(2m){F.c9(2m.5n,"ho",wj);F.5w(2m.1Y,"6F",wj);F.4o(2m.ql,"Vk",wj);F.4o(2m.qh,"Vf",wj);F.4o(2m.BI,"Va",wj)}I wj},rZ:H(2l,2a){G 1u=4k(2l,2a);if(!1u){I 1F}G 5n=F.a7("ho",1u);if(5n==""){I 1F}G 1Y=F.5k("6F",1u);G dm=F.3Q("1jZ",1u);if(dm!=0){1Y=2h.D9(1Y,dm,F.1m.3z)}G ql=F.4v("Vk",1u);G qh=F.4v("Vf",1u);G BI=F.4v("Va",1u);I 1a 5T(5n,1Y,ql,qh,BI)},1gU:H(5i,2l,2a){if(5i==1c){I 1c}G 1u=F.3i(2l,2a);1u.2Q("Id",(5P 5i.jm=="av")?5i.jm:"");if(!5i.jm){G BC=F.3i("t6",1u);BC.2Q("KN",5i.1b.T);1h(G i=0;i<5i.1b.T;i++){G 1p=5i.1b[i];G hE=F.3i("aw",BC);G c0=1p.7i.sh;if(c0){hE.2Q("kb",c0.5R);hE.2Q("jf",c0.kn)}1p.5u(hE,F)}}},1gX:H(2l,2a,Dh){G 1u=4k(2l,2a);if(!1u){I 1c}G Up=1u.4y("Id");if(Up==""||Dh){G hB=1a K.8a();G BC=4k("t6",1u);if(!BC){I 1c}G Uy=BC.7U("aw");1h(G i=0;i<Uy.T;i++){G hE=Uy[i];G 1p=1a K.aw(0,0);1p.jh=F.4v("1gW",hE);1p.jg=F.4v("1gV",hE);1p.4N=F.hy("nq",hE);1p.4B=F.3Q("zA",hE);1p.t1=F.3Q("9R",hE);1p.5r=F.Dv(1p,"BQ",hE);1p.x=F.5k("X",hE);1p.y=F.5k("Y",hE);hB.1b.1f(1p)}I hB}1k{I K.8a.2e(Up)}},xf:H(2g,2l,2a){if(2g==1c){I 1c}G 1u=F.3i(2l,2a);1u.2Q("Id",2g.id?2g.id:"az");I 1u},wV:H(2l,2a){G 1u=4k(2l,2a);if(!1u){I 1F}I 1u.1kj.1kk("Id").N||"x9"},DX:H(2l,2a){G 1gM=["7H","DY","DZ","hx","OR","OY","OV","OW","Ph","Pl","Pa","P7","P8","Qk","Qq","Qr","Qf","Q1"];G id=F.3Q(2l,2a);I 1gM[id]},7R:H(1u){if(1u.fH.T==0){I""}I 1u.fH[0].1gN},1gL:H(1Y,2l,2a){G 7R=1Y.1l.7P()+", "+1Y.1o.7P();I F.3i(2l,2a,7R)},1gK:H(2l,2a){G 1u=4k(2l,2a);if(!1u){I 1F}G N=F.7R(1u);G 6G=N.cF(",");I 1a 6F(6s(6G[0]),6s(6G[1]))},PM:H(wu,2l,2a){G 7R="0, 0, 1, 1";if(wu){7R=wu.x.7P()+", "+wu.y.7P()+", "+wu.1l.7P()+", "+wu.1o.7P()}I F.3i(2l,2a,7R)},UP:H(2l,2a){G 1u=4k(2l,2a);if(!1u){I 1F}G N=F.7R(1u);G 6G=N.cF(",");1h(G i=0;i<6G.T;i++){6G[i]=6s(6G[i])}I 1I.DM(6G)},ER:H(9i,2l,2a){G 7R="0, 0, 0, 0";if(9i){7R=9i.3R.7P()+", "+9i.3c.7P()+", "+9i.2Z.7P()+", "+9i.3F.7P()}I F.3i(2l,2a,7R)},EB:H(2l,2a){G 1u=4k(2l,2a);if(!1u){I 1a 7G(0,0,0,0)}G N=F.7R(1u);G 6G=N.cF(",");1h(G i=0;i<6G.T;i++){6G[i]=6s(6G[i])}I 1a 7G(6G[0],6G[1],6G[2],6G[3])},Q6:H(1p,2l,2a){G 7R="0, 0";if(1p){7R=1p.x.7P()+", "+1p.y.7P()}I F.3i(2l,2a,7R)},1gO:H(1u){G N=1u.fH[0].1gN;G 6G=N.cF(",");1h(G i=0;i<6G.T;i++){6G[i]=6s(6G[i])}I 1a 1L(6G[0],6G[1])},1gQ:H(1b,2l,2a){if(1b==1c){I 1c}G 1u=F.3i(2l,2a);1h(G i=0;i<1b.T;i++){F.Q6(1b[i],"1L",1u)}I 1u},1gP:H(2l,2a){G 1u=4k(2l,2a);if(!1u){I[]}G 2C=1u.7U("1L");G 1b=[];1h(G i=0;i<2C.T;i++){1b.1f(F.1gO(2C[i]))}I 1b},1h7:H(4H,2l,2a){if(4H==1c){I 1c}G 1u=F.3i(2l,2a);F.1h6(1u,4H);I 1u},1h6:H(1h5,4H){4H.5u(1h5,F)},1h8:H(2l,2a){G 1u=4k(2l,2a);if(1u==1c){I 1c}I F.1hb(1u)},1hb:H(1u){G 4H=1a K.f8();4H.5g(1u,F);I 4H},PX:H(2a,5n){I 4k(5n,2a)},Wo:H(2B,2a){G 6n=[];if(F.3O.1ha){G pW=F.3O.1ha(2B,2a,1c,1kc.1jP,1c);G Qj=pW.1h9();3v(Qj){6n.1f(Qj);Qj=pW.1h9()}}1k{1h(G i=0;i<2a.fH.T;i++){if(2a.fH[i].1h0==2B){6n.1f(2a.fH[i])}}}I 6n},1gZ:H(4P,2l,2a){if(!4P==1c){I 1c}G 1u=F.3i(2l,2a);F.wQ(4P.UB,"1k3",1u);H Uu(hD,nE,BA,1h1){if(!hD){I}1h(G i=0;i<hD.T;i++){G 1gY=hD[i];G qt=nE.3i("1h2",BA);nE.wQ(1gY,"vm",qt);nE.4r(0,"aK",qt);nE.4r(0,"1k7",qt);nE.c9("0, 0, 0, 0","1k5",qt);if(1h1){G Pp=nE.3i("1gr",qt);G PQ=nE.3i("1ko",Pp);PQ.2Q("1kn","1");nE.3i("1km",PQ,"4O:1kr:1kp");nE.3i("eg",PQ,"1kh").2Q("aK","2")}}}G BA=F.3i("1h3",1u);Uu(4P.c5,F,BA,1x);Uu(4P.2C,F,BA,1t);F.4o(1t,"E3",1u);F.PM(4P.UB.3a(),"1kg",1u);I 1u},1h4:H(2l,2a){G 1u=4k(2l,2a);if(!1u){I 1c}G BA=4k("1h3",1u);if(!1u){I 1c}G 4P={2C:[],c5:[]};G Uw=1u.7U("1h2");1h(G i=0;i<Uw.T;i++){G qt=Uw[i];G fv=4k("vm",qt);if(fv){G 1g=F.PC(fv);G Pp=4k("1gr",qt);G hD=Pp?4P.2C:4P.c5;hD.1f(1g)}}I 4P},1gp:H(jk,2l,2a,1jX){if(jk==1c){I 1c}G aA=0;G 1u=1c;if(5P jk==="av"){if(jk.T===1){aA=4}1k{aA=1}1u=F.c9(jk,2l,2a)}1k{if(5P jk==="1jW"){aA=2;1u=F.4o(jk,2l,2a)}1k{if(5P jk==="wf"){if(K.1M.1k0(jk)){aA=6;1u=F.5w(jk,2l,2a)}1k{aA=9;1u=F.4r(jk,2l,2a)}}}}if(1u!=1c){1u.2Q("aK",aA)}I 1u},1gv:H(2l,2a){G 1u=4k(2l,2a);if(!1u){I 1c}G aA=7e(1u.4y("aK"));if(aA==1){I F.a7(2l,2a)}if(aA==2){I F.4v(2l,2a)}if(aA==3){I F.3Q(2l,2a)}if(aA==4){I F.a7(2l,2a)}if(aA==5){I F.3Q(2l,2a)}if(aA==6){I F.5k(2l,2a)}if(aA==7){I F.3Q(2l,2a)}if(aA==8){I F.3Q(2l,2a)}if(aA==9){I F.3Q(2l,2a)}if(aA==10){I F.3Q(2l,2a)}if(aA==11){I F.5k(2l,2a)}if(aA==12){I F.3Q(2l,2a)}if(aA==13){I F.3Q(2l,2a)}if(aA==14){I F.3Q(2l,2a)}I 1c},Dm:H(1g,PD,2l,2a){if(PD==1c){I 1c}G 1u=F.3i(2l,2a);G s7=1x;if(F.1m){s7=F.1m.1gq({1g:1g,5r:PD,Al:2l,1u:1u,O:F})}if(!s7){2a.qz(1u);F.1gp(PD,2l,2a,1x)}I 1u},Dv:H(1g,2l,2a){G 1u=4k(2l,2a);if(!1u){I 1c}G 1D={1g:1g,5r:1c,Al:2l,1u:1u,O:F};G s7=F.1m.1gs(1D);if(!s7){I F.1gv(2l,2a)}I 1D.5r},1gu:H(2l,2a){G 1u=4k(2l,2a);if(!1u){I 1c}G 1y=7e(1u.4y("Id"));I F.hs[1y]},4k:4k};H 4k(2l,2a){G 2C=2a.7U(2l);if(2C.T<1){I 1c}if(2C[0].4p!=2a){I 1c}I 2C[0]}H 1gt(N){I(5P N!="1F")&&N!==1c}J.2x(s9,"J.1e.s9")})(J.1e);(H(K){G 1E=J.3X.1E;G 1I=J.1B.1I;G 5T=J.1B.5T;G 7G=J.1B.7G;G aT=K.aT=H(){F.1P=1a J.1B.8n("",1a 1I(0,0,1,1));F.1P.4i=K.4w.7z};aT.1s={1T:H(){G 1K=1a F.7i();1K.1j=F.1j;1K.1P=F.1P.1T();1K.2m=F.2m;1K.1N=F.1N;1K.3e=F.3e;1K.7Z=F.7Z;1K.bz=F.bz;1K.fq=F.fq;1K.k8(F.g8);1K.9Z=F.9Z;if(F.4d){1K.MU(F.MM())}1K.7Q=F.7Q;1K.kx(F.oY());I 1K},3q:H(){G 1q={1P:F.8V(),4q:F.ec(),4i:F.ft(),fq:F.Ei(),9Z:F.At(),7Q:F.7Q,1N:F.1N,3e:F.3e,7Z:F.7Z,bz:F.bz,2m:F.2m,5r:F.5r||1c};if(F.g8){if(F.1j.1j.AR){1q.AS=F.1j.1j.AR(F.g8)}1k{1q.B2=F.g8}}I 1q},3D:H(1q){F.aJ(1q.1P);F.b7(1q.4q);F.bq(1q.4i);F.tH(1q.fq);F.wd(1q.9Z);if(1q.7Q){F.Ea(7G.1K(1q.7Q))}F.1N=1q.1N;F.3e=1q.3e;F.7Z=1q.7Z;F.bz=1q.bz;if(1q.2m){F.2m=5T.1K(1q.2m)}if(1q.AS!=1F){F.k8(F.1j.1j.fp[1q.AS])}if(1q.B2!=1F){F.k8(1q.B2)}F.kx(1q.5r)},5g:H(1v,O){F.2m=O.rZ("5T",1v);F.3e=O.9r("tR",1v);F.aJ(O.a7("8n",1v));F.bz=O.3Q("1gj",1v);F.7Z=O.3Q("1gi",1v);G so=O.vo("1gk",1v);if(so){F.b7(so.dh);F.bq(so.4i)}1k{F.b7(O.3Q("tA",1v));F.bq(O.3Q("tv",1v))}F.9Z=O.3Q("hW",1v);F.k8(O.EI("hX",1v));G Qm=O.PX(1v,"AN");if(Qm){F.7Q=O.EB("AN",1v)}},5u:H(1v,O){O.qW(F.2m,"5T",1v);O.9k(F.3e,"tR",1v);O.c9(F.8V(),"8n",1v);O.4r(F.Eu(),"1gj",1v);O.4r(F.1gl(),"1gi",1v);O.4r(F.ec(),"tA",1v);O.4r(F.ft(),"tv",1v);O.4r(F.At(),"hW",1v);O.MS(F.Eg(),"hX",1v);if(F.7Q){O.ER(F.7Q,"AN",1v)}},aJ:K.ao.1s.aJ,8V:K.ao.1s.8V,b7:K.ao.1s.b7,ec:K.ao.1s.ec,bq:K.ao.1s.bq,ft:K.ao.1s.ft,MU:K.5p.1s.MU,MM:K.5p.1s.MM,tH:K.5p.1s.tH,Ei:K.5p.1s.Ei,k8:K.5p.1s.k8,Eg:K.5p.1s.Eg,oW:K.5p.1s.oW,wd:K.5p.1s.wd,At:K.5p.1s.At,Ea:K.5p.1s.Ea,WH:K.5p.1s.WH,Et:H(N){if(F.2m!==N){F.2m=N;F.1S()}},MB:H(){I F.2m},7A:H(N){if(F.1N!==N){F.1N=N;F.1S()}},bs:H(){I F.1N},iW:H(N){if(F.3e!==N){F.3e=N;F.1S()}},lo:H(){I F.3e},1ot:H(N){if(F.bz!=N){F.bz=N;F.1S()}},Eu:H(){if(F.bz===1F){I 1}I F.bz},1os:H(N){if(F.7Z!=N){F.7Z=N;F.1S()}},1gl:H(){if(F.7Z===1F){I 1}I F.7Z},kx:H(N){if(F.5r!==N){F.5r=N}},oY:H(){I F.5r},1S:H(){if(F.1j){F.1j.1S()}},6I:H(){if(F.1j){F.1j.6I()}}};J.2x(aT,"J.1e.aT")})(J.1e);(H(K){G 1E=J.3X.1E;G 3U=J.1B.3U;G 9T=J.1B.9T;G 1I=J.1B.1I;G 1M=J.1e.1M;G 9M=J.1e.9M;G r9=J.1e.r9;G ny=K.ny=H(){1n.2T(ny,F);F.2R=r9.Wt;F.6J="gp";F.8q="gp"};ny.1s={3D:H(1q){F.2R=1q.2R;F.6J=1q.6J;F.lH=1q.lH;F.8q=1q.8q},3q:H(){G 1q={Bb:F.7i.ek,2R:F.2R,6J:F.6J,lH:F.lH,8q:F.8q};I 1q},5u:H(1v,O){O.4r(F.2R,"aK",1v);O.hn(F.6J,"1go",1v);O.4o(F.lH,"1gn",1v);O.hn(F.8q,"1gm",1v)},5g:H(1v,O){F.2R=O.3Q("aK",1v);F.6J=O.hy("1go",1v);F.lH=O.4v("1gn",1v);F.8q=O.hy("1gm",1v)},1T:H(){G 1K=1a F.7i();1K.2R=F.2R;1K.6J=F.6J;1K.lH=F.lH;1K.8q=F.8q;I 1K},Ns:H(S){G 2z=1a 1I(0,0,100,100);G 1d=S.3a();G x=1d.1l/2z.1l;G y=1d.1o/2z.1o;G 3g=1a 9T();3g.a6(1d.x-1d.1l/2,1d.y-1d.1o/2);3g.3w(x,y);3g.a6(1d.1l/x-2z.x-2z.1l/2,1d.1o/y-2z.y-2z.1o/2);if(S.pR>0){3g.nP(S.pR,2z.x+2z.1l/2,2z.y+2z.1o/2)}if(S.3b!==0){3g.nP(S.3b,2z.x+2z.1l/2,2z.y+2z.1o/2)}I 3g},1gF:H(S){if(S.6k){I S.6k.9W()}1k{G p=1a 3U();G 1d=S.3a();p.nU(1d.x,1d.y,1d.1l,1d.1o);I p}},5j:H(S,2w,1D){if(1D.nT==9M.Br){G 2z=1a 1I(0,0,100,100);G 1d=S.3a();if(S.6k){G pL=S.6k.9W()}1k{G pL=1a 3U();pL.nU(2z.x,2z.y,2z.1l,2z.1o)}G 2K=1a J.1B.l0();2K.kk=F.1gF(S);G 3g=F.Ns(S);G 6J=1M.uq((1D.lH)?S.1oi():F.6J);G Xh=1M.ds(6J.cU,6J.dT,6J.bA,0.7);G l8=1M.ds(6J.cU,6J.dT,6J.bA,0);G 1gG=1M.ds(6J.cU,6J.dT,6J.bA,0.5);G Vr=1M.ds(6J.cU,6J.dT,6J.bA,0.2);G Ox=1M.ds(6J.cU,6J.dT,6J.bA,0.1);6J=1M.ds(6J.cU,6J.dT,6J.bA);G 8q=1M.uq(F.8q);G D4=1M.ds(8q.cU,8q.dT,8q.bA,0.3);G pP=1M.ds(8q.cU,8q.dT,8q.bA,0);G Og=1M.ds(8q.cU,8q.dT,8q.bA,0.5);8q=1M.ds(8q.cU,8q.dT,8q.bA);if(F.2R==r9.Wt){G 7b=1a 3U();7b.Xl(50,100,50,0,6.Xg/2,1);G iU={2R:"GD",gx:Xh,gA:l8,y1:100,y2:100,1gI:50};7b.7A(iU);7b.9e(l8);7b.5c=3g.1T();1E.4K(2K.2w,7b);G l=2z.x;G t=2z.y;G r=2z.2Z();G b=2z.y+2z.1o*35/100;G w=r-l;G h=b-t;G 6w=1a 3U();if(1D.1gE){6w.1om(2z.x+2z.1l/2,2z.y+((2z.1o*70/100)/2)-2z.1o*20/100,2z.1l,2z.1o*70/100)}1k{6w.4M(l,t,r,t);6w.4M(r,t,r,b);6w.4M(r,b,l+w/2,b);6w.4M(l+w/2,b);6w.Wx(l+w/3,b,l,b,l,t+h/2);6w.4M(l,t+h/2,l,t)}G ei={2R:"ik",4N:D4};6w.7A(ei);6w.9e(pP);6w.5c=3g.1T();1E.4K(2K.2w,6w)}1k{if(F.2R==r9.1gD){G 7b=1a 3U();7b.nU(2z.x,2z.y+2z.1o/2,2z.1l,2z.1o/2);G iU={2R:"no",x1:50,y1:49.5,x2:50,y2:101.5,gx:l8,gA:6J};7b.7A(iU);7b.9e(l8);7b.5c=3g.1T();1E.4K(2K.2w,7b);G 6w=1a 3U();6w.nU(2z.x,2z.y,2z.1l,2z.1o/3);G ei={2R:"no",x1:50,y1:33.5,x2:50,y2:0,gx:l8,gA:1gG};6w.7A(ei);6w.9e(l8);6w.5c=3g.1T();1E.4K(2K.2w,6w);G l=2z.x;G t=2z.y;G r=2z.2Z();G b=2z.y+2z.1o*40/100;G w=r-l;G h=b-t;G eq=1a 3U();eq.4M(l,t,r,t);eq.4M(r,t,r,b);eq.4M(r,t,r,b);eq.4M(r,b);eq.Wx(r-w/3,b-h/4,l+w/3,b-h/4,l,b);eq.4M(l,b,l,t);G Mi={2R:"ik",4N:D4};eq.7A(Mi);eq.9e(pP);eq.5c=3g.1T();1E.4K(2K.2w,eq)}1k{if(F.2R==r9.1gJ){G 7b=1a 3U();7b.Xl(50,100,100,0,6.Xg/2,1);G iU={2R:"GD",gx:Xh,gA:l8,y1:100,y2:100,1oG:50,1gI:100};7b.7A(iU);7b.9e(l8);7b.5c=3g.1T();1E.4K(2K.2w,7b);G 6w=1a 3U();6w.nU(2z.x,2z.y,2z.1l,2z.1o/4);G ei={2R:"no",x1:50,y1:0,x2:50,y2:25.5,gx:Og,gA:pP};6w.7A(ei);6w.9e(pP);6w.5c=3g.1T();1E.4K(2K.2w,6w);G eq=pL.1T();G Cg=1a 1I(1d.x,1d.y,1d.1l,1d.1o/4);G c=1a J.1B.l0();c.kk=Cg;G Mi={2R:"no",x1:50,y1:0,x2:50,y2:100,gx:8q,gA:pP};eq.7A("6W");eq.9e(Mi);G s=1-(((S.fi()||1)/S.1j.3w)/100);G BD=3g.1T();BD.NO(s,s,2z);eq.5c=BD.1T();1E.4K(c.2w,eq);1E.4K(2K.2w,c)}1k{if(F.2R==r9.1gH){G 7b=1a 3U();7b.nU(2z.x,2z.y,2z.1l,2z.1o/2);G iU={2R:"no",x1:50,y1:0,x2:50,y2:50.5,gx:Og,gA:D4};iU.9P=[];iU.9P.1f({1Z:0,4N:pP});iU.9P.1f({1Z:0.2,4N:D4});iU.9P.1f({1Z:0.4,4N:Og});7b.7A(iU);7b.9e(pP);7b.5c=3g.1T();1E.4K(2K.2w,7b);G 6w=1a 3U();6w.nU(2z.x,2z.y,2z.1l,2z.1o);G ei={2R:"no",gx:6J,gA:6J};ei.9P=[];ei.9P.1f({1Z:0,4N:Vr});ei.9P.1f({1Z:0.1o1,4N:Ox});ei.9P.1f({1Z:0.143,4N:l8});ei.9P.1f({1Z:0.4,4N:Ox});ei.9P.1f({1Z:0.1o0,4N:l8});ei.9P.1f({1Z:0.1nZ,4N:Ox});ei.9P.1f({1Z:1,4N:Vr});6w.7A(ei);6w.9e(pP);6w.5c=3g.1T();1E.4K(2K.2w,6w)}}}}1E.4K(2w,2K)}},gY:H(){I F.2R},1o4:H(N){F.2R=N},1o3:H(){I F.6J},1o2:H(N){F.6J=N},1nY:H(){I F.lH},1nU:H(N){F.lH=N},1nT:H(){I F.8q},1nS:H(N){F.8q=N}};J.2x(ny,"J.1e.ny");G nG=K.nG=H(){1n.2T(nG,F);F.go=0.4;F.ef="dM";F.ji="gp"};nG.1s={3D:H(1q){F.go=1q.go;F.ef=1q.ef;F.ji=1q.ji},3q:H(){G 1q={Bb:F.7i.ek,go:F.go,ef:F.ef,ji:F.ji};I 1q},5u:H(1v,O){O.5w(F.go,"1gy",1v);O.hn(F.ef,"1gx",1v);O.hn(F.ji,"1gw",1v)},5g:H(1v,O){F.go=O.5k("1gy",1v);F.ef=O.hy("1gx",1v);F.ji=O.hy("1gw",1v)},1T:H(){G 1K=1a F.7i();1K.go=F.go;1K.ef=F.ef;1K.ji=F.ji;I 1K},Ns:H(S){G 2z=1a 1I(0,0,100,100);G 1d=S.3a();G x=1d.1l/2z.1l;G y=1d.1o/2z.1o;G 3g=1a 9T();3g.a6(1d.x-1d.1l/2,1d.y-1d.1o/2);3g.3w(x,y);3g.a6(1d.1l/x-2z.x-2z.1l/2,1d.1o/y-2z.y-2z.1o/2);if(S.pR>0){3g.nP(S.pR,2z.x+2z.1l/2,2z.y+2z.1o/2)}if(S.3b!==0){3g.nP(S.3b,2z.x+2z.1l/2,2z.y+2z.1o/2)}I 3g},5j:H(S,2w,1D){G 2z=1a 1I(0,0,100,100);G 1d=S.3a();if(S.6k){G pL=S.6k.9W()}1k{G pL=1a 3U();pL.nU(2z.x,2z.y,2z.1l,2z.1o)}G 2K=1a J.1B.l0();G 3g=F.Ns(S);G 1gC=1D.1gz;G 1gB=1gC*3;G 1N=1D.1N;if(1D.nT==9M.Bk){if(5P(1D.1N)=="av"){1N={2R:"ik",4N:1M.uq(1D.1N)}}1k{if(1N.2R=="ik"){1N.4N=1M.uq(1N.4N)}}if(1N.2R=="no"||1N.2R=="GD"){1N.gx=1M.uq(1N.gx);1N.gA=1M.uq(1N.gA)}if(1N.2R=="ik"){1N.4N=1M.ds(1N.4N.cU,1N.4N.dT,1N.4N.bA,F.go)}1k{if(1N.2R=="no"||1N.2R=="GD"){1N.gx=1M.ds(1N.gx.cU,1N.gx.dT,1N.gx.bA,F.go);1N.gA=1M.ds(1N.gA.cU,1N.gA.dT,1N.gA.bA,F.go)}}1D.1N=1N;G 7b=pL.1T();7b.7A("6W");G ef=1M.uq(F.ef);G W0=3g.1T();W0.NO(1.W3,1.W3,2z);G t=15;1h(G i=10;i>=0;i-=2){6w=7b.1T();6w.rn="he";6w.9e(1M.ds(ef.cU,ef.dT,ef.bA,0.1));t-=3;6w.3p=t;6w.5c=W0.1T();1E.4K(2K.2w,6w)}1E.4K(2w,2K);I}G 7b=pL.1T();7b.7A("6W");7b.9e(F.ji);7b.3p=S.fi()+1gB;G BD=3g.1T();BD.NO(0.99,0.99,2z);7b.5c=BD.1T();1E.4K(2K.2w,7b);1E.4K(2w,2K)},1oh:H(){I F.go},1og:H(N){F.go=N},1of:H(){I F.ef},1ob:H(N){F.ef=N},1o7:H(){I F.ji},1o6:H(N){F.ji=N}};J.2x(nG,"J.1e.nG")})(J.1e);(H(K){G 1E=J.3X.1E;G tq=K.tq=H(1m){1n.2T(tq,F,[1m]);F.pj=[];F.5n="tq"};tq.1s={l6:H(){1E.1U(F.pj,H(6i){6i.l6()},F)},fR:H(){1h(G i=F.pj.T-1;i>=0;i--){F.pj[i].fR()}},fL:H(){1E.1U(F.pj,H(6i){6i.fL()},F)},1o5:H(){I F.pj}};J.2x(tq,"J.1e.tq",K.h9)})(J.1e);(H(K){G rC=K.rC=H(1m,1g){1n.2T(rC,F,[1m]);F.1g=1g;F.5n="rC"};rC.1s={l6:H(){F.1m.Gw(F.1g)},fR:H(){F.1m.GM(F.1g,1x)},fL:H(){F.1m.Gw(F.1g)}};J.2x(rC,"J.1e.rC",K.h9)})(J.1e);(H(K){G rk=K.rk=H(1m,1g){1n.2T(rk,F,[1m]);F.1g=1g;F.5n="rk"};rk.1s={l6:H(){F.1m.GM(F.1g)},fR:H(){F.1m.Gw(F.1g)},fL:H(){F.1m.GM(F.1g)}};J.2x(rk,"J.1e.rk",K.h9)})(J.1e);(H(K){G kE=K.kE=H(1m,1g){1n.2T(kE,F,[1m]);F.1G=1g.dQ();F.1g=1g};kE.1s={fR:H(){F.R2()},fL:H(){F.R2()},l6:H(){},R2:H(){G 1gA=F.1g.dQ();F.1g.ee(F.1G);F.1G=1gA}};J.2x(kE,"J.1e.kE",K.h9)})(J.1e);(H(K){G qM=K.qM=H(1m,2K){1n.2T(qM,F,[1m]);F.2K=2K;F.aS=F.2K.aS;F.5n="qM"};qM.1s={l6:H(){F.2K.AY(!F.2K.rW())},fR:H(){if(F.aS){F.2K.OA()}1k{F.2K.OE()}},fL:H(){if(!F.aS){F.2K.OA()}1k{F.2K.OE()}}};J.2x(qM,"J.1e.qM",K.h9)})(J.1e);(H(K){G oR=K.oR=H(1m,6z){1n.2T(oR,F,[1m]);F.6z=6z;F.1fn=6z.8g;F.5n="oR"};oR.1s={l6:H(){F.Fp=F.6z.8g},fR:H(){F.6z.AJ(F.1fn)},fL:H(){F.6z.AJ(F.Fp)}};J.2x(oR,"J.1e.oR",K.h9)})(J.1e);(H(K){G tN=K.tN=H(1m,6z,2r){1n.2T(tN,F,[1m]);F.6z=6z;F.2r=2r;F.bW=F.2r.1l;F.1ea=F.2r.ha;F.5n="tN"};tN.1s={l6:H(){F.nO=F.2r.1l;F.1e9=F.2r.ha},fR:H(){F.6z.AD(F.2r,F.bW);F.6z.Fy(F.2r,F.1ea)},fL:H(){F.6z.Fy(F.2r,F.1e9);F.6z.AD(F.2r,F.nO)}};J.2x(tN,"J.1e.tN",K.h9)})(J.1e);(H(K){G tP=K.tP=H(1m,6z,1J){1n.2T(tP,F,[1m]);F.6z=6z;F.1J=1J;F.e6=F.1J.1o;F.5n="tP"};tP.1s={l6:H(){F.nr=F.1J.1o},fR:H(){F.6z.AW(F.1J,F.e6)},fL:H(){F.6z.AW(F.1J,F.nr)}};J.2x(tP,"J.1e.tP",K.h9)})(J.1e);(H(K){G uQ=K.uQ=H(1m){F.1m=1m;F.sA=[];F.kz=-1;F.tX=1c;F.Mh=0};uQ.1s={f4:H(6i){6i.l6();if(F.tX==1c){F.Fz(6i)}1k{F.tX.pj.1f(6i)}},Fz:H(6i){if(F.kz<F.sA.T-1){F.sA.dg(F.kz+1,F.sA.T-F.kz-1)}F.sA.1f(6i);++F.kz;F.1m.F9()},B4:H(){if(F.tX==1c){F.tX=1a K.tq(F.1m)}F.Mh++;I F.tX},BB:H(Fz){F.Mh--;if(F.Mh==0){if(Fz!=1x){F.Fz(F.tX)}F.tX=1c}},fR:H(){if(F.LX()){G c=F.sA[F.kz];c.fR();--F.kz;F.1m.F9()}},fL:H(){if(F.MA()){++F.kz;G c=F.sA[F.kz];c.fL();F.1m.F9()}},LX:H(){I F.kz>=0},MA:H(){I F.kz<F.sA.T-1}};J.2x(uQ,"J.1e.uQ")})(J.1e);(H(K){G 1E=J.3X.1E;G c7=J.c7;G 6O=J.4j.6O;G 2h=J.1B.2h;G 1I=J.1B.1I;G 9x=J.3X.9x;G x5=K.x5=H(1m){F.1m=1m;cm=F.1m.Ay};x5.1s={8N:H(1i){F.Pm();G 1b=F.Qp(1i);1i.sF(1b,0,0,1x)},jI:H(1X){F.Pm();1h(G i=0;i<1X.T;i++){G 1i=1X[i];1i.P9=F.Qp(1i)}F.1ee(1X);1h(G i=0;i<1X.T;i++){G 1i=1X[i];1i.sF(1i.P9,0,0,1x);5M 1i.P9}},Qp:H(1i){cm=F.1m.Ay;G y7=1i.kM().8m();G 9q=1i.jt();G xO=1i.kD().8m();G FO=1i.fB();G un=y7.2N();G 1e8=xO.2N();G td=-[0,90,180,11z][1e2(un,1e8)];if(td!=0){y7=k0(y7,un,td);9q=K.1M.bO(9q,un,td);xO=k0(xO,un,td);FO=K.1M.bO(FO,un,td)}G Mn=12I(y7,9q)+12I(xO,FO);G 1b=1e3[Mn](y7,9q,xO,FO);if(td!=0){K.1M.k7(1b,un,-td)}G 2u=1e6(F.1m,1i,1b);if(2u.T>0){G xW=[];G 1eb=1en(2u);1h(G i=0;i<1b.T-1;++i){G P4=[];G p1=1b[i];G p2=1b[i+1];1E.1U(1eb,H(S){1E.h4(P4,1e7(p1,p2,S,i))});P4.8F(H(i1,i2){G d1=c7.5y(p1,i1);G d2=c7.5y(p1,i2);if(d1<d2){I-1}if(d1>d2){I 1}I 0});1E.h4(xW,P4)}G uS=[];1h(G i=0;i<xW.T;++i){G jo=xW[i];1h(G j=i+1;j<xW.T;++j){G aN=xW[j];if(aN.S==jo.S){uS.1f(jo);uS.1f(aN);i=j;2i}}}if(uS.T>0){G cK=[];G xS=-1;1h(G 8w=0;8w<uS.T-1;8w+=2){G jo=uS[8w];G qF=uS[8w+1];3v(xS!=jo.5v){cK.1f(1b[++xS])}1em(cK,jo.S,jo,qF);xS=qF.5v}3v(xS!=1b.T-1){cK.1f(1b[++xS])}1b=cK}1eo(1i,2u);1ep(1b,2u)}I 1b},1ed:H(1b){G 5t=[];1h(G i=0;i<1b.T-1;i++){G 5v={1y:i,1b:1b,5F:H(){I F.1b[F.1y].y==F.1b[F.1y+1].y},Zp:H(){G ii=F.1b[F.1y].x;G 56=F.1b[F.1y+1].x;I ii<56?[ii,56]:[56,ii]},Zj:H(){G ii=F.1b[F.1y].y;G 56=F.1b[F.1y+1].y;I ii<56?[ii,56]:[56,ii]}};5t.1f(5v)}I 5t},1ee:H(1X){1h(G i=0;i<1X.T;i++){G 1i=1X[i];1i.1ec=F.1ed(1i.P9)}F.118(1X,1t);F.118(1X,1x)},118:H(1X,5F){G 5t=[];1h(G i=0;i<1X.T;i++){G 1i=1X[i];G 2B=1i.1ec;1h(G j=0;j<2B.T;j++){G 5v=2B[j];if(5v.5F()==5F){5t.1f(5v)}}}5t.8F(5F?1eh:1eq);G v7=-(5O.7T-1);G eP=[];G 4x=5t.T;1h(G i=0;i<=4x;++i){G 5v=i<4x?5t[i]:1c;if(5v==1c||C8(5v,5F)!=v7){if(eP.T>1){G zP=1ei(eP,5F);1h(G g=0;g<zP.T;g++){G 4P=zP[g];if(4P.T<2){2V}G Gb=C8(4P[0],5F);4P.8F(5F?1ef:1eg);G 2H=Gb-cm/2;G 2n=Gb+cm/2;G mm=cm/8;G m=(2H+2n)/2;G d=1w.2H((2n-2H)/2,(4P.T-1)*3*mm);G fY=d/(4P.T-1);G 3I=Gb-d/2>=2H+fY?Gb-d/2:m-d/2;1h(G si=0;si<4P.T;si++){G s=4P[si];G 4R=3I-C8(s,5F);if(5F){s.1b[s.1y].y=3I;s.1b[s.1y+1].y=3I}1k{s.1b[s.1y].x=3I;s.1b[s.1y+1].x=3I}3I+=fY}}}eP.T=0}if(5v!=1c){v7=C8(5v,5F);if(5v.1y>0&&5v.1y<5v.1b.T-1){eP.1f(5v)}}}},Pm:H(){}};G cm=8;G 1e3={rl:H(or,op,dr,dp){G mx=m(r(or),l(dr));I[op,{x:mx,y:op.y},{x:mx,y:dp.y},dp]},rt:H(or,op,dr,dp){if(op.y<t(dr)-cm){I[op,{x:dp.x,y:op.y},dp]}G mx=m(r(or),l(dr));I[op,{x:mx,y:op.y},{x:mx,y:t(dr)-cm},{x:dp.x,y:t(dr)-cm},dp]},rb:H(or,op,dr,dp){if(op.y>b(dr)+cm){I[op,{x:dp.x,y:op.y},dp]}G mx=m(r(or),l(dr));I[op,{x:mx,y:op.y},{x:mx,y:b(dr)+cm},{x:dp.x,y:b(dr)+cm},dp]},rr:H(or,op,dr,dp){if(op.y<t(dr)-cm||op.y>b(dr)+cm){I[op,{x:r(dr)+cm,y:op.y},{x:r(dr)+cm,y:dp.y},dp]}G mx=m(r(or),l(dr));I[op,{x:mx,y:op.y},{x:mx,y:b(dr)+cm},{x:r(dr)+cm,y:b(dr)+cm},{x:r(dr)+cm,y:dp.y},dp]},bl:H(or,op,dr,dp){if(b(or)<dp.y-cm){I[op,{x:op.x,y:dp.y},dp]}G mx=m(r(or),l(dr));I[op,{x:op.x,y:b(or)+cm},{x:mx,y:b(or)+cm},{x:mx,y:dp.y},dp]},bt:H(or,op,dr,dp){if(b(or)<t(dr)-2*cm){G my=m(b(or),t(dr));I[op,{x:op.x,y:my},{x:dp.x,y:my},dp]}G mx=m(r(or),l(dr));I[op,{x:op.x,y:b(or)+cm},{x:mx,y:b(or)+cm},{x:mx,y:t(dr)-cm},{x:dp.x,y:t(dr)-cm},dp]},bb:H(or,op,dr,dp){G am=1w.2n(b(or),b(dr))+cm;I[op,{x:op.x,y:am},{x:dp.x,y:am},dp]},br:H(or,op,dr,dp){G my=b(or)<t(dr)-2*cm?m(b(or),t(dr)):1w.2n(b(or),b(dr))+cm;I[op,{x:op.x,y:my},{x:r(dr)+cm,y:my},{x:r(dr)+cm,y:dp.y},dp]},tl:H(or,op,dr,dp){if(dp.y<t(or)-cm){I[op,{x:op.x,y:dp.y},dp]}G mx=m(r(or),l(dr));I[op,{x:op.x,y:t(or)-cm},{x:mx,y:t(or)-cm},{x:mx,y:dp.y},dp]},tt:H(or,op,dr,dp){G 8Z=1w.2H(t(or),t(dr));I[op,{x:op.x,y:8Z-cm},{x:dp.x,y:8Z-cm},dp]},tb:H(or,op,dr,dp){if(t(or)>b(dr)+2*cm){G my=m(t(or),b(dr));I[op,{x:op.x,y:my},{x:dp.x,y:my},dp]}G mx=m(r(or),l(dr));I[op,{x:op.x,y:t(or)-cm},{x:mx,y:t(or)-cm},{x:mx,y:b(dr)+cm},{x:dp.x,y:b(dr)+cm},dp]},tr:H(or,op,dr,dp){G my=t(or)>b(dr)+2*cm?m(t(or),b(dr)):1w.2H(t(or),t(dr))-cm;I[op,{x:op.x,y:my},{x:r(dr)+cm,y:my},{x:r(dr)+cm,y:dp.y},dp]},ll:H(or,op,dr,dp){if(t(or)>dp.y+cm||b(or)<dp.y-cm){I[op,{x:l(or)-cm,y:op.y},{x:l(or)-cm,y:dp.y},dp]}G mx=m(r(or),l(dr));I[op,{x:l(or)-cm,y:op.y},{x:l(or)-cm,y:t(or)-cm},{x:mx,y:t(or)-cm},{x:mx,y:dp.y},dp]},lt:H(or,op,dr,dp){if(b(or)<t(dr)-2*cm){G my=m(b(or),t(dr));I[op,{x:l(or)-cm,y:op.y},{x:l(or)-cm,y:my},{x:dp.x,y:my},dp]}G 8Z=1w.2H(t(or),t(dr));I[op,{x:l(or)-cm,y:op.y},{x:l(or)-cm,y:8Z-cm},{x:dp.x,y:8Z-cm},dp]},lb:H(or,op,dr,dp){if(t(or)>b(dr)+2*cm){G my=m(t(or),b(dr));I[op,{x:l(or)-cm,y:op.y},{x:l(or)-cm,y:my},{x:dp.x,y:my},dp]}G am=1w.2n(b(or),b(dr));I[op,{x:l(or)-cm,y:op.y},{x:l(or)-cm,y:am+cm},{x:dp.x,y:am+cm},dp]},lr:H(or,op,dr,dp){G my=0;if(t(or)>b(dr)+2*cm){my=m(t(or),b(dr))}1k{if(b(or)<t(dr)-2*cm){my=m(b(or),t(dr))}1k{my=1w.2H(t(or),t(dr))-cm}}I[op,{x:l(or)-cm,y:op.y},{x:l(or)-cm,y:my},{x:r(dr)+cm,y:my},{x:r(dr)+cm,y:dp.y},dp]}};H 12I(1r,1p){G 8H=1r.z2();G Mm=[];G Mn=["t","r","b","l"];G bj="t";1h(G i=0;i<4;++i){G d=1a J.1B.1o8(1p,8H[i],8H[(i+1)%4]);Mm.1f(d.1ph())}G tY=5O.7T;1h(G i=0;i<4;++i){if(Mm[i]<tY){tY=Mm[i];bj=Mn[i]}}I bj}H 1e2(7p,1p){G x=1p.x-7p.x;G y=1p.y-7p.y;if(1w.4L(x)>1w.4L(y)&&x>=0){I 0}if(1w.4L(x)>1w.4L(y)&&x<0){I 2}if(y>0){I 1}I 3}H k0(1r,7p,4J){G 8H=1r.z2();K.1M.k7(8H,7p,4J);G l=1w.2H(8H[0].x,1w.2H(8H[1].x,8H[2].x));G t=1w.2H(8H[0].y,1w.2H(8H[1].y,8H[2].y));G r=1w.2n(8H[0].x,1w.2n(8H[1].x,8H[2].x));G b=1w.2n(8H[0].y,1w.2n(8H[1].y,8H[2].y));I 1I.gQ(l,t,r,b)}H ez(a1,a2,b1,b2){G 12h=a2.x-a1.x;G 1e1=a2.y-a1.y;G 12d=b2.x-b1.x;G 1e4=b2.y-b1.y;if(12h==0&&12d==0){I 1c}if(1e1==0&&1e4==0){I 1c}if(12d==0&&Yr(b1.x,a1.x,a2.x)&&Yq(a1.y,b1.y,b2.y)){I{x:b1.x,y:a1.y}}if(12h==0&&Yq(a1.x,b1.x,b2.x)&&Yr(b1.y,a1.y,a2.y)){I{x:a1.x,y:b1.y}}I 1c}H 1e7(p1,p2,S,5v){G 1r=S.pX;G oM=[];G 8H=1r.z2();1h(G i=0;i<4;++i){G aN=ez(p1,p2,8H[i],8H[(i+1)%4]);if(aN){aN.S=S;aN.5v=5v;aN.bj=i;oM.1f(aN);S.NQ++}}I oM}H Yq(v,v1,v2){G 2H=1w.2H(v1,v2);G 2n=1w.2n(v1,v2);I 2H<v&&v<2n}H Yr(v,v1,v2){G 2H=1w.2H(v1,v2);G 2n=1w.2n(v1,v2);I 2H<=v&&v<=2n}H 1e6(1m,1i,1b){G 2u=[];G 1e5=1I.1pe(1b);1m.2u.1U(H(S){if(S==1i.kM()||S==1i.kD()){I}if(!S.YU()){I}if(S.ut){if(S.ut(1i.kM())||S.ut(1i.kD())){I}}G cj=K.1M.7u(S.8m(),cm,cm);S.pX=cj;S.NQ=0;if(cj.hZ(1e5)){2u.1f(S)}});I 2u}H 1eo(1i,2u){G p8=[];p8.1f(1i.kM());if(1i.kM()!=1i.kD()){p8.1f(1i.kD())}1E.1U(p8,H(S){if(!S.YU()){I}G cj=K.1M.7u(S.8m(),cm,cm);S.pX=cj;S.NQ=0;2u.1f(S)})}H 1en(2u){if(2u.T==1){I 2u}G NM=[];G 2s=1a 6O;1E.1U(2u,H(S){S.NS=2s.qG(1c,S)});1h(G i=0;i<2u.T-1;++i){G 7X=2u[i];1h(G j=i+1;j<2u.T;++j){G 7W=2u[j];if(7X.pX.hZ(7W.pX.7u(-cm/4))){2s.qX(7X.NS,7W.NS)}}}G jN=2s.Ev();1E.1U(jN,H(3l){if(3l.2M.T==1){NM.1f(3l.2M[0].4a)}1k{G 8P=1c;3l.2M.1U(H(2S){8P=2S.4a.pX.8P(8P)});NM.1f({pX:8P,NQ:0})}});1E.1U(2u,H(S){5M S.NS});I NM}H 1em(1b,S,jo,qF){G 8H=S.pX.z2();G qx=[];qx.1f(jo);G bj=jo.bj;3v(bj!=qF.bj){bj=(bj+1)%4;qx.1f(8H[bj])}qx.1f(qF);G q9=[];q9.1f(jo);G bj=jo.bj;3v(bj!=qF.bj){q9.1f(8H[bj]);bj=bj-1;if(bj<0){bj=3}}q9.1f(qF);if(qx.T<q9.T){1E.h4(1b,qx)}1k{if(qx.T>q9.T){1E.h4(1b,q9)}1k{1E.h4(1b,XE(qx)<XE(q9)?qx:q9)}}}H XE(1b){G 8y=0;1h(G i=0;i<1b.T-1;++i){8y+=c7.5y(1b[i],1b[i+1])}I 8y}H l(1r){I 1r.x}H t(1r){I 1r.y}H r(1r){I 1r.x+1r.1l}H b(1r){I 1r.y+1r.1o}H m(v1,v2){I(v1+v2)/2}H 5F(5v,1b){I 1b[5v].y==1b[5v+1].y}H XM(5v,1b){G p1=1b[5v];G p2=1b[5v+1];if(p1.x==p2.x){I p2.y-p1.y}1k{I p2.x-p1.x}}H 10c(p1,p2,2u){1h(G n=0;n<2u.T;++n){G S=2u[n];G 1r=S.pX.7u(-cm/8);if(1r.3S(p1)&&1r.3S(p2)){I 1t}G 8H=1r.z2();1h(G i=0;i<4;++i){G aN=ez(p1,p2,8H[i],8H[(i+1)%4]);if(aN){I 1t}}}I 1x}H 1ep(1b,2u){1h(G i=1;i<1b.T-4;++i){G c=i;G n=i+1;G u=i+2;G Xo=XM(c,1b);G Y5=XM(u,1b);G Cr=5F(c,1b);G 1es=5F(n,1b);G 1er=5F(u,1b);if(Cr!=1es&&Cr==1er&&Xo*Y5<0){if(1w.4L(Xo)<1w.4L(Y5)){G x=Cr?{x:1b[c].x,y:1b[u].y}:{x:1b[u].x,y:1b[c].y};if(!10c(1b[c],x,2u)){1b.dg(c,3,x);i=1w.2n(1,i-2)}}1k{G x=Cr?{x:1b[u+1].x,y:1b[c].y}:{x:1b[c].x,y:1b[u+1].y};if(!10c(x,1b[u+1],2u)){1b.dg(n,3,x);i=1w.2n(1,i-2)}}}}}H 1eq(s1,s2){G p1=s1.1b[s1.1y];G p2=s2.1b[s2.1y];if(p1.x<p2.x){I-1}if(p1.x>p2.x){I 1}I 0}H 1eh(s1,s2){G p1=s1.1b[s1.1y];G p2=s2.1b[s2.1y];if(p1.y<p2.y){I-1}if(p1.y>p2.y){I 1}I 0}H 1eg(s1,s2){G p1=s1.1b[0];G p2=s2.1b[0];if(p1.x<p2.x){I-1}if(p1.x>p2.x){I 1}G q1=s1.1b[s1.1y];G q2=s2.1b[s2.1y];G r1=s1.1b[s1.1y+1];G r2=s2.1b[s2.1y+1];G D2=q1.y>r1.y;G CO=q2.y>r2.y;if(D2&&CO){if(q1.y<q2.y){I-1}if(q1.y>q2.y){I 1}}if(!D2&&!CO){if(q1.y<q2.y){I 1}if(q1.y>q2.y){I-1}}if(D2&&!CO){I-1}if(!D2&&CO){I 1}I 0}H 1ef(s1,s2){G p1=s1.1b[0];G p2=s2.1b[0];if(p1.y<p2.y){I-1}if(p1.y>p2.y){I 1}I 0}H C8(5v,5F){G 1p=5v.1b[5v.1y];I 5F?1p.y:1p.x}H 1ei(5t,5F){G 2s=1a J.4j.6O();G 2M=[];1h(G i=0;i<5t.T;i++){G 5v=5t[i];G 2S=2s.qG(1c,5v);2M.1f(2S)}1h(G i=0;i<5t.T-1;i++){1h(G j=i+1;j<5t.T;j++){G i1=5F?5t[i].Zp():5t[i].Zj();G i2=5F?5t[j].Zp():5t[j].Zj();if(1el(i1,i2)){2s.qX(2M[i],2M[j])}}}G jN=2s.Ev();G zP=[];1h(G i=0;i<jN.T;i++){G 3l=jN[i];G 4P=[];1h(G v=0;v<3l.2M.T;v++){G 2S=3l.2M[v];4P.1f(2S.4a)}zP.1f(4P)}I zP}H 1el(i1,i2){if(i1[0]>=i2[1]){I 1x}if(i2[0]>=i1[1]){I 1x}I 1t}J.2x(x5,"J.1e.x5")})(J.1e);(H(K){G 1E=J.3X.1E;G c7=J.c7;G 6O=J.4j.6O;G 2h=J.1B.2h;G 1I=J.1B.1I;G 1L=J.1B.1L;G 9x=J.3X.9x;G XD=J.3X.XD;G gl=J.3X.gl;G th=K.th=H(1m){1n.2T(th,F,[1m]);F.3V=1a gl();F.cG=4;F.Qo=12;F.113=4;F.Ie=2;F.DD=2;F.te=4};th.1s={Qp:H(1i){G t3=1i.jt();G t8=1i.fB();G 8N=F.1dI(F.DL(t3),F.DL(t8));if(8N){G l=8N.T-1;G 1ek=8N[0].y==8N[1].y;G 1ej=8N[l].y==8N[l-1].y;1h(G i=0;i<8N.T;i++){8N[i]=F.1dG(8N[i])}8N[0]=t3;if(1ek){8N[1].y=t3.y}1k{8N[1].x=t3.x}8N[l]=t8;if(1ej){8N[l-1].y=t8.y}1k{8N[l-1].x=t8.x}}I 8N},XI:H(tV){G m=[];m[0]=F.EY(tV,1,0);m[1]=F.EY(tV,0,1);m[2]=F.EY(tV,-1,0);m[3]=F.EY(tV,0,-1);G eb=5O.7T;G vY=1c;1h(G i=0;i<4;i++){if(eb>m[i].d){eb=m[i].d;vY=m[i]}}I 1a 1L(vY.x,vY.y)},EY:H(tV,dx,dy){G x=tV.x;G y=tV.y;G d=0;3v(F.3V.1V(x,y)==qb){x+=dx;y+=dy;d++}I{x:x,y:y,d:d}},1dI:H(2I,4D){G t3=2I.1T();G t8=4D.1T();2I=F.XI(2I);4D=F.XI(4D);G 3V=F.3V;G Yn=1a gl(3V.3W,3V.2P);G vO=1a gl(3V.3W,3V.2P);3V.2X(2I.x,2I.y,0);3V.2X(4D.x,4D.y,0);G lq=1a XD(1dJ);G gC=[];G 5f={x:2I.x,y:2I.y,2C:[],g:0,h:F.10V(2I,4D)};5f.f=5f.g+5f.h;lq.4K(5f);vO.2X(5f.x,5f.y,5f);G Pz=F.Ie;G te=F.te;G 9K=1c;G xo=1x;3v(1t){if(lq.bo()){2i}G w6=lq.1pw();vO.2X(w6.x,w6.y,1c);Yn.2X(w6.x,w6.y,w6);9K=w6;if(9K.x==4D.x&&9K.y==4D.y){xo=1t;2i}G x=9K.x;G y=9K.y;G 7m=[[1,0],[0,1],[-1,0],[0,-1]];1h(G i=0;i<4;i++){G tx=x+7m[i][0];G ty=y+7m[i][1];if(tx<0||ty<0||tx>=3V.3W||ty>=3V.3W){2V}G Yj=3V.1V(tx,ty)||0;if(Yj==qb){2V}G g=9K.g+Pz+Yj;G yp=9K.1j==1c||(9K.1j.y==9K.y&&7m[i][1]==0)||(9K.1j.x==9K.x&&7m[i][0]==0);if(!yp){g+=te}G 4g=vO.1V(tx,ty);if(4g!=1c){9K.2C.1f(4g);if(g<4g.g){4g.1j=9K;4g.g=g;4g.f=g+4g.h;lq.138(4g)}}1k{4g=Yn.1V(tx,ty);if(4g!=1c){9K.2C.1f(4g);if(g<4g.g){4g.1j=9K;4g.g=g;4g.f=g+4g.h;G cc=4g.2C.T;G 8j;1h(G j=0;j<cc;j++){8j=4g.2C[j];G gi=Pz;yp=4g.1j==1c||(4g.1j.y==4g.y&&4g.y==8j.y)||(4g.1j.x==4g.x&&4g.x==8j.x);if(!yp){gi+=te}if(g+gi<8j.g){G PP=vO.1V(8j.x,8j.y)!=1c;8j.g=g+gi;8j.f=8j.g+8j.h;8j.1j=4g;gC.1f(8j);if(PP){lq.138(8j)}}}G 1j;3v(gC.T>0){1j=gC.dq();cc=1j.2C.T;1h(G j=0;j<cc;j++){8j=1j.2C[j];G gi=Pz;yp=1j.1j==1c||(1j.1j.y==1j.y&&1j.y==8j.y)||(1j.1j.x==1j.x&&1j.x==8j.x);if(!yp){gi+=te}if(1j.g+gi<8j.g){G PP=vO.1V(8j.x,8j.y)!=1c;8j.g=1j.g+gi;8j.f=8j.g+8j.h;8j.1j=1j;gC.1f(8j);if(PP){lq.138(8j)}}}}}}1k{G 3G=1a 1L(tx,ty);G 5o={x:3G.x,y:3G.y,1j:9K,2C:[],g:g,h:F.10V(3G,4D)};5o.f=5o.g+5o.h;lq.4K(5o);vO.2X(5o.x,5o.y,5o);9K.2C.1f(5o)}}}}if(xo){G 3G=[];3G.1f(t8);if(!4D.dI(t8)){3G.1f(4D)}3v(9K!=1c){3G.1f(1a 1L(9K.x,9K.y));9K=9K.1j}if(!2I.dI(t3)){3G.1f(2I)}3G.1f(t3);3G.gH();G 4W,4Q,Pi;1h(G i=1;i<3G.T-1;){4W=3G[i-1];4Q=3G[i];Pi=3G[i+1];if(4W.x==4Q.x&&4Q.x==Pi.x){3G.dg(i,1)}1k{if(4W.y==4Q.y&&4Q.y==Pi.y){3G.dg(i,1)}1k{i++}}}I 3G}I 1c},10V:H(2I,4D){I 1L.5y(2I,4D)},eM:H(c,r){G eM=F.3V.1V(c,r);I eM||0},Pm:H(){G 1m=F.1m;G cG=F.cG;G 3V=F.3V;G 1r=1m.wA().8P(1m.3a());F.12z=1r.3R();F.12A=1r.3c();G 11u=1w.7J(1r.1l/cG);G 11q=1w.7J(1r.1o/cG);3V.xY();3V.q7(11u,11q);1h(G i=0;i<1m.2u.T;i++){G S=1m.2u[i];if(S.aX&&!1n.2D(K.3B,S)){G aF=S.8m();G Pd=aF.3R()-1r.3R();Pd=1w.7J(Pd/cG);G Qs=aF.3c()-1r.3c();Qs=1w.7J(Qs/cG);G Ql=aF.2Z()-1r.3R();Ql=1w.120(Ql/cG);G Qw=aF.3F()-1r.3c();Qw=1w.120(Qw/cG);1h(G c=Pd;c<=Ql;c++){1h(G r=Qs;r<=Qw;r++){3V.2X(c,r,qb)}}}}1h(G i=0;i<1m.2u.T;i++){G S=1m.2u[i];if(S.aX&&!1n.2D(K.3B,S)){if(F.DD==0){2V}G aF=S.8m();G 5H=F.DL(aF.5H());G bc=F.DL(aF.bc());G 1dH=1w.7J(F.Qo/F.cG);1h(G b=1;b<=1dH;++b){G eM=F.DD/b;G 12g=1w.2n(0,5H.x-b);G Q0=1w.2H(11u-1,bc.x+b);G 133=1w.2n(0,5H.y-b);G Q5=1w.2H(11q-1,bc.y+b);G r=5H.y-b;if(r>=0){1h(G c=12g;c<=Q0;++c){if(F.eM(c,r)<eM){F.3V.2X(c,r,eM)}}}r=bc.y+b;if(r<=Q5){1h(G c=12g;c<=Q0;++c){if(F.eM(c,r)<eM){F.3V.2X(c,r,eM)}}}G c=5H.x-b;if(c>=0){1h(r=133;r<=Q5;++r){if(F.eM(c,r)<eM){F.3V.2X(c,r,eM)}}}c=bc.x+b;if(c<=Q0){1h(r=133;r<=Q5;++r){if(F.eM(c,r)<eM){F.3V.2X(c,r,eM)}}}}}}},DL:H(1p){G x=1p.x-F.12z;x=1w.7J(x/F.cG);G y=1p.y-F.12A;y=1w.7J(y/F.cG);I 1a 1L(x,y)},1dG:H(1p){G x=1p.x*F.cG+F.cG/2;x=x+F.12z;G y=1p.y*F.cG+F.cG/2;y=y+F.12A;I 1a 1L(x,y)},1pv:H(N){F.cG=N},1pr:H(){I F.cG},1pn:H(N){F.Qo=N},1pm:H(){I F.Qo},1pl:H(N){F.113=N},1pq:H(){I F.113},1pp:H(N){F.Ie=N},1po:H(){I F.Ie},1oR:H(N){F.DD=N},1oQ:H(){I F.DD},1oP:H(N){F.te=N},1oU:H(){I F.te}};H 1dJ(7X,7W){if(7W==1c){I 1}if(7X==7W){I 0}if(7X.f>7W.f){I 1}if(7X.f<7W.f){I-1}if(7X.x>7W.x){I 1}if(7X.x<7W.x){I-1}if(7X.y>7W.y){I 1}if(7X.y<7W.y){I-1}I 0}J.2x(th,"J.1e.th",K.x5)})(J.1e);J.10O("J.1e.6R");J.1e.6R.hL={U8:0,oK:1};(H(3j){G aT=3j.aT=H(1j){1n.2T(aT,F);F.1j=1j;F.1A=1a 3j.2E();F.1P=""};aT.1s={1dM:H(2r,1J){F.2r=2r;F.1J=1J},xB:H(){I F},t4:H(){I F.8V()},nu:H(1p){I F.xm()},pN:H(8e,5W){I 1a J.1e.nD({2G:F,8e:8e,5W:5W,2r:F.2r,1J:F.1J})},yn:H(5W){F.aJ(5W)},vt:H(){I 1c},3D:H(1q){if(1q.1A){F.1A.3D(1q.1A)}F.1P=1q.1P},3q:H(){G 1q={1A:F.1A.3q(),1P:F.1P};I 1q},5u:H(1v,O){G 8o=O.3i("2E",1v);F.1A.5u(8o,O);O.c9(F.1P,"8n",1v);if(F.1A&&(F.1A.5x||F.1A.4U)){G 2m={};if(F.1A.5x){2m.5n=F.1A.5x}if(F.1A.4U){2m.1Y=F.1A.4U}O.qW(2m,"5T",1v)}if(F.1A&&(F.1A.4q!=1F||F.1A.4i!=1F)){G 7K={};if(F.1A.4q!==1F){7K.dh=F.1A.4q}if(F.1A.4i!=1F){7K.4i=F.1A.4i}O.X6(7K,"1dL",1v)}if(F.1A&&F.1A.3e!=1F){O.hn(F.1A.3e,"nq",1v)}},5g:H(1v,O){G 8o=O.4k("2E",1v);F.1A.5g(8o,O);F.1P=O.a7("8n",1v);G 2m=O.rZ("5T",1v);if(2m){if(2m.5n){F.1A.5x=2m.5n}if(2m.1Y){F.1A.4U=2m.1Y}}G 7K=O.vo("1dL",1v);if(7K){if(7K.dh){F.1A.4q=7K.dh}if(7K.4i){F.1A.4i=7K.4i}}G 4N=O.hy("nq",1v);if(4N){F.1A.3e=4N}},l5:H(){I F.1A},wk:H(N){if(!N){7r 1a 7M("p7 1A of a 2G uL be 1c.")}if(F.1A===N){I}F.1A=N;F.1j.3V.1S()},8V:H(){I F.1P},aJ:H(N){if(F.1P===N){I}F.1P=N;F.1j.3V.1S()},xm:H(){I F.yo},yk:H(N){F.yo=N}};J.2x(aT,"J.1e.6R.aT")})(J.1e.6R);(H(3j){G wL=3j.wL=H(3V,ca,fj,eC,gh){1n.2T(wL,F);F.3V=3V;G qs=F;G 5V=H(){qs.s6=1x;qs.3V.LE(3j.2q.qw,5V)};F.3V.7V(3j.2q.qw,5V);F.ca=ca;F.fj=fj;F.eC=eC;F.gh=gh;F.s6=1t};wL.1s={l5:H(){if(!F.s6){7r 1a 7M("nt xn or xi s5 1G of a 2G xj xk rD xH 3V\'s xD xM iZ.")}I 1a 3j.w5(F)},wk:H(N){if(!F.s6){7r 1a 7M("nt xn or xi s5 1G of a 2G xj xk rD xH 3V\'s xD xM iZ.")}1h(G c=F.ca;c<=F.fj;c++){1h(G r=F.eC;r<=F.gh;r++){F.3V.1V(c,r).wk(N)}}},8V:H(){if(!F.s6){7r 1a 7M("nt xn or xi s5 1G of a 2G xj xk rD xH 3V\'s xD xM iZ.")}I F.3V.1V(F.ca,F.fj).8V()},aJ:H(N){if(!s6){7r 1a 1oS("nt xn or xi s5 1G of a 2G xj xk rD xH 3V\'s xD xM iZ.")}1h(G c=F.ca;c<=F.fj;c++){1h(G r=F.eC;r<=F.gh;r++){F.3V.1V(c,r).aJ(N)}}},XN:H(){I F.ca},XR:H(){I F.fj},Yb:H(){I F.eC},Y9:H(){I F.gh}};J.2x(wL,"J.1e.6R.wL")})(J.1e.6R);(H(3j){G w5=3j.w5=H(nV,ca,fj,eC,gh){1n.2T(w5,F);F.nV=nV;F.3V=nV.3V;F.ca=nV.ca;F.fj=nV.fj;F.eC=nV.eC;F.gh=nV.gh};w5.1s={eT:H(h8){if(!F.nV.s6){7r 1a 7M("nt xn or xi s5 1G of a 2G xj xk rD xH 3V\'s xD xM iZ.")}I h8.5j(F.3V.1V(F.ca,F.eC).l5())},eS:H(nI,N){if(!F.nV.s6){7r 1a 7M("nt xn or xi s5 1G of a 2G xj xk rD xH 3V\'s xD xM iZ.")}1h(G c=F.ca;c<=F.fj;c++){1h(G r=F.eC;r<=F.gh;r++){nI.5j(F.3V.1V(c,r).l5(),[N])}}},J2:H(){I F.eT(3j.2E.1s.J2)},UA:H(N){F.eS(3j.2E.1s.UA,N)},IX:H(){I F.eT(3j.2E.1s.IX)},Uo:H(N){F.eS(3j.2E.1s.Uo,N)},IV:H(){I F.eT(3j.2E.1s.IV)},I6:H(N){F.eS(3j.2E.1s.I6,N)},Ia:H(){I F.eT(3j.2E.1s.Ia)},UL:H(N){F.eS(3j.2E.1s.UL,N)},Ib:H(){I F.eT(3j.2E.1s.Ib)},I8:H(N){F.eS(3j.2E.1s.I8,N)},HV:H(){I F.eT(3j.2E.1s.HV)},UQ:H(N){F.eS(3j.2E.1s.UQ,N)},HX:H(){I F.eT(3j.2E.1s.HX)},I1:H(N){F.eS(3j.2E.1s.I1,N)},Iq:H(){I F.eT(3j.2E.1s.Iq)},UK:H(N){F.eS(3j.2E.1s.UK,N)},Im:H(){I F.eT(3j.2E.1s.Im)},Ig:H(N){F.eS(3j.2E.1s.Ig,N)},lo:H(){I F.eT(3j.2E.1s.lo)},iW:H(N){F.eS(3j.2E.1s.iW,N)},wK:H(){I F.eT(3j.2E.1s.wK)},DI:H(N){F.eS(3j.2E.1s.DI,N)},wM:H(){I F.eT(3j.2E.1s.wM)},DJ:H(N){F.eS(3j.2E.1s.DJ,N)},ec:H(){I F.eT(3j.2E.1s.ec)},b7:H(N){F.eS(3j.2E.1s.b7,N)},ft:H(){I F.eT(3j.2E.1s.ft)},bq:H(N){F.eS(3j.2E.1s.bq,N)}};J.2x(w5,"J.1e.6R.w5")})(J.1e.6R);(H(3j){G vV=3j.vV=H(3V){1n.2T(vV,F);F.3V=3V;F.4e=[[]];F.8U=0;F.8A=0};vV.1s={3D:H(1q){F.4e=[];F.8U=1q.8U;F.8A=1q.8A;G 2r;1h(G i=0;i<1q.4e.T;i++){if(i%F.8U===0){if(2r){F.4e.1f(2r)}2r=[]}G 2G=1a 3j.aT(F);2G.3D(1q.4e[i]);2r.1f(2G)}if(1q.4e.T>0){F.4e.1f(2r)}},3q:H(){G 1q={4e:F.1dA(),8U:F.8U,8A:F.8A};I 1q},5u:H(1v,O){1v.2Q("1dK",F.8A);1v.2Q("1dB",F.8U);1h(G c=0,cl=F.8A;c<cl;c++){1h(G r=0,rl=F.8U;r<rl;r++){G zz=O.3i("aT",1v);zz.2Q("Hg",r);zz.2Q("zA",c);F.4e[c][r].5u(zz,O)}}},5g:H(1v,O){F.8A=7e(1v.4y("1dK"));F.8U=7e(1v.4y("1dB"));F.4e=[];1h(G i=0;i<F.8A;i++){F.4e.1f([])}G 6n=O.Wo("aT",1v);1h(G i=0;i<6n.T;i++){G 2G=1a 3j.aT(F);2G.5g(6n[i],O);G c=7e(6n[i].4y("zA"));G r=7e(6n[i].4y("Hg"));F.4e[c][r]=2G}},1dA:H(){G 2W=[];1h(G c=0,cl=F.8A;c<cl;c++){1h(G r=0,rl=F.8U;r<rl;r++){2W.1f(F.4e[c][r].3q())}}I 2W},1dZ:H(1y,4x){if(4x<=0){I}G 8U=F.hJ();1h(G c=0;c<4x;c++){G 2r=[];1h(G r=0;r<8U;r++){2r.1f(1a 3j.aT(F))}F.4e.dg(1y+c,0,2r)}F.8A+=4x},1f4:H(1y,4x){if(4x<=0){I}G 8A=F.ge();1h(G c=0;c<8A;c++){1h(G r=0;r<4x;r++){F.4e[c].dg(1y+r,0,1a 3j.aT(F))}}F.8U+=4x},1dP:H(1y,4x){if(4x<=0){I}F.4e.dg(1y,4x);F.8A-=4x},1f2:H(1y,4x){if(4x<=0){I}G 8A=F.ge();1h(G c=0;c<8A;c++){F.4e[c].dg(1y,4x)}F.8U-=4x},1V:H(2r,1J){I F.4e[2r][1J]},ge:H(){I F.8A},hJ:H(){I F.8U}};J.2x(vV,"J.1e.6R.vV")})(J.1e.6R);J.1e.6R.2q={qw:"qw"};(H(3j){G 1I=J.1B.1I;G 1L=J.1B.1L;G 3o=J.3X.3o;G gl=3j.gl=H(1j){1n.2T(gl,F);F.1j=1j;F.7D=1a 3j.nW(F,1x);F.6f=1a 3j.nW(F,1t);F.d7=0;F.d5=0;F.fd=10;F.tn="";F.pJ=1x;F.jy=1t;F.gW=1t;F.jd=1t;F.fa=[];F.fh=[];F.3s=1a 3j.vV(F);F.1A=1a 3j.2E();F.1A.I6(1);F.1A.I8(1);F.1A.I1(1);F.1A.Ig(1);F.1A.b7(J.1e.4w.7z);F.1A.bq(J.1e.4w.7z);F.zk=1n.zl()};gl.1s={3D:H(1q){F.7D.3D(1q.7D);F.6f.3D(1q.6f);F.d7=1q.d7;F.d5=1q.d5;F.fd=1q.fd;F.tn=1q.tn;F.gW=1q.gW;F.jd=1q.jd;F.fa=1q.fa;F.fh=1q.fh;if(1q.jy!=1F){F.jy=1q.jy}if(1q.1A){F.1A.3D(1q.1A)}F.3s.3D(1q.3s);F.3n(3j.2q.qw,J.nK.z9)},3q:H(){G 1q={7D:F.7D.3q(),6f:F.6f.3q(),d7:F.d7,d5:F.d5,fd:F.fd,tn:F.tn,gW:F.gW,jd:F.jd,fa:F.fa,fh:F.fh,jy:F.jy,1A:F.1A.3q(),3s:F.3s.3q()};I 1q},5u:H(1v,O){O.5w(F.d7,"1dz",1v);O.5w(F.d5,"1dC",1v);O.5w(F.fd,"1dF",1v);if(F.1A&&(F.1A.5x||F.1A.4U)){G 2m={};if(F.1A.5x){2m.5n=F.1A.5x}if(F.1A.4U){2m.1Y=F.1A.4U}O.qW(2m,"1dE",1v)}O.4o(F.gW,"1dD",1v);O.4o(F.jd,"1dW",1v);O.KQ(F.fa,"1dV","rB",1v);O.KQ(F.fh,"1dU","AT",1v);O.4o(F.jy,"1dX",1v);G A4=O.3i("10G",1v);F.7D.5u(A4,O);G A6=O.3i("Ef",1v);F.6f.5u(A6,O);G zJ=O.3i("10n",1v);F.3s.5u(zJ,O)},5g:H(1v,O){F.d7=O.5k("1dz",1v);F.d5=O.5k("1dC",1v);F.fd=O.5k("1dF",1v);G 2m=O.rZ("1dE",1v);if(2m){if(2m.5n){F.1A.5x=2m.5n}if(2m.1Y){F.1A.4U=2m.1Y}}F.gW=O.4v("1dD",1v);F.jd=O.4v("1dW",1v);F.fa=O.L7("1dV","rB",1v);F.fh=O.L7("1dU","AT",1v);F.jy=O.4v("1dX",1v);G A4=O.4k("10G",1v);F.7D.5g(A4,O);G A6=O.4k("Ef",1v);F.6f.5g(A6,O);G zJ=O.4k("10n",1v);F.3s.5g(zJ,O)},7V:H(6d,5V){1n.zT(F,6d,5V)},LE:H(6d,5V){1n.j0(F,6d,5V)},3n:H(6d,1W){G 5V=1n.oH(F,6d);if(5V){5V(F,1W)}},1f6:H(1C,1j,i){if(1C.4Y()){7r 1a 7M("nt 4K a 1C to iQ 1dO 1dN 1j 1C at a eD.")}if(!1j){1j=F.7D}if(!1j.ju()){7r 1a 7M("p7 Jm 1C is hS a 2r 1C.")}G 56=1j;3v(56){if(1C===56){7r 1a 7M("nt 4K a 1C to 1dQ or as a 1dT or 1dS 2c to yO of rD 2C.")}56=56.1j}1C.oU(1j);G 3k=1j.3y();if(!i){3k.1f(1C)}1k{3k.dg(i,0,1C)}F.1e0(1C);F.1S()},1e0:H(1C){G rT=F.io(1C);G Z6=1C.iD();if(1C.4Y().3y().T===1){if(1C.4Y()!==F.7D){Z6-=1}}F.3s.1dZ(rT,Z6);if(1C.4Y().3y().T===1){1C.EH(1w.2n(F.fd,1C.4Y().8v()))}1k{1C.EH(F.fd)}if(1C.8d()===0){1C.1o=20}F.3n(3j.2q.qw,J.nK.z9)},10h:H(1C){G 1j=1C.4Y();if(!1j){I}if(!1C.ju()){7r 1a 7M("p7 Jm 1C is hS a 2r 1C.")}G 3k=1j.3y();G 1y=3k.7g(1C);F.1dY(1C);1C.oU();3k.dg(1y,1);F.1S()},1dY:H(1C){G rT=F.io(1C);G yT=1C.iD();if(1C.4Y().3y().T===1){if(1C.4Y()!==F.7D){yT-=1}}if(1C.4Y().3y().T===1&&1C.4Y()!==F.7D){1C.4Y().fl(1C.8v())}1C.TK();1C.TN();F.3s.1dP(rT,yT);F.3n(3j.2q.qw,J.nK.z9)},1eW:H(1C,1j,i){if(1C.4Y()){7r 1a 7M("nt 4K a 1C to iQ 1dO 1dN 1j 1C at a eD.")}if(!1j){1j=F.6f}if(!1j.i3()){7r 1a 7M("p7 Jm 1C is hS a 1J 1C.")}G 56=1j;3v(56){if(1C===56){7r 1a 7M("nt 4K a 1C to 1dQ or as a 1dT or 1dS 2c to yO of rD 2C.")}56=56.1j}1C.oU(1j);G 3k=1j.3y();if(CC(i)||i<0||i>3k.T){3k.1f(1C)}1k{3k.dg(i,0,1C)}F.1dR(1C);F.1S()},1dR:H(1C){G rT=F.io(1C);G Zu=1C.iD();if(1C.4Y().3y().T===1){if(1C.4Y()!==F.6f){Zu-=1}}F.3s.1f4(rT,Zu);if(1C.4Y().3y().T===1){1C.HD(1w.2n(F.fd,1C.4Y().8d()))}1k{1C.HD(F.fd)}if(1C.8v()===0){1C.1l=20}F.3n(3j.2q.qw,J.nK.z9)},10i:H(1C){G 1j=1C.4Y();if(!1j){I}if(!1C.i3()){7r 1a 7M("p7 Jm 1C is hS a 1J 1C.")}G 3k=1j.3y();G 1y=3k.7g(1C);F.1f3(1C);1C.oU();3k.dg(1y,1);F.1S()},1f3:H(1C){G rT=F.io(1C);G z0=1C.iD();if(1C.4Y().3y().T===1){if(1C.4Y()!==F.6f){z0-=1}}if(1C.4Y().3y().T===1&&1C.4Y()!==F.6f){1C.4Y().fb(1C.8d())}1C.TK();1C.TN();F.3s.1f2(rT,z0);F.3n(3j.2q.qw,J.nK.z9)},1p6:H(dE){I F.JX(F.7D.3y(),dE)},1p5:H(dE){I F.JX(F.6f.3y(),dE)},JX:H(3C,dE){1h(G i=0;i<3C.T;i++){G 1C=3C[i];if(1C.UV()==dE){I 1C}G 2W=F.JX(1C.3y(),dE);if(2W){I 2W}}},io:H(1C){if(!1C.4Y()){I 0}I F.io(1C.4Y())+F.1f5(1C)},1f5:H(1C){G 1y=0;1h(G i=0,l=1C.4Y().3y().T;i<l;i++){G 2c=1C.4Y().3y()[i];if(2c===1C){2i}1y+=2c.iD()}I 1y},1oX:H(3x){I F.JV(F.6f.3y(),3x,0)},1oW:H(3x){I F.JV(F.7D.3y(),3x,0)},JV:H(3C,3x,g0){if(3x===g0){I 3C.T}if(3x<g0){I 0}G 4x=0;1h(G i=0;i<3C.T;i++){G 1C=3C[i];4x+=F.JV(1C.3y(),3x,g0+1)}I 4x},115:H(rQ){I F.tJ(F.6f.3y(),rQ)},12Q:H(rQ){I F.tJ(F.7D.3y(),rQ)},tJ:H(3C,rQ){if(3C.T===0){I 0}if(3C.T===1){if(3C[0]===rQ){I 0}}G ri=0;1h(G i=0;i<3C.T;i++){G 1C=3C[i];if(1C===rQ){2V}ri=1w.2n(ri,F.tJ(1C.3y(),rQ))}I ri+1},Yy:H(3C,jH,3x){if(jH.T<=3x){jH.1f(0)}G 6u=0;G fb=1x;if(3x<F.fh.T){G 1o=F.fh[3x];if(1o>0){fb=1t;6u=1o}}G i;if(!fb){6u=jH[3x];1h(i=0;i<3C.T;i++){G 1C=3C[i];if(6u<1C.8d()){6u=1C.8d()}}}1h(i=0;i<3C.T;i++){F.Yy(3C[i].3y(),jH,3x+1)}jH[3x]=6u},1fb:H(1C,1o){G tF=[];F.10E(F.7D.3y(),1C,1o,tF,0);G gG=0;1h(G i=0;i<tF.T;i++){gG+=tF[i]}I gG},10E:H(3C,zh,ke,jH,3x){if(jH.T<=3x){jH.1f(0)}G 6u=0;G fb=1x;G 1o;if(3x<F.fh.T){1o=F.fh[3x];if(1o>0){fb=1t;6u=1o}}G i;if(!fb){6u=jH[3x];1h(i=0;i<3C.T;i++){G 1C=3C[i];1o=1C.8d();if(1C===zh){1o=ke}if(6u<1o){6u=1o}}}1h(i=0;i<3C.T;i++){F.10E(3C[i].3y(),zh,ke,jH,3x+1)}jH[3x]=6u},Yz:H(3C,fT,3x){if(fT.T<=3x){fT.1f(0)}G 4F=0;G fl=1x;if(3x<F.fa.T){G 1l=F.fa[3x];if(1l>0){fl=1t;4F=1l}}G i;if(!fl){4F=fT[3x];1h(i=0;i<3C.T;i++){G 1C=3C[i];if(4F<1C.8v()){4F=1C.8v()}}}1h(i=0;i<3C.T;i++){F.Yz(3C[i].3y(),fT,3x+1)}fT[3x]=4F},1fa:H(1C,1l){G tI=[];F.104(F.6f.3y(),1C,1l,tI,0);G hR=0;1h(G i=0;i<tI.T;i++){hR+=tI[i]}I hR},104:H(3C,zh,km,fT,3x){if(fT.T<=3x){fT.1f(0)}G 4F=0;G fl=1x;G 1l;if(3x<F.fa.T){1l=F.fa[3x];if(1l>0){fl=1t;4F=1l}}G i;if(!fl){4F=fT[3x];1h(i=0;i<3C.T;i++){G 1C=3C[i];1l=1C.8v();if(1C===zh){1l=km}if(4F<1l){4F=1l}}}1h(i=0;i<3C.T;i++){F.104(3C[i].3y(),zh,km,fT,3x+1)}fT[3x]=4F},tJ:H(3C){if(3C.T===0){I 0}G LD=0;1h(G i=0;i<3C.T;i++){LD=1w.2n(LD,F.tJ(3C[i].3y()))}I LD+1},12P:H(3x,3C,g0){if(!3C){if(3x<F.fh.T){G 1o=F.fh[3x];if(1o>0){I 1o}}3C=F.7D.3y()}if(!g0){g0=0}G 6u=0;G i;if(3x===g0){1h(i=0;i<3C.T;i++){G 1C=3C[i];if(6u<1C.8d()){6u=1C.8d()}}I 6u}1h(i=0;i<3C.T;i++){6u=1w.2n(6u,F.12P(3x,3C[i].3y(),g0+1))}I 6u},10U:H(3x,3C,g0){if(!3C){if(3x<F.fa.T){G 1l=F.fa[3x];if(1l>0){I 1l}}3C=F.6f.3y()}if(!g0){g0=0}G 4F=0;G i;if(3x===g0){1h(i=0;i<3C.T;i++){G 1C=3C[i];if(4F<1C.8v()){4F=1C.8v()}}I 4F}1h(i=0;i<3C.T;i++){4F=1w.2n(4F,F.10U(3x,3C[i].3y(),g0+1))}I 4F},1f8:H(1C,1d,d0){if(1C===d0.1C){d0.1d=1d}1k{if(d0.KZ){if(1C.WQ(d0.1C)){d0.1d=1d.8P(d0.1d)}}}},IS:H(1C){if(1C.3y().T===0){I}G Ct=1C.3y()[1C.3y().T-1];if(Ct.3y().T===0){if(1C.ju()){F.10h(Ct)}1k{F.10i(Ct)}F.109(1C);I}F.IS(Ct)},109:H(1C){if(1C.3y().T>0){I}G 1j=1C.4Y();if(!1j){I}if(1C.i3()){F.10i(1C)}1k{F.10h(1C)}F.109(1j)},XW:H(1C,KZ){G 4e={1C:1C,KZ:KZ};G qs=F;G ab=H(1C,1d,4e){qs.1f8(1C,1d,4e)};G x=0;G y=0;if(F.gW&&F.1j.gR&&F.1j.gD){x=F.1j.gR();y=F.1j.gD()}F.I0(ab,x,y,4e);F.IU(ab,x,y,4e);I 4e.1d},1p0:H(){I F.XW(F.7D,1t)},1oZ:H(){I F.XW(F.6f,1t)},1oY:H(2G){G ca=-1;G fj=-1;G eC=-1;G gh=-1;if(2G.XN&&2G.XR&&2G.Yb&&2G.Y9){ca=2G.XN();fj=2G.XR();eC=2G.Yb();gh=2G.Y9()}1k{1h(G c=0,cl=F.3s.ge();c<cl;c++){1h(G r=0,rl=F.3s.hJ();r<rl;r++){if(F.3s.1V(c,r)==2G){ca=c;fj=c;eC=r;gh=r;2i}}if(ca!==-1){2i}}}if(ca!==-1){G x=F.d7+F.nL();G y=F.d5+F.nJ();G 1l=0;G 1o=0;G i;G j;1h(i=0;i<ca;i++){x+=F.9z(i).8v()}1h(j=0;j<eC;j++){y+=F.8i(j).8d()}1h(i=ca;i<=fj;i++){1l+=F.9z(i).8v()}1h(j=eC;j<=gh;j++){1o+=F.8i(j).8d()}I 1a 1I(x,y,1l,1o)}I 1I.bo},1nR:H(){I F.7D.3y()},1mK:H(){I F.6f.3y()},ge:H(){G 4x=0;G 3C=F.7D.3y();1h(G i=0,l=3C.T;i<l;i++){G 1C=3C[i];4x+=1C.iD()}I 4x},1f7:H(N){if(N<0){I}G 8A=F.ge();if(N===8A){I}if(N>8A){1h(G i=0;i<N-8A;i++){F.1f6(1a 3j.cL(),F.7D)}}if(N<8A){G yT=8A-N;3v(yT>0){F.IS(F.7D);yT--}}},hJ:H(){G 4x=0;G 3C=F.6f.3y();1h(G i=0,l=3C.T;i<l;i++){G 1C=3C[i];4x+=1C.iD()}I 4x},1eX:H(N){if(N<0){I}G 8U=F.hJ();if(N==8U){I}if(N>8U){1h(G i=0;i<N-8U;i++){F.1eW(1a 3j.cL(),F.6f)}}if(N<8U){G z0=8U-N;3v(z0>0){F.IS(F.6f);z0--}}},1V:H(2r,1J){if(!CC(2r)&&!CC(1J)){I F.3s.1V(2r,1J)}if(1J&&1J.3y&&1J.3y().T===0&&2r&&2r.3y&&2r.3y().T===0){G qQ=F.io(2r);G dv=F.io(1J);I F.3s.1V(qQ,dv)}1k{if(!2r||!2r.3y){2r=F.7D}if(!1J||!1J.3y){1J=F.6f}G XK=F.io(2r);G 1eV=XK+2r.iD()-1;G XC=F.io(1J);G 1eY=XC+1J.iD()-1;I 1a 3j.wL(F,XK,1eV,XC,1eY)}},1mH:H(){I F.d7},1mD:H(N){if(F.d7===N){I}F.d7=N;F.1S()},1mC:H(){I F.d5},1mB:H(N){if(F.d5===N){I}F.d5=N;F.1S()},1eI:H(){I F.fd},1mG:H(N){if(N<=0){I}if(F.fd===N){I}F.fd=N;1h(G i=0,l=F.7D.3y().T;i<l;i++){G 1C=F.7D.3y()[i];1C.EH(F.fd)}},nJ:H(){G tF=[];F.Yy(F.7D.3y(),tF,0);G gG=0;1h(G i=0;i<tF.T;i++){gG+=tF[i]}I gG},nL:H(){G tI=[];F.Yz(F.6f.3y(),tI,0);G hR=0;1h(G i=0;i<tI.T;i++){hR+=tI[i]}I hR},12Q:H(){I F.tJ(F.7D.3y())},115:H(){I F.tJ(F.6f.3y())},1mF:H(){I F.nM},1mE:H(N){if(F.nM===N){I}F.nM=N;F.1S()},1fi:H(){I F.tn},1mW:H(N){if(F.tn===N){I}F.tn=N;F.1S()},1mV:H(){I F.gW},1n0:H(N){if(F.gW===N){I}F.gW=N;F.1S()},1mZ:H(){I F.jd},1mY:H(N){if(F.jd===N){I}F.jd=N;F.1S()},1mU:H(){I F.fa},1mQ:H(N){if(!N){7r 1a 7M("p7 1J fT kL uL be 1c.")}F.fa=N;F.1S()},1mP:H(){I F.fh},1mO:H(N){if(!N){7r 1a 7M("p7 1J fT kL uL be 1c.")}F.fh=N;F.1S()},IU:H(ab,Fd,Fm,d0){G ug=F.nJ();G uk=F.nL();G 1f1=F.12Q();G y=F.d5;G 3G=[];G Fk=1a 3o();G 1C;1h(G i=0,l=F.7D.3y().T;i<l;i++){1C=F.7D.3y()[i];3G.1f(1C);Fk.2X(1C,y)}G 3x=0;3v(3G.T>0){G x=F.d7+uk;G KV=F.12P(3x);G 56=[];G L4=1a 3o();1h(G i=0;i<3G.T;i++){G 1C=3G[i];if(1C.3y().T===0){if(3x!==1f1-1){56.1f(1C);L4.2X(1C,Fk.1V(1C));x+=1C.8v();2V}}G dx=x;G dy=Fk.1V(1C);G 1d=1a J.1B.1I(dx,dy,1C.8v(),y+KV-dy);1d.y+=Fm;ab(1C,1d,d0);x+=1C.8v();1h(G j=0,jl=1C.3y().T;j<jl;j++){G 2c=1C.3y()[j];56.1f(2c);L4.2X(2c,y+KV)}}y+=KV;3x++;3G=56;Fk=L4}},I0:H(ab,Fd,Fm,d0){G ug=F.nJ();G uk=F.nL();G 1f0=F.115();G x=F.d7;G 3G=[];G Go=1a 3o();G 1C;1h(G i=0,l=F.6f.3y().T;i<l;i++){G 1C=F.6f.3y()[i];3G.1f(1C);Go.2X(1C,x)}G 3x=0;3v(3G.T>0){G y=F.d5+ug;G HH=F.10U(3x);G 56=[];G H9=1a 3o();1h(G i=0;i<3G.T;i++){G 1C=3G[i];if(1C.3y().T===0){if(3x!==1f0-1){56.1f(1C);H9.2X(1C,Go.1V(1C));y+=1C.8d();2V}}G dx=Go.1V(1C);G dy=y;G 1d=1a J.1B.1I(dx,dy,x+HH-dx,1C.8d());1d.x+=Fd;ab(1C,1d,d0);y+=1C.8d();1h(G j=0,jl=1C.3y().T;j<jl;j++){G 2c=1C.3y()[j];56.1f(2c);H9.2X(2c,x+HH)}}x+=HH;3x++;3G=56;Go=H9}},1mS:H(O){F.1fl(O);if(!F.jd){F.11e(O)}},1mR:H(O){if(F.jd){F.11e(O)}},11e:H(O){G 4e={O:O};G qs=F;G ab=H(1C,1d,4e){qs.1fm(1C,1d,4e)};G x=0;G y=0;if(F.gW&&F.1j.gR&&F.1j.gD){x=F.1j.gR();y=F.1j.gD()}F.IU(ab,x,y,4e);F.I0(ab,x,y,4e);if(F.3s.ge()>0&&F.3s.hJ()>0){F.1eZ(O,x,y)}},1eZ:H(O,x,y){G ug=F.nJ();G uk=F.nL();G 1d=1a J.1B.1I(F.d7+x,F.d5+y,uk,ug);if(F.nM){F.Io(O,1d,F.nM)}G 5x=F.B1(F.nM);G 4U=F.uI(F.nM);G 3e=F.gu(F.nM);G 4q=F.Lo(F.nM);G 4i=F.Kw(F.nM);F.Aa(O,F.1fi(),5x,4U,4q,4i,3e,1d,1x)},Io:H(O,1d,1A){G qf=J.1e.1M.bs(O,F.1f9(1A),1d);if(qf){O.bE=qf;O.nv(1d.x,1d.y,1d.1l,1d.1o)}G ks=F.1fc(1A);G lf=F.1ff(1A);if(ks&&lf){O.ed();O.6B(1d.3R(),1d.3c());O.4M(1d.3R(),1d.3F());O.8f=ks;O.aQ=lf/O.bn;O.3E()}G lC=F.1fe(1A);G q5=F.1fd(1A);if(lC&&q5){O.ed();O.6B(1d.3R(),1d.3c());O.4M(1d.2Z(),1d.3c());O.8f=lC;O.aQ=q5/O.bn;O.3E()}G l7=F.1eC(1A);G iC=F.1eB(1A);if(l7&&iC){O.ed();O.6B(1d.2Z(),1d.3c());O.4M(1d.2Z(),1d.3F());O.8f=l7;O.aQ=iC/O.bn;O.3E()}G kA=F.1eA(1A);G lg=F.1eD(1A);if(kA&&lg){O.ed();O.6B(1d.3R(),1d.3F());O.4M(1d.2Z(),1d.3F());O.8f=kA;O.aQ=lg/O.bn;O.3E()}},Aa:H(O,1P,5x,4U,4q,4i,4N,1d,kS){if(!1P){I}O.cM();O.1r(1d.x,1d.y,1d.1l,1d.1o);O.kk();G 7m=0;if(kS){if(1d.1l<1d.1o){7m=1w.2n(1d.1l,1d.1o)/2}1k{7m=1w.2H(1d.1l,1d.1o)/2}O.a6(1d.x+7m,1d.y+7m);O.kS(3*1w.PI/2);O.a6(-1d.x-7m,-1d.y-7m)}O.bE=4N;O.1fh="3c";O.2m=4U+"px "+5x;G Gm=1d.1l;G ua=1d.1o;if(kS){Gm=1d.1o;ua=1d.1l}G xR=4U;G f3=F.1fj(O,1P,Gm);if(f3){G x=1d.x;G y=1d.y;O.IK="3R";if(4q==J.1e.4w.7z){if(kS){x=1d.x+7m}1k{x=1d.x+1d.1l/2}O.IK="2N"}if(4q==J.1e.4w.gE){if(kS){x=1d.x+2*7m}1k{x=1d.x+1d.1l}O.IK="2Z"}G gG=f3.T*xR;if(gG<ua){if(4i==J.1e.4w.7z){y+=(ua-gG)/2}if(4i==J.1e.4w.gE){y+=ua-gG}}1h(G i=0;i<f3.T;i++){G 8z=f3[i];O.1fg(8z,x,y);y+=xR}}O.cH()},1fj:H(O,1P,4F){G f3=1P.cF("\\n");if(4F==5O.7T){I f3}G HW=[];1h(G i=0;i<f3.T;i++){G I4=f3[i].cF(" ");G sZ="";1h(G i=0;i<I4.T;i++){G FX=I4[i];m=O.11W(sZ+FX).1l;if(m<4F){if(i===0){sZ+=FX}1k{sZ+=" "+FX}}1k{if(sZ!=""){HW.1f(sZ)}sZ=FX}if(i===I4.T-1){HW.1f(sZ);2i}}}I HW},1fm:H(1C,1d,d0){G 1ml=d0;G O=d0.O;F.Io(O,1d,1C.l5());G xT=1C.l5();G 5x=F.B1(xT);G 4U=F.uI(xT);G 3e=F.gu(xT);G 4q=F.Lo(xT);G 4i=F.Kw(xT);F.Aa(O,1C.UV(),5x,4U,4q,4i,3e,1d,1C.1eJ())},1fl:H(O){G ug=F.nJ();G uk=F.nL();G x=F.d7+uk;1h(G c=0;c<F.ge();c++){G 2r=F.9z(c);G 1fk=2r.8v();G y=F.d5+ug;1h(G r=0;r<F.hJ();r++){G 1J=F.8i(r);G fW=1J.8d();G 2G=F.3s.1V(c,r);G 1d=1a J.1B.1I(x,y,1fk,fW);y+=1J.8d();G u5=2G.l5();F.Io(O,1d,u5);G 1P=2G.8V();if(1P){G 5x=F.B1(u5);G 4U=F.uI(u5);G 3e=F.gu(u5);G 4q=F.Lo(u5);G 4i=F.Kw(u5);F.Aa(O,2G.8V(),5x,4U,4q,4i,3e,1d,1x)}}x+=2r.8v()}},G3:H(3C,QZ){1h(G i=0;i<3C.T;i++){if(3C[i].3k.T==0){QZ.1f(3C[i]);2V}F.G3(3C[i].3k,QZ)}},wq:H(1C,BP){G R6=F.nJ();G Rw=F.1fb(1C,BP);G t7=[];F.G3(F.6f.3k,t7);G sg=[];F.G3(F.7D.3k,sg);if(Rw!=R6){G 4R=R6-Rw;G 8A=F.ge();G 8U=F.hJ();G x=F.d7+F.nL();1h(G c=0;c<8A;c++){G y=F.d5+F.nJ();1h(G r=0;r<8U;r++){G 2G=F.3s.1V(c,r);G 1d=1a 1I(x,y,sg[c].1l,t7[r].1o);G t5=1d;t5.y-=4R;y+=t7[r].1o}x+=sg[c].1l}}},Az:H(1C,BP){G Tb=F.nL();G SX=F.1fa(1C,BP);G t7=[];F.G3(F.6f.3k,t7);G sg=[];F.1mc(F.7D.3k,sg);if(SX!=Tb){G 4R=Tb-SX;G 8A=F.ge();G 8U=F.hJ();G x=F.d7+F.nL();1h(G c=0;c<8A;c++){G y=F.d5+nJ();1h(G r=0;r<8U;r++){G 2G=F.3s.1V(c,r);G 1d=1a 1I(x,y,sg[c].1l,t7[r].1o);G t5=1d;t5.x-=4R;y+=t7[r].1o}x+=sg[c].1l}}},e8:H(4g){if(F.1j){G sm=F.1j.1A;if(sm&&4g.5j(sm)){I sm}G 4H=F.1j.4H;if(4H){G qm=F.cD(4g,4H);if(qm){I qm}}}I F.cD(4g,J.1e.f8.f2)},cD:H(4g,4H){G eh=4H.5I["4O:4n"];if(eh){if(4g.5j(eh)){I eh}}I 1c},fc:H(1A,h8,H1){G N;if(1A){N=h8.5j(1A);if(N!==1F){I N}}if(F.1A){N=h8.5j(F.1A);if(N!==1F){I N}}if(H1){G S7=F.e8(H1);if(S7){I H1.5j(S7)}}},1f9:H(1A){G N=F.fc(1A,3j.2E.1s.J2,J.1e.2E.1s.bs);if(N!==1F){I N}I"gp"},1fc:H(1A){G N=F.fc(1A,3j.2E.1s.IX,J.1e.2E.1s.uE);if(N!==1F){I N}I"dM"},1ff:H(1A){G N=F.fc(1A,3j.2E.1s.IV,J.1e.2E.1s.uM);if(N!==1F){I N}I 0},1fe:H(1A){G N=F.fc(1A,3j.2E.1s.Ia,J.1e.2E.1s.uE);if(N!==1F){I N}I"dM"},1fd:H(1A){G N=F.fc(1A,3j.2E.1s.Ib,J.1e.2E.1s.uM);if(N!==1F){I N}I 0},1eC:H(1A){G N=F.fc(1A,3j.2E.1s.HV,J.1e.2E.1s.uE);if(N!==1F){I N}I"dM"},1eB:H(1A){G N=F.fc(1A,3j.2E.1s.HX,J.1e.2E.1s.uM);if(N!==1F){I N}I 0},1eA:H(1A){G N=F.fc(1A,3j.2E.1s.Iq,J.1e.2E.1s.uE);if(N!==1F){I N}I"dM"},1eD:H(1A){G N=F.fc(1A,3j.2E.1s.Im,J.1e.2E.1s.uM);if(N!==1F){I N}I 0},B1:H(1A){G N=F.fc(1A,3j.2E.1s.wK,J.1e.2E.1s.wK);if(N!==1F){I N}I"GE-Gy"},uI:H(1A){G N=F.fc(1A,3j.2E.1s.wM,J.1e.2E.1s.wM);if(N!==1F){I N}I 4},gu:H(1A){G N=F.fc(1A,3j.2E.1s.lo,J.1e.2E.1s.lo);if(N!==1F){I N}I"dM"},Lo:H(1A){G N=F.fc(1A,3j.2E.1s.ec);if(N!==1F){I N}I J.1e.4w.7z},Kw:H(1A){G N=F.fc(1A,3j.2E.1s.ft);if(N!==1F){I N}I J.1e.4w.7z},9z:H(1y){I F.Cu(F.7D.3y(),1y)},8i:H(1y){I F.Cu(F.6f.3y(),1y)},1eE:H(1C,1d,d0){if(1d.3S(d0.1eF)){d0.1ev=1C;d0.9h=1d}},1eG:H(1p,9h,BS){if(!BS){BS=1a 1L(0,0)}G 4e={1eF:1p};G qs=F;G ab=H(1C,1d,4e){qs.1eE(1C,1d,4e)};G x=0;G y=0;if(F.gW&&BS){x=BS.x;y=BS.y}F.IU(ab,x,y,4e);F.I0(ab,x,y,4e);if(9h){9h.9h=4e.9h}I 4e.1ev},1eu:H(1p,jc){G x=1p.x-F.nL()-F.d7;G y=1p.y-F.nJ()-F.d5;G 1l=0;G 1o=0;if(x<0||y<0){I}G 2r=-1;G 1J=-1;1h(G c=0,cl=F.3s.ge();c<cl;c++){1l=F.9z(c).8v();x-=1l;if(x<0){2r=c;2i}}1h(G r=0;r<F.3s.hJ();r++){1o=F.8i(r).8d();y-=1o;if(y<0){1J=r;2i}}if(2r>=0&&1J>=0){if(jc){jc.jc=1a J.1B.1I(1p.x-x-1l,1p.y-y-1o,1l,1o);jc.2r=2r;jc.1J=1J}I F.3s.1V(2r,1J)}I 1c},1nA:H(2G){1h(G c=0,cl=F.ge();c<cl;c++){1h(G r=0,rl=F.hJ();r<rl;r++){if(F.3s.1V(c,r)===2G){I c}}}I-1},1nz:H(2G){1h(G c=0,cl=F.ge();c<cl;c++){1h(G r=0,rl=F.hJ();r<rl;r++){if(F.3s.1V(c,r)===2G){I r}}}I-1},1nu:H(2r){if(2r.3y().T>0){I-1}if(2r.i3()){I-1}I F.io(2r)},1nK:H(1J){if(1J.3y().T>0){I-1}if(1J.ju()){I-1}I F.io(1J)},Cu:H(3C,1y){G 3G=0;1h(G i=0;i<3C.T;i++){G 1C=3C[i];G 9y=3G;G to=9y+1C.iD()-1;if(1C.3y().T===0){if(9y<=1y&&1y<=to){I 1C}}if(9y<=1y&&1y<=to){I F.Cu(1C.3y(),1y-3G)}3G=to+1}I 1c},1S:H(nA){if(F.1j){F.1j.1S();if(nA===1F){nA=1t}if(nA&&F.1j.4z){F.1j.4z(1t)}}},l5:H(){I F.1A},VC:H(){I F.pJ},VN:H(N){F.pJ=N},1n8:H(){I F.jy},1nd:H(N){F.jy=N}};J.2x(gl,"J.1e.6R.gl")})(J.1e.6R);(H(3j){G cL=3j.cL=H(){1n.2T(cL,F);F.3k=[];F.1l=0;F.1o=0;F.oj=J.1e.6R.hL.oK;F.dE="";F.nw=1x;F.vJ="#7f";F.1A=1a 3j.2E()};cL.1s={3D:H(1q){F.3k=[];1h(G i=0;i<1q.3k.T;i++){G 1C=1a 3j.cL();1C.3D(1q.3k[i]);1C.1j=F;F.3k.1f(1C)}F.1l=1q.1l||0;F.1o=1q.1o||0;F.oj=1q.oj||J.1e.6R.hL.oK;F.dE=1q.dE||"";F.nw=1q.nw||1x;F.vJ=1q.vJ||"#7f";if(1q.1A){F.1A.3D(1q.1A)}if(F.8d()===0){F.1o=20}},3q:H(){G 1q={3k:F.1eR(),1l:F.1l,1o:F.1o,oj:F.oj,dE:F.dE,nw:F.nw,vJ:F.vJ,1A:F.1A.3q()};I 1q},5u:H(1v,O){O.5w(F.1l,"rB",1v);O.5w(F.1o,"AT",1v);O.4r(F.oj,"hL",1v);O.c9(F.dE,"1ew",1v);O.4o(F.nw,"1ez",1v);O.hn(F.vJ,"1ey",1v);if(F.1A&&(F.1A.5x||F.1A.4U)){G 2m={};if(F.1A.5x){2m.5n=F.1A.5x}if(F.1A.4U){2m.1Y=F.1A.4U}O.qW(2m,"1ex",1v)}if(F.1A&&(F.1A.4q!=1F||F.1A.4i!=1F)){G 7K={};if(F.1A.4q!==1F){7K.dh=F.1A.4q}if(F.1A.4i!=1F){7K.4i=F.1A.4i}O.X6(7K,"1eQ",1v)}G 8o=O.3i("2E",1v);F.1A.5u(8o,O);G Jy=O.3i("1eP",1v);1h(G i=0;i<F.3k.T;i++){O.1et(F.3k[i],Jy,"cL")}},5g:H(1v,O){F.1l=O.5k("rB",1v);F.1o=O.5k("AT",1v);F.oj=O.3Q("hL",1v);F.dE=O.a7("1ew",1v);F.nw=O.4v("1ez",1v);F.vJ=O.hy("1ey",1v);G 2m=O.rZ("1ex",1v);if(2m){if(2m.5n){F.1A.5x=2m.5n}if(2m.1Y){F.1A.4U=2m.1Y}}G 7K=O.vo("1eQ",1v);if(7K){if(7K.dh){F.1A.4q=7K.dh}if(7K.4i){F.1A.4i=7K.4i}}G 8o=O.4k("2E",1v);F.1A.5g(8o,O);G Jy=O.4k("1eP",1v);F.3k=[];G WL=O.Wo("cL",Jy);1h(G i=0;i<WL.T;i++){G 1C=O.1eO(WL[i]);1C.1j=F;F.3k.1f(1C)}},1eR:H(){G 2W=[];1h(G i=0;i<F.3k.T;i++){2W.1f(F.3k[i].3q())}I 2W},WQ:H(1C){if(F.1j===1C){I 1t}if(!F.1j){I 1x}I F.1j.WQ(1C)},oU:H(N){F.1j=N},1eU:H(bW,nO){if(F.3k.T===0){I}G r0=0;G Lq=0;1h(G i=0;i<F.3k.T;i++){G 1C=F.3k[i];if(1C.oh()===J.1e.6R.hL.oK){r0++;Lq+=1C.8v()}}G du=F.qv();if(bW<nO){if(r0>0){G Lf=nO-bW;1h(G i=0;i<F.3k.T;i++){G 1C=F.3k[i];if(1C.oh()===J.1e.6R.hL.oK){1C.AZ(1C.8v()+Lf*1C.8v()/Lq)}}}1k{G BR=F.3k[F.3k.T-1];BR.AZ(BR.8v()+nO-bW)}}1k{G iQ=0;if(r0>0){G KU=bW-nO;1h(G i=0;i<F.3k.T;i++){G 1C=F.3k[i];if(1C.oh()===J.1e.6R.hL.oK){G oP=1C.8v()-KU*1C.8v()/Lq;if(oP<du){iQ=du-oP;oP=du}1C.AZ(oP)}}}1k{iQ=bW-nO}if(iQ>0){1h(G i=F.3k.T-1;i>=0;i--){G 1C=F.3k[i];if(1C.oh()===J.1e.6R.hL.U8){G oP=1C.8v()-iQ;if(oP<du){oP=du}1C.AZ(oP)}}}}},1eS:H(e6,nr){if(F.3k.T===0){I}G r0=0;G KS=0;1h(G i=0;i<F.3k.T;i++){G 1C=F.3k[i];if(1C.oh()===J.1e.6R.hL.oK){r0++;KS+=1C.8d()}}G du=F.qv();if(e6<nr){if(r0>0){G Lf=nr-e6;1h(G i=0;i<F.3k.T;i++){G 1C=F.3k[i];if(1C.oh()===J.1e.6R.hL.oK){1C.AC(1C.8d()+Lf*1C.8d()/KS)}}}1k{G BR=F.3k[F.3k.T-1];BR.AC(BR.8d()+nr-e6)}}1k{G iQ=0;if(r0>0){G KU=e6-nr;1h(G i=0;i<F.3k.T;i++){G 1C=F.3k[i];if(1C.oh()===J.1e.6R.hL.oK){G o0=1C.8d()-KU*1C.8d()/KS;if(o0<du){iQ=du-o0;o0=du}1C.AC(o0)}}}1k{iQ=e6-nr}if(iQ>0){1h(G i=F.3k.KN-1;i>=0;i--){G 1C=F.3k[i];if(1C.oh()===J.1e.6R.hL.U8){G o0=1C.8d()-iQ;if(o0<du){o0=du}1C.AC(o0)}}}}},EH:H(1l){if(F.3k.T===0){if(F.1l<1l){F.1l=1l}}1k{1h(G i=0;i<F.3k.T;i++){F.3k[i].EH(1l)}}},HD:H(1o){if(F.3k.T===0){if(F.1o<1o){F.1o=1o}}1k{1h(G i=0;i<F.3k.T;i++){F.3k[i].HD(1o)}}},TK:H(){F.1l=0;1h(G i=0;i<F.3k.T;i++){F.3k[i].fl(0)}},TN:H(){F.1o=0;1h(G i=0;i<F.3k.T;i++){F.3k[i].fb(0)}},Ab:H(1C){if(F.1j){F.1j.Ab(1C)}},AZ:H(N){if(F.ju()){if(N<F.qv()){N=F.qv()}}1k{if(N<0){N=0}}if(F.1l===N){I}G 1eT=F.1l;if(F.3k.T===0){F.1l=N;I}G bW=F.8v();F.1l=N;if(F.ju()){F.1eU(bW,F.1l)}if(F.i3()){F.Az(F,1eT)}},AC:H(N){if(F.i3()){if(N<F.qv()){N=F.qv()}}1k{if(N<0){N=0}}if(F.1o===N){I}G TO=F.1o;if(F.3k.T===0){F.1o=N;if(F.ju()){F.1j.wq(F,TO)}I}G e6=F.8d();F.1o=N;if(F.i3()){F.1eS(e6,F.1o)}if(F.ju()){F.wq(F,TO)}},wq:H(1C,1o){F.1j.wq(1C,1o)},Az:H(1C,1l){F.1j.Az(1C,1l)},4Y:H(){I F.1j},3y:H(){I F.3k},iD:H(){if(F.3k.T===0){I 1}G 2W=0;1h(G i=0;i<F.3k.T;i++){2W+=F.3k[i].iD()}I 2W},8v:H(){if(F.3k.T===0){I F.1l}if(F.i3()){I F.1l}G hR=0;1h(G i=0;i<F.3k.T;i++){hR+=F.3k[i].8v()}if(hR==0){I F.1l}I hR},fl:H(N){F.AZ(N)},8d:H(){if(F.3k.T==0){I F.1o}if(F.ju()){I F.1o}G gG=0;1h(G i=0;i<F.3k.T;i++){gG+=F.3k[i].8d()}if(gG==0){I F.1o}I gG},fb:H(N){F.AC(N)},oh:H(){I F.oj},1n4:H(N){F.oj=N},UV:H(){I F.dE},1nn:H(N){if(F.dE===N){I}F.dE=N;F.Ab(F)},1eJ:H(){I F.nw},1nm:H(N){if(F.nw===N){I}F.nw=N;F.Ab(F)},l5:H(){I F.1A},wk:H(N){if(!N){I}if(F.1A===N){I}F.1A=N;F.Ab(F)},ju:H(){if(F.1j){I F.1j.ju()}I 1x},i3:H(){if(F.1j){I F.1j.i3()}I 1x},qv:H(){if(F.1j){I F.1j.qv()}I 0}};J.2x(cL,"J.1e.6R.cL")})(J.1e.6R);(H(3j){G nW=3j.nW=H(3V,6f){1n.2T(nW,F);F.3V=3V;F.6f=6f};nW.1s={3D:H(1q){1n.2o(nW,F,"3D",[1q]);F.6f=1q.6f},3q:H(){G 1q=1n.2o(nW,F,"3q",[]);1q.6f=F.6f;I 1q},Ab:H(1C){if(F.3V){F.3V.1S()}},ju:H(){I!F.6f},i3:H(){I F.6f},qv:H(){I F.3V.1eI()},wq:H(1C,1o){F.3V.wq(1C,1o)},Az:H(1C,1l){F.3V.Az(1C,1l)}};J.2x(nW,"J.1e.6R.nW",3j.cL)})(J.1e.6R);(H(3j){G 2E=3j.2E=H(){1n.2T(2E,F)};2E.1s={3D:H(1q){F.tj=1q.tj;F.ks=1q.ks;F.lf=1q.lf||1;F.lC=1q.lC;F.q5=1q.q5||1;F.l7=1q.l7;F.iC=1q.iC||1;F.kA=1q.kA;F.lg=1q.lg||1;F.3e=1q.3e;F.5x=1q.5x;F.4U=1q.4U;F.4q=1q.4q;F.4i=1q.4i},3q:H(){G 1q={tj:F.tj,ks:F.ks,lf:F.lf,lC:F.lC,q5:F.q5,l7:F.l7,iC:F.iC,kA:F.kA,lg:F.lg,3e:F.3e,5x:F.5x,4U:F.4U,4q:F.4q,4i:F.4i};I 1q},5u:H(1v,O){O.9k(F.tj,"1eH",1v);O.wc({1N:F.ks,1l:F.lf},"1eK",1v);O.wc({1N:F.lC,1l:F.1nq},"1eN",1v);O.wc({1N:F.l7,1l:F.iC},"1eM",1v);O.wc({1N:F.kA,1l:F.lg},"1eL",1v)},5g:H(1v,O){F.tj=O.9r("1eH",1v);G 2y=O.nF("1eK",1v);if(2y){if(2y.1N){F.ks=2y.1N}if(2y.1l){F.lf=2y.1l}}2y=O.nF("1eN",1v);if(2y){if(2y.1N){F.lC=2y.1N}if(2y.1l){F.iC=2y.1l}}2y=O.nF("1eM",1v);if(2y){if(2y.1N){F.l7=2y.1N}if(2y.1l){F.iC=2y.1l}}2y=O.nF("1eL",1v);if(2y){if(2y.1N){F.kA=2y.1N}if(2y.1l){F.lg=2y.1l}}},J2:H(){I F.tj},UA:H(N){F.tj=N},IX:H(){I F.ks},Uo:H(N){F.ks=N},IV:H(){I F.lf},I6:H(N){F.lf=N},Ia:H(){I F.lC},UL:H(N){F.lC=N},Ib:H(){I F.q5},I8:H(N){F.q5=N},HV:H(){I F.l7},UQ:H(N){F.l7=N},HX:H(){I F.iC},I1:H(N){F.iC=N},Iq:H(){I F.kA},UK:H(N){F.kA=N},Im:H(){I F.lg},Ig:H(N){F.lg=N},lo:H(){I F.3e},iW:H(N){F.3e=N},wK:H(){I F.5x},DI:H(N){F.5x=N},wM:H(){I F.4U},DJ:H(N){F.4U=N},ec:H(){I F.4q},b7:H(N){F.4q=N},ft:H(){I F.4i},bq:H(N){F.4i=N}};J.2x(2E,"J.1e.6R.2E")})(J.1e.6R);I J}));',62,5767,'|||||||||||||||||||||||||||||||||||||||||this|var|function|return|MindFusion|mdiag|||value|context||||node|length|||||||||||||||||new|points|null|bounds|Diagramming|push|item|for|link|parent|else|width|diagram|mflayer|height|point|json|rect|prototype|true|element|xmlElement|Math|false|index|obj|style|Drawing|header|params|ArrayList|undefined|state|destination|Rect|row|copy|Point|Utils|brush|origin|text|Shape|items|invalidate|clone|forEach|get|args|links|size|position|||||||||||parentElement|outline|child||fromId|shapes|shape|GraphicsUnit|break|Shapes|case|elementName|font|max|callBaseMethod|mousePosition|Events|column|graph|L100|nodes|layer|content|registerClass|pen|outlineBounds|ist|path|children|isInstanceOfType|Style|get_element|cell|min|start|MouseCursors|container|L50|vertices|center|contains|rows|setAttribute|type|vertex|initializeBase|edge|continue|result|set|edges|right|||||||||||getBounds|rotationAngle|top|sequence|textColor|adjustmentHandle|matrix|selection|addChildElement|mlanes|subHeaders|component|DiagramNode|raiseEvent|Dictionary|strokeThickness|toJson|master|cells|PathFinder|tree|while|scale|level|getSubHeaders|measureUnit|originConnection|ContainerNode|headers|fromJson|stroke|bottom|current|root|pos|destinationConnection|canvas|handle|nodeEffects|A50|document|layers|readInt|left|containsPoint|dfsNumber|Path|grid|columns|Collections|prepareScriptEvent|layout|||||||||||owner|scroller|DiagramLink|image|data|gridPosition|check|decoration|lineAlignment|Graphs|selectSingleNode|LayeredLayout|currentController|Diagram|writeBool|parentNode|textAlignment|writeInt|00000000000001|captionHeight|Vector|readBool|Alignment|count|getAttribute|setDirty|labels|col|createDelegate|end|margin|maxWidth|setBounds|theme|target|angle|add|abs|lineTo|color|std|group|pt2|offset|progress|getMillimeter|fontSize|strokeDashStyle|pt1|incoming|getParent|anchorPointDetails|||||remove||next||||M100|mgeo|transform|options|layoutArea|temp|loadFromXml|radius|anchorPattern|apply|readFloat|shapeDecorations|label|name|newNode|ShapeNode|effects|tag|M50|segments|saveToXml|segment|writeFloat|fontName|distance|propertyElement|undoManager|weight|viewport|mouseButton|fromValue|horizontal|dependency|topLeft|styles|positions|HandlesStyle|orientation|delete|textRenderer|Number|typeof|trackerRect|classId|button|Font|Orientation|handler|newText|HandleUtils|fillMode|TreeLayout|||||||||||outEdges|originalStates|enabled|eventName|graphicsContainer|rowHeader|padding|handlesStyle|command|LinkShape|shapeRenderer|BorderedTreeLayout|switch|elements|AdjustmentHandles|TreeMapLayout|canvasElement|L60|parseFloat|FreeFormNode|maxHeight|A40|epath2|updateFromPoints|move|table|total|moveTo|builder|NodeEventArgs|scroll|Size|coords|RenderPhase|setDiagramDirty|glowColor|nodeDistance|shadowColor|Horizontal|captionBackBrush|Graph|jsonTemplate|point1|Lanes|thisObj|visited|toValue|window|transparent|dashStyle|inplaceTextBox|Controls|||||||||||neighbor|epath|prop|view|parseInt|000000|indexOf|pts|constructor|flipX|flipY|arrow|off|headShapeRenderer|LayoutDirection|pivot|999999999999986|throw|headShapeSize|baseShapeSize|inflate|direction|mouseInputDispatcher|headShape|cursor|Center|setBrush|TableNode|virtualStart|columnHeader|effect|handleAtPoint|Thickness|None|addHandlers|floor|stringFormat|horizontalScale|Error|setShape|verticalScale|toString|imagePadding|innerText|textSize|MAX_VALUE|getElementsByTagName|addEventListener|node2|node1|point2|rowSpan|||||||||||AnchorPattern|zOrder|SpringLayout|getHeight|oldText|strokeStyle|currentScrollRow|L80|getRow|kid|sender|nodeStyle|getRotatedBounds|Text|styleElement|repaint|reflectionColor|cascadeStartHorizontal|getCell|action|location|getWidth|pair|pathString|len|line|columnCount|L40|Line|anchoring|updateContent|sort|backColor|corners|dist|defaultValue|LayoutUtils|diagBounds|setInstance|route|scrollLeft|union|Builder|scrollTop|instanceId|L90|rowCount|getText|neighbors|AssistantPosition|last|minY||||||||Behavior|||controller|delta|enabledHandles|baseShape|setPen|currentBehavior|cancel|headerBounds|thickness|low1|writeBrush|FractalLayout|99999999999999|diagramBounds|manipulator|getRect|startPoint|readBrush|masterNode|frame|addItem|func|rcPage|Set|from|getColumn|shadowOffsetY|field|method|slice|shadowOffsetX|xhr|childCircle|treeLevel|animationType|getCenter|best|suppressSetDirty|EffectPhase|L30|L83|colorStops|Action|MarkStyle|shadow|Matrix|dummy|baseShapeRenderer|getOutline|backBrush|onMouseMove|imageAlign|textRect|||layoutCtr|arrange|pow|translate|readString|crad|shapeLibraryLocation||callback||considered|appendChild|diagramPoint|boxes||details|L25|L20|low2|maxY|expanded|DiagramItem||LinkEventArgs||||shouldCancel|string|AnchorPoint|||Rectangle|typeId|modifyHandle|L70|pointerPosition|cellRect|nodeRect|sweep|autoRoute|Edge|setText|Type|init|body|intersection|selected|inEdges|lineWidth|lastTouch|folded|Cell|manim|LayoutAlignment|props|obstacle|hitTest|arguments|down|||brushElement|onMouseUp|outlinePen|outlineBrush|setTextAlignment|unfoldedSize|scrollOffset|duration||bottomRight|sub||cornerRadius|L10|easingType|Near|side|effectElement||isHorizontal|_mf_scale|empty|autoScrollAmount|setLineAlignment||getBrush||C100|scrollZoneSize|onMouseDown|svg|svgElement|columnSpan|blue|fill|classNodes|allowIncomingLinks|fillStyle|textStyle|dest|currentCursor|expandButton|closed|visibility|SvgNode|magnifierRenderer|tooltip|rotatePointAt|assistantPosition|commit|Vertex|DummyNode|activeItem|poly|Bezier|oldWidth|styled|allowOutgoingLinks|Cascading|classDesc|||||attachedNodes|DiagramMediator|Geometry|substring|writeString|columnStart|scrX||scrY||allowRemoveChildren|evenodd|captionFont|pixelsPerUnit|nodeBounds|currentPoint|||_pts|clientToDoc||vertexBuckets|getOtherEnd|||fontStyle|margins|control|||rcTotal|startDrag|modifiedItem|treeLevels|resolveInheritedStyle|defaultShape|split|gridSize|restore|mask|minX|newPoints|Header|save|Visibility|keepGroupLayout|L75|L85|touches|allowAddChildren|resizing|red|paths|diagramView|||param|customData|||||topMargin|div|leftMargin|units|ptDoc|connectionStyle|||ordered|dynamic|shapeImpl|splice|alignment||indexInLayer|virtualEnd||unit|leftPos|||pop||rgbToString|loadFromLibPending|minSize|rowIndex|cellFrameStyle|||L55|parts|localPoint|scaleMode|rightPos|title|foldIconSize|measureString|backgroundImage|equals|iconSize|getMinDist|recording|black|ignoreLayout|segmentCount|cartesianToPolarDegrees|saveState|shapeDecorationsElement|updateLocation|green|currentPhase|showGrid|buttonDown|||rowObj|hcenter|||initialize|hsize|svgString|oldHeight|L45|resolveEffectiveStyle|intersectingItems|ShapeRenderer|maxDist|getTextAlignment|beginPath|restoreState|shadeColor|Value|diagramStyle|ebrush2|script|__typeName|allowFlip|getRotationAngle|weights|incomingLinks|animation|epath3|rotateText|targetConnection|offsetBranch|outgoingLinks|multiple|L77|Left|hyperLink|getIntersection|maxX|ifIntersect|rowStart|time|SinglePointerController|resizingHeaderWidth|outgoing|lastPosition|form|anchoringInfo|folder|subordinates|cost|magnifierShape|outlinePath|bucket|isStatic|dLayer|setPropertyValue|getPropertyValue|Selection|topCenter|updateDrag|baseStyle|client|CompositeNode|horizontalOffset|L13|Default|lines|executeCommand|360|rule|iconRect|Theme|originalPoints|rowWidths|setHeight|getEffectivePropertyValue|minHeaderSize|polarToCartesianDegrees|autoHandlesItem|svgdoc|columnHeights|getEffectiveStrokeThickness|columnEnd|rules|setWidth|vector||Date|images|imageLocation|headStrokeDashStyle|box|getLineAlignment|scrollAmount|itemElement|layering|||collapsedSet|getTopLevel|getEndPoint|rightSibling|farPoint|linkBaseShape|gridSizeY|gridSizeX|childNodes|default|rotateImage|leftSibling|redo|recordingDispatcher|InplaceEditController|saveEndRelative|arrowRect|scrollDiv|undo|minVisibleFontSize|widths|cachedLayoutRect|locked|rowHeight|expandOnIncoming|step|multipleGraphsPlacement|currentLevel|shapeDecoration|getUndoEnabled|linkShape|createController|headBrush|searchOrder|src|imageContent|relatedItem|Brush|baseBrush|org|selectedItems|getColumnCount|AnimationType|scaleFactor|rowEnd||docToClient|getCursorPos|Grid|relativePosition|LinkNodesBehavior|opacity|white|rintr|focusDiv|autoResize|currentMousePoint|getEffectiveTextColor|angles|zIndex|color1|alignToGrid|rectangles|color2|linkSegments|stack|getScrollY|Far|Create|totalHeight|reverse|autoSize|BehaviorBase|fromPoints|doc|linkHeadShape|Animation|M90|idmap|fromLTRB|getScrollX|zoomFactor|dispose|notInteractive|verticalAlign|hookHeaders|linkCrossings|getType|This|setCurrentCursor|L61|queue|setTimeout|addRange|intDiv|getHandled|foreColor|getter|Command|columnStyle|parentDoc|topRight|DrawNodesBehavior|round|linkTextStyle|Vertical|updateChildren|bottomLeft|spTreeEdge|getEffectiveStroke|showAnchors||writeColor|Name||scrollTimeoutId|autoScrDX|svgs||L87|autoScrDY|defaultNodeSize|Circle|readColor|headStroke|headStrokeThickness|pattern|L15|list|pointElement|lastIO|With|getEffectiveFont|gridRow|getRowCount|alignedNodes|ResizeType|resizerRect|allowResizeRows|allowResizeColumns|mediator|nearPoint|totalWidth|not|rgba|lowpt|createElement|ImageAlign|Image|CreateSelectionController|intersectsWith|verticalOffset|||isRowHeader|inputDispatcher|mouseHandler|textPadding|sqrt|horizontalAlign|autoArrange|ShapeLibrary||enableAssistants||Manipulator||onLoad|relativeTo|prev|gridOffsetX|SolidBrush|measure|L39||getIndex||allowUnconnectedLinks|linkType|||previousBounds|diagramId|getElementById||mouseDown|effectElements|getEffectiveStrokeDashStyle|yoff|rightBorderThickness|getDeepChildCount|ScaleMode|controlLoaded|thumbRect|setMouseCursor|magnifierEnabled|propertyMap|||steps|Rotate|iconsidered|expandable|more|ColumnStyle|captions|colWidth|ebrush|expandBounds|setTextColor|adjustmentHandlesSize|xoff|changed|removeHandler|||64466|shapeBrush|allowSelfLoops|gridOffsetY|35534|decorationPen|getRotatedRect|endDrag|getCaptionHeight|cellBounds|headersOnTop|intersects|Version|allowOutgoing|allowIncoming|innerOutlineColor|getVisible|object||patternId|MouseButtonActions|enter|setVisible|manipulators|originAnchor|2000|getStartPoint|isColumnHeader|destinationAnchor|Modify|lowpt2|allowResizeHeaders|clipChildren|dir|nodeConstructor|LinkTextStyle|DashStyle|Index|ptMid|getCancel|heights|routeLinks|downNodes|242|originalState|AlignStart|components|order|Panel|shadowsStyle|minWidth|childCircles|L17|sequenceStart|enableStyledText|NodeListView|vertexStack|lightgray|SimpleShape|rotateRect|||arc|info|M40|backgroundImageAlign|rotatePointsAt|setImageContent|gridCol|Overview|Class|area|getNearestAnchor|desiredHeight|allowZoom|branchBounds|assistantType|addVector|fit|clip|getSegmentCount|desiredWidth|classVersion|diagramElement|chars|getSelected|updateCanvasElements|leftBorderPen|TreeLayoutLinkType|oLayer|linkStyle|obstacles|setTag|showDisabledHandles|undoIndex|bottomBorderPen|branchCircle|guideColor|getDestination|ChangeItemCommand|LinkCrossings|pointerColor|subordinate|anchorPointVisuals|CreateLinkController|shift|array|getOrigin|folderRect|dynamicLinks|CreateNodeController|roundedLinksRadius|addLinkToNode|rotate|affectedItems|shouldCancelDrag|captionFill|removeLinkFromNode|setRow|magnifierFrameThickness|counter|Container|||laneGrid|newPoint|getStyle|execute|rightBorderPen|glowColor2|handled|||Property|enableGuides||leftBorderThickness|bottomBorderThickness|Ruler|createElementNS|rowArea|projectionColor||cols|www|getTextColor||open||http||validated||levelDistance|||bezier|parentWeight|updateConnections|topBorderPen|Move|TableConnectionPoint|recip|fromVertex|usePenAsGlow|magnifierSecondaryFrameColor|allowDrag|Anchoring|Auto|getBezierPt|MultipleGraphsPlacement|subtract|M20|draw|getViewport|uLinkCount|upNodes|roundedLinks|dLinkCount|ManipulatorController|enableWrap|saveLocationState|stepx|attachment|Touch|magnifierHeight|RecordingMouseDispatcher|magnifierWidth|getNearestBorderPoint|ModifyLinkController|ModifyNodeController|getSize|resizer|ModifySelectionController|magnifierFactor|getEnableStyledText|Factory||getInitialPoint|||Straight|apt|invalidateLayout|removeItem||tsize|contentArray|setsLinkEndPoints|onUpdateVisuals|ptf2||HorizontalResize|cursorHint|dummificationLevel||||VerticalResize|L14|clearTimeout|breadth|onClick|getAllOutgoingLinks|allowMultipleResize|segmentLength|nodeCaption|hitTestManipulators|eventDispatcher|ptCurrent|interactionState|linkBrush|brth|getAllIncomingLinks|newValue|startTimeStamp|segmentDir|Animations|targetId|ItemEventArgs|scaleSize|linkPen|jump|parseType|registerItemClass|tooltipDelay|||InplaceEditEventArgs|A30|RelativeToLink|M10|createShadow|shapePen|PanController|strings|getShadowOffsetY|ctrBounds||legacyPen|MagnifyController|L67|getShadowOffsetX||back|sin|lengthType|textStroke|textStrokeThickness|LinearGradientBrush||Color|newHeight||Cannot|getEditRect|fillRect|rotateTitle|replacement|GlassEffect|Right|dirty|TreeMapLayoutBuilder|levelSizes|CellEventArgs|ctx|readPen|AeroEffect|keepRootPosition|setter|getTotalColumnHeight|EventArgs|getTotalRowWidth|topLeftAreaStyle|TopToBottom|newWidth|rotateAt|tempPath|sideLen|lowPoint|phase|addRect|cellCluster|MasterHeader|insert|hyperlink|linkBaseShapeSize|newHeaderHeight|||moves|drawShadow|linkHeadShapeSize|cancelDrag|DiagramLinkBuilder|magnifierFrameColor|Effects|ShapeNodeBuilder|resizeDelegate|FitSize|halfDistance|includeGroups||compareWith|getResizeType||resizeType|remaining|SpringLayoutBuilder|childMargin||colSpan||dBaryCenter||skipLocked|layoutTraits|Effect|uBaryCenter|keepGroups|||inplaceResources|RightToLeft|absolute|SvgNodeBuilder|commitCompositeOperation|showDeleteButton|textElement|LeftToRight|getHandler|call|getFoldedContainer|Proportional|LayeredLayoutBuilder|intersections|fileName|xxProj|newHeaderWidth|TableNodeBuilder|ScrollTableCommand|linkHitDistance|200|setParent|M15|loadImage|align|getTag|desiredSize|backgroundImageUrl|||C30|sorted|getRowRect|getThresh|The|newNodes|rcItem|hinch|decorationPath||Pan|shapeDecorationPath|AutoResize|linkRouter|CellValidationEventArgs|setIds|commands|makeRect|rotatedBounds|fromNode|ModifierKeyActions|updateLinks||StyleBuilder|originNode|toNode||placed|FreeFormNodeBuilder|ContainerNodeBuilder||preventDefaultTouch|getEffectiveHandlesSize|low|touchThreshold|applyEffects|FreeFormHandle|iKa|LaneGridController|invalidParent|strokeBounds|autoCloseDistance|allowInplaceEdit|getItemAt|nodePath|updateAnchorVisibility4|createEditArgs|decorationBrush|reflectionColor2|updateFromEndPoints|shapeOrientation|replacementFor|getFromValue|separationPairs|showLaneGrid|iter|routeBounds|Keyboard|repeat|||||BorderedTreeLayoutBuilder|topBorderThickness|crossingRadius|resize|autoScroll|path2|rcCpt|255|gridStyle|gridColor|fitInBounds|background|validate|italic|behavior|updateDependencies|visible|bold|themeStyle|FractalLayoutBuilder|inplaceObject|freeFormAttractDistance|startIdx|getBuilder|_this|attachmentElement|SimplePanel|getMinSize|invalidated|path1|preventDefault|removeChild|freeFormTargets|childLinks|86583|MouseInputDispatcher|createElements|exit|createVertex|DiagonalResize|ded|compactAssistants|pointStack|delKeyAction|FoldContainerCommand|getEffectiveTextStroke|L34|head|columnIndex|getShape|allowChangeSegments|getNodeAt|ModifierKeyAction|textHeight|writeFont|createEdge|url|806023|proportionalCount|||sum|degreeToRadian|edgeStack|mouseUpDelegate|primaryMeasure|SerializeTagEventArgs|GlassEffectType|19398|||getEffectiveBrush||legacyCaptionFormat|parentDiv||depth|topEdge|RemoveItemCommand||usingContainerNodes|lineJoin|divSize||setHeadShape||TreeLayoutBuilder||invalidRect|||||ConnectionPoint|crossings|Width|AddItemCommand|its|setEnableStyledText|cellInfo|componentStack|GridPanel|iLa|KeyboardInputDispatcher|getWeight|rcSel|CounterDiagonalResize|30127|fixedSize|updatePosFromOrgAndDest|exclude|DrawLinksBehavior|newWithOffset|gindex|ModifyBehavior|strPath|getFolded|rcObjRect|clipped|readFont|pointDetails|||13417|modificationStart|the|valid|serialized|Scale|XmlPersistContext|verticalScaleElement|FFFFFF|autoAnchorsNode|||onResize|columnHeaders|xmlInfo||magnifierShading|levelIndex||parentStyle|subElementName|legacyTextFormat||mousemove||mouseMoveDelegate||rcNewSize|dependencies|||||undoHistory|valueElement|totalLength|skipInvisible|FontStyle|copyPoints|nodeMap|addToContext|preparePostback|getZIndex|ctor|virtualScroll|verticalScaleVisible|gridPointSize|Decoration|keyboardInputDispatcher|Outline|horizontalScaleVisible|key|downNode|activeManipulator|range|currDown|ShapeDecoration|virtualStartIndex|lastWord|addDataId|markStyle||orgStart|getTextToEdit|oldBounds|Points|rowHeaders|orgEnd|outlineElement|pointedItem||circle|rotation|turnCost|RecordingKeyboardDispatcher|updatePathFromPoints|GridRouter||backgroundBrush|restoreLocationState|||topLeftAreaText||onShapeLibraryLoaded|CompositeCommand||DummyConnectionPoint||defaultStyles|TextVerticalAlignment|isDummy|||HeaderResizeEventArgs|TextAlignment|tableStyle|updateIntersections|freeformStyle|oPos|maxHeightsPerLevel|LinkTextRenderer|setImageLocation|maxWidthsPerLevel|getDepth|ShowAnchors|onError|priority|ResizeTableColumnCommand|StackPanel|ResizeTableRowCommand|maxLeftLevel|TextBrush|repaintId|Select|nodeGridPos|gridPoint|LinkLabel|currentComposite|minDist|shapeStyle|MagnifyBehavior|propName|buttonMappedTo|setLineDash|library|cellStyle|pointsValid|childrenOf|getEffectiveTextStrokeThickness|getHandlePositions|destHeight|decorationElement|attachHandlers|console|skipLayout|load|totalColumnHeight|getToValue||hoverTimeoutId|totalRowWidth|animations|KeyboardEventHandler|originCenter|Ellipse||parseColor|resetSelfLoopPoints|requiresSimpleGraph|containsRecursively|HeaderEventArgs|TouchEventHandler|BottomToTop|columnElements|SelectionEventArgs|headerSize|ComponentEventArgs|DiagramEventArgs|collapse|onShapeLoaded|getStroke|previousRight|DoNothingBehavior|walk|getEffectiveFontSize|getLayoutRect|rectPtFromPercent|cannot|getStrokeThickness|find|updateData|createEditControl|UndoManager|maxRightLevel|pairs|getLinkCrossings|requiresCascadingLinks|getPoints|searchCounter|setsLinkPoints|previousLeft|MouseEventHandler|nodePos|||SvgContent|loadItem|simple|diameter|currentPos|ExpandButton|DeleteButton||convertToShape||Folder|onlyInteractive|centers|getLayoutTraits|close||getEffectiveHeadStroke|Custom|LengthType|Item|onlyToSubtree|readStringFormat|parentEdge|measuredSize|pivotPoint||getDiagramItem|Collapsed|NoButton|GridRow|||AllColumnWidths|rectPoints|desiredDistance|getHandleAt|ColumnResizer|startInteraction|GridColumn|PanBehavior|getIntersectingItems|newScale|titleColor|CellFrameStyle|nodesIntersect|toolTip|backgroundImageContent|gridOpen|RowResizer|removeEdge|participant|toGraph|dots|inNodes|CellMatrix|horizontalScaleElement|dPriority|nearest|outNodes|uPriority|animationId|C70||scrollElement|CellClusterStyle|pstmp|onlyNodes|cutPairs|colorsElement|resources|isItemVisible|writePen|setImageAlign|getLocked|number|mouseup|containerStyle||fontElement|setStyle|leftHeap|doc0InDevice|rightHeap|setItemIndices|inheritsFrom|onColumnHeaderHeightChanged|hidden|SelectOnlyBehavior|canvasSize|rectangle|refreshScales|ellapsedTime|controlPoints|crossBefore|onAutoScroll|getContentBounds|recordings|savedBounds|getPixel|setBaseShape|L89|RoundedRectangle|selectionElement|markedStack|ScrollBar|getFontName|CellCluster|getFontSize|onKeyUp|draggedNode|setBoundsWithRules|writeItemReference|removeAnchorPointVisuals|findControl|Scroller|nodeSelected|readShape|idMap|spansMarked|imageLoadHandler|findPaths||||||Router|CellEditor|keyboardHandler|sgt|RoundRect|removeAt|stopAutoScroll||minDistances|Polyline|writeShape|longest|isFrozen|modify|cluster|after|252|getInplaceEditBounds|query|found|defaultBounds|addData|needsMouseMessages|||ignored|resizedHeader|topNodes||scrollPos|targetElement|ddx|getObjectToEdit|drawDashedLine|structure|allRowsHeight|t3s|ddy|underlying|resizeEnabled|keyCode|lengthFactor|lengthPos|has|requiresConnectedGraph|destRect|negatedY|0px|lineHeight|lastSegmentAdded|headerStyle|marginTop|e1Vertices|linkIntersections|Shadow|clear|e2Vertices||||||negatedX|setBackColor|originRect|Function|repeatingLinks|setRotationAngle|projectRotatedBounds|shapeDecorationsPen|drawInteraction|AssistantType|L23|shapeDecorationsBrush|map||quadraticCurveTo|setInplaceEditBounds|itemUnderMouse|hierarchy|setEditedText|inplaceEditBounds|straight|pointOffset|addCanvasElements|||getZoomFactor|CombinedScales|processed|setEnabled|dimColor|getEffectiveBackBrush|addArc|none|autoClasses|threshold|L65|cycles|firstLeftAssistant|newPath|L28|45085|measuredHeight|54915|measuredWidth|L57|any|FitAll|setModfCursor|removeCanvasElements|L72|columnsToRemove|getFoldable|treeLayoutAssistant|foldable|A10|prevSize|isAnchorPatternVisible|rowsToRemove|addElement|getCornerPoints|isVisible|caption|mark|onScroll|adjVertex|L68|Empty|getScrollbarSize|69873|objects|onTouchEnd|setExpandable|emulateMouse|clearAll|desiredHeader|newRect|newBounds|eventHandlers|eventHandlerList|ComponentLoader|approximation|loaded|inReplacement|alignedPoint|C33|sign|layoutRect|changeVertex|outReplacement|dependentUpon|recognize|1000|cellElement|Column|masters|stepy|maxSize|maxLevel|500|intervals|vhratio|hvratio|cellsElement|ptInitial|startTotalChange|assistantBounds|sizePrim|posPrim|splitGroups|allocated|cmd|TextEditor|addHandler|secondaryMeasure|getContext|bind|get_focusElement|L33|loader|keys|ancPoints|Stretch|aligning|columnsElement||rowsElement|rep|verticalAlignment|horizontalAlignment|drawText|notifyHeaderChanged|iterations|line1|line2|rowElements|vcenter3|newLink|penElement|animationDelta|vcenter1|propertyName|segmentPoints|oldConnection|line3|CascadingShape|placeSequence|totalWeight|numerator|getImageAlign|formHandle|AutoWidth|Ignore|itemElements|routeMargin|onRowHeaderWidthChanged|setZIndex|line4|setHeightNoNotify|setColumnWidth|radTotal|sweepAngle|countIntersectingItems|clientToDocOverflow|getRectPtPercent|setCurrScrollRow|parse|version|headerElement|ImagePadding|_mf_linkCrossings|systemClipboard|colors|saveImage|imageIndex|Height|EasingType|downwards|setRowHeight|fontFamily|setFolded|setWidthNoNotify|dPos|getEffectiveFontName|imageData|nodeBaryCenter|startComposite|cellSizes|paddedRect|spline|EasyMove|getEnabledHandles|ignoreTransform|typeName|spanningCell|rBest|viewbox|0001|setSegmentCount|updateText|ptBest|childBounds|BeforeFill|visitNodes|nodesExpandable|childArea|link1|strokeRect|selHandle|AfterFill|link2|nodeClass|resObject|classes|Cross|testNode|desiredDist|getScrollable|attachmentsElement|endComposite|pointsElement|innerMatrix|updateAnchorVisibility|drawHandles|ptf|onUpdateBounds|underline|createConnectionPoint|drawAdjustmentHandles|getTime|cellSize|jsonObj|modifierKeyActions|oldValue|Tag|lastHeader|scrollPosition|denominator|svgData|isStraight|scrollable|test|L27|framePath||degree|getLength|||||setScrollable|coord|addToRect|headShapeBounds|initialTemperature|relativeSize|useLinkWeights|normalizeRect|polyline|clipPath|resetCrossings|maxPaths|useNodeWeights|colRect|L43|raiseCreating|cancelNow|LinkRules|tolow|countCrossings|cHorz|targetView|lastChild|getHeader|treeEdge|onItemDropped|ptf1|row2|tension|resizeToFitChildren|uLayer|isNaN|updateRelatedPoints|addManipulator|removeManipulator|setSelected|auto|xmldoc|setLinkHeadShape|newlink|updateLinksPos|updateScrollerContent|L18|up2|scrollStayInDoc|uniform|resizerHeight|lastColumn|autoWidth|calcAutoWidths|L62|copyLinks|setBaseBrush|containerId|masterId|setHeadBrush|subtractPadding|up1|generatorBuckets|reflectionColor1|L88|addManipulatorVisuals|onUpdateDelegate|onDiagramMouseMove|convert|downPoint|getAutoAnchorsNode|bestPoint|marginLeft|bestEval|source|getHandlePosition|standalone|ShadowsStyle|sinks|onDiagramPaint|qualifiedNameParts|writeTag|hasAttribute|nodeRightClass|M80|zOrderedItemsAt|writeResource|scrollTo|overflow|nodeLeftClass|readTag|boolValue|getCount|setAutoHandlesItem|addVertexToBucket|M45|customNodeType|sink|nodeVicinityCost|setMinDist|updateScales|setLocation|customLinkType|setFontName|setFontSize|thumbHeight|diagramToGrid|fromArgs|currentClass|createControl|onReplay|onRemove|Magnify|allowMultipleSelection|prevBridge|sortedNodes|nextBridge|minLayer|readArrowheadV13|Arrow|Triangle|reversedEdges|sortByDfsNumber|buttonDownPosition|Visible|setZoomFactor|namedComponents|getAnchor|Increase|arrangeInRect|getDummyNode|setImagePadding|setBackBrush|M87|getLocation|linkToNodeMap|Rows|getImageContent|sizeSec|getImageLocation|nextNode|measureChild|nodeType|tempText|tableWidth|baseShapeBounds|Relative|L32|lineHitTest|laneElement|setFont|getColumnSpan|getConnectedComponents|changeOrigin|tempCol|updateFromMasters|firstCharLower|gridPos|readThickness|C15|raiseClicked|labelsElement|repaintDelegate|docToClientOverflow|ensureWidth|readImage|createCallback|imageElement|getBucket|raiseDoubleClicked|selectionRect|resMap|fontHeight|textBoxSize|writeThickness|modifiedDiagram|leftNode|temperature|M70|offsetY|pixels|freeInDir|offsetX|rightNode|vertexIdx|iEnd|drawRotationHandle|setFlipX|getPolyLine|setFlipY|chooseBestAnchorPoint|acceptLinks|updateCanUndo|setKeepGroupLayout|handledItem|leaveInplaceEditMode|scrollX|levelCount|tolerance|tempMaster|bottomSide|StrokeDashStyle|drawOutline|currentY|raiseModified|scrollY|getKeepGroupLayout|log|newRow|halfSectorAngle|nearestPt|SvgExporter|alignEndPointToBorder|mnp|firstRightAssistant|currentAngle|getKeys|setColumnStyle|addToHistory|nodePointed|getAlignToGrid|setAnchoring|getAnchoring|useStyles||lineY|linkPointed|textChunk|tail|rightSide|vmaster|deviation|raiseAnimatedLayoutCompleted|endPoint|clonePoints|setCenterAndSize|transformPoints|requiresHierarchyInfo|distToPolyline|updateFlag|shapeScale|SquareHandles|word|centerDelta|handleBrush|drawCircle|editObject|canvasRect|collectLeaves|MoveOnly|parentLinkAngle|attractedPoints|shapeDecorationBrush|invalidateZOrder|shapeDecorationPen|buttonActions|sharedPos|linkDestination|deleteItem|shapeDecorationBounds|commonEdge|linkOrigin|setFlip|levels|vcenter4|setPoints|inc|destWidth|vcenter2|currentX|setDestinationAnchor|roundRect|setOriginAnchor|addVertexAndOutEdges|cos|PolylineShape|done|doAddItem|drawLines|serif|colObj|__type|getLinksToContainedNodes|updateLayoutId|RadialGradientBrush|sans|leftBounds|updateFromRoute|toDelete|instanceof|ConnectionStyle|setFoldable|radians|doRemoveItem|smalloff|linksToRoute|ellipse|mainDiagonal|selfLoops|className|topmostItemAt|getRoundedLinks|9999|onItemDragging|maxBreadth|onShapeLibraryLoad|err|onShapeLibraryError|parentGetter|swap|updateAllLinks|vcopy|removeElement|oanchor|stopCursorChange|startCompositeOperation|nextX|getLaneGrid|saveMapping|danchor|externalLinks|worstCase|removed|Row|clientY|onTouchStart|headerStartResizing|headerResized|docLeft|resizeToFitItem|registerForSubmit|clientX|bufferZone|tableRowResizing|resetLink|tableColumnResized|onTouchMove|linkPasted|collectGroup|nodePasted|tableRowResized|labelElement|linksFromZ|serializeItems|controlLoadedScript|linkParent|ensureHeight|secDiagonal|minCircle|setDiagram|levelWidth|prepare|itemAdded|docTop|Object|submit|getAttachedNodes|selectedLinks|raiseCreated|docBottom|docRight|itemRemoved|getDestinationAnchor|getOriginAnchor|getRightBorderPen|wrappedLines|getRightBorderThickness|listCoords|disabled|processRowHeaders|setRightBorderThickness|getHandlesStyle|getMasterNode|words|e1v|setLeftBorderThickness|animationOptions|setTopBorderThickness|getShowLaneGrid|getTopBorderPen|getTopBorderThickness|xOffset||lengthCost|createPattern|setBottomBorderThickness|dashes|yOffset|treeExpanded|startTime|hatchBrush|getBottomBorderThickness|handlePoints|drawRectangle|showDisabled|getBottomBorderPen|handledByChild|hatchFill|cachedLinks|patternFill|create|SaveToStringFormat|rightButtonActions|ctp|labelLayoutInvalid|getLinksInScope|bestDeviation|focus|isRoot|middleButtonActions|alignFirstCascadingSegment|blocks|setShapeLibraryLocation|relations|lastCursorPos|textAlign|updateExternalLinks|setOrientation|setBehavior|rcRoot|accept|HatchHandles|tooltipDiv|removeLastChildDeep|ptCorner|processColumnHeaders|getLeftBorderThickness|e2v|getLeftBorderPen|childCirclePos|res|str|format|getBackgroundBrush|getChildLinks|backgroundColor|animationComplete|leftButtonActions|vals|updateCanvasSize|horzSegment|ShadowOffsetX|nodeCreated|segmNum|ShadowOffsetY|nodeDoubleClicked|arrangePoints|stringCallback|nodeDeleted|isItemInteractive|nofitScaleFactor|setAutoScrollAmount|linkDoubleClicked|specified|linkModified|nodeClicked|Canvas|topLevel|linkTextEdited|nodeModified|getAllLinks|considerBounds|finalizeRoute|overview|skipRoute|subHeadersElement|nodeTextEdited|easeOut|DelKeyAction|ToolTip|ResizeTopLeft|alignResize|Bounds|participantNode|connectionPoint|incNodes|incLinks|createNode|convertPath|zooming|percentH|getTrackerResizer|setCancel|percentW|percent|tryMoveTracker|cp1|cp2|getLevelCount|cutEdge|findHeader|setDefaultShape|alt|ctrlKey|setInterval|bezierApprox|returnPairs|selectedNodes|resizerWidth|testPt2|testPt1|cutEdges|linkCreated|linkDeleted|rcTest|startX|setHeadShapeSize|GridStyle|startY|initializeLink|getEllipseIntr|newX|newY|initializeNode|updateAnimation|nodeAdded|ptc|linkClicked|loadEffects|LinkLength|approximateBezier|pointAlongLength|saveEffects|bottomLevel|external|getEffectiveLineAlignment|setLinkBaseShape|enterInplaceEditMode|BezierShape|hitTestAdjustmentHandles|linkDeselected|sizeChanged|normalX|oldPoints|releaseCapture|clicked|connection|ptf3|Margin|ptCurr|autoSnapDistance|clipboardData|Count|cellTextEdited|tableColumnResizing|writeFloatArray|getLayoutMaster|totalProportionalHeight|raiseModifying|decrease|levelHeight|branchCircles|num|template|includeSubHeaders|||||nextY|||readFloatArray|||nodeDeleting|centerPoint|foldedRect|nodeCreating|newMaxLevel|increase|containerChildAdded|mousedown|nodeModifying|linkModifying|easeIn|204|ctrRelative|createLink|getEffectiveTextAlignment|linkDeleting|totalProportionalWidth|linkCreating|linkConstructor|inner|selectionModifying|requestAnimationFrame|treeCollapsed|Undetermined|updateRect|linkSelected|normalY|invalidateLabelLayout|nodeDeselected|maxDepth|removeEventListener|labelsAutoArrange|containerChildAdding|cartesianToPolar|containerChildRemoving|containerUnfolded|setCapture|containerChildRemoved|containerFolded|getMultipleGraphsPlacement|rootX|newRootX|94095|22105|rowRect|26587|69266|64954|nonzero|canUndo|30733|95518||setAllowResizeRows|autoProperty|29629|refineStage|||newRootY|setMultipleGraphsPlacement|35046|rootY|setAllowResizeColumns|73413|setTransparent|n1_edges|setRotateText|squarify|startCompositeCounter|ebrush3|iStart|L69|siftingRounds|distances|sides|containerPadding|L44|getNodeEffects|703709|04482|05905|77895|iGrow|L96|setRotateImage|34221|hasNodeEffects|canRedo|getFont|23141|collectionElement|handlesSize|addEdge|gray|prevLink|22281|rgb|25878|pointInPolygon|getImage|level1|diagItemStyle|L56|getEmptyBounds|readBrushContent|writeImage|relativeSized|setImage|layoutSize|levels2|levels1|Stroke|76859|19639|FontSize|L42|StrokeThickness|L93|65779|rowDefinitions|ShadowBrush|hasBrush|sizeOfColumnSpan|80361|cdef|downLayer|dedum|upLayer|tableHeight|77719|74121|FontFamily|columnDefinitions|rdef|07932|19261|960736|72239|24548|newAutoAnchorsNode|roots|getTransform|ratio1|redimTable|dlinks|38861|linkChanges|22149|createRow|07958|rowCenter|426519|compareByGridPos|L38|72315|createColumn|14413|cellFill|n11|anchorPoints|deleteButton|unions|n12|scaleAtCenter|getId|routeIntersections|copyColumn|rvertex|vBorder|CaptionHeight|CaptionBackBrush|EnableStyledText|border|fileUrl|hBorder|n21|setShowDeleteButton|xmlCollectionToPath|calcBaryCenter|n22|addAnchorPointVisuals|original|cycleFound|getNodeDistance|27685|setNodeDistance|57348|37573|rotationDiff|nodeSize|92042|reflectionColor3|previousRights|callbackFound|L53|createSvgElement|getBackBrush|worst|80739|autoColumns|27761|maxIterations||layerDistance|03926|calcCrossings|calcUpData|handlePosition|glowColor5|node1GridPos|calcDownData|doFold|62427|intr|doSquarify|doUnfold|rowY|85587|ptLeftTop|previousLefts|setContent|77851|revert|75452|92068|rowFromPoint|node2GridPos|61139|Tetragon|61423749153967|does|masterItem|BowArrow|PointerArrow|setSelectedState|Rhombus|getShapeDecorationBrush|averageNodeSize|NEGATIVE_INFINITY|getShapeDecorationPen|clearInternal|segmentIntersections|offsetFunc|nodeFrom|RevTriangle|Quill|_mf_route|Reversed|writeEffects|writeStyleContent|nodeLeft|setTextPadding|readEffect|writeEffect|PentagonArrow|pt3|readEffects|C85|DoubleArrow|markObstacles|defaultShapesDefined|M76|traitsElement|layerCount|M35|defaultShapes|M65|M24|L78|L73|A20|vertexOrder|adjcCost|prevBridgeTarget|oldRotationAngle|readItemReference|tagValue|leftRes|floatArray|toLowerCase|allMastersProcessed||newSel|rightRes|Decision|writeRectangleF|setTargetElement|nextBridgeTarget|wasOpen|pairElement|colorArray|customEditor|offset1|imagesMap|level2|autoSized|selectNode|A9A9A9|enumerateLevels|maxc|DefaultFlow|rightClasses|POSITIVE_INFINITY|sizeOfV3|maxr|writePointF|shapeDecorationBuilder|invisible|desiredWidthMargins|desiredHeightMargins|leftClasses|sizeOfV2|classIndex|prepareCommands|Slash|85786|M13|supportsAutoScroll|thisNode|RevWithLine|nodeRight|imagePaddingElement|decorationBounds|nodeVicinitySize|routeInternal|RevWithCirc|BackSlash|nodeTop|L64|14214|M85|nodeBottom|C95|DInDelay|Display|getContent|addIncomingLink|DirectAccessStorage|polar|setHandled|HatchHandles3|Cloud|undoEnabled|RoundAndSquare2|xml|RoundAndSquare|animatedLayoutCompleted|InvisibleMove|compareByIndex|drawRoundedPolyline|ConeUp|DiskStorage|FixedWidth|Arcs|ConeDown|Collate|base64|oldDest|drawHatchFrame|ConnectedIssues|leaves|clickedItem|centerY|exchangeStates|closerDistance|CreateRequest|getShowDisabledHandles|currentHeight|DataTransmition|Cube|updateOriginIntersection|updateDestinationIntersection|setTopLevel|match|Cylinder|Database|cellElements|updateObjects|measureCircles|CancelEventArgs|drawSquareHandles|removeOutgoingLink|nearestNode|removeIncomingLink|centerX|rad|Delay|addOutgoingLink|Node|columnElement|getMousePosition|getAdjustmentHandle|DDelay|previousHeight|getMouseButton|Decision2|totalSweep|copyRow|Content|Star16Pointed|Octagon|OfflineStorage|Donut|Star32Pointed|Star24Pointed|OffpageConnection|hyperlinkClicked|Star5Pointed|Star4Pointed|Star7Pointed|OffpageReference|Star6Pointed|serializeTag|MessageToUser|Microform|Merge|MessageFromUser|laneGridCellTextEdited|deserializeTag|Plaque|MultiDocument|MultiProc|MicroformProcessing|MicroformRecording|propertyElements|expand|Sphere|Procedure|Sort|Start|resolverdStyle|Star|Save|PunchedCard|Prysm|Process|RSave|PyramidUp|PyramidDown|drawMinus|Decagon|RightTriangle|Pentagon|Trapezoid|farPointDelta|pointsInCircle|PrimitiveFromCall|PrimitiveToCall|Tape|TransmittalTape|Terminator|getFoldIconSize|ManualOperation|defsElement|DOutDelay|EndLoop|ResizeTopCenter|relax|Document|ExternalOrganization|File|FramedRectangle|focusInput|ExternalProcess|fromCoordString|toCoordString|saveSVG|DividedEvent|rotHandle|svgUrl|contentFile|svgIndex|DividedProcess|getDirection|setDirection|backgroundElement|ResizeMiddleLeft|ResizeBottomCenter|ResizeMiddleRight|Gate|standardShapeReplacement|Interrupt2|previousWidth|hasStrokeDashStyle|Interrupt|getStrokeDashStyle|IsoProcess|hasStroke|LinedDocument|minDistIndex|hasStrokeThickness|Junction|Lightning|getShadowColor|Heptagon|bestShape|currentWidth|Heart|hasShadowColor|Hourglass|InternalStorage|hasFontName|hasTextColor|hasFontStyle|Input|hasFontSize|nextPc|getScrollPosition|stylesMap|writeStyle|readStyle|destinationPoint|fileVersion|labelElements|styleElements|Images|layoutLayer|HeadStrokeDashStyle|HeadShape|sizeDocForItems|imageElements|BaseShape|originPoint|writeEffectContent|routeLinksAt|itemClass|rects|placeRight|topItem|because|effectsMap|zeroWidth|originIndex|destinationIndex|zeroHeight|prevHeight|animationProgress|update|getAnchorFromIndex|instantiateItem|isReflexive|moveLeft|brushElements|Brushes|leftNodePriority|effectsElement|handles||saveItemToXml|mapVirtualNode|xmlClassMap|nodesInLongLink|loadItemFromXml|nodeToLinkMap|brushesMap|Fixed|setTextStyle|rightNodePriority|nodePriority|deleteSelection|n1Priority|n2Priority|moveRight|writeBrushContent|brushes|onItemRemoved|draggingEndPoint|isLinkType|isNodeType|Gradient|nodeLeftClassRef|setLeftBorderPen|anchorId|setMagnifierShape|replayIntervalId|savedState|nodeRightClassRef|saveAsDotnetAttachment|o2layer|attachmentElements|define|pointElements|clayer|setBackgroundBrush|mainItem|timerInterval|onDragOver|onDropOver|nodeOp|containerHit|alignPointToGrid|forEachValue|currNode|setBottomBorderPen|setTopBorderPen|computeClasses|onReplayTimeout|updateContainersZOrder|readRectangleF|setRightBorderPen|clearRuntimeData|svgElements|placeLeft|onStartInteraction|getTitle|Elastic|multiplier|maxDiagonalDistance|svgsMap|getXmlInfo|sortedItems|implement|readEffectContent|widthHeightRatio|squareSize|filteredItems|evalPos|multiplyScalar|LinkShapes|Underline|Linear|o1layer|invalidateDefaultShapes|vpoints|Italic|readColorValue|intValue|BackBow|Exponential|Bold|aHex|Power|approx|hasSwapped|arrangeSquare|memCrossings|glowColor4|setLinkHeadShapeSize|denom|cancelAnimationFrame|alignLastCascadingSegment|temp1|getTopIntr|insertColumn|deleteRowLinks|arrangeCascadingSegments|insertRow|getAllowInplaceEdit|setLinkSegments|setLinkShape|setBackgroundImageContent|setShapeBrush|scrollDown|setLinkBrush|evalRatio|setBackgroundImageUrl|arrangeSiblings|stop|setAllowInplaceEdit|crossAfter|setLinkBaseShapeSize|ctext|updateLinksIndices|polar2|rrSin|xxSin|Xml|fromXmlDocument|continueLoop|polar1|Simple|shadowMatrix|backgroundImageIndex|00001|01|applyTo|ipol1|ipol2|getRoundedLinksRadius|numOfSegments|t1x|t2x|unshift|rarrange|assignInstanceIds|newColumn|temp2|PolylineRenderer|drawLink|oldOrigin|Border3D|t1y|t2y|ratio2|getEffectiveHeadStrokeThickness|selectNodes|getHeadStrokeDashStyle|getHeadStrokeThickness|getEffectiveHeadBrush|getHeadStroke|Type1|getEffectiveHeadStrokeDashStyle|routing|first|bezierTo|putEndPointsAtNodeBorders|minimizeCrossingsDir|getNeighbors|getCommonEdges|getEffectiveBaseBrush|setStrokeThickness|setStroke|alpha2|blackBrush|getImagePadding|setShadowColor|getPointsBounds|attraction|headerElements|updateLabelLayout|setBaseShapeSize|EaseIn|moveToEpsilonCircle|isDescendantOf|intersect|getSpanningCellSize|markCoveredCells|calcWeights|layOutArea|compareValue|crossedLinksToInvalidate|transformRect|LinkBaseShape|maxLength|fixedSpace|scrollUp|LinkHeadShape|closer|covered|writeStringFormat|n1BaryCenter|vdiv|getAllowResizeColumns|balance|hdiv|getOriginIndex|getDestinationIndex|getAllowResizeRows|resizerSize|28318530717959|glowColor1|getLinksFromZ|labelFromPoint|n2BaryCenter|arcTo|System3D|BpmnStartTimer|cLen|Millimeter|traverse|lastItem|cycleGuard|test3EdgeConnectivity|10000|attachTo|LinkFollowsNodesRule|getDescendantNodes|AttachedFollowsMasterRule|ItemFollowsContainerRule|getOrientation|lastLevel|rowStartIndex|PriorityQueue|pathLength|updateSize|getItemsSize|updateAnchorPositions2|nearestFree|calcAnchorVisibility|columnStartIndex|listSize|directedLength|getColumnStart|onHide|onShow|_shapeCanvas|getColumnEnd|targetAsDiagram|removeDragShape|findCutPairs|setEnabledHandles|getHeaderBounds|oldRect|setAnchorPattern|deselectContainedItems|Pixel|componentFromJson|38576250846033|getBoxAt|selectBox|uLen|allowed|pointer|curentSearch|getRowEnd|deps|getRowStart|123233995736766e|getHeadersOnLevel|getting|getExpandable|M17|XML|M39|localCost|XMLHttpRequest|keyUpDelegate|shortName|gridClosed|Draw|status|between|betweenInc|clearLayout|05|drawUnderline|indices|scrollDelegate|processText|collectHeights|collectWidths|angleDelta|send|oldBounds2|newBounds1|newBrth|Array|concat|_mf_transform|decorationsElement|rotated|fromPositionAndSize|decorationFillMode|oldBounds1|decorations|newBounds2|getArcPoint|DeleteSelectedItems|property|canvases|isElliptic|getObstacle|epsilon|offset2|processPathString|setMeasureUnit|classFromTemplate|rightBounds|layoutHeight|scrollPosFromTracker|getBackgroundImage|L98|hitResult|columnsToAdd|setPos|getBackgroundImageAlign|availableHeight|L66|borderPoint|reduce|childEdges|getRuntimeIndex|childResult|sourceWidth|Decrease|addToZOrder|yint|getChildren|childEdge|trackerW|sourceHeight|setTrackerPosition|xint|fixedSizeTotal|findAllPaths|autoSizeTotal|availableSize|rowsToAdd|findShortestPath|minPath|nontreeEdges|sameLow|flag|minWeight|dfsVertex|findLongestPath|availableWidth|recalculateCanvas|layoutWidth|detachSub|getEnabled|001|findCycle|assignCoords|overrideAutoSize|convertPaths|spanCol|spanRow|addedNodes|viewBounds|scrollbarWidth|trackerSize|setObstacle|offsetHeight|clientHeight|strokeText|overflowY|nameMap|sizeElement|||||collectWidthsIf||includeLinks|C83|deleted|ensureNonEmpty|onMouseLeftButtonUp|selectionBounds|intersectsNode|onMouseLeftButtonDown|setAllowIncomingLinks|onChildModified|setAllowOutgoingLinks|removeColumnHeader|removeRowHeader|singleNode|posSec|moveTrackerRectIfExists|childMeasuredWidth|Cells|L37|clearInterval|Component|changeCursor|C10|pathFound|newEdges|childMeasuredHeight|checkAutoScroll|shortestOnly|getZOrder|getActiveItem|onDiagramRepaint|enumCircuitsTarjan|Queue|primary|collectHeightsIf|M30|Columns|secondary|visitNode|arrangeAnimatedComplete|BpmnDataBasedXor|setId|BpmnComplex|raiseHeaderResizing|registerNamespace|itemInSelection|raiseDeselected|shapeDecorationsGroup|bAssistantType|aAssistantType|getRowLevelWidth|routeHeuristics|sizeScale|BeginLoop|dirVect|PathParser|||capHeight|crossingCost|onlySelection|getRowDepth|updateArrowHeadData|Keep|splitPaths|setupOriginConnection|oldPos|addTransform|componentSize|Segment|drawHeaders|setLoopShape|inputState|panPoint|BpmnEndCancel|shouldMoveWithMaster|getThumbRect|BpmnEndCompensation|arrangeCircles|addItemInternal|sep|DontChange|gridHeight|animationsRunning|canResizeLaneHeader|outlineBuilder|gridWidth|renderPhase|Arrow2|tooltipTimeoutId|arrowInterior|270|clientPos|diag|clientBounds|Alternative|Arrow1|Actor|ModificationStart|decorationBuilder|Arrow7|getGraphBounds|resetLinks|Arrow6|targetBounds|Arrow8|Arrow9|startScroll|completeLayout|setPatternId|serverRegistered|Arrow3|getCommonEdge|separators|measureText|updateOutline|Arrow5|Arrow4|ceil|getGridSizeY|BpmnIntermediateMultiple|BpmnIntermediateLink|BpmnIntermediateMessage|candidates|vertexId|||dfsConnectivity|supportsCursors|getHatchFill|getDecorationBrush|bdx|newRotatedBounds|whitePixel|minc|adx|BpmnIntermediateError|getGridSizeX|startBounds|VLen|doubleClickCheck|nextId|getRotatedBounds1|topMiddle|BpmnStartLink|OverLongestSegment|xfactor|BpmnStartRule|BpmnStartMessage|BpmnStartMultiple|BpmnParallelFork|validateParams|BpmnIntermediateRule|gridOffsetLeft|gridOffsetTop|getOutlinePen|handleIndex|getOutlineBrush|setAllowFlip|BpmnIntermediateTimer|getBackColor|setupDestConnection|getNearestSide|reassignLevels|BpmnEndMessage|BpmnEndMultiple|KeepRatio|clearHandlers|getMinWidth|getColumnLevelHeight|getColumnDepth|getEffectiveNodeEffects|ControlPoint|BpmnEndError|setBoundsImpl|setBoundsWithRules2|build|BpmnEndLink|BpmnEndTerminate|vertexCopyToOrigMap|initializeDefault|fixRowConnections|maxRect|minr|grayPen||Pointer|getEnds|changePriority|BpmnEventBasedXor|BpmnInclusive|BpmnIntermediateCompensation|sources|setShapeTransform|BpmnIntermediateCancel|Reassign|getDecorationPen|zoomToRect|setMeasures|arrangeChildOrient|placeRightToLeft|lastNode|rcCurrent|pathNodesBetween|fieldName|intermLinksOnlyToSubtree|relativePoint|childOnPathTo|applyForce|getLengthType|mf_clipboard|setLengthType|intermNodes|raiseValidateAnchorPoint|DynamicLinks|ShowDisabledHandles|ctorFromName|AdjustmentHandlesSize|onItemAdded|gridColumn|loadView|AllowMultipleSelection|dummify|diagramCoords|computeRightClasses|AllDirections|measureMax|maxLayoutIterations|placeLeftToRight|actualWidth|actualHeight|primarySize|secondarySize|raisePasted|assignCoordinates|sizeOfV1|unconnectedLinks|forReverse|enqueue|arrangeAnimated|getNearestAnchorPoint|copyToClipboard|computeLeftClasses|getShowAnchors|pointInInplaceEdit||maxdiff|Circular|combineSequences||selectController|getNeighborOnLayer|setAutoAnchorsNode|nodeLayer|setShowAnchors|placeSingle|makeAcyclic|adjustDirections|timer|compare|getCutPairs|unprocessed|collectDependencies|Bounce|bothEndsDragged|sameOffset|sameSize|translateLinkPoints|keyboardData|mouseData|startWidth|onUpdateCallback|DrawSvgNodes|LinkFreeShapes|LinkSvgNodes|onCustomFunctionCallback|DrawFreeShapes|DrawFreeForms|SelectOnly|RightButton|now|LeftButton|module|DrawContainers|DoNothing|recorded|DrawLinks|inplaceKeyUp|keyup|DeleteActiveItem|onDoubleClick|LinkContainers|isRunning|DrawShapes|LinkTables|DrawTables|getAdjustmentHandlesSize|setGridPointSize|oldCtrRect|setRouteLinks|calcAutoFrame|virtualEndIndex|newCtrRect|onCustomFunction||translation|setGridOffsetY|uiOut|LinkFreeForms|setGridStyle|directions|mouseMoved|controlPointStart|replaceNewItem|rightClass|t3Sizes|sequenceEnd|rootPanel|alignMove|nodeClassRef|isNumber|vnode|Mouse|setGridOffsetX|AllRules|getPointedItem|buttonDownItem|createIdArray|loadTemplate|setModificationStart|magnifyMode|delay|canApplyRule|onCustomFunctionDelegate|leftClass|panMode|GroupRules|wiIn|setGridColor|serializePoints|mouseEvent|setGridSizeY|setGridSizeX|clientToDocLength|NodeFollowsSelectionRule|regIndex|routeRect|setAlignToGrid|setShowGrid|getAllowOutgoing|getAllowIncoming|sortHandles|compareByPosIncreasing|createFocusable|nonRotatedHandlePosition|compareByPosDecreasing|upper|ResizeBottomRight|setDelKeyAction|n22gp|getKeepRootPosition|getLevelDistance|updateZOrder|ResizeTopRight|setLevelDistance|factory||checkDistance|updateFocusable|registerXmlTypes|SubordinateGroup|EnabledHandles|innerScroller|_mf_originalHeight|leftMostVirtualNode|checkKeepInsideParent|maxDistance|skipAuto|originalHandles|nodeIndex|nextVirtualNode|updateRectMove|setLinkType|parser|saveToString|pointVisuals|SelectedOnly|getLinkType|charAt|setProperty|serializer|getMarkStyle|getColor|captionSize|createAnchorPointVisual|Json|getY|getX|setShapePen|touchHandler|setLinkPen|rootCircle|n21gp|n12gp|ResizeBottomLeft|n11gp|RightAndDown|OneLevel|setKeepRootPosition|TopLeft|magnifierFrameDashStops|Cancel|updateManipulators|getShowDeleteButton|IgnoreLayout|TextPadding|getTextPadding|edgeCopyToOrigMap|HyperLink|ZIndex|recalcVirtualScroll|Locked|trackMouseMovement|AutoHandles|branchDistance|clearTooltip|setMarkStyle|ecopy||setAutoHandles|handleMouseMove|tooltipY|tooltipX|solid|onHover|raiseMouseHover|onTooltip|divId|tooltipPoint|setSize|setColor|compareRadius|markSize|rotatePoint|editPoint|trackMouseHover|startHoverTimer|raiseTableColumnResized|raiseHeaderResized|raiseDrawAdjustmentHandles|raiseTableColumnResizing|relativeDistancePoint|ShowDeleteButton|Expanded|DistanceSq|raiseHitTestAdjustmentHandles|setX|Expandable|raiseDeleted|setAllowIncoming|setAllowOutgoing|setY|setColumn|removeFromZOrder|removeFromCollection|hasAssistants|lessThan|getEffectiveFontStyle|deleteLinks|getEffectiveShadowColor|detach|AllowIncomingLinks|Obstacle|distanceSq|AllowOutgoingLinks|Normal|raiseDeleting|RotationAngle|All|updateAnchorVisibility3|r2x|shadowsOnly|ShapePen|DefaultShape|r1x|EaseOut|BackgroundImageUrl|getContentPath|LinkBrush|r1y||r2y|AllowUnconnectedLinks|LinkPen|drawShadows|ShapeBrush|comps|incidentWith|easeInOut|tablesScrollable|EaseInOut|LinkSegments|LinkStyle|NodesExpandable|arrangeChild|random|BackgroundImage|processedProps|sortByIndex|adjacentTo|TablesScrollable|thisRef|visitChildren|RoundedLinksRadius|Foldable|dedummify|EnableLanes|childComponent|AutoSnapDistance|RoundedLinks|UnfoldedSize|createComponent|setDefaults|ExpandOnIncoming|AllowSelfLoops|Folded|Lane|FoldIconSize|dfsCounter|MeasureUnit|repulsion|AllowRemoveChildren|calcSpringForce|drawChildren|RouteLinks|calcRepulsionForce|ClipChildren|shapeText|LinkText|ShapeText|childTemplate|remainsConnectedWithout|AllowAddChildren|linkText|minimizeCrossings|dfs|ulayer|getDescendantLinks|caf|Properties|linksElement|ActiveItem||self|parentArea|layoutRow|__currentSearch|getAbsoluteMaster|attach|loadProperties|minNodeSize|raf|Always|nextElementSibling|Selected|loadedBounds|changeDestination|pat|firstElementChild|updateAnchorVisibility2|Nodes|pointVisual|Links|nodesElement|toXmlDocument|dlayer|raiseChildAdded|raiseChildRemoved|GridSizeX|onDragOut|enumAllCyclesDirected|searchId|EaseOutIn|presorted|GridColor|callbackEnum|GridOffsetY|effectiveMeasuredHeight|willWrap|canWrap|GridSizeY|addNodes|effectiveMeasuredWidth|GridOffsetX|getFoldedBounds|secondPass|setExpanded|updateBounds|getEffectiveEffects|onUpdate|easeOutIn|discardDiagramEffects|inode|LinkBaseShapeSize|ShowGrid|AlignToGrid|saveProperties|allowShrink|LinkHeadShapeSize|swapPairs|GET|statusText|onerror|responseType|Transparent|RotateImage|RotateText|isArray|textContent|mode|xmlElementToPath|registerDefaultShape|responseXML|onload|oldFlipX|__baseType|getBaseType|oldFlipY|transformAndGetPoints|getApproximatingContext|png|AllowFlip|FlipY|FlipX|Fit|getAllowFlip|getFlipY|getFlipX|97584|04845|14359|12605|5845|82551|43967|L35|0983|000002414559|56231|85641|L58|43769|L24|L19|L11|L22|A24|L46|L31|L81|L86|L16|L74|L59|L91|L99|createCell|rowElement|AllowResizeRows|addRoundRect|oldCols|setCaptionHeight|renderCell|Caption|percentPoint|SvgUrl|CaptionFormat|AllowResizeColumns|Scrollable|CurrentScrollRow|removeRowOutgoingLink|removeRowIncomingLink|addRowOutgoingLink|getRowIntersection|firstRow|mid|nRow|deleteRow|deleteColumn|oldRows|canScrollUp|addRowIncomingLink|ignoreRows|canScrollDown|startAngle|rebuild|parseAll|endAngle|svgMatrix|closePath|anticlockwise|addShapeDecoration|KeepHeight|KeepWidth|drawRoundRect|filter|cmdStrings|shapeTransform|exportElement|createDocument|implementation|XMLSerializer|Base64|xmlString|serializeToString|setStrokeDashStyle|nodeEffect|listElement|getFontStyle|_mf_clipCounter|_mf_defsElement|_mf_context|9017|autoScrollIfNeeded|cachedZOrder|FixedScale|shrinkToFit|tryMoveTrackerResizer|targetHeight|targetWidth|addDragShape|getClientPos|success|scaleFont|clientWidth|offsetWidth|scaleStrokeThickness|setAllowZoom|setScaleMode|setScaleFactor|getAutoScrollAmount|raiseTableRowResized|raiseTableRowResizing|enumAllCycles|coef|initialZoomFactor|trackerH|savedScrollX|setDimColor|getBackgroundImageSize|savedScrollY|touchstart|getResizeCursor|setControl|touchmove|escapeHtml|touchcancel|touchend|setAutoArrange|segmentToPolyline|getPivotPoint|maxLines|getControl|OverrideBehavior|setTransform|setPadding|overflowX|getNodes|getPadding|getShapeLibraryLocation|catch|try|parentBreadth|serializeCaptions|nodeSelectedScript|updateLayoutDelegate|addNode|newPos|updateLayout|L48|L52|createDummyShape|L36|L47|M47|M14|raiseSelected|raiseSelectionMoved|selBounds|removeItemInternal|cloneLinks|cloneNodes|selectItemsInRect|C35|C50|C55|C66|C90|A37|M33|52284749830794|M25|M77|522847498307934|228474983079344|L95|C80|insertBefore|calcUnitInterval|calcPixelsPerUnit|setUnit|setGuideColor|setProjectionColor|setForeColor|getSelection|getItems|startHeight|drawProjection|drawCursorProjection|getStandardDivisions|drawMarks|getProjectRotatedBounds|setProjectRotatedBounds|getNegatedY|Control|borderPen|rellativeY|calcScrollPos|setHorizontalScaleVisible|setEnableGuides|setPointerColor|setVerticalScaleVisible|setNegatedY|getNegatedX|setNegatedX|LeftMargin|serializeData|RowCount|TopMargin|HookHeaders|DefaultFont|MinHeaderSize|gridToDiagram|bands|aStar|compareNodes|ColumnCount|Format|setIndex|one|than|removeColumns|itself|onRowHeaderAdded|indirect|direct|ColumnHeights|RowWidths|HeadersOnTop|AllowResizeHeaders|onColumnHeaderRemoved|insertColumns|onColumnHeaderAdded|ady|getSector|createPath|bdy|linkBounds|getNearbyNodes|getNodeIntersections|destCenter|newStyle|oldStyle|mergedNodes|_mf_segments|segmentsFromPoints|pullLinksApart|compareH|compareV|compareY|getSplitGroups|endHorz|startHorz|intervalsIntersect|addBorderSegments|mergeOverlappingNodes|addLinkNodes|removeUturns|compareX|uHorz|nHorz|saveHeaderToXml|getCellFromPoint|hitHeader|Title|TitleFont|TitleColor|RotateTitle|getEffectiveBottomBorderPen|getEffectiveRightBorderThickness|getEffectiveRightBorderPen|getEffectiveBottomBorderThickness|hitTestHeader|testPoint|getHeaderFromPoint|BackgroundBrush|getMinHeaderSize|getRotateTitle|LeftBorderPen|BottomBorderPen|RightBorderPen|TopBorderPen|loadHeaderFromXml|SubHeaders|TitleFormat|serializeSubHeaders|setChildrenHeights|prevWidth|setChildrenWidths|columnEndIndex|addRowHeader|setRowCount|rowEndIndex|drawTopLeftArea|rowLevelCount|columnLevelCount|removeRows|onRowHeaderRemoved|insertRows|getLocalIndex|addColumnHeader|setColumnCount|collectHeaderBounds|getEffectiveBackground|getTotalRowWidthIf|getTotalColumnHeightIf|getEffectiveLeftBorderPen|getEffectiveTopBorderThickness|getEffectiveTopBorderPen|getEffectiveLeftBorderThickness|fillText|textBaseline|getTopLeftAreaText|wrapText|columnWidth|drawCells|drawHeader|oldRow|writeImages|Color2|Color1|readImages|readStyles|writeStyles|section|Angle|Solid|readBrushes|ColorBlend|Colors|Pos|Positions|innerHTML|readSvgContent|writeSvgContent|LineAlignment|writeColorArray|floatValue|stringValue|instantiateEffect|readStyleContent|Styles|writeSvgs|Svg|Svgs|readSvgs|ignoreCaption|resizeToFitText|useScrollBars|hasOwnProperty|220|targetType|TargetType|lastRow|removeRotation|cell2|cellFromPoint|getColumnRect|getCaptionBackBrush|setCaptionBackBrush|writeResources|ClassId|instantiateObject|readResources|writeBrushes|contentWriter|Resources|diagBrush|tableBrush|whiteBrush|Origin|destElement|originElement|Destination|RowSpan|ColumnSpan|TextFormat|getRowSpan|ReflectionColor|UsePenAsGlow|GlowColor|writeObject|raiseSerializeTag|Traits|raiseDeserializeTag|hasValue|readSvg|readObject|InnerOutlineColor|ShadeColor|Opacity|unitsPerPixel|currentState|px3|px1|Type2|isEllipse|getClip|glowColor3|Type4|radius2|Type3|readSizeF|writeSizeF|headShapes|nodeValue|readPointValue|readPoints|writePointCollection|256|colorValue|readColorArray|writeAnchorPattern|AllowOutgoing|AllowIncoming|readAnchorPattern|attachedNode|writeGroup|tagName|trait|Attachment|Attachments|readGroup|themeElement|writeThemeContent|writeTheme|readTheme|iterateNext|evaluate|readThemeContent|getFarPoint|drawMagnifier|drawDashFrame|getSegmentCenter|getNearPoint|drawRoundAndSquareHandles|part|renderer|dashLen|symmetricPoint|MiddleSegment|dash|ptRes2|SquareHandles2|DashFrame|crossing|ptRes1|Invisible|getLongestSegment|getSegmentLength|setMagnifierFrameThickness|HatchFrame|setMagnifierShading|HatchHandles2|setOrigin|setMagnifierWidth|updateNodeCollections|alignCascadingSegments|setDestination|setMagnifierHeight|setMagnifierEnabled|originContainer|setScrollZoneSize|doRoute|setMagnifierFactor|destContainer|segmentPenalty|drawPlus|raiseTreeExpanded|getPatternFill|pointsAlongVector|Follow|completeGraph|applyLayout|debugId|prepareLayout|applyAnimatedLayout|raiseTreeCollapsed|Closed|setShadowOffsetY|setShadowOffsetX|doArrangeLinkLabels|nextToFirstDifferent|getShadowsStyle|onContextMenu|setRightButtonActions|maxDeviation|setUndoEnabled|handleSize|oncontextmenu|getHeadBrush|nearestPointIndex|attractThreshold|setHeadStrokeDashStyle|setHeadStrokeThickness|setHeadStroke|pointsToTry|arrangeLinkLabel|labelRect|nextToLastDifferent|negate|divideScalar|getBaseShape|setMagnifierFrameColor|getCrossingRadius|quality|getBaseShapeSize|raiseFolded|lsc|rrect|MiddleSegmentRotated|pointInHandle|lrect|rcLink|calcPointBounds|getBaseBrush|getHeadShapeSize|pointEqualEpsilon|pointIndex|setMiddleButtonActions|setMagnifierSecondaryFrameColor|hlen|vlen|setLeftButtonActions|getHeadShape|raiseUnfolded|cancelCompositeOperation|OriginAnchor|getOldText|HeadStroke|MaxWidth|AutoArrange|controlPoint|resetVirtualScroll|segmentStart|drawWithCrossings|DestinationAnchor|EnableWrap|HorizontalAlign|setControlPoints|VerticalOffset|getTextStyle|SplineShape|Labels|HeadStrokeThickness|Label|VerticalAlign|CascadeStartHorizontal|onDragOverNode|Dynamic|getComponent|onDropOverNode|DestinationRow|TextStyle|setShowLaneGrid|getContainer|getCrossings|AutoRoute|getItem|setCustomLinkType|HeadBrush|BaseBrush|OriginRow|setVirtualScroll|BaseShapeSize|HeadShapeSize|setTheme|setCustomNodeType|getNewText|sameNode|updateTargetConnection|buildNodeMap|getUnionBounds|endItemChange|setAutoResize|filterByPosition|triPoints|getNearestNode|setLinkHitDistance|canceledPoints|compareZ|that|HorizontalOffset|RelativeTo|useTargetPoint|getAbsoluteNodeMaster|originalPoint|collectHierarchyInfo|setAutoScroll|baseline|startItemChange|setStartPoint|degrees|ORDERED_NODE_ITERATOR_TYPE|getLineHitTest|getDirty|setEndPoint|importNode|AlignLastCascadingSegment|isConnected|boolean|raiseIfNotSerializable|colorStringToHex|Unit|isFloat|setCenter|resizeToFitItems|MainItem|writeImageContent|Percents|getData|Data|routed|ap2|ap1|angleBetween|XPathResult|cutToClipboard|getControlPoints|MIN_VALUE|PrevRect|True|setData|attributes|getNamedItem|pasteFromClipboard|Key|IsTraits|Pair|InContainer|setAttibute|ContainmentKeys|Split|Never|Lines|BottomRight|512|1023|Crosses|ZOrder|Pen|search|Spline|AfterOutline|Cut|updatePointData|customDrawArgs|Cursors|List|getToolTip|setToolTip|TopCenter|MiddleRight|BottomLeft|BottomCenter|TopRight|MiddleLeft|MiddleCenter|parseFromString|setLocked|getGraphicsContent|String|setHyperLink|getHyperLink|setRequestHeader|POST|getTextComponent|itemRemovedScript|atan2|RegExp|Regular|replace|setTextStrokeThickness|getTextStrokeThickness|getPen|DOMParser|setTextStroke|getTextStroke|setWeight|getIgnoreLayout|bezierCurveTo|loadFromString|setTooltip|getTooltip|setIgnoreLayout|application|defaultPoint|addRow|addColumn|getSegmentIntersection|getCaptionFont|setCaptionFont|properties|getCellFrameStyle|setCellFrameStyle|clipToBounds|Unable|getConnectionStyle|setConnectionStyle|setDynamic|varsion|setOriginIndex|getAutoRoute|setAutoRoute|getDynamic|setDestinationIndex|addLabel|removeLabel|keepCellWidth|registered|createTextNode|initDefault|DiagramStyle|getSiftingRounds|setSiftingRounds|viewBox|getLayerDistance|setLayerDistance|defs|setNodeEffects|Tooltip|getPosition|iLr|setFontStyle|iKr|hasBackBrush|rowObject|parseSvg|CardinalSpline|Link|and|Exception|decode|View|documentElement|exportString|getCurvePoints|writeSvg|encode|getAutoScroll|ollectLeaves|getScrollZoneSize|setRoundedLinksRadius|getShowGrid|getAutoResize|getMagnifierEnabled|getRoot|setRoot|getMagnifierHeight|renderData|getMagnifierFactor|getMagnifierWidth|getTooltipDelay|getGridOffsetX|directTo|getCommonVertex|joins|getGridOffsetY|createReverseEdge|setCrossingRadius|getGridColor|setRoundedLinks|reversed|getLinkHitDistance|setLinkCrossings|setTopMargin|getTopMargin|setLeftMargin|setTopLeftAreaStyle|getTopLeftAreaStyle|setMinHeaderSize|getLeftMargin|get3EdgeConnectedComponents|getMagnifierShape|getRowHeaders|replay|getMagnifierFrameThickness|getMagnifierShading|setColumnHeadersHeights|getColumnHeadersHeights|setRowHeadersWidths|drawLast|drawFirst|Recording|getRowHeadersWidths|getHookHeaders|setTopLeftAreaText|getBiconnectedComponents|setHeadersOnTop|getHeadersOnTop|setHookHeaders|getCustomNodeType|getCustomLinkType|getGridPointSize|setResizeType|prm|getTheme|getVirtualScroll|getAllowResizeHeaders|getDuration|setDuration|getGridStyle|setTooltipDelay|setAllowResizeHeaders|setExpandOnIncoming|getExpandOnIncoming|registerDisposableObject|exports|amd|Common|getProgress|acos|setRotateTitle|setTitle|setNodesExpandable|getNodesExpandable|toptBorderThickness|oRequestAnimationFrame|msRequestAnimationFrame|webkitCancelAnimationFrame|getColumnIndex|webkitRequestAnimationFrame|mozRequestAnimationFrame|mozCancelAnimationFrame|IDisposable|getCellRow|getCellColumn|oCancelAnimationFrame|msCancelAnimationFrame|Sys|setAnimationType|getParam|setParam|setFromValue|setToValue|getAnimationType|getRowIndex|setRepeat|getReverse|setReverse|getEasingType|setEasingType|getRepeat|getColumnHeaders|setReflectionColor|getReflectionColor|setUsePenAsGlow|getDynamicLinks|baseShapeObj|setScroll|getUsePenAsGlow|963|857|037|setGlowColor|getGlowColor|setType|getCommands|setInnerOutlineColor|getInnerOutlineColor|DistanceToSegment|getModificationStart|getAutoHandlesItem|setShadeColor|headShapeObj|getRouteLinks|setDynamicLinks|getShadeColor|setOpacity|getOpacity|getEffectivePen|setZoomFactorPivot|setScrollY|300|addEllipse|DestinationRelative|setScrollX|AutoSnapToNode|getIterations|setIterations|setRowSpan|setColumnSpan|SegmentCount|setZoomLevel|getLayoutArea|setLayoutArea|HeadPen|getSquarify|setSquarify|getContainerPadding|zoomToFit|all|edgeTo|setContainerPadding|raduis1|OriginRelative|getMiddleButtonActions|getRightButtonActions|setShadowsStyle|getModifierKeyActions|getLeftButtonActions|record|arrangeLinkLabels|setTurnCost|getNodeVicinityCost|setNodeVicinityCost|InvalidOperationException|getBehavior|getTurnCost|getMagnifierFrameColor|getColumnLevelCount|getRowLevelCount|getCellBounds|getRowHeaderBounds|getColumnHeaderBounds|generator|stopRecording|findBlockSeparationPairs|findBlockSeparationPairsB|findRow|findColumn|getMagnifierSecondaryFrameColor|getAllowUnconnectedLinks|setAllowMultipleResize|getAllowMultipleResize|setLinkTextStyle|getLinkTextStyle|setAllowUnconnectedLinks|boundingRect|setLinkRouter|getLinkRouter|distanceToSegment|routeAllLinks|setRouteMargin|getRouteMargin|setCrossingCost|getNodeVicinitySize|setNodeVicinitySize|getLengthCost|setLengthCost|getCrossingCost|getGridSize|drawImage|setShowDisabledHandles|setAdjustmentHandlesSize|setGridSize|popMin||dequeue|itemAddedScript|88098|61074|findAllCycles|canMoveLink|getNodeRect|38926|55283|L97|11902|display|L79|getScaleFactor|getScaleMode|getLineDash|94214|getDimColor|getAllowZoom|447174|drawCallback|41986|_tooltip|startPts|dddddd|segmentEnd|5000|onMagnify|beginEdit|M84|_verticalScale|C26|_horizontalScale|lightSteelBlue|zoomChanged|Percent|M60|block|58014|endPts|defaultFont|99999999999998|C25|30127018922194|updateScale|M75|09158|Layouts|linkCreatingScript|preserve|nodeModifyingScript|nodeModifiedScript|05786|getColumns|nodeCreatingScript|getRows|linkCreatedScript|90843|setMinVisibleFontSize|operate|setTargetView|setFoldIconSize|pageYOffset|getDefaultProperty|linkModifyingScript|linkModifiedScript|getDefaultValue|setDefaultProperty|grouping|createImageData|30581|autoHeight|putImageData|nodeClickedScript|_mf_links|7464|59885|5093|69418|L71|800|nodeCreatedScript|nwse|onMouseLeave|40115|253604|setZoomFactorAndScroll|4907|getClipChildren|linkClickedScript|setClipChildren|rectFromPoints|getClosed|platform|navigator|C49|C58|foreground|dragOffset|dragInitialPos|createDiagramLink|mac|M67|5C87B2|identifier|_inplaceInput|must|textarea|onkeyup|C37|getLinks|setClosed|ArgumentException|getVerticalScaleVisible|selectSingle|L94|pointedHandle|2403876506104|createShapeNode|NotAllowed|getNodesAt|getItemsAt|getLinksAt|getHorizontal|getLinkAt|checkIntersect|getElement|getObject|minDistToRect|createSvgNode|getPropertyName|31759111665348|unionRects|M44|createContainerNode|createTableNode|unique|38576250846034|7763568394002505e|477152501692064|999999999999998|105427357601002e|radianToDegree|getGuideColor|C67|getProjectionColor|getForeColor|477152501692068|C16|M28|join|setRect|setAdjustmentHandle|getNode|getUnit|C20|eval|getHyperlink|getLink|isRegistered|C38|C91|offsetPointCollection|decision2In2Out|C21|assignId|allowLinkDirection|getHorizontalScaleVisible|yellow|getRegIndex|TopInBottomOut|topInBottomOut|getEnableGuides|endEdit|getPointerColor|LeftInRightOut|decision1In3Out|Decision2In2Out|Decision1In3Out|C96|leftInRightOut|selectionModifyingScript|setVerticalAlign|getHorizontalAlign|drawForeground|getFactory|M74|sizeChangedScript|getShapes|getVerticalAlign|setHorizontalAlign|Alternate|tableRowResizedScript|getDelKeyAction|nodePointedScript|linkPointedScript|getAutoArrange|tableRowResizingScript|tableColumnResizedScript|visuals|setMargin|getAnchorPointPos|containerChildRemovedScript|containerChildAddedScript|getLinkSegments|linkTextEditedScript|setSegmentPosition|getAnchorRect|nodeTextEditedScript|setControlPointPosition|stringDrawn|getLinkShape|getMargin|repaintScript|containerFoldedScript|containerUnfoldedScript|cellTextEditedScript|DIV|tabIndex|_focusable|initializeNodeScript|getShapePen|getShapeBrush|getClosestSegmentPoint|getAnchorPattern|getExpanded|setFreeFormAttractDistance|getAutoCloseDistance|updatePositions|getFreeFormAttractDistance|getLinkBrush|getFitTextStep|linkSelectedScript|linkDeselectedScript|firstChild|readyState|getLinkPen|arcToBezierCurves|nodeDeselectedScript|CANVAS|treeCollapsedScript|nodePastedScript|getLinkBaseShape|headerStartResizingScript|linkDoubleClickedScript|miter|initializeLinkScript|Arc|treeExpandedScript|setLinkLengthPosition|linkPastedScript|getFreeFormTargets|setFreeFormTargets|setAutoCloseDistance|nextSibling|quad|setHandlesStyle|nodeDoubleClickedScript|trim|getDefaultShape|getSizeRect|contain|linkDeletedScript|setAllowAddChildren|getAllowAddChildren|which|nodeDeletedScript|leaveInplaceEditScript|nodeDeletingScript|getAllowSelfLoops|getAllowRemoveChildren|getAllowIncomingLinks|related|setIconSize|getIconSize|have|getLinkBaseShapeSize|setAllowSelfLoops|getUnfoldedSize|setAllowRemoveChildren|getComponents|enterInplaceEditScript|getOutgoingLinks|magnifyTimeoutId|exec|pageXOffset|hitTestAdjustmentHandlesScript|clickedScript|getIncomingLinks|headerResizedScript|fromCenterAndSize|getBackgroundImageUrl|_element|setBackgroundImageAlign|groups|cyclic|raiseInitialize|diagrams|with|getBackgroundImageContent|getLinkHeadShapeSize|distToRectPoint|lastClick|altKey|8c8c96|tableColumnResizingScript|rightButtonDownPosDev|rightButtonDownPos|pathCopy|itemTestForDoubleClick|getRotateImage|containerChildAddingScript|collectHyperlinks|getShift|setShift|getAlt|getRotateText|shiftKey|setAlt|containerChildRemovingScript|leftButtonDownPosDev|are|3366CC|getTransparent|getLinkHeadShape|getAllowOutgoingLinks|setDefaultNodeSize|getDefaultNodeSize|selectItem|them|getPolygonIntersection|leftButtonDownPos|doubleClick|linkDeletingScript|drawAdjustmentHandlesScript|createEditControlScript|getEffects|_mf_minVisibleFontSize|lastMouseUp'.split('|'),0,{}))
;
var MindFusionDiagram = (function () {
  var Diagram = MindFusion.Diagramming.Diagram;
  var _State = {
    latestRecordGuid: '',
    _instances: [],
    getCurrentInstance: function () {
      if (PropertyCardSection.GetActiveTab().name == "Chart")
        return this._instances.find(x => x.instanceName == 'diagramWorkflow');
      else
        return this._instances.find(x => x.instanceName == 'diagram');
    },
    getCurrentDiagram: function () {
      return Diagram.find(this.getCurrentInstance().instanceName);
    },
    find: function (el) {
      return this._instances.find(x => x.instanceName == el);
    }
  };
  var createOrUpdateDiagram = function (objectId, recordGuid, versionIndex, _id) {
    if (_State.latestRecordGuid != AppV.GetGlobals().RecordGuid)
      _State._instances = [];
      var el = AppV.GetGlobals().isMainWindow?_State.find(_id):null; 
    _State.latestRecordGuid = AppV.GetGlobals().RecordGuid;
    if (!el) {
      var objToPush = {
        _instance: MindFusion.AbstractionLayer.createControl(Diagram, null, null, null, $("#" + _id)[0]),
        instanceName: _id,
        objectId: objectId,
        recordGuid: recordGuid,
        versionIndex: versionIndex
      };

      var index = _State._instances.push(objToPush) - 1;
      setLicense(index);
      return _State._instances[index];
      }
    return el;
  }
  var setLicense = function (index) {
    return _State._instances[index]._instance.setLicenseKey(enums.Private.key);
  }
  var postRequest = function (diagram, res) {
    diagram.loadFromString(res.diagram);
    diagram.setZoomFactor(AppV.GetAdditionalInfo().selectedProcessHistoryZoom);
    diagram.enabled = false;
    diagram.setLeftButtonActions(MindFusion.Diagramming.MouseButtonActions.None);
    diagram.setMiddleButtonActions(MindFusion.Diagramming.MouseButtonActions.None);
    diagram.setRightButtonActions(MindFusion.Diagramming.MouseButtonActions.None);
    window.loadingPanel.Hide();
  }

  var ChangeZoom = function (zoomFactor, reset = false) {
    var diagram = _State.getCurrentDiagram();
    if (!diagram)
      return;
    var zoomToCalc = diagram.zoomFactor + zoomFactor;
    if ((zoomToCalc <= 200 && zoomToCalc > 19) || reset) {
      var zoom = reset ? 100 : zoomToCalc;
      AppV.PushAdditionalInfo("selectedProcessHistoryZoom", zoom);
      diagram.setZoomFactor(zoom);
    }
  }

  return {
    init: function (objectId = null, recordGuid = null, versionIndex = null, _id = 'diagram') {
      var allowed = ["Chart", "History"];
      if (!allowed.includes(AppV.GetPropertyTabsState().ActiveTab))
        return;
      var diagram = createOrUpdateDiagram(objectId, recordGuid, versionIndex, _id);
      var objToSend = (objectId != null) ?
        { type: "POST", url: "/Processes/GetHistoryDiagram/", data: { objectId, recordGuid, versionIndex } }
        : { type: "POST", url: "/Processes/GetDiagram/", data: { objectId: AppV.GetGlobals().ObjectId } };

      Request.ajax(objToSend, false).then(res => postRequest(diagram._instance, res));
    },
    zoomIn: function () {
      ChangeZoom(10);
    },
    zoomOut: function () {
      ChangeZoom(-10);
    },
    resetZoom: function () {
      ChangeZoom(100, true);
    }
  }
})();;
var DlhSoft;"undefined"===typeof DlhSoft&&(DlhSoft={assemblies:[],buildReleaseDate:new Date(1,0,1)});DlhSoft.assemblies.push({assembly:"DlhSoft.ProjectData.GanttChart.HTML.Controls",company:"DlhSoft",product:"Project Data Modern Library",version:"5.3.14.0",copyright:"Copyright \u00a9 2012-2019 DlhSoft",title:"Project Data Gantt Chart HTML Controls",description:"Project Data Gantt Chart related HTML client components"});
DlhSoft.buildReleaseDate=function(O,K,X){O=new Date(O,K-1,X);return O>DlhSoft.buildReleaseDate?O:DlhSoft.buildReleaseDate}(2019,8,17);var _0x5c25="Licensing{undefined{string{DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase.{.{length{license{push{type{content{:{lastIndexOf{substr{buildReleaseDate{charCodeAt{pow{toUpperCase{DlhSoft Component Licensing Warning{http://DlhSoft.com/Purchase.aspx{?Assemblies={,{http://www.componentsource.com/features/dlhsoft{ (version {){This component is currently licensed to be used for testing purposes only{The component is part of this assembly{To purchase a standard license for a product that includes this assembly you can use the Purchase page{ownerDocument{div{createElement{style{position: absolute; left: 24px; top: 24px; width: 480px; display: block; z-index: 1; color: Black; background-color: #ffffc0; border: solid 1px Blue; overflow: auto{setAttribute{padding: 6px; padding-top: 8px; font-family: Arial; font-size: small{font-weight: bold; margin-bottom: 4px{appendChild{createTextNode{color: Red; margin-top: 2px; margin-bottom: 2px{margin-top: 4px{a{color: Blue; text-decoration: underline{href{target{_blank{Purchase license{margin-left: 4px; color: Blue; text-decoration: underline{javascript://{Continue trial{click{removeChild{addEventListener{\n\n{: {:\n".split("{");
void 0==DlhSoft[_0x5c25[0]]&&(DlhSoft[_0x5c25[0]]=function(){var O=_0x5c25[1],K=_0x5c25[2],X=[],ca=[],na=_0x5c25[3],fa=function($,P){if(typeof $!==K||typeof P!==K)return!1;if(P==na)return!0;var W=P[_0x5c25[11]](_0x5c25[10]);if(0<=W){var Q=P[_0x5c25[12]](0,W),I,G=Q[_0x5c25[11]](_0x5c25[10]);if(0<=G)try{I=new Date(parseInt(Q[_0x5c25[12]](G+1)))}catch(V){}typeof I===O&&(I=new Date(2013,11,31));if(DlhSoft[_0x5c25[13]]>I)return!1;Q=Q+_0x5c25[10]+$;for(i=I=0;i<Q[_0x5c25[5]];i++)G=Q[_0x5c25[14]](i),I=(I<<
5)-I+G,I&=I;0>I&&(I=Math[_0x5c25[15]](2,32)-I);Q=I.toString(16)[_0x5c25[16]]();W=P[_0x5c25[12]](W+1);if(Q==W)return!0}return!1},S=function(K,P,W,Q,I){var G=_0x5c25[17],V=_0x5c25[18],U=typeof ComponentSource===O||!ComponentSource?V+_0x5c25[19]+Q+_0x5c25[20]+I:_0x5c25[21],S=Q+_0x5c25[22]+I+_0x5c25[23],N=_0x5c25[24],r=_0x5c25[25],k=_0x5c25[26];setTimeout(function(){var j=K[_0x5c25[27]],m=j[_0x5c25[29]](_0x5c25[28]);m[_0x5c25[32]](_0x5c25[30],_0x5c25[31]);var p=j[_0x5c25[29]](_0x5c25[28]);p[_0x5c25[32]](_0x5c25[30],
_0x5c25[33]);var s=j[_0x5c25[29]](_0x5c25[28]);s[_0x5c25[32]](_0x5c25[30],_0x5c25[34]);p[_0x5c25[35]](s);s[_0x5c25[35]](j[_0x5c25[36]](G));p[_0x5c25[35]](j[_0x5c25[36]](N+_0x5c25[10]));s=j[_0x5c25[29]](_0x5c25[28]);s[_0x5c25[32]](_0x5c25[30],_0x5c25[37]);s[_0x5c25[35]](j[_0x5c25[36]](P));p[_0x5c25[35]](s);p[_0x5c25[35]](j[_0x5c25[36]](r+_0x5c25[10]));s=j[_0x5c25[29]](_0x5c25[28]);s[_0x5c25[32]](_0x5c25[30],_0x5c25[37]);s[_0x5c25[35]](j[_0x5c25[36]](S));p[_0x5c25[35]](s);p[_0x5c25[35]](j[_0x5c25[36]](k+
_0x5c25[10]));s=j[_0x5c25[29]](_0x5c25[28]);s[_0x5c25[32]](_0x5c25[30],_0x5c25[38]);var v=j[_0x5c25[29]](_0x5c25[39]);v[_0x5c25[32]](_0x5c25[30],_0x5c25[40]);v[_0x5c25[32]](_0x5c25[41],U);v[_0x5c25[32]](_0x5c25[42],_0x5c25[43]);v[_0x5c25[35]](j[_0x5c25[36]](_0x5c25[44]));s[_0x5c25[35]](v);v=j[_0x5c25[29]](_0x5c25[39]);v[_0x5c25[32]](_0x5c25[30],_0x5c25[45]);v[_0x5c25[32]](_0x5c25[41],_0x5c25[46]);v[_0x5c25[35]](j[_0x5c25[36]](_0x5c25[47]));v[_0x5c25[50]](_0x5c25[48],function(){K[_0x5c25[49]](m);ca[_0x5c25[7]](W)},
!1);s[_0x5c25[35]](v);p[_0x5c25[35]](s);m[_0x5c25[35]](p);K[_0x5c25[35]](m)},0);setTimeout(function(){alert(G+_0x5c25[51]+N+_0x5c25[52]+P+_0x5c25[51]+r+_0x5c25[53]+S+_0x5c25[51]+k+_0x5c25[4])},6E5)};return{setLicense:function(K,P){X[_0x5c25[7]]({type:K,content:P})},validate:function($,P,W,Q,I,G,V){for(var P=P+_0x5c25[4]+W,U=0;U<ca[_0x5c25[5]];U++)if(ca[U]==P)return;a:if(typeof G!==K&&typeof V!==O&&(V[_0x5c25[6]]!==O&&(G=V[_0x5c25[6]]),typeof V===K&&(G=V)),typeof G!==K)for(V=0;V<X[_0x5c25[5]];V++)if(U=
X[V],U[_0x5c25[8]]==P&&typeof U[_0x5c25[9]]===K){G=U[_0x5c25[9]];break a}fa(P,G)?$[_0x5c25[6]]=G:S($,W,P,Q,I)}}}());void 0==DlhSoft.Controls&&(DlhSoft.Controls={});
void 0==DlhSoft.Controls.GanttChartView&&(DlhSoft.Controls.GanttChartView=function(){var O=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],K=["January","February","March","April","May","June","July","August","September","October","November","December"],X=[31,28,31,30,31,30,31,31,30,31,30,31],ca=new Date(2592E5),na=new Date(3155762592E5),fa=function(a,d,c,b){if(typeof a.ownerDocument.createElementNS==="undefined"||typeof a.ownerDocument.addEventListener==="undefined")alert("The required HTML5 features are not supported by the application host. Some features will be unavailable. Consider upgrading.");
else{var e=["DlhSoft.Controls","GanttChartView","DlhSoft.ProjectData.GanttChart.HTML.Controls","5","validate","Licensing"];DlhSoft[e[5]][e[4]](a,e[0],e[1],e[2],e[3],b,c);a.isInitializing=true;typeof a.settings!=="undefined"&&typeof a.settings.toggleButtonAreaWidth!=="undefined"&&delete a.settings.toggleButtonAreaWidth;if(typeof a.items!=="undefined")for(b=0;b<a.items.length;b++)delete a.items[b].successors;typeof c!=="object"&&(c={});W(d,c);P(c,d,a);wc(a,d,c);b=c.columns;e=c.scales;xc(b,a,c);oa(d,
a);da(d,c,a);if(typeof c.visibilityFilter!=="undefined"){yc(d,c.visibilityFilter);for(var f=0,g=0;g<d.length;g++){var l=d[g];if(typeof l.ganttChartItems!=="undefined"){if(!l.isHidden)l.scheduleChartVisibilityIndex=f++;for(var h=0;h<l.ganttChartItems.length;h++){var o=l.ganttChartItems[h];if(l.isHidden)o.isHidden=true;o.displayRowIndex=l.scheduleChartVisibilityIndex}}}}var n=Q(a,d,c),t=a.ownerDocument,f=t.createElement("div");f.setAttribute("style","font-family: Arial; font-size: small; overflow: auto");
g=t.createElement("div");typeof c.containerClass!=="undefined"&&g.setAttribute("class",c.containerClass);typeof c.containerStyle!=="undefined"&&g.setAttribute("style",c.containerStyle);f.appendChild(g);l=t.createElement("div");l.setAttribute("style","border: solid 1px "+c.border+"; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; overflow: auto");g.appendChild(l);var w=
t.createElement("div");w.setAttribute("style","overflow: auto; float: left; border-right: solid 1px "+c.border+"; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; width: "+c.gridWidth);c.isGridVisible&&l.appendChild(w);var u=t.createElement("div");u.setAttribute("style","overflow: auto; float: right; width: "+c.chartWidth);l.appendChild(u);var D=t.createElement("div");D.setAttribute("style","position: relative; opacity: 0; left: 0px; width: "+c.splitterWidth+"px; height: 0px; background: "+
c.splitterBackground+"; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; cursor: e-resize; -ms-touch-action: pinch-zoom; touch-action: auto");D.addEventListener("mouseover",function(){D.style.opacity=1;D.isWaiting!=="undefined"&&delete D.isWaiting},true);D.addEventListener("mouseout",function(){if(typeof D.isWaiting==="undefined"){D.isWaiting=true;setTimeout(function(){if(typeof D.isWaiting!=="undefined"){delete D.isWaiting;if(typeof D.x==="undefined")D.style.opacity=
0}},1E3)}},true);D.addEventListener("mousedown",function(a){if(a.button==0){D.style.opacity=1;D.x=a.clientX;D.gridWidth=w.offsetWidth}},true);t.addEventListener("mousemove",function(b){if(typeof D.x!=="undefined"&&!(a.offsetWidth<=0)){var b=D.gridWidth+(b.clientX-D.x),d=a.offsetWidth-b-3,l=Math.max(1,c.minGridWidth),e=Math.max(1,c.minChartWidth);if(b<l){d=d-(l-b);b=l}else if(d<e){b=b-(e-d);d=e}b<1&&(b=1);d<1&&(d=1);typeof w.percent!=="undefined"&&delete w.percent;b=Math.floor(b*1E6/a.offsetWidth)/
1E4;w.style.width=b+"%";u.style.width=100-b+"%";c.gridWidth=w.offsetWidth+"px";c.chartWidth=u.offsetWidth+"px";Ea(D,w,c);typeof c.splitterPositionChangeHandler!=="undefined"&&setTimeout(function(){c.splitterPositionChangeHandler(w.offsetWidth,u.offsetWidth)},0)}},true);t.addEventListener("mouseup",function(){if(typeof D.x!=="undefined"){delete D.x;D.style.opacity=0}if(DlhSoft.Controls.ToolTip&&c.useUpdatingToolTips)(toolTip=a.toolTip)&&toolTip.hide()},true);c.isGridVisible&&c.isSplitterEnabled&&l.appendChild(D);
g=t.createElement("div");g.setAttribute("style","float: right; background: "+c.headerBackground+"; width: 0px; height: "+c.headerHeight+"px");w.appendChild(g);l=t.createElement("div");l.setAttribute("style","overflow: hidden; background: "+c.headerBackground+"; border-bottom: solid 1px "+c.border+"; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; height: "+c.headerHeight+"px");w.appendChild(l);h=t.createElement("div");h.setAttribute("style","float: right; background: "+
c.headerBackground+"; width: 0px; height: "+c.headerHeight+"px");u.appendChild(h);o=t.createElement("div");o.setAttribute("style","overflow: hidden; background: "+c.headerBackground+"; border-bottom: solid 1px "+c.border+"; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; height: "+c.headerHeight+"px");u.appendChild(o);var q=t.createElement("div");q.setAttribute("style","overflow-x: "+(typeof c.isExport==="undefined"||!c.isExport?"scroll":"hidden")+"; overflow-y: "+
(typeof c.isExport==="undefined"||!c.isExport?"auto":"hidden")+"; height: "+n);w.appendChild(q);var J=t.createElement("div");J.setAttribute("style","overflow-x: "+(typeof c.isExport==="undefined"||!c.isExport?"scroll":"hidden")+"; overflow-y: "+(typeof c.isExport==="undefined"||!c.isExport?"auto":"hidden")+"; height: "+n);u.appendChild(J);var n=hb(b),k=t.createElement("div");k.setAttribute("style","background: "+c.headerBackground+"; border-bottom: solid 1px "+c.border+"; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; width: "+
n+"px; overflow: hidden; height: "+c.headerHeight+"px");l.appendChild(k);var j=t.createElement("div");j.setAttribute("style","float: left; width: "+n+"px; overflow: auto"+(c.horizontalGridLines?"; border-bottom: 1px solid "+c.horizontalGridLines+"; margin-bottom: -1px; ; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box":""));q.appendChild(j);if(typeof c.extraSpaceHeight!=="undefined"){var m=t.createElement("div");m.setAttribute("style","overflow: hidden; width: "+
n+"px; height: "+c.extraSpaceHeight+"px");q.appendChild(m)}var s=H(c.timelineFinish,c),p=t.createElement("div");p.setAttribute("style","background: "+c.headerBackground+"; border-bottom: solid 1px "+c.border+"; -wekbit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; width: "+s+"px; height: "+c.headerHeight+"px");o.appendChild(p);var v=t.createElement("div");v.setAttribute("style","float: left; overflow: hidden; width: "+s+"px; height: 0px");J.appendChild(v);var x=t.createElementNS("http://www.w3.org/2000/svg",
"svg");x.setAttribute("style","width: "+s+"px; height: 0px");n=c.styleDefinitionTemplate(a);x.appendChild(n);x.chartAreaDefinitions=n;n=t.createElementNS("http://www.w3.org/2000/svg","g");x.appendChild(n);v.chartAreaAlternativeRows=n;n=function(){setTimeout(function(){try{var a=v.chartArea,b=a.chartAreaDefinitions;a.removeChild(b);a.childNodes.length>0?a.insertBefore(b,a.childNodes[0]):a.appendChild(b)}catch(c){}},0)};x.addEventListener("mousedown",n,true);t.addEventListener("mouseup",n,true);a.resetChartAreaDefinitions=
n;v.appendChild(x);v.chartArea=x;if(typeof c.extraSpaceHeight!=="undefined"){n=t.createElement("div");n.setAttribute("style","overflow: hidden; width: "+s+"px; height: "+c.extraSpaceHeight+"px");J.appendChild(n);J.chartExtraSpace=n}var r,B,y;setTimeout(function(){r=a.offsetWidth;B=a.offsetHeight;y=u.offsetHeight},0);typeof a.splitterUpdateTimer!=="undefined"&&clearInterval(a.splitterUpdateTimer);a.splitterUpdateTimer=setInterval(function(){try{if(typeof D.x==="undefined"&&!(a.offsetWidth<=0)){var b=
a.offsetWidth,d=u.offsetHeight,l=screen.deviceXDPI;if(b!=r||l!=screen.deviceXDPI){var e=typeof w.percent!=="undefined"?w.percent*b:w.offsetWidth,h=u.offsetWidth,f=Math.max(1,c.minGridWidth),o=Math.max(1,c.minChartWidth);if(e<f){h=h-(f-e);e=f}else if(h<o){e=e-(o-h);h=o}e<1&&(e=1);h<1&&(h=1);var n=Math.floor(e*1E6/b)/1E4;w.percent=n/100;w.style.width=n+"%";u.style.width=100-n+"%";c.gridWidth=w.offsetWidth+"px";c.chartWidth=u.offsetWidth+"px";Ea(D,w,c);if(typeof c.splitterPositionChangeHandler!=="undefined"){var g=
w.offsetWidth,t=u.offsetWidth;g>0&&t>0&&setTimeout(function(){c.splitterPositionChangeHandler(g,t)},0)}r=b;B=d}else if(d!=y){Ea(D,w,c);y=d}}}catch(q){try{clearInterval(a.splitterUpdateTimer)}catch(J){}}},100);typeof a.heightUpdateTimer!=="undefined"&&clearInterval(a.heightUpdateTimer);a.heightUpdateTimer=setInterval(function(){try{if(!(a.clientHeight<=0)){var b=a.clientHeight;if(b!=B){var l=Q(a,d,c);q.style.height=l;J.style.height=l;Ea(D,w,c);if(J.style.height!="auto")v.availableHeight=J.clientHeight;
va(v,wa(d,c));xa(d,J,c);B=b}}}catch(e){try{clearInterval(a.heightUpdateTimer)}catch(h){}}},100);var A=function(a,b,l,e,h,f){var o;if(c.mouseHandler||c.mouseMoveHandler&&f=="mousemove"||c.mouseDownHandler&&f=="mousedown"||(c.clickHandler||c.itemClickHandler||c.chartClickHandler||c.chartItemClickHandler)&&f=="click"||(c.doubleClickHandler||c.itemDoubleClickHandler||c.chartDoubleClickHandler||c.chartItemDoubleClickHandler)&&f=="dblclick"){var n=a.which;!n&&a.button&&(a.button&1?n=1:a.button&4?n=2:a.button&
2&&(n=3));o=h.getBoundingClientRect();var g=t.body,u=t.documentElement,h=o.left+(window.pageXOffset||u.scrollLeft||g.scrollLeft)-(u.clientLeft||g.clientLeft||0);o=Math.round(o.top+(window.pageYOffset||u.scrollTop||g.scrollTop)-(u.clientTop||g.clientTop||0));var h=Math.round(h),h=a.pageX-h,u=a.pageY-o,q=o=0,D,w;if(l)for(g=0;g<d.length;g++){q=d[g];if(q.isVisible&&!(typeof q.isHidden!=="undefined"&&q.isHidden)){q=q.itemTop+c.itemHeight;if(u<=q){D=d[g];break}}}else if(b){for(var J=c.scales,j=0,k,g=0;g<
J.length;g++){k=J[g];(typeof k.isHeaderVisible==="undefined"||k.isHeaderVisible)&&j++}var p=c.headerHeight;j>0&&(p=c.headerHeight/j);for(g=0;g<J.length;g++){k=J[g];if(typeof k.isHeaderVisible==="undefined"||k.isHeaderVisible){j=p;if(typeof k.headerHeight!=="undefined")j=k.headerHeight;q=q+j;if(u<=q){D=k;break}}}}if(b)w=Fa(h,c);else{u=c.columns;for(g=0;g<u.length;g++){q=u[g];o=o+(q.width?q.width:0);if(h<=o){w=q;break}}}c.mouseHandler&&c.mouseHandler(f,l,b,D,w,n,e,a);c.mouseMoveHandler&&f=="mousemove"&&
c.mouseMoveHandler(l,b,D,w);c.mouseDownHandler&&f=="mousedown"&&c.mouseDownHandler(l,b,D,w,n);c.clickHandler&&f=="click"&&c.clickHandler(l,b,D,w);c.doubleClickHandler&&f=="dblclick"&&c.doubleClickHandler(l,b,D,w);c.itemClickHandler&&(f=="click"&&l&&D)&&c.itemClickHandler(b,D,w);c.itemDoubleClickHandler&&(f=="dblclick"&&l&&D)&&c.itemDoubleClickHandler(b,D,w);c.chartClickHandler&&(f=="click"&&b)&&c.chartClickHandler(l,D,w);c.chartDoubleClickHandler&&(f=="dblclick"&&b)&&c.chartDoubleClickHandler(l,D,
w);c.chartItemClickHandler&&(f=="click"&&l&&b)&&c.chartItemClickHandler(D,w);c.chartItemDoubleClickHandler&&(f=="dblclick"&&l&&b)&&c.chartItemDoubleClickHandler(D,w)}};k.addEventListener("mousemove",function(a){A(a,false,false,0,k,"mousemove")});k.addEventListener("mousedown",function(a){A(a,false,false,1,k,"mousedown")});k.addEventListener("click",function(a){A(a,false,false,1,k,"click")});k.addEventListener("dblclick",function(a){A(a,false,false,2,k,"dblclick")});j.addEventListener("mousemove",
function(a){A(a,false,true,0,j,"mousemove")});j.addEventListener("mousedown",function(a){A(a,false,true,1,j,"mousedown")});j.addEventListener("click",function(a){A(a,false,true,1,j,"click")});j.addEventListener("dblclick",function(a){A(a,false,true,2,j,"dblclick")});p.addEventListener("mousemove",function(a){A(a,true,false,0,p,"mousemove")});p.addEventListener("mousedown",function(a){A(a,true,false,1,p,"mousedown")});p.addEventListener("click",function(a){A(a,true,false,1,p,"click")});p.addEventListener("dblclick",
function(a){A(a,true,false,2,p,"dblclick")});v.addEventListener("mousemove",function(a){A(a,true,true,0,v,"mousemove")});v.addEventListener("mousedown",function(a){A(a,true,true,1,v,"mousedown")});v.addEventListener("click",function(a){A(a,true,true,1,v,"click")});v.addEventListener("dblclick",function(a){A(a,true,true,2,v,"dblclick")});j.container=q;v.container=J;k.container=l;p.container=o;a.gridContainer=w;a.chartContainer=u;a.gridContent=j;a.chartContent=v;a.gridContentContainer=q;a.chartContentContainer=
J;a.gridHeader=k;a.chartHeader=p;a.gridHeaderContainer=l;a.chartHeaderContainer=o;a.splitter=D;J.isInitializing=true;n=I(d,c);zc(a,f);if(J.style.height!="auto")v.availableHeight=J.clientHeight;Ac(k,b,c);ib(p,x,e,c);Bc(j,v,x,d,b,n,c);Ea(D,w,c);J.isInitializing=false;xa(d,J,c);J.scrollLeft=H(c.displayedTime,c);if(o.scrollLeft!=J.scrollLeft)o.scrollLeft=J.scrollLeft;Cc(a,q,w,l,g,j,J,o,u,h,v,D,d,c);var z=false,E=function(a,b){typeof b==="undefined"&&(b=0);if(c.hourWidth!=a){z=true;var l=J.scrollLeft,
e=b,h=c.hourWidth;c.hourWidth=a;typeof c.hourWidthChangeHandler!=="undefined"&&setTimeout(function(){c.hourWidthChangeHandler(c.hourWidth)},0);s=H(c.timelineFinish,c);p.style.width=s+"px";v.style.width=s+"px";x.style.width=s+"px";if(typeof J.chartExtraSpace!=="undefined")J.chartExtraSpace.style.width=s+"px";var f;for(f=p.childNodes.length;f-- >0;)p.removeChild(p.childNodes[f]);var o=[];for(f=x.childNodes.length;f-- >1;){var n=x.childNodes[f];if(n!=v.chartAreaAlternativeRows){n.tag!="Scale-Highlighting"&&
(n.tag!="Scale-Highlighting-CurrentTime"&&n.tag!="Scale-Separator"&&n.tag!="Scale-Separator-CurrentTime")&&o.push(n);x.removeChild(n)}}ib(p,x,c.scales,c);for(f=0;f<d.length;f++){n=d[f];(!c.isVirtualizing||typeof n.isVirtuallyVisible!=="undefined"&&n.isVirtuallyVisible)&&ga(n.chartItem,n,c)}for(f=o.length;f-- >0;)x.appendChild(o[f]);va(v,wa(d,c));J.scrollLeft=e*(a/h)-(e-l);setTimeout(function(){z=false},200)}};a.setHourWidth=E;if(typeof c.isMouseWheelZoomEnabled==="undefined"||c.isMouseWheelZoomEnabled){b=
function(b){b.preventDefault();b.stopPropagation();if(!z){var c=typeof b.wheelDelta!=="undefined"?b.wheelDelta>=0?1:-1:typeof b.detail!=="undefined"?-b.detail>=0?1:-1:0,d=a.settings,l=d.hourWidth,e=typeof d.isMouseWheelZoomEnabledMinHourWidth!=="undefined"?d.isMouseWheelZoomEnabledMinHourWidth:1;if(c<0)l=l/(1.2*-c);else if(c>0){l=l*1.2*c;c=typeof d.isMouseWheelZoomEnabledMaxHourWidth!=="undefined"?d.isMouseWheelZoomEnabledMaxHourWidth:20;l>c&&(l=c)}l<e&&(l=e);E(l,b.offsetX)}};x.addEventListener("mousewheel",
b,false);x.addEventListener("DOMMouseScroll",b,false)}a.isInitializing=false;a.isInitialized=true;return a}},S=function(a){fa(a,a.items,a.settings,a.license)},$=function(a){if(typeof a.dateTimePickerType==="undefined")a.dateTimePickerType="text";if(typeof a.useDatePicker==="undefined")a.useDatePicker=true;if(typeof a.useTimePicker==="undefined")a.useTimePicker=true;if(typeof a.useResourceSelector==="undefined")a.useResourceSelector=true;if(typeof a.useUpdatingToolTips==="undefined")a.useUpdatingToolTips=
true;if(typeof a.dateFormatter==="undefined")a.dateFormatter=U;if(typeof a.dateTimeFormatter==="undefined")a.dateTimeFormatter=la;if(typeof a.dateTimeParser==="undefined")a.dateTimeParser=r;if(typeof a.itemPropertyChangeHandler==="undefined")a.itemPropertyChangeHandler=function(){};if(typeof a.target==="undefined")a.target="Standard";if(typeof a.theme==="undefined")a.theme="Modern";if(typeof a.isGridVisible==="undefined")switch(a.target){default:a.isGridVisible=true;break;case "Phone":a.isGridVisible=
false}if(typeof a.interaction==="undefined")a.interaction=a.target!="Phone"?"Standard":"TouchEnabled";if(typeof a.isSplitterEnabled==="undefined")a.isSplitterEnabled=true;if(typeof a.isReadOnly==="undefined")a.isReadOnly=false;if(typeof a.isGridReadOnly==="undefined")a.isGridReadOnly=false;if(typeof a.isChartReadOnly==="undefined")a.isChartReadOnly=false;if(typeof a.isContentReadOnly==="undefined")a.isContentReadOnly=false;if(typeof a.isAssignmentsContentReadOnly==="undefined")a.isAssignmentsContentReadOnly=
false;if(typeof a.isIndividualItemNonworkingTimeHighlighted==="undefined")a.isIndividualItemNonworkingTimeHighlighted=false;if(typeof a.areTaskInterruptionsHighlighted==="undefined")a.areTaskInterruptionsHighlighted=false;if(typeof a.areTaskDependencyConstraintsEnabled==="undefined")a.areTaskDependencyConstraintsEnabled=false;if(typeof a.selectionMode==="undefined")a.selectionMode="Focus";if(typeof a.isVirtualizing==="undefined")a.isVirtualizing=true},P=function(a,d,c){$(a);if(typeof a.gridWidth===
"undefined")a.gridWidth="35%";if(typeof a.chartWidth==="undefined")a.chartWidth=a.isGridVisible?"65%":"100%";if(typeof a.minGridWidth==="undefined")a.minGridWidth=32;if(typeof a.minColumnWidth==="undefined")a.minColumnWidth=32;if(typeof a.minChartWidth==="undefined")a.minChartWidth=36;if(typeof a.border==="undefined")switch(a.theme){default:a.border="#e0e0e0";break;case "ModernBordered":case "Aero":a.border="#9a9a9a"}if(typeof a.splitterWidth==="undefined")a.splitterWidth=4;if(typeof a.splitterBackground===
"undefined")a.splitterBackground=a.border;if(typeof a.indentationLevelWidth==="undefined")a.indentationLevelWidth=16;if(typeof a.itemHeight==="undefined")a.itemHeight=21;if(typeof a.headerBackground==="undefined")a.headerBackground="#f4f4f4";if(typeof a.headerHeight==="undefined")a.headerHeight=42;if(typeof a.columns==="undefined")a.columns=m(d,a);if(typeof a.toggleButtonStyle==="undefined"&&a.toggleButtonClass==null)a.toggleButtonStyle="fill: Gray";if(typeof a.toggleButtonHoveringStyle==="undefined"&&
a.toggleButtonHoveringClass==null)a.toggleButtonHoveringStyle="fill: Black";if(typeof a.collapsedToggleButtonTemplate==="undefined")a.collapsedToggleButtonTemplate=Bb(c,a);if(typeof a.expandedToggleButtonTemplate==="undefined")a.expandedToggleButtonTemplate=Cb(c,a);if(typeof a.gridLines!=="undefined"){if(typeof a.horizontalGridLines==="undefined")a.horizontalGridLines=a.gridLines;if(typeof a.verticalGridLines==="undefined")a.verticalGridLines=a.gridLines;if(typeof a.horizontalChartLines==="undefined")a.horizontalChartLines=
a.gridLines}if(typeof a.itemStyle==="undefined"&&typeof a.horizontalGridLines!=="undefined"){a.itemStyle="border-top: solid 1px "+a.horizontalGridLines+"; margin-top: -1px; -wekbit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box";if(typeof a.cellStyle==="undefined")a.cellStyle=typeof a.verticalGridLines!=="undefined"?"border-right: solid 1px "+a.verticalGridLines+"; height: "+a.itemHeight+"px; padding-top: 2px; padding-left: 2px":"height: "+a.itemHeight+"px; padding-top: 2px"}if(typeof a.cellStyle===
"undefined"&&typeof a.verticalGridLines!=="undefined")a.cellStyle="border-right: solid 1px "+a.verticalGridLines+"; height: "+a.itemHeight+"px; padding-top: 3px; padding-left: 2px";if(typeof a.selectedItemStyle==="undefined"&&a.selectedItemClass==null)switch(a.theme){default:a.selectedItemStyle=typeof a.horizontalGridLines!=="undefined"||typeof a.verticalGridLines==="undefined"?"background-color: #f4f4f4; border-top: solid 1px "+(typeof a.horizontalGridLines!=="undefined"?a.horizontalGridLines:"White")+
    "; margin-top: -1px; -wekbit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box" : "background-color: #f4f4f4"; break; case "Aero": a.selectedItemStyle = typeof a.horizontalGridLines !== "undefined" || typeof a.verticalGridLines === "undefined" ?"background-color: #8D8D8D; border-top: solid 1px "+(typeof a.horizontalGridLines!=="undefined"?a.horizontalGridLines:"White")+"; margin-top: -1px; -wekbit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box":"background-color: LightBlue"}if(typeof a.summaryItemStyle===
"undefined"&&a.summaryItemClass==null)a.summaryItemStyle="font-weight: bold";if(typeof a.daysOfWeek==="undefined")a.daysOfWeek=O;if(typeof a.months==="undefined")a.months=K;if(typeof a.weekStartDay==="undefined")a.weekStartDay=0;if(typeof a.currentTime==="undefined")a.currentTime=new Date;else if(typeof a.currentTime==="string")try{a.currentTime=new Date(a.currentTime)}catch(b){a.currentTime=new Date(parseInt(a.currentTime))}if(typeof a.displayedTime==="string")try{a.displayedTime=new Date(a.displayedTime)}catch(e){a.displayedTime=
new Date(parseInt(a.displayedTime))}if(typeof a.timelineStart==="string")try{a.timelineStart=new Date(a.timelineStart)}catch(f){a.timelineStart=new Date(parseInt(a.timelineStart))}if(typeof a.timelineFinish==="string")try{a.timelineFinish=new Date(a.timelineFinish)}catch(g){a.timelineFinish=new Date(parseInt(a.timelineFinish))}if(typeof a.isRelativeToTimezone==="undefined"||a.isRelativeToTimezone){a.currentTime=new Date(a.currentTime.valueOf()-a.currentTime.getTimezoneOffset()*6E4);if(typeof a.displayedTime!==
"undefined")a.displayedTime=new Date(a.displayedTime.valueOf()-a.displayedTime.getTimezoneOffset()*6E4);if(typeof a.timelineStart!=="undefined")a.timelineStart=new Date(a.timelineStart.valueOf()-a.timelineStart.getTimezoneOffset()*6E4);if(typeof a.timelineFinish!=="undefined")a.timelineFinish=new Date(a.timelineFinish.valueOf()-a.timelineFinish.getTimezoneOffset()*6E4);if(typeof a.scales!=="undefined")for(d=0;d<a.scales.length;d++){var l=a.scales[d];if(typeof l.intervals!=="undefined")for(var h=0;h<
l.intervals.length;h++){var o=l.intervals[h];if(typeof o.start!=="undefined")o.start=new Date(o.start.valueOf()-o.start.getTimezoneOffset()*6E4);if(typeof o.finish!=="undefined")o.finish=new Date(o.finish.valueOf()-o.finish.getTimezoneOffset()*6E4)}}a.isRelativeToTimezone=false}if(typeof a.schedule!=="undefined"&&a.schedule!=null){if(a.schedule!=a.previousSchedule||a.schedule.workingWeekStart!=a.previousSchedule.workingWeekStart)a.workingWeekStart=a.schedule.workingWeekStart;if(a.schedule!=a.previousSchedule||
a.schedule.workingWeekFinish!=a.previousSchedule.workingWeekFinish)a.workingWeekFinish=a.schedule.workingWeekFinish;if(a.schedule!=a.previousSchedule||a.schedule.workingDayStart!=a.previousSchedule.workingDayStart)a.visibleDayStart=a.schedule.workingDayStart;if(a.schedule!=a.previousSchedule||a.schedule.workingDayFinish!=a.previousSchedule.workingDayFinish)a.visibleDayFinish=a.schedule.workingDayFinish;if(a.schedule!=a.previousSchedule||a.schedule.specialNonworkingDays!=a.previousSchedule.specialNonworkingDays)a.specialNonworkingDays=
a.schedule.specialNonworkingDays}a.timelineStart=typeof a.timelineStart==="undefined"?new Date(ya(a.currentTime,a.weekStartDay).valueOf()-6048E5):ya(a.timelineStart,a.weekStartDay);a.timelineFinish=typeof a.timelineFinish==="undefined"?new Date(ya(a.currentTime,a.weekStartDay).valueOf()+320544E5):jb(a.timelineFinish,a.weekStartDay);if(!a.isExport&&typeof a.specialNonworkingDays!=="undefined")for(d=0;d<a.specialNonworkingDays.length;d++)a.specialNonworkingDays[d]=Y(new Date(a.specialNonworkingDays[d].valueOf()-
(a.specialNonworkingDays[d].getTimezoneOffset()<0?a.specialNonworkingDays[d].getTimezoneOffset():0)*6E4));if(!a.isExport&&typeof a.resourceSchedules!=="undefined")for(l=0;l<a.resourceSchedules.length;l++){h=a.resourceSchedules[l].value;if(typeof h.specialNonworkingDays!=="undefined")for(d=0;d<h.specialNonworkingDays.length;d++)h.specialNonworkingDays[d]=Y(new Date(h.specialNonworkingDays[d].valueOf()-(h.specialNonworkingDays[d].getTimezoneOffset()<0?h.specialNonworkingDays[d].getTimezoneOffset():
0)*6E4))}if(typeof a.scales==="undefined")a.scales=Db(a);if(typeof a.updateScale==="undefined")a.updateScale=9E5;if(typeof a.hourWidth==="undefined")a.hourWidth=2.5;if(typeof a.displayedTime==="undefined"){a.displayedTime=a.currentTime;setTimeout(function(){var b=c.chartContentContainer.scrollLeft-a.hourWidth*12;if(c.chartContentContainer.scrollLeft-b<c.chartContentContainer.clientWidth/3)c.chartContentContainer.scrollLeft=Math.max(0,b)},0)}a.previousSchedule=a.schedule;if(typeof a.visibleDayStart===
"undefined")a.visibleDayStart=288E5;if(typeof a.visibleDayFinish==="undefined")a.visibleDayFinish=576E5;if(a.visibleDayStart>=a.visibleDayFinish){a.visibleWeekStart=0;a.visibleWeekFinish=864E5}if(typeof a.visibleWeekStart==="undefined")a.visibleWeekStart=0;if(typeof a.visibleWeekFinish==="undefined")a.visibleWeekFinish=6;if(a.visibleWeekStart>a.visibleWeekFinish)if(a.visibleWeekStart==a.visibleWeekFinish+1){a.visibleWeekStart=0;a.visibleWeekFinish=6}else a.visibleWeekFinish=a.visibleWeekStart;if(typeof a.workingWeekStart===
"undefined")a.workingWeekStart=1;if(typeof a.workingWeekFinish==="undefined")a.workingWeekFinish=5;if(a.workingWeekStart>a.workingWeekFinish)if(a.workingWeekStart==a.workingWeekFinish+1){a.workingWeekStart=0;a.workingWeekFinish=6}else a.workingWeekFinish=a.workingWeekStart;a.workingDayStart=a.visibleDayStart;a.workingDayFinish=a.visibleDayFinish;if(typeof a.barMargin==="undefined")a.barMargin=a.itemHeight/4;if(typeof a.barHeight==="undefined")a.barHeight=a.itemHeight-a.barMargin*2;if(typeof a.barCornerRadius===
"undefined")switch(a.theme){default:a.barCornerRadius=0;break;case "Aero":a.barCornerRadius=3}if(typeof a.completedBarMargin==="undefined")a.completedBarMargin=a.barHeight/2.5;if(typeof a.completedBarHeight==="undefined")a.completedBarHeight=a.barHeight-a.completedBarMargin*2;if(typeof completedBarCornerRadius==="undefined")a.completedBarCornerRadius=0;if(typeof a.styleDefinitionTemplate==="undefined")a.styleDefinitionTemplate=Eb(c,a);if(typeof a.standardBarStyle==="undefined"&&a.standardBarClass==
null)switch(a.theme){default:a.standardBarStyle="fill: #8abbed; fill-opacity: 0.8; stroke: #8abbed; stroke-width: 0.65px";break;case "ModernBordered":a.standardBarStyle="fill: #8abbed; fill-opacity: 0.8; stroke: Blue; stroke-width: 0.65px";break;case "Aero":a.standardBarStyle="fill: url(#BlueGradient); fill-opacity: 0.8; stroke: Blue"}if(typeof a.standardCompletedBarStyle==="undefined"&&a.standardCompletedBarClass==null)switch(a.theme){default:a.standardCompletedBarStyle="fill: #3b87d9; stroke: #3b87d9; stroke-width: 0.65px";
    break; case "Aero": a.standardCompletedBarStyle ="fill: #000000; stroke: #000000; stroke-width: 0.65px"}if(typeof a.summaryBarStyle==="undefined"&&a.summaryBarClass==null)switch(a.theme){default:a.summaryBarStyle="fill: #607080; stroke: #607080; stroke-width: 0.65px";break;case "ModernBordered":a.summaryBarStyle="fill: #607080; stroke: #202020; stroke-width: 0.65px";break;case "Aero":a.summaryBarStyle="fill: url(#BlackGradient); stroke: Black"}if(typeof a.collapsedSummaryLineStyle==="undefined"&&a.collapsedSummaryLineClass==
null)a.collapsedSummaryLineStyle="stroke: #3b87d9; stroke-width: 0.65px; stroke-dasharray: 2 2";if(typeof a.milestoneBarStyle==="undefined"&&a.milestoneBarClass==null)switch(a.theme){default:a.milestoneBarStyle="fill: #607080; stroke: #607080; stroke-width: 0.65px";break;case "ModernBordered":a.milestoneBarStyle="fill: #607080; stroke: #202020; stroke-width: 0.65px";break;case "Aero":a.milestoneBarStyle="fill: url(#BlackGradient); stroke: Black"}if(typeof a.baselineBarStyle==="undefined"&&a.baselineBarClass==
null)switch(a.theme){default:a.baselineBarStyle="fill: none; stroke: #3b87d9; stroke-width: 0.65px; stroke-dasharray: 2, 2";break;case "Aero":a.baselineBarStyle="fill: none; stroke: Blue; stroke-dasharray: 2, 2"}if(typeof a.dependencyPointerStyle==="undefined"&&a.dependencyPointerClass==null)switch(a.theme){default:a.dependencyPointerStyle="fill: #3b87d9; stroke: #3b87d9; stroke-width: 0.65px";break;case "Aero":a.dependencyPointerStyle="fill: Blue; stroke: Blue"}if(typeof a.dependencyLineStyle===
"undefined"&&a.dependencyLineClass==null)switch(a.theme){default:a.dependencyLineStyle="stroke: #3b87d9; stroke-width: 0.65px; fill: none; marker-end: url(#ArrowMarker)";break;case "Aero":a.dependencyLineStyle="stroke: Blue; stroke-width: 0.65px; fill: none; marker-end: url(#ArrowMarker)"}if(typeof a.dependencyLineZoneStyle==="undefined"&&a.dependencyLineZoneClass==null)a.dependencyLineZoneStyle="stroke: White; stroke-opacity: 0; stroke-width: 4px; fill: none";if(typeof a.temporaryDependencyLineStyle===
"undefined"&&a.temporaryDependencyLineClass==null)switch(a.theme){default:a.temporaryDependencyLineStyle="stroke: #3b87d9; stroke-width: 0.65px; stroke-dasharray: 2, 2; fill: none; marker-end: url(#ArrowMarker)";break;case "Aero":a.temporaryDependencyLineStyle="stroke: Blue; stroke-width: 0.65px; stroke-dasharray: 2, 2; fill: none; marker-end: url(#ArrowMarker)"}if(typeof a.assignmentsStyle==="undefined"&&a.assignmentsClass==null)a.assignmentsStyle="stroke-width: 0.25px; font-size: x-small";if(typeof a.standardTaskTemplate===
"undefined")a.standardTaskTemplate=Fb();if(typeof a.summaryTaskTemplate==="undefined")a.summaryTaskTemplate=Gb();if(typeof a.milestoneTaskTemplate==="undefined")a.milestoneTaskTemplate=Hb();if(typeof a.horizontalChartLines!=="undefined"){var n=a.internalPreTaskTemplate;a.internalPreTaskTemplate=function(b){if(typeof b.scheduleChartItem!=="undefined")return typeof n!=="undefined"?n(b):null;var c=b.ganttChartView.ownerDocument,d=c.createElementNS("http://www.w3.org/2000/svg","g");typeof n!=="undefined"&&
d.appendChild(n(b));var l=c.createElementNS("http://www.w3.org/2000/svg","line");l.setAttribute("x1",0);l.setAttribute("y1",-0.5);l.setAttribute("x2",H(a.timelineFinish,a));l.setAttribute("y2",-0.5);l.setAttribute("style","stroke: "+a.horizontalChartLines+"; stroke-width: 0.5px");d.appendChild(l);if(b.index==b.ganttChartView.items.length-1){l=c.createElementNS("http://www.w3.org/2000/svg","line");l.setAttribute("x1",0);l.setAttribute("y1",a.itemHeight+0.5);l.setAttribute("x2",H(a.timelineFinish,a));
l.setAttribute("y2",a.itemHeight+0.5);l.setAttribute("style","stroke: "+a.horizontalChartLines+"; stroke-width: 0.5px");d.appendChild(l)}return d}}if(typeof a.isTaskToolTipVisible==="undefined")switch(a.target){default:a.isTaskToolTipVisible=true;break;case "Phone":a.isTaskToolTipVisible=false}if(typeof a.itemTemplate==="undefined")a.itemTemplate=Ib(a);if(typeof a.areTaskAssignmentsVisible==="undefined")a.areTaskAssignmentsVisible=true;if(typeof a.assignmentsTemplate==="undefined")a.assignmentsTemplate=
Jb();if(typeof a.isTaskCompletedEffortVisible==="undefined")a.isTaskCompletedEffortVisible=true;if(typeof a.areTaskDependenciesVisible==="undefined")a.areTaskDependenciesVisible=true;if(typeof a.dependencyLineTemplate==="undefined")a.dependencyLineTemplate=Kb();if(typeof a.isDependencyToolTipVisible==="undefined")a.isDependencyToolTipVisible=a.isTaskToolTipVisible;if(typeof a.predecessorItemTemplate==="undefined")a.predecessorItemTemplate=Lb(a);if(typeof a.isDraggingTaskStartEndsEnabled==="undefined")a.isDraggingTaskStartEndsEnabled=
true;if(typeof a.areTaskDependencyConstraintsEnabledWhileDragging==="undefined")a.areTaskDependencyConstraintsEnabledWhileDragging=false;if(typeof a.isTaskStartReadOnly==="undefined")a.isTaskStartReadOnly=false;if(typeof a.isTaskEffortReadOnly==="undefined")a.isTaskEffortReadOnly=false;if(typeof a.isTaskCompletionReadOnly==="undefined")a.isTaskCompletionReadOnly=false;if(typeof a.areTaskPredecessorsReadOnly==="undefined")a.areTaskPredecessorsReadOnly=false;if(typeof a.isBaselineVisible==="undefined")a.isBaselineVisible=
true;var t=null;if(a.isIndividualItemNonworkingTimeHighlighted||a.areTaskInterruptionsHighlighted)for(d=0;d<a.scales.length;d++)if(a.scales[d].scaleType=="NonworkingTime"){t=a.scales[d];break}if(t!=null&&a.isIndividualItemNonworkingTimeHighlighted){var w=a.internalPreTaskTemplate;a.internalPreTaskTemplate=function(b){if(typeof b.scheduleChartItem!=="undefined")return typeof w!=="undefined"?w(b):null;var c;c=E(b);if(typeof c==="undefined")c=null;else{var d=[],l,e;l=kb(a.timelineStart,typeof c.workingWeekStart!==
"undefined"?c.workingWeekFinish:a.workingWeekFinish);for(e=lb(l,typeof c.workingWeekFinish!=="undefined"?c.workingWeekStart:a.workingWeekStart);l<a.timelineFinish;l=za(l),e=za(e))d.push({start:l,finish:e});if(typeof c.specialNonworkingDays!=="undefined")for(var f=0;f<c.specialNonworkingDays.length;f++){l=c.specialNonworkingDays[f];e=ba(l);d.push({start:l,finish:e})}c=d}if(c==null||c.length==0)return typeof w!=="undefined"?w(b):null;d=b.ganttChartView.ownerDocument;l=d.createElementNS("http://www.w3.org/2000/svg",
"g");for(e=0;e<c.length;e++){var f=c[e],h=f.finish,f=H(f.start,a),h=H(h,a)-f;if(!(h<=0)){var o=d.createElementNS("http://www.w3.org/2000/svg","rect");o.setAttribute("x",f-1);o.setAttribute("y",0);o.setAttribute("width",h);o.setAttribute("height",a.itemHeight);o.setAttribute("class",t.highlightingClass);o.setAttribute("style",t.highlightingStyle);l.appendChild(o)}}typeof w!=="undefined"&&l.appendChild(w(b));return l}}if(t!=null&&a.areTaskInterruptionsHighlighted){var u=a.internalExtraTaskTemplate;
a.internalExtraTaskTemplate=function(b){if(typeof b.scheduleChartItem!=="undefined")return typeof u!=="undefined"?u(b):null;var c;if(b.hasChildren&&(typeof b.isSummaryEnabled==="undefined"||b.isSummaryEnabled)||b.isMilestone)c=null;else{var d=E(b);c=[];var l,e;l=kb(Y(b.start),typeof d!=="undefined"&&typeof d.workingWeekStart!=="undefined"?d.workingWeekFinish:a.workingWeekFinish);for(e=lb(l,typeof d!=="undefined"&&typeof d.workingWeekFinish!=="undefined"?d.workingWeekStart:a.workingWeekStart);l<b.finish;l=
za(l),e=za(e))c.push({start:l>=b.start?l:b.start,finish:e<=b.finish?e:b.finish});d=typeof d!=="undefined"&&typeof d.specialNonworkingDays!=="undefined"?d.specialNonworkingDays:a.specialNonworkingDays;if(typeof d!=="undefined")for(var f=0;f<d.length;f++){l=d[f];e=ba(l);l>=b.start&&e<=b.finish&&c.push({start:l,finish:e})}}if(c==null||c.length==0)return typeof u!=="undefined"?u(b):null;l=b.ganttChartView.ownerDocument;e=l.createElementNS("http://www.w3.org/2000/svg","g");for(d=0;d<c.length;d++){var f=
c[d],h=f.finish,f=H(f.start,a),h=H(h,a)-f;if(!(h<=0)){var o=l.createElementNS("http://www.w3.org/2000/svg","rect");o.setAttribute("x",f-1);o.setAttribute("y",a.barMargin);o.setAttribute("width",h);o.setAttribute("height",a.barHeight);o.setAttribute("class",t.highlightingClass);o.setAttribute("style",t.highlightingStyle);e.appendChild(o)}}typeof u!=="undefined"&&e.appendChild(u(b));return e}}},W=function(a,d){for(var c=0;c<a.length;c++){var b=a[c];if(typeof b==="string"){b={content:b};a[c]=b}if(typeof b.indentation===
"string")b.indentation=parseInt(b.indentation);if(typeof b.isExpanded==="string")b.isExpanded=b.isExpanded.toLowerCase()=="true";if(typeof b.start==="string"){try{b.start=new Date(b.start)}catch(e){b.start=new Date(parseInt(b.start))}if(typeof d.isRelativeToTimezone==="undefined"||d.isRelativeToTimezone)b.start=new Date(b.start.valueOf()+b.start.getTimezoneOffset()*6E4);b.preferredStart=b.start}if(typeof b.finish==="string"){try{b.finish=new Date(b.finish)}catch(f){b.finish=new Date(parseInt(b.finish))}if(typeof d.isRelativeToTimezone===
"undefined"||d.isRelativeToTimezone)b.finish=new Date(b.finish.valueOf()+b.finish.getTimezoneOffset()*6E4)}if(typeof b.completedFinish==="string"){try{b.completedFinish=new Date(b.completedFinish)}catch(g){b.completedFinish=new Date(parseInt(b.completedFinish))}if(typeof d.isRelativeToTimezone==="undefined"||d.isRelativeToTimezone)b.completedFinish=new Date(b.completedFinish.valueOf()+b.completedFinish.getTimezoneOffset()*6E4)}if(typeof b.isMilestone==="string")b.isMilestone=b.isMilestone.toLowerCase()==
"true";if(typeof b.baselineStart==="string"){try{b.baselineStart=new Date(b.baselineStart)}catch(l){b.baselineStart=new Date(parseInt(b.baselineStart))}if(typeof d.isRelativeToTimezone==="undefined"||d.isRelativeToTimezone)b.baselineStart=new Date(b.baselineStart.valueOf()+b.baselineStart.getTimezoneOffset()*6E4)}if(typeof b.baselineFinish==="string"){try{b.baselineFinish=new Date(b.baselineFinish)}catch(h){b.baselineFinish=new Date(parseInt(b.baselineFinish))}if(typeof d.isRelativeToTimezone==="undefined"||
d.isRelativeToTimezone)b.baselineFinish=new Date(b.baselineFinish.valueOf()+b.baselineFinish.getTimezoneOffset()*6E4)}if(typeof b.minStart==="string"){try{b.minStart=new Date(b.minStart)}catch(o){b.minStart=new Date(parseInt(b.minStart))}if(typeof d.isRelativeToTimezone==="undefined"||d.isRelativeToTimezone)b.minStart=new Date(b.minStart.valueOf()+b.minStart.getTimezoneOffset()*6E4)}if(typeof b.maxStart==="string"){try{b.maxStart=new Date(b.maxStart)}catch(n){b.maxStart=new Date(parseInt(b.maxStart))}if(typeof d.isRelativeToTimezone===
"undefined"||d.isRelativeToTimezone)b.maxStart=new Date(b.maxStart.valueOf()+b.maxStart.getTimezoneOffset()*6E4)}if(typeof b.minFinish==="string"){try{b.minFinish=new Date(b.minFinish)}catch(t){b.minFinish=new Date(parseInt(b.minFinish))}if(typeof d.isRelativeToTimezone==="undefined"||d.isRelativeToTimezone)b.minFinish=new Date(b.minFinish.valueOf()+b.minFinish.getTimezoneOffset()*6E4)}if(typeof b.maxFinish==="string"){try{b.maxFinish=new Date(b.maxFinish)}catch(w){b.maxFinish=new Date(parseInt(b.maxFinish))}if(typeof d.isRelativeToTimezone===
"undefined"||d.isRelativeToTimezone)b.maxFinish=new Date(b.maxFinish.valueOf()+b.maxFinish.getTimezoneOffset()*6E4)}if(typeof b.predecessors!=="undefined"){if(typeof b.predecessors==="string")b.predecessors=b.predecessors.split(",");for(var u=0;u<b.predecessors.length;u++){var D=b.predecessors[u];if(typeof D==="string"){D={item:D};b.predecessors[u]=D}if(typeof D.item==="string"){var q=parseInt(D.item)-1;D.item=q>=0&&q<a.length?a[q]:null}if(typeof D.lag==="string")D.lag=parseFloat(D.lag)}}if(typeof b.schedule!==
"undefined"&&typeof b.schedule.specialNonworkingDays!=="undefined")for(u=0;u<b.schedule.specialNonworkingDays.length;u++)b.schedule.specialNonworkingDays[u]=Y(new Date(b.schedule.specialNonworkingDays[u].valueOf()-b.schedule.specialNonworkingDays[u].getTimezoneOffset()*6E4));typeof b.wasGridItemContentLoaded!=="undefined"&&delete b.wasGridItemContentLoaded}},Q=function(a,d,c){var b;if(a.isContentHeightInitialized&&a.isContentHeightAuto)b=d.length>0?"auto":c.itemHeight+"px";else{var e=a.clientHeight-
c.headerHeight-2;e<0&&(e=0);b=e+"px";if(e<c.itemHeight){if(!a.isContentHeightInitialized)a.isContentHeightAuto=true;b=d.length>0?"auto":c.itemHeight+"px"}a.isContentHeightInitialized=true}return b},I=function(a,d){if(typeof d.toggleButtonAreaWidth!=="undefined")return d.toggleButtonAreaWidth;var c=0;if(d.isGridVisible)for(var b=0;b<a.length;b++)if(a[b].indentation>0){c=16;break}return d.toggleButtonAreaWidth=c},G=function(a,d){var c=a.createElement("span");c.innerHTML=d;return c},V=function(a,d){return d==
true?a.createTextNode("\u2713"):a.createTextNode("")},U=function(a){var d=a.getFullYear(),c=a.getMonth()+1;c<10&&(c="0"+c);a=a.getDate();a<10&&(a="0"+a);return c+"/"+a+"/"+d},la=function(a){var d=U(a),c=a.getHours();c<10&&(c="0"+c.toString());a=a.getMinutes();a<10&&(a="0"+a.toString());return d+" "+c+":"+a},N=function(a){return new Date(a.valueOf()+a.getTimezoneOffset()*6E4)},r=function(a){var d=new Date;if(a==null||a=="")return d;var c,b,e,f;e=a.indexOf(" ");if(e>=0){c=a.substr(0,e);f=a.substr(e+
1)}else{c=a;f="0"}e=c.indexOf("/");if(e>=0){for(a=c.substr(0,e);a.length>0&&a.substr(0,1)=="0";)a=a.substr(1);a=parseInt(a)-1;c=c.substr(e+1);e=c.indexOf("/");if(e>=0){b=c.substr(0,e);for(e=c.substr(e+1);e.length>0&&e.substr(0,1)=="0";)e=e.substr(1);c=parseInt(e)}else{b=c;c=d.getFullYear()}for(;b.length>0&&b.substr(0,1)=="0";)b=b.substr(1);b=parseInt(b)}else{for(;c.length>0&&c.substr(0,1)=="0";)c=c.substr(1);b=parseInt(c);a=d.getMonth();c=d.getFullYear()}var g;e=f.indexOf(":");if(e>=0){g=f.substr(0,
e);f=f.substr(e+1)}else{g=f;f="0"}for(;g.length>1&&g.substr(0,1)=="0";)g=g.substr(1);for(e=parseInt(g);f.length>1&&f.substr(0,1)=="0";)f=f.substr(1);f=parseInt(f);return isNaN(c)||isNaN(a)||isNaN(b)||c<=0||a<0||a>=12||b<1||b>X[a]+(a!=1||!(c%400==0||(c%100==0?0:c%4==0))?0:1)?isNaN(e)||isNaN(f)||e<0||e>=24||f<0||f>=60?d:new Date(d.getFullYear(),d.getMonth(),d.getDate(),e,f,0,0):isNaN(e)||isNaN(f)||e<0||e>=24||f<0||f>=60?new Date(c,a,b,0,0,0,0):new Date(c,a,b,e,f,0,0)},k=function(a){return new Date(a.valueOf()-
a.getTimezoneOffset()*6E4)},j=function(a,d){var c=a.ownerDocument,b=c.createElementNS("http://www.w3.org/2000/svg","svg");b.setAttribute("style","width: 12px; height: 12px");b.setAttribute("focusable","false");c=c.createElementNS("http://www.w3.org/2000/svg","rect");c.setAttribute("id","PART_Border");c.setAttribute("width","12");c.setAttribute("height","12");c.setAttribute("style","fill: White; fill-opacity: 0");b.appendChild(c);a.setAttribute("id","PART_Button");typeof d.toggleButtonClass!=="undefined"&&
a.setAttribute("class",d.toggleButtonClass);typeof d.toggleButtonStyle!=="undefined"&&a.setAttribute("style",d.toggleButtonStyle);b.appendChild(a);return b},m=function(a,d){typeof d!=="object"&&(d={});$(d);var c=[{header:"",width:32,isSelection:true},{header:"Task",width:140,isTreeView:true},{header:"Start",width:140},{header:"Finish",width:140},{header:"Milestone",width:80},{header:"Completed",width:80},{header:"Assignments",width:200}];c[0].cellTemplate=p(d,c[0],a);c[1].cellTemplate=B(d,c[1],a);
c[1].exportCellTemplate=B(d,c[1],a,false);c[2].cellTemplate=z(d,c[2]);c[2].exportCellTemplate=z(d,c[2],false);c[3].cellTemplate=ja(d,c[3]);c[3].exportCellTemplate=ja(d,c[3],false);c[4].cellTemplate=Mb(d,c[4]);c[4].exportCellTemplate=Mb(d,c[4],false);c[5].cellTemplate=Nb(d,c[5]);c[5].exportCellTemplate=Nb(d,c[5],false);c[6].cellTemplate=Ob(d,c[6]);c[6].exportCellTemplate=Ob(d,c[6],false);d.selectionMode!="Single"&&(d.selectionMode!="Extended"&&d.selectionMode!="ExtendedFocus")&&c.splice(0,1);return c},
p=function(a,d,c){return function(b){return!d.isReadOnly?s(b,a,c):V(b.ganttChartView.ownerDocument,b.isSelected)}},s=function(a,d){var c=a.ganttChartView.ownerDocument,b;if(typeof a.selectionInput==="undefined"){b=c.createElement("input");a.selectionInput=b;b.type="checkbox";b.setAttribute("style","margin: 0px")}else b=a.selectionInput;if(a.isSelected){b.setAttribute("checked","checked");if(!b.checked)b.checked=true}else if(b.checked)b.checked=false;var e=function(){b.checked?v(a,true,d.selectionMode):
v(a,false,d.selectionMode)};typeof b.changeEventListener!=="undefined"&&b.removeEventListener("change",b.changeEventListener,true);b.addEventListener("change",e,true);b.changeEventListener=e;c=function(a){if(a.keyCode==13){a.preventDefault();a.stopPropagation();e(a)}};typeof b.keyPressEventListener!=="undefined"&&b.removeEventListener("keypress",b.keyPressEventListener,true);b.addEventListener("keypress",c,true);b.keyPressEventListener=c;return b},v=function(a,d,c){a.isSelected=d;y(a,"isSelected",
true,true);Pb(a);if(typeof a.ganttChartView!=null){a.ganttChartView.selectedItem=a;if(c!="Extended"&&c!="ExtendedFocus")a.ganttChartView.selectedItems=[a];var b;if(c!="Extended"&&c!="ExtendedFocus")for(b=0;b<a.ganttChartView.items.length;b++){d=a.ganttChartView.items[b];if(d!=a&&d.isSelected){d.isSelected=false;y(d,"isSelected",false,true);Pb(d)}}}if(typeof a.ganttChartView!=null&&(c=="Extended"||c=="ExtendedFocus")){c=[];for(b=0;b<a.ganttChartView.items.length;b++){d=a.ganttChartView.items[b];d.isSelected&&
c.push(d)}a.ganttChartView.selectedItems=c}},x=function(a,d){if(typeof a.ganttChartView!=null)a.ganttChartView.currentItem=a;if(d.selectionMode=="Focus"||d.selectionMode=="ExtendedFocus"){if(typeof a.scheduleChartItem!=="undefined")a=a.scheduleChartItem;a.isSelected||v(a,true,d.selectionMode)}},B=function(a,d,c,b){var e=function(a){return G(a.ganttChartView.ownerDocument,a.content)};return(typeof b==="undefined"||b)&&!a.isReadOnly&&!a.isGridReadOnly&&!a.isContentReadOnly?function(b){return!d.isReadOnly&&
(typeof b.isReadOnly==="undefined"||!b.isReadOnly)?A(b,Math.max(0,d.width-b.indentation*b.ganttChartView.settings.indentationLevelWidth-b.ganttChartView.settings.toggleButtonAreaWidth-16),a):e(b)}:e},A=function(a,d,c){var b=a.ganttChartView.ownerDocument,e;if(typeof a.contentInput==="undefined"){e=b.createElement("input");a.contentInput=e;e.type="text";e.addEventListener("focus",function(){x(a,c)},false);var f=function(){a.content=e.value;y(a,"content",true,true);pa(a)};typeof e.changeEventListener!==
"undefined"&&e.removeEventListener("change",e.changeEventListener,true);e.addEventListener("change",f,true);e.changeEventListener=f;b=function(a){if(a.keyCode==13){a.preventDefault();a.stopPropagation();f(a)}};typeof e.keyPressEventListener!=="undefined"&&e.removeEventListener("keypress",e.keyPressEventListener,true);e.addEventListener("keypress",b,true);e.keyPressEventListener=b;e.addEventListener("focus",function(){e.style.backgroundColor="White"},false);e.addEventListener("blur",function(){e.style.backgroundColor=
"Transparent"},false)}else e=a.contentInput;e.value=a.content;b="";if(a.hasChildren&&(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled))b="; font-weight: bold";e.setAttribute("style","background-color: Transparent; width: "+d+"px; border-width: 0px; padding: 0px"+b);return e},z=function(a,d,c){var b=function(b){return typeof b.start==="undefined"||typeof b.isSummaryEnabled!=="undefined"&&!b.isSummaryEnabled&&typeof b.isBarVisible!=="undefined"&&!b.isBarVisible?b.ganttChartView.ownerDocument.createTextNode(""):
b.ganttChartView.ownerDocument.createTextNode(a.dateTimeFormatter(N(b.start)))};return(typeof c==="undefined"||c)&&!a.isReadOnly&&!a.isGridReadOnly?function(c){return!d.isReadOnly&&(typeof c.isReadOnly==="undefined"||!c.isReadOnly)&&!(typeof c.isSummaryEnabled!=="undefined"&&!c.isSummaryEnabled&&typeof c.isBarVisible!=="undefined"&&!c.isBarVisible)?Dc(c,Math.max(0,d.width-16),a):b(c)}:b},Dc=function(a,d,c){var b=a.ganttChartView.ownerDocument,e;if(typeof a.startInput==="undefined"){e=b.createElement("input");
a.startInput=e;try{e.type=c.dateTimePickerType}catch(f){e.type="text"}e.addEventListener("focus",function(){x(a,c)},false);e.addEventListener("focus",function(){e.style.backgroundColor="White"},false);e.addEventListener("blur",function(){e.style.backgroundColor="Transparent"},false)}else e=a.startInput;if(typeof a.start!=="undefined")e.value=c.dateTimeFormatter(N(a.start));DlhSoft.Controls.DatePicker&&(c.dateTimePickerType=="text"&&c.useDatePicker)&&e.addEventListener("focus",function(){if(!a.isWaitingToRefreshGridItem){var d=
(c.useTimePicker&&DlhSoft.Controls.DateTimePicker?DlhSoft.Controls.DateTimePicker:DlhSoft.Controls.DatePicker).get(e);if(!d||!d.isOpen){var l=0,f=0;try{l=e.selectionStart;f=e.selectionEnd}catch(g){}d=(c.useTimePicker&&DlhSoft.Controls.DateTimePicker?DlhSoft.Controls.DateTimePicker:DlhSoft.Controls.DatePicker).initialize(e,void 0,{inputStyle:null,isDropDownButtonVisible:false,defaultTimeOfDay:c.workingDayStart,dateTimeFormatter:c.dateTimeFormatter,dateTimeParser:c.dateTimeParser,popupStyle:"margin-top: 1px; background-color: White; border: 1px solid "+
c.border,disabledDateSelector:Qb(c),disabledTimeSelector:Ec(c),calendarSelectorLevels:c.calendarSelectorLevels,months:c.months,daysOfWeek:F(c.daysOfWeek)},"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase.");d.openDropDown();setTimeout(function(){try{e.selectionStart=l;e.selectionEnd=f}catch(a){}},100);navigator.userAgent.match(/(Android)|(IPad)|(IPhone)/i)==null?setTimeout(function(){try{e.focus()}catch(a){}},100):
b.createEvent&&setTimeout(function(){var a=b.createEvent("MouseEvents");a.initEvent("blur",true,false);e.dispatchEvent(a)})}}},true);var g="";if(a.hasChildren&&(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled))g="; font-weight: bold";e.setAttribute("style","background-color: Transparent; width: "+d+"px; border-width: 0px; padding: 0px"+g);a.hasChildren&&(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled)?e.setAttribute("disabled","true"):e.removeAttribute("disabled");var l=function(){if(!a.hasChildren||
!(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled)){var b=a.completedFinish>a.start,d,l;if(c.isTaskEffortPreservedWhenStartChangesInGrid){d=ea(a,c);l=Aa(a,c)}a.start=M(k(c.dateTimeParser(e.value)),c,true,a.isMilestone,E(a));a.preferredStart=a.start;y(a,"start",true,true);if(a.finish<a.start){a.finish=a.start;y(a,"finish",false,true)}if(a.completedFinish<a.start||!b){a.completedFinish=a.start;y(a,"completedFinish",false,true)}else if(a.completedFinish>a.finish){a.completedFinish=a.finish;
y(a,"completedFinish",false,true)}if(typeof a.completedInput!=="undefined"){b=a.completedInput;typeof b.changeEventListener!=="undefined"&&b.removeEventListener("change",b.changeEventListener,true);delete a.completedInput}if(c.isTaskEffortPreservedWhenStartChangesInGrid){Ya(a,d,c);Za(a,l,c)}}Z(a)};typeof e.changeEventListener!=="undefined"&&e.removeEventListener("change",e.changeEventListener,true);e.addEventListener("change",l,true);e.changeEventListener=l;d=function(a){if(a.keyCode==13){a.preventDefault();
a.stopPropagation();l(a)}};typeof e.keyPressEventListener!=="undefined"&&e.removeEventListener("keypress",e.keyPressEventListener,true);e.addEventListener("keypress",d,true);e.keyPressEventListener=d;return e},ja=function(a,d,c){var b=function(b){return typeof b.finish==="undefined"||typeof b.isMilestone!=="undefined"&&b.isMilestone==true&&typeof b.start!=="undefined"&&b.finish.valueOf()==b.start.valueOf()||typeof b.isSummaryEnabled!=="undefined"&&!b.isSummaryEnabled&&typeof b.isBarVisible!=="undefined"&&
!b.isBarVisible?b.ganttChartView.ownerDocument.createTextNode(""):b.ganttChartView.ownerDocument.createTextNode(a.dateTimeFormatter(N(b.finish)))};return(typeof c==="undefined"||c)&&!a.isReadOnly&&!a.isGridReadOnly?function(c){return!d.isReadOnly&&(typeof c.isReadOnly==="undefined"||!c.isReadOnly)&&!(typeof c.isSummaryEnabled!=="undefined"&&!c.isSummaryEnabled&&typeof c.isBarVisible!=="undefined"&&!c.isBarVisible)?Fc(c,Math.max(0,d.width-16),a):b(c)}:b},Fc=function(a,d,c){var b=a.ganttChartView.ownerDocument,
e;if(typeof a.finishInput==="undefined"){e=b.createElement("input");a.finishInput=e;try{e.type=c.dateTimePickerType}catch(f){e.type="text"}e.addEventListener("focus",function(){x(a,c)},false);e.addEventListener("focus",function(){e.style.backgroundColor="White"},false);e.addEventListener("blur",function(){e.style.backgroundColor="Transparent"},false)}else e=a.finishInput;if(typeof a.finish!=="undefined")e.value=c.dateTimeFormatter(N(a.finish));DlhSoft.Controls.DatePicker&&(c.dateTimePickerType=="text"&&
c.useDatePicker)&&e.addEventListener("focus",function(){if(!a.isWaitingToRefreshGridItem){var d=(c.useTimePicker&&DlhSoft.Controls.DateTimePicker?DlhSoft.Controls.DateTimePicker:DlhSoft.Controls.DatePicker).get(e);if(!d||!d.isOpen){var l=0,f=0;try{l=e.selectionStart;f=e.selectionEnd}catch(h){}d=(c.useTimePicker&&DlhSoft.Controls.DateTimePicker?DlhSoft.Controls.DateTimePicker:DlhSoft.Controls.DatePicker).initialize(e,void 0,{inputStyle:null,isDropDownButtonVisible:false,defaultTimeOfDay:c.workingDayFinish,
dateTimeFormatter:c.dateTimeFormatter,dateTimeParser:c.dateTimeParser,popupStyle:"margin-top: 1px; background-color: White; border: 1px solid "+c.border,disabledDateSelector:Qb(c),disabledTimeSelector:C(c,a),calendarSelectorLevels:c.calendarSelectorLevels,months:c.months,daysOfWeek:F(c.daysOfWeek)},"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase.");d.openDropDown();setTimeout(function(){try{e.selectionStart=l;
e.selectionEnd=f}catch(a){}},100);navigator.userAgent.match(/(Android)|(IPad)|(IPhone)/i)==null?setTimeout(function(){try{e.focus()}catch(a){}},100):b.createEvent&&setTimeout(function(){var a=b.createEvent("MouseEvents");a.initEvent("blur",true,false);e.dispatchEvent(a)})}}},true);var g="";typeof a.isMilestone!=="undefined"&&a.isMilestone==true&&(g="; visibility: hidden");var l="";if(a.hasChildren&&(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled))l="; font-weight: bold";e.setAttribute("style",
"background-color: Transparent; width: "+d+"px; border-width: 0px; padding: 0px"+g+l);a.hasChildren&&(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled)?e.setAttribute("disabled","true"):e.removeAttribute("disabled");var h=function(){if(!a.hasChildren||!(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled)){var b=k(c.dateTimeParser(e.value));e.value.length>0&&(e.value.indexOf(" ")<0&&ka(b)==0)&&(b=ba(b));a.finish=M(b,c,a.isMilestone,true,E(a));if(a.finish<a.start)a.finish=a.start;
y(a,"finish",true,true);if(a.completedFinish<a.start){a.completedFinish=a.start;y(a,"completedFinish",false,true)}else if(a.completedFinish>a.finish){a.completedFinish=a.finish;y(a,"completedFinish",false,true)}if(typeof a.completedInput!=="undefined"){b=a.completedInput;typeof b.changeEventListener!=="undefined"&&b.removeEventListener("change",b.changeEventListener,true);delete a.completedInput}}Z(a)};typeof e.changeEventListener!=="undefined"&&e.removeEventListener("change",e.changeEventListener,
true);e.addEventListener("change",h,true);e.changeEventListener=h;d=function(a){if(a.keyCode==13){a.preventDefault();a.stopPropagation();h(a)}};typeof e.keyPressEventListener!=="undefined"&&e.removeEventListener("keypress",e.keyPressEventListener,true);e.addEventListener("keypress",d,true);e.keyPressEventListener=d;return e},Qb=function(a){return function(d){if(d.getDay()<a.workingWeekStart||d.getDay()>a.workingWeekFinish)return true;d=k(d).valueOf();if(a.specialNonworkingDays)for(var c=0;c<a.specialNonworkingDays.length;c++)if(d==
a.specialNonworkingDays[c].valueOf())return true;return false}},Ec=function(a){return function(d){return d<a.visibleDayStart||d>=a.visibleDayFinish}},C=function(a,d){return function(c){return(Y(d.start)<Y(d.finish)?c<=a.visibleDayStart:c<a.visibleDayStart)||c>a.visibleDayFinish}},F=function(a){if(a){for(var d=[],c=0;c<a.length;c++){var b=a[c],b=b.length>0?b[0].toUpperCase()+(b.length>1?b[1]:""):"";d.push(b)}return d}},Mb=function(a,d,c){var b=function(a){return typeof a.isMilestone==="undefined"||
typeof a.isSummaryEnabled!=="undefined"&&!a.isSummaryEnabled&&typeof a.isBarVisible!=="undefined"&&!a.isBarVisible?a.ganttChartView.ownerDocument.createTextNode(""):V(a.ganttChartView.ownerDocument,a.isMilestone)};return(typeof c==="undefined"||c)&&!a.isReadOnly&&!a.isGridReadOnly?function(c){return!d.isReadOnly&&(typeof c.isReadOnly==="undefined"||!c.isReadOnly)&&!(typeof c.isSummaryEnabled!=="undefined"&&!c.isSummaryEnabled&&typeof c.isBarVisible!=="undefined"&&!c.isBarVisible)?T(c,a):b(c)}:b},
T=function(a,d){var c=a.ganttChartView.ownerDocument,b;if(typeof a.milestoneInput==="undefined"){b=c.createElement("input");a.milestoneInput=b;b.type="checkbox";b.setAttribute("style","margin: 0px; margin-left: 2px; margin-right: 2px");b.addEventListener("focus",function(){x(a,d)},false)}else b=a.milestoneInput;(!a.hasChildren||!(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled))&&typeof a.isMilestone!=="undefined"&&a.isMilestone?b.setAttribute("checked",true):b.removeAttribute("checked");
if(!a.hasChildren||!(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled)){var e=function(){if(b.checked){a.isMilestone=true;y(a,"isMilestone",true,true);if(a.finish>a.start){a.finish=a.start;y(a,"finish",false,true)}if(a.completedFinish>a.start){a.completedFinish=a.start;y(a,"completedFinish",false,true)}}else{a.isMilestone=false;y(a,"isMilestone",true,true)}Z(a)};typeof b.changeEventListener!=="undefined"&&b.removeEventListener("change",b.changeEventListener,true);b.addEventListener("change",
e,true);b.changeEventListener=e;c=function(a){if(a.keyCode==13){a.preventDefault();a.stopPropagation();e(a)}};typeof b.keyPressEventListener!=="undefined"&&b.removeEventListener("keypress",b.keyPressEventListener,true);b.addEventListener("keypress",c,true);b.keyPressEventListener=c}else b.setAttribute("style","visibility: hidden");return b},Ob=function(a,d,c){var b=function(a){return typeof a.assignmentsContent==="undefined"||typeof a.isSummaryEnabled!=="undefined"&&!a.isSummaryEnabled&&typeof a.isBarVisible!==
"undefined"&&!a.isBarVisible?a.ganttChartView.ownerDocument.createTextNode(""):G(a.ganttChartView.ownerDocument,a.assignmentsContent)};return(typeof c==="undefined"||c)&&!a.isReadOnly&&!a.isGridReadOnly&&!a.isAssignmentsContentReadOnly?function(c){return!d.isReadOnly&&(typeof c.isReadOnly==="undefined"||!c.isReadOnly)&&!(typeof c.isSummaryEnabled!=="undefined"&&!c.isSummaryEnabled&&typeof c.isBarVisible!=="undefined"&&!c.isBarVisible)?Gc(c,Math.max(0,d.width-16),a):b(c)}:b},Gc=function(a,d,c){var b=
a.ganttChartView,e=b.ownerDocument,f;if(typeof a.assignmentsContentInput==="undefined"){f=e.createElement("input");a.assignmentsContentInput=f;f.type="text";f.addEventListener("focus",function(){x(a,c)},false);var g=function(){a.assignmentsContent=f.value;y(a,"assignmentsContent",true,true);if(!a.hasChildren&&a.hasFixedEffort){a.fixedEffort=ea(a,c);a.fixedEffortAssignments=ha(a)}qa(a);var b=null;DlhSoft.Controls.MultiSelectorComboBox&&(b=DlhSoft.Controls.MultiSelectorComboBox.get(f));if(b!=null&&
b.availableChoices.length>0)var d=setInterval(function(){if(!b.isOpen&&e.activeElement!=a.assignmentsContentInput){clearInterval(d);Z(a)}},100);else Z(a)};typeof f.changeEventListener!=="undefined"&&f.removeEventListener("change",f.changeEventListener,true);f.addEventListener("change",function(a){f.dontAutoFocus=true;g(a)},true);f.changeEventListener=g;var l=function(a){if(a.keyCode==13){a.preventDefault();a.stopPropagation();typeof f.dontAutoFocus!=="undefined"&&delete f.dontAutoFocus;g(a)}};typeof f.keyPressEventListener!==
"undefined"&&f.removeEventListener("keypress",f.keyPressEventListener,true);f.addEventListener("keypress",l,true);f.keyPressEventListener=l;f.addEventListener("focus",function(){f.style.backgroundColor="White"},false);f.addEventListener("blur",function(){f.style.backgroundColor="Transparent"},false)}else f=a.assignmentsContentInput;if(typeof a.assignmentsContent!=="undefined")f.value=a.assignmentsContent;DlhSoft.Controls.MultiSelectorComboBox&&c.useResourceSelector&&f.addEventListener("focus",function(){if(!a.isWaitingToRefreshGridItem){var d=
DlhSoft.Controls.MultiSelectorComboBox.get(f);if(!d||!d.isOpen&&d.availableChoices.length>0){d=c.assignableResources;if(typeof d==="undefined"){d=Ka(b.items);c.assignableResources=d}var l=0,n=0;try{l=f.selectionStart;n=f.selectionEnd}catch(g){}d=DlhSoft.Controls.MultiSelectorComboBox.initialize(f,d,void 0,{inputStyle:null,autoAppendAvailableChoices:c.autoAppendAssignableResources,isDropDownButtonVisible:false,popupStyle:"margin-top: 1px; background-color: White; color: Black; border: 1px solid "+
c.border+"; font-size: small; max-height: 188px; overflow-y: auto"},"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase.");d.openDropDown();setTimeout(function(){try{f.selectionStart=l;f.selectionEnd=n}catch(a){}},100);navigator.userAgent.match(/(Android)|(IPad)|(IPhone)/i)==null?setTimeout(function(){try{f.focus()}catch(a){}},100):e.createEvent&&setTimeout(function(){var a=e.createEvent("MouseEvents");a.initEvent("blur",
true,false);f.dispatchEvent(a)})}}},true);l="";if(a.hasChildren&&(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled))l="; font-weight: bold";f.setAttribute("style","background-color: Transparent; width: "+d+"px; border-width: 0px; padding: 0px"+l);return f},Nb=function(a,d,c){var b=function(a){return typeof a.start==="undefined"||typeof a.finish==="undefined"||a.finish.valueOf()==a.start.valueOf()||typeof a.isSummaryEnabled!=="undefined"&&!a.isSummaryEnabled&&typeof a.isBarVisible!=="undefined"&&
!a.isBarVisible?a.ganttChartView.ownerDocument.createTextNode(""):V(a.ganttChartView.ownerDocument,a.ganttChartView.isItemCompleted(a))};return(typeof c==="undefined"||c)&&!a.isReadOnly&&!a.isGridReadOnly?function(c){return!d.isReadOnly&&(typeof c.isReadOnly==="undefined"||!c.isReadOnly)&&(!c.hasChildren||!(typeof c.isSummaryEnabled==="undefined"||c.isSummaryEnabled))&&!(typeof c.isSummaryEnabled!=="undefined"&&!c.isSummaryEnabled&&typeof c.isBarVisible!=="undefined"&&!c.isBarVisible)?Hc(c,a):b(c)}:
b},Hc=function(a,d){var c=a.ganttChartView.ownerDocument,b;if(typeof a.completedInput==="undefined"){b=c.createElement("input");a.completedInput=b;b.type="checkbox";b.setAttribute("style","margin: 0px; margin-left: 2px; margin-right: 2px");b.addEventListener("focus",function(){x(a,d)},false)}else b=a.completedInput;a.isSetAsCompleted||(!a.hasChildren||!(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled))&&a.completedFinish>=a.finish&&a.finish>a.start&&(typeof a.isMilestone==="undefined"||
!a.isMilestone)?b.setAttribute("checked",true):b.removeAttribute("checked");a.hasChildren&&(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled)&&b.setAttribute("style","visibility: hidden");var e=function(){if(b.checked){if(a.completedFinish<a.finish){a.completedFinish=a.finish;y(a,"completedFinish",true,true)}if(a.isMilestone||a.finish.valueOf()<=a.start.valueOf())a.isSetAsCompleted=true}else{if(a.completedFinish>a.start){a.completedFinish=a.start;y(a,"completedFinish",true,true)}if(a.isMilestone||
a.finish.valueOf()<=a.start.valueOf())a.isSetAsCompleted=false}Z(a)};typeof b.changeEventListener!=="undefined"&&b.removeEventListener("change",b.changeEventListener,true);b.addEventListener("change",e,true);b.changeEventListener=e;c=function(a){if(a.keyCode==13){a.preventDefault();a.stopPropagation();e(a)}};typeof b.keyPressEventListener!=="undefined"&&b.removeEventListener("keypress",b.keyPressEventListener,true);b.addEventListener("keypress",c,true);b.keyPressEventListener=c;return b},hb=function(a){for(var d=
0,c=0;c<a.length;c++)d=d+a[c].width;return d},xc=function(a,d,c){for(var b=I(d.items,c),e=0;e<a.length;e++){var f=a[e];f.ganttChartView=d;if(typeof f.width==="undefined")f.width=100;if(typeof f.minWidth==="undefined")f.minWidth=Math.min(f.width,c.minColumnWidth+(f.isTreeView?b:0));if(typeof f.maxWidth==="undefined")f.maxWidth=c.maxColumnWidth;if(typeof f.cellTemplate==="undefined")f.cellTemplate=function(a){return G(a.ganttChartView.ownerDocument,a.content)};if(c.verticalGridLines){if(f.minWidth<
4)f.minWidth=4;if(f.width<f.minWidth)f.width=f.minWidth}}},Ac=function(a,d,c){var b=a.ownerDocument,e=b.createElement("div");typeof c.columnHeaderClass!=="undefined"&&e.setAttribute("class",c.columnHeaderClass);typeof c.columnHeaderStyle!=="undefined"&&e.setAttribute("style",c.columnHeaderStyle);for(var f=0;f<d.length;f++)e.appendChild(Ic(b,d[f],c));a.appendChild(e)},Ic=function(a,d,c){var b=a.createElement("div");b.setAttribute("style","overflow-y: hidden; vertical-align: middle; display: table-cell; -wekbit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; height: "+
c.headerHeight+"px");var e=a.createElement("div"),f=d.width>=4?2:d.width/2;e.setAttribute("style","padding-left: "+f+"px; padding-right: "+f+"px; overflow-x: hidden; -wekbit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; width: "+d.width+"px");f=a.createElement("div");typeof d.headerClass!=="undefined"&&f.setAttribute("class",d.headerClass);typeof d.headerStyle!=="undefined"&&f.setAttribute("style",d.headerStyle);f.appendChild(G(a,d.header));e.appendChild(f);b.appendChild(e);
if(d.width>=1&&(typeof c.allowUserToResizeColumns==="undefined"||c.allowUserToResizeColumns)&&(typeof d.allowUserToResize==="undefined"||d.allowUserToResize)){b.isGripperVisible=false;var g=d.ganttChartView,l=function(a){b.isGripperVisible=a;b.style.cursor=a?"e-resize":"default";b.style.borderRight=a?"solid 1px "+c.border:c.verticalGridLines?"solid 1px "+c.verticalGridLines:"";e.style.width=d.width-(b.style.borderRight?1:0)+"px"};c.verticalGridLines&&l();var h=c.splitterWidth;b.addEventListener("mouseover",
function(a){if(!DlhSoft.Controls.GanttChartView.isGripperDragging&&!(b.isGripperDragging||typeof a.offsetX==="undefined"&&a.currentTarget!=b))l((typeof a.offsetX!=="undefined"?a.offsetX:a.layerX-a.currentTarget.offsetLeft)>=d.width-h)},true);b.addEventListener("mousemove",function(a){if(!DlhSoft.Controls.GanttChartView.isGripperDragging&&!(b.isGripperDragging||typeof a.offsetX==="undefined"&&a.currentTarget!=b))l((typeof a.offsetX!=="undefined"?a.offsetX:a.layerX-a.currentTarget.offsetLeft)>=d.width-
h)},true);e.addEventListener("mouseover",function(a){!DlhSoft.Controls.GanttChartView.isGripperDragging&&(!b.isGripperDragging&&!(typeof a.offsetX!=="undefined"||a.currentTarget!=e))&&l(a.layerX-a.currentTarget.offsetLeft>=d.width-h)},false);e.addEventListener("mousemove",function(a){!DlhSoft.Controls.GanttChartView.isGripperDragging&&(!b.isGripperDragging&&!(typeof a.offsetX!=="undefined"||a.currentTarget!=e))&&l(a.layerX-a.currentTarget.offsetLeft>=d.width-h)},false);b.addEventListener("mousedown",
function(a){if(!(a.button!=0||!b.isGripperVisible||DlhSoft.Controls.GanttChartView.isGripperDragging)){DlhSoft.Controls.GanttChartView.isGripperDragging=true;b.isGripperDragging=true;b.initialGripperDraggingX=a.clientX;b.initialColumnWidth=d.width}},true);a.addEventListener("mousemove",function(a){if(b.isGripperDragging){d.width=Math.max(d.minWidth,b.initialColumnWidth+(a.clientX-b.initialGripperDraggingX));if(typeof d.maxWidth!=="undefined"&&d.width>d.maxWidth)d.width=d.maxWidth;e.style.width=d.width-
1+"px";typeof c.columnWidthChangeHandler!=="undefined"&&setTimeout(function(){c.columnWidthChangeHandler(d,d.width)},0);if(!g.isWaitingToRefreshColumns){g.isWaitingToRefreshColumns=true;setTimeout(function(){var a=hb(c.columns);g.gridHeader.style.width=a+"px";g.gridContent.style.width=a+"px";delete g.isWaitingToRefreshColumns;g.refreshGridItems()},0)}}},true);a.addEventListener("mouseup",function(){if(b.isGripperDragging){delete b.isGripperDragging;delete b.initialGripperDraggingX;delete b.initialColumnWidth;
l(false);delete DlhSoft.Controls.GanttChartView.isGripperDragging}},true);b.addEventListener("mouseout",function(){b.isGripperDragging||l(false)},false)}return b},oa=function(a,d){for(var c=-1,b=null,e=null,f=[],g=0;g<a.length;g++){var l=a[g];if(typeof l.scheduleChartItem==="undefined"){if(typeof l.isSelected==="undefined")l.isSelected=false;if(l.isSelected){e==null&&(e=l);f.push(l)}if(typeof l.indentation==="undefined")l.indentation=0;if(g==0&&l.indentation!=0){l.indentation=0;y(l,"indentation",
false,true)}if(typeof l.isExpanded==="undefined")l.isExpanded=true;if(b!=null){var h=b.indentation+1;if(l.indentation>h){l.indentation=h;y(l,"indentation",false,true)}b.hasChildren=l.indentation>b.indentation;if(b.hasChildren&&typeof b.isMilestone!=="undefined"&&b.isMilestone){b.isMilestone=false;y(b,"isMilestone",false,true)}}}l.isVisible=c<0||l.indentation<=c;if(typeof l.scheduleChartItem==="undefined"){if(l.isVisible&&!l.isExpanded)c=l.indentation;l.isExpanded&&l.indentation==c&&(c=-1);b=l}}if(b!=
null)b.hasChildren=false;d.selectedItem=e;d.selectedItems=f},da=function(a,d,c){c.isTimingInformationInitialized=false;c.isBasicTimingInformationInitialized=false;var b=Y(d.currentTime),e=[],f,g,l;for(g=0;g<a.length;g++){f=a[g];f.index=g;var h=null;for(e.length>0&&(h=e[e.length-1]);h!=null&&f.indentation<=h.indentation;){e.pop();h=e[e.length-1]}f.parent=h;f.children=[];h!=null&&h.children.push(f);if(!f.hasChildren||!(typeof f.isSummaryEnabled==="undefined"||f.isSummaryEnabled)){l=f.start;var o=f.finish,
n=f.completedFinish;if(typeof f.start==="undefined"){f.start=b;f.preferredStart=f.start}if(typeof f.finish==="undefined")f.finish=typeof f.isMilestone==="undefined"||!f.isMilestone?ba(b):f.start;if(typeof f.isSetAsCompleted==="undefined")f.isSetAsCompleted=typeof f.completedFinish!=="undefined"&&f.completedFinish.valueOf()==f.finish.valueOf();if(typeof f.completedFinish==="undefined")f.completedFinish=f.start;if(typeof f.isRelativeToTimezone==="undefined"||f.isRelativeToTimezone){f.start=new Date(f.start.valueOf()-
f.start.getTimezoneOffset()*6E4);f.preferredStart=f.start;f.finish=new Date(f.finish.valueOf()-f.finish.getTimezoneOffset()*6E4);f.completedFinish=typeof f.completedFinish==="number"?R(f.start,f.completedFinish*L(f.start,f.finish,d,E(f)),d,E(f)):new Date(f.completedFinish.valueOf()-f.completedFinish.getTimezoneOffset()*6E4);if(typeof f.baselineStart!=="undefined")f.baselineStart=new Date(f.baselineStart.valueOf()-f.baselineStart.getTimezoneOffset()*6E4);if(typeof f.baselineFinish!=="undefined")f.baselineFinish=
new Date(f.baselineFinish.valueOf()-f.baselineFinish.getTimezoneOffset()*6E4);if(typeof f.minStart!=="undefined")f.minStart=new Date(f.minStart.valueOf()-f.minStart.getTimezoneOffset()*6E4);if(typeof f.maxStart!=="undefined")f.maxStart=new Date(f.maxStart.valueOf()-f.maxStart.getTimezoneOffset()*6E4);if(typeof f.minFinish!=="undefined")f.minFinish=new Date(f.minFinish.valueOf()-f.minFinish.getTimezoneOffset()*6E4);if(typeof f.maxFinish!=="undefined")f.maxFinish=new Date(f.maxFinish.valueOf()-f.maxFinish.getTimezoneOffset()*
6E4);f.isRelativeToTimezone=false}else if(typeof f.completedFinish==="number")f.completedFinish=R(f.start,f.completedFinish*L(f.start,f.finish,d,E(f)),d,E(f));if(typeof f.minStart!=="undefined"&&f.start<f.minStart)f.start=f.minStart;else if(typeof f.maxStart!=="undefined"&&f.start>f.maxStart)f.start=f.maxStart;if(typeof f.maxFinish!=="undefined"&&f.finish>f.maxFinish)f.finish=f.maxFinish;else if(typeof f.minFinish!=="undefined"&&f.finish<f.minFinish)f.finish=f.minFinish;if(f.finish<f.start)f.finish=
f.start;if(f.completedFinish<f.start)f.completedFinish=f.start;else if(f.completedFinish>f.finish)f.completedFinish=f.finish;if(typeof f.loadChartItem==="undefined")f.start=M(f.start,d,true,typeof f.isMilestone!=="undefined"&&f.isMilestone,E(f));typeof f.dependsOf!=="undefined"&&delete f.dependsOf;f.preferredStart=f.start;if(typeof f.loadChartItem==="undefined"){f.finish=M(f.finish,d,typeof f.isMilestone!=="undefined"&&f.isMilestone,true,E(f));f.completedFinish=M(f.completedFinish,d,typeof f.isMilestone!==
"undefined"&&f.isMilestone,true,E(f))}if(f.finish<f.start)f.finish=f.start;if(typeof f.isMilestone==="undefined")f.isMilestone=!(f.hasChildren&&(typeof f.isSummaryEnabled==="undefined"||f.isSummaryEnabled))&&f.finish.valueOf()==f.start.valueOf();if(f.completedFinish<f.start)f.completedFinish=f.start;if(f.completedFinish>f.finish)f.completedFinish=f.finish;if(typeof f.isSetAsCompleted!=="undefined"&&(!f.isMilestone||f.completedFinish.valueOf()<f.finish.valueOf()))f.isSetAsCompleted=false;(typeof l===
"undefined"||f.start.valueOf()!=l.valueOf())&&y(f,"start",false,true);(typeof o==="undefined"||f.finish.valueOf()!=o.valueOf())&&y(f,"finish",false,true);(typeof n==="undefined"||f.completedFinish.valueOf()!=n.valueOf())&&y(f,"completedFinish",false,true)}for(l=0;l<e.length;l++){o=e[l];if(typeof o.isSummaryEnabled==="undefined"||o.isSummaryEnabled){if(typeof o.start==="undefined"||o.start>f.start){o.start=f.start;y(o,"start",false,true)}if(typeof o.finish==="undefined"||o.finish<f.finish){o.finish=
f.finish;y(o,"finish",false,true)}if(typeof o.completedFinish==="undefined"||o.completedFinish.valueOf()!=o.start.valueOf()){o.completedFinish=o.start;y(o,"completedFinish",false,true)}}}(h==null||f.indentation>h.indentation)&&e.push(f)}c.isBasicTimingInformationInitialized=true;for(g=a.length;g-- >0;){f=a[g];f.hasChildren&&(typeof f.isSummaryEnabled==="undefined"||f.isSummaryEnabled)&&$a(f)}if(d.areTaskDependencyConstraintsEnabled)for(g=0;g<a.length;g++){f=a[g];typeof f.predecessors!=="undefined"&&
(f.predecessors!=null&&f.predecessors.length>0)&&La(f,a,d,c)}for(g=0;g<a.length;g++){f=a[g];if(!f.hasChildren&&f.hasFixedEffort){f.fixedEffort=ea(f,d);f.fixedEffortAssignments=ha(f)}}c.isTimingInformationInitialized=true},$a=function(a,d){if(!(a.children.length<=0||typeof a.isSummaryEnabled!=="undefined"&&!a.isSummaryEnabled)){typeof d==="undefined"&&(d=true);var c=a.start,b=a.finish,e=a.completedFinish;delete a.start;delete a.finish;delete a.completedFinish;for(var f=0;f<=1;f++){for(var g=0;g<a.children.length;g++){var l=
a.children[g];if(!(typeof l.isParentSummarizationEnabled!=="undefined"&&!l.isParentSummarizationEnabled&&f<1)){if(typeof a.start==="undefined"||a.start>l.start)a.start=l.start;if(typeof a.finish==="undefined"||a.finish<l.finish)a.finish=l.finish}}if(typeof a.start!=="undefined"&&typeof a.finish!=="undefined")break}a.completedFinish=a.start;(typeof c==="undefined"||a.start.valueOf()!=c.valueOf())&&y(a,"start",false,d);(typeof b==="undefined"||a.finish.valueOf()!=b.valueOf())&&y(a,"finish",false,d);
(typeof e==="undefined"||a.completedFinish.valueOf()!=e.valueOf())&&y(a,"completedFinish",false,d)}},nb=function(a,d){return a==d||mb(a,d)||mb(d,a)},mb=function(a,d){var c=a.parent;return c==null?false:(typeof c.isSummaryEnabled==="undefined"||c.isSummaryEnabled)&&c==d?true:mb(c,d)},Ga=function(a,d){if(typeof a.predecessors==="undefined")return false;for(var c=0;c<a.predecessors.length;c++)if(a.predecessors[c].item==d)return true;return false},Y=function(a){return new Date(Math.floor(a.valueOf()/
864E5)*864E5)},ka=function(a){return a.valueOf()-Y(a).valueOf()},ma=function(a){a=Math.floor((a.valueOf()-2592E5)/864E5)%7;a<0&&(a=a+7);return a},ya=function(a,d){Y(a);return new Date(Math.floor((a.valueOf()-2592E5)/6048E5)*6048E5+2592E5+d*864E5)},jb=function(a,d){var c=ya(a,d);return Math.abs(c.valueOf()-a.valueOf())<=36E5?c:new Date(c.valueOf()+6048E5)},ab=function(a){return a.hourWidth*(a.visibleDayFinish-a.visibleDayStart)/36E5},H=function(a,d){var c=ab(d),b=ab(d)*(d.visibleWeekFinish-d.visibleWeekStart+
1),e=ya(a,d.weekStartDay),e=Math.floor((e-d.timelineStart)/6048E5)*b-Math.max(0,d.weekStartDay-d.visibleWeekStart)*c,b=ma(a),e=b<=d.visibleWeekStart?e+0:b>d.visibleWeekFinish?e+(d.visibleWeekFinish-d.visibleWeekStart+1)*c:e+(b-d.visibleWeekStart)*c,c=ka(a);b>=d.visibleWeekStart&&b<=d.visibleWeekFinish&&(e=c<=d.visibleDayStart?e+0:c>=d.visibleDayFinish?e+(d.visibleDayFinish-d.visibleDayStart)/36E5*d.hourWidth:e+(c-d.visibleDayStart)/36E5*d.hourWidth);return e},Fa=function(a,d){for(var c=d.timelineStart.valueOf(),
b=ab(d),e=ab(d)*(d.visibleWeekFinish-d.visibleWeekStart+1);a>e;){c=c+6048E5;a=a-e}for(c=c+Math.max(0,d.visibleWeekStart-d.weekStartDay)*864E5;a>b;){c=c+864E5;a=a-b}c=c+d.visibleDayStart;c=c+a/d.hourWidth*36E5;return new Date(c)},Db=function(a){switch(a.theme){default:return[{scaleType:"NonworkingTime",isHeaderVisible:false,isHighlightingVisible:true,highlightingStyle:"stroke-width: 0; fill: #f4f4f4; fill-opacity: 0.65"},{scaleType:"Weeks",headerTextFormat:"Date",headerStyle:"padding: 2.25px"},{scaleType:"Days",
headerTextFormat:"DayOfWeekAbbreviation",headerStyle:"padding: 2.25px"},{scaleType:"CurrentTime",isHeaderVisible:false,isSeparatorVisible:true,separatorStyle:"stroke: #8bbf8a; stroke-width: 0.5px"}];case "ModernBordered":return[{scaleType:"NonworkingTime",isHeaderVisible:false,isHighlightingVisible:true,highlightingStyle:"stroke-width: 0; fill: #f4f4f4; fill-opacity: 0.65"},{scaleType:"Weeks",headerTextFormat:"Date",headerStyle:"padding: 2.25px; border-right: solid 1px White; border-bottom: solid 1px White",
isSeparatorVisible:true,separatorStyle:"stroke: #c8bfe7; stroke-width: 0.5px"},{scaleType:"Days",headerTextFormat:"DayOfWeekAbbreviation",headerStyle:"padding: 2.25px; border-right: solid 1px White"},{scaleType:"CurrentTime",isHeaderVisible:false,isSeparatorVisible:true,separatorStyle:"stroke: #8bbf8a; stroke-width: 1px"}];case "Aero":return[{scaleType:"NonworkingTime",isHeaderVisible:false,isHighlightingVisible:true,highlightingStyle:"stroke-width: 0; fill: #f4f4f4; fill-opacity: 0.65"},{scaleType:"Weeks",
headerTextFormat:"Date",headerStyle:"padding: 2.25px; border-right: solid 1px #c8bfe7; border-bottom: solid 1px #c8bfe7",isSeparatorVisible:true,separatorStyle:"stroke: #c8bfe7; stroke-width: 0.5px"},{scaleType:"Days",headerTextFormat:"DayOfWeekAbbreviation",headerStyle:"padding: 2.25px; border-right: solid 1px #c8bfe7"},{scaleType:"CurrentTime",isHeaderVisible:false,isSeparatorVisible:true,separatorStyle:"stroke: Black; stroke-width: 1px"}]}},ra=function(a,d){return new Date(Math.floor((a-2592E5).valueOf()/
d.updateScale)*d.updateScale+2592E5)},ib=function(a,d,c,b,e){typeof e==="undefined"&&(e=false);var f=a.ownerDocument,g=0,l,h;for(l=0;l<c.length;l++){h=c[l];(typeof h.isHeaderVisible==="undefined"||h.isHeaderVisible)&&g++}var o=b.headerHeight;g>0&&(o=b.headerHeight/g);for(l=0;l<c.length;l++){h=c[l];if(!e||!(h.scaleType!="CurrentTime"&&h.scaleType!="FutureTime")){g=Jc(h,b);if(typeof g!=="undefined"){g.length==0&&g.push({start:b.timelineStart,finish:b.timelineFinish});var n=o;if(typeof h.headerHeight!==
"undefined")n=h.headerHeight;for(var t=b.timelineStart,w=0;w<g.length;w++){var u=g[w],D=u.start,q=u.finish;if(h.scaleType!="CurrentTime"&&h.scaleType!="FutureTime"&&h.scaleType!="NonworkingTime"){if(D>t&&(typeof h.isHeaderVisible==="undefined"||h.isHeaderVisible))D=t;D<t&&(D=t);if(D<b.timelineStart)D=b.timelineStart;if(q>b.timelineFinish)q=b.timelineFinish;q<D&&(q=D);if(w==g.length-1&&q<b.timelineFinish&&(typeof h.isHeaderVisible==="undefined"||h.isHeaderVisible))q=b.timelineFinish;t=q}var J=H(D,
b),k=H(q,b),j=k-J;if(!(j<=0)){if(typeof h.isHeaderVisible==="undefined"||h.isHeaderVisible){var p=Kc(h,u,b),m=f.createElement("div");m.setAttribute("style","float: left; overflow: hidden; width: "+j+"px; height: "+n+"px");var s=f.createElement("div");s.setAttribute("class",h.headerClass);s.setAttribute("style",h.headerStyle);s.appendChild(G(f,p));m.appendChild(s);a.appendChild(m)}u.start=D;u.finish=q;u=false;if(typeof h.isHighlightingVisible!=="undefined")u=h.isHighlightingVisible;if(u){u=f.createElementNS("http://www.w3.org/2000/svg",
"rect");u.setAttribute("x",J-1);u.setAttribute("y",0);u.setAttribute("width",j);u.setAttribute("height",0);u.setAttribute("class",h.highlightingClass);u.setAttribute("style",h.highlightingStyle);u.tag="Scale-Highlighting"+(h.scaleType!="CurrentTime"&&h.scaleType!="FutureTime"?"":"-CurrentTime");d.appendChild(u)}J=false;if(typeof h.isSeparatorVisible!=="undefined")J=h.isSeparatorVisible;if(J){J=f.createElementNS("http://www.w3.org/2000/svg","line");J.setAttribute("x1",k-0.75);J.setAttribute("y1",0);
J.setAttribute("x2",k-0.75);J.setAttribute("y2",0);J.setAttribute("class",h.separatorClass);J.setAttribute("style",h.separatorStyle);J.tag="Scale-Separator"+(h.scaleType!="CurrentTime"&&h.scaleType!="FutureTime"?"":"-CurrentTime");d.appendChild(J)}}}}}}},Jc=function(a,d){var c="Custom",b,e;if(typeof a.scaleType!=="undefined")c=a.scaleType;switch(c){case "CurrentTime":return[{start:d.timelineStart,finish:d.currentTime}];case "FutureTime":return[{start:d.currentTime,finish:d.timelineFinish}];case "Years":c=
[];b=new Date(d.timelineStart.valueOf());e=b.getTimezoneOffset();b.setMonth(0,1);var f=b.getTimezoneOffset();for(b=new Date(b.valueOf()-(f-e)*6E4-(f>0?864E5:0));e=Lc(b),b<d.timelineFinish;b=e)c.push({start:b,finish:e});return c;case "Months":c=[];b=new Date(d.timelineStart.valueOf());e=b.getTimezoneOffset();b.setDate(1);f=b.getTimezoneOffset();for(b=new Date(b.valueOf()-(f-e)*6E4-(f>0?864E5:0));e=Mc(b),b<d.timelineFinish;b=e)c.push({start:b,finish:e});return c;case "Weeks":c=[];b=d.timelineStart;
e=d.weekStartDay;for(f=d.visibleWeekStart;ma(b)!=e;)b=Ma(b);for(;ma(b)<f;)b=ba(b);for(b=new Date(b.valueOf());e=za(b),b<d.timelineFinish;b=e)c.push({start:b,finish:e});return c;case "Days":c=[];for(b=d.timelineStart;e=ba(b),b<d.timelineFinish;b=e)c.push({start:b,finish:e});return c;case "Hours":c=[];for(b=new Date(Y(d.timelineStart).valueOf()+d.visibleDayStart);e=Nc(new Date(b.valueOf()+36E5),d.visibleDayFinish,d.visibleDayStart),b<d.timelineFinish;b=e)c.push({start:b,finish:e});return c;case "NonworkingTime":c=
[];b=kb(d.timelineStart,d.workingWeekFinish);for(e=lb(b,d.workingWeekStart);b<d.timelineFinish;b=za(b),e=za(e))c.push({start:b,finish:e});if(typeof d.specialNonworkingDays!=="undefined")for(f=0;f<d.specialNonworkingDays.length;f++){b=d.specialNonworkingDays[f];e=ba(b);c.push({start:b,finish:e})}return c;default:return a.intervals}},Nc=function(a,d,c){if(ka(a)>d){a=ba(a);return new Date(Y(a).valueOf()+c)}return new Date(a.valueOf())},ba=function(a){return new Date(a.valueOf()+864E5)},Ma=function(a){return new Date(a.valueOf()-
864E5)},za=function(a){return new Date(a.valueOf()+6048E5)},Mc=function(a){var d=a.getTimezoneOffset(),a=new Date(a.valueOf()+(d>0?864E5:0)),c=a.getMonth()+1;if(c>=12){c=0;a.setFullYear(a.getFullYear()+1)}a.setMonth(c,1);c=a.getTimezoneOffset();return new Date(a.valueOf()-(c-d)*6E4-(c>0?864E5:0))},Lc=function(a){var d=a.getTimezoneOffset(),a=new Date(a.valueOf()+(d>0?864E5:0));a.setFullYear(a.getFullYear()+1);a.setMonth(0,1);var c=a.getTimezoneOffset();return new Date(a.valueOf()-(c-d)*6E4-(c>0?864E5:
0))},Rb=function(a,d){if(typeof d==="undefined")return false;for(var c=a.valueOf(),b=0;b<d.length;b++)if(d[b].valueOf()==c)return true;return false},kb=function(a,d){for(;ma(a)!=d;)a=Ma(a);return ba(a)},lb=function(a,d){for(;ma(a)!=d;)a=ba(a);return new Date(a.valueOf())},Kc=function(a,d,c){var b="Date";if(typeof a.headerTextFormat!=="undefined")b=a.headerTextFormat;a=d.start;if(a<c.timelineStart)a=c.timelineStart;if(typeof b==="function")return b(a);switch(b){case "Localized":return a.toLocaleString();
case "DateTime":return c.dateTimeFormatter(N(a));case "Date":return c.dateFormatter(N(a));case "Hour":a=new Date(a.valueOf()+a.getTimezoneOffset()*6E4);return(a.getHours()<10?"0":"")+a.getHours();case "DayOfWeek":return c.daysOfWeek[ma(a)];case "DayOfWeekAbbreviation":d=c.daysOfWeek[ma(a)];return d.length>0?d[0].toUpperCase():"";case "Day":a=new Date(a.valueOf()+a.getTimezoneOffset()*6E4);return(a.getDate()<10?"0":"")+a.getDate();case "Month":return c.months[(new Date(a.valueOf()+(a.getTimezoneOffset()+
720)*6E4)).getMonth()];case "MonthAbbreviation":d=c.months[(new Date(a.valueOf()+(a.getTimezoneOffset()+720)*6E4)).getMonth()];return d.length<=0?"":d[0].toUpperCase()+(d.length>1?d.substr(1,Math.min(3,d.length)-1):"");case "Year":return(new Date(a.valueOf()+(a.getTimezoneOffset()+720)*6E4)).getFullYear();case "MonthYear":return c.months[(new Date(a.valueOf()+(a.getTimezoneOffset()+720)*6E4)).getMonth()]+" "+(new Date(a.valueOf()+(a.getTimezoneOffset()+720)*6E4)).getFullYear();default:return d.headerText?
d.headerText:a.toString()}},Bc=function(a,d,c,b,e,f,g){for(var l=0,h=0;h<b.length;h++){var o=b[h];g.isGridVisible&&typeof o.displayRowIndex==="undefined"&&a.appendChild(Sb(o,b,e,d,f,g));var n=l;typeof o.displayRowIndex!=="undefined"&&(n=o.displayRowIndex*g.itemHeight);c.appendChild(Tb(o,n,g));o.isVisible&&!(typeof o.isHidden!=="undefined"&&o.isHidden)&&(l=Math.max(l,n+g.itemHeight));o.itemTop=n}va(d,l);setTimeout(function(){Na(b,d,g)},0)},wa=function(a,d){for(var c=0,b=0,e=-1,f=0;f<a.length;f++){var g=
a[f];if((typeof g.scheduleChartItem==="undefined"||g.scheduleChartItem==g)&&g.isVisible&&!(typeof g.isHidden!=="undefined"&&g.isHidden))if(typeof g.displayRowIndex==="undefined"&&b>e){c=c+d.itemHeight;e=b++}else{c=Math.max(c,g.itemTop+d.itemHeight);e=g.displayRowIndex}}return c},Ba=function(a,d,c){if(a.isPart)return Ba(a.ganttChartItem,d,c);var b;if(typeof a.displayRowIndex!=="undefined"){b=a.displayRowIndex*c.itemHeight;return a.itemTop=b}for(var e=b=0;e<d.length;e++){var f=d[e];if(f==a)break;f.isVisible&&
(!(typeof f.isHidden!=="undefined"&&f.isHidden)&&typeof f.displayRowIndex==="undefined")&&(b=b+c.itemHeight)}return a.itemTop=b},Na=function(a,d,c){if(!(typeof c.alternativeItemClass==="undefined"&&typeof c.alternativeItemStyle==="undefined"&&typeof c.alternativeChartItemClass==="undefined"&&typeof c.alternativeChartItemStyle==="undefined")){var b=d.chartAreaAlternativeRows,e,f=0,g=false;b.count=f;for(e=0;e<a.length;e++){var l=a[e];if(l.isVisible&&typeof l.alternativeContentContainer!=="undefined"){var h=
l.alternativeContentContainer;if(f%2==1){typeof c.alternativeItemClass!=="undefined"&&h.setAttribute("class",c.alternativeItemClass);typeof c.alternativeItemStyle!=="undefined"&&h.setAttribute("style",c.alternativeItemStyle);if(typeof c.alternativeChartItemClass!=="undefined"||typeof c.alternativeChartItemStyle!=="undefined")if(!c.isVirtualizing||l.isVirtuallyVisible||!g){g=true;if(typeof b.count==="undefined"||f>b.count){l=document.createElementNS("http://www.w3.org/2000/svg","rect");l.setAttribute("x",
0);l.setAttribute("y",f*c.itemHeight);l.setAttribute("width",d.clientWidth);l.setAttribute("height",c.itemHeight);typeof c.alternativeChartItemClass!=="undefined"&&l.setAttribute("class",c.alternativeChartItemClass);typeof c.alternativeChartItemStyle!=="undefined"&&l.setAttribute("style",c.alternativeChartItemStyle);l.index=f;b.appendChild(l)}}b.count=f}else{h.setAttribute("class","");h.setAttribute("style","")}f++}}for(e=b.childNodes.length;e-- >0;){a=b.childNodes[e];a.index>b.count&&b.removeChild(a)}}},
Sb=function(a,d,c,b,e,f){var g=a.ganttChartView.ownerDocument,l=g.createElement("div");typeof f.itemClass!=="undefined"&&l.setAttribute("class",f.itemClass);typeof f.itemStyle!=="undefined"&&l.setAttribute("style",f.itemStyle);var h=g.createElement("div");a.alternativeContentContainer=h;var o=g.createElement("div");try{o.addEventListener("mousedown",function(b){b.target!=a.selectionInput&&x(a,f)},false);o.addEventListener("mouseup",function(b){b.target!=a.selectionInput&&x(a,f)},false)}catch(n){}if(a.isSelected){typeof f.selectedItemClass!==
"undefined"&&o.setAttribute("class",f.selectedItemClass);typeof f.selectedItemStyle!=="undefined"&&o.setAttribute("style",f.selectedItemStyle)}var t=g.createElement("div");typeof a["class"]!=="undefined"&&t.setAttribute("class",a["class"]);typeof a.style!=="undefined"&&t.setAttribute("style",a.style);var w=g.createElement("div");if(a.hasChildren&&(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled)){typeof f.summaryItemClass!=="undefined"&&w.setAttribute("class",f.summaryItemClass);typeof f.summaryItemStyle!==
"undefined"&&w.setAttribute("style",f.summaryItemStyle)}else if(a.isMilestone){typeof f.milestoneItemClass!=="undefined"&&w.setAttribute("class",f.milestoneItemClass);typeof f.milestoneItemStyle!=="undefined"&&w.setAttribute("style",f.milestoneItemStyle)}else{typeof f.standardItemClass!=="undefined"&&w.setAttribute("class",f.standardItemClass);typeof f.standardItemStyle!=="undefined"&&w.setAttribute("style",f.standardItemStyle)}g=g.createElement("div");a.gridItem=g;a.gridItemContent=w;a.gridItemSelectionContainer=
o;var u=f.itemHeight;if(!a.isVisible||typeof a.isHidden!=="undefined"&&a.isHidden)u=0;g.setAttribute("style","overflow: hidden; height: "+u+"px");Ca(g,a,d,c,b,e,f);w.appendChild(g);t.appendChild(w);o.appendChild(t);h.appendChild(o);l.appendChild(h);a.gridItemContainer=l;(typeof f.isGridRowClickTimeScrollingEnabled==="undefined"||f.isGridRowClickTimeScrollingEnabled)&&l.addEventListener("mouseup",function(){var c;if(typeof a.ganttChartItems==="undefined")c=a.start;else{c=null;for(var d=0;d<a.ganttChartItems.length;d++)if(c==
null||a.ganttChartItems[d].start<c)c=a.ganttChartItems[d].start;c=c==null?a.start:c}c=H(c,f);d=c-f.hourWidth*8;c-d>=b.container.clientWidth/2.5&&(d=c);b.container.scrollLeft=Math.max(0,d)},true);return l},Ca=function(a,d,c,b,e,f,g){var l=d.ganttChartView.ownerDocument;if(!g.isVirtualizing||typeof d.isVirtuallyVisible!=="undefined"&&d.isVirtuallyVisible){var h=function(){if(typeof d.gridItemSelectionContainer!=="undefined"){var h=d.gridItemSelectionContainer;typeof g.selectedItemClass!=="undefined"&&
h.setAttribute("class",d.isSelected?g.selectedItemClass:null);typeof g.selectedItemStyle!=="undefined"&&h.setAttribute("style",d.isSelected?g.selectedItemStyle:null)}if(typeof d.gridItemContent!=="undefined"){h=d.gridItemContent;h.setAttribute("class","");h.setAttribute("style","");if(d.hasChildren&&(typeof d.isSummaryEnabled==="undefined"||d.isSummaryEnabled)){typeof g.summaryItemClass!=="undefined"&&h.setAttribute("class",g.summaryItemClass);typeof g.summaryItemStyle!=="undefined"&&h.setAttribute("style",
g.summaryItemStyle)}else if(d.isMilestone){typeof g.milestoneItemClass!=="undefined"&&h.setAttribute("class",g.milestoneItemClass);typeof g.milestoneItemStyle!=="undefined"&&h.setAttribute("style",g.milestoneItemStyle)}else{typeof g.standardItemClass!=="undefined"&&h.setAttribute("class",g.standardItemClass);typeof g.standardItemStyle!=="undefined"&&h.setAttribute("style",g.standardItemStyle)}}var h=[],n=null;try{n=l.activeElement}catch(t){}for(;n!=null&&n!=d.gridItem;){h.push(n);n=n.parentNode}for(var w=
-1,n=a.childNodes.length;n-- >0;)if(h.indexOf(a.childNodes[n])>=0){w=n;break}for(n=a.childNodes.length;n-- >0;)a.removeChild(a.childNodes[n]);for(n=0;n<b.length;n++)a.appendChild(Ub(d,c,b[n],e,f,g));typeof d.ganttChartView.draggingItem==="undefined"&&w>=0&&setTimeout(function(){try{for(var b=a.childNodes[w];b.nodeName!="input"&&b.nodeName!="textarea"&&b.nodeName!="label"&&b.nodeName!="select"&&b.nodeName!="button"&&b.childNodes.length>0;)b=b.childNodes[0];b&&b.dontAutoFocus?delete b.dontAutoFocus:
setTimeout(function(){try{b.focus()}catch(a){}},0)}catch(c){}},0)};if(d.wasGridItemContentLoaded)setTimeout(h,0);else{h();d.wasGridItemContentLoaded=true}}},Oa=function(a){if(typeof a.isWaitingToRefreshGridItem==="undefined"){a.isWaitingToRefreshGridItem=true;setTimeout(function(){typeof a.gridItem!=="undefined"&&Ca(a.gridItem,a,a.ganttChartView.items,a.ganttChartView.settings.columns,a.ganttChartView.chartContent,a.ganttChartView.settings.toggleButtonAreaWidth,a.ganttChartView.settings);delete a.isWaitingToRefreshGridItem},
0)}},Oc=function(a,d,c,b,e,f,g){var l=d.ganttChartView.ownerDocument;(!g.isVirtualizing||typeof d.isVirtuallyVisible!=="undefined"&&d.isVirtuallyVisible)&&setTimeout(function(){if(typeof d.gridItemSelectionContainer!=="undefined"){var h=d.gridItemSelectionContainer;typeof g.selectedItemClass!=="undefined"&&h.setAttribute("class",d.isSelected?g.selectedItemClass:null);typeof g.selectedItemStyle!=="undefined"&&h.setAttribute("style",d.isSelected?g.selectedItemStyle:null)}var h=[],o=null;try{o=l.activeElement}catch(n){}for(;o!=
null&&o!=d.gridItem;){h.push(o);o=o.parentNode}for(var t=-1,o=a.childNodes.length;o-- >0;)if(a.childNodes[o].isSelection&&h.indexOf(a.childNodes[o])>=0){t=o;break}for(o=a.childNodes.length;o-- >0;)a.childNodes[o].isSelection&&a.removeChild(a.childNodes[o]);for(o=0;o<b.length;o++)b[o].isSelection&&o<a.childNodes.length&&a.insertBefore(Ub(d,c,b[o],e,f,g),a.childNodes[o]);typeof d.ganttChartView.draggingItem==="undefined"&&t>=0&&setTimeout(function(){try{for(var b=a.childNodes[t];b.nodeName!="input"&&
b.nodeName!="textarea"&&b.nodeName!="label"&&b.nodeName!="select"&&b.nodeName!="button"&&b.childNodes.length>0;)b=b.childNodes[0];b&&b.dontAutoFocus?delete b.dontAutoFocus:setTimeout(function(){try{b.focus()}catch(a){}},0)}catch(c){}},0)},0)},Pb=function(a){typeof a.gridItem!=="undefined"&&Oc(a.gridItem,a,a.ganttChartView.items,a.ganttChartView.settings.columns,a.ganttChartView.chartContent,a.ganttChartView.settings.toggleButtonAreaWidth,a.ganttChartView.settings)},Ub=function(a,d,c,b,e,f){var g=
a.ganttChartView.ownerDocument,l=g.createElement("div"),h=0;c.isTreeView==true&&(h=f.indentationLevelWidth*a.indentation);l.setAttribute("style","overflow: hidden; vertical-align: middle; display: table-cell; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; margin: 0px; padding: 0px; width: "+c.width+"px; height: "+f.itemHeight+"px; padding-left: "+h+"px");var o=g.createElement("div");typeof c.cellClass!=="undefined"?o.setAttribute("class",c.cellClass):typeof f.cellClass!==
"undefined"&&o.setAttribute("class",f.cellClass);typeof c.cellStyle!=="undefined"?o.setAttribute("style",c.cellStyle):typeof f.cellStyle!=="undefined"&&o.setAttribute("style",f.cellStyle);var n=g.createElement("div");n.setAttribute("style","white-space: nowrap; overflow: hidden; margin: 0px; padding: 0px; width: "+(c.width-h-16)+"px");if(c.isTreeView==true){h=g.createElement("div");h.setAttribute("style","display: inline-block; width: "+e+"px");if(a.hasChildren){e=g.createElement("div");e.setAttribute("style",
"cursor: default; padding-left: 1px; font-size: 12px; display: inline-block");g=f.collapsedToggleButtonTemplate;if(a.isExpanded)g=f.expandedToggleButtonTemplate;g=g();e.appendChild(g);Vb(e,a,d,g,b,null,null,f);h.appendChild(e)}n.appendChild(h)}a=c.cellTemplate(a);n.appendChild(a);o.appendChild(n);l.appendChild(o);l.isSelection=c.isSelection;return l},Bb=function(a,d){return function(){var c=a.ownerDocument.createElementNS("http://www.w3.org/2000/svg","polygon");c.setAttribute("points","3.5,2.5 3.5,11.5 10.5,6.5");
return j(c,d)}},Cb=function(a,d){return function(){var c=a.ownerDocument.createElementNS("http://www.w3.org/2000/svg","polygon");c.setAttribute("points","2.5,3.5 11.5,3.5 6.5,10.5");return j(c,d)}},Vb=function(a,d,c,b,e,f,g,l){if(typeof f==="undefined"||f==null)f=b.querySelector("#PART_Button");f!=null&&Wb(f,f,l);if(typeof g==="undefined"||g==null)g=b.querySelector("#PART_Border");g!=null&&Wb(g,f,l);c={toggleButton:a,item:d,items:c,content:b,chartContent:e,settings:l};if(f!=null){f.tag=c;(typeof l.isExport===
"undefined"||!l.isExport)&&f.addEventListener("mouseup",ob,true)}if(g!=null){g.tag=c;(typeof l.isExport==="undefined"||!l.isExport)&&g.addEventListener("mouseup",ob,true)}a.tag=c;f==null&&(g==null&&(typeof l.isExport==="undefined"||!l.isExport))&&a.addEventListener("mouseup",ob,true);b.addEventListener("keypress",function(a){if(a.keyCode==32){a.preventDefault();a.stopPropagation();ia(d,!d.isExpanded,true)}},true);d.toggleButton=a},Wb=function(a,d,c){if(!(typeof c.isExport!=="undefined"&&c.isExport)){a.addEventListener("mouseover",
function(){typeof c.toggleButtonHoveringClass!=="undefined"&&d.setAttribute("class",c.toggleButtonHoveringClass);typeof c.toggleButtonHoveringStyle!=="undefined"&&d.setAttribute("style",c.toggleButtonHoveringStyle)},true);a.addEventListener("mouseout",function(){d.setAttribute("class",c.toggleButtonClass);d.setAttribute("style",c.toggleButtonStyle)},true)}},ob=function(a){a.stopPropagation();a=a.target.tag.item;ia(a,!a.isExpanded,true)},ia=function(a,d,c,b){if(a.isExpanded!=d){a.isExpanded=d;(typeof b===
"undefined"||b)&&y(a,"isExpanded",c,true);Xb(a)}},Xb=function(a,d){if(typeof a.toggleButton==="undefined")(typeof d==="undefined"||d)&&setTimeout(function(){Xb(a,false)},0);else{var c=a.toggleButton,b=c.tag,e=b.settings,f=e.expandedToggleButtonTemplate,g=e.collapsedToggleButtonTemplate;a.isExpanded&&(g=f);var f=g(),g=f.querySelector("#PART_Button"),l=f.querySelector("#PART_Border");c.replaceChild(f,b.content);b.content=f;var h=b.items,b=b.chartContent;Vb(c,a,h,f,b,g,l,e);a.isVisible&&!(typeof a.isHidden!==
"undefined"&&a.isHidden)&&Pc(h,a,b,e);qa(a);Na(h,b,e);c=a.scheduleChartView;if(typeof c!=="undefined")for(e=a.scheduleChartIndex;e<c.scheduleChartItems.length;e++){b=c.scheduleChartItems[e];if(typeof b.ganttChartItems!=="undefined")for(f=0;f<b.ganttChartItems.length;f++){g=b.ganttChartItems[f];g.displayRowIndex=b.itemTop/c.settings.itemHeight;c.refreshChartItem(g)}}}},Pc=function(a,d,c,b){var e=-1,f=false,g=false,l=false,h=0,o,n,t,w=[];for(n=0;n<a.length;n++){t=a[n];if(t==d){f=t.isExpanded;e=t.indentation}else t.indentation<=
e&&(l=true);var u=t.chartItem;if(g&&!l){if(f){o=true;for(var D=t.parent;D!=null;){if(!D.isVisible||!D.isExpanded){o=false;break}D=D.parent}}else o=false;if(t.isVisible!=o){t.isVisible=f;y(t,"isVisible",false,true);o=b.itemHeight;if(!t.isVisible||typeof t.isHidden!=="undefined"&&t.isHidden)o=0;if(typeof t.gridItem!=="undefined")t.gridItem.style.height=o+"px";o="visible";if(!t.isVisible||typeof t.isHidden!=="undefined"&&t.isHidden)o="hidden";u.setAttribute("style","visibility: "+o)}}if(typeof t.displayRowIndex===
"undefined"){u.setAttribute("transform","translate(0, "+h+")");Ha(t,h)}t==d&&(g=true);o=b.itemHeight;if(!t.isVisible||typeof t.isHidden!=="undefined"&&t.isHidden)o=0;if(t.itemTop!=h)t.itemTop=h;typeof t.displayRowIndex==="undefined"&&(h=h+o);if(t.predecessors&&t.predecessors.length>0&&w.indexOf(t)<0){w.push(t);for(u=0;u<t.predecessors.length;u++){o=t.predecessors[u].item;w.indexOf(o)<0&&w.push(o)}}}va(c,h);sa(a,d);if(b.areTaskDependenciesVisible)for(n=0;n<w.length;n++)sa(a,w[n]);xa(a,c.container,
b)},Ha=function(a,d){typeof a.parts==="undefined"||a.parts.length<=0||setTimeout(function(){for(var c=0;c<a.parts.length;c++){var b=a.parts[c];b.itemTop=d;if(typeof b.chartItem!=="undefined"){b.chartItem.setAttribute("transform","translate(0, "+d+")");b.chartItem.style.visibility=a.chartItem.style.visibility;if(typeof b.isInternallyHidden!=="undefined"){delete b.isInternallyHidden;b.chartItem.style.display="inline"}}}},0)},va=function(a,d){if(d<a.availableHeight)d=a.availableHeight;a.style.height=
d+"px";var c=a.chartArea;c.style.height=d+"px";for(var b=0;b<c.childNodes.length;b++){var e=c.childNodes[b];if(typeof e.tag!=="undefined")switch(e.tag){case "Scale-Highlighting":case "Scale-Highlighting-CurrentTime":e.setAttribute("height",d);break;case "Scale-Separator":case "Scale-Separator-CurrentTime":e.setAttribute("y2",d)}}},sa=function(a,d){var c=[],b,e,f,g;if(typeof d.successors==="undefined"){d.successors=[];for(e=0;e<a.length;e++){b=a[e];if(!(b==d||typeof b.predecessors==="undefined"||b.predecessors.length==
0))for(f=0;f<b.predecessors.length;f++)if(b.predecessors[f].item==d){d.successors.push(b);break}}}for(e=0;e<d.successors.length;e++){var l=d.successors[e];if(typeof l.predecessors!=="undefined"&&l.predecessors.length>0)for(f=0;f<l.predecessors.length;f++){var h=l.predecessors[f].item;if(typeof h!=="undefined"){b=true;for(g=0;g<c;g++)if(h==c[g]){b=false;break}if(b){ga(h.chartItem,h,h.ganttChartView.settings);c.push(h)}}}if(typeof l.predecessors!=="undefined"&&l.predecessors.length>0){b=true;for(g=
0;g<c;g++)if(typeof l!=="undefined"&&l==c[g]){b=false;break}if(b){ga(l.chartItem,l,l.ganttChartView.settings);c.push(l)}}}},Tb=function(a,d,c){var b=a.ganttChartView.ownerDocument.createElementNS("http://www.w3.org/2000/svg","g");a.chartItem=b;var e="visible";if(!a.isVisible||typeof a.isHidden!=="undefined"&&a.isHidden)e="hidden";b.setAttribute("style","visibility: "+e+"; -ms-touch-action: pinch-zoom; touch-action: pinch-zoom");b.setAttribute("transform","translate(0, "+d+")");if(typeof a.isInternallyHidden!==
"undefined"&&a.isInternallyHidden)b.style.display="none";Ha(a,d);ga(b,a,c);try{b.addEventListener("mousedown",function(){x(a,c)},false);b.addEventListener("mouseup",function(){x(a,c)},false)}catch(f){}return b},ga=function(a,d,c){for(var b=a.childNodes.length;b-- >0;)a.removeChild(a.childNodes[b]);if(!(c.isVirtualizing&&(typeof d.isVirtuallyVisible==="undefined"||!d.isVirtuallyVisible)||typeof d.isBarVisible!=="undefined"&&!d.isBarVisible)){b=c.standardTaskTemplate;if(typeof d.standardTaskTemplate!==
"undefined")b=d.standardTaskTemplate;if(d.hasChildren&&(typeof d.isSummaryEnabled==="undefined"||d.isSummaryEnabled)){b=c.summaryTaskTemplate;if(typeof d.summaryTaskTemplate!=="undefined")b=d.summaryTaskTemplate}else if(d.isMilestone){b=c.milestoneTaskTemplate;if(typeof d.milestoneTaskTemplate!=="undefined")b=d.milestoneTaskTemplate}if(typeof d.taskTemplate!=="undefined")b=d.taskTemplate;if(typeof c.internalPreTaskTemplate!=="undefined"){var e=c.internalPreTaskTemplate(d);e!=null&&a.appendChild(e)}b=
b(d);b.addEventListener("contextmenu",function(a){typeof c.itemContextMenuHandler!=="undefined"?c.itemContextMenuHandler(a,d):a.preventDefault()},false);a.appendChild(b);if(typeof c.internalExtraTaskTemplate!=="undefined"){e=c.internalExtraTaskTemplate(d);e!=null&&a.appendChild(e)}if(typeof c.extraTaskTemplate!=="undefined"){e=c.extraTaskTemplate(d);e!=null&&a.appendChild(e)}if(c.areTaskAssignmentsVisible){e=c.assignmentsTemplate(d);b.appendChild(e)}if(c.isTaskToolTipVisible){e=c.itemTemplate;if(typeof d.template!==
"undefined")e=d.template;b.appendChild(e(d))}if(c.areTaskDependenciesVisible&&typeof d.predecessors!=="undefined")for(b=0;b<d.predecessors.length;b++){e=d.predecessors[b];if(!((typeof d.ganttChartView==="undefined"||d.ganttChartView.items.indexOf(e.item))<0||!e.item.isVisible||typeof e.item.isHidden!=="undefined"&&e.item.isHidden||typeof e.item.isBarVisible!=="undefined"&&!e.item.isBarVisible)){var f=c.dependencyLineTemplate(d,e);f.predecessorIndex=b;(function(){f.addEventListener("click",function(a){c.dependencyLineClickHandler&&
c.dependencyLineClickHandler(d.predecessors[this.predecessorIndex],d,a)});f.addEventListener("dblclick",function(a){c.dependencyLineDoubleClickHandler&&c.dependencyLineDoubleClickHandler(d.predecessors[this.predecessorIndex],d,a)})})(e);typeof c.predecessorItemContextMenuHandler!=="undefined"?f.addEventListener("contextmenu",function(a){c.predecessorItemContextMenuHandler(a,d.predecessors[this.predecessorIndex],d)}):!c.isReadOnly&&(!c.isChartReadOnly&&!c.areTaskPredecessorsReadOnly&&(typeof d.isReadOnly===
"undefined"||!d.isReadOnly))&&f.addEventListener("contextmenu",function(a){if(confirm("Are you sure you want to remove the predecessor?")){for(var b=[],f=0;f<d.predecessors.length;f++)if(f!=this.predecessorIndex){var e=d.predecessors[f];delete e.item.successors;b.push(e)}d.predecessors=b;y(d,"predecessors",true,true);ga(d.chartItem,d,c);sa(d.ganttChartView.items,d)}a.preventDefault()},false);a.appendChild(f);if(c.isDependencyToolTipVisible){var g=c.predecessorItemTemplate;if(typeof e.template!=="undefined")g=
e.template;f.appendChild(g(d,e))}}}}},Qa=function(a){for(var d=0;d<a.length;d++)Pa(a[d])},qa=function(a){if((!a.ganttChartView.settings.isVirtualizing||typeof a.isVirtuallyVisible!=="undefined"&&a.isVirtuallyVisible)&&typeof a.isWaitingToRefreshChartItem==="undefined"){a.isWaitingToRefreshChartItem=true;setTimeout(function(){ga(a.chartItem,a,a.ganttChartView.settings);var d=Ba(a,a.ganttChartView.items,a.ganttChartView.settings);a.chartItem.setAttribute("transform","translate(0, "+d+")");Ha(a,d);delete a.isWaitingToRefreshChartItem},
0)}},pa=function(a){if(!a.ganttChartView.settings.isVirtualizing||typeof a.isVirtuallyVisible!=="undefined"&&a.isVirtuallyVisible)if(typeof a.isWaitingToRefreshGridItem!=="undefined"||typeof a.isWaitingToRefreshChartItem!=="undefined"){typeof a.isWaitingToRefreshGridItem==="undefined"&&Oa(a);typeof a.isWaitingToRefreshChartItem==="undefined"&&qa(a)}else{a.isWaitingToRefreshGridItem=true;a.isWaitingToRefreshChartItem=true;setTimeout(function(){typeof a.gridItem!=="undefined"&&Ca(a.gridItem,a,a.ganttChartView.items,
a.ganttChartView.settings.columns,a.ganttChartView.chartContent,a.ganttChartView.settings.toggleButtonAreaWidth,a.ganttChartView.settings);ga(a.chartItem,a,a.ganttChartView.settings);var d=Ba(a,a.ganttChartView.items,a.ganttChartView.settings);a.chartItem.setAttribute("transform","translate(0, "+d+")");Ha(a,d);delete a.isWaitingToRefreshGridItem;delete a.isWaitingToRefreshChartItem},0)}},ta=function(a){if((!a.ganttChartView.settings.isVirtualizing||typeof a.isVirtuallyVisible!=="undefined"&&a.isVirtuallyVisible)&&
typeof a.isWaitingToRefreshPredecessorItems==="undefined"){a.isWaitingToRefreshPredecessorItems=true;setTimeout(function(){sa(a.ganttChartView.items,a);delete a.isWaitingToRefreshPredecessorItems},0)}},Pa=function(a){if(!a.ganttChartView.settings.isVirtualizing||typeof a.isVirtuallyVisible!=="undefined"&&a.isVirtuallyVisible)if(typeof a.isWaitingToRefreshGridItem!=="undefined"||typeof a.isWaitingToRefreshChartItem!=="undefined"||typeof a.isWaitingToRefreshPredecessorItems!=="undefined"){typeof a.isWaitingToRefreshGridItem===
"undefined"&&Oa(a);typeof a.isWaitingToRefreshChartItem==="undefined"&&qa(a);typeof a.isWaitingToRefreshPredecessorItems==="undefined"&&ta(a)}else{a.isWaitingToRefreshGridItem=true;a.isWaitingToRefreshChartItem=true;a.isWaitingToRefreshPredecessorItems=true;setTimeout(function(){typeof a.gridItem!=="undefined"&&Ca(a.gridItem,a,a.ganttChartView.items,a.ganttChartView.settings.columns,a.ganttChartView.chartContent,a.ganttChartView.settings.toggleButtonAreaWidth,a.ganttChartView.settings);ga(a.chartItem,
a,a.ganttChartView.settings);var d=Ba(a,a.ganttChartView.items,a.ganttChartView.settings);a.chartItem.setAttribute("transform","translate(0, "+d+")");Ha(a,d);sa(a.ganttChartView.items,a);delete a.isWaitingToRefreshGridItem;delete a.isWaitingToRefreshChartItem;delete a.isWaitingToRefreshPredecessorItems},0)}},Z=function(a){Pa(a);for(a=a.parent;a!=null;){$a(a);Pa(a);a=a.parent}},Ra=function(a,d,c,b){W(d,b);oa(d,c);da(d,b,c);c=a.index-1;c>=0&&Z(d[c]);Z(a);c=a.index+1;c<d.length&&Z(d[c])},bb=function(a,
d){var c=d.toggleButtonAreaWidth;delete d.toggleButtonAreaWidth;I(a,d);return d.toggleButtonAreaWidth!=c},Yb=function(a,d,c,b,e){d.ganttChartView=c;for(d.isVirtuallyVisible=true;a>0&&b[a-1].isPart;)a--;var f=a<b.length?b[a]:null;if(f==null||f.isPart){f=a>0?b[a-1]:null;f=f!=null?f.indentation+1:0;if(d.indentation>f)d.indentation=f}else if(typeof d.indentation==="undefined"||d.indentation<f.indentation-1||d.indentation>f.indentation)d.indentation=f.indentation;W([d],e);b.splice(a,0,d);oa(b,c);da(b,
e,c);var g;if(e.isGridVisible&&typeof d.displayRowIndex==="undefined"){var l=null;if(a<b.length-1){f=b[a+1];if(!f.isPart){g=f.itemTop;if(typeof f.gridItemContainer!=="undefined")l=f.gridItemContainer}}c.gridContent.insertBefore(Sb(d,b,e.columns,c.chartContent,e.toggleButtonAreaWidth,e),l)}typeof g==="undefined"&&(g=wa(b,e)-e.itemHeight);l=g;typeof d.displayRowIndex!=="undefined"&&(l=d.displayRowIndex*e.itemHeight);c.chartContent.chartArea.appendChild(Tb(d,l,e));d.isVisible&&!(typeof d.isHidden!==
"undefined"&&d.isHidden)&&(g=Math.max(g,l+e.itemHeight));d.itemTop=l;if(typeof d.displayRowIndex==="undefined")for(f=a+1;f<b.length;f++){var h=b[f],l=g;typeof h.displayRowIndex!=="undefined"&&(l=h.displayRowIndex*e.itemHeight);h.isVisible&&!(typeof h.isHidden!=="undefined"&&h.isHidden)&&(g=Math.max(g,l+e.itemHeight));h.itemTop=l;qa(h);sa(b,h)}for(f=a+1;f<b.length;f++)Oa(b[f]);if(c.isContentHeightInitialized&&c.isContentHeightAuto){a=Q(c,b,e);c.gridContentContainer.style.height=a;c.chartContentContainer.style.height=
a}va(c.chartContent,wa(b,e));Na(b,c.chartContent,e);bb(b,e)&&Qa(b);Ra(d,b,c,e);xa(b,c.chartContentContainer,e)},Eb=function(a,d){return function(c){typeof c==="undefined"&&(c=a);var b=c.ownerDocument,c=b.createElementNS("http://www.w3.org/2000/svg","defs"),e=b.createElementNS("http://www.w3.org/2000/svg","linearGradient");e.setAttribute("id","BlueGradient");e.setAttribute("x1","0%");e.setAttribute("y1","0%");e.setAttribute("x2","0%");e.setAttribute("y2","100%");var f=b.createElementNS("http://www.w3.org/2000/svg",
"stop");f.setAttribute("offset","0%");f.setAttribute("style","stop-color: White");var g=b.createElementNS("http://www.w3.org/2000/svg","stop");g.setAttribute("offset","25%");g.setAttribute("style","stop-color: LightBlue");var l=b.createElementNS("http://www.w3.org/2000/svg","stop");l.setAttribute("offset","100%");l.setAttribute("style","stop-color: Blue");e.appendChild(f);e.appendChild(g);e.appendChild(l);c.appendChild(e);e=b.createElementNS("http://www.w3.org/2000/svg","linearGradient");e.setAttribute("id",
"BlackGradient");e.setAttribute("x1","0%");e.setAttribute("y1","0%");e.setAttribute("x2","0%");e.setAttribute("y2","100%");f=b.createElementNS("http://www.w3.org/2000/svg","stop");f.setAttribute("offset","0%");f.setAttribute("style","stop-color: Black");g=b.createElementNS("http://www.w3.org/2000/svg","stop");g.setAttribute("offset","10%");g.setAttribute("style","stop-color: White");l=b.createElementNS("http://www.w3.org/2000/svg","stop");l.setAttribute("offset","20%");l.setAttribute("style","stop-color: Gray");
var h=b.createElementNS("http://www.w3.org/2000/svg","stop");h.setAttribute("offset","60%");h.setAttribute("style","stop-color: Black");e.appendChild(f);e.appendChild(g);e.appendChild(l);e.appendChild(h);c.appendChild(e);e=b.createElementNS("http://www.w3.org/2000/svg","marker");e.setAttribute("id","ArrowMarker");e.setAttribute("viewBox","0 0 10 10");e.setAttribute("refX","0");e.setAttribute("refY","5");e.setAttribute("markerUnits","strokeWidth");e.setAttribute("markerWidth","5");e.setAttribute("markerHeight",
"4");e.setAttribute("orient","auto");b=b.createElementNS("http://www.w3.org/2000/svg","path");switch(d.theme){default:b.setAttribute("fill","#3b87d9");break;case "Aero":b.setAttribute("fill","Blue")}b.setAttribute("d","M 0 0 L 10 5 L 0 10 z");e.appendChild(b);c.appendChild(e);return c}},Ib=function(a){return function(d){var c=d.ganttChartView,b=d.ganttChartView.ownerDocument,e=b.createElementNS("http://www.w3.org/2000/svg","title");e.appendChild(G(b,d.content));if(typeof a.areToolTipsSimplified===
"undefined"||!a.areToolTipsSimplified){e.appendChild(b.createTextNode("  "));if(typeof d.loadChartView==="undefined"){if(typeof d.scheduleChartView==="undefined"&&d.parent){e.appendChild(b.createElement("br"));e.appendChild(b.createTextNode("Parent: "+d.parent.content+"  "))}if(typeof d.scheduleChartView!=="undefined"&&d.scheduleChartItem){e.appendChild(b.createElement("br"));e.appendChild(b.createTextNode("Row: "+d.scheduleChartItem.content+"  "))}if(d.hasChildren){e.appendChild(b.createElement("br"));
e.appendChild(b.createTextNode("Children: "+d.children.length+"  "))}e.appendChild(b.createElement("br"));e.appendChild(b.createTextNode((!d.isMilestone?"Start: ":"")+a.dateTimeFormatter(N(d.start))+"  "));if(!d.isMilestone){e.appendChild(b.createElement("br"));e.appendChild(b.createTextNode("Finish: "+a.dateTimeFormatter(N(d.finish))+"  "))}if(a.areTaskAssignmentsVisible&&d.assignmentsContent){e.appendChild(b.createElement("br"));e.appendChild(b.createTextNode("Assignments: "+d.assignmentsContent+
"  "))}if(!d.isMilestone){e.appendChild(b.createElement("br"));e.appendChild(b.createTextNode("Effort: "+c.getItemTotalEffort(d)/36E5+"h  "));if(a.isTaskCompletedEffortVisible){c=c.getItemCompletion(d);if(!isNaN(c)){e.appendChild(b.createElement("br"));e.appendChild(b.createTextNode("Completed: "+Math.round(c*1E4)/100+"%  "))}}}if(a.areTaskDependenciesVisible&&d.predecessors&&d.predecessors.length>0){e.appendChild(b.createElement("br"));for(var c="",f=0;f<d.predecessors.length;f++){var g=d.predecessors[f];
if(g.item){c.length>0&&(c=c+", ");c=c+g.item.content;g.dependencyType&&(c=c+(" ("+Zb(g.dependencyType)+")"))}}e.appendChild(b.createTextNode("Predecessors: "+c+"  "))}}else if(!isNaN(d.units)){e.appendChild(b.createElement("br"));e.appendChild(b.createTextNode("Allocation: "+Math.round(d.units*1E4)/100+"%  "))}}return e}},Jb=function(a){return function(d){var c=d.ganttChartView,b=typeof a!=="undefined"?a:c.settings,c=c.ownerDocument,e=c.createElementNS("http://www.w3.org/2000/svg","text"),f=H(d.finish,
b);if(d.isMilestone||d.hasChildren&&(typeof d.isSummaryEnabled==="undefined"||d.isSummaryEnabled))f=f+b.barHeight/2;e.setAttribute("x",f+7);e.setAttribute("y",b.barMargin+b.barHeight-1);d=b.target!="Phone"?d.assignmentsContent:d.content;typeof d==="undefined"&&(d="");e.appendChild(c.createTextNode(d));typeof b.assignmentsClass!=="undefined"?e.setAttribute("class",b.assignmentsClass):typeof b.assignmentsStyle!=="undefined"&&e.setAttribute("style",b.assignmentsStyle);return e}},pb=function(a){var d=
a.ganttChartView.ownerDocument;if(typeof a.chartItemArea==="undefined")a.chartItemArea=d.createElementNS("http://www.w3.org/2000/svg","g");for(d=a.chartItemArea.childNodes.length;d-- >0;)a.chartItemArea.removeChild(a.chartItemArea.childNodes[d]);return a.chartItemArea},Fb=function(a,d,c){return function(b){var e=typeof d!=="undefined"?d:b.ganttChartView,f=typeof c!=="undefined"?c:e.settings,g=typeof a!=="undefined"?a:e.items,l=e.ownerDocument,h=pb(b);if(f.isBaselineVisible&&typeof b.baselineStart!==
"undefined"&&typeof b.baselineFinish!=="undefined"){var o=H(b.baselineStart,f),n=Math.max(H(b.baselineFinish,f),o+4),t=l.createElementNS("http://www.w3.org/2000/svg","rect");t.setAttribute("x",o);t.setAttribute("y",f.barMargin/2);t.setAttribute("width",Math.max(0,n-o-1));t.setAttribute("height",f.barHeight);t.setAttribute("rx",f.barCornerRadius);t.setAttribute("ry",f.barCornerRadius);o=f.baselineBarClass;if(typeof b.baselineBarClass!=="undefined")o=b.baselineBarClass;if(typeof o!=="undefined")t.setAttribute("class",
o);else{o=f.baselineBarStyle;if(typeof b.baselineBarStyle!=="undefined")o=b.baselineBarStyle;typeof o!=="undefined"&&t.setAttribute("style",o)}h.appendChild(t)}var t=H(b.start,f),o=Math.max(H(b.finish,f),t+4),n=H(b.completedFinish,f),w=l.createElementNS("http://www.w3.org/2000/svg","rect");w.setAttribute("x",t);w.setAttribute("y",f.barMargin);w.setAttribute("width",Math.max(0,o-t-1));w.setAttribute("height",f.barHeight);w.setAttribute("rx",f.barCornerRadius);w.setAttribute("ry",f.barCornerRadius);
var u=f.standardBarClass;if(typeof b.standardBarClass!=="undefined")u=b.standardBarClass;if(typeof b.barClass!=="undefined")u=b.barClass;if(typeof u!=="undefined")w.setAttribute("class",u);else{u=f.standardBarStyle;if(typeof b.standardBarStyle!=="undefined")u=b.standardBarStyle;if(typeof b.barStyle!=="undefined")u=b.barStyle;typeof u!=="undefined"&&w.setAttribute("style",u)}h.appendChild(w);if(f.isTaskCompletedEffortVisible){w=l.createElementNS("http://www.w3.org/2000/svg","rect");w.setAttribute("x",
t);w.setAttribute("y",f.barMargin+f.completedBarMargin);w.setAttribute("width",Math.max(0,n-t-1));w.setAttribute("height",f.completedBarHeight);w.setAttribute("rx",f.completedBarCornerRadius);w.setAttribute("ry",f.completedBarCornerRadius);u=f.standardCompletedBarClass;if(typeof b.standardCompletedBarClass!=="undefined")u=b.standardCompletedBarClass;if(typeof b.completedBarClass!=="undefined")u=b.completedBarClass;if(typeof u!=="undefined")w.setAttribute("class",u);else{u=f.standardCompletedBarStyle;
if(typeof b.standardCompletedBarStyle!=="undefined")u=b.standardCompletedBarStyle;if(typeof b.completedBarStyle!=="undefined")u=b.completedBarStyle;typeof u!=="undefined"&&w.setAttribute("style",u)}h.appendChild(w)}if(!f.isReadOnly&&!f.isChartReadOnly&&(typeof b.isReadOnly==="undefined"||!b.isReadOnly)&&(typeof b.isBarReadOnly==="undefined"||!b.isBarReadOnly)){w=l.createElementNS("http://www.w3.org/2000/svg","rect");w.setAttribute("x",t);w.setAttribute("y",f.barMargin);w.setAttribute("width",Math.max(0,
o-t-1));w.setAttribute("height",f.barHeight);w.setAttribute("style","fill: White; fill-opacity: 0; cursor: move");f.isTaskStartReadOnly||h.appendChild(w);u=l.createElementNS("http://www.w3.org/2000/svg","rect");u.setAttribute("x",t-4);u.setAttribute("y",f.barMargin);u.setAttribute("width",4);u.setAttribute("height",f.barHeight);u.setAttribute("style","fill: White; fill-opacity: 0; cursor: e-resize");f.isDraggingTaskStartEndsEnabled&&(!f.isTaskStartReadOnly&&f.interaction!="TouchEnabled")&&h.appendChild(u);
var D=l.createElementNS("http://www.w3.org/2000/svg","rect");D.setAttribute("x",o-4);D.setAttribute("y",f.barMargin);D.setAttribute("width",8);D.setAttribute("height",f.barHeight);D.setAttribute("style","fill: White; fill-opacity: 0; cursor: e-resize");!f.isTaskEffortReadOnly&&f.interaction!="TouchEnabled"&&h.appendChild(D);var q=l.createElementNS("http://www.w3.org/2000/svg","rect");q.setAttribute("x",n-2);q.setAttribute("y",f.barMargin);q.setAttribute("width",6);q.setAttribute("height",f.barHeight);
q.setAttribute("style","fill: White; fill-opacity: 0; cursor: e-resize");if(!f.isTaskCompletionReadOnly&&f.isTaskCompletedEffortVisible&&f.interaction!="TouchEnabled"){h.appendChild(q);var k=l.createElementNS("http://www.w3.org/2000/svg","title"),j=typeof f.areToolTipsSimplified==="undefined"||!f.areToolTipsSimplified?e.getItemCompletion(b):NaN;k.appendChild(G(l,!isNaN(j)?Math.round(j*1E4)/100+"%":""));q.appendChild(k)}qb(w,u,D,q,b,t,o,n,g,e,f);if(f.areTaskDependenciesVisible&&!f.areTaskPredecessorsReadOnly&&
!b.isPart){n=null;if(typeof f.allowCreatingStartDependencies==="undefined"||f.allowCreatingStartDependencies){n=l.createElementNS("http://www.w3.org/2000/svg","circle");n.setAttribute("cx",t);n.setAttribute("cy",f.barMargin+f.barHeight/2);n.setAttribute("r",f.barHeight/4);n.setAttribute("style","fill: White; fill-opacity: 0; cursor: pointer");h.appendChild(n)}l=l.createElementNS("http://www.w3.org/2000/svg","circle");l.setAttribute("cx",o-2);l.setAttribute("cy",f.barMargin+f.barHeight/2);l.setAttribute("r",
f.barHeight/4);l.setAttribute("style","fill: White; fill-opacity: 0; cursor: pointer");h.appendChild(l);cb(l,n,h,b,f.barMargin+f.barHeight/2,o-2,t,g,e,f)}}return h}},Gb=function(a,d,c){return function(b){var e=typeof d!=="undefined"?d:b.ganttChartView,f=typeof c!=="undefined"?c:e.settings,g=typeof a!=="undefined"?a:e.items,l=e.ownerDocument,h=pb(b),o=H(b.start,f),n=H(b.finish,f),t=f.barHeight*2.15/3,w=l.createElementNS("http://www.w3.org/2000/svg","rect");w.setAttribute("x",o);w.setAttribute("y",
f.barMargin);w.setAttribute("width",Math.max(0,n-o-1));w.setAttribute("height",t);var u=f.summaryBarClass;if(typeof b.summaryBarClass!=="undefined")u=b.summaryBarClass;if(typeof b.barClass!=="undefined")u=b.barClass;if(typeof u!=="undefined")w.setAttribute("class",u);else{var D=f.summaryBarStyle;if(typeof b.summaryBarStyle!=="undefined")D=b.summaryBarStyle;if(typeof b.barStyle!=="undefined")D=b.barStyle;typeof D!=="undefined"&&w.setAttribute("style",D)}h.appendChild(w);if(!b.isExpanded){w=l.createElementNS("http://www.w3.org/2000/svg",
"line");w.setAttribute("x1",o);w.setAttribute("y1",f.barMargin+t+2.5);w.setAttribute("x2",n-1);w.setAttribute("y2",f.barMargin+t+2.5);var q=f.collapsedSummaryLineClass;if(typeof b.collapsedSummaryLineClass!=="undefined")q=b.collapsedSummaryLineClass;if(typeof q!=="undefined")w.setAttribute("class",q);else{q=f.collapsedSummaryLineStyle;if(typeof b.collapsedSummaryLineStyle!=="undefined")q=b.collapsedSummaryLineStyle;typeof q!=="undefined"&&w.setAttribute("style",q)}h.appendChild(w)}var q=l.createElementNS("http://www.w3.org/2000/svg",
"polygon"),w=f.barMargin-0.25,k=t+1.5,j=f.barHeight*3/4,p=f.barHeight/4,t=o-1-f.barHeight/3;q.setAttribute("points",t+","+w+" "+t+","+(w+k)+" "+(t+j/2)+","+(w+k+p)+" "+(t+j)+","+(w+k)+" "+(t+j)+","+w);typeof u!=="undefined"&&q.setAttribute("class",u);typeof D!=="undefined"&&q.setAttribute("style",D);h.appendChild(q);q=l.createElementNS("http://www.w3.org/2000/svg","polygon");t=n+f.barHeight/3;q.setAttribute("points",t+","+w+" "+t+","+(w+k)+" "+(t-j/2)+","+(w+k+p)+" "+(t-j)+","+(w+k)+" "+(t-j)+","+
w);typeof u!=="undefined"&&q.setAttribute("class",u);typeof D!=="undefined"&&q.setAttribute("style",D);h.appendChild(q);if(!f.isReadOnly&&!f.isChartReadOnly&&(typeof b.isReadOnly==="undefined"||!b.isReadOnly)&&(typeof b.isBarReadOnly==="undefined"||!b.isBarReadOnly)&&f.areTaskDependenciesVisible&&!f.areTaskPredecessorsReadOnly&&!b.isPart){u=null;if(typeof f.allowCreatingStartDependencies==="undefined"||f.allowCreatingStartDependencies){u=l.createElementNS("http://www.w3.org/2000/svg","circle");u.setAttribute("cx",
o-0.5);u.setAttribute("cy",f.barMargin+f.barHeight/2);u.setAttribute("r",f.barHeight/4);u.setAttribute("style","fill: White; fill-opacity: 0; cursor: pointer");h.appendChild(u)}l=l.createElementNS("http://www.w3.org/2000/svg","circle");l.setAttribute("cx",n-0.5);l.setAttribute("cy",f.barMargin+f.barHeight/2);l.setAttribute("r",2.5);l.setAttribute("style","fill: White; fill-opacity: 0; cursor: pointer");h.appendChild(l);cb(l,u,h,b,f.barMargin+f.barHeight/2,n-1.5,o,g,e,f)}return h}},Hb=function(a,d,
c){return function(b){var e=typeof d!=="undefined"?d:b.ganttChartView,f=typeof c!=="undefined"?c:e.settings,g=typeof a!=="undefined"?a:e.items,l=e.ownerDocument,h=pb(b);if(f.isBaselineVisible&&typeof b.baselineStart!=="undefined"){var o=H(b.baselineStart,f),n=l.createElementNS("http://www.w3.org/2000/svg","polygon"),t=f.barMargin-1,w=f.barHeight+1;n.setAttribute("points",o+","+t+" "+(o-w/2)+","+(t+w/2)+" "+o+","+(t+w)+" "+(o+w/2)+","+(t+w/2));o=f.baselineBarClass;if(typeof b.baselineBarClass!=="undefined")o=
b.baselineBarClass;if(typeof o!=="undefined")n.setAttribute("class",o);else{var u=f.baselineBarStyle;if(typeof b.baselineBarStyle!=="undefined")u=b.baselineBarStyle}n.setAttribute("style",u);h.appendChild(n)}n=H(b.start,f);u=l.createElementNS("http://www.w3.org/2000/svg","polygon");n=n-1;t=f.barMargin;o=f.barHeight+1;u.setAttribute("points",n+","+t+" "+(n-o/2)+","+(t+o/2)+" "+n+","+(t+o)+" "+(n+o/2)+","+(t+o/2));t=f.milestoneBarClass;if(typeof b.milestoneBarClass!=="undefined")t=b.milestoneBarClass;
if(typeof b.barClass!=="undefined")t=b.barClass;if(typeof t!=="undefined")u.setAttribute("class",t);else{t=f.milestoneBarStyle;if(typeof b.milestoneBarStyle!=="undefined")t=b.milestoneBarStyle;if(typeof b.barStyle!=="undefined")t=b.barStyle;typeof t!=="undefined"&&u.setAttribute("style",t)}h.appendChild(u);if(!f.isReadOnly&&!f.isChartReadOnly&&(typeof b.isReadOnly==="undefined"||!b.isReadOnly)&&(typeof b.isBarReadOnly==="undefined"||!b.isBarReadOnly)){u=l.createElementNS("http://www.w3.org/2000/svg",
"rect");u.setAttribute("x",n-o/2);u.setAttribute("y",f.barMargin);u.setAttribute("width",o);u.setAttribute("height",o);u.setAttribute("style","fill: White; fill-opacity: 0; cursor: move");h.appendChild(u);qb(u,null,null,null,b,n,n,n,g,e,f);if(f.areTaskDependenciesVisible&&!f.areTaskPredecessorsReadOnly&&!b.isPart){l=l.createElementNS("http://www.w3.org/2000/svg","circle");l.setAttribute("cx",n);l.setAttribute("cy",f.barMargin+f.barHeight/2);l.setAttribute("r",f.barHeight/4);l.setAttribute("style",
"fill: White; fill-opacity: 0; cursor: pointer");h.appendChild(l);cb(l,null,h,b,f.barMargin+f.barHeight/2,n,n,g,e,f)}}return h}},Kb=function(a,d){return function(c,b){var e=c.ganttChartView,f=typeof d!=="undefined"?d:e.settings,g=typeof a!=="undefined"?a:e.items,l=e.ownerDocument,e=l.createElementNS("http://www.w3.org/2000/svg","g"),h;h=Ba(b.item,g,f);var o=Ba(c,g,f),g="M ",n,t,w=f.itemHeight,u=w/2,D=w/3.5,q=2,k=false,j;if(h==o&&(typeof b.dependencyType==="undefined"||b.dependencyType=="FinishStart"||
b.dependencyType=="FS"||b.dependencyType=="StartFinish"||b.dependencyType=="SF")){if(typeof b.dependencyType==="undefined"||b.dependencyType=="FinishStart"||b.dependencyType=="FS"){n=H(b.item.finish,f);t=H(c.start,f)}else{n=H(b.item.start,f);t=H(c.finish,f)}h=h-o+0.5;g=g+(n+" "+(h+u)+" L "+(t+(t>n?-1:1)*(w/5-1))+" "+(h+u))}else{if(typeof b.dependencyType!=="undefined"&&(b.dependencyType=="StartStart"||b.dependencyType=="SS"||b.dependencyType=="StartFinish"||b.dependencyType=="SF")){n=H(b.item.start,
f);b.item.hasChildren&&(typeof b.item.isSummaryEnabled==="undefined"||b.item.isSummaryEnabled)?n=n-(w/5+0.25):b.item.isMilestone&&(n=n-w/4);t=n-D}else{n=H(b.item.finish,f)-1;if(b.item.hasChildren&&(typeof b.item.isSummaryEnabled==="undefined"||b.item.isSummaryEnabled))n=n+(w/5+0.25);else if(b.item.isMilestone)n=n+w/4;else{j=H(b.item.start,f)+4-1;n<j&&(n=j)}t=n+D}h=h-o+0.5;g=g+(n+" "+(h+u)+" L "+t+" "+(h+u));if(typeof b.dependencyType!=="undefined"&&(b.dependencyType=="FinishFinish"||b.dependencyType==
"FF"||b.dependencyType=="StartFinish"||b.dependencyType=="SF")){n=H(c.finish,f)-1;if(typeof b.dependencyType!=="undefined"&&(b.dependencyType=="FinishFinish"||b.dependencyType=="FF")){k=true;if(c.hasChildren&&(typeof c.isSummaryEnabled==="undefined"||c.isSummaryEnabled))n=n+(w/5+1);else if(c.isMilestone)n=n+(w/4+1);else{j=H(c.start,f)+4-1;n<j&&(n=j)}o=n+D}else if(c.isMilestone)o=n;else{j=H(c.start,f)+4;n<j&&(n=j);o=n-2.5}}else{n=H(c.start,f);if(typeof b.dependencyType!=="undefined"&&(b.dependencyType==
"StartStart"||b.dependencyType=="SS")){k=true;c.hasChildren&&(typeof c.isSummaryEnabled==="undefined"||c.isSummaryEnabled)?n=n-(w/5+1):c.isMilestone&&(n=n-(w/4+1));o=n-D}else if(c.isMilestone)o=n-1;else{o=n+1.5;j=H(c.finish,f);o<t&&(j-t>D*2&&c.start>=b.item.finish)&&(o=t)}}if(typeof b.dependencyType!=="undefined"&&(b.dependencyType=="StartStart"||b.dependencyType=="SS"||b.dependencyType=="StartFinish"||b.dependencyType=="SF")){if(o>t){h=h-D/6;h=h<=0?h+u:h-u;g=g+(" "+t+" "+(h+u))}}else if(o<t){h=h-
D/6;h=h<=0?h+u:h-u;g=g+(" "+t+" "+(h+u))}g=g+(" "+o+" "+(h+u));h=k?u+0.5:h<=0?w/4-1-q:w-w/4+1+q;if(k){o>n-q&&(q=-q);n=n-q}g=g+(" "+o+" "+h);k&&(g=g+(" "+n+" "+h))}h=g;g=l.createElementNS("http://www.w3.org/2000/svg","path");g.setAttribute("d",h);typeof f.dependencyLineZoneClass!=="undefined"&&g.setAttribute("class",f.dependencyLineZoneClass);typeof f.dependencyLineZoneStyle!=="undefined"&&g.setAttribute("style",f.dependencyLineZoneStyle);e.appendChild(g);l=l.createElementNS("http://www.w3.org/2000/svg",
"path");l.setAttribute("d",h);h=f.dependencyLineClass;if(typeof b.dependencyLineClass!=="undefined")h=b.dependencyLineClass;if(typeof h!=="undefined")l.setAttribute("class",h);else{f=f.dependencyLineStyle;if(typeof b.dependencyLineStyle!=="undefined")f=b.dependencyLineStyle;typeof f!=="undefined"&&l.setAttribute("style",f)}e.appendChild(l);return e}},Lb=function(a){return function(d,c){var b=d.ganttChartView.ownerDocument,e=b.createElementNS("http://www.w3.org/2000/svg","title");e.appendChild(G(b,
c.item.content+" - "+d.content));if(typeof a.areToolTipsSimplified==="undefined"||!a.areToolTipsSimplified){e.appendChild(b.createTextNode("  "));if(c.dependencyType){e.appendChild(b.createElement("br"));e.appendChild(G(b,"Type: "+Zb(c.dependencyType)+"  "))}if(c.lag){e.appendChild(b.createElement("br"));e.appendChild(G(b,"Lag: "+c.lag/36E5+"h  "))}}return e}},Zb=function(a){switch(a){case "StartStart":case "SS":return"SS";case "FinishFinish":case "FF":return"FF";case "StartFinish":case "SF":return"SF";
default:return"FS"}},y=function(a,d,c,b){if(typeof a.ganttChartView!=="undefined"){var e=a.ganttChartView,f=e.settings;if(d=="start"||d=="minStart"||d=="maxStart"){if(typeof a.minStart!=="undefined"&&a.start<a.minStart){a.start=a.minStart;if(typeof a.loadChartItem==="undefined")a.start=M(a.start,f,true,typeof a.isMilestone!=="undefined"&&a.isMilestone,E(a));if(c)a.preferredStart=a.start}else if(typeof a.maxStart!=="undefined"&&a.start>a.maxStart){a.start=a.maxStart;if(typeof a.loadChartItem==="undefined")a.start=
M(a.start,f,true,typeof a.isMilestone!=="undefined"&&a.isMilestone,E(a));if(c)a.preferredStart=a.start}if(a.finish<a.start){a.finish=a.start;y(a,"finish",false,true)}if(a.completedFinish<a.start){a.completedFinish=a.start;y(a,"completedFinish",false,true)}else if(a.completedFinish>a.finish){a.completedFinish=a.finish;y(a,"completedFinish",false,true)}}else if(d=="finish"||d=="minFinish"||d=="maxFinish"){if(typeof a.maxFinish!=="undefined"&&a.finish>a.maxFinish){a.finish=a.maxFinish;if(typeof a.loadChartItem===
"undefined")a.finish=M(a.finish,f,typeof a.isMilestone!=="undefined"&&a.isMilestone,true,E(a))}else if(typeof a.minFinish!=="undefined"&&a.finish<a.minFinish){a.finish=a.minFinish;if(typeof a.loadChartItem==="undefined")a.finish=M(a.finish,f,typeof a.isMilestone!=="undefined"&&a.isMilestone,true,E(a))}if(a.finish<a.start){a.finish=a.start;y(a,"finish",false,true)}if(a.completedFinish<a.start){a.completedFinish=a.start;y(a,"completedFinish",false,true)}else if(a.completedFinish>a.finish){a.completedFinish=
a.finish;y(a,"completedFinish",false,true)}}if(e.isTimingInformationInitialized){var g=e.items,l,h;if(d=="indentation"||d=="predecessors")for(l=0;l<g.length;l++){h=g[l];typeof h.dependsOf!=="undefined"&&delete h.dependsOf}if((d=="predecessors"||d=="start"||d=="finish")&&typeof a.isDuringPropertyChangeTaskDependencyConstraintsEnsuring==="undefined"&&f.areTaskDependencyConstraintsEnabled&&(f.areTaskDependencyConstraintsEnabledWhileDragging||typeof e.isDuringTimeDragOperation==="undefined")){a.isDuringPropertyChangeTaskDependencyConstraintsEnsuring=
true;for(h=a.parent;h!=null;){typeof h.predecessors!=="undefined"&&h.predecessors.length>0&&La(h,g,f,e);h=h.parent}h=a;for(typeof h.predecessors!=="undefined"&&h.predecessors.length>0?La(h,g,f,e):rb(h,f);h!=null;){if(typeof h.successors==="undefined"){h.successors=[];for(l=0;l<g.length;l++){var o=g[l];if(!(o==h||typeof o.predecessors==="undefined"||o.predecessors.length==0))for(var n=0;n<o.predecessors.length;n++)if(o.predecessors[n].item==h){h.successors.push(o);break}}}for(l=0;l<h.successors.length;l++)La(h.successors[l],
g,f,e);h=h.parent}delete a.isDuringPropertyChangeTaskDependencyConstraintsEnsuring}a.isPart&&a.ganttChartItem&&y(a.ganttChartItem,"parts",false,true)}if(a.isSetAsCompleted&&(d=="start"||d=="finish"||d=="completedFinish"))a.isSetAsCompleted=false;if((d=="start"||d=="finish")&&!a.hasChildren&&a.hasFixedEffort&&typeof a.fixedEffort!=="undefined"){g=e.getItemEffort(a)/a.fixedEffort;h="";for(l=0;l<a.fixedEffortAssignments.length;l++){o=a.fixedEffortAssignments[l];h.length>0&&(h=h+", ");n=Math.floor(o.value/
g*1E6)/1E6;h=h+(o.key+(n!=1?" ["+n*100+"%]":""))}e.setItemAssignmentsContent(a,h)}f.itemPropertyChangeHandler(a,d,c,b);d=="isExpanded"?typeof a.ganttChartView!=="undefined"&&typeof a.ganttChartView.settings.itemExpansionChangeHandler!=="undefined"&&a.ganttChartView.settings.itemExpansionChangeHandler(a,a.isExpanded):d=="isSelected"&&typeof a.ganttChartView!=="undefined"&&typeof a.ganttChartView.settings.itemSelectionChangeHandler!=="undefined"&&a.ganttChartView.settings.itemSelectionChangeHandler(a,
a.isSelected,c);typeof a.scheduleChartView!=="undefined"&&d=="content"&&a.scheduleChartView.refreshScheduleChartItem(a)}},rb=function(a,d){if(typeof a.isAwaitingPreferredStartUpdates==="undefined")if(a.hasChildren&&(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled))for(var c=0;c<a.children.length;c++)rb(a.children[c],d);else if(typeof a.preferredStart!=="undefined"&&a.preferredStart<a.start){a.isAwaitingPreferredStartUpdates=true;effort=L(a.start,a.finish,d,E(a));completedEffort=L(a.start,
a.completedFinish,d,E(a));a.start=a.preferredStart;a.finish=R(a.start,effort,d,E(a));a.completedFinish=R(a.start,completedEffort,d,E(a));y(a,"start",false,true);y(a,"finish",false,true);y(a,"completedFinish",false,true);setTimeout(function(){Z(a);delete a.isAwaitingPreferredStartUpdates},1)}},La=function(a,d,c,b){if(b.isBasicTimingInformationInitialized&&(typeof a.areDependencyConstraintsEnabled==="undefined"||a.areDependencyConstraintsEnabled)){rb(a,c);for(var e=[],f,g=false,b=0;b<a.predecessors.length;b++){f=
a.predecessors[b];if(typeof f.item==="undefined"||d.indexOf(f.item)<0||Sa(f.item,a)){c.invalidPredecessorDetectionHandler&&c.invalidPredecessorDetectionHandler(f,a,f.item);g=true}else e.push(f)}a.predecessors=e;if(g){y(a,"predecessors",false,true);typeof a.ganttChartView!=="undefined"&&Pa(a)}for(b=0;b<a.predecessors.length;b++){f=a.predecessors[b];$b(a,f,d,c)}}},$b=function(a,d,c,b){if(a.hasChildren&&(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled))for(var e=0;e<a.children.length;e++)$b(a.children[e],
d,c,b);else if(!(typeof b.areDependencyConstraintsAppliedOnMilestones!=="undefined"&&!b.areDependencyConstraintsAppliedOnMilestones&&a.isMilestone||typeof b.areDependencyConstraintsAppliedOnStartedTasks!=="undefined"&&!b.areDependencyConstraintsAppliedOnStartedTasks&&Ia(a))){var f=d.item,g,c=false;if(typeof d.dependencyType==="undefined"||d.dependencyType==""||d.dependencyType=="FinishStart"||d.dependencyType=="FS"){f=f.finish;typeof d.lag!=="undefined"&&d.lag!=0&&(f=R(f,d.lag,b,E(a)));if(a.start<
f){if(!a.isMilestone&&(!a.hasChildren||!(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled))){e=L(a.start,a.finish,b,E(a));g=L(a.start,a.completedFinish,b,E(a))}if(!a.hasChildren||!(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled)){a.start=M(ra(f,b),b,true,a.isMilestone,E(a));y(a,"start",false,true);if(a.isMilestone){a.finish=a.start;y(a,"finish",false,true);a.completedFinish=a.start}else{a.finish=R(a.start,e,b,E(a));y(a,"finish",false,true);a.completedFinish=R(a.start,g,b,E(a))}y(a,
"completedFinish",false,true);c=true}}}else if(d.dependencyType=="StartStart"||d.dependencyType=="SS"){f=f.start;typeof d.lag!=="undefined"&&d.lag!=0&&(f=R(f,d.lag,b,E(a)));if(a.start<f){if(!a.isMilestone&&(!a.hasChildren||!(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled))){e=L(a.start,a.finish,b,E(a));g=L(a.start,a.completedFinish,b,E(a))}if(!a.hasChildren||!(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled)){a.start=M(ra(f,b),b,true,a.isMilestone,E(a));y(a,"start",false,
true);if(a.isMilestone){a.finish=a.start;y(a,"finish",false,true);a.completedFinish=a.start}else{a.finish=R(a.start,e,b,E(a));y(a,"finish",false,true);a.completedFinish=R(a.start,g,b,E(a))}y(a,"completedFinish",false,true);c=true}}}else if(d.dependencyType=="FinishFinish"||d.dependencyType=="FF"){f=f.finish;typeof d.lag!=="undefined"&&d.lag!=0&&(f=R(f,d.lag,b,E(a)));if(a.finish>f&&(!a.hasChildren||!(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled))){a.finish=M(ra(f,b),b,a.isMilestone,
true,E(a));if(a.finish<a.start)a.finish=a.start;y(a,"finish",false,true);if(a.isMilestone){if(a.completedFinish!=a.start){a.completedFinish=a.start;y(a,"completedFinish",false,true)}}else if(a.completedFinish>a.finish){a.completedFinish=a.finish;y(a,"completedFinish",false,true)}c=true}}else if(d.dependencyType=="StartFinish"||d.dependencyType=="SF"){f=f.start;typeof d.lag!=="undefined"&&d.lag!=0&&(f=R(f,d.lag,b,E(a)));if(a.finish>f&&(!a.hasChildren||!(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled))){a.finish=
M(ra(f,b),b,a.isMilestone,true,E(a));if(a.finish<a.start)a.finish=a.start;y(a,"finish",false,true);if(a.isMilestone){if(a.completedFinish!=a.start){a.completedFinish=a.start;y(a,"completedFinish",false,true)}}else if(a.completedFinish>a.finish){a.completedFinish=a.finish;y(a,"completedFinish",false,true)}c=true}}if(c&&!(typeof a.ganttChartView==="undefined"||typeof a.isAwaitingEnsureItemDependencyConstraintsUpdates!=="undefined"))if(typeof a.ganttChartView!=="undefined"&&!a.ganttChartView.isTimingInformationInitialized)Z(a);
else{a.isAwaitingEnsureItemDependencyConstraintsUpdates=true;setTimeout(function(){Z(a);delete a.isAwaitingEnsureItemDependencyConstraintsUpdates},0)}}},Sa=function(a,d){if(typeof a.dependsOf!=="undefined"&&typeof a.dependsOf[a]!=="undefined")return a.dependsOf[d];try{if(a==d)return true;var c=ac(a);if(c.indexOf(d)>=0)return true;var b=ac(d);if(b.indexOf(a)>=0)return true;var e=sb(a),f,g;for(f=0;f<e.length;f++){g=e[f];if(g==d||g==a||c.indexOf(g)>=0||b.indexOf(g)>=0||Sa(g,d))return true}for(e=0;e<
c.length;e++){var l=sb(c[e]);for(f=0;f<l.length;f++){g=l[f];if(g==d||g==a||c.indexOf(g)>=0||b.indexOf(g)>=0||Sa(g,d))return true}}var h=a.children;for(f=0;f<h.length;f++){var o=h[f];if(typeof o.predecessors!=="undefined"&&o.predecessors.length>0&&Sa(o,d))return true}}finally{if(typeof a.dependsOf==="undefined")a.dependsOf={};a.dependsOf[d]=true}return a.dependsOf[d]=false},ac=function(a){for(var d=[];typeof a.parent!=="undefined"&&a.parent!=null;){(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled)&&
d.push(a.parent);a=a.parent}return d},sb=function(a){var d=[];if(typeof a.predecessors!=="undefined"&&a.predecessors!=null)for(var c=0;c<a.predecessors.length;c++)typeof a.predecessors[c].item!=="undefined"&&d.push(a.predecessors[c].item);return d},yc=function(a,d){for(var c=0;c<a.length;c++){var b=a[c],e=d==null||d(b);b.isHidden=!e;if(e)for(b=b.parent;b!=null;){b.isHidden=false;b=b.parent}}},bc=function(a,d,c){return M(a,d,true,true,c)},ua=function(a,d,c){return M(a,d,true,false,c)},M=function(a,
d,c,b,e){var f=typeof e!=="undefined"&&typeof e.workingDayStart!=="undefined"?e.workingDayStart:d.visibleDayStart,g=typeof e!=="undefined"&&typeof e.workingDayFinish!=="undefined"?e.workingDayFinish:d.visibleDayFinish,l=typeof e!=="undefined"&&typeof e.workingWeekStart!=="undefined"?e.workingWeekStart:d.workingWeekStart,h=typeof e!=="undefined"&&typeof e.workingWeekFinish!=="undefined"?e.workingWeekFinish:d.workingWeekFinish,d=typeof e!=="undefined"&&typeof e.specialNonworkingDays!=="undefined"?e.specialNonworkingDays:
d.specialNonworkingDays,e=Y(a),a=ka(a);if(a<f||!c&&a==f)if(c)a=f;else{e=Ma(e);a=g}if(a>g||!b&&a==g)if(b)a=g;else{e=ba(e);a=f}for(b=ma(e);b<l||b>h||Rb(e,d);){if(c){b++;e=ba(e);a=f}else{b--;e=Ma(e);a=g}for(;b<0;)b=b+7;for(;b>=7;)b=b-7}return new Date(e.valueOf()+a)},L=function(a,d,c,b){if(d.valueOf()<a.valueOf())return-L(d,a,c,b);if(d.valueOf()==a.valueOf())return 0;var e=typeof b!=="undefined"&&typeof b.workingDayStart!=="undefined"?b.workingDayStart:c.visibleDayStart,f=typeof b!=="undefined"&&typeof b.workingDayFinish!==
"undefined"?b.workingDayFinish:c.visibleDayFinish,g=typeof b!=="undefined"&&typeof b.workingWeekStart!=="undefined"?b.workingWeekStart:c.workingWeekStart,l=typeof b!=="undefined"&&typeof b.workingWeekFinish!=="undefined"?b.workingWeekFinish:c.workingWeekFinish,b=typeof b!=="undefined"&&typeof b.specialNonworkingDays!=="undefined"?b.specialNonworkingDays:c.specialNonworkingDays,c=0,h=Y(a),a=ka(a);if(a<e)a=e;else if(a>=f){h=ba(h);a=e}for(var o=Y(d);h<o;){var n=ma(h);n>=g&&(n<=l&&!Rb(h,b))&&(c=c+(f-
a));h=ba(h);a=e}d=ka(d);d<e?d=e:d>f&&(d=f);d>a&&(c=c+(d-a));return c},R=function(a,d,c,b){if(d<0)return Ta(-d,a,c,b);a=M(a,c,true,false,b);if(d==0)return a;var e=typeof b!=="undefined"&&typeof b.workingDayStart!=="undefined"?b.workingDayStart:c.visibleDayStart,f=typeof b!=="undefined"&&typeof b.workingDayFinish!=="undefined"?b.workingDayFinish:c.visibleDayFinish,g=ka(a);if(g+d<f)return new Date(a.valueOf()+d);g=f-g;a=new Date(a.valueOf()+g);for(d=d-g;d>0;){a=ka(a)>0?M(ba(Y(a)),c,true,false,b):M(Y(a),
c,true,false,b);if(e+d<f)return new Date(a.valueOf()+d);g=f-e;a=new Date(a.valueOf()+g);d=d-g}return new Date(a.valueOf())},Ta=function(a,d,c,b){if(a<0)return R(d,-a,c,b);d=M(d,c,false,true,b);if(a==0)return d;var e=typeof b!=="undefined"&&typeof b.workingDayStart!=="undefined"?b.workingDayStart:c.visibleDayStart,f=typeof b!=="undefined"&&typeof b.workingDayFinish!=="undefined"?b.workingDayFinish:c.visibleDayFinish,g=ka(d);if(g-a>e)return new Date(d.valueOf()-a);g=g-e;d=new Date(d.valueOf()-g);for(a=
a-g;a>0;){d=ka(d)<864E5?M(Y(d),c,false,true,b):M(Ma(Y(d)),c,false,true,b);if(f-a>e)return new Date(d.valueOf()-a);g=f-e;d=new Date(d.valueOf()-g);a=a-g}return new Date(d.valueOf())},db=function(a,d,c,b,e){return L(a,d,b,e)/L(a,c,b,e)},cc=function(a,d,c,b,e){return R(a,d*L(a,c,b,e),b,e)},Ua=function(a){for(var d=0,a=ha(a),c=0;c<a.length;c++)d=d+a[c].value;d==0&&(d=1);return d},tb=function(a){if(a.hasChildren&&(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled)){for(var d=0,a=a.children,c=
0;c<a.length;c++)d=d+tb(a[c]);return d}return a.ganttChartView.getItemEffort(a)*Ua(a)},ub=function(a){if(a.hasChildren&&(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled)){for(var d=0,a=a.children,c=0;c<a.length;c++)d=d+ub(a[c]);return d}return a.ganttChartView.getItemCompletedEffort(a)*Ua(a)},E=function(a){if(a.schedule)return a.schedule;if(a.scheduleChartItem)return a.scheduleChartItem.schedule;var d=ha(a);if(d){for(var c=-Infinity,b,e=0;e<d.length;e++){var f=d[e];if(f.value>c){b=f.key;
c=f.value}}if((a=a.ganttChartView)&&a.settings&&a.settings.resourceSchedules){b=aa(a.settings.resourceSchedules,b);return b<0||!a.settings.resourceSchedules[b]?void 0:a.settings.resourceSchedules[b].value}}},qb=function(a,d,c,b,e,f,g,l,h,o,n){var t;a.addEventListener("mousedown",function(b){if(b.button==0){o.isDuringTimeDragOperation=true;o.draggingItem=e;o.dragType="Start";o.style.cursor=a.style.cursor;o.draggingInitialX=b.clientX;o.draggingInitialStartPosition=f;o.draggingInitialFinishPosition=
g;o.draggingInitialCompletedFinishPosition=l;b.preventDefault();if(DlhSoft.Controls.ToolTip&&n.useUpdatingToolTips){(t=DlhSoft.Controls.ToolTip.get(a))||(t=DlhSoft.Controls.ToolTip.initialize(void 0,a,{duration:NaN,containerStyle:"cursor: default; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; border: 1px solid "+n.border+"; background-color: White; color: Black; font-family: Arial; font-size: 12px; padding: 4px; margin-top: 1px"},"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase."));
t.setContent(n.dateTimeFormatter(N(e.start))+" \u2013 "+n.dateTimeFormatter(N(e.finish)));t.show();t.originalX=t.x;o.toolTip=t}}},true);d!=null&&d.addEventListener("mousedown",function(b){if(b.button==0){o.isDuringTimeDragOperation=true;o.draggingItem=e;o.dragType="StartOnly";o.style.cursor=a.style.cursor;o.draggingInitialX=b.clientX;o.draggingInitialStartPosition=f;b.preventDefault();if(DlhSoft.Controls.ToolTip&&n.useUpdatingToolTips){(t=DlhSoft.Controls.ToolTip.get(d))||(t=DlhSoft.Controls.ToolTip.initialize(void 0,
d,{duration:NaN,containerStyle:"cursor: default; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; border: 1px solid "+n.border+"; background-color: White; color: Black; font-family: Arial; font-size: 12px; padding: 4px; margin-top: 1px"},"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase."));t.setContent(n.dateTimeFormatter(N(e.start))+" \u2013");t.show();t.setHorizontalPosition(t.x+
4);t.originalX=t.x;o.toolTip=t}}},true);c!=null&&c.addEventListener("mousedown",function(a){if(a.button==0){o.isDuringTimeDragOperation=true;o.draggingItem=e;o.dragType="Finish";o.style.cursor=c.style.cursor;o.draggingInitialX=a.clientX;o.draggingInitialFinishPosition=g;a.preventDefault();if(DlhSoft.Controls.ToolTip&&n.useUpdatingToolTips){(t=DlhSoft.Controls.ToolTip.get(c))||(t=DlhSoft.Controls.ToolTip.initialize(void 0,c,{duration:NaN,containerStyle:"cursor: default; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; border: 1px solid "+
n.border+"; background-color: White; color: Black; font-family: Arial; font-size: 12px; padding: 4px; margin-top: 1px"},"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase."));t.setContent("\u2013 "+n.dateTimeFormatter(N(e.finish)));t.show();t.setHorizontalPosition(t.x-t.contentContainer.clientWidth);t.originalX=t.x;o.toolTip=t}}},true);b!=null&&b.addEventListener("mousedown",function(a){if(a.button==0){o.isDuringTimeDragOperation=
true;o.draggingItem=e;o.dragType="CompletedFinish";o.style.cursor=b.style.cursor;o.draggingInitialX=a.clientX;o.draggingInitialCompletedFinishPosition=l;a.preventDefault();if(DlhSoft.Controls.ToolTip&&n.useUpdatingToolTips){(t=DlhSoft.Controls.ToolTip.get(b))||(t=DlhSoft.Controls.ToolTip.initialize(void 0,b,{duration:NaN,containerStyle:"cursor: default; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; border: 1px solid "+n.border+"; background-color: White; color: Black; font-family: Arial; font-size: 12px; padding: 4px; margin-top: 1px"},
"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase."));a=db(e.start,e.completedFinish,e.finish,n,E(e));if(!isNaN(a)){t.setContent(Math.round(a*1E4)/100+"%");t.show();t.setHorizontalPosition(t.x+2);t.originalX=t.x;o.toolTip=t}}}},true);if(typeof o.draggableItems==="undefined")o.draggableItems=[];for(var w=false,u=0;u<o.draggableItems.length;u++)if(o.draggableItems[u]==e){w=true;break}if(!w){o.addEventListener("mousemove",
function(a){if(!(typeof o.draggingItem==="undefined"||o.draggingItem!=e||o.dragType!="Start"&&o.dragType!="StartOnly"&&o.dragType!="Finish"&&o.dragType!="CompletedFinish")){var b=a.clientX-o.draggingInitialX;dc(a.clientX,o);delete o.draggingItem;o.draggingInitialStartPosition+b<0&&(b=-o.draggingInitialStartPosition);if(o.dragType=="Start"||o.dragType=="StartOnly"){var c;o.dragType!="StartOnly"&&(c=L(e.start,e.finish,n,E(e)));a=L(e.start,e.completedFinish,n,E(e));b=M(ra(Fa(o.draggingInitialStartPosition+
b,n),n),n,true,e.isMilestone,E(e));if(o.dragType=="StartOnly"&&b>e.finish)b=e.finish;e.start=b;e.preferredStart=e.start;y(e,"start",true,false);if(o.dragType!="StartOnly"){if(e.isMilestone){e.finish=e.start;y(e,"finish",false,false);e.completedFinish=e.start}else{e.finish=R(e.start,c,n,E(e));y(e,"finish",false,false);e.completedFinish=R(e.start,a,n,E(e))}y(e,"completedFinish",false,false);if(DlhSoft.Controls.ToolTip&&n.useUpdatingToolTips){t=o.toolTip;t.setContent(n.dateTimeFormatter(N(e.start))+
" \u2013 "+n.dateTimeFormatter(N(e.finish)));t.setHorizontalPosition(t.originalX+(H(e.start,n)-o.draggingInitialStartPosition))}}else{if(e.finish<e.start){e.finish=e.start;y(e,"finish",false,false)}if(e.completedFinish<e.start||a<=0){e.completedFinish=e.start;y(e,"completedFinish",false,false)}if(DlhSoft.Controls.ToolTip&&n.useUpdatingToolTips){t=o.toolTip;t.setContent(n.dateTimeFormatter(N(e.start))+" \u2013");t.setHorizontalPosition(t.originalX+(H(e.start,n)-o.draggingInitialStartPosition))}}Va(e,
h,o.chartContent,n)}else if(o.dragType=="Finish"){c=M(ra(Fa(o.draggingInitialFinishPosition+b,n),n),n,e.isMilestone,true,E(e));if(c<e.start)c=e.start;if(c.valueOf()!=e.finish.valueOf()){e.finish=c;y(e,"finish",true,false)}if(e.completedFinish>c){e.completedFinish=c;y(e,"completedFinish",false,false)}if(DlhSoft.Controls.ToolTip&&n.useUpdatingToolTips){t=o.toolTip;t.setContent("\u2013 "+n.dateTimeFormatter(N(e.finish)));t.setHorizontalPosition(t.originalX+(H(e.finish,n)-o.draggingInitialFinishPosition))}Va(e,
h,o.chartContent,n)}else if(o.dragType=="CompletedFinish"){c=M(ra(Fa(o.draggingInitialCompletedFinishPosition+b,n),n),n,e.isMilestone,true,E(e));if(c<e.start)c=e.start;if(c>e.finish)c=e.finish;if(c.valueOf()!=e.completedFinish.valueOf()){e.completedFinish=c;y(e,"completedFinish",true,false)}if(DlhSoft.Controls.ToolTip&&n.useUpdatingToolTips){t=o.toolTip;c=db(e.start,e.completedFinish,e.finish,n,E(e));if(!isNaN(c)){t.setContent(Math.round(c*1E4)/100+"%");t.setHorizontalPosition(t.originalX+(H(e.completedFinish,
n)-o.draggingInitialCompletedFinishPosition))}}Va(e,h,o.chartContent,n)}o.draggingItem=e;o.draggingPerformed=true}},true);document.addEventListener("mouseup",function(a){if(!(a.button!=0||typeof o.draggingItem==="undefined"||o.draggingItem!=e||o.dragType!="Start"&&o.dragType!="StartOnly"&&o.dragType!="Finish"&&o.dragType!="CompletedFinish")){delete o.isDuringTimeDragOperation;a=o.draggingItem;o.style.cursor="default";if(o.draggingPerformed){if(o.dragType=="Start"||o.dragType=="StartOnly"){y(a,"start",
true,true);y(a,"finish",false,true);y(a,"completedFinish",false,true)}else if(o.dragType=="Finish"){y(a,"finish",true,true);y(a,"completedFinish",false,true)}else o.dragType=="CompletedFinish"&&y(a,"completedFinish",true,true);delete o.draggingPerformed}delete o.draggingItem}},true);o.draggableItems.push(e)}},cb=function(a,d,c,b,e,f,g,l,h,o){var n=b.ganttChartView.ownerDocument;a.addEventListener("mousedown",function(c){if(c.button==0){delete h.cancelDrag;h.draggingItem=b;h.dragType="Dependency";
h.dragDependencyType="Finish";h.style.cursor=a.style.cursor;h.draggingInitialX=c.clientX;h.draggingInitialY=c.clientY;h.draggingInitialRightPosition=f;h.draggingInitialTopPosition=e;h.draggingInitialFinishPosition=f;h.draggingInitialThumbPosition=e;c.preventDefault();if(DlhSoft.Controls.ToolTip&&o.useUpdatingToolTips){(toolTip=DlhSoft.Controls.ToolTip.get(a))||(toolTip=DlhSoft.Controls.ToolTip.initialize(void 0,a,{duration:NaN,containerStyle:"cursor: default; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; border: 1px solid "+
o.border+"; background-color: White; color: Black; font-family: Arial; font-size: 12px; padding: 4px; margin-top: 1px"},"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase."));toolTip.setContent(b.content+" \u2013");toolTip.show();toolTip.setPosition(toolTip.x+16,toolTip.y-8);toolTip.originalX=toolTip.x;toolTip.originalY=toolTip.y;h.toolTip=toolTip}}},true);d!=null&&d.addEventListener("mousedown",function(c){if(c.button==
0){delete h.cancelDrag;h.draggingItem=b;h.dragType="Dependency";h.dragDependencyType="Start";h.style.cursor=a.style.cursor;h.draggingInitialX=c.clientX;h.draggingInitialY=c.clientY;h.draggingInitialRightPosition=g;h.draggingInitialTopPosition=e;h.draggingInitialFinishPosition=g;h.draggingInitialThumbPosition=e;c.preventDefault();if(DlhSoft.Controls.ToolTip&&o.useUpdatingToolTips){(toolTip=DlhSoft.Controls.ToolTip.get(d))||(toolTip=DlhSoft.Controls.ToolTip.initialize(void 0,d,{duration:NaN,containerStyle:"cursor: default; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; border: 1px solid "+
o.border+"; background-color: White; color: Black; font-family: Arial; font-size: 12px; padding: 4px; margin-top: 1px"},"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase."));toolTip.setContent(b.content+" \u2013");toolTip.show();toolTip.setPosition(toolTip.x+16,toolTip.y-8);toolTip.originalX=toolTip.x;toolTip.originalY=toolTip.y;h.toolTip=toolTip}}},true);a.addEventListener("mouseover",function(){if(typeof h.temporaryHoveringThumb!==
"undefined"){var b=h.temporaryHoveringThumb;delete h.temporaryHoveringThumb;if(typeof b.originalStyle==="undefined")return;b.setAttribute("style",b.originalStyle);delete b.originalStyle}if(typeof h.temporaryDependencyLine==="undefined"){a.mouseOver=true;h.temporaryHoveringThumb=a;a.originalStyle=a.getAttribute("style");typeof o.dependencyPointerClass!=="undefined"&&a.setAttribute("class",o.dependencyPointerClass);typeof o.dependencyPointerStyle!=="undefined"&&a.setAttribute("style",o.dependencyPointerStyle);
a.style.cursor="pointer"}},true);d!=null&&d.addEventListener("mouseover",function(){if(typeof h.temporaryHoveringThumb!=="undefined"){var a=h.temporaryHoveringThumb;delete h.temporaryHoveringThumb;if(typeof a.originalStyle==="undefined")return;a.setAttribute("style",a.originalStyle);delete a.originalStyle}if(typeof h.temporaryDependencyLine==="undefined"){d.mouseOver=true;h.temporaryHoveringThumb=d;d.originalStyle=d.getAttribute("style");typeof o.dependencyPointerClass!=="undefined"&&d.setAttribute("class",
o.dependencyPointerClass);typeof o.dependencyPointerStyle!=="undefined"&&d.setAttribute("style",o.dependencyPointerStyle);d.style.cursor="pointer"}},true);a.addEventListener("mouseout",function(){delete a.mouseOver;setTimeout(function(){if(!(typeof a.originalStyle==="undefined"||a.mouseOver)){a.setAttribute("style",a.originalStyle);delete a.originalStyle}},2E3)},true);if(d!=null){delete d.mouseOver;d.addEventListener("mouseout",function(){setTimeout(function(){if(!(typeof d.originalStyle==="undefined"||
d.mouseOver)){d.setAttribute("style",d.originalStyle);delete d.originalStyle}},2E3)},true)}if(typeof h.draggableDependencyItems==="undefined")h.draggableDependencyItems=[];for(var t=false,w=0;w<h.draggableDependencyItems.length;w++)if(h.draggableDependencyItems[w]==b){t=true;break}if(!t){h.addEventListener("mousemove",function(a){if(!(typeof h.draggingItem==="undefined"||h.draggingItem!=b||h.dragType!="Dependency")){var d=a.clientX-h.draggingInitialX,f=a.clientY-h.draggingInitialY;dc(a.clientX,h);
ec(a.clientY,h);delete h.draggingItem;h.draggingInitialFinishPosition+d<0&&(d=-h.draggingInitialFinishPosition);if(typeof h.temporaryDependencyLine!=="undefined"){try{c.removeChild(h.temporaryDependencyLine)}catch(e){}delete h.temporaryDependencyLine}if(h.cancelDrag){delete h.cancelDrag;delete h.draggingItem;h.style.cursor="default"}else{a=n.createElementNS("http://www.w3.org/2000/svg","line");a.setAttribute("x1",h.draggingInitialRightPosition);a.setAttribute("y1",h.draggingInitialTopPosition);a.setAttribute("x2",
h.draggingInitialFinishPosition+d);a.setAttribute("y2",h.draggingInitialThumbPosition+f);typeof o.temporaryDependencyLineClass!=="undefined"&&a.setAttribute("class",o.temporaryDependencyLineClass);typeof o.temporaryDependencyLineStyle!=="undefined"&&a.setAttribute("style",o.temporaryDependencyLineStyle);h.temporaryDependencyLine=a;c.appendChild(a);h.draggingItem=b;if(DlhSoft.Controls.ToolTip&&o.useUpdatingToolTips){toolTip=h.toolTip;for(var g=Math.floor((b.itemTop+h.draggingInitialThumbPosition+f)/
o.itemHeight),a=null,t=0,w=0;w<l.length;w++){var j=l[w];if(j.isVisible&&!(typeof j.isHidden!=="undefined"&&j.isHidden)&&typeof j.displayRowIndex==="undefined"){if(t==g){a=j;break}t++}}g="Start";if(a!=null){t=h.draggingInitialFinishPosition+d;w=H(a.start,o);j=H(a.finish,o);if(a.isMilestone||a.hasChildren&&(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled)){w=w-o.itemHeight/2;j=j+o.itemHeight/2}j<w+4&&(j=w+4);if(t<w||t>j||nb(a,b)||Ga(a,b)||Ga(b,a))a=null;if(a!=null&&(typeof o.allowCreatingToFinishDependencies===
"undefined"||o.allowCreatingToFinishDependencies)&&!a.isMilestone&&t>w+(j-w)*3/4)g="Finish"}toolTip.setContent(b.content+" \u2013"+(a!=null?" "+a.content+(g!="Finish"?"":" \u2022"):""));toolTip.setPosition(toolTip.originalX+d,toolTip.originalY+f)}}}},true);n.addEventListener("mouseup",function(a){if(!(a.button!=0||typeof h.draggingItem==="undefined"||h.draggingItem!=b||h.dragType!="Dependency")){if(typeof h.temporaryDependencyLine!=="undefined"){try{c.removeChild(h.temporaryDependencyLine)}catch(d){}delete h.temporaryDependencyLine}for(var f=
Math.floor((b.itemTop+h.draggingInitialThumbPosition+(a.clientY-h.draggingInitialY))/o.itemHeight),e=null,n=0,g=0;g<l.length;g++){var t=l[g];if(t.isVisible&&!(typeof t.isHidden!=="undefined"&&t.isHidden)&&typeof t.displayRowIndex==="undefined"){if(n==f){e=t;break}n++}}if(e!=null){a=h.draggingInitialFinishPosition+(a.clientX-h.draggingInitialX);f=H(e.start,o);n=H(e.finish,o);if(e.isMilestone||e.hasChildren&&(typeof e.isSummaryEnabled==="undefined"||e.isSummaryEnabled)){f=f-o.itemHeight/2;n=n+o.itemHeight/
2}n<f+4&&(n=f+4);if(a>=f&&a<=n&&!nb(e,b)&&!Ga(e,b)&&!Ga(b,e)){a=e==null||typeof o.allowCreatingToFinishDependencies!=="undefined"&&!o.allowCreatingToFinishDependencies||e.isMilestone||a<=f+(n-f)*3/4?"Start":"Finish";delete b.successors;if(typeof e.predecessors==="undefined")e.predecessors=[];f={item:b};if(h.dragDependencyType!="Start"){if(a=="Finish")f.dependencyType="FF"}else f.dependencyType=a!="Finish"?"SS":"SF";e.predecessors.push(f);y(e,"predecessors",true,true);if(e.start<b.finish&&!o.areTaskDependencyConstraintsEnabled&&
!o.areTaskDependencyConstraintsDisabledWhenDropping){var w,j;if(!e.isMilestone&&(!e.hasChildren||!(typeof e.isSummaryEnabled==="undefined"||e.isSummaryEnabled))){w=L(e.start,e.finish,o,E(e));j=L(e.start,e.completedFinish,o,E(e))}if((!e.hasChildren||!(typeof e.isSummaryEnabled==="undefined"||e.isSummaryEnabled))&&a=="Start"){e.start=M(ra(h.dragDependencyType!="Start"?b.finish:b.start,o),o,true,e.isMilestone,E(b));y(e,"start",false,true);if(e.isMilestone){e.finish=e.start;y(e,"finish",false,true);e.completedFinish=
e.start}else{e.finish=R(e.start,w,o,E(e));y(e,"finish",false,true);e.completedFinish=R(e.start,j,o,E(e))}y(e,"completedFinish",false,true)}}Va(e,l,h.chartContent,o);Va(b,l,h.chartContent,o)}}delete h.draggingItem;h.style.cursor="default"}},true);h.draggableDependencyItems.push(b)}},dc=function(a,d){if(typeof d.draggingItem!=="undefined"){var c=d,b=0;if(c.offsetParent){do{b=b+c.offsetLeft;c=c.offsetParent}while(c)}a=a-b;if(a<d.gridContentContainer.offsetWidth+24){c=d.chartContentContainer.scrollLeft;
d.chartContentContainer.scrollLeft=d.chartContentContainer.scrollLeft-20;c=c-d.chartContentContainer.scrollLeft;if(typeof d.draggingInitialStartPosition!=="undefined")d.draggingInitialStartPosition=d.draggingInitialStartPosition-c;if(typeof d.draggingInitialFinishPosition!=="undefined")d.draggingInitialFinishPosition=d.draggingInitialFinishPosition-c;if(typeof d.draggingInitialCompletedFinishPosition!=="undefined")d.draggingInitialCompletedFinishPosition=d.draggingInitialCompletedFinishPosition-c}else if(a>=
d.gridContentContainer.offsetWidth+d.chartContentContainer.clientWidth-24){c=d.chartContentContainer.scrollLeft;d.chartContentContainer.scrollLeft=d.chartContentContainer.scrollLeft+20;c=d.chartContentContainer.scrollLeft-c;if(typeof d.draggingInitialStartPosition!=="undefined")d.draggingInitialStartPosition=d.draggingInitialStartPosition+c;if(typeof d.draggingInitialFinishPosition!=="undefined")d.draggingInitialFinishPosition=d.draggingInitialFinishPosition+c;if(typeof d.draggingInitialCompletedFinishPosition!==
"undefined")d.draggingInitialCompletedFinishPosition=d.draggingInitialCompletedFinishPosition+c}}},Qc=function(a){var d=0;if(a.offsetParent){do{d=d+a.offsetTop;a=a.offsetParent}while(a)}return d},ec=function(a,d){if(typeof d.draggingItem!=="undefined"){var a=a-Qc(d),c,b;if(a<d.chartHeaderContainer.clientHeight+24){c=d.chartContentContainer.scrollTop;d.chartContentContainer.scrollTop=d.chartContentContainer.scrollTop-20;if(typeof d.isDuringVerticalScrolling==="undefined"){d.isDuringVerticalScrolling=
true;setTimeout(function(){b=c-d.chartContentContainer.scrollTop;d.draggingInitialThumbPosition=d.draggingInitialThumbPosition-b;delete d.isDuringVerticalScrolling},0)}}else if(a>=d.chartHeaderContainer.clientHeight+d.chartContentContainer.clientHeight-24){c=d.chartContentContainer.scrollTop;d.chartContentContainer.scrollTop=d.chartContentContainer.scrollTop+20;if(typeof d.isDuringVerticalScrolling==="undefined"){d.isDuringVerticalScrolling=true;setTimeout(function(){b=d.chartContentContainer.scrollTop-
c;d.draggingInitialThumbPosition=d.draggingInitialThumbPosition+b;delete d.isDuringVerticalScrolling},0)}}}},Va=function(a,d,c,b){ga(a.chartItem,a,b);sa(d,a);setTimeout(function(){if(typeof a.gridItem!=="undefined"){if(typeof a.completedInput!=="undefined"){var e=a.completedInput;typeof e.changeEventListener!=="undefined"&&e.removeEventListener("change",e.changeEventListener,true);delete a.completedInput}Ca(a.gridItem,a,d,b.columns,c,b.toggleButtonAreaWidth,b)}for(e=a.parent;e!=null;){$a(e,false);
a=e;ga(a.chartItem,a,b);sa(d,a);typeof a.gridItem!=="undefined"&&Ca(a.gridItem,a,d,b.columns,c,b.toggleButtonAreaWidth,b);e=a.parent}},0)},fc=function(a){var d=a.itemTop-a.ganttChartView.chartContentContainer.scrollTop;if(d<0)a.ganttChartView.chartContentContainer.scrollTop=a.itemTop;else if(d>a.ganttChartView.chartContentContainer.clientHeight-a.ganttChartView.settings.itemHeight)a.ganttChartView.chartContentContainer.scrollTop=a.itemTop-(a.ganttChartView.chartContentContainer.clientHeight-a.ganttChartView.settings.itemHeight)},
Cc=function(a,d,c,b,e,f,g,l,h,o,n,t,w,u){var j,q;d.addEventListener("scroll",function(){if(g.scrollTop!=d.scrollTop&&!q){j=true;setTimeout(function(){g.scrollTop=d.scrollTop;setTimeout(function(){j=false},100)},200)}if(b.scrollLeft!=d.scrollLeft)b.scrollLeft=d.scrollLeft},true);eb(d,c,e,u);typeof a.updateGridHeaderTimer!=="undefined"&&clearInterval(a.updateGridHeaderTimer);a.updateGridHeaderTimer=setInterval(function(){try{eb(d,c,e,u)}catch(b){try{clearInterval(a.updateGridHeaderTimer)}catch(l){}}},
100);g.addEventListener("scroll",function(){if(d.scrollTop!=g.scrollTop&&!j){q=true;setTimeout(function(){d.scrollTop=g.scrollTop;setTimeout(function(){q=false},100)},200)}if(l.scrollLeft!=g.scrollLeft)l.scrollLeft=g.scrollLeft;xa(w,g,u);Na(w,n,u);u.displayedTime=Fa(g.scrollLeft,u);(typeof a.isDuringScrollToDateTime==="undefined"||!a.isDuringScrollToDateTime)&&typeof u.displayedTimeChangeHandler!=="undefined"&&setTimeout(function(){u.displayedTimeChangeHandler(u.displayedTime)},0);typeof a.isDuringScrollToDateTime!==
"undefined"&&delete a.isDuringScrollToDateTime},true);setTimeout(function(){if(l.scrollLeft!=g.scrollLeft)l.scrollLeft=g.scrollLeft;xa(w,g,u)},1);eb(g,h,o,u);typeof a.updateChartHeaderTimer!=="undefined"&&clearInterval(a.updateChartHeaderTimer);a.updateChartHeaderTimer=setInterval(function(){try{eb(g,h,o,u)}catch(b){try{clearInterval(a.updateChartHeaderTimer)}catch(c){}}},100);window.addEventListener("mousewheel",function(){try{a.cancelDrag=true}catch(b){}},true)},eb=function(a,d,c,b){setTimeout(function(){try{var e=
d.clientWidth-a.clientWidth;e<0&&(e=0);var f=e+"px";if(c.style.width!=f){c.style.width=f;if(e>0){c.style.boxSizing="border-box";c.style.MozBoxSizing="border-box";c.style.border="solid 1px "+b.border;c.style.borderTop="none";c.style.borderRight="none"}else{c.style.border="";c.style.borderTop="";c.style.borderRight="";c.style.boxSizing="";c.style.MozBoxSizing=""}}}catch(g){}},0)},Ea=function(a,d,c){if(c.isSplitterEnabled){a.style.height=d.clientHeight+"px";a.style.left=Math.max(0,d.offsetWidth-1)+"px"}},
xa=function(a,d,c){if(!(typeof d.isInitializing!=="undefined"&&d.isInitializing)&&c.isVirtualizing)for(var b=d.scrollTop-c.itemHeight,d=b+d.clientHeight+2*c.itemHeight,e=0;e<a.length;e++){var f=a[e];if(!f.isPart)if(typeof f.isVirtuallyVisible==="undefined"&&(typeof f.isVisible==="undefined"||f.isVisible)&&!(typeof f.isHidden!=="undefined"&&f.isHidden)&&typeof f.itemTop!=="undefined"&&f.itemTop>=b&&f.itemTop<d){f.isVirtuallyVisible=true;y(f,"isVirtuallyVisible",false,true);typeof f.gridItem!=="undefined"&&
Ca(f.gridItem,f,a,c.columns,f.ganttChartView.chartContent,c.toggleButtonAreaWidth,c);ga(f.chartItem,f,c);f.chartItem.setAttribute("transform","translate(0, "+f.itemTop+")");Ha(f,f.itemTop)}else typeof f.isVirtuallyVisible!=="undefined"&&((typeof f.isVisible==="undefined"||f.isVisible)&&!(typeof f.isHidden!=="undefined"&&f.isHidden)&&typeof f.itemTop!=="undefined"&&(f.itemTop<b||f.itemTop>=d))&&delete f.isVirtuallyVisible}},zc=function(a,d){for(var c=a.childNodes.length;c-- >0;)a.removeChild(a.childNodes[c]);
a.appendChild(d)},vb=function(a,d,c,b){var e=b.indexOf(a);if(!(e<0||d<0||d==e||d>=b.length)){b.splice(e,1);b.splice(d,0,a);gc(b);S(c);typeof c.settings.itemMoveHandler!=="undefined"&&c.settings.itemMoveHandler(a,e,d)}},fb=function(a,d,c,b,e){if(!(a<0||c<0||c==a||c>e.length-d)){var f=[],g;for(g=a;g<a+d;g++)f.push(e[g]);e.splice(a,d);for(g=0;g<f.length;g++)e.splice(c+g,0,f[g]);gc(e);S(b);if(typeof b.settings.itemMoveHandler!=="undefined")for(g=0;g<f.length;g++)b.settings.itemMoveHandler(f[g],a+g,c+
g)}},gc=function(a){for(var d=0,c=0;c<a.length;c++){var b=a[c];if(b.indentation>d){b.indentation=d;y(b,"indentation",false,true)}d=b.indentation+1}},Rc=function(a,d,c,b,e,f,g,l,h,o){a.addEventListener("mousedown",function(c){if(c.button==0){delete b.cancelDrag;b.draggingItem=d;b.dragType="Ordering";b.style.cursor=a.style.cursor;b.draggingInitialY=c.clientY;b.draggingInitialThumbPosition=0;b.resetChartAreaDefinitions();c.preventDefault()}},true);if(typeof b.draggableOrderingItems==="undefined")b.draggableOrderingItems=
[];for(var n=false,t=0;t<b.draggableOrderingItems.length;t++)if(b.draggableOrderingItems[t]==d){n=true;break}if(!n){b.addEventListener("mousemove",function(a){if(!(typeof b.draggingItem==="undefined"||b.draggingItem!=d||b.dragType!="Ordering")){if(typeof b.temporaryHoveredGridItemSelectionContainer!=="undefined"){b.temporaryHoveredGridItemSelectionContainer.setAttribute("class",b.temporaryHoveredGridItemClass);b.temporaryHoveredGridItemSelectionContainer.setAttribute("style",b.temporaryHoveredGridItemStyle);
delete b.temporaryHoveredGridItemSelectionContainer;delete b.temporaryHoveredGridItemClass;delete b.temporaryHoveredGridItemStyle}var n=a.clientY-b.draggingInitialY;ec(a.clientY,b);delete b.draggingItem;if(b.cancelDrag){x(d,e);delete b.cancelDrag;delete b.draggingItem;b.style.cursor="default"}else{for(var a=Math.floor((d.itemTop+b.draggingInitialThumbPosition+n)/e.itemHeight),n=null,t=0,q=0;q<c.length;q++){var j=c[q];if(j.isVisible&&!(typeof j.isHidden!=="undefined"&&j.isHidden)&&typeof j.displayRowIndex===
"undefined"){if(t==a){n=j;break}t++}}if(n!=null&&n!=d&&n.gridItemSelectionContainer!=null){b.temporaryHoveredGridItemSelectionContainer=n.gridItemSelectionContainer;b.temporaryHoveredGridItemClass=n.gridItemSelectionContainer.getAttribute("class");b.temporaryHoveredGridItemStyle=n.gridItemSelectionContainer.getAttribute("style");typeof f==="undefined"||f(a,n)?typeof g!=="undefined"?n.gridItemSelectionContainer.setAttribute("class",g):typeof l!=="undefined"&&n.gridItemSelectionContainer.setAttribute("style",
l):typeof h!=="undefined"?n.gridItemSelectionContainer.setAttribute("class",h):typeof o!=="undefined"&&n.gridItemSelectionContainer.setAttribute("style",o)}b.draggingItem=d}}},true);document.addEventListener("mouseup",function(a){if(!(a.button!=0||typeof b.draggingItem==="undefined"||b.draggingItem!=d||b.dragType!="Ordering")){if(typeof b.temporaryHoveredGridItemSelectionContainer!=="undefined"){b.temporaryHoveredGridItemSelectionContainer.setAttribute("class",b.temporaryHoveredGridItemClass);b.temporaryHoveredGridItemSelectionContainer.setAttribute("style",
b.temporaryHoveredGridItemStyle);delete b.temporaryHoveredGridItemSelectionContainer;delete b.temporaryHoveredGridItemClass;delete b.temporaryHoveredGridItemStyle}for(var a=Math.floor((d.itemTop+b.draggingInitialThumbPosition+(a.clientY-b.draggingInitialY))/e.itemHeight),l=null,h=0,o=0;o<c.length;o++){var n=c[o];if(n.isVisible&&!(typeof n.isHidden!=="undefined"&&n.isHidden)&&typeof n.displayRowIndex==="undefined"){if(h==a){l=n;break}h++}}l!=null&&(typeof f==="undefined"||f(a,l))&&b.moveItemHierarchy(b.draggingItem,
l.index);setTimeout(function(){x(d,e);fc(d)},0);b.resetChartAreaDefinitions();delete b.draggingItem;b.style.cursor="default"}},true);b.draggableOrderingItems.push(d)}},Sc=function(a,d){for(var c in d)c.indexOf("custom")!=0&&c.indexOf("description")!=0||typeof a[c]==="undefined"&&(a[c]=d[c])},hc=function(a,d,c,b,e,f,g,l,h,o,n,t,w,u,j,q){var k,p=[],m;if(typeof b!=="undefined")for(k=0;k<b.length;k++){m=q.columns[b[k]];p.push({isTreeView:m.isTreeView,header:m.header,width:m.width,headerClass:m.headerClass,
headerStyle:m.headerStyle,cellClass:m.cellClass,cellStyle:m.cellStyle,cellTemplate:typeof m.exportCellTemplate!=="undefined"?m.exportCellTemplate:m.cellTemplate})}else for(k=0;k<q.columns.length;k++){m=q.columns[k];m.isSelection||p.push({isTreeView:m.isTreeView,header:m.header,width:m.width,headerClass:m.headerClass,headerStyle:m.headerStyle,cellClass:m.cellClass,cellStyle:m.cellStyle,cellTemplate:typeof m.exportCellTemplate!=="undefined"?m.exportCellTemplate:m.cellTemplate})}if(typeof c==="undefined")c=
q.isGridVisible;k=c?hb(p)+1:0;if(typeof e!=="undefined"){if(typeof g==="undefined"||!g)e=new Date(e.valueOf()-e.getTimezoneOffset()*6E4)}else e=q.timelineStart;if(typeof f!=="undefined"){if(typeof g==="undefined"||!g)f=new Date(f.valueOf()-f.getTimezoneOffset()*6E4)}else f=q.timelineFinish;e={isExport:true,isReadOnly:true,selectionMode:"None",isVirtualizing:false,isGridVisible:c,isSplitterEnabled:false,gridWidth:k+"px",columns:p,allowUserToResizeColumns:false,isGridRowClickTimeScrollingEnabled:false,
isMouseWheelZoomEnabled:false,timelineStart:e,timelineFinish:f,hourWidth:typeof l!=="undefined"?l:q.hourWidth,displayedTime:typeof e!=="undefined"?e:q.timelineStart,currentTime:q.currentTime,isTaskToolTipVisible:false,isDependencyToolTipVisible:false,containerClass:q.containerClass,containerStyle:q.containerStyle,border:q.border,theme:q.theme,headerBackground:q.headerBackground,headerHeight:q.headerHeight,itemHeight:q.itemHeight,itemClass:q.itemClass,itemStyle:q.itemStyle,standardItemClass:q.standardItemClass,
summaryItemClass:q.summaryItemClass,milestoneItemClass:q.milestoneItemClass,standardItemStyle:q.standardItemStyle,summaryItemStyle:q.summaryItemStyle,milestoneItemStyle:q.milestoneItemStyle,indentationLevelWidth:q.indentationLevelWidth,toggleButtonClass:q.toggleButtonClass,toggleButtonStyle:q.toggleButtonStyle,scales:[],visibleWeekStart:q.visibleWeekStart,visibleWeekFinish:q.visibleWeekFinish,workingWeekStart:q.workingWeekStart,workingWeekFinish:q.workingWeekFinish,visibleDayStart:q.visibleDayStart,
visibleDayFinish:q.visibleDayFinish,specialNonworkingDays:q.specialNonworkingDays,barMargin:q.barMargin,barHeight:q.barHeight,barCornerRadius:q.barCornerRadius,completedBarMargin:q.completedBarMargin,completedBarHeight:q.completedBarHeight,completedBarCornerRadius:q.completedBarCornerRadius,standardBarClass:q.standardBarClass,summaryBarClass:q.summaryBarClass,milestoneBarClass:q.milestoneBarClass,standardBarStyle:q.standardBarStyle,summaryBarStyle:q.summaryBarStyle,milestoneBarStyle:q.milestoneBarStyle,
standardCompletedBarClass:q.standardCompletedBarClass,standardCompletedBarStyle:q.standardCompletedBarStyle,dependencyLineClass:q.dependencyLineClass,dependencyLineStyle:q.dependencyLineStyle,assignmentsClass:q.assignmentsClass,assignmentsStyle:q.assignmentsStyle,areTaskAssignmentsVisible:q.areTaskAssignmentsVisible,isTaskCompletedEffortVisible:q.isTaskCompletedEffortVisible,areTaskDependenciesVisible:q.areTaskDependenciesVisible,areDependencyConstraintsAppliedOnStartedTasks:q.areDependencyConstraintsAppliedOnMilestones,
areDependencyConstraintsAppliedOnMilestones:q.areDependencyConstraintsAppliedOnMilestones,isBaselineVisible:q.isBaselineVisible,alternativeItemClass:q.alternativeItemClass,alternativeChartItemClass:q.alternativeChartItemClass,alternativeItemStyle:q.alternativeItemStyle,alternativeChartItemStyle:q.alternativeChartItemStyle,gridLines:q.gridLines,horizontalGridLines:q.horizontalGridLines,verticalGridLines:q.verticalGridLines,horizontalChartLines:q.horizontalChartLines,isIndividualItemNonworkingTimeHighlighted:q.isIndividualItemNonworkingTimeHighlighted,
areTaskInterruptionsHighlighted:q.areTaskInterruptionsHighlighted,isBaselineVisible:q.isBaselineVisible,taskInitiationCost:q.taskInitiationCost,defaultResourceUsageCost:q.defaultResourceUsageCost,specificResourceUsageCosts:q.specificResourceUsageCosts,defaultResourceHourCost:q.defaultResourceHourCost,specificResourceHourCosts:q.specificResourceHourCosts,target:q.target,months:q.months,daysOfWeek:q.daysOfWeek,weekStartDay:q.weekStartDay,dateFormatter:q.dateFormatter,dateTimeFormatter:q.dateTimeFormatter,
isRelativeToTimezone:q.isRelativeToTimezone,standardTaskTemplate:q.standardTaskTemplate,summaryTaskTemplate:q.summaryTaskTemplate,milestoneTaskTemplate:q.milestoneTaskTemplate,assignmentsTemplate:q.assignmentsTemplate,dependencyLineTemplate:q.dependencyLineTemplate,styleDefinitionTemplate:q.styleDefinitionTemplate};e.timelineStart=ya(e.timelineStart,e.weekStartDay);e.timelineFinish=jb(e.timelineFinish,e.weekStartDay);f=H(e.timelineFinish,e);e.chartWidth=f+"px";var s=k+f+2+(c?1:0);for(k=0;k<q.scales.length;k++){c=
q.scales[k];e.scales.push({scaleType:c.scaleType,isHeaderVisible:c.isHeaderVisible,headerHeight:c.headerHeight,headerTextFormat:c.headerTextFormat,headerClass:c.headerClass,headerStyle:c.headerStyle,isHighlightingVisible:c.isHighlightingVisible,highlightingClass:c.highlightingClass,highlightingStyle:c.highlightingStyle,isSeparatorVisible:c.isSeparatorVisible,separatorClass:c.separatorClass,separatorStyle:c.separatorStyle})}var v,x,r=false;if(n!=null&&typeof n.createElement!=="undefined")v=n;else{if(n!=
null&&typeof n.focus!=="undefined")x=n;else{x=window.open("",n!=null?n:"_blank",typeof t!=="undefined"&&t&&(typeof u==="undefined"||u)?"width=320,height=100,location=no,menubar=no,toolbar=no,status=no,scrollbars=yes":"");r=true}v=x.document;try{var B=document.head.getElementsByTagName("link");for(k=0;k<B.length;k++){var y=B[k],A=v.adoptNode(y.cloneNode(true));A.href=y.href;v.head.appendChild(A)}}catch(z){}}v.title=typeof a!=="undefined"?a:"Exported chart"+(typeof t!=="undefined"&&t?" (printable)":
"");typeof h==="undefined"&&(h=0);typeof o==="undefined"&&(o=j.length-1);a=[];for(k=B=0;k<j.length;k++){n=j[k];if(!(typeof n.displayRowIndex!=="undefined"&&(n.displayRowIndex<h||n.displayRowIndex>o)||typeof n.displayRowIndex==="undefined"&&(B++<h||B>o+1))){q={content:n.content,indentation:n.indentation,start:n.start,finish:n.finish,completedFinish:n.completedFinish,isMilestone:n.isMilestone,schedule:E(n),assignmentsContent:n.assignmentsContent,baselineStart:n.baselineStart,baselineFinish:n.baselineFinish,
isBarVisible:n.isBarVisible,isRelativeToTimezone:n.isRelativeToTimezone,"class":n["class"],style:n.style,barClass:n.barClass,standardBarClass:n.standardBarClass,completedStandardBarClass:n.completedStandardBarClass,summaryBarClass:n.summaryBarClass,milestoneBarClass:n.milestoneBarClass,baselineBarClass:n.baselineBarClass,barStyle:n.barStyle,standardBarStyle:n.standardBarStyle,completedStandardBarStyle:n.completedStandardBarStyle,summaryBarStyle:n.summaryBarStyle,milestoneBarStyle:n.milestoneBarStyle,
baselineBarStyle:n.baselineBarStyle,isSummaryEnabled:n.isSummaryEnabled,isParentSummarizationEnabled:n.isParentSummarizationEnabled,isHidden:n.isHidden,isExported:true,tag:n};if(typeof n.displayRowIndex!=="undefined")q.displayRowIndex=n.displayRowIndex-h;Sc(q,n);a.push(q);n.exportItem=q}}for(k=0;k<j.length;k++){n=j[k];if(!(typeof n.displayRowIndex!=="undefined"&&(n.displayRowIndex<h||n.displayRowIndex>o))){q=n.exportItem;if(typeof n.predecessors!=="undefined"){q.predecessors=[];for(B=0;B<n.predecessors.length;B++){y=
n.predecessors[B];typeof y.item.displayRowIndex!=="undefined"&&(y.item.displayRowIndex<h||y.item.displayRowIndex>o)||q.predecessors.push({item:y.item.exportItem,dependencyType:y.dependencyType,lag:y.lag,dependencyLineClass:y.dependencyLineClass,dependencyLineStyle:y.dependencyLineStyle})}}}}var C=v.createElement("p");C.innerHTML=typeof d!=="undefined"?d:"";v.body.appendChild(C);var F=v.createElement("div");F.setAttribute("style","width: "+s+"px");try{DlhSoft.Controls.GanttChartView.initialize(F,a,
e,"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase.")}catch(G){}setTimeout(function(){r&&v.body.setAttribute("style","margin: 0px");var a=v.createElement("div");a.appendChild(F);v.body.replaceChild(a,C);if(w){a.setAttribute("style","width: "+F.offsetHeight+"px; height: "+s+"px; overflow: hidden");a=Math.round((F.offsetWidth-F.offsetHeight)/2);F.setAttribute("style","width: "+s+"px; transform: rotate(90deg) translateX("+
a+"px) translateY("+a+"px); -webkit-transform: rotate(90deg) translateX("+a+"px) translateY("+a+"px)")}v.close();if(typeof x!==void 0){x.focus();if(typeof t!=="undefined"&&t){x.print();(typeof u==="undefined"||u)&&x.close()}}},0)},ic=function(a){var d=na;if(typeof a==="undefined")return d;for(var c=0;c<a.length;c++){var b=a[c];if((!b.hasChildren||!(typeof b.isSummaryEnabled==="undefined"||b.isSummaryEnabled))&&b.start<d)d=b.start}return new Date(d.valueOf())},jc=function(a){var d=ca;if(typeof a===
"undefined")return d;for(var c=0;c<a.length;c++){var b=a[c];if(!b.hasChildren||!(typeof b.isSummaryEnabled==="undefined"||b.isSummaryEnabled))if(typeof b.isMilestone==="undefined"||!b.isMilestone){if(b.finish>d)d=b.finish}else if(b.start>d)d=b.start}return new Date(d.valueOf())},kc=function(a,d){for(var c=0,b=0;b<a.length;b++){var e=a[b];e.parent==null&&(c=c+ea(e,d))}return c},lc=function(a,d){for(var c=0,b=0;b<a.length;b++){var e=a[b];e.parent==null&&(c=c+Aa(e,d))}return c},mc=function(a,d){for(var c=
[],b=0;b<d.length;b++){var e=d[b];if(!(e==a||typeof e.predecessors==="undefined"||e.predecessors.length==0))for(var f=0;f<e.predecessors.length;f++)if(e.predecessors[f].item==a){c.push(e);break}}return c},wb=function(a,d){for(var c=[],b=mc(a,d),e=0;e<b.length;e++){var f=b[e];if(!(typeof f.predecessors==="undefined"||f.predecessors.length==0))for(var g=0;g<f.predecessors.length;g++)f.predecessors[g].item==a&&c.push({successor:f,predecessor:f.predecessors[g]})}return c},gb=function(a,d,c,b){typeof d===
"undefined"&&(d=0);var e=jc(c);if(a.finish>=e)return true;if(!a.hasChildren||!(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled))for(var f=wb(a,c),e=0;e<f.length;e++){var g=f[e].successor,l=f[e].predecessor;if(((typeof l.dependencyType==="undefined"||l.dependencyType==""||l.dependencyType=="FinishStart"||l.dependencyType=="FS")&&L(a.finish,g.start,b,E(a))<=d||(l.dependencyType=="StartStart"||l.dependencyType=="SS")&&L(a.start,g.start,b,E(a))<=d)&&gb(g,d,c,b))return true}else{a=a.children;
for(e=0;e<a.length;e++)if(gb(a[e],d,c,b))return true}return false},xb=function(a,d,c){for(var b=0;b<a.length;b++){var e=a[b];(!e.hasChildren||!(typeof e.isSummaryEnabled==="undefined"||e.isSummaryEnabled))&&(typeof e.predecessors!=="undefined"&&e.predecessors!=null&&e.predecessors.length>0)&&La(e,a,d,c)}},nc=function(a,d,c,b){var d=new Date(d.valueOf()-d.getTimezoneOffset()*6E4),d=ua(d,b,E(a)),c=ea(a,b),e=Aa(a,b);yb(a,d);Ya(a,c,b);Za(a,e,b);Z(a)},oc=function(a,d){for(var c=0,b=ha(a),e=0;e<b.length;e++){var f=
b[e],g=f.key,l;typeof d.specificResourceUsageCosts!=="undefined"&&(l=aa(d.specificResourceUsageCosts,g))>=0?c=c+d.specificResourceUsageCosts[l].value*f.value:typeof d.defaultResourceUsageCost!=="undefined"&&(c=c+d.defaultResourceUsageCost*f.value);if(!a.hasChildren||!(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled)){var h=ea(a,d)/36E5;typeof d.specificResourceHourCosts!=="undefined"&&(l=aa(d.specificResourceHourCosts,g))>=0?c=c+d.specificResourceHourCosts[l].value*h*f.value:typeof d.defaultResourceHourCost!==
"undefined"&&(c=c+d.defaultResourceHourCost*h*f.value)}}return c},Ab=function(a,d){var c=typeof d.taskInitiationCost!=="undefined"?d.taskInitiationCost:0,c=c+oc(a,d);if(a.hasChildren&&(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled))for(var b=0;b<a.children.length;b++)c=c+zb(a.children[b],d);return c},zb=function(a,d){return(typeof a.executionCost!=="undefined"?a.executionCost:0)+Ab(a,d)},Tc=function(a){for(var d=[],a=sb(a),c=0;c<a.length;c++)pc(a[c],d);return d},pc=function(a,d){if(!a.hasChildren||
!(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled))d.indexOf(a)<0&&d.push(a);else for(var c=0;c<a.children.length;c++)pc(a.children[c],d)},Ia=function(a){return!a.isMilestone&&a.completedFinish>a.start},ea=function(a,d){if(a.hasChildren&&(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled)){for(var c=0,b=a.children,e=0;e<b.length;e++)c=c+ea(b[e],d);return c}return L(a.start,a.finish,d,E(a))},Aa=function(a,d){if(a.hasChildren&&(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled)){for(var c=
0,b=a.children,e=0;e<b.length;e++)c=c+Aa(b[e],d);return c}return L(a.start,a.completedFinish,d,E(a))},Ya=function(a,d,c){d=R(a.start,d,c,E(a));a.finish=d;y(a,"finish",false,false);qc(a,false)},Za=function(a,d,c){a.completedFinish=R(a.start,d,c,E(a));y(a,"completedFinish",false,false)},yb=function(a,d){a.start=d;a.preferredStart=d;y(a,"start",false,false);qc(a,false)},qc=function(a,d){for(var c=a.parent;c!=null;){$a(c,d);a=c;c=a.parent}},rc=function(a,d,c){typeof c==="undefined"&&(c=false);var b=a.parent,
e=a.index;if(b==null){for(b=0;e-- >0;){a=d[e];a.indentation==0&&b++}return b+(!c?1:0)}return rc(b,d)+"."+(b.children.indexOf(a)+(!c?1:0))},ha=function(a){var d;a=a.assignmentsContent;if(typeof a==="undefined")d=[];else{for(var a=a.split(","),c=[],b=0;b<a.length;b++){var e=Wa(a[b]),f=1,g=e.indexOf("["),l=e.lastIndexOf("]");if(g>=0&&l>=0){l=Wa(e.substr(g+1,l-g-1));e=Wa(e.substr(0,g));g=l.indexOf("%");g>=0&&(l=Wa(l.substr(0,g)));try{d=parseFloat(l);f=d/100}catch(h){f=1}}if(!(e.length<=0)){g=aa(c,e);
g<0?c.push({key:e,value:f}):c[g].value=c[g].value+f}}d=c}return d},sc=function(a){for(var d=[],a=ha(a),c=0;c<a.length;c++)d.push(a[c].key);return d},Ja=function(a,d){if(typeof d==="undefined")return[];for(var c=[],b=0;b<d.length;b++){var e=d[b];if(!e.hasChildren||!(typeof e.isSummaryEnabled==="undefined"||e.isSummaryEnabled))for(var f=ha(e),g=0;g<f.length;g++){var l=f[g];if(l.key==a){c.push({key:e,value:l.value});break}}}return c},Ka=function(a){if(typeof a==="undefined")return[];for(var d=[],c=0;c<
a.length;c++){var b=a[c];if(!b.hasChildren||!(typeof b.isSummaryEnabled==="undefined"||b.isSummaryEnabled))for(var b=sc(b),e=0;e<b.length;e++){var f=b[e];d.indexOf(f)<0&&d.push(f)}}return d},tc=function(a,d){for(var c=[],b=Ja(a,d),e=0;e<b.length;e++){var f=b[e],g=f.key;if(!g.hasChildren||!(typeof g.isSummaryEnabled==="undefined"||g.isSummaryEnabled))for(g=[{start:g.start,finish:g.finish}];g.length>0;){var l;l=g[0];g.splice(0,1);if(!(l.finish<=l.start))if(c.length==0)c.push({key:l,value:f.value});
else{ic(d);for(var h=false,o=0;o<c.length;o++){var n=c[o].key,t=c[o].value;if(!(l.start>=n.finish))if(l.finish<=n.start){for(h=0;h<=o;h++)if(c[h].key.start>=l.start){c.splice(h,0,{key:l,value:f.value});break}h=true;break}else if(l.start<=n.start&&l.finish>=n.finish){c[o].value=t+f.value;l.start<n.start&&g.push({start:l.start,finish:n.start});l.finish>n.finish&&g.push({start:n.finish,finish:l.finish});h=true;break}else if(l.start>=n.start&&l.finish<=n.finish){c.splice(o,1);l.start>n.start&&c.splice(o++,
0,{key:{start:n.start,finish:l.start},value:t});c.splice(o++,0,{key:l,value:t+f.value});l.finish<n.finish&&c.splice(o++,0,{key:{start:l.finish,finish:n.finish},value:t});h=true;break}else if(l.start>=n.start&&l.finish>=n.finish){c.splice(o,1);l.start>n.start&&c.splice(o++,0,{key:{start:n.start,finish:l.start},value:t});c.splice(o++,0,{key:{start:l.start,finish:n.finish},value:t+f.value});l.finish>n.finish&&g.push({start:n.finish,finish:l.finish});h=true;break}else if(l.start<=n.start&&l.finish<=n.finish){c.splice(o,
1);l.start<n.start&&g.push({start:l.start,finish:n.start});c.splice(o++,0,{key:{start:n.start,finish:l.finish},value:t+f.value});l.finish<n.finish&&c.splice(o++,0,{key:{start:l.finish,finish:n.finish},value:t});h=true;break}}h||c.push({key:l,value:f.value})}}}return c},Da=function(a){var d=a.content;return a.parent==null?d:d+" ("+Da(a.parent)+")"},Xa=function(a,d){return a==d?true:a.parent==null?false:Xa(a.parent,d)},Wa=function(a){return a.replace(/^\s*/,"").replace(/\s*$/,"")},aa=function(a,d){for(var c=
0;c<a.length;c++)if(a[c].key==d)return c;return-1},uc=function(a){return typeof a!=="undefined"?new Date(a.valueOf()+a.getTimezoneOffset()*6E4):a},vc=function(a){return typeof a!=="undefined"?new Date(a.valueOf()-a.getTimezoneOffset()*6E4):a},wc=function(a,d,c){var b;for(b=0;b<d.length;b++)d[b].ganttChartView=a;for(b=0;b<d.length;b++){var e=d[b];if(typeof e.parts!=="undefined"){if(typeof e.isGroup==="undefined"){e.isGroup=true;e.isSummaryEnabled=false}W(e.parts,c);if(e.isGroup||typeof e.isBarVisible===
"undefined")e.isBarVisible=false;for(var f=0;f<e.parts.length;f++){var g=e.parts[f];g.ganttChartView=e.ganttChartView;g.ganttChartItem=e;g.isPart=true;g.isVirtuallyVisible=true;if(e.isGroup||typeof g.indentation==="undefined")g.indentation=0;if(e.isGroup||typeof g.displayRowIndex==="undefined")g.displayRowIndex=-1;g.isInternallyHidden=true;d.indexOf(g)>=0||d.splice(d.length,0,g)}}}a.items=d;a.settings=c;a.refresh=function(){S(a)};a.refreshItems=function(){Qa(d)};a.refreshGridItems=function(){for(var a=
0;a<d.length;a++)Oa(d[a])};a.refreshChartItems=function(){for(var a=0;a<d.length;a++)qa(d[a])};a.refreshGridItem=Oa;a.refreshChartItem=qa;a.refreshItem=pa;a.refreshPredecessorItems=ta;a.refreshItemGraph=Pa;a.refreshItemPath=Z;a.refreshItemNeighbourhood=function(b){Ra(b,d,a,c)};a.refreshCurrentTimeLine=function(){var b=a.chartHeader,e=a.chartContent,f=e.chartArea,n,g=[];for(n=f.childNodes.length;n-- >1;){var w=f.childNodes[n];w.tag!="Scale-Highlighting-CurrentTime"&&w.tag!="Scale-Separator-CurrentTime"&&
g.push(w);f.removeChild(w)}ib(b,f,c.scales,c,true);for(n=g.length;n-- >0;)f.appendChild(g[n]);va(e,wa(d,c))};a.setCurrentTime=function(b){c.currentTime=b;a.refreshCurrentTimeLine()};a.updateCurrentTime=function(){var b=new Date,b=new Date(b.valueOf()-b.getTimezoneOffset()*6E4);a.setCurrentTime(b)};a.getCurrentItem=function(){return a.currentItem};a.getSelectedItem=function(){return a.selectedItem};a.getSelectedItems=function(){return a.selectedItems};a.selectItem=function(a){v(a,true,c.selectionMode)};
a.unselectItem=function(a){v(a,false,c.selectionMode)};a.expandItem=function(a){ia(a,true,true)};a.collapseItem=function(a){ia(a,false,true)};a.scrollToItem=fc;a.scrollToBottom=function(){a.chartContentContainer.scrollTop=a.chartContent.clientHeight};a.scrollToDateTime=function(b){a.isDuringScrollToDateTime=true;a.chartContentContainer.scrollLeft=H(b,a.settings)};a.increaseTimelinePage=function(b){c.timelineStart=new Date(c.timelineStart.valueOf()+b);c.timelineFinish=new Date(c.timelineFinish.valueOf()+
b);S(a)};a.decreaseTimelinePage=function(b){c.timelineStart=new Date(c.timelineStart.valueOf()-b);c.timelineFinish=new Date(c.timelineFinish.valueOf()-b);S(a)};a.setSplitterPosition=function(b){var d=a.gridContainer,e=a.chartContainer,f=a.splitter,b=Math.floor(b*1E6/a.offsetWidth)/1E4;typeof d.percent!=="undefined"&&delete d.percent;d.style.width=b+"%";e.style.width=100-b+"%";Ea(f,d,c)};a.getChartPosition=function(a){return H(a,c)};a.getChartWidth=function(){return H(c.timelineFinish,c)};a.getDateTime=
function(a){return Fa(a,c)};a.getWorkingTime=function(a){return bc(a,c)};a.getStartWorkingTime=function(a){return ua(a,c)};a.getFinishWorkingTime=function(a){return M(a,c,false,true,void 0)};a.getEffort=function(a,b){return L(a,b,c)};a.getFinish=function(a,b){return R(a,b,c)};a.getStart=function(a,b){return Ta(a,b,c)};a.getCompletion=function(a,b,d){return db(a,b,d,c)};a.getCompletedFinish=function(a,b,d){return cc(a,b,d,c)};a.getItemsHeight=function(){return wa(d,c)};a.getItemTop=function(a){return Ba(a,
d,c)};a.onItemPropertyChanged=y;a.initializeTaskDraggingThumbs=function(b,c,d,e,f,g,u,j){qb(b,c,d,e,f,g,u,j,a.items,a,a.settings)};a.initializeDependencyDraggingThumbs=function(b,c,d,e,f,g,u){cb(b,c,d,e,f,g,u,a.items,a,a.settings)};a.insertItem=function(b,e){Yb(b,e,a,d,c)};a.addItem=function(b){a.insertItem(d.length,b)};a.insertItems=function(b,c){for(var d=0;d<c.length;d++)a.insertItem(b++,c[d])};a.addItems=function(b){for(var c=0;c<b.length;c++)a.addItem(b[c])};a.removeItem=function(b){var e=b.index,
f=null,n=false;if(e>0){for(f=d[e-1];f.parent!=null;)f=f.parent;n=f.isExpanded;b.hasChildren&&ia(f,b.isExpanded,false,true);f.indentation>=b.indentation&&(f=null)}else d[0].isExpanded||ia(d[0],true,false,true);var g=e+1<d.length?d[e+1]:null;g!=null&&(!g.isExpanded&&g.indentation>b.indentation)&&ia(g,true,false,true);var w=g!=null?g.indentation:null,u,j,q;for(j=0;j<a.items.length;j++){u=a.items[j];if(u.predecessors!=null)for(q=u.predecessors.length;q-- >0;)if(u.predecessors[q].item==b){u.predecessors.splice(q,
1);y(u,"predecessors",false,true);pa(u);ta(u)}}var k=b.itemTop;d.splice(e,1);oa(d,a);da(d,c,a);c.isGridVisible&&typeof b.displayRowIndex==="undefined"&&typeof b.gridItemContainer!=="undefined"&&a.gridContent.removeChild(b.gridItemContainer);j=a.chartContent.chartArea;typeof b.chartItem!=="undefined"&&j.removeChild(b.chartItem);g=e<d.length?d[e]:null;if(g!=null&&g.indentation<w){y(g,"indentation",false,true);g.predecessors=[];y(g,"predecessors",false,true);for(j=0;j<d.length;j++){u=d[j];if(!(u==g||
typeof u.predecessors==="undefined"||u.predecessors.length==0))for(q=0;q<u.predecessors.length;q++)if(u.predecessors[q].item==g){u.predecessors.splice(q--,1);y(u,"predecessors",false,true);pa(u);ta(u)}}}f!=null&&ia(f,n,false,true);for(j=e;j<d.length;j++){b=d[j];actualItemTop=k;typeof b.displayRowIndex!=="undefined"&&(actualItemTop=b.displayRowIndex*c.itemHeight);b.isVisible&&!(typeof b.isHidden!=="undefined"&&b.isHidden)&&(k=Math.max(k,actualItemTop+c.itemHeight));b.itemTop=actualItemTop;pa(b)}va(a.chartContent,
wa(d,c));Na(d,a.chartContent,c);bb(d,c)&&Qa(d);e>=d.length&&(e=d.length-1);if(e>=0){for(j=0;j<e;j++)qa(d[j]);Ra(d[e],d,a,c)}xa(d,a.chartContentContainer,c)};a.removeItems=function(b){for(var c=0;c<b.length;c++)a.removeItem(b[c])};a.increaseItemIndentation=function(b){var e=b.index>0?a.items[b.index-1]:null;if(!(e==null||b.indentation>e.indentation)){ia(b,true,false,true);b.indentation++;y(b,"indentation",true,true);if(b.predecessors&&b.predecessors.length>0){for(var f=false,n=0;n<b.predecessors.length;n++)if(b.predecessors[n].item==
e&&b.indentation>e.indentation){b.predecessors.splice(n--,1);f=true}f&&y(b,"predecessors",false,true)}for(f=0;f<d.length;f++){n=d[f];if(!(n!=e||typeof n.predecessors==="undefined"||n.predecessors.length==0))for(var g=0;g<n.predecessors.length;g++)if(n.predecessors[g].item==b&&e.indentation>n.predecessors[g].item.indentation){n.predecessors.splice(g--,1);y(n,"predecessors",false,true);pa(n);ta(n)}}bb(d,c)&&Qa(d);for(Ra(b,d,a,c);b!=null;){b.isExpanded||ia(b,true,false);b=b.parent}}};a.decreaseItemIndentation=
function(b){var e=b.index<a.items.length-1?a.items[b.index+1]:null;if(!(b.indentation<=0||e!=null&&b.indentation<e.indentation)){b.indentation--;y(b,"indentation",true,true);if(e&&b.predecessors&&b.predecessors.length>0){for(var f=false,n=0;n<b.predecessors.length;n++)if(b.predecessors[n].item==e&&b.indentation==e.indentation){b.predecessors.splice(n--,1);f=true}f&&y(b,"predecessors",false,true)}for(f=0;f<d.length;f++){n=d[f];if(!(n!=e||typeof n.predecessors==="undefined"||n.predecessors.length==
0))for(var g=0;g<n.predecessors.length;g++)if(n.predecessors[g].item==b&&e.indentation==n.predecessors[g].item.indentation){n.predecessors.splice(g--,1);y(n,"predecessors",false,true);pa(n);ta(n)}}bb(d,c)&&Qa(d);for(Ra(b,d,a,c);b!=null;){b.isExpanded||ia(b,true,false);b=b.parent}}};a.setItemContent=function(a,b){a.content=b;y(a,"content",true,true)};a.setItemStart=function(a,b){a.start=ua(b,c,E(a));a.preferredStart=a.start;y(a,"start",true,true);if(a.completedFinish<a.start){a.completedFinish=a.start;
y(a,"completedFinish",false,true)}};a.setItemFinish=function(a,b){var d;d=E(a);d=M(b,c,false,true,d);a.finish=d;y(a,"finish",true,true);if(a.completedFinish>a.finish){a.completedFinish=a.finish;y(a,"completedFinish",false,true)}};a.setItemIsMilestone=function(a,b){a.isMilestone=b;y(a,"isMilestone",true,true)};a.getItemEffort=function(a){return ea(a,c)};a.setItemEffort=function(a,b){a.finish=R(a.start,b,c,E(a));y(a,"finish",true,true);if(a.completedFinish>a.finish){a.completedFinish=a.finish;y(a,"completedFinish",
false,true)}};a.getItemTotalEffort=function(a){return tb(a)};a.setItemTotalEffort=function(a,b){a.ganttChartView.setItemEffort(a,b/Ua(a))};a.setItemHasFixedEffort=function(a,b){a.hasFixedEffort=b;if(!a.hasChildren&&a.hasFixedEffort){a.fixedEffort=ea(a,c);a.fixedEffortAssignments=ha(a)}};a.getItemDuration=function(a){return L(a.start,a.finish,c,E(a))};a.setItemDuration=a.setItemEffort;a.getItemCompletedEffort=function(a){return Aa(a,c)};a.setItemCompletedEffort=function(a,b){a.completedFinish=R(a.start,
b,c,E(a));if(a.completedFinish>a.finish)a.completedFinish=a.finish;y(a,"completedFinish",true,true)};a.getItemTotalCompletedEffort=function(a){return ub(a)};a.setItemTotalCompletedEffort=function(a,b){a.ganttChartView.setItemCompletedEffort(a,b/Ua(a))};a.getItemCompletion=function(b){return a.getItemCompletedEffort(b)/a.getItemEffort(b)};a.setItemCompletion=function(b,c){a.setItemCompletedEffort(b,c*a.getItemEffort(b))};a.isItemCompleted=function(b){return a.getItemCompletion(b)>=1||(b.isMilestone||
b.finish.valueOf()<=b.start.valueOf())&&typeof b.isSetAsCompleted!=="undefined"&&b.isSetAsCompleted};a.setItemAsCompleted=function(b){if(b.isMilestone||b.finish.valueOf()<=b.start.valueOf())b.isSetAsCompleted=true;a.setItemCompletion(b,1)};a.hasItemStarted=function(a){return Ia(a)};a.setItemAsNotStarted=function(b){if(b.isMilestone||b.finish.valueOf()<=b.start.valueOf())b.isSetAsCompleted=false;a.setItemCompletion(b,0)};a.isItemOnSchedule=function(a){var b=new Date,b=new Date(b.valueOf()-b.getTimezoneOffset()*
6E4);return a.completedFinish>=b};a.setItemAssignmentsContent=function(a,b){a.assignmentsContent=b;y(a,"assignmentsContent",true,true)};a.getItemPredecessorsString=function(a,b){var c=b;typeof c==="undefined"&&(c=false);var e="";if(!(typeof a.predecessors==="undefined"||a.predecessors.length==0))for(var f=0;f<a.predecessors.length;f++){var g=a.predecessors[f],j=d.indexOf(g.item);if(!(j<0)){e.length>0&&(e=e+", ");e=e+(j+(!c?1:0));if(typeof g.dependencyType!=="undefined"&&g.dependencyType!=""&&g.dependencyType!=
"FinishStart"&&g.dependencyType!="FS")if(g.dependencyType=="StartStart"||g.dependencyType=="SS")e=e+"SS";else if(g.dependencyType=="FinishFinish"||g.dependencyType=="FF")e=e+"FF";else if(g.dependencyType=="StartFinish"||g.dependencyType=="SF")e=e+"SF";if(typeof g.lag!=="undefined"&&g.lag!=0){g.lag>0&&(e=e+"+");e=e+g.lag/36E5}}}return e};a.setItemPredecessorsString=function(a,b,c){typeof c==="undefined"&&(c=false);var e=[];a.predecessors=e;for(var b=b.split(","),f=0;f<b.length;f++){var g=Wa(b[f]);
if(!(g.length<=0)){for(var j=0;j<g.length&&g.charCodeAt(j)>=48&&g.charCodeAt(j)<=57;)j++;var k=g.substr(0,j),k=parseInt(k)-(!c?1:0);if(!isNaN(k)&&!(k<0||k>=d.length)){k=d[k];if(!nb(a,k)&&!Ga(a,k)&&!Ga(k,a)){var g=g.substr(j),j=g.indexOf("+"),q=g.indexOf("-"),m=j>=0?j:q>=0?q:-1,q=0;if(m>=0){var p=parseFloat(g.substr(m+1));isNaN(p)||(q=p*(j>=0?1:-1)*36E5)}g=(m<0?g:g.substr(0,m)).toUpperCase();e.push({item:k,dependencyType:g,lag:q})}}}}for(c=0;c<d.length;c++)delete d[c].successors;y(a,"predecessors",
true,true)};a.getItemIndexString=function(a,b){typeof b==="undefined"&&(b=false);return typeof a.index!=="undefined"?(a.index+(!b?1:0)).toString():""};a.getItemWbsIndexString=function(a,b){return rc(a,d,b).toString()};a.moveRange=function(b,c,e){fb(b,c,e,a,d)};a.moveItem=function(b,c){vb(b,c,a,d)};a.moveItemUp=function(b){var c=d.indexOf(b);c<=0||vb(b,c-1,a,d)};a.moveItemDown=function(b){var c=d.indexOf(b);c<0||c>=d.length-1||vb(b,c+1,a,d)};a.moveItemHierarchy=function(b,c){for(var e=d.indexOf(b),
f=e+1;f<d.length;f++)if(d[f].indentation<=b.indentation)break;fb(e,f-e,c,a,d)};a.moveItemHierarchyUp=function(b){for(var c=d.indexOf(b),e=c+1;e<d.length;e++)if(d[e].indentation<=b.indentation)break;for(var f=c;f-- >0;){if(d[f].indentation<b.indentation)return;if(d[f].indentation==b.indentation)break}fb(c,e-c,f,a,d)};a.moveItemHierarchyDown=function(b){for(var c=d.indexOf(b),e=c+1;e<d.length;e++)if(d[e].indentation<=b.indentation)break;for(var e=e-c,f=c+e;f++<d.length-1;)if(d[f].indentation<=b.indentation)break;
d[f-1].indentation<b.indentation||fb(c,e,f-e,a,d)};a.exportContent=function(a,b){typeof a==="undefined"&&(a={});hc(a.title,a.preparingMessage,a.isGridVisible,a.columnIndexes,a.timelineStart,a.timelineFinish,a.isRelativeToTimezone,a.hourWidth,a.startRowIndex,a.endRowIndex,b,false,a.rotate,false,d,c)};a.print=function(a){typeof a==="undefined"&&(a={});hc(a.title,a.preparingMessage,a.isGridVisible,a.columnIndexes,a.timelineStart,a.timelineFinish,a.isRelativeToTimezone,a.hourWidth,a.startRowIndex,a.endRowIndex,
null,true,a.rotate,a.autoClose,d,c)};a.getRootItems=function(){for(var a=[],b=0;b<d.length;b++){var c=d[b];c.parent==null&&a.push(c)}return a};a.getLeafItems=function(){for(var a=[],b=0;b<d.length;b++){var c=d[b];c.parent!=null&&a.push(c)}return a};a.getSummaryItems=function(){for(var a=[],b=0;b<d.length;b++){var c=d[b];c.hasChildren&&a.push(c)}return a};a.getProjectStart=function(){return ic(d)};a.getProjectFinish=function(){return jc(d)};a.getProjectEffort=function(){return kc(d,c)};a.getProjectTotalEffort=
function(){for(var a=0,b=0;b<d.length;b++){var c=d[b];c.parent==null&&(a=a+tb(c))}return a};a.getProjectCompletedEffort=function(){return lc(d,c)};a.getProjectTotalCompletedEffort=function(){for(var a=0,b=0;b<d.length;b++){var c=d[b];c.parent==null&&(a=a+ub(c))}return a};a.getProjectCompletion=function(){return lc(d,c)/kc(d,c)};a.isItemCritical=function(a,b){return gb(a,b,d,c)};a.getCriticalItems=function(a){typeof a==="undefined"&&(a=0);if(typeof d==="undefined")a=void 0;else{for(var b=[],e=0;e<
d.length;e++){var f=d[e];(!f.hasChildren||!(typeof f.isSummaryEnabled==="undefined"||f.isSummaryEnabled))&&gb(f,a,d,c)&&b.push(f)}a=b}return a};a.ensureDependencyConstraints=function(){xb(d,c,a)};a.setupBaseline=function(){for(var a=0;a<d.length;a++){var b=d[a];if(!b.hasChildren||!(typeof b.isSummaryEnabled==="undefined"||b.isSummaryEnabled)){b.baselineStart=b.start;b.isMilestone?delete b.baselineFinish:b.baselineFinish=b.finish}else{delete b.baselineFinish;delete b.baselineStart}pa(b)}};a.rescheduleItemToStart=
function(a,b){nc(a,b,d,c)};a.rescheduleItemToFinish=function(a,b){var d=b,d=new Date(d.valueOf()-d.getTimezoneOffset()*6E4),e=ea(a,c),f=Aa(a,c),d=Ta(e,d,c,E(a)),d=ua(d,c,E(a));yb(a,d);Ya(a,e,c);Za(a,f,c);Z(a)};a.splitRemainingWork=function(b,e,f){if(typeof d==="undefined"||b.hasChildren||b.isMilestone||!Ia(b)||!b.isMilestone&&b.completedFinish>=b.finish)b=null;else{var g=d.indexOf(b);if(g<0)b=null;else{e={content:typeof e==="undefined"?b.content:b.content+e,indentation:b.indentation,isExpanded:b.isExpanded,
start:b.completedFinish,finish:b.finish,assignmentsContent:b.assignmentsContent,isReadOnly:b.isReadOnly,isHidden:b.isHidden,isBarVisible:b.isBarVisible,isBarReadOnly:b.isBarReadOnly,isSummaryEnabled:b.isSummaryEnabled,isParentSummarizationEnabled:b.isParentSummarizationEnabled,displayRowIndex:b.displayRowIndex,"class":b["class"],style:b.style,barClass:b.barClass,standardBarClass:b.standardBarClass,summaryBarClass:b.summaryBarClass,milestoneBarClass:b.milestoneBarClass,baselineBarClass:b.baselineBarClass,
barStyle:b.barStyle,standardBarStyle:b.standardBarStyle,summaryBarStyle:b.summaryBarStyle,milestoneBarStyle:b.milestoneBarStyle,baselineBarStyle:b.baselineBarStyle,taskTemplate:b.taskTemplate,template:b.template,tag:b.tag};if(typeof f!=="undefined")b.content=b.content+f;b.finish=b.completedFinish;Yb(g+1,e,a,d,c);f=wb(b,d);for(g=0;g<f.length;g++){var t=f[g].predecessor;if(typeof t.dependencyType==="undefined"||t.dependencyType==""||t.dependencyType=="FinishStart"||t.dependencyType=="FS"||t.dependencyType==
"FinishFinish"||t.dependencyType=="FF")t.item=e}e.predecessors=[{item:b}];ta(b);ta(e);b=e}}return b};a.optimizeWork=function(b,e,f){var g=f;typeof b==="undefined"&&(b=false);typeof e==="undefined"&&(e=false);typeof g==="undefined"&&(g=new Date);for(var g=new Date(g.valueOf()+g.getTimezoneOffset()*6E4),t=[],f=0;f<d.length;f++){var j=d[f];if(!j.hasChildren||!(typeof j.isSummaryEnabled==="undefined"||j.isSummaryEnabled))if(!(j.start<=g||!e&&Ia(j))){if(b){for(var k=false,m=j;m!=null;){if(typeof m.predecessors!==
"undefined"&&m.predecessors.length>0){k=true;break}m=m.parent}if(!k)continue}nc(j,g,d,c);t.push(j)}}xb(d,c,a);for(f=0;f<t.length;f++){b=t[f];y(b,"start",true,true);y(b,"finish",true,true);y(b,"completedFinish",true,true);Z(b)}};a.levelAllocations=function(b){if(!b)b=a.items;b.length||(b=[b]);for(var c=0;c<b.length;c++){var d=b[c],e,f="",g=ha(d);if(g&&g.length>0){var j=0;for(e=0;e<g.length;e++)j=j+g[e].value;if(j>0){for(e=0;e<g.length;e++){f.length>0&&(f=f+", ");f=f+(g[e].key+(g.length>1?" ["+Math.round(g[e].value/
j*1E4)/100+"%]":""))}d.assignmentsContent=f;y(d,"assignmentsContent",false,true);Z(d)}}}};a.levelResources=function(b,e){var f;var g=b,j=e;if(typeof d==="undefined")f=void 0;else{typeof g==="undefined"&&(g=false);typeof j==="undefined"&&(j=new Date);xb(d,c,a);var k=[],u=[],m,q,p,s=[];for(q=0;q<d.length;q++){m=d[q];if(!m.hasChildren||!(typeof m.isSummaryEnabled==="undefined"||m.isSummaryEnabled)){k.push({key:m,value:Tc(m)});var v=ha(m),x=[];for(p=0;p<v.length;p++){var r=v[p];r.value>0&&x.push(r)}u.push({key:m,
value:x});s.push(m)}}v=[];for(x=k.length;x>0;){r=[];for(q=0;q<k.length;q++){m=k[q].key;p=true;for(var B=k[q].value,A=0;A<B.length;A++){var z=B[A];if(aa(k,z)>=0&&r.indexOf(z)<0){p=false;break}}if(p){A=m;p=j;B=c;if(typeof A.minStart!=="undefined"&&p<A.minStart)p=A.minStart;if(g||!Ia(A))for(;A!=null;){if(typeof A.predecessors!=="undefined")for(z=0;z<A.predecessors.length;z++){var C=A.predecessors[z];if(typeof C!=="undefined"){var F=C.dependencyType;typeof F==="undefined"&&(F="FinishStart");switch(F){case "":case "FinishStart":case "FS":C=
R(C.item.finish,typeof C.lag==="undefined"?0:C.lag,B,E(C.item));C>p&&(p=C);break;case "StartStart":case "SS":C=R(C.item.start,typeof C.lag==="undefined"?0:C.lag,B,E(C.item));C>p&&(p=C)}}}for(A=A.parent;A!=null&&typeof A.isSummaryEnabled!=="undefined"&&!A.isSummaryEnabled;)A=A.parent}B=p;p=aa(u,m);var A=u[p].value,H;for(p=0;p<A.length;p++){H=A[p].key;z=A[p].value;F=aa(v,H);if(F>=0){C=1;if(typeof c.resourceQuantities!=="undefined"){var G=aa(c.resourceQuantities,H);if(G>=0)C=c.resourceQuantities[G].value}previousAllocations=
v[F].value;for(F=0;F<previousAllocations.length;F++){H=previousAllocations[F].key;if(!(H+z<=C)){G=previousAllocations[F].value;G>B&&(B=G)}}}}if((g||!Ia(m))&&(B=ua(B,c,E(m)))!=m.start){p=ea(m,c);z=Aa(m,c);yb(m,B);Ya(m,p,c);Za(m,z,c)}C=m.finish;for(p=0;p<A.length;p++){H=A[p].key;z=A[p].value;F=aa(v,H);if(F<0){G=[];v.push({key:H,value:G})}else G=v[F].value;for(var I=[{key:z,value:C}],ja,L,M,F=0;F<G.length;F++){H=G[F].key;var K=G[F].value;if(K>B){L=H+z;M=K<C?K:C;ja=aa(I,L);if(ja<0)I.push({key:L,value:M});
else if(M>I[L])I[ja].value=M;K<C?I.push({key:H+z,value:K}):I.push({key:H+z,value:C})}}for(z=0;z<I.length;z++){L=I[z].key;M=I[z].value;ja=aa(G,L);if(ja<0)G.push({key:L,value:M});else if(M>G[ja].value)G[ja].value=M}}r.push(m)}}for(q=0;q<r.length;q++)k.splice(k.indexOf(r[q]),1);if(k.length==x)break;x=k.length}for(q=0;q<s.length;q++){m=s[q];y(m,"start",true,true);y(m,"finish",true,true);y(m,"completedFinish",true,true);Z(m)}}return f};a.getItemSuccessors=function(a){return mc(a,d)};a.getItemSuccessorPredecessorItems=
function(a){return wb(a,d)};a.getItemAllocationUnits=Ua;a.getItemAssignments=ha;a.getItemAssignedResources=sc;a.getResourceAssignments=function(a){return Ja(a,d)};a.getResourceAssignedItems=function(a){for(var b=[],a=Ja(a,d),c=0;c<a.length;c++)b.push(a[c].key);return b};a.getAssignedResources=function(){return Ka(d)};a.getItemAssignmentsCost=function(a){return oc(a,c)};a.getItemExtraCost=function(a){return Ab(a,c)};a.getItemCost=function(a){return zb(a,c)};a.setItemCost=function(a,b){a.executionCost=
b-Ab(a,c);y(a,"executionCost",true,true)};a.getResourceCost=function(a){for(var b=0,a=Ja(a,d),e=0;e<a.length;e++){var f=a[e],g;typeof c.specificResourceUsageCosts!=="undefined"&&(g=aa(c.specificResourceUsageCosts,resource))>=0?b=b+c.specificResourceUsageCosts[g].value*f.value:typeof c.defaultResourceUsageCost!=="undefined"&&(b=b+c.defaultResourceUsageCost*f.value);var j=f.key;if(!j.hasChildren||!(typeof j.isSummaryEnabled==="undefined"||j.isSummaryEnabled)){j=ea(j,c)/36E5;typeof c.specificResourceHourCosts!==
"undefined"&&(g=aa(c.specificResourceHourCosts,resource))>=0?b=b+c.specificResourceHourCosts[g].value*j*f.value:typeof c.defaultResourceHourCost!=="undefined"&&(b=b+c.defaultResourceHourCost*j*f.value)}}return b};a.getProjectCost=function(){for(var a=0,b=0;b<d.length;b++){var e=d[b];e.parent==null&&(a=a+zb(e,c))}return a};a.getScheduleChartItems=function(a){var b=[],a=typeof a!=="undefined"?typeof a==="array"?a:[a]:typeof c.assignableResources!=="undefined"?c.assignableResources:[],e,f=Ka(d),g;for(g=
0;g<f.length;g++){e=f[g];a.indexOf(e)<0&&a.push(e)}for(g=0;g<a.length;g++){e=a[g];f={tag:e,content:e,ganttChartItems:[]};e=Ja(e,d);for(var j=0;j<e.length;j++){var k=e[j],m=k.key,k={tag:m,content:m.content,start:m.start,finish:m.finish,completedFinish:m.completedFinish,isMilestone:m.isMilestone,schedule:E(m),assignmentsContent:k.value!=1?Math.round(k.value*1E4)/100+"%":"",minStart:m.minStart,maxStart:m.maxStart,minFinish:m.minFinish,maxFinish:m.maxFinish,isHidden:m.isHidden,isBarVisible:m.isBarVisible,
isBarReadOnly:m.isBarReadOnly,isReadOnly:m.isReadOnly,isRelativeToTimezone:m.isRelativeToTimezone};f.ganttChartItems.push(k)}b.push(f)}return b};a.getAllocations=function(a){return tc(a,d)};a.getLoadChartItems=function(a){var b=[];typeof a==="undefined"?a=Ka(d):typeof a!=="array"&&(a=[a]);for(var e=0;e<a.length;e++){for(var f=a[e],g={tag:f,content:f,ganttChartItems:[]},j=tc(f,d),k=0;k<j.length;k++){var m=j[k],q=1;if(typeof c.resourceQuantities!=="undefined"){var p=aa(c.resourceQuantities,f);if(p>=
0)q=c.resourceQuantities[p].value}p=c.maxLoadChartDisplayedResourceQuantity;typeof p==="undefined"&&(p=100);q>p&&(q=p);g.ganttChartItems.push({start:m.key.start,finish:m.key.finish,units:m.value/q,content:Math.round(m.value*1E4)/100+"%",isRelativeToTimezone:false})}b.push(g)}return b};a.getFilteredGanttChartItems=function(a){for(var a=[a],b=[],c=0;c<a.length;c++){var e=a[c],f=[];if(typeof a==="undefined")a=Ka(d);else if(typeof a!=="array")var g=Ja(e,d);for(e=0;e<g.length;e++){var j=g[e].key;if((!j.hasChildren||
!(typeof j.isSummaryEnabled==="undefined"||j.isSummaryEnabled))&&!(b.indexOf(j)>=0)){f.push({tag:j,content:j.content,start:j.start,finish:j.finish,completedFinish:j.completedFinish,isMilestone:j.isMilestone,assignmentsContent:a.length>1?j.assignmentsContent:g[e].value!=1?Math.round(g[e].value*1E4)/100+"%":"",minStart:j.minStart,maxStart:j.maxStart,minFinish:j.minFinish,maxFinish:j.maxFinish,isHidden:j.isHidden,isBarVisible:j.isBarVisible,isBarReadOnly:j.isBarReadOnly,isReadOnly:true,isRelativeToTimezone:j.isRelativeToTimezone});
b.push(j)}}}return f};a.copyCommonSettings=function(a){if(typeof a!=="undefined"){a.target=c.target;a.theme=c.theme;a.border=c.border;a.containerClass=c.containerClass;a.containerStyle=c.containerStyle;a.isGridVisible=c.isGridVisible;a.gridWidth=c.gridWidth;a.chartWidth=c.chartWidth;a.isSplitterEnabled=c.isSplitterEnabled;a.splitterWidth=c.splitterWidth;a.splitterBackground=c.splitterBackground;a.minGridWidth=c.minGridWidth;a.minChartWidth=c.minChartWidth;a.headerBackground=c.headerBackground;a.headerHeight=
c.headerHeight;a.indentationLevelWidth=c.indentationLevelWidth;a.gridLines=c.gridLines;a.horizontalGridLines=c.horizontalGridLines;a.verticalGridLines=c.verticalGridLines;a.horizontalChartLines=c.horizontalChartLines;a.displayedTime=c.displayedTime;a.currentTime=c.currentTime;a.timelineStart=c.timelineStart;a.timelineFinish=c.timelineFinish;a.scales=c.scales;a.updateScale=c.updateScale;a.hourWidth=c.hourWidth;a.workingWeekStart=c.workingWeekStart;a.workingWeekFinish=c.workingWeekFinish;a.visibleDayStart=
c.visibleDayStart;a.visibleDayFinish=c.visibleDayFinish;a.visibleWeekStart=c.visibleWeekStart;a.visibleWeekFinish=c.visibleWeekFinish;a.specialNonworkingDays=c.specialNonworkingDays;a.months=c.months;a.daysOfWeek=c.daysOfWeek;a.weekStartDay=c.weekStartDay;a.dateFormatter=c.dateFormatter;a.dateTimeFormatter=c.dateTimeFormatter;a.dateTimeParser=c.dateTimeParser;a.isRelativeToTimezone=c.isRelativeToTimezone}};a.getPertChartItems=function(a,b,e,f,g,j){var k=a,m=b,q=e,p=g,e=j;if(typeof k==="undefined"||
k<0)k=Number.MAX_VALUE;typeof m==="undefined"&&(m="Start");typeof q==="undefined"&&(q="Finish");typeof p==="undefined"&&(p=" completed");typeof e==="undefined"&&(e=" starting");for(var v=new Date((new Date(1E4,0,1)).valueOf()-1),j=[],s,x,r,B,A,g=[],a=0;a<d.length;a++){b=d[a];b.indentation<=k&&(!b.hasChildren||!(typeof b.isSummaryEnabled==="undefined"||b.isSummaryEnabled||typeof b.isBarVisible!=="undefined"&&!b.isBarVisible)||b.indentation==k)&&g.push({key:b,value:[]})}for(a=0;a<g.length;a++){var b=
g[a].key,y=[b];if(b.indentation==k&&b.hasChildren&&(typeof b.isSummaryEnabled==="undefined"||b.isSummaryEnabled||typeof b.isBarVisible!=="undefined"&&!b.isBarVisible))for(s=0;s<d.length;s++){x=d[s];Xa(x,b)&&y.push(x)}B=g[a].value;for(s=0;s<y.length;s++)for(var z=y[s];z!=null;){if(typeof z.predecessors!=="undefined")for(r=0;r<z.predecessors.length;r++)if(!(typeof z.predecessors[r].item==="undefined"||typeof z.predecessors[r].dependencyType!=="undefined"&&z.predecessors[r].dependencyType!=""&&z.predecessors[r].dependencyType!=
"FinishStart"&&z.predecessors[r].dependencyType!="FS")){for(x=A=z.predecessors[r].item;x!=null&&aa(g,x)<0;)x=x.parent;if(x!=b){var C=[];if(x!=null)C.push(x);else for(var F=0;F<g.length;F++){x=g[F].key;Xa(x,A)&&C.push(x)}for(A=0;A<C.length;A++){x=C[A];B.indexOf(x)<0&&B.push(x)}}}z=z.parent}}k=0;r=s=null;for(a=0;a<d.length;a++){b=d[a];if(s==null||b.start<s)s=b.start;if(r==null||b.finish>r)r=b.finish}s==null&&(s=v);m={content:m,displayedText:(k++).toString(),displayedRowIndex:0,displayedColumnIndex:0};
j.push(m);y=[m];v=[];for(a=0;a<g.length;a++)g[a].value.length==0&&v.push(g[a].key);if(v.length>0){y=[];for(a=0;a<v.length;a++){b=v[a];r=m;B=(k++).toString();if(b.start>s){r={content:b.content!=null?b.content.toString()+e:null,displayedText:B,predecessors:[]};j.push(r);r.predecessors.push({item:m,content:f,isEffortVirtual:true})}B={content:b.content+p,displayedText:B+(r!=m?"'":""),predecessors:[],tag:b};y.push(B);j.push(B);B.predecessors.push({item:r,content:Da(b),displayedText:b.content!=null?b.content.toString():
null,effort:L(b.start,b.finish,c,E(b)),tag:b})}do{z=[];for(a=0;a<y.length;a++)z.push(y[a]);b=false;for(a=0;a<y.length;a++){v=y[a];B=v.tag;C=[];for(s=0;s<g.length;s++)g[s].value.indexOf(B)>=0&&C.push(g[s].key);if(C.length>0){z.splice(z.indexOf(v),1);for(s=0;s<C.length;s++){b=C[s];B=null;for(r=0;r<j.length;r++)if(j[r].tag==b){B=j[r];break}if(B==null){B={content:b.content+p,displayedText:(k++).toString(),predecessors:[],tag:b};z.push(B);j.push(B)}B.predecessors.push({item:v,content:Da(b),displayedText:b.content!=
null?b.content.toString():null,effort:L(b.start,b.finish,c,E(b)),tag:b})}b=true}}y=z}while(b)}b={content:q,displayedText:(k++).toString(),predecessors:[],displayedRowIndex:0};j.push(b);b=b.predecessors;for(a=0;a<y.length;a++)b.push({item:y[a]});for(s=0;s<g.length;s++){b=g[s].key;v=null;for(r=0;r<j.length;r++)if(j[r].tag==b){v=j[r];break}if(v!=null){a=[];if(typeof v.predecessors!=="undefined")for(r=0;r<v.predecessors.length;r++)v.predecessors[r].tag==b&&a.push(v.predecessors[r]);if(a.length>1){p={content:b.content!=
null?b.content.toString()+e:null,displayedText:v.displayedText,predecessors:[]};j.splice(j.indexOf(v),0,p);k=p.predecessors;for(r=0;r<a.length;r++){q=a[r];v.predecessors.splice(v.predecessors.indexOf(q),1);k.push({item:q.item,content:f,isEffortVirtual:true})}v.predecessors.push({item:p,content:Da(b),displayedText:b.content!=null?b.content.toString():null,effort:L(b.start,b.finish,c,E(b)),tag:b});v.displayedText=v.displayedText+"'"}else if(a.length==1){q=a[0];a=q.item.tag;if(a!=null&&b.start>ua(a.finish,
c)){r={content:b.content!=null?b.content.toString()+e:null,displayedText:v.displayedText,predecessors:[]};j.splice(j.indexOf(v),0,r);r.predecessors.push({item:q.item,content:f,isEffortVirtual:true});v.predecessors.splice(0,v.predecessors.length);v.predecessors.push({item:r,content:Da(b),displayedText:b.content!=null?b.content.toString():null,effort:L(b.start,b.finish,c,E(b)),tag:b});v.displayedText=v.displayedText+"'"}}}}for(a=0;a<g.length;a++)if(g[a].key.isMilestone){b=g[a].key;v=null;for(r=0;r<
j.length;r++)if(j[r].tag==b){v=j[r];break}if(v!=null&&typeof v.predecessors!=="undefined"&&v.predecessors.length==1){q=v.predecessors[0];if(q.item!=m&&q.tag==b){v.predecessors.splice(0,1);B=q.item;for(r=0;r<B.predecessors.length;r++){f=B.predecessors[r];q.item.predecessors.splice(q.item.predecessors.indexOf(f),1);v.predecessors.push(f)}v.content=b.content!=null?b.content.toString():null;v.displayedText=v.displayedText.replace("'","");j.splice(j.indexOf(B),1)}}}return j};a.getNetworkDiagramItems=function(a,
b,e){var f=a,g=b,j=e;if(typeof f==="undefined"||f<0)f=Number.MAX_VALUE;typeof g==="undefined"&&(g="Start");typeof j==="undefined"&&(j="Finish");var e=new Date(1900,0,1),b=new Date((new Date(1E4,0,1)).valueOf()-1),a=[],k,m,q,p,v,s,x,r,B=[];for(k=0;k<d.length;k++){m=d[k];m.indentation<=f&&(!m.hasChildren||!(typeof m.isSummaryEnabled==="undefined"||m.isSummaryEnabled||typeof m.isBarVisible!=="undefined"&&!m.isBarVisible)||m.indentation==f)&&B.push({key:m,value:[]})}for(k=0;k<B.length;k++){m=B[k].key;
s=[m];if(m.indentation==f&&m.hasChildren&&(typeof m.isSummaryEnabled==="undefined"||m.isSummaryEnabled||typeof m.isBarVisible!=="undefined"&&!m.isBarVisible))for(q=0;q<d.length;q++){p=d[q];Xa(p,m)&&s.push(p)}x=B[k].value;for(q=0;q<s.length;q++)for(var y=s[q];y!=null;){if(typeof y.predecessors!=="undefined")for(v=0;v<y.predecessors.length;v++)if(!(typeof y.predecessors[v].item==="undefined"||typeof y.predecessors[v].dependencyType!=="undefined"&&y.predecessors[v].dependencyType!=""&&y.predecessors[v].dependencyType!=
"FinishStart"&&y.predecessors[v].dependencyType!="FS")){for(p=r=y.predecessors[v].item;p!=null&&aa(B,p)<0;)p=p.parent;if(p!=m){var A=[];if(p!=null)A.push(p);else for(var z=0;z<B.length;z++){p=B[z].key;Xa(p,r)&&A.push(p)}for(r=0;r<A.length;r++){p=A[r];x.indexOf(p)<0&&x.push(p)}}}y=y.parent}}r=q=null;for(k=0;k<d.length;k++){m=d[k];if(q==null||m.start<q)q=m.start;if(r==null||m.finish>r)r=m.finish}q==null&&(q=b);r==null&&(r=e);g={content:g,displayedText:g,earlyStart:q,earlyFinish:q,lateStart:b,lateFinish:b,
isMilestone:true,effort:0,displayedRowIndex:0,displayedColumnIndex:0};a.push(g);f=[g];q=[];for(k=0;k<B.length;k++)B[k].value.length==0&&q.push(B[k].key);if(q.length>0){f=[];for(k=0;k<q.length;k++){m=q[k];v={content:Da(m),displayedText:m.content,earlyStart:e,earlyFinish:e,lateStart:b,lateFinish:b,effort:L(m.start,m.finish,c,E(m)),isMilestone:m.isMilestone,predecessors:[],tag:m};f.push(v);a.push(v);v.earlyStart=ua(g.earlyFinish,c);v.earlyFinish=R(v.earlyStart,v.effort,c);v.predecessors.push({item:g,
tag:m})}do{y=[];for(k=0;k<f.length;k++)y.push(f[k]);v=false;for(k=0;k<f.length;k++){s=f[k];m=s.tag;A=[];for(q=0;q<B.length;q++)B[q].value.indexOf(m)>=0&&A.push(B[q].key);if(A.length>0){y.splice(y.indexOf(s),1);for(q=0;q<A.length;q++){m=A[q];x=null;for(v=0;v<a.length;v++)if(a[v].tag==m){x=a[v];break}if(x==null){x={content:Da(m),displayedText:m.content,earlyStart:e,earlyFinish:e,lateStart:b,lateFinish:b,effort:L(m.start,m.finish,c,E(m)),isMilestone:m.isMilestone,predecessors:[],tag:m};y.push(x);a.push(x)}v=
ua(s.earlyFinish,c);if(v>x.earlyStart){x.earlyStart=v;x.earlyFinish=R(x.earlyStart,x.effort,c)}x.predecessors.push({item:s,tag:m})}v=true}}f=y}while(v)}j={content:j,displayedText:j,earlyStart:e,earlyFinish:e,lateStart:r,lateFinish:r,isMilestone:true,effort:0,predecessors:[],displayedRowIndex:0};a.push(j);q=j.predecessors;for(k=0;k<f.length;k++){B=f[k];v=B.earlyFinish;if(v>j.earlyStart){j.earlyStart=v;j.earlyFinish=j.earlyStart}q.push({item:B})}for(f=[j];f.length>0;){B=[];for(k=0;k<f.length;k++){s=
f[k];if(typeof s.predecessors!=="undefined")for(q=0;q<s.predecessors.length;q++){r=s.predecessors[q];x=r.item;B.push(x);m=s.lateStart;if(m<x.lateFinish){x.lateFinish=x.effort>0?M(m,c,false,true,void 0):m;x.lateStart=Ta(x.effort,x.lateFinish,c)}}}f=B}if(a.length>2)for(k=0;k<a.length;k++){m=a[k];m.slack=L(m.earlyStart,m.lateStart,c)}else{g.earlyStart=e;g.earlyFinish=e;g.lateStart=e;g.lateFinish=e;j.earlyStart=b;j.earlyFinish=b;j.lateStart=b;j.lateFinish=b}for(k=0;k<a.length;k++)a[k].isRelativeToTimezone=
false;return a};a.getOutputDate=uc;a.getInputDate=vc;a.itemDependsOf=function(a,b){return Sa(a,b)}};return{initialize:fa,initializeItems:W,refresh:S,getDefaultColumns:m,getDefaultCollapsedToggleButtonTemplate:Bb,getDefaultExpandedToggleButtonTemplate:Cb,getDefaultScales:Db,getDefaultStyleDefinitionTemplate:Eb,getDefaultStandardTaskTemplate:Fb,getDefaultSummaryTaskTemplate:Gb,getDefaultMilestoneTaskTemplate:Hb,getDefaultItemTemplate:Ib,getDefaultAssignmentsTemplate:Jb,getDefaultDependencyLineTemplate:Kb,
getDefaultPredecessorItemTemplate:Lb,initializeTaskDraggingThumbs:function(a,d,c,b,e,f,g,l){e.ganttChartView.initializeTaskDraggingThumbs(a,d,c,b,e,f,g,l)},initializeDependencyDraggingThumb:function(a,d,c,b,e){c.ganttChartView.initializeDependencyDraggingThumb(a,d,c,b,e)},getWorkingTime:bc,getEffort:L,getFinish:R,getStart:Ta,getCompletion:db,getCompletedFinish:cc,getWeekStart:function(a,d){return ya(a,d)},getWeekFinish:jb,defaultDateTimeFormatter:function(a){return la(N(a))},defaultDateFormatter:function(a){return U(N(a))},
defaultDateTimeParser:function(a){return k(r(a))},textColumnTemplateBase:function(a,d,c){d=d();if(typeof d==="undefined"||typeof c!=="undefined"&&!c())d="";return a.createTextNode(d)},textInputColumnTemplateBase:function(a,d,c,b,e,f,g){var l=a.createElement("input");l.setAttribute("type","text");a=c();typeof a==="undefined"&&(a="");l.setAttribute("value",a);a="";typeof f!=="undefined"&&!f()&&(a="; display: none");f="";typeof g!=="undefined"&&g()&&(f="; font-weight: bold");l.setAttribute("style","background-color: Transparent; width: "+
d+"px; border-width: 0px; padding: 0px"+a+f);typeof e!=="undefined"&&!e()&&l.setAttribute("disabled","true");l.addEventListener("change",function(){b(l.value)},true);l.addEventListener("keypress",function(a){if(a.keyCode==13){a.preventDefault();a.stopPropagation();b(l.value)}},true);l.addEventListener("focus",function(){l.style.backgroundColor="White"},true);l.addEventListener("blur",function(){l.style.backgroundColor="Transparent"},true);return l},optionSelectColumnTemplateBase:function(a,d,c,b,
e,f,g,l){var h=a.createElement("select"),j=function(b,c){var d=a.createElement("option");d.appendChild(a.createTextNode(b));b==c&&d.setAttribute("selected",true);h.appendChild(d)},b=b();typeof b==="undefined"&&(b="");j("",b);for(var c=c(),n=0;n<c.length;n++)j(c[n],b);j="";typeof g!=="undefined"&&!g()&&(j="; display: none");g="";typeof l!=="undefined"&&l()&&(g="; font-weight: bold");h.setAttribute("style","background-color: Transparent; width: "+d+"px; border-width: 0px; padding: 0px"+j+g);typeof f!==
"undefined"&&!f()&&h.setAttribute("disabled","true");h.addEventListener("change",function(){e(h.value)},true);h.addEventListener("keypress",function(a){if(a.keyCode==13){a.preventDefault();a.stopPropagation();e(h.value)}},true);h.addEventListener("focus",function(){h.style.backgroundColor="White"},true);h.addEventListener("blur",function(){h.style.backgroundColor="Transparent"},true);return h},numberInputColumnTemplateBase:function(a,d,c,b,e,f,g){return DlhSoft.Controls.GanttChartView.textInputColumnTemplateBase(a,
d,function(){var a=c();return!isNaN(a)?a:""},function(a){a=parseFloat(a);isNaN(a)&&(a=0);b(a)},e,f,g)},percentInputColumnTemplateBase:function(a,d,c,b,e,f,g){return DlhSoft.Controls.GanttChartView.numberInputColumnTemplateBase(a,d,c,function(a){a<0&&(a=0);a>100&&(a=100);b(a)},e,f,g)},timeSpanInputColumnTemplateBase:function(a,d,c,b,e,f,g,l){typeof e==="undefined"&&(e=1);return DlhSoft.Controls.GanttChartView.numberInputColumnTemplateBase(a,d,function(){var a=c()/(36E5*e);return Math.round(a*100)/
100},function(a){a=parseFloat(a);a<0&&(a=0);b(a*36E5*e)},f,g,l)},datePickerInputColumnTemplateBase:function(a,d,c,b,e,f,g,l,h,j,n,k,m){n||(n=["Su","Mo","Tu","We","Th","Fr","Sa"]);var v=k,p=m;if(!k)k=DlhSoft.Controls.GanttChartView.defaultDateTimeFormatter;if(!m)m=DlhSoft.Controls.GanttChartView.defaultDateTimeParser;var q=a.createElement("input");q.setAttribute("type","text");c=c();typeof c==="undefined"?c="":c!=null&&(c=k(c));q.setAttribute("value",c);DlhSoft.Controls.DatePicker&&q.addEventListener("focus",
function(){var b=DlhSoft.Controls.DatePicker.get(q);if(!b||!b.isOpen){var c=0,d=0;try{c=q.selectionStart;d=q.selectionEnd}catch(e){}b=DlhSoft.Controls.DatePicker.initialize(q,void 0,{inputStyle:null,defaultTimeOfDay:l,isDropDownButtonVisible:false,popupStyle:"margin-top: 1px; background-color: White; border: 1px solid #e0e0e0",calendarSelectorLevels:h,months:j,daysOfWeek:F(n),dateTimeFormatter:v,dateTimeParser:p},"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase.");
b.openDropDown();setTimeout(function(){try{q.selectionStart=c;q.selectionEnd=d}catch(a){}},100);navigator.userAgent.match(/(Android)|(IPad)|(IPhone)/i)==null?setTimeout(function(){try{q.focus()}catch(a){}},100):a.createEvent&&setTimeout(function(){var b=a.createEvent("MouseEvents");b.initEvent("blur",true,false);q.dispatchEvent(b)})}},true);k="";typeof f!=="undefined"&&!f()&&(k="; display: none");f="";typeof g!=="undefined"&&g()&&(f="; font-weight: bold");q.setAttribute("style","background-color: Transparent; width: "+
d+"px; border-width: 0px; padding: 0px"+k+f);typeof e!=="undefined"&&!e()&&q.setAttribute("disabled","true");var s=function(){var a=q.value,a=a!=""?m(a):null;b(a)};q.addEventListener("change",function(){s()},true);q.addEventListener("keypress",function(a){if(a.keyCode==13){a.preventDefault();a.stopPropagation();s()}},true);q.addEventListener("focus",function(){q.style.backgroundColor="White"},true);q.addEventListener("blur",function(){q.style.backgroundColor="Transparent"},true);return q},dateTimePickerInputColumnTemplateBase:function(a,
d,c,b,e,f,g,l,h,j,n,k,m){n||(n=["Su","Mo","Tu","We","Th","Fr","Sa"]);var v=k,p=m;if(!k)k=DlhSoft.Controls.GanttChartView.defaultDateTimeFormatter;if(!m)m=DlhSoft.Controls.GanttChartView.defaultDateTimeParser;var q=a.createElement("input");q.setAttribute("type","text");c=c();typeof c==="undefined"?c="":c!=null&&(c=k(c));q.setAttribute("value",c);(DlhSoft.Controls.DateTimePicker||DlhSoft.Controls.DatePicker)&&q.addEventListener("focus",function(){var b=(DlhSoft.Controls.DateTimePicker?DlhSoft.Controls.DateTimePicker:
DlhSoft.Controls.DatePicker).get(q);if(!b||!b.isOpen){var c=0,d=0;try{c=q.selectionStart;d=q.selectionEnd}catch(e){}b=(DlhSoft.Controls.DateTimePicker?DlhSoft.Controls.DateTimePicker:DlhSoft.Controls.DatePicker).initialize(q,void 0,{inputStyle:null,defaultTimeOfDay:l,isDropDownButtonVisible:false,popupStyle:"margin-top: 1px; background-color: White; border: 1px solid #e0e0e0",calendarSelectorLevels:h,months:j,daysOfWeek:F(n),dateTimeFormatter:v,dateTimeParser:p},"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase.");
b.openDropDown();setTimeout(function(){try{q.selectionStart=c;q.selectionEnd=d}catch(a){}},100);navigator.userAgent.match(/(Android)|(IPad)|(IPhone)/i)==null?setTimeout(function(){try{q.focus()}catch(a){}},100):a.createEvent&&setTimeout(function(){var b=a.createEvent("MouseEvents");b.initEvent("blur",true,false);q.dispatchEvent(b)})}},true);k="";typeof f!=="undefined"&&!f()&&(k="; display: none");f="";typeof g!=="undefined"&&g()&&(f="; font-weight: bold");q.setAttribute("style","background-color: Transparent; width: "+
d+"px; border-width: 0px; padding: 0px"+k+f);typeof e!=="undefined"&&!e()&&q.setAttribute("disabled","true");var s=function(){var a=q.value,a=a!=""?m(a):null;b(a)};q.addEventListener("change",function(){s()},true);q.addEventListener("keypress",function(a){if(a.keyCode==13){a.preventDefault();a.stopPropagation();s()}},true);q.addEventListener("focus",function(){q.style.backgroundColor="White"},true);q.addEventListener("blur",function(){q.style.backgroundColor="Transparent"},true);return q},multiSelectorComboBoxInputColumnTemplateBase:function(a,
d,c,b,e,f,g,l){var h=a.createElement("input");h.setAttribute("type","text");b=b();typeof b==="undefined"&&(b="");h.setAttribute("value",b);DlhSoft.Controls.MultiSelectorComboBox&&h.addEventListener("focus",function(){var b=DlhSoft.Controls.MultiSelectorComboBox.get(h);if(!b||!b.isOpen&&b.availableChoices.length>0){var b=c(),d=0,e=0;try{d=h.selectionStart;e=h.selectionEnd}catch(f){}b=DlhSoft.Controls.MultiSelectorComboBox.initialize(h,b,void 0,{inputStyle:null,autoAppendAvailableChoices:false,isDropDownButtonVisible:false,
popupStyle:"margin-top: 1px; background-color: White; border: 1px solid #e0e0e0; color: Black; font-size: small; max-height: 188px; overflow-y: auto"},"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase.");b.openDropDown();setTimeout(function(){try{h.selectionStart=d;h.selectionEnd=e}catch(a){}},100);navigator.userAgent.match(/(Android)|(IPad)|(IPhone)/i)==null?setTimeout(function(){try{h.focus()}catch(a){}},100):
a.createEvent&&setTimeout(function(){var b=a.createEvent("MouseEvents");b.initEvent("blur",true,false);h.dispatchEvent(b)})}},true);b="";typeof g!=="undefined"&&!g()&&(b="; display: none");g="";typeof l!=="undefined"&&l()&&(g="; font-weight: bold");h.setAttribute("style","background-color: Transparent; width: "+d+"px; border-width: 0px; padding: 0px"+b+g);typeof f!=="undefined"&&!f()&&h.setAttribute("disabled","true");h.addEventListener("change",function(){e(h.value)},true);h.addEventListener("keypress",
function(a){if(a.keyCode==13){a.preventDefault();a.stopPropagation();e(h.value)}},true);h.addEventListener("focus",function(){h.style.backgroundColor="White"},true);h.addEventListener("blur",function(){h.style.backgroundColor="Transparent"},true);return h},dateTimeInputColumnTemplateBase:function(a,d,c,b,e,f,g){return DlhSoft.Controls.GanttChartView.textInputColumnTemplateBase(a,d,function(){var a=c();return a!=null?DlhSoft.Controls.GanttChartView.defaultDateTimeFormatter(a):""},function(a){a=a!=
""?DlhSoft.Controls.GanttChartView.defaultDateTimeParser(a):null;b(a)},e,f,g)},getIndexColumnTemplate:function(){return function(a){var d=a.ganttChartView;return DlhSoft.Controls.GanttChartView.textColumnTemplateBase(d.ownerDocument,function(){return d.getItemIndexString(a)})}},getWbsColumnTemplate:function(a){return function(d){var c=d.ganttChartView;return DlhSoft.Controls.GanttChartView.textColumnTemplateBase(c.ownerDocument,function(){return c.getItemWbsIndexString(d,a)})}},getEffortColumnTemplate:function(a,
d,c){typeof d==="undefined"&&(d=1);return function(b){var e=b.ganttChartView;return DlhSoft.Controls.GanttChartView.timeSpanInputColumnTemplateBase(e.ownerDocument,a,function(){return e.getItemEffort(b)},function(a){e.setItemEffort(b,a);e.refreshItemPath(b)},d,function(){return!(b.isReadOnly||c||typeof b.ganttChartView!=="undefined"&&typeof b.ganttChartView.settings!=="undefined"&&(b.ganttChartView.settings.isReadOnly||b.ganttChartView.settings.isGridReadOnly))&&!(b.hasChildren&&(typeof b.isSummaryEnabled===
"undefined"||b.isSummaryEnabled))},function(){return!(b.isMilestone||typeof b.isBarVisible!=="undefined"&&!b.isBarVisible)},function(){return b.hasChildren&&(typeof b.isSummaryEnabled==="undefined"||b.isSummaryEnabled)})}},getDurationColumnTemplate:function(a,d,c){typeof d==="undefined"&&(d=1);return function(b){var e=b.ganttChartView;return DlhSoft.Controls.GanttChartView.timeSpanInputColumnTemplateBase(e.ownerDocument,a,function(){return e.getItemDuration(b)},function(a){e.setItemDuration(b,a);
e.refreshItemPath(b)},d,function(){return!(b.isReadOnly||c||typeof b.ganttChartView!=="undefined"&&typeof b.ganttChartView.settings!=="undefined"&&(b.ganttChartView.settings.isReadOnly||b.ganttChartView.settings.isGridReadOnly))&&!(b.hasChildren&&(typeof b.isSummaryEnabled==="undefined"||b.isSummaryEnabled))},function(){return!(b.isMilestone||typeof b.isBarVisible!=="undefined"&&!b.isBarVisible)},function(){return b.hasChildren&&(typeof b.isSummaryEnabled==="undefined"||b.isSummaryEnabled)})}},getTotalEffortColumnTemplate:function(a,
d,c){typeof d==="undefined"&&(d=1);return function(b){var e=b.ganttChartView;return DlhSoft.Controls.GanttChartView.timeSpanInputColumnTemplateBase(e.ownerDocument,a,function(){return e.getItemTotalEffort(b)},function(a){e.setItemTotalEffort(b,a);e.refreshItemPath(b)},d,function(){return!(b.isReadOnly||c||typeof b.ganttChartView!=="undefined"&&typeof b.ganttChartView.settings!=="undefined"&&(b.ganttChartView.settings.isReadOnly||b.ganttChartView.settings.isGridReadOnly))&&!(b.hasChildren&&(typeof b.isSummaryEnabled===
"undefined"||b.isSummaryEnabled))},function(){return!(b.isMilestone||typeof b.isBarVisible!=="undefined"&&!b.isBarVisible)},function(){return b.hasChildren&&(typeof b.isSummaryEnabled==="undefined"||b.isSummaryEnabled)})}},getCompletedEffortColumnTemplate:function(a,d,c){typeof d==="undefined"&&(d=1);return function(b){var e=b.ganttChartView;return DlhSoft.Controls.GanttChartView.timeSpanInputColumnTemplateBase(e.ownerDocument,a,function(){return e.getItemCompletedEffort(b)},function(a){e.setItemCompletedEffort(b,
a);e.refreshItemPath(b)},d,function(){return!(b.isReadOnly||c||typeof b.ganttChartView!=="undefined"&&typeof b.ganttChartView.settings!=="undefined"&&(b.ganttChartView.settings.isReadOnly||b.ganttChartView.settings.isGridReadOnly))&&!(b.hasChildren&&(typeof b.isSummaryEnabled==="undefined"||b.isSummaryEnabled))},function(){return!(b.isMilestone||typeof b.isBarVisible!=="undefined"&&!b.isBarVisible)},function(){return b.hasChildren&&(typeof b.isSummaryEnabled==="undefined"||b.isSummaryEnabled)})}},
getTotalCompletedEffortColumnTemplate:function(a,d,c){typeof d==="undefined"&&(d=1);return function(b){var e=b.ganttChartView;return DlhSoft.Controls.GanttChartView.timeSpanInputColumnTemplateBase(e.ownerDocument,a,function(){return e.getItemTotalCompletedEffort(b)},function(a){e.setItemTotalCompletedEffort(b,a);e.refreshItemPath(b)},d,function(){return!(b.isReadOnly||c||typeof b.ganttChartView!=="undefined"&&typeof b.ganttChartView.settings!=="undefined"&&(b.ganttChartView.settings.isReadOnly||b.ganttChartView.settings.isGridReadOnly))&&
!(b.hasChildren&&(typeof b.isSummaryEnabled==="undefined"||b.isSummaryEnabled))},function(){return!(b.isMilestone||typeof b.isBarVisible!=="undefined"&&!b.isBarVisible)},function(){return b.hasChildren&&(typeof b.isSummaryEnabled==="undefined"||b.isSummaryEnabled)})}},getCompletionColumnTemplate:function(a,d){return function(c){var b=c.ganttChartView;return DlhSoft.Controls.GanttChartView.percentInputColumnTemplateBase(b.ownerDocument,a,function(){var a=b.getItemCompletion(c)*100;return Math.round(a*
100)/100},function(a){if(typeof c.gridItem!=="undefined"&&typeof c.completedInput!=="undefined"){var d=c.completedInput;typeof d.changeEventListener!=="undefined"&&d.removeEventListener("change",d.changeEventListener,true);delete c.completedInput}a=parseFloat(a)/100;b.setItemCompletion(c,a);b.refreshItemPath(c)},function(){return!(c.isReadOnly||d||typeof c.ganttChartView!=="undefined"&&typeof c.ganttChartView.settings!=="undefined"&&(c.ganttChartView.settings.isReadOnly||c.ganttChartView.settings.isGridReadOnly))&&
!(c.hasChildren&&(typeof c.isSummaryEnabled==="undefined"||c.isSummaryEnabled))},function(){return!(c.isMilestone||typeof c.isBarVisible!=="undefined"&&!c.isBarVisible)},function(){return c.hasChildren&&(typeof c.isSummaryEnabled==="undefined"||c.isSummaryEnabled)})}},getCostColumnTemplate:function(a,d){return function(c){var b=c.ganttChartView;return DlhSoft.Controls.GanttChartView.numberInputColumnTemplateBase(b.ownerDocument,a,function(){return b.getItemCost(c)},function(a){b.setItemCost(c,a);
b.refreshItemPath(c)},function(){return!(c.isReadOnly||d||typeof c.ganttChartView!=="undefined"&&typeof c.ganttChartView.settings!=="undefined"&&(c.ganttChartView.settings.isReadOnly||c.ganttChartView.settings.isGridReadOnly))},void 0,function(){return c.hasChildren&&(typeof c.isSummaryEnabled==="undefined"||c.isSummaryEnabled)})}},getPredecessorsColumnTemplate:function(a,d,c){return function(b){var e=b.ganttChartView;return DlhSoft.Controls.GanttChartView.textInputColumnTemplateBase(e.ownerDocument,
a,function(){return e.getItemPredecessorsString(b,c)},function(a){e.setItemPredecessorsString(b,a,c);e.refreshItemGraph(b)},function(){return!(b.isReadOnly||d||typeof b.ganttChartView!=="undefined"&&typeof b.ganttChartView.settings!=="undefined"&&(b.ganttChartView.settings.isReadOnly||b.ganttChartView.settings.isGridReadOnly))},function(){return!(typeof b.isBarVisible!=="undefined"&&!b.isBarVisible)},function(){return b.hasChildren&&(typeof b.isSummaryEnabled==="undefined"||b.isSummaryEnabled)})}},
getAssignmentSelectorColumnTemplate:function(a,d,c){return function(b){var e=b.ganttChartView;return DlhSoft.Controls.GanttChartView.optionSelectColumnTemplateBase(e.ownerDocument,a,function(){return typeof d==="array"?d:d(b)},function(){return b.assignmentsContent},function(a){b.assignmentsContent=a;e.onItemPropertyChanged(b,"assignmentsContent",true,true);e.refreshItem(b)},function(){return!(b.isReadOnly||c||typeof b.ganttChartView!=="undefined"&&typeof b.ganttChartView.settings!=="undefined"&&
(b.ganttChartView.settings.isReadOnly||b.ganttChartView.settings.isGridReadOnly))},function(){return!(typeof b.isBarVisible!=="undefined"&&!b.isBarVisible)},function(){return b.hasChildren&&(typeof b.isSummaryEnabled==="undefined"||b.isSummaryEnabled)})}},getBaselineStartColumnTemplate:function(a,d,c,b,e,f,g,l){typeof d==="undefined"&&(d=true);typeof c==="undefined"&&(c=true);return function(h){var j=h.ganttChartView;return(d?c?DlhSoft.Controls.GanttChartView.dateTimePickerInputColumnTemplateBase:
DlhSoft.Controls.GanttChartView.datePickerInputColumnTemplateBase:DlhSoft.Controls.GanttChartView.dateTimeInputColumnTemplateBase)(j.ownerDocument,a,function(){return h.baselineStart},function(a){a!=null?h.baselineStart=a:delete h.baselineStart;j.onItemPropertyChanged(h,"baselineStart",true,true);j.refreshItem(h)},function(){return!(h.isReadOnly||l||typeof h.ganttChartView!=="undefined"&&typeof h.ganttChartView.settings!=="undefined"&&(h.ganttChartView.settings.isReadOnly||h.ganttChartView.settings.isGridReadOnly))},
function(){return!(typeof h.isBarVisible!=="undefined"&&!h.isBarVisible)},function(){return h.hasChildren&&(typeof h.isSummaryEnabled==="undefined"||h.isSummaryEnabled)},b,e,f,g)}},getBaselineFinishColumnTemplate:function(a,d,c,b,e,f,g,l){typeof d==="undefined"&&(d=true);typeof c==="undefined"&&(c=true);return function(h){var j=h.ganttChartView;return(d?c?DlhSoft.Controls.GanttChartView.dateTimePickerInputColumnTemplateBase:DlhSoft.Controls.GanttChartView.datePickerInputColumnTemplateBase:DlhSoft.Controls.GanttChartView.dateTimeInputColumnTemplateBase)(j.ownerDocument,
a,function(){return h.baselineFinish},function(a){a!=null?h.baselineFinish=a:delete h.baselineFinish;j.onItemPropertyChanged(h,"baselineFinish",true,true);j.refreshItem(h)},function(){return!(h.isReadOnly||l||typeof h.ganttChartView!=="undefined"&&typeof h.ganttChartView.settings!=="undefined"&&(h.ganttChartView.settings.isReadOnly||h.ganttChartView.settings.isGridReadOnly))},function(){return!(h.isMilestone||typeof h.isBarVisible!=="undefined"&&!h.isBarVisible)},function(){return h.hasChildren&&
(typeof h.isSummaryEnabled==="undefined"||h.isSummaryEnabled)},b?b:864E5,e,f,g)}},getMinStartColumnTemplate:function(a,d,c,b,e,f,g,l){typeof d==="undefined"&&(d=true);typeof c==="undefined"&&(c=true);return function(h){var j=h.ganttChartView;return(d?c?DlhSoft.Controls.GanttChartView.dateTimePickerInputColumnTemplateBase:DlhSoft.Controls.GanttChartView.datePickerInputColumnTemplateBase:DlhSoft.Controls.GanttChartView.dateTimeInputColumnTemplateBase)(j.ownerDocument,a,function(){return h.minStart},
function(a){a!=null?h.minStart=a:delete h.minStart;j.onItemPropertyChanged(h,"minStart",true,true);j.refreshItem(h)},function(){return!(h.isReadOnly||l||typeof h.ganttChartView!=="undefined"&&typeof h.ganttChartView.settings!=="undefined"&&(h.ganttChartView.settings.isReadOnly||h.ganttChartView.settings.isGridReadOnly))&&!(h.hasChildren&&(typeof h.isSummaryEnabled==="undefined"||h.isSummaryEnabled))},function(){return!(typeof h.isBarVisible!=="undefined"&&!h.isBarVisible)},function(){return h.hasChildren&&
(typeof h.isSummaryEnabled==="undefined"||h.isSummaryEnabled)},b,e,f,g)}},getMaxStartColumnTemplate:function(a,d,c,b,e,f,g,l){typeof d==="undefined"&&(d=true);typeof c==="undefined"&&(c=true);return function(h){var j=h.ganttChartView;return(d?c?DlhSoft.Controls.GanttChartView.dateTimePickerInputColumnTemplateBase:DlhSoft.Controls.GanttChartView.datePickerInputColumnTemplateBase:DlhSoft.Controls.GanttChartView.dateTimeInputColumnTemplateBase)(j.ownerDocument,a,function(){return h.maxStart},function(a){a!=
null?h.maxStart=a:delete h.maxStart;j.onItemPropertyChanged(h,"maxStart",true,true);j.refreshItem(h)},function(){return!(h.isReadOnly||l||typeof h.ganttChartView!=="undefined"&&typeof h.ganttChartView.settings!=="undefined"&&(h.ganttChartView.settings.isReadOnly||h.ganttChartView.settings.isGridReadOnly))&&!(h.hasChildren&&(typeof h.isSummaryEnabled==="undefined"||h.isSummaryEnabled))},function(){return!(typeof h.isBarVisible!=="undefined"&&!h.isBarVisible)},function(){return h.hasChildren&&(typeof h.isSummaryEnabled===
"undefined"||h.isSummaryEnabled)},b?b:864E5,e,f,g)}},getMinFinishColumnTemplate:function(a,d,c,b,e,f,g,l){typeof d==="undefined"&&(d=true);typeof c==="undefined"&&(c=true);return function(h){var j=h.ganttChartView;return(d?c?DlhSoft.Controls.GanttChartView.dateTimePickerInputColumnTemplateBase:DlhSoft.Controls.GanttChartView.datePickerInputColumnTemplateBase:DlhSoft.Controls.GanttChartView.dateTimeInputColumnTemplateBase)(j.ownerDocument,a,function(){return h.minFinish},function(a){a!=null?h.minFinish=
a:delete h.minFinish;j.onItemPropertyChanged(h,"minFinish",true,true);j.refreshItem(h)},function(){return!(h.isReadOnly||l||typeof h.ganttChartView!=="undefined"&&typeof h.ganttChartView.settings!=="undefined"&&(h.ganttChartView.settings.isReadOnly||h.ganttChartView.settings.isGridReadOnly))&&!(h.hasChildren&&(typeof h.isSummaryEnabled==="undefined"||h.isSummaryEnabled))},function(){return!(h.isMilestone||typeof h.isBarVisible!=="undefined"&&!h.isBarVisible)},function(){return h.hasChildren&&(typeof h.isSummaryEnabled===
"undefined"||h.isSummaryEnabled)},b,e,f,g)}},getMaxFinishColumnTemplate:function(a,d,c,b,e,f,g,l){typeof d==="undefined"&&(d=true);typeof c==="undefined"&&(c=true);return function(h){var j=h.ganttChartView;return(d?c?DlhSoft.Controls.GanttChartView.dateTimePickerInputColumnTemplateBase:DlhSoft.Controls.GanttChartView.datePickerInputColumnTemplateBase:DlhSoft.Controls.GanttChartView.dateTimeInputColumnTemplateBase)(j.ownerDocument,a,function(){return h.maxFinish},function(a){a!=null?h.maxFinish=a:
delete h.maxFinish;j.onItemPropertyChanged(h,"maxFinish",true,true);j.refreshItem(h)},function(){return!(h.isReadOnly||l||typeof h.ganttChartView!=="undefined"&&typeof h.ganttChartView.settings!=="undefined"&&(h.ganttChartView.settings.isReadOnly||h.ganttChartView.settings.isGridReadOnly))&&!(h.hasChildren&&(typeof h.isSummaryEnabled==="undefined"||h.isSummaryEnabled))},function(){return!(h.isMilestone||typeof h.isBarVisible!=="undefined"&&!h.isBarVisible)},function(){return h.hasChildren&&(typeof h.isSummaryEnabled===
"undefined"||h.isSummaryEnabled)},b?b:864E5,e,f,g)}},getIconColumnTemplate:function(a,d,c,b,e,f,g,l,h){if(typeof a==="string")var j=a,a=function(){return j};typeof b==="undefined"||b==false?b=function(){return false}:b==true&&(b=function(){return true});return function(j){var k=j.ganttChartView,o=k.ownerDocument.createElement("img");o.setAttribute("src",a(j));typeof d!=="undefined"&&o.setAttribute("class",d);typeof c!=="undefined"&&o.setAttribute("style",c);if(!k.settings.isReadOnly&&!k.settings.isGridReadOnly&&
b(j)){o.style.cursor="move";Rc(o,j,k.items,k,k.settings,e,f,g,l,h)}return o}},getOutputDate:uc,getInputDate:vc}}());
void 0==DlhSoft.Controls.ScheduleChartView&&(DlhSoft.Controls.ScheduleChartView=function(){var O=function(k,j,m,p){var s=["DlhSoft.Controls","ScheduleChartView","DlhSoft.ProjectData.GanttChart.HTML.Controls","5","validate","Licensing"];DlhSoft[s[5]][s[4]](k,s[0],s[1],s[2],s[3],p,m);k.isScheduleChartInitializing=true;for(var p=j,j=[],v=s=0,x=0;x<p.length;x++){var B=p[x];if(!(typeof B.scheduleChartItem!=="undefined"&&B.scheduleChartItem!=B)){B.scheduleChartIndex=s++;if(!B.isHidden)B.scheduleChartVisibilityIndex=
v++;B.isBarVisible=false;j.push(B);if(typeof B.ganttChartItems!=="undefined")for(var A=0;A<B.ganttChartItems.length;A++){var z=B.ganttChartItems[A];z.scheduleChartItem=B;if(B.isHidden)z.isHidden=true;z.displayRowIndex=B.scheduleChartVisibilityIndex;z.indentation=B.indentation;j.push(z)}}}typeof m!=="object"&&(m={});DlhSoft.Controls.GanttChartView.initializeItems(j,m);s=m;v=j;X(s);if(typeof s.gridWidth==="undefined")s.gridWidth="15%";if(typeof s.chartWidth==="undefined")s.chartWidth=s.isGridVisible?
"85%":"100%";if(typeof s.columns==="undefined")s.columns=ca(v,s);if(typeof s.areTaskDependenciesVisible==="undefined")s.areTaskDependenciesVisible=false;if(typeof s.isBaselineVisible==="undefined")s.isBaselineVisible=false;if(typeof s.areAssignmentsReadOnly==="undefined")s.areAssignmentsReadOnly=false;if(typeof s.assignmentThumbStyle==="undefined")switch(s.theme){default:s.assignmentThumbStyle="fill: none; stroke: #3b87d9; stroke-width: 0.65px; stroke-dasharray: 2, 2";break;case "Aero":s.assignmentThumbStyle=
"fill: none; stroke: Blue; stroke-dasharray: 2, 2"}if(typeof s.temporaryAssignmentThumbStyle==="undefined")switch(s.theme){default:s.temporaryAssignmentThumbStyle="fill: none; stroke: #3b87d9; stroke-width: 0.65px; stroke-dasharray: 2, 2";break;case "Aero":s.temporaryAssignmentThumbStyle="fill: none; stroke: Blue; stroke-width: 0.65px; stroke-dasharray: 2, 2"}if(typeof s.assignmentThumbTemplate==="undefined")s.assignmentThumbTemplate=Q(v,k,s);s.internalExtraTaskTemplate=s.assignmentThumbTemplate;
N(k,j,p,m);DlhSoft.Controls.GanttChartView.initialize(k,j,m,"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase.");r(k,j);k.isScheduleChartInitializing=false;k.isScheduleChartInitialized=true;return k},K=function(k){O(k,k.scheduleChartItems,k.settings,k.license)},X=function(k){if(typeof k.useUpdatingToolTips==="undefined")k.useUpdatingToolTips=true;if(typeof k.target==="undefined")k.target="Standard";if(typeof k.theme===
"undefined")k.theme="Modern";if(typeof k.isGridVisible==="undefined")switch(k.target){default:k.isGridVisible=true;break;case "Phone":k.isGridVisible=false}if(typeof k.interaction==="undefined")k.interaction=k.target!="Phone"?"Standard":"TouchEnabled";if(typeof k.isReadOnly==="undefined")k.isReadOnly=false;if(typeof k.isGridReadOnly==="undefined")k.isGridReadOnly=false;if(typeof k.isContentReadOnly==="undefined")k.isContentReadOnly=false;if(typeof k.selectionMode==="undefined")k.selectionMode="Focus";
if(typeof k.isVirtualizing==="undefined")k.isVirtualizing=true;if(k.target=="Phone"&&typeof k.areTaskAssignmentsVisible==="undefined")k.areTaskAssignmentsVisible=false},ca=function(k,j){typeof j!=="object"&&(j={});X(j);var m=[{header:"",width:32,isSelection:true},{header:"Resource",width:120,isTreeView:true}];m[0].cellTemplate=na(j,m[0],k);m[1].cellTemplate=P(j,m[1],k);m[1].exportCellTemplate=P(j,m[1],k,false);j.selectionMode!="Single"&&(j.selectionMode!="Extended"&&j.selectionMode!="ExtendedFocus")&&
m.splice(0,1);return m},na=function(k,j){return function(k){return!j.isReadOnly?fa(k):getBooleanNode(k.ganttChartView.ownerDocument,k.isSelected)}},fa=function(k){var j=k.ganttChartView.ownerDocument,m;if(typeof k.selectionInput==="undefined"){m=j.createElement("input");k.selectionInput=m;m.type="checkbox";m.setAttribute("style","margin: 0px")}else m=k.selectionInput;if(k.isSelected){m.setAttribute("checked","checked");if(!m.checked)m.checked=true}else if(m.checked)m.checked=false;var p=function(){m.checked?
S(k):typeof k.scheduleChartView!=="undefined"&&k.scheduleChartView.unselectItem(k)};typeof m.changeEventListener!=="undefined"&&m.removeEventListener("change",m.changeEventListener,true);m.addEventListener("change",p,true);m.changeEventListener=p;j=function(j){if(j.keyCode==13){j.preventDefault();j.stopPropagation();p(j)}};typeof m.keyPressEventListener!=="undefined"&&m.removeEventListener("keypress",m.keyPressEventListener,true);m.addEventListener("keypress",j,true);m.keyPressEventListener=j;return m},
S=function(k){typeof k.scheduleChartView!=="undefined"&&k.scheduleChartView.selectItem(k)},$=function(k,j){if(typeof k.scheduleChartView!=null)k.scheduleChartView.currentItem=k;(j.selectionMode=="Focus"||j.selectionMode=="ExtendedFocus")&&!k.isSelected&&S(k)},P=function(k,j,m,p){var s=function(j){var k=j.content,j=j.ganttChartView.ownerDocument.createElement("span");j.innerHTML=k;return j};return(typeof p==="undefined"||p)&&!k.isReadOnly&&!k.isGridReadOnly&&!k.isContentReadOnly?function(m){return!j.isReadOnly&&
(typeof m.isReadOnly==="undefined"||!m.isReadOnly)?W(m,Math.max(0,j.width-m.indentation*m.ganttChartView.settings.indentationLevelWidth-m.ganttChartView.settings.toggleButtonAreaWidth-16),k):s(m)}:s},W=function(k,j,m){var p=k.ganttChartView.ownerDocument,s;if(typeof k.contentInput==="undefined"){s=p.createElement("input");k.contentInput=s;s.type="text";s.addEventListener("focus",function(){$(k,m)},false);var v=function(){k.content=s.value;k.scheduleChartView.onItemPropertyChanged(k,"content",true,
true);k.scheduleChartView.refreshItem(k)};typeof s.changeEventListener!=="undefined"&&s.removeEventListener("change",s.changeEventListener,true);s.addEventListener("change",v,true);s.changeEventListener=v;p=function(j){if(j.keyCode==13){j.preventDefault();j.stopPropagation();v(j)}};typeof s.keyPressEventListener!=="undefined"&&s.removeEventListener("keypress",s.keyPressEventListener,true);s.addEventListener("keypress",p,true);s.keyPressEventListener=p;s.addEventListener("focus",function(){s.style.backgroundColor=
"White"},false);s.addEventListener("blur",function(){s.style.backgroundColor="Transparent"},false)}else s=k.contentInput;s.value=k.content;p="";if(k.hasChildren&&(typeof k.isSummaryEnabled==="undefined"||k.isSummaryEnabled))p="; font-weight: bold";s.setAttribute("style","background-color: Transparent; width: "+j+"px; border-width: 0px; padding: 0px"+p);return s},Q=function(k,j,m){return function(p){var s=p.ganttChartView.ownerDocument,v=s.createElementNS("http://www.w3.org/2000/svg","g");if(!m.isReadOnly&&
!m.isChartReadOnly&&(typeof p.isReadOnly==="undefined"||!p.isReadOnly)&&!m.areAssignmentsReadOnly){var x=j.getChartPosition(p.start,m),r=Math.max(j.getChartPosition(p.finish,m),x+4),A=s.createElementNS("http://www.w3.org/2000/svg","line");A.setAttribute("x1",x);A.setAttribute("y1",m.barMargin+m.barHeight+2);A.setAttribute("x2",r-1);A.setAttribute("y2",m.barMargin+m.barHeight+2);var z=m.assignmentThumbClass;typeof z!=="undefined"&&A.setAttribute("class",z);A.setAttribute("style",m.assignmentThumbStyle);
A.style.visibility="hidden";v.appendChild(A);s=s.createElementNS("http://www.w3.org/2000/svg","rect");s.setAttribute("x",x);s.setAttribute("y",m.barMargin+m.barHeight-2);s.setAttribute("width",Math.max(0,r-x-1));s.setAttribute("height",7);s.setAttribute("style","fill: White; fill-opacity: 0; cursor: move");s.addEventListener("mouseover",function(){if(typeof j.draggingItem==="undefined")A.style.visibility="visible"},true);s.addEventListener("mouseout",function(){A.style.visibility="hidden"},true);
v.appendChild(s);G(s,v,p,x,r,k,j,m)}return v}},I=function(k){var j=k.scheduleChartView;k.itemTop=k.scheduleChartVisibilityIndex*settings.itemHeight;j.refreshGridItem(k);if(typeof k.ganttChartItems!=="undefined")for(var m=0;m<k.ganttChartItems.length;m++){var p=k.ganttChartItems[m];p.itemTop=k.itemTop;j.refreshChartItem(p)}},G=function(k,j,m,p,s,v,x,r){var A=m.ganttChartView.ownerDocument;k.addEventListener("mousedown",function(v){if(v.button==0){delete x.cancelDrag;x.draggingItem=m;x.dragType="Assignment";
x.style.cursor=k.style.cursor;x.draggingInitialY=v.clientY;x.draggingInitialThumbPosition=r.barMargin;v.preventDefault();j.itemLeft=p;j.itemRight=s;m.assignmentThumb=j;if(DlhSoft.Controls.ToolTip&&r.useUpdatingToolTips){(toolTip=DlhSoft.Controls.ToolTip.get(k))||(toolTip=DlhSoft.Controls.ToolTip.initialize(void 0,k,{duration:NaN,containerStyle:"cursor: default; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; border: 1px solid "+r.border+"; background-color: White; color: Black; font-family: Arial; font-size: 12px; padding: 4px; margin-top: 1px"},
"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase."));toolTip.setContent(m.content+" \u2013");toolTip.show();toolTip.setPosition(toolTip.x+(s-p)+4,toolTip.y-r.itemHeight-1);toolTip.originalY=toolTip.y;x.toolTip=toolTip}}},true);if(typeof x.draggableAssignmentItems==="undefined")x.draggableAssignmentItems=[];for(var z=false,G=0;G<x.draggableAssignmentItems.length;G++)if(x.draggableAssignmentItems[G]==m){z=true;break}if(!z){x.addEventListener("mousemove",
function(k){if(!(typeof x.draggingItem==="undefined"||x.draggingItem!=m||x.dragType!="Assignment")){var z=Math.ceil((k.clientY-x.draggingInitialY)/r.itemHeight)*r.itemHeight;U(k.clientY,x);delete x.draggingItem;j=m.assignmentThumb;p=j.itemLeft;s=j.itemRight;if(typeof x.temporaryAssignmentThumb!=="undefined"){try{j.removeChild(x.temporaryAssignmentThumb)}catch(G){}delete x.temporaryAssignmentThumb}if(x.cancelDrag){delete x.cancelDrag;delete x.draggingItem;x.style.cursor="default"}else{if(r.temporaryAssignmentThumbTemplate)k=
r.temporaryAssignmentThumbTemplate(x,p,x.draggingInitialThumbPosition+z,Math.max(4,s-p-1),r.barHeight);else{k=A.createElementNS("http://www.w3.org/2000/svg","rect");k.setAttribute("x",p);k.setAttribute("y",x.draggingInitialThumbPosition+z);k.setAttribute("width",Math.max(4,s-p-1));k.setAttribute("height",r.barHeight);typeof r.temporaryAssignmentThumbClass!=="undefined"&&k.setAttribute("class",r.temporaryAssignmentThumbClass);k.setAttribute("style",r.temporaryAssignmentThumbStyle)}x.temporaryAssignmentThumb=
k;j.appendChild(k);x.draggingItem=m;if(DlhSoft.Controls.ToolTip&&r.useUpdatingToolTips){toolTip=x.toolTip;var k=Math.floor((m.itemTop+x.draggingInitialThumbPosition+z)/r.itemHeight),I=null,C=0,F;for(F=0;F<v.length;F++){var K=v[F];if(K.isVisible&&!(typeof K.isHidden!=="undefined"&&K.isHidden)&&typeof K.displayRowIndex==="undefined"){if(C==k){K.hasChildren||(I=K);break}C++}}toolTip.setContent(m.content+" \u2013"+(I!=null?" "+I.content:""));toolTip.setVerticalPosition(Math.max(V(x)+x.chartHeaderContainer.clientHeight,
toolTip.originalY+z));if(typeof toolTip.originalX==="undefined")toolTip.originalX=toolTip.x;toolTip.setHorizontalPosition(toolTip.originalX)}}}},true);A.addEventListener("mouseup",function(k){if(!(k.button!=0||typeof x.draggingItem==="undefined"||x.draggingItem!=m||x.dragType!="Assignment")){j=m.assignmentThumb;if(typeof x.temporaryAssignmentThumb!=="undefined"){try{j.removeChild(x.temporaryAssignmentThumb)}catch(p){}delete x.temporaryAssignmentThumb}var k=Math.ceil((k.clientY-x.draggingInitialY)/
r.itemHeight)*r.itemHeight,k=Math.floor((m.itemTop+x.draggingInitialThumbPosition+k)/r.itemHeight),s=null,A=0,z;for(z=0;z<v.length;z++){var F=v[z];if(F.isVisible&&!(typeof F.isHidden!=="undefined"&&F.isHidden)&&typeof F.displayRowIndex==="undefined"){if(A==k){F.hasChildren||(s=F);break}A++}}if(s!=null){var A=m.scheduleChartItem,F=A.ganttChartItems,G=[];for(z=0;z<F.length;z++)F[z]!=m&&G.push(F[z]);A.ganttChartItems=G;x.onItemPropertyChanged(A,"ganttChartItems",false,true);if(typeof s.ganttChartItems===
"undefined")s.ganttChartItems=[];s.ganttChartItems.push(m);x.onItemPropertyChanged(s,"ganttChartItems",true,true);m.scheduleChartItem=s;x.onItemPropertyChanged(m,"scheduleChartItem",true,true);m.displayRowIndex=k;m.isVirtuallyVisible=true;x.refreshChartItem(m);$(s,r)}delete x.draggingItem;x.style.cursor="default"}},true);x.draggableAssignmentItems.push(m)}},V=function(k){var j=0;if(k.offsetParent){do{j=j+k.offsetTop;k=k.offsetParent}while(k)}return j},U=function(k,j){if(typeof j.draggingItem!=="undefined"){var k=
k-V(j),m,p;if(k<j.chartHeaderContainer.clientHeight+24){m=j.chartContentContainer.scrollTop;j.chartContentContainer.scrollTop=j.chartContentContainer.scrollTop-20;if(typeof j.isDuringVerticalScrolling==="undefined"){j.isDuringVerticalScrolling=true;setTimeout(function(){p=m-j.chartContentContainer.scrollTop;j.draggingInitialThumbPosition=j.draggingInitialThumbPosition-p;delete j.isDuringVerticalScrolling},0)}}else if(k>=j.chartHeaderContainer.clientHeight+j.chartContentContainer.clientHeight-24){m=
j.chartContentContainer.scrollTop;j.chartContentContainer.scrollTop=j.chartContentContainer.scrollTop+20;if(typeof j.isDuringVerticalScrolling==="undefined"){j.isDuringVerticalScrolling=true;setTimeout(function(){p=j.chartContentContainer.scrollTop-m;j.draggingInitialThumbPosition=j.draggingInitialThumbPosition+p;delete j.isDuringVerticalScrolling},0)}}}},la=function(k,j,m,p){var s=p.indexOf(k);if(!(s<0||j<0||j==s||j>=p.length)){p.splice(s,1);p.splice(j,0,k);K(m);typeof m.settings.itemMoveHandler!==
"undefined"&&m.settings.itemMoveHandler(k,s,j)}},N=function(k,j,m,p){for(var s=0;s<j.length;s++)j[s].scheduleChartView=k;k.scheduleChartItems=m;k.settings=p;k.refreshScheduleChartItem=I;k.initializeAssignmentDraggingThumb=function(j,m,p,s,r){G(j,m,p,s,r,k.items,k,k.settings)};k.insertScheduleChartItem=function(p,s){var r=p;s.scheduleChartView=k;s.isVirtuallyVisible=true;s.scheduleChartIndex=r;var A=0,z;for(z=0;z<r;z++)m[z].isHidden||A++;s.scheduleChartVisibilityIndex=A;s.isBarVisible=false;r=r<m.length?
m[r].index:j.length;m.splice(s.scheduleChartIndex,0,s);k.insertItem(r++,s);if(typeof s.ganttChartItems!=="undefined")for(z=0;z<s.ganttChartItems.length;z++){A=s.ganttChartItems[z];A.scheduleChartView=k;A.scheduleChartItem=s;A.isHidden=s.isHidden;A.displayRowIndex=s.scheduleChartVisibilityIndex;A.indentation=s.indentation;k.insertItem(r++,A)}for(z=s.scheduleChartIndex+1;z<m.length;z++){r=m[z];r.scheduleChartIndex=z;typeof r.scheduleChartVisibilityIndex!=="undefined"&&r.scheduleChartVisibilityIndex++;
if(typeof r.ganttChartItems!=="undefined")for(A=0;A<r.ganttChartItems.length;A++)r.ganttChartItems[A].displayRowIndex=r.scheduleChartVisibilityIndex;I(r)}};k.addScheduleChartItem=function(j){k.insertScheduleChartItem(m.length,j)};k.insertScheduleChartItems=function(j,m){for(var p=0;p<m.length;p++)k.insertScheduleChartItem(j++,m[p])};k.addScheduleChartItems=function(j){for(var m=0;m<j.length;m++)k.addScheduleChartItem(j[m])};k.removeScheduleChartItem=function(j){if(typeof j.ganttChartItems!=="undefined")for(var p=
0;p<j.ganttChartItems.length;p++)k.removeItem(j.ganttChartItems[p]);m.splice(j.scheduleChartIndex,1);for(p=j.scheduleChartIndex;p<m.length;p++){var s=m[p];s.scheduleChartIndex=p;typeof s.scheduleChartVisibilityIndex!=="undefined"&&s.scheduleChartVisibilityIndex--;if(typeof s.ganttChartItems!=="undefined")for(var r=0;r<s.ganttChartItems.length;r++)s.ganttChartItems[r].displayRowIndex=s.scheduleChartVisibilityIndex;I(s)}k.removeItem(j)};k.removeScheduleChartItems=function(j){for(var m=0;m<j.length;m++)k.removeScheduleChartItem(j[m])};
k.moveScheduleChartRange=function(j,p,s){if(!(j<0||s<0||s==j||s>m.length-p)){var r=[],z;for(z=j;z<j+p;z++)r.push(m[z]);m.splice(j,p);for(z=0;z<r.length;z++)m.splice(s+z,0,r[z]);K(k);if(typeof k.settings.itemMoveHandler!=="undefined")for(z=0;z<r.length;z++)k.settings.itemMoveHandler(r[z],j+z,s+z)}};k.moveScheduleChartItem=function(j,p){la(j,p,k,m)};k.moveScheduleChartItemUp=function(j){var p=m.indexOf(j);p<=0||la(j,p-1,k,m)};k.moveScheduleChartItemDown=function(j){var p=m.indexOf(j);p<0||p>=m.length-
1||la(j,p+1,k,m)}},r=function(k,j){k.items=j;k.refresh=function(){K(k)}};return{initialize:O,refresh:K,getDefaultColumns:ca,getDefaultScales:DlhSoft.Controls.GanttChartView.getDefaultScales,getDefaultStyleDefinitionTemplate:DlhSoft.Controls.GanttChartView.getDefaultStyleDefinitionTemplate,getDefaultStandardTaskTemplate:DlhSoft.Controls.GanttChartView.getDefaultStandardTaskTemplate,getDefaultMilestoneTaskTemplate:DlhSoft.Controls.GanttChartView.getDefaultMilestoneTaskTemplate,getDefaultItemTemplate:DlhSoft.Controls.GanttChartView.getDefaultItemTemplate,
getDefaultAssignmentsTemplate:DlhSoft.Controls.GanttChartView.getDefaultAssignmentsTemplate,initializeTaskDraggingThumbs:DlhSoft.Controls.GanttChartView.initializeTaskDraggingThumbs,initializeDependencyDraggingThumb:DlhSoft.Controls.GanttChartView.initializeDependencyDraggingThumb,initializeAssignmentDraggingThumb:function(k,j,m,p,s){m.scheduleChartView.initializeAssignmentDraggingThumb(k,j,m,p,s)},getWorkingTime:DlhSoft.Controls.GanttChartView.getWorkingTime,getEffort:DlhSoft.Controls.GanttChartView.getEffort,
getFinish:DlhSoft.Controls.GanttChartView.getFinish,getStart:DlhSoft.Controls.GanttChartView.getStart,getCompletion:DlhSoft.Controls.GanttChartView.getCompletion,getCompletedFinish:DlhSoft.Controls.GanttChartView.getCompletedFinish,textColumnTemplateBase:DlhSoft.Controls.GanttChartView.textColumnTemplateBase,textInputColumnTemplateBase:DlhSoft.Controls.GanttChartView.textInputColumnTemplateBase,getOutputDate:DlhSoft.Controls.GanttChartView.getOutputDate,getInputDate:DlhSoft.Controls.GanttChartView.getInputDate}}());
void 0==DlhSoft.Controls.LoadChartView&&(DlhSoft.Controls.LoadChartView=function(){var O=function(r,k,j,m){var p=["DlhSoft.Controls","LoadChartView","DlhSoft.ProjectData.GanttChart.HTML.Controls","5","validate","Licensing"];DlhSoft[p[5]][p[4]](r,p[0],p[1],p[2],p[3],m,j);r.isLoadChartInitializing=true;for(var m=k,k=[],s=p=0;s<m.length;s++){var v=m[s];if(typeof v.isExported!=="undefined"&&v.isExported)k.push(v);else if(!(typeof v.loadChartItem!=="undefined"&&v.loadChartItem!=v)){v.loadChartIndex=v.scheduleChartIndex=
p++;v.isBarVisible=false;k.push(v);if(typeof v.ganttChartItems!=="undefined")for(var x=0;x<v.ganttChartItems.length;x++){var B=v.ganttChartItems[x];B.loadChartItem=B.scheduleChartItem=v;B.displayRowIndex=v.loadChartIndex;k.push(B)}}}typeof j!=="object"&&(j={});DlhSoft.Controls.GanttChartView.initializeItems(k,j);p=j;s=k;X(p);if(typeof p.gridWidth==="undefined")p.gridWidth="15%";if(typeof p.chartWidth==="undefined")p.chartWidth=p.isGridVisible?"85%":"100%";if(typeof p.columns==="undefined")p.columns=
ca(s,p);if(typeof p.normalAllocationBarStyle==="undefined"&&p.normalAllocationBarClass==null)switch(p.theme){default:p.normalAllocationBarStyle="fill: Blue; fill-opacity: 0.8; stroke: Blue; stroke-width: 0.65px";break;case "Aero":p.normalAllocationBarStyle="fill: Blue; stroke: Blue"}if(typeof p.underAllocationBarStyle==="undefined"&&p.underAllocationBarClass==null)switch(p.theme){default:p.underAllocationBarStyle="fill: Blue; fill-opacity: 0.8; stroke: Blue; stroke-width: 0.65px";break;case "Aero":p.underAllocationBarStyle=
"fill: Blue; stroke: Blue"}if(typeof p.overAllocationBarStyle==="undefined"&&p.overAllocationBarClass==null)switch(p.theme){default:p.overAllocationBarStyle="fill: Red; fill-opacity: 0.8; stroke: Red; stroke-width: 0.65px";break;case "Aero":p.overAllocationBarStyle="fill: Red; stroke: Red"}if(typeof p.maxDisplayedUnits==="undefined")p.maxDisplayedUnits=1.5;if(typeof p.allocationTemplate==="undefined")p.allocationTemplate=I();p.standardTaskTemplate=p.allocationTemplate;p.milestoneTaskTemplate=p.allocationTemplate;
p.areTaskDependenciesVisible=false;p.isBaselineVisible=false;p.isTaskCompletedEffortVisible=false;p.areTaskAssignmentsVisible=false;la(r,k,m,j);DlhSoft.Controls.GanttChartView.initialize(r,k,j,"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase.");N(r,k,j);r.isLoadChartInitializing=false;r.isLoadChartInitialized=true;return r},K=function(r){O(r,r.loadChartItems,r.settings,r.license)},X=function(r){if(typeof r.target===
"undefined")r.target="Standard";if(typeof r.theme==="undefined")r.theme="Modern";if(typeof r.isGridVisible==="undefined")switch(r.target){default:r.isGridVisible=true;break;case "Phone":r.isGridVisible=false}if(typeof r.isReadOnly==="undefined")r.isReadOnly=true;if(typeof r.selectionMode==="undefined")r.selectionMode="Focus";if(typeof r.isVirtualizing==="undefined")r.isVirtualizing=true},ca=function(r,k){typeof k!=="object"&&(k={});X(k);var j=[{header:"",width:32,isSelection:true},{header:"Resource",
width:100}];j[0].cellTemplate=na(k,j[0],r);j[1].cellTemplate=$(k,j[1]);j[1].exportCellTemplate=$(k,j[1],false);k.selectionMode!="Single"&&(k.selectionMode!="Extended"&&k.selectionMode!="ExtendedFocus")&&j.splice(0,1);return j},na=function(r,k){return function(j){return!k.isReadOnly?fa(j):getBooleanNode(j.ganttChartView.ownerDocument,j.isSelected)}},fa=function(r){var k=r.ganttChartView.ownerDocument,j;if(typeof r.selectionInput==="undefined"){j=k.createElement("input");r.selectionInput=j;j.type="checkbox";
j.setAttribute("style","margin: 0px")}else j=r.selectionInput;if(r.isSelected){j.setAttribute("checked","checked");if(!j.checked)j.checked=true}else if(j.checked)j.checked=false;var m=function(){j.checked?S(r):typeof r.loadChartView!=="undefined"&&r.loadChartView.unselectItem(r)};typeof j.changeEventListener!=="undefined"&&j.removeEventListener("change",j.changeEventListener,true);j.addEventListener("change",m,true);j.changeEventListener=m;k=function(j){if(j.keyCode==13){j.preventDefault();j.stopPropagation();
m(j)}};typeof j.keyPressEventListener!=="undefined"&&j.removeEventListener("keypress",j.keyPressEventListener,true);j.addEventListener("keypress",k,true);j.keyPressEventListener=k;return j},S=function(r){typeof r.loadChartView!=="undefined"&&r.loadChartView.selectItem(r)},$=function(r,k,j){var m=function(j){var k=j.content,j=j.ganttChartView.ownerDocument.createElement("span");j.innerHTML=k;return j};return(typeof j==="undefined"||j)&&!r.isReadOnly&&!r.isGridReadOnly&&!r.isContentReadOnly?function(j){return!k.isReadOnly&&
(typeof j.isReadOnly==="undefined"||!j.isReadOnly)?P(j,Math.max(0,k.width-2),r):m(j)}:m},P=function(r,k,j){var m=r.ganttChartView.ownerDocument,p;if(typeof r.contentInput==="undefined"){p=m.createElement("input");r.contentInput=p;p.type="text";p.addEventListener("focus",function(){if(typeof r.loadChartView!=null)r.loadChartView.currentItem=r;(j.selectionMode=="Focus"||j.selectionMode=="ExtendedFocus")&&!r.isSelected&&S(r)},false);var s=function(){r.content=p.value;r.loadChartView.onItemPropertyChanged(r,
"content",true,true);r.loadChartView.refreshItem(r)};typeof p.changeEventListener!=="undefined"&&p.removeEventListener("change",p.changeEventListener,true);p.addEventListener("change",s,true);p.changeEventListener=s;m=function(j){if(j.keyCode==13){j.preventDefault();j.stopPropagation();s(j)}};typeof p.keyPressEventListener!=="undefined"&&p.removeEventListener("keypress",p.keyPressEventListener,true);p.addEventListener("keypress",m,true);p.keyPressEventListener=m;p.addEventListener("focus",function(){p.style.backgroundColor=
"White"},false);p.addEventListener("blur",function(){p.style.backgroundColor="Transparent"},false)}else p=r.contentInput;p.value=r.content;p.setAttribute("style","background-color: Transparent; width: "+k+"px; border-width: 0px; padding: 0px");return p},W=function(r){for(var k=0,j=0;j<r.length;j++)k=k+r[j].width;return k},Q=function(r){var k=r.loadChartView;k.refreshGridItem(r);if(typeof r.ganttChartItems!=="undefined")for(var j=0;j<r.ganttChartItems.length;j++)k.refreshChartItem(r.ganttChartItems[j])},
I=function(r,k,j){return function(m){var p=typeof k!=="undefined"?k:m.loadChartView,s=typeof j!=="undefined"?j:p.settings,r=p.ownerDocument,x;x=p.ownerDocument;if(typeof m.chartItemArea==="undefined")m.chartItemArea=x.createElementNS("http://www.w3.org/2000/svg","g");for(x=m.chartItemArea.childNodes.length;x-- >0;)m.chartItemArea.removeChild(m.chartItemArea.childNodes[x]);x=m.chartItemArea;var B=p.getChartPosition(m.start,s),p=Math.max(p.getChartPosition(m.finish,s),B+4),r=r.createElementNS("http://www.w3.org/2000/svg",
"rect"),A=typeof m.units!=="undefined"?m.units:1,z=Math.min(A,s.maxDisplayedUnits)/s.maxDisplayedUnits*s.barHeight;r.setAttribute("x",B);r.setAttribute("y",s.barMargin+(s.barHeight-z));r.setAttribute("width",Math.max(0,p-B-1));r.setAttribute("height",z);B=A==1?s.normalAllocationBarClass:A<1?s.underAllocationBarClass:s.overAllocationBarClass;if(typeof m.allocationBarClass!=="undefined")B=m.allocationBarClass;if(typeof B!=="undefined")r.setAttribute("class",B);else{s=A==1?s.normalAllocationBarStyle:
A<1?s.underAllocationBarStyle:s.overAllocationBarStyle;if(typeof m.allocationBarStyle!=="undefined")s=m.allocationBarStyle;typeof s!=="undefined"&&r.setAttribute("style",s)}x.appendChild(r);return x}},G=function(r,k,j,m){var p=m.indexOf(r);if(!(p<0||k<0||k==p||k>=m.length)){m.splice(p,1);m.splice(k,0,r);K(j);typeof j.settings.itemMoveHandler!=="undefined"&&j.settings.itemMoveHandler(r,p,k)}},V=function(r,k){for(var j in k)j.indexOf("custom")!=0&&j.indexOf("description")!=0||typeof r[j]==="undefined"&&
(r[j]=k[j])},U=function(r,k,j,m,p,s,v,x,B,A,z,G,I,K,N,P,C){var F,Q=[],T;if(typeof m!=="undefined")for(F=0;F<m.length;F++){T=C.columns[m[F]];Q.push({header:T.header,width:T.width,headerClass:T.headerClass,headerStyle:T.headerStyle,cellClass:T.cellClass,cellStyle:T.cellStyle,cellTemplate:typeof T.exportCellTemplate!=="undefined"?T.exportCellTemplate:T.cellTemplate})}else for(F=0;F<C.columns.length;F++){T=C.columns[F];T.isSelection||Q.push({header:T.header,width:T.width,headerClass:T.headerClass,headerStyle:T.headerStyle,
cellClass:T.cellClass,cellStyle:T.cellStyle,cellTemplate:typeof T.exportCellTemplate!=="undefined"?T.exportCellTemplate:T.cellTemplate})}if(typeof j==="undefined")j=C.isGridVisible;F=j?W(Q)+1:0;if(typeof p!=="undefined"){if(typeof v==="undefined"||!v)p=new Date(p.valueOf()-p.getTimezoneOffset()*6E4)}else p=C.timelineStart;if(typeof s!=="undefined"){if(typeof v==="undefined"||!v)s=new Date(s.valueOf()-s.getTimezoneOffset()*6E4)}else s=C.timelineFinish;p={isExport:true,isReadOnly:true,selectionMode:"None",
isVirtualizing:false,isGridVisible:j,isSplitterEnabled:false,gridWidth:F+"px",columns:Q,allowUserToResizeColumns:false,isGridRowClickTimeScrollingEnabled:false,isMouseWheelZoomEnabled:false,timelineStart:p,timelineFinish:s,hourWidth:typeof x!=="undefined"?x:C.hourWidth,displayedTime:typeof p!=="undefined"?p:C.timelineStart,currentTime:C.currentTime,isTaskToolTipVisible:false,isDependencyToolTipVisible:false,areTaskDependenciesVisible:false,isBaselineVisible:false,isTaskCompletedEffortVisible:false,
areTaskAssignmentsVisible:false,containerClass:C.containerClass,containerStyle:C.containerStyle,border:C.border,theme:C.theme,headerBackground:C.headerBackground,headerHeight:C.headerHeight,itemHeight:C.itemHeight,itemClass:C.itemClass,itemStyle:C.itemStyle,scales:[],visibleWeekStart:C.visibleWeekStart,visibleWeekFinish:C.visibleWeekFinish,workingWeekStart:C.workingWeekStart,workingWeekFinish:C.workingWeekFinish,visibleDayStart:C.visibleDayStart,visibleDayFinish:C.visibleDayFinish,specialNonworkingDays:C.specialNonworkingDays,
barMargin:C.barMargin,barHeight:C.barHeight,normalAllocationBarClass:C.normalAllocationBarClass,underAllocationBarClass:C.underAllocationBarClass,overAllocationBarClass:C.overAllocationBarClass,normalAllocationBarStyle:C.normalAllocationBarStyle,underAllocationBarStyle:C.underAllocationBarStyle,overAllocationBarStyle:C.overAllocationBarStyle,alternativeItemClass:C.alternativeItemClass,alternativeChartItemClass:C.alternativeChartItemClass,alternativeItemStyle:C.alternativeItemStyle,alternativeChartItemStyle:C.alternativeChartItemStyle,
gridLines:C.gridLines,horizontalGridLines:C.horizontalGridLines,verticalGridLines:C.verticalGridLines,horizontalChartLines:C.horizontalChartLines,target:C.target,months:C.months,daysOfWeek:C.daysOfWeek,weekStartDay:C.weekStartDay,dateFormatter:C.dateFormatter,dateTimeFormatter:C.dateTimeFormatter,isRelativeToTimezone:C.isRelativeToTimezone,allocationTemplate:C.allocationTemplate};p.timelineStart=DlhSoft.Controls.GanttChartView.getWeekStart(p.timelineStart,p.weekStartDay);p.timelineFinish=DlhSoft.Controls.GanttChartView.getWeekFinish(p.timelineFinish,
p.weekStartDay);N=N.getChartPosition(p.timelineFinish,p)-N.getChartPosition(p.timelineStart,p);p.chartWidth=N+"px";var U=F+N+2+(j?1:0);for(F=0;F<C.scales.length;F++){j=C.scales[F];p.scales.push({scaleType:j.scaleType,isHeaderVisible:j.isHeaderVisible,headerHeight:j.headerHeight,headerTextFormat:j.headerTextFormat,headerClass:j.headerClass,headerStyle:j.headerStyle,isHighlightingVisible:j.isHighlightingVisible,highlightingClass:j.highlightingClass,highlightingStyle:j.highlightingStyle,isSeparatorVisible:j.isSeparatorVisible,
separatorClass:j.separatorClass,separatorStyle:j.separatorStyle})}var O,S,$=false;if(z!=null&&typeof z.createElement!=="undefined")O=z;else{if(z!=null&&typeof z.focus!=="undefined")S=z;else{S=window.open("",z!=null?z:"_blank",typeof G!=="undefined"&&G&&(typeof K==="undefined"||K)?"width=320,height=100,location=no,menubar=no,toolbar=no,status=no,scrollbars=yes":"");$=true}O=S.document;try{var X=document.head.getElementsByTagName("link");for(F=0;F<X.length;F++){var ca=X[F],fa=O.adoptNode(ca.cloneNode(true));
fa.href=ca.href;O.head.appendChild(fa)}}catch(la){}}O.title=typeof r!=="undefined"?r:"Exported chart"+(typeof G!=="undefined"&&G?" (printable)":"");typeof B==="undefined"&&(B=0);typeof A==="undefined"&&(A=P.length-1);r=[];for(F=X=0;F<P.length;F++){z=P[F];if(!(typeof z.displayRowIndex!=="undefined"&&(z.displayRowIndex<B||z.displayRowIndex>A)||typeof z.displayRowIndex==="undefined"&&(X++<B||X>A+1))){C={content:z.content,start:z.start,finish:z.finish,units:z.units,isBarVisible:z.isBarVisible,isRelativeToTimezone:z.isRelativeToTimezone,
"class":z["class"],style:z.style,barClass:z.barClass,barStyle:z.barStyle,isSummaryEnabled:z.isSummaryEnabled,isParentSummarizationEnabled:z.isParentSummarizationEnabled,isHidden:z.isHidden,isExported:true,tag:z};if(typeof z.displayRowIndex!=="undefined")C.displayRowIndex=z.displayRowIndex-B;V(C,z);r.push(C);z.exportItem=C}}var oa=O.createElement("p");oa.innerHTML=typeof k!=="undefined"?k:"";O.body.appendChild(oa);var da=O.createElement("div");da.setAttribute("style","width: "+U+"px");try{DlhSoft.Controls.LoadChartView.initialize(da,
r,p,"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase.")}catch(na){}setTimeout(function(){$&&O.body.setAttribute("style","margin: 0px");var j=O.createElement("div");j.appendChild(da);O.body.replaceChild(j,oa);if(I){j.setAttribute("style","width: "+da.offsetHeight+"px; height: "+U+"px; overflow: hidden");j=Math.round((da.offsetWidth-da.offsetHeight)/2);da.setAttribute("style","width: "+U+"px; transform: rotate(90deg) translateX("+
j+"px) translateY("+j+"px); -webkit-transform: rotate(90deg) translateX("+j+"px) translateY("+j+"px)")}O.close();if(typeof S!==void 0){S.focus();if(typeof G!=="undefined"&&G){S.print();(typeof K==="undefined"||K)&&S.close()}}},0)},la=function(r,k,j,m){for(var p=0;p<k.length;p++)k[p].loadChartView=k[p].scheduleChartView=r;r.loadChartItems=r.scheduleChartItems=j;r.settings=m;r.refreshLoadChartItem=Q;r.insertLoadChartItem=function(m,p){var x=m;p.loadChartView=p.scheduleChartView=r;p.isVirtuallyVisible=
true;p.loadChartIndex=p.scheduleChartIndex=x;p.isBarVisible=false;x=x<j.length?j[x].index:k.length;j.splice(p.loadChartIndex,0,p);r.insertItem(x++,p);if(typeof p.ganttChartItems!=="undefined")for(var B=0;B<p.ganttChartItems.length;B++){var A=p.ganttChartItems[B];A.loadChartView=A.scheduleChartView=r;A.loadChartItem=A.scheduleChartItem=p;A.displayRowIndex=p.loadChartIndex;r.insertItem(x++,A)}for(x=p.loadChartIndex+1;x<j.length;x++){B=j[x];B.loadChartIndex=B.scheduleChartIndex=x;if(typeof B.ganttChartItems!==
"undefined")for(A=0;A<B.ganttChartItems.length;A++)B.ganttChartItems[A].displayRowIndex=B.loadChartIndex;Q(B)}};r.addLoadChartItem=function(k){r.insertLoadChartItem(j.length,k)};r.insertLoadChartItems=function(j,k){for(var m=0;m<k.length;m++)r.insertLoadChartItem(j++,k[m])};r.addLoadChartItems=function(j){for(var k=0;k<j.length;k++)r.addLoadChartItem(j[k])};r.removeLoadChartItem=function(k){if(typeof k.ganttChartItems!=="undefined")for(var m=0;m<k.ganttChartItems.length;m++)r.removeItem(k.ganttChartItems[m]);
r.removeItem(k);j.splice(k.loadChartIndex,1);for(k=k.loadChartIndex;k<j.length;k++){m=j[k];m.loadChartIndex=m.scheduleChartIndex=k;if(typeof m.ganttChartItems!=="undefined")for(var p=0;p<m.ganttChartItems.length;p++)m.ganttChartItems[p].displayRowIndex=m.loadChartIndex;Q(m)}};r.removeLoadChartItems=function(j){for(var k=0;k<j.length;k++)r.removeLoadChartItem(j[k])};r.moveLoadChartRange=function(k,m,p){if(!(k<0||p<0||p==k||p>j.length-m)){var B=[],A;for(A=k;A<k+m;A++)B.push(j[A]);j.splice(k,m);for(A=
0;A<B.length;A++)j.splice(p+A,0,B[A]);K(r);if(typeof r.settings.itemMoveHandler!=="undefined")for(A=0;A<B.length;A++)r.settings.itemMoveHandler(B[A],k+A,p+A)}};r.moveLoadChartItem=function(k,m){G(k,m,r,j)};r.moveLoadChartItemUp=function(k){var m=j.indexOf(k);m<=0||G(k,m-1,r,j)};r.moveLoadChartItemDown=function(k){var m=j.indexOf(k);m<0||m>=j.length-1||G(k,m+1,r,j)}},N=function(r,k,j){r.items=k;r.refresh=function(){K(r)};r.exportContent=function(m,p){typeof m==="undefined"&&(m={});U(m.title,m.preparingMessage,
m.isGridVisible,m.columnIndexes,m.timelineStart,m.timelineFinish,m.isRelativeToTimezone,m.hourWidth,m.startRowIndex,m.endRowIndex,p,false,m.rotate,false,r,k,j)};r.print=function(m){typeof m==="undefined"&&(m={});U(m.title,m.preparingMessage,m.isGridVisible,m.columnIndexes,m.timelineStart,m.timelineFinish,m.isRelativeToTimezone,m.hourWidth,m.startRowIndex,m.endRowIndex,null,true,m.rotate,m.autoClose,r,k,j)}};return{initialize:O,refresh:K,getDefaultColumns:ca,getDefaultScales:DlhSoft.Controls.GanttChartView.getDefaultScales,
getDefaultAllocationTemplate:I,getDefaultItemTemplate:DlhSoft.Controls.GanttChartView.getDefaultItemTemplate,getWorkingTime:DlhSoft.Controls.GanttChartView.getWorkingTime,textColumnTemplateBase:DlhSoft.Controls.GanttChartView.textColumnTemplateBase,textInputColumnTemplateBase:DlhSoft.Controls.GanttChartView.textInputColumnTemplateBase,getOutputDate:DlhSoft.Controls.GanttChartView.getOutputDate,getInputDate:DlhSoft.Controls.GanttChartView.getInputDate}}());
;
"undefined"===typeof DlhSoft&&(DlhSoft={assemblies:[],buildReleaseDate:new Date(1,0,1)});DlhSoft.assemblies.push({assembly:"DlhSoft.Data.HTML.Controls",company:"DlhSoft",product:"Data Modern Library",version:"5.2.3.0",copyright:"Copyright \ufffd 2014-2015 DlhSoft",title:"Data HTML Controls",description:"Data related HTML client components"});DlhSoft.buildReleaseDate=function(l,g,t){l=new Date(l,g-1,t);return l>DlhSoft.buildReleaseDate?l:DlhSoft.buildReleaseDate}(2015,5,8);var _0x5c25="Licensing{undefined{string{DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase.{.{length{license{push{type{content{:{lastIndexOf{substr{buildReleaseDate{charCodeAt{pow{toUpperCase{DlhSoft Component Licensing Warning{http://DlhSoft.com/Purchase.aspx{?Assemblies={,{http://www.componentsource.com/features/dlhsoft{ (version {){This component is currently licensed to be used for testing purposes only{The component is part of this assembly{To purchase a standard license for a product that includes this assembly you can use the Purchase page{ownerDocument{div{createElement{style{position: absolute; left: 24px; top: 24px; width: 480px; display: block; z-index: 1; color: Black; background-color: #ffffc0; border: solid 1px Blue; overflow: auto{setAttribute{padding: 6px; padding-top: 8px; font-family: Arial; font-size: small{font-weight: bold; margin-bottom: 4px{appendChild{createTextNode{color: Red; margin-top: 2px; margin-bottom: 2px{margin-top: 4px{a{color: Blue; text-decoration: underline{href{target{_blank{Purchase license{margin-left: 4px; color: Blue; text-decoration: underline{javascript://{Continue trial{click{removeChild{addEventListener{\n\n{: {:\n".split("{");
void 0==DlhSoft[_0x5c25[0]]&&(DlhSoft[_0x5c25[0]]=function(){var l=_0x5c25[1],g=_0x5c25[2],t=[],u=[],A=_0x5c25[3],z=function(v,o){if(typeof v!==g||typeof o!==g)return!1;if(o==A)return!0;var r=o[_0x5c25[11]](_0x5c25[10]);if(0<=r){var q=o[_0x5c25[12]](0,r),j,s=q[_0x5c25[11]](_0x5c25[10]);if(0<=s)try{j=new Date(parseInt(q[_0x5c25[12]](s+1)))}catch(k){}typeof j===l&&(j=new Date(2013,11,31));if(DlhSoft[_0x5c25[13]]>j)return!1;q=q+_0x5c25[10]+v;for(i=j=0;i<q[_0x5c25[5]];i++)s=q[_0x5c25[14]](i),j=(j<<5)-
j+s,j&=j;0>j&&(j=Math[_0x5c25[15]](2,32)-j);q=j.toString(16)[_0x5c25[16]]();r=o[_0x5c25[12]](r+1);if(q==r)return!0}return!1},x=function(g,o,r,q,j){var s=_0x5c25[17],k=_0x5c25[18],p=typeof ComponentSource===l||!ComponentSource?k+_0x5c25[19]+q+_0x5c25[20]+j:_0x5c25[21],c=q+_0x5c25[22]+j+_0x5c25[23],a=_0x5c25[24],b=_0x5c25[25],d=_0x5c25[26];setTimeout(function(){var f=g[_0x5c25[27]],e=f[_0x5c25[29]](_0x5c25[28]);e[_0x5c25[32]](_0x5c25[30],_0x5c25[31]);var h=f[_0x5c25[29]](_0x5c25[28]);h[_0x5c25[32]](_0x5c25[30],
_0x5c25[33]);var m=f[_0x5c25[29]](_0x5c25[28]);m[_0x5c25[32]](_0x5c25[30],_0x5c25[34]);h[_0x5c25[35]](m);m[_0x5c25[35]](f[_0x5c25[36]](s));h[_0x5c25[35]](f[_0x5c25[36]](a+_0x5c25[10]));m=f[_0x5c25[29]](_0x5c25[28]);m[_0x5c25[32]](_0x5c25[30],_0x5c25[37]);m[_0x5c25[35]](f[_0x5c25[36]](o));h[_0x5c25[35]](m);h[_0x5c25[35]](f[_0x5c25[36]](b+_0x5c25[10]));m=f[_0x5c25[29]](_0x5c25[28]);m[_0x5c25[32]](_0x5c25[30],_0x5c25[37]);m[_0x5c25[35]](f[_0x5c25[36]](c));h[_0x5c25[35]](m);h[_0x5c25[35]](f[_0x5c25[36]](d+
_0x5c25[10]));m=f[_0x5c25[29]](_0x5c25[28]);m[_0x5c25[32]](_0x5c25[30],_0x5c25[38]);var n=f[_0x5c25[29]](_0x5c25[39]);n[_0x5c25[32]](_0x5c25[30],_0x5c25[40]);n[_0x5c25[32]](_0x5c25[41],p);n[_0x5c25[32]](_0x5c25[42],_0x5c25[43]);n[_0x5c25[35]](f[_0x5c25[36]](_0x5c25[44]));m[_0x5c25[35]](n);n=f[_0x5c25[29]](_0x5c25[39]);n[_0x5c25[32]](_0x5c25[30],_0x5c25[45]);n[_0x5c25[32]](_0x5c25[41],_0x5c25[46]);n[_0x5c25[35]](f[_0x5c25[36]](_0x5c25[47]));n[_0x5c25[50]](_0x5c25[48],function(){g[_0x5c25[49]](e);u[_0x5c25[7]](r)},
!1);m[_0x5c25[35]](n);h[_0x5c25[35]](m);e[_0x5c25[35]](h);g[_0x5c25[35]](e)},0);setTimeout(function(){alert(s+_0x5c25[51]+a+_0x5c25[52]+o+_0x5c25[51]+b+_0x5c25[53]+c+_0x5c25[51]+d+_0x5c25[4])},6E5)};return{setLicense:function(g,l){t[_0x5c25[7]]({type:g,content:l})},validate:function(v,o,r,q,j,s,k){for(var o=o+_0x5c25[4]+r,p=0;p<u[_0x5c25[5]];p++)if(u[p]==o)return;a:if(typeof s!==g&&typeof k!==l&&(k[_0x5c25[6]]!==l&&(s=k[_0x5c25[6]]),typeof k===g&&(s=k)),typeof s!==g)for(k=0;k<t[_0x5c25[5]];k++)if(p=
t[k],p[_0x5c25[8]]==o&&typeof p[_0x5c25[9]]===g){s=p[_0x5c25[9]];break a}z(o,s)?v[_0x5c25[6]]=s:x(v,r,o,q,j)}}}());"undefined"===typeof DlhSoft&&(DlhSoft={assemblies:[],buildReleaseDate:new Date(1,0,1)});DlhSoft.assemblies.push({assembly:"DlhSoft.Data.HTML.Controls",company:"DlhSoft",product:"Data Modern Library",version:"5.2.3.0",copyright:"Copyright \ufffd 2014-2015 DlhSoft",title:"Data HTML Controls",description:"Data related HTML client components"});
DlhSoft.buildReleaseDate=function(l,g,t){l=new Date(l,g-1,t);return l>DlhSoft.buildReleaseDate?l:DlhSoft.buildReleaseDate}(2015,5,8);_0x5c25="Licensing{undefined{string{DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase.{.{length{license{push{type{content{:{lastIndexOf{substr{buildReleaseDate{charCodeAt{pow{toUpperCase{DlhSoft Component Licensing Warning{http://DlhSoft.com/Purchase.aspx{?Assemblies={,{http://www.componentsource.com/features/dlhsoft{ (version {){This component is currently licensed to be used for testing purposes only{The component is part of this assembly{To purchase a standard license for a product that includes this assembly you can use the Purchase page{ownerDocument{div{createElement{style{position: absolute; left: 24px; top: 24px; width: 480px; display: block; z-index: 1; color: Black; background-color: #ffffc0; border: solid 1px Blue; overflow: auto{setAttribute{padding: 6px; padding-top: 8px; font-family: Arial; font-size: small{font-weight: bold; margin-bottom: 4px{appendChild{createTextNode{color: Red; margin-top: 2px; margin-bottom: 2px{margin-top: 4px{a{color: Blue; text-decoration: underline{href{target{_blank{Purchase license{margin-left: 4px; color: Blue; text-decoration: underline{javascript://{Continue trial{click{removeChild{addEventListener{\n\n{: {:\n".split("{");
void 0==DlhSoft[_0x5c25[0]]&&(DlhSoft[_0x5c25[0]]=function(){var l=_0x5c25[1],g=_0x5c25[2],t=[],u=[],A=_0x5c25[3],z=function(v,o){if(typeof v!==g||typeof o!==g)return!1;if(o==A)return!0;var r=o[_0x5c25[11]](_0x5c25[10]);if(0<=r){var q=o[_0x5c25[12]](0,r),j,s=q[_0x5c25[11]](_0x5c25[10]);if(0<=s)try{j=new Date(parseInt(q[_0x5c25[12]](s+1)))}catch(k){}typeof j===l&&(j=new Date(2013,11,31));if(DlhSoft[_0x5c25[13]]>j)return!1;q=q+_0x5c25[10]+v;for(i=j=0;i<q[_0x5c25[5]];i++)s=q[_0x5c25[14]](i),j=(j<<5)-
j+s,j&=j;0>j&&(j=Math[_0x5c25[15]](2,32)-j);q=j.toString(16)[_0x5c25[16]]();r=o[_0x5c25[12]](r+1);if(q==r)return!0}return!1},x=function(g,o,r,q,j){var s=_0x5c25[17],k=_0x5c25[18],p=typeof ComponentSource===l||!ComponentSource?k+_0x5c25[19]+q+_0x5c25[20]+j:_0x5c25[21],c=q+_0x5c25[22]+j+_0x5c25[23],a=_0x5c25[24],b=_0x5c25[25],d=_0x5c25[26];setTimeout(function(){var f=g[_0x5c25[27]],e=f[_0x5c25[29]](_0x5c25[28]);e[_0x5c25[32]](_0x5c25[30],_0x5c25[31]);var h=f[_0x5c25[29]](_0x5c25[28]);h[_0x5c25[32]](_0x5c25[30],
_0x5c25[33]);var m=f[_0x5c25[29]](_0x5c25[28]);m[_0x5c25[32]](_0x5c25[30],_0x5c25[34]);h[_0x5c25[35]](m);m[_0x5c25[35]](f[_0x5c25[36]](s));h[_0x5c25[35]](f[_0x5c25[36]](a+_0x5c25[10]));m=f[_0x5c25[29]](_0x5c25[28]);m[_0x5c25[32]](_0x5c25[30],_0x5c25[37]);m[_0x5c25[35]](f[_0x5c25[36]](o));h[_0x5c25[35]](m);h[_0x5c25[35]](f[_0x5c25[36]](b+_0x5c25[10]));m=f[_0x5c25[29]](_0x5c25[28]);m[_0x5c25[32]](_0x5c25[30],_0x5c25[37]);m[_0x5c25[35]](f[_0x5c25[36]](c));h[_0x5c25[35]](m);h[_0x5c25[35]](f[_0x5c25[36]](d+
_0x5c25[10]));m=f[_0x5c25[29]](_0x5c25[28]);m[_0x5c25[32]](_0x5c25[30],_0x5c25[38]);var n=f[_0x5c25[29]](_0x5c25[39]);n[_0x5c25[32]](_0x5c25[30],_0x5c25[40]);n[_0x5c25[32]](_0x5c25[41],p);n[_0x5c25[32]](_0x5c25[42],_0x5c25[43]);n[_0x5c25[35]](f[_0x5c25[36]](_0x5c25[44]));m[_0x5c25[35]](n);n=f[_0x5c25[29]](_0x5c25[39]);n[_0x5c25[32]](_0x5c25[30],_0x5c25[45]);n[_0x5c25[32]](_0x5c25[41],_0x5c25[46]);n[_0x5c25[35]](f[_0x5c25[36]](_0x5c25[47]));n[_0x5c25[50]](_0x5c25[48],function(){g[_0x5c25[49]](e);u[_0x5c25[7]](r)},
!1);m[_0x5c25[35]](n);h[_0x5c25[35]](m);e[_0x5c25[35]](h);g[_0x5c25[35]](e)},0);setTimeout(function(){alert(s+_0x5c25[51]+a+_0x5c25[52]+o+_0x5c25[51]+b+_0x5c25[53]+c+_0x5c25[51]+d+_0x5c25[4])},6E5)};return{setLicense:function(g,l){t[_0x5c25[7]]({type:g,content:l})},validate:function(v,o,r,q,j,s,k){for(var o=o+_0x5c25[4]+r,p=0;p<u[_0x5c25[5]];p++)if(u[p]==o)return;a:if(typeof s!==g&&typeof k!==l&&(k[_0x5c25[6]]!==l&&(s=k[_0x5c25[6]]),typeof k===g&&(s=k)),typeof s!==g)for(k=0;k<t[_0x5c25[5]];k++)if(p=
t[k],p[_0x5c25[8]]==o&&typeof p[_0x5c25[9]]===g){s=p[_0x5c25[9]];break a}z(o,s)?v[_0x5c25[6]]=s:x(v,r,o,q,j)}}}());var __extends=this&&this.__extends||function(l,g){function t(){this.constructor=l}for(var u in g)g.hasOwnProperty(u)&&(l[u]=g[u]);t.prototype=g.prototype;l.prototype=new t},DlhSoft;
(function(l){(function(g){var t;(function(k){k.initialize=function(c,a,b){return new g(c,a,b)};k.get=function(c){return c.component};var g=function(){function c(a,b,d){this.host=a;this.settings=b;this.isInitialized=!1;var f="DlhSoft.Controls ContentControl DlhSoft.Data.HTML.Controls 5 validate Licensing".split(" ");l[f[5]][f[4]](a,f[0],f[1],f[2],f[3],d,b);this.host.component=this;"undefined"===typeof b&&(b={});this.settings=b;c.initializeSettings(this.settings);b=this.settings.content;if("undefined"===
typeof b||null==b)b=c.getContent(a);this.content=b;this.settings.content=b;this.refresh();this.isInitialized=!0}c.initializeSettings=function(a){"undefined"===typeof a.theme&&(a.theme="Modern");"undefined"===typeof a.containerStyle&&(a.containerStyle="font-family: Arial; font-size: "+("Modern"==a.theme?"12px":"small"));"undefined"===typeof a.contentTemplate&&(a.contentTemplate=function(a,d){if(typeof d==="undefined"||d==null)d="";if(d instanceof HTMLElement)return d;var c=a.createElement("span");
c.innerHTML=d.toString();return c})};c.getContent=function(a){var b=a.ownerDocument.createElement("span"),d=[],c;for(c=0;c<a.childNodes.length;c++)d.push(a.childNodes[c]);for(c=a.childNodes.length;0<c--;)a.removeChild(a.childNodes[c]);for(c=0;c<d.length;c++)b.appendChild(d[c]);return b};c.prototype.refresh=function(){for(var a=this.host.ownerDocument,b=this.host.childNodes.length;0<b--;)this.host.removeChild(this.host.childNodes[b]);this.contentContainer=this.settings.contentTemplate(a,this.content);
null!=this.settings.containerStyle&&this.contentContainer.setAttribute("style",this.settings.containerStyle);"undefined"!==typeof this.settings.containerClass&&this.contentContainer.setAttribute("class",this.settings.containerClass);this.host.appendChild(this.contentContainer)};c.prototype.setContent=function(a){this.content=a;this.settings.content=a;this.refresh()};return c}();k.Element=g})(t=g.ContentControl||(g.ContentControl={}));(function(k){k.initialize=function(c,a,b,d){return new g(c,a,b,
d)};k.get=function(c){return c.component};var g=function(){function c(a,b,d,f){this.host=a;this.settings=d;this.isInitialized=!1;var e="DlhSoft.Controls ItemsControl DlhSoft.Data.HTML.Controls 5 validate Licensing".split(" ");l[e[5]][e[4]](a,e[0],e[1],e[2],e[3],f,d);this.host.component=this;"undefined"===typeof d&&(d={});this.settings=d;c.initializeSettings(this.settings);if("undefined"===typeof b||null==b)b=this.settings.items;if("undefined"===typeof b||null==b)b=c.getItems(a);this.items=b;this.settings.items=
b;this.refresh();this.isInitialized=!0}c.initializeSettings=function(a){"undefined"===typeof a.theme&&(a.theme="Modern");"undefined"===typeof a.itemContainerStyle&&(a.itemContainerStyle="font-family: Arial; font-size: "+("Modern"==a.theme?"12px":"small"));"undefined"===typeof a.itemTemplate&&(a.itemTemplate=function(a,d){if(typeof d==="undefined"||d==null)d="";if(d instanceof HTMLElement)return d;var c=a.createElement("span");c.innerHTML=d.toString();return c})};c.getItems=function(a){var b=[],d;
for(d=0;d<a.childNodes.length;d++)a.childNodes[d]instanceof HTMLElement&&b.push(a.childNodes[d]);for(d=a.childNodes.length;0<d--;)a.removeChild(a.childNodes[d]);return b};c.prototype.refresh=function(){for(var a=this.host.ownerDocument,b=this.host.childNodes.length;0<b--;)this.host.removeChild(this.host.childNodes[b]);this.itemContainers=[];for(b=0;b<this.items.length;b++){var d=this.settings.itemTemplate(a,this.items[b]);null!=this.settings.itemContainerStyle&&d.setAttribute("style",this.settings.itemContainerStyle);
"undefined"!==typeof this.settings.itemContainerClass&&d.setAttribute("class",this.settings.itemContainerClass);this.host.appendChild(d)}};c.prototype.setItems=function(a){this.items=a;this.settings.items=a;this.refresh()};return c}();k.Element=g})(g.ItemsControl||(g.ItemsControl={}));var u;(function(k){k.initialize=function(c,a,b,d){return new g(c,a,b,d)};k.get=function(c){return c.component};var g=function(){function c(a,b,d,f){this.host=a;this.clickHandler=b;this.settings=d;this.isInitialized=
!1;b="DlhSoft.Controls Button DlhSoft.Data.HTML.Controls 5 validate Licensing".split(" ");l[b[5]][b[4]](a,b[0],b[1],b[2],b[3],f,d);this.host.component=this;"undefined"===typeof d&&(d={});this.settings=d;c.initializeSettings(this.settings);var e=this.host.ownerDocument;if(this.inputHost=a instanceof HTMLInputElement?a:null)e=e.createElement("span"),this.inputHost.parentElement&&this.inputHost.parentElement.insertBefore(e,this.inputHost),this.host=e,l[b[5]][b[4]](e,b[0],b[1],b[2],b[3],f,d),this.host.component=
this;if(d=this.host.getAttribute("style"))this.settings.containerStyle=d+";"+this.settings.containerStyle,this.host.setAttribute("style","");if((d=this.host.getAttribute("class"))&&!this.settings.containerClass)this.settings.containerClass=d,this.host.setAttribute("class","");d=this.settings.content;if("undefined"===typeof d||null==d)d=t.Element.getContent(a);this.content=d;this.settings.content=d;this.isEnabled=this.settings.isEnabled;this.isInitialRefresh=!0;this.refresh();this.isInitialized=!0}
c.initializeSettings=function(a){t.Element.initializeSettings(a);a.containerStyle+=("Modern"==a.theme?"; color: #505050":"")+"; display: inline-block; text-align: center; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; cursor: default; background-color: #f0f0f0; border: 1px solid #e0e0e0; "+("Modern"==a.theme?"":"; border-radius: 3px");"undefined"===typeof a.inputType&&(a.inputType="button");"undefined"===typeof a.isEnabled&&(a.isEnabled=!0);"undefined"===
typeof a.disabledStyle&&(a.disabledStyle="opacity: 0.5");"undefined"===typeof a.hoveringStyle&&(a.hoveringStyle="background-color: "+("Modern"==a.theme?"#e8e8ff":"#e8e8e8"));"undefined"===typeof a.pressedStyle&&(a.pressedStyle="background-color: "+("Modern"==a.theme?"#d0d0ff":"#e8e8e8"));"undefined"===typeof a.contentStyle&&(a.contentStyle="padding: 4px 8px 4px 8px; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; cursor: default")};c.prototype.refresh=
function(){var a=this;if(this.isInitialRefresh&&(delete this.isInitialRefresh,this instanceof A.Element))return;for(var b=this.host.ownerDocument,d=this.host.childNodes.length;0<d--;)this.host.removeChild(this.host.childNodes[d]);this.inputHost?(this.inputElement=this.inputHost,this.inputElement.value&&(this.content=this.inputElement.value)):this.inputElement=b.createElement("input");this.settings.inputName&&this.inputElement.setAttribute("name",this.settings.inputName);this.inputElement.value||(this.inputElement.value=
this.inputElement.name);this.inputElement.setAttribute("type","toggleButton"!=this.settings.inputType?this.settings.inputType:"checkbox");this.inputElement.style.display="none";this.host.appendChild(this.inputElement);this.contentControlHost=b.createElement("div");this.contentControlHost.setAttribute("style",this.settings.containerStyle);"undefined"!==typeof this.settings.containerClass&&this.contentControlHost.setAttribute("class",this.settings.containerClass);this.host.appendChild(this.contentControlHost);
this.contentControl=new t.Element(this.contentControlHost,{theme:this.settings.theme,containerStyle:null,content:this.content,contentTemplate:function(b,d){if(typeof d==="undefined"||d==null)d="";var c=b.createElement("div");a.contentContainer=c;c.setAttribute("style",a.settings.contentStyle);typeof a.settings.contentClass!=="undefined"&&c.setAttribute("class",a.settings.contentClass);c.appendChild(a.settings.contentTemplate(b,d));var m=b.createElement("div");a.hoverableContainer=m;if(!a.isEnabled){a.hoverableContainer.setAttribute("style",
a.settings.disabledStyle);typeof a.settings.disabledClass!=="undefined"&&a.hoverableContainer.setAttribute("class",a.settings.disabledClass)}var n=b.createElement("div");a.pressableContainer=n;n.appendChild(c);m.appendChild(n);m.onmouseenter=function(){if(a.isEnabled&&a.hoverableContainer==m){m.setAttribute("style",a.settings.hoveringStyle);typeof a.settings.hoveringClass!=="undefined"&&m.setAttribute("class",a.settings.hoveringClass);if(a.settings.inputType!="toggleButton"&&a.isPressed){n.setAttribute("style",
a.settings.pressedStyle);typeof a.settings.pressedClass!=="undefined"&&n.setAttribute("class",a.settings.pressedClass)}a.isHovering=true;a.settings.hoveringHandler&&a.settings.hoveringHandler(a)}};m.onmouseleave=function(){if(a.isEnabled&&a.hoverableContainer==m){a.isHovering=false;m.setAttribute("style","");m.setAttribute("class","");if(a.settings.inputType!="toggleButton"){n.setAttribute("style","");n.setAttribute("class","")}a.settings.unhoveringHandler&&a.settings.unhoveringHandler(a)}};if(a.settings.inputType!=
"toggleButton"){n.onmousedown=function(){if(a.isEnabled&&a.pressableContainer==n){n.setAttribute("style",a.settings.pressedStyle);typeof a.settings.pressedClass!=="undefined"&&n.setAttribute("class",a.settings.pressedClass);a.isPressed=true;a.settings.pressedHandler&&a.settings.pressedHandler(a)}};b.addEventListener("mouseup",function(){if(a.isEnabled&&a.pressableContainer==n){a.isPressed=false;n.setAttribute("style","");n.setAttribute("class","");a.settings.unpressedHandler&&a.settings.unpressedHandler(a)}},
false);n.onmouseup=function(){if(a.isEnabled&&a.pressableContainer==n){a.clickHandler&&a.clickHandler();try{var b=a.inputElement.ownerDocument.createEvent("HTMLEvents");b.initEvent("click",true,true);a.inputElement.dispatchEvent(b)}catch(d){}}}}else n.onmousedown=function(){if(a.isEnabled&&a.pressableContainer==n)if(a.isPressed){a.isPressed=false;n.setAttribute("style","");n.setAttribute("class","");a.settings.unpressedHandler&&a.settings.unpressedHandler(a);a.clickHandler&&a.clickHandler();try{d=
a.inputElement.ownerDocument.createEvent("HTMLEvents");d.initEvent("click",true,true);a.inputElement.dispatchEvent(d);c=a.inputElement.ownerDocument.createEvent("HTMLEvents");c.initEvent("change",true,true);a.inputElement.dispatchEvent(c)}catch(b){}}else{n.setAttribute("style",a.settings.pressedStyle);typeof a.settings.pressedClass!=="undefined"&&n.setAttribute("class",a.settings.pressedClass);a.isPressed=true;a.settings.pressedHandler&&a.settings.pressedHandler(a);a.clickHandler&&a.clickHandler();
try{var d=a.inputElement.ownerDocument.createEvent("HTMLEvents");d.initEvent("click",true,true);a.inputElement.dispatchEvent(d);var c=a.inputElement.ownerDocument.createEvent("HTMLEvents");c.initEvent("change",true,true);a.inputElement.dispatchEvent(c)}catch(f){}}};return m}},"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase.")};c.prototype.setContent=function(a){this.content=a;this.settings.content=a;this.refresh()};
c.prototype.enable=function(){this.isEnabled=!0;this.settings.isEnabled=!0;this.refresh()};c.prototype.disable=function(){this.isEnabled=!1;this.settings.isEnabled=!1;this.refresh()};return c}();k.Element=g})(u=g.Button||(g.Button={}));var A;(function(k){k.initialize=function(c,a,b,d){return new g(c,a,b,d)};k.get=function(c){return c.component};var g=function(c){function a(a,d,f,e){var h=this;c.call(this,a,void 0,f,e);this.toggleHandler=d;this.isInitialized=!1;this.settings.inputType="toggleButton";
this.clickHandler=function(){h.toggleHandler&&h.toggleHandler(h.isPressed)};this.refresh();this.isInitialized=!0}__extends(a,c);return a}(u.Element);k.Element=g})(A=g.ToggleButton||(g.ToggleButton={}));(function(k){k.initialize=function(c,a,b){return new g(c,a,b)};k.get=function(c){return c.component};var g=function(){function c(a,b,d){this.host=a;this.settings=b;this.isInitialized=!1;var f="DlhSoft.Controls TextBox DlhSoft.Data.HTML.Controls 5 validate Licensing".split(" ");l[f[5]][f[4]](a,f[0],
f[1],f[2],f[3],d,b);this.host.component=this;"undefined"===typeof b&&(b={});this.settings=b;c.initializeSettings(this.settings);var e=this.host.ownerDocument;if(this.inputHost=a instanceof HTMLInputElement?a:null)a=e.createElement("span"),this.inputHost.parentElement&&this.inputHost.parentElement.insertBefore(a,this.inputHost),this.host=a,l[f[5]][f[4]](a,f[0],f[1],f[2],f[3],d,b),this.host.component=this;b=b.value;if("undefined"===typeof b||null==b)b=this.inputHost?this.inputHost.value:this.host.innerText?
this.host.innerText:this.host.innerHTML;this.value=b;this.settings.value=b;this.isEnabled=this.settings.isEnabled;this.refresh();this.isInitialized=!0}c.initializeSettings=function(a){"undefined"===typeof a.theme&&(a.theme="Modern");"undefined"===typeof a.isEnabled&&(a.isEnabled=!0);"undefined"===typeof a.isReadOnly&&(a.isReadOnly=!1);"undefined"===typeof a.inputStyle&&"Modern"==a.theme&&(a.inputStyle="border: 1px solid #e0e0e0; background-color: White; color: #505050; font-family: Arial; font-size: 12px; padding: 4px")};
c.prototype.refresh=function(){for(var a=this,b=this.host.ownerDocument,d=this.host.childNodes.length;0<d--;)this.host.removeChild(this.host.childNodes[d]);this.inputElement=!this.inputHost?b.createElement("input"):this.inputHost;this.settings.inputName&&this.inputElement.setAttribute("name",this.settings.inputName);this.inputElement.setAttribute("type","text");"undefined"!==typeof this.settings.inputStyle&&this.inputElement.setAttribute("style",this.settings.inputStyle+(this.inputElement.getAttribute("style")?
";"+this.inputElement.getAttribute("style"):""));this.settings.inputClass&&this.inputElement.setAttribute("class",this.settings.inputClass);this.inputElement.value=this.value;this.settings.isReadOnly?this.inputElement.setAttribute("readonly","readonly"):this.inputElement.removeAttribute("readonly");this.settings.isEnabled?this.inputElement.removeAttribute("disabled"):this.inputElement.setAttribute("disabled","disabled");this.host.appendChild(this.inputElement);this.inputElement.onchange=function(){a.isEnabled&&
(a.value=a.inputElement.value,a.settings.changeHandler&&a.settings.changeHandler(a.value))};this.inputElement.onclick=function(){a.settings.clickHandler&&a.settings.clickHandler()}};c.prototype.getValue=function(){return this.value};c.prototype.setValue=function(a){this.value=a;this.settings.value=a;this.refresh()};c.prototype.enable=function(){this.isEnabled=!0;this.settings.isEnabled=!0;this.refresh()};c.prototype.disable=function(){this.isEnabled=!1;this.settings.isEnabled=!1;this.refresh()};return c}();
k.Element=g})(g.TextBox||(g.TextBox={}));var z;(function(k){k.initialize=function(c,a,b,d){return new g(c,a,b,d)};k.get=function(c){return c.component};var g=function(){function c(a,b,d,f){this.host=a;this.selectedTime=b;this.settings=d;this.isInitialized=!1;var e="DlhSoft.Controls CalendarSelector DlhSoft.Data.HTML.Controls 5 validate Licensing".split(" ");l[e[5]][e[4]](a,e[0],e[1],e[2],e[3],f,d);this.host.component=this;"undefined"===typeof d&&(d={});this.settings=d;c.initializeSettings(this.settings);
"undefined"===typeof b&&(b=d.minValue);b<d.minValue&&(b=d.minValue);this.selectedTime=b;null==this.settings.displayedTime&&(a=this.settings.rows*this.settings.columns,this.settings.displayedTime=Math.floor(this.selectedTime/a)*a);this.settings.displayedTime<d.minValue&&(this.settings.displayedTime=d.minValue);this.refresh();this.isInitialized=!0}c.initializeSettings=function(a){"undefined"===typeof a.theme&&(a.theme="Modern");"undefined"===typeof a.rows?a.rows=4:0>=a.rows&&(a.rows=1);"undefined"===
typeof a.columns?a.columns=3:0>=a.columns&&(a.columns=1);"undefined"===typeof a.headerProvider&&(a.headerProvider=function(b,d){return b.createTextNode(d!=null?d.toString()+" - "+(d+a.rows*a.columns-1).toString():"?")});"undefined"===typeof a.headerStyle&&(a.headerStyle="color: "+("Modern"==a.theme?"#505050":"Black")+"; background-color: #f0f0f0; padding: 8px; font-size: "+("Modern"==a.theme?"12px":"small")+"; text-align: center; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; cursor: default");
"undefined"===typeof a.timeStyle&&(a.timeStyle="color: "+("Modern"==a.theme?"#505050":"Black")+"; min-width: "+Math.max(128/a.columns,64)+"px; height: "+Math.max(80/a.rows,20)+"px; padding: 2px; text-align: center; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; cursor: default; font-size: "+("Modern"==a.theme?"12px":"small"));"undefined"===typeof a.selectedTimeStyle&&(a.selectedTimeStyle="background-color: #3399ff; color: White; padding: 2px");"undefined"===
typeof a.timeFormatter&&(a.timeFormatter=function(a){return a.toString()});"undefined"===typeof a.invertMatrix&&(a.invertMatrix=!1);"undefined"===typeof a.minValue&&(a.minValue=0);"undefined"===typeof a.scrollingHeight&&(a.scrollingHeight="auto")};c.prototype.refresh=function(){for(var a=this,b=this.host.ownerDocument,d=this.host.childNodes.length;0<d--;)this.host.removeChild(this.host.childNodes[d]);d=b.createElement("table");d.cellSpacing="0";d.cellPadding="0";d.setAttribute("style",this.settings.containerStyle);
this.settings.containerClass&&d.setAttribute("class",this.settings.containerClass);var c=null!=this.settings.displayedTime?this.settings.displayedTime:0,e=b.createElement("tr");e.setAttribute("style",this.settings.headerStyle);e.setAttribute("class",this.settings.headerClass);var h=b.createElement("td");h.setAttribute("style","text-align: left; padding-left: 4px");var m=b.createElement("a");m.setAttribute("href","javascript://");m.setAttribute("style","text-decoration: none; color: Gray; font-size: "+
("Modern"==this.settings.theme?"10px":"x-small")+"; cursor: pointer");m.appendChild(b.createTextNode("\u25c4"));m.onclick=function(b){a.setDisplayedValue(c-a.settings.rows*a.settings.columns);b.stopPropagation()};h.appendChild(m);e.appendChild(h);h=b.createElement("td");h.setAttribute("style",this.settings.headerStyle);h.setAttribute("class",this.settings.headerClass);m=b.createElement("span");m.appendChild(this.settings.headerProvider(b,this.settings.displayedTime));h.appendChild(m);e.appendChild(h);
h=b.createElement("td");h.setAttribute("style","text-align: right; padding-right: 4px");m=b.createElement("a");m.setAttribute("href","javascript://");m.setAttribute("style","text-decoration: none; color: Gray; font-size: "+("Modern"==this.settings.theme?"10px":"x-small")+"; cursor: pointer");m.appendChild(b.createTextNode("\u25ba"));m.onclick=function(b){a.setDisplayedValue(c+a.settings.rows*a.settings.columns);b.stopPropagation()};h.appendChild(m);e.appendChild(h);d.appendChild(e);h=b.createElement("tr");
d.appendChild(h);e=b.createElement("td");e.colSpan=3;h.appendChild(e);h=b.createElement("div");h.setAttribute("style","padding: 2px; max-height: "+this.settings.scrollingHeight+"; overflow-y: auto");e.appendChild(h);e=b.createElement("table");e.cellSpacing="0";e.cellPadding="0";h.appendChild(e);for(var h=null!=this.settings.displayedTime?this.settings.displayedTime:0,m=null!=this.selectedTime?this.selectedTime:0,n=this.settings.rows,g=this.settings.columns,k=0;k<n;k++){for(var p=b.createElement("tr"),
j=0;j<g;j++){this.settings.invertMatrix&&(h=c+j*n+k);var l=b.createElement("td");l.setAttribute("style",this.settings.timeStyle);l.setAttribute("class",this.settings.timeClass);var o;try{o=this.settings.timeFormatter(h)}catch(s){o=h.toString()}var q=b.createElement("div");l.appendChild(q);var r=b.createElement("a");r.setAttribute("href","javascript://");r.setAttribute("style","text-decoration: none; display: inline-block; cursor: pointer; color: inherit");r.appendChild(b.createTextNode(o));q.appendChild(r);
null!=m&&h==m&&(q.setAttribute("style",this.settings.selectedTimeStyle),q.setAttribute("class",this.settings.selectedTimeClass),this.selectedElement=q);r.value=h;r.onclick=function(b){a.setValue(b.currentTarget.value);b.stopPropagation()};p.appendChild(l);h++}e.appendChild(p)}this.host.appendChild(d)};c.prototype.getValue=function(){return this.selectedTime};c.prototype.setValue=function(a){if(!a||a<this.settings.minValue)a=this.settings.minValue;this.selectedTime=a;this.refresh();this.settings.selectedTimeChangeHandler&&
this.settings.selectedTimeChangeHandler(a)};c.prototype.setDisplayedValue=function(a){if(!a||a<this.settings.minValue)a=this.settings.minValue;if(null==this.settings.displayedTime||a!=this.settings.displayedTime)this.settings.displayedTime=a,this.refresh(),this.settings.displayedTimeChangeHandler&&this.settings.displayedTimeChangeHandler(a)};return c}();k.Element=g})(z=g.CalendarSelector||(g.CalendarSelector={}));var x;(function(k){k.initialize=function(c,a,b,d){return new g(c,a,b,d)};k.get=function(c){return c.component};
var g=function(){function c(a,b,d,f){this.host=a;this.selectedDate=b;this.settings=d;this.isInitialized=!1;var e="DlhSoft.Controls Calendar DlhSoft.Data.HTML.Controls 5 validate Licensing".split(" ");l[e[5]][e[4]](a,e[0],e[1],e[2],e[3],f,d);this.host.component=this;"undefined"===typeof d&&(d={});this.settings=d;c.initializeSettings(this.settings);"undefined"===typeof b&&(b=new Date);b<this.settings.minValue&&(b=this.settings.minValue);this.selectedDates=(this.selectedDate=b)?[this.selectedDate]:[];
this.selectedDateRanges=(this.selectedDateRange=this.selectedDate?{start:this.selectedDate,finish:this.selectedDate}:null)?[this.selectedDateRange]:null;null==this.settings.displayedDate&&(this.settings.displayedDate=this.selectedDate);this.settings.displayedDate<this.settings.minValue&&(this.settings.displayedDate=this.settings.minValue);this.refresh();this.isInitialized=!0}c.initializeSettings=function(a){"undefined"===typeof a.theme&&(a.theme="Modern");"undefined"===typeof a.isReadOnly&&(a.isReadOnly=
!1);"undefined"===typeof a.isTodayLinkVisible&&(a.isTodayLinkVisible=!1);"undefined"===typeof a.defaultTimeOfDay&&(a.defaultTimeOfDay=0);"undefined"===typeof a.allowMultipleSelection&&(a.allowMultipleSelection=!1);"undefined"===typeof a.allowRangeSelection&&(a.allowRangeSelection=!1);"undefined"===typeof a.monthYearHeaderStyle&&(a.monthYearHeaderStyle="color: "+("Modern"==a.theme?"#505050":"Black")+"; background-color: #f0f0f0; padding: 8px; font-size: "+("Modern"==a.theme?"12px":"small")+"; text-align: center; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; cursor: default");
"undefined"===typeof a.dayOfWeekHeaderStyle&&(a.dayOfWeekHeaderStyle="color: "+("Modern"==a.theme?"#505050":"Black")+"; padding: 3px; padding-top: 4px; padding-bottom: 2px; border-bottom: 1px solid "+("Modern"==a.theme?"#e0e0e0":"Silver")+"; font-size: "+("Modern"==a.theme?"12px":"small")+"; text-align: center; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; cursor: default");"undefined"===typeof a.dayStyle&&(a.dayStyle="color: "+("Modern"==a.theme?"#505050":
"Black")+"; min-width: 24px; padding: 2px; text-align: center; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; cursor: default; font-size: "+("Modern"==a.theme?"12px":"small")+(a.allowMultipleSelection||a.allowRangeSelection?"; height: "+("Modern"==a.theme?"18px":"20px"):""));"undefined"===typeof a.otherMonthDayStyle&&(a.otherMonthDayStyle="color: "+("Modern"==a.theme?"#c0c0c0":"Silver"));"undefined"===typeof a.selectedDayStyle&&(a.selectedDayStyle="background-color: #3399ff; color: White; padding: 2px");
"undefined"===typeof a.disabledDayStyle&&(a.disabledDayStyle="color: "+("Modern"==a.theme?"#c0c0c0":"Silver"));"undefined"===typeof a.todayLinkStyle&&(a.todayLinkStyle="color: "+("Modern"==a.theme?"#505050":"Black")+"; padding: 4px; border-top: 1px solid "+("Modern"==a.theme?"#e0e0e0":"Silver")+"; font-size: "+("Modern"==a.theme?"12px":"small")+"; text-align: center; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; cursor: default");"undefined"===typeof a.todayString&&
(a.todayString="Today");"undefined"===typeof a.months&&(a.months="January February March April May June July August September October November December".split(" "));"undefined"===typeof a.daysOfWeek&&(a.daysOfWeek="Su Mo Tu We Th Fr Sa".split(" "));"undefined"===typeof a.monthRows&&(a.monthRows=1);1>a.monthRows&&(a.monthRows=1);"undefined"===typeof a.monthColumns&&(a.monthColumns=1);1>a.monthColumns&&(a.monthColumns=1);"undefined"===typeof a.monthCellSpacing&&(a.monthCellSpacing="0");"undefined"===
typeof a.applyMonthStyleForSingleCell&&(a.applyMonthStyleForSingleCell=!1);"undefined"===typeof a.applyNextMonthButtonToLastColumn&&(a.applyNextMonthButtonToLastColumn=!0);"undefined"===typeof a.applyNextMonthButtonToLastRow&&(a.applyNextMonthButtonToLastRow=!1);"undefined"===typeof a.containerStyle&&(a.containerStyle=("Modern"==a.theme?"":"border: 1px solid #707070; ")+"font-family: Arial"+("undefined"===typeof a.monthCellStyle&&(1<a.monthRows||1<a.monthColumns||a.applyMonthStyleForSingleCell)?"Modern"==
a.theme?"; margin: -2px":"; padding: 2px":"Modern"==a.theme?"; border: 1px solid #e0e0e0":""));"undefined"===typeof a.monthCellStyle&&(a.monthCellStyle="margin: 2px; border: 1px solid "+("Modern"==a.theme?"#e0e0e0":"Silver"));"undefined"===typeof a.calendarSelectorLevels&&(a.calendarSelectorLevels=0);"undefined"===typeof a.calendarSelectorPopupStyle&&(a.calendarSelectorPopupStyle="background-color: White; border: 1px solid "+("Modern"==a.theme?"#e0e0e0":"#707070")+"; font-family: Arial");"undefined"===
typeof a.minValue&&(a.minValue=new Date(101,0,1))};c.prototype.refresh=function(){for(var a=this,b=this.host.ownerDocument,d=this.host.childNodes.length;0<d--;)this.host.removeChild(this.host.childNodes[d]);var d=b.createElement("table"),f,e;d.cellSpacing=this.settings.monthCellSpacing;d.cellPadding="0";d.setAttribute("style",this.settings.containerStyle);this.settings.containerClass&&d.setAttribute("class",this.settings.containerClass);var h=c.getDate(null!=this.settings.displayedDate?this.settings.displayedDate:
null!=this.selectedDate?this.selectedDate:new Date);this.settings.defaultTimeOfDay>=c.dayDuration&&(h=c.subtractDay(h));f=h;for(var m=0;m<this.settings.monthRows;m++){var n=b.createElement("tr");d.appendChild(n);for(var g=0;g<this.settings.monthColumns;g++){e=b.createElement("td");n.appendChild(e);var k=b.createElement("table");k.cellSpacing="0";k.cellPadding="0";if(1<this.settings.monthRows||1<this.settings.monthColumns||this.settings.applyMonthStyleForSingleCell)k.setAttribute("style",this.settings.monthCellStyle),
k.setAttribute("class",this.settings.monthCellClass);e.appendChild(k);e=b.createElement("tr");e.setAttribute("style",this.settings.monthYearHeaderStyle);e.setAttribute("class",this.settings.monthYearHeaderClass);var l=b.createElement("td");l.setAttribute("style","text-align: left; padding-left: 4px");if(0==m&&0==g){var j=b.createElement("a");j.setAttribute("href","javascript://");j.setAttribute("style","text-decoration: none; color: Gray; font-size: "+("Modern"==this.settings.theme?"10px":"x-small")+
"; cursor: pointer");j.appendChild(b.createTextNode("\u25c4"));j.onclick=function(b){for(var d=h;d.getMonth()==h.getMonth();)d=c.subtractDay(d);a.setDisplayedValue(d);b.stopPropagation()};l.appendChild(j)}e.appendChild(l);l=b.createElement("td");l.setAttribute("style",this.settings.monthYearHeaderStyle);l.setAttribute("class",this.settings.monthYearHeaderClass);l.colSpan=5;var j=b.createElement("span"),p=b.createTextNode(this.settings.months[f.getMonth()]+" "+f.getFullYear());if(1>this.settings.calendarSelectorLevels||
0<m||0<g)j.appendChild(p);else{var o=b.createElement("a");o.setAttribute("href","javascript://");o.setAttribute("style","text-decoration: none; display: inline-block; cursor: pointer; color: inherit");o.appendChild(p);j.appendChild(o);var q=b.createElement("div");q.setAttribute("style","display: none; position: absolute; margin-left: -40px");o.appendChild(q);var s=b.createElement("div");s.setAttribute("style",this.settings.calendarSelectorPopupStyle);this.settings.calendarSelectorPopupClass&&s.setAttribute("class",
this.settings.calendarSelectorPopupClass);q.appendChild(s);o.onclick=function(b){if((b.target||b.srcElement)==o){if("none"!=q.style.display)q.style.display="none";else{var d=12*h.getFullYear()+h.getMonth(),c={theme:a.settings.theme,headerProvider:function(b,d){var c=b.createTextNode(Math.floor(d/12).toString());if(2>a.settings.calendarSelectorLevels)return c;var e=b.createElement("a");e.setAttribute("href","javascript://");e.setAttribute("style","text-decoration: none; display: inline-block; cursor: pointer; color: inherit");
e.appendChild(c);var h=b.createElement("div");h.setAttribute("style","display: none; position: absolute; margin-left: -10px");e.appendChild(h);var m=b.createElement("div");m.setAttribute("style",a.settings.calendarSelectorPopupStyle);a.settings.calendarSelectorPopupClass&&m.setAttribute("class",a.settings.calendarSelectorPopupClass);h.appendChild(m);e.onclick=function(b){if((b.target||b.srcElement)==e){if("none"!=h.style.display)h.style.display="none";else{var c=Math.floor(d/12)-1;h.style.display=
"block";var g=z.initialize(m,c,{rows:5,columns:2,invertMatrix:!0,headerProvider:function(b,d){var c=b.createTextNode((d+1).toString()+" - "+(d+10).toString());if(3>a.settings.calendarSelectorLevels)return c;var e=b.createElement("a");e.setAttribute("href","javascript://");e.setAttribute("style","text-decoration: none; display: inline-block; cursor: pointer; color: inherit");e.appendChild(c);var f=b.createElement("div");f.setAttribute("style","display: none; position: absolute; margin-left: -10px");
e.appendChild(f);var h=b.createElement("div");h.setAttribute("style",a.settings.calendarSelectorPopupStyle);a.settings.calendarSelectorPopupClass&&h.setAttribute("class",a.settings.calendarSelectorPopupClass);f.appendChild(h);e.onclick=function(a){if((a.target||a.srcElement)==e){if("none"!=f.style.display)f.style.display="none";else{var b=Math.floor(d/10);f.style.display="block";z.initialize(h,b,{rows:5,columns:2,invertMatrix:!0,headerProvider:function(a,b){return a.createTextNode((10*b+1).toString()+
" - "+(10*(b+10)).toString())},timeFormatter:function(a){return(10*a+1).toString()+"-"+(10*a+10).toString().substr((10*a+10).toString().length-2)},minValue:10},"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase.").settings.selectedTimeChangeHandler=function(a){g.setDisplayedValue(10*a)}}a.stopPropagation()}};return e},timeFormatter:function(a){return(a+1).toString()},minValue:100},"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase.");
g.settings.selectedTimeChangeHandler=function(a){f.setDisplayedValue(12*(a+1))}}b.stopPropagation()}};return e},timeFormatter:function(b){return a.settings.months[b-12*Math.floor(b/12)]},minValue:1212};q.style.display="block";var f=z.initialize(s,d,c,"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase.");f.settings.selectedTimeChangeHandler=function(b){a.setDisplayedValue(new Date(Math.floor(b/12),b-12*Math.floor(b/
12),1))}}b.stopPropagation()}}}l.appendChild(j);e.appendChild(l);l=b.createElement("td");l.setAttribute("style","text-align: right; padding-right: 4px");if((!this.settings.applyNextMonthButtonToLastRow?0==m:m==this.settings.monthRows-1)&&(this.settings.applyNextMonthButtonToLastColumn?g==this.settings.monthColumns-1:0==g))j=b.createElement("a"),j.setAttribute("href","javascript://"),j.setAttribute("style","text-decoration: none; color: Gray; font-size: "+("Modern"==this.settings.theme?"10px":"x-small")+
"; cursor: pointer"),j.appendChild(b.createTextNode("\u25ba")),j.onclick=function(b){for(var d=h;d.getMonth()==h.getMonth();)d=c.addDay(d);a.setDisplayedValue(d);b.stopPropagation()},l.appendChild(j);e.appendChild(l);k.appendChild(e);l=b.createElement("tr");for(e=0;7>e;e++)j=b.createElement("td"),j.setAttribute("style",this.settings.dayOfWeekHeaderStyle),j.setAttribute("class",this.settings.dayOfWeekHeaderClass),j.appendChild(b.createTextNode(this.settings.daysOfWeek[e])),l.appendChild(j);k.appendChild(l);
l=null!=this.selectedDate?c.getDate(this.selectedDate):null;null!=l&&this.settings.defaultTimeOfDay>=c.dayDuration&&(l=c.subtractDay(l));j=f.getMonth();e=c.getFirstDayOfMonth(f);p=c.getPreviousWeekStart(e);for(f=0;6>f;f++){var r=b.createElement("tr");for(e=0;7>e;e++){var t=b.createElement("td");t.setAttribute("style",this.settings.dayStyle);t.setAttribute("class",this.settings.dayClass);var u=p.getDate().toString(),w=b.createElement("span");t.appendChild(w);var v=b.createElement("span");w.appendChild(v);
var B="undefined"!==typeof this.settings.disabledDateSelector&&this.settings.disabledDateSelector(p),x=p.getMonth()==j,y=b.createElement("a");y.setAttribute("href","javascript://");y.setAttribute("style","text-decoration: none; display: inline-block; cursor: "+(this.settings.isReadOnly||B||!x&&(this.settings.allowRangeSelection||this.settings.allowMultipleSelection)?"default":"pointer")+"; color: inherit; width: 20px");y.appendChild(b.createTextNode(u));v.appendChild(y);if(B)w.setAttribute("style",
this.settings.disabledDayStyle),w.setAttribute("class",this.settings.disabledDayClass);else if(x){if(u=l&&Math.abs(p.valueOf()-l.valueOf())<=c.hourDuration||this.isValueSelected(p))w.setAttribute("style",this.settings.selectedDayStyle),w.setAttribute("class",this.settings.selectedDayClass);this.settings.highlightingStyleSelector&&(w=this.settings.highlightingStyleSelector(p,u))&&v.setAttribute("style",w);this.settings.highlightingClassSelector&&(w=this.settings.highlightingClassSelector(p,u))&&v.setAttribute("class",
w)}else v.setAttribute("style",this.settings.otherMonthDayStyle),v.setAttribute("class",this.settings.otherMonthDayClass);!this.settings.isReadOnly&&!B&&(y.value=c.addTimeOfDay(p,this.settings.defaultTimeOfDay),!this.settings.allowMultipleSelection&&!this.settings.allowRangeSelection?y.onclick=function(b){var d=b.currentTarget.value;a.setDisplayedValue(d);a.setValue(d);b.stopPropagation()}:this.settings.allowRangeSelection?x&&(y.onmousedown=function(b){var d=b.currentTarget.value;a.draggingFromDate=
d;a.setValue(d);b.preventDefault()},y.onmouseover=function(b){if(a.draggingFromDate&&(b=b.currentTarget.value,!a.draggingToDate||b.valueOf()!=a.draggingToDate.valueOf()))a.draggingToDate=b,a.setValueRange({start:a.draggingFromDate,finish:a.draggingToDate})}):x&&(y.onclick=function(b){a.invertValueSelection(b.currentTarget.value);b.stopPropagation()}));r.appendChild(t);p=c.addDay(p)}k.appendChild(r)}f=p}}!this.settings.isReadOnly&&this.settings.isTodayLinkVisible&&(m=b.createElement("tr"),n=b.createElement("td"),
n.colSpan=7,n.setAttribute("style",this.settings.todayLinkStyle),n.setAttribute("class",this.settings.todayLinkClass),g=b.createElement("a"),g.setAttribute("href","javascript://"),g.setAttribute("style","text-decoration: none; color: inherit; cursor: pointer"),g.appendChild(b.createTextNode(this.settings.todayString)),n.appendChild(g),g.value=c.addTimeOfDay(c.getDate(new Date),this.settings.defaultTimeOfDay),g.onclick=function(b){var d=b.currentTarget.value;a.setDisplayedValue(d);a.setValue(d);b.stopPropagation()},
m.appendChild(n),d.appendChild(m));this.host.appendChild(d);this.isInitialized||b.addEventListener("mouseup",function(){a.draggingToDate&&delete a.draggingToDate;a.draggingFromDate&&delete a.draggingFromDate},!0)};c.prototype.getValue=function(){return this.selectedDate};c.prototype.setValue=function(a){null!=a&&a<this.settings.minValue&&(a=this.settings.minValue);if(null==this.selectedDate&&null!=a||null!=this.selectedDate&&null==a||null!=this.selectedDate&&null!=a&&a.valueOf()!=this.selectedDate.valueOf()||
this.settings.forceSetOnClick)this.isDuringInternalSetValue=!0,this.selectedDate=a,this.setValues(null!=a?[a]:[]),delete this.isDuringInternalSetValue,null==this.settings.displayedDate&&null!=a?(this.settings.displayedDate=a,this.refresh(),this.settings.displayedDateChangeHandler&&this.settings.displayedDateChangeHandler(a)):this.refresh(),this.settings.selectedDateChangeHandler&&this.settings.selectedDateChangeHandler(a)};c.prototype.setDisplayedValue=function(a){null!=a&&a<this.settings.minValue&&
(a=this.settings.minValue);if(null==this.settings.displayedDate||a.valueOf()!=this.settings.displayedDate.valueOf())this.settings.displayedDate=a,this.refresh(),this.settings.displayedDateChangeHandler&&this.settings.displayedDateChangeHandler(a)};c.prototype.getValues=function(){return this.selectedDates};c.prototype.setValues=function(a){this.selectedDates=a;0<a.length&&(this.isDuringInternalSetValues=!0,this.selectedDate=a[0],this.setValueRanges([{start:this.selectedDate,finish:this.selectedDate}]),
delete this.isDuringInternalSetValues)};c.prototype.getValueRange=function(){return this.selectedDateRange};c.prototype.setValueRange=function(a){a.finish||(a.finish=a.start);if(a.finish<a.start){var b=a.finish;a.finish=a.start;a.start=b}this.setValueRanges([a])};c.prototype.getValueRanges=function(){return this.selectedDateRanges};c.prototype.setValueRanges=function(a){this.selectedDateRanges=a;if(0<a.length&&(this.selectedDateRange=a[0],!this.isDuringInternalSetValues)){this.selectedDates=[];for(var b=
0;b<a.length;b++){var d=a[b];d.finish||(d.finish=d.start);if(d.finish<d.start){var f=d.finish;d.finish=d.start;d.start=f}for(f=d.start;f<=d.finish;f=c.addDay(f))this.selectedDates.push(f)}this.selectedDate=this.selectedDateRange.start}this.isDuringInternalSetValue||(this.refresh(),this.settings.selectedDateChangeHandler&&this.settings.selectedDateChangeHandler(this.selectedDate));this.settings.selectionChangedHandler&&this.settings.selectionChangedHandler()};c.prototype.isValueSelected=function(a){for(var a=
a.valueOf(),b=0;b<this.selectedDates.length;b++)if(this.selectedDates[b].valueOf()==a)return!0;return!1};c.prototype.invertValueSelection=function(a){for(var b=a.valueOf(),d=0;d<this.selectedDates.length;d++)if(this.selectedDates[d].valueOf()==b){1<this.selectedDates.length&&(this.selectedDates.splice(d,1),this.setValues(this.selectedDates));return}this.selectedDates.push(a);this.setValues(this.selectedDates)};c.getDate=function(a){var b=a.getTimezoneOffset()*c.minuteDuration;return new Date(Math.floor((a.valueOf()-
b)/c.dayDuration)*c.dayDuration+b)};c.getPreviousWeekStart=function(a){for(var b=a=c.getDate(a);0<a.getDay();)a=c.subtractDay(a);if(b.valueOf()-a.valueOf()>6.5*c.dayDuration)for(b=0;7>b;b++)a=c.addDay(a);return a};c.addDay=function(a){var b=a.getTimezoneOffset()*c.minuteDuration,a=new Date(a.valueOf()-b+c.dayDuration),b=a.getTimezoneOffset()*c.minuteDuration;return new Date(a.valueOf()+b)};c.subtractDay=function(a){return c.getDate(new Date(a.valueOf()-c.dayDuration))};c.addTimeOfDay=function(a,b){var d=
a.getTimezoneOffset()*c.minuteDuration,a=new Date(a.valueOf()-d+b),d=a.getTimezoneOffset()*c.minuteDuration;return new Date(a.valueOf()+d)};c.getFirstDayOfMonth=function(a){for(a=c.getDate(a);1<a.getDate();)a=c.subtractDay(a);return a};c.secondDuration=1E3;c.minuteDuration=60*c.secondDuration;c.hourDuration=60*c.minuteDuration;c.dayDuration=24*c.hourDuration;c.weekDuration=7*c.dayDuration;c.initialSundayDateTimeValue=3*c.dayDuration;return c}();k.Element=g})(x=g.Calendar||(g.Calendar={}));var v;(function(g){g.initialize=
function(c,a,b,d){return new j(c,a,b,d)};g.get=function(c){return c.component};var j=function(){function c(a,b,d,f){this.host=a;this.value=b;this.settings=d;this.isInitialized=!1;this.dropDownButtonElement=null;var e="DlhSoft.Controls DatePicker DlhSoft.Data.HTML.Controls 5 validate Licensing".split(" ");l[e[5]][e[4]](a,e[0],e[1],e[2],e[3],f,d);this.host.component=this;"undefined"===typeof d&&(d={});this.settings=d;c.initializeSettings(this.settings);var h=this.host.ownerDocument;if(this.inputHost=
a instanceof HTMLInputElement?a:null){if(null==b)try{b=this.settings.dateTimeParser(this.inputHost.value)}catch(m){}a=h.createElement("span");this.inputHost.parentElement&&this.inputHost.parentElement.insertBefore(a,this.inputHost);this.host=a;l[e[5]][e[4]](a,e[0],e[1],e[2],e[3],f,d);this.host.component=this}"undefined"===typeof b&&(b=d.isNullValueAccepted?null:new Date);this.value=b;this.refresh();this.isInitialized=!0}c.initializeSettings=function(a){"undefined"===typeof a.isTodayLinkVisible&&(a.isTodayLinkVisible=
!0);"undefined"===typeof a.calendarSelectorLevels&&(a.calendarSelectorLevels=Infinity);"undefined"===typeof a.popupStyle&&(a.popupStyle="background-color: White; border: 1px solid "+("Modern"==a.theme?"#e0e0e0":"#707070")+"; font-family: Arial");"undefined"===typeof a.calendarSelectorPopupStyle&&(a.calendarSelectorPopupStyle=a.popupStyle);"undefined"===typeof a.calendarSelectorPopupClass&&(a.calendarSelectorPopupClass=a.popupClass);x.Element.initializeSettings(a);"undefined"===typeof a.openDropDownOnInputClick&&
(a.openDropDownOnInputClick=!0);"undefined"===typeof a.dateTimeFormatter&&(a.dateTimeFormatter=function(b){if(b==null&&a.isNullValueAccepted)return"";var d=function(a,b){b===void 0&&(b=2);for(var d=a.toString();d.length<b;)d="0"+d;return d},c=b.getFullYear(),e=b.getMonth()+1,h=b.getDate(),m=b.getHours(),b=b.getMinutes();return d(e)+"/"+d(h)+"/"+d(c,4)+" "+d(m)+":"+d(b)});"undefined"===typeof a.dateTimeParser&&(a.dateTimeParser=function(b){if(typeof b==="undefined"||b==null||b.length==0)return a.isNullValueAccepted?
null:new Date;b=new Date(b);return isNaN(b.valueOf())||b.getFullYear()<=0?new Date:b});"undefined"===typeof a.isNullValueAccepted&&(a.isNullValueAccepted=!0);"undefined"===typeof a.isDropDownButtonVisible&&(a.isDropDownButtonVisible=!1);"undefined"===typeof a.dropDownButtonDefinition&&(a.dropDownButtonDefinition="<svg style='display: inline-block; margin-left: 4px; cursor: pointer; vertical-align: middle' width='12' height='12'><rect x='0' y='0' width='12' height='3' style='fill: #707070; stroke: #707070; stroke-width: 0.65'/><rect x='0' y='3' width='12' height='9' style='fill: none; stroke: #707070; stroke-width: 0.65'/><line x1='3' y1='3' x2='3' y2='12' style='stroke: #707070; stroke-width: 0.65'/><line x1='6' y1='3' x2='6' y2='12' style='stroke: #707070; stroke-width: 0.65'/><line x1='9' y1='3' x2='9' y2='12' style='stroke: #707070; stroke-width: 0.65'/><line x1='0' y1='6' x2='12' y2='6' style='stroke: #707070; stroke-width: 0.65'/><line x1='0' y1='9' x2='12' y2='9' style='stroke: #707070; stroke-width: 0.65'/></svg>");
"undefined"===typeof a.inputStyle&&"Modern"==a.theme&&(a.inputStyle="border: 1px solid #e0e0e0; background-color: White; color: #505050; font-family: Arial; font-size: 12px; padding: 4px")};c.prototype.refresh=function(){for(var a=this,b=this.host.ownerDocument,d=this.host.childNodes.length;0<d--;)this.host.removeChild(this.host.childNodes[d]);d=b.createElement("div");d.setAttribute("style","margin-top: -1px");if(this.inputHost)c=b.createElement("span"),c.setAttribute("style","display: inline-block"),
c.appendChild(d),this.host.appendChild(c),d=this.host.firstChild,this.popupElement=d.firstChild,this.inputHost.parentElement&&this.inputHost.parentElement.removeChild(this.inputHost),this.popupElement&&this.popupElement.parentElement&&this.popupElement.parentElement.insertBefore(this.inputHost,this.popupElement),this.inputElement=this.inputHost;else{var c=b.createElement("span");c.setAttribute("style","display: inline-block");var e=b.createElement("input");c.appendChild(e);c.appendChild(d);this.host.appendChild(c);
d=this.host.firstChild;this.inputElement=d.firstChild;this.popupElement=d.childNodes[1]}this.popupElement&&(d=b.createElement("div"),d.setAttribute("style",this.settings.popupStyle),this.settings.popupClass&&d.setAttribute("class",this.settings.popupClass),this.popupElement.appendChild(d));this.inputElement&&("undefined"!==typeof this.settings.inputStyle&&this.inputElement.setAttribute("style",this.settings.inputStyle+(this.inputElement.getAttribute("style")?";"+this.inputElement.getAttribute("style"):
"")),this.settings.inputClass&&this.inputElement.setAttribute("class",this.settings.inputClass));this.settings.isDropDownButtonVisible&&(this.dropDownButtonElement=b.createElement("span"),this.dropDownButtonElement.setAttribute("style","display: inline-block"),this.dropDownButtonElement.innerHTML=this.settings.dropDownButtonDefinition,this.popupElement&&this.popupElement.parentElement&&this.popupElement.parentElement.insertBefore(this.dropDownButtonElement,this.popupElement));this.inputElement&&(this.inputElement.DatePicker=
this,this.setValue(this.value),this.settings.isReadOnly&&this.inputElement.setAttribute("readonly","readonly"));this.popupElement&&(d=this.popupElement.firstChild,this.calendarHost=b.createElement("div"),d.appendChild(this.calendarHost));this.calendarHost&&(this.calendar=new x.Element(this.calendarHost,this.value,{theme:this.settings.theme,isReadOnly:this.settings.isReadOnly,displayedDate:this.settings.displayedDate,defaultTimeOfDay:this.settings.defaultTimeOfDay,isTodayLinkVisible:this.settings.isTodayLinkVisible,
containerStyle:null,monthYearHeaderStyle:this.settings.monthYearHeaderStyle,monthYearHeaderClass:this.settings.monthYearHeaderClass,dayOfWeekHeaderStyle:this.settings.dayOfWeekHeaderStyle,dayOfWeekHeaderClass:this.settings.dayOfWeekHeaderClass,dayStyle:this.settings.dayStyle,dayClass:this.settings.dayClass,otherMonthDayStyle:this.settings.otherMonthDayStyle,otherMonthDayClass:this.settings.otherMonthDayClass,selectedDayStyle:this.settings.selectedDayStyle,selectedDayClass:this.settings.selectedDayClass,
disabledDayStyle:this.settings.disabledDayStyle,disabledDayClass:this.settings.disabledDayClass,todayLinkStyle:this.settings.todayLinkStyle,todayLinkClass:this.settings.todayLinkClass,monthRows:this.settings.monthRows,monthColumns:this.settings.monthColumns,monthCellSpacing:this.settings.monthCellSpacing,monthCellStyle:this.settings.monthCellStyle,monthCellClass:this.settings.monthCellClass,highlightingStyleSelector:this.settings.highlightingStyleSelector,highlightingClassSelector:this.settings.highlightingClassSelector,
disabledDateSelector:this.settings.disabledDateSelector,applyMonthStyleForSingleCell:this.settings.applyMonthStyleForSingleCell,applyNextMonthButtonToLastColumn:!0,applyNextMonthButtonToLastRow:!1,allowMultipleSelection:!1,allowRangeSelection:!1,calendarSelectorLevels:this.settings.calendarSelectorLevels,calendarSelectorPopupStyle:this.settings.calendarSelectorPopupStyle,calendarSelectorPopupClass:this.settings.calendarSelectorPopupClass,minValue:this.settings.minValue,months:this.settings.months,
daysOfWeek:this.settings.daysOfWeek,todayString:this.settings.todayString,forceSetOnClick:!0,selectedDateChangeHandler:function(b){a.setValue(b);a.settings.selectedDateChangeHandler&&a.settings.selectedDateChangeHandler(b)}},"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase."));if(this.inputElement&&(this.inputElement.addEventListener("change",function(){a.refreshValue()},!0),this.dropDownButtonElement&&(this.dropDownButtonElement.onmousedown=
function(){a.recordClick();a.refreshValue();setTimeout(function(){a.toggleDropDown()},0)}),this.popupElement))this.popupElement.style.position="absolute",this.popupElement.style.display="none",this.inputElement.addEventListener("focus",function(){if(a.settings.openDropDownOnInputClick){a.openDropDown();a.focusValue=a.inputElement.value}},!0),this.inputElement.addEventListener("blur",function(){a.settings.openDropDownOnInputClick&&typeof a.focusValue!=="undefined"&&delete a.focusValue},!0),this.inputElement.addEventListener("keydown",
function(b){b.keyCode==13?a.settings.openDropDownOnInputClick&&a.refreshValue():a.closeDropDown()},!0),this.inputElement.addEventListener("mousedown",function(){setTimeout(function(){if(a.settings.openDropDownOnInputClick&&!(typeof a.focusValue!=="undefined"&&a.inputElement.value!=a.focusValue)){a.refreshValue();a.openDropDown()}},0);a.recordClick()},!0),this.inputElement.addEventListener("input",function(){a.closeDropDown()},!0),this.popupElement.onmousedown=function(){a.recordClick()},b.addEventListener("mousedown",
function(){setTimeout(function(){a.isDuringRecordedClick()||a.closeDropDown()},0)},!0),b.addEventListener("mousewheel",function(){a.closeDropDown()},!0),b.addEventListener("DOMMouseScroll",function(){a.closeDropDown()},!0)};c.prototype.recordClick=function(){var a=this;this.isDuringClick||(this.isDuringClick=!0,setTimeout(function(){delete a.isDuringClick},0))};c.prototype.isDuringRecordedClick=function(){return"undefined"!==typeof this.isDuringClick};c.prototype.getValue=function(){return this.value};
c.prototype.setValue=function(a){this.resetValue(a)};c.prototype.setDisplayedValue=function(a){this.calendar&&this.calendar.setDisplayedValue(a)};c.prototype.refreshValue=function(){this.resetValue()};c.prototype.resetValue=function(a){if(!this.isDuringInternalSetValue){this.isDuringInternalSetValue=!0;this.closeDropDown();var b=this.value;try{this.value=null!=a?a:this.settings.dateTimeParser(this.inputElement.value)}catch(d){}null!=this.value&&this.value<this.settings.minValue&&(this.value=this.settings.isNullValueAccepted?
null:this.settings.minValue);this.settings.disabledDateSelector&&(null!=this.value&&this.settings.disabledDateSelector(this.value))&&(this.value=this.settings.isNullValueAccepted?null:new Date);var c;try{c=this.settings.dateTimeFormatter(this.value)}catch(e){c=""}if(c!=this.inputElement.value&&(this.inputElement.value=c,this.isInitialized))try{var h=this.inputElement.ownerDocument.createEvent("HTMLEvents");h.initEvent("change",!0,!0);this.inputElement.dispatchEvent(h)}catch(m){}if(this.value&&!b||
!this.value&&b||this.value&&b&&this.value.valueOf()!=b.valueOf())this.calendar&&(this.calendar.selectedDate=this.value,this.calendar.refresh()),this.settings.valueChangeHandler&&this.settings.valueChangeHandler(this.value);delete this.isDuringInternalSetValue}};c.prototype.openDropDown=function(){this.isOpen||this.toggleDropDown()};c.prototype.closeDropDown=function(){this.isOpen&&this.toggleDropDown()};c.prototype.toggleDropDown=function(){var a=this;(this.isOpen=!this.isOpen)&&this.value&&this.setDisplayedValue(this.value);
var b=function(){var b=a.inputElement.getBoundingClientRect();a.popupElement.style.position="fixed";a.popupElement.style.zIndex="1";a.popupElement.style.left=b.left+"px";a.popupElement.style.top=b.top+b.height+"px";a.popupElement.style.display=a.isOpen?"block":"none";var d=a.popupElement.getBoundingClientRect();d.bottom>a.popupElement.ownerDocument.documentElement.clientHeight&&b.top>=d.height&&(a.popupElement.style.top=b.top-d.height+2+"px");d.right>a.popupElement.ownerDocument.documentElement.clientWidth&&
a.popupElement.ownerDocument.documentElement.clientWidth>=d.width&&(a.popupElement.style.left=a.popupElement.ownerDocument.documentElement.clientWidth-d.width+"px")};b();this.isOpen&&this.settings.dropDownOpenedHandler?this.settings.dropDownOpenedHandler():!this.isOpen&&this.settings.dropDownClosedHandler&&this.settings.dropDownClosedHandler();if(this.isOpen){var d=this.host.ownerDocument.documentElement.clientWidth,c=this.host.ownerDocument.documentElement.clientHeight,e=this.host.getBoundingClientRect();
this.positionChangeHandlerTimer=setInterval(function(){var h=a.host.ownerDocument.documentElement.clientWidth,m=a.host.ownerDocument.documentElement.clientHeight,g=a.host.getBoundingClientRect();h!=d||m!=c?a.closeDropDown():(g.left!=e.left||g.top!=e.top||g.width!=e.width||g.height!=e.height)&&b();d=h;c=m;e=g},100)}else this.positionChangeHandlerTimer&&(clearInterval(this.positionChangeHandlerTimer),delete this.positionChangeHandlerTimer)};return c}();g.Element=j})(v=g.DatePicker||(g.DatePicker={}));
var o;(function(g){var j=function(){function c(a,b,d,f,e){this.host=a;this.selectedTime=b;this.header=d;this.settings=f;this.isInitialized=!1;var h="DlhSoft.Controls CalendarDay DlhSoft.Data.HTML.Controls 5 validate Licensing".split(" ");l[h[5]][h[4]](a,h[0],h[1],h[2],h[3],e,f);this.host.component=this;"undefined"===typeof f&&(f={});"undefined"!==typeof d&&"undefined"===typeof f.header&&(f.header=d);this.settings=f;c.initializeSettings(this.settings);"undefined"===typeof b&&(a=new Date,b=(new Date(a.valueOf()-
a.getTimezoneOffset()*c.minuteDuration)).getTime(),b-=Math.floor(b/c.dayDuration)*c.dayDuration);this.selectedTime=b;this.refresh();this.isInitialized=!0}c.initializeSettings=function(a){"undefined"===typeof a.theme&&(a.theme="Modern");"undefined"===typeof a.isReadOnly&&(a.isReadOnly=!1);"undefined"===typeof a.isNowLinkVisible&&(a.isNowLinkVisible=!1);"undefined"===typeof a.header&&(a.header="Time of day");"undefined"===typeof a.isHeaderVisible&&(a.isHeaderVisible=!0);"undefined"===typeof a.headerStyle&&
(a.headerStyle="color: "+("Modern"==a.theme?"#505050":"Black")+"; background-color: #f0f0f0; padding: 8px; font-size: "+("Modern"==a.theme?"12px":"small")+"; text-align: center; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; cursor: default");"undefined"===typeof a.timeStyle&&(a.timeStyle="color: "+("Modern"==a.theme?"#505050":"Black")+"; min-width: 24px; padding: 2px; text-align: center; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; cursor: default; font-size: "+
("Modern"==a.theme?"12px":"small"));"undefined"===typeof a.selectedTimeStyle&&(a.selectedTimeStyle="background-color: #3399ff; color: White; padding: 2px");"undefined"===typeof a.disabledTimeStyle&&(a.disabledTimeStyle="color: "+("Modern"==a.theme?"#c0c0c0":"Silver"));"undefined"===typeof a.nowLinkStyle&&(a.nowLinkStyle="color: "+("Modern"==a.theme?"#505050":"Black")+"; padding: 4px; border-top: 1px solid "+("Modern"==a.theme?"#e0e0e0":"Silver")+"; font-size: "+("Modern"==a.theme?"12px":"small")+
"; text-align: center; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; cursor: default");"undefined"===typeof a.nowString&&(a.nowString="Now");"undefined"===typeof a.hourDivisions?a.hourDivisions=2:0>=a.hourDivisions&&(a.hourDivisions=1);"undefined"===typeof a.timeFormatter&&(a.timeFormatter=function(a){var d=Math.floor(a/c.hourDuration),a=Math.floor((a-d*c.hourDuration)/c.minuteDuration),f=function(a,b){b===void 0&&(b=2);for(var d=a.toString();d.length<
b;)d="0"+d;return d};return f(d)+":"+f(a)});"undefined"===typeof a.hourColumns?a.hourColumns=4:0>=a.hourColumns&&(a.hourColumns=1);"undefined"===typeof a.scrollingHeight&&(a.scrollingHeight="auto")};c.prototype.refresh=function(){for(var a=this,b=this.host.ownerDocument,d=this.host.childNodes.length;0<d--;)this.host.removeChild(this.host.childNodes[d]);d=b.createElement("table");d.cellSpacing="0";d.cellPadding="0";d.setAttribute("style",this.settings.containerStyle);this.settings.containerClass&&
d.setAttribute("class",this.settings.containerClass);if(this.settings.isHeaderVisible){var f=b.createElement("tr");f.setAttribute("style",this.settings.headerStyle);f.setAttribute("class",this.settings.headerClass);var e=b.createElement("td");e.setAttribute("style",this.settings.headerStyle);e.setAttribute("class",this.settings.headerClass);var h=b.createElement("span");h.appendChild(b.createTextNode(this.settings.header));e.appendChild(h);f.appendChild(e);d.appendChild(f)}e=b.createElement("tr");
d.appendChild(e);f=b.createElement("td");e.appendChild(f);e=b.createElement("div");e.setAttribute("style","max-height: "+this.settings.scrollingHeight+"; overflow-y: auto");f.appendChild(e);f=b.createElement("table");f.cellSpacing="0";f.cellPadding="0";e.appendChild(f);for(var e=null!=this.selectedTime?c.getTime(this.selectedTime,this.settings.hourDivisions):null,h=this.settings.hourDivisions,m=this.settings.hourColumns,g=24/m,k=0;k<g*h;k++){for(var j=b.createElement("tr"),l=0;l<m;l++){var p=(l*g+
k/h)*c.hourDuration,o=b.createElement("td");o.setAttribute("style",this.settings.timeStyle);o.setAttribute("class",this.settings.timeClass);var q;try{q=this.settings.timeFormatter(p)}catch(s){q=(p/c.hourDuration).toString()}var r=b.createElement("span");o.appendChild(r);var t=b.createElement("span");r.appendChild(t);var v="undefined"!==typeof this.settings.disabledTimeSelector&&this.settings.disabledTimeSelector(p),u=b.createElement("a");u.setAttribute("href","javascript://");u.setAttribute("style",
"text-decoration: none; display: inline-block; cursor: "+(this.settings.isReadOnly||v?"default":"pointer")+"; color: inherit; width: 40px");u.appendChild(b.createTextNode(q));t.appendChild(u);if(v)r.setAttribute("style",this.settings.disabledTimeStyle),r.setAttribute("class",this.settings.disabledTimeClass);else{var w=null!=e&&p==e;w&&(r.setAttribute("style",this.settings.selectedTimeStyle),r.setAttribute("class",this.settings.selectedTimeClass),this.selectedElement=r);this.settings.highlightingStyleSelector&&
(r=this.settings.highlightingStyleSelector(p,w))&&t.setAttribute("style",r);this.settings.highlightingClassSelector&&(w=this.settings.highlightingClassSelector(p,w))&&t.setAttribute("class",w)}!this.settings.isReadOnly&&!v&&(u.value=p,u.onclick=function(b){a.setValue(b.currentTarget.value);b.stopPropagation()});j.appendChild(o)}f.appendChild(j)}!this.settings.isReadOnly&&this.settings.isNowLinkVisible&&(q=b.createElement("tr"),f=b.createElement("td"),f.setAttribute("style",this.settings.nowLinkStyle),
f.setAttribute("class",this.settings.nowLinkClass),e=b.createElement("a"),e.setAttribute("href","javascript://"),e.setAttribute("style","text-decoration: none; color: inherit; cursor: pointer"),e.appendChild(b.createTextNode(this.settings.nowString)),f.appendChild(e),e.value=-1,e.onclick=function(b){var d=b.currentTarget.value;0>d&&(d=new Date,d=(new Date(d.valueOf()-d.getTimezoneOffset()*c.minuteDuration)).getTime(),d-=Math.floor(d/c.dayDuration)*c.dayDuration);a.setValue(d);b.stopPropagation()},
q.appendChild(f),d.appendChild(q));this.host.appendChild(d)};c.prototype.getValue=function(){return this.selectedTime};c.prototype.setValue=function(a){null!=a&&0>a&&(a=0);if(a!=this.selectedTime||this.settings.forceSetOnClick)this.selectedTime=a,this.refresh(),this.settings.selectedTimeChangeHandler&&this.settings.selectedTimeChangeHandler(a)};c.getTime=function(a,b){var d=c.hourDuration/b;return Math.floor(a/d)*d};c.secondDuration=1E3;c.minuteDuration=60*c.secondDuration;c.hourDuration=60*c.minuteDuration;
c.dayDuration=24*c.hourDuration;return c}();g.Element=j})(o=g.CalendarDay||(g.CalendarDay={}));var r;(function(g){g.initialize=function(c,a,b,d,f){return new j(c,a,b,d,f)};g.get=function(c){return c.component};var j=function(){function c(a,b,d,f,e){this.host=a;this.value=b;this.header=d;this.settings=f;this.isInitialized=!1;this.dropDownButtonElement=null;var h="DlhSoft.Controls TimePicker DlhSoft.Data.HTML.Controls 5 validate Licensing".split(" ");l[h[5]][h[4]](a,h[0],h[1],h[2],h[3],e,f);this.host.component=
this;"undefined"===typeof f&&(f={});"undefined"!==typeof d&&"undefined"===typeof f.header&&(f.header=d);this.settings=f;c.initializeSettings(this.settings);d=this.host.ownerDocument;if(this.inputHost=a instanceof HTMLInputElement?a:null){if(null==b)try{b=this.settings.timeParser(this.inputHost.value)}catch(m){}a=d.createElement("span");this.inputHost.parentElement&&this.inputHost.parentElement.insertBefore(a,this.inputHost);this.host=a;l[h[5]][h[4]](a,h[0],h[1],h[2],h[3],e,f);this.host.component=
this}"undefined"===typeof b&&(f.isNullValueAccepted?b=null:(b=new Date,b=(new Date(b.valueOf()-b.getTimezoneOffset()*c.minuteDuration)).getTime(),b-=Math.floor(b/c.dayDuration)*c.dayDuration));this.value=b;this.refresh();this.isInitialized=!0}c.initializeSettings=function(a){"undefined"===typeof a.isNowLinkVisible&&(a.isNowLinkVisible=!0);"undefined"===typeof a.timeFormatter&&(a.timeFormatter=function(b){if(b==null&&a.isNullValueAccepted)return"";var d=Math.floor(b/c.hourDuration),b=Math.floor((b-
d*c.hourDuration)/c.minuteDuration),f=function(a,b){b===void 0&&(b=2);for(var d=a.toString();d.length<b;)d="0"+d;return d};return f(d)+":"+f(b)});o.Element.initializeSettings(a);"undefined"===typeof a.openDropDownOnInputClick&&(a.openDropDownOnInputClick=!0);"undefined"===typeof a.timeParser&&(a.timeParser=function(b){if(typeof b==="undefined"||b==null||b.length==0)return a.isNullValueAccepted?null:0;var d=b.lastIndexOf(" ");d>=0&&(b=b.substr(d+1));b=new Date("01/01/1970 "+b);if(isNaN(b.valueOf())||
b.getFullYear()<=0||b.getFullYear()!=1970||b.getMonth()!=0||b.getDate()!=1){b=new Date;b=(new Date(b.valueOf()-b.getTimezoneOffset()*c.minuteDuration)).getTime();return b=b-Math.floor(b/c.dayDuration)*c.dayDuration}return b.getTime()-b.getTimezoneOffset()*c.minuteDuration});"undefined"===typeof a.isNullValueAccepted&&(a.isNullValueAccepted=!0);"undefined"===typeof a.isDropDownButtonVisible&&(a.isDropDownButtonVisible=!1);"undefined"===typeof a.dropDownButtonDefinition&&(a.dropDownButtonDefinition=
"<svg style='display: inline-block; margin-left: 4px; cursor: pointer; vertical-align: middle' width='12' height='12'><circle cx='6' cy='6' r='6' style='fill: none; stroke: #707070; stroke-width: 0.65'/><line x1='6' y1='2' x2='6' y2='6' style='stroke: #707070; stroke-width: 0.65'/><line x1='6' y1='6' x2='10' y2='6' style='stroke: #707070; stroke-width: 0.65'/></svg>");"undefined"===typeof a.popupStyle&&(a.popupStyle="background-color: White; border: 1px solid "+("Modern"==a.theme?"#e0e0e0":"#707070")+
"; font-family: Arial");"undefined"===typeof a.inputStyle&&"Modern"==a.theme&&(a.inputStyle="border: 1px solid #e0e0e0; background-color: White; color: #505050; font-family: Arial; font-size: 12px; padding: 4px");"undefined"===typeof a.defaultPrefix&&(a.defaultPrefix="")};c.prototype.refresh=function(){for(var a=this,b=this.host.ownerDocument,d=this.host.childNodes.length;0<d--;)this.host.removeChild(this.host.childNodes[d]);d=b.createElement("div");d.setAttribute("style","margin-top: -1px");if(this.inputHost)c=
b.createElement("span"),c.setAttribute("style","display: inline-block"),c.appendChild(d),this.host.appendChild(c),d=this.host.firstChild,this.popupElement=d.firstChild,this.inputHost.parentElement&&this.inputHost.parentElement.removeChild(this.inputHost),this.popupElement&&this.popupElement.parentElement&&this.popupElement.parentElement.insertBefore(this.inputHost,this.popupElement),this.inputElement=this.inputHost;else{var c=b.createElement("span");c.setAttribute("style","display: inline-block");
var e=b.createElement("input");c.appendChild(e);c.appendChild(d);this.host.appendChild(c);d=this.host.firstChild;this.inputElement=d.firstChild;this.popupElement=d.childNodes[1]}this.popupElement&&(d=b.createElement("div"),d.setAttribute("style",this.settings.popupStyle),this.settings.popupClass&&d.setAttribute("class",this.settings.popupClass),this.popupElement.appendChild(d));this.inputElement&&("undefined"!==typeof this.settings.inputStyle&&this.inputElement.setAttribute("style",this.settings.inputStyle+
(this.inputElement.getAttribute("style")?";"+this.inputElement.getAttribute("style"):"")),this.settings.inputClass&&this.inputElement.setAttribute("class",this.settings.inputClass));this.settings.isDropDownButtonVisible&&(this.dropDownButtonElement=b.createElement("span"),this.dropDownButtonElement.setAttribute("style","display: inline-block"),this.dropDownButtonElement.innerHTML=this.settings.dropDownButtonDefinition,this.popupElement&&this.popupElement.parentElement&&this.popupElement.parentElement.insertBefore(this.dropDownButtonElement,
this.popupElement));this.inputElement&&(this.inputElement.TimePicker=this,this.setValue(this.value),this.settings.isReadOnly&&this.inputElement.setAttribute("readonly","readonly"));this.popupElement&&(d=this.popupElement.firstChild,this.calendarDayHost=b.createElement("div"),d.appendChild(this.calendarDayHost));this.calendarDayHost&&(this.calendarDay=new o.Element(this.calendarDayHost,this.value,void 0,{theme:this.settings.theme,isReadOnly:this.settings.isReadOnly,header:this.settings.header,isHeaderVisible:this.settings.isHeaderVisible,
isNowLinkVisible:this.settings.isNowLinkVisible,containerStyle:null,headerStyle:this.settings.headerStyle,headerClass:this.settings.headerClass,timeStyle:this.settings.timeStyle,timeClass:this.settings.timeClass,selectedTimeStyle:this.settings.selectedTimeStyle,selectedTimeClass:this.settings.selectedTimeClass,disabledTimeStyle:this.settings.disabledTimeStyle,disabledTimeClass:this.settings.disabledTimeClass,nowLinkStyle:this.settings.nowLinkStyle,nowLinkClass:this.settings.nowLinkClass,highlightingStyleSelector:this.settings.highlightingStyleSelector,
highlightingClassSelector:this.settings.highlightingClassSelector,disabledTimeSelector:this.settings.disabledTimeSelector,nowString:this.settings.nowString,hourDivisions:this.settings.hourDivisions,timeFormatter:this.settings.timeFormatter,hourColumns:this.settings.hourColumns,scrollingHeight:this.settings.scrollingHeight,forceSetOnClick:!0,selectedTimeChangeHandler:function(b){a.setValue(b);a.settings.selectedTimeChangeHandler&&a.settings.selectedTimeChangeHandler(b)}},"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase."));
if(this.inputElement&&(this.inputElement.addEventListener("change",function(){a.refreshValue()},!0),this.dropDownButtonElement&&(this.dropDownButtonElement.onmousedown=function(){a.recordClick();a.refreshValue();setTimeout(function(){a.toggleDropDown()},0)}),this.popupElement))this.popupElement.style.position="absolute",this.popupElement.style.display="none",this.inputElement.addEventListener("focus",function(){if(a.settings.openDropDownOnInputClick){a.openDropDown();a.focusValue=a.inputElement.value}},
!0),this.inputElement.addEventListener("blur",function(){a.settings.openDropDownOnInputClick&&typeof a.focusValue!=="undefined"&&delete a.focusValue},!0),this.inputElement.addEventListener("keydown",function(b){b.keyCode==13?a.settings.openDropDownOnInputClick&&a.refreshValue():a.closeDropDown()},!0),this.inputElement.addEventListener("mousedown",function(){setTimeout(function(){if(a.settings.openDropDownOnInputClick&&!(typeof a.focusValue!=="undefined"&&a.inputElement.value!=a.focusValue)){a.refreshValue();
a.openDropDown()}},0);a.recordClick()},!0),this.inputElement.addEventListener("input",function(){a.closeDropDown()},!0),this.popupElement.onmousedown=function(){a.recordClick()},b.addEventListener("mousedown",function(){setTimeout(function(){a.isDuringRecordedClick()||a.closeDropDown()},0)},!0),b.addEventListener("mousewheel",function(b){a.isMouseWheelScrollingPopup(b)||a.closeDropDown()},!0),b.addEventListener("DOMMouseScroll",function(b){a.isMouseWheelScrollingPopup(b)||a.closeDropDown()},!0)};
c.prototype.recordClick=function(){var a=this;this.isDuringClick||(this.isDuringClick=!0,setTimeout(function(){delete a.isDuringClick},0))};c.prototype.isDuringRecordedClick=function(){return"undefined"!==typeof this.isDuringClick};c.prototype.isMouseWheelScrollingPopup=function(a){for(var b="undefined"!==typeof a.wheelDelta?a.wheelDelta/120:"undefined"!==typeof a.detail?-a.detail/3:0,a=a.target,d=!1;null!=a;){if(0<a.offsetHeight&&a.offsetHeight<a.scrollHeight&&!(1>=a.scrollTop&&0<b||a.scrollTop>=
a.scrollHeight-a.clientHeight-1&&0>b))d=!0;if(a==this.popupElement)return d;a=a.parentElement}return!1};c.prototype.getValue=function(){return this.value};c.prototype.setValue=function(a){this.resetValue(a)};c.prototype.refreshValue=function(){this.resetValue()};c.prototype.resetValue=function(a){if(!this.isDuringInternalSetValue){this.isDuringInternalSetValue=!0;this.closeDropDown();var b=this.value;try{this.value=null!=a?a:this.settings.timeParser(this.inputElement.value)}catch(d){}this.settings.disabledTimeSelector&&
(null!=this.value&&this.settings.disabledTimeSelector(this.value))&&(this.settings.isNullValueAccepted?this.value=null:(a=new Date,this.value=(new Date(a.valueOf()-a.getTimezoneOffset()*c.minuteDuration)).getTime(),this.value-=Math.floor(this.value/c.dayDuration)*c.dayDuration));a=this.inputElement.value?this.inputElement.value.lastIndexOf(" "):-1;a=0<=a?this.inputElement.value.substr(0,a):this.settings.defaultPrefix;0<a.length&&(a+=" ");var f;try{f=a+this.settings.timeFormatter(this.value)}catch(e){}if(f!=
this.inputElement.value&&(this.inputElement.value=f,this.isInitialized))try{var h=this.inputElement.ownerDocument.createEvent("HTMLEvents");h.initEvent("change",!0,!0);this.inputElement.dispatchEvent(h)}catch(m){}if(this.value&&!b||!this.value&&b||this.value&&b&&this.value!=b)this.calendarDay&&(this.calendarDay.selectedTime=this.value,this.calendarDay.refresh()),this.settings.valueChangeHandler&&this.settings.valueChangeHandler(this.value);delete this.isDuringInternalSetValue}};c.prototype.openDropDown=
function(){this.isOpen||this.toggleDropDown()};c.prototype.closeDropDown=function(){this.isOpen&&this.toggleDropDown()};c.prototype.toggleDropDown=function(){var a=this;this.isOpen=!this.isOpen;var b=function(){var b=a.inputElement.getBoundingClientRect();a.popupElement.style.position="fixed";a.popupElement.style.zIndex="1";a.popupElement.style.left=b.left+"px";a.popupElement.style.top=b.top+b.height+"px";a.popupElement.style.display=a.isOpen?"block":"none";var d=a.popupElement.getBoundingClientRect();
d.bottom>a.popupElement.ownerDocument.documentElement.clientHeight&&b.top>=d.height&&(a.popupElement.style.top=b.top-d.height+2+"px");d.right>a.popupElement.ownerDocument.documentElement.clientWidth&&a.popupElement.ownerDocument.documentElement.clientWidth>=d.width&&(a.popupElement.style.left=a.popupElement.ownerDocument.documentElement.clientWidth-d.width+"px")};b();this.isOpen&&this.settings.dropDownOpenedHandler?this.settings.dropDownOpenedHandler():!this.isOpen&&this.settings.dropDownClosedHandler&&
this.settings.dropDownClosedHandler();if(this.isOpen){this.calendarDay.selectedElement&&this.calendarDay.selectedElement.scrollIntoView();var d=this.host.ownerDocument.documentElement.clientWidth,c=this.host.ownerDocument.documentElement.clientHeight,e=this.host.getBoundingClientRect();this.positionChangeHandlerTimer=setInterval(function(){var h=a.host.ownerDocument.documentElement.clientWidth,g=a.host.ownerDocument.documentElement.clientHeight,k=a.host.getBoundingClientRect();h!=d||g!=c?a.closeDropDown():
(k.left!=e.left||k.top!=e.top||k.width!=e.width||k.height!=e.height)&&b();d=h;c=g;e=k},100)}else this.positionChangeHandlerTimer&&(clearInterval(this.positionChangeHandlerTimer),delete this.positionChangeHandlerTimer)};c.secondDuration=1E3;c.minuteDuration=60*c.secondDuration;c.hourDuration=60*c.minuteDuration;c.dayDuration=24*c.hourDuration;return c}();g.Element=j})(r=g.TimePicker||(g.TimePicker={}));(function(g){g.initialize=function(c,a,b,d){return new j(c,a,b,d)};g.get=function(c){return c["DateTimePicker.component"]};
var j=function(){function c(a,b,d,f){var e=this;this.host=a;this.value=b;this.settings=d;this.isInitialized=!1;this.host["DateTimePicker.component"]=this;"undefined"===typeof d&&(d={});"undefined"!==typeof d.license&&"undefined"!==typeof d.datePickerSettings&&(d.datePickerSettings.license=d.license);this.settings=d;c.initializeSettings(this.settings);"undefined"===typeof b&&(b=d.datePickerSettings.isNullValueAccepted?null:new Date);this.value=b;this.timePicker=r.initialize(a,void 0,void 0,this.settings.timePickerSettings,
"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase.");this.inputElement=this.timePicker.inputElement;this.inputElement["DateTimePicker.component"]=this;this.datePicker=v.initialize(this.inputElement,this.value,this.settings.datePickerSettings,f);this.value=this.datePicker.value;var h;try{h=b?this.datePicker.settings.dateTimeFormatter(b):""}catch(g){h=""}a=h.lastIndexOf(" ");0<=a&&(h=h.substr(0,a));this.timePicker.settings.defaultPrefix=
h;var k=this.datePicker.settings.dropDownOpenedHandler;this.datePicker.settings.dropDownOpenedHandler=function(){e.datePicker.isOpen&&e.timePicker.isOpen&&e.timePicker.closeDropDown();e.isOpen=e.datePicker.isOpen;k&&k()};var j=this.datePicker.settings.dropDownClosedHandler;this.datePicker.settings.dropDownClosedHandler=function(){e.isOpen=e.datePicker.isOpen;j&&j()};var l=this.timePicker.settings.dropDownOpenedHandler;this.timePicker.settings.dropDownOpenedHandler=function(){e.timePicker.isOpen&&
!e.value?e.timePicker.closeDropDown():(e.timePicker.isOpen&&e.datePicker.isOpen&&e.datePicker.closeDropDown(),e.isTimeOpen=e.timePicker.isOpen,l&&l())};var p=this.timePicker.settings.dropDownClosedHandler;this.timePicker.settings.dropDownClosedHandler=function(){e.isTimeOpen=e.timePicker.isOpen;p&&p()};var o=this.datePicker.settings.valueChangeHandler;this.datePicker.settings.valueChangeHandler=function(a){e.value=a;o&&o(a)};this.inputElement&&(this.inputElement.addEventListener("focus",function(){if(e.settings.openDropDownOnInputClick){switch(e.getCurrentValuePart()){default:e.openDropDown();
break;case "Time":e.timePicker.refreshValue(),e.openTimeDropDown()}e.focusValue=e.inputElement.value}},!0),this.inputElement.addEventListener("blur",function(){e.settings.openDropDownOnInputClick&&"undefined"!==typeof e.focusValue&&delete e.focusValue},!0),this.inputElement.addEventListener("keydown",function(a){13==a.keyCode?e.settings.openDropDownOnInputClick&&e.refreshValue():e.closeDropDown()},!0),this.inputElement.addEventListener("mousedown",function(){setTimeout(function(){if(e.settings.openDropDownOnInputClick&&
!("undefined"!==typeof e.focusValue&&e.inputElement.value!=e.focusValue))switch(e.getCurrentValuePart()){default:e.datePicker.refreshValue();e.openDropDown();break;case "Time":e.timePicker.refreshValue(),e.openTimeDropDown()}},0)},!0));this.isInitialized=!0}c.initializeSettings=function(a){"undefined"===typeof a.theme&&(a.theme="Modern");"undefined"===typeof a.isReadOnly&&(a.isReadOnly=!1);"undefined"===typeof a.isNullValueAccepted&&(a.isNullValueAccepted=!0);"undefined"===typeof a.openDropDownOnInputClick&&
(a.openDropDownOnInputClick=!0);"undefined"===typeof a.datePickerSettings&&(a.datePickerSettings={});a.datePickerSettings.isReadOnly=a.isReadOnly;a.datePickerSettings.theme=a.theme;"undefined"===typeof a.datePickerSettings.isTodayLinkVisible&&(a.datePickerSettings.isTodayLinkVisible=a.areCurrentLinksVisible);"undefined"===typeof a.datePickerSettings.defaultTimeOfDay&&(a.datePickerSettings.defaultTimeOfDay=a.defaultTimeOfDay);a.datePickerSettings.openDropDownOnInputClick=!1;"undefined"===typeof a.datePickerSettings.isDropDownButtonVisible&&
(a.datePickerSettings.isDropDownButtonVisible=a.areDropDownButtonsVisible);a.datePickerSettings.allowMultipleSelection=!1;a.datePickerSettings.allowRangeSelection=!1;"undefined"===typeof a.datePickerSettings.dateTimeFormatter&&(a.datePickerSettings.dateTimeFormatter=a.dateTimeFormatter);"undefined"===typeof a.datePickerSettings.dateTimeParser&&(a.datePickerSettings.dateTimeParser=a.dateTimeParser);a.datePickerSettings.isNullValueAccepted=a.isNullValueAccepted;"undefined"===typeof a.datePickerSettings.valueChangeHandler&&
(a.datePickerSettings.valueChangeHandler=a.valueChangeHandler);"undefined"===typeof a.datePickerSettings.popupClass&&(a.datePickerSettings.popupClass=a.popupClass);"undefined"===typeof a.datePickerSettings.popupStyle&&(a.datePickerSettings.popupStyle=a.popupStyle);"undefined"===typeof a.datePickerSettings.inputClass&&(a.datePickerSettings.inputClass=a.inputClass);"undefined"===typeof a.datePickerSettings.inputStyle&&(a.datePickerSettings.inputStyle=a.inputStyle);"undefined"===typeof a.datePickerSettings.disabledDateSelector&&
(a.datePickerSettings.disabledDateSelector=a.disabledDateSelector);"undefined"===typeof a.datePickerSettings.calendarSelectorLevels&&(a.datePickerSettings.calendarSelectorLevels=a.calendarSelectorLevels);"undefined"===typeof a.datePickerSettings.months&&(a.datePickerSettings.months=a.months);"undefined"===typeof a.datePickerSettings.daysOfWeek&&(a.datePickerSettings.daysOfWeek=a.daysOfWeek);"undefined"===typeof a.timePickerSettings&&(a.timePickerSettings={});a.timePickerSettings.theme=a.theme;a.timePickerSettings.isReadOnly=
a.isReadOnly;"undefined"===typeof a.timePickerSettings.isNowLinkVisible&&(a.timePickerSettings.isNowLinkVisible=a.areCurrentLinksVisible);"undefined"===typeof a.timePickerSettings.nowString&&(a.timePickerSettings.nowString="Current");a.timePickerSettings.openDropDownOnInputClick=!1;"undefined"===typeof a.timePickerSettings.isDropDownButtonVisible&&(a.timePickerSettings.isDropDownButtonVisible=a.areDropDownButtonsVisible);"undefined"===typeof a.timePickerSettings.timeFormatter&&"undefined"!==typeof a.datePickerSettings.dateTimeFormatter&&
(a.timePickerSettings.timeFormatter=function(b){var c=new Date(1970,0,1),b=b!=null?a.datePickerSettings.dateTimeFormatter(new Date(c.valueOf()+b)):"",c=b.lastIndexOf(" ");return c<0?"":b.substr(c+1)});"undefined"===typeof a.timePickerSettings.timeParser&&("undefined"!==typeof a.datePickerSettings.dateTimeParser&&"undefined"!==typeof a.datePickerSettings.dateTimeFormatter)&&(a.timePickerSettings.timeParser=function(b){var f=b.lastIndexOf(" ");if(f<0){if(a.isNullValueAccepted)return null;b=new Date;
b=(new Date(b.valueOf()-b.getTimezoneOffset()*c.minuteDuration)).getTime();return b-Math.floor(b/c.dayDuration)*c.dayDuration}var b=b.substr(f+1),e=a.datePickerSettings.dateTimeFormatter(new Date(1970,0,1)),f=e.indexOf(" ");f>=0&&(e=e.substr(0,f+1));b=a.datePickerSettings.dateTimeParser(e+b);if(isNaN(b.valueOf())||b.getFullYear()<=0||b.getFullYear()!=1970||b.getMonth()!=0||b.getDate()!=1){b=new Date;b=(new Date(b.valueOf()-b.getTimezoneOffset()*c.minuteDuration)).getTime();return b=b-Math.floor(b/
c.dayDuration)*c.dayDuration}return b.getTime()-b.getTimezoneOffset()*c.minuteDuration});a.timePickerSettings.isNullValueAccepted=a.isNullValueAccepted;if("undefined"!==typeof a.timePickerSettings.disabledTimeSelector){var b=a.datePickerSettings.disabledDateSelector;a.datePickerSettings.disabledDateSelector=function(d){var f=false;b&&(f=b(d));if(f)return true;d=(new Date(d.valueOf()-d.getTimezoneOffset()*c.minuteDuration)).getTime();d=d-Math.floor(d/c.dayDuration)*c.dayDuration;return a.timePickerSettings.disabledTimeSelector(d)}}"undefined"===
typeof a.timePickerSettings.popupClass&&(a.timePickerSettings.popupClass=a.popupClass);"undefined"===typeof a.timePickerSettings.popupStyle&&(a.timePickerSettings.popupStyle=a.popupStyle);a.timePickerSettings.inputClass=void 0;a.timePickerSettings.inputStyle=null;"undefined"===typeof a.timePickerSettings.disabledTimeSelector&&(a.timePickerSettings.disabledTimeSelector=a.disabledTimeSelector)};c.prototype.refreshValue=function(){this.datePicker.refreshValue();this.timePicker.refreshValue()};c.prototype.getValue=
function(){return this.datePicker.getValue()};c.prototype.setValue=function(a){this.datePicker.setValue(a)};c.prototype.getTimeValue=function(){return this.timePicker.getValue()};c.prototype.setTimeValue=function(a){this.timePicker.setValue(a)};c.prototype.openDropDown=function(){this.datePicker.openDropDown()};c.prototype.closeDropDown=function(){this.datePicker.closeDropDown()};c.prototype.openTimeDropDown=function(){this.timePicker.openDropDown()};c.prototype.closeTimeDropDown=function(){this.timePicker.closeDropDown()};
c.prototype.getCurrentValuePart=function(){if(!this.inputElement||!this.inputElement.value)return null;var a=this.inputElement.value.lastIndexOf(" ");return 0>a?"Date":this.inputElement.selectionStart>a?"Time":"Date"};c.secondDuration=1E3;c.minuteDuration=60*c.secondDuration;c.hourDuration=60*c.minuteDuration;c.dayDuration=24*c.hourDuration;return c}();g.Element=j})(g.DateTimePicker||(g.DateTimePicker={}));var q;(function(g){g.initialize=function(c,a,b,d,f){return new p(c,a,b,d,f)};g.get=function(c){return c.component};
var p=function(){function c(a,b,d,f,e){this.host=a;this.availableChoices=b;this.value=d;this.settings=f;this.isInitialized=!1;this.dropDownButtonElement=null;var h="DlhSoft.Controls MultiSelectorComboBox DlhSoft.Data.HTML.Controls 5 validate Licensing".split(" ");l[h[5]][h[4]](a,h[0],h[1],h[2],h[3],e,f);this.host.component=this;"undefined"===typeof f&&(f={});this.settings=f;c.initializeSettings(this.settings);"undefined"===typeof this.settings.choiceStyle&&!(this instanceof j.Element)&&(this.settings.choiceStyle=
"cursor: pointer");var g=this.host.ownerDocument;if(this.inputHost=a instanceof HTMLInputElement?a:null)null==d&&(d=this.inputHost.value),a=g.createElement("span"),this.inputHost.parentElement&&this.inputHost.parentElement.insertBefore(a,this.inputHost),this.host=a,l[h[5]][h[4]](a,h[0],h[1],h[2],h[3],e,f),this.host.component=this;if("undefined"===typeof b||null==b)b=[];this.availableChoices=b;if("undefined"===typeof d||null==d)d="";this.value=d;this.refresh();this.isInitialized=!0}c.initializeSettings=
function(a){"undefined"===typeof a.theme&&(a.theme="Modern");"undefined"===typeof a.isReadOnly&&(a.isReadOnly=!1);"undefined"===typeof a.autoAppendAvailableChoices&&(a.autoAppendAvailableChoices=!1);"undefined"===typeof a.openDropDownOnInputClick&&(a.openDropDownOnInputClick=!0);"undefined"===typeof a.isDropDownButtonVisible&&(a.isDropDownButtonVisible=!1);"undefined"===typeof a.dropDownButtonDefinition&&(a.dropDownButtonDefinition="<span style='display: inline-block; margin-left: 1px; color: "+("Modern"==
a.theme?"#909090":"#707070")+"; font-size: "+("Modern"==a.theme?"10px":"x-small")+"; "+(!a.isReadOnly?"cursor: pointer":"opacity: 0.25")+"; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none'>\u25bc</span>");"undefined"===typeof a.separator&&(a.separator=",");"undefined"===typeof a.isSpaceSeparated&&(a.isSpaceSeparated=!0);"undefined"===typeof a.delimiters&&(a.delimiters=["["]);"undefined"===typeof a.areCheckBoxesVisible&&(a.areCheckBoxesVisible=!0);"undefined"===
typeof a.popupStyle&&(a.popupStyle="background-color: White; color: "+("Modern"==a.theme?"#505050":"Black")+"; border: 1px solid "+("Modern"==a.theme?"#e0e0e0":"#707070")+"; font-family: Arial; font-size: "+("Modern"==a.theme?"12px":"small")+"; max-height: 188px; overflow-y: auto");"undefined"===typeof a.inputStyle&&"Modern"==a.theme&&(a.inputStyle="border: 1px solid #e0e0e0; background-color: White; color: #505050; font-family: Arial; font-size: 12px; padding: 4px")};c.prototype.refresh=function(){for(var a=
this,b=this.host.ownerDocument,d=this.host.childNodes.length;0<d--;)this.host.removeChild(this.host.childNodes[d]);d=b.createElement("div");d.setAttribute("style","margin-top: -1px");if(this.inputHost)c=b.createElement("span"),c.setAttribute("style","display: inline-block"),c.appendChild(d),this.host.appendChild(c),d=this.host.firstChild,this.popupElement=d.firstChild,this.inputHost.parentElement&&this.inputHost.parentElement.removeChild(this.inputHost),this.popupElement&&this.popupElement.parentElement&&
this.popupElement.parentElement.insertBefore(this.inputHost,this.popupElement),this.inputElement=this.inputHost;else{var c=b.createElement("span");c.setAttribute("style","display: inline-block");var e=b.createElement("input");c.appendChild(e);c.appendChild(d);this.host.appendChild(c);d=this.host.firstChild;this.inputElement=d.firstChild;this.popupElement=d.childNodes[1]}this.popupElement&&(d=b.createElement("div"),d.setAttribute("style",this.settings.popupStyle),this.settings.popupClass&&d.setAttribute("class",
this.settings.popupClass),this.popupElement.appendChild(d));this.inputElement&&("undefined"!==typeof this.settings.inputStyle&&this.inputElement.setAttribute("style",this.settings.inputStyle+(this.inputElement.getAttribute("style")?";"+this.inputElement.getAttribute("style"):"")),this.settings.inputClass&&this.inputElement.setAttribute("class",this.settings.inputClass));this.settings.isDropDownButtonVisible&&(this.dropDownButtonElement=b.createElement("span"),this.dropDownButtonElement.setAttribute("style",
"display: inline-block"),this.dropDownButtonElement.innerHTML=this.settings.dropDownButtonDefinition,this.popupElement&&this.popupElement.parentElement&&this.popupElement.parentElement.insertBefore(this.dropDownButtonElement,this.popupElement));this.inputElement&&(this.inputElement.MultiSelectorComboBox=this,this.setValue(this.value),(this.settings.isReadOnly||this instanceof s.Element)&&this.inputElement.setAttribute("readonly","readonly"));this.popupElement&&(d=this.popupElement.firstChild,this.checkBoxListElement=
b.createElement("div"),this.checkBoxListElement.setAttribute("style","margin: 2px; margin-left: 0px; padding-right: 2px; padding-bottom: 2px"),d.appendChild(this.checkBoxListElement),this.refreshSelectedChoices());if(this.inputElement&&(this.inputElement.addEventListener("change",function(){a.refreshValue();a.refreshAvailableChoices()},!0),this.dropDownButtonElement&&(this.dropDownButtonElement.onmousedown=function(){a.recordClick();a.refreshValue();setTimeout(function(){a.toggleDropDown()},0)}),
this.popupElement))this.popupElement.style.position="absolute",this.popupElement.style.display="none",this.inputElement.addEventListener("focus",function(){if(a.settings.openDropDownOnInputClick){a.openDropDown();a.focusValue=a.inputElement.value}},!0),this.inputElement.addEventListener("blur",function(){a.settings.openDropDownOnInputClick&&typeof a.focusValue!=="undefined"&&delete a.focusValue},!0),this.inputElement.addEventListener("keydown",function(b){b.keyCode==13?a.settings.openDropDownOnInputClick&&
a.refreshValue():a.closeDropDown()},!0),this.inputElement.addEventListener("mousedown",function(){setTimeout(function(){if(a.settings.openDropDownOnInputClick&&!(typeof a.focusValue!=="undefined"&&a.inputElement.value!=a.focusValue)){a.refreshValue();a.openDropDown()}},0);a.recordClick()},!0),this.inputElement.addEventListener("input",function(){a.closeDropDown()},!0),this.popupElement.onmousedown=function(){a.recordClick()},b.addEventListener("mousedown",function(){setTimeout(function(){a.isDuringRecordedClick()||
a.closeDropDown()},0)},!0),b.addEventListener("mousewheel",function(b){a.isMouseWheelScrollingPopup(b)||a.closeDropDown()},!0),b.addEventListener("DOMMouseScroll",function(b){a.isMouseWheelScrollingPopup(b)||a.closeDropDown()},!0)};c.prototype.recordClick=function(){var a=this;this.isDuringClick||(this.isDuringClick=!0,setTimeout(function(){delete a.isDuringClick},0))};c.prototype.isDuringRecordedClick=function(){return"undefined"!==typeof this.isDuringClick};c.prototype.isMouseWheelScrollingPopup=
function(a){for(var b="undefined"!==typeof a.wheelDelta?a.wheelDelta/120:"undefined"!==typeof a.detail?-a.detail/3:0,a=a.target,d=!1;null!=a;){if(0<a.offsetHeight&&a.offsetHeight<a.scrollHeight&&!(1>=a.scrollTop&&0<b||a.scrollTop>=a.scrollHeight-a.clientHeight-1&&0>b))d=!0;if(a==this.popupElement)return d;a=a.parentElement}return!1};c.prototype.getValue=function(){return this.value};c.prototype.setValue=function(a){this.resetValue(a)};c.prototype.refreshValue=function(){this.resetValue()};c.prototype.resetValue=
function(a){this.isDuringInternalSetValue||(this.closeDropDown(),this.setValueInternal(a))};c.prototype.setValueInternal=function(a,b){if(!this.isDuringInternalSetValue){this.isDuringInternalSetValue=!0;"undefined"===typeof b&&(b=!0);var d=this.value,c=this.value="undefined"!==typeof a&&null!=a?a:this.inputElement.value;if(c!=this.inputElement.value&&(this.inputElement.value=c,this.isInitialized))try{var e=this.inputElement.ownerDocument.createEvent("HTMLEvents");e.initEvent("change",!0,!0);this.inputElement.dispatchEvent(e)}catch(h){}if(this.value&&
!d||!this.value&&d||this.value&&d&&this.value.valueOf()!=d.valueOf())b&&this.refreshSelectedChoices(),this.settings.valueChangeHandler&&this.settings.valueChangeHandler(this.value);delete this.isDuringInternalSetValue}};c.prototype.refreshAvailableChoices=function(){if(this.settings.autoAppendAvailableChoices){for(var a=this.getSelectedChoices(!1),b=0;b<a.length;b++){var d=a[b];0>this.availableChoices.indexOf(d)&&this.availableChoices.push(d)}this.refreshSelectedChoices()}};c.prototype.getSelectedChoice=
function(a){return this.getSelectedChoices(a)[0]};c.prototype.getSelectedChoices=function(a){"undefined"===typeof a&&(a=!0);for(var b=[],d=this.value.trim(),c=d.split(this.settings.separator),e=0;e<c.length;e++)if(d=c[e].trim(),0!=d.length){for(var h=0;h<this.settings.delimiters.length;h++){var g=d.indexOf(this.settings.delimiters[h]);0<=g&&(d=d.substr(0,g).trim())}(!a||0<=this.availableChoices.indexOf(d))&&b.push(d)}return b};c.prototype.refreshSelectedChoices=function(){for(var a=this,b=this.checkBoxListElement.childNodes.length;0<
b--;)this.checkBoxListElement.removeChild(this.checkBoxListElement.childNodes[b]);this.checkBoxElements=[];if(this.checkBoxListElement)for(var b=this.getSelectedChoices(),d=0;d<this.availableChoices.length;d++){var c=document.createElement("div");c.setAttribute("style","padding: 1px; padding-left: 2px; padding-right: 2px");var e=this.availableChoices[d],h=document.createElement("input");h.setAttribute("type","checkbox");h.setAttribute("value",e);var g=0<=b.indexOf(e);g&&h.setAttribute("checked","checked");
this.settings.areCheckBoxesVisible&&(h.setAttribute("style","margin-bottom: -1px"+("Modern"==this.settings.theme&&null!=this.settings.inputStyle?"; border: 1px solid #e0e0e0":"")),h.onchange=function(b){var b=b.currentTarget,c=b.getAttribute("value");a.setSelectedChoice(c,b.checked,!1)},c.appendChild(h));this.checkBoxElements.push(h);var k=document.createElement(this instanceof j.Element?"div":"span");k.setAttribute("style",this.settings.choiceStyle);k.setAttribute("class",this.settings.choiceClass);
var l=document.createElement(this instanceof j.Element?"div":"span");g&&(l.setAttribute("style",this.settings.selectedChoiceStyle),l.setAttribute("class",this.settings.selectedChoiceClass));g=document.createElement("span");g.innerHTML=e;l.appendChild(g);k.appendChild(l);k.checkBox=h;k.onclick=function(b){var c=b.currentTarget.checkBox.getAttribute("value");a.setValue(c);b.stopPropagation()};c.appendChild(k);this.checkBoxListElement.appendChild(c)}};c.prototype.selectChoice=function(a){this.setSelectedChoice(a,
!0)};c.prototype.unselectChoice=function(a){this.setSelectedChoice(a,!1)};c.prototype.setSelectedChoice=function(a,b,c){"undefined"===typeof c&&(c=!0);for(var a=a.trim(),f=this.value.trim(),e=f.split(this.settings.separator),h="",g=!1,k=0;k<e.length;k++)if(f=e[k].trim(),0!=f.length){for(var j=f,l=0;l<this.settings.delimiters.length;l++){var p=f.indexOf(this.settings.delimiters[l]);0<=p&&(f=f.substr(0,p).trim())}if(f!=a||b)h+=(0<h.length?this.settings.separator+(this.settings.isSpaceSeparated?" ":
""):"")+j,f==a&&(g=!0)}!g&&b&&(h+=(0<h.length?this.settings.separator+(this.settings.isSpaceSeparated?" ":""):"")+a);c?this.setValue(h):this.setValueInternal(h,!1)};c.prototype.openDropDown=function(){this.isOpen||this.toggleDropDown()};c.prototype.closeDropDown=function(){this.isOpen&&this.toggleDropDown()};c.prototype.toggleDropDown=function(){var a=this;if(!this.settings.isReadOnly&&(this.isOpen||!(0>=this.availableChoices.length))){(this.isOpen=!this.isOpen)&&this.refreshAvailableChoices();var b=
function(){var b=a.inputElement.getBoundingClientRect();a.popupElement.style.position="fixed";a.popupElement.style.zIndex="1";a.popupElement.style.left=b.left+"px";a.popupElement.style.top=b.top+b.height+"px";a.popupElement.style.minWidth=a.inputElement.offsetWidth+"px";a.popupElement.style.display=a.isOpen?"block":"none";var c=a.popupElement.getBoundingClientRect();c.bottom>a.popupElement.ownerDocument.documentElement.clientHeight&&b.top>=c.height&&(a.popupElement.style.top=b.top-c.height+2+"px");
c.right>a.popupElement.ownerDocument.documentElement.clientWidth&&a.popupElement.ownerDocument.documentElement.clientWidth>=c.width&&(a.popupElement.style.left=a.popupElement.ownerDocument.documentElement.clientWidth-c.width+"px")};b();this.isOpen&&this.settings.dropDownOpenedHandler?this.settings.dropDownOpenedHandler():!this.isOpen&&this.settings.dropDownClosedHandler&&this.settings.dropDownClosedHandler();if(this.isOpen){var c=this.host.ownerDocument.documentElement.clientWidth,f=this.host.ownerDocument.documentElement.clientHeight,
e=this.host.getBoundingClientRect();this.positionChangeHandlerTimer=setInterval(function(){var h=a.host.ownerDocument.documentElement.clientWidth,g=a.host.ownerDocument.documentElement.clientHeight,k=a.host.getBoundingClientRect();h!=c||g!=f?a.closeDropDown():(k.left!=e.left||k.top!=e.top||k.width!=e.width||k.height!=e.height)&&b();c=h;f=g;e=k},100)}else this.positionChangeHandlerTimer&&(clearInterval(this.positionChangeHandlerTimer),delete this.positionChangeHandlerTimer)}};return c}();g.Element=
p})(q=g.MultiSelectorComboBox||(g.MultiSelectorComboBox={}));var j;(function(g){g.initialize=function(c,a,b,d,f){return new j(c,a,b,d,f)};g.get=function(c){return c.component};var j=function(c){function a(a,d,f,e,h){c.call(this,a,d,f,e,h);this.isInitialized=!1;this.settings.areCheckBoxesVisible=!1;"undefined"===typeof e.choiceStyle&&(e.choiceStyle="padding: 2px; margin-right: -4px; cursor: pointer");"undefined"===typeof e.selectedChoiceStyle&&(e.selectedChoiceStyle="background-color: #3399ff; color: White; margin: -3px; padding: 2px");
this.refresh();this.isInitialized=!0}__extends(a,c);return a}(q.Element);g.Element=j})(j=g.ComboBox||(g.ComboBox={}));var s;(function(g){g.initialize=function(c,a,b,d,f){return new l(c,a,b,d,f)};g.get=function(c){return c.component};var l=function(c){function a(){c.apply(this,arguments)}__extends(a,c);return a}(j.Element);g.Element=l})(s=g.DropDownList||(g.DropDownList={}));(function(g){g.initialize=function(c,a,b,d){return new j(c,a,b,d)};g.get=function(c){return c["ToolTip.component"]};var j=function(){function c(a,
b,d,f){var e=this;this.content=a;this.targetElement=b;this.settings=d;this.isInitialized=!1;this.isEnabled=!0;this.isVisible=!1;var b=b.ownerDocument,g=b.createElement("span");b.body.appendChild(g);var j="DlhSoft.Controls ToolTip DlhSoft.Data.HTML.Controls 5 validate Licensing".split(" ");l[j[5]][j[4]](g,j[0],j[1],j[2],j[3],f,d);a&&a instanceof HTMLElement?(a.parentNode&&a.parentNode.removeChild(a),f=a):(f=b.createElement("span"),f.innerHTML=a);g.appendChild(f);this.host=g;this.contentContainer=f;
this.host["ToolTip.component"]=this;this.contentContainer["ToolTip.component"]=this;this.targetElement["ToolTip.component"]=this;"undefined"===typeof d&&(d={});this.settings=d;c.initializeSettings(this.settings);this.contentContainer.setAttribute("style",this.settings.containerStyle);this.settings.containerClass&&this.contentContainer.setAttribute("class",this.settings.containerClass);this.isEnabled=this.settings.isEnabled;(this.isVisible=this.settings.isVisible)?this.show():this.hide();this.refresh();
var k=!1;this.targetElement.addEventListener("mouseenter",function(){if(e.isEnabled){e.show();k=true}});this.targetElement.addEventListener("mouseleave",function(){if(e.isEnabled){k=false;isNaN(e.settings.duration)||setTimeout(function(){k||e.hide()},e.settings.duration)}});this.contentContainer.addEventListener("mouseenter",function(){e.isEnabled&&(k=true)});this.contentContainer.addEventListener("mouseleave",function(){if(e.isEnabled){k=false;isNaN(e.settings.duration)||setTimeout(function(){k||
e.hide()},e.settings.duration)}});this.targetElement.addEventListener("mouseup",function(){e.isEnabled&&e.hide()},!0);b.addEventListener("mousedown",function(){e.isEnabled&&(k||e.hide())},!0);b.addEventListener("mousewheel",function(){e.isEnabled&&e.hide()},!0);b.addEventListener("DOMMouseScroll",function(){e.isEnabled&&e.hide()},!0);this.isInitialized=!0}c.initializeSettings=function(a){"undefined"===typeof a.theme&&(a.theme="Modern");"undefined"===typeof a.isEnabled&&(a.isEnabled=!0);"undefined"===
typeof a.duration&&(a.duration=0);"undefined"===typeof a.isVisible&&(a.isVisible=!1);"undefined"===typeof a.containerStyle&&(a.containerStyle="cursor: default; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; border: 1px solid "+("Modern"==a.theme?"#e0e0e0":"#707070")+"; background-color: "+("Modern"==a.theme?"White":"#ffffc0")+"; color: "+("Modern"==a.theme?"#505050":"Black")+"; font-family: Arial; font-size: "+("Modern"==a.theme?"12px":"small")+"; padding: 4px")};
c.prototype.refresh=function(){var a=this.targetElement.getBoundingClientRect();this.x=a.left;this.y=a.top+a.height;this.contentContainer.style.position="fixed";this.contentContainer.style.zIndex="1";this.contentContainer.style.left=this.x+"px";this.contentContainer.style.top=this.y+"px";this.contentContainer.style.display=this.settings.isVisible?"inline-block":"none";var b=this.contentContainer.getBoundingClientRect();b.bottom>this.contentContainer.ownerDocument.documentElement.clientHeight&&a.top>=
b.height&&(this.contentContainer.style.top=a.top-b.height+2+"px");b.right>this.contentContainer.ownerDocument.documentElement.clientWidth&&this.contentContainer.ownerDocument.documentElement.clientWidth>=b.width&&(this.contentContainer.style.left=this.contentContainer.ownerDocument.documentElement.clientWidth-b.width+"px")};c.prototype.setPosition=function(a,b){this.setHorizontalPosition(a);this.setVerticalPosition(b)};c.prototype.setHorizontalPosition=function(a){this.x=a;this.contentContainer.style.left=
this.x+"px"};c.prototype.setVerticalPosition=function(a){this.y=a;this.contentContainer.style.top=this.y+"px"};c.prototype.enable=function(){this.isEnabled||(this.settings.isEnabled=this.isEnabled=!0)};c.prototype.disable=function(){this.isEnabled&&(this.settings.isEnabled=this.isEnabled=!1)};c.prototype.show=function(){c.previouslyShown&&c.previouslyShown.hide();c.previouslyShown=this;this.isVisible||(this.settings.isVisible=this.isVisible=!0,this.refresh(),this.settings.shownHandler&&this.settings.shownHandler())};
c.prototype.hide=function(){this.isVisible&&(this.settings.isVisible=this.isVisible=!1,this.refresh(),this.settings.hiddenHandler&&this.settings.hiddenHandler())};c.prototype.setContent=function(a){a&&a instanceof HTMLElement?(a.parentNode&&a.parentNode.removeChild(a),this.host.replaceChild(a,this.contentContainer),this.contentContainer=a):this.contentContainer.innerHTML=a};return c}();g.Element=j})(g.ToolTip||(g.ToolTip={}));(function(k){function j(c,a){for(var b=g.TreeGrid.getDefaultColumns(c,a),
d=0;d<b.length;d++)delete b[d].isTreeView;return b}k.initialize=function(c,a,b,d){if(a)for(var f=0;f<a.length;f++)delete a[f].indentation,delete a[f].isExpanded;b||(b={});b.columns||(b.columns=j(a,b));return g.TreeGrid.initialize(c,a,b,d)};k.getDefaultColumns=j})(g.Grid||(g.Grid={}))})(l.Controls||(l.Controls={}))})(DlhSoft||(DlhSoft={}));
;
"undefined"===typeof DlhSoft&&(DlhSoft={assemblies:[],buildReleaseDate:new Date(1,0,1)});DlhSoft.assemblies.push({assembly:"DlhSoft.ProjectData.GanttChart.HTML.Controls.Extras",company:"DlhSoft",product:"Project Data Modern Library",version:"5.1.10.4",copyright:"Copyright \ufffd 2013-2014 DlhSoft",title:"Project Data Gantt Chart HTML Controls Extras",description:"Project Data Gantt Chart related HTML client extra components"});
DlhSoft.buildReleaseDate=function(i,B,p){i=new Date(i,B-1,p);return i>DlhSoft.buildReleaseDate?i:DlhSoft.buildReleaseDate}(2014,1,15);var DlhSoft;
(function(i){(function(i){(function(p){(function(i){i.initialize=function(a,b){return new J(a,b)};var J=function(){function a(b,c){this.control=b;this.settings=c;"undefined"===typeof c&&(c={});this.settings=c;a.initializeSettings(this.settings)}a.prototype.loadXml=function(b){this.importXml(b)};a.prototype.importXml=function(b){var c=this.control,e=c.items,g=c.settings,d=null;if("undefined"!==typeof b&&("undefined"!==typeof b.document&&(b=b.document),"undefined"!==typeof b.getElementsByTagName))d=
b,1!=d.getElementsByTagName("Project").length&&(b=d.body.innerHTML,b=b.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/<br>/g,"\n"),d=null);null==d&&(d=(new DOMParser).parseFromString(b.toString(),"text/xml"));var b=[],W=[],i=[],q=[];"undefined"!==typeof this.settings.assignableResources&&this.settings.assignableResources.splice(0,this.settings.assignableResources.length);d=d.getElementsByTagName("Project")[0];if("undefined"!==typeof d){var k,l,s,h;try{var n=d.getElementsByTagName("CalendarUID")[0].childNodes[0].nodeValue,
r,f,x=d.getElementsByTagName("Calendars")[0].getElementsByTagName("Calendar");for(f=0;f<x.length;f++)if(x[f].getElementsByTagName("UID")[0].childNodes[0].nodeValue==n){r=x[f];break}var n=[],u=r.getElementsByTagName("WeekDays")[0].getElementsByTagName("WeekDay");for(f=0;f<u.length;f++)"0"!=u[f].getElementsByTagName("DayWorking")[0].childNodes[0].nodeValue&&"0"!=u[f].getElementsByTagName("DayType")[0].childNodes[0].nodeValue&&n.push(u[f]);n.sort(function(b,a){var c=parseInt(b.getElementsByTagName("DayType")[0].childNodes[0].nodeValue),
d=parseInt(a.getElementsByTagName("DayType")[0].childNodes[0].nodeValue);return c==d?0:c>d?1:-1});var y=n[0];k=parseInt(y.getElementsByTagName("DayType")[0].childNodes[0].nodeValue)-1;l=parseInt(n[n.length-1].getElementsByTagName("DayType")[0].childNodes[0].nodeValue)-1;var m=y.getElementsByTagName("WorkingTimes")[0].getElementsByTagName("WorkingTime");s=a.parseXmlToTimeSpan(m[0].getElementsByTagName("FromTime")[0].childNodes[0].nodeValue);for(f=h=0;f<m.length;f++){var v=a.parseXmlToTimeSpan(m[f].getElementsByTagName("ToTime")[0].childNodes[0].nodeValue);
0==v&&(v=a.dayDuration);h+=v-a.parseXmlToTimeSpan(m[f].getElementsByTagName("FromTime")[0].childNodes[0].nodeValue)}var j;"undefined"!==typeof this.settings.projectInfoLoadingHandler&&(j={sourceElement:d},this.settings.projectInfoLoadingHandler(j))}catch(J){k=1,l=5,s=8*a.hourDuration,h=8*a.hourDuration}g.visibleWeekStart=0;g.visibleWeekFinish=6;g.workingWeekStart=k;g.workingWeekFinish=l;g.visibleDayStart=s;g.visibleDayFinish=s+h;e.splice(0,e.length);try{var D,K,E,A,o,C=d.getElementsByTagName("Tasks")[0].getElementsByTagName("Task");
for(f=0;f<C.length;f++){var t=C[f];if(!(0>=t.getElementsByTagName("Name").length)){var M=parseInt(t.getElementsByTagName("OutlineLevel")[0].childNodes[0].nodeValue)-1;if(!(0>M)){D=t.getElementsByTagName("UID")[0].childNodes[0].nodeValue;K=t.getElementsByTagName("Name")[0].childNodes[0].nodeValue;var N=a.parseXmlToDateTime(t.getElementsByTagName("Start")[0].childNodes[0].nodeValue),O=a.parseXmlToDateTime(t.getElementsByTagName("Finish")[0].childNodes[0].nodeValue),B=parseInt(t.getElementsByTagName("PercentComplete")[0].childNodes[0].nodeValue),
X=p.getOutputDate(c.getCompletedFinish(p.getInputDate(N),B/100,p.getInputDate(O))),Y="1"==t.getElementsByTagName("Milestone")[0].childNodes[0].nodeValue?!0:!1;o={content:K,indentation:M,isExpanded:!0,start:N,finish:O,completedFinish:X,isMilestone:Y};"undefined"!==typeof this.settings.ganttChartItemLoadingHandler&&(j={sourceElement:t,ganttChartItem:o},this.settings.ganttChartItemLoadingHandler(j),o=j.ganttChartItem);b.push(o);i.push({key:D,value:o})}}}var P=d.getElementsByTagName("Resources")[0].getElementsByTagName("Resource");
for(f=0;f<P.length;f++){var F=P[f];if(!(0>=F.getElementsByTagName("Name").length)){D=F.getElementsByTagName("UID")[0].childNodes[0].nodeValue;var w=K=F.getElementsByTagName("Name")[0].childNodes[0].nodeValue;"undefined"!==typeof this.settings.assignableResourceInfoLoadingHandler&&(j={sourceElement:F,resource:w},this.settings.assignableResourceInfoLoadingHandler(j),w=j.resource);W.push(w);q.push({key:D,value:w});"undefined"!==typeof this.settings.assignableResources&&this.settings.assignableResources.push(w)}}var Q=
d.getElementsByTagName("Assignments")[0].getElementsByTagName("Assignment");for(f=0;f<Q.length;f++){var G=Q[f];E=G.getElementsByTagName("TaskUID")[0].childNodes[0].nodeValue;A=a.indexOfKey(i,E);if(!(0>A)){o=i[A].value;var Z=G.getElementsByTagName("ResourceUID")[0].childNodes[0].nodeValue,R=a.indexOfKey(q,Z);if(!(0>R)){var w=q[R].value,S=G.getElementsByTagName("Units")[0].childNodes[0].nodeValue,z="undefined"!==typeof S?parseFloat(S):1,L=w+(1!=z?" ":"")+(1!=z?"["+Math.round(1E4*z)/100+"%]":"");"undefined"!==
typeof this.settings.assignmentInfoLoadingHandler&&(j={sourceElement:G,ganttChartItem:o,resource:w,allocationUnits:z},this.settings.assignmentInfoLoadingHandler(j),w=j.resource,z=j.allocationUnits,L=w+(1!=z?" ":"")+(1!=z?"["+Math.round(1E4*z)/100+"%]":""));o.assignmentsContent="undefined"===typeof o.assignmentsContent||0==o.assignmentsContent.length?L:o.assignmentsContent+", "+L}}}C=d.getElementsByTagName("Tasks")[0].getElementsByTagName("Task");for(f=0;f<C.length;f++)if(t=C[f],E=t.getElementsByTagName("UID")[0].childNodes[0].nodeValue,
A=a.indexOfKey(i,E),!(0>A)){o=i[A].value;var T=t.getElementsByTagName("PredecessorLink");for(k=0;k<T.length;k++){var H=T[k],$=H.getElementsByTagName("PredecessorUID")[0].childNodes[0].nodeValue,U=a.indexOfKey(i,$);if(!(0>U)){var aa=i[U].value,I=parseInt(H.getElementsByTagName("Type")[0].childNodes[0].nodeValue);l=1==I?"":3==I?"SS":0==I?"FF":2==I?"SF":"";var V=H.getElementsByTagName("LinkLag")[0].childNodes[0].nodeValue,ba=(null!=V?parseInt(V):0)/10*a.minuteDuration;l={item:aa,dependencyType:l,lag:ba};
"undefined"!==typeof this.settings.predecessorItemLoadingHandler&&(j={sourceElement:H,ganttChartItem:o,predecessorItem:l},this.settings.predecessorItemLoadingHandler(j),l=j.predecessorItem,o=j.ganttChartItem);"undefined"===typeof o.predecessors&&(o.predecessors=[]);o.predecessors.push(l)}}}for(f=0;f<b.length;f++)e.push(b[f])}catch(ca){}}e=c.getProjectStart();f=new Date;e>f&&(e=f);g.timelineStart=new Date(e.valueOf()-1*a.weekDuration);g.timelineFinish=new Date(e.valueOf()+52*a.weekDuration);g.displayedTime=
e;c.refresh()};a.parseXmlToTimeSpan=function(b){var a,e,g,d,i;d=b.indexOf(":");i=b.lastIndexOf(":");0<d&&(0<i&&i>d&&b.length>i)&&(a=parseInt(b.substr(0,d)),e=parseInt(b.substr(d+1,i)),g=parseInt(b.substr(i+1,b.length)));return 1E3*(3600*a+60*e+g)};a.parseXmlToDateTime=function(b){var a,e,g,d,i,p,q,k,l=b.indexOf("T");q=b.indexOf("-");0<l&&0<q&&(a=parseInt(b.substring(0,q)),k=b.lastIndexOf("-"),0<k&&k>q&&(e=parseInt(b.substring(q+1,k)),l>k&&(g=parseInt(b.substring(k+1,l)))));q=b.indexOf(":");0<l&&0<
q&&(d=parseInt(b.substring(l+1,q)),k=b.lastIndexOf(":"),0<k&&(i=parseInt(b.substring(q+1,k)),b.length>k&&(p=parseInt(b.substring(k+1,b.length)))));return new Date(a,e-1,g,d,i,p)};a.indexOfKey=function(b,a){for(var e=0;e<b.length;e++)if(b[e].key==a)return e;return-1};a.prototype.getXml=function(){return this.getXmlInternal(this.settings.compact)};a.prototype.getXmlInternal=function(b){var c=this.control,e=c.items,g=c.settings,d,i=Math.round((g.visibleDayFinish-g.visibleDayStart)/a.minuteDuration),
B=g.workingWeekFinish-g.workingWeekStart+1,q=c.getProjectStart(),k=c.getAssignedResources();"undefined"===typeof this.settings.assignableResources&&(this.settings.assignableResources=[]);for(d=0;d<k.length;d++)0>this.settings.assignableResources.indexOf(k[d])&&this.settings.assignableResources.push(k[d]);var k=this.settings.assignableResources,l="";for(d=0;7>d;d++){var s=g.workingWeekStart<=d&&g.workingWeekFinish>=d;0<l.length&&(l+="\n");l+=a.applyStringTemplateValues(a.scheduleWeekDayXmlTemplate,
[{key:"DayNumber",value:(d+1).toString()},{key:"IsWorkingDay",value:s?"1":"0"},{key:"WorkingTimes",value:s?a.applyStringTemplateValues(a.scheduleDayWorkingTimesXmlTemplate,[{key:"FromTime",value:a.convertDayTimeToXml(g.visibleDayStart<a.dayDuration?g.visibleDayStart:0)},{key:"ToTime",value:a.convertDayTimeToXml(g.visibleDayFinish<a.dayDuration?g.visibleDayFinish:0)}]):""}])}var s="",h,n,r;for(d=0;d<e.length;d++){0<s.length&&(s+="\n");h=e[d];var f=h.start,x=h.finish,u=c.getItemEffort(h);n=c.getItemCompletedEffort(h);
r=c.getItemTotalEffort(h);var y=c.getItemTotalCompletedEffort(h),m="";if("undefined"!==typeof h.predecessors)for(var v=0;v<h.predecessors.length;v++){0<m.length&&(m+="\n");var j=h.predecessors[v],m=m+this.savePredecessorItem(h,j,a.predecessorXmlTemplate,[{key:"PredecessorIndex",value:(j.item.index+1).toString()},{key:"DependencyType",value:"undefined"===typeof j.dependencyType||""==j.dependencyType||"FinishStart"==j.dependencyType||"FS"==j.dependencyType?1:"StartStart"==j.dependencyType||"SS"==j.dependencyType?
3:"FinishFinish"==j.dependencyType||"FF"==j.dependencyType?0:"StartFinish"==j.dependencyType||"SF"==j.dependencyType?2:-1},{key:"Lag",value:"undefined"!==typeof j.lag?Math.floor(10*(j.lag/a.minuteDuration)):0}])}r=[{key:"Index",value:(h.index+1).toString()},{key:"Index",value:(h.index+1).toString()},{key:"Content",value:(0<h.content.length?h.content:"").toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},{key:"Indentation",value:(h.indentation+1).toString()},{key:"Start",value:a.convertDateToXml(p.getOutputDate(f))},
{key:"Finish",value:a.convertDateToXml(p.getOutputDate(x))},{key:"Duration",value:a.convertTimeSpanToXml(u)},{key:"CompletedDuration",value:a.convertTimeSpanToXml(n)},{key:"Effort",value:a.convertTimeSpanToXml(r)},{key:"CompletedEffort",value:a.convertTimeSpanToXml(y)},{key:"RemainingEffort",value:a.convertTimeSpanToXml(r-y)},{key:"IsMilestone",value:h.isMilestone?1:0},{key:"IsSummary",value:h.hasChildren?1:0},{key:"Cost",value:c.getItemCost(h)},{key:"Completion",value:!h.isMilestone&&0<u?Math.round(100*
c.getItemCompletion(h)):0},{key:"ConstraintDefinition",value:f>q&&!h.hasChildren?"<ConstraintDate>"+a.convertDateToXml(p.getOutputDate(f))+"</ConstraintDate>":""},{key:"PredecessorLinks",value:m}];s+=this.saveGanttChartItem(h,a.taskXmlTemplate,r)}n="";for(d=0;d<k.length;d++)0<n.length&&(n+="\n"),h=k[d],r=[{key:"Index",value:(d+1).toString()},{key:"Index",value:(d+1).toString()},{key:"Name",value:(0<h.length?h:"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}],n+=this.saveResourceInfo(h,
a.resourceXmlTemplate,r);f="";for(d=0;d<e.length;d++){0<f.length&&(f+="\n");h=e[d];x=c.getItemAssignments(h);for(u=0;u<x.length;u++)m=x[u],r=c.getItemEffort(h)*m.value,y=c.getItemCompletedEffort(h)*m.value,v=k.indexOf(m.key),r=[{key:"Indexes",value:(h.index*k.length+v+1).toString()},{key:"TaskIndex",value:(h.index+1).toString()},{key:"ResourceIndex",value:(v+1).toString()},{key:"AllocationUnits",value:m.value},{key:"Completion",value:Math.round(100*c.getCompletion(h.start,h.completedFinish,h.finish)).toString()},
{key:"Start",value:a.convertDateToXml(p.getOutputDate(h.start))},{key:"Finish",value:a.convertDateToXml(p.getOutputDate(h.finish))},{key:"Effort",value:a.convertTimeSpanToXml(r)},{key:"CompletedEffort",value:a.convertTimeSpanToXml(y)},{key:"RemainingEffort",value:a.convertTimeSpanToXml(r-y)}],f+=this.saveAssignmentInfo(h,m.key,m.value,a.assignmentXmlTemplate,r)}c=[{key:"ProjectStart",value:a.convertDateToXml(p.getOutputDate(q))},{key:"DayStart",value:a.convertDayTimeToXml(g.visibleDayStart<a.dayDuration?
g.visibleDayStart:0)},{key:"DayFinish",value:a.convertDayTimeToXml(g.visibleDayFinish<a.dayDuration?g.visibleDayFinish:0)},{key:"MinutesPerDay",value:i},{key:"MinutesPerWeek",value:i*B},{key:"ScheduleWeekDays",value:l},{key:"Tasks",value:s},{key:"Resources",value:n},{key:"Assignments",value:f}];c=this.saveProjectInfo(a.projectXmlTemplate,c);"undefined"!==typeof this.settings.spaceSeparated&&this.settings.spaceSeparated&&(c=c.replace(/\n+/g,"\n "));"undefined"!==typeof b&&(c=b?c.replace(/\n/g,""):
c.replace(/\n+/g,"\n"));return c};a.prototype.saveProjectInfo=function(b,c){b=a.applyStringTemplateValues(b,c);if("undefined"!==typeof this.settings.projectInfoSavingHandler){var e={outputXml:b};this.settings.projectInfoSavingHandler(e);b=e.outputXml}return b};a.prototype.saveGanttChartItem=function(b,c,e){c=a.applyStringTemplateValues(c,e);"undefined"!==typeof this.settings.ganttChartItemSavingHandler&&(b={ganttChartItem:b,outputXml:c},this.settings.ganttChartItemSavingHandler(b),c=b.outputXml);
return c};a.prototype.savePredecessorItem=function(b,c,e,g){e=a.applyStringTemplateValues(e,g);"undefined"!==typeof this.settings.predecessorItemSavingHandler&&(b={ganttChartItem:b,predecessorItem:c,outputXml:e},this.settings.predecessorItemSavingHandler(b),e=b.outputXml);return e};a.prototype.saveResourceInfo=function(b,c,e){c=a.applyStringTemplateValues(c,e);"undefined"!==typeof this.settings.resourceInfoSavingHandler&&(b={resource:b,outputXml:c},this.settings.resourceInfoSavingHandler(b),c=b.outputXml);
return c};a.prototype.saveAssignmentInfo=function(b,c,e,g,d){g=a.applyStringTemplateValues(g,d);"undefined"!==typeof this.settings.assignmentInfoSavingHandler&&(b={ganttChartItem:b,resource:c,allocationUnits:e,outputXml:g},this.settings.assignmentInfoSavingHandler(b),g=b.outputXml);return g};a.applyStringTemplateValues=function(b,a){for(var e=0;e<a.length;e++)b=b.replace("{"+a[e].key+"}",a[e].value);return b};a.convertDateToXml=function(a){var c=(a.getMonth()+1).toString(),e=a.getDate().toString(),
g=a.getHours().toString(),d=a.getMinutes().toString(),i=a.getSeconds().toString();return a.getFullYear().toString()+"-"+(1<c.length?c:"0"+c)+"-"+(1<e.length?e:"0"+e)+"T"+(1<g.length?g:"0"+g)+":"+(1<d.length?d:"0"+d)+":"+(1<i.length?i:"0"+i)};a.convertDayTimeToXml=function(b){var c=Math.floor(b/a.hourDuration),e=Math.floor(b/a.minuteDuration-60*c),g=c.toString(),d=e.toString(),b=Math.floor(b/a.secondDuration-60*e-3600*c).toString();return(1<g.length?g:"0"+g)+":"+(1<d.length?d:"0"+d)+":"+(1<b.length?
b:"0"+b)};a.convertTimeSpanToXml=function(b){var c=Math.floor(b/a.hourDuration),e=Math.floor(b/a.minuteDuration-60*c);return"PT"+c+"H"+e+"M"+Math.floor(b/a.secondDuration-60*e-3600*c)+"S"};a.prototype.exportXml=function(a){var c;if("undefined"===typeof a||null==a)a=c=window.open();"undefined"!==typeof a.document&&(a=a.document);a.open("text/html");var e=this.getXmlInternal(!1),e=e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br>");a.write(e);a.close();return c};
a.initializeSettings=function(){};a.secondDuration=1E3;a.minuteDuration=60*a.secondDuration;a.hourDuration=60*a.minuteDuration;a.dayDuration=24*a.hourDuration;a.weekDuration=7*a.dayDuration;a.projectXmlTemplate="<?xml version='1.0' encoding='UTF-8' standalone='yes'?>\n<Project xmlns='http://schemas.microsoft.com/project'>\n<SaveVersion>14</SaveVersion>\n<ScheduleFromStart>1</ScheduleFromStart>\n<StartDate>{ProjectStart}</StartDate>\n<DefaultStartTime>{DayStart}</DefaultStartTime>\n<DefaultFinishTime>{DayFinish}</DefaultFinishTime>\n<MinutesPerDay>{MinutesPerDay}</MinutesPerDay>\n<MinutesPerWeek>{MinutesPerWeek}</MinutesPerWeek>\n<DurationFormat>7</DurationFormat>\n<WorkFormat>2</WorkFormat>\n<CalendarUID>1</CalendarUID>\n<Calendars>\n<Calendar>\n<UID>1</UID>\n<Name>Standard</Name>\n<IsBaseCalendar>1</IsBaseCalendar>\n<BaseCalendarUID>-1</BaseCalendarUID>\n<WeekDays>\n{ScheduleWeekDays}\n</WeekDays>\n</Calendar>\n</Calendars>\n<Tasks>\n{Tasks}\n</Tasks>\n<Resources>\n{Resources}\n</Resources>\n<Assignments>\n{Assignments}\n</Assignments>\n</Project>";
a.scheduleWeekDayXmlTemplate="<WeekDay>\n<DayType>{DayNumber}</DayType>\n<DayWorking>{IsWorkingDay}</DayWorking>\n{WorkingTimes}\n</WeekDay>";a.scheduleDayWorkingTimesXmlTemplate="<WorkingTimes>\n<WorkingTime>\n<FromTime>{FromTime}</FromTime>\n<ToTime>{ToTime}</ToTime>\n</WorkingTime>\n</WorkingTimes>";a.taskXmlTemplate="<Task>\n<UID>{Index}</UID>\n<ID>{Index}</ID>\n<Active>1</Active>\n<Name>{Content}</Name>\n<Manual>0</Manual>\n<IsNull>0</IsNull>\n<OutlineLevel>{Indentation}</OutlineLevel>\n<Priority>500</Priority>\n<Start>{Start}</Start>\n<Finish>{Finish}</Finish>\n<Duration>{Duration}</Duration>\n<DurationFormat>7</DurationFormat>\n<Work>{Effort}</Work>\n<ActualDuration>{CompletedDuration}</ActualDuration>\n<ActualWork>{CompletedEffort}</ActualWork>\n<RemainingWork>{RemainingEffort}</RemainingWork>\n<Milestone>{IsMilestone}</Milestone>\n<Summary>{IsSummary}</Summary>\n<FixedCost>0</FixedCost>\n<FixedCostAccrual>3</FixedCostAccrual>\n<PercentComplete>{Completion}</PercentComplete>\n<Cost>{Cost}</Cost>\n<ConstraintType>0</ConstraintType>\n{ConstraintDefinition}\n<CalendarUID>-1</CalendarUID>\n<IgnoreResourceCalendar>0</IgnoreResourceCalendar>\n{PredecessorLinks}\n</Task>";
a.predecessorXmlTemplate="<PredecessorLink>\n<PredecessorUID>{PredecessorIndex}</PredecessorUID>\n<Type>{DependencyType}</Type>\n<LinkLag>{Lag}</LinkLag>\n<LagFormat>5</LagFormat>\n</PredecessorLink>";a.resourceXmlTemplate="<Resource>\n<UID>{Index}</UID>\n<ID>{Index}</ID>\n<Name>{Name}</Name>\n<Type>1</Type>\n<IsNull>0</IsNull>\n<CalendarUID>1</CalendarUID>\n</Resource>";a.assignmentXmlTemplate="<Assignment>\n<UID>{Indexes}</UID>\n<TaskUID>{TaskIndex}</TaskUID>\n<ResourceUID>{ResourceIndex}</ResourceUID>\n<Units>{AllocationUnits}</Units>\n<PercentWorkComplete>{Completion}</PercentWorkComplete>\n<Start>{Start}</Start>\n<Finish>{Finish}</Finish>\n<Work>{Effort}</Work>\n<ActualWork>{CompletedEffort}</ActualWork>\n<RemainingWork>{RemainingEffort}</RemainingWork>\n</Assignment>";
return a}();i.Service=J})(p.ProjectSerializer||(p.ProjectSerializer={}))})(i.GanttChartView||(i.GanttChartView={}))})(i.Controls||(i.Controls={}))})(DlhSoft||(DlhSoft={}));
;
var DlhSoft;"undefined"===typeof DlhSoft&&(DlhSoft={assemblies:[],buildReleaseDate:new Date(1,0,1)});DlhSoft.assemblies.push({assembly:"DlhSoft.HierarchicalData.HTML.Controls",company:"DlhSoft",product:"Hierarchical Data Modern Library",version:"5.3.6.0",copyright:"Copyright \u00a9 2012-2015 DlhSoft",title:"Hierarchical Data HTML Controls",description:"Hierarchical Data related HTML client components"});
DlhSoft.buildReleaseDate=function(y,u,A){y=new Date(y,u-1,A);return y>DlhSoft.buildReleaseDate?y:DlhSoft.buildReleaseDate}(2015,9,22);var _0x5c25="Licensing{undefined{string{DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase.{.{length{license{push{type{content{:{lastIndexOf{substr{buildReleaseDate{charCodeAt{pow{toUpperCase{DlhSoft Component Licensing Warning{http://DlhSoft.com/Purchase.aspx{?Assemblies={,{http://www.componentsource.com/features/dlhsoft{ (version {){This component is currently licensed to be used for testing purposes only{The component is part of this assembly{To purchase a standard license for a product that includes this assembly you can use the Purchase page{ownerDocument{div{createElement{style{position: absolute; left: 24px; top: 24px; width: 480px; display: block; z-index: 1; color: Black; background-color: #ffffc0; border: solid 1px Blue; overflow: auto{setAttribute{padding: 6px; padding-top: 8px; font-family: Arial; font-size: small{font-weight: bold; margin-bottom: 4px{appendChild{createTextNode{color: Red; margin-top: 2px; margin-bottom: 2px{margin-top: 4px{a{color: Blue; text-decoration: underline{href{target{_blank{Purchase license{margin-left: 4px; color: Blue; text-decoration: underline{javascript://{Continue trial{click{removeChild{addEventListener{\n\n{: {:\n".split("{");
void 0==DlhSoft[_0x5c25[0]]&&(DlhSoft[_0x5c25[0]]=function(){var y=_0x5c25[1],u=_0x5c25[2],A=[],K=[],E=_0x5c25[3],G=function(x,s){if(typeof x!==u||typeof s!==u)return!1;if(s==E)return!0;var B=s[_0x5c25[11]](_0x5c25[10]);if(0<=B){var q=s[_0x5c25[12]](0,B),n,t=q[_0x5c25[11]](_0x5c25[10]);if(0<=t)try{n=new Date(parseInt(q[_0x5c25[12]](t+1)))}catch(p){}typeof n===y&&(n=new Date(2013,11,31));if(DlhSoft[_0x5c25[13]]>n)return!1;q=q+_0x5c25[10]+x;for(i=n=0;i<q[_0x5c25[5]];i++)t=q[_0x5c25[14]](i),n=(n<<5)-
n+t,n&=n;0>n&&(n=Math[_0x5c25[15]](2,32)-n);q=n.toString(16)[_0x5c25[16]]();B=s[_0x5c25[12]](B+1);if(q==B)return!0}return!1},H=function(x,s,u,q,n){var t=_0x5c25[17],p=_0x5c25[18],z=typeof ComponentSource===y||!ComponentSource?p+_0x5c25[19]+q+_0x5c25[20]+n:_0x5c25[21],A=q+_0x5c25[22]+n+_0x5c25[23],E=_0x5c25[24],G=_0x5c25[25],H=_0x5c25[26];setTimeout(function(){var n=x[_0x5c25[27]],p=n[_0x5c25[29]](_0x5c25[28]);p[_0x5c25[32]](_0x5c25[30],_0x5c25[31]);var q=n[_0x5c25[29]](_0x5c25[28]);q[_0x5c25[32]](_0x5c25[30],
_0x5c25[33]);var r=n[_0x5c25[29]](_0x5c25[28]);r[_0x5c25[32]](_0x5c25[30],_0x5c25[34]);q[_0x5c25[35]](r);r[_0x5c25[35]](n[_0x5c25[36]](t));q[_0x5c25[35]](n[_0x5c25[36]](E+_0x5c25[10]));r=n[_0x5c25[29]](_0x5c25[28]);r[_0x5c25[32]](_0x5c25[30],_0x5c25[37]);r[_0x5c25[35]](n[_0x5c25[36]](s));q[_0x5c25[35]](r);q[_0x5c25[35]](n[_0x5c25[36]](G+_0x5c25[10]));r=n[_0x5c25[29]](_0x5c25[28]);r[_0x5c25[32]](_0x5c25[30],_0x5c25[37]);r[_0x5c25[35]](n[_0x5c25[36]](A));q[_0x5c25[35]](r);q[_0x5c25[35]](n[_0x5c25[36]](H+
_0x5c25[10]));r=n[_0x5c25[29]](_0x5c25[28]);r[_0x5c25[32]](_0x5c25[30],_0x5c25[38]);var w=n[_0x5c25[29]](_0x5c25[39]);w[_0x5c25[32]](_0x5c25[30],_0x5c25[40]);w[_0x5c25[32]](_0x5c25[41],z);w[_0x5c25[32]](_0x5c25[42],_0x5c25[43]);w[_0x5c25[35]](n[_0x5c25[36]](_0x5c25[44]));r[_0x5c25[35]](w);w=n[_0x5c25[29]](_0x5c25[39]);w[_0x5c25[32]](_0x5c25[30],_0x5c25[45]);w[_0x5c25[32]](_0x5c25[41],_0x5c25[46]);w[_0x5c25[35]](n[_0x5c25[36]](_0x5c25[47]));w[_0x5c25[50]](_0x5c25[48],function(){x[_0x5c25[49]](p);K[_0x5c25[7]](u)},
!1);r[_0x5c25[35]](w);q[_0x5c25[35]](r);p[_0x5c25[35]](q);x[_0x5c25[35]](p)},0);setTimeout(function(){alert(t+_0x5c25[51]+E+_0x5c25[52]+s+_0x5c25[51]+G+_0x5c25[53]+A+_0x5c25[51]+H+_0x5c25[4])},6E5)};return{setLicense:function(u,s){A[_0x5c25[7]]({type:u,content:s})},validate:function(x,s,B,q,n,t,p){for(var s=s+_0x5c25[4]+B,z=0;z<K[_0x5c25[5]];z++)if(K[z]==s)return;a:if(typeof t!==u&&typeof p!==y&&(p[_0x5c25[6]]!==y&&(t=p[_0x5c25[6]]),typeof p===u&&(t=p)),typeof t!==u)for(p=0;p<A[_0x5c25[5]];p++)if(z=
A[p],z[_0x5c25[8]]==s&&typeof z[_0x5c25[9]]===u){t=z[_0x5c25[9]];break a}G(s,t)?x[_0x5c25[6]]=t:H(x,B,s,q,n)}}}());void 0==DlhSoft.Controls&&(DlhSoft.Controls={});
void 0==DlhSoft.Controls.TreeGrid&&(DlhSoft.Controls.TreeGrid=function(){var y=function(a,b,c,d){if(typeof a.ownerDocument.createElementNS==="undefined"||typeof a.ownerDocument.addEventListener==="undefined")alert("The required HTML5 features are not supported by the application host. Some features will be unavailable. Consider upgrading.");else{var e=["DlhSoft.Controls","TreeGrid","DlhSoft.HierarchicalData.HTML.Controls","5","validate","Licensing"];DlhSoft[e[5]][e[4]](a,e[0],e[1],e[2],e[3],d,c);
a.isInitializing=true;typeof a.settings!=="undefined"&&typeof a.settings.toggleButtonAreaWidth!=="undefined"&&delete a.settings.toggleButtonAreaWidth;typeof c!=="object"&&(c={});E(b,c);K(c,b,a);pa(a,b,c);d=c.columns;ma(d,a,c);N(b,a);O(b,c,a);typeof c.visibilityFilter!=="undefined"&&qa(b,c.visibilityFilter);var f=G(a,b,c),h=a.ownerDocument,e=h.createElement("div");e.setAttribute("style","font-family: Arial; font-size: small; overflow: auto");var g=h.createElement("div");typeof c.containerClass!=="undefined"&&
g.setAttribute("class",c.containerClass);typeof c.containerStyle!=="undefined"&&g.setAttribute("style",c.containerStyle);e.appendChild(g);var j=h.createElement("div");j.setAttribute("style","border: solid 1px "+c.border+"; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; overflow: auto");g.appendChild(j);g=h.createElement("div");g.setAttribute("style","overflow: auto; float: left; border-right: solid 1px "+
c.border+"; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; width: "+c.gridWidth);j.appendChild(g);h.addEventListener("mouseup",function(){if(DlhSoft.Controls.ToolTip&&c.useUpdatingToolTips)(toolTip=a.toolTip)&&toolTip.hide()},true);j=h.createElement("div");j.setAttribute("style","float: right; background: "+c.headerBackground+"; width: 0px; height: "+c.headerHeight+"px");g.appendChild(j);var m=h.createElement("div");m.setAttribute("style","overflow: hidden; background: "+
c.headerBackground+"; border-bottom: solid 1px "+c.border+"; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; height: "+c.headerHeight+"px");g.appendChild(m);var k=h.createElement("div");k.setAttribute("style","overflow-x: "+(typeof c.isExport==="undefined"||!c.isExport?"scroll":"hidden")+"; overflow-y: "+(typeof c.isExport==="undefined"||!c.isExport?"auto":"hidden")+"; height: "+f);g.appendChild(k);var o=U(d),f=h.createElement("div");f.setAttribute("style","background: "+
c.headerBackground+"; border-bottom: solid 1px "+c.border+"; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; width: "+o+"px; overflow: hidden; height: "+c.headerHeight+"px");m.appendChild(f);var F=h.createElement("div");F.setAttribute("style","float: left; width: "+o+"px; overflow: auto");k.appendChild(F);if(typeof c.extraSpaceHeight!=="undefined"){h=h.createElement("div");h.setAttribute("style","overflow: hidden; width: "+o+"px; height: "+c.extraSpaceHeight+"px");
k.appendChild(h)}var l;setTimeout(function(){l=a.offsetHeight},0);typeof a.heightUpdateTimer!=="undefined"&&clearInterval(a.heightUpdateTimer);a.heightUpdateTimer=setInterval(function(){try{if(!(a.clientHeight<=0)){var e=a.clientHeight;if(e!=l){var d=G(a,b,c);k.style.height=d;I(b,k,c);l=e}}}catch(f){try{clearInterval(a.heightUpdateTimer)}catch(g){}}},100);F.container=k;f.container=m;a.gridContainer=g;a.gridContent=F;a.gridContentContainer=k;a.gridHeader=f;a.gridHeaderContainer=m;h=H(b,c);ra(a,e);
na(f,d,c);r(F,b,d,h,c);I(b,k,c);sa(a,k,g,m,j,F,b,c);a.isInitializing=false;a.isInitialized=true;return a}},u=function(a){y(a,a.items,a.settings,a.license)},A=function(a){if(typeof a.itemPropertyChangeHandler==="undefined")a.itemPropertyChangeHandler=function(){};if(typeof a.target==="undefined")a.target="Standard";if(typeof a.theme==="undefined")a.theme="Modern";if(typeof a.interaction==="undefined")a.interaction=a.target!="Phone"?"Standard":"TouchEnabled";if(typeof a.isReadOnly==="undefined")a.isReadOnly=
false;if(typeof a.isContentReadOnly==="undefined")a.isContentReadOnly=false;if(typeof a.selectionMode==="undefined")a.selectionMode="Focus";if(typeof a.isVirtualizing==="undefined")a.isVirtualizing=true},K=function(a,b,c){A(a);if(typeof a.gridWidth==="undefined")a.gridWidth="100%";if(typeof a.minColumnWidth==="undefined")a.minColumnWidth=32;if(typeof a.border==="undefined")switch(a.theme){default:a.border="#e0e0e0";break;case "ModernBordered":case "Aero":a.border="#9a9a9a"}if(typeof a.splitterWidth===
"undefined")a.splitterWidth=4;if(typeof a.indentationLevelWidth==="undefined")a.indentationLevelWidth=16;if(typeof a.itemHeight==="undefined")a.itemHeight=21;if(typeof a.headerBackground==="undefined")a.headerBackground="#f4f4f4";if(typeof a.headerHeight==="undefined")a.headerHeight=21;if(typeof a.columns==="undefined")a.columns=B(b,a);if(typeof a.toggleButtonStyle==="undefined"&&a.toggleButtonClass==null)a.toggleButtonStyle="fill: Gray";if(typeof a.toggleButtonHoveringStyle==="undefined"&&a.toggleButtonHoveringClass==
null)a.toggleButtonHoveringStyle="fill: Black";if(typeof a.collapsedToggleButtonTemplate==="undefined")a.collapsedToggleButtonTemplate=Z(c,a);if(typeof a.expandedToggleButtonTemplate==="undefined")a.expandedToggleButtonTemplate=$(c,a);if(typeof a.gridLines==="undefined")a.gridLines="LightGray";if(typeof a.horizontalGridLines==="undefined")a.horizontalGridLines=a.gridLines;if(typeof a.verticalGridLines==="undefined")a.verticalGridLines=a.gridLines;if(typeof a.itemStyle==="undefined"&&typeof a.horizontalGridLines!==
"undefined"){a.itemStyle="border-top: solid 1px "+a.horizontalGridLines+"; margin-top: -1px; -wekbit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box";if(typeof a.cellStyle==="undefined")a.cellStyle=typeof a.verticalGridLines!=="undefined"?"border-right: solid 1px "+a.verticalGridLines+"; height: "+a.itemHeight+"px; padding-top: 2px; padding-left: 2px":"height: "+a.itemHeight+"px; padding-top: 2px"}if(typeof a.cellStyle==="undefined"&&typeof a.verticalGridLines!=="undefined")a.cellStyle=
"border-right: solid 1px "+a.verticalGridLines+"; height: "+a.itemHeight+"px; padding-top: 3px; padding-left: 2px";if(typeof a.selectedItemStyle==="undefined"&&a.selectedItemClass==null)switch(a.theme){default:a.selectedItemStyle=typeof a.horizontalGridLines!=="undefined"||typeof a.verticalGridLines==="undefined"?"background-color: #f4f4f4; border-top: solid 1px "+(typeof a.horizontalGridLines!=="undefined"?a.horizontalGridLines:"White")+"; margin-top: -1px; -wekbit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box":
"background-color: #f4f4f4";break;case "Aero":a.selectedItemStyle=typeof a.horizontalGridLines!=="undefined"||typeof a.verticalGridLines==="undefined"?"background-color: LightBlue; border-top: solid 1px "+(typeof a.horizontalGridLines!=="undefined"?a.horizontalGridLines:"White")+"; margin-top: -1px; -wekbit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box":"background-color: LightBlue"}if(typeof a.summaryItemStyle==="undefined"&&a.summaryItemClass==null)a.summaryItemStyle=
"font-weight: bold"},E=function(a){for(var b=0;b<a.length;b++){var c=a[b];if(typeof c==="string"){c={content:c};a[b]=c}if(typeof c.indentation==="string")c.indentation=parseInt(c.indentation);if(typeof c.isExpanded==="string")c.isExpanded=c.isExpanded.toLowerCase()=="true";typeof c.wasGridItemContentLoaded!=="undefined"&&delete c.wasGridItemContentLoaded}},G=function(a,b,c){var d;if(a.isContentHeightInitialized&&a.isContentHeightAuto)d=b.length>0?"auto":c.itemHeight+"px";else{var e=a.clientHeight-
c.headerHeight-2;e<0&&(e=0);d=e+"px";if(e<c.itemHeight){if(!a.isContentHeightInitialized)a.isContentHeightAuto=true;d=b.length>0?"auto":c.itemHeight+"px"}a.isContentHeightInitialized=true}return d},H=function(a,b){if(typeof b.toggleButtonAreaWidth!=="undefined")return b.toggleButtonAreaWidth;for(var c=0,d=0;d<a.length;d++)if(a[d].indentation>0){c=16;break}return b.toggleButtonAreaWidth=c},x=function(a,b){var c=a.createElement("span");c.innerHTML=b;return c},s=function(a,b){var c=a.ownerDocument,d=
c.createElementNS("http://www.w3.org/2000/svg","svg");d.setAttribute("style","width: 12px; height: 12px");d.setAttribute("focusable","false");c=c.createElementNS("http://www.w3.org/2000/svg","rect");c.setAttribute("id","PART_Border");c.setAttribute("width","12");c.setAttribute("height","12");c.setAttribute("style","fill: White; fill-opacity: 0");d.appendChild(c);a.setAttribute("id","PART_Button");typeof b.toggleButtonClass!=="undefined"&&a.setAttribute("class",b.toggleButtonClass);typeof b.toggleButtonStyle!==
"undefined"&&a.setAttribute("style",b.toggleButtonStyle);d.appendChild(a);return d},B=function(a,b){typeof b!=="object"&&(b={});A(b);var c=[{header:"",width:32,isSelection:true},{header:"Item",width:280,isTreeView:true}];c[0].cellTemplate=q(b,c[0],a);c[1].cellTemplate=z(b,c[1],a);c[1].exportCellTemplate=z(b,c[1],a,false);b.selectionMode!="Single"&&(b.selectionMode!="Extended"&&b.selectionMode!="ExtendedFocus")&&c.splice(0,1);return c},q=function(a,b,c){return function(d){return!b.isReadOnly?n(d,a,
c):getBooleanNode(d.treeGrid.ownerDocument,d.isSelected)}},n=function(a,b){var c=a.treeGrid.ownerDocument,d;if(typeof a.selectionInput==="undefined"){d=c.createElement("input");a.selectionInput=d;d.type="checkbox";d.setAttribute("style","margin: 0px")}else d=a.selectionInput;if(a.isSelected){d.setAttribute("checked","checked");if(!d.checked)d.checked=true}else if(d.checked)d.checked=false;var e=function(){d.checked?t(a,true,b.selectionMode):t(a,false,b.selectionMode)};typeof d.changeEventListener!==
"undefined"&&d.removeEventListener("change",d.changeEventListener,true);d.addEventListener("change",e,true);d.changeEventListener=e;c=function(a){if(a.keyCode==13){a.preventDefault();a.stopPropagation();e(a)}};typeof d.keyPressEventListener!=="undefined"&&d.removeEventListener("keypress",d.keyPressEventListener,true);d.addEventListener("keypress",c,true);d.keyPressEventListener=c;return d},t=function(a,b,c){a.isSelected=b;v(a,"isSelected",true,true);aa(a);if(typeof a.treeGrid!=null){a.treeGrid.selectedItem=
a;if(c!="Extended"&&c!="ExtendedFocus")a.treeGrid.selectedItems=[a];var d;if(c!="Extended"&&c!="ExtendedFocus")for(d=0;d<a.treeGrid.items.length;d++){b=a.treeGrid.items[d];if(b!=a&&b.isSelected){b.isSelected=false;v(b,"isSelected",false,true);aa(b)}}}if(typeof a.treeGrid!=null&&(c=="Extended"||c=="ExtendedFocus")){c=[];for(d=0;d<a.treeGrid.items.length;d++){b=a.treeGrid.items[d];b.isSelected&&c.push(b)}a.treeGrid.selectedItems=c}},p=function(a,b){if(typeof a.treeGrid!=null)a.treeGrid.currentItem=
a;if(b.selectionMode=="Focus"||b.selectionMode=="ExtendedFocus")a.isSelected||t(a,true,b.selectionMode)},z=function(a,b,c,d){var e=function(a){return x(a.treeGrid.ownerDocument,a.content)};return(typeof d==="undefined"||d)&&!a.isReadOnly&&!a.isContentReadOnly?function(c){return!b.isReadOnly&&(typeof c.isReadOnly==="undefined"||!c.isReadOnly)?la(c,Math.max(0,b.width-c.indentation*c.treeGrid.settings.indentationLevelWidth-c.treeGrid.settings.toggleButtonAreaWidth-16),a):e(c)}:e},la=function(a,b,c){var d=
a.treeGrid.ownerDocument,e;if(typeof a.contentInput==="undefined"){e=d.createElement("input");a.contentInput=e;e.type="text";e.addEventListener("focus",function(){p(a,c)},false);var f=function(){a.content=e.value;v(a,"content",true,true);J(a)};typeof e.changeEventListener!=="undefined"&&e.removeEventListener("change",e.changeEventListener,true);e.addEventListener("change",f,true);e.changeEventListener=f;d=function(a){if(a.keyCode==13){a.preventDefault();a.stopPropagation();f(a)}};typeof e.keyPressEventListener!==
"undefined"&&e.removeEventListener("keypress",e.keyPressEventListener,true);e.addEventListener("keypress",d,true);e.keyPressEventListener=d;e.addEventListener("focus",function(){e.style.backgroundColor="White"},false);e.addEventListener("blur",function(){e.style.backgroundColor="Transparent"},false)}else e=a.contentInput;e.value=a.content;d="";if(a.hasChildren&&(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled))d="; font-weight: bold";e.setAttribute("style","background-color: Transparent; width: "+
b+"px; border-width: 0px; padding: 0px"+d);return e},U=function(a){for(var b=0,c=0;c<a.length;c++)b=b+a[c].width;return b},ma=function(a,b,c){for(var d=H(b.items,c),e=0;e<a.length;e++){var f=a[e];f.treeGrid=b;if(typeof f.width==="undefined")f.width=100;if(typeof f.minWidth==="undefined")f.minWidth=Math.min(f.width,c.minColumnWidth+(f.isTreeView?d:0));if(typeof f.maxWidth==="undefined")f.maxWidth=c.maxColumnWidth;if(typeof f.cellTemplate==="undefined")f.cellTemplate=function(a){return x(a.treeGrid.ownerDocument,
a.content)}}},na=function(a,b,c){var d=a.ownerDocument,e=d.createElement("div");typeof c.columnHeaderClass!=="undefined"&&e.setAttribute("class",c.columnHeaderClass);typeof c.columnHeaderStyle!=="undefined"&&e.setAttribute("style",c.columnHeaderStyle);for(var f=0;f<b.length;f++)e.appendChild(oa(d,b[f],c));a.appendChild(e)},oa=function(a,b,c){var d=a.createElement("div");d.setAttribute("style","overflow-y: hidden; vertical-align: middle; display: table-cell; -wekbit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; height: "+
c.headerHeight+"px");var e=a.createElement("div");e.setAttribute("style","padding-left: 2px; padding-right: 2px; overflow-x: hidden; -wekbit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; width: "+b.width+"px");var f=a.createElement("div");typeof b.headerClass!=="undefined"&&f.setAttribute("class",b.headerClass);typeof b.headerStyle!=="undefined"&&f.setAttribute("style",b.headerStyle);f.appendChild(x(a,b.header));e.appendChild(f);d.appendChild(e);if(b.width>=1&&(typeof c.allowUserToResizeColumns===
"undefined"||c.allowUserToResizeColumns)&&(typeof b.allowUserToResize==="undefined"||b.allowUserToResize)){d.isGripperVisible=false;var h=b.treeGrid,g=function(a){d.isGripperVisible=a;d.style.cursor=a?"e-resize":"default";d.style.borderRight=a?"solid 1px "+c.border:"";e.style.width=b.width-(a?1:0)+"px"},j=c.splitterWidth;d.addEventListener("mouseover",function(a){if(!DlhSoft.Controls.TreeGrid.isGripperDragging&&!(d.isGripperDragging||typeof a.offsetX==="undefined"&&a.currentTarget!=d))g((typeof a.offsetX!==
"undefined"?a.offsetX:a.layerX-a.currentTarget.offsetLeft)>=b.width-j)},true);d.addEventListener("mousemove",function(a){if(!DlhSoft.Controls.TreeGrid.isGripperDragging&&!(d.isGripperDragging||typeof a.offsetX==="undefined"&&a.currentTarget!=d))g((typeof a.offsetX!=="undefined"?a.offsetX:a.layerX-a.currentTarget.offsetLeft)>=b.width-j)},true);e.addEventListener("mouseover",function(a){!DlhSoft.Controls.TreeGrid.isGripperDragging&&(!d.isGripperDragging&&!(typeof a.offsetX!=="undefined"||a.currentTarget!=
e))&&g(a.layerX-a.currentTarget.offsetLeft>=b.width-j)},false);e.addEventListener("mousemove",function(a){!DlhSoft.Controls.TreeGrid.isGripperDragging&&(!d.isGripperDragging&&!(typeof a.offsetX!=="undefined"||a.currentTarget!=e))&&g(a.layerX-a.currentTarget.offsetLeft>=b.width-j)},false);d.addEventListener("mousedown",function(a){if(!(a.button!=0||!d.isGripperVisible||DlhSoft.Controls.TreeGrid.isGripperDragging)){DlhSoft.Controls.TreeGrid.isGripperDragging=true;d.isGripperDragging=true;d.initialGripperDraggingX=
a.clientX;d.initialColumnWidth=b.width}},true);a.addEventListener("mousemove",function(a){if(d.isGripperDragging){b.width=Math.max(b.minWidth,d.initialColumnWidth+(a.clientX-d.initialGripperDraggingX));if(typeof b.maxWidth!=="undefined"&&b.width>b.maxWidth)b.width=b.maxWidth;e.style.width=b.width-1+"px";typeof c.columnWidthChangeHandler!=="undefined"&&setTimeout(function(){c.columnWidthChangeHandler(b,b.width)},0);if(!h.isWaitingToRefreshColumns){h.isWaitingToRefreshColumns=true;setTimeout(function(){var a=
U(c.columns);h.gridHeader.style.width=a+"px";h.gridContent.style.width=a+"px";delete h.isWaitingToRefreshColumns;h.refreshGridItems()},0)}}},true);a.addEventListener("mouseup",function(){if(d.isGripperDragging){delete d.isGripperDragging;delete d.initialGripperDraggingX;delete d.initialColumnWidth;g(false);delete DlhSoft.Controls.TreeGrid.isGripperDragging}},true);d.addEventListener("mouseout",function(){d.isGripperDragging||g(false)},false)}return d},N=function(a,b){for(var c=-1,d=null,e=null,f=
[],h=0;h<a.length;h++){var g=a[h];if(typeof g.isSelected==="undefined")g.isSelected=false;if(g.isSelected){e==null&&(e=g);f.push(g)}if(typeof g.indentation==="undefined")g.indentation=0;if(h==0&&g.indentation!=0){g.indentation=0;v(g,"indentation",false,true)}if(typeof g.isExpanded==="undefined")g.isExpanded=true;if(d!=null){var j=d.indentation+1;if(g.indentation>j){g.indentation=j;v(g,"indentation",false,true)}d.hasChildren=g.indentation>d.indentation;if(d.hasChildren&&typeof d.isMilestone!=="undefined"&&
d.isMilestone){d.isMilestone=false;v(d,"isMilestone",false,true)}}g.isVisible=c<0||g.indentation<=c;if(g.isVisible&&!g.isExpanded)c=g.indentation;g.isExpanded&&g.indentation==c&&(c=-1);d=g}if(d!=null)d.hasChildren=false;b.selectedItem=e;b.selectedItems=f},O=function(a,b,c){c.isHierarchicalInformationInitialized=false;var b=[],d,e;for(e=0;e<a.length;e++){d=a[e];d.index=e;var f=null;for(b.length>0&&(f=b[b.length-1]);f!=null&&d.indentation<=f.indentation;){b.pop();f=b[b.length-1]}d.parent=f;d.children=
[];f!=null&&f.children.push(d);(f==null||d.indentation>f.indentation)&&b.push(d)}c.isHierarchicalInformationInitialized=true},r=function(a,b,c,d,e){for(var f=0,h=0;h<b.length;h++){var g=b[h];a.appendChild(ba(g,b,c,d,e));var j=f;g.isVisible&&!(typeof g.isHidden!=="undefined"&&g.isHidden)&&(f=Math.max(f,j+e.itemHeight));g.itemTop=j}setTimeout(function(){P(b,e)},0)},w=function(a,b){for(var c=0,d=0;d<a.length;d++){var e=a[d];e.isVisible&&!(typeof e.isHidden!=="undefined"&&e.isHidden)&&(c=c+b.itemHeight)}return c},
V=function(a,b,c){for(var d=0,e=0;e<b.length;e++){var f=b[e];if(f==a)break;f.isVisible&&!(typeof f.isHidden!=="undefined"&&f.isHidden)&&(d=d+c.itemHeight)}return a.itemTop=d},P=function(a,b){if(!(typeof b.alternativeItemClass==="undefined"&&typeof b.alternativeItemStyle==="undefined")){var c,d=0;for(c=0;c<a.length;c++){var e=a[c];if(e.isVisible&&typeof e.alternativeContentContainer!=="undefined"){e=e.alternativeContentContainer;if(d%2==1){typeof b.alternativeItemClass!=="undefined"&&e.setAttribute("class",
b.alternativeItemClass);typeof b.alternativeItemStyle!=="undefined"&&e.setAttribute("style",b.alternativeItemStyle)}else{e.setAttribute("class","");e.setAttribute("style","")}d++}}}},ba=function(a,b,c,d,e){var f=a.treeGrid.ownerDocument,h=f.createElement("div");typeof e.itemClass!=="undefined"&&h.setAttribute("class",e.itemClass);typeof e.itemStyle!=="undefined"&&h.setAttribute("style",e.itemStyle);var g=f.createElement("div");a.alternativeContentContainer=g;var j=f.createElement("div");try{j.addEventListener("mousedown",
function(b){b.target!=a.selectionInput&&p(a,e)},false);j.addEventListener("mouseup",function(b){b.target!=a.selectionInput&&p(a,e)},false)}catch(m){}if(a.isSelected){typeof e.selectedItemClass!=="undefined"&&j.setAttribute("class",e.selectedItemClass);typeof e.selectedItemStyle!=="undefined"&&j.setAttribute("style",e.selectedItemStyle)}var k=f.createElement("div");typeof a["class"]!=="undefined"&&k.setAttribute("class",a["class"]);typeof a.style!=="undefined"&&k.setAttribute("style",a.style);var o=
f.createElement("div");if(a.hasChildren&&(typeof a.isSummaryEnabled==="undefined"||a.isSummaryEnabled)){typeof e.summaryItemClass!=="undefined"&&o.setAttribute("class",e.summaryItemClass);typeof e.summaryItemStyle!=="undefined"&&o.setAttribute("style",e.summaryItemStyle)}else{typeof e.standardItemClass!=="undefined"&&o.setAttribute("class",e.standardItemClass);typeof e.standardItemStyle!=="undefined"&&o.setAttribute("style",e.standardItemStyle)}f=f.createElement("div");a.gridItem=f;a.gridItemContent=
o;a.gridItemSelectionContainer=j;var F=e.itemHeight;if(!a.isVisible||typeof a.isHidden!=="undefined"&&a.isHidden)F=0;f.setAttribute("style","overflow: hidden; height: "+F+"px");Q(f,a,b,c,d,e);o.appendChild(f);k.appendChild(o);j.appendChild(k);g.appendChild(j);h.appendChild(g);return a.gridItemContainer=h},Q=function(a,b,c,d,e,f){var h=b.treeGrid.ownerDocument;if(!f.isVirtualizing||typeof b.isVirtuallyVisible!=="undefined"&&b.isVirtuallyVisible){var g=function(){if(typeof b.gridItemSelectionContainer!==
"undefined"){var g=b.gridItemSelectionContainer;typeof f.selectedItemClass!=="undefined"&&g.setAttribute("class",b.isSelected?f.selectedItemClass:null);typeof f.selectedItemStyle!=="undefined"&&g.setAttribute("style",b.isSelected?f.selectedItemStyle:null)}if(typeof b.gridItemContent!=="undefined"){g=b.gridItemContent;g.setAttribute("class","");g.setAttribute("style","");if(b.hasChildren&&(typeof b.isSummaryEnabled==="undefined"||b.isSummaryEnabled)){typeof f.summaryItemClass!=="undefined"&&g.setAttribute("class",
f.summaryItemClass);typeof f.summaryItemStyle!=="undefined"&&g.setAttribute("style",f.summaryItemStyle)}else{typeof f.standardItemClass!=="undefined"&&g.setAttribute("class",f.standardItemClass);typeof f.standardItemStyle!=="undefined"&&g.setAttribute("style",f.standardItemStyle)}}var g=[],m=null;try{m=h.activeElement}catch(k){}for(;m!=null&&m!=b.gridItem;){g.push(m);m=m.parentNode}for(var o=-1,m=a.childNodes.length;m-- >0;)if(g.indexOf(a.childNodes[m])>=0){o=m;break}for(m=a.childNodes.length;m-- >
0;)a.removeChild(a.childNodes[m]);for(m=0;m<d.length;m++)a.appendChild(ca(b,c,d[m],e,f));typeof b.treeGrid.draggingItem==="undefined"&&o>=0&&setTimeout(function(){try{for(var b=a.childNodes[o];b.nodeName!="input"&&b.nodeName!="textarea"&&b.nodeName!="label"&&b.nodeName!="select"&&b.nodeName!="button"&&b.childNodes.length>0;)b=b.childNodes[0];b&&b.dontAutoFocus?delete b.dontAutoFocus:setTimeout(function(){try{b.focus()}catch(a){}},0)}catch(c){}},0)};if(b.wasGridItemContentLoaded)setTimeout(g,0);else{g();
b.wasGridItemContentLoaded=true}}},W=function(a){if(typeof a.isWaitingToRefreshGridItem==="undefined"){a.isWaitingToRefreshGridItem=true;setTimeout(function(){typeof a.gridItem!=="undefined"&&Q(a.gridItem,a,a.treeGrid.items,a.treeGrid.settings.columns,a.treeGrid.settings.toggleButtonAreaWidth,a.treeGrid.settings);V(a,a.treeGrid.items,a.treeGrid.settings);delete a.isWaitingToRefreshGridItem},0)}},ta=function(a,b,c,d,e,f){var h=b.treeGrid.ownerDocument;(!f.isVirtualizing||typeof b.isVirtuallyVisible!==
"undefined"&&b.isVirtuallyVisible)&&setTimeout(function(){if(typeof b.gridItemSelectionContainer!=="undefined"){var g=b.gridItemSelectionContainer;typeof f.selectedItemClass!=="undefined"&&g.setAttribute("class",b.isSelected?f.selectedItemClass:null);typeof f.selectedItemStyle!=="undefined"&&g.setAttribute("style",b.isSelected?f.selectedItemStyle:null)}var g=[],j=null;try{j=h.activeElement}catch(m){}for(;j!=null&&j!=b.gridItem;){g.push(j);j=j.parentNode}for(var k=-1,j=a.childNodes.length;j-- >0;)if(a.childNodes[j].isSelection&&
g.indexOf(a.childNodes[j])>=0){k=j;break}for(j=a.childNodes.length;j-- >0;)a.childNodes[j].isSelection&&a.removeChild(a.childNodes[j]);for(j=0;j<d.length;j++)d[j].isSelection&&j<a.childNodes.length&&a.insertBefore(ca(b,c,d[j],e,f),a.childNodes[j]);typeof b.treeGrid.draggingItem==="undefined"&&k>=0&&setTimeout(function(){try{for(var b=a.childNodes[k];b.nodeName!="input"&&b.nodeName!="textarea"&&b.nodeName!="label"&&b.nodeName!="select"&&b.nodeName!="button"&&b.childNodes.length>0;)b=b.childNodes[0];
b&&b.dontAutoFocus?delete b.dontAutoFocus:setTimeout(function(){try{b.focus()}catch(a){}},0)}catch(c){}},0)},0)},aa=function(a){typeof a.gridItem!=="undefined"&&ta(a.gridItem,a,a.treeGrid.items,a.treeGrid.settings.columns,a.treeGrid.settings.toggleButtonAreaWidth,a.treeGrid.settings)},ca=function(a,b,c,d,e){var f=a.treeGrid.ownerDocument,h=f.createElement("div"),g=0;c.isTreeView==true&&(g=e.indentationLevelWidth*a.indentation);h.setAttribute("style","overflow: hidden; vertical-align: middle; display: table-cell; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing; margin: 0px; padding: 0px; width: "+
c.width+"px; height: "+e.itemHeight+"px; padding-left: "+g+"px");var j=f.createElement("div");typeof c.cellClass!=="undefined"?j.setAttribute("class",c.cellClass):typeof e.cellClass!=="undefined"&&j.setAttribute("class",e.cellClass);typeof c.cellStyle!=="undefined"?j.setAttribute("style",c.cellStyle):typeof e.cellStyle!=="undefined"&&j.setAttribute("style",e.cellStyle);var m=f.createElement("div");m.setAttribute("style","white-space: nowrap; overflow: hidden; margin: 0px; padding: 0px; width: "+(c.width-
g-16)+"px");if(c.isTreeView==true){g=f.createElement("div");g.setAttribute("style","display: inline-block; width: "+d+"px");if(a.hasChildren){d=f.createElement("div");d.setAttribute("style","cursor: default; padding-left: 1px; font-size: 12px; display: inline-block");f=e.collapsedToggleButtonTemplate;if(a.isExpanded)f=e.expandedToggleButtonTemplate;f=f();d.appendChild(f);da(d,a,b,f,null,null,e);g.appendChild(d)}m.appendChild(g)}a=c.cellTemplate(a);m.appendChild(a);j.appendChild(m);h.appendChild(j);
h.isSelection=c.isSelection;return h},Z=function(a,b){return function(){var c=a.ownerDocument.createElementNS("http://www.w3.org/2000/svg","polygon");c.setAttribute("points","3.5,2.5 3.5,11.5 10.5,6.5");return s(c,b)}},$=function(a,b){return function(){var c=a.ownerDocument.createElementNS("http://www.w3.org/2000/svg","polygon");c.setAttribute("points","2.5,3.5 11.5,3.5 6.5,10.5");return s(c,b)}},da=function(a,b,c,d,e,f,h){if(typeof e==="undefined"||e==null)e=d.querySelector("#PART_Button");e!=null&&
ea(e,e,h);if(typeof f==="undefined"||f==null)f=d.querySelector("#PART_Border");f!=null&&ea(f,e,h);c={toggleButton:a,item:b,items:c,content:d,settings:h};if(e!=null){e.tag=c;(typeof h.isExport==="undefined"||!h.isExport)&&e.addEventListener("mouseup",X,true)}if(f!=null){f.tag=c;(typeof h.isExport==="undefined"||!h.isExport)&&f.addEventListener("mouseup",X,true)}a.tag=c;e==null&&(f==null&&(typeof h.isExport==="undefined"||!h.isExport))&&a.addEventListener("mouseup",X,true);d.addEventListener("keypress",
function(a){if(a.keyCode==32){a.preventDefault();a.stopPropagation();C(b,!b.isExpanded,true)}},true);b.toggleButton=a},ea=function(a,b,c){if(!(typeof c.isExport!=="undefined"&&c.isExport)){a.addEventListener("mouseover",function(){typeof c.toggleButtonHoveringClass!=="undefined"&&b.setAttribute("class",c.toggleButtonHoveringClass);typeof c.toggleButtonHoveringStyle!=="undefined"&&b.setAttribute("style",c.toggleButtonHoveringStyle)},true);a.addEventListener("mouseout",function(){b.setAttribute("class",
c.toggleButtonClass);b.setAttribute("style",c.toggleButtonStyle)},true)}},X=function(a){a.stopPropagation();a=a.target.tag.item;C(a,!a.isExpanded,true)},C=function(a,b,c,d){if(a.isExpanded!=b){a.isExpanded=b;(typeof d==="undefined"||d)&&v(a,"isExpanded",c,true);fa(a)}},fa=function(a,b){if(typeof a.toggleButton==="undefined")(typeof b==="undefined"||b)&&setTimeout(function(){fa(a,false)},0);else{var c=a.toggleButton,d=c.tag,e=d.settings,f=e.expandedToggleButtonTemplate,h=e.collapsedToggleButtonTemplate;
a.isExpanded&&(h=f);var f=h(),h=f.querySelector("#PART_Button"),g=f.querySelector("#PART_Border");c.replaceChild(f,d.content);d.content=f;d=d.items;da(c,a,d,f,h,g,e);a.isVisible&&!(typeof a.isHidden!=="undefined"&&a.isHidden)&&ua(d,a,e);P(d,e)}},ua=function(a,b,c){var d=-1,e=false,f=false,h=false,g=0,j,m,k;for(m=0;m<a.length;m++){k=a[m];if(k==b){e=k.isExpanded;d=k.indentation}else k.indentation<=d&&(h=true);if(f&&!h){if(e){j=true;for(var o=k.parent;o!=null;){if(!o.isVisible||!o.isExpanded){j=false;
break}o=o.parent}}else j=false;if(k.isVisible!=j){k.isVisible=e;v(k,"isVisible",false,true);j=c.itemHeight;if(!k.isVisible||typeof k.isHidden!=="undefined"&&k.isHidden)j=0;if(typeof k.gridItem!=="undefined")k.gridItem.style.height=j+"px"}}k==b&&(f=true);j=c.itemHeight;if(!k.isVisible||typeof k.isHidden!=="undefined"&&k.isHidden)j=0;if(k.itemTop!=g)k.itemTop=g;g=g+j}I(a,b.treeGrid.gridContentContainer,c)},L=function(a){for(var b=0;b<a.length;b++)J(a[b])},J=function(a){if(!a.treeGrid.settings.isVirtualizing||
typeof a.isVirtuallyVisible!=="undefined"&&a.isVirtuallyVisible){a.isWaitingToRefreshGridItem=true;setTimeout(function(){typeof a.gridItem!=="undefined"&&Q(a.gridItem,a,a.treeGrid.items,a.treeGrid.settings.columns,a.treeGrid.settings.toggleButtonAreaWidth,a.treeGrid.settings);V(a,a.treeGrid.items,a.treeGrid.settings);delete a.isWaitingToRefreshGridItem},0)}},R=function(a){J(a);for(a=a.parent;a!=null;){J(a);a=a.parent}},M=function(a,b,c,d){E(b,d);N(b,c);O(b,d,c);c=a.index-1;c>=0&&R(b[c]);R(a);c=a.index+
1;c<b.length&&R(b[c])},S=function(a,b){var c=b.toggleButtonAreaWidth;delete b.toggleButtonAreaWidth;H(a,b);return b.toggleButtonAreaWidth!=c},v=function(a,b,c,d){if(typeof a.treeGrid!=="undefined"){a.treeGrid.settings.itemPropertyChangeHandler(a,b,c,d);b=="isExpanded"?typeof a.treeGrid!=="undefined"&&typeof a.treeGrid.settings.itemExpansionChangeHandler!=="undefined"&&a.treeGrid.settings.itemExpansionChangeHandler(a,a.isExpanded):b=="isSelected"&&typeof a.treeGrid!=="undefined"&&typeof a.treeGrid.settings.itemSelectionChangeHandler!==
"undefined"&&a.treeGrid.settings.itemSelectionChangeHandler(a,a.isSelected,c)}},qa=function(a,b){for(var c=0;c<a.length;c++){var d=a[c],e=b==null||b(d);d.isHidden=!e;if(e)for(d=d.parent;d!=null;){d.isHidden=false;d=d.parent}}},va=function(a){var b=0;if(a.offsetParent){do{b=b+a.offsetTop;a=a.offsetParent}while(a)}return b},wa=function(a,b){if(typeof b.draggingItem!=="undefined"){var a=a-va(b),c,d;if(a<b.gridHeaderContainer.clientHeight+24){c=b.gridContentContainer.scrollTop;b.gridContentContainer.scrollTop=
b.gridContentContainer.scrollTop-20;if(typeof b.isDuringVerticalScrolling==="undefined"){b.isDuringVerticalScrolling=true;setTimeout(function(){d=c-b.gridContentContainer.scrollTop;b.draggingInitialThumbPosition=b.draggingInitialThumbPosition-d;delete b.isDuringVerticalScrolling},0)}}else if(a>=b.gridHeaderContainer.clientHeight+b.gridContentContainer.clientHeight-24){c=b.gridContentContainer.scrollTop;b.gridContentContainer.scrollTop=b.gridContentContainer.scrollTop+20;if(typeof b.isDuringVerticalScrolling===
"undefined"){b.isDuringVerticalScrolling=true;setTimeout(function(){d=b.gridContentContainer.scrollTop-c;b.draggingInitialThumbPosition=b.draggingInitialThumbPosition+d;delete b.isDuringVerticalScrolling},0)}}}},ga=function(a){var b=a.itemTop-a.treeGrid.gridContentContainer.scrollTop;if(b<0)a.treeGrid.gridContentContainer.scrollTop=a.itemTop;else if(b>a.treeGrid.gridContentContainer.clientHeight-a.treeGrid.settings.itemHeight)a.treeGrid.gridContentContainer.scrollTop=a.itemTop-(a.treeGrid.gridContentContainer.clientHeight-
a.treeGrid.settings.itemHeight)},sa=function(a,b,c,d,e,f,h,g){b.addEventListener("scroll",function(){if(d.scrollLeft!=b.scrollLeft)d.scrollLeft=b.scrollLeft;I(h,b,g)},true);ha(b,c,e,g);typeof a.updateGridHeaderTimer!=="undefined"&&clearInterval(a.updateGridHeaderTimer);a.updateGridHeaderTimer=setInterval(function(){try{ha(b,c,e,g)}catch(d){try{clearInterval(a.updateGridHeaderTimer)}catch(f){}}},100);window.addEventListener("mousewheel",function(){try{a.cancelDrag=true}catch(b){}},true)},ha=function(a,
b,c,d){setTimeout(function(){try{var e=b.clientWidth-a.clientWidth;e<0&&(e=0);var f=e+"px";if(c.style.width!=f){c.style.width=f;if(e>0){c.style.boxSizing="border-box";c.style.MozBoxSizing="border-box";c.style.border="solid 1px "+d.border;c.style.borderTop="none";c.style.borderRight="none"}else{c.style.border="";c.style.borderTop="";c.style.borderRight="";c.style.boxSizing="";c.style.MozBoxSizing=""}}}catch(h){}},0)},I=function(a,b,c){if(c.isVirtualizing)for(var d=b.scrollTop-c.itemHeight,b=d+b.clientHeight+
2*c.itemHeight,e=0;e<a.length;e++){var f=a[e];if(typeof f.isVirtuallyVisible==="undefined"&&(typeof f.isVisible==="undefined"||f.isVisible)&&!(typeof f.isHidden!=="undefined"&&f.isHidden)&&typeof f.itemTop!=="undefined"&&f.itemTop>=d&&f.itemTop<b){f.isVirtuallyVisible=true;v(f,"isVirtuallyVisible",false,true);typeof f.gridItem!=="undefined"&&Q(f.gridItem,f,a,c.columns,c.toggleButtonAreaWidth,c)}else typeof f.isVirtuallyVisible!=="undefined"&&((typeof f.isVisible==="undefined"||f.isVisible)&&!(typeof f.isHidden!==
"undefined"&&f.isHidden)&&typeof f.itemTop!=="undefined"&&(f.itemTop<d||f.itemTop>=b))&&delete f.isVirtuallyVisible}},ra=function(a,b){for(var c=a.childNodes.length;c-- >0;)a.removeChild(a.childNodes[c]);a.appendChild(b)},Y=function(a,b,c,d){var e=d.indexOf(a);if(!(e<0||b<0||b==e||b>=d.length)){d.splice(e,1);d.splice(b,0,a);ia(d);u(c);typeof c.settings.itemMoveHandler!=="undefined"&&c.settings.itemMoveHandler(a,e,b)}},T=function(a,b,c,d,e){if(!(a<0||c<0||c==a||c>e.length-b)){var f=[],h;for(h=a;h<
a+b;h++)f.push(e[h]);e.splice(a,b);for(h=0;h<f.length;h++)e.splice(c+h,0,f[h]);ia(e);u(d);if(typeof d.settings.itemMoveHandler!=="undefined")for(h=0;h<f.length;h++)d.settings.itemMoveHandler(f[h],a+h,c+h)}},ia=function(a){for(var b=0,c=0;c<a.length;c++){var d=a[c];if(d.indentation>b){d.indentation=b;v(d,"indentation",false,true)}b=d.indentation+1}},xa=function(a,b,c,d,e,f,h,g,j,m){a.addEventListener("mousedown",function(c){if(c.button==0){delete d.cancelDrag;d.draggingItem=b;d.dragType="Ordering";
d.style.cursor=a.style.cursor;d.draggingInitialY=c.clientY;d.draggingInitialThumbPosition=0;c.preventDefault()}},true);if(typeof d.draggableOrderingItems==="undefined")d.draggableOrderingItems=[];for(var k=false,o=0;o<d.draggableOrderingItems.length;o++)if(d.draggableOrderingItems[o]==b){k=true;break}if(!k){d.addEventListener("mousemove",function(a){if(!(typeof d.draggingItem==="undefined"||d.draggingItem!=b||d.dragType!="Ordering")){if(typeof d.temporaryHoveredGridItemSelectionContainer!=="undefined"){d.temporaryHoveredGridItemSelectionContainer.setAttribute("class",
d.temporaryHoveredGridItemClass);d.temporaryHoveredGridItemSelectionContainer.setAttribute("style",d.temporaryHoveredGridItemStyle);delete d.temporaryHoveredGridItemSelectionContainer;delete d.temporaryHoveredGridItemClass;delete d.temporaryHoveredGridItemStyle}var l=a.clientY-d.draggingInitialY;wa(a.clientY,d);delete d.draggingItem;if(d.cancelDrag){p(b,e);delete d.cancelDrag;delete d.draggingItem;d.style.cursor="default"}else{for(var a=Math.floor((b.itemTop+d.draggingInitialThumbPosition+l)/e.itemHeight),
l=null,k=0,o=0;o<c.length;o++){var n=c[o];if(n.isVisible&&!(typeof n.isHidden!=="undefined"&&n.isHidden)){if(k==a){l=n;break}k++}}if(l!=null&&l!=b&&l.gridItemSelectionContainer!=null){d.temporaryHoveredGridItemSelectionContainer=l.gridItemSelectionContainer;d.temporaryHoveredGridItemClass=l.gridItemSelectionContainer.getAttribute("class");d.temporaryHoveredGridItemStyle=l.gridItemSelectionContainer.getAttribute("style");typeof f==="undefined"||f(a,l)?typeof h!=="undefined"?l.gridItemSelectionContainer.setAttribute("class",
h):typeof g!=="undefined"&&l.gridItemSelectionContainer.setAttribute("style",g):typeof j!=="undefined"?l.gridItemSelectionContainer.setAttribute("class",j):typeof m!=="undefined"&&l.gridItemSelectionContainer.setAttribute("style",m)}d.draggingItem=b}}},true);document.addEventListener("mouseup",function(a){if(!(a.button!=0||typeof d.draggingItem==="undefined"||d.draggingItem!=b||d.dragType!="Ordering")){if(typeof d.temporaryHoveredGridItemSelectionContainer!=="undefined"){d.temporaryHoveredGridItemSelectionContainer.setAttribute("class",
d.temporaryHoveredGridItemClass);d.temporaryHoveredGridItemSelectionContainer.setAttribute("style",d.temporaryHoveredGridItemStyle);delete d.temporaryHoveredGridItemSelectionContainer;delete d.temporaryHoveredGridItemClass;delete d.temporaryHoveredGridItemStyle}for(var a=Math.floor((b.itemTop+d.draggingInitialThumbPosition+(a.clientY-d.draggingInitialY))/e.itemHeight),g=null,h=0,j=0;j<c.length;j++){var k=c[j];if(k.isVisible&&!(typeof k.isHidden!=="undefined"&&k.isHidden)){if(h==a){g=k;break}h++}}g!=
null&&(typeof f==="undefined"||f(a,g))&&d.moveItemHierarchy(d.draggingItem,g.index);setTimeout(function(){p(b,e);ga(b)},0);delete d.draggingItem;d.style.cursor="default"}},true);d.draggableOrderingItems.push(b)}},ya=function(a,b){for(var c in b)c.indexOf("custom")!=0&&c.indexOf("description")!=0||typeof a[c]==="undefined"&&(a[c]=b[c])},ja=function(a,b,c,d,e,f,h,g,j,m,k){var o,n=[],l;if(typeof c!=="undefined")for(o=0;o<c.length;o++){l=k.columns[c[o]];n.push({isTreeView:l.isTreeView,header:l.header,
width:l.width,headerClass:l.headerClass,headerStyle:l.headerStyle,cellClass:l.cellClass,cellStyle:l.cellStyle,cellTemplate:typeof l.exportCellTemplate!=="undefined"?l.exportCellTemplate:l.cellTemplate})}else for(o=0;o<k.columns.length;o++){l=k.columns[o];l.isSelection||n.push({isTreeView:l.isTreeView,header:l.header,width:l.width,headerClass:l.headerClass,headerStyle:l.headerStyle,cellClass:l.cellClass,cellStyle:l.cellStyle,cellTemplate:typeof l.exportCellTemplate!=="undefined"?l.exportCellTemplate:
l.cellTemplate})}o=U(n)+1;var k={isExport:true,isReadOnly:true,selectionMode:"None",isVirtualizing:false,gridWidth:o+"px",columns:n,allowUserToResizeColumns:false,containerClass:k.containerClass,containerStyle:k.containerStyle,border:k.border,theme:k.theme,headerBackground:k.headerBackground,headerHeight:k.headerHeight,itemHeight:k.itemHeight,itemClass:k.itemClass,itemStyle:k.itemStyle,standardItemClass:k.standardItemClass,summaryItemClass:k.summaryItemClass,standardItemStyle:k.standardItemStyle,
summaryItemStyle:k.summaryItemStyle,indentationLevelWidth:k.indentationLevelWidth,toggleButtonClass:k.toggleButtonClass,toggleButtonStyle:k.toggleButtonStyle,gridLines:k.gridLines,horizontalGridLines:k.horizontalGridLines,verticalGridLines:k.verticalGridLines,target:k.target},q=o+2,D,p,t=false;if(f!=null&&typeof f.createElement!=="undefined")D=f;else{if(f!=null&&typeof f.focus!=="undefined")p=f;else{p=window.open("",f!=null?f:"_blank",typeof h!=="undefined"&&h&&(typeof j==="undefined"||j)?"width=320,height=100,location=no,menubar=no,toolbar=no,status=no,scrollbars=yes":
"");t=true}D=p.document}D.title=typeof a!=="undefined"?a:"Exported hierarchy"+(typeof h!=="undefined"&&h?" (printable)":"");typeof d==="undefined"&&(d=0);typeof e==="undefined"&&(e=m.length-1);a=[];for(o=c=0;o<m.length;o++){f=m[o];if(!(c++<d||c>e+1)){n={content:f.content,indentation:f.indentation,"class":f["class"],style:f.style,isSummaryEnabled:f.isSummaryEnabled,isHidden:f.isHidden,isExported:true,tag:f};ya(n,f);a.push(n);f.exportItem=n}}var s=D.createElement("p");s.innerHTML=typeof b!=="undefined"?
b:"";D.body.appendChild(s);var r=D.createElement("div");r.setAttribute("style","width: "+q+"px");try{DlhSoft.Controls.TreeGrid.initialize(r,a,k,"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase.")}catch(u){}setTimeout(function(){t&&D.body.setAttribute("style","margin: 0px");var a=D.createElement("div");a.appendChild(r);D.body.replaceChild(a,s);if(g){a.setAttribute("style","width: "+r.offsetHeight+"px; height: "+
q+"px; overflow: hidden");a=Math.round((r.offsetWidth-r.offsetHeight)/2);r.setAttribute("style","width: "+q+"px; transform: rotate(90deg) translateX("+a+"px) translateY("+a+"px); -webkit-transform: rotate(90deg) translateX("+a+"px) translateY("+a+"px)")}D.close();if(typeof p!==void 0){p.focus();if(typeof h!=="undefined"&&h){p.print();(typeof j==="undefined"||j)&&p.close()}}},0)},ka=function(a,b,c){typeof c==="undefined"&&(c=false);var d=a.parent,e=a.index;if(d==null){for(d=0;e-- >0;){a=b[e];a.indentation==
0&&d++}return d+(!c?1:0)}return ka(d,b)+"."+(d.children.indexOf(a)+(!c?1:0))},pa=function(a,b,c){var d;for(d=0;d<b.length;d++)b[d].treeGrid=a;a.items=b;a.settings=c;a.refresh=function(){u(a)};a.refreshItems=function(){L(b)};a.refreshGridItems=function(){for(var a=0;a<b.length;a++)W(b[a])};a.refreshGridItem=W;a.refreshItem=J;a.refreshItemPath=R;a.refreshItemNeighbourhood=function(e){M(e,b,a,c)};a.getCurrentItem=function(){return a.currentItem};a.getSelectedItem=function(){return a.selectedItem};a.getSelectedItems=
function(){return a.selectedItems};a.selectItem=function(a){t(a,true,c.selectionMode)};a.unselectItem=function(a){t(a,false,c.selectionMode)};a.expandItem=function(a){C(a,true,true)};a.collapseItem=function(a){C(a,false,true)};a.scrollToItem=ga;a.scrollToBottom=function(){a.gridContentContainer.scrollTop=a.gridContent.clientHeight};a.getItemsHeight=function(){return w(b,c)};a.getItemTop=function(a){return V(a,b,c)};a.onItemPropertyChanged=v;a.insertItem=function(e,d){d.treeGrid=a;d.isVirtuallyVisible=
true;var h=e<b.length?b[e]:null;if(h==null){h=e>0?b[e-1]:null;h=h!=null?h.indentation+1:0;if(d.indentation>h)d.indentation=h}else if(typeof d.indentation==="undefined"||d.indentation<h.indentation-1||d.indentation>h.indentation)d.indentation=h.indentation;E([d],c);b.splice(e,0,d);N(b,a);O(b,c,a);var g,j=null;if(e<b.length-1){h=b[e+1];g=h.itemTop;if(typeof h.gridItemContainer!=="undefined")j=h.gridItemContainer}a.gridContent.insertBefore(ba(d,b,c.columns,c.toggleButtonAreaWidth,c),j);typeof g==="undefined"&&
(g=w(b,c)-c.itemHeight);h=g;d.isVisible&&!(typeof d.isHidden!=="undefined"&&d.isHidden)&&Math.max(g,h+c.itemHeight);d.itemTop=h;for(g=e+1;g<b.length;g++)W(b[g]);if(a.isContentHeightInitialized&&a.isContentHeightAuto){g=G(a,b,c);a.gridContentContainer.style.height=g}P(b,c);S(b,c)&&L(b);M(d,b,a,c);I(b,a.gridContentContainer,c)};a.addItem=function(c){a.insertItem(b.length,c)};a.insertItems=function(b,c){for(var d=0;d<c.length;d++)a.insertItem(b++,c[d])};a.addItems=function(b){for(var c=0;c<b.length;c++)a.addItem(b[c])};
a.removeItem=function(d){var f=d.index,h=d.itemTop,g=null,j=false;if(f>0){for(g=b[f-1];g.parent!=null;)g=g.parent;j=g.isExpanded;d.hasChildren&&C(g,d.isExpanded,false,true);g.indentation>=d.indentation&&(g=null)}else b[0].isExpanded||C(b[0],true,false,true);var m=f+1<b.length?b[f+1]:null;m!=null&&(!m.isExpanded&&m.indentation>d.indentation)&&C(m,true,false,true);var k=m!=null?m.indentation:null;b.splice(f,1);N(b,a);O(b,c,a);typeof d.gridItemContainer!=="undefined"&&a.gridContent.removeChild(d.gridItemContainer);
m=f<b.length?b[f]:null;m!=null&&m.indentation<k&&v(m,"indentation",false,true);g!=null&&C(g,j,false,true);for(d=f;d<b.length;d++){g=b[d];actualItemTop=h;g.isVisible&&!(typeof g.isHidden!=="undefined"&&g.isHidden)&&(h=Math.max(h,actualItemTop+c.itemHeight));g.itemTop=actualItemTop;J(g)}P(b,c);S(b,c)&&L(b);f>=b.length&&(f=b.length-1);f>=0&&M(b[f],b,a,c);I(b,a.gridContentContainer,c)};a.removeItems=function(b){for(var c=0;c<b.length;c++)a.removeItem(b[c])};a.increaseItemIndentation=function(d){var f=
d.index>0?a.items[d.index-1]:null;if(!(f==null||d.indentation>f.indentation)){C(d,true,false,true);d.indentation++;v(d,"indentation",true,true);S(b,c)&&L(b);for(M(d,b,a,c);d!=null;){d.isExpanded||C(d,true,false);d=d.parent}}};a.decreaseItemIndentation=function(d){var f=d.index<a.items.length-1?a.items[d.index+1]:null;if(!(d.indentation<=0||f!=null&&d.indentation<f.indentation)){d.indentation--;v(d,"indentation",true,true);S(b,c)&&L(b);for(M(d,b,a,c);d!=null;){d.isExpanded||C(d,true,false);d=d.parent}}};
a.setItemContent=function(a,b){a.content=b;v(a,"content",true,true)};a.getItemIndexString=function(a,b){typeof b==="undefined"&&(b=false);return typeof a.index!=="undefined"?(a.index+(!b?1:0)).toString():""};a.getItemWbsIndexString=function(a,c){return ka(a,b,c).toString()};a.moveRange=function(c,d,h){T(c,d,h,a,b)};a.moveItem=function(c,d){Y(c,d,a,b)};a.moveItemUp=function(c){var d=b.indexOf(c);d<=0||Y(c,d-1,a,b)};a.moveItemDown=function(c){var d=b.indexOf(c);d<0||d>=b.length-1||Y(c,d+1,a,b)};a.moveItemHierarchy=
function(c,d){for(var h=b.indexOf(c),g=h+1;g<b.length;g++)if(b[g].indentation<=c.indentation)break;T(h,g-h,d,a,b)};a.moveItemHierarchyUp=function(c){for(var d=b.indexOf(c),h=d+1;h<b.length;h++)if(b[h].indentation<=c.indentation)break;for(var g=d;g-- >0;){if(b[g].indentation<c.indentation)return;if(b[g].indentation==c.indentation)break}T(d,h-d,g,a,b)};a.moveItemHierarchyDown=function(c){for(var d=b.indexOf(c),h=d+1;h<b.length;h++)if(b[h].indentation<=c.indentation)break;for(var h=h-d,g=d+h;g++<b.length-
1;)if(b[g].indentation<=c.indentation)break;b[g-1].indentation<c.indentation||T(d,h,g-h,a,b)};a.exportContent=function(a,d){typeof a==="undefined"&&(a={});ja(a.title,a.preparingMessage,a.columnIndexes,a.startRowIndex,a.endRowIndex,d,false,a.rotate,false,b,c)};a.print=function(a){typeof a==="undefined"&&(a={});ja(a.title,a.preparingMessage,a.columnIndexes,a.startRowIndex,a.endRowIndex,null,true,a.rotate,a.autoClose,b,c)};a.getRootItems=function(){for(var a=[],c=0;c<b.length;c++){var d=b[c];d.parent==
null&&a.push(d)}return a};a.getLeafItems=function(){for(var a=[],c=0;c<b.length;c++){var d=b[c];d.parent!=null&&a.push(d)}return a};a.copyCommonSettings=function(a){if(typeof a!=="undefined"){a.target=c.target;a.theme=c.theme;a.border=c.border;a.containerClass=c.containerClass;a.containerStyle=c.containerStyle;a.gridWidth=c.gridWidth;a.headerBackground=c.headerBackground;a.headerHeight=c.headerHeight;a.indentationLevelWidth=c.indentationLevelWidth;a.gridLines=c.gridLines;a.horizontalGridLines=c.horizontalGridLines;
a.verticalGridLines=c.verticalGridLines}}};return{initialize:y,initializeItems:E,refresh:u,getDefaultColumns:B,getDefaultCollapsedToggleButtonTemplate:Z,getDefaultExpandedToggleButtonTemplate:$,textColumnTemplateBase:function(a,b,c){b=b();if(typeof b==="undefined"||typeof c!=="undefined"&&!c())b="";return a.createTextNode(b)},textInputColumnTemplateBase:function(a,b,c,d,e,f,h){var g=a.createElement("input");g.setAttribute("type","text");a=c();typeof a==="undefined"&&(a="");g.setAttribute("value",
a);a="";typeof f!=="undefined"&&!f()&&(a="; display: none");f="";typeof h!=="undefined"&&h()&&(f="; font-weight: bold");g.setAttribute("style","background-color: Transparent; width: "+b+"px; border-width: 0px; padding: 0px"+a+f);typeof e!=="undefined"&&!e()&&g.setAttribute("disabled","true");g.addEventListener("change",function(){d(g.value)},true);g.addEventListener("keypress",function(a){if(a.keyCode==13){a.preventDefault();a.stopPropagation();d(g.value)}},true);g.addEventListener("focus",function(){g.style.backgroundColor=
"White"},true);g.addEventListener("blur",function(){g.style.backgroundColor="Transparent"},true);return g},optionSelectColumnTemplateBase:function(a,b,c,d,e,f,h,g){var j=a.createElement("select"),m=function(b,c){var d=a.createElement("option");d.appendChild(a.createTextNode(b));b==c&&d.setAttribute("selected",true);j.appendChild(d)},d=d();typeof d==="undefined"&&(d="");m("",d);for(var c=c(),k=0;k<c.length;k++)m(c[k],d);m="";typeof h!=="undefined"&&!h()&&(m="; display: none");h="";typeof g!=="undefined"&&
g()&&(h="; font-weight: bold");j.setAttribute("style","background-color: Transparent; width: "+b+"px; border-width: 0px; padding: 0px"+m+h);typeof f!=="undefined"&&!f()&&j.setAttribute("disabled","true");j.addEventListener("change",function(){e(j.value)},true);j.addEventListener("keypress",function(a){if(a.keyCode==13){a.preventDefault();a.stopPropagation();e(j.value)}},true);j.addEventListener("focus",function(){j.style.backgroundColor="White"},true);j.addEventListener("blur",function(){j.style.backgroundColor=
"Transparent"},true);return j},numberInputColumnTemplateBase:function(a,b,c,d,e,f,h){return DlhSoft.Controls.TreeGrid.textInputColumnTemplateBase(a,b,function(){var a=c();return!isNaN(a)?a:""},function(a){a=parseFloat(a);isNaN(a)&&(a=0);d(a)},e,f,h)},percentInputColumnTemplateBase:function(a,b,c,d,e,f,h){return DlhSoft.Controls.TreeGrid.numberInputColumnTemplateBase(a,b,c,function(a){a<0&&(a=0);a>100&&(a=100);d(a)},e,f,h)},timeSpanInputColumnTemplateBase:function(a,b,c,d,e,f,h,g){typeof e==="undefined"&&
(e=1);return DlhSoft.Controls.TreeGrid.numberInputColumnTemplateBase(a,b,function(){var a=c()/(hourDuration*e);return Math.round(a*100)/100},function(a){a=parseFloat(a);a<0&&(a=0);d(a*hourDuration*e)},f,h,g)},datePickerInputColumnTemplateBase:function(a,b,c,d,e,f,h,g,j,m,k,o,n){k||(k=["Su","Mo","Tu","We","Th","Fr","Sa"]);o||(o=function(a){return a.toString()});n||(n=function(a){return new Date(a)});var l=a.createElement("input");l.setAttribute("type","text");c=c();typeof c==="undefined"?c="":c!=null&&
(c=o(c));l.setAttribute("value",c);DlhSoft.Controls.DatePicker&&l.addEventListener("focus",function(){var b=DlhSoft.Controls.DatePicker.get(l);if(!b||!b.isOpen){var c=0,d=0;try{c=l.selectionStart;d=l.selectionEnd}catch(e){}b=DlhSoft.Controls.DatePicker.initialize(l,void 0,{inputStyle:null,defaultTimeOfDay:g,isDropDownButtonVisible:false,popupStyle:"margin-top: 1px; background-color: White; border: 1px solid #e0e0e0",calendarSelectorLevels:j,months:m,daysOfWeek:getAbbreviations(k),dateTimeFormatter:o,
dateTimeParser:n},"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase.");b.openDropDown();setTimeout(function(){try{l.selectionStart=c;l.selectionEnd=d}catch(a){}},100);navigator.userAgent.match(/(Android)|(IPad)|(IPhone)/i)==null?setTimeout(function(){try{l.focus()}catch(a){}},100):a.createEvent&&setTimeout(function(){var b=a.createEvent("MouseEvents");b.initEvent("blur",true,false);l.dispatchEvent(b)})}},true);c=
"";typeof f!=="undefined"&&!f()&&(c="; display: none");f="";typeof h!=="undefined"&&h()&&(f="; font-weight: bold");l.setAttribute("style","background-color: Transparent; width: "+b+"px; border-width: 0px; padding: 0px"+c+f);typeof e!=="undefined"&&!e()&&l.setAttribute("disabled","true");var p=function(){var a=l.value,a=a!=""?n(a):null;d(a)};l.addEventListener("change",function(){p()},true);l.addEventListener("keypress",function(a){if(a.keyCode==13){a.preventDefault();a.stopPropagation();p()}},true);
l.addEventListener("focus",function(){l.style.backgroundColor="White"},true);l.addEventListener("blur",function(){l.style.backgroundColor="Transparent"},true);return l},dateTimePickerInputColumnTemplateBase:function(a,b,c,d,e,f,h,g,j,m,k,o,n){k||(k=["Su","Mo","Tu","We","Th","Fr","Sa"]);o||(o=function(a){return a.toString()});n||(n=function(a){return new Date(a)});var l=a.createElement("input");l.setAttribute("type","text");c=c();typeof c==="undefined"?c="":c!=null&&(c=o(c));l.setAttribute("value",
c);(DlhSoft.Controls.DateTimePicker||DlhSoft.Controls.DatePicker)&&l.addEventListener("focus",function(){var b=(DlhSoft.Controls.DateTimePicker?DlhSoft.Controls.DateTimePicker:DlhSoft.Controls.DatePicker).get(l);if(!b||!b.isOpen){var c=0,d=0;try{c=l.selectionStart;d=l.selectionEnd}catch(e){}b=(DlhSoft.Controls.DateTimePicker?DlhSoft.Controls.DateTimePicker:DlhSoft.Controls.DatePicker).initialize(l,void 0,{inputStyle:null,defaultTimeOfDay:g,isDropDownButtonVisible:false,popupStyle:"margin-top: 1px; background-color: White; border: 1px solid #e0e0e0",
calendarSelectorLevels:j,months:m,daysOfWeek:getAbbreviations(k),dateTimeFormatter:o,dateTimeParser:n},"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase.");b.openDropDown();setTimeout(function(){try{l.selectionStart=c;l.selectionEnd=d}catch(a){}},100);navigator.userAgent.match(/(Android)|(IPad)|(IPhone)/i)==null?setTimeout(function(){try{l.focus()}catch(a){}},100):a.createEvent&&setTimeout(function(){var b=a.createEvent("MouseEvents");
b.initEvent("blur",true,false);l.dispatchEvent(b)})}},true);c="";typeof f!=="undefined"&&!f()&&(c="; display: none");f="";typeof h!=="undefined"&&h()&&(f="; font-weight: bold");l.setAttribute("style","background-color: Transparent; width: "+b+"px; border-width: 0px; padding: 0px"+c+f);typeof e!=="undefined"&&!e()&&l.setAttribute("disabled","true");var p=function(){var a=l.value,a=a!=""?n(a):null;d(a)};l.addEventListener("change",function(){p()},true);l.addEventListener("keypress",function(a){if(a.keyCode==
13){a.preventDefault();a.stopPropagation();p()}},true);l.addEventListener("focus",function(){l.style.backgroundColor="White"},true);l.addEventListener("blur",function(){l.style.backgroundColor="Transparent"},true);return l},multiSelectorComboBoxInputColumnTemplateBase:function(a,b,c,d,e,f,h,g){var j=a.createElement("input");j.setAttribute("type","text");d=d();typeof d==="undefined"&&(d="");j.setAttribute("value",d);DlhSoft.Controls.MultiSelectorComboBox&&j.addEventListener("focus",function(){var b=
DlhSoft.Controls.MultiSelectorComboBox.get(j);if(!b||!b.isOpen&&b.availableChoices.length>0){var b=c(),d=0,e=0;try{d=j.selectionStart;e=j.selectionEnd}catch(f){}b=DlhSoft.Controls.MultiSelectorComboBox.initialize(j,b,void 0,{inputStyle:null,autoAppendAvailableChoices:false,isDropDownButtonVisible:false,popupStyle:"margin-top: 1px; background-color: White; border: 1px solid #e0e0e0; color: Black; font-size: small; max-height: 188px; overflow-y: auto"},"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase.");
b.openDropDown();setTimeout(function(){try{j.selectionStart=d;j.selectionEnd=e}catch(a){}},100);navigator.userAgent.match(/(Android)|(IPad)|(IPhone)/i)==null?setTimeout(function(){try{j.focus()}catch(a){}},100):a.createEvent&&setTimeout(function(){var b=a.createEvent("MouseEvents");b.initEvent("blur",true,false);j.dispatchEvent(b)})}},true);d="";typeof h!=="undefined"&&!h()&&(d="; display: none");h="";typeof g!=="undefined"&&g()&&(h="; font-weight: bold");j.setAttribute("style","background-color: Transparent; width: "+
b+"px; border-width: 0px; padding: 0px"+d+h);typeof f!=="undefined"&&!f()&&j.setAttribute("disabled","true");j.addEventListener("change",function(){e(j.value)},true);j.addEventListener("keypress",function(a){if(a.keyCode==13){a.preventDefault();a.stopPropagation();e(j.value)}},true);j.addEventListener("focus",function(){j.style.backgroundColor="White"},true);j.addEventListener("blur",function(){j.style.backgroundColor="Transparent"},true);return j},dateTimeInputColumnTemplateBase:function(a,b,c,d,
e,f,h){return DlhSoft.Controls.TreeGrid.textInputColumnTemplateBase(a,b,function(){var a=c();return a!=null?a.toString():""},function(a){a=a!=""?new Date(a):null;d(a)},e,f,h)},getIndexColumnTemplate:function(){return function(a){var b=a.treeGrid;return DlhSoft.Controls.TreeGrid.textColumnTemplateBase(b.ownerDocument,function(){return b.getItemIndexString(a)})}},getWbsColumnTemplate:function(a){return function(b){var c=b.treeGrid;return DlhSoft.Controls.TreeGrid.textColumnTemplateBase(c.ownerDocument,
function(){return c.getItemWbsIndexString(b,a)})}},getIconColumnTemplate:function(a,b,c,d,e,f,h,g,j){if(typeof a==="string")var m=a,a=function(){return m};typeof d==="undefined"||d==false?d=function(){return false}:d==true&&(d=function(){return true});return function(k){var m=k.treeGrid,n=m.ownerDocument.createElement("img");n.setAttribute("src",a(k));typeof b!=="undefined"&&n.setAttribute("class",b);typeof c!=="undefined"&&n.setAttribute("style",c);if(!m.settings.isReadOnly&&d(k)){n.style.cursor=
"move";xa(n,k,m.items,m,m.settings,e,f,h,g,j)}return n}}}}());
;
var DlhSoft;"undefined"===typeof DlhSoft&&(DlhSoft={assemblies:[],buildReleaseDate:new Date(1,0,1)});DlhSoft.assemblies.push({assembly:"DlhSoft.ProjectData.PertChart.HTML.Controls",company:"DlhSoft",product:"Project Data Modern Library",version:"5.3.2.0",copyright:"Copyright \u00a9 2012-2016 DlhSoft",title:"Project Data PERT Chart HTML Controls",description:"Project Data PERT Chart related HTML client components"});
DlhSoft.buildReleaseDate=function(L,M,O){L=new Date(L,M-1,O);return L>DlhSoft.buildReleaseDate?L:DlhSoft.buildReleaseDate}(2017,5,17);var _0x5c25="Licensing{undefined{string{DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase.{.{length{license{push{type{content{:{lastIndexOf{substr{buildReleaseDate{charCodeAt{pow{toUpperCase{DlhSoft Component Licensing Warning{http://DlhSoft.com/Purchase.aspx{?Assemblies={,{http://www.componentsource.com/features/dlhsoft{ (version {){This component is currently licensed to be used for testing purposes only{The component is part of this assembly{To purchase a standard license for a product that includes this assembly you can use the Purchase page{ownerDocument{div{createElement{style{position: absolute; left: 24px; top: 24px; width: 480px; display: block; z-index: 1; color: Black; background-color: #ffffc0; border: solid 1px Blue; overflow: auto{setAttribute{padding: 6px; padding-top: 8px; font-family: Arial; font-size: small{font-weight: bold; margin-bottom: 4px{appendChild{createTextNode{color: Red; margin-top: 2px; margin-bottom: 2px{margin-top: 4px{a{color: Blue; text-decoration: underline{href{target{_blank{Purchase license{margin-left: 4px; color: Blue; text-decoration: underline{javascript://{Continue trial{click{removeChild{addEventListener{\n\n{: {:\n".split("{");
void 0==DlhSoft[_0x5c25[0]]&&(DlhSoft[_0x5c25[0]]=function(){var L=_0x5c25[1],M=_0x5c25[2],O=[],T=[],U=_0x5c25[3],Z=function(I,D){if(typeof I!==M||typeof D!==M)return!1;if(D==U)return!0;var J=D[_0x5c25[11]](_0x5c25[10]);if(0<=J){var w=D[_0x5c25[12]](0,J),y,C=w[_0x5c25[11]](_0x5c25[10]);if(0<=C)try{y=new Date(parseInt(w[_0x5c25[12]](C+1)))}catch(x){}typeof y===L&&(y=new Date(2013,11,31));if(DlhSoft[_0x5c25[13]]>y)return!1;w=w+_0x5c25[10]+I;for(i=y=0;i<w[_0x5c25[5]];i++)C=w[_0x5c25[14]](i),y=(y<<5)-
y+C,y&=y;0>y&&(y=Math[_0x5c25[15]](2,32)-y);w=y.toString(16)[_0x5c25[16]]();J=D[_0x5c25[12]](J+1);if(w==J)return!0}return!1},P=function(I,D,J,w,y){var C=_0x5c25[17],x=_0x5c25[18],K=typeof ComponentSource===L||!ComponentSource?x+_0x5c25[19]+w+_0x5c25[20]+y:_0x5c25[21],E=w+_0x5c25[22]+y+_0x5c25[23],G=_0x5c25[24],F=_0x5c25[25],H=_0x5c25[26];setTimeout(function(){var A=I[_0x5c25[27]],y=A[_0x5c25[29]](_0x5c25[28]);y[_0x5c25[32]](_0x5c25[30],_0x5c25[31]);var w=A[_0x5c25[29]](_0x5c25[28]);w[_0x5c25[32]](_0x5c25[30],
_0x5c25[33]);var B=A[_0x5c25[29]](_0x5c25[28]);B[_0x5c25[32]](_0x5c25[30],_0x5c25[34]);w[_0x5c25[35]](B);B[_0x5c25[35]](A[_0x5c25[36]](C));w[_0x5c25[35]](A[_0x5c25[36]](G+_0x5c25[10]));B=A[_0x5c25[29]](_0x5c25[28]);B[_0x5c25[32]](_0x5c25[30],_0x5c25[37]);B[_0x5c25[35]](A[_0x5c25[36]](D));w[_0x5c25[35]](B);w[_0x5c25[35]](A[_0x5c25[36]](F+_0x5c25[10]));B=A[_0x5c25[29]](_0x5c25[28]);B[_0x5c25[32]](_0x5c25[30],_0x5c25[37]);B[_0x5c25[35]](A[_0x5c25[36]](E));w[_0x5c25[35]](B);w[_0x5c25[35]](A[_0x5c25[36]](H+
_0x5c25[10]));B=A[_0x5c25[29]](_0x5c25[28]);B[_0x5c25[32]](_0x5c25[30],_0x5c25[38]);var x=A[_0x5c25[29]](_0x5c25[39]);x[_0x5c25[32]](_0x5c25[30],_0x5c25[40]);x[_0x5c25[32]](_0x5c25[41],K);x[_0x5c25[32]](_0x5c25[42],_0x5c25[43]);x[_0x5c25[35]](A[_0x5c25[36]](_0x5c25[44]));B[_0x5c25[35]](x);x=A[_0x5c25[29]](_0x5c25[39]);x[_0x5c25[32]](_0x5c25[30],_0x5c25[45]);x[_0x5c25[32]](_0x5c25[41],_0x5c25[46]);x[_0x5c25[35]](A[_0x5c25[36]](_0x5c25[47]));x[_0x5c25[50]](_0x5c25[48],function(){I[_0x5c25[49]](y);T[_0x5c25[7]](J)},
!1);B[_0x5c25[35]](x);w[_0x5c25[35]](B);y[_0x5c25[35]](w);I[_0x5c25[35]](y)},0);setTimeout(function(){alert(C+_0x5c25[51]+G+_0x5c25[52]+D+_0x5c25[51]+F+_0x5c25[53]+E+_0x5c25[51]+H+_0x5c25[4])},6E5)};return{setLicense:function(I,D){O[_0x5c25[7]]({type:I,content:D})},validate:function(I,D,J,w,y,C,x){for(var D=D+_0x5c25[4]+J,K=0;K<T[_0x5c25[5]];K++)if(T[K]==D)return;a:if(typeof C!==M&&typeof x!==L&&(x[_0x5c25[6]]!==L&&(C=x[_0x5c25[6]]),typeof x===M&&(C=x)),typeof C!==M)for(x=0;x<O[_0x5c25[5]];x++)if(K=
O[x],K[_0x5c25[8]]==D&&typeof K[_0x5c25[9]]===M){C=K[_0x5c25[9]];break a}Z(D,C)?I[_0x5c25[6]]=C:P(I,J,D,w,y)}}}());void 0==DlhSoft.Controls&&(DlhSoft.Controls={});void 0==DlhSoft.Controls.Pert&&(DlhSoft.Controls.Pert={});
void 0==DlhSoft.Controls.Pert.PertChartView&&(DlhSoft.Controls.Pert.PertChartView=function(){var L=function(b,f,d,e){var a=["DlhSoft.Controls.Pert","PertChartView","DlhSoft.ProjectData.PertChart.HTML.Controls","5","validate","Licensing"];DlhSoft[a[5]][a[4]](b,a[0],a[1],a[2],a[3],e,d);b.isInitializing=true;if(typeof b.items!=="undefined")for(e=0;e<b.items.length;e++)delete b.items[e].successors;typeof d!=="object"&&(d={});U(f,d);T(d,f,b);ja(b,f,d);Z(f);var g=J(b,f,d),l=b.ownerDocument,e=l.createElement("div");
e.setAttribute("style","font-family: Arial; font-size: small; overflow: auto");a=l.createElement("div");typeof d.containerClass!=="undefined"&&a.setAttribute("class",d.containerClass);typeof d.containerStyle!=="undefined"&&a.setAttribute("style",d.containerStyle);e.appendChild(a);var c=l.createElement("div");c.setAttribute("style","border: solid 1px "+d.border+"; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; overflow: hidden");
a.appendChild(c);a=l.createElement("div");a.setAttribute("style","overflow: auto");c.appendChild(a);var h=l.createElement("div");h.setAttribute("style","overflow: "+(typeof d.isExport==="undefined"||!d.isExport?"auto":"hidden")+"; height: "+g);a.appendChild(h);var c=C(f,d),j=x(f,d),s=l.createElement("div");s.setAttribute("style","float: left; overflow: hidden; width: "+c+"px; height: "+j+"px");h.appendChild(s);g=l.createElementNS("http://www.w3.org/2000/svg","svg");g.setAttribute("style","width: "+
c+"px; height: "+j+"px");c=d.styleDefinitionTemplate();g.appendChild(c);g.chartAreaDefinitions=c;c=function(){setTimeout(function(){try{var a=s.chartArea,g=a.chartAreaDefinitions;a.removeChild(g);a.childNodes.length>0?a.insertBefore(g,a.childNodes[0]):a.appendChild(g)}catch(c){}},0)};g.addEventListener("mousedown",c,true);l.addEventListener("mouseup",c,true);s.appendChild(g);s.chartArea=g;var v;setTimeout(function(){v=b.clientHeight},0);typeof b.heightUpdateTimer!=="undefined"&&clearInterval(b.heightUpdateTimer);
b.heightUpdateTimer=setInterval(function(){try{if(!(b.clientHeight<=0)){var a=b.clientHeight;if(a!=v){var g=J(b,f,d);h.style.height=g;v=a}}}catch(c){try{clearInterval(b.heightUpdateTimer)}catch(l){}}},100);var k=function(a,g,c,h){var j;if(d.mouseHandler||d.mouseMoveHandler&&h=="mousemove"||d.mouseDownHandler&&h=="mousedown"||d.clickHandler&&h=="click"||d.doubleClickHandler&&h=="dblclick"){var b=a.which;!b&&a.button&&(a.button&1?b=1:a.button&4?b=2:a.button&2&&(b=3));j=c.getBoundingClientRect();var e=
l.body,s=l.documentElement,c=j.left+(window.pageXOffset||s.scrollLeft||e.scrollLeft)-(s.clientLeft||e.clientLeft||0);j=Math.round(j.top+(window.pageYOffset||s.scrollTop||e.scrollTop)-(s.clientTop||e.clientTop||0));c=Math.round(c);c=a.pageX-c;j=a.pageY-j;for(e=0;e<f.length;e++){var s=f[e],v=E(s,d),k=G(s,d);if(c>=v&&c<v+d.itemWidth&&j>=k&&j<k+d.itemHeight){d.mouseHandler&&d.mouseHandler(h,s,b,g,a);d.mouseMoveHandler&&h=="mousemove"&&d.mouseMoveHandler(s);d.mouseDownHandler&&h=="mousedown"&&d.mouseDownHandler(s,
b);d.itemClickHandler&&h=="click"&&d.itemClickHandler(s);d.itemDoubleClickHandler&&h=="dblclick"&&d.itemDoubleClickHandler(s)}}}};s.addEventListener("mousemove",function(a){k(a,0,s,"mousemove")});s.addEventListener("mousedown",function(a){k(a,1,s,"mousedown")});s.addEventListener("click",function(a){k(a,1,s,"click")});s.addEventListener("dblclick",function(a){k(a,2,s,"dblclick")});s.addEventListener("click",function(a){a.srcElement&&a.srcElement.nodeName!="rect"&&a.stopPropagation()},true);s.container=
h;b.chartContainer=a;b.chartContent=s;b.chartContentContainer=h;h.isInitializing=true;ka(b,e);K(s,g,f,d);h.isInitializing=false;b.isInitializing=false;b.isInitialized=true;return b},M=function(b){L(b,b.items,b.settings,b.license)},O=function(b){if(typeof b.timeSpanFormatter==="undefined")b.timeSpanFormatter=y;if(typeof b.itemPropertyChangeHandler==="undefined")b.itemPropertyChangeHandler=function(){};if(typeof b.target==="undefined")b.target="Standard";if(typeof b.theme==="undefined")b.theme="Modern"},
T=function(b,f,d){O(b);if(typeof b.border==="undefined")switch(b.theme){default:b.border="#e0e0e0";break;case "ModernBordered":case "Aero":b.border="#9a9a9a"}if(typeof b.canUserRearrangeItems==="undefined")b.canUserRearrangeItems=true;if(typeof b.snapRearrangedItemsToGuidelines==="undefined")b.snapRearrangedItemsToGuidelines=true;if(typeof b.itemWidth==="undefined")b.itemWidth=40;if(typeof b.itemHeight==="undefined")b.itemHeight=40;if(typeof b.aspectRatio==="undefined")b.aspectRatio=1;if(typeof b.shapeWidth===
"undefined")b.shapeWidth=32;if(typeof b.shapeHeight==="undefined")b.shapeHeight=32;if(typeof b.styleDefinitionTemplate==="undefined")b.styleDefinitionTemplate=W(d,b);if(typeof b.dependencyTextBlockWidth==="undefined")b.dependencyTextBlockWidth=120;if(typeof b.shapeStyle==="undefined"&&b.shapeClass==null)b.shapeStyle="fill: White; stroke: #606060; stroke-width: 0.75px";if(typeof b.temporaryThumbStyle==="undefined"&&b.temporaryThumbClass==null)b.temporaryThumbStyle="fill: none; stroke: #0000ff; stroke-width: 0.65px; stroke-dasharray: 2, 2; ";
if(typeof b.dependencyLineStyle==="undefined"&&b.dependencyLineClass==null)b.dependencyLineStyle="stroke: #8080FF; stroke-width: 0.65px; fill: none; marker-end: url(#ArrowMarker)";if(typeof b.virtualEffortDependencyLineStyle==="undefined"&&b.virtualEffortDependencyLineClass==null)b.virtualEffortDependencyLineStyle="stroke: #8080FF; stroke-width: 0.65px; stroke-dasharray: 2, 2; fill: none; marker-end: url(#ArrowMarker)";if(typeof b.dependencyLineZoneStyle==="undefined"&&b.dependencyLineZoneClass==
null)b.dependencyLineZoneStyle="stroke: White; stroke-opacity: 0; stroke-width: 4px; fill: none";if(typeof b.taskEventTemplate==="undefined")b.taskEventTemplate=aa();if(typeof b.dependencyTextStyle==="undefined")b.dependencyTextStyle="color: #606060; text-anchor: middle";if(typeof b.chartMargin==="undefined")b.chartMargin=16;if(typeof b.isTaskEventToolTipVisible==="undefined")switch(b.target){default:b.isTaskEventToolTipVisible=true;break;case "Phone":b.isTaskEventToolTipVisible=false}if(typeof b.itemTemplate===
"undefined")b.itemTemplate=X(b);if(typeof b.dependencyLineTemplate==="undefined")b.dependencyLineTemplate=ba();if(typeof b.isDependencyToolTipVisible==="undefined")b.isDependencyToolTipVisible=b.isTaskEventToolTipVisible;if(typeof b.predecessorItemTemplate==="undefined")b.predecessorItemTemplate=la(b)},U=function(b){for(var f=0;f<b.length;f++){var d=b[f];if(typeof d==="string"){d={content:d};b[f]=d}if(typeof d.predecessors!=="undefined"){if(typeof d.predecessors==="string")d.predecessors=d.predecessors.split(",");
for(var e=0;e<d.predecessors.length;e++){var a=d.predecessors[e];if(typeof a==="string"){a={item:a};d.predecessors[e]=a}if(typeof a.item==="string"){var g=parseInt(a.item)-1;a.item=g>=0&&g<b.length?b[g]:null}if(typeof a.effort==="string")a.effort=parseFloat(a.effort)}}if(typeof d.displayedRowIndex!=="undefined")d.actualRowIndex=d.displayedRowIndex;if(typeof d.displayedColumnIndex!=="undefined")d.actualColumnIndex=d.displayedColumnIndex;if(typeof d.actualRowIndex==="undefined")d.actualRowIndex=0;if(typeof d.actualColumnIndex===
"undefined")d.actualColumnIndex=0}},Z=function(b){b.positionedItems=[];b.maxRowIndex=null;for(var f=0;f<b.length;f++){var d=b[f],e=b;if(typeof d.displayedRowIndex==="undefined"){var a;if(typeof d.predecessors!=="undefined"){a=e.positionedItems;for(var g=[],l=d.predecessors,c=0;c<a.length;c++)for(var h=a[c],j=0;j<l.length;j++)if(l[j].item==h){g.push(h);break}a=g}else a=null;if(a!=null){g=a;l=[];for(c=0;c<g.length;c++){h=g[c].actualRowIndex;l.indexOf(h)<0&&l.push(h)}g=l}else g=null;g=g!=null&&g.length>
0?R(g):e.maxRowIndex!=null?e.maxRowIndex+1:0;l=l=void 0;if(typeof d.displayedColumnIndex==="undefined"){l=P(e.positionedItems,g);l=l.length>0?R(l)+1:0;c=a!=null?P(a,g):null;if(c!=null&&c.length>0){h=null;for(j=0;j<c.length;j++)if(h==null||c[j]<h)h=c[j];c=h+1}else c=null;if(c!=null&&c!=l){g++;a=a!=null?I(a):null;l=a!=null&&a.length>0?R(a)+1:0}for(d.actualColumnIndex=l;D(e.positionedItems,g,l);)g++}else for(;;g++){l=P(e.positionedItems,g);l=l.length>0?R(l)+1:0;if(l<=d.actualColumnIndex)break}d.actualRowIndex=
g}else if(typeof d.displayedColumnIndex==="undefined"){a=I(e.positionedItems);d.actualColumnIndex=a.length>0?R(a)+1:0}e.positionedItems.push(d);if(e.maxRowIndex==null||d.actualRowIndex>e.maxRowIndex)e.maxRowIndex=d.actualRowIndex}},P=function(b,f){for(var d=[],e=0;e<b.length;e++){var a=b[e];if(a.actualRowIndex==f){a=a.actualColumnIndex;d.indexOf(a)<0&&d.push(a)}}return d},I=function(b){for(var f=[],d=0;d<b.length;d++){var e=b[d].actualColumnIndex;f.indexOf(e)<0&&f.push(e)}return f},D=function(b,f,
d){for(var e=0;e<b.length;e++){var a=b[e];if(a.actualRowIndex==f&&a.actualColumnIndex==d)return true}return false},J=function(b,f,d){var e;if(b.isContentHeightInitialized&&b.isContentHeightAuto)e=f.length>0?"auto":d.itemHeight+"px";else{var a=b.clientHeight-2;a<0&&(a=0);e=a+"px";if(a<d.itemHeight){if(!b.isContentHeightInitialized)b.isContentHeightAuto=true;e=f.length>0?"auto":d.itemHeight+"px"}b.isContentHeightInitialized=true}return e},w=function(b,f){var d=b.createElement("span");d.innerHTML=f;
return d},y=function(b){return Math.ceil(b/36E5*1E4/100)/100+"h"},C=function(b,f){for(var d=0,e=0;e<b.length;e++)d=Math.max(d,b[e].actualColumnIndex);return f.itemWidth+d*(f.itemWidth+f.dependencyTextBlockWidth)+f.chartMargin*2},x=function(b,f){for(var d=0,e=0;e<b.length;e++)d=Math.max(d,b[e].actualRowIndex);return f.itemHeight+d*(f.itemHeight+f.dependencyTextBlockWidth/f.aspectRatio)+f.chartMargin*2},K=function(b,f,d,e){for(b=0;b<d.length;b++){var a=d[b],g=E(a,e),l=G(a,e);f.appendChild(H(a,g,l,e))}},
E=function(b,f){if(typeof b.displayedColumnIndex!=="undefined")b.actualColumnIndex=b.displayedColumnIndex;return Math.max(0,f.chartMargin+b.actualColumnIndex*(f.itemWidth+f.dependencyTextBlockWidth))},G=function(b,f){if(typeof b.displayedRowIndex!=="undefined")b.actualRowIndex=b.displayedRowIndex;return Math.max(0,f.chartMargin+b.actualRowIndex*(f.itemHeight+f.dependencyTextBlockWidth/f.aspectRatio))},F=function(b){for(var f=[],d,e,a=0;a<b.length;a++){var g=b[a];if(typeof g.predecessors!=="undefined"&&
g.predecessors.length>0)for(var l=0;l<g.predecessors.length;l++){var c=g.predecessors[l].item;if(typeof c!=="undefined"){d=true;for(e=0;e<f;e++)if(c==f[e]){d=false;break}if(d){A(c.chartItem,c,c.pertChartView.settings);d=E(c,c.pertChartView.settings);e=G(c,c.pertChartView.settings);c.chartItem.setAttribute("transform","translate("+d+", "+e+")");f.push(c)}}}if(typeof g.predecessors!=="undefined"&&g.predecessors.length>0){d=true;for(e=0;e<f;e++)if(typeof g!=="undefined"&&g==f[e]){d=false;break}if(d){A(g.chartItem,
g,g.pertChartView.settings);d=E(g,g.pertChartView.settings);e=G(g,g.pertChartView.settings);g.chartItem.setAttribute("transform","translate("+d+", "+e+")");f.push(g)}}}},H=function(b,f,d,e){var a=b.pertChartView.ownerDocument.createElementNS("http://www.w3.org/2000/svg","g");b.chartItem=a;a.setAttribute("style","-ms-touch-action: pinch-zoom; touch-action: pinch-zoom");a.setAttribute("transform","translate("+f+", "+d+")");A(a,b,e);return a},A=function(b,f,d){for(var e=b.childNodes.length;e-- >0;)b.removeChild(b.childNodes[e]);
if(typeof f.isShapeVisible==="undefined"||f.isShapeVisible){e=d.taskEventTemplate;if(typeof f.taskEventTemplate!=="undefined")e=f.taskEventTemplate;e=e(f);b.appendChild(e);if(typeof d.internalExtraTaskTemplate!=="undefined"){var a=d.internalExtraTaskTemplate(f);a!=null&&b.appendChild(a)}if(typeof d.extraTaskEventTemplate!=="undefined"){a=d.extraTaskEventTemplate(f);a!=null&&b.appendChild(a)}if(d.isTaskEventToolTipVisible){a=d.itemTemplate;if(typeof f.template!=="undefined")a=f.template;e.appendChild(a(f))}if(typeof f.predecessors!==
"undefined")for(e=0;e<f.predecessors.length;e++){a=f.predecessors[e];if(!((typeof f.pertChartView==="undefined"||f.pertChartView.items.indexOf(a.item))<0)){var g=d.dependencyLineTemplate(f,a);g.predecessorIndex=e;(function(a){g.addEventListener("click",function(g){d.dependencyLineClickHandler&&d.dependencyLineClickHandler(a,f,g)});g.addEventListener("dblclick",function(g){d.dependencyLineDoubleClickHandler&&d.dependencyLineDoubleClickHandler(a,f,g)})})(a);b.appendChild(g);if(d.isDependencyToolTipVisible){var l=
d.predecessorItemTemplate;if(typeof a.template!=="undefined")l=a.template;g.appendChild(l(f,a))}}}}},V=function(b){if(typeof b.isWaitingToRefreshChartItem==="undefined"){b.isWaitingToRefreshChartItem=true;setTimeout(function(){A(b.chartItem,b,b.pertChartView.settings);var f=E(b,b.pertChartView.settings),d=G(b,b.pertChartView.settings);b.chartItem.setAttribute("transform","translate("+f+", "+d+")");delete b.isWaitingToRefreshChartItem},0)}},Q=function(b){V(b)},B=function(b){if(typeof b.isWaitingToRefreshPredecessorItems===
"undefined"){b.isWaitingToRefreshPredecessorItems=true;setTimeout(function(){F(b.pertChartView.items,b);delete b.isWaitingToRefreshPredecessorItems},0)}},$=function(b){if(typeof b.isWaitingToRefreshChartItem!=="undefined"||typeof b.isWaitingToRefreshPredecessorItems!=="undefined"){typeof b.isWaitingToRefreshChartItem==="undefined"&&V(b);typeof b.isWaitingToRefreshPredecessorItems==="undefined"&&B(b)}else{b.isWaitingToRefreshChartItem=true;b.isWaitingToRefreshPredecessorItems=true;setTimeout(function(){A(b.chartItem,
b,b.pertChartView.settings);var f=E(b,b.pertChartView.settings),d=G(b,b.pertChartView.settings);b.chartItem.setAttribute("transform","translate("+f+", "+d+")");F(b.pertChartView.items,b);delete b.isWaitingToRefreshChartItem;delete b.isWaitingToRefreshPredecessorItems},0)}},W=function(b){return function(){var f=b.ownerDocument,d=f.createElementNS("http://www.w3.org/2000/svg","defs"),e=f.createElementNS("http://www.w3.org/2000/svg","marker");e.setAttribute("id","ArrowMarker");e.setAttribute("viewBox",
"0 0 10 10");e.setAttribute("refX","0");e.setAttribute("refY","5");e.setAttribute("markerUnits","strokeWidth");e.setAttribute("markerWidth","5");e.setAttribute("markerHeight","4");e.setAttribute("orient","auto");f=f.createElementNS("http://www.w3.org/2000/svg","path");f.setAttribute("fill","#8080ff");f.setAttribute("d","M 0 0 L 10 5 L 0 10 z");e.appendChild(f);d.appendChild(e);return d}},X=function(){return function(b){var f=b.pertChartView.ownerDocument,d=f.createElementNS("http://www.w3.org/2000/svg",
"title");d.appendChild(w(f,typeof b.content!=="undefined"?b.content:""));return d}},aa=function(b,f,d){return function(e){var a=typeof f!=="undefined"?f:e.pertChartView,g=typeof d!=="undefined"?d:a.settings,l=typeof b!=="undefined"?b:a.items,c=a.ownerDocument,h;h=e.pertChartView.ownerDocument;if(typeof e.chartItemArea==="undefined")e.chartItemArea=h.createElementNS("http://www.w3.org/2000/svg","g");for(h=e.chartItemArea.childNodes.length;h-- >0;)e.chartItemArea.removeChild(e.chartItemArea.childNodes[h]);
h=e.chartItemArea;var j=(g.itemWidth-g.shapeWidth)/2,s=j+g.shapeWidth,v=(g.itemHeight-g.shapeHeight)/2,k=v+g.shapeHeight,q=g.shapeHeight,o,r=c.createElementNS("http://www.w3.org/2000/svg","rect");r.setAttribute("x",j);r.setAttribute("y",v);r.setAttribute("width",Math.max(0,s-j-1));r.setAttribute("height",Math.max(0,k-v-1));r.setAttribute("rx",g.shapeWidth/10);r.setAttribute("ry",g.shapeHeight/10);o=g.shapeClass;if(typeof e.shapeClass!=="undefined")o=e.shapeClass;if(typeof o!=="undefined")r.setAttribute("class",
o);else{o=g.shapeStyle;if(typeof e.shapeStyle!=="undefined")o=e.shapeStyle;typeof o!=="undefined"&&r.setAttribute("style",o)}h.appendChild(r);r=c.createElementNS("http://www.w3.org/2000/svg","text");r.setAttribute("x",(j+s)/2);r.setAttribute("y",k-q*1.5/8-6);r.setAttribute("style","font-weight: bold; text-anchor: middle");q=e.displayedText;typeof q==="undefined"&&(q="");r.appendChild(c.createTextNode(q));h.appendChild(r);if(g.canUserRearrangeItems){c=c.createElementNS("http://www.w3.org/2000/svg",
"rect");c.setAttribute("x",j);c.setAttribute("y",v);c.setAttribute("width",Math.max(0,s-j-1));c.setAttribute("height",Math.max(0,k-v-1));c.setAttribute("style","fill: White; fill-opacity: 0; cursor: move");h.appendChild(c);ca(c,e,l,E(e,g),G(e,g),a,g)}return h}},ba=function(b,f){return function(b,e){var a=b.pertChartView,g=typeof f!=="undefined"?f:a.settings,a=a.ownerDocument,l=a.createElementNS("http://www.w3.org/2000/svg","g"),c=void 0,h=void 0,j,s="M ",c=E(b,g)-2,h=G(b,g)-2,v=E(e.item,g);j=G(e.item,
g);var k=E(b,g),q=G(b,g),o=Math.abs(k-v),r=Math.abs(q-j),t=g.shapeWidth+2,m=g.shapeHeight+2,p=t/2,u=m/2,n=Math.max(t,m),r=r<n*4;if(o<n)s=j<=q?s+(v+p-c+","+(j+m-h))+(" L "+(k+p-c)+","+(q-h)):s+(v+p-c+","+(j-h))+(" L "+(k+p-c)+","+(q+m-h));else{s=v<=k?s+(v+t-c+","+(j+u-h)):s+(v-c+","+(j+u-h));s=r?v<=k?s+(" L "+(k-c)+","+(q+u-h)):s+(" L "+(k+t-c)+","+(q+u-h)):j<=q?s+(" L "+(k+p-c)+","+(q-h)):s+(" L "+(k+p-c)+","+(q+m-h))}c=((v<=k?v:k)+(v>=k?v:k))/2+p-c;h=((j<=q?j:q)+(j>=q?j:q))/2+u-h;j=s;s=a.createElementNS("http://www.w3.org/2000/svg",
"path");s.setAttribute("d",j);typeof g.dependencyLineZoneClass!=="undefined"&&s.setAttribute("class",g.dependencyLineZoneClass);typeof g.dependencyLineZoneStyle!=="undefined"&&s.setAttribute("style",g.dependencyLineZoneStyle);l.appendChild(s);s=a.createElementNS("http://www.w3.org/2000/svg","path");s.setAttribute("d",j);if(typeof e.isEffortVirtual!=="undefined"?!e.isEffortVirtual:typeof e.effort!=="undefined"&&e.effort>0){j=g.dependencyLineClass;if(typeof e.dependencyLineClass!=="undefined")j=e.dependencyLineClass;
typeof j!=="undefined"&&s.setAttribute("class",j);j=g.dependencyLineStyle;if(typeof e.dependencyLineStyle!=="undefined")j=e.dependencyLineStyle}else{j=g.virtualEffortDependencyLineClass;if(typeof e.virtualEffortDependencyLineClass!=="undefined")j=e.virtualEffortDependencyLineClass;typeof j!=="undefined"&&s.setAttribute("class",j);j=g.virtualEffortDependencyLineStyle;if(typeof e.virtualEffortDependencyLineStyle!=="undefined")j=e.virtualEffortDependencyLineStyle}typeof j!=="undefined"&&s.setAttribute("style",
j);l.appendChild(s);s=a.createElementNS("http://www.w3.org/2000/svg","text");s.setAttribute("x",c);s.setAttribute("y",h-6);h=g.dependencyTextClass;if(typeof e.dependencyTextClass!=="undefined")h=e.dependencyTextClass;typeof h!=="undefined"&&s.setAttribute("class",h);g=g.dependencyTextStyle;if(typeof e.dependencyTextStyle!=="undefined")g=e.dependencyTextStyle;s.setAttribute("style",g);g=e.displayedText;typeof g==="undefined"&&(g="");s.appendChild(a.createTextNode(g));l.appendChild(s);return l}},la=
function(){return function(b,f){var d=b.pertChartView.ownerDocument,e=d.createElementNS("http://www.w3.org/2000/svg","title");e.appendChild(w(d,typeof f.content!=="undefined"?f.content:""));return e}},S=function(b,f,d,e){typeof b.pertChartView!=="undefined"&&b.pertChartView.settings.itemPropertyChangeHandler(b,f,d,e)},ca=function(b,f,d,e,a,g,l){b.addEventListener("mousedown",function(c){if(c.button==0){g.draggingItem=f;g.dragType="Position";g.style.cursor=b.style.cursor;g.draggingInitialX=c.clientX;
g.draggingInitialY=c.clientY;g.draggingInitialThumbXPosition=e;g.draggingInitialThumbYPosition=a;c.preventDefault()}},true);if(typeof g.draggableItems==="undefined")g.draggableItems=[];for(var c=false,h=0;h<g.draggableItems.length;h++)if(g.draggableItems[h]==f){c=true;break}if(!c){g.addEventListener("mousemove",function(a){if(!(typeof g.draggingItem==="undefined"||g.draggingItem!=f||g.dragType!="Position")){var c=a.clientX-g.draggingInitialX,h=a.clientY-g.draggingInitialY;var b=a.clientX;if(typeof g.draggingItem!==
"undefined"){var e=g,o=0;if(e.offsetParent){do{o=o+e.offsetLeft;e=e.offsetParent}while(e)}b=b-o;if(b<24){b=g.chartContentContainer.scrollLeft;g.chartContentContainer.scrollLeft=g.chartContentContainer.scrollLeft-48;b=b-g.chartContentContainer.scrollLeft;if(typeof g.draggingInitialThumbXPosition!=="undefined")g.draggingInitialThumbXPosition=g.draggingInitialThumbXPosition-b}else if(b>=g.chartContentContainer.clientWidth-24){b=g.chartContentContainer.scrollLeft;g.chartContentContainer.scrollLeft=g.chartContentContainer.scrollLeft+
48;b=g.chartContentContainer.scrollLeft-b;if(typeof g.draggingInitialThumbXPosition!=="undefined")g.draggingInitialThumbXPosition=g.draggingInitialThumbXPosition+b}}a=a.clientY;if(typeof g.draggingItem!=="undefined"){b=g;e=0;if(b.offsetParent){do{e=e+b.offsetTop;b=b.offsetParent}while(b)}a=a-e;if(a<24){a=g.chartContentContainer.scrollTop;g.chartContentContainer.scrollTop=g.chartContentContainer.scrollTop-48;a=a-g.chartContentContainer.scrollTop;if(typeof g.draggingInitialThumbYPosition!=="undefined")g.draggingInitialThumbYPosition=
g.draggingInitialThumbYPosition-a}else if(a>=g.chartContentContainer.clientHeight-24){a=g.chartContentContainer.scrollTop;g.chartContentContainer.scrollTop=g.chartContentContainer.scrollTop+48;a=g.chartContentContainer.scrollTop-a;if(typeof g.draggingInitialThumbYPosition!=="undefined")g.draggingInitialThumbYPosition=g.draggingInitialThumbYPosition+a}}delete g.draggingItem;g.draggingInitialThumbXPosition+c<0&&(c=-g.draggingInitialThumbXPosition);g.draggingInitialThumbYPosition+h<0&&(h=-g.draggingInitialThumbYPosition);
h=(g.draggingInitialThumbYPosition+h-l.chartMargin)/(l.itemHeight+l.dependencyTextBlockWidth/l.aspectRatio);l.snapRearrangedItemsToGuidelines&&(h=Math.round(h));f.actualRowIndex=h;c=(g.draggingInitialThumbXPosition+c-l.chartMargin)/(l.itemWidth+l.dependencyTextBlockWidth);l.snapRearrangedItemsToGuidelines&&(c=Math.round(c));f.actualColumnIndex=c;S(f,"actualRowIndex",true,false);S(f,"actualColumnIndex",true,false);typeof f.displayedColumnIndex!=="undefined"&&delete f.displayedColumnIndex;typeof f.displayedRowIndex!==
"undefined"&&delete f.displayedRowIndex;da(f,d,g.chartContent,l,false);g.draggingItem=f;g.draggingPerformed=true}},true);document.addEventListener("mouseup",function(a){if(!(a.button!=0||typeof g.draggingItem==="undefined"||g.draggingItem!=f||g.dragType!="Position")){da(f,d,g.chartContent,l,true);a=g.draggingItem;delete g.draggingItem;g.style.cursor="default";if(g.draggingPerformed){S(a,"actualColumnIndex",true,true);S(a,"actualRowIndex",true,true);delete g.draggingPerformed}}},true);g.draggableItems.push(f)}},
da=function(b,f,d,e,a){var g=b.pertChartView.ownerDocument;if(a){if(typeof d.temporaryRectangle!=="undefined"){g=d.chartArea;g.removeChild(d.temporaryRectangle);delete d.temporaryRectangle}setTimeout(function(){A(b.chartItem,b,e);F(f,b);setTimeout(function(){N(d,f,e,true)},0)})}else{if(typeof d.temporaryRectangle!=="undefined")a=d.temporaryRectangle;else{a=g.createElementNS("http://www.w3.org/2000/svg","rect");a.setAttribute("x",0);a.setAttribute("y",0);a.setAttribute("width",e.shapeWidth);a.setAttribute("height",
e.shapeHeight);a.setAttribute("rx",e.shapeWidth/10);a.setAttribute("ry",e.shapeHeight/10);typeof e.temporaryThumbClass!=="undefined"&&a.setAttribute("class",e.temporaryThumbClass);a.setAttribute("style",e.temporaryThumbStyle);d.temporaryRectangle=a;g=d.chartArea;g.appendChild(a)}var g=E(b,e)+(e.itemWidth-e.shapeWidth)/2,l=G(b,e)+(e.itemHeight-e.shapeHeight)/2;a.setAttribute("transform","translate("+g+", "+l+")");setTimeout(function(){N(d,f,e,false)},0)}},N=function(b,f,d,e){var a=C(f,d),f=x(f,d);
if(e||a>b.clientWidth)b.style.width=a+"px";if(e||f>b.clientHeight)b.style.height=f+"px";e&&b.chartArea.setAttribute("style","width: "+a+"px; height: "+f+"px")},ka=function(b,f){for(var d=b.childNodes.length;d-- >0;)b.removeChild(b.childNodes[d]);b.appendChild(f)},ma=function(b,f){for(var d in f)d.indexOf("custom")!=0&&d.indexOf("description")!=0||typeof b[d]==="undefined"&&(b[d]=f[d])},ea=function(b,f,d,e,a,g,l,c){var c={isExport:true,canUserRearrangeItems:false,isTaskEventToolTipVisible:false,isDependencyToolTipVisible:false,
containerClass:c.containerClass,containerStyle:c.containerStyle,border:c.border,theme:c.theme,itemWidth:c.itemWidth,itemHeight:c.itemHeight,aspectRatio:c.aspectRatio,shapeWidth:c.shapeWidth,shapeHeight:c.shapeHeight,shapeClass:c.shapeClass,shapeStyle:c.shapeStyle,shapeCornerRadius:c.shapeCornerRadius,dependencyTextStyle:c.dependencyTextStyle,dependencyLineClass:c.dependencyLineClass,dependencyLineStyle:c.dependencyLineStyle,virtualEffortDependencyLineClass:c.virtualEffortDependencyLineClass,virtualEffortDependencyLineStyle:c.virtualEffortDependencyLineStyle,
dependencyTextBlockWidth:c.dependencyTextBlockWidth,chartMargin:0,target:c.target,timeSpanFormatter:c.timeSpanFormatter,taskEventTemplate:c.taskEventTemplate,dependencyLineTemplate:c.dependencyLineTemplate},h=C(l,c),j=x(l,c);c.chartWidth=h+"px";c.chartHeight=j+"px";var s=h+2,h=j+2,v,k,q=false;if(d!=null&&typeof d.createElement!=="undefined")v=d;else{if(d!=null&&typeof d.focus!=="undefined")k=d;else{k=window.open("",d!=null?d:"_blank",typeof e!=="undefined"&&e&&(typeof g==="undefined"||g)?"width=320,height=100,location=no,menubar=no,toolbar=no,status=no,scrollbars=yes":
"");q=true}v=k.document;try{for(var o=document.head.getElementsByTagName("link"),d=0;d<o.length;d++){var r=o[d],t=v.adoptNode(r.cloneNode(true));t.href=r.href;v.head.appendChild(t)}}catch(m){}}v.title=typeof b!=="undefined"?b:"Exported chart"+(typeof e!=="undefined"&&e?" (printable)":"");b=[];for(d=0;d<l.length;d++){o=l[d];r={content:o.content,displayedText:o.displayedText,isShapeVisible:o.isShapeVisible,shapeClass:o.shapeClass,shapeStyle:o.shapeStyle,dependencyTextStyle:o.dependencyTextStyle,displayedRowIndex:o.actualRowIndex,
displayedColumnIndex:o.actualColumnIndex,isExported:true};ma(r,o);b.push(r);o.exportItem=r}for(d=0;d<l.length;d++){o=l[d];r=o.exportItem;if(typeof o.predecessors!=="undefined"){r.predecessors=[];for(t=0;t<o.predecessors.length;t++){j=o.predecessors[t];r.predecessors.push({item:j.item.exportItem,content:j.content,displayedText:j.displayedText,effort:j.effort,isEffortVirtual:j.isEffortVirtual,dependencyLineClass:j.dependencyLineClass,dependencyLineStyle:j.dependencyLineStyle,virtualEffortDependencyLineClass:j.virtualEffortDependencyLineClass,
virtualEffortDependencyLineStyle:j.virtualEffortDependencyLineStyle,dependencyTextStyle:j.dependencyTextStyle})}}}var p=v.createElement("p");p.innerHTML=typeof f!=="undefined"?f:"";v.body.appendChild(p);var u=v.createElement("div");u.setAttribute("style","width: "+s+"px; height: "+h+"px");try{DlhSoft.Controls.Pert.PertChartView.initialize(u,b,c,"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase.")}catch(n){}setTimeout(function(){q&&
v.body.setAttribute("style","margin: 0px");var c=v.createElement("div");c.appendChild(u);v.body.replaceChild(c,p);if(a){c.setAttribute("style","width: "+u.offsetHeight+"px; height: "+s+"px; overflow: hidden");c=Math.round((u.offsetWidth-u.offsetHeight)/2);u.setAttribute("style","width: "+s+"px; transform: rotate(90deg) translateX("+c+"px) translateY("+c+"px); -webkit-transform: rotate(90deg) translateX("+c+"px) translateY("+c+"px)")}v.close();if(typeof k!==void 0){k.focus();if(typeof e!=="undefined"&&
e){k.print();(typeof g==="undefined"||g)&&k.close()}}},0)},na=function(b,f){typeof b==="undefined"&&(b=0);var d=Y(f);if(d==null)return[];for(var d=[d],e=fa(b,f),a=0;a<e.length;a++)d.push(e[a].dependentItem);return d},fa=function(b,f){var d=Y(f);if(d==null)return[];var e;a:{for(e=f.length;e-- >0;){var a=f[e];if(ga(a).length==0){e=a;break a}}e=null}if(e==null)return[];d=ha(d,e);e=[];for(a=0;a<d.length;a++)e.push(d[a]);return e},ha=function(b,f){if(b==null||f==null||b==f||typeof f.predecessors==="undefined")return[];
var d=[],e=[],a,g=null;for(a=0;a<f.predecessors.length;a++){predecessorItem=f.predecessors[a];predecessorItem.dependentItem=f;if(typeof predecessorItem.item!=="undefined"){var l=ia(b,predecessorItem.item);if(l!=null){if((typeof predecessorItem.isEffortVirtual==="undefined"||!predecessorItem.isEffortVirtual)&&predecessorItem.effort>0)l=l+predecessorItem.effort;if(g==null||l>=g){if(g==null||l>g){g=l;e=[]}e.push(predecessorItem)}}}}for(a=0;a<e.length;a++){for(var g=e[a],l=ha(b,g.item),c=0;c<l.length;c++)d.push(l[c]);
d.push(g)}return d},Y=function(b){for(var f=0;f<b.length;f++){var d=b[f];if(typeof d.predecessors==="undefined"||d.predecessors.length==0)return d}return null},ia=function(b,f){if(b==null||f==null)return null;if(b==f)return 0;for(var d=null,e=ga(b),a=0;a<e.length;a++){var g=e[a],l=ia(g.dependentItem,f);if(l!=null){l=l+((typeof predecessorItem.isEffortVirtual==="undefined"||!predecessorItem.isEffortVirtual)&&g.predecessorItem.effort>0?g.predecessorItem.effort:0);l<0&&(l=0);if(d==null||l>d)d=l}}return d},
ga=function(b){for(var f=[],d=b.pertChartView.items,e=0;e<d.length;e++){var a=d[e];if(typeof a.predecessors!=="undefined")for(var g=0;g<a.predecessors.length;g++){var l=a.predecessors[g];typeof l.item!=="undefined"&&l.item==b&&f.push({dependentItem:a,predecessorItem:l})}}return f},R=function(b){for(var f=null,d=0;d<b.length;d++)if(f==null||b[d]>f)f=b[d];return f},ja=function(b,f,d){for(var e=0;e<f.length;e++)f[e].pertChartView=b;b.items=f;b.settings=d;b.refresh=function(){M(b)};b.refreshItems=function(){for(var a=
0;a<f.length;a++){var g=f[a];V(g);B(g)}};b.refreshChartItems=function(){for(var a=0;a<f.length;a++)V(f[a])};b.refreshItem=Q;b.refreshChartItem=V;b.refreshPredecessorItems=B;b.refreshItemGraph=$;b.scrollToItem=function(a){var g=E(a,d),b=g-a.pertChartView.chartContentContainer.scrollLeft;if(b<0)a.pertChartView.chartContentContainer.scrollLeft=g;else if(b>a.pertChartView.chartContentContainer.clientWidth-a.pertChartView.settings.itemWidth)a.pertChartView.chartContentContainer.scrollLeft=g-(a.pertChartView.chartContentContainer.clientWidth-
a.pertChartView.settings.itemWidth);g=G(a,d);b=g-a.pertChartView.chartContentContainer.scrollTop;if(b<0)a.pertChartView.chartContentContainer.scrollTop=g;else if(b>a.pertChartView.chartContentContainer.clientHeight-a.pertChartView.settings.itemHeight)a.pertChartView.chartContentContainer.scrollTop=g-(a.pertChartView.chartContentContainer.clientHeight-a.pertChartView.settings.itemHeight)};b.scrollToLeft=function(){b.chartContentContainer.scrollLeft=0};b.scrollToRight=function(){b.chartContentContainer.scrollLeft=
b.chartContent.clientWidth};b.scrollToTop=function(){b.chartContentContainer.scrollTop=0};b.scrollToBottom=function(){b.chartContentContainer.scrollTop=b.chartContent.clientHeight};b.getChartWidth=function(){return C(f,d)};b.getChartHeight=function(){return x(f,d)};b.getItemTop=function(a){return G(a,d)};b.getItemLeft=function(a){return E(a,d)};b.onItemPropertyChanged=S;b.initializeTasEventkDraggingThumbs=function(a,g,l,c){ca(a,g,b.items,l,c,b,b.settings)};b.exportContent=function(a,g){typeof a===
"undefined"&&(a={});ea(a.title,a.preparingMessage,g,false,a.rotate,false,f,d)};b.print=function(a){typeof a==="undefined"&&(a={});ea(a.title,a.preparingMessage,null,true,a.rotate,a.autoClose,f,d)};b.isItemCritical=function(a,g){return na(g,f).indexOf(a)>=0};b.isDependencyCritical=function(a,g){return fa(g,f).indexOf(a)>=0};b.getCriticalItems=function(a){return na(a,f)};b.getCriticalDependencies=function(a){return fa(a,f)};b.repositionEnds=function(){if(f.length!=0){for(var a=false,g=0;g<f.length;g++){for(var b=
f[g],c=0,h=0;h<f.length;h++){var j=f[h];if(typeof j.predecessors!=="undefined"){for(var d=0;d<j.predecessors.length;d++)if(typeof j.predecessors[d].item!=="undefined"&&j.predecessors[d].item==b){c++;if(c>1)break}if(c>1)break}}c>1&&(a=true)}g=f[0];g.displayedRowIndex=a?0.5:0;b=f[f.length-1];b.displayedRowIndex=a?0.5:0;$(g);$(b)}}};return{initialize:L,initializeItems:U,refresh:M,getDefaultStyleDefinitionTemplate:W,getDefaultTaskEventTemplate:aa,getDefaultItemTemplate:X,getDefaultDependencyLineTemplate:ba,
getDefaultPredecessorItemTemplate:la,initializeTaskEventDraggingThumbs:function(b,f,d,e){f.pertChartView.initializeTaskEventDraggingThumbs(b,f,d,e)},defaultTimeSpanFormatter:y}}());
void 0==DlhSoft.Controls.Pert.NetworkDiagramView&&(DlhSoft.Controls.Pert.NetworkDiagramView=function(){var L=function(a,g,b,c){var h=["DlhSoft.Controls.Pert","NetworkDiagramView","DlhSoft.ProjectData.PertChart.HTML.Controls","5","validate","Licensing"];DlhSoft[h[5]][h[4]](a,h[0],h[1],h[2],h[3],c,b);a.isInitializing=true;if(typeof a.items!=="undefined")for(c=0;c<a.items.length;c++)delete a.items[c].successors;typeof b!=="object"&&(b={});U(g,b);T(b,g,a);e(a,g,b);x(g,b);Z(g);var j=J(a,g,b),d=a.ownerDocument,
c=d.createElement("div");c.setAttribute("style","font-family: Arial; font-size: small; overflow: auto");h=d.createElement("div");typeof b.containerClass!=="undefined"&&h.setAttribute("class",b.containerClass);typeof b.containerStyle!=="undefined"&&h.setAttribute("style",b.containerStyle);c.appendChild(h);var f=d.createElement("div");f.setAttribute("style","border: solid 1px "+b.border+"; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; overflow: hidden");
h.appendChild(f);h=d.createElement("div");h.setAttribute("style","overflow: auto");f.appendChild(h);var k=d.createElement("div");k.setAttribute("style","overflow: "+(typeof b.isExport==="undefined"||!b.isExport?"auto":"hidden")+"; height: "+j);h.appendChild(k);var f=K(g,b),q=E(g,b),o=d.createElement("div");o.setAttribute("style","float: left; overflow: hidden; width: "+f+"px; height: "+q+"px");k.appendChild(o);j=d.createElementNS("http://www.w3.org/2000/svg","svg");j.setAttribute("style","width: "+
f+"px; height: "+q+"px");f=b.styleDefinitionTemplate();j.appendChild(f);j.chartAreaDefinitions=f;f=function(){setTimeout(function(){try{var a=o.chartArea,g=a.chartAreaDefinitions;a.removeChild(g);a.childNodes.length>0?a.insertBefore(g,a.childNodes[0]):a.appendChild(g)}catch(c){}},0)};j.addEventListener("mousedown",f,true);d.addEventListener("mouseup",f,true);o.appendChild(j);o.chartArea=j;var r;setTimeout(function(){r=a.clientHeight},0);typeof a.heightUpdateTimer!=="undefined"&&clearInterval(a.heightUpdateTimer);
a.heightUpdateTimer=setInterval(function(){try{if(!(a.clientHeight<=0)){var c=a.clientHeight;if(c!=r){var h=J(a,g,b);k.style.height=h;r=c}}}catch(j){try{clearInterval(a.heightUpdateTimer)}catch(d){}}},100);var t=function(a,c,h,j){var f;if(b.mouseHandler||b.mouseMoveHandler&&j=="mousemove"||b.mouseDownHandler&&j=="mousedown"||b.clickHandler&&j=="click"||b.doubleClickHandler&&j=="dblclick"){var e=a.which;!e&&a.button&&(a.button&1?e=1:a.button&4?e=2:a.button&2&&(e=3));f=h.getBoundingClientRect();var v=
d.body,k=d.documentElement,h=f.left+(window.pageXOffset||k.scrollLeft||v.scrollLeft)-(k.clientLeft||v.clientLeft||0);f=Math.round(f.top+(window.pageYOffset||k.scrollTop||v.scrollTop)-(k.clientTop||v.clientTop||0));h=Math.round(h);h=a.pageX-h;f=a.pageY-f;for(v=0;v<g.length;v++){var k=g[v],q=F(k,b),o=H(k,b);if(h>=q&&h<q+b.itemWidth&&f>=o&&f<o+b.itemHeight){b.mouseHandler&&b.mouseHandler(j,k,e,c,a);b.mouseMoveHandler&&j=="mousemove"&&b.mouseMoveHandler(k);b.mouseDownHandler&&j=="mousedown"&&b.mouseDownHandler(k,
e);b.itemClickHandler&&j=="click"&&b.itemClickHandler(k);b.itemDoubleClickHandler&&j=="dblclick"&&b.itemDoubleClickHandler(k)}}}};o.addEventListener("mousemove",function(a){t(a,0,o,"mousemove")});o.addEventListener("mousedown",function(a){t(a,1,o,"mousedown")});o.addEventListener("click",function(a){t(a,1,o,"click")});o.addEventListener("dblclick",function(a){t(a,2,o,"dblclick")});o.addEventListener("click",function(a){a.srcElement&&a.srcElement.nodeName!="rect"&&a.stopPropagation()},true);o.container=
k;a.chartContainer=h;a.chartContent=o;a.chartContentContainer=k;k.isInitializing=true;na(a,c);G(o,j,g,b);k.isInitializing=false;a.isInitializing=false;a.isInitialized=true;return a},M=function(a){L(a,a.items,a.settings,a.license)},O=function(a){if(typeof a.dateTimeFormatter==="undefined")a.dateTimeFormatter=y;if(typeof a.timeSpanFormatter==="undefined")a.timeSpanFormatter=C;if(typeof a.itemPropertyChangeHandler==="undefined")a.itemPropertyChangeHandler=function(){};if(typeof a.target==="undefined")a.target=
"Standard";if(typeof a.theme==="undefined")a.theme="Modern"},T=function(a,g,b){O(a);if(typeof a.border==="undefined")switch(a.theme){default:a.border="#e0e0e0";break;case "ModernBordered":case "Aero":a.border="#9a9a9a"}if(typeof a.canUserRearrangeItems==="undefined")a.canUserRearrangeItems=true;if(typeof a.snapRearrangedItemsToGuidelines==="undefined")a.snapRearrangedItemsToGuidelines=true;if(typeof a.itemWidth==="undefined")a.itemWidth=220;if(typeof a.itemHeight==="undefined")a.itemHeight=100;if(typeof a.aspectRatio===
"undefined")a.aspectRatio=1;if(typeof a.shapeWidth==="undefined")a.shapeWidth=212;if(typeof a.shapeHeight==="undefined")a.shapeHeight=92;if(typeof a.styleDefinitionTemplate==="undefined")a.styleDefinitionTemplate=aa(b,a);if(typeof a.shapeStyle==="undefined"&&a.shapeClass==null)a.shapeStyle="fill: White; stroke: #0000ff; stroke-width: 1px";if(typeof a.milestoneStyle==="undefined"&&a.milestoneClass==null)a.milestoneStyle="fill: White; stroke: #000000; stroke-width: 1px";if(typeof a.temporaryThumbStyle===
"undefined"&&a.temporaryThumbClass==null)a.temporaryThumbStyle="fill: none; stroke: #0000ff; stroke-width: 0.65px; stroke-dasharray: 2, 2; ";if(typeof a.dependencyLineStyle==="undefined"&&a.dependencyLineClass==null)a.dependencyLineStyle="stroke: #8080FF; stroke-width: 0.65px; fill: none; marker-end: url(#ArrowMarker)";if(typeof a.dependencyLineZoneStyle==="undefined"&&a.dependencyLineZoneClass==null)a.dependencyLineZoneStyle="stroke: White; stroke-opacity: 0; stroke-width: 4px; fill: none";if(typeof a.taskTemplate===
"undefined")a.taskTemplate=S();if(typeof a.minDependencyLineLength==="undefined")a.minDependencyLineLength=48;if(typeof a.diagramMargin==="undefined")a.diagramMargin=16;if(typeof a.isTaskToolTipVisible==="undefined")switch(a.target){default:a.isTaskToolTipVisible=true;break;case "Phone":a.isTaskToolTipVisible=false}if(typeof a.itemTemplate==="undefined")a.itemTemplate=ba(a);if(typeof a.dependencyLineTemplate==="undefined")a.dependencyLineTemplate=ca();if(typeof a.isDependencyToolTipVisible==="undefined")a.isDependencyToolTipVisible=
a.isTaskToolTipVisible;if(typeof a.predecessorItemTemplate==="undefined")a.predecessorItemTemplate=da(a)},U=function(a,g){for(var b=new Date,c=0;c<a.length;c++){var h=a[c];if(typeof h==="string"){h={content:h};a[c]=h}if(typeof h.earlyStart==="string"){try{h.earlyStart=Date.parse(h.earlyStart)}catch(j){h.earlyStart=new Date(parseInt(h.earlyStart))}if(typeof g.isRelativeToTimezone==="undefined"||g.isRelativeToTimezone)h.earlyStart=new Date(h.earlyStart.valueOf()+b.getTimezoneOffset()*6E4)}if(typeof h.earlyFinish===
"string"){try{h.earlyFinish=Date.parse(h.earlyFinish)}catch(d){h.earlyFinish=new Date(parseInt(h.earlyFinish))}if(typeof g.isRelativeToTimezone==="undefined"||g.isRelativeToTimezone)h.earlyFinish=new Date(h.earlyFinish.valueOf()+b.getTimezoneOffset()*6E4)}if(typeof h.lateStart==="string"){try{h.lateStart=Date.parse(h.lateStart)}catch(f){h.lateStart=new Date(parseInt(h.lateStart))}if(typeof g.isRelativeToTimezone==="undefined"||g.isRelativeToTimezone)h.lateStart=new Date(h.lateStart.valueOf()+b.getTimezoneOffset()*
6E4)}if(typeof h.lateFinish==="string"){try{h.lateFinish=Date.parse(h.lateFinish)}catch(e){h.lateFinish=new Date(parseInt(h.lateFinish))}if(typeof g.isRelativeToTimezone==="undefined"||g.isRelativeToTimezone)h.earlyFinish=new Date(h.earlyFinish.valueOf()+b.getTimezoneOffset()*6E4)}if(typeof h.effort==="string")try{h.effort=parseInt(h.effort)}catch(q){}if(typeof h.isMilestone==="string")h.isMilestone=h.isMilestone.toLowerCase()==trueStringValue;if(typeof h.slack==="string")try{h.slack=parseInt(h.slack)}catch(o){}if(typeof h.predecessors!==
"undefined"){if(typeof h.predecessors==="string")h.predecessors=h.predecessors.split(",");for(var r=0;r<h.predecessors.length;r++){var t=h.predecessors[r];if(typeof t==="string"){t={item:t};h.predecessors[r]=t}if(typeof t.item==="string"){var m=parseInt(t.item)-1;t.item=m>=0&&m<a.length?a[m]:null}if(typeof t.lag==="string")t.lag=parseFloat(t.lag)}}if(typeof h.displayedRowIndex!=="undefined")h.actualRowIndex=h.displayedRowIndex;if(typeof h.displayedColumnIndex!=="undefined")h.actualColumnIndex=h.displayedColumnIndex;
if(typeof h.actualRowIndex==="undefined")h.actualRowIndex=0;if(typeof h.actualColumnIndex==="undefined")h.actualColumnIndex=0}},Z=function(a){a.positionedItems=[];a.maxRowIndex=null;for(var g=0;g<a.length;g++){var l=a[g],c=a;if(typeof l.displayedRowIndex==="undefined"){var h;if(typeof l.predecessors!=="undefined"){h=c.positionedItems;for(var j=[],d=l.predecessors,f=0;f<h.length;f++)for(var e=h[f],q=0;q<d.length;q++)if(d[q].item==e){j.push(e);break}h=j}else h=null;if(h!=null){j=h;d=[];for(f=0;f<j.length;f++){e=
j[f].actualRowIndex;d.indexOf(e)<0&&d.push(e)}j=d}else j=null;j=j!=null&&j.length>0?b(j):c.maxRowIndex!=null?c.maxRowIndex+1:0;d=d=void 0;if(typeof l.displayedColumnIndex==="undefined"){d=P(c.positionedItems,j);d=d.length>0?b(d)+1:0;f=h!=null?P(h,j):null;if(f!=null&&f.length>0){e=null;for(q=0;q<f.length;q++)if(e==null||f[q]<e)e=f[q];f=e+1}else f=null;if(f!=null&&f!=d){j++;h=h!=null?I(h):null;d=h!=null&&h.length>0?b(h)+1:0}for(l.actualColumnIndex=d;D(c.positionedItems,j,d);)j++}else for(;;j++){d=P(c.positionedItems,
j);d=d.length>0?b(d)+1:0;if(d<=l.actualColumnIndex)break}l.actualRowIndex=j}else if(typeof l.displayedColumnIndex==="undefined"){h=I(c.positionedItems);l.actualColumnIndex=h.length>0?b(h)+1:0}c.positionedItems.push(l);if(c.maxRowIndex==null||l.actualRowIndex>c.maxRowIndex)c.maxRowIndex=l.actualRowIndex}},P=function(a,g){for(var b=[],c=0;c<a.length;c++){var h=a[c];if(h.actualRowIndex==g){h=h.actualColumnIndex;b.indexOf(h)<0&&b.push(h)}}return b},I=function(a){for(var g=[],b=0;b<a.length;b++){var c=
a[b].actualColumnIndex;g.indexOf(c)<0&&g.push(c)}return g},D=function(a,g,b){for(var c=0;c<a.length;c++){var h=a[c];if(h.actualRowIndex==g&&h.actualColumnIndex==b)return true}return false},J=function(a,g,b){var c;if(a.isContentHeightInitialized&&a.isContentHeightAuto)c=g.length>0?"auto":b.itemHeight+"px";else{var h=a.clientHeight-2;h<0&&(h=0);c=h+"px";if(h<b.itemHeight){if(!a.isContentHeightInitialized)a.isContentHeightAuto=true;c=g.length>0?"auto":b.itemHeight+"px"}a.isContentHeightInitialized=true}return c},
w=function(a,g){var b=a.createElement("span");b.innerHTML=g;return b},y=function(a){var g;g=a.getFullYear();var b=a.getMonth()+1;b<10&&(b="0"+b);var c=a.getDate();c<10&&(c="0"+c);g=b+"/"+c+"/"+g;b=a.getHours();b<10&&(b="0"+b.toString());a=a.getMinutes();a<10&&(a="0"+a.toString());return g+" "+b+":"+a},C=function(a){return Math.ceil(a/36E5*1E4/100)/100+"h"},x=function(a){var g=new Date(Math.floor((new Date).valueOf()/864E5)*864E5),b=new Date,c,h;for(h=0;h<a.length;h++){c=a[h];c.index=h;var j=c.earlyStart,
d=c.earlyFinish,f=c.lateStart,e=c.lateFinish;if(typeof c.earlyStart==="undefined")c.earlyStart=g;if(typeof c.earlyFinish==="undefined")c.earlyFinish=typeof c.isMilestone==="undefined"||!c.isMilestone?new Date(g.valueOf()+864E5):c.earlyStart;if(typeof c.lateStart==="undefined")c.lateStart=g;if(typeof c.lateFinish==="undefined")c.lateFinish=typeof c.isMilestone==="undefined"||!c.isMilestone?new Date(g.valueOf()+864E5):c.lateStart;if(typeof c.isRelativeToTimezone==="undefined"||c.isRelativeToTimezone){c.earlyStart=
new Date(c.earlyStart.valueOf()-b.getTimezoneOffset()*6E4);c.earlyFinish=new Date(c.earlyFinish.valueOf()-b.getTimezoneOffset()*6E4);c.lateStart=new Date(c.lateStart.valueOf()-b.getTimezoneOffset()*6E4);c.lateFinish=new Date(c.lateFinish.valueOf()-b.getTimezoneOffset()*6E4);c.isRelativeToTimezone=false}if(typeof c.effort==="undefined")c.effort=0;if(typeof c.slack==="undefined")c.slack=0;if(typeof c.isMilestone==="undefined")c.isMilestone=false;(typeof j==="undefined"||c.earlyStart.valueOf()!=j.valueOf())&&
N(c,"earlyStart",false,true);(typeof d==="undefined"||c.earlyFinish.valueOf()!=d.valueOf())&&N(c,"earlyFinish",false,true);(typeof f==="undefined"||c.lateStart.valueOf()!=f.valueOf())&&N(c,"lateStart",false,true);(typeof e==="undefined"||c.lateFinish.valueOf()!=e.valueOf())&&N(c,"lateFinish",false,true)}},K=function(a,g){for(var b=0,c=0;c<a.length;c++)b=Math.max(b,a[c].actualColumnIndex);return g.itemWidth+b*(g.itemWidth+g.minDependencyLineLength)+g.diagramMargin*2},E=function(a,g){for(var b=0,c=
0;c<a.length;c++)b=Math.max(b,a[c].actualRowIndex);return g.itemHeight+b*(g.itemHeight+g.minDependencyLineLength/g.aspectRatio)+g.diagramMargin*2},G=function(a,g,b,c){for(a=0;a<b.length;a++){var h=b[a],j=F(h,c),d=H(h,c);g.appendChild(V(h,j,d,c))}},F=function(a,g){if(typeof a.displayedColumnIndex!=="undefined")a.actualColumnIndex=a.displayedColumnIndex;return Math.max(0,g.diagramMargin+a.actualColumnIndex*(g.itemWidth+g.minDependencyLineLength))},H=function(a,g){if(typeof a.displayedRowIndex!=="undefined")a.actualRowIndex=
a.displayedRowIndex;return Math.max(0,g.diagramMargin+a.actualRowIndex*(g.itemHeight+g.minDependencyLineLength/g.aspectRatio))},A=function(a){for(var g=[],b,c,h=0;h<a.length;h++){var j=a[h];if(typeof j.predecessors!=="undefined"&&j.predecessors.length>0)for(var d=0;d<j.predecessors.length;d++){var f=j.predecessors[d].item;if(typeof f!=="undefined"){b=true;for(c=0;c<g;c++)if(f==g[c]){b=false;break}if(b){Q(f.chartItem,f,f.networkDiagramView.settings);b=F(f,f.networkDiagramView.settings);c=H(f,f.networkDiagramView.settings);
f.chartItem.setAttribute("transform","translate("+b+", "+c+")");g.push(f)}}}if(typeof j.predecessors!=="undefined"&&j.predecessors.length>0){b=true;for(c=0;c<g;c++)if(typeof j!=="undefined"&&j==g[c]){b=false;break}if(b){Q(j.chartItem,j,j.networkDiagramView.settings);b=F(j,j.networkDiagramView.settings);c=H(j,j.networkDiagramView.settings);j.chartItem.setAttribute("transform","translate("+b+", "+c+")");g.push(j)}}}},V=function(a,b,d,c){var h=a.networkDiagramView.ownerDocument.createElementNS("http://www.w3.org/2000/svg",
"g");a.chartItem=h;h.setAttribute("style","-ms-touch-action: pinch-zoom; touch-action: pinch-zoom");h.setAttribute("transform","translate("+b+", "+d+")");Q(h,a,c);return h},Q=function(a,b,d){for(var c=a.childNodes.length;c-- >0;)a.removeChild(a.childNodes[c]);if(typeof b.isShapeVisible==="undefined"||b.isShapeVisible){c=d.taskTemplate;if(typeof b.taskTemplate!=="undefined")c=b.taskTemplate;c=c(b);a.appendChild(c);if(typeof d.internalExtraTaskTemplate!=="undefined"){var h=d.internalExtraTaskTemplate(b);
h!=null&&a.appendChild(h)}if(typeof d.extraTaskTemplate!=="undefined"){h=d.extraTaskTemplate(b);h!=null&&a.appendChild(h)}if(d.isTaskToolTipVisible){h=d.itemTemplate;if(typeof b.template!=="undefined")h=b.template;c.appendChild(h(b))}if(typeof b.predecessors!=="undefined")for(c=0;c<b.predecessors.length;c++){h=b.predecessors[c];if(!((typeof b.networkDiagramView==="undefined"||b.networkDiagramView.items.indexOf(h.item))<0||typeof h.item.isShapeVisible!=="undefined"&&!h.item.isShapeVisible)){var j=
d.dependencyLineTemplate(b,h);j.predecessorIndex=c;(function(a){j.addEventListener("click",function(c){d.dependencyLineClickHandler&&d.dependencyLineClickHandler(a,b,c)});j.addEventListener("dblclick",function(c){d.dependencyLineDoubleClickHandler&&d.dependencyLineDoubleClickHandler(a,b,c)})})(h);a.appendChild(j);if(d.isDependencyToolTipVisible){var f=d.predecessorItemTemplate;if(typeof h.template!=="undefined")f=h.template;j.appendChild(f(b,h))}}}}},B=function(a){if(typeof a.isWaitingToRefreshChartItem===
"undefined"){a.isWaitingToRefreshChartItem=true;setTimeout(function(){Q(a.chartItem,a,a.networkDiagramView.settings);var b=F(a,a.networkDiagramView.settings),d=H(a,a.networkDiagramView.settings);a.chartItem.setAttribute("transform","translate("+b+", "+d+")");delete a.isWaitingToRefreshChartItem},0)}},$=function(a){B(a)},W=function(a){if(typeof a.isWaitingToRefreshPredecessorItems==="undefined"){a.isWaitingToRefreshPredecessorItems=true;setTimeout(function(){A(a.networkDiagramView.items,a);delete a.isWaitingToRefreshPredecessorItems},
0)}},X=function(a){if(typeof a.isWaitingToRefreshChartItem!=="undefined"||typeof a.isWaitingToRefreshPredecessorItems!=="undefined"){typeof a.isWaitingToRefreshChartItem==="undefined"&&B(a);typeof a.isWaitingToRefreshPredecessorItems==="undefined"&&W(a)}else{a.isWaitingToRefreshChartItem=true;a.isWaitingToRefreshPredecessorItems=true;setTimeout(function(){Q(a.chartItem,a,a.networkDiagramView.settings);var b=F(a,a.networkDiagramView.settings),d=H(a,a.networkDiagramView.settings);a.chartItem.setAttribute("transform",
"translate("+b+", "+d+")");A(a.networkDiagramView.items,a);delete a.isWaitingToRefreshChartItem;delete a.isWaitingToRefreshPredecessorItems},0)}},aa=function(a){return function(){var b=a.ownerDocument,d=b.createElementNS("http://www.w3.org/2000/svg","defs"),c=b.createElementNS("http://www.w3.org/2000/svg","marker");c.setAttribute("id","ArrowMarker");c.setAttribute("viewBox","0 0 10 10");c.setAttribute("refX","0");c.setAttribute("refY","5");c.setAttribute("markerUnits","strokeWidth");c.setAttribute("markerWidth",
"5");c.setAttribute("markerHeight","4");c.setAttribute("orient","auto");b=b.createElementNS("http://www.w3.org/2000/svg","path");b.setAttribute("fill","#8080ff");b.setAttribute("d","M 0 0 L 10 5 L 0 10 z");c.appendChild(b);d.appendChild(c);return d}},ba=function(){return function(a){var b=a.networkDiagramView.ownerDocument,d=b.createElementNS("http://www.w3.org/2000/svg","title");d.appendChild(w(b,a.content));return d}},la=function(a){var b=a.networkDiagramView.ownerDocument;if(typeof a.chartItemArea===
"undefined")a.chartItemArea=b.createElementNS("http://www.w3.org/2000/svg","g");for(b=a.chartItemArea.childNodes.length;b-- >0;)a.chartItemArea.removeChild(a.chartItemArea.childNodes[b]);return a.chartItemArea},S=function(a,b,d){return function(c){var h=typeof b!=="undefined"?b:c.networkDiagramView,j=typeof d!=="undefined"?d:h.settings,f=typeof a!=="undefined"?a:h.items,e=h.ownerDocument,k=la(c),q=(j.itemWidth-j.shapeWidth)/2,o=q+j.shapeWidth,r=(j.itemHeight-j.shapeHeight)/2,t=r+j.shapeHeight,m=0,
p=j.shapeHeight,u=j.shapeWidth;if(c.isMilestone){m=u/16;q=q+m;o=o-m;u=u-2*m}if(c.isMilestone){var n=e.createElementNS("http://www.w3.org/2000/svg","polygon");n.setAttribute("points",q+","+r+" "+(q-m)+","+(r+t)/2+" "+q+","+t+" "+o+","+t+" "+(o+m)+","+(r+t)/2+" "+o+","+r);m=j.milestoneClass;if(typeof c.milestoneClass!=="undefined")m=c.milestoneClass;if(typeof m!=="undefined")n.setAttribute("class",m);else{m=j.milestoneStyle;if(typeof c.milestoneStyle!=="undefined")m=c.milestoneStyle;typeof m!=="undefined"&&
n.setAttribute("style",m)}k.appendChild(n)}n=e.createElementNS("http://www.w3.org/2000/svg","rect");n.setAttribute("x",q);n.setAttribute("y",r);n.setAttribute("width",Math.max(0,o-q-1));n.setAttribute("height",Math.max(0,t-r-1));m=j.shapeClass;if(typeof c.shapeClass!=="undefined")m=c.shapeClass;if(typeof m!=="undefined")n.setAttribute("class",m);else{m=j.shapeStyle;if(typeof c.shapeStyle!=="undefined")m=c.shapeStyle;typeof m!=="undefined"&&n.setAttribute("style",m)}k.appendChild(n);m=e.createElementNS("http://www.w3.org/2000/svg",
"line");m.setAttribute("x1",q);m.setAttribute("y1",r+p*3/8);m.setAttribute("x2",o-1);m.setAttribute("y2",r+p*3/8);n=j.shapeClass;if(typeof c.shapeClass!=="undefined")n=c.shapeClass;typeof n!=="undefined"&&m.setAttribute("class",n);n=j.shapeStyle;if(typeof c.shapeStyle!=="undefined")n=c.shapeStyle;typeof n!=="undefined"&&m.setAttribute("style",n);k.appendChild(m);m=e.createElementNS("http://www.w3.org/2000/svg","line");m.setAttribute("x1",q);m.setAttribute("y1",t-p*3/8);m.setAttribute("x2",o-1);m.setAttribute("y2",
t-p*3/8);n=j.shapeClass;if(typeof c.shapeClass!=="undefined")n=c.shapeClass;typeof n!=="undefined"&&m.setAttribute("class",n);n=j.shapeStyle;if(typeof c.shapeStyle!=="undefined")n=c.shapeStyle;typeof n!=="undefined"&&m.setAttribute("style",n);k.appendChild(m);m=e.createElementNS("http://www.w3.org/2000/svg","line");m.setAttribute("x1",q+u*3/8);m.setAttribute("y1",r);m.setAttribute("x2",q+u*3/8);m.setAttribute("y2",r+p*3/8);n=j.shapeClass;if(typeof c.shapeClass!=="undefined")n=c.shapeClass;typeof n!==
"undefined"&&m.setAttribute("class",n);n=j.shapeStyle;if(typeof c.shapeStyle!=="undefined")n=c.shapeStyle;typeof n!=="undefined"&&m.setAttribute("style",n);k.appendChild(m);m=e.createElementNS("http://www.w3.org/2000/svg","line");m.setAttribute("x1",o-u*3/8);m.setAttribute("y1",r);m.setAttribute("x2",o-u*3/8);m.setAttribute("y2",r+p*3/8);n=j.shapeClass;if(typeof c.shapeClass!=="undefined")n=c.shapeClass;typeof n!=="undefined"&&m.setAttribute("class",n);n=j.shapeStyle;if(typeof c.shapeStyle!=="undefined")n=
c.shapeStyle;typeof n!=="undefined"&&m.setAttribute("style",n);k.appendChild(m);m=e.createElementNS("http://www.w3.org/2000/svg","line");m.setAttribute("x1",q+u*3/8);m.setAttribute("y1",t);m.setAttribute("x2",q+u*3/8);m.setAttribute("y2",t-p*3/8);n=j.shapeClass;if(typeof c.shapeClass!=="undefined")n=c.shapeClass;typeof n!=="undefined"&&m.setAttribute("class",n);n=j.shapeStyle;if(typeof c.shapeStyle!=="undefined")n=c.shapeStyle;typeof n!=="undefined"&&m.setAttribute("style",n);k.appendChild(m);m=e.createElementNS("http://www.w3.org/2000/svg",
"line");m.setAttribute("x1",o-u*3/8);m.setAttribute("y1",t);m.setAttribute("x2",o-u*3/8);m.setAttribute("y2",t-p*3/8);n=j.shapeClass;if(typeof c.shapeClass!=="undefined")n=c.shapeClass;typeof n!=="undefined"&&m.setAttribute("class",n);n=j.shapeStyle;if(typeof c.shapeStyle!=="undefined")n=c.shapeStyle;typeof n!=="undefined"&&m.setAttribute("style",n);k.appendChild(m);n=e.createElementNS("http://www.w3.org/2000/svg","text");n.setAttribute("x",(q+o)/2);n.setAttribute("y",t-p*3/8-6);n.setAttribute("style",
"font-weight: bold; text-anchor: middle");m=c.displayedText;typeof m==="undefined"&&(m="");n.appendChild(e.createTextNode(m));k.appendChild(n);var m=function(a){var a=j.dateTimeFormatter(new Date(a.valueOf()+(new Date).getTimezoneOffset()*6E4)),b;b=a.indexOf(" ");if(b>=0){value1=a.substr(0,b);value2=a.substr(b+1)}else{value1=a;value2=""}return[value1,value2]},n=m(c.earlyStart),z=e.createElementNS("http://www.w3.org/2000/svg","text");z.setAttribute("x",q+u*3/8/2);z.setAttribute("y",t-p*5/8-20);z.setAttribute("style",
"text-anchor: middle");z.appendChild(e.createTextNode(n[0]));k.appendChild(z);z=e.createElementNS("http://www.w3.org/2000/svg","text");z.setAttribute("x",q+u*3/8/2);z.setAttribute("y",t-p*5/8-4);z.setAttribute("style","text-anchor: middle");z.appendChild(e.createTextNode(n[1]));k.appendChild(z);n=j.timeSpanFormatter(c.effort);z=e.createElementNS("http://www.w3.org/2000/svg","text");z.setAttribute("x",(q+o)/2);z.setAttribute("y",t-p*5/8-12);z.setAttribute("style","text-anchor: middle");z.appendChild(e.createTextNode(n));
k.appendChild(z);n=m(c.earlyFinish);z=e.createElementNS("http://www.w3.org/2000/svg","text");z.setAttribute("x",o-u*3/8/2);z.setAttribute("y",t-p*5/8-20);z.setAttribute("style","text-anchor: middle");z.appendChild(e.createTextNode(n[0]));k.appendChild(z);z=e.createElementNS("http://www.w3.org/2000/svg","text");z.setAttribute("x",o-u*3/8/2);z.setAttribute("y",t-p*5/8-4);z.setAttribute("style","text-anchor: middle");z.appendChild(e.createTextNode(n[1]));k.appendChild(z);n=m(c.lateStart);p=e.createElementNS("http://www.w3.org/2000/svg",
"text");p.setAttribute("x",q+u*3/8/2);p.setAttribute("y",t-20);p.setAttribute("style","text-anchor: middle");p.appendChild(e.createTextNode(n[0]));k.appendChild(p);p=e.createElementNS("http://www.w3.org/2000/svg","text");p.setAttribute("x",q+u*3/8/2);p.setAttribute("y",t-4);p.setAttribute("style","text-anchor: middle");p.appendChild(e.createTextNode(n[1]));k.appendChild(p);n=j.timeSpanFormatter(c.slack);p=e.createElementNS("http://www.w3.org/2000/svg","text");p.setAttribute("x",(q+o)/2);p.setAttribute("y",
t-12);p.setAttribute("style","text-anchor: middle");p.appendChild(e.createTextNode(n));k.appendChild(p);n=m(c.lateFinish);p=e.createElementNS("http://www.w3.org/2000/svg","text");p.setAttribute("x",o-u*3/8/2);p.setAttribute("y",t-20);p.setAttribute("style","text-anchor: middle");p.appendChild(e.createTextNode(n[0]));k.appendChild(p);p=e.createElementNS("http://www.w3.org/2000/svg","text");p.setAttribute("x",o-u*3/8/2);p.setAttribute("y",t-4);p.setAttribute("style","text-anchor: middle");p.appendChild(e.createTextNode(n[1]));
k.appendChild(p);if(j.canUserRearrangeItems){e=e.createElementNS("http://www.w3.org/2000/svg","rect");e.setAttribute("x",q);e.setAttribute("y",r);e.setAttribute("width",Math.max(0,o-q-1));e.setAttribute("height",Math.max(0,t-r-1));e.setAttribute("style","fill: White; fill-opacity: 0; cursor: move");k.appendChild(e);ka(e,c,f,F(c,j),H(c,j),h,j)}return k}},ca=function(a,b){return function(a,c){var h=a.networkDiagramView,j=typeof b!=="undefined"?b:h.settings,d=h.ownerDocument,h=d.createElementNS("http://www.w3.org/2000/svg",
"g"),e;e="M ";var f=F(a,j)-2,q=H(a,j)-2,o=F(c.item,j),r=H(c.item,j),t=F(a,j),m=H(a,j),p=Math.abs(t-o),u=Math.abs(m-r),n=j.shapeWidth+2,z=j.shapeHeight+2,y=n/2,x=z/2,w=Math.max(n,z),u=u<w*4;if(p<w)e=r<=m?e+(o+y-f+","+(r+z-q))+(" L "+(t+y-f)+","+(m-q)):e+(o+y-f+","+(r-q))+(" L "+(t+y-f)+","+(m+z-q));else{e=o<=t?e+(o+n-f+","+(r+x-q)):e+(o-f+","+(r+x-q));e=u?o<=t?e+(" L "+(t-f)+","+(m+x-q)):e+(" L "+(t+n-f)+","+(m+x-q)):r<=m?e+(" L "+(t+y-f)+","+(m-q)):e+(" L "+(t+y-f)+","+(m+z-q))}f=d.createElementNS("http://www.w3.org/2000/svg",
"path");f.setAttribute("d",e);typeof j.dependencyLineZoneClass!=="undefined"&&f.setAttribute("class",j.dependencyLineZoneClass);typeof j.dependencyLineZoneStyle!=="undefined"&&f.setAttribute("style",j.dependencyLineZoneStyle);h.appendChild(f);d=d.createElementNS("http://www.w3.org/2000/svg","path");d.setAttribute("d",e);e=j.dependencyLineClass;if(typeof c.dependencyLineClass!=="undefined")e=c.dependencyLineClass;typeof e!=="undefined"&&d.setAttribute("class",e);j=j.dependencyLineStyle;if(typeof c.dependencyLineStyle!==
"undefined")j=c.dependencyLineStyle;typeof j!=="undefined"&&d.setAttribute("style",j);h.appendChild(d);return h}},da=function(){return function(a,b){var d=a.networkDiagramView.ownerDocument,c=d.createElementNS("http://www.w3.org/2000/svg","title");c.appendChild(w(d,b.item.displayedText+" - "+a.displayedText));return c}},N=function(a,b,d,c){typeof a.networkDiagramView!=="undefined"&&a.networkDiagramView.settings.itemPropertyChangeHandler(a,b,d,c)},ka=function(a,b,d,c,h,j,e){a.addEventListener("mousedown",
function(d){if(d.button==0){j.draggingItem=b;j.dragType="Position";j.style.cursor=a.style.cursor;j.draggingInitialX=d.clientX;j.draggingInitialY=d.clientY;j.draggingInitialThumbXPosition=c;j.draggingInitialThumbYPosition=h;d.preventDefault()}},true);if(typeof j.draggableItems==="undefined")j.draggableItems=[];for(var f=false,k=0;k<j.draggableItems.length;k++)if(j.draggableItems[k]==b){f=true;break}if(!f){j.addEventListener("mousemove",function(a){if(!(typeof j.draggingItem==="undefined"||j.draggingItem!=
b||j.dragType!="Position")){var c=a.clientX-j.draggingInitialX,h=a.clientY-j.draggingInitialY;var f=a.clientX;if(typeof j.draggingItem!=="undefined"){var k=j,p=0;if(k.offsetParent){do{p=p+k.offsetLeft;k=k.offsetParent}while(k)}f=f-p;if(f<24){f=j.chartContentContainer.scrollLeft;j.chartContentContainer.scrollLeft=j.chartContentContainer.scrollLeft-48;f=f-j.chartContentContainer.scrollLeft;if(typeof j.draggingInitialThumbXPosition!=="undefined")j.draggingInitialThumbXPosition=j.draggingInitialThumbXPosition-
f}else if(f>=j.chartContentContainer.clientWidth-24){f=j.chartContentContainer.scrollLeft;j.chartContentContainer.scrollLeft=j.chartContentContainer.scrollLeft+48;f=j.chartContentContainer.scrollLeft-f;if(typeof j.draggingInitialThumbXPosition!=="undefined")j.draggingInitialThumbXPosition=j.draggingInitialThumbXPosition+f}}a=a.clientY;if(typeof j.draggingItem!=="undefined"){f=j;k=0;if(f.offsetParent){do{k=k+f.offsetTop;f=f.offsetParent}while(f)}a=a-k;if(a<24){a=j.chartContentContainer.scrollTop;j.chartContentContainer.scrollTop=
j.chartContentContainer.scrollTop-48;a=a-j.chartContentContainer.scrollTop;if(typeof j.draggingInitialThumbYPosition!=="undefined")j.draggingInitialThumbYPosition=j.draggingInitialThumbYPosition-a}else if(a>=j.chartContentContainer.clientHeight-24){a=j.chartContentContainer.scrollTop;j.chartContentContainer.scrollTop=j.chartContentContainer.scrollTop+48;a=j.chartContentContainer.scrollTop-a;if(typeof j.draggingInitialThumbYPosition!=="undefined")j.draggingInitialThumbYPosition=j.draggingInitialThumbYPosition+
a}}delete j.draggingItem;j.draggingInitialThumbXPosition+c<0&&(c=-j.draggingInitialThumbXPosition);j.draggingInitialThumbYPosition+h<0&&(h=-j.draggingInitialThumbYPosition);h=(j.draggingInitialThumbYPosition+h-e.diagramMargin)/(e.itemHeight+e.minDependencyLineLength/e.aspectRatio);e.snapRearrangedItemsToGuidelines&&(h=Math.round(h));b.actualRowIndex=h;c=(j.draggingInitialThumbXPosition+c-e.diagramMargin)/(e.itemWidth+e.minDependencyLineLength);e.snapRearrangedItemsToGuidelines&&(c=Math.round(c));
b.actualColumnIndex=c;N(b,"actualRowIndex",true,false);N(b,"actualColumnIndex",true,false);typeof b.displayedColumnIndex!=="undefined"&&delete b.displayedColumnIndex;typeof b.displayedRowIndex!=="undefined"&&delete b.displayedRowIndex;ma(b,d,j.chartContent,e,false);j.draggingItem=b;j.draggingPerformed=true}},true);document.addEventListener("mouseup",function(a){if(!(a.button!=0||typeof j.draggingItem==="undefined"||j.draggingItem!=b||j.dragType!="Position")){ma(b,d,j.chartContent,e,true);a=j.draggingItem;
delete j.draggingItem;j.style.cursor="default";if(j.draggingPerformed){N(a,"actualColumnIndex",true,true);N(a,"actualRowIndex",true,true);delete j.draggingPerformed}}},true);j.draggableItems.push(b)}},ma=function(a,b,d,c,h){var j=a.networkDiagramView.ownerDocument;if(h){if(typeof d.temporaryRectangle!=="undefined"){j=d.chartArea;j.removeChild(d.temporaryRectangle);delete d.temporaryRectangle}setTimeout(function(){Q(a.chartItem,a,c);A(b,a);setTimeout(function(){ea(d,b,c,true)},0)})}else{if(typeof d.temporaryRectangle!==
"undefined")h=d.temporaryRectangle;else{h=j.createElementNS("http://www.w3.org/2000/svg","rect");h.setAttribute("x",0);h.setAttribute("y",0);h.setAttribute("width",c.shapeWidth);h.setAttribute("height",c.shapeHeight);typeof c.temporaryThumbClass!=="undefined"&&h.setAttribute("class",c.temporaryThumbClass);h.setAttribute("style",c.temporaryThumbStyle);d.temporaryRectangle=h;j=d.chartArea;j.appendChild(h)}var j=F(a,c)+(c.itemWidth-c.shapeWidth)/2,e=H(a,c)+(c.itemHeight-c.shapeHeight)/2;h.setAttribute("transform",
"translate("+j+", "+e+")");setTimeout(function(){ea(d,b,c,false)},0)}},ea=function(a,b,d,c){var h=K(b,d),b=E(b,d);if(c||h>a.clientWidth)a.style.width=h+"px";if(c||b>a.clientHeight)a.style.height=b+"px";c&&a.chartArea.setAttribute("style","width: "+h+"px; height: "+b+"px")},na=function(a,b){for(var d=a.childNodes.length;d-- >0;)a.removeChild(a.childNodes[d]);a.appendChild(b)},fa=function(a,b){for(var d in b)d.indexOf("custom")!=0&&d.indexOf("description")!=0||typeof a[d]==="undefined"&&(a[d]=b[d])},
ha=function(a,b,d,c,h,j,e,f,k){var d={isExport:true,canUserRearrangeItems:false,isTaskToolTipVisible:false,isDependencyToolTipVisible:false,containerClass:k.containerClass,containerStyle:k.containerStyle,border:k.border,theme:k.theme,itemWidth:k.itemWidth,itemHeight:k.itemHeight,aspectRatio:k.aspectRatio,shapeWidth:k.shapeWidth,shapeHeight:k.shapeHeight,shapeClass:k.shapeClass,milestoneClass:k.milestoneClass,shapeStyle:k.shapeStyle,milestoneStyle:k.milestoneStyle,dependencyLineClass:k.dependencyLineClass,
dependencyLineStyle:k.dependencyLineStyle,minDependencyLineLength:k.minDependencyLineLength,diagramMargin:0,target:k.target,dateTimeFormatter:k.dateTimeFormatter,timeSpanFormatter:k.timeSpanFormatter,isRelativeToTimezone:k.isRelativeToTimezone,taskTemplate:k.taskTemplate,dependencyLineTemplate:k.dependencyLineTemplate},k=K(f,d),q=E(f,d);d.chartWidth=k+"px";d.chartHeight=q+"px";var o=k+2,k=q+2,r,t,m=false;if(c!=null&&typeof c.createElement!=="undefined")r=c;else{if(c!=null&&typeof c.focus!=="undefined")t=
c;else{t=window.open("",c!=null?c:"_blank",typeof h!=="undefined"&&h&&(typeof e==="undefined"||e)?"width=320,height=100,location=no,menubar=no,toolbar=no,status=no,scrollbars=yes":"");m=true}r=t.document;try{for(var p=document.head.getElementsByTagName("link"),c=0;c<p.length;c++){var u=p[c],n=r.adoptNode(u.cloneNode(true));n.href=u.href;r.head.appendChild(n)}}catch(y){}}r.title=typeof a!=="undefined"?a:"Exported diagram"+(typeof h!=="undefined"&&h?" (printable)":"");a=[];for(c=0;c<f.length;c++){p=
f[c];u={content:p.content,earlyStart:p.earlyStart,earlyFinish:p.earlyFinish,lateStart:p.lateStart,lateFinish:p.lateFinish,isMilestone:p.isMilestone,effort:p.effort,slack:p.slack,isShapeVisible:p.isShapeVisible,isRelativeToTimezone:p.isRelativeToTimezone,shapeClass:p.shapeClass,milestoneClass:p.milestoneClass,shapeStyle:p.shapeStyle,milestoneStyle:p.milestoneStyle,displayedRowIndex:p.actualRowIndex,displayedColumnIndex:p.actualColumnIndex,isExported:true};fa(u,p);a.push(u);p.exportItem=u}for(c=0;c<
f.length;c++){p=f[c];u=p.exportItem;if(typeof p.predecessors!=="undefined"){u.predecessors=[];for(n=0;n<p.predecessors.length;n++){q=p.predecessors[n];u.predecessors.push({item:q.item.exportItem,dependencyLineClass:q.dependencyLineClass,dependencyLineStyle:q.dependencyLineStyle})}}}var x=r.createElement("p");x.innerHTML=typeof b!=="undefined"?b:"";r.body.appendChild(x);var w=r.createElement("div");w.setAttribute("style","width: "+o+"px; height: "+k+"px");try{DlhSoft.Controls.Pert.NetworkDiagramView.initialize(w,
a,d,"DlhSoft.Controls: DlhSoft internal usage only. Customers may purchase standard product usage licenses from http://DlhSoft.com/Purchase.")}catch(A){}setTimeout(function(){m&&r.body.setAttribute("style","margin: 0px");var a=r.createElement("div");a.appendChild(w);r.body.replaceChild(a,x);if(j){a.setAttribute("style","width: "+w.offsetHeight+"px; height: "+o+"px; overflow: hidden");a=Math.round((w.offsetWidth-w.offsetHeight)/2);w.setAttribute("style","width: "+o+"px; transform: rotate(90deg) translateX("+
a+"px) translateY("+a+"px); -webkit-transform: rotate(90deg) translateX("+a+"px) translateY("+a+"px)")}r.close();if(typeof t!==void 0){t.focus();if(typeof h!=="undefined"&&h){t.print();(typeof e==="undefined"||e)&&t.close()}}},0)},Y=function(a,b){var d;a:{for(d=0;d<b.length;d++){var c=b[d];if(typeof c.predecessors==="undefined"||c.predecessors.length==0){d=c;break a}}d=null}if(d==null)return[];var h;a:{for(c=b.length;c-- >0;){h=b[c];if(ja(h).length==0)break a}h=null}if(h==null)return[];c=[d];d=ga(d,
h);for(h=0;h<d.length;h++)c.push(d[h]);return c},ia=function(a,b){for(var d=Y(a,b),c=[],h=0;h<d.length;h++){var j=d[h];if(typeof j.predecessors!=="undefined")for(var e=0;e<j.predecessors.length;e++){var f=j.predecessors[e];typeof f.item!=="undefined"&&d.indexOf(f.item)>=0&&c.push(f)}}return c},ga=function(a,b){if(a==null||b==null||a==b||typeof b.predecessors==="undefined")return[];var d=[],c=[],h,j=null;for(h=0;h<b.predecessors.length;h++){predecessorItem=b.predecessors[h];if(typeof predecessorItem.item!==
"undefined"){var e=R(a,predecessorItem.item);if(e!=null){predecessorItem.item.effort>0&&(e=e+predecessorItem.item.effort);if(j==null||e>=j){if(j==null||e>j){j=e;c=[]}c.push(predecessorItem)}}}}for(h=0;h<c.length;h++){nextPredecessorItem=c[h];j=ga(a,nextPredecessorItem.item);for(e=0;e<j.length;e++)d.push(j[e]);d.push(b)}return d},R=function(a,b){if(a==null||b==null)return null;if(a==b)return 0;for(var d=null,c=ja(a),h=0;h<c.length;h++){var e=c[h],f=R(e.dependentItem,b);if(f!=null){f=f+(typeof e.predecessorItem.item!==
"undefined"&&e.predecessorItem.item.effort>0?e.predecessorItem.item.effort:0);f<0&&(f=0);if(d==null||f>d)d=f}}return d},ja=function(a){for(var b=[],d=a.networkDiagramView.items,c=0;c<d.length;c++){var h=d[c];if(typeof h.predecessors!=="undefined")for(var e=0;e<h.predecessors.length;e++){var f=h.predecessors[e];typeof f.item!=="undefined"&&f.item==a&&b.push({dependentItem:h,predecessorItem:f})}}return b},b=function(a){for(var b=null,d=0;d<a.length;d++)if(b==null||a[d]>b)b=a[d];return b},f=function(a){return typeof a!==
"undefined"?new Date(a.valueOf()+a.getTimezoneOffset()*6E4):a},d=function(a){return typeof a!=="undefined"?new Date(a.valueOf()-a.getTimezoneOffset()*6E4):a},e=function(a,b,e){for(var c=0;c<b.length;c++)b[c].networkDiagramView=a;a.items=b;a.settings=e;a.refresh=function(){M(a)};a.refreshItems=function(){for(var a=0;a<b.length;a++){var c=b[a];B(c);W(c)}};a.refreshChartItems=function(){for(var a=0;a<b.length;a++)B(b[a])};a.refreshItem=$;a.refreshChartItem=B;a.refreshPredecessorItems=W;a.refreshItemGraph=
X;a.scrollToItem=function(a){var b=F(a,e),c=b-a.networkDiagramView.chartContentContainer.scrollLeft;if(c<0)a.networkDiagramView.chartContentContainer.scrollLeft=b;else if(c>a.networkDiagramView.chartContentContainer.clientWidth-a.networkDiagramView.settings.itemWidth)a.networkDiagramView.chartContentContainer.scrollLeft=b-(a.networkDiagramView.chartContentContainer.clientWidth-a.networkDiagramView.settings.itemWidth);b=H(a,e);c=b-a.networkDiagramView.chartContentContainer.scrollTop;if(c<0)a.networkDiagramView.chartContentContainer.scrollTop=
b;else if(c>a.networkDiagramView.chartContentContainer.clientHeight-a.networkDiagramView.settings.itemHeight)a.networkDiagramView.chartContentContainer.scrollTop=b-(a.networkDiagramView.chartContentContainer.clientHeight-a.networkDiagramView.settings.itemHeight)};a.scrollToLeft=function(){a.chartContentContainer.scrollLeft=0};a.scrollToRight=function(){a.chartContentContainer.scrollLeft=a.chartContent.clientWidth};a.scrollToTop=function(){a.chartContentContainer.scrollTop=0};a.scrollToBottom=function(){a.chartContentContainer.scrollTop=
a.chartContent.clientHeight};a.getChartWidth=function(){return K(b,e)};a.getChartHeight=function(){return E(b,e)};a.getItemTop=function(a){return H(a,e)};a.getItemLeft=function(a){return F(a,e)};a.onItemPropertyChanged=N;a.initializeTaskDraggingThumbs=function(b,c,d,e){ka(b,c,a.items,d,e,a,a.settings)};a.exportContent=function(a,c){typeof a==="undefined"&&(a={});ha(a.title,a.preparingMessage,a.isRelativeToTimezone,c,false,a.rotate,false,b,e)};a.print=function(a){typeof a==="undefined"&&(a={});ha(a.title,
a.preparingMessage,a.isRelativeToTimezone,null,true,a.rotate,a.autoClose,b,e)};a.isItemCritical=function(a,c){return Y(c,b).indexOf(a)>=0};a.isDependencyCritical=function(a,c){return ia(c,b).indexOf(a)>=0};a.getCriticalItems=function(a){return Y(a,b)};a.getCriticalDependencies=function(a){return ia(a,b)};a.repositionEnds=function(){if(b.length!=0){for(var a=false,c=0;c<b.length;c++){for(var d=b[c],e=0,f=0;f<b.length;f++){var l=b[f];if(typeof l.predecessors!=="undefined"){for(var o=0;o<l.predecessors.length;o++)if(typeof l.predecessors[o].item!==
"undefined"&&l.predecessors[o].item==d){e++;if(e>1)break}if(e>1)break}}e>1&&(a=true)}c=b[0];c.displayedRowIndex=a?0.5:0;d=b[b.length-1];d.displayedRowIndex=a?0.5:0;X(c);X(d)}};a.getOutputDate=f;a.getInputDate=d};return{initialize:L,initializeItems:U,refresh:M,getDefaultStyleDefinitionTemplate:aa,getDefaultTaskTemplate:S,getDefaultItemTemplate:ba,getDefaultDependencyLineTemplate:ca,getDefaultPredecessorItemTemplate:da,initializeTaskDraggingThumbs:function(a,b,d,c){b.networkDiagramView.initializeTaskDraggingThumbs(a,
b,d,c)},defaultDateTimeFormatter:function(a){return y(new Date(a.valueOf()+(new Date).getTimezoneOffset()*6E4))},defaultTimeSpanFormatter:C,getOutputDate:f,getInputDate:d}}());
;
// Supported themes: Default, Generic-bright, Generic-blue, DlhSoft-gray, Purple-green, Steel-blue, Dark-black, Cyan-green, Blue-navy, Orange-brown, Teal-green, Purple-beige, Gray-blue, Aero.
function initializeGanttChartTemplates(settings, theme) {
    if (theme == 'Default' || theme == 'Aero')
        return;
    // Override settings (partial).
    var barMargin = 4;
    var barHeight = settings.itemHeight - 2 * barMargin;
    var completedBarMargin = 1;
    var completedBarHeight = barHeight - 2 * completedBarMargin;
    // Common helpers.
    var undefinedType = 'undefined', svgns = 'http://www.w3.org/2000/svg', hourDuration = 60 * 60 * 1000;
    function getChartItemArea(item) {
        var document = item.ganttChartView.ownerDocument;
        if (typeof item.chartItemArea === undefinedType)
            item.chartItemArea = document.createElementNS(svgns, 'g');
        for (var i = item.chartItemArea.childNodes.length; i-- > 0;)
            item.chartItemArea.removeChild(item.chartItemArea.childNodes[i]);
        return item.chartItemArea;
    }
    function getTextNode(document, value) {
        var span = document.createElement('span');
        span.innerHTML = value;
        return span;
    };
    function getDependencyTypeString(dependencyType) {
        switch (dependencyType) {
            case 'StartStart':
            case 'SS':
                return 'SS';
            case 'FinishFinish':
            case 'FF':
                return 'FF';
            case 'StartFinish':
            case 'SF':
                return 'SF';
            case 'FinishStart':
            case 'FS':
            default:
                return 'FS';
        }
    };
    // Template definitions.
    settings.styleDefinitionTemplate = function (ganttChartView) {
        var document = ganttChartView.ownerDocument;
        var defs = document.createElementNS(svgns, 'defs');
        var arrowMarker = document.createElementNS(svgns, 'marker');
        arrowMarker.setAttribute('id', 'ArrowMarker');
        arrowMarker.setAttribute('viewBox', '0 0 9 9');
        arrowMarker.setAttribute('refX', '0');
        arrowMarker.setAttribute('refY', '4.5');
        arrowMarker.setAttribute('markerUnits', 'strokeWidth');
        arrowMarker.setAttribute('markerWidth', 4.5 * (settings.arrowSize ? settings.arrowSize : 1));
        arrowMarker.setAttribute('markerHeight', 3.5 * (settings.arrowSize ? settings.arrowSize : 1));
        arrowMarker.setAttribute('orient', 'auto');
        var arrowPath = document.createElementNS(svgns, 'path');
        arrowPath.setAttribute('fill', settings.arrowFill ? settings.arrowFill : '#3b87d9');
        arrowPath.setAttribute('d', 'M 0 0 L 9 4.5 L 0 9 z');
        arrowMarker.appendChild(arrowPath);
        defs.appendChild(arrowMarker);
        return defs;
    };
    settings.standardTaskTemplate = function (item) {
        var ganttChartView = item.ganttChartView;
        var settings = ganttChartView.settings;
        var items = ganttChartView.items;
        var document = ganttChartView.ownerDocument;
        var group = getChartItemArea(item);
        if (settings.isBaselineVisible && typeof item.baselineStart !== undefinedType && typeof item.baselineFinish !== undefinedType) {
            var itemBaselineLeft = ganttChartView.getChartPosition(item.baselineStart);
            var itemBaselineRight = Math.max(ganttChartView.getChartPosition(item.baselineFinish), itemBaselineLeft + 4);
            var baselineBar = document.createElementNS(svgns, 'rect');
            baselineBar.setAttribute('x', itemBaselineLeft);
            baselineBar.setAttribute('y', barMargin / 2);
            baselineBar.setAttribute('width', Math.max(0, itemBaselineRight - itemBaselineLeft - 1));
            baselineBar.setAttribute('height', barHeight);
            baselineBar.setAttribute('rx', settings.barCornerRadius);
            baselineBar.setAttribute('ry', settings.barCornerRadius);
            var baselineBarClass = settings.baselineBarClass;
            if (typeof item.baselineBarClass !== undefinedType)
                baselineBarClass = item.baselineBarClass;
            if (typeof baselineBarClass !== undefinedType)
                baselineBar.setAttribute('class', baselineBarClass);
            else {
                var baselineBarStyle = settings.baselineBarStyle;
                if (typeof item.baselineBarStyle !== undefinedType)
                    baselineBarStyle = item.baselineBarStyle;
                if (typeof baselineBarStyle !== undefinedType)
                    baselineBar.setAttribute('style', baselineBarStyle);
            }
            group.appendChild(baselineBar);
        }
        var itemLeft = ganttChartView.getChartPosition(item.start);
        var itemRight = Math.max(ganttChartView.getChartPosition(item.finish), itemLeft + 4);
        var itemCompletedRight = ganttChartView.getChartPosition(item.completedFinish) + 1;
        var bar = document.createElementNS(svgns, 'rect');
        bar.setAttribute('x', itemLeft);
        bar.setAttribute('y', barMargin);
        bar.setAttribute('width', Math.max(0, itemRight - itemLeft - 1));
        bar.setAttribute('height', barHeight);
        bar.setAttribute('rx', settings.barCornerRadius);
        bar.setAttribute('ry', settings.barCornerRadius);
        var barClass = settings.standardBarClass;
        if (typeof item.standardBarClass !== undefinedType)
            barClass = item.standardBarClass;
        if (typeof item.barClass !== undefinedType)
            barClass = item.barClass;
        if (typeof barClass !== undefinedType)
            bar.setAttribute('class', barClass);
        else {
            var barStyle = settings.standardBarStyle;
            if (typeof item.standardBarStyle !== undefinedType)
                barStyle = item.standardBarStyle;
            if (typeof item.barStyle !== undefinedType)
                barStyle = item.barStyle;
            if (typeof barStyle !== undefinedType)
                bar.setAttribute('style', barStyle);
        }
        group.appendChild(bar);
        if (settings.isTaskCompletedEffortVisible) {
            var completedBar = document.createElementNS(svgns, 'rect');
            completedBar.setAttribute('x', itemLeft + 1);
            completedBar.setAttribute('y', barMargin + completedBarMargin);
            completedBar.setAttribute('width', Math.max(0, itemCompletedRight - 2 - 1 - itemLeft - 1));
            completedBar.setAttribute('height', completedBarHeight);
            completedBar.setAttribute('rx', settings.completedBarCornerRadius);
            completedBar.setAttribute('ry', settings.completedBarCornerRadius);
            var completedBarClass = settings.standardCompletedBarClass;
            if (typeof item.standardCompletedBarClass !== undefinedType)
                completedBarClass = item.standardCompletedBarClass;
            if (typeof item.completedBarClass !== undefinedType)
                completedBarClass = item.completedBarClass;
            if (typeof completedBarClass !== undefinedType)
                completedBar.setAttribute('class', completedBarClass);
            else {
                var completedBarStyle = settings.standardCompletedBarStyle;
                if (typeof item.standardCompletedBarStyle !== undefinedType)
                    completedBarStyle = item.standardCompletedBarStyle;
                if (typeof item.completedBarStyle !== undefinedType)
                    completedBarStyle = item.completedBarStyle;
                if (typeof completedBarStyle !== undefinedType)
                    completedBar.setAttribute('style', completedBarStyle);
            }
            group.appendChild(completedBar);
        }
        if (!settings.isReadOnly && !settings.isChartReadOnly && (typeof item.isReadOnly === undefinedType || !item.isReadOnly) && (typeof item.isBarReadOnly === undefinedType || !item.isBarReadOnly)) {
            var thumb = document.createElementNS(svgns, 'rect');
            thumb.setAttribute('x', itemLeft);
            thumb.setAttribute('y', barMargin);
            thumb.setAttribute('width', Math.max(0, itemRight - itemLeft - 1));
            thumb.setAttribute('height', barHeight);
            thumb.setAttribute('style', 'fill: White; fill-opacity: 0; cursor: move');
            if (!settings.isTaskStartReadOnly)
                group.appendChild(thumb);
            var startThumb = document.createElementNS(svgns, 'rect');
            startThumb.setAttribute('x', itemLeft - 4);
            startThumb.setAttribute('y', barMargin);
            startThumb.setAttribute('width', 4);
            startThumb.setAttribute('height', barHeight);
            startThumb.setAttribute('style', 'fill: White; fill-opacity: 0; cursor: e-resize');
            if (settings.isDraggingTaskStartEndsEnabled && !settings.isTaskStartReadOnly && settings.interaction != 'TouchEnabled')
                group.appendChild(startThumb);
            var finishThumb = document.createElementNS(svgns, 'rect');
            finishThumb.setAttribute('x', itemRight - 4);
            finishThumb.setAttribute('y', barMargin);
            finishThumb.setAttribute('width', 8);
            finishThumb.setAttribute('height', barHeight);
            finishThumb.setAttribute('style', 'fill: White; fill-opacity: 0; cursor: e-resize');
            if (!settings.isTaskEffortReadOnly && settings.interaction != 'TouchEnabled')
                group.appendChild(finishThumb);
            var completedFinishThumb = document.createElementNS(svgns, 'rect');
            completedFinishThumb.setAttribute('x', itemCompletedRight - 2);
            completedFinishThumb.setAttribute('y', barMargin);
            completedFinishThumb.setAttribute('width', 6);
            completedFinishThumb.setAttribute('height', barHeight);
            completedFinishThumb.setAttribute('style', 'fill: White; fill-opacity: 0; cursor: e-resize');
            if (!settings.isTaskCompletionReadOnly && settings.isTaskCompletedEffortVisible && settings.interaction != 'TouchEnabled') {
                group.appendChild(completedFinishThumb);
                var completedFinishToolTip = document.createElementNS(svgns, 'title');
                var completion = typeof settings.areToolTipsSimplified === undefinedType || !settings.areToolTipsSimplified ? ganttChartView.getItemCompletion(item) : NaN;
                completedFinishToolTip.appendChild(getTextNode(document, !isNaN(completion) ? (Math.round(completion * 100 * 100) / 100) + '%' : ''));
                completedFinishThumb.appendChild(completedFinishToolTip);
            }
            ganttChartView.initializeTaskDraggingThumbs(thumb, startThumb, finishThumb, completedFinishThumb, item, itemLeft, itemRight, itemCompletedRight);
            if (settings.areTaskDependenciesVisible && !settings.areTaskPredecessorsReadOnly && !item.isPart) {
                var startDependencyThumb = null;
                if (typeof settings.allowCreatingStartDependencies === undefinedType || settings.allowCreatingStartDependencies) {
                    startDependencyThumb = document.createElementNS(svgns, 'circle');
                    startDependencyThumb.setAttribute('cx', itemLeft);
                    startDependencyThumb.setAttribute('cy', barMargin + barHeight / 2);
                    startDependencyThumb.setAttribute('r', barHeight / 4);
                    startDependencyThumb.setAttribute('style', 'fill: White; fill-opacity: 0; cursor: pointer');
                    group.appendChild(startDependencyThumb);
                }
                var dependencyThumb = document.createElementNS(svgns, 'circle');
                dependencyThumb.setAttribute('cx', itemRight - 2);
                dependencyThumb.setAttribute('cy', barMargin + barHeight / 2);
                dependencyThumb.setAttribute('r', barHeight / 4);
                dependencyThumb.setAttribute('style', 'fill: White; fill-opacity: 0; cursor: pointer');
                group.appendChild(dependencyThumb);
                ganttChartView.initializeDependencyDraggingThumbs(dependencyThumb, startDependencyThumb, group, item, barMargin + barHeight / 2, itemRight - 2, itemLeft);
            }
        }
        return group;
    };
    settings.summaryTaskTemplate = function (item) {
        var ganttChartView = item.ganttChartView;
        var settings = ganttChartView.settings;
        var items = ganttChartView.items;
        var document = ganttChartView.ownerDocument;
        var group = getChartItemArea(item);
        var itemLeft = ganttChartView.getChartPosition(item.start);
        var itemRight = ganttChartView.getChartPosition(item.finish);
        var height = settings.barHeight * 2.15 / 2.65;
        var bar = document.createElementNS(svgns, 'rect');
        bar.setAttribute('x', itemLeft);
        bar.setAttribute('y', settings.barMargin);
        bar.setAttribute('width', Math.max(0, itemRight - itemLeft - 1));
        bar.setAttribute('height', height);
        var barClass = settings.summaryBarClass;
        if (typeof item.summaryBarClass !== undefinedType)
            barClass = item.summaryBarClass;
        if (typeof item.barClass !== undefinedType)
            barClass = item.barClass;
        if (typeof barClass !== undefinedType)
            bar.setAttribute('class', barClass);
        else {
            var barStyle = settings.summaryBarStyle;
            if (typeof item.summaryBarStyle !== undefinedType)
                barStyle = item.summaryBarStyle;
            if (typeof item.barStyle !== undefinedType)
                barStyle = item.barStyle;
            if (typeof barStyle !== undefinedType)
                bar.setAttribute('style', barStyle);
        }
        group.appendChild(bar);
        if (!item.isExpanded) {
            var line = document.createElementNS(svgns, 'line');
            line.setAttribute('x1', itemLeft);
            line.setAttribute('y1', settings.barMargin + height + 2.5);
            line.setAttribute('x2', itemRight - 1);
            line.setAttribute('y2', settings.barMargin + height + 2.5);
            var lineClass = settings.collapsedSummaryLineClass;
            if (typeof item.collapsedSummaryLineClass !== undefinedType)
                lineClass = item.collapsedSummaryLineClass;
            if (typeof lineClass !== undefinedType)
                line.setAttribute('class', lineClass);
            else {
                var lineStyle = settings.collapsedSummaryLineStyle;
                if (typeof item.collapsedSummaryLineStyle !== undefinedType)
                    lineStyle = item.collapsedSummaryLineStyle;
                if (typeof lineStyle !== undefinedType)
                    line.setAttribute('style', lineStyle);
            }
            group.appendChild(line);
        }
        var startTriangle = document.createElementNS(svgns, 'polygon'), x;
        var y = settings.barMargin - 0.25, h = height + 1.5, tw = settings.barHeight * 3 / 4, teh = settings.barHeight / 4;
        x = itemLeft - 1 - settings.barHeight / 3;
        startTriangle.setAttribute('points', x + ',' + y + ' ' + x + ',' + (y + h) + ' ' + (x + tw / 2) + ',' + (y + h + teh) + ' ' + (x + tw) + ',' + (y + h) + ' ' + (x + tw) + ',' + y);
        if (typeof barClass !== undefinedType)
            startTriangle.setAttribute('class', barClass);
        if (typeof barStyle !== undefinedType)
            startTriangle.setAttribute('style', barStyle);
        group.appendChild(startTriangle);
        var endTriangle = document.createElementNS(svgns, 'polygon');
        x = itemRight + settings.barHeight / 3;
        endTriangle.setAttribute('points', x + ',' + y + ' ' + x + ',' + (y + h) + ' ' + (x - tw / 2) + ',' + (y + h + teh) + ' ' + (x - tw) + ',' + (y + h) + ' ' + (x - tw) + ',' + y);
        if (typeof barClass !== undefinedType)
            endTriangle.setAttribute('class', barClass);
        if (typeof barStyle !== undefinedType)
            endTriangle.setAttribute('style', barStyle);
        group.appendChild(endTriangle);
        if (!settings.isReadOnly && !settings.isChartReadOnly && (typeof item.isReadOnly === undefinedType || !item.isReadOnly) && (typeof item.isBarReadOnly === undefinedType || !item.isBarReadOnly)) {
            if (settings.areTaskDependenciesVisible && !settings.areTaskPredecessorsReadOnly && !item.isPart) {
                var startDependencyThumb = null;
                if (typeof settings.allowCreatingStartDependencies === undefinedType || settings.allowCreatingStartDependencies) {
                    startDependencyThumb = document.createElementNS(svgns, 'circle');
                    startDependencyThumb.setAttribute('cx', itemLeft - 0.5);
                    startDependencyThumb.setAttribute('cy', settings.barMargin + settings.barHeight / 2);
                    startDependencyThumb.setAttribute('r', settings.barHeight / 4);
                    startDependencyThumb.setAttribute('style', 'fill: White; fill-opacity: 0; cursor: pointer');
                    group.appendChild(startDependencyThumb);
                }
                var dependencyThumb = document.createElementNS(svgns, 'circle');
                dependencyThumb.setAttribute('cx', itemRight - 0.5);
                dependencyThumb.setAttribute('cy', settings.barMargin + settings.barHeight / 2);
                dependencyThumb.setAttribute('r', 2.5);
                dependencyThumb.setAttribute('style', 'fill: White; fill-opacity: 0; cursor: pointer');
                group.appendChild(dependencyThumb);
                ganttChartView.initializeDependencyDraggingThumbs(dependencyThumb, startDependencyThumb, group, item, settings.barMargin + settings.barHeight / 2, itemRight - 1.5, itemLeft);
            }
        }
        return group;
    };
    settings.milestoneTaskTemplate = function (item) {
        var ganttChartView = item.ganttChartView;
        var settings = ganttChartView.settings;
        var items = ganttChartView.items;
        var document = ganttChartView.ownerDocument;
        var group = getChartItemArea(item);
        if (settings.isBaselineVisible && typeof item.baselineStart !== undefinedType) {
            var itemBaselineLeft = ganttChartView.getChartPosition(item.baselineStart);
            var baselineStartDiamond = document.createElementNS(svgns, 'polygon');
            var xb = itemBaselineLeft, yb = settings.barMargin - 1, hb = settings.barHeight + 1;
            baselineStartDiamond.setAttribute('points', xb + ',' + yb + ' ' + (xb - hb / 2) + ',' + (yb + hb / 2) + ' ' + xb + ',' + (yb + hb) + ' ' + (xb + hb / 2) + ',' + (yb + hb / 2));
            var baselineBarClass = settings.baselineBarClass;
            if (typeof item.baselineBarClass !== undefinedType)
                baselineBarClass = item.baselineBarClass;
            if (typeof baselineBarClass !== undefinedType)
                baselineStartDiamond.setAttribute('class', baselineBarClass);
            else {
                var baselineBarStyle = settings.baselineBarStyle;
                if (typeof item.baselineBarStyle !== undefinedType)
                    baselineBarStyle = item.baselineBarStyle;
            }
            baselineStartDiamond.setAttribute('style', baselineBarStyle);
            group.appendChild(baselineStartDiamond);
        }
        var itemLeft = ganttChartView.getChartPosition(item.start);
        var startDiamond = document.createElementNS(svgns, 'polygon');
        var x = itemLeft - 1, y = settings.barMargin, h = settings.barHeight + 1;
        startDiamond.setAttribute('points', x + ',' + y + ' ' + (x - h / 2) + ',' + (y + h / 2) + ' ' + x + ',' + (y + h) + ' ' + (x + h / 2) + ',' + (y + h / 2));
        var barClass = settings.milestoneBarClass;
        if (typeof item.milestoneBarClass !== undefinedType)
            barClass = item.milestoneBarClass;
        if (typeof item.barClass !== undefinedType)
            barClass = item.barClass;
        if (typeof barClass !== undefinedType)
            startDiamond.setAttribute('class', barClass);
        else {
            var barStyle = settings.milestoneBarStyle;
            if (typeof item.milestoneBarStyle !== undefinedType)
                barStyle = item.milestoneBarStyle;
            if (typeof item.barStyle !== undefinedType)
                barStyle = item.barStyle;
            if (typeof barStyle !== undefinedType)
                startDiamond.setAttribute('style', barStyle);
        }
        group.appendChild(startDiamond);
        if (!settings.isReadOnly && !settings.isChartReadOnly && (typeof item.isReadOnly === undefinedType || !item.isReadOnly) && (typeof item.isBarReadOnly === undefinedType || !item.isBarReadOnly)) {
            var thumb = document.createElementNS(svgns, 'rect');
            thumb.setAttribute('x', x - h / 2);
            thumb.setAttribute('y', settings.barMargin);
            thumb.setAttribute('width', h);
            thumb.setAttribute('height', h);
            thumb.setAttribute('style', 'fill: White; fill-opacity: 0; cursor: move');
            group.appendChild(thumb);
            ganttChartView.initializeTaskDraggingThumbs(thumb, null, null, null, item, x, x, x);
            if (settings.areTaskDependenciesVisible && !settings.areTaskPredecessorsReadOnly && !item.isPart) {
                var dependencyThumb = document.createElementNS(svgns, 'circle');
                dependencyThumb.setAttribute('cx', x);
                dependencyThumb.setAttribute('cy', settings.barMargin + settings.barHeight / 2);
                dependencyThumb.setAttribute('r', settings.barHeight / 4);
                dependencyThumb.setAttribute('style', 'fill: White; fill-opacity: 0; cursor: pointer');
                group.appendChild(dependencyThumb);
                ganttChartView.initializeDependencyDraggingThumbs(dependencyThumb, null, group, item, settings.barMargin + settings.barHeight / 2, x, x);
            }
        }
        return group;
    };
    settings.dependencyLineTemplate = function (item, predecessorItem) {
        var ganttChartView = item.ganttChartView;
        var settings = ganttChartView.settings;
        var items = ganttChartView.items;
        var document = ganttChartView.ownerDocument;
        function getDependencyLinePathData(item, predecessorItem) {
            var y = ganttChartView.getItemTop(predecessorItem.item);
            var y1 = ganttChartView.getItemTop(item);
            var d = 'M ', x, x1, x2, y, h = settings.itemHeight, h2 = h / 2, extraLineLength = h / 3.5, arrowSpace = 3.5, horizontal = false, x0;
            if (y == y1 && (typeof predecessorItem.dependencyType === undefinedType || predecessorItem.dependencyType == 'FinishStart' || predecessorItem.dependencyType == 'FS' || predecessorItem.dependencyType == 'StartFinish' || predecessorItem.dependencyType == 'SF')) {
                if (typeof predecessorItem.dependencyType === undefinedType || predecessorItem.dependencyType == 'FinishStart' || predecessorItem.dependencyType == 'FS') {
                    x = ganttChartView.getChartPosition(predecessorItem.item.finish);
                    x1 = ganttChartView.getChartPosition(item.start);
                }
                else {
                    x = ganttChartView.getChartPosition(predecessorItem.item.start);
                    x1 = ganttChartView.getChartPosition(item.finish);
                }
                y = y - y1 + 0.5;
                d += x + ' ' + (y + h2) + ' L ' + (x1 + (x1 > x ? -1 : +1) * (h / 5 - 1)) + ' ' + (y + h2);
            }
            else {
                if (typeof predecessorItem.dependencyType !== undefinedType && (predecessorItem.dependencyType == 'StartStart' || predecessorItem.dependencyType == 'SS' || predecessorItem.dependencyType == 'StartFinish' || predecessorItem.dependencyType == 'SF')) {
                    x = ganttChartView.getChartPosition(predecessorItem.item.start);
                    if ((predecessorItem.item.hasChildren && (typeof predecessorItem.item.isSummaryEnabled === undefinedType || predecessorItem.item.isSummaryEnabled)))
                        x -= h / 5 + 0.25;
                    else if (predecessorItem.item.isMilestone)
                        x -= h / 4;
                    x1 = x - extraLineLength;
                }
                else {
                    x = ganttChartView.getChartPosition(predecessorItem.item.finish) - 1;
                    if (predecessorItem.item.hasChildren && (typeof predecessorItem.item.isSummaryEnabled === undefinedType || predecessorItem.item.isSummaryEnabled))
                        x += h / 5 + 0.25;
                    else if (predecessorItem.item.isMilestone)
                        x += h / 4;
                    else {
                        x0 = ganttChartView.getChartPosition(predecessorItem.item.start) + 4 - 1;
                        if (x < x0)
                            x = x0;
                    }
                    x1 = x + extraLineLength;
                }
                y = y - y1;
                d += x + ' ' + (y + h2) + ' L ' + x1 + ' ' + (y + h2);
                if (typeof predecessorItem.dependencyType !== undefinedType && (predecessorItem.dependencyType == 'FinishFinish' || predecessorItem.dependencyType == 'FF' || predecessorItem.dependencyType == 'StartFinish' || predecessorItem.dependencyType == 'SF')) {
                    x = ganttChartView.getChartPosition(item.finish) - 1;
                    if (typeof predecessorItem.dependencyType !== undefinedType && (predecessorItem.dependencyType == 'FinishFinish' || predecessorItem.dependencyType == 'FF')) {
                        horizontal = true;
                        if (item.hasChildren && (typeof item.isSummaryEnabled === undefinedType || item.isSummaryEnabled))
                            x += h / 5 + 1;
                        else if (item.isMilestone)
                            x += h / 4 + 1;
                        else {
                            x0 = ganttChartView.getChartPosition(item.start) + 4 - 1;
                            if (x < x0)
                                x = x0;
                        }
                        x2 = x + extraLineLength;
                    }
                    else {
                        if (item.isMilestone)
                            x2 = x;
                        else {
                            x0 = ganttChartView.getChartPosition(item.start) + 4;
                            if (x < x0)
                                x = x0;
                            x2 = x - 2.5;
                        }
                    }
                }
                else {
                    x = ganttChartView.getChartPosition(item.start);
                    if (typeof predecessorItem.dependencyType !== undefinedType && (predecessorItem.dependencyType == 'StartStart' || predecessorItem.dependencyType == 'SS')) {
                        horizontal = true;
                        if (item.hasChildren && (typeof item.isSummaryEnabled === undefinedType || item.isSummaryEnabled))
                            x -= h / 5 + 1;
                        else if (item.isMilestone)
                            x -= h / 4 + 1;
                        x2 = x - extraLineLength;
                    }
                    else {
                        if (item.isMilestone)
                            x2 = x - 1;
                        else {
                            x2 = x + 1.5;
                            var xf = ganttChartView.getChartPosition(item.finish);
                            if (x2 < x1 && xf - x1 > extraLineLength * 2 && item.start >= predecessorItem.item.finish)
                                x2 = x1;
                        }
                    }
                }
                if (typeof predecessorItem.dependencyType !== undefinedType && (predecessorItem.dependencyType == 'StartStart' || predecessorItem.dependencyType == 'SS' || predecessorItem.dependencyType == 'StartFinish' || predecessorItem.dependencyType == 'SF')) {
                    if (x2 > x1) {
                        y -= extraLineLength / 6;
                        if (y <= 0)
                            y += h2;
                        else
                            y -= h2 - 2.5;
                        d += ' ' + x1 + ' ' + (y + h2);
                    }
                    d += ' ' + x2 + ' ' + (y + h2);
                }
                else {
                    if (x2 < x1) {
                        y -= extraLineLength / 6;
                        if (y <= 0)
                            y += h2;
                        else
                            y -= h2 - 2.5;
                        d += ' ' + x1 + ' ' + (y + h2);
                    }
                    d += ' ' + x2 + ' ' + (y + h2);
                }
                if (horizontal)
                    y = h2 + 0.5;
                else if (y <= 0)
                    y = h / 4 - (!item.isMilestone && !item.hasChildren ? barMargin : 1) - arrowSpace;
                else
                    y = h - h / 4 + (!item.isMilestone && !item.hasChildren ? barMargin : 1) + arrowSpace;
                if (horizontal) {
                    if (x2 > x - arrowSpace)
                        arrowSpace = -arrowSpace;
                    x -= arrowSpace;
                }
                d += ' ' + x2 + ' ' + y;
                if (horizontal)
                    d += ' ' + x + ' ' + y;
            }
            return d;
        }
        var group = document.createElementNS(svgns, 'g');
        var data = getDependencyLinePathData(item, predecessorItem);
        var polylineZone = document.createElementNS(svgns, 'path');
        polylineZone.setAttribute('d', data);
        if (typeof settings.dependencyLineZoneClass !== undefinedType)
            polylineZone.setAttribute('class', settings.dependencyLineZoneClass);
        if (typeof settings.dependencyLineZoneStyle !== undefinedType)
            polylineZone.setAttribute('style', settings.dependencyLineZoneStyle);
        group.appendChild(polylineZone);
        var polyline = document.createElementNS(svgns, 'path');
        polyline.setAttribute('d', data);
        var polylineClass = settings.dependencyLineClass;
        if (typeof predecessorItem.dependencyLineClass !== undefinedType)
            polylineClass = predecessorItem.dependencyLineClass;
        if (typeof polylineClass !== undefinedType)
            polyline.setAttribute('class', polylineClass);
        else {
            var polylineStyle = settings.dependencyLineStyle;
            if (typeof predecessorItem.dependencyLineStyle !== undefinedType)
                polylineStyle = predecessorItem.dependencyLineStyle;
            if (typeof polylineStyle !== undefinedType)
                polyline.setAttribute('style', polylineStyle);
        }
        group.appendChild(polyline);
        return group;
    };
    settings.assignmentsTemplate = function (item) {
        var ganttChartView = item.ganttChartView;
        var settings = ganttChartView.settings;
        var document = ganttChartView.ownerDocument;
        var text = document.createElementNS(svgns, 'text');
        var itemRight = ganttChartView.getChartPosition(item.finish);
        if (item.isMilestone || (item.hasChildren && (typeof item.isSummaryEnabled === undefinedType || item.isSummaryEnabled)))
            itemRight += settings.barHeight / 2;
        text.setAttribute('x', itemRight + 7);
        text.setAttribute('y', settings.barMargin + settings.barHeight - 1);
        var isPhone = settings.target == 'Phone';
        var content = !isPhone ? item.assignmentsContent : item.content;
        if (typeof content === undefinedType)
            content = '';
        text.appendChild(document.createTextNode(content));
        if (typeof settings.assignmentsClass !== undefinedType)
            text.setAttribute('class', settings.assignmentsClass);
        else if (typeof settings.assignmentsStyle !== undefinedType)
            text.setAttribute('style', settings.assignmentsStyle);
        return text;
    };
    settings.itemTemplate = function (item) {
        var ganttChartView = item.ganttChartView;
        var document = item.ganttChartView.ownerDocument;
        var toolTip = document.createElementNS(svgns, 'title');
        toolTip.appendChild(getTextNode(document, item.content));
        if (typeof settings.areToolTipsSimplified === undefinedType || !settings.areToolTipsSimplified) {
            toolTip.appendChild(document.createTextNode('  '));
            if (typeof item.loadChartView === undefinedType) {
                if (typeof item.scheduleChartView === undefinedType && item.parent) {
                    toolTip.appendChild(document.createElement('br'));
                    toolTip.appendChild(document.createTextNode('Parent: ' + item.parent.content + '  '));
                }
                if (typeof item.scheduleChartView !== undefinedType && item.scheduleChartItem) {
                    toolTip.appendChild(document.createElement('br'));
                    toolTip.appendChild(document.createTextNode('Row: ' + item.scheduleChartItem.content + '  '));
                }
                if (item.hasChildren) {
                    toolTip.appendChild(document.createElement('br'));
                    toolTip.appendChild(document.createTextNode('Children: ' + item.children.length + '  '));
                }
                toolTip.appendChild(document.createElement('br'));
                toolTip.appendChild(document.createTextNode((!item.isMilestone ? 'Start: ' : '') + settings.dateTimeFormatter(ganttChartView.getOutputDate(item.start)) + '  '));
                if (!item.isMilestone) {
                    toolTip.appendChild(document.createElement('br'));
                    toolTip.appendChild(document.createTextNode('Finish: ' + settings.dateTimeFormatter(ganttChartView.getOutputDate(item.finish)) + '  '));
                }
                if (settings.areTaskAssignmentsVisible && item.assignmentsContent) {
                    toolTip.appendChild(document.createElement('br'));
                    toolTip.appendChild(document.createTextNode('Assignments: ' + item.assignmentsContent + '  '));
                }
                if (!item.isMilestone) {
                    toolTip.appendChild(document.createElement('br'));
                    toolTip.appendChild(document.createTextNode('Effort: ' + (ganttChartView.getItemTotalEffort(item) / hourDuration) + 'h' + '  '));
                    if (settings.isTaskCompletedEffortVisible) {
                        var completion = ganttChartView.getItemCompletion(item);
                        if (!isNaN(completion)) {
                            toolTip.appendChild(document.createElement('br'));
                            toolTip.appendChild(document.createTextNode('Completed: ' + (Math.round(completion * 100 * 100) / 100) + '%' + '  '));
                        }
                    }
                }
                if (settings.areTaskDependenciesVisible && item.predecessors && item.predecessors.length > 0) {
                    toolTip.appendChild(document.createElement('br'));
                    var predecessorsString = '';
                    for (var i = 0; i < item.predecessors.length; i++) {
                        var predecessor = item.predecessors[i];
                        if (!predecessor.item)
                            continue;
                        if (predecessorsString.length > 0)
                            predecessorsString += ', ';
                        predecessorsString += predecessor.item.content;
                        if (predecessor.dependencyType)
                            predecessorsString += ' (' + getDependencyTypeString(predecessor.dependencyType) + ')';
                    }
                    toolTip.appendChild(document.createTextNode('Predecessors: ' + predecessorsString + '  '));
                }
            }
            else if (!isNaN(item.units)) {
                toolTip.appendChild(document.createElement('br'));
                toolTip.appendChild(document.createTextNode('Allocation: ' + (Math.round(item.units * 100 * 100) / 100) + '%  '));
            }
        }
        return toolTip;
    };
    settings.predecessorItemTemplate = function (item, predecessorItem) {
        var document = item.ganttChartView.ownerDocument;
        var toolTip = document.createElementNS(svgns, 'title');
        toolTip.appendChild(getTextNode(document, predecessorItem.item.content + ' - ' + item.content));
        if (typeof settings.areToolTipsSimplified === undefinedType || !settings.areToolTipsSimplified) {
            toolTip.appendChild(document.createTextNode('  '));
            if (predecessorItem.dependencyType) {
                toolTip.appendChild(document.createElement('br'));
                toolTip.appendChild(getTextNode(document, 'Type: ' + getDependencyTypeString(predecessorItem.dependencyType) + '  '));
            }
            if (predecessorItem.lag) {
                toolTip.appendChild(document.createElement('br'));
                toolTip.appendChild(getTextNode(document, 'Lag: ' + (predecessorItem.lag / hourDuration) + 'h' + '  '));
            }
        }
        return toolTip;
    };
}
function initializePertChartTemplates(settings, theme) {
    if (theme == 'Default')
        return;
    // Common helpers.
    var svgns = 'http://www.w3.org/2000/svg';
    // Template definitions.
    settings.styleDefinitionTemplate = function () {
        var defs = document.createElementNS(svgns, 'defs');
        var arrowMarker = document.createElementNS(svgns, 'marker');
        arrowMarker.setAttribute('id', 'PertArrowMarker');
        arrowMarker.setAttribute("viewBox", "0 0 10 10");
        arrowMarker.setAttribute("refX", "0");
        arrowMarker.setAttribute("refY", "5");
        arrowMarker.setAttribute("markerUnits", "strokeWidth");
        arrowMarker.setAttribute("markerWidth", "5");
        arrowMarker.setAttribute("markerHeight", "4");
        arrowMarker.setAttribute("orient", "auto");
        var arrowPath = document.createElementNS(svgns, "path");
        arrowPath.setAttribute("fill", settings.arrowFill ? settings.arrowFill : '#3b87d9');
        arrowPath.setAttribute("d", "M 0 0 L 10 5 L 0 10 z");
        arrowMarker.appendChild(arrowPath);
        defs.appendChild(arrowMarker);
        return defs;
    };
}
;
// Supported themes: Default, Generic-bright, Generic-blue, DlhSoft-gray, Purple-green, Steel-blue, Dark-black, Cyan-green, Blue-navy, Orange-brown, Teal-green, Purple-beige, Gray-blue, Aero.
function initializeGanttChartTheme(settings, theme) {
    if (theme == 'Default')
        return;
    if (theme == 'Aero') {
        settings.theme = 'Aero';
        return;
    }
    settings.headerHeight = 31 * 2; // 2 scale rows
    settings.itemHeight = 28;
    settings.barCornerRadius = 1;
    settings.completedBarCornerRadius = 1;
    settings.arrowSize = 2;
    settings.hourWidth = 5;
    switch (theme) {
        case 'Generic-bright':
            settings.headerBackground = 'white';
            settings.mainStroke = '#005c9e';
            settings.mainFill = 'white';
            settings.accentFill = '#005c9e';
            settings.diamondFill = '#e31d3b';
            settings.diamondStroke = '#005c9e';
            break;
        case 'Generic-blue':
            settings.headerBackground = 'white';
            break;
        case 'Purple-green':
            settings.headerBackground = '#dddfd4';
            settings.mainStroke = '#005173';
            settings.mainFill = '#a0729d';
            settings.accentFill = '#91bc0e';
            break;
        case 'Blue-navy':
            settings.headerBackground = '#eeeeee';
            settings.selectedGridBackground = '#e8e8e8';
            settings.mainStroke = '#6534ff';
            settings.mainFill = '#369bf9';
            settings.accentFill = '#227fd5';
            settings.alternativeGridBackground = '#f9f9f9';
            break;
        case 'Orange-brown':
            settings.headerBackground = '#eeeeee';
            settings.selectedGridBackground = '#e8e8e8';
            settings.mainStroke = '#6534ff';
            settings.mainFill = '#ffbf5a';
            settings.accentFill = '#d5a05a';
            settings.diamondFill = '#a91923';
            settings.diamondStroke = '#222222';
            settings.alternativeBackground = '#f9f9f9';
            break;
        case 'Teal-green':
            settings.headerBackground = '#eeeeee';
            settings.mainStroke = '#6534ff';
            settings.mainFill = '#5ebcbb';
            settings.accentFill = '#3294a1';
            settings.diamondFill = '#4c7f3d';
            settings.diamondStroke = '#222222';
            break;
        case 'Steel-blue':
            settings.border = '#aaaaaa';
            settings.headerBackground = '#4b5d6b';
            settings.headerForeground = 'white';
            settings.headerBorder = '#aaaaaa';
            settings.containerBackground = '#a5b5c2';
            settings.chartBackground = '#bfcfda';
            settings.gridForeground = 'gray';
            settings.toggleFill = 'gray';
            settings.selectedGridForeground = '#4b5d6b';
            settings.selectedGridBackground = '#95a5b2';
            settings.nonworkingBackground = '#95a5b2';
            settings.mainStroke = '#6534ff';
            settings.mainFill = '#6699cc';
            settings.accentFill = '#4c7f3d';
            settings.diamondFill = '#4b5d6b';
            settings.diamondStroke = '#222222';
            break;
        case 'Cyan-green':
            settings.headerBackground = '#dddddd';
            settings.mainStroke = '#6534ff';
            settings.mainFill = '#1fb5ce';
            settings.accentFill = '#1fce43';
            settings.diamondFill = '#d6485b';
            settings.diamondStroke = '#222222';
            break;
        case 'Purple-beige':
            settings.selectedGridBackground = '#bfb8a4';
            settings.mainStroke = '#005c9e';
            settings.mainFill = '#a68b99';
            settings.accentFill = '#bfb8a4';
            settings.diamondFill = '#bfb8a4';
            settings.diamondStroke = '#005c9e';
            settings.alternativeGridBackground = '#f0eeeb';
            settings.alternativeChartBackground = '#f9f9f9';
            break;
        case 'Dark-black':
            settings.containerClass = 'dark'; // CSS class for dynamically generated elements, e.g. input (app.css)
            settings.border = '#222222';
            settings.headerBackground = '#111111';
            settings.headerForeground = '#eeeeee';
            settings.headerBorder = '#222222';
            settings.containerBackground = '#222222';
            settings.gridForeground = '#dddddd';
            settings.chartForeground = '#dddddd';
            settings.scaleSeparatorBorder = '#505050';
            settings.toggleFill = '#808080';
            settings.toggleHoveringFill = 'white';
            settings.selectedGridForeground = 'white';
            settings.selectedGridBackground = '#404040';
            settings.nonworkingBackground = '#333333';
            settings.mainStroke = 'gray';
            settings.accentFill = '#ffbb00';
            settings.summaryFill = '#505050';
            settings.diamondFill = '#ffbb00';
            settings.currentTimeStroke = '#289451';
            break;
        case 'Gray-blue':
            settings.headerBackground = 'white';
            settings.containerBackground = '#f0f0f0';
            settings.selectedGridBackground = 'white';
            settings.mainStroke = '#005c9e';
            settings.mainFill = 'white';
            settings.accentFill = '#0087be';
            settings.diamondFill = '#607080';
            settings.diamondStroke = '#005c9e';
            break;
        case 'DlhSoft-gray':
            settings.border = '#aaaaaa';
            settings.headerBackground = '#e31d3b';
            settings.headerForeground = 'white';
            settings.headerBorder = 'transparent';
            settings.selectedGridBackground = '#e8e8e8';
            settings.mainStroke = '#666';
            settings.mainFill = '#f0f0f0';
            settings.accentFill = '#ad927f';
            settings.summaryFill = '#666';
            settings.diamondFill = '#82a0b3';
            settings.diamondStroke = '#666';
            settings.alternativeGridBackground = '#f8f8f8';
            settings.currentTimeStroke = '#82a0b3';
            break;
    }
    if (settings.containerBackground)
        settings.containerStyle = 'background-color: ' + settings.containerBackground;
    if (settings.headerForeground)
        settings.columnHeaderStyle = 'color: ' + settings.headerForeground;
    if (settings.gridForeground) {
        settings.itemStyle = 'color: ' + settings.gridForeground + (settings.gridBackground ? '; background-color: ' + settings.gridBackground : '');
        if (settings.selectedGridForeground)
            settings.selectedItemStyle = 'color: ' + settings.selectedGridForeground + '; background-color: ' + (settings.selectedGridBackground ? settings.selectedGridBackground : settings.gridForeground);
    }
    else {
        if (settings.selectedGridForeground || settings.selectedGridBackground)
            settings.selectedItemStyle = 'color: ' + (settings.selectedGridForeground ? settings.selectedGridForeground : 'black') + '; background-color: ' + (settings.selectedGridBackground ? settings.selectedGridBackground : '#f0f0f0');
    }
    if (settings.toggleFill)
        settings.toggleButtonStyle = 'fill: ' + settings.toggleFill;
    if (settings.toggleHoveringFill)
        settings.toggleButtonHoveringStyle = 'fill: ' + settings.toggleHoveringFill;
    settings.scales = [{ scaleType: 'NonworkingTime', isHeaderVisible: false, isHighlightingVisible: true, highlightingStyle: 'stroke-width: 0; fill: ' + (settings.nonworkingBackground ? settings.nonworkingBackground : '#f8f8f8') + '; fill-opacity: 0.65' },
                       { scaleType: 'Weeks', headerTextFormat: 'Date', headerStyle: 'padding: 7px 5px; border-right: 1px solid ' + (settings.headerBorder ? settings.headerBorder : '#e8e8e8') + '; border-bottom: 1px solid ' + (settings.headerBorder ? settings.headerBorder : '#e8e8e8') + (settings.headerForeground ? '; color: ' + settings.headerForeground : ''), isSeparatorVisible: true, separatorStyle: 'stroke: ' + (settings.scaleSeparatorBorder ? settings.scaleSeparatorBorder : '#c8bfe7') + '; stroke-width: 0.5px' },
                       { scaleType: 'Days', headerTextFormat: 'DayOfWeekAbbreviation', headerStyle: 'padding: 7px 5px; border-right: 1px solid ' + (settings.headerBorder ? settings.headerBorder : '#e8e8e8') + (settings.headerForeground ? '; color: ' + settings.headerForeground : '') },
                       { scaleType: 'CurrentTime', isHeaderVisible: false, isSeparatorVisible: true, separatorStyle: 'stroke: ' + (settings.currentTimeStroke ? settings.currentTimeStroke : '#e31d3b') + '; stroke-width: 0.5px' }];
    if (settings.chartBackground)
        settings.scales.splice(0, 0, { scaleType: 'Custom', isHeaderVisible: false, intervals: [{ start: new Date(1, 0, 1), finish: new Date(10000, 11, 31, 23, 59, 59, 999) }], isHighlightingVisible: true, highlightingStyle: 'fill: ' + settings.chartBackground });
    if (settings.mainFill) {
        settings.standardBarStyle = 'stroke: ' + (settings.mainStroke ? settings.mainStroke : settings.mainFill) + '; fill: ' + settings.mainFill;
        settings.collapsedSummaryLineStyle = 'stroke: ' + (settings.mainStroke ? settings.mainStroke : settings.mainFill) + '; stroke-width: 0.65px; stroke-dasharray: 2 2';
    }
    if (settings.accentFill)
        settings.standardCompletedBarStyle = 'stroke: ' + settings.accentFill + '; fill: ' + settings.accentFill;
    if (settings.summaryFill)
        settings.summaryBarStyle = 'stroke: ' + (settings.summaryStroke ? settings.summaryStroke : settings.summaryFill) + '; fill: ' + settings.summaryFill;
    if (settings.diamondFill)
        settings.milestoneBarStyle = 'stroke: ' + (settings.diamondStroke ? settings.diamondStroke : settings.diamondFill) + '; fill: ' + settings.diamondFill;
    if (settings.mainStroke) {
        settings.baselineBarStyle = 'fill: none; stroke: ' + settings.mainStroke + '; stroke-width: 0.65px; stroke-dasharray: 2, 2';
        settings.arrowFill = settings.mainStroke;
        settings.dependencyLineStyle = 'stroke: ' + settings.arrowFill + '; stroke-width: 0.65px; fill: none; marker-end: url(#ArrowMarker)';
    }
    if (settings.chartForeground)
        settings.assignmentsStyle = 'font-size: x-small; fill: ' + settings.chartForeground;
    if (settings.alternativeBackground) {
        settings.alternativeGridBackground = settings.alternativeBackground;
        settings.alternativeChartBackground = settings.alternativeBackground;
    }
    if (settings.alternativeGridBackground)
        settings.alternativeItemStyle = 'background-color: ' + settings.alternativeGridBackground;
    if (settings.alternativeChartBackground)
        settings.alternativeChartItemStyle = 'fill: ' + settings.alternativeChartBackground;
}
function initializeLoadChartTheme(settings, theme) {
    initializeGanttChartTheme(settings, theme);
    if (theme == 'Default')
        return;
    settings.barHeight = 20;
    settings.allocationFill = settings.mainFill ? (settings.mainFill != 'white' ? settings.mainFill : settings.mainStroke) : '#8abbed';
    settings.allocationFill = "#3D89D4";
    settings.allocationFill = "#3D89D4";
    settings.normalAllocationBarStyle = settings.underAllocationBarStyle = 'stroke: ' + settings.allocationFill + '; fill: ' + settings.allocationFill;
    settings.overAllocationBarStyle = 'stroke: #e31d3b; fill: #e31d3b';
}
function initializePertChartTheme(settings, theme) {
    if (theme == 'Default')
        return;
    settings.shapeStyle = 'fill: White; stroke: #606060; stroke-width: 1px';
    settings.milestoneStyle = 'fill: White; stroke: #606060; stroke-width: 1px';
    settings.dependencyLineStyle = 'stroke: #8abbed; stroke-width: 0.65px; fill: none; marker-end: url(#PertArrowMarker)';
    settings.virtualEffortDependencyLineStyle = 'stroke: #8abbed; stroke-width: 0.65px; stroke-dasharray: 2, 2; fill: none; marker-end: url(#PertArrowMarker)';
}
;
DlhSoft.Licensing.setLicense("DlhSoft.Controls.GanttChartView", "RevZone Solutions:F1FF6296:7838EDE0:1586638800000:5E503D95");
DlhSoft.Licensing.setLicense("DlhSoft.Controls.ScheduleChartView", "RevZone Solutions:F1FF6296:7838EDE0:1586638800000:17438B2DA");
DlhSoft.Licensing.setLicense("DlhSoft.Controls.LoadChartView", "RevZone Solutions:F1FF6296:7838EDE0:1586638800000:778E80B7");
DlhSoft.Licensing.setLicense("DlhSoft.Controls.Calendar", "RevZone Solutions:F1FF6296:7838EDE0:1586638800000:11227D05C");
DlhSoft.Licensing.setLicense("DlhSoft.Controls.DatePicker", "RevZone Solutions:F1FF6296:7838EDE0:1586638800000:1270C633E");
DlhSoft.Licensing.setLicense("DlhSoft.Controls.TimePicker", "RevZone Solutions:F1FF6296:7838EDE0:1586638800000:1177A135F");
DlhSoft.Licensing.setLicense("DlhSoft.Controls.MultiSelectorComboBox", "RevZone Solutions:F1FF6296:7838EDE0:1586638800000:13EA80CF1");
DlhSoft.Licensing.setLicense("DlhSoft.Controls.Pert.PertChartView", "RevZone Solutions:F1FF6296:7838EDE0:1586638800000:3694C87B");
DlhSoft.Licensing.setLicense("DlhSoft.Controls.Pert.NetworkDiagramView", "RevZone Solutions:F1FF6296:7838EDE0:1586638800000:7809665B");
;

(function () {


    var planning = {};
    planning.selectedScheduleChartPlanning = false;
    planning.selectedLoadChartPlanning = false;
    planning.showProperties = true;
    planning.automaticScheduling = true;
    planning.NonWorkingDays = false;
    planning.isBaselineVisible = false;
    planning.IsResources = false;
    planning.zoomToSelection = false;
    planning.iscriticalPath = false;
    planning.isImportXml = false;
    planning.isPrint = false;
    planning.indexItemSaved = -1;
    planning.itemHasChanged = false;

    planning.projectOptions = [];
    actionToPerform = 0;

    planning.TabClickStageId = [];
    var date = new Date(), year = date.getFullYear(), month = date.getMonth();
    var queryString = window.location.search;
    var theme = "Aero";//queryString ? queryString.substr(1) : null;
    var standardBarStyle = "fill: #3D89D4; fill-opacity: 0.8; stroke: #3D89D4";
    var isWaitingToRefreshScheduleChartView, isWaitingToRefreshScheduleChartViewDisplayedTime, isWaitingToRefreshScheduleChartViewSplitterPosition,
        isWaitingToRefreshLoadChartView, isWaitingToRefreshLoadChartViewDisplayedTime, isWaitingToRefreshLoadChartViewSplitterPosition,
        isWaitingToRefreshGanttChartViewDisplayedTime, isWaitingToRefreshGanttChartViewSplitterPosition;

    var majorScaleTypeSelect = "Weeks";
    var majorScaleHeaderFormatSelect = "Date";
    var majorScaleSeparatorCheckBox = true;
    var minorScaleTypeSelect = "Days";
    var minorScaleHeaderFormatSelect = "Day";
    var minorScaleSeparatorCheckBox = true;
    var mondayBasedCheckBox = true;
    var currentTimeCheckBox = true;
    var zoomLevelTextBox = "5";
    var updateScaleSelect = "900000";

    var settings = {};
    var dayCalendars = [];
    // Duration preparations.
    var hourDuration = 60 * 60 * 1000, dayDuration = 24 * hourDuration, weekDuration = 7 * dayDuration, initialSundayDateValue = 3 * dayDuration;
    var defaultdayAddTimeline = 21;
    // Because we use a custom calendar that might have different working times for different days of week, we need to supplementary highlight 
    // the nonworking time at the start and end of such days of week using a custom highlighting scale that is initialized whenever the calendar 
    // is updated.
    var highlightingScale;
    // When start is updated with drag operations, finish will also be updated.
    // We record the last update time in this variable to avoid refreshing the item twice in these cases (under itemPropertyChangeHandler).
    var startUpdatedAt = new Date();

    var _InternalFunctions = {

        updateFromSelectedMajorScaleType: function () {
            switch (majorScaleTypeSelect) {
                case 'Years':
                    majorScaleHeaderFormatSelect = 'Year';
                    minorScaleTypeSelect = 'Months';
                    break;
                case 'Quarters':
                    majorScaleHeaderFormatSelect = 'Year';
                    minorScaleTypeSelect = 'Months';
                    break;
                case 'Months':
                    majorScaleHeaderFormatSelect = 'Month';
                    minorScaleTypeSelect = 'Weeks';
                    break;
                case 'Weeks':
                    majorScaleHeaderFormatSelect = 'Date';
                    minorScaleTypeSelect = 'Days';
                    break;
                case 'Days':
                    majorScaleHeaderFormatSelect = 'Day';
                    minorScaleTypeSelect = 'Hours';
                    break;
                case 'Hours':
                    majorScaleHeaderFormatSelect = 'Hour';
                    minorScaleTypeSelect = 'Days';
                    break;
            }
            _InternalFunctions.updateFromSelectedMinorScaleType();
        },
        updateFromSelectedMinorScaleType: function () {
            switch (minorScaleTypeSelect) {
                case 'Years':
                    minorScaleHeaderFormatSelect = 'Year';
                    zoomLevelTextBox = '0.5';
                    break;
                case 'Quarters':
                    minorScaleHeaderFormatSelect = 'Year';
                    zoomLevelTextBox = '0.5';
                    break;
                case 'Months':
                    minorScaleHeaderFormatSelect = 'MonthAbbreviation';
                    zoomLevelTextBox = '0.5';
                    break;
                case 'Weeks':
                    minorScaleHeaderFormatSelect = 'Day';
                    zoomLevelTextBox = '2';
                    break;
                case 'Days':
                    minorScaleHeaderFormatSelect = 'Day';
                    zoomLevelTextBox = '5';
                    break;
                case 'Hours':
                    minorScaleHeaderFormatSelect = 'Hour';
                    zoomLevelTextBox = '100';
                    break;
            }
            _InternalFunctions.initializeScales();
        },
        initializeScales: function () {
            var scales = [];
            if (planning.NonWorkingDays)
                scales.push({ scaleType: 'NonworkingTime', isHeaderVisible: false, isHighlightingVisible: true, highlightingStyle: 'stroke-width: 0; fill: ' + (theme == 'Dark-black' ? '#333333' : (theme == 'Steel-blue' ? '#95a5b2' : '#f8f8f8')) });
            scales.push({ scaleType: majorScaleTypeSelect, headerTextFormat: majorScaleHeaderFormatSelect, headerStyle: 'padding: 7px 5px; border-right: solid 1px White; border-bottom: solid 1px White; color: gray', isSeparatorVisible: majorScaleSeparatorCheckBox, separatorStyle: 'stroke: #c8bfe7; stroke-width: 1px' });
            scales.push({ scaleType: minorScaleTypeSelect, headerTextFormat: minorScaleHeaderFormatSelect, headerStyle: 'padding: 7px 5px; border-right: solid 1px White; border-bottom: solid 1px White; color: gray', isSeparatorVisible: minorScaleSeparatorCheckBox });//, separatorStyle: 'stroke: #c8bfe7; stroke-width: 0.25px'
            if (currentTimeCheckBox)
                scales.push({ scaleType: 'CurrentTime', isHeaderVisible: false, isSeparatorVisible: true, separatorStyle: 'stroke: Red; stroke-width: 0.5px' });
            window[Planning.getGanttChartId()].settings.scales = scales;
            window[Planning.getGanttChartId()].settings.updateScale = parseFloat(updateScaleSelect);
            window[Planning.getGanttChartId()].settings.weekStartDay = !mondayBasedCheckBox ? 0 : 1;
            var hourWidth = parseFloat(zoomLevelTextBox);
            if (hourWidth > 0)
                window[Planning.getGanttChartId()].settings.hourWidth = hourWidth;
            var timelineStart = _InternalFunctions.GetTimelineStart();
            var timelineFinish = _InternalFunctions.GetTimelineFinish();
            var displayedTime = _InternalFunctions.GetDisplayTime();
            window[Planning.getGanttChartId()].settings.timelineFinish = new Date(year + (majorScaleTypeSelect == 'Years' ? 2 : (minorScaleTypeSelect != 'Hours' ? 1 : 0)), month + (minorScaleTypeSelect != 'Hours' ? 0 : 1), 1);
            if (window[Planning.getGanttChartId()]) {
                window[Planning.getGanttChartId()].settings.timelineStart = DlhSoft.Controls.GanttChartView.getInputDate(timelineStart);
                window[Planning.getGanttChartId()].settings.timelineFinish = DlhSoft.Controls.GanttChartView.getInputDate(timelineFinish); // DlhSoft.Controls.GanttChartView.getInputDate(window[Planning.getGanttChartId()].settings.timelineFinish);
                window[Planning.getGanttChartId()].settings.displayedTime = DlhSoft.Controls.GanttChartView.getInputDate(displayedTime);
                window[Planning.getGanttChartId()].refresh();
            }
        },
        UpdateProgressFromTasks: function (action) {
            var items = [];
            if (action == 0) {
                items = window[Planning.getGanttChartId()].getSelectedItems();
            } else {
                items = window[Planning.getGanttChartId()].items;
            }
            if (items.length == 0) {
                Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                return;
            }
            var selectedItems = [];
            items.forEach(function (item, index) {
                if (!item.hasChildren)
                    selectedItems.push(item.key);
            });

            $.ajax({
                url: '/Projects/UpdateProgressFromTasks',
                type: "POST",
                dataType: "json",
                data: {
                    objectId: AppV.GetGlobals().ObjectId,
                    recordId: AppV.GetGlobals().RecordId,
                    recordGuid: AppV.GetGlobals().RecordGuid,
                    selectedItems: selectedItems,
                },
                success: function (response) {
                    var res = JSON.parse(response.data);
                    if (res.Success) {
                        Planning.ProjectsPlanningPerformCallback(true);
                        Notification.SetNotification(SwResourceObject.SavedSuccessfully, 'sucess', 3500);
                    }
                    else {
                        Notification.SetNotification(SwResourceObject.FailedToApplyChanges, 'warning', 3500);
                    }
                },
                error: function (response) {
                }
            });
        },
        updateItemProgressBar: function (action) {
            var items = window[Planning.getGanttChartId()].getSelectedItems();
            if (items.length == 0) {
                Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                return;
            }
            var koficent = 0;
            if (action === "0Percent" || action === "CtxPlanning0Percent") koficent = 0;
            if (action === "25Percent" || action === "CtxPlanning25Percent") koficent = 0.25;
            if (action === "50Percent" || action === "CtxPlanning50Percent") koficent = 0.5;
            if (action === "75Percent" || action === "CtxPlanning75Percent") koficent = 0.75;
            if (action === "100Percent" || action === "CtxPlanning100Percent") koficent = 1;
            items.forEach(function (element, index) {
                var hours = element.work * koficent;
                element.completedWorkNew = hours;
                Planning.updateItem(element);
                Planning.updateParents(element);
            });
            window[Planning.getGanttChartId()].refreshItems();
            Planning.refreshOtherViews();
        },
        EnableDisableContextMenuItems: function () {
            var recordStatus = AppV.GetPropertyTabsState().CheckStatus;
            var enable = !AppV.GetGlobals().isMainWindow;
            if (recordStatus === enums.RecordStatus.CheckedIn) {
                enable = false;
            }
            var itemsToHide = [
                "CtxPlanningMoveUp", "CtxPlanningMoveDown", "CtxPlanningIncreaseIndent", "CtxPlanningDecreaseIndent", "CtxPlanningSplitStage",
                "CtxPlanningRemoveStage", "CtxPlanningResetBaseline", "CtxPlanningUpdateProgressFromTasks", "CtxPlanningUpdateProgress", "CtxPlanningUpdateWorkHoursFromTasks",
                "CtxPlanningSetAsMilestone", "CtxPlanningScheduling", "CtxPlanningDelete"
            ];
            itemsToHide.forEach(function (value) {
                var itemContextMenu = CtxPlanning.GetItemByName(value);
                if (itemContextMenu !== undefined && itemContextMenu !== null) {
                    itemContextMenu.SetEnabled(enable);
                }
            });
        },
        SetCustomValueItemPlanning: function (item) {
            item.timesheetsAll = 0;
            item.timesheetsApproved = 0;
            item.tasksAll = 0;
            item.tasksCompleted = 0;
            item.resources = "";
            item.responsibleUser = "";
            item.indentation = 1;
            item.baselineStart = item.start;
            item.workBaseline = 8;
            item.completedWorkBaseline = 0;
            item.indentLevel = 0;
            item.iconIndex = 0;
            return item;
        },

        SetCustomValueItemPlanningImportXML: function (item) {
            item.timesheetsAll = 0;
            item.timesheetsApproved = 0;
            item.tasksAll = 0;
            item.tasksCompleted = 0;
            item.responsibleUser = "";
            item.baselineStart = item.start;
            item.workBaseline = 8;
            item.completedWorkBaseline = 0;
            item.indentLevel = 0;
            item.iconIndex = 0;
            return item;
        },

        GetItemToAddInsertPlanning: function () {
            var items = window[Planning.getGanttChartId()].items;
            var startToAdd = new Date(date.getFullYear(), date.getMonth(), (date.getDate() + 1));
            item = {
                content: '', start: startToAdd,
                timesheetsAll: 0, timesheetsApproved: 0, tasksAll: 0, tasksCompleted: 0, resources: "", responsibleUser: "", indentation: 1
            };
            if (items.length > 0) {
                var itemToAdd = window[Planning.getGanttChartId()].items[window[Planning.getGanttChartId()].items.length - 1];
                startToAdd = new Date(itemToAdd.finish.getFullYear(), itemToAdd.finish.getMonth(), (itemToAdd.finish.getDate() + 1));
            }
            item.start = startToAdd;
            item.work = 8;
            item.completedWorkNew = 0;
            item.finish = DlhSoft.Controls.GanttChartView.getFinish(item.start, _InternalFunctions.secondsToTime(item.work * 3600), window[Planning.getGanttChartId()].settings);
            item = _InternalFunctions.SetCustomValueItemPlanning(item);
            return item;
        },
        GetItemToSave: function (stageId, item) {
            var splits = "";
            var firstTime = false;
            if (typeof item.interruptions != "undefined") {
                item.interruptions.forEach(function (iteminterruption) {
                    if (!firstTime) {
                        splits += iteminterruption.offset + "-" + iteminterruption.duration;
                        firstTime = true;
                    } else {
                        splits += ";" + iteminterruption.offset + "-" + iteminterruption.duration;
                    }
                });
            };
            var ganntChartItem = {
                Key: stageId,
                Content: item.content,
                Indentation: item.indentation,
                IconIndex: item.iconIndex,
                Splits: splits,
                Work: parseFloat(item.work),//DlhSoft.Controls.GanttChartView.getTotalEffortColumnTemplate(64)(item).value,
                CompletedWork: parseFloat(item.completedWorkNew),
                Precdecessors: DlhSoft.Controls.GanttChartView.getPredecessorsColumnTemplate(84)(item).value,
                BaselineStart: DlhSoft.Controls.GanttChartView.getBaselineStartColumnTemplate(124, true, true, 8 * 60 * 60 * 1000)(item).value,
                WorkBaseLine: item.workBaseline,
                CompletedWorkBaseLine: item.completedWorkBaseline,
                Start: item.start,
                Finish: item.finish,
                OrderIndex: item.index,
                Resources: item.resources,
                StageType: item.stageType,
                IsAutoSchedule: item.areDependencyConstraintsEnabled
            };
            return ganntChartItem;
        },
        SaveAllPlanningItems: function (action, realaction = "") {
            var items = window[Planning.getGanttChartId()].items;
            if (items.length == 0) {
                Notification.SetNotification(SwResourceObject.FailedToSaveRecord, 'warning', 3500);
                return;
            }
            var ganntChartListItems = [];
            items.forEach(function (item, index) {
                var itemgantt = _InternalFunctions.GetItemToSave(item.key, item);
                var chartItem = JSON.stringify(itemgantt);
                ganntChartListItems.push(chartItem);
            });

            $.ajax({
                url: '/Projects/SaveAllPlanningItems',
                type: "POST",
                dataType: "json",
                data: {
                    objectId: AppV.GetGlobals().ObjectId,
                    recordId: AppV.GetGlobals().RecordId,
                    recordGuid: AppV.GetGlobals().RecordGuid,
                    action: action,
                    ganntChartItem: ganntChartListItems
                },
                success: function (response) {
                    var res = JSON.parse(response.data);
                    if (res.Success) {
                        planning.itemHasChanged = false;
                        if (realaction == "Outside") {
                            return;
                        }
                        Planning.ProjectsPlanningPerformCallback(true);
                        if (realaction == "Update")
                            Notification.SetNotification(SwResourceObject.SavedSuccessfully, 'sucess', 3500);
                    }
                    else {
                        Notification.SetNotification(SwResourceObject.FailedToApplyChanges, 'warning', 3500);
                    }
                },
                error: function (response) {
                }
            });
        },
        AddUpdateInsertItemPlanning: function (action, itemUpdate = null) {
            var item = window[Planning.getGanttChartId()].selectedItem;
            var stageId = -1;
            var splitOldItem = null;
            if (action === "Add") {
                item = window[Planning.getGanttChartId()].items[window[Planning.getGanttChartId()].items.length - 1];
            }
            else if (action == "Insert") {
                item = window[Planning.getGanttChartId()].items[window[Planning.getGanttChartId()].selectedItem.index - 1];
            }
            else if (action == "Update") {
                item = itemUpdate;
                stageId = item.key;
            }
            else if (action == "Split") {
                action = "Add";
                splitOldItem = item;
                item = itemUpdate;
                stageId = item.key;
            }
            if (item == null) {
                Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                return;
            }
            var ganntChartItem = _InternalFunctions.GetItemToSave(stageId, item);

            var chartItem = JSON.stringify(ganntChartItem);
            var ganntChartItemSplit = null;
            var chartItemSplit = null;
            if (splitOldItem !== null) {
                ganntChartItemSplit = _InternalFunctions.GetItemToSave(splitOldItem.key, splitOldItem);
                chartItemSplit = JSON.stringify(ganntChartItemSplit);
            }

            $.ajax({
                url: '/Projects/AddUpdateInsertItemPlanning',
                type: "POST",
                dataType: "json",
                data: {
                    objectId: AppV.GetGlobals().ObjectId,
                    recordId: AppV.GetGlobals().RecordId,
                    recordGuid: AppV.GetGlobals().RecordGuid,
                    action: action,
                    ganntChartItem: chartItem,
                    ganntChartItemSplit: chartItemSplit
                },
                success: function (response) {
                    var res = JSON.parse(response.data);
                    if (res.Success) {
                        _InternalFunctions.SaveAllPlanningItems("Update", action);
                        // Planning.ProjectsPlanningPerformCallback(true);
                        planning.indexItemSaved = item.index;
                    }
                    else {
                        Notification.SetNotification(SwResourceObject.FailedToApplyChanges, 'warning', 3500);
                        planning.indexItemSaved = -1;
                    }
                },
                error: function (response) {
                }
            });
        },
        GetTimeTotalMilliseconds: function (time, isDay) {
            var n = time.toString();
            var hasMin = n.includes(".");
            var hour = time;
            var min = 0;
            var sec = 0;
            if (hasMin) {
                hour = Number(n.split(".")[0]);
                min = Number(n.split(".")[1]);
            }
            var totalMilliseconds = (hour * 60 * 60 + min * 60 + sec) * 1000;
            return totalMilliseconds;
        },
        GetFullDateString: function (datetime) {
            return datetime.getUTCFullYear() + "-" + (datetime.getUTCMonth() + 1) + "-" + datetime.getUTCDate() + " " + datetime.getUTCHours() + ":" + datetime.getUTCMinutes() + ":" + datetime.getUTCSeconds();
        },
        GetShortDateString: function (datetime) {
            return datetime.getUTCFullYear() + "-" + (datetime.getUTCMonth() + 1) + "-" + datetime.getUTCDate();
        },
        SetAsMilestone: function () {
            var items = window[Planning.getGanttChartId()].getSelectedItems();
            if (items.length == 0) {
                Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                return;
            }
            items.forEach(function (item) {
                item.isMilestone = true;
                item.work = 0;
                item.completedWorkNew = 0;
                item.completedPercent = 0;
            });
            window[Planning.getGanttChartId()].refresh();
        },
        SetAutoScheduling: function (isAll, isAuto) {
            var items = window[Planning.getGanttChartId()].getSelectedItems();
            if (isAll)
                items = window[Planning.getGanttChartId()].items;
            items.forEach(function (item, index) {
                item.areDependencyConstraintsEnabled = isAuto;
            });
            window[Planning.getGanttChartId()].refresh();
        },
        GetDisplayTime: function () {
            var timelineStart = Helper.getUTCDateFormat(date);
            if (window[Planning.getGanttChartId()].items.length > 0) {
                timelineStart = window[Planning.getGanttChartId()].items[0].start;
            }
            return timelineStart;
        },
        GetTimelineStart: function () {
            var timelineStart = Helper.getUTCDateFormat(date);
            if (window[Planning.getGanttChartId()].items.length > 0) {
                timelineStart = window[Planning.getGanttChartId()].items[0].start;
                timelineStart = new Date(timelineStart.getFullYear(), timelineStart.getMonth(), (timelineStart.getDate() - 2));
            }
            return timelineStart;
        },
        GetTimelineFinish: function () {
            var timelineFinish = new Date(date.getFullYear(), date.getMonth(), (date.getDate() + defaultdayAddTimeline));
            if (window[Planning.getGanttChartId()].items.length > 0) {
                var finishedDate = window[Planning.getGanttChartId()].items[0].finish;
                timelineFinish = new Date(finishedDate.getFullYear(), finishedDate.getMonth(), (finishedDate.getDate() + defaultdayAddTimeline));
            }
            return timelineFinish;
        },
        IsIdInArray: function (array, name) {
            for (var i = 0; i < array.length; i++) {
                if (array[i] === name)
                    return true;
            }
            planning.TabClickStageId.push(name);
            return false;
        },
        secondsToTime: function (secs) {
            secs = Math.round(secs);
            var hours = Math.floor(secs / (60 * 60));
            var divisor_for_minutes = secs % (60 * 60);
            var minutes = Math.floor(divisor_for_minutes / 60);
            var divisor_for_seconds = divisor_for_minutes % 60;
            var seconds = Math.ceil(divisor_for_seconds);
            var time = hours + ":" + minutes + ":" + seconds;
            return time;
        }
    };

    document.addEventListener("DOMContentLoaded", function () {
        window.onresize = function () {
            if (!AppV.GetGlobals().isMainWindow && AppV.GetPropertyTabsState().ActiveTab == "GanttChart") {
                if (Helper.ItemiUndefinedOrNull("ProjectsPlanningCardSection")) {
                    var tabName = ProjectsPlanningCardSection.GetActiveTab().name;
                    Planning.PerformPlanningHeightChanges(tabName);
                }
            }
        };
    });
    planning.getGanttChartId = function () { return "ganttChartView" + actionToPerform; };
    planning.getScheduleChartPanelId = function () { return "scheduleChartPanel" + actionToPerform; };
    planning.getScheduleChartViewId = function () { return "scheduleChartView" + actionToPerform; };
    planning.getloadChartPanelId = function () { return "loadChartPanel" + actionToPerform; };
    planning.getloadChartViewId = function () { return "loadChartView" + actionToPerform; };

    planning.GetSlectedItemStageId = function () {
        if (typeof window[Planning.getGanttChartId()] == "undefined")
            return -1;
        var item = window[Planning.getGanttChartId()].selectedItem;
        if (item == null)
            return -1;
        return item.key;
    };

    planning.ProjectsPlanningPerformCallback = function (reload, templateId = -1, selectedRecord = []) {
        window["cbpProjectsPlanning" + actionToPerform].PerformCallback({
            ObjectId: AppV.GetGlobals().ObjectId,
            IdRecord: AppV.GetGlobals().RecordId,
            templateId: templateId,
            reload: reload,
            selectedRecord: selectedRecord,
            actionToPerform: actionToPerform
        });
    };

    planning.GetTabEnableRights = function () {
        var enable = true;
        var recordStatus = AppV.GetPropertyTabsState().CheckStatus;
        var IsCheckedOutBySelf = AppV.GetPropertyTabsState().IsCheckedOutBySelf;
        if (recordStatus === enums.RecordStatus.CheckedIn || !IsCheckedOutBySelf) {
            enable = false;
        } 
        return enable;
    };

    planning.SetPlanningTabsRights = function () {
        //var enable = Planning.GetTabEnableRights();
        var enable = (window[Planning.getGanttChartId()].selectedItem !== null);

        if (Helper.ItemiUndefinedOrNull("ProjectsPlanningCardSection")) {
            var tabName = ProjectsPlanningCardSection.GetActiveTab().name;
            if (tabName === "Properties") {
                if (Helper.ItemiUndefinedOrNull("PlanningPropertiesSave")) {
                    PlanningPropertiesSave.SetEnabled(enable);
                }
            } else if (tabName === "ToDo") {
            }
            else if (tabName === "Resources") {
                if (Helper.ItemiUndefinedOrNull("ResourcesGridShowAllSubStages")) {
                    if (ResourcesGridShowAllSubStages.GetChecked() === true ||
                        ResourcesGridShowAllStages.GetChecked() === true ||
                        window[Planning.getGanttChartId()].getSelectedItems().length  > 1) {
                        enable = false;
                    }
                }
                if (Helper.ItemiUndefinedOrNull("CtxResourcesGrid")) {
                    CtxResourcesGrid.GetItemByName("AddResourcesGrid").SetEnabled(enable);
                    CtxResourcesGrid.GetItemByName("RemoveResourcesGrid").SetEnabled(enable);
                    CtxResourcesGrid.GetItemByName("RemoveAllResourcesGrid").SetEnabled(enable);
                }
                if (Helper.ItemiUndefinedOrNull("AddResources")) {
                    AddResources.SetEnabled(enable);
                }
                if (Helper.ItemiUndefinedOrNull("RemoveResources")) {
                    RemoveResources.SetEnabled(enable);
                }
                if (Helper.ItemiUndefinedOrNull("ResourcesGrid")) {
                    if (ResourcesGrid.cpHasValues === false) {
                        RemoveResources.SetEnabled(false);
                    }
                }
                
            }
            else if (tabName === "ProjectsDeliverables") {
            }
            else if (tabName === "Notifications") {
                if (Helper.ItemiUndefinedOrNull("btnNewNotificationsPlanning")) {
                    btnNewNotificationsPlanning.SetEnabled(enable);
                }
                if (Helper.ItemiUndefinedOrNull("btnEditNotificationsPlanning")) {
                    btnEditNotificationsPlanning.SetEnabled(enable);
                }
                if (Helper.ItemiUndefinedOrNull("btnDeleteNotificationsPlanning")) {
                    btnDeleteNotificationsPlanning.SetEnabled(enable);
                }
            }
        }
    };


    planning.splFullScreenCollapsed = function (s, e) {
        var resize = (window[Planning.getScheduleChartPanelId()].style.display != 'none' || window[Planning.getloadChartPanelId()].style.display != 'none');
        if (!resize) {
            var Id = Planning.getGanttChartId();
            var height = window.innerHeight - ribbonPrpCard.GetHeight() - 40;
            document.getElementById(Id).style.height = height + "px";
        }
    };
    planning.splFullScreenExpanded = function (s, e, click) {
        var resize = (window[Planning.getScheduleChartPanelId()].style.display != 'none' || window[Planning.getloadChartPanelId()].style.display != 'none');
        if (!resize) {
            var Id = Planning.getGanttChartId();
            var idBootom = "mainProjectsSplFullScreenMode_" + mainProjectsSplFullScreenMode.GetPaneByName("mainProjectsSplPropertyPanel").helper.indexPath;
            document.getElementById(idBootom).style.height = 360 + "px";
            document.getElementById(Id).style.height = 500 + "px";
        }
    };
    planning.splFullScreenModeResizeCompleted = function (s, e) {
        var resize = (window[Planning.getScheduleChartPanelId()].style.display != 'none' || window[Planning.getloadChartPanelId()].style.display != 'none');
        if (!resize) {
            var Id = Planning.getGanttChartId();
            var idBootom = "mainProjectsSplFullScreenMode_" + mainProjectsSplFullScreenMode.GetPaneByName("mainProjectsSplPropertyPanel").helper.indexPath;
            var height = window.innerHeight - ribbonPrpCard.GetHeight() - window[idBootom].offsetHeight - 40;
            document.getElementById(Id).style.height = height + "px";
        }
    };
    planning.PlanningPropertiesSave_Click = function (s, e) {
        AjaxStatus.FormSubmit(window.ActionToPerform.Save, Action.EditPlanning);
    };

    planning.GetDate = function (date) {
        return new Date(date.match(/[+-]?\d+(?:\.\d+)?/g).map(Number)[0]);
    };
    planning.TimeSpanFromHour = function (time) {
        var timeParts = time.toString().split(".");
        return (+timeParts[0] * (60000 * 60));// + (+timeParts[1] * 60000);
    };

    planning.LoadProjectData = function (s, e) {
        var height = RzProperties.GetCHeightForGanttChart();
        var isMainGridDisplay = actionToPerform === enums.ActionToPerform.MainGridDisplay;
        height = (isMainGridDisplay ? 500 : height);
        var Id = Planning.getGanttChartId();
        var IsOpenTemplate = actionToPerform === enums.ActionToPerform.Edit;
        height = IsOpenTemplate ? 350 : height;
        document.getElementById(Id).style.height = height + "px";
        var projectData = JSON.parse(s.cpAllRowData);
        var projectOptions = JSON.parse(s.cpProjectsOptions);
        planning.projectOptions = projectOptions;
        planning.isBaselineVisible = IsOpenTemplate ? false : planning.isBaselineVisible;

        var isGridReadOnly = AppV.GetGlobals().isMainWindow;
        var isChartReadOnly = AppV.GetGlobals().isMainWindow;
        var recordStatus = AppV.GetPropertyTabsState().CheckStatus;
        var IsCheckedOutBySelf = AppV.GetPropertyTabsState().IsCheckedOutBySelf;
        if (!AppV.GetGlobals().isMainWindow) {
            if (recordStatus === enums.RecordStatus.CheckedIn || !IsCheckedOutBySelf) {
                isGridReadOnly = true;
                isChartReadOnly = true;
            }
        }
        settings = {
            gridWidth: IsOpenTemplate ? '0%' : "40%",
            isGridVisible: !IsOpenTemplate,
            chartWidth: IsOpenTemplate ? '100%' : "60%",
            isGridReadOnly: IsOpenTemplate ? true : isGridReadOnly,
            isChartReadOnly: IsOpenTemplate ? true : isChartReadOnly,
            theme: theme,
            selectedIndex: 0,
            isBaselineVisible: planning.isBaselineVisible,
            isGridRowClickTimeScrollingEnabled: planning.zoomToSelection,
            areTaskDependencyConstraintsEnabled: planning.automaticScheduling,
            selectionMode: "Focus",//None,Focus,Single,Extended,ExtendedFocus
            isSplitterEnabled: true,
        };

        // Optionally, set up nonworking days.
        settings.specialNonworkingDays = [];//[new Date(year, month, 10), new Date(year, month, 11), new Date(year, month, 12)];
        Planning.CalendarsData(projectOptions);

        // Support for updating items from the chart area (by chaning start, finish, or completedFinish).

        settings.itemPropertyChangeHandler = function (item, propertyName, isDirect, isFinal) {
            // Skip this handler for summary item, and also when the property name changes as direct action and final attempt
            // (as not needed at the end of drag operation again).
            //if (item.hasChildren || (isDirect && isFinal))
            //    return;
            // Treat only start, finish, and completedFinish changes.

            if (planning.isImportXml) return;
            switch (propertyName) {
                case 'start':
                    // Record the time of the start update.
                    startUpdatedAt = new Date();
                    // When start changes, update item's work, and completionPercent accordingly, and refresh the UI.
                    // We do it asynchronously to allow the component to first update finish as well.
                    setTimeout(function () {
                        item.work = Planning.getWork(item.start, item.interruptions, item.finish);
                        var completedWork = Planning.getWork(item.start, item.interruptions, item.completedFinish);
                        item.completionPercent = completedWork / item.work * 100;
                        Planning.updateItem(item);
                        Planning.updateParents(item);
                    }, 1);
                    break;
                case 'finish':
                    // Avoid refreshing finish when start updated (because it will be handled under start change). 
                    if (new Date().valueOf() - startUpdatedAt.valueOf() < 2)
                        return;
                    // When finish changes (alone), update item's work, and completionPercent accordingly, and refresh the UI.
                    item.work = Planning.getWork(item.start, item.interruptions, item.finish);
                    var completedWork = Planning.getWork(item.start, item.interruptions, item.completedFinish);
                    item.completionPercent = completedWork / item.work * 100;
                    Planning.updateItem(item);
                    Planning.updateParents(item);
                    break;
                case 'completedFinish':
                    // When completedFinish changes, update item's completionPercent accordingly, and refresh the UI.
                    var completedWork = Planning.getWork(item.start, item.interruptions, item.completedFinish);
                    item.completionPercent = completedWork / item.work * 100;
                    Planning.updateItem(item);
                    Planning.updateParents(item);
                    break;
            }
            //if (isDirect && isFinal) {
            //    if (propertyName !== "isSelected") {
            //        _InternalFunctions.AddUpdateInsertItemPlanning("Update", item);
            //    }
            //}
        };


        $("#ganttChartView0").on("change", function () {
            planning.itemHasChanged = true;
            if (planning.itemHasChanged)
                Planning.SaveAllPlanningItemsOutside("Update", "Outside");
        }); 

        settings.itemSelectionChangeHandler = function (item, isSelected, isDirect) {
            if (isSelected && isDirect) {
                Planning.ItemChangeActionSuccess(item);
            }
            if (event != undefined || event != null) {
                if (event.ctrlKey) {
                    window[Planning.getGanttChartId()].settings.selectionMode = "ExtendedFocus";
                } else {
                    window[Planning.getGanttChartId()].settings.selectionMode = "Focus";
                }
            }
        };

        settings.mouseHandler = function (eventName, isOnItemsArea, isOnChart, row, column, button, clickCount, e) {
            var buttonDetails = button == 1 ? 'left' : (button == 2 ? 'middle' : (button == 3 ? 'right' : 'N/A'));
            if (clickCount > 0 && buttonDetails === 'right' && !isOnChart) {
                Planning.OnShowCtxMenuPlanning(e);
            }
            if (clickCount > 0 && buttonDetails === 'left' && isOnChart) {
                var item = window[Planning.getGanttChartId()].selectedItem;
                if (item != null) {
                    if (item.isExpanded != null || item.isExpanded != undefined) {
                        if (item.isExpanded) {
                            setTimeout(function () { window[Planning.getGanttChartId()].collapseItem(item); }, 1000);
                        } else {
                            setTimeout(function () { window[Planning.getGanttChartId()].expandItem(item); }, 1000);
                        }
                    }
                }
            }
        };

        //settings.displayedTimeChangeHandler = function (displayedTime) {
        //    var startTimeline = window[Planning.getGanttChartId()].settings.timelineStart;
        //    var timelineFinish = window[Planning.getGanttChartId()].settings.timelineFinish; 
        //    var displayedTimeFinish = new Date(displayedTime.getFullYear(), displayedTime.getMonth() +1, (displayedTime.getDate() ));
        //    if (startTimeline.getUTCFullYear() === displayedTime.getUTCFullYear()
        //        && (startTimeline.getUTCMonth() + 1) == (displayedTime.getUTCMonth() + 1)
        //        && startTimeline.getUTCDate() === displayedTime.getUTCDate()) {
        //       // window[Planning.getGanttChartId()].decreaseTimelinePage(1 * 7 * 24 * 60 * 60 * 1000); // 1 weeks
        //         window[Planning.getGanttChartId()].settings.timelineStart = new Date(startTimeline.getFullYear(), startTimeline.getMonth(), (startTimeline.getDate() - 7));
        //         window[Planning.getGanttChartId()].refresh();
        //    }
        //    var diffDays = Math.abs((timelineFinish.getUTCDate() - displayedTimeFinish.getUTCDate()));
        //    if (timelineFinish.getUTCFullYear() === displayedTimeFinish.getUTCFullYear()
        //        && (timelineFinish.getUTCMonth() + 1) == (displayedTimeFinish.getUTCMonth() + 1)
        //        && diffDays<7) {
        //       // window[Planning.getGanttChartId()].increaseTimelinePage(1 * 7 * 24 * 60 * 60 * 1000); // 1 weeks
        //        window[Planning.getGanttChartId()].settings.timelineFinish = new Date(timelineFinish.getFullYear(), timelineFinish.getMonth(), (timelineFinish.getDate() + 7));
        //        window[Planning.getGanttChartId()].refresh();
        //    }
        //};

        var items = [];
        projectData.forEach(function (item, index) {
            var ganntItem = {
                key: item.Key,
                content: item.Content,
                indentation: item.Indentation,
                start: Helper.getUTCDateFormat(Planning.GetDate(item.Start)),
                finish: Helper.getUTCDateFormat(Planning.GetDate(item.Finish)),
                timeSpamWork: item.TimeSpanWork.TotalMilliseconds,
                timeSpamCompletedWork: item.TimeSpanCompletedWork.TotalMilliseconds,
                completedWorkNew: item.CompletedWork,
                isMilestone: item.IsMilestone,
                number: item.Number,
                baselineStart: Helper.getUTCDateFormat(Planning.GetDate(item.BaselineStart)),
                baselineFinish: Helper.getUTCDateFormat(Planning.GetDate(item.BaselineFinish)),
                timesheetsAll: item.TimesheetsAll,
                timesheetsApproved: item.TimesheetsApproved,
                tasksAll: item.TasksAll,
                tasksCompleted: item.TasksCompleted,
                predecessors: predecessors,
                resources: item.Resources,
                responsibleUser: item.ResponsibleUser,
                workBaseline: item.WorkBaseline,
                timeSpamWorkBaseline: item.TimeSpanWorkBaseline.TotalMilliseconds,
                completedWorkBaseline: item.CompletedWorkBaseline,
                indentLevel: item.IndentLevel,
                iconIndex: item.IconIndex,
                stageType: item.StageType,
                areDependencyConstraintsEnabled: item.IsAutoSchedule
            };
            items.push(ganntItem);
            var predecessors = [];
            item.PredecessorItem.forEach(function (itempredecessors) {
                items[index].predecessors = [{ item: items[itempredecessors.index], dependencyType: itempredecessors.DependencyType, tag: itempredecessors.Tag, itemIndex: itempredecessors.ItemIndex }];
            });
            if (!items[index].interruptions)
                items[index].interruptions = [];
            item.InterruptionItem.forEach(function (iteminterruption) {
                items[index].interruptions.push({ offset: parseFloat(iteminterruption.Position), duration: parseFloat(iteminterruption.Length) });
                // Planning.updateItem(items[index]);
            });
        });

        // Customize the standard task template to draw a generic interruptions area and used interval bars on top.
        settings.standardTaskTemplate = function (item) {
            if (planning.isPrint) {
                item = window[Planning.getGanttChartId()].items[item.index];
            }
            var ganttChartView = item.ganttChartView, settings = window[Planning.getGanttChartId()].settings, document = window[Planning.getGanttChartId()].ownerDocument;
            var undefinedType = 'undefined', svgns = 'http://www.w3.org/2000/svg';
            var barMargin = 4, barHeight = settings.itemHeight - 2 * barMargin;
            var group = Planning.getChartItemArea(item);
            var itemLeft = ganttChartView.getChartPosition(item.start);
            var itemRight = Math.max(ganttChartView.getChartPosition(item.finish) - 1, itemLeft + 4);
            var itemCompletedRight = Math.max(ganttChartView.getChartPosition(item.completedFinish) - 1, itemLeft);

            // Interruptions area drawn for the entire item's spanning with stroke-dasharray: 2-2 (dashed line).

            settings.standardBarStyle = standardBarStyle;
            var rect = document.createElementNS(svgns, 'rect');
            rect.setAttribute('x', itemLeft);
            rect.setAttribute('y', barMargin);
            rect.setAttribute('width', Math.max(0, itemRight - itemLeft - 1));
            rect.setAttribute('height', barHeight);
            rect.setAttribute('style', settings.standardBarStyle + ';  fill: White');//stroke-dasharray: 2 2;

            group.appendChild(rect);

            //Baseline
            if (settings.isBaselineVisible) {
                var itemLeftbaseline = ganttChartView.getChartPosition(item.baselineStart);
                var itemRightbaseline = Math.max(ganttChartView.getChartPosition(item.baselineFinish) - 1, itemLeftbaseline + 4);
                rect = document.createElementNS(svgns, 'rect');
                rect.setAttribute('x', itemLeftbaseline);
                rect.setAttribute('y', barMargin - 2);
                rect.setAttribute('width', Math.max(0, itemRightbaseline - itemLeftbaseline - 1));
                rect.setAttribute('height', barHeight);
                rect.setAttribute('style', settings.standardBarStyle + ';fill: none; stroke: Blue; stroke-dasharray: 2, 2');//stroke-dasharray: 2 2;
                //if (item.baselineStart.toUTCString() != item.baselineFinish.toUTCString())
                group.appendChild(rect);
            }
            // item.workTimes array (with start-finish intervals) is computed when getWorkTimesAndFinish method is called for the item,
            // i.e. when calendar is applied (including at initialization time) or whenever the item changes.
            if (item.workTimes) {
                // Draw standard bars for each work time interval of the item, between interval.start and interval.finish.
                for (var i = 0; i < item.workTimes.length; i++) {
                    var interval = item.workTimes[i];
                    var intervalLeft = ganttChartView.getChartPosition(interval.start);
                    var intervalRight = Math.max(ganttChartView.getChartPosition(interval.finish) - 1, intervalLeft + 4);
                    rect = document.createElementNS(svgns, 'rect');
                    rect.setAttribute('x', intervalLeft);
                    rect.setAttribute('y', barMargin);
                    rect.setAttribute('width', Math.max(0, intervalRight - intervalLeft - 1));
                    rect.setAttribute('height', barHeight);
                    rect.setAttribute('style', settings.standardBarStyle);
                    // criticalPath
                    if (!item.hasChildren && window[Planning.getGanttChartId()].isItemCritical(item)) {
                        if (planning.iscriticalPath)
                            rect.setAttribute('style', 'stroke: #e31d3b; fill: #e31d3b');
                    }
                    group.appendChild(rect);
                }
            }

            // The same way for completedWorkTimes (representing the completed time intervals).
            if (item.completedWorkTimes) {
                for (var i = 0; i < item.completedWorkTimes.length; i++) {
                    var interval = item.completedWorkTimes[i];
                    var intervalLeft = ganttChartView.getChartPosition(interval.start);
                    var intervalRight = Math.max(ganttChartView.getChartPosition(interval.finish) - 1, intervalLeft);
                    rect = document.createElementNS(svgns, 'rect');
                    rect.setAttribute('x', intervalLeft);
                    rect.setAttribute('y', barMargin + barHeight / 3);
                    rect.setAttribute('width', Math.max(0, intervalRight - intervalLeft - 1));
                    rect.setAttribute('height', barHeight - 2 * barHeight / 3);
                    rect.setAttribute('style', settings.standardCompletedBarStyle);
                    group.appendChild(rect);
                }
            }


            // If the item is not read only, add thumbs allowing the end user to move or resize the bar.
            if (!settings.isReadOnly && !settings.isChartReadOnly && (typeof item.isReadOnly === undefinedType || !item.isReadOnly) && (typeof item.isBarReadOnly === undefinedType || !item.isBarReadOnly)) {
                // Thumb to allow moving the bar - updating start and preserving work.
                var thumb = document.createElementNS(svgns, 'rect');
                thumb.setAttribute('x', itemLeft);
                thumb.setAttribute('y', barMargin);
                thumb.setAttribute('width', Math.max(0, itemRight - itemLeft - 1));
                thumb.setAttribute('height', barHeight);
                thumb.setAttribute('style', 'fill: White; fill-opacity: 0; cursor: move');
                if (!settings.isTaskStartReadOnly)
                    group.appendChild(thumb);
                // Thumb to allow resizing the bar at start time - also updating work to preserve finish.
                var startThumb = document.createElementNS(svgns, 'rect');
                startThumb.setAttribute('x', itemLeft - 4);
                startThumb.setAttribute('y', barMargin);
                startThumb.setAttribute('width', 4);
                startThumb.setAttribute('height', barHeight);
                startThumb.setAttribute('style', 'fill: White; fill-opacity: 0; cursor: e-resize');
                if (settings.isDraggingTaskStartEndsEnabled && !settings.isTaskStartReadOnly && settings.interaction != 'TouchEnabled')
                    group.appendChild(startThumb);
                // Thumb to allow resizing the bar at finish time - also updating work to preserve start.
                var finishThumb = document.createElementNS(svgns, 'rect');
                finishThumb.setAttribute('x', itemRight - 2);
                finishThumb.setAttribute('y', barMargin);
                finishThumb.setAttribute('width', 8);
                finishThumb.setAttribute('height', barHeight);
                finishThumb.setAttribute('style', 'fill: White; fill-opacity: 0; cursor: e-resize');
                if (!settings.isTaskEffortReadOnly && settings.interaction != 'TouchEnabled')
                    group.appendChild(finishThumb);
                // Thumb to allow resizing the completion bar.
                var completedFinishThumb = document.createElementNS(svgns, 'rect');
                completedFinishThumb.setAttribute('x', itemCompletedRight - 2);
                completedFinishThumb.setAttribute('y', barMargin);
                completedFinishThumb.setAttribute('width', 4);
                completedFinishThumb.setAttribute('height', barHeight);
                completedFinishThumb.setAttribute('style', 'fill: White; fill-opacity: 0; cursor: e-resize');
                if (!settings.isTaskCompletionReadOnly && settings.isTaskCompletedEffortVisible && settings.interaction != "TouchEnabled")
                    group.appendChild(completedFinishThumb);
                // Bind the thumbs internally to the item values.
                ganttChartView.initializeTaskDraggingThumbs(thumb, startThumb, finishThumb, completedFinishThumb, item, itemLeft, itemRight, itemCompletedRight);

                // Also define and initialize thumbs for creating dependencies by dragging from circles drawn at the ends of the bars.
                if (settings.areTaskDependenciesVisible && !settings.areTaskPredecessorsReadOnly && !item.isPart) {
                    var startDependencyThumb = null;
                    if (typeof settings.allowCreatingStartDependencies === undefinedType || settings.allowCreatingStartDependencies) {
                        startDependencyThumb = document.createElementNS(svgns, 'circle');
                        startDependencyThumb.setAttribute('cx', itemLeft);
                        startDependencyThumb.setAttribute('cy', barMargin + barHeight / 2);
                        startDependencyThumb.setAttribute('r', barHeight / 4);
                        startDependencyThumb.setAttribute('style', 'fill: White; fill-opacity: 0; cursor: pointer');
                        group.appendChild(startDependencyThumb);
                    }
                    var dependencyThumb = document.createElementNS(svgns, 'circle');
                    dependencyThumb.setAttribute('cx', itemRight - 2);
                    dependencyThumb.setAttribute('cy', barMargin + barHeight / 2);
                    dependencyThumb.setAttribute('r', barHeight / 4);
                    dependencyThumb.setAttribute('style', 'fill: White; fill-opacity: 0; cursor: pointer');
                    group.appendChild(dependencyThumb);
                    ganttChartView.initializeDependencyDraggingThumbs(dependencyThumb, startDependencyThumb, group, item, barMargin + barHeight / 2, itemRight - 2, itemLeft);
                }
            }

            // Return the SVG container group containing all the defined elements above.
            return group;
        };
        var columns = DlhSoft.Controls.GanttChartView.getDefaultColumns(items, settings);
        columns.splice(5, 1);

        var indexOffset = columns[0].isSelection ? 1 : 0;

        columns.unshift({ header: '', width: 45, displayIndex: 0, cellTemplate: DlhSoft.Controls.GanttChartView.getIndexColumnTemplate() });
        columns.unshift({
            header: '', width: 35, displayIndex: 1, cellTemplate: function (item) {
                return Planning.SetIconColumnGanttChartView(item);
            }
        });
        columns[2 + indexOffset].header = isMainGridDisplay ? SwResourceObject.Description : SwResourceObject.Stage;
        columns[2 + indexOffset].width = 200;
        columns[2 + indexOffset].displayIndex = 2;

        columns[3 + indexOffset].header = SwResourceObject.Start;
        columns[4 + indexOffset].header = SwResourceObject.Finish;

        var headerDuration = isMainGridDisplay ? SwResourceObject.TimeAllocated + "(" + SwResourceObject.Stages.replace(" ", "") + ")" : SwResourceObject.Duration;
        var heightColumn = isMainGridDisplay ? 140 : 80;
        var durationUnits = (projectOptions.DurationUnits == "1") ? false : true;

        columns.splice(5 + indexOffset, 0, {
            header: headerDuration + ' ' + (durationUnits == true ? '(d)' : '(h)'), width: heightColumn, cellTemplate: function (item) {
                return DlhSoft.Controls.GanttChartView.numberInputColumnTemplateBase(item.ganttChartView.ownerDocument, 64,
                    function () {
                        return (durationUnits == true ? Number(parseFloat(item.work / 8).toFixed(2)) : Number(parseFloat(item.work).toFixed(2)));
                    },
                    function (value) {
                        if (item.hasChildren) item.work = item.work;
                        item.work = (durationUnits == true ? Number(parseFloat(value * 8).toFixed(2)) : Number(parseFloat(value).toFixed(2)));
                        if (item.work < item.completedWorkNew) {
                            item.completedWorkNew = item.work * (item.completionPercent / 100);
                        }
                        // When item.work changes, update other properties of the item (e.g. finish and workTimes) and update parent nodes (summaries) as well. 
                        Planning.updateItem(item);
                        Planning.updateParents(item);
                    });
            }
        });
        var headerCompletedWork = isMainGridDisplay ? SwResourceObject.Time + " " + SwResourceObject.Completed + "(" + SwResourceObject.Stages.replace(" ", "") + ")" : SwResourceObject.CompletedWork;
        columns.splice(6 + indexOffset, 0, {
            header: headerCompletedWork + ' ' + (durationUnits == true ? '(d)' : '(h)'), width: heightColumn, cellTemplate: function (item) {
                return DlhSoft.Controls.GanttChartView.numberInputColumnTemplateBase(item.ganttChartView.ownerDocument, 64,
                    function () {
                        return (durationUnits == true ? Number(parseFloat(item.completedWorkNew / 8).toFixed(2)) : Number(parseFloat(item.completedWorkNew).toFixed(2)));
                    },
                    function (value) {
                        var work = (durationUnits == true ? item.work / 8 : item.work);
                        if (value > work) {
                            item.completedWorkNew = (durationUnits == true ? item.completedWorkNew : item.completedWorkNew);
                        } else {
                            item.completedWorkNew = (durationUnits == true ? value * 8 : value);
                        }
                        Planning.updateItem(item);
                        Planning.updateParents(item);
                    });
            }
        });
        columns.splice(7 + indexOffset, 0, {
            header: SwResourceObject.CompletedPercent, width: 80, cellTemplate: function (item) {
                return DlhSoft.Controls.GanttChartView.numberInputColumnTemplateBase(item.ganttChartView.ownerDocument, 64,
                    function () {
                        return Number(parseFloat(item.completionPercent).toFixed(2));
                    },
                    function (value) {
                        if (value > 100) {
                            item.completionPercent = item.completionPercent;
                        } else {
                            item.completionPercent = value;
                        }
                        item.completedWorkNew = (item.completionPercent / 100) * item.work;
                        Planning.updateItem(item);
                        Planning.updateParents(item);
                    });
            }
        });

        columns.splice(8 + indexOffset, 0, {
            header: SwResourceObject.Predecessors, isReadOnly: true, cellTemplate: DlhSoft.Controls.GanttChartView.getPredecessorsColumnTemplate(84)
        });

        columns.splice(9 + indexOffset, 0, {
            header: SwResourceObject.TimesheetsAll, cellTemplate: function (item) {
                return item.ganttChartView.ownerDocument.createTextNode(item.timesheetsAll);
            }
        });
        columns.splice(10 + indexOffset, 0, {
            header: SwResourceObject.TimesheetsApproved, cellTemplate: function (item) {
                return item.ganttChartView.ownerDocument.createTextNode(item.timesheetsApproved);
            }
        });
        columns.splice(11 + indexOffset, 0, {
            header: SwResourceObject.TasksAll, cellTemplate: function (item) {
                return item.ganttChartView.ownerDocument.createTextNode(item.tasksAll);
            }
        });
        columns.splice(12 + indexOffset, 0, {
            header: SwResourceObject.TasksCompleted, cellTemplate: function (item) {
                return item.ganttChartView.ownerDocument.createTextNode(item.tasksCompleted);
            }
        });

        columns.splice(15 + indexOffset, 0, {
            header: SwResourceObject.Resources, width: 300, cellTemplate: function (item) {
                return item.ganttChartView.ownerDocument.createTextNode(item.resources);
            }
        });
        columns.splice(16 + indexOffset, 0, {
            header: SwResourceObject.ResponsibleUser, width: 130, cellTemplate: function (item) {
                return item.ganttChartView.ownerDocument.createTextNode(item.responsibleUser);
            }
        });
        columns.splice(17 + indexOffset, 0, {
            header: SwResourceObject.PlannedStart, width: 150, cellTemplate: DlhSoft.Controls.GanttChartView.getBaselineStartColumnTemplate(124, true, true, 8 * 60 * 60 * 1000)
        });
        columns.splice(18 + indexOffset, 0, {
            header: SwResourceObject.WorkBaseline, cellTemplate: function (item) {
                return item.ganttChartView.ownerDocument.createTextNode(item.workBaseline);
            }
        });
        columns.splice(19 + indexOffset, 0, {
            header: SwResourceObject.CompletedWorkBaseline, cellTemplate: function (item) {
                return item.ganttChartView.ownerDocument.createTextNode(item.completedWorkBaseline);
            }
        });
        columns.splice(20 + indexOffset, 0, {
            header: SwResourceObject.IndentLevel, width: 100, cellTemplate: function (item) {
                return item.ganttChartView.ownerDocument.createTextNode(item.indentLevel);
            }
        });
        columns.splice(21 + indexOffset, 0, {
            header: SwResourceObject.IconIndex, width: 100, cellTemplate: function (item) {
                return item.ganttChartView.ownerDocument.createTextNode(item.iconIndex);
            }
        });
        columns.splice(22 + indexOffset, 0, {
            header: SwResourceObject.StageType, cellTemplate: function (item) {
                return item.ganttChartView.ownerDocument.createTextNode(item.stageType);
            }
        });


        settings.columns = columns;

        // Optionally, initialize custom theme and templates (themes.js, templates.js).
        initializeGanttChartTheme(settings, theme);
        initializeGanttChartTemplates(settings, theme);

        // Initialize the component.
        DlhSoft.Controls.GanttChartView.initialize(window[Planning.getGanttChartId()], items, settings);

        Planning.updateDayCalendars(projectOptions);

        window[Planning.getGanttChartId()].items.forEach(function (item, index) {
            var start = Helper.getUTCDateFormat(item.start);
            var finish = DlhSoft.Controls.GanttChartView.getFinish(start, item.timeSpamWork, settings);
            var completedFinish = DlhSoft.Controls.GanttChartView.getFinish(start, item.timeSpamCompletedWork, settings);
            completedFinish = Helper.getUTCDateFormat(completedFinish);
            var work = Planning.getWork(start, item.interruptions, finish);
            item.baselineFinish = DlhSoft.Controls.GanttChartView.getFinish(Helper.getUTCDateFormat(item.baselineStart), item.timeSpamWorkBaseline, settings);
            item.work = work;
            var completedWork = Planning.getWork(start, item.interruptions, completedFinish);
            item.completedWork = completedWork;
            if (item.completedWork > item.work) {
                item.completedWork = item.work;
                completedWork = item.work;
            };
            item.completionPercent = completedWork / work * 100;
            Planning.updateItem(item);
            Planning.updateParents(item);
        });

        if (!planning.showProperties) {
            Planning.RibbonCheckedChangedSettingsPlanning("PropertiesPlanning");
            Planning.PerformPlanningHeightChanges("Properties");
        }
        Planning.ShowHideAssignmentsContent(planning.IsResources);
        window[Planning.getGanttChartId()].refresh();
        window[Planning.getGanttChartId()].refreshItems();
        Planning.ShowHideNonWorkingDaysPlanning(planning.NonWorkingDays);
        if (isMainGridDisplay) Planning.PlanningViewCollapseExpand(0);

    };
    planning.ProjectsPlanningInit = function (s, e, action) {
        planning.TabClickStageId = [];
        actionToPerform = action;
    };
    planning.ProjectsPlanningBeginCallback = function (s, e) {
        if (!AppV.GetGlobals().isMainWindow) {
            //window["cbpProjectsPlanning" + actionToPerform].HideLoadingPanel();
            //loadingPanel.Show();
        }

    };
    planning.SetBootomTabPlanningEnable = function () {
        if (window[Planning.getGanttChartId()] != null || window[Planning.getGanttChartId()] != undefined) {
            if (Helper.ItemiUndefinedOrNull("mainProjectsSplFullScreenMode")) {
                if (window[Planning.getGanttChartId()].items.length == 0) {
                    mainProjectsSplFullScreenMode.SetEnabled(false);
                } else {
                    mainProjectsSplFullScreenMode.SetEnabled(true);
                }
            }
        }
    };

    planning.ProjectsPlanningBootomInit = function (s, e) {
        Planning.SetBootomTabPlanningEnable();
    };



    planning.ProjectsPlanningEndCallback = function (s, e) {
        if (!AppV.GetGlobals().isMainWindow) {
            window["cbpProjectsPlanning" + actionToPerform].HideLoadingPanel();
            loadingPanel.Hide();
        }
        var zoomtoSelected = false;
        if (typeof ZoomToSelectionPlanningView != "undefined") zoomtoSelected = ZoomToSelectionPlanningView.GetChecked();
        planning.LoadProjectData(s, e);
        planning.isPrint = false;
        if (planning.indexItemSaved != -1) {
            var item = window[Planning.getGanttChartId()].items[planning.indexItemSaved];
            if (item != null) {
                window[Planning.getGanttChartId()].selectItem(item);
                window[Planning.getGanttChartId()].scrollToItem(item);
                if (item.finish != null || item.finish !== "" || item.finish != undefined) {
                    if (Planning.CanScrollToDate())
                        window[Planning.getGanttChartId()].scrollToDateTime(new Date(item.finish.getFullYear(), item.finish.getMonth(), item.finish.getDate()));
                } else {
                    if (Planning.CanScrollToDate())
                        window[Planning.getGanttChartId()].scrollToDateTime(new Date(year, month, 1));
                }

                //var tabName = "Properties";
                //if (ProjectsPlanningCardSection != "undefined") {
                //    tabName = ProjectsPlanningCardSection.GetActiveTab().name;
                //}
                //if (tabName !== "Properties") {
                    setTimeout(function () {
                        if (window[Planning.getGanttChartId()].selectedItem != null && window[Planning.getGanttChartId()].selectedItem.contentInput) {
                            window[Planning.getGanttChartId()].selectedItem.contentInput.autofocus = true;
                            window[Planning.getGanttChartId()].selectedItem.contentInput.style.backgroundColor = "white";
                            window[Planning.getGanttChartId()].selectedItem.contentInput.select();
                        }
                    }, 1000);
                //}
            }
        }
        planning.indexItemSaved = -1;
        planning.itemHasChanged = false;
        Planning.SetBootomTabPlanningEnable();
        planning.SetPlanningTabsRights();
        App.Global.SetViewerRightsRibbonDisable("DeletePlanning");
    };
    planning.CanScrollToDate = function () {
        var zoomtoSelected = false;
        if (typeof ZoomToSelectionPlanning != "undefined")
            zoomtoSelected = ZoomToSelectionPlanning.GetChecked();
        return zoomtoSelected;
    };


    planning.OnShowCtxMenuPlanning = function (e) {
        var Id = Planning.getGanttChartId();
        setTimeout(function () {
            if (document.getElementById(Id).addEventListener) {
                document.getElementById(Id).addEventListener('contextmenu', function (e) {
                    e.preventDefault();
                    if (actionToPerform === ActionToPerform.MainGridDisplay) {
                        window.CtxPlanningView.ShowAtPos(e.clientX, e.clientY);
                    } else {
                        window.CtxPlanning.ShowAtPos(e.clientX, e.clientY);
                        _InternalFunctions.EnableDisableContextMenuItems();
                    }

                }, false);
            } else {
                document.getElementById(Id).attachEvent('oncontextmenu', function () {
                    window.event.returnValue = false;
                });
            }
        }, 10);
    };

    planning.OnContextMenuClickPlanning = function (s, e) {
        switch (e.item.name) {
            case "CtxPlanningRefresh":
                Planning.ProjectsPlanningPerformCallback(true);
                break;
            case "CtxPlanningMoveUp":
                Planning.MoveUpPlanning();
                break;
            case "CtxPlanningMoveDown":
                Planning.MoveDownPlanning();
                break;
            case "CtxPlanningIncreaseIndent":
                Planning.IndentRightPlanning();
                break;
            case "CtxPlanningDecreaseIndent":
                Planning.IndentLeftPlanning();
                break;
            case "CtxPlanningSplitStage":
                Planning.PlanningSplitStage();
                break;
            case "CtxPlanningRemoveStage":
                Helper.ShowConfirmPopUp("SolidWorks", SwResourceObject.AreYouSure, "Planning.AddRemoveSplitItem('RemoveAll',1)");
                break;
            case "CtxPlanningResetBaselineSelectedStage":
                var message = Helper.T("ThisWillResetTheBaselineForSelectedStages") + " " + SwResourceObject.AreYouSure;
                Helper.ShowConfirmPopUp("SolidWorks", message, "Planning.ResetBaseLinePlanning(0)");
                break;
            case "CtxPlanningResetBaselineAllStages":
                Helper.ShowConfirmPopUp("SolidWorks", SwResourceObject.ThisWillResetTheBaselineForAllStages + " " + SwResourceObject.AreYouSure,
                    "Planning.ResetBaseLinePlanning(1)");
                break;
            case "CtxPlanningProgressSelectedStage":
                _InternalFunctions.UpdateProgressFromTasks(0);
                break;
            case "CtxPlanningProgressAllStages":
                _InternalFunctions.UpdateProgressFromTasks(1);
                break;
            case "CtxPlanning0Percent":
            case "CtxPlanning25Percent":
            case "CtxPlanning50Percent":
            case "CtxPlanning75Percent":
            case "CtxPlanning100Percent":
                _InternalFunctions.updateItemProgressBar(e.item.name);
                break;
            case "CtxPlanningUpdateWorkHoursFromTasks":
                View.load('AddUpdateFromTasks', {});
                break;
            case "CtxPlanningPrint":
                Planning.print();
                break;
            case "CtxPlanningSetAsMilestone":
                _InternalFunctions.SetAsMilestone();
                break;
            case "CtxPlanningSetAllToAutoSchedule":
                _InternalFunctions.SetAutoScheduling(true, true);
                break;
            case "CtxPlanningManuallySchedule":
                _InternalFunctions.SetAutoScheduling(false, false);
                break;
            case "CtxPlanningAutoSchedule":
                _InternalFunctions.SetAutoScheduling(false, true);
                break;
            /// Main Grid projects
            case "CtxPlanningViewRefresh":
                Planning.PlanningViewShown();
                break;
            case "CtxPlanningViewCollapseAll":
                Planning.PlanningViewCollapseExpand(0);
                break;
            case "CtxPlanningViewExpandAll":
                Planning.PlanningViewCollapseExpand(1);
                break;
            case "CtxPlanningViewRemoveFromList":
                Planning.PlanningViewRemoveFromList();
                break;
            case "CtxPlanningDelete":
                View.load('AddDeletePlanningItem', {});
                break;
        }
    };

    planning.OnSettingsMenuPlanningItemClick = function (s, e) {
        switch (e.item.name) {
            case "ImportXmlPlanning":
                var message = Helper.T("ThisWillReplaceExistingStages") + " " + SwResourceObject.AreYouSure;
                Helper.ShowConfirmPopUp("SolidWorks", message, "Planning.ImportXmlPlanning()");
                break;
            case "ExportXmlPlanning":
                Planning.saveProjectXmlFile();
                break;
            case "SaveAsImagePlanning":
                //  Planning.SaveAsImagePlanning();
                break;
            case "PrintPlanningPlanning":
                Planning.print();
                break;
            case "0Percent":
            case "25Percent":
            case "50Percent":
            case "75Percent":
            case "100Percent":
                _InternalFunctions.updateItemProgressBar(e.item.name);
                break;
            case "SelectedStagesPlanning":
                _InternalFunctions.UpdateProgressFromTasks(0);
                break;
            case "AllStagesPlanning":
                _InternalFunctions.UpdateProgressFromTasks(1);
                break;
        }
    };

    planning.ImportXmlPlanning = function () {
        View.load('AddImportXML', {});
    };
    planning.SaveAsImagePlanning = function () {
        // Get Project XML content.
        var projectXmlSerializerSettings = { compact: true };
        var projectSerializer = DlhSoft.Controls.GanttChartView.ProjectSerializer.initialize(window[Planning.getGanttChartId()], projectXmlSerializerSettings);
        var projectXml = projectSerializer.getXml();
        // Encode Project XML content to pass security requirements.
        projectXml = encodeURIComponent(projectXml);
        // Prepare HTML form and post Project XML content to server side PNG image exporter Web Form (see GetPng.aspx.cs).
        var form = document.createElement('form');
        form.setAttribute('method', 'POST');
        form.setAttribute('action', 'GetPng.aspx?theme=' + theme);
        var projectXmlField = document.createElement('input');
        projectXmlField.setAttribute('type', 'hidden');
        projectXmlField.setAttribute('name', 'ProjectXml');
        projectXmlField.setAttribute('value', projectXml);
        form.appendChild(projectXmlField);
        document.body.appendChild(form);
        form.submit();
        document.body.removeChild(form);

    };
    planning.ResetBaseLinePlanning = function (action) {
        var items = [];
        if (action == 0) {
            items = window[Planning.getGanttChartId()].getSelectedItems();
        } else {
            items = window[Planning.getGanttChartId()].items;
        }
        if (items.length == 0) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }
        items.forEach(function (item) {
            item.baselineStart = item.start;
            item.baselineFinish = item.finish;
            item.workBaseline = item.work;
            item.completedWorkBaseline = item.completedWorkNew;
        });
        window[Planning.getGanttChartId()].refreshItems();
        _InternalFunctions.SaveAllPlanningItems("Update", "Update");
    };
    planning.SetSpliterPanleCollapsed = function () {
        if (typeof mainProjectsSplFullScreenMode != "undefined") {
            var panel = mainProjectsSplFullScreenMode.GetPaneByName("mainProjectsSplPropertyPanel");
            if (panel != null) {
                return mainProjectsSplFullScreenMode.GetPaneByName("mainProjectsSplPropertyPanel").IsCollapsed();
            }
        }
        return false;
    };
    planning.SetScheduleChartPlanning = function () {
        var IsCollapsed = Planning.SetSpliterPanleCollapsed();
        if (window[Planning.getScheduleChartPanelId()] != undefined || window[Planning.getScheduleChartPanelId()] !== null) {
            if (window[Planning.getScheduleChartPanelId()].style.display == 'none') {
                if (IsCollapsed) {
                    mainProjectsSplFullScreenMode_0i0i0i0i1_S_CB_Img.click();
                }
            }
        }
        if (Planning.selectedScheduleChartPlanning) {
            Planning.ShowHideAssignmentsContent(false);
            window.Planning.closeScheduleChartView();
            Planning.selectedScheduleChartPlanning = false;
            if (!AppV.GetGlobals().isMainWindow) {
                if (IsCollapsed)
                    mainProjectsSplFullScreenMode_0i0i0i0i1_S_CB_Img.click();
                document.getElementById(ribbonPrpCard.GetItemByName("ScheduleChartPlanning").id).classList.remove("itemHoverPlanning");
            }
            planning.PlanningGantChartSetEnableButton(true, "LoadChartPlanningView");
        } else {
            Planning.ShowHideAssignmentsContent(true);
            window.Planning.ScheduleChartInit();
            Planning.selectedScheduleChartPlanning = true;
            if (!AppV.GetGlobals().isMainWindow) {
                mainProjectsSplFullScreenMode_0i0i0i0i1_S_CF_Img.click();
                document.getElementById(ribbonPrpCard.GetItemByName("LoadChartPlanning").id).classList.remove("itemHoverPlanning");
                document.getElementById(ribbonPrpCard.GetItemByName("ScheduleChartPlanning").id).classList.add("itemHoverPlanning");
            }
            planning.PlanningGantChartSetEnableButton(false, "LoadChartPlanningView");
        }
        Planning.SetDynamicHightPlanning(Planning.getScheduleChartPanelId());
        Planning.SetScheduleChartPlanningButtons(Planning.selectedScheduleChartPlanning);
    };
    planning.SetLoadChartPlanning = function () {
        var IsCollapsed = Planning.SetSpliterPanleCollapsed();
        if (window[Planning.getloadChartPanelId()] != undefined || window[Planning.getloadChartPanelId()] !== null) {
            if (window[Planning.getloadChartPanelId()].style.display == 'none') {
                if (IsCollapsed) {
                    mainProjectsSplFullScreenMode_0i0i0i0i1_S_CB_Img.click();
                }
            }
        }
        if (Planning.selectedLoadChartPlanning) {
            Planning.ShowHideAssignmentsContent(false);
            window.Planning.closeLoadChartView();
            Planning.selectedLoadChartPlanning = false;
            if (!AppV.GetGlobals().isMainWindow) {
                if (IsCollapsed)
                    mainProjectsSplFullScreenMode_0i0i0i0i1_S_CB_Img.click();
                document.getElementById(ribbonPrpCard.GetItemByName("LoadChartPlanning").id).classList.remove("itemHoverPlanning");
            }
            planning.PlanningGantChartSetEnableButton(true, "ScheduleChartPlanningView");
        } else {
            Planning.ShowHideAssignmentsContent(true);
            window.Planning.LoadChartInit();
            Planning.selectedLoadChartPlanning = true;
            if (!AppV.GetGlobals().isMainWindow) {
                mainProjectsSplFullScreenMode_0i0i0i0i1_S_CF_Img.click();
                document.getElementById(ribbonPrpCard.GetItemByName("ScheduleChartPlanning").id).classList.remove("itemHoverPlanning");
                document.getElementById(ribbonPrpCard.GetItemByName("LoadChartPlanning").id).classList.add("itemHoverPlanning");
            }
            planning.PlanningGantChartSetEnableButton(false, "ScheduleChartPlanningView");
        }
        Planning.SetDynamicHightPlanning(Planning.getloadChartPanelId());
        Planning.SetLoadChartPlanningButtons(Planning.selectedLoadChartPlanning);
    };

    planning.SetScheduleChartPlanningButtons = function (selectedScheduleChartPlanning) {
        if (selectedScheduleChartPlanning) {
            DisableItem(enums.RibbonNames.Properties, "DeletePlanning");
            DisableItem(enums.RibbonNames.Properties, "AddPlanning");
            DisableItem(enums.RibbonNames.Properties, "InsertPlanning");
            DisableItem(enums.RibbonNames.Properties, "SplitRemainingTimePlanning");
            DisableItem(enums.RibbonNames.Properties, "LoadChartPlanning");
        } else {
            EnableItems(enums.RibbonNames.Properties, "DeletePlanning");
            EnableItems(enums.RibbonNames.Properties, "AddPlanning");
            EnableItems(enums.RibbonNames.Properties, "InsertPlanning");
            EnableItems(enums.RibbonNames.Properties, "SplitRemainingTimePlanning");
            EnableItems(enums.RibbonNames.Properties, "LoadChartPlanning");
        }
    };
    planning.SetLoadChartPlanningButtons = function (selectedLoadChartPlanning) {
        if (selectedLoadChartPlanning) {
            DisableItem(enums.RibbonNames.Properties, "DeletePlanning");
            DisableItem(enums.RibbonNames.Properties, "AddPlanning");
            DisableItem(enums.RibbonNames.Properties, "InsertPlanning");
            DisableItem(enums.RibbonNames.Properties, "SplitRemainingTimePlanning");
            DisableItem(enums.RibbonNames.Properties, "ScheduleChartPlanning");
        } else {
            EnableItems(enums.RibbonNames.Properties, "DeletePlanning");
            EnableItems(enums.RibbonNames.Properties, "AddPlanning");
            EnableItems(enums.RibbonNames.Properties, "InsertPlanning");
            EnableItems(enums.RibbonNames.Properties, "SplitRemainingTimePlanning");
            EnableItems(enums.RibbonNames.Properties, "ScheduleChartPlanning");
        }
    };

    planning.PlanningViewAfterResizing = function (s, e) {
        var windowInnerWidth = window.innerWidth;
        if (s.GetWidth() >= windowInnerWidth) {
            s.SetWidth(windowInnerWidth);
            s.UpdatePosition();
        }
    };
    planning.PlanningViewShown = function () {
        var selectedRecord = [];
        Helper.FilterGridSelectedKeysOnPage("gridViewDocuments", "idRecord")
            .forEach(function (result, index) {
                selectedRecord.push(result.RecordGuid);
            });
        if (selectedRecord.length == 0) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }
        Planning.PlanningGantChartSetEnableButton(true);
        Planning.ProjectsPlanningPerformCallback(true, -1, selectedRecord);
    };

    planning.OnPopUpResize = function (s, e, width, height) {
        //var widthC = s.GetWidth();
        //var heightC = s.GetHeight();
        //if (e.resizeState == 4) {
        //    widthC = width;
        //    heightC = height;
        //}
        //if (e.resizeState == 3) {
        //    widthC = widthC -100;
        //    heightC = heightC - 100;
        //}
        //var differencewidth = widthC - 50;
        //var differenceheight = heightC - 200;
        //s.SetWidth(widthC);
        //s.SetHeight(heightC);
        //var ganttChart = document.getElementById(Planning.getGanttChartId());
        //if (ganttChart !== null) {
        //    ganttChart.style.height = differenceheight + "px";
        //    ganttChart.style.width = differencewidth + "px";
        //}
        //s.UpdatePosition();
    };


    planning.SetPopUpSize = function (s, e, width, height, className, id, reset) {
        if (e.resizeState == 4 || Boolean(reset)) {
            s.SetWidth(width);
            s.SetHeight(height);
        } else {
            if (document.documentElement.clientWidth < width)
                s.SetWidth(document.documentElement.clientWidth);
            else
                s.SetWidth(s.GetWidth());

            if (document.documentElement.clientHeight < height)
                s.SetHeight(document.documentElement.clientHeight);
            else
                s.SetHeight(s.GetHeight());

            height = s.GetHeight();
            width = s.GetWidth();
        }
        var popupName = "#_" + s.name + " div";
        var contentData = document.querySelectorAll(popupName);
        var contentDataArr = [];
        for (var i = 0; i < contentData.length; i++) {
            if (contentData[i].className == className && contentData[i].id == id) {
                contentDataArr.push(contentData[i]);
            }
        }
        for (i = 0; i < contentDataArr.length; i++) {
            if (i == 4) {
                contentDataArr[i].style.height = (height - 102) + "px";
            }
        }
        var popupNamePWC = s.name + "_PWC-1";
        if (document.getElementById(popupNamePWC) != null)
            document.getElementById(popupNamePWC).style.overflowY = "hidden";

        s.UpdatePosition();
    };

    planning.PlanningCalendarClick = function () {
        var item = window[Planning.getGanttChartId()].selectedItem;

        var selectedRecord = [];
        Helper.FilterGridSelectedKeysOnPage("gridViewDocuments", "idRecord")
            .forEach(function (result, index) {
                selectedRecord.push(result.RecordGuid);
            });

        //hide gantChart
        var projectPlanning = document.getElementById("projectPlanning");
        var projectCalendarPlanning = document.getElementById("projectCalendarPlanning");
        if (projectPlanning != null) {
            projectPlanning.style.display = "none";
        }
        if (projectCalendarPlanning != null) {
            projectCalendarPlanning.style.display = "block";
        }
        //Call calendar data
        window['cbpCalendarPlanningView'].PerformCallback({
            objectId: AppV.GetGlobals().ObjectId,
            recordGuid: selectedRecord,
            stageId: -1
        });

        planning.EnableDisableGantChartMenu(false);
    };

    planning.EnableDisableGantChartMenu = function (enable) {
        CmbScalePlanningView.SetVisible(enable);
        ResourcesPlanningView.SetVisible(enable);
        ZoomToSelectionPlanningView.SetVisible(enable);
        OptionsPlanningView.SetVisible(enable);
        ScheduleChartPlanningView.SetVisible(enable);
        LoadChartPlanningView.SetVisible(enable);
    };

    planning.PlanningGantChartSetEnableButton = function (enable, id = "") {
        if (id != "") {
            if (typeof window[id] !== "undefined") {
                window[id].SetEnabled(enable);
            }
        } else {
            if (typeof ScheduleChartPlanningView !== "undefined") {
                ScheduleChartPlanningView.SetEnabled(enable);
            }
            if (typeof LoadChartPlanningView !== "undefined") {
                LoadChartPlanningView.SetEnabled(enable);
            }
        }
    };
    planning.PlanningGantChartClick = function () {
        //show gantChart
        var projectPlanning = document.getElementById("projectPlanning");
        var projectCalendarPlanning = document.getElementById("projectCalendarPlanning");
        if (projectPlanning != null) {
            projectPlanning.style.display = "block";
        }
        if (projectCalendarPlanning != null) {
            projectCalendarPlanning.style.display = "none";
        }
        Planning.PlanningGantChartSetEnableButton(true);
        //Call planning data
        if (window['gridViewDocuments'] !== undefined) {
            var selectedRecord = [];

            Helper.FilterGridSelectedKeysOnPage("gridViewDocuments", "idRecord")
                .forEach(function (result, index) {
                    selectedRecord.push(result.RecordGuid);
                });
            Planning.ProjectsPlanningPerformCallback(true, -1, selectedRecord);
        } else {
            Planning.ProjectsPlanningPerformCallback(true);
        }
        planning.EnableDisableGantChartMenu(true);
    };

    planning.PlanningViewCloseUp = function (s, e) {
        actionToPerform = enums.ActionToPerform.Default;
        pcModalPlanningView.Hide();
    };
    planning.PlanningViewResourcesCheckedChanged = function () {
        Planning.ShowHideAssignmentsContent(ResourcesPlanningView.GetChecked());
    };
    planning.PlanningViewZoomToSelectionCheckedChanged = function () {
        Planning.ZoomToSelectionPlanning(ZoomToSelectionPlanningView.GetChecked());
    };
    planning.PlanningViewPlanningOptions = function () {
        View.load('AddPlanningOptions', {
            objectId: -1,
            recordId: -1
        },true);
    };
    planning.PlanningViewOnScaleListComboValueChanged = function (s, e) {
        majorScaleTypeSelect = s.GetValue();
        _InternalFunctions.updateFromSelectedMajorScaleType();
    };
    planning.PlanningViewCollapseExpand = function (isCollapse) {
        var items = window[Planning.getGanttChartId()].items;
        if (items.length > 0) {
            if (isCollapse === 0) {
                items.forEach(function (item) {
                    if (item.hasChildren) window[Planning.getGanttChartId()].collapseItem(item);
                });
            } else {
                items.forEach(function (item) {
                    if (item.hasChildren) window[Planning.getGanttChartId()].expandItem(item);
                });
            }
        }
    };

    planning.PlanningViewRemoveFromList = function () {
        var item = window[Planning.getGanttChartId()].getSelectedItem();
        if (item != null) {
            var parent = item.parent;
            if (item.parent == null) parent = item;
            if (parent != null) {
                var children = parent.children;
                if (children != null && children.length > 0) {
                    window[Planning.getGanttChartId()].removeItems(children);
                }
                window[Planning.getGanttChartId()].removeItem(parent);
                window[Planning.getGanttChartId()].refreshGridItems();
            }
        };
    };


    planning.ConfirmOpenProjectTemplate = function (s, e) {
        var message = Helper.T("ThisWillOverwriteAllYourStages") + " " + SwResourceObject.DoYouWantToContinue;
        Helper.ShowConfirmPopUp("SolidWorks", message, "Planning.OpenProjectSaveTemplate()");
    };
    planning.OpenProjectSaveTemplate = function (s, e) {
        var templateId = OpenProjectGrid.GetRowKey(OpenProjectGrid.GetFocusedRowIndex());
        var optionRbl = Number(OpenProjectsOptionRbl.GetValue());
        if (optionRbl == 0) templateId = -1;
        if (optionRbl == 1) {
            if (templateId < 1) {
                Notification.SetNotification(SwResourceObject.PleaseSelectATemplate, 'warning', 3500);
                return;
            }
        }
        $.ajax({
            url: '/Projects/SaveProjectTemplate',
            type: "POST",
            dataType: "json",
            data: {
                objectId: AppV.GetGlobals().ObjectId,
                recordId: AppV.GetGlobals().RecordId,
                recordGuid: AppV.GetGlobals().RecordGuid,
                templateId: templateId,
                startDate: OpenProjectStartDate.GetText(),
                optionRbl: optionRbl,
            },
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    actionToPerform = enums.ActionToPerform.Default;
                    pcModalOpenProject.Hide();
                    Planning.ProjectsPlanningPerformCallback(true);
                }
                else {
                    Notification.SetNotification(res.Message, 'warning', 3500);
                }
            },
            error: function (response) {
            }
        });
    };
    planning.OpenProjectGridBeginCallback = function (s, e) {
        e.customArgs["objectId"] = AppV.GetGlobals().ObjectId;
    };
    planning.OpenProjectCloseUp = function (s, e) {
        actionToPerform = enums.ActionToPerform.Default;
        pcModalOpenProject.Hide();
    };
    planning.OpenProjectGridFocusedRowChanged = function (s, e) {
        var key = s.GetRowKey(s.GetFocusedRowIndex());
        if (key > 0)
            Planning.ProjectsPlanningPerformCallback(true, key);
    };
    planning.OptionRblSelectedIndexChanged = function (s, e) {
        var optionRbl = Boolean(Number(OpenProjectsOptionRbl.GetValue()));
        OpenProjectStartDate.SetEnabled(optionRbl);
        OpenProjectResources.SetEnabled(optionRbl);
        CmbViewOptionsOpen.SetEnabled(optionRbl);
        OpenProjectGrid.SetEnabled(optionRbl);
    };
    planning.OpenProjectResourcesCheckedChanged = function (s, e) {
        Planning.ShowHideAssignmentsContent(OpenProjectResources.GetChecked());
    };

    planning.PlanningDeleteItems_Click = function (s, e) {
        var items = window[Planning.getGanttChartId()].getSelectedItems();
        if (items.length == 0) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }
        var hasChildren = false; var selectedItems = [];
        items.forEach(function (element) {
            selectedItems.push(element.key);
            if (element.hasChildren) hasChildren = true;
        });
        if (hasChildren) {
            Notification.SetNotification(Helper.T("YouMustRemoveAllChildrenBeforeDeletingThisItem"), 'warning', 3500);
            return;
        }
        if (selectedItems.length == 0) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }
        $.ajax({
            url: '/Projects/DeleteItemsPlanning',
            type: "POST",
            data: {
                selectedItems: selectedItems,
                recordGuid: AppV.GetGlobals().RecordGuid,
                deleteUnEdited: DeleteUnEditedTasksCB.GetChecked()
            },
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    items.forEach(function (element) {
                        window[Planning.getGanttChartId()].removeItem(element, true); // Also remove successors' predecessor information.
                        Planning.refreshOtherViews();
                    });
                    pcModalDeleteItem.Hide();
                } else {
                    Notification.SetNotification(SwResourceObject.FailedToDeleteItems, 'warning', 3500);
                }
            },
            error: function (response) {
                pcModalDeleteItem.Hide();
            }
        });
    };

    planning.getChartItemArea = function (item) {
        var undefinedType = 'undefined', svgns = 'http://www.w3.org/2000/svg';
        var document = item.ganttChartView.ownerDocument;
        if (typeof item.chartItemArea === undefinedType)
            item.chartItemArea = document.createElementNS(svgns, 'g');
        for (var i = item.chartItemArea.childNodes.length; i-- > 0;)
            item.chartItemArea.removeChild(item.chartItemArea.childNodes[i]);
        return item.chartItemArea;
    };

    planning.SetIconColumnGanttChartView = function (item) {
        var rectangle = document.createElement('div');
        rectangle.innerHTML = '&nbsp;';
        if (item.isMilestone) {
            rectangle.setAttribute('class', 'solidworks diamond16black');
        }
        else if (item.hasChildren) {
            rectangle.setAttribute('class', 'solidworks stagesummary16x16');
        }
        else if (item.areDependencyConstraintsEnabled != undefined && !item.areDependencyConstraintsEnabled) {
            rectangle.setAttribute('class', 'solidworks stagemanualpin16x16green');
        }
        else {
            rectangle.setAttribute('class', 'solidworks splitstage16x16none');
        }
        return rectangle;
    };

    planning.SetCompletedEffortColumnTemplate = function (item, durationUnits) {
        var complitework = DlhSoft.Controls.GanttChartView.getCompletedEffortColumnTemplate(item, 64).value;
        complitework = (durationUnits == true ? Number(parseFloat(complitework / 8).toFixed(2)) : Number(parseFloat(complitework).toFixed(2)))
        var rectangle = document.createElement('input');
        rectangle.setAttribute('type', 'text');
        rectangle.setAttribute('value', complitework);
        rectangle.setAttribute('style', 'background-color: Transparent; width: 64px; border-width: 0px; padding: 0px');
        return rectangle;
    };

    planning.SetWorkColumnGanttChartView = function (item) {
        var work = parseInt(item.customCompletedWorkValue);
        var rectangle = document.createElement('input');
        rectangle.setAttribute('type', 'text');
        rectangle.setAttribute('value', work);
        rectangle.setAttribute('style', 'background-color: Transparent; width: 64px; border-width: 0px; padding: 0px');
        return rectangle;
    };
    planning.SetDynamicHightPlanning = function (Id) {
        var defaultvalue = Id == Planning.getloadChartViewId() ? 60 : 40;
        var ribbon = 0;
        if (document.getElementById("ribbonPrpCard") != null) {
            ribbon = document.getElementById("ribbonPrpCard").clientHeight;
        }
        if (AppV.GetGlobals().isMainWindow) {
            var idSV = Planning.getScheduleChartViewId();
            var idLV = Planning.getloadChartViewId();
            if (idSV !== "" || idSV !== null) {
                document.getElementById(idSV).style.height = "230px";
            }
            if (idLV !== "" || idLV !== null) {
                document.getElementById(idLV).style.height = "230px";
            }
            document.getElementById(Id).style.height = "230px";
        } else {
            var height = document.body.clientHeight - (window[Planning.getGanttChartId()].clientHeight + ribbon + defaultvalue);
            document.getElementById(Id).style.height = height + "px";
            //var idSVP = Planning.getScheduleChartViewId();
            //var idLVP = Planning.getloadChartViewId();
            //if (idSVP !== "" || idSVP !== null) { document.getElementById(idSVP).style.height = height + "px !important";   }
            //if (idLVP !== "" || idLVP !== null) { document.getElementById(idLVP).style.height = height + "px !important";   }
        }
    };


    planning.ItemChangeActionSuccess = function (item) {
        if (!AppV.GetGlobals().isMainWindow) {
            if (item == null)
                return;
            var stageId = item.key;
            if (Helper.ItemiUndefinedOrNull("ProjectsPlanningCardSection")) {
                var tabName = ProjectsPlanningCardSection.GetActiveTab().name;
                Planning.TabClickProjectsPlanningCardSection(tabName, true, stageId);
            }
        }
    };

    planning.TabClickProjectsPlanningCardSection = function (tabName, itemChange = false, itemChangestageId = -1) {
        if (typeof window[Planning.getGanttChartId()] === "undefined" || window[Planning.getGanttChartId()] === null) return;
        var item = window[Planning.getGanttChartId()].selectedItem;
        if (item == null) {
            if (itemChange) stageId = itemChangestageId;
            if (stageId > 0) {
                window[Planning.getGanttChartId()].items.forEach(function (itemS) {
                    if (itemS.key === stageId) item = itemS;
                });
            }
            if (item === null)
                return;
        }
        var stageId = item.key;
        if (itemChange) stageId = itemChangestageId;
        if (stageId == -1 || stageId == undefined)
            return;
        window.Processes.State.StageId = stageId;
        var idTab = tabName + "" + stageId;
        var reload = false;
        var callbackTab = true;
        if (Planning.selectedScheduleChartPlanning || Planning.selectedLoadChartPlanning)
            return;

        if (!_InternalFunctions.IsIdInArray(planning.TabClickStageId, idTab)) {
            reload = true;
        }
        if (Helper.ItemiUndefinedOrNull("PropertiesPlanning")) {
            callbackTab = PropertiesPlanning.GetChecked();
            if (callbackTab) {
                if (Helper.ItemiUndefinedOrNull("mainProjectsSplFullScreenMode")) {
                    var propertyPanel = mainProjectsSplFullScreenMode.GetPaneByName("mainProjectsSplPropertyPanel");
                    if (propertyPanel != null) {
                        callbackTab = !propertyPanel.IsCollapsed();
                    }
                }
            }
        }
        if (typeof window[Planning.getGanttChartId()] !== "undefined") {
            var items = window[Planning.getGanttChartId()].getSelectedItems();
            if (items.length > 1 &&
                tabName !== "ToDo" &&
                tabName !== "Resources") {
                callbackTab = false;
            }
        }
        if (callbackTab) {
            if (tabName === "Properties") {
             
                window["cbPropertiesTabNewFrom"].PerformCallback({
                    objectId: AppV.GetGlobals().ObjectId,
                    recordId: AppV.GetGlobals().RecordId,
                    groupObjIdSo: -1,
                    getFields: true,
                    actionToPerform: enums.ActionToPerform.Planning,
                    stageId: stageId
                });
            } else if (tabName === "ToDo") {
                var selectedItems = [];
                var ShowAllSubStagesName = "ShowAllSubStagesToDoChkb" + enums.Modules.Planning;
                if (typeof window[ShowAllSubStagesName] !== 'undefined') {
                    if (window[ShowAllSubStagesName].GetChecked() === true) {
                        selectedItems = Planning.ExtractChildrensSelectedStages(stageId);
                    } else {
                        selectedItems = Planning.GetSelectedStages(stageId);
                    }
                }

                window.cbpToDoSectionPlanning.PerformCallback({
                    objectId: AppV.GetGlobals().ObjectId,
                    recordGuid: AppV.GetGlobals().RecordGuid,
                    stageId: stageId,
                    selectedStageIds: selectedItems
                });
            }
            else if (tabName === "Resources") {
                //var showAllStages = Resources.ShowAllStages();
                //if (showAllStages) 
                reload = true;
                Resources.PerformCallbackResourcesTab(stageId, reload, enums.Modules.Planning);
            }
            else if (tabName === "ProjectsDeliverables") {
                var pdShowAllStages = RzProjectDeliverables.Default.ShowAllStages();
                var pdShowAllSubStages = RzProjectDeliverables.Default.ShowAllSubStages();
                if (pdShowAllStages) reload = true;

                var selectedStagesIds = [];
                if (pdShowAllSubStages) {
                    selectedStagesIds = Planning.ExtractChildrensSelectedStages(stageId);
                }

                window.cbpProjectDeliverablesPlanning.PerformCallback({
                    objectId: AppV.GetGlobals().ObjectId,
                    recordGuid: AppV.GetGlobals().RecordGuid,
                    recordId: AppV.GetGlobals().RecordId,
                    shouldReload: reload,
                    stageId: stageId,
                    showAllStages: pdShowAllStages,
                    showAllSubStages: pdShowAllSubStages,
                    selectedStageIds: selectedStagesIds
                });
            }
            else if (tabName === "Notifications") {
                Notifications.PerformCallbackNotifications(AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordGuid, true);
            }
            else if (tabName === "Timesheets") {
                window.cbpTimesheetsGrid.PerformCallback({
                    IdRecord: AppV.GetGlobals().RecordId,
                    UserId: -1,
                    stageId: stageId,
                    isEdit: true,
                    showTasks: false,
                    reload: reload
                });
            }
            else if (tabName === "Calendar") {
                window.cbpCalendar.PerformCallback(
                    {
                        objectId: AppV.GetGlobals().ObjectId,
                        recordGuid: AppV.GetGlobals().RecordGuid,
                        //recordId: AppV.GetGlobals().RecordId,
                        //shouldReload: true,
                        stageId: stageId
                    });
            }
        }
        Planning.SetPlanningTabsRights();
        Planning.PerformPlanningHeightChanges(tabName);
    };


    planning.mainProjectsSplFullScreenModeResizeCompleted = function (s, e) {
        if (e.pane.name === "mainProjectsSplGridPanel") {
            Planning.ResizePlanningModule();
        }
    };
    planning.ResizePlanningModule = function () {
        if (Helper.ItemiUndefinedOrNull("ProjectsPlanningCardSection")) {
            var tabName = ProjectsPlanningCardSection.GetActiveTab().name;
            Planning.PerformPlanningHeightChanges(tabName);
        }
    };

    planning.PerformPlanningHeightChanges = function (tabName) {
        var heightPropertyPanel = mainProjectsSplFullScreenMode.GetPaneByName("mainProjectsSplPropertyPanel").lastHeight - 50;
        var modulName = enums.Modules.Planning;
        if (tabName === "Properties") {
            Planning.CalculatePropertiesSection();
        } else if (tabName === "ToDo") {
            RzProperties.CalculateHeightForToDo(modulName);
        } else if (tabName === "Resources") {
            if (typeof ResourcesGrid != 'undefined') {
                ResourcesGrid.SetHeight(heightPropertyPanel);
            }
        } else if (tabName === "ProjectsDeliverables") {
            RzProperties.CalculateHeightForProjectDeliverables(modulName);
        } else if (tabName === "Notifications") {
            RzProperties.CalculateHeightForNotifications(modulName);
        } else if (tabName === "Timesheets") {
            if (typeof TimesheetsGrid != 'undefined') {
                TimesheetsGrid.SetHeight(heightPropertyPanel);
            }
        } else if (tabName === "Calendar") {
            if (typeof CalendarScheduler != 'undefined') {
                CalendarScheduler.SetHeight(heightPropertyPanel);
            }
        }
        RzProperties.CalculateHeightForGanttChart();
    };
    planning.CalculatePropertiesSection = function () {
        var height = mainProjectsSplFullScreenMode.GetPaneByName("mainProjectsSplPropertyPanel").lastHeight;
        var spliterName = "splResizingPlanningProperties" + "_1_CC";
        var spliter = document.getElementById(spliterName);
        if (spliter != null) {
            spliter.style.height = height + "px";
        }
        var els = document.getElementsByClassName("scrollableDivDocs"), i;
        var scroll = height + 100;
        for (i = 0; i < els.length; i++) {
            els[i].style.height = scroll + "px";
        }

    };

    planning.OnScaleListComboInit = function (s, e) {
        s.SetSelectedIndex(1);
    };

    planning.OnScaleListComboValueChanged = function (s, e) {
        majorScaleTypeSelect = s.GetValue();
        _InternalFunctions.updateFromSelectedMajorScaleType();
    };


    planning.onImportXMLUploadBtnOk = function (e) {
        if (window.uFileImportXML.GetFileNames().length !== 0) {
            window.uFileImportXML.Upload();
        } else {
            Notification.SetNotification(window.SwResourceObject.PleaseSelectAFile, 'warning', 3500);
        }
    };



    planning.onPrimaryFileUploadComplete = function (e) {
        if (e.callbackData) {
            $.ajax({
                url: '/Projects/GetXMLDataFromFile',
                type: "POST",
                data: {
                    fileName: e.callbackData
                },
                success: function (response) {
                    if (response.Success) {
                        planning.isImportXml = true;
                        var settingsS = window[Planning.getGanttChartId()].settings;
                        var projectSerializer = DlhSoft.Controls.GanttChartView.ProjectSerializer.initialize(window[Planning.getGanttChartId()], settingsS);
                        parser = new DOMParser();
                        xmlDoc = parser.parseFromString(response.XmlDocument, "text/xml");
                        projectSerializer.loadXml(xmlDoc);
                        //To get Interruptions,Calendar
                        var xmlProject = xmlDoc.getElementsByTagName("Project")[0];
                        var xmlTasks = xmlDoc.getElementsByTagName("Tasks")[0];
                        for (var i = 0; i < xmlTasks.childElementCount; i++) {
                            window[Planning.getGanttChartId()].items[i].resources = window[Planning.getGanttChartId()].items[i].assignmentsContent;
                            var xmlchildren = xmlTasks.children[i];
                            var interruption = xmlchildren.getElementsByTagName("Interruptions")[0];
                            var arrayInterruption = [];
                            if (interruption !== undefined || interruption !== null) {
                                if (interruption.textContent.includes('|')) {
                                    arrayInterruption = interruption.textContent.split('|');
                                } else {
                                    if (interruption.textContent.includes('/')) {
                                        arrayInterruption.push(interruption.textContent);
                                    }
                                }
                            }
                            if (!window[Planning.getGanttChartId()].items[i].interruptions)
                                window[Planning.getGanttChartId()].items[i].interruptions = [];
                            arrayInterruption.forEach(function (iteminterruption) {
                                var itemData = iteminterruption.split('/');
                                if (itemData.length > 1) {
                                    window[Planning.getGanttChartId()].items[i].interruptions.push({ offset: parseFloat(itemData[0]), duration: parseFloat(itemData[1]) });
                                }
                            });
                        }
                        if (window[Planning.getGanttChartId()].items.length == 0) {
                            Notification.SetNotification(SwResourceObject.FileCannotBeImported, 'warning', 3500);
                        } else {
                            window[Planning.getGanttChartId()].items.forEach(function (item, index) {
                                item = _InternalFunctions.SetCustomValueItemPlanningImportXML(item);
                                var work = Planning.getWork(item.start, item.interruptions, item.finish);
                                item.work = work;
                                var completedWorkNew = Planning.getWork(item.start, item.interruptions, item.completedFinish);
                                item.completedWorkNew = completedWorkNew;
                                if (item.completedWorkNew > item.work) {
                                    item.completedWorkNew = item.work;
                                    completedWorkNew = item.work;
                                };
                                item.completionPercent = completedWorkNew / work * 100;
                                window[Planning.getGanttChartId()].items[index] = item;
                                Planning.updateItem(item);
                                Planning.updateParents(item);
                            });
                            window[Planning.getGanttChartId()].refresh();
                            window[Planning.getGanttChartId()].refreshItems();
                            _InternalFunctions.SaveAllPlanningItems("Insert", "Insert");
                            Planning.ProjectsPlanningPerformCallback(true);
                        }
                        pcModalImportXML.Hide();
                        planning.isImportXml = false;
                    } else {
                        Notification.SetNotification(SwResourceObject.FileNotFound, 'warning', 3500);
                    }
                },
                error: function (response) {
                    window.loadingPanel.Hide();
                }
            });
        }
        else { Notification.SetNotification(window.SwResourceObject.UploadFileToServer, 'error', 3500); }
    };

    planning.ScheduleChartInit = function (s, e) {
        var scheduleChartPanel = document.querySelector("#" + Planning.getScheduleChartPanelId());
        if (scheduleChartPanel !== null) {
            scheduleChartPanel.style.display = 'inherit';
        }
        var scheduleChartItems = window[Planning.getGanttChartId()].getScheduleChartItems();
        var scheduleChartSettings = {
            isReadOnly: true, selectionMode: 'None', isMouseWheelZoomEnabled: false,
            //useMultipleLinesPerRow: true, areIndividualItemAppearanceSettingsApplied: true, isAlternatingItemBackgroundInverted: true
        };
        window[Planning.getGanttChartId()].copyCommonSettings(scheduleChartSettings);
        var scheduleChartView = document.querySelector("#" + Planning.getScheduleChartViewId());
        scheduleChartSettings.standardBarStyle = standardBarStyle;
        initializeGanttChartTheme(scheduleChartSettings, theme);
        initializeGanttChartTemplates(scheduleChartSettings, theme);
        DlhSoft.Controls.ScheduleChartView.initialize(scheduleChartView, scheduleChartItems, scheduleChartSettings);
        scheduleChartSettings.displayedTimeChangeHandler = function (displayedTime) { Planning.refreshViewsDisplayedTime('ScheduleChart', displayedTime); }
        scheduleChartSettings.splitterPositionChangeHandler = function (gridWidth, chartWidth) { Planning.refreshViewsSplitterPosition('ScheduleChart', gridWidth, chartWidth); }
    };
    planning.closeScheduleChartView = function () {
        var scheduleChartPanel = document.querySelector("#" + Planning.getScheduleChartPanelId());
        if (scheduleChartPanel != null)
            scheduleChartPanel.style.display = 'none';
    };
    planning.LoadChartInit = function (s, e) {
        var loadChartPanel = document.querySelector("#" + Planning.getloadChartPanelId());
        if (loadChartPanel != null)
            loadChartPanel.style.display = 'inherit';
        var loadChartItems = window[Planning.getGanttChartId()].getLoadChartItems();
        var loadChartSettings = { selectionMode: 'None', isMouseWheelZoomEnabled: false };
        window[Planning.getGanttChartId()].copyCommonSettings(loadChartSettings);
        var loadChartView = document.querySelector("#" + Planning.getloadChartViewId());
        initializeLoadChartTheme(loadChartSettings, theme);
        DlhSoft.Controls.LoadChartView.initialize(loadChartView, loadChartItems, loadChartSettings);
        loadChartSettings.displayedTimeChangeHandler = function (displayedTime) { Planning.refreshViewsDisplayedTime('LoadChart', displayedTime); }
        loadChartSettings.splitterPositionChangeHandler = function (gridWidth, chartWidth) { Planning.refreshViewsSplitterPosition('LoadChart', gridWidth, chartWidth); }
        Planning.refreshLoadChartResourceSelector();
    };

    planning.closeLoadChartView = function () {
        var loadChartPanel = document.querySelector("#" + Planning.getloadChartPanelId());
        loadChartPanel.style.display = 'none';
    };

    planning.PertChartInit = function (s, e) {
        var modalID = "pcModalPertChart_PWC-1";
        document.getElementById(modalID).style.overflow = 'auto';
        var pertChartPanel = document.querySelector('#pertChartPanel');
        if (pertChartPanel !== null)
            pertChartPanel.style.display = 'inherit';
        // Optionally, pass 0 as method parameter to generate a lighter diagram for root tasks only.
        var pertChartItems = window[Planning.getGanttChartId()].getPertChartItems();
        var pertChartSettings = { chartMargin: 2, snapRearrangedItemsToGuidelines: false };
        var pertChartView = document.querySelector('#pertChartView');
        initializePertChartTheme(pertChartSettings, theme);
        initializePertChartTemplates(pertChartSettings, theme);
        DlhSoft.Controls.Pert.PertChartView.initialize(pertChartView, pertChartItems, pertChartSettings);
        var criticalItems = pertChartView.getCriticalItems();
        for (var i = 0; i < criticalItems.length; i++) {
            var item = criticalItems[i];
            item.shapeStyle = 'stroke: #e31d3b; fill: White';
            pertChartView.refreshItem(item);
        }

        var everyChild = document.querySelectorAll("#pertChartView div");
        for (i = 0; i < everyChild.length; i++) {
            var height = everyChild[i].style.height;
            if (i == 4) {  //height == "auto" && i == 4
                everyChild[i].style.height = "470px";
            }
        }
        if (document.getElementById(modalID) != null)
            document.getElementById(modalID).style.overflowY = "hidden";
    };
    planning.NetworkDiagramInit = function (s, e) {
        var modalID = "pcModalNetworkDiagram_PWC-1";
        document.getElementById(modalID).style.overflow = 'auto';
        var networkDiagramPanel = document.querySelector('#networkDiagramPanel');
        if (networkDiagramPanel != null)
            networkDiagramPanel.style.display = 'inherit';
        // Optionally, pass 0 as method parameter to generate a lighter diagram for root tasks only.
        var networkDiagramItems = window[Planning.getGanttChartId()].getNetworkDiagramItems();
        var networkDiagramSettings = { diagramMargin: 2, snapRearrangedItemsToGuidelines: false };
        var networkDiagramView = document.querySelector('#networkDiagramView');

        initializePertChartTheme(networkDiagramSettings, theme);
        initializePertChartTemplates(networkDiagramSettings, theme);

        DlhSoft.Controls.Pert.NetworkDiagramView.initialize(networkDiagramView, networkDiagramItems, networkDiagramSettings);
        var criticalItems = networkDiagramView.getCriticalItems();
        for (var i = 0; i < criticalItems.length; i++) {
            var item = criticalItems[i];
            item.shapeStyle = 'stroke: #e31d3b; fill: White';
            networkDiagramView.refreshItem(item);
        }
        // Optionally, reposition end nodes in order to get better visualization.
        // networkDiagramView.repositionEnds();
        var everyChild = document.querySelectorAll("#networkDiagramView div");
        for (i = 0; i < everyChild.length; i++) {
            var height = everyChild[i].style.height;
            if (i == 4) { //height == "auto" && i == 4
                everyChild[i].style.height = "480px";
            }
        }
        if (document.getElementById(modalID) != null)
            document.getElementById(modalID).style.overflowY = "hidden";
    };

    planning.RibbonCheckedChangedSettingsPlanning = function (name) {
        switch (name) {
            case "PropertiesPlanning":
                var showProperties = PropertiesPlanning.GetChecked();
                var IsCollapsed = Planning.SetSpliterPanleCollapsed();
                if (showProperties) {
                    if (IsCollapsed) {
                        mainProjectsSplFullScreenMode_0i0i0i0i1_S_CB_Img.click();
                    }
                }
                else {
                    mainProjectsSplFullScreenMode_0i0i0i0i1_S_CF_Img.click();
                }
                planning.showProperties = showProperties;
                break;
            case "ResourcesPlanning":
                Planning.ShowHideAssignmentsContent(ResourcesPlanning.GetChecked());
                break;
            case "BaseLinePlanning":
                Planning.toggleBaseline(BaseLinePlanning.GetChecked());
                break;
            case "CriticalPathPlanning":
                Planning.highlightCriticalPath(CriticalPathPlanning.GetChecked());
                break;
            case "NonWorkingDaysPlanning":
                Planning.ShowHideNonWorkingDaysPlanning(NonWorkingDaysPlanning.GetChecked());
                break;
            case "ZoomToSelectionPlanning":
                Planning.ZoomToSelectionPlanning(ZoomToSelectionPlanning.GetChecked());
                break;
            case "AutomaticSchedulingPlanning":
                Planning.toggleDependencyConstraints(AutomaticSchedulingPlanning.GetChecked());
                break;
        }
    };

    planning.PlanningOptionsSave = function (s, e) {
        var message = Helper.T("ThisWillChangeTheExistingGanttChartPlan") + "  " + Helper.T("DoYouWantToContinue");
        Helper.ShowConfirmPopUp("SolidWorks", message, "window.Planning.ConfirmPlanningOptionsSave()");
    };
    planning.ConfirmPlanningOptionsSave = function (s, e) {
        if (AppV.GetGlobals().isMainWindow) {
            pcModalPlanningOptions.Hide();
            return;
        }
        if (MondayHours.GetValue() == 0 && TuesdayHours.GetValue() == 0 && WednesdayHours.GetValue() == 0
            && ThursdayHours.GetValue() == 0 && FridayHours.GetValue() == 0 && SaturdayHours.GetValue() == 0 && SundayHours.GetValue() == 0) {
            Notification.SetNotification(Helper.T("YouCannotSetAllDaysToBeNonworkingDays"), 'warning', 3500);
            return;
        }
        $.ajax({
            url: '/Projects/SavePlanningOptions',
            type: "POST",
            data: {
                objectId: AppV.GetGlobals().ObjectId,
                recordId: AppV.GetGlobals().RecordId,
                mondayHours: MondayHours.GetValue(),
                tuesdayHours: TuesdayHours.GetValue(),
                wednesdayHours: WednesdayHours.GetValue(),
                thursdayHours: ThursdayHours.GetValue(),
                fridayHours: FridayHours.GetValue(),
                saturdayHours: SaturdayHours.GetValue(),
                sundayHours: SundayHours.GetValue(),
                defaultStartTime: CmbDefaultStartTime.GetValue(),
                weekStartDay: parseInt(CmbWeekStartDay.GetValue()),
                duration: parseInt(CmbDuration.GetValue())
            },
            success: function (response) {
                if (response.Success) {
                    Planning.ProjectsPlanningPerformCallback(true);
                    pcModalPlanningOptions.Hide();
                } else {
                    Notification.SetNotification(SwResourceObject.FailedToSaveChanges, 'warning', 3500);
                }
            },
            error: function (response) {
                window.loadingPanel.Hide();
            }
        });

    };

    planning.PlanningMoveProject = function (s, e) {
        var items = window[Planning.getGanttChartId()].items;
        if (items.length == 0) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }
        var hourstoMove = MoveProjectWorkingHoursSe.GetValue();
        var projectMove = MoveProjectsOptionRbl.GetValue();
        var moveBaselines = MoveBaselinesCkb.GetValue();
        var selectedItems = [];
        var totalMilliseconds = _InternalFunctions.GetTimeTotalMilliseconds(hourstoMove, false);
        items.forEach(function (element) {
            var baselineStart = "";
            var totalMilliseconds = _InternalFunctions.GetTimeTotalMilliseconds(hourstoMove, false);
            if (projectMove == "0") { totalMilliseconds = -totalMilliseconds; };
            var start = window[Planning.getGanttChartId()].getFinish(element.start, totalMilliseconds, window[Planning.getGanttChartId()].settings);
            if (moveBaselines) {
                baselineStart = DlhSoft.Controls.GanttChartView.getFinish(element.baselineStart, totalMilliseconds, window[Planning.getGanttChartId()].settings);
                baselineStart = _InternalFunctions.GetFullDateString(baselineStart);
            }
            start = _InternalFunctions.GetFullDateString(start);
            element = element.key + " -- " + start + " -- " + baselineStart;
            selectedItems.push(element);
        });
        var seconds = totalMilliseconds / 1000;
        $.ajax({
            url: '/Projects/MoveProjectItems',
            type: "POST",
            data: {
                selectedItems: selectedItems,
                objectId: AppV.GetGlobals().ObjectId,
                recordGuid: AppV.GetGlobals().RecordGuid,
                seconds: seconds,
                moveUnEditedTasks: MoveUnEditedTasksCkb.GetChecked(),
                moveEditedTasks: MoveEditedTasksCkb.GetChecked(),
                moveBaselines: moveBaselines
            },
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    pcModalMoveProject.Hide();
                    Planning.ProjectsPlanningPerformCallback(true);
                    Notification.SetNotification(SwResourceObject.SavedSuccessfully, 'sucess', 3500);
                } else {
                    Notification.SetNotification(res.message, 'warning', 3500);
                }
            },
            error: function (response) {
                window.loadingPanel.Hide();
            }
        });
    };

    planning.PlanningUpdateFromTasks = function (s, e) {
        var selectedItems = [];
        var items = [];
        var isSelected = (SEUpdateFromTasksSelected.GetValue() === "0" ? false : true);
        var ignoreMilestone = SEIgnoreMilestones.GetValue();
        if (!isSelected) {
            items = window[Planning.getGanttChartId()].getSelectedItems();
        } else {
            items = window[Planning.getGanttChartId()].items;
        }
        items.forEach(function (item, index) {
            if (ignoreMilestone)
                if (!item.hasChildren) {
                    var ignorItem = ignoreMilestone && item.isMilestone;
                    if (!ignorItem) {
                        selectedItems.push(item.key);
                    }
                }
        });
        if (selectedItems.length == 0) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }
        var hasNoTask = CkbUpdateFromTasksNoTask.GetValue();
        var taskhours = SEUpdateFromTasksHours.GetValue();
        var hasAdditionValue = CkbUpdateFromTasksValueOf.GetValue();
        var hasAdditionValueHP = (SEUpdateFromTasksEachValue.GetValue() === "0" ? false : true);
        var additionValuehours = 0;
        if (hasAdditionValue) {
            if (!hasAdditionValueHP) {
                additionValuehours = SEUpdateFromTasksEachValueH.GetValue();
            } else {
                additionValuehours = SEUpdateFromTasksEachValueP.GetValue();
            }
        }
        $.ajax({
            url: '/Projects/UpdateFromTasks',
            type: "POST",
            data: {
                selectedItems: selectedItems,
                objectId: AppV.GetGlobals().ObjectId,
                recordId: AppV.GetGlobals().RecordId,
                taskhours: taskhours,
                additionValuehours: additionValuehours,
                hasNoTask: hasNoTask,
                hasAdditionValue: hasAdditionValue,
                hasAdditionValueHP: hasAdditionValueHP,
                ignoreMilestone: ignoreMilestone
            },
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    pcModalUpdateFromTasks.Hide();
                    Planning.ProjectsPlanningPerformCallback(true);
                    Notification.SetNotification(SwResourceObject.SavedSuccessfully, 'sucess', 3500);
                } else {
                    Notification.SetNotification(res.message, 'warning', 3500);
                }
            },
            error: function (response) {
                window.loadingPanel.Hide();
            }
        });
    };

    planning.PlanningSplitStageModal = function (name) {
        switch (name) {
            case "btnSplitStageSave":
                Planning.ProjectsPlanningPerformCallback(true);
                pcModalSplitStage.Hide();
                break;
            case "btnSplitStageClose":
                Planning.ProjectsPlanningPerformCallback(true);
                pcModalSplitStage.Hide();
                break;
            case "btnSplitStagAdd":
                View.load('AddSplitStageItem', {});
                break;
            case "btnSplitStagRemove":
                Planning.AddRemoveSplitItem("Remove");
                break;
            case "btnSplitStagRemoveAll":
                Helper.ShowConfirmPopUp("SolidWorks", SwResourceObject.AreYouSure, "Planning.AddRemoveSplitItem('RemoveAll')");
                break;
            case "btnSplitStageItemSave":
                Planning.AddRemoveSplitItem("Insert");
                break;
            case "btnSplitStagShowExample":
                Planning.SplitStagShowExample("Insert");
                break;
            case "btnSplitStagExport":
                SplitStageGridView.ExportTo(ASPxClientGridViewExportFormat.Xlsx);
                break;
        }
    };
    planning.SplitStagShowExample = function () {
        if (SplitStageShowExample.style.display != 'none') {
            SplitStageShowExample.style.display = "none";
            btnSplitStagShowExample.SetText(SwResourceObject.ShowExample);
        } else {
            SplitStageShowExample.style.display = "block";
            btnSplitStagShowExample.SetText(Helper.T("HideExample"));
        }
    };
    planning.AddRemoveSplitItem = function (action, outside = 0) {
        var item = window[Planning.getGanttChartId()].selectedItem;
        if (item == null) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }
        if (action === "RemoveAll" && outside === 1 && item.interruptions.length === 0) {
            return;
        }
        if (action === "RemoveAll" && outside === 0 && SplitStageGridView.GetVisibleRowsOnPage() === 0) {
            return;
        }
        var stageId = item.key;
        var position = 0;
        var length = 0;
        var gridKey = 0;
        if (action === "Insert") {
            position = SEPosition.GetValue();
            length = SELength.GetValue();
        }
        if (action === "Remove") {
            gridKey = SplitStageGridView.GetRowKey(SplitStageGridView.GetFocusedRowIndex());
        }
        $.ajax({
            url: '/Projects/AddRemoveSplitItem',
            type: "POST",
            dataType: "json",
            data: {
                stageId: stageId,
                position: position,
                length: length,
                gridKey: Number(gridKey),
                action: action
            },
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    if (action === "RemoveAll") {
                        if (outside === 0)
                            SplitStageGridView.PerformCallback({ stageId: stageId });
                        else
                            Planning.ProjectsPlanningPerformCallback(true);
                    }
                    if ((action === "Insert" || action === "Remove") && outside === 0) {
                        SplitStageGridView.PerformCallback({ stageId: stageId });
                        pcModalSplitStageItem.Hide();
                    }
                }
                else {
                    Notification.SetNotification(res.message, 'warning', 3500);
                    if (action === "Insert" && outside === 0) {
                        pcModalSplitStageItem.Hide();
                    }
                }
            },
            error: function (response) {
            }
        });
    };


    planning.SaveAllPlanningItems = function () {
        _InternalFunctions.SaveAllPlanningItems("Update", "Update");
    };

    planning.SaveAllPlanningItemsOutside = function (action,realaction) {
        _InternalFunctions.SaveAllPlanningItems(action, realaction);
    };

    planning.OpenPlanning = function () {
        var objectId = AppV.GetGlobals().ObjectId;
        var recordId = AppV.GetGlobals().RecordId;
        View.load('AddOpenProject', { objectId: objectId });
    };

    planning.PlanningSplitStage = function () {
        var stageId = Planning.GetSlectedItemStageId();
        if (stageId != -1) {
            View.load('AddPlanningSplitStage', {
                stageId: stageId
            });
        } else {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
        }
    };
    planning.SplitRemainingTimePlanning = function () {
        var item = window[Planning.getGanttChartId()].selectedItem;
        if (item == null) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }
        var content = item.content;
        if (item.isMilestone) { //Some other conditions
            Notification.SetNotification(Helper.T("SelectedStageCannotBeSplit"), 'warning', 3500);
            return;
        }
        var work = DlhSoft.Controls.GanttChartView.getTotalEffortColumnTemplate(64)(item).value;
        var completedWork = DlhSoft.Controls.GanttChartView.getCompletedEffortColumnTemplate(64)(item).value;
        var remwork = work - completedWork;

        var remainingWorkItem = window[Planning.getGanttChartId()].splitRemainingWork(item, completedWork, completedWork);
        if (remainingWorkItem == null) {
            Notification.SetNotification(Helper.T("SelectedStageCannotBeSplit"), 'warning', 3500);
            return;
        }
        item.work = completedWork;
        item.completedWorkNew = completedWork;
        item.content = content;
        var splitsRemaining = [];
        var splitsCurrent = [];
        if (typeof item.interruptions != "undefined") {
            item.interruptions.forEach(function (iteminterruption) {
                if (Number(iteminterruption.offset) < remwork) {
                    splitsRemaining.push({ offset: parseFloat(iteminterruption.offset), duration: parseFloat(iteminterruption.duration) });
                } else {
                    splitsCurrent.push({ offset: parseFloat(iteminterruption.offset), duration: parseFloat(iteminterruption.duration) });
                }
            });
            item.interruptions = splitsCurrent;
        }
        Planning.updateItem(item);
        Planning.updateParents(item);
        var totalMilliseconds = _InternalFunctions.GetTimeTotalMilliseconds(remwork, false);
        remainingWorkItem.finish = DlhSoft.Controls.GanttChartView.getFinish(remainingWorkItem.start, totalMilliseconds, window[Planning.getGanttChartId()].settings);
        window[Planning.getGanttChartId()].scrollToItem(remainingWorkItem);
        var itemtoSplit = _InternalFunctions.SetCustomValueItemPlanning(remainingWorkItem);
        itemtoSplit.work = remwork;
        itemtoSplit.completedWorkNew = 0;
        itemtoSplit.content = content;
        if (splitsRemaining.length > 0) itemtoSplit.interruptions = splitsRemaining;
        window[Planning.getGanttChartId()].refreshItems();
        Planning.refreshOtherViews();
        _InternalFunctions.AddUpdateInsertItemPlanning("Split", itemtoSplit);
    };


    planning.PlanningRefreshSingleStageResources = function (recources) {
        if (Planning.GetResourcesPlanningValue()) {
            var selectedItem = window[Planning.getGanttChartId()].selectedItem;
            if (selectedItem != null) {
                selectedItem.resources = recources;
                selectedItem.assignmentsContent = recources;
                window[Planning.getGanttChartId()].refreshChartItems();
            }
        }
    };

    planning.PlanningAllDataRefreshResources = function () {
        if (Planning.GetResourcesPlanningValue()) {
            Planning.ProjectsPlanningPerformCallback(true);
        }
    };
    planning.GetResourcesPlanningValue = function () {
        var resourcesPlanning = typeof ResourcesPlanning === "undefined" ? false : ResourcesPlanning.GetChecked();
        if (resourcesPlanning === null)
            return false;
        return resourcesPlanning;
    };

    planning.ShowHideAssignmentsContent = function (display) {
        planning.IsResources = display;
        if (display) {
            window[Planning.getGanttChartId()].items.forEach(function (element) {
                if ((element.resources == "" || element.resources == " " || element.resources == null) && !element.hasChildren) {
                    element.assignmentsContent = "";
                } else {
                    element.assignmentsContent = element.resources;
                };
            });
        } else {
            window[Planning.getGanttChartId()].items.forEach(function (element) {
                element.assignmentsContent = "";
            });
        }
        window[Planning.getGanttChartId()].refreshChartItems();
    };

    planning.ShowHideNonWorkingDaysPlanning = function (display) {
        planning.NonWorkingDays = display;
        _InternalFunctions.updateFromSelectedMajorScaleType();
    };
    planning.toggleBaseline = function (baseline) {
        planning.isBaselineVisible = baseline;
        var settings = window[Planning.getGanttChartId()].settings;
        settings.isBaselineVisible = baseline;
        window[Planning.getGanttChartId()].refresh();
    };
    planning.ZoomToSelectionPlanning = function (zoomToSelection) {
        planning.zoomToSelection = zoomToSelection;
        var settings = window[Planning.getGanttChartId()].settings;
        settings.isGridRowClickTimeScrollingEnabled = zoomToSelection;
        window[Planning.getGanttChartId()].refresh();
    };

    planning.toggleDependencyConstraints = function (automaticScheduling) {
        planning.automaticScheduling = automaticScheduling;
        var settings = window[Planning.getGanttChartId()].settings;
        settings.areTaskDependencyConstraintsEnabled = automaticScheduling;
        window[Planning.getGanttChartId()].refresh();
        Planning.refreshOtherViews();
    };

    planning.AddPlanning = function () {
        var item = _InternalFunctions.GetItemToAddInsertPlanning();
        window[Planning.getGanttChartId()].addItem(item);
        window[Planning.getGanttChartId()].refreshItems();
        Planning.refreshOtherViews();
        _InternalFunctions.AddUpdateInsertItemPlanning("Add");
    };
    planning.InsertPlanning = function () {
        var itemSelected = window[Planning.getGanttChartId()].selectedItem;
        if (itemSelected == null) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }
        var item = _InternalFunctions.GetItemToAddInsertPlanning();
        window[Planning.getGanttChartId()].insertItem(window[Planning.getGanttChartId()].selectedItem.index, item);
        Planning.refreshOtherViews();
        _InternalFunctions.AddUpdateInsertItemPlanning("Insert");
    };
    planning.IndentLeftPlanning = function () {
        var item = window[Planning.getGanttChartId()].selectedItem;
        if (item == null)
            return;
        window[Planning.getGanttChartId()].decreaseItemIndentation(item);
        window[Planning.getGanttChartId()].scrollToItem(item);
        Planning.refreshOtherViews();
    };
    planning.IndentRightPlanning = function () {
        var item = window[Planning.getGanttChartId()].selectedItem;
        if (item == null)
            return;
        window[Planning.getGanttChartId()].increaseItemIndentation(item);
        window[Planning.getGanttChartId()].scrollToItem(item);
        Planning.refreshOtherViews();
    };
    planning.MoveUpPlanning = function () {
        if (window[Planning.getGanttChartId()].selectedItem == null)
            return;
        var item = window[Planning.getGanttChartId()].selectedItem;
        window[Planning.getGanttChartId()].moveItemHierarchyUp(item);
        window[Planning.getGanttChartId()].scrollToItem(item);
        Planning.refreshOtherViews();
    };
    planning.MoveDownPlanning = function () {
        if (window[Planning.getGanttChartId()].selectedItem == null)
            return;
        var item = window[Planning.getGanttChartId()].selectedItem;
        window[Planning.getGanttChartId()].moveItemHierarchyDown(item);
        window[Planning.getGanttChartId()].scrollToItem(item);
        Planning.refreshOtherViews();
    };
    planning.refreshOtherViews = function () {
        Planning.refreshScheduleChartView();
        Planning.refreshLoadChartResourceSelector();
        Planning.refreshLoadChartView();
        Planning.closePertChartView();
        Planning.closeNetworkDiagramView();
    };
    planning.refreshScheduleChartView = function () {
        if (window[Planning.getScheduleChartPanelId()] !== undefined || window[Planning.getScheduleChartPanelId()] !== null) {
            if (window[Planning.getScheduleChartPanelId()].style.display != 'none' && !isWaitingToRefreshScheduleChartView) {
                isWaitingToRefreshScheduleChartView = true;
                setTimeout(function () {
                    isWaitingToRefreshScheduleChartView = false;
                    var scheduleChartView = document.querySelector("#" + Planning.getScheduleChartViewId());
                    if (scheduleChartView != null) {
                        scheduleChartView.scheduleChartItems = window[Planning.getGanttChartId()].getScheduleChartItems();
                        window[Planning.getGanttChartId()].copyCommonSettings(scheduleChartView.settings);
                        scheduleChartView.refresh();
                    }
                });
            }
        }
    };
    planning.refreshLoadChartResourceSelector = function () {
        var loadChartResourceFilter = document.querySelector('#loadChartResourceFilter'), i;
        if (loadChartResourceFilter != null) {
            var previouslySelectedResource = loadChartResourceFilter.value;
            for (i = loadChartResourceFilter.childNodes.length; i-- > 2;)
                loadChartResourceFilter.removeChild(loadChartResourceFilter.childNodes[i]);
            var resources = window[Planning.getGanttChartId()].getAssignedResources();
            for (i = 0; i < resources.length; i++) {
                var resource = resources[i];
                var option = document.createElement('option');
                option.appendChild(document.createTextNode(resource));
                if (resource == previouslySelectedResource)
                    option.setAttribute('selected', 'true');
                loadChartResourceFilter.appendChild(option);
            }
        }
    };
    planning.loadChartResourceFilterChanged = function () {
        Planning.refreshLoadChartView();
    };
    planning.refreshLoadChartView = function () {
        if (window[Planning.getloadChartPanelId()] !== undefined || window[Planning.getloadChartPanelId()] !== null) {
            if (window[Planning.getloadChartPanelId()].style.display != 'none' && !isWaitingToRefreshLoadChartView) {
                isWaitingToRefreshLoadChartView = true;
                setTimeout(function () {
                    var loadChartView = document.querySelector("#" + Planning.getloadChartViewId());
                    if (loadChartView != null) {
                        var loadChartResourceFilter = document.querySelector('#loadChartResourceFilter');
                        var resourceFilterValue = loadChartResourceFilter.value;
                        if (resourceFilterValue == '') {
                            loadChartView.loadChartItems = window[Planning.getGanttChartId()].getLoadChartItems();
                            loadChartView.settings.itemHeight = 28;
                            loadChartView.settings.barHeight = 20;
                        }
                        else {
                            loadChartView.loadChartItems = window[Planning.getGanttChartId()].getLoadChartItems([resourceFilterValue]);
                            loadChartView.settings.itemHeight = 112;
                            loadChartView.settings.barHeight = 104;
                        }
                        window[Planning.getGanttChartId()].copyCommonSettings(loadChartView.settings);
                        loadChartView.refresh();
                        isWaitingToRefreshLoadChartView = false;
                    }
                });
            }
        }
    };
    planning.refreshViewsDisplayedTime = function (sourceControlType, displayedTime) {
        if (sourceControlType != 'ScheduleChart' && window[Planning.getScheduleChartPanelId()].style.display != 'none' && !isWaitingToRefreshScheduleChartViewDisplayedTime) {
            isWaitingToRefreshScheduleChartViewDisplayedTime = true;
            setTimeout(function () {
                var scheduleChartView = document.querySelector("#" + Planning.getScheduleChartViewId());
                if (scheduleChartView != null) {
                    scheduleChartView.scrollToDateTime(displayedTime);
                    isWaitingToRefreshScheduleChartViewDisplayedTime = false;
                }
            });
        }
        if (sourceControlType != 'LoadChart' && window[Planning.getloadChartPanelId()].style.display != 'none' && !isWaitingToRefreshLoadChartViewDisplayedTime) {
            isWaitingToRefreshLoadChartViewDisplayedTime = true;
            setTimeout(function () {
                var loadChartView = document.querySelector("#" + Planning.getloadChartViewId());
                if (loadChartView != null) {
                    loadChartView.scrollToDateTime(displayedTime);
                    isWaitingToRefreshLoadChartViewDisplayedTime = false;
                }
            });
        }
        if (sourceControlType != 'GanttChart' && !isWaitingToRefreshGanttChartViewDisplayedTime) {
            isWaitingToRefreshGanttChartViewDisplayedTime = true;
            setTimeout(function () {
                window[Planning.getGanttChartId()].scrollToDateTime(displayedTime);
                isWaitingToRefreshGanttChartViewDisplayedTime = false;
            });
        }
    };
    planning.refreshViewsSplitterPosition = function (sourceControlType, gridWidth, chartWidth) {
        if (sourceControlType != 'ScheduleChart' && window[Planning.getScheduleChartPanelId()].style.display != 'none' && !isWaitingToRefreshScheduleChartViewSplitterPosition) {
            isWaitingToRefreshScheduleChartViewSplitterPosition = true;
            setTimeout(function () {
                var scheduleChartView = document.querySelector("#" + Planning.getScheduleChartViewId());
                if (scheduleChartView != null) {
                    scheduleChartView.setSplitterPosition(gridWidth, chartWidth);
                    isWaitingToRefreshScheduleChartViewSplitterPosition = false;
                }
            });
        }
        if (sourceControlType != 'LoadChart' && window[Planning.getloadChartPanelId()].style.display != 'none' && !isWaitingToRefreshLoadChartViewSplitterPosition) {
            isWaitingToRefreshLoadChartViewSplitterPosition = true;
            setTimeout(function () {
                var loadChartView = document.querySelector('#loadChartView');
                if (loadChartView != null) {
                    loadChartView.setSplitterPosition(gridWidth, chartWidth);
                    isWaitingToRefreshLoadChartViewSplitterPosition = false;
                }
            });
        }
        if (sourceControlType != 'GanttChart' && !isWaitingToRefreshGanttChartViewSplitterPosition) {
            isWaitingToRefreshGanttChartViewSplitterPosition = true;
            setTimeout(function () {
                window[Planning.getGanttChartId()].setSplitterPosition(gridWidth, chartWidth);
                isWaitingToRefreshGanttChartViewSplitterPosition = false;
            });
        }
    };
    planning.closePertChartView = function () {
        var pertChartPanel = document.querySelector('#pertChartPanel');
        //pertChartPanel.style.display = 'none';
    };
    planning.closeNetworkDiagramView = function () {
        var networkDiagramPanel = document.querySelector('#networkDiagramPanel');
        // networkDiagramPanel.style.display = 'none';
    };
    planning.loadProjectXmlContent = function () {
        var projectSerializer = DlhSoft.Controls.GanttChartView.ProjectSerializer.initialize(ganttChartView);
        var loadProjectXmlInput = document.querySelector('#loadProjectXmlInput');
        projectSerializer.loadXml(loadProjectXmlInput.value);
        Planning.closeLoadProjectXml();
    };

    planning.saveProjectXmlFile = function () {
        var oldIsResources = planning.IsResources;
        var xmlData = Planning.saveProjectXml();
        $.ajax({
            url: '/Projects/SaveXmlProjectFile',
            type: "POST",
            data: { xmlData: xmlData },
            success: function (response) {
                if (response.Success) {
                    var filesJson = [];
                    filesJson.push({
                        download: RootUrl + 'File/DownloadFile?fileName=' + encodeURIComponent(response.fileName),
                        filename: response.fileName
                    });
                    Helper.download_multiple_files(filesJson);
                    Planning.ShowHideAssignmentsContent(oldIsResources);
                } else {
                    Notification.SetNotification(SwResourceObject.FileNotFound, 'warning', 3500);
                }
            },
        });
    };


    planning.saveProjectXml = function () {
        Planning.ShowHideAssignmentsContent(true);
        var projectXmlSerializerSettings = { compact: true, spaceSeparated: true };
        var projectSerializer = DlhSoft.Controls.GanttChartView.ProjectSerializer.initialize(window[Planning.getGanttChartId()], projectXmlSerializerSettings);
        var xml = projectSerializer.getXml();
        parser = new DOMParser();
        var xmlDoc = parser.parseFromString(xml, "text/xml");
        var xmlProject = xmlDoc.getElementsByTagName("Project")[0];
        var xmlTasks = xmlDoc.getElementsByTagName("Tasks")[0];
        var DayCalendars = xmlDoc.createElementNS("RevzoneGanttChartShowcase", "DayCalendars");
        var dayCalendarsContent = " ";
        var scheduleP = Planning.projectOptions;
        dayCalendarsContent = scheduleP.DefaultStartTime + "/" + scheduleP.WorkHoursSun + "|";
        dayCalendarsContent += scheduleP.DefaultStartTime + "/" + scheduleP.WorkHoursMon + "|" + scheduleP.DefaultStartTime + "/" + scheduleP.WorkHoursThu + "|";
        dayCalendarsContent += scheduleP.DefaultStartTime + "/" + scheduleP.WorkHoursWed + "|" + scheduleP.DefaultStartTime + "/" + scheduleP.WorkHoursTue + "|";
        dayCalendarsContent += scheduleP.DefaultStartTime + "/" + scheduleP.WorkHoursFri + "|" + scheduleP.DefaultStartTime + "/" + scheduleP.WorkHoursSat;
        DayCalendars.textContent = dayCalendarsContent;
        xmlProject.appendChild(DayCalendars);

        for (var i = 0; i < xmlTasks.childElementCount; i++) {
            var xmlchildren = xmlTasks.children[i];
            var item = window[Planning.getGanttChartId()].items[i];
            var Interruptions = xmlDoc.createElementNS("RevzoneGanttChartShowcase", "Interruptions");
            var interruptionContent = " ";
            if (item !== null || item !== "undefined") {
                var firstTime = false;
                if (item.interruptions.length > 0) {
                    item.interruptions.forEach(function (iteminterruption) {
                        if (!firstTime) {
                            interruptionContent += _InternalFunctions.secondsToTime(iteminterruption.offset * 3600) + "/" + _InternalFunctions.secondsToTime(iteminterruption.duration * 3600);
                            firstTime = true;
                        } else {
                            interruptionContent += "|" + _InternalFunctions.secondsToTime(iteminterruption.offset * 3600) + "/" + _InternalFunctions.secondsToTime(iteminterruption.duration * 3600);
                        }
                    });
                }
            }
            Interruptions.textContent = interruptionContent;
            xmlchildren.appendChild(Interruptions);
            xmlTasks.children[i] = xmlchildren;
        }

        return new XMLSerializer().serializeToString(xmlDoc.documentElement);
    };

    planning.print = function () {
        planning.isPrint = true;
        var timelineStart = _InternalFunctions.GetTimelineStart();
        var timelineFinish = _InternalFunctions.GetTimelineFinish();
        // Print the task hierarchy column and a selected timeline page of 5 weeks (timeline end week extensions would be added automatically, if necessary).
        // Optionally, to rotate the print output and simulate Landscape printing mode (when the end user keeps Portrait selection in the Print dialog), append the rotate parameter set to true to the method call: rotate: true.
        window[Planning.getGanttChartId()].print({ title: 'Gantt Chart (printable)', isGridVisible: true, gridWidth: '35%', columnIndexes: [1, 2, 3, 4], timelineStart: timelineStart, timelineFinish: timelineFinish, preparingMessage: '...' });
        planning.isPrint = false;
        window[Planning.getGanttChartId()].refreshChartItems();
    };
    planning.highlightCriticalPath = function (critical) {
        planning.iscriticalPath = critical;
        for (var i = 0; i < window[Planning.getGanttChartId()].items.length; i++) {
            var item = window[Planning.getGanttChartId()].items[i];
            delete item.barStyle;
            if (!item.hasChildren && window[Planning.getGanttChartId()].isItemCritical(item)) {
                if (critical)
                    item.barStyle = 'stroke: #e31d3b; fill: #e31d3b';
                else
                    item.barStyle = 'fill: url(#BlueGradient); fill-opacity: 0.8; stroke: Blue';
            }
            window[Planning.getGanttChartId()].refreshChartItem(item);
        }
    };

    planning.CalendarsData = function (projectOptions) {
        var defaultTime = projectOptions.DefaultStartTime.split(":");
        var defaultStartTime = parseFloat(defaultTime[0] + "." + defaultTime[1]);//projectOptions.DefaultStartTime
        dayCalendars[0] = { start: defaultStartTime, duration: projectOptions.WorkHoursSun };
        dayCalendars[1] = { start: defaultStartTime, duration: projectOptions.WorkHoursMon };
        dayCalendars[2] = { start: defaultStartTime, duration: projectOptions.WorkHoursTue };
        dayCalendars[3] = { start: defaultStartTime, duration: projectOptions.WorkHoursWed };
        dayCalendars[4] = { start: defaultStartTime, duration: projectOptions.WorkHoursThu };
        dayCalendars[5] = { start: defaultStartTime, duration: projectOptions.WorkHoursFri };
        dayCalendars[6] = { start: defaultStartTime, duration: projectOptions.WorkHoursSat };

    };

    planning.updateDayCalendars = function (projectOptions) {
        //for (var day = 0; day < 7; day++) {
        //    var start = parseFloat(document.getElementById('calendarStart' + day).value);
        //    var duration = parseFloat(document.getElementById('calendarDuration' + day).value);
        //    dayCalendars[day] = { start: start, duration: duration };
        //};
        var defaultTime = projectOptions.DefaultStartTime.split(":");
        var defaultStartTime = parseFloat(defaultTime[0] + "." + defaultTime[1]);//projectOptions.DefaultStartTime
        dayCalendars[0] = { start: defaultStartTime, duration: projectOptions.WorkHoursSun };
        dayCalendars[1] = { start: defaultStartTime, duration: projectOptions.WorkHoursMon };
        dayCalendars[2] = { start: defaultStartTime, duration: projectOptions.WorkHoursTue };
        dayCalendars[3] = { start: defaultStartTime, duration: projectOptions.WorkHoursWed };
        dayCalendars[4] = { start: defaultStartTime, duration: projectOptions.WorkHoursThu };
        dayCalendars[5] = { start: defaultStartTime, duration: projectOptions.WorkHoursFri };
        dayCalendars[6] = { start: defaultStartTime, duration: projectOptions.WorkHoursSat };
        Planning.applyCalendar();
    };

    planning.addInterruption = function () {
        var item = window[Planning.getGanttChartId()].selectedItem;
        if (!item)
            return;
        if (!item.interruptions)
            item.interruptions = [];
        var offset = parseFloat(document.getElementById('interruptionStart').value);
        var duration = parseFloat(document.getElementById('interruptionDuration').value);
        item.interruptions.push({ offset: offset, duration: duration });
        Planning.updateItem(item);
    };

    // Applies the current calendar updating the highlighting scale and all items in the chart (respecting their interruptions as well, if set).
    planning.applyCalendar = function () {
        // Compute the working start and working finish days of week, and the maximal start and minimal finish times of day (in hours).
        var weekStart = -1, weekFinish = 6, dayStart = 24, dayFinish = 0;
        for (var day = 0; day < 7; day++) {
            var dayCalendar = dayCalendars[day], start = dayCalendar.start, duration = dayCalendar.duration, finish = start + duration;
            if (duration > 0) {
                if (weekStart == -1)
                    weekStart = day;
                weekFinish = day;
                if (start < dayStart)
                    dayStart = start;
                if (finish > dayFinish)
                    dayFinish = finish;
            }
        }
        if (weekStart < 0)
            weekStart = 0;
        // Set up a schedule using these limits, adding the nonworking days as well.
        settings.schedule = {
            workingWeekStart: weekStart, workingWeekFinish: weekFinish,
            workingDayStart: dayStart * hourDuration, workingDayFinish: dayFinish * hourDuration,
            specialNonworkingDays: settings.specialNonworkingDays
        };

        // Update all leaf items.
        var items = window[Planning.getGanttChartId()].items, leafItems = window[Planning.getGanttChartId()].getLeafItems();
        for (var i = 0; i < leafItems.length; i++) {
            Planning.updateItem(leafItems[i]);
        }
        // Then update the hierarchical parents of all items (in reverse order).
        for (var i = items.length; i-- > 0;) {
            var item = items[i];
            Planning.updateSummary(item);
        }

        // Compute an array of day intervals (from timeline start to finish) that are working considering the schedule above, but 
        // nonworking based on the customly defined day calendars. 
        var specialDayIntervals = [];
        for (var d = settings.timelineStart; d <= settings.timelineFinish; d = Planning.increasedDateTime(d, 24)) {
            var day = Planning.getDayOfWeek(d);
            if (day < weekStart || day > weekFinish)
                continue;
            var dayCalendar = dayCalendars[day], start = dayCalendar.start, duration = dayCalendar.duration, finish = start + duration;
            if (start > dayStart)
                specialDayIntervals.push({ start: Planning.increasedDateTime(d, dayStart), finish: Planning.increasedDateTime(d, start) });
            if (finish < dayFinish)
                specialDayIntervals.push({ start: Planning.increasedDateTime(d, finish), finish: Planning.increasedDateTime(d, dayFinish) });
        }

        // Then set up the highlighting scale to be drawn for all these special intervals in the view.
        var scales = settings.scales;
        if (highlightingScale)
            scales.pop();
        highlightingScale = null;
        if (specialDayIntervals.length > 0) {
            scales.push(highlightingScale = {
                scaleType: 'Custom', isHeaderVisible: false, // no header needed for the special highlighting scale
                intervals: specialDayIntervals,
                isHighlightingVisible: true, highlightingStyle: 'fill: #f8f8f8; opacity: 0.65' // use the same style as that used by the component for the nonworking time under the schedule definition.
            });
        }

        // Finally refresh the UI of the component to draw the highlighting scale and update items in grids and chart.
        window[Planning.getGanttChartId()].refresh();
    };

    // When an item's work or completionPercent is updated, refresh its finish, completedFinish, and workTimes and completedWorkTimes accordingly.
    planning.updateItem = function (item) {
        var work = item.work;
        if (item.completedWorkNew > item.work) item.completedWorkNew = item.work;
        var completionPercent = (item.completedWorkNew / item.work) * 100, completedWork = work * completionPercent / 100;
        if (completionPercent > 100) completionPercent = 100;
        item.completionPercent = completionPercent;
        var result = Planning.getTimes(item.start, item.interruptions, work);
        item.preferredStart = item.start = result.start;
        item.workTimes = result.workTimes;
        if (!item.hasChildren) item.finish = result.finish;
        result = Planning.getTimes(item.start, item.interruptions, item.completedWorkNew);
        item.completedWorkTimes = result.workTimes;
        item.completedFinish = result.finish;
        window[Planning.getGanttChartId()].refreshItemPath(item);
    };

    // Recursively update all parent items (summaries for an item).
    planning.updateParents = function (item) {
        while (item) {
            Planning.updateSummary(item);
            item = item.parent;
        }
    };

    // Refresh a summary item's work and completion percent based on the values of its child items.
    planning.updateSummary = function (item) {
        if (!item.hasChildren)
            return;
        var work = 0, completedWork = 0, completedWorkNew = 0, children = item.children;
        for (var i = 0; i < children.length; i++) {
            var child = children[i];
            var childWork = child.work;
            var childCompletionPercent = child.completionPercent, childCompletedWork = childWork * childCompletionPercent / 100;
            work += childWork;
            completedWork += childCompletedWork;
            completedWorkNew += child.completedWorkNew;
        }
        item.work = work;
        item.completedWorkNew = completedWorkNew;
        item.completionPercent = completedWorkNew / work * 100;
        //window[Planning.getGanttChartId()].refreshItem(item);
        window[Planning.getGanttChartId()].refreshGridItem(item);
    };

    // Based on given start time, interruptions array, and work value (in hours), the algorithm below computes the work time intervals
    // (considering the defined day calendars as well) and the finish time of the item (and also the possibly coerced start time to update as well).
    planning.getTimes = function (start, interruptions, work) {
        // Preparations: intervals will eventually contain the item's work times between start and finish to fulfil work, dateTime will go from start
        // to finish, remainingWork determines the work that is still needed to be covered, and offset indicates the working time used from start to
        // the current position in the algorithm (including interruptions). 
        var intervals = [], dateTime = Planning.getDateTime(start), remainingWork = work, offset = 0;
        // Copy interruptions: the algorithm will temporary update them, removing parts of their durations and updating their offsets on the go.
        var remainingInterruptions = [];
        if (interruptions) {
            for (var i = 0; i < interruptions.length; i++) {
                var interruption = interruptions[i];
                remainingInterruptions.push({ offset: interruption.offset, duration: interruption.duration });
            }
        }
        // While we still have work to fulfil, try to find more working time and use it.
        while (remainingWork > 0) {
            // Go to next day if needed (if we are not just starting or if we are already again at a day's midnight.)
            var timeOfDay = Planning.getTimeOfDay(dateTime);
            if (timeOfDay > 0)
                dateTime = Planning.increasedDateTime(Planning.getDateTime(dateTime), 24);
            // Ensure we are during a day that has working time under the schedule.
            dateTime = window[Planning.getGanttChartId()].getStartWorkingTime(dateTime);
            // Get the day of week and the custom day calendar for that.
            var dayOfWeek = Planning.getDayOfWeek(dateTime);
            var dayCalendar = dayCalendars[dayOfWeek];
            // Go to the start of day considering the custom day calendar.
            dateTime = Planning.increasedDateTime(Planning.getDateTime(dateTime), dayCalendar.start);
            // If the custom day calendar starts earlier than the initial start that we received, move to start again.
            if (dateTime < start)
                dateTime = start;
            // Get the current time of day.
            timeOfDay = Planning.getTimeOfDay(dateTime);
            // While we still have work to fulfil and the day calendar has remaining duration, use the available working time from there.
            while (remainingWork > 0 && timeOfDay < dayCalendar.start + dayCalendar.duration) {
                // The work time available during the day would be from dayCalendar finish minus the cureent time of day.
                var dayWork = dayCalendar.start + dayCalendar.duration - timeOfDay;
                // However, if there is an interruption from the current offset for the available work time duration we should used only 
                // part of that, and skip some work time depending on when the interruption ends (during the same interval or all remaining 
                // interval if later).
                var interruption = Planning.getRelativeInterruption(offset, dayWork, remainingInterruptions);
                var skipWork = 0;
                if (interruption && interruption.offset < remainingWork) {
                    dayWork = interruption.offset;
                    skipWork = interruption.duration;
                }
                // If there is too less remaining work, we don't need to use all available work time.
                if (remainingWork < dayWork)
                    dayWork = remainingWork;
                // Use the time: update remainingWork, and create a new interval or update the last one if its finish is the same as the current offset.
                remainingWork -= dayWork;
                var lastInterval = intervals.length > 0 ? intervals[intervals.length - 1] : null;
                if (lastInterval && lastInterval.offset + lastInterval.duration == offset) {
                    lastInterval.duration += dayWork;
                    lastInterval.finish = Planning.increasedDateTime(dateTime, dayWork);
                }
                else if (dayWork > 0) {
                    // Intervals will have start and finish date-times, but also offset and durations for reference purposes.
                    intervals.push({ offset: offset, duration: dayWork, start: dateTime, finish: Planning.increasedDateTime(dateTime, dayWork) });
                }
                // Also update current offset, dateTime (eventually finish value), and the current time of day accordingly.
                offset += dayWork + skipWork;
                dateTime = Planning.increasedDateTime(dateTime, dayWork + skipWork);
                timeOfDay += dayWork + skipWork;
            }
        }
        // Sometimes there is no interval created (e.g. if the work is zero).
        // In this case, there should be one interval created, with duration zero.
        if (intervals.length == 0)
            intervals.push({ offset: 0, duration: 0, start: start, finish: start });
        // Returns workTimes intervals, finish date-time, but also start (as first interval's start) to be used if start time needs to be
        // coerced for the item to respect the day calendar.
        return { start: intervals[0].start, workTimes: intervals, finish: intervals[intervals.length - 1].finish };
    };

    // Gets work (in hours) between start and finish, considering the day calendars and the specified interruptions collection.  
    planning.getWork = function (start, interruptions, finish) {
        // Preparations: dateTime will go from start to finish, work increases until covers the time, and offset indicates the working time used
        // from start to the current position in the algorithm (including interruptions). 
        var dateTime = Planning.getDateTime(start), work = 0, offset = 0;
        // Copy interruptions: the algorithm will temporary update them, removing parts of their durations and updating their offsets on the go.
        var remainingInterruptions = [];
        if (interruptions) {
            for (var i = 0; i < interruptions.length; i++) {
                var interruption = interruptions[i];
                remainingInterruptions.push({ offset: interruption.offset, duration: interruption.duration });
            }
        }
        // While we still have time to go, use the available working time from there.
        while (dateTime < finish) {
            // Go to next day if needed (if we are not just starting or if we are already again at a day's midnight.)
            var timeOfDay = Planning.getTimeOfDay(dateTime);
            if (timeOfDay > 0)
                dateTime = Planning.increasedDateTime(Planning.getDateTime(dateTime), 24);
            // Ensure we are during a day that has working time under the schedule.
            dateTime = window[Planning.getGanttChartId()].getStartWorkingTime(dateTime);
            // Get the day of week and the custom day calendar for that.
            var dayOfWeek = Planning.getDayOfWeek(dateTime);
            var dayCalendar = dayCalendars[dayOfWeek];
            // Go to the start of day considering the custom day calendar.
            dateTime = Planning.increasedDateTime(Planning.getDateTime(dateTime), dayCalendar.start);
            // If the custom day calendar starts earlier than the initial start that we received, move to start again.
            if (dateTime < start)
                dateTime = start;
            // Get the current time of day.
            timeOfDay = Planning.getTimeOfDay(dateTime);
            // While we still have time to go and the day calendar has remaining duration, use the available working time from there.
            while (dateTime < finish && timeOfDay < dayCalendar.start + dayCalendar.duration) {
                // The work time available during the day would be from dayCalendar finish minus the cureent time of day.
                var dayWork = dayCalendar.start + dayCalendar.duration - timeOfDay;
                // However, if there is an interruption from the current offset for the available work time duration we should used only 
                // part of that, and skip some work time depending on when the interruption ends (during the same interval or all remaining 
                // interval if later).
                var interruption = Planning.getRelativeInterruption(offset, dayWork, remainingInterruptions);
                var skipWork = 0;
                if (interruption) {
                    dayWork = interruption.offset;
                    skipWork = interruption.duration;
                }
                // Use the time: update work.
                work += dayWork;
                // Also update current offset, dateTime (towards finish value), and the current time of day accordingly.
                offset += dayWork + skipWork;
                dateTime = Planning.increasedDateTime(dateTime, dayWork + skipWork);
                timeOfDay += dayWork + skipWork;
            }
        }
        // Finally, remove last part of the work value within the day of the finish time (from finish time itself to the end of the day calendar
        // as it has been added above, without checking.) Check also for days ending at 24:00 (when time of day becomes 00:00 of the next day).
        if (Planning.getDateTime(dateTime).valueOf() == Planning.getDateTime(finish).valueOf() ||
            (Planning.getDateTime(dateTime).valueOf() == Planning.getDateTime(finish).valueOf() + dayDuration && Planning.getTimeOfDay(dateTime) == 0)) {
            finishTimeOfDay = Planning.getTimeOfDay(finish);
            if (finishTimeOfDay == 0)
                finishTimeOfDay = 24;
            if (dayCalendar != null) {
                if (finishTimeOfDay < dayCalendar.start)
                    finishTimeOfDay = dayCalendar.start;
                else if (finishTimeOfDay > dayCalendar.start + dayCalendar.duration)
                    finishTimeOfDay = dayCalendar.start + dayCalendar.duration;
            }
            work -= timeOfDay - finishTimeOfDay;
        }
        // Ensure work is minimum zero (needed for milestones or very short items).
        return Math.max(0, work);
    };

    // Returns an interval definition (with relative offset and duration) from the first interruption in the specified collection
    // that is at or after the current offset and within the specified duration.
    planning.getRelativeInterruption = function (offset, duration, interruptions) {
        for (var i = 0; i < interruptions.length; i++) {
            var interruption = interruptions[i];
            // Ensure the interruption's duration to use is higher than zero, and that its offset is at or after the current offset
            // and within the specified duration.
            if (interruption.duration > 0 && interruption.offset >= offset && interruption.offset < offset + duration) {
                var interruptionOffset = interruption.offset, interruptionDuration = interruption.duration;
                if (interruptionOffset + interruptionDuration > offset + duration) {
                    interruptionDuration = offset + duration - interruptionOffset;
                    // If only part of the interruption is spanning from the offset within the specified duration,
                    // update interruption's offset and duration accordingly.
                    interruption.offset += interruptionDuration;
                    interruption.duration -= interruptionDuration;
                } else {
                    // Otherwise set the interruption's duration to zero.
                    interruption.offset += interruptionDuration;
                    interruption.duration = 0;
                }
                for (var j = i + 1; j < interruptions.length; j++) {
                    interruption = interruptions[j];
                    interruption.offset += interruptionDuration;
                }
                // Return the computed values. Offset is relative to the current offset.
                return { offset: interruptionOffset - offset, duration: interruptionDuration };
            }
        }
        // If no interruption found, we'll return null.
        return null;
    };

    // Helper functions: getDate returns the date for a date-time (midnight), getTimeOfDay returns the time of day for a date-time (in hours),
    // getDayOfWeek returns the day of week of the specified date (from 0 to 6), and increasedDateTime(dateTime, byValue) returns a date-time by 
    // adding the specified value (in hours) to the specified date-time.
    planning.getDateTime = function (dateTime) {
        if (dateTime == undefined) dateTime = date;
        return new Date(Math.floor(dateTime.valueOf() / dayDuration) * dayDuration);
    };

    planning.getTimeOfDay = function (dateTime) {
        if (dateTime == undefined) dateTime = date;
        return (dateTime.valueOf() - Planning.getDateTime(dateTime).valueOf()) / hourDuration;
    };

    planning.getDayOfWeek = function (dateTime) {
        if (dateTime == undefined) dateTime = date;
        var r = Math.floor((dateTime.valueOf() - initialSundayDateValue) / dayDuration) % 7;
        if (r < 0)
            r += 7;
        return r;
    };

    planning.increasedDateTime = function (dateTime, byValue) {
        return new Date(dateTime.valueOf() + byValue * hourDuration);
    };
    var planningSelectedStagesIds = [];
    planning.ExtractChildrensSelectedStages = function (stageId = -1) {
        var items = [];
        planningSelectedStagesIds = [];
        items = window[Planning.getGanttChartId()].getSelectedItems();

        if (items.length == 0) {
            return;
        }

        if (items.length === 1 &&
            stageId !== -1) {
            items = [];

            window[Planning.getGanttChartId()].items.forEach(function (itemS) {
                if (itemS.key === stageId)
                    items.push(itemS);
            });
        } else {
            window[Planning.getGanttChartId()].items.forEach(function (itemS) {
                if (itemS.key === stageId)
                    items.push(itemS);
            });
        }

        planning.GetChildrenStagesIds(items);

        return planningSelectedStagesIds;
    };

    planning.GetSelectedStages = function (stageId = -1) {
        var itemsToReturn = [];
        var items = window[Planning.getGanttChartId()].getSelectedItems();

        if (items.length == 0) {
            return;
        }

        var selectedKeys = items.map(function (item) {
            return item["key"];
        });

        if (window[Planning.getGanttChartId()].settings.selectionMode === "Focus") {
            window[Planning.getGanttChartId()].items.forEach(function (itemS) {
                if (stageId !== -1) {
                    if (itemS.key === stageId) {
                        itemsToReturn.push(itemS);
                    }
                } else {
                    window[Planning.getGanttChartId()].items.forEach(function (itemS) {
                        if (selectedKeys.includes(itemS.key) && itemS.isSelected === true) {
                            itemsToReturn.push(itemS);
                        }
                    });
                }
            });
        } else {
            window[Planning.getGanttChartId()].items.forEach(function (itemS) {
                if ((itemS.key === stageId || selectedKeys.includes(itemS.key)) && itemS.isSelected === true) {
                    itemsToReturn.push(itemS);
                }
            });
        }

        return itemsToReturn.map(function (item) {
                            return item["key"];
                        });
    };

    planning.GetChildrenStagesIds = function (items) {

        items.forEach(function (item, index) {
            if (!planningSelectedStagesIds.includes(item.key))
                planningSelectedStagesIds.push(item.key);
            if (item.hasChildren) {
                planning.GetChildrenStagesIds(item.children);
            }
        });
    };

    window.Planning = planning;
})();
;
(function () {

    var resources = {};

    resources.PerformCallbackResourcesTab = function (stageId, reload = false, moduleName = "") {
        var showAllStages = Resources.ShowAllStages();
        var showAllSubStages = Resources.ShowAllSubStages();
        var selectedStagesIds = [];

        if (moduleName === enums.Modules.Planning) {
            //if (showAllSubStages) {
            //    selectedStagesIds = Planning.ExtractChildrensSelectedStages(stageId); 
            //} 
            if (showAllSubStages === true) {
                selectedStagesIds = Planning.ExtractChildrensSelectedStages(stageId);
            } else {
                selectedStagesIds = Planning.GetSelectedStages(stageId);
            }
        }
        
        cbpResources.PerformCallback({
            stageId: stageId,
            showAllStages: showAllStages,
            showAllSubStages: showAllSubStages,
            selectedStageIds: selectedStagesIds,
            moduleName: moduleName,
            reload: reload
        });

    };
    resources.ResourcesInit = function (s, e) {
        Planning.PerformPlanningHeightChanges("Resources");
    };

    resources.BeginCallback = function (s, e) {
        if (window[s.name].cpModuleName === enums.Modules.Planning) {
            var selectedItems = [];
            var ShowAllSubStagesName = "ResourcesGridShowAllSubStages";
            if (typeof ShowAllSubStagesName !== 'undefined') {
                //if (window[ShowAllSubStagesName].GetChecked() === true) {
                //    selectedItems = Planning.ExtractChildrensSelectedStages();
                //}
                if (window[ShowAllSubStagesName].GetChecked()  === true) {
                    selectedItems = Planning.ExtractChildrensSelectedStages();
                } else {
                    selectedItems = Planning.GetSelectedStages();
                }
            }
            e.customArgs["selectedStageIds"] = selectedItems;
        }
    };

    resources.ResourcesEndCallback = function (s, e) {
        var showAllStages = Resources.ShowAllStages();
        Resources.DisplayButtonMenu();
        Planning.SetPlanningTabsRights();
        Resources.HideCxtMenuElements(showAllStages);
    };
    
    resources.ShowAllStages = function () {
        var showAllStages = typeof ResourcesGridShowAllStages === "undefined" ? false : ResourcesGridShowAllStages.GetChecked();
        if (showAllStages === null)
            return false;
        return showAllStages;
    };

    resources.ShowAllSubStages = function () {
        var showAllSubStages = typeof ResourcesGridShowAllSubStages === "undefined" ? false : ResourcesGridShowAllSubStages.GetChecked();
        if (showAllSubStages === null)
            return;
        return showAllSubStages;
    };

    resources.GetStageId = function () {
        var item = window[Planning.getGanttChartId()].selectedItem;
        if (item === null)
            return -1;
        var StageId = item.key;
        return StageId;
    };

    resources.CasesUserListIds = function (gridName, key) {
        var CasesUsersListIds = [];
        var result = Helper.FilterGridSelectedKeysOnPage(gridName, key);
        if (result.length === 0 || result === -1) {
            return CasesUsersListIds;
        }
        result.forEach(function (entry) {
            CasesUsersListIds.push(entry.CasesUsersListId);
        });
        return CasesUsersListIds;
    };

    resources.DisplayButtonMenu = function () {
        var idLeftMenu = document.getElementById("LeftMenuResources");
        if (idLeftMenu !== null) {
            document.getElementById("LeftMenuResources").style.display = "block";
        }
    };

    resources.DisplayFromButtonContextMenu = function () {
        var s = {};
        s = window["ResourcesGrid"];
        var e = {};
        window["ResourcesGrid"].pageRowCount === 0 ? e.objectType = "emptyrow" : e.objectType = "row";
        e.index = window["ResourcesGrid"].GetFocusedRowIndex();
        var offset = $("#MainResourcesGridMenuButton").offset();
        e.htmlEvent = { clientX: offset.left, clientY: offset.top };
        try {
            Resources.OnShowCtxMenuResources(s, e);
        } catch (e) {
            console.log(e);
        }
    };

    resources.OnShowCtxMenuResources = function (s, e) {
        if (e.objectType === "row" || e.objectType === "emptyrow") {
            s.SetFocusedRowIndex(e.index);
            var x = ASPxClientUtils.GetEventX(e.htmlEvent);
            var y = ASPxClientUtils.GetEventY(e.htmlEvent);
            setTimeout(function () {
                window.CtxResourcesGrid.ShowAtPos(x, y);
            }, 10);
        }
    };

    resources.HideCxtMenuElements = function (showAllStages) {
        if (showAllStages === "undefined") {
            showAllStages === false;
        }

        else if (showAllStages === true) {
            CtxResourcesGrid.GetItemByName("TimeLimitsResourcesGrid").SetEnabled(false);
            CtxResourcesGrid.GetItemByName("MakeResponsibleUserResourcesGrid").SetEnabled(false);
        }
        else {
            CtxResourcesGrid.GetItemByName("TimeLimitsResourcesGrid").SetEnabled(true);
            CtxResourcesGrid.GetItemByName("MakeResponsibleUserResourcesGrid").SetEnabled(true);
        }
    };

    resources.ContextMenuItemClick = function (s, e) {
        switch (e.item.name) {
            case "AddResourcesGrid":
                resources.GetAddUsersCallBack();
                break;
            case "RemoveResourcesGrid":
                resources.ShowDeletedConfirmation();
                break;
            case "RemoveAllResourcesGrid":
                resources.ShowDeletedConfirmationRemoveAll();
                break;
            case "TimeLimitsResourcesGrid":
                resources.GetTimeLimitsCallBack();
                break;
            case "MakeResponsibleUserResourcesGrid":
                resources.MakeResponsibleUser();
                break;
            case "RefreshResourcesGrid":
                Resources.ResourcesGridRefresh_Click();
                break;
        }
    };

    resources.GetAddUsersCallBack = function () {
        var StageId = Resources.GetStageId();
        if (StageId === -1) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }
        View.load("addUsersPopup",
            {
                showAllStages: Resources.ShowAllStages(),
                stageId: StageId,
                reload: true
            });
    };

    resources.GetOptionsCallBack = function () {
        View.load("addUsersToAllStagesPopup");
    };

    resources.EnableTimeLimitCheckBox = function () {
        var enable = typeof enableTimeLimits === "undefined" ? false : enableTimeLimits.GetChecked();
        if (enable === true) {
            fromDateTimeLimits.SetEnabled(true);
            toDateTimeLimits.SetEnabled(true);
        }
        else {
            fromDateTimeLimits.SetEnabled(false);
            fromDateTimeLimits.Clear();
            toDateTimeLimits.SetEnabled(false);
            toDateTimeLimits.Clear();
        }
    };

    resources.ShowDeletedConfirmation = function () {
        var userSelected = Helper.FilterGridSelectedKeysOnPage("ResourcesGrid", "CasesUsersListId");
        if (typeof (userSelected) === 'undefined' || userSelected === null || userSelected.length < 1 || userSelected === -1) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAUser, enums.NotificationStatus.Warning, 3500);
        }
        else {
            Helper.ShowConfirmPopUp("SolidWorks", SwResourceObject.AreYouSure, "Resources.CallRemoveUser()");
        }
    };

    resources.ShowDeletedConfirmationRemoveAll = function () {
        var userSelected = window["ResourcesGrid"].GetFocusedRowIndex();
        if (typeof (userSelected) === 'undefined' || userSelected === null || userSelected.length < 1 || userSelected === -1) {
            Notification.SetNotification(Helper.T("ThereIsNothingToDelete"), 'warning', 3500);
        }
        else {
            Helper.ShowConfirmPopUp("SolidWorks", SwResourceObject.AreYouSure, "Resources.CallRemoveAllUsers()");
        }
    };

    resources.ResourcesGridRefresh_Click = function () {
        var StageId = Resources.GetStageId();
        if (StageId === -1) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }
        Resources.PerformCallbackResourcesTab(StageId, true);
    };

    resources.GetTimeLimitsCallBack = function () {
        var selectedUser = Helper.FilterGridSelectedKeysOnPage("ResourcesGrid", "CasesUsersListId");
        if (selectedUser.length === 0 || selectedUser === -1) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAUser, 'warning', 3500);
            return;
        }
        if (selectedUser.length === 1) {
            View.load("timeLimitsPopup",
                {
                    fromDateTimeLimits: selectedUser[0].StartDate,
                    toDateTimeLimits: selectedUser[0].EndDate
                });
        }
        else {
            View.load("timeLimitsPopup",
                {
                    fromDateTimeLimits: null,
                    toDateTimeLimits: null
                });
        }

    };

    resources.CallRemoveAllUsers = function () {
        var StageId = Resources.GetStageId();
        if (StageId === -1) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }
        $.ajax({
            url: '/Resources/RemoveAllUsersFromGrid',
            type: "POST",
            data: {
                stageId: StageId,
                showAllStages: Resources.ShowAllStages()
            },
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    Resources.PerformCallbackResourcesTab(StageId, true);
                    if (res.CustomAttributes.ResourcesAdded != undefined)
                        Planning.PlanningRefreshSingleStageResources(res.CustomAttributes.ResourcesAdded);
                }
                else {
                    Notification.SetNotification(SwResourceObject.FailedToRemoveItems, 'warning', 3500);
                }
            },
            error: function (response) {
                window.loadingPanel.Hide();
            }
        });
    };

    resources.CallRemoveUser = function () {
        var StageId = Resources.GetStageId();
        if (StageId === -1) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }
        var casesUsersListIds = Resources.CasesUserListIds("ResourcesGrid", "CasesUsersListId");
        if (casesUsersListIds.length === 0) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAUser, 'warning', 3500);
            return;
        }
        $.ajax({
            url: '/Resources/RemoveUserFromGrid',
            type: "POST",
            data: {
                casesUsersListIds: casesUsersListIds,
                stageId: StageId,
                showAllStages: Resources.ShowAllStages()

            },
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    Resources.PerformCallbackResourcesTab(StageId, true);
                    if (res.CustomAttributes.ResourcesAdded != undefined)
                        Planning.PlanningRefreshSingleStageResources(res.CustomAttributes.ResourcesAdded);
                }
                else {
                    Notification.SetNotification(SwResourceObject.FailedToRemoveItems, 'warning', 3500);
                }
            },
            error: function (response) {
                window.loadingPanel.Hide();
            }
        });
    };

    resources.AddToThisStage = function () {
        var StageId = resources.GetStageId();
        if (StageId === -1) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }
        var UsersListIds = [];
        var selectedUser = Helper.FilterGridSelectedKeysOnPage("AddUSerResourcesGrid", "UserId");
        if (selectedUser.length === 0 || selectedUser === -1) {
            UsersListIds = 0;
        }
        selectedUser.forEach(function (entry) {
            UsersListIds.push(entry.UserId);
        });

        $.ajax({
            url: '/Resources/ApplyChangesAddUsers',
            type: "POST",
            data: {
                stageId: StageId,
                userId: UsersListIds
            },
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    Resources.PerformCallbackResourcesTab(StageId, true);
                    if (res.CustomAttributes.ResourcesAdded != undefined)
                        Planning.PlanningRefreshSingleStageResources(res.CustomAttributes.ResourcesAdded);
                }
                else {
                    Notification.SetNotification(SwResourceObject.FailedToApplyChanges, 'warning', 3500);
                }
                pcModalAddUsers.Hide();
            },
            error: function (response) {
                window.loadingPanel.Hide();
            }
        });
    };

    resources.AddAndClose = function () {
        var StageId = resources.GetStageId();
        if (StageId === -1) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }
        var UsersListIds = [];
        var selectedUser = Helper.FilterGridSelectedKeysOnPage("AddUSerResourcesGrid", "UserId");
        if (selectedUser.length === 0 || selectedUser === -1) {
            UsersListIds = 0;
        }
        selectedUser.forEach(function (entry) {
            UsersListIds.push(entry.UserId);
        });

        var removeExisting;
        var checked = window.existingUser.GetSelectedIndex();
        if (checked === "undefined") {
            removeExisting === false;
        }
        if (checked === 0) {
            removeExisting = true;
        }
        else {
            removeExisting = false;
        }

        ignoreCurrentStage = typeof doNotAddUsers === "undefined" ? false : doNotAddUsers.GetChecked();
        if (ignoreCurrentStage === "undefined") {
            ignoreCurrentStage.GetChecked() === false;
        }

        $.ajax({
            url: '/Resources/GetAddToAllSubstagesData',
            type: "POST",
            data: {
                stageId: StageId,
                userId: UsersListIds,
                ExistingUsers: removeExisting,
                IgnoreCurrentStage: ignoreCurrentStage
            },
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    Resources.PerformCallbackResourcesTab(StageId, true);
                }
                else {
                    Notification.SetNotification(SwResourceObject.FailedToApplyChanges, 'warning', 3500);
                }
                pcModalAddToAllSubstagesPopUp.Hide();
            },
            error: function (response) {
                window.loadingPanel.Hide();
            }
        });
    };

    resources.ResourcesGridMenuRights = function (s, e, isAllStages) {
        var enable = s.GetChecked();
        if (isAllStages) {
            ResourcesGridShowAllSubStages.SetEnabled(!enable);
        } else {
            ResourcesGridShowAllStages.SetEnabled(!enable);
        }
        AddResources.SetEnabled(true);
        RemoveResources.SetEnabled(true);
        if (ResourcesGridShowAllSubStages.GetChecked() === true ||
            ResourcesGridShowAllStages.GetChecked() === true) {
            AddResources.SetEnabled(false);
            RemoveResources.SetEnabled(false);
        } 

        if (window[Planning.getGanttChartId()].getSelectedItems().length > 1) {
            AddResources.SetEnabled(false);
            RemoveResources.SetEnabled(false);
        }
    };
    
    resources.OkTimeLimitButton = function () {
        var StageId = resources.GetStageId();
        if (StageId === -1) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }
        var enable = typeof enableTimeLimits === "undefined" ? false : enableTimeLimits.GetChecked();

        if (enable === true) {
            var StartDate = window.fromDateTimeLimits.GetText();
            var EndDate = window.toDateTimeLimits.GetText();
            if ((!StartDate && EndDate) || (StartDate && !EndDate)) {
                Notification.SetNotification(Helper.T("PleaseChooseBothDates"), 'warning', 3500);
                return;
            }
            var casesUsersListIds = Resources.CasesUserListIds("ResourcesGrid", "CasesUsersListId");
            if (casesUsersListIds.length === 0) {
                Notification.SetNotification(SwResourceObject.PleaseSelectAUser, 'warning', 3500);
                return;
            }
            else {
                $.ajax({
                    url: '/Resources/SetTimeLimits',
                    type: "POST",
                    data: {
                        stageId: StageId,
                        chkEnableTimeLimit: enable,
                        casesUsersListIds: casesUsersListIds,
                        startDate: StartDate,
                        endDate: EndDate
                    },
                    success: function (response) {
                        var res = JSON.parse(response.data);
                        if (res.Success) {
                            Resources.PerformCallbackResourcesTab(StageId, true);
                        }
                        else {
                            Notification.SetNotification(SwResourceObject.FailedToApplyChanges, 'warning', 3500);
                        }
                        pcModalTimeLimit.Hide();
                    },
                    error: function (response) {
                        window.loadingPanel.Hide();
                    }
                });
            }
        }
        else {
            pcModalTimeLimit.Hide();
        }
    };

    resources.MakeResponsibleUser = function () {
        var selectedUser = Helper.FilterGridSelectedKeysOnPage("ResourcesGrid", "CasesUsersListId");
        if (selectedUser.length === 0 || selectedUser === -1) {
            selectedUser = Helper.FilterGridFocusedRowKey("ResourcesGrid", "CasesUsersListId");
        }
        if (selectedUser.length === 0 || selectedUser === -1) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAUser, 'warning', 3500);
            return;
        }
         if (selectedUser.length > 1) {
            Notification.SetNotification(Helper.T("PleaseSelectOnlyOneUser"), 'warning', 3500);
            return;
        }
        $.ajax({
            url: '/Resources/MakeResponsibleUser',
            type: "POST",
            data: {
                stageId: selectedUser[0].StageId,
                userId: selectedUser[0].UserId,
                showAllStages: Resources.ShowAllStages()
            },
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    Resources.PerformCallbackResourcesTab(selectedUser[0].StageId, true);
                }
                else {
                    Notification.SetNotification(SwResourceObject.FailedToApplyChanges, 'warning', 3500);
                }
            },
            error: function (response) {
                window.loadingPanel.Hide();
            }
        });
    };

    window.Resources = resources;
})();;
(function () {

    var looger = {};

    looger.BeginCallback = function (s, e) {
        switch (e.command) {
            case "PAGERONCLICK":
            case "APPLYCOLUMNFILTER":
            case "APPLYFILTER":
            case "APPLYHEADERCOLUMNFILTER":
            case "NEXTPAGE":
            case "SORT":
            case "EXPANDROW":
            case "COLLAPSEALL":
            case "EXPANDALL":
                e.customArgs["reload"] = false;
                break;
            default:
                e.customArgs["reload"] = true;
                break;
        }

        e.customArgs["btnLogSearch"] = btnLogSearch.GetValue();
        e.customArgs["LogLevel"] = Number(LogLevel.GetValue());
        e.customArgs["dateFrom"] = LogCreatedOnFrom.GetText();
        e.customArgs["dateTo"] = LogCreatedOnTo.GetText();

    };
    looger.OnbtnViewLogClick = function (s, e) {
        var key = LogGrid.GetRowKey(LogGrid.focusedRowIndex);
        if (key !== "" && key !== null) {
            pcModalLogDetails.PerformCallback({
                Id: key
            });
            pcModalLogDetails.Show();
        }
        else {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
        }
    };

    looger.OnbtnViewClearLog = function (s, e) {
        Helper.ShowConfirmPopUp("SolidWorks", SwResourceObject.AreYouSureYouWantToContinue, "Looger.OnbtnViewConfirmClearLog()");
    };

    looger.OnbtnViewConfirmClearLog = function (s, e) {
        loadingPanel.Show();
        $.ajax({
            type: "POST",
            url: '/Log/ClearLog/',
            data: {},
            dataType: "json",
            success: function (response) {
                if (response.Success) {
                    Notification.SetNotification(response.Message, 'sucess', 2500);
                } else {
                   // Notification.SetNotification(response.Message, 'warning', 2500);
                }
                LogGrid.PerformCallback();
                loadingPanel.Hide();
            }
        });
    };
    looger.OnbtnSearchAllButtonClick = function (s, e) {
        if (e.buttonIndex === 0) {
            LogGrid.PerformCallback();
        } else {
            window.btnLogSearch.SetValue('');
        }
    };
    looger.OnbtnSearchAllKeyPress = function (s, e) {
        if (e.htmlEvent.keyCode === 13) {
            LogGrid.PerformCallback();
        }
    };

    window.Looger = looger;
})();

;
var RzProjectDeliverables = (function () {

    var _State = {
        ModuleName: ""
    };

    var _InternalFunctions = {
        CheckMenuVisibility: function (s,e) {
            var value = !(s.pageRowCount === 0);
            window["btnOpenRecord" + s.cpModule].SetEnabled(value);
            window["btnSearch" + s.cpModule].SetEnabled(value);

            if (s.cpModule === enums.Modules.Planning) {
                window["btnRemoveSingleProjDeliver"].SetEnabled(value);
                window["btnRemoveAllProjDeliver"].SetEnabled(value);
            }

            if (s.cpModule === enums.Modules.Planning) {
                var deliverablesShowAllStagesChecked = DeliverablesShowAllStages.GetChecked();
                var deliverablesShowAllSubStagesChecked = DeliverablesShowAllSubStages.GetChecked();
                var enable = true;
                if (deliverablesShowAllStagesChecked) {
                    DeliverablesShowAllSubStages.SetEnabled(false);
                    enable = false;
                    value = false;
                } else if (deliverablesShowAllSubStagesChecked) {
                    DeliverablesShowAllStages.SetEnabled(false);
                    enable = false;
                    value = false;
                } else {
                    DeliverablesShowAllStages.SetEnabled(true);
                    DeliverablesShowAllSubStages.SetEnabled(true);
                    enable = true;
                }
                btnAddItemProjDeliver.SetEnabled(enable);
                btnRemoveSingleProjDeliver.SetEnabled(value);
                btnRemoveAllProjDeliver.SetEnabled(value);
            
                if (window[Planning.getGanttChartId()].getSelectedItems().length > 1) {
                    btnAddItemProjDeliver.SetEnabled(false);
                    btnRemoveSingleProjDeliver.SetEnabled(false);
                    btnRemoveAllProjDeliver.SetEnabled(false);
                }
            }
        }
    };

    return {
        Default: {

            OnInit: function (s, e) {

                RzProperties.CalculateHeightForProjectDeliverables(s.cpModule);

                _State.ModuleName = s.cpModule;

                _InternalFunctions.CheckMenuVisibility(s,e);
            },

            EndCallback: function (s, e) {
                if (AppV.GetGlobals().isMainWindow) {
                    RzProjectDeliverables.Default.OnInit(s, e);
                }

                _State.ModuleName = s.cpModule;

                _InternalFunctions.CheckMenuVisibility(s,e);
            },
            
            AddItemsToStage: function () {
                //Get selected values
                var selectedRow = Helper.FilterGridSelectedKeysOnPage("gridRelatedItems", "RecordGuid");

                if (selectedRow === undefined || selectedRow === null) {
                    Notification.SetNotification(SwResourceObject.ChooseARecord, 'warning', 3500);
                    return;
                }

                var item = window[Planning.getGanttChartId()].selectedItem;
                var stageId = -1;
                if (item !== null) {
                    stageId = item.key;
                }

                var selectedRowsArray = [];
                selectedRow.forEach(function (element) {
                    selectedRowsArray.push(element.RecordGuid);
                });

                $.ajax({
                    type: "POST",
                    url: '/ProjectDeliverables/AddItems/',
                    data: {
                        "stageId": stageId,
                        "parentRecordGuid": AppV.GetGlobals().RecordGuid,
                        "parentObjectId": AppV.GetGlobals().ObjectId,
                        "objectId": window.cmbSelectObjectRelatedItems.GetValue(),
                        "selectedItemsGuids": selectedRowsArray
                    },
                    dataType: "json",
                    success: function (response) {
                        var res = JSON.parse(response.data);
                        if (res.Success) {
                            window.ProjectDeliverablesGridPlanning.PerformCallback({
                                shouldReload: true
                            });
                        } else {
                            Notification.SetNotification(res.Message, 'warning', 3500);
                        }
                    }
                });
            },

            CheckRightsOfAddItemsAction: function () {
                var result = false;
                $.ajax({
                    type: "POST",
                    url: '/ProjectDeliverables/CheckRightsAddItems/',
                    data: {
                        "objectId": AppV.GetGlobals().ObjectId
                    },
                    async: false,
                    dataType: "json",
                    success: function (response) {
                        var res = JSON.parse(response.data);
                        if (res.Success) {
                            result = true;
                        } else {
                            Notification.SetNotification(res.Message, 'warning', 3500);
                            result = false;
                        }
                    }
                });
                return result;
            },

            ShowAllStages: function () {
                var showAllStages = typeof DeliverablesShowAllStages === "undefined" ? false : DeliverablesShowAllStages.GetChecked();
                if (showAllStages === null)
                    return false;
                return showAllStages;
            },

            ShowAllSubStages : function () {
                var showAllStages = typeof DeliverablesShowAllSubStages === "undefined" ? false : DeliverablesShowAllSubStages.GetChecked();
                if (showAllStages === null)
                    return false;
                return showAllStages;
            },

            DeliverablesCallback: function () {
                var reload = false;
                var stageId = RzProjectDeliverables.Default.GetStageId();
                var pdShowAllStages = RzProjectDeliverables.Default.ShowAllStages();
                var pdShowAllSubStages = RzProjectDeliverables.Default.ShowAllSubStages();
                if (pdShowAllStages || pdShowAllSubStages) reload = true;

                var selectedStagesIds = [];
                if (pdShowAllSubStages) {
                    selectedStagesIds = Planning.ExtractChildrensSelectedStages(stageId);
                }

                window.cbpProjectDeliverablesPlanning.PerformCallback({
                    objectId: AppV.GetGlobals().ObjectId,
                    recordGuid: AppV.GetGlobals().RecordGuid,
                    recordId: AppV.GetGlobals().RecordId,
                    shouldReload: reload,
                    stageId: stageId,
                    showAllStages: pdShowAllStages,
                    showAllSubStages: pdShowAllSubStages,
                    selectedStageIds: selectedStagesIds
                });
            },

            GetStageId : function () {
                var item = window[Planning.getGanttChartId()].selectedItem;
                if (item === null)
                    return -1;
                var StageId = item.key;
                return StageId;
            },

            BeginCallback : function (s, e) {
                if (window[s.name].cpModule === enums.Modules.Planning) {
                    var selectedItems = [];
                    var ShowAllSubStagesName = "DeliverablesShowAllSubStages";
                    if (typeof ShowAllSubStagesName !== 'undefined') {
                        if (window[ShowAllSubStagesName].GetChecked() === true) {
                            selectedItems = Planning.ExtractChildrensSelectedStages();
                        }
                    }
                    e.customArgs["selectedStageIds"] = selectedItems;
                }
            }
        },

        Menu: {
            OpenRecord: function () {
                var selectedRow = Helper.GetGridFocusedRowKey("ProjectDeliverablesGrid" + _State.ModuleName);

                if (selectedRow !== undefined && selectedRow !== null) {

                    var rowFocused = JSON.parse(window["ProjectDeliverablesGrid" + _State.ModuleName].cpAllRowData).filter(function (x) {
                        return x.IdRecord == Number(selectedRow);
                    })[0];

                    var value = rowFocused.UrlEncrypted;

                    if (!Helper.IsEmpty("", value)) {
                        Helper.open('/PropertyCard/Index/' + value, '_blank');
                    }
                    else {
                        Notification.SetNotification(SwResourceObject.ChooseARecord, 'warning', 3500);
                    }
                } else {
                    Notification.SetNotification(SwResourceObject.ChooseARecord, 'warning', 3500);
                }

            },

            Find: function (s, e) {
                Helper.HideShowSearchBar(s, e);
            },

            AddItemClick: function (s, e) {
                if (AppV.GetPropertyTabsState().IsCheckedOutBySelf ||  RzProjectDeliverables.Default.CheckRightsOfAddItemsAction()) {
                    RzRelatedItems.Default.ShowRelatedItemsPopUp("RzProjectDeliverables.Default.AddItemsToStage()",
                        "RzProjectDeliverables.Default.CheckRightsOfAddItemsAction()",
                        AppV.GetGlobals().ObjectId,
                        -1,
                        enums.ObjectTypeToAddTo.TypeProject
                    );
                }

            },

            RemoveItem: function (s, e, removeAll = false) {

                if (typeof window["ProjectDeliverablesGrid" + _State.ModuleName] === "undefined" ||
                    !ASPxClientUtils.IsExists(window["ProjectDeliverablesGrid" + _State.ModuleName])) {
                    return;
                }

                //Get selected values
                var selectedRow = Helper.FilterGridSelectedKeysOnPage("ProjectDeliverablesGrid" + _State.ModuleName, "IdRecord");

                if (selectedRow === undefined || selectedRow === null || selectedRow.length === 0) {
                    Notification.SetNotification(SwResourceObject.ChooseARecord, 'warning', 3500);
                    return;
                }

                var item = window[Planning.getGanttChartId()].selectedItem;
                var stageId = -1;
                if (item !== null) {
                    stageId = item.key;
                }

                var selectedRowsArray = [];
                selectedRow.forEach(function (element) {
                    selectedRowsArray.push(element.RecordGuid);
                });

                $.ajax({
                    type: "POST",
                    url: '/ProjectDeliverables/RemoveItem/',
                    data: {
                        "objectId": AppV.GetGlobals().ObjectId,
                        "recordId": AppV.GetGlobals().RecordId,
                        "recordGuid": AppV.GetGlobals().RecordGuid,
                        "stageId": stageId,
                        "recordGuids": selectedRowsArray,
                        "removeAll": removeAll
                    },
                    async: false,
                    dataType: "json",
                    success: function (response) {
                        var res = JSON.parse(response.data);
                        if (res.Success) {
                            ProjectDeliverablesGridPlanning.PerformCallback({
                                shouldReload: true
                            });
                            Notification.SetNotification(SwResourceObject.RecordDeleted, 'success', 3500);
                        } else {
                            Notification.SetNotification(res.Message, 'warning', 3500);
                        }
                    }
                });
            },

            RemoveAllItems: function (s, e) {
                Helper.ShowConfirmPopUp("SolidWorks",
                    SwResourceObject.AreYouSureYouWantToRemoveAllItems,
                    "RzProjectDeliverables.Menu.RemoveItem(s,e,true)");
            },

            DeliverablesShowAllSubStagesCheckedChange: function (s,e) {
                RzProjectDeliverables.Default.DeliverablesCallback();
                RzProjectDeliverables.Menu.MenuItemsRights(s, e, false);
            },

            DeliverablesShowAllStagesCheckedChange: function (s,e) {
                RzProjectDeliverables.Default.DeliverablesCallback();
                RzProjectDeliverables.Menu.MenuItemsRights(s, e, true);
            },

            MenuItemsRights: function (s,e, isAllStages) {
                var enable = s.GetChecked();
                if (isAllStages) {
                    DeliverablesShowAllSubStages.SetEnabled(!enable);
                } else {
                    DeliverablesShowAllStages.SetEnabled(!enable);
                }
                btnAddItemProjDeliver.SetEnabled(!enable);
                btnRemoveSingleProjDeliver.SetEnabled(!enable);
                btnRemoveAllProjDeliver.SetEnabled(!enable);
            }
        },

        ContextMenu: {

            Display: function (s, e) {

                var x = window.ASPxClientUtils.GetEventX(e.htmlEvent);
                var y = window.ASPxClientUtils.GetEventY(e.htmlEvent);
                window["CtxMenuProjectDeliverablesGrid" + s.cpModule].ShowAtPos(x, y);
                gridSenderName = s.name;

                _State.ModuleName = s.cpModule;

                if (window["ProjectDeliverablesGrid" + s.cpModule].cpHasValues === false) {
                    window["CtxMenuProjectDeliverablesGrid" + s.cpModule].SetEnabled(false);
                    window["CtxMenuProjectDeliverablesGrid" + s.cpModule].GetItemByName("refresh").SetEnabled(true);
                    //btnOpenRecord.SetEnabled(false);
                }
            },

            DisplayFromButtonContextMenu: function (s, e) {
                //var s = {};
                //var e = {};
                s = window["ProjectDeliverablesGrid" + s.cpModule];
                e.index = window["ProjectDeliverablesGrid" + s.cpModule].GetFocusedRowIndex();
                var offset = $("#GridMenuButtonProjDeliver" + s.cpModule).offset();
                e.htmlEvent = { clientX: offset.left, clientY: offset.top };
                try {
                    _State.ModuleName = s.cpModule;
                    RzProjectDeliverables.ContextMenu.Display(s, e);
                } catch (e) {
                    console.log(e);
                }
            },

            ItemClick: function (s, e) {
                switch (e.item.name) {

                    case "openRecord":
                        RzProjectDeliverables.Menu.OpenRecord();
                        break;

                    case "copySelectedValue":
                        Helper.CopyTextToClipboard(RzProjectDeliverables.ProjectDeliverablesFieldValueToCopy);
                        break;

                    case "createShortcut":
                        var values = JSON.parse(window["ProjectDeliverablesGrid" + s.cpModule].cpAllRowData).filter(function (x) {
                            return x.IdRecord == Number(Helper.GetGridFocusedRowKey("ProjectDeliverablesGrid" + s.cpModule));
                        })[0];

                        View.load("addShortCutPopUp",
                            {
                                "ObjectId": values.ObjectId,
                                "ObjectType": values.ObjectType || 0,
                                "DisplayName": values.RecordPartNumber + " " + values.RecordDescription,
                                "RecordId": values.IdRecord
                            });
                        break;

                    case "refresh":
                        window["ProjectDeliverablesGrid" + s.cpModule].PerformCallback({
                            shouldReload: true
                        });
                        break;

                    case "exportToExcel":
                        App.Exporting = true;
                        window["ProjectDeliverablesGrid" + s.cpModule].ExportTo(ASPxClientTreeListExportFormat.Xlsx);
                        break;
                }
            },

            ItemMouseOver: function (s, e) {
                if (e.item.name === "copySelectedValue") {
                    var values = Helper.GetGridFocusedRowKey("ProjectDeliverablesGrid" + _State.ModuleName);
                    if (values !== undefined && !Helper.IsEmpty("", values)) {

                        var value = JSON.parse(window["ProjectDeliverablesGrid" + _State.ModuleName].cpAllRowData).filter(function (x) {
                            return x.IdRecord == Number(Helper.GetGridFocusedRowKey("ProjectDeliverablesGrid" + _State.ModuleName));
                        })[0];

                        RzProjectDeliverables.ProjectDeliverablesFieldValueToCopy = value.RecordPartNumber;
                    }
                }
            }

        }
    };
})();;
var RzRelatedItems = (function () {

    var _State = {

    };

    return {
        Default: {
            ShowRelatedItemsPopUp: function (yesAction = "", initialAction = "", objectId = -1, stageId = -1, objectToAdd = -1) {
                //ToDo: Implement initial action before open popup
                //var checkPassed;
                //var initFunc;

                //if (initialAction !== "") {
                //    initFunc = new Function("rrrrt();");
                //    checkPassed = initFunc.apply(null);
                //}
                //alert(2);
                //if (checkPassed)
                    View.load("ModalRelatedItems",
                        {
                            yesAction: yesAction,
                            objectId: objectId,
                            stageId: stageId,
                            objectToAdd: objectToAdd
                        });

            },

            OnSearchButtonClick: function (s, e) {
                var cmbSelectObject = window.cmbSelectObjectRelatedItems.GetValue();
                if (e.buttonIndex === 0) {
                    if (cmbSelectObject !== null) {
                        window.gridRelatedItems.PerformCallback();
                    }
                    else {
                        Notification.SetNotification(window.SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
                    }
                } else {
                    if (cmbSelectObject !== null) {
                        window.btnAddRelatedItems.SetValue('');
                        window.gridRelatedItems.PerformCallback();
                    }
                    else {
                        window.btnAddRelatedItems.SetValue('');
                    }
                }
            },

            SelectTypeObjectIndexChange: function (s, e) {

                var selectedValue =
                    window.cmbSelectObjectRelatedItems.GetValue();

                window.gridRelatedItems.PerformCallback({
                    objectId: s.cpObjectId,
                    recordGuid: s.cpRecordGuid,
                    selectedObjectId: selectedValue
                });
            }

        },

        Menu: {
            KeyPressSimpleSearch: function (s, e) {
                var cmbSelectObject = window.cmbSelectObjectRelatedItems.GetValue();
                if (cmbSelectObject !== null) {
                    if (e.htmlEvent.keyCode === 13) {
                        window.gridRelatedItems.PerformCallback();
                    }
                }
            }
        },

        Grid: {
            BeginCallback: function (s, e) {

                var selectedValue =
                    window.cmbSelectObjectRelatedItems.GetValue();

                e.customArgs["objectId"] = s.cpObjectId;
                e.customArgs["recordGuid"] = s.cpRecordGuid;
                e.customArgs["selectedObjectId"] = selectedValue;
                e.customArgs["simpleSearchFor"] = window.btnAddRelatedItems.GetValue();
                e.customArgs["limitRecord"] = window.AddRelatedItemsSearchLimitRecords.GetValue();
                e.customArgs["stageId"] = -1;
                e.customArgs["objectToAdd"] = enums.ObjectTypeToAddTo.TypeProject;

            }
        }
    };
})();;
(function () {

    var notifications = {};
    var moduleName = AppV.GetGlobals().ModuleName;
    notifications.PerformCallbackNotifications = function (objectId, recordGuid, reload = false) {
        moduleName = moduleName.replace(/["']/g, "");
        stageId = -1;
        if (typeof window[Planning.getGanttChartId()] !== "undefined") {
            var item = window[Planning.getGanttChartId()].selectedItem;
            if (item !== null) {
                stageId = item.key;
            }
        }
        var allStages = false;
        var allStagesName = "ShowCompletedNotificationsChkb" + moduleName;
        if (typeof window[allStagesName] !== "undefined") {
            allStages = window[allStagesName].GetValue();
        }
        window["cbpNotifications" + moduleName].PerformCallback({
            objectId: objectId,
            recordGuid: recordGuid,
            reload: reload,
            moduleName: moduleName,
            stageId: stageId,
            allStages: allStages
        });
    };

    notifications.NotificationsInit = function (s, e) {
        moduleName = s.cpModuleName.replace(/["']/g, "");
        Notifications.EnableDisableButtons();
        RzProperties.CalculateHeightForNotifications(moduleName);
    };

    notifications.NotificationsEndCallback = function (s, e) {
        Notifications.NotificationsInit(s, e);
        // loadingPanel.Hide();
    };

    notifications.GridBeginCallback = function (s, e) {
        var enableNotification = false;
        var nameChkb = window["EnableNotificationsChkb" + moduleName];
        if (typeof nameChkb !== "undefined") {
            enableNotification = nameChkb.GetChecked();
            e.customArgs["enableNotification"] = enableNotification;
        }
        var showAllStages = false;
        var showAllStagesChkb= window["ShowCompletedNotificationsChkb" + moduleName];
        if (typeof showAllStagesChkb !== "undefined") {
            showAllStages = showAllStages.GetChecked();
        }
        e.customArgs["objectId"] = AppV.GetGlobals().ObjectId;
        e.customArgs["recordGuid"] = AppV.GetGlobals().RecordGuid;
        e.customArgs["enableNotification"] = enableNotification;
        e.customArgs["moduleName"] = AppV.GetGlobals().ModuleName;
        e.customArgs["stageId"] = Processes.State.StageId;
        e.customArgs["allStages"] = showAllStages;
        // loadingPanel.Show();
    };

    notifications.EnableDisableButtons = function () {
        var objectId = AppV.GetGlobals().ObjectId;
        var recordGuid = AppV.GetGlobals().RecordGuid;
        var isChecked = true;
        var nameChkb = window["EnableNotificationsChkb" + moduleName];
        var btnNewName = window["btnNewNotifications" + moduleName];
        var btnNbtnDelete = window["btnDeleteNotifications" + moduleName];
        if (typeof nameChkb !== "undefined") {
            isChecked = nameChkb.GetChecked();
        }
        if ((recordGuid === "" && objectId < 1) || !isChecked) {
            if (typeof btnNewName !== "undefined") {
                btnNewName.SetEnabled(false);
            }
            if (typeof btnNbtnDelete !== "undefined") {
                btnNbtnDelete.SetEnabled(false);
            }
            return;
        }
        else {
            if (typeof btnNewName !== "undefined") {
                btnNewName.SetEnabled(true);
            }
            if (typeof btnNbtnDelete !== "undefined") {
                btnNbtnDelete.SetEnabled(true);
            }
        }
    };

    notifications.DoEnableNotifications = function (objectId, recordGuid) {
        var isChecked = window["EnableNotificationsChkb" + moduleName].GetChecked();
        $.ajax({
            url: '/Notifications/DoEnableNotifications',
            type: "POST",
            data: {
                isChecked: isChecked,
                objectId: objectId,
                recordGuid: recordGuid
            },
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    Notifications.EnableDisableButtons();
                    Notifications.PerformCallbackNotifications(AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordGuid, true);
                } else {
                    Notification.SetNotification(SwResourceObject.AnErrorOccurred, 'warning', 3500);
                    return;
                }
            }
        });
    };

    notifications.DeleteNotificationItem = function () {
        var isPlanning = false;
        var gridName = "NotificationsGrid" + AppV.GetGlobals().ModuleName;
        result = JSON.parse(window[gridName].cpAllRowData)[window[gridName].GetFocusedRowIndex()];
        if (result === null || result === undefined) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, enums.NotificationStatus.Warning, 3500);
            return;
        }
        var notificationId = result.RecordNotificationId;
        if (moduleName === enums.Modules.Planning) {
            isPlanning = true;
        }
        $.ajax({
            url: '/Notifications/DeleteNotificationItem',
            type: "POST",
            data: {
                notificationId: notificationId,
                isPlanning: isPlanning
            },
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    Notifications.PerformCallbackNotifications(AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordGuid, true);
                }
                else {
                    Notification.SetNotification(SwResourceObject.FailedToRemoveItems, 'warning', 3500);
                    return;
                }
            },
            error: function (response) {
                window.loadingPanel.Hide();
            }
        });
    };

    notifications.SendNotifications = function () {
        var gridName = "NotificationsGrid" + AppV.GetGlobals().ModuleName;
        result = JSON.parse(window[gridName].cpAllRowData)[window[gridName].GetFocusedRowIndex()];
        if (result === null || result === undefined) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, enums.NotificationStatus.Warning, 3500);
            return;
        }
        var notificationId = result.RecordNotificationId;
        $.ajax({
            url: '/Notifications/SendNotifications',
            type: "POST",
            data: {
                notificationId: notificationId,
                objectId: AppV.GetGlobals().ObjectId,
                recordGuid: AppV.GetGlobals().RecordGuid
            },
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    Notifications.PerformCallbackNotifications(AppV.GetGlobals().ObjectId, AppV.GetGlobals().RecordGuid, true);
                }
                else {
                    Notification.SetNotification(SwResourceObject.AnErrorOccurred, 'warning', 3500);
                    return;
                }
            },
            error: function (response) {
                window.loadingPanel.Hide();
            }
        });
    };

    notifications.NotificationsToolbarClick = function (s, e) {
        var objId = AppV.GetGlobals().ObjectId;
        var recordGuid = AppV.GetGlobals().RecordGuid;
        moduleName = moduleName.replace(/["']/g, "");
        var gridName = "NotificationsGrid" + moduleName;
        switch (s.name) {
            case "btnNewNotifications" + moduleName:
                Notifications.GetNewPopUpCallBack();
                break;
            case "btnEditNotifications" + moduleName:
                result = JSON.parse(window[gridName].cpAllRowData)[window[gridName].GetFocusedRowIndex()];
                if (result === null || result === undefined || result === -1) {
                    Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, enums.NotificationStatus.Warning, 3500);
                    return;
                }
                Notifications.GetNotificationsProperties();
                break;
            case "btnRefreshNotifications" + moduleName:
                Notifications.PerformCallbackNotifications(objId, recordGuid, true);
                break;
            case "btnDeleteNotifications" + moduleName:
                result = JSON.parse(window[gridName].cpAllRowData)[window[gridName].GetFocusedRowIndex()];
                if (result === null || result === undefined || result === -1) {
                    Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, enums.NotificationStatus.Warning, 3500);
                    return;
                }
                Helper.ShowConfirmPopUp("SolidWorks", SwResourceObject.AreYouSureYouWantToDeleteSelectedItem, "Notifications.DeleteNotificationItem()");
                break;
            case "EnableNotificationsChkb" + moduleName:
                Notifications.DoEnableNotifications(objId, recordGuid);
                break;
            case "btnSendNow" + moduleName:
                Notifications.SendNotifications();
                break;
            case "ShowCompletedNotificationsChkb" + moduleName:
                break;
        }
    };

    // #region New

    var NotificationRecordId = -1;
    var ConditionsString = "";
    var GroupObjId = -1;
    var SelectedTypeId = - 1;
    var SelectedTypeId1 = - 1;
    var Reload = false;

    // #region Enable/Disable

    notifications.EnableDisableSubject = function () {
        var checked = typeof notificationEmailOrSmsType === "undefined" ? false : window.notificationEmailOrSmsType.GetSelectedIndex();
        if (checked === false) {
            return;
        }
        if (checked === 0) {
            notificationsSubject.SetVisible(true);
            notificationToGrid.PerformCallback({
                ObjectId: AppV.GetGlobals().ObjectId,
                RecordGuid: AppV.GetGlobals().RecordGuid,
                GroupObjId: GroupObjId,
                IsSmsChecked: false,
                RecordNotificationId: NotificationRecordId,
                reload: true
            });
        }
        else {
            notificationsSubject.SetVisible(false);
            notificationToGrid.PerformCallback({
                ObjectId: AppV.GetGlobals().ObjectId,
                RecordGuid: AppV.GetGlobals().RecordGuid,
                GroupObjId: GroupObjId,
                IsSmsChecked: true,
                RecordNotificationId: NotificationRecordId,
                reload: true
            });
        }
    };

    notifications.EnableDisableTwoConditions = function () {
        var checked = typeof motificationTwoConditions === "undefined" ? false : motificationTwoConditions.GetChecked();
        if (checked) {
            notificationField1Cmb.SetEnabled(true);
            notificationCondition1Cmb.SetEnabled(true);
            notificationValue1Cmb.SetEnabled(true);
        }
        else {
            notificationField1Cmb.SetEnabled(false);
            notificationCondition1Cmb.SetEnabled(false);
            notificationValue1Cmb.SetEnabled(false);
        }
    };

    notifications.EnableDisableAddMainContact = function () {
        var ObjectId = AppV.GetGlobals().ObjectId;

        if (ObjectId > 80 && ObjectId < 90) {
            notificationsAddMainContact.SetVisible(true);
        }
        else {
            notificationsAddMainContact.SetVisible(false);
        }
        if (notificationToGrid.pageRowCount > 0) {
            notificationToGrid.SetFocusedRowIndex(0);
        }
    };

    // #endregion

    // #region Edit/Save
    notifications.NewPopupShown = function (s, e) {
        if (typeof btnToClose != "undefined")
            btnToClose.SetEnabled(true);
    };
    
    notifications.NewPopupBeginCallback = function (s, e) {
        NotificationRecordId = pcModalNewNotification.cpNotificationRecordId;
        GroupObjId = pcModalNewNotification.cpNotificationGroupObjId;
        ConditionsString = pcModalNewNotification.cpNotificationString;
        SelectedTypeId = pcModalNewNotification.cpNotificationType1;
        SelectedTypeId1 = pcModalNewNotification.cpNotificationType2;
    };

    notifications.GetNewPopUpCallBack = function () {
        View.load("notificationNewPopup",
            {
                ObjectId: AppV.GetGlobals().ObjectId,
                RecordGuid: AppV.GetGlobals().RecordGuid,
                IsSmsChecked: false,
                NotificationRecordId: -1,
                Head: null,
                Body: null,
                isEdit: false,
                reload: true
            });
    };

    notifications.GetItemsToSave = function () {
        var subject = typeof notificationsSubject === "undefined" ? "" : window.notificationsSubject.GetText();
        var message = typeof notificationsMessages === "undefined" ? "" : window.notificationsMessages.GetText();
        var dateTime = typeof motificationDateTimeChckb === "undefined" ? false : window.motificationDateTimeChckb.GetValue();
        var date = typeof motificationCalendar === "undefined" ? "" : window.motificationCalendar.GetText();
        if (date === "") { date = "1/1/0001"; }
        var time = typeof motificationTime === "undefined" ? "" : window.motificationTime.GetText();

        var conditions = typeof motificationConditionsChckb === "undefined" ? false : window.motificationConditionsChckb.GetValue();
        var twoConditions = typeof motificationTwoConditions === "undefined" ? false : window.motificationTwoConditions.GetValue();
        var andOr = typeof notificationAndOr === "undefined" ? -1 : window.notificationAndOr.GetValue();

        var field1 = typeof notificationFieldCmb === "undefined" ? null : window.notificationFieldCmb.GetValue();
        if (field1 === null) { field1 = ""; }
        var field2 = typeof notificationField1Cmb === "undefined" ? null : window.notificationField1Cmb.GetValue();
        if (field2 === null) { field2 = ""; }

        var condition1 = typeof notificationConditionCmb === "undefined" ? null : window.notificationConditionCmb.GetValue();
        if (condition1 === null) { condition1 = ""; }
        var condition2 = typeof notificationCondition1Cmb === "undefined" ? null : window.notificationCondition1Cmb.GetValue();
        if (condition2 === null) { condition2 = ""; }

        var value2 = typeof notificationValue1Cmb === "undefined" ? "" : window.notificationValue1Cmb.GetText();
        var value1 = typeof notificationValueCmb === "undefined" ? "" : window.notificationValueCmb.GetText();

        if (conditions === true) {
            if (field1 === "") {
                twoConditions = false;
                andOr = 0;
                field2 = "";
                condition2 = "";
                value2 = "";
            }
            if (twoConditions === false) {
                andOr = 0;
                field2 = "";
                condition2 = "";
                value2 = "";
            }
        }
        else {
            twoConditions = false;
            andOr = 0;
            field1 = "";
            field2 = "";
            condition2 = "";
            condition1 = "";
            value1 = "";
            value2 = "";
        }

        var NotificationstItems = {
            Subject: subject,
            Message: message,
            DateTime: dateTime,
            Date: date,
            Time: time,
            Conditions: conditions,
            Field1: field1,
            Condition1: condition1,
            Value1: value1,
            TwoConditions: twoConditions,
            AndOr: andOr,
            Field2: field2,
            Condition2: condition2,
            Value2: value2,
            SelectedTypeId: SelectedTypeId,
            SelectedTypeId1: SelectedTypeId1
        };

        return NotificationstItems;
    };

    notifications.ObjectRecordReportId = function () {
        var objRecordReportId = [];
        var objectRecordReportId = Helper.FilterGridSelectedKeysOnPage("notificationAttachmentsGrid", "ObjectRecordReportId");
        if (typeof objectRecordReportId === 'undefined' || objectRecordReportId === null || objectRecordReportId.length < 1 || objectRecordReportId === -1) {
            objRecordReportId.push(0);
        }
        else {
            objectRecordReportId.forEach(function (entry) {
                if (entry.ObjectRecordReportId !== null) {
                    objRecordReportId.push(entry.ObjectRecordReportId);
                }
            });
        }
        return objRecordReportId;
    };

    notifications.SaveNewNotifications = function () {
        var checked = typeof notificationEmailOrSmsType === "undefined" ? false : window.notificationEmailOrSmsType.GetSelectedIndex();
        var isSmsChecked;
        if (checked === 0) { isSmsChecked = false; }
        else { isSmsChecked = true; }

        var objId = AppV.GetGlobals().ObjectId;
        var recordGuid = AppV.GetGlobals().RecordGuid;

        var notificationsDataConditions = [];
        var ItemsNotifications = Notifications.GetItemsToSave();
        var NtfsItms = JSON.stringify(ItemsNotifications);
        notificationsDataConditions.push(NtfsItms);

        $.ajax({
            url: '/Notifications/CallNotificationsSave',
            type: "POST",
            data: {
                ObjectId: objId,
                RecordNotificationId: NotificationRecordId,
                RecordGuid: recordGuid,
                IsSmsChecked: isSmsChecked,
                MainContact: false,
                NotificationsDataConditions: notificationsDataConditions,
                ObjectRecordReportId: Notifications.ObjectRecordReportId()
            },
            success: function (response) {
                if (!response.Success) {
                    Notification.SetNotification(SwResourceObject.UnableToAddAManualAddress, 'warning', 3500);
                    return;
                }
            }
        });
        pcModalNewNotification.Hide();
        Notifications.PerformCallbackNotifications(objId, recordGuid, true);
        Reload = true;
    };

    notifications.CloseNewNotificationsPopUp = function () {
        var nameChkb = window["EnableNotificationsChkb" + moduleName];
        var enableNotifications = false;
        if (typeof nameChkb !== "undefined") {
            enableNotifications = nameChkb.GetChecked();
        }
        $.ajax({
            url: '/Notifications/CloseNewNotificationPopUp',
            type: "POST",
            data: {
                RecordGuid: AppV.GetGlobals().RecordGuid,
                ObjectId: AppV.GetGlobals().ObjectId,
                EnableNotifications: enableNotifications
            },
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    pcModalNewNotification.Hide();
                }
                else {
                    Notification.SetNotification(SwResourceObject.Failed, 'warning', 3500);
                    return;
                }
            }
        });
        btnToClose.SetEnabled(false);
        Reload = false;
    };

    notifications.GetNotificationsProperties = function () {
        var gridName = "NotificationsGrid" + moduleName;
        result = JSON.parse(window[gridName].cpAllRowData)[window[gridName].GetFocusedRowIndex()];
        if (result === null || result === undefined || result === -1) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, enums.NotificationStatus.Warning, 3500);
            return;
        }
        else {
            var notificationId = result.RecordNotificationId;
            var msgType = result.MSGType;
            var head = result.Subject;
            var body = result.Body;
        }

        if (msgType === 1) { var isSmsChecked = true; }
        else { isSmsChecked = false; }

        View.load("notificationNewPopup",
            {
                ObjectId: AppV.GetGlobals().ObjectId,
                RecordGuid: AppV.GetGlobals().RecordGuid,
                IsSmsChecked: isSmsChecked,
                NotificationRecordId: notificationId,
                Head: head,
                Body: body,
                isEdit: true,
                reload: Reload
            });
    };

    notifications.SetData = function () {
        if (ConditionsString !== null && ConditionsString.length !== 0) {
            var array = [];
            array = ConditionsString.split('\n');

            notificationFieldCmb === "undefined" ? null : window.notificationFieldCmb.SetValue(array[0]);
            notificationConditionCmb === "undefined" ? null : window.notificationConditionCmb.SetValue(array[1]);
            if (SelectedTypeId !== 3) { notificationValueCmb === "undefined" ? "" : window.notificationValueCmb.SetText(array[2]); }

            if (array[3] === "Yes") { motificationTwoConditions === "undefined" ? false : window.motificationTwoConditions.SetValue(true); }
            else { motificationTwoConditions === "undefined" ? false : window.motificationTwoConditions.SetValue(false); }

            if (array[4] === "And" || array[4] === "") { notificationAndOr === "undefined" ? false : window.notificationAndOr.SetSelectedIndex(0); }
            else { notificationAndOr === "undefined" ? false : window.notificationAndOr.SetSelectedIndex(1); }

            if (array[5] !== "-1") {
                notificationField1Cmb === "undefined" ? null : window.notificationField1Cmb.SetValue(array[5]);
                notificationCondition1Cmb === "undefined" ? null : window.notificationCondition1Cmb.SetValue(array[6]);
                if (SelectedTypeId1 !== 3) { notificationValue1Cmb === "undefined" ? "" : window.notificationValue1Cmb.SetText(array[7]); }
            }

            Notifications.EnableDisableTwoConditions();
        }
    };

    // #endregion

    // #region AddContacts

    notifications.GetAddContactPopUpCallBack = function () {
        var checked = typeof notificationEmailOrSmsType === "undefined" ? false : window.notificationEmailOrSmsType.GetSelectedIndex();
        if (checked === false) {
            return;
        }
        var isSmsChecked;
        if (checked === 0) { isSmsChecked = false; }
        else { isSmsChecked = true; }

        View.load("notificationAddContactPopup",
            {
                ObjectId: AppV.GetGlobals().ObjectId,
                RecordGuid: AppV.GetGlobals().RecordGuid,
                GroupObjId: GroupObjId,
                IsSmsChecked: isSmsChecked,
                SelectedObjId: 0
            });
    };

    notifications.GetAddManuallyPopUpCallBack = function () {
        var checked = typeof notificationEmailOrSmsType === "undefined" ? false : window.notificationEmailOrSmsType.GetSelectedIndex();
        var isSmsChecked;
        if (checked === 0) { isSmsChecked = false; }
        else { isSmsChecked = true; }

        View.load("notificationAddManuallyPopup",
            {
                IsSmsChecked: isSmsChecked,
                AddManual: true
            });
    };

    notifications.CloseAddContactNotification = function (s, e) {
        var checked = typeof notificationEmailOrSmsType === "undefined" ? false : window.notificationEmailOrSmsType.GetSelectedIndex();
        var isSmsChecked;
        if (checked === 0) { isSmsChecked = false; }
        else { isSmsChecked = true; }

        notificationToGrid.PerformCallback({
            ObjectId: AppV.GetGlobals().ObjectId,
            RecordGuid: AppV.GetGlobals().RecordGuid,
            GroupObjId: GroupObjId,
            IsSmsChecked: isSmsChecked,
            RecordNotificationId: NotificationRecordId,
            reload: true
        });
        pcModalAddContactNotification.Hide();
    };

    notifications.CloseAddManuallyNotification = function (s, e) {
        var checked = typeof notificationEmailOrSmsType === "undefined" ? false : window.notificationEmailOrSmsType.GetSelectedIndex();
        var isSmsChecked;
        if (checked === 0) { isSmsChecked = false; }
        else { isSmsChecked = true; }

        var fName = typeof notificationAddManuallyFirstName === "undefined" ? null : notificationAddManuallyFirstName.GetValue();
        var lName = typeof notificationAddManuallyLastName === "undefined" ? null : notificationAddManuallyLastName.GetValue();
        var email = typeof notificationAddManuallyEmail === "undefined" ? false : notificationAddManuallyEmail.GetValue();
        var telephone = typeof notificationAddManuallyTelephone === "undefined" ? false : notificationAddManuallyTelephone.GetValue();

        var otherAddress = " ";
        if (email === false) {
            if (telephone !== null) {
                otherAddress = telephone;
            }
        }
        if (telephone === false) {
            if (email !== null) {
                otherAddress = email;
            }
        }

        if (!fName || !lName || !otherAddress) {
            Notification.SetNotification(SwResourceObject.PleaseCompleteAllFields, 'warning', 3500);
            return;
        }
        else {
            var fN = fName.trim();
            var lN = lName.trim();
            var oAdd = otherAddress.trim();
            if (!fN || !lN || !oAdd) {
                Notification.SetNotification(SwResourceObject.PleaseCompleteAllFields, 'warning', 3500);
                return;
            }
            else {
                var FullName = fN + " " + lN;
                var exist1 = Notifications.DoNotAddMultipleTimes(FullName);
                if (exist1 === true) {
                    Notification.SetNotification(SwResourceObject.ThisUsernameHasAlreadyBeenUsed, 'warning', 3500);
                    pcModalAddManuallyNotification.Hide();
                    return;
                }
                else {
                    $.ajax({
                        url: '/Notifications/InsertManually',
                        type: "POST",
                        data: {
                            RecordNotificationId: NotificationRecordId,
                            FName: fN,
                            LName: lN,
                            OtherAddress: oAdd
                        },
                        success: function (response) {
                            var res = JSON.parse(response.data);
                            if (res.Success) {
                                pcModalAddManuallyNotification.Hide();
                                notificationToGrid.PerformCallback({
                                    ObjectId: AppV.GetGlobals().ObjectId,
                                    RecordGuid: AppV.GetGlobals().RecordGuid,
                                    GroupObjId: GroupObjId,
                                    IsSmsChecked: isSmsChecked,
                                    RecordNotificationId: NotificationRecordId,
                                    reload: true
                                });
                            }
                            else {
                                Notification.SetNotification(SwResourceObject.FailedToApplyChanges, 'warning', 3500);
                                pcModalAddManuallyNotification.Hide();
                            }
                        }
                    });
                }
            }
        }
    };

    notifications.AddGridBeginCallback = function (s, e) {
        var checked = typeof notificationEmailOrSmsType === "undefined" ? false : window.notificationEmailOrSmsType.GetSelectedIndex();
        var isSmsChecked;
        if (checked === 0) { isSmsChecked = false; }
        else { isSmsChecked = true; }

        var selectedItem = typeof notifiacationSelectContactTypeList === "undefined" ? 0 : notifiacationSelectContactTypeList.GetCurrentValue();
        var selectedObjId;
        if (selectedItem === null) {
            selectedObjId = 0;
        }
        else {
            selectedObjId = selectedItem;
        }

        e.customArgs["ObjectId"] = AppV.GetGlobals().ObjectId;
        e.customArgs["RecordGuid"] = AppV.GetGlobals().RecordGuid;
        e.customArgs["GroupObjId"] = GroupObjId;
        e.customArgs["searchString"] = contactSearchText.GetText();
        e.customArgs["IsSmsChecked"] = isSmsChecked;
        e.customArgs["SelectedObjId"] = selectedObjId;
        e.customArgs["RecordNotificationId"] = NotificationRecordId;
        e.customArgs["reload"] = false;
    };

    notifications.GetAddContactGridCallBack = function () {
        var checked = typeof notificationEmailOrSmsType === "undefined" ? false : window.notificationEmailOrSmsType.GetSelectedIndex();
        var isSmsChecked;
        if (checked === 0) { isSmsChecked = false; }
        else { isSmsChecked = true; }

        var selectedItem = typeof notifiacationSelectContactTypeList === "undefined" ? 0 : notifiacationSelectContactTypeList.GetCurrentValue();
        var selectedObjId;
        if (selectedItem === null) {
            selectedObjId = 0;
        }
        else {
            selectedObjId = selectedItem;
        }

        notificationAddGrid.PerformCallback({
            ObjectId: AppV.GetGlobals().ObjectId,
            RecordGuid: AppV.GetGlobals().RecordGuid,
            GroupObjId: GroupObjId,
            searchString: contactSearchText.GetText(),
            IsSmsChecked: isSmsChecked,
            SelectedObjId: selectedObjId,
            RecordNotificationId: NotificationRecordId,
            reload: true
        });
    };

    notifications.AddAddress = function (s, e) {
        var selectedRecords = [];
        var result = Helper.FilterGridSelectedKeysOnPage("notificationAddGrid", "IdRecord");
        if (result.length === 0 || result === -1) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }
        result.forEach(function (entry) {
            if (entry.RecordNotificationsAddressId === -1) {
                selectedRecords.push(entry);
            }
        });
        if (selectedRecords.length === 0) {
            return;
        }

        $.ajax({
            url: '/Notifications/AddSelectedUsers',
            type: "POST",
            data: {
                SelectedRecords: selectedRecords,
                ObjectId: AppV.GetGlobals().ObjectId,
                RecordGuid: AppV.GetGlobals().RecordGuid,
                GroupObjId: GroupObjId,
                RecordNotificationId: NotificationRecordId
            },
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    Notifications.GetAddContactGridCallBack();
                }
                else {
                    Notification.SetNotification(SwResourceObject.FailedToApplyChanges, 'warning', 3500);
                    return;
                }
            }
        });
    };

    notifications.CallAddMeNotifications = function (s, e) {
        var checked = typeof notificationEmailOrSmsType === "undefined" ? false : window.notificationEmailOrSmsType.GetSelectedIndex();
        var isSmsChecked;
        var exist = Notifications.DoNotAddMultipleTimes(Helper.GetCookie("FullName"));
        if (exist === true) {
            Notification.SetNotification(SwResourceObject.ThisUsernameHasAlreadyBeenUsed, 'warning', 3500);
            return;
        }
        if (checked === 0) {
            isSmsChecked = false;
            $.ajax({
                url: '/Notifications/AddMeNotification',
                type: "POST",
                data: {
                    RecordNotificationId: NotificationRecordId,
                    IsSmsChecked: isSmsChecked
                },
                success: function (response) {
                    var res = JSON.parse(response.data);
                    if (res.Success) {
                        notificationToGrid.PerformCallback({
                            ObjectId: AppV.GetGlobals().ObjectId,
                            RecordGuid: AppV.GetGlobals().RecordGuid,
                            GroupObjId: GroupObjId,
                            IsSmsChecked: isSmsChecked,
                            RecordNotificationId: NotificationRecordId,
                            reload: true
                        });
                    }
                    else {
                        if (res.Message !== "") {
                            Helper.ShowConfirmPopUp("SolidWorks", Helper.T("" + res.Message + ""), "Notifications.AddMeManually()");
                        }
                        else {
                            Notification.SetNotification(SwResourceObject.UnableToAddAManualAddress, 'warning', 3500);
                            return;
                        }
                    }
                }
            });
        }
        else {
            isSmsChecked = true;
            $.ajax({
                url: '/Notifications/AddMeNotification',
                type: "POST",
                data: {
                    RecordNotificationId: NotificationRecordId,
                    IsSmsChecked: isSmsChecked
                },
                success: function (response) {
                    var res = JSON.parse(response.data);
                    if (res.Success) {
                        notificationToGrid.PerformCallback({
                            ObjectId: AppV.GetGlobals().ObjectId,
                            RecordGuid: AppV.GetGlobals().RecordGuid,
                            GroupObjId: GroupObjId,
                            IsSmsChecked: isSmsChecked,
                            RecordNotificationId: NotificationRecordId,
                            reload: true
                        });
                    }
                    else {
                        if (res.Message !== "") {
                            Helper.ShowConfirmPopUp("SolidWorks", Helper.T("" + res.Message + ""), "Notifications.AddMeManually()");
                        }
                        else {
                            Notification.SetNotification(SwResourceObject.UnableToAddAManualAddress, 'warning', 3500);
                            return;
                        }
                    }
                }
            });
        }
    };

    notifications.AddMeManually = function () {
        var checked = typeof notificationEmailOrSmsType === "undefined" ? false : window.notificationEmailOrSmsType.GetSelectedIndex();
        var isSmsChecked;
        if (checked === 0) { isSmsChecked = false; }
        else { isSmsChecked = true; }

        View.load("notificationAddManuallyPopup",
            {
                IsSmsChecked: isSmsChecked,
                AddManual: false
            });
    };

    notifications.DoNotAddMultipleTimes = function (insert) {
        var userName = [];
        var inserted = JSON.parse(window["notificationToGrid"].cpAllRowData);
        inserted.forEach(function (entry) {
            userName.push(entry.Name);
        });
        if (userName.length > 0) {
            if (userName.indexOf(insert) > -1) { return true; }
            else { return false; }
        }
        else { return false; }
    };

    notifications.FieldLengthValidation = function (fieldName) {
        var FieldName = typeof fieldName === "undefined" ? null : fieldName.GetValue();
        if (FieldName.length >= 250) {
            fieldName.Clear();
            Notification.SetNotification(SwResourceObject.ThisValueIsNotAllowedItMayAlreadyExistOrHaveOtherRestrictions, 'warning', 3500);
            return;
        }
    };

    // #endregion

    // #region Remove

    notifications.ShowDeletedConfirmation = function () {
        var userSelected = Helper.FilterGridSelectedKeysOnPage("notificationToGrid", "RecordNotificationsAddressId");
        if (typeof userSelected === 'undefined' || userSelected === null || userSelected.length < 1 || userSelected === -1) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, enums.NotificationStatus.Warning, 3500);
        }
        else {
            Helper.ShowConfirmPopUp("SolidWorks", SwResourceObject.AreYouSureYouWantToDeleteSelectedItem, "Notifications.RemoveSelectedUserNotification()");
        }
    };

    notifications.ShowDeletedAllConfirmation = function () {
        var userSelected = window["notificationToGrid"].GetFocusedRowIndex();
        if (typeof (userSelected) === 'undefined' || userSelected === null || userSelected.length < 1 || userSelected === -1) {
            Notification.SetNotification(Helper.T("ThereIsNothingToDelete"), 'warning', 3500);
        }
        else {
            Helper.ShowConfirmPopUp("SolidWorks", SwResourceObject.AreYouSureYouWantToRemoveAllItems, "Notifications.RemoveAllUsersNotification()");
        }
    };

    notifications.RemoveSelectedUserNotification = function (s, e) {
        var checked = typeof notificationEmailOrSmsType === "undefined" ? false : window.notificationEmailOrSmsType.GetSelectedIndex();
        var isSmsChecked;
        if (checked === 0) { isSmsChecked = false; }
        else { isSmsChecked = true; }

        var selectedRecords = [];
        var result = Helper.FilterGridSelectedKeysOnPage("notificationToGrid", "RecordNotificationsAddressId");
        result.forEach(function (entry) {
            if (entry.RecordNotificationsAddressId !== null) {
                selectedRecords.push(entry.RecordNotificationsAddressId);
            }
        });
        $.ajax({
            url: '/Notifications/DeleteUserFromNotification',
            type: "POST",
            data: {
                RecordNotificationId: null,
                RecordNotificationsAddressId: selectedRecords
            },
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    notificationToGrid.PerformCallback({
                        ObjectId: AppV.GetGlobals().ObjectId,
                        RecordGuid: AppV.GetGlobals().RecordGuid,
                        GroupObjId: GroupObjId,
                        IsSmsChecked: isSmsChecked,
                        RecordNotificationId: NotificationRecordId,
                        reload: true
                    });
                }
                else {
                    Notification.SetNotification(SwResourceObject.FailedToApplyChanges, 'warning', 3500);
                    return;
                }
            }
        });
    };

    notifications.RemoveAllUsersNotification = function () {
        var checked = typeof notificationEmailOrSmsType === "undefined" ? false : window.notificationEmailOrSmsType.GetSelectedIndex();
        var isSmsChecked;
        if (checked === 0) { isSmsChecked = false; }
        else { isSmsChecked = true; }

        $.ajax({
            url: '/Notifications/DeleteUserFromNotification',
            type: "POST",
            data: {
                RecordNotificationId: NotificationRecordId,
                RecordNotificationsAddressId: 0
            },
            success: function (response) {
                var res = JSON.parse(response.data);
                if (res.Success) {
                    notificationToGrid.PerformCallback({
                        ObjectId: AppV.GetGlobals().ObjectId,
                        RecordGuid: AppV.GetGlobals().RecordGuid,
                        GroupObjId: GroupObjId,
                        IsSmsChecked: isSmsChecked,
                        RecordNotificationId: NotificationRecordId,
                        reload: true
                    });
                }
                else {
                    Notification.SetNotification(SwResourceObject.FailedToApplyChanges, 'warning', 3500);
                    return;
                }
            }
        });
    };

    // #endregion

    // #region Template

    notifications.GetSaveAsTemplatePopUp = function () {
        View.load("notificationSaveAsTemplate");
    };

    notifications.CallSaveAsTemplate = function (s, e) {
        var subject = typeof notificationsSubject === "undefined" ? "" : window.notificationsSubject.GetText();
        var message = typeof notificationsMessages === "undefined" ? "" : window.notificationsMessages.GetText();
        var templateName = typeof notificationsInputTemplateName === "undefined" ? null : notificationsInputTemplateName.GetValue();
        if (!templateName || templateName.length === 0) {
            Notification.SetNotification(SwResourceObject.FieldNameIsRequired, 'warning', 3500);
            return;
        }
        else {
            if (!templateName.trim()) {
                Notification.SetNotification(SwResourceObject.FieldNameIsRequired, 'warning', 3500);
                return;
            }
        }

        var TemplateNames = [];
        if (s.cpTemplateName !== null) {
            notificationsPage.cpTemplateName.forEach(function (element) {
                TemplateNames.push(element.TNName);
            });
        }

        if (TemplateNames.indexOf(templateName) > -1) {
            Notification.SetNotification(SwResourceObject.ThisNameIsAlreadyUsedPleaseTryADifferentOne, 'warning', 3500);
            return;
        }
        else {
            $.ajax({
                url: '/Notifications/CallSaveAsTemplates',
                type: "POST",
                data: {
                    TemplateName: templateName,
                    Subject: subject,
                    Message: message
                },
                success: function (response) {
                    var res = JSON.parse(response.data);
                    if (res.Success) {
                        notificationsTemplatesDropDown.PerformCallback();
                        pcModalSaveAsTemplate.Hide();
                    }
                    else {
                        Notification.SetNotification(SwResourceObject.Failed, 'warning', 3500);
                        return;
                    }
                }
            });
        }
    };

    notifications.ShowReplaceTemplate = function () {
        var templateId = typeof notifiacationUseTemplateDropDownList === "undefined" ? null : notifiacationUseTemplateDropDownList.GetValue();
        var body = typeof notificationsMessages === "undefined" ? null : notificationsMessages.GetValue();
        if (templateId === null) {
            Notification.SetNotification(SwResourceObject.PleaseSelectAnItem, 'warning', 3500);
            return;
        }
        else {
            if (body !== null) {
                Helper.ShowConfirmPopUp("SolidWorks", SwResourceObject.DoYouWantToReplaceExistingText, "Notifications.CallHeadAndBodyTemplates()");
            }
            else {
                Notifications.CallHeadAndBodyTemplates();
            }
        }
    };

    notifications.CallHeadAndBodyTemplates = function () {
        var templateId = typeof notifiacationUseTemplateDropDownList === "undefined" ? null : notifiacationUseTemplateDropDownList.GetValue();
        var checked = typeof notificationEmailOrSmsType === "undefined" ? 0 : window.notificationEmailOrSmsType.GetSelectedIndex();
        if (checked === 0) {
            notificationsSubjectTextBox.PerformCallback({
                TemplateId: templateId
            });
            notificationsMessageMemo.PerformCallback({
                TemplateId: templateId
            });
        }
        else {
            notificationsMessageMemo.PerformCallback({
                TemplateId: templateId
            });
        }

    };

    // #endregion

    //#region ConditionsAndValues

    notifications.GetNotificationCondition1 = function (s, e) {
        cpModalNotificationsConditions1.PerformCallback({
            ObjectId: AppV.GetGlobals().ObjectId,
            DisplayName: notificationFieldCmb.GetText()
        });
        Notifications.GetNotificationValue1();
    };

    notifications.GetNotificationCondition2 = function (s, e) {
        cpModalNotificationsConditions2.PerformCallback({
            ObjectId: AppV.GetGlobals().ObjectId,
            DisplayName: notificationField1Cmb.GetText()
        });
        Notifications.GetNotificationValue2();
    };

    notifications.GetNotificationValue1 = function (s, e) {
        cpModalNotificationsValue1.PerformCallback({
            ObjectId: AppV.GetGlobals().ObjectId,
            DisplayName: notificationFieldCmb.GetText()
        });

        var field1 = typeof notificationFieldCmb === "undefined" ? null : window.notificationFieldCmb.GetValue();
        Notifications.ReloadSelectedTypeId(field1);
    };

    notifications.GetNotificationValue2 = function (s, e) {
        cpModalNotificationsValue2.PerformCallback({
            ObjectId: AppV.GetGlobals().ObjectId,
            DisplayName: notificationField1Cmb.GetText()
        });

        var field2 = typeof notificationField1Cmb === "undefined" ? null : window.notificationField1Cmb.GetValue();
        Notifications.ReloadSelectedTypeId1(field2);
    };

    notifications.GetnotificationsConditionsForms = function () {
        $.ajax({
            url: '/Notifications/GetnotificationsConditionsForm',
            type: "POST",
            data: {
                ObjectId: AppV.GetGlobals().ObjectId,
                DisplayName: notificationFieldCmb.GetText()
            }
        });
    };

    //#endregion

    //#region ReloadSelectedTypeIds

    notifications.ReloadSelectedTypeId = function (TypeId) {
        $.ajax({
            url: '/Notifications/ReloadTypeId',
            type: "GET",
            data: {
                ObjectId: AppV.GetGlobals().ObjectId,
                TypeId: TypeId
            },
            cache: false,
            success: function (result) {
                SelectedTypeId = result;
            }
        });
    };

    notifications.ReloadSelectedTypeId1 = function (TypeId) {
        $.ajax({
            url: '/Notifications/ReloadTypeId',
            type: "GET",
            data: {
                ObjectId: AppV.GetGlobals().ObjectId,
                TypeId: TypeId
            },
            cache: false,
            success: function (result) {
                SelectedTypeId1 = result;
            }
        });
    };

    //#endregion

    notifications.ToGridBeginCallback = function (s, e) {
        var checked = typeof notificationEmailOrSmsType === "undefined" ? false : window.notificationEmailOrSmsType.GetSelectedIndex();
        var isSmsChecked;
        if (checked === 0) { isSmsChecked = false; }
        else { isSmsChecked = true; }
        e.customArgs["IsSmsChecked"] = isSmsChecked;
    };

    notifications.CountCharacter = function () {
        var count = typeof notificationsMessages === "undefined" ? 0 : notificationsMessages.GetText().length;
        var content = notificationLengthLabel.textContent;      //Tot no of characters
        if (count > 0) {
            content = SwResourceObject.TotNoOfCharacters + " (" + count + ")";
            document.getElementById('notificationLengthLabel').innerText = content;
        }
        else {
            document.getElementById('notificationLengthLabel').innerText = SwResourceObject.TotNoOfCharacters; //Tot no of characters
        }
    };

    notifications.ChangeRadiobutonCheckedIndex = function (sms) {
        var checked = typeof notificationEmailOrSmsType === "undefined" ? null : window.notificationEmailOrSmsType.GetSelectedIndex();
        if (checked !== null) {
            if (sms === true) { window.notificationEmailOrSmsType.SetSelectedIndex(1); }
            else { window.notificationEmailOrSmsType.SetSelectedIndex(0); }
        }
        else { return; }
        Notifications.EnableDisableSubject();
    };

    // #endregion

    window.Notifications = notifications;
})();;
var RzCalendar = (function () {

    var _State = {
        toolTipContext: null
    };


    var _InternalFunctions = {
        Default: {

        }
    };

    return {

        Default: {
            ShouldReload: function (reload) {
                if (typeof reload !== 'undefined')
                    _State.Default.reload = reload;
                else
                    return _State.Default.reload;
            }
        },

        Calendar: {
            BeginCallback: function (s, e) {
                //var selectedRecord = [];
                //Helper.FilterGridSelectedKeysOnPage("gridViewDocuments", "idRecord")
                //    .forEach(function (result, index) {
                //        selectedRecord.push(result.RecordGuid);
                //    });

                e.customArgs["showTasks"] = showTasks.GetValue();
                e.customArgs["showStages"] = showStages.GetValue();
                e.customArgs["showTopLevelProject"] = showTopLevelProject.GetValue();
                e.customArgs["showMilstones"] = showMilstones.GetValue();
                e.customArgs["recordGuid"] = s.cpRecordGuids;
            },

            //EndCallback: function (s, e) {
            //    if (s.cpModule == enums.Modules.Planning) {
            //        s.SetHeight(500);
            //    }
            //    //var height = RzProperties.GetCHeightForGanttChart();
            //    //var isMainGridDisplay = actionToPerform === enums.ActionToPerform.MainGridDisplay;
            //    //height = (isMainGridDisplay ? 500 : height);
            //    //var Id = Planning.getGanttChartId();
            //    //var IsOpenTemplate = actionToPerform === enums.ActionToPerform.Edit;
            //    //height = IsOpenTemplate ? 350 : height;
            //    //document.getElementById(Id).style.height = height + "px";
            //},

            OnToolTipDisplaying: function (s, e) {
                _State.toolTipContext = e;
                switch (e.toolTip.type) {
                    case MVCxSchedulerToolTipType.Appointment:
                        RzCalendar.Calendar.OnAppointmentTipDisplaying(s, e);
                        break;
                    case MVCxSchedulerToolTipType.AppointmentDrag:
                        break;
                    case MVCxSchedulerToolTipType.Selection:
                        //OnSelectionTipDisplaying(s, e);
                        break;
                }
            },

            OnAppointmentTipDisplaying: function (s, e) {
                var currentApt = RzCalendar.Calendar.GetCurrentApt();
                //if (!currentApt.updated) {
                //    CalendarScheduler.RefreshClientAppointmentProperties(currentApt, AppointmentPropertyNames.Normal, RzCalendar.Calendar.OnAppointmentRefresh);
                //    RzCalendar.Calendar.SetAptToolTipSubject("Loading...");
                //} else {
                RzCalendar.Calendar.SetAptToolTipSubject(currentApt.GetSubject());
                //}
                var textInterval = e.toolTip.ConvertIntervalToString(currentApt.interval);
                $('#AptToolTipInterval').html(textInterval);
            },

            OnAppointmentRefresh: function (apt) {
                apt.updated = true;
                RzCalendar.Calendar.SetAptToolTipSubject(apt.GetSubject());
            },

            SetAptToolTipSubject: function (text) {
                $('#AptToolTipSubject').html(ASPx.Str.EncodeHtml(text));
            },

            GetCurrentApt: function () {
                return _State.toolTipContext.data.GetAppointment();
            }
        },

        Menu: {
            MenuCheckClick: function (s, e) {
                if (window['gridViewDocuments'] !== undefined) {
                    var selectedRecord = [];
                    
                    Helper.FilterGridSelectedKeysOnPage("gridViewDocuments", "idRecord")
                        .forEach(function (result, index) {
                            selectedRecord.push(result.RecordGuid);
                        });
                    window['CalendarScheduler' + s.cpModule].PerformCallback({
                        recordGuid: selectedRecord
                    });
                } else {
                    window['CalendarScheduler' + s.cpModule].PerformCallback();
                }

            }
        }

    };

})();
;

//import { SSL_OP_NO_TICKET } from "constants";

(function () {

    var gridInlineEditor = {}
    gridInlineEditor.State = {
        eventGridS: [],
        eventGridE: [],
    };


    gridInlineEditor.CheckIfCanBeEdited = function () {
       // var isEdit = (AppV.GetGlobals().RecordId > 0) ? true : false;
        var acceptedProcess = true;
        if (typeof ribbonPrpCard !== "undefined") {
            var acceptProcess = ribbonPrpCard.GetItemByName('AcceptProcess');
            if (acceptProcess != null) {
                acceptedProcess = !ribbonPrpCard.GetItemByName('AcceptProcess').enabled;
            }
        }
        if (!AppV.GetGlobals().isMainWindow && acceptedProcess)
            return true;
        else
            return false;
    }

    var quantityField;
    var arrayDisableColumnsTextLine = ["swconfiguration", "createddate", "modifieddate", "revision", "folder", "configparent", "type", "origin", "primaryfile"];
    gridInlineEditor.GridBatchEditTemplateCellFocused = function (s, e) {
        var editEnable = false;
        var editBtn = false;
        var saveBtn = false;
        var gridName = s.name;
        var rowData;
        if (gridName.includes("BillOfMaterials")) {
            var checkGT = window.billOfMaterials.checkActiveDisplay();
            if (typeof window.ribbonPrpCard === "undefined") {
                e.cancel = true;
                return;
            }

            var columnData = JSON.parse(s.cpAllColumnData).find(function (field) { return field.SystemName == e.focusedColumn.fieldName });
            var isReference = columnData.IsReference;
            
            if (s.name.includes("TreeListBillOfMaterials")) {
                var result = Helper.FilterTreelistFocusedNodeKey(checkGT, "KEYID")[0];
                if (result.Level != "1") {
                    if (isReference == true)
                        editEnable = false;
                    else {
                        e.cancel = true;
                        return;
                        //editEnable = false;
                    }
                    
                }
                    
            }

            editBtn = window.ribbonPrpCard.GetItemByName("Edit").enabled;
            saveBtn = window.ribbonPrpCard.GetItemByName("SaveBom").enabled;

            

            if (editBtn == false && saveBtn == false) {
                e.cancel = true;
                return;
            }

            if (editBtn == false && saveBtn == true) {

                if (checkGT.startsWith("Tree")) {
                    rowData = Helper.FilterTreelistFocusedNodeKey(checkGT, "KEYID")[0];
                } else {
                    rowData = Helper.FilterGridFocusedRowKey(checkGT, "KEYID")[0];
                }
                 
                

                if (rowData.ChildObjId == -999) {
                    if (e.focusedColumn.fieldName.toLowerCase().trim() == "revision") {
                        editEnable = false;
                    }
                    else {
                        editEnable = arrayDisableColumnsTextLine.includes(e.focusedColumn.fieldName.toLowerCase().trim());
                    }
                    
                } else {
                    var check = (columnData.Action == 1 & columnData.HasEditRights && !columnData.IsPreviewMode);
                    if (check == 0)
                        editEnable = true;
                    else
                        editEnable = false;
                }
            } else {
                e.cancel = true;
                return; 
            }
        }

        if (gridName.includes("ProcessRelatedItemGrid")) {
            var rowData = JSON.parse(s.cpAllRowData).find(function (field) { return field.idRecord == e.key });
            if (rowData.ChildProcessGuid != null) {
                e.cancel = true;
                return;
            }
        }
        if (editEnable) {
            e.cancel = true;
            return;
        }

        var acceptedProcess = GridInlineEditor.CheckIfCanBeEdited();
        if (acceptedProcess) {
            if (e == null) return;
            if (e.focusedColumn == null || e.focusedColumn == "undefined") return;
            var fieldName = e.focusedColumn.fieldName;

            gridInlineEditor.State.eventGridS = s
            gridInlineEditor.State.eventGridE = e;

            if (fieldName == "Quantity")
                quantityField = e.focusedColumn;

            var columnItem = GridInlineEditor.GetColumnDataTypeId(s, fieldName);
            var fieldTypeId;
            if (s.name == "ProcessRelatedItemGrid")
                fieldTypeId = columnItem.TypeId;
            else
                fieldTypeId = columnItem.Type;

            if (fieldTypeId == enums.FieldTypes.Memo && columnItem.UseMemoRichText == true) {

                var fieldRow;
                if (s.name.includes("TreeListBillOfMaterials"))
                    fieldRow = e.itemValues[e.focusedColumn.index];
                else
                    fieldRow = e.rowValues[e.focusedColumn.index];

                var rowId;
                if (s.name.includes("Tree"))
                    rowId = e.nodeKey;
                else
                    rowId = e.key;
                

                if (fieldRow !== null) htmlContent = fieldRow.value;
                var hasChanges = s.batchEditApi.HasChanges(rowId, e.focusedColumn.index)
                if (!hasChanges) {
                    gridInlineEditor.GetMemoFullContentFromCustomProperties(s, rowId, e.focusedColumn.fieldName, columnItem.Id, true);
             
                } else {
                    if (!s.name.includes("SpecialObjectsGrid")) {
                        View.load("GridInlineEditorPopUpControl", {
                            htmlContent: htmlContent,
                            fieldName: e.focusedColumn.fieldName,
                            rowid: rowId,
                            id: columnItem.Id,
                            gridName: s.name
                        });
                    }
                }
            }

            var popUpUsed;
            if (s.name.includes("BillOfMaterials"))
                popUpUsed = enums.ActionToPerform.BomInlineEdit;
            else
                popUpUsed = enums.ActionToPerform.GridInlineEdit;

            if (fieldTypeId == enums.FieldTypes.ObjectType) {
                var columnItem = GridInlineEditor.GetColumnDataTypeId(s, fieldName);
                if (columnItem !== null) {
                    var objectId = columnItem.ObjectId;
                    var columnId = columnItem.Id;
                    var fieldName = columnItem.DisplayName;
                    var allowMultiple = columnItem.AllowMultipleItems;
                    ObjectTypeField.GridBatchEditObjectType(s, objectId, columnId, fieldName, allowMultiple, popUpUsed);
                }
            }
        } else {
            e.cancel = true;
            //Notification.SetNotification(window.SwResourceObject.YouMayNotHavePermissionToPerformThisAction, 'warning', 2500);
        }
    }

    gridInlineEditor.GetMemoFullContentFromCustomProperties = function(s, keyId, fieldName, id, callInlineEditor) {
        var customProps = JSON.parse(s.cpAllRowData);
        for (var i = 0; i < customProps.length; i++) {
            var rowId;

            if (s.name.includes("BillOfMaterials"))
                rowId = customProps[i].KEYID
            else
                rowId = customProps[i].idRecord;
            
            if (rowId == Number(keyId)) {
                var custom = customProps[i].CustomProperties;
                if (custom != null) {
                    var columnItem = custom.find(function(element) {
                        return element.SystemName == fieldName;
                    });
                    if (columnItem != null) {
                        $.ajax({
                            type: "POST",
                            url: '/ProcessItems/ConvertRtfToHtml/',
                            data: {
                                "rtf": columnItem.Value
                            },
                            dataType: "json",
                            success: function(response) {
                                if (response.success === true) {
                                    if (callInlineEditor == true) {
                                        gridInlineEditor.LoadModalInline(response, s, keyId, fieldName, id);
                                    }
                                    else
                                        gridInlineEditor.LoadModalNotEditable(response, s, keyId, fieldName, id);
                                }
                            }
                        });
                    }
                }
            }
        }
    }

    gridInlineEditor.LoadModalInline = function(response ,s, keyId, fieldName, id) {
        View.load("GridInlineEditorPopUpControl", {
            htmlContent: response.html,
            fieldName: fieldName,
            rowid: keyId,
            id: id,
            gridName: s.name
        });
    }

    gridInlineEditor.LoadModalNotEditable = function(response, s, keyId, fieldName, id) {
        View.load("HtmlEditorPopUpControl",
        {
            htmlContent: response.html,
            fieldName: fieldName
        });
    }

    var isTextChanged = false;
    gridInlineEditor.OnHtmlChanged = function (s, e) {
        isTextChanged = true;
    }

    gridInlineEditor.OnBatchEditEndEditing = function (s, e) {
        if (quantityField != null && quantityField != undefined && quantityField != "undefined") {

            var checkGT = window.billOfMaterials.checkActiveDisplay();
            var quantityValue;
            var quatityManualValue;
            var quatityExistingManualValue;
            var quantityExistingValue;
            var rowData;
            if (checkGT.startsWith("Tree")) {
                quantityExistingValue = e.nodeValues[s.GetColumnByName("Quantity").index].value;
                if (s.GetColumnByName("QtyManual") == null)
                    return;
                quatityExistingManualValue = e.nodeValues[s.GetColumnByName("QtyManual").index].value;
                rowData = JSON.parse(s.cpAllRowData).find(function (field) { return field.KEYID == e.nodeKey });
            } else {
                quantityExistingValue = e.rowValues[s.GetColumnByField("Quantity").index].value;
                if (s.GetColumnByField("QtyManual") == null)
                    return;
                quatityExistingManualValue = e.rowValues[s.GetColumnByField("QtyManual").index].value;
                rowData = JSON.parse(s.cpAllRowData).find(function (field) { return field.KEYID == e.key });
            }

            var prop = rowData.CustomProperties;
            quatityManualValue = prop.find(function (element) { return element.SystemName === "QtyManual" }).Value;
            quantityValue = prop.find(function (element) { return element.SystemName === "Quantity" }).Value;

            if (rowData.BKeepQuantityInSync != 0 && quatityManualValue == quantityValue) {
                if (checkGT.startsWith("Tree")) {
                    if (quatityExistingManualValue == quatityManualValue) {
                        s.batchEditApi.SetCellValue(e.nodeKey, "QtyManual", quantityExistingValue);
                    }
                } else {
                    if (quatityExistingManualValue == quatityManualValue) {
                        s.batchEditApi.SetCellValue(e.visibleIndex, "QtyManual", quantityExistingValue);
                    }
                }
            }
            
            quantityField = null;
        }
    }

    gridInlineEditor.OnFocusedCellChanging = function(s, e) {
        var col = gridInlineEditor.GetColumnDataTypeId(s, e.cellInfo.column.name);
        if (col != undefined) {
            var value = s.batchEditApi.GetCellValue(e.cellInfo.rowVisibleIndex, e.cellInfo.column);
            if (s.name.includes("BillOfMaterials")) {

                if (s.name.includes("Tree"))
                    value = s.batchEditApi.GetCellValue(e.cellInfo.nodeKey, e.cellInfo.column);

                if (window.ribbonPrpCard == undefined)
                    return;

                editBtn = window.ribbonPrpCard.GetItemByName("Edit").enabled;
                saveBtn = window.ribbonPrpCard.GetItemByName("SaveBom").enabled;
                
                if (editBtn == true && saveBtn == false) {

                    if (col.TypeId == enums.FieldTypes.HyperLink) {
                        gridInlineEditor.OpenNewTab(value);

                    } else if (col.TypeId == enums.FieldTypes.Memo && col.UseMemoRichText) {
                        if (s.name.includes("Tree"))
                            gridInlineEditor.GetMemoFullContentFromCustomProperties(s, e.cellInfo.nodeKey, e.cellInfo.column.name, col.id, false);
                        else
                            gridInlineEditor.GetMemoFullContentFromCustomProperties(s, e.cellInfo.key, e.cellInfo.column.name, col.id, false);
                    }

                }
            }
            else if (col.Action != 1) {
                if (col.TypeId == enums.FieldTypes.HyperLink) {
                    gridInlineEditor.OpenNewTab(value);

                } else if (col.TypeId == enums.FieldTypes.Memo && col.UseMemoRichText) {
                    gridInlineEditor.GetMemoFullContentFromCustomProperties(s, e.cellInfo.key, e.cellInfo.column.name, e.cellInfo.column.id, false);
                }
            }
        }
    }

    gridInlineEditor.OpenNewTab = function(value) {
        if (!value.match(/^https?:\/\//i)) {
            value = 'http://' + value;
        }

        var newwindow = window.open(value, "_blank");
        newwindow.focus();
    }

    gridInlineEditor.btnSaveRichText = function (s, e) {
        var eventEditoContent = GridInlineEditorContent;
        var content = eventEditoContent.GetHtml ? eventEditoContent.GetHtml() : eventEditoContent.GetText();

        GridInlineEditorPopUpControl.Hide();
        if (isTextChanged)
            gridInlineEditor.SetInlineGridDataCell(content);
    };

    gridInlineEditor.SetInlineGridDataCell = function (content) {
        GridInlineEditor.SetGridContentCell(content);

        var eventGridE = gridInlineEditor.State.eventGridE;
        var eventGridS = gridInlineEditor.State.eventGridS;
        var fieldName = eventGridE.focusedColumn.fieldName;
        var columnItem = GridInlineEditor.GetColumnDataTypeId(eventGridS, fieldName);

        if (columnItem.Type == enums.FieldTypes.Memo) {
            GridInlineEditor.SetGirdFocusRowCell();
        }
    }
    gridInlineEditor.SetGridContentCell = function (content) {
        var eventGridS = gridInlineEditor.State.eventGridS;
        var eventGridE = gridInlineEditor.State.eventGridE;
        if (eventGridS.name.includes("TreeListBillOfMaterials")) {
            eventGridS.batchEditApi.SetCellValue(eventGridE.nodeKey, eventGridE.focusedColumn.fieldName, content)
        } else {
            eventGridS.batchEditApi.SetCellValue(eventGridE.visibleIndex, eventGridE.focusedColumn.fieldName, content)
        }
        
    }

    gridInlineEditor.SetGirdFocusRowCell = function () {
        var eventGridS = gridInlineEditor.State.eventGridS;
        var eventGridE = gridInlineEditor.State.eventGridE;
        window[eventGridS.name].SetFocusedRowIndex = eventGridE.visibleIndex
        if (eventGridS.name == "ProcessRelatedItemGrid") {
            gridInlineEditor.ClearGridInlineState();
        }
        
    }

    gridInlineEditor.ClearGridInlineState = function () {
        gridInlineEditor.State.eventGridS = [];
        gridInlineEditor.State.eventGridE = [];
    }

    gridInlineEditor.GetColumnDataTypeId = function (s, fieldName) {
        //var fieldTypeId = -1;
        var columnData = JSON.parse(s.cpAllColumnData);
        var columnItem = columnData.find(function (element) {
            return element.DisplayName == fieldName;
        });

        if (columnItem == null || columnData == "undefined" || columnData == undefined) {
            columnItem = columnData.find(function (element) {
                return element.SystemName == fieldName;
            });
        }
        return columnItem;
    }

    gridInlineEditor.ApplyAll = function (grid) {
        var eventGridE = gridInlineEditor.State.eventGridE;
        var eventGridS = gridInlineEditor.State.eventGridS;

        if (eventGridE.length == 0)
            return;

        var rows = grid.GetVisibleRowsOnPage();
        var focusedRowIndex = grid.GetFocusedRowIndex();

        

        var fieldName = eventGridE.focusedColumn.fieldName;
        var column = eventGridS.GetColumnByField(fieldName)
        
        //var content = eventGridS.batchEditApi.GetCellValue(focusedRowIndex, column);
        var type = gridInlineEditor.GetColumnDataTypeId(grid, fieldName);
        var content = "";
        var value = "";
        if (type !== null) {
            if (type.TypeId == enums.FieldTypes.ListOfValuesNumeric || type.TypeId == enums.FieldTypes.ListOfValuesNumeric_Decimal || type.TypeId == enums.FieldTypes.ListOfValuesString) {
                var contentData = eventGridS.batchEditApi.GetCellTextContainer(focusedRowIndex, column);
                value = eventGridS.batchEditApi.GetCellValue(focusedRowIndex, column);
                if (contentData !== null) content = contentData.textContent;
            } else {
                content = eventGridS.batchEditApi.GetCellValue(focusedRowIndex, column);
                value = eventGridS.batchEditApi.GetCellValue(focusedRowIndex, column);
            }
        }
        var listkeyGridData = "";
        if (type !== null) {
            if (rows > 0) {
                for (var i = 0; i < rows; i++) {
                    var keyGrid = grid.GetRowKey(i);
                    var rowData = JSON.parse(eventGridS.cpAllRowData).find(function (field) { return field.idRecord == keyGrid });
                    if (rowData.ChildProcessGuid == null) {
                        listkeyGridData += keyGrid + ";";
                        eventGridS.batchEditApi.SetCellValueByKey(keyGrid, column, content, content, false)
                    }
                    
                }

                if (type.TypeId == enums.FieldTypes.ObjectType) {
                    $.ajax({
                        type: "POST",
                        url: '/Properties/FillMultipleObjectsCacheModel/',
                        data: {
                            "columnId": type.Id,
                            "keyGrid": eventGridE.key,
                            "listkeyGridData": listkeyGridData,
                            "objectTypePopUpUsed": enums.ActionToPerform.GridInlineEdit,
                        },
                        dataType: "json",
                        success: function (response) {
                            if (response.Sucess === true) {

                            } else {
                                Notification.SetNotification(window.SwResourceObject['PleaseSelectAnItem'], 'warning', 2500);
                            }
                        }
                    });
                }
                    
            }
            
        }
        

    }

    gridInlineEditor.ApplyAbove = function (grid) {
        var eventGridE = gridInlineEditor.State.eventGridE;
        var eventGridS = gridInlineEditor.State.eventGridS;

        if (eventGridE.length == 0)
            return;

        var rows = grid.GetVisibleRowsOnPage();
        var focusedRowIndex = grid.GetFocusedRowIndex();

        var fieldName = eventGridE.focusedColumn.fieldName;
        var column = eventGridS.GetColumnByField(fieldName)


        //var content = eventGridS.batchEditApi.GetCellValue(focusedRowIndex, column);
        var type = gridInlineEditor.GetColumnDataTypeId(grid, fieldName);
        var content = "";
        var value = "";
        if (type !== null) {
            if (type.TypeId == enums.FieldTypes.ListOfValuesNumeric || type.TypeId == enums.FieldTypes.ListOfValuesNumeric_Decimal || type.TypeId == enums.FieldTypes.ListOfValuesString) {
                var contentData = eventGridS.batchEditApi.GetCellTextContainer(focusedRowIndex, column);
                value = eventGridS.batchEditApi.GetCellValue(focusedRowIndex, column);
                if (contentData !== null) content = contentData.textContent;
            } else if(type.TypeId == enums.FieldTypes.ObjectType){
                var contentData = eventGridS.batchEditApi.GetCellTextContainer(focusedRowIndex, column);
                value = eventGridS.batchEditApi.GetCellValue(focusedRowIndex, column);
                if (contentData !== null) content = contentData.textContent;
            }
            else {
                content = eventGridS.batchEditApi.GetCellValue(focusedRowIndex, column);
                value = eventGridS.batchEditApi.GetCellValue(focusedRowIndex, column);
            }
        }
        var listkeyGridData = "";
        if (type !== null) {
            if (rows > 0) {
                for (var i = 0; i < focusedRowIndex; i++) {
                    var keyGrid = grid.GetRowKey(i);
                    var rowData = JSON.parse(eventGridS.cpAllRowData).find(function (field) { return field.idRecord == keyGrid });
                    if (rowData.ChildProcessGuid == null) {
                        listkeyGridData += keyGrid + ";";
                        eventGridS.batchEditApi.SetCellValueByKey(keyGrid, column, content, content, false)
                    }
                }

                if (type.TypeId == enums.FieldTypes.ObjectType) {
                    $.ajax({
                        type: "POST",
                        url: '/Properties/FillMultipleObjectsCacheModel/',
                        data: {
                            "columnId": type.Id,
                            "keyGrid": eventGridE.key,
                            "listkeyGridData": listkeyGridData,
                            "objectTypePopUpUsed": enums.ActionToPerform.GridInlineEdit,
                        },
                        dataType: "json",
                        success: function (response) {
                            if (response.Sucess === true) {

                            } else {
                                Notification.SetNotification(window.SwResourceObject['PleaseSelectAnItem'], 'warning', 2500);
                            }
                        }
                    });
                } 
            }
        }

        

    }

    gridInlineEditor.ApplyBelow = function (grid) {
        var eventGridE = gridInlineEditor.State.eventGridE;
        var eventGridS = gridInlineEditor.State.eventGridS;

        if (eventGridE.length == 0)
            return;

        var rows = grid.GetVisibleRowsOnPage();
        var focusedRowIndex = grid.GetFocusedRowIndex();

        var fieldName = eventGridE.focusedColumn.fieldName;
        var column = eventGridS.GetColumnByField(fieldName);

        var type = gridInlineEditor.GetColumnDataTypeId(grid, fieldName);
        var content = "";
        var value = "";
        if (type !== null) {
            if (type.TypeId == enums.FieldTypes.ListOfValuesNumeric || type.TypeId == enums.FieldTypes.ListOfValuesNumeric_Decimal || type.TypeId  == enums.FieldTypes.ListOfValuesString) {
                var contentData = eventGridS.batchEditApi.GetCellTextContainer(focusedRowIndex, column);
                value = eventGridS.batchEditApi.GetCellValue(focusedRowIndex, column);
                if (contentData !== null) content = contentData.textContent;
            } else {
                content = eventGridS.batchEditApi.GetCellValue(focusedRowIndex, column);
                value = eventGridS.batchEditApi.GetCellValue(focusedRowIndex, column);
            }
        }
        var listkeyGridData = "";
        if (type !== null) {
            if (rows > 0) {
                for (var i = focusedRowIndex; i < rows; i++) {
                    var keyGrid = grid.GetRowKey(i);
                    var rowData = JSON.parse(eventGridS.cpAllRowData).find(function (field) { return field.idRecord == keyGrid });
                    if (rowData.ChildProcessGuid == null) {
                        listkeyGridData += keyGrid + ";";
                        eventGridS.batchEditApi.SetCellValue(i, column, value, content, false)
                    }
                }

                if (type.TypeId == enums.FieldTypes.ObjectType) {
                    $.ajax({
                        type: "POST",
                        url: '/Properties/FillMultipleObjectsCacheModel/',
                        data: {
                            "columnId": type.Id,
                            "keyGrid": eventGridE.key,
                            "listkeyGridData": listkeyGridData,
                            "objectTypePopUpUsed": enums.ActionToPerform.GridInlineEdit,
                        },
                        dataType: "json",
                        success: function (response) {
                            if (response.Sucess === true) {

                            } else {
                                Notification.SetNotification(window.SwResourceObject['PleaseSelectAnItem'], 'warning', 2500);
                            }
                        }
                    });
                }
            }
        }
        

    }

    gridInlineEditor.ApplySelected = function (grid) {
        var eventGridE = gridInlineEditor.State.eventGridE;
        var eventGridS = gridInlineEditor.State.eventGridS;

        if (eventGridE.length == 0)
            return;


        var rows = grid.GetSelectedKeysOnPage();
        var focusedRowIndex = grid.GetFocusedRowIndex();

        var fieldName = eventGridE.focusedColumn.fieldName;
        var column = eventGridS.GetColumnByField(fieldName);

        var type = gridInlineEditor.GetColumnDataTypeId(grid, fieldName);
        var content = "";
        var value = "";
        if (type !== null) {
            if (type.TypeId == enums.FieldTypes.ListOfValuesNumeric || type.TypeId == enums.FieldTypes.ListOfValuesNumeric_Decimal || type.TypeId == enums.FieldTypes.ListOfValuesString) {
                var contentData = eventGridS.batchEditApi.GetCellTextContainer(focusedRowIndex, column);
                value = eventGridS.batchEditApi.GetCellValue(focusedRowIndex, column);
                if (contentData !== null) content = contentData.textContent;
            } else {
                content = eventGridS.batchEditApi.GetCellValue(focusedRowIndex, column);
                value = eventGridS.batchEditApi.GetCellValue(focusedRowIndex, column);
            }
        }
        var listkeyGridData = "";
        if (type !== null) {
            if (rows.length > 0) {
                for (var i = 0; i < rows.length; i++) {
                    var keyGrid = rows[i];
                    var rowData = JSON.parse(eventGridS.cpAllRowData).find(function (field) { return field.idRecord == keyGrid });
                    if (rowData.ChildProcessGuid == null) { 
                        listkeyGridData += keyGrid + ";";
                        eventGridS.batchEditApi.SetCellValueByKey(keyGrid, column, value, content, false)
                    }
                }

                if (type.TypeId == enums.FieldTypes.ObjectType) {
                    $.ajax({
                        type: "POST",
                        url: '/Properties/FillMultipleObjectsCacheModel/',
                        data: {
                            "columnId": type.Id,
                            "keyGrid": eventGridE.key,
                            "listkeyGridData": listkeyGridData,
                            "objectTypePopUpUsed": enums.ActionToPerform.GridInlineEdit,
                        },
                        dataType: "json",
                        success: function (response) {
                            if (response.Sucess === true) {

                            } else {
                                Notification.SetNotification(window.SwResourceObject['PleaseSelectAnItem'], 'warning', 2500);
                            }
                        }
                    });
                }
            }
        }
    }

    gridInlineEditor.UpdateGrid = function () {
        var eventGridS = gridInlineEditor.State.eventGridS;
        var grid = window.ASPxClientControl.GetControlCollection().GetByName(eventGridS.name)
        if (grid != null &&  grid != "undefined") {
            grid.UpdateEdit();
        }
    }

    gridInlineEditor.CheckGridForChanges = function () {
        var eventGridS = gridInlineEditor.State.eventGridS;
        if (Object.keys(eventGridS).length > 0) {
           return eventGridS.batchEditApi.HasChanges();
        }
        return false;
    }

    
    gridInlineEditor.OnBatchEditConfirmShowing = function (s, e) {
        e.cancel = true;

    }
    
    window.GridInlineEditor = gridInlineEditor;
})();;
