/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
const d = [
  { name: "objectid", type: "oid", alias: "ObjectID", description: "Unique identifier for each record in the dataset.", choiceList: null, length: null },
  { name: "globalid", type: "globalid", alias: "GlobalID", description: "Globally unique identifier for the record.", choiceList: null, length: null },
  { name: "created_date", type: "date", alias: "Created On", description: "Date when the record was created.", choiceList: null, length: null },
  { name: "created_user", type: "string", alias: "Created By", description: "User who created the record.", choiceList: null, length: 255 },
  { name: "last_edited_date", type: "date", alias: "Last Edited On", description: "Date when the record was last edited.", choiceList: null, length: null },
  { name: "last_edited_user", type: "string", alias: "Last Edited By", description: "User who last edited the record.", choiceList: null, length: 255 }
], c = "fieldInspections", u = "manageSpatialData", _ = "placesOfInterest", r = {};
function p(e) {
  return (e ? r[e] : void 0) ?? Object.values(r).find((t) => !!t?.initialTemplate);
}
function o(e) {
  if (!e?.featureLayer) {
    const { sourceBuildSolution: n, templateId: a, ...l } = e ?? {};
    return l;
  }
  const { sourceBuildSolution: t, templateId: i, ...s } = e;
  return {
    ...s,
    featureLayer: {
      ...e.featureLayer,
      layers: e.featureLayer.layers.map(({ systemFields: n, ...a }) => a)
    }
  };
}
function m(e) {
  const t = o(e);
  return {
    ...t,
    solution: {
      ...t.solution,
      strings: t.solution.strings.map((i, s) => ({ _idx: s, ...i }))
    },
    items: t.items.map((i, s) => ({ _idx: s, ...i })),
    featureLayer: {
      ...t.featureLayer,
      layers: t.featureLayer.layers.map((i, s) => ({
        _idx: s,
        ...i,
        customFields: i.customFields.map((n, a) => ({ _idx: a, ...n })),
        requiredFields: i.requiredFields.map((n, a) => ({ _idx: a, ...n }))
      }))
    }
  };
}
function h(e, t) {
  return {
    ...e,
    layers: e.layers.map((i) => {
      const s = t?.layers.find((a) => a.id === i.id), n = s?.systemFields?.length ? s.systemFields : d;
      return { ...i, systemFields: n };
    })
  };
}
export {
  u as T,
  _ as a,
  c as b,
  o as c,
  r as d,
  p as g,
  h as r,
  m as t
};
