@imgly/plugin-ai-sticker-generation-web 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ import CreativeEditorSDK from '@cesdk/cesdk-js';
2
+ type CustomImageSize = {
3
+ width: number;
4
+ height: number;
5
+ };
6
+ export declare function isCustomImageSize(imageSize: any): imageSize is CustomImageSize;
7
+ export declare function uploadImageInputToFalIfNeeded(imageUrl?: string, cesdk?: CreativeEditorSDK): Promise<string | undefined>;
8
+ export {};
@@ -0,0 +1,3 @@
1
+ export declare const PLUGIN_ICON_SET_ID = "@imgly/plugin-ai-sticker-generation";
2
+ declare const iconSprite = "\n <svg>\n <symbol\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n id=\"@imgly/StickerVariation\"\n >\n <path d=\"M4.5 4H13.5C13.7761 4 14 4.22386 14 4.5V5H16V4.5C16 3.11929 14.8807 2 13.5 2H4.5C3.11929 2 2 3.11929 2 4.5V13.5C2 14.8807 3.11929 16 4.5 16H5V14H4.5C4.22386 14 4 13.7761 4 13.5V4.5C4 4.22386 4.22386 4 4.5 4Z\" fill=\"currentColor\"/>\n <path d=\"M15.9375 13.625C16.8695 13.625 17.625 12.8695 17.625 11.9375C17.625 11.0055 16.8695 10.25 15.9375 10.25C15.0055 10.25 14.25 11.0055 14.25 11.9375C14.25 12.8695 15.0055 13.625 15.9375 13.625Z\" fill=\"currentColor\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9.5 7C8.11929 7 7 8.11929 7 9.5V18.5C7 19.8807 8.11929 21 9.5 21H18.5C19.8807 21 21 19.8807 21 18.5V9.5C21 8.11929 19.8807 7 18.5 7H9.5ZM9 9.5C9 9.22386 9.22386 9 9.5 9H18.5C18.7761 9 19 9.22386 19 9.5V18.5C19 18.7761 18.7761 19 18.5 19H16.3351L12.7198 13.5771C12.4972 13.2432 12.0064 13.2432 11.7838 13.5771L9 17.7528V9.5Z\" fill=\"currentColor\"/>\n\n </symbol>\n </svg>\n";
3
+ export default iconSprite;
@@ -0,0 +1,10 @@
1
+ import { Output } from '@imgly/plugin-ai-generation-web';
2
+ import { type PluginConfiguration } from './types';
3
+ declare const Plugin: <I, O extends Output>(pluginConfiguration: PluginConfiguration<I, O>) => {
4
+ initialize: (context: import("@cesdk/engine").EnginePluginContext & {
5
+ cesdk?: import("@cesdk/cesdk-js").default;
6
+ }) => void;
7
+ name: string;
8
+ version: string;
9
+ };
10
+ export default Plugin;
package/dist/index.mjs ADDED
@@ -0,0 +1,117 @@
1
+ var Zt=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,l)=>{let c=e.locale??"en",d="",g=[];l.label!=null&&typeof l.label=="object"&&l.label[c]&&(d=l.label[c]),l.tags!=null&&typeof l.tags=="object"&&l.tags[c]&&(g=l.tags[c]);let p={...l,label:d,tags:g};return this.filterAsset(p,e)&&u.push(p),u},[]);t=await this.restoreBlobUrls(t),t=this.sortAssets(t,e);let{page:r,perPage:i}=e,n=r*i,o=n+i,a=t.slice(n,o),s=o<t.length?r+1:void 0;return{assets:a,currentPage:r,nextPage:s,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(o=>{o.groups&&Array.isArray(o.groups)&&o.groups.forEach(a=>i.add(a))});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;P(e,o=>{i.add(o)}),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=()=>{P(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((o,a)=>{let s=o.meta?.insertedAt||o._insertedAt||Date.now(),u=a.meta?.insertedAt||a._insertedAt||Date.now();return e==="asc"?s-u:u-s}),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,o])=>{let a={id:n,blob:o};i.put(a)}),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 P(e,i=>{r.add(i)}),await Promise.all([...r].map(async i=>{let n=await this.createBlobUrlFromStore(i);t[i]=n})),P(e,i=>t[i]??i)}filterAsset(e,t){let{query:r,tags:i,groups:n,excludeGroups:o}=t;if(r&&r.trim()!==""){let a=r.trim().toLowerCase().split(" "),s=e.label?.toLowerCase()??"",u=e.tags?.map(l=>l.toLowerCase())??[];if(!a.every(l=>s.includes(l)||u.some(c=>c.includes(l))))return!1}if(i){let a=Array.isArray(i)?i:[i];if(a.length>0&&(!e.tags||!a.every(s=>e.tags?.includes(s))))return!1}return!(n&&n.length>0&&(!e.groups||!n.some(a=>e.groups?.includes(a)))||o&&o.length>0&&e.groups&&e.groups.some(a=>o.includes(a)))}sortAssets(e,t){let{sortingOrder:r,sortKey:i,sortActiveFirst:n}=t,o=[...e];return!r||r==="None"||(i?o.sort((a,s)=>{let u,l;return i==="id"?(u=a.id,l=s.id):(u=a.meta?.[i]??null,l=s.meta?.[i]??null),u==null?r==="Ascending"?-1:1:l==null?r==="Ascending"?1:-1:typeof u=="string"&&typeof l=="string"?r==="Ascending"?u.localeCompare(l):l.localeCompare(u):r==="Ascending"?u<l?-1:u>l?1:0:u>l?-1:u<l?1:0}):r==="Descending"&&o.reverse(),n&&o.sort((a,s)=>a.active&&!s.active?-1:!a.active&&s.active?1:0)),o}};function P(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 o=t(e[i],n);typeof o=="string"&&(e[i]=o)}else e[i]=P(e[i],t,n)}return e}for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)){let n=e[i],o=r?`${r}.${i}`:i;if(typeof n=="string"&&n.startsWith("blob:")){let a=t(n,o);typeof a=="string"&&(e[i]=a)}else e[i]=P(n,t,o)}return e}var Yt=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 g=c.meta?.insertedAt||0;return(d.meta?.insertedAt||0)-g});let{page:n,perPage:o}=e,a=n*o,s=a+o,u=i.slice(a,s),l=s<i.length?n+1:void 0;return{assets:u,currentPage:n,nextPage:l,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")}};var Qt=typeof global=="object"&&global&&global.Object===Object&&global,We=Qt,Wt=typeof self=="object"&&self&&self.Object===Object&&self,Kt=We||Wt||Function("return this")(),C=Kt,Jt=C.Symbol,O=Jt,Ke=Object.prototype,Xt=Ke.hasOwnProperty,er=Ke.toString,H=O?O.toStringTag:void 0;function tr(e){var t=Xt.call(e,H),r=e[H];try{e[H]=void 0;var i=!0}catch{}var n=er.call(e);return i&&(t?e[H]=r:delete e[H]),n}var rr=tr,ir=Object.prototype,nr=ir.toString;function or(e){return nr.call(e)}var ar=or,sr="[object Null]",lr="[object Undefined]",Oe=O?O.toStringTag:void 0;function ur(e){return e==null?e===void 0?lr:sr:Oe&&Oe in Object(e)?rr(e):ar(e)}var K=ur;function cr(e){return e!=null&&typeof e=="object"}var Ie=cr,pu=Array.isArray;function dr(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Je=dr,gr="[object AsyncFunction]",pr="[object Function]",fr="[object GeneratorFunction]",hr="[object Proxy]";function mr(e){if(!Je(e))return!1;var t=K(e);return t==pr||t==fr||t==gr||t==hr}var br=mr,yr=C["__core-js_shared__"],ge=yr,De=function(){var e=/[^.]+$/.exec(ge&&ge.keys&&ge.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function vr(e){return!!De&&De in e}var wr=vr,kr=Function.prototype,Ir=kr.toString;function Cr(e){if(e!=null){try{return Ir.call(e)}catch{}try{return e+""}catch{}}return""}var E=Cr,Sr=/[\\^$.*+?()[\]{}|]/g,Ar=/^\[object .+?Constructor\]$/,xr=Function.prototype,Mr=Object.prototype,Er=xr.toString,jr=Mr.hasOwnProperty,_r=RegExp("^"+Er.call(jr).replace(Sr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Lr(e){if(!Je(e)||wr(e))return!1;var t=br(e)?_r:Ar;return t.test(E(e))}var Nr=Lr;function Pr(e,t){return e?.[t]}var Or=Pr;function Dr(e,t){var r=Or(e,t);return Nr(r)?r:void 0}var D=Dr,$r=D(C,"WeakMap"),be=$r;function Tr(e,t){return e===t||e!==e&&t!==t}var zr=Tr,Rr=9007199254740991;function Fr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Rr}var Ur=Fr,fu=Object.prototype,Vr="[object Arguments]";function Br(e){return Ie(e)&&K(e)==Vr}var $e=Br,Xe=Object.prototype,Gr=Xe.hasOwnProperty,Hr=Xe.propertyIsEnumerable,hu=$e(function(){return arguments}())?$e:function(e){return Ie(e)&&Gr.call(e,"callee")&&!Hr.call(e,"callee")},et=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Te=et&&typeof module=="object"&&module&&!module.nodeType&&module,qr=Te&&Te.exports===et,ze=qr?C.Buffer:void 0,mu=ze?ze.isBuffer:void 0,Zr="[object Arguments]",Yr="[object Array]",Qr="[object Boolean]",Wr="[object Date]",Kr="[object Error]",Jr="[object Function]",Xr="[object Map]",ei="[object Number]",ti="[object Object]",ri="[object RegExp]",ii="[object Set]",ni="[object String]",oi="[object WeakMap]",ai="[object ArrayBuffer]",si="[object DataView]",li="[object Float32Array]",ui="[object Float64Array]",ci="[object Int8Array]",di="[object Int16Array]",gi="[object Int32Array]",pi="[object Uint8Array]",fi="[object Uint8ClampedArray]",hi="[object Uint16Array]",mi="[object Uint32Array]",v={};v[li]=v[ui]=v[ci]=v[di]=v[gi]=v[pi]=v[fi]=v[hi]=v[mi]=!0;v[Zr]=v[Yr]=v[ai]=v[Qr]=v[si]=v[Wr]=v[Kr]=v[Jr]=v[Xr]=v[ei]=v[ti]=v[ri]=v[ii]=v[ni]=v[oi]=!1;function bi(e){return Ie(e)&&Ur(e.length)&&!!v[K(e)]}var yi=bi;function vi(e){return function(t){return e(t)}}var wi=vi,tt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Y=tt&&typeof module=="object"&&module&&!module.nodeType&&module,ki=Y&&Y.exports===tt,pe=ki&&We.process,Ii=function(){try{var e=Y&&Y.require&&Y.require("util").types;return e||pe&&pe.binding&&pe.binding("util")}catch{}}(),Re=Ii,Fe=Re&&Re.isTypedArray,bu=Fe?wi(Fe):yi,Ci=Object.prototype,yu=Ci.hasOwnProperty;function Si(e,t){return function(r){return e(t(r))}}var Ai=Si,vu=Ai(Object.keys,Object),xi=Object.prototype,wu=xi.hasOwnProperty,Mi=D(Object,"create"),Q=Mi;function Ei(){this.__data__=Q?Q(null):{},this.size=0}var ji=Ei;function _i(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Li=_i,Ni="__lodash_hash_undefined__",Pi=Object.prototype,Oi=Pi.hasOwnProperty;function Di(e){var t=this.__data__;if(Q){var r=t[e];return r===Ni?void 0:r}return Oi.call(t,e)?t[e]:void 0}var $i=Di,Ti=Object.prototype,zi=Ti.hasOwnProperty;function Ri(e){var t=this.__data__;return Q?t[e]!==void 0:zi.call(t,e)}var Fi=Ri,Ui="__lodash_hash_undefined__";function Vi(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Q&&t===void 0?Ui:t,this}var Bi=Vi;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=ji;$.prototype.delete=Li;$.prototype.get=$i;$.prototype.has=Fi;$.prototype.set=Bi;var Ue=$;function Gi(){this.__data__=[],this.size=0}var Hi=Gi;function qi(e,t){for(var r=e.length;r--;)if(zr(e[r][0],t))return r;return-1}var ae=qi,Zi=Array.prototype,Yi=Zi.splice;function Qi(e){var t=this.__data__,r=ae(t,e);if(r<0)return!1;var i=t.length-1;return r==i?t.pop():Yi.call(t,r,1),--this.size,!0}var Wi=Qi;function Ki(e){var t=this.__data__,r=ae(t,e);return r<0?void 0:t[r][1]}var Ji=Ki;function Xi(e){return ae(this.__data__,e)>-1}var en=Xi;function tn(e,t){var r=this.__data__,i=ae(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}var rn=tn;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=Hi;T.prototype.delete=Wi;T.prototype.get=Ji;T.prototype.has=en;T.prototype.set=rn;var se=T,nn=D(C,"Map"),W=nn;function on(){this.size=0,this.__data__={hash:new Ue,map:new(W||se),string:new Ue}}var an=on;function sn(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var ln=sn;function un(e,t){var r=e.__data__;return ln(t)?r[typeof t=="string"?"string":"hash"]:r.map}var le=un;function cn(e){var t=le(this,e).delete(e);return this.size-=t?1:0,t}var dn=cn;function gn(e){return le(this,e).get(e)}var pn=gn;function fn(e){return le(this,e).has(e)}var hn=fn;function mn(e,t){var r=le(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}var bn=mn;function z(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}z.prototype.clear=an;z.prototype.delete=dn;z.prototype.get=pn;z.prototype.has=hn;z.prototype.set=bn;var rt=z;function yn(){this.__data__=new se,this.size=0}var vn=yn;function wn(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var kn=wn;function In(e){return this.__data__.get(e)}var Cn=In;function Sn(e){return this.__data__.has(e)}var An=Sn,xn=200;function Mn(e,t){var r=this.__data__;if(r instanceof se){var i=r.__data__;if(!W||i.length<xn-1)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new rt(i)}return r.set(e,t),this.size=r.size,this}var En=Mn;function J(e){var t=this.__data__=new se(e);this.size=t.size}J.prototype.clear=vn;J.prototype.delete=kn;J.prototype.get=Cn;J.prototype.has=An;J.prototype.set=En;var jn=Object.prototype,ku=jn.propertyIsEnumerable,_n=D(C,"DataView"),ye=_n,Ln=D(C,"Promise"),ve=Ln,Nn=D(C,"Set"),we=Nn,Ve="[object Map]",Pn="[object Object]",Be="[object Promise]",Ge="[object Set]",He="[object WeakMap]",qe="[object DataView]",On=E(ye),Dn=E(W),$n=E(ve),Tn=E(we),zn=E(be),N=K;(ye&&N(new ye(new ArrayBuffer(1)))!=qe||W&&N(new W)!=Ve||ve&&N(ve.resolve())!=Be||we&&N(new we)!=Ge||be&&N(new be)!=He)&&(N=function(e){var t=K(e),r=t==Pn?e.constructor:void 0,i=r?E(r):"";if(i)switch(i){case On:return qe;case Dn:return Ve;case $n:return Be;case Tn:return Ge;case zn:return He}return t});var Iu=C.Uint8Array,Rn="__lodash_hash_undefined__";function Fn(e){return this.__data__.set(e,Rn),this}var Un=Fn;function Vn(e){return this.__data__.has(e)}var Bn=Vn;function ke(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new rt;++t<r;)this.add(e[t])}ke.prototype.add=ke.prototype.push=Un;ke.prototype.has=Bn;var Ze=O?O.prototype:void 0,Cu=Ze?Ze.valueOf:void 0,Gn=Object.prototype,Su=Gn.hasOwnProperty,Hn=Object.prototype,Au=Hn.hasOwnProperty,xu=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),Mu=new RegExp(/[A-Fa-f0-9]{1}/,"g"),Eu=new RegExp(/[A-Fa-f0-9]{2}/,"g");async function it(e,t){if(e.startsWith("buffer:")){let r=await t.editor.getMimeType(e),i=t.editor.getBufferLength(e),n=t.editor.getBufferData(e,0,i),o=new Blob([n],{type:r});return URL.createObjectURL(o)}else return e}async function qn(e,t){let r=await it(e,t);return new Promise((i,n)=>{let o=new Image;o.onload=()=>{i({width:o.width,height:o.height})},o.onerror=n,o.src=r})}async function Zn(e,t,r){let i,n=t.block.getFill(e),o=t.block.getSourceSet(n,"fill/image/sourceSet"),[a]=o;if(a==null){if(i=t.block.getString(n,"fill/image/imageFileURI"),i==null)throw new Error("No image source/uri found")}else i=a.uri;if(r?.throwErrorIfSvg&&await t.editor.getMimeType(i)==="image/svg+xml")throw new Error("SVG images are not supported");return it(i,t)}function Yn(e){return e!==void 0}var Qn=Yn;var nt=class ot{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 ot),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))}},Wn=class at{constructor(){this.providers=new Map}static get(){let t="__imgly_provider_registry__",r=typeof window<"u"?window:globalThis;return r[t]||(r[t]=new at),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 Kn(e){let t=e.filter(r=>!!r);return r=>async(i,n)=>{let o=[],a=l=>{o.push(l)},s=async(l,c,d)=>{if(l>=t.length)return r(c,d);let g=t[l],p=async(b,m)=>s(l+1,b,m),h={...d,addDisposer:a};return g(c,h,p)},u={...n,addDisposer:a};return{result:await s(0,i,u),dispose:async()=>{for(let l=o.length-1;l>=0;l--)try{await o[l]()}catch(c){console.error("Error in disposer:",c)}o.length=0}}}}function Jn({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,o=Date.now();try{return n=await i(t,r),n}finally{n!=null&&(console.log(`Generation took ${Date.now()-o}ms`),console.log("Generation result:",JSON.stringify(n,null,2))),console.groupEnd()}}}var Xn=Jn;var fe="ly.img.ai.temp";async function eo(e,t){return e.engine.asset.findAllSources().includes(fe)||e.engine.asset.addLocalSource(fe),e.engine.asset.apply(fe,t)}function to(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 st(){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 ro(e,t=0,r="image/jpeg",i=.8){return new Promise((n,o)=>{try{let a=document.createElement("video");a.crossOrigin="anonymous",a.style.display="none",a.addEventListener("loadedmetadata",()=>{a.currentTime=Math.min(t,a.duration),a.addEventListener("seeked",()=>{let s=document.createElement("canvas");s.width=a.videoWidth,s.height=a.videoHeight;let u=s.getContext("2d");if(!u){document.body.removeChild(a),o(new Error("Failed to create canvas context"));return}u.drawImage(a,0,0,s.width,s.height);try{let l=s.toDataURL(r,i);document.body.removeChild(a),n(l)}catch(l){document.body.removeChild(a),o(new Error(`Failed to create thumbnail: ${l instanceof Error?l.message:String(l)}`))}},{once:!0})}),a.addEventListener("error",()=>{document.body.removeChild(a),o(new Error(`Failed to load video from ${e}`))}),a.src=e,document.body.appendChild(a)}catch(a){o(a)}})}function lt(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 io(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 Ce(e){return e instanceof Error&&e.name==="AbortError"}function no(e,t,r){let i=`${t}.iconSetAdded`;e.ui.experimental.hasGlobalStateValue(i)||(e.ui.addIconSet(t,r),e.ui.experimental.setGlobalStateValue(i,!0))}function ut(e,t,r){let i="ai-plugin-version",n="ai-plugin-version-warning-shown";try{let o=e.ui.experimental.getGlobalStateValue(i);o?o!==r&&(e.ui.experimental.getGlobalStateValue(n,!1)||(console.warn(`[IMG.LY AI Plugins] Version mismatch detected!
2
+ Plugin "${t}" is using version ${r}, but other AI plugins are using version ${o}.
3
+ This may cause compatibility issues. Please ensure all AI plugins (@imgly/plugin-ai-*) use the same version.
4
+ 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(o){console.debug("[IMG.LY AI Plugins] Could not check plugin version consistency:",o)}}function oo(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 o=t.ui.isPanelOpen(r);n.Button(`${r}.dock.button`,{label:`${r}.dock.label`,isSelected:o,icon:"@imgly/Sparkle",onClick:()=>{t.ui.findAllPanels().forEach(a=>{a.startsWith("ly.img.ai.")&&t.ui.closePanel(a),!o&&a==="//ly.img.panel/assetLibrary"&&t.ui.closePanel(a)}),o?t.ui.closePanel(r):t.ui.openPanel(r)}})})}var ct=oo;function ao(e,t){let{cesdk:r,provider:i,getInput:n}=t;console.error("Generation failed:",e),so(r,i.output.notification,()=>({input:n?.().input,error:e}))||r.ui.showNotification({type:"error",message:to(e)})}function so(e,t,r){let i=t?.error;if(i==null||!(typeof i.show=="function"?i.show(r()):i.show))return!1;let n=typeof i.message=="function"?i.message(r()):i.message??"common.ai-generation.failed",o=i.action!=null?{label:typeof i.action.label=="function"?i.action.label(r()):i.action.label,onClick:()=>{i?.action?.onClick(r())}}:void 0;return e.ui.showNotification({type:"error",message:n,action:o}),!0}var Ye=ao,lo="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIzIiBoZWlnaHQ9IjMyMyIgdmlld0JveD0iMCAwIDMyMyAzMjMiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIzMjMiIGhlaWdodD0iMzIzIiBmaWxsPSIjRTlFQkVEIi8+CjxnIG9wYWNpdHk9IjAuMyI+CjxwYXRoIGQ9Ik0xMTYgMTg0VjE5MS41QzExNiAxOTkuNzg0IDEyMi43MTYgMjA2LjUgMTMxIDIwNi41SDE5MUMxOTkuMjg0IDIwNi41IDIwNiAxOTkuNzg0IDIwNiAxOTEuNVYxMzEuNUMyMDYgMTIzLjIxNiAxOTkuMjg0IDExNi41IDE5MSAxMTYuNUwxOTAuOTk1IDEyNi41QzE5My43NTcgMTI2LjUgMTk2IDEyOC43MzkgMTk2IDEzMS41VjE5MS41QzE5NiAxOTQuMjYxIDE5My43NjEgMTk2LjUgMTkxIDE5Ni41SDEzMUMxMjguMjM5IDE5Ni41IDEyNiAxOTQuMjYxIDEyNiAxOTEuNVYxODRIMTE2WiIgZmlsbD0iIzhGOEY4RiIvPgo8cGF0aCBkPSJNMTY2LjQ5NCAxMDUuOTI0QzE2NS44NjkgMTA0LjM0MiAxNjMuNjI5IDEwNC4zNDIgMTYzLjAwNSAxMDUuOTI0TDE1OS43NDUgMTE0LjE5MUMxNTkuNTU0IDExNC42NzQgMTU5LjE3MiAxMTUuMDU3IDE1OC42ODggMTE1LjI0N0wxNTAuNDIyIDExOC41MDhDMTQ4LjgzOSAxMTkuMTMyIDE0OC44MzkgMTIxLjM3MiAxNTAuNDIyIDEyMS45OTZMMTU4LjY4OCAxMjUuMjU2QzE1OS4xNzIgMTI1LjQ0NyAxNTkuNTU0IDEyNS44MjkgMTU5Ljc0NSAxMjYuMzEzTDE2My4wMDUgMTM0LjU3OUMxNjMuNjI5IDEzNi4xNjIgMTY1Ljg2OSAxMzYuMTYyIDE2Ni40OTQgMTM0LjU3OUwxNjkuNzU0IDEyNi4zMTNDMTY5Ljk0NCAxMjUuODI5IDE3MC4zMjcgMTI1LjQ0NyAxNzAuODEgMTI1LjI1NkwxNzkuMDc3IDEyMS45OTZDMTgwLjY2IDEyMS4zNzIgMTgwLjY2IDExOS4xMzIgMTc5LjA3NyAxMTguNTA4TDE3MC44MSAxMTUuMjQ3QzE3MC4zMjcgMTE1LjA1NyAxNjkuOTQ0IDExNC42NzQgMTY5Ljc1NCAxMTQuMTkxTDE2Ni40OTQgMTA1LjkyNFoiIGZpbGw9IiM4RjhGOEYiLz4KPHBhdGggZD0iTTEzMy4wMDUgMTI4LjQyNEMxMzMuNjI5IDEyNi44NDIgMTM1Ljg2OSAxMjYuODQyIDEzNi40OTQgMTI4LjQyNEwxNDEuODc1IDE0Mi4wN0MxNDIuMDY2IDE0Mi41NTMgMTQyLjQ0OCAxNDIuOTM1IDE0Mi45MzIgMTQzLjEyNkwxNTYuNTc3IDE0OC41MDhDMTU4LjE2IDE0OS4xMzIgMTU4LjE2IDE1MS4zNzIgMTU2LjU3NyAxNTEuOTk2TDE0Mi45MzIgMTU3LjM3OEMxNDIuNDQ4IDE1Ny41NjggMTQyLjA2NiAxNTcuOTUxIDE0MS44NzUgMTU4LjQzNEwxMzYuNDk0IDE3Mi4wNzlDMTM1Ljg2OSAxNzMuNjYyIDEzMy42MjkgMTczLjY2MiAxMzMuMDA1IDE3Mi4wNzlMMTI3LjYyMyAxNTguNDM0QzEyNy40MzMgMTU3Ljk1MSAxMjcuMDUgMTU3LjU2OCAxMjYuNTY3IDE1Ny4zNzhMMTEyLjkyMiAxNTEuOTk2QzExMS4zMzkgMTUxLjM3MiAxMTEuMzM5IDE0OS4xMzIgMTEyLjkyMiAxNDguNTA4TDEyNi41NjcgMTQzLjEyNkMxMjcuMDUgMTQyLjkzNSAxMjcuNDMzIDE0Mi41NTMgMTI3LjYyMyAxNDIuMDdMMTMzLjAwNSAxMjguNDI0WiIgZmlsbD0iIzhGOEY4RiIvPgo8cGF0aCBkPSJNMTk1Ljk5OSAxODQuMDA0VjE5MS41MDJDMTk1Ljk5OSAxOTQuMjYzIDE5My43NjEgMTk2LjUwMiAxOTAuOTk5IDE5Ni41MDJIMTQ3LjY2OEwxNzIuODc5IDE1OC42ODRDMTc0LjM2MyAxNTYuNDU4IDE3Ny42MzUgMTU2LjQ1OCAxNzkuMTIgMTU4LjY4NEwxOTUuOTk5IDE4NC4wMDRaIiBmaWxsPSIjOEY4RjhGIi8+CjwvZz4KPC9zdmc+Cg==",Se=lo;function uo(e,t,r){switch(t){case"image":return co(e,r[t]);case"video":return go(e,r[t]);case"sticker":return po(e,r[t]);default:throw new Error(`Unsupported output kind for creating placeholder block: ${t}`)}}function co(e,t){let r=t.width,i=t.height;return{id:e,meta:{previewUri:Se,fillType:"//ly.img.ubq/fill/image",kind:"image",width:r,height:i}}}function go(e,t){let r=t.width,i=t.height;return{id:e,label:t.label,meta:{previewUri:Se,mimeType:"video/mp4",kind:"video",fillType:"//ly.img.ubq/fill/video",duration:t.duration.toString(),width:r,height:i}}}function po(e,t){let r=t.width,i=t.height;return{id:e,meta:{previewUri:Se,fillType:"//ly.img.ubq/fill/image",kind:"sticker",width:r,height:i}}}var fo=uo;async function ho(e,t,r,i){switch(t){case"image":{if(i.kind!=="image")throw new Error(`Output kind does not match the expected type: ${i.kind} (expected: image)`);return mo(e,r[t],i)}case"video":{if(i.kind!=="video")throw new Error(`Output kind does not match the expected type: ${i.kind} (expected: video)`);return bo(e,r[t],i)}case"audio":{if(i.kind!=="audio")throw new Error(`Output kind does not match the expected type: ${i.kind} (expected: audio)`);return yo(e,r[t],i)}case"sticker":{if(i.kind!=="sticker")throw new Error(`Output kind does not match the expected type: ${i.kind} (expected: sticker)`);return vo(e,r[t],i)}default:throw new Error(`Unsupported output kind for creating placeholder block: ${t}`)}}function mo(e,t,r){let i=t.width,n=t.height;return{id:e,label:t.label,meta:{uri:r.url,thumbUri:r.url,fillType:"//ly.img.ubq/fill/image",kind:"image",width:i,height:n},payload:{sourceSet:[{uri:r.url,width:i,height:n}]}}}async function bo(e,t,r){let i=t.width,n=t.height,o=await ro(r.url,0);return{id:e,label:t.label,meta:{uri:r.url,thumbUri:o,mimeType:"video/mp4",kind:"video",fillType:"//ly.img.ubq/fill/video",duration:t.duration.toString(),width:i,height:n}}}function yo(e,t,r){return{id:e,label:t.label,meta:{uri:r.url,thumbUri:r.thumbnailUrl,blockType:"//ly.img.ubq/audio",mimeType:"audio/x-m4a",duration:r.duration.toString()}}}function vo(e,t,r){let i=t.width,n=t.height;return{id:e,label:t.label,meta:{uri:r.url,thumbUri:r.url,fillType:"//ly.img.ubq/fill/image",kind:"sticker",width:i,height:n},payload:{sourceSet:[{uri:r.url,width:i,height:n}]}}}var dt=ho;function wo(e){switch(e.userFlow){case"placeholder":return Io(e);case"generation-only":return ko(e);default:throw new Error(`Unknown user flow: ${e.userFlow}. Expected 'placeholder' or 'generation-only'.`)}}function ko(e){let{cesdk:t,abortSignal:r}=e;return async i=>{try{let n=e.kind,o=await e.getBlockInput(i);if(A(t,r))return{status:"aborted"};let a=await e.generate(i,{middlewares:[...e.middlewares??[]],debug:e.debug,dryRun:e.dryRun,abortSignal:r});if(A(t,r))return{status:"aborted"};if(a.status!=="success")return a;if(a.type==="async")throw new Error("Async generation is not supported in this context yet.");if(A(t,r))return{status:"aborted"};if(e.historyAssetSourceId!=null){let s=st(),u=await dt(s,n,o,a.output),l={...u,id:`${Date.now()}-${u.id}`,label:u.label!=null?{en:u.label}:{},tags:{}};t.engine.asset.addAssetToSource(e.historyAssetSourceId,l)}else e.debug&&console.log("No asset source ID found in history and generation only was requested. Doing nothing. If no middleware is adding functionality this could be a bug.");return a}catch(n){return{status:"error",message:n instanceof Error?n.message:String(n)}}}}function Io(e){let{cesdk:t,abortSignal:r}=e,i;return async n=>{try{let o=e.kind,a=await e.getBlockInput(n);if(A(t,r))return{status:"aborted"};let s=st(),u=fo(s,o,a);if(i=await eo(t,u),A(t,r,i))return{status:"aborted"};if(i!=null&&e.kind==="video"){let d=t.engine.block.getPositionX(i),g=t.engine.block.getPositionY(i),p=t.engine.block.duplicate(i);t.engine.block.setPositionX(p,d),t.engine.block.setPositionY(p,g),t.engine.block.destroy(i),i=p}if(i==null)throw new Error("Could not create placeholder block");t.engine.block.setState(i,{type:"Pending",progress:0});let l=await e.generate(n,{middlewares:[...e.middlewares??[]],debug:e.debug,dryRun:e.dryRun,abortSignal:r});if(A(t,r,i))return{status:"aborted"};if(l.status!=="success")return l;if(l.type==="async")throw new Error("Async generation is not supported in this context yet.");if(!t.engine.block.isValid(i))return{status:"aborted",message:"Placeholder block was destroyed before generation completed."};let c=await dt(s,o,a,l.output);if(A(t,r,i))return{status:"aborted"};if(e.debug&&console.log("Updating placeholder in scene:",JSON.stringify(c,void 0,2)),await t.engine.asset.defaultApplyAssetToBlock(c,i),A(t,r,i))return{status:"aborted"};if(e.historyAssetSourceId!=null){let d={...c,id:`${Date.now()}-${c.id}`,label:c.label!=null?{en:c.label}:{},tags:{}};t.engine.asset.addAssetToSource(e.historyAssetSourceId,d)}return t.engine.block.isValid(i)&&t.engine.block.setState(i,{type:"Ready"}),l}catch(o){return i!=null&&t.engine.block.isValid(i)&&(Ce(o)?t.engine.block.destroy(i):t.engine.block.setState(i,{type:"Error",error:"Unknown"})),{status:"error",message:o instanceof Error?o.message:String(o)}}}}function A(e,t,r){return t.aborted?(r!=null&&e.engine.block.isValid(r)&&e.engine.block.destroy(r),!0):!1}var Co=wo;function Ae(e){return`${e}.generating`}function So(e){return`${e}.abort`}function Ao(e,t,r,i,n,o,a){let{builder:s,experimental:u}=e,{cesdk:l,includeHistoryLibrary:c=!0}=o,{id:d,output:{abortable:g}}=t,p=u.global(So(d),()=>{}),h=u.global(Ae(d),!1),b,m=h.value&&g,f=()=>{m&&(p.value(),h.setValue(!1),p.setValue(()=>{}))},L;if(o.requiredInputs!=null&&o.requiredInputs.length>0){let I=i();L=o.requiredInputs.every(k=>!I.input[k])}let y=u.global(`${d}.confirmationDialogId`,void 0);s.Section(`${d}.generate.section`,{children:()=>{s.Button(`${d}.generate`,{label:["common.generate",`panel.${d}.generate`],isLoading:h.value,color:"accent",isDisabled:L,suffix:m?{icon:"@imgly/Cross",color:"danger",tooltip:[`panel.${d}.abort`,"common.cancel"],onClick:()=>{let I=l.ui.showDialog({type:"warning",content:"panel.ly.img.ai.generation.confirmCancel.content",cancel:{label:"common.close",onClick:({id:k})=>{l.ui.closeDialog(k),y.setValue(void 0)}},actions:{label:"panel.ly.img.ai.generation.confirmCancel.confirm",color:"danger",onClick:({id:k})=>{f(),l.ui.closeDialog(k),y.setValue(void 0)}}});y.setValue(I)}}:void 0,onClick:async()=>{b=new AbortController;let I=b.signal;await(async()=>{try{h.setValue(!0),p.setValue(()=>{a.debug&&console.log("Aborting generation"),b?.abort()});let k=await Co({kind:t.kind,generate:r,historyAssetSourceId:o.historyAssetSourceId,userFlow:o.createPlaceholderBlock?"placeholder":"generation-only",getBlockInput:n,abortSignal:I,cesdk:l,debug:a.debug,dryRun:a.dryRun})(i().input);if(k.status==="aborted")return;if(k.status==="error"){Ye(k.message,{cesdk:l,provider:t,getInput:i});return}if(k.status==="success"&&k.type==="sync"){let M=t.output.notification;xo(l,M,()=>({input:i().input,output:k.output}))}}catch(k){if(Ce(k))return;Ye(k,{cesdk:l,provider:t,getInput:i})}finally{b=void 0,h.setValue(!1),p.setValue(()=>{}),y.value!=null&&(l.ui.closeDialog(y.value),y.setValue(void 0))}})()}}),t.output.generationHintText!=null&&s.Text(`${d}.generation-hint`,{align:"center",content:t.output.generationHintText})}}),c&&o.historyAssetLibraryEntryId!=null&&s.Library(`${d}.history.library`,{entries:[o.historyAssetLibraryEntryId]})}function xo(e,t,r){let i=t?.success;if(i==null||!(typeof i.show=="function"?i.show(r()):i.show))return!1;let n=typeof i.message=="function"?i.message(r()):i.message??"common.ai-generation.success",o=i.action!=null?{label:typeof i.action.label=="function"?i.action.label(r()):i.action.label,onClick:()=>{i?.action?.onClick(r())}}:void 0;return e.ui.showNotification({type:"success",message:n,action:o,duration:i.duration}),!0}var gt=Ao;async function Mo({options:e,provider:t,panelInput:r,config:i},n){if(r==null)return;let{cesdk:o}=e,{id:a}=t,s=r.render;return u=>{let{state:l}=u,c=l(Ae(a),{isGenerating:!1,abort:()=>{}}).value.isGenerating,{getInput:d,getBlockInput:g}=s(u,{cesdk:o,isGenerating:c});return gt(u,t,n,d,g,{...e,includeHistoryLibrary:r.includeHistoryLibrary??!0,createPlaceholderBlock:r.userFlow==="placeholder"},i),d}}var Eo=Mo;function pt(e,t){if(!t.startsWith("#/"))throw new Error(`External references are not supported: ${t}`);let r=t.substring(2).split("/"),i=e;for(let n of r){if(i==null)throw new Error(`Invalid reference path: ${t}`);i=i[n]}if(i===void 0)throw new Error(`Reference not found: ${t}`);return i}function Z(e,t,r=new Set){if(t==null||r.has(t))return t;if(r.add(t),t.$ref&&typeof t.$ref=="string"){let i=pt(e,t.$ref),n={...Z(e,i,r)};for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&o!=="$ref"&&(n[o]=Z(e,t[o],r));return n}if(Array.isArray(t))return t.map(i=>Z(e,i,r));if(typeof t=="object"){let i={};for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=Z(e,t[n],r));return i}return t}function jo(e){return Z(e,{...e})}function _o(e,t=!1){let r=a=>(t&&console.log(`OpenAPI Schema validation failed: ${a}`),!1);if(typeof e!="object"||e===null)return r(`Input is ${e===null?"null":typeof e}, not an object`);let i=e;if(!(typeof i.type=="string"||Array.isArray(i.enum)||typeof i.properties=="object"||typeof i.items=="object"||typeof i.allOf=="object"||typeof i.anyOf=="object"||typeof i.oneOf=="object"||typeof i.not=="object"))return r("Missing required schema-defining properties (type, enum, properties, items, allOf, anyOf, oneOf, not)");if(i.type!==void 0){let a=["string","number","integer","boolean","array","object","null"];if(typeof i.type=="string"){if(!a.includes(i.type))return r(`Invalid type: ${i.type}. Must be one of ${a.join(", ")}`)}else if(Array.isArray(i.type)){for(let s of i.type)if(typeof s!="string"||!a.includes(s))return r(`Array of types contains invalid value: ${s}. Must be one of ${a.join(", ")}`)}else return r(`Type must be a string or array of strings, got ${typeof i.type}`)}if(i.items!==void 0&&(typeof i.items!="object"||i.items===null))return r(`Items must be an object, got ${i.items===null?"null":typeof i.items}`);if(i.properties!==void 0&&(typeof i.properties!="object"||i.properties===null))return r(`Properties must be an object, got ${i.properties===null?"null":typeof i.properties}`);let n=["allOf","anyOf","oneOf"];for(let a of n)if(i[a]!==void 0){if(!Array.isArray(i[a]))return r(`${a} must be an array, got ${typeof i[a]}`);for(let s=0;s<i[a].length;s++){let u=i[a][s];if(typeof u!="object"||u===null)return r(`Item ${s} in ${a} must be an object, got ${u===null?"null":typeof u}`)}}if(i.not!==void 0&&(typeof i.not!="object"||i.not===null))return r(`'not' must be an object, got ${i.not===null?"null":typeof i.not}`);if(i.additionalProperties!==void 0&&typeof i.additionalProperties!="boolean"&&(typeof i.additionalProperties!="object"||i.additionalProperties===null))return r(`additionalProperties must be a boolean or an object, got ${i.additionalProperties===null?"null":typeof i.additionalProperties}`);if(i.format!==void 0&&typeof i.format!="string")return r(`format must be a string, got ${typeof i.format}`);let o=["minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf"];for(let a of o)if(i[a]!==void 0&&typeof i[a]!="number")return r(`${a} must be a number, got ${typeof i[a]}`);if(i.minLength!==void 0&&(typeof i.minLength!="number"||i.minLength<0))return r(`minLength must be a non-negative number, got ${typeof i.minLength=="number"?i.minLength:typeof i.minLength}`);if(i.maxLength!==void 0&&(typeof i.maxLength!="number"||i.maxLength<0))return r(`maxLength must be a non-negative number, got ${typeof i.maxLength=="number"?i.maxLength:typeof i.maxLength}`);if(i.pattern!==void 0&&typeof i.pattern!="string")return r(`pattern must be a string, got ${typeof i.pattern}`);if(i.minItems!==void 0&&(typeof i.minItems!="number"||i.minItems<0))return r(`minItems must be a non-negative number, got ${typeof i.minItems=="number"?i.minItems:typeof i.minItems}`);if(i.maxItems!==void 0&&(typeof i.maxItems!="number"||i.maxItems<0))return r(`maxItems must be a non-negative number, got ${typeof i.maxItems=="number"?i.maxItems:typeof i.maxItems}`);if(i.uniqueItems!==void 0&&typeof i.uniqueItems!="boolean")return r(`uniqueItems must be a boolean, got ${typeof i.uniqueItems}`);if(i.minProperties!==void 0&&(typeof i.minProperties!="number"||i.minProperties<0))return r(`minProperties must be a non-negative number, got ${typeof i.minProperties=="number"?i.minProperties:typeof i.minProperties}`);if(i.maxProperties!==void 0&&(typeof i.maxProperties!="number"||i.maxProperties<0))return r(`maxProperties must be a non-negative number, got ${typeof i.maxProperties=="number"?i.maxProperties:typeof i.maxProperties}`);if(i.required!==void 0){if(!Array.isArray(i.required))return r(`required must be an array, got ${typeof i.required}`);for(let a=0;a<i.required.length;a++){let s=i.required[a];if(typeof s!="string")return r(`Item ${a} in required array must be a string, got ${typeof s}`)}}return!0}function Lo(e,t){if(e.properties==null)throw new Error("Input schema must have properties");let r=e.properties,i=[];return No(e,t).forEach(n=>{let o=n,a=r[n]??void 0;i.push({id:o,schema:a})}),i}function No(e,t){let r=t.order;if(r!=null&&Array.isArray(r))return r;if(e.properties==null)throw new Error("Input schema must have properties");let i=e.properties,n=Object.keys(i),o=Po(e,t)??n;return r!=null&&typeof r=="function"&&(o=r(o)),[...new Set(o)]}function Po(e,t){if(t.orderExtensionKeyword==null)return;if(typeof t.orderExtensionKeyword!="string"&&!Array.isArray(t.orderExtensionKeyword))throw new Error("orderExtensionKeyword must be a string or an array of strings");let r=(typeof t.orderExtensionKeyword=="string"?[t.orderExtensionKeyword]:t.orderExtensionKeyword).find(i=>i in e);return r==null?void 0:e[r]}var ft=Lo;function ht(e,t,r,i,n,o){if(t.schema==null)return i.renderCustomProperty!=null&&i.renderCustomProperty[t.id]!=null?i.renderCustomProperty[t.id](e,t):void 0;let a=t,s=t.schema.type;if(i.renderCustomProperty!=null&&i.renderCustomProperty[t.id]!=null)return i.renderCustomProperty[t.id](e,t);switch(s){case"string":return t.schema.enum!=null?Oo(e,a,r,i,n,o):bt(e,a,r,i,n,o);case"boolean":return yt(e,a,r,i,n,o);case"number":case"integer":return vt(e,a,r,i,n,o);case"object":return mt(e,a,r,i,n,o);case"array":break;case void 0:{if(t.schema.anyOf!=null&&Array.isArray(t.schema.anyOf))return Do(e,a,r,i,n,o);break}default:console.error(`Unsupported property type: ${s}`)}}function mt(e,t,r,i,n,o){let a=ft(t.schema??{},i).reduce((s,u)=>{let l=ht(e,u,r,i,n,o);return l!=null&&(s[u.id]=l()),s},{});return()=>({id:t.id,type:"object",value:a})}function bt(e,t,r,i,n,o){let{builder:a,experimental:{global:s}}=e,{id:u}=t,l=`${r.id}.${u}`,c=t.schema.title??l,d=s(l,t.schema.default??""),g=$o(t.schema),p=g?.component!=null&&g?.component==="TextArea"?"TextArea":"TextInput";return a[p](l,{inputLabel:c,placeholder:n.i18n?.prompt,...d}),()=>({id:t.id,type:"string",value:d.value})}function Oo(e,t,r,i,n,o){let{builder:a,experimental:{global:s}}=e,{id:u}=t,l=`${r.id}.${u}`,c=t.schema.title??l,d=t.schema.enum!=null&&"x-imgly-enum-labels"in t.schema.enum&&typeof t.schema.enum["x-imgly-enum-labels"]=="object"?t.schema.enum["x-imgly-enum-labels"]:"x-imgly-enum-labels"in t.schema&&typeof t.schema["x-imgly-enum-labels"]=="object"?t.schema["x-imgly-enum-labels"]:{},g="x-imgly-enum-icons"in t.schema&&typeof t.schema["x-imgly-enum-icons"]=="object"?t.schema["x-imgly-enum-icons"]:{},p=(t.schema.enum??[]).map(m=>({id:m,label:d[m]??lt(m),icon:g[m]})),h=t.schema.default!=null?p.find(m=>m.id===t.schema.default)??p[0]:p[0],b=s(l,h);return a.Select(l,{inputLabel:c,values:p,...b}),()=>({id:t.id,type:"string",value:b.value.id})}function yt(e,t,r,i,n,o){let{builder:a,experimental:{global:s}}=e,{id:u}=t,l=`${r.id}.${u}`,c=t.schema.title??l,d=!!t.schema.default,g=s(l,d);return a.Checkbox(l,{inputLabel:c,...g}),()=>({id:t.id,type:"boolean",value:g.value})}function vt(e,t,r,i,n,o){let{builder:a,experimental:{global:s}}=e,{id:u}=t,l=`${r.id}.${u}`,c=t.schema.title??l,d=t.schema.minimum,g=t.schema.maximum,p=t.schema.default;p==null&&(d!=null?p=d:g!=null?p=g:p=0);let h=s(l,p);if(d!=null&&g!=null){let b=t.schema.type==="number"?.1:1;"x-imgly-step"in t.schema&&typeof t.schema["x-imgly-step"]=="number"&&(b=t.schema["x-imgly-step"]),a.Slider(l,{inputLabel:c,min:d,max:g,step:b,...h})}else a.NumberInput(l,{inputLabel:c,min:d,max:g,...h});return()=>({id:t.id,type:"integer",value:h.value})}function Do(e,t,r,i,n,o){let{builder:a,experimental:{global:s}}=e,{id:u}=t,l=`${r.id}.${u}`,c=t.schema.title??l,d=t.schema.anyOf??[],g=[],p={},h={};d.forEach((f,L)=>{let y=f.title??"common.custom",I=`${r.id}.${u}.anyOf[${L}]`,k="x-imgly-enum-labels"in t.schema&&typeof t.schema["x-imgly-enum-labels"]=="object"?t.schema["x-imgly-enum-labels"]:{},M="x-imgly-enum-icons"in t.schema&&typeof t.schema["x-imgly-enum-icons"]=="object"?t.schema["x-imgly-enum-icons"]:{};f.type==="string"?f.enum!=null?f.enum.forEach(oe=>{g.push({id:oe,label:k[oe]??lt(oe),icon:M[oe]})}):(p[I]=()=>bt(e,{id:I,schema:{...f,title:y}},r,i,n,o),g.push({id:I,label:k[y]??y,icon:M[y]})):f.type==="boolean"?(p[I]=()=>yt(e,{id:I,schema:{...f,title:y}},r,i,n,o),g.push({id:I,label:k[y]??y,icon:M[y]})):f.type==="integer"?(p[I]=()=>vt(e,{id:I,schema:{...f,title:y}},r,i,n,o),g.push({id:I,label:k[y]??y,icon:M[y]})):f.type==="array"||f.type==="object"&&(p[I]=()=>mt(e,{id:I,schema:{...f,title:y}},r,i,n,o),g.push({id:I,label:k[y]??y,icon:M[y]}))});let b=t.schema.default!=null?g.find(f=>f.id===t.schema.default)??g[0]:g[0],m=s(l,b);if(a.Select(l,{inputLabel:c,values:g,...m}),m.value.id in p){let f=p[m.value.id]();h[m.value.id]=f}return()=>{let f=h[m.value.id];return f!=null?{...f(),id:t.id}:{id:t.id,type:"string",value:m.value.id}}}function $o(e){if("x-imgly-builder"in e)return e["x-imgly-builder"]}var To=ht;async function zo({options:e,provider:t,panelInput:r,config:i},n){let{id:o}=t;if(r==null)return;i.debug&&console.log(`Registering schema-based panel input for provider ${o}`);let a=jo(r.document),s=pt(a,r.inputReference);if(!_o(s,i.debug))throw new Error(`Input reference '${r.inputReference}' does not resolve to a valid OpenAPI schema`);let u=s,l=ft(u,r);return c=>{let{builder:d}=c,g=[];d.Section(`${o}.schema.section`,{children:()=>{l.forEach(m=>{let f=To(c,m,t,r,e,i);f!=null&&(Array.isArray(f)?g.push(...f):g.push(f))})}});let p=g.map(m=>m()),h=m=>m.type==="object"?Object.entries(m.value).reduce((f,[L,y])=>(f[L]=h(y),f),{}):m.value,b=p.reduce((m,f)=>(m[f.id]=h(f),m),{});gt(c,t,n,()=>({input:b}),()=>r.getBlockInput(b),{...e,requiredInputs:u.required,createPlaceholderBlock:r.userFlow==="placeholder"},i)}}var Ro=zo;async function Fo(e,t){if(e.panelInput!=null)switch(e.panelInput.type){case"custom":return Eo(e,t);case"schema":return Ro(e,t);default:e.config.debug&&console.warn(`Invalid panel input type '${panelInput.type}' - skipping`)}}var Uo=Fo;function Vo(e){let{provider:t,options:{engine:r}}=e,i=t.output.history??"@imgly/local";if(i==null||i===!1)return;let n=r.asset.findAllSources();function o(){let a=`${t.id}.history`;for(;n.includes(a);)a+=`-${Math.random().toString(36).substring(2,6)}`;return a}if(i==="@imgly/local"){let a=o();return r.asset.addLocalSource(a),a}if(i==="@imgly/indexedDB"){let a=o();return r.asset.addSource(new Zt(a,r)),a}return i}var Bo=Vo;function Go(e,t){if(t==null||!t)return;let r=`${e.provider.id}.history.entry`;return e.options.cesdk.ui.addAssetLibraryEntry({id:r,sourceIds:[t],sortBy:{sortKey:"insertedAt",sortingOrder:"Descending"},canRemove:!0,gridItemHeight:"square",gridBackgroundType:"cover"}),r}var Ho=Go,he="@imgly/plugin-ai-generation",qo=`
5
+ <svg>
6
+ <symbol
7
+ fill="none"
8
+ xmlns="http://www.w3.org/2000/svg"
9
+ viewBox="0 0 24 24"
10
+ id="@imgly/Sparkle"
11
+ >
12
+ <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"/>
13
+ <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"/>
14
+ <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"/>
15
+
16
+ </symbol>
17
+
18
+ <symbol
19
+ fill="none"
20
+ xmlns="http://www.w3.org/2000/svg"
21
+ viewBox="0 0 24 24"
22
+ id="${he}/image"
23
+ >
24
+ <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"/>
25
+ <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"/>
26
+ <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"/>
27
+ <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"/>
28
+
29
+ </symbol>
30
+ <symbol
31
+ fill="none"
32
+ xmlns="http://www.w3.org/2000/svg"
33
+ viewBox="0 0 24 24"
34
+ id="${he}/video"
35
+ >
36
+ <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"/>
37
+ <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"/>
38
+ <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"/>
39
+ <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"/>
40
+ </symbol>
41
+ <symbol
42
+ fill="none"
43
+ xmlns="http://www.w3.org/2000/svg"
44
+ viewBox="0 0 24 24"
45
+ id="${he}/audio"
46
+ >
47
+ <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"/>
48
+ <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"/>
49
+ <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"/>
50
+ </symbol>
51
+ <symbol
52
+ fill="none"
53
+ xmlns="http://www.w3.org/2000/svg"
54
+ viewBox="0 0 24 24"
55
+ id="@imgly/MixingPlate"
56
+ >
57
+ <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"/>
58
+ <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"/>
59
+ <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"/>
60
+ <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"/>
61
+ <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"/>
62
+
63
+ </symbol>
64
+ </svg>
65
+ `,Zo=qo;function Yo(e){return async(t,r,i)=>e.enable?(console.log(`[DRY RUN]: Requesting dummy AI generation for kind '${e.kind}' with inputs: `,JSON.stringify(t,void 0,2)),await wt(2e3),await Qo(t,e,r)):i(t,r)}async function Qo(e,t,r){switch(t.kind){case"image":return Wo(e,t,r);case"video":return Ko(e,t,r);case"text":return Jo(e,t,r);case"audio":return ea(e,t,r);default:throw new Error(`Unsupported output kind for creating dry run output: ${t.kind}`)}}async function Wo(e,t,{engine:r}){let i,n,o=e!=null&&typeof e=="object"&&"prompt"in e&&typeof e.prompt=="string"?e.prompt:"AI Generated Image",a=o.match(/(\d+)x(\d+)/);if(a!=null)i=parseInt(a[1],10),n=parseInt(a[2],10);else if(t.blockInputs!=null&&(i=t.blockInputs.image.width,n=t.blockInputs.image.height),t.blockIds!=null&&Array.isArray(t.blockIds)&&t.blockIds.length>0){let[s]=t.blockIds,u=await Zn(s,r),l=await qn(u,r);i=l.width,n=l.height}else i=512,n=512;return{kind:"image",url:`https://placehold.co/${i}x${n}/000000/FFF?text=${o.replace(" ","+").replace(`
66
+ `,"+")}`}}async function Ko(e,t,r){return Promise.resolve({kind:"video",url:"https://storage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4"})}async function Jo(e,t,r){let i="";if(t.blockIds&&t.blockIds.length>0){let[a]=t.blockIds;r.engine.block.isValid(a)&&(i=r.engine.block.getString(a,"text/text"))}if(!i&&e!=null&&typeof e=="object"&&"prompt"in e&&typeof e.prompt=="string"){let a=e.prompt,s=a.match(/text:\s*"([^"]+)"/i)||a.match(/content:\s*"([^"]+)"/i)||a.match(/"([^"]+)"/);s&&s[1]&&(i=s[1])}let n=i.length||50,o="";if(e!=null&&typeof e=="object")if("language"in e&&typeof e.language=="string")o=q(n,"translation");else if("type"in e&&typeof e.type=="string"){let a=e.type;o=q(n,a)}else"customPrompt"in e?o=q(n,"custom"):o=q(n,"improved");else o=q(n,"generated");return Xo(o,r.abortSignal)}async function*Xo(e,t){let r=Math.max(1,Math.ceil(e.length/20)),i=0;for(;i<e.length;){if(t?.aborted)return;let n=Math.min(i+r,e.length);yield{kind:"text",text:e.substring(0,n)},i=n,i<e.length&&await wt(100)}return{kind:"text",text:e}}function q(e,t){let r="[DRY RUN - Dummy Text] ",i=r.length;if(e<=i)return r.substring(0,e);let n=e-i,o={translation:"Ceci est un texte fictif traduit qui maintient la longueur approximative.",professional:"Enhanced professional content with improved clarity and structure.",casual:"Relaxed, friendly text that keeps things simple and approachable.",formal:"Refined formal documentation that preserves original structure.",humorous:"Amusing content that brings lighthearted fun to the text.",improved:"Enhanced text that demonstrates better clarity and readability.",custom:"Customized content reflecting the requested modifications.",generated:"AI-generated content maintaining original length and structure."},a=o[t]||o.generated,s="";if(n<=a.length)s=a.substring(0,n);else{s=a;let u=[" Additional content continues with similar phrasing."," Further elaboration maintains the established tone."," Extended content preserves the original style."," Continued text follows the same pattern."],l=0;for(;s.length<n;){let c=u[l%u.length];if(s.length+c.length<=n)s+=c;else{s+=c.substring(0,n-s.length);break}l++}}return r+s}async function ea(e,t,r){let i=3;if(e!=null&&typeof e=="object"){if("duration"in e&&typeof e.duration=="number")i=e.duration;else if("prompt"in e&&typeof e.prompt=="string"){let n=e.prompt.match(/(\d+)\s*(?:seconds?|secs?|s)\b/i);n&&(i=parseInt(n[1],10))}}return t.blockInputs?.audio?.duration&&(i=t.blockInputs.audio.duration),{kind:"audio",url:ta(220,i),duration:i,thumbnailUrl:void 0}}function ta(e,t){let r=Math.floor(44100*t),i=new Float32Array(r);for(let n=0;n<r;n++)i[n]=Math.sin(2*Math.PI*e*n/44100);return ra(i,44100)}function ra(e,t){let r=e.length,i=2,n=1,o=n*i,a=t*o,s=r*i,u=44+s,l=new ArrayBuffer(u),c=new DataView(l),d=(b,m)=>{for(let f=0;f<m.length;f++)c.setUint8(b+f,m.charCodeAt(f))};d(0,"RIFF"),c.setUint32(4,u-8,!0),d(8,"WAVE"),d(12,"fmt "),c.setUint32(16,16,!0),c.setUint16(20,1,!0),c.setUint16(22,n,!0),c.setUint32(24,t,!0),c.setUint32(28,a,!0),c.setUint16(32,o,!0),c.setUint16(34,16,!0),d(36,"data"),c.setUint32(40,s,!0);let g=44;for(let b=0;b<r;b++){let m=Math.max(-1,Math.min(1,e[b])),f=Math.round(m*32767);c.setInt16(g,f,!0),g+=2}let p=new Uint8Array(l),h="";for(let b=0;b<p.length;b++)h+=String.fromCharCode(p[b]);return`data:audio/wav;base64,${btoa(h)}`}async function wt(e){return new Promise(t=>{setTimeout(t,e)})}var ia=Yo,na="USER_CANCEL";function oa(e){return async(t,r)=>{if(r?.abortSignal?.aborted)return{status:"aborted"};let i=Kn([...e.provider.output.middleware??[],...r?.middlewares??[],Xn({enable:r?.debug}),ia({enable:r?.dryRun,kind:e.provider.kind})]);try{let{result:n}=await i(e.provider.output.generate)(t,{abortSignal:r?.abortSignal,engine:e.engine,cesdk:e.cesdk});return r?.abortSignal?.aborted?{status:"aborted"}:n instanceof Error?{status:"error",message:n.message}:n==null?{status:"error",message:"No output generated"}:io(n)?{status:"success",type:"async",output:n}:{status:"success",type:"sync",output:n}}catch(n){return Ce(n)?{status:"aborted",message:n.message}:n===na?{status:"aborted",message:n}:{status:"error",message:n instanceof Error?n.message:String(n)}}}}var aa=oa;async function sa(e,t,r,i){let n={...i,provider:t},o={provider:t,panelInput:t.input?.panel,options:{cesdk:r.cesdk,engine:r.cesdk.engine},config:n};await t.initialize?.({...r,engine:r.cesdk.engine});let a=Bo(o),s=Ho(o,a);o.options.historyAssetSourceId=a,o.options.historyAssetLibraryEntryId=s;let u=aa({provider:t,cesdk:r.cesdk,engine:r.cesdk.engine}),l=await Uo(o,u);no(r.cesdk,"@imgly/plugin-ai-generation",Zo);let c={provider:t,panel:{builderRenderFunction:l},history:{assetSourceId:a,assetLibraryEntryId:s},generate:u};return Wn.get().register(c),c}var me=sa;function la(e){let{kind:t,cesdk:r,historAssetSourceIds:i}=e,n=`ly.img.ai.${t}-generation.history`;if(r.engine.asset.findAllSources().includes(n))return n;let o=new Yt(n,r,i);return r.engine.asset.addSource(o),o.id}var ua=la;async function ca(e,t,r,i){let n,o=[];if(Array.isArray(t)){let s=await Promise.all(t.map(u=>me(e,u,r,i)));o.push(...s),n=ga({prefix:e,providerInitializationResults:o})}else{let s=await Promise.all(t.fromText.map(l=>me(e,l,r,i)));o.push(...s);let u=await Promise.all(t.fromImage.map(l=>me(e,l,r,i)));o.push(...u),n=da({prefix:`ly.img.ai.${e}-generation`,initializedFromTextProviders:s,initializedFromImageProviders:u})}let a=ua({kind:e,cesdk:r.cesdk,historAssetSourceIds:o.map(s=>s.history?.assetSourceId).filter(Qn)});return{panel:{builderRenderFunction:n},history:{assetSourceId:a},providerInitializationResults:o}}function da({prefix:e,initializedFromTextProviders:t,initializedFromImageProviders:r}){let i=t.length>0&&r.length>0;return n=>{let{builder:o,experimental:a}=n,s=a.global(`${e}.fromType`,i?"fromText":void 0),u=[];s.value==="fromText"?u.push(...t):s.value==="fromImage"?u.push(...r):u.push(...t,...r);let l=t.map(({provider:h,panel:b})=>({id:h.id,label:h.name??h.id,builderRenderFunction:b?.builderRenderFunction})),c=r.map(({provider:h,panel:b})=>({id:h.id,label:h.name??h.id,builderRenderFunction:b?.builderRenderFunction})),d=n.experimental.global(`${e}.selectedProvider.fromText`,l[0]),g=n.experimental.global(`${e}.selectedProvider.fromImage`,c[0]),p=s.value==="fromText"?d:s.value==="fromImage"?g:void 0;if((i||u.length>1)&&o.Section(`${e}.providerSelection.section`,{children:()=>{if(i&&o.ButtonGroup(`${e}.fromType.buttonGroup`,{inputLabel:"Input",children:()=>{o.Button(`${e}.fromType.buttonGroup.fromText`,{label:"Text",icon:s.value!=="fromText"&&Qe(t,n)?"@imgly/LoadingSpinner":void 0,isActive:s.value==="fromText",onClick:()=>{s.setValue("fromText")}}),o.Button(`${e}.fromType.buttonGroup.fromImage`,{label:"Image",icon:s.value!=="fromImage"&&Qe(r,n)?"@imgly/LoadingSpinner":void 0,isActive:s.value==="fromImage",onClick:()=>{s.setValue("fromImage")}})}}),u.length>1){let h=s.value==="fromText"?l:s.value==="fromImage"?c:[...l,...c];p!=null&&o.Select(`${e}.providerSelect.select`,{inputLabel:"Provider",values:h,...p})}}}),u.length>1)p?.value.builderRenderFunction?.(n);else{let h=u[0];h&&h.panel?.builderRenderFunction?.(n)}}}function ga({prefix:e,providerInitializationResults:t}){return r=>{let{builder:i}=r;if(t.length===0)return;let n=t.map(({provider:a,panel:s})=>({id:a.id,label:a.name??a.id,builderRenderFunction:s?.builderRenderFunction})),o=r.state(`${e}.selectedProvider`,n[0]);t.length>1&&o!=null&&i.Section(`${e}.providerSelection.section`,{children:()=>{i.Select(`${e}.providerSelect.select`,{inputLabel:"Provider",values:n,...o})}}),o.value.builderRenderFunction?.(r)}}function Qe(e,t){return e.length===0?!1:e.some(({provider:r})=>r.id==null?!1:t.experimental.global(Ae(r.id),!1).value)}var kt=ca;var It="@imgly/plugin-ai-sticker-generation",pa=`
67
+ <svg>
68
+ <symbol
69
+ fill="none"
70
+ xmlns="http://www.w3.org/2000/svg"
71
+ viewBox="0 0 24 24"
72
+ id="@imgly/StickerVariation"
73
+ >
74
+ <path d="M4.5 4H13.5C13.7761 4 14 4.22386 14 4.5V5H16V4.5C16 3.11929 14.8807 2 13.5 2H4.5C3.11929 2 2 3.11929 2 4.5V13.5C2 14.8807 3.11929 16 4.5 16H5V14H4.5C4.22386 14 4 13.7761 4 13.5V4.5C4 4.22386 4.22386 4 4.5 4Z" fill="currentColor"/>
75
+ <path d="M15.9375 13.625C16.8695 13.625 17.625 12.8695 17.625 11.9375C17.625 11.0055 16.8695 10.25 15.9375 10.25C15.0055 10.25 14.25 11.0055 14.25 11.9375C14.25 12.8695 15.0055 13.625 15.9375 13.625Z" fill="currentColor"/>
76
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M9.5 7C8.11929 7 7 8.11929 7 9.5V18.5C7 19.8807 8.11929 21 9.5 21H18.5C19.8807 21 21 19.8807 21 18.5V9.5C21 8.11929 19.8807 7 18.5 7H9.5ZM9 9.5C9 9.22386 9.22386 9 9.5 9H18.5C18.7761 9 19 9.22386 19 9.5V18.5C19 18.7761 18.7761 19 18.5 19H16.3351L12.7198 13.5771C12.4972 13.2432 12.0064 13.2432 11.7838 13.5771L9 17.7528V9.5Z" fill="currentColor"/>
77
+
78
+ </symbol>
79
+ </svg>
80
+ `,Ct=pa;var fa=typeof global=="object"&&global&&global.Object===Object&&global,zt=fa,ha=typeof self=="object"&&self&&self.Object===Object&&self,ma=zt||ha||Function("return this")(),S=ma,ba=S.Symbol,F=ba,Rt=Object.prototype,ya=Rt.hasOwnProperty,va=Rt.toString,X=F?F.toStringTag:void 0;function wa(e){var t=ya.call(e,X),r=e[X];try{e[X]=void 0;var i=!0}catch{}var n=va.call(e);return i&&(t?e[X]=r:delete e[X]),n}var ka=wa,Ia=Object.prototype,Ca=Ia.toString;function Sa(e){return Ca.call(e)}var Aa=Sa,xa="[object Null]",Ma="[object Undefined]",St=F?F.toStringTag:void 0;function Ea(e){return e==null?e===void 0?Ma:xa:St&&St in Object(e)?ka(e):Aa(e)}var ie=Ea;function ja(e){return e!=null&&typeof e=="object"}var Pe=ja,Pu=Array.isArray;function _a(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ft=_a,La="[object AsyncFunction]",Na="[object Function]",Pa="[object GeneratorFunction]",Oa="[object Proxy]";function Da(e){if(!Ft(e))return!1;var t=ie(e);return t==Na||t==Pa||t==La||t==Oa}var $a=Da,Ta=S["__core-js_shared__"],xe=Ta,At=function(){var e=/[^.]+$/.exec(xe&&xe.keys&&xe.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function za(e){return!!At&&At in e}var Ra=za,Fa=Function.prototype,Ua=Fa.toString;function Va(e){if(e!=null){try{return Ua.call(e)}catch{}try{return e+""}catch{}}return""}var j=Va,Ba=/[\\^$.*+?()[\]{}|]/g,Ga=/^\[object .+?Constructor\]$/,Ha=Function.prototype,qa=Object.prototype,Za=Ha.toString,Ya=qa.hasOwnProperty,Qa=RegExp("^"+Za.call(Ya).replace(Ba,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Wa(e){if(!Ft(e)||Ra(e))return!1;var t=$a(e)?Qa:Ga;return t.test(j(e))}var Ka=Wa;function Ja(e,t){return e?.[t]}var Xa=Ja;function es(e,t){var r=Xa(e,t);return Ka(r)?r:void 0}var U=es,ts=U(S,"WeakMap"),Ee=ts;function rs(e,t){return e===t||e!==e&&t!==t}var is=rs,ns=9007199254740991;function os(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=ns}var as=os;var Ou=Object.prototype;var ss="[object Arguments]";function ls(e){return Pe(e)&&ie(e)==ss}var xt=ls,Ut=Object.prototype,us=Ut.hasOwnProperty,cs=Ut.propertyIsEnumerable,Du=xt(function(){return arguments}())?xt:function(e){return Pe(e)&&us.call(e,"callee")&&!cs.call(e,"callee")};var Vt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Mt=Vt&&typeof module=="object"&&module&&!module.nodeType&&module,ds=Mt&&Mt.exports===Vt,Et=ds?S.Buffer:void 0,$u=Et?Et.isBuffer:void 0;var gs="[object Arguments]",ps="[object Array]",fs="[object Boolean]",hs="[object Date]",ms="[object Error]",bs="[object Function]",ys="[object Map]",vs="[object Number]",ws="[object Object]",ks="[object RegExp]",Is="[object Set]",Cs="[object String]",Ss="[object WeakMap]",As="[object ArrayBuffer]",xs="[object DataView]",Ms="[object Float32Array]",Es="[object Float64Array]",js="[object Int8Array]",_s="[object Int16Array]",Ls="[object Int32Array]",Ns="[object Uint8Array]",Ps="[object Uint8ClampedArray]",Os="[object Uint16Array]",Ds="[object Uint32Array]",w={};w[Ms]=w[Es]=w[js]=w[_s]=w[Ls]=w[Ns]=w[Ps]=w[Os]=w[Ds]=!0;w[gs]=w[ps]=w[As]=w[fs]=w[xs]=w[hs]=w[ms]=w[bs]=w[ys]=w[vs]=w[ws]=w[ks]=w[Is]=w[Cs]=w[Ss]=!1;function $s(e){return Pe(e)&&as(e.length)&&!!w[ie(e)]}var Ts=$s;function zs(e){return function(t){return e(t)}}var Rs=zs,Bt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ee=Bt&&typeof module=="object"&&module&&!module.nodeType&&module,Fs=ee&&ee.exports===Bt,Me=Fs&&zt.process,Us=function(){try{var e=ee&&ee.require&&ee.require("util").types;return e||Me&&Me.binding&&Me.binding("util")}catch{}}(),jt=Us,_t=jt&&jt.isTypedArray,Tu=_t?Rs(_t):Ts;var Vs=Object.prototype,zu=Vs.hasOwnProperty;function Bs(e,t){return function(r){return e(t(r))}}var Gs=Bs,Ru=Gs(Object.keys,Object);var Hs=Object.prototype,Fu=Hs.hasOwnProperty;var qs=U(Object,"create"),te=qs;function Zs(){this.__data__=te?te(null):{},this.size=0}var Ys=Zs;function Qs(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Ws=Qs,Ks="__lodash_hash_undefined__",Js=Object.prototype,Xs=Js.hasOwnProperty;function el(e){var t=this.__data__;if(te){var r=t[e];return r===Ks?void 0:r}return Xs.call(t,e)?t[e]:void 0}var tl=el,rl=Object.prototype,il=rl.hasOwnProperty;function nl(e){var t=this.__data__;return te?t[e]!==void 0:il.call(t,e)}var ol=nl,al="__lodash_hash_undefined__";function sl(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=te&&t===void 0?al:t,this}var ll=sl;function V(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])}}V.prototype.clear=Ys;V.prototype.delete=Ws;V.prototype.get=tl;V.prototype.has=ol;V.prototype.set=ll;var Lt=V;function ul(){this.__data__=[],this.size=0}var cl=ul;function dl(e,t){for(var r=e.length;r--;)if(is(e[r][0],t))return r;return-1}var ue=dl,gl=Array.prototype,pl=gl.splice;function fl(e){var t=this.__data__,r=ue(t,e);if(r<0)return!1;var i=t.length-1;return r==i?t.pop():pl.call(t,r,1),--this.size,!0}var hl=fl;function ml(e){var t=this.__data__,r=ue(t,e);return r<0?void 0:t[r][1]}var bl=ml;function yl(e){return ue(this.__data__,e)>-1}var vl=yl;function wl(e,t){var r=this.__data__,i=ue(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}var kl=wl;function B(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}B.prototype.clear=cl;B.prototype.delete=hl;B.prototype.get=bl;B.prototype.has=vl;B.prototype.set=kl;var ce=B,Il=U(S,"Map"),re=Il;function Cl(){this.size=0,this.__data__={hash:new Lt,map:new(re||ce),string:new Lt}}var Sl=Cl;function Al(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var xl=Al;function Ml(e,t){var r=e.__data__;return xl(t)?r[typeof t=="string"?"string":"hash"]:r.map}var de=Ml;function El(e){var t=de(this,e).delete(e);return this.size-=t?1:0,t}var jl=El;function _l(e){return de(this,e).get(e)}var Ll=_l;function Nl(e){return de(this,e).has(e)}var Pl=Nl;function Ol(e,t){var r=de(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}var Dl=Ol;function G(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])}}G.prototype.clear=Sl;G.prototype.delete=jl;G.prototype.get=Ll;G.prototype.has=Pl;G.prototype.set=Dl;var Gt=G;function $l(){this.__data__=new ce,this.size=0}var Tl=$l;function zl(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var Rl=zl;function Fl(e){return this.__data__.get(e)}var Ul=Fl;function Vl(e){return this.__data__.has(e)}var Bl=Vl,Gl=200;function Hl(e,t){var r=this.__data__;if(r instanceof ce){var i=r.__data__;if(!re||i.length<Gl-1)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new Gt(i)}return r.set(e,t),this.size=r.size,this}var ql=Hl;function ne(e){var t=this.__data__=new ce(e);this.size=t.size}ne.prototype.clear=Tl;ne.prototype.delete=Rl;ne.prototype.get=Ul;ne.prototype.has=Bl;ne.prototype.set=ql;var Zl=Object.prototype,Uu=Zl.propertyIsEnumerable;var Yl=U(S,"DataView"),je=Yl,Ql=U(S,"Promise"),_e=Ql,Wl=U(S,"Set"),Le=Wl,Nt="[object Map]",Kl="[object Object]",Pt="[object Promise]",Ot="[object Set]",Dt="[object WeakMap]",$t="[object DataView]",Jl=j(je),Xl=j(re),eu=j(_e),tu=j(Le),ru=j(Ee),R=ie;(je&&R(new je(new ArrayBuffer(1)))!=$t||re&&R(new re)!=Nt||_e&&R(_e.resolve())!=Pt||Le&&R(new Le)!=Ot||Ee&&R(new Ee)!=Dt)&&(R=function(e){var t=ie(e),r=t==Kl?e.constructor:void 0,i=r?j(r):"";if(i)switch(i){case Jl:return $t;case Xl:return Nt;case eu:return Pt;case tu:return Ot;case ru:return Dt}return t});var Vu=S.Uint8Array;var iu="__lodash_hash_undefined__";function nu(e){return this.__data__.set(e,iu),this}var ou=nu;function au(e){return this.__data__.has(e)}var su=au;function Ne(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Gt;++t<r;)this.add(e[t])}Ne.prototype.add=Ne.prototype.push=ou;Ne.prototype.has=su;var Tt=F?F.prototype:void 0,Bu=Tt?Tt.valueOf:void 0;var lu=Object.prototype,Gu=lu.hasOwnProperty;var uu=Object.prototype,Hu=uu.hasOwnProperty;var qu=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),Zu=new RegExp(/[A-Fa-f0-9]{1}/,"g"),Yu=new RegExp(/[A-Fa-f0-9]{2}/,"g");function cu(e){return e==null?[]:Array.isArray(e)?e:[e]}var Ht=cu;var _="@imgly/plugin-ai-sticker-generation-web";var x="ly.img.ai.sticker-generation";function du(e){return{async initialize({cesdk:t}){if(t==null)return;ut(t,_,"0.2.0");let i=nt.get().register({type:"plugin",sceneMode:"Design",id:_,pluginId:_,label:"Generate Sticker",meta:{panelId:x},execute:()=>{t.ui.isPanelOpen(x)?t.ui.closePanel(x):t.ui.openPanel(x)}});t.ui.addIconSet(It,Ct),t.i18n.setTranslations({en:{[`panel.${x}`]:"Sticker Generation",[`${x}.dock.label`]:"AI Sticker"}});let n=e.providers?.text2sticker,o=await Promise.all(Ht(n).map(s=>s({cesdk:t}))),a=await kt("sticker",{fromText:o,fromImage:[]},{cesdk:t},e);a.history?.assetSourceId!=null,a.panel.builderRenderFunction!=null?(t.ui.registerPanel(x,a.panel.builderRenderFunction),ct({cesdk:t,panelId:x})):i()}}}var qt=du;var gu=e=>({name:_,version:"0.2.0",...qt(e)}),oc=gu;export{oc as default};
81
+ /*! Bundled license information:
82
+
83
+ @imgly/plugin-ai-generation-web/dist/index.mjs:
84
+ (*! Bundled license information:
85
+
86
+ @imgly/plugin-utils/dist/index.mjs:
87
+ (*! Bundled license information:
88
+
89
+ lodash-es/lodash.js:
90
+ (**
91
+ * @license
92
+ * Lodash (Custom Build) <https://lodash.com/>
93
+ * Build: `lodash modularize exports="es" -o ./`
94
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
95
+ * Released under MIT license <https://lodash.com/license>
96
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
97
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
98
+ *)
99
+ *)
100
+ *)
101
+
102
+ @imgly/plugin-utils/dist/index.mjs:
103
+ (*! Bundled license information:
104
+
105
+ lodash-es/lodash.js:
106
+ (**
107
+ * @license
108
+ * Lodash (Custom Build) <https://lodash.com/>
109
+ * Build: `lodash modularize exports="es" -o ./`
110
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
111
+ * Released under MIT license <https://lodash.com/license>
112
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
113
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
114
+ *)
115
+ *)
116
+ */
117
+ //# sourceMappingURL=index.mjs.map