PageSourceSearch

https://www.freecanvas.ai.kr/assets/ProjectHistory-SPdI5-Bl.js

js freecanvas.ai.kr collected 2026-10-02 01:59:26 UTC 55,451 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/shareComments-BhcYGG95.js","assets/vendor-firebase-Dak2Hxsr.js","assets/firebase-FBroemQC.js","assets/firestoreService-7NrzI4tJ.js","assets/index-CL-0Jw9t.js","assets/vendor-react-Hmgc0IJo.js","assets/index-BDOMsqD5.css","assets/detailHtml-BUUBOfBA.js","assets/storageService-BSSwqqbq.js","assets/userService-j0Fmw12X.js","assets/userNotifications-BFSmaFGp.js"])))=>i.map(i=>d[i]);
2import{s as B,n as J,a as Pe,_ as ae}from"./index-CL-0Jw9t.js";import{r as d,j as e}from"./vendor-react-Hmgc0IJo.js";import{s as Ae}from"./shareCommentRules-Bqb9G7Ec.js";import{E as Be,Q as Le}from"./AppAuthenticated-DS7p-za4.js";import{a7 as Ue,a8 as $e,a9 as Te}from"./firestoreService-7NrzI4tJ.js";import{g as I,t as Me}from"./storageService-BSSwqqbq.js";import{d as We}from"./downloadFile-DbTs4Tyj.js";import"./detailHtml-BUUBOfBA.js";import"./vendor-genai-Ca_DMGSD.js";import"./firebase-FBroemQC.js";import"./vendor-firebase-Dak2Hxsr.js";import"./userNotifications-BFSmaFGp.js";import"./userService-j0Fmw12X.js";const Ve=s=>s.deletedAt?"trash":s.projectKind==="link-import"?"draft":s.status||"completed",re=s=>{const l=new Date(s).getTime();return Number.isFinite(l)?l:0},_e=(s,{status:l,favoritesOnly:o,sort:c})=>s.filter(i=>{const m=Ve(i);return l==="trash"?m==="trash"&&(!o||i.isFavorite===!0):m==="trash"?!1:(!o||i.isFavorite===!0)&&(l==="all"||m===l)}).sort((i,m)=>(c==="name"?i.name.localeCompare(m.name,"ko",{numeric:!0,sensitivity:"base"}):re(c==="created"?m.createdAt:m.updatedAt)-re(c==="created"?i.createdAt:i.updatedAt))||i.id.localeCompare(m.id)),ze=s=>{var c,i;const l=(s.images||[]).filter(m=>m.status==="completed").length,o=Math.max(((c=s.plan)==null?void 0:c.length)||0,((i=s.images)==null?void 0:i.length)||0);return{completed:l,total:o,percent:o?Math.min(100,l/o*100):0}},Re=({project:s,onClose:l,onPrepare:o,onApply:c})=>{const[i,m]=d.useState("product"),[u,b]=d.useState(!1),[r,N]=d.use
2State(null),[w,f]=d.useState(""),D=d.useRef(null);d.useEffect(()=>()=>{var x;(x=D.current)==null||x.abort()},[]);const E=()=>{var x;(x=D.current)==null||x.abort(),l()},F=async()=>{if(u)return;const x=new AbortController;D.current=x,b(!0),f("");try{const p=r||await o(s,i,x.signal);if(x.signal.aborted)return;if(!r&&p.warnings.length){N(p);return}await c(p,x.signal)}catch(p){if(x.signal.aborted)return;f(p instanceof Error?p.message:"준비하지 못했습니다. 다시 시도해 주세요.")}finally{x.signal.aborted||b(!1)}};return e.jsxs(Be,{title:"이 작업으로 새로 만들기",onClose:E,footer:e.jsxs("div",{className:"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",children:[e.jsx("button",{type:"button",onClick:E,className:"rounded-xl border border-slate-200 px-5 py-3 text-sm font-medium hover:bg-slate-50",children:"취소"}),e.jsx("button",{type:"button",disabled:u,onClick:()=>void F(),className:"rounded-xl bg-[#285D5B] px-5 py-3 text-sm font-semibold text-white hover:bg-[#1D4745] disabled:opacity-60",children:u?"준비 중…":r?"사진 누락 확인 후 시작":"이 내용으로 시작"})]}),children:[e.jsxs("p",{className:"text-sm leading-6 text-slate-600",children:[e.jsx("span",{className:"font-semibold text-slate-900",children:s.name}),"에서 무엇을 가져올까요?"]}),e.jsx("div",{className:"grid gap-3 sm:grid-cols-2",role:"group","aria-label":"재사용할 내용",children:[["product","같은 상품으로 새로 만들기","상품 정보·사진·옵션·고시를 복사해 수정해요."],["design","스타일만 가져오기","디자인 설정만 가져오고, 상품 정보는 새로 입력해요."]].map(([x,p,M])=>e.jsxs("button",{type:"button","aria-pressed":i===x,disabled:u,onClick:()=>{m(x),N(null),f("")},className:`rounded-2xl border-2 p-4 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-teal-600 focus-visible:ring-offset-2 ${i===x?"border-[#48A9A6] bg-[#F0F8F7]":"border-slate-200 bg-white hover:border-slate-300"}`,children:[e.jsxs("span",{className:"flex items-start gap-2 font-semibold text-slate-900",children:[e.jsx("span",{"aria-hidden":"true",className:i===x?"text-teal-600":"text-slate-300",children:i===x?"●":"○"}),p]}),e.jsx("span",{className:"mt-2 block text-sm leading-6 text-slate-600",children:M})]},x))}),e.jsx("p",{className:"text-xs leading-6 text-slate-500",children:"원본은 그대로 유지돼요. 실제 생성 전까지 크레딧은 사용하지 않습니다."}),e.jsxs("details",{className:"rounded-xl bg-slate-50 px-4 py-3 text-xs leading-6 text-slate-600",children:[e.jsx("summary",{className:"cursor-pointer font-medium",children:"가져오지 않는 내용 · 확인 사항"}),e.jsxs("p",{className:"mt-2",children:["생성된 결과 이미지·캔버스 배치·수정 이력·공유 설정은 복사하지 않습니다.",i==="design"?" 상품명·사진·브랜드명·옵션·고시는 새 상품에 맞게 입력해 주세요.":" 옵션·고시의 사실 정보는 직접 확인해 주세요."," ","실제 생성 시 기존 이용 한도가 적용됩니다."]})]}),r&&e.jsxs("div",{role:"alert",className:"rounded-xl border border-amber-200 bg-amber-50 p-4 text-sm text-amber-900",children:[e.jsx("p",{className:"font-semibold",children:"일부 사진을 가져오지 못했습니다"}),e.jsx("ul",{className:"mt-2 list-disc space-y-1 pl-5",children:r.warnings.map((x,p)=>e.jsx("li",{children:x},p))}),e.jsx("button",{type:"button",disabled:u,onClick:()=>{N(null),f("")},className:"mt-3 underline underline-offset-4",children:"사진 다시 불러오기"})]}),w&&e.jsx("p",{role:"alert",className:"rounded-xl bg-red-50 p-3 text-sm text-red-700",children:w}),u&&e.jsx("p",{role:"status",className:"text-sm text-[#285D5B]",children:"원본 사진을 준비하고 있습니다. 사진 수에 따라 잠시 걸릴 수 있습니다."})]})},Ne={all:"전체 상태","in-progress":"진행 중",completed:"완료",failed:"실패",draft:"링크 초안",trash:"휴지통"},ye={updated:"최근 수정순",created:"최근 생성순",name:"이름순"},Ke=({query:s,onQuery:l,type:o,onType:c,typeOptions:i,status:m,onStatus:u,favoritesOnly:b,onFavorites:r,sort:N,onSort:w,view:f,onView:D,count:E,total:F,onReset:x})=>{var R;const[p,M]=d.useState(!1),P=d.useId(),j=o==="video-translation",A=[o!=="all"&&((R=i.find(h=>h.value===o))==null?void 0:R.label),!j&&m!=="all"&&Ne[m],!j&&b&&"즐겨찾기",!j&&N!=="updated"&&ye[N],!j&&f==="list"&&"목록 보기"].filter(
2Boolean),O=!!s||A.length>0;return e.jsxs("div",{className:"mb-5 rounded-2xl border border-slate-200 bg-white p-3 sm:p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative min-w-0 flex-1",children:[e.jsx("svg",{"aria-hidden":"true",className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-4.35-4.35m1.35-5.15a6.5 6.5 0 11-13 0 6.5 6.5 0 0113 0z"})}),e.jsx("input",{type:"search","aria-label":"작업 내역 검색",placeholder:"이름·설명으로 검색",value:s,onChange:h=>l(h.target.value),className:"min-h-11 w-full rounded-xl border border-slate-200 bg-slate-50 py-2 pl-9 pr-9 text-base text-slate-900 placeholder:text-slate-400 focus:border-teal-600 focus:outline-none sm:text-sm"}),s&&e.jsx("button",{type:"button","aria-label":"검색어 지우기",onClick:()=>l(""),className:"absolute right-1 top-1/2 h-9 w-9 -translate-y-1/2 rounded-lg text-slate-500 hover:bg-slate-200",children:"×"})]}),e.jsxs("button",{type:"button","aria-expanded":p,"aria-controls":P,onClick:()=>M(h=>!h),className:`min-h-11 shrink-0 rounded-xl border px-3 text-sm font-medium ${p?"border-teal-200 bg-teal-50 text-teal-800":"border-slate-200 text-slate-600 hover:bg-slate-50"}`,children:["필터·보기 ",e.jsx("span",{"aria-hidden":"true",children:p?"−":"+"})]})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 text-xs text-slate-500",children:[e.jsxs("p",{role:"status",className:"mr-auto",children:[e.jsxs("span",{className:"font-semibold text-slate-800",children:[E,"개"]})," 표시 · 전체 ",F,"개"]}),A.map(h=>e.jsx("span",{className:"rounded-md bg-teal-50 px-2 py-1 text-teal-800",children:h},String(h))),O&&e.jsx("button",{type:"button",onClick:x,className:"min-h-8 rounded-lg px-2 text-slate-500 underline underline-offset-4 hover:bg-slate-50",children:"초기화"})]}),e.jsxs("div",{id:P,hidden:!p,className:p?"mt-3 flex flex-wrap items-center gap-3 border-t border-slate-100 pt-3":"hidden",children:[e.jsxs("label",{className:"flex min-h-11 max-w-full items-center gap-2 text-sm text-slate-500",children:["유형",e.jsx("select",{"aria-label":"작업 유형",value:o,onChange:h=>c(h.target.value),className:"min-w-0 max-w-full rounded-lg border border-slate-200 bg-white p-2 text-base text-slate-900 focus:outline-teal-600 sm:text-sm",children:i.map(h=>e.jsxs("option",{value:h.value,children:[h.label," (",h.count,")"]},h.value))})]}),!j&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"flex min-h-11 items-center gap-2 text-sm text-slate-500",children:["상태",e.jsx("select",{"aria-label":"작업 상태",value:m,onChange:h=>u(h.target.value),className:"rounded-lg border border-slate-200 bg-white p-2 text-base text-slate-900 focus:outline-teal-600 sm:text-sm",children:Object.entries(Ne).map(([h,k])=>e.jsx("option",{value:h,children:k},h))})]}),e.jsx("button",{type:"button","aria-pressed":b,onClick:()=>r(!b),className:`min-h-11 rounded-xl border px-3 text-sm ${b?"border-amber-300 bg-amber-50 text-amber-800":"border-slate-200 text-slate-600 hover:bg-slate-50"}`,children:"★ 즐겨찾기만"}),e.jsxs("label",{className:"flex min-h-11 items-center gap-2 text-sm text-slate-500",children:["정렬",e.jsx("select",{"aria-label":"작업 정렬",value:N,onChange:h=>w(h.target.value),className:"rounded-lg border border-slate-200 bg-white p-2 text-base text-slate-900 focus:outline-teal-600 sm:text-sm",children:Object.entries(ye).map(([h,k])=>e.jsx("option",{value:h,children:k},h))})]}),e.jsx("div",{role:"group","aria-label":"작업 보기 방식",className:"flex rounded-xl bg-slate-100 p-1",children:["grid","list"].map(h=>e.jsx("button",{type:"button","aria-pressed":f===h,onClick:()=>D(h),className:`min-h-10 rounded-lg px-3 text-sm ${f===h?"bg-white font-semibold text-[#285D5B] shadow-sm":"text-slate-500 hover:text-slate-900"}`,children:h==="grid"?"카드":"목록"},h))})]})]})]})},He=(s,l,o)=>
2{const[c,i]=d.useState(null),[m,u]=d.useState(!0),b=s.rawStoragePath||s.storagePath;return d.useEffect(()=>{let r=!0;return(async()=>{if(u(!0),b)try{const f=await I(b);r&&(i(f),u(!1));return}catch(f){console.warn("최신 URL 가져오기 실패:",b,f)}const w=s.rawImageUrl||s.imageUrl;if(w){r&&(i(w),u(!1));return}if(l&&o)try{s.id;const f=await Me(o,l,s.id);if(f&&r){i(f),u(!1);return}}catch(f){console.warn("❌ 경로 재구성 실패:",f)}r&&(i(null),u(!1))})(),()=>{r=!1}},[b,s.rawImageUrl,s.imageUrl,s.id,l,o]),c},S=s=>{var o,c,i,m;const l=s;return l.projectKind==="detail-editor"||l.projectKind==="link-import"?l.projectKind:!((o=s.plan)!=null&&o.length)&&((m=(i=(c=s.detailBlockEditorDraft)==null?void 0:c.importedDocument)==null?void 0:i.blocks)!=null&&m.length)?"detail-editor":"generated"},je=s=>{var m,u,b,r,N,w,f,D,E,F;const l=s;if(l.detailEditorSummary)return l.detailEditorSummary;const o=((u=(m=s.detailBlockEditorDraft)==null?void 0:m.importedDocument)==null?void 0:u.blocks)||[];if(o.length===0)return;const c=o.filter(x=>x.type==="image"),i=o.filter(x=>x.type==="text");return{blockCount:o.length,imageBlockCount:c.length,textBlockCount:i.length,referenceImageCount:((r=(b=s.detailBlockEditorDraft)==null?void 0:b.referenceImages)==null?void 0:r.length)||0,pageTitle:(w=(N=s.detailBlockEditorDraft)==null?void 0:N.importedDocument)==null?void 0:w.pageTitle,previewStoragePath:((f=c.find(x=>x.storagePath))==null?void 0:f.storagePath)||((F=(E=(D=s.detailBlockEditorDraft)==null?void 0:D.referenceImages)==null?void 0:E.find(x=>x.storagePath))==null?void 0:F.storagePath)}},Se=(s,l)=>
2{const[o,c]=d.useState(l||null);return d.useEffect(()=>{let i=!0;return(async()=>{if(l){c(l);return}if(!s){c(null);return}try{const u=await I(s);i&&c(u)}catch(u){console.warn("상세 편집 미리보기 URL 로드 실패:",s,u),i&&c(null)}})(),()=>{i=!1}},[l,s]),o},Ce=({img:s,alt:l,projectId:o,userId:c})=>{const i=He(s,o,c),[m,u]=d.useState(!1),[b,r]=d.useState(!1),N=d.useCallback(async()=>{if(m||b)return;console.error("썸네일 로드 실패:",{imageId:s.id,sectionTitle:s.sectionTitle,storagePath:s.rawStoragePath||s.storagePath});const w=s.rawStoragePath||s.storagePath;if(w){r(!0);try{(await I(w,!0)).substring(0,100)}catch(f){console.error("최신 URL 획득 실패:",f),u(!0)}finally{r(!1)}}else u(!0)},[s,m,b]);return m||!i?null:e.jsx("img",{src:i,alt:l,className:"w-full h-full object-cover",loading:"lazy",decoding:"async",crossOrigin:i.includes("firebasestorage.googleapis.com")?void 0:"anonymous",onError:N})},le=({storagePath:s,dataUrl:l,alt:o})=>{const c=Se(s,l);return c?e.jsx("img",{src:c,alt:o,className:"w-full h-full object-cover",loading:"lazy",decoding:"async"}):null},Oe=s=>s?{none:"브랜드 미노출",subtle:"은은하게 노출","ending-only":"마지막에만 노출",all:"전체 노출"}[s]:"노출 방식 미설정",Qe=s=>!!(s!=null&&s.brandPresetId||s!=null&&s.brandPresetName||s!=null&&s.brandName||s!=null&&s.brandSlogan||s!=null&&s.brandLogoUrl||s!=null&&s.brandTone||s!=null&&s.brandColorPalette||s!=null&&s.brandLayoutDirection),De=({productInfo:s})=>{const l=Se(s==null?void 0:s.brandLogoStoragePath,s==null?void 0:s.brandLogoUrl);if(!Qe(s))return null;const o=(s==null?void 0:s.brandPresetName)||(s==null?void 0:s.brandName)||"브랜드 스타일",c=((s==null?void 0:s.brandName)||(s==null?void 0:s.brandPresetName)||"B").slice(0,1),i=[s!=null&&s.brandName?`브랜드 ${s.brandName}`:"프리셋 적용",Oe(s==null?void 0:s.brandMentionMode)];return e.jsx("div",{className:"mb-4 rounded-lg border border-blue-100 bg-blue-50/70 px-3 py-2",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-8 w-8 flex-shrink-0 overflow-hidden rounded-md border border-blue-100 bg-white",children:l?e.jsx("img",{src:l,alt:o,className:"h-full w-full object-contain p-1"}):e.jsx("div",{className:"flex h-full w-full items-center justify-center text-xs font-bold text-blue-700",children:c})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-[11px] font-bold text-blue-900",children:o}),e.jsx("div",{className:"mt-0.5 truncate text-[10px] font-medium text-blue-700",children:i.join(" · ")})]})]})})},Fe=({productInfo:s})=>{const l=Array.isArray(s==null?void 0:s.productOptions)?s.productOptions:[],o=l.filter(r=>r.name||r.description||r.hasImage).length,c=l.filter(r=>r.hasImage||r.imageStoragePath||r.imageUrl).length,i=!!(s!=null&&s.productNotice)&&Object.values(s.productNotice).some(r=>typeof r=="string"&&r.trim().length>0),m=!!(s!=null&&s.productNoticeDisplayImageStoragePath||s!=null&&s.productNoticeDisplayImageUrl),u=(s==null?void 0:s.aiDisclosureEnabled)===!0,b=[o>0?`옵션 ${o}개${c?` · 이미지 ${c}`:""}`:"",i?`상품정보제공고시${m?" · 사진":""}`:"",u?"AI 표시 포함":""].filter(Boolean);return b.length===0?null:e.jsx("div",{className:"mb-4 flex flex-wrap gap-1.5",children:b.map(r=>e.jsx("span",{className:"rounded-full border border-slate-200 bg-white px-2 py-1 text-[10px] font-semibold text-slate-600",children:r},r))})},qe=({project:s,onClose:l,onShare:o})=>{const[c,i]=d.useState(""),[m,u]=d.useState(!1),[b,r]=d.useState(!1),{user:N}=Pe(),[w,f]=d.useState({isPublic:s.isPublic===!0,shareToken:s.shareToken}),[D,E]=d.useState(!1),[F,x]=d.useState(null),[p,M]=d.useState(null);d.useEffect(()=>{if(!s.isPublic)return;let k=!1;return ae(async()=>{const{getProjectShareComments:y}=await import("./shareComments-BhcYGG95.js");return{getProjectShareComments:y}},__vite__mapDeps([0,1,2])).then(({getProjectShareComments:y})=>y(s.id)).then(y=>{k||M(Ae(y))}).catch(()=>{}),()=>{k=!0}},[s.id,s.isPublic]);const P=d.useRef(!1),j=()=>{P.current&&o(),l()},A=w.isPublic&&w.shareToken?`${window.location.origin}${window.location.pathname}?share=${encodeURIComponent(w.shareToken)}`:null,O=async()=>
2{if(!D){E(!0),x(null);try{const{setProjectPublicShare:k}=await ae(async()=>{const{setProjectPublicShare:W}=await import("./firestoreService-7NrzI4tJ.js").then(K=>K.ar);return{setProjectPublicShare:W}},__vite__mapDeps([3,4,5,6,1,2,7,8])),y=await k(s.id,!w.isPublic,w.shareToken);f(y),x(y.isPublic?"공개 링크를 켰어요. 아래 링크를 복사해 전달하세요.":"공개 링크를 껐어요. 기존 링크로는 더 이상 열리지 않습니다."),P.current=!0}catch(k){console.error("공개 링크 설정 실패:",k),x("공개 링크 설정에 실패했습니다. 잠시 후 다시 시도해 주세요.")}finally{E(!1)}}},R=async()=>{if(A)try{await navigator.clipboard.writeText(A),x("링크를 복사했어요.")}catch{x("복사하지 못했습니다. 링크를 직접 선택해 복사해 주세요.")}},h=async()=>{if(!c||!N)return;const k=c.trim().toLowerCase();if(!k||!k.includes("@")){B("유효한 이메일 주소를 입력해주세요.");return}try{r(!0);const{validateUserEmailForSharing:y}=await ae(async()=>{const{validateUserEmailForSharing:K}=await import("./userService-j0Fmw12X.js");return{validateUserEmailForSharing:K}},__vite__mapDeps([9,4,5,6,1,2,3,7,8,10])),W=await y(k);if(r(!1),!W.isValid){B(W.message||"사용자 검증에 실패했습니다.");return}if(!W.hasActiveSubscription){B(W.message||"구독 중인 사용자에게만 프로젝트를 공유할 수 있습니다.");return}u(!0),s.id,await Te(s.id,N.uid,k),B("프로젝트가 공유되었습니다."),o(),l(),i("")}catch(y){r(!1),console.error("❌ 프로젝트 공유 실패:",y),B("공유에 실패했습니다: "+(y instanceof Error?y.message:"알 수 없는 오류"))}finally{u(!1)}};return e.jsx("div",{className:"fixed inset-0 z-50 bg-black/50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-white rounded-xl max-w-md w-full p-6",children:[e.jsx("h3",{className:"text-xl font-bold mb-4",children:"프로젝트 공유"}),e.jsxs("div",{className:"mb-5 rounded-xl border border-slate-200 bg-slate-50 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-semibold text-slate-800",children:"🔗 공개 링크로 보여주기"}),e.jsx("div",{className:"text-[11px] text-slate-500 break-keep",children:"가입 없이 누구나 읽기 전용으로 ë³´ê³ , 섹션을 눌러 코멘트를 남길 수 있어요. 거래처·사장님 확인용."})]}),e.jsx("button",{type:"button",onClick:()=>{O()},disabled:D,"aria-pressed":w.isPublic,className:`flex-shrink-0 rounded-full px-3 py-1.5 text-xs font-semibold transition-colors disabled:opacity-50 ${w.isPublic?"bg-emerald-600 text-white hover:bg-emerald-700":"bg-white border border-slate-300 text-slate-700 hover:bg-slate-100"}`,children:D?"처리 중…":w.isPublic?"켜짐 · 끄기":"켜기"})]}),A&&e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx("input",{readOnly:!0,value:A,onFocus:k=>k.currentTarget.select(),className:"min-w-0 flex-1 rounded-lg border border-slate-300 bg-white px-2 py-1.5 text-[11px] text-slate-700","aria-label":"공개 링크"}),e.jsx("button",{type:"button",onClick:()=>{R()},className:"flex-shrink-0 rounded-lg bg-slate-900 px-3 py-1.5 text-xs font-semibold text-white hover:bg-slate-800",children:"복사"})]}),F&&e.jsx("p",{className:"mt-2 text-[11px] text-slate-600",role:"status",children:F}),w.isPublic&&p&&e.jsxs("p",{className:"mt-2 text-[11px] text-indigo-700 break-keep","data-share-comment-summary":"1",children:["💬 ",p," — 작업을 열면 ê²°ê³¼ 화면 상단에서 확인·반영 처리할 수 있어요."]})]}),e.jsxs("p",{className:"text-sm text-slate-600 mb-4",children:["또는 프리캔버스 사용자에게 편집 권한으로 공유할 수 있어요. 공유할 사용자의 이메일을 입력하세요.",e.jsx("br",{}),e.jsx("span",{className:"text-xs text-slate-500",children:"※ 구독 중인 사용자에게만 공유할 수 있습니다."}),e.jsx("br",{}),e.jsx("span",{className:"text-xs text-amber-600",children:"※ 한 명과만 공유 가능합니다."})]}),e.jsx("input",{type:"email",value:c,onChange:k=>i(k.target.value),placeholder:"[email protected]",disabled:b||m,className:"w-full px-4 py-2 border border-slate-300 rounded-lg mb-4 focus:outline-none focus:ring-2 focus:ring-[#48A9A6] focus:border-[#48A9A6] disabled:opacity-50 disabled:cursor-not-allowed"}),(b||m)&&e.jsxs("div",{className:"mb-4 text-sm text-[#48A9A6] flex items-center gap-2",children:[e.jsxs("svg",{className:"animate-spin h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),b?"사용자 검증 중...":"공유 중..."]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:j,disabled:b||m,className:"flex-1 px-4 py-2 bg-slate-200 text-slate-700 rounded-lg hover:bg-slate-300 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:"취소"}),e.jsx("button",{onClick:h,disabled:!c||b||m,className:"flex-1 px-4 py-2 bg-[#48A9A6] text-white rounded-lg hover:bg-[#3D908D] disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:m?"공유 중...":b?"검증 중...":"공유"})]})]})})},nt=({projects:s,videoTranslationJobs:l=[],onDeleteVideoJob:o,onLoadProject:c,onDeleteProject:i,onRestoreProject:m,onPurgeProject:u,onEditProject:b,currentUser:r,onPrepareReuse:N,onApplyReuse:w,onToggleFavorite:f,onBack:D,onNewProject:E,onShare:F,isLoading:x,sharedProjects:p=[],initialFilter:M="all",detailEditorImportMode:P=!1})=>
2{const[j,A]=d.useState(M),[O,R]=d.useState(""),[h,k]=d.useState("all"),[y,W]=d.useState(!1),[K,ie]=d.useState("updated"),[H,ne]=d.useState("grid"),[de,oe]=d.useState(null),[ce,me]=d.useState([]),[xe,he]=d.useState(""),[V,X]=d.useState(s.length===0&&p.length>0?"shared":"mine"),[ue,ee]=d.useState(null),ge=()=>{ie("updated"),ne("grid"),R(""),k("all"),W(!1),A("all")},Ee=async t=>{if(!(!f||ce.includes(t.id))){me(a=>[...a,t.id]),he("");try{await f(t)}catch{he("즐겨찾기를 저장하지 못했습니다. 기존 상태를 유지했습니다. 다시 시도해 주세요.")}finally{me(a=>a.filter(n=>n!==t.id))}}};d.useEffect(()=>{A(M)},[M]),d.useEffect(()=>{V==="mine"&&s.length===0&&p.length>0?X("shared"):V==="shared"&&p.length===0&&s.length>0&&X("mine")},[V,s.length,p.length]);const Y=d.useCallback(t=>{var v;const a=S(t),n=((v=t.productInfo)==null?void 0:v.pageType)||"general";return a==="detail-editor"||n==="general"||n==="clothing"||n==="fresh-produce"},[]),_=O.trim().toLowerCase(),be=d.useCallback(t=>{var n,v,U,$,T;return _?[t.name,(n=t.productInfo)==null?void 0:n.name,(v=t.productInfo)==null?void 0:v.description,(U=t.linkImportSummary)==null?void 0:U.title,(T=($=t.detailBlockEditorDraft)==null?void 0:$.importedDocument)==null?void 0:T.pageTitle].filter(Boolean).join(" ").toLowerCase().includes(_):!0},[_]),Q=d.useMemo(()=>{let t;return j==="video-translation"?[]:(j==="all"?t=s:j==="detail-editor"?t=s.filter(a=>P?Y(a):S(a)==="detail-editor"):j==="link-import"?t=s.filter(a=>S(a)==="link-import"):t=s.filter(a=>{var n;return(((n=a.productInfo)==null?void 0:n.pageType)||"general")===j&&S(a)!=="detail-editor"}),_e(t.filter(be),{status:h,favoritesOnly:y,sort:K}))},[s,j,P,Y,be,h,y,K]),te=d.useMemo(()=>_?l.filter(t=>[t.fileName,t.selectedVideoUrl,t.sourceUrl].filter(Boolean).join(" ").toLowerCase().includes(_)):l,[l,_]),L=d.useMemo(()=>({all:s.length,general:s.filter(t=>{var a,n;return(((a=t.productInfo)==null?void 0:a.pageType)==="general"||!((n=t.productInfo)!=null&&n.pageType))&&S(t)!=="detail-editor"}).length,clothing:s.filter(t=>{var a;return((a=t.productInfo)==null?void 0:a.pageType)==="clothing"&&S(t)!=="detail-editor"}).length,freshProduce:s.filter(t=>{var a;return((a=t.productInfo)==null?void 0:a.pageType)==="fresh-produce"&&S(t)!=="detail-editor"}).length,cardnews:s.filter(t=>{var a;return((a=t.productInfo)==null?void 0:a.pageType)==="cardnews"&&S(t)!=="detail-editor"}).length,thumbnail:s.filter(t=>{var a;return((a=t.productInfo)==null?void 0:a.pageType)==="thumbnail"&&S(t)!=="detail-editor"}).length,detailEditor:s.filter(t=>P?Y(t):S(t)==="detail-editor").length,linkImport:s.filter(t=>S(t)==="link-import").length,videoTranslation:l.length}),[s,P,Y,l.length]),pe=d.useMemo(()=>({mine:s.length,shared:p.length}),[s.length,p.length]),fe=d.useCallback(t=>{var n,v,U,$,T,z,C,G;if(t.images.length>0)return[t.images.find(g=>g.status==="completed")||t.images[0]].map(g=>({id:g.id,type:"generated",img:g,alt:g.sectionTitle}));if(S(t)==="link-import"){const g=(n=t.originalImageStoragePaths)==null?void 0:n[0],ve=((v=t.originalImagesUrls)==null?void 0:v[0])||((U=t.linkImportSummary)==null?void 0:U.thumbnailUrl);return g||ve?[{id:`${t.id}-link-import-preview`,type:"stored",storagePath:g,dataUrl:g?void 0:ve,alt:(($=t.linkImportSummary)==null?void 0:$.title)||t.name||"링크 초안 이미지"}]:[]}if(S(t)!=="detail-editor")return[];const a=((C=(z=(T=t.detailBlockEditorDraft)==null?void 0:T.importedDocument)==null?void 0:z.blocks)==null?void 0:C.filter(g=>g.type==="image").slice(0,1))||[];return a.length>0?a.map(g=>({id:g.id,type:"stored",storagePath:g.storagePath,dataUrl:g.dataUrl,alt:g.name||"상세 편집 이미지"})):(((G=t.detailBlockEditorDraft)==null?void 0:G.referenceImages)||[]).slice(0,1).map(g=>({id:g.id,type:"stored",storagePath:g.storagePath,dataUrl:g.dataUrl,alt:g.name}))},[]),[q,we]=d.useState(null),se=d.useCallback(async(t,a)=>{we(t);try{const n=await I(t,!0);await We(n,a)==="opened"&&B('바로 저장이 막혀 새 탭으로 열었습니다. 영상에서 마우스 오른쪽 버튼 → "동영상을 다른 이름으로 저장"으로 받아주세요.')}catch(n){console.error("영상 번역 에셋 다운로드 실패:",n),B("다운로드에 실패했습니다. 잠시 후 다시 시도해주세요.")}finally{we(null)}},[]);if(x)return e.jsxs("div",{className:"max-w-6xl mx-auto px-3 sm:px-4",children:[e.jsxs("div",{role:"status",className:"text-center py-12",children:[e.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-[#48A9A6]"}),e.jsx("p",{className:"mt-4 text-slate-600 break-keep",children:"작업 내역 불러오는 중..."})]}),e.jsx("div",{"aria-hidden":"true",className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[0,1,2].map(t=>e.jsx("div",{className:"h-80 animate-pulse rounded-2xl border border-slate-100 bg-slate-100 motion-reduce:animate-none"},t))})]});if(s.length===0&&l.length===0&&(!p||p.length===0))return e.jsx("div",{className:"max-w-6xl mx-auto px-3 sm:px-4",children:e.jsxs("div",{className:"text-center py-16 bg-gradient-to-b from-[#F0F8F7] to-white rounded-3xl shadow-sm border border-[#D6E8E6] px-6",children:[e.jsx("svg",{className:"mx-auto h-12 w-12 text-slate-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),e.jsx("h3",{className:"mt-4 text-base sm:text-lg font-medium text-slate-900 break-keep",children:"저장된 작업이 없습니다"}),e.jsxs("p",{className:"mt-2 text-sm text-slate-500 break-keep leading-relaxed",children:["제품 사진이나 상품 링크로 첫 상세페이지를 만들어보세요.",e.jsx("br",{}
2),"완성한 작업은 여기서 모아 ë³´ê³ , 다음 상품에 재사용할 수 있어요."]}),(E||D)&&e.jsxs("button",{onClick:E||D,className:"mt-5 inline-flex items-center gap-2 px-4 py-2 bg-gradient-to-r from-[#48A9A6] to-[#327674] text-white text-sm font-medium rounded-lg hover:from-[#3D908D] hover:to-[#285D5B] transition-colors shadow-sm break-keep",children:[e.jsx("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"새로운 제품 만들기"]})]})});const Z=t=>re(t)?new Intl.DateTimeFormat("ko-KR",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(t):"날짜 정보 없음",ke=(t,a)=>{const n=S(t);return P?n==="detail-editor"?"편집 계속":"편집으로 열기":n==="link-import"?"초안 이어서":n==="detail-editor"?"편집 계속":a?"계속하기":"불러오기"};return e.jsxs("div",{className:"max-w-6xl mx-auto px-3 sm:px-4",children:[e.jsx("div",{className:"mb-6",children:e.jsxs("div",{className:"inline-flex items-center gap-1 p-1 rounded-xl bg-[#F1EAE5]/80 border border-slate-300",children:[e.jsxs("button",{onClick:()=>X("mine"),className:`px-3 sm:px-4 py-2 rounded-lg text-sm font-medium transition-all ${V==="mine"?"bg-white border border-slate-300 shadow-sm text-slate-900":"text-slate-600 hover:text-slate-900"}`,children:["내 작업",e.jsx("span",{className:`ml-2 px-2 py-0.5 rounded-full text-xs ${V==="mine"?"bg-[#DEF0EF] text-[#285D5B]":"bg-slate-200 text-slate-600"}`,children:pe.mine})]}),e.jsxs("button",{onClick:()=>X("shared"),className:`px-3 sm:px-4 py-2 rounded-lg text-sm font-medium transition-all ${V==="shared"?"bg-white border border-slate-300 shadow-sm text-slate-900":"text-slate-600 hover:text-slate-900"}`,children:["공유받은 작업",e.jsx("span",{className:`ml-2 px-2 py-0.5 rounded-full text-xs ${V==="shared"?"bg-[#DEF0EF] text-[#285D5B]":"bg-slate-200 text-slate-600"}`,children:pe.shared})]})]})}),V==="mine"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4 flex flex-col gap-3 sm:mb-5 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl sm:text-2xl font-bold text-slate-900 break-keep",children:"내 작업 내역"}),P&&e.jsx("p",{className:"mt-1 text-sm text-slate-500",children:"편집할 작업을 선택하세요."})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 sm:gap-3",children:[D&&e.jsxs("button",{onClick:D,className:"flex items-center justify-center gap-2 px-3 sm:px-4 py-2 text-sm font-medium text-slate-700 hover:text-[#3D908D] transition-colors break-keep whitespace-nowrap",children:[e.jsx("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 19l-7-7m0 0l7-7m-7 7h18"})}),e.jsx("span",{className:"break-keep",children:"돌아가기"})]}),E&&e.jsxs("button",{onClick:E,className:"flex items-center justify-center gap-2 px-3 sm:px-4 py-2 bg-gradient-to-r from-[#48A9A6] to-[#327674] text-white text-sm font-medium rounded-lg hover:from-[#3D908D] hover:to-[#285D5B] transition-colors shadow-sm break-keep whitespace-nowrap",children:[e.jsx("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),e.jsx("span",{className:"break-keep",children:"새 작업 만들기"})]})]})]}),e.jsx(Ke,{query:O,onQuery:R,type:j,onType:A,typeOptions:[{value:"all",label:"전체 작업",count:L.all},{value:"general",label:"일반",count:L.general},{value:"clothing",label:"의류",count:L.clothing},{value:"fresh-produce",label:"과일/채소",count:L.freshProduce},{value:"cardnews",label:"카드뉴스",count:L.cardnews},{value:"thumbnail",label:"썸네일",count:L.thumbnail},{value:"detail-editor",label:P?"편집 가능":"상세편집",count:L.detailEditor},{value:"link-import",label:"링크 초안",count:L.linkImport},{value:"video-translation",label:"영상",count:L.videoTranslation}],status:h,onStatus:k,favoritesOnly:y,onFavorites:W,sort:K,onSort:ie,view:H,onView:ne,count:j==="video-translation"?te.length:Q.length,total:j==="video-translation"?L.videoTranslation:s.length,onReset:ge}),xe&&e.jsx("p",{role:"alert",className:"mb-4 rounded-xl bg-red-50 p-3 text-sm text-red-700",children:xe}),h==="trash"&&j!=="video-translation"&&e.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900","data-trash-limit-hint":"1",children:[e.jsx("p",{className:"min-w-0 flex-1 break-keep",children:"월 작업 한도는 이미지 파일이 차지하는 저장 공간 기준이라, 휴지통에 있는 작업도 파일이 남아 있는 동안은 이번 달 작업 수에 포함돼요. 「영구 삭제」로 파일까지 지우면 그만큼 다시 만들 수 있고, 30일이 지나면 자동으로 영구 삭제됩니다."}),u&&Q.length>0&&e.jsxs("button",{type:"button",onClick:async()=>{const t=Q.map(a=>a.id);await J({title:`휴지통을 비울까요? (${t.length}개)`,message:"목록에 보이는 작업이 모두 영구 삭제되며 되돌릴 수 없습니다.",confirmLabel:"모두 영구 삭제",danger:!0})&&t.forEach(a=>u(a))},className:"flex-shrink-0 rounded-lg bg-red-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-red-700","data-trash-empty":"1",children:["휴지통 비우기 (",Q.length,"개)"]})]}),j==="video-translation"?te.length===0?e.jsxs("div",{className:"text-center py-12 bg-[#FCFAF8] rounded-2xl shadow-sm border border-slate-300 px-4",children:[e.jsx("h3",{className:"mt-1 text-base sm:text-lg font-medium text-slate-900 break-keep",children:_?"검색 ê²°ê
2³¼ê°€ 없습니다":"저장된 영상 작업이 없습니다"}),e.jsx("p",{className:"mt-2 text-sm text-slate-500 break-keep leading-relaxed",children:_?"다른 검색어를 입력하거나 검색어를 지워보세요.":'"1688 영상 번역" 탭이나 ê²°ê³¼ 화면의 "쇼츠 만들기"로 영상을 만들면 여기에 기록됩니다.'})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:te.map(t=>{const a=t.status==="completed"&&!!t.storagePath,n=t.status==="completed"?"bg-[#DEF0EF] text-[#285D5B]":t.status==="failed"?"bg-red-100 text-red-700":"bg-amber-100 text-amber-700";return e.jsxs("div",{className:"bg-[#FCFAF8] rounded-lg shadow-sm border border-slate-200 overflow-hidden",children:[e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-base font-semibold text-slate-900 break-keep",children:t.fileName||(t.kind==="shorts"?"상세페이지 쇼츠":"1688 영상 번역")}),t.selectedVideoUrl&&e.jsx("div",{className:"text-xs text-slate-500 mt-1 truncate",title:t.selectedVideoUrl,children:t.selectedVideoUrl})]}),e.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[t.kind==="shorts"?e.jsx("span",{className:"px-2 py-1 bg-violet-600 text-white text-xs font-medium rounded-full whitespace-nowrap",children:"쇼츠"}):e.jsx("span",{className:"px-2 py-1 bg-slate-900 text-white text-xs font-medium rounded-full whitespace-nowrap",children:"1688 영상"}),e.jsx("span",{className:`px-2 py-1 text-xs font-medium rounded-full whitespace-nowrap ${n}`,children:t.status==="completed"?"완료":t.status==="failed"?"실패":"진행 중"})]})]}),e.jsxs("div",{className:"text-xs text-slate-600 space-y-1",children:[t.kind==="shorts"?e.jsxs("div",{children:["상세페이지 이미지로 만든 세로형 쇼츠 영상",typeof t.duration=="number"?` · 약 ${Math.round(t.duration)}초`:""]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:["템플릿: ",t.template==="shortsHeadline"?"쇼츠 헤드라인":"원문 자막형"]}),e.jsxs("div",{children:["더빙: ",t.koreanDubbingEnabled?"한국어 더빙 사용":"더빙 없음"]})]}),e.jsxs("div",{children:["수정: ",Z(t.updatedAt)]})]}),a?e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("button",{onClick:()=>se(t.storagePath,`${t.fileName||"1688-video"}.mp4`),disabled:q!==null,className:"px-3 py-2 bg-[#48A9A6] text-white text-sm font-medium rounded-lg hover:bg-[#3D908D] transition-colors disabled:cursor-not-allowed disabled:opacity-60",children:q===t.storagePath?"저장 중...":"MP4 다운로드"}),t.srtStoragePath&&e.jsx("button",{onClick:()=>se(t.srtStoragePath,`${t.fileName||"1688-video"}.srt`),disabled:q!==null,className:"px-3 py-2 bg-slate-100 text-slate-700 text-sm font-medium rounded-lg hover:bg-slate-200 transition-colors disabled:cursor-not-allowed disabled:opacity-60",children:q===t.srtStoragePath?"저장 중...":"SRT"}),t.vttStoragePath&&e.jsx("button",{onClick:()=>se(t.vttStoragePath,`${t.fileName||"1688-video"}.vtt`),disabled:q!==null,className:"px-3 py-2 bg-slate-100 text-slate-700 text-sm font-medium rounded-lg hover:bg-slate-200 transition-colors disabled:cursor-not-allowed disabled:opacity-60",children:q===t.vttStoragePath?"저장 중...":"VTT"}),o&&e.jsx("button",{onClick:async()=>{await J({title:"이 영상 작업을 삭제할까요?",message:"저장된 MP4와 자막 파일도 함께 삭제되며 되돌릴 수 없습니다.",confirmLabel:"삭제",danger:!0})&&o(t.id)},className:"ml-auto px-3 py-2 bg-slate-100 text-slate-700 text-sm font-medium rounded-lg hover:bg-slate-200 transition-colors",children:"삭제"})]}):e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.status==="failed"?e.jsx("p",{className:"flex-1 min-w-0 text-xs text-red-600 break-keep leading-relaxed",children:'영상 생성에 실패했습니다. 작업 화면의 "1688 영상 번역" 탭에서 같은 링크로 다시 시도해주세요.'}):e.jsx("p",{className:"flex-1 min-w-0 text-xs text-amber-700 break-keep leading-relaxed",children:"영상 생성이 진행 중입니다. 완료되면 이 카드에서 MP4를 내려받을 수 있습니다."}),o&&e.jsx("button",{onClick:async()=>{await J({title:"이 영상 작업 기록을 삭제할까요?",message:"되돌릴 수 없습니다.",confirmLabel:"삭제",danger:!0})&&o(t.id)},className:"px-3 py-2 bg-slate-100 text-slate-700 text-sm font-medium rounded-lg hover:bg-slate-200 transition-colors flex-shrink-0",children:"삭제"})]})]}),(t.framePreviewStoragePath||t.thumbnailUrl)&&e.jsx("div",{className:"p-2 bg-slate-50",children:e.jsx("div",{className:"aspect-square bg-slate-200 rounded overflow-hidden",children:e.jsx(le,{storagePath:t.framePreviewStoragePath,dataUrl:t.framePreviewStoragePath?void 0:t.thumbnailUrl,alt:t.fileName||"1688 영상 미리보기"})})})]},t.id)})}):Q.length===0?e.jsxs("div",{className:"text-center py-12 bg-[#FCFAF8] rounded-2xl shadow-sm border border-slate-300 px-4",children:[e.jsx("svg",{className:"mx-auto h-12 w-12 text-slate-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),e.jsx("h3",{className:"mt-4 text-base sm:text-lg font-medium text-slate-900 break-keep",children:y?"조건에 맞는 즐겨찾기가 없습니다":"조건에 맞는 작업이 없습니다"}),e.jsx("p",{className:"mt-2 text-sm text-slate-500 break-keep leading-relaxed",children:_?"다른 검색어를 입력하거나 검색어를 지워보세요.":y?"자주 쓰는 작업의 별을 눌러 모아 두세요. 다른 필터가 선택되어 있다면 초기화해 보세요.":"상태나 작업 유형을 바꾸어 보세요. 저장된 작업은 그대로 유지됩니다."}),e.jsx("button",{type:"button",onClick:ge,className:"mt-4 rounded-xl bg-[#285D5B] px-5 py-3 text-sm font-medium text-white hover:bg-[#1D4745]",children:"전체 작업 보기"})]}):e.jsx("div",{className:H==="grid"?"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5":"grid grid-cols-1 gap-4",children:Q.map(t=>{var C,G;const a=S(t),n=je(t),v=t.status==="in-progress",{completed:U,total:$,percent:T}=ze(t),z=fe(t);return e.jsxs("div",{role:"article","aria-label":t.name,className:`flex min-w-0 flex-col bg-white rounded-2xl shadow-sm border hover:shadow-md transition-shadow overflow-hidden ${H==="list"?"sm:flex-row":""} ${v?"border-[#A7D6D4]":"border-slate-200"}`,children:[e.jsxs("div",{className:"order-2 flex min-w-0 flex-1 flex-col p-4 sm:p-5",children:[e.jsxs("div",{className:"flex items-start justify-between mb-2 gap-2",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold text-slate-900 break-words flex-1 min-w-0",children:t.name}),f&&(r==null?void 0:r.uid)===t.userId&&e.jsx("button",{type:"button","aria-label":`${t.name}
2 즐겨찾기`,"aria-pressed":t.isFavorite===!0,disabled:ce.includes(t.id),onClick:()=>void Ee(t),className:`-mt-1 flex h-10 w-10 shrink-0 items-center justify-center rounded-xl transition-colors disabled:opacity-40 ${t.isFavorite?"bg-amber-50 text-amber-600":"text-slate-400 hover:bg-slate-50 hover:text-amber-600"}`,children:e.jsx("svg",{"aria-hidden":"true",className:"h-5 w-5",viewBox:"0 0 24 24",fill:t.isFavorite?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.7",children:e.jsx("path",{strokeLinejoin:"round",d:"m12 3 2.8 5.7 6.3.9-4.55 4.43 1.07 6.27L12 17.34 6.38 20.3l1.07-6.27L2.9 9.6l6.3-.9L12 3Z"})})})]}),e.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-1.5",children:[a==="generated"&&e.jsx("span",{className:"rounded-md bg-slate-100 px-2 py-1 text-xs text-slate-600",children:{general:"일반 상세",clothing:"의류","fresh-produce":"과일·채소",cardnews:"카드뉴스",thumbnail:"썸네일"}[((C=t.productInfo)==null?void 0:C.pageType)||"general"]||"상세페이지"}),t.status==="failed"&&e.jsx("span",{className:"rounded-md bg-red-50 px-2 py-1 text-xs text-red-700",children:"실패 · 확인 필요"}),!v&&t.status!=="failed"&&a!=="link-import"&&e.jsx("span",{className:"rounded-md bg-[#F0F8F7] px-2 py-1 text-xs text-[#285D5B]",children:"완료"}),e.jsxs("div",{className:"flex flex-wrap gap-1 justify-end",children:[a==="detail-editor"&&e.jsx("span",{className:"px-2 py-1 bg-slate-900 text-white text-xs font-medium rounded-full whitespace-nowrap flex-shrink-0",children:"상세 편집"}),a==="link-import"&&e.jsx("span",{className:"px-2 py-1 bg-blue-100 text-blue-700 text-xs font-medium rounded-full whitespace-nowrap flex-shrink-0",children:"링크 초안"}),v&&e.jsx("span",{className:"px-2 py-1 bg-[#DEF0EF] text-[#285D5B] text-xs font-medium rounded-full whitespace-nowrap flex-shrink-0",children:"진행 중"}),t.sharedWith&&t.sharedWith.length>0&&e.jsxs("span",{className:"px-2 py-1 bg-[#F1EAE5] text-slate-700 text-xs font-medium rounded-full whitespace-nowrap flex-shrink-0",children:["공유중 (",t.sharedWith.length,")"]})]})]}),e.jsx("p",{className:"text-sm text-slate-600 mb-4 line-clamp-2 break-keep leading-relaxed",children:a==="detail-editor"?(n==null?void 0:n.pageTitle)||"기존 상세페이지를 블록 단위로 편집한 작업입니다.":a==="link-import"?((G=t.linkImportSummary)==null?void 0:G.title)||t.productInfo.name||"링크에서 가져온 초안입니다.":t.productInfo.description||"설명 없음"}),a==="generated"&&H==="grid"&&e.jsx(De,{productInfo:t.productInfo}),a==="generated"&&e.jsx(Fe,{productInfo:t.productInfo}),v&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-600 mb-1 break-keep",children:[e.jsx("span",{children:"생성 진행률"}),e.jsxs("span",{className:"whitespace-nowrap ml-2",children:[U,"/",$]})]}),e.jsx("div",{className:"w-full bg-slate-200 rounded-full h-2",children:e.jsx("div",{className:"bg-[#48A9A6] h-2 rounded-full transition-all duration-300",style:{width:`${T}%`}})})]}),e.jsxs("div",{className:"flex flex-col gap-1 text-xs text-slate-500 mb-4 break-keep",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-1",children:[e.jsxs("span",{className:"break-keep",children:["수정: ",Z(t.updatedAt)]}),e.jsx("span",{className:"whitespace-nowrap",children:a==="detail-editor"?`블록 ${(n==null?void 0:n.blockCount)||0}개`:a==="link-import"?"링크 가져오기 초안":v?`${U}개 완료`:`${t.images.length}개 이미지`})]}),a==="detail-editor"&&n&&e.jsxs("div",{className:"text-xs text-slate-500 break-keep",children:["이미지 ",n.imageBlockCount,"개 · 텍스트 ",n.textBlockCount,"개"]}),t.lastEditedBy&&t.lastEditedBy!==(r==null?void 0:r.email)&&e.jsxs("div",{className:"text-xs text-amber-600 break-keep",children:["마지막 편집: ",t.lastEditedBy,t.lastEditedAt&&` (${Z(t.lastEditedAt)})`]}),t.sharedWith&&t.sharedWith.length>0&&e.jsxs("div",{className:"text-xs text-[#3D908D] break-keep",children:["공유 대상: ",t.sharedWith.join(", ")]})]}),e.jsxs("div",{className:"mt-auto flex flex-col gap-2 border-t border-slate-100 pt-3",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("button",{onClick:()=>c(t),className:"flex-1 min-w-[8rem] px-3 sm:px-4 py-2 bg-[#48A9A6] text-white text-sm font-medium rounded-lg hover:bg-[#3D908D] transition-colors break-keep",children:ke(t,v)}),!P&&N&&w&&r&&Le(t,r.uid)&&e.jsx("button",{type:"button",onClick:()=>oe(t),className:"flex-1 min-w-[8rem] rounded-lg border border-[#B5DCDA] bg-[#F0F8F7] px-3 py-2 text-sm font-semibold text-[#285D5B] hover:bg-[#DEF0EF]",children:"새로 만들기"})]}),e.jsxs("details",{className:"group rounded-lg",children:[e.jsx("summary",{"aria-label":`${t.name} 추가 작업`,className:"cursor-pointer rounded-lg px-2 py-2 text-xs font-medium text-slate-500 hover:bg-slate-50",children:"정보 수정 · 공유 · 삭제"}),e.jsxs("div",{className:"flex flex-wrap gap-2 py-2",children:[r&&t.userId===r.uid&&e.jsx(e.Fragment,{children:t.sharedWith&&t.sharedWith.length>0?e.jsxs("button",{onClick:async()=>{try{await Ue(t.id,r.uid),B("공유가 해제되었습니다."),F&&F()}catch(g){console.error("공유 해제 실패:",g),B("공유 해제에 실패했습니다: "+(g instanceof Error?g.message:"알 수 없는 오류"))}},className:"px-3 sm:px-4 py-2 bg-red-100 text-red-700 text-sm font-medium rounded-lg hover:bg-red-200 transition-colors whitespace-nowrap break-keep",title:"공유 해제",children:[e.jsx("svg",{className:"w-4 h-4 inline-block mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"})}),"공유 해제"]}):e.jsxs("button",{onClick:()=>ee(t),className:"px-3 sm:px-4 py-2 bg-[#DEF0EF] text-[#285D5B] text-sm font-medium rounded-lg hover:bg-[#C3E3E2] transition-colors whitespace-nowrap break-keep",title:"프로젝트 공유",children:[e.jsx("svg",{className:"w-4 h-4 inline-block mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.684 13.342C8.886 12.938 9 12.482 9 12c0-.482-.114-.938-.316-1.342m0 2.684a3 3 0 110-2.684m0 2.684l6.632 3.316m-6.632-6l6.632-3.3
216m0 0a3 3 0 105.367-2.684 3 3 0 00-5.367 2.684zm0 9.316a3 3 0 105.368 2.684 3 3 0 00-5.368-2.684z"})}),"공유"]})}),t.deletedAt?e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>m==null?void 0:m(t.id),className:"px-3 sm:px-4 py-2 bg-emerald-100 text-emerald-800 text-sm font-medium rounded-lg hover:bg-emerald-200 transition-colors",title:"휴지통에서 꺼내 원래 목록으로 되돌립니다",children:"복구"}),e.jsx("button",{onClick:async()=>{await J({title:`"${t.name}"을(를) 영구 삭제할까요?`,message:"이미지와 내용이 모두 사라지며 되돌릴 수 없습니다.",confirmLabel:"영구 삭제",danger:!0})&&(u==null||u(t.id))},className:"px-3 sm:px-4 py-2 bg-red-100 text-red-700 text-sm font-medium rounded-lg hover:bg-red-200 transition-colors",children:"영구 삭제"})]}):e.jsx("button",{onClick:()=>{i(t.id)},className:"px-3 sm:px-4 py-2 bg-slate-100 text-slate-700 text-sm font-medium rounded-lg hover:bg-slate-200 transition-colors",title:"휴지통으로 이동 (30일 안에 복구 가능)",children:"삭제"})]}),b&&e.jsx("button",{onClick:()=>b(t),className:"w-full px-3 sm:px-4 py-2 bg-[#F8F4F1] text-slate-700 text-sm font-medium rounded-lg hover:bg-[#F1EAE5] transition-colors border border-slate-300 break-keep",children:"정보 수정"})]})]})]}),z.length>0?e.jsx("div",{className:`order-1 bg-slate-50 ${H==="list"?"w-full shrink-0 sm:relative sm:w-52":""}`,children:z.map(g=>e.jsx("div",{className:`overflow-hidden bg-slate-100 [&_img]:object-top ${H==="list"?"aspect-[16/9] sm:absolute sm:inset-0 sm:aspect-auto":"aspect-[16/10]"}`,children:g.type==="generated"?e.jsx(Ce,{img:g.img,alt:g.alt,projectId:t.id,userId:t.userId}):e.jsx(le,{storagePath:g.storagePath,dataUrl:g.dataUrl,alt:g.alt})},g.id))}):e.jsx("div",{className:`order-1 flex items-center justify-center bg-gradient-to-br from-[#F0F8F7] to-slate-50 text-sm text-slate-400 ${H==="list"?"h-32 w-full shrink-0 sm:h-auto sm:w-52":"aspect-[16/10]"}`,children:e.jsx("span",{children:a==="link-import"?"링크에서 가져온 상품":v?"이미지 준비 중":"미리보기 없음"})})]},t.id)})})]}),V==="shared"&&e.jsxs("div",{children:[e.jsxs("div",{className:"mb-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("svg",{className:"w-6 h-6 text-[#48A9A6]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.684 13.342C8.886 12.938 9 12.482 9 12c0-.482-.114-.938-.316-1.342m0 2.684a3 3 0 110-2.684m0 2.684l6.632 3.316m-6.632-6l6.632-3.316m0 0a3 3 0 105.367-2.684 3 3 0 00-5.367 2.684zm0 9.316a3 3 0 105.368 2.684 3 3 0 00-5.368-2.684z"})}),e.jsx("h2",{className:"text-xl sm:text-2xl font-bold text-slate-900 break-keep",children:"공유받은 프로젝트"}),e.jsxs("span",{className:"px-2 py-1 bg-[#DEF0EF] text-[#285D5B] text-xs font-medium rounded-full",children:[p.length,"개"]})]}),e.jsx("p",{className:"text-sm text-slate-600 break-keep",children:"공유받은 프로젝트를 열어보고 필요하면 내 작업으로 저장하세요."})]}),p.length===0?e.jsxs("div",{className:"text-center py-12 bg-[#FCFAF8] rounded-2xl shadow-sm border border-slate-300 px-4",children:[e.jsx("svg",{className:"mx-auto h-12 w-12 text-slate-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.684 13.342C8.886 12.938 9 12.482 9 12c0-.482-.114-.938-.316-1.342m0 2.684a3 3 0 110-2.684m0 2.684l6.632 3.316m-6.632-6l6.632-3.316m0 0a3 3 0 105.367-2.684 3 3 0 00-5.367 2.684zm0 9.316a3 3 0 105.368 2.684 3 3 0 00-5.368-2.684z"})}),e.jsx("h3",{className:"mt-4 text-base sm:text-lg font-medium text-slate-900 break-keep",children:"공유받은 프로젝트가 없습니다"}),e.jsx("p",{className:"mt-2 text-sm text-slate-500 break-keep leading-relaxed",children:"팀원이 프로젝트를 공유하면 이 탭에 표시됩니다."})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:p.map(t=>{var T,z;const a=S(t),n=je(t),v=t.status==="in-progress",U=t.images.filter(C=>C.status==="completed").length;(T=t.plan)!=null&&T.length||t.images.length;const $=fe(t);return e.jsxs("div",{className:`bg-[#FCFAF8] rounded-lg shadow-sm border hover:shadow-md transition-shadow overflow-hidden ${v?"border-[#A7D6D4] ring-2 ring-[#DEF0EF]":"border-slate-200"}`,children:[e.jsxs("div",{className:"p-3 sm:p-4",children:[e.jsxs("div",{className:"flex items-start justify-between mb-2 gap-2",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold text-slate-900 break-keep flex-1 min-w-0",children:t.name}),e.jsxs("div",{className:"flex flex-wrap gap-1 justify-end",children:[a==="detail-editor"&&e.jsx("span",{className:"px-2 py-1 bg-slate-900 text-white text-xs font-medium rounded-full whitespace-nowrap flex-shrink-0",children:"상세 편집"}),a==="link-import"&&e.jsx("span",{className:"px-2 py-1 bg-blue-100 text-blue-700 text-xs font-medium rounded-full whitespace-nowrap flex-shrink-0",children:"링크 초안"}),e.jsx("span",{className:"ml-2 px-2 py-1 bg-[#DEF0EF] text-[#285D5B] text-xs font-medium rounded-full whitespace-nowrap flex-shrink-0",children:"공유됨"})]})]}),e.jsx("p",{className:"text-sm text-slate-600 mb-4 line-clamp-2 break-keep leading-relaxed",children:a==="detail-editor"?(n==null?void 0:n.pageTitle)||"기존 상세페이지 편집 작업입니다.":a==="link-import"?((z=t.linkImportSummary)==null?void 0:z.title)||t.productInfo.name||"링크에서 가져온 초안입니다.":t.productInfo.description||"설명 없음"}),a==="generated"&&e.jsx(De,{productInfo:t.productInfo}),a==="generated"&&e.jsx(Fe,{productInfo:t.productInfo}),e.jsxs("div",{className:"flex flex-col gap-1 text-xs text-slate-500 mb-4 break-keep",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-1",children:[e.jsxs("span",{className:"break-keep",children:["수정: ",Z(t.updatedAt)]}),e.jsx("span",{className:"whitespace-nowrap",children:a==="detail-editor"?`블록 ${(n==null?void 0:n.blockCount)||0}
2개`:a==="link-import"?"링크 가져오기 초안":v?`${U}개 완료`:`${t.images.length}개 이미지`})]}),a==="detail-editor"&&n&&e.jsxs("div",{className:"text-xs text-slate-500 break-keep",children:["이미지 ",n.imageBlockCount,"개 · 텍스트 ",n.textBlockCount,"개"]}),t.lastEditedBy&&e.jsxs("div",{className:"text-xs text-amber-600 break-keep",children:["마지막 편집: ",t.lastEditedBy,t.lastEditedAt&&` (${Z(t.lastEditedAt)})`]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("button",{onClick:()=>c(t),className:"w-full px-3 sm:px-4 py-2 bg-[#48A9A6] text-white text-sm font-medium rounded-lg hover:bg-[#3D908D] transition-colors break-keep",children:ke(t,v)}),r&&e.jsxs("button",{onClick:async()=>{try{await $e(t,r.uid),B("프로젝트가 내 작업 내역에 저장되었습니다."),F&&F()}catch(C){console.error("프로젝트 저장 실패:",C),B("프로젝트 저장에 실패했습니다: "+(C instanceof Error?C.message:"알 수 없는 오류"))}},className:"w-full px-3 sm:px-4 py-2 bg-[#EFF6F6] text-[#285D5B] text-sm font-medium rounded-lg hover:bg-[#DCEBEA] transition-colors border border-[#BFDAD9] break-keep",children:[e.jsx("svg",{className:"w-4 h-4 inline-block mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4"})}),"내 프로젝트로 저장"]})]})]}),$.length>0&&e.jsx("div",{className:"grid grid-cols-1 gap-1 p-2 bg-slate-50",children:$.map(C=>e.jsx("div",{className:"aspect-square bg-slate-200 rounded overflow-hidden",children:C.type==="generated"?e.jsx(Ce,{img:C.img,alt:C.alt,projectId:t.id,userId:t.userId}):e.jsx(le,{storagePath:C.storagePath,dataUrl:C.dataUrl,alt:C.alt})},C.id))})]},t.id)})})]}),de&&N&&w&&e.jsx(Re,{project:de,onClose:()=>oe(null),onPrepare:N,onApply:w}),ue&&e.jsx(qe,{project:ue,onClose:()=>ee(null),onShare:()=>{ee(null),F&&F()}})]})};export{nt as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.