import"./IconButtonWrapper.svelte_svelte_type_style_lang-BOpxTcdu.js";import"./MarkdownCode.svelte_svelte_type_style_lang-3tofWDHK.js";import{B as Ke}from"./BlockLabel-DqHge3FF.js";import{I as Be}from"./IconButton-B-aAVSzy.js";import{E as Qe}from"./Empty-CxRQfWXb.js";import{S as Ye}from"./ShareButton-CKIdzpwI.js";import{C as Ze}from"./Clear-By3xiIwg.js";import{D as xe}from"./Download-DVtk-Jv3.js";import{I as Le,F as et}from"./FullscreenButton-CqFNG1Hv.js";import{P as Te}from"./Play-B0Q0U1Qz.js";import{I as tt}from"./IconButtonWrapper-Cg16aIPK.js";import"./index-C7PS0jJm.js";/* empty css */import{M as lt}from"./ModifyUpload-CMNONuNr.js";import{I as oe}from"./Image-CsmDAdIf.js";/* empty css *//* empty css */import{V as fe}from"./Video-DiLYgEjl.js";import{u as nt}from"./utils-BsGrhMNe.js";import"./prism-python-qapVsvY8.js";import"./Community-Dw1micSV.js";import"./Minimize-OAHZO2Ge.js";import"./svelte/svelte.js";import"./Edit-BpRIf5rU.js";import"./Undo-DCjBnnSO.js";import"./DownloadLink-IzUam-rM.js";import"./context-TgWPFwN2.js";import"./file-url-DgijyRSD.js";import"./hls-CnVhpNcu.js";var ce=Object.prototype.hasOwnProperty;function _e(l,e,n){for(n of l.keys())if(Y(n,e))return n}function Y(l,e){var n,t,r;if(l===e)return!0;if(l&&e&&(n=l.constructor)===e.constructor){if(n===Date)return l.getTime()===e.getTime();if(n===RegExp)return l.toString()===e.toString();if(n===Array){if((t=l.length)===e.length)for(;t--&&Y(l[t],e[t]););return t===-1}if(n===Set){if(l.size!==e.size)return!1;for(t of l)if(r=t,r&&typeof r=="object"&&(r=_e(e,r),!r)||!e.has(r))return!1;return!0}if(n===Map){if(l.size!==e.size)return!1;for(t of l)if(r=t[0],r&&typeof r=="object"&&(r=_e(e,r),!r)||!Y(t[1],e.get(r)))return!1;return!0}if(n===ArrayBuffer)l=new Uint8Array(l),e=new Uint8Array(e);else if(n===DataView){if((t=l.byteLength)===e.byteLength)for(;t--&&l.getInt8(t)===e.getInt8(t););return t===-1}if(ArrayBuffer.isView(l)){if((t=l.byteLength)===e.byteLength)for(;t--&&l[t]===e[t];);return t===-1}if(!n||typeof l=="object"){t=0;for(n in l)if(ce.call(l,n)&&++t&&!ce.call(e,n)||!(n in e)||!Y(l[n],e[n]))return!1;return Object.keys(e).length===t}}return l!==l&&e!==e}async function it(l){return l?`
${(await Promise.all(l.map(async([n,t])=>n===null||!n.url?"":await nt(n.url)))).map(n=>``).join("")}
`:""}const{SvelteComponent:rt,add_render_callback:ot,append:A,attr:I,binding_callbacks:re,bubble:me,check_outros:C,create_component:B,destroy_component:L,destroy_each:Ee,detach:E,element:O,empty:De,ensure_array_like:le,flush:z,globals:ft,group_outros:N,init:st,insert:D,is_function:ut,listen:Z,mount_component:T,noop:at,run_all:ct,safe_not_equal:_t,set_data:Re,set_style:P,space:U,text:Ae,toggle_class:R,transition_in:h,transition_out:d}=window.__gradio__svelte__internal,{window:Ue}=ft,{createEventDispatcher:mt,onMount:ht}=window.__gradio__svelte__internal,{tick:gt}=window.__gradio__svelte__internal;function he(l,e,n){const t=l.slice();return t[47]=e[n],t[49]=n,t}function ge(l,e,n){const t=l.slice();return t[50]=e[n],t[51]=e,t[49]=n,t}function pe(l){let e,n;return e=new Ke({props:{show_label:l[2],Icon:Le,label:l[3]||"Gallery"}}),{c(){B(e.$$.fragment)},m(t,r){T(e,t,r),n=!0},p(t,r){const i={};r[0]&4&&(i.show_label=t[2]),r[0]&8&&(i.label=t[3]||"Gallery"),e.$set(i)},i(t){n||(h(e.$$.fragment,t),n=!0)},o(t){d(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function pt(l){let e,n,t,r,i,s,c=l[22]&&l[7]&&de(l),o=l[12]&&l[1]===null&&je(l),p=le(l[16]),u=[];for(let a=0;ad(u[a],1,1,()=>{u[a]=null});return{c(){e=O("div"),c&&c.c(),n=U(),t=O("div"),o&&o.c(),r=U(),i=O("div");for(let a=0;a{c=null}),C()),a[12]&&a[1]===null?o?(o.p(a,_),_[0]&4098&&h(o,1)):(o=je(a),o.c(),h(o,1),o.m(t,r)):o&&(N(),d(o,1,1,()=>{o=null}),C()),_[0]&8454274){p=le(a[16]);let b;for(b=0;bd(m[k],1,1,()=>{m[k]=null});return{c(){e=O("button"),B(n.$$.fragment),t=U(),r=O("button"),s.c(),c=U(),w&&w.c(),o=U(),p=O("div");for(let k=0;k{b[q]=null}),C(),s=b[i],s?s.p(l,v):(s=b[i]=_[i](l),s.c()),h(s,1),s.m(r,null)),(!u||v[0]&4194304)&&P(r,"height","calc(100% - "+(l[22].caption?"80px":"60px")+")"),l[22]?.caption?w?w.p(l,v):(w=ye(l),w.c(),w.m(e,o)):w&&(w.d(1),w=null),v[0]&598018){y=le(l[16]);let j;for(j=0;j{s=null}),C()),u[14]?c?(c.p(u,g),g[0]&16384&&h(c,1)):(c=we(u),c.c(),h(c,1),c.m(n.parentNode,n)):c&&(N(),d(c,1,1,()=>{c=null}),C()),u[9]?o?(o.p(u,g),g[0]&512&&h(o,1)):(o=ke(u),o.c(),h(o,1),o.m(t.parentNode,t)):o&&(N(),d(o,1,1,()=>{o=null}),C()),u[17]?p&&(N(),d(p,1,1,()=>{p=null}),C()):p?(p.p(u,g),g[0]&131072&&h(p,1)):(p=ve(u),p.c(),h(p,1),p.m(r.parentNode,r))},i(u){i||(h(s),h(c),h(o),h(p),i=!0)},o(u){d(s),d(c),d(o),d(p),i=!1},d(u){u&&(E(e),E(n),E(t),E(r)),s&&s.d(u),c&&c.d(u),o&&o.d(u),p&&p.d(u)}}}function wt(l){let e,n;return e=new fe({props:{src:l[22].video.url,"data-testid":"detailed-video",alt:l[22].caption||"",loading:"lazy",loop:!1,is_stream:!1,muted:!1,controls:!0}}),{c(){B(e.$$.fragment)},m(t,r){T(e,t,r),n=!0},p(t,r){const i={};r[0]&4194304&&(i.src=t[22].video.url),r[0]&4194304&&(i.alt=t[22].caption||""),e.$set(i)},i(t){n||(h(e.$$.fragment,t),n=!0)},o(t){d(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function kt(l){let e,n;return e=new oe({props:{"data-testid":"detailed-image",src:l[22].image.url,alt:l[22].caption||"",title:l[22].caption||null,class:l[22].caption&&"with-caption",loading:"lazy"}}),{c(){B(e.$$.fragment)},m(t,r){T(e,t,r),n=!0},p(t,r){const i={};r[0]&4194304&&(i.src=t[22].image.url),r[0]&4194304&&(i.alt=t[22].caption||""),r[0]&4194304&&(i.title=t[22].caption||null),r[0]&4194304&&(i.class=t[22].caption&&"with-caption"),e.$set(i)},i(t){n||(h(e.$$.fragment,t),n=!0)},o(t){d(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function ye(l){let e,n=l[22].caption+"",t;return{c(){e=O("caption"),t=Ae(n),I(e,"class","caption svelte-842rpi")},m(r,i){D(r,e,i),A(e,t)},p(r,i){i[0]&4194304&&n!==(n=r[22].caption+"")&&Re(t,n)},d(r){r&&E(e)}}}function vt(l){let e,n,t,r;return e=new Te({}),t=new fe({props:{src:l[50].video.url,title:l[50].caption||null,is_stream:!1,"data-testid":"thumbnail "+(l[49]+1),alt:"",loading:"lazy",loop:!1}}),{c(){B(e.$$.fragment),n=U(),B(t.$$.fragment)},m(i,s){T(e,i,s),D(i,n,s),T(t,i,s),r=!0},p(i,s){const c={};s[0]&65536&&(c.src=i[50].video.url),s[0]&65536&&(c.title=i[50].caption||null),t.$set(c)},i(i){r||(h(e.$$.fragment,i),h(t.$$.fragment,i),r=!0)},o(i){d(e.$$.fragment,i),d(t.$$.fragment,i),r=!1},d(i){i&&E(n),L(e,i),L(t,i)}}}function yt(l){let e,n;return e=new oe({props:{src:l[50].image.url,title:l[50].caption||null,"data-testid":"thumbnail "+(l[49]+1),alt:"",loading:"lazy"}}),{c(){B(e.$$.fragment)},m(t,r){T(e,t,r),n=!0},p(t,r){const i={};r[0]&65536&&(i.src=t[50].image.url),r[0]&65536&&(i.title=t[50].caption||null),e.$set(i)},i(t){n||(h(e.$$.fragment,t),n=!0)},o(t){d(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function $e(l){let e,n,t,r,i,s=l[49],c,o,p;const u=[yt,vt],g=[];function a(w,y){return"image"in w[50]?0:1}n=a(l),t=g[n]=u[n](l);const _=()=>l[38](e,s),b=()=>l[38](null,s);function $(){return l[39](l[49])}return{c(){e=O("button"),t.c(),r=U(),I(e,"class","thumbnail-item thumbnail-small svelte-842rpi"),I(e,"aria-label",i="Thumbnail "+(l[49]+1)+" of "+l[16].length),R(e,"selected",l[1]===l[49]&&l[13]!=="minimal")},m(w,y){D(w,e,y),g[n].m(e,null),A(e,r),_(),c=!0,o||(p=Z(e,"click",$),o=!0)},p(w,y){l=w;let m=n;n=a(l),n===m?g[n].p(l,y):(N(),d(g[m],1,1,()=>{g[m]=null}),C(),t=g[n],t?t.p(l,y):(t=g[n]=u[n](l),t.c()),h(t,1),t.m(e,r)),(!c||y[0]&65536&&i!==(i="Thumbnail "+(l[49]+1)+" of "+l[16].length))&&I(e,"aria-label",i),s!==l[49]&&(b(),s=l[49],_()),(!c||y[0]&8194)&&R(e,"selected",l[1]===l[49]&&l[13]!=="minimal")},i(w){c||(h(t),c=!0)},o(w){d(t),c=!1},d(w){w&&E(e),g[n].d(),b(),o=!1,p()}}}function je(l){let e,n;return e=new lt({props:{i18n:l[11]}}),e.$on("clear",l[41]),{c(){B(e.$$.fragment)},m(t,r){T(e,t,r),n=!0},p(t,r){const i={};r[0]&2048&&(i.i18n=t[11]),e.$set(i)},i(t){n||(h(e.$$.fragment,t),n=!0)},o(t){d(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function $t(l){let e,n,t,r;return e=new Te({}),t=new fe({props:{src:l[47].video.url,title:l[47].caption||null,is_stream:!1,"data-testid":"thumbnail "+(l[49]+1),alt:"",loading:"lazy",loop:!1}}),{c(){B(e.$$.fragment),n=U(),B(t.$$.fragment)},m(i,s){T(e,i,s),D(i,n,s),T(t,i,s),r=!0},p(i,s){const c={};s[0]&65536&&(c.src=i[47].video.url),s[0]&65536&&(c.title=i[47].caption||null),t.$set(c)},i(i){r||(h(e.$$.fragment,i),h(t.$$.fragment,i),r=!0)},o(i){d(e.$$.fragment,i),d(t.$$.fragment,i),r=!1},d(i){i&&E(n),L(e,i),L(t,i)}}}function jt(l){let e,n;return e=new oe({props:{alt:l[47].caption||"",src:typeof l[47].image=="string"?l[47].image:l[47].image.url,loading:"lazy"}}),{c(){B(e.$$.fragment)},m(t,r){T(e,t,r),n=!0},p(t,r){const i={};r[0]&65536&&(i.alt=t[47].caption||""),r[0]&65536&&(i.src=typeof t[47].image=="string"?t[47].image:t[47].image.url),e.$set(i)},i(t){n||(h(e.$$.fragment,t),n=!0)},o(t){d(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function ze(l){let e,n=l[47].caption+"",t;return{c(){e=O("div"),t=Ae(n),I(e,"class","caption-label svelte-842rpi")},m(r,i){D(r,e,i),A(e,t)},p(r,i){i[0]&65536&&n!==(n=r[47].caption+"")&&Re(t,n)},d(r){r&&E(e)}}}function Ie(l){let e,n,t,r,i,s,c,o,p;const u=[jt,$t],g=[];function a($,w){return"image"in $[47]?0:1}n=a(l),t=g[n]=u[n](l);let _=l[47].caption&&ze(l);function b(){return l[42](l[49])}return{c(){e=O("button"),t.c(),r=U(),_&&_.c(),i=U(),I(e,"class","thumbnail-item thumbnail-lg svelte-842rpi"),I(e,"aria-label",s="Thumbnail "+(l[49]+1)+" of "+l[16].length),R(e,"selected",l[1]===l[49])},m($,w){D($,e,w),g[n].m(e,null),A(e,r),_&&_.m(e,null),A(e,i),c=!0,o||(p=Z(e,"click",b),o=!0)},p($,w){l=$;let y=n;n=a(l),n===y?g[n].p(l,w):(N(),d(g[y],1,1,()=>{g[y]=null}),C(),t=g[n],t?t.p(l,w):(t=g[n]=u[n](l),t.c()),h(t,1),t.m(e,r)),l[47].caption?_?_.p(l,w):(_=ze(l),_.c(),_.m(e,i)):_&&(_.d(1),_=null),(!c||w[0]&65536&&s!==(s="Thumbnail "+(l[49]+1)+" of "+l[16].length))&&I(e,"aria-label",s),(!c||w[0]&2)&&R(e,"selected",l[1]===l[49])},i($){c||(h(t),c=!0)},o($){d(t),c=!1},d($){$&&E(e),g[n].d(),_&&_.d(),o=!1,p()}}}function zt(l){let e,n;return e=new Le({}),{c(){B(e.$$.fragment)},m(t,r){T(e,t,r),n=!0},i(t){n||(h(e.$$.fragment,t),n=!0)},o(t){d(e.$$.fragment,t),n=!1},d(t){L(e,t)}}}function It(l){let e,n,t,r,i,s,c;ot(l[32]);let o=l[2]&&pe(l);const p=[dt,pt],u=[];function g(a,_){return a[0]==null||a[16]==null||a[16].length===0?0:1}return n=g(l),t=u[n]=p[n](l),{c(){o&&o.c(),e=U(),t.c(),r=De()},m(a,_){o&&o.m(a,_),D(a,e,_),u[n].m(a,_),D(a,r,_),i=!0,s||(c=Z(Ue,"resize",l[32]),s=!0)},p(a,_){a[2]?o?(o.p(a,_),_[0]&4&&h(o,1)):(o=pe(a),o.c(),h(o,1),o.m(e.parentNode,e)):o&&(N(),d(o,1,1,()=>{o=null}),C());let b=n;n=g(a),n===b?u[n].p(a,_):(N(),d(u[b],1,1,()=>{u[b]=null}),C(),t=u[n],t?t.p(a,_):(t=u[n]=p[n](a),t.c()),h(t,1),t.m(r.parentNode,r))},i(a){i||(h(o),h(t),i=!0)},o(a){d(o),d(t),i=!1},d(a){a&&(E(e),E(r)),o&&o.d(a),u[n].d(a),s=!1,c()}}}function Bt(l,e,n){let t,r,i,{show_label:s=!0}=e,{label:c}=e,{value:o=null}=e,{columns:p=[2]}=e,{rows:u=void 0}=e,{height:g="auto"}=e,{preview:a}=e,{allow_preview:_=!0}=e,{object_fit:b="cover"}=e,{show_share_button:$=!1}=e,{show_download_button:w=!1}=e,{i18n:y}=e,{selected_index:m=null}=e,{interactive:x}=e,{_fetch:k}=e,{mode:v="normal"}=e,{show_fullscreen_button:S=!0}=e,{display_icon_button_wrapper_top_corner:q=!1}=e,j=!1,H;const J=mt();let K=!0,V=null,ne=o;m==null&&a&&o?.length&&(m=0);let ie=m;function se(f){const M=f.target,G=f.offsetX,X=M.offsetWidth/2;G{document.addEventListener("fullscreenchange",()=>{n(17,j=!!document.fullscreenElement)})});function Se(){n(21,ue=Ue.innerHeight)}const Oe=()=>{const f="image"in i?i?.image:i?.video;if(f==null)return;const{url:M,orig_name:G}=f;M&&ae(M,G??"image")};function Me(f){me.call(this,l,f)}function Pe(f){me.call(this,l,f)}const Ve=()=>{n(1,m=null),J("preview_close")},Fe=f=>se(f);function Ge(f,M){re[f?"unshift":"push"](()=>{W[M]=f,n(19,W)})}const qe=f=>n(1,m=f);function He(f){re[f?"unshift":"push"](()=>{F=f,n(20,F)})}const We=()=>n(0,o=[]),Xe=f=>{m===null&&_&&J("preview_open"),n(1,m=f)};function Je(f){re[f?"unshift":"push"](()=>{H=f,n(18,H)})}return l.$$set=f=>{"show_label"in f&&n(2,s=f.show_label),"label"in f&&n(3,c=f.label),"value"in f&&n(0,o=f.value),"columns"in f&&n(4,p=f.columns),"rows"in f&&n(5,u=f.rows),"height"in f&&n(6,g=f.height),"preview"in f&&n(27,a=f.preview),"allow_preview"in f&&n(7,_=f.allow_preview),"object_fit"in f&&n(8,b=f.object_fit),"show_share_button"in f&&n(9,$=f.show_share_button),"show_download_button"in f&&n(10,w=f.show_download_button),"i18n"in f&&n(11,y=f.i18n),"selected_index"in f&&n(1,m=f.selected_index),"interactive"in f&&n(12,x=f.interactive),"_fetch"in f&&n(28,k=f._fetch),"mode"in f&&n(13,v=f.mode),"show_fullscreen_button"in f&&n(14,S=f.show_fullscreen_button),"display_icon_button_wrapper_top_corner"in f&&n(15,q=f.display_icon_button_wrapper_top_corner)},l.$$.update=()=>{l.$$.dirty[0]&536870913&&n(29,K=o==null||o.length===0?!0:K),l.$$.dirty[0]&1&&n(16,V=o==null?null:o.map(f=>"video"in f?{video:f.video,caption:f.caption}:"image"in f?{image:f.image,caption:f.caption}:{})),l.$$.dirty[0]&1744830467&&(Y(ne,o)||(K?(n(1,m=a&&o?.length?0:null),n(29,K=!1)):n(1,m=m!=null&&o!=null&&m