1 line
18 KiB
JavaScript
1 line
18 KiB
JavaScript
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,44026,e=>{"use strict";let t=(0,e.i(78445).default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);e.s(["Loader2",()=>t],44026)},50147,e=>{"use strict";let t=(0,e.i(78445).default)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);e.s(["User",()=>t],50147)},78445,e=>{"use strict";var t=e.i(59760);let s=(...e)=>e.filter((e,t,s)=>!!e&&""!==e.trim()&&s.indexOf(e)===t).join(" ").trim(),i=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,s)=>s?s.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)};var a={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let r=(0,t.forwardRef)(({color:e="currentColor",size:i=24,strokeWidth:r=2,absoluteStrokeWidth:l,className:n="",children:o,iconNode:d,...c},u)=>(0,t.createElement)("svg",{ref:u,...a,width:i,height:i,stroke:e,strokeWidth:l?24*Number(r)/Number(i):r,className:s("lucide",n),...!o&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(c)&&{"aria-hidden":"true"},...c},[...d.map(([e,s])=>(0,t.createElement)(e,s)),...Array.isArray(o)?o:[o]])),l=(e,a)=>{let l=(0,t.forwardRef)(({className:l,...n},o)=>(0,t.createElement)(r,{ref:o,iconNode:a,className:s(`lucide-${i(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,l),...n}));return l.displayName=i(e),l};e.s(["default",()=>l],78445)},12856,(e,t,s)=>{t.exports=e.r(96479)},62746,e=>{"use strict";let t=(0,e.i(78445).default)("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);e.s(["BookOpen",()=>t],62746)},33907,e=>{"use strict";var t,s=((t={}).CHARACTER="Personnage",t.LOCATION="Lieu",t.OBJECT="Objet",t.NOTE="Note",t);e.s(["EntityType",()=>s])},22508,e=>{"use strict";let t=(0,e.i(78445).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["Plus",()=>t],22508)},4915,e=>{"use strict";let t=(0,e.i(78445).default)("pen-line",[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);e.s(["Edit3",()=>t],4915)},54956,e=>{"use strict";let t=(0,e.i(78445).default)("target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);e.s(["Target",()=>t],54956)},49491,e=>{"use strict";let t=(0,e.i(78445).default)("flame",[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",key:"1slcih"}]]);e.s(["Flame",()=>t],49491)},43331,e=>{"use strict";let t=(0,e.i(78445).default)("book",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);e.s(["Book",()=>t],43331)},8011,71143,e=>{"use strict";var t=e.i(59760),s=e.i(4301),i=e.i(33907);let a="Nouveau Roman",r="Auteur Inconnu",l={id:"chap-1",title:"Chapitre 1",content:"<p>Il était une fois...</p>",summary:"Début de l'histoire."},n={[i.EntityType.CHARACTER]:"👤",[i.EntityType.LOCATION]:"🏰",[i.EntityType.OBJECT]:"🗝️",[i.EntityType.NOTE]:"📝"},o={[i.EntityType.CHARACTER]:"bg-blue-100 text-blue-800 border-blue-200",[i.EntityType.LOCATION]:"bg-green-100 text-green-800 border-green-200",[i.EntityType.OBJECT]:"bg-amber-100 text-amber-800 border-amber-200",[i.EntityType.NOTE]:"bg-gray-100 text-gray-800 border-gray-200"};e.s(["ARCHETYPES",0,["Le Héros","L'Ombre / Le Méchant","Le Mentor","Le Gardien du Seuil","Le Shapeshifter (Changeforme)","Le Trickster (Farceur)","L'Allié","L'Élu","Le Rebelle","Le Séducteur","Le Sage","Le Guerrier","L'Innocent"],"DEFAULT_AUTHOR",0,r,"DEFAULT_BOOK_TITLE",0,a,"ENTITY_COLORS",0,o,"ENTITY_ICONS",0,n,"EYE_COLORS",0,["Marron","Bleu","Vert","Noisette","Gris","Noir","Vairons","Ambre"],"GENRES",0,["Fantasy","Science-Fiction","Thriller / Polar","Romance","Historique","Horreur","Aventure","Contemporain","Jeunesse / Young Adult","Dystopie"],"HAIR_COLORS",0,["Brun","Noir","Blond","Roux","Auburn","Gris","Blanc","Châtain","Chauve","Teinture (Bleu/Rose/Etc)"],"INITIAL_CHAPTER",0,l,"POV_OPTIONS",0,["1ère personne (Je)","3ème personne (Limitée au protagoniste)","3ème personne (Omnisciente)","Multi-points de vue (Alterné)"],"TENSE_OPTIONS",0,["Passé (Passé simple / Imparfait)","Présent de narration"],"TONES",0,["Sombre & Sérieux","Léger & Humoristique","Épique & Grandiose","Mélancolique","Mystérieux","Optimiste","Cynique","Romantique"]],71143),e.s(["useProjects",0,e=>{let[i,n]=(0,t.useState)([]),[o,d]=(0,t.useState)(null),[c,u]=(0,t.useState)(!1);(0,t.useEffect)(()=>{e?(async()=>{u(!0);try{let e=(await s.default.projects.list()||[]).map(e=>({id:e.id,title:e.title,author:e.author,lastModified:new Date(e.updatedAt).getTime(),chapters:[],entities:[],ideas:[],settings:e.settings||void 0}));n(e)}catch(e){console.error("Failed to load projects",e)}finally{u(!1)}})():n([])},[e]),(0,t.useEffect)(()=>{o&&(async()=>{try{let e=await s.default.projects.get(o),t={id:e.id,title:e.title,author:e.author,lastModified:new Date(e.updatedAt).getTime(),settings:e.settings||void 0,styleGuide:e.styleGuide||void 0,chapters:(e.chapters||[]).map(e=>({id:e.id,title:e.title,content:e.content,summary:e.summary})),entities:(e.entities||[]).map(e=>({id:e.id,type:e.type,name:e.name,description:e.description,details:e.details,storyContext:e.storyContext,attributes:e.attributes,customValues:e.customValues})),ideas:(e.ideas||[]).map(e=>({id:e.id,title:e.title,description:e.description,status:e.status,category:e.category,createdAt:new Date(e.createdAt).getTime()})),workflow:{nodes:(e.plotNodes||[]).map(e=>({id:e.id,x:e.x,y:e.y,title:e.title,description:e.description,color:e.color,type:e.type})),connections:(e.plotConnections||[]).map(e=>({id:e.id,source:e.source,target:e.target}))}};n(e=>e.map(e=>e.id===o?t:e))}catch(e){console.error("Failed to load project details",e)}})()},[o]);let p=async(e,t)=>{try{let i=await s.default.chapters.create({projectId:e,title:t.title||"New Chapter",content:t.content||"",summary:t.summary||void 0});return n(t=>t.map(t=>t.id!==e?t:{...t,chapters:[...t.chapters,{id:i.id,title:i.title,content:i.content,summary:i.summary}]})),i.id}catch(e){return console.error("Failed to add chapter",e),null}};return{projects:i,currentProjectId:o,setCurrentProjectId:d,createProject:async()=>{if(e)try{let t=await s.default.projects.create({title:a,author:e.name||r,settings:{genre:"Fantasy",targetAudience:"Adult",tone:"Epic"}}),i={id:t.id,title:t.title,author:t.author,lastModified:Date.now(),chapters:[],entities:[],ideas:[],settings:t.settings};return n(e=>[...e,i]),await p(t.id,l),t.id}catch(e){console.error("Failed to create project",e)}},updateProject:async(e,t)=>{n(s=>s.map(s=>s.id===e?{...s,...t}:s));try{let i={};void 0!==t.title&&(i.title=t.title),void 0!==t.author&&(i.author=t.author),void 0!==t.settings&&(i.settings=t.settings),void 0!==t.styleGuide&&(i.styleGuide=t.styleGuide),await s.default.projects.update(e,i)}catch(e){console.error("Failed to update project",e)}},addChapter:p,updateChapter:async(e,t,i)=>{n(s=>s.map(s=>s.id!==e?s:{...s,chapters:s.chapters.map(e=>e.id===t?{...e,...i}:e)}));try{await s.default.chapters.update(t,i)}catch(e){console.error("Failed to update chapter",e)}},createEntity:async(e,t,i)=>{try{let a=await s.default.entities.create({projectId:e,type:t,name:i?.name||`Nouveau ${t}`,description:i?.description||"",details:i?.details||"",attributes:i?.attributes||void 0,customValues:i?.customValues||void 0});return n(t=>t.map(t=>t.id!==e?t:{...t,entities:[...t.entities,{id:a.id,type:a.type,name:a.name,description:a.description,details:a.details,attributes:a.attributes,customValues:a.customValues||{}}]})),a.id}catch(e){throw console.error("Failed to create entity",e),e}},updateEntity:async(e,t,i)=>{n(s=>s.map(s=>s.id!==e?s:{...s,entities:s.entities.map(e=>e.id===t?{...e,...i}:e)}));try{await s.default.entities.update(t,i)}catch(e){console.error("Failed to update entity",e)}},deleteEntity:async(e,t)=>{n(s=>s.map(s=>s.id!==e?s:{...s,entities:s.entities.filter(e=>e.id!==t)}));try{await s.default.entities.delete(t)}catch(e){console.error("Failed to delete entity",e)}},deleteProject:async e=>{try{await s.default.projects.delete(e),n(t=>t.filter(t=>t.id!==e)),o===e&&d(null)}catch(e){console.error("Failed to delete project",e)}}}}],8011)},30103,86180,e=>{"use strict";var t=e.i(78445);let s=(0,t.default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",()=>s],30103);let i=(0,t.default)("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]);e.s(["LogOut",()=>i],86180)},23439,e=>{"use strict";var t=e.i(30064),s=e.i(12856),i=e.i(18404),a=e.i(8011),r=e.i(22508),l=e.i(43331);let n=(0,e.i(78445).default)("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);var o=e.i(30103),d=e.i(86180),c=e.i(50147),u=e.i(54956),p=e.i(49491),h=e.i(4915);let m=({user:e,projects:s,onSelect:i,onCreate:a,onLogout:m,onPricing:x,onProfile:g})=>(0,t.jsx)("div",{className:"min-h-screen bg-[#eef2ff] p-8 font-sans",children:(0,t.jsxs)("div",{className:"max-w-6xl mx-auto space-y-8",children:[(0,t.jsxs)("div",{className:"flex flex-col md:flex-row justify-between items-center bg-white p-8 rounded-[2rem] shadow-sm border border-indigo-100 gap-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-6",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("img",{src:e.avatar,className:"w-20 h-20 rounded-full border-4 border-slate-50 shadow-lg object-cover",alt:"Avatar"}),(0,t.jsx)("div",{className:"absolute -bottom-1 -right-1 bg-green-500 w-5 h-5 rounded-full border-4 border-white"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("h2",{className:"text-3xl font-black text-slate-900",children:["Bonjour, ",e.name," 👋"]}),(0,t.jsxs)("div",{className:"flex items-center gap-3 mt-1",children:[(0,t.jsx)("span",{className:"px-3 py-1 rounded-full bg-indigo-100 text-indigo-700 text-[10px] uppercase font-black tracking-widest",children:e.subscription.plan}),(0,t.jsx)("span",{className:"text-slate-400 text-xs font-medium",children:"Membre depuis le 24 janv."})]})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsxs)("button",{onClick:g,className:"bg-slate-50 text-slate-700 px-5 py-2.5 rounded-xl text-sm font-bold hover:bg-slate-100 transition-all flex items-center gap-2 border border-slate-200",children:[(0,t.jsx)(c.User,{size:18})," Mon Profil"]}),(0,t.jsx)("button",{onClick:m,className:"p-3 text-slate-400 hover:text-red-500 rounded-full hover:bg-red-50 transition-colors",children:(0,t.jsx)(d.LogOut,{size:20})})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[(0,t.jsxs)("div",{className:"bg-white p-6 rounded-3xl shadow-sm border border-indigo-50 flex items-center gap-4",children:[(0,t.jsx)("div",{className:"bg-orange-100 p-3 rounded-2xl text-orange-600",children:(0,t.jsx)(p.Flame,{size:24})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Série actuelle"}),(0,t.jsxs)("p",{className:"text-2xl font-black text-slate-900",children:[e.stats.writingStreak," Jours"]})]})]}),(0,t.jsxs)("div",{className:"bg-white p-6 rounded-3xl shadow-sm border border-indigo-50 flex items-center gap-4",children:[(0,t.jsx)("div",{className:"bg-blue-100 p-3 rounded-2xl text-blue-600",children:(0,t.jsx)(h.Edit3,{size:24})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Mots écrits"}),(0,t.jsx)("p",{className:"text-2xl font-black text-slate-900",children:e.stats.totalWordsWritten.toLocaleString()})]})]}),(0,t.jsxs)("div",{className:"bg-white p-6 rounded-3xl shadow-sm border border-indigo-50 flex items-center gap-4",children:[(0,t.jsx)("div",{className:"bg-indigo-100 p-3 rounded-2xl text-indigo-600",children:(0,t.jsx)(u.Target,{size:24})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Objectif du jour"}),(0,t.jsxs)("p",{className:"text-2xl font-black text-slate-900",children:[e.preferences.dailyWordGoal," Mots"]})]})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[(0,t.jsxs)("div",{className:"lg:col-span-2 space-y-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,t.jsx)("h3",{className:"text-2xl font-black text-slate-900",children:"Mes Romans"}),(0,t.jsxs)("button",{onClick:a,className:"flex items-center gap-2 bg-blue-600 text-white px-6 py-3 rounded-2xl font-bold hover:bg-blue-700 transition-all shadow-xl shadow-blue-200",children:[(0,t.jsx)(r.Plus,{size:20})," Écrire un nouveau livre"]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[s.map(e=>(0,t.jsxs)("div",{onClick:()=>i(e.id),className:"bg-white p-8 rounded-[2.5rem] border border-indigo-50 shadow-sm hover:shadow-2xl hover:scale-[1.02] transition-all cursor-pointer group flex flex-col justify-between h-64",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"bg-blue-50 w-12 h-12 rounded-2xl flex items-center justify-center text-blue-600 mb-6 group-hover:bg-blue-600 group-hover:text-white transition-colors",children:(0,t.jsx)(l.Book,{size:24})}),(0,t.jsx)("h4",{className:"font-black text-slate-900 text-xl truncate mb-1",children:e.title}),(0,t.jsxs)("p",{className:"text-slate-400 text-sm",children:["Dernière modification : ",new Date(e.lastModified).toLocaleDateString()]})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center text-[10px] text-slate-400 font-black uppercase tracking-widest border-t border-slate-50 pt-4",children:[(0,t.jsxs)("span",{children:[e.chapters.length," Chapitres"]}),(0,t.jsx)(o.ChevronRight,{size:20,className:"group-hover:text-blue-600 transition-transform group-hover:translate-x-1 duration-300"})]})]},e.id)),0===s.length&&(0,t.jsxs)("div",{className:"col-span-2 py-24 bg-white rounded-[3rem] border-2 border-dashed border-indigo-100 flex flex-col items-center justify-center text-indigo-300",children:[(0,t.jsx)(l.Book,{size:64,className:"mb-6 opacity-20"}),(0,t.jsx)("p",{className:"font-bold text-lg",children:"Prêt à commencer votre premier roman ?"}),(0,t.jsx)("button",{onClick:a,className:"mt-4 text-blue-600 font-bold hover:underline",children:"Créer un projet maintenant"})]})]})]}),(0,t.jsx)("div",{className:"space-y-6",children:(0,t.jsxs)("div",{className:"bg-slate-900 text-white p-8 rounded-[2.5rem] shadow-xl relative overflow-hidden",children:[(0,t.jsx)("div",{className:"absolute top-0 right-0 w-32 h-32 bg-indigo-500/20 blur-[60px] -z-1"}),(0,t.jsxs)("h3",{className:"font-black text-xl mb-6 flex items-center gap-2",children:[(0,t.jsx)(n,{size:20,className:"text-yellow-400"})," Utilisation"]}),(0,t.jsxs)("div",{className:"space-y-8",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex justify-between text-[10px] font-black text-slate-400 uppercase tracking-widest mb-2",children:[(0,t.jsx)("span",{children:"Actions IA"}),(0,t.jsxs)("span",{children:[e.usage.aiActionsCurrent," / ",999999===e.usage.aiActionsLimit?"∞":e.usage.aiActionsLimit]})]}),(0,t.jsx)("div",{className:"h-3 w-full bg-slate-800 rounded-full overflow-hidden",children:(0,t.jsx)("div",{className:"h-full bg-blue-500 transition-all duration-1000 shadow-[0_0_10px_rgba(59,130,246,0.5)]",style:{width:`${Math.min(100,e.usage.aiActionsCurrent/e.usage.aiActionsLimit*100)}%`}})})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex justify-between text-[10px] font-black text-slate-400 uppercase tracking-widest mb-2",children:[(0,t.jsx)("span",{children:"Emplacements Roman"}),(0,t.jsxs)("span",{children:[s.length," / ",e.usage.projectsLimit]})]}),(0,t.jsx)("div",{className:"h-3 w-full bg-slate-800 rounded-full overflow-hidden",children:(0,t.jsx)("div",{className:"h-full bg-indigo-500 transition-all duration-1000 shadow-[0_0_10px_rgba(99,102,241,0.5)]",style:{width:`${Math.min(100,s.length/e.usage.projectsLimit*100)}%`}})})]})]}),(0,t.jsx)("button",{onClick:x,className:"w-full mt-10 bg-white/10 hover:bg-white/20 py-4 rounded-2xl text-sm font-bold transition-all",children:"Upgrade Plan"})]})})]})]})});var x=e.i(44026),g=e.i(62746),b=e.i(59760);function f(){let e=(0,s.useRouter)(),{user:r,logout:l,loading:n}=(0,i.useAuthContext)(),{projects:o,setCurrentProjectId:d,createProject:c}=(0,a.useProjects)(r);return((0,b.useEffect)(()=>{n||r||e.replace("/login")},[r,n,e]),n||!r)?(0,t.jsxs)("div",{className:"h-screen w-full flex flex-col items-center justify-center bg-slate-900 text-white",children:[(0,t.jsx)(x.Loader2,{className:"animate-spin text-blue-500 mb-4",size:48}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(g.BookOpen,{className:"text-blue-500",size:20}),(0,t.jsx)("span",{className:"text-lg font-bold",children:"PlumeIA"})]})]}):(0,t.jsx)(m,{user:r,projects:o,onSelect:t=>{d(t),e.push(`/project/${t}`)},onCreate:async()=>{let t=await c();t&&(d(t),e.push(`/project/${t}`))},onLogout:()=>{l(),e.push("/")},onPricing:()=>e.push("/pricing"),onProfile:()=>e.push("/profile")})}e.s(["default",()=>f],23439)}]); |