import { __name } from "./chunk-AGHRB4JF.js";
import { lineBreakRegex } from "./chunk-ABZYJK2D.js";
import { require_dist } from "../../../../@braintree/sanitize-url/dist/index.js";
var import_dist = require_dist(), drawRect = /* @__PURE__ */ __name((e, a) => {
	let o = e.append("rect");
	if (o.attr("x", a.x), o.attr("y", a.y), o.attr("fill", a.fill), o.attr("stroke", a.stroke), o.attr("width", a.width), o.attr("height", a.height), a.name && o.attr("name", a.name), a.rx && o.attr("rx", a.rx), a.ry && o.attr("ry", a.ry), a.attrs !== void 0) for (let e in a.attrs) o.attr(e, a.attrs[e]);
	return a.class && o.attr("class", a.class), o;
}, "drawRect"), drawBackgroundRect = /* @__PURE__ */ __name((e, a) => {
	drawRect(e, {
		x: a.startx,
		y: a.starty,
		width: a.stopx - a.startx,
		height: a.stopy - a.starty,
		fill: a.fill,
		stroke: a.stroke,
		class: "rect"
	}).lower();
}, "drawBackgroundRect"), drawText = /* @__PURE__ */ __name((e, o) => {
	let s = o.text.replace(lineBreakRegex, " "), c = e.append("text");
	c.attr("x", o.x), c.attr("y", o.y), c.attr("class", "legend"), c.style("text-anchor", o.anchor), o.class && c.attr("class", o.class);
	let l = c.append("tspan");
	return l.attr("x", o.x + o.textMargin * 2), l.text(s), c;
}, "drawText"), drawImage = /* @__PURE__ */ __name((e, a, o, c) => {
	let l = e.append("image");
	l.attr("x", a), l.attr("y", o);
	let u = (0, import_dist.sanitizeUrl)(c);
	l.attr("xlink:href", u);
}, "drawImage"), drawEmbeddedImage = /* @__PURE__ */ __name((e, a, o, c) => {
	let l = e.append("use");
	l.attr("x", a), l.attr("y", o);
	let u = (0, import_dist.sanitizeUrl)(c);
	l.attr("xlink:href", `#${u}`);
}, "drawEmbeddedImage"), getNoteRect = /* @__PURE__ */ __name(() => ({
	x: 0,
	y: 0,
	width: 100,
	height: 100,
	fill: "#EDF2AE",
	stroke: "#666",
	anchor: "start",
	rx: 0,
	ry: 0
}), "getNoteRect"), getTextObj = /* @__PURE__ */ __name(() => ({
	x: 0,
	y: 0,
	width: 100,
	height: 100,
	"text-anchor": "start",
	style: "#666",
	textMargin: 0,
	rx: 0,
	ry: 0,
	tspan: !0
}), "getTextObj");
export { drawBackgroundRect, drawEmbeddedImage, drawImage, drawRect, drawText, getNoteRect, getTextObj };
