var Ot=`
<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>
`,te=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 a=i;return{id:a.id,label:{en:a.label},meta:a.thumbUri?{...a.meta??{},thumbUri:a.thumbUri}:a.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:a,query:n,tags:l,groups:s,excludeGroups:f,sortingOrder:g,sortKey:d}=e,u=[...this.assets];if(s&&s.length>0&&(u=u.filter(o=>o.groups&&s.some(c=>o.groups?.includes(c)))),f&&f.length>0&&(u=u.filter(o=>!o.groups||!f.some(c=>o.groups?.includes(c)))),n){let o=n.toLowerCase();u=u.filter(c=>{let p=c.label?.[i]?.toLowerCase(),m=c.tags?.[i]||[];return p&&p.includes(o)||m.some(pe=>pe.toLowerCase().includes(o))})}if(l&&l.length>0){let o=Array.isArray(l)?l:[l];u=u.filter(c=>{let p=c.tags?.[i]||[];return o.some(m=>p.includes(m))})}a&&u.sort((o,c)=>{let p=this.activeAssetIds.has(o.id),m=this.activeAssetIds.has(c.id);return p&&!m?-1:!p&&m?1:0}),d&&d!=="id"?u.sort((o,c)=>{let p=o.meta?.[d],m=c.meta?.[d];return p===void 0?1:m===void 0?-1:typeof p=="string"&&typeof m=="string"?g==="Descending"?m.localeCompare(p):p.localeCompare(m):typeof p=="number"&&typeof m=="number"?g==="Descending"?m-p:p-m:0}):d==="id"&&u.sort((o,c)=>g==="Descending"?c.id.localeCompare(o.id):o.id.localeCompare(c.id));let w=u.length,v=t*r,I=v+r,y=u.slice(v,I).map(o=>{let c=o.label?.[i]||"",p=this.translateLabel?this.translateLabel(o.id,c,i):c;return{id:o.id,groups:o.groups,meta:o.meta,payload:o.payload,locale:i,label:p,tags:o.tags?.[i],active:this.activeAssetIds.has(o.id)}}),k=I<w?t+1:void 0;return{assets:y,currentPage:t,nextPage:k,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 Rt=typeof global=="object"&&global&&global.Object===Object&&global,Ye=Rt,zt=typeof self=="object"&&self&&self.Object===Object&&self,Ut=Ye||zt||Function("return this")(),S=Ut,Ft=S.Symbol,j=Ft,Ze=Object.prototype,Vt=Ze.hasOwnProperty,Bt=Ze.toString,U=j?j.toStringTag:void 0;function Gt(e){var t=Vt.call(e,U),r=e[U];try{e[U]=void 0;var i=!0}catch{}var a=Bt.call(e);return i&&(t?e[U]=r:delete e[U]),a}var qt=Gt,Ht=Object.prototype,Kt=Ht.toString;function Yt(e){return Kt.call(e)}var Zt=Yt,Qt="[object Null]",Wt="[object Undefined]",_e=j?j.toStringTag:void 0;function Jt(e){return e==null?e===void 0?Wt:Qt:_e&&_e in Object(e)?qt(e):Zt(e)}var G=Jt;function Xt(e){return e!=null&&typeof e=="object"}var we=Xt,os=Array.isArray;function er(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Qe=er,tr="[object AsyncFunction]",rr="[object Function]",ir="[object GeneratorFunction]",nr="[object Proxy]";function ar(e){if(!Qe(e))return!1;var t=G(e);return t==rr||t==ir||t==tr||t==nr}var or=ar,lr=S["__core-js_shared__"],ge=lr,Ne=function(){var e=/[^.]+$/.exec(ge&&ge.keys&&ge.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function sr(e){return!!Ne&&Ne in e}var ur=sr,cr=Function.prototype,dr=cr.toString;function pr(e){if(e!=null){try{return dr.call(e)}catch{}try{return e+""}catch{}}return""}var x=pr,gr=/[\\^$.*+?()[\]{}|]/g,mr=/^\[object .+?Constructor\]$/,fr=Function.prototype,yr=Object.prototype,br=fr.toString,hr=yr.hasOwnProperty,vr=RegExp("^"+br.call(hr).replace(gr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function wr(e){if(!Qe(e)||ur(e))return!1;var t=or(e)?vr:mr;return t.test(x(e))}var kr=wr;function Ir(e,t){return e?.[t]}var Sr=Ir;function Ar(e,t){var r=Sr(e,t);return kr(r)?r:void 0}var M=Ar,xr=M(S,"WeakMap"),fe=xr;function Cr(e,t){return e===t||e!==e&&t!==t}var Er=Cr,jr=9007199254740991;function Mr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=jr}var $r=Mr;var ls=Object.prototype;var Tr="[object Arguments]";function Lr(e){return we(e)&&G(e)==Tr}var De=Lr,We=Object.prototype,Pr=We.hasOwnProperty,_r=We.propertyIsEnumerable,ss=De(function(){return arguments}())?De:function(e){return we(e)&&Pr.call(e,"callee")&&!_r.call(e,"callee")};var Je=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Oe=Je&&typeof module=="object"&&module&&!module.nodeType&&module,Nr=Oe&&Oe.exports===Je,Re=Nr?S.Buffer:void 0,us=Re?Re.isBuffer:void 0;var Dr="[object Arguments]",Or="[object Array]",Rr="[object Boolean]",zr="[object Date]",Ur="[object Error]",Fr="[object Function]",Vr="[object Map]",Br="[object Number]",Gr="[object Object]",qr="[object RegExp]",Hr="[object Set]",Kr="[object String]",Yr="[object WeakMap]",Zr="[object ArrayBuffer]",Qr="[object DataView]",Wr="[object Float32Array]",Jr="[object Float64Array]",Xr="[object Int8Array]",ei="[object Int16Array]",ti="[object Int32Array]",ri="[object Uint8Array]",ii="[object Uint8ClampedArray]",ni="[object Uint16Array]",ai="[object Uint32Array]",b={};b[Wr]=b[Jr]=b[Xr]=b[ei]=b[ti]=b[ri]=b[ii]=b[ni]=b[ai]=!0;b[Dr]=b[Or]=b[Zr]=b[Rr]=b[Qr]=b[zr]=b[Ur]=b[Fr]=b[Vr]=b[Br]=b[Gr]=b[qr]=b[Hr]=b[Kr]=b[Yr]=!1;function oi(e){return we(e)&&$r(e.length)&&!!b[G(e)]}var li=oi;function si(e){return function(t){return e(t)}}var ui=si,Xe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,F=Xe&&typeof module=="object"&&module&&!module.nodeType&&module,ci=F&&F.exports===Xe,me=ci&&Ye.process,di=function(){try{var e=F&&F.require&&F.require("util").types;return e||me&&me.binding&&me.binding("util")}catch{}}(),ze=di,Ue=ze&&ze.isTypedArray,cs=Ue?ui(Ue):li;var pi=Object.prototype,ds=pi.hasOwnProperty;function gi(e,t){return function(r){return e(t(r))}}var mi=gi,ps=mi(Object.keys,Object);var fi=Object.prototype,gs=fi.hasOwnProperty;var yi=M(Object,"create"),V=yi;function bi(){this.__data__=V?V(null):{},this.size=0}var hi=bi;function vi(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var wi=vi,ki="__lodash_hash_undefined__",Ii=Object.prototype,Si=Ii.hasOwnProperty;function Ai(e){var t=this.__data__;if(V){var r=t[e];return r===ki?void 0:r}return Si.call(t,e)?t[e]:void 0}var xi=Ai,Ci=Object.prototype,Ei=Ci.hasOwnProperty;function ji(e){var t=this.__data__;return V?t[e]!==void 0:Ei.call(t,e)}var Mi=ji,$i="__lodash_hash_undefined__";function Ti(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=V&&t===void 0?$i:t,this}var Li=Ti;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=hi;$.prototype.delete=wi;$.prototype.get=xi;$.prototype.has=Mi;$.prototype.set=Li;var Fe=$;function Pi(){this.__data__=[],this.size=0}var _i=Pi;function Ni(e,t){for(var r=e.length;r--;)if(Er(e[r][0],t))return r;return-1}var re=Ni,Di=Array.prototype,Oi=Di.splice;function Ri(e){var t=this.__data__,r=re(t,e);if(r<0)return!1;var i=t.length-1;return r==i?t.pop():Oi.call(t,r,1),--this.size,!0}var zi=Ri;function Ui(e){var t=this.__data__,r=re(t,e);return r<0?void 0:t[r][1]}var Fi=Ui;function Vi(e){return re(this.__data__,e)>-1}var Bi=Vi;function Gi(e,t){var r=this.__data__,i=re(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}var qi=Gi;function T(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])}}T.prototype.clear=_i;T.prototype.delete=zi;T.prototype.get=Fi;T.prototype.has=Bi;T.prototype.set=qi;var ie=T,Hi=M(S,"Map"),B=Hi;function Ki(){this.size=0,this.__data__={hash:new Fe,map:new(B||ie),string:new Fe}}var Yi=Ki;function Zi(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Qi=Zi;function Wi(e,t){var r=e.__data__;return Qi(t)?r[typeof t=="string"?"string":"hash"]:r.map}var ne=Wi;function Ji(e){var t=ne(this,e).delete(e);return this.size-=t?1:0,t}var Xi=Ji;function en(e){return ne(this,e).get(e)}var tn=en;function rn(e){return ne(this,e).has(e)}var nn=rn;function an(e,t){var r=ne(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}var on=an;function L(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])}}L.prototype.clear=Yi;L.prototype.delete=Xi;L.prototype.get=tn;L.prototype.has=nn;L.prototype.set=on;var et=L;function ln(){this.__data__=new ie,this.size=0}var sn=ln;function un(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var cn=un;function dn(e){return this.__data__.get(e)}var pn=dn;function gn(e){return this.__data__.has(e)}var mn=gn,fn=200;function yn(e,t){var r=this.__data__;if(r instanceof ie){var i=r.__data__;if(!B||i.length<fn-1)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new et(i)}return r.set(e,t),this.size=r.size,this}var bn=yn;function q(e){var t=this.__data__=new ie(e);this.size=t.size}q.prototype.clear=sn;q.prototype.delete=cn;q.prototype.get=pn;q.prototype.has=mn;q.prototype.set=bn;var hn=Object.prototype,ms=hn.propertyIsEnumerable;var vn=M(S,"DataView"),ye=vn,wn=M(S,"Promise"),be=wn,kn=M(S,"Set"),he=kn,Ve="[object Map]",In="[object Object]",Be="[object Promise]",Ge="[object Set]",qe="[object WeakMap]",He="[object DataView]",Sn=x(ye),An=x(B),xn=x(be),Cn=x(he),En=x(fe),E=G;(ye&&E(new ye(new ArrayBuffer(1)))!=He||B&&E(new B)!=Ve||be&&E(be.resolve())!=Be||he&&E(new he)!=Ge||fe&&E(new fe)!=qe)&&(E=function(e){var t=G(e),r=t==In?e.constructor:void 0,i=r?x(r):"";if(i)switch(i){case Sn:return He;case An:return Ve;case xn:return Be;case Cn:return Ge;case En:return qe}return t});var fs=S.Uint8Array;var jn="__lodash_hash_undefined__";function Mn(e){return this.__data__.set(e,jn),this}var $n=Mn;function Tn(e){return this.__data__.has(e)}var Ln=Tn;function ve(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new et;++t<r;)this.add(e[t])}ve.prototype.add=ve.prototype.push=$n;ve.prototype.has=Ln;var Ke=j?j.prototype:void 0,ys=Ke?Ke.valueOf:void 0;var Pn=Object.prototype,bs=Pn.hasOwnProperty;var _n=Object.prototype,hs=_n.hasOwnProperty;var vs=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),ws=new RegExp(/[A-Fa-f0-9]{1}/,"g"),ks=new RegExp(/[A-Fa-f0-9]{2}/,"g");function ke(e){return{"image/png":"png","image/jpeg":"jpg","image/webp":"webp","image/gif":"gif","image/svg+xml":"svg"}[e]??"png"}async function H(e,t){if(e.startsWith("buffer:")){let r=await t.editor.getMimeType(e),i=t.editor.getBufferLength(e),a=t.editor.getBufferData(e,0,i),n=new Uint8Array(a),l=new Blob([n],{type:r});return URL.createObjectURL(l)}else return e}async function tt(e,t){let r=await H(e,t);return new Promise((i,a)=>{let n=new Image;n.onload=()=>{i({width:n.width,height:n.height})},n.onerror=a,n.src=r})}async function rt(e,t,r){let i,a=t.block.getFill(e),n=t.block.getSourceSet(a,"fill/image/sourceSet"),[l]=n;if(l==null){if(i=t.block.getString(a,"fill/image/imageFileURI"),i==null)throw new Error("No image source/uri found")}else i=l.uri;if(r?.throwErrorIfSvg&&await t.editor.getMimeType(i)==="image/svg+xml")throw new Error("SVG images are not supported");return H(i,t)}function Nn(e){return e!==void 0}var ae=Nn;var oe={Formats:Ot};var Dn=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 a=i;return{id:a.id,label:{en:a.label},meta:a.thumbUri?{...a.meta??{},thumbUri:a.thumbUri}:a.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:a,query:n,tags:l,groups:s,excludeGroups:f,sortingOrder:g,sortKey:d}=e,u=[...this.assets];if(s&&s.length>0&&(u=u.filter(o=>o.groups&&s.some(c=>o.groups?.includes(c)))),f&&f.length>0&&(u=u.filter(o=>!o.groups||!f.some(c=>o.groups?.includes(c)))),n){let o=n.toLowerCase();u=u.filter(c=>{let p=c.label?.[i]?.toLowerCase(),m=c.tags?.[i]||[];return p&&p.includes(o)||m.some(pe=>pe.toLowerCase().includes(o))})}if(l&&l.length>0){let o=Array.isArray(l)?l:[l];u=u.filter(c=>{let p=c.tags?.[i]||[];return o.some(m=>p.includes(m))})}a&&u.sort((o,c)=>{let p=this.activeAssetIds.has(o.id),m=this.activeAssetIds.has(c.id);return p&&!m?-1:!p&&m?1:0}),d&&d!=="id"?u.sort((o,c)=>{let p=o.meta?.[d],m=c.meta?.[d];return p===void 0?1:m===void 0?-1:typeof p=="string"&&typeof m=="string"?g==="Descending"?m.localeCompare(p):p.localeCompare(m):typeof p=="number"&&typeof m=="number"?g==="Descending"?m-p:p-m:0}):d==="id"&&u.sort((o,c)=>g==="Descending"?c.id.localeCompare(o.id):o.id.localeCompare(c.id));let w=u.length,v=t*r,I=v+r,y=u.slice(v,I).map(o=>{let c=o.label?.[i]||"",p=this.translateLabel?this.translateLabel(o.id,c,i):c;return{id:o.id,groups:o.groups,meta:o.meta,payload:o.payload,locale:i,label:p,tags:o.tags?.[i],active:this.activeAssetIds.has(o.id)}}),k=I<w?t+1:void 0;return{assets:y,currentPage:t,nextPage:k,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 On=typeof global=="object"&&global&&global.Object===Object&&global,ht=On,Rn=typeof self=="object"&&self&&self.Object===Object&&self,zn=ht||Rn||Function("return this")(),A=zn,Un=A.Symbol,_=Un,vt=Object.prototype,Fn=vt.hasOwnProperty,Vn=vt.toString,K=_?_.toStringTag:void 0;function Bn(e){var t=Fn.call(e,K),r=e[K];try{e[K]=void 0;var i=!0}catch{}var a=Vn.call(e);return i&&(t?e[K]=r:delete e[K]),a}var Gn=Bn,qn=Object.prototype,Hn=qn.toString;function Kn(e){return Hn.call(e)}var Yn=Kn,Zn="[object Null]",Qn="[object Undefined]",it=_?_.toStringTag:void 0;function Wn(e){return e==null?e===void 0?Qn:Zn:it&&it in Object(e)?Gn(e):Yn(e)}var W=Wn;function Jn(e){return e!=null&&typeof e=="object"}var Te=Jn,As=Array.isArray;function Xn(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var wt=Xn,ea="[object AsyncFunction]",ta="[object Function]",ra="[object GeneratorFunction]",ia="[object Proxy]";function na(e){if(!wt(e))return!1;var t=W(e);return t==ta||t==ra||t==ea||t==ia}var aa=na,oa=A["__core-js_shared__"],Ie=oa,nt=function(){var e=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function la(e){return!!nt&&nt in e}var sa=la,ua=Function.prototype,ca=ua.toString;function da(e){if(e!=null){try{return ca.call(e)}catch{}try{return e+""}catch{}}return""}var C=da,pa=/[\\^$.*+?()[\]{}|]/g,ga=/^\[object .+?Constructor\]$/,ma=Function.prototype,fa=Object.prototype,ya=ma.toString,ba=fa.hasOwnProperty,ha=RegExp("^"+ya.call(ba).replace(pa,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function va(e){if(!wt(e)||sa(e))return!1;var t=aa(e)?ha:ga;return t.test(C(e))}var wa=va;function ka(e,t){return e?.[t]}var Ia=ka;function Sa(e,t){var r=Ia(e,t);return wa(r)?r:void 0}var N=Sa,Aa=N(A,"WeakMap"),xe=Aa;function xa(e,t){return e===t||e!==e&&t!==t}var Ca=xa,Ea=9007199254740991;function ja(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Ea}var Ma=ja,xs=Object.prototype,$a="[object Arguments]";function Ta(e){return Te(e)&&W(e)==$a}var at=Ta,kt=Object.prototype,La=kt.hasOwnProperty,Pa=kt.propertyIsEnumerable,Cs=at(function(){return arguments}())?at:function(e){return Te(e)&&La.call(e,"callee")&&!Pa.call(e,"callee")},It=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ot=It&&typeof module=="object"&&module&&!module.nodeType&&module,_a=ot&&ot.exports===It,lt=_a?A.Buffer:void 0,Es=lt?lt.isBuffer:void 0,Na="[object Arguments]",Da="[object Array]",Oa="[object Boolean]",Ra="[object Date]",za="[object Error]",Ua="[object Function]",Fa="[object Map]",Va="[object Number]",Ba="[object Object]",Ga="[object RegExp]",qa="[object Set]",Ha="[object String]",Ka="[object WeakMap]",Ya="[object ArrayBuffer]",Za="[object DataView]",Qa="[object Float32Array]",Wa="[object Float64Array]",Ja="[object Int8Array]",Xa="[object Int16Array]",eo="[object Int32Array]",to="[object Uint8Array]",ro="[object Uint8ClampedArray]",io="[object Uint16Array]",no="[object Uint32Array]",h={};h[Qa]=h[Wa]=h[Ja]=h[Xa]=h[eo]=h[to]=h[ro]=h[io]=h[no]=!0;h[Na]=h[Da]=h[Ya]=h[Oa]=h[Za]=h[Ra]=h[za]=h[Ua]=h[Fa]=h[Va]=h[Ba]=h[Ga]=h[qa]=h[Ha]=h[Ka]=!1;function ao(e){return Te(e)&&Ma(e.length)&&!!h[W(e)]}var oo=ao;function lo(e){return function(t){return e(t)}}var so=lo,St=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Y=St&&typeof module=="object"&&module&&!module.nodeType&&module,uo=Y&&Y.exports===St,Se=uo&&ht.process,co=function(){try{var e=Y&&Y.require&&Y.require("util").types;return e||Se&&Se.binding&&Se.binding("util")}catch{}}(),st=co,ut=st&&st.isTypedArray,js=ut?so(ut):oo,po=Object.prototype,Ms=po.hasOwnProperty;function go(e,t){return function(r){return e(t(r))}}var mo=go,$s=mo(Object.keys,Object),fo=Object.prototype,Ts=fo.hasOwnProperty,yo=N(Object,"create"),Z=yo;function bo(){this.__data__=Z?Z(null):{},this.size=0}var ho=bo;function vo(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var wo=vo,ko="__lodash_hash_undefined__",Io=Object.prototype,So=Io.hasOwnProperty;function Ao(e){var t=this.__data__;if(Z){var r=t[e];return r===ko?void 0:r}return So.call(t,e)?t[e]:void 0}var xo=Ao,Co=Object.prototype,Eo=Co.hasOwnProperty;function jo(e){var t=this.__data__;return Z?t[e]!==void 0:Eo.call(t,e)}var Mo=jo,$o="__lodash_hash_undefined__";function To(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Z&&t===void 0?$o:t,this}var Lo=To;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=ho;D.prototype.delete=wo;D.prototype.get=xo;D.prototype.has=Mo;D.prototype.set=Lo;var ct=D;function Po(){this.__data__=[],this.size=0}var _o=Po;function No(e,t){for(var r=e.length;r--;)if(Ca(e[r][0],t))return r;return-1}var le=No,Do=Array.prototype,Oo=Do.splice;function Ro(e){var t=this.__data__,r=le(t,e);if(r<0)return!1;var i=t.length-1;return r==i?t.pop():Oo.call(t,r,1),--this.size,!0}var zo=Ro;function Uo(e){var t=this.__data__,r=le(t,e);return r<0?void 0:t[r][1]}var Fo=Uo;function Vo(e){return le(this.__data__,e)>-1}var Bo=Vo;function Go(e,t){var r=this.__data__,i=le(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}var qo=Go;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=_o;O.prototype.delete=zo;O.prototype.get=Fo;O.prototype.has=Bo;O.prototype.set=qo;var se=O,Ho=N(A,"Map"),Q=Ho;function Ko(){this.size=0,this.__data__={hash:new ct,map:new(Q||se),string:new ct}}var Yo=Ko;function Zo(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Qo=Zo;function Wo(e,t){var r=e.__data__;return Qo(t)?r[typeof t=="string"?"string":"hash"]:r.map}var ue=Wo;function Jo(e){var t=ue(this,e).delete(e);return this.size-=t?1:0,t}var Xo=Jo;function el(e){return ue(this,e).get(e)}var tl=el;function rl(e){return ue(this,e).has(e)}var il=rl;function nl(e,t){var r=ue(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}var al=nl;function R(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])}}R.prototype.clear=Yo;R.prototype.delete=Xo;R.prototype.get=tl;R.prototype.has=il;R.prototype.set=al;var At=R;function ol(){this.__data__=new se,this.size=0}var ll=ol;function sl(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var ul=sl;function cl(e){return this.__data__.get(e)}var dl=cl;function pl(e){return this.__data__.has(e)}var gl=pl,ml=200;function fl(e,t){var r=this.__data__;if(r instanceof se){var i=r.__data__;if(!Q||i.length<ml-1)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new At(i)}return r.set(e,t),this.size=r.size,this}var yl=fl;function J(e){var t=this.__data__=new se(e);this.size=t.size}J.prototype.clear=ll;J.prototype.delete=ul;J.prototype.get=dl;J.prototype.has=gl;J.prototype.set=yl;var bl=Object.prototype,Ls=bl.propertyIsEnumerable,hl=N(A,"DataView"),Ce=hl,vl=N(A,"Promise"),Ee=vl,wl=N(A,"Set"),je=wl,dt="[object Map]",kl="[object Object]",pt="[object Promise]",gt="[object Set]",mt="[object WeakMap]",ft="[object DataView]",Il=C(Ce),Sl=C(Q),Al=C(Ee),xl=C(je),Cl=C(xe),P=W;(Ce&&P(new Ce(new ArrayBuffer(1)))!=ft||Q&&P(new Q)!=dt||Ee&&P(Ee.resolve())!=pt||je&&P(new je)!=gt||xe&&P(new xe)!=mt)&&(P=function(e){var t=W(e),r=t==kl?e.constructor:void 0,i=r?C(r):"";if(i)switch(i){case Il:return ft;case Sl:return dt;case Al:return pt;case xl:return gt;case Cl:return mt}return t});var Ps=A.Uint8Array,El="__lodash_hash_undefined__";function jl(e){return this.__data__.set(e,El),this}var Ml=jl;function $l(e){return this.__data__.has(e)}var Tl=$l;function Me(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new At;++t<r;)this.add(e[t])}Me.prototype.add=Me.prototype.push=Ml;Me.prototype.has=Tl;var yt=_?_.prototype:void 0,_s=yt?yt.valueOf:void 0,Ll=Object.prototype,Ns=Ll.hasOwnProperty,Pl=Object.prototype,Ds=Pl.hasOwnProperty,Os=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),Rs=new RegExp(/[A-Fa-f0-9]{1}/,"g"),zs=new RegExp(/[A-Fa-f0-9]{2}/,"g");function _l(e){return e!==void 0}var Nl=_l;function Dl(e){return e?.version?e.version.localeCompare("1.59.0",void 0,{numeric:!0,sensitivity:"base"})>=0&&typeof e.i18n?.translate=="function":!1}function Ol(e){return typeof e?.translate=="function"}function bt(e,t,r){return e&&Dl(e)&&Ol(e.i18n)?e.i18n.translate(t):r}function z(e,t){if(typeof e.i18n?.getTranslations!="function"){e.i18n.setTranslations(t);return}let r=Object.keys(t),i=e.i18n.getTranslations(r),a={};for(let n of r){let l=t[n];if(!l)continue;let s=i[n]??{},f={};for(let[g,d]of Object.entries(l))!(g in s)&&d!==void 0&&(f[g]=d);Object.keys(f).length>0&&(a[n]=f)}Object.keys(a).length>0&&e.i18n.setTranslations(a)}function Rl(e,t){let{cesdk:r}=t,i=t.propertyKey??"image_url",a=$e(e);return z(r,{en:{[`panel.${a}`]:"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."}}),zl(e,r),{[i]:(n,l)=>{let{builder:s,experimental:{global:f},payload:g}=n,d,u=n.providerConfig,w=n.config,v=u?.properties?.[l.id]??w?.properties?.[l.id];v?.default&&(typeof v.default=="function"?d=v.default({}):d=v.default);let I=d??g?.url??t.defaultUrl,y=f(`${e}.${l.id}`,I);return s.MediaPreview(l.id,{preview:{type:"image",uri:y.value},action:{label:"ly.img.ai.imageSelection.selectImage.label",onClick:()=>{r?.ui.openPanel(a,{payload:{onSelect:k=>{k.meta?.uri!=null&&y.setValue(k.meta?.uri)}}})}}}),()=>({id:l.id,type:"string",value:y.value})}}}function zl(e,t){t?.ui.registerPanel($e(e),({builder:r,payload:i})=>{r.Library(`${e}.library.image`,{entries:["ly.img.image"],onSelect:async a=>{let n=a?.meta?.uri;if(n==null)return;let l=await t.engine.editor.getMimeType(n);l==="image/svg+xml"?t.ui.showNotification({type:"warning",message:"ly.img.ai.imageSelection.error.svg"}):l.startsWith("image/")?(i?.onSelect(a),t?.ui.closePanel($e(e))):t.ui.showNotification({type:"warning",message:"ly.img.ai.imageSelection.error.invalidType"})}})})}function $e(e){return`ly.img.ai.${e}.imageSelection`}var Ul=Rl;function Fl(e,t){let{cesdk:r}=t;if(r==null)return{};let i=t.propertyKey??"style",a=Bl(e);z(r,{en:{[`panel.${a}`]:"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 n=ql({baseURL:t.baseURL??"https://cdn.img.ly/assets/plugins/plugin-ai-image-generation-web/v1/gpt-image-1/",includeNone:!0,cesdk:r}),l=n;t.styles!=null&&(Array.isArray(t.styles)?l=t.styles:typeof t.styles=="function"&&(l=t.styles(n)));let s=Hl({cesdk:r,providerId:e,styles:l}),f=s.id;return Kl(s,{cesdk:r}),Vl({providerId:e,cesdk:r,panelId:a,entryId:f}),{[t.propertyKeyForPrompt??"prompt"]:(g,d)=>{let u=g.state("prompt","");return g.builder.TextArea(`${d.id}`,{inputLabel:t.i18n?.prompt?.inputLabel??t.propertyKeyForPrompt??"prompt",placeholder:t.i18n?.prompt?.placeholder,...u}),()=>{let[w]=s.getActiveAssetIds(),v=s.getAsset(w);return{id:d.id,type:"string",value:v?.meta?.prompt==null?u.value:`${u.value}; ${v.meta.prompt}`}}},[i]:(g,d)=>{let{builder:u,state:w}=g;if(l.length>0){let v=w("style",l[0]);return u.Button(`${d.id}`,{inputLabel:`${e}.${d.id}`,icon:"@imgly/Appearance",isDisabled:l.length===0,trailingIcon:"@imgly/ChevronRight",label:v.value.label,labelAlignment:"left",onClick:()=>{let I={onSelect:async y=>{s.clearActiveAssets(),s.setAssetActive(y.id),v.setValue({id:y.id,label:y.label??y.id}),r.ui.closePanel(a)}};r.ui.openPanel(a,{payload:I})}}),()=>({id:d.id,type:"string",value:v.value.id})}return()=>({id:d.id,type:"string",value:"none"})}}}function Vl(e){let{providerId:t,cesdk:r,panelId:i,entryId:a}=e;r?.ui.registerPanel(i,({builder:n,payload:l})=>{l?.onSelect==null&&n.Section(`${t}.error`,{children:()=>{n.Text("error",{content:"No onSelect function provided for the style selection panel."})}}),n.Library(`${t}.library.image`,{entries:[a],onSelect:async s=>{l?.onSelect?.(s)}})})}function Bl(e){return`ly.img.ai.${e}.styleSelection`}var Gl=[{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 ql(e){return Gl.map(t=>t.id==="none"?e.includeNone?{id:t.id,label:bt(e.cesdk,t.labelKey,t.labelKey),prompt:t.prompt,thumbUri:`${e.baseURL}thumbnails/None.svg`}:void 0:{id:t.id,label:bt(e.cesdk,t.labelKey,t.labelKey),prompt:t.prompt,thumbUri:`${e.baseURL}thumbnails/${t.id}.jpeg`}).filter(Nl)}var Hl=e=>{let t=e.styles.map(l=>({...l,meta:{prompt:l.prompt}})),r=e.cesdk.engine.asset.findAllSources(),i=`${e.providerId}/styles`;for(;r.includes(i);)i+=`-${Math.random().toString(36).substring(2,5)}`;let a=new Dn(i,t),n=e.styles[0];return a.setAssetActive(n.id),a},Kl=(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"})},Yl=Fl;var xt=class Ct{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 Ct),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,a)=>{if(i===null){a(t,r);return}this.matchesFilters(t,i)&&a(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 Zl="ly.img.ai";function X(e){return`${Zl}.${e}`}function Ql(){return({engine:e})=>{let t=e.block.findAllSelected();if(t==null||t.length!==1)return!1;let[r]=t;if(!e.block.supportsFill(r)||e.block.getKind(r)==="sticker"||!["//ly.img.ubq/graphic","//ly.img.ubq/page"].includes(e.block.getType(r)))return!1;let i=e.block.getFill(r);return e.block.getType(i)==="//ly.img.ubq/fill/image"}}var Et=Ql;var Ae="@imgly/plugin-ai-generation",Us=`
<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="${Ae}/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="${Ae}/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="${Ae}/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 jt={ImageUrl:Ul,StyleTransfer:Yl};var Mt={openapi:"3.0.0",components:{schemas:{GptImage1Input:{title:"TextToImageInput",type:"object",properties:{prompt:{title:"Prompt",type:"string","x-imgly-builder":{component:"TextArea"}},style:{title:"Style",type:"string",description:"The style of the generated images."},size:{enum:["1024x1024","1536x1024","1024x1536"],type:"string",title:"Format",default:"1024x1024","x-imgly-enum-labels":{"1024x1024":"Square","1536x1024":"Landscape","1024x1536":"Portrait"},"x-imgly-enum-icons":{"1024x1024":"@imgly/plugin/formats/ratio1by1","1024x1536":"@imgly/plugin/formats/ratio3by4","1536x1024":"@imgly/plugin/formats/ratio4by3"}},background:{enum:["auto","transparent","opaque"],type:"string",title:"Background",default:"auto","x-imgly-enum-labels":{auto:"Auto",transparent:"Transparent",opaque:"Opaque"}}},"x-order-properties":["prompt","style","size","background"],required:["prompt"]}}}};function ce(e,t){let r=e.split(",")[1]||e,i=atob(r),a=[];for(let s=0;s<i.length;s++)a.push(i.charCodeAt(s));let n=new Uint8Array(a);return new Blob([n],{type:t})}var ee=[{id:"none",label:"None",prompt:""},{id:"anime-celshaded",label:"Anime",prompt:"anime cel\u2011shaded, bright pastel palette, expressive eyes, clean line art "},{id:"cyberpunk-neon",label:"Cyberpunk",prompt:"cyberpunk cityscape, glowing neon signage, reflective puddles, dark atmosphere"},{id:"kodak-portra-400",label:"Kodak 400",prompt:"shot on Kodak Portra 400, soft grain, golden\u2011hour warmth, 35 mm photo"},{id:"watercolor-storybook",label:"Watercolor",prompt:"loose watercolor washes, gentle gradients, dreamy storybook feel"},{id:"dark-fantasy-realism",label:"Dark Fantasy",prompt:"dark fantasy realm, moody chiaroscuro lighting, hyper\u2011real textures"},{id:"vaporwave-retrofuturism",label:"Vaporwave",prompt:"retro\u2011futuristic vaporwave, pastel sunset gradient, chrome text, VHS scanlines"},{id:"minimal-vector-flat",label:"Vector Flat",prompt:"minimalist flat vector illustration, bold geometry, two\u2011tone palette"},{id:"pixarstyle-3d-render",label:"3D Animation",prompt:"Pixar\u2011style 3D render, oversized eyes, subtle subsurface scattering, cinematic lighting"},{id:"ukiyoe-woodblock",label:"Ukiyo\u2011e",prompt:"ukiyo\u2011e woodblock print, Edo\u2011period style, visible washi texture, limited color ink"},{id:"surreal-dreamscape",label:"Surreal",prompt:"surreal dreamscape, floating objects, impossible architecture, vivid clouds"},{id:"steampunk-victorian",label:"Steampunk",prompt:"Victorian steampunk world, ornate brass gears, leather attire, atmospheric fog"},{id:"nightstreet-photo-bokeh",label:"Night Bokeh",prompt:"night\u2011time street shot, large aperture bokeh lights, candid urban mood"},{id:"comicbook-pop-art",label:"Pop Art",prompt:"classic comic\u2011book panel, halftone shading, exaggerated action lines, CMYK pop colors"}],$t=(e,t)=>{let r=ee.map(n=>n.id==="none"?t.includeNone?{id:n.id,label:n.label,thumbUri:`${t.baseURL}thumbnails/None.svg`}:void 0:{id:n.id,label:n.label,thumbUri:`${t.baseURL}thumbnails/${n.id}.jpeg`}).filter(ae),i=new te(e,r),a=ee[0];return i.setAssetActive(a.id),i},Tt=(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"})};function Lt(e){return async({cesdk:t})=>Jl(t,e)}function Jl(e,t){let r="open-ai/gpt-image-1/text2image",i="https://cdn.img.ly/assets/plugins/plugin-ai-image-generation-web/v1/gpt-image-1/",a=`${r}/styles`,n=$t(a,{baseURL:i,includeNone:!0});return Tt(n,{cesdk:e}),e.ui.registerPanel(`${X(r)}.styleSelection`,({builder:s,payload:f})=>{if(f==null)return null;s.Library(`${r}.library.style`,{entries:[a],onSelect:async g=>{f.onSelect(g)}})}),e.ui.addIconSet("@imgly/plugin/formats",oe.Formats),z(e,{en:{[`panel.${X(r)}.styleSelection`]:"Style Selection","panel.gpt-image-1.imageSelection":"Select Image To Change"}}),{id:"open-ai/gpt-image-1/text2image",kind:"image",name:"GPT Image 1",input:{panel:{type:"schema",document:Mt,inputReference:"#/components/schemas/GptImage1Input",includeHistoryLibrary:!0,orderExtensionKeyword:"x-order-properties",renderCustomProperty:{style:({builder:s,state:f},g)=>{let d=f("style",n.getAssetSelectValue(n.getActiveAssetIds()[0])??ee[0]);return s.Button(`${g.id}`,{inputLabel:[`ly.img.plugin-ai-image-generation-web.${r}.property.${g.id}`,`ly.img.plugin-ai-generation-web.property.${g.id}`,`ly.img.plugin-ai-image-generation-web.${r}.defaults.property.${g.id}`,`ly.img.plugin-ai-generation-web.defaults.property.${g.id}`],icon:"@imgly/Appearance",trailingIcon:"@imgly/ChevronRight",label:d.value.label,labelAlignment:"left",onClick:()=>{let u={onSelect:async w=>{let v={id:w.id,label:w.label??w.id};n.clearActiveAssets(),n.setAssetActive(w.id),d.setValue(v),e.ui.closePanel(`${X(r)}.styleSelection`)}};e.ui.openPanel(`${X(r)}.styleSelection`,{payload:u})}}),()=>({id:g.id,type:"string",value:d.value.id??n.getActiveAssetIds()[0]})}},getBlockInput:s=>{switch(s.size){case"auto":return Promise.resolve({image:{width:512,height:512}});case"1024x1024":return Promise.resolve({image:{width:1024,height:1024}});case"1536x1024":return Promise.resolve({image:{width:1536,height:1024}});case"1024x1536":return Promise.resolve({image:{width:1024,height:1536}});default:throw new Error("Invalid image size")}},userFlow:"placeholder"}},output:{abortable:!0,history:"@imgly/indexedDB",middleware:t.middlewares??t.middleware??[],generate:async(s,{abortSignal:f})=>{let g=ee.find(c=>c.id===s.style),d=s.prompt;g!=null&&g.id!=="none"&&g.prompt&&(d=`${d}, ${g.prompt}`);let u=e.ui.experimental.hasGlobalStateValue("OPENAI_API_KEY"),w=u?"https://api.openai.com/v1":t.proxyUrl,y=(await(await fetch(`${w}/images/generations`,{signal:f,method:"POST",headers:u?{Authorization:`Bearer ${e.ui.experimental.getGlobalStateValue("OPENAI_API_KEY")}`,"Content-Type":"application/json",...t.headers??{}}:{"Content-Type":"application/json",...t.headers??{}},body:JSON.stringify({model:"gpt-image-1",prompt:d,n:1,size:s.size,background:s.background})})).json()).data?.[0].b64_json;if(y==null)throw new Error("No image data returned");let k=ce(y,"image/png");return{kind:"image",url:URL.createObjectURL(k)}}}}}var Pt={openapi:"3.0.0",components:{schemas:{GptImage1Input:{title:"ImageToImageInput",type:"object",properties:{prompt:{title:"Prompt",type:"string","x-imgly-builder":{component:"TextArea"}},image_url:{title:"Image Url",type:"string",description:"Optional URL of an input image for editing."}},"x-order-properties":["image_url","prompt","background"],required:["image_url","prompt"]}}}};import{MimeType as is}from"@cesdk/cesdk-js";var _t="gpt-image-1.changeStyleLibrary",Le=`ly.img.${_t}`,de=`ly.img.plugin-ai-image-generation-web.quickAction.${_t}`,Pe=[{id:"none",label:"None",prompt:""},{id:"anime-celshaded",label:"Anime",prompt:"anime cel\u2011shaded, bright pastel palette, expressive eyes, clean line art "},{id:"cyberpunk-neon",label:"Cyberpunk",prompt:"cyberpunk cityscape, glowing neon signage, reflective puddles, dark atmosphere"},{id:"kodak-portra-400",label:"Kodak 400",prompt:"shot on Kodak Portra 400, soft grain, golden\u2011hour warmth, 35 mm photo"},{id:"watercolor-storybook",label:"Watercolor",prompt:"loose watercolor washes, gentle gradients, dreamy storybook feel"},{id:"dark-fantasy-realism",label:"Dark Fantasy",prompt:"dark fantasy realm, moody chiaroscuro lighting, hyper\u2011real textures"},{id:"vaporwave-retrofuturism",label:"Vaporwave",prompt:"retro\u2011futuristic vaporwave, pastel sunset gradient, chrome text, VHS scanlines"},{id:"minimal-vector-flat",label:"Vector Flat",prompt:"minimalist flat vector illustration, bold geometry, two\u2011tone palette"},{id:"pixarstyle-3d-render",label:"3D Animation",prompt:"Pixar\u2011style 3D render, oversized eyes, subtle subsurface scattering, cinematic lighting"},{id:"ukiyoe-woodblock",label:"Ukiyo\u2011e",prompt:"ukiyo\u2011e woodblock print, Edo\u2011period style, visible washi texture, limited color ink"},{id:"surreal-dreamscape",label:"Surreal",prompt:"surreal dreamscape, floating objects, impossible architecture, vivid clouds"},{id:"steampunk-victorian",label:"Steampunk",prompt:"Victorian steampunk world, ornate brass gears, leather attire, atmospheric fog"},{id:"nightstreet-photo-bokeh",label:"Night Bokeh",prompt:"night\u2011time street shot, large aperture bokeh lights, candid urban mood"},{id:"comicbook-pop-art",label:"Pop Art",prompt:"classic comic\u2011book panel, halftone shading, exaggerated action lines, CMYK pop colors"}],es=(e,t)=>{let r=Pe.map(n=>n.id==="none"?t.includeNone?{id:n.id,label:n.label,thumbUri:`${t.baseURL}thumbnails/None.svg`}:void 0:{id:n.id,label:n.label,thumbUri:`${t.baseURL}thumbnails/${n.id}.jpeg`}).filter(ae),i=new te(e,r),a=Pe[0];return i.setAssetActive(a.id),i},ts=(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"})},rs=e=>{let{cesdk:t,modelKey:r,baseURL:i}=e,a=`${r}/styles`,l=es(a,{baseURL:i??"https://cdn.img.ly/assets/plugins/plugin-ai-image-generation-web/v1/gpt-image-1/"});return ts(l,{cesdk:t}),z(t,{en:{[`${de}`]:"Change Style",[`${de}.description`]:"Apply different art styles to your image"}}),{id:Le,type:"quick",kind:"image",label:`${de}`,enable:Et(),scopes:["fill/change"],render:({builder:f,experimental:g,generate:d,engine:u,close:w})=>{g.builder.Popover(`${Le}.popover`,{label:`${de}`,icon:"@imgly/Appearance",labelAlignment:"left",variant:"plain",trailingIcon:"@imgly/ChevronRight",placement:"right",children:()=>{f.Library(`${Le}.popover.library`,{entries:[`${r}/styles`],onSelect:async v=>{try{let[I]=u.block.findAllSelected(),y=await rt(I,u,{throwErrorIfSvg:!0}),k=v.id,o=Pe.find(({id:c})=>c===k);if(o==null)throw new Error(`Style not found: ${k}`);await d({prompt:o.prompt,uri:y}),w()}catch(I){console.error("Generation error:",I)}}})}})}}},Nt=rs;function Dt(e){return async({cesdk:t})=>ns(t,e)}function ns(e,t){let r="open-ai/gpt-image-1/image2image";return e.ui.addIconSet("@imgly/plugin/formats",oe.Formats),xt.get().register(Nt({cesdk:e,modelKey:r,baseURL:"https://cdn.img.ly/assets/plugins/plugin-ai-image-generation-web/v1/gpt-image-1/"})),{id:r,kind:"image",name:"GPT Image 1",input:{panel:{type:"schema",document:Pt,inputReference:"#/components/schemas/GptImage1Input",includeHistoryLibrary:!0,orderExtensionKeyword:"x-order-properties",renderCustomProperty:{...e!=null?jt.ImageUrl("gpt-image-1",{cesdk:e}):{}},getBlockInput:async n=>{if(n.image_url==null||Array.isArray(n.image_url))throw new Error("Cannot process getBlockInput for multiple images");let{width:l,height:s}=await tt(n.image_url,e.engine);return Promise.resolve({image:{width:l,height:s}})},userFlow:"placeholder"},quickActions:{supported:{"ly.img.gpt-image-1.changeStyleLibrary":{mapInput:n=>({prompt:n.prompt,image_url:n.uri})},"ly.img.editImage":{mapInput:n=>({prompt:n.prompt,image_url:n.uri})},"ly.img.swapBackground":{mapInput:n=>({prompt:n.prompt,image_url:n.uri})},"ly.img.createVariant":{mapInput:n=>({prompt:n.prompt,image_url:n.uri})},"ly.img.combineImages":{mapInput:n=>({prompt:n.prompt,image_url:n.uris,exportFromBlockIds:n.exportFromBlockIds})},"ly.img.remixPage":{mapInput:n=>({prompt:n.prompt,image_url:n.uri})},"ly.img.remixPageWithPrompt":{mapInput:n=>({prompt:n.prompt,image_url:n.uri})}}}},output:{abortable:!0,history:"@imgly/indexedDB",middleware:t.middlewares??t.middleware??[],generate:async(n,{abortSignal:l})=>{let s=new FormData;if(Array.isArray(n.image_url))n.exportFromBlockIds!=null?await Promise.all(n.exportFromBlockIds.map(async y=>{let k=await e.engine.block.export(y,is.Jpeg,{targetHeight:1024,targetWidth:1024});s.append("image[]",k,`image_${y}.jpeg`)})):await Promise.all(n.image_url.map(async y=>{let k=await e.engine.editor.getMimeType(y),o=await H(y,e.engine),p=await(await fetch(o)).blob();s.append("image[]",p,`image.${ke(k)}`)}));else{let y=await e.engine.editor.getMimeType(n.image_url),k=await H(n.image_url,e.engine),c=await(await fetch(k)).blob();s.append("image",c,`image.${ke(y)}`)}s.append("prompt",n.prompt),s.append("model","gpt-image-1"),s.append("size","auto"),s.append("n","1");let f=e.ui.experimental.hasGlobalStateValue("OPENAI_API_KEY"),g=f?"https://api.openai.com/v1":t.proxyUrl,w=(await(await fetch(`${g}/images/edits`,{signal:l,method:"POST",headers:f?{Authorization:`Bearer ${e.ui.experimental.getGlobalStateValue("OPENAI_API_KEY")}`,...t.headers??{}}:{...t.headers??{}},body:s})).json()).data?.[0].b64_json;if(w==null)throw new Error("No image data returned");let v=ce(w,"image/png");return{kind:"image",url:URL.createObjectURL(v)}}}}}var as={GptImage1:{Text2Image:Lt,Image2Image:Dt}},bu=as;export{bu as default};
/*! Bundled license information:

lodash-es/lodash.js:
  (**
   * @license
   * Lodash (Custom Build) <https://lodash.com/>
   * Build: `lodash modularize exports="es" -o ./`
   * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
   * Released under MIT license <https://lodash.com/license>
   * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
   * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
   *)
*/
//# sourceMappingURL=index.mjs.map
