@imgly/plugin-ai-image-generation-web 0.1.1 → 0.1.3
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.
- package/dist/fal-ai/index.mjs +7 -7
- package/dist/fal-ai/index.mjs.map +3 -3
- package/dist/index.mjs +4 -4
- package/dist/index.mjs.map +3 -3
- package/package.json +1 -1
package/dist/fal-ai/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Zn=Object.create;var Oi=Object.defineProperty;var Xn=Object.getOwnPropertyDescriptor;var Jn=Object.getOwnPropertyNames;var eo=Object.getPrototypeOf,to=Object.prototype.hasOwnProperty;var x=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var io=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Jn(t))!to.call(e,n)&&n!==i&&Oi(e,n,{get:()=>t[n],enumerable:!(r=Xn(t,n))||r.enumerable});return e};var ji=(e,t,i)=>(i=e!=null?Zn(eo(e)):{},io(t||!e||!e.__esModule?Oi(i,"default",{value:e,enumerable:!0}):i,e));var Kt=x(j=>{"use strict";var ad=j&&j.__awaiter||function(e,t,i,r){function n(o){return o instanceof i?o:new i(function(a){a(o)})}return new(i||(i=Promise))(function(o,a){function s(u){try{c(r.next(u))}catch(d){a(d)}}function l(u){try{c(r.throw(u))}catch(d){a(d)}}function c(u){u.done?o(u.value):n(u.value).then(s,l)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(j,"__esModule",{value:!0});j.TARGET_URL_HEADER=void 0;j.withMiddleware=sd;j.withProxy=ld;function sd(...e){let t=i=>typeof i=="function";return i=>ad(this,void 0,void 0,function*(){let r=Object.assign({},i);for(let n of e.filter(t))r=yield n(r);return r})}j.TARGET_URL_HEADER="x-fal-target-url";function ld(e){let t=i=>Promise.resolve(i);return typeof window>"u"?t:i=>i.headers&&j.TARGET_URL_HEADER in i?t(i):Promise.resolve(Object.assign(Object.assign({},i),{url:e.targetUrl,headers:Object.assign(Object.assign({},i.headers||{}),{[j.TARGET_URL_HEADER]:i.url})}))}});var Y=x(P=>{"use strict";var Ar=P&&P.__awaiter||function(e,t,i,r){function n(o){return o instanceof i?o:new i(function(a){a(o)})}return new(i||(i=Promise))(function(o,a){function s(u){try{c(r.next(u))}catch(d){a(d)}}function l(u){try{c(r.throw(u))}catch(d){a(d)}}function c(u){u.done?o(u.value):n(u.value).then(s,l)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(P,"__esModule",{value:!0});P.ValidationError=P.ApiError=void 0;P.defaultResponseHandler=Mr;P.resultResponseHandler=ud;var cd="x-fal-request-id",he=class extends Error{constructor({message:t,status:i,body:r}){super(t),this.name="ApiError",this.status=i,this.body=r}};P.ApiError=he;var Je=class extends he{constructor(t){super(t),this.name="ValidationError"}get fieldErrors(){return typeof this.body.detail=="string"?[{loc:["body"],msg:this.body.detail,type:"value_error"}]:this.body.detail||[]}getFieldErrors(t){return this.fieldErrors.filter(i=>i.loc[i.loc.length-1]===t)}};P.ValidationError=Je;function Mr(e){return Ar(this,void 0,void 0,function*(){var t;let{status:i,statusText:r}=e,n=(t=e.headers.get("Content-Type"))!==null&&t!==void 0?t:"";if(!e.ok){if(n.includes("application/json")){let o=yield e.json(),a=i===422?Je:he;throw new a({message:o.message||r,status:i,body:o})}throw new he({message:`HTTP ${i}: ${r}`,status:i})}return n.includes("application/json")?e.json():n.includes("text/html")?e.text():n.includes("application/octet-stream")?e.arrayBuffer():e.text()})}function ud(e){return Ar(this,void 0,void 0,function*(){return{data:yield Mr(e),requestId:e.headers.get(cd)||""}})}});var Tr=x((Oh,dd)=>{dd.exports={name:"@fal-ai/client",description:"The fal.ai client for JavaScript and TypeScript",version:"1.3.0",license:"MIT",repository:{type:"git",url:"https://github.com/fal-ai/fal-js.git",directory:"libs/client"},keywords:["fal","client","ai","ml","typescript"],exports:{".":"./src/index.js","./endpoints":"./src/types/endpoints.js"},typesVersions:{"*":{endpoints:["src/types/endpoints.d.ts"]}},main:"./src/index.js",types:"./src/index.d.ts",dependencies:{"@msgpack/msgpack":"^3.0.0-beta2","eventsource-parser":"^1.1.2",robot3:"^0.4.1"},engines:{node:">=18.0.0"},type:"commonjs"}});var it=x(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.isBrowser=pd;tt.getUserAgent=gd;function pd(){return typeof window<"u"&&typeof window.document<"u"}var et=null;function gd(){if(et!==null)return et;let e=Tr();return et=`${e.name}/${e.version}`,et}});var rt=x(z=>{"use strict";Object.defineProperty(z,"__esModule",{value:!0});z.credentialsFromEnv=void 0;z.resolveDefaultFetch=jr;z.createConfig=_d;z.getRestApiUrl=vd;var Or=Kt(),hd=Y(),fd=it();function jr(){if(typeof fetch>"u")throw new Error("Your environment does not support fetch. Please provide your own fetch implementation.");return fetch}function md(){return typeof process<"u"&&process.env&&(typeof process.env.FAL_KEY<"u"||typeof process.env.FAL_KEY_ID<"u"&&typeof process.env.FAL_KEY_SECRET<"u")}var yd=()=>{if(md())return typeof process.env.FAL_KEY<"u"?process.env.FAL_KEY:process.env.FAL_KEY_ID?`${process.env.FAL_KEY_ID}:${process.env.FAL_KEY_SECRET}`:void 0};z.credentialsFromEnv=yd;var bd={credentials:z.credentialsFromEnv,suppressLocalCredentialsWarning:!1,requestMiddleware:e=>Promise.resolve(e),responseHandler:hd.defaultResponseHandler};function _d(e){var t;let i=Object.assign(Object.assign(Object.assign({},bd),e),{fetch:(t=e.fetch)!==null&&t!==void 0?t:jr()});e.proxyUrl&&(i=Object.assign(Object.assign({},i),{requestMiddleware:(0,Or.withMiddleware)(i.requestMiddleware,(0,Or.withProxy)({targetUrl:e.proxyUrl}))}));let{credentials:r,suppressLocalCredentialsWarning:n}=i,o=typeof r=="function"?r():r;return(0,fd.isBrowser)()&&o&&!n&&console.warn("The fal credentials are exposed in the browser's environment. That's not recommended for production use cases."),i}function vd(){return"https://rest.alpha.fal.ai"}});var Z=x(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.ensureEndpointIdFormat=Pr;q.parseEndpointId=xd;q.isValidUrl=Ed;q.throttle=Id;q.isReact=Sd;q.isPlainObject=kd;function Pr(e){if(e.split("/").length>1)return e;let[,i,r]=/^([0-9]+)-([a-zA-Z0-9-]+)$/.exec(e)||[];if(i&&r)return`${i}/${r}`;throw new Error(`Invalid app id: ${e}. Must be in the format <appOwner>/<appId>`)}var wd=["workflows","comfy"];function xd(e){let i=Pr(e).split("/");return wd.includes(i[0])?{owner:i[1],alias:i[2],path:i.slice(3).join("/")||void 0,namespace:i[0]}:{owner:i[0],alias:i[1],path:i.slice(2).join("/")||void 0}}function Ed(e){try{let{host:t}=new URL(e);return/(fal\.(ai|run))$/.test(t)}catch{return!1}}function Id(e,t,i=!1){let r,n;return(...o)=>{!n&&i?(e(...o),n=Date.now()):(r&&clearTimeout(r),r=setTimeout(()=>{Date.now()-n>=t&&(e(...o),n=Date.now())},t-(Date.now()-n)))}}var Wt;function Sd(){if(Wt===void 0){let e=new Error().stack;Wt=!!e&&(e.includes("node_modules/react-dom/")||e.includes("node_modules/next/"))}return Wt}function kd(e){return!!e&&Object.getPrototypeOf(e)===Object.prototype}});var fe=x(V=>{"use strict";var Cd=V&&V.__awaiter||function(e,t,i,r){function n(o){return o instanceof i?o:new i(function(a){a(o)})}return new(i||(i=Promise))(function(o,a){function s(u){try{c(r.next(u))}catch(d){a(d)}}function l(u){try{c(r.throw(u))}catch(d){a(d)}}function c(u){u.done?o(u.value):n(u.value).then(s,l)}c((r=r.apply(e,t||[])).next())})},Ad=V&&V.__rest||function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]]);return i};Object.defineProperty(V,"__esModule",{value:!0});V.dispatchRequest=Td;V.buildUrl=Od;var $r=it(),Dr=Z(),Md=typeof navigator<"u"&&navigator?.userAgent==="Cloudflare-Workers";function Td(e){return Cd(this,void 0,void 0,function*(){var t,i,r;let{targetUrl:n,input:o,config:a,options:s={}}=e,{credentials:l,requestMiddleware:c,responseHandler:u,fetch:d}=a,h=(0,$r.isBrowser)()?{}:{"User-Agent":(0,$r.getUserAgent)()},p=typeof l=="function"?l():l,{method:f,url:b,headers:_}=yield c({method:((i=(t=e.method)!==null&&t!==void 0?t:s.method)!==null&&i!==void 0?i:"post").toUpperCase(),url:n,headers:e.headers}),g=p?{Authorization:`Key ${p}`}:{},m=Object.assign(Object.assign(Object.assign(Object.assign({},g),{Accept:"application/json","Content-Type":"application/json"}),h),_??{}),{responseHandler:E}=s,w=Ad(s,["responseHandler"]),A=yield d(b,Object.assign(Object.assign(Object.assign(Object.assign({},w),{method:f,headers:Object.assign(Object.assign({},m),(r=w.headers)!==null&&r!==void 0?r:{})}),!Md&&{mode:"cors"}),{signal:s.signal,body:f.toLowerCase()!=="get"&&o?JSON.stringify(o):void 0}));return yield(E??u)(A)})}function Od(e,t={}){var i,r;let n=((i=t.method)!==null&&i!==void 0?i:"post").toLowerCase(),o=((r=t.path)!==null&&r!==void 0?r:"").replace(/^\//,"").replace(/\/{2,}/,"/"),a=t.input,s=Object.assign(Object.assign({},t.query||{}),n==="get"?a:{}),l=Object.keys(s).length>0?`?${new URLSearchParams(s).toString()}`:"";if((0,Dr.isValidUrl)(e))return`${e.endsWith("/")?e:`${e}/`}${o}${l}`;let c=(0,Dr.ensureEndpointIdFormat)(e);return`${`https://${t.subdomain?`${t.subdomain}.`:""}fal.run/${c}/${o}`.replace(/\/$/,"")}${l}`}});var Nr=x(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});function jd(e){let t,i,r,n,o,a,s;return l(),{feed:c,reset:l};function l(){t=!0,i="",r=0,n=-1,o=void 0,a=void 0,s=""}function c(d){i=i?i+d:d,t&&Pd(i)&&(i=i.slice(Ur.length)),t=!1;let h=i.length,p=0,f=!1;for(;p<h;){f&&(i[p]===`
|
|
2
2
|
`&&++p,f=!1);let b=-1,_=n,g;for(let m=r;b<0&&m<h;++m)g=i[m],g===":"&&_<0?_=m-p:g==="\r"?(f=!0,b=m-p):g===`
|
|
3
3
|
`&&(b=m-p);if(b<0){r=h-p,n=_;break}else r=0,n=-1;u(i,p,_,b),p+=b+1}p===h?i="":p>0&&(i=i.slice(p))}function u(d,h,p,f){if(f===0){s.length>0&&(e({type:"event",id:o,event:a||void 0,data:s.slice(0,-1)}),s="",o=void 0),a=void 0;return}let b=p<0,_=d.slice(h,h+(b?f:p)),g=0;b?g=f:d[h+p+1]===" "?g=p+2:g=p+1;let m=h+g,E=f-g,w=d.slice(m,m+E).toString();if(_==="data")s+=w?"".concat(w,`
|
|
4
4
|
`):`
|
|
5
|
-
`;else if(_==="event")a=w;else if(_==="id"&&!w.includes("\0"))o=w;else if(_==="retry"){let A=parseInt(w,10);Number.isNaN(A)||e({type:"reconnect-interval",value:A})}}}var Pr=[239,187,191];function Td(e){return Pr.every((t,i)=>e.charCodeAt(i)===t)}Qt.createParser=Md});var Kt=x(R=>{"use strict";var Od=R&&R.__awaiter||function(e,t,i,r){function n(o){return o instanceof i?o:new i(function(a){a(o)})}return new(i||(i=Promise))(function(o,a){function s(u){try{c(r.next(u))}catch(d){a(d)}}function l(u){try{c(r.throw(u))}catch(d){a(d)}}function c(u){u.done?o(u.value):n(u.value).then(s,l)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(R,"__esModule",{value:!0});R.TOKEN_EXPIRATION_SECONDS=void 0;R.getTemporaryAuthToken=Dd;var jd=rt(),Pd=fe(),$d=Z();R.TOKEN_EXPIRATION_SECONDS=120;function Dd(e,t){return Od(this,void 0,void 0,function*(){let i=(0,$d.parseEndpointId)(e),r=yield(0,Pd.dispatchRequest)({method:"POST",targetUrl:`${(0,jd.getRestApiUrl)()}/tokens/`,config:t,input:{allowed_apps:[i.alias],token_expiration:R.TOKEN_EXPIRATION_SECONDS}});return typeof r!="string"&&r.detail?r.detail:r})}});var Yt=x(O=>{"use strict";var je=O&&O.__awaiter||function(e,t,i,r){function n(o){return o instanceof i?o:new i(function(a){a(o)})}return new(i||(i=Promise))(function(o,a){function s(u){try{c(r.next(u))}catch(d){a(d)}}function l(u){try{c(r.throw(u))}catch(d){a(d)}}function c(u){u.done?o(u.value):n(u.value).then(s,l)}c((r=r.apply(e,t||[])).next())})},Pe=O&&O.__await||function(e){return this instanceof Pe?(this.v=e,this):new Pe(e)},Nd=O&&O.__asyncGenerator||function(e,t,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(e,t||[]),n,o=[];return n={},s("next"),s("throw"),s("return",a),n[Symbol.asyncIterator]=function(){return this},n;function a(p){return function(f){return Promise.resolve(f).then(p,d)}}function s(p,f){r[p]&&(n[p]=function(b){return new Promise(function(_,g){o.push([p,b,_,g])>1||l(p,b)})},f&&(n[p]=f(n[p])))}function l(p,f){try{c(r[p](f))}catch(b){h(o[0][3],b)}}function c(p){p.value instanceof Pe?Promise.resolve(p.value.v).then(u,d):h(o[0][2],p)}function u(p){l("next",p)}function d(p){l("throw",p)}function h(p,f){p(f),o.shift(),o.length&&l(o[0][0],o[0][1])}};Object.defineProperty(O,"__esModule",{value:!0});O.FalStream=void 0;O.createStreamingClient=Ld;var Ud=$r(),Bd=Kt(),Dr=fe(),me=Y(),Wt="text/event-stream",Fd=15*1e3,nt=class{constructor(t,i,r){var n;this.listeners=new Map,this.buffer=[],this.currentData=void 0,this.lastEventTimestamp=0,this.streamClosed=!1,this.abortController=new AbortController,this.start=()=>je(this,void 0,void 0,function*(){var o,a;let{endpointId:s,options:l}=this,{input:c,method:u="post",connectionMode:d="server"}=l;try{if(d==="client"){let h=yield(0,Bd.getTemporaryAuthToken)(s,this.config),{fetch:p}=this.config,f=new URL(this.url);f.searchParams.set("fal_jwt_token",h);let b=yield p(f.toString(),{method:u.toUpperCase(),headers:{accept:(o=l.accept)!==null&&o!==void 0?o:Wt,"content-type":"application/json"},body:c&&u!=="get"?JSON.stringify(c):void 0,signal:this.abortController.signal});return yield this.handleResponse(b)}return yield(0,Dr.dispatchRequest)({method:u.toUpperCase(),targetUrl:this.url,input:c,config:this.config,options:{headers:{accept:(a=l.accept)!==null&&a!==void 0?a:Wt},responseHandler:this.handleResponse,signal:this.abortController.signal}})}catch(h){this.handleError(h)}}),this.handleResponse=o=>je(this,void 0,void 0,function*(){var a,s;if(!o.ok){try{yield(0,me.defaultResponseHandler)(o)}catch(b){this.emit("error",b)}return}let l=o.body;if(!l){this.emit("error",new me.ApiError({message:"Response body is empty.",status:400,body:void 0}));return}if(!((a=o.headers.get("content-type"))!==null&&a!==void 0?a:"").startsWith(Wt)){let b=l.getReader(),_=()=>{b.read().then(({done:g,value:m})=>{if(g){this.emit("done",this.currentData);return}this.currentData=m,this.emit("data",m),_()})};_();return}let u=new TextDecoder("utf-8"),d=o.body.getReader(),h=(0,Ud.createParser)(b=>{if(b.type==="event"){let _=b.data;try{let g=JSON.parse(_);this.buffer.push(g),this.currentData=g,this.emit("data",g),this.emit("message",g)}catch(g){this.emit("error",g)}}}),p=(s=this.options.timeout)!==null&&s!==void 0?s:Fd,f=()=>je(this,void 0,void 0,function*(){let{value:b,done:_}=yield d.read();this.lastEventTimestamp=Date.now(),h.feed(u.decode(b)),Date.now()-this.lastEventTimestamp>p&&this.emit("error",new me.ApiError({message:`Event stream timed out after ${(p/1e3).toFixed(0)} seconds with no messages.`,status:408})),_?this.emit("done",this.currentData):f().catch(this.handleError)});f().catch(this.handleError)}),this.handleError=o=>{var a;if(o.name==="AbortError"||this.signal.aborted)return;let s=o instanceof me.ApiError?o:new me.ApiError({message:(a=o.message)!==null&&a!==void 0?a:"An unknown error occurred",status:500});this.emit("error",s)},this.on=(o,a)=>{var s;this.listeners.has(o)||this.listeners.set(o,[]),(s=this.listeners.get(o))===null||s===void 0||s.push(a)},this.emit=(o,a)=>{let s=this.listeners.get(o)||[];for(let l of s)l(a)},this.done=()=>je(this,void 0,void 0,function*(){return this.donePromise}),this.abort=o=>{this.streamClosed||this.abortController.abort(o)},this.endpointId=t,this.config=i,this.url=(n=r.url)!==null&&n!==void 0?n:(0,Dr.buildUrl)(t,{path:"/stream",query:r.queryParams}),this.options=r,this.donePromise=new Promise((o,a)=>{this.streamClosed&&a(new me.ApiError({message:"Streaming connection is already closed.",status:400,body:void 0})),this.signal.addEventListener("abort",()=>{var s;o((s=this.currentData)!==null&&s!==void 0?s:{})}),this.on("done",s=>{this.streamClosed=!0,o(s)}),this.on("error",s=>{this.streamClosed=!0,a(s)})}),r.signal&&r.signal.addEventListener("abort",()=>{this.abortController.abort()}),this.start().catch(this.handleError)}[Symbol.asyncIterator](){return Nd(this,arguments,function*(){let i=!0,r=()=>i=!1;for(this.on("error",r),this.on("done",r);i||this.buffer.length>0;){let n=this.buffer.shift();n&&(yield yield Pe(n)),yield Pe(new Promise(o=>setTimeout(o,16)))}})}get signal(){return this.abortController.signal}};O.FalStream=nt;function Ld({config:e,storage:t}){return{stream(i,r){return je(this,void 0,void 0,function*(){let n=r.input?yield t.transformInput(r.input):void 0;return new nt(i,e,Object.assign(Object.assign({},r),{input:n}))})}}}});var Ur=x(H=>{"use strict";var X=H&&H.__awaiter||function(e,t,i,r){function n(o){return o instanceof i?o:new i(function(a){a(o)})}return new(i||(i=Promise))(function(o,a){function s(u){try{c(r.next(u))}catch(d){a(d)}}function l(u){try{c(r.throw(u))}catch(d){a(d)}}function c(u){u.done?o(u.value):n(u.value).then(s,l)}c((r=r.apply(e,t||[])).next())})},zd=H&&H.__rest||function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]]);return i};Object.defineProperty(H,"__esModule",{value:!0});H.createQueueClient=void 0;var U=fe(),qd=Y(),Vd=Yt(),ot=Z(),Nr=500,Rd=({config:e,storage:t})=>{let i={submit(r,n){return X(this,void 0,void 0,function*(){let{webhookUrl:o,priority:a}=n,s=zd(n,["webhookUrl","priority"]),l=n.input?yield t.transformInput(n.input):void 0;return(0,U.dispatchRequest)({method:n.method,targetUrl:(0,U.buildUrl)(r,Object.assign(Object.assign({},s),{subdomain:"queue",query:o?{fal_webhook:o}:void 0})),headers:{"x-fal-queue-priority":a??"normal"},input:l,config:e,options:{signal:n.abortSignal}})})},status(r,n){return X(this,arguments,void 0,function*(o,{requestId:a,logs:s=!1,abortSignal:l}){let c=(0,ot.parseEndpointId)(o),u=c.namespace?`${c.namespace}/`:"";return(0,U.dispatchRequest)({method:"get",targetUrl:(0,U.buildUrl)(`${u}${c.owner}/${c.alias}`,{subdomain:"queue",query:{logs:s?"1":"0"},path:`/requests/${a}/status`}),config:e,options:{signal:l}})})},streamStatus(r,n){return X(this,arguments,void 0,function*(o,{requestId:a,logs:s=!1,connectionMode:l}){let c=(0,ot.parseEndpointId)(o),u=c.namespace?`${c.namespace}/`:"",d={logs:s?"1":"0"},h=(0,U.buildUrl)(`${u}${c.owner}/${c.alias}`,{subdomain:"queue",path:`/requests/${a}/status/stream`,query:d});return new Vd.FalStream(o,e,{url:h,method:"get",connectionMode:l,queryParams:d})})},subscribeToStatus(r,n){return X(this,void 0,void 0,function*(){let o=n.requestId,a=n.timeout,s,l=()=>{};if(n.mode==="streaming"){let c=yield i.streamStatus(r,{requestId:o,logs:n.logs,connectionMode:"connectionMode"in n?n.connectionMode:void 0}),u=[];a&&(s=setTimeout(()=>{throw c.abort(),i.cancel(r,{requestId:o}).catch(l),new Error(`Client timed out waiting for the request to complete after ${a}ms`)},a)),c.on("data",h=>{n.onQueueUpdate&&("logs"in h&&Array.isArray(h.logs)&&h.logs.length>0&&u.push(...h.logs),n.onQueueUpdate("logs"in h?Object.assign(Object.assign({},h),{logs:u}):h))});let d=yield c.done();return s&&clearTimeout(s),d}return new Promise((c,u)=>{var d;let h,p="pollInterval"in n&&typeof n.pollInterval=="number"&&(d=n.pollInterval)!==null&&d!==void 0?d:Nr,f=()=>{s&&clearTimeout(s),h&&clearTimeout(h)};a&&(s=setTimeout(()=>{f(),i.cancel(r,{requestId:o}).catch(l),u(new Error(`Client timed out waiting for the request to complete after ${a}ms`))},a));let b=()=>X(this,void 0,void 0,function*(){var _;try{let g=yield i.status(r,{requestId:o,logs:(_=n.logs)!==null&&_!==void 0?_:!1,abortSignal:n.abortSignal});if(n.onQueueUpdate&&n.onQueueUpdate(g),g.status==="COMPLETED"){f(),c(g);return}h=setTimeout(b,p)}catch(g){f(),u(g)}});b().catch(u)})})},result(r,n){return X(this,arguments,void 0,function*(o,{requestId:a,abortSignal:s}){let l=(0,ot.parseEndpointId)(o),c=l.namespace?`${l.namespace}/`:"";return(0,U.dispatchRequest)({method:"get",targetUrl:(0,U.buildUrl)(`${c}${l.owner}/${l.alias}`,{subdomain:"queue",path:`/requests/${a}`}),config:Object.assign(Object.assign({},e),{responseHandler:qd.resultResponseHandler}),options:{signal:s}})})},cancel(r,n){return X(this,arguments,void 0,function*(o,{requestId:a,abortSignal:s}){let l=(0,ot.parseEndpointId)(o),c=l.namespace?`${l.namespace}/`:"";yield(0,U.dispatchRequest)({method:"put",targetUrl:(0,U.buildUrl)(`${c}${l.owner}/${l.alias}`,{subdomain:"queue",path:`/requests/${a}/cancel`}),config:e,options:{signal:s}})})}};return i};H.createQueueClient=Rd});var at=x(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.utf8Count=Hd;B.utf8EncodeJs=Br;B.utf8EncodeTE=Fr;B.utf8Encode=Kd;B.utf8DecodeJs=Lr;B.utf8DecodeTD=zr;B.utf8Decode=Xd;function Hd(e){let t=e.length,i=0,r=0;for(;r<t;){let n=e.charCodeAt(r++);if(n&4294967168)if(!(n&4294965248))i+=2;else{if(n>=55296&&n<=56319&&r<t){let o=e.charCodeAt(r);(o&64512)===56320&&(++r,n=((n&1023)<<10)+(o&1023)+65536)}n&4294901760?i+=4:i+=3}else{i++;continue}}return i}function Br(e,t,i){let r=e.length,n=i,o=0;for(;o<r;){let a=e.charCodeAt(o++);if(a&4294967168)if(!(a&4294965248))t[n++]=a>>6&31|192;else{if(a>=55296&&a<=56319&&o<r){let s=e.charCodeAt(o);(s&64512)===56320&&(++o,a=((a&1023)<<10)+(s&1023)+65536)}a&4294901760?(t[n++]=a>>18&7|240,t[n++]=a>>12&63|128,t[n++]=a>>6&63|128):(t[n++]=a>>12&15|224,t[n++]=a>>6&63|128)}else{t[n++]=a;continue}t[n++]=a&63|128}}var Gd=new TextEncoder,Qd=50;function Fr(e,t,i){Gd.encodeInto(e,t.subarray(i))}function Kd(e,t,i){e.length>Qd?Fr(e,t,i):Br(e,t,i)}var Wd=4096;function Lr(e,t,i){let r=t,n=r+i,o=[],a="";for(;r<n;){let s=e[r++];if(!(s&128))o.push(s);else if((s&224)===192){let l=e[r++]&63;o.push((s&31)<<6|l)}else if((s&240)===224){let l=e[r++]&63,c=e[r++]&63;o.push((s&31)<<12|l<<6|c)}else if((s&248)===240){let l=e[r++]&63,c=e[r++]&63,u=e[r++]&63,d=(s&7)<<18|l<<12|c<<6|u;d>65535&&(d-=65536,o.push(d>>>10&1023|55296),d=56320|d&1023),o.push(d)}else o.push(s);o.length>=Wd&&(a+=String.fromCharCode(...o),o.length=0)}return o.length>0&&(a+=String.fromCharCode(...o)),a}var Yd=new TextDecoder,Zd=200;function zr(e,t,i){let r=e.subarray(t,t+i);return Yd.decode(r)}function Xd(e,t,i){return i>Zd?zr(e,t,i):Lr(e,t,i)}});var Xt=x(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.ExtData=void 0;var Zt=class{constructor(t,i){this.type=t,this.data=i}};st.ExtData=Zt});var ct=x(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.DecodeError=void 0;var Jt=class e extends Error{constructor(t){super(t);let i=Object.create(e.prototype);Object.setPrototypeOf(this,i),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:e.name})}};lt.DecodeError=Jt});var ut=x(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});G.UINT32_MAX=void 0;G.setUint64=Jd;G.setInt64=ep;G.getInt64=tp;G.getUint64=ip;G.UINT32_MAX=4294967295;function Jd(e,t,i){let r=i/4294967296,n=i;e.setUint32(t,r),e.setUint32(t+4,n)}function ep(e,t,i){let r=Math.floor(i/4294967296),n=i;e.setUint32(t,r),e.setUint32(t+4,n)}function tp(e,t){let i=e.getInt32(t),r=e.getUint32(t+4);return i*4294967296+r}function ip(e,t){let i=e.getUint32(t),r=e.getUint32(t+4);return i*4294967296+r}});var ei=x(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.timestampExtension=M.EXT_TIMESTAMP=void 0;M.encodeTimeSpecToTimestamp=Vr;M.encodeDateToTimeSpec=Rr;M.encodeTimestampExtension=Hr;M.decodeTimestampToTimeSpec=Gr;M.decodeTimestampExtension=Qr;var rp=ct(),qr=ut();M.EXT_TIMESTAMP=-1;var np=4294967296-1,op=17179869184-1;function Vr({sec:e,nsec:t}){if(e>=0&&t>=0&&e<=op)if(t===0&&e<=np){let i=new Uint8Array(4);return new DataView(i.buffer).setUint32(0,e),i}else{let i=e/4294967296,r=e&4294967295,n=new Uint8Array(8),o=new DataView(n.buffer);return o.setUint32(0,t<<2|i&3),o.setUint32(4,r),n}else{let i=new Uint8Array(12),r=new DataView(i.buffer);return r.setUint32(0,t),(0,qr.setInt64)(r,4,e),i}}function Rr(e){let t=e.getTime(),i=Math.floor(t/1e3),r=(t-i*1e3)*1e6,n=Math.floor(r/1e9);return{sec:i+n,nsec:r-n*1e9}}function Hr(e){if(e instanceof Date){let t=Rr(e);return Vr(t)}else return null}function Gr(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{let i=t.getUint32(0),r=t.getUint32(4),n=(i&3)*4294967296+r,o=i>>>2;return{sec:n,nsec:o}}case 12:{let i=(0,qr.getInt64)(t,4),r=t.getUint32(0);return{sec:i,nsec:r}}default:throw new rp.DecodeError(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${e.length}`)}}function Qr(e){let t=Gr(e);return new Date(t.sec*1e3+t.nsec/1e6)}M.timestampExtension={type:M.EXT_TIMESTAMP,encode:Hr,decode:Qr}});var gt=x(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.ExtensionCodec=void 0;var dt=Xt(),ap=ei(),$e=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(ap.timestampExtension)}register({type:t,encode:i,decode:r}){if(t>=0)this.encoders[t]=i,this.decoders[t]=r;else{let n=-1-t;this.builtInEncoders[n]=i,this.builtInDecoders[n]=r}}tryToEncode(t,i){for(let r=0;r<this.builtInEncoders.length;r++){let n=this.builtInEncoders[r];if(n!=null){let o=n(t,i);if(o!=null){let a=-1-r;return new dt.ExtData(a,o)}}}for(let r=0;r<this.encoders.length;r++){let n=this.encoders[r];if(n!=null){let o=n(t,i);if(o!=null){let a=r;return new dt.ExtData(a,o)}}}return t instanceof dt.ExtData?t:null}decode(t,i,r){let n=i<0?this.builtInDecoders[-1-i]:this.decoders[i];return n?n(t,i,r):new dt.ExtData(i,t)}};pt.ExtensionCodec=$e;$e.defaultCodec=new $e});var ii=x(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});ti.ensureUint8Array=lp;function sp(e){return e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer}function lp(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):sp(e)?new Uint8Array(e):Uint8Array.from(e)}});var ni=x($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.Encoder=$.DEFAULT_INITIAL_BUFFER_SIZE=$.DEFAULT_MAX_DEPTH=void 0;var Kr=at(),cp=gt(),Wr=ut(),up=ii();$.DEFAULT_MAX_DEPTH=100;$.DEFAULT_INITIAL_BUFFER_SIZE=2048;var ri=class e{constructor(t){this.entered=!1,this.extensionCodec=t?.extensionCodec??cp.ExtensionCodec.defaultCodec,this.context=t?.context,this.useBigInt64=t?.useBigInt64??!1,this.maxDepth=t?.maxDepth??$.DEFAULT_MAX_DEPTH,this.initialBufferSize=t?.initialBufferSize??$.DEFAULT_INITIAL_BUFFER_SIZE,this.sortKeys=t?.sortKeys??!1,this.forceFloat32=t?.forceFloat32??!1,this.ignoreUndefined=t?.ignoreUndefined??!1,this.forceIntegerToFloat=t?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new e({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(t){if(this.entered)return this.clone().encodeSharedRef(t);try{return this.entered=!0,this.reinitializeState(),this.doEncode(t,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(t){if(this.entered)return this.clone().encode(t);try{return this.entered=!0,this.reinitializeState(),this.doEncode(t,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(t,i){if(i>this.maxDepth)throw new Error(`Too deep objects in depth ${i}`);t==null?this.encodeNil():typeof t=="boolean"?this.encodeBoolean(t):typeof t=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(t):this.encodeNumber(t):typeof t=="string"?this.encodeString(t):this.useBigInt64&&typeof t=="bigint"?this.encodeBigInt64(t):this.encodeObject(t,i)}ensureBufferSizeToWrite(t){let i=this.pos+t;this.view.byteLength<i&&this.resizeBuffer(i*2)}resizeBuffer(t){let i=new ArrayBuffer(t),r=new Uint8Array(i),n=new DataView(i);r.set(this.bytes),this.view=n,this.bytes=r}encodeNil(){this.writeU8(192)}encodeBoolean(t){t===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(t){!this.forceIntegerToFloat&&Number.isSafeInteger(t)?t>=0?t<128?this.writeU8(t):t<256?(this.writeU8(204),this.writeU8(t)):t<65536?(this.writeU8(205),this.writeU16(t)):t<4294967296?(this.writeU8(206),this.writeU32(t)):this.useBigInt64?this.encodeNumberAsFloat(t):(this.writeU8(207),this.writeU64(t)):t>=-32?this.writeU8(224|t+32):t>=-128?(this.writeU8(208),this.writeI8(t)):t>=-32768?(this.writeU8(209),this.writeI16(t)):t>=-2147483648?(this.writeU8(210),this.writeI32(t)):this.useBigInt64?this.encodeNumberAsFloat(t):(this.writeU8(211),this.writeI64(t)):this.encodeNumberAsFloat(t)}encodeNumberAsFloat(t){this.forceFloat32?(this.writeU8(202),this.writeF32(t)):(this.writeU8(203),this.writeF64(t))}encodeBigInt64(t){t>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(t)):(this.writeU8(211),this.writeBigInt64(t))}writeStringHeader(t){if(t<32)this.writeU8(160+t);else if(t<256)this.writeU8(217),this.writeU8(t);else if(t<65536)this.writeU8(218),this.writeU16(t);else if(t<4294967296)this.writeU8(219),this.writeU32(t);else throw new Error(`Too long string: ${t} bytes in UTF-8`)}encodeString(t){let r=(0,Kr.utf8Count)(t);this.ensureBufferSizeToWrite(5+r),this.writeStringHeader(r),(0,Kr.utf8Encode)(t,this.bytes,this.pos),this.pos+=r}encodeObject(t,i){let r=this.extensionCodec.tryToEncode(t,this.context);if(r!=null)this.encodeExtension(r);else if(Array.isArray(t))this.encodeArray(t,i);else if(ArrayBuffer.isView(t))this.encodeBinary(t);else if(typeof t=="object")this.encodeMap(t,i);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(t)}`)}encodeBinary(t){let i=t.byteLength;if(i<256)this.writeU8(196),this.writeU8(i);else if(i<65536)this.writeU8(197),this.writeU16(i);else if(i<4294967296)this.writeU8(198),this.writeU32(i);else throw new Error(`Too large binary: ${i}`);let r=(0,up.ensureUint8Array)(t);this.writeU8a(r)}encodeArray(t,i){let r=t.length;if(r<16)this.writeU8(144+r);else if(r<65536)this.writeU8(220),this.writeU16(r);else if(r<4294967296)this.writeU8(221),this.writeU32(r);else throw new Error(`Too large array: ${r}`);for(let n of t)this.doEncode(n,i+1)}countWithoutUndefined(t,i){let r=0;for(let n of i)t[n]!==void 0&&r++;return r}encodeMap(t,i){let r=Object.keys(t);this.sortKeys&&r.sort();let n=this.ignoreUndefined?this.countWithoutUndefined(t,r):r.length;if(n<16)this.writeU8(128+n);else if(n<65536)this.writeU8(222),this.writeU16(n);else if(n<4294967296)this.writeU8(223),this.writeU32(n);else throw new Error(`Too large map object: ${n}`);for(let o of r){let a=t[o];this.ignoreUndefined&&a===void 0||(this.encodeString(o),this.doEncode(a,i+1))}}encodeExtension(t){if(typeof t.data=="function"){let r=t.data(this.pos+6),n=r.length;if(n>=4294967296)throw new Error(`Too large extension object: ${n}`);this.writeU8(201),this.writeU32(n),this.writeI8(t.type),this.writeU8a(r);return}let i=t.data.length;if(i===1)this.writeU8(212);else if(i===2)this.writeU8(213);else if(i===4)this.writeU8(214);else if(i===8)this.writeU8(215);else if(i===16)this.writeU8(216);else if(i<256)this.writeU8(199),this.writeU8(i);else if(i<65536)this.writeU8(200),this.writeU16(i);else if(i<4294967296)this.writeU8(201),this.writeU32(i);else throw new Error(`Too large extension object: ${i}`);this.writeI8(t.type),this.writeU8a(t.data)}writeU8(t){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,t),this.pos++}writeU8a(t){let i=t.length;this.ensureBufferSizeToWrite(i),this.bytes.set(t,this.pos),this.pos+=i}writeI8(t){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,t),this.pos++}writeU16(t){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,t),this.pos+=2}writeI16(t){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,t),this.pos+=2}writeU32(t){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,t),this.pos+=4}writeI32(t){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,t),this.pos+=4}writeF32(t){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,t),this.pos+=4}writeF64(t){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,t),this.pos+=8}writeU64(t){this.ensureBufferSizeToWrite(8),(0,Wr.setUint64)(this.view,this.pos,t),this.pos+=8}writeI64(t){this.ensureBufferSizeToWrite(8),(0,Wr.setInt64)(this.view,this.pos,t),this.pos+=8}writeBigUint64(t){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,t),this.pos+=8}writeBigInt64(t){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,t),this.pos+=8}};$.Encoder=ri});var Yr=x(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});oi.encode=pp;var dp=ni();function pp(e,t){return new dp.Encoder(t).encodeSharedRef(e)}});var Zr=x(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.prettyByte=gp;function gp(e){return`${e<0?"-":""}0x${Math.abs(e).toString(16).padStart(2,"0")}`}});var Xr=x(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.CachedKeyDecoder=void 0;var hp=at(),fp=16,mp=16,si=class{constructor(t=fp,i=mp){this.hit=0,this.miss=0,this.maxKeyLength=t,this.maxLengthPerKey=i,this.caches=[];for(let r=0;r<this.maxKeyLength;r++)this.caches.push([])}canBeCached(t){return t>0&&t<=this.maxKeyLength}find(t,i,r){let n=this.caches[r-1];e:for(let o of n){let a=o.bytes;for(let s=0;s<r;s++)if(a[s]!==t[i+s])continue e;return o.str}return null}store(t,i){let r=this.caches[t.length-1],n={bytes:t,str:i};r.length>=this.maxLengthPerKey?r[Math.random()*r.length|0]=n:r.push(n)}decode(t,i,r){let n=this.find(t,i,r);if(n!=null)return this.hit++,n;this.miss++;let o=(0,hp.utf8DecodeJs)(t,i,r),a=Uint8Array.prototype.slice.call(t,i,i+r);return this.store(a,o),o}};ht.CachedKeyDecoder=si});var mt=x(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.Decoder=void 0;var li=Zr(),yp=gt(),J=ut(),bp=at(),Jr=ii(),_p=Xr(),F=ct(),ci="array",Ne="map_key",tn="map_value",vp=e=>{if(typeof e=="string"||typeof e=="number")return e;throw new F.DecodeError("The type of key must be string or number but "+typeof e)},ui=class{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(t){let i=this.getUninitializedStateFromPool();i.type=ci,i.position=0,i.size=t,i.array=new Array(t)}pushMapState(t){let i=this.getUninitializedStateFromPool();i.type=Ne,i.readCount=0,i.size=t,i.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){let t={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(t)}return this.stack[this.stackHeadPosition]}release(t){if(this.stack[this.stackHeadPosition]!==t)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(t.type===ci){let r=t;r.size=0,r.array=void 0,r.position=0,r.type=void 0}if(t.type===Ne||t.type===tn){let r=t;r.size=0,r.map=void 0,r.readCount=0,r.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}},De=-1,pi=new DataView(new ArrayBuffer(0)),wp=new Uint8Array(pi.buffer);try{pi.getInt8(0)}catch(e){if(!(e instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}var en=new RangeError("Insufficient data"),xp=new _p.CachedKeyDecoder,di=class e{constructor(t){this.totalPos=0,this.pos=0,this.view=pi,this.bytes=wp,this.headByte=De,this.stack=new ui,this.entered=!1,this.extensionCodec=t?.extensionCodec??yp.ExtensionCodec.defaultCodec,this.context=t?.context,this.useBigInt64=t?.useBigInt64??!1,this.rawStrings=t?.rawStrings??!1,this.maxStrLength=t?.maxStrLength??J.UINT32_MAX,this.maxBinLength=t?.maxBinLength??J.UINT32_MAX,this.maxArrayLength=t?.maxArrayLength??J.UINT32_MAX,this.maxMapLength=t?.maxMapLength??J.UINT32_MAX,this.maxExtLength=t?.maxExtLength??J.UINT32_MAX,this.keyDecoder=t?.keyDecoder!==void 0?t.keyDecoder:xp,this.mapKeyConverter=t?.mapKeyConverter??vp}clone(){return new e({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=De,this.stack.reset()}setBuffer(t){let i=(0,Jr.ensureUint8Array)(t);this.bytes=i,this.view=new DataView(i.buffer,i.byteOffset,i.byteLength),this.pos=0}appendBuffer(t){if(this.headByte===De&&!this.hasRemaining(1))this.setBuffer(t);else{let i=this.bytes.subarray(this.pos),r=(0,Jr.ensureUint8Array)(t),n=new Uint8Array(i.length+r.length);n.set(i),n.set(r,i.length),this.setBuffer(n)}}hasRemaining(t){return this.view.byteLength-this.pos>=t}createExtraByteError(t){let{view:i,pos:r}=this;return new RangeError(`Extra ${i.byteLength-r} of ${i.byteLength} byte(s) found at buffer[${t}]`)}decode(t){if(this.entered)return this.clone().decode(t);try{this.entered=!0,this.reinitializeState(),this.setBuffer(t);let i=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return i}finally{this.entered=!1}}*decodeMulti(t){if(this.entered){yield*this.clone().decodeMulti(t);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(t);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(t){if(this.entered)return this.clone().decodeAsync(t);try{this.entered=!0;let i=!1,r;for await(let s of t){if(i)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(s);try{r=this.doDecodeSync(),i=!0}catch(l){if(!(l instanceof RangeError))throw l}this.totalPos+=this.pos}if(i){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return r}let{headByte:n,pos:o,totalPos:a}=this;throw new RangeError(`Insufficient data in parsing ${(0,li.prettyByte)(n)} at ${a} (${o} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(t){return this.decodeMultiAsync(t,!0)}decodeStream(t){return this.decodeMultiAsync(t,!1)}async*decodeMultiAsync(t,i){if(this.entered){yield*this.clone().decodeMultiAsync(t,i);return}try{this.entered=!0;let r=i,n=-1;for await(let o of t){if(i&&n===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(o),r&&(n=this.readArraySize(),r=!1,this.complete());try{for(;yield this.doDecodeSync(),--n!==0;);}catch(a){if(!(a instanceof RangeError))throw a}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){let t=this.readHeadByte(),i;if(t>=224)i=t-256;else if(t<192)if(t<128)i=t;else if(t<144){let n=t-128;if(n!==0){this.pushMapState(n),this.complete();continue e}else i={}}else if(t<160){let n=t-144;if(n!==0){this.pushArrayState(n),this.complete();continue e}else i=[]}else{let n=t-160;i=this.decodeString(n,0)}else if(t===192)i=null;else if(t===194)i=!1;else if(t===195)i=!0;else if(t===202)i=this.readF32();else if(t===203)i=this.readF64();else if(t===204)i=this.readU8();else if(t===205)i=this.readU16();else if(t===206)i=this.readU32();else if(t===207)this.useBigInt64?i=this.readU64AsBigInt():i=this.readU64();else if(t===208)i=this.readI8();else if(t===209)i=this.readI16();else if(t===210)i=this.readI32();else if(t===211)this.useBigInt64?i=this.readI64AsBigInt():i=this.readI64();else if(t===217){let n=this.lookU8();i=this.decodeString(n,1)}else if(t===218){let n=this.lookU16();i=this.decodeString(n,2)}else if(t===219){let n=this.lookU32();i=this.decodeString(n,4)}else if(t===220){let n=this.readU16();if(n!==0){this.pushArrayState(n),this.complete();continue e}else i=[]}else if(t===221){let n=this.readU32();if(n!==0){this.pushArrayState(n),this.complete();continue e}else i=[]}else if(t===222){let n=this.readU16();if(n!==0){this.pushMapState(n),this.complete();continue e}else i={}}else if(t===223){let n=this.readU32();if(n!==0){this.pushMapState(n),this.complete();continue e}else i={}}else if(t===196){let n=this.lookU8();i=this.decodeBinary(n,1)}else if(t===197){let n=this.lookU16();i=this.decodeBinary(n,2)}else if(t===198){let n=this.lookU32();i=this.decodeBinary(n,4)}else if(t===212)i=this.decodeExtension(1,0);else if(t===213)i=this.decodeExtension(2,0);else if(t===214)i=this.decodeExtension(4,0);else if(t===215)i=this.decodeExtension(8,0);else if(t===216)i=this.decodeExtension(16,0);else if(t===199){let n=this.lookU8();i=this.decodeExtension(n,1)}else if(t===200){let n=this.lookU16();i=this.decodeExtension(n,2)}else if(t===201){let n=this.lookU32();i=this.decodeExtension(n,4)}else throw new F.DecodeError(`Unrecognized type byte: ${(0,li.prettyByte)(t)}`);this.complete();let r=this.stack;for(;r.length>0;){let n=r.top();if(n.type===ci)if(n.array[n.position]=i,n.position++,n.position===n.size)i=n.array,r.release(n);else continue e;else if(n.type===Ne){if(i==="__proto__")throw new F.DecodeError("The key __proto__ is not allowed");n.key=this.mapKeyConverter(i),n.type=tn;continue e}else if(n.map[n.key]=i,n.readCount++,n.readCount===n.size)i=n.map,r.release(n);else{n.key=null,n.type=Ne;continue e}}return i}}readHeadByte(){return this.headByte===De&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=De}readArraySize(){let t=this.readHeadByte();switch(t){case 220:return this.readU16();case 221:return this.readU32();default:{if(t<160)return t-144;throw new F.DecodeError(`Unrecognized array type byte: ${(0,li.prettyByte)(t)}`)}}}pushMapState(t){if(t>this.maxMapLength)throw new F.DecodeError(`Max length exceeded: map length (${t}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(t)}pushArrayState(t){if(t>this.maxArrayLength)throw new F.DecodeError(`Max length exceeded: array length (${t}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(t)}decodeString(t,i){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(t,i):this.decodeBinary(t,i)}decodeUtf8String(t,i){if(t>this.maxStrLength)throw new F.DecodeError(`Max length exceeded: UTF-8 byte length (${t}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+i+t)throw en;let r=this.pos+i,n;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(t)?n=this.keyDecoder.decode(this.bytes,r,t):n=(0,bp.utf8Decode)(this.bytes,r,t),this.pos+=i+t,n}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===Ne:!1}decodeBinary(t,i){if(t>this.maxBinLength)throw new F.DecodeError(`Max length exceeded: bin length (${t}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(t+i))throw en;let r=this.pos+i,n=this.bytes.subarray(r,r+t);return this.pos+=i+t,n}decodeExtension(t,i){if(t>this.maxExtLength)throw new F.DecodeError(`Max length exceeded: ext length (${t}) > maxExtLength (${this.maxExtLength})`);let r=this.view.getInt8(this.pos+i),n=this.decodeBinary(t,i+1);return this.extensionCodec.decode(n,r,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){let t=this.view.getUint8(this.pos);return this.pos++,t}readI8(){let t=this.view.getInt8(this.pos);return this.pos++,t}readU16(){let t=this.view.getUint16(this.pos);return this.pos+=2,t}readI16(){let t=this.view.getInt16(this.pos);return this.pos+=2,t}readU32(){let t=this.view.getUint32(this.pos);return this.pos+=4,t}readI32(){let t=this.view.getInt32(this.pos);return this.pos+=4,t}readU64(){let t=(0,J.getUint64)(this.view,this.pos);return this.pos+=8,t}readI64(){let t=(0,J.getInt64)(this.view,this.pos);return this.pos+=8,t}readU64AsBigInt(){let t=this.view.getBigUint64(this.pos);return this.pos+=8,t}readI64AsBigInt(){let t=this.view.getBigInt64(this.pos);return this.pos+=8,t}readF32(){let t=this.view.getFloat32(this.pos);return this.pos+=4,t}readF64(){let t=this.view.getFloat64(this.pos);return this.pos+=8,t}};ft.Decoder=di});var nn=x(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.decode=Ep;yt.decodeMulti=Ip;var rn=mt();function Ep(e,t){return new rn.Decoder(t).decode(e)}function Ip(e,t){return new rn.Decoder(t).decodeMulti(e)}});var sn=x(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.isAsyncIterable=on;Ue.asyncIterableFromStream=an;Ue.ensureAsyncIterable=Sp;function on(e){return e[Symbol.asyncIterator]!=null}async function*an(e){let t=e.getReader();try{for(;;){let{done:i,value:r}=await t.read();if(i)return;yield r}}finally{t.releaseLock()}}function Sp(e){return on(e)?e:an(e)}});var ln=x(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.decodeAsync=kp;Be.decodeArrayStream=Cp;Be.decodeMultiStream=Ap;var gi=mt(),hi=sn();async function kp(e,t){let i=(0,hi.ensureAsyncIterable)(e);return new gi.Decoder(t).decodeAsync(i)}function Cp(e,t){let i=(0,hi.ensureAsyncIterable)(e);return new gi.Decoder(t).decodeArrayStream(i)}function Ap(e,t){let i=(0,hi.ensureAsyncIterable)(e);return new gi.Decoder(t).decodeStream(i)}});var un=x(v=>{"use strict";Object.defineProperty(v,"__esModule",{value:!0});v.decodeTimestampExtension=v.encodeTimestampExtension=v.decodeTimestampToTimeSpec=v.encodeTimeSpecToTimestamp=v.encodeDateToTimeSpec=v.EXT_TIMESTAMP=v.ExtData=v.ExtensionCodec=v.Encoder=v.DecodeError=v.Decoder=v.decodeMultiStream=v.decodeArrayStream=v.decodeAsync=v.decodeMulti=v.decode=v.encode=void 0;var Mp=Yr();Object.defineProperty(v,"encode",{enumerable:!0,get:function(){return Mp.encode}});var cn=nn();Object.defineProperty(v,"decode",{enumerable:!0,get:function(){return cn.decode}});Object.defineProperty(v,"decodeMulti",{enumerable:!0,get:function(){return cn.decodeMulti}});var fi=ln();Object.defineProperty(v,"decodeAsync",{enumerable:!0,get:function(){return fi.decodeAsync}});Object.defineProperty(v,"decodeArrayStream",{enumerable:!0,get:function(){return fi.decodeArrayStream}});Object.defineProperty(v,"decodeMultiStream",{enumerable:!0,get:function(){return fi.decodeMultiStream}});var Tp=mt();Object.defineProperty(v,"Decoder",{enumerable:!0,get:function(){return Tp.Decoder}});var Op=ct();Object.defineProperty(v,"DecodeError",{enumerable:!0,get:function(){return Op.DecodeError}});var jp=ni();Object.defineProperty(v,"Encoder",{enumerable:!0,get:function(){return jp.Encoder}});var Pp=gt();Object.defineProperty(v,"ExtensionCodec",{enumerable:!0,get:function(){return Pp.ExtensionCodec}});var $p=Xt();Object.defineProperty(v,"ExtData",{enumerable:!0,get:function(){return $p.ExtData}});var ye=ei();Object.defineProperty(v,"EXT_TIMESTAMP",{enumerable:!0,get:function(){return ye.EXT_TIMESTAMP}});Object.defineProperty(v,"encodeDateToTimeSpec",{enumerable:!0,get:function(){return ye.encodeDateToTimeSpec}});Object.defineProperty(v,"encodeTimeSpecToTimestamp",{enumerable:!0,get:function(){return ye.encodeTimeSpecToTimestamp}});Object.defineProperty(v,"decodeTimestampToTimeSpec",{enumerable:!0,get:function(){return ye.decodeTimestampToTimeSpec}});Object.defineProperty(v,"encodeTimestampExtension",{enumerable:!0,get:function(){return ye.encodeTimestampExtension}});Object.defineProperty(v,"decodeTimestampExtension",{enumerable:!0,get:function(){return ye.decodeTimestampExtension}})});var Sn=x(T=>{"use strict";Object.defineProperty(T,"__esModule",{value:!0});function C(e){return{enumerable:!0,value:e}}function dn(e){return{enumerable:!0,writable:!0,value:e}}var ee={},Dp=()=>!0,pn=()=>({}),hn=e=>e,Np=(e,t,i,r)=>e.apply(i,r)&&t.apply(i,r),Up=(e,t,i,[r,n])=>t.call(i,e.call(i,r,n),n),Q=(e,t)=>Object.freeze(Object.create(e,t));function gn(e,t,i){return e.reduce((r,n)=>function(...o){return i(r,n,this,o)},t)}function fn(e){return Q(this,{fn:C(e)})}var mn={},yn=fn.bind(mn),Bp=e=>yn((t,i)=>!!~e(t,i)&&t),bn={},Fp=fn.bind(bn);function bt(e,t){return t.filter(i=>e.isPrototypeOf(i))}function _n(e,t,...i){let r=gn(bt(bn,i).map(o=>o.fn),Dp,Np),n=gn(bt(mn,i).map(o=>o.fn),hn,Up);return Q(this,{from:C(e),to:C(t),guards:C(r),reducers:C(n)})}var vn={},wn={},Lp=_n.bind(vn),zp=_n.bind(wn,null);function qp(e,t,i){return yi(t,e,i,this.immediates)||e}function xn(e){let t=new Map;for(let i of e)t.has(i.from)||t.set(i.from,[]),t.get(i.from).push(i);return t}var Vp={enter:hn};function Rp(...e){let t=bt(vn,e),i=bt(wn,e),r={final:C(e.length===0),transitions:C(xn(t))};return i.length&&(r.immediates=C(i),r.enter=C(qp)),Q(Vp,r)}var Hp={enter(e,t,i){let r=this.fn.call(t,t.context,i);return mi.isPrototypeOf(r)?Q(En,{machine:C(r),transitions:C(this.transitions)}).enter(e,t,i):(r.then(n=>t.send({type:"done",data:n})).catch(n=>t.send({type:"error",error:n})),e)}},En={enter(e,t,i){if(t.child=In(this.machine,r=>{t.onChange(r),t.child==r&&r.machine.state.value.final&&(delete t.child,t.send({type:"done",data:r.context}))},t.context,i),t.child.machine.state.value.final){let r=t.child.context;return delete t.child,yi(t,e,{type:"done",data:r},this.transitions.get("done"))}return e}};function Gp(e,...t){let i=C(xn(t));return mi.isPrototypeOf(e)?Q(En,{machine:C(e),transitions:i}):Q(Hp,{fn:C(e),transitions:i})}var mi={get state(){return{name:this.current,value:this.states[this.current]}}};function Qp(e,t,i=pn){return typeof e!="string"&&(i=t||pn,t=e,e=Object.keys(t)[0]),ee._create&&ee._create(e,t),Q(mi,{context:C(i),current:C(e),states:C(t)})}function yi(e,t,i,r){let{context:n}=e;for(let{to:o,guards:a,reducers:s}of r)if(a(n,i)){e.context=s.call(e,n,i);let l=t.original||t,c=Q(l,{current:C(o),original:{value:l}});return ee._onEnter&&ee._onEnter(t,o,e.context,n,i),c.state.value.enter(c,e,i)}}function Kp(e,t){let i=t.type||t,{machine:r}=e,{value:n,name:o}=r.state;return n.transitions.has(i)?yi(e,r,t,n.transitions.get(i))||r:(ee._send&&ee._send(i,o),r)}var Wp={send(e){this.machine=Kp(this,e),this.onChange(this)}};function In(e,t,i,r){let n=Object.create(Wp,{machine:dn(e),context:dn(e.context(i,r)),onChange:C(t)});return n.send=n.send.bind(n),n.machine=n.machine.state.value.enter(n.machine,n,r),n}T.action=Bp;T.createMachine=Qp;T.d=ee;T.guard=Fp;T.immediate=zp;T.interpret=In;T.invoke=Gp;T.reduce=yn;T.state=Rp;T.transition=Lp});var Tn=x(xi=>{"use strict";Object.defineProperty(xi,"__esModule",{value:!0});xi.createRealtimeClient=ug;var vt=un(),y=Sn(),kn=Kt(),bi=Y(),Cn=it(),wi=Z(),Yp=()=>({enqueuedMessage:void 0});function Zp(e){return e.token!==void 0}function Xp(e){return!Zp(e)}function _t(e,t){return Object.assign(Object.assign({},e),{enqueuedMessage:t.message})}function L(e){return e.websocket&&e.websocket.readyState===WebSocket.OPEN&&e.websocket.close(),Object.assign(Object.assign({},e),{websocket:void 0})}function Jp(e,t){return e.websocket&&e.websocket.readyState===WebSocket.OPEN?(t.message instanceof Uint8Array?e.websocket.send(t.message):e.websocket.send((0,vt.encode)(t.message)),Object.assign(Object.assign({},e),{enqueuedMessage:void 0})):Object.assign(Object.assign({},e),{enqueuedMessage:t.message})}function _i(e){return Object.assign(Object.assign({},e),{token:void 0})}function eg(e,t){return Object.assign(Object.assign({},e),{token:t.token})}function tg(e,t){return Object.assign(Object.assign({},e),{websocket:t.websocket})}var ig=(0,y.createMachine)("idle",{idle:(0,y.state)((0,y.transition)("send","connecting",(0,y.reduce)(_t)),(0,y.transition)("expireToken","idle",(0,y.reduce)(_i)),(0,y.transition)("close","idle",(0,y.reduce)(L))),connecting:(0,y.state)((0,y.transition)("connecting","connecting"),(0,y.transition)("connected","active",(0,y.reduce)(tg)),(0,y.transition)("connectionClosed","idle",(0,y.reduce)(L)),(0,y.transition)("send","connecting",(0,y.reduce)(_t)),(0,y.transition)("close","idle",(0,y.reduce)(L)),(0,y.immediate)("authRequired",(0,y.guard)(Xp))),authRequired:(0,y.state)((0,y.transition)("initiateAuth","authInProgress"),(0,y.transition)("send","authRequired",(0,y.reduce)(_t)),(0,y.transition)("close","idle",(0,y.reduce)(L))),authInProgress:(0,y.state)((0,y.transition)("authenticated","connecting",(0,y.reduce)(eg)),(0,y.transition)("unauthorized","idle",(0,y.reduce)(_i),(0,y.reduce)(L)),(0,y.transition)("send","authInProgress",(0,y.reduce)(_t)),(0,y.transition)("close","idle",(0,y.reduce)(L))),active:(0,y.state)((0,y.transition)("send","active",(0,y.reduce)(Jp)),(0,y.transition)("unauthorized","idle",(0,y.reduce)(_i)),(0,y.transition)("connectionClosed","idle",(0,y.reduce)(L)),(0,y.transition)("close","idle",(0,y.reduce)(L))),failed:(0,y.state)((0,y.transition)("send","failed"),(0,y.transition)("close","idle",(0,y.reduce)(L)))},Yp);function rg(e,{token:t,maxBuffering:i}){if(i!==void 0&&(i<1||i>60))throw new Error("The `maxBuffering` must be between 1 and 60 (inclusive)");let r=new URLSearchParams({fal_jwt_token:t});return i!==void 0&&r.set("max_buffering",i.toFixed(0)),`wss://fal.run/${(0,wi.ensureEndpointIdFormat)(e)}/realtime?${r.toString()}`}var ng=128;function og(e){return e.status==="error"&&e.error==="Unauthorized"}var ag={NORMAL_CLOSURE:1e3,GOING_AWAY:1001},vi=new Map,An=new Map;function sg(e,t,i){if(!vi.has(e)){let r=(0,y.interpret)(ig,i);vi.set(e,Object.assign(Object.assign({},r),{throttledSend:t>0?(0,wi.throttle)(r.send,t,!0):r.send}))}return vi.get(e)}var Fe=()=>{},lg={send:Fe,close:Fe};function cg(e){return e.status!=="error"&&e.type!=="x-fal-message"&&!Mn(e)}function Mn(e){return e.type==="x-fal-error"}function ug({config:e}){return{connect(t,i){let{clientOnly:r=(0,wi.isReact)()&&!(0,Cn.isBrowser)(),connectionKey:n=crypto.randomUUID(),maxBuffering:o,throttleInterval:a=ng}=i;if(r&&!(0,Cn.isBrowser)())return lg;let s;An.set(n,{onError:i.onError,onResult:i.onResult});let l=()=>An.get(n),c=sg(n,a,({context:h,machine:p,send:f})=>{let{enqueuedMessage:b,token:_}=h;if(p.current==="active"&&b&&f({type:"send",message:b}),p.current==="authRequired"&&_===void 0&&s!==p.current&&(f({type:"initiateAuth"}),(0,kn.getTemporaryAuthToken)(t,e).then(g=>{f({type:"authenticated",token:g});let m=Math.round(kn.TOKEN_EXPIRATION_SECONDS*.9*1e3);setTimeout(()=>{f({type:"expireToken"})},m)}).catch(g=>{f({type:"unauthorized",error:g})})),p.current==="connecting"&&s!==p.current&&_!==void 0){let g=new WebSocket(rg(t,{token:_,maxBuffering:o}));g.onopen=()=>{f({type:"connected",websocket:g})},g.onclose=m=>{if(m.code!==ag.NORMAL_CLOSURE){let{onError:E=Fe}=l();E(new bi.ApiError({message:`Error closing the connection: ${m.reason}`,status:m.code}))}f({type:"connectionClosed",code:m.code})},g.onerror=m=>{let{onError:E=Fe}=l();E(new bi.ApiError({message:"Unknown error",status:500}))},g.onmessage=m=>{let{onResult:E}=l();if(m.data instanceof ArrayBuffer){let A=(0,vt.decode)(new Uint8Array(m.data));E(A);return}if(m.data instanceof Uint8Array){let A=(0,vt.decode)(m.data);E(A);return}if(m.data instanceof Blob){m.data.arrayBuffer().then(A=>{let Ci=(0,vt.decode)(new Uint8Array(A));E(Ci)});return}let w=JSON.parse(m.data);if(og(w)){f({type:"unauthorized",error:new Error("Unauthorized")});return}if(cg(w)){E(w);return}if(Mn(w)){if(w.error==="TIMEOUT")return;let{onError:A=Fe}=l();A(new bi.ApiError({message:`${w.error}: ${w.reason}`,status:400,body:w}));return}}}s=p.current});return{send:h=>{c.throttledSend({type:"send",message:h})},close:()=>{c.send({type:"close"})}}}}}});var Dn=x(Le=>{"use strict";var te=Le&&Le.__awaiter||function(e,t,i,r){function n(o){return o instanceof i?o:new i(function(a){a(o)})}return new(i||(i=Promise))(function(o,a){function s(u){try{c(r.next(u))}catch(d){a(d)}}function l(u){try{c(r.throw(u))}catch(d){a(d)}}function c(u){u.done?o(u.value):n(u.value).then(s,l)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(Le,"__esModule",{value:!0});Le.createStorageClient=fg;var On=rt(),jn=fe(),dg=Z();function Pn(e){var t;let[i,r]=e.split("/");return(t=r.split(/[-;]/)[0])!==null&&t!==void 0?t:"bin"}function pg(e,t,i){return te(this,void 0,void 0,function*(){let r=e.name||`${Date.now()}.${Pn(i)}`;return yield(0,jn.dispatchRequest)({method:"POST",targetUrl:`${(0,On.getRestApiUrl)()}/storage/upload/initiate?storage_type=fal-cdn-v3`,input:{content_type:i,file_name:r},config:t})})}function gg(e,t,i){return te(this,void 0,void 0,function*(){let r=e.name||`${Date.now()}.${Pn(i)}`;return yield(0,jn.dispatchRequest)({method:"POST",targetUrl:`${(0,On.getRestApiUrl)()}/storage/upload/initiate-multipart?storage_type=fal-cdn-v3`,input:{content_type:i,file_name:r},config:t})})}function $n(e,t,i){return te(this,arguments,void 0,function*(r,n,o,a=3){if(a===0)throw new Error("Part upload failed, retries exhausted");let{fetch:s,responseHandler:l}=o;try{let c=yield s(r,{method:"PUT",body:n});return yield l(c)}catch{return yield $n(r,n,o,a-1)}})}function hg(e,t){return te(this,void 0,void 0,function*(){let{fetch:i,responseHandler:r}=t,n=e.type||"application/octet-stream",{upload_url:o,file_url:a}=yield gg(e,t,n),s=10*1024*1024,l=Math.ceil(e.size/s),c=new URL(o),u=[];for(let p=0;p<l;p++){let f=p*s,b=Math.min(f+s,e.size),_=e.slice(f,b),g=p+1,m=`${c.origin}${c.pathname}/${g}${c.search}`;u.push(yield $n(m,_,t))}let d=`${c.origin}${c.pathname}/complete${c.search}`,h=yield i(d,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parts:u.map(p=>({partNumber:p.partNumber,etag:p.etag}))})});return yield r(h),a})}function fg({config:e}){let t={upload:i=>te(this,void 0,void 0,function*(){if(i.size>94371840)return yield hg(i,e);let r=i.type||"application/octet-stream",{fetch:n,responseHandler:o}=e,{upload_url:a,file_url:s}=yield pg(i,e,r),l=yield n(a,{method:"PUT",body:i,headers:{"Content-Type":i.type||"application/octet-stream"}});return yield o(l),s}),transformInput:i=>te(this,void 0,void 0,function*(){if(Array.isArray(i))return Promise.all(i.map(r=>t.transformInput(r)));if(i instanceof Blob)return yield t.upload(i);if((0,dg.isPlainObject)(i)){let n=Object.entries(i).map(a=>te(this,[a],void 0,function*([s,l]){return[s,yield t.transformInput(l)]})),o=yield Promise.all(n);return Object.fromEntries(o)}return i})};return t}});var Ei=x(ze=>{"use strict";var Nn=ze&&ze.__awaiter||function(e,t,i,r){function n(o){return o instanceof i?o:new i(function(a){a(o)})}return new(i||(i=Promise))(function(o,a){function s(u){try{c(r.next(u))}catch(d){a(d)}}function l(u){try{c(r.throw(u))}catch(d){a(d)}}function c(u){u.done?o(u.value):n(u.value).then(s,l)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(ze,"__esModule",{value:!0});ze.createFalClient=xg;var mg=rt(),yg=Ur(),bg=Tn(),Un=fe(),_g=Y(),vg=Dn(),wg=Yt();function xg(e={}){let t=(0,mg.createConfig)(e),i=(0,vg.createStorageClient)({config:t}),r=(0,yg.createQueueClient)({config:t,storage:i}),n=(0,wg.createStreamingClient)({config:t,storage:i}),o=(0,bg.createRealtimeClient)({config:t});return{queue:r,realtime:o,storage:i,streaming:n,stream:n.stream,run(a){return Nn(this,arguments,void 0,function*(s,l={}){let c=l.input?yield i.transformInput(l.input):void 0;return(0,Un.dispatchRequest)({method:l.method,targetUrl:(0,Un.buildUrl)(s,l),input:c,config:Object.assign(Object.assign({},t),{responseHandler:_g.resultResponseHandler}),options:{signal:l.abortSignal}})})},subscribe:(a,s)=>Nn(this,void 0,void 0,function*(){let{request_id:l}=yield r.submit(a,s);return s.onEnqueue&&s.onEnqueue(l),yield r.subscribeToStatus(a,Object.assign({requestId:l},s)),r.result(a,{requestId:l})})}}});var Fn=x(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.isQueueStatus=Bn;wt.isCompletedQueueStatus=Eg;function Bn(e){return e&&e.status&&e.response_url}function Eg(e){return Bn(e)&&e.status==="COMPLETED"}});var Ii=x(k=>{"use strict";var Ig=k&&k.__createBinding||(Object.create?function(e,t,i,r){r===void 0&&(r=i);var n=Object.getOwnPropertyDescriptor(t,i);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,r,n)}:function(e,t,i,r){r===void 0&&(r=i),e[r]=t[i]}),Sg=k&&k.__exportStar||function(e,t){for(var i in e)i!=="default"&&!Object.prototype.hasOwnProperty.call(t,i)&&Ig(t,e,i)};Object.defineProperty(k,"__esModule",{value:!0});k.fal=k.parseEndpointId=k.ValidationError=k.ApiError=k.withProxy=k.withMiddleware=k.createFalClient=void 0;var Ln=Ei(),kg=Ei();Object.defineProperty(k,"createFalClient",{enumerable:!0,get:function(){return kg.createFalClient}});var zn=Ht();Object.defineProperty(k,"withMiddleware",{enumerable:!0,get:function(){return zn.withMiddleware}});Object.defineProperty(k,"withProxy",{enumerable:!0,get:function(){return zn.withProxy}});var qn=Y();Object.defineProperty(k,"ApiError",{enumerable:!0,get:function(){return qn.ApiError}});Object.defineProperty(k,"ValidationError",{enumerable:!0,get:function(){return qn.ValidationError}});Sg(Fn(),k);var Cg=Z();Object.defineProperty(k,"parseEndpointId",{enumerable:!0,get:function(){return Cg.parseEndpointId}});k.fal=function(){let t=(0,Ln.createFalClient)();return{config(i){t=(0,Ln.createFalClient)(i)},get queue(){return t.queue},get realtime(){return t.realtime},get storage(){return t.storage},get streaming(){return t.streaming},run(i,r){return t.run(i,r)},subscribe(i,r){return t.subscribe(i,r)},stream(i,r){return t.stream(i,r)}}}()});var eo=`
|
|
5
|
+
`;else if(_==="event")a=w;else if(_==="id"&&!w.includes("\0"))o=w;else if(_==="retry"){let A=parseInt(w,10);Number.isNaN(A)||e({type:"reconnect-interval",value:A})}}}var Ur=[239,187,191];function Pd(e){return Ur.every((t,i)=>e.charCodeAt(i)===t)}Yt.createParser=jd});var Zt=x(R=>{"use strict";var $d=R&&R.__awaiter||function(e,t,i,r){function n(o){return o instanceof i?o:new i(function(a){a(o)})}return new(i||(i=Promise))(function(o,a){function s(u){try{c(r.next(u))}catch(d){a(d)}}function l(u){try{c(r.throw(u))}catch(d){a(d)}}function c(u){u.done?o(u.value):n(u.value).then(s,l)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(R,"__esModule",{value:!0});R.TOKEN_EXPIRATION_SECONDS=void 0;R.getTemporaryAuthToken=Bd;var Dd=rt(),Ud=fe(),Nd=Z();R.TOKEN_EXPIRATION_SECONDS=120;function Bd(e,t){return $d(this,void 0,void 0,function*(){let i=(0,Nd.parseEndpointId)(e),r=yield(0,Ud.dispatchRequest)({method:"POST",targetUrl:`${(0,Dd.getRestApiUrl)()}/tokens/`,config:t,input:{allowed_apps:[i.alias],token_expiration:R.TOKEN_EXPIRATION_SECONDS}});return typeof r!="string"&&r.detail?r.detail:r})}});var Jt=x(O=>{"use strict";var je=O&&O.__awaiter||function(e,t,i,r){function n(o){return o instanceof i?o:new i(function(a){a(o)})}return new(i||(i=Promise))(function(o,a){function s(u){try{c(r.next(u))}catch(d){a(d)}}function l(u){try{c(r.throw(u))}catch(d){a(d)}}function c(u){u.done?o(u.value):n(u.value).then(s,l)}c((r=r.apply(e,t||[])).next())})},Pe=O&&O.__await||function(e){return this instanceof Pe?(this.v=e,this):new Pe(e)},Fd=O&&O.__asyncGenerator||function(e,t,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=i.apply(e,t||[]),n,o=[];return n={},s("next"),s("throw"),s("return",a),n[Symbol.asyncIterator]=function(){return this},n;function a(p){return function(f){return Promise.resolve(f).then(p,d)}}function s(p,f){r[p]&&(n[p]=function(b){return new Promise(function(_,g){o.push([p,b,_,g])>1||l(p,b)})},f&&(n[p]=f(n[p])))}function l(p,f){try{c(r[p](f))}catch(b){h(o[0][3],b)}}function c(p){p.value instanceof Pe?Promise.resolve(p.value.v).then(u,d):h(o[0][2],p)}function u(p){l("next",p)}function d(p){l("throw",p)}function h(p,f){p(f),o.shift(),o.length&&l(o[0][0],o[0][1])}};Object.defineProperty(O,"__esModule",{value:!0});O.FalStream=void 0;O.createStreamingClient=Vd;var Ld=Nr(),zd=Zt(),Br=fe(),me=Y(),Xt="text/event-stream",qd=15*1e3,nt=class{constructor(t,i,r){var n;this.listeners=new Map,this.buffer=[],this.currentData=void 0,this.lastEventTimestamp=0,this.streamClosed=!1,this.abortController=new AbortController,this.start=()=>je(this,void 0,void 0,function*(){var o,a;let{endpointId:s,options:l}=this,{input:c,method:u="post",connectionMode:d="server"}=l;try{if(d==="client"){let h=yield(0,zd.getTemporaryAuthToken)(s,this.config),{fetch:p}=this.config,f=new URL(this.url);f.searchParams.set("fal_jwt_token",h);let b=yield p(f.toString(),{method:u.toUpperCase(),headers:{accept:(o=l.accept)!==null&&o!==void 0?o:Xt,"content-type":"application/json"},body:c&&u!=="get"?JSON.stringify(c):void 0,signal:this.abortController.signal});return yield this.handleResponse(b)}return yield(0,Br.dispatchRequest)({method:u.toUpperCase(),targetUrl:this.url,input:c,config:this.config,options:{headers:{accept:(a=l.accept)!==null&&a!==void 0?a:Xt},responseHandler:this.handleResponse,signal:this.abortController.signal}})}catch(h){this.handleError(h)}}),this.handleResponse=o=>je(this,void 0,void 0,function*(){var a,s;if(!o.ok){try{yield(0,me.defaultResponseHandler)(o)}catch(b){this.emit("error",b)}return}let l=o.body;if(!l){this.emit("error",new me.ApiError({message:"Response body is empty.",status:400,body:void 0}));return}if(!((a=o.headers.get("content-type"))!==null&&a!==void 0?a:"").startsWith(Xt)){let b=l.getReader(),_=()=>{b.read().then(({done:g,value:m})=>{if(g){this.emit("done",this.currentData);return}this.currentData=m,this.emit("data",m),_()})};_();return}let u=new TextDecoder("utf-8"),d=o.body.getReader(),h=(0,Ld.createParser)(b=>{if(b.type==="event"){let _=b.data;try{let g=JSON.parse(_);this.buffer.push(g),this.currentData=g,this.emit("data",g),this.emit("message",g)}catch(g){this.emit("error",g)}}}),p=(s=this.options.timeout)!==null&&s!==void 0?s:qd,f=()=>je(this,void 0,void 0,function*(){let{value:b,done:_}=yield d.read();this.lastEventTimestamp=Date.now(),h.feed(u.decode(b)),Date.now()-this.lastEventTimestamp>p&&this.emit("error",new me.ApiError({message:`Event stream timed out after ${(p/1e3).toFixed(0)} seconds with no messages.`,status:408})),_?this.emit("done",this.currentData):f().catch(this.handleError)});f().catch(this.handleError)}),this.handleError=o=>{var a;if(o.name==="AbortError"||this.signal.aborted)return;let s=o instanceof me.ApiError?o:new me.ApiError({message:(a=o.message)!==null&&a!==void 0?a:"An unknown error occurred",status:500});this.emit("error",s)},this.on=(o,a)=>{var s;this.listeners.has(o)||this.listeners.set(o,[]),(s=this.listeners.get(o))===null||s===void 0||s.push(a)},this.emit=(o,a)=>{let s=this.listeners.get(o)||[];for(let l of s)l(a)},this.done=()=>je(this,void 0,void 0,function*(){return this.donePromise}),this.abort=o=>{this.streamClosed||this.abortController.abort(o)},this.endpointId=t,this.config=i,this.url=(n=r.url)!==null&&n!==void 0?n:(0,Br.buildUrl)(t,{path:"/stream",query:r.queryParams}),this.options=r,this.donePromise=new Promise((o,a)=>{this.streamClosed&&a(new me.ApiError({message:"Streaming connection is already closed.",status:400,body:void 0})),this.signal.addEventListener("abort",()=>{var s;o((s=this.currentData)!==null&&s!==void 0?s:{})}),this.on("done",s=>{this.streamClosed=!0,o(s)}),this.on("error",s=>{this.streamClosed=!0,a(s)})}),r.signal&&r.signal.addEventListener("abort",()=>{this.abortController.abort()}),this.start().catch(this.handleError)}[Symbol.asyncIterator](){return Fd(this,arguments,function*(){let i=!0,r=()=>i=!1;for(this.on("error",r),this.on("done",r);i||this.buffer.length>0;){let n=this.buffer.shift();n&&(yield yield Pe(n)),yield Pe(new Promise(o=>setTimeout(o,16)))}})}get signal(){return this.abortController.signal}};O.FalStream=nt;function Vd({config:e,storage:t}){return{stream(i,r){return je(this,void 0,void 0,function*(){let n=r.input?yield t.transformInput(r.input):void 0;return new nt(i,e,Object.assign(Object.assign({},r),{input:n}))})}}}});var Lr=x(H=>{"use strict";var X=H&&H.__awaiter||function(e,t,i,r){function n(o){return o instanceof i?o:new i(function(a){a(o)})}return new(i||(i=Promise))(function(o,a){function s(u){try{c(r.next(u))}catch(d){a(d)}}function l(u){try{c(r.throw(u))}catch(d){a(d)}}function c(u){u.done?o(u.value):n(u.value).then(s,l)}c((r=r.apply(e,t||[])).next())})},Rd=H&&H.__rest||function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]]);return i};Object.defineProperty(H,"__esModule",{value:!0});H.createQueueClient=void 0;var N=fe(),Hd=Y(),Gd=Jt(),ot=Z(),Fr=500,Qd=({config:e,storage:t})=>{let i={submit(r,n){return X(this,void 0,void 0,function*(){let{webhookUrl:o,priority:a}=n,s=Rd(n,["webhookUrl","priority"]),l=n.input?yield t.transformInput(n.input):void 0;return(0,N.dispatchRequest)({method:n.method,targetUrl:(0,N.buildUrl)(r,Object.assign(Object.assign({},s),{subdomain:"queue",query:o?{fal_webhook:o}:void 0})),headers:{"x-fal-queue-priority":a??"normal"},input:l,config:e,options:{signal:n.abortSignal}})})},status(r,n){return X(this,arguments,void 0,function*(o,{requestId:a,logs:s=!1,abortSignal:l}){let c=(0,ot.parseEndpointId)(o),u=c.namespace?`${c.namespace}/`:"";return(0,N.dispatchRequest)({method:"get",targetUrl:(0,N.buildUrl)(`${u}${c.owner}/${c.alias}`,{subdomain:"queue",query:{logs:s?"1":"0"},path:`/requests/${a}/status`}),config:e,options:{signal:l}})})},streamStatus(r,n){return X(this,arguments,void 0,function*(o,{requestId:a,logs:s=!1,connectionMode:l}){let c=(0,ot.parseEndpointId)(o),u=c.namespace?`${c.namespace}/`:"",d={logs:s?"1":"0"},h=(0,N.buildUrl)(`${u}${c.owner}/${c.alias}`,{subdomain:"queue",path:`/requests/${a}/status/stream`,query:d});return new Gd.FalStream(o,e,{url:h,method:"get",connectionMode:l,queryParams:d})})},subscribeToStatus(r,n){return X(this,void 0,void 0,function*(){let o=n.requestId,a=n.timeout,s,l=()=>{};if(n.mode==="streaming"){let c=yield i.streamStatus(r,{requestId:o,logs:n.logs,connectionMode:"connectionMode"in n?n.connectionMode:void 0}),u=[];a&&(s=setTimeout(()=>{throw c.abort(),i.cancel(r,{requestId:o}).catch(l),new Error(`Client timed out waiting for the request to complete after ${a}ms`)},a)),c.on("data",h=>{n.onQueueUpdate&&("logs"in h&&Array.isArray(h.logs)&&h.logs.length>0&&u.push(...h.logs),n.onQueueUpdate("logs"in h?Object.assign(Object.assign({},h),{logs:u}):h))});let d=yield c.done();return s&&clearTimeout(s),d}return new Promise((c,u)=>{var d;let h,p="pollInterval"in n&&typeof n.pollInterval=="number"&&(d=n.pollInterval)!==null&&d!==void 0?d:Fr,f=()=>{s&&clearTimeout(s),h&&clearTimeout(h)};a&&(s=setTimeout(()=>{f(),i.cancel(r,{requestId:o}).catch(l),u(new Error(`Client timed out waiting for the request to complete after ${a}ms`))},a));let b=()=>X(this,void 0,void 0,function*(){var _;try{let g=yield i.status(r,{requestId:o,logs:(_=n.logs)!==null&&_!==void 0?_:!1,abortSignal:n.abortSignal});if(n.onQueueUpdate&&n.onQueueUpdate(g),g.status==="COMPLETED"){f(),c(g);return}h=setTimeout(b,p)}catch(g){f(),u(g)}});b().catch(u)})})},result(r,n){return X(this,arguments,void 0,function*(o,{requestId:a,abortSignal:s}){let l=(0,ot.parseEndpointId)(o),c=l.namespace?`${l.namespace}/`:"";return(0,N.dispatchRequest)({method:"get",targetUrl:(0,N.buildUrl)(`${c}${l.owner}/${l.alias}`,{subdomain:"queue",path:`/requests/${a}`}),config:Object.assign(Object.assign({},e),{responseHandler:Hd.resultResponseHandler}),options:{signal:s}})})},cancel(r,n){return X(this,arguments,void 0,function*(o,{requestId:a,abortSignal:s}){let l=(0,ot.parseEndpointId)(o),c=l.namespace?`${l.namespace}/`:"";yield(0,N.dispatchRequest)({method:"put",targetUrl:(0,N.buildUrl)(`${c}${l.owner}/${l.alias}`,{subdomain:"queue",path:`/requests/${a}/cancel`}),config:e,options:{signal:s}})})}};return i};H.createQueueClient=Qd});var at=x(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.utf8Count=Kd;B.utf8EncodeJs=zr;B.utf8EncodeTE=qr;B.utf8Encode=Zd;B.utf8DecodeJs=Vr;B.utf8DecodeTD=Rr;B.utf8Decode=tp;function Kd(e){let t=e.length,i=0,r=0;for(;r<t;){let n=e.charCodeAt(r++);if(n&4294967168)if(!(n&4294965248))i+=2;else{if(n>=55296&&n<=56319&&r<t){let o=e.charCodeAt(r);(o&64512)===56320&&(++r,n=((n&1023)<<10)+(o&1023)+65536)}n&4294901760?i+=4:i+=3}else{i++;continue}}return i}function zr(e,t,i){let r=e.length,n=i,o=0;for(;o<r;){let a=e.charCodeAt(o++);if(a&4294967168)if(!(a&4294965248))t[n++]=a>>6&31|192;else{if(a>=55296&&a<=56319&&o<r){let s=e.charCodeAt(o);(s&64512)===56320&&(++o,a=((a&1023)<<10)+(s&1023)+65536)}a&4294901760?(t[n++]=a>>18&7|240,t[n++]=a>>12&63|128,t[n++]=a>>6&63|128):(t[n++]=a>>12&15|224,t[n++]=a>>6&63|128)}else{t[n++]=a;continue}t[n++]=a&63|128}}var Wd=new TextEncoder,Yd=50;function qr(e,t,i){Wd.encodeInto(e,t.subarray(i))}function Zd(e,t,i){e.length>Yd?qr(e,t,i):zr(e,t,i)}var Xd=4096;function Vr(e,t,i){let r=t,n=r+i,o=[],a="";for(;r<n;){let s=e[r++];if(!(s&128))o.push(s);else if((s&224)===192){let l=e[r++]&63;o.push((s&31)<<6|l)}else if((s&240)===224){let l=e[r++]&63,c=e[r++]&63;o.push((s&31)<<12|l<<6|c)}else if((s&248)===240){let l=e[r++]&63,c=e[r++]&63,u=e[r++]&63,d=(s&7)<<18|l<<12|c<<6|u;d>65535&&(d-=65536,o.push(d>>>10&1023|55296),d=56320|d&1023),o.push(d)}else o.push(s);o.length>=Xd&&(a+=String.fromCharCode(...o),o.length=0)}return o.length>0&&(a+=String.fromCharCode(...o)),a}var Jd=new TextDecoder,ep=200;function Rr(e,t,i){let r=e.subarray(t,t+i);return Jd.decode(r)}function tp(e,t,i){return i>ep?Rr(e,t,i):Vr(e,t,i)}});var ti=x(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.ExtData=void 0;var ei=class{constructor(t,i){this.type=t,this.data=i}};st.ExtData=ei});var ct=x(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.DecodeError=void 0;var ii=class e extends Error{constructor(t){super(t);let i=Object.create(e.prototype);Object.setPrototypeOf(this,i),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:e.name})}};lt.DecodeError=ii});var ut=x(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});G.UINT32_MAX=void 0;G.setUint64=ip;G.setInt64=rp;G.getInt64=np;G.getUint64=op;G.UINT32_MAX=4294967295;function ip(e,t,i){let r=i/4294967296,n=i;e.setUint32(t,r),e.setUint32(t+4,n)}function rp(e,t,i){let r=Math.floor(i/4294967296),n=i;e.setUint32(t,r),e.setUint32(t+4,n)}function np(e,t){let i=e.getInt32(t),r=e.getUint32(t+4);return i*4294967296+r}function op(e,t){let i=e.getUint32(t),r=e.getUint32(t+4);return i*4294967296+r}});var ri=x(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.timestampExtension=M.EXT_TIMESTAMP=void 0;M.encodeTimeSpecToTimestamp=Gr;M.encodeDateToTimeSpec=Qr;M.encodeTimestampExtension=Kr;M.decodeTimestampToTimeSpec=Wr;M.decodeTimestampExtension=Yr;var ap=ct(),Hr=ut();M.EXT_TIMESTAMP=-1;var sp=4294967296-1,lp=17179869184-1;function Gr({sec:e,nsec:t}){if(e>=0&&t>=0&&e<=lp)if(t===0&&e<=sp){let i=new Uint8Array(4);return new DataView(i.buffer).setUint32(0,e),i}else{let i=e/4294967296,r=e&4294967295,n=new Uint8Array(8),o=new DataView(n.buffer);return o.setUint32(0,t<<2|i&3),o.setUint32(4,r),n}else{let i=new Uint8Array(12),r=new DataView(i.buffer);return r.setUint32(0,t),(0,Hr.setInt64)(r,4,e),i}}function Qr(e){let t=e.getTime(),i=Math.floor(t/1e3),r=(t-i*1e3)*1e6,n=Math.floor(r/1e9);return{sec:i+n,nsec:r-n*1e9}}function Kr(e){if(e instanceof Date){let t=Qr(e);return Gr(t)}else return null}function Wr(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{let i=t.getUint32(0),r=t.getUint32(4),n=(i&3)*4294967296+r,o=i>>>2;return{sec:n,nsec:o}}case 12:{let i=(0,Hr.getInt64)(t,4),r=t.getUint32(0);return{sec:i,nsec:r}}default:throw new ap.DecodeError(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${e.length}`)}}function Yr(e){let t=Wr(e);return new Date(t.sec*1e3+t.nsec/1e6)}M.timestampExtension={type:M.EXT_TIMESTAMP,encode:Kr,decode:Yr}});var gt=x(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.ExtensionCodec=void 0;var dt=ti(),cp=ri(),$e=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(cp.timestampExtension)}register({type:t,encode:i,decode:r}){if(t>=0)this.encoders[t]=i,this.decoders[t]=r;else{let n=-1-t;this.builtInEncoders[n]=i,this.builtInDecoders[n]=r}}tryToEncode(t,i){for(let r=0;r<this.builtInEncoders.length;r++){let n=this.builtInEncoders[r];if(n!=null){let o=n(t,i);if(o!=null){let a=-1-r;return new dt.ExtData(a,o)}}}for(let r=0;r<this.encoders.length;r++){let n=this.encoders[r];if(n!=null){let o=n(t,i);if(o!=null){let a=r;return new dt.ExtData(a,o)}}}return t instanceof dt.ExtData?t:null}decode(t,i,r){let n=i<0?this.builtInDecoders[-1-i]:this.decoders[i];return n?n(t,i,r):new dt.ExtData(i,t)}};pt.ExtensionCodec=$e;$e.defaultCodec=new $e});var oi=x(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.ensureUint8Array=dp;function up(e){return e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer}function dp(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):up(e)?new Uint8Array(e):Uint8Array.from(e)}});var si=x($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.Encoder=$.DEFAULT_INITIAL_BUFFER_SIZE=$.DEFAULT_MAX_DEPTH=void 0;var Zr=at(),pp=gt(),Xr=ut(),gp=oi();$.DEFAULT_MAX_DEPTH=100;$.DEFAULT_INITIAL_BUFFER_SIZE=2048;var ai=class e{constructor(t){this.entered=!1,this.extensionCodec=t?.extensionCodec??pp.ExtensionCodec.defaultCodec,this.context=t?.context,this.useBigInt64=t?.useBigInt64??!1,this.maxDepth=t?.maxDepth??$.DEFAULT_MAX_DEPTH,this.initialBufferSize=t?.initialBufferSize??$.DEFAULT_INITIAL_BUFFER_SIZE,this.sortKeys=t?.sortKeys??!1,this.forceFloat32=t?.forceFloat32??!1,this.ignoreUndefined=t?.ignoreUndefined??!1,this.forceIntegerToFloat=t?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new e({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(t){if(this.entered)return this.clone().encodeSharedRef(t);try{return this.entered=!0,this.reinitializeState(),this.doEncode(t,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(t){if(this.entered)return this.clone().encode(t);try{return this.entered=!0,this.reinitializeState(),this.doEncode(t,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(t,i){if(i>this.maxDepth)throw new Error(`Too deep objects in depth ${i}`);t==null?this.encodeNil():typeof t=="boolean"?this.encodeBoolean(t):typeof t=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(t):this.encodeNumber(t):typeof t=="string"?this.encodeString(t):this.useBigInt64&&typeof t=="bigint"?this.encodeBigInt64(t):this.encodeObject(t,i)}ensureBufferSizeToWrite(t){let i=this.pos+t;this.view.byteLength<i&&this.resizeBuffer(i*2)}resizeBuffer(t){let i=new ArrayBuffer(t),r=new Uint8Array(i),n=new DataView(i);r.set(this.bytes),this.view=n,this.bytes=r}encodeNil(){this.writeU8(192)}encodeBoolean(t){t===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(t){!this.forceIntegerToFloat&&Number.isSafeInteger(t)?t>=0?t<128?this.writeU8(t):t<256?(this.writeU8(204),this.writeU8(t)):t<65536?(this.writeU8(205),this.writeU16(t)):t<4294967296?(this.writeU8(206),this.writeU32(t)):this.useBigInt64?this.encodeNumberAsFloat(t):(this.writeU8(207),this.writeU64(t)):t>=-32?this.writeU8(224|t+32):t>=-128?(this.writeU8(208),this.writeI8(t)):t>=-32768?(this.writeU8(209),this.writeI16(t)):t>=-2147483648?(this.writeU8(210),this.writeI32(t)):this.useBigInt64?this.encodeNumberAsFloat(t):(this.writeU8(211),this.writeI64(t)):this.encodeNumberAsFloat(t)}encodeNumberAsFloat(t){this.forceFloat32?(this.writeU8(202),this.writeF32(t)):(this.writeU8(203),this.writeF64(t))}encodeBigInt64(t){t>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(t)):(this.writeU8(211),this.writeBigInt64(t))}writeStringHeader(t){if(t<32)this.writeU8(160+t);else if(t<256)this.writeU8(217),this.writeU8(t);else if(t<65536)this.writeU8(218),this.writeU16(t);else if(t<4294967296)this.writeU8(219),this.writeU32(t);else throw new Error(`Too long string: ${t} bytes in UTF-8`)}encodeString(t){let r=(0,Zr.utf8Count)(t);this.ensureBufferSizeToWrite(5+r),this.writeStringHeader(r),(0,Zr.utf8Encode)(t,this.bytes,this.pos),this.pos+=r}encodeObject(t,i){let r=this.extensionCodec.tryToEncode(t,this.context);if(r!=null)this.encodeExtension(r);else if(Array.isArray(t))this.encodeArray(t,i);else if(ArrayBuffer.isView(t))this.encodeBinary(t);else if(typeof t=="object")this.encodeMap(t,i);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(t)}`)}encodeBinary(t){let i=t.byteLength;if(i<256)this.writeU8(196),this.writeU8(i);else if(i<65536)this.writeU8(197),this.writeU16(i);else if(i<4294967296)this.writeU8(198),this.writeU32(i);else throw new Error(`Too large binary: ${i}`);let r=(0,gp.ensureUint8Array)(t);this.writeU8a(r)}encodeArray(t,i){let r=t.length;if(r<16)this.writeU8(144+r);else if(r<65536)this.writeU8(220),this.writeU16(r);else if(r<4294967296)this.writeU8(221),this.writeU32(r);else throw new Error(`Too large array: ${r}`);for(let n of t)this.doEncode(n,i+1)}countWithoutUndefined(t,i){let r=0;for(let n of i)t[n]!==void 0&&r++;return r}encodeMap(t,i){let r=Object.keys(t);this.sortKeys&&r.sort();let n=this.ignoreUndefined?this.countWithoutUndefined(t,r):r.length;if(n<16)this.writeU8(128+n);else if(n<65536)this.writeU8(222),this.writeU16(n);else if(n<4294967296)this.writeU8(223),this.writeU32(n);else throw new Error(`Too large map object: ${n}`);for(let o of r){let a=t[o];this.ignoreUndefined&&a===void 0||(this.encodeString(o),this.doEncode(a,i+1))}}encodeExtension(t){if(typeof t.data=="function"){let r=t.data(this.pos+6),n=r.length;if(n>=4294967296)throw new Error(`Too large extension object: ${n}`);this.writeU8(201),this.writeU32(n),this.writeI8(t.type),this.writeU8a(r);return}let i=t.data.length;if(i===1)this.writeU8(212);else if(i===2)this.writeU8(213);else if(i===4)this.writeU8(214);else if(i===8)this.writeU8(215);else if(i===16)this.writeU8(216);else if(i<256)this.writeU8(199),this.writeU8(i);else if(i<65536)this.writeU8(200),this.writeU16(i);else if(i<4294967296)this.writeU8(201),this.writeU32(i);else throw new Error(`Too large extension object: ${i}`);this.writeI8(t.type),this.writeU8a(t.data)}writeU8(t){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,t),this.pos++}writeU8a(t){let i=t.length;this.ensureBufferSizeToWrite(i),this.bytes.set(t,this.pos),this.pos+=i}writeI8(t){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,t),this.pos++}writeU16(t){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,t),this.pos+=2}writeI16(t){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,t),this.pos+=2}writeU32(t){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,t),this.pos+=4}writeI32(t){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,t),this.pos+=4}writeF32(t){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,t),this.pos+=4}writeF64(t){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,t),this.pos+=8}writeU64(t){this.ensureBufferSizeToWrite(8),(0,Xr.setUint64)(this.view,this.pos,t),this.pos+=8}writeI64(t){this.ensureBufferSizeToWrite(8),(0,Xr.setInt64)(this.view,this.pos,t),this.pos+=8}writeBigUint64(t){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,t),this.pos+=8}writeBigInt64(t){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,t),this.pos+=8}};$.Encoder=ai});var Jr=x(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});li.encode=fp;var hp=si();function fp(e,t){return new hp.Encoder(t).encodeSharedRef(e)}});var en=x(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.prettyByte=mp;function mp(e){return`${e<0?"-":""}0x${Math.abs(e).toString(16).padStart(2,"0")}`}});var tn=x(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.CachedKeyDecoder=void 0;var yp=at(),bp=16,_p=16,ui=class{constructor(t=bp,i=_p){this.hit=0,this.miss=0,this.maxKeyLength=t,this.maxLengthPerKey=i,this.caches=[];for(let r=0;r<this.maxKeyLength;r++)this.caches.push([])}canBeCached(t){return t>0&&t<=this.maxKeyLength}find(t,i,r){let n=this.caches[r-1];e:for(let o of n){let a=o.bytes;for(let s=0;s<r;s++)if(a[s]!==t[i+s])continue e;return o.str}return null}store(t,i){let r=this.caches[t.length-1],n={bytes:t,str:i};r.length>=this.maxLengthPerKey?r[Math.random()*r.length|0]=n:r.push(n)}decode(t,i,r){let n=this.find(t,i,r);if(n!=null)return this.hit++,n;this.miss++;let o=(0,yp.utf8DecodeJs)(t,i,r),a=Uint8Array.prototype.slice.call(t,i,i+r);return this.store(a,o),o}};ht.CachedKeyDecoder=ui});var mt=x(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.Decoder=void 0;var di=en(),vp=gt(),J=ut(),wp=at(),rn=oi(),xp=tn(),F=ct(),pi="array",Ue="map_key",on="map_value",Ep=e=>{if(typeof e=="string"||typeof e=="number")return e;throw new F.DecodeError("The type of key must be string or number but "+typeof e)},gi=class{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(t){let i=this.getUninitializedStateFromPool();i.type=pi,i.position=0,i.size=t,i.array=new Array(t)}pushMapState(t){let i=this.getUninitializedStateFromPool();i.type=Ue,i.readCount=0,i.size=t,i.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){let t={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(t)}return this.stack[this.stackHeadPosition]}release(t){if(this.stack[this.stackHeadPosition]!==t)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(t.type===pi){let r=t;r.size=0,r.array=void 0,r.position=0,r.type=void 0}if(t.type===Ue||t.type===on){let r=t;r.size=0,r.map=void 0,r.readCount=0,r.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}},De=-1,fi=new DataView(new ArrayBuffer(0)),Ip=new Uint8Array(fi.buffer);try{fi.getInt8(0)}catch(e){if(!(e instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}var nn=new RangeError("Insufficient data"),Sp=new xp.CachedKeyDecoder,hi=class e{constructor(t){this.totalPos=0,this.pos=0,this.view=fi,this.bytes=Ip,this.headByte=De,this.stack=new gi,this.entered=!1,this.extensionCodec=t?.extensionCodec??vp.ExtensionCodec.defaultCodec,this.context=t?.context,this.useBigInt64=t?.useBigInt64??!1,this.rawStrings=t?.rawStrings??!1,this.maxStrLength=t?.maxStrLength??J.UINT32_MAX,this.maxBinLength=t?.maxBinLength??J.UINT32_MAX,this.maxArrayLength=t?.maxArrayLength??J.UINT32_MAX,this.maxMapLength=t?.maxMapLength??J.UINT32_MAX,this.maxExtLength=t?.maxExtLength??J.UINT32_MAX,this.keyDecoder=t?.keyDecoder!==void 0?t.keyDecoder:Sp,this.mapKeyConverter=t?.mapKeyConverter??Ep}clone(){return new e({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=De,this.stack.reset()}setBuffer(t){let i=(0,rn.ensureUint8Array)(t);this.bytes=i,this.view=new DataView(i.buffer,i.byteOffset,i.byteLength),this.pos=0}appendBuffer(t){if(this.headByte===De&&!this.hasRemaining(1))this.setBuffer(t);else{let i=this.bytes.subarray(this.pos),r=(0,rn.ensureUint8Array)(t),n=new Uint8Array(i.length+r.length);n.set(i),n.set(r,i.length),this.setBuffer(n)}}hasRemaining(t){return this.view.byteLength-this.pos>=t}createExtraByteError(t){let{view:i,pos:r}=this;return new RangeError(`Extra ${i.byteLength-r} of ${i.byteLength} byte(s) found at buffer[${t}]`)}decode(t){if(this.entered)return this.clone().decode(t);try{this.entered=!0,this.reinitializeState(),this.setBuffer(t);let i=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return i}finally{this.entered=!1}}*decodeMulti(t){if(this.entered){yield*this.clone().decodeMulti(t);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(t);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(t){if(this.entered)return this.clone().decodeAsync(t);try{this.entered=!0;let i=!1,r;for await(let s of t){if(i)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(s);try{r=this.doDecodeSync(),i=!0}catch(l){if(!(l instanceof RangeError))throw l}this.totalPos+=this.pos}if(i){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return r}let{headByte:n,pos:o,totalPos:a}=this;throw new RangeError(`Insufficient data in parsing ${(0,di.prettyByte)(n)} at ${a} (${o} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(t){return this.decodeMultiAsync(t,!0)}decodeStream(t){return this.decodeMultiAsync(t,!1)}async*decodeMultiAsync(t,i){if(this.entered){yield*this.clone().decodeMultiAsync(t,i);return}try{this.entered=!0;let r=i,n=-1;for await(let o of t){if(i&&n===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(o),r&&(n=this.readArraySize(),r=!1,this.complete());try{for(;yield this.doDecodeSync(),--n!==0;);}catch(a){if(!(a instanceof RangeError))throw a}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){let t=this.readHeadByte(),i;if(t>=224)i=t-256;else if(t<192)if(t<128)i=t;else if(t<144){let n=t-128;if(n!==0){this.pushMapState(n),this.complete();continue e}else i={}}else if(t<160){let n=t-144;if(n!==0){this.pushArrayState(n),this.complete();continue e}else i=[]}else{let n=t-160;i=this.decodeString(n,0)}else if(t===192)i=null;else if(t===194)i=!1;else if(t===195)i=!0;else if(t===202)i=this.readF32();else if(t===203)i=this.readF64();else if(t===204)i=this.readU8();else if(t===205)i=this.readU16();else if(t===206)i=this.readU32();else if(t===207)this.useBigInt64?i=this.readU64AsBigInt():i=this.readU64();else if(t===208)i=this.readI8();else if(t===209)i=this.readI16();else if(t===210)i=this.readI32();else if(t===211)this.useBigInt64?i=this.readI64AsBigInt():i=this.readI64();else if(t===217){let n=this.lookU8();i=this.decodeString(n,1)}else if(t===218){let n=this.lookU16();i=this.decodeString(n,2)}else if(t===219){let n=this.lookU32();i=this.decodeString(n,4)}else if(t===220){let n=this.readU16();if(n!==0){this.pushArrayState(n),this.complete();continue e}else i=[]}else if(t===221){let n=this.readU32();if(n!==0){this.pushArrayState(n),this.complete();continue e}else i=[]}else if(t===222){let n=this.readU16();if(n!==0){this.pushMapState(n),this.complete();continue e}else i={}}else if(t===223){let n=this.readU32();if(n!==0){this.pushMapState(n),this.complete();continue e}else i={}}else if(t===196){let n=this.lookU8();i=this.decodeBinary(n,1)}else if(t===197){let n=this.lookU16();i=this.decodeBinary(n,2)}else if(t===198){let n=this.lookU32();i=this.decodeBinary(n,4)}else if(t===212)i=this.decodeExtension(1,0);else if(t===213)i=this.decodeExtension(2,0);else if(t===214)i=this.decodeExtension(4,0);else if(t===215)i=this.decodeExtension(8,0);else if(t===216)i=this.decodeExtension(16,0);else if(t===199){let n=this.lookU8();i=this.decodeExtension(n,1)}else if(t===200){let n=this.lookU16();i=this.decodeExtension(n,2)}else if(t===201){let n=this.lookU32();i=this.decodeExtension(n,4)}else throw new F.DecodeError(`Unrecognized type byte: ${(0,di.prettyByte)(t)}`);this.complete();let r=this.stack;for(;r.length>0;){let n=r.top();if(n.type===pi)if(n.array[n.position]=i,n.position++,n.position===n.size)i=n.array,r.release(n);else continue e;else if(n.type===Ue){if(i==="__proto__")throw new F.DecodeError("The key __proto__ is not allowed");n.key=this.mapKeyConverter(i),n.type=on;continue e}else if(n.map[n.key]=i,n.readCount++,n.readCount===n.size)i=n.map,r.release(n);else{n.key=null,n.type=Ue;continue e}}return i}}readHeadByte(){return this.headByte===De&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=De}readArraySize(){let t=this.readHeadByte();switch(t){case 220:return this.readU16();case 221:return this.readU32();default:{if(t<160)return t-144;throw new F.DecodeError(`Unrecognized array type byte: ${(0,di.prettyByte)(t)}`)}}}pushMapState(t){if(t>this.maxMapLength)throw new F.DecodeError(`Max length exceeded: map length (${t}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(t)}pushArrayState(t){if(t>this.maxArrayLength)throw new F.DecodeError(`Max length exceeded: array length (${t}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(t)}decodeString(t,i){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(t,i):this.decodeBinary(t,i)}decodeUtf8String(t,i){if(t>this.maxStrLength)throw new F.DecodeError(`Max length exceeded: UTF-8 byte length (${t}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+i+t)throw nn;let r=this.pos+i,n;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(t)?n=this.keyDecoder.decode(this.bytes,r,t):n=(0,wp.utf8Decode)(this.bytes,r,t),this.pos+=i+t,n}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===Ue:!1}decodeBinary(t,i){if(t>this.maxBinLength)throw new F.DecodeError(`Max length exceeded: bin length (${t}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(t+i))throw nn;let r=this.pos+i,n=this.bytes.subarray(r,r+t);return this.pos+=i+t,n}decodeExtension(t,i){if(t>this.maxExtLength)throw new F.DecodeError(`Max length exceeded: ext length (${t}) > maxExtLength (${this.maxExtLength})`);let r=this.view.getInt8(this.pos+i),n=this.decodeBinary(t,i+1);return this.extensionCodec.decode(n,r,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){let t=this.view.getUint8(this.pos);return this.pos++,t}readI8(){let t=this.view.getInt8(this.pos);return this.pos++,t}readU16(){let t=this.view.getUint16(this.pos);return this.pos+=2,t}readI16(){let t=this.view.getInt16(this.pos);return this.pos+=2,t}readU32(){let t=this.view.getUint32(this.pos);return this.pos+=4,t}readI32(){let t=this.view.getInt32(this.pos);return this.pos+=4,t}readU64(){let t=(0,J.getUint64)(this.view,this.pos);return this.pos+=8,t}readI64(){let t=(0,J.getInt64)(this.view,this.pos);return this.pos+=8,t}readU64AsBigInt(){let t=this.view.getBigUint64(this.pos);return this.pos+=8,t}readI64AsBigInt(){let t=this.view.getBigInt64(this.pos);return this.pos+=8,t}readF32(){let t=this.view.getFloat32(this.pos);return this.pos+=4,t}readF64(){let t=this.view.getFloat64(this.pos);return this.pos+=8,t}};ft.Decoder=hi});var sn=x(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.decode=kp;yt.decodeMulti=Cp;var an=mt();function kp(e,t){return new an.Decoder(t).decode(e)}function Cp(e,t){return new an.Decoder(t).decodeMulti(e)}});var un=x(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.isAsyncIterable=ln;Ne.asyncIterableFromStream=cn;Ne.ensureAsyncIterable=Ap;function ln(e){return e[Symbol.asyncIterator]!=null}async function*cn(e){let t=e.getReader();try{for(;;){let{done:i,value:r}=await t.read();if(i)return;yield r}}finally{t.releaseLock()}}function Ap(e){return ln(e)?e:cn(e)}});var dn=x(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.decodeAsync=Mp;Be.decodeArrayStream=Tp;Be.decodeMultiStream=Op;var mi=mt(),yi=un();async function Mp(e,t){let i=(0,yi.ensureAsyncIterable)(e);return new mi.Decoder(t).decodeAsync(i)}function Tp(e,t){let i=(0,yi.ensureAsyncIterable)(e);return new mi.Decoder(t).decodeArrayStream(i)}function Op(e,t){let i=(0,yi.ensureAsyncIterable)(e);return new mi.Decoder(t).decodeStream(i)}});var gn=x(v=>{"use strict";Object.defineProperty(v,"__esModule",{value:!0});v.decodeTimestampExtension=v.encodeTimestampExtension=v.decodeTimestampToTimeSpec=v.encodeTimeSpecToTimestamp=v.encodeDateToTimeSpec=v.EXT_TIMESTAMP=v.ExtData=v.ExtensionCodec=v.Encoder=v.DecodeError=v.Decoder=v.decodeMultiStream=v.decodeArrayStream=v.decodeAsync=v.decodeMulti=v.decode=v.encode=void 0;var jp=Jr();Object.defineProperty(v,"encode",{enumerable:!0,get:function(){return jp.encode}});var pn=sn();Object.defineProperty(v,"decode",{enumerable:!0,get:function(){return pn.decode}});Object.defineProperty(v,"decodeMulti",{enumerable:!0,get:function(){return pn.decodeMulti}});var bi=dn();Object.defineProperty(v,"decodeAsync",{enumerable:!0,get:function(){return bi.decodeAsync}});Object.defineProperty(v,"decodeArrayStream",{enumerable:!0,get:function(){return bi.decodeArrayStream}});Object.defineProperty(v,"decodeMultiStream",{enumerable:!0,get:function(){return bi.decodeMultiStream}});var Pp=mt();Object.defineProperty(v,"Decoder",{enumerable:!0,get:function(){return Pp.Decoder}});var $p=ct();Object.defineProperty(v,"DecodeError",{enumerable:!0,get:function(){return $p.DecodeError}});var Dp=si();Object.defineProperty(v,"Encoder",{enumerable:!0,get:function(){return Dp.Encoder}});var Up=gt();Object.defineProperty(v,"ExtensionCodec",{enumerable:!0,get:function(){return Up.ExtensionCodec}});var Np=ti();Object.defineProperty(v,"ExtData",{enumerable:!0,get:function(){return Np.ExtData}});var ye=ri();Object.defineProperty(v,"EXT_TIMESTAMP",{enumerable:!0,get:function(){return ye.EXT_TIMESTAMP}});Object.defineProperty(v,"encodeDateToTimeSpec",{enumerable:!0,get:function(){return ye.encodeDateToTimeSpec}});Object.defineProperty(v,"encodeTimeSpecToTimestamp",{enumerable:!0,get:function(){return ye.encodeTimeSpecToTimestamp}});Object.defineProperty(v,"decodeTimestampToTimeSpec",{enumerable:!0,get:function(){return ye.decodeTimestampToTimeSpec}});Object.defineProperty(v,"encodeTimestampExtension",{enumerable:!0,get:function(){return ye.encodeTimestampExtension}});Object.defineProperty(v,"decodeTimestampExtension",{enumerable:!0,get:function(){return ye.decodeTimestampExtension}})});var An=x(T=>{"use strict";Object.defineProperty(T,"__esModule",{value:!0});function C(e){return{enumerable:!0,value:e}}function hn(e){return{enumerable:!0,writable:!0,value:e}}var ee={},Bp=()=>!0,fn=()=>({}),yn=e=>e,Fp=(e,t,i,r)=>e.apply(i,r)&&t.apply(i,r),Lp=(e,t,i,[r,n])=>t.call(i,e.call(i,r,n),n),Q=(e,t)=>Object.freeze(Object.create(e,t));function mn(e,t,i){return e.reduce((r,n)=>function(...o){return i(r,n,this,o)},t)}function bn(e){return Q(this,{fn:C(e)})}var _n={},vn=bn.bind(_n),zp=e=>vn((t,i)=>!!~e(t,i)&&t),wn={},qp=bn.bind(wn);function bt(e,t){return t.filter(i=>e.isPrototypeOf(i))}function xn(e,t,...i){let r=mn(bt(wn,i).map(o=>o.fn),Bp,Fp),n=mn(bt(_n,i).map(o=>o.fn),yn,Lp);return Q(this,{from:C(e),to:C(t),guards:C(r),reducers:C(n)})}var En={},In={},Vp=xn.bind(En),Rp=xn.bind(In,null);function Hp(e,t,i){return vi(t,e,i,this.immediates)||e}function Sn(e){let t=new Map;for(let i of e)t.has(i.from)||t.set(i.from,[]),t.get(i.from).push(i);return t}var Gp={enter:yn};function Qp(...e){let t=bt(En,e),i=bt(In,e),r={final:C(e.length===0),transitions:C(Sn(t))};return i.length&&(r.immediates=C(i),r.enter=C(Hp)),Q(Gp,r)}var Kp={enter(e,t,i){let r=this.fn.call(t,t.context,i);return _i.isPrototypeOf(r)?Q(kn,{machine:C(r),transitions:C(this.transitions)}).enter(e,t,i):(r.then(n=>t.send({type:"done",data:n})).catch(n=>t.send({type:"error",error:n})),e)}},kn={enter(e,t,i){if(t.child=Cn(this.machine,r=>{t.onChange(r),t.child==r&&r.machine.state.value.final&&(delete t.child,t.send({type:"done",data:r.context}))},t.context,i),t.child.machine.state.value.final){let r=t.child.context;return delete t.child,vi(t,e,{type:"done",data:r},this.transitions.get("done"))}return e}};function Wp(e,...t){let i=C(Sn(t));return _i.isPrototypeOf(e)?Q(kn,{machine:C(e),transitions:i}):Q(Kp,{fn:C(e),transitions:i})}var _i={get state(){return{name:this.current,value:this.states[this.current]}}};function Yp(e,t,i=fn){return typeof e!="string"&&(i=t||fn,t=e,e=Object.keys(t)[0]),ee._create&&ee._create(e,t),Q(_i,{context:C(i),current:C(e),states:C(t)})}function vi(e,t,i,r){let{context:n}=e;for(let{to:o,guards:a,reducers:s}of r)if(a(n,i)){e.context=s.call(e,n,i);let l=t.original||t,c=Q(l,{current:C(o),original:{value:l}});return ee._onEnter&&ee._onEnter(t,o,e.context,n,i),c.state.value.enter(c,e,i)}}function Zp(e,t){let i=t.type||t,{machine:r}=e,{value:n,name:o}=r.state;return n.transitions.has(i)?vi(e,r,t,n.transitions.get(i))||r:(ee._send&&ee._send(i,o),r)}var Xp={send(e){this.machine=Zp(this,e),this.onChange(this)}};function Cn(e,t,i,r){let n=Object.create(Xp,{machine:hn(e),context:hn(e.context(i,r)),onChange:C(t)});return n.send=n.send.bind(n),n.machine=n.machine.state.value.enter(n.machine,n,r),n}T.action=zp;T.createMachine=Yp;T.d=ee;T.guard=qp;T.immediate=Rp;T.interpret=Cn;T.invoke=Wp;T.reduce=vn;T.state=Qp;T.transition=Vp});var Pn=x(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.createRealtimeClient=gg;var vt=gn(),y=An(),Mn=Zt(),wi=Y(),Tn=it(),Ii=Z(),Jp=()=>({enqueuedMessage:void 0});function eg(e){return e.token!==void 0}function tg(e){return!eg(e)}function _t(e,t){return Object.assign(Object.assign({},e),{enqueuedMessage:t.message})}function L(e){return e.websocket&&e.websocket.readyState===WebSocket.OPEN&&e.websocket.close(),Object.assign(Object.assign({},e),{websocket:void 0})}function ig(e,t){return e.websocket&&e.websocket.readyState===WebSocket.OPEN?(t.message instanceof Uint8Array?e.websocket.send(t.message):e.websocket.send((0,vt.encode)(t.message)),Object.assign(Object.assign({},e),{enqueuedMessage:void 0})):Object.assign(Object.assign({},e),{enqueuedMessage:t.message})}function xi(e){return Object.assign(Object.assign({},e),{token:void 0})}function rg(e,t){return Object.assign(Object.assign({},e),{token:t.token})}function ng(e,t){return Object.assign(Object.assign({},e),{websocket:t.websocket})}var og=(0,y.createMachine)("idle",{idle:(0,y.state)((0,y.transition)("send","connecting",(0,y.reduce)(_t)),(0,y.transition)("expireToken","idle",(0,y.reduce)(xi)),(0,y.transition)("close","idle",(0,y.reduce)(L))),connecting:(0,y.state)((0,y.transition)("connecting","connecting"),(0,y.transition)("connected","active",(0,y.reduce)(ng)),(0,y.transition)("connectionClosed","idle",(0,y.reduce)(L)),(0,y.transition)("send","connecting",(0,y.reduce)(_t)),(0,y.transition)("close","idle",(0,y.reduce)(L)),(0,y.immediate)("authRequired",(0,y.guard)(tg))),authRequired:(0,y.state)((0,y.transition)("initiateAuth","authInProgress"),(0,y.transition)("send","authRequired",(0,y.reduce)(_t)),(0,y.transition)("close","idle",(0,y.reduce)(L))),authInProgress:(0,y.state)((0,y.transition)("authenticated","connecting",(0,y.reduce)(rg)),(0,y.transition)("unauthorized","idle",(0,y.reduce)(xi),(0,y.reduce)(L)),(0,y.transition)("send","authInProgress",(0,y.reduce)(_t)),(0,y.transition)("close","idle",(0,y.reduce)(L))),active:(0,y.state)((0,y.transition)("send","active",(0,y.reduce)(ig)),(0,y.transition)("unauthorized","idle",(0,y.reduce)(xi)),(0,y.transition)("connectionClosed","idle",(0,y.reduce)(L)),(0,y.transition)("close","idle",(0,y.reduce)(L))),failed:(0,y.state)((0,y.transition)("send","failed"),(0,y.transition)("close","idle",(0,y.reduce)(L)))},Jp);function ag(e,{token:t,maxBuffering:i}){if(i!==void 0&&(i<1||i>60))throw new Error("The `maxBuffering` must be between 1 and 60 (inclusive)");let r=new URLSearchParams({fal_jwt_token:t});return i!==void 0&&r.set("max_buffering",i.toFixed(0)),`wss://fal.run/${(0,Ii.ensureEndpointIdFormat)(e)}/realtime?${r.toString()}`}var sg=128;function lg(e){return e.status==="error"&&e.error==="Unauthorized"}var cg={NORMAL_CLOSURE:1e3,GOING_AWAY:1001},Ei=new Map,On=new Map;function ug(e,t,i){if(!Ei.has(e)){let r=(0,y.interpret)(og,i);Ei.set(e,Object.assign(Object.assign({},r),{throttledSend:t>0?(0,Ii.throttle)(r.send,t,!0):r.send}))}return Ei.get(e)}var Fe=()=>{},dg={send:Fe,close:Fe};function pg(e){return e.status!=="error"&&e.type!=="x-fal-message"&&!jn(e)}function jn(e){return e.type==="x-fal-error"}function gg({config:e}){return{connect(t,i){let{clientOnly:r=(0,Ii.isReact)()&&!(0,Tn.isBrowser)(),connectionKey:n=crypto.randomUUID(),maxBuffering:o,throttleInterval:a=sg}=i;if(r&&!(0,Tn.isBrowser)())return dg;let s;On.set(n,{onError:i.onError,onResult:i.onResult});let l=()=>On.get(n),c=ug(n,a,({context:h,machine:p,send:f})=>{let{enqueuedMessage:b,token:_}=h;if(p.current==="active"&&b&&f({type:"send",message:b}),p.current==="authRequired"&&_===void 0&&s!==p.current&&(f({type:"initiateAuth"}),(0,Mn.getTemporaryAuthToken)(t,e).then(g=>{f({type:"authenticated",token:g});let m=Math.round(Mn.TOKEN_EXPIRATION_SECONDS*.9*1e3);setTimeout(()=>{f({type:"expireToken"})},m)}).catch(g=>{f({type:"unauthorized",error:g})})),p.current==="connecting"&&s!==p.current&&_!==void 0){let g=new WebSocket(ag(t,{token:_,maxBuffering:o}));g.onopen=()=>{f({type:"connected",websocket:g})},g.onclose=m=>{if(m.code!==cg.NORMAL_CLOSURE){let{onError:E=Fe}=l();E(new wi.ApiError({message:`Error closing the connection: ${m.reason}`,status:m.code}))}f({type:"connectionClosed",code:m.code})},g.onerror=m=>{let{onError:E=Fe}=l();E(new wi.ApiError({message:"Unknown error",status:500}))},g.onmessage=m=>{let{onResult:E}=l();if(m.data instanceof ArrayBuffer){let A=(0,vt.decode)(new Uint8Array(m.data));E(A);return}if(m.data instanceof Uint8Array){let A=(0,vt.decode)(m.data);E(A);return}if(m.data instanceof Blob){m.data.arrayBuffer().then(A=>{let Ti=(0,vt.decode)(new Uint8Array(A));E(Ti)});return}let w=JSON.parse(m.data);if(lg(w)){f({type:"unauthorized",error:new Error("Unauthorized")});return}if(pg(w)){E(w);return}if(jn(w)){if(w.error==="TIMEOUT")return;let{onError:A=Fe}=l();A(new wi.ApiError({message:`${w.error}: ${w.reason}`,status:400,body:w}));return}}}s=p.current});return{send:h=>{c.throttledSend({type:"send",message:h})},close:()=>{c.send({type:"close"})}}}}}});var Bn=x(Le=>{"use strict";var te=Le&&Le.__awaiter||function(e,t,i,r){function n(o){return o instanceof i?o:new i(function(a){a(o)})}return new(i||(i=Promise))(function(o,a){function s(u){try{c(r.next(u))}catch(d){a(d)}}function l(u){try{c(r.throw(u))}catch(d){a(d)}}function c(u){u.done?o(u.value):n(u.value).then(s,l)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(Le,"__esModule",{value:!0});Le.createStorageClient=bg;var $n=rt(),Dn=fe(),hg=Z();function Un(e){var t;let[i,r]=e.split("/");return(t=r.split(/[-;]/)[0])!==null&&t!==void 0?t:"bin"}function fg(e,t,i){return te(this,void 0,void 0,function*(){let r=e.name||`${Date.now()}.${Un(i)}`;return yield(0,Dn.dispatchRequest)({method:"POST",targetUrl:`${(0,$n.getRestApiUrl)()}/storage/upload/initiate?storage_type=fal-cdn-v3`,input:{content_type:i,file_name:r},config:t})})}function mg(e,t,i){return te(this,void 0,void 0,function*(){let r=e.name||`${Date.now()}.${Un(i)}`;return yield(0,Dn.dispatchRequest)({method:"POST",targetUrl:`${(0,$n.getRestApiUrl)()}/storage/upload/initiate-multipart?storage_type=fal-cdn-v3`,input:{content_type:i,file_name:r},config:t})})}function Nn(e,t,i){return te(this,arguments,void 0,function*(r,n,o,a=3){if(a===0)throw new Error("Part upload failed, retries exhausted");let{fetch:s,responseHandler:l}=o;try{let c=yield s(r,{method:"PUT",body:n});return yield l(c)}catch{return yield Nn(r,n,o,a-1)}})}function yg(e,t){return te(this,void 0,void 0,function*(){let{fetch:i,responseHandler:r}=t,n=e.type||"application/octet-stream",{upload_url:o,file_url:a}=yield mg(e,t,n),s=10*1024*1024,l=Math.ceil(e.size/s),c=new URL(o),u=[];for(let p=0;p<l;p++){let f=p*s,b=Math.min(f+s,e.size),_=e.slice(f,b),g=p+1,m=`${c.origin}${c.pathname}/${g}${c.search}`;u.push(yield Nn(m,_,t))}let d=`${c.origin}${c.pathname}/complete${c.search}`,h=yield i(d,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parts:u.map(p=>({partNumber:p.partNumber,etag:p.etag}))})});return yield r(h),a})}function bg({config:e}){let t={upload:i=>te(this,void 0,void 0,function*(){if(i.size>94371840)return yield yg(i,e);let r=i.type||"application/octet-stream",{fetch:n,responseHandler:o}=e,{upload_url:a,file_url:s}=yield fg(i,e,r),l=yield n(a,{method:"PUT",body:i,headers:{"Content-Type":i.type||"application/octet-stream"}});return yield o(l),s}),transformInput:i=>te(this,void 0,void 0,function*(){if(Array.isArray(i))return Promise.all(i.map(r=>t.transformInput(r)));if(i instanceof Blob)return yield t.upload(i);if((0,hg.isPlainObject)(i)){let n=Object.entries(i).map(a=>te(this,[a],void 0,function*([s,l]){return[s,yield t.transformInput(l)]})),o=yield Promise.all(n);return Object.fromEntries(o)}return i})};return t}});var ki=x(ze=>{"use strict";var Fn=ze&&ze.__awaiter||function(e,t,i,r){function n(o){return o instanceof i?o:new i(function(a){a(o)})}return new(i||(i=Promise))(function(o,a){function s(u){try{c(r.next(u))}catch(d){a(d)}}function l(u){try{c(r.throw(u))}catch(d){a(d)}}function c(u){u.done?o(u.value):n(u.value).then(s,l)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(ze,"__esModule",{value:!0});ze.createFalClient=Sg;var _g=rt(),vg=Lr(),wg=Pn(),Ln=fe(),xg=Y(),Eg=Bn(),Ig=Jt();function Sg(e={}){let t=(0,_g.createConfig)(e),i=(0,Eg.createStorageClient)({config:t}),r=(0,vg.createQueueClient)({config:t,storage:i}),n=(0,Ig.createStreamingClient)({config:t,storage:i}),o=(0,wg.createRealtimeClient)({config:t});return{queue:r,realtime:o,storage:i,streaming:n,stream:n.stream,run(a){return Fn(this,arguments,void 0,function*(s,l={}){let c=l.input?yield i.transformInput(l.input):void 0;return(0,Ln.dispatchRequest)({method:l.method,targetUrl:(0,Ln.buildUrl)(s,l),input:c,config:Object.assign(Object.assign({},t),{responseHandler:xg.resultResponseHandler}),options:{signal:l.abortSignal}})})},subscribe:(a,s)=>Fn(this,void 0,void 0,function*(){let{request_id:l}=yield r.submit(a,s);return s.onEnqueue&&s.onEnqueue(l),yield r.subscribeToStatus(a,Object.assign({requestId:l},s)),r.result(a,{requestId:l})})}}});var qn=x(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.isQueueStatus=zn;wt.isCompletedQueueStatus=kg;function zn(e){return e&&e.status&&e.response_url}function kg(e){return zn(e)&&e.status==="COMPLETED"}});var Ci=x(k=>{"use strict";var Cg=k&&k.__createBinding||(Object.create?function(e,t,i,r){r===void 0&&(r=i);var n=Object.getOwnPropertyDescriptor(t,i);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,r,n)}:function(e,t,i,r){r===void 0&&(r=i),e[r]=t[i]}),Ag=k&&k.__exportStar||function(e,t){for(var i in e)i!=="default"&&!Object.prototype.hasOwnProperty.call(t,i)&&Cg(t,e,i)};Object.defineProperty(k,"__esModule",{value:!0});k.fal=k.parseEndpointId=k.ValidationError=k.ApiError=k.withProxy=k.withMiddleware=k.createFalClient=void 0;var Vn=ki(),Mg=ki();Object.defineProperty(k,"createFalClient",{enumerable:!0,get:function(){return Mg.createFalClient}});var Rn=Kt();Object.defineProperty(k,"withMiddleware",{enumerable:!0,get:function(){return Rn.withMiddleware}});Object.defineProperty(k,"withProxy",{enumerable:!0,get:function(){return Rn.withProxy}});var Hn=Y();Object.defineProperty(k,"ApiError",{enumerable:!0,get:function(){return Hn.ApiError}});Object.defineProperty(k,"ValidationError",{enumerable:!0,get:function(){return Hn.ValidationError}});Ag(qn(),k);var Tg=Z();Object.defineProperty(k,"parseEndpointId",{enumerable:!0,get:function(){return Tg.parseEndpointId}});k.fal=function(){let t=(0,Vn.createFalClient)();return{config(i){t=(0,Vn.createFalClient)(i)},get queue(){return t.queue},get realtime(){return t.realtime},get storage(){return t.storage},get streaming(){return t.streaming},run(i,r){return t.run(i,r)},subscribe(i,r){return t.subscribe(i,r)},stream(i,r){return t.stream(i,r)}}}()});var ro=`
|
|
6
6
|
<svg>
|
|
7
7
|
<symbol
|
|
8
8
|
fill="none"
|
|
@@ -68,7 +68,7 @@ var Kn=Object.create;var Ai=Object.defineProperty;var Wn=Object.getOwnPropertyDe
|
|
|
68
68
|
<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"/>
|
|
69
69
|
</symbol>
|
|
70
70
|
</svg>
|
|
71
|
-
`,Ot=class{constructor(e,t=[]){this.id=e,this.assets=t.map(i=>{if(typeof i.label=="string"&&!(i.label&&typeof i.label=="object")){let r=i;return{id:r.id,label:{en:r.label},meta:r.thumbUri?{thumbUri:r.thumbUri}:void 0}}return i}),this.activeAssetIds=new Set}async findAssets(e){let{page:t,perPage:i,locale:r="en",sortActiveFirst:n,query:o,tags:a,groups:s,excludeGroups:l,sortingOrder:c,sortKey:u}=e,d=[...this.assets];if(s&&s.length>0&&(d=d.filter(g=>g.groups&&s.some(m=>g.groups?.includes(m)))),l&&l.length>0&&(d=d.filter(g=>!g.groups||!l.some(m=>g.groups?.includes(m)))),o){let g=o.toLowerCase();d=d.filter(m=>{let E=m.label?.[r]?.toLowerCase(),w=m.tags?.[r]||[];return E&&E.includes(g)||w.some(A=>A.toLowerCase().includes(g))})}if(a&&a.length>0){let g=Array.isArray(a)?a:[a];d=d.filter(m=>{let E=m.tags?.[r]||[];return g.some(w=>E.includes(w))})}n&&d.sort((g,m)=>{let E=this.activeAssetIds.has(g.id),w=this.activeAssetIds.has(m.id);return E&&!w?-1:!E&&w?1:0}),u&&u!=="id"?d.sort((g,m)=>{let E=g.meta?.[u],w=m.meta?.[u];return E===void 0?1:w===void 0?-1:typeof E=="string"&&typeof w=="string"?c==="Descending"?w.localeCompare(E):E.localeCompare(w):typeof E=="number"&&typeof w=="number"?c==="Descending"?w-E:E-w:0}):u==="id"&&d.sort((g,m)=>c==="Descending"?m.id.localeCompare(g.id):g.id.localeCompare(m.id));let h=d.length,p=t*i,f=p+i,b=d.slice(p,f).map(g=>({id:g.id,groups:g.groups,meta:g.meta,payload:g.payload,locale:r,label:g.label?.[r],tags:g.tags?.[r],active:this.activeAssetIds.has(g.id)})),_=f<h?t+1:void 0;return{assets:b,currentPage:t,nextPage:_,total:h}}updateLabel(e,t,i){this.assets.forEach(r=>{r.id===e&&(r.label=r.label||{},r.label[i]=t)})}setAssetActive(e){this.activeAssetIds.add(e)}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(i=>i.id===e.id);t>=0?this.assets[t]=e:this.assets.push(e)}removeAsset(e){let t=this.assets.findIndex(i=>i.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(i=>e.add(i))}),Array.from(e)}getSupportedMimeTypes(){return["image/jpeg","image/png","image/svg+xml","image/webp","video/mp4","audio/mpeg"]}};var to=typeof global=="object"&&global&&global.Object===Object&&global,Ri=to,io=typeof self=="object"&&self&&self.Object===Object&&self,ro=Ri||io||Function("return this")(),D=ro,no=D.Symbol,re=no,Hi=Object.prototype,oo=Hi.hasOwnProperty,ao=Hi.toString,be=re?re.toStringTag:void 0;function so(e){var t=oo.call(e,be),i=e[be];try{e[be]=void 0;var r=!0}catch{}var n=ao.call(e);return r&&(t?e[be]=i:delete e[be]),n}var lo=so,co=Object.prototype,uo=co.toString;function po(e){return uo.call(e)}var go=po,ho="[object Null]",fo="[object Undefined]",Ti=re?re.toStringTag:void 0;function mo(e){return e==null?e===void 0?fo:ho:Ti&&Ti in Object(e)?lo(e):go(e)}var xe=mo;function yo(e){return e!=null&&typeof e=="object"}var jt=yo,Lg=Array.isArray;function bo(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Gi=bo,_o="[object AsyncFunction]",vo="[object Function]",wo="[object GeneratorFunction]",xo="[object Proxy]";function Eo(e){if(!Gi(e))return!1;var t=xe(e);return t==vo||t==wo||t==_o||t==xo}var Io=Eo,So=D["__core-js_shared__"],It=So,Oi=function(){var e=/[^.]+$/.exec(It&&It.keys&&It.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function ko(e){return!!Oi&&Oi in e}var Co=ko,Ao=Function.prototype,Mo=Ao.toString;function To(e){if(e!=null){try{return Mo.call(e)}catch{}try{return e+""}catch{}}return""}var K=To,Oo=/[\\^$.*+?()[\]{}|]/g,jo=/^\[object .+?Constructor\]$/,Po=Function.prototype,$o=Object.prototype,Do=Po.toString,No=$o.hasOwnProperty,Uo=RegExp("^"+Do.call(No).replace(Oo,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Bo(e){if(!Gi(e)||Co(e))return!1;var t=Io(e)?Uo:jo;return t.test(K(e))}var Fo=Bo;function Lo(e,t){return e?.[t]}var zo=Lo;function qo(e,t){var i=zo(e,t);return Fo(i)?i:void 0}var ne=qo,Vo=ne(D,"WeakMap"),kt=Vo;function Ro(e,t){return e===t||e!==e&&t!==t}var Ho=Ro,Go=9007199254740991;function Qo(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Go}var Ko=Qo;var zg=Object.prototype;var Wo="[object Arguments]";function Yo(e){return jt(e)&&xe(e)==Wo}var ji=Yo,Qi=Object.prototype,Zo=Qi.hasOwnProperty,Xo=Qi.propertyIsEnumerable,qg=ji(function(){return arguments}())?ji:function(e){return jt(e)&&Zo.call(e,"callee")&&!Xo.call(e,"callee")};var Ki=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Pi=Ki&&typeof module=="object"&&module&&!module.nodeType&&module,Jo=Pi&&Pi.exports===Ki,$i=Jo?D.Buffer:void 0,Vg=$i?$i.isBuffer:void 0;var ea="[object Arguments]",ta="[object Array]",ia="[object Boolean]",ra="[object Date]",na="[object Error]",oa="[object Function]",aa="[object Map]",sa="[object Number]",la="[object Object]",ca="[object RegExp]",ua="[object Set]",da="[object String]",pa="[object WeakMap]",ga="[object ArrayBuffer]",ha="[object DataView]",fa="[object Float32Array]",ma="[object Float64Array]",ya="[object Int8Array]",ba="[object Int16Array]",_a="[object Int32Array]",va="[object Uint8Array]",wa="[object Uint8ClampedArray]",xa="[object Uint16Array]",Ea="[object Uint32Array]",I={};I[fa]=I[ma]=I[ya]=I[ba]=I[_a]=I[va]=I[wa]=I[xa]=I[Ea]=!0;I[ea]=I[ta]=I[ga]=I[ia]=I[ha]=I[ra]=I[na]=I[oa]=I[aa]=I[sa]=I[la]=I[ca]=I[ua]=I[da]=I[pa]=!1;function Ia(e){return jt(e)&&Ko(e.length)&&!!I[xe(e)]}var Sa=Ia;function ka(e){return function(t){return e(t)}}var Ca=ka,Wi=typeof exports=="object"&&exports&&!exports.nodeType&&exports,_e=Wi&&typeof module=="object"&&module&&!module.nodeType&&module,Aa=_e&&_e.exports===Wi,St=Aa&&Ri.process,Ma=function(){try{var e=_e&&_e.require&&_e.require("util").types;return e||St&&St.binding&&St.binding("util")}catch{}}(),Di=Ma,Ni=Di&&Di.isTypedArray,Rg=Ni?Ca(Ni):Sa;var Ta=Object.prototype,Hg=Ta.hasOwnProperty;function Oa(e,t){return function(i){return e(t(i))}}var ja=Oa,Gg=ja(Object.keys,Object);var Pa=Object.prototype,Qg=Pa.hasOwnProperty;var $a=ne(Object,"create"),ve=$a;function Da(){this.__data__=ve?ve(null):{},this.size=0}var Na=Da;function Ua(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Ba=Ua,Fa="__lodash_hash_undefined__",La=Object.prototype,za=La.hasOwnProperty;function qa(e){var t=this.__data__;if(ve){var i=t[e];return i===Fa?void 0:i}return za.call(t,e)?t[e]:void 0}var Va=qa,Ra=Object.prototype,Ha=Ra.hasOwnProperty;function Ga(e){var t=this.__data__;return ve?t[e]!==void 0:Ha.call(t,e)}var Qa=Ga,Ka="__lodash_hash_undefined__";function Wa(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=ve&&t===void 0?Ka:t,this}var Ya=Wa;function oe(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}oe.prototype.clear=Na;oe.prototype.delete=Ba;oe.prototype.get=Va;oe.prototype.has=Qa;oe.prototype.set=Ya;var Ui=oe;function Za(){this.__data__=[],this.size=0}var Xa=Za;function Ja(e,t){for(var i=e.length;i--;)if(Ho(e[i][0],t))return i;return-1}var Ge=Ja,es=Array.prototype,ts=es.splice;function is(e){var t=this.__data__,i=Ge(t,e);if(i<0)return!1;var r=t.length-1;return i==r?t.pop():ts.call(t,i,1),--this.size,!0}var rs=is;function ns(e){var t=this.__data__,i=Ge(t,e);return i<0?void 0:t[i][1]}var os=ns;function as(e){return Ge(this.__data__,e)>-1}var ss=as;function ls(e,t){var i=this.__data__,r=Ge(i,e);return r<0?(++this.size,i.push([e,t])):i[r][1]=t,this}var cs=ls;function ae(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}ae.prototype.clear=Xa;ae.prototype.delete=rs;ae.prototype.get=os;ae.prototype.has=ss;ae.prototype.set=cs;var Qe=ae,us=ne(D,"Map"),we=us;function ds(){this.size=0,this.__data__={hash:new Ui,map:new(we||Qe),string:new Ui}}var ps=ds;function gs(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var hs=gs;function fs(e,t){var i=e.__data__;return hs(t)?i[typeof t=="string"?"string":"hash"]:i.map}var Ke=fs;function ms(e){var t=Ke(this,e).delete(e);return this.size-=t?1:0,t}var ys=ms;function bs(e){return Ke(this,e).get(e)}var _s=bs;function vs(e){return Ke(this,e).has(e)}var ws=vs;function xs(e,t){var i=Ke(this,e),r=i.size;return i.set(e,t),this.size+=i.size==r?0:1,this}var Es=xs;function se(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}se.prototype.clear=ps;se.prototype.delete=ys;se.prototype.get=_s;se.prototype.has=ws;se.prototype.set=Es;var Yi=se;function Is(){this.__data__=new Qe,this.size=0}var Ss=Is;function ks(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i}var Cs=ks;function As(e){return this.__data__.get(e)}var Ms=As;function Ts(e){return this.__data__.has(e)}var Os=Ts,js=200;function Ps(e,t){var i=this.__data__;if(i instanceof Qe){var r=i.__data__;if(!we||r.length<js-1)return r.push([e,t]),this.size=++i.size,this;i=this.__data__=new Yi(r)}return i.set(e,t),this.size=i.size,this}var $s=Ps;function Ee(e){var t=this.__data__=new Qe(e);this.size=t.size}Ee.prototype.clear=Ss;Ee.prototype.delete=Cs;Ee.prototype.get=Ms;Ee.prototype.has=Os;Ee.prototype.set=$s;var Ds=Object.prototype,Kg=Ds.propertyIsEnumerable;var Ns=ne(D,"DataView"),Ct=Ns,Us=ne(D,"Promise"),At=Us,Bs=ne(D,"Set"),Mt=Bs,Bi="[object Map]",Fs="[object Object]",Fi="[object Promise]",Li="[object Set]",zi="[object WeakMap]",qi="[object DataView]",Ls=K(Ct),zs=K(we),qs=K(At),Vs=K(Mt),Rs=K(kt),ie=xe;(Ct&&ie(new Ct(new ArrayBuffer(1)))!=qi||we&&ie(new we)!=Bi||At&&ie(At.resolve())!=Fi||Mt&&ie(new Mt)!=Li||kt&&ie(new kt)!=zi)&&(ie=function(e){var t=xe(e),i=t==Fs?e.constructor:void 0,r=i?K(i):"";if(r)switch(r){case Ls:return qi;case zs:return Bi;case qs:return Fi;case Vs:return Li;case Rs:return zi}return t});var Wg=D.Uint8Array;var Hs="__lodash_hash_undefined__";function Gs(e){return this.__data__.set(e,Hs),this}var Qs=Gs;function Ks(e){return this.__data__.has(e)}var Ws=Ks;function Tt(e){var t=-1,i=e==null?0:e.length;for(this.__data__=new Yi;++t<i;)this.add(e[t])}Tt.prototype.add=Tt.prototype.push=Qs;Tt.prototype.has=Ws;var Vi=re?re.prototype:void 0,Yg=Vi?Vi.valueOf:void 0;var Ys=Object.prototype,Zg=Ys.hasOwnProperty;var Zs=Object.prototype,Xg=Zs.hasOwnProperty;var Jg=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),eh=new RegExp(/[A-Fa-f0-9]{1}/,"g"),th=new RegExp(/[A-Fa-f0-9]{2}/,"g");async function Zi(e){return new Promise((t,i)=>{let r=new Image;r.onload=()=>{t({width:r.width,height:r.height})},r.onerror=i,r.src=e})}var Xi={Formats:eo};function Xs(e,t){let{cesdk:i}=t,r=t.propertyKey??"image_url";return Js(e,i),{[r]:(n,o)=>{let{builder:a,experimental:{global:s},payload:l}=n,c=l?.url??t.defaultUrl,u=s(`${e}.${o.id}`,c);return a.MediaPreview(o.id,{preview:{type:"image",uri:u.value},action:{label:"Select Image",onClick:()=>{i?.ui.openPanel(`${e}.imageSelection`,{payload:{onSelect:d=>{d.meta?.uri!=null&&u.setValue(d.meta?.uri)}}})}}}),()=>({id:o.id,type:"string",value:u.value})}}}function Js(e,t){t?.ui.registerPanel(`${e}.imageSelection`,({builder:i,payload:r})=>{i.Library(`${e}.library.image`,{entries:["ly.img.image"],onSelect:async n=>{let o=n?.meta?.uri;if(o==null)return;let a=await t.engine.editor.getMimeType(o);a==="image/svg+xml"?t.ui.showNotification({type:"warning",message:"SVG images are not supported. Please choose a different image."}):a.startsWith("image/")?(r?.onSelect(n),t?.ui.closePanel(`${e}.imageSelection`)):t.ui.showNotification({type:"warning",message:`Only images are supported. Found '${a}'. Please choose a different image.`})}})})}var el=Xs;var tl="ly.img.ai";function Me(e){return`${tl}/${e}`}function il(){return async(e,t,i)=>{console.group("[GENERATION]"),console.log("Generating with input:",JSON.stringify(e,null,2));let r,n=Date.now();try{return r=await i(e,t),r}finally{r!=null&&(console.log(`Generation took ${Date.now()-n}ms`),console.log("Generation result:",JSON.stringify(r,null,2))),console.groupEnd()}}}var hr=il;var rl=typeof global=="object"&&global&&global.Object===Object&&global,fr=rl,nl=typeof self=="object"&&self&&self.Object===Object&&self,ol=fr||nl||Function("return this")(),N=ol,al=N.Symbol,ce=al,mr=Object.prototype,sl=mr.hasOwnProperty,ll=mr.toString,Ie=ce?ce.toStringTag:void 0;function cl(e){var t=sl.call(e,Ie),i=e[Ie];try{e[Ie]=void 0;var r=!0}catch{}var n=ll.call(e);return r&&(t?e[Ie]=i:delete e[Ie]),n}var ul=cl,dl=Object.prototype,pl=dl.toString;function gl(e){return pl.call(e)}var hl=gl,fl="[object Null]",ml="[object Undefined]",Ji=ce?ce.toStringTag:void 0;function yl(e){return e==null?e===void 0?ml:fl:Ji&&Ji in Object(e)?ul(e):hl(e)}var Te=yl;function bl(e){return e!=null&&typeof e=="object"}var zt=bl,nh=Array.isArray;function _l(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var yr=_l,vl="[object AsyncFunction]",wl="[object Function]",xl="[object GeneratorFunction]",El="[object Proxy]";function Il(e){if(!yr(e))return!1;var t=Te(e);return t==wl||t==xl||t==vl||t==El}var Sl=Il,kl=N["__core-js_shared__"],Pt=kl,er=function(){var e=/[^.]+$/.exec(Pt&&Pt.keys&&Pt.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Cl(e){return!!er&&er in e}var Al=Cl,Ml=Function.prototype,Tl=Ml.toString;function Ol(e){if(e!=null){try{return Tl.call(e)}catch{}try{return e+""}catch{}}return""}var W=Ol,jl=/[\\^$.*+?()[\]{}|]/g,Pl=/^\[object .+?Constructor\]$/,$l=Function.prototype,Dl=Object.prototype,Nl=$l.toString,Ul=Dl.hasOwnProperty,Bl=RegExp("^"+Nl.call(Ul).replace(jl,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Fl(e){if(!yr(e)||Al(e))return!1;var t=Sl(e)?Bl:Pl;return t.test(W(e))}var Ll=Fl;function zl(e,t){return e?.[t]}var ql=zl;function Vl(e,t){var i=ql(e,t);return Ll(i)?i:void 0}var ue=Vl,Rl=ue(N,"WeakMap"),Nt=Rl;function Hl(e,t){return e===t||e!==e&&t!==t}var Gl=Hl,Ql=9007199254740991;function Kl(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Ql}var Wl=Kl,oh=Object.prototype,Yl="[object Arguments]";function Zl(e){return zt(e)&&Te(e)==Yl}var tr=Zl,br=Object.prototype,Xl=br.hasOwnProperty,Jl=br.propertyIsEnumerable,ah=tr(function(){return arguments}())?tr:function(e){return zt(e)&&Xl.call(e,"callee")&&!Jl.call(e,"callee")},_r=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ir=_r&&typeof module=="object"&&module&&!module.nodeType&&module,ec=ir&&ir.exports===_r,rr=ec?N.Buffer:void 0,sh=rr?rr.isBuffer:void 0,tc="[object Arguments]",ic="[object Array]",rc="[object Boolean]",nc="[object Date]",oc="[object Error]",ac="[object Function]",sc="[object Map]",lc="[object Number]",cc="[object Object]",uc="[object RegExp]",dc="[object Set]",pc="[object String]",gc="[object WeakMap]",hc="[object ArrayBuffer]",fc="[object DataView]",mc="[object Float32Array]",yc="[object Float64Array]",bc="[object Int8Array]",_c="[object Int16Array]",vc="[object Int32Array]",wc="[object Uint8Array]",xc="[object Uint8ClampedArray]",Ec="[object Uint16Array]",Ic="[object Uint32Array]",S={};S[mc]=S[yc]=S[bc]=S[_c]=S[vc]=S[wc]=S[xc]=S[Ec]=S[Ic]=!0;S[tc]=S[ic]=S[hc]=S[rc]=S[fc]=S[nc]=S[oc]=S[ac]=S[sc]=S[lc]=S[cc]=S[uc]=S[dc]=S[pc]=S[gc]=!1;function Sc(e){return zt(e)&&Wl(e.length)&&!!S[Te(e)]}var kc=Sc;function Cc(e){return function(t){return e(t)}}var Ac=Cc,vr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ke=vr&&typeof module=="object"&&module&&!module.nodeType&&module,Mc=ke&&ke.exports===vr,$t=Mc&&fr.process,Tc=function(){try{var e=ke&&ke.require&&ke.require("util").types;return e||$t&&$t.binding&&$t.binding("util")}catch{}}(),nr=Tc,or=nr&&nr.isTypedArray,lh=or?Ac(or):kc,Oc=Object.prototype,ch=Oc.hasOwnProperty;function jc(e,t){return function(i){return e(t(i))}}var Pc=jc,uh=Pc(Object.keys,Object),$c=Object.prototype,dh=$c.hasOwnProperty,Dc=ue(Object,"create"),Ce=Dc;function Nc(){this.__data__=Ce?Ce(null):{},this.size=0}var Uc=Nc;function Bc(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Fc=Bc,Lc="__lodash_hash_undefined__",zc=Object.prototype,qc=zc.hasOwnProperty;function Vc(e){var t=this.__data__;if(Ce){var i=t[e];return i===Lc?void 0:i}return qc.call(t,e)?t[e]:void 0}var Rc=Vc,Hc=Object.prototype,Gc=Hc.hasOwnProperty;function Qc(e){var t=this.__data__;return Ce?t[e]!==void 0:Gc.call(t,e)}var Kc=Qc,Wc="__lodash_hash_undefined__";function Yc(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=Ce&&t===void 0?Wc:t,this}var Zc=Yc;function de(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}de.prototype.clear=Uc;de.prototype.delete=Fc;de.prototype.get=Rc;de.prototype.has=Kc;de.prototype.set=Zc;var ar=de;function Xc(){this.__data__=[],this.size=0}var Jc=Xc;function eu(e,t){for(var i=e.length;i--;)if(Gl(e[i][0],t))return i;return-1}var We=eu,tu=Array.prototype,iu=tu.splice;function ru(e){var t=this.__data__,i=We(t,e);if(i<0)return!1;var r=t.length-1;return i==r?t.pop():iu.call(t,i,1),--this.size,!0}var nu=ru;function ou(e){var t=this.__data__,i=We(t,e);return i<0?void 0:t[i][1]}var au=ou;function su(e){return We(this.__data__,e)>-1}var lu=su;function cu(e,t){var i=this.__data__,r=We(i,e);return r<0?(++this.size,i.push([e,t])):i[r][1]=t,this}var uu=cu;function pe(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}pe.prototype.clear=Jc;pe.prototype.delete=nu;pe.prototype.get=au;pe.prototype.has=lu;pe.prototype.set=uu;var Ye=pe,du=ue(N,"Map"),Ae=du;function pu(){this.size=0,this.__data__={hash:new ar,map:new(Ae||Ye),string:new ar}}var gu=pu;function hu(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var fu=hu;function mu(e,t){var i=e.__data__;return fu(t)?i[typeof t=="string"?"string":"hash"]:i.map}var Ze=mu;function yu(e){var t=Ze(this,e).delete(e);return this.size-=t?1:0,t}var bu=yu;function _u(e){return Ze(this,e).get(e)}var vu=_u;function wu(e){return Ze(this,e).has(e)}var xu=wu;function Eu(e,t){var i=Ze(this,e),r=i.size;return i.set(e,t),this.size+=i.size==r?0:1,this}var Iu=Eu;function ge(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}ge.prototype.clear=gu;ge.prototype.delete=bu;ge.prototype.get=vu;ge.prototype.has=xu;ge.prototype.set=Iu;var wr=ge;function Su(){this.__data__=new Ye,this.size=0}var ku=Su;function Cu(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i}var Au=Cu;function Mu(e){return this.__data__.get(e)}var Tu=Mu;function Ou(e){return this.__data__.has(e)}var ju=Ou,Pu=200;function $u(e,t){var i=this.__data__;if(i instanceof Ye){var r=i.__data__;if(!Ae||r.length<Pu-1)return r.push([e,t]),this.size=++i.size,this;i=this.__data__=new wr(r)}return i.set(e,t),this.size=i.size,this}var Du=$u;function Oe(e){var t=this.__data__=new Ye(e);this.size=t.size}Oe.prototype.clear=ku;Oe.prototype.delete=Au;Oe.prototype.get=Tu;Oe.prototype.has=ju;Oe.prototype.set=Du;var Nu=Object.prototype,ph=Nu.propertyIsEnumerable,Uu=ue(N,"DataView"),Ut=Uu,Bu=ue(N,"Promise"),Bt=Bu,Fu=ue(N,"Set"),Ft=Fu,sr="[object Map]",Lu="[object Object]",lr="[object Promise]",cr="[object Set]",ur="[object WeakMap]",dr="[object DataView]",zu=W(Ut),qu=W(Ae),Vu=W(Bt),Ru=W(Ft),Hu=W(Nt),le=Te;(Ut&&le(new Ut(new ArrayBuffer(1)))!=dr||Ae&&le(new Ae)!=sr||Bt&&le(Bt.resolve())!=lr||Ft&&le(new Ft)!=cr||Nt&&le(new Nt)!=ur)&&(le=function(e){var t=Te(e),i=t==Lu?e.constructor:void 0,r=i?W(i):"";if(r)switch(r){case zu:return dr;case qu:return sr;case Vu:return lr;case Ru:return cr;case Hu:return ur}return t});var gh=N.Uint8Array,Gu="__lodash_hash_undefined__";function Qu(e){return this.__data__.set(e,Gu),this}var Ku=Qu;function Wu(e){return this.__data__.has(e)}var Yu=Wu;function Lt(e){var t=-1,i=e==null?0:e.length;for(this.__data__=new wr;++t<i;)this.add(e[t])}Lt.prototype.add=Lt.prototype.push=Ku;Lt.prototype.has=Yu;var pr=ce?ce.prototype:void 0,hh=pr?pr.valueOf:void 0,Zu=Object.prototype,fh=Zu.hasOwnProperty,Xu=Object.prototype,mh=Xu.hasOwnProperty,yh=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),bh=new RegExp(/[A-Fa-f0-9]{1}/,"g"),_h=new RegExp(/[A-Fa-f0-9]{2}/,"g"),Dt="@imgly/plugin-ai-generation",vh=`
|
|
71
|
+
`,Ot=class{constructor(e,t=[]){this.id=e,this.assets=t.map(i=>{if(typeof i.label=="string"&&!(i.label&&typeof i.label=="object")){let r=i;return{id:r.id,label:{en:r.label},meta:r.thumbUri?{thumbUri:r.thumbUri}:void 0}}return i}),this.activeAssetIds=new Set}async findAssets(e){let{page:t,perPage:i,locale:r="en",sortActiveFirst:n,query:o,tags:a,groups:s,excludeGroups:l,sortingOrder:c,sortKey:u}=e,d=[...this.assets];if(s&&s.length>0&&(d=d.filter(g=>g.groups&&s.some(m=>g.groups?.includes(m)))),l&&l.length>0&&(d=d.filter(g=>!g.groups||!l.some(m=>g.groups?.includes(m)))),o){let g=o.toLowerCase();d=d.filter(m=>{let E=m.label?.[r]?.toLowerCase(),w=m.tags?.[r]||[];return E&&E.includes(g)||w.some(A=>A.toLowerCase().includes(g))})}if(a&&a.length>0){let g=Array.isArray(a)?a:[a];d=d.filter(m=>{let E=m.tags?.[r]||[];return g.some(w=>E.includes(w))})}n&&d.sort((g,m)=>{let E=this.activeAssetIds.has(g.id),w=this.activeAssetIds.has(m.id);return E&&!w?-1:!E&&w?1:0}),u&&u!=="id"?d.sort((g,m)=>{let E=g.meta?.[u],w=m.meta?.[u];return E===void 0?1:w===void 0?-1:typeof E=="string"&&typeof w=="string"?c==="Descending"?w.localeCompare(E):E.localeCompare(w):typeof E=="number"&&typeof w=="number"?c==="Descending"?w-E:E-w:0}):u==="id"&&d.sort((g,m)=>c==="Descending"?m.id.localeCompare(g.id):g.id.localeCompare(m.id));let h=d.length,p=t*i,f=p+i,b=d.slice(p,f).map(g=>({id:g.id,groups:g.groups,meta:g.meta,payload:g.payload,locale:r,label:g.label?.[r],tags:g.tags?.[r],active:this.activeAssetIds.has(g.id)})),_=f<h?t+1:void 0;return{assets:b,currentPage:t,nextPage:_,total:h}}updateLabel(e,t,i){this.assets.forEach(r=>{r.id===e&&(r.label=r.label||{},r.label[i]=t)})}setAssetActive(e){this.activeAssetIds.add(e)}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(i=>i.id===e.id);t>=0?this.assets[t]=e:this.assets.push(e)}removeAsset(e){let t=this.assets.findIndex(i=>i.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(i=>e.add(i))}),Array.from(e)}getSupportedMimeTypes(){return["image/jpeg","image/png","image/svg+xml","image/webp","video/mp4","audio/mpeg"]}};var no=typeof global=="object"&&global&&global.Object===Object&&global,Qi=no,oo=typeof self=="object"&&self&&self.Object===Object&&self,ao=Qi||oo||Function("return this")(),D=ao,so=D.Symbol,re=so,Ki=Object.prototype,lo=Ki.hasOwnProperty,co=Ki.toString,be=re?re.toStringTag:void 0;function uo(e){var t=lo.call(e,be),i=e[be];try{e[be]=void 0;var r=!0}catch{}var n=co.call(e);return r&&(t?e[be]=i:delete e[be]),n}var po=uo,go=Object.prototype,ho=go.toString;function fo(e){return ho.call(e)}var mo=fo,yo="[object Null]",bo="[object Undefined]",Pi=re?re.toStringTag:void 0;function _o(e){return e==null?e===void 0?bo:yo:Pi&&Pi in Object(e)?po(e):mo(e)}var xe=_o;function vo(e){return e!=null&&typeof e=="object"}var jt=vo,Vg=Array.isArray;function wo(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Wi=wo,xo="[object AsyncFunction]",Eo="[object Function]",Io="[object GeneratorFunction]",So="[object Proxy]";function ko(e){if(!Wi(e))return!1;var t=xe(e);return t==Eo||t==Io||t==xo||t==So}var Co=ko,Ao=D["__core-js_shared__"],It=Ao,$i=function(){var e=/[^.]+$/.exec(It&&It.keys&&It.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Mo(e){return!!$i&&$i in e}var To=Mo,Oo=Function.prototype,jo=Oo.toString;function Po(e){if(e!=null){try{return jo.call(e)}catch{}try{return e+""}catch{}}return""}var K=Po,$o=/[\\^$.*+?()[\]{}|]/g,Do=/^\[object .+?Constructor\]$/,Uo=Function.prototype,No=Object.prototype,Bo=Uo.toString,Fo=No.hasOwnProperty,Lo=RegExp("^"+Bo.call(Fo).replace($o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function zo(e){if(!Wi(e)||To(e))return!1;var t=Co(e)?Lo:Do;return t.test(K(e))}var qo=zo;function Vo(e,t){return e?.[t]}var Ro=Vo;function Ho(e,t){var i=Ro(e,t);return qo(i)?i:void 0}var ne=Ho,Go=ne(D,"WeakMap"),kt=Go;function Qo(e,t){return e===t||e!==e&&t!==t}var Ko=Qo,Wo=9007199254740991;function Yo(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Wo}var Zo=Yo;var Rg=Object.prototype;var Xo="[object Arguments]";function Jo(e){return jt(e)&&xe(e)==Xo}var Di=Jo,Yi=Object.prototype,ea=Yi.hasOwnProperty,ta=Yi.propertyIsEnumerable,Hg=Di(function(){return arguments}())?Di:function(e){return jt(e)&&ea.call(e,"callee")&&!ta.call(e,"callee")};var Zi=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ui=Zi&&typeof module=="object"&&module&&!module.nodeType&&module,ia=Ui&&Ui.exports===Zi,Ni=ia?D.Buffer:void 0,Gg=Ni?Ni.isBuffer:void 0;var ra="[object Arguments]",na="[object Array]",oa="[object Boolean]",aa="[object Date]",sa="[object Error]",la="[object Function]",ca="[object Map]",ua="[object Number]",da="[object Object]",pa="[object RegExp]",ga="[object Set]",ha="[object String]",fa="[object WeakMap]",ma="[object ArrayBuffer]",ya="[object DataView]",ba="[object Float32Array]",_a="[object Float64Array]",va="[object Int8Array]",wa="[object Int16Array]",xa="[object Int32Array]",Ea="[object Uint8Array]",Ia="[object Uint8ClampedArray]",Sa="[object Uint16Array]",ka="[object Uint32Array]",I={};I[ba]=I[_a]=I[va]=I[wa]=I[xa]=I[Ea]=I[Ia]=I[Sa]=I[ka]=!0;I[ra]=I[na]=I[ma]=I[oa]=I[ya]=I[aa]=I[sa]=I[la]=I[ca]=I[ua]=I[da]=I[pa]=I[ga]=I[ha]=I[fa]=!1;function Ca(e){return jt(e)&&Zo(e.length)&&!!I[xe(e)]}var Aa=Ca;function Ma(e){return function(t){return e(t)}}var Ta=Ma,Xi=typeof exports=="object"&&exports&&!exports.nodeType&&exports,_e=Xi&&typeof module=="object"&&module&&!module.nodeType&&module,Oa=_e&&_e.exports===Xi,St=Oa&&Qi.process,ja=function(){try{var e=_e&&_e.require&&_e.require("util").types;return e||St&&St.binding&&St.binding("util")}catch{}}(),Bi=ja,Fi=Bi&&Bi.isTypedArray,Qg=Fi?Ta(Fi):Aa;var Pa=Object.prototype,Kg=Pa.hasOwnProperty;function $a(e,t){return function(i){return e(t(i))}}var Da=$a,Wg=Da(Object.keys,Object);var Ua=Object.prototype,Yg=Ua.hasOwnProperty;var Na=ne(Object,"create"),ve=Na;function Ba(){this.__data__=ve?ve(null):{},this.size=0}var Fa=Ba;function La(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var za=La,qa="__lodash_hash_undefined__",Va=Object.prototype,Ra=Va.hasOwnProperty;function Ha(e){var t=this.__data__;if(ve){var i=t[e];return i===qa?void 0:i}return Ra.call(t,e)?t[e]:void 0}var Ga=Ha,Qa=Object.prototype,Ka=Qa.hasOwnProperty;function Wa(e){var t=this.__data__;return ve?t[e]!==void 0:Ka.call(t,e)}var Ya=Wa,Za="__lodash_hash_undefined__";function Xa(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=ve&&t===void 0?Za:t,this}var Ja=Xa;function oe(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}oe.prototype.clear=Fa;oe.prototype.delete=za;oe.prototype.get=Ga;oe.prototype.has=Ya;oe.prototype.set=Ja;var Li=oe;function es(){this.__data__=[],this.size=0}var ts=es;function is(e,t){for(var i=e.length;i--;)if(Ko(e[i][0],t))return i;return-1}var Ge=is,rs=Array.prototype,ns=rs.splice;function os(e){var t=this.__data__,i=Ge(t,e);if(i<0)return!1;var r=t.length-1;return i==r?t.pop():ns.call(t,i,1),--this.size,!0}var as=os;function ss(e){var t=this.__data__,i=Ge(t,e);return i<0?void 0:t[i][1]}var ls=ss;function cs(e){return Ge(this.__data__,e)>-1}var us=cs;function ds(e,t){var i=this.__data__,r=Ge(i,e);return r<0?(++this.size,i.push([e,t])):i[r][1]=t,this}var ps=ds;function ae(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}ae.prototype.clear=ts;ae.prototype.delete=as;ae.prototype.get=ls;ae.prototype.has=us;ae.prototype.set=ps;var Qe=ae,gs=ne(D,"Map"),we=gs;function hs(){this.size=0,this.__data__={hash:new Li,map:new(we||Qe),string:new Li}}var fs=hs;function ms(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var ys=ms;function bs(e,t){var i=e.__data__;return ys(t)?i[typeof t=="string"?"string":"hash"]:i.map}var Ke=bs;function _s(e){var t=Ke(this,e).delete(e);return this.size-=t?1:0,t}var vs=_s;function ws(e){return Ke(this,e).get(e)}var xs=ws;function Es(e){return Ke(this,e).has(e)}var Is=Es;function Ss(e,t){var i=Ke(this,e),r=i.size;return i.set(e,t),this.size+=i.size==r?0:1,this}var ks=Ss;function se(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}se.prototype.clear=fs;se.prototype.delete=vs;se.prototype.get=xs;se.prototype.has=Is;se.prototype.set=ks;var Ji=se;function Cs(){this.__data__=new Qe,this.size=0}var As=Cs;function Ms(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i}var Ts=Ms;function Os(e){return this.__data__.get(e)}var js=Os;function Ps(e){return this.__data__.has(e)}var $s=Ps,Ds=200;function Us(e,t){var i=this.__data__;if(i instanceof Qe){var r=i.__data__;if(!we||r.length<Ds-1)return r.push([e,t]),this.size=++i.size,this;i=this.__data__=new Ji(r)}return i.set(e,t),this.size=i.size,this}var Ns=Us;function Ee(e){var t=this.__data__=new Qe(e);this.size=t.size}Ee.prototype.clear=As;Ee.prototype.delete=Ts;Ee.prototype.get=js;Ee.prototype.has=$s;Ee.prototype.set=Ns;var Bs=Object.prototype,Zg=Bs.propertyIsEnumerable;var Fs=ne(D,"DataView"),Ct=Fs,Ls=ne(D,"Promise"),At=Ls,zs=ne(D,"Set"),Mt=zs,zi="[object Map]",qs="[object Object]",qi="[object Promise]",Vi="[object Set]",Ri="[object WeakMap]",Hi="[object DataView]",Vs=K(Ct),Rs=K(we),Hs=K(At),Gs=K(Mt),Qs=K(kt),ie=xe;(Ct&&ie(new Ct(new ArrayBuffer(1)))!=Hi||we&&ie(new we)!=zi||At&&ie(At.resolve())!=qi||Mt&&ie(new Mt)!=Vi||kt&&ie(new kt)!=Ri)&&(ie=function(e){var t=xe(e),i=t==qs?e.constructor:void 0,r=i?K(i):"";if(r)switch(r){case Vs:return Hi;case Rs:return zi;case Hs:return qi;case Gs:return Vi;case Qs:return Ri}return t});var Xg=D.Uint8Array;var Ks="__lodash_hash_undefined__";function Ws(e){return this.__data__.set(e,Ks),this}var Ys=Ws;function Zs(e){return this.__data__.has(e)}var Xs=Zs;function Tt(e){var t=-1,i=e==null?0:e.length;for(this.__data__=new Ji;++t<i;)this.add(e[t])}Tt.prototype.add=Tt.prototype.push=Ys;Tt.prototype.has=Xs;var Gi=re?re.prototype:void 0,Jg=Gi?Gi.valueOf:void 0;var Js=Object.prototype,eh=Js.hasOwnProperty;var el=Object.prototype,th=el.hasOwnProperty;var ih=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),rh=new RegExp(/[A-Fa-f0-9]{1}/,"g"),nh=new RegExp(/[A-Fa-f0-9]{2}/,"g");function Pt(e){return{"image/png":"png","image/jpeg":"jpg","image/webp":"webp","image/gif":"gif","image/svg+xml":"svg"}[e]??"png"}async function $t(e,t){if(e.startsWith("buffer:")){let i=await t.engine.editor.getMimeType(e),r=t.engine.editor.getBufferLength(e),n=t.engine.editor.getBufferData(e,0,r),o=new Blob([n],{type:i});return URL.createObjectURL(o)}else return e}async function er(e,t){let i=await $t(e,t);return new Promise((r,n)=>{let o=new Image;o.onload=()=>{r({width:o.width,height:o.height})},o.onerror=n,o.src=i})}var tr={Formats:ro};function tl(e,t){let{cesdk:i}=t,r=t.propertyKey??"image_url";return il(e,i),{[r]:(n,o)=>{let{builder:a,experimental:{global:s},payload:l}=n,c=l?.url??t.defaultUrl,u=s(`${e}.${o.id}`,c);return a.MediaPreview(o.id,{preview:{type:"image",uri:u.value},action:{label:"Select Image",onClick:()=>{if(i==null)return;let d=Bt(e);i.ui.openPanel(d,{payload:{onSelect:h=>{h.meta?.uri!=null&&u.setValue(h.meta?.uri)}}})}}}),()=>({id:o.id,type:"string",value:u.value})}}}function il(e,t){t?.ui.registerPanel(Bt(e),({builder:i,payload:r})=>{i.Library(`${e}.library.image`,{entries:["ly.img.image"],onSelect:async n=>{let o=n?.meta?.uri;if(o==null)return;let a=await t.engine.editor.getMimeType(o);a==="image/svg+xml"?t.ui.showNotification({type:"warning",message:"SVG images are not supported. Please choose a different image."}):a.startsWith("image/")?(r?.onSelect(n),t?.ui.closePanel(Bt(e))):t.ui.showNotification({type:"warning",message:`Only images are supported. Found '${a}'. Please choose a different image.`})}})})}function Bt(e){return`ly.img.ai/${e}.imageSelection`}var rl=tl;var nl="ly.img.ai";function Me(e){return`${nl}/${e}`}function ol(){return async(e,t,i)=>{console.group("[GENERATION]"),console.log("Generating with input:",JSON.stringify(e,null,2));let r,n=Date.now();try{return r=await i(e,t),r}finally{r!=null&&(console.log(`Generation took ${Date.now()-n}ms`),console.log("Generation result:",JSON.stringify(r,null,2))),console.groupEnd()}}}var yr=ol;var al=typeof global=="object"&&global&&global.Object===Object&&global,br=al,sl=typeof self=="object"&&self&&self.Object===Object&&self,ll=br||sl||Function("return this")(),U=ll,cl=U.Symbol,ce=cl,_r=Object.prototype,ul=_r.hasOwnProperty,dl=_r.toString,Ie=ce?ce.toStringTag:void 0;function pl(e){var t=ul.call(e,Ie),i=e[Ie];try{e[Ie]=void 0;var r=!0}catch{}var n=dl.call(e);return r&&(t?e[Ie]=i:delete e[Ie]),n}var gl=pl,hl=Object.prototype,fl=hl.toString;function ml(e){return fl.call(e)}var yl=ml,bl="[object Null]",_l="[object Undefined]",ir=ce?ce.toStringTag:void 0;function vl(e){return e==null?e===void 0?_l:bl:ir&&ir in Object(e)?gl(e):yl(e)}var Te=vl;function wl(e){return e!=null&&typeof e=="object"}var Rt=wl,sh=Array.isArray;function xl(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var vr=xl,El="[object AsyncFunction]",Il="[object Function]",Sl="[object GeneratorFunction]",kl="[object Proxy]";function Cl(e){if(!vr(e))return!1;var t=Te(e);return t==Il||t==Sl||t==El||t==kl}var Al=Cl,Ml=U["__core-js_shared__"],Dt=Ml,rr=function(){var e=/[^.]+$/.exec(Dt&&Dt.keys&&Dt.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Tl(e){return!!rr&&rr in e}var Ol=Tl,jl=Function.prototype,Pl=jl.toString;function $l(e){if(e!=null){try{return Pl.call(e)}catch{}try{return e+""}catch{}}return""}var W=$l,Dl=/[\\^$.*+?()[\]{}|]/g,Ul=/^\[object .+?Constructor\]$/,Nl=Function.prototype,Bl=Object.prototype,Fl=Nl.toString,Ll=Bl.hasOwnProperty,zl=RegExp("^"+Fl.call(Ll).replace(Dl,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ql(e){if(!vr(e)||Ol(e))return!1;var t=Al(e)?zl:Ul;return t.test(W(e))}var Vl=ql;function Rl(e,t){return e?.[t]}var Hl=Rl;function Gl(e,t){var i=Hl(e,t);return Vl(i)?i:void 0}var ue=Gl,Ql=ue(U,"WeakMap"),Ft=Ql;function Kl(e,t){return e===t||e!==e&&t!==t}var Wl=Kl,Yl=9007199254740991;function Zl(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Yl}var Xl=Zl,lh=Object.prototype,Jl="[object Arguments]";function ec(e){return Rt(e)&&Te(e)==Jl}var nr=ec,wr=Object.prototype,tc=wr.hasOwnProperty,ic=wr.propertyIsEnumerable,ch=nr(function(){return arguments}())?nr:function(e){return Rt(e)&&tc.call(e,"callee")&&!ic.call(e,"callee")},xr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,or=xr&&typeof module=="object"&&module&&!module.nodeType&&module,rc=or&&or.exports===xr,ar=rc?U.Buffer:void 0,uh=ar?ar.isBuffer:void 0,nc="[object Arguments]",oc="[object Array]",ac="[object Boolean]",sc="[object Date]",lc="[object Error]",cc="[object Function]",uc="[object Map]",dc="[object Number]",pc="[object Object]",gc="[object RegExp]",hc="[object Set]",fc="[object String]",mc="[object WeakMap]",yc="[object ArrayBuffer]",bc="[object DataView]",_c="[object Float32Array]",vc="[object Float64Array]",wc="[object Int8Array]",xc="[object Int16Array]",Ec="[object Int32Array]",Ic="[object Uint8Array]",Sc="[object Uint8ClampedArray]",kc="[object Uint16Array]",Cc="[object Uint32Array]",S={};S[_c]=S[vc]=S[wc]=S[xc]=S[Ec]=S[Ic]=S[Sc]=S[kc]=S[Cc]=!0;S[nc]=S[oc]=S[yc]=S[ac]=S[bc]=S[sc]=S[lc]=S[cc]=S[uc]=S[dc]=S[pc]=S[gc]=S[hc]=S[fc]=S[mc]=!1;function Ac(e){return Rt(e)&&Xl(e.length)&&!!S[Te(e)]}var Mc=Ac;function Tc(e){return function(t){return e(t)}}var Oc=Tc,Er=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ke=Er&&typeof module=="object"&&module&&!module.nodeType&&module,jc=ke&&ke.exports===Er,Ut=jc&&br.process,Pc=function(){try{var e=ke&&ke.require&&ke.require("util").types;return e||Ut&&Ut.binding&&Ut.binding("util")}catch{}}(),sr=Pc,lr=sr&&sr.isTypedArray,dh=lr?Oc(lr):Mc,$c=Object.prototype,ph=$c.hasOwnProperty;function Dc(e,t){return function(i){return e(t(i))}}var Uc=Dc,gh=Uc(Object.keys,Object),Nc=Object.prototype,hh=Nc.hasOwnProperty,Bc=ue(Object,"create"),Ce=Bc;function Fc(){this.__data__=Ce?Ce(null):{},this.size=0}var Lc=Fc;function zc(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var qc=zc,Vc="__lodash_hash_undefined__",Rc=Object.prototype,Hc=Rc.hasOwnProperty;function Gc(e){var t=this.__data__;if(Ce){var i=t[e];return i===Vc?void 0:i}return Hc.call(t,e)?t[e]:void 0}var Qc=Gc,Kc=Object.prototype,Wc=Kc.hasOwnProperty;function Yc(e){var t=this.__data__;return Ce?t[e]!==void 0:Wc.call(t,e)}var Zc=Yc,Xc="__lodash_hash_undefined__";function Jc(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=Ce&&t===void 0?Xc:t,this}var eu=Jc;function de(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}de.prototype.clear=Lc;de.prototype.delete=qc;de.prototype.get=Qc;de.prototype.has=Zc;de.prototype.set=eu;var cr=de;function tu(){this.__data__=[],this.size=0}var iu=tu;function ru(e,t){for(var i=e.length;i--;)if(Wl(e[i][0],t))return i;return-1}var We=ru,nu=Array.prototype,ou=nu.splice;function au(e){var t=this.__data__,i=We(t,e);if(i<0)return!1;var r=t.length-1;return i==r?t.pop():ou.call(t,i,1),--this.size,!0}var su=au;function lu(e){var t=this.__data__,i=We(t,e);return i<0?void 0:t[i][1]}var cu=lu;function uu(e){return We(this.__data__,e)>-1}var du=uu;function pu(e,t){var i=this.__data__,r=We(i,e);return r<0?(++this.size,i.push([e,t])):i[r][1]=t,this}var gu=pu;function pe(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}pe.prototype.clear=iu;pe.prototype.delete=su;pe.prototype.get=cu;pe.prototype.has=du;pe.prototype.set=gu;var Ye=pe,hu=ue(U,"Map"),Ae=hu;function fu(){this.size=0,this.__data__={hash:new cr,map:new(Ae||Ye),string:new cr}}var mu=fu;function yu(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var bu=yu;function _u(e,t){var i=e.__data__;return bu(t)?i[typeof t=="string"?"string":"hash"]:i.map}var Ze=_u;function vu(e){var t=Ze(this,e).delete(e);return this.size-=t?1:0,t}var wu=vu;function xu(e){return Ze(this,e).get(e)}var Eu=xu;function Iu(e){return Ze(this,e).has(e)}var Su=Iu;function ku(e,t){var i=Ze(this,e),r=i.size;return i.set(e,t),this.size+=i.size==r?0:1,this}var Cu=ku;function ge(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}ge.prototype.clear=mu;ge.prototype.delete=wu;ge.prototype.get=Eu;ge.prototype.has=Su;ge.prototype.set=Cu;var Ir=ge;function Au(){this.__data__=new Ye,this.size=0}var Mu=Au;function Tu(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i}var Ou=Tu;function ju(e){return this.__data__.get(e)}var Pu=ju;function $u(e){return this.__data__.has(e)}var Du=$u,Uu=200;function Nu(e,t){var i=this.__data__;if(i instanceof Ye){var r=i.__data__;if(!Ae||r.length<Uu-1)return r.push([e,t]),this.size=++i.size,this;i=this.__data__=new Ir(r)}return i.set(e,t),this.size=i.size,this}var Bu=Nu;function Oe(e){var t=this.__data__=new Ye(e);this.size=t.size}Oe.prototype.clear=Mu;Oe.prototype.delete=Ou;Oe.prototype.get=Pu;Oe.prototype.has=Du;Oe.prototype.set=Bu;var Fu=Object.prototype,fh=Fu.propertyIsEnumerable,Lu=ue(U,"DataView"),Lt=Lu,zu=ue(U,"Promise"),zt=zu,qu=ue(U,"Set"),qt=qu,ur="[object Map]",Vu="[object Object]",dr="[object Promise]",pr="[object Set]",gr="[object WeakMap]",hr="[object DataView]",Ru=W(Lt),Hu=W(Ae),Gu=W(zt),Qu=W(qt),Ku=W(Ft),le=Te;(Lt&&le(new Lt(new ArrayBuffer(1)))!=hr||Ae&&le(new Ae)!=ur||zt&&le(zt.resolve())!=dr||qt&&le(new qt)!=pr||Ft&&le(new Ft)!=gr)&&(le=function(e){var t=Te(e),i=t==Vu?e.constructor:void 0,r=i?W(i):"";if(r)switch(r){case Ru:return hr;case Hu:return ur;case Gu:return dr;case Qu:return pr;case Ku:return gr}return t});var mh=U.Uint8Array,Wu="__lodash_hash_undefined__";function Yu(e){return this.__data__.set(e,Wu),this}var Zu=Yu;function Xu(e){return this.__data__.has(e)}var Ju=Xu;function Vt(e){var t=-1,i=e==null?0:e.length;for(this.__data__=new Ir;++t<i;)this.add(e[t])}Vt.prototype.add=Vt.prototype.push=Zu;Vt.prototype.has=Ju;var fr=ce?ce.prototype:void 0,yh=fr?fr.valueOf:void 0,ed=Object.prototype,bh=ed.hasOwnProperty,td=Object.prototype,_h=td.hasOwnProperty,vh=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,"i"),wh=new RegExp(/[A-Fa-f0-9]{1}/,"g"),xh=new RegExp(/[A-Fa-f0-9]{2}/,"g");var Nt="@imgly/plugin-ai-generation",Eh=`
|
|
72
72
|
<svg>
|
|
73
73
|
<symbol
|
|
74
74
|
fill="none"
|
|
@@ -86,7 +86,7 @@ var Kn=Object.create;var Ai=Object.defineProperty;var Wn=Object.getOwnPropertyDe
|
|
|
86
86
|
fill="none"
|
|
87
87
|
xmlns="http://www.w3.org/2000/svg"
|
|
88
88
|
viewBox="0 0 24 24"
|
|
89
|
-
id="${
|
|
89
|
+
id="${Nt}/image"
|
|
90
90
|
>
|
|
91
91
|
<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"/>
|
|
92
92
|
<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"/>
|
|
@@ -98,7 +98,7 @@ var Kn=Object.create;var Ai=Object.defineProperty;var Wn=Object.getOwnPropertyDe
|
|
|
98
98
|
fill="none"
|
|
99
99
|
xmlns="http://www.w3.org/2000/svg"
|
|
100
100
|
viewBox="0 0 24 24"
|
|
101
|
-
id="${
|
|
101
|
+
id="${Nt}/video"
|
|
102
102
|
>
|
|
103
103
|
<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"/>
|
|
104
104
|
<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"/>
|
|
@@ -109,7 +109,7 @@ var Kn=Object.create;var Ai=Object.defineProperty;var Wn=Object.getOwnPropertyDe
|
|
|
109
109
|
fill="none"
|
|
110
110
|
xmlns="http://www.w3.org/2000/svg"
|
|
111
111
|
viewBox="0 0 24 24"
|
|
112
|
-
id="${
|
|
112
|
+
id="${Nt}/audio"
|
|
113
113
|
>
|
|
114
114
|
<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"/>
|
|
115
115
|
<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"/>
|
|
@@ -129,7 +129,7 @@ var Kn=Object.create;var Ai=Object.defineProperty;var Wn=Object.getOwnPropertyDe
|
|
|
129
129
|
|
|
130
130
|
</symbol>
|
|
131
131
|
</svg>
|
|
132
|
-
`;var gr="ly.img.ai.quickAction.order",Se="ly.img.ai.quickAction.actions";function Ju(e,t){return{id:t,setQuickActionMenuOrder:i=>{e.ui.experimental.setGlobalStateValue(`${gr}.${t}`,i)},getQuickActionMenuOrder:()=>e.ui.experimental.getGlobalStateValue(`${gr}.${t}`,[]),registerQuickAction:i=>{if(!e.ui.experimental.hasGlobalStateValue(`${Se}.${t}`))e.ui.experimental.setGlobalStateValue(`${Se}.${t}`,{[i.id]:i});else{let r=e.ui.experimental.getGlobalStateValue(`${Se}.${t}`,{});e.ui.experimental.setGlobalStateValue(`${Se}.${t}`,{...r,[i.id]:i})}},getQuickAction:i=>e.ui.experimental.getGlobalStateValue(`${Se}.${t}`,{})[i]}}var xr=Ju;var Er={ImageUrl:el};var Ir={openapi:"3.0.0",info:{title:"Fal Queue API",version:"1.0.0",description:"The Fal Queue API."},components:{securitySchemes:{apiKeyAuth:{type:"apiKey",in:"header",name:"Authorization",description:"Fal Key"}},schemas:{QueueStatus:{type:"object",properties:{status:{type:"string",enum:["IN_QUEUE","IN_PROGRESS","COMPLETED"]},request_id:{type:"string",description:"The request id."},response_url:{type:"string",description:"The response url."},status_url:{type:"string",description:"The status url."},cancel_url:{type:"string",description:"The cancel url."},logs:{type:"object",description:"The logs.",additionalProperties:!0},metrics:{type:"object",description:"The metrics.",additionalProperties:!0},queue_position:{type:"integer",description:"The queue position."}},required:["status","request_id"]},RecraftV3Input:{title:"TextToImageInput",type:"object",properties:{prompt:{title:"Prompt",type:"string","x-imgly-builder":{component:"TextArea"}},image_size:{anyOf:[{enum:["square_hd","square","portrait_4_3","portrait_16_9","landscape_4_3","landscape_16_9"],type:"string"},{$ref:"#/components/schemas/ImageSize"}],title:"Format",default:"square_hd","x-imgly-enum-labels":{ImageSize:"Custom",square_hd:"Square HD",square:"Square",portrait_4_3:"Portrait 4:3",portrait_16_9:"Portrait 16:9",landscape_4_3:"Landscape 4:3",landscape_16_9:"Landscape 16:9"},"x-imgly-enum-icons":{square:"@imgly/plugin/formats/ratio1by1",square_hd:"@imgly/plugin/formats/ratio1by1",portrait_4_3:"@imgly/plugin/formats/ratio3by4",portrait_16_9:"@imgly/plugin/formats/ratio9by16",landscape_4_3:"@imgly/plugin/formats/ratio4by3",landscape_16_9:"@imgly/plugin/formats/ratio16by9",ImageSize:"@imgly/plugin/formats/ratioFree"}},style:{enum:["any","realistic_image","digital_illustration","vector_illustration","realistic_image/b_and_w","realistic_image/hard_flash","realistic_image/hdr","realistic_image/natural_light","realistic_image/studio_portrait","realistic_image/enterprise","realistic_image/motion_blur","realistic_image/evening_light","realistic_image/faded_nostalgia","realistic_image/forest_life","realistic_image/mystic_naturalism","realistic_image/natural_tones","realistic_image/organic_calm","realistic_image/real_life_glow","realistic_image/retro_realism","realistic_image/retro_snapshot","realistic_image/urban_drama","realistic_image/village_realism","realistic_image/warm_folk","digital_illustration/pixel_art","digital_illustration/hand_drawn","digital_illustration/grain","digital_illustration/infantile_sketch","digital_illustration/2d_art_poster","digital_illustration/handmade_3d","digital_illustration/hand_drawn_outline","digital_illustration/engraving_color","digital_illustration/2d_art_poster_2","digital_illustration/antiquarian","digital_illustration/bold_fantasy","digital_illustration/child_book","digital_illustration/child_books","digital_illustration/cover","digital_illustration/crosshatch","digital_illustration/digital_engraving","digital_illustration/expressionism","digital_illustration/freehand_details","digital_illustration/grain_20","digital_illustration/graphic_intensity","digital_illustration/hard_comics","digital_illustration/long_shadow","digital_illustration/modern_folk","digital_illustration/multicolor","digital_illustration/neon_calm","digital_illustration/noir","digital_illustration/nostalgic_pastel","digital_illustration/outline_details","digital_illustration/pastel_gradient","digital_illustration/pastel_sketch","digital_illustration/pop_art","digital_illustration/pop_renaissance","digital_illustration/street_art","digital_illustration/tablet_sketch","digital_illustration/urban_glow","digital_illustration/urban_sketching","digital_illustration/vanilla_dreams","digital_illustration/young_adult_book","digital_illustration/young_adult_book_2","vector_illustration/bold_stroke","vector_illustration/chemistry","vector_illustration/colored_stencil","vector_illustration/contour_pop_art","vector_illustration/cosmics","vector_illustration/cutout","vector_illustration/depressive","vector_illustration/editorial","vector_illustration/emotional_flat","vector_illustration/infographical","vector_illustration/marker_outline","vector_illustration/mosaic","vector_illustration/naivector","vector_illustration/roundish_flat","vector_illustration/segmented_colors","vector_illustration/sharp_contrast","vector_illustration/thin","vector_illustration/vector_photo","vector_illustration/vivid_shapes","vector_illustration/engraving","vector_illustration/line_art","vector_illustration/line_circuit","vector_illustration/linocut"],title:"Style",type:"string",description:"The style of the generated images. Vector images cost 2X as much.",default:"realistic_image"},colors:{title:"Colors",type:"array",description:"An array of preferable colors",items:{$ref:"#/components/schemas/RGBColor"},default:[]}},"x-fal-order-properties":["prompt","style","image_size"],required:["prompt"]},RecraftV3Output:{title:"TextToImageOutput",type:"object",properties:{images:{title:"Images",type:"array",items:{$ref:"#/components/schemas/File"}}},"x-fal-order-properties":["images"],required:["images"]},ImageSize:{title:"ImageSize",type:"object",properties:{height:{maximum:14142,type:"integer",title:"Height",description:"The height of the generated image.",exclusiveMinimum:0,default:512},width:{maximum:14142,type:"integer",title:"Width",description:"The width of the generated image.",exclusiveMinimum:0,default:512}},"x-fal-order-properties":["width","height"]},RGBColor:{title:"RGBColor",type:"object",properties:{r:{minimum:0,maximum:255,type:"integer",title:"R",description:"Red color value",default:0},b:{minimum:0,maximum:255,type:"integer",title:"B",description:"Blue color value",default:0},g:{minimum:0,maximum:255,type:"integer",title:"G",description:"Green color value",default:0}},"x-fal-order-properties":["r","g","b"]},File:{title:"File",type:"object",properties:{file_size:{title:"File Size",type:"integer",description:"The size of the file in bytes."},file_name:{title:"File Name",type:"string",description:"The name of the file. It will be auto-generated if not provided."},content_type:{title:"Content Type",type:"string",description:"The mime type of the file."},url:{title:"Url",type:"string",description:"The URL where the file can be downloaded from."},file_data:{format:"binary",title:"File Data",type:"string",description:"File data"}},"x-fal-order-properties":["url","content_type","file_name","file_size","file_data"],required:["url"]}}},paths:{"/fal-ai/recraft-v3/requests/{request_id}/status":{get:{parameters:[{name:"request_id",in:"path",required:!0,schema:{type:"string",description:"Request ID"}},{name:"logs",in:"query",required:!1,schema:{type:"number",description:"Whether to include logs (`1`) in the response or not (`0`)."}}],responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/recraft-v3/requests/{request_id}/cancel":{put:{parameters:[{name:"request_id",in:"path",required:!0,schema:{type:"string",description:"Request ID"}}],responses:{"200":{description:"The request was cancelled.",content:{"application/json":{schema:{type:"object",properties:{success:{type:"boolean",description:"Whether the request was cancelled successfully."}}}}}}}}},"/fal-ai/recraft-v3":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/RecraftV3Input"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/recraft-v3/requests/{request_id}":{get:{parameters:[{name:"request_id",in:"path",required:!0,schema:{type:"string",description:"Request ID"}}],responses:{"200":{description:"Result of the request.",content:{"application/json":{schema:{$ref:"#/components/schemas/RecraftV3Output"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};var td={square_hd:{width:1024,height:1024},square:{width:512,height:512},portrait_4_3:{width:1024,height:1365},portrait_16_9:{width:1024,height:1820},landscape_4_3:{width:1365,height:1024},landscape_16_9:{width:1820,height:1024}};function Xe(e){return td[e]}var qt=[{id:"realistic_image",label:"Realistic Image"},{id:"digital_illustration",label:"Digital Illustration"},{id:"realistic_image/b_and_w",label:"Black & White"},{id:"realistic_image/hard_flash",label:"Hard Flash"},{id:"realistic_image/hdr",label:"HDR"},{id:"realistic_image/natural_light",label:"Natural Light"},{id:"realistic_image/studio_portrait",label:"Studio Portrait"},{id:"realistic_image/enterprise",label:"Enterprise"},{id:"realistic_image/motion_blur",label:"Motion Blur"},{id:"realistic_image/evening_light",label:"Evening Light"},{id:"realistic_image/faded_nostalgia",label:"Faded Nostalgia"},{id:"realistic_image/forest_life",label:"Forest Life"},{id:"realistic_image/mystic_naturalism",label:"Mystic Naturalism"},{id:"realistic_image/natural_tones",label:"Natural Tones"},{id:"realistic_image/organic_calm",label:"Organic Calm"},{id:"realistic_image/real_life_glow",label:"Real Life Glow"},{id:"realistic_image/retro_realism",label:"Retro Realism"},{id:"realistic_image/retro_snapshot",label:"Retro Snapshot"},{id:"realistic_image/urban_drama",label:"Urban Drama"},{id:"realistic_image/village_realism",label:"Village Realism"},{id:"realistic_image/warm_folk",label:"Warm Folk"},{id:"digital_illustration/pixel_art",label:"Pixel Art"},{id:"digital_illustration/hand_drawn",label:"Hand Drawn"},{id:"digital_illustration/grain",label:"Grain"},{id:"digital_illustration/infantile_sketch",label:"Infantile Sketch"},{id:"digital_illustration/2d_art_poster",label:"2D Art Poster"},{id:"digital_illustration/handmade_3d",label:"Handmade 3D"},{id:"digital_illustration/hand_drawn_outline",label:"Hand Drawn Outline"},{id:"digital_illustration/engraving_color",label:"Engraving Color"},{id:"digital_illustration/2d_art_poster_2",label:"2D Art Poster 2"},{id:"digital_illustration/antiquarian",label:"Antiquarian"},{id:"digital_illustration/bold_fantasy",label:"Bold Fantasy"},{id:"digital_illustration/child_book",label:"Child Book"},{id:"digital_illustration/child_books",label:"Child Books"},{id:"digital_illustration/cover",label:"Cover"},{id:"digital_illustration/crosshatch",label:"Crosshatch"},{id:"digital_illustration/digital_engraving",label:"Digital Engraving"},{id:"digital_illustration/expressionism",label:"Expressionism"},{id:"digital_illustration/freehand_details",label:"Freehand Details"},{id:"digital_illustration/grain_20",label:"Grain 20"},{id:"digital_illustration/graphic_intensity",label:"Graphic Intensity"},{id:"digital_illustration/hard_comics",label:"Hard Comics"},{id:"digital_illustration/long_shadow",label:"Long Shadow"},{id:"digital_illustration/modern_folk",label:"Modern Folk"},{id:"digital_illustration/multicolor",label:"Multicolor"},{id:"digital_illustration/neon_calm",label:"Neon Calm"},{id:"digital_illustration/noir",label:"Noir"},{id:"digital_illustration/nostalgic_pastel",label:"Nostalgic Pastel"},{id:"digital_illustration/outline_details",label:"Outline Details"},{id:"digital_illustration/pastel_gradient",label:"Pastel Gradient"},{id:"digital_illustration/pastel_sketch",label:"Pastel Sketch"},{id:"digital_illustration/pop_art",label:"Pop Art"},{id:"digital_illustration/pop_renaissance",label:"Pop Renaissance"},{id:"digital_illustration/street_art",label:"Street Art"},{id:"digital_illustration/tablet_sketch",label:"Tablet Sketch"},{id:"digital_illustration/urban_glow",label:"Urban Glow"},{id:"digital_illustration/urban_sketching",label:"Urban Sketching"},{id:"digital_illustration/vanilla_dreams",label:"Vanilla Dreams"},{id:"digital_illustration/young_adult_book",label:"Young Adult Book"},{id:"digital_illustration/young_adult_book_2",label:"Young Adult Book 2"}],Eh=qt[0],Vt=[{id:"vector_illustration",label:"Vector Illustration"},{id:"vector_illustration/bold_stroke",label:"Bold Stroke"},{id:"vector_illustration/chemistry",label:"Chemistry"},{id:"vector_illustration/colored_stencil",label:"Colored Stencil"},{id:"vector_illustration/contour_pop_art",label:"Contour Pop Art"},{id:"vector_illustration/cosmics",label:"Cosmics"},{id:"vector_illustration/cutout",label:"Cutout"},{id:"vector_illustration/depressive",label:"Depressive"},{id:"vector_illustration/editorial",label:"Editorial"},{id:"vector_illustration/emotional_flat",label:"Emotional Flat"},{id:"vector_illustration/infographical",label:"Infographical"},{id:"vector_illustration/marker_outline",label:"Marker Outline"},{id:"vector_illustration/mosaic",label:"Mosaic"},{id:"vector_illustration/naivector",label:"Naive Vector"},{id:"vector_illustration/roundish_flat",label:"Roundish Flat"},{id:"vector_illustration/segmented_colors",label:"Segmented Colors"},{id:"vector_illustration/sharp_contrast",label:"Sharp Contrast"},{id:"vector_illustration/thin",label:"Thin"},{id:"vector_illustration/vector_photo",label:"Vector Photo"},{id:"vector_illustration/vivid_shapes",label:"Vivid Shapes"},{id:"vector_illustration/engraving",label:"Engraving"},{id:"vector_illustration/line_art",label:"Line Art"},{id:"vector_illustration/line_circuit",label:"Line Circuit"},{id:"vector_illustration/linocut",label:"Linocut"}],Ih=Vt[0],id=e=>({realistic_image:`${e}/realistic_image.webp`,digital_illustration:`${e}/digital_illustration.webp`,"realistic_image/b_and_w":`${e}/realistic_image_black_&_white.webp`,"realistic_image/hard_flash":`${e}/realistic_image_hard_flash.webp`,"realistic_image/hdr":`${e}/realistic_image_hdr.webp`,"realistic_image/natural_light":`${e}/realistic_image_natural_light.webp`,"realistic_image/studio_portrait":`${e}/realistic_image_studio_portrait.webp`,"realistic_image/enterprise":`${e}/realistic_image_enterprise.webp`,"realistic_image/motion_blur":`${e}/realistic_image_motion_blur.webp`,"digital_illustration/pixel_art":`${e}/digital_illustration_pixel_art.webp`,"digital_illustration/hand_drawn":`${e}/digital_illustration_hand_drawn.webp`,"digital_illustration/grain":`${e}/digital_illustration_grain.webp`,"digital_illustration/infantile_sketch":`${e}/digital_illustration_infantile_sketch.webp`,"digital_illustration/2d_art_poster":`${e}/digital_illustration_2d_art_poster.webp`,"digital_illustration/handmade_3d":`${e}/digital_illustration_handmade_3d.webp`,"digital_illustration/hand_drawn_outline":`${e}/digital_illustration_handdrawn_outline.webp`,"digital_illustration/engraving_color":`${e}/digital_illustration_engraving_color.webp`,"digital_illustration/2d_art_poster_2":`${e}/digital_illustration_2d_artposter_2.webp`,vector_illustration:`${e}/vector_illustration.svg`,"vector_illustration/bold_stroke":`${e}/vector_illustration_bold_stroke.svg`,"vector_illustration/chemistry":`${e}/vector_illustration_chemistry.svg`,"vector_illustration/colored_stencil":`${e}/vector_illustration_colored_stencil.svg`,"vector_illustration/contour_pop_art":`${e}/vector_illustration_contour_pop_art.svg`,"vector_illustration/cosmics":`${e}/vector_illustration_cosmics.svg`,"vector_illustration/cutout":`${e}/vector_illustration_cutout.svg`,"vector_illustration/depressive":`${e}/vector_illustration_depressive.svg`,"vector_illustration/editorial":`${e}/vector_illustration_editorial.svg`,"vector_illustration/emotional_flat":`${e}/vector_illustration_emotional_flat.svg`,"vector_illustration/infographical":`${e}/vector_illustration_infographical.svg`,"vector_illustration/marker_outline":`${e}/vector_illustration_marker_outline.svg`,"vector_illustration/mosaic":`${e}/vector_illustration_mosaic.svg`,"vector_illustration/naivector":`${e}/vector_illustration_naivector.svg`,"vector_illustration/roundish_flat":`${e}/vector_illustration_roundish_flat.svg`,"vector_illustration/segmented_colors":`${e}/vector_illustration_segmented_colors.svg`,"vector_illustration/sharp_contrast":`${e}/vector_illustration_sharp_contrast.svg`,"vector_illustration/thin":`${e}/vector_illustration_thin.svg`,"vector_illustration/vector_photo":`${e}/vector_illustration_vector_photo.svg`,"vector_illustration/vivid_shapes":`${e}/vector_illustration_vivid_shapes.svg`,"vector_illustration/engraving":`${e}/vector_illustration_engraving.svg`,"vector_illustration/line_art":`${e}/vector_illustration_line_art.svg`,"vector_illustration/line_circuit":`${e}/vector_illustration_line_circuit.svg`,"vector_illustration/linocut":`${e}/vector_illustration_linocut.svg`,"realistic_image/evening_light":`${e}/realistic_image_evening_light.webp`,"realistic_image/faded_nostalgia":`${e}/realistic_image_faded_nostalgia.webp`,"realistic_image/forest_life":`${e}/realistic_image_forest_life.webp`,"realistic_image/mystic_naturalism":`${e}/realistic_image_mystic_naturalism.webp`,"realistic_image/natural_tones":`${e}/realistic_image_natural_tones.webp`,"realistic_image/organic_calm":`${e}/realistic_image_organic_calm.webp`,"realistic_image/real_life_glow":`${e}/realistic_image_real_life_glow.webp`,"realistic_image/retro_realism":`${e}/realistic_image_retro_realism.webp`,"realistic_image/retro_snapshot":`${e}/realistic_image_retro_snapshot.webp`,"realistic_image/urban_drama":`${e}/realistic_image_urban_drama.webp`,"realistic_image/village_realism":`${e}/realistic_image_village_realism.webp`,"realistic_image/warm_folk":`${e}/realistic_image_warm_folk.webp`,"digital_illustration/antiquarian":`${e}/digital_illustration_antiquarian.webp`,"digital_illustration/bold_fantasy":`${e}/digital_illustration_bold_fantasy.webp`,"digital_illustration/child_book":`${e}/digital_illustration_child_book.webp`,"digital_illustration/child_books":`${e}/digital_illustration_child_books.webp`,"digital_illustration/cover":`${e}/digital_illustration_cover.webp`,"digital_illustration/crosshatch":`${e}/digital_illustration_crosshatch.webp`,"digital_illustration/digital_engraving":`${e}/digital_illustration_digital_engraving.webp`,"digital_illustration/expressionism":`${e}/digital_illustration_expressionism.webp`,"digital_illustration/freehand_details":`${e}/digital_illustration_freehand_details.webp`,"digital_illustration/grain_20":`${e}/digital_illustration_grain_20.webp`,"digital_illustration/graphic_intensity":`${e}/digital_illustration_graphic_intensity.webp`,"digital_illustration/hard_comics":`${e}/digital_illustration_hard_comics.webp`,"digital_illustration/long_shadow":`${e}/digital_illustration_long_shadow.webp`,"digital_illustration/modern_folk":`${e}/digital_illustration_modern_folk.webp`,"digital_illustration/multicolor":`${e}/digital_illustration_multicolor.webp`,"digital_illustration/neon_calm":`${e}/digital_illustration_neon_calm.webp`,"digital_illustration/noir":`${e}/digital_illustration_noir.webp`,"digital_illustration/nostalgic_pastel":`${e}/digital_illustration_nostalgic_pastel.webp`,"digital_illustration/outline_details":`${e}/digital_illustration_outline_details.webp`,"digital_illustration/pastel_gradient":`${e}/digital_illustration_pastel_gradient.webp`,"digital_illustration/pastel_sketch":`${e}/digital_illustration_pastel_sketch.webp`,"digital_illustration/pop_art":`${e}/digital_illustration_pop_art.webp`,"digital_illustration/pop_renaissance":`${e}/digital_illustration_pop_renaissance.webp`,"digital_illustration/street_art":`${e}/digital_illustration_street_art.webp`,"digital_illustration/tablet_sketch":`${e}/digital_illustration_tablet_sketch.webp`,"digital_illustration/urban_glow":`${e}/digital_illustration_urban_glow.webp`,"digital_illustration/urban_sketching":`${e}/digital_illustration_urban_sketching.webp`,"digital_illustration/vanilla_dreams":`${e}/digital_illustration_vanilla_dreams.webp`,"digital_illustration/young_adult_book":`${e}/digital_illustration_young_adult_book.webp`,"digital_illustration/young_adult_book_2":`${e}/digital_illustration_young_adult_book_2.webp`});function Rt(e,t){return id(`${t}thumbnails/`)[e]}var ki=Mi(Ii());var Si=Mi(Ii());function xt(e){return e!=null&&typeof e!="string"&&"width"in e&&"height"in e}async function Vn(e,t){if(e!=null){if(e.startsWith("blob:")){let r=await(await fetch(e)).blob(),n=new File([r],"image.png",{type:"image/png"});return Si.fal.storage.upload(n)}if(t!=null&&e.startsWith("buffer:")){let i=await t.engine.editor.getMimeType(e),r=t.engine.editor.getBufferLength(e),n=t.engine.editor.getBufferData(e,0,r),o=new File([n],"image.png",{type:i});return Si.fal.storage.upload(o)}return e}}function Ag(e,t){let i=e.middleware??[];t.debug&&i.unshift(hr());let r={id:e.modelKey,kind:"image",name:e.name,initialize:async n=>{ki.fal.config({proxyUrl:t.proxyUrl}),e.initialize?.(n)},input:{quickActions:{actions:e.quickActions??[]},panel:{type:"schema",document:e.schema,inputReference:e.inputReference,includeHistoryLibrary:!0,orderExtensionKeyword:"x-fal-order-properties",renderCustomProperty:{...e.cesdk!=null?Er.ImageUrl(e.modelKey,{cesdk:e.cesdk}):{},...e.renderCustomProperty},getBlockInput:n=>{if(e.getBlockInput!=null)return e.getBlockInput(n);if(e.getImageSize!=null){let{width:o,height:a}=e.getImageSize(n);return Promise.resolve({image:{width:o,height:a}})}if(n.image_size!=null&&xt(n.image_size))return Promise.resolve({image:{width:n.image_size.width??512,height:n.image_size.height??512}});if(n.image_size!=null&&typeof n.image_size=="string"){let o=Xe(n.image_size);return Promise.resolve({image:o})}throw new Error("getBlockInput or getImageSize must be provided")},userFlow:e.useFlow??"placeholder"}},output:{abortable:!0,middleware:i,history:"@imgly/indexedDB",generate:async(n,{abortSignal:o})=>{let a=await Vn(n.image_url,e.cesdk),s=await ki.fal.subscribe(e.modelKey,{abortSignal:o,input:a!=null?{...n,image_url:a}:n,logs:!0}),l=s?.data?.images;if(l!=null&&Array.isArray(l)){let u=l[0]?.url;if(u!=null)return{kind:"image",url:u}}else{let c=s?.data?.image;if(c!=null){let u=c?.url;if(u!=null)return{kind:"image",url:u}}}throw console.error("Cannot extract generated image from response:",s),new Error("Cannot find generated image")}}};return t.debug&&console.log("Created Provider:",r),r}var Et=Ag;var qe,Ve;function Rn(e){return async({cesdk:t})=>Mg(t,e)}function Mg(e,t){let i="fal-ai/recraft-v3",r=`${i}/styles/image`,n=`${i}/styles/vector`,o=t.baseURL??"https://cdn.img.ly/assets/plugins/plugin-ai-image-generation-web/v1/recraft-v3/";return e.ui.addIconSet("@imgly/plugin/formats",Xi.Formats),qe=new Ot(r,qt.map(({id:a,label:s})=>({id:a,label:s,thumbUri:Rt(a,o)}))),Ve=new Ot(n,Vt.map(({id:a,label:s})=>({id:a,label:s,thumbUri:Rt(a,o)}))),qe.setAssetActive("realistic_image"),Ve.setAssetActive("vector_illustration"),e.engine.asset.addSource(qe),e.engine.asset.addSource(Ve),e.ui.addAssetLibraryEntry({id:r,sourceIds:[r],gridItemHeight:"square",gridBackgroundType:"cover",cardLabel:({label:a})=>a,cardLabelPosition:()=>"below"}),e.ui.addAssetLibraryEntry({id:n,sourceIds:[n],gridItemHeight:"square",gridBackgroundType:"cover",cardLabel:({label:a})=>a,cardLabelPosition:()=>"below"}),e.ui.registerPanel(`${Me(i)}.styleSelection`,({builder:a,payload:s})=>{if(s==null)return null;let l=s.generationType==="image"?[r]:[n];a.Library(`${i}.library.style`,{entries:l,onSelect:async c=>{s.onSelect(c)}})}),e.i18n.setTranslations({en:{[`panel.${Me("fal-ai/recraft-v3")}.styleSelection`]:"Style Selection",[`${i}.style`]:"Style",[`${i}.style.type`]:"Type",[`${i}.style.type.image`]:"Image",[`${i}.style.type.vector`]:"Vector"}}),Et({modelKey:i,schema:Ir,inputReference:"#/components/schemas/RecraftV3Input",middleware:t.middleware??[],userFlow:"placeholder",renderCustomProperty:{style:({builder:a,state:s},l)=>{let c=s("type","image"),u=s("style/image",{id:"realistic_image",label:"Realistic Image"}),d=s("style/vector",{id:"vector_illustration",label:"Vector Illustration"}),h=c.value==="image"?u:d;return a.ButtonGroup(`${l.id}.type`,{inputLabel:`${i}.${l.id}.type`,children:()=>{a.Button(`${l.id}.type.image`,{label:`${i}.${l.id}.type.image`,isActive:c.value==="image",onClick:()=>c.setValue("image")}),a.Button(`${l.id}.type.vector`,{label:`${i}.${l.id}.type.vector`,isActive:c.value==="vector",onClick:()=>c.setValue("vector")})}}),a.Button(`${l.id}`,{inputLabel:`${i}.${l.id}`,icon:"@imgly/Appearance",trailingIcon:"@imgly/ChevronRight",label:h.value.label,labelAlignment:"left",onClick:()=>{let p={generationType:c.value,onSelect:async f=>{if(f.id==="back")return;let b={id:f.id,label:f.label??f.id};c.value==="image"?(qe.clearActiveAssets(),qe.setAssetActive(f.id),u.setValue(b)):c.value==="vector"&&(Ve.clearActiveAssets(),Ve.setAssetActive(f.id),d.setValue(b)),e.ui.closePanel(`${Me(i)}.styleSelection`)}};e.ui.openPanel(`${Me(i)}.styleSelection`,{payload:p})}}),()=>({id:l.id,type:"string",value:h.value.id??"realistic_image"})}},getBlockInput:a=>{if(xt(a.image_size))return Promise.resolve({image:{width:a.image_size.width??512,height:a.image_size.height??512}});let s=Xe(a.image_size??"square_hd");return Promise.resolve({image:s})}},t)}var Hn={openapi:"3.0.0",info:{title:"Fal Queue API",version:"1.0.0",description:"The Fal Queue API."},components:{securitySchemes:{apiKeyAuth:{type:"apiKey",in:"header",name:"Authorization",description:"Fal Key"}},schemas:{QueueStatus:{type:"object",properties:{status:{type:"string",enum:["IN_QUEUE","IN_PROGRESS","COMPLETED"]},request_id:{type:"string",description:"The request id."},response_url:{type:"string",description:"The response url."},status_url:{type:"string",description:"The status url."},cancel_url:{type:"string",description:"The cancel url."},logs:{type:"object",description:"The logs.",additionalProperties:!0},metrics:{type:"object",description:"The metrics.",additionalProperties:!0},queue_position:{type:"integer",description:"The queue position."}},required:["status","request_id"]},GeminiFlashEditInput:{title:"GeminiImageRequest",type:"object",properties:{prompt:{maxLength:5e3,type:"string",title:"Prompt",minLength:3,description:"The prompt for image generation or editing","x-imgly-builder":{component:"TextArea"}},image_url:{title:"Image Url",type:"string",description:"Optional URL of an input image for editing. If not provided, generates a new image."}},"x-fal-order-properties":["image_url","prompt"],required:["prompt","image_url"]},GeminiFlashEditOutput:{title:"GeminiImageOutput",type:"object",properties:{description:{title:"Description",type:"string",description:"Text description or response from Gemini"},image:{description:"The generated or edited image",$ref:"#/components/schemas/Image"}},"x-fal-order-properties":["image","description"],required:["image","description"]},Image:{title:"Image",type:"object",properties:{file_size:{anyOf:[{type:"integer"},{type:"null"}],title:"File Size",description:"The size of the file in bytes."},height:{anyOf:[{type:"integer"},{type:"null"}],title:"Height",description:"The height of the image in pixels."},file_name:{anyOf:[{type:"string"},{type:"null"}],title:"File Name",description:"The name of the file. It will be auto-generated if not provided."},content_type:{anyOf:[{type:"string"},{type:"null"}],title:"Content Type",description:"The mime type of the file."},url:{title:"Url",type:"string",description:"The URL where the file can be downloaded from."},width:{anyOf:[{type:"integer"},{type:"null"}],title:"Width",description:"The width of the image in pixels."}},description:"Represents an image file.","x-fal-order-properties":["url","content_type","file_name","file_size","width","height"],required:["url"]}}},paths:{"/fal-ai/gemini-flash-edit/requests/{request_id}/status":{get:{parameters:[{name:"request_id",in:"path",required:!0,schema:{type:"string",description:"Request ID"}},{name:"logs",in:"query",required:!1,schema:{type:"number",description:"Whether to include logs (`1`) in the response or not (`0`)."}}],responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/gemini-flash-edit/requests/{request_id}/cancel":{put:{parameters:[{name:"request_id",in:"path",required:!0,schema:{type:"string",description:"Request ID"}}],responses:{"200":{description:"The request was cancelled.",content:{"application/json":{schema:{type:"object",properties:{success:{type:"boolean",description:"Whether the request was cancelled successfully."}}}}}}}}},"/fal-ai/gemini-flash-edit":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/GeminiFlashEditInput"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/gemini-flash-edit/requests/{request_id}":{get:{parameters:[{name:"request_id",in:"path",required:!0,schema:{type:"string",description:"Request ID"}}],responses:{"200":{description:"Result of the request.",content:{"application/json":{schema:{$ref:"#/components/schemas/GeminiFlashEditOutput"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function Gn(e){return e.i18n.setTranslations({en:{"ly.img.ai.inference.change":"Change","ly.img.ai.inference.generate":"Generate","ly.img.ai.inference.create":"Create","ly.img.ai.inference.changeArtStyle":"Change Art Style","ly.img.ai.inference.paintedBy":"Painted By","ly.img.ai.inference.changeImage":"Edit Image...","ly.img.ai.inference.changeImage.prompt.inputLabel":"Change image...","ly.img.ai.inference.changeImage.prompt.placeholder":"Describe what you want to change...","ly.img.ai.inference.createVariant":"Create Variant...","ly.img.ai.inference.createVariant.prompt.inputLabel":"Describe Your Variant","ly.img.ai.inference.createVariant.prompt.placeholder":"e.g., same character with arms raised","ly.img.ai.inference.createVideo":"Create Video..."}}),[jg(e),Pg(e),$g(e),Dg(e),Ng(e)]}function Og(){return({engine:e})=>{let t=e.block.findAllSelected();if(t==null||t.length!==1)return!1;let[i]=t;if(e.block.getType(i)!=="//ly.img.ubq/graphic"&&!e.block.supportsFill(i))return!1;let r=e.block.getFill(i);return e.block.getType(r)==="//ly.img.ubq/fill/image"}}function Re(e){return{id:e,version:"1",confirmation:!0,lockDuringConfirmation:!1,enable:Og()}}async function He(e,t){let i,r=t.engine.block.getFill(e),n=t.engine.block.getSourceSet(r,"fill/image/sourceSet"),[o]=n;if(o==null){if(i=t.engine.block.getString(r,"fill/image/imageFileURI"),i==null)throw new Error("No image source/uri found")}else i=o.uri;if(await t.engine.editor.getMimeType(i)==="image/svg+xml")throw new Error("SVG images are not supported");return i}function jg(e){return{...Re("changeImage"),render:({builder:i},{toggleExpand:r})=>{i.Button("changeImage.button",{label:"ly.img.ai.inference.changeImage",icon:"@imgly/plugin-ai-generation/image",labelAlignment:"left",variant:"plain",onClick:r})},renderExpanded:({builder:i,state:r,experimental:n},{generate:o,toggleExpand:a,handleGenerationError:s})=>{let l=r("changeImage.prompt","");i.TextArea("changeImage.textarea",{inputLabel:"ly.img.ai.inference.changeImage.prompt.inputLabel",placeholder:"ly.img.ai.inference.changeImage.prompt.placeholder",...l}),i.Separator("changeImage.separator"),n.builder.ButtonRow("changeImage.footer",{justifyContent:"space-between",children:()=>{i.Button("changeImage.footer.cancel",{label:"common.back",icon:"@imgly/ChevronLeft",onClick:a}),i.Button("changeImage.footer.apply",{label:"ly.img.ai.inference.change",icon:"@imgly/MagicWand",color:"accent",onClick:async()=>{try{let c=l.value;if(!c)return;let[u]=e.engine.block.findAllSelected(),d=await He(u,e);o({prompt:c,image_url:d,blockId:u}),a()}catch(c){s(c)}}})}})}}}function Pg(e){let t=Re("createVariant");return{...t,confirmation:!1,enable:()=>{if(typeof t.enable=="boolean"&&!t.enable||typeof t.enable=="function"&&!t.enable({engine:e.engine}))return!1;let[i]=e.engine.block.findAllSelected();if(!e.feature.isEnabled("ly.img.duplicate",{engine:e.engine})||!e.engine.block.isAllowedByScope(i,"lifecycle/duplicate"))return!1;let r=e.engine.block.getParent(i);return!(r!=null&&e.engine.block.getType(r)==="//ly.img.ubq/track"&&e.engine.block.isPageDurationSource(r)||e.engine.block.getType(i)==="//ly.img.ubq/page")},render:({builder:i},{toggleExpand:r})=>{i.Button("createVariant.button",{label:"ly.img.ai.inference.createVariant",icon:"@imgly/ImageVariation",labelAlignment:"left",variant:"plain",onClick:r})},renderExpanded:({builder:i,state:r,experimental:n,engine:o},{generate:a,toggleExpand:s,handleGenerationError:l})=>{let c=r("createVariant.prompt","");i.TextArea("createVariant.textarea",{inputLabel:"ly.img.ai.inference.createVariant.prompt.inputLabel",placeholder:"ly.img.ai.inference.createVariant.prompt.placeholder",...c}),i.Separator("createVariant.separator"),n.builder.ButtonRow("createVariant.footer",{justifyContent:"space-between",children:()=>{i.Button("createVariant.footer.cancel",{label:"common.back",icon:"@imgly/ChevronLeft",onClick:s}),i.Button("createVariant.footer.apply",{label:"ly.img.ai.inference.create",icon:"@imgly/MagicWand",color:"accent",onClick:async()=>{try{let u=c.value;if(!u)return;let[d]=o.block.findAllSelected(),h=o.block.duplicate(d);o.block.setSelected(d,!1),o.block.setSelected(h,!0);let p=o.block.getParent(h);if(p==null)throw new Error("Parent not found");let f=1,b=o.block.getWidth(p),_=o.block.getHeight(p),g=.02*Math.min(b,_)*f;o.block.setPositionX(h,o.block.getPositionX(h)+g),o.block.setPositionY(h,o.block.getPositionY(h)+g);let m=await He(h,e);a({prompt:u,image_url:m,blockId:h},{blockIds:[h]}),s()}catch(u){l(u)}}})}})}}}function $g(e){return{...Re("createVideo"),render:({builder:i},{closeMenu:r,handleGenerationError:n})=>{i.Button("createVideo.button",{label:"ly.img.ai.inference.createVideo",icon:"@imgly/plugin-ai-generation/video",labelAlignment:"left",variant:"plain",onClick:async()=>{try{let[o]=e.engine.block.findAllSelected(),a=await He(o,e);e.ui.openPanel("ly.img.ai/video-generation"),e.ui.experimental.setGlobalStateValue("ly.img.ai.video-generation.fromType","fromImage"),e.ui.experimental.setGlobalStateValue("fal-ai/minimax/video-01-live/image-to-video.image_url",a),r()}catch(o){n(o)}}})}}}function Dg(e){let t=Re("styleTransfer"),i=[{id:"water",label:"Watercolor Painting",prompt:"Convert to watercolor painting."},{id:"oil",label:"Oil Painting",prompt:"Render in oil painting style."},{id:"charcoal",label:"Charcoal Sketch",prompt:"Transform into a charcoal sketch."},{id:"pencil",label:"Pencil Drawing",prompt:"Apply pencil drawing effect."},{id:"pastel",label:"Pastel Artwork",prompt:"Make it look like a pastel artwork."},{id:"ink",label:"Ink Wash",prompt:"Turn into a classic ink wash painting."},{id:"stained-glass",label:"Stained Glass Window",prompt:"Stylize as a stained glass window."},{id:"japanse",label:"Japanese Woodblock Print",prompt:"Repaint as a traditional Japanese woodblock print."}];return{...t,render:({builder:r,experimental:n},{generate:o,closeMenu:a,handleGenerationError:s})=>{n.builder.Popover("styleTransfer.popover",{label:"ly.img.ai.inference.changeArtStyle",icon:"@imgly/Appearance",labelAlignment:"left",variant:"plain",trailingIcon:"@imgly/ChevronRight",placement:"right",children:()=>{r.Section("styleTransfer.popover.section",{children:()=>{n.builder.Menu("styleTransfer.popover.menu",{children:()=>{i.forEach(l=>{r.Button(`styleTransfer.popover.menu.${l.id}`,{label:l.label,labelAlignment:"left",variant:"plain",onClick:async()=>{try{a();let[c]=e.engine.block.findAllSelected(),u=await He(c,e);o({prompt:l.prompt,image_url:u,blockId:c})}catch(c){s(c)}}})})}})}})}})}}}function Ng(e){let t=Re("artists"),i=[{id:"van-gogh",label:"Van Gogh",prompt:"Render this image in the style of Vincent van Gogh, using expressive brushstrokes and swirling motion."},{id:"monet",label:"Monet",prompt:"Transform this image into the soft, impressionistic style of Claude Monet with natural light and delicate color blending."},{id:"picasso",label:"Picasso",prompt:"Apply a Pablo Picasso cubist style with abstract geometry and fragmented shapes."},{id:"dali",label:"Dal\xED",prompt:"Make this image resemble Salvador Dal\xED's surrealist style, with dreamlike distortion and soft shadows."},{id:"matisse",label:"Matisse",prompt:"Stylize the image using Henri Matisse's bold colors and simplified, flowing shapes."},{id:"warhol",label:"Warhol",prompt:"Convert this image into Andy Warhol's pop art style with flat colors, repetition, and bold outlines."},{id:"michelangelo",label:"Michelangelo",prompt:"Render the image in the classical Renaissance style of Michelangelo, with dramatic anatomy and fresco-like detail."},{id:"da-vinci",label:"Da Vinci",prompt:"Make this image look like a Leonardo da Vinci painting, using soft transitions, balanced composition, and natural tones."},{id:"rembrandt",label:"Rembrandt",prompt:"Apply Rembrandt's style with rich contrast, warm tones, and dramatic use of light and shadow."},{id:"mon-drain",label:"Mondrian",prompt:"Transform the image into Piet Mondrian's abstract geometric style with grids and primary colors."},{id:"khalo",label:"Frida Kahlo",prompt:"Stylize this image in the expressive, symbolic style of Frida Kahlo with vivid colors and surreal framing."},{id:"hokusai",label:"Hokusai",prompt:"Render the image in the style of Hokusai, using bold outlines, flat color, and traditional Japanese woodblock aesthetics."}];return{...t,render:({builder:r,experimental:n},{generate:o,closeMenu:a,handleGenerationError:s})=>{n.builder.Popover("artists.popover",{label:"ly.img.ai.inference.paintedBy",icon:"@imgly/MixingPlate",labelAlignment:"left",variant:"plain",trailingIcon:"@imgly/ChevronRight",placement:"right",children:()=>{r.Section("artists.popover.section",{children:()=>{n.builder.Menu("artists.popover.menu",{children:()=>{i.forEach(l=>{r.Button(`artists.popover.menu.${l.id}`,{label:l.label,labelAlignment:"left",variant:"plain",onClick:async()=>{try{a();let[c]=e.engine.block.findAllSelected(),u=await He(c,e);o({prompt:l.prompt,image_url:u,blockId:c})}catch(c){s(c)}}})})}})}})}})}}}function Qn(e){return async({cesdk:t})=>Ug(t,e)}function Ug(e,t){let i="fal-ai/gemini-flash-edit",r=Gn(e),n=xr(e,"image");return n.setQuickActionMenuOrder([...n.getQuickActionMenuOrder(),"ly.img.separator","styleTransfer","artists","ly.img.separator","changeImage","createVariant","ly.img.separator","createVideo"]),Et({modelKey:i,name:"Change Image",schema:Hn,inputReference:"#/components/schemas/GeminiFlashEditInput",cesdk:e,quickActions:r,middleware:t.middleware,getBlockInput:async o=>{let{width:a,height:s}=await Zi(o.image_url);return Promise.resolve({image:{width:a,height:s}})}},t)}var Bg={RecraftV3:Rn,GeminiFlashEdit:Qn},Uf=Bg;export{Uf as default};
|
|
132
|
+
`;var mr="ly.img.ai.quickAction.order",Se="ly.img.ai.quickAction.actions";function id(e,t){return{id:t,setQuickActionMenuOrder:i=>{e.ui.experimental.setGlobalStateValue(`${mr}.${t}`,i)},getQuickActionMenuOrder:()=>e.ui.experimental.getGlobalStateValue(`${mr}.${t}`,[]),registerQuickAction:i=>{if(!e.ui.experimental.hasGlobalStateValue(`${Se}.${t}`))e.ui.experimental.setGlobalStateValue(`${Se}.${t}`,{[i.id]:i});else{let r=e.ui.experimental.getGlobalStateValue(`${Se}.${t}`,{});e.ui.experimental.setGlobalStateValue(`${Se}.${t}`,{...r,[i.id]:i})}},getQuickAction:i=>e.ui.experimental.getGlobalStateValue(`${Se}.${t}`,{})[i]}}var Sr=id;var kr={ImageUrl:rl};var Cr={openapi:"3.0.0",info:{title:"Fal Queue API",version:"1.0.0",description:"The Fal Queue API."},components:{securitySchemes:{apiKeyAuth:{type:"apiKey",in:"header",name:"Authorization",description:"Fal Key"}},schemas:{QueueStatus:{type:"object",properties:{status:{type:"string",enum:["IN_QUEUE","IN_PROGRESS","COMPLETED"]},request_id:{type:"string",description:"The request id."},response_url:{type:"string",description:"The response url."},status_url:{type:"string",description:"The status url."},cancel_url:{type:"string",description:"The cancel url."},logs:{type:"object",description:"The logs.",additionalProperties:!0},metrics:{type:"object",description:"The metrics.",additionalProperties:!0},queue_position:{type:"integer",description:"The queue position."}},required:["status","request_id"]},RecraftV3Input:{title:"TextToImageInput",type:"object",properties:{prompt:{title:"Prompt",type:"string","x-imgly-builder":{component:"TextArea"}},image_size:{anyOf:[{enum:["square_hd","square","portrait_4_3","portrait_16_9","landscape_4_3","landscape_16_9"],type:"string"},{$ref:"#/components/schemas/ImageSize"}],title:"Format",default:"square_hd","x-imgly-enum-labels":{ImageSize:"Custom",square_hd:"Square HD",square:"Square",portrait_4_3:"Portrait 4:3",portrait_16_9:"Portrait 16:9",landscape_4_3:"Landscape 4:3",landscape_16_9:"Landscape 16:9"},"x-imgly-enum-icons":{square:"@imgly/plugin/formats/ratio1by1",square_hd:"@imgly/plugin/formats/ratio1by1",portrait_4_3:"@imgly/plugin/formats/ratio3by4",portrait_16_9:"@imgly/plugin/formats/ratio9by16",landscape_4_3:"@imgly/plugin/formats/ratio4by3",landscape_16_9:"@imgly/plugin/formats/ratio16by9",ImageSize:"@imgly/plugin/formats/ratioFree"}},style:{enum:["any","realistic_image","digital_illustration","vector_illustration","realistic_image/b_and_w","realistic_image/hard_flash","realistic_image/hdr","realistic_image/natural_light","realistic_image/studio_portrait","realistic_image/enterprise","realistic_image/motion_blur","realistic_image/evening_light","realistic_image/faded_nostalgia","realistic_image/forest_life","realistic_image/mystic_naturalism","realistic_image/natural_tones","realistic_image/organic_calm","realistic_image/real_life_glow","realistic_image/retro_realism","realistic_image/retro_snapshot","realistic_image/urban_drama","realistic_image/village_realism","realistic_image/warm_folk","digital_illustration/pixel_art","digital_illustration/hand_drawn","digital_illustration/grain","digital_illustration/infantile_sketch","digital_illustration/2d_art_poster","digital_illustration/handmade_3d","digital_illustration/hand_drawn_outline","digital_illustration/engraving_color","digital_illustration/2d_art_poster_2","digital_illustration/antiquarian","digital_illustration/bold_fantasy","digital_illustration/child_book","digital_illustration/child_books","digital_illustration/cover","digital_illustration/crosshatch","digital_illustration/digital_engraving","digital_illustration/expressionism","digital_illustration/freehand_details","digital_illustration/grain_20","digital_illustration/graphic_intensity","digital_illustration/hard_comics","digital_illustration/long_shadow","digital_illustration/modern_folk","digital_illustration/multicolor","digital_illustration/neon_calm","digital_illustration/noir","digital_illustration/nostalgic_pastel","digital_illustration/outline_details","digital_illustration/pastel_gradient","digital_illustration/pastel_sketch","digital_illustration/pop_art","digital_illustration/pop_renaissance","digital_illustration/street_art","digital_illustration/tablet_sketch","digital_illustration/urban_glow","digital_illustration/urban_sketching","digital_illustration/vanilla_dreams","digital_illustration/young_adult_book","digital_illustration/young_adult_book_2","vector_illustration/bold_stroke","vector_illustration/chemistry","vector_illustration/colored_stencil","vector_illustration/contour_pop_art","vector_illustration/cosmics","vector_illustration/cutout","vector_illustration/depressive","vector_illustration/editorial","vector_illustration/emotional_flat","vector_illustration/infographical","vector_illustration/marker_outline","vector_illustration/mosaic","vector_illustration/naivector","vector_illustration/roundish_flat","vector_illustration/segmented_colors","vector_illustration/sharp_contrast","vector_illustration/thin","vector_illustration/vector_photo","vector_illustration/vivid_shapes","vector_illustration/engraving","vector_illustration/line_art","vector_illustration/line_circuit","vector_illustration/linocut"],title:"Style",type:"string",description:"The style of the generated images. Vector images cost 2X as much.",default:"realistic_image"},colors:{title:"Colors",type:"array",description:"An array of preferable colors",items:{$ref:"#/components/schemas/RGBColor"},default:[]}},"x-fal-order-properties":["prompt","style","image_size"],required:["prompt"]},RecraftV3Output:{title:"TextToImageOutput",type:"object",properties:{images:{title:"Images",type:"array",items:{$ref:"#/components/schemas/File"}}},"x-fal-order-properties":["images"],required:["images"]},ImageSize:{title:"ImageSize",type:"object",properties:{height:{maximum:14142,type:"integer",title:"Height",description:"The height of the generated image.",exclusiveMinimum:0,default:512},width:{maximum:14142,type:"integer",title:"Width",description:"The width of the generated image.",exclusiveMinimum:0,default:512}},"x-fal-order-properties":["width","height"]},RGBColor:{title:"RGBColor",type:"object",properties:{r:{minimum:0,maximum:255,type:"integer",title:"R",description:"Red color value",default:0},b:{minimum:0,maximum:255,type:"integer",title:"B",description:"Blue color value",default:0},g:{minimum:0,maximum:255,type:"integer",title:"G",description:"Green color value",default:0}},"x-fal-order-properties":["r","g","b"]},File:{title:"File",type:"object",properties:{file_size:{title:"File Size",type:"integer",description:"The size of the file in bytes."},file_name:{title:"File Name",type:"string",description:"The name of the file. It will be auto-generated if not provided."},content_type:{title:"Content Type",type:"string",description:"The mime type of the file."},url:{title:"Url",type:"string",description:"The URL where the file can be downloaded from."},file_data:{format:"binary",title:"File Data",type:"string",description:"File data"}},"x-fal-order-properties":["url","content_type","file_name","file_size","file_data"],required:["url"]}}},paths:{"/fal-ai/recraft-v3/requests/{request_id}/status":{get:{parameters:[{name:"request_id",in:"path",required:!0,schema:{type:"string",description:"Request ID"}},{name:"logs",in:"query",required:!1,schema:{type:"number",description:"Whether to include logs (`1`) in the response or not (`0`)."}}],responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/recraft-v3/requests/{request_id}/cancel":{put:{parameters:[{name:"request_id",in:"path",required:!0,schema:{type:"string",description:"Request ID"}}],responses:{"200":{description:"The request was cancelled.",content:{"application/json":{schema:{type:"object",properties:{success:{type:"boolean",description:"Whether the request was cancelled successfully."}}}}}}}}},"/fal-ai/recraft-v3":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/RecraftV3Input"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/recraft-v3/requests/{request_id}":{get:{parameters:[{name:"request_id",in:"path",required:!0,schema:{type:"string",description:"Request ID"}}],responses:{"200":{description:"Result of the request.",content:{"application/json":{schema:{$ref:"#/components/schemas/RecraftV3Output"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};var nd={square_hd:{width:1024,height:1024},square:{width:512,height:512},portrait_4_3:{width:1024,height:1365},portrait_16_9:{width:1024,height:1820},landscape_4_3:{width:1365,height:1024},landscape_16_9:{width:1820,height:1024}};function Xe(e){return nd[e]}var Ht=[{id:"realistic_image",label:"Realistic Image"},{id:"digital_illustration",label:"Digital Illustration"},{id:"realistic_image/b_and_w",label:"Black & White"},{id:"realistic_image/hard_flash",label:"Hard Flash"},{id:"realistic_image/hdr",label:"HDR"},{id:"realistic_image/natural_light",label:"Natural Light"},{id:"realistic_image/studio_portrait",label:"Studio Portrait"},{id:"realistic_image/enterprise",label:"Enterprise"},{id:"realistic_image/motion_blur",label:"Motion Blur"},{id:"realistic_image/evening_light",label:"Evening Light"},{id:"realistic_image/faded_nostalgia",label:"Faded Nostalgia"},{id:"realistic_image/forest_life",label:"Forest Life"},{id:"realistic_image/mystic_naturalism",label:"Mystic Naturalism"},{id:"realistic_image/natural_tones",label:"Natural Tones"},{id:"realistic_image/organic_calm",label:"Organic Calm"},{id:"realistic_image/real_life_glow",label:"Real Life Glow"},{id:"realistic_image/retro_realism",label:"Retro Realism"},{id:"realistic_image/retro_snapshot",label:"Retro Snapshot"},{id:"realistic_image/urban_drama",label:"Urban Drama"},{id:"realistic_image/village_realism",label:"Village Realism"},{id:"realistic_image/warm_folk",label:"Warm Folk"},{id:"digital_illustration/pixel_art",label:"Pixel Art"},{id:"digital_illustration/hand_drawn",label:"Hand Drawn"},{id:"digital_illustration/grain",label:"Grain"},{id:"digital_illustration/infantile_sketch",label:"Infantile Sketch"},{id:"digital_illustration/2d_art_poster",label:"2D Art Poster"},{id:"digital_illustration/handmade_3d",label:"Handmade 3D"},{id:"digital_illustration/hand_drawn_outline",label:"Hand Drawn Outline"},{id:"digital_illustration/engraving_color",label:"Engraving Color"},{id:"digital_illustration/2d_art_poster_2",label:"2D Art Poster 2"},{id:"digital_illustration/antiquarian",label:"Antiquarian"},{id:"digital_illustration/bold_fantasy",label:"Bold Fantasy"},{id:"digital_illustration/child_book",label:"Child Book"},{id:"digital_illustration/child_books",label:"Child Books"},{id:"digital_illustration/cover",label:"Cover"},{id:"digital_illustration/crosshatch",label:"Crosshatch"},{id:"digital_illustration/digital_engraving",label:"Digital Engraving"},{id:"digital_illustration/expressionism",label:"Expressionism"},{id:"digital_illustration/freehand_details",label:"Freehand Details"},{id:"digital_illustration/grain_20",label:"Grain 20"},{id:"digital_illustration/graphic_intensity",label:"Graphic Intensity"},{id:"digital_illustration/hard_comics",label:"Hard Comics"},{id:"digital_illustration/long_shadow",label:"Long Shadow"},{id:"digital_illustration/modern_folk",label:"Modern Folk"},{id:"digital_illustration/multicolor",label:"Multicolor"},{id:"digital_illustration/neon_calm",label:"Neon Calm"},{id:"digital_illustration/noir",label:"Noir"},{id:"digital_illustration/nostalgic_pastel",label:"Nostalgic Pastel"},{id:"digital_illustration/outline_details",label:"Outline Details"},{id:"digital_illustration/pastel_gradient",label:"Pastel Gradient"},{id:"digital_illustration/pastel_sketch",label:"Pastel Sketch"},{id:"digital_illustration/pop_art",label:"Pop Art"},{id:"digital_illustration/pop_renaissance",label:"Pop Renaissance"},{id:"digital_illustration/street_art",label:"Street Art"},{id:"digital_illustration/tablet_sketch",label:"Tablet Sketch"},{id:"digital_illustration/urban_glow",label:"Urban Glow"},{id:"digital_illustration/urban_sketching",label:"Urban Sketching"},{id:"digital_illustration/vanilla_dreams",label:"Vanilla Dreams"},{id:"digital_illustration/young_adult_book",label:"Young Adult Book"},{id:"digital_illustration/young_adult_book_2",label:"Young Adult Book 2"}],kh=Ht[0],Gt=[{id:"vector_illustration",label:"Vector Illustration"},{id:"vector_illustration/bold_stroke",label:"Bold Stroke"},{id:"vector_illustration/chemistry",label:"Chemistry"},{id:"vector_illustration/colored_stencil",label:"Colored Stencil"},{id:"vector_illustration/contour_pop_art",label:"Contour Pop Art"},{id:"vector_illustration/cosmics",label:"Cosmics"},{id:"vector_illustration/cutout",label:"Cutout"},{id:"vector_illustration/depressive",label:"Depressive"},{id:"vector_illustration/editorial",label:"Editorial"},{id:"vector_illustration/emotional_flat",label:"Emotional Flat"},{id:"vector_illustration/infographical",label:"Infographical"},{id:"vector_illustration/marker_outline",label:"Marker Outline"},{id:"vector_illustration/mosaic",label:"Mosaic"},{id:"vector_illustration/naivector",label:"Naive Vector"},{id:"vector_illustration/roundish_flat",label:"Roundish Flat"},{id:"vector_illustration/segmented_colors",label:"Segmented Colors"},{id:"vector_illustration/sharp_contrast",label:"Sharp Contrast"},{id:"vector_illustration/thin",label:"Thin"},{id:"vector_illustration/vector_photo",label:"Vector Photo"},{id:"vector_illustration/vivid_shapes",label:"Vivid Shapes"},{id:"vector_illustration/engraving",label:"Engraving"},{id:"vector_illustration/line_art",label:"Line Art"},{id:"vector_illustration/line_circuit",label:"Line Circuit"},{id:"vector_illustration/linocut",label:"Linocut"}],Ch=Gt[0],od=e=>({realistic_image:`${e}/realistic_image.webp`,digital_illustration:`${e}/digital_illustration.webp`,"realistic_image/b_and_w":`${e}/realistic_image_black_&_white.webp`,"realistic_image/hard_flash":`${e}/realistic_image_hard_flash.webp`,"realistic_image/hdr":`${e}/realistic_image_hdr.webp`,"realistic_image/natural_light":`${e}/realistic_image_natural_light.webp`,"realistic_image/studio_portrait":`${e}/realistic_image_studio_portrait.webp`,"realistic_image/enterprise":`${e}/realistic_image_enterprise.webp`,"realistic_image/motion_blur":`${e}/realistic_image_motion_blur.webp`,"digital_illustration/pixel_art":`${e}/digital_illustration_pixel_art.webp`,"digital_illustration/hand_drawn":`${e}/digital_illustration_hand_drawn.webp`,"digital_illustration/grain":`${e}/digital_illustration_grain.webp`,"digital_illustration/infantile_sketch":`${e}/digital_illustration_infantile_sketch.webp`,"digital_illustration/2d_art_poster":`${e}/digital_illustration_2d_art_poster.webp`,"digital_illustration/handmade_3d":`${e}/digital_illustration_handmade_3d.webp`,"digital_illustration/hand_drawn_outline":`${e}/digital_illustration_handdrawn_outline.webp`,"digital_illustration/engraving_color":`${e}/digital_illustration_engraving_color.webp`,"digital_illustration/2d_art_poster_2":`${e}/digital_illustration_2d_artposter_2.webp`,vector_illustration:`${e}/vector_illustration.svg`,"vector_illustration/bold_stroke":`${e}/vector_illustration_bold_stroke.svg`,"vector_illustration/chemistry":`${e}/vector_illustration_chemistry.svg`,"vector_illustration/colored_stencil":`${e}/vector_illustration_colored_stencil.svg`,"vector_illustration/contour_pop_art":`${e}/vector_illustration_contour_pop_art.svg`,"vector_illustration/cosmics":`${e}/vector_illustration_cosmics.svg`,"vector_illustration/cutout":`${e}/vector_illustration_cutout.svg`,"vector_illustration/depressive":`${e}/vector_illustration_depressive.svg`,"vector_illustration/editorial":`${e}/vector_illustration_editorial.svg`,"vector_illustration/emotional_flat":`${e}/vector_illustration_emotional_flat.svg`,"vector_illustration/infographical":`${e}/vector_illustration_infographical.svg`,"vector_illustration/marker_outline":`${e}/vector_illustration_marker_outline.svg`,"vector_illustration/mosaic":`${e}/vector_illustration_mosaic.svg`,"vector_illustration/naivector":`${e}/vector_illustration_naivector.svg`,"vector_illustration/roundish_flat":`${e}/vector_illustration_roundish_flat.svg`,"vector_illustration/segmented_colors":`${e}/vector_illustration_segmented_colors.svg`,"vector_illustration/sharp_contrast":`${e}/vector_illustration_sharp_contrast.svg`,"vector_illustration/thin":`${e}/vector_illustration_thin.svg`,"vector_illustration/vector_photo":`${e}/vector_illustration_vector_photo.svg`,"vector_illustration/vivid_shapes":`${e}/vector_illustration_vivid_shapes.svg`,"vector_illustration/engraving":`${e}/vector_illustration_engraving.svg`,"vector_illustration/line_art":`${e}/vector_illustration_line_art.svg`,"vector_illustration/line_circuit":`${e}/vector_illustration_line_circuit.svg`,"vector_illustration/linocut":`${e}/vector_illustration_linocut.svg`,"realistic_image/evening_light":`${e}/realistic_image_evening_light.webp`,"realistic_image/faded_nostalgia":`${e}/realistic_image_faded_nostalgia.webp`,"realistic_image/forest_life":`${e}/realistic_image_forest_life.webp`,"realistic_image/mystic_naturalism":`${e}/realistic_image_mystic_naturalism.webp`,"realistic_image/natural_tones":`${e}/realistic_image_natural_tones.webp`,"realistic_image/organic_calm":`${e}/realistic_image_organic_calm.webp`,"realistic_image/real_life_glow":`${e}/realistic_image_real_life_glow.webp`,"realistic_image/retro_realism":`${e}/realistic_image_retro_realism.webp`,"realistic_image/retro_snapshot":`${e}/realistic_image_retro_snapshot.webp`,"realistic_image/urban_drama":`${e}/realistic_image_urban_drama.webp`,"realistic_image/village_realism":`${e}/realistic_image_village_realism.webp`,"realistic_image/warm_folk":`${e}/realistic_image_warm_folk.webp`,"digital_illustration/antiquarian":`${e}/digital_illustration_antiquarian.webp`,"digital_illustration/bold_fantasy":`${e}/digital_illustration_bold_fantasy.webp`,"digital_illustration/child_book":`${e}/digital_illustration_child_book.webp`,"digital_illustration/child_books":`${e}/digital_illustration_child_books.webp`,"digital_illustration/cover":`${e}/digital_illustration_cover.webp`,"digital_illustration/crosshatch":`${e}/digital_illustration_crosshatch.webp`,"digital_illustration/digital_engraving":`${e}/digital_illustration_digital_engraving.webp`,"digital_illustration/expressionism":`${e}/digital_illustration_expressionism.webp`,"digital_illustration/freehand_details":`${e}/digital_illustration_freehand_details.webp`,"digital_illustration/grain_20":`${e}/digital_illustration_grain_20.webp`,"digital_illustration/graphic_intensity":`${e}/digital_illustration_graphic_intensity.webp`,"digital_illustration/hard_comics":`${e}/digital_illustration_hard_comics.webp`,"digital_illustration/long_shadow":`${e}/digital_illustration_long_shadow.webp`,"digital_illustration/modern_folk":`${e}/digital_illustration_modern_folk.webp`,"digital_illustration/multicolor":`${e}/digital_illustration_multicolor.webp`,"digital_illustration/neon_calm":`${e}/digital_illustration_neon_calm.webp`,"digital_illustration/noir":`${e}/digital_illustration_noir.webp`,"digital_illustration/nostalgic_pastel":`${e}/digital_illustration_nostalgic_pastel.webp`,"digital_illustration/outline_details":`${e}/digital_illustration_outline_details.webp`,"digital_illustration/pastel_gradient":`${e}/digital_illustration_pastel_gradient.webp`,"digital_illustration/pastel_sketch":`${e}/digital_illustration_pastel_sketch.webp`,"digital_illustration/pop_art":`${e}/digital_illustration_pop_art.webp`,"digital_illustration/pop_renaissance":`${e}/digital_illustration_pop_renaissance.webp`,"digital_illustration/street_art":`${e}/digital_illustration_street_art.webp`,"digital_illustration/tablet_sketch":`${e}/digital_illustration_tablet_sketch.webp`,"digital_illustration/urban_glow":`${e}/digital_illustration_urban_glow.webp`,"digital_illustration/urban_sketching":`${e}/digital_illustration_urban_sketching.webp`,"digital_illustration/vanilla_dreams":`${e}/digital_illustration_vanilla_dreams.webp`,"digital_illustration/young_adult_book":`${e}/digital_illustration_young_adult_book.webp`,"digital_illustration/young_adult_book_2":`${e}/digital_illustration_young_adult_book_2.webp`});function Qt(e,t){return od(`${t}thumbnails/`)[e]}var Mi=ji(Ci());var Ai=ji(Ci());function xt(e){return e!=null&&typeof e!="string"&&"width"in e&&"height"in e}async function Gn(e,t){if(e!=null){if(e.startsWith("blob:")){let i=t!=null?await t.engine.editor.getMimeType(e):"image/png",n=await(await fetch(e)).blob(),o=new File([n],`image.${Pt(i)}`,{type:i});return Ai.fal.storage.upload(o)}if(t!=null&&e.startsWith("buffer:")){let i=await t.engine.editor.getMimeType(e),r=t.engine.editor.getBufferLength(e),n=t.engine.editor.getBufferData(e,0,r),o=new File([n],`image.${Pt(i)}`,{type:i});return Ai.fal.storage.upload(o)}return e}}function Og(e,t){let i=e.middleware??[];t.debug&&i.unshift(yr());let r={id:e.modelKey,kind:"image",name:e.name,initialize:async n=>{Mi.fal.config({proxyUrl:t.proxyUrl}),e.initialize?.(n)},input:{quickActions:{actions:e.quickActions??[]},panel:{type:"schema",document:e.schema,inputReference:e.inputReference,includeHistoryLibrary:!0,orderExtensionKeyword:"x-fal-order-properties",renderCustomProperty:{...e.cesdk!=null?kr.ImageUrl(e.modelKey,{cesdk:e.cesdk}):{},...e.renderCustomProperty},getBlockInput:n=>{if(e.getBlockInput!=null)return e.getBlockInput(n);if(e.getImageSize!=null){let{width:o,height:a}=e.getImageSize(n);return Promise.resolve({image:{width:o,height:a}})}if(n.image_size!=null&&xt(n.image_size))return Promise.resolve({image:{width:n.image_size.width??512,height:n.image_size.height??512}});if(n.image_size!=null&&typeof n.image_size=="string"){let o=Xe(n.image_size);return Promise.resolve({image:o})}throw new Error("getBlockInput or getImageSize must be provided")},userFlow:e.useFlow??"placeholder"}},output:{abortable:!0,middleware:i,history:"@imgly/indexedDB",generate:async(n,{abortSignal:o})=>{let a=await Gn(n.image_url,e.cesdk),s=await Mi.fal.subscribe(e.modelKey,{abortSignal:o,input:a!=null?{...n,image_url:a}:n,logs:!0}),l=s?.data?.images;if(l!=null&&Array.isArray(l)){let u=l[0]?.url;if(u!=null)return{kind:"image",url:u}}else{let c=s?.data?.image;if(c!=null){let u=c?.url;if(u!=null)return{kind:"image",url:u}}}throw console.error("Cannot extract generated image from response:",s),new Error("Cannot find generated image")}}};return t.debug&&console.log("Created Provider:",r),r}var Et=Og;var qe,Ve;function Qn(e){return async({cesdk:t})=>jg(t,e)}function jg(e,t){let i="fal-ai/recraft-v3",r=`${i}/styles/image`,n=`${i}/styles/vector`,o=t.baseURL??"https://cdn.img.ly/assets/plugins/plugin-ai-image-generation-web/v1/recraft-v3/";return e.ui.addIconSet("@imgly/plugin/formats",tr.Formats),qe=new Ot(r,Ht.map(({id:a,label:s})=>({id:a,label:s,thumbUri:Qt(a,o)}))),Ve=new Ot(n,Gt.map(({id:a,label:s})=>({id:a,label:s,thumbUri:Qt(a,o)}))),qe.setAssetActive("realistic_image"),Ve.setAssetActive("vector_illustration"),e.engine.asset.addSource(qe),e.engine.asset.addSource(Ve),e.ui.addAssetLibraryEntry({id:r,sourceIds:[r],gridItemHeight:"square",gridBackgroundType:"cover",cardLabel:({label:a})=>a,cardLabelPosition:()=>"below"}),e.ui.addAssetLibraryEntry({id:n,sourceIds:[n],gridItemHeight:"square",gridBackgroundType:"cover",cardLabel:({label:a})=>a,cardLabelPosition:()=>"below"}),e.ui.registerPanel(`${Me(i)}.styleSelection`,({builder:a,payload:s})=>{if(s==null)return null;let l=s.generationType==="image"?[r]:[n];a.Library(`${i}.library.style`,{entries:l,onSelect:async c=>{s.onSelect(c)}})}),e.i18n.setTranslations({en:{[`panel.${Me("fal-ai/recraft-v3")}.styleSelection`]:"Style Selection",[`${i}.style`]:"Style",[`${i}.style.type`]:"Type",[`${i}.style.type.image`]:"Image",[`${i}.style.type.vector`]:"Vector"}}),Et({modelKey:i,schema:Cr,inputReference:"#/components/schemas/RecraftV3Input",middleware:t.middleware??[],userFlow:"placeholder",renderCustomProperty:{style:({builder:a,state:s},l)=>{let c=s("type","image"),u=s("style/image",{id:"realistic_image",label:"Realistic Image"}),d=s("style/vector",{id:"vector_illustration",label:"Vector Illustration"}),h=c.value==="image"?u:d;return a.ButtonGroup(`${l.id}.type`,{inputLabel:`${i}.${l.id}.type`,children:()=>{a.Button(`${l.id}.type.image`,{label:`${i}.${l.id}.type.image`,isActive:c.value==="image",onClick:()=>c.setValue("image")}),a.Button(`${l.id}.type.vector`,{label:`${i}.${l.id}.type.vector`,isActive:c.value==="vector",onClick:()=>c.setValue("vector")})}}),a.Button(`${l.id}`,{inputLabel:`${i}.${l.id}`,icon:"@imgly/Appearance",trailingIcon:"@imgly/ChevronRight",label:h.value.label,labelAlignment:"left",onClick:()=>{let p={generationType:c.value,onSelect:async f=>{if(f.id==="back")return;let b={id:f.id,label:f.label??f.id};c.value==="image"?(qe.clearActiveAssets(),qe.setAssetActive(f.id),u.setValue(b)):c.value==="vector"&&(Ve.clearActiveAssets(),Ve.setAssetActive(f.id),d.setValue(b)),e.ui.closePanel(`${Me(i)}.styleSelection`)}};e.ui.openPanel(`${Me(i)}.styleSelection`,{payload:p})}}),()=>({id:l.id,type:"string",value:h.value.id??"realistic_image"})}},getBlockInput:a=>{if(xt(a.image_size))return Promise.resolve({image:{width:a.image_size.width??512,height:a.image_size.height??512}});let s=Xe(a.image_size??"square_hd");return Promise.resolve({image:s})}},t)}var Kn={openapi:"3.0.0",info:{title:"Fal Queue API",version:"1.0.0",description:"The Fal Queue API."},components:{securitySchemes:{apiKeyAuth:{type:"apiKey",in:"header",name:"Authorization",description:"Fal Key"}},schemas:{QueueStatus:{type:"object",properties:{status:{type:"string",enum:["IN_QUEUE","IN_PROGRESS","COMPLETED"]},request_id:{type:"string",description:"The request id."},response_url:{type:"string",description:"The response url."},status_url:{type:"string",description:"The status url."},cancel_url:{type:"string",description:"The cancel url."},logs:{type:"object",description:"The logs.",additionalProperties:!0},metrics:{type:"object",description:"The metrics.",additionalProperties:!0},queue_position:{type:"integer",description:"The queue position."}},required:["status","request_id"]},GeminiFlashEditInput:{title:"GeminiImageRequest",type:"object",properties:{prompt:{maxLength:5e3,type:"string",title:"Prompt",minLength:3,description:"The prompt for image generation or editing","x-imgly-builder":{component:"TextArea"}},image_url:{title:"Image Url",type:"string",description:"Optional URL of an input image for editing. If not provided, generates a new image."}},"x-fal-order-properties":["image_url","prompt"],required:["prompt","image_url"]},GeminiFlashEditOutput:{title:"GeminiImageOutput",type:"object",properties:{description:{title:"Description",type:"string",description:"Text description or response from Gemini"},image:{description:"The generated or edited image",$ref:"#/components/schemas/Image"}},"x-fal-order-properties":["image","description"],required:["image","description"]},Image:{title:"Image",type:"object",properties:{file_size:{anyOf:[{type:"integer"},{type:"null"}],title:"File Size",description:"The size of the file in bytes."},height:{anyOf:[{type:"integer"},{type:"null"}],title:"Height",description:"The height of the image in pixels."},file_name:{anyOf:[{type:"string"},{type:"null"}],title:"File Name",description:"The name of the file. It will be auto-generated if not provided."},content_type:{anyOf:[{type:"string"},{type:"null"}],title:"Content Type",description:"The mime type of the file."},url:{title:"Url",type:"string",description:"The URL where the file can be downloaded from."},width:{anyOf:[{type:"integer"},{type:"null"}],title:"Width",description:"The width of the image in pixels."}},description:"Represents an image file.","x-fal-order-properties":["url","content_type","file_name","file_size","width","height"],required:["url"]}}},paths:{"/fal-ai/gemini-flash-edit/requests/{request_id}/status":{get:{parameters:[{name:"request_id",in:"path",required:!0,schema:{type:"string",description:"Request ID"}},{name:"logs",in:"query",required:!1,schema:{type:"number",description:"Whether to include logs (`1`) in the response or not (`0`)."}}],responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/gemini-flash-edit/requests/{request_id}/cancel":{put:{parameters:[{name:"request_id",in:"path",required:!0,schema:{type:"string",description:"Request ID"}}],responses:{"200":{description:"The request was cancelled.",content:{"application/json":{schema:{type:"object",properties:{success:{type:"boolean",description:"Whether the request was cancelled successfully."}}}}}}}}},"/fal-ai/gemini-flash-edit":{post:{requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/GeminiFlashEditInput"}}}},responses:{"200":{description:"The request status.",content:{"application/json":{schema:{$ref:"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/gemini-flash-edit/requests/{request_id}":{get:{parameters:[{name:"request_id",in:"path",required:!0,schema:{type:"string",description:"Request ID"}}],responses:{"200":{description:"Result of the request.",content:{"application/json":{schema:{$ref:"#/components/schemas/GeminiFlashEditOutput"}}}}}}}},servers:[{url:"https://queue.fal.run"}],security:[{apiKeyAuth:[]}]};function Wn(e){return e.i18n.setTranslations({en:{"ly.img.ai.inference.change":"Change","ly.img.ai.inference.generate":"Generate","ly.img.ai.inference.create":"Create","ly.img.ai.inference.changeArtStyle":"Change Art Style","ly.img.ai.inference.paintedBy":"Painted By","ly.img.ai.inference.changeImage":"Edit Image...","ly.img.ai.inference.changeImage.prompt.inputLabel":"Change image...","ly.img.ai.inference.changeImage.prompt.placeholder":"Describe what you want to change...","ly.img.ai.inference.createVariant":"Create Variant...","ly.img.ai.inference.createVariant.prompt.inputLabel":"Describe Your Variant","ly.img.ai.inference.createVariant.prompt.placeholder":"e.g., same character with arms raised","ly.img.ai.inference.createVideo":"Create Video..."}}),[Dg(e),Ug(e),Ng(e),Bg(e),Fg(e)]}function $g(){return({engine:e})=>{let t=e.block.findAllSelected();if(t==null||t.length!==1)return!1;let[i]=t;if(e.block.getType(i)!=="//ly.img.ubq/graphic"&&!e.block.supportsFill(i))return!1;let r=e.block.getFill(i);return e.block.getType(r)==="//ly.img.ubq/fill/image"}}function Re(e){return{id:e,version:"1",confirmation:!0,lockDuringConfirmation:!1,enable:$g()}}async function He(e,t){let i,r=t.engine.block.getFill(e),n=t.engine.block.getSourceSet(r,"fill/image/sourceSet"),[o]=n;if(o==null){if(i=t.engine.block.getString(r,"fill/image/imageFileURI"),i==null)throw new Error("No image source/uri found")}else i=o.uri;if(await t.engine.editor.getMimeType(i)==="image/svg+xml")throw new Error("SVG images are not supported");return $t(i,t)}function Dg(e){return{...Re("changeImage"),render:({builder:i},{toggleExpand:r})=>{i.Button("changeImage.button",{label:"ly.img.ai.inference.changeImage",icon:"@imgly/plugin-ai-generation/image",labelAlignment:"left",variant:"plain",onClick:r})},renderExpanded:({builder:i,state:r,experimental:n},{generate:o,toggleExpand:a,handleGenerationError:s})=>{let l=r("changeImage.prompt","");i.TextArea("changeImage.textarea",{inputLabel:"ly.img.ai.inference.changeImage.prompt.inputLabel",placeholder:"ly.img.ai.inference.changeImage.prompt.placeholder",...l}),i.Separator("changeImage.separator"),n.builder.ButtonRow("changeImage.footer",{justifyContent:"space-between",children:()=>{i.Button("changeImage.footer.cancel",{label:"common.back",icon:"@imgly/ChevronLeft",onClick:a}),i.Button("changeImage.footer.apply",{label:"ly.img.ai.inference.change",icon:"@imgly/MagicWand",color:"accent",onClick:async()=>{try{let c=l.value;if(!c)return;let[u]=e.engine.block.findAllSelected(),d=await He(u,e);o({prompt:c,image_url:d,blockId:u}),a()}catch(c){s(c)}}})}})}}}function Ug(e){let t=Re("createVariant");return{...t,confirmation:!1,enable:()=>{if(typeof t.enable=="boolean"&&!t.enable||typeof t.enable=="function"&&!t.enable({engine:e.engine}))return!1;let[i]=e.engine.block.findAllSelected();if(!e.feature.isEnabled("ly.img.duplicate",{engine:e.engine})||!e.engine.block.isAllowedByScope(i,"lifecycle/duplicate"))return!1;let r=e.engine.block.getParent(i);return!(r!=null&&e.engine.block.getType(r)==="//ly.img.ubq/track"&&e.engine.block.isPageDurationSource(r)||e.engine.block.getType(i)==="//ly.img.ubq/page")},render:({builder:i},{toggleExpand:r})=>{i.Button("createVariant.button",{label:"ly.img.ai.inference.createVariant",icon:"@imgly/ImageVariation",labelAlignment:"left",variant:"plain",onClick:r})},renderExpanded:({builder:i,state:r,experimental:n,engine:o},{generate:a,toggleExpand:s,handleGenerationError:l})=>{let c=r("createVariant.prompt","");i.TextArea("createVariant.textarea",{inputLabel:"ly.img.ai.inference.createVariant.prompt.inputLabel",placeholder:"ly.img.ai.inference.createVariant.prompt.placeholder",...c}),i.Separator("createVariant.separator"),n.builder.ButtonRow("createVariant.footer",{justifyContent:"space-between",children:()=>{i.Button("createVariant.footer.cancel",{label:"common.back",icon:"@imgly/ChevronLeft",onClick:s}),i.Button("createVariant.footer.apply",{label:"ly.img.ai.inference.create",icon:"@imgly/MagicWand",color:"accent",onClick:async()=>{try{let u=c.value;if(!u)return;let[d]=o.block.findAllSelected(),h=o.block.duplicate(d);o.block.setSelected(d,!1),o.block.setSelected(h,!0);let p=o.block.getParent(h);if(p==null)throw new Error("Parent not found");let f=1,b=o.block.getWidth(p),_=o.block.getHeight(p),g=.02*Math.min(b,_)*f;o.block.setPositionX(h,o.block.getPositionX(h)+g),o.block.setPositionY(h,o.block.getPositionY(h)+g);let m=await He(h,e);a({prompt:u,image_url:m,blockId:h},{blockIds:[h]}),s()}catch(u){l(u)}}})}})}}}function Ng(e){return{...Re("createVideo"),render:({builder:i},{closeMenu:r,handleGenerationError:n})=>{i.Button("createVideo.button",{label:"ly.img.ai.inference.createVideo",icon:"@imgly/plugin-ai-generation/video",labelAlignment:"left",variant:"plain",onClick:async()=>{try{let[o]=e.engine.block.findAllSelected(),a=await He(o,e);e.ui.openPanel("ly.img.ai/video-generation"),e.ui.experimental.setGlobalStateValue("ly.img.ai.video-generation.fromType","fromImage"),e.ui.experimental.setGlobalStateValue("fal-ai/minimax/video-01-live/image-to-video.image_url",a),r()}catch(o){n(o)}}})}}}function Bg(e){let t=Re("styleTransfer"),i=[{id:"water",label:"Watercolor Painting",prompt:"Convert to watercolor painting."},{id:"oil",label:"Oil Painting",prompt:"Render in oil painting style."},{id:"charcoal",label:"Charcoal Sketch",prompt:"Transform into a charcoal sketch."},{id:"pencil",label:"Pencil Drawing",prompt:"Apply pencil drawing effect."},{id:"pastel",label:"Pastel Artwork",prompt:"Make it look like a pastel artwork."},{id:"ink",label:"Ink Wash",prompt:"Turn into a classic ink wash painting."},{id:"stained-glass",label:"Stained Glass Window",prompt:"Stylize as a stained glass window."},{id:"japanse",label:"Japanese Woodblock Print",prompt:"Repaint as a traditional Japanese woodblock print."}];return{...t,render:({builder:r,experimental:n},{generate:o,closeMenu:a,handleGenerationError:s})=>{n.builder.Popover("styleTransfer.popover",{label:"ly.img.ai.inference.changeArtStyle",icon:"@imgly/Appearance",labelAlignment:"left",variant:"plain",trailingIcon:"@imgly/ChevronRight",placement:"right",children:()=>{r.Section("styleTransfer.popover.section",{children:()=>{n.builder.Menu("styleTransfer.popover.menu",{children:()=>{i.forEach(l=>{r.Button(`styleTransfer.popover.menu.${l.id}`,{label:l.label,labelAlignment:"left",variant:"plain",onClick:async()=>{try{a();let[c]=e.engine.block.findAllSelected(),u=await He(c,e);o({prompt:l.prompt,image_url:u,blockId:c})}catch(c){s(c)}}})})}})}})}})}}}function Fg(e){let t=Re("artists"),i=[{id:"van-gogh",label:"Van Gogh",prompt:"Render this image in the style of Vincent van Gogh, using expressive brushstrokes and swirling motion."},{id:"monet",label:"Monet",prompt:"Transform this image into the soft, impressionistic style of Claude Monet with natural light and delicate color blending."},{id:"picasso",label:"Picasso",prompt:"Apply a Pablo Picasso cubist style with abstract geometry and fragmented shapes."},{id:"dali",label:"Dal\xED",prompt:"Make this image resemble Salvador Dal\xED's surrealist style, with dreamlike distortion and soft shadows."},{id:"matisse",label:"Matisse",prompt:"Stylize the image using Henri Matisse's bold colors and simplified, flowing shapes."},{id:"warhol",label:"Warhol",prompt:"Convert this image into Andy Warhol's pop art style with flat colors, repetition, and bold outlines."},{id:"michelangelo",label:"Michelangelo",prompt:"Render the image in the classical Renaissance style of Michelangelo, with dramatic anatomy and fresco-like detail."},{id:"da-vinci",label:"Da Vinci",prompt:"Make this image look like a Leonardo da Vinci painting, using soft transitions, balanced composition, and natural tones."},{id:"rembrandt",label:"Rembrandt",prompt:"Apply Rembrandt's style with rich contrast, warm tones, and dramatic use of light and shadow."},{id:"mon-drain",label:"Mondrian",prompt:"Transform the image into Piet Mondrian's abstract geometric style with grids and primary colors."},{id:"khalo",label:"Frida Kahlo",prompt:"Stylize this image in the expressive, symbolic style of Frida Kahlo with vivid colors and surreal framing."},{id:"hokusai",label:"Hokusai",prompt:"Render the image in the style of Hokusai, using bold outlines, flat color, and traditional Japanese woodblock aesthetics."}];return{...t,render:({builder:r,experimental:n},{generate:o,closeMenu:a,handleGenerationError:s})=>{n.builder.Popover("artists.popover",{label:"ly.img.ai.inference.paintedBy",icon:"@imgly/MixingPlate",labelAlignment:"left",variant:"plain",trailingIcon:"@imgly/ChevronRight",placement:"right",children:()=>{r.Section("artists.popover.section",{children:()=>{n.builder.Menu("artists.popover.menu",{children:()=>{i.forEach(l=>{r.Button(`artists.popover.menu.${l.id}`,{label:l.label,labelAlignment:"left",variant:"plain",onClick:async()=>{try{a();let[c]=e.engine.block.findAllSelected(),u=await He(c,e);o({prompt:l.prompt,image_url:u,blockId:c})}catch(c){s(c)}}})})}})}})}})}}}function Yn(e){return async({cesdk:t})=>Lg(t,e)}function Lg(e,t){let i="fal-ai/gemini-flash-edit",r=Wn(e),n=Sr(e,"image");return n.setQuickActionMenuOrder([...n.getQuickActionMenuOrder(),"ly.img.separator","styleTransfer","artists","ly.img.separator","changeImage","createVariant","ly.img.separator","createVideo"]),Et({modelKey:i,name:"Change Image",schema:Kn,inputReference:"#/components/schemas/GeminiFlashEditInput",cesdk:e,quickActions:r,middleware:t.middleware,getBlockInput:async o=>{let{width:a,height:s}=await er(o.image_url,e);return Promise.resolve({image:{width:a,height:s}})}},t)}var zg={RecraftV3:Qn,GeminiFlashEdit:Yn},qf=zg;export{qf as default};
|
|
133
133
|
/*! Bundled license information:
|
|
134
134
|
|
|
135
135
|
@imgly/plugin-utils/dist/index.mjs:
|