import { T as Tabs } from './Tabs-cdccf481.js';
export { a as TABS } from './Tabs-cdccf481.js';
import './Index-f62c49f9.js';
import './index-b5b16a51.js';
import './svelte/svelte.js';

/* home/runner/work/gradio/gradio/js/tabs/Index.svelte generated by Svelte v4.2.2 */
const {
	SvelteComponent,
	add_flush_callback,
	bind,
	binding_callbacks,
	create_component,
	create_slot,
	destroy_component,
	get_all_dirty_from_scope,
	get_slot_changes,
	init,
	mount_component,
	safe_not_equal,
	transition_in,
	transition_out,
	update_slot_base
} = window.__gradio__svelte__internal;
const { createEventDispatcher } = window.__gradio__svelte__internal;
function create_default_slot(ctx) {
	let current;
	const default_slot_template = /*#slots*/ ctx[5].default;
	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[9], null);

	return {
		c() {
			if (default_slot) default_slot.c();
		},
		m(target, anchor) {
			if (default_slot) {
				default_slot.m(target, anchor);
			}

			current = true;
		},
		p(ctx, dirty) {
			if (default_slot) {
				if (default_slot.p && (!current || dirty & /*$$scope*/ 512)) {
					update_slot_base(
						default_slot,
						default_slot_template,
						ctx,
						/*$$scope*/ ctx[9],
						!current
						? get_all_dirty_from_scope(/*$$scope*/ ctx[9])
						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[9], dirty, null),
						null
					);
				}
			}
		},
		i(local) {
			if (current) return;
			transition_in(default_slot, local);
			current = true;
		},
		o(local) {
			transition_out(default_slot, local);
			current = false;
		},
		d(detaching) {
			if (default_slot) default_slot.d(detaching);
		}
	};
}

function create_fragment(ctx) {
	let tabs;
	let updating_selected;
	let current;

	function tabs_selected_binding(value) {
		/*tabs_selected_binding*/ ctx[6](value);
	}

	let tabs_props = {
		visible: /*visible*/ ctx[1],
		elem_id: /*elem_id*/ ctx[2],
		elem_classes: /*elem_classes*/ ctx[3],
		$$slots: { default: [create_default_slot] },
		$$scope: { ctx }
	};

	if (/*selected*/ ctx[0] !== void 0) {
		tabs_props.selected = /*selected*/ ctx[0];
	}

	tabs = new Tabs({ props: tabs_props });
	binding_callbacks.push(() => bind(tabs, 'selected', tabs_selected_binding));
	tabs.$on("change", /*change_handler*/ ctx[7]);
	tabs.$on("select", /*select_handler*/ ctx[8]);

	return {
		c() {
			create_component(tabs.$$.fragment);
		},
		m(target, anchor) {
			mount_component(tabs, target, anchor);
			current = true;
		},
		p(ctx, [dirty]) {
			const tabs_changes = {};
			if (dirty & /*visible*/ 2) tabs_changes.visible = /*visible*/ ctx[1];
			if (dirty & /*elem_id*/ 4) tabs_changes.elem_id = /*elem_id*/ ctx[2];
			if (dirty & /*elem_classes*/ 8) tabs_changes.elem_classes = /*elem_classes*/ ctx[3];

			if (dirty & /*$$scope*/ 512) {
				tabs_changes.$$scope = { dirty, ctx };
			}

			if (!updating_selected && dirty & /*selected*/ 1) {
				updating_selected = true;
				tabs_changes.selected = /*selected*/ ctx[0];
				add_flush_callback(() => updating_selected = false);
			}

			tabs.$set(tabs_changes);
		},
		i(local) {
			if (current) return;
			transition_in(tabs.$$.fragment, local);
			current = true;
		},
		o(local) {
			transition_out(tabs.$$.fragment, local);
			current = false;
		},
		d(detaching) {
			destroy_component(tabs, detaching);
		}
	};
}

function instance($$self, $$props, $$invalidate) {
	let { $$slots: slots = {}, $$scope } = $$props;
	const dispatch = createEventDispatcher();
	let { visible = true } = $$props;
	let { elem_id = "" } = $$props;
	let { elem_classes = [] } = $$props;
	let { selected } = $$props;
	let { gradio } = $$props;

	function tabs_selected_binding(value) {
		selected = value;
		$$invalidate(0, selected);
	}

	const change_handler = () => gradio.dispatch("change");
	const select_handler = e => gradio.dispatch("select", e.detail);

	$$self.$$set = $$props => {
		if ('visible' in $$props) $$invalidate(1, visible = $$props.visible);
		if ('elem_id' in $$props) $$invalidate(2, elem_id = $$props.elem_id);
		if ('elem_classes' in $$props) $$invalidate(3, elem_classes = $$props.elem_classes);
		if ('selected' in $$props) $$invalidate(0, selected = $$props.selected);
		if ('gradio' in $$props) $$invalidate(4, gradio = $$props.gradio);
		if ('$$scope' in $$props) $$invalidate(9, $$scope = $$props.$$scope);
	};

	$$self.$$.update = () => {
		if ($$self.$$.dirty & /*selected*/ 1) {
			dispatch("prop_change", { selected });
		}
	};

	return [
		selected,
		visible,
		elem_id,
		elem_classes,
		gradio,
		slots,
		tabs_selected_binding,
		change_handler,
		select_handler,
		$$scope
	];
}

class Index extends SvelteComponent {
	constructor(options) {
		super();

		init(this, options, instance, create_fragment, safe_not_equal, {
			visible: 1,
			elem_id: 2,
			elem_classes: 3,
			selected: 0,
			gradio: 4
		});
	}
}

export { Index as default };
//# sourceMappingURL=Index-64882154.js.map
