import { n as __exportAll } from "./chunk-B-1-B7_t.js";
import { c as ComboboxAnchor_default, i as ComboboxInput_default, l as Combobox_default, n as ComboboxItemIndicator_default, o as ComboboxEmpty_default, r as ComboboxItem_default, s as ComboboxContent_default } from "./combobox-D0Svg8GU.js";
import { t as FieldFrame_default } from "./field-frame-DhCOWcMP.js";
import { Fragment, computed, createBlock, createElementBlock, createTextVNode, createVNode, defineComponent, mergeModels, openBlock, ref, renderList, toDisplayString, unref, useModel, withCtx } from "vue";
import { Globe } from "@lucide/vue";
//#region src/components/compositions/elements/picker/TimezonePicker.vue?vue&type=script&setup=true&lang.ts
var TimezonePicker_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
	__name: "TimezonePicker",
	props: /* @__PURE__ */ mergeModels({
		modelValue: {},
		id: {},
		name: {},
		label: {},
		hideLabel: { type: Boolean },
		placeholder: {},
		required: { type: Boolean },
		readonly: { type: Boolean },
		disabled: { type: Boolean },
		helpText: {},
		errors: { default: () => [] }
	}, {
		"modelValue": {},
		"modelModifiers": {}
	}),
	emits: ["update:modelValue"],
	setup(__props) {
		/**
		* Props-driven timezone picker composition. Searchable combobox over
		* every IANA timezone reported by the runtime (`Intl.supportedValuesOf`).
		* Falls back to a curated list when `Intl.supportedValuesOf` is missing
		* (older jsdom).
		*
		*   <TimezonePicker v-model="tz" label="Timezone" />
		*/
		const model = useModel(__props, "modelValue");
		const query = ref("");
		const timezones = computed(() => {
			const intl = Intl;
			if (typeof intl.supportedValuesOf === "function") try {
				return intl.supportedValuesOf("timeZone");
			} catch {
				return [];
			}
			return [
				"UTC",
				"America/New_York",
				"America/Chicago",
				"America/Denver",
				"America/Los_Angeles",
				"Europe/London",
				"Europe/Paris",
				"Europe/Berlin",
				"Asia/Tokyo",
				"Asia/Shanghai",
				"Australia/Sydney"
			];
		});
		const filtered = computed(() => {
			const q = query.value.trim().toLowerCase();
			if (!q) return timezones.value.slice(0, 200);
			return timezones.value.filter((tz) => tz.toLowerCase().includes(q)).slice(0, 200);
		});
		function onSelect(value) {
			model.value = typeof value === "string" ? value : "";
		}
		return (_ctx, _cache) => {
			return openBlock(), createBlock(unref(FieldFrame_default), {
				label: __props.label,
				required: __props.required,
				"hide-label": __props.hideLabel,
				for: __props.id,
				"help-text": __props.helpText,
				errors: __props.errors
			}, {
				default: withCtx(() => [createVNode(unref(Combobox_default), {
					"model-value": model.value ?? "",
					disabled: __props.disabled,
					"onUpdate:modelValue": onSelect
				}, {
					default: withCtx(() => [createVNode(unref(ComboboxAnchor_default), {
						"data-element-name": __props.name ?? void 0,
						"data-readonly": __props.readonly || void 0
					}, {
						default: withCtx(() => [createVNode(unref(Globe), { class: "mr-2 size-4 shrink-0 opacity-50" }), createVNode(unref(ComboboxInput_default), {
							modelValue: query.value,
							"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => query.value = $event),
							placeholder: __props.placeholder ?? "Select a timezone…",
							readonly: __props.readonly,
							required: __props.required
						}, null, 8, [
							"modelValue",
							"placeholder",
							"readonly",
							"required"
						])]),
						_: 1
					}, 8, ["data-element-name", "data-readonly"]), createVNode(unref(ComboboxContent_default), null, {
						default: withCtx(() => [createVNode(unref(ComboboxEmpty_default), null, {
							default: withCtx(() => [..._cache[1] || (_cache[1] = [createTextVNode("No timezones match.", -1)])]),
							_: 1
						}), (openBlock(true), createElementBlock(Fragment, null, renderList(filtered.value, (tz) => {
							return openBlock(), createBlock(unref(ComboboxItem_default), {
								key: tz,
								value: tz
							}, {
								default: withCtx(() => [createVNode(unref(ComboboxItemIndicator_default)), createTextVNode(" " + toDisplayString(tz), 1)]),
								_: 2
							}, 1032, ["value"]);
						}), 128))]),
						_: 1
					})]),
					_: 1
				}, 8, ["model-value", "disabled"])]),
				_: 1
			}, 8, [
				"label",
				"required",
				"hide-label",
				"for",
				"help-text",
				"errors"
			]);
		};
	}
});
//#endregion
//#region src/components/compositions/elements/picker/TimezonePicker.vue
var TimezonePicker_exports = /* @__PURE__ */ __exportAll({ default: () => TimezonePicker_default });
var TimezonePicker_default = TimezonePicker_vue_vue_type_script_setup_true_lang_default;
//#endregion
export { TimezonePicker_exports as n, TimezonePicker_default as t };

//# sourceMappingURL=TimezonePicker-JOP7Z0iZ.js.map