1import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./react-CwJFpaho.js";import{n,t as r}from"./createServerFn-CQQ9jaf5.js";import{t as i}from"./link-VkU6pzKT.js";import{n as a,t as o}from"./use-credits-DQzFMBNr.js";import{t as s}from"./jsx-runtime-NZYk81nU.js";import{i as c,n as l}from"./dist-DhI92mXj.js";import{t as u}from"./arrow-left-9ESDrJZ1.js";import{t as d}from"./arrow-right-BMMxwn3Z.js";import{a as f,c as p,i as m,n as h,o as g,r as _,s as v,t as y}from"./wand-sparkles-BGA7Drrq.js";import{t as b}from"./check-Cl9-9Tax.js";import{t as x}from"./chevron-down-DEI3QUVX.js";import{t as S}from"./chevron-right-BBe-i6bO.js";import{t as C}from"./circle-alert-B9tqHS3z.js";import{t as w}from"./coins-CSpGVxcQ.js";import{t as T}from"./copy-DY6AAKuH.js";import{a as E,i as D,n as ee,r as O,t as k}from"./video-D8g2TSxw.js";import{t as A}from"./info-bqKYXZGJ.js";import{t as te}from"./layout-grid-RwPmf3bS.js";import{t as j}from"./refresh-cw-DUAVBviK.js";import{t as ne}from"./sparkles-CMJz046a.js";import{t as re}from"./triangle-alert-Ci_kaVBc.js";import{t as M}from"./x-B3GNbQVW.js";import{t as N}from"./dist-Q4xMfT_r.js";import{i as ie,r as P,t as F}from"./dist-Blizl3wC.js";import{t as I}from"./dist-Y8Bkug8m.js";import{n as ae,r as L}from"./dist-EoIoEB7M.js";import{n as oe}from"./dist-CzQ5NTIr.js";import{a as se,i as ce,n as le,o as ue,r as de,t as fe}from"./es2015-xjzXIJXQ.js";import{t as pe}from"./dist-BZbB8Cyp.js";import{a as me,i as he,r as R,t as ge}from"./dist-BES4SjL7.js";import{a as _e,i as ve,n as ye,o as be,r as xe,s as Se,t as Ce}from"./select-YzojAV8g.js";import{t as we}from"./switch-XMFtESyb.js";import{r as z,t as B}from"./button-ZpIdMbnM.js";import{t as V}from"./schema-COYTXoFI.js";import{t as Te}from"./card-BluHikOt.js";import{Et as H,Mt as U}from"./index-Dla_URep.js";import{t as Ee}from"./input-CKuCt7Cw.js";import{t as De}from"./badge-1WP_oZkm.js";import{a as Oe,n as ke,r as Ae,t as W}from"./field-TJljLC-H.js";import{t as je}from"./textarea-Bd5d0oTv.js";import{t as Me}from"./auth-client-D9iZhwEd.js";import{i as Ne,r as Pe}from"./generate.fn-CJSiG7Yi.js";import{a as Fe,i as Ie,n as Le,o as Re,r as ze,t as Be}from"./dialog-D-d2IhIy.js";import{i as Ve,n as He,r as Ue,t as We}from"./tabs-CCwvkFtH.js";import{n as Ge,r as Ke,t as qe}from"./upload-rules-QM4Hi6nv.js";var G=e(t(),1),K=e(s(),1),Je=Object.defineProperty,q=(e,t)=>Je(e,`name`,{value:t,configurable:!0}),Ye=`Popover`,[Xe,Ze]=ie(Ye,[me]),Qe=me(),[$e,J]=Xe(Ye),et=q(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Qe(t),c=G.useRef(null),[l,u]=G.useState(!1),[d,f]=F({prop:r,defaultProp:i??!1,onChange:a,caller:Ye});return(0,K.jsx)(he,{...s,children:(0,K.jsx)($e,{scope:t,contentId:ae(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:G.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:G.useCallback(()=>u(!0),[]),onCustomAnchorRemove:G.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),tt=`PopoverTrigger`,nt=G.forwardRef(q(function(e,t){let{__scopePopover:n,...r}=e,i=J(tt,n),a=Qe(n),o=c(t,i.triggerRef),s=(0,K.jsx)(N.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":pt(i.open),...r,ref:o,onClick:P(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,K.jsx)(ge,{asChild:!0,...a,children:s})},`PopoverTrigger`)),rt=`PopoverPortal`,[it,at]=Xe(rt,{forceMount:void 0}),ot=q(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=J(rt,t);return(0,K.jsx)(it,{scope:t,forceMount:n,children:(0,K.jsx)(L,{present:n||a.open,children:(0,K.jsx)(ce,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),st=`PopoverContent`,ct=G.forwardRef(q(function(e,t){let n=at(st,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=J(st,e.__scopePopover);return(0,K.jsx)(L,{present:r||a.open,children:a.modal?(0,K.jsx)(ut,{...i,ref:t}):(0,K.jsx)(dt,{...i,ref:t})})},`PopoverContent`)),lt=l(`PopoverContent.RemoveScroll`),ut=G.forwardRef(q(function(e,t){let n=J(st,e.__scopePopover),r=G.useRef(null),i=c(t,r),a=G.useRef(!1);return G.useEffect(()=>{let e=r.current;if(e)return fe(e)},[]),(0,K.jsx)(le,{as:lt,allowPinchZoom:!0,children:(0,K.jsx)(ft,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:P(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:P(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:P(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),dt=G.forwardRef(q(function(e,t){let n=J(st,e.__scopePopover),r=G.useRef(!1),i=G.useRef(!1);return(0,K.jsx)(ft,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),ft=G.forwardRef(q(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=J(st,n),p=Qe(n);return de(),(0,K.jsx)(se,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,K.jsx)(ue,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,K.jsx)(R,{"data-state":pt(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})},`PopoverContentImpl`));function pt(e){return e?`open`:`closed`}q(pt,`getState`);var mt=et,ht=nt,gt=ot,_t=ct,vt=Object.defineProperty,Y=(e,t)=>
1vt(e,`name`,{value:t,configurable:!0}),yt=[`PageUp`,`PageDown`],bt=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],xt={"from-left":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-right":[`Home`,`PageDown`,`ArrowDown`,`ArrowRight`],"from-bottom":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-top":[`Home`,`PageDown`,`ArrowUp`,`ArrowLeft`]},St=`Slider`,[Ct,wt,Tt]=I(St),[Et,Dt]=ie(St,[Tt]),[Ot,kt]=Et(St),At=G.forwardRef(Y(function(e,t){let{name:n,min:r=0,max:i=100,step:a=1,orientation:o=`horizontal`,disabled:s=!1,minStepsBetweenThumbs:l=0,defaultValue:u=[r],value:d,onValueChange:f=Y(()=>{},`onValueChange`),onValueCommit:p=Y(()=>{},`onValueCommit`),inverted:m=!1,form:h,...g}=e,_=G.useRef(new Set),v=G.useRef(0),y=G.useRef(!1),b=o===`horizontal`?Nt:Pt,[x,S]=G.useState(null),C=c(t,S),[w=[],T]=F({prop:d,defaultProp:u,onChange:Y(e=>{[..._.current][v.current]?.focus({preventScroll:!0,focusVisible:y.current}),y.current=!1,f(e)},`onChange`)}),E=G.useRef(w),D=G.useRef(w);G.useEffect(()=>{let e=h?x?.ownerDocument.getElementById(h):x?.closest(`form`);if(e instanceof HTMLFormElement){let t=Y(()=>T(D.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[x,h,T]);function ee(e){A(e,Qt(w,e))}Y(ee,`handleSlideStart`);function O(e){A(e,v.current)}Y(O,`handleSlideMove`);function k(){String(w)!==String(E.current)&&p(w)}Y(k,`handleSlideEnd`);function A(e,t,{commit:n}={commit:!1}){let o=rn(a),s=X(Math.round((e-r)/a)*a+r,o),c=be(s,[r,i]);T((e=[])=>{let r=Yt(e,c,t);if(tn(r,l*a)){v.current=r.indexOf(c);let t=String(r)!==String(e);return t&&n&&p(r),t?r:e}return e})}return Y(A,`updateValues`),(0,K.jsx)(Ot,{scope:e.__scopeSlider,name:n,disabled:s,min:r,max:i,valueIndexToChangeRef:v,thumbs:_.current,values:w,orientation:o,form:h,children:(0,K.jsx)(Ct.Provider,{scope:e.__scopeSlider,children:(0,K.jsx)(Ct.Slot,{scope:e.__scopeSlider,children:(0,K.jsx)(b,{"aria-disabled":s,"data-disabled":s?``:void 0,...g,ref:C,onPointerDown:P(g.onPointerDown,()=>{s||(E.current=w,y.current=!1)}),min:r,max:i,inverted:m,onSlideStart:s?void 0:ee,onSlideMove:s?void 0:O,onSlideEnd:s?void 0:k,onHomeKeyDown:()=>{s||(y.current=!0,A(r,0,{commit:!0}))},onEndKeyDown:()=>{s||(y.current=!0,A(i,w.length-1,{commit:!0}))},onStepKeyDown:({event:e,direction:t})=>{if(!s){y.current=!0;let n=yt.includes(e.key)||e.shiftKey&&bt.includes(e.key)?10:1,i=v.current,o=w[i];A(an(o,{min:r,step:a,direction:t,multiplier:n}),i,{commit:!0})}}})})})})},`Slider`)),[jt,Mt]=Et(St,{startEdge:`left`,endEdge:`right`,size:`width`,direction:1}),Nt=G.forwardRef(Y(function(e,t){let{min:n,max:r,dir:i,inverted:a,onSlideStart:o,onSlideMove:s,onSlideEnd:l,onStepKeyDown:u,...d}=e,[f,p]=G.useState(null),m=c(t,p),h=G.useRef(void 0),g=oe(i),_=g===`ltr`,v=_&&!a||!_&&a;function y(e){let t=h.current||f.getBoundingClientRect(),i=nn([0,t.width],v?[n,r]:[r,n]);return h.current=t,i(e-t.left)}return Y(y,`getValueFromPointer`),(0,K.jsx)(jt,{scope:e.__scopeSlider,startEdge:v?`left`:`right`,endEdge:v?`right`:`left`,direction:v?1:-1,size:`width`,children:(0,K.jsx)(Ft,{dir:g,"data-orientation":`horizontal`,...d,ref:m,style:{...d.style,"--radix-slider-thumb-transform":`translateX(-50%)`},onSlideStart:e=>{let t=y(e.clientX);o?.(t)},onSlideMove:e=>{let t=y(e.clientX);s?.(t)},onSlideEnd:()=>{h.current=void 0,l?.()},onStepKeyDown:e=>{let t=xt[v?`from-left`:`from-right`].includes(e.key);u?.({event:e,direction:t?-1:1})}})})},`SliderHorizontal`)),Pt=G.forwardRef(Y(function(e,t){let{min:n,max:r,inverted:i,onSlideStart:a,onSlideMove:o,onSlideEnd:s,onStepKeyDown:l,...u}=e,d=G.useRef(null),f=c(t,d),p=G.useRef(void 0),m=!i;function h(e){let t=p.current||d.current.getBoundingClientRect(),i=nn([0,t.height],m?[r,n]:[n,r]);return p.current=t,i(e-t.top)}return Y(h,`getValueFromPointer`),(0,K.jsx)(jt,{scope:e.__scopeSlider,startEdge:m?`bottom`:`top`,endEdge:m?`top`:`bottom`,size:`height`,direction:m?1:-1,children:(0,K.jsx)(Ft,{"data-orientation":`vertical`,...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":`translateY(50%)`},onSlideStart:e=>{let t=h(e.clientY);a?.(t)},onSlideMove:e=>{let t=h(e.clientY);o?.(t)},onSlideEnd:()=>{p.current=void 0,s?.()},onStepKeyDown:e=>
1{let t=xt[m?`from-bottom`:`from-top`].includes(e.key);l?.({event:e,direction:t?-1:1})}})})},`SliderVertical`)),Ft=G.forwardRef(Y(function(e,t){let{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:a,onHomeKeyDown:o,onEndKeyDown:s,onStepKeyDown:c,...l}=e,u=kt(St,n);return(0,K.jsx)(N.span,{...l,ref:t,onKeyDown:P(e.onKeyDown,e=>{e.key===`Home`?(o(e),e.preventDefault()):e.key===`End`?(s(e),e.preventDefault()):yt.concat(bt).includes(e.key)&&(c(e),e.preventDefault())}),onPointerDown:P(e.onPointerDown,e=>{let t=e.target;t.setPointerCapture(e.pointerId),e.preventDefault(),u.thumbs.has(t)?t.focus({preventScroll:!0,focusVisible:!1}):r(e)}),onPointerMove:P(e.onPointerMove,e=>{e.target.hasPointerCapture(e.pointerId)&&i(e)}),onPointerUp:P(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),a(e))})})},`SliderImpl`)),It=`SliderTrack`,Lt=G.forwardRef(Y(function(e,t){let{__scopeSlider:n,...r}=e,i=kt(It,n);return(0,K.jsx)(N.span,{"data-disabled":i.disabled?``:void 0,"data-orientation":i.orientation,...r,ref:t})},`SliderTrack`)),Rt=`SliderRange`,zt=G.forwardRef(Y(function(e,t){let{__scopeSlider:n,...r}=e,i=kt(Rt,n),a=Mt(Rt,n),o=G.useRef(null),s=c(t,o),l=i.values.length,u=i.values.map(e=>Xt(e,i.min,i.max)),d=l>1?Math.min(...u):0,f=100-Math.max(...u);return(0,K.jsx)(N.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?``:void 0,...r,ref:s,style:{...e.style,[a.startEdge]:d+`%`,[a.endEdge]:f+`%`}})},`SliderRange`)),[Bt,Vt]=Et(`SliderThumb`),Ht=`SliderThumbProvider`;function Ut(e){let{__scopeSlider:t,name:n,children:r,internal_do_not_use_render:i}=e,a=kt(Ht,t),o=wt(t),[s,c]=G.useState(null),l=G.useMemo(()=>s?o().findIndex(e=>e.ref.current===s):-1,[o,s]),u=pe(s),d=!s||!!a.form||!!s.closest(`form`),f=a.values[l],p=n??(a.name?a.name+(a.values.length>1?`[]`:``):void 0),m=f===void 0?0:Xt(f,a.min,a.max);G.useEffect(()=>{if(s)return a.thumbs.add(s),()=>{a.thumbs.delete(s)}},[s,a.thumbs]);let h={value:f,name:p,form:a.form,isFormControl:d,index:l,thumb:s,onThumbChange:c,percent:m,size:u};return(0,K.jsx)(Bt,{scope:t,...h,children:on(i)?i(h):r})}Y(Ut,`SliderThumbProvider`);var Wt=`SliderThumbTrigger`,Gt=G.forwardRef(Y(function(e,t){let{__scopeSlider:n,...r}=e,i=kt(Wt,n),a=Mt(Wt,n),{index:o,value:s,percent:l,size:u,onThumbChange:d}=Vt(Wt,n),f=c(t,d),p=Zt(o,i.values.length),m=u?.[a.size],h=m?$t(m,l,a.direction):0;return(0,K.jsx)(`span`,{style:{transform:`var(--radix-slider-thumb-transform)`,position:`absolute`,[a.startEdge]:`calc(${l}% + ${h}px)`},children:(0,K.jsx)(Ct.ItemSlot,{scope:n,children:(0,K.jsx)(N.span,{role:`slider`,"aria-label":e[`aria-label`]||p,"aria-valuemin":i.min,"aria-valuenow":s,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?``:void 0,tabIndex:i.disabled?void 0:0,...r,ref:f,style:s===void 0?{display:`none`}:e.style,onFocus:P(e.onFocus,()=>{i.valueIndexToChangeRef.current=o})})})})},`SliderThumbTrigger`)),Kt=G.forwardRef(Y(function(e,t){let{__scopeSlider:n,name:r,...i}=e;return(0,K.jsx)(Ut,{__scopeSlider:n,name:r,internal_do_not_use_render:({index:e,isFormControl:r})=>(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Gt,{...i,ref:t,__scopeSlider:n}),r?(0,K.jsx)(Jt,{__scopeSlider:n},e):null]})})},`SliderThumb`)),qt=`SliderBubbleInput`,Jt=G.forwardRef(Y(function({__scopeSlider:e,...t},n){let{value:r,name:i,form:a}=Vt(qt,e),o=G.useRef(null),s=c(o,n),l=Se(r);return G.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(l!==r&&n){let t=new Event(`input`,{bubbles:!0});n.call(e,r),e.dispatchEvent(t)}},[l,r]),(0,K.jsx)(N.input,{style:{display:`none`},name:i,form:a,...t,ref:s,defaultValue:r})},`SliderBubbleInput`));function Yt(e=[],t,n){let r=[...e];return r[n]=t,r.sort((e,t)=>e-t)}Y(Yt,`getNextSortedValues`);function Xt(e,t,n){let r=100/(n-t)*(e-t);return be(r,[0,100])}Y(Xt,`convertValueToPercentage`);function Zt(e,t){if(t>2)return`Value ${e+1} of ${t}`;if(t===2)return[`Minimum`,`Maximum`][e]}Y(Zt,`getLabel`);function Qt(e,t){if(e.length===1)return 0;let n=e.map(e=>Math.abs(e-t)),r=Math.min(...n);return n.indexOf(r)}Y(Qt,`getClosestValueIndex`);function $t(e,t,n){let r=e/2;return(r-nn([0,50],[0,r])(t)*n)*n}Y($t,`getThumbInBoundsOffset`);function en(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}Y(en,`getStepsBetweenValues`);function tn(e,t){if(t>0){let n=en(e);return Math.min(...n)>=t}return!0}Y(tn,`hasMinStepsBetweenValues`);function nn(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}Y(nn,`linearScale`);function rn(e){if(!Number.isFinite(e))return 0;let t=e.toString();if(t.includes(`e`)){let[e,n]=t.split(`e`),r=e.split(`.`)[1]||``,i=Number(n);return Math.max(0,r.length-i)}let n=t.split(`.`)[1];return n?n.length:0}Y(rn,`getDecimalCount`);function X(e,t){let n=10**t;return Math.round(e*n)/n}Y(X,`roundValue`);function an(e,{min:t,step:n,direction:r,multiplier:i}){let a=rn(n),o=(e-t)/n,s=Math.round(o),c=X(s*n+t,a)===X(e,a),l;return l=c?s+i*r:r>0?Math.ceil(o):Math.floor(o),X(l*n+t,a)}Y(an,`getNextStepValue`);function on(e){return typeof e==`function`}Y(on,`isFunction`);var sn={id:`gpt-image-2`,platform:`fal`,category:`image`,icon:`/icon/openai.svg`,name:`GPT Image 2`,slug:`/ai-image/gpt-image-2`,description:`OpenAI's latest image generation and editing model with native multi-image support.`,isNew:!1,isHot:!0,tabs:[{key:`
1image-edit`,name:`Image Edit`,resolveEndpoint:()=>`openai/gpt-image-2/edit`,fields:[{type:`image-input`,key:`image_url`,label:`Image`,required:!0,max:9,default:[],description:`Upload images to edit (required, up to 9 images).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to edit the image...`,rows:5,maxLength:3e3,description:`Describe what you want to edit the image`,enableOptimize:!0,optimizeCategory:`image`,optimizeType:`edit`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`Square HD`,value:`square_hd`,ratio:`1:1`},{label:`Square`,value:`square`,ratio:`1:1`},{label:`3:4`,value:`portrait_4_3`,ratio:`3:4`},{label:`4:3`,value:`landscape_4_3`,ratio:`4:3`},{label:`9:16`,value:`portrait_16_9`,ratio:`9:16`},{label:`16:9`,value:`landscape_16_9`,ratio:`16:9`},{label:`Auto`,value:`auto`}],default:`portrait_4_3`},{type:`select`,key:`quality`,label:`Quality`,options:[{label:`auto`,value:`auto`},{label:`low`,value:`low`},{label:`medium`,value:`medium`},{label:`high`,value:`high`}],default:`medium`,description:`Quality for the generated image`},{type:`select`,key:`num_images`,label:`Number of Images`,options:[{label:`1`,value:`1`},{label:`2`,value:`2`},{label:`3`,value:`3`}],default:`1`,description:`Number of images to generate at once`},{type:`select`,key:`output_format`,label:`Output Format`,options:[{label:`JPEG`,value:`jpeg`},{label:`PNG`,value:`png`},{label:`WebP`,value:`webp`}],default:`jpeg`,description:`Format of the output images.`},{type:`image-input`,key:`mask_url`,label:`Mask Image`,required:!1,max:1,default:``,description:`Upload mask image (optional, up to 1 image).`}],computeCredits:cn,buildInput:({fields:e,enableSafetyChecker:t})=>{let n=e.image_url,r=e.mask_url,i=Number(e.num_images)||1;return{prompt:e.prompt,...n?.length?{image_urls:n}:{},image_size:e.aspect_ratio,quality:e.quality,num_images:i,output_format:e.output_format,sync_mode:!1,...r?{mask_url:r}:{},enable_safety_checker:t}},parseResult:ln,example:{input:{image_url:[`https://v3b.fal.media/files/b/0a981c67/cwMUgFRWZNhRxbI6a37Bg_D2Bh_e7GNH2moZd_llNz9_9cab3829-d8ba-43d6-982f-7ef41192edcb%20copy.jpg`,`https://v3b.fal.media/files/b/0a970d7d/-YGNo3Wsq8q1gq1VnyTdi_bfd10f20-636f-42aa-b8f0-28f957def181.png`],prompt:`Wrap the double-decker bus from the first image with the exact branding design from the second image as a full bus livery. Keep the street scene, people, and background unchanged .`,aspect_ratio:`auto`,num_images:`1`,quality:`medium`,output_format:`jpeg`},output:[`https://v3b.fal.media/files/b/0a981c67/A5TcqbjgHhGfrEb9vsGxh_cDTMHkw2.jpg`],duration:235}},{key:`text-to-image`,name:`Text to Image`,resolveEndpoint:()=>`openai/gpt-image-2`,fields:[{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate...`,rows:5,maxLength:3e3,description:`Describe what you want to generate`,enableOptimize:!0,optimizeCategory:`image`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`Square HD`,value:`square_hd`,ratio:`1:1`},{label:`Square`,value:`square`,ratio:`1:1`},{label:`3:4`,value:`portrait_4_3`,ratio:`3:4`},{label:`4:3`,value:`landscape_4_3`,ratio:`4:3`},{label:`9:16`,value:`portrait_16_9`,ratio:`9:16`},{label:`16:9`,value:`landscape_16_9`,ratio:`16:9`},{label:`Auto`,value:`auto`}],default:`portrait_4_3`},{type:`select`,key:`quality`,label:`Quality`,options:[{label:`auto`,value:`auto`},{label:`low`,value:`low`},{label:`medium`,value:`medium`},{label:`high`,value:`high`}],default:`medium`,description:`Quality for the generated image`},{type:`select`,key:`num_images`,label:`Number of Images`,options:[{label:`1`,value:`1`},{label:`2`,value:`2`},{label:`3`,value:`3`}],default:`1`,description:`Number of images to generate at once`},{type:`select`,key:`output_format`,label:`Output Format`,options:[{label:`JPEG`,value:`jpeg`},{label:`PNG`,value:`png`},{label:`WebP`,value:`webp`}],default:`jpeg`,description:`Format of the output images.`}],computeCredits:cn,buildInput:({fields:e,enableSafetyChecker:t})=>{let n=Number(e.num_images)||1;return{prompt:e.prompt,image_size:e.aspect_ratio,quality:e.quality,num_images:n,output_format:e.output_format,sync_mode:!1,enable_safety_checker:t}},parseResult:ln,example:{input:{prompt:`Create a high-end hero infographic announcing âGPT Image 2 is hereâ. 2Design it like a futuristic periodic table mixed with a clean anatomical diagram: a precise grid of 16â24 mini image panels, each showcasing a different visual style such as oil painting, anime, blueprint, isometric 3D, photorealism, watercolor, pixel art, clay render, cinematic lighting, product photography, fashion editorial, U
2I mockup, technical diagram, and surreal concept art. 3 4The image should feel electric, colorful, premium, and extremely polished. 5Use a clean modern layout, sharp typography, subtle labels, thin lines, glowing accents, and a strong visual hierarchy. 6The infographic itself should demonstrate the power of an advanced image model: beautiful composition, perfect grids, consistent spacing, readable text, and diverse styles in one coherent design. 7 8No date. No extra caption. Just a powerful visual announcement that speaks for itself.`,aspect_ratio:`landscape_16_9`,quality:`medium`,output_format:`jpeg`,num_images:`1`},output:[`https://v3b.fal.media/files/b/0a981c3d/hdg8iaY8yShEwChTPjFah_OZUgg7Z4.jpg`],duration:321}}]};function cn(e){let t=e.quality,n=e.aspect_ratio,r=Number(e.num_images)||1;return({auto:{square_hd:100,square:50,auto:50,portrait_4_3:50,landscape_4_3:50,landscape_16_9:50,portrait_16_9:50},high:{square_hd:100,square:50,auto:50,portrait_4_3:50,landscape_4_3:50,landscape_16_9:50,portrait_16_9:50},medium:{square_hd:20,square:10,auto:10,portrait_4_3:10,landscape_4_3:10,landscape_16_9:10,portrait_16_9:10},low:{square_hd:10,square:5,auto:5,portrait_4_3:5,landscape_4_3:5,landscape_16_9:5,portrait_16_9:5}}[t]?.[n]??50)*r}function ln(e){return e.images.map(e=>e.url)}var un={id:`grok`,platform:`fal`,category:`image`,icon:`/icon/grok.svg`,name:`Grok`,description:`xAI's creative image model known for unrestricted artistic generation.`,tabs:[{key:`image-edit`,name:`Image Edit`,resolveEndpoint:()=>`xai/grok-imagine-image/edit`,fields:[{type:`image-input`,key:`image_url`,label:`Image`,required:!0,max:3,default:[],description:`Upload images to edit (required, up to 3 images).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe how you want to edit the image...`,rows:5,maxLength:3e3,description:`Describe how you want to edit the image`,enableOptimize:!0,optimizeCategory:`image`,optimizeType:`edit`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`auto`,value:`auto`},{label:`1:1`,value:`1:1`,ratio:`1:1`},{label:`1:2`,value:`1:2`,ratio:`1:2`},{label:`2:1`,value:`2:1`,ratio:`2:1`},{label:`2:3`,value:`2:3`,ratio:`2:3`},{label:`3:2`,value:`3:2`,ratio:`3:2`},{label:`3:4`,value:`3:4`,ratio:`3:4`},{label:`4:3`,value:`4:3`,ratio:`4:3`},{label:`9:16`,value:`9:16`,ratio:`9:16`},{label:`9:20`,value:`9:20`,ratio:`9:20`},{label:`16:9`,value:`16:9`,ratio:`16:9`},{label:`20:9`,value:`20:9`,ratio:`20:9`}],default:`3:4`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`1k`,value:`1k`},{label:`2k`,value:`2k`}],default:`1k`,description:`Resolution of the generated image.`},{type:`select`,key:`output_format`,label:`Output Format`,options:[{label:`JPEG`,value:`jpeg`},{label:`PNG`,value:`png`},{label:`WebP`,value:`webp`}],default:`jpeg`,description:`The format of the generated image.`},{type:`select`,key:`num_images`,label:`Number of Images`,options:[{label:`1`,value:`1`},{label:`2`,value:`2`},{label:`3`,value:`3`}],default:`1`,description:`Number of images to generate at once`}],computeCredits:dn,buildInput:({fields:e,enableSafetyChecker:t})=>{let n=e.image_url,r=Number(e.num_images)||1;return{prompt:e.prompt,resolution:e.resolution,num_images:r,aspect_ratio:e.aspect_ratio,output_format:e.output_format,sync_mode:!1,...n?.length?{image_urls:n}:{},enable_safety_checker:t}},parseResult:fn,example:{input:{image_url:[`https://v3b.fal.media/files/b/0a8b911d/Abk8vStrvmSPlzUqI_NN3_image_043.png`],prompt:`Make this scene more realistic but still keep the game vibes`,aspect_ratio:`4:3`,resolution:`1k`,output_format:`jpeg`,num_images:`1`},output:[`https://v3b.fal.media/files/b/0a8b911d/XMqiVoO2ECXUZEUYmPl2l.jpg`],duration:198}},{key:`text-to-image`,name:`Text to Image`,resolveEndpoint:()=>`xai/grok-imagine-image`,fields:[{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate...`,rows:5,maxLength:3e3,description:`Describe what you want to generate`,enableOptimize:!0,optimizeCategory:`image`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`1:1`,value:`1:1`,ratio:`1:1`},{label:`1:2`,value:`1:2`,ratio:`1:2`},{label:`2:1`,value:`2:1`,ratio:`2:1`},{label:`2:3`,value:`2:3`,ratio:`2:3`},{label:`3:2`,value:`3:2`,ratio:`3:2`},{label:`3:4`,value:`3:4`,ratio:`3:4`},{label:`4:3`,value:`4:3`,ratio:`4:3`},{label:`9:16`,value:`9:16`,ratio:`9:16`},{label:`9:20`,value:`9:20`,ratio:`9:20`},{label:`16:9`,value:`16:9`,ratio:`16:9`},{label:`20:9`,value:`20:9`,ratio:`20:9`}],default:`3:4`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`1k`,value:`1k`},{label:`2k`,value:`2k`}],default:`1k`,description:`Resolution of the generated image.`},{type:`select`,key:`output_format`,label:`Output Format`,options:[{label:`JPEG`,value:`jpeg`},{label:`PNG`,value:`png`},{label:`WebP`,value:`webp`}],default:`jpeg`,description:`Format of the output images.`},{type:`select`,key:`num_images`,label:`Number of Images`,options:[{label:`1`,value:`1`},{label:`2`,value:`2`},{label:`3`,value:`3`}],default:`1`,description:`Number of images to generate at once`}],computeCredits:dn,buildInput:({fields:e,enableSafetyChecker:t})=>{let n=Number(e.num_images)||1;return{prompt:e.prompt,num_images:n,aspect_ratio:e.aspect_ratio,resolution:e.resolution,output_format:e.output_format,sync_mode:!1,enable_safety_checker:t}},parseResult:fn}]};function dn(e){return 5*(Number(e.num_images)||1)}function fn(e){return e.images.map(e=>e.url)}var pn={id:`grok-v2`,platform:`fal`,category:`image`,icon:`/icon/grok.svg`,name:`Grok v2.0`,description:`xAI's creative image model known for unrestr
8icted artistic generation.`,isNew:!0,isHot:!1,tabs:[{key:`image-edit`,name:`Image Edit`,resolveEndpoint:()=>`xai/grok-imagine-image/v2.0/edit`,fields:[{type:`image-input`,key:`image_url`,label:`Image`,required:!0,max:3,default:[],description:`Upload images to edit (required, up to 3 images).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe how you want to edit the image...`,rows:5,maxLength:3e3,description:`Describe how you want to edit the image`,enableOptimize:!0,optimizeCategory:`image`,optimizeType:`edit`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`auto`,value:`auto`},{label:`1:1`,value:`1:1`,ratio:`1:1`},{label:`1:2`,value:`1:2`,ratio:`1:2`},{label:`2:1`,value:`2:1`,ratio:`2:1`},{label:`2:3`,value:`2:3`,ratio:`2:3`},{label:`3:2`,value:`3:2`,ratio:`3:2`},{label:`3:4`,value:`3:4`,ratio:`3:4`},{label:`4:3`,value:`4:3`,ratio:`4:3`},{label:`9:16`,value:`9:16`,ratio:`9:16`},{label:`9:20`,value:`9:20`,ratio:`9:20`},{label:`16:9`,value:`16:9`,ratio:`16:9`},{label:`20:9`,value:`20:9`,ratio:`20:9`}],default:`3:4`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`1k`,value:`1k`},{label:`2k`,value:`2k`}],default:`1k`,description:`Resolution of the generated image.`},{type:`select`,key:`output_format`,label:`Output Format`,options:[{label:`JPEG`,value:`jpeg`},{label:`PNG`,value:`png`},{label:`WebP`,value:`webp`}],default:`jpeg`,description:`The format of the generated image.`},{type:`select`,key:`quality`,label:`Quality`,options:[{label:`low`,value:`low`},{label:`medium`,value:`medium`}],default:`medium`,description:`The quality of the generated image.`},{type:`select`,key:`num_images`,label:`Number of Images`,options:[{label:`1`,value:`1`},{label:`2`,value:`2`},{label:`3`,value:`3`}],default:`1`,description:`Number of images to generate at once`}],computeCredits:hn,buildInput:({fields:e,enableSafetyChecker:t})=>{let n=e.image_url,r=Number(e.num_images)||1;return{prompt:e.prompt,num_images:r,aspect_ratio:e.aspect_ratio,resolution:e.resolution,output_format:e.output_format,sync_mode:!1,...n?.length?{image_urls:n}:{},quality:e.quality,enable_safety_checker:t}},parseResult:gn,example:{input:{image_url:[`https://v3b.fal.media/files/b/0aa54033/pNq_9LgF7zwRWkX3EUz___iYpKBaQSuw-kaEY2EYKJx_Bm1x394c.jpg`],prompt:`Make the sneakers solid white with red laces, and replace the autumn leaves with light fresh snow dusting the bench`,aspect_ratio:`4:3`,resolution:`1k`,quality:`medium`,output_format:`jpeg`,num_images:`1`},output:[`https://v3b.fal.media/files/b/0aa5447a/afiMkoIecsO5HzINdUKoZ_yDG5WEOv.jpg`],duration:198}},{key:`text-to-image`,name:`Text to Image`,resolveEndpoint:()=>`xai/grok-imagine-image/v2.0/text-to-image`,fields:[{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate...`,rows:5,maxLength:3e3,description:`Describe what you want to generate`,enableOptimize:!0,optimizeCategory:`image`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`1:1`,value:`1:1`,ratio:`1:1`},{label:`1:2`,value:`1:2`,ratio:`1:2`},{label:`2:1`,value:`2:1`,ratio:`2:1`},{label:`2:3`,value:`2:3`,ratio:`2:3`},{label:`3:2`,value:`3:2`,ratio:`3:2`},{label:`3:4`,value:`3:4`,ratio:`3:4`},{label:`4:3`,value:`4:3`,ratio:`4:3`},{label:`9:16`,value:`9:16`,ratio:`9:16`},{label:`9:20`,value:`9:20`,ratio:`9:20`},{label:`16:9`,value:`16:9`,ratio:`16:9`},{label:`20:9`,value:`20:9`,ratio:`20:9`}],default:`3:4`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`1k`,value:`1k`},{label:`2k`,value:`2k`}],default:`1k`,description:`Resolution of the generated image.`},{type:`select`,key:`output_format`,label:`Output Format`,options:[{label:`JPEG`,value:`jpeg`},{label:`PNG`,value:`png`},{label:`WebP`,value:`webp`}],default:`jpeg`,description:`Format of the output images.`},{type:`select`,key:`quality`,label:`Quality`,options:[{label:`low`,value:`low`},{label:`medium`,value:`medium`}],default:`medium`,description:`The quality of the generated image.`},{type:`select`,key:`num_images`,label:`Number of Images`,options:[{label:`1`,value:`1`},{label:`2`,value:`2`},{label:`3`,value:`3`}],default:`1`,description:`Number of images to generate at once`}],computeCredits:hn,buildInput:({fields:e,enableSafetyChecker:t})=>{let n=Number(e.num_images)||1;return{prompt:e.prompt,num_images:n,aspect_ratio:e.aspect_ratio,resolution:e.resolution,output_format:e.output_format,sync_mode:!1,quality:e.quality,enable_safety_checker:t}},parseResult:gn}]},mn={"1k":5,"2k":8};function hn(e){return(mn[e.resolution]??mn[`1k`])*(Number(e.num_images)||1)}function gn(e){return e.images.map(e=>e.url)}var _n={id:`nano-banana-2`,platform:`fal`,category:`image`,icon:`/icon/google.svg`,name:`Nano Banana 2`,slug:`/ai-image/nano-banana-2`,de
8scription:`Google's fast image generation model with conversational editing, multi-image fusion, and character consistency`,isNew:!1,isHot:!0,tabs:[{key:`image-edit`,name:`Image Edit`,resolveEndpoint:()=>`fal-ai/nano-banana-2/edit`,fields:[{type:`image-input`,key:`image_url`,label:`Image`,required:!0,max:9,default:[],description:`Upload images to edit (required, up to 9 images).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to edit the image...`,rows:5,maxLength:3e3,description:`Describe what you want to edit the image`,enableOptimize:!0,optimizeCategory:`image`,optimizeType:`edit`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`1:1`,value:`1:1`,ratio:`1:1`},{label:`1:4`,value:`1:4`,ratio:`1:4`},{label:`1:8`,value:`1:8`,ratio:`1:8`},{label:`2:3`,value:`2:3`,ratio:`2:3`},{label:`3:2`,value:`3:2`,ratio:`3:2`},{label:`3:4`,value:`3:4`,ratio:`3:4`},{label:`4:1`,value:`4:1`,ratio:`4:1`},{label:`4:3`,value:`4:3`,ratio:`4:3`},{label:`4:5`,value:`4:5`,ratio:`4:5`},{label:`5:4`,value:`5:4`,ratio:`5:4`},{label:`8:1`,value:`8:1`,ratio:`8:1`},{label:`9:16`,value:`9:16`,ratio:`9:16`},{label:`16:9`,value:`16:9`,ratio:`16:9`},{label:`21:9`,value:`21:9`,ratio:`21:9`},{label:`Auto`,value:`auto`}],default:`3:4`},{type:`select`,key:`num_images`,label:`Number of Images`,options:[{label:`1`,value:`1`},{label:`2`,value:`2`},{label:`3`,value:`3`}],default:`1`,description:`Number of images to generate at once`},{type:`select`,key:`output_format`,label:`Output Format`,options:[{label:`JPEG`,value:`jpeg`},{label:`PNG`,value:`png`},{label:`WebP`,value:`webp`}],default:`jpeg`,description:`Format of the output images.`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`0.5K`,value:`0.5K`},{label:`1K`,value:`1K`},{label:`2K`,value:`2K`},{label:`4K`,value:`4K`}],default:`1K`,description:`Resolution of the output images.`},{type:`switch`,key:`enable_web_search`,label:`Enable Web Search`,default:!1,description:`Enable web search for the image generation task. This will allow the model to use the latest information from the web to generate the image.`,descriptionType:`popover`},{type:`switch`,key:`limit_generations`,label:`Limit Generations`,default:!0,description:`Experimental parameter to limit the number of generations from each round of prompting to 1. Set to True to to disregard any instructions in the prompt regarding the number of images to generate and ignore any intermediate images generated by the model. This may affect generation quality. Default value: Open`,descriptionType:`popover`},{type:`select`,key:`thinking_level`,label:`Thinking Level`,options:[{label:`Off`,value:`off`},{label:`Minimal`,value:`minimal`},{label:`High`,value:`high`}],default:`off`,description:`When set, enables model thinking with the given level and includes thoughts in the generation. Omit to disable.`,descriptionType:`popover`},{type:`textarea`,key:`system_prompt`,label:`System Prompt`,default:``,placeholder:`Enter a system prompt for the image generation task.`,rows:5,maxLength:1e3,description:`Optional system instruction that steers the model's persona and output style across the request. Leave blank to omit; when provided, it is sent as the system instruction to Gemini (or as a system message on OpenAI-compatible providers). Default value empty.`,descriptionType:`popover`},{type:`seed-input`,key:`seed`,label:`Seed`}],computeCredits:vn,buildInput:({fields:e,enableSafetyChecker:t})=>{let n=e.image_url,r=Number(e.num_images)||1;return{prompt:e.prompt,num_images:r,seed:e.seed,aspect_ratio:e.aspect_ratio,output_format:e.output_format,safety_tolerance:t?`1`:`6`,sync_mode:!1,...n?.length?{image_urls:n}:{},system_prompt:e.system_prompt,resolution:e.resolution,limit_generations:e.limit_generations,enable_web_search:e.enable_web_search,...e.thinking_level&&e.thinking_level!==`off`?{thinking_level:e.thinking_level}:{},enable_safety_checker:t}},parseResult:yn,example:{input:{image_url:[`https://storage.googleapis.com/falserverless/example_inputs/nano-banana-edit-input.png`,`https://storage.googleapis.com/falserverless/example_inputs/nano-banana-edit-input-2.png`],prompt:`make a photo of the man driving the car down the california coastline`,aspect_ratio:`auto`,output_format:`png`,resolution:`1K`,limit_generations:!0,enable_web_search:!1,thinking_level:`off`,num_images:`1`},output:[`https://storage.googleapis.com/falserverless/example_outputs/nano-banana-2-edit-output.png`],duration:135}},{key:`text-to-image`,name:`Text to Image`,resolveEndpoint:()=>`fal-ai/nano-banana-2`,fields:[{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to edit the image...`,rows:5,maxLength:3e3,description:`Describe what you want to edit the image`,enableOptimize:!0,optimizeCategory:`image`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`1:1`,value:`1:1`,ratio:`1:1`},{label:`1:4`,value:`1:4`,ratio:`1:4`},{label:`1:8`,value:`1:8`,ratio:`1:8`},{label:`2:3`,value:`2:3`,ratio:`2:3`},{label:`3:2`,value:`3:2`,ratio:`3:2`},{label:`3:4`,value:`3:4`,ratio:`3:4`},{label:`4:1`,value:`4:1`,ratio:`4:1`},{label:`4:3`,value:`4:3`,ratio:`4:3`},{label:`4:5`,value:`4:5`,ratio:`4:5`},{label:`5:4`,value:`5:4`,ratio:`5:4`},{label:`8:1`,value:`8:1`,ratio:`8:1`},{label:`9:16`,value:`9:16`,ratio:`9:16`},{label:`16:9`,value:`16:9`,ratio:`16:9`},{label:`21:9`,value:`21:9`,ratio:`21:9`},{label:`Auto`,value:`auto`}],default:`3:4`},{type:`select`,key:`num_images`,label:`Number of Images`,options:[{label:`1`,value:`1`},{label:`2`,value:`2`},{label:`3`,value:`3`}],default:`1`,description:`Number of images to generate at once`},{type:`select`,key:`output_format`,label:`Output Format`,options:[{label:`JPEG`,value:`jpeg`},{label:`PNG`,value:`png`},{label:`WebP`,value:`webp`}],default:`jpeg`,description:`Format of the output images.`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`0.5K`,value:`0.5K`},{label:`1K`,value:`1K`},{label:`2K`,value:`2K`},{label:`4K`,value:`4K`}],default:`1K`,description:`Resolution of the output images.`},{type:`switch`,key:`enable_web_search`,label:`Enable Web Search`,default:!1,description:`Enable web search for the image generation task. This will allow the model to use the latest information from the web to generate the image.`,descriptionType:`popover`},{type:`switch`,key:`limit_generations`,label:`Limit Generations`,default:!0,description:`Experimental parameter to limit the number of generations from each round of prompting to 1. Set to True to to disregard any instructions in the prompt regarding the number of images to generate and ignore any intermediate images generated by the model. This may affect generation quality. Default value: Open`,descriptionType:`popover`},{type:`select`,key:`thinking_level`,label:`Thinking Level`,options:[{label:`Off`,value:`off`},{label:`Minimal`,value:`minimal`},{label:`High`,value:`high`}],default:`off`,description:`When set, enables model thinking with the given level and includes thoughts in the generation. Omit to disable.`,descriptionType:`popover`},{type:`textarea`,key:`system_prompt`,label:`System Prompt`,default:``,placeholder:`Enter a system prompt for the image generation task.`,rows:5,maxLength:1e3,description:`Optional system instruction that steers the model's persona and output style across the request. Leave blank to omit; when provided, it is sent as the system instruction to Gemini (or as a system message on OpenAI-compatible providers). Default value empty.`,descriptionType:`popover`},{type:`seed-input`,key:`seed`,label:`Seed`}
8],computeCredits:vn,buildInput:({fields:e,enableSafetyChecker:t})=>{let n=Number(e.num_images)||1;return{prompt:e.prompt,num_images:n,seed:e.seed,aspect_ratio:e.aspect_ratio,output_format:e.output_format,safety_tolerance:t?`1`:`6`,sync_mode:!1,system_prompt:e.system_prompt,resolution:e.resolution,limit_generations:e.limit_generations,enable_web_search:e.enable_web_search,...e.thinking_level&&e.thinking_level!==`off`?{thinking_level:e.thinking_level}:{},enable_safety_checker:t}},parseResult:yn}]};function vn(e){let t=e.resolution,n=Number(e.num_images)||1,r={"1K":15,"2K":20,"4K":30}[t]??10;return e.enable_web_search&&(r+=5),r*n}function yn(e){return e.images.map(e=>e.url)}var bn={id:`nano-banana-pro`,platform:`fal`,category:`image`,icon:`/icon/google.svg`,name:`Nano Banana Pro`,description:`Google's premium image generation model with superior detail and composition.`,tabs:[{key:`image-edit`,name:`Image Edit`,resolveEndpoint:()=>`fal-ai/nano-banana-pro/edit`,fields:[{type:`image-input`,key:`image_url`,label:`Image`,required:!0,max:9,default:[],description:`Upload images to edit (required, up to 9 images).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to edit the image...`,rows:5,maxLength:3e3,description:`Describe what you want to edit the image`,enableOptimize:!0,optimizeCategory:`image`,optimizeType:`edit`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`1:1`,value:`1:1`,ratio:`1:1`},{label:`2:3`,value:`2:3`,ratio:`2:3`},{label:`3:2`,value:`3:2`,ratio:`3:2`},{label:`3:4`,value:`3:4`,ratio:`3:4`},{label:`4:3`,value:`4:3`,ratio:`4:3`},{label:`4:5`,value:`4:5`,ratio:`4:5`},{label:`5:4`,value:`5:4`,ratio:`5:4`},{label:`9:16`,value:`9:16`,ratio:`9:16`},{label:`16:9`,value:`16:9`,ratio:`16:9`},{label:`21:9`,value:`21:9`,ratio:`21:9`},{label:`Auto`,value:`auto`}],default:`3:4`},{type:`select`,key:`num_images`,label:`Number of Images`,options:[{label:`1`,value:`1`},{label:`2`,value:`2`},{label:`3`,value:`3`}],default:`1`,description:`Number of images to generate at once`},{type:`select`,key:`output_format`,label:`Output Format`,options:[{label:`JPEG`,value:`jpeg`},{label:`PNG`,value:`png`},{label:`WebP`,value:`webp`}],default:`jpeg`,description:`Format of the output images.`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`0.5K`,value:`0.5K`},{label:`1K`,value:`1K`},{label:`2K`,value:`2K`},{label:`4K`,value:`4K`}],default:`1K`,description:`Resolution of the output images.`},{type:`switch`,key:`enable_web_search`,label:`Enable Web Search`,default:!1,description:`Enable web search for the image generation task. This will allow the model to use the latest information from the web to generate the image.`,descriptionType:`popover`},{type:`switch`,key:`limit_generations`,label:`Limit Generations`,default:!0,description:`Experimental parameter to limit the number of generations from each round of prompting to 1. Set to True to to disregard any instructions in the prompt regarding the number of images to generate and ignore any intermediate images generated by the model. This may affect generation quality. Default value: Open`,descriptionType:`popover`},{type:`textarea`,key:`system_prompt`,label:`System Prompt`,default:``,placeholder:`Enter a system prompt for the image generation task.`,rows:5,maxLength:1e3,description:`Optional system instruction that steers the model's persona and output style across the request. Leave blank to omit; when provided, it is sent as the system instruction to Gemini (or as a system message on OpenAI-compatible providers). Default value empty.`,descriptionType:`popover`},{type:`seed-input`,key:`seed`,label:`Seed`}],computeCredits:xn,buildInput:({fields:e,enableSafetyChecker:t})=>{let n=e.image_url,r=Number(e.num_images)||1;return{prompt:e.prompt,num_images:r,seed:e.seed,aspect_ratio:e.aspect_ratio,output_format:e.output_format,safety_tolerance:t?`1`:`6`,sync_mode:!1,...n?.length?{image_urls:n}:{},system_prompt:e.system_prompt,resolution:e.resolution,limit_generations:e.limit_generations,enable_web_search:e.enable_web_search,enable_safety_checker:t}},parseResult:Sn,example:{input:{image_url:[`https://storage.googleapis.com/falserverless/example_inputs/nano-banana-edit-input.png`,`https://storage.googleapis.com/falserverless/example_inputs/nano-banana-edit-input-2.png`],prompt:`make a photo of the man driving the car down the california coastline`,aspect_ratio:`auto`,output_format:`png`,resolution:`1K`,limit_generations:!1,enable_web_search:!1,num_images:`1`},output:[`https://storage.googleapis.com/falserverless/example_outputs/nano-banana-pro-edit-output.png`],duration:189}},{key:`text-to-image`,name:`Text to Image`,resolveEndpoint:()=>`fal-ai/nano-banana-pro`,fields:[{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to edit the image...`,rows:5,maxLength:3e3,description:`Describe what you want to edit the image`,enableOptimize:!0,optimizeCategory:`image`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`1:1`,value:`1:1`,ratio:`1:1`},{label:`2:3`,value:`2:3`,ratio:`2:3`},{label:`3:2`,value:`3:2`,ratio:`3:2`},{label:`3:4`,value:`3:4`,ratio:`3:4`},{label:`4:3`,value:`4:3`,ratio:`4:3`},{label:`4:5`,value:`4:5`,ratio:`4:5`},{label:`5:4`,value:`5:4`,ratio:`5:4`},{label:`9:16`,value:`9:16`,ratio:`9:16`},{label:`16:9`,value:`16:9`,ratio:`16:9`},{label:`21:9`,value:`21:9`,ratio:`21:9`},{label:`Auto`,value:`auto`}],default:`3:4`},{type:`select`,key:`num_images`,label:`Number of Images`,options:[{label:`1`,value:`1`},{label:`2`,value:`2`},{label:`3`,value:`3`}],default:`1`,description:`Number of images to generate at once`},{type:`select`,key:`output_format`,label:`Output Format`,options:[{label:`JPEG`,value:`jpeg`},{label:`PNG`,value:`png`},{label:`WebP`,value:`webp`}],default:`jpeg`,description:`Format of the output images.`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`0.5K`,value:`0.5K`},{label:`1K`,value:`1K`},{label:`2K`,value:`2K`},{label:`4K`,value:`4K`}],default:`1K`,description:`Resolution of the output images.`},{type:`switch`,key:`enable_web_search`,label:`Enable Web Search`,default:!1,description:`Enable web search for the image generation task. This will allow the model to use the latest information from the web to generate the image.`,descriptionType:`popover`},{type:`switch`,key:`limit_generations`,label:`Limit Generations`,default:!0,description:`Experimental parameter to limit the number of generations from each round of prompting to 1. Set to True to to disregard any instructions in the prompt regarding the number of images to generate and ignore any intermediate images generated by the model. This may affect generation quality. Default value: Open`,descriptionType:`popover`},{type:`textarea`,key:`system_prompt`,label:`System Prompt`,default:``,placeholder:`Enter a system prompt for the image generation task.`,rows:5,maxLength:1e3,description:`Optional system instruction that steers the model's persona and output style across the request. Leave blank to omit; when provided, it is sent as the system instruction to Gemini (or as a system message on OpenAI-compatible providers). Default value empty.`,descriptionType:`popover`},{type:`seed-input`,key:`seed`,label:`Seed`}
8],computeCredits:xn,buildInput:({fields:e,enableSafetyChecker:t})=>{let n=Number(e.num_images)||1;return{prompt:e.prompt,num_images:n,seed:e.seed,aspect_ratio:e.aspect_ratio,output_format:e.output_format,safety_tolerance:t?`1`:`6`,sync_mode:!1,system_prompt:e.system_prompt,resolution:e.resolution,limit_generations:e.limit_generations,enable_web_search:e.enable_web_search,enable_safety_checker:t}},parseResult:Sn,example:{input:{prompt:`An action shot of a black lab swimming in an inground suburban swimming pool. The camera is placed meticulously on the water line, dividing the image in half, revealing both the dogs head above water holding a tennis ball in it's mouth, and it's paws paddling underwater.`,ratio:`1:1`,output_format:`png`,resolution:`1K`,enable_web_search:!1,limit_generations:!1,system_prompt:``},output:[`https://storage.googleapis.com/falserverless/example_outputs/nano-banana-pro-t2i-output.png`],duration:50}}]};function xn(e){let t=e.resolution,n=Number(e.num_images)||1,r=t===`4K`?40:20;return e.enable_web_search&&(r+=5),r*n}function Sn(e){return e.images.map(e=>e.url)}var Cn={id:`seedream-v5-lite`,platform:`fal`,category:`image`,icon:`/icon/bytedance.svg`,name:`Seedream 5 Lite`,description:`Seedream 5.0 lite: image generation with built-in reasoning, example-based editing, and deep domain knowledge`,tabs:[{key:`image-edit`,name:`Image Edit`,resolveEndpoint:()=>`fal-ai/bytedance/seedream/v5/lite/edit`,fields:[{type:`image-input`,key:`image_url`,label:`Image`,required:!0,max:10,default:[],description:`Upload images to edit (required, up to 10 images).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to edit the image...`,rows:5,maxLength:3e3,description:`Describe what you want to edit the image`,enableOptimize:!0,optimizeCategory:`image`,optimizeType:`edit`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`Square HD`,value:`square_hd`,ratio:`1:1`},{label:`Square`,value:`square`,ratio:`1:1`},{label:`3:4`,value:`portrait_4_3`,ratio:`3:4`},{label:`4:3`,value:`landscape_4_3`,ratio:`4:3`},{label:`9:16`,value:`portrait_16_9`,ratio:`9:16`},{label:`16:9`,value:`landscape_16_9`,ratio:`16:9`},{label:`Auto 2K`,value:`auto_2K`},{label:`Auto 3K`,value:`auto_3K`},{label:`Auto 4K`,value:`auto_4K`}],default:`portrait_4_3`},{type:`select`,key:`num_images`,label:`Number of Images`,options:[{label:`1`,value:`1`},{label:`2`,value:`2`},{label:`3`,value:`3`}],default:`1`,description:`Number of images to generate at once`},{type:`seed-input`,key:`seed`,label:`Seed`}],computeCredits:wn,buildInput:({fields:e,enableSafetyChecker:t})=>{let n=e.image_url,r=Number(e.num_images)||1;return{prompt:e.prompt,image_size:e.aspect_ratio,num_images:r,max_images:1,sync_mode:!1,seed:e.seed,...n?.length?{image_urls:n}:{},enable_safety_checker:t}},parseResult:Tn},{key:`text-to-image`,name:`Text to Image`,resolveEndpoint:()=>`fal-ai/bytedance/seedream/v5/lite/text-to-image`,fields:[{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate...`,rows:5,maxLength:3e3,description:`Describe what you want to generate`,enableOptimize:!0,optimizeCategory:`image`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`Square HD`,value:`square_hd`,ratio:`1:1`},{label:`Square`,value:`square`,ratio:`1:1`},{label:`3:4`,value:`portrait_4_3`,ratio:`3:4`},{label:`4:3`,value:`landscape_4_3`,ratio:`4:3`},{label:`9:16`,value:`portrait_16_9`,ratio:`9:16`},{label:`16:9`,value:`landscape_16_9`,ratio:`16:9`},{label:`Auto 2K`,value:`auto_2K`},{label:`Auto 4K`,value:`auto_4K`}],default:`portrait_4_3`},{type:`select`,key:`num_images`,label:`Number of Images`,options:[{label:`1`,value:`1`},{label:`2`,value:`2`},{label:`3`,value:`3`}],default:`1`,description:`Number of images to generate at once`},{type:`seed-input`,key:`seed`,label:`Seed`}],computeCredits:wn,buildInput:({fields:e,enableSafetyChecker:t})=>{let n=Number(e.num_images)||1;return{prompt:e.prompt,image_size:e.aspect_ratio,num_images:n,max_images:1,sync_mode:!1,seed:e.seed,enable_safety_checker:t}},parseResult:Tn}]};function wn(e){let t=e.aspect_ratio,n=Number(e.num_images)||1,r=5;
8return t===`square_hd`||t===`auto_2K`?r=10:t===`auto_3K`?r=15:t===`auto_4K`&&(r=20),r*n}function Tn(e){return e.images.map(e=>e.url)}var En={id:`seedream-v45`,platform:`fal`,category:`image`,icon:`/icon/bytedance.svg`,name:`Seedream 4.5`,description:`ByteDance's high-quality image generation model with excellent prompt adherence.`,isHot:!0,restrictedUserVisible:!1,tabs:[{key:`image-edit`,name:`Image Edit`,resolveEndpoint:()=>`fal-ai/bytedance/seedream/v4.5/edit`,fields:[{type:`image-input`,key:`image_url`,label:`Image`,required:!0,max:10,default:[],description:`Upload images to edit (required, up to 10 images).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to edit the image...`,rows:5,maxLength:3e3,description:`Describe what you want to edit the image`,enableOptimize:!0,optimizeCategory:`image`,optimizeType:`edit`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`Square HD`,value:`square_hd`,ratio:`1:1`},{label:`Square`,value:`square`,ratio:`1:1`},{label:`3:4`,value:`portrait_4_3`,ratio:`3:4`},{label:`4:3`,value:`landscape_4_3`,ratio:`4:3`},{label:`9:16`,value:`portrait_16_9`,ratio:`9:16`},{label:`16:9`,value:`landscape_16_9`,ratio:`16:9`},{label:`Auto 2K`,value:`auto_2K`},{label:`Auto 4K`,value:`auto_4K`}],default:`portrait_4_3`},{type:`select`,key:`num_images`,label:`Number of Images`,options:[{label:`1`,value:`1`},{label:`2`,value:`2`},{label:`3`,value:`3`}],default:`1`,description:`Number of images to generate at once`},{type:`seed-input`,key:`seed`,label:`Seed`}],computeCredits:Dn,buildInput:({fields:e,enableSafetyChecker:t})=>{let n=e.image_url,r=Number(e.num_images)||1;return{prompt:e.prompt,image_size:e.aspect_ratio,num_images:r,max_images:1,seed:e.seed,sync_mode:!1,...n?.length?{image_urls:n}:{},enable_safety_checker:t}},parseResult:On,example:{input:{image_url:[`https://image.nanoimage.ai/example/edit_input_1.jpg`,`https://image.nanoimage.ai/example/edit_input_2.jpg`,`https://image.nanoimage.ai/example/edit_input_3.jpg`],prompt:`Replace the product in Figure 1 with that in Figure 2. For the title copy the text in Figure 3 to the top of the screen, the title should have a clear contrast with the background but not be overly eye-catching.`,aspect_ratio:`portrait_4_3`,num_images:`1`},output:[`https://image.nanoimage.ai/example/edit_output.jpg`],duration:50}},{key:`text-to-image`,name:`Text to Image`,resolveEndpoint:()=>`fal-ai/bytedance/seedream/v4.5/text-to-image`,fields:[{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate...`,rows:5,maxLength:3e3,description:`Describe what you want to generate`,enableOptimize:!0,optimizeCategory:`image`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`Square HD`,value:`square_hd`,ratio:`1:1`},{label:`Square`,value:`square`,ratio:`1:1`},{label:`3:4`,value:`portrait_4_3`,ratio:`3:4`},{label:`4:3`,value:`landscape_4_3`,ratio:`4:3`},{label:`9:16`,value:`portrait_16_9`,ratio:`9:16`},{label:`16:9`,value:`landscape_16_9`,ratio:`16:9`},{label:`Auto 2K`,value:`auto_2K`},{label:`Auto 4K`,value:`auto_4K`}],default:`portrait_4_3`},{type:`select`,key:`num_images`,label:`Number of Images`,options:[{label:`1`,value:`1`},{label:`2`,value:`2`},{label:`3`,value:`3`}],default:`1`,description:`Number of images to generate at once`},{type:`seed-input`,key:`seed`,label:`Seed`}],computeCredits:Dn,buildInput:({fields:e,enableSafetyChecker:t})=>{let n=Number(e.num_images)||1;return{prompt:e.prompt,image_size:e.aspect_ratio,num_images:n,max_images:1,sync_mode:!1,seed:e.seed,enable_safety_checker:t}},parseResult:On}]};function Dn(e){return 5*(Number(e.num_images)||1)}function On(e){return e.images.map(e=>e.url)}var kn={id:`wan-v27`,platform:`fal`,category:`image`,icon:`/icon/qwen.svg`,name:`Wan 2.7`,description:`Alibaba's high-quality image generation model with excellent prompt adherence.`,isNew:!1,isHot:!0,tabs:[{key:`image-edit`,name:`Image Edit`,resolveEndpoint:()=>`fal-ai/wan/v2.7/edit`,fields:[{type:`image-input`,key:`image_url`,label:`Image`,required:!0,max:4,default:[],description:`Upload images to edit (required, up to 4 images).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to edit the image...`,rows:5,maxLength:3e3,description:`Describe what you want to edit the image. Supports Chinese and English.`,enableOptimize:!0,optimizeCategory:`image`,optimizeType:`edit`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`Square HD`,value:`square_hd`,ratio:`1:1`},{label:`Square`,value:`square`,ratio:`1:1`},{label:`3:4`,value:`portrait_4_3`,ratio:`3:4`},{label:`4:3`,value:`landscape_4_3`,ratio:`4:3`},{label:`9:16`,value:`portrait_16_9`,ratio:`9:16`},{label:`16:9`,value:`landscape_16_9`,ratio:`16:9`}],default:`portrait_4_3`},{type:`select`,key:`num_images`,label:`Number of Images`,options:[{label:`1`,value:`1`},{label:`2`,value:`2`},{label:`3`,value:`3`},{label:`4`,value:`4`}],default:`1`,description:`Number of images to generate at once`},{type:`text`,key:`negative_prompt`,label:`Negative Prompt`,default:`blur, distort, and low quality`,placeholder:`Describe what you want to avoid in the image...`,maxLength:500,description:`Describe what you want to avoid in the image.`},{type:`select`,key:`output_format`,label:`Output Format`,options:[{label:`JPEG`,value:`jpeg`},{label:`PNG`,value:`png`},{label:`WebP`,value:`webp`}],default:`jpeg`,description:`Format of the output images.`},{type:`seed-input`,key:`seed`,label:`Seed`}
8],computeCredits:An,buildInput:({fields:e,enableSafetyChecker:t})=>{let n=e.image_url,r=Number(e.num_images)||1;return{prompt:e.prompt,...n?.length?{image_urls:n}:{},negative_prompt:e.negative_prompt,image_size:e.aspect_ratio,num_images:r,enable_prompt_expansion:!0,seed:e.seed,enable_safety_checker:t,output_format:e.output_format}},parseResult:Mn},{key:`text-to-image`,name:`Text to Image`,resolveEndpoint:()=>`fal-ai/wan/v2.7/text-to-image`,fields:[{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate...`,rows:5,maxLength:3e3,description:`Describe what you want to generate. Supports Chinese and English.`,enableOptimize:!0,optimizeCategory:`image`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`Square HD`,value:`square_hd`,ratio:`1:1`},{label:`Square`,value:`square`,ratio:`1:1`},{label:`3:4`,value:`portrait_4_3`,ratio:`3:4`},{label:`4:3`,value:`landscape_4_3`,ratio:`4:3`},{label:`9:16`,value:`portrait_16_9`,ratio:`9:16`},{label:`16:9`,value:`landscape_16_9`,ratio:`16:9`}],default:`portrait_4_3`},{type:`select`,key:`num_images`,label:`Number of Images`,options:[{label:`1`,value:`1`},{label:`2`,value:`2`},{label:`3`,value:`3`},{label:`4`,value:`4`},{label:`5`,value:`5`}],default:`1`,description:`Number of images to generate at once`},{type:`text`,key:`negative_prompt`,label:`Negative Prompt`,default:`blur, distort, and low quality`,placeholder:`Describe what you want to avoid in the image...`,maxLength:500,description:`Describe what you want to avoid in the image.`},{type:`select`,key:`output_format`,label:`Output Format`,options:[{label:`JPEG`,value:`jpeg`},{label:`PNG`,value:`png`},{label:`WebP`,value:`webp`}],default:`jpeg`,description:`Format of the output images.`},{type:`seed-input`,key:`seed`,label:`Seed`}],computeCredits:An,buildInput:({fields:e,enableSafetyChecker:t})=>{let n=Number(e.num_images)||1;return{prompt:e.prompt,negative_prompt:e.negative_prompt,image_size:e.aspect_ratio,num_images:n,seed:e.seed,enable_safety_checker:t,output_format:e.output_format}},parseResult:Mn},{key:`image-edit-pro`,name:`Image Edit (Pro)`,resolveEndpoint:()=>`fal-ai/wan/v2.7/pro/edit`,fields:[{type:`image-input`,key:`image_url`,label:`Image`,required:!0,max:4,default:[],description:`Upload images to edit (required, up to 4 images).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to edit the image...`,rows:5,maxLength:3e3,description:`Describe what you want to edit the image. Supports Chinese and English.`,enableOptimize:!0,optimizeCategory:`image`,optimizeType:`edit`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`Square HD`,value:`square_hd`,ratio:`1:1`},{label:`Square`,value:`square`,ratio:`1:1`},{label:`3:4`,value:`portrait_4_3`,ratio:`3:4`},{label:`4:3`,value:`landscape_4_3`,ratio:`4:3`},{label:`9:16`,value:`portrait_16_9`,ratio:`9:16`},{label:`16:9`,value:`landscape_16_9`,ratio:`16:9`}],default:`portrait_4_3`},{type:`select`,key:`num_images`,label:`Number of Images`,options:[{label:`1`,value:`1`},{label:`2`,value:`2`},{label:`3`,value:`3`},{label:`4`,value:`4`}],default:`1`,description:`Number of images to generate at once`},{type:`text`,key:`negative_prompt`,label:`Negative Prompt`,default:`blur, distort, and low quality`,placeholder:`Describe what you want to avoid in the image...`,maxLength:500,description:`Describe what you want to avoid in the image.`},{type:`select`,key:`output_format`,label:`Output Format`,options:[{label:`JPEG`,value:`jpeg`},{label:`PNG`,value:`png`},{label:`WebP`,value:`webp`}],default:`jpeg`,description:`Format of the output images.`},{type:`seed-input`,key:`seed`,label:`Seed`}],computeCredits:jn,buildInput:({fields:e,enableSafetyChecker:t})=>{let n=e.image_url,r=Number(e.num_images)||1;return{prompt:e.prompt,...n?.length?{image_urls:n}:{},negative_prompt:e.negative_prompt,image_size:e.aspect_ratio,num_images:r,enable_prompt_expansion:!0,seed:e.seed,enable_safety_checker:t,output_format:e.output_format}},parseResult:Mn},{key:`text-to-image-pro`,name:`Text to Image (Pro)`,resolveEndpoint:()=>`fal-ai/wan/v2.7/pro/text-to-image`,fields:[{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate...`,rows:5,maxLength:3e3,description:`Describe what you want to generate. Supports Chinese and English.`,enableOptimize:!0,optimizeCategory:`image`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`Square HD`,value:`square_hd`,ratio:`1:1`},{label:`Square`,value:`square`,ratio:`1:1`},{label:`3:4`,value:`portrait_4_3`,ratio:`3:4`},{label:`4:3`,value:`landscape_4_3`,ratio:`4:3`},{label:`9:16`,value:`portrait_16_9`,ratio:`9:16`},{label:`16:9`,value:`landscape_16_9`,ratio:`16:9`}],default:`portrait_4_3`},{type:`select`,key:`num_images`,label:`Number of Images`,options:[{label:`1`,value:`1`},{label:`2`,value:`2`},{label:`3`,value:`3`},{label:`4`,value:`4`},{label:`5`,value:`5`}],default:`1`,description:`Number of images to generate at once`},{type:`text`,key:`negative_prompt`,label:`Negative Prompt`,default:`blur, distort, and low quality`,placeholder:`Describe what you want to avoid in the image...`,maxLength:500,description:`Describe what you want to avoid in the image.`},{type:`select`,key:`output_format`,label:`Output Format`,options:[{label:`JPEG`,value:`jpeg`},{label:`PNG`,value:`png`},{label:`WebP`,value:`webp`}],default:`jpeg`,description:`Format of the output images.`},{type:`seed-input`,key:`seed`,label:`Seed`}
8],computeCredits:jn,buildInput:({fields:e,enableSafetyChecker:t})=>{let n=Number(e.num_images)||1;return{prompt:e.prompt,negative_prompt:e.negative_prompt,image_size:e.aspect_ratio,num_images:n,seed:e.seed,enable_safety_checker:t,output_format:e.output_format}},parseResult:Mn}]};function An(e){return 5*(Number(e.num_images)||1)}function jn(e){return 10*(Number(e.num_images)||1)}function Mn(e){return e.images.map(e=>e.url)}var Nn={id:`elevenlabs`,platform:`fal`,category:`speech`,icon:`/icon/elevenlabs.svg`,name:`ElevenLabs`,description:`Industry-leading text-to-speech model with natural and expressive voice synthesis.`,isNew:!0,tabs:[{key:`text-to-speech`,name:`Text to Speech`,outputType:`audio`,resolveEndpoint:()=>`fal-ai/elevenlabs/tts/turbo-v2.5`,fields:[{type:`textarea`,key:`text`,label:`Text`,required:!0,default:``,placeholder:`Enter the text you want to convert to speech...`,rows:5,maxLength:3e3,description:`Enter the text you want to convert to speech`,alert:`3 credits / 1K chars`,enableOptimize:!0,optimizeCategory:`speech`},{type:`select`,key:`voice`,label:`Voice`,options:[{label:`Aria(â)`,value:`Aria`},{label:`Roger(â)`,value:`Roger`},{label:`Sarah(â)`,value:`Sarah`},{label:`Laura(â)`,value:`Laura`},{label:`Charlie(â)`,value:`Charlie`},{label:`George(â)`,value:`George`},{label:`Callum(â)`,value:`Callum`},{label:`River(â)`,value:`River`},{label:`Liam(â)`,value:`Liam`},{label:`Charlotte(â)`,value:`Charlotte`},{label:`Alice(â)`,value:`Alice`},{label:`Matilda(â)`,value:`Matilda`},{label:`Will(â)`,value:`Will`},{label:`Jessica(â)`,value:`Jessica`},{label:`Eric(â)`,value:`Eric`},{label:`Chris(â)`,value:`Chris`},{label:`Brian(â)`,value:`Brian`},{label:`Daniel(â)`,value:`Daniel`},{label:`Lily(â)`,value:`Lily`},{label:`Bill(â)`,value:`Bill`}],default:`Aria`,description:`Select the voice you want to use for the speech`},{type:`slider`,key:`stability`,label:`Stability`,default:.5,min:.1,max:1,step:.1,description:`Adjust the stability of the speech`,descriptionType:`popover`,minLabel:`Variable`,maxLabel:`Stable`},{type:`slider`,key:`similarity_boost`,label:`Similarity Boost`,default:.7,min:.1,max:1,step:.1,description:`Adjust the similarity boost of the speech`,descriptionType:`popover`,minLabel:`Low`,maxLabel:`High`},{type:`slider`,key:`style`,label:`Style`,default:0,min:.1,max:1,step:.1,description:`Adjust the style of the speech`,descriptionType:`popover`,minLabel:`Neutral`,maxLabel:`Creative`},{type:`slider`,key:`speed`,label:`Speed`,default:1,min:.7,max:1.2,step:.1,description:`Adjust the speed of the speech`,descriptionType:`popover`,minLabel:`Slow (0.7)`,maxLabel:`Fast (1.2)`},{type:`select`,key:`apply_text_normalization`,label:`Apply Text Normalization`,options:[{label:`auto`,value:`auto`},{label:`on`,value:`on`},{label:`off`,value:`off`}],default:`auto`,description:`Apply text normalization to the speech`},{type:`text`,key:`language_code`,label:`Language Code`,default:`en`,description:`Language code, e.g. en, zh, ja, de`,maxLength:20,descriptionType:`popover`}],computeCredits:e=>{let t=e.text||``;return Math.max(5,Math.ceil(t.length/500)*5)},buildInput:({fields:e,enableSafetyChecker:t})=>({text:e.text,voice:e.voice,stability:e.stability,similarity_boost:e.similarity_boost,style:e.style,speed:e.speed,timestamps:!1,language_code:e.language_code,apply_text_normalization:e.apply_text_normalization,enable_safety_checker:t}),parseResult:e=>{let t=e.audio;return t?[t.url]:[]},example:{input:{text:`Hello! This is a test of the text to speech system, powered by ElevenLabs. How does it sound?`,voice:`Aria`,stability:.5,similarity_boost:.7,style:0,speed:1,apply_text_normalization:`auto`,language_code:`en`},output:[`https://v3.fal.media/files/zebra/zJL_oRY8h5RWwjoK1w7tx_output.mp3`],duration:98}},{key:`speech-to-text`,name:`Speech to Text`,outputType:`text`,resolveEndpoint:()=>`fal-ai/elevenlabs/speech-to-text`,fields:[{type:`audio-input`,key:`audio_url`,label:`Audio`,required:!0,accept:[`audio/mpeg`,`audio/ogg`,`audio/wav`,`audio/x-m4a`,`audio/aac`],max:1,default:[],description:`Upload audio file (mp3, ogg, wav, m4a, aac)`},{type:`text`,key:`language_code`,label:`Language Code`,default:`en`,description:`Language code, e.g. en, zh, ja, de`,maxLength:20,descriptionType:`popover`},{type:`switch`,key:`tag_audio_events`,label:`Tag Audio Events`,default:!1,description:`Tag audio events in the speech`,descriptionType:`popover`},{type:`switch`,key:`diarize`,label:`Diarize`,default:!1,description:`Diarize the audio in the speech`,descriptionType:`popover`}],computeCredits:e=>{let t=e.audio_url_duration||60;return Math.max(1,Math.ceil(t/60)*3)},buildInput:({fields:e,enableSafetyChecker:t})=>({audio_url:Array.isArray(e.audio_url)?e.audio_url[0]||``:e.audio_url,language_code:e.language_code,tag_audio_events:e.tag_audio_events,diarize:e.diarize,enable_safety_checker:t}),parseResult:e=>[JSON.stringify(e)],example:{input:{audio_url:[`https://v3.fal.media/files/zebra/zJL_oRY8h5RWwjoK1w7tx_output.mp3`],language_code:`en`,tag_audio_events:!0,diarize:!0},output:[`{"text":"Hello! This is a test of the text to speech system.","language_code":"eng","words":[]}`],duration:15}}]},Pn=1e4;function Fn(){return Math.floor(Math.random()*9e4)+Pn}function In(e){let t={};
8for(let n of e)n.type===`seed-input`?(t[n.key]=Fn(),t[`${n.key}_locked`]=!1):t[n.key]=n.default;return t}function Ln(e,t){let n={...t};for(let t of e)t.type===`seed-input`&&((n[`${t.key}_locked`]??!1)||(n[t.key]=Fn()));return n}var Rn={id:`happy-horse-v11`,platform:`fal`,category:`video`,icon:`/icon/alibaba.svg`,name:`Happy Horse V1.1`,description:`Alibaba's video generation model optimized for creative and dynamic content.`,isNew:!1,tabs:[{key:`text-to-video`,name:`Text to Video`,outputType:`video`,resolveEndpoint:()=>`alibaba/happy-horse/v1.1/text-to-video`,fields:[{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:2500,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`1:1`,value:`1:1`},{label:`3:4`,value:`3:4`},{label:`4:3`,value:`4:3`},{label:`4:5`,value:`4:5`},{label:`5:4`,value:`5:4`},{label:`9:16`,value:`9:16`},{label:`9:21`,value:`9:21`},{label:`16:9`,value:`16:9`},{label:`21:9`,value:`21:9`}],default:`16:9`,description:`Aspect ratio of the video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`720p`,value:`720p`},{label:`1080p`,value:`1080p`}],default:`720p`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`3s`,value:`3`},{label:`4s`,value:`4`},{label:`5s`,value:`5`},{label:`6s`,value:`6`},{label:`7s`,value:`7`},{label:`8s`,value:`8`},{label:`9s`,value:`9`},{label:`10s`,value:`10`},{label:`11s`,value:`11`},{label:`12s`,value:`12`},{label:`13s`,value:`13`},{label:`14s`,value:`14`},{label:`15s`,value:`15`}],default:`5`,description:`Duration of the video`},{type:`seed-input`,key:`seed`,label:`Seed`}],computeCredits:zn,buildInput:({fields:e,enableSafetyChecker:t})=>({prompt:e.prompt,aspect_ratio:e.aspect_ratio,resolution:e.resolution,duration:e.duration,seed:e.seed,enable_safety_checker:t}),parseResult:Bn,example:{input:{prompt:`Medium shot of a professional news anchor at a sleek desk in a modern broadcast studio, cool blue lighting, softly glowing screens behind. 0-5s: He looks into the camera and says in a clear measured voice, "Good evening. Tonight, a breakthrough that could change how millions of us work." 5-10s: He turns slightly toward a second camera, "We'll have the full story, and what it means for you, right after this." Precise lip-sync, subtle studio room tone, crisp broadcast quality, shallow depth of field.`,resolution:`720p`,duration:`10`,aspect_ratio:`16:9`},output:[`https://v3b.fal.media/files/b/0a9f3a12/VUE_7oBMkmCcKNawH0G_a_922UfRwW.mp4`],duration:165}},{key:`image-to-video`,name:`Image to Video`,outputType:`video`,resolveEndpoint:()=>`alibaba/happy-horse/v1.1/image-to-video`,fields:[{type:`image-input`,key:`image_url`,label:`Image`,required:!0,max:1,default:``,description:`The image to generate the video from (required).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:2500,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`720p`,value:`720p`},{label:`1080p`,value:`1080p`}],default:`720p`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`3s`,value:`3`},{label:`4s`,value:`4`},{label:`5s`,value:`5`},{label:`6s`,value:`6`},{label:`7s`,value:`7`},{label:`8s`,value:`8`},{label:`9s`,value:`9`},{label:`10s`,value:`10`},{label:`11s`,value:`11`},{label:`12s`,value:`12`},{label:`13s`,value:`13`},{label:`14s`,value:`14`},{label:`15s`,value:`15`}],default:`5`,description:`Duration of the video`},{type:`seed-input`,key:`seed`,label:`Seed`}],computeCredits:zn,buildInput:({fields:e,enableSafetyChecker:t})=>({image_url:e.image_url,prompt:e.prompt,resolution:e.resolution,duration:e.duration,seed:e.seed,enable_safety_checker:t}),parseResult:Bn,example:{input:{prompt:`Bring the scene in the image to life.`,image_url:`https://v3b.fal.media/files/b/0a9eaaaa/A5Z-Bbuk0cZondKU0Cksq_eGkoZngK.png`,resolution:`720p`,duration:`10`,aspect_ratio:`16:9`},output:[`https://v3b.fal.media/files/b/0a9f39fd/N9U9ZDVOZvX13yQTzx0wN_NrDUbOAF.mp4`],duration:218}},{key:`reference-to-video`,name:`Reference to Video`,outputType:`video`,resolveEndpoint:()=>`alibaba/happy-horse/v1.1/reference-to-video`,fields:[{type:`image-input`,key:`image_url`,label:`Image`,required:!0,max:9,default:``,description:`Reference images for subject consistency (1-9 images). Formats: JPEG, JPG, PNG, WEBP. Shortest side must be at least 400 px (720P or higher recommended). Max 20 MB each. (required).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:2500,description:`Text prompt describing the desired video. Reference subjects from your images using character1, character2, ... up to character9`,enableOptimize:!0,optimizeCategory:`video`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`1:1`,value:`1:1`},{label:`3:4`,value:`3:4`},{label:`4:3`,value:`4:3`},{label:`4:5`,value:`4:5`},{label:`5:4`,value:`5:4`},{label:`9:16`,value:`9:16`},{label:`9:21`,value:`9:21`},{label:`16:9`,value:`16:9`},{label:`21:9`,value:`21:9`}],default:`16:9`,description:`Aspect ratio of the video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`720p`,value:`720p`},{label:`1080p`,value:`1080p`}],default:`720p`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`3s`,value:`3`},{label:`4s`,value:`4`},{label:`5s`,value:`5`},{label:`6s`,value:`6`},{label:`7s`,value:`7`},{label:`8s`,value:`8`},{label:`9s`,value:`9`},{label:`10s`,value:`10`},{label:`11s`,value:`11`},{label:`12s`,value:`12`},{label:`13s`,value:`13`},{label:`14s`,value:`14`},{label:`15s`,value:`15`}],default:`5`,description:`Duration of the video`},{type:`seed-input`,key:`seed`,label:`Seed`}
8],computeCredits:zn,buildInput:({fields:e,enableSafetyChecker:t})=>{let n=e.image_url;return{prompt:e.prompt,...n?.length?{image_urls:n}:{},aspect_ratio:e.aspect_ratio,resolution:e.resolution,duration:e.duration,seed:e.seed,enable_safety_checker:t}},parseResult:Bn,example:{input:{prompt:`Arrange the skincare serum bottle on the marble surface surrounded by the eucalyptus leaves, white jasmine flowers, and glistening water droplets from the references, forming a fresh premium skincare product scene, with a slow gentle camera move and soft consistent spa lighting.`,image_url:[`https://v3b.fal.media/files/b/0a9d84a6/gskmRfROCTPcC4SlJqS18_bmeTBX4F.png`,`https://v3b.fal.media/files/b/0a9d84a8/f5ZLLko_5tFg7LUCcODvo_MOrrvNIQ.png`,`https://v3b.fal.media/files/b/0a9d84aa/a690naJipCHbKHpE3ZmUR_6bOFZY2L.png`,`https://v3b.fal.media/files/b/0a9d84af/iyAgMiLIOkDlcKqIao5ib_8BRYDa23.png`],resolution:`720p`,duration:`10`,aspect_ratio:`16:9`},output:[`https://v3b.fal.media/files/b/0a9f3a7b/dCPmgZZFTeE_FaOXiv_d__179TS4kD.mp4`],duration:315}}]};function zn(e){let t=e.resolution,n=Number(e.duration)||5;return(t===`1080p`?20:10)*n}function Bn(e){let t=e.video;return t?(Array.isArray(t)?t:[t]).map(e=>e.url):[]}var Vn={id:`kling-v3`,platform:`fal`,category:`video`,icon:`/icon/kling.svg`,name:`Kling Video v3`,description:`Kuaishou's advanced video generation model with realistic motion and physics.`,tabs:[{key:`text-to-video`,name:`Text to Video`,outputType:`video`,resolveEndpoint:()=>
8`fal-ai/kling-video/v3/standard/text-to-video`,fields:[{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:3e3,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`3s`,value:`3`},{label:`4s`,value:`4`},{label:`5s`,value:`5`},{label:`6s`,value:`6`},{label:`7s`,value:`7`},{label:`8s`,value:`8`},{label:`9s`,value:`9`},{label:`10s`,value:`10`},{label:`11s`,value:`11`},{label:`12s`,value:`12`},{label:`13s`,value:`13`},{label:`14s`,value:`14`},{label:`15s`,value:`15`}],default:`10`,description:`Duration of the video`},{type:`switch`,key:`generate_audio`,label:`Generate Audio`,default:!1,description:`Generate audio for the video`},{type:`select`,key:`shot_type`,label:`Shot Type`,options:[{label:`Customize`,value:`customize`},{label:`Intelligent`,value:`intelligent`}],default:`customize`,description:`Type of shot to generate`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`1:1`,value:`1:1`},{label:`9:16`,value:`9:16`},{label:`16:9`,value:`16:9`}],default:`16:9`,description:`Aspect ratio of the video`},{type:`text`,key:`negative_prompt`,label:`Negative Prompt`,default:`blur, distort, and low quality`,placeholder:`Describe what you want to avoid in the video...`,maxLength:500,description:`Describe what you want to avoid in the video`}],computeCredits:()=>50,buildInput:({fields:e,enableSafetyChecker:t})=>({prompt:e.prompt,duration:e.duration,generate_audio:e.generate_audio,shot_type:e.shot_type,aspect_ratio:e.aspect_ratio,negative_prompt:e.negative_prompt,enable_safety_checker:t}),parseResult:e=>{let t=e.video;return t?(Array.isArray(t)?t:[t]).map(e=>e.url):[]},example:{input:{prompt:`Cinematic drone shot flying through ancient stone ruins covered in moss and vines at golden hour. Camera starts low, rises through crumbling archways, revealing a vast misty valley beyond. Volumetric light rays pierce through gaps in the stone. Epic scale, photorealistic, 8K quality.`,duration:`5`,aspect_ratio:`16:9`,generate_audio:!0,shot_type:`customize`,negative_prompt:`blur, distort, and low quality`},output:[`https://storage.googleapis.com/falserverless/example_outputs/kling-v3/standard-t2v/out.mp4`],duration:98}},{key:`image-to-video`,name:`Image to Video`,outputType:`video`,resolveEndpoint:()=>`fal-ai/kling-video/v3/standard/image-to-video`,fields:[{type:`image-input`,key:`start_image_url`,label:`Start Image`,required:!0,max:1,default:``,description:`The starting frame image to animate from (required).`},{type:`image-input`,key:`end_image_url`,label:`End Image`,required:!1,max:1,default:``,description:`The ending frame image to animate to (optional).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:3e3,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`3s`,value:`3`},{label:`4s`,value:`4`},{label:`5s`,value:`5`},{label:`6s`,value:`6`},{label:`7s`,value:`7`},{label:`8s`,value:`8`},{label:`9s`,value:`9`},{label:`10s`,value:`10`},{label:`11s`,value:`11`},{label:`12s`,value:`12`},{label:`13s`,value:`13`},{label:`14s`,value:`14`},{label:`15s`,value:`15`}],default:`10`,description:`Duration of the video`},{type:`switch`,key:`generate_audio`,label:`Generate Audio`,default:!1,description:`Generate audio for the video`},{type:`select`,key:`shot_type`,label:`Shot Type`,options:[{label:`Customize`,value:`customize`},{label:`Intelligent`,value:`intelligent`}],default:`customize`,description:`Type of shot to generate`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`1:1`,value:`1:1`},{label:`9:16`,value:`9:16`},{label:`16:9`,value:`16:9`}],default:`16:9`,description:`Aspect ratio of the video`},{type:`text`,key:`negative_prompt`,label:`Negative Prompt`,default:`blur, distort, and low quality`,placeholder:`Describe what you want to avoid in the video...`,maxLength:500,description:`Describe what you want to avoid in the video`}],computeCredits:()=>50,buildInput:({fields:e,enableSafetyChecker:t})=>({prompt:e.prompt,start_image_url:e.start_image_url,...e.end_image_url?{end_image_url:e.end_image_url}:{},duration:e.duration,generate_audio:e.generate_audio,shot_type:e.shot_type,aspect_ratio:e.aspect_ratio,negative_prompt:e.negative_prompt,enable_safety_checker:t}),parseResult:e=>{let t=e.video;return t?(Array.isArray(t)?t:[t]).map(e=>e.url):[]},example:{input:{prompt:`Camera slowly orbits around the vase. Soft light shifts across the ceramic surface. The pampas grass sways gently. Shadows move elegantly. Smooth continuous motion, premium feel.`,start_image_url:`https://storage.googleapis.com/falserverless/example_inputs/kling-v3/standard-i2v/start_image.png`,duration:`12`,aspect_ratio:`16:9`,generate_audio:!0,shot_type:`customize`,negative_prompt:`blur, distort, and low quality`},output:[`https://storage.googleapis.com/falserverless/example_outputs/kling-v3/standard-i2v/out.mp4`],duration:98}}]},Hn={id:`minimax-h3`,platform:`fal`,category:`video`,icon:`/icon/minimax.svg`,name:`MiniMax H3`,description:`MiniMax H3 is an open-weights, general-purpose multimodal video model. Instead of a separate model for each task, MiniMax H3 reads text, images, video, and audio in one unified context and generates coherent audiovisual results from any mix of them.`,isNew:!1,isHot:!1,tabs:[{key:`text-to-vi
8deo`,name:`Text to Video`,outputType:`video`,resolveEndpoint:()=>`minimax/h3/text-to-video`,fields:[{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:3e3,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`768P`,value:`768P`},{label:`2K`,value:`2K`},{label:`4K`,value:`4K`}],default:`2K`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`5s`,value:`5`},{label:`6s`,value:`6`},{label:`7s`,value:`7`},{label:`8s`,value:`8`},{label:`9s`,value:`9`},{label:`10s`,value:`10`},{label:`11s`,value:`11`},{label:`12s`,value:`12`},{label:`13s`,value:`13`},{label:`14s`,value:`14`},{label:`15s`,value:`15`}],default:`5`,description:`Duration of the video`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`1:1`,value:`1:1`},{label:`3:4`,value:`3:4`},{label:`4:3`,value:`4:3`},{label:`9:16`,value:`9:16`},{label:`16:9`,value:`16:9`},{label:`21:9`,value:`21:9`}],default:`16:9`,description:`Aspect ratio of the video`}],computeCredits:Kn,buildInput:({fields:e,enableSafetyChecker:t})=>({prompt:e.prompt,resolution:e.resolution,duration:e.duration,aspect_ratio:e.aspect_ratio,enable_safety_checker:t}),parseResult:Jn,example:{input:{prompt:`A white kitten chases a butterfly across a sunlit garden. Gentle camera tracking, natural movement, soft afternoon light filtering through the leaves.`,resolution:`2K`,duration:`5`,aspect_ratio:`16:9`},output:[`https://v3b.fal.media/files/b/0aa46818/--prs89fkHtWW406fmEs__NRhTqNku.mp4`],duration:120}},{key:`image-to-video`,name:`Image to Video`,outputType:`video`,resolveEndpoint:()=>`minimax/h3/image-to-video`,fields:[{type:`image-input`,key:`image_url`,label:`Start Image`,required:!0,max:1,default:``,description:`The starting frame image to animate from (required).`},{type:`image-input`,key:`end_image_url`,label:`End Image`,required:!1,max:1,default:``,description:`The ending frame image to animate to (optional).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:3e3,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`768P`,value:`768P`},{label:`2K`,value:`2K`},{label:`4K`,value:`4K`}],default:`2K`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`5s`,value:`5`},{label:`6s`,value:`6`},{label:`7s`,value:`7`},{label:`8s`,value:`8`},{label:`9s`,value:`9`},{label:`10s`,value:`10`},{label:`11s`,value:`11`},{label:`12s`,value:`12`},{label:`13s`,value:`13`},{label:`14s`,value:`14`},{label:`15s`,value:`15`}],default:`5`,description:`Duration of the video`}],computeCredits:Kn,buildInput:({fields:e,enableSafetyChecker:t})=>({prompt:e.prompt,image_url:e.image_url,...e.end_image_url?{end_image_url:e.end_image_url}:{},resolution:e.resolution,duration:e.duration,enable_safety_checker:t}),parseResult:Jn},{key:`reference-to-video`,name:`Reference To Video`,outputType:`video`,resolveEndpoint:()=>`minimax/h3/reference-to-video`,fields:[{type:`image-input`,key:`image_url`,label:`Image`,required:!1,max:10,default:[],description:`Reference images to guide video generation. Refer to them in the prompt as Image 1, Image 2, etc.`},{type:`video-input`,key:`video_url`,label:`Video`,required:!1,max:10,default:[],description:`Reference videos to guide video generation. Refer to them in the prompt as Video 1, Video 2, etc.`},{type:`audio-input`,key:`audio_url`,label:`Audio`,required:!1,accept:[`audio/mpeg`,`audio/wav`],max:10,default:[],description:`Reference audio to guide video generation. Refer to them in the prompt as Audio 1, Audio 2, etc.`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:3e3,description:`Text prompt for video generation. Refer to reference assets by their modality and order in the reference lists: Image 1, Image 2, Video 1, Audio 1, and so on.`,enableOptimize:!0,optimizeCategory:`video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`768P`,value:`768P`},{label:`2K`,value:`2K`},{label:`4K`,value:`4K`}],default:`2K`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`5s`,value:`5`},{label:`6s`,value:`6`},{label:`7s`,value:`7`},{label:`8s`,value:`8`},{label:`9s`,value:`9`},{label:`10s`,value:`10`},{label:`11s`,value:`11`},{label:`12s`,value:`12`},{label:`13s`,value:`13`},{label:`14s`,value:`14`},{label:`15s`,value:`15`}],default:`5`,description:`Duration of the video`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`adaptive`,value:`adaptive`},{label:`1:1`,value:`1:1`},{label:`3:4`,value:`3:4`},{label:`4:3`,value:`4:3`},{label:`9:16`,value:`9:16`},{label:`16:9`,value:`16:9`},{label:`21:9`,value:`21:9`}],default:`adaptive`,description:`Aspect ratio of the video`}],computeCredits:qn,buildInput:({fields:e,enableSafetyChecker:t})=>{let n=e.image_url,r=e.video_url,i=e.audio_url;return{prompt:e.prompt,...n?.length?{reference_image_urls:n}:{},...r?.length?{reference_video_urls:r}:{},...i?.length?{reference_audio_urls:i}:{},resolution:e.resolution,duration:e.duration,aspect_ratio:e.aspect_ratio,enable_safety_checker:t}},parseResult:Jn}]}
8,Un={"768P":6,"2K":9.75,"4K":12},Wn=5,Gn=6;function Kn(e){let t=Un[e.resolution]??Un[`2K`],n=Number(e.duration)||5;return Math.round(t*n)}function qn(e){let t=Un[e.resolution]??Un[`2K`],n=Number(e.duration)||5,r=Array.isArray(e.image_url)?e.image_url:[],i=Math.max(0,r.length-Wn);return Math.round(t*n+i*Gn)}function Jn(e){let t=e.video;return t?(Array.isArray(t)?t:[t]).map(e=>e.url):[]}var Yn={id:`minimax-h3-max`,platform:`fal`,category:`video`,icon:`/icon/minimax.svg`,name:`MiniMax H3 Max`,description:`MiniMax H3 Max is a post-trained variant of MiniMax H3, tuned for stronger prompt adherence and better aesthetics while co-optimized with our custom inference stack for higher throughput with no compromises on output quality`,isNew:!0,isHot:!0,tabs:[{key:`text-to-video`,name:`Text to Video`,outputType:`video`,resolveEndpoint:()=>`minimax/h3-max/text-to-video`,fields:[{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:3e3,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`480P`,value:`480P`},{label:`768P`,value:`768P`}],default:`768P`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`5s`,value:`5`},{label:`6s`,value:`6`},{label:`7s`,value:`7`},{label:`8s`,value:`8`},{label:`9s`,value:`9`},{label:`10s`,value:`10`},{label:`11s`,value:`11`},{label:`12s`,value:`12`},{label:`13s`,value:`13`},{label:`14s`,value:`14`},{label:`15s`,value:`15`}],default:`5`,description:`Duration of the video`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`1:1`,value:`1:1`},{label:`3:4`,value:`3:4`},{label:`4:3`,value:`4:3`},{label:`9:16`,value:`9:16`},{label:`16:9`,value:`16:9`},{label:`21:9`,value:`21:9`}],default:`16:9`,description:`Aspect ratio of the video`},{type:`select`,key:`prompt_expansion_mode`,label:`Prompt Expansion Mode`,required:!0,options:[{label:`Balanced`,value:`balanced`},{label:`Quality`,value:`quality`}],default:`balanced`,description:`How much effort to spend rewriting the prompt before generation. 'balanced' returns in about a second. 'quality' spends up to ~30s on a richer prompt.`,descriptionType:`popover`},{type:`seed-input`,key:`seed`,label:`Seed`}],computeCredits:$n,buildInput:({fields:e,enableSafetyChecker:t})=>({prompt:e.prompt,duration:e.duration,resolution:e.resolution,seed:e.seed,enable_safety_checker:t,prompt_expansion_mode:e.prompt_expansion_mode,aspect_ratio:e.aspect_ratio}),parseResult:tr,example:{input:{prompt:`An aging warrior-monk in scorched ceremonial armor, a split ceramic mask and a humming prayer-band on his forearm + 0â4s: climbs silently along a cliffside terrace as insect-like surveyor drones comb the sun-bleached ruins, standing alone under as the camera rises over the ruined monastery. Sun-blasted post-apocalyptic sci-fi action, dust, heat haze, practical debris, sweeping crane tracking, silence broken only by wind.`,resolution:`768P`,prompt_expansion_mode:`balanced`,duration:`5`,aspect_ratio:`16:9`},output:[`https://v3b.fal.media/files/b/0aa7ecbd/cJvT63jq0mDi8-E8fYXHq_minimax-h3.mp4`],duration:3}},{key:`image-to-video`,name:`Image to Video`,outputType:`video`,resolveEndpoint:()=>`minimax/h3-max/image-to-video`,fields:[{type:`image-input`,key:`image_url`,label:`Start Image`,required:!0,max:1,default:``,description:`The starting frame image to animate from (required).`},{type:`image-input`,key:`end_image_url`,label:`End Image`,required:!1,max:1,default:``,description:`The ending frame image to animate to (optional).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:3e3,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`480P`,value:`480P`},{label:`768P`,value:`768P`}],default:`768P`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`5s`,value:`5`},{label:`6s`,value:`6`},{label:`7s`,value:`7`},{label:`8s`,value:`8`},{label:`9s`,value:`9`},{label:`10s`,value:`10`},{label:`11s`,value:`11`},{label:`12s`,value:`12`},{label:`13s`,value:`13`},{label:`14s`,value:`14`},{label:`15s`,value:`15`}],default:`5`,description:`Duration of the video`},{type:`select`,key:`prompt_expansion_mode`,label:`Prompt Expansion Mode`,required:!0,options:[{label:`Balanced`,value:`balanced`},{label:`Quality`,value:`quality`}],default:`balanced`,description:`How much effort to spend rewriting the prompt before generation. 'balanced' returns in about a second. 'quality' spends up to ~30s on a richer prompt.`,descriptionType:`popover`},{type:`seed-input`,key:`seed`,label:`Seed`}
8],computeCredits:$n,buildInput:({fields:e,enableSafetyChecker:t})=>({prompt:e.prompt,duration:e.duration,resolution:e.resolution,seed:e.seed,enable_safety_checker:t,prompt_expansion_mode:e.prompt_expansion_mode,image_url:e.image_url,...e.end_image_url?{end_image_url:e.end_image_url}:{}}),parseResult:tr},{key:`reference-to-video`,name:`Reference To Video`,outputType:`video`,resolveEndpoint:()=>`minimax/h3-max/reference-to-video`,fields:[{type:`image-input`,key:`image_url`,label:`Image`,required:!1,max:12,default:[],description:`Reference images to guide video generation. Refer to them in the prompt as Image 1, Image 2, etc.`},{type:`video-input`,key:`video_url`,label:`Video`,required:!1,max:12,default:[],description:`Reference videos to guide video generation. Refer to them in the prompt as Video 1, Video 2, etc.`},{type:`audio-input`,key:`audio_url`,label:`Audio`,required:!1,accept:[`audio/mpeg`,`audio/wav`],max:12,default:[],description:`Reference audio to guide video generation. Refer to them in the prompt as Audio 1, Audio 2, etc.`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:3e3,description:`Text prompt for video generation. Refer to reference assets by their modality and order in the reference lists: Image 1, Image 2, Video 1, Audio 1, and so on.`,enableOptimize:!0,optimizeCategory:`video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`480P`,value:`480P`},{label:`768P`,value:`768P`}],default:`768P`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`5s`,value:`5`},{label:`6s`,value:`6`},{label:`7s`,value:`7`},{label:`8s`,value:`8`},{label:`9s`,value:`9`},{label:`10s`,value:`10`},{label:`11s`,value:`11`},{label:`12s`,value:`12`},{label:`13s`,value:`13`},{label:`14s`,value:`14`},{label:`15s`,value:`15`}],default:`5`,description:`Duration of the video`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`adaptive`,value:`adaptive`},{label:`1:1`,value:`1:1`},{label:`3:4`,value:`3:4`},{label:`4:3`,value:`4:3`},{label:`9:16`,value:`9:16`},{label:`16:9`,value:`16:9`},{label:`21:9`,value:`21:9`}],default:`adaptive`,description:`Aspect ratio of the video`},{type:`select`,key:`prompt_expansion_mode`,label:`Prompt Expansion Mode`,required:!0,options:[{label:`Balanced`,value:`balanced`},{label:`Quality`,value:`quality`}],default:`balanced`,description:`How much effort to spend rewriting the prompt before generation. 'balanced' returns in about a second. 'quality' spends up to ~30s on a richer prompt.`,descriptionType:`popover`},{type:`seed-input`,key:`seed`,label:`Seed`}],computeCredits:er,buildInput:({fields:e,enableSafetyChecker:t})=>{let n=e.image_url,r=e.video_url,i=e.audio_url;return{prompt:e.prompt,duration:e.duration,resolution:e.resolution,seed:e.seed,enable_safety_checker:t,prompt_expansion_mode:e.prompt_expansion_mode,aspect_ratio:e.aspect_ratio,...n?.length?{reference_image_urls:n}:{},...r?.length?{reference_video_urls:r}:{},...i?.length?{reference_audio_urls:i}:{}}},parseResult:tr}]},Xn={"480P":3.75,"768P":6},Zn=4,Qn=1.5;function $n(e){let t=Xn[e.resolution]??Xn[`768P`],n=Number(e.duration)||5;return Math.round(t*n)}function er(e){let t=Xn[e.resolution]??Xn[`768P`],n=Number(e.duration)||5,r=Array.isArray(e.image_url)?e.image_url:[],i=Math.max(0,r.length-Zn);return Math.round(t*n+i*Qn)}function tr(e){let t=e.video;return t?(Array.isArray(t)?t:[t]).map(e=>e.url):[]}var nr={id:`seedance-v2`,platform:`fal`,category:`video`,icon:`/icon/bytedance.svg`,name:`Seedance 2.0`,description:`ByteDance's next-generation video model with improved coherence and visual fidelity.`,tabs:[{key:`text-to-video`,name:`Text to Video`,outputType:`video`,resolveEndpoint:()=>`bytedance/seedance-2.0/text-to-video`,fields:[{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:3e3,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`480p`,value:`480p`},{label:`720p`,value:`720p`},{label:`1080p`,value:`1080p`}],default:`480p`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`auto`,value:`auto`},{label:`4s`,value:`4`},{label:`5s`,value:`5`},{label:`6s`,value:`6`},{label:`7s`,value:`7`},{label:`8s`,value:`8`},{label:`9s`,value:`9`},{label:`10s`,value:`10`},{label:`11s`,value:`11`},{label:`12s`,value:`12`},{label:`13s`,value:`13`},{label:`14s`,value:`14`},{label:`15s`,value:`15`}],default:`5`,description:`Duration of the video`},{type:`switch`,key:`generate_audio`,label:`Generate Audio`,default:!1,description:`Generate audio for the video`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`auto`,value:`auto`},{label:`1:1`,value:`1:1`},{label:`3:4`,value:`3:4`},{label:`4:3`,value:`4:3`},{label:`9:16`,value:`9:16`},{label:`16:9`,value:`16:9`},{label:`21:9`,value:`21:9`}],default:`16:9`,description:`Aspect ratio of the video`}],computeCredits:ir,buildInput:({fields:e,enableSafetyChecker:t})=>({prompt:e.prompt,resolution:e.resolution,duration:e.duration,aspect_ratio:e.aspect_ratio,generate_audio:e.generate_audio,enable_safety_checker:t}),parseResult:ar}
8,{key:`image-to-video`,name:`Image to Video`,outputType:`video`,resolveEndpoint:()=>`bytedance/seedance-2.0/image-to-video`,fields:[{type:`image-input`,key:`image_url`,label:`Start Image`,required:!0,max:1,default:``,description:`The starting frame image to animate from (required).`},{type:`image-input`,key:`end_image_url`,label:`End Image`,required:!1,max:1,default:``,description:`The ending frame image to animate to (optional).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:3e3,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`480p`,value:`480p`},{label:`720p`,value:`720p`},{label:`1080p`,value:`1080p`}],default:`480p`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`auto`,value:`auto`},{label:`4s`,value:`4`},{label:`5s`,value:`5`},{label:`6s`,value:`6`},{label:`7s`,value:`7`},{label:`8s`,value:`8`},{label:`9s`,value:`9`},{label:`10s`,value:`10`},{label:`11s`,value:`11`},{label:`12s`,value:`12`},{label:`13s`,value:`13`},{label:`14s`,value:`14`},{label:`15s`,value:`15`}],default:`5`,description:`Duration of the video`},{type:`switch`,key:`generate_audio`,label:`Generate Audio`,default:!1,description:`Generate audio for the video`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`auto`,value:`auto`},{label:`1:1`,value:`1:1`},{label:`3:4`,value:`3:4`},{label:`4:3`,value:`4:3`},{label:`9:16`,value:`9:16`},{label:`16:9`,value:`16:9`},{label:`21:9`,value:`21:9`}],default:`16:9`,description:`Aspect ratio of the video`},{type:`seed-input`,key:`seed`,label:`Seed`}],computeCredits:ir,buildInput:({fields:e,enableSafetyChecker:t})=>({prompt:e.prompt,image_url:e.image_url,...e.end_image_url?{end_image_url:e.end_image_url}:{},resolution:e.resolution,duration:e.duration,aspect_ratio:e.aspect_ratio,generate_audio:e.generate_audio,seed:e.seed,enable_safety_checker:t}),parseResult:ar}]},rr={"480p":10.09,"720p":22.76,"1080p":51.15};function ir(e){let t=rr[e.resolution]??rr[`720p`],n=e.duration===`auto`?10:Number(e.duration)||10;return Math.round(t*n)}function ar(e){let t=e.video;return t?(Array.isArray(t)?t:[t]).map(e=>e.url):[]}var or={id:`seedance-v15`,platform:`fal`,category:`video`,icon:`/icon/bytedance.svg`,name:`Seedance 1.5 Pro`,description:`ByteDance's professional video generation model with high motion quality.`,isNew:!1,isHot:!0,tabs:[{key:`text-to-video`,name:`Text to Video`,outputType:`video`,resolveEndpoint:()=>
8`fal-ai/bytedance/seedance/v1.5/pro/text-to-video`,fields:[{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:3e3,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`480p`,value:`480p`},{label:`720p`,value:`720p`},{label:`1080p`,value:`1080p`}],default:`720p`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`4s`,value:`4`},{label:`5s`,value:`5`},{label:`6s`,value:`6`},{label:`7s`,value:`7`},{label:`8s`,value:`8`},{label:`9s`,value:`9`},{label:`10s`,value:`10`},{label:`11s`,value:`11`},{label:`12s`,value:`12`}],default:`5`,description:`Duration of the video`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`auto`,value:`auto`},{label:`1:1`,value:`1:1`},{label:`3:4`,value:`3:4`},{label:`4:3`,value:`4:3`},{label:`9:16`,value:`9:16`},{label:`16:9`,value:`16:9`},{label:`21:9`,value:`21:9`}],default:`16:9`,description:`Aspect ratio of the video`},{type:`switch`,key:`generate_audio`,label:`Generate Audio`,default:!1,description:`Generate audio for the video`},{type:`switch`,key:`camera_fixed`,label:`Camera Fixed`,default:!1,description:`Camera fixed for the video`},{type:`seed-input`,key:`seed`,label:`Seed`}],computeCredits:cr,buildInput:({fields:e,enableSafetyChecker:t})=>({prompt:e.prompt,aspect_ratio:e.aspect_ratio,resolution:e.resolution,duration:e.duration,camera_fixed:e.camera_fixed,seed:e.seed,enable_safety_checker:t,generate_audio:e.generate_audio}),parseResult:lr,example:{input:{prompt:`Defense attorney declaring "Ladies and gentlemen, reasonable doubt isn't just a phrase, it's the foundation of justice itself", footsteps on marble, jury shifting, courtroom drama, closing argument power.`,resolution:`720p`,duration:`5`,aspect_ratio:`16:9`,generate_audio:!0,camera_fixed:!1},output:[`https://v3b.fal.media/files/b/0a87743e/0K5lW0v-iC_BbKo64o0cA_video.mp4`],duration:98}},{key:`image-to-video`,name:`Image to Video`,outputType:`video`,resolveEndpoint:()=>`fal-ai/bytedance/seedance/v1.5/pro/image-to-video`,fields:[{type:`image-input`,key:`image_url`,label:`Start Image`,required:!0,max:1,default:``,description:`The starting frame image to animate from (required).`},{type:`image-input`,key:`end_image_url`,label:`End Image`,required:!1,max:1,default:``,description:`The ending frame image to animate to (optional).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:3e3,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`480p`,value:`480p`},{label:`720p`,value:`720p`},{label:`1080p`,value:`1080p`}],default:`720p`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`4s`,value:`4`},{label:`5s`,value:`5`},{label:`6s`,value:`6`},{label:`7s`,value:`7`},{label:`8s`,value:`8`},{label:`9s`,value:`9`},{label:`10s`,value:`10`},{label:`11s`,value:`11`},{label:`12s`,value:`12`}],default:`5`,description:`Duration of the video`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`auto`,value:`auto`},{label:`1:1`,value:`1:1`},{label:`3:4`,value:`3:4`},{label:`4:3`,value:`4:3`},{label:`9:16`,value:`9:16`},{label:`16:9`,value:`16:9`},{label:`21:9`,value:`21:9`}],default:`16:9`,description:`Aspect ratio of the video`},{type:`switch`,key:`generate_audio`,label:`Generate Audio`,default:!1,description:`Generate audio for the video`},{type:`switch`,key:`camera_fixed`,label:`Camera Fixed`,default:!1,description:`Camera fixed for the video`},{type:`seed-input`,key:`seed`,label:`Seed`}],computeCredits:cr,buildInput:({fields:e,enableSafetyChecker:t})=>({prompt:e.prompt,aspect_ratio:e.aspect_ratio,resolution:e.resolution,duration:e.duration,camera_fixed:e.camera_fixed,seed:e.seed,enable_safety_checker:t,generate_audio:e.generate_audio,image_url:e.image_url,...e.end_image_url?{end_image_url:e.end_image_url}:{}}),parseResult:lr,example:{input:{prompt:`A man is crying and he says "I shouldn't have done it. I regret everything"`,image_url:`https://v3b.fal.media/files/b/0a8773cd/REzCWn1BKUVuMFTxR-R3W_image_317.png`,resolution:`720p`,duration:`5`,aspect_ratio:`16:9`,generate_audio:!1,camera_fixed:!1},output:[`https://v3b.fal.media/files/b/0a8773d3/l2fk-fIO_PQFPzbvHkQX1_video.mp4`],duration:98}}]},sr={"480p":{noAudio:2.225,audio:4.45}
8,"720p":{noAudio:5,audio:10},"1080p":{noAudio:11.25,audio:22.5}};function cr(e){let t=sr[e.resolution]??sr[`720p`],n=e.duration===`auto`?10:Number(e.duration)||10,r=e.generate_audio?t.audio:t.noAudio;return Math.round(r*n)}function lr(e){let t=e.video;return t?(Array.isArray(t)?t:[t]).map(e=>e.url):[]}var ur={id:`seedance-2.5`,platform:`fal`,category:`video`,icon:`/icon/bytedance.svg`,name:`Seedance 2.5`,description:`Dreamina Seedance 2.5 is ByteDance's next-generation video generation model. It generates native 30-second video at super high resolution and combines up to 50 multimodal references in a single generation.`,isNew:!1,tabs:[{key:`text-to-video`,name:`Text to Video`,outputType:`video`,resolveEndpoint:()=>`bytedance/seedance-2.5/text-to-video`,fields:[{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:3e3,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`480p`,value:`480p`},{label:`720p`,value:`720p`}],default:`480p`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`auto`,value:`auto`},{label:`4s`,value:`4`},{label:`5s`,value:`5`},{label:`6s`,value:`6`},{label:`7s`,value:`7`},{label:`8s`,value:`8`},{label:`9s`,value:`9`},{label:`10s`,value:`10`},{label:`11s`,value:`11`},{label:`12s`,value:`12`},{label:`13s`,value:`13`},{label:`14s`,value:`14`},{label:`15s`,value:`15`},{label:`16s`,value:`16`},{label:`17s`,value:`17`},{label:`18s`,value:`18`},{label:`19s`,value:`19`},{label:`20s`,value:`20`},{label:`21s`,value:`21`},{label:`22s`,value:`22`},{label:`23s`,value:`23`},{label:`24s`,value:`24`},{label:`25s`,value:`25`},{label:`26s`,value:`26`},{label:`27s`,value:`27`},{label:`28s`,value:`28`},{label:`29s`,value:`29`},{label:`30s`,value:`30`}],default:`5`,description:`Duration of the video`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`auto`,value:`auto`},{label:`1:1`,value:`1:1`},{label:`3:4`,value:`3:4`},{label:`4:3`,value:`4:3`},{label:`9:16`,value:`9:16`},{label:`16:9`,value:`16:9`},{label:`21:9`,value:`21:9`}],default:`16:9`,description:`Aspect ratio of the video`},{type:`switch`,key:`generate_audio`,label:`Generate Audio`,default:!0,description:`Generate audio for the video`}],computeCredits:fr,buildInput:({fields:e,enableSafetyChecker:t})=>({prompt:e.prompt,resolution:e.resolution,duration:e.duration,aspect_ratio:e.aspect_ratio,generate_audio:e.generate_audio,enable_safety_checker:t}),parseResult:mr},{key:`image-to-video`,name:`Image to Video`,outputType:`video`,resolveEndpoint:()=>`bytedance/seedance-2.5/image-to-video`,fields:[{type:`image-input`,key:`image_url`,label:`Start Image`,required:!0,max:1,default:``,description:`The starting frame image to animate from (required).`},{type:`image-input`,key:`end_image_url`,label:`End Image`,required:!1,max:1,default:``,description:`The ending frame image to animate to (optional).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:3e3,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`480p`,value:`480p`},{label:`720p`,value:`720p`}],default:`480p`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`auto`,value:`auto`},{label:`4s`,value:`4`},{label:`5s`,value:`5`},{label:`6s`,value:`6`},{label:`7s`,value:`7`},{label:`8s`,value:`8`},{label:`9s`,value:`9`},{label:`10s`,value:`10`},{label:`11s`,value:`11`},{label:`12s`,value:`12`},{label:`13s`,value:`13`},{label:`14s`,value:`14`},{label:`15s`,value:`15`},{label:`16s`,value:`16`},{label:`17s`,value:`17`},{label:`18s`,value:`18`},{label:`19s`,value:`19`},{label:`20s`,value:`20`},{label:`21s`,value:`21`},{label:`22s`,value:`22`},{label:`23s`,value:`23`},{label:`24s`,value:`24`},{label:`25s`,value:`25`},{label:`26s`,value:`26`},{label:`27s`,value:`27`},{label:`28s`,value:`28`},{label:`29s`,value:`29`},{label:`30s`,value:`30`}],default:`5`,description:`Duration of the video`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`auto`,value:`auto`}],default:`auto`,description:`Aspect ratio of the video`},{type:`switch`,key:`generate_audio`,label:`Generate Audio`,default:!1,description:`Generate audio for the video`}],computeCredits:fr,buildInput:({fields:e,enableSafetyChecker:t})=>({prompt:e.prompt,image_url:e.image_url,...e.end_image_url?{end_image_url:e.end_image_url}:{},resolution:e.resolution,duration:e.duration,aspect_ratio:e.aspect_ratio,generate_audio:e.generate_audio,enable_safety_checker:t}),parseResult:mr},{key:`reference-to-video`,name:`Reference To Video`,outputType:`video`,resolveEndpoint:()=>`bytedance/seedance-2.5/reference-to-video`,fields:[{type:`image-input`,key:`image_url`,label:`Image`,required:!1,max:10,default:[],description:`Reference images to guide video generation. Refer to them in the prompt as @Image1, @Image2, etc.`},{type:`video-input`,key:`video_url`,label:`Video`,required:!1,max:10,default:[],description:`Reference videos to guide video generation. Refer to them in the prompt as @Video1, @Video2, etc.`},{type:`audio-input`,key:`audio_url`,label:`Audio`,required:!1,accept:[`audio/mpeg`,`audio/wav`],max:10,default:[],description:`Reference audio to guide video generation. Refer to them in the prompt as @Audio1, @Audio2, etc.`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:3e3,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`480p`,value:`480p`},{label:`720p`,value:`720p`}],default:`480p`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`auto`,value:`auto`},{label:`4s`,value:`4`},{label:`5s`,value:`5`},{label:`6s`,value:`6`},{label:`7s`,value:`7`},{label:`8s`,value:`8`},{label:`9s`,value:`9`},{label:`10s`,value:`10`},{label:`11s`,value:`11`},{label:`12s`,value:`12`},{label:`13s`,value:`13`},{label:`14s`,value:`14`},{label:`15s`,value:`15`},{label:`16s`,value:`16`},{label:`17s`,value:`17`},{label:`18s`,value:`18`},{label:`19s`,value:`19`},{label:`20s`,value:`20`},{label:`21s`,value:`21`},{label:`22s`,value:`22`},{label:`23s`,value:`23`},{label:`24s`,value:`24`},{label:`25s`,value:`25`},{label:`26s`,value:`26`},{label:`27s`,value:`27`},{label:`28s`,value:`28`},{label:`29s`,value:`29`},{label:`30s`,value:`30`}],default:`5`,description:`Duration of the video`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`auto`,value:`auto`}],default:`auto`,description:`Aspect ratio of the video`},{type:`switch`,key:`generate_audio`,label:`Generate Audio`,default:!1,description:`Generate audio for the video`}],computeCredits:pr,buildInput:({fields:e,enableSafetyChecker:t})=>{let n=e.image_url,r=e.video_url,i=e.audio_url;return{prompt:e.prompt,...n?.length?{image_urls:n}:{},...r?.length?{video_urls:r}:{},...i?.length?{audio_urls:i}:{},resolution:e.resolution,duration:e.duration,aspect_ratio:e.aspect_ratio,generate_audio:e.generate_audio,enable_safety_checker:t}},parseResult:mr}]},dr={"480p":{standard:16.54,withVideoRef:9.92},"720p":{standard:35.48,withVideoRef:21.29}};function fr(e){let t=dr[e.resolution]??dr[`720p`],n=e.duration===`auto`?10:Number(e.duration)||10;return Math.round(t.standard*n)}function pr(e){let t=dr[e.resolution]??dr[`720p`],n=e.duration===`auto`?10:Number(e.duration)||10,r=Array.isArray(e.video_url)&&e.video_url.length>0?t.withVideoRef:t.standard;return Math.round(r*n)}function mr(e){let t=e.video;return t?(Array.isArray(t)?t:[t]).map(e=>e.url):[]}var hr={id:`veo-v31`,platform:`fal`,category:`video`,icon:`/icon/google.svg`,name:`Veo 3.1`,description:`Google's new and improved version of Veo 3, with higher-fidelity video, context-aware audio, reference image and last frame support`,tabs:[{key:`text-to-vi
8deo`,name:`Text to Video`,outputType:`video`,resolveEndpoint:()=>`fal-ai/veo3.1`,fields:[{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:2500,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`9:16`,value:`9:16`},{label:`16:9`,value:`16:9`}],default:`16:9`,description:`Aspect ratio of the video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`720p`,value:`720p`},{label:`1080p`,value:`1080p`},{label:`4k`,value:`4k`}],default:`720p`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`4s`,value:`4s`},{label:`6s`,value:`6s`},{label:`8s`,value:`8s`}],default:`4s`,description:`Duration of the video`},{type:`text`,key:`negative_prompt`,label:`Negative Prompt`,default:``,maxLength:500,description:`Describe what you want to avoid in the video`},{type:`switch`,key:`generate_audio`,label:`Generate Audio`,default:!1,description:`Generate audio for the video`},{type:`switch`,key:`auto_fix`,label:`Auto Fix`,default:!0,description:`Whether to automatically attempt to fix prompts that fail content policy or other validation checks by rewriting them`,descriptionType:`popover`},{type:`seed-input`,key:`seed`,label:`Seed`}],computeCredits:gr,buildInput:({fields:e,enableSafetyChecker:t})=>({prompt:e.prompt,aspect_ratio:e.aspect_ratio,duration:e.duration,negative_prompt:e.negative_prompt,resolution:e.resolution,generate_audio:e.generate_audio,seed:e.seed,auto_fix:e.auto_fix,safety_tolerance:`6`,enable_safety_checker:t}),parseResult:Z,example:{input:{prompt:`First-person view soaring low over a medieval battlefield at dawn, gliding past clashing knights in armor, fire-lit arrows whizzing overhead, splintered catapults burning near fallen soldiers, flying inches above torn flags and mud-soaked ground, ambient sounds of swords striking, war cries, galloping hooves, and wind rushing in your ears, raw, terrifying, epic`,resolution:`1080p`,duration:`8s`,aspect_ratio:`16:9`},output:[`https://v3.fal.media/files/penguin/D-wlVxx1E8BPr2AG9cxhb_output.mp4`],duration:165}},{key:`image-to-video`,name:`Image to Video`,outputType:`video`,resolveEndpoint:()=>`fal-ai/veo3.1/image-to-video`,fields:[{type:`image-input`,key:`image_url`,label:`Image`,required:!0,max:1,default:``,description:`The image to generate the video from (required).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:3e3,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`auto`,value:`auto`},{label:`9:16`,value:`9:16`},{label:`16:9`,value:`16:9`}],default:`auto`,description:`Aspect ratio of the video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`720p`,value:`720p`},{label:`1080p`,value:`1080p`},{label:`4k`,value:`4k`}],default:`720p`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`4s`,value:`4s`},{label:`6s`,value:`6s`},{label:`8s`,value:`8s`}],default:`4s`,description:`Duration of the video`},{type:`text`,key:`negative_prompt`,label:`Negative Prompt`,default:``,maxLength:500,description:`Describe what you want to avoid in the video`},{type:`switch`,key:`generate_audio`,label:`Generate Audio`,default:!1,description:`Generate audio for the video`},{type:`switch`,key:`auto_fix`,label:`Auto Fix`,default:!0,description:`Whether to automatically attempt to fix prompts that fail content policy or other validation checks by rewriting them`,descriptionType:`popover`},{type:`seed-input`,key:`seed`,label:`Seed`}],computeCredits:gr,buildInput:({fields:e,enableSafetyChecker:t})=>({prompt:e.prompt,aspect_ratio:e.aspect_ratio,duration:e.duration,negative_prompt:e.negative_prompt,resolution:e.resolution,generate_audio:e.generate_audio,seed:e.seed,auto_fix:e.auto_fix,safety_tolerance:`6`,image_url:e.image_url,enable_safety_checker:t}),parseResult:Z,example:{input:{prompt:`A monkey and polar bear host a casual podcast about AI inference, bringing their unique perspectives from different environments (tropical vs. arctic) to discu
8ss how AI systems make decisions and process information. 9Sample Dialogue: 10Monkey (Banana): "Welcome back to Bananas & Ice! I am Banana" 11Polar Bear (Ice): "And I'm Ice!"`,image_url:`https://storage.googleapis.com/falserverless/example_inputs/veo31_i2v_input.jpg`,resolution:`720p`,duration:`8s`,aspect_ratio:`16:9`,auto_fix:!1},output:[`https://storage.googleapis.com/falserverless/model_tests/gallery/veo3-1-i2v.mp4`],duration:218}},{key:`text-to-video-fast`,name:`Text to Video (Fast)`,outputType:`video`,resolveEndpoint:()=>`fal-ai/veo3.1/fast`,fields:[{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:2500,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`9:16`,value:`9:16`},{label:`16:9`,value:`16:9`}],default:`16:9`,description:`Aspect ratio of the video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`720p`,value:`720p`},{label:`1080p`,value:`1080p`},{label:`4k`,value:`4k`}],default:`720p`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`4s`,value:`4s`},{label:`6s`,value:`6s`},{label:`8s`,value:`8s`}],default:`4s`,description:`Duration of the video`},{type:`text`,key:`negative_prompt`,label:`Negative Prompt`,default:``,maxLength:500,description:`Describe what you want to avoid in the video`},{type:`switch`,key:`generate_audio`,label:`Generate Audio`,default:!1,description:`Generate audio for the video`},{type:`switch`,key:`auto_fix`,label:`Auto Fix`,default:!0,description:`Whether to automatically attempt to fix prompts that fail content policy or other validation checks by rewriting them`,descriptionType:`popover`},{type:`seed-input`,key:`seed`,label:`Seed`}],computeCredits:_r,buildInput:({fields:e,enableSafetyChecker:t})=>({prompt:e.prompt,aspect_ratio:e.aspect_ratio,duration:e.duration,negative_prompt:e.negative_prompt,resolution:e.resolution,generate_audio:e.generate_audio,seed:e.seed,auto_fix:e.auto_fix,safety_tolerance:`6`,enable_safety_checker:t}),parseResult:Z,example:{input:{prompt:`Two person street interview in New York City. 12Sample Dialogue: 13Host: "Did you hear the news?" 14Person: "Yes! Veo 3.1 is now available on fal. If you want to see it, go check their website."`,resolution:`720p`,duration:`8s`,aspect_ratio:`16:9`},output:[`https://v3b.fal.media/files/b/kangaroo/oUCiZjQwEy6bIQdPUSLDF_output.mp4`],duration:165}},{key:`image-to-video-fast`,name:`Image to Video (Fast)`,outputType:`video`,resolveEndpoint:()=>`fal-ai/veo3.1/fast/image-to-video`,fields:[{type:`image-input`,key:`image_url`,label:`Image`,required:!0,max:1,default:``,description:`The image to generate the video from (required).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:3e3,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`auto`,value:`auto`},{label:`9:16`,value:`9:16`},{label:`16:9`,value:`16:9`}],default:`auto`,description:`Aspect ratio of the video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`720p`,value:`720p`},{label:`1080p`,value:`1080p`},{label:`4k`,value:`4k`}],default:`720p`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`4s`,value:`4s`},{label:`6s`,value:`6s`},{label:`8s`,value:`8s`}],default:`4s`,description:`Duration of the video`},{type:`text`,key:`negative_prompt`,label:`Negative Prompt`,default:``,maxLength:500,description:`Describe what you want to avoid in the video`},{type:`switch`,key:`generate_audio`,label:`Generate Audio`,default:!1,description:`Generate audio for the video`},{type:`switch`,key:`auto_fix`,label:`Auto Fix`,default:!0,description:`Whether to automatically attempt to fix prompts that fail content policy or other validation checks by rewriting them`,descriptionType:`popover`},{type:`seed-input`,key:`seed`,label:`Seed`}
14],computeCredits:_r,buildInput:({fields:e,enableSafetyChecker:t})=>({prompt:e.prompt,aspect_ratio:e.aspect_ratio,duration:e.duration,negative_prompt:e.negative_prompt,resolution:e.resolution,generate_audio:e.generate_audio,seed:e.seed,auto_fix:e.auto_fix,safety_tolerance:`6`,image_url:e.image_url,enable_safety_checker:t}),parseResult:Z,example:{input:{prompt:`A monkey and polar bear host a casual podcast about AI inference, bringing their unique perspectives from different environments (tropical vs. arctic) to discuss how AI systems make decisions and process information. 15Sample Dialogue: 16Monkey (Banana): "Welcome back to Bananas & Ice! I am Banana" 17Polar Bear (Ice): "And I'm Ice!"`,image_url:`https://storage.googleapis.com/falserverless/example_inputs/veo31_i2v_input.jpg`,resolution:`720p`,duration:`8s`,aspect_ratio:`16:9`,auto_fix:!1},output:[`https://storage.googleapis.com/falserverless/model_tests/gallery/veo3-1-i2v.mp4`],duration:218}},{key:`text-to-video-lite`,name:`Text to Video (Lite)`,outputType:`video`,resolveEndpoint:()=>`fal-ai/veo3.1/lite`,fields:[{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:2500,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`9:16`,value:`9:16`},{label:`16:9`,value:`16:9`}],default:`16:9`,description:`Aspect ratio of the video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`720p`,value:`720p`},{label:`1080p`,value:`1080p`},{label:`4k`,value:`4k`}],default:`720p`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`4s`,value:`4s`},{label:`6s`,value:`6s`},{label:`8s`,value:`8s`}],default:`4s`,description:`Duration of the video`},{type:`text`,key:`negative_prompt`,label:`Negative Prompt`,default:``,maxLength:500,description:`Describe what you want to avoid in the video`},{type:`switch`,key:`generate_audio`,label:`Generate Audio`,default:!1,description:`Generate audio for the video`},{type:`switch`,key:`auto_fix`,label:`Auto Fix`,default:!0,description:`Whether to automatically attempt to fix prompts that fail content policy or other validation checks by rewriting them`,descriptionType:`popover`},{type:`seed-input`,key:`seed`,label:`Seed`}],computeCredits:vr,buildInput:({fields:e,enableSafetyChecker:t})=>({prompt:e.prompt,aspect_ratio:e.aspect_ratio,duration:e.duration,negative_prompt:e.negative_prompt,resolution:e.resolution,generate_audio:e.generate_audio,seed:e.seed,auto_fix:e.auto_fix,safety_tolerance:`6`,enable_safety_checker:t}),parseResult:Z,example:{input:{prompt:`A massive blue whale glides through crystal-clear deep ocean water, sunlight rays piercing through the surface above, bioluminescent plankton scattered around, cinematic slow motion`,resolution:`720p`,duration:`8s`,aspect_ratio:`16:9`},output:[`https://v3b.fal.media/files/b/0a94683f/r4vLtNmFDi_qpglfEX_q9_0a7258527ac84509a0997639765f5c79.mp4`],duration:376}
17},{key:`image-to-video-lite`,name:`Image to Video (Lite)`,outputType:`video`,resolveEndpoint:()=>`fal-ai/veo3.1/lite/image-to-video`,fields:[{type:`image-input`,key:`image_url`,label:`Image`,required:!0,max:1,default:``,description:`The image to generate the video from (required).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:3e3,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`auto`,value:`auto`},{label:`9:16`,value:`9:16`},{label:`16:9`,value:`16:9`}],default:`auto`,description:`Aspect ratio of the video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`720p`,value:`720p`},{label:`1080p`,value:`1080p`},{label:`4k`,value:`4k`}],default:`720p`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`4s`,value:`4s`},{label:`6s`,value:`6s`},{label:`8s`,value:`8s`}],default:`4s`,description:`Duration of the video`},{type:`text`,key:`negative_prompt`,label:`Negative Prompt`,default:``,maxLength:500,description:`Describe what you want to avoid in the video`},{type:`switch`,key:`generate_audio`,label:`Generate Audio`,default:!1,description:`Generate audio for the video`},{type:`switch`,key:`auto_fix`,label:`Auto Fix`,default:!0,description:`Whether to automatically attempt to fix prompts that fail content policy or other validation checks by rewriting them`,descriptionType:`popover`},{type:`seed-input`,key:`seed`,label:`Seed`}],computeCredits:vr,buildInput:({fields:e,enableSafetyChecker:t})=>({prompt:e.prompt,aspect_ratio:e.aspect_ratio,duration:e.duration,negative_prompt:e.negative_prompt,resolution:e.resolution,generate_audio:e.generate_audio,seed:e.seed,auto_fix:e.auto_fix,safety_tolerance:`6`,image_url:e.image_url,enable_safety_checker:t}),parseResult:Z},{key:`extend-video`,name:`Extend Video`,outputType:`video`,resolveEndpoint:()=>`fal-ai/veo3.1/extend-video`,fields:[{type:`video-input`,key:`video_url`,label:`Video`,required:!0,max:1,default:``,description:`The video to extend (required).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:3e3,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`auto`,value:`auto`},{label:`9:16`,value:`9:16`},{label:`16:9`,value:`16:9`}],default:`auto`,description:`Aspect ratio of the video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`720p`,value:`720p`}],default:`720p`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`7s`,value:`7s`}],default:`7s`,description:`Duration of the video`},{type:`text`,key:`negative_prompt`,label:`Negative Prompt`,default:``,maxLength:500,description:`Describe what you want to avoid in the video`},{type:`switch`,key:`generate_audio`,label:`Generate Audio`,default:!1,description:`Generate audio for the video`},{type:`switch`,key:`auto_fix`,label:`Auto Fix`,default:!0,description:`Whether to automatically attempt to fix prompts that fail content policy or other validation checks by rewriting them`,descriptionType:`popover`},{type:`seed-input`,key:`seed`,label:`Seed`}],computeCredits:yr,buildInput:({fields:e,enableSafetyChecker:t})=>({prompt:e.prompt,aspect_ratio:e.aspect_ratio,duration:e.duration,negative_prompt:e.negative_prompt,resolution:e.resolution,generate_audio:e.generate_audio,seed:e.seed,auto_fix:e.auto_fix,safety_tolerance:`6`,video_url:e.video_url,enable_safety_checker:t}),parseResult:Z},{key:`extend-video-fast`,name:`Extend Video (Fast)`,outputType:`video`,resolveEndpoint:()=>`fal-ai/veo3.1/fast/extend-video`,fields:[{type:`video-input`,key:`video_url`,label:`Video`,required:!0,max:1,default:``,description:`The video to extend (required).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:3e3,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`auto`,value:`auto`},{label:`9:16`,value:`9:16`},{label:`16:9`,value:`16:9`}],default:`auto`,description:`Aspect ratio of the video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`720p`,value:`720p`}],default:`720p`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`7s`,value:`7s`}],default:`7s`,description:`Duration of the video`},{type:`text`,key:`negative_prompt`,label:`Negative Prompt`,default:``,maxLength:500,description:`Describe what you want to avoid in the video`},{type:`switch`,key:`generate_audio`,label:`Generate Audio`,default:!1,description:`Generate audio for the video`},{type:`switch`,key:`auto_fix`,label:`Auto Fix`,default:!0,description:`Whether to automatically attempt to fix prompts that fail content policy or other validation checks by rewriting them`,descriptionType:`popover`},{type:`seed-input`,key:`seed`,label:`Seed`}
17],computeCredits:br,buildInput:({fields:e,enableSafetyChecker:t})=>({prompt:e.prompt,aspect_ratio:e.aspect_ratio,duration:e.duration,negative_prompt:e.negative_prompt,resolution:e.resolution,generate_audio:e.generate_audio,seed:e.seed,auto_fix:e.auto_fix,safety_tolerance:`6`,video_url:e.video_url,enable_safety_checker:t}),parseResult:Z},{key:`reference-to-video`,name:`Reference to Video`,outputType:`video`,resolveEndpoint:()=>`fal-ai/veo3.1/reference-to-video`,fields:[{type:`image-input`,key:`image_url`,label:`Image`,required:!0,max:3,default:[],description:`The image to reference (required, up to 3 images).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:3e3,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`9:16`,value:`9:16`},{label:`16:9`,value:`16:9`}],default:`16:9`,description:`Aspect ratio of the video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`720p`,value:`720p`},{label:`1080p`,value:`1080p`},{label:`4k`,value:`4k`}],default:`720p`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`8s`,value:`8s`}],default:`8s`,description:`Duration of the video`},{type:`switch`,key:`generate_audio`,label:`Generate Audio`,default:!1,description:`Generate audio for the video`},{type:`switch`,key:`auto_fix`,label:`Auto Fix`,default:!0,description:`Whether to automatically attempt to fix prompts that fail content policy or other validation checks by rewriting them`,descriptionType:`popover`}],computeCredits:xr,buildInput:({fields:e,enableSafetyChecker:t})=>{let n=e.image_url;return{prompt:e.prompt,aspect_ratio:e.aspect_ratio,duration:e.duration,resolution:e.resolution,generate_audio:e.generate_audio,auto_fix:e.auto_fix,safety_tolerance:`6`,...n?.length?{image_urls:n}:{},enable_safety_checker:t}},parseResult:Z},{key:`reference-to-video-fast`,name:`Reference to Video (Fast)`,outputType:`video`,resolveEndpoint:()=>`fal-ai/veo3.1/fast/reference-to-video`,fields:[{type:`image-input`,key:`image_url`,label:`Image`,required:!0,max:3,default:[],description:`The image to reference (required, up to 3 images).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:3e3,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`9:16`,value:`9:16`},{label:`16:9`,value:`16:9`}],default:`16:9`,description:`Aspect ratio of the video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`720p`,value:`720p`},{label:`1080p`,value:`1080p`},{label:`4k`,value:`4k`}],default:`720p`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`8s`,value:`8s`}],default:`8s`,description:`Duration of the video`},{type:`switch`,key:`generate_audio`,label:`Generate Audio`,default:!1,description:`Generate audio for the video`},{type:`switch`,key:`auto_fix`,label:`Auto Fix`,default:!0,description:`Whether to automatically attempt to fix prompts that fail content policy or other validation checks by rewriting them`,descriptionType:`popover`}],computeCredits:Sr,buildInput:({fields:e,enableSafetyChecker:t})=>{let n=e.image_url;return{prompt:e.prompt,aspect_ratio:e.aspect_ratio,duration:e.duration,resolution:e.resolution,generate_audio:e.generate_audio,auto_fix:e.auto_fix,safety_tolerance:`6`,...n?.length?{image_urls:n}:{},enable_safety_checker:t}},parseResult:Z,example:{input:{prompt:`A chimpanzee wearing overalls frolics in the grassy field, gently playing with the butterflies. In the background, a circus tent and carousel beckon.`,image_url:[`https://storage.googleapis.com/falserverless/example_inputs/veo31-r2v-input-1.png`,`https://storage.googleapis.com/falserverless/example_inputs/veo31-r2v-input-2.png`,`https://storage.googleapis.com/falserverless/example_inputs/veo31-r2v-input-3.png`],resolution:`720p`,duration:`8s`,aspect_ratio:`16:9`,auto_fix:!1,generate_audio:!0},output:[`https://storage.googleapis.com/falserverless/example_outputs/veo31-r2v-output.mp4`],duration:376}
17},{key:`first-last-frame-to-video`,name:`First/Last Frame to Video`,outputType:`video`,resolveEndpoint:()=>`fal-ai/veo3.1/first-last-frame-to-video`,fields:[{type:`image-input`,key:`first_frame_url`,label:`First Frame`,required:!0,max:1,default:``,description:`The first frame to generate the video from (required).`},{type:`image-input`,key:`last_frame_url`,label:`Last Frame`,required:!0,max:1,default:``,description:`The last frame to generate the video from (required).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:3e3,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`auto`,value:`auto`},{label:`9:16`,value:`9:16`},{label:`16:9`,value:`16:9`}],default:`auto`,description:`Aspect ratio of the video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`720p`,value:`720p`},{label:`1080p`,value:`1080p`},{label:`4k`,value:`4k`}],default:`720p`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`4s`,value:`4s`},{label:`6s`,value:`6s`},{label:`8s`,value:`8s`}],default:`8s`,description:`Duration of the video`},{type:`text`,key:`negative_prompt`,label:`Negative Prompt`,default:``,maxLength:500,description:`Describe what you want to avoid in the video`},{type:`switch`,key:`generate_audio`,label:`Generate Audio`,default:!1,description:`Generate audio for the video`},{type:`switch`,key:`auto_fix`,label:`Auto Fix`,default:!0,description:`Whether to automatically attempt to fix prompts that fail content policy or other validation checks by rewriting them`,descriptionType:`popover`},{type:`seed-input`,key:`seed`,label:`Seed`}],computeCredits:Cr,buildInput:({fields:e,enableSafetyChecker:t})=>({prompt:e.prompt,aspect_ratio:e.aspect_ratio,duration:e.duration,negative_prompt:e.negative_prompt,resolution:e.resolution,generate_audio:e.generate_audio,seed:e.seed,auto_fix:e.auto_fix,safety_tolerance:`6`,first_frame_url:e.first_frame_url,last_frame_url:e.last_frame_url,enable_safety_checker:t}),parseResult:Z,example:{input:{prompt:`A woman looks into the camera, breathes in, then exclaims energetically, "have you guys checked out Veo3.1 First-Last-Frame-to-Video on Fal? It's incredible!"`,first_frame_url:`https://storage.googleapis.com/falserverless/example_inputs/veo31-flf2v-input-1.jpeg`,last_frame_url:`https://storage.googleapis.com/falserverless/example_inputs/veo31-flf2v-input-2.jpeg`,resolution:`720p`,duration:`8s`,auto_fix:!1,generate_audio:!0},output:[`https://storage.googleapis.com/falserverless/example_outputs/veo31-flf2v-output.mp4`],duration:376}
17},{key:`first-last-frame-to-video-fast`,name:`First/Last Frame to Video (Fast)`,outputType:`video`,resolveEndpoint:()=>`fal-ai/veo3.1/fast/first-last-frame-to-video`,fields:[{type:`image-input`,key:`first_frame_url`,label:`First Frame`,required:!0,max:1,default:``,description:`The first frame to generate the video from (required).`},{type:`image-input`,key:`last_frame_url`,label:`Last Frame`,required:!0,max:1,default:``,description:`The last frame to generate the video from (required).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:3e3,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`auto`,value:`auto`},{label:`9:16`,value:`9:16`},{label:`16:9`,value:`16:9`}],default:`auto`,description:`Aspect ratio of the video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`720p`,value:`720p`},{label:`1080p`,value:`1080p`},{label:`4k`,value:`4k`}],default:`720p`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`4s`,value:`4s`},{label:`6s`,value:`6s`},{label:`8s`,value:`8s`}],default:`8s`,description:`Duration of the video`},{type:`text`,key:`negative_prompt`,label:`Negative Prompt`,default:``,maxLength:500,description:`Describe what you want to avoid in the video`},{type:`switch`,key:`generate_audio`,label:`Generate Audio`,default:!1,description:`Generate audio for the video`},{type:`switch`,key:`auto_fix`,label:`Auto Fix`,default:!0,description:`Whether to automatically attempt to fix prompts that fail content policy or other validation checks by rewriting them`,descriptionType:`popover`},{type:`seed-input`,key:`seed`,label:`Seed`}],computeCredits:wr,buildInput:({fields:e,enableSafetyChecker:t})=>({prompt:e.prompt,aspect_ratio:e.aspect_ratio,duration:e.duration,negative_prompt:e.negative_prompt,resolution:e.resolution,generate_audio:e.generate_audio,seed:e.seed,auto_fix:e.auto_fix,safety_tolerance:`6`,first_frame_url:e.first_frame_url,last_frame_url:e.last_frame_url,enable_safety_checker:t}),parseResult:Z,example:{input:{prompt:`A woman looks into the camera, breathes in, then exclaims energetically, "have you guys checked out Veo3.1 First-Last-Frame-to-Video on Fal? It's incredible!"`,first_frame_url:`https://storage.googleapis.com/falserverless/example_inputs/veo31-flf2v-input-1.jpeg`,last_frame_url:`https://storage.googleapis.com/falserverless/example_inputs/veo31-flf2v-input-2.jpeg`,resolution:`720p`,duration:`8s`,auto_fix:!1,generate_audio:!0},output:[`https://storage.googleapis.com/falserverless/example_outputs/veo31-flf2v-output.mp4`],duration:376}
17},{key:`first-last-frame-to-video-lite`,name:`First/Last Frame to Video (Lite)`,outputType:`video`,resolveEndpoint:()=>`fal-ai/veo3.1/lite/first-last-frame-to-video`,fields:[{type:`image-input`,key:`first_frame_url`,label:`First Frame`,required:!0,max:1,default:``,description:`The first frame to generate the video from (required).`},{type:`image-input`,key:`last_frame_url`,label:`Last Frame`,required:!0,max:1,default:``,description:`The last frame to generate the video from (required).`},{type:`textarea`,key:`prompt`,label:`Prompt`,required:!0,default:``,placeholder:`Describe what you want to generate the video...`,rows:5,maxLength:3e3,description:`Describe what you want to generate the video`,enableOptimize:!0,optimizeCategory:`video`},{type:`aspect-ratio`,key:`aspect_ratio`,label:`Aspect Ratio`,options:[{label:`auto`,value:`auto`},{label:`9:16`,value:`9:16`},{label:`16:9`,value:`16:9`}],default:`auto`,description:`Aspect ratio of the video`},{type:`select`,key:`resolution`,label:`Resolution`,options:[{label:`720p`,value:`720p`},{label:`1080p`,value:`1080p`},{label:`4k`,value:`4k`}],default:`720p`,description:`Resolution of the video`},{type:`select`,key:`duration`,label:`Duration`,options:[{label:`4s`,value:`4s`},{label:`6s`,value:`6s`},{label:`8s`,value:`8s`}],default:`8s`,description:`Duration of the video`},{type:`text`,key:`negative_prompt`,label:`Negative Prompt`,default:``,maxLength:500,description:`Describe what you want to avoid in the video`},{type:`switch`,key:`generate_audio`,label:`Generate Audio`,default:!1,description:`Generate audio for the video`},{type:`switch`,key:`auto_fix`,label:`Auto Fix`,default:!0,description:`Whether to automatically attempt to fix prompts that fail content policy or other validation checks by rewriting them`,descriptionType:`popover`},{type:`seed-input`,key:`seed`,label:`Seed`}],computeCredits:Tr,buildInput:({fields:e,enableSafetyChecker:t})=>({prompt:e.prompt,aspect_ratio:e.aspect_ratio,duration:e.duration,negative_prompt:e.negative_prompt,resolution:e.resolution,generate_audio:e.generate_audio,seed:e.seed,auto_fix:e.auto_fix,safety_tolerance:`6`,first_frame_url:e.first_frame_url,last_frame_url:e.last_frame_url,enable_safety_checker:t}),parseResult:Z,example:{input:{prompt:`A woman looks into the camera, breathes in, then exclaims energetically, "have you guys checked out Veo3.1 First-Last-Frame-to-Video on Fal? It's incredible!"`,first_frame_url:`https://storage.googleapis.com/falserverless/example_inputs/veo31-flf2v-input-1.jpeg`,last_frame_url:`https://storage.googleapis.com/falserverless/example_inputs/veo31-flf2v-input-2.jpeg`,resolution:`720p`,duration:`8s`,auto_fix:!1,generate_audio:!0},output:[`https://storage.googleapis.com/falserverless/example_outputs/veo31-flf2v-output.mp4`],duration:376}
17}]};function gr(e){let t=e.resolution,n=parseInt(e.duration,10)||8,r=e.generate_audio,i;return i=t===`4k`?r?75:50:r?50:25,i*n}function _r(e){let t=e.resolution,n=parseInt(e.duration,10)||4,r=e.generate_audio,i;return i=t===`4k`?r?45:40:r?20:10,Math.ceil(i*n)}function vr(e){let t=e.resolution,n=parseInt(e.duration,10)||4,r=e.generate_audio,i;return i=t===`4k`?r?25:20:t===`1080p`?r?15:10:r?10:5,Math.ceil(i*n)}function yr(e){let t=parseInt(e.duration,10)||4,n=e.generate_audio?50:25;return Math.ceil(n*t)}function br(e){let t=parseInt(e.duration,10)||4,n=e.generate_audio?20:10;return Math.ceil(n*t)}function xr(e){let t=e.resolution,n=parseInt(e.duration,10)||4,r=e.generate_audio,i;return i=t===`4k`?r?75:50:r?50:25,i*n}function Sr(e){let t=parseInt(e.duration,10)||4,n=e.generate_audio?18.75:12.5;return Math.ceil(n*t)}function Cr(e){let t=e.resolution,n=parseInt(e.duration,10)||4,r=e.generate_audio,i;return i=t===`4k`?r?75:50:r?50:25,i*n}function wr(e){let t=e.resolution,n=parseInt(e.duration,10)||4,r=e.generate_audio,i;return i=t===`4k`?r?43.75:37.5:r?18.75:12.5,Math.ceil(i*n)}function Tr(e){let t=e.resolution,n=parseInt(e.duration,10)||4,r=e.generate_audio,i;return i=t===`4k`?r?25:20:t===`1080p`?r?10:6.25:r?6.25:3.75,Math.ceil(i*n)}function Z(e){let t=e.video;return t?(Array.isArray(t)?t:[t]).map(e=>e.url):[]}var Er=[En,Cn,kn,sn,un,pn,_n,bn,Yn,Hn,or,ur,nr,Vn,Rn,hr,Nn],Dr=Er.filter(e=>e.enabled!==!1),Or=Dr.filter(e=>e.category===`image`),kr=Dr.filter(e=>e.category===`video`);Dr.filter(e=>e.category===`speech`);var Ar=En.id,jr=Yn.id;Nn.id;function Mr(e,t=Er){let n=t.find(t=>t.id===e);if(!n)throw Error(`Unknown model: ${e}`);return n}function Nr(e,t,n){let r=Mr(e,n).tabs.find(e=>e.key===t);if(!r)throw Error(`Unknown tab "${t}" for model "${e}"`);return r}function Pr(e,t,n){if(!t||n.length===0)return e;let r=t.toLowerCase();return n.some(e=>r.includes(e))?e.filter(e=>e.restrictedUserVisible!==!1):e}function Fr(e,t,n){let r=Nr(e,t,n),i=In(r.fields);return r.example?{...i,...r.example.input}:i}var Ir=r({method:`GET`}).handler(n(`fd544d95c7ac202cd05b6d1c5c4ae6c38469c20a116a4cd28a54260ece516e9a`));function Lr({...e}){return(0,K.jsx)(mt,{"data-slot":`popover`,...e})}function Rr({...e}){return(0,K.jsx)(ht,{"data-slot":`popover-trigger`,...e})}function zr({className:e,align:t=`center`,sideOffset:n=4,...r}){return(0,K.jsx)(gt,{children:(0,K.jsx)(_t,{"data-slot":`popover-content`,align:t,sideOffset:n,className:z(`z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...r})})}function Br({label:e,description:t}){return(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(Oe,{children:e}),(0,K.jsxs)(Lr,{children:[(0,K.jsx)(Rr,{asChild:!0,children:(0,K.jsx)(`button`,{type:`button`,className:`inline-flex items-center justify-center rounded-full text-muted-foreground hover:text-foreground transition-colors`,children:(0,K.jsx)(A,{className:`size-3.5`})})}),(0,K.jsx)(zr,{side:`top`,className:`w-64 text-xs text-muted-foreground`,children:t})]})]})}function Q({field:e}){return e.description&&e.descriptionType===`popover`?(0,K.jsx)(Br,{label:e.label,description:e.description}):(0,K.jsx)(Oe,{children:e.label})}function $({field:e}){return!e.description||e.descriptionType===`popover`?null:(0,K.jsx)(Ae,{className:`text-xs`,children:e.description})}function Vr({field:e,value:t,onChange:n,disabled:r}){return(0,K.jsxs)(W,{children:[(0,K.jsx)(Q,{field:e}),(0,K.jsx)($,{field:e}),(0,K.jsx)(`div`,{className:`grid grid-cols-4 gap-2`,children:e.options.map(i=>{let a=t===i.value;return(0,K.jsxs)(`button`,{type:`button`,disabled:r,onClick:()=>n(e.key,i.value),className:z(`relative flex flex-col items-center justify-center gap-1.5 rounded-lg border p-2.5 transition-colors`,`hover:border-primary/50 hover:bg-accent`,`disabled:opacity-50 disabled:pointer-events-none`,a?`border-primary bg-primary/5`:`border-border`),children:[a&&(0,K.jsx)(b,{className:`absolute top-1 right-1 size-3 text-primary`}),i.ratio&&(0,K.jsx)(Hr,{ratio:i.ratio}),(0,K.jsx)(`span`,{className:`w-full truncate text-center text-[11px] text-foreground`,children:i.label})]},i.value)})})]})}function Hr({ratio:e}){let t=Ur(e);
17if(!t)return null;let{w:n,h:r}=t,i=20/Math.max(n,r),a=Math.round(n*i),o=Math.round(r*i);return(0,K.jsx)(`div`,{className:`flex h-6 items-center justify-center`,children:(0,K.jsx)(`div`,{className:`rounded-[2px] border-[1.5px] border-current`,style:{width:`${a}px`,height:`${o}px`}})})}function Ur(e){let t=e.match(/^(\d+):(\d+)$/);return t?{w:Number(t[1]),h:Number(t[2])}:null}function Wr({value:e,onChange:t,accept:n,max:r,disabled:i,onDurationChange:a}){let[o,s]=(0,G.useState)([]),[c,l]=(0,G.useState)([]),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(null),m=(0,G.useRef)(null),h=(0,G.useRef)(null),g=e.length+o.length,v=g<r,y=(0,G.useCallback)(e=>new Promise(t=>{let n=URL.createObjectURL(e),r=new Audio(n);r.addEventListener(`loadedmetadata`,()=>{URL.revokeObjectURL(n),t(r.duration)}),r.addEventListener(`error`,()=>{URL.revokeObjectURL(n),t(0)})}),[]),b=e=>!e||e<=0?`0:00`:`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,`0`)}`,x=(0,G.useCallback)(async e=>{let t=new FormData;t.append(`file`,e),t.append(`folder`,`upload`);let n=await fetch(`/api/upload`,{method:`POST`,body:t});if(!n.ok)try{let e=await n.json();return n.status===401?{error:`Please login to upload files`}:{error:e.error??`Upload failed (${n.status})`}}catch{return{error:`Upload failed (${n.status})`}}return{url:(await n.json()).url}},[]),S=(0,G.useCallback)(async n=>{let r=await x(n.file);`error`in r?(s(e=>e.map(e=>e.id===n.id?{...e,status:`failed`}:e)),H.error(`Upload failed`,{description:r.error})):(s(e=>e.filter(e=>e.id!==n.id)),t([...e,r.url]),l(e=>[...e,{url:r.url,duration:n.duration,fileName:n.file.name}]),n.duration&&a&&a(n.duration))},[e,t,a,x]),w=(0,G.useCallback)(async e=>{if(i||!v)return;let{valid:t,error:a}=Ke(Array.from(e),{accept:n,maxCount:r-g});if(a&&H.error(`Some files were skipped`,{description:a}),t.length===0)return;let o=await Promise.all(t.map(async e=>{let t=await y(e);return{id:crypto.randomUUID(),previewUrl:URL.createObjectURL(e),file:e,status:`uploading`,duration:t}}));s(e=>[...e,...o]);for(let e of o)S(e)},[i,v,r,g,n,S,y]),T=(0,G.useCallback)(e=>{s(t=>t.map(t=>t.id===e.id?{...t,status:`uploading`}:t)),S(e)},[S]),E=(0,G.useCallback)(e=>{URL.revokeObjectURL(e.previewUrl),s(t=>t.filter(t=>t.id!==e.id))},[]),D=(0,G.useCallback)(e=>{e.preventDefault(),d(!1),w(e.dataTransfer.files)},[w]),k=n=>{let r=e[n];t(e.filter((e,t)=>t!==n)),l(e=>e.filter(e=>e.url!==r)),f===r&&(p(null),h.current&&h.current.pause())},A=e=>{f===e?(h.current?.pause(),p(null)):h.current&&(h.current.src=e,h.current.play(),p(e))},te=o.some(e=>e.status===`uploading`),j=n.join(`,`);return(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(`audio`,{ref:h,onEnded:()=>p(null),className:`hidden`}),(e.length>0||o.length>0)&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[e.map((e,t)=>{let n=c.find(t=>t.url===e);return(0,K.jsxs)(`div`,{className:`group flex items-center gap-2 rounded-md border p-2`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>A(e),disabled:i,className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary hover:bg-primary/20 transition-colors`,children:f===e?(0,K.jsx)(_,{className:`size-3.5`}):(0,K.jsx)(ee,{className:`size-3.5 ml-0.5`})}),(0,K.jsx)(`div`,{className:`flex flex-1 flex-col min-w-0`,children:(0,K.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:n?.fileName||`Audio ${t+1}`})}),n?.duration?(0,K.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:b(n.duration)}):null,!i&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>k(t),className:`size-5 flex shrink-0 items-center justify-center rounded-full text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors`,children:(0,K.jsx)(M,{className:`size-3.5`})})]},e)}),o.map(e=>(0,K.jsxs)(`div`,{className:`group flex items-center gap-2 rounded-md border p-2`,children:[(0,K.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-muted`,children:e.status===`uploading`?(0,K.jsx)(U,{className:`size-3.5 animate-spin text-muted-foreground`}):(0,K.jsx)(C,{className:`size-3.5 text-destructive`})}),(0,K.jsxs)(`div`,{className:`flex flex-1 flex-col min-w-0`,children:[(0,K.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:e.file.name}),(0,K.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.status===`uploading`?`Uploading...`:`Upload failed - click to retry`})]}),e.status===`failed`&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>T(e),className:`shrink-0 text-[11px] text-primary hover:underline`,children:`Retry`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>E(e),className:`size-5 flex shrink-0 items-center justify-center rounded-full text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors`,children:(0,K.jsx)(M,{className:`size-3.5`})})]},e.id))]}),v&&(0,K.jsxs)(`div`,{onClick:()=>!i&&!te&&m.current?.click(),onDragOver:e=>{e.preventDefault(),d(!0)},onDragLeave:()=>d(!1),onDrop:D,className:z(`flex flex-col items-center justify-center gap-1 rounded-md border-2 border-dashed p-4 cursor-pointer transition-colors`,u&&`border-primary bg-primary/5`,i||te?`opacity-50 cursor-not-allowed`:`hover:border-primary/50`),children:[te?(0,K.jsx)(U,{className:`size-5 animate-spin text-muted-foreground`}):(0,K.jsx)(O,{className:`size-5 text-muted-foreground`}),(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:te?`Uploading...`:`Drop audio here or click (${g}/${r})`})]}),(0,K.jsx)(`input`,{ref:m,type:`file`,accept:j,multiple:r>1,className:`hidden`,onChange:e=>{e.target.files&&w(e.target.files),e.target.value=``}})]})}function Gr({field:e,value:t,onChange:n,disabled:r}){return(0,K.jsxs)(W,{children:[(0,K.jsx)(Q,{field:e}),(0,K.jsx)($,{field:e}),(0,K.jsx)(Wr,{value:Array.isArray(t)?t:t?[t]:[],onChange:t=>n(e.key,t),accept:e.accept,max:e.max,disabled:r,onDurationChange:t=>{n(`${e.key}_duration`,t)}})]})}var Kr=r({method:`GET`}).handler(n(`e2b01cbbb9e346f15c0454ceef8e4ef81728fd197c72e09d0670922f7ecd730d`));function qr(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function Jr({open:e,onOpenChange:t,currentCount:n,max:r,onConfirm:i}){let[a,o]=(0,G.useState)(null),[s,c]=(0,G.useState)(new Set),[l,u]=(0,G.useState)([]),[d,f]=(0,G.useState)(!1),[p,m]=(0,G.useState)(1),[h,g]=(0,G.useState)(!1),_=r-n,v=(0,G.useCallback)(async e=>{g(!0);try{let t=await Kr({data:{page:e}});u(n=>e===1?t.tasks:[...n,...t.tasks]),f(t.hasMore)}finally{g(!1)}},[]);(0,G.useEffect)(()=>{e&&(m(1),u([]),o(null),c(new Set),v(1))},[e,v]);let y=e=>{c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.size<_&&n.add(e),n})},x=()=>{i([...s]),t(!1)},S=e=>{e||(o(null),c(new Set)),t(e)};return(0,K.jsx)(Be,{open:e,onOpenChange:S,children:(0,K.jsxs)(Le,{className:`max-w-[calc(100%-2rem)] sm:max-w-2xl max-h-[80vh] flex flex-col`,children:[(0,K.jsxs)(Fe,{children:[(0,K.jsx)(Re,{children:a?`Select Images`:`My Creations`}),(0,K.jsx)(ze,{children:a?`${V(a.type)} · Select images (${s.size}/${_})`:`Select images from my creations`}),(0,K.jsxs)(`p`,{className:`flex items-center gap-1 text-xs text-amber-500`,children:[(0,K.jsx)(re,{className:`size-3.5 shrink-0`}),`Images are permanently deleted after expiration and may not display correctly â please skip them.`]})]}),(0,K.jsxs)(`div`,{className:`flex-1 overflow-y-auto min-h-0 px-1 py-2 scrollbar-thin`,children:[h&&l.length===0&&(0,K.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,K.jsx)(U,{className:`size-6 animate-spin text-muted-foreground`})}),!h&&l.length===0&&(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-12 text-muted-foreground`,children:[(0,K.jsx)(D,{className:`size-10`}),(0,K.jsx)(`p`,{className:`text-sm text-center`,children:`No creations yet. Upload images in AI tasks and they will appear here.`})]}),!a&&l.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`grid grid-cols-3 sm:grid-cols-5 ga
17p-2`,children:l.map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>e.images.length>0&&o(e),className:z(`relative aspect-square rounded-lg border overflow-hidden flex items-center justify-center`,e.images.length>0?`cursor-pointer hover:ring-2 hover:ring-primary/50`:`cursor-default`),children:[e.images.length>0?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`img`,{src:e.images[0],alt:``,className:`size-full object-cover bg-muted`}),e.images.length>1&&(0,K.jsx)(`span`,{className:`absolute top-1 right-1 bg-black/60 text-white text-[10px] px-1 rounded`,children:e.images.length})]}):(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-1 text-muted-foreground/50`,children:[(0,K.jsx)(D,{className:`size-6`}),(0,K.jsx)(`span`,{className:`text-[10px]`,children:`No image`})]}),(0,K.jsxs)(`span`,{className:`absolute bottom-0 inset-x-0 bg-black/50 text-white text-[8px] px-0.5 py-px truncate text-center`,children:[V(e.type),` · `,qr(e.createdAt)]})]},e.id))}),d&&(0,K.jsx)(B,{variant:`ghost`,size:`sm`,className:`w-full mt-2`,disabled:h,onClick:()=>{let e=p+1;m(e),v(e)},children:h?(0,K.jsx)(U,{className:`size-4 animate-spin`}):`Load more`})]}),a&&(0,K.jsx)(`div`,{className:`grid grid-cols-3 sm:grid-cols-5 gap-2`,children:a.images.map(e=>{let t=s.has(e),n=!t&&s.size>=_;return(0,K.jsxs)(`button`,{type:`button`,onClick:()=>!n&&y(e),className:z(`relative aspect-square rounded-lg overflow-hidden border-2 transition-all`,t&&`border-primary ring-1 ring-primary`,!t&&!n&&`border-transparent hover:border-primary/50`,n&&`opacity-40 cursor-not-allowed border-transparent`),children:[(0,K.jsx)(`img`,{src:e,alt:``,className:`size-full object-cover bg-muted`}),t&&(0,K.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-primary/20`,children:(0,K.jsx)(b,{className:`size-5 text-primary`})})]},e)})})]}),(0,K.jsx)(Ie,{children:a?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{variant:`outline`,onClick:()=>o(null),children:`Back`}),(0,K.jsxs)(B,{onClick:x,disabled:s.size===0,children:[`Confirm (`,s.size,`)`]})]}):(0,K.jsx)(B,{variant:`outline`,onClick:()=>S(!1),children:`Cancel`})})]})})}function Yr({value:e,onChange:t,max:n,disabled:r}){let[i,a]=(0,G.useState)([]),[o,s]=(0,G.useState)(!1),[c,l]=(0,G.useState)(!1),u=(0,G.useRef)(null),{data:d}=Me.useSession(),f=e.length+i.length,p=f<n,m=(0,G.useCallback)(async e=>{let t=new FormData;t.append(`file`,e),t.append(`folder`,`upload`);let n=await fetch(`/api/upload`,{method:`POST`,body:t});if(!n.ok)try{let e=await n.json();return n.status===401?{error:`Please login to upload images`}:{error:e.error??`Upload failed (${n.status})`}}catch{return{error:`Upload failed (${n.status})`}}return{url:(await n.json()).url}},[]),g=(0,G.useCallback)(async n=>{let r=await m(n.file);`error`in r?(a(e=>e.map(e=>e.id===n.id?{...e,status:`failed`}:e)),H.error(`Upload failed`,{description:r.error})):(a(e=>e.filter(e=>e.id!==n.id)),t([...e,r.url]))},[e,t,m]),_=(0,G.useCallback)(async e=>{if(r||!p)return;let{valid:t,error:i}=Ke(Array.from(e),{accept:qe,maxCount:n-f});if(i&&H.error(`Some files were skipped`,{description:i}),t.length===0)return;let o=t.map(e=>({id:crypto.randomUUID(),previewUrl:URL.createObjectURL(e),file:e,status:`uploading`}));a(e=>[...e,...o]);for(let e of o)g(e)},[r,p,n,f,g]),v=(0,G.useCallback)(e=>{a(t=>t.map(t=>t.id===e.id?{...t,status:`uploading`}:t)),g(e)},[g]),y=(0,G.useCallback)(e=>{URL.revokeObjectURL(e.previewUrl),a(t=>t.filter(t=>t.id!==e.id))},[]),b=(0,G.useCallback)(e=>{e.preventDefault(),s(!1),_(e.dataTransfer.files)},[_]),x=n=>{t(e.filter((e,t)=>t!==n))},S=r=>{let i=n-f;t([...e,...r.slice(0,i)])},w=i.some(e=>e.status===`uploading`);return(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(e.length>0||i.length>0)&&(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.map((e,t)=>(0,K.jsxs)(`div`,{className:`group relative size-16 rounded-md overflow-hidden border`,children:[(0,K.jsx)(`img`,{src:e,alt:`Upload ${t+1}`,className:`size-full object-cover`}),!r&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>x(t),className:`absolute top-0.5 right-0.5 size-4 flex items-center justify-center rounded-full bg-black/60 text-white`,children:(0,K.jsx)(M,{className:`size-3`})})]},e)),i.map(e=>(0,K.jsxs)(`div`,{className:`group relative size-16 rounded-md overflow-hidden border`,children:[(0,K.jsx)(`img`,{src:e.previewUrl,alt:`Uploading`,className:`size-full object-cover`}),e.status===`uploading`&&(0,K.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black/40`,children:(0,K.jsx)(U,{className:`size-5 animate-spin text-white`})}),e.status===`failed`&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>v(e),className:`absolute inset-0 flex items-center justify-center bg-destructive/40 cursor-pointer`,title:`Click to retry`,children:(0,K.jsx)(C,{className:`size-5 text-white`})}),!r&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>y(e),className:`absolute top-0.5 right-0.5 size-4 flex items-center justify-center rounded-full bg-black/60 text-white`,children:(0,K.jsx)(M,{className:`size-3`})})]},e.id))]}),p&&(0,K.jsxs)(`div`,{onClick:()=>!r&&!w&&u.current?.click(),onDragOver:e=>{e.preventDefault(),s(!0)},onDragLeave:()=>s(!1),onDrop:b,className:z(`flex flex-col items-center justify-center gap-1 rounded-md border-2 border-dashed p-4 cursor-pointer transition-colors`,o&&`border-primary bg-primary/5`,r||w?`opacity-50 cursor-not-allowed`:`hover:border-primary/50`),children:[(0,K.jsx)(h,{className:`size-5 text-muted-foreground`}),(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:w?`Uploading...`:`Click or drop images here to upload (${f}/${n})`}),!r&&!w&&(0,K.jsx)(`button`,{type:`button`,onClick:e=>{if(e.stopPropagation(),!d){window.location.href=`/signin`;return}l(!0)},className:`text-xs text-primary hover:text-primary/80 transition-colors underline`,children:`Select from my creations`})]}),(0,K.jsx)(`input`,{ref:u,type:`file`,accept:qe.join(`,`),multiple:!0,className:`hidden`,onChange:e=>{e.target.files&&_(e.target.files),e.target.value=``}}),(0,K.jsx)(Jr,{open:c,onOpenChange:l,currentCount:f,max:n,onConfirm:S})]})}function Xr({field:e,value:t,onChange:n,disabled:r}){let i=e.max===1;return(0,K.jsxs)(W,{children:[(0,K.jsx)(Q,{field:e}),(0,K.jsx)($,{field:e}),(0,K.jsx)(Yr,{value:i?t?[t]:[]:Array.isArray(t)?t:t?[t]:[],onChange:t=>n(e.key,i?t[0]??``:t),max:e.max,disabled:r})]})}var Zr=1e4,Qr=`Controls reproducibility. Lock it to get similar variations across generations.`;function $r(){return Math.floor(Math.random()*9e4)+Zr}function ei({label:e,value:t,locked:n,onChange:r,onLockedChange:i,disabled:a}){return(0,K.jsxs)(W,{children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(Oe,{children:e}),(0,K.jsxs)(Lr,{children:[(0,K.jsx)(Rr,{asChild:!0,children:(0,K.jsx)(`button`,{type:`button`,className:`inline-flex items-center justify-center rounded-full text-muted-foreground hover:text-foreground transition-colors`,children:(0,K.jsx)(A,{className:`size-3.5`})})}),(0,K.jsx)(zr,{side:`top`,className:`w-64 text-xs text-muted-foreground`,children:Qr})]})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>i(!n),disabled:a,className:`flex size-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-50 disabled:pointer-events-none`,title:n?`Unlock seed (randomize each generation)`:`Lock seed (keep fixed)`,children:n?(0,K.jsx)(m,{className:`size-3.5`}):(0,K.jsx)(f,{className:`size-3.5`})}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>r($r()),disabled:a||n,className:`flex size-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-50 disabled:pointer-events-none`,title:`Generate random seed`,children:(0,K.jsx)(j,{className:`size-3.5`})})]})]}),(0,K.jsx)(Ee,{type:`number`,value:t,readOnly:!0,tabIndex:-1,disabled:a,className:`curs
17or-default [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none focus-visible:border-input focus-visible:ring-0`})]})}function ti({field:e,value:t,values:n,onChange:r,disabled:i}){let a=typeof t==`number`?t:0,o=n[`${e.key}_locked`]??!1;return(0,K.jsx)(ei,{label:e.label,value:a,locked:o,onChange:t=>r(e.key,t),onLockedChange:t=>r(`${e.key}_locked`,t),disabled:i})}function ni({field:e,value:t,onChange:n,disabled:r}){return(0,K.jsxs)(W,{children:[(0,K.jsx)(Q,{field:e}),(0,K.jsxs)(Ce,{value:t,onValueChange:t=>n(e.key,t),disabled:r,children:[(0,K.jsx)(ve,{className:`w-full`,children:(0,K.jsx)(_e,{})}),(0,K.jsx)(ye,{children:e.options.map(e=>(0,K.jsx)(xe,{value:e.value,children:e.label},e.value))})]}),(0,K.jsx)($,{field:e})]})}function ri({className:e,defaultValue:t,value:n,min:r=0,max:i=100,...a}){let o=G.useMemo(()=>Array.isArray(n)?n:Array.isArray(t)?t:[r,i],[n,t,r,i]);return(0,K.jsxs)(At,{"data-slot":`slider`,defaultValue:t,value:n,min:r,max:i,className:z(`relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col`,e),...a,children:[(0,K.jsx)(Lt,{"data-slot":`slider-track`,className:z(`relative grow overflow-hidden rounded-full bg-muted data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5`),children:(0,K.jsx)(zt,{"data-slot":`slider-range`,className:z(`absolute bg-primary data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full`)})}),Array.from({length:o.length},(e,t)=>(0,K.jsx)(Kt,{"data-slot":`slider-thumb`,className:`block size-4 shrink-0 rounded-full border border-primary bg-white shadow-sm ring-ring/50 transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50`},t))]})}function ii({field:e,value:t,onChange:n,disabled:r}){let i=!!(e.minLabel||e.maxLabel);return(0,K.jsxs)(W,{children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(Q,{field:{...e,descriptionType:i?`popover`:e.descriptionType}}),(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t})]}),(0,K.jsx)(ri,{value:[t],onValueChange:([t])=>n(e.key,t),min:e.min,max:e.max,step:e.step,disabled:r}),i?(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.minLabel}),(0,K.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.maxLabel})]}):(0,K.jsx)($,{field:e})]})}function ai({field:e,value:t,onChange:n,disabled:r}){return(0,K.jsxs)(W,{orientation:`horizontal`,children:[(0,K.jsxs)(ke,{children:[(0,K.jsx)(Q,{field:e}),(0,K.jsx)($,{field:e})]}),(0,K.jsx)(we,{checked:t,onCheckedChange:t=>n(e.key,t),disabled:r})]})}var oi=r({method:`POST`}).handler(n(`ae6489b203fc129a2b52308a21084aacf69938dce06f9ffc6af6777637ef3de8`));function si({field:e,value:t,onChange:n,disabled:r}){let[i,a]=(0,G.useState)(!1),o=(t??``).length,s=!!e.alert,c=o>0,l=async()=>{if(!(!c||i)){a(!0);try{let r=await oi({data:{prompt:t??``,category:e.optimizeCategory,type:e.optimizeType}});if(!r.success||!r.optimizedPrompt)throw Error(r.error??`Optimization failed`);n(e.key,r.optimizedPrompt)}catch(e){H.error(e.message||`Optimization failed`)}finally{a(!1)}}};return(0,K.jsxs)(W,{children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(Q,{field:{...e,descriptionType:s?`popover`:e.descriptionType}}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[e.enableOptimize&&(0,K.jsxs)(B,{type:`button`,variant:`ghost`,size:`xs`,onClick:l,disabled:r||i||!c,children:[i?(0,K.jsx)(U,{className:`size-3 animate-spin`}):(0,K.jsx)(ne,{className:`size-3`}),i?`Optimizing...`:`Optimize`]}),(0,K.jsxs)(B,{type:`button`,variant:`ghost`,size:`xs`,onClick:()=>n(e.key,``),disabled:r||i||!c,children:[(0,K.jsx)(M,{className:`size-3`}),`Clear`]})]})]}),(0,K.jsx)(je,{value:t,onChange:t=>{e.maxLength&&t.target.value.length>e.maxLength||n(e.key,t.target.value)},placeholder:e.placeholder,maxLength:e.maxLength,disabled:r||i,className:`resize-none overflow-y-auto field-sizing-normal! min-h-0!`,style:{height:`${e.rows*1.5+1}rem`}}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[e.alert?(0,K.jsx)(`span`,{className:`text-xs font-medium text-amber-600 dar
17k:text-amber-400`,children:e.alert}):e.description&&e.descriptionType!==`popover`?(0,K.jsx)(Ae,{className:`text-xs`,children:e.description}):(0,K.jsx)(`span`,{}),e.maxLength&&(0,K.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:[o,`/`,e.maxLength]})]})]})}function ci({field:e,value:t,onChange:n,disabled:r}){let i=(t??``).length;return(0,K.jsxs)(W,{children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(Q,{field:e}),i>0&&!r&&(0,K.jsx)(`button`,{type:`button`,className:`text-xs text-muted-foreground hover:text-foreground transition-colors`,onClick:()=>n(e.key,``),children:`Clear`})]}),(0,K.jsx)(Ee,{value:t,onChange:t=>{e.maxLength&&t.target.value.length>e.maxLength||n(e.key,t.target.value)},placeholder:e.placeholder,maxLength:e.maxLength,disabled:r}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[e.description&&e.descriptionType!==`popover`?(0,K.jsx)(Ae,{className:`text-xs`,children:e.description}):(0,K.jsx)(`span`,{}),(0,K.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:[i,`/`,e.maxLength]})]})]})}function li({value:e,onChange:t,accept:n,max:r,disabled:i,onDurationChange:a}){let[o,s]=(0,G.useState)([]),[c,l]=(0,G.useState)([]),[u,d]=(0,G.useState)(!1),f=(0,G.useRef)(null),p=e.length+o.length,m=p<r,h=(0,G.useCallback)(e=>new Promise(t=>{let n=URL.createObjectURL(e),r=document.createElement(`video`);
17r.preload=`metadata`,r.muted=!0,r.playsInline=!0;let i=()=>URL.revokeObjectURL(n);r.addEventListener(`loadeddata`,()=>{let e=document.createElement(`canvas`);e.width=r.videoWidth,e.height=r.videoHeight,e.getContext(`2d`)?.drawImage(r,0,0);let n=e.toDataURL(`image/jpeg`,.7);i(),t({duration:r.duration,thumbnail:n})}),r.addEventListener(`error`,()=>{i(),t({duration:0,thumbnail:``})}),r.src=n}),[]),g=e=>!e||e<=0?`0:00`:`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,`0`)}`,_=(0,G.useCallback)(async e=>{let t=new FormData;t.append(`file`,e),t.append(`folder`,`upload`);let n=await fetch(`/api/upload`,{method:`POST`,body:t});if(!n.ok)try{let e=await n.json();return n.status===401?{error:`Please login to upload files`}:{error:e.error??`Upload failed (${n.status})`}}catch{return{error:`Upload failed (${n.status})`}}return{url:(await n.json()).url}},[]),v=(0,G.useCallback)(async n=>{let r=await _(n.file);`error`in r?(s(e=>e.map(e=>e.id===n.id?{...e,status:`failed`}:e)),H.error(`Upload failed`,{description:r.error})):(s(e=>e.filter(e=>e.id!==n.id)),t([...e,r.url]),l(e=>[...e,{url:r.url,duration:n.duration,fileName:n.file.name,thumbnail:n.thumbnail}]),n.duration&&a&&a(n.duration))},[e,t,a,_]),y=(0,G.useCallback)(async e=>{if(i||!m)return;let{valid:t,error:a}=Ke(Array.from(e),{accept:n,maxCount:r-p});if(a&&H.error(`Some files were skipped`,{description:a}),t.length===0)return;let o=await Promise.all(t.map(async e=>{let{duration:t,thumbnail:n}=await h(e);return{id:crypto.randomUUID(),previewUrl:URL.createObjectURL(e),file:e,status:`uploading`,duration:t,thumbnail:n}}));s(e=>[...e,...o]);for(let e of o)v(e)},[i,m,r,p,n,v,h]),b=(0,G.useCallback)(e=>{s(t=>t.map(t=>t.id===e.id?{...t,status:`uploading`}:t)),v(e)},[v]),x=(0,G.useCallback)(e=>{URL.revokeObjectURL(e.previewUrl),s(t=>t.filter(t=>t.id!==e.id))},[]),S=(0,G.useCallback)(e=>{e.preventDefault(),d(!1),y(e.dataTransfer.files)},[y]),w=n=>{let r=e[n];t(e.filter((e,t)=>t!==n)),l(e=>e.filter(e=>e.url!==r))},T=o.some(e=>e.status===`uploading`),E=n.join(`,`);return(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(e.length>0||o.length>0)&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[e.map((e,t)=>{let n=c.find(t=>t.url===e);return(0,K.jsxs)(`div`,{className:`group flex items-center gap-2 rounded-md border p-2`,children:[(0,K.jsx)(`div`,{className:`size-10 shrink-0 rounded overflow-hidden bg-muted`,children:n?.thumbnail?(0,K.jsx)(`img`,{src:n.thumbnail,alt:``,className:`size-full object-cover`}):(0,K.jsx)(`div`,{className:`size-full flex items-center justify-center text-primary`,children:(0,K.jsx)(k,{className:`size-4`})})}),(0,K.jsxs)(`div`,{className:`flex flex-1 flex-col min-w-0`,children:[(0,K.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:n?.fileName||`Video ${t+1}`}),n?.duration?(0,K.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:g(n.duration)}):null]}),!i&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>w(t),className:`size-5 flex shrink-0 items-center justify-center rounded-full text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors`,children:(0,K.jsx)(M,{className:`size-3.5`})})]},e)}),o.map(e=>(0,K.jsxs)(`div`,{className:`group flex items-center gap-2 rounded-md border p-2`,children:[(0,K.jsxs)(`div`,{className:`relative size-10 shrink-0 rounded overflow-hidden bg-muted`,children:[e.thumbnail?(0,K.jsx)(`img`,{src:e.thumbnail,alt:``,className:`size-full object-cover`}):(0,K.jsx)(`div`,{className:`size-full flex items-center justify-center`,children:(0,K.jsx)(k,{className:`size-4 text-muted-foreground`})}),(0,K.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black/40`,children:e.status===`uploading`?(0,K.jsx)(U,{className:`size-4 animate-spin text-white`}):(0,K.jsx)(C,{className:`size-4 text-destructive`})})]}),(0,K.jsxs)(`div`,{className:`flex flex-1 flex-col min-w-0`,children:[(0,K.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:e.file.name}),(0,K.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.status===`uploading`?`Uploading...`:`Upload failed`})]}),e.status===`failed`&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>b(e),className:`shrink-0 text-[11px] text-primary hover:underline`,children:`Retry`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>x(e),className:`size-5 flex shrink-0 items-center justify-center rounded-full text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors`,children:(0,K.jsx)(M,{className:`size-3.5`})})]},e.id))]}),m&&(0,K.jsxs)(`div`,{onClick:()=>!i&&!T&&f.current?.click(),onDragOver:e=>{e.preventDefault(),d(!0)},onDragLeave:()=>d(!1),onDrop:S,className:z(`flex flex-col items-center justify-center gap-1 rounded-md border-2 border-dashed p-4 cursor-pointer transition-colors`,u&&`border-primary bg-primary/5`,i||T?`opacity-50 cursor-not-allowed`:`hover:border-primary/50`),children:[T?(0,K.jsx)(U,{className:`size-5 animate-spin text-muted-foreground`}):(0,K.jsx)(k,{className:`size-5 text-muted-foreground`}),(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:T?`Uploading...`:`Drop video here or click (${p}/${r})`})]}),(0,K.jsx)(`input`,{ref:f,type:`file`,accept:E,multiple:r>1,className:`hidden`,onChange:e=>{e.target.files&&y(e.target.files),e.target.value=``}})]})}function ui({field:e,value:t,onChange:n,disabled:r}){let i=e.max===1,a=i?t?[t]:[]:Array.isArray(t)?t:t?[t]:[],o=e.accept??Ge;return(0,K.jsxs)(W,{children:[(0,K.jsx)(Q,{field:e}),(0,K.jsx)($,{field:e}),(0,K.jsx)(li,{value:a,onChange:t=>n(e.key,i?t[0]??``:t),accept:o,max:e.max,disabled:r,onDurationChange:t=>{n(`${e.key}_duration`,t)}})]})}function di({fields:e,values:t,onChange:n,disabled:r}){return(0,K.jsx)(`div`,{className:`flex flex-col gap-5`,children:e.map(e=>(0,K.jsx)(fi,{field:e,value:t[e.key],values:t,onChange:n,disabled:r},e.key))})}function fi({field:e,value:t,values:n,onChange:r,disabled:i}){switch(e.type){case`select`:return(0,K.jsx)(ni,{field:e,value:t,onChange:r,disabled:i});case`slider`:return(0,K.jsx)(ii,{field:e,value:t,onChange:r,disabled:i});case`switch`:return(0,K.jsx)(ai,{field:e,value:t,onChange:r,disabled:i});case`text`:return(0,K.jsx)(ci,{field:e,value:t,onChange:r,disabled:i});case`textarea`:return(0,K.jsx)(si,{field:e,value:t,onChange:r,disabled:i});case`image-input`:return(0,K.jsx)(Xr,{field:e,value:t,onChange:r,disabled:i});case`aspect-ratio`:return(0,K.jsx)(Vr,{field:e,value:t,onChange:r,disabled:i});case`audio-input`:return(0,K.jsx)(Gr,{field:e,value:t,onChange:r,disabled:i});case`video-input`:return(0,K.jsx)(ui,{field:e,value:t,onChange:r,disabled:i});case`seed-input`:return(0,K.jsx)(ti,{field:e,value:t,values:n,onChange:r,disabled:i});default:return null}}function pi({url:e}){return(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-4 w-full px-4`,children:[(0,K.jsx)(O,{className:`size-12 text-primary`}),(0,K.jsx)(`audio`,{src:e,controls:!0,className:`w-full max-w-md`})]})}function mi({images:e,currentIndex:t,onIndexChange:n}){let[r,i]=(0,G.useState)(0),a=t??r,o=n??i,[s,c]=(0,G.useState)(new Set),l=e.length>1,f=()=>{a>0&&o(a-1)},p=()=>{a<e.length-1&&o(a+1)},m=a>0,h=a<e.length-1;return(0,K.jsxs)(`div`,{className:`relative min-h-0 size-full`,children:[(0,K.jsx)(`div`,{className:`size-full overflow-hidden`,children:(0,K.jsx)(`div`,{className:`flex h-full transition-transform duration-300 ease-in-out`,style:{transform:`translateX(-${a*100}%)`},children:e.map((e,t)=>(0,K.jsx)(`div`,{className:`flex h-full w-full shrink-0 items-center justify-center`,children:s.has(t)?(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-muted-foreground`,children:[(0,K.jsx)(D,{className:`size-12`}),(0,K.jsx)(`p`,{className:`text-sm`,children:`Image failed to load`})]}):(0,K.jsx)(`img`,{src:e,alt:`Image ${t+1}`,className:`max-h-full max-w-full object-contain rounded-md`,onError:()=>c(e=>new Set(e).add(t))})},e))})}),l&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{type:`button`,onClick:f,disabled:!m,className:`absolute left-2 top-1/2 -translate-y-1/2 flex size-8 items-center justify-center rounded-full bg-black/40 text-white transition-colors hover:bg-black/60 disabled:opacity-30 disabled:pointer-events-none`,children:(0,K.jsx)(u,{className:`size-4`})}),(0,K.jsx)(`button`,{type:`button`,onClick:p,disabled:!h,className:`absolute right-2 top-1/2 -translate-y-1/2 flex size-8 items-center justify-center rounded-full bg-black/40 text-white transition-colors hover:bg-black/60 disabled:opacity-30 disabled:pointer-events-none`,children:(0,K.jsx)(d,{className:`size-4`})}),(0,K.jsx)(`div`,{className:`absolute bottom-6 left-1/2 -translate-x-1/2 flex items-center gap-1.5 rounded-full bg-black/40 px-2.5 py-1.5`,children:e.map((e,t)=>(0,K.jsx)(`div`,{className:`size-1.5 rounded-full transition-colors ${t===a?`bg-white`:`bg-white/40`}`},t))})]})]})}function hi({rawJson:e,onCopyText:t}){let[n,r]=(0,G.useState)(!1),i=e,a=e;try{let t=JSON.parse(e);i=t.text||JSON.stringify(t,null,2),a=JSON.stringify(t,null,2)}catch{}return(0,K.jsxs)(`div`,{className:`flex w-full h-full flex-col self-start overflow-y-auto gap-3`,children:[(0,K.jsxs)(`div`,{className:`relative rounded-md border bg-background p-4 pr-10`,children:[(0,K.jsx)(`p`,{className:`text-sm whitespace-pre-wrap wrap-break-word`,children:i}),(0,K.jsx)(`button`,{type:`button`,onClick:t,className:`absolute top-2 right-2 flex size-7 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors`,title:`Copy text`,children:(0,K.jsx)(T,{className:`size-3.5`})})]}),(0,K.jsxs)(`div`,{className:`rounded-md border bg-background`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>r(!n),className:`flex w-full items-center gap-2 px-4 py-2 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[(0,K.jsx)(x,{className:`size-3.5 transition-transform ${n?``:`-rotate-90`}`}),(0,K.jsx)(`span`,{children:`Full JSON Response`})]}),n&&(0,K.jsx)(`div`,{className:`border-t px-4 py-3 max-h-48 overflow-y-auto`,children:(0,K.jsx)(`pre`,{className:`text-xs whitespace-pre-wrap wrap-break-word text-muted-foreground`,children:a})})]})]})}function gi({url:e}){return(0,K.jsx)(`div`,{className:`w-full aspect-video`,children:(0,K.jsx)(`video`,{src:e,controls:!0,className:`size-full object-contain rounded-md`})})}function _i(e){switch(e){case`video`:return`Generating video...`;case`audio`:return`Processing...`;case`text`:return`Processing...`;default:return`Generating image...`}}function vi(e){switch(e){case`video`:return`Video generation may take a few minutes, please be patient.`;default:return`AI generation may take a while, please be patient.`}}function yi(e){switch(e){case`video`:return`Generated videos will appear here`;case`audio`:return`Generated audio will appear here`;case`text`:return`Generated text will appear here`;default:return`Generated images will appear here`}}function bi({outputType:e}){switch(e){case`video`:return(0,K.jsx)(k,{className:`size-12`});case`audio`:case`text`:return(0,K.jsx)(O,{className:`size-12`});default:return(0,K.jsx)(D,{className:`size-12`})}}function xi(e){switch(e){case`text`:return`Copy JSON copies the full structured response including metadata.`;case`video`:return`If download doesn't start, right-click (or long-press on mobile) the video and select "Save video as"`;case`audio`:return`If download doesn't start, right-click the audio player and select "Save audio as"`;default:return`If download doesn't start, right-click (or long-press on mobile) the image and select "Save image as"`}}function Si(e){switch(e){case`audio`:case`text`:return 3e3;default:return 5e3}}function Ci(e){switch(e){case`video`:return 6e5;default:return 3e5}}function wi({models:e,defaultModelId:t,defaultTabKey:n}){let{data:r}=Me.useSession(),{data:s=[]}=a({queryKey:[`site-config`,`restricted-email-keywords`],queryFn:()=>Ir(),staleTime:6e4}),c=(0,G.useMemo)(()=>Pr(e,r?.user?.email,s),[e,r?.user?.email,s]),[l,u]=(0,G.useState)(()=>t&&c.some(e=>e.id===t)?t:c[0].id),d=c.some(e=>e.id===l)?l:c[0].id,f=Mr(d,c),[p,m]=(0,G.useState)(()=>n&&f.tabs.some(e=>e.key===n)?n:f.tabs[0].key),h=f.tabs.find(e=>e.key===p)??f.tabs[0],g=h.outputType??`image`,[_,y]=(0,G.useState)(()=>Fr(l,h.key)),[b,x]=(0,G.useState)(`idle`),[S,w]=(0,G.useState)(()=>h.example?.output??[]),[D,ee]=(0,G.useState)(null),[O,k]=(0,G.useState)(null),[A,j]=(0,G.useState)(!1),[re,M]=(0,G.useState)(!1),[N,ie]=(0,G.useState)(0),[P,F]=(0,G.useState)(()=>h.example?.duration??null),I=(0,G.useRef)(null),ae=(0,G.useRef)(0),L=(0,G.useRef)(null),[oe,se]=(0,G.useState)(0),{credits:ce,isLoading:le,invali
17date:ue}=o();(0,G.useEffect)(()=>{if(d!==l){u(d);let e=Mr(d,c).tabs[0];m(e.key),y(Fr(d,e.key)),x(`idle`),w(e.example?.output??[]),F(e.example?.duration??null),k(null),j(!1),M(!1)}},[d,l,c]);let de=(0,G.useCallback)(e=>{u(e);let t=Mr(e,c).tabs[0];m(t.key),y(Fr(e,t.key)),k(null),j(!1),M(!1),x(`idle`),w(t.example?.output??[]),F(t.example?.duration??null)},[c]),fe=(0,G.useCallback)(e=>{m(e),y(Fr(d,e));let t=f.tabs.find(t=>t.key===e)??f.tabs[0];k(null),j(!1),M(!1),x(`idle`),w(t.example?.output??[]),F(t.example?.duration??null)},[d,f.tabs]),pe=(0,G.useCallback)((e,t)=>{y(n=>({...n,[e]:t})),O&&b===`failed`&&(k(null),j(!1),M(!1),x(`idle`))},[O,b]),me=(0,G.useCallback)(()=>{y(In(h.fields)),x(`idle`),w([]),F(null),k(null),j(!1),M(!1)},[h.fields]);(0,G.useEffect)(()=>()=>{L.current&&clearInterval(L.current),I.current&&clearInterval(I.current)},[]);let he=()=>{ae.current=Date.now(),ie(0),F(null),I.current=setInterval(()=>{ie(Math.floor((Date.now()-ae.current)/100))},100)},R=()=>{I.current&&=(clearInterval(I.current),null),F((Date.now()-ae.current)/1e3)},ge=async()=>{if(!r){x(`failed`),k(`Please login to use AI services. New users receive free credits!`),j(!0);return}if(ce<V){x(`failed`),k(`Insufficient credits. You need ${V} credits to generate an image.`),M(!0),H.error(`Insufficient credits. Please purchase more credits.`);return}let e=h.fields.filter(e=>{if(!e.required)return!1;let t=_[e.key];return Array.isArray(t)?t.length===0:typeof t==`string`?t.trim()===``:t==null});if(e.length>0){x(`failed`),k(`Please fill in: ${e.map(e=>e.label).join(`, `)}`),j(!1),M(!1);return}x(`submitting`),k(null),j(!1),M(!1),w([]),se(0),he();let t=Ln(h.fields,_);y(t);try{let e=await Pe({data:{modelId:d,tabKey:h.key,fields:t}});if(!e.success||!e.task_id){R(),x(`failed`);let t=e.error??`Failed to submit task`;k(t),j(t.toLowerCase().includes(`login`));return}x(`polling`),ue();let n=e.task_id;ee(n);let r=Date.now(),i=Ci(g),a=Si(g);L.current=setInterval(async()=>{if(Date.now()-r>i){L.current&&clearInterval(L.current),L.current=null,R(),k(`Generation timed out. The task may still be processing â check My Creations later for results.`),j(!1),x(`failed`);return}try{let e=await Ne({data:{taskId:n}});if(e.status===`succeeded`&&e.output)L.current&&clearInterval(L.current),L.current=null,R(),w(e.output),x(`succeeded`),ue();else if(e.status===`failed`){L.current&&clearInterval(L.current),L.current=null,R();let t=e.error??`Generation failed`;k(t),j(t.toLowerCase().includes(`login`)),x(`failed`),ue()}}catch{}},a)}catch{R(),x(`failed`),k(`Network error, please try again`),j(!1)}},be=()=>{if(!r){H.error(`Please login to download`);return}let e=S[oe]??S[0]??h.example?.output?.[0];if(!e)return;let t=document.createElement(`a`);t.href=`/api/download?url=${encodeURIComponent(e)}`,document.body.appendChild(t),t.click(),document.body.removeChild(t)},Se=()=>{let e=S[0]??h.example?.output?.[0];if(e)try{let t=JSON.parse(e);navigator.clipboard.writeText(JSON.stringify(t,null,2)),H.success(`JSON copied to clipboard`)}catch{navigator.clipboard.writeText(e),H.success(`Copied to clipboard`)}},we=()=>{let e=S[0]??h.example?.output?.[0];if(e)try{let t=JSON.parse(e);navigator.clipboard.writeText(t.text||e),H.success(`Text copied to clipboard`)}catch{navigator.clipboard.writeText(e),H.success(`Copied to clipboard`)}},z=b===`submitting`||b===`polling`,V=h.computeCredits(_);return(0,K.jsxs)(`div`,{className:`flex flex-col lg:flex-row lg:h-170 gap-6 rounded-xl border bg-background p-4`,children:[(0,K.jsxs)(`div`,{className:`flex w-full lg:flex-4 lg:h-full lg:min-w-0 flex-col gap-4`,children:[(0,K.jsxs)(Ce,{value:d,onValueChange:de,disabled:z,children:[(0,K.jsx)(ve,{className:`w-full`,children:(0,K.jsx)(_e,{placeholder:`Select model`})}),(0,K.jsx)(ye,{children:c.map(e=>(0,K.jsx)(xe,{value:e.id,children:(0,K.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.icon&&(0,K.jsx)(`img`,{src:e.icon,alt:``,className:`size-4 rounded-sm`}),e.name,(e.isHot||e.isNew)&&(0,K.jsx)(De,{className:`bg-primary/10 text-primary rounded px-1 py-0 text-xs leading-tight`,children:e.isHot?`HOT`:`NEW`})]})},e.id))})]}),(0,K.jsx)(`div`,{className:`lg:min-h-0 lg:flex-1 lg:overflow-y-auto overscroll-y-contain scrollbar-thin`,children:(0,K.jsx)(`div`,{className:`lg:px-1 lg:pr-3 lg:pb-2`,children:f.tabs.length>1?(0,K.jsxs)(We,{value:p,onValueChange:fe,children:[(0,K.jsx)(Ue,{className:f.tabs.length>3?`w-full h-auto! flex flex-wrap bg-transparent gap-2 p-0 rounded-none justify-start`:`w-full`,children:f.tabs.map(e=>(0,K.jsx)(Ve,{value:e.key,disabled:z,className:f.tabs.length>3?`flex-initial border border-border data-[state=active]:border-primary data-[state=active]:bg-accent`:void 0,children:e.name},e.key))}),f.tabs.map(e=>(0,K.jsx)(He,{value:e.key,className:`mt-4`,children:(0,K.jsx)(di,{fields:e.fields,values:_,onChange:pe,disabled:z})},e.key))]}):(0,K.jsx)(di,{fields:h.fields,values:_,onChange:pe,disabled:z})})}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(B,{onClick:ge,disabled:z||le,className:`flex-1`,children:z?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(U,{className:`size-4 animate-spin`}),`Generating...`]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(ne,{className:`size-4`}),`Generate (`,V,` credits)`]})}),(0,K.jsx)(B,{variant:`outline`,disabled:z,onClick:me,children:`Reset`})]}),(0,K.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`This generation costs `,(0,K.jsx)(`span`,{className:`font-medium text-foreground`,children:V}),` credits · Available balance: `,(0,K.jsx)(`span`,{className:`font-medium text-foreground`,children:ce}),` credits`]})]}),(0,K.jsxs)(`div`,{className:`flex min-h-100 lg:min-h-0 lg:flex-5 lg:min-w-0 flex-col rounded-lg border bg-muted/30 overflow-hidden`,children:[(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-4`,children:[b===`idle`&&S.length===0&&(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-muted-foreground`,children:[(0,K.jsx)(bi,{outputType:g}),(0,K.jsx)(`p`,{className:`text-sm`,children:yi(g)})]}),b===`idle`&&S.length>0&&Ti(S,g,{currentImageIndex:oe,onImageIndexChange:se,onCopyText:we}),z&&(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-muted-foreground`,children:[(0,K.jsx)(U,{className:`size-10 animate-spin`}),(0,K.jsx)(`p`,{className:`text-sm font-medium`,children:_i(g)}),(0,K.jsxs)(`p`,{className:`text-2xl font-mono tabular-nums`,children:[(N/10).toFixed(1),`s`]}),(0,K.jsxs)(`div`,{className:`mt-2 flex flex-col items-center gap-1 text-xs text-muted-foreground
17/70`,children:[(0,K.jsx)(`p`,{children:vi(g)}),(0,K.jsx)(`p`,{children:`You can safely leave this page â check My Creations later for results.`})]})]}),b===`failed`&&(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-3 px-6 text-center`,children:[(0,K.jsx)(C,{className:`size-10 text-destructive`}),(0,K.jsx)(`p`,{className:`text-sm text-destructive`,children:O??`Something went wrong`}),A&&(0,K.jsx)(B,{size:`sm`,variant:`outline`,asChild:!0,children:(0,K.jsx)(`a`,{href:`/signin`,children:`Sign In`})}),re&&(0,K.jsx)(B,{size:`sm`,variant:`outline`,asChild:!0,children:(0,K.jsx)(i,{to:`/pricing`,children:`Buy Credits`})})]}),b===`succeeded`&&S.length>0&&Ti(S,g,{currentImageIndex:oe,onImageIndexChange:se,onCopyText:we})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-t px-4 py-3`,children:[(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:P===null?`\xA0`:`Generated in ${Math.ceil(P)}s`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[g===`text`?(0,K.jsxs)(B,{size:`sm`,variant:`outline`,disabled:z||b===`failed`,onClick:Se,children:[(0,K.jsx)(T,{className:`size-4`}),`Copy JSON`]}):(0,K.jsxs)(B,{size:`sm`,variant:`outline`,disabled:z||b===`failed`,onClick:be,children:[(0,K.jsx)(E,{className:`size-4`}),`Download`]}),b===`succeeded`&&(0,K.jsxs)(B,{size:`sm`,variant:`outline`,onClick:()=>window.open(`/contact${D?`?taskId=${D}`:``}`,`_blank`),children:[(0,K.jsx)(v,{className:`size-4`}),`Report`]}),(0,K.jsx)(B,{size:`sm`,variant:`outline`,asChild:!0,children:(0,K.jsxs)(i,{to:`/settings/my-creations`,children:[(0,K.jsx)(te,{className:`size-4`}),`My Creations`]})})]}),(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground/70`,children:xi(g)})]})]})]})}function Ti(e,t,n){switch(t){case`video`:return(0,K.jsx)(gi,{url:e[0]});case`audio`:return(0,K.jsx)(pi,{url:e[0]});case`text`:return(0,K.jsx)(hi,{rawJson:e[0],onCopyText:n.onCopyText});default:return(0,K.jsx)(mi,{images:e,currentIndex:n.currentImageIndex,onIndexChange:n.onImageIndexChange})}}function Ei(){return(0,K.jsx)(`section`,{id:`ai-tools`,className:`px-4 py-16`,children:(0,K.jsxs)(`div`,{className:`mx-auto max-w-6xl`,children:[(0,K.jsxs)(`div`,{className:`text-center`,children:[(0,K.jsx)(`h2`,{className:`text-balance text-3xl font-semibold md:text-4xl`,children:`One Purchase, Unlock All AI Tools`}),(0,K.jsx)(`p`,{className:`max-w-4xl mx-auto text-muted-foreground mt-6`,children:`Get instant access to our complete AI creative suite. No separate subscriptions, no hidden feesâone plan unlocks AI image generation, ai image editing, ai video generation, and more.`})]}),(0,K.jsxs)(`div`,{className:`mt-12 grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:[(0,K.jsx)(Di,{title:`AI Image Generator`,description:`Bring your ideas to life with AI-generated images. Create unique, high-quality visuals from text prompts for marketing, social media, and creative projects.`,link:`/ai-image-generator`,icon:(0,K.jsx)(g,{className:`size-10`}),iconColor:`bg-primary/10 text-primary`}),(0,K.jsx)(Di,{title:`AI Image Editor`,description:`Edit and enhance your images with powerful AI technology. Perfect your photos with intelligent adjustments, effects, and transformations in seconds.`,link:`/`,icon:(0,K.jsx)(y,{className:`size-10`}),iconColor:`bg-primary/10 text-primary`}),(0,K.jsx)(Di,{title:`AI Video Generator`,description:`Transform text and images into stunning videos in minutes. Create professional video content with customizable aspect ratios, HD quality, and full commercial rights.`,link:`/ai-video-generator`,icon:(0,K.jsx)(k,{className:`size-10`}),iconColor:`bg-primary/10 text-primary`}),(0,K.jsx)(Di,{title:`More Tools Coming Soon`,description:`We're constantly expanding our AI creative suite. Stay tuned for new tools designed to streamline your workflow and unlock even more creative possibilities.`,icon:(0,K.jsx)(ne,{className:`size-10`}),iconColor:`bg-primary/10 text-primary`})]})]})})}var Di=({title:e,description:t,icon:n,iconColor:r,link:i})=>(0,K.jsx)(Te,{className:`p-6`,children:(0,K.jsxs)(`div`,{className:`relative`,children:[(0,K.jsx)(`div`,{className:`flex size-20 items-center justify-center rounded-lg ${r}`,children:n}),(0,K.jsxs)(`div`,{className:`space-y-2 py-6`,children:[(0,K.jsx)(`h3`,{className:`text-base font-medium`,children:e}),(0,K.jsx)(`p`,{className:`text-muted-foreground line-clamp-4 text-sm`,children:t})]}),(0,K.jsx)(`div`,{className:`flex gap-3 border-t border-dashed pt-6`,children:i?(0,K.jsx)(B,{asChild:!0,size:`sm`,className:`gap-1 pr-2 shadow-none`,variant:`outline`,children:(0,K.jsxs)(`a`,{href:i,children:[`Learn More`,(0,K.jsx)(S,{className:`ml-0 opacity-50`})]})}):(0,K.jsxs)(B,{size:`sm`,className:`gap-1 pr-2 shadow-none`,disabled:!0,variant:`outline`,children:[`Coming Soon`,(0,K.jsx)(S,{className:`ml-0 opacity-50`})]})})]})});function Oi(){return(0,K.jsx)(`section`,{className:`px-4 py-16 md:py-32 bg-zinc-50 dark:bg-transparent`,children:(0,K.jsxs)(`div`,{className:`mx-auto max-w-6xl`,children:[(0,K.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-6 text-center`,children:[(0,K.jsx)(`h2`,{className:`text-center text-4xl font-semibold lg:text-5xl`,children:`Flexible Plans for Every Creator`}),(0,K.jsx)(`p`,{className:`text-muted-foreground text-lg`,children:`Get started with free credits and experience the power of AI image editor. Need more? Our affordable credit packages give you the flexibility to edit as many images as you want, whenever you want. All tools included, no hidden fees, no commitments.`})]}),(0,K.jsxs)(`div`,{className:`mt-12 grid gap-8 sm:grid-cols-2`,children:[(0,K.jsxs)(Te,{className:`px-8 md:px-10 items-center text-center`,children:[(0,K.jsx)(`div`,{className:`flex items-center justify-center size-16 rounded-full bg-primary/10`,children:(0,K.jsx)(p,{className:`size-8 text-primary`})}),(0,K.jsx)(`h3`,{className:`text-2xl font-bold`,children:`Subscription Plans`}),(0,K.jsx)(`p`,{className:`text-muted-foreground`,children:`Best for regular creators who need a steady flow of credits every month.`}),(0,K.jsxs)(`ul`,{className:`space-y-3 text-muted-foreground text-left self-stretch`,children:[(0,K.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`size-1.5 rounded-full bg-primary shrink-0`}),`Credits delivered monthly`]}),(0,K.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`size-1.5 rounded-full bg-primary shrink-0`}),`Save more with yearly billing`]}),(0,K.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`size-1.5 rounded-full bg-primary shrink-0`}),`Priority support included`]})]})]}),(0,K.jsxs)(Te,{className:`px-8 md:px-10 items-center text-center`,children:[(0,K.jsx)(`div`,{className:`flex items-center justify-center size-16 rounded-full bg-primary/10`,children:(0,K.jsx)(w,{className:`size-8 text-primary`})}),(0,K.jsx)(`h3`,{className:`text-2xl font-bold`,children:`Credit Packs`}),(0,K.jsx)(`p`,{className:`text-muted-foreground`,children:`Perfect for occasional users who want flexibility without a subscription.`}),(0,K.jsxs)(`ul`,{className:`space-y-3 text-muted-foreground text-left self-stretch`,children:[(0,K.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`size-1.5 rounded-full bg-primary shrink-0`}),`Buy only what you need`]}),(0,K.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`size-1.5 rounded-full bg-primary shrink-0`}),`No recurring commitment`]}),(0,K.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`size-1.5 rounded-full bg-primary shrink-0`}),`Use anytime within 30 days`]})]})]})]}),(0,K.jsx)(`div`,{className:`mt-10 w-full flex justify-center`,children:(0,K.jsx)(B,{asChild:!0,size:`lg`,children:(0,K.jsx)(`a`,{href:`/pricing`,children:`View Pricing & Plans`})})})]})})}export{jr as a,Ar as i,Ei as n,Or as o,wi as r,kr as s,Oi as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.