import { IpcChannels as i } from "./accelbyte-widgets148.mjs";
import { AccPath as r } from "./accelbyte-widgets34.mjs";
import { GlobalPath as c } from "./accelbyte-widgets104.mjs";
import { LoginPath as s } from "./accelbyte-widgets35.mjs";
import { UrlUtils as m } from "./accelbyte-widgets90.mjs";
let a = !1;
class n {
  static getAppPage(e) {
    return `${c.Game.link}${e ? `?itemId=${e}` : ""}`;
  }
  static getAppIdFromQueryParameter(e) {
    return new URLSearchParams(e).get("itemId");
  }
  static openExternalBrowser(e) {
    if (!m.isValidUrl(e))
      throw new Error(`${e} is invalid URL`);
    Device.send(i.OPEN_EXTERNAL, e);
  }
  static refreshBrowser() {
    Device.send(i.REFRESH_BROWSER_WINDOW);
  }
}
n.receiveBrowserWindow = (o) => {
  Device.receive(i.GET_BROWSER_WINDOW, (e) => {
    o({
      minimizable: !!e.minimizable,
      maximizable: !!e.maximizable,
      isMaximized: !!e.isMaximized,
      canGoBack: !!e.canGoBack,
      canGoForward: !!e.canGoForward
    });
  });
};
n.startCheckConnection = () => {
  Device.send(i.START_CHECK_CONNECTION);
};
n.destroyCheckConnection = () => {
  Device.send(i.DESTROY_CHECK_CONNECTION);
};
n.receiveConnection = (o) => {
  Device.receive(i.IS_ONLINE, (e) => {
    a !== e && (a = e, Device.send(i.IS_ONLINE, e)), o(e);
  });
};
n.terminateLauncher = () => {
  Device.send(i.TERMINATE_LAUNCHER);
};
n.closeWindow = () => {
  Device.send(i.ON_CLOSE_WINDOW);
};
n.maximizeWindow = () => {
  Device.send(i.ON_MAXIMIZE_WINDOW);
};
n.unmaximizeWindow = () => {
  Device.send(i.ON_UNMAXIMIZE_WINDOW);
};
n.minimizeWindow = () => {
  Device.send(i.ON_MINIMIZE_WINDOW);
};
n.isRouteWithHeader = (o) => !d.find((t) => t === o);
n.isRouteWithFooter = (o) => !l.find((t) => t === o);
const d = [
  s.Login.link,
  r.UpgradeAccount.link,
  c.PromptLegal.link,
  r.AccountDeletionSuccess.link,
  r.EmailVerification.link,
  r.TwoFA.link
], l = [
  r.UpgradeAccount.link,
  c.PromptLegal.link,
  r.AccountDeletionSuccess.link,
  r.EmailVerification.link
];
export {
  n as LauncherHelper
};
