@animaapp/anima-sdk-react 0.6.3 → 0.6.4
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/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
`;break;case"id":o=y.includes("\0")?void 0:y;break;case"retry":/^\d+$/.test(y)?s(parseInt(y,10)):n(new ar(`Invalid \`retry\` value: "${y}"`,{type:"invalid-retry",value:y,line:m}));break;default:n(new ar(`Unknown field "${l.length>20?`${l.slice(0,20)}…`:l}"`,{type:"unknown-field",field:l,value:y,line:m}));break}}function v(){c.length>0&&e({id:o,event:u||void 0,data:c.endsWith(`
|
|
3
3
|
`)?c.slice(0,-1):c}),o=void 0,c="",u=""}function b(l={}){a&&l.consume&&p(a),i=!0,o=void 0,c="",u="",a=""}return{feed:h,reset:b}}function Ro(t){const e=[];let n="",s=0;for(;s<t.length;){const r=t.indexOf("\r",s),a=t.indexOf(`
|
|
4
4
|
`,s);let i=-1;if(r!==-1&&a!==-1?i=Math.min(r,a):r!==-1?i=r:a!==-1&&(i=a),i===-1){n=t.slice(s);break}else{const o=t.slice(s,i);e.push(o),s=i+1,t[s-1]==="\r"&&t[s]===`
|
|
5
|
-
`&&s++}}return[e,n]}class ir extends Event{constructor(e,n){var s,r;super(e),this.code=(s=n==null?void 0:n.code)!=null?s:void 0,this.message=(r=n==null?void 0:n.message)!=null?r:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,n,s){return s(or(this),n)}[Symbol.for("Deno.customInspect")](e,n){return e(or(this),n)}}function Po(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function ss(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(ss).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${ss(t.cause)}`:t.message:`${t}`}function or(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var Lr=t=>{throw TypeError(t)},As=(t,e,n)=>e.has(t)||Lr("Cannot "+n),C=(t,e,n)=>(As(t,e,"read from private field"),n?n.call(t):e.get(t)),q=(t,e,n)=>e.has(t)?Lr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),$=(t,e,n,s)=>(As(t,e,"write to private field"),e.set(t,n),n),Ne=(t,e,n)=>(As(t,e,"access private method"),n),re,Je,ut,on,gn,Nt,ft,Rt,Me,dt,pt,lt,Ct,pe,rs,as,is,cr,os,cs,At,us,ds;class cn extends EventTarget{constructor(e,n){var s,r;super(),q(this,pe),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,q(this,re),q(this,Je),q(this,ut),q(this,on),q(this,gn),q(this,Nt),q(this,ft),q(this,Rt,null),q(this,Me),q(this,dt),q(this,pt,null),q(this,lt,null),q(this,Ct,null),q(this,as,a=>je(this,null,function*(){var i;C(this,dt).reset();const{body:o,redirected:c,status:u,headers:h}=a;if(u===204){Ne(this,pe,At).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?$(this,ut,new URL(a.url)):$(this,ut,void 0),u!==200){Ne(this,pe,At).call(this,`Non-200 status code (${u})`,u);return}if(!(h.get("content-type")||"").startsWith("text/event-stream")){Ne(this,pe,At).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(C(this,re)===this.CLOSED)return;$(this,re,this.OPEN);const p=new Event("open");if((i=C(this,Ct))==null||i.call(this,p),this.dispatchEvent(p),typeof o!="object"||!o||!("getReader"in o)){Ne(this,pe,At).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}const k=new TextDecoder,v=o.getReader();let b=!0;do{const{done:l,value:y}=yield v.read();y&&C(this,dt).feed(k.decode(y,{stream:!l})),l&&(b=!1,C(this,dt).reset(),Ne(this,pe,us).call(this))}while(b)})),q(this,is,a=>{$(this,Me,void 0),!(a.name==="AbortError"||a.type==="aborted")&&Ne(this,pe,us).call(this,ss(a))}),q(this,os,a=>{typeof a.id=="string"&&$(this,Rt,a.id);const i=new MessageEvent(a.event||"message",{data:a.data,origin:C(this,ut)?C(this,ut).origin:C(this,Je).origin,lastEventId:a.id||""});C(this,lt)&&(!a.event||a.event==="message")&&C(this,lt).call(this,i),this.dispatchEvent(i)}),q(this,cs,a=>{$(this,Nt,a)}),q(this,ds,()=>{$(this,ft,void 0),C(this,re)===this.CONNECTING&&Ne(this,pe,rs).call(this)});try{if(e instanceof URL)$(this,Je,e);else if(typeof e=="string")$(this,Je,new URL(e,Io()));else throw new Error("Invalid URL")}catch(a){throw Po("An invalid or illegal string was specified")}$(this,dt,No({onEvent:C(this,os),onRetry:C(this,cs)})),$(this,re,this.CONNECTING),$(this,Nt,3e3),$(this,gn,(s=n==null?void 0:n.fetch)!=null?s:globalThis.fetch),$(this,on,(r=n==null?void 0:n.withCredentials)!=null?r:!1),Ne(this,pe,rs).call(this)}get readyState(){return C(this,re)}get url(){return C(this,Je).href}get withCredentials(){return C(this,on)}get onerror(){return C(this,pt)}set onerror(e){$(this,pt,e)}get onmessage(){return C(this,lt)}set onmessage(e){$(this,lt,e)}get onopen(){return C(this,Ct)}set onopen(e){$(this,Ct,e)}addEventListener(e,n,s){const r=n;super.addEventListener(e,r,s)}removeEventListener(e,n,s){const r=n;super.removeEventListener(e,r,s)}close(){C(this,ft)&&clearTimeout(C(this,ft)),C(this,re)!==this.CLOSED&&(C(this,Me)&&C(this,Me).abort(),$(this,re,this.CLOSED),$(this,Me,void 0))}}re=new WeakMap,Je=new WeakMap,ut=new WeakMap,on=new WeakMap,gn=new WeakMap,Nt=new WeakMap,ft=new WeakMap,Rt=new WeakMap,Me=new WeakMap,dt=new WeakMap,pt=new WeakMap,lt=new WeakMap,Ct=new WeakMap,pe=new WeakSet,rs=function(){$(this,re,this.CONNECTING),$(this,Me,new AbortController),C(this,gn)(C(this,Je),Ne(this,pe,cr).call(this)).then(C(this,as)).catch(C(this,is))},as=new WeakMap,is=new WeakMap,cr=function(){var t;const e={mode:"cors",redirect:"follow",headers:Ke({Accept:"text/event-stream"},C(this,Rt)?{"Last-Event-ID":C(this,Rt)}:void 0),cache:"no-store",signal:(t=C(this,Me))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},os=new WeakMap,cs=new WeakMap,At=function(t,e){var n;C(this,re)!==this.CLOSED&&$(this,re,this.CLOSED);const s=new ir("error",{code:e,message:t});(n=C(this,pt))==null||n.call(this,s),this.dispatchEvent(s)},us=function(t,e){var n;if(C(this,re)===this.CLOSED)return;$(this,re,this.CONNECTING);const s=new ir("error",{code:e,message:t});(n=C(this,pt))==null||n.call(this,s),this.dispatchEvent(s),$(this,ft,setTimeout(C(this,ds),C(this,Nt)))},ds=new WeakMap,cn.CONNECTING=0,cn.OPEN=1,cn.CLOSED=2;function Io(){const t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}var Fr=Symbol.for("immer-nothing"),ur=Symbol.for("immer-draftable"),ce=Symbol.for("immer-state"),jo=process.env.NODE_ENV!=="production"?[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}]:[];function ae(t,...e){if(process.env.NODE_ENV!=="production"){const n=jo[t],s=typeof n=="function"?n.apply(null,e):n;throw new Error(`[Immer] ${s}`)}throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var _t=Object.getPrototypeOf;function bt(t){return!!t&&!!t[ce]}function tt(t){var e;return t?$r(t)||Array.isArray(t)||!!t[ur]||!!((e=t.constructor)!=null&&e[ur])||En(t)||xn(t):!1}var Zo=Object.prototype.constructor.toString();function $r(t){if(!t||typeof t!="object")return!1;const e=_t(t);if(e===null)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===Zo}function vn(t,e){kn(t)===0?Reflect.ownKeys(t).forEach(n=>{e(n,t[n],t)}):t.forEach((n,s)=>e(s,n,t))}function kn(t){const e=t[ce];return e?e.type_:Array.isArray(t)?1:En(t)?2:xn(t)?3:0}function ls(t,e){return kn(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Wr(t,e,n){const s=kn(t);s===2?t.set(e,n):s===3?t.add(n):t[e]=n}function Do(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function En(t){return t instanceof Map}function xn(t){return t instanceof Set}function qe(t){return t.copy_||t.base_}function fs(t,e){if(En(t))return new Map(t);if(xn(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=$r(t);if(e===!0||e==="class_only"&&!n){const s=Object.getOwnPropertyDescriptors(t);delete s[ce];let r=Reflect.ownKeys(s);for(let a=0;a<r.length;a++){const i=r[a],o=s[i];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(s[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:t[i]})}return Object.create(_t(t),s)}else{const s=_t(t);if(s!==null&&n)return Ke({},t);const r=Object.create(s);return Object.assign(r,t)}}function Bt(t,e=!1){return Sn(t)||bt(t)||!tt(t)||(kn(t)>1&&(t.set=t.add=t.clear=t.delete=Mo),Object.freeze(t),e&&Object.entries(t).forEach(([n,s])=>Bt(s,!0))),t}function Mo(){ae(2)}function Sn(t){return Object.isFrozen(t)}var Lo={};function nt(t){const e=Lo[t];return e||ae(0,t),e}var Kt;function Vr(){return Kt}function Fo(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function dr(t,e){e&&(nt("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function hs(t){ps(t),t.drafts_.forEach($o),t.drafts_=null}function ps(t){t===Kt&&(Kt=t.parent_)}function lr(t){return Kt=Fo(Kt,t)}function $o(t){const e=t[ce];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function fr(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[ce].modified_&&(hs(e),ae(4)),tt(t)&&(t=_n(e,t),e.parent_||bn(e,t)),e.patches_&&nt("Patches").generateReplacementPatches_(n[ce].base_,t,e.patches_,e.inversePatches_)):t=_n(e,n,[]),hs(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==Fr?t:void 0}function _n(t,e,n){if(Sn(e))return e;const s=e[ce];if(!s)return vn(e,(r,a)=>hr(t,s,e,r,a,n)),e;if(s.scope_!==t)return e;if(!s.modified_)return bn(t,s.base_,!0),s.base_;if(!s.finalized_){s.finalized_=!0,s.scope_.unfinalizedDrafts_--;const r=s.copy_;let a=r,i=!1;s.type_===3&&(a=new Set(r),r.clear(),i=!0),vn(a,(o,c)=>hr(t,s,r,o,c,n,i)),bn(t,r,!1),n&&t.patches_&&nt("Patches").generatePatches_(s,n,t.patches_,t.inversePatches_)}return s.copy_}function hr(t,e,n,s,r,a,i){if(process.env.NODE_ENV!=="production"&&r===n&&ae(5),bt(r)){const o=a&&e&&e.type_!==3&&!ls(e.assigned_,s)?a.concat(s):void 0,c=_n(t,r,o);if(Wr(n,s,c),bt(c))t.canAutoFreeze_=!1;else return}else i&&n.add(r);if(tt(r)&&!Sn(r)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;_n(t,r),(!e||!e.scope_.parent_)&&typeof s!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,s)&&bn(t,r)}}function bn(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Bt(e,n)}function Wo(t,e){const n=Array.isArray(t),s={type_:n?1:0,scope_:e?e.scope_:Vr(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=s,a=Ns;n&&(r=[s],a=qt);const{revoke:i,proxy:o}=Proxy.revocable(r,a);return s.draft_=o,s.revoke_=i,o}var Ns={get(t,e){if(e===ce)return t;const n=qe(t);if(!ls(n,e))return Vo(t,n,e);const s=n[e];return t.finalized_||!tt(s)?s:s===jn(t.base_,e)?(Zn(t),t.copy_[e]=ys(s,t)):s},has(t,e){return e in qe(t)},ownKeys(t){return Reflect.ownKeys(qe(t))},set(t,e,n){const s=zr(qe(t),e);if(s!=null&&s.set)return s.set.call(t.draft_,n),!0;if(!t.modified_){const r=jn(qe(t),e),a=r==null?void 0:r[ce];if(a&&a.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(Do(n,r)&&(n!==void 0||ls(t.base_,e)))return!0;Zn(t),ms(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return jn(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,Zn(t),ms(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=qe(t),s=Reflect.getOwnPropertyDescriptor(n,e);return s&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:s.enumerable,value:n[e]}},defineProperty(){ae(11)},getPrototypeOf(t){return _t(t.base_)},setPrototypeOf(){ae(12)}},qt={};vn(Ns,(t,e)=>{qt[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});qt.deleteProperty=function(t,e){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(e))&&ae(13),qt.set.call(this,t,e,void 0)};qt.set=function(t,e,n){return process.env.NODE_ENV!=="production"&&e!=="length"&&isNaN(parseInt(e))&&ae(14),Ns.set.call(this,t[0],e,n,t[0])};function jn(t,e){const n=t[ce];return(n?qe(n):t)[e]}function Vo(t,e,n){var r;const s=zr(e,n);return s?"value"in s?s.value:(r=s.get)==null?void 0:r.call(t.draft_):void 0}function zr(t,e){if(!(e in t))return;let n=_t(t);for(;n;){const s=Object.getOwnPropertyDescriptor(n,e);if(s)return s;n=_t(n)}}function ms(t){t.modified_||(t.modified_=!0,t.parent_&&ms(t.parent_))}function Zn(t){t.copy_||(t.copy_=fs(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var zo=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,n,s)=>{if(typeof e=="function"&&typeof n!="function"){const a=n;n=e;const i=this;return function(c=a,...u){return i.produce(c,h=>n.call(this,h,...u))}}typeof n!="function"&&ae(6),s!==void 0&&typeof s!="function"&&ae(7);let r;if(tt(e)){const a=lr(this),i=ys(e,void 0);let o=!0;try{r=n(i),o=!1}finally{o?hs(a):ps(a)}return dr(a,s),fr(r,a)}else if(!e||typeof e!="object"){if(r=n(e),r===void 0&&(r=e),r===Fr&&(r=void 0),this.autoFreeze_&&Bt(r,!0),s){const a=[],i=[];nt("Patches").generateReplacementPatches_(e,r,a,i),s(a,i)}return r}else ae(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(i,...o)=>this.produceWithPatches(i,c=>e(c,...o));let s,r;return[this.produce(e,n,(i,o)=>{s=i,r=o}),s,r]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){tt(t)||ae(8),bt(t)&&(t=Uo(t));const e=lr(this),n=ys(t,void 0);return n[ce].isManual_=!0,ps(e),n}finishDraft(t,e){const n=t&&t[ce];(!n||!n.isManual_)&&ae(9);const{scope_:s}=n;return dr(s,e),fr(void 0,s)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const r=e[n];if(r.path.length===0&&r.op==="replace"){t=r.value;break}}n>-1&&(e=e.slice(n+1));const s=nt("Patches").applyPatches_;return bt(t)?s(t,e):this.produce(t,r=>s(r,e))}};function ys(t,e){const n=En(t)?nt("MapSet").proxyMap_(t,e):xn(t)?nt("MapSet").proxySet_(t,e):Wo(t,e);return(e?e.scope_:Vr()).drafts_.push(n),n}function Uo(t){return bt(t)||ae(10,t),Ur(t)}function Ur(t){if(!tt(t)||Sn(t))return t;const e=t[ce];let n;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=fs(t,e.scope_.immer_.useStrictShallowCopy_)}else n=fs(t,!0);return vn(n,(s,r)=>{Wr(n,s,Ur(r))}),e&&(e.finalized_=!1),n}var ue=new zo,Bo=ue.produce;ue.produceWithPatches.bind(ue);ue.setAutoFreeze.bind(ue);ue.setUseStrictShallowCopy.bind(ue);ue.applyPatches.bind(ue);ue.createDraft.bind(ue);ue.finishDraft.bind(ue);function Ko(t){var e=V.useState(function(){return Bt(typeof t=="function"?t():t,!0)}),n=e[1];return[e[0],V.useCallback(function(s){n(typeof s=="function"?Bo(s):Bt(s))},[])]}const pr={status:"idle",error:null,result:null,tasks:{fetchDesign:{status:"pending"},codeGeneration:{status:"pending",progress:0},uploadAssets:{status:"pending"}}},mr=t=>"path"in t?{filePath:t.path.replace(/^\//,""),referencePath:t.path==="/"?"":t.path}:{filePath:t.filePath.replace(/^\//,""),referencePath:t.referencePath==="/"?"":t.referencePath},qo=({url:t,method:e="POST"})=>{const[n,s]=Ko(pr);return{getCode:a=>je(exports,null,function*(){var h,p,k;s(v=>{v.status="pending",v.error=null,v.result=null,v.tasks=pr.tasks});const i=structuredClone(a);if(((h=a.assetsStorage)==null?void 0:h.strategy)==="local"){const{referencePath:v}=mr(a.assetsStorage);a.assetsStorage={strategy:"external",url:v}}let o;const c=new cn(t,{fetch:(v,b)=>(o=fetch(v,Us(Ke({},b),{method:e,body:JSON.stringify(a)})),o)}),u=new Promise(v=>{const b={};c.addEventListener("start",l=>{const y=JSON.parse(l.data);b.sessionId=y.sessionId,s(m=>{m.tasks.fetchDesign.status="running"})}),c.addEventListener("pre_codegen",l=>{JSON.parse(l.data).message==="Anima model built"&&s(m=>{m.tasks.fetchDesign.status="finished",m.tasks.codeGeneration.status="running",m.tasks.uploadAssets.status="running"})}),c.addEventListener("figma_metadata",l=>{const y=JSON.parse(l.data);b.figmaFileName=y.figmaFileName,b.figmaSelectedFrameName=y.figmaSelectedFrameName}),c.addEventListener("aborted",()=>{const l=new qs({name:"Aborted",reason:"Unknown"});s(y=>{y.status="aborted",y.result=null,y.error=l}),v({result:null,error:l})}),c.addEventListener("generating_code",l=>{const y=JSON.parse(l.data);y.payload.status==="success"&&(b.files=y.payload.files),s(m=>{m.tasks.codeGeneration.progress=y.payload.progress,m.tasks.codeGeneration.status="running"})}),c.addEventListener("codegen_completed",()=>{s(l=>{l.tasks.codeGeneration.status="finished"})}),c.addEventListener("generation_completed",()=>{s(l=>{l.tasks.codeGeneration.status="finished"})}),c.addEventListener("assets_uploaded",()=>{s(l=>{l.tasks.uploadAssets.status="finished"})}),c.addEventListener("assets_list",l=>{const y=JSON.parse(l.data);b.assets=y.payload.assets}),c.addEventListener("error",l=>je(exports,null,function*(){var W,R;let y;try{l instanceof MessageEvent?y=JSON.parse(l.data):y=yield(yield o).json()}catch(U){}const m=new qs({name:(W=y==null?void 0:y.payload.name)!=null?W:"Unknown error",reason:(R=y==null?void 0:y.payload.message)!=null?R:"Unknown",status:y==null?void 0:y.payload.status,detail:y==null?void 0:y.payload.detail});s(U=>{U.status="error",U.error=m}),v({result:null,error:m})})),c.addEventListener("done",l=>{const y=JSON.parse(l.data);b.tokenUsage=y.payload.tokenUsage,s(m=>{m.status="success",m.result=b}),v({result:b,error:null})})});try{const{result:v,error:b}=yield u,l=structuredClone(v);if(((p=i.assetsStorage)==null?void 0:p.strategy)==="local"&&((k=l==null?void 0:l.assets)!=null&&k.length)){const{filePath:y}=mr(i.assetsStorage),m=l.assets.map(R=>je(exports,null,function*(){const L=yield(yield fetch(R.url)).arrayBuffer();return{assetName:R.name,base64:ca(L)}})),W=yield Promise.allSettled(m);for(const R of W){const U={};if(R.status==="fulfilled"){const{assetName:L,base64:H}=R.value;U[L]=H;const Z=y?`${y}/${L}`:L;l.files[Z]={content:H,isBinary:!0}}}}return b?{result:null,error:b}:{result:l,error:b}}finally{c.close()}}),status:n.status,tasks:n.tasks,error:n.error,result:n.result}};var en={exports:{}},Dn={};/**
|
|
5
|
+
`&&s++}}return[e,n]}class ir extends Event{constructor(e,n){var s,r;super(e),this.code=(s=n==null?void 0:n.code)!=null?s:void 0,this.message=(r=n==null?void 0:n.message)!=null?r:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,n,s){return s(or(this),n)}[Symbol.for("Deno.customInspect")](e,n){return e(or(this),n)}}function Po(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function ss(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(ss).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${ss(t.cause)}`:t.message:`${t}`}function or(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var Lr=t=>{throw TypeError(t)},As=(t,e,n)=>e.has(t)||Lr("Cannot "+n),C=(t,e,n)=>(As(t,e,"read from private field"),n?n.call(t):e.get(t)),q=(t,e,n)=>e.has(t)?Lr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),$=(t,e,n,s)=>(As(t,e,"write to private field"),e.set(t,n),n),Ne=(t,e,n)=>(As(t,e,"access private method"),n),re,Je,ut,on,gn,Nt,ft,Rt,Me,dt,pt,lt,Ct,pe,rs,as,is,cr,os,cs,At,us,ds;class cn extends EventTarget{constructor(e,n){var s,r;super(),q(this,pe),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,q(this,re),q(this,Je),q(this,ut),q(this,on),q(this,gn),q(this,Nt),q(this,ft),q(this,Rt,null),q(this,Me),q(this,dt),q(this,pt,null),q(this,lt,null),q(this,Ct,null),q(this,as,a=>je(this,null,function*(){var i;C(this,dt).reset();const{body:o,redirected:c,status:u,headers:h}=a;if(u===204){Ne(this,pe,At).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?$(this,ut,new URL(a.url)):$(this,ut,void 0),u!==200){Ne(this,pe,At).call(this,`Non-200 status code (${u})`,u);return}if(!(h.get("content-type")||"").startsWith("text/event-stream")){Ne(this,pe,At).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(C(this,re)===this.CLOSED)return;$(this,re,this.OPEN);const p=new Event("open");if((i=C(this,Ct))==null||i.call(this,p),this.dispatchEvent(p),typeof o!="object"||!o||!("getReader"in o)){Ne(this,pe,At).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}const k=new TextDecoder,v=o.getReader();let b=!0;do{const{done:l,value:y}=yield v.read();y&&C(this,dt).feed(k.decode(y,{stream:!l})),l&&(b=!1,C(this,dt).reset(),Ne(this,pe,us).call(this))}while(b)})),q(this,is,a=>{$(this,Me,void 0),!(a.name==="AbortError"||a.type==="aborted")&&Ne(this,pe,us).call(this,ss(a))}),q(this,os,a=>{typeof a.id=="string"&&$(this,Rt,a.id);const i=new MessageEvent(a.event||"message",{data:a.data,origin:C(this,ut)?C(this,ut).origin:C(this,Je).origin,lastEventId:a.id||""});C(this,lt)&&(!a.event||a.event==="message")&&C(this,lt).call(this,i),this.dispatchEvent(i)}),q(this,cs,a=>{$(this,Nt,a)}),q(this,ds,()=>{$(this,ft,void 0),C(this,re)===this.CONNECTING&&Ne(this,pe,rs).call(this)});try{if(e instanceof URL)$(this,Je,e);else if(typeof e=="string")$(this,Je,new URL(e,Io()));else throw new Error("Invalid URL")}catch(a){throw Po("An invalid or illegal string was specified")}$(this,dt,No({onEvent:C(this,os),onRetry:C(this,cs)})),$(this,re,this.CONNECTING),$(this,Nt,3e3),$(this,gn,(s=n==null?void 0:n.fetch)!=null?s:globalThis.fetch),$(this,on,(r=n==null?void 0:n.withCredentials)!=null?r:!1),Ne(this,pe,rs).call(this)}get readyState(){return C(this,re)}get url(){return C(this,Je).href}get withCredentials(){return C(this,on)}get onerror(){return C(this,pt)}set onerror(e){$(this,pt,e)}get onmessage(){return C(this,lt)}set onmessage(e){$(this,lt,e)}get onopen(){return C(this,Ct)}set onopen(e){$(this,Ct,e)}addEventListener(e,n,s){const r=n;super.addEventListener(e,r,s)}removeEventListener(e,n,s){const r=n;super.removeEventListener(e,r,s)}close(){C(this,ft)&&clearTimeout(C(this,ft)),C(this,re)!==this.CLOSED&&(C(this,Me)&&C(this,Me).abort(),$(this,re,this.CLOSED),$(this,Me,void 0))}}re=new WeakMap,Je=new WeakMap,ut=new WeakMap,on=new WeakMap,gn=new WeakMap,Nt=new WeakMap,ft=new WeakMap,Rt=new WeakMap,Me=new WeakMap,dt=new WeakMap,pt=new WeakMap,lt=new WeakMap,Ct=new WeakMap,pe=new WeakSet,rs=function(){$(this,re,this.CONNECTING),$(this,Me,new AbortController),C(this,gn)(C(this,Je),Ne(this,pe,cr).call(this)).then(C(this,as)).catch(C(this,is))},as=new WeakMap,is=new WeakMap,cr=function(){var t;const e={mode:"cors",redirect:"follow",headers:Ke({Accept:"text/event-stream"},C(this,Rt)?{"Last-Event-ID":C(this,Rt)}:void 0),cache:"no-store",signal:(t=C(this,Me))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},os=new WeakMap,cs=new WeakMap,At=function(t,e){var n;C(this,re)!==this.CLOSED&&$(this,re,this.CLOSED);const s=new ir("error",{code:e,message:t});(n=C(this,pt))==null||n.call(this,s),this.dispatchEvent(s)},us=function(t,e){var n;if(C(this,re)===this.CLOSED)return;$(this,re,this.CONNECTING);const s=new ir("error",{code:e,message:t});(n=C(this,pt))==null||n.call(this,s),this.dispatchEvent(s),$(this,ft,setTimeout(C(this,ds),C(this,Nt)))},ds=new WeakMap,cn.CONNECTING=0,cn.OPEN=1,cn.CLOSED=2;function Io(){const t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}var Fr=Symbol.for("immer-nothing"),ur=Symbol.for("immer-draftable"),ce=Symbol.for("immer-state"),jo=process.env.NODE_ENV!=="production"?[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}]:[];function ae(t,...e){if(process.env.NODE_ENV!=="production"){const n=jo[t],s=typeof n=="function"?n.apply(null,e):n;throw new Error(`[Immer] ${s}`)}throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var _t=Object.getPrototypeOf;function bt(t){return!!t&&!!t[ce]}function tt(t){var e;return t?$r(t)||Array.isArray(t)||!!t[ur]||!!((e=t.constructor)!=null&&e[ur])||En(t)||xn(t):!1}var Zo=Object.prototype.constructor.toString();function $r(t){if(!t||typeof t!="object")return!1;const e=_t(t);if(e===null)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===Zo}function vn(t,e){kn(t)===0?Reflect.ownKeys(t).forEach(n=>{e(n,t[n],t)}):t.forEach((n,s)=>e(s,n,t))}function kn(t){const e=t[ce];return e?e.type_:Array.isArray(t)?1:En(t)?2:xn(t)?3:0}function ls(t,e){return kn(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Wr(t,e,n){const s=kn(t);s===2?t.set(e,n):s===3?t.add(n):t[e]=n}function Do(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function En(t){return t instanceof Map}function xn(t){return t instanceof Set}function qe(t){return t.copy_||t.base_}function fs(t,e){if(En(t))return new Map(t);if(xn(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=$r(t);if(e===!0||e==="class_only"&&!n){const s=Object.getOwnPropertyDescriptors(t);delete s[ce];let r=Reflect.ownKeys(s);for(let a=0;a<r.length;a++){const i=r[a],o=s[i];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(s[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:t[i]})}return Object.create(_t(t),s)}else{const s=_t(t);if(s!==null&&n)return Ke({},t);const r=Object.create(s);return Object.assign(r,t)}}function Bt(t,e=!1){return Sn(t)||bt(t)||!tt(t)||(kn(t)>1&&(t.set=t.add=t.clear=t.delete=Mo),Object.freeze(t),e&&Object.entries(t).forEach(([n,s])=>Bt(s,!0))),t}function Mo(){ae(2)}function Sn(t){return Object.isFrozen(t)}var Lo={};function nt(t){const e=Lo[t];return e||ae(0,t),e}var Kt;function Vr(){return Kt}function Fo(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function dr(t,e){e&&(nt("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function hs(t){ps(t),t.drafts_.forEach($o),t.drafts_=null}function ps(t){t===Kt&&(Kt=t.parent_)}function lr(t){return Kt=Fo(Kt,t)}function $o(t){const e=t[ce];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function fr(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[ce].modified_&&(hs(e),ae(4)),tt(t)&&(t=_n(e,t),e.parent_||bn(e,t)),e.patches_&&nt("Patches").generateReplacementPatches_(n[ce].base_,t,e.patches_,e.inversePatches_)):t=_n(e,n,[]),hs(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==Fr?t:void 0}function _n(t,e,n){if(Sn(e))return e;const s=e[ce];if(!s)return vn(e,(r,a)=>hr(t,s,e,r,a,n)),e;if(s.scope_!==t)return e;if(!s.modified_)return bn(t,s.base_,!0),s.base_;if(!s.finalized_){s.finalized_=!0,s.scope_.unfinalizedDrafts_--;const r=s.copy_;let a=r,i=!1;s.type_===3&&(a=new Set(r),r.clear(),i=!0),vn(a,(o,c)=>hr(t,s,r,o,c,n,i)),bn(t,r,!1),n&&t.patches_&&nt("Patches").generatePatches_(s,n,t.patches_,t.inversePatches_)}return s.copy_}function hr(t,e,n,s,r,a,i){if(process.env.NODE_ENV!=="production"&&r===n&&ae(5),bt(r)){const o=a&&e&&e.type_!==3&&!ls(e.assigned_,s)?a.concat(s):void 0,c=_n(t,r,o);if(Wr(n,s,c),bt(c))t.canAutoFreeze_=!1;else return}else i&&n.add(r);if(tt(r)&&!Sn(r)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;_n(t,r),(!e||!e.scope_.parent_)&&typeof s!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,s)&&bn(t,r)}}function bn(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Bt(e,n)}function Wo(t,e){const n=Array.isArray(t),s={type_:n?1:0,scope_:e?e.scope_:Vr(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=s,a=Ns;n&&(r=[s],a=qt);const{revoke:i,proxy:o}=Proxy.revocable(r,a);return s.draft_=o,s.revoke_=i,o}var Ns={get(t,e){if(e===ce)return t;const n=qe(t);if(!ls(n,e))return Vo(t,n,e);const s=n[e];return t.finalized_||!tt(s)?s:s===jn(t.base_,e)?(Zn(t),t.copy_[e]=ys(s,t)):s},has(t,e){return e in qe(t)},ownKeys(t){return Reflect.ownKeys(qe(t))},set(t,e,n){const s=zr(qe(t),e);if(s!=null&&s.set)return s.set.call(t.draft_,n),!0;if(!t.modified_){const r=jn(qe(t),e),a=r==null?void 0:r[ce];if(a&&a.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(Do(n,r)&&(n!==void 0||ls(t.base_,e)))return!0;Zn(t),ms(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return jn(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,Zn(t),ms(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=qe(t),s=Reflect.getOwnPropertyDescriptor(n,e);return s&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:s.enumerable,value:n[e]}},defineProperty(){ae(11)},getPrototypeOf(t){return _t(t.base_)},setPrototypeOf(){ae(12)}},qt={};vn(Ns,(t,e)=>{qt[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});qt.deleteProperty=function(t,e){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(e))&&ae(13),qt.set.call(this,t,e,void 0)};qt.set=function(t,e,n){return process.env.NODE_ENV!=="production"&&e!=="length"&&isNaN(parseInt(e))&&ae(14),Ns.set.call(this,t[0],e,n,t[0])};function jn(t,e){const n=t[ce];return(n?qe(n):t)[e]}function Vo(t,e,n){var r;const s=zr(e,n);return s?"value"in s?s.value:(r=s.get)==null?void 0:r.call(t.draft_):void 0}function zr(t,e){if(!(e in t))return;let n=_t(t);for(;n;){const s=Object.getOwnPropertyDescriptor(n,e);if(s)return s;n=_t(n)}}function ms(t){t.modified_||(t.modified_=!0,t.parent_&&ms(t.parent_))}function Zn(t){t.copy_||(t.copy_=fs(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var zo=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,n,s)=>{if(typeof e=="function"&&typeof n!="function"){const a=n;n=e;const i=this;return function(c=a,...u){return i.produce(c,h=>n.call(this,h,...u))}}typeof n!="function"&&ae(6),s!==void 0&&typeof s!="function"&&ae(7);let r;if(tt(e)){const a=lr(this),i=ys(e,void 0);let o=!0;try{r=n(i),o=!1}finally{o?hs(a):ps(a)}return dr(a,s),fr(r,a)}else if(!e||typeof e!="object"){if(r=n(e),r===void 0&&(r=e),r===Fr&&(r=void 0),this.autoFreeze_&&Bt(r,!0),s){const a=[],i=[];nt("Patches").generateReplacementPatches_(e,r,a,i),s(a,i)}return r}else ae(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(i,...o)=>this.produceWithPatches(i,c=>e(c,...o));let s,r;return[this.produce(e,n,(i,o)=>{s=i,r=o}),s,r]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){tt(t)||ae(8),bt(t)&&(t=Uo(t));const e=lr(this),n=ys(t,void 0);return n[ce].isManual_=!0,ps(e),n}finishDraft(t,e){const n=t&&t[ce];(!n||!n.isManual_)&&ae(9);const{scope_:s}=n;return dr(s,e),fr(void 0,s)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const r=e[n];if(r.path.length===0&&r.op==="replace"){t=r.value;break}}n>-1&&(e=e.slice(n+1));const s=nt("Patches").applyPatches_;return bt(t)?s(t,e):this.produce(t,r=>s(r,e))}};function ys(t,e){const n=En(t)?nt("MapSet").proxyMap_(t,e):xn(t)?nt("MapSet").proxySet_(t,e):Wo(t,e);return(e?e.scope_:Vr()).drafts_.push(n),n}function Uo(t){return bt(t)||ae(10,t),Ur(t)}function Ur(t){if(!tt(t)||Sn(t))return t;const e=t[ce];let n;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=fs(t,e.scope_.immer_.useStrictShallowCopy_)}else n=fs(t,!0);return vn(n,(s,r)=>{Wr(n,s,Ur(r))}),e&&(e.finalized_=!1),n}var ue=new zo,Bo=ue.produce;ue.produceWithPatches.bind(ue);ue.setAutoFreeze.bind(ue);ue.setUseStrictShallowCopy.bind(ue);ue.applyPatches.bind(ue);ue.createDraft.bind(ue);ue.finishDraft.bind(ue);function Ko(t){var e=V.useState(function(){return Bt(typeof t=="function"?t():t,!0)}),n=e[1];return[e[0],V.useCallback(function(s){n(typeof s=="function"?Bo(s):Bt(s))},[])]}const pr={status:"idle",error:null,result:null,tasks:{fetchDesign:{status:"pending"},codeGeneration:{status:"pending",progress:0},uploadAssets:{status:"pending"}}},mr=t=>"path"in t?{filePath:t.path.replace(/^\//,""),referencePath:t.path==="/"?"":t.path}:{filePath:t.filePath.replace(/^\//,""),referencePath:t.referencePath==="/"?"":t.referencePath},qo=({url:t,method:e="POST"})=>{const[n,s]=Ko(pr);return{getCode:a=>je(exports,null,function*(){var h,p,k;s(v=>{v.status="pending",v.error=null,v.result=null,v.tasks=pr.tasks});const i=structuredClone(a);if(((h=a.assetsStorage)==null?void 0:h.strategy)==="local"){const{referencePath:v}=mr(a.assetsStorage);a.assetsStorage={strategy:"external",url:v}}let o;const c=new cn(t,{fetch:(v,b)=>(o=fetch(v,Us(Ke({},b),{method:e,body:JSON.stringify(a)})),o)}),u=new Promise(v=>{const b={};c.addEventListener("start",l=>{const y=JSON.parse(l.data);b.sessionId=y.sessionId,s(m=>{m.tasks.fetchDesign.status="running"})}),c.addEventListener("pre_codegen",l=>{JSON.parse(l.data).message==="Anima model built"&&s(m=>{m.tasks.fetchDesign.status="finished",m.tasks.codeGeneration.status="running",m.tasks.uploadAssets.status="running"})}),c.addEventListener("figma_metadata",l=>{const y=JSON.parse(l.data);b.figmaFileName=y.figmaFileName,b.figmaSelectedFrameName=y.figmaSelectedFrameName}),c.addEventListener("aborted",()=>{const l=new qs({name:"Aborted",reason:"Unknown"});s(y=>{y.status="aborted",y.result=null,y.error=l}),v({result:null,error:l})}),c.addEventListener("generating_code",l=>{const y=JSON.parse(l.data);y.payload.status==="success"&&(b.files=y.payload.files),s(m=>{m.tasks.codeGeneration.progress=y.payload.progress,m.tasks.codeGeneration.status="running"})}),c.addEventListener("codegen_completed",()=>{s(l=>{l.tasks.codeGeneration.status="finished"})}),c.addEventListener("generation_completed",()=>{s(l=>{l.tasks.codeGeneration.status="finished"})}),c.addEventListener("assets_uploaded",()=>{s(l=>{l.tasks.uploadAssets.status="finished"})}),c.addEventListener("assets_list",l=>{const y=JSON.parse(l.data);b.assets=y.payload.assets}),c.addEventListener("error",l=>je(exports,null,function*(){var W,R;let y;try{l instanceof MessageEvent?y=JSON.parse(l.data):y=yield(yield o).json()}catch(U){}const m=new qs({name:(W=y==null?void 0:y.payload.name)!=null?W:"Unknown error",reason:(R=y==null?void 0:y.payload.message)!=null?R:"Unknown",status:y==null?void 0:y.payload.status,detail:y==null?void 0:y.payload.detail});s(U=>{U.status="error",U.error=m}),v({result:null,error:m})})),c.addEventListener("done",l=>{const y=JSON.parse(l.data);b.tokenUsage=y.payload.tokenUsage,b.sessionId=y.payload.sessionId,s(m=>{m.status="success",m.result=b}),v({result:b,error:null})})});try{const{result:v,error:b}=yield u,l=structuredClone(v);if(((p=i.assetsStorage)==null?void 0:p.strategy)==="local"&&((k=l==null?void 0:l.assets)!=null&&k.length)){const{filePath:y}=mr(i.assetsStorage),m=l.assets.map(R=>je(exports,null,function*(){const L=yield(yield fetch(R.url)).arrayBuffer();return{assetName:R.name,base64:ca(L)}})),W=yield Promise.allSettled(m);for(const R of W){const U={};if(R.status==="fulfilled"){const{assetName:L,base64:H}=R.value;U[L]=H;const Z=y?`${y}/${L}`:L;l.files[Z]={content:H,isBinary:!0}}}}return b?{result:null,error:b}:{result:l,error:b}}finally{c.close()}}),status:n.status,tasks:n.tasks,error:n.error,result:n.result}};var en={exports:{}},Dn={};/**
|
|
6
6
|
* @license React
|
|
7
7
|
* use-sync-external-store-shim.production.js
|
|
8
8
|
*
|