/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import "@esri/solution-common";
import { g as p } from "./cardsHelpers.js";
import { B as y } from "./interfaces.js";
async function _(e, n, r, o, t = y, i = "created", s = "desc", a = !1, l = [], u = [], c, f, g) {
  if (!e?.IsSignedIn)
    return;
  const d = {
    q: t,
    filter: "type:Solution",
    sortField: i,
    sortOrder: s,
    delay: a,
    categories: l,
    num: 100
  };
  return d.q += S(e, f), await m(
    n,
    d,
    o,
    u,
    g,
    c
  );
}
function S(e, n) {
  let r = "";
  const o = e.PortalUserOrg, t = e.PortalUserName;
  return o && (r += " orgid:" + o), n !== "My organization's solutions" && t && (r += " owner:" + t), r;
}
async function m(e, n, r, o, t = "", i) {
  const s = await r.requestDeployedSolutionCards(n, e, t, i), a = p(s.cards, o);
  return {
    cards: s.cards,
    relatedSolutions: a
  };
}
export {
  _ as g
};
