import DocumentItem_default from "./DocumentItem.js";
import { c } from "react/compiler-runtime";
import React, { useEffect } from "react";
import { WorkflowState } from "@loopstack/api-client";
import { jsx } from "react/jsx-runtime";
import { useParams } from "react-router-dom";
var DocumentList_default = (i) => {
	let s = c(23), { pipeline: l, workflow: u, documents: d, scrollTo: f, settings: p } = i, { workflowId: m, clickId: h } = useParams(), g;
	s[0] !== m || s[1] !== f || s[2] !== u.id ? (g = () => {
		m === u.id && f(u.id);
	}, s[0] = m, s[1] = f, s[2] = u.id, s[3] = g) : g = s[3];
	let _;
	s[4] !== h || s[5] !== m || s[6] !== f || s[7] !== u.id ? (_ = [
		u.id,
		m,
		h,
		f
	], s[4] = h, s[5] = m, s[6] = f, s[7] = u.id, s[8] = _) : _ = s[8], useEffect(g, _);
	let v = u.status === WorkflowState.Waiting, y;
	if (s[9] !== d || s[10] !== v || s[11] !== l || s[12] !== p || s[13] !== u) {
		let r;
		s[15] !== d.length || s[16] !== v || s[17] !== l || s[18] !== p || s[19] !== u ? (r = (r, i) => {
			let a = r, o = r.place === u.place || !!a.meta?.enableAtPlaces?.includes(u.place);
			return /* @__PURE__ */ jsx(DocumentItem_default, {
				document: r,
				workflow: u,
				pipeline: l,
				isActive: v && o,
				isLastItem: i === d.length - 1,
				settings: p
			}, r.id);
		}, s[15] = d.length, s[16] = v, s[17] = l, s[18] = p, s[19] = u, s[20] = r) : r = s[20], y = d.map(r), s[9] = d, s[10] = v, s[11] = l, s[12] = p, s[13] = u, s[14] = y;
	} else y = s[14];
	let b;
	return s[21] === y ? b = s[22] : (b = /* @__PURE__ */ jsx("div", {
		className: "flex flex-col gap-6",
		children: y
	}), s[21] = y, s[22] = b), b;
};
export { DocumentList_default as default };
