import "./jszip-ChlR43oI.es.js";
import { A as openBlock, K as ref, O as onMounted, Q as normalizeClass, d as createBaseVNode, m as createElementBlock, o as withKeys, p as createCommentVNode, s as withModifiers, tt as toDisplayString } from "./vue-DMgTaOx9.es.js";
import { t as __plugin_vue_export_helper_default } from "./_plugin-vue_export-helper-HmhZBO0u.es.js";
var _hoisted_1 = ["onKeydown"];
var _hoisted_2 = { class: "sd-find-replace__row" };
var _hoisted_3 = { class: "sd-find-replace__input-wrap" };
var _hoisted_4 = [
	"value",
	"placeholder",
	"aria-label"
];
var _hoisted_5 = {
	key: 0,
	class: "sd-find-replace__count"
};
var _hoisted_6 = { class: "sd-find-replace__nav" };
var _hoisted_7 = [
	"disabled",
	"title",
	"aria-label"
];
var _hoisted_8 = [
	"disabled",
	"title",
	"aria-label"
];
var _hoisted_9 = ["title", "aria-label"];
var _hoisted_10 = {
	key: 0,
	class: "sd-find-replace__row"
};
var _hoisted_11 = { class: "sd-find-replace__input-wrap" };
var _hoisted_12 = [
	"value",
	"placeholder",
	"aria-label"
];
var _hoisted_13 = { class: "sd-find-replace__nav" };
var _hoisted_14 = ["disabled", "title"];
var _hoisted_15 = ["disabled", "title"];
var _hoisted_16 = { class: "sd-find-replace__options" };
var _hoisted_17 = ["title", "aria-label"];
var _hoisted_18 = ["title", "aria-label"];
var _hoisted_19 = ["title", "aria-label"];
var FindReplaceSurface_default = /* @__PURE__ */ __plugin_vue_export_helper_default({
	__name: "FindReplaceSurface",
	props: {
		surfaceId: {
			type: String,
			default: ""
		},
		mode: {
			type: String,
			default: "floating"
		},
		request: {
			type: Object,
			default: () => ({})
		},
		resolve: {
			type: Function,
			default: () => {}
		},
		close: {
			type: Function,
			default: () => {}
		},
		findReplace: {
			type: Object,
			required: true
		}
	},
	setup(__props) {
		const props = __props;
		const findInputRef = ref(null);
		function handleFindKeydown(e) {
			if (e.key === "Enter" && !e.shiftKey) {
				e.preventDefault();
				props.findReplace.goNext();
			} else if (e.key === "Enter" && e.shiftKey) {
				e.preventDefault();
				props.findReplace.goPrev();
			}
		}
		function handleClose() {
			props.findReplace.close("user-closed");
		}
		function focusFindInput() {
			findInputRef.value?.focus();
			findInputRef.value?.select();
		}
		onMounted(() => {
			findInputRef.value?.focus();
			props.findReplace.registerFocusFn(focusFindInput);
		});
		return (_ctx, _cache) => {
			return openBlock(), createElementBlock("div", {
				class: "sd-find-replace",
				onKeydown: withKeys(withModifiers(handleClose, ["stop"]), ["esc"])
			}, [
				createBaseVNode("div", _hoisted_2, [createBaseVNode("div", _hoisted_3, [createBaseVNode("input", {
					ref_key: "findInputRef",
					ref: findInputRef,
					value: __props.findReplace.findQuery.value,
					onInput: _cache[0] || (_cache[0] = ($event) => __props.findReplace.findQuery.value = $event.target.value),
					type: "text",
					class: "sd-find-replace__input",
					placeholder: __props.findReplace.texts.findPlaceholder,
					"aria-label": __props.findReplace.texts.findAriaLabel,
					onKeydown: handleFindKeydown
				}, null, 40, _hoisted_4), __props.findReplace.findQuery.value ? (openBlock(), createElementBlock("span", _hoisted_5, toDisplayString(__props.findReplace.matchLabel.value), 1)) : createCommentVNode("", true)]), createBaseVNode("div", _hoisted_6, [
					createBaseVNode("button", {
						type: "button",
						class: "sd-find-replace__btn sd-find-replace__btn--icon",
						disabled: !__props.findReplace.hasMatches.value,
						title: __props.findReplace.texts.previousMatchLabel,
						"aria-label": __props.findReplace.texts.previousMatchAriaLabel,
						onClick: _cache[1] || (_cache[1] = ($event) => __props.findReplace.goPrev())
					}, " ▲ ", 8, _hoisted_7),
					createBaseVNode("button", {
						type: "button",
						class: "sd-find-replace__btn sd-find-replace__btn--icon",
						disabled: !__props.findReplace.hasMatches.value,
						title: __props.findReplace.texts.nextMatchLabel,
						"aria-label": __props.findReplace.texts.nextMatchAriaLabel,
						onClick: _cache[2] || (_cache[2] = ($event) => __props.findReplace.goNext())
					}, " ▼ ", 8, _hoisted_8),
					createBaseVNode("button", {
						type: "button",
						class: "sd-find-replace__btn sd-find-replace__btn--icon",
						title: __props.findReplace.texts.closeLabel,
						"aria-label": __props.findReplace.texts.closeAriaLabel,
						onClick: handleClose
					}, " ✕ ", 8, _hoisted_9)
				])]),
				__props.findReplace.showReplace.value && __props.findReplace.replaceEnabled ? (openBlock(), createElementBlock("div", _hoisted_10, [createBaseVNode("div", _hoisted_11, [createBaseVNode("input", {
					value: __props.findReplace.replaceText.value,
					onInput: _cache[3] || (_cache[3] = ($event) => __props.findReplace.replaceText.value = $event.target.value),
					type: "text",
					class: "sd-find-replace__input",
					placeholder: __props.findReplace.texts.replacePlaceholder,
					"aria-label": __props.findReplace.texts.replaceAriaLabel,
					onKeydown: _cache[4] || (_cache[4] = withKeys(withModifiers(($event) => __props.findReplace.replaceCurrent(), ["prevent"]), ["enter"]))
				}, null, 40, _hoisted_12)]), createBaseVNode("div", _hoisted_13, [createBaseVNode("button", {
					type: "button",
					class: "sd-find-replace__btn sd-find-replace__btn--action",
					disabled: !__props.findReplace.hasMatches.value,
					title: __props.findReplace.texts.replaceLabel,
					onClick: _cache[5] || (_cache[5] = ($event) => __props.findReplace.replaceCurrent())
				}, toDisplayString(__props.findReplace.texts.replaceLabel), 9, _hoisted_14), createBaseVNode("button", {
					type: "button",
					class: "sd-find-replace__btn sd-find-replace__btn--action",
					disabled: !__props.findReplace.hasMatches.value,
					title: __props.findReplace.texts.replaceAllLabel,
					onClick: _cache[6] || (_cache[6] = ($event) => __props.findReplace.replaceAll())
				}, toDisplayString(__props.findReplace.texts.replaceAllLabel), 9, _hoisted_15)])])) : createCommentVNode("", true),
				createBaseVNode("div", _hoisted_16, [
					__props.findReplace.replaceEnabled ? (openBlock(), createElementBlock("button", {
						key: 0,
						type: "button",
						class: normalizeClass(["sd-find-replace__btn sd-find-replace__btn--toggle", { "sd-find-replace__btn--active": __props.findReplace.showReplace.value }]),
						title: __props.findReplace.texts.toggleReplaceLabel,
						"aria-label": __props.findReplace.texts.toggleReplaceAriaLabel,
						onClick: _cache[7] || (_cache[7] = ($event) => __props.findReplace.showReplace.value = !__props.findReplace.showReplace.value)
					}, " ⇅ ", 10, _hoisted_17)) : createCommentVNode("", true),
					createBaseVNode("button", {
						type: "button",
						class: normalizeClass(["sd-find-replace__btn sd-find-replace__btn--toggle", { "sd-find-replace__btn--active": __props.findReplace.caseSensitive.value }]),
						title: __props.findReplace.texts.matchCaseLabel,
						"aria-label": __props.findReplace.texts.matchCaseAriaLabel,
						onClick: _cache[8] || (_cache[8] = ($event) => __props.findReplace.caseSensitive.value = !__props.findReplace.caseSensitive.value)
					}, toDisplayString(__props.findReplace.texts.matchCaseLabel), 11, _hoisted_18),
					createBaseVNode("button", {
						type: "button",
						class: normalizeClass(["sd-find-replace__btn sd-find-replace__btn--toggle", { "sd-find-replace__btn--active": __props.findReplace.ignoreDiacritics.value }]),
						title: __props.findReplace.texts.ignoreDiacriticsLabel,
						"aria-label": __props.findReplace.texts.ignoreDiacriticsAriaLabel,
						onClick: _cache[9] || (_cache[9] = ($event) => __props.findReplace.ignoreDiacritics.value = !__props.findReplace.ignoreDiacritics.value)
					}, toDisplayString(__props.findReplace.texts.ignoreDiacriticsLabel), 11, _hoisted_19)
				])
			], 40, _hoisted_1);
		};
	}
}, [["__scopeId", "data-v-8c7fd9b2"]]);
export { FindReplaceSurface_default as default };
