import { jsx as i, jsxs as a, Fragment as Me } from "react/jsx-runtime";
import O, { memo as Re, forwardRef as me, useRef as Q, useEffect as te, useState as B } from "react";
import H from "prop-types";
import { useForm as Ve, Controller as y } from "react-hook-form";
import { yupResolver as Oe } from "@hookform/resolvers/yup";
import d from "@mui/material/Grid2";
import * as F from "yup";
import { useTheme as Ae, Modal as Le, Typography as h, IconButton as Ue, Box as C, FormControl as N, Select as L, MenuItem as T, FormControlLabel as U, Checkbox as W, TextField as G, Stack as We, Button as ce } from "@mui/material";
import Z from "@/views/custom-components/CustomTextArea";
import M from "@/views/custom-components/CustomTextField";
import { retrieveAllConfigured as De, execute as de, getNotificationTypeList as Ke } from "@/common/services/GlobalApis";
import { showToast as je } from "@/common/toaster/toaster";
import qe from "@/hooks/useTrackEvent";
import "./ManageEventConfiguration-0YBDaxOI.js";
import { useTranslateProvider as Ye } from "@/common/languageTranslator/TranslationContext";
import { faXmark as Je } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon as Be } from "@fortawesome/react-fontawesome";
import He from "@/views/custom-components/CkEditor/CkEditor";
function Qe() {
  const o = {
    resolve: null,
    promise: null
  };
  return o.promise = new Promise((r) => {
    o.resolve = r;
  }), o;
}
function Xe(o) {
  let r = null;
  return (...l) => (r || (r = {
    current: o(...l)
  }), r.current);
}
const I = new Array(256).fill("").map((o, r) => ("0" + r.toString(16)).slice(-2));
function Ge() {
  const [o, r, l, e] = crypto.getRandomValues(new Uint32Array(4));
  return "e" + I[o >> 0 & 255] + I[o >> 8 & 255] + I[o >> 16 & 255] + I[o >> 24 & 255] + I[r >> 0 & 255] + I[r >> 8 & 255] + I[r >> 16 & 255] + I[r >> 24 & 255] + I[l >> 0 & 255] + I[l >> 8 & 255] + I[l >> 16 & 255] + I[l >> 24 & 255] + I[e >> 0 & 255] + I[e >> 8 & 255] + I[e >> 16 & 255] + I[e >> 24 & 255];
}
function he(o) {
  return !!o && /^\d+\.\d+\.\d+/.test(o);
}
function Ze(o) {
  if (!he(o))
    throw new Error(`Invalid semantic version: ${o || "<blank>"}.`);
  const [r, l, e] = o.split(".");
  return {
    major: Number.parseInt(r, 10),
    minor: Number.parseInt(l, 10),
    patch: Number.parseInt(e, 10)
  };
}
function fe(o) {
  return o ? ["nightly", "alpha", "internal", "nightly-", "staging"].some((r) => o.includes(r)) : !1;
}
function et(o) {
  return he(o) || fe(o);
}
function tt(o, r) {
  const l = o.extraPlugins || [];
  return {
    ...o,
    extraPlugins: [
      ...l,
      ...r.filter((e) => !l.includes(e))
    ]
  };
}
function it(o) {
  if (fe(o))
    return 3;
  const { major: r } = Ze(o);
  switch (!0) {
    case r >= 44:
      return 3;
    case r >= 38:
      return 2;
    default:
      return 1;
  }
}
function nt() {
  const { CKEDITOR_VERSION: o, CKEDITOR: r } = window;
  return et(o) ? {
    source: r ? "cdn" : "npm",
    version: o
  } : null;
}
function rt() {
  const o = nt();
  return o ? it(o.version) : null;
}
function ge(o, r) {
  switch (r || (r = rt() || void 0), r) {
    case 1:
    case 2:
      return o === void 0;
    case 3:
      return o === "GPL";
    default:
      return !1;
  }
}
function ot(o, r) {
  return function(e) {
    ge(e.config.get("licenseKey")) || e.on("collectUsageData", (u, { setUsageData: b }) => {
      b(`integration.${o}`, r);
    });
  };
}
var lt = Object.defineProperty, at = (o, r, l) => r in o ? lt(o, r, { enumerable: !0, configurable: !0, writable: !0, value: l }) : o[r] = l, S = (o, r, l) => at(o, typeof r != "symbol" ? r + "" : r, l);
/**
 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
 */
const Ne = class ve {
  constructor(r, l) {
    S(this, "_lifecycle"), S(this, "_element"), S(this, "_releaseLock", null), S(this, "_value", null), S(this, "_afterMountCallbacks", []), S(this, "_state", {
      destroyedBeforeInitialization: !1,
      mountingInProgress: null
    }), S(this, "release", Xe(() => {
      const { _releaseLock: e, _state: u, _element: b, _lifecycle: g } = this;
      u.mountingInProgress ? u.mountingInProgress.then(() => g.unmount({
        element: b,
        // Mount result might be overridden by watchdog during restart so use instance variable.
        mountResult: this.value
      })).catch((E) => {
        console.error("Semaphore unmounting error:", E);
      }).then(e.resolve).then(() => {
        this._value = null;
      }) : (u.destroyedBeforeInitialization = !0, e.resolve());
    })), this._element = r, this._lifecycle = l, this._lock();
  }
  /**
   * Getter for {@link #_value}.
   */
  get value() {
    return this._value;
  }
  /**
   * Occasionally, the Watchdog restarts the editor instance, resulting in a new instance being assigned to the semaphore.
   * In terms of race conditions, it's generally safer to simply override the semaphore value rather than recreating it
   * with a different one.
   */
  unsafeSetValue(r) {
    this._value = r, this._afterMountCallbacks.forEach((l) => l(r)), this._afterMountCallbacks = [];
  }
  /**
   * This registers a callback that will be triggered after the editor has been successfully mounted.
   *
   * 	* If the editor is already mounted, the callback will be executed immediately.
   *	* If the editor is in the process of mounting, the callback will be executed upon successful mounting.
  * 	* If the editor is never mounted, the passed callback will not be executed.
  * 	* If an exception is thrown within the callback, it will be re-thrown in the semaphore.
  */
  runAfterMount(r) {
    const { _value: l, _afterMountCallbacks: e } = this;
    l ? r(l) : e.push(r);
  }
  /**
   * This method is used to inform other components that the {@link #_element} will be used by the editor,
   * which is initialized by the {@link #_lifecycle} methods.
   *
   * 	* If an editor is already present on the provided element, the initialization of the current one
   * 	  will be postponed until the previous one is destroyed.
   *
   * 	* If the element is empty and does not have an editor attached to it, the currently locked editor will
   * 	  be mounted immediately.
   *
   * After the successful initialization of the editor and the assignment of the {@link #_value} member,
   * the `onReady` lifecycle method is called.
   *
   * *Important note:*
   *
   * It’s really important to keep this method *sync*. If we make this method *async*, it won’t work well because
   * it will cause problems when we’re trying to set up the {@link LifeCycleEditorElementSemaphore#_semaphores} map entries.
   */
  _lock() {
    const { _semaphores: r } = ve, { _state: l, _element: e, _lifecycle: u } = this, b = r.get(e) || Promise.resolve(null), g = Qe();
    this._releaseLock = g;
    const E = b.then(() => l.destroyedBeforeInitialization ? Promise.resolve(void 0) : (l.mountingInProgress = u.mount().then((_) => (_ && this.unsafeSetValue(_), _)), l.mountingInProgress)).then(async (_) => {
      _ && u.afterMount && await u.afterMount({
        element: e,
        mountResult: _
      });
    }).then(() => g.promise).catch((_) => {
      console.error("Semaphore mounting error:", _);
    }).then(() => {
      r.get(e) === E && r.delete(e);
    });
    r.set(e, E);
  }
};
S(Ne, "_semaphores", /* @__PURE__ */ new Map());
let st = Ne;
/**
 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
 */
const ct = "$__CKEditorReactContextMetadata";
function dt(o, r) {
  return {
    ...r,
    [ct]: o
  };
}
/**
 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
 */
const ut = O.createContext(null), mt = (o) => !!o && typeof o == "object" && "status" in o && ["initializing", "initialized", "error"].includes(o.status), pe = (o) => (r) => mt(r) && r.status === o, ue = pe("initializing"), ht = (o) => pe("initialized")(o) && o.watchdog.state === "ready";
/**
 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
 */
const ft = ot(
  "react",
  {
    version: "9.5.0",
    frameworkVersion: O.version
  }
);
/**
 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
 */
function gt(o) {
  return ge(o.licenseKey) ? o : tt(o, [
    /**
     * This part of the code is not executed in open-source implementations using a GPL key.
     * It only runs when a specific license key is provided. If you are uncertain whether
     * this applies to your installation, please contact our support team.
     */
    ft
  ]);
}
/**
 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
 */
const ee = "Lock from React integration (@ckeditor/ckeditor5-react)";
class be extends O.Component {
  constructor(r) {
    super(r), S(this, "domContainer", O.createRef()), S(this, "editorSemaphore", null), this._checkVersion();
  }
  /**
   * Checks if the CKEditor version used in the application is compatible with the component.
   */
  _checkVersion() {
    const { CKEDITOR_VERSION: r } = window;
    if (!r)
      return console.warn('Cannot find the "CKEDITOR_VERSION" in the "window" scope.');
    const [l] = r.split(".").map(Number);
    l >= 42 || r.startsWith("0.0.0") || console.warn("The <CKEditor> component requires using CKEditor 5 in version 42+ or nightly build.");
  }
  get _semaphoreValue() {
    const { editorSemaphore: r } = this;
    return r ? r.value : null;
  }
  /**
   * An watchdog instance.
   */
  get watchdog() {
    const { _semaphoreValue: r } = this;
    return r ? r.watchdog : null;
  }
  /**
   * An editor instance.
   */
  get editor() {
    const { _semaphoreValue: r } = this;
    return r ? r.instance : null;
  }
  /**
   * The CKEditor component should not be updated by React itself.
   * However, if the component identifier changes, the whole structure should be created once again.
   */
  shouldComponentUpdate(r) {
    const { props: l, editorSemaphore: e } = this;
    return r.id !== l.id || r.disableWatchdog !== l.disableWatchdog ? !0 : (e && (e.runAfterMount(({ instance: u }) => {
      this._shouldUpdateEditorData(l, r, u) && u.data.set(r.data);
    }), "disabled" in r && e.runAfterMount(({ instance: u }) => {
      r.disabled ? u.enableReadOnlyMode(ee) : u.disableReadOnlyMode(ee);
    })), !1);
  }
  /**
   * Initialize the editor when the component is mounted.
   */
  componentDidMount() {
    ue(this.context) || this._initLifeCycleSemaphore();
  }
  /**
   * Re-render the entire component once again. The old editor will be destroyed and the new one will be created.
   */
  componentDidUpdate() {
    ue(this.context) || this._initLifeCycleSemaphore();
  }
  /**
   * Destroy the editor before unmounting the component.
   */
  componentWillUnmount() {
    this._unlockLifeCycleSemaphore();
  }
  /**
   * Async destroy attached editor and unlock element semaphore.
   */
  _unlockLifeCycleSemaphore() {
    this.editorSemaphore && (this.editorSemaphore.release(), this.editorSemaphore = null);
  }
  /**
   * Unlocks previous editor semaphore and creates new one..
   */
  _initLifeCycleSemaphore() {
    this._unlockLifeCycleSemaphore(), this.editorSemaphore = new st(this.domContainer.current, {
      mount: async () => this._initializeEditor(),
      afterMount: ({ mountResult: r }) => {
        const { onReady: l } = this.props;
        l && this.domContainer.current !== null && l(r.instance);
      },
      unmount: async ({ element: r, mountResult: l }) => {
        const { onAfterDestroy: e } = this.props;
        try {
          await this._destroyEditor(l), r.innerHTML = "";
        } finally {
          e && e(l.instance);
        }
      }
    });
  }
  /**
   * Render a <div> element which will be replaced by CKEditor.
   */
  render() {
    return /* @__PURE__ */ O.createElement("div", { ref: this.domContainer });
  }
  /**
   * Initializes the editor by creating a proper watchdog and initializing it with the editor's configuration.
   */
  async _initializeEditor() {
    if (this.props.disableWatchdog)
      return {
        instance: await this._createEditor(this.domContainer.current, this._getConfig()),
        watchdog: null
      };
    const r = ht(this.context) ? new Nt(this.context.watchdog) : new this.props.editor.EditorWatchdog(this.props.editor, this.props.watchdogConfig), l = {
      current: 0
    };
    return r.setCreator(async (e, u) => {
      var b;
      const { editorSemaphore: g } = this, { onAfterDestroy: E } = this.props;
      l.current > 0 && E && ((b = g == null ? void 0 : g.value) != null && b.instance) && E(g.value.instance);
      const _ = await this._createEditor(e, u);
      return g && l.current > 0 && (g.unsafeSetValue({
        instance: _,
        watchdog: r
      }), setTimeout(() => {
        this.props.onReady && this.props.onReady(r.editor);
      })), l.current++, _;
    }), r.on("error", (e, { error: u, causesRestart: b }) => {
      (this.props.onError || console.error)(u, { phase: "runtime", willEditorRestart: b });
    }), await r.create(this.domContainer.current, this._getConfig()).catch((e) => {
      (this.props.onError || console.error)(e, { phase: "initialization", willEditorRestart: !1 });
    }), {
      watchdog: r,
      instance: r.editor
    };
  }
  /**
   * Creates an editor from the element and configuration.
   *
   * @param element The source element.
   * @param config CKEditor 5 editor configuration.
   */
  _createEditor(r, l) {
    const { contextItemMetadata: e } = this.props;
    return e && (l = dt(e, l)), this.props.editor.create(
      r,
      gt(l)
    ).then((u) => {
      if ("disabled" in this.props) {
        /* istanbul ignore else -- @preserve */
        this.props.disabled && u.enableReadOnlyMode(ee);
      }
      const b = u.model.document, g = u.editing.view.document;
      return b.on("change:data", (E) => {
        /* istanbul ignore else -- @preserve */
        this.props.onChange && this.props.onChange(E, u);
      }), g.on("focus", (E) => {
        /* istanbul ignore else -- @preserve */
        this.props.onFocus && this.props.onFocus(E, u);
      }), g.on("blur", (E) => {
        /* istanbul ignore else -- @preserve */
        this.props.onBlur && this.props.onBlur(E, u);
      }), u;
    });
  }
  /**
   * Destroys the editor by destroying the watchdog.
   */
  async _destroyEditor(r) {
    const { watchdog: l, instance: e } = r;
    return new Promise((u, b) => {
      /* istanbul ignore next -- @preserve */
      setTimeout(async () => {
        try {
          if (l)
            return await l.destroy(), u();
          if (e)
            return await e.destroy(), u();
          u();
        } catch (g) {
          console.error(g), b(g);
        }
      });
    });
  }
  /**
   * Returns true when the editor should be updated.
   *
   * @param prevProps Previous react's properties.
   * @param nextProps React's properties.
   * @param editor Current editor instance.
   */
  _shouldUpdateEditorData(r, l, e) {
    return !(r.data === l.data || e.data.get() === l.data);
  }
  /**
   * Returns the editor configuration.
   */
  _getConfig() {
    const r = this.props.config || {};
    return this.props.data && r.initialData && console.warn(
      "Editor data should be provided either using `config.initialData` or `content` property. The config value takes precedence over `content` property and will be used when both are specified."
    ), {
      ...r,
      initialData: r.initialData || this.props.data || ""
    };
  }
}
S(be, "contextType", ut);
class Nt {
  /**
   * @param contextWatchdog The context watchdog instance that will be wrapped into editor watchdog API.
   */
  constructor(r) {
    S(this, "_contextWatchdog"), S(this, "_id"), S(this, "_creator"), this._contextWatchdog = r, this._id = Ge();
  }
  /**
   *  @param creator A watchdog's editor creator function.
   */
  setCreator(r) {
    this._creator = r;
  }
  /**
   * Adds an editor configuration to the context watchdog registry. Creates an instance of it.
   *
   * @param sourceElementOrData A source element or data for the new editor.
   * @param config CKEditor 5 editor config.
   */
  create(r, l) {
    return this._contextWatchdog.add({
      sourceElementOrData: r,
      config: l,
      creator: this._creator,
      id: this._id,
      type: "editor"
    });
  }
  /**
   * Creates a listener that is attached to context watchdog's item and run when the context watchdog fires.
   * Currently works only for the `error` event.
   */
  on(r, l) {
    this._contextWatchdog.on("itemError", (e, { itemId: u, error: b }) => {
      u === this._id && l(null, { error: b, causesRestart: void 0 });
    });
  }
  destroy() {
    return this._contextWatchdog.state === "ready" ? this._contextWatchdog.remove(this._id) : Promise.resolve();
  }
  /**
   * An editor instance.
   */
  get editor() {
    return this._contextWatchdog.getItem(this._id);
  }
}
/**
 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
 */
function we(...o) {
  return (r) => {
    o.forEach((l) => {
      typeof l == "function" ? l(r) : l != null && (l.current = r);
    });
  };
}
const vt = Re(me(({ id: o, semaphore: r, rootName: l }, e) => {
  const u = Q(null);
  return te(() => {
    let b, g;
    return r.runAfterMount(({ instance: E }) => {
      if (!u.current)
        return;
      g = E;
      const { ui: _, model: R } = g, D = R.document.getRoot(l);
      D && g.ui.getEditableElement(l) && g.detachEditable(D), b = _.view.createEditable(l, u.current), _.addEditable(b), E.editing.view.forceRender();
    }), () => {
      if (g && g.state !== "destroyed" && u.current) {
        const E = g.model.document.getRoot(l);
        /* istanbul ignore else -- @preserve */
        E && g.detachEditable(E);
      }
    };
  }, [r.revision]), /* @__PURE__ */ O.createElement(
    "div",
    {
      key: r.revision,
      id: o,
      ref: we(e, u)
    }
  );
}));
vt.displayName = "EditorEditable";
const pt = me(({ editor: o }, r) => {
  const l = Q(null);
  return te(() => {
    const e = l.current;
    if (!o || !e)
      return;
    const u = o.ui.view.toolbar.element;
    return e.appendChild(u), () => {
      e.contains(u) && e.removeChild(u);
    };
  }, [o && o.id]), /* @__PURE__ */ O.createElement("div", { ref: we(l, r) });
});
pt.displayName = "EditorToolbarWrapper";
const bt = ({
  open: o,
  handleClose: r,
  handleClick: l,
  type: e
}) => {
  var le, ae, se;
  const u = Ae(), b = u.palette.mode === "dark", g = Q(null), E = Q(!1), _ = qe(), [R, D] = B([]), [K, Ce] = B([]), [j, Ee] = B([]), { translate: c } = Ye(), [q, xe] = B([]), _e = F.object().shape({
    excetionTypes: F.string().test(
      "is-required",
      "Execution type is required",
      function(t) {
        return (e == null ? void 0 : e.type) === "EXCEPTION" ? !!t : !0;
      }
    ),
    mobileNumberFieldName: F.string().test(
      "is-required",
      "Enter Sms contact number field name",
      function(t) {
        return (e == null ? void 0 : e.type) === "SMS" ? !!t : !0;
      }
    ),
    smsTypeField: F.string().test(
      "is-required",
      "Enter Sms Type Field",
      function(t) {
        return (e == null ? void 0 : e.type) === "SMS" ? !!t : !0;
      }
    ),
    trigerWhen: F.string().test(
      "is-required",
      "trigerWhen is required",
      function(t) {
        return (e == null ? void 0 : e.type) != "EXCEPTION" && (e == null ? void 0 : e.type) != "SYSTEM_FUNCTION" ? !!t : !0;
      }
    ),
    baseDateFieldName: F.string().test(
      "is-required",
      "Enter Email Id field name",
      function(t) {
        return (e == null ? void 0 : e.type) === "EMAIL" ? !!t : !0;
      }
    ),
    emailSubject: F.string().test(
      "is-required",
      "Enter email subject",
      function(t) {
        return (e == null ? void 0 : e.type) === "EMAIL" ? !!t : !0;
      }
    ),
    notificationTypeId: F.string().test(
      "is-required",
      "Select type",
      function(t) {
        return (e == null ? void 0 : e.type) === "PUSH_NOTIFICATION" ? !!t : !0;
      }
    ),
    userFieldName: F.string().test(
      "is-required",
      "Enter User Id field name",
      function(t) {
        return (e == null ? void 0 : e.type) === "PUSH_NOTIFICATION" ? !!t : !0;
      }
    ),
    heading: F.string().test(
      "is-required",
      "Enter heading",
      function(t) {
        return (e == null ? void 0 : e.type) === "PUSH_NOTIFICATION" && X ? !!t : !0;
      }
    ),
    template: F.string().test(
      "is-required",
      "Enter Template",
      function(t) {
        return (e == null ? void 0 : e.type) === "PUSH_NOTIFICATION" && X ? !!t : !0;
      }
    )
  }), {
    control: v,
    handleSubmit: Ie,
    reset: Y,
    setValue: p,
    unregister: ie,
    getValues: ne,
    watch: V,
    formState: { errors: f }
  } = Ve({
    defaultValues: {},
    resolver: Oe(_e),
    mode: "onChange"
  });
  te(() => {
    var t;
    e && (Pe(), (t = Object.keys(e)) == null || t.forEach((n) => {
      var s, m, w;
      if (n === "index" && p(n, e[n]), n === "smsConfigJson" && e[n]) {
        const x = e[n];
        (s = Object.keys(x)) == null || s.forEach((P) => {
          p(P, x[P]);
        });
      } else if (n === "pushNotificationConfigJson" && e[n]) {
        const x = e[n];
        (m = Object.keys(x)) == null || m.forEach((P) => {
          p(P, x[P]);
        });
      } else if (n === "kafkaConfigJson" && e[n]) {
        const x = e[n];
        (w = Object.keys(x)) == null || w.forEach((P) => {
          p(P, x[P]);
        });
      } else e[n] !== void 0 && e[n] !== null && p(n, e[n]);
    }));
  }, [e]);
  const k = V("queryMasterParamJson"), re = V("queryCode"), Te = V("systemFunctionId"), $ = V("functionParams"), ye = V("trigerWhen"), X = V("notificationTypeId"), z = V("kafkaParameterJson"), oe = V("formType"), Se = async (t) => {
    var m;
    k && k.forEach((w, x) => {
      p(`${w.parameterName}${x}`, ""), p(`${w.parameterName}${x}isFixed`, !1);
    });
    let n = [];
    const s = R == null ? void 0 : R.find((w) => (w == null ? void 0 : w.code) === t);
    if (s) {
      const w = (m = s == null ? void 0 : s.params) == null ? void 0 : m.split(",");
      Array.from(new Set(w)).forEach((P) => {
        n.push({ parameterName: P });
      });
    }
    p("queryMasterParamJson", n);
  }, Fe = (t) => {
    $ && $.forEach((m, w) => {
      p(`${m.parameterName}${w}`, ""), p(`${m.parameterName}${w}isFixed`, !1);
    });
    let n = [];
    const s = K.find((m) => m.id === t);
    s && Array.from(new Set(s.parameters)).forEach((w) => {
      n.push(w);
    }), p("functionParams", n);
  }, ke = (t) => {
    const n = q.find(
      (s) => s.id === t
    );
    n && (p("notificationType", n), p("template", n.message), p("heading", n.heading));
  }, A = (t, n, s) => {
    if ((e == null ? void 0 : e.type) === "QUERY") {
      const m = [...k];
      m[t][n] = s, p("queryMasterParamJson", m);
    }
    if ((e == null ? void 0 : e.type) === "SYSTEM_FUNCTION") {
      const m = [...$];
      m[t][n] = s, p("functionParams", m);
    }
    if ((e == null ? void 0 : e.type) === "KAFKA_SYNC") {
      const m = [...z];
      m[t][n] = s, p("kafkaParameterJson", m);
    }
  }, $e = (t) => {
    const n = ne("kafkaParameterJson");
    n && Array.isArray(n) && (n.forEach((m, w) => {
      ie(`${m.parameterName}${w}`), ie(`${m.parameterName}${w}isFixed`);
    }), p("kafkaParameterJson", [], { shouldValidate: !0 }));
    const s = j.find(
      (m) => m.form_type === t
    );
    if (s && s.param_types) {
      const m = JSON.parse(s.param_types), w = Object.keys(m).map((x) => ({
        parameterName: x,
        mappingValue: "",
        isFixed: !1
      }));
      p("kafkaParameterJson", w, { shouldValidate: !0 });
    } else
      p("kafkaParameterJson", [], { shouldValidate: !0 });
  }, Pe = async () => {
    var t, n;
    try {
      if ((e == null ? void 0 : e.type) === "QUERY") {
        const s = await De(!0);
        D(s == null ? void 0 : s.data);
      }
      if ((e == null ? void 0 : e.type) === "SYSTEM_FUNCTION") {
        const m = await de({
          code: "system_function_retrieve_all",
          parameters: {}
        }), w = (t = m == null ? void 0 : m.data) == null ? void 0 : t.result.map((x) => (x.parameters = JSON.parse(x.parameters), x));
        Ce(w);
      }
      if ((e == null ? void 0 : e.type) === "PUSH_NOTIFICATION") {
        const s = await Ke();
        xe(s == null ? void 0 : s.data);
      }
      if ((e == null ? void 0 : e.type) === "KAFKA_SYNC") {
        const s = await de({
          code: "retrieve_all_kafka_configs",
          parameters: {}
        });
        Ee(((n = s == null ? void 0 : s.data) == null ? void 0 : n.result) || []);
      }
    } catch {
      je({ message: "Error in loading", type: "error" });
    }
  }, J = () => {
    _("conversion_event", {
      form: g.current,
      form_name: "Add Other Type Configuration",
      submit: E.current
    }), r();
  }, ze = (t) => {
    t = JSON.parse(JSON.stringify(t)), t.minute = Number(t.minute || 0), t.type = e == null ? void 0 : e.type, e.type === "SMS" && (t.smsConfigJson = {
      mobileNumberFieldName: t.mobileNumberFieldName,
      isPriority: t.isPriority,
      isSmsTypeFixed: t.isSmsTypeFixed,
      smsTypeField: t.smsTypeField
    }, delete t.mobileNumberFieldName, delete t.isPriority, delete t.isSmsTypeFixed, delete t.smsTypeField), e.type === "PUSH_NOTIFICATION" && (t.pushNotificationConfigJson = {
      notificationTypeId: t.notificationTypeId,
      userFieldName: t.userFieldName,
      heading: t.heading,
      template: t.template
    }, delete t.notificationTypeId, delete t.userFieldName, delete t.heading, delete t.template), e.type === "KAFKA_SYNC" && (t.kafkaConfigJson = {
      formType: t.formType,
      kafkaParameterJson: t.kafkaParameterJson
    }), k == null || k.forEach((n, s) => {
      delete t[`${n == null ? void 0 : n.parameterName}${s}`], delete t[`${n == null ? void 0 : n.parameterName}${s}isFixed`];
    }), $ == null || $.forEach((n, s) => {
      delete t[`${n == null ? void 0 : n.parameterName}${s}`], delete t[`${n == null ? void 0 : n.parameterName}${s}isFixed`];
    }), z == null || z.forEach((n, s) => {
      delete t[`${n == null ? void 0 : n.parameterName}${s}`], delete t[`${n == null ? void 0 : n.parameterName}${s}isFixed`];
    }), l(t), E.current = !0, J(), Y();
  };
  return /* @__PURE__ */ i(
    Le,
    {
      "data-testid": "othertypeeventconfigmodal-modal",
      open: o,
      className: "flex items-center justify-center",
      onClose: () => {
        J(), Y();
      },
      sx: {
        "& .MuiBackdrop-root": {
          backgroundColor: "rgba(0, 0, 0, 0.1)"
        }
      },
      children: /* @__PURE__ */ a(
        d,
        {
          container: !0,
          className: "w-[90%] md:w-[80%] flex flex-col",
          sx: {
            // 1. Theme-aware background
            backgroundColor: (t) => t.palette.background.paper,
            // 2. Dynamic Border/Shadow for Dark Mode
            border: (t) => t.palette.mode === "dark" ? `1px solid ${t.palette.divider}` : "none",
            // 3. GitHub-style shadow (Soft in light, Deep in dark)
            boxShadow: (t) => t.palette.mode === "dark" ? "0 8px 24px rgba(0,0,0,0.4)" : t.shadows[2],
            // Standard MUI shadow for light mode
            borderRadius: "12px",
            // Matches your MuiCard configuration
            transition: "all 0.3s ease-in-out"
            // Keeps children inside the rounded corners
          },
          children: [
            /* @__PURE__ */ a(
              d,
              {
                className: "manageeventconfiguration-modal-header p-2.5 px-5 flex border-b",
                "data-testid": "othertypeeventconfigmodal-modal-header",
                children: [
                  /* @__PURE__ */ a(
                    h,
                    {
                      variant: "body1",
                      className: "font-medium text-lg text-customBlue",
                      children: [
                        c("Add"),
                        " ",
                        c(e == null ? void 0 : e.type),
                        " ",
                        c("Configuration")
                      ]
                    }
                  ),
                  /* @__PURE__ */ i(
                    Ue,
                    {
                      size: "small",
                      onClick: () => {
                        J(), Y();
                      },
                      "data-testid": "othertypeeventconfigmodal-close-button",
                      children: /* @__PURE__ */ i(Be, { icon: Je })
                    }
                  )
                ]
              }
            ),
            /* @__PURE__ */ a(
              "form",
              {
                onSubmit: Ie(ze),
                ref: g,
                "data-testid": "othertypeeventconfigmodal-form",
                children: [
                  /* @__PURE__ */ a(d, { container: !0, className: "  max-h-[60vh] overflow-y-auto w-full", children: [
                    /* @__PURE__ */ i(
                      d,
                      {
                        item: !0,
                        className: "border-b border-gray-300 p-2.5 flex flex-col items-start",
                        size: { xs: 12 },
                        children: /* @__PURE__ */ i(C, { className: "whitespace-normal w-full break-all  p-2.5 flex flex-col items-start", children: /* @__PURE__ */ a(h, { variant: "body2", className: "font-bold", children: [
                          c("Available Implicit Parameters"),
                          ":",
                          " ",
                          e == null ? void 0 : e.implicitParam,
                          " "
                        ] }) })
                      }
                    ),
                    /* @__PURE__ */ a(d, { item: !0, className: "p-2.5 w-full", children: [
                      (e == null ? void 0 : e.type) === "EXCEPTION" && /* @__PURE__ */ a(d, { container: !0, spacing: 2, children: [
                        /* @__PURE__ */ i(d, { item: !0, size: { xs: 12 }, className: " w-full", children: /* @__PURE__ */ a(
                          N,
                          {
                            variant: "outlined",
                            className: " w-full",
                            "data-testid": "othertypeeventconfigmodal-exceptionType",
                            children: [
                              /* @__PURE__ */ a(h, { variant: "body2", children: [
                                c("Exception"),
                                " ",
                                c("Type"),
                                /* @__PURE__ */ i("span", { style: { color: "red", marginLeft: 4 }, children: "*" })
                              ] }),
                              /* @__PURE__ */ a(C, { className: " w-full", children: [
                                /* @__PURE__ */ i(
                                  y,
                                  {
                                    name: "excetionTypes",
                                    control: v,
                                    defaultValue: "",
                                    className: " w-full",
                                    render: ({ field: t }) => /* @__PURE__ */ a(
                                      L,
                                      {
                                        className: " w-full",
                                        ...t,
                                        error: f.excetionTypes,
                                        size: "small",
                                        "data-testid": "othertypeeventconfigmodal-excetionTypes-select",
                                        children: [
                                          /* @__PURE__ */ i(T, { value: "", children: /* @__PURE__ */ i(h, { variant: "body2", children: c("Select") }) }),
                                          /* @__PURE__ */ i(T, { value: "ImtechoUserException", children: /* @__PURE__ */ i(h, { variant: "body2", children: c("Imtecho User Exception") }) }),
                                          /* @__PURE__ */ i(T, { value: "ImtechoSystemException", children: /* @__PURE__ */ a(h, { variant: "body2", children: [
                                            " ",
                                            c("Imtecho System Exception")
                                          ] }) }),
                                          /* @__PURE__ */ i(T, { value: "ImtechoMobileException", children: /* @__PURE__ */ i(h, { variant: "body2", children: c("Imtecho Mobile Exception") }) })
                                        ]
                                      }
                                    )
                                  }
                                ),
                                (f == null ? void 0 : f.excetionTypes) && /* @__PURE__ */ i(
                                  "p",
                                  {
                                    className: "error-helper",
                                    "data-testid": "custom-error-message",
                                    children: (le = f == null ? void 0 : f.excetionTypes) == null ? void 0 : le.message
                                  }
                                )
                              ] })
                            ]
                          }
                        ) }),
                        /* @__PURE__ */ a(d, { item: !0, size: { xs: 12 }, className: " w-full", children: [
                          " ",
                          /* @__PURE__ */ a(
                            N,
                            {
                              variant: "outlined",
                              className: " w-full",
                              "data-testid": "othertypeeventconfigmodal-exceptionMessage",
                              children: [
                                /* @__PURE__ */ i(h, { variant: "body2", children: c("Message") }),
                                /* @__PURE__ */ i(C, { className: " w-full", children: /* @__PURE__ */ i(
                                  Z,
                                  {
                                    control: v,
                                    id: "exceptionMessage",
                                    name: "exceptionMessage",
                                    errors: f,
                                    label: "",
                                    minRows: 5,
                                    "data-testid": "othertypeeventconfigmodal-exceptionMessage-customtextarea"
                                  }
                                ) })
                              ]
                            }
                          )
                        ] })
                      ] }),
                      (e == null ? void 0 : e.type) === "SMS" && /* @__PURE__ */ a(d, { container: !0, spacing: 2, children: [
                        /* @__PURE__ */ i(d, { item: !0, size: { xs: 12 }, className: " w-full", children: /* @__PURE__ */ a(
                          N,
                          {
                            variant: "outlined",
                            className: " w-full",
                            "data-testid": "othertypeeventconfigmodal-mobileNumberFieldName",
                            children: [
                              /* @__PURE__ */ a(h, { variant: "body2", children: [
                                c("SMS"),
                                " ",
                                c("Phone number"),
                                " ",
                                c("Field"),
                                " ",
                                c("Name"),
                                /* @__PURE__ */ i("span", { style: { color: "red", marginLeft: 4 }, children: "*" })
                              ] }),
                              /* @__PURE__ */ i(C, { className: " w-full", children: /* @__PURE__ */ i(
                                M,
                                {
                                  control: v,
                                  id: "mobileNumberFieldName",
                                  name: "mobileNumberFieldName",
                                  errors: f,
                                  label: "",
                                  size: "small",
                                  dataTestId: "othertypeeventconfigmodal-mobileNumberFieldName-textfield"
                                }
                              ) })
                            ]
                          }
                        ) }),
                        /* @__PURE__ */ i(d, { item: !0, size: { xs: 12 }, className: " w-full", children: /* @__PURE__ */ a(
                          N,
                          {
                            variant: "outlined",
                            className: " w-full",
                            "data-testid": "othertypeeventconfigmodal-smsTypeField",
                            children: [
                              /* @__PURE__ */ a(
                                d,
                                {
                                  container: !0,
                                  justifyContent: "space-between",
                                  alignItems: "center",
                                  children: [
                                    /* @__PURE__ */ i(d, { item: !0, xs: !0, children: /* @__PURE__ */ a(h, { variant: "body2", children: [
                                      c("SMS"),
                                      " ",
                                      c("Type"),
                                      " ",
                                      c("Field"),
                                      " ",
                                      c("Value"),
                                      /* @__PURE__ */ i("span", { style: { color: "red", marginLeft: 4 }, children: "*" })
                                    ] }) }),
                                    /* @__PURE__ */ a(d, { container: !0, children: [
                                      " ",
                                      /* @__PURE__ */ i(d, { item: !0, children: /* @__PURE__ */ i(N, { component: "fieldset", className: "mr-2", children: /* @__PURE__ */ i(
                                        y,
                                        {
                                          control: v,
                                          name: "isPriority",
                                          defaultValue: !1,
                                          render: ({ field: t }) => /* @__PURE__ */ i(
                                            U,
                                            {
                                              control: /* @__PURE__ */ i(
                                                W,
                                                {
                                                  checked: t.value,
                                                  onChange: (n) => t.onChange(n.target.checked),
                                                  "data-testid": "othertypeeventconfigmodal-isPriority-checkbox"
                                                }
                                              ),
                                              label: "Is Priority"
                                            }
                                          )
                                        }
                                      ) }) }),
                                      /* @__PURE__ */ i(d, { item: !0, children: /* @__PURE__ */ i(N, { component: "fieldset", className: "mr-2", children: /* @__PURE__ */ i(
                                        y,
                                        {
                                          control: v,
                                          name: "isSmsTypeFixed",
                                          defaultValue: !1,
                                          render: ({ field: t }) => /* @__PURE__ */ i(
                                            U,
                                            {
                                              control: /* @__PURE__ */ i(
                                                W,
                                                {
                                                  checked: t.value,
                                                  onChange: (n) => t.onChange(n.target.checked),
                                                  "data-testid": "othertypeeventconfigmodal-isSmsTypeFixed-checkbox"
                                                }
                                              ),
                                              label: c("Is Fixed Value")
                                            }
                                          )
                                        }
                                      ) }) })
                                    ] })
                                  ]
                                }
                              ),
                              /* @__PURE__ */ i(C, { className: " w-full", children: /* @__PURE__ */ i(
                                M,
                                {
                                  control: v,
                                  id: "smsTypeField",
                                  name: "smsTypeField",
                                  errors: f,
                                  label: "",
                                  size: "small",
                                  dataTestId: "othertypeeventconfigmodal-smsTypeField-textfield"
                                }
                              ) })
                            ]
                          }
                        ) })
                      ] }),
                      (e == null ? void 0 : e.type) === "EMAIL" && /* @__PURE__ */ a(d, { container: !0, spacing: 2, className: " w-full", children: [
                        /* @__PURE__ */ i(d, { item: !0, size: { xs: 12 }, className: " w-full", children: /* @__PURE__ */ a(
                          N,
                          {
                            variant: "outlined",
                            className: " w-full",
                            "data-testid": "othertypeeventconfigmodal-emailIdField",
                            children: [
                              /* @__PURE__ */ a(h, { variant: "body2", children: [
                                c("Email"),
                                " ",
                                c("Id"),
                                " ",
                                c("Field"),
                                " ",
                                c("Value"),
                                /* @__PURE__ */ i("span", { style: { color: "red", marginLeft: 4 }, children: "*" })
                              ] }),
                              /* @__PURE__ */ i(C, { className: " w-full", children: /* @__PURE__ */ i(
                                M,
                                {
                                  control: v,
                                  id: "baseDateFieldName",
                                  name: "baseDateFieldName",
                                  errors: f,
                                  label: "",
                                  size: "small",
                                  dataTestId: "othertypeeventconfigmodal-baseDateFieldName-textfield"
                                }
                              ) })
                            ]
                          }
                        ) }),
                        /* @__PURE__ */ i(d, { item: !0, size: { xs: 12 }, className: " w-full", children: /* @__PURE__ */ a(
                          N,
                          {
                            variant: "outlined",
                            className: " w-full",
                            "data-testid": "othertypeeventconfigmodal-emailSubjectField",
                            children: [
                              /* @__PURE__ */ a(h, { variant: "body2", children: [
                                c("Email"),
                                " ",
                                c("Subject"),
                                /* @__PURE__ */ i("span", { style: { color: "red", marginLeft: 4 }, children: "*" })
                              ] }),
                              /* @__PURE__ */ i(C, { className: " w-full", children: /* @__PURE__ */ i(
                                M,
                                {
                                  control: v,
                                  id: "emailSubject",
                                  name: "emailSubject",
                                  errors: f,
                                  label: "",
                                  size: "small",
                                  dataTestId: "othertypeeventconfigmodal-emailSubject-textfield"
                                }
                              ) })
                            ]
                          }
                        ) }),
                        /* @__PURE__ */ i(d, { item: !0, size: { xs: 12 }, className: " w-full", children: /* @__PURE__ */ a(
                          N,
                          {
                            variant: "outlined",
                            className: " w-[95%] md:w-full overflow-auto",
                            "data-testid": "othertypeeventconfigmodal-template",
                            children: [
                              /* @__PURE__ */ i(h, { variant: "body2", children: c("Template") }),
                              /* @__PURE__ */ i(
                                C,
                                {
                                  className: " w-full",
                                  sx: {
                                    borderRadius: "8px",
                                    overflow: "hidden",
                                    border: `1px solid ${u.palette.divider}`,
                                    // This targets the actual writing area
                                    "& .ck-editor__main > .ck-editor__editable": {
                                      backgroundColor: `${u.palette.background.paper} !important`,
                                      color: `${u.palette.text.primary} !important`,
                                      minHeight: "200px",
                                      "&.ck-focused": {
                                        borderColor: `${u.palette.primary.main} !important`
                                      }
                                    },
                                    // This targets the toolbar
                                    "& .ck.ck-toolbar": {
                                      backgroundColor: b ? "#21262D !important" : "#f5f5f5 !important",
                                      borderColor: `${u.palette.divider} !important`
                                    },
                                    // This targets the buttons/icons inside the toolbar
                                    "& .ck.ck-toolbar .ck-button": {
                                      color: `${u.palette.text.primary} !important`,
                                      cursor: "pointer",
                                      "&:hover": {
                                        backgroundColor: b ? "#30363D !important" : "#e0e0e0 !important"
                                      },
                                      "&.ck-on": {
                                        backgroundColor: b ? "#11B66633 !important" : "#d1d1d1 !important",
                                        color: `${u.palette.primary.main} !important`
                                      }
                                    },
                                    // This targets dropdowns and labels
                                    "& .ck.ck-label": {
                                      color: `${u.palette.text.secondary} !important`
                                    }
                                  },
                                  children: /* @__PURE__ */ i(
                                    be,
                                    {
                                      editor: He,
                                      data: ne("template") || "",
                                      config: {
                                        toolbar: [
                                          "heading",
                                          "|",
                                          "bold",
                                          "italic",
                                          "underline",
                                          "|",
                                          "cut",
                                          "copy",
                                          "|",
                                          // Added cut and copy
                                          "bulletedList",
                                          "numberedList",
                                          "|",
                                          "blockQuote",
                                          "|",
                                          "undo",
                                          "redo"
                                        ]
                                      },
                                      onChange: (t, n) => {
                                        const s = n.getData();
                                        p("template", s);
                                      },
                                      "data-testid": "othertypeeventconfigmodal-template-ckeditor"
                                    }
                                  )
                                }
                              )
                            ]
                          }
                        ) })
                      ] }),
                      (e == null ? void 0 : e.type) === "QUERY" && /* @__PURE__ */ i(d, { container: !0, children: /* @__PURE__ */ i(d, { item: !0, size: { xs: 12 }, className: " w-full", children: /* @__PURE__ */ a(
                        N,
                        {
                          variant: "outlined",
                          className: " w-full",
                          "data-testid": "othertypeeventconfigmodal-querySelect",
                          children: [
                            /* @__PURE__ */ i(h, { variant: "body2", children: c("Query") }),
                            /* @__PURE__ */ i(C, { className: " w-full", children: /* @__PURE__ */ i(
                              y,
                              {
                                className: " w-full",
                                name: "queryCode",
                                control: v,
                                defaultValue: null,
                                render: ({ field: t }) => /* @__PURE__ */ a(
                                  L,
                                  {
                                    ...t,
                                    className: " w-full",
                                    size: "small",
                                    displayEmpty: !0,
                                    onChange: (n) => {
                                      t.onChange(n), Se(n.target.value);
                                    },
                                    "data-testid": "othertypeeventconfigmodal-queryCode-select",
                                    children: [
                                      /* @__PURE__ */ i(T, { value: null, children: /* @__PURE__ */ i(h, { variant: "body2", children: c("Select") }) }),
                                      R == null ? void 0 : R.map((n, s) => /* @__PURE__ */ i(T, { value: n == null ? void 0 : n.code, children: /* @__PURE__ */ a(h, { variant: "body2", children: [
                                        " ",
                                        n == null ? void 0 : n.code
                                      ] }) }, s + 1))
                                    ]
                                  }
                                )
                              }
                            ) })
                          ]
                        }
                      ) }) }),
                      k && (e == null ? void 0 : e.type) === "QUERY" && re && /* @__PURE__ */ i(d, { container: !0, className: " w-full", children: k == null ? void 0 : k.map((t, n) => /* @__PURE__ */ i(
                        d,
                        {
                          item: !0,
                          size: { xs: 12 },
                          className: " w-full",
                          children: /* @__PURE__ */ a(N, { variant: "outlined", className: " w-full", children: [
                            /* @__PURE__ */ a(
                              d,
                              {
                                container: !0,
                                justifyContent: "space-between",
                                alignItems: "center",
                                children: [
                                  /* @__PURE__ */ i(d, { item: !0, children: /* @__PURE__ */ a(h, { variant: "body1", children: [
                                    t == null ? void 0 : t.parameterName,
                                    " ",
                                    c("Mapping")
                                  ] }) }),
                                  /* @__PURE__ */ i(d, { item: !0, children: /* @__PURE__ */ i(N, { component: "fieldset", className: "mr-2", children: /* @__PURE__ */ i(
                                    y,
                                    {
                                      control: v,
                                      name: `${t == null ? void 0 : t.parameterName}${n}isFixed`,
                                      defaultValue: (t == null ? void 0 : t.isFixed) || !1,
                                      render: ({ field: s }) => /* @__PURE__ */ i(
                                        U,
                                        {
                                          control: /* @__PURE__ */ i(
                                            W,
                                            {
                                              checked: s.value,
                                              onChange: (m) => {
                                                s.onChange(m.target.checked), A(
                                                  n,
                                                  "isFixed",
                                                  m.target.checked
                                                );
                                              },
                                              "data-testid": "othertypeeventconfigmodal-isFixed-checkbox"
                                            }
                                          ),
                                          label: "Is Fixed Value"
                                        }
                                      )
                                    }
                                  ) }) })
                                ]
                              }
                            ),
                            /* @__PURE__ */ i(C, { className: " w-full", children: /* @__PURE__ */ i(
                              y,
                              {
                                control: v,
                                className: " w-full",
                                name: `${t == null ? void 0 : t.parameterName}${n}`,
                                defaultValue: t == null ? void 0 : t.mappingValue,
                                render: ({ field: s }) => /* @__PURE__ */ i(
                                  G,
                                  {
                                    variant: "outlined",
                                    size: "small",
                                    className: " w-full",
                                    ...s,
                                    fullWidth: !0,
                                    onChange: (m) => {
                                      p(
                                        `${t == null ? void 0 : t.parameterName}${n}`,
                                        m.target.value
                                      ), A(
                                        n,
                                        "mappingValue",
                                        m.target.value
                                      );
                                    },
                                    "data-testid": `othertypeeventconfigmodal-${t == null ? void 0 : t.parameterName}${n}-textfiled`
                                  }
                                )
                              }
                            ) })
                          ] })
                        },
                        n + 1
                      )) }),
                      (e == null ? void 0 : e.type) === "SYSTEM_FUNCTION" && /* @__PURE__ */ i(d, { container: !0, children: /* @__PURE__ */ i(d, { item: !0, size: { xs: 12 }, className: " w-full", children: /* @__PURE__ */ a(
                        N,
                        {
                          variant: "outlined",
                          className: " w-full",
                          "data-testid": "othertypeeventconfigmodal-systemFunction",
                          children: [
                            /* @__PURE__ */ i(h, { variant: "body2", children: c("System Function") }),
                            /* @__PURE__ */ i(C, { className: " w-full", children: /* @__PURE__ */ i(
                              y,
                              {
                                className: " w-full",
                                name: "systemFunctionId",
                                control: v,
                                defaultValue: "",
                                render: ({ field: t }) => /* @__PURE__ */ a(
                                  L,
                                  {
                                    ...t,
                                    className: " w-full",
                                    size: "small",
                                    onChange: (n) => {
                                      t.onChange(n), Fe(n.target.value);
                                    },
                                    "data-testid": "othertypeeventconfigmodal-systemFunctionId-select",
                                    sx: {
                                      ".MuiSelect-select": {
                                        whiteSpace: "pre-wrap",
                                        // Allows line breaks
                                        wordBreak: "break-word",
                                        height: "auto",
                                        minHeight: "1.4375em"
                                      }
                                    },
                                    MenuProps: {
                                      PaperProps: {
                                        sx: {
                                          maxHeight: 300,
                                          overflow: "auto",
                                          maxWidth: 410
                                        }
                                      }
                                    },
                                    children: [
                                      /* @__PURE__ */ i(T, { value: "", children: /* @__PURE__ */ i(h, { variant: "body2", children: c("None") }) }),
                                      K == null ? void 0 : K.map((n, s) => /* @__PURE__ */ i(T, { value: n == null ? void 0 : n.id, children: /* @__PURE__ */ a(h, { variant: "body2", children: [
                                        " ",
                                        n == null ? void 0 : n.name,
                                        " (",
                                        n == null ? void 0 : n.className,
                                        ")"
                                      ] }) }, s + 1))
                                    ]
                                  }
                                )
                              }
                            ) })
                          ]
                        }
                      ) }) }),
                      $ && (e == null ? void 0 : e.type) === "SYSTEM_FUNCTION" && Te && /* @__PURE__ */ i(d, { container: !0, children: $ == null ? void 0 : $.map((t, n) => /* @__PURE__ */ i(
                        d,
                        {
                          item: !0,
                          size: { xs: 12 },
                          className: " w-full",
                          children: /* @__PURE__ */ a(N, { variant: "outlined", className: " w-full", children: [
                            /* @__PURE__ */ a(
                              d,
                              {
                                container: !0,
                                justifyContent: "space-between",
                                alignItems: "center",
                                children: [
                                  /* @__PURE__ */ i(d, { item: !0, xs: !0, children: /* @__PURE__ */ a(h, { variant: "body2", children: [
                                    t == null ? void 0 : t.parameterName,
                                    " ",
                                    c("Mapping")
                                  ] }) }),
                                  /* @__PURE__ */ i(d, { item: !0, children: /* @__PURE__ */ i(
                                    N,
                                    {
                                      component: "fieldset",
                                      className: "mr-2",
                                      children: /* @__PURE__ */ i(
                                        y,
                                        {
                                          control: v,
                                          name: `${t == null ? void 0 : t.parameterName}${n}isFixed`,
                                          defaultValue: (t == null ? void 0 : t.isFixed) || !1,
                                          render: ({ field: s }) => /* @__PURE__ */ i(
                                            U,
                                            {
                                              control: /* @__PURE__ */ i(
                                                W,
                                                {
                                                  checked: s.value,
                                                  onChange: (m) => {
                                                    s.onChange(m.target.checked), A(
                                                      n,
                                                      "isFixed",
                                                      m.target.checked
                                                    );
                                                  },
                                                  "data-testid": "othertypeeventconfigmodal-systemFunctionId-checkbox"
                                                }
                                              ),
                                              label: "Is Fixed Value"
                                            }
                                          )
                                        }
                                      )
                                    }
                                  ) })
                                ]
                              }
                            ),
                            /* @__PURE__ */ i(C, { className: " w-full", children: /* @__PURE__ */ i(
                              y,
                              {
                                control: v,
                                className: " w-full",
                                name: `${t == null ? void 0 : t.parameterName}${n}`,
                                defaultValue: t == null ? void 0 : t.mappingValue,
                                render: ({ field: s }) => /* @__PURE__ */ i(
                                  G,
                                  {
                                    variant: "outlined",
                                    size: "small",
                                    className: " w-full",
                                    ...s,
                                    fullWidth: !0,
                                    onChange: (m) => {
                                      p(
                                        `${t == null ? void 0 : t.parameterName}${n}`,
                                        m.target.value
                                      ), A(
                                        n,
                                        "mappingValue",
                                        m.target.value
                                      );
                                    },
                                    "data-testid": `othertypeeventconfigmodal-${t == null ? void 0 : t.parameterName}${n}-textfiled`
                                  }
                                )
                              }
                            ) })
                          ] })
                        },
                        n + 1
                      )) }),
                      (e == null ? void 0 : e.type) === "PUSH_NOTIFICATION" && /* @__PURE__ */ a(d, { container: !0, spacing: 2, children: [
                        /* @__PURE__ */ i(d, { item: !0, size: { xs: 12 }, className: " w-full", children: /* @__PURE__ */ a(
                          N,
                          {
                            variant: "outlined",
                            className: " w-full",
                            "data-testid": "othertypeeventconfigmodal-userIdFieldName",
                            children: [
                              /* @__PURE__ */ a(h, { variant: "body2", children: [
                                c("User"),
                                " ",
                                c("Id"),
                                " ",
                                c("Field"),
                                " ",
                                c("Name"),
                                /* @__PURE__ */ i("span", { style: { color: "red", marginLeft: 4 }, children: "*" })
                              ] }),
                              /* @__PURE__ */ i(C, { className: " w-full", children: /* @__PURE__ */ i(
                                M,
                                {
                                  control: v,
                                  id: "userFieldName",
                                  name: "userFieldName",
                                  errors: f,
                                  label: "",
                                  size: "small",
                                  dataTestId: "othertypeeventconfigmodal-userFieldName-textfield"
                                }
                              ) })
                            ]
                          }
                        ) }),
                        /* @__PURE__ */ i(d, { item: !0, size: { xs: 12 }, className: " w-full", children: /* @__PURE__ */ a(
                          N,
                          {
                            variant: "outlined",
                            className: " w-full",
                            "data-testid": "othertypeeventconfigmodal-notificationType",
                            children: [
                              /* @__PURE__ */ a(h, { variant: "body2", children: [
                                c("Notification"),
                                " ",
                                c("Type"),
                                /* @__PURE__ */ i("span", { style: { color: "red", marginLeft: 4 }, children: "*" })
                              ] }),
                              /* @__PURE__ */ a(C, { className: " w-full", children: [
                                /* @__PURE__ */ i(
                                  y,
                                  {
                                    className: " w-full",
                                    name: "notificationTypeId",
                                    control: v,
                                    defaultValue: "",
                                    render: ({ field: t }) => /* @__PURE__ */ a(
                                      L,
                                      {
                                        ...t,
                                        className: " w-full",
                                        size: "small",
                                        error: f == null ? void 0 : f.notificationTypeId,
                                        onChange: (n) => {
                                          t.onChange(n), ke(n.target.value);
                                        },
                                        "data-testid": "othertypeeventconfigmodal-notificationtypeid-select",
                                        children: [
                                          /* @__PURE__ */ i(T, { value: "", children: /* @__PURE__ */ i(h, { variant: "body2", children: c("None") }) }),
                                          q == null ? void 0 : q.map((n, s) => /* @__PURE__ */ i(T, { value: n == null ? void 0 : n.id, children: /* @__PURE__ */ i(h, { variant: "body2", children: n == null ? void 0 : n.type }) }, s + 1))
                                        ]
                                      }
                                    )
                                  }
                                ),
                                (f == null ? void 0 : f.notificationTypeId) && /* @__PURE__ */ i(
                                  "p",
                                  {
                                    className: "error-helper",
                                    "data-testid": "custom-error-message",
                                    children: (ae = f == null ? void 0 : f.notificationTypeId) == null ? void 0 : ae.message
                                  }
                                )
                              ] })
                            ]
                          }
                        ) })
                      ] }),
                      (e == null ? void 0 : e.type) === "PUSH_NOTIFICATION" && X && /* @__PURE__ */ a(d, { container: !0, spacing: 2, children: [
                        /* @__PURE__ */ i(d, { item: !0, size: { xs: 12 }, className: " w-full", children: /* @__PURE__ */ a(N, { variant: "outlined", className: " w-full", children: [
                          /* @__PURE__ */ a(h, { variant: "body2", children: [
                            c("Notification"),
                            " ",
                            c("Heading"),
                            /* @__PURE__ */ i("span", { style: { color: "red", marginLeft: 4 }, children: "*" })
                          ] }),
                          /* @__PURE__ */ i(C, { className: " w-full", children: /* @__PURE__ */ i(
                            M,
                            {
                              control: v,
                              id: "heading",
                              name: "heading",
                              errors: f,
                              label: "",
                              size: "small",
                              dataTestId: "othertypeeventconfigmodal-heading-textfield"
                            }
                          ) })
                        ] }) }),
                        /* @__PURE__ */ a(d, { item: !0, size: { xs: 12 }, className: " w-full", children: [
                          " ",
                          /* @__PURE__ */ a(N, { variant: "outlined", className: " w-full", children: [
                            /* @__PURE__ */ i(h, { variant: "body2", children: c("Template") }),
                            /* @__PURE__ */ i(C, { className: " w-full", children: /* @__PURE__ */ i(
                              Z,
                              {
                                control: v,
                                id: "template",
                                name: "template",
                                errors: f,
                                label: "",
                                minRows: 5,
                                "data-testid": "othertypeeventconfigmodal-template-customtextarea"
                              }
                            ) })
                          ] })
                        ] })
                      ] }),
                      (e == null ? void 0 : e.type) === "KAFKA_SYNC" && /* @__PURE__ */ i(d, { container: !0, children: /* @__PURE__ */ i(d, { item: !0, size: { xs: 12 }, className: " w-full", children: /* @__PURE__ */ a(
                        N,
                        {
                          variant: "outlined",
                          className: " w-full",
                          "data-testid": "othertypeeventconfigmodal-kafkaConfig",
                          children: [
                            /* @__PURE__ */ a(h, { variant: "body2", children: [
                              c("Kafka Config"),
                              /* @__PURE__ */ i("span", { style: { color: "red", marginLeft: 4 }, children: "*" })
                            ] }),
                            /* @__PURE__ */ i(C, { className: " w-full", children: /* @__PURE__ */ i(
                              y,
                              {
                                className: " w-full",
                                name: "formType",
                                control: v,
                                defaultValue: "",
                                error: f,
                                render: ({ field: t }) => /* @__PURE__ */ a(
                                  L,
                                  {
                                    ...t,
                                    className: " w-full",
                                    size: "small",
                                    displayEmpty: !0,
                                    onChange: (n) => {
                                      t.onChange(n), $e(n.target.value);
                                    },
                                    "data-testid": "othertypeeventconfigmodal-kafkaConfig-select",
                                    children: [
                                      /* @__PURE__ */ i(T, { value: "", children: /* @__PURE__ */ i(h, { variant: "body2", children: c("Select") }) }),
                                      j == null ? void 0 : j.map((n, s) => /* @__PURE__ */ i(T, { value: n.form_type, children: /* @__PURE__ */ i(h, { variant: "body2", children: n.form_type }) }, s))
                                    ]
                                  }
                                )
                              }
                            ) })
                          ]
                        }
                      ) }) }),
                      z && (e == null ? void 0 : e.type) === "KAFKA_SYNC" && oe && z.length > 0 && /* @__PURE__ */ i(d, { container: !0, className: " w-full", children: z == null ? void 0 : z.map((t, n) => /* @__PURE__ */ i(
                        d,
                        {
                          item: !0,
                          size: { xs: 12 },
                          className: " w-full",
                          children: /* @__PURE__ */ a(N, { variant: "outlined", className: " w-full", children: [
                            /* @__PURE__ */ a(
                              d,
                              {
                                container: !0,
                                justifyContent: "space-between",
                                alignItems: "center",
                                children: [
                                  /* @__PURE__ */ i(d, { item: !0, xs: !0, children: /* @__PURE__ */ a(h, { variant: "body2", children: [
                                    t == null ? void 0 : t.parameterName,
                                    " ",
                                    c("Mapping")
                                  ] }) }),
                                  /* @__PURE__ */ i(d, { item: !0, children: /* @__PURE__ */ i(
                                    N,
                                    {
                                      component: "fieldset",
                                      className: "mr-2",
                                      children: /* @__PURE__ */ i(
                                        y,
                                        {
                                          control: v,
                                          name: `${t == null ? void 0 : t.parameterName}${n}isFixed`,
                                          defaultValue: (t == null ? void 0 : t.isFixed) || !1,
                                          render: ({ field: s }) => /* @__PURE__ */ i(
                                            U,
                                            {
                                              control: /* @__PURE__ */ i(
                                                W,
                                                {
                                                  checked: s.value,
                                                  onChange: (m) => {
                                                    s.onChange(m.target.checked), A(
                                                      n,
                                                      "isFixed",
                                                      m.target.checked
                                                    );
                                                  },
                                                  "data-testid": "othertypeeventconfigmodal-kafka-isFixed-checkbox"
                                                }
                                              ),
                                              label: c("Is Fixed Value")
                                            }
                                          )
                                        }
                                      )
                                    }
                                  ) })
                                ]
                              }
                            ),
                            /* @__PURE__ */ i(C, { className: " w-full", children: /* @__PURE__ */ i(
                              y,
                              {
                                control: v,
                                className: " w-full",
                                name: `${t == null ? void 0 : t.parameterName}${n}`,
                                defaultValue: (t == null ? void 0 : t.mappingValue) || "",
                                render: ({ field: s }) => /* @__PURE__ */ i(
                                  G,
                                  {
                                    variant: "outlined",
                                    size: "small",
                                    className: " w-full",
                                    ...s,
                                    fullWidth: !0,
                                    onChange: (m) => {
                                      p(
                                        `${t == null ? void 0 : t.parameterName}${n}`,
                                        m.target.value
                                      ), A(
                                        n,
                                        "mappingValue",
                                        m.target.value
                                      );
                                    },
                                    "data-testid": `othertypeeventconfigmodal-kafka-${t == null ? void 0 : t.parameterName}${n}-textfield`
                                  }
                                )
                              }
                            ) })
                          ] })
                        },
                        `${oe}-${t == null ? void 0 : t.parameterName}-${n}`
                      )) }),
                      ((e == null ? void 0 : e.type) === "SMS" || (e == null ? void 0 : e.type) == "QUERY" && !re) && /* @__PURE__ */ i(d, { container: !0, spacing: 2, children: /* @__PURE__ */ a(d, { item: !0, size: { xs: 12 }, className: " w-full", children: [
                        " ",
                        /* @__PURE__ */ a(
                          N,
                          {
                            variant: "outlined",
                            className: " w-full",
                            "data-testid": e.type === "QUERY" ? "othertypeeventconfigmodal-queryArea" : "othertypeeventconfigmodal-template",
                            children: [
                              /* @__PURE__ */ i(h, { variant: "body2", children: c(
                                e.type === "QUERY" ? "Query" : "Template"
                              ) }),
                              /* @__PURE__ */ i(C, { className: " w-full", children: /* @__PURE__ */ i(
                                Z,
                                {
                                  control: v,
                                  id: "template",
                                  name: "template",
                                  label: "",
                                  minRows: 5,
                                  "data-testid": "othertypeeventconfigmodal-template-customtextarea"
                                }
                              ) })
                            ]
                          }
                        )
                      ] }) }),
                      (e == null ? void 0 : e.type) != "EXCEPTION" && (e == null ? void 0 : e.type) != "SYSTEM_FUNCTION" && /* @__PURE__ */ i(d, { container: !0, spacing: 2, children: /* @__PURE__ */ a(d, { item: !0, size: { xs: 12 }, className: "mt-2 w-full", children: [
                        /* @__PURE__ */ a(
                          N,
                          {
                            variant: "outlined",
                            className: " w-full",
                            "data-testid": "othertypeeventconfigmodal-triggerWhen",
                            children: [
                              /* @__PURE__ */ a(h, { variant: "body2", children: [
                                c("Trigger"),
                                " ",
                                c("When"),
                                /* @__PURE__ */ i("span", { style: { color: "red", marginLeft: 4 }, children: "*" })
                              ] }),
                              /* @__PURE__ */ a(C, { className: " w-full", children: [
                                /* @__PURE__ */ i(
                                  y,
                                  {
                                    name: "trigerWhen",
                                    control: v,
                                    defaultValue: "",
                                    className: " w-full",
                                    render: ({ field: t }) => /* @__PURE__ */ a(
                                      L,
                                      {
                                        className: " w-full",
                                        ...t,
                                        error: f.trigerWhen,
                                        size: "small",
                                        displayEmpty: !0,
                                        "data-testid": "othertypeeventconfigmodal-trigegrwhen-select",
                                        children: [
                                          /* @__PURE__ */ i(T, { value: "", children: /* @__PURE__ */ i(h, { variant: "body2", children: c("Select") }) }),
                                          /* @__PURE__ */ i(T, { value: "IMMEDIATELY", children: /* @__PURE__ */ i(h, { variant: "body2", children: c("Immediately") }) }),
                                          /* @__PURE__ */ i(T, { value: "AFTER", children: /* @__PURE__ */ i(h, { variant: "body2", children: c("After") }) })
                                        ]
                                      }
                                    )
                                  }
                                ),
                                (f == null ? void 0 : f.trigerWhen) && /* @__PURE__ */ i(
                                  "p",
                                  {
                                    className: "error-helper",
                                    "data-testid": "custom-error-message",
                                    children: (se = f == null ? void 0 : f.trigerWhen) == null ? void 0 : se.message
                                  }
                                )
                              ] })
                            ]
                          }
                        ),
                        ye === "AFTER" && /* @__PURE__ */ a(Me, { children: [
                          /* @__PURE__ */ i(d, { item: !0, size: { xs: 12 }, children: /* @__PURE__ */ a(
                            N,
                            {
                              variant: "outlined",
                              className: " w-full",
                              "data-testid": "othertypeeventconfigmodal-dayField",
                              children: [
                                /* @__PURE__ */ i(h, { variant: "body2", children: c("Day") }),
                                /* @__PURE__ */ i(C, { className: " w-full", children: /* @__PURE__ */ i(
                                  M,
                                  {
                                    control: v,
                                    id: "day",
                                    name: "day",
                                    errors: f,
                                    label: "",
                                    type: "number",
                                    size: "small",
                                    dataTestId: "othertypeeventconfigmodal-type-textfield"
                                  }
                                ) })
                              ]
                            }
                          ) }),
                          /* @__PURE__ */ i(d, { item: !0, size: { xs: 12 }, children: /* @__PURE__ */ a(
                            N,
                            {
                              variant: "outlined",
                              className: " w-full",
                              "data-testid": "othertypeeventconfigmodal-hourField",
                              children: [
                                /* @__PURE__ */ i(h, { variant: "body2", children: c("Hour") }),
                                /* @__PURE__ */ i(C, { className: " w-full", children: /* @__PURE__ */ i(
                                  M,
                                  {
                                    control: v,
                                    id: "hour",
                                    name: "hour",
                                    errors: f,
                                    label: "",
                                    type: "number",
                                    size: "small",
                                    dataTestId: "othertypeeventconfigmodal-type-textfield"
                                  }
                                ) })
                              ]
                            }
                          ) }),
                          /* @__PURE__ */ i(d, { item: !0, size: { xs: 12 }, children: /* @__PURE__ */ a(
                            N,
                            {
                              variant: "outlined",
                              className: " w-full",
                              "data-testid": "othertypeeventconfigmodal-minuteField",
                              children: [
                                /* @__PURE__ */ i(h, { variant: "body2", children: c("Minute") }),
                                /* @__PURE__ */ i(C, { className: " w-full", children: /* @__PURE__ */ i(
                                  M,
                                  {
                                    control: v,
                                    id: "minute",
                                    name: "minute",
                                    type: "number",
                                    errors: f,
                                    label: "",
                                    size: "small",
                                    dataTestId: "othertypeeventconfigmodal-type-textfield"
                                  }
                                ) })
                              ]
                            }
                          ) })
                        ] })
                      ] }) })
                    ] })
                  ] }),
                  /* @__PURE__ */ a(
                    We,
                    {
                      direction: "row",
                      className: "mr-5",
                      spacing: 2,
                      justifyContent: "flex-end",
                      mt: 1,
                      mb: 1,
                      children: [
                        /* @__PURE__ */ i(
                          ce,
                          {
                            variant: "contained",
                            size: "small",
                            color: "secondary",
                            onClick: () => {
                              J(), Y();
                            },
                            "data-testid": "othertypeeventconfigmodal-cancel-button",
                            children: /* @__PURE__ */ i(h, { variant: "body2", children: c("Cancel") })
                          }
                        ),
                        /* @__PURE__ */ i(
                          ce,
                          {
                            size: "small",
                            type: "submit",
                            variant: "contained",
                            color: "primary",
                            "data-testid": "othertypeeventconfigmodal-submit-button",
                            children: c("Submit")
                          }
                        )
                      ]
                    }
                  )
                ]
              }
            )
          ]
        }
      )
    }
  );
};
bt.propTypes = {
  open: H.any,
  handleClose: H.any,
  handleClick: H.any,
  type: H.any
};
export {
  bt as default
};
//# sourceMappingURL=OtherTypeEventConfigModal-dXt2qDg_.js.map
