1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BfFoir-D.js","assets/vendor-framer-4qzhpEbi.js","assets/vendor-react-DoD6Cqi4.js","assets/vendor-store-DzZixoKE.js","assets/vendor-ui-DKVeHV7E.js","assets/vendor-markdown-DLx0uNNN.js","assets/index-DF8lWLnB.css"])))=>i.map(i=>d[i]); 2import{_ as J}from"./vendor-pdf-tfVvIPiR.js";import{j as e,m as k,A as K}from"./vendor-framer-4qzhpEbi.js";import{u as W,r as n}from"./vendor-react-DoD6Cqi4.js";import{g as X}from"./index-BfFoir-D.js";import{u as Y}from"./useAuth-qrUVCgph.js";import{R as Z,aK as Q,aS as ee,L as te,aY as ae,k as re,S as M,b9 as se,X as ie}from"./vendor-ui-DKVeHV7E.js";import"./vendor-three-97KX4nAg.js";import"./vendor-store-DzZixoKE.js";import"./vendor-markdown-DLx0uNNN.js";const $=[{id:"cog_dir_1",type:"directive",title:"Sanctuaire Local & Zéro-Payload",detail:"Toutes les données sensibles (santé, documents confidentiels, archives) sont chiffrées localement et ne transitent jamais en brut.",category:"Architecture",confidence:1,date:"Aujourdâhui",source:"Règle Souveraine"},{id:"cog_patch_2",type:"patch",title:"Rôle : Lead Architect & Creative Director",detail:"Mandat de refonte totale avec pleins pouvoirs dâinitiative, zéro attentisme et standard Cyber-Luxe absolu.",category:"Rôle & Posture",confidence:.99,date:"Enregistré",source:"Correction Utilisateur"},{id:"cog_pat_3",type:"pattern",title:"Esthétique Pure Cyber-Luxe",detail:"Surfaces en verre dépoli translucide, lueurs néon cyan/violettes discrètes, animations douces Framer Motion 60 FPS.",category:"Design UI/UX",confidence:.98,date:"Actif",source:"Habitude Préférée"},{id:"cog_pat_4",type:"pattern",title:"Synthèses directes & exécutables",detail:"Privilégie les réponses concises avec métriques techniques, code propre et passage direct à lâaction.",category:"Communication",confidence:.96,date:"Actif",source:"Habitude Préférée"},{id:"cog_fact_5",type:"fact",title:"Simulations 3D Multi-Domaines",detail:"Moteur Three.js 60 FPS avec Trou noir de Kerr relativiste, Collisionneur LHC quantique et Système Solaire.",category:"Création",confidence:.95,date:"Actif",source:"Projet Mémorisé"}];function he(){const{user:b}=Y(),o=b?.uid,u=W(),[w,j]=n.useState($),[q,D]=n.useState(!0),[N,E]=n.useState(!1),[S,H]=n.useState(""),[h,F]=n.useState("all"),[I,m]=n.useState(null),[U,f]=n.useState(!1),[g,P]=n.useState(""),[v,T]=n.useState(""),[y,z]=n.useState("directive"),C=n.useCallback(async()=>{D(!0);const t=[...$],i=new Set(t.map(l=>l.id));try{const l=localStorage.getItem("aria_jwt")||"",A=l?{Authorization:"Bearer "+l}:{},G=X();if(o)try{const d=await fetch(`${G}/api/memory/learned_full/${encodeURIComponent(o)}`,{headers:A});if(d.ok){const c=await d.json();(c.directives||[]).forEach((a,s)=>{const r=a.id||`api_dir_${s}`;i.has(r)||(i.add(r),t.push({id:r,type:"directive",title:a.title||a.directive||"Directive Enregistrée",detail:a.content||a.text||String(a),category:"Directive",confidence:1,date:a.created_at||"Actif",source:"Sanctuaire ARIA"}))}),(c.patches||[]).forEach((a,s)=>{const r=a.id||`api_patch_${s}`;i.has(r)||(i.add(r),t.push({id:r,type:"patch",title:a.title||"Correction Mémorisée",detail:a.rule||a.correction||String(a),category:"Correction",confidence:.98,date:a.created_at||"Validé",source:"Feedback Utilisateur",userComment:a.user_comment}))}),(c.patterns||[]).forEach((a,s)=>{const r=a.id||`api_pat_${s}`;i.has(r)||(i.add(r),t.push({id:r,type:"pattern",title:a.prefer?`Préférer : ${a.prefer}`:"Habitude Apprise",detail:a.avoid?`Ãviter : ${a.avoid} â Préférer : ${a.prefer}`:a.pattern||a.content||String(a),category:"Habitude",confidence:a.confidence||.94,date:a.timestamp||"Actif",source:"Observation ARIA"}))})}}catch{}if(o)try{const d=new Set;try{const{useStore:c}=await J(async()=>{const{useStore:s}=await import("./index-BfFoir-D.js").then(r=>r.ek);return{useStore:s}},__vite__mapDeps([0,1,2,3,4,5,6]));(c.getState().conversations||[]).forEach(s=>{s.id&&d.add(s.id)});const a=localStorage.getItem(`aria_conversations_cache_v1:${o}`);if(a){const s=JSON.parse(a);
2Array.isArray(s)&&s.forEach(r=>{r?.id&&d.add(r.id)})}}catch{}for(let c=0;c<localStorage.length;c++){const a=localStorage.key(c);if(a&&a.startsWith("aria_messages_cache:")){const s=a.replace("aria_messages_cache:","").split(":")[0];if(s&&d.size>0&&!d.has(s))continue;const r=localStorage.getItem(a);if(r){const L=JSON.parse(r);Array.isArray(L)&&L.forEach(p=>{const x=p.content||p.text||"";if(typeof x=="string"&&p.role==="user"&&/^(je veux que|toujours|ne jamais|règle|consigne)\b/i.test(x.trim())&&x.length>15&&x.length<250){const _=`hist_${ne(x)}`;i.has(_)||(i.add(_),t.push({id:_,type:"directive",title:"Directive issue du dialogue",detail:x.trim(),category:"Instruction",confidence:.96,date:p.timestamp?new Date(p.timestamp).toLocaleDateString("fr-FR"):"Historique",source:"Conversation passée"}))}})}}}}catch{}j(t)}finally{D(!1)}},[o]);n.useEffect(()=>{C()},[C]);const B=async()=>{E(!0),m("Scan approfondi de toutes les mémoires et conversations anciennes...");try{await new Promise(t=>setTimeout(t,600)),await C(),m("Scan terminé : 100% des faits et consignes ont été consolidés !"),setTimeout(()=>m(null),3500)}catch{m("Scan terminé avec succès."),setTimeout(()=>m(null),2500)}finally{E(!1)}},O=()=>{if(!g.trim()||!v.trim())return;const t={id:`custom_${Date.now()}`,type:y,title:g.trim(),detail:v.trim(),category:y==="directive"?"Directive":y==="patch"?"Correction":"Habitude",confidence:1,date:"à lâinstant",source:"Ajout Manuel"};j(i=>[t,...i]),f(!1),P(""),T("")},V=t=>{j(i=>i.filter(l=>l.id!==t))},R=n.useMemo(()=>w.filter(t=>{const i=h==="all"||t.type===h,l=S.toLowerCase().trim(),A=!l||t.title.toLowerCase().includes(l)||t.detail.toLowerCase().includes(l)||t.category.toLowerCase().includes(l);return i&&A}),[w,h,S]);return e.jsxs("div",{className:"min-h-0 flex-1 overflow-auto p-3 sm:p-4 custom-scrollbar-cyan","data-aria":"workspace-learned-patterns",children:[e.jsxs("div",{className:"mb-3 flex items-start justify-between gap-2 border-b border-white/10 pb-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-amber-400 animate-pulse"}),e.jsx("p",{className:"text-[13px] font-bold text-white tracking-wide",children:"Ce quâARIA a appris de toi"})]}),e.jsx("p",{className:"mt-0.5 text-[11px] text-texte-faible leading-relaxed",children:"Directives souveraines, habitudes de code, préférences artistiques et leçons retenues au fil de vos échanges."})]}),e.jsxs("button",{type:"button",onClick:B,disabled:N,title:"Scanner tout l'historique (Même ancien)",className:"flex shrink-0 items-center gap-1.5 rounded-xl border border-[rgba(196,165,116,0.30)] bg-[rgba(196,165,116,0.10)] px-2.5 py-1.5 text-[11px] font-semibold text-[#E8D5B5] hover:bg-[rgba(196,165,116,0.20)] transition-all shadow-sm",children:[e.jsx(Z,{className:`h-3 w-3 ${N?"animate-spin":""}`}),e.jsx("span",{children:N?"Scan...":"Scanner"})]})]}),I&&e.jsx(k.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},className:"mb-3 rounded-xl border border-[rgba(196,165,116,0.30)] bg-[rgba(196,165,116,0.15)] p-2 text-center text-xs font-medium text-[#E8D5B5]",children:I}),e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Q,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-texte-faible"}),e.jsx("input",{type:"text",value:S,onChange:t=>H(t.target.value),placeholder:"Rechercher une règle, un fait, une habitude...",className:"w-full rounded-xl border border-white/10 bg-white/[0.03] py-1.5 pl-8 pr-3 text-xs text-white placeholder-texte-faible focus:border-amber-400/50 focus:outline-none transition-all"})]}),e.jsxs("button",{type:"button",onClick:()=>f(!0),className:"flex items-center gap-1 rounded-xl border border-amber-400/30 bg-amber-500/15 px-2.5 py-1.5 text-xs font-semibold text-amber-200 hover:bg-amber-500/25 transition-all shrink-0",children:[e.jsx(ee,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Ajouter"})]})]}),e.jsx("div",{className:"mb-3 flex items-center gap-1.5 overflow-x-auto scrollbar-none pb-1",children:[{id:"all",label:`Tout (${w.length})`},{id:"directive",label:"Directives"},{id:"pattern",label:"Habitudes"},{id:"patch",label:"Corrections"},{id:"fact",label:"Faits"}].map(t=>e.jsx("button",{type:"button",onClick:()=>F(t.id),className:`shrink-0 rounded-lg px-2.5 py-1 text-[10px] font-medium transition ${h===t.id?"bg-amber-500/20 text-amber-300 border border-amber-400/40 shadow-sm":"bg-white/[0.02] text-texte-faible border border-white/5 hover:text-white"}`,children:t.label},t.id))}),q?e.jsxs("div",{className:"flex items-center justify-center gap-2 py-10 text-texte-faible text-xs",children:[e.jsx(te,{className:"h-4 w-4 animate-spin text-amber-400"})," Exploration mémorielle en coursâ¦"]}):R.length===0?e.jsxs("div",{className:"rounded-2xl border border-border bg-surface-voile p-8 text-center",children:[e.jsx(ae,{className:"mx-auto mb-2 h-7 w-7 text-texte-efface"}),e.jsx("p",{className:"text-xs text-texte-faible",children:"Aucune connaissance trouvée pour cette catégorie."})]}):e.jsx("div",{className:"flex flex-col gap-2.5 mb-4",children:R.map(t=>e.jsxs(k.div,{initial:{opacity:0,y:4}
2,animate:{opacity:1,y:0},className:"relative overflow-hidden rounded-2xl border border-white/10 bg-[#06080e]/80 p-3 shadow-[0_4px_20px_rgba(0,0,0,0.3)] backdrop-blur-md hover:border-amber-400/30 transition-all",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{className:`text-[9px] font-bold uppercase tracking-wider px-2 py-0.5 rounded-full border ${t.type==="directive"?"border-[rgba(196,165,116,0.30)] bg-[rgba(196,165,116,0.10)] text-[#E8D5B5]":t.type==="patch"?"border-emerald-500/30 bg-emerald-500/10 text-emerald-300":"border-amber-500/30 bg-amber-500/10 text-amber-300"}`,children:t.category}),e.jsxs("span",{className:"text-[10px] text-texte-efface",children:["⢠Confiance ",Math.round(t.confidence*100),"%"]}),t.date&&e.jsxs("span",{className:"text-[10px] text-texte-efface",children:["⢠",t.date]})]}),e.jsx("button",{type:"button",title:"Supprimer",onClick:()=>V(t.id),className:"text-texte-efface hover:text-rose-400 transition-colors p-1",children:e.jsx(re,{className:"h-3 w-3"})})]}),e.jsx("h4",{className:"text-xs font-bold text-white tracking-tight",children:t.title}),e.jsx("p",{className:"mt-1 text-[11px] text-texte-doux leading-relaxed whitespace-pre-wrap",children:t.detail}),t.userComment&&e.jsxs("div",{className:"mt-2 rounded-lg bg-amber-500/[0.06] border border-amber-400/15 p-1.5 text-[10px] text-amber-200/90 italic",children:["Note : ",t.userComment]}),e.jsxs("div",{className:"mt-2 flex items-center justify-between text-[9px] text-texte-efface border-t border-white/5 pt-1.5",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(M,{className:"h-2.5 w-2.5 text-amber-400"}),t.source]}),e.jsx("span",{className:"text-emerald-400/80 font-medium",children:"Actif en permanence"})]})]},t.id))}),e.jsxs("button",{type:"button",onClick:()=>u("/memory?tab=learned"),className:"flex w-full items-center justify-center gap-1.5 rounded-xl border border-amber-400/30 bg-amber-500/15 px-3 py-2.5 text-xs font-bold text-amber-100 hover:bg-amber-500/25 transition-all shadow-md mt-2",children:[e.jsx("span",{children:"Consulter & Gérer dans la Page Mémoire Intégrale"}),e.jsx(se,{className:"h-3.5 w-3.5"})]}),e.jsx(K,{children:U&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4 backdrop-blur-sm",children:e.jsxs(k.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"w-full max-w-md rounded-2xl border border-amber-400/30 bg-[#0d121f] p-5 shadow-2xl space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-white/10 pb-2",children:[e.jsxs("h3",{className:"text-sm font-bold text-white flex items-center gap-2",children:[e.jsx(M,{className:"h-4 w-4 text-amber-400"}),"Enseigner une règle ou fait à ARIA"]}),e.jsx("button",{type:"button",onClick:()=>f(!1),className:"text-texte-faible hover:text-white",children:e.jsx(ie,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] font-semibold text-texte-faible mb-1",children:"Type de mémoire"}),e.jsxs("select",{value:y,onChange:t=>z(t.target.value),className:"w-full rounded-xl border border-white/10 bg-white/5 py-1.5 px-3 text-xs text-white focus:border-amber-400/50 outline-none",children:[e.jsx("option",{value:"directive",children:"Directive Stricte (Règle d'or)"}),e.jsx("option",{value:"pattern",children:"Habitude / Préférence de style"}),e.jsx("option",{value:"patch",children:"Correction de rôle ou comportement"}),e.jsx("option",{value:"fact",children:"Fait personnel ou projet"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] font-semibold text-texte-faible mb-1",children:"Titre de la règle"}),e.jsx("input",{type:"text",value:g,onChange:t=>P(t.target.value),placeholder:"Ex: Toujours utiliser le standard A4 pour les lettres",className:"w-full rounded-xl border border-white/10 bg-white/5 py-1.5 px-3 text-xs text-white placeholder-texte-faible focus:border-amber-400/50 outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] font-semibold text-texte-faible mb-1",children:"Détails & Consignes"}
2),e.jsx("textarea",{rows:3,value:v,onChange:t=>T(t.target.value),placeholder:"Exprimez précisément ce qu'ARIA doit appliquer sans exception...",className:"w-full rounded-xl border border-white/10 bg-white/5 py-1.5 px-3 text-xs text-white placeholder-texte-faible focus:border-amber-400/50 outline-none resize-none"})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2 border-t border-white/10",children:[e.jsx("button",{type:"button",onClick:()=>f(!1),className:"rounded-xl px-3 py-1.5 text-xs text-texte-faible hover:bg-white/5",children:"Annuler"}),e.jsx("button",{type:"button",onClick:O,disabled:!g.trim()||!v.trim(),className:"rounded-xl bg-amber-500/20 border border-amber-400/40 px-3.5 py-1.5 text-xs font-bold text-amber-200 hover:bg-amber-500/30 transition-all disabled:opacity-50",children:"Valider la consigne"})]})]})})})]})}function ne(b){let o=0;for(let u=0;u<b.length;u++)o=(o<<5)-o+b.charCodeAt(u),o|=0;return Math.abs(o)}export{he 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.