class ATCRadioData {
}
class ATCDialogLine {
}
class ATCDialogData {
    constructor() {
        this.IsOn = false;
    }
}
class ATCListener extends ViewListener.ViewListener {
    onUpdateATCData(callback) {
        this.on("UpdateATCAllData", callback);
    }
    onUpdateDialogs(callback) {
        this.on("UpdateATCDialogsData", callback);
    }
    onUpdatePromptAndOptions(callback) {
        this.on("UpdateATCPromptAndOptionsData", callback);
    }
    onUpdateATISData(callback) {
        this.on("UpdateATCATISData", callback);
    }
    onUpdateATCDRadioData(callback) {
        this.on("UpdateATCDRadioData", callback);
    }
    onUpdateCopilotState(callback) {
        this.on("UpdateCopilotState", callback);
    }
}
function RegisterATCListener(callback) {
    return RegisterViewListenerT("JS_LISTENER_ATC", callback, ATCListener);
}

class IngamePanelCustomPanel extends TemplateElement {
    constructor() {
        super(...arguments);
        this.onUpdateOptions = (data) => {
            this.SetPromptAndOptionsData(data);
        };
    }
    connectedCallback() {
        super.connectedCallback();
        this.ATCListener = RegisterATCListener(() => { });
        this.RegisterATCCallbacks();
    }
    initialize() {
    }
    disconnectedCallback() {
        super.disconnectedCallback();
    }
    RegisterATCCallbacks() {
        this.ATCListener.onUpdatePromptAndOptions(this.onUpdateOptions);
    }
    SetPromptAndOptionsData(data) {
        this.optionData = data.Options;
        var container = document.getElementById("atcOptions");
        while (container.firstChild) {
            container.removeChild(container.firstChild);
        }
        for (var i = 0; i < data.Options.length; i++) {
            if (!data.OptionsActive[i]) {
                continue;
            }

            if (data.Options[i].length != 0) {
                const regex = /(\d){1} - (.*)/g;
                let result = regex.exec(data.Options[i]);
                var com = document.createElement("li");
                com.innerText = result[1] + " - " + result[2];
                container.appendChild(com);
            }
        }
    }
    updateImage() {
    }
}
window.customElements.define("ingamepanel-custom", IngamePanelCustomPanel);
checkAutoload();