ima2-gen 1.1.13 → 1.1.14

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 (53) hide show
  1. package/README.md +10 -1
  2. package/bin/commands/doctor.js +195 -0
  3. package/bin/commands/doctor.ts +202 -0
  4. package/bin/ima2.js +3 -105
  5. package/bin/ima2.ts +3 -109
  6. package/config.js +1 -0
  7. package/config.ts +5 -0
  8. package/docs/CLI.md +36 -0
  9. package/docs/FAQ.ko.md +82 -2
  10. package/docs/FAQ.md +85 -2
  11. package/docs/PROMPT_STUDIO.ko.md +111 -0
  12. package/docs/PROMPT_STUDIO.md +115 -0
  13. package/docs/README.ko.md +8 -1
  14. package/docs/migration/runtime-test-inventory.md +6 -1
  15. package/lib/agentRuntime.js +9 -2
  16. package/lib/agentRuntime.ts +8 -2
  17. package/lib/errorClassify.js +1 -1
  18. package/lib/errorClassify.ts +1 -1
  19. package/lib/generationErrors.js +121 -23
  20. package/lib/generationErrors.ts +100 -13
  21. package/lib/responsesDoctor.js +386 -0
  22. package/lib/responsesDoctor.ts +456 -0
  23. package/lib/responsesErrors.js +57 -0
  24. package/lib/responsesErrors.ts +83 -0
  25. package/lib/responsesFallback.js +72 -0
  26. package/lib/responsesFallback.ts +114 -0
  27. package/lib/responsesImageAdapter.js +121 -174
  28. package/lib/responsesImageAdapter.ts +136 -211
  29. package/lib/responsesParse.js +324 -0
  30. package/lib/responsesParse.ts +452 -0
  31. package/lib/responsesTools.js +15 -0
  32. package/lib/responsesTools.ts +28 -0
  33. package/package.json +1 -1
  34. package/routes/edit.js +26 -1
  35. package/routes/edit.ts +26 -1
  36. package/routes/generate.js +40 -0
  37. package/routes/generate.ts +47 -0
  38. package/ui/dist/.vite/manifest.json +12 -12
  39. package/ui/dist/assets/{AgentWorkspace-BJe9yxPA.js → AgentWorkspace-B6YNOZHi.js} +1 -1
  40. package/ui/dist/assets/{CardNewsWorkspace-BBLdwzYU.js → CardNewsWorkspace-EFVeg4l_.js} +1 -1
  41. package/ui/dist/assets/{NodeCanvas-BSZ527J4.js → NodeCanvas-iM6yjHvO.js} +1 -1
  42. package/ui/dist/assets/{PromptBuilderPanel-Y2VygFc0.js → PromptBuilderPanel-C3GdLDCl.js} +1 -1
  43. package/ui/dist/assets/{PromptImportDialog-C6lFV-LL.js → PromptImportDialog-DS9vrc_w.js} +2 -2
  44. package/ui/dist/assets/{PromptImportDiscoverySection-D8YJFhND.js → PromptImportDiscoverySection-DHFEt_FA.js} +1 -1
  45. package/ui/dist/assets/{PromptImportFolderSection-ywfcQolW.js → PromptImportFolderSection-BQxb1zs5.js} +1 -1
  46. package/ui/dist/assets/{PromptLibraryPanel-fk4KmrGy.js → PromptLibraryPanel-NhMKVGfU.js} +2 -2
  47. package/ui/dist/assets/{SettingsWorkspace-DL5vhAHQ.js → SettingsWorkspace-FjKjaDqj.js} +1 -1
  48. package/ui/dist/assets/index-BAN6lKgf.js +28 -0
  49. package/ui/dist/assets/{index-BLx55BOg.js → index-BbFZyM92.js} +1 -1
  50. package/ui/dist/assets/index-DK1faG9Z.css +1 -0
  51. package/ui/dist/index.html +2 -2
  52. package/ui/dist/assets/index-ByViUJfx.css +0 -1
  53. package/ui/dist/assets/index-Ci36vcFD.js +0 -28
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PromptImportDiscoverySection-D8YJFhND.js","assets/index-Ci36vcFD.js","assets/index-ByViUJfx.css","assets/PromptImportFolderSection-ywfcQolW.js"])))=>i.map(i=>d[i]);
2
- import{u as G,j as e,b as ce,a as o,D as K,E as M,F as pe,G as de,H as me,_ as J}from"./index-Ci36vcFD.js";function ue(i){const t=i.source;if(!t)return"";if(t.owner&&t.repo){const u=t.ref?`@${t.ref}`:"",s=t.path?`:${t.path}`:"";return`${t.owner}/${t.repo}${u}${s}`}return t.filename??t.sourceId??t.kind??""}function he(i,t){const u=i.tags.find(s=>s.toLowerCase().startsWith(t));return u?u.slice(t.length):null}function be(i){return i.tags.includes("attribution-required")||i.warnings?.some(t=>t.toLowerCase().includes("attribution"))===!0}function ge({candidate:i,selected:t,disabled:u=!1,onToggleSelected:s,onImportOne:g}){const{t:n}=G();if(!i)return e.jsx("aside",{className:"prompt-import-dialog__candidate-preview","aria-label":n("promptLibrary.previewPrompt"),children:e.jsx("div",{className:"prompt-import-dialog__empty",children:n("promptLibrary.importPreviewEmpty")})});const x=ue(i),v=he(i,"license:"),h=be(i);return e.jsxs("aside",{className:"prompt-import-dialog__candidate-preview","aria-label":n("promptLibrary.previewPrompt"),children:[e.jsxs("div",{className:"prompt-import-dialog__preview-header",children:[e.jsxs("div",{children:[e.jsx("span",{children:n("promptLibrary.previewPrompt")}),e.jsx("h4",{children:i.name})]}),e.jsx("button",{type:"button",onClick:()=>g(i),disabled:u,children:n("promptLibrary.importThisPrompt")})]}),e.jsxs("label",{className:"prompt-import-dialog__preview-select",children:[e.jsx("input",{type:"checkbox",checked:t,disabled:u,onChange:l=>s(i.id,l.target.checked)}),e.jsx("span",{children:n(t?"promptLibrary.selectedPrompt":"promptLibrary.selectPrompt")})]}),e.jsxs("div",{className:"prompt-import-dialog__preview-field",children:[e.jsx("strong",{children:n("promptLibrary.promptText")}),e.jsx("p",{children:i.text})]}),i.tags.length>0?e.jsxs("div",{className:"prompt-import-dialog__preview-field",children:[e.jsx("strong",{children:n("promptLibrary.tags")}),e.jsx("div",{className:"prompt-import-dialog__preview-chips",children:i.tags.map(l=>e.jsx("em",{children:l},l))})]}):null,i.warnings?.length?e.jsxs("div",{className:"prompt-import-dialog__preview-field",children:[e.jsx("strong",{children:n("promptLibrary.compatibilityWarnings")}),e.jsx("div",{className:"prompt-import-dialog__preview-chips",children:i.warnings.map(l=>e.jsx("b",{children:l},l))})]}):null,x||v||h?e.jsxs("div",{className:"prompt-import-dialog__preview-field",children:[e.jsx("strong",{children:n("promptLibrary.sourceDetails")}),x?e.jsx("small",{children:x}):null,v?e.jsxs("small",{children:[n("promptLibrary.license"),": ",v]}):null,h?e.jsx("small",{children:n("promptLibrary.attributionRequired")}):null]}):null]})}function fe(i){const t=i.source;if(!t)return"";if(t.owner&&t.repo){const u=t.path?` · ${t.path}`:"";return`github · ${t.owner}/${t.repo}${u}`}return t.filename?t.filename:t.sourceId?t.sourceId:t.kind??""}function ye(i){const t=i.replace(/\s+/g," ").trim();return t.length>220?`${t.slice(0,220)}...`:t}function xe({candidates:i,selectedIds:t,activeCandidateId:u,busy:s=!1,onSelectCandidate:g,onToggleSelected:n,onSelectAll:x,onClearSelection:v,onImportOne:h}){const{t:l}=G();if(i.length===0)return e.jsx("section",{className:"prompt-import-dialog__results","aria-label":l("promptLibrary.searchResults"),children:e.jsx("div",{className:"prompt-import-dialog__empty",children:l("promptLibrary.importPreviewEmpty")})});const f=i.every(p=>t.has(p.id));return e.jsxs("section",{className:"prompt-import-dialog__results","aria-label":l("promptLibrary.searchResults"),children:[e.jsxs("header",{className:"prompt-import-dialog__results-header",children:[e.jsx("strong",{children:l("promptLibrary.searchResultsHeader",{count:i.length})}),e.jsxs("div",{className:"prompt-import-dialog__results-header-actions",children:[e.jsx("button",{type:"button",onClick:x,disabled:f,children:l("promptLibrary.selectAllCandidates")}),e.jsx("button",{type:"button",onClick:v,disabled:t.size===0,children:l("promptLibrary.clearCandidateSelection")})]})]}),i.map(p=>{const y=t.has(p.id),S=u===p.id,j=fe(p);return e.jsxs("article",{className:`prompt-import-dialog__result-card${S?" active":""}`,children:[e.jsxs("button",{type:"button",className:"prompt-import-dialog__result-main",onClick:()=>g(p),children:[e.jsx("strong",{children:p.name}),e.jsx("span",{children:ye(p.text)}),j?e.jsx("small",{children:j}):null]}),e.jsxs("div",{className:"prompt-import-dialog__result-meta",children:[p.warnings?.slice(0,2).map(b=>e.jsx("b",{className:"prompt-import-dialog__hint-chip",children:b},b)),p.tags.slice(0,4).map(b=>e.jsx("em",{children:b},b))]}),e.jsxs("div",{className:"prompt-import-dialog__result-actions",children:[e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:y,onChange:b=>n(p.id,b.target.checked)}),e.jsx("span",{children:l(y?"promptLibrary.selectedPrompt":"promptLibrary.selectPrompt")})]}),e.jsx("button",{type:"button",onClick:()=>g(p),children:l("promptLibrary.previewPrompt")}),e.jsx("button",{type:"button",onClick:()=>h(p),disabled:s,children:l("promptLibrary.importThisPrompt")})]})]},p.id)})]})}const ve=o.lazy(()=>J(()=>import("./PromptImportDiscoverySection-D8YJFhND.js"),__vite__mapDeps([0,1,2])).then(i=>({default:i.PromptImportDiscoverySection}))),je=o.lazy(()=>J(()=>import("./PromptImportFolderSection-ywfcQolW.js"),__vite__mapDeps([3,1,2])).then(i=>({default:i.PromptImportFolderSection}))),_e=/\.(txt|md|markdown)$/i;function Se({open:i,onClose:t,onImported:u}){const{t:s}=G(),g=ce(r=>r.showToast),n=o.useRef(null),x=o.useRef(null),v=o.useRef(null),[h,l]=o.useState(""),[f,p]=o.useState([]),[y,S]=o.useState(new Set),[j,b]=o.useState(null),[_,L]=o.useState(!1),[H,m]=o.useState(null),[X,N]=o.useState(!1),[Y,A]=o.useState([]),[$,Z]=o.useState(""),[P,z]=o.useState(new Set),[O,E]=o.useState(!1),[V,I]=o.useState([]),[C,W]=o.useState("curated"),[q,ee]=o.useState(!1),B=f.length>0,D=!B||q;o.useEffect(()=>{if(i)return v.current=document.activeElement,window.setTimeout(()=>x.current?.focus(),0),()=>v.current?.focus()},[i]);const re=o.useCallback(async()=>{const r=await K();A(r.sources),z(new Set)},[]);o.useEffect(()=>{if(!i)return;let r=!1;return K().then(a=>{r||(A(a.sources),z(new Set))}).catch(()=>{r||A([])}),()=>{r=!0}},[i]);const w=o.useCallback(r=>{p(a=>{const c=new Set(a.map(k=>k.id)),d=[...a];for(const k of r)c.has(k.id)||d.push(k);return b(k=>k??d[0]?.id??null),d})},[]),R=o.useCallback(async r=>{const a=r.filter(c=>_e.test(c.name));if(a.length===0){m(s("promptLibrary.importNoValidFiles"));return}L(!0),m(null);try{const c=[];for(const d of a)c.push(await M({source:{kind:"local",filename:d.name,text:await d.text()}}));w(c.flatMap(d=>d.candidates))}catch(c){m(c instanceof Error?c.message:s("promptLibrary.importFailed"))}finally{L(!1)}},[w,s]),te=o.useCallback(async()=>{if(h.trim()){L(!0),m(null);try{const r=await M({source:{kind:"github",input:h.trim()}});w(r.candidates)}catch(r){m(r instanceof Error?r.message:s("promptLibrary.importFailed"))}finally{L(!1)}}},[w,h,s]),se=o.useCallback(async()=>{E(!0),m(null),I([]);try{const r=await pe({q:$.trim(),sourceIds:[...P]});w(r.results),I(r.warnings),r.results.length===0&&m(s("promptLibrary.noCuratedResults"))}catch(r){m(r instanceof Error?r.message:s("promptLibrary.importFailed"))}finally{E(!1)}},[w,$,P,s]),ie=o.useCallback(async r=>{E(!0),m(null),I([]);try{const a=await de({sourceId:r});I(a.warnings),g(s("promptLibrary.curatedRefreshed",{count:a.candidateCount}))}catch(a){m(a instanceof Error?a.message:s("promptLibrary.importFailed"))}finally{E(!1)}},[g,s]),Q=o.useCallback((r,a)=>{S(c=>{const d=new Set(c);return a?d.add(r):d.delete(r),d})},[]),oe=o.useCallback(()=>{S(new Set(f.map(r=>r.id)))},[f]),ae=o.useCallback(()=>{S(new Set)},[]),F=o.useCallback(async r=>{if(r.length===0){m(s("promptLibrary.importSelectAtLeastOne"));return}L(!0),m(null);try{const a=await me({candidates:r});await u(),g(s("promptLibrary.imported",{count:a.promptsImported})),t()}catch(a){m(a instanceof Error?a.message:s("promptLibrary.importFailed"))}finally{L(!1)}},[t,u,g,s]),le=o.useCallback(async()=>{const r=f.filter(a=>y.has(a.id));await F(r)},[f,F,y]),U=o.useCallback(r=>{S(new Set([r.id])),F([r])},[F]),ne=o.useCallback(r=>{const a=Array.from(r.target.files??[]);a.length>0&&R(a),r.target.value=""},[R]),T=o.useCallback(r=>{r.preventDefault(),r.stopPropagation(),N(!1);const a=Array.from(r.dataTransfer?.files??[]);a.length>0&&R(a)},[R]);return o.useEffect(()=>{if(!i)return;const r=c=>{c.preventDefault(),N(!0)},a=c=>{c.relatedTarget===null&&N(!1)};return window.addEventListener("dragover",r),window.addEventListener("dragleave",a),window.addEventListener("drop",T),()=>{window.removeEventListener("dragover",r),window.removeEventListener("dragleave",a),window.removeEventListener("drop",T)}},[T,i]),i?e.jsxs("div",{className:"prompt-import-dialog",role:"presentation",children:[e.jsx("div",{className:"prompt-import-dialog__backdrop",onClick:t}),e.jsxs("div",{ref:x,className:"prompt-import-dialog__panel",role:"dialog","aria-modal":"true","aria-labelledby":"prompt-import-title",tabIndex:-1,onKeyDown:r=>{r.key==="Escape"&&t()},children:[e.jsxs("div",{className:"prompt-import-dialog__header",children:[e.jsx("h3",{id:"prompt-import-title",children:s("promptLibrary.importTitle")}),e.jsx("button",{type:"button",onClick:t,"aria-label":s("common.close"),children:"×"})]}),D&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`prompt-import-dialog__dropzone${X?" active":""}`,onDragOver:r=>{r.preventDefault(),N(!0)},onDragLeave:()=>N(!1),onDrop:T,children:[e.jsx("strong",{children:s("promptLibrary.importDropTitle")}),e.jsx("span",{children:s("promptLibrary.importDropHint")}),e.jsx("button",{type:"button",onClick:()=>n.current?.click(),children:s("promptLibrary.importChooseFiles")}),e.jsx("input",{ref:n,className:"prompt-library-panel__file-input",type:"file",accept:".txt,.md,.markdown,text/plain,text/markdown",multiple:!0,onChange:ne})]}),e.jsxs("div",{className:"prompt-import-dialog__github",children:[e.jsx("label",{htmlFor:"prompt-import-github",children:s("promptLibrary.importGithubLabel")}),e.jsxs("div",{children:[e.jsx("input",{id:"prompt-import-github",type:"text",value:h,onChange:r=>l(r.target.value),placeholder:"owner/repo:path/to/prompts.md"}),e.jsx("button",{type:"button",onClick:()=>{te()},disabled:_||!h.trim(),children:s("promptLibrary.importPreview")})]})]}),e.jsx(o.Suspense,{fallback:null,children:e.jsx(je,{input:h,disabled:_,onCandidates:w,onError:m})}),e.jsxs("div",{className:"prompt-import-dialog__source-tabs",role:"tablist","aria-label":s("promptLibrary.curatedSources"),children:[e.jsx("button",{type:"button",className:C==="curated"?"active":"",onClick:()=>W("curated"),"aria-pressed":C==="curated",children:s("promptLibrary.curatedSources")}),e.jsx("button",{type:"button",className:C==="discovery"?"active":"",onClick:()=>W("discovery"),"aria-pressed":C==="discovery",children:s("promptLibrary.discovery")})]})]}),(D?C==="curated":!0)&&e.jsxs("div",{className:"prompt-import-dialog__curated",children:[D&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"prompt-import-dialog__section-title",children:[e.jsx("strong",{children:s("promptLibrary.curatedSources")}),e.jsx("span",{children:s("promptLibrary.curatedSourcesHint")})]}),e.jsx("div",{className:"prompt-import-dialog__source-list",children:Y.filter(r=>r.trustTier!=="manual-review").map(r=>e.jsxs("label",{className:"prompt-import-dialog__source",children:[e.jsx("input",{type:"checkbox",checked:P.has(r.id),onChange:a=>{z(c=>{const d=new Set(c);return a.target.checked?d.add(r.id):d.delete(r.id),d})}}),e.jsxs("span",{children:[e.jsx("strong",{children:r.displayName}),e.jsxs("small",{children:[r.licenseSpdx," · ",r.trustTier]})]}),e.jsx("button",{type:"button",onClick:()=>{ie(r.id)},disabled:O,children:s("promptLibrary.refreshSource")})]},r.id))})]}),e.jsxs("div",{className:"prompt-import-dialog__search-results",children:[e.jsx("input",{type:"text",value:$,onChange:r=>Z(r.target.value),placeholder:s("promptLibrary.curatedSearchPlaceholder"),"aria-label":s("promptLibrary.curatedSearch")}),e.jsx("button",{type:"button",onClick:()=>{se()},disabled:O||P.size===0,children:s(O?"common.loading":"promptLibrary.curatedSearch")})]}),V.length>0?e.jsx("div",{className:"prompt-import-dialog__warning",children:V.slice(0,3).join(" · ")}):null]}),D&&C==="discovery"&&e.jsx(o.Suspense,{fallback:e.jsx("div",{className:"prompt-import-dialog__empty",children:s("common.loading")}),children:e.jsx(ve,{disabled:_,onError:m,onSourcesChanged:re})}),B&&!q&&e.jsx("button",{type:"button",className:"prompt-import-dialog__add-source-toggle",onClick:()=>ee(!0),children:s("promptLibrary.addAnotherSource")}),H?e.jsx("div",{className:"prompt-import-dialog__error",role:"alert",children:H}):null,e.jsxs("div",{className:"prompt-import-dialog__workspace","aria-live":"polite",children:[e.jsx(xe,{candidates:f,selectedIds:y,activeCandidateId:j,busy:_,onSelectCandidate:r=>b(r.id),onToggleSelected:Q,onSelectAll:oe,onClearSelection:ae,onImportOne:U}),e.jsx(ge,{candidate:f.find(r=>r.id===j)??null,selected:j?y.has(j):!1,disabled:_,onToggleSelected:Q,onImportOne:U})]}),e.jsxs("div",{className:"prompt-import-dialog__footer",children:[e.jsx("button",{type:"button",onClick:t,children:s("common.cancel")}),e.jsx("button",{type:"button",onClick:()=>{le()},disabled:_||y.size===0,children:_?s("common.loading"):s("promptLibrary.importSelected",{count:y.size})})]})]})]}):null}export{Se as PromptImportDialog};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PromptImportDiscoverySection-DHFEt_FA.js","assets/index-BAN6lKgf.js","assets/index-DK1faG9Z.css","assets/PromptImportFolderSection-BQxb1zs5.js"])))=>i.map(i=>d[i]);
2
+ import{u as G,j as e,b as ce,a as o,D as K,E as M,F as pe,G as de,H as me,_ as J}from"./index-BAN6lKgf.js";function ue(i){const t=i.source;if(!t)return"";if(t.owner&&t.repo){const u=t.ref?`@${t.ref}`:"",s=t.path?`:${t.path}`:"";return`${t.owner}/${t.repo}${u}${s}`}return t.filename??t.sourceId??t.kind??""}function he(i,t){const u=i.tags.find(s=>s.toLowerCase().startsWith(t));return u?u.slice(t.length):null}function be(i){return i.tags.includes("attribution-required")||i.warnings?.some(t=>t.toLowerCase().includes("attribution"))===!0}function ge({candidate:i,selected:t,disabled:u=!1,onToggleSelected:s,onImportOne:g}){const{t:n}=G();if(!i)return e.jsx("aside",{className:"prompt-import-dialog__candidate-preview","aria-label":n("promptLibrary.previewPrompt"),children:e.jsx("div",{className:"prompt-import-dialog__empty",children:n("promptLibrary.importPreviewEmpty")})});const x=ue(i),v=he(i,"license:"),h=be(i);return e.jsxs("aside",{className:"prompt-import-dialog__candidate-preview","aria-label":n("promptLibrary.previewPrompt"),children:[e.jsxs("div",{className:"prompt-import-dialog__preview-header",children:[e.jsxs("div",{children:[e.jsx("span",{children:n("promptLibrary.previewPrompt")}),e.jsx("h4",{children:i.name})]}),e.jsx("button",{type:"button",onClick:()=>g(i),disabled:u,children:n("promptLibrary.importThisPrompt")})]}),e.jsxs("label",{className:"prompt-import-dialog__preview-select",children:[e.jsx("input",{type:"checkbox",checked:t,disabled:u,onChange:l=>s(i.id,l.target.checked)}),e.jsx("span",{children:n(t?"promptLibrary.selectedPrompt":"promptLibrary.selectPrompt")})]}),e.jsxs("div",{className:"prompt-import-dialog__preview-field",children:[e.jsx("strong",{children:n("promptLibrary.promptText")}),e.jsx("p",{children:i.text})]}),i.tags.length>0?e.jsxs("div",{className:"prompt-import-dialog__preview-field",children:[e.jsx("strong",{children:n("promptLibrary.tags")}),e.jsx("div",{className:"prompt-import-dialog__preview-chips",children:i.tags.map(l=>e.jsx("em",{children:l},l))})]}):null,i.warnings?.length?e.jsxs("div",{className:"prompt-import-dialog__preview-field",children:[e.jsx("strong",{children:n("promptLibrary.compatibilityWarnings")}),e.jsx("div",{className:"prompt-import-dialog__preview-chips",children:i.warnings.map(l=>e.jsx("b",{children:l},l))})]}):null,x||v||h?e.jsxs("div",{className:"prompt-import-dialog__preview-field",children:[e.jsx("strong",{children:n("promptLibrary.sourceDetails")}),x?e.jsx("small",{children:x}):null,v?e.jsxs("small",{children:[n("promptLibrary.license"),": ",v]}):null,h?e.jsx("small",{children:n("promptLibrary.attributionRequired")}):null]}):null]})}function fe(i){const t=i.source;if(!t)return"";if(t.owner&&t.repo){const u=t.path?` · ${t.path}`:"";return`github · ${t.owner}/${t.repo}${u}`}return t.filename?t.filename:t.sourceId?t.sourceId:t.kind??""}function ye(i){const t=i.replace(/\s+/g," ").trim();return t.length>220?`${t.slice(0,220)}...`:t}function xe({candidates:i,selectedIds:t,activeCandidateId:u,busy:s=!1,onSelectCandidate:g,onToggleSelected:n,onSelectAll:x,onClearSelection:v,onImportOne:h}){const{t:l}=G();if(i.length===0)return e.jsx("section",{className:"prompt-import-dialog__results","aria-label":l("promptLibrary.searchResults"),children:e.jsx("div",{className:"prompt-import-dialog__empty",children:l("promptLibrary.importPreviewEmpty")})});const f=i.every(p=>t.has(p.id));return e.jsxs("section",{className:"prompt-import-dialog__results","aria-label":l("promptLibrary.searchResults"),children:[e.jsxs("header",{className:"prompt-import-dialog__results-header",children:[e.jsx("strong",{children:l("promptLibrary.searchResultsHeader",{count:i.length})}),e.jsxs("div",{className:"prompt-import-dialog__results-header-actions",children:[e.jsx("button",{type:"button",onClick:x,disabled:f,children:l("promptLibrary.selectAllCandidates")}),e.jsx("button",{type:"button",onClick:v,disabled:t.size===0,children:l("promptLibrary.clearCandidateSelection")})]})]}),i.map(p=>{const y=t.has(p.id),S=u===p.id,j=fe(p);return e.jsxs("article",{className:`prompt-import-dialog__result-card${S?" active":""}`,children:[e.jsxs("button",{type:"button",className:"prompt-import-dialog__result-main",onClick:()=>g(p),children:[e.jsx("strong",{children:p.name}),e.jsx("span",{children:ye(p.text)}),j?e.jsx("small",{children:j}):null]}),e.jsxs("div",{className:"prompt-import-dialog__result-meta",children:[p.warnings?.slice(0,2).map(b=>e.jsx("b",{className:"prompt-import-dialog__hint-chip",children:b},b)),p.tags.slice(0,4).map(b=>e.jsx("em",{children:b},b))]}),e.jsxs("div",{className:"prompt-import-dialog__result-actions",children:[e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:y,onChange:b=>n(p.id,b.target.checked)}),e.jsx("span",{children:l(y?"promptLibrary.selectedPrompt":"promptLibrary.selectPrompt")})]}),e.jsx("button",{type:"button",onClick:()=>g(p),children:l("promptLibrary.previewPrompt")}),e.jsx("button",{type:"button",onClick:()=>h(p),disabled:s,children:l("promptLibrary.importThisPrompt")})]})]},p.id)})]})}const ve=o.lazy(()=>J(()=>import("./PromptImportDiscoverySection-DHFEt_FA.js"),__vite__mapDeps([0,1,2])).then(i=>({default:i.PromptImportDiscoverySection}))),je=o.lazy(()=>J(()=>import("./PromptImportFolderSection-BQxb1zs5.js"),__vite__mapDeps([3,1,2])).then(i=>({default:i.PromptImportFolderSection}))),_e=/\.(txt|md|markdown)$/i;function Se({open:i,onClose:t,onImported:u}){const{t:s}=G(),g=ce(r=>r.showToast),n=o.useRef(null),x=o.useRef(null),v=o.useRef(null),[h,l]=o.useState(""),[f,p]=o.useState([]),[y,S]=o.useState(new Set),[j,b]=o.useState(null),[_,L]=o.useState(!1),[H,m]=o.useState(null),[X,N]=o.useState(!1),[Y,A]=o.useState([]),[$,Z]=o.useState(""),[P,z]=o.useState(new Set),[O,E]=o.useState(!1),[V,I]=o.useState([]),[C,W]=o.useState("curated"),[q,ee]=o.useState(!1),B=f.length>0,D=!B||q;o.useEffect(()=>{if(i)return v.current=document.activeElement,window.setTimeout(()=>x.current?.focus(),0),()=>v.current?.focus()},[i]);const re=o.useCallback(async()=>{const r=await K();A(r.sources),z(new Set)},[]);o.useEffect(()=>{if(!i)return;let r=!1;return K().then(a=>{r||(A(a.sources),z(new Set))}).catch(()=>{r||A([])}),()=>{r=!0}},[i]);const w=o.useCallback(r=>{p(a=>{const c=new Set(a.map(k=>k.id)),d=[...a];for(const k of r)c.has(k.id)||d.push(k);return b(k=>k??d[0]?.id??null),d})},[]),R=o.useCallback(async r=>{const a=r.filter(c=>_e.test(c.name));if(a.length===0){m(s("promptLibrary.importNoValidFiles"));return}L(!0),m(null);try{const c=[];for(const d of a)c.push(await M({source:{kind:"local",filename:d.name,text:await d.text()}}));w(c.flatMap(d=>d.candidates))}catch(c){m(c instanceof Error?c.message:s("promptLibrary.importFailed"))}finally{L(!1)}},[w,s]),te=o.useCallback(async()=>{if(h.trim()){L(!0),m(null);try{const r=await M({source:{kind:"github",input:h.trim()}});w(r.candidates)}catch(r){m(r instanceof Error?r.message:s("promptLibrary.importFailed"))}finally{L(!1)}}},[w,h,s]),se=o.useCallback(async()=>{E(!0),m(null),I([]);try{const r=await pe({q:$.trim(),sourceIds:[...P]});w(r.results),I(r.warnings),r.results.length===0&&m(s("promptLibrary.noCuratedResults"))}catch(r){m(r instanceof Error?r.message:s("promptLibrary.importFailed"))}finally{E(!1)}},[w,$,P,s]),ie=o.useCallback(async r=>{E(!0),m(null),I([]);try{const a=await de({sourceId:r});I(a.warnings),g(s("promptLibrary.curatedRefreshed",{count:a.candidateCount}))}catch(a){m(a instanceof Error?a.message:s("promptLibrary.importFailed"))}finally{E(!1)}},[g,s]),Q=o.useCallback((r,a)=>{S(c=>{const d=new Set(c);return a?d.add(r):d.delete(r),d})},[]),oe=o.useCallback(()=>{S(new Set(f.map(r=>r.id)))},[f]),ae=o.useCallback(()=>{S(new Set)},[]),F=o.useCallback(async r=>{if(r.length===0){m(s("promptLibrary.importSelectAtLeastOne"));return}L(!0),m(null);try{const a=await me({candidates:r});await u(),g(s("promptLibrary.imported",{count:a.promptsImported})),t()}catch(a){m(a instanceof Error?a.message:s("promptLibrary.importFailed"))}finally{L(!1)}},[t,u,g,s]),le=o.useCallback(async()=>{const r=f.filter(a=>y.has(a.id));await F(r)},[f,F,y]),U=o.useCallback(r=>{S(new Set([r.id])),F([r])},[F]),ne=o.useCallback(r=>{const a=Array.from(r.target.files??[]);a.length>0&&R(a),r.target.value=""},[R]),T=o.useCallback(r=>{r.preventDefault(),r.stopPropagation(),N(!1);const a=Array.from(r.dataTransfer?.files??[]);a.length>0&&R(a)},[R]);return o.useEffect(()=>{if(!i)return;const r=c=>{c.preventDefault(),N(!0)},a=c=>{c.relatedTarget===null&&N(!1)};return window.addEventListener("dragover",r),window.addEventListener("dragleave",a),window.addEventListener("drop",T),()=>{window.removeEventListener("dragover",r),window.removeEventListener("dragleave",a),window.removeEventListener("drop",T)}},[T,i]),i?e.jsxs("div",{className:"prompt-import-dialog",role:"presentation",children:[e.jsx("div",{className:"prompt-import-dialog__backdrop",onClick:t}),e.jsxs("div",{ref:x,className:"prompt-import-dialog__panel",role:"dialog","aria-modal":"true","aria-labelledby":"prompt-import-title",tabIndex:-1,onKeyDown:r=>{r.key==="Escape"&&t()},children:[e.jsxs("div",{className:"prompt-import-dialog__header",children:[e.jsx("h3",{id:"prompt-import-title",children:s("promptLibrary.importTitle")}),e.jsx("button",{type:"button",onClick:t,"aria-label":s("common.close"),children:"×"})]}),D&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`prompt-import-dialog__dropzone${X?" active":""}`,onDragOver:r=>{r.preventDefault(),N(!0)},onDragLeave:()=>N(!1),onDrop:T,children:[e.jsx("strong",{children:s("promptLibrary.importDropTitle")}),e.jsx("span",{children:s("promptLibrary.importDropHint")}),e.jsx("button",{type:"button",onClick:()=>n.current?.click(),children:s("promptLibrary.importChooseFiles")}),e.jsx("input",{ref:n,className:"prompt-library-panel__file-input",type:"file",accept:".txt,.md,.markdown,text/plain,text/markdown",multiple:!0,onChange:ne})]}),e.jsxs("div",{className:"prompt-import-dialog__github",children:[e.jsx("label",{htmlFor:"prompt-import-github",children:s("promptLibrary.importGithubLabel")}),e.jsxs("div",{children:[e.jsx("input",{id:"prompt-import-github",type:"text",value:h,onChange:r=>l(r.target.value),placeholder:"owner/repo:path/to/prompts.md"}),e.jsx("button",{type:"button",onClick:()=>{te()},disabled:_||!h.trim(),children:s("promptLibrary.importPreview")})]})]}),e.jsx(o.Suspense,{fallback:null,children:e.jsx(je,{input:h,disabled:_,onCandidates:w,onError:m})}),e.jsxs("div",{className:"prompt-import-dialog__source-tabs",role:"tablist","aria-label":s("promptLibrary.curatedSources"),children:[e.jsx("button",{type:"button",className:C==="curated"?"active":"",onClick:()=>W("curated"),"aria-pressed":C==="curated",children:s("promptLibrary.curatedSources")}),e.jsx("button",{type:"button",className:C==="discovery"?"active":"",onClick:()=>W("discovery"),"aria-pressed":C==="discovery",children:s("promptLibrary.discovery")})]})]}),(D?C==="curated":!0)&&e.jsxs("div",{className:"prompt-import-dialog__curated",children:[D&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"prompt-import-dialog__section-title",children:[e.jsx("strong",{children:s("promptLibrary.curatedSources")}),e.jsx("span",{children:s("promptLibrary.curatedSourcesHint")})]}),e.jsx("div",{className:"prompt-import-dialog__source-list",children:Y.filter(r=>r.trustTier!=="manual-review").map(r=>e.jsxs("label",{className:"prompt-import-dialog__source",children:[e.jsx("input",{type:"checkbox",checked:P.has(r.id),onChange:a=>{z(c=>{const d=new Set(c);return a.target.checked?d.add(r.id):d.delete(r.id),d})}}),e.jsxs("span",{children:[e.jsx("strong",{children:r.displayName}),e.jsxs("small",{children:[r.licenseSpdx," · ",r.trustTier]})]}),e.jsx("button",{type:"button",onClick:()=>{ie(r.id)},disabled:O,children:s("promptLibrary.refreshSource")})]},r.id))})]}),e.jsxs("div",{className:"prompt-import-dialog__search-results",children:[e.jsx("input",{type:"text",value:$,onChange:r=>Z(r.target.value),placeholder:s("promptLibrary.curatedSearchPlaceholder"),"aria-label":s("promptLibrary.curatedSearch")}),e.jsx("button",{type:"button",onClick:()=>{se()},disabled:O||P.size===0,children:s(O?"common.loading":"promptLibrary.curatedSearch")})]}),V.length>0?e.jsx("div",{className:"prompt-import-dialog__warning",children:V.slice(0,3).join(" · ")}):null]}),D&&C==="discovery"&&e.jsx(o.Suspense,{fallback:e.jsx("div",{className:"prompt-import-dialog__empty",children:s("common.loading")}),children:e.jsx(ve,{disabled:_,onError:m,onSourcesChanged:re})}),B&&!q&&e.jsx("button",{type:"button",className:"prompt-import-dialog__add-source-toggle",onClick:()=>ee(!0),children:s("promptLibrary.addAnotherSource")}),H?e.jsx("div",{className:"prompt-import-dialog__error",role:"alert",children:H}):null,e.jsxs("div",{className:"prompt-import-dialog__workspace","aria-live":"polite",children:[e.jsx(xe,{candidates:f,selectedIds:y,activeCandidateId:j,busy:_,onSelectCandidate:r=>b(r.id),onToggleSelected:Q,onSelectAll:oe,onClearSelection:ae,onImportOne:U}),e.jsx(ge,{candidate:f.find(r=>r.id===j)??null,selected:j?y.has(j):!1,disabled:_,onToggleSelected:Q,onImportOne:U})]}),e.jsxs("div",{className:"prompt-import-dialog__footer",children:[e.jsx("button",{type:"button",onClick:t,children:s("common.cancel")}),e.jsx("button",{type:"button",onClick:()=>{le()},disabled:_||y.size===0,children:_?s("common.loading"):s("promptLibrary.importSelected",{count:y.size})})]})]})]}):null}export{Se as PromptImportDialog};
@@ -1 +1 @@
1
- import{u as L,a as t,J as S,K as C,L as P,j as r}from"./index-Ci36vcFD.js";const R=["gpt-image-2 prompt","nano banana prompts","typography image prompt"];function k({disabled:d=!1,onError:a,onSourcesChanged:y}){const{t:s}=L(),[l,N]=t.useState("gpt-image-2 prompt"),[v,p]=t.useState([]),[n,c]=t.useState(!1),[g,m]=t.useState([]),[h,_]=t.useState({});t.useEffect(()=>{let e=!1;return S().then(i=>{e||p(i.candidates)}).catch(()=>{e||p([])}),()=>{e=!0}},[]);const w=t.useCallback(async()=>{c(!0),m([]),a(null);try{const e=await C({q:l.trim(),seeds:R});p(e.candidates),m([...e.warnings,...e.rateLimit?.remaining===0?["github-rate-limit-exhausted"]:[]]),e.candidates.length===0&&a(s("promptLibrary.discoveryNoResults"))}catch(e){a(e instanceof Error?e.message:s("promptLibrary.importFailed"))}finally{c(!1)}},[a,l,s]),x=t.useCallback(async(e,i)=>{c(!0),m([]),a(null);try{const j=(h[e.fullName]||"").split(/\r?\n|,/).map(u=>u.trim()).filter(Boolean),b=await P({repo:e.fullName,status:i,allowedPaths:i==="approved"?j:[],defaultSearch:i==="approved"&&j.length>0});m(b.warnings),p(u=>u.map(f=>f.fullName===e.fullName?b.candidate:f)),await y()}catch(o){a(o instanceof Error?o.message:s("promptLibrary.importFailed"))}finally{c(!1)}},[h,a,y,s]);return r.jsxs("div",{className:"prompt-import-dialog__discovery",children:[r.jsxs("div",{className:"prompt-import-dialog__section-title",children:[r.jsx("strong",{children:s("promptLibrary.discovery")}),r.jsx("span",{children:s("promptLibrary.discoveryReviewQueue")})]}),r.jsxs("div",{className:"prompt-import-dialog__discovery-actions",children:[r.jsx("input",{type:"text",value:l,onChange:e=>N(e.target.value),placeholder:s("promptLibrary.discoverySearchPlaceholder"),"aria-label":s("promptLibrary.discoverySearch")}),r.jsx("button",{type:"button",onClick:()=>{w()},disabled:d||n||!l.trim(),children:s(n?"common.loading":"promptLibrary.discoverySearch")})]}),g.length>0?r.jsx("div",{className:"prompt-import-dialog__discovery-warning",children:g.slice(0,3).join(" · ")}):null,v.length===0?r.jsx("div",{className:"prompt-import-dialog__empty",children:s("promptLibrary.discoveryNoResults")}):r.jsx("div",{className:"prompt-import-dialog__discovery-list",children:v.map(e=>r.jsxs("article",{className:"prompt-import-dialog__discovery-candidate",children:[r.jsxs("div",{children:[r.jsx("strong",{children:e.fullName}),r.jsx("small",{children:e.description||e.htmlUrl})]}),r.jsxs("div",{className:"prompt-import-dialog__score",children:[r.jsxs("span",{children:[s("promptLibrary.discoveryScore"),": ",e.score]}),r.jsx("span",{children:e.licenseSpdx}),r.jsx("span",{children:e.status})]}),e.scoreReasons.length>0?r.jsx("em",{children:e.scoreReasons.slice(0,3).join(" · ")}):null,e.warnings.length>0?r.jsx("b",{children:e.warnings.slice(0,2).join(" · ")}):null,r.jsx("textarea",{value:h[e.fullName]||"",onChange:i=>_(o=>({...o,[e.fullName]:i.target.value})),placeholder:"README.md, prompts/example.md","aria-label":s("promptLibrary.discoveryRequiresPaths")}),r.jsxs("div",{className:"prompt-import-dialog__review-actions",children:[r.jsx("button",{type:"button",onClick:()=>{x(e,"approved")},disabled:d||n,children:s("promptLibrary.discoveryApprove")}),r.jsx("button",{type:"button",onClick:()=>{x(e,"rejected")},disabled:d||n,children:s("promptLibrary.discoveryReject")})]})]},e.fullName))})]})}export{k as PromptImportDiscoverySection};
1
+ import{u as L,a as t,J as S,K as C,L as P,j as r}from"./index-BAN6lKgf.js";const R=["gpt-image-2 prompt","nano banana prompts","typography image prompt"];function k({disabled:d=!1,onError:a,onSourcesChanged:y}){const{t:s}=L(),[l,N]=t.useState("gpt-image-2 prompt"),[v,p]=t.useState([]),[n,c]=t.useState(!1),[g,m]=t.useState([]),[h,_]=t.useState({});t.useEffect(()=>{let e=!1;return S().then(i=>{e||p(i.candidates)}).catch(()=>{e||p([])}),()=>{e=!0}},[]);const w=t.useCallback(async()=>{c(!0),m([]),a(null);try{const e=await C({q:l.trim(),seeds:R});p(e.candidates),m([...e.warnings,...e.rateLimit?.remaining===0?["github-rate-limit-exhausted"]:[]]),e.candidates.length===0&&a(s("promptLibrary.discoveryNoResults"))}catch(e){a(e instanceof Error?e.message:s("promptLibrary.importFailed"))}finally{c(!1)}},[a,l,s]),x=t.useCallback(async(e,i)=>{c(!0),m([]),a(null);try{const j=(h[e.fullName]||"").split(/\r?\n|,/).map(u=>u.trim()).filter(Boolean),b=await P({repo:e.fullName,status:i,allowedPaths:i==="approved"?j:[],defaultSearch:i==="approved"&&j.length>0});m(b.warnings),p(u=>u.map(f=>f.fullName===e.fullName?b.candidate:f)),await y()}catch(o){a(o instanceof Error?o.message:s("promptLibrary.importFailed"))}finally{c(!1)}},[h,a,y,s]);return r.jsxs("div",{className:"prompt-import-dialog__discovery",children:[r.jsxs("div",{className:"prompt-import-dialog__section-title",children:[r.jsx("strong",{children:s("promptLibrary.discovery")}),r.jsx("span",{children:s("promptLibrary.discoveryReviewQueue")})]}),r.jsxs("div",{className:"prompt-import-dialog__discovery-actions",children:[r.jsx("input",{type:"text",value:l,onChange:e=>N(e.target.value),placeholder:s("promptLibrary.discoverySearchPlaceholder"),"aria-label":s("promptLibrary.discoverySearch")}),r.jsx("button",{type:"button",onClick:()=>{w()},disabled:d||n||!l.trim(),children:s(n?"common.loading":"promptLibrary.discoverySearch")})]}),g.length>0?r.jsx("div",{className:"prompt-import-dialog__discovery-warning",children:g.slice(0,3).join(" · ")}):null,v.length===0?r.jsx("div",{className:"prompt-import-dialog__empty",children:s("promptLibrary.discoveryNoResults")}):r.jsx("div",{className:"prompt-import-dialog__discovery-list",children:v.map(e=>r.jsxs("article",{className:"prompt-import-dialog__discovery-candidate",children:[r.jsxs("div",{children:[r.jsx("strong",{children:e.fullName}),r.jsx("small",{children:e.description||e.htmlUrl})]}),r.jsxs("div",{className:"prompt-import-dialog__score",children:[r.jsxs("span",{children:[s("promptLibrary.discoveryScore"),": ",e.score]}),r.jsx("span",{children:e.licenseSpdx}),r.jsx("span",{children:e.status})]}),e.scoreReasons.length>0?r.jsx("em",{children:e.scoreReasons.slice(0,3).join(" · ")}):null,e.warnings.length>0?r.jsx("b",{children:e.warnings.slice(0,2).join(" · ")}):null,r.jsx("textarea",{value:h[e.fullName]||"",onChange:i=>_(o=>({...o,[e.fullName]:i.target.value})),placeholder:"README.md, prompts/example.md","aria-label":s("promptLibrary.discoveryRequiresPaths")}),r.jsxs("div",{className:"prompt-import-dialog__review-actions",children:[r.jsx("button",{type:"button",onClick:()=>{x(e,"approved")},disabled:d||n,children:s("promptLibrary.discoveryApprove")}),r.jsx("button",{type:"button",onClick:()=>{x(e,"rejected")},disabled:d||n,children:s("promptLibrary.discoveryReject")})]})]},e.fullName))})]})}export{k as PromptImportDiscoverySection};
@@ -1 +1 @@
1
- import{u as w,a,N as S,O as _,j as t}from"./index-Ci36vcFD.js";function F({input:i,disabled:h=!1,onCandidates:u,onError:l}){const{t:s}=w(),[f,g]=a.useState([]),[o,p]=a.useState(new Set),[d,n]=a.useState(!1),[x,c]=a.useState([]),y=a.useCallback(async()=>{if(i.trim()){n(!0),c([]),l(null);try{const e=await S({source:{kind:"github-folder",input:i.trim()}});g(e.files),p(new Set(e.files.slice(0,5).map(r=>r.path))),c(e.warnings),e.files.length===0&&l(s("promptLibrary.folderFilesEmpty"))}catch(e){g([]),p(new Set),l(e instanceof Error?e.message:s("promptLibrary.folderUnsupported"))}finally{n(!1)}}},[i,l,s]),b=a.useCallback(async()=>{const e=[...o];if(e.length===0){l(s("promptLibrary.folderNoSelection"));return}n(!0),c([]),l(null);try{const r=await _({source:{kind:"github-folder",input:i.trim()},paths:e});c(r.warnings),u(r.candidates)}catch(r){l(r instanceof Error?r.message:s("promptLibrary.importFailed"))}finally{n(!1)}},[i,u,l,o,s]);return t.jsxs("div",{className:"prompt-import-dialog__folder",children:[t.jsxs("div",{className:"prompt-import-dialog__section-title",children:[t.jsx("strong",{children:s("promptLibrary.folderFiles")}),t.jsx("span",{children:s("promptLibrary.folderBrowseHint")})]}),t.jsxs("div",{className:"prompt-import-dialog__folder-actions",children:[t.jsx("button",{type:"button",onClick:()=>{y()},disabled:h||d||!i.trim(),children:s(d?"common.loading":"promptLibrary.folderBrowse")}),t.jsx("button",{type:"button",onClick:()=>{b()},disabled:h||d||o.size===0,children:s("promptLibrary.folderPreviewSelected")}),t.jsx("span",{children:s("promptLibrary.folderSelectedCount",{count:o.size})})]}),f.length>0?t.jsx("div",{className:"prompt-import-dialog__folder-list",children:f.map(e=>t.jsxs("label",{className:"prompt-import-dialog__folder-file",children:[t.jsx("input",{type:"checkbox",checked:o.has(e.path),onChange:r=>{p(j=>{const m=new Set(j);return r.target.checked?m.add(e.path):m.delete(e.path),m})}}),t.jsxs("span",{children:[t.jsx("strong",{children:e.name}),t.jsx("small",{children:e.path})]}),t.jsxs("em",{children:[Math.ceil(e.sizeBytes/1024)," KB"]})]},e.path))}):null,x.length>0?t.jsx("div",{className:"prompt-import-dialog__folder-warning",children:x.slice(0,3).join(" · ")}):null]})}export{F as PromptImportFolderSection};
1
+ import{u as w,a,N as S,O as _,j as t}from"./index-BAN6lKgf.js";function F({input:i,disabled:h=!1,onCandidates:u,onError:l}){const{t:s}=w(),[f,g]=a.useState([]),[o,p]=a.useState(new Set),[d,n]=a.useState(!1),[x,c]=a.useState([]),y=a.useCallback(async()=>{if(i.trim()){n(!0),c([]),l(null);try{const e=await S({source:{kind:"github-folder",input:i.trim()}});g(e.files),p(new Set(e.files.slice(0,5).map(r=>r.path))),c(e.warnings),e.files.length===0&&l(s("promptLibrary.folderFilesEmpty"))}catch(e){g([]),p(new Set),l(e instanceof Error?e.message:s("promptLibrary.folderUnsupported"))}finally{n(!1)}}},[i,l,s]),b=a.useCallback(async()=>{const e=[...o];if(e.length===0){l(s("promptLibrary.folderNoSelection"));return}n(!0),c([]),l(null);try{const r=await _({source:{kind:"github-folder",input:i.trim()},paths:e});c(r.warnings),u(r.candidates)}catch(r){l(r instanceof Error?r.message:s("promptLibrary.importFailed"))}finally{n(!1)}},[i,u,l,o,s]);return t.jsxs("div",{className:"prompt-import-dialog__folder",children:[t.jsxs("div",{className:"prompt-import-dialog__section-title",children:[t.jsx("strong",{children:s("promptLibrary.folderFiles")}),t.jsx("span",{children:s("promptLibrary.folderBrowseHint")})]}),t.jsxs("div",{className:"prompt-import-dialog__folder-actions",children:[t.jsx("button",{type:"button",onClick:()=>{y()},disabled:h||d||!i.trim(),children:s(d?"common.loading":"promptLibrary.folderBrowse")}),t.jsx("button",{type:"button",onClick:()=>{b()},disabled:h||d||o.size===0,children:s("promptLibrary.folderPreviewSelected")}),t.jsx("span",{children:s("promptLibrary.folderSelectedCount",{count:o.size})})]}),f.length>0?t.jsx("div",{className:"prompt-import-dialog__folder-list",children:f.map(e=>t.jsxs("label",{className:"prompt-import-dialog__folder-file",children:[t.jsx("input",{type:"checkbox",checked:o.has(e.path),onChange:r=>{p(j=>{const m=new Set(j);return r.target.checked?m.add(e.path):m.delete(e.path),m})}}),t.jsxs("span",{children:[t.jsx("strong",{children:e.name}),t.jsx("small",{children:e.path})]}),t.jsxs("em",{children:[Math.ceil(e.sizeBytes/1024)," KB"]})]},e.path))}):null,x.length>0?t.jsx("div",{className:"prompt-import-dialog__folder-warning",children:x.slice(0,3).join(" · ")}):null]})}export{F as PromptImportFolderSection};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PromptImportDialog-C6lFV-LL.js","assets/index-Ci36vcFD.js","assets/index-ByViUJfx.css"])))=>i.map(i=>d[i]);
2
- import{u,j as r,a as n,b as s,S as E,_ as $}from"./index-Ci36vcFD.js";function A({prompt:a,onClose:c,onLoad:d,onInsert:t,onDelete:m,onToggleFavorite:l}){const{t:o}=u(),p=async()=>{try{await navigator.clipboard.writeText(a.text)}catch{}};return r.jsxs("div",{className:"prompt-detail-modal",onClick:c,children:[r.jsx("div",{className:"prompt-detail-modal__backdrop"}),r.jsxs("div",{className:"prompt-detail-modal__content",onClick:i=>i.stopPropagation(),children:[r.jsxs("div",{className:"prompt-detail-modal__header",children:[r.jsx("h4",{children:a.name||o("promptLibrary.untitled")}),r.jsx("button",{className:"prompt-detail-modal__close",onClick:c,"aria-label":o("common.close"),children:"×"})]}),r.jsxs("div",{className:"prompt-detail-modal__body",children:[r.jsx("div",{className:"prompt-detail-modal__label",children:o("promptLibrary.content")}),r.jsx("div",{className:"prompt-detail-modal__prompt",children:a.text}),a.tags.length>0&&r.jsxs("div",{className:"prompt-detail-modal__tags",children:[r.jsx("div",{className:"prompt-detail-modal__label",children:o("promptLibrary.tags")}),r.jsx("div",{className:"prompt-detail-modal__tag-list",children:a.tags.map(i=>r.jsxs("span",{className:"prompt-detail-modal__tag",children:["#",i]},i))})]})]}),r.jsxs("div",{className:"prompt-detail-modal__footer",children:[r.jsx("button",{className:"prompt-detail-modal__load",onClick:d,children:o("promptLibrary.load")}),r.jsx("button",{className:"prompt-detail-modal__copy",onClick:p,children:o("promptLibrary.copy")}),r.jsxs("button",{className:"prompt-detail-modal__insert",onClick:t,children:["+ ",o("promptLibrary.insert")]}),r.jsx("button",{className:`prompt-detail-modal__favorite${a.isFavorite?" prompt-detail-modal__favorite--on":""}`,onClick:l,children:a.isFavorite?"★ "+o("promptLibrary.unfavorite"):"☆ "+o("promptLibrary.favorite")}),r.jsx("button",{className:"prompt-detail-modal__delete",onClick:m,children:o("common.delete")})]})]})]})}function R({prompt:a,onLoad:c,onInsert:d,onDelete:t,onToggleFavorite:m}){const{t:l}=u(),[o,p]=n.useState(!1),i=a.text.length>45?a.text.slice(0,45)+"...":a.text;return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"prompt-library-row",onClick:()=>p(!0),children:[r.jsxs("div",{className:"prompt-library-row__main",children:[r.jsx("div",{className:"prompt-library-row__title",children:a.name||l("promptLibrary.untitled")}),r.jsx("div",{className:"prompt-library-row__preview",children:i})]}),r.jsxs("div",{className:"prompt-library-row__actions",children:[r.jsx("button",{className:"prompt-library-row__insert",onClick:b=>{b.stopPropagation(),d()},title:l("promptLibrary.insert"),"aria-label":l("promptLibrary.insert"),children:"+"}),r.jsx("button",{className:`prompt-library-row__star${a.isFavorite?" prompt-library-row__star--on":""}`,onClick:b=>{b.stopPropagation(),m()},"aria-label":a.isFavorite?l("promptLibrary.unfavorite"):l("promptLibrary.favorite"),children:a.isFavorite?"★":"☆"}),r.jsx("span",{className:"prompt-library-row__chevron",children:"›"})]})]}),o&&r.jsx(A,{prompt:a,onClose:()=>p(!1),onLoad:()=>{c(),p(!1)},onInsert:()=>{d(),p(!1)},onDelete:t,onToggleFavorite:m})]})}const z=n.lazy(()=>$(()=>import("./PromptImportDialog-C6lFV-LL.js"),__vite__mapDeps([0,1,2])).then(a=>({default:a.PromptImportDialog})));function V({variant:a="overlay",forceOpen:c=!1,onRequestClose:d}){const{t}=u(),m=s(e=>e.promptLibraryOpen),l=s(e=>e.togglePromptLibrary),o=s(e=>e.promptLibrary),p=s(e=>e.promptLibraryLoading),i=s(e=>e.loadPromptLibrary),b=s(e=>e.deletePromptFromLibrary),P=s(e=>e.togglePromptFavorite),w=s(e=>e.setPrompt),j=s(e=>e.insertPromptToComposer),k=s(e=>e.clearInsertedPrompts),L=s(e=>e.showToast),[y,F]=n.useState(""),[x,O]=n.useState(!1),[S,N]=n.useState(!1),[f,g]=n.useState(!1),h=c||m,_=d??l;n.useEffect(()=>{h&&i()},[h,i]);const I=n.useCallback(e=>{j({id:e.id,name:e.name||t("promptLibrary.untitled"),text:e.text}),L(t("promptLibrary.inserted")),_()},[_,j,L,t]);if(!h)return null;const C=o.prompts.filter(e=>{if(x&&!e.isFavorite)return!1;if(!y.trim())return!0;const v=y.toLowerCase();return e.name.toLowerCase().includes(v)||e.text.toLowerCase().includes(v)||e.tags.some(T=>T.toLowerCase().includes(v))}),D=r.jsxs("div",{className:"prompt-library-panel__drawer",children:[r.jsxs("div",{className:"prompt-library-panel__header",children:[r.jsx("h3",{children:t("promptLibrary.title")}),r.jsxs("div",{className:"prompt-library-panel__actions",children:[r.jsx("button",{className:"prompt-library-panel__add",onClick:()=>N(e=>!e),title:t("promptLibrary.addNew"),"aria-label":t("promptLibrary.addNew"),children:"+"}),r.jsx("button",{className:"prompt-library-panel__import",onClick:()=>g(!0),title:t("promptLibrary.importFiles"),"aria-label":t("promptLibrary.importFiles"),children:t("promptLibrary.import")}),r.jsx("button",{onClick:_,"aria-label":t("common.close"),children:"×"})]}),S&&r.jsx(E,{text:"",onClose:()=>N(!1)})]}),r.jsxs("div",{className:"prompt-library-panel__search",children:[r.jsx("input",{type:"text",placeholder:t("promptLibrary.search"),value:y,onChange:e=>F(e.target.value)}),r.jsxs("button",{type:"button",className:`prompt-library-panel__filter-toggle${x?" active":""}`,"aria-pressed":x,title:t("promptLibrary.favorites"),onClick:()=>O(e=>!e),children:[r.jsx("span",{"aria-hidden":"true",children:"★"}),r.jsx("span",{children:t("promptLibrary.favorites")})]})]}),p?r.jsx("div",{className:"prompt-library-panel__loading",children:t("common.loading")}):r.jsx("div",{className:"prompt-library-panel__list",children:C.length===0?r.jsx("div",{className:"prompt-library-panel__empty",children:t("promptLibrary.empty")}):C.map(e=>r.jsx(R,{prompt:e,onLoad:()=>{k(),w(e.text),l()},onInsert:()=>I(e),onDelete:()=>b(e.id),onToggleFavorite:()=>P(e.id)},e.id))}),f?r.jsx(n.Suspense,{fallback:null,children:r.jsx(z,{open:f,onClose:()=>g(!1),onImported:i})}):null]});return r.jsxs("div",{className:`prompt-library-panel prompt-library-panel--${a}`,children:[a==="overlay"?r.jsx("div",{className:"prompt-library-panel__backdrop",onClick:_}):null,D]})}export{V as PromptLibraryPanel};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PromptImportDialog-DS9vrc_w.js","assets/index-BAN6lKgf.js","assets/index-DK1faG9Z.css"])))=>i.map(i=>d[i]);
2
+ import{u,j as r,a as n,b as s,S as E,_ as $}from"./index-BAN6lKgf.js";function A({prompt:a,onClose:c,onLoad:d,onInsert:t,onDelete:m,onToggleFavorite:l}){const{t:o}=u(),p=async()=>{try{await navigator.clipboard.writeText(a.text)}catch{}};return r.jsxs("div",{className:"prompt-detail-modal",onClick:c,children:[r.jsx("div",{className:"prompt-detail-modal__backdrop"}),r.jsxs("div",{className:"prompt-detail-modal__content",onClick:i=>i.stopPropagation(),children:[r.jsxs("div",{className:"prompt-detail-modal__header",children:[r.jsx("h4",{children:a.name||o("promptLibrary.untitled")}),r.jsx("button",{className:"prompt-detail-modal__close",onClick:c,"aria-label":o("common.close"),children:"×"})]}),r.jsxs("div",{className:"prompt-detail-modal__body",children:[r.jsx("div",{className:"prompt-detail-modal__label",children:o("promptLibrary.content")}),r.jsx("div",{className:"prompt-detail-modal__prompt",children:a.text}),a.tags.length>0&&r.jsxs("div",{className:"prompt-detail-modal__tags",children:[r.jsx("div",{className:"prompt-detail-modal__label",children:o("promptLibrary.tags")}),r.jsx("div",{className:"prompt-detail-modal__tag-list",children:a.tags.map(i=>r.jsxs("span",{className:"prompt-detail-modal__tag",children:["#",i]},i))})]})]}),r.jsxs("div",{className:"prompt-detail-modal__footer",children:[r.jsx("button",{className:"prompt-detail-modal__load",onClick:d,children:o("promptLibrary.load")}),r.jsx("button",{className:"prompt-detail-modal__copy",onClick:p,children:o("promptLibrary.copy")}),r.jsxs("button",{className:"prompt-detail-modal__insert",onClick:t,children:["+ ",o("promptLibrary.insert")]}),r.jsx("button",{className:`prompt-detail-modal__favorite${a.isFavorite?" prompt-detail-modal__favorite--on":""}`,onClick:l,children:a.isFavorite?"★ "+o("promptLibrary.unfavorite"):"☆ "+o("promptLibrary.favorite")}),r.jsx("button",{className:"prompt-detail-modal__delete",onClick:m,children:o("common.delete")})]})]})]})}function R({prompt:a,onLoad:c,onInsert:d,onDelete:t,onToggleFavorite:m}){const{t:l}=u(),[o,p]=n.useState(!1),i=a.text.length>45?a.text.slice(0,45)+"...":a.text;return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"prompt-library-row",onClick:()=>p(!0),children:[r.jsxs("div",{className:"prompt-library-row__main",children:[r.jsx("div",{className:"prompt-library-row__title",children:a.name||l("promptLibrary.untitled")}),r.jsx("div",{className:"prompt-library-row__preview",children:i})]}),r.jsxs("div",{className:"prompt-library-row__actions",children:[r.jsx("button",{className:"prompt-library-row__insert",onClick:b=>{b.stopPropagation(),d()},title:l("promptLibrary.insert"),"aria-label":l("promptLibrary.insert"),children:"+"}),r.jsx("button",{className:`prompt-library-row__star${a.isFavorite?" prompt-library-row__star--on":""}`,onClick:b=>{b.stopPropagation(),m()},"aria-label":a.isFavorite?l("promptLibrary.unfavorite"):l("promptLibrary.favorite"),children:a.isFavorite?"★":"☆"}),r.jsx("span",{className:"prompt-library-row__chevron",children:"›"})]})]}),o&&r.jsx(A,{prompt:a,onClose:()=>p(!1),onLoad:()=>{c(),p(!1)},onInsert:()=>{d(),p(!1)},onDelete:t,onToggleFavorite:m})]})}const z=n.lazy(()=>$(()=>import("./PromptImportDialog-DS9vrc_w.js"),__vite__mapDeps([0,1,2])).then(a=>({default:a.PromptImportDialog})));function V({variant:a="overlay",forceOpen:c=!1,onRequestClose:d}){const{t}=u(),m=s(e=>e.promptLibraryOpen),l=s(e=>e.togglePromptLibrary),o=s(e=>e.promptLibrary),p=s(e=>e.promptLibraryLoading),i=s(e=>e.loadPromptLibrary),b=s(e=>e.deletePromptFromLibrary),P=s(e=>e.togglePromptFavorite),w=s(e=>e.setPrompt),j=s(e=>e.insertPromptToComposer),k=s(e=>e.clearInsertedPrompts),L=s(e=>e.showToast),[y,F]=n.useState(""),[x,O]=n.useState(!1),[S,N]=n.useState(!1),[f,g]=n.useState(!1),h=c||m,_=d??l;n.useEffect(()=>{h&&i()},[h,i]);const I=n.useCallback(e=>{j({id:e.id,name:e.name||t("promptLibrary.untitled"),text:e.text}),L(t("promptLibrary.inserted")),_()},[_,j,L,t]);if(!h)return null;const C=o.prompts.filter(e=>{if(x&&!e.isFavorite)return!1;if(!y.trim())return!0;const v=y.toLowerCase();return e.name.toLowerCase().includes(v)||e.text.toLowerCase().includes(v)||e.tags.some(T=>T.toLowerCase().includes(v))}),D=r.jsxs("div",{className:"prompt-library-panel__drawer",children:[r.jsxs("div",{className:"prompt-library-panel__header",children:[r.jsx("h3",{children:t("promptLibrary.title")}),r.jsxs("div",{className:"prompt-library-panel__actions",children:[r.jsx("button",{className:"prompt-library-panel__add",onClick:()=>N(e=>!e),title:t("promptLibrary.addNew"),"aria-label":t("promptLibrary.addNew"),children:"+"}),r.jsx("button",{className:"prompt-library-panel__import",onClick:()=>g(!0),title:t("promptLibrary.importFiles"),"aria-label":t("promptLibrary.importFiles"),children:t("promptLibrary.import")}),r.jsx("button",{onClick:_,"aria-label":t("common.close"),children:"×"})]}),S&&r.jsx(E,{text:"",onClose:()=>N(!1)})]}),r.jsxs("div",{className:"prompt-library-panel__search",children:[r.jsx("input",{type:"text",placeholder:t("promptLibrary.search"),value:y,onChange:e=>F(e.target.value)}),r.jsxs("button",{type:"button",className:`prompt-library-panel__filter-toggle${x?" active":""}`,"aria-pressed":x,title:t("promptLibrary.favorites"),onClick:()=>O(e=>!e),children:[r.jsx("span",{"aria-hidden":"true",children:"★"}),r.jsx("span",{children:t("promptLibrary.favorites")})]})]}),p?r.jsx("div",{className:"prompt-library-panel__loading",children:t("common.loading")}):r.jsx("div",{className:"prompt-library-panel__list",children:C.length===0?r.jsx("div",{className:"prompt-library-panel__empty",children:t("promptLibrary.empty")}):C.map(e=>r.jsx(R,{prompt:e,onLoad:()=>{k(),w(e.text),l()},onInsert:()=>I(e),onDelete:()=>b(e.id),onToggleFavorite:()=>P(e.id)},e.id))}),f?r.jsx(n.Suspense,{fallback:null,children:r.jsx(z,{open:f,onClose:()=>g(!1),onImported:i})}):null]});return r.jsxs("div",{className:`prompt-library-panel prompt-library-panel--${a}`,children:[a==="overlay"?r.jsx("div",{className:"prompt-library-panel__backdrop",onClick:_}):null,D]})}export{V as PromptLibraryPanel};
@@ -1 +1 @@
1
- import{u as p,f as k,h as T,j as e,b as c,i as E,k as L,a as d,T as R,I as $,W as O}from"./index-Ci36vcFD.js";function C(s){return s==="ready"?"Ready":s==="auth_required"?"Login required":s==="starting"?"Starting":s==="offline"?"Offline":"Checking"}function I(){const{t:s}=p(),l=k(),{data:a,error:t}=T(),r=a?.apiKeySource==="env"||a?.apiKeySource==="config"||a?.apiKeyValid===!0,h=l?.status==="ready",m=a?.apiKeySource==="config"?s("settings.account.apiSourceConfig"):s("settings.account.apiSourceEnv"),g=a?.apiKeyValid===!0;return e.jsxs(e.Fragment,{children:[e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("p",{className:"settings-eyebrow",children:s("settings.account.primaryEyebrow")}),e.jsx("h4",{children:s("settings.account.oauthTitle")}),e.jsx("p",{children:s("settings.account.oauthBody")})]}),e.jsxs("div",{className:`settings-status${h?" is-ok":""}`,children:[e.jsx("span",{"aria-hidden":"true"}),C(l?.status)]})]}),r?e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("p",{className:"settings-eyebrow",children:m}),e.jsx("h4",{children:s("settings.account.apiTitle")}),e.jsx("p",{children:s("settings.account.apiBody")})]}),e.jsxs("div",{className:`settings-status${g?" is-ok":" is-muted"}`,children:[e.jsx("span",{"aria-hidden":"true"}),s(t?"settings.account.apiUnknown":g?"settings.account.apiReady":"settings.account.apiUnavailable")]})]}):null]})}function K(){const{t:s}=p(),l=c(r=>r.reasoningEffort),a=c(r=>r.setReasoningEffort),t=r=>{a(r.target.value)};return e.jsx("div",{className:"image-model-select image-model-select--settings",children:e.jsx("select",{id:"settings-reasoning-effort",value:l,onChange:t,children:E.map(r=>e.jsx("option",{value:r.value,children:s(r.fullLabelKey)},r.value))})})}const A={ko:"KO",en:"EN"};function P(){const{t:s,locale:l}=p(),a=c(t=>t.setLocale);return e.jsx("div",{className:"lang-toggle",role:"group","aria-label":s("language.label"),children:L.map(t=>e.jsx("button",{type:"button",className:`lang-toggle__btn ${l===t?"is-active":""}`,onClick:()=>a(t),"aria-pressed":l===t,title:s(`language.${t}`),children:e.jsx("span",{className:"lang-toggle__label",children:A[t]})},t))})}const B=["system","dark","light"];function F(){const{t:s}=p(),l=c(i=>i.theme),a=c(i=>i.setTheme),t=c(i=>i.themeFamily),r=c(i=>i.setThemeFamily),[h,m]=d.useState(!1),g=d.useRef(null);d.useEffect(()=>{if(!h)return;const i=o=>{g.current&&(g.current.contains(o.target)||m(!1))},x=o=>{o.key==="Escape"&&m(!1)};return document.addEventListener("mousedown",i),document.addEventListener("keydown",x),()=>{document.removeEventListener("mousedown",i),document.removeEventListener("keydown",x)}},[h]);const u=i=>s(`theme.family.${i}`);return e.jsxs("div",{className:"theme-toggle","aria-label":s("theme.label"),children:[e.jsxs("div",{className:"theme-toggle__row",children:[e.jsx("span",{className:"theme-toggle__label",id:"theme-style-label",children:s("theme.styleLabel")}),e.jsxs("div",{className:"theme-toggle__family",ref:g,children:[e.jsxs("button",{type:"button",className:"theme-toggle__family-trigger","aria-haspopup":"listbox","aria-expanded":h,"aria-labelledby":"theme-style-label",onClick:()=>m(i=>!i),children:[e.jsx("span",{className:`theme-toggle__family-dot theme-toggle__family-dot--${t}`,"aria-hidden":"true"}),e.jsx("span",{className:"theme-toggle__family-name",children:u(t)}),e.jsx("span",{className:"theme-toggle__family-caret","aria-hidden":"true",children:"▾"})]}),h?e.jsx("ul",{className:"theme-toggle__family-menu",role:"listbox","aria-labelledby":"theme-style-label",children:R.map(i=>e.jsx("li",{role:"none",children:e.jsxs("button",{type:"button",role:"option","aria-selected":t===i,className:`theme-toggle__family-option ${t===i?"is-active":""}`,onClick:()=>{r(i),m(!1)},children:[e.jsx("span",{className:`theme-toggle__family-dot theme-toggle__family-dot--${i}`,"aria-hidden":"true"}),e.jsx("span",{className:"theme-toggle__family-name",children:u(i)})]})},i))}):null]})]}),e.jsxs("div",{className:"theme-toggle__row",children:[e.jsx("span",{className:"theme-toggle__label",id:"theme-mode-label",children:s("theme.modeLabel")}),e.jsx("div",{className:"theme-toggle__mode",role:"group","aria-labelledby":"theme-mode-label",children:B.map(i=>e.jsx("button",{type:"button",className:`theme-toggle__btn ${l===i?"is-active":""}`,onClick:()=>a(i),"aria-pressed":l===i,title:s(`theme.${i}`),children:s(`theme.${i}`)},i))})]})]})}const D=["rail","horizontal","sidebar"];function M(){const{t:s}=p(),l=c(t=>t.historyStripLayout),a=c(t=>t.setHistoryStripLayout);return e.jsx("div",{className:"history-layout-toggle",role:"group","aria-label":s("settings.appearance.historyStripLayoutTitle"),children:D.map(t=>e.jsx("button",{type:"button",className:`history-layout-toggle__btn ${l===t?"is-active":""}`,onClick:()=>a(t),"aria-pressed":l===t,title:s(`settings.appearance.historyStripLayout.${t}`),children:s(`settings.appearance.historyStripLayout.${t}`)},t))})}const W=[{value:"default",labelKey:"workspace.defaultLabel",descKey:"workspace.defaultDesc"},{value:"prompt-studio",labelKey:"workspace.promptStudioLabel",descKey:"workspace.promptStudioDesc"}];function G(){const s=c(t=>t.workspaceProfile),l=c(t=>t.setWorkspaceProfile),{t:a}=p();return e.jsxs("div",{className:"settings-field",children:[e.jsx("label",{className:"settings-field__label",children:a("workspace.profileLabel")}),e.jsx("div",{className:"settings-field__options",children:W.map(t=>e.jsxs("label",{className:"settings-radio-option",children:[e.jsx("input",{type:"radio",name:"workspaceProfile",value:t.value,checked:s===t.value,onChange:()=>l(t.value)}),e.jsxs("span",{className:"settings-radio-option__text",children:[e.jsx("strong",{children:a(t.labelKey)}),e.jsx("span",{className:"settings-radio-option__desc",children:a(t.descKey)})]})]},t.value))})]})}const f=["account","generation","appearance","workspace","language","future"];function y({id:s,setRef:l,children:a}){const{t}=p();return e.jsxs("section",{id:s,ref:r=>l(s,r),className:"settings-section","aria-labelledby":`settings-section-${s}`,children:[e.jsx("header",{className:"settings-section__header",children:e.jsxs("div",{children:[e.jsx("h3",{id:`settings-section-${s}`,children:t(`settings.sections.${s}.title`)}),e.jsx("p",{children:t(`settings.sections.${s}.hint`)})]})}),e.jsx("div",{className:"settings-section__body",children:a})]})}function U(){const{t:s}=p(),l=c(n=>n.activeSettingsSection),a=c(n=>n.setActiveSettingsSection),t=c(n=>n.closeSettings),r=c(n=>n.openReadinessPopup),h=c(n=>n.galleryDefaultScope),m=c(n=>n.setGalleryDefaultScope),g=d.useRef(null),u=d.useRef(null),i=d.useRef(!1),x=d.useRef({account:null,generation:null,appearance:null,workspace:null,language:null,future:null}),o=(n,j)=>{x.current[n]=j},w=n=>{a(n),i.current=!0,x.current[n]?.scrollIntoView({behavior:"auto",block:"start"}),u.current!==null&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>{i.current=!1,u.current=null},120)};return d.useEffect(()=>{const n=j=>{j.key==="Escape"&&t()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t]),d.useEffect(()=>{const n=g.current;if(!n||typeof IntersectionObserver!="function")return;const j=new IntersectionObserver(_=>{if(i.current)return;const v=_.filter(N=>N.isIntersecting).sort((N,S)=>S.intersectionRatio-N.intersectionRatio)[0]?.target.id;v&&f.includes(v)&&a(v)},{root:n,threshold:[.35,.6]});for(const _ of f){const b=x.current[_];b&&j.observe(b)}return()=>j.disconnect()},[a]),d.useEffect(()=>()=>{u.current!==null&&window.clearTimeout(u.current)},[]),e.jsx("main",{ref:g,className:"settings-workspace","aria-labelledby":"settings-title",children:e.jsxs("div",{className:"settings-shell",children:[e.jsxs("header",{className:"settings-header",children:[e.jsxs("div",{children:[e.jsx("p",{className:"settings-eyebrow",children:s("settings.eyebrow")}),e.jsx("h2",{id:"settings-title",children:s("settings.title")}),e.jsx("p",{children:s("settings.subtitle")})]}),e.jsx("button",{type:"button",className:"settings-close",onClick:t,"aria-label":s("settings.closeAria"),title:s("settings.closeTitle"),children:"X"})]}),e.jsxs("div",{className:"settings-layout",children:[e.jsx("nav",{className:"settings-nav settings-nav--mobile","aria-label":s("settings.navAria"),children:e.jsx("div",{className:"settings-mobile-nav",role:"list",children:f.map(n=>e.jsxs("button",{type:"button",className:`settings-mobile-nav__item${l===n?" is-active":""}`,onClick:()=>w(n),"aria-current":l===n?"true":void 0,children:[e.jsx("span",{children:s(`settings.sections.${n}.title`)}),e.jsx("small",{children:s(`settings.sections.${n}.hint`)})]},n))})}),e.jsx("nav",{className:"settings-nav","aria-label":s("settings.navAria"),children:f.map(n=>e.jsxs("button",{type:"button",className:`settings-nav__item${l===n?" is-active":""}`,onClick:()=>w(n),"aria-label":s("settings.jumpTo",{section:s(`settings.sections.${n}.title`)}),children:[e.jsx("span",{children:s(`settings.sections.${n}.title`)}),e.jsx("small",{children:s(`settings.sections.${n}.hint`)})]},n))}),e.jsxs("section",{className:"settings-content","aria-label":s("settings.contentAria"),children:[e.jsxs(y,{id:"account",setRef:o,children:[e.jsx(I,{}),e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("readiness.settingsTitle")}),e.jsx("p",{children:s("readiness.settingsBody")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx("button",{type:"button",className:"settings-action-btn",onClick:r,children:s("readiness.open")})})]})]}),e.jsxs(y,{id:"generation",setRef:o,children:[e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("settings.imageModel.title")}),e.jsx("p",{children:s("settings.imageModel.body")}),e.jsx("p",{className:"settings-row__microcopy",children:s("settings.imageModel.unsupportedHelp")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx($,{variant:"settings"})})]}),e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("settings.reasoning.title")}),e.jsx("p",{children:s("settings.reasoning.body")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx(K,{})})]}),e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("settings.webSearch.title")}),e.jsx("p",{children:s("settings.webSearch.body")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx(O,{})})]}),e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("settings.gallery.defaultScopeTitle")}),e.jsx("p",{children:s("settings.gallery.defaultScopeBody")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsxs("select",{value:h,onChange:n=>m(n.target.value),"aria-label":s("settings.gallery.defaultScopeTitle"),children:[e.jsx("option",{value:"current-session",children:s("gallery.scope.current")}),e.jsx("option",{value:"all",children:s("gallery.scope.all")})]})})]})]}),e.jsxs(y,{id:"appearance",setRef:o,children:[e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("settings.appearance.themeTitle")}),e.jsx("p",{children:s("settings.appearance.themeBody")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx(F,{})})]}),e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("settings.appearance.historyStripLayoutTitle")}),e.jsx("p",{children:s("settings.appearance.historyStripLayoutBody")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx(M,{})})]})]}),e.jsx(y,{id:"workspace",setRef:o,children:e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("workspace.sectionTitle")}),e.jsx("p",{children:s("workspace.sectionBody")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx(G,{})})]})}),e.jsx(y,{id:"language",setRef:o,children:e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("settings.language.title")}),e.jsx("p",{children:s("settings.language.body")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx(P,{})})]})}),e.jsx(y,{id:"future",setRef:o,children:e.jsxs("article",{className:"settings-note",children:[e.jsx("h4",{children:s("settings.future.title")}),e.jsx("p",{children:s("settings.future.body")})]})})]})]})]})})}export{U as SettingsWorkspace};
1
+ import{u as p,f as k,h as T,j as e,b as c,i as E,k as L,a as d,T as R,I as $,W as O}from"./index-BAN6lKgf.js";function C(s){return s==="ready"?"Ready":s==="auth_required"?"Login required":s==="starting"?"Starting":s==="offline"?"Offline":"Checking"}function I(){const{t:s}=p(),l=k(),{data:a,error:t}=T(),r=a?.apiKeySource==="env"||a?.apiKeySource==="config"||a?.apiKeyValid===!0,h=l?.status==="ready",m=a?.apiKeySource==="config"?s("settings.account.apiSourceConfig"):s("settings.account.apiSourceEnv"),g=a?.apiKeyValid===!0;return e.jsxs(e.Fragment,{children:[e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("p",{className:"settings-eyebrow",children:s("settings.account.primaryEyebrow")}),e.jsx("h4",{children:s("settings.account.oauthTitle")}),e.jsx("p",{children:s("settings.account.oauthBody")})]}),e.jsxs("div",{className:`settings-status${h?" is-ok":""}`,children:[e.jsx("span",{"aria-hidden":"true"}),C(l?.status)]})]}),r?e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("p",{className:"settings-eyebrow",children:m}),e.jsx("h4",{children:s("settings.account.apiTitle")}),e.jsx("p",{children:s("settings.account.apiBody")})]}),e.jsxs("div",{className:`settings-status${g?" is-ok":" is-muted"}`,children:[e.jsx("span",{"aria-hidden":"true"}),s(t?"settings.account.apiUnknown":g?"settings.account.apiReady":"settings.account.apiUnavailable")]})]}):null]})}function K(){const{t:s}=p(),l=c(r=>r.reasoningEffort),a=c(r=>r.setReasoningEffort),t=r=>{a(r.target.value)};return e.jsx("div",{className:"image-model-select image-model-select--settings",children:e.jsx("select",{id:"settings-reasoning-effort",value:l,onChange:t,children:E.map(r=>e.jsx("option",{value:r.value,children:s(r.fullLabelKey)},r.value))})})}const A={ko:"KO",en:"EN"};function P(){const{t:s,locale:l}=p(),a=c(t=>t.setLocale);return e.jsx("div",{className:"lang-toggle",role:"group","aria-label":s("language.label"),children:L.map(t=>e.jsx("button",{type:"button",className:`lang-toggle__btn ${l===t?"is-active":""}`,onClick:()=>a(t),"aria-pressed":l===t,title:s(`language.${t}`),children:e.jsx("span",{className:"lang-toggle__label",children:A[t]})},t))})}const B=["system","dark","light"];function F(){const{t:s}=p(),l=c(i=>i.theme),a=c(i=>i.setTheme),t=c(i=>i.themeFamily),r=c(i=>i.setThemeFamily),[h,m]=d.useState(!1),g=d.useRef(null);d.useEffect(()=>{if(!h)return;const i=o=>{g.current&&(g.current.contains(o.target)||m(!1))},x=o=>{o.key==="Escape"&&m(!1)};return document.addEventListener("mousedown",i),document.addEventListener("keydown",x),()=>{document.removeEventListener("mousedown",i),document.removeEventListener("keydown",x)}},[h]);const u=i=>s(`theme.family.${i}`);return e.jsxs("div",{className:"theme-toggle","aria-label":s("theme.label"),children:[e.jsxs("div",{className:"theme-toggle__row",children:[e.jsx("span",{className:"theme-toggle__label",id:"theme-style-label",children:s("theme.styleLabel")}),e.jsxs("div",{className:"theme-toggle__family",ref:g,children:[e.jsxs("button",{type:"button",className:"theme-toggle__family-trigger","aria-haspopup":"listbox","aria-expanded":h,"aria-labelledby":"theme-style-label",onClick:()=>m(i=>!i),children:[e.jsx("span",{className:`theme-toggle__family-dot theme-toggle__family-dot--${t}`,"aria-hidden":"true"}),e.jsx("span",{className:"theme-toggle__family-name",children:u(t)}),e.jsx("span",{className:"theme-toggle__family-caret","aria-hidden":"true",children:"▾"})]}),h?e.jsx("ul",{className:"theme-toggle__family-menu",role:"listbox","aria-labelledby":"theme-style-label",children:R.map(i=>e.jsx("li",{role:"none",children:e.jsxs("button",{type:"button",role:"option","aria-selected":t===i,className:`theme-toggle__family-option ${t===i?"is-active":""}`,onClick:()=>{r(i),m(!1)},children:[e.jsx("span",{className:`theme-toggle__family-dot theme-toggle__family-dot--${i}`,"aria-hidden":"true"}),e.jsx("span",{className:"theme-toggle__family-name",children:u(i)})]})},i))}):null]})]}),e.jsxs("div",{className:"theme-toggle__row",children:[e.jsx("span",{className:"theme-toggle__label",id:"theme-mode-label",children:s("theme.modeLabel")}),e.jsx("div",{className:"theme-toggle__mode",role:"group","aria-labelledby":"theme-mode-label",children:B.map(i=>e.jsx("button",{type:"button",className:`theme-toggle__btn ${l===i?"is-active":""}`,onClick:()=>a(i),"aria-pressed":l===i,title:s(`theme.${i}`),children:s(`theme.${i}`)},i))})]})]})}const D=["rail","horizontal","sidebar"];function M(){const{t:s}=p(),l=c(t=>t.historyStripLayout),a=c(t=>t.setHistoryStripLayout);return e.jsx("div",{className:"history-layout-toggle",role:"group","aria-label":s("settings.appearance.historyStripLayoutTitle"),children:D.map(t=>e.jsx("button",{type:"button",className:`history-layout-toggle__btn ${l===t?"is-active":""}`,onClick:()=>a(t),"aria-pressed":l===t,title:s(`settings.appearance.historyStripLayout.${t}`),children:s(`settings.appearance.historyStripLayout.${t}`)},t))})}const W=[{value:"default",labelKey:"workspace.defaultLabel",descKey:"workspace.defaultDesc"},{value:"prompt-studio",labelKey:"workspace.promptStudioLabel",descKey:"workspace.promptStudioDesc"}];function G(){const s=c(t=>t.workspaceProfile),l=c(t=>t.setWorkspaceProfile),{t:a}=p();return e.jsxs("div",{className:"settings-field",children:[e.jsx("label",{className:"settings-field__label",children:a("workspace.profileLabel")}),e.jsx("div",{className:"settings-field__options",children:W.map(t=>e.jsxs("label",{className:"settings-radio-option",children:[e.jsx("input",{type:"radio",name:"workspaceProfile",value:t.value,checked:s===t.value,onChange:()=>l(t.value)}),e.jsxs("span",{className:"settings-radio-option__text",children:[e.jsx("strong",{children:a(t.labelKey)}),e.jsx("span",{className:"settings-radio-option__desc",children:a(t.descKey)})]})]},t.value))})]})}const f=["account","generation","appearance","workspace","language","future"];function y({id:s,setRef:l,children:a}){const{t}=p();return e.jsxs("section",{id:s,ref:r=>l(s,r),className:"settings-section","aria-labelledby":`settings-section-${s}`,children:[e.jsx("header",{className:"settings-section__header",children:e.jsxs("div",{children:[e.jsx("h3",{id:`settings-section-${s}`,children:t(`settings.sections.${s}.title`)}),e.jsx("p",{children:t(`settings.sections.${s}.hint`)})]})}),e.jsx("div",{className:"settings-section__body",children:a})]})}function U(){const{t:s}=p(),l=c(n=>n.activeSettingsSection),a=c(n=>n.setActiveSettingsSection),t=c(n=>n.closeSettings),r=c(n=>n.openReadinessPopup),h=c(n=>n.galleryDefaultScope),m=c(n=>n.setGalleryDefaultScope),g=d.useRef(null),u=d.useRef(null),i=d.useRef(!1),x=d.useRef({account:null,generation:null,appearance:null,workspace:null,language:null,future:null}),o=(n,j)=>{x.current[n]=j},w=n=>{a(n),i.current=!0,x.current[n]?.scrollIntoView({behavior:"auto",block:"start"}),u.current!==null&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>{i.current=!1,u.current=null},120)};return d.useEffect(()=>{const n=j=>{j.key==="Escape"&&t()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t]),d.useEffect(()=>{const n=g.current;if(!n||typeof IntersectionObserver!="function")return;const j=new IntersectionObserver(_=>{if(i.current)return;const v=_.filter(N=>N.isIntersecting).sort((N,S)=>S.intersectionRatio-N.intersectionRatio)[0]?.target.id;v&&f.includes(v)&&a(v)},{root:n,threshold:[.35,.6]});for(const _ of f){const b=x.current[_];b&&j.observe(b)}return()=>j.disconnect()},[a]),d.useEffect(()=>()=>{u.current!==null&&window.clearTimeout(u.current)},[]),e.jsx("main",{ref:g,className:"settings-workspace","aria-labelledby":"settings-title",children:e.jsxs("div",{className:"settings-shell",children:[e.jsxs("header",{className:"settings-header",children:[e.jsxs("div",{children:[e.jsx("p",{className:"settings-eyebrow",children:s("settings.eyebrow")}),e.jsx("h2",{id:"settings-title",children:s("settings.title")}),e.jsx("p",{children:s("settings.subtitle")})]}),e.jsx("button",{type:"button",className:"settings-close",onClick:t,"aria-label":s("settings.closeAria"),title:s("settings.closeTitle"),children:"X"})]}),e.jsxs("div",{className:"settings-layout",children:[e.jsx("nav",{className:"settings-nav settings-nav--mobile","aria-label":s("settings.navAria"),children:e.jsx("div",{className:"settings-mobile-nav",role:"list",children:f.map(n=>e.jsxs("button",{type:"button",className:`settings-mobile-nav__item${l===n?" is-active":""}`,onClick:()=>w(n),"aria-current":l===n?"true":void 0,children:[e.jsx("span",{children:s(`settings.sections.${n}.title`)}),e.jsx("small",{children:s(`settings.sections.${n}.hint`)})]},n))})}),e.jsx("nav",{className:"settings-nav","aria-label":s("settings.navAria"),children:f.map(n=>e.jsxs("button",{type:"button",className:`settings-nav__item${l===n?" is-active":""}`,onClick:()=>w(n),"aria-label":s("settings.jumpTo",{section:s(`settings.sections.${n}.title`)}),children:[e.jsx("span",{children:s(`settings.sections.${n}.title`)}),e.jsx("small",{children:s(`settings.sections.${n}.hint`)})]},n))}),e.jsxs("section",{className:"settings-content","aria-label":s("settings.contentAria"),children:[e.jsxs(y,{id:"account",setRef:o,children:[e.jsx(I,{}),e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("readiness.settingsTitle")}),e.jsx("p",{children:s("readiness.settingsBody")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx("button",{type:"button",className:"settings-action-btn",onClick:r,children:s("readiness.open")})})]})]}),e.jsxs(y,{id:"generation",setRef:o,children:[e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("settings.imageModel.title")}),e.jsx("p",{children:s("settings.imageModel.body")}),e.jsx("p",{className:"settings-row__microcopy",children:s("settings.imageModel.unsupportedHelp")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx($,{variant:"settings"})})]}),e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("settings.reasoning.title")}),e.jsx("p",{children:s("settings.reasoning.body")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx(K,{})})]}),e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("settings.webSearch.title")}),e.jsx("p",{children:s("settings.webSearch.body")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx(O,{})})]}),e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("settings.gallery.defaultScopeTitle")}),e.jsx("p",{children:s("settings.gallery.defaultScopeBody")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsxs("select",{value:h,onChange:n=>m(n.target.value),"aria-label":s("settings.gallery.defaultScopeTitle"),children:[e.jsx("option",{value:"current-session",children:s("gallery.scope.current")}),e.jsx("option",{value:"all",children:s("gallery.scope.all")})]})})]})]}),e.jsxs(y,{id:"appearance",setRef:o,children:[e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("settings.appearance.themeTitle")}),e.jsx("p",{children:s("settings.appearance.themeBody")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx(F,{})})]}),e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("settings.appearance.historyStripLayoutTitle")}),e.jsx("p",{children:s("settings.appearance.historyStripLayoutBody")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx(M,{})})]})]}),e.jsx(y,{id:"workspace",setRef:o,children:e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("workspace.sectionTitle")}),e.jsx("p",{children:s("workspace.sectionBody")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx(G,{})})]})}),e.jsx(y,{id:"language",setRef:o,children:e.jsxs("article",{className:"settings-row",children:[e.jsxs("div",{className:"settings-row__copy",children:[e.jsx("h4",{children:s("settings.language.title")}),e.jsx("p",{children:s("settings.language.body")})]}),e.jsx("div",{className:"settings-row__control",children:e.jsx(P,{})})]})}),e.jsx(y,{id:"future",setRef:o,children:e.jsxs("article",{className:"settings-note",children:[e.jsx("h4",{children:s("settings.future.title")}),e.jsx("p",{children:s("settings.future.body")})]})})]})]})]})})}export{U as SettingsWorkspace};