UNPKG

@imgly/plugin-ai-apps-web

Version:

AI apps orchestration plugin for the CE.SDK editor

68 lines (64 loc) 506 kB
var Ag=typeof global=="object"&&global&&global.Object===Object&&global,Ml=Ag,Mg=typeof self=="object"&&self&&self.Object===Object&&self,jg=Ml||Mg||Function("return this")(),B=jg,Sg=B.Symbol,De=Sg,jl=Object.prototype,_g=jl.hasOwnProperty,$g=jl.toString,sr=De?De.toStringTag:void 0;function Eg(e){var t=_g.call(e,sr),r=e[sr];try{e[sr]=void 0;var i=!0}catch{}var n=$g.call(e);return i&&(t?e[sr]=r:delete e[sr]),n}var Lg=Eg,Tg=Object.prototype,Og=Tg.toString;function Ng(e){return Og.call(e)}var Dg=Ng,Pg="[object Null]",zg="[object Undefined]",pl=De?De.toStringTag:void 0;function Ug(e){return e==null?e===void 0?zg:Pg:pl&&pl in Object(e)?Lg(e):Dg(e)}var pr=Ug;function Rg(e){return e!=null&&typeof e=="object"}var Bn=Rg,QQ=Array.isArray;function Fg(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Sl=Fg,Vg="[object AsyncFunction]",Bg="[object Function]",Gg="[object GeneratorFunction]",qg="[object Proxy]";function Yg(e){if(!Sl(e))return!1;var t=pr(e);return t==Bg||t==Gg||t==Vg||t==qg}var Hg=Yg,Zg=B["__core-js_shared__"],Dn=Zg,gl=function(){var e=/[^.]+$/.exec(Dn&&Dn.keys&&Dn.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Qg(e){return!!gl&&gl in e}var Wg=Qg,Kg=Function.prototype,Jg=Kg.toString;function Xg(e){if(e!=null){try{return Jg.call(e)}catch{}try{return e+""}catch{}}return""}var be=Xg,ey=/[\\^$.*+?()[\]{}|]/g,ty=/^\[object .+?Constructor\]$/,ry=Function.prototype,iy=Object.prototype,ny=ry.toString,oy=iy.hasOwnProperty,ay=RegExp("^"+ny.call(oy).replace(ey,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ly(e){if(!Sl(e)||Wg(e))return!1;var t=Hg(e)?ay:ty;return t.test(be(e))}var sy=ly;function uy(e,t){return e?.[t]}var cy=uy;function dy(e,t){var r=cy(e,t);return sy(r)?r:void 0}var Pe=dy,py=Pe(B,"WeakMap"),zn=py;function gy(e,t){return e===t||e!==e&&t!==t}var yy=gy,fy=9007199254740991;function my(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=fy}var hy=my;var WQ=Object.prototype;var by="[object Arguments]";function vy(e){return Bn(e)&&pr(e)==by}var yl=vy,_l=Object.prototype,wy=_l.hasOwnProperty,ky=_l.propertyIsEnumerable,KQ=yl(function(){return arguments}())?yl:function(e){return Bn(e)&&wy.call(e,"callee")&&!ky.call(e,"callee")};var $l=typeof exports=="object"&&exports&&!exports.nodeType&&exports,fl=$l&&typeof module=="object"&&module&&!module.nodeType&&module,xy=fl&&fl.exports===$l,ml=xy?B.Buffer:void 0,JQ=ml?ml.isBuffer:void 0;var Iy="[object Arguments]",Cy="[object Array]",Ay="[object Boolean]",My="[object Date]",jy="[object Error]",Sy="[object Function]",_y="[object Map]",$y="[object Number]",Ey="[object Object]",Ly="[object RegExp]",Ty="[object Set]",Oy="[object String]",Ny="[object WeakMap]",Dy="[object ArrayBuffer]",Py="[object DataView]",zy="[object Float32Array]",Uy="[object Float64Array]",Ry="[object Int8Array]",Fy="[object Int16Array]",Vy="[object Int32Array]",By="[object Uint8Array]",Gy="[object Uint8ClampedArray]",qy="[object Uint16Array]",Yy="[object Uint32Array]",M={};M[zy]=M[Uy]=M[Ry]=M[Fy]=M[Vy]=M[By]=M[Gy]=M[qy]=M[Yy]=!0;M[Iy]=M[Cy]=M[Dy]=M[Ay]=M[Py]=M[My]=M[jy]=M[Sy]=M[_y]=M[$y]=M[Ey]=M[Ly]=M[Ty]=M[Oy]=M[Ny]=!1;function Hy(e){return Bn(e)&&hy(e.length)&&!!M[pr(e)]}var Zy=Hy;function Qy(e){return function(t){return e(t)}}var Wy=Qy,El=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ur=El&&typeof module=="object"&&module&&!module.nodeType&&module,Ky=ur&&ur.exports===El,Pn=Ky&&Ml.process,Jy=function(){try{var e=ur&&ur.require&&ur.require("util").types;return e||Pn&&Pn.binding&&Pn.binding("util")}catch{}}(),hl=Jy,bl=hl&&hl.isTypedArray,XQ=bl?Wy(bl):Zy;var Xy=Object.prototype,eW=Xy.hasOwnProperty;function ef(e,t){return function(r){return e(t(r))}}var tf=ef,tW=tf(Object.keys,Object);var rf=Object.prototype,rW=rf.hasOwnProperty;var nf=Pe(Object,"create"),cr=nf;function of(){this.__data__=cr?cr(null):{},this.size=0}var af=of;function lf(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var sf=lf,uf="__lodash_hash_undefined__",cf=Object.prototype,df=cf.hasOwnProperty;function pf(e){var t=this.__data__;if(cr){var r=t[e];return r===uf?void 0:r}return df.call(t,e)?t[e]:void 0}var gf=pf,yf=Object.prototype,ff=yf.hasOwnProperty;function mf(e){var t=this.__data__;return cr?t[e]!==void 0:ff.call(t,e)}var hf=mf,bf="__lodash_hash_undefined__";function vf(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=cr&&t===void 0?bf:t,this}var wf=vf;function ze(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])}}ze.prototype.clear=af;ze.prototype.delete=sf;ze.prototype.get=gf;ze.prototype.has=hf;ze.prototype.set=wf;var vl=ze;function kf(){this.__data__=[],this.size=0}var xf=kf;function If(e,t){for(var r=e.length;r--;)if(yy(e[r][0],t))return r;return-1}var Vi=If,Cf=Array.prototype,Af=Cf.splice;function Mf(e){var t=this.__data__,r=Vi(t,e);if(r<0)return!1;var i=t.length-1;return r==i?t.pop():Af.call(t,r,1),--this.size,!0}var jf=Mf;function Sf(e){var t=this.__data__,r=Vi(t,e);return r<0?void 0:t[r][1]}var _f=Sf;function $f(e){return Vi(this.__data__,e)>-1}var Ef=$f;function Lf(e,t){var r=this.__data__,i=Vi(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}var Tf=Lf;function Ue(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])}}Ue.prototype.clear=xf;Ue.prototype.delete=jf;Ue.prototype.get=_f;Ue.prototype.has=Ef;Ue.prototype.set=Tf;var Bi=Ue,Of=Pe(B,"Map"),dr=Of;function Nf(){this.size=0,this.__data__={hash:new vl,map:new(dr||Bi),string:new vl}}var Df=Nf;function Pf(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var zf=Pf;function Uf(e,t){var r=e.__data__;return zf(t)?r[typeof t=="string"?"string":"hash"]:r.map}var Gi=Uf;function Rf(e){var t=Gi(this,e).delete(e);return this.size-=t?1:0,t}var Ff=Rf;function Vf(e){return Gi(this,e).get(e)}var Bf=Vf;function Gf(e){return Gi(this,e).has(e)}var qf=Gf;function Yf(e,t){var r=Gi(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}var Hf=Yf;function Re(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])}}Re.prototype.clear=Df;Re.prototype.delete=Ff;Re.prototype.get=Bf;Re.prototype.has=qf;Re.prototype.set=Hf;var Ll=Re;function Zf(){this.__data__=new Bi,this.size=0}var Qf=Zf;function Wf(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var Kf=Wf;function Jf(e){return this.__data__.get(e)}var Xf=Jf;function em(e){return this.__data__.has(e)}var tm=em,rm=200;function im(e,t){var r=this.__data__;if(r instanceof Bi){var i=r.__data__;if(!dr||i.length<rm-1)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new Ll(i)}return r.set(e,t),this.size=r.size,this}var nm=im;function gr(e){var t=this.__data__=new Bi(e);this.size=t.size}gr.prototype.clear=Qf;gr.prototype.delete=Kf;gr.prototype.get=Xf;gr.prototype.has=tm;gr.prototype.set=nm;var om=Object.prototype,iW=om.propertyIsEnumerable;var am=Pe(B,"DataView"),Un=am,lm=Pe(B,"Promise"),Rn=lm,sm=Pe(B,"Set"),Fn=sm,wl="[object Map]",um="[object Object]",kl="[object Promise]",xl="[object Set]",Il="[object WeakMap]",Cl="[object DataView]",cm=be(Un),dm=be(dr),pm=be(Rn),gm=be(Fn),ym=be(zn),Ne=pr;(Un&&Ne(new Un(new ArrayBuffer(1)))!=Cl||dr&&Ne(new dr)!=wl||Rn&&Ne(Rn.resolve())!=kl||Fn&&Ne(new Fn)!=xl||zn&&Ne(new zn)!=Il)&&(Ne=function(e){var t=pr(e),r=t==um?e.constructor:void 0,i=r?be(r):"";if(i)switch(i){case cm:return Cl;case dm:return wl;case pm:return kl;case gm:return xl;case ym:return Il}return t});var nW=B.Uint8Array;var fm="__lodash_hash_undefined__";function mm(e){return this.__data__.set(e,fm),this}var hm=mm;function bm(e){return this.__data__.has(e)}var vm=bm;function Vn(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Ll;++t<r;)this.add(e[t])}Vn.prototype.add=Vn.prototype.push=hm;Vn.prototype.has=vm;var Al=De?De.prototype:void 0,oW=Al?Al.valueOf:void 0;var wm=Object.prototype,aW=wm.hasOwnProperty;var km=Object.prototype,lW=km.hasOwnProperty;var sW=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),uW=new RegExp(/[A-Fa-f0-9]{1}/,"g"),cW=new RegExp(/[A-Fa-f0-9]{2}/,"g");function xm(e){return e!==void 0}var Tl=xm;var Im=typeof global=="object"&&global&&global.Object===Object&&global,Zl=Im,Cm=typeof self=="object"&&self&&self.Object===Object&&self,Am=Zl||Cm||Function("return this")(),G=Am,Mm=G.Symbol,Ve=Mm,Ql=Object.prototype,jm=Ql.hasOwnProperty,Sm=Ql.toString,yr=Ve?Ve.toStringTag:void 0;function _m(e){var t=jm.call(e,yr),r=e[yr];try{e[yr]=void 0;var i=!0}catch{}var n=Sm.call(e);return i&&(t?e[yr]=r:delete e[yr]),n}var $m=_m,Em=Object.prototype,Lm=Em.toString;function Tm(e){return Lm.call(e)}var Om=Tm,Nm="[object Null]",Dm="[object Undefined]",Ol=Ve?Ve.toStringTag:void 0;function Pm(e){return e==null?e===void 0?Dm:Nm:Ol&&Ol in Object(e)?$m(e):Om(e)}var br=Pm;function zm(e){return e!=null&&typeof e=="object"}var Jn=zm,pW=Array.isArray;function Um(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Wl=Um,Rm="[object AsyncFunction]",Fm="[object Function]",Vm="[object GeneratorFunction]",Bm="[object Proxy]";function Gm(e){if(!Wl(e))return!1;var t=br(e);return t==Fm||t==Vm||t==Rm||t==Bm}var qm=Gm,Ym=G["__core-js_shared__"],Gn=Ym,Nl=function(){var e=/[^.]+$/.exec(Gn&&Gn.keys&&Gn.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Hm(e){return!!Nl&&Nl in e}var Zm=Hm,Qm=Function.prototype,Wm=Qm.toString;function Km(e){if(e!=null){try{return Wm.call(e)}catch{}try{return e+""}catch{}}return""}var ve=Km,Jm=/[\\^$.*+?()[\]{}|]/g,Xm=/^\[object .+?Constructor\]$/,eh=Function.prototype,th=Object.prototype,rh=eh.toString,ih=th.hasOwnProperty,nh=RegExp("^"+rh.call(ih).replace(Jm,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function oh(e){if(!Wl(e)||Zm(e))return!1;var t=qm(e)?nh:Xm;return t.test(ve(e))}var ah=oh;function lh(e,t){return e?.[t]}var sh=lh;function uh(e,t){var r=sh(e,t);return ah(r)?r:void 0}var Be=uh,ch=Be(G,"WeakMap"),Hn=ch;function dh(e,t){return e===t||e!==e&&t!==t}var ph=dh,gh=9007199254740991;function yh(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=gh}var fh=yh,gW=Object.prototype,mh="[object Arguments]";function hh(e){return Jn(e)&&br(e)==mh}var Dl=hh,Kl=Object.prototype,bh=Kl.hasOwnProperty,vh=Kl.propertyIsEnumerable,yW=Dl(function(){return arguments}())?Dl:function(e){return Jn(e)&&bh.call(e,"callee")&&!vh.call(e,"callee")},Jl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Pl=Jl&&typeof module=="object"&&module&&!module.nodeType&&module,wh=Pl&&Pl.exports===Jl,zl=wh?G.Buffer:void 0,fW=zl?zl.isBuffer:void 0,kh="[object Arguments]",xh="[object Array]",Ih="[object Boolean]",Ch="[object Date]",Ah="[object Error]",Mh="[object Function]",jh="[object Map]",Sh="[object Number]",_h="[object Object]",$h="[object RegExp]",Eh="[object Set]",Lh="[object String]",Th="[object WeakMap]",Oh="[object ArrayBuffer]",Nh="[object DataView]",Dh="[object Float32Array]",Ph="[object Float64Array]",zh="[object Int8Array]",Uh="[object Int16Array]",Rh="[object Int32Array]",Fh="[object Uint8Array]",Vh="[object Uint8ClampedArray]",Bh="[object Uint16Array]",Gh="[object Uint32Array]",j={};j[Dh]=j[Ph]=j[zh]=j[Uh]=j[Rh]=j[Fh]=j[Vh]=j[Bh]=j[Gh]=!0;j[kh]=j[xh]=j[Oh]=j[Ih]=j[Nh]=j[Ch]=j[Ah]=j[Mh]=j[jh]=j[Sh]=j[_h]=j[$h]=j[Eh]=j[Lh]=j[Th]=!1;function qh(e){return Jn(e)&&fh(e.length)&&!!j[br(e)]}var Yh=qh;function Hh(e){return function(t){return e(t)}}var Zh=Hh,Xl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,fr=Xl&&typeof module=="object"&&module&&!module.nodeType&&module,Qh=fr&&fr.exports===Xl,qn=Qh&&Zl.process,Wh=function(){try{var e=fr&&fr.require&&fr.require("util").types;return e||qn&&qn.binding&&qn.binding("util")}catch{}}(),Ul=Wh,Rl=Ul&&Ul.isTypedArray,mW=Rl?Zh(Rl):Yh,Kh=Object.prototype,hW=Kh.hasOwnProperty;function Jh(e,t){return function(r){return e(t(r))}}var Xh=Jh,bW=Xh(Object.keys,Object),eb=Object.prototype,vW=eb.hasOwnProperty,tb=Be(Object,"create"),mr=tb;function rb(){this.__data__=mr?mr(null):{},this.size=0}var ib=rb;function nb(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var ob=nb,ab="__lodash_hash_undefined__",lb=Object.prototype,sb=lb.hasOwnProperty;function ub(e){var t=this.__data__;if(mr){var r=t[e];return r===ab?void 0:r}return sb.call(t,e)?t[e]:void 0}var cb=ub,db=Object.prototype,pb=db.hasOwnProperty;function gb(e){var t=this.__data__;return mr?t[e]!==void 0:pb.call(t,e)}var yb=gb,fb="__lodash_hash_undefined__";function mb(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=mr&&t===void 0?fb:t,this}var hb=mb;function Ge(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])}}Ge.prototype.clear=ib;Ge.prototype.delete=ob;Ge.prototype.get=cb;Ge.prototype.has=yb;Ge.prototype.set=hb;var Fl=Ge;function bb(){this.__data__=[],this.size=0}var vb=bb;function wb(e,t){for(var r=e.length;r--;)if(ph(e[r][0],t))return r;return-1}var qi=wb,kb=Array.prototype,xb=kb.splice;function Ib(e){var t=this.__data__,r=qi(t,e);if(r<0)return!1;var i=t.length-1;return r==i?t.pop():xb.call(t,r,1),--this.size,!0}var Cb=Ib;function Ab(e){var t=this.__data__,r=qi(t,e);return r<0?void 0:t[r][1]}var Mb=Ab;function jb(e){return qi(this.__data__,e)>-1}var Sb=jb;function _b(e,t){var r=this.__data__,i=qi(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}var $b=_b;function qe(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])}}qe.prototype.clear=vb;qe.prototype.delete=Cb;qe.prototype.get=Mb;qe.prototype.has=Sb;qe.prototype.set=$b;var Yi=qe,Eb=Be(G,"Map"),hr=Eb;function Lb(){this.size=0,this.__data__={hash:new Fl,map:new(hr||Yi),string:new Fl}}var Tb=Lb;function Ob(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Nb=Ob;function Db(e,t){var r=e.__data__;return Nb(t)?r[typeof t=="string"?"string":"hash"]:r.map}var Hi=Db;function Pb(e){var t=Hi(this,e).delete(e);return this.size-=t?1:0,t}var zb=Pb;function Ub(e){return Hi(this,e).get(e)}var Rb=Ub;function Fb(e){return Hi(this,e).has(e)}var Vb=Fb;function Bb(e,t){var r=Hi(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}var Gb=Bb;function Ye(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])}}Ye.prototype.clear=Tb;Ye.prototype.delete=zb;Ye.prototype.get=Rb;Ye.prototype.has=Vb;Ye.prototype.set=Gb;var es=Ye;function qb(){this.__data__=new Yi,this.size=0}var Yb=qb;function Hb(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var Zb=Hb;function Qb(e){return this.__data__.get(e)}var Wb=Qb;function Kb(e){return this.__data__.has(e)}var Jb=Kb,Xb=200;function e0(e,t){var r=this.__data__;if(r instanceof Yi){var i=r.__data__;if(!hr||i.length<Xb-1)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new es(i)}return r.set(e,t),this.size=r.size,this}var t0=e0;function vr(e){var t=this.__data__=new Yi(e);this.size=t.size}vr.prototype.clear=Yb;vr.prototype.delete=Zb;vr.prototype.get=Wb;vr.prototype.has=Jb;vr.prototype.set=t0;var r0=Object.prototype,wW=r0.propertyIsEnumerable,i0=Be(G,"DataView"),Zn=i0,n0=Be(G,"Promise"),Qn=n0,o0=Be(G,"Set"),Wn=o0,Vl="[object Map]",a0="[object Object]",Bl="[object Promise]",Gl="[object Set]",ql="[object WeakMap]",Yl="[object DataView]",l0=ve(Zn),s0=ve(hr),u0=ve(Qn),c0=ve(Wn),d0=ve(Hn),Fe=br;(Zn&&Fe(new Zn(new ArrayBuffer(1)))!=Yl||hr&&Fe(new hr)!=Vl||Qn&&Fe(Qn.resolve())!=Bl||Wn&&Fe(new Wn)!=Gl||Hn&&Fe(new Hn)!=ql)&&(Fe=function(e){var t=br(e),r=t==a0?e.constructor:void 0,i=r?ve(r):"";if(i)switch(i){case l0:return Yl;case s0:return Vl;case u0:return Bl;case c0:return Gl;case d0:return ql}return t});var kW=G.Uint8Array,p0="__lodash_hash_undefined__";function g0(e){return this.__data__.set(e,p0),this}var y0=g0;function f0(e){return this.__data__.has(e)}var m0=f0;function Kn(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new es;++t<r;)this.add(e[t])}Kn.prototype.add=Kn.prototype.push=y0;Kn.prototype.has=m0;var Hl=Ve?Ve.prototype:void 0,xW=Hl?Hl.valueOf:void 0,h0=Object.prototype,IW=h0.hasOwnProperty,b0=Object.prototype,CW=b0.hasOwnProperty,AW=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),MW=new RegExp(/[A-Fa-f0-9]{1}/,"g"),jW=new RegExp(/[A-Fa-f0-9]{2}/,"g");var Zi=class ts{constructor(){this.actions=new Map,this.subscribers=new Map}static get(){let t="__imgly_action_registry__",r=typeof window<"u"?window:globalThis;return r[t]||(r[t]=new ts),r[t]}register(t){return this.actions.set(t.id,t),this.notifySubscribers(t,"registered"),()=>{this.actions.get(t.id)===t&&(this.actions.delete(t.id),this.notifySubscribers(t,"unregistered"))}}getAll(){return Array.from(this.actions.values())}getBy(t){return this.getAll().filter(r=>this.matchesFilters(r,t))}subscribe(t){return this.subscribers.set(t,null),()=>{this.subscribers.delete(t)}}subscribeBy(t,r){return this.subscribers.set(r,t),()=>{this.subscribers.delete(r)}}notifySubscribers(t,r){this.subscribers.forEach((i,n)=>{if(i===null){n(t,r);return}this.matchesFilters(t,i)&&n(t,r)})}matchesFilters(t,r){return!(r.type&&t.type!==r.type||r.pluginId&&t.type==="plugin"&&t.pluginId!==r.pluginId||r.id&&t.id!==r.id||r.kind&&(t.type!=="quick"||t.kind!==r.kind))}};var v0="ly.img.ai";function rs(e){return`${v0}.${e}`}function is(e,t,r){let i="ai-plugin-version",n="ai-plugin-version-warning-shown";try{let a=e.ui.experimental.getGlobalStateValue(i);a?a!==r&&(e.ui.experimental.getGlobalStateValue(n,!1)||(console.warn(`[IMG.LY AI Plugins] Version mismatch detected! Plugin "${t}" is using version ${r}, but other AI plugins are using version ${a}. This may cause compatibility issues. Please ensure all AI plugins (@imgly/plugin-ai-*) use the same version. Consider updating all AI plugins to the same version for optimal compatibility.`),e.ui.experimental.setGlobalStateValue(n,!0))):e.ui.experimental.setGlobalStateValue(i,r)}catch(a){console.debug("[IMG.LY AI Plugins] Could not check plugin version consistency:",a)}}var Yn="@imgly/plugin-ai-generation",SW=` <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="${Yn}/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="${Yn}/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="${Yn}/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 w0=class{constructor(e,t,r){this.assetStoreName="assets",this.blobStoreName="blobs",this.db=null,this.id=e,this.engine=t,this.dbName=r?.dbName??`ly.img.assetSource/${e}`,this.dbVersion=r?.dbVersion??1}async initialize(){if(!this.db)return new Promise((e,t)=>{let r=indexedDB.open(this.dbName,this.dbVersion);r.onerror=i=>{t(new Error(`Failed to open IndexedDB: ${i.target.error}`))},r.onupgradeneeded=i=>{let n=i.target.result;n.objectStoreNames.contains(this.assetStoreName)||n.createObjectStore(this.assetStoreName,{keyPath:"id"}),n.objectStoreNames.contains(this.blobStoreName)||n.createObjectStore(this.blobStoreName,{keyPath:"id"})},r.onsuccess=i=>{this.db=i.target.result,e()}})}close(){this.db&&(this.db.close(),this.db=null)}async findAssets(e){if(await this.initialize(),!this.db)throw new Error("Database not initialized");try{let t=(await this.getAllAssets("asc")).reduce((u,s)=>{let c=e.locale??"en",d="",p=[];s.label!=null&&typeof s.label=="object"&&s.label[c]&&(d=s.label[c]),s.tags!=null&&typeof s.tags=="object"&&s.tags[c]&&(p=s.tags[c]);let y={...s,label:d,tags:p};return this.filterAsset(y,e)&&u.push(y),u},[]);t=await this.restoreBlobUrls(t),t=this.sortAssets(t,e);let{page:r,perPage:i}=e,n=r*i,a=n+i,o=t.slice(n,a),l=a<t.length?r+1:void 0;return{assets:o,currentPage:r,nextPage:l,total:t.length}}catch(t){console.error("Error finding assets:",t);return}}async getGroups(){if(await this.initialize(),!this.db)throw new Error("Database not initialized");return new Promise((e,t)=>{let r=this.db.transaction(this.assetStoreName,"readonly").objectStore(this.assetStoreName).getAll();r.onsuccess=()=>{let i=new Set;r.result.forEach(a=>{a.groups&&Array.isArray(a.groups)&&a.groups.forEach(o=>i.add(o))});let n=[...i];e(n)},r.onerror=()=>{t(new Error(`Failed to get groups: ${r.error}`))}})}addAsset(e){this.initialize().then(async()=>{if(!this.db)throw new Error("Database not initialized");let t=this.db.transaction(this.assetStoreName,"readwrite"),r=t.objectStore(this.assetStoreName),i=new Set;Qe(e,a=>{i.add(a)}),setTimeout(()=>{this.storeBlobUrls([...i])});let n={...e,meta:{...e.meta,insertedAt:e.meta?.insertedAt||Date.now()}};r.put(n),t.onerror=()=>{console.error(`Failed to add asset: ${t.error}`)}}).catch(t=>{console.error("Error initializing database:",t)})}async removeAsset(e){let t=await this.getAsset(e);return this.initialize().then(()=>{if(!this.db)throw new Error("Database not initialized");let r=this.db.transaction(this.assetStoreName,"readwrite");r.objectStore(this.assetStoreName).delete(e),r.oncomplete=()=>{Qe(t,i=>{this.removeBlob(i)}),this.engine.asset.assetSourceContentsChanged(this.id)},r.onerror=()=>{console.error(`Failed to remove asset: ${r.error}`)}}).catch(r=>{console.error("Error initializing database:",r)})}async removeBlob(e){return this.initialize().then(()=>{if(!this.db)throw new Error("Database not initialized");let t=this.db.transaction(this.blobStoreName,"readwrite");t.objectStore(this.blobStoreName).delete(e),t.onerror=()=>{console.error(`Failed to remove blob: ${t.error}`)}}).catch(t=>{console.error("Error initializing database:",t)})}async getAllAssets(e="desc"){return new Promise((t,r)=>{let i=this.db.transaction(this.assetStoreName,"readonly").objectStore(this.assetStoreName).getAll();i.onsuccess=()=>{let n=i.result;n.sort((a,o)=>{let l=a.meta?.insertedAt||a._insertedAt||Date.now(),u=o.meta?.insertedAt||o._insertedAt||Date.now();return e==="asc"?l-u:u-l}),t(n)},i.onerror=()=>{r(new Error(`Failed to get assets: ${i.error}`))}})}async getAsset(e){return new Promise((t,r)=>{let i=this.db.transaction(this.assetStoreName,"readonly").objectStore(this.assetStoreName).get(e);i.onsuccess=()=>{t(i.result)},i.onerror=()=>{r(new Error(`Failed to get blob: ${i.error}`))}})}async getBlob(e){return new Promise((t,r)=>{let i=this.db.transaction(this.blobStoreName,"readonly").objectStore(this.blobStoreName).get(e);i.onsuccess=()=>{t(i.result)},i.onerror=()=>{r(new Error(`Failed to get blob: ${i.error}`))}})}async createBlobUrlFromStore(e){let t=await this.getBlob(e);return t!=null?URL.createObjectURL(t.blob):e}async storeBlobUrls(e){let t={};return await Promise.all(e.map(async r=>{let i=await(await fetch(r)).blob();t[r]=i})),this.initialize().then(async()=>{if(!this.db)throw new Error("Database not initialized");let r=this.db.transaction(this.blobStoreName,"readwrite"),i=r.objectStore(this.blobStoreName);Object.entries(t).forEach(([n,a])=>{let o={id:n,blob:a};i.put(o)}),r.onerror=()=>{console.error(`Failed to add blobs: ${r.error}`)}}).catch(r=>{console.error("Error initializing database:",r)})}async restoreBlobUrls(e){let t={},r=new Set;return Qe(e,i=>{r.add(i)}),await Promise.all([...r].map(async i=>{let n=await this.createBlobUrlFromStore(i);t[i]=n})),Qe(e,i=>t[i]??i)}filterAsset(e,t){let{query:r,tags:i,groups:n,excludeGroups:a}=t;if(r&&r.trim()!==""){let o=r.trim().toLowerCase().split(" "),l=e.label?.toLowerCase()??"",u=e.tags?.map(s=>s.toLowerCase())??[];if(!o.every(s=>l.includes(s)||u.some(c=>c.includes(s))))return!1}if(i){let o=Array.isArray(i)?i:[i];if(o.length>0&&(!e.tags||!o.every(l=>e.tags?.includes(l))))return!1}return!(n&&n.length>0&&(!e.groups||!n.some(o=>e.groups?.includes(o)))||a&&a.length>0&&e.groups&&e.groups.some(o=>a.includes(o)))}sortAssets(e,t){let{sortingOrder:r,sortKey:i,sortActiveFirst:n}=t,a=[...e];return!r||r==="None"||(i?a.sort((o,l)=>{let u,s;return i==="id"?(u=o.id,s=l.id):(u=o.meta?.[i]??null,s=l.meta?.[i]??null),u==null?r==="Ascending"?-1:1:s==null?r==="Ascending"?1:-1:typeof u=="string"&&typeof s=="string"?r==="Ascending"?u.localeCompare(s):s.localeCompare(u):r==="Ascending"?u<s?-1:u>s?1:0:u>s?-1:u<s?1:0}):r==="Descending"&&a.reverse(),n&&a.sort((o,l)=>o.active&&!l.active?-1:!o.active&&l.active?1:0)),a}};function Qe(e,t,r=""){if(e===null||typeof e!="object")return e;if(Array.isArray(e)){for(let i=0;i<e.length;i++){let n=r?`${r}[${i}]`:`[${i}]`;if(typeof e[i]=="string"&&e[i].startsWith("blob:")){let a=t(e[i],n);typeof a=="string"&&(e[i]=a)}else e[i]=Qe(e[i],t,n)}return e}for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)){let n=e[i],a=r?`${r}.${i}`:i;if(typeof n=="string"&&n.startsWith("blob:")){let o=t(n,a);typeof o=="string"&&(e[i]=o)}else e[i]=Qe(n,t,a)}return e}var k0=class{constructor(e,t,r){this.id=e,this.cesdk=t,this.assetSourceIds=r}async findAssets(e){try{let t=this.assetSourceIds.map(c=>this.cesdk.engine.asset.findAssets(c,{...e,perPage:9999,page:0})),r=await Promise.all(t),i=[];r.forEach(c=>{c?.assets&&(i=i.concat(c.assets))}),i.sort((c,d)=>{let p=c.meta?.insertedAt||0;return(d.meta?.insertedAt||0)-p});let{page:n,perPage:a}=e,o=n*a,l=o+a,u=i.slice(o,l),s=l<i.length?n+1:void 0;return{assets:u,currentPage:n,nextPage:s,total:i.length}}catch(t){console.error("Error finding assets:",t);return}}async getGroups(){let e=this.assetSourceIds.map(i=>this.cesdk.engine.asset.getGroups(i)),t=await Promise.all(e),r=new Set;return t.forEach(i=>{i.forEach(n=>r.add(n))}),Array.from(r)}addAsset(e){throw new Error("AggregatedAssetSource does not support adding assets")}removeAsset(e){throw new Error("AggregatedAssetSource does not support removing assets")}},x0=class{constructor(e,t){this.engine=e,this.key=t}hasData(e){return this.engine.block.isValid(e)&&this.engine.block.hasMetadata(e,this.key)}get(e){if(this.hasData(e))return JSON.parse(this.engine.block.getMetadata(e,this.key))}set(e,t){this.engine.block.setMetadata(e,this.key,JSON.stringify(t))}clear(e){this.engine.block.hasMetadata(e,this.key)&&this.engine.block.removeMetadata(e,this.key)}},zs=x0,I0=typeof global=="object"&&global&&global.Object===Object&&global,Us=I0,C0=typeof self=="object"&&self&&self.Object===Object&&self,A0=Us||C0||Function("return this")(),H=A0,M0=H.Symbol,We=M0,Rs=Object.prototype,j0=Rs.hasOwnProperty,S0=Rs.toString,wr=We?We.toStringTag:void 0;function _0(e){var t=j0.call(e,wr),r=e[wr];try{e[wr]=void 0;var i=!0}catch{}var n=S0.call(e);return i&&(t?e[wr]=r:delete e[wr]),n}var $0=_0,E0=Object.prototype,L0=E0.toString;function T0(e){return L0.call(e)}var O0=T0,N0="[object Null]",D0="[object Undefined]",ns=We?We.toStringTag:void 0;function P0(e){return e==null?e===void 0?D0:N0:ns&&ns in Object(e)?$0(e):O0(e)}var Lr=P0;function z0(e){return e!=null&&typeof e=="object"}var vo=z0,$W=Array.isArray;function U0(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Fs=U0,R0="[object AsyncFunction]",F0="[object Function]",V0="[object GeneratorFunction]",B0="[object Proxy]";function G0(e){if(!Fs(e))return!1;var t=Lr(e);return t==F0||t==V0||t==R0||t==B0}var q0=G0,Y0=H["__core-js_shared__"],Xn=Y0,os=function(){var e=/[^.]+$/.exec(Xn&&Xn.keys&&Xn.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function H0(e){return!!os&&os in e}var Z0=H0,Q0=Function.prototype,W0=Q0.toString;function K0(e){if(e!=null){try{return W0.call(e)}catch{}try{return e+""}catch{}}return""}var ke=K0,J0=/[\\^$.*+?()[\]{}|]/g,X0=/^\[object .+?Constructor\]$/,e2=Function.prototype,t2=Object.prototype,r2=e2.toString,i2=t2.hasOwnProperty,n2=RegExp("^"+r2.call(i2).replace(J0,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function o2(e){if(!Fs(e)||Z0(e))return!1;var t=q0(e)?n2:X0;return t.test(ke(e))}var a2=o2;function l2(e,t){return e?.[t]}var s2=l2;function u2(e,t){var r=s2(e,t);return a2(r)?r:void 0}var Je=u2,c2=Je(H,"WeakMap"),lo=c2;function d2(e,t){return e===t||e!==e&&t!==t}var p2=d2,g2=9007199254740991;function y2(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=g2}var f2=y2,EW=Object.prototype,m2="[object Arguments]";function h2(e){return vo(e)&&Lr(e)==m2}var as=h2,Vs=Object.prototype,b2=Vs.hasOwnProperty,v2=Vs.propertyIsEnumerable,LW=as(function(){return arguments}())?as:function(e){return vo(e)&&b2.call(e,"callee")&&!v2.call(e,"callee")},Bs=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ls=Bs&&typeof module=="object"&&module&&!module.nodeType&&module,w2=ls&&ls.exports===Bs,ss=w2?H.Buffer:void 0,TW=ss?ss.isBuffer:void 0,k2="[object Arguments]",x2="[object Array]",I2="[object Boolean]",C2="[object Date]",A2="[object Error]",M2="[object Function]",j2="[object Map]",S2="[object Number]",_2="[object Object]",$2="[object RegExp]",E2="[object Set]",L2="[object String]",T2="[object WeakMap]",O2="[object ArrayBuffer]",N2="[object DataView]",D2="[object Float32Array]",P2="[object Float64Array]",z2="[object Int8Array]",U2="[object Int16Array]",R2="[object Int32Array]",F2="[object Uint8Array]",V2="[object Uint8ClampedArray]",B2="[object Uint16Array]",G2="[object Uint32Array]",S={};S[D2]=S[P2]=S[z2]=S[U2]=S[R2]=S[F2]=S[V2]=S[B2]=S[G2]=!0;S[k2]=S[x2]=S[O2]=S[I2]=S[N2]=S[C2]=S[A2]=S[M2]=S[j2]=S[S2]=S[_2]=S[$2]=S[E2]=S[L2]=S[T2]=!1;function q2(e){return vo(e)&&f2(e.length)&&!!S[Lr(e)]}var Y2=q2;function H2(e){return function(t){return e(t)}}var Z2=H2,Gs=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Mr=Gs&&typeof module=="object"&&module&&!module.nodeType&&module,Q2=Mr&&Mr.exports===Gs,eo=Q2&&Us.process,W2=function(){try{var e=Mr&&Mr.require&&Mr.require("util").types;return e||eo&&eo.binding&&eo.binding("util")}catch{}}(),us=W2,cs=us&&us.isTypedArray,OW=cs?Z2(cs):Y2,K2=Object.prototype,NW=K2.hasOwnProperty;function J2(e,t){return function(r){return e(t(r))}}var X2=J2,DW=X2(Object.keys,Object),e4=Object.prototype,PW=e4.hasOwnProperty,t4=Je(Object,"create"),Sr=t4;function r4(){this.__data__=Sr?Sr(null):{},this.size=0}var i4=r4;function n4(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var o4=n4,a4="__lodash_hash_undefined__",l4=Object.prototype,s4=l4.hasOwnProperty;function u4(e){var t=this.__data__;if(Sr){var r=t[e];return r===a4?void 0:r}return s4.call(t,e)?t[e]:void 0}var c4=u4,d4=Object.prototype,p4=d4.hasOwnProperty;function g4(e){var t=this.__data__;return Sr?t[e]!==void 0:p4.call(t,e)}var y4=g4,f4="__lodash_hash_undefined__";function m4(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Sr&&t===void 0?f4:t,this}var h4=m4;function Xe(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])}}Xe.prototype.clear=i4;Xe.prototype.delete=o4;Xe.prototype.get=c4;Xe.prototype.has=y4;Xe.prototype.set=h4;var ds=Xe;function b4(){this.__data__=[],this.size=0}var v4=b4;function w4(e,t){for(var r=e.length;r--;)if(p2(e[r][0],t))return r;return-1}var Ji=w4,k4=Array.prototype,x4=k4.splice;function I4(e){var t=this.__data__,r=Ji(t,e);if(r<0)return!1;var i=t.length-1;return r==i?t.pop():x4.call(t,r,1),--this.size,!0}var C4=I4;function A4(e){var t=this.__data__,r=Ji(t,e);return r<0?void 0:t[r][1]}var M4=A4;function j4(e){return Ji(this.__data__,e)>-1}var S4=j4;function _4(e,t){var r=this.__data__,i=Ji(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}var $4=_4;function et(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])}}et.prototype.clear=v4;et.prototype.delete=C4;et.prototype.get=M4;et.prototype.has=S4;et.prototype.set=$4;var Xi=et,E4=Je(H,"Map"),_r=E4;function L4(){this.size=0,this.__data__={hash:new ds,map:new(_r||Xi),string:new ds}}var T4=L4;function O4(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var N4=O4;function D4(e,t){var r=e.__data__;return N4(t)?r[typeof t=="string"?"string":"hash"]:r.map}var en=D4;function P4(e){var t=en(this,e).delete(e);return this.size-=t?1:0,t}var z4=P4;function U4(e){return en(this,e).get(e)}var R4=U4;function F4(e){return en(this,e).has(e)}var V4=F4;function B4(e,t){var r=en(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}var G4=B4;function tt(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])}}tt.prototype.clear=T4;tt.prototype.delete=z4;tt.prototype.get=R4;tt.prototype.has=V4;tt.prototype.set=G4;var qs=tt;function q4(){this.__data__=new Xi,this.size=0}var Y4=q4;function H4(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var Z4=H4;function Q4(e){return this.__data__.get(e)}var W4=Q4;function K4(e){return this.__data__.has(e)}var J4=K4,X4=200;function e5(e,t){var r=this.__data__;if(r instanceof Xi){var i=r.__data__;if(!_r||i.length<X4-1)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new qs(i)}return r.set(e,t),this.size=r.size,this}var t5=e5;function Tr(e){var t=this.__data__=new Xi(e);this.size=t.size}Tr.prototype.clear=Y4;Tr.prototype.delete=Z4;Tr.prototype.get=W4;Tr.prototype.has=J4;Tr.prototype.set=t5;var r5=Object.prototype,zW=r5.propertyIsEnumerable,i5=Je(H,"DataView"),so=i5,n5=Je(H,"Promise"),uo=n5,o5=Je(H,"Set"),co=o5,ps="[object Map]",a5="[object Object]",gs="[object Promise]",ys="[object Set]",fs="[object WeakMap]",ms="[object DataView]",l5=ke(so),s5=ke(_r),u5=ke(uo),c5=ke(co),d5=ke(lo),He=Lr;(so&&He(new so(new ArrayBuffer(1)))!=ms||_r&&He(new _r)!=ps||uo&&He(uo.resolve())!=gs||co&&He(new co)!=ys||lo&&He(new lo)!=fs)&&(He=function(e){var t=Lr(e),r=t==a5?e.constructor:void 0,i=r?ke(r):"";if(i)switch(i){case l5:return ms;case s5:return ps;case u5:return gs;case c5:return ys;case d5:return fs}return t});var UW=H.Uint8Array,p5="__lodash_hash_undefined__";function g5(e){return this.__data__.set(e,p5),this}var y5=g5;function f5(e){return this.__data__.has(e)}var m5=f5;function po(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new qs;++t<r;)this.add(e[t])}po.prototype.add=po.prototype.push=y5;po.prototype.has=m5;var hs=We?We.prototype:void 0,RW=hs?hs.valueOf:void 0,h5=Object.prototype,FW=h5.hasOwnProperty,b5=Object.prototype,VW=b5.hasOwnProperty,BW=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),GW=new RegExp(/[A-Fa-f0-9]{1}/,"g"),qW=new RegExp(/[A-Fa-f0-9]{2}/,"g");function v5(e){return{"image/png":"png","image/jpeg":"jpg","image/webp":"webp","image/gif":"gif","image/svg+xml":"svg"}[e]??"png"}async function Ys(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),a=new Blob([n],{type:r});return URL.createObjectURL(a)}else return e}async function go(e,t){let r=await Ys(e,t);return new Promise((i,n)=>{let a=new Image;a.onload=()=>{i({width:a.width,height:a.height})},a.onerror=n,a.src=r})}async function w5(e,t,r){let i,n=t.block.getFill(e),a=t.block.getSourceSet(n,"fill/image/sourceSet"),[o]=a;if(o==null){if(i=t.block.getString(n,"fill/image/imageFileURI"),i==null)throw new Error("No image source/uri found")}else i=o.uri;if(r?.throwErrorIfSvg&&await t.editor.getMimeType(i)==="image/svg+xml")throw new Error("SVG images are not supported");return Ys(i,t)}function k5(e){return e!==void 0}var tn=k5,Hs=class Zs{constructor(){this.actions=new Map,this.subscribers=new Map}static get(){let t="__imgly_action_registry__",r=typeof window<"u"?window:globalThis;return r[t]||(r[t]=new Zs),r[t]}register(t){return this.actions.set(t.id,t),this.notifySubscribers(t,"registered"),()=>{this.actions.get(t.id)===t&&(this.actions.delete(t.id),this.notifySubscribers(t,"unregistered"))}}getAll(){return Array.from(this.actions.values())}getBy(t){return this.getAll().filter(r=>this.matchesFilters(r,t))}subscribe(t){return this.subscribers.set(t,null),()=>{this.subscribers.delete(t)}}subscribeBy(t,r){return this.subscribers.set(r,t),()=>{this.subscribers.delete(r)}}notifySubscribers(t,r){this.subscribers.forEach((i,n)=>{if(i===null){n(t,r);return}this.matchesFilters(t,i)&&n(t,r)})}matchesFilters(t,r){return!(r.type&&t.type!==r.type||r.pluginId&&t.type==="plugin"&&t.pluginId!==r.pluginId||r.id&&t.id!==r.id||r.kind&&(t.type!=="quick"||t.kind!==r.kind))}},Qs=class Ws{constructor(){this.providers=new Map}static get(){let t="__imgly_provider_registry__",r=typeof window<"u"?window:globalThis;return r[t]||(r[t]=new Ws),r[t]}register(t){return this.providers.has(t.provider.id)&&console.warn(`Provider with ID "${t.provider.id}" is already registered`),this.providers.set(t.provider.id,t),()=>{this.providers.get(t.provider.id)===t&&this.providers.delete(t.provider.id)}}getAll(){return Array.from(this.providers.values())}getById(t){return this.providers.get(t)}getByKind(t){return this.getAll().filter(({provider:r})=>r.kind===t)}};function x5(e){let t=e.filter(r=>!!r);return r=>async(i,n)=>{let a=[],o=s=>{a.push(s)},l=async(s,c,d)=>{if(s>=t.length)return r(c,d);let p=t[s],y=async(b,v)=>l(s+1,b,v),g={...d,addDisposer:o};return p(c,g,y)},u={...n,addDisposer:o};return{result:await l(0,i,u),dispose:async()=>{for(let s=a.length-1;s>=0;s--)try{await a[s]()}catch(c){console.error("Error in disposer:",c)}a.length=0}}}}function I5({enable:e=!0}){return async(t,r,i)=>{if(!e)return i(t,r);console.group("[GENERATION]"),console.log("Generating with input:",JSON.stringify(t,null,2));let n,a=Date.now();try{return n=await i(t,r),n}finally{n!=null&&(console.log(`Generation took ${Date.now()-a}ms`),console.log("Generation result:",JSON.stringify(n,null,2))),console.groupEnd()}}}var C5=I5,to="ly.img.ai.temp";async function A5(e,t){return e.engine.asset.findAllSources().includes(to)||e.engine.asset.addLocalSource(to),e.engine.asset.apply(to,t)}function M5(e,t="We encountered an unknown error while generating the asset. Please try again."){if(e===null)return t;if(e instanceof Error)return e.message;if(typeof e=="object"){let r=e;return"message"in r&&typeof r.message=="string"?r.message:"cause"in r&&typeof r.cause=="string"?r.cause:"detail"in r&&typeof r.detail=="object"&&r.detail!==null&&"message"in r.detail&&typeof r.detail.message=="string"?r.detail.message:"error"in r&&typeof r.error=="object"&&r.error!==null&&"message"in r.error&&typeof r.error.message=="string"?r.error.message:t}return typeof e=="string"?e:String(e)||t}function Ks(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function j5(e,t=0,r="image/jpeg",i=.8){return new Promise((n,a)=>{try{let o=document.createElement("video");o.crossOrigin="anonymous",o.style.display="none",o.addEventListener("loadedmetadata",()=>{o.currentTime=Math.min(t,o.duration),o.addEventListener("seeked",()=>{let l=document.createElement("canvas");l.width=o.videoWidth,l.height=o.videoHeight;let u=l.getContext("2d");if(!u){document.body.removeChild(o),a(new Error("Failed to create canvas context"));return}u.drawImage(o,0,0,l.width,l.height);try{let s=l.toDataURL(r,i);document.body.removeChild(o),n(s)}catch(s){document.body.removeChild(o),a(new Error(`Failed to create thumbnail: ${s instanceof Error?s.message:String(s)}`))}},{once:!0})}),o.addEventListener("error",()=>{document.body.removeChild(o),a(new Error(`Failed to load video from ${e}`))}),o.src=e,document.body.appendChild(o)}catch(o){a(o)}})}function S5(e){return e?e.replace(/[_-]/g," ").replace(/([A-Z])/g," $1").trim().split(" ").filter(t=>t.length>0).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" "):""}function _5(e){return typeof e=="object"&&e!==null&&"next"in e&&"return"in e&&"throw"in e&&typeof e.next=="function"&&typeof e.return=="function"&&typeof e.throw=="function"&&Symbol.asyncIterator in e&&typeof e[Symbol.asyncIterator]=="function"}function wo(e){return e instanceof Error&&e.name==="AbortError"}function $5(e,t,r){let i=`${t}.iconSetAdded`;e.ui.experimental.hasGlobalStateValue(i)||(e.ui.addIconSet(t,r),e.ui.experimental.setGlobalStateValue(i,!0))}function E5(e,t,r){let i="ai-plugin-version",n="ai-plugin-version-warning-shown";try{let a=e.ui.experimental.getGlobalStateValue(i);a?a!==r&&(e.ui.experimental.getGlobalStateValue(n,!1)||(console.warn(`[IMG.LY AI Plugins] Version mismatch detected! Plugin "${t}" is using version ${r}, but other AI plugins are using version ${a}. This may cause compatibility issues. Please ensure all AI plugins (@imgly/plugin-ai-*) use the same version. Consider updating all AI plugins to the same version for optimal compatibility.`),e.ui.experimental.setGlobalStateValue(n,!0))):e.ui.experimental.setGlobalStateValue(i,r)}catch(a){console.debug("[IMG.LY AI Plugins] Could not check plugin version consistency:",a)}}function L5(e){let{cesdk:t,panelId:r}=e;r.startsWith("ly.img.ai.")||console.warn(`Dock components for AI generation should open a panel with an id starting with "ly.img.ai." \u2013 "${r}" was provided.`);let i=`${r}.dock`;t.ui.registerComponent(i,({builder:n})=>{let a=t.ui.isPanelOpen(r);n.Button(`${r}.dock.button`,{label:`${r}.dock.label`,isSelected:a,icon:"@imgly/Sparkle",onClick:()=>{t.ui.findAllPanels().forEach(o=>{o.startsWith("ly.img.ai.")&&t.ui.closePanel(o),!a&&o==="//ly.img.panel/assetLibrary"&&t.ui.closePanel(o)}),a?t.ui.closePan