import e, { useState as v, useCallback as ae, useEffect as W, useRef as le, useMemo as Ve } from "react";
import { c as Ze, u as Qe, t as K, B as j, l as We, a as ge, b as ne, h as ee, e as ve } from "./useRoutes-367960a3.mjs";
import { HelpCircle as jt, Minus as qt, ChevronDown as dt, ChevronUp as Jt, Edit as xt, Copy as Yt, Trash2 as At, Plus as et, Search as Ct, Eye as Zt, X as vt, Info as Qt } from "react-feather";
import { Trans as y } from "react-i18next";
import { u as wt, B as tt, D as It, C as Dt, T as U, I as Fe, a as Lt, b as at, i as be, c as nt, R as Pt, S as st, g as Xe, d as kt, t as Be, e as re, E as Et, f as rt, P as ea } from "./isEqual-71550163.mjs";
import { a as ie, S as je, F as ye } from "./Select-934e9e99.mjs";
import { I as xe, P as Me } from "./InputGroup-b546018b.mjs";
import { F as N, u as me, W as Q, c as Ft, E as qe, b as ta } from "./Env-92498313.mjs";
import { Validate as V, SdkCache as k, CodeGenUtil as te, ApiUtils as $e, Network as O, DesktopChecker as Re } from "@accelbyte/sdk";
import { z as u } from "zod";
import { RoleResponseV3 as aa, Iam as na, IamUserAuthorizationClient as sa } from "@accelbyte/sdk-iam";
import { D as ra, a as oa, v as gt, A as Mt, b as ca, c as ot, d as Rt } from "./FormValidationError-77a20a8d.mjs";
import Ae from "classnames";
import { u as _e, a as ia } from "./index-28007ca6.mjs";
import { C as Oe, f as la, d as ht, j as ft, h as Tt, b as Nt } from "./validateNotEmpty-815360bd.mjs";
import { M as ma, a as pa } from "./numbers-bf855d8f.mjs";
import { L as I } from "./index-35107a02.mjs";
import "./ItemPlaceholder-4ed993c7.mjs";
import { B as he, m as ua } from "./HtmlUtils-79af1e28.mjs";
import { a as ct, b as it, L as da } from "./LoadingPage-d6d2cc0b.mjs";
import { T as Ea } from "./Tabs-de7e5bfe.mjs";
import { useReactTable as ga, getCoreRowModel as ha, getSortedRowModel as fa, flexRender as yt, createColumnHelper as _t } from "@tanstack/react-table";
import Ta from "react-copy-to-clipboard";
import { toast as H } from "react-toastify";
import { R as Na } from "./Radio-f3466dd6.mjs";
import Se from "react-tooltip";
import { C as Gt } from "./CommonError-b56f12ad.mjs";
import "flat";
import "i18next";
import "date-fns";
import "./utils.mjs";
import "uuid";
import "@lexical/code";
import "lexical";
import "react-dom";
import "./Modal-05e5e3d2.mjs";
import "./Typography-fd0ebec3.mjs";
import "./isObjectLike-a62f2bf0.mjs";
import "./merge-78dc87d6.mjs";
import "./InputLabel-760cfc94.mjs";
import "react-select";
import "axios";
import "@accelbyte/sdk-basic";
import "@accelbyte/sdk-legal";
import "buffer";
import "@accelbyte/sdk-gdpr";
import "xregexp";
import "./UrlUtils-1bad2fa2.mjs";
import "isomorphic-dompurify";
import "./ErrorLayout-d232f96c.mjs";
const Ut = u.enum([
  Oe.enum.empty,
  Oe.enum.invalidFileExtensions,
  Oe.enum.exceedMaximumFileSize
]);
var Pe = /* @__PURE__ */ ((n) => (n.VISIBLE = "VISIBLE", n.HIDDEN = "HIDDEN", n))(Pe || {}), z = /* @__PURE__ */ ((n) => (n.DRAFT = "DRAFT", n.PUBLISHED = "PUBLISHED", n))(z || {});
const Ne = u.object({
  id: u.string(),
  name: u.string(),
  slug: u.string(),
  description: u.string().nullish(),
  status: u.enum([
    "HIDDEN",
    "VISIBLE"
    /* VISIBLE */
  ]),
  icon: u.string().nullish(),
  displayOrder: u.number(),
  createdAt: u.string(),
  updatedAt: u.string()
}), ya = u.object({
  data: u.array(Ne),
  paging: u.object({
    previous: u.string().nullish(),
    next: u.string().nullish()
  })
}), ba = u.object({
  name: u.string().min(1, "This field is required").max(30, "The topic title you entered exceeds the maximum allowed character limit of 30"),
  description: u.string().max(256, "The topic description you entered exceeds the maximum allowed character limit of 256").nullish()
}), ke = u.object({
  id: u.string(),
  title: u.string(),
  slug: u.string(),
  rawContent: u.string().nullish(),
  htmlContent: u.string().nullish(),
  status: u.enum([
    "DRAFT",
    "PUBLISHED"
    /* PUBLISHED */
  ]),
  metaDescription: u.string(),
  metaTitle: u.string(),
  createdAt: u.string(),
  updatedAt: u.string(),
  topic: Ne.pick({ id: !0, slug: !0, name: !0, description: !0 })
}), Sa = u.object({
  data: u.array(ke),
  paging: u.object({
    previous: u.string().nullish(),
    next: u.string().nullish()
  })
});
u.object({
  displayName: u.string(),
  emailAddress: u.string(),
  topicName: u.string(),
  text: u.string()
});
u.object({
  id: u.string(),
  supportAdminNotificationEmail: u.string()
});
u.object({
  supportAdminNotificationEmail: u.string()
});
class ue {
  // @ts-ignore
  constructor(t, a, s = !1) {
    this.axiosInstance = t, this.namespace = a, this.cache = s;
  }
  createTopic(t) {
    const a = {}, s = "/content-management/v1/admin/namespaces/{namespace}/topics".replace("{namespace}", this.namespace), o = this.axiosInstance.post(s, t, { params: a });
    return V.responseType(() => o, u.unknown(), "z.unknown()");
  }
  fetchTopic() {
    const t = {}, a = "/content-management/v1/admin/namespaces/{namespace}/topics".replace("{namespace}", this.namespace), s = this.axiosInstance.get(a, { params: t }), o = () => V.responseType(() => s, u.array(Ne), "Topic[]");
    if (!this.cache)
      return k.withoutCache(o);
    const r = a + te.hashCode(JSON.stringify({ params: t }));
    return k.withCache(r, o);
  }
  fetchTopicById(t) {
    const a = {}, s = "/content-management/v1/admin/namespaces/{namespace}/topics/{topicId}".replace("{namespace}", this.namespace).replace("{topicId}", t), o = this.axiosInstance.get(s, { params: a }), r = () => V.responseType(() => o, Ne, "Topic");
    if (!this.cache)
      return k.withoutCache(r);
    const c = s + te.hashCode(JSON.stringify({ params: a }));
    return k.withCache(c, r);
  }
  fetchTopicBySlug(t) {
    const a = {}, s = "/content-management/v1/admin/namespaces/{namespace}/topics/slug/{slug}".replace("{namespace}", this.namespace).replace("{slug}", t), o = this.axiosInstance.get(s, { params: a }), r = () => V.responseType(() => o, Ne, "Topic");
    if (!this.cache)
      return k.withoutCache(r);
    const c = s + te.hashCode(JSON.stringify({ params: a }));
    return k.withCache(c, r);
  }
  deleteTopic(t) {
    const a = {}, s = "/content-management/v1/admin/namespaces/{namespace}/topics/{topicId}".replace("{namespace}", this.namespace).replace("{topicId}", t), o = this.axiosInstance.delete(s, { params: a });
    return V.responseType(() => o, u.unknown(), "z.unknown()");
  }
  updateTopic(t, a) {
    const s = {}, o = "/content-management/v1/admin/namespaces/{namespace}/topics/{topicId}".replace("{namespace}", this.namespace).replace("{topicId}", t), r = this.axiosInstance.put(o, a, { params: s });
    return V.responseType(() => r, u.unknown(), "z.unknown()");
  }
  fetchPublicTopic(t) {
    const a = t, s = "/content-management/v1/public/namespaces/{namespace}/topics".replace("{namespace}", this.namespace), o = this.axiosInstance.get(s, { params: a }), r = () => V.responseType(() => o, ya, "TopicList");
    if (!this.cache)
      return k.withoutCache(r);
    const c = s + te.hashCode(JSON.stringify({ params: a }));
    return k.withCache(c, r);
  }
  fetchPublicTopicById(t) {
    const a = {}, s = "/content-management/v1/public/namespaces/{namespace}/topics/{topicId}".replace("{namespace}", this.namespace).replace("{topicId}", t), o = this.axiosInstance.get(s, { params: a }), r = () => V.responseType(() => o, Ne, "Topic");
    if (!this.cache)
      return k.withoutCache(r);
    const c = s + te.hashCode(JSON.stringify({ params: a }));
    return k.withCache(c, r);
  }
  fetchPublicTopicBySlug(t) {
    const a = {}, s = "/content-management/v1/public/namespaces/{namespace}/topics/{slug}".replace("{namespace}", this.namespace).replace("{slug}", t), o = this.axiosInstance.get(s, { params: a }), r = () => V.responseType(() => o, Ne, "Topic");
    if (!this.cache)
      return k.withoutCache(r);
    const c = s + te.hashCode(JSON.stringify({ params: a }));
    return k.withCache(c, r);
  }
}
function Ue(n, t) {
  const a = n.assembly(), s = t != null && t.namespace ? t == null ? void 0 : t.namespace : a.namespace, o = t != null && t.cache ? t == null ? void 0 : t.cache : a.cache, r = $e.mergedConfigs(a.config, t);
  async function c() {
    const b = await new ue(O.create(r), s, o).fetchTopic();
    if (b.error)
      throw b.error;
    return b.response.data;
  }
  async function i(g) {
    const p = await new ue(O.create(r), s, o).fetchTopicById(g);
    if (p.error)
      throw p.error;
    return p.response.data;
  }
  async function l(g) {
    const p = await new ue(O.create(r), s, o).fetchTopicBySlug(g);
    if (p.error)
      throw p.error;
    return p.response.data;
  }
  async function m(g) {
    const p = await new ue(O.create(r), s, o).deleteTopic(g);
    if (p.error)
      throw p.error;
    return p.response.data;
  }
  async function d(g, b) {
    const M = await new ue(O.create(r), s, o).updateTopic(g, b);
    if (M.error)
      throw M.error;
    return M.response.data;
  }
  async function S(g) {
    const p = await new ue(O.create(r), s, o).createTopic(g);
    if (p.error)
      throw p.error;
    return p.response.data;
  }
  async function x(g) {
    const p = await new ue(O.create(r), s, o).fetchPublicTopic(g);
    if (p.error)
      throw p.error;
    return p.response.data;
  }
  async function h(g) {
    const p = await new ue(O.create(r), s, o).fetchPublicTopicBySlug(g);
    if (p.error)
      throw p.error;
    return p.response.data;
  }
  return {
    getTopics: c,
    getTopicById: i,
    getTopicBySlug: l,
    createTopic: S,
    updateTopic: d,
    deleteTopic: m,
    getPublicTopics: x,
    getPublicTopicBySlug: h
  };
}
class de {
  // @ts-ignore
  constructor(t, a, s = !1) {
    this.axiosInstance = t, this.namespace = a, this.cache = s;
  }
  fetchArticles() {
    const t = {}, a = "/content-management/v1/admin/namespaces/{namespace}/articles".replace("{namespace}", this.namespace), s = this.axiosInstance.get(a, { params: t }), o = () => V.responseType(() => s, u.array(ke), "Article");
    if (!this.cache)
      return k.withoutCache(o);
    const r = a + te.hashCode(JSON.stringify({ params: t }));
    return k.withCache(r, o);
  }
  fetchArticleById(t) {
    const a = {}, s = "/content-management/v1/admin/namespaces/{namespace}/articles/{articleId}".replace("{namespace}", this.namespace).replace("{articleId}", t), o = this.axiosInstance.get(s, { params: a }), r = () => V.responseType(() => o, ke, "Article");
    if (!this.cache)
      return k.withoutCache(r);
    const c = s + te.hashCode(JSON.stringify({ params: a }));
    return k.withCache(c, r);
  }
  fetchArticleBySlug(t) {
    const a = {}, s = "/content-management/v1/admin/namespaces/{namespace}/articles/slug/{slug}".replace("{namespace}", this.namespace).replace("{slug}", t), o = this.axiosInstance.get(s, { params: a }), r = () => V.responseType(() => o, ke, "Article");
    if (!this.cache)
      return k.withoutCache(r);
    const c = s + te.hashCode(JSON.stringify({ params: a }));
    return k.withCache(c, r);
  }
  createArticle(t) {
    const a = {}, s = "/content-management/v1/admin/namespaces/{namespace}/articles".replace("{namespace}", this.namespace), o = this.axiosInstance.post(s, t, { params: a });
    return V.responseType(() => o, u.unknown(), "z.unknown()");
  }
  updateArticle(t) {
    const a = {}, s = "/content-management/v1/admin/namespaces/{namespace}/articles/{articleId}".replace("{namespace}", this.namespace).replace("{articleId}", t.id), o = this.axiosInstance.put(s, t, { params: a });
    return V.responseType(() => o, u.unknown(), "z.unknown()");
  }
  deleteArticle(t) {
    const a = {}, s = "/content-management/v1/admin/namespaces/{namespace}/articles/{articleId}".replace("{namespace}", this.namespace).replace("{articleId}", t), o = this.axiosInstance.delete(s, { params: a });
    return V.responseType(() => o, u.unknown(), "z.unknown()");
  }
  fetchPublicArticles(t) {
    const a = t, s = "/content-management/v1/public/namespaces/{namespace}/articles".replace("{namespace}", this.namespace), o = this.axiosInstance.get(s, { params: a }), r = () => V.responseType(() => o, Sa, "ArticleList");
    if (!this.cache)
      return k.withoutCache(r);
    const c = s + te.hashCode(JSON.stringify({ params: a }));
    return k.withCache(c, r);
  }
  fetchPublicArticleBySlug(t) {
    const a = t, s = "/content-management/v1/public/namespaces/{namespace}/articles/{slug}".replace("{namespace}", this.namespace).replace("{slug}", t.slug), o = this.axiosInstance.get(s, { params: a }), r = () => V.responseType(() => o, ke, "Article");
    if (!this.cache)
      return k.withoutCache(r);
    const c = s + te.hashCode(JSON.stringify({ params: a }));
    return k.withCache(c, r);
  }
}
function xa(n, t) {
  const a = n.assembly(), s = t != null && t.namespace ? t == null ? void 0 : t.namespace : a.namespace, o = t != null && t.cache ? t == null ? void 0 : t.cache : a.cache, r = $e.mergedConfigs(a.config, t);
  async function c() {
    const b = await new de(O.create(r), s, o).fetchArticles();
    if (b.error)
      throw b.error;
    return b.response.data;
  }
  async function i(g) {
    const p = await new de(O.create(r), s, o).fetchArticleById(g);
    if (p.error)
      throw p.error;
    return p.response.data;
  }
  async function l(g) {
    const p = await new de(O.create(r), s, o).fetchArticleBySlug(g);
    if (p.error)
      throw p.error;
    return p.response.data;
  }
  async function m(g) {
    const p = await new de(O.create(r), s, o).createArticle(g);
    if (p.error)
      throw p.error;
    return p.response.data;
  }
  async function d(g) {
    const p = await new de(O.create(r), s, o).updateArticle(g);
    if (p.error)
      throw p.error;
    return p.response.data;
  }
  async function S(g) {
    const p = await new de(O.create(r), s, o).deleteArticle(g);
    if (p.error)
      throw p.error;
    return p.response.data;
  }
  async function x(g) {
    const p = await new de(O.create(r), s, o).fetchPublicArticles(g);
    if (p.error)
      throw p.error;
    return p.response.data;
  }
  async function h(g) {
    const p = await new de(O.create(r), s, o).fetchPublicArticleBySlug(g);
    if (p.error)
      throw p.error;
    return p.response.data;
  }
  return {
    getArticles: c,
    deleteArticle: S,
    getArticleById: i,
    getArticleBySlug: l,
    createArticle: m,
    updateArticle: d,
    getPublicArticles: x,
    getPublicArticleBySlug: h
  };
}
class Aa {
  // @ts-ignore
  constructor(t, a, s = !1) {
    this.axiosInstance = t, this.namespace = a, this.cache = s;
  }
  /**
   * Required permission 'ADMIN:ROLE [READ]'<br> <p>action code: 10419</p>
   */
  getRole_ByRoleId(t) {
    const a = {}, s = "/iam/v3/admin/roles/{roleId}".replace("{roleId}", t), o = this.axiosInstance.get(s, { params: a }), r = () => V.responseType(() => o, aa, "RoleResponseV3");
    if (!this.cache)
      return k.withoutCache(r);
    const c = s + te.hashCode(JSON.stringify({ params: a }));
    return k.withCache(c, r);
  }
}
function Je(n, t) {
  const a = n.assembly(), s = t != null && t.namespace ? t == null ? void 0 : t.namespace : a.namespace, o = t != null && t.cache ? t == null ? void 0 : t.cache : a.cache, r = $e.mergedConfigs(a.config, t);
  async function c(i) {
    var d;
    let l = i;
    l || (l = await na.UsersApi(n, t).getUsersMe());
    const m = new Aa(O.create(r), s, o);
    if (l.namespaceRoles) {
      const S = await Promise.all(l.namespaceRoles.map((x) => m.getRole_ByRoleId(x.roleId)));
      for (const x of S)
        l.permissions = [...l.permissions, ...(d = x.response) == null ? void 0 : d.data.permissions];
    }
    return l;
  }
  return { getCurrentUserRole: c };
}
class Ca {
  // @ts-ignore
  constructor(t, a, s = !1) {
    this.axiosInstance = t, this.namespace = a, this.cache = s;
  }
  sendSupportEmail(t) {
    const a = {}, s = "/content-management/v1/public/namespaces/{namespace}/support/send".replace("{namespace}", this.namespace), o = this.axiosInstance.post(s, t, { params: a });
    return V.responseType(() => o, u.unknown(), "z.unknown()");
  }
}
function va(n, t) {
  const a = n.assembly(), s = t != null && t.namespace ? t == null ? void 0 : t.namespace : a.namespace, o = t != null && t.cache ? t == null ? void 0 : t.cache : a.cache, r = $e.mergedConfigs(a.config, t);
  async function c(i) {
    const m = await new Ca(O.create(r), s, o).sendSupportEmail(i);
    if (m.error)
      throw m.error;
    return m.response.data;
  }
  return {
    sendSupportEmail: c
  };
}
const wa = {
  TopicsApi: Ue,
  ArticlesApi: xa,
  UserApi: Je,
  SupportEmailApi: va
}, q = wa, Ia = { useTopics: La }, Da = {
  topics: [],
  topicsFetchStatus: N.IDLE,
  topicsError: null,
  topicDetail: null,
  topicDetailFetchStatus: N.IDLE,
  topicDetailError: null
};
function La() {
  const [n, t] = v(Da), [a] = me(), s = ae(
    async (r) => {
      let c = [], i = null;
      try {
        return t((m) => ({
          ...m,
          topicsError: null,
          topicsFetchStatus: N.FETCHING
        })), c = (await q.TopicsApi(a).getPublicTopics({ status: r })).data, { data: c };
      } catch (l) {
        return i = Q.getErrorType(l), { error: i };
      } finally {
        t((l) => ({
          ...l,
          topics: c,
          topicsError: i,
          topicsFetchStatus: N.IDLE
        }));
      }
    },
    [a]
  ), o = ae(
    async (r) => {
      let c = null, i = null;
      try {
        return t((m) => ({
          ...m,
          topicDetailError: null,
          topicDetailFetchStatus: N.FETCHING
        })), c = await q.TopicsApi(a).getPublicTopicBySlug(r), { data: c };
      } catch (l) {
        return i = Q.getErrorType(l), { error: i };
      } finally {
        t((l) => ({
          ...l,
          topicDetail: c,
          topicDetailError: i,
          topicDetailFetchStatus: N.IDLE
        }));
      }
    },
    [a]
  );
  return {
    state: n,
    mutations: {
      fetchTopicsList: s,
      fetchTopicBySlug: o
    }
  };
}
const Ht = { useSupportSubmission: Fa }, Pa = {
  supportEmailFetchStatus: N.IDLE,
  supportEmailError: null,
  showSupportCTA: !1,
  supportCTAEnabled: !1
}, ka = Ze("support-submission", Pa);
function Fa() {
  const [n, t] = Qe(ka), [a] = me(), {
    state: { supportData: s }
  } = _e();
  W(() => {
    s && (Re.isDesktopApp() ? t((c) => ({ ...c, supportCTAEnabled: s == null ? void 0 : s.displayCTAButton.data.isLauncherEnabled })) : t((c) => ({ ...c, supportCTAEnabled: s == null ? void 0 : s.displayCTAButton.data.isPlayerPortalEnabled })));
  }, [s]);
  const o = ae(
    async (c) => {
      let i = null;
      try {
        return t((l) => ({
          ...l,
          supportEmailError: null,
          supportEmailFetchStatus: N.SENDING
        })), await q.SupportEmailApi(a).sendSupportEmail(c), { data: !0 };
      } catch (l) {
        return i = Q.getErrorType(l), { error: i };
      } finally {
        t((l) => ({
          ...l,
          supportEmailError: i,
          supportEmailFetchStatus: N.IDLE
        }));
      }
    },
    [a]
  );
  return {
    state: n,
    mutations: {
      sendSupportEmail: o,
      setShowSupportCTA: (c) => t((i) => ({ ...i, showSupportCTA: c }))
    }
  };
}
const bt = {
  email: "",
  selectedTopicName: "",
  displayName: "",
  detailReport: "",
  files: [],
  isSubmitted: !1,
  isAllValidationValid: !1
}, ze = 1200, Ma = 1048576, Ra = 20 * Ma, _a = !0, Bt = ({ CTAIcon: n }) => {
  const t = le(new la()), [a, s] = wt(bt), { isSubmitted: o, email: r, displayName: c, selectedTopicName: i, detailReport: l, files: m } = a, {
    state: { topicsFetchStatus: d, topics: S },
    mutations: { fetchTopicsList: x }
  } = Ia.useTopics(), {
    state: { user: h }
  } = Ft(), {
    state: { supportData: g }
  } = _e(), [b] = me(), {
    state: { supportEmailFetchStatus: p, supportEmailError: M, showSupportCTA: D, supportCTAEnabled: B },
    mutations: { sendSupportEmail: J, setShowSupportCTA: E }
  } = Ht.useSupportSubmission();
  W(() => {
    b && x();
  }, [b]), W(() => () => {
    E(!1);
  }, []), W(() => {
    h && s({ email: h.emailAddress, displayName: h.displayName });
  }, [h]);
  const F = S.map((T) => ({
    value: T.name || "",
    label: T.name || ""
  })), f = (T) => {
    const w = T.target.value;
    t.current.set("displayName", gt(w, { isRequired: !0 })), s({ displayName: w });
  }, R = (T) => {
    const w = T.target.value;
    t.current.set("email", ft(w, { isRequired: !0 })), s({ email: w });
  }, A = (T) => {
    t.current.set("topic", Tt((T == null ? void 0 : T.value) || "")), s({ selectedTopicName: T == null ? void 0 : T.value });
  }, C = (T) => {
    const w = T.target.value;
    t.current.set("detailReport", Nt(w, { max: ze, isRequired: !0 })), s({ detailReport: w });
  }, $ = (T) => {
    if (T) {
      let w = 0;
      for (let X = 0; X < T.length; X++) {
        const ce = T[X];
        w += ce.size;
      }
      w > Ra ? t.current.set("files", Ut.enum.exceedMaximumFileSize) : t.current.set("files", null);
    }
  }, Y = () => {
    t.current.set("displayName", gt(c, { isRequired: !0 })), t.current.set("email", ft(r, { isRequired: !0 })), t.current.set("topic", Tt(i)), t.current.set("detailReport", Nt(l, { max: ze, isRequired: !0 })), m.length > 0 && $(m);
    const T = t.current.isAllValid();
    return s({ isAllValidationValid: T }), T;
  }, oe = async () => {
    !(await J({
      displayName: c,
      emailAddress: r,
      topicName: i,
      text: l
    })).error && s({ isSubmitted: !0 });
  }, _ = (T) => {
    T.preventDefault(), Y() && oe();
  }, P = () => {
    s({
      ...bt,
      email: h ? h.emailAddress : "",
      displayName: h ? h.displayName : ""
    }), E(!1);
  };
  if (!B)
    return null;
  const L = () => {
    const T = g == null ? void 0 : g.submissionForm.data;
    T != null && T.isUseExternalSupportEnabled && T.externalSupportURL ? window.open(T.externalSupportURL, "_blank") : E(!0);
  };
  return /* @__PURE__ */ e.createElement("div", { className: "support-cta fixed bottom-4 right-4 z-50" }, /* @__PURE__ */ e.createElement(
    "button",
    {
      onClick: () => L(),
      className: Ae(
        "support-cta-button btn btn-primary group flex cursor-pointer items-center rounded-full border-0 p-3 text-3xl outline-none transition-all hover:px-6",
        { hidden: D }
      )
    },
    n || /* @__PURE__ */ e.createElement(jt, { width: "1em", height: "1em", className: "block" }),
    /* @__PURE__ */ e.createElement("div", { className: "text-md ml-0 w-0 overflow-hidden whitespace-nowrap transition-all group-hover:ml-3 group-hover:w-[140px]" }, /* @__PURE__ */ e.createElement(y, { i18nKey: "SupportCTA.button" }, "Contact Support"))
  ), /* @__PURE__ */ e.createElement(
    "div",
    {
      className: Ae(
        "submission-form absolute right-0 bottom-0 w-[362px] origin-bottom overflow-hidden rounded-lg transition-all",
        { "pointer-events-none scale-y-0 opacity-0": !D }
      )
    },
    /* @__PURE__ */ e.createElement("div", { className: "header bg-od-rgba-card text-od-rgba-text font-title relative py-3 px-4 text-center" }, /* @__PURE__ */ e.createElement(y, { i18nKey: "SupportCTA.form.header.title" }, "Leave us a message"), /* @__PURE__ */ e.createElement(
      "button",
      {
        className: "minimize text-od-rgba-text absolute right-4 top-[50%] translate-y-[-50%] cursor-pointer border-0 bg-transparent p-0 text-lg outline-none",
        onClick: o ? P : () => E(!1)
      },
      /* @__PURE__ */ e.createElement(qt, { color: "currentColor", width: "1em", height: "1em", className: "block" })
    )),
    /* @__PURE__ */ e.createElement("div", { className: "body bg-neutral-0 text-neutral-80 font-body styled-scrollbar overflow-y-auto p-4" }, !o && !M && /* @__PURE__ */ e.createElement("form", { onSubmit: _, autoComplete: "off" }, /* @__PURE__ */ e.createElement("div", { className: "input-group" }, /* @__PURE__ */ e.createElement("label", { className: "input-label", htmlFor: "displayName" }, /* @__PURE__ */ e.createElement(y, { i18nKey: "SupportCTA.form.input.name.label" }, "Your name"), "*"), /* @__PURE__ */ e.createElement(ie, { className: "formGroup" }, /* @__PURE__ */ e.createElement(
      xe,
      {
        type: "text",
        value: c,
        id: "displayName",
        name: "displayName",
        className: "inputGroup",
        onChange: f,
        placeholder: K("SupportCTA.form.input.name.placeholder")
      }
    ), ra(t.current.get("displayName"), {
      max: ma,
      min: pa
    }))), /* @__PURE__ */ e.createElement("div", { className: "input-group" }, /* @__PURE__ */ e.createElement("label", { className: "input-label", htmlFor: "email" }, /* @__PURE__ */ e.createElement(y, { i18nKey: "SupportCTA.form.input.email" }, "Your email"), "*"), /* @__PURE__ */ e.createElement(ie, null, /* @__PURE__ */ e.createElement(xe, { value: r, placeholder: "someone@example.com", onChange: R, disabled: !!h }), oa(t.current.get("email")))), /* @__PURE__ */ e.createElement("div", { className: "input-group" }, /* @__PURE__ */ e.createElement("label", { className: "input-label", htmlFor: "topic" }, /* @__PURE__ */ e.createElement(y, { i18nKey: "SupportCTA.form.select.topic.label" }, "To start, tell us what you need help with"), "*"), /* @__PURE__ */ e.createElement(ie, null, /* @__PURE__ */ e.createElement(
      je,
      {
        isFullWidth: !0,
        id: "topic",
        className: "flex w-full items-center",
        isLoading: d === N.FETCHING,
        isDisabled: d === N.FETCHING,
        value: F.find((T) => T.value === i),
        onChange: A,
        options: F,
        placeholder: K("SupportCTA.form.select.topic.placeholder"),
        menuShouldScrollIntoView: !1
      }
    ), /* @__PURE__ */ e.createElement(St, { errorType: t.current.get("topic") }))), /* @__PURE__ */ e.createElement("div", { className: "input-group" }, /* @__PURE__ */ e.createElement("label", { className: "input-label", htmlFor: "detailReport" }, /* @__PURE__ */ e.createElement(y, { i18nKey: "SupportCTA.form.input.detailReport.label" }, "Tell us more about the problem"), "*"), /* @__PURE__ */ e.createElement(ie, null, /* @__PURE__ */ e.createElement(
      "textarea",
      {
        id: "detailReport",
        value: l,
        onChange: C,
        placeholder: K("SupportCTA.form.input.detailReport.placeholder"),
        maxLength: ze
      }
    ), /* @__PURE__ */ e.createElement(St, { errorType: t.current.get("detailReport") }))), !_a, /* @__PURE__ */ e.createElement(
      j,
      {
        buttonFontSize: We.MEDIUM,
        buttonStyle: ge.PRIMARY,
        buttonType: ne.FLAT,
        className: "w-full uppercase",
        isLoading: p === N.SENDING,
        loadingIndicator: "SPINNER",
        type: "submit"
      },
      /* @__PURE__ */ e.createElement(y, { i18nKey: "common.button.send" }, "SEND")
    )), !o && M && /* @__PURE__ */ e.createElement(Ua, { handleRetry: oe }), o && /* @__PURE__ */ e.createElement(Ga, null))
  ));
}, Ga = () => /* @__PURE__ */ e.createElement("div", { className: "successMessage py-20 text-center" }, /* @__PURE__ */ e.createElement("h2", { className: "title font-title text-md text-neutral-140 mb-1 font-medium" }, /* @__PURE__ */ e.createElement(y, { i18nKey: "SupportCTA.form.success.title" }, "Thank you for reaching out")), /* @__PURE__ */ e.createElement("p", { className: "info text-neutral-120 mt-0 mb-3 text-sm" }, /* @__PURE__ */ e.createElement(y, { i18nKey: "SupportCTA.form.success.info" }, "Someone will get back to you soon"))), Ua = ({ handleRetry: n }) => /* @__PURE__ */ e.createElement("div", { className: "py-20 text-center" }, /* @__PURE__ */ e.createElement("h2", { className: "title font-title text-md text-neutral-140 mb-1 font-medium" }, /* @__PURE__ */ e.createElement(y, { i18nKey: "SupportCTA.form.error.title" }, "There seems to be a problem when submitting your request")), /* @__PURE__ */ e.createElement("button", { className: "text-md text-od-rgba-primary m-0 cursor-pointer border-0 bg-transparent p-0 font-bold", onClick: n }, /* @__PURE__ */ e.createElement(y, { i18nKey: "SupportCTA.form.error.button" }, "Retry"))), St = ({ errorType: n }) => {
  if (!n)
    return null;
  const t = {
    [ht.enum.empty]: /* @__PURE__ */ e.createElement(y, { i18nKey: "common.field.error.empty" }, "This field is required"),
    [ht.enum.exceedLengthLimit]: /* @__PURE__ */ e.createElement(y, { i18nKey: "common.field.error.ExceedLimit" }, "The number of characters exceeds the maximum allowed"),
    [Ut.enum.exceedMaximumFileSize]: /* @__PURE__ */ e.createElement(y, { i18nKey: "common.field.error.exceedMaximumFileSize" }, "The file(s) is too large. Allowed maximum size is ", { maxFileSize: "20 MB" }, ".")
  };
  return /* @__PURE__ */ e.createElement(ye, null, t[n]);
}, Ha = ({ manageArticleURL: n, isAdminCanEdit: t, initialTopics: a, onLoadMore: s, isLoadingMore: o }) => {
  const { state: r } = ee(), {
    state: { supportData: c }
  } = _e(), [i] = me(), {
    state: { supportCTAEnabled: l },
    mutations: { setShowSupportCTA: m }
  } = Ht.useSupportSubmission(), d = c == null ? void 0 : c.knowledgeBaseSettings.data.isKnowledgeBaseEnabled, S = () => {
    if (!i)
      return;
    const h = c == null ? void 0 : c.submissionForm.data;
    h != null && h.isUseExternalSupportEnabled && h.externalSupportURL ? window.open(h.externalSupportURL, "_blank") : m(!0);
  }, x = !!a.data.length;
  return /* @__PURE__ */ e.createElement("div", { className: "supportPage" }, t ? /* @__PURE__ */ e.createElement("div", { className: "bg-dark-80 flex items-center justify-center gap-4 py-6" }, /* @__PURE__ */ e.createElement("p", null, /* @__PURE__ */ e.createElement(y, { i18nKey: "SupportMainPage.manageContent.information" }, "Manage Knowledge Base contents here")), /* @__PURE__ */ e.createElement(j, { className: "bg-green-80 border-none", buttonStyle: ge.NONE }, n && /* @__PURE__ */ e.createElement("a", { href: n, target: "_blank", className: "text-white", rel: "noreferrer" }, /* @__PURE__ */ e.createElement(y, { i18nKey: "SupportMainPage.manageContent.button" }, "MANAGE CONTENT")), !n && /* @__PURE__ */ e.createElement(I, { to: r.support.manage.article.index.link, className: "text-white" }, /* @__PURE__ */ e.createElement(y, { i18nKey: "SupportMainPage.manageContent.button" }, "MANAGE CONTENT")))) : /* @__PURE__ */ e.createElement("div", { className: "mb-28" }), /* @__PURE__ */ e.createElement("div", { className: "container" }, /* @__PURE__ */ e.createElement("h1", { className: "supportPageTitle" }, /* @__PURE__ */ e.createElement(y, { i18nKey: "SupportMainPage.title" }, "Support Center")), /* @__PURE__ */ e.createElement("p", { className: "supportSubTitle" }, /* @__PURE__ */ e.createElement(y, { i18nKey: "SupportMainPage.heading.subtitle" }, "How can we help?")), d && /* @__PURE__ */ e.createElement("section", { className: "topicsList mx-auto mt-[72px] mb-12 max-w-[1000px]" }, !x && /* @__PURE__ */ e.createElement("div", { className: "topicsNotFound text-od-rgba-text py-24 text-center text-3xl" }, /* @__PURE__ */ e.createElement(y, { i18nKey: "SupportMainPage.topics.notFound" }, "No topic available")), x && /* @__PURE__ */ e.createElement("div", { className: "-mx-2 flex flex-wrap justify-center" }, a.data.map((h) => /* @__PURE__ */ e.createElement("div", { className: "supportTopicItem w-3/12 p-2", key: h.slug }, /* @__PURE__ */ e.createElement(
    I,
    {
      to: r.support.topic.index.makePath({ params: { slug: h.slug } }),
      title: h.name,
      className: "card bg-od-rgba-card block h-full rounded-2xl p-4 transition-all hover:-translate-y-1"
    },
    /* @__PURE__ */ e.createElement("div", { className: "title font-title text-od-rgba-text text-md tracking-md mb-4 flex items-center font-medium" }, h.icon && /* @__PURE__ */ e.createElement("img", { src: h.icon, className: "mr-2 block h-5" }), /* @__PURE__ */ e.createElement("div", { className: "line-clamp-2" }, h.name)),
    /* @__PURE__ */ e.createElement("div", { className: "desc text-tiny tracking-md text-od-rgba-text-default leading-[1.45]" }, /* @__PURE__ */ e.createElement("p", { className: "line-clamp-5 m-0" }, h.description))
  ))))), a.paging.next && /* @__PURE__ */ e.createElement("div", { className: "mb-8" }, /* @__PURE__ */ e.createElement(tt, { isLoadingMore: o, onClick: s })), !d && l && /* @__PURE__ */ e.createElement("div", { className: "mt-4 flex justify-center" }, /* @__PURE__ */ e.createElement(j, { onClick: S, className: "button", buttonStyle: ge.PRIMARY, buttonType: ne.FLAT }, /* @__PURE__ */ e.createElement(y, { i18nKey: "SupportMainPage.btn.contactOurSupport" }, "Contact Us")))), l && /* @__PURE__ */ e.createElement(Bt, null));
};
function cs(n) {
  return /* @__PURE__ */ e.createElement(Ha, { ...n });
}
function Ba() {
  return /* @__PURE__ */ e.createElement(Ba, null);
}
const Kt = ({ topicId: n, initialTopics: t, onLoadmoreTopic: a, isLoadingMoreTopic: s }) => {
  const o = le({ initialTopics: t }).current, r = le(null), { state: c } = ee(), i = () => {
    r.current && r.current.scrollIntoView({ behavior: "smooth", block: "end", inline: "nearest" });
  };
  W(() => (o.initialTopics !== t && i(), () => {
    o.initialTopics = t;
  }), [t]);
  const l = (m) => Ae('text-[color:rgba(var(--od-rgb-text),0.8)] hover:text-od-rgb-text"', {
    "hover:text-od-rgb-text": m !== n,
    "text-od-rgba-secondary": m === n
  });
  return /* @__PURE__ */ e.createElement("aside", { className: "sidebar bg-od-rgb-card sticky top-24 w-[200px] rounded py-4" }, /* @__PURE__ */ e.createElement("div", { className: "sidebar-label text-2tiny text-od-rgba-text-default mb-4 px-4 font-semibold uppercase" }, /* @__PURE__ */ e.createElement(y, { i18nKey: "Navigation.links.support.content.topics" }, "Topics")), /* @__PURE__ */ e.createElement("div", { className: "styled-scrollbar max-h-[286px] overflow-y-auto px-4" }, /* @__PURE__ */ e.createElement("ul", { className: "topics-list text-2sm m-0 list-disc pl-5", ref: r }, t.data.map((m) => /* @__PURE__ */ e.createElement("li", { key: m.slug, className: `mb-4 last:mb-0 ${l(m.id)}` }, /* @__PURE__ */ e.createElement(
    I,
    {
      to: c.support.topic.index.makePath({ params: { slug: m.slug } }),
      title: m.name,
      className: `topic-link line-clamp-1 ${l(m.id)}`
    },
    m.name
  ))))), t.paging.next && /* @__PURE__ */ e.createElement(tt, { onClick: a, isLoadingMore: s }));
}, Ka = ({
  initialData: n,
  onLoadmoreArticle: t,
  isLoadingMoreArticle: a,
  isLoadingMoreTopic: s,
  onLoadmoreTopic: o
}) => {
  const { topic: r, topics: c, articles: i } = n, { state: l } = ee(), {
    state: { supportData: m }
  } = _e(), { state: d } = ve(), S = m == null ? void 0 : m.knowledgeBaseSettings.data.isKnowledgeBaseEnabled;
  W(() => {
    !S && !Re.isDesktopApp() && d.replace(l.support.index.link);
  }, [S]);
  const x = !!i.data.length;
  return !S && !Re.isDesktopApp() ? null : /* @__PURE__ */ e.createElement("div", { className: "articlesPage" }, /* @__PURE__ */ e.createElement("div", { className: "container flex h-full flex-col" }, /* @__PURE__ */ e.createElement(he, { className: "flex items-center py-8" }, /* @__PURE__ */ e.createElement(I, { to: l.support.index.link }, /* @__PURE__ */ e.createElement(y, { i18nKey: "Navigation.links.support.title" }, "Support")), /* @__PURE__ */ e.createElement("span", null, r == null ? void 0 : r.name)), /* @__PURE__ */ e.createElement("main", { className: "wrapper flex flex-grow gap-10" }, /* @__PURE__ */ e.createElement("div", { className: "w-auto flex-[0_0_auto]" }, /* @__PURE__ */ e.createElement(
    Kt,
    {
      topicId: r == null ? void 0 : r.id,
      initialTopics: c,
      isLoadingMoreTopic: s,
      onLoadmoreTopic: o
    }
  )), /* @__PURE__ */ e.createElement("div", { className: "flex-grow" }, /* @__PURE__ */ e.createElement("div", { className: "content max-w-[640px]" }, /* @__PURE__ */ e.createElement("h1", { className: "content-title text-od-rgb-text font-title mb-1 mt-0 text-3xl font-medium leading-[1.5]" }, r == null ? void 0 : r.name), /* @__PURE__ */ e.createElement("div", { className: "content-info text-2sm text-od-rgb-text/90 leading-[1.5]" }, /* @__PURE__ */ e.createElement("p", { className: "my-0" }, r == null ? void 0 : r.description)), /* @__PURE__ */ e.createElement("hr", { className: "border-od-rgb-text/20 my-6 border-[0_0_1px_0]" }), /* @__PURE__ */ e.createElement(e.Fragment, null, !x && /* @__PURE__ */ e.createElement("div", { className: "mb-8 text-center text-xl font-medium" }, /* @__PURE__ */ e.createElement(y, { i18nKey: "SupportArticlePage.articlesList.notFound" }, "No article available")), x && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("h2", { className: "support-title text-2sm text-od-rgba-text-default mb-4 font-normal uppercase" }, /* @__PURE__ */ e.createElement(y, { i18nKey: "SupportArticlePage.articlesList.title" }, "Support Articles")), i.data.map((h) => /* @__PURE__ */ e.createElement("article", { className: "article-item mb-4", key: h.slug }, /* @__PURE__ */ e.createElement(
    I,
    {
      to: l.support.article.index.makePath({ params: { slug: h.slug } }),
      title: h.title,
      className: "title font-title text-2sm line-clamp-2 text-od-rgba-secondary mb-1  font-medium"
    },
    h.title
  ), /* @__PURE__ */ e.createElement("div", { className: "desc text-od-rgb-text/90 text-2sm line-clamp-3 leading-[1.5]" }, /* @__PURE__ */ e.createElement("p", { className: "my-0" }, h.metaDescription)))))), i.paging.next && /* @__PURE__ */ e.createElement("div", { className: "mb-8" }, /* @__PURE__ */ e.createElement(tt, { onClick: t, isLoadingMore: a })))))));
};
function is(n) {
  return /* @__PURE__ */ e.createElement(Ka, { ...n });
}
const $a = ({ initialArticle: n, initialTopics: t, isLoadingMoreTopic: a, onLoadmoreTopic: s }) => {
  const { state: o } = ee(), {
    state: { supportData: r }
  } = _e(), { state: c } = ve(), i = r == null ? void 0 : r.knowledgeBaseSettings.data.isKnowledgeBaseEnabled;
  return W(() => {
    !i && !Re.isDesktopApp() && c.replace(o.support.index.link);
  }, [i]), !i && !Re.isDesktopApp() ? null : /* @__PURE__ */ e.createElement("div", { className: "articleDetailPage" }, /* @__PURE__ */ e.createElement("div", { className: "container flex h-full flex-col" }, /* @__PURE__ */ e.createElement(he, { className: "flex items-center py-8" }, /* @__PURE__ */ e.createElement(I, { to: o.support.index.link }, /* @__PURE__ */ e.createElement(y, { i18nKey: "Navigation.links.support.title" }, "Support")), (n == null ? void 0 : n.topic.slug) && /* @__PURE__ */ e.createElement(I, { to: o.support.topic.index.makePath({ params: { slug: n == null ? void 0 : n.topic.slug } }) }, /* @__PURE__ */ e.createElement("span", null, n == null ? void 0 : n.topic.name)), n == null ? void 0 : n.title), /* @__PURE__ */ e.createElement("main", { className: "wrapper flex flex-grow gap-10" }, /* @__PURE__ */ e.createElement("div", { className: "w-auto flex-[0_0_auto]" }, /* @__PURE__ */ e.createElement(
    Kt,
    {
      topicId: n == null ? void 0 : n.topic.id,
      initialTopics: t,
      isLoadingMoreTopic: a,
      onLoadmoreTopic: s
    }
  )), /* @__PURE__ */ e.createElement("div", { className: "flex-grow" }, /* @__PURE__ */ e.createElement("div", { className: "content border-od-rgb-text/20 mb-8 max-w-[640px] border-[0_0_1px_0] border-solid pb-[1px]" }, /* @__PURE__ */ e.createElement(e.Fragment, null, !n && /* @__PURE__ */ e.createElement("div", { className: "my-6 text-center text-xl font-medium" }, /* @__PURE__ */ e.createElement(y, { i18nKey: "SupportArticlePage.articlesList.notFound" }, "No article available")), n && /* @__PURE__ */ e.createElement("article", { className: "mb-4" }, /* @__PURE__ */ e.createElement("h1", { className: "mb-6 mt-0 text-[36px] font-medium leading-[1.25]" }, n.title), n.htmlContent && /* @__PURE__ */ e.createElement(
    "div",
    {
      className: "article-content prose",
      dangerouslySetInnerHTML: ua(n.htmlContent, { ADD_ATTR: ["target"] })
    }
  ))))))));
};
function ls(n) {
  return /* @__PURE__ */ e.createElement($a, { ...n });
}
function Va() {
  return /* @__PURE__ */ e.createElement(Va, null);
}
function ms(n) {
  return /* @__PURE__ */ e.createElement(Bt, { ...n });
}
const $t = () => {
  const { state: n } = ee(), { state: t } = ve(), a = t.location.pathname;
  return /* @__PURE__ */ e.createElement(Ea, { variant: "OUTLINE", className: "manageSupportTabs" }, /* @__PURE__ */ e.createElement(
    "div",
    {
      className: Ae(
        a === n.support.manage.article.index.link ? "active" : "inactive",
        "flex flex-1 items-center justify-center"
      )
    },
    /* @__PURE__ */ e.createElement(I, { to: n.support.manage.article.index.link, className: "!text-white" }, /* @__PURE__ */ e.createElement(y, { i18nKey: "Navigation.links.support.content.articles" }, "ARTICLES"))
  ), /* @__PURE__ */ e.createElement(
    "div",
    {
      className: Ae(
        a === n.support.manage.topic.index.link ? "active" : "inactive",
        "flex flex-1 items-center justify-center"
      )
    },
    /* @__PURE__ */ e.createElement(I, { to: n.support.manage.topic.index.link, className: "!text-white" }, /* @__PURE__ */ e.createElement(y, { i18nKey: "Navigation.links.support.content.topics" }, "TOPICS"))
  ));
}, Vt = ({ data: n, columns: t, defaultColumnSize: a }) => {
  const [s, o] = v([]), r = ga({
    data: n,
    columns: t,
    state: {
      sorting: s
    },
    onSortingChange: o,
    getCoreRowModel: ha(),
    getSortedRowModel: fa(),
    sortDescFirst: !0,
    defaultColumn: {
      size: a
    }
  });
  return /* @__PURE__ */ e.createElement("table", { className: "w-full border-collapse" }, /* @__PURE__ */ e.createElement("thead", { className: "bg-dark-100 border-dark-100 border border-solid" }, r.getHeaderGroups().map((c) => /* @__PURE__ */ e.createElement("tr", { key: c.id }, c.headers.map((i) => /* @__PURE__ */ e.createElement("th", { className: "p-4 text-left", style: { width: i.getSize() }, key: i.id }, /* @__PURE__ */ e.createElement(
    "div",
    {
      className: Ae("flex items-center justify-between", i.column.getCanSort() && "cursor-pointer select-none"),
      onClick: i.column.getToggleSortingHandler()
    },
    yt(i.column.columnDef.header, i.getContext()),
    i.column.getCanSort() && ({
      false: /* @__PURE__ */ e.createElement(dt, { size: 18, opacity: 0.65 }),
      asc: /* @__PURE__ */ e.createElement(Jt, { size: 18 }),
      desc: /* @__PURE__ */ e.createElement(dt, { size: 18 })
    }[i.column.getIsSorted()] ?? null)
  )))))), /* @__PURE__ */ e.createElement("tbody", null, r.getRowModel().rows.map((c) => /* @__PURE__ */ e.createElement("tr", { key: c.id }, c.getVisibleCells().map((i) => /* @__PURE__ */ e.createElement("td", { className: "border-dark-100 border border-solid p-4", key: i.id }, yt(i.column.columnDef.cell, i.getContext())))))));
}, Ce = { useTopicsList: Oa, useTopicDetail: za };
function Oa() {
  const [n, t] = v({
    topicsList: [],
    topicsListFetchStatus: N.IDLE,
    topicsListError: null
  }), [a] = me(), s = ae(async () => {
    let o = [], r = null;
    try {
      return t((i) => ({
        ...i,
        topicsListError: null,
        topicsListFetchStatus: N.FETCHING
      })), o = await q.TopicsApi(a).getTopics(), { data: o };
    } catch (c) {
      return r = Q.getErrorType(c), { error: r };
    } finally {
      t((c) => ({
        ...c,
        topicsList: o,
        topicsListError: r,
        topicsListFetchStatus: N.IDLE
      }));
    }
  }, [a]);
  return {
    state: n,
    mutations: {
      fetchTopicsList: s
    }
  };
}
function za() {
  const [n, t] = v({
    topicDetail: null,
    topicDetailFetchStatus: N.IDLE,
    topicDetailError: null,
    deleteTopicFetchStatus: N.IDLE,
    deleteTopicError: null,
    updateTopicFetchStatus: N.IDLE,
    updateTopicError: null,
    createTopicFetchStatus: N.IDLE,
    createTopicError: null
  }), [a] = me(), s = ae(
    async (i) => {
      let l = null, m = null;
      try {
        return t((S) => ({
          ...S,
          topicDetailError: null,
          topicDetailFetchStatus: N.FETCHING
        })), l = await q.TopicsApi(a).getTopicBySlug(i), { data: l };
      } catch (d) {
        return m = Q.getErrorType(d), { error: m };
      } finally {
        t((d) => ({
          ...d,
          topicDetail: l,
          topicDetailError: m,
          topicDetailFetchStatus: N.IDLE
        }));
      }
    },
    [a]
  ), o = ae(
    async (i) => {
      let l = null;
      try {
        return t((m) => ({
          ...m,
          deleteTopicError: null,
          deleteTopicFetchStatus: N.DELETING
        })), await Ue(a).deleteTopic(i), { data: !0 };
      } catch (m) {
        return l = Q.getErrorType(m), { error: l };
      } finally {
        t((m) => ({
          ...m,
          deleteTopicError: l,
          deleteTopicFetchStatus: N.IDLE
        }));
      }
    },
    [a]
  ), r = ae(
    async (i) => {
      let l = null;
      const { name: m, slug: d, id: S, description: x, status: h, displayOrder: g } = i;
      try {
        return t((b) => ({
          ...b,
          updateTopicError: null,
          updateTopicFetchStatus: N.UPDATING
        })), await Ue(a).updateTopic(String(S), {
          slug: d,
          name: m,
          description: x,
          status: h,
          displayOrder: g
        }), { data: !0 };
      } catch (b) {
        return l = Q.getErrorType(b), { error: l };
      } finally {
        t((b) => ({
          ...b,
          updateTopicError: l,
          updateTopicFetchStatus: N.IDLE
        }));
      }
    },
    [a]
  ), c = ae(
    async (i) => {
      let l = null;
      const { name: m, description: d } = i;
      try {
        return t((S) => ({
          ...S,
          createTopicError: null,
          createTopicFetchStatus: N.CREATING
        })), await Ue(a).createTopic({
          name: m,
          description: d
        }), { data: !0 };
      } catch (S) {
        return l = Q.getErrorType(S), { error: l };
      } finally {
        t((S) => ({
          ...S,
          createTopicError: l,
          createTopicFetchStatus: N.IDLE
        }));
      }
    },
    [a]
  );
  return {
    state: n,
    mutations: {
      fetchTopicBySlug: s,
      deleteTopic: o,
      updateTopic: r,
      createTopic: c
    }
  };
}
const Wa = {
  articles: [],
  articleError: null,
  articleFetchStatus: N.IDLE
}, Xa = Ze("article", Wa);
function ja() {
  const [n] = me(), [t, a] = Qe(Xa), s = ae(async () => {
    let i = null, l = [];
    try {
      return a((m) => ({ ...m, articleFetchStatus: N.FETCHING })), l = await q.ArticlesApi(n).getArticles(), { data: l };
    } catch (m) {
      return i = Q.getErrorType(m), { error: i };
    } finally {
      a((m) => ({ ...m, articles: l, articleError: i, articleFetchStatus: N.IDLE })), a((m) => ({ ...m, articles: l, articleError: i, articleFetchStatus: N.IDLE }));
    }
  }, [n]), o = async (i) => {
    let l = null;
    try {
      return a((m) => ({ ...m, articleFetchStatus: N.CREATING })), await q.ArticlesApi(n).createArticle(i), { data: null };
    } catch (m) {
      return l = Q.getErrorType(m), { error: l };
    } finally {
      a((m) => ({ ...m, articleError: l, articleFetchStatus: N.IDLE }));
    }
  }, r = ae(
    async (i) => {
      let l = null;
      try {
        return a((m) => ({ ...m, articleFetchStatus: N.UPDATING })), await q.ArticlesApi(n).updateArticle(i), { data: null };
      } catch (m) {
        return l = Q.getErrorType(m), { error: l };
      } finally {
        a((m) => ({ ...m, articleError: l, articleFetchStatus: N.IDLE }));
      }
    },
    [n]
  );
  return {
    state: t,
    mutations: { fetchArticlesList: s, deleteArticle: async (i) => {
      let l = null, m = [];
      try {
        return a((d) => ({ ...d, articleFetchStatus: N.DELETING })), await q.ArticlesApi(n).deleteArticle(i), m = await q.ArticlesApi(n).getArticles(), { data: m };
      } catch (d) {
        return l = Q.getErrorType(d), { error: l };
      } finally {
        a((d) => ({ ...d, articles: m, articleError: l, articleFetchStatus: N.IDLE })), a((d) => ({ ...d, articles: m, articleError: l, articleFetchStatus: N.IDLE }));
      }
    }, createArticle: o, updateArticle: r }
  };
}
const qa = {
  articleDetail: null,
  articleError: null,
  articleFetchStatus: N.IDLE
}, Ja = Ze("article-detail", qa);
function Ya() {
  const [n] = me(), [t, a] = Qe(Ja), s = ae(
    async (o) => {
      let r = null, c;
      try {
        return a((i) => ({ ...i, articleFetchStatus: N.FETCHING })), c = await q.ArticlesApi(n).getArticleBySlug(o), { data: c };
      } catch (i) {
        return r = Q.getErrorType(i), { error: r };
      } finally {
        a((i) => ({ ...i, articleDetail: c, articleError: r, articleFetchStatus: N.IDLE }));
      }
    },
    [n]
  );
  return {
    state: t,
    mutations: {
      fetchArticleBySlug: s
    }
  };
}
const Ke = { useArticles: ja, useArticleDetail: Ya };
const Ee = "ALL", Za = () => {
  const [n, t] = v(!1), [a, s] = v({ copiedLink: "", isCopied: !1 }), [o, r] = wt({ keyword: "", topic: Ee, status: Ee }), [c, i] = v(""), {
    state: { articles: l, articleFetchStatus: m },
    mutations: { fetchArticlesList: d, deleteArticle: S }
  } = Ke.useArticles(), {
    state: { topicsList: x },
    mutations: { fetchTopicsList: h }
  } = Ce.useTopicsList(), { state: g } = ee(), b = m === N.FETCHING, p = (E) => {
    t(!0), i(E);
  }, M = (E) => {
    const { keyword: F, status: f, topic: R } = E;
    let A = l;
    return F && (A = A.filter((C) => C.title.toLowerCase().includes(F.toLowerCase()))), f && f !== Ee && (A = A.filter((C) => C.status === f)), R && R !== Ee && (A = A.filter((C) => C.topic.id === R)), A;
  }, D = _t(), B = [
    D.accessor("title", {
      cell: (E) => E.getValue(),
      header: () => /* @__PURE__ */ e.createElement("span", null, "Article Title"),
      maxSize: 600,
      size: 500
    }),
    D.accessor("topic.name", {
      cell: (E) => /* @__PURE__ */ e.createElement("span", null, E.getValue()),
      header: () => /* @__PURE__ */ e.createElement("span", null, "Topic"),
      size: 150,
      maxSize: 280
    }),
    D.accessor("status", {
      cell: (E) => /* @__PURE__ */ e.createElement("span", { className: `bg-${E.getValue() === z.DRAFT ? "slate" : "green"}-80 self-center rounded-sm px-2 py-1 text-sm` }, E.getValue()),
      header: () => /* @__PURE__ */ e.createElement("span", null, "Status"),
      minSize: 100
    }),
    D.display({
      id: "action",
      maxSize: 60,
      cell: (E) => /* @__PURE__ */ e.createElement("div", { className: "relative flex" }, a.isCopied && E.row.original.slug === a.copiedLink && /* @__PURE__ */ e.createElement("p", { className: "copiedTooltip" }, "copied"), /* @__PURE__ */ e.createElement(
        I,
        {
          to: g.support.manage.article.edit.makePath({
            params: { slug: E.row.original.slug }
          }),
          className: "mr-6 mt-[2px]"
        },
        /* @__PURE__ */ e.createElement(xt, { size: 22, className: "stroke-white" })
      ), /* @__PURE__ */ e.createElement(Ta, { text: `${window.location.origin}/support/article/${E.row.original.slug}` }, /* @__PURE__ */ e.createElement(
        j,
        {
          buttonType: ne.PLAIN,
          buttonStyle: ge.TEXT,
          onClick: () => {
            s({ copiedLink: String(E.row.original.slug), isCopied: !0 }), setTimeout(() => s({ copiedLink: "", isCopied: !1 }), 1e3);
          }
        },
        /* @__PURE__ */ e.createElement(Yt, { size: 22, className: "mr-6" })
      )), /* @__PURE__ */ e.createElement(j, { buttonStyle: ge.TEXT, buttonType: ne.PLAIN, onClick: () => p(E.row.original.id) }, /* @__PURE__ */ e.createElement(At, { size: 22, className: "stroke-red-60" })))
    })
  ];
  W(() => {
    d(), h();
  }, []);
  const J = async () => {
    const E = H.loading("Deleting article...", U);
    (await S(c)).error ? H.update(E, { render: "Failed to delete article. Please try again.", type: "error", isLoading: !1, ...U }) : H.update(E, { render: "Article deleted", type: "success", isLoading: !1, ...U }), t(!1);
  };
  return /* @__PURE__ */ e.createElement("div", { className: "articleListPage" }, /* @__PURE__ */ e.createElement(he, { className: "flex items-center py-8" }, /* @__PURE__ */ e.createElement(I, { to: g.support.index.link }, /* @__PURE__ */ e.createElement(y, { i18nKey: "Navigation.links.support.title" }, "Support")), /* @__PURE__ */ e.createElement(y, { i18nKey: "Navigation.links.support.admin" }, "Manage Contents")), /* @__PURE__ */ e.createElement("div", { className: "mt-10 flex justify-between" }, /* @__PURE__ */ e.createElement($t, null), /* @__PURE__ */ e.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ e.createElement("a", { href: It, target: "blank", rel: "noopener noreferer", className: "inline-flex items-center" }, /* @__PURE__ */ e.createElement(Dt, null), /* @__PURE__ */ e.createElement("span", { className: "sr-only" }, "Go to AccelByte Docs")), /* @__PURE__ */ e.createElement(I, { to: g.support.manage.article.create.link }, /* @__PURE__ */ e.createElement(j, { className: "font-semibold", buttonType: ne.OUTLINED, buttonStyle: ge.WHITE }, /* @__PURE__ */ e.createElement(et, { className: "mr-1" }), " NEW ARTICLE")))), /* @__PURE__ */ e.createElement("div", null, b && /* @__PURE__ */ e.createElement(ct, { className: it.medium }), !b && !l.length && /* @__PURE__ */ e.createElement("div", { className: "flex flex-col items-center py-6" }, /* @__PURE__ */ e.createElement("p", { className: "mb-5 text-xl" }, K("Navigation.support.content.articles.noContent")), /* @__PURE__ */ e.createElement(I, { to: g.support.manage.article.create.link }, /* @__PURE__ */ e.createElement(j, null, "ADD NEW ARTICLE"))), !b && !!l.length && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "search my-4 flex w-3/4 gap-3 py-2" }, /* @__PURE__ */ e.createElement(
    xe,
    {
      placeholder: K("SupportSearchBar.form.search"),
      beforeElement: /* @__PURE__ */ e.createElement(Ct, { className: "ml-4", size: 16 }),
      className: "searchInput self-start",
      onChange: (E) => r({ keyword: E.target.value })
    }
  ), /* @__PURE__ */ e.createElement("div", { className: "selectInput" }, /* @__PURE__ */ e.createElement(
    je,
    {
      defaultValue: { label: "All Topics", value: Ee },
      options: [
        { label: "All Topics", value: Ee },
        ...(x == null ? void 0 : x.map((E) => ({ label: E.name, value: E.id }))) || []
      ],
      onChange: (E) => r({ topic: E == null ? void 0 : E.value }),
      isFullWidth: !0
    }
  )), /* @__PURE__ */ e.createElement("div", { className: "selectInput" }, /* @__PURE__ */ e.createElement(
    je,
    {
      defaultValue: { label: "All Status", value: Ee },
      options: [
        { label: "All Status", value: Ee },
        { label: "Draft", value: z.DRAFT },
        { label: "Published", value: z.PUBLISHED }
      ],
      onChange: (E) => r({ status: E == null ? void 0 : E.value }),
      isFullWidth: !0
    }
  ))), /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement(Vt, { data: M(o), columns: B })))), /* @__PURE__ */ e.createElement(
    Mt,
    {
      visible: n,
      onClose: () => t(!1),
      onSubmit: J,
      isSubmitDisabled: m === N.DELETING,
      subtitle: K("AlertDialog.subtitle.delete.article")
    }
  ));
};
function ps() {
  return /* @__PURE__ */ e.createElement("div", { className: "px-6 py-2" }, /* @__PURE__ */ e.createElement(Za, null));
}
const Ot = ({
  action: n,
  onArticleSubmit: t,
  isDraft: a,
  isSubmitting: s,
  isNotUpdated: o,
  validationError: r
}) => {
  const [c, i] = v(!1), l = !!(n === "CREATE" && o);
  return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "bg-dark-100 mb-4 rounded-md p-4" }, /* @__PURE__ */ e.createElement("div", { className: "flex" }, /* @__PURE__ */ e.createElement("h3", { className: "text-[32px] font-medium" }, "Publishing Control"), n !== "CREATE" && a && /* @__PURE__ */ e.createElement("span", { className: "bg-slate-80 text-2tiny ml-2 self-center rounded-sm px-2 py-1" }, "DRAFT")), /* @__PURE__ */ e.createElement("div", { className: "my-4 flex justify-between" }, /* @__PURE__ */ e.createElement("p", { className: "text-neutral-60" }, "Visiblity"), /* @__PURE__ */ e.createElement("div", { className: "flex gap-4" }, /* @__PURE__ */ e.createElement("span", { className: "bg-green-80 self-center rounded-sm px-2 py-1 text-sm" }, "PUBLIC"))), /* @__PURE__ */ e.createElement("div", { className: "flex justify-end gap-2" }, /* @__PURE__ */ e.createElement(
    j,
    {
      buttonType: ne.TEXT,
      onClick: () => {
        n === "CREATE" || a ? t(z.DRAFT) : i(!0);
      },
      disabled: s || l || o && a || r && r.size > 0
    },
    n === "CREATE" || a ? K("SupportPage.saveDraft.button") : K("SupportPage.unpublish.button")
  ), /* @__PURE__ */ e.createElement(
    j,
    {
      onClick: () => t(z.PUBLISHED),
      disabled: s || l || o && !a || r && r.size > 0
    },
    n === "CREATE" || a ? K("SupportPage.publish.button") : K("SupportPage.update.button")
  ))), /* @__PURE__ */ e.createElement(
    ca,
    {
      visible: c,
      onClose: () => i(!1),
      onSubmit: () => t(z.DRAFT)
    }
  ));
};
const zt = ({ onChange: n, topics: t, topicId: a }) => {
  const [s, o] = v(""), { state: r } = ee();
  return W(() => {
    o(a), n("topicId", a);
  }, [a]), /* @__PURE__ */ e.createElement("div", { className: "topicSection" }, /* @__PURE__ */ e.createElement("h3", { className: "text-[32px] font-medium" }, K("SupportArticlePage.topicSection.title")), t != null && t.length ? /* @__PURE__ */ e.createElement("div", { className: "radioContainer" }, t.map((c) => /* @__PURE__ */ e.createElement(
    Na,
    {
      key: c.id,
      label: c.name,
      className: "mb-3",
      checked: c.id === s,
      onClick: () => {
        n("topicId", c.id), o(c.id);
      }
    }
  ))) : /* @__PURE__ */ e.createElement("p", { className: "text-center" }, "No topic yet"), /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement(I, { to: r.support.manage.topic.create.link }, /* @__PURE__ */ e.createElement(j, { buttonType: ne.TEXT, className: "!px-0 font-semibold" }, /* @__PURE__ */ e.createElement(et, { className: "mr-1" }), " Add New Topic"))));
};
const He = {
  title: "",
  status: z.DRAFT,
  rawContent: "",
  htmlContent: "",
  topicId: "",
  metaTitle: "",
  metaDescription: "",
  textEditor: ""
}, Qa = u.enum([
  "title",
  "status",
  "rawContent",
  "htmlContent",
  "topicId",
  "metaTitle",
  "metaDescription",
  "textEditor"
]), lt = u.object({
  title: u.string().trim().min(1, "Article title can't be empty").max(128, "The title you entered exceeds the maximum allowed character limit of 128"),
  metaTitle: u.string().trim().max(128, "The meta title you entered exceeds the maximum allowed character limit of 128"),
  metaDescription: u.string().trim().max(256, "The meta description you entered exceeds the maximum allowed character limit of 256").optional().default(""),
  textEditor: u.string().trim().min(1, "Article content can't be empty").max(65536)
});
u.object({
  id: u.string().optional(),
  htmlContent: u.string().trim().min(1).max(65536),
  rawContent: u.string().trim().min(1).max(65536),
  topicId: u.string(),
  namespace: u.string().optional(),
  status: u.nativeEnum(z)
}).merge(lt);
class G {
}
G.META_TITLE_MIN_LENGTH = 50;
G.META_TITLE_MAX_SUGGESTED_LENGTH = 70;
G.META_TITLE_MAX_LENGTH = 128;
G.META_DESCRIPTION_MIN_LENGTH = 100;
G.META_DESCRIPTION_MAX_SUGGESTED_LENGTH = 160;
G.META_DESCRIPTION_MAX_LENGTH = 256;
G.TITLE_MAX_LENGTH = 128;
const Ye = () => {
  const n = le(null);
  return { onShowPopover: () => {
    n.current && Se.show(n.current);
  }, onHidePopover: () => {
    n.current && Se.hide(n.current);
  }, popoverRef: n };
}, Le = u.enum(["LESS", "FAIR", "OVER"]), se = u.enum(["metaTitle", "metaDescription"]), Ge = ({ max: n, length: t }) => 100 / (n / t), Ie = (n, t) => {
  switch (n) {
    case se.Enum.metaTitle: {
      if (t < G.META_TITLE_MIN_LENGTH)
        return Le.Enum.LESS;
      if (t > G.META_TITLE_MAX_SUGGESTED_LENGTH)
        return Le.Enum.OVER;
      break;
    }
    case se.Enum.metaDescription: {
      if (t < G.META_DESCRIPTION_MIN_LENGTH)
        return Le.Enum.LESS;
      if (t > G.META_DESCRIPTION_MAX_SUGGESTED_LENGTH)
        return Le.Enum.OVER;
      break;
    }
  }
  return Le.Enum.FAIR;
}, Wt = ({ children: n, onChange: t, articleDetail: a, validationError: s }) => {
  const {
    state: { discoveryConfigData: o }
  } = ia(), { onHidePopover: r, onShowPopover: c, popoverRef: i } = Ye(), {
    onHidePopover: l,
    onShowPopover: m,
    popoverRef: d
  } = Ye(), [S, x] = v({
    level: Ie(se.Enum.metaTitle, a.metaTitle.length),
    progress: Ge({ length: a.metaTitle.length, max: G.META_TITLE_MAX_SUGGESTED_LENGTH })
  });
  W(() => {
    x({
      level: Ie(se.Enum.metaTitle, a.metaTitle.length),
      progress: Ge({ length: a.metaTitle.length, max: G.META_TITLE_MAX_SUGGESTED_LENGTH })
    });
  }, [a.metaTitle]);
  const [h, g] = v({
    level: Ie(se.Enum.metaDescription, a.metaDescription.length),
    progress: Ge({ length: a.metaDescription.length, max: G.META_DESCRIPTION_MAX_SUGGESTED_LENGTH })
  });
  W(() => {
    g({
      level: Ie(se.Enum.metaDescription, a.metaDescription.length),
      progress: Ge({
        length: a.metaDescription.length,
        max: G.META_DESCRIPTION_MAX_SUGGESTED_LENGTH
      })
    });
  }, [a.metaDescription]);
  const b = (E, F) => {
    switch (E) {
      case se.Enum.metaTitle: {
        const f = 100 / (G.META_TITLE_MAX_LENGTH / F.length);
        x({ level: Ie(E, F.length), progress: f });
        break;
      }
      case se.Enum.metaDescription: {
        const f = 100 / (G.META_DESCRIPTION_MAX_LENGTH / F.length);
        g({ level: Ie(E, F.length), progress: f });
        break;
      }
    }
    t(E, F);
  }, [p, M] = v(""), D = Ve(
    () => `${p}/support/${a.metaTitle.split(" ").join("-") || "article-name"}`,
    [p, a.metaTitle]
  ), B = Ve(
    () => {
      var E, F;
      return `Support | ${a.metaTitle || "<meta title>"} - ${(F = (E = o == null ? void 0 : o.brandName) == null ? void 0 : E.data) == null ? void 0 : F.value}`;
    },
    [a.metaTitle, o]
  ), J = Ve(() => `${a.metaDescription || "<meta description>"}`, [a.metaDescription]);
  return W(() => {
    location && M(location.origin);
  }, []), /* @__PURE__ */ e.createElement("div", { className: "articleForm bg-dark-100 w-3/4 rounded-md p-4" }, /* @__PURE__ */ e.createElement(ie, { className: "formGroup" }, /* @__PURE__ */ e.createElement(
    xe,
    {
      placeholder: "Enter Title*",
      autoFocus: !0,
      onChange: (E) => t(Qa.Enum.title, E.target.value),
      value: a.title,
      popoverContent: /* @__PURE__ */ e.createElement(
        Fe,
        {
          messages: [
            K("News.form.validation.required.info"),
            K("News.form.validation.title.max.info"),
            K("News.form.validation.alphanumeric.info")
          ]
        }
      )
    }
  ), /* @__PURE__ */ e.createElement(ye, null, s.get("title"))), n, /* @__PURE__ */ e.createElement(ye, null, s.get("textEditor")), /* @__PURE__ */ e.createElement("div", { className: "seoSettings mt-4" }, /* @__PURE__ */ e.createElement("h2", { className: "mb-4 text-[2rem] font-semibold" }, "SEO Settings"), /* @__PURE__ */ e.createElement("div", { className: "bg-dark-80 mb-6 rounded p-4" }, /* @__PURE__ */ e.createElement("div", { className: "mb-2 flex items-center gap-2" }, /* @__PURE__ */ e.createElement(Zt, null), /* @__PURE__ */ e.createElement("span", { className: "text-3xl font-medium" }, "Snippet Preview")), /* @__PURE__ */ e.createElement("div", { className: "mb-2" }, /* @__PURE__ */ e.createElement("span", { className: "text-tiny leading-4" }, "Exact results may vary based on content and search relevancy.")), /* @__PURE__ */ e.createElement("div", { className: "w-full break-all rounded bg-white p-4" }, /* @__PURE__ */ e.createElement("span", { className: "line-clamp-1 mb-[5px] text-ellipsis text-[15px] leading-[18px] text-[#202124]" }, D), /* @__PURE__ */ e.createElement("span", { className: "line-clamp-1 mb-[5px] w-full cursor-pointer text-ellipsis text-3xl leading-[26px] text-[#0055CA] hover:underline" }, B), /* @__PURE__ */ e.createElement("span", { className: "line-clamp-2 text-ellipsis text-[13px] text-[#4D5156]" }, J))), /* @__PURE__ */ e.createElement("div", { className: "mb-6" }, /* @__PURE__ */ e.createElement(ie, { className: "formGroup" }, /* @__PURE__ */ e.createElement("div", { className: "flex w-full", onMouseEnter: c, onMouseLeave: r }, /* @__PURE__ */ e.createElement(
    xe,
    {
      placeholder: "Enter Title",
      onChange: (E) => b(se.Enum.metaTitle, E.target.value),
      value: a.metaTitle
    }
  ), /* @__PURE__ */ e.createElement(Me, { tooltipRef: i, hideMobile: !0, className: "text-center" }, /* @__PURE__ */ e.createElement(Fe, { messages: [K("News.form.validation.metaTitle.length.info")] }))), /* @__PURE__ */ e.createElement(ye, null, s.get("metaTitle"))), /* @__PURE__ */ e.createElement("p", { className: "mb-2 text-sm" }, K("SupportArticlePage.meta.title")), /* @__PURE__ */ e.createElement("div", { className: "flex items-center gap-2" }, !a.metaTitle && /* @__PURE__ */ e.createElement("span", { className: "bg-red-80 rounded-sm p-2 text-sm" }, "MISSING"), /* @__PURE__ */ e.createElement("span", null, a.metaTitle.length, "/", G.META_TITLE_MAX_SUGGESTED_LENGTH), /* @__PURE__ */ e.createElement("div", { className: "bg-dark-60 h-2 w-full overflow-hidden rounded-full" }, /* @__PURE__ */ e.createElement(
    "div",
    {
      className: `${S.level.toLowerCase()} h-full rounded-full transition-all duration-300`,
      style: { width: `${S.progress}%` }
    }
  )))), /* @__PURE__ */ e.createElement("div", { className: "mb-6" }, /* @__PURE__ */ e.createElement(ie, { className: "formGroup" }, /* @__PURE__ */ e.createElement("div", { className: "flex w-full" }, /* @__PURE__ */ e.createElement(
    Lt,
    {
      placeholder: "Meta Description",
      type: "textarea",
      rows: "3",
      className: "formTextArea",
      onChange: (E) => b(se.Enum.metaDescription, E.target.value),
      value: a.metaDescription,
      onMouseEnter: m,
      onMouseLeave: l
    }
  ), /* @__PURE__ */ e.createElement(Me, { tooltipRef: d, hideMobile: !0, className: "text-center" }, /* @__PURE__ */ e.createElement(Fe, { messages: [K("News.form.validation.metaDescription.length.info")] }))), /* @__PURE__ */ e.createElement(ye, null, s.get("metaDescription"))), /* @__PURE__ */ e.createElement("p", { className: "mb-2 text-sm" }, K("SupportArticlePage.meta.description")), /* @__PURE__ */ e.createElement("div", { className: "flex items-center gap-2" }, !a.metaDescription && /* @__PURE__ */ e.createElement("span", { className: "bg-red-80 rounded-sm p-2 text-sm" }, "MISSING"), /* @__PURE__ */ e.createElement("span", null, a.metaDescription.length, "/", G.META_DESCRIPTION_MAX_SUGGESTED_LENGTH), /* @__PURE__ */ e.createElement("div", { className: "bg-dark-60 h-2 w-full overflow-hidden rounded-full" }, /* @__PURE__ */ e.createElement(
    "div",
    {
      className: `${h.level.toLowerCase()} h-full rounded-full transition-all duration-300`,
      style: { width: `${h.progress}%` }
    }
  ))))));
}, en = () => {
  const [n, t] = v(He), [a, s] = v(null), [o, r] = v(!1), [c, i] = v(!1), [l, m] = v(!0), d = le(), { state: S } = ee(), { state: x } = ve(), { validateAll: h, validateSingleInput: g, validationErrorMessage: b } = at({ schema: lt }), {
    mutations: { createArticle: p }
  } = Ke.useArticles(), {
    mutations: { fetchTopicsList: M }
  } = Ce.useTopicsList(), D = x.block && x.block(() => {
    var C, $;
    const A = ($ = (C = d.current) == null ? void 0 : C.getRootElement()) == null ? void 0 : $.textContent;
    return be({ ...n, topicId: "" }, He) && !A || c ? !1 : (r(!0), !0);
  });
  nt(), W(() => ((async () => {
    const C = await M();
    C.data && s(C.data);
  })(), () => {
    D != null && D.reset && D.reset();
  }), []);
  const B = (A, C) => {
    const $ = ["metaDescription", "metaTitle", "title", "textEditor"], Y = { ...n, [A]: C };
    t(Y), $.includes(A) && g(A, C);
  }, J = () => {
    var C, $;
    const A = (($ = (C = d.current) == null ? void 0 : C.getRootElement()) == null ? void 0 : $.textContent) || "";
    B("textEditor", A);
  }, E = async (A) => {
    var P, L;
    const { validation: C } = h(n);
    if (!C.success)
      return;
    const $ = (L = (P = d.current) == null ? void 0 : P.getRootElement()) == null ? void 0 : L.textContent, Y = H.loading("Publishing article...", U);
    i(!0);
    const oe = {
      ...n,
      textContent: void 0,
      status: A,
      rawContent: Xe(d.current),
      htmlContent: kt(d.current),
      metaTitle: n.metaTitle || Be(n.title),
      metaDescription: n.metaDescription || $ && Be($, G.META_DESCRIPTION_MAX_LENGTH) || ""
    };
    if ((await p({ ...oe })).error) {
      let T = re.articleFailedToPublish;
      A === z.DRAFT && (T = re.articleFailedToSaveAsDraft), i(!1), H.update(Y, { render: T, type: "error", isLoading: !1, ...U });
    } else {
      let T = re.articlePublished;
      A === z.DRAFT && (T = re.articleSavedAsDraft), H.update(Y, { render: T, type: "success", isLoading: !1, ...U }), x.push(S.support.manage.article.index.link);
    }
  }, F = () => {
    r(!1), D != null && D.proceed && D.proceed();
  }, f = a !== null ? a[0].id : "", R = be(n, { ...He, topicId: f }) && l;
  return /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement(he, { className: "mb-6 flex items-center" }, /* @__PURE__ */ e.createElement(I, { to: S.support.index.link }, /* @__PURE__ */ e.createElement(y, { i18nKey: "Navigation.links.support.title" }, "Support")), /* @__PURE__ */ e.createElement(I, { to: S.support.manage.article.index.link }, /* @__PURE__ */ e.createElement(y, { i18nKey: "Navigation.links.support.admin" }, "Manage Contents")), /* @__PURE__ */ e.createElement("span", null, /* @__PURE__ */ e.createElement(y, { i18nKey: "Navigation.links.support.content.articles.create" }, "Create New Article"))), /* @__PURE__ */ e.createElement("h1", { className: "text-xxl mb-4 font-semibold" }, /* @__PURE__ */ e.createElement(y, { i18nKey: "Navigation.links.support.content.articles.create" }, "Create New Article")), /* @__PURE__ */ e.createElement("div", { className: "flex gap-4" }, /* @__PURE__ */ e.createElement(Wt, { onChange: B, articleDetail: n, validationError: b }, /* @__PURE__ */ e.createElement(
    Pt,
    {
      rawContent: n.rawContent,
      onEditorChange: (A, C) => {
        var $, Y;
        d.current = C, J(), m(!((Y = ($ = d.current) == null ? void 0 : $.getRootElement()) != null && Y.textContent));
      }
    }
  )), /* @__PURE__ */ e.createElement("div", { className: "w-1/4" }, /* @__PURE__ */ e.createElement(
    Ot,
    {
      action: "CREATE",
      onArticleSubmit: E,
      isSubmitting: c,
      isNotUpdated: R,
      validationError: b
    }
  ), /* @__PURE__ */ e.createElement(zt, { topics: a, topicId: f, onChange: B }), /* @__PURE__ */ e.createElement(st, null))), /* @__PURE__ */ e.createElement(ot, { visible: o, onClose: () => r(!1), onSubmit: F }));
};
function us() {
  return /* @__PURE__ */ e.createElement("div", { className: "px-6 py-2" }, /* @__PURE__ */ e.createElement(en, null));
}
const tn = ({ slug: n }) => {
  const [t, a] = v({ id: "", ...He }), [s, o] = v(null), [r, c] = v(!1), [i, l] = v(!1), [m, d] = v(!1), [S, x] = v(!0), h = le(), g = le(null), { state: b } = ee(), { state: p } = ve(), { validateAll: M, validateSingleInput: D, validationErrorMessage: B } = at({ schema: lt }), {
    mutations: { updateArticle: J }
  } = Ke.useArticles(), {
    mutations: { fetchArticleBySlug: E }
  } = Ke.useArticleDetail(), {
    mutations: { fetchTopicsList: F }
  } = Ce.useTopicsList(), f = p.block && p.block(() => be(t, g.current) || m ? !1 : (l(!0), !0));
  nt(), W(() => ((async () => {
    const P = await E(n), L = await F();
    if (P.data) {
      const { title: T, rawContent: w, status: X, metaTitle: ce, metaDescription: fe, id: Z, topic: De, htmlContent: pe } = P.data;
      g.current = {
        id: Z,
        title: T,
        status: X,
        rawContent: w || "",
        htmlContent: pe || "",
        metaTitle: ce,
        metaDescription: fe,
        topicId: De.id
      }, a({
        ...t,
        id: Z,
        title: T,
        status: X,
        rawContent: w || "",
        htmlContent: pe || "",
        metaTitle: ce,
        metaDescription: fe,
        textEditor: w || "",
        topicId: De.id
      });
    }
    L.data && o(L.data);
  })(), () => {
    f != null && f.reset && f.reset();
  }), []);
  const R = (_, P) => {
    const L = ["metaDescription", "metaTitle", "title", "textEditor"], T = { ...t, [_]: P };
    a(T), L.includes(_) && D(_, P);
  }, A = () => {
    var P, L;
    const _ = ((L = (P = h.current) == null ? void 0 : P.getRootElement()) == null ? void 0 : L.textContent) || "";
    R("textEditor", _);
  }, C = async () => {
    var _;
    if (g.current && h.current) {
      const P = g.current, L = h.current, T = ((_ = L.getRootElement()) == null ? void 0 : _.textContent) || "";
      L.update(() => {
        Et.reset(), Et.updateFromJSON(L, P.rawContent);
      });
      const w = {
        ...P,
        textEditor: T
      };
      a(w), M(w), c(!1);
    }
  }, $ = async (_) => {
    var ce, fe;
    const { validation: P } = M(t);
    if (!P.success)
      return;
    const L = (fe = (ce = h.current) == null ? void 0 : ce.getRootElement()) == null ? void 0 : fe.textContent, T = H.loading("Updating article...", U);
    d(!0);
    const w = {
      ...t,
      id: t.id || "",
      textEditor: void 0,
      status: _,
      htmlContent: kt(h.current),
      rawContent: Xe(h.current),
      metaTitle: t.metaTitle || Be(t.title),
      metaDescription: t.metaDescription || L && Be(L, G.META_DESCRIPTION_MAX_LENGTH) || ""
    };
    if ((await J(w)).error) {
      let Z = re.articleFailedToPublish;
      _ === z.DRAFT && (Z = re.articleFailedToSaveAsDraft), t.status === z.PUBLISHED && _ === z.DRAFT && (Z = re.articleFailedToUnPublish), d(!1), H.update(T, { render: Z, type: "error", isLoading: !1, ...U });
    } else {
      let Z = re.articlePublished;
      _ === z.DRAFT && (Z = re.articleSavedAsDraft), t.status === z.PUBLISHED && _ === z.DRAFT && (Z = re.articleUnpublished), H.update(T, { render: Z, type: "success", isLoading: !1, ...U }), p.push(b.support.manage.article.index.link);
    }
  }, Y = () => {
    l(!1), f != null && f.proceed && f.proceed();
  }, oe = be(t, g.current) && S;
  return /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement(he, { className: "mb-6 flex items-center" }, /* @__PURE__ */ e.createElement(I, { to: b.support.index.link }, /* @__PURE__ */ e.createElement(y, { i18nKey: "Navigation.links.support.title" }, "Support")), /* @__PURE__ */ e.createElement(I, { to: b.support.manage.article.index.link }, /* @__PURE__ */ e.createElement(y, { i18nKey: "Navigation.links.support.admin" }, "Manage Contents")), /* @__PURE__ */ e.createElement("span", null, /* @__PURE__ */ e.createElement(y, { i18nKey: "Navigation.links.support.content.articles.edit" }, "Edit Article"))), /* @__PURE__ */ e.createElement("h1", { className: "text-xxl mb-4 font-semibold" }, /* @__PURE__ */ e.createElement(y, { i18nKey: "Navigation.links.support.content.articles.edit" }, "Edit Article")), /* @__PURE__ */ e.createElement("div", { className: "flex gap-4" }, t && /* @__PURE__ */ e.createElement(Wt, { onChange: R, articleDetail: t, validationError: B }, /* @__PURE__ */ e.createElement(
    Pt,
    {
      rawContent: t.rawContent,
      onEditorChange: (_, P) => {
        var L;
        h.current = P, A(), x(be(Xe(P), (L = g.current) == null ? void 0 : L.rawContent));
      }
    }
  )), /* @__PURE__ */ e.createElement("div", { className: "w-1/4" }, /* @__PURE__ */ e.createElement(
    Ot,
    {
      action: "EDIT",
      onArticleSubmit: $,
      isDraft: t.status === z.DRAFT,
      isSubmitting: m,
      isNotUpdated: oe,
      validationError: B
    }
  ), /* @__PURE__ */ e.createElement("div", { className: "bg-dark-100 mb-4 rounded-md p-4" }, /* @__PURE__ */ e.createElement(
    j,
    {
      buttonType: ne.OUTLINED,
      onClick: () => c(!0),
      disabled: m || oe,
      isFullWidth: !0
    },
    /* @__PURE__ */ e.createElement(vt, { className: "mr-1" }),
    " DISCARD CHANGES"
  )), /* @__PURE__ */ e.createElement(zt, { onChange: R, topics: s, topicId: t.topicId }), /* @__PURE__ */ e.createElement(st, null))), /* @__PURE__ */ e.createElement(
    Rt,
    {
      visible: r,
      onClose: () => c(!1),
      onSubmit: C
    }
  ), /* @__PURE__ */ e.createElement(ot, { visible: i, onClose: () => l(!1), onSubmit: Y }));
};
function ds({ slug: n }) {
  return /* @__PURE__ */ e.createElement("div", { className: "px-6 py-2" }, /* @__PURE__ */ e.createElement(tn, { slug: n }));
}
const an = ({
  isChecked: n,
  isLoading: t = !1,
  isDisabled: a = !1,
  label: s = "",
  name: o = "",
  value: r = "",
  onChange: c,
  className: i,
  popoverContent: l
}) => {
  const m = t || a, d = le(null), S = () => {
    d.current && Se.show(d.current);
  }, x = () => {
    d.current && Se.hide(d.current);
  };
  return /* @__PURE__ */ e.createElement("div", { className: Ae("styled-toggle", i, { disabled: m }) }, t && /* @__PURE__ */ e.createElement("span", { className: "styled-toggle__loading" }), /* @__PURE__ */ e.createElement("label", { "data-checked": n, className: "toggle-label", onMouseEnter: S, onMouseLeave: x }, /* @__PURE__ */ e.createElement("input", { type: "checkbox", "aria-label": s, name: o, value: r, onChange: c, disabled: m })), /* @__PURE__ */ e.createElement(Me, { tooltipRef: d, hideMobile: !0, popoverPlacement: "top", className: "text-center" }, l));
}, nn = () => {
  const [n, t] = v(!1), [a, s] = v(""), [o, r] = v(""), c = le(null), { state: i } = ee(), {
    state: { topicsList: l, topicsListFetchStatus: m, topicsListError: d },
    mutations: { fetchTopicsList: S }
  } = Ce.useTopicsList(), {
    state: { deleteTopicFetchStatus: x, updateTopicFetchStatus: h },
    mutations: { updateTopic: g, deleteTopic: b }
  } = Ce.useTopicDetail(), p = _t(), M = m === N.FETCHING;
  W(() => {
    S();
  }, []);
  const D = (f) => {
    t(!0), r(f);
  }, B = async () => {
    var A;
    const f = H.loading("Deleting topic...", U), R = await b(o);
    if (!R.error)
      await S(), H.update(f, { render: "Topic deleted", type: "success", isLoading: !1, ...U });
    else {
      let C = "Failed to delete topic. Please try again.";
      qe.isAxiosError(R.error) && ((A = R.error.response) == null ? void 0 : A.status) === 400 && (C = "The action can't be completed because there are articles that have been assigned to this topic."), H.update(f, { render: C, type: "error", isLoading: !1, ...U });
    }
    t(!1);
  }, J = () => l.filter((f) => f.name.toLowerCase().includes(a.toLowerCase())), E = async (f) => {
    const R = H.loading("Updating topic...", U), A = { ...f };
    A.status = f.status === Pe.VISIBLE ? Pe.HIDDEN : Pe.VISIBLE, (await g(A)).error ? H.update(R, {
      render: "Failed to update topic. Please try again.",
      type: "error",
      isLoading: !1,
      ...U
    }) : (await S(), H.update(R, { render: "Topic updated", type: "success", isLoading: !1, ...U }));
  }, F = [
    p.display({
      id: "displayOrder",
      header: "Display Order",
      size: 95,
      cell: (f) => /* @__PURE__ */ e.createElement("p", { className: "text-center" }, f.row.index + 1)
    }),
    p.accessor("name", {
      header: () => /* @__PURE__ */ e.createElement("span", { className: "flex" }, "Topic"),
      cell: (f) => /* @__PURE__ */ e.createElement("p", null, f.getValue())
    }),
    p.accessor("status", {
      header: () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
        "span",
        {
          onMouseEnter: () => c.current && Se.show(c.current),
          onMouseLeave: () => c.current && Se.hide(c.current),
          className: "flex items-center gap-2"
        },
        "Display on Landing Page ",
        /* @__PURE__ */ e.createElement(Qt, { size: 16 }),
        /* @__PURE__ */ e.createElement(Me, { tooltipRef: c, popoverPlacement: "top", className: "mb-2 text-center", hideMobile: !0 }, /* @__PURE__ */ e.createElement(y, { i18nKey: "SupportPage.topicList.tooltip.displayInfo" }, "Hide specific topic from the landing page. But can still visible in other pages."))
      )),
      cell: (f) => {
        const R = f.getValue();
        return /* @__PURE__ */ e.createElement(
          an,
          {
            onChange: () => E(f.row.original),
            isChecked: R === Pe.VISIBLE,
            isDisabled: h === N.UPDATING
          }
        );
      }
    }),
    p.display({
      id: "action",
      cell: (f) => /* @__PURE__ */ e.createElement("div", { className: "relative flex" }, /* @__PURE__ */ e.createElement(
        I,
        {
          to: i.support.manage.topic.edit.makePath({
            params: { slug: f.row.original.slug }
          }),
          className: "mr-6 mt-[2px]"
        },
        /* @__PURE__ */ e.createElement(xt, { className: "stroke-white", size: 22 })
      ), /* @__PURE__ */ e.createElement(
        j,
        {
          buttonStyle: ge.TEXT,
          buttonType: ne.PLAIN,
          onClick: () => D(f.row.original.id),
          disabled: l.length === 1
        },
        /* @__PURE__ */ e.createElement(At, { size: 22, className: "stroke-red-60" })
      ))
    })
  ];
  return /* @__PURE__ */ e.createElement("div", { className: "topicPage" }, /* @__PURE__ */ e.createElement(he, { className: "py-8" }, /* @__PURE__ */ e.createElement(I, { to: i.support.index.link }, /* @__PURE__ */ e.createElement(y, { i18nKey: "Navigation.links.support.title" }, "Support")), /* @__PURE__ */ e.createElement(y, { i18nKey: "Navigation.links.manageContents" }, "Manage Contents")), /* @__PURE__ */ e.createElement("div", { className: "mt-10 flex justify-between" }, /* @__PURE__ */ e.createElement($t, null), /* @__PURE__ */ e.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ e.createElement("a", { href: It, target: "blank", rel: "noopener noreferer", className: "inline-flex items-center" }, /* @__PURE__ */ e.createElement(Dt, null), /* @__PURE__ */ e.createElement("span", { className: "sr-only" }, "Go to AccelByte Docs")), /* @__PURE__ */ e.createElement(I, { to: i.support.manage.topic.create.link }, /* @__PURE__ */ e.createElement(j, { className: "font-semibold", buttonType: ne.OUTLINED, buttonStyle: ge.WHITE }, /* @__PURE__ */ e.createElement(et, { className: "mr-1" }), " NEW TOPIC")))), /* @__PURE__ */ e.createElement("div", null, M && /* @__PURE__ */ e.createElement(ct, { className: it.medium }), !M && !d && !l.length && /* @__PURE__ */ e.createElement("div", { className: "flex flex-col items-center py-6" }, /* @__PURE__ */ e.createElement("p", { className: "mb-5 text-xl" }, K("Navigation.support.content.topics.noContent")), /* @__PURE__ */ e.createElement(I, { to: i.support.manage.topic.create.link }, /* @__PURE__ */ e.createElement(j, null, "ADD NEW TOPIC"))), !M && !d && !!l.length && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "topicPageSearch" }, /* @__PURE__ */ e.createElement(
    xe,
    {
      type: "text",
      placeholder: "Search topic",
      beforeElement: /* @__PURE__ */ e.createElement(Ct, { className: "ml-4", size: 16 }),
      className: "searchInput self-start",
      onChange: (f) => s(f.target.value)
    }
  )), /* @__PURE__ */ e.createElement(Vt, { data: a ? J() : l, columns: F, defaultColumnSize: 225 })), !M && d && /* @__PURE__ */ e.createElement(Gt, { error: d })), /* @__PURE__ */ e.createElement(
    Mt,
    {
      visible: n,
      onClose: () => t(!1),
      onSubmit: B,
      isSubmitDisabled: x === N.DELETING,
      subtitle: K("AlertDialog.subtitle.delete.topic")
    }
  ), /* @__PURE__ */ e.createElement(Se, null));
};
function Es() {
  return /* @__PURE__ */ e.createElement("div", { className: "px-6 py-2" }, /* @__PURE__ */ e.createElement(nn, null));
}
var mt = /* @__PURE__ */ ((n) => (n.EDIT = "EDIT", n.CREATE = "CREATE", n))(mt || {});
const Xt = (n) => {
  var L, T;
  const { action: t, topic: a } = n, s = {
    name: (a == null ? void 0 : a.name) || "",
    description: (a == null ? void 0 : a.description) || ""
  }, [o, r] = v(s), [c, i] = v(!1), [l, m] = v(!1), [d, S] = v(!1), { state: x } = ee(), { state: h } = ve(), {
    state: { updateTopicFetchStatus: g },
    mutations: { updateTopic: b, createTopic: p }
  } = Ce.useTopicDetail(), { validateAll: M, validateSingleInput: D, validationErrorMessage: B } = at({ schema: ba }), {
    popoverRef: J,
    onShowPopover: E,
    onHidePopover: F
  } = Ye(), f = h.block && h.block(() => be(o, s) || g === N.UPDATING || d ? !1 : (m(!0), !0));
  nt(), W(() => () => {
    f != null && f.reset && f.reset();
  }, []);
  const R = () => {
    m(!1), f != null && f.proceed && f.proceed();
  }, A = (w) => {
    r((X) => ({ ...X, ...w }));
  }, C = (w) => {
    const X = w.target.value;
    A({ name: X }), D("name", X);
  }, $ = (w) => {
    const X = w.target.value;
    A({ description: X }), D("description", X);
  }, Y = () => {
    i(!1), A(s);
  }, oe = async (w) => {
    var Z, De;
    const { name: X, description: ce } = o;
    w.preventDefault();
    const { validation: fe } = M({ name: X, description: ce });
    if (fe.success) {
      if (t === "EDIT") {
        const pe = H.loading("Updating topic...", U);
        S(!0);
        const Te = { ...a };
        Te.name = o.name, Te.description = o.description;
        const we = await b(Te);
        if (!we.error)
          H.update(pe, { render: "Topic updated", type: "success", isLoading: !1, ...U }), _();
        else {
          S(!1);
          let ut = "Failed to update topic. Please try again.";
          qe.isAxiosError(we.error) && ((Z = we.error.response) == null ? void 0 : Z.status) === 409 && (ut = "A topic with the identical name already exists."), H.update(pe, { render: ut, type: "error", isLoading: !1, ...U });
        }
      } else if (t === "CREATE") {
        const pe = H.loading("Publishing topic...", U);
        S(!0);
        const Te = await p({
          name: o.name,
          description: o.description
        });
        if (!Te.error)
          H.update(pe, { render: "Topic published", type: "success", isLoading: !1, ...U }), _();
        else {
          S(!1);
          let we = "Failed to publish topic. Please try again.";
          qe.isAxiosError(Te.error) && ((De = Te.error.response) == null ? void 0 : De.status) === 409 && (we = "A topic with the identical name already exists."), H.update(pe, { render: we, type: "error", isLoading: !1, ...U });
        }
      }
    }
  }, _ = () => {
    i(!1), h.push(x.support.manage.topic.index.link);
  }, P = be(o, s);
  return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("form", { onSubmit: oe }, /* @__PURE__ */ e.createElement("div", { className: "flex gap-4" }, /* @__PURE__ */ e.createElement("div", { className: "bg-dark-100 topicForm w-3/4 rounded-md p-4" }, /* @__PURE__ */ e.createElement(ie, { className: "formGroup" }, /* @__PURE__ */ e.createElement(
    xe,
    {
      type: "text",
      value: o.name,
      name: "name",
      className: "inputGroup",
      onChange: C,
      placeholder: "Enter topic name*",
      popoverContent: /* @__PURE__ */ e.createElement(Fe, { messages: ["Required", "Max 30 characters", "Allow alphanumeric"] }),
      autoFocus: !0
    }
  ), /* @__PURE__ */ e.createElement(ye, null, B && ((L = B.get("name")) == null ? void 0 : L[0]))), /* @__PURE__ */ e.createElement(ie, { className: "formGroup" }, /* @__PURE__ */ e.createElement("div", { className: "flex w-full", onMouseEnter: E, onMouseLeave: F }, /* @__PURE__ */ e.createElement(
    Lt,
    {
      name: "description",
      value: o.description,
      placeholder: "Enter topic description",
      onChange: $,
      type: "textarea",
      rows: "5",
      className: "inputGroup formTextArea resize-none"
    }
  ), /* @__PURE__ */ e.createElement(Me, { tooltipRef: J, hideMobile: !0, className: "text-center" }, /* @__PURE__ */ e.createElement(Fe, { messages: ["Max 256 characters", "Allow alphanumeric"] }))), /* @__PURE__ */ e.createElement(ye, null, B && ((T = B.get("description")) == null ? void 0 : T[0])))), /* @__PURE__ */ e.createElement("div", { className: "w-[32rem]" }, t === "EDIT" && /* @__PURE__ */ e.createElement("div", { className: "bg-dark-100 mb-4 rounded-md p-4" }, /* @__PURE__ */ e.createElement(
    j,
    {
      onClick: () => i(!0),
      isFullWidth: !0,
      buttonFontSize: We.MEDIUM,
      buttonType: ne.OUTLINED,
      type: "button",
      disabled: g === N.UPDATING || d || P
    },
    /* @__PURE__ */ e.createElement(vt, { className: "mr-1" }),
    " DISCARD CHANGES"
  )), /* @__PURE__ */ e.createElement("div", { className: "bg-dark-100 mb-1 rounded-md p-4" }, /* @__PURE__ */ e.createElement("h3", { className: "mt-0 text-[32px] font-medium" }, "Publishing Control"), /* @__PURE__ */ e.createElement(
    j,
    {
      disabled: o.name.trim() === "" || g === N.UPDATING || d || P || B.size > 0,
      isFullWidth: !0,
      buttonFontSize: We.MEDIUM,
      className: "my-6",
      type: "submit"
    },
    t === "CREATE" ? "PUBLISH" : "UPDATE"
  )), /* @__PURE__ */ e.createElement(st, null)))), /* @__PURE__ */ e.createElement(
    Rt,
    {
      visible: c,
      onClose: () => i(!1),
      onSubmit: Y
    }
  ), /* @__PURE__ */ e.createElement(ot, { visible: l, onClose: () => m(!1), onSubmit: R }));
}, sn = () => {
  const { state: n } = ee();
  return /* @__PURE__ */ e.createElement("div", { className: "container mx-auto px-2" }, /* @__PURE__ */ e.createElement(he, { className: "mb-6 flex items-center py-8" }, /* @__PURE__ */ e.createElement(I, { to: n.support.index.link }, /* @__PURE__ */ e.createElement(y, { i18nKey: "Navigation.links.support.title" }, "Support")), /* @__PURE__ */ e.createElement(I, { to: n.support.manage.topic.index.link }, /* @__PURE__ */ e.createElement(y, { i18nKey: "Navigation.links.support.admin" }, "Manage Contents")), /* @__PURE__ */ e.createElement(y, { i18nKey: "Navigation.links.support.content.topics.create" }, "Create New Topic")), /* @__PURE__ */ e.createElement("h1", { className: "mb-4 text-3xl font-semibold" }, /* @__PURE__ */ e.createElement(y, { i18nKey: "Navigation.links.support.content.topics.create" }, "Create New Topic")), /* @__PURE__ */ e.createElement(Xt, { action: mt.CREATE }));
};
function gs() {
  return /* @__PURE__ */ e.createElement("div", { className: "px-6 py-2" }, /* @__PURE__ */ e.createElement(sn, null));
}
const rn = ({ slug: n }) => {
  const { state: t } = ee(), {
    state: { topicDetail: a, topicDetailError: s, topicDetailFetchStatus: o },
    mutations: { fetchTopicBySlug: r }
  } = Ce.useTopicDetail();
  W(() => {
    r(n);
  }, []);
  const c = o === N.FETCHING;
  return /* @__PURE__ */ e.createElement("div", { className: "container mx-auto px-2" }, /* @__PURE__ */ e.createElement(he, { className: "mb-6 flex items-center py-8" }, /* @__PURE__ */ e.createElement(I, { to: t.support.index.link }, /* @__PURE__ */ e.createElement(y, { i18nKey: "Navigation.links.support.title" }, "Support")), /* @__PURE__ */ e.createElement(I, { to: t.support.manage.topic.index.link }, /* @__PURE__ */ e.createElement(y, { i18nKey: "Navigation.links.support.admin" }, "Manage Contents")), /* @__PURE__ */ e.createElement(y, { i18nKey: "Navigation.links.support.content.topics.edit" }, "Edit Topic")), /* @__PURE__ */ e.createElement("h1", { className: "mb-4 text-3xl font-semibold" }, /* @__PURE__ */ e.createElement(y, { i18nKey: "Navigation.links.support.content.topics.edit" }, "Edit Topic")), c && /* @__PURE__ */ e.createElement(ct, { className: it.tall }), !c && a && /* @__PURE__ */ e.createElement(Xt, { action: mt.EDIT, topic: a }), !c && s && /* @__PURE__ */ e.createElement(Gt, { error: s }));
};
function hs({ slug: n }) {
  return /* @__PURE__ */ e.createElement("div", { className: "px-6 py-2" }, /* @__PURE__ */ e.createElement(rn, { slug: n }));
}
const on = ({ children: n }) => {
  const {
    state: { user: t, userFetchStatus: a }
  } = Ft(), { state: s } = ve(), [o] = me();
  return W(() => {
    if (!t && a !== N.FETCHING) {
      const r = new sa(o).createLoginURL(s.location.pathname);
      window.location.replace(r);
    }
  }, [s.location.pathname]), /* @__PURE__ */ e.createElement(e.Fragment, null, a !== N.FETCHING && !t && /* @__PURE__ */ e.createElement(da, null), t && n);
};
function fs({ children: n }) {
  return /* @__PURE__ */ e.createElement(on, null, n);
}
const pt = "ADMIN:NAMESPACE:{namespace}:CONTENTMANAGEMENT", cn = {
  resource: `${pt}:SUPPORT`,
  action: rt.UPDATE
}, ln = {
  resource: `${pt}:SUPPORT`,
  action: rt.CREATE
};
`${pt}`, rt.DELETE;
class mn {
}
mn.checkSupportAdminPermission = async (n, t) => {
  try {
    const a = {
      config: {
        headers: {
          Authorization: `Bearer ${t}`
        }
      }
    }, s = t ? await Je(n, a).getCurrentUserRole() : await Je(n).getCurrentUserRole(), o = new ea({ user: s, currentNamespace: ta.NAMESPACE });
    return o.hasPermission(cn) && o.hasPermission(ln);
  } catch {
    return !1;
  }
};
const Ts = async ({
  sdk: n,
  queryParams: t
}) => await q.ArticlesApi(n).getPublicArticles({ ...t }), Ns = async ({
  sdk: n,
  queryParams: t
}) => await q.ArticlesApi(n).getPublicArticleBySlug({ ...t }), ys = async ({
  sdk: n,
  queryParams: t
}) => await q.TopicsApi(n).getPublicTopics({ ...t }), bs = async ({ sdk: n, slug: t }) => await q.TopicsApi(n).getPublicTopicBySlug(t);
export {
  ke as Article,
  ls as ArticleDetailPageWidget,
  Va as ArticleDetailSkeleton,
  ps as ArticleListPageWidget,
  xa as ArticlesApi,
  is as ArticlesPageWidget,
  us as CreateArticlePageWidget,
  gs as CreateTopicPageWidget,
  ds as EditArticlePageWidget,
  hs as EditTopicPageWidget,
  fs as ManageContentPageWidget,
  mn as PermissionUtils,
  ms as SupportCTAWidget,
  cs as SupportPageWidget,
  Ba as SupportTopicCardSkeleton,
  Ne as Topic,
  Es as TopicListWidget,
  Ue as TopicsApi,
  Ns as supportPublicArticleBySlugFetcher,
  Ts as supportPublicArticlesFetcher,
  bs as supportPublicTopicBySlugFetcher,
  ys as supportPublicTopicsFetcher
};
