ima2-gen 3.8.2 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/bin/commands/gen.js +10 -0
  2. package/docs/migration/runtime-test-inventory.md +5 -1
  3. package/lib/alphaDecode.js +18 -0
  4. package/lib/atlasCloudImageAdapter.js +6 -1
  5. package/lib/backgroundPresets.js +28 -1
  6. package/lib/generatePipeline.js +74 -5
  7. package/lib/imageBackgroundParam.js +108 -0
  8. package/lib/promptImport/gptImageHints.js +4 -1
  9. package/lib/responsesFallback.js +8 -2
  10. package/lib/responsesImageAdapter.js +10 -1
  11. package/package.json +2 -2
  12. package/routes/video.js +7 -0
  13. package/skills/ima2/SKILL.md +28 -4
  14. package/skills/ima2-front/references/asset-requirements.md +23 -8
  15. package/skills/ima2-uiux/SKILL.md +15 -4
  16. package/ui/dist/.vite/manifest.json +32 -32
  17. package/ui/dist/assets/{AgentWorkspace-bUd5NsQ_.js → AgentWorkspace-fcIXiWV6.js} +1 -1
  18. package/ui/dist/assets/AssetGenWorkspace-CqXyN9at.js +2 -0
  19. package/ui/dist/assets/{AssetsWorkspace-DO_wfFQB.js → AssetsWorkspace-xwHFVOb7.js} +1 -1
  20. package/ui/dist/assets/{CardNewsWorkspace-D3M0w8pg.js → CardNewsWorkspace-ltdjG40R.js} +1 -1
  21. package/ui/dist/assets/{GenerationRequestLogPanel-WvSV0yXP.js → GenerationRequestLogPanel-B68EUfUg.js} +1 -1
  22. package/ui/dist/assets/{HomeWorkspace-BGCBf9iK.js → HomeWorkspace-BBOG_aNm.js} +1 -1
  23. package/ui/dist/assets/KeyingPanel-Bv0n_bhk.js +1 -0
  24. package/ui/dist/assets/{NodeCanvas-DwbR2nol.js → NodeCanvas-VwdctvAW.js} +1 -1
  25. package/ui/dist/assets/{PromptBuilderPanel-KSH3ChjC.js → PromptBuilderPanel-BBMpF_3Q.js} +1 -1
  26. package/ui/dist/assets/{PromptImportDialog-CjHiCEo9.js → PromptImportDialog-D4QYbRfH.js} +2 -2
  27. package/ui/dist/assets/{PromptImportDiscoverySection-CWU-vKyM.js → PromptImportDiscoverySection-Bx7BeTFh.js} +1 -1
  28. package/ui/dist/assets/{PromptImportFolderSection-_zRnJGkJ.js → PromptImportFolderSection-Bwf60URx.js} +1 -1
  29. package/ui/dist/assets/{PromptLibraryPanel-64VN4nml.js → PromptLibraryPanel-mNG2wZkQ.js} +2 -2
  30. package/ui/dist/assets/{SettingsWorkspace-DZMNEpuq.js → SettingsWorkspace-DA5tIa0Q.js} +1 -1
  31. package/ui/dist/assets/{SpriteRecipeWorkspace-Y6GqpVHs.js → SpriteRecipeWorkspace-Da9qTQX0.js} +1 -1
  32. package/ui/dist/assets/{index-CFixfKaC.js → index-Bv1Yrz8W.js} +3 -3
  33. package/ui/dist/assets/{index-waPOg2eb.css → index-C0nfanMr.css} +1 -1
  34. package/ui/dist/assets/{index-XXtoj9ME.js → index-CxEuSZMC.js} +16 -16
  35. package/ui/dist/assets/{pptxgen.es-hCJot2gG.js → pptxgen.es-BE4CSd5F.js} +1 -1
  36. package/ui/dist/assets/{useAgentDialogFocus-PWmMjerz.js → useAgentDialogFocus-R64NV-ZZ.js} +1 -1
  37. package/ui/dist/index.html +2 -2
  38. package/ui/dist/assets/AssetGenWorkspace-8fK-K64E.js +0 -2
  39. package/ui/dist/assets/KeyingPanel-CEBLIhhu.js +0 -1
@@ -1,2 +1,2 @@
1
- import{u,M as l,j as e,N as k,a as h,t as j,s as _}from"./index-XXtoj9ME.js";function C(s){const r=s.slots.filter(n=>n.kind==="text"||n.textKind).length,c=s.slots.filter(n=>n.kind==="image").length;return`${r} text / ${c} image`}function T(){const{t:s}=u(),r=l(t=>t.templates),c=l(t=>t.imageTemplateId),n=l(t=>t.setImageTemplate);return e.jsxs("section",{className:"card-news-panel",children:[e.jsxs("div",{className:"card-news-panel__head",children:[e.jsx("span",{children:s("cardNews.imageTemplate")}),e.jsx("button",{type:"button",disabled:!0,title:s("cardNews.newTemplateLater"),children:"+"})]}),e.jsx("div",{className:"card-news-template-grid",children:r.map(t=>e.jsxs("button",{type:"button",className:`card-news-template${c===t.id?" selected":""}`,onClick:()=>n(t.id),children:[e.jsx("img",{src:t.previewUrl,alt:""}),e.jsxs("span",{className:"card-news-template__body",children:[e.jsx("span",{className:"card-news-template__name",children:t.name}),e.jsx("span",{className:"card-news-template__meta",children:C(t)}),e.jsx("span",{className:"card-news-template__sizes",children:t.recommendedOutputSizes.join(" · ")})]})]},t.id))})]})}function I(){const{t:s}=u(),r=l(t=>t.roleTemplates),c=l(t=>t.roleTemplateId),n=l(t=>t.setRoleTemplate);return e.jsxs("section",{className:"card-news-panel",children:[e.jsx("div",{className:"card-news-panel__head",children:e.jsx("span",{children:s("cardNews.roleTemplate")})}),e.jsx("div",{className:"card-news-role-row",children:r.map(t=>e.jsx("button",{type:"button",className:c===t.id?"selected":"",onClick:()=>n(t.id),children:t.name},t.id))})]})}function F({status:s,locked:r}){const{t:c}=u(),n=r?"locked":s,t=n==="queued"||n==="generating";return e.jsxs("span",{className:`card-news-status-badge card-news-status-badge--${n}`,children:[t?e.jsx("span",{className:"card-news-spinner","aria-hidden":"true"}):null,c(`cardNews.status.${n}`)]})}function M(s,r){const c=`cardNews.roles.${s}`,n=r(c);return n===c?s:n}function S(){const{t:s}=u(),r=l(t=>t.activePlan),c=l(t=>t.selectedCardId),n=l(t=>t.selectCard);return r?e.jsx("div",{className:"card-news-deck","aria-label":s("common.cardDeck"),onWheel:k,children:r.cards.map(t=>e.jsxs("button",{type:"button",className:`card-news-deck-card${c===t.id?" selected":""}`,onClick:()=>n(t.id),children:[e.jsx("span",{children:String(t.order).padStart(2,"0")}),t.url?e.jsx("img",{src:t.url,alt:"",className:"card-news-deck-card__thumb"}):null,e.jsx("strong",{children:M(t.role,s)}),e.jsx("small",{children:t.headline||t.textFields.find(p=>p.renderMode==="in-image")?.text}),e.jsx(F,{status:t.status,locked:t.locked})]},t.id))}):null}const $=[];function E(){const{t:s}=u(),r=l(t=>t.activePlan?.cards??$),c=l(t=>t.generating),n={total:r.length,done:r.filter(t=>t.status==="generated").length,queued:r.filter(t=>t.status==="queued").length,errors:r.filter(t=>t.status==="error").length,skipped:r.filter(t=>t.locked||t.status==="skipped").length};return n.total?e.jsxs("div",{className:"card-news-batch-bar","aria-live":"polite",children:[e.jsx("span",{children:c?s("cardNews.progress.generating",{done:n.done,total:n.total}):s("cardNews.progress.summary",{done:n.done,total:n.total})}),e.jsx("span",{children:s("cardNews.progress.detail",{queued:n.queued,errors:n.errors,skipped:n.skipped})})]}):null}function P({meta:s}){const{t:r}=u();if(!s)return null;const c=s.mode==="structured-output"?r("cardNews.planner.structured"):s.mode==="json-mode"?r("cardNews.planner.jsonMode"):r("cardNews.planner.fallback");return e.jsxs("span",{className:"card-news-planner-badge",children:[c," · ",s.model,s.repaired?` · ${r("cardNews.planner.repaired")}`:""]})}function L(s){const r=s.textFields.filter(c=>c.renderMode==="in-image"&&c.text).map(c=>`[${c.placement}] ${c.text}`);return[s.headline,...r].filter(Boolean).join(`
1
+ import{u,M as l,j as e,N as k,a as h,t as j,s as _}from"./index-CxEuSZMC.js";function C(s){const r=s.slots.filter(n=>n.kind==="text"||n.textKind).length,c=s.slots.filter(n=>n.kind==="image").length;return`${r} text / ${c} image`}function T(){const{t:s}=u(),r=l(t=>t.templates),c=l(t=>t.imageTemplateId),n=l(t=>t.setImageTemplate);return e.jsxs("section",{className:"card-news-panel",children:[e.jsxs("div",{className:"card-news-panel__head",children:[e.jsx("span",{children:s("cardNews.imageTemplate")}),e.jsx("button",{type:"button",disabled:!0,title:s("cardNews.newTemplateLater"),children:"+"})]}),e.jsx("div",{className:"card-news-template-grid",children:r.map(t=>e.jsxs("button",{type:"button",className:`card-news-template${c===t.id?" selected":""}`,onClick:()=>n(t.id),children:[e.jsx("img",{src:t.previewUrl,alt:""}),e.jsxs("span",{className:"card-news-template__body",children:[e.jsx("span",{className:"card-news-template__name",children:t.name}),e.jsx("span",{className:"card-news-template__meta",children:C(t)}),e.jsx("span",{className:"card-news-template__sizes",children:t.recommendedOutputSizes.join(" · ")})]})]},t.id))})]})}function I(){const{t:s}=u(),r=l(t=>t.roleTemplates),c=l(t=>t.roleTemplateId),n=l(t=>t.setRoleTemplate);return e.jsxs("section",{className:"card-news-panel",children:[e.jsx("div",{className:"card-news-panel__head",children:e.jsx("span",{children:s("cardNews.roleTemplate")})}),e.jsx("div",{className:"card-news-role-row",children:r.map(t=>e.jsx("button",{type:"button",className:c===t.id?"selected":"",onClick:()=>n(t.id),children:t.name},t.id))})]})}function F({status:s,locked:r}){const{t:c}=u(),n=r?"locked":s,t=n==="queued"||n==="generating";return e.jsxs("span",{className:`card-news-status-badge card-news-status-badge--${n}`,children:[t?e.jsx("span",{className:"card-news-spinner","aria-hidden":"true"}):null,c(`cardNews.status.${n}`)]})}function M(s,r){const c=`cardNews.roles.${s}`,n=r(c);return n===c?s:n}function S(){const{t:s}=u(),r=l(t=>t.activePlan),c=l(t=>t.selectedCardId),n=l(t=>t.selectCard);return r?e.jsx("div",{className:"card-news-deck","aria-label":s("common.cardDeck"),onWheel:k,children:r.cards.map(t=>e.jsxs("button",{type:"button",className:`card-news-deck-card${c===t.id?" selected":""}`,onClick:()=>n(t.id),children:[e.jsx("span",{children:String(t.order).padStart(2,"0")}),t.url?e.jsx("img",{src:t.url,alt:"",className:"card-news-deck-card__thumb"}):null,e.jsx("strong",{children:M(t.role,s)}),e.jsx("small",{children:t.headline||t.textFields.find(p=>p.renderMode==="in-image")?.text}),e.jsx(F,{status:t.status,locked:t.locked})]},t.id))}):null}const $=[];function E(){const{t:s}=u(),r=l(t=>t.activePlan?.cards??$),c=l(t=>t.generating),n={total:r.length,done:r.filter(t=>t.status==="generated").length,queued:r.filter(t=>t.status==="queued").length,errors:r.filter(t=>t.status==="error").length,skipped:r.filter(t=>t.locked||t.status==="skipped").length};return n.total?e.jsxs("div",{className:"card-news-batch-bar","aria-live":"polite",children:[e.jsx("span",{children:c?s("cardNews.progress.generating",{done:n.done,total:n.total}):s("cardNews.progress.summary",{done:n.done,total:n.total})}),e.jsx("span",{children:s("cardNews.progress.detail",{queued:n.queued,errors:n.errors,skipped:n.skipped})})]}):null}function P({meta:s}){const{t:r}=u();if(!s)return null;const c=s.mode==="structured-output"?r("cardNews.planner.structured"):s.mode==="json-mode"?r("cardNews.planner.jsonMode"):r("cardNews.planner.fallback");return e.jsxs("span",{className:"card-news-planner-badge",children:[c," · ",s.model,s.repaired?` · ${r("cardNews.planner.repaired")}`:""]})}function L(s){const r=s.textFields.filter(c=>c.renderMode==="in-image"&&c.text).map(c=>`[${c.placement}] ${c.text}`);return[s.headline,...r].filter(Boolean).join(`
2
2
  `)}function R(s,r){const c=s.slotId?r?.slots.find(n=>n.id===s.slotId):null;return c?{left:`${c.x/20.48}%`,top:`${c.y/20.48}%`,width:`${c.w/20.48}%`,minHeight:`${c.h/20.48}%`}:B(s)}const b={"top-left":{left:"10%",top:"10%",width:"34%"},"top-center":{left:"50%",top:"10%",width:"42%",transform:"translateX(-50%)"},"top-right":{right:"10%",top:"10%",width:"34%"},"center-left":{left:"10%",top:"50%",width:"34%",transform:"translateY(-50%)"},center:{left:"50%",top:"50%",width:"44%",transform:"translate(-50%, -50%)"},"center-right":{right:"10%",top:"50%",width:"34%",transform:"translateY(-50%)"},"bottom-left":{left:"10%",bottom:"10%",width:"34%"},"bottom-center":{left:"50%",bottom:"10%",width:"42%",transform:"translateX(-50%)"},"bottom-right":{right:"10%",bottom:"10%",width:"34%"},free:{left:"50%",top:"50%",width:"44%",transform:"translate(-50%, -50%)"}};function B(s){return b[s.placement]||b.center}function D(){const{t:s}=u(),r=l(a=>a.activePlan),c=l(a=>a.selectedCardId),n=l(a=>a.selectedTextFieldId),t=l(a=>a.templates),p=l(a=>a.plannerMeta),m=l(a=>a.retryCard),x=l(a=>a.selectTextField),o=r?.cards.find(a=>a.id===c)||r?.cards[0],w=r?t.find(a=>a.id===r.imageTemplateId):void 0,d=o?.textFields.filter(a=>a.renderMode==="in-image")||[];return!r||!o?e.jsxs("section",{className:"card-news-empty",children:[e.jsxs("div",{className:"card-news-empty__deck","aria-hidden":"true",children:[e.jsx("div",{className:"card-news-empty__card card-news-empty__card--back"}),e.jsx("div",{className:"card-news-empty__card card-news-empty__card--mid"}),e.jsxs("div",{className:"card-news-empty__card",children:[e.jsx("span",{}),e.jsx("strong",{}),e.jsx("em",{})]})]}),e.jsxs("div",{className:"card-news-empty__copy",children:[e.jsx("span",{children:s("uiMode.cardNews")}),e.jsx("h2",{children:s("cardNews.emptyTitle")}),e.jsx("p",{children:s("cardNews.emptyBody")})]})]}):e.jsxs("section",{className:"card-news-stage",children:[e.jsxs("div",{className:"card-news-stage__header",children:[e.jsxs("div",{children:[e.jsx("h2",{children:r.title}),e.jsx("p",{children:r.generationStrategy}),e.jsx(P,{meta:p})]}),e.jsxs("span",{children:[o.order," / ",r.cards.length]})]}),e.jsx(E,{}),e.jsxs("div",{className:"card-news-preview",children:[o.status==="queued"||o.status==="generating"?e.jsx("div",{className:"card-news-preview__loading",children:s("cardNews.progress.cardGenerating")}):o.status==="error"?e.jsxs("div",{className:"card-news-preview__error",children:[e.jsx("span",{children:o.error||s("cardNews.error")}),o.locked?null:e.jsx("button",{type:"button",onClick:()=>{m(o.id)},children:s("cardNews.retryCard")})]}):o.url?e.jsx("img",{src:o.url,alt:o.headline}):e.jsx("div",{className:"card-news-preview__slot"}),d.length?e.jsx("div",{className:"card-news-stage-overlay",children:d.map(a=>e.jsx("button",{type:"button",className:`card-news-stage-overlay__field card-news-stage-overlay__field--${a.placement}${n===a.id?" selected":""}`,style:R(a,w),onClick:()=>x(a.id),"aria-label":s("cardNews.selectTextField",{text:a.text||a.kind}),children:e.jsx("span",{children:a.text||a.kind})},a.id))}):null]}),o.url?e.jsxs("div",{className:"card-news-result-actions",children:[e.jsx("button",{type:"button",onClick:()=>navigator.clipboard?.writeText(o.visualPrompt),children:s("cardNews.actions.copyPrompt")}),e.jsx("button",{type:"button",onClick:()=>navigator.clipboard?.writeText(L(o)),children:s("cardNews.actions.copyCopy")}),e.jsx("a",{href:o.url,target:"_blank",rel:"noreferrer",children:s("cardNews.actions.openImage")}),e.jsx("a",{href:o.url,download:!0,children:s("cardNews.actions.downloadCard")})]}):null]})}function y(s,r){const c=`cardNews.placements.${s}`,n=r(c);return n===c?s:n}function q({placement:s}){const{t:r}=u();return e.jsx("span",{className:"card-news-placement-chip",children:y(s,r)})}const K=["headline","body","caption","cta","badge","number"],A=["top-left","top-center","top-right","center-left","center","center-right","bottom-left","bottom-center","bottom-right","free"],H=["in-image","ui-only"],Y=["primary","secondary","supporting"];function N(s,r,c){const n=`cardNews.${s}.${r}`,t=c(n);return t===n?r:t}function z({field:s,locked:r,selected:c=!1,onSelect:n,onChange:t,onRemove:p}){const{t:m}=u(),x=s.text.length,o=typeof s.maxChars=="number"&&x>s.maxChars,w=s.maxChars===null||s.maxChars>80,d=h.useMemo(()=>K.map(i=>({value:i,label:N("textKinds",i,m)})),[m]),a=h.useMemo(()=>A.map(i=>({value:i,label:y(i,m)})),[m]),g=h.useMemo(()=>H.map(i=>({value:i,label:N("renderModes",i,m)})),[m]),f=h.useMemo(()=>Y.map(i=>({value:i,label:N("hierarchy",i,m)})),[m]);return e.jsxs("div",{className:`card-news-text-field-card${c?" selected":""}`,onClick:n,children:[e.jsxs("div",{className:"card-news-text-field-card__header",children:[e.jsx("span",{children:N("textKinds",s.kind,m)}),e.jsx(q,{placement:s.placement})]}),e.jsxs("label",{className:"card-news-field",children:[e.jsx("span",{children:m("cardNews.textFieldText")}),w?e.jsx("textarea",{value:s.text,disabled:r,onChange:i=>t({text:i.target.value,source:"user"})}):e.jsx("input",{value:s.text,disabled:r,onChange:i=>t({text:i.target.value,source:"user"})})]}),e.jsxs("div",{className:"card-news-text-field-card__grid",children:[e.jsxs("label",{className:"card-news-field",children:[e.jsx("span",{children:m("cardNews.textKind")}),e.jsx(j,{items:d,value:s.kind,disabled:r,onChange:i=>t({kind:i,source:"user"})})]}),e.jsxs("label",{className:"card-news-field",children:[e.jsx("span",{children:m("cardNews.placement")}),e.jsx(j,{items:a,value:s.placement,disabled:r,onChange:i=>t({placement:i,source:"user"})})]}),e.jsxs("label",{className:"card-news-field",children:[e.jsx("span",{children:m("cardNews.renderMode")}),e.jsx(j,{items:g,value:s.renderMode,disabled:r,onChange:i=>t({renderMode:i,source:"user"})})]}),e.jsxs("label",{className:"card-news-field",children:[e.jsx("span",{children:m("cardNews.hierarchyLabel")}),e.jsx(j,{items:f,value:s.hierarchy,disabled:r,onChange:i=>t({hierarchy:i,source:"user"})})]})]}),e.jsxs("div",{className:`card-news-text-field-card__meta${o?" over":""}`,children:[e.jsx("span",{children:s.maxChars===null?x:`${x}/${s.maxChars}`}),o?e.jsx("span",{children:m("cardNews.textTooLong")}):null,p?e.jsx("button",{type:"button",disabled:r,onClick:p,children:m("cardNews.removeTextField")}):null]})]})}function O(){return{id:`tf_${Date.now().toString(36)}`,kind:"body",text:"",renderMode:"in-image",placement:"center",slotId:null,hierarchy:"supporting",maxChars:null,language:null,source:"user"}}function W(){const{t:s}=u(),r=l(a=>a.activePlan),c=l(a=>a.selectedCardId),n=l(a=>a.selectedTextFieldId),t=l(a=>a.updateCard),p=l(a=>a.updateTextField),m=l(a=>a.addTextField),x=l(a=>a.removeTextField),o=l(a=>a.selectTextField),w=l(a=>a.retryCard),d=r?.cards.find(a=>a.id===c)||r?.cards[0];return d?e.jsxs("aside",{className:"card-news-inspector",children:[e.jsx("div",{className:"section-title",children:s("cardNews.inspector")}),e.jsxs("div",{className:"card-news-inspector-group",children:[e.jsx("span",{className:"card-news-inspector-label",children:s("cardNews.cardTitle")}),e.jsxs("label",{className:"card-news-field",children:[e.jsx("span",{children:s("cardNews.headline")}),e.jsx("input",{value:d.headline,disabled:d.locked,onChange:a=>t(d.id,{headline:a.target.value})})]})]}),e.jsxs("div",{className:"card-news-inspector-group",children:[e.jsxs("div",{className:"card-news-inspector-row",children:[e.jsx("span",{className:"card-news-inspector-label",children:s("cardNews.textFields")}),e.jsx("button",{type:"button",className:"secondary-btn",disabled:d.locked,onClick:()=>m(d.id,O()),children:s("cardNews.addTextField")})]}),d.textFields.length?d.textFields.map(a=>e.jsx(z,{field:a,locked:d.locked,selected:n===a.id,onSelect:()=>o(a.id),onChange:g=>p(d.id,a.id,g),onRemove:()=>x(d.id,a.id)},a.id)):e.jsx("p",{className:"card-news-muted",children:s("cardNews.noTextFields")})]}),e.jsxs("details",{className:"card-news-inspector-group card-news-advanced-prompt",children:[e.jsx("summary",{children:s("cardNews.designPrompt")}),e.jsxs("label",{className:"card-news-field",children:[e.jsx("span",{children:s("cardNews.visualPrompt")}),e.jsx("textarea",{value:d.visualPrompt,disabled:d.locked,onChange:a=>t(d.id,{visualPrompt:a.target.value})})]})]}),d.imageFilename?e.jsxs("div",{className:"card-news-generated-meta",children:[e.jsx("span",{children:s("cardNews.generatedMeta")}),e.jsx("code",{children:d.imageFilename}),e.jsx("span",{children:d.status})]}):null,d.locked?e.jsx("p",{className:"card-news-locked-help",children:s("cardNews.lockedHelp")}):null,e.jsx("button",{type:"button",className:`secondary-btn${d.locked?" active":""}`,onClick:()=>t(d.id,{locked:!d.locked}),children:d.locked?s("cardNews.locked"):s("cardNews.unlocked")}),e.jsx("button",{type:"button",className:"secondary-btn",disabled:d.locked||!["draft","error"].includes(d.status),onClick:()=>{w(d.id)},children:s("cardNews.retryCard")})]}):e.jsxs("aside",{className:"card-news-inspector card-news-inspector-empty",children:[e.jsx("div",{className:"section-title",children:s("cardNews.inspector")}),e.jsxs("div",{className:"card-news-inspector-empty__mock","aria-hidden":"true",children:[e.jsx("span",{}),e.jsx("strong",{}),e.jsx("i",{}),e.jsx("i",{})]}),e.jsx("p",{children:s("cardNews.noCard")})]})}const v="ima2:cardNewsMobileNoticeShown";function X(){const{t:s}=u(),r=_(),[c,n]=h.useState(()=>{if(typeof window>"u")return!0;try{return localStorage.getItem(v)==="1"}catch{return!1}});if(!r||c)return null;const t=()=>{try{localStorage.setItem(v,"1")}catch{}n(!0)};return e.jsxs("div",{className:"card-news-mobile-notice",role:"status",children:[e.jsx("span",{children:s("mobile.cardNewsBanner")}),e.jsx("button",{type:"button",onClick:t,children:s("mobile.dismiss")})]})}function U(){const{t:s}=u(),r=l(n=>n.hydrate),c=l(n=>n.error);return h.useEffect(()=>{r()},[r]),e.jsxs("main",{className:"card-news-workspace","aria-label":s("cardNews.workspace"),children:[e.jsx(X,{}),e.jsxs("div",{className:"card-news-setup",children:[e.jsx(T,{}),e.jsx(I,{})]}),e.jsxs("div",{className:"card-news-main",children:[c?e.jsx("div",{className:"card-news-error",role:"alert",children:c}):null,e.jsx(D,{}),e.jsx(S,{})]}),e.jsx(W,{})]})}export{U as CardNewsWorkspace};
@@ -1 +1 @@
1
- import{q as j,u as _,aq as b,C as N,j as e,b as p,a as n}from"./index-XXtoj9ME.js";async function f(){return j("/api/generation-requests")}async function v(a){if(navigator.clipboard?.writeText){await navigator.clipboard.writeText(a);return}const o=document.createElement("textarea");o.value=a,o.style.position="fixed",o.style.opacity="0",document.body.appendChild(o),o.select();try{document.execCommand("copy")}finally{document.body.removeChild(o)}}function y({entry:a,onClose:o,onCopyPrompt:i}){const{t:s}=_(),l=b(!0,o),r=a.succeeded===0;return N.createPortal(e.jsxs("div",{className:"generation-log-detail",role:"presentation",children:[e.jsx("div",{className:"generation-log-detail__backdrop",onClick:o}),e.jsxs("div",{ref:l,className:"generation-log-detail__content",role:"dialog","aria-modal":"true","aria-labelledby":"generation-log-detail-title",tabIndex:-1,children:[e.jsxs("div",{className:"generation-log-detail__header",children:[e.jsxs("h2",{id:"generation-log-detail-title",className:"generation-log-detail__title",children:[s("generationLog.detailTitle"),e.jsxs("span",{className:`generation-log-detail__badge${r?" is-error":" is-success"}`,children:[a.succeeded,"/",a.requested]})]}),e.jsx("button",{type:"button",className:"generation-log-detail__close",onClick:o,"aria-label":s("common.close"),children:"×"})]}),e.jsxs("div",{className:"generation-log-detail__grid",children:[e.jsx("span",{className:"generation-log-detail__label",children:s("generationLog.detailTime")}),e.jsx("span",{children:new Date(a.createdAt).toLocaleString()}),e.jsx("span",{className:"generation-log-detail__label",children:s("generationLog.detailRequestId")}),e.jsx("span",{className:"generation-log-detail__mono",children:a.requestId}),e.jsx("span",{className:"generation-log-detail__label",children:s("generationLog.detailCounts")}),e.jsxs("span",{children:[a.succeeded," / ",a.requested]}),a.error?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"generation-log-detail__label",children:s("generationLog.detailError")}),e.jsx("span",{className:"generation-log-detail__mono is-error",children:a.error})]}):null,a.errorMessage?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"generation-log-detail__label",children:s("generationLog.detailErrorMessage")}),e.jsx("span",{className:"generation-log-detail__reason",children:a.errorMessage})]}):null]}),e.jsxs("div",{className:"generation-log-detail__section",children:[e.jsx("div",{className:"generation-log-detail__label",children:s("generationLog.detailPrompt")}),e.jsx("div",{className:"generation-log-detail__prompt",children:a.prompt||s("generationLog.detailPromptEmpty")})]}),e.jsx("div",{className:"generation-log-detail__footer",children:e.jsx("button",{type:"button",className:"generation-log-detail__copy",onClick:()=>i(a),"data-modal-initial-focus":!0,children:s("generationLog.copy")})})]})]}),document.body)}function q(){const{t:a}=_(),o=p(t=>t.showToast),i=p(t=>t.activeGenerations),[s,l]=n.useState([]),[r,d]=n.useState(!0),[x,g]=n.useState(!1),[u,m]=n.useState(null),c=n.useCallback(async()=>{d(!0),g(!1);try{const t=await f();l(t.items)}catch{l([]),g(!0)}finally{d(!1)}},[]);n.useEffect(()=>{c()},[c,i]);const h=async t=>{try{await v(t.prompt),o(a("generationLog.copied"))}catch{o(a("toast.copyFailed"),!0)}};return r?e.jsx("div",{className:"generation-request-log__empty",children:a("common.loading")}):x?e.jsxs("div",{className:"generation-request-log__empty",role:"alert",children:[e.jsx("span",{children:a("generationLog.loadFailed")}),e.jsx("button",{type:"button",onClick:()=>{c()},children:a("generationLog.retry")})]}):e.jsxs("div",{className:"generation-request-log",role:"list",children:[s.length===0?e.jsx("div",{className:"generation-request-log__empty",children:a("generationLog.empty")}):s.map(t=>e.jsxs("button",{type:"button",role:"listitem",className:"generation-request-log__item",onClick:()=>m(t),title:a("generationLog.detailOpen"),children:[e.jsx("span",{className:"generation-request-log__prompt",children:t.prompt}),e.jsxs("span",{className:`generation-request-log__count${t.succeeded===0?" is-error":" is-success"}`,children:[t.succeeded,"/",t.requested]})]},t.id)),u?e.jsx(y,{entry:u,onClose:()=>m(null),onCopyPrompt:t=>{h(t)}}):null]})}export{q as GenerationRequestLogPanel};
1
+ import{q as j,u as _,aq as b,C as N,j as e,b as p,a as n}from"./index-CxEuSZMC.js";async function f(){return j("/api/generation-requests")}async function v(a){if(navigator.clipboard?.writeText){await navigator.clipboard.writeText(a);return}const o=document.createElement("textarea");o.value=a,o.style.position="fixed",o.style.opacity="0",document.body.appendChild(o),o.select();try{document.execCommand("copy")}finally{document.body.removeChild(o)}}function y({entry:a,onClose:o,onCopyPrompt:i}){const{t:s}=_(),l=b(!0,o),r=a.succeeded===0;return N.createPortal(e.jsxs("div",{className:"generation-log-detail",role:"presentation",children:[e.jsx("div",{className:"generation-log-detail__backdrop",onClick:o}),e.jsxs("div",{ref:l,className:"generation-log-detail__content",role:"dialog","aria-modal":"true","aria-labelledby":"generation-log-detail-title",tabIndex:-1,children:[e.jsxs("div",{className:"generation-log-detail__header",children:[e.jsxs("h2",{id:"generation-log-detail-title",className:"generation-log-detail__title",children:[s("generationLog.detailTitle"),e.jsxs("span",{className:`generation-log-detail__badge${r?" is-error":" is-success"}`,children:[a.succeeded,"/",a.requested]})]}),e.jsx("button",{type:"button",className:"generation-log-detail__close",onClick:o,"aria-label":s("common.close"),children:"×"})]}),e.jsxs("div",{className:"generation-log-detail__grid",children:[e.jsx("span",{className:"generation-log-detail__label",children:s("generationLog.detailTime")}),e.jsx("span",{children:new Date(a.createdAt).toLocaleString()}),e.jsx("span",{className:"generation-log-detail__label",children:s("generationLog.detailRequestId")}),e.jsx("span",{className:"generation-log-detail__mono",children:a.requestId}),e.jsx("span",{className:"generation-log-detail__label",children:s("generationLog.detailCounts")}),e.jsxs("span",{children:[a.succeeded," / ",a.requested]}),a.error?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"generation-log-detail__label",children:s("generationLog.detailError")}),e.jsx("span",{className:"generation-log-detail__mono is-error",children:a.error})]}):null,a.errorMessage?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"generation-log-detail__label",children:s("generationLog.detailErrorMessage")}),e.jsx("span",{className:"generation-log-detail__reason",children:a.errorMessage})]}):null]}),e.jsxs("div",{className:"generation-log-detail__section",children:[e.jsx("div",{className:"generation-log-detail__label",children:s("generationLog.detailPrompt")}),e.jsx("div",{className:"generation-log-detail__prompt",children:a.prompt||s("generationLog.detailPromptEmpty")})]}),e.jsx("div",{className:"generation-log-detail__footer",children:e.jsx("button",{type:"button",className:"generation-log-detail__copy",onClick:()=>i(a),"data-modal-initial-focus":!0,children:s("generationLog.copy")})})]})]}),document.body)}function q(){const{t:a}=_(),o=p(t=>t.showToast),i=p(t=>t.activeGenerations),[s,l]=n.useState([]),[r,d]=n.useState(!0),[x,g]=n.useState(!1),[u,m]=n.useState(null),c=n.useCallback(async()=>{d(!0),g(!1);try{const t=await f();l(t.items)}catch{l([]),g(!0)}finally{d(!1)}},[]);n.useEffect(()=>{c()},[c,i]);const h=async t=>{try{await v(t.prompt),o(a("generationLog.copied"))}catch{o(a("toast.copyFailed"),!0)}};return r?e.jsx("div",{className:"generation-request-log__empty",children:a("common.loading")}):x?e.jsxs("div",{className:"generation-request-log__empty",role:"alert",children:[e.jsx("span",{children:a("generationLog.loadFailed")}),e.jsx("button",{type:"button",onClick:()=>{c()},children:a("generationLog.retry")})]}):e.jsxs("div",{className:"generation-request-log",role:"list",children:[s.length===0?e.jsx("div",{className:"generation-request-log__empty",children:a("generationLog.empty")}):s.map(t=>e.jsxs("button",{type:"button",role:"listitem",className:"generation-request-log__item",onClick:()=>m(t),title:a("generationLog.detailOpen"),children:[e.jsx("span",{className:"generation-request-log__prompt",children:t.prompt}),e.jsxs("span",{className:`generation-request-log__count${t.succeeded===0?" is-error":" is-success"}`,children:[t.succeeded,"/",t.requested]})]},t.id)),u?e.jsx(y,{entry:u,onClose:()=>m(null),onCopyPrompt:t=>{h(t)}}):null]})}export{q as GenerationRequestLogPanel};
@@ -1 +1 @@
1
- import{b as i,u as m,ae as I,j as e,af as k,ag as A,t as P,ah as E,a as x,ai as M,aj as R,ak as T,al as w,am as C,an as L,ao as O,ap as H}from"./index-XXtoj9ME.js";const S={oauth:"GPT OAuth",api:"GPT API",grok:"Grok OAuth","grok-api":"Grok API",agy:"Antigravity","gemini-api":"Gemini API",atlascloud:"Atlas Cloud",minimax:"MiniMax"};function G(s){if(s.kind==="attachment")return s.source.dataUrl;if(s.source.thumbnailUrl)return s.source.thumbnailUrl;const t=s.source.referenceFilenames[0];if(t)return t.startsWith("/generated/")?t:`/generated/${t.split("/").map(encodeURIComponent).join("/")}`}function U({providerAvailability:s}){const t=i(o=>o.prompt),r=i(o=>o.setPrompt),n=i(o=>o.provider),a=i(o=>o.setProvider),c=i(o=>o.selectedPresetIds),p=i(o=>o.removePreset),d=i(o=>o.generate),j=i(o=>o.activeGenerations),h=i(o=>o.trayItems),{t:l}=m(),f=new Set(c),b=I().filter(o=>f.has(o.id)),v=j>0,y=Object.entries(S).map(([o,u])=>{const g=o,_=s[g];return{value:g,label:u,sub:_.ok?l("readiness.ready"):_.reason,disabled:!_.ok}});return e.jsxs("div",{className:"home-prompt",children:[b.length>0?e.jsx(k,{className:"home-prompt__chips",ariaLabel:l("home.selectedPresets"),children:b.map(o=>e.jsx(A,{selected:!0,onRemove:()=>p(o.id),removeLabel:l("common.removeNamed",{name:o.name}),title:o.category,children:o.name},o.id))}):null,h.length>0?e.jsxs("div",{className:"home-prompt__reference-strip",role:"group","aria-label":l("home.referenceTrayAria",{count:h.length}),children:[e.jsx("span",{className:"home-prompt__reference-thumbs","aria-hidden":"true",children:h.map(o=>{const u=G(o);return e.jsx("span",{className:"home-prompt__reference-thumb",children:u?e.jsx("img",{src:u,alt:"",loading:"lazy",decoding:"async"}):"@"},o.tokenId)})}),e.jsx("span",{className:"home-prompt__reference-count",children:l("home.referenceTrayCount",{count:h.length})})]}):null,e.jsx("label",{className:"home-prompt__label",htmlFor:"home-prompt-input",children:l("prompt.label")}),e.jsx("textarea",{id:"home-prompt-input",className:"home-prompt__textarea",rows:5,value:t,placeholder:l("prompt.placeholder"),onChange:o=>r(o.target.value)}),e.jsxs("div",{className:"home-prompt__footer",children:[e.jsx(P,{className:"home-prompt__provider",items:y,value:n,onChange:a,ariaLabel:l("readiness.provider")}),e.jsx("button",{type:"button",className:"home-prompt__generate",disabled:v||t.trim().length===0,onClick:()=>{d();const o=i.getState().setUIMode;o("classic")},children:v?l("generate.buttonLoading",{n:j}):l("generate.button")})]})]})}const N=/\.(mp4|webm|mov)(?:$|[?#])/i;function D(s){return s.mediaType==="video"||N.test(s.filename??"")||N.test(s.url??s.image)?s.thumb:s.thumb||s.url||s.image||void 0}function V({item:s,featured:t}){const{t:r}=m(),[n,a]=x.useState(!1),c=D(s),p=(s.userPrompt?.trim()||s.prompt?.trim()||r("home.untitledResult")).slice(0,60),d=r("home.recentResultAlt",{prompt:p});return!c||n?e.jsx("div",{className:"home-recent-card__fallback",role:"img","aria-label":d,children:r("home.mediaUnavailable")}):e.jsx("img",{src:c,alt:d,loading:t?"eager":"lazy",decoding:"async",onError:()=>a(!0)})}function B(){const s=i(n=>n.history),{t}=m(),r=s.slice(0,5);return r.length===0?e.jsx("p",{className:"home-recent-empty",role:"status",children:t("history.emptyRecent")}):e.jsx("div",{className:"home-recent-row",role:"list","aria-label":t("home.recentTitle"),children:r.map((n,a)=>{const c=a===0;return e.jsx("figure",{className:`home-recent-card${c?" is-featured":""}`,role:"listitem",children:e.jsx(V,{item:n,featured:c})},E(n))})})}function $(){return e.jsxs("svg",{className:"home-hero__mode-arrow",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M5 12h14"}),e.jsx("path",{d:"m12 5 7 7-7 7"})]})}function F(){const{t:s}=m(),t=M(),r=x.useMemo(()=>Object.values(t).filter(a=>a?.ok).length,[t]),n=x.useMemo(()=>Object.keys(t).length,[t]);return e.jsxs("div",{className:"home-hero",children:[e.jsx("div",{className:"home-hero__mark","aria-hidden":"true",children:"IMA2"}),e.jsxs("header",{className:"home-hero__intro",children:[e.jsx("h1",{className:"home-hero__title",children:s("home.heroTitle")}),e.jsx("p",{className:"home-hero__lede",children:s("home.heroLede")})]}),e.jsxs("p",{className:"home-hero__readiness",role:"status",children:[e.jsx("span",{className:`home-hero__dot${r>0?" is-ready":""}`,"aria-hidden":"true"}),r>0?s("home.lanesReady",{ready:r,total:n}):s("home.lanesNone")]}),e.jsx("div",{className:"home-workspace__composer",children:e.jsx(U,{providerAvailability:t})}),e.jsxs("section",{className:"home-workspace__recent","aria-labelledby":"home-recent-title",children:[e.jsx("h2",{id:"home-recent-title",children:s("home.recentTitle")}),e.jsx(B,{})]}),e.jsx(W,{})]})}function W(){const{t:s}=m(),t=i(a=>a.setUIMode),r=[{mode:"classic",label:s("nav.create"),hint:s("home.modeCreateHint"),enabled:!0,icon:R},{mode:"node",label:s("nav.node"),hint:s("home.modeNodeHint"),enabled:w,icon:T},{mode:"agent",label:s("nav.agent"),hint:s("home.modeAgentHint"),enabled:L,icon:C},{mode:"assets",label:s("nav.assets"),hint:s("home.modeAssetsHint"),enabled:!0,icon:O}];function n(a){t(a),history.replaceState(null,"",H[a]??"#create")}return e.jsxs("nav",{className:"home-modes","aria-label":s("home.modesTitle"),children:[e.jsx("h2",{className:"home-modes__title",children:s("home.modesTitle")}),r.filter(a=>a.enabled).map(a=>e.jsxs("button",{type:"button",className:"home-modes__item",onClick:()=>n(a.mode),children:[e.jsx("span",{className:"home-modes__icon",children:e.jsx(a.icon,{})}),e.jsx("span",{className:"home-modes__label",children:a.label}),e.jsx("span",{className:"home-modes__hint",children:a.hint}),e.jsx($,{})]},a.mode))]})}function K(){const{t:s}=m();return e.jsx("section",{className:"home-workspace","aria-label":s("nav.home"),children:e.jsx("div",{className:"home-workspace__inner",children:e.jsx(F,{})})})}export{K as HomeWorkspace};
1
+ import{b as i,u as m,ae as I,j as e,af as k,ag as A,t as P,ah as E,a as x,ai as M,aj as R,ak as T,al as w,am as C,an as L,ao as O,ap as H}from"./index-CxEuSZMC.js";const S={oauth:"GPT OAuth",api:"GPT API",grok:"Grok OAuth","grok-api":"Grok API",agy:"Antigravity","gemini-api":"Gemini API",atlascloud:"Atlas Cloud",minimax:"MiniMax"};function G(s){if(s.kind==="attachment")return s.source.dataUrl;if(s.source.thumbnailUrl)return s.source.thumbnailUrl;const t=s.source.referenceFilenames[0];if(t)return t.startsWith("/generated/")?t:`/generated/${t.split("/").map(encodeURIComponent).join("/")}`}function U({providerAvailability:s}){const t=i(o=>o.prompt),r=i(o=>o.setPrompt),n=i(o=>o.provider),a=i(o=>o.setProvider),c=i(o=>o.selectedPresetIds),p=i(o=>o.removePreset),d=i(o=>o.generate),j=i(o=>o.activeGenerations),h=i(o=>o.trayItems),{t:l}=m(),f=new Set(c),b=I().filter(o=>f.has(o.id)),v=j>0,y=Object.entries(S).map(([o,u])=>{const g=o,_=s[g];return{value:g,label:u,sub:_.ok?l("readiness.ready"):_.reason,disabled:!_.ok}});return e.jsxs("div",{className:"home-prompt",children:[b.length>0?e.jsx(k,{className:"home-prompt__chips",ariaLabel:l("home.selectedPresets"),children:b.map(o=>e.jsx(A,{selected:!0,onRemove:()=>p(o.id),removeLabel:l("common.removeNamed",{name:o.name}),title:o.category,children:o.name},o.id))}):null,h.length>0?e.jsxs("div",{className:"home-prompt__reference-strip",role:"group","aria-label":l("home.referenceTrayAria",{count:h.length}),children:[e.jsx("span",{className:"home-prompt__reference-thumbs","aria-hidden":"true",children:h.map(o=>{const u=G(o);return e.jsx("span",{className:"home-prompt__reference-thumb",children:u?e.jsx("img",{src:u,alt:"",loading:"lazy",decoding:"async"}):"@"},o.tokenId)})}),e.jsx("span",{className:"home-prompt__reference-count",children:l("home.referenceTrayCount",{count:h.length})})]}):null,e.jsx("label",{className:"home-prompt__label",htmlFor:"home-prompt-input",children:l("prompt.label")}),e.jsx("textarea",{id:"home-prompt-input",className:"home-prompt__textarea",rows:5,value:t,placeholder:l("prompt.placeholder"),onChange:o=>r(o.target.value)}),e.jsxs("div",{className:"home-prompt__footer",children:[e.jsx(P,{className:"home-prompt__provider",items:y,value:n,onChange:a,ariaLabel:l("readiness.provider")}),e.jsx("button",{type:"button",className:"home-prompt__generate",disabled:v||t.trim().length===0,onClick:()=>{d();const o=i.getState().setUIMode;o("classic")},children:v?l("generate.buttonLoading",{n:j}):l("generate.button")})]})]})}const N=/\.(mp4|webm|mov)(?:$|[?#])/i;function D(s){return s.mediaType==="video"||N.test(s.filename??"")||N.test(s.url??s.image)?s.thumb:s.thumb||s.url||s.image||void 0}function V({item:s,featured:t}){const{t:r}=m(),[n,a]=x.useState(!1),c=D(s),p=(s.userPrompt?.trim()||s.prompt?.trim()||r("home.untitledResult")).slice(0,60),d=r("home.recentResultAlt",{prompt:p});return!c||n?e.jsx("div",{className:"home-recent-card__fallback",role:"img","aria-label":d,children:r("home.mediaUnavailable")}):e.jsx("img",{src:c,alt:d,loading:t?"eager":"lazy",decoding:"async",onError:()=>a(!0)})}function B(){const s=i(n=>n.history),{t}=m(),r=s.slice(0,5);return r.length===0?e.jsx("p",{className:"home-recent-empty",role:"status",children:t("history.emptyRecent")}):e.jsx("div",{className:"home-recent-row",role:"list","aria-label":t("home.recentTitle"),children:r.map((n,a)=>{const c=a===0;return e.jsx("figure",{className:`home-recent-card${c?" is-featured":""}`,role:"listitem",children:e.jsx(V,{item:n,featured:c})},E(n))})})}function $(){return e.jsxs("svg",{className:"home-hero__mode-arrow",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M5 12h14"}),e.jsx("path",{d:"m12 5 7 7-7 7"})]})}function F(){const{t:s}=m(),t=M(),r=x.useMemo(()=>Object.values(t).filter(a=>a?.ok).length,[t]),n=x.useMemo(()=>Object.keys(t).length,[t]);return e.jsxs("div",{className:"home-hero",children:[e.jsx("div",{className:"home-hero__mark","aria-hidden":"true",children:"IMA2"}),e.jsxs("header",{className:"home-hero__intro",children:[e.jsx("h1",{className:"home-hero__title",children:s("home.heroTitle")}),e.jsx("p",{className:"home-hero__lede",children:s("home.heroLede")})]}),e.jsxs("p",{className:"home-hero__readiness",role:"status",children:[e.jsx("span",{className:`home-hero__dot${r>0?" is-ready":""}`,"aria-hidden":"true"}),r>0?s("home.lanesReady",{ready:r,total:n}):s("home.lanesNone")]}),e.jsx("div",{className:"home-workspace__composer",children:e.jsx(U,{providerAvailability:t})}),e.jsxs("section",{className:"home-workspace__recent","aria-labelledby":"home-recent-title",children:[e.jsx("h2",{id:"home-recent-title",children:s("home.recentTitle")}),e.jsx(B,{})]}),e.jsx(W,{})]})}function W(){const{t:s}=m(),t=i(a=>a.setUIMode),r=[{mode:"classic",label:s("nav.create"),hint:s("home.modeCreateHint"),enabled:!0,icon:R},{mode:"node",label:s("nav.node"),hint:s("home.modeNodeHint"),enabled:w,icon:T},{mode:"agent",label:s("nav.agent"),hint:s("home.modeAgentHint"),enabled:L,icon:C},{mode:"assets",label:s("nav.assets"),hint:s("home.modeAssetsHint"),enabled:!0,icon:O}];function n(a){t(a),history.replaceState(null,"",H[a]??"#create")}return e.jsxs("nav",{className:"home-modes","aria-label":s("home.modesTitle"),children:[e.jsx("h2",{className:"home-modes__title",children:s("home.modesTitle")}),r.filter(a=>a.enabled).map(a=>e.jsxs("button",{type:"button",className:"home-modes__item",onClick:()=>n(a.mode),children:[e.jsx("span",{className:"home-modes__icon",children:e.jsx(a.icon,{})}),e.jsx("span",{className:"home-modes__label",children:a.label}),e.jsx("span",{className:"home-modes__hint",children:a.hint}),e.jsx($,{})]},a.mode))]})}function K(){const{t:s}=m();return e.jsx("section",{className:"home-workspace","aria-label":s("nav.home"),children:e.jsx("div",{className:"home-workspace__inner",children:e.jsx(F,{})})})}export{K as HomeWorkspace};
@@ -0,0 +1 @@
1
+ import{u as se,a as M,b as q,p as he,j as s,ab as fe,ac as ge,ad as me}from"./index-CxEuSZMC.js";import{u as pe}from"./useAgentDialogFocus-R64NV-ZZ.js";function ye(){return s.jsx("svg",{viewBox:"0 0 24 24",width:"18",height:"18","aria-hidden":"true",children:s.jsx("path",{d:"M6 6l12 12M18 6 6 18",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})})}function xe({zoomed:e}){return s.jsxs("svg",{viewBox:"0 0 24 24",width:"18",height:"18","aria-hidden":"true",children:[s.jsx("circle",{cx:"10.5",cy:"10.5",r:"6.5",fill:"none",stroke:"currentColor",strokeWidth:"1.7"}),s.jsx("path",{d:"M15.5 15.5 21 21M7.5 10.5h6",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"}),e?null:s.jsx("path",{d:"M10.5 7.5v6",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function Le({item:e,onClose:t}){const{t:n}=se(),[o,i]=M.useState(!1),l=e.metadata??null,[f,u]=M.useState(l),d=M.useId(),h=q(U=>U.setKeyingTarget),g=q(U=>U.setCuratorTarget),r=M.useCallback(()=>t(),[t]),v=pe(!0,r),a=e.mediaType==="video",m=e.kind!=="edit"&&!!e.filename&&e.backgroundPreset!=="transparent",E=l??f,y=typeof E?.spriteRunId=="string"?E.spriteRunId:null,R=typeof E?.manifestPath=="string"?E.manifestPath:null,K=!!(y&&R&&e.filename),P=n(a?"assetGen.videoFallback":"assetGen.imageFallback"),x=e.prompt?.trim()||P,L=M.useCallback(()=>{h(e),t()},[e,t,h]),T=M.useCallback(()=>{!y||!R||!e.filename||(g({runId:y,atlasFile:e.filename,manifestFile:R}),t())},[e.filename,R,t,g,y]);return M.useEffect(()=>{u(l);const U=e.requestId?.startsWith("asset:")?e.requestId.slice(6):null;if(!U||l)return;let B=!0;return he(U).then(({asset:S})=>{B&&u(S.metadata)}).catch(()=>{B&&u(null)}),()=>{B=!1}},[l,e.requestId]),M.useEffect(()=>{const U=document.body.style.overflow,B=document.documentElement.style.overflow;return document.body.style.overflow="hidden",document.documentElement.style.overflow="hidden",()=>{document.body.style.overflow=U,document.documentElement.style.overflow=B}},[]),s.jsxs("div",{className:"assetgen-lightbox",role:"presentation",children:[s.jsx("button",{type:"button",className:"assetgen-lightbox__backdrop","aria-label":n("assetGen.closePreview"),onClick:r}),s.jsxs("section",{ref:v,className:"assetgen-lightbox__panel",role:"dialog","aria-modal":"true","aria-labelledby":d,children:[s.jsxs("header",{className:"assetgen-lightbox__header",children:[s.jsx("h2",{id:d,children:n("assetGen.previewDialogTitle",{prompt:x})}),s.jsx("button",{type:"button",className:"assetgen-lightbox__control","aria-label":n("assetGen.closePreview"),onClick:r,children:s.jsx(ye,{})})]}),s.jsx("div",{className:["assetgen-lightbox__stage",e.kind==="edit"?"is-keyed":"",o?"is-zoomed":""].filter(Boolean).join(" "),tabIndex:o?0:void 0,children:a?s.jsx("video",{src:e.url||e.image,poster:e.thumb||void 0,controls:!0,autoPlay:!0,muted:!0,playsInline:!0,preload:"metadata","aria-label":x}):s.jsx("img",{src:e.url||e.image,alt:x})}),!a||m||K?s.jsxs("footer",{className:"assetgen-lightbox__footer",children:[K?s.jsx("button",{type:"button",className:"assetgen-lightbox__zoom assetgen-lightbox__curate",onClick:T,children:n("spriteCurator.open")}):null,m?s.jsx("button",{type:"button",className:"assetgen-lightbox__zoom assetgen-lightbox__keybtn",onClick:L,children:n("keying.open")}):null,a?null:s.jsxs("button",{type:"button",className:"assetgen-lightbox__zoom","aria-pressed":o,"aria-label":n(o?"assetGen.zoomOut":"assetGen.zoomIn"),onClick:()=>i(U=>!U),children:[s.jsx(xe,{zoomed:o}),s.jsx("span",{children:n(o?"assetGen.zoomOut":"assetGen.zoomIn")})]})]}):null]})]})}const H={tolerance:40,softness:10,spill:50};function ee(e,t,n){const o=128-.168736*e-.331264*t+.5*n,i=128+.5*e-.418688*t-.081312*n;return[o,i]}function te(e,t,n){return .299*e+.587*t+.114*n}function ke(e,t,n,o){const i=t*n,l=new Uint8Array(i);for(let r=0;r<i;r++)e[r]<o&&(l[r]=1);const f=new Uint8Array(i),u=new Int32Array(i);let d=0,h=0;const g=r=>{l[r]&&!f[r]&&(f[r]=1,u[h++]=r)};for(let r=0;r<t;r++)g(r),g((n-1)*t+r);for(let r=0;r<n;r++)g(r*t),g(r*t+t-1);for(;d<h;){const r=u[d++],v=r%t,a=(r-v)/t;v>0&&g(r-1),v<t-1&&g(r+1),a>0&&g(r-t),a<n-1&&g(r+t)}for(let r=0;r<i;r++)l[r]&&!f[r]&&(e[r]=o)}function ne(e){const{width:t,height:n,data:o}=e;if(t<2||n<2||o.length<t*n*4)throw new Error("colorKey: image too small or malformed pixel buffer");const i=4,l=[0,Math.max(0,t-i)],f=[0,Math.max(0,n-i)],u=[],d=[],h=[];for(const r of l)for(const v of f)for(let a=v;a<Math.min(v+i,n);a++)for(let m=r;m<Math.min(r+i,t);m++){const E=(a*t+m)*4;u.push(o[E]),d.push(o[E+1]),h.push(o[E+2])}const g=r=>{const v=[...r].sort((a,m)=>a-m);return v[Math.floor(v.length/2)]};return{r:g(u),g:g(d),b:g(h)}}function be(e,t){const{width:n,height:o,data:i}=e;if(!n||!o||i.length!==n*o*4)throw new Error("colorKey: empty or malformed pixel buffer");const l=Math.max(0,Math.min(100,t.tolerance)),f=Math.max(0,Math.min(50,t.softness)),u=Math.max(0,Math.min(100,t.spill))/100,d=l/100*120,h=d+f/100*120,[g,r]=ee(t.keyColor.r,t.keyColor.g,t.keyColor.b),v=t.keyColor.r,a=t.keyColor.g,m=t.keyColor.b,E=a>v+20&&a>m+20&&a>60,R=Math.max(v,a,m)-Math.min(v,a,m)<40,K=te(v,a,m),P=10+l/100*15,x=400,L=n*o,T=new Float32Array(L);for(let b=0;b<L;b++){const k=b*4,_=i[k],A=i[k+1],I=i[k+2],[F,C]=ee(_,A,I),w=Math.hypot(F-g,C-r);if(R)if(w>P)T[b]=x;else{const N=Math.abs(te(_,A,I)-K)*.8;T[b]=Math.hypot(w,N)}else T[b]=w}const U=new Float32Array(L);for(let b=0;b<o;b++)for(let k=0;k<n;k++){const _=b*n+k;if(T[_]>=x){U[_]=x;continue}let A=0,I=0;for(let F=-1;F<=1;F++){const C=b+F;if(!(C<0||C>=o))for(let w=-1;w<=1;w++){const N=k+w;if(N<0||N>=n)continue;const G=T[C*n+N];G>=x||(A+=G,I++)}}U[_]=I>0?A/I:x}R&&ke(U,n,o,h);const B=h+u*120,S=new Uint8ClampedArray(i.length);for(let b=0;b<L;b++){const k=b*4,_=i[k],A=i[k+1],I=i[k+2],F=i[k+3],C=U[b];let w;C<=d?w=0:C<h?w=Math.pow((C-d)/(h-d),1.5)*255:w=255;let N=_,G=A,$=I;if(E&&u>0&&w>0){const W=B>d?Math.max(0,1-(C-d)/(B-d)):0;if(W>0){const X=(_+I)/2,p=Math.max(0,A-X)*W*u;G=Math.round(A-p);const j=p*.3;N=Math.min(255,Math.round(_+j)),$=Math.min(255,Math.round(I+j))}}S[k]=N,S[k+1]=G,S[k+2]=$,S[k+3]=Math.min(F,Math.round(w))}if(E&&u>0){let b=new Uint8Array(L);for(let k=0;k<o;k++)for(let _=0;_<n;_++){const A=k*n+_;if(S[A*4+3]===0)continue;let I=!1;e:for(let F=-1;F<=1;F++){const C=k+F;if(!(C<0||C>=o))for(let w=-1;w<=1;w++){const N=_+w;if(!(N<0||N>=n)&&S[(C*n+N)*4+3]===0){I=!0;break e}}}I&&(b[A]=1)}for(let k=0;k<3;k++){const _=new Uint8Array(L);for(let A=0;A<o;A++)for(let I=0;I<n;I++){const F=A*n+I;if(b[F]){_[F]=1;continue}if(S[F*4+3]===0)continue;let C=!1;for(let w=-1;w<=1&&!C;w++){const N=A+w;if(!(N<0||N>=o))for(let G=-1;G<=1&&!C;G++){const $=I+G;$<0||$>=n||b[N*n+$]&&(C=!0)}}C&&(_[F]=1)}b=_}for(let k=0;k<L;k++){if(!b[k])continue;const _=k*4,A=S[_],I=S[_+1],F=S[_+2],C=Math.max(A,F);if(I>C-8){const w=Math.max(0,C-4),N=Math.max(0,I-w);S[_+1]=Math.max(0,I-N),S[_]=Math.min(255,A+Math.round(N*.25)),S[_+2]=Math.min(255,F+Math.round(N*.25))}}}return{width:n,height:o,data:S}}function _e(e){return Math.round(Math.max(0,Math.min(100,e))*.7)}function oe(e,t,n){const o=Math.max(0,Math.min(t-1,Math.round(e.x*(t-1))));return Math.max(0,Math.min(n-1,Math.round(e.y*(n-1))))*t+o}function ve(e,t,n,o){for(const i of n)if(Math.max(Math.abs(e[t]-i.r),Math.abs(e[t+1]-i.g),Math.abs(e[t+2]-i.b))<=o)return!0;return!1}function Me(e,t,n){const{width:o,height:i,data:l}=e,f=o*i,u=new Uint8Array(f),d=new Uint8Array(f),h=new Int32Array(f),g=t.map(a=>{const m=oe(a,o,i)*4;return{r:l[m],g:l[m+1],b:l[m+2]}});let r=0;const v=a=>{d[a]||(d[a]=1,l[a*4+3]!==0&&ve(l,a*4,g,n)&&(h[r++]=a))};for(const a of t)v(oe(a,o,i));for(;r>0;){const a=h[--r];u[a]=1;const m=a%o;m>0&&v(a-1),m<o-1&&v(a+1),a>=o&&v(a-o),a<f-o&&v(a+o)}return u}function we(e,t,n,o){if(n.length===0)return;if(e.width!==t.width||e.height!==t.height||e.data.length!==t.data.length)throw new Error("wandErase: target/source buffer size mismatch");const i=Me(t,n,_e(o));for(let l=0;l<i.length;l++)i[l]&&(e.data[l*4+3]=0)}const je={reach:4,spillMaxFraction:.005},re=18,Ce=180,Ne=40,Ee=2,J=0,Se=1,ie=2,le=3;function Q(e){const t=[e.r,e.g,e.b],n=[],o=[];for(let i=0;i<3;i++)if(t[i]>=192)n.push(i);else if(t[i]<64)o.push(i);else return null;return n.length===0||o.length===0?null:{keyed:n,unkeyed:o}}function V(e,t,n,o){const i=[e,t,n];let l=0;for(const u of o.keyed)l+=i[u];let f=0;for(const u of o.unkeyed)f+=i[u];return l/o.keyed.length-f/o.unkeyed.length}function Ae(e,t,n,o){return Math.hypot(e-o.r,t-o.g,n-o.b)}function ce(e,t,n,o,i,l){const f=Math.min(l/i,1),u=1-f;if(u<=0)return[0,0,0,0];const d=(h,g)=>Math.min(255,Math.max(0,Math.round((h-f*g)/u)));return[u,d(e,o.r),d(t,o.g),d(n,o.b)]}function Ie(e,t,n,o){const i=t*n,l=255,f=new Uint8Array(i).fill(l);let u=[];for(let h=0;h<i;h++)e[h]&&(f[h]=0,u.push(h));let d=0;for(;u.length>0&&d<o;){d++;const h=[];for(const g of u){const r=g%t,v=(g-r)/t;for(let a=-1;a<=1;a++){const m=v+a;if(!(m<0||m>=n))for(let E=-1;E<=1;E++){const y=r+E;if(y<0||y>=t)continue;const R=m*t+y;f[R]===l&&(f[R]=d,h.push(R))}}}u=h}return f}function Re(e,t,n,o){const i=e.width*e.height,l=new Uint8Array(i),f=new Uint8Array(i);for(let u=0;u<i;u++){const d=u*4;if(t.data[d+3]===0){l[u]=J,f[u]=1;continue}const h=e.data[d],g=e.data[d+1],r=e.data[d+2];V(h,g,r,o)<re?l[u]=Se:Ae(h,g,r,n)<=Ce?l[u]=ie:l[u]=le}return{classes:l,keyedMask:f}}function Ue(e,t,n,o,i,l,f,u){const d=t.width*t.height,h=new Uint8Array(d);for(let g=0;g<d;g++){const r=l[g];if(!(r>0&&r<=u))continue;const v=f[g];if(v===ie){if(r>Ee)continue}else if(v!==le)continue;const a=g*4,m=t.data[a],E=t.data[a+1],y=t.data[a+2],R=V(m,E,y,o),[K,P,x,L]=ce(m,E,y,n,i,R),T=Math.round(t.data[a+3]*K);T<=0?(e.data[a]=0,e.data[a+1]=0,e.data[a+2]=0,e.data[a+3]=0):(e.data[a]=P,e.data[a+1]=x,e.data[a+2]=L,e.data[a+3]=T),h[g]=1}return h}function Te(e,t,n,o,i,l,f,u){const{width:d,height:h}=t,g=d*h;let r=0;for(let y=0;y<g;y++)l[y]!==J&&r++;const v=Math.max(32,Math.round(r*u)),a=new Float32Array(g).fill(-1);for(let y=0;y<g;y++){if(f[y]||l[y]===J)continue;const R=y*4;if(e.data[R+3]===0)continue;const K=V(t.data[R],t.data[R+1],t.data[R+2],o);K>=re&&(a[y]=K)}const m=new Uint8Array(g),E=[];for(let y=0;y<g;y++){if(a[y]<0||m[y])continue;m[y]=1,E.length=0,E.push(y);const R=[];let K=-1;for(;E.length>0;){const P=E.pop();R.push(P),a[P]>K&&(K=a[P]);const x=P%d,L=(P-x)/d;for(let T=-1;T<=1;T++){const U=L+T;if(!(U<0||U>=h))for(let B=-1;B<=1;B++){const S=x+B;if(S<0||S>=d)continue;const b=U*d+S;a[b]>=0&&!m[b]&&(m[b]=1,E.push(b))}}}if(!(R.length>v)&&!(K<=Ne))for(const P of R){const x=P*4,L=t.data[x],T=t.data[x+1],U=t.data[x+2],[B,S,b,k]=ce(L,T,U,n,i,a[P]);B<=0||(e.data[x]=S,e.data[x+1]=b,e.data[x+2]=k)}}}function De(e,t,n){if(!e.width||!e.height||e.width!==t.width||e.height!==t.height||e.data.length!==t.data.length||e.data.length!==e.width*e.height*4)throw new Error("softUnmix: empty or mismatched pixel buffers");const o=Q(n.keyColor);if(!o)return;const i=V(n.keyColor.r,n.keyColor.g,n.keyColor.b,o);if(i<=0)return;const l=Math.max(0,Math.min(254,Math.round(n.reach))),{classes:f,keyedMask:u}=Re(t,e,n.keyColor,o);let d;if(l>0){const h=Ie(u,t.width,t.height,l);d=Ue(e,t,n.keyColor,o,i,h,f,l)}else d=new Uint8Array(t.width*t.height);n.spillMaxFraction>0&&Te(e,t,n.keyColor,o,i,f,d,n.spillMaxFraction)}function ae(e,t,n){const o=`/generated/${encodeURIComponent(t)}`;return{...e,image:o,url:o,filename:t,mediaType:n,kind:"edit",requestId:`derived:${t}`,createdAt:Date.now(),providerUrl:null}}function Be(){const{t:e}=se(),t=q(c=>c.keyingTarget),n=q(c=>c.setKeyingTarget),o=q(c=>c.addAssetGenDerivedItem),i=q(c=>c.selectedProjectId),l=q(c=>c.showToast),[f,u]=M.useState("loading"),[d,h]=M.useState(!1),[g,r]=M.useState(null),[v,a]=M.useState(null),[m,E]=M.useState(H.tolerance),[y,R]=M.useState(H.softness),[K,P]=M.useState(H.spill),[x,L]=M.useState(null),[T,U]=M.useState("erase"),[B,S]=M.useState([]),[b,k]=M.useState(!0),_=M.useRef(null),A=M.useRef(null),I=M.useRef(0),F=M.useRef(null),C=M.useRef(null),w=M.useCallback(()=>{F.current?.(),F.current=null},[]),N=t?.mediaType==="video",G=t?N&&t.filename?`/api/video/frame?file=${encodeURIComponent(t.filename)}&position=0`:t.url||t.image:null;M.useEffect(()=>{if(!G)return;let c=!0;u("loading"),_.current=null,L(null),S([]),U("erase");const p=new Image;return p.onload=()=>{if(c)try{const j=document.createElement("canvas");j.width=p.naturalWidth,j.height=p.naturalHeight;const D=j.getContext("2d");if(!D)throw new Error("no 2d context");D.drawImage(p,0,0);const O=D.getImageData(0,0,j.width,j.height);_.current=O,L(ne(O)),u("ready")}catch{c&&u("error")}},p.onerror=()=>{c&&u("error")},p.src=G,()=>{c=!1,p.onload=null,p.onerror=null}},[G]),M.useEffect(()=>(C.current=t?.filename??null,w(),h(!1),a(null),r(null),w),[w,t?.filename]),M.useEffect(()=>{if(!(f!=="ready"||!x))return cancelAnimationFrame(I.current),I.current=requestAnimationFrame(()=>{const c=_.current,p=A.current;if(!(!c||!p))try{const j=be({width:c.width,height:c.height,data:c.data},{keyColor:x,tolerance:m,softness:y,spill:K});b&&Q(x)&&De(j,{width:c.width,height:c.height,data:c.data},{keyColor:x,...je}),B.length>0&&we(j,{width:c.width,height:c.height,data:c.data},B,m),p.width=j.width,p.height=j.height;const D=p.getContext("2d");if(!D)return;const O=D.createImageData(j.width,j.height);O.data.set(j.data),D.putImageData(O,0,0)}catch{u("error")}}),()=>cancelAnimationFrame(I.current)},[f,x,m,y,K,B,b]);const $=M.useCallback(c=>{const p=_.current,j=A.current;if(!p||!j)return;const D=j.getBoundingClientRect(),O=Math.max(0,Math.min(1,(c.clientX-D.left)/D.width)),Y=Math.max(0,Math.min(1,(c.clientY-D.top)/D.height));if(T==="erase"&&!N){S(de=>[...de,{x:O,y:Y}]);return}const z=Math.floor((c.clientX-D.left)/D.width*p.width),ue=Math.floor((c.clientY-D.top)/D.height*p.height),Z=(Math.max(0,Math.min(p.height-1,ue))*p.width+Math.max(0,Math.min(p.width-1,z)))*4;L({r:p.data[Z],g:p.data[Z+1],b:p.data[Z+2]})},[T,N]),W=M.useCallback(()=>{const c=A.current;c&&c.toBlob(p=>{if(!p)return;const j=URL.createObjectURL(p),D=document.createElement("a");D.href=j,D.download=`${(t?.filename||"asset").replace(/\.[a-z]+$/i,"")}-keyed.png`,D.click(),URL.revokeObjectURL(j)},"image/png")},[t]),X=M.useCallback(()=>{const c=A.current;if(!(!c||!t?.filename||d)){if(h(!0),r(null),N){fe({source:t.filename,keyParams:{tolerance:m,softness:y,keyColor:x??void 0},projectId:i,name:`${(t.prompt||"asset").trim().slice(0,60)} (keyed)`}).then(({requestId:p})=>{if(C.current!==t.filename)return;a(0),w();const j=ge(p,null,(D,O)=>{const Y=O&&typeof O=="object"?O:{};if(D==="keying-progress"){const z=Y.outTimeMs;a(typeof z=="number"&&Number.isFinite(z)?z:0)}else if(D==="keying-done"){w();const z=Y.filePath;if(typeof z=="string"&&z.trim()){o(ae(t,z.trim(),"video")),h(!1),a(null),l(e("keying.videoSaved")),n(null);return}h(!1),a(null),r(e("keying.saveError"))}else D==="keying-error"&&(w(),h(!1),a(null),r(typeof Y.error=="string"&&Y.error?Y.error:e("keying.saveError")))});F.current=j}).catch(p=>{C.current===t.filename&&(h(!1),r(p instanceof Error?p.message:e("keying.saveError")))});return}c.toBlob(p=>{if(C.current===t.filename){if(!p){h(!1),r(e("keying.saveError"));return}me(p,{source:t.filename,projectId:i,name:`${(t.prompt||"asset").trim().slice(0,60)} (keyed)`,meta:{keyParams:{tolerance:m,softness:y,spill:K},prompt:t.prompt}}).then(({filePath:j})=>{if(C.current===t.filename){if(typeof j!="string"||!j.trim())throw new Error(e("keying.saveError"));o(ae(t,j.trim(),"image")),l(e("keying.saved")),n(null)}}).catch(j=>{C.current===t.filename&&r(j instanceof Error?j.message:e("keying.saveError"))}).finally(()=>{C.current===t.filename&&h(!1)})}},"image/png")}},[t,d,N,x,i,m,y,K,w,o,l,n,e]);return M.useEffect(()=>{const c=p=>{p.key==="Escape"&&n(null)};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[n]),t?s.jsx("div",{className:"assetgen-popup-backdrop",onClick:()=>n(null),children:s.jsxs("div",{className:"keying-panel",role:"dialog","aria-modal":"true","aria-label":e("keying.title"),onClick:c=>c.stopPropagation(),children:[s.jsxs("header",{className:"keying-panel__head",children:[s.jsx("h2",{children:e("keying.title")}),x?s.jsxs("span",{className:"keying-panel__key",title:e("keying.keyColor"),children:[N?null:s.jsxs("span",{className:"keying-panel__modes",role:"group","aria-label":e("keying.clickMode"),children:[s.jsx("button",{type:"button",className:T==="erase"?"is-active":"","aria-pressed":T==="erase",onClick:()=>U("erase"),children:e("keying.modeErase")}),s.jsx("button",{type:"button",className:T==="pick"?"is-active":"","aria-pressed":T==="pick",onClick:()=>U("pick"),children:e("keying.modePick")})]}),B.length>0?s.jsx("button",{type:"button",className:"keying-panel__undo",onClick:()=>S(c=>c.slice(0,-1)),children:e("keying.undoClick",{count:String(B.length)})}):null,s.jsx("span",{className:"assetgen-bg-picker__swatch",style:{background:`rgb(${x.r},${x.g},${x.b})`},"aria-hidden":"true"}),s.jsx("span",{className:"keying-panel__hint",children:e(T==="erase"&&!N?"keying.eraseHint":"keying.pickHint")})]}):null]}),s.jsx("div",{className:"keying-panel__compare","aria-busy":f==="loading",children:f==="error"?s.jsxs("div",{className:"keying-panel__error",role:"alert",children:[s.jsx("p",{children:e("keying.loadError")}),s.jsx("button",{type:"button",onClick:()=>n(null),children:e("project.close")})]}):s.jsxs(s.Fragment,{children:[s.jsxs("figure",{className:"keying-panel__preview",children:[s.jsx("figcaption",{className:"keying-panel__preview-label",children:e("keying.original")}),s.jsx("div",{className:"keying-panel__stage keying-panel__stage--original",children:s.jsx("img",{src:G??"",alt:e("keying.originalAlt")})})]}),s.jsxs("figure",{className:"keying-panel__preview",children:[s.jsx("figcaption",{className:"keying-panel__preview-label",children:e("keying.removed")}),s.jsxs("div",{className:"keying-panel__stage",children:[s.jsx("canvas",{ref:A,className:"keying-panel__canvas",onClick:$,"aria-label":e("keying.previewAlt")}),f==="loading"?s.jsx("span",{className:"keying-panel__loading",role:"status",children:e("keying.previewLoading")}):null]})]})]})}),s.jsxs("details",{className:"keying-panel__advanced",children:[s.jsx("summary",{children:e("keying.advanced")}),s.jsxs("div",{className:"keying-panel__controls",children:[s.jsxs("label",{children:[e("keying.tolerance")," ",s.jsx("output",{children:m}),s.jsx("input",{type:"range",min:0,max:100,value:m,onChange:c=>E(Number(c.target.value))})]}),s.jsxs("label",{children:[e("keying.softness")," ",s.jsx("output",{children:y}),s.jsx("input",{type:"range",min:0,max:50,value:y,onChange:c=>R(Number(c.target.value))})]}),s.jsxs("label",{children:[e("keying.spill")," ",s.jsx("output",{children:K}),s.jsx("input",{type:"range",min:0,max:100,value:K,onChange:c=>P(Number(c.target.value))})]}),s.jsxs("label",{className:"keying-panel__unmix",children:[s.jsx("input",{type:"checkbox",checked:b,disabled:!x||!Q(x),onChange:c=>k(c.target.checked)}),e("keying.unmix"),s.jsx("span",{className:"keying-panel__hint",children:e("keying.unmixHint")})]}),s.jsx("button",{type:"button",className:"keying-panel__reset",onClick:()=>{E(H.tolerance),R(H.softness),P(H.spill),S([]),k(!0),_.current&&L(ne(_.current))},children:e("keying.reset")})]})]}),s.jsxs("footer",{className:"keying-panel__actions",children:[g?s.jsx("span",{className:"keying-panel__save-error",role:"alert",children:g}):null,s.jsx("button",{type:"button",className:"assetgen-generate",disabled:f!=="ready"||d||!t.filename,onClick:X,children:d?v!==null?e("keying.videoKeying",{seconds:String(Math.round(v/1e3))}):e("keying.saving"):e(N?"keying.videoSave":"keying.save")}),N?null:s.jsx("button",{type:"button",className:"assetgen-popup__close",disabled:f!=="ready",onClick:W,children:e("keying.download")}),s.jsx("button",{type:"button",className:"assetgen-popup__close",onClick:()=>n(null),children:e("project.close")})]})]})}):null}export{Le as A,Be as K};