import { fieldFactory as s } from "../subcomponents/FieldTypes/fieldFactory.js";
const u = (f, d, c) => {
  const i = [], o = [];
  for (let n = 0; n < d.length; n++)
    try {
      const t = d[n], e = c(t.name), r = {
        id: 0,
        isSet: !0,
        fixed: !1,
        field: e,
        fieldType: e.type,
        operator: d[n].operator
        // operator
      };
      if (!e)
        continue;
      s().verifySort(t, e) === !0 && (e.presence === "fixed" && (o.findIndex((a) => a === e.name) === -1 ? (r.fixed = !0, o.push(e.name)) : r.fixed = !1), r.isSet = !0, r.id = i.length + 1, i.push(r));
    } catch {
    }
  for (let n = 0; n < f.length; n++) {
    const t = f[n];
    if ((t.presence === "initialized" || t.presence === "fixed") && !d.find((e) => e.name === t.name)) {
      const e = s().getDefaultSort(
        t,
        t.presence === "fixed"
      );
      e.id = i.length + 1, i.push(e);
    }
  }
  return i;
};
export {
  u as getPurgedInitialSortApplied
};
