@imgly/plugin-ai-video-generation-web
Version:
AI video generation plugin for the CE.SDK editor
128 lines (124 loc) • 63.8 kB
JavaScript
var qt=class{constructor(e,t=[],r){this.id=e,this.translateLabel=r?.translateLabel,this.assets=t.map(i=>{if(typeof i.label=="string"&&!(i.label&&typeof i.label=="object")){let n=i;return{id:n.id,label:{en:n.label},meta:n.thumbUri?{...n.meta??{},thumbUri:n.thumbUri}:n.meta}}return i}),this.activeAssetIds=new Set,this.assets.length>0&&this.activeAssetIds.add(this.assets[0].id)}async findAssets(e){let{page:t,perPage:r,locale:i="en",sortActiveFirst:n,query:o,tags:a,groups:s,excludeGroups:u,sortingOrder:d,sortKey:l}=e,c=[...this.assets];if(s&&s.length>0&&(c=c.filter(p=>p.groups&&s.some(f=>p.groups?.includes(f)))),u&&u.length>0&&(c=c.filter(p=>!p.groups||!u.some(f=>p.groups?.includes(f)))),o){let p=o.toLowerCase();c=c.filter(f=>{let h=f.label?.[i]?.toLowerCase(),I=f.tags?.[i]||[];return h&&h.includes(p)||I.some(Ht=>Ht.toLowerCase().includes(p))})}if(a&&a.length>0){let p=Array.isArray(a)?a:[a];c=c.filter(f=>{let h=f.tags?.[i]||[];return p.some(I=>h.includes(I))})}n&&c.sort((p,f)=>{let h=this.activeAssetIds.has(p.id),I=this.activeAssetIds.has(f.id);return h&&!I?-1:!h&&I?1:0}),l&&l!=="id"?c.sort((p,f)=>{let h=p.meta?.[l],I=f.meta?.[l];return h===void 0?1:I===void 0?-1:typeof h=="string"&&typeof I=="string"?d==="Descending"?I.localeCompare(h):h.localeCompare(I):typeof h=="number"&&typeof I=="number"?d==="Descending"?I-h:h-I:0}):l==="id"&&c.sort((p,f)=>d==="Descending"?f.id.localeCompare(p.id):p.id.localeCompare(f.id));let w=c.length,x=t*r,j=x+r,S=c.slice(x,j).map(p=>{let f=p.label?.[i]||"",h=this.translateLabel?this.translateLabel(p.id,f,i):f;return{id:p.id,groups:p.groups,meta:p.meta,payload:p.payload,locale:i,label:h,tags:p.tags?.[i],active:this.activeAssetIds.has(p.id)}}),re=j<w?t+1:void 0;return{assets:S,currentPage:t,nextPage:re,total:w}}updateLabel(e,t,r){this.assets.forEach(i=>{i.id===e&&(i.label=i.label||{},i.label[r]=t)})}getAssetSelectValue(e){let t=this.assets.find(({id:r})=>r===e);if(t){let r=this.translateLabel?this.translateLabel(t.id,t.label?.en||"",""):t.label?.en||"";return{id:t.id,label:r,thumbUri:t.meta?.thumbUri}}}getActiveSelectValue(){let e=this.getActiveAssetIds();if(e.length>0){let t=this.assets.find(({id:r})=>r===e[0]);if(t){let r=this.translateLabel?this.translateLabel(t.id,t.label?.en||"",""):t.label?.en||"";return{id:t.id,label:r,thumbUri:t.meta?.thumbUri}}}}getTranslatedLabel(e){let t=this.assets.find(({id:r})=>r===e);if(t)return this.translateLabel?this.translateLabel(t.id,t.label?.en||"",""):t.label?.en||""}getAsset(e){return this.assets.find(t=>t.id===e)}setAssetActive(e){this.activeAssetIds.add(e)}getActiveAssetIds(){return Array.from(this.activeAssetIds)}setAssetsActive(e){e.forEach(t=>this.activeAssetIds.add(t))}setAssetInactive(e){this.activeAssetIds.delete(e)}clearActiveAssets(){this.activeAssetIds.clear()}isAssetActive(e){return this.activeAssetIds.has(e)}addAsset(e){let t=this.assets.findIndex(r=>r.id===e.id);t>=0?this.assets[t]=e:this.assets.push(e)}removeAsset(e){let t=this.assets.findIndex(r=>r.id===e);t!==-1&&(this.assets.splice(t,1),this.activeAssetIds.delete(e))}async getGroups(){let e=new Set;return this.assets.forEach(t=>{t.groups&&t.groups.forEach(r=>e.add(r))}),Array.from(e)}getSupportedMimeTypes(){return["image/jpeg","image/png","image/svg+xml","image/webp","video/mp4","audio/mpeg"]}};var Kt=typeof global=="object"&&global&&global.Object===Object&&global,Ue=Kt,Zt=typeof self=="object"&&self&&self.Object===Object&&self,Qt=Ue||Zt||Function("return this")(),C=Qt,Yt=C.Symbol,L=Yt,Be=Object.prototype,Wt=Be.hasOwnProperty,Jt=Be.toString,G=L?L.toStringTag:void 0;function Xt(e){var t=Wt.call(e,G),r=e[G];try{e[G]=void 0;var i=!0}catch{}var n=Jt.call(e);return i&&(t?e[G]=r:delete e[G]),n}var er=Xt,tr=Object.prototype,rr=tr.toString;function ir(e){return rr.call(e)}var nr=ir,or="[object Null]",ar="[object Undefined]",Pe=L?L.toStringTag:void 0;function sr(e){return e==null?e===void 0?ar:or:Pe&&Pe in Object(e)?er(e):nr(e)}var Z=sr;function lr(e){return e!=null&&typeof e=="object"}var be=lr,Ml=Array.isArray;function ur(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ge=ur,dr="[object AsyncFunction]",cr="[object Function]",pr="[object GeneratorFunction]",gr="[object Proxy]";function mr(e){if(!Ge(e))return!1;var t=Z(e);return t==cr||t==pr||t==dr||t==gr}var fr=mr,hr=C["__core-js_shared__"],ue=hr,Ee=function(){var e=/[^.]+$/.exec(ue&&ue.keys&&ue.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function yr(e){return!!Ee&&Ee in e}var br=yr,vr=Function.prototype,wr=vr.toString;function xr(e){if(e!=null){try{return wr.call(e)}catch{}try{return e+""}catch{}}return""}var M=xr,Ir=/[\\^$.*+?()[\]{}|]/g,kr=/^\[object .+?Constructor\]$/,Sr=Function.prototype,Ar=Object.prototype,Cr=Sr.toString,Pr=Ar.hasOwnProperty,Er=RegExp("^"+Cr.call(Pr).replace(Ir,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Mr(e){if(!Ge(e)||br(e))return!1;var t=fr(e)?Er:kr;return t.test(M(e))}var Tr=Mr;function jr(e,t){return e?.[t]}var _r=jr;function Lr(e,t){var r=_r(e,t);return Tr(r)?r:void 0}var V=Lr,Vr=V(C,"WeakMap"),pe=Vr;function Or(e,t){return e===t||e!==e&&t!==t}var Dr=Or,$r=9007199254740991;function Rr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=$r}var Fr=Rr,Tl=Object.prototype,Nr="[object Arguments]";function zr(e){return be(e)&&Z(e)==Nr}var Me=zr,He=Object.prototype,Ur=He.hasOwnProperty,Br=He.propertyIsEnumerable,jl=Me(function(){return arguments}())?Me:function(e){return be(e)&&Ur.call(e,"callee")&&!Br.call(e,"callee")},qe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Te=qe&&typeof module=="object"&&module&&!module.nodeType&&module,Gr=Te&&Te.exports===qe,je=Gr?C.Buffer:void 0,_l=je?je.isBuffer:void 0,Hr="[object Arguments]",qr="[object Array]",Kr="[object Boolean]",Zr="[object Date]",Qr="[object Error]",Yr="[object Function]",Wr="[object Map]",Jr="[object Number]",Xr="[object Object]",ei="[object RegExp]",ti="[object Set]",ri="[object String]",ii="[object WeakMap]",ni="[object ArrayBuffer]",oi="[object DataView]",ai="[object Float32Array]",si="[object Float64Array]",li="[object Int8Array]",ui="[object Int16Array]",di="[object Int32Array]",ci="[object Uint8Array]",pi="[object Uint8ClampedArray]",gi="[object Uint16Array]",mi="[object Uint32Array]",g={};g[ai]=g[si]=g[li]=g[ui]=g[di]=g[ci]=g[pi]=g[gi]=g[mi]=!0;g[Hr]=g[qr]=g[ni]=g[Kr]=g[oi]=g[Zr]=g[Qr]=g[Yr]=g[Wr]=g[Jr]=g[Xr]=g[ei]=g[ti]=g[ri]=g[ii]=!1;function fi(e){return be(e)&&Fr(e.length)&&!!g[Z(e)]}var hi=fi;function yi(e){return function(t){return e(t)}}var bi=yi,Ke=typeof exports=="object"&&exports&&!exports.nodeType&&exports,H=Ke&&typeof module=="object"&&module&&!module.nodeType&&module,vi=H&&H.exports===Ke,de=vi&&Ue.process,wi=function(){try{var e=H&&H.require&&H.require("util").types;return e||de&&de.binding&&de.binding("util")}catch{}}(),_e=wi,Le=_e&&_e.isTypedArray,Ll=Le?bi(Le):hi,xi=Object.prototype,Vl=xi.hasOwnProperty;function Ii(e,t){return function(r){return e(t(r))}}var ki=Ii,Ol=ki(Object.keys,Object),Si=Object.prototype,Dl=Si.hasOwnProperty,Ai=V(Object,"create"),q=Ai;function Ci(){this.__data__=q?q(null):{},this.size=0}var Pi=Ci;function Ei(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Mi=Ei,Ti="__lodash_hash_undefined__",ji=Object.prototype,_i=ji.hasOwnProperty;function Li(e){var t=this.__data__;if(q){var r=t[e];return r===Ti?void 0:r}return _i.call(t,e)?t[e]:void 0}var Vi=Li,Oi=Object.prototype,Di=Oi.hasOwnProperty;function $i(e){var t=this.__data__;return q?t[e]!==void 0:Di.call(t,e)}var Ri=$i,Fi="__lodash_hash_undefined__";function Ni(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=q&&t===void 0?Fi:t,this}var zi=Ni;function O(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}O.prototype.clear=Pi;O.prototype.delete=Mi;O.prototype.get=Vi;O.prototype.has=Ri;O.prototype.set=zi;var Ve=O;function Ui(){this.__data__=[],this.size=0}var Bi=Ui;function Gi(e,t){for(var r=e.length;r--;)if(Dr(e[r][0],t))return r;return-1}var ie=Gi,Hi=Array.prototype,qi=Hi.splice;function Ki(e){var t=this.__data__,r=ie(t,e);if(r<0)return!1;var i=t.length-1;return r==i?t.pop():qi.call(t,r,1),--this.size,!0}var Zi=Ki;function Qi(e){var t=this.__data__,r=ie(t,e);return r<0?void 0:t[r][1]}var Yi=Qi;function Wi(e){return ie(this.__data__,e)>-1}var Ji=Wi;function Xi(e,t){var r=this.__data__,i=ie(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}var en=Xi;function D(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}D.prototype.clear=Bi;D.prototype.delete=Zi;D.prototype.get=Yi;D.prototype.has=Ji;D.prototype.set=en;var ne=D,tn=V(C,"Map"),K=tn;function rn(){this.size=0,this.__data__={hash:new Ve,map:new(K||ne),string:new Ve}}var nn=rn;function on(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var an=on;function sn(e,t){var r=e.__data__;return an(t)?r[typeof t=="string"?"string":"hash"]:r.map}var oe=sn;function ln(e){var t=oe(this,e).delete(e);return this.size-=t?1:0,t}var un=ln;function dn(e){return oe(this,e).get(e)}var cn=dn;function pn(e){return oe(this,e).has(e)}var gn=pn;function mn(e,t){var r=oe(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}var fn=mn;function $(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}$.prototype.clear=nn;$.prototype.delete=un;$.prototype.get=cn;$.prototype.has=gn;$.prototype.set=fn;var Ze=$;function hn(){this.__data__=new ne,this.size=0}var yn=hn;function bn(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var vn=bn;function wn(e){return this.__data__.get(e)}var xn=wn;function In(e){return this.__data__.has(e)}var kn=In,Sn=200;function An(e,t){var r=this.__data__;if(r instanceof ne){var i=r.__data__;if(!K||i.length<Sn-1)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new Ze(i)}return r.set(e,t),this.size=r.size,this}var Cn=An;function Q(e){var t=this.__data__=new ne(e);this.size=t.size}Q.prototype.clear=yn;Q.prototype.delete=vn;Q.prototype.get=xn;Q.prototype.has=kn;Q.prototype.set=Cn;var Pn=Object.prototype,$l=Pn.propertyIsEnumerable,En=V(C,"DataView"),ge=En,Mn=V(C,"Promise"),me=Mn,Tn=V(C,"Set"),fe=Tn,Oe="[object Map]",jn="[object Object]",De="[object Promise]",$e="[object Set]",Re="[object WeakMap]",Fe="[object DataView]",_n=M(ge),Ln=M(K),Vn=M(me),On=M(fe),Dn=M(pe),_=Z;(ge&&_(new ge(new ArrayBuffer(1)))!=Fe||K&&_(new K)!=Oe||me&&_(me.resolve())!=De||fe&&_(new fe)!=$e||pe&&_(new pe)!=Re)&&(_=function(e){var t=Z(e),r=t==jn?e.constructor:void 0,i=r?M(r):"";if(i)switch(i){case _n:return Fe;case Ln:return Oe;case Vn:return De;case On:return $e;case Dn:return Re}return t});var Rl=C.Uint8Array,$n="__lodash_hash_undefined__";function Rn(e){return this.__data__.set(e,$n),this}var Fn=Rn;function Nn(e){return this.__data__.has(e)}var zn=Nn;function he(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Ze;++t<r;)this.add(e[t])}he.prototype.add=he.prototype.push=Fn;he.prototype.has=zn;var Ne=L?L.prototype:void 0,Fl=Ne?Ne.valueOf:void 0,Un=Object.prototype,Nl=Un.hasOwnProperty,Bn=Object.prototype,zl=Bn.hasOwnProperty,Ul=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),Bl=new RegExp(/[A-Fa-f0-9]{1}/,"g"),Gl=new RegExp(/[A-Fa-f0-9]{2}/,"g");function Gn(e){return e!==void 0}var Hn=Gn;function qn(e){return e?.version?e.version.localeCompare("1.59.0",void 0,{numeric:!0,sensitivity:"base"})>=0&&typeof e.i18n?.translate=="function":!1}function Kn(e){return typeof e?.translate=="function"}function ze(e,t,r){return e&&qn(e)&&Kn(e.i18n)?e.i18n.translate(t):r}function A(e,t){if(typeof e.i18n?.getTranslations!="function"){e.i18n.setTranslations(t);return}let r=Object.keys(t),i=e.i18n.getTranslations(r),n={};for(let o of r){let a=t[o];if(!a)continue;let s=i[o]??{},u={};for(let[d,l]of Object.entries(a))!(d in s)&&l!==void 0&&(u[d]=l);Object.keys(u).length>0&&(n[o]=u)}Object.keys(n).length>0&&e.i18n.setTranslations(n)}function Zn(e,t){let{cesdk:r}=t,i=t.propertyKey??"image_url",n=ye(e);return A(r,{en:{[`panel.${n}`]:"Select Image To Change","ly.img.ai.imageSelection.selectImage.label":"Select Image","ly.img.ai.imageSelection.error.svg":"SVG images are not supported. Please choose a different image.","ly.img.ai.imageSelection.error.invalidType":"Only images are supported. Found '{mimeType}'. Please choose a different image."}}),Qn(e,r),{[i]:(o,a)=>{let{builder:s,experimental:{global:u},payload:d}=o,l,c=o.providerConfig,w=o.config,x=c?.properties?.[a.id]??w?.properties?.[a.id];x?.default&&(typeof x.default=="function"?l=x.default({}):l=x.default);let j=l??d?.url??t.defaultUrl,S=u(`${e}.${a.id}`,j);return s.MediaPreview(a.id,{preview:{type:"image",uri:S.value},action:{label:"ly.img.ai.imageSelection.selectImage.label",onClick:()=>{r?.ui.openPanel(n,{payload:{onSelect:re=>{re.meta?.uri!=null&&S.setValue(re.meta?.uri)}}})}}}),()=>({id:a.id,type:"string",value:S.value})}}}function Qn(e,t){t?.ui.registerPanel(ye(e),({builder:r,payload:i})=>{r.Library(`${e}.library.image`,{entries:["ly.img.image"],onSelect:async n=>{let o=n?.meta?.uri;if(o==null)return;let a=await t.engine.editor.getMimeType(o);a==="image/svg+xml"?t.ui.showNotification({type:"warning",message:"ly.img.ai.imageSelection.error.svg"}):a.startsWith("image/")?(i?.onSelect(n),t?.ui.closePanel(ye(e))):t.ui.showNotification({type:"warning",message:"ly.img.ai.imageSelection.error.invalidType"})}})})}function ye(e){return`ly.img.ai.${e}.imageSelection`}var Yn=Zn;function Wn(e,t){let{cesdk:r}=t;if(r==null)return{};let i=t.propertyKey??"style",n=Xn(e);A(r,{en:{[`panel.${n}`]:"Select Style",[`${e}.${i}`]:"Style","ly.img.ai.styleTransfer.none":"None","ly.img.ai.styleTransfer.anime":"Anime","ly.img.ai.styleTransfer.cyberpunk":"Cyberpunk","ly.img.ai.styleTransfer.kodak400":"Kodak 400","ly.img.ai.styleTransfer.watercolor":"Watercolor","ly.img.ai.styleTransfer.darkFantasy":"Dark Fantasy","ly.img.ai.styleTransfer.vaporwave":"Vaporwave","ly.img.ai.styleTransfer.vectorFlat":"Vector Flat","ly.img.ai.styleTransfer.3dAnimation":"3D Animation","ly.img.ai.styleTransfer.ukiyoe":"Ukiyo\u2011e","ly.img.ai.styleTransfer.surreal":"Surreal","ly.img.ai.styleTransfer.steampunk":"Steampunk","ly.img.ai.styleTransfer.nightBokeh":"Night Bokeh","ly.img.ai.styleTransfer.popArt":"Pop Art"}});let o=to({baseURL:t.baseURL??"https://cdn.img.ly/assets/plugins/plugin-ai-image-generation-web/v1/gpt-image-1/",includeNone:!0,cesdk:r}),a=o;t.styles!=null&&(Array.isArray(t.styles)?a=t.styles:typeof t.styles=="function"&&(a=t.styles(o)));let s=ro({cesdk:r,providerId:e,styles:a}),u=s.id;return io(s,{cesdk:r}),Jn({providerId:e,cesdk:r,panelId:n,entryId:u}),{[t.propertyKeyForPrompt??"prompt"]:(d,l)=>{let c=d.state("prompt","");return d.builder.TextArea(`${l.id}`,{inputLabel:t.i18n?.prompt?.inputLabel??t.propertyKeyForPrompt??"prompt",placeholder:t.i18n?.prompt?.placeholder,...c}),()=>{let[w]=s.getActiveAssetIds(),x=s.getAsset(w);return{id:l.id,type:"string",value:x?.meta?.prompt==null?c.value:`${c.value}; ${x.meta.prompt}`}}},[i]:(d,l)=>{let{builder:c,state:w}=d;if(a.length>0){let x=w("style",a[0]);return c.Button(`${l.id}`,{inputLabel:`${e}.${l.id}`,icon:"@imgly/Appearance",isDisabled:a.length===0,trailingIcon:"@imgly/ChevronRight",label:x.value.label,labelAlignment:"left",onClick:()=>{let j={onSelect:async S=>{s.clearActiveAssets(),s.setAssetActive(S.id),x.setValue({id:S.id,label:S.label??S.id}),r.ui.closePanel(n)}};r.ui.openPanel(n,{payload:j})}}),()=>({id:l.id,type:"string",value:x.value.id})}return()=>({id:l.id,type:"string",value:"none"})}}}function Jn(e){let{providerId:t,cesdk:r,panelId:i,entryId:n}=e;r?.ui.registerPanel(i,({builder:o,payload:a})=>{a?.onSelect==null&&o.Section(`${t}.error`,{children:()=>{o.Text("error",{content:"No onSelect function provided for the style selection panel."})}}),o.Library(`${t}.library.image`,{entries:[n],onSelect:async s=>{a?.onSelect?.(s)}})})}function Xn(e){return`ly.img.ai.${e}.styleSelection`}var eo=[{id:"none",labelKey:"ly.img.ai.styleTransfer.none",prompt:""},{id:"anime-celshaded",labelKey:"ly.img.ai.styleTransfer.anime",prompt:"anime cel\u2011shaded, bright pastel palette, expressive eyes, clean line art "},{id:"cyberpunk-neon",labelKey:"ly.img.ai.styleTransfer.cyberpunk",prompt:"cyberpunk cityscape, glowing neon signage, reflective puddles, dark atmosphere"},{id:"kodak-portra-400",labelKey:"ly.img.ai.styleTransfer.kodak400",prompt:"shot on Kodak Portra 400, soft grain, golden\u2011hour warmth, 35 mm photo"},{id:"watercolor-storybook",labelKey:"ly.img.ai.styleTransfer.watercolor",prompt:"loose watercolor washes, gentle gradients, dreamy storybook feel"},{id:"dark-fantasy-realism",labelKey:"ly.img.ai.styleTransfer.darkFantasy",prompt:"dark fantasy realm, moody chiaroscuro lighting, hyper\u2011real textures"},{id:"vaporwave-retrofuturism",labelKey:"ly.img.ai.styleTransfer.vaporwave",prompt:"retro\u2011futuristic vaporwave, pastel sunset gradient, chrome text, VHS scanlines"},{id:"minimal-vector-flat",labelKey:"ly.img.ai.styleTransfer.vectorFlat",prompt:"minimalist flat vector illustration, bold geometry, two\u2011tone palette"},{id:"pixarstyle-3d-render",labelKey:"ly.img.ai.styleTransfer.3dAnimation",prompt:"Pixar\u2011style 3D render, oversized eyes, subtle subsurface scattering, cinematic lighting"},{id:"ukiyoe-woodblock",labelKey:"ly.img.ai.styleTransfer.ukiyoe",prompt:"ukiyo\u2011e woodblock print, Edo\u2011period style, visible washi texture, limited color ink"},{id:"surreal-dreamscape",labelKey:"ly.img.ai.styleTransfer.surreal",prompt:"surreal dreamscape, floating objects, impossible architecture, vivid clouds"},{id:"steampunk-victorian",labelKey:"ly.img.ai.styleTransfer.steampunk",prompt:"Victorian steampunk world, ornate brass gears, leather attire, atmospheric fog"},{id:"nightstreet-photo-bokeh",labelKey:"ly.img.ai.styleTransfer.nightBokeh",prompt:"night\u2011time street shot, large aperture bokeh lights, candid urban mood"},{id:"comicbook-pop-art",labelKey:"ly.img.ai.styleTransfer.popArt",prompt:"classic comic\u2011book panel, halftone shading, exaggerated action lines, CMYK pop colors"}];function to(e){return eo.map(t=>t.id==="none"?e.includeNone?{id:t.id,label:ze(e.cesdk,t.labelKey,t.labelKey),prompt:t.prompt,thumbUri:`${e.baseURL}/thumbnails/None.svg`}:void 0:{id:t.id,label:ze(e.cesdk,t.labelKey,t.labelKey),prompt:t.prompt,thumbUri:`${e.baseURL}/thumbnails/${t.id}.jpeg`}).filter(Hn)}var ro=e=>{let t=e.styles.map(a=>({...a,meta:{prompt:a.prompt}})),r=e.cesdk.engine.asset.findAllSources(),i=`${e.providerId}/styles`;for(;r.includes(i);)i+=`-${Math.random().toString(36).substring(2,5)}`;let n=new qt(i,t),o=e.styles[0];return n.setAssetActive(o.id),n},io=(e,t)=>{t.cesdk.engine.asset.addSource(e),t.cesdk.ui.addAssetLibraryEntry({id:e.id,sourceIds:[e.id],gridItemHeight:"square",gridBackgroundType:"cover",cardLabel:({label:r})=>r,cardLabelPosition:()=>"below"})},no=Wn;var oo="ly.img.ai";function k(e){return`${oo}.${e}`}function y(e,t,r){let i=`${t}.iconSetAdded`;e.ui.experimental.hasGlobalStateValue(i)||(e.ui.addIconSet(t,r),e.ui.experimental.setGlobalStateValue(i,!0))}function Qe(e,t){let r={...e};if(!t)return r;for(let[i,n]of Object.entries(t))n===!1||n===null||n===void 0?delete r[i]:n===!0?i in e||(r[i]=!0):r[i]=n;return r}var ce="@imgly/plugin-ai-generation",Hl=`
<svg>
<symbol
fill="none"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
id="@imgly/Sparkle"
>
<path d="M5.35545 2.06745C5.24149 1.72556 4.7579 1.72556 4.64394 2.06745L4.05898 3.82232C4.02166 3.93429 3.9338 4.02215 3.82184 4.05948L2.06694 4.64459C1.72506 4.75858 1.72509 5.24217 2.06699 5.3561L3.82179 5.9409C3.93378 5.97822 4.02166 6.06609 4.05899 6.17808L4.64394 7.93291C4.7579 8.2748 5.24149 8.2748 5.35545 7.93291L5.9404 6.17806C5.97773 6.06608 6.06559 5.97821 6.17757 5.94089L7.93242 5.35594C8.27431 5.24198 8.27431 4.75839 7.93242 4.64442L6.17757 4.05947C6.06559 4.02215 5.97773 3.93428 5.9404 3.8223L5.35545 2.06745Z" fill="currentColor"/>
<path d="M17.9632 3.23614C17.8026 2.80788 17.1968 2.80788 17.0362 3.23614L16.0787 5.78951C16.0285 5.92337 15.9229 6.02899 15.789 6.07918L13.2356 7.0367C12.8074 7.19729 12.8074 7.80307 13.2356 7.96366L15.789 8.92118C15.9229 8.97138 16.0285 9.077 16.0787 9.21085L17.0362 11.7642C17.1968 12.1925 17.8026 12.1925 17.9632 11.7642L18.9207 9.21086C18.9709 9.077 19.0765 8.97138 19.2104 8.92118L21.7637 7.96366C22.192 7.80307 22.192 7.1973 21.7637 7.0367L19.2104 6.07918C19.0765 6.02899 18.9709 5.92337 18.9207 5.78951L17.9632 3.23614Z" fill="currentColor"/>
<path d="M9.30058 7.82012C9.54712 7.1791 10.454 7.1791 10.7006 7.82012L12.3809 12.189C12.4571 12.3871 12.6136 12.5436 12.8117 12.6198L17.1806 14.3001C17.8216 14.5466 17.8216 15.4536 17.1806 15.7001L12.8117 17.3804C12.6136 17.4566 12.4571 17.6131 12.3809 17.8112L10.7006 22.1801C10.454 22.8211 9.54712 22.8211 9.30058 22.1801L7.62024 17.8112C7.54406 17.6131 7.38754 17.4566 7.18947 17.3804L2.82061 15.7001C2.17959 15.4536 2.17959 14.5466 2.82061 14.3001L7.18947 12.6198C7.38754 12.5436 7.54406 12.3871 7.62024 12.189L9.30058 7.82012Z" fill="currentColor"/>
</symbol>
<symbol
fill="none"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
id="${ce}/image"
>
<path d="M3 16.5V18C3 19.6569 4.34315 21 6 21H18C19.6569 21 21 19.6569 21 18V6C21 4.34315 19.6569 3 18 3L17.999 5C18.5513 5 19 5.44772 19 6V18C19 18.5523 18.5523 19 18 19H6C5.44772 19 5 18.5523 5 18V16.5H3Z" fill="currentColor"/>
<path d="M13.0982 0.884877C12.9734 0.568323 12.5254 0.568322 12.4005 0.884876L11.7485 2.53819C11.7104 2.63483 11.6339 2.71134 11.5372 2.74945L9.8839 3.40151C9.56735 3.52636 9.56734 3.97436 9.8839 4.09921L11.5372 4.75126C11.6339 4.78938 11.7104 4.86588 11.7485 4.96253L12.4005 6.61584C12.5254 6.93239 12.9734 6.9324 13.0982 6.61584L13.7503 4.96253C13.7884 4.86588 13.8649 4.78938 13.9616 4.75126L15.6149 4.09921C15.9314 3.97436 15.9314 3.52636 15.6149 3.40151L13.9616 2.74945C13.8649 2.71134 13.7884 2.63483 13.7503 2.53819L13.0982 0.884877Z" fill="currentColor"/>
<path d="M6.40053 5.38488C6.52538 5.06832 6.97338 5.06832 7.09823 5.38488L8.17455 8.11392C8.21267 8.21057 8.28917 8.28707 8.38582 8.32519L11.1149 9.40151C11.4314 9.52636 11.4314 9.97436 11.1149 10.0992L8.38582 11.1755C8.28917 11.2136 8.21267 11.2901 8.17455 11.3868L7.09823 14.1158C6.97338 14.4324 6.52538 14.4324 6.40053 14.1158L5.32421 11.3868C5.2861 11.2901 5.20959 11.2136 5.11295 11.1755L2.3839 10.0992C2.06735 9.97436 2.06735 9.52636 2.3839 9.40151L5.11295 8.32519C5.20959 8.28707 5.2861 8.21057 5.32421 8.11392L6.40053 5.38488Z" fill="currentColor"/>
<path d="M18.9994 16.5008V18.0004C18.9994 18.5526 18.5517 19.0004 17.9994 19.0004H9.33302L14.3753 11.4369C14.6722 10.9916 15.3266 10.9916 15.6234 11.4369L18.9994 16.5008Z" fill="currentColor"/>
</symbol>
<symbol
fill="none"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
id="${ce}/video"
>
<path d="M6 3C4.34315 3 3 4.34315 3 6V18C3 19.6569 4.34315 21 6 21H18C19.6569 21 21 19.6569 21 18V16.5H19V18C19 18.5523 18.5523 19 18 19H6C5.44772 19 5 18.5523 5 18V6C5 5.44772 5.44772 5 6 5V3Z" fill="currentColor"/>
<path d="M10.9025 0.8839C11.0273 0.567345 11.4753 0.567346 11.6002 0.883901L12.2522 2.53721C12.2904 2.63386 12.3669 2.71036 12.4635 2.74848L14.1168 3.40053C14.4334 3.52538 14.4334 3.97338 14.1168 4.09823L12.4635 4.75029C12.3669 4.7884 12.2904 4.86491 12.2522 4.96155L11.6002 6.61486C11.4753 6.93142 11.0273 6.93142 10.9025 6.61486L10.2504 4.96155C10.2123 4.86491 10.1358 4.7884 10.0392 4.75029L8.38585 4.09823C8.0693 3.97338 8.0693 3.52538 8.38585 3.40053L10.0392 2.74848C10.1358 2.71036 10.2123 2.63386 10.2504 2.53721L10.9025 0.8839Z" fill="currentColor"/>
<path d="M18.9019 3.3845C19.0267 3.06795 19.4747 3.06795 19.5996 3.3845L20.6759 6.11355C20.714 6.2102 20.7905 6.2867 20.8872 6.32482L23.6162 7.40114C23.9328 7.52598 23.9328 7.97399 23.6162 8.09883L20.8872 9.17515C20.7905 9.21327 20.714 9.28977 20.6759 9.38642L19.5996 12.1155C19.4747 12.432 19.0267 12.432 18.9019 12.1155L17.8255 9.38642C17.7874 9.28977 17.7109 9.21327 17.6143 9.17515L14.8852 8.09883C14.5687 7.97399 14.5687 7.52598 14.8852 7.40114L17.6143 6.32482C17.7109 6.2867 17.7874 6.2102 17.8255 6.11355L18.9019 3.3845Z" fill="currentColor"/>
<path d="M14.9994 13.2862C15.5089 12.8859 15.5089 12.1141 14.9995 11.7137L10.618 8.27047C9.96188 7.75485 9.00011 8.22225 9.00011 9.05673L9.00011 15.9429C9.00011 16.7773 9.96185 17.2448 10.618 16.7292L14.9994 13.2862Z" fill="currentColor"/>
</symbol>
<symbol
fill="none"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
id="${ce}/audio"
>
<path d="M6 3.80273C4.2066 4.84016 3 6.77919 3 9.00004V12.8153C3 15.931 5.39501 18.4873 8.44444 18.7436V20.9645C8.44444 22.2198 9.89427 22.9198 10.8773 22.1392L15.1265 18.7647H15.5C17.8285 18.7647 19.8472 17.4384 20.8417 15.5H18.4187C17.6889 16.2784 16.6512 16.7647 15.5 16.7647H14.9522C14.6134 16.7647 14.2846 16.8794 14.0193 17.0901L10.4444 19.929V18.2597C10.4444 17.4341 9.77513 16.7647 8.9495 16.7647C7.80494 16.7647 6.77409 16.2779 6.05276 15.5H6V15.4419C5.37798 14.7439 5 13.8237 5 12.8153V9.00004C5 7.98559 5.37764 7.05935 6 6.35422V3.80273Z" fill="currentColor"/>
<path d="M11.6002 1.8839C11.4753 1.56735 11.0273 1.56735 10.9025 1.8839L10.2504 3.53721C10.2123 3.63386 10.1358 3.71036 10.0392 3.74848L8.38585 4.40053C8.0693 4.52538 8.0693 4.97338 8.38585 5.09823L10.0392 5.75029C10.1358 5.7884 10.2123 5.86491 10.2504 5.96155L10.9025 7.61486C11.0273 7.93142 11.4753 7.93142 11.6002 7.61486L12.2522 5.96155C12.2904 5.86491 12.3669 5.7884 12.4635 5.75029L14.1168 5.09823C14.4334 4.97338 14.4334 4.52538 14.1168 4.40053L12.4635 3.74848C12.3669 3.71036 12.2904 3.63386 12.2522 3.53721L11.6002 1.8839Z" fill="currentColor"/>
<path d="M19.5996 4.3845C19.4747 4.06795 19.0267 4.06795 18.9019 4.3845L17.8255 7.11355C17.7874 7.2102 17.7109 7.2867 17.6143 7.32482L14.8852 8.40114C14.5687 8.52598 14.5687 8.97399 14.8852 9.09883L17.6143 10.1752C17.7109 10.2133 17.7874 10.2898 17.8255 10.3864L18.9019 13.1155C19.0267 13.432 19.4747 13.432 19.5996 13.1155L20.6759 10.3864C20.714 10.2898 20.7905 10.2133 20.8872 10.1752L23.6162 9.09883C23.9328 8.97399 23.9328 8.52598 23.6162 8.40114L20.8872 7.32482C20.7905 7.2867 20.714 7.2102 20.6759 7.11355L19.5996 4.3845Z" fill="currentColor"/>
</symbol>
<symbol
fill="none"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
id="@imgly/MixingPlate"
>
<path d="M9.75 9C10.5784 9 11.25 8.32843 11.25 7.5C11.25 6.67157 10.5784 6 9.75 6C8.92157 6 8.25 6.67157 8.25 7.5C8.25 8.32843 8.92157 9 9.75 9Z" fill="currentColor"/>
<path d="M7 13C7.82843 13 8.5 12.3284 8.5 11.5C8.5 10.6716 7.82843 10 7 10C6.17157 10 5.5 10.6716 5.5 11.5C5.5 12.3284 6.17157 13 7 13Z" fill="currentColor"/>
<path d="M15.75 7.5C15.75 8.32843 15.0784 9 14.25 9C13.4216 9 12.75 8.32843 12.75 7.5C12.75 6.67157 13.4216 6 14.25 6C15.0784 6 15.75 6.67157 15.75 7.5Z" fill="currentColor"/>
<path d="M17 13C17.8284 13 18.5 12.3284 18.5 11.5C18.5 10.6716 17.8284 10 17 10C16.1716 10 15.5 10.6716 15.5 11.5C15.5 12.3284 16.1716 13 17 13Z" fill="currentColor"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.26309 2.77709C10.6681 1.77921 13.4829 1.7322 15.9209 2.64297C18.1572 3.47923 20.0876 5.09285 21.1766 7.28598C22.3395 9.62772 22.4889 13.1077 20.3864 15.2982C19.2693 16.4621 17.7657 16.9982 16.0026 16.9997C15.7897 16.9997 15.5555 16.9864 15.3497 16.9745C15.309 16.9722 15.2694 16.9699 15.2313 16.9679C14.9817 16.9542 14.761 16.9455 14.5569 16.9539C14.124 16.9718 13.9598 17.0612 13.89 17.1324C13.718 17.3081 13.6946 17.6672 13.8854 17.8895C14.2899 18.3608 14.5016 18.9277 14.5016 19.5497C14.5016 20.2206 14.3086 20.9011 13.7542 21.3896C13.2471 21.837 12.6082 21.9997 11.9635 21.9997C10.6049 21.9997 9.31155 21.7367 8.0934 21.2067C6.89058 20.6831 5.84501 19.9687 4.94363 19.0666C4.04281 18.1651 3.31836 17.107 2.79369 15.8978C1.72761 13.4409 1.72662 10.5261 2.81247 8.07034C3.88024 5.65548 5.84206 3.78161 8.26309 2.77709ZM15.2207 4.51639C13.2556 3.78239 10.9651 3.82132 9.02956 4.62439C7.06888 5.43791 5.49559 6.94785 4.64163 8.87914C3.78373 10.8194 3.78253 13.1522 4.62841 15.1017C5.05312 16.0805 5.63511 16.9291 6.35838 17.6529C7.08102 18.3761 7.91671 18.9484 8.89123 19.3728C9.8492 19.7895 10.87 19.9997 11.9635 19.9997C12.2815 19.9997 12.394 19.9225 12.431 19.8899L12.4319 19.8891C12.4367 19.8849 12.4487 19.8743 12.4631 19.8359C12.4799 19.7911 12.5016 19.7024 12.5016 19.5497C12.5016 19.4091 12.4633 19.3034 12.3677 19.192C11.5353 18.222 11.5272 16.6868 12.4611 15.7331C13.0741 15.1071 13.8844 14.98 14.4745 14.9556C14.7819 14.943 15.085 14.9568 15.3409 14.9709C15.3906 14.9736 15.4379 14.9763 15.4832 14.9788C15.6876 14.9904 15.8508 14.9997 16.0009 14.9997C17.3405 14.9986 18.2792 14.6054 18.9435 13.9133C20.2633 12.5382 20.3186 10.055 19.3853 8.1755C18.5436 6.48051 17.0293 5.19281 15.2207 4.51639Z" fill="currentColor"/>
</symbol>
</svg>
`;var Ye={ImageUrl:Yn,StyleTransfer:no};var ao=`
<svg>
<symbol
fill="none"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
id="@imgly/plugin/formats/ratioFree"
>
<path d="M7 6C6.44772 6 6 6.44772 6 7V9.22222H4V7C4 5.34315 5.34315 4 7 4H9.22222V6H7Z" fill="currentColor"/>
<path d="M17 6H14.7778V4H17C18.6569 4 20 5.34315 20 7V9.22222H18V7C18 6.44772 17.5523 6 17 6Z" fill="currentColor"/>
<path d="M6 14.7778V17C6 17.5523 6.44772 18 7 18H9.22222V20H7C5.34315 20 4 18.6569 4 17V14.7778H6Z" fill="currentColor"/>
<path d="M18 17V14.7778H20V17C20 18.6569 18.6569 20 17 20H14.7778V18H17C17.5523 18 18 17.5523 18 17Z" fill="currentColor"/>
</symbol>
<symbol
fill="none"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
id="@imgly/plugin/formats/ratio4by3"
>
<path d="M6.5 13H8V15H10V16.5H6.5V13Z" fill="currentColor"/>
<path d="M14 9V7.5H17.5V11H16V9H14Z" fill="currentColor"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 4C4.34315 4 3 5.34315 3 7V17C3 18.6569 4.34315 20 6 20H18C19.6569 20 21 18.6569 21 17V7C21 5.34315 19.6569 4 18 4H6ZM5 7C5 6.44772 5.44772 6 6 6H18C18.5523 6 19 6.44772 19 7V17C19 17.5523 18.5523 18 18 18H6C5.44772 18 5 17.5523 5 17V7Z" fill="currentColor"/>
</symbol>
<symbol
fill="none"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
id="@imgly/plugin/formats/ratio16by9"
>
<path d="M4.5 13H6V15H8V16.5H4.5V13Z" fill="currentColor"/>
<path d="M16 9V7.5H19.5V11H18V9H16Z" fill="currentColor"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 4C2.34315 4 1 5.34315 1 7V17C1 18.6569 2.34315 20 4 20H20C21.6569 20 23 18.6569 23 17V7C23 5.34315 21.6569 4 20 4H4ZM3 7C3 6.44772 3.44772 6 4 6H20C20.5523 6 21 6.44772 21 7V17C21 17.5523 20.5523 18 20 18H4C3.44772 18 3 17.5523 3 17V7Z" fill="currentColor"/>
</symbol>
<symbol
fill="none"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
id="@imgly/plugin/formats/ratio9by16"
>
<path d="M7.5 16H9V18H11V19.5H7.5V16Z" fill="currentColor"/>
<path d="M13 6V4.5H16.5V8H15V6H13Z" fill="currentColor"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 20C4 21.6569 5.34315 23 7 23H17C18.6569 23 20 21.6569 20 20V4C20 2.34315 18.6569 1 17 1H7C5.34315 1 4 2.34315 4 4V20ZM7 21C6.44772 21 6 20.5523 6 20V4C6 3.44772 6.44772 3 7 3H17C17.5523 3 18 3.44772 18 4V20C18 20.5523 17.5523 21 17 21H7Z" fill="currentColor"/>
</symbol>
<symbol
fill="none"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
id="@imgly/plugin/formats/ratio3by4"
>
<path d="M11 17.5V16H9V14H7.5V17.5H11Z" fill="currentColor"/>
<path d="M15 10H16.5V6.5H13V8H15V10Z" fill="currentColor"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M20 18C20 19.6569 18.6569 21 17 21H7C5.34315 21 4 19.6569 4 18V6C4 4.34315 5.34315 3 7 3H17C18.6569 3 20 4.34315 20 6V18ZM17 19C17.5523 19 18 18.5523 18 18V6C18 5.44772 17.5523 5 17 5H7C6.44771 5 6 5.44771 6 6V18C6 18.5523 6.44772 19 7 19H17Z" fill="currentColor"/>
</symbol>
<symbol
fill="none"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
id="@imgly/plugin/formats/ratio1by1"
>
<path d="M17.4142 8.00009L16 6.58587L14.2929 8.29298L15.7071 9.70719L17.4142 8.00009Z" fill="currentColor"/>
<path d="M13.0404 12.3739L15.0404 10.3739L13.6262 8.95965L11.6262 10.9596L13.0404 12.3739Z" fill="currentColor"/>
<path d="M10.3737 15.0405L12.3737 13.0405L10.9595 11.6263L8.95953 13.6263L10.3737 15.0405Z" fill="currentColor"/>
<path d="M9.70708 15.7072L8.29286 14.293L6.58576 16.0001L7.99997 17.4143L9.70708 15.7072Z" fill="currentColor"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M7 4C5.34315 4 4 5.34315 4 7V17C4 18.6569 5.34315 20 7 20H17C18.6569 20 20 18.6569 20 17V7C20 5.34315 18.6569 4 17 4H7ZM6 7C6 6.44772 6.44772 6 7 6H17C17.5523 6 18 6.44772 18 7V17C18 17.5523 17.5523 18 17 18H7C6.44772 18 6 17.5523 6 17V7Z" fill="currentColor"/>
</symbol>
</svg>
`;var so=typeof global=="object"&&global&&global.Object===Object&&global,ct=so,lo=typeof self=="object"&&self&&self.Object===Object&&self,uo=ct||lo||Function("return this")(),P=uo,co=P.Symbol,F=co,pt=Object.prototype,po=pt.hasOwnProperty,go=pt.toString,Y=F?F.toStringTag:void 0;function mo(e){var t=po.call(e,Y),r=e[Y];try{e[Y]=void 0;var i=!0}catch{}var n=go.call(e);return i&&(t?e[Y]=r:delete e[Y]),n}var fo=mo,ho=Object.prototype,yo=ho.toString;function bo(e){return yo.call(e)}var vo=bo,wo="[object Null]",xo="[object Undefined]",We=F?F.toStringTag:void 0;function Io(e){return e==null?e===void 0?xo:wo:We&&We in Object(e)?fo(e):vo(e)}var ee=Io;function ko(e){return e!=null&&typeof e=="object"}var Ce=ko,Zl=Array.isArray;function So(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var gt=So,Ao="[object AsyncFunction]",Co="[object Function]",Po="[object GeneratorFunction]",Eo="[object Proxy]";function Mo(e){if(!gt(e))return!1;var t=ee(e);return t==Co||t==Po||t==Ao||t==Eo}var To=Mo,jo=P["__core-js_shared__"],ve=jo,Je=function(){var e=/[^.]+$/.exec(ve&&ve.keys&&ve.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function _o(e){return!!Je&&Je in e}var Lo=_o,Vo=Function.prototype,Oo=Vo.toString;function Do(e){if(e!=null){try{return Oo.call(e)}catch{}try{return e+""}catch{}}return""}var T=Do,$o=/[\\^$.*+?()[\]{}|]/g,Ro=/^\[object .+?Constructor\]$/,Fo=Function.prototype,No=Object.prototype,zo=Fo.toString,Uo=No.hasOwnProperty,Bo=RegExp("^"+zo.call(Uo).replace($o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Go(e){if(!gt(e)||Lo(e))return!1;var t=To(e)?Bo:Ro;return t.test(T(e))}var Ho=Go;function qo(e,t){return e?.[t]}var Ko=qo;function Zo(e,t){var r=Ko(e,t);return Ho(r)?r:void 0}var N=Zo,Qo=N(P,"WeakMap"),xe=Qo;function Yo(e,t){return e===t||e!==e&&t!==t}var Wo=Yo,Jo=9007199254740991;function Xo(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Jo}var ea=Xo;var Ql=Object.prototype;var ta="[object Arguments]";function ra(e){return Ce(e)&&ee(e)==ta}var Xe=ra,mt=Object.prototype,ia=mt.hasOwnProperty,na=mt.propertyIsEnumerable,Yl=Xe(function(){return arguments}())?Xe:function(e){return Ce(e)&&ia.call(e,"callee")&&!na.call(e,"callee")};var ft=typeof exports=="object"&&exports&&!exports.nodeType&&exports,et=ft&&typeof module=="object"&&module&&!module.nodeType&&module,oa=et&&et.exports===ft,tt=oa?P.Buffer:void 0,Wl=tt?tt.isBuffer:void 0;var aa="[object Arguments]",sa="[object Array]",la="[object Boolean]",ua="[object Date]",da="[object Error]",ca="[object Function]",pa="[object Map]",ga="[object Number]",ma="[object Object]",fa="[object RegExp]",ha="[object Set]",ya="[object String]",ba="[object WeakMap]",va="[object ArrayBuffer]",wa="[object DataView]",xa="[object Float32Array]",Ia="[object Float64Array]",ka="[object Int8Array]",Sa="[object Int16Array]",Aa="[object Int32Array]",Ca="[object Uint8Array]",Pa="[object Uint8ClampedArray]",Ea="[object Uint16Array]",Ma="[object Uint32Array]",m={};m[xa]=m[Ia]=m[ka]=m[Sa]=m[Aa]=m[Ca]=m[Pa]=m[Ea]=m[Ma]=!0;m[aa]=m[sa]=m[va]=m[la]=m[wa]=m[ua]=m[da]=m[ca]=m[pa]=m[ga]=m[ma]=m[fa]=m[ha]=m[ya]=m[ba]=!1;function Ta(e){return Ce(e)&&ea(e.length)&&!!m[ee(e)]}var ja=Ta;function _a(e){return function(t){return e(t)}}var La=_a,ht=typeof exports=="object"&&exports&&!exports.nodeType&&exports,W=ht&&typeof module=="object"&&module&&!module.nodeType&&module,Va=W&&W.exports===ht,we=Va&&ct.process,Oa=function(){try{var e=W&&W.require&&W.require("util").types;return e||we&&we.binding&&we.binding("util")}catch{}}(),rt=Oa,it=rt&&rt.isTypedArray,Jl=it?La(it):ja;var Da=Object.prototype,Xl=Da.hasOwnProperty;function $a(e,t){return function(r){return e(t(r))}}var Ra=$a,eu=Ra(Object.keys,Object);var Fa=Object.prototype,tu=Fa.hasOwnProperty;var Na=N(Object,"create"),J=Na;function za(){this.__data__=J?J(null):{},this.size=0}var Ua=za;function Ba(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Ga=Ba,Ha="__lodash_hash_undefined__",qa=Object.prototype,Ka=qa.hasOwnProperty;function Za(e){var t=this.__data__;if(J){var r=t[e];return r===Ha?void 0:r}return Ka.call(t,e)?t[e]:void 0}var Qa=Za,Ya=Object.prototype,Wa=Ya.hasOwnProperty;function Ja(e){var t=this.__data__;return J?t[e]!==void 0:Wa.call(t,e)}var Xa=Ja,es="__lodash_hash_undefined__";function ts(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=J&&t===void 0?es:t,this}var rs=ts;function z(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}z.prototype.clear=Ua;z.prototype.delete=Ga;z.prototype.get=Qa;z.prototype.has=Xa;z.prototype.set=rs;var nt=z;function is(){this.__data__=[],this.size=0}var ns=is;function os(e,t){for(var r=e.length;r--;)if(Wo(e[r][0],t))return r;return-1}var ae=os,as=Array.prototype,ss=as.splice;function ls(e){var t=this.__data__,r=ae(t,e);if(r<0)return!1;var i=t.length-1;return r==i?t.pop():ss.call(t,r,1),--this.size,!0}var us=ls;function ds(e){var t=this.__data__,r=ae(t,e);return r<0?void 0:t[r][1]}var cs=ds;function ps(e){return ae(this.__data__,e)>-1}var gs=ps;function ms(e,t){var r=this.__data__,i=ae(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}var fs=ms;function U(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}U.prototype.clear=ns;U.prototype.delete=us;U.prototype.get=cs;U.prototype.has=gs;U.prototype.set=fs;var se=U,hs=N(P,"Map"),X=hs;function ys(){this.size=0,this.__data__={hash:new nt,map:new(X||se),string:new nt}}var bs=ys;function vs(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var ws=vs;function xs(e,t){var r=e.__data__;return ws(t)?r[typeof t=="string"?"string":"hash"]:r.map}var le=xs;function Is(e){var t=le(this,e).delete(e);return this.size-=t?1:0,t}var ks=Is;function Ss(e){return le(this,e).get(e)}var As=Ss;function Cs(e){return le(this,e).has(e)}var Ps=Cs;function Es(e,t){var r=le(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}var Ms=Es;function B(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}B.prototype.clear=bs;B.prototype.delete=ks;B.prototype.get=As;B.prototype.has=Ps;B.prototype.set=Ms;var yt=B;function Ts(){this.__data__=new se,this.size=0}var js=Ts;function _s(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var Ls=_s;function Vs(e){return this.__data__.get(e)}var Os=Vs;function Ds(e){return this.__data__.has(e)}var $s=Ds,Rs=200;function Fs(e,t){var r=this.__data__;if(r instanceof se){var i=r.__data__;if(!X||i.length<Rs-1)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new yt(i)}return r.set(e,t),this.size=r.size,this}var Ns=Fs;function te(e){var t=this.__data__=new se(e);this.size=t.size}te.prototype.clear=js;te.prototype.delete=Ls;te.prototype.get=Os;te.prototype.has=$s;te.prototype.set=Ns;var zs=Object.prototype,ru=zs.propertyIsEnumerable;var Us=N(P,"DataView"),Ie=Us,Bs=N(P,"Promise"),ke=Bs,Gs=N(P,"Set"),Se=Gs,ot="[object Map]",Hs="[object Object]",at="[object Promise]",st="[object Set]",lt="[object WeakMap]",ut="[object DataView]",qs=T(Ie),Ks=T(X),Zs=T(ke),Qs=T(Se),Ys=T(xe),R=ee;(Ie&&R(new Ie(new ArrayBuffer(1)))!=ut||X&&R(new X)!=ot||ke&&R(ke.resolve())!=at||Se&&R(new Se)!=st||xe&&R(new xe)!=lt)&&(R=function(e){var t=ee(e),r=t==Hs?e.constructor:void 0,i=r?T(r):"";if(i)switch(i){case qs:return ut;case Ks:return ot;case Zs:return at;case Qs:return st;case Ys:return lt}return t});var iu=P.Uint8Array;var Ws="__lodash_hash_undefined__";function Js(e){return this.__data__.set(e,Ws),this}var Xs=Js;function el(e){return this.__data__.has(e)}var tl=el;function Ae(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new yt;++t<r;)this.add(e[t])}Ae.prototype.add=Ae.prototype.push=Xs;Ae.prototype.has=tl;var dt=F?F.prototype:void 0,nu=dt?dt.valueOf:void 0;var rl=Object.prototype,ou=rl.hasOwnProperty;var il=Object.prototype,au=il.hasOwnProperty;var su=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),lu=new RegExp(/[A-Fa-f0-9]{1}/,"g"),uu=new RegExp(/[A-Fa-f0-9]{2}/,"g");async function nl(e,t){if(e.startsWith("buffer:")){let r=await t.editor.getMimeType(e),i=t.editor.getBufferLength(e),n=t.editor.getBufferData(e,0,i),o=new Uint8Array(n),a=new Blob([o],{type:r});return URL.createObjectURL(a)}else return e}async function E(e,t){let r=await nl(e,t);return new Promise((i,n)=>{let o=new Image;o.onload=()=>{i({width:o.width,height:o.height})},o.onerror=n,o.src=r})}var b={Formats:ao};var bt={openapi:"3.0.0",info:{title:"Veo 3.1 API",version:"1.0.0",description:"Google Veo 3.1 video generation via Runware"},components:{schemas:{Veo31Text2VideoInput:{title:"Veo31Text2VideoInput",type:"object",properties:{prompt:{title:"Prompt",type:"string",description:"Text description for video generation",minLength:2,maxLength:3e3,"x-imgly-builder":{component:"TextArea"}},format:{title:"Format",type:"string",enum:["1280x720","720x1280","1920x1080","1080x1920"],default:"1280x720",description:"Output resolution and aspect ratio","x-imgly-enum-labels":{"1280x720":"Landscape HD (1280\xD7720)","720x1280":"Portrait HD (720\xD71280)","1920x1080":"Landscape Full HD (1920\xD71080)","1080x1920":"Portrait Full HD (1080\xD71920)"},"x-imgly-enum-icons":{"1280x720":"@imgly/plugin/formats/ratio16by9","720x1280":"@imgly/plugin/formats/ratio9by16","1920x1080":"@imgly/plugin/formats/ratio16by9","1080x1920":"@imgly/plugin/formats/ratio9by16"}},generate_audio:{title:"Generate Audio",type:"boolean",default:!0,description:"Generate native audio with the video"}},"x-fal-order-properties":["prompt","format","generate_audio"],required:["prompt"]}}},paths:{}};function al(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.floor(Math.random()*16);return(e==="x"?t:t&3|8).toString(16)})}function sl(e){return new Promise(t=>{setTimeout(t,e)})}function vt(e,t){async function r(i,n){let o=Date.now();for(;Date.now()-o<6e5;){if(n?.aborted)throw new Error("Video generation aborted");let a=[{taskType:"getResponse",taskUUID:i}],s=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...t},body:JSON.stringify(a),signal:n});if(!s.ok){let l=await s.text();throw new Error(`Runware API polling error: ${s.status} - ${l}`)}let u=await s.json();if(u.errors!=null&&u.errors.length>0){let l=u.errors[0];throw new Error(`Runware API error: ${l.errorMessage}`)}if(u.error!=null)throw new Error(`Runware API error: ${u.error.errorMessage??u.error}`);let d=u.data;if(d!=null&&Array.isArray(d)&&d.length>0){let l=d.find(c=>c.taskType==="videoInference"&&c.taskUUID===i);if(l!=null){if(l.status==="success"&&l.videoURL)return l;if(l.status==="failed")throw new Error(l.errorMessage??"Video generation failed")}}await sl(3e3)}throw new Error("Video generation timed out")}return{videoInference:async(i,n)=>{let o=al(),a=[{taskType:"videoInference",taskUUID:o,model:i.model,deliveryMethod:"async",...i.positivePrompt!=null&&{positivePrompt:i.positivePrompt},...i.width!=null&&{width:i.width},...i.height!=null&&{height:i.height},outputType:i.outputType??"URL",outputFormat:i.outputFormat??"MP4",numberResults:i.numberResults??1,...i.negativePrompt!=null&&{negativePrompt:i.negativePrompt},...i.duration!=null&&{duration:i.duration},...i.fps!=null&&{fps:i.fps},...i.seed!=null&&{seed:i.seed},...i.frameImages!=null&&{frameImages:i.frameImages},...i.providerSettings!=null&&{providerSettings:i.providerSettings}}],s=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...t},body:JSON.stringify(a),signal:n});if(!s.ok){let w=await s.text();throw new Error(`Runware API error: ${s.status} - ${w}`)}let u=await s.json();if(u.errors!=null&&u.errors.length>0){let w=u.errors[0];throw new Error(`Runware API error: ${w.errorMessage}`)}if(u.error!=null)throw new Error(`Runware API error: ${u.error.errorMessage??u.error}`);let d=u.data;if(d==null||!Array.isArray(d))throw new Error("Invalid response from Runware API: missing data array");if(d.find(w=>w.taskType==="videoInference"&&w.taskUUID===o)==null)throw new Error("Video generation task was not acknowledged");return[await r(o,n)]}}}async function xt(e,t){if(e!=null){if(e.startsWith("blob:")){let i=await(await fetch(e)).blob();return wt(i)}if(t!=null&&e.startsWith("buffer:")){let r=await t.engine.editor.getMimeType(e),i=t.engine.editor.getBufferLength(e),n=t.engine.editor.getBufferData(e,0,i),o=new Uint8Array(n),a=new Blob([o],{type:r});return wt(a)}return e}}function wt(e){return new Promise((t,r)=>{let i=new FileReader;i.onloadend=()=>t(i.result),i.onerror=r,i.readAsDataURL(e)})}function ll(e,t){let r=e.middleware??t.middlewares??t.middleware??[],i=null,n={id:e.providerId,kind:"video",name:e.name,configuration:t,initialize:async o=>{i=vt(t.proxyUrl,e.headers),e.initialize?.(o)},input:{quickActions:{supported:Qe(e.supportedQuickActions??{},t.supportedQuickActions)},panel:{type:"schema",document:e.schema,inputReference:e.inputReference,includeHistoryLibrary:!0,orderExtensionKeyword:"x-fal-order-properties",renderCustomProperty:{...e.cesdk!=null?Ye.ImageUrl(e.providerId,{cesdk:e.cesdk}):{},...e.renderCustomProperty},getBlockInput:e.getBlockInput,userFlow:e.useFlow??"placeholder"}},output:{abortable:!0,history:t.history??"@imgly/indexedDB",middleware:r,generate:async(o,{abortSignal:a})=>{if(!i)throw new Error("Provider not initialized");let s=o;if(o.image_url!=null){let l=await xt(o.image_url,e.cesdk);s={...o,image_url:l}}let u=e.mapInput(s),d=await i.videoInference({model:e.modelId,outputType:"URL",outputFormat:"MP4",numberResults:1,...u},a);if(d!=null&&Array.isArray(d)&&d.length>0){let c=d[0]?.videoURL;if(c!=null)return{kind:"video",url:c}}throw console.error("Cannot extract generated video from response:",d),new Error("Cannot find generated video")},generationHintText:"ly.img.ai.video.generation.hint"}};return t.debug&&console.log("Created Provider:",n),n}var v=ll;var ul={"1280x720":{width:1280,height:720},"720x1280":{width:720,height:1280},"1920x1080":{width:1920,height:1080},"1080x1920":{width:1080,height:1920}};function It(e){return ul[e]??{width:1280,height:720}}function kt(e){return async({cesdk:t})=>(y(t,"@imgly/plugin/formats",b.Formats),v({modelId:"google:3@2",providerId:"runware/google/veo-3.1",name:"Veo 3.1",schema:bt,inputReference:"#/components/schemas/Veo31Text2VideoInput",cesdk:t,middleware:e.middlewares??[],getBlockInput:async r=>{let i=It(r.format??"1280x720");return{video:{width:i.width,height:i.height,duration:8}}},mapInput:r=>{let i=It(r.format??"1280x720");return{positivePrompt:r.prompt,width:i.width,height:i.height,duration:8,fps:24,providerSettings:{google:{generateAudio:r.generate_audio??!0}}}}},e))}var St={openapi:"3.0.0",info:{title:"Veo 3.1 Image-to-Video API",version:"1.0.0",description:"Google Veo 3.1 image-to-video generation via Runware"},components:{schemas:{Veo31Image2VideoInput:{title:"Veo31Image2VideoInput",type:"object",properties:{image_url:{title:"Source Image",type:"string",description:"First frame image to animate","x-imgly-builder":{component:"ImageUrl"}},prompt:{title:"Prompt",type:"string",description:"Describe the motion and action for the video",minLength:2,maxLength:3e3,"x-imgly-builder":{component:"TextArea"}},format:{title:"Format",type:"string",enum:["1280x720","720x1280","1920x1080","1080x1920"],default:"1280x720",description:"Output resolution and aspect ratio","x-imgly-enum-labels":{"1280x720":"Landscape HD (1280\xD7720)","720x1280":"Portrait HD (720\xD71280)","1920x1080":"Landscape Full HD (1920\xD71080)","1080x1920":"Portrait Full HD (1080\xD71920)"},"x-imgly-enum-icons":{"1280x720":"@imgly/plugin/formats/ratio16by9","720x1280":"@imgly/plugin/formats/ratio9by16","1920x1080":"@imgly/plugin/formats/ratio16by9","1080x1920":"@imgly/plugin/formats/ratio9by16"}},generate_audio:{title:"Generate Audio",type:"boolean",default:!0,description:"Generate native audio with the video"}},"x-fal-order-properties":["image_url","prompt","format","generate_audio"],required:["image_url"]}}},paths:{}};var cl={"1280x720":{width:1280,height:720},"720x1280":{width:720,height:1280},"1920x1080":{width:1920,height:1080},"1080x1920":{width:1080,height:1920}};function At(e){return cl[e]??{width:1280,height:720}}function pl(e,t){return e>=t?"1280x720":"720x1280"}function Ct(e){return async({cesdk:t})=>{let r="runware/google/veo-3.1/image2video";return y(t,"@imgly/plugin/formats",b.Formats),A(t,{en:{[`panel.${k(r)}.imageSelection`]:"Select Image To Animate",[`libraries.${k(r)}.history.label`]:"Generated From Image"}}),v({modelId:"google:3@2",providerId:r,name:"Veo 3.1",schema:St,inputReference:"#/components/schemas/Veo31Image2VideoInput",cesdk:t,middleware:e.middlewares??[],supportedQuickActions:{"ly.img.createVideo":{mapInput:i=>({image_url:i.uri,prompt:i.prompt??""})}},getBlockInput:async i=>{let{width:n,height:o}=await E(i.image_url,t.engine),a=i.format??pl(n,o),s=At(a);return{video:{width:s.width,height:s.height,duration:8}}},mapInput:i=>{let n=At(i.format??"1280x720");return{positivePrompt:i.prompt??"",width:n.width,height:n.height,frameImages:[{inputImage:i.image_url,frame:"first"}],duration:8,fps:24,providerSettings:{google:{generateAudio:i.generate_audio??!0}