import { b as generateId } from "./dist-CYoGQ6PD.mjs";
import { m as actions } from "./module-BMSfcjYx.mjs";
import "./document-drive-BKF7N19I.mjs";
import "./chunk-VBDAOXYI-Dd3pepio.mjs";
import "./dist-LFSG_0Q3.mjs";
import { s as useSelectedGrantPoolDocument } from "./grant-pool-B5bEceKw.mjs";
import "./load-design-tokens-B8bpWdLf.mjs";
import { t as DocumentToolbar } from "./connect-9ej7S5NE-DaHvmG3o.mjs";
import { useCallback, useState } from "react";
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
//#region editors/grant-pool-editor/components/PoolHeader.tsx
const LIFECYCLE_CLASS = {
	DRAFT: "rfp-status-draft",
	REQUEST_FOR_COMMENTS: "rfp-status-pending",
	UPCOMING: "rfp-status-review",
	OPEN: "rfp-status-approved",
	CLOSED: "rfp-status-closed",
	AWARDED: "rfp-status-funded",
	NOT_AWARDED: "rfp-status-rejected",
	CANCELLED: "rfp-status-rejected"
};
function PoolHeader({ state }) {
	const lifecycle = state.lifecycle;
	const mechLabel = state.grantFundingMechanism ? state.grantFundingMechanism.toLowerCase().replace(/_/g, " ") : "mechanism not set";
	return /* @__PURE__ */ jsxs("header", {
		className: "rfp-header",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "rfp-header-row",
			children: [/* @__PURE__ */ jsxs("div", {
				className: "rfp-col",
				children: [
					/* @__PURE__ */ jsx("span", {
						className: "rfp-meta",
						children: "Grant Pool · DAOIP-5"
					}),
					/* @__PURE__ */ jsx("h1", {
						className: "rfp-h1",
						children: state.name || "Unnamed pool"
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "rfp-row",
						style: {
							gap: 8,
							marginTop: 4
						},
						children: [/* @__PURE__ */ jsx("span", {
							className: "rfp-chip",
							children: mechLabel
						}), state.code ? /* @__PURE__ */ jsx("span", {
							className: "rfp-chip",
							children: state.code
						}) : null]
					})
				]
			}), /* @__PURE__ */ jsx("span", {
				className: `rfp-status-badge ${LIFECYCLE_CLASS[lifecycle] ?? "rfp-status-draft"}`,
				children: lifecycle.toLowerCase().replace(/_/g, " ")
			})]
		}), state.description ? /* @__PURE__ */ jsx("p", {
			className: "rfp-body",
			style: { maxWidth: 680 },
			children: state.description
		}) : null]
	});
}
//#endregion
//#region editors/grant-pool-editor/components/PoolBasics.tsx
function PoolBasics({ state, on }) {
	return /* @__PURE__ */ jsxs("section", {
		className: "rfp-card rfp-section",
		children: [
			/* @__PURE__ */ jsx("h2", {
				className: "rfp-section-subtitle",
				children: "Basics"
			}),
			/* @__PURE__ */ jsx("hr", { className: "rfp-divider" }),
			/* @__PURE__ */ jsxs("label", {
				className: "rfp-field",
				children: [/* @__PURE__ */ jsx("span", {
					className: "rfp-label",
					children: "Pool name"
				}), /* @__PURE__ */ jsx("input", {
					className: "rfp-input",
					defaultValue: state.name ?? "",
					placeholder: "e.g. Web3 Community Round",
					onBlur: (e) => on.setPoolName(e.target.value.trim())
				})]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "rfp-grid-2",
				children: [/* @__PURE__ */ jsxs("label", {
					className: "rfp-field",
					children: [/* @__PURE__ */ jsx("span", {
						className: "rfp-label",
						children: "Short code"
					}), /* @__PURE__ */ jsx("input", {
						className: "rfp-input",
						defaultValue: state.code ?? "",
						placeholder: "e.g. RFP-23",
						onBlur: (e) => on.setCode(e.target.value.trim())
					})]
				}), /* @__PURE__ */ jsxs("label", {
					className: "rfp-field",
					children: [/* @__PURE__ */ jsx("span", {
						className: "rfp-label",
						children: "Briefing URL"
					}), /* @__PURE__ */ jsx("input", {
						className: "rfp-input",
						defaultValue: state.briefingURI ?? "",
						placeholder: "https://…",
						onBlur: (e) => on.setBriefingUri(e.target.value.trim())
					})]
				})]
			}),
			/* @__PURE__ */ jsxs("label", {
				className: "rfp-field",
				children: [/* @__PURE__ */ jsx("span", {
					className: "rfp-label",
					children: "Summary"
				}), /* @__PURE__ */ jsx("textarea", {
					className: "rfp-textarea",
					defaultValue: state.description ?? "",
					placeholder: "What this pool funds, who it's for, what the expected outcome looks like.",
					onBlur: (e) => on.setDescription(e.target.value.trim())
				})]
			})
		]
	});
}
//#endregion
//#region editors/grant-pool-editor/components/PoolReferences.tsx
function PoolReferences({ state, on }) {
	return /* @__PURE__ */ jsxs("section", {
		className: "rfp-card rfp-section",
		children: [
			/* @__PURE__ */ jsx("h2", {
				className: "rfp-section-subtitle",
				children: "References"
			}),
			/* @__PURE__ */ jsx("hr", { className: "rfp-divider" }),
			/* @__PURE__ */ jsxs("label", {
				className: "rfp-field",
				children: [/* @__PURE__ */ jsx("span", {
					className: "rfp-label",
					children: "Grant System (PHID)"
				}), /* @__PURE__ */ jsx("input", {
					className: "rfp-input",
					defaultValue: state.grantSystemRef ?? "",
					placeholder: "PHID of the owning grant-system document",
					onBlur: (e) => {
						const v = e.target.value.trim();
						if (v) on.setGrantSystemRef(v);
					}
				})]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "rfp-grid-2",
				children: [/* @__PURE__ */ jsxs("label", {
					className: "rfp-field",
					children: [/* @__PURE__ */ jsx("span", {
						className: "rfp-label",
						children: "Applications URI"
					}), /* @__PURE__ */ jsx("input", {
						className: "rfp-input",
						defaultValue: state.applicationsURI ?? "",
						placeholder: "https://…",
						onBlur: (e) => on.setApplicationsUri(e.target.value.trim())
					})]
				}), /* @__PURE__ */ jsxs("label", {
					className: "rfp-field",
					children: [/* @__PURE__ */ jsx("span", {
						className: "rfp-label",
						children: "Governance URI"
					}), /* @__PURE__ */ jsx("input", {
						className: "rfp-input",
						defaultValue: state.governanceURI ?? "",
						placeholder: "https://…",
						onBlur: (e) => on.setGovernanceUri(e.target.value.trim())
					})]
				})]
			}),
			/* @__PURE__ */ jsxs("label", {
				className: "rfp-field",
				children: [/* @__PURE__ */ jsx("span", {
					className: "rfp-label",
					children: "Attestation issuers URI"
				}), /* @__PURE__ */ jsx("input", {
					className: "rfp-input",
					defaultValue: state.attestationIssuersURI ?? "",
					placeholder: "https://…",
					onBlur: (e) => on.setAttestationIssuersUri(e.target.value.trim())
				})]
			})
		]
	});
}
//#endregion
//#region editors/grant-pool-editor/components/PoolFunding.tsx
const MECHANISMS = [
	"REQUEST_FOR_PROPOSAL",
	"DIRECT_GRANTS",
	"QUADRATIC_FUNDING",
	"RETRO_FUNDING",
	"BOUNTIES",
	"STREAMING_QUADRATIC_FUNDING",
	"CONVICTION_VOTING",
	"SELF_CURATED_REGISTRIES",
	"GIFT_CIRCLES",
	"SOCIAL_MEDIA_CAPITAL_ALLOCATION",
	"FUTARCHY",
	"ASSURANCE_CONTRACTS",
	"COOKIE_JAR",
	"IMPACT_ATTESTATIONS",
	"STOKVEL",
	"DELEGATED_DOMAIN_ALLOCATION",
	"EVOLUTIONARY_GRANTS_GAMES",
	"DIRECT_TO_CONTRACT_INCENTIVES",
	"ANGEL_INVESTMENT",
	"DOMINANT_ASSURANCE_CONTRACTS",
	"COMMUNITY_CURRENCIES",
	"UNIVERSAL_BASIC_INCOME",
	"GNOSIS_SAFE",
	"WAQF",
	"RANKED_CHOICE_VOTING",
	"HONOUR",
	"MUTUAL_AID_NETWORKS",
	"BONDING_CURVES",
	"ZAKAT",
	"DECENTRALIZED_VALIDATORS",
	"REVNETS",
	"OTHER"
];
function PoolFunding({ state, on }) {
	const totalUsd = state.totalGrantPoolSizeInUSD;
	return /* @__PURE__ */ jsxs("section", {
		className: "rfp-card rfp-section",
		children: [
			/* @__PURE__ */ jsx("h2", {
				className: "rfp-section-subtitle",
				children: "Funding"
			}),
			/* @__PURE__ */ jsx("hr", { className: "rfp-divider" }),
			/* @__PURE__ */ jsxs("div", {
				className: "rfp-grid-2",
				children: [/* @__PURE__ */ jsxs("label", {
					className: "rfp-field",
					children: [/* @__PURE__ */ jsx("span", {
						className: "rfp-label",
						children: "Funding mechanism"
					}), /* @__PURE__ */ jsxs("select", {
						className: "rfp-select",
						value: state.grantFundingMechanism ?? "",
						onChange: (e) => {
							const v = e.target.value;
							if (v) on.setFundingMechanism(v);
						},
						children: [/* @__PURE__ */ jsx("option", {
							value: "",
							disabled: true,
							children: "Select mechanism…"
						}), MECHANISMS.map((m) => /* @__PURE__ */ jsx("option", {
							value: m,
							children: m.toLowerCase().replace(/_/g, " ")
						}, m))]
					})]
				}), /* @__PURE__ */ jsxs("label", {
					className: "rfp-field",
					children: [/* @__PURE__ */ jsx("span", {
						className: "rfp-label",
						children: "Total pool size (USD)"
					}), /* @__PURE__ */ jsx("input", {
						className: "rfp-input",
						type: "number",
						defaultValue: totalUsd?.value ?? "",
						placeholder: "e.g. 100000",
						onBlur: (e) => {
							const v = parseFloat(e.target.value);
							if (Number.isFinite(v)) on.setTotalPoolSizeUsd({
								value: v,
								unit: "USD"
							});
						}
					})]
				})]
			})
		]
	});
}
//#endregion
//#region editors/grant-pool-editor/components/PoolFundingDetails.tsx
function fmt(amount) {
	if (!amount) return "—";
	const v = amount.value;
	const u = amount.unit || "";
	if (v == null) return "—";
	return `${v.toLocaleString()} ${u}`.trim();
}
function PoolFundingDetails({ state, on }) {
	const [entryValue, setEntryValue] = useState("");
	const [entryUnit, setEntryUnit] = useState("USDC");
	const [minValue, setMinValue] = useState(state.minGrant[0]?.amount?.value != null ? String(state.minGrant[0].amount.value) : "");
	const [minUnit, setMinUnit] = useState(state.minGrant[0]?.amount?.unit ?? "USD");
	const [maxValue, setMaxValue] = useState(state.maxGrant[0]?.amount?.value != null ? String(state.maxGrant[0].amount.value) : "");
	const [maxUnit, setMaxUnit] = useState(state.maxGrant[0]?.amount?.unit ?? "USD");
	return /* @__PURE__ */ jsxs("section", {
		className: "rfp-card rfp-section",
		children: [
			/* @__PURE__ */ jsx("h2", {
				className: "rfp-section-subtitle",
				children: "Pool size & grant bounds"
			}),
			/* @__PURE__ */ jsx("hr", { className: "rfp-divider" }),
			/* @__PURE__ */ jsxs("div", {
				className: "rfp-col",
				children: [
					/* @__PURE__ */ jsx("span", {
						className: "rfp-label",
						children: "Total pool size entries"
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "rfp-row",
						children: [
							/* @__PURE__ */ jsx("input", {
								className: "rfp-input",
								style: { flex: 1 },
								type: "number",
								step: "any",
								value: entryValue,
								onChange: (e) => setEntryValue(e.target.value),
								placeholder: "Amount"
							}),
							/* @__PURE__ */ jsx("input", {
								className: "rfp-input",
								style: { maxWidth: 140 },
								value: entryUnit,
								onChange: (e) => setEntryUnit(e.target.value),
								placeholder: "USDC"
							}),
							/* @__PURE__ */ jsx("button", {
								className: "rfp-btn-secondary",
								disabled: !entryValue.trim() || !entryUnit.trim(),
								onClick: () => {
									const v = parseFloat(entryValue);
									if (Number.isFinite(v)) {
										on.addPoolSizeEntry(v, entryUnit.trim());
										setEntryValue("");
									}
								},
								children: "Add"
							})
						]
					}),
					state.totalGrantPoolSize.length === 0 ? /* @__PURE__ */ jsx("div", {
						className: "rfp-empty",
						children: "No pool size entries yet."
					}) : /* @__PURE__ */ jsx("ul", {
						className: "rfp-list",
						children: state.totalGrantPoolSize.map((entry) => /* @__PURE__ */ jsxs("li", {
							className: "rfp-list-item",
							children: [/* @__PURE__ */ jsx("span", { children: fmt(entry.amount) }), /* @__PURE__ */ jsx("button", {
								className: "rfp-btn-ghost",
								onClick: () => on.removePoolSizeEntry(entry.id),
								children: "Remove"
							})]
						}, entry.id))
					})
				]
			}),
			/* @__PURE__ */ jsx("hr", { className: "rfp-divider" }),
			/* @__PURE__ */ jsxs("div", {
				className: "rfp-col",
				children: [
					/* @__PURE__ */ jsx("span", {
						className: "rfp-label",
						children: "Per-grant bounds (min / max)"
					}),
					/* @__PURE__ */ jsx("p", {
						className: "rfp-hint",
						children: "The smallest and largest grant a single applicant can receive from this pool. Saving replaces current bounds."
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "rfp-grid-2",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "rfp-row",
							children: [/* @__PURE__ */ jsx("input", {
								className: "rfp-input",
								type: "number",
								step: "any",
								value: minValue,
								onChange: (e) => setMinValue(e.target.value),
								placeholder: "Min"
							}), /* @__PURE__ */ jsx("input", {
								className: "rfp-input",
								style: { maxWidth: 100 },
								value: minUnit,
								onChange: (e) => setMinUnit(e.target.value),
								placeholder: "USD"
							})]
						}), /* @__PURE__ */ jsxs("div", {
							className: "rfp-row",
							children: [/* @__PURE__ */ jsx("input", {
								className: "rfp-input",
								type: "number",
								step: "any",
								value: maxValue,
								onChange: (e) => setMaxValue(e.target.value),
								placeholder: "Max"
							}), /* @__PURE__ */ jsx("input", {
								className: "rfp-input",
								style: { maxWidth: 100 },
								value: maxUnit,
								onChange: (e) => setMaxUnit(e.target.value),
								placeholder: "USD"
							})]
						})]
					}),
					/* @__PURE__ */ jsx("button", {
						className: "rfp-btn-secondary",
						disabled: !minValue.trim() || !maxValue.trim(),
						onClick: () => {
							const mv = parseFloat(minValue);
							const Mv = parseFloat(maxValue);
							if (Number.isFinite(mv) && Number.isFinite(Mv)) on.setGrantBounds(mv, minUnit.trim() || "USD", Mv, maxUnit.trim() || "USD");
						},
						style: { alignSelf: "flex-start" },
						children: "Save bounds"
					}),
					state.minGrant.length > 0 || state.maxGrant.length > 0 ? /* @__PURE__ */ jsxs("div", {
						className: "rfp-hint",
						children: [
							"Current: min ",
							fmt(state.minGrant[0]?.amount),
							" · max",
							" ",
							fmt(state.maxGrant[0]?.amount)
						]
					}) : null
				]
			})
		]
	});
}
//#endregion
//#region editors/grant-pool-editor/components/PoolSchedule.tsx
function toLocalInputValue(iso) {
	if (!iso) return "";
	const d = new Date(iso);
	if (Number.isNaN(d.getTime())) return "";
	return d.toISOString().slice(0, 16);
}
function PoolSchedule({ state, on }) {
	return /* @__PURE__ */ jsxs("section", {
		className: "rfp-card rfp-section",
		children: [
			/* @__PURE__ */ jsx("h2", {
				className: "rfp-section-subtitle",
				children: "Schedule"
			}),
			/* @__PURE__ */ jsx("hr", { className: "rfp-divider" }),
			/* @__PURE__ */ jsxs("div", {
				className: "rfp-grid-2",
				children: [/* @__PURE__ */ jsxs("label", {
					className: "rfp-field",
					children: [/* @__PURE__ */ jsx("span", {
						className: "rfp-label",
						children: "Opens"
					}), /* @__PURE__ */ jsx("input", {
						className: "rfp-input",
						type: "datetime-local",
						defaultValue: toLocalInputValue(state.openDate),
						onBlur: (e) => {
							if (e.target.value) on.setOpenDate(new Date(e.target.value).toISOString());
						}
					})]
				}), /* @__PURE__ */ jsxs("label", {
					className: "rfp-field",
					children: [/* @__PURE__ */ jsx("span", {
						className: "rfp-label",
						children: "Closes"
					}), /* @__PURE__ */ jsx("input", {
						className: "rfp-input",
						type: "datetime-local",
						defaultValue: toLocalInputValue(state.closeDate),
						onBlur: (e) => {
							if (e.target.value) on.setCloseDate(new Date(e.target.value).toISOString());
						}
					})]
				})]
			})
		]
	});
}
//#endregion
//#region editors/grant-pool-editor/components/PoolCriteria.tsx
function PoolCriteria({ state, on }) {
	return /* @__PURE__ */ jsxs("section", {
		className: "rfp-card rfp-section",
		children: [
			/* @__PURE__ */ jsx("h2", {
				className: "rfp-section-subtitle",
				children: "Criteria"
			}),
			/* @__PURE__ */ jsx("hr", { className: "rfp-divider" }),
			/* @__PURE__ */ jsxs("label", {
				className: "rfp-field",
				children: [/* @__PURE__ */ jsx("span", {
					className: "rfp-label",
					children: "Eligibility"
				}), /* @__PURE__ */ jsx("textarea", {
					className: "rfp-textarea",
					defaultValue: state.eligibilityCriteria ?? "",
					placeholder: "Who may apply (e.g. individuals + teams, open-source only, EU residents only, etc.)",
					onBlur: (e) => on.setEligibility(e.target.value.trim())
				})]
			}),
			/* @__PURE__ */ jsxs("label", {
				className: "rfp-field",
				children: [/* @__PURE__ */ jsx("span", {
					className: "rfp-label",
					children: "Evaluation"
				}), /* @__PURE__ */ jsx("textarea", {
					className: "rfp-textarea",
					defaultValue: state.evaluationCriteria ?? "",
					placeholder: "How applications will be scored (technical merit, impact, alignment, budget fit, etc.)",
					onBlur: (e) => on.setEvaluation(e.target.value.trim())
				})]
			})
		]
	});
}
//#endregion
//#region editors/grant-pool-editor/components/PoolCredentials.tsx
function PoolCredentials({ state, on }) {
	const [draft, setDraft] = useState("");
	const add = () => {
		const v = draft.trim();
		if (!v) return;
		on.addRequiredCredential(v);
		setDraft("");
	};
	return /* @__PURE__ */ jsxs("section", {
		className: "rfp-card rfp-section",
		children: [
			/* @__PURE__ */ jsx("h2", {
				className: "rfp-section-subtitle",
				children: "Required credentials"
			}),
			/* @__PURE__ */ jsx("hr", { className: "rfp-divider" }),
			/* @__PURE__ */ jsxs("p", {
				className: "rfp-hint",
				children: [
					"Applicant must hold these attestations (e.g.",
					" ",
					/* @__PURE__ */ jsx("code", { children: "IdentityVerification" }),
					", ",
					/* @__PURE__ */ jsx("code", { children: "DAOContributor" }),
					")."
				]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "rfp-row",
				children: [/* @__PURE__ */ jsx("input", {
					className: "rfp-input",
					style: { flex: 1 },
					value: draft,
					onChange: (e) => setDraft(e.target.value),
					placeholder: "Credential name",
					onKeyDown: (e) => {
						if (e.key === "Enter") {
							e.preventDefault();
							add();
						}
					}
				}), /* @__PURE__ */ jsx("button", {
					className: "rfp-btn-secondary",
					onClick: add,
					disabled: !draft.trim(),
					children: "Add"
				})]
			}),
			state.requiredCredentials.length === 0 ? /* @__PURE__ */ jsx("div", {
				className: "rfp-empty",
				children: "No credentials required."
			}) : /* @__PURE__ */ jsx("div", {
				className: "rfp-row",
				style: {
					flexWrap: "wrap",
					gap: 8
				},
				children: state.requiredCredentials.map((c) => /* @__PURE__ */ jsxs("span", {
					className: "rfp-chip",
					children: [c, /* @__PURE__ */ jsx("button", {
						className: "rfp-chip-close",
						onClick: () => on.removeRequiredCredential(c),
						"aria-label": `Remove ${c}`,
						children: "×"
					})]
				}, c))
			})
		]
	});
}
//#endregion
//#region editors/grant-pool-editor/components/PoolContextDocuments.tsx
function PoolContextDocuments({ state, on }) {
	const [name, setName] = useState("");
	const [url, setUrl] = useState("");
	const add = () => {
		if (!name.trim() || !url.trim()) return;
		on.addContextDocument(name.trim(), url.trim());
		setName("");
		setUrl("");
	};
	return /* @__PURE__ */ jsxs("section", {
		className: "rfp-card rfp-section",
		children: [
			/* @__PURE__ */ jsx("h2", {
				className: "rfp-section-subtitle",
				children: "Context documents"
			}),
			/* @__PURE__ */ jsx("hr", { className: "rfp-divider" }),
			/* @__PURE__ */ jsx("p", {
				className: "rfp-hint",
				children: "Supplementary PDFs, templates, or reference URLs applicants should read."
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "rfp-row",
				children: [
					/* @__PURE__ */ jsx("input", {
						className: "rfp-input",
						style: { maxWidth: 220 },
						value: name,
						onChange: (e) => setName(e.target.value),
						placeholder: "Document name"
					}),
					/* @__PURE__ */ jsx("input", {
						className: "rfp-input",
						style: { flex: 1 },
						value: url,
						onChange: (e) => setUrl(e.target.value),
						placeholder: "https://…"
					}),
					/* @__PURE__ */ jsx("button", {
						className: "rfp-btn-secondary",
						onClick: add,
						disabled: !name.trim() || !url.trim(),
						children: "Add"
					})
				]
			}),
			state.contextDocuments.length === 0 ? /* @__PURE__ */ jsx("div", {
				className: "rfp-empty",
				children: "No context documents yet."
			}) : /* @__PURE__ */ jsx("ul", {
				className: "rfp-list",
				children: state.contextDocuments.map((doc) => /* @__PURE__ */ jsxs("li", {
					className: "rfp-list-item",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "rfp-col",
						style: {
							gap: 2,
							flex: 1
						},
						children: [/* @__PURE__ */ jsx("strong", { children: doc.name }), /* @__PURE__ */ jsxs("a", {
							href: doc.url,
							target: "_blank",
							rel: "noreferrer",
							className: "rfp-hint",
							children: [doc.url, " ↗"]
						})]
					}), /* @__PURE__ */ jsx("button", {
						className: "rfp-btn-ghost",
						onClick: () => on.removeContextDocument(doc.id),
						children: "Remove"
					})]
				}, doc.id))
			})
		]
	});
}
//#endregion
//#region editors/grant-pool-editor/components/PoolClassification.tsx
function ChipList({ label, hint, items, onAdd, onRemove, placeholder }) {
	const [draft, setDraft] = useState("");
	const commit = () => {
		const v = draft.trim();
		if (!v) return;
		onAdd(v);
		setDraft("");
	};
	return /* @__PURE__ */ jsxs("div", {
		className: "rfp-col",
		children: [
			/* @__PURE__ */ jsx("span", {
				className: "rfp-label",
				children: label
			}),
			/* @__PURE__ */ jsx("p", {
				className: "rfp-hint",
				children: hint
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "rfp-row",
				children: [/* @__PURE__ */ jsx("input", {
					className: "rfp-input",
					style: { flex: 1 },
					value: draft,
					onChange: (e) => setDraft(e.target.value),
					placeholder,
					onKeyDown: (e) => {
						if (e.key === "Enter") {
							e.preventDefault();
							commit();
						}
					}
				}), /* @__PURE__ */ jsx("button", {
					className: "rfp-btn-secondary",
					onClick: commit,
					children: "Add"
				})]
			}),
			items.length === 0 ? /* @__PURE__ */ jsx("div", {
				className: "rfp-empty",
				children: "None yet."
			}) : /* @__PURE__ */ jsx("div", {
				className: "rfp-row",
				style: {
					flexWrap: "wrap",
					gap: 8
				},
				children: items.map((v) => /* @__PURE__ */ jsxs("span", {
					className: "rfp-chip",
					children: [v, /* @__PURE__ */ jsx("button", {
						className: "rfp-chip-close",
						onClick: () => onRemove(v),
						"aria-label": `Remove ${v}`,
						children: "×"
					})]
				}, v))
			})
		]
	});
}
function PoolClassification({ state, on }) {
	return /* @__PURE__ */ jsxs("section", {
		className: "rfp-card rfp-section",
		children: [
			/* @__PURE__ */ jsx("h2", {
				className: "rfp-section-subtitle",
				children: "Classification"
			}),
			/* @__PURE__ */ jsx("hr", { className: "rfp-divider" }),
			/* @__PURE__ */ jsx(ChipList, {
				label: "Categories",
				hint: "Topic/focus area (e.g. infrastructure, research, education).",
				items: state.categories,
				onAdd: on.addCategory,
				onRemove: on.removeCategory,
				placeholder: "Add a category…"
			}),
			/* @__PURE__ */ jsx(ChipList, {
				label: "Ecosystems",
				hint: "Blockchain/protocol ecosystems this pool applies to.",
				items: state.ecosystems,
				onAdd: on.addEcosystem,
				onRemove: on.removeEcosystem,
				placeholder: "e.g. ethereum, optimism, arbitrum"
			}),
			/* @__PURE__ */ jsx(ChipList, {
				label: "Tags",
				hint: "Free-form labels.",
				items: state.tags,
				onAdd: on.addTag,
				onRemove: on.removeTag,
				placeholder: "Add a tag…"
			})
		]
	});
}
//#endregion
//#region editors/grant-pool-editor/components/PoolSameAs.tsx
function PoolSameAs({ state, on }) {
	const [draft, setDraft] = useState("");
	const add = () => {
		const v = draft.trim();
		if (!v) return;
		on.addSameAs(v);
		setDraft("");
	};
	return /* @__PURE__ */ jsxs("section", {
		className: "rfp-card rfp-section",
		children: [
			/* @__PURE__ */ jsx("h2", {
				className: "rfp-section-subtitle",
				children: "Identity links (schema.org sameAs)"
			}),
			/* @__PURE__ */ jsx("hr", { className: "rfp-divider" }),
			/* @__PURE__ */ jsx("p", {
				className: "rfp-hint",
				children: "Canonical pool pages on external sites (Gitcoin round URL, program page, etc.) for identity disambiguation."
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "rfp-row",
				children: [/* @__PURE__ */ jsx("input", {
					className: "rfp-input",
					style: { flex: 1 },
					value: draft,
					onChange: (e) => setDraft(e.target.value),
					placeholder: "https://…",
					onKeyDown: (e) => {
						if (e.key === "Enter") {
							e.preventDefault();
							add();
						}
					}
				}), /* @__PURE__ */ jsx("button", {
					className: "rfp-btn-secondary",
					onClick: add,
					disabled: !draft.trim(),
					children: "Add"
				})]
			}),
			state.sameAs.length === 0 ? /* @__PURE__ */ jsx("div", {
				className: "rfp-empty",
				children: "No identity links yet."
			}) : /* @__PURE__ */ jsx("ul", {
				className: "rfp-list",
				children: state.sameAs.map((url) => /* @__PURE__ */ jsxs("li", {
					className: "rfp-list-item",
					children: [/* @__PURE__ */ jsx("a", {
						href: url,
						target: "_blank",
						rel: "noreferrer",
						style: {
							color: "inherit",
							textDecoration: "none"
						},
						children: url
					}), /* @__PURE__ */ jsx("button", {
						className: "rfp-btn-ghost",
						onClick: () => on.removeSameAs(url),
						children: "Remove"
					})]
				}, url))
			})
		]
	});
}
//#endregion
//#region editors/grant-pool-editor/components/PoolReviewers.tsx
function PoolReviewers({ state, on }) {
	const [did, setDid] = useState("");
	const [name, setName] = useState("");
	const [scope, setScope] = useState("INTERNAL");
	const [kind, setKind] = useState("HUMAN");
	const add = () => {
		if (!did.trim() || !name.trim()) return;
		on.addReviewer(did.trim(), scope, kind, name.trim());
		setDid("");
		setName("");
	};
	return /* @__PURE__ */ jsxs("section", {
		className: "rfp-card rfp-section",
		children: [
			/* @__PURE__ */ jsx("h2", {
				className: "rfp-section-subtitle",
				children: "Invited reviewers"
			}),
			/* @__PURE__ */ jsx("hr", { className: "rfp-divider" }),
			/* @__PURE__ */ jsx("p", {
				className: "rfp-hint",
				children: "Reviewers who can score applications. Internal = part of the funder team; external = outside experts or AI agents."
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "rfp-grid-2",
				children: [/* @__PURE__ */ jsx("input", {
					className: "rfp-input",
					value: name,
					onChange: (e) => setName(e.target.value),
					placeholder: "Reviewer name"
				}), /* @__PURE__ */ jsx("input", {
					className: "rfp-input",
					value: did,
					onChange: (e) => setDid(e.target.value),
					placeholder: "did:pkh:eip155:1:0x…"
				})]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "rfp-row",
				children: [
					/* @__PURE__ */ jsxs("select", {
						className: "rfp-select",
						style: { maxWidth: 160 },
						value: scope,
						onChange: (e) => setScope(e.target.value),
						children: [/* @__PURE__ */ jsx("option", {
							value: "INTERNAL",
							children: "Internal"
						}), /* @__PURE__ */ jsx("option", {
							value: "EXTERNAL",
							children: "External"
						})]
					}),
					/* @__PURE__ */ jsxs("select", {
						className: "rfp-select",
						style: { maxWidth: 160 },
						value: kind,
						onChange: (e) => setKind(e.target.value),
						children: [
							/* @__PURE__ */ jsx("option", {
								value: "HUMAN",
								children: "Human"
							}),
							/* @__PURE__ */ jsx("option", {
								value: "GROUP",
								children: "Group"
							}),
							/* @__PURE__ */ jsx("option", {
								value: "AI",
								children: "AI"
							})
						]
					}),
					/* @__PURE__ */ jsx("button", {
						className: "rfp-btn-secondary",
						onClick: add,
						disabled: !did.trim() || !name.trim(),
						children: "Add reviewer"
					})
				]
			}),
			state.reviewers.length === 0 ? /* @__PURE__ */ jsx("div", {
				className: "rfp-empty",
				children: "No reviewers invited yet."
			}) : /* @__PURE__ */ jsx("ul", {
				className: "rfp-list",
				children: state.reviewers.map((r) => /* @__PURE__ */ jsxs("li", {
					className: "rfp-list-item",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "rfp-col",
						style: {
							gap: 4,
							flex: 1
						},
						children: [/* @__PURE__ */ jsxs("div", {
							className: "rfp-row",
							style: { gap: 8 },
							children: [
								/* @__PURE__ */ jsx("strong", { children: r.name }),
								/* @__PURE__ */ jsx("span", {
									className: "rfp-chip",
									children: r.scope.toLowerCase()
								}),
								/* @__PURE__ */ jsx("span", {
									className: "rfp-chip",
									children: r.reviewerType.toLowerCase()
								})
							]
						}), /* @__PURE__ */ jsx("div", {
							className: "rfp-hint",
							children: r.did
						})]
					}), /* @__PURE__ */ jsx("button", {
						className: "rfp-btn-ghost",
						onClick: () => on.removeReviewer(r.id),
						children: "Remove"
					})]
				}, r.id))
			})
		]
	});
}
//#endregion
//#region editors/grant-pool-editor/components/PoolProvenance.tsx
function PoolProvenance({ state, on }) {
	const [submitterType, setSubmitterType] = useState("VERIFIED_PUBLISHER");
	const [submitterId, setSubmitterId] = useState("");
	const [publisherId, setPublisherId] = useState("");
	const [verifierDid, setVerifierDid] = useState("");
	const [verMethod, setVerMethod] = useState("MANUAL_REVIEW");
	const [supersedes, setSupersedes] = useState("");
	const [claimedFrom, setClaimedFrom] = useState("");
	const [duplicateOf, setDuplicateOf] = useState("");
	return /* @__PURE__ */ jsxs("section", {
		className: "rfp-card rfp-section",
		children: [
			/* @__PURE__ */ jsx("h2", {
				className: "rfp-section-subtitle",
				children: "Provenance & lineage"
			}),
			/* @__PURE__ */ jsx("hr", { className: "rfp-divider" }),
			/* @__PURE__ */ jsxs("div", {
				className: "rfp-grid-2",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "rfp-field",
					children: [/* @__PURE__ */ jsx("span", {
						className: "rfp-label",
						children: "Submitter"
					}), /* @__PURE__ */ jsx("div", {
						className: "rfp-hint",
						children: state.submitter ? /* @__PURE__ */ jsxs(Fragment, { children: [
							/* @__PURE__ */ jsx("span", {
								className: "rfp-chip",
								children: state.submitter.type.toLowerCase().replace(/_/g, " ")
							}),
							/* @__PURE__ */ jsx("div", {
								style: { marginTop: 4 },
								children: state.submitter.identifier
							}),
							/* @__PURE__ */ jsx("div", { children: new Date(state.submitter.submittedAt).toLocaleString() })
						] }) : "—"
					})]
				}), /* @__PURE__ */ jsxs("div", {
					className: "rfp-field",
					children: [/* @__PURE__ */ jsx("span", {
						className: "rfp-label",
						children: "Publisher"
					}), /* @__PURE__ */ jsx("div", {
						className: "rfp-hint",
						children: state.publisher ? /* @__PURE__ */ jsxs(Fragment, { children: [state.publisher.identifier, /* @__PURE__ */ jsx("div", { children: new Date(state.publisher.publishedAt).toLocaleString() })] }) : "—"
					})]
				})]
			}),
			state.lastVerifiedAt ? /* @__PURE__ */ jsxs("div", {
				className: "rfp-field",
				children: [/* @__PURE__ */ jsx("span", {
					className: "rfp-label",
					children: "Last verified"
				}), /* @__PURE__ */ jsxs("div", {
					className: "rfp-hint",
					children: [
						new Date(state.lastVerifiedAt).toLocaleString(),
						state.verificationMethod ? ` · via ${state.verificationMethod.toLowerCase().replace(/_/g, " ")}` : "",
						state.verifiedBy ? ` · by ${state.verifiedBy}` : ""
					]
				})]
			}) : null,
			/* @__PURE__ */ jsx("hr", { className: "rfp-divider" }),
			/* @__PURE__ */ jsxs("div", {
				className: "rfp-col",
				children: [/* @__PURE__ */ jsx("span", {
					className: "rfp-label",
					children: "Set submitter"
				}), /* @__PURE__ */ jsxs("div", {
					className: "rfp-row",
					children: [
						/* @__PURE__ */ jsxs("select", {
							className: "rfp-select",
							style: { maxWidth: 180 },
							value: submitterType,
							onChange: (e) => setSubmitterType(e.target.value),
							children: [
								/* @__PURE__ */ jsx("option", {
									value: "COMMUNITY",
									children: "Community"
								}),
								/* @__PURE__ */ jsx("option", {
									value: "VERIFIED_PUBLISHER",
									children: "Verified publisher"
								}),
								/* @__PURE__ */ jsx("option", {
									value: "AUTOMATION",
									children: "Automation"
								})
							]
						}),
						/* @__PURE__ */ jsx("input", {
							className: "rfp-input",
							style: { flex: 1 },
							value: submitterId,
							onChange: (e) => setSubmitterId(e.target.value),
							placeholder: "Identifier (DID or wallet)"
						}),
						/* @__PURE__ */ jsx("button", {
							className: "rfp-btn-secondary",
							disabled: !submitterId.trim(),
							onClick: () => {
								on.setSubmitter(submitterType, submitterId.trim());
								setSubmitterId("");
							},
							children: "Save"
						})
					]
				})]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "rfp-row",
				children: [/* @__PURE__ */ jsx("input", {
					className: "rfp-input",
					style: { flex: 1 },
					value: publisherId,
					onChange: (e) => setPublisherId(e.target.value),
					placeholder: "Publisher identifier"
				}), /* @__PURE__ */ jsx("button", {
					className: "rfp-btn-secondary",
					disabled: !publisherId.trim(),
					onClick: () => {
						on.setPublisher(publisherId.trim());
						setPublisherId("");
					},
					children: "Set publisher"
				})]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "rfp-row",
				children: [
					/* @__PURE__ */ jsx("input", {
						className: "rfp-input",
						style: { flex: 1 },
						value: verifierDid,
						onChange: (e) => setVerifierDid(e.target.value),
						placeholder: "Verifier DID"
					}),
					/* @__PURE__ */ jsxs("select", {
						className: "rfp-select",
						style: { maxWidth: 220 },
						value: verMethod,
						onChange: (e) => setVerMethod(e.target.value),
						children: [
							/* @__PURE__ */ jsx("option", {
								value: "MANUAL_REVIEW",
								children: "Manual review"
							}),
							/* @__PURE__ */ jsx("option", {
								value: "DOMAIN_VERIFICATION",
								children: "Domain verification"
							}),
							/* @__PURE__ */ jsx("option", {
								value: "HTTP_PROBE",
								children: "HTTP probe"
							}),
							/* @__PURE__ */ jsx("option", {
								value: "REVIEWER_CONFIRMATION",
								children: "Reviewer confirmation"
							})
						]
					}),
					/* @__PURE__ */ jsx("button", {
						className: "rfp-btn-secondary",
						disabled: !verifierDid.trim(),
						onClick: () => {
							on.recordVerification(verifierDid.trim(), verMethod);
							setVerifierDid("");
						},
						children: "Record verification"
					})
				]
			}),
			/* @__PURE__ */ jsx("hr", { className: "rfp-divider" }),
			/* @__PURE__ */ jsxs("div", {
				className: "rfp-col",
				children: [
					/* @__PURE__ */ jsx("span", {
						className: "rfp-label",
						children: "Lineage"
					}),
					/* @__PURE__ */ jsx("p", {
						className: "rfp-hint",
						children: "Link this pool to related pool documents by PHID."
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "rfp-grid-2",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "rfp-field",
							children: [
								/* @__PURE__ */ jsx("span", {
									className: "rfp-label",
									children: "Supersedes"
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "rfp-hint",
									children: ["Current: ", state.supersedes ?? "—"]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "rfp-row",
									children: [/* @__PURE__ */ jsx("input", {
										className: "rfp-input",
										style: { flex: 1 },
										value: supersedes,
										onChange: (e) => setSupersedes(e.target.value),
										placeholder: "PHID of superseded pool"
									}), /* @__PURE__ */ jsx("button", {
										className: "rfp-btn-ghost",
										disabled: !supersedes.trim(),
										onClick: () => {
											on.markSupersedes(supersedes.trim());
											setSupersedes("");
										},
										children: "Set"
									})]
								})
							]
						}), /* @__PURE__ */ jsxs("div", {
							className: "rfp-field",
							children: [
								/* @__PURE__ */ jsx("span", {
									className: "rfp-label",
									children: "Claimed from entry"
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "rfp-hint",
									children: ["Current: ", state.claimedFromEntry ?? "—"]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "rfp-row",
									children: [/* @__PURE__ */ jsx("input", {
										className: "rfp-input",
										style: { flex: 1 },
										value: claimedFrom,
										onChange: (e) => setClaimedFrom(e.target.value),
										placeholder: "PHID of original community entry"
									}), /* @__PURE__ */ jsx("button", {
										className: "rfp-btn-ghost",
										disabled: !claimedFrom.trim(),
										onClick: () => {
											on.markClaimedFromEntry(claimedFrom.trim());
											setClaimedFrom("");
										},
										children: "Set"
									})]
								})
							]
						})]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "rfp-field",
						children: [
							/* @__PURE__ */ jsx("span", {
								className: "rfp-label",
								children: "Duplicate of"
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "rfp-hint",
								children: ["Current: ", state.duplicateOf ?? "—"]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "rfp-row",
								children: [/* @__PURE__ */ jsx("input", {
									className: "rfp-input",
									style: { flex: 1 },
									value: duplicateOf,
									onChange: (e) => setDuplicateOf(e.target.value),
									placeholder: "PHID of canonical pool"
								}), /* @__PURE__ */ jsx("button", {
									className: "rfp-btn-ghost",
									disabled: !duplicateOf.trim(),
									onClick: () => {
										on.markDuplicateOf(duplicateOf.trim());
										setDuplicateOf("");
									},
									children: "Set"
								})]
							})
						]
					})
				]
			})
		]
	});
}
//#endregion
//#region editors/grant-pool-editor/components/PoolPublishPanel.tsx
function PoolPublishPanel({ state, on }) {
	const lifecycle = state.lifecycle;
	const [cancelReason, setCancelReason] = useState("");
	const canPublish = state.governanceState !== "APPROVED" && lifecycle !== "CANCELLED";
	const canOpen = lifecycle === "UPCOMING";
	const canClose = lifecycle === "OPEN";
	const canAward = lifecycle === "CLOSED";
	const canCancel = lifecycle !== "CANCELLED" && lifecycle !== "AWARDED";
	return /* @__PURE__ */ jsxs("section", {
		className: "rfp-card rfp-section",
		children: [
			/* @__PURE__ */ jsx("h2", {
				className: "rfp-section-subtitle",
				children: "Lifecycle"
			}),
			/* @__PURE__ */ jsx("hr", { className: "rfp-divider" }),
			/* @__PURE__ */ jsxs("div", {
				className: "rfp-row",
				style: {
					gap: 12,
					flexWrap: "wrap"
				},
				children: [
					/* @__PURE__ */ jsx("button", {
						className: "rfp-btn-primary",
						disabled: !canPublish,
						onClick: on.publishPool,
						children: "Publish"
					}),
					/* @__PURE__ */ jsx("button", {
						className: "rfp-btn-secondary",
						disabled: !canOpen,
						onClick: () => on.advanceLifecycle("OPEN"),
						children: "Open for applications"
					}),
					/* @__PURE__ */ jsx("button", {
						className: "rfp-btn-secondary",
						disabled: !canClose,
						onClick: on.closePool,
						children: "Close"
					}),
					/* @__PURE__ */ jsx("button", {
						className: "rfp-btn-secondary",
						disabled: !canAward,
						onClick: () => on.advanceLifecycle("AWARDED"),
						children: "Mark awarded"
					}),
					/* @__PURE__ */ jsx("button", {
						className: "rfp-btn-secondary",
						disabled: !canAward,
						onClick: () => on.advanceLifecycle("NOT_AWARDED"),
						children: "Mark not awarded"
					})
				]
			}),
			canCancel ? /* @__PURE__ */ jsxs("div", {
				className: "rfp-col",
				style: { marginTop: 16 },
				children: [/* @__PURE__ */ jsx("span", {
					className: "rfp-label",
					children: "Cancel this pool"
				}), /* @__PURE__ */ jsxs("div", {
					className: "rfp-row",
					children: [/* @__PURE__ */ jsx("input", {
						className: "rfp-input",
						style: { flex: 1 },
						value: cancelReason,
						onChange: (e) => setCancelReason(e.target.value),
						placeholder: "Reason (optional)"
					}), /* @__PURE__ */ jsx("button", {
						className: "rfp-btn-ghost",
						onClick: () => {
							on.cancelPool(cancelReason.trim());
							setCancelReason("");
						},
						style: { color: "var(--rfp-error)" },
						children: "Cancel pool"
					})]
				})]
			}) : null
		]
	});
}
//#endregion
//#region editors/grant-pool-editor/components/PoolExtensions.tsx
function PoolExtensions({ state, on }) {
	const [expanded, setExpanded] = useState(false);
	return /* @__PURE__ */ jsxs("section", {
		className: "rfp-card rfp-section",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "rfp-row",
			style: { justifyContent: "space-between" },
			children: [/* @__PURE__ */ jsxs("h2", {
				className: "rfp-section-subtitle",
				children: ["DAOIP-5 extensions ", state.extensions ? "· set" : "· empty"]
			}), /* @__PURE__ */ jsx("button", {
				className: "rfp-btn-ghost",
				onClick: () => setExpanded((v) => !v),
				children: expanded ? "Hide" : "Show"
			})]
		}), expanded ? /* @__PURE__ */ jsxs(Fragment, { children: [
			/* @__PURE__ */ jsx("hr", { className: "rfp-divider" }),
			/* @__PURE__ */ jsxs("p", {
				className: "rfp-hint",
				children: [
					"JSON blob forwarded to the DAOIP-5 projection as",
					" ",
					/* @__PURE__ */ jsx("code", { children: "extensions" }),
					". Integrator-specific fields go here."
				]
			}),
			/* @__PURE__ */ jsxs("label", {
				className: "rfp-field",
				children: [/* @__PURE__ */ jsx("span", {
					className: "rfp-label",
					children: "Extensions (JSON)"
				}), /* @__PURE__ */ jsx("textarea", {
					className: "rfp-textarea",
					defaultValue: state.extensions ?? "",
					placeholder: "{\"vendorKey\": \"value\"}",
					onBlur: (e) => on.setExtensions(e.target.value),
					style: {
						fontFamily: "monospace",
						minHeight: 120
					}
				})]
			})
		] }) : null]
	});
}
//#endregion
//#region editors/grant-pool-editor/editor.tsx
function Editor() {
	const [document, dispatch] = useSelectedGrantPoolDocument();
	const setPoolName = useCallback((name) => dispatch(actions.setPoolName({ name })), [dispatch]);
	const setDescription = useCallback((description) => dispatch(actions.setDescription({ description })), [dispatch]);
	const setCode = useCallback((code) => dispatch(actions.setCode({ code })), [dispatch]);
	const setBriefingUri = useCallback((uri) => dispatch(actions.setBriefingUri({ briefingURI: uri })), [dispatch]);
	const setGrantSystemRef = useCallback((grantSystemRef) => dispatch(actions.setGrantSystemRef({ grantSystemRef })), [dispatch]);
	const setApplicationsUri = useCallback((applicationsURI) => dispatch(actions.setApplicationsUri({ applicationsURI })), [dispatch]);
	const setGovernanceUri = useCallback((governanceURI) => dispatch(actions.setGovernanceUri({ governanceURI })), [dispatch]);
	const setAttestationIssuersUri = useCallback((attestationIssuersURI) => dispatch(actions.setAttestationIssuersUri({ attestationIssuersURI })), [dispatch]);
	const setFundingMechanism = useCallback((m) => m && dispatch(actions.setFundingMechanism({ grantFundingMechanism: m })), [dispatch]);
	const setTotalPoolSizeUsd = useCallback((v) => {
		if (v.value == null || !v.unit) return;
		dispatch(actions.setTotalPoolSizeUsd({ totalGrantPoolSizeInUSD: {
			value: v.value,
			unit: v.unit
		} }));
	}, [dispatch]);
	const addPoolSizeEntry = useCallback((value, unit) => dispatch(actions.addPoolSizeEntry({
		id: generateId(),
		amount: {
			value,
			unit
		}
	})), [dispatch]);
	const removePoolSizeEntry = useCallback((id) => dispatch(actions.removePoolSizeEntry({ id })), [dispatch]);
	const setGrantBounds = useCallback((mv, mu, Mv, Mu) => dispatch(actions.setGrantBounds({
		minGrantId1: generateId(),
		minGrantAmount1: {
			value: mv,
			unit: mu
		},
		maxGrantId1: generateId(),
		maxGrantAmount1: {
			value: Mv,
			unit: Mu
		}
	})), [dispatch]);
	const setOpenDate = useCallback((d) => dispatch(actions.setOpenDate({ openDate: d })), [dispatch]);
	const setCloseDate = useCallback((d) => dispatch(actions.setCloseDate({ closeDate: d })), [dispatch]);
	useCallback((isOpen) => dispatch(actions.setIsOpen({ isOpen })), [dispatch]);
	const advanceLifecycle = useCallback((target) => dispatch(actions.advanceLifecycle({ lifecycle: target })), [dispatch]);
	const setEligibility = useCallback((v) => dispatch(actions.setEligibilityCriteria({ eligibilityCriteria: v })), [dispatch]);
	const setEvaluation = useCallback((v) => dispatch(actions.setEvaluationCriteria({ evaluationCriteria: v })), [dispatch]);
	const addRequiredCredential = useCallback((credential) => dispatch(actions.addRequiredCredential({ credential })), [dispatch]);
	const removeRequiredCredential = useCallback((credential) => dispatch(actions.removeRequiredCredential({ credential })), [dispatch]);
	const addContextDocument = useCallback((name, url) => dispatch(actions.addContextDocument({
		id: generateId(),
		name,
		url
	})), [dispatch]);
	const removeContextDocument = useCallback((id) => dispatch(actions.removeContextDocument({ id })), [dispatch]);
	const addCategory = useCallback((category) => dispatch(actions.addCategory({ category })), [dispatch]);
	const removeCategory = useCallback((category) => dispatch(actions.removeCategory({ category })), [dispatch]);
	const addEcosystem = useCallback((ecosystem) => dispatch(actions.addEcosystem({ ecosystem })), [dispatch]);
	const removeEcosystem = useCallback((ecosystem) => dispatch(actions.removeEcosystem({ ecosystem })), [dispatch]);
	const addTag = useCallback((tag) => dispatch(actions.addTag({ tag })), [dispatch]);
	const removeTag = useCallback((tag) => dispatch(actions.removeTag({ tag })), [dispatch]);
	const addSameAs = useCallback((url) => dispatch(actions.addPoolSameAs({ url })), [dispatch]);
	const removeSameAs = useCallback((url) => dispatch(actions.removePoolSameAs({ url })), [dispatch]);
	const addReviewer = useCallback((did, scope, reviewerType, name) => dispatch(actions.addReviewer({
		id: generateId(),
		did,
		scope,
		reviewerType,
		name
	})), [dispatch]);
	const removeReviewer = useCallback((id) => dispatch(actions.removeReviewer({ id })), [dispatch]);
	const setSubmitter = useCallback((type, identifier) => dispatch(actions.setSubmitter({
		type,
		identifier,
		submittedAt: (/* @__PURE__ */ new Date()).toISOString()
	})), [dispatch]);
	const setPublisher = useCallback((identifier) => dispatch(actions.setPublisher({
		identifier,
		publishedAt: (/* @__PURE__ */ new Date()).toISOString()
	})), [dispatch]);
	const recordVerification = useCallback((verifiedBy, verificationMethod) => dispatch(actions.recordVerification({
		verifiedBy,
		verificationMethod,
		verifiedAt: (/* @__PURE__ */ new Date()).toISOString()
	})), [dispatch]);
	const markSupersedes = useCallback((supersedes) => dispatch(actions.markSupersedes({ supersedes })), [dispatch]);
	const markClaimedFromEntry = useCallback((claimedFromEntry) => dispatch(actions.markClaimedFromEntry({ claimedFromEntry })), [dispatch]);
	const markDuplicateOf = useCallback((duplicateOf) => dispatch(actions.markDuplicateOf({ duplicateOf })), [dispatch]);
	const publishPool = useCallback(() => dispatch(actions.publishPool({ publishedAt: (/* @__PURE__ */ new Date()).toISOString() })), [dispatch]);
	const closePool = useCallback(() => dispatch(actions.closePool({ closedAt: (/* @__PURE__ */ new Date()).toISOString() })), [dispatch]);
	const cancelPool = useCallback((reason) => dispatch(actions.cancelPool({
		cancelledAt: (/* @__PURE__ */ new Date()).toISOString(),
		reason
	})), [dispatch]);
	const setExtensions = useCallback((extensions) => dispatch(actions.setPoolExtensions({ extensions })), [dispatch]);
	if (!document) return null;
	const state = document.state.global;
	return /* @__PURE__ */ jsxs("div", {
		className: "rfp-scope",
		children: [/* @__PURE__ */ jsx(DocumentToolbar, {}), /* @__PURE__ */ jsx("div", {
			className: "rfp-page",
			children: /* @__PURE__ */ jsxs("div", {
				className: "rfp-page-inner",
				children: [
					/* @__PURE__ */ jsx(PoolHeader, { state }),
					/* @__PURE__ */ jsx(PoolBasics, {
						state,
						on: {
							setPoolName,
							setDescription,
							setCode,
							setBriefingUri
						}
					}),
					/* @__PURE__ */ jsx(PoolReferences, {
						state,
						on: {
							setGrantSystemRef,
							setApplicationsUri,
							setGovernanceUri,
							setAttestationIssuersUri
						}
					}),
					/* @__PURE__ */ jsx(PoolFunding, {
						state,
						on: {
							setFundingMechanism,
							setTotalPoolSizeUsd
						}
					}),
					/* @__PURE__ */ jsx(PoolFundingDetails, {
						state,
						on: {
							addPoolSizeEntry,
							removePoolSizeEntry,
							setGrantBounds
						}
					}),
					/* @__PURE__ */ jsx(PoolSchedule, {
						state,
						on: {
							setOpenDate,
							setCloseDate
						}
					}),
					/* @__PURE__ */ jsx(PoolCriteria, {
						state,
						on: {
							setEligibility,
							setEvaluation
						}
					}),
					/* @__PURE__ */ jsx(PoolCredentials, {
						state,
						on: {
							addRequiredCredential,
							removeRequiredCredential
						}
					}),
					/* @__PURE__ */ jsx(PoolContextDocuments, {
						state,
						on: {
							addContextDocument,
							removeContextDocument
						}
					}),
					/* @__PURE__ */ jsx(PoolClassification, {
						state,
						on: {
							addCategory,
							removeCategory,
							addEcosystem,
							removeEcosystem,
							addTag,
							removeTag
						}
					}),
					/* @__PURE__ */ jsx(PoolSameAs, {
						state,
						on: {
							addSameAs,
							removeSameAs
						}
					}),
					/* @__PURE__ */ jsx(PoolReviewers, {
						state,
						on: {
							addReviewer,
							removeReviewer
						}
					}),
					/* @__PURE__ */ jsx(PoolProvenance, {
						state,
						on: {
							setSubmitter,
							setPublisher,
							recordVerification,
							markSupersedes,
							markClaimedFromEntry,
							markDuplicateOf
						}
					}),
					/* @__PURE__ */ jsx(PoolPublishPanel, {
						state,
						on: {
							advanceLifecycle,
							publishPool,
							closePool,
							cancelPool
						}
					}),
					/* @__PURE__ */ jsx(PoolExtensions, {
						state,
						on: { setExtensions }
					})
				]
			})
		})]
	});
}
//#endregion
export { Editor as default };

//# sourceMappingURL=editor-HqeAmop8.mjs.map