import{S as U,i as Z,s as z,d as p,o as P,Z as F,v as G,P as H,Q as J,y as R,a3 as C,a4 as D,q as K,e as T,g as E,h as w,w as B,b as m,c as k,t as q,f as h,_ as L,$ as M,a0 as V,D as W,E as X,u as Y,a5 as x,k as A,l as $,n as ee}from"./index.e648a11b.js";const y="Users/aliabid/projects/gradio/ui/packages/tabs/src/Tabs.svelte";function N(s,e,c){const r=s.slice();return r[10]=e[c],r[12]=c,r}function I(s){let e,c=s[10].name+"",r,l,d,t;function a(){return s[8](s[10])}const o={c:function(){e=w("button"),r=A(c),l=B(),m(e,"class","px-4 pb-2 pt-1.5 border-transparent text-gray-400 hover:text-gray-700 -mb-[2px] border-2 border-b-0"),k(e,y,43,4,1199)},m:function(u,i){T(u,e,i),h(e,r),h(e,l),d||(t=$(e,"click",a,!1,!1,!1),d=!0)},p:function(u,i){s=u},d:function(u){u&&E(e),d=!1,t()}};return p("SvelteRegisterBlock",{block:o,id:I.name,type:"else",source:"(43:3) {:else}",ctx:s}),o}function Q(s){let e,c=s[10].name+"",r,l;const d={c:function(){e=w("button"),r=A(c),l=B(),m(e,"class","bg-white px-4 pb-2 pt-1.5 rounded-t-lg border-gray-200 -mb-[2px] border-2 border-b-0"),k(e,y,37,4,1044)},m:function(a,o){T(a,e,o),h(e,r),h(e,l)},p:ee,d:function(a){a&&E(e)}};return p("SvelteRegisterBlock",{block:d,id:Q.name,type:"if",source:"(37:3) {#if t.id === $selected_tab}",ctx:s}),d}function S(s){let e;function c(t,a){return t[10].id===t[2]?Q:I}let r=c(s),l=r(s);const d={c:function(){l.c(),e=K()},m:function(a,o){l.m(a,o),T(a,e,o)},p:function(a,o){r===(r=c(a))&&l?l.p(a,o):(l.d(1),l=r(a),l&&(l.c(),l.m(e.parentNode,e)))},d:function(a){l.d(a),a&&E(e)}};return p("SvelteRegisterBlock",{block:d,id:S.name,type:"each",source:"(36:2) {#each tabs as t, i}",ctx:s}),d}function j(s){let e,c,r,l,d=s[3];P(d);let t=[];for(let u=0;u<d.length;u+=1)t[u]=S(N(s,d,u));const a=s[7].default,o=F(a,s,s[6],null),_={c:function(){e=w("div"),c=w("div");for(let i=0;i<t.length;i+=1)t[i].c();r=B(),o&&o.c(),m(c,"class","flex border-b-2 dark:border-gray-700"),k(c,y,34,1,934),m(e,"class","tabs flex flex-col my-4"),m(e,"id",s[0]),q(e,"hidden",s[1]===!1),k(e,y,29,0,845)},l:function(i){throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option")},m:function(i,b){T(i,e,b),h(e,c);for(let f=0;f<t.length;f+=1)t[f].m(c,null);h(e,r),o&&o.m(e,null),l=!0},p:function(i,[b]){if(b&44){d=i[3],P(d);let f;for(f=0;f<d.length;f+=1){const n=N(i,d,f);t[f]?t[f].p(n,b):(t[f]=S(n),t[f].c(),t[f].m(c,null))}for(;f<t.length;f+=1)t[f].d(1);t.length=d.length}o&&o.p&&(!l||b&64)&&L(o,a,i,i[6],l?V(a,i[6],b,null):M(i[6]),null),(!l||b&1)&&m(e,"id",i[0]),b&2&&q(e,"hidden",i[1]===!1)},i:function(i){l||(W(o,i),l=!0)},o:function(i){X(o,i),l=!1},d:function(i){i&&E(e),Y(t,i),o&&o.d(i)}};return p("SvelteRegisterBlock",{block:_,id:j.name,type:"component",source:"",ctx:s}),_}const O={};function te(s,e,c){let r,{$$slots:l={},$$scope:d}=e;G("Tabs",l,["default"]);let{elem_id:t=""}=e,{visible:a=!0}=e;const o=[],_=D(!1);H(_,"selected_tab"),J(s,_,n=>c(2,r=n));const u=R();C(O,{register_tab:n=>{o.push({name:n.name,id:n.id}),_.update(v=>v||n.id)},unregister_tab:n=>{const v=o.findIndex(g=>g.id===n.id);o.splice(v,1),_.update(g=>g===n.id?o[v]?.id||o[o.length-1]?.id:g)},selected_tab:_});function i(n){x(_,r=n,r),u("change")}const b=["elem_id","visible"];Object.keys(e).forEach(n=>{!~b.indexOf(n)&&n.slice(0,2)!=="$$"&&n!=="slot"&&console.warn(`<Tabs> was created with unknown prop '${n}'`)});const f=n=>i(n.id);return s.$$set=n=>{"elem_id"in n&&c(0,t=n.elem_id),"visible"in n&&c(1,a=n.visible),"$$scope"in n&&c(6,d=n.$$scope)},s.$capture_state=()=>({TABS:O,setContext:C,createEventDispatcher:R,writable:D,elem_id:t,visible:a,tabs:o,selected_tab:_,dispatch:u,handle_click:i,$selected_tab:r}),s.$inject_state=n=>{"elem_id"in n&&c(0,t=n.elem_id),"visible"in n&&c(1,a=n.visible)},e&&"$$inject"in e&&s.$inject_state(e.$$inject),[t,a,r,o,_,i,d,l,f]}class se extends U{constructor(e){super(e),Z(this,e,te,j,z,{elem_id:0,visible:1}),p("SvelteRegisterComponent",{component:this,tagName:"Tabs",options:e,id:j.name})}get elem_id(){throw new Error("<Tabs>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'")}set elem_id(e){throw new Error("<Tabs>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'")}get visible(){throw new Error("<Tabs>: Props cannot be read directly from the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'")}set visible(e){throw new Error("<Tabs>: Props cannot be set directly on the component instance unless compiling with 'accessors: true' or '<svelte:options accessors/>'")}}export{se as T,O as a};
