import state from "../../store";
export default async function findSite(db, id) {
  var _a, _b, _c, _d;
  const site = await db.find("sites", id);
  const photos = [];
  for (const photo of ((_c = (_a = state === null || state === void 0 ? void 0 : state.jobs) === null || _a === void 0 ? void 0 : _a[(_b = site === null || site === void 0 ? void 0 : site.job) === null || _b === void 0 ? void 0 : _b.id]) === null || _c === void 0 ? void 0 : _c.photos) || []) {
    if (((_d = photo === null || photo === void 0 ? void 0 : photo.site) === null || _d === void 0 ? void 0 : _d.id) !== (site === null || site === void 0 ? void 0 : site.id))
      continue;
    photos.push(photo);
  }
  site.photos = photos;
  return site;
}
//# sourceMappingURL=findSite.js.map