2025-03-13 17:55:37 +01:00

3 lines
8.2 KiB
JavaScript

import{B as V}from"./Block-DZqtZLFP.js";import{B as W}from"./BlockTitle-BIcnzvtg.js";import"./IconButtonWrapper.svelte_svelte_type_style_lang-BOpxTcdu.js";import"./MarkdownCode.svelte_svelte_type_style_lang-3tofWDHK.js";import{S as X}from"./index-B1gfMDT9.js";import"./StreamingBar.svelte_svelte_type_style_lang-CDNxkBIr.js";import{default as Ye}from"./Example-BoMLuz1A.js";import"./Info-DcCn6tHi.js";import"./MarkdownCode-DJM7o_VY.js";import"./prism-python-qapVsvY8.js";import"./index-C7PS0jJm.js";import"./svelte/svelte.js";import"./IconButton-B-aAVSzy.js";import"./Clear-By3xiIwg.js";const{SvelteComponent:Y,append:C,attr:k,detach:Z,element:T,flush:E,init:y,init_binding_group:p,insert:$,listen:x,noop:F,safe_not_equal:ee,set_data:te,set_input_value:G,space:le,text:ie,toggle_class:R}=window.__gradio__svelte__internal,{createEventDispatcher:se}=window.__gradio__svelte__internal;function ne(i){let e,t,l=!1,_,u,r,g,h,f,d;return h=p(i[6][0]),{c(){e=T("label"),t=T("input"),_=le(),u=T("span"),r=ie(i[1]),t.disabled=i[3],k(t,"type","radio"),k(t,"name","radio-"+ ++ae),t.__value=i[2],G(t,t.__value),k(t,"aria-checked",i[4]),k(t,"class","svelte-k79vs1"),k(u,"class","ml-2 svelte-k79vs1"),k(e,"data-testid",g=i[1]+"-radio-label"),k(e,"class","svelte-k79vs1"),R(e,"disabled",i[3]),R(e,"selected",i[4]),h.p(t)},m(o,c){$(o,e,c),C(e,t),t.checked=t.__value===i[0],C(e,_),C(e,u),C(u,r),f||(d=x(t,"change",i[5]),f=!0)},p(o,[c]){c&8&&(t.disabled=o[3]),c&4&&(t.__value=o[2],G(t,t.__value),l=!0),c&16&&k(t,"aria-checked",o[4]),(l||c&1)&&(t.checked=t.__value===o[0]),c&2&&te(r,o[1]),c&2&&g!==(g=o[1]+"-radio-label")&&k(e,"data-testid",g),c&8&&R(e,"disabled",o[3]),c&16&&R(e,"selected",o[4])},i:F,o:F,d(o){o&&Z(e),h.r(),f=!1,d()}}}let ae=0;function _e(i,e,t){let{display_value:l}=e,{internal_value:_}=e,{disabled:u=!1}=e,{selected:r=null}=e;const g=se();let h=!1;async function f(c,s){t(4,h=c===s),h&&g("input",s)}const d=[[]];function o(){r=this.__value,t(0,r)}return i.$$set=c=>{"display_value"in c&&t(1,l=c.display_value),"internal_value"in c&&t(2,_=c.internal_value),"disabled"in c&&t(3,u=c.disabled),"selected"in c&&t(0,r=c.selected)},i.$$.update=()=>{i.$$.dirty&5&&f(r,_)},[r,l,_,u,h,o,d]}class ue extends Y{constructor(e){super(),y(this,e,_e,ne,ee,{display_value:1,internal_value:2,disabled:3,selected:0})}get display_value(){return this.$$.ctx[1]}set display_value(e){this.$$set({display_value:e}),E()}get internal_value(){return this.$$.ctx[2]}set internal_value(e){this.$$set({internal_value:e}),E()}get disabled(){return this.$$.ctx[3]}set disabled(e){this.$$set({disabled:e}),E()}get selected(){return this.$$.ctx[0]}set selected(e){this.$$set({selected:e}),E()}}const oe=ue,{SvelteComponent:re,add_flush_callback:ce,assign:fe,attr:de,bind:he,binding_callbacks:me,check_outros:ge,create_component:j,destroy_component:z,detach:w,element:be,empty:ve,ensure_array_like:H,flush:m,get_spread_object:ke,get_spread_update:we,group_outros:Be,init:Se,insert:B,mount_component:D,outro_and_destroy_block:qe,safe_not_equal:Ce,set_data:Ee,space:J,text:Re,transition_in:S,transition_out:q,update_keyed_each:je}=window.__gradio__svelte__internal;function K(i,e,t){const l=i.slice();return l[21]=e[t][0],l[22]=e[t][1],l[24]=t,l}function ze(i){let e;return{c(){e=Re(i[2])},m(t,l){B(t,e,l)},p(t,l){l&4&&Ee(e,t[2])},d(t){t&&w(e)}}}function L(i,e){let t,l,_,u;function r(f){e[18](f)}function g(){return e[19](e[22],e[24])}let h={display_value:e[21],internal_value:e[22],disabled:e[14]};return e[0]!==void 0&&(h.selected=e[0]),l=new oe({props:h}),me.push(()=>he(l,"selected",r)),l.$on("input",g),{key:i,first:null,c(){t=ve(),j(l.$$.fragment),this.first=t},m(f,d){B(f,t,d),D(l,f,d),u=!0},p(f,d){e=f;const o={};d&128&&(o.display_value=e[21]),d&128&&(o.internal_value=e[22]),d&16384&&(o.disabled=e[14]),!_&&d&1&&(_=!0,o.selected=e[0],ce(()=>_=!1)),l.$set(o)},i(f){u||(S(l.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),u=!1},d(f){f&&w(t),z(l,f)}}}function De(i){let e,t,l,_,u,r=[],g=new Map,h;const f=[{autoscroll:i[1].autoscroll},{i18n:i[1].i18n},i[12]];let d={};for(let s=0;s<f.length;s+=1)d=fe(d,f[s]);e=new X({props:d}),e.$on("clear_status",i[17]),l=new W({props:{root:i[13],show_label:i[8],info:i[3],$$slots:{default:[ze]},$$scope:{ctx:i}}});let o=H(i[7]);const c=s=>s[24];for(let s=0;s<o.length;s+=1){let n=K(i,o,s),b=c(n);g.set(b,r[s]=L(b,n))}return{c(){j(e.$$.fragment),t=J(),j(l.$$.fragment),_=J(),u=be("div");for(let s=0;s<r.length;s+=1)r[s].c();de(u,"class","wrap svelte-1kzox3m")},m(s,n){D(e,s,n),B(s,t,n),D(l,s,n),B(s,_,n),B(s,u,n);for(let b=0;b<r.length;b+=1)r[b]&&r[b].m(u,null);h=!0},p(s,n){const b=n&4098?we(f,[n&2&&{autoscroll:s[1].autoscroll},n&2&&{i18n:s[1].i18n},n&4096&&ke(s[12])]):{};e.$set(b);const v={};n&8192&&(v.root=s[13]),n&256&&(v.show_label=s[8]),n&8&&(v.info=s[3]),n&33554436&&(v.$$scope={dirty:n,ctx:s}),l.$set(v),n&16515&&(o=H(s[7]),Be(),r=je(r,n,c,1,s,o,g,u,qe,L,null,K),ge())},i(s){if(!h){S(e.$$.fragment,s),S(l.$$.fragment,s);for(let n=0;n<o.length;n+=1)S(r[n]);h=!0}},o(s){q(e.$$.fragment,s),q(l.$$.fragment,s);for(let n=0;n<r.length;n+=1)q(r[n]);h=!1},d(s){s&&(w(t),w(_),w(u)),z(e,s),z(l,s);for(let n=0;n<r.length;n+=1)r[n].d()}}}function Ie(i){let e,t;return e=new V({props:{visible:i[6],type:"fieldset",elem_id:i[4],elem_classes:i[5],container:i[9],scale:i[10],min_width:i[11],$$slots:{default:[De]},$$scope:{ctx:i}}}),{c(){j(e.$$.fragment)},m(l,_){D(e,l,_),t=!0},p(l,[_]){const u={};_&64&&(u.visible=l[6]),_&16&&(u.elem_id=l[4]),_&32&&(u.elem_classes=l[5]),_&512&&(u.container=l[9]),_&1024&&(u.scale=l[10]),_&2048&&(u.min_width=l[11]),_&33583503&&(u.$$scope={dirty:_,ctx:l}),e.$set(u)},i(l){t||(S(e.$$.fragment,l),t=!0)},o(l){q(e.$$.fragment,l),t=!1},d(l){z(e,l)}}}function Me(i,e,t){let l,{gradio:_}=e,{label:u=_.i18n("radio.radio")}=e,{info:r=void 0}=e,{elem_id:g=""}=e,{elem_classes:h=[]}=e,{visible:f=!0}=e,{value:d=null}=e,{choices:o=[]}=e,{show_label:c=!0}=e,{container:s=!1}=e,{scale:n=null}=e,{min_width:b=void 0}=e,{loading_status:v}=e,{interactive:I=!0}=e,{root:A}=e;function N(){_.dispatch("change")}let M=d;const O=()=>_.dispatch("clear_status",v);function P(a){d=a,t(0,d)}const Q=(a,U)=>{_.dispatch("select",{value:a,index:U}),_.dispatch("input")};return i.$$set=a=>{"gradio"in a&&t(1,_=a.gradio),"label"in a&&t(2,u=a.label),"info"in a&&t(3,r=a.info),"elem_id"in a&&t(4,g=a.elem_id),"elem_classes"in a&&t(5,h=a.elem_classes),"visible"in a&&t(6,f=a.visible),"value"in a&&t(0,d=a.value),"choices"in a&&t(7,o=a.choices),"show_label"in a&&t(8,c=a.show_label),"container"in a&&t(9,s=a.container),"scale"in a&&t(10,n=a.scale),"min_width"in a&&t(11,b=a.min_width),"loading_status"in a&&t(12,v=a.loading_status),"interactive"in a&&t(15,I=a.interactive),"root"in a&&t(13,A=a.root)},i.$$.update=()=>{i.$$.dirty&65537&&d!==M&&(t(16,M=d),N()),i.$$.dirty&32768&&t(14,l=!I)},[d,_,u,r,g,h,f,o,c,s,n,b,v,A,l,I,M,O,P,Q]}class Ve extends re{constructor(e){super(),Se(this,e,Me,Ie,Ce,{gradio:1,label:2,info:3,elem_id:4,elem_classes:5,visible:6,value:0,choices:7,show_label:8,container:9,scale:10,min_width:11,loading_status:12,interactive:15,root:13})}get gradio(){return this.$$.ctx[1]}set gradio(e){this.$$set({gradio:e}),m()}get label(){return this.$$.ctx[2]}set label(e){this.$$set({label:e}),m()}get info(){return this.$$.ctx[3]}set info(e){this.$$set({info:e}),m()}get elem_id(){return this.$$.ctx[4]}set elem_id(e){this.$$set({elem_id:e}),m()}get elem_classes(){return this.$$.ctx[5]}set elem_classes(e){this.$$set({elem_classes:e}),m()}get visible(){return this.$$.ctx[6]}set visible(e){this.$$set({visible:e}),m()}get value(){return this.$$.ctx[0]}set value(e){this.$$set({value:e}),m()}get choices(){return this.$$.ctx[7]}set choices(e){this.$$set({choices:e}),m()}get show_label(){return this.$$.ctx[8]}set show_label(e){this.$$set({show_label:e}),m()}get container(){return this.$$.ctx[9]}set container(e){this.$$set({container:e}),m()}get scale(){return this.$$.ctx[10]}set scale(e){this.$$set({scale:e}),m()}get min_width(){return this.$$.ctx[11]}set min_width(e){this.$$set({min_width:e}),m()}get loading_status(){return this.$$.ctx[12]}set loading_status(e){this.$$set({loading_status:e}),m()}get interactive(){return this.$$.ctx[15]}set interactive(e){this.$$set({interactive:e}),m()}get root(){return this.$$.ctx[13]}set root(e){this.$$set({root:e}),m()}}export{Ye as BaseExample,oe as BaseRadio,Ve as default};
//# sourceMappingURL=Index-D2L5Z-MF.js.map