@wakastellar/ui 3.5.0 → 3.5.2
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.
- package/dist/editor.cjs.js +2 -2
- package/dist/editor.es.js +4 -4
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +6826 -6826
- package/dist/src/blocks/login/index.d.ts +4 -4
- package/dist/src/stories/editor/EditorStoryWrapper.d.ts +11 -0
- package/dist/waka-editor-plugins-CGojOMS5.js +1 -0
- package/dist/{waka-editor-plugins-DR6tpsUC.mjs → waka-editor-plugins-Dwh4Vreq.mjs} +1 -1
- package/package.json +1 -1
- package/src/blocks/footer/index.tsx +4 -4
- package/src/blocks/login/index.tsx +14 -14
- package/src/blocks/profile/index.tsx +5 -6
- package/src/blocks/sidebar/index.tsx +0 -2
- package/src/components/dropdown-menu/DropdownMenu.stories.tsx +2 -2
- package/src/components/editor/waka-dnd-editor.tsx +1 -1
- package/src/components/editor/waka-document-editor.tsx +1 -1
- package/src/components/editor/waka-editor-plugins.ts +1 -1
- package/src/components/waka-approval-chain/WakaApprovalChain.stories.tsx +15 -17
- package/src/components/waka-compare-period/WakaComparePeriod.stories.tsx +35 -19
- package/src/components/waka-content-recommendation/WakaContentRecommendation.stories.tsx +18 -5
- package/src/components/waka-password-strength/WakaPasswordStrength.stories.tsx +11 -34
- package/src/components/waka-streak-counter/WakaStreakCounter.stories.tsx +30 -30
- package/dist/waka-editor-plugins-sGSh9hn2.js +0 -1
package/dist/editor.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./chunk-14q5BKub.js`),t=require(`./cn-DEtaFQsA.js`),n=require(`./security-bFWwDrlg.js`),r=require(`./badge-BbwO7QeZ.js`),i=require(`./separator-NrkltulH.js`),a=require(`./textarea-CdQWggYG.js`),o=require(`./waka-editor-plugins-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./chunk-14q5BKub.js`),t=require(`./cn-DEtaFQsA.js`),n=require(`./security-bFWwDrlg.js`),r=require(`./badge-BbwO7QeZ.js`),i=require(`./separator-NrkltulH.js`),a=require(`./textarea-CdQWggYG.js`),o=require(`./waka-editor-plugins-CGojOMS5.js`);let s=require(`react`);s=e.a(s);let c=require(`lucide-react`),l=require(`react/jsx-runtime`);t.n();function u(e,t){try{t(e.chain().focus())}catch{}}function d(e,t,n){try{return e.isActive(t,n)}catch{return!1}}var f={bold:{icon:c.Bold,label:`Gras`,shortcut:`Ctrl+B`,action:e=>u(e,e=>e.toggleBold().run()),isActive:e=>d(e,`bold`)},italic:{icon:c.Italic,label:`Italique`,shortcut:`Ctrl+I`,action:e=>u(e,e=>e.toggleItalic().run()),isActive:e=>d(e,`italic`)},underline:{icon:c.Underline,label:`Souligné`,shortcut:`Ctrl+U`,action:e=>u(e,e=>e.toggleUnderline().run()),isActive:e=>d(e,`underline`)},strikethrough:{icon:c.Strikethrough,label:`Barré`,shortcut:`Ctrl+Shift+S`,action:e=>u(e,e=>e.toggleStrike().run()),isActive:e=>d(e,`strikethrough`)},code:{icon:c.Code,label:`Code`,shortcut:`Ctrl+E`,action:e=>u(e,e=>e.toggleCode().run()),isActive:e=>d(e,`code`)},highlight:{icon:c.Highlighter,label:`Surligné`,action:e=>u(e,e=>e.toggleHighlight().run()),isActive:e=>d(e,`highlight`)},h1:{icon:c.Heading1,label:`Titre 1`,action:e=>{try{e.tf.h1.toggle()}catch{u(e,e=>e.toggleHeading({level:1}).run())}},isActive:e=>d(e,`heading`,{level:1})},h2:{icon:c.Heading2,label:`Titre 2`,action:e=>{try{e.tf.h2.toggle()}catch{u(e,e=>e.toggleHeading({level:2}).run())}},isActive:e=>d(e,`heading`,{level:2})},h3:{icon:c.Heading3,label:`Titre 3`,action:e=>{try{e.tf.h3.toggle()}catch{u(e,e=>e.toggleHeading({level:3}).run())}},isActive:e=>d(e,`heading`,{level:3})},blockquote:{icon:c.Quote,label:`Citation`,action:e=>{try{e.tf.blockquote.toggle()}catch{u(e,e=>e.toggleBlockquote().run())}},isActive:e=>d(e,`blockquote`)},callout:{icon:c.MessageSquarePlus,label:`Callout`,action:e=>{try{e.tf.callout.insert()}catch{}},isActive:e=>d(e,`callout`)},table:{icon:c.Table,label:`Tableau`,action:e=>{try{e.tf.table.insert({rows:3,cols:3})}catch{}},isActive:e=>d(e,`table`)},columns:{icon:c.Columns2,label:`Colonnes`,action:e=>{try{e.tf.column.insert()}catch{}},isActive:e=>d(e,`column_group`)},link:{icon:c.Link,label:`Lien`,shortcut:`Ctrl+K`,action:e=>{try{e.tf.link.toggle()}catch{}},isActive:e=>d(e,`a`)},image:{icon:c.Image,label:`Image`,action:e=>{try{e.tf.image.insert({url:``})}catch{}},isActive:()=>!1},separator:{icon:c.Minus,label:`Séparateur`,action:e=>{try{u(e,e=>e.insertBreak().run())}catch{}},isActive:()=>!1},ai:{icon:c.Sparkles,label:`Assistant IA`,action:()=>{},isActive:()=>!1}},p=[[`bold`,`italic`,`underline`,`strikethrough`,`code`,`highlight`],[`h1`,`h2`,`h3`],[`blockquote`,`callout`,`table`,`columns`],[`link`,`image`,`separator`]];function m({groups:e=p,editor:r,className:a,enableAI:o=!1,onAIClick:c}){let u=s.useMemo(()=>o?[...e,[`ai`]]:e,[e,o]);return(0,l.jsx)(n.u,{delayDuration:300,children:(0,l.jsx)(`div`,{role:`toolbar`,"aria-label":`Barre d'outils de formatage`,className:t.t(`flex flex-wrap items-center gap-0.5 p-1`,`border-b bg-muted/30`,a),children:u.map((e,t)=>(0,l.jsxs)(s.Fragment,{children:[t>0&&(0,l.jsx)(i.t,{orientation:`vertical`,className:`mx-1 h-6`}),e.map(e=>{let t=f[e];if(!t)return null;let a=t.isActive?.(r)??!1,o=t.shortcut?`${t.label} (${t.shortcut})`:t.label,s=t.icon;return(0,l.jsxs)(n.c,{children:[(0,l.jsx)(n.d,{asChild:!0,children:(0,l.jsx)(i.n,{type:`button`,variant:a?`secondary`:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>{if(e===`ai`&&c){c();return}t.action(r)},"aria-label":t.label,"aria-pressed":a,children:(0,l.jsx)(s,{className:`h-4 w-4`})})}),(0,l.jsx)(n.l,{side:`bottom`,className:`text-xs`,children:o})]},e)})]},t))})})}m.displayName=`WakaEditorToolbar`,t.n();var h=s.forwardRef(({value:e,onChange:t,readOnly:n=!1,placeholder:r=`Commencez a ecrire...`,className:i,editorClassName:a,minHeight:o=200,label:c,description:u,error:d,preset:f=`standard`,enableAI:m=!1,enableMarkdown:h=!1,enableMedia:v=!1,enableMentions:y=!1,enableDnD:b=!1,enableTOC:x=!1,toolbarGroups:S=p,hideToolbar:C=!1,onAIClick:w,extraPlugins:T,editorRef:E},D)=>{let[O,k]=s.useState(null),[A,j]=s.useState(!1);return s.useEffect(()=>{let e=!1;return(async()=>{try{let[t,n]=await Promise.all([import(`platejs/react`),Promise.resolve().then(()=>require(`./waka-editor-plugins-CGojOMS5.js`)).then(e=>e.g)]),r=await n.loadCorePlugins(),i=n.getPresetLoaders(f),a=await Promise.all(i.map(e=>e())),o=[];h&&o.push(n.loadMarkdownPlugin()),v&&o.push(n.loadMediaPlugins()),y&&o.push(n.loadMentionPlugins()),b&&o.push(n.loadDndPlugin()),x&&o.push(n.loadTocPlugin());let s=await Promise.all(o),c=[...r,...a.flat(),...s.flat(),...T??[]];e||k({components:{Plate:t.Plate,PlateContent:t.PlateContent,usePlateEditor:t.usePlateEditor},plugins:c})}catch{e||j(!0)}})(),()=>{e=!0}},[f,h,v,y,b,x,T]),O?(0,l.jsx)(g,{ref:D,components:O.components,plugins:O.plugins,value:e,onChange:t,readOnly:n,placeholder:r,className:i,editorClassName:a,minHeight:o,label:c,description:u,error:d,enableAI:m,toolbarGroups:S,hideToolbar:C,onAIClick:w,editorRef:E}):(0,l.jsx)(_,{ref:D,value:e,onChange:t,placeholder:r,className:i,minHeight:o,label:c,description:u,error:d,loading:!A,readOnly:n})});h.displayName=`WakaEditor`;var g=s.forwardRef(({components:{Plate:e,PlateContent:n,usePlateEditor:r},plugins:i,value:o,onChange:c,readOnly:u=!1,placeholder:d,className:f,editorClassName:p,minHeight:h,label:g,description:_,error:v,enableAI:y,toolbarGroups:b,hideToolbar:x,onAIClick:S,editorRef:C},w)=>{let T=r({plugins:i,value:o??[{type:`p`,children:[{text:``}]}]});return s.useEffect(()=>{C&&(C.current=T)},[T,C]),(0,l.jsxs)(`div`,{ref:w,className:t.t(`space-y-1.5`,f),children:[g&&(0,l.jsx)(a.n,{children:g}),_&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:_}),(0,l.jsx)(e,{editor:T,onChange:c?({value:e})=>c(e):void 0,readOnly:u,children:(0,l.jsxs)(`div`,{className:t.t(`border rounded-lg overflow-hidden`,v&&`border-destructive`,u&&`opacity-80`),children:[!x&&!u&&(0,l.jsx)(m,{editor:T,groups:b,enableAI:y,onAIClick:S}),(0,l.jsx)(`div`,{style:{minHeight:h},children:(0,l.jsx)(n,{placeholder:d,readOnly:u,className:t.t(`prose prose-sm max-w-none p-3`,`focus-within:outline-none`,`[&_[data-slate-editor]]:outline-none [&_[data-slate-editor]]:min-h-[inherit]`,p)})})]})}),v&&(0,l.jsx)(`p`,{className:`text-sm text-destructive`,children:v})]})});g.displayName=`PlateEditorInner`;var _=s.forwardRef(({value:e,onChange:n,placeholder:r,className:i,minHeight:o,label:c,description:u,error:d,loading:f,readOnly:p},m)=>{let h=s.useMemo(()=>{if(!e)return``;let t=e=>e.map(e=>typeof e.text==`string`?e.text:e.children?t(e.children):``).join(`
|
|
2
2
|
`);return t(e)},[e]);return(0,l.jsxs)(`div`,{ref:m,className:t.t(`space-y-1.5`,i),children:[c&&(0,l.jsx)(a.n,{children:c}),u&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:u}),(0,l.jsxs)(`div`,{className:`relative`,children:[(0,l.jsx)(a.t,{value:h,onChange:e=>{n?.([{type:`p`,children:[{text:e.target.value}]}])},placeholder:r,disabled:f||p,style:{minHeight:o},className:t.t(d&&`border-destructive`)}),f&&(0,l.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-background/50 rounded-lg`,children:(0,l.jsx)(`span`,{className:`text-sm text-muted-foreground animate-pulse`,children:`Chargement de l'editeur...`})})]}),d&&(0,l.jsx)(`p`,{className:`text-sm text-destructive`,children:d})]})});_.displayName=`FallbackEditor`,t.n();function v(e,t){try{t(e)}catch{}}function y(e,t){try{return e.isActive(t)}catch{return!1}}var b=[{key:`bold`,icon:c.Bold,label:`Gras`,shortcut:`Ctrl+B`,action:e=>v(e,e=>e.chain().focus().toggleBold().run()),isActive:e=>y(e,`bold`)},{key:`italic`,icon:c.Italic,label:`Italique`,shortcut:`Ctrl+I`,action:e=>v(e,e=>e.chain().focus().toggleItalic().run()),isActive:e=>y(e,`italic`)},{key:`underline`,icon:c.Underline,label:`Souligne`,shortcut:`Ctrl+U`,action:e=>v(e,e=>e.chain().focus().toggleUnderline().run()),isActive:e=>y(e,`underline`)},{key:`strikethrough`,icon:c.Strikethrough,label:`Barre`,action:e=>v(e,e=>e.chain().focus().toggleStrike().run()),isActive:e=>y(e,`strikethrough`)},{key:`code`,icon:c.Code,label:`Code`,shortcut:`Ctrl+E`,action:e=>v(e,e=>e.chain().focus().toggleCode().run()),isActive:e=>y(e,`code`)},{key:`highlight`,icon:c.Highlighter,label:`Surligner`,action:e=>v(e,e=>e.chain().focus().toggleHighlight().run()),isActive:e=>y(e,`highlight`)},{key:`link`,icon:c.Link,label:`Lien`,shortcut:`Ctrl+K`,action:e=>{try{e.tf.link.toggle()}catch{}},isActive:e=>y(e,`a`)}],x=s.forwardRef(({editor:e,buttons:t=b,enableAI:n=!1,onAIClick:r,className:i},a)=>{let[o,u]=s.useState(null);return s.useEffect(()=>{import(`@platejs/floating`).then(e=>{e.useFloatingToolbar&&u(()=>e.useFloatingToolbar)}).catch(()=>{})},[]),(0,l.jsx)(S,{ref:a,editor:e,buttons:s.useMemo(()=>n?[...t,{key:`ai`,icon:c.Sparkles,label:`Demander a l'IA`,action:()=>r?.(),isActive:()=>!1}]:t,[t,n,r]),className:i,floatingHook:o})});x.displayName=`WakaFloatingToolbar`;var S=s.forwardRef(({editor:e,buttons:n,className:r,floatingHook:i},a)=>{let o=i?i({editor:e}):{ref:null,hidden:!1,props:{}},c=s.useCallback(e=>{typeof a==`function`?a(e):a&&(a.current=e),o.ref&&(typeof o.ref==`function`?o.ref(e):o.ref.current=e)},[a,o.ref]);return o.hidden?null:(0,l.jsx)(`div`,{ref:c,...o.props,className:t.t(`flex items-center gap-0.5 p-1`,`rounded-lg border bg-popover shadow-lg`,`animate-in fade-in-0 zoom-in-95`,r),role:`toolbar`,"aria-label":`Barre d'outils flottante`,children:n.map((n,r)=>{let i=n.isActive?.(e)??!1,a=n.icon;return(0,l.jsx)(`button`,{type:`button`,title:n.shortcut?`${n.label} (${n.shortcut})`:n.label,"aria-label":n.label,"aria-pressed":i,className:t.t(`inline-flex h-7 w-7 items-center justify-center rounded-md`,`text-sm transition-colors`,i?`bg-accent text-accent-foreground`:`hover:bg-accent/50 text-foreground/70 hover:text-foreground`),onMouseDown:t=>{t.preventDefault(),n.action(e)},children:(0,l.jsx)(a,{className:`h-3.5 w-3.5`})},n.key)})})});S.displayName=`FloatingToolbarContent`,t.n();var C=[{key:`h1`,label:`Titre 1`,description:`Titre principal de section`,icon:c.Heading1,group:`Blocs de base`,keywords:[`heading`,`titre`,`h1`],action:e=>{try{e.tf.h1.toggle()}catch{}}},{key:`h2`,label:`Titre 2`,description:`Sous-titre de section`,icon:c.Heading2,group:`Blocs de base`,keywords:[`heading`,`titre`,`h2`],action:e=>{try{e.tf.h2.toggle()}catch{}}},{key:`h3`,label:`Titre 3`,description:`Titre de sous-section`,icon:c.Heading3,group:`Blocs de base`,keywords:[`heading`,`titre`,`h3`],action:e=>{try{e.tf.h3.toggle()}catch{}}},{key:`bulletList`,label:`Liste a puces`,description:`Liste non ordonnee`,icon:c.List,group:`Blocs de base`,keywords:[`bullet`,`list`,`unordered`,`puces`],action:e=>{try{e.chain().focus().toggleBulletList().run()}catch{}}},{key:`numberedList`,label:`Liste numerotee`,description:`Liste ordonnee`,icon:c.ListOrdered,group:`Blocs de base`,keywords:[`numbered`,`list`,`ordered`,`numerotee`],action:e=>{try{e.chain().focus().toggleOrderedList().run()}catch{}}},{key:`blockquote`,label:`Citation`,description:`Bloc de citation`,icon:c.Quote,group:`Blocs de base`,keywords:[`quote`,`citation`,`blockquote`],action:e=>{try{e.tf.blockquote.toggle()}catch{}}},{key:`table`,label:`Tableau`,description:`Inserer un tableau 3x3`,icon:c.Table,group:`Blocs avances`,keywords:[`table`,`tableau`,`grid`],action:e=>{try{e.tf.table.insert({rows:3,cols:3})}catch{}}},{key:`columns`,label:`Colonnes`,description:`Mise en page multi-colonnes`,icon:c.Columns2,group:`Blocs avances`,keywords:[`column`,`colonne`,`layout`,`mise en page`],action:e=>{try{e.tf.column.insert()}catch{}}},{key:`callout`,label:`Callout`,description:`Encart d'information colore`,icon:c.MessageSquarePlus,group:`Blocs avances`,keywords:[`callout`,`alert`,`info`,`encart`],action:e=>{try{e.tf.callout.insert()}catch{}}},{key:`codeBlock`,label:`Bloc de code`,description:`Code source avec coloration`,icon:c.Code,group:`Blocs avances`,keywords:[`code`,`pre`,`source`],action:e=>{try{e.chain().focus().toggleCodeBlock().run()}catch{}}},{key:`link`,label:`Lien`,description:`Inserer un lien hypertexte`,icon:c.Link,group:`Insertions`,keywords:[`link`,`lien`,`url`,`href`],action:e=>{try{e.tf.link.toggle()}catch{}}},{key:`image`,label:`Image`,description:`Inserer une image`,icon:c.Image,group:`Insertions`,keywords:[`image`,`photo`,`picture`,`img`],action:e=>{try{e.tf.image.insert({url:``})}catch{}}},{key:`divider`,label:`Separateur`,description:`Ligne horizontale de separation`,icon:c.Minus,group:`Insertions`,keywords:[`divider`,`separator`,`hr`,`line`],action:e=>{try{e.chain().focus().insertBreak().run()}catch{}}},{key:`ai`,label:`Demander a l'IA`,description:`Generer du contenu avec l'assistant IA`,icon:c.Sparkles,group:`IA`,keywords:[`ai`,`ia`,`assistant`,`generate`,`generer`],action:()=>{}}];function w({commands:e=C,className:n,onSelect:r}){let[i,a]=s.useState(``),[o,c]=s.useState(0),u=s.useRef(null),d=s.useMemo(()=>{if(!i)return e;let t=i.toLowerCase();return e.filter(e=>e.label.toLowerCase().includes(t)||e.key.toLowerCase().includes(t)||e.keywords?.some(e=>e.toLowerCase().includes(t)))},[e,i]),f=s.useMemo(()=>{let e=new Map;for(let t of d){let n=t.group||`Autre`;e.has(n)||e.set(n,[]),e.get(n).push(t)}return e},[d]),p=s.useMemo(()=>d,[d]),m=s.useCallback(e=>{e.key===`ArrowDown`?(e.preventDefault(),c(e=>Math.min(e+1,p.length-1))):e.key===`ArrowUp`?(e.preventDefault(),c(e=>Math.max(e-1,0))):e.key===`Enter`&&p[o]&&(e.preventDefault(),r?.(p[o].key))},[p,o,r]);return s.useEffect(()=>c(0),[i]),(0,l.jsxs)(`div`,{ref:u,className:t.t(`w-72 max-h-80 overflow-y-auto`,`rounded-lg border bg-popover shadow-lg`,`p-1`,n),role:`listbox`,onKeyDown:m,children:[(0,l.jsx)(`div`,{className:`px-2 pb-1.5`,children:(0,l.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:`Rechercher...`,className:t.t(`w-full rounded-md border bg-background px-2 py-1.5`,`text-sm placeholder:text-muted-foreground`,`focus:outline-none focus:ring-1 focus:ring-ring`),autoFocus:!0})}),p.length===0&&(0,l.jsx)(`div`,{className:`px-2 py-4 text-center text-sm text-muted-foreground`,children:`Aucune commande trouvee`}),Array.from(f.entries()).map(([e,n])=>(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`div`,{className:`px-2 py-1 text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:e}),n.map(e=>{let n=p.indexOf(e),i=e.icon;return(0,l.jsxs)(`button`,{role:`option`,"aria-selected":n===o,className:t.t(`flex w-full items-center gap-3 rounded-md px-2 py-1.5 text-left`,`text-sm transition-colors cursor-pointer`,n===o?`bg-accent text-accent-foreground`:`hover:bg-accent/50`),onMouseEnter:()=>c(n),onClick:()=>r?.(e.key),children:[(0,l.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md border bg-background`,children:(0,l.jsx)(i,{className:`h-4 w-4`})}),(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`font-medium`,children:e.label}),e.description&&(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground truncate`,children:e.description})]})]},e.key)})]},e))]})}w.displayName=`WakaSlashMenu`;async function T(e=C){try{let{SlashPlugin:t,SlashInputPlugin:n}=await import(`@platejs/combobox/react`);return[t.configure({options:{trigger:`/`,triggerPreviousCharPattern:/^$|^[\s"']$/,rules:e.map(e=>({key:e.key,text:e.label,keywords:e.keywords,onSelect:e.action}))}}),n]}catch{return console.warn(`[WakaSlashMenu] @platejs/combobox not installed, slash commands disabled`),[]}}t.n();var E=[{key:`continue`,label:`Continuer la redaction`,prompt:`Continue writing the following text naturally:
|
|
3
3
|
|
|
4
4
|
{{selection}}`,group:`Generer`},{key:`summarize`,label:`Resumer`,prompt:`Summarize the following text concisely:
|
|
@@ -25,7 +25,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
25
25
|
|
|
26
26
|
{{selection}}`,group:`Traduire`},{key:`translate-de`,label:`Traduire en allemand`,prompt:`Translate the following text to German:
|
|
27
27
|
|
|
28
|
-
{{selection}}`,group:`Traduire`}],D=s.forwardRef(({value:e,onChange:n,aiEndpoint:r,systemPrompt:i=`You are an advanced AI writing assistant. Help the user write, edit, and improve their content.`,aiActions:o=E,enableCopilot:c=!0,copilotDebounceMs:u=500,aiHeaders:d,readOnly:f=!1,placeholder:p=`Tapez / pour les commandes, ou commencez a ecrire...`,className:m,editorClassName:h,minHeight:g=300,label:_,description:v,error:y,extraPlugins:b,editorRef:x},S)=>{let[C,w]=s.useState(null),[T,D]=s.useState(!1),k=s.useRef({aiEndpoint:r,systemPrompt:i,aiActions:o,enableCopilot:c,copilotDebounceMs:u,aiHeaders:d});return k.current={aiEndpoint:r,systemPrompt:i,aiActions:o,enableCopilot:c,copilotDebounceMs:u,aiHeaders:d},s.useEffect(()=>{let e=!1;return(async()=>{try{let[t,n,r,i,a,o,s,c,l,u]=await Promise.all([import(`platejs/react`),import(`@platejs/basic-nodes/react`),import(`@platejs/table/react`),import(`@platejs/layout/react`),import(`@platejs/callout/react`),import(`@platejs/ai/react`),import(`@platejs/markdown`),import(`@platejs/selection/react`),import(`@platejs/link/react`),import(`@platejs/indent/react`)]),d=k.current,f=[n.BoldPlugin,n.ItalicPlugin,n.UnderlinePlugin,n.StrikethroughPlugin,n.CodePlugin,n.HighlightPlugin,n.H1Plugin,n.H2Plugin,n.H3Plugin,n.H4Plugin,n.BlockquotePlugin,r.TablePlugin,r.TableRowPlugin,r.TableCellPlugin,r.TableCellHeaderPlugin,i.ColumnPlugin,i.ColumnItemPlugin,a.CalloutPlugin,l.LinkPlugin.configure({options:{allowedSchemes:[`http`,`https`,`mailto`,`tel`]}}),u.IndentPlugin,c.BlockSelectionPlugin,s.MarkdownPlugin,o.AIPlugin,o.AIChatPlugin.configure({options:{chat:{api:d.aiEndpoint,body:{system:d.systemPrompt},headers:d.aiHeaders}}})];d.enableCopilot&&o.CopilotPlugin&&f.push(o.CopilotPlugin.configure(({api:e})=>({options:{completeOptions:{api:d.aiEndpoint,body:{system:d.systemPrompt},headers:d.aiHeaders,onFinish:(t,n)=>{n!==`0`&&e.copilot.setBlockSuggestion({text:n})}},debounceDelay:d.copilotDebounceMs},shortcuts:{accept:{keys:`tab`},acceptNextWord:{keys:`mod+right`},reject:{keys:`escape`},triggerSuggestion:{keys:`ctrl+space`}}}))),e||w({Plate:t.Plate,PlateContent:t.PlateContent,usePlateEditor:t.usePlateEditor,plugins:f})}catch(t){console.error(`[WakaAIWriter] Failed to load plugins:`,t),e||D(!0)}})(),()=>{e=!0}},[]),C?(0,l.jsx)(O,{ref:S,bundle:C,value:e,onChange:n,readOnly:f,placeholder:p,className:m,editorClassName:h,minHeight:g,label:_,description:v,error:y,extraPlugins:b,editorRef:x}):(0,l.jsxs)(`div`,{ref:S,className:t.t(`space-y-1.5`,m),children:[_&&(0,l.jsx)(a.n,{children:_}),v&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:v}),(0,l.jsxs)(`div`,{className:`relative`,children:[(0,l.jsx)(a.t,{placeholder:p,disabled:!0,style:{minHeight:g},className:t.t(y&&`border-destructive`)}),(0,l.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-background/50 rounded-lg`,children:(0,l.jsx)(`span`,{className:`text-sm text-muted-foreground animate-pulse`,children:T?`Erreur de chargement de l'editeur IA`:`Chargement de l'editeur IA...`})})]}),y&&(0,l.jsx)(`p`,{className:`text-sm text-destructive`,children:y})]})});D.displayName=`WakaAIWriter`;var O=s.forwardRef(({bundle:{Plate:e,PlateContent:n,usePlateEditor:r,plugins:i},value:o,onChange:c,readOnly:u,placeholder:d,className:f,editorClassName:p,minHeight:m,label:h,description:g,error:_,extraPlugins:v,editorRef:y},b)=>{let x=r({plugins:s.useMemo(()=>[...i,...v??[]],[i,v]),value:o??[{type:`p`,children:[{text:``}]}]});return s.useEffect(()=>{y&&(y.current=x)},[x,y]),(0,l.jsxs)(`div`,{ref:b,className:t.t(`space-y-1.5`,f),children:[h&&(0,l.jsx)(a.n,{children:h}),g&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:g}),(0,l.jsx)(e,{editor:x,onChange:c?({value:e})=>c(e):void 0,readOnly:u,children:(0,l.jsxs)(`div`,{className:t.t(`border rounded-lg overflow-hidden`,_&&`border-destructive`,u&&`opacity-80`),children:[!u&&(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b bg-muted/30 text-xs text-muted-foreground`,children:[(0,l.jsx)(`kbd`,{className:`rounded border bg-muted px-1.5 py-0.5 font-mono text-[10px]`,children:`Ctrl+J`}),(0,l.jsx)(`span`,{children:`Ouvrir le menu IA`}),(0,l.jsx)(`span`,{className:`mx-1`,children:`|`}),(0,l.jsx)(`kbd`,{className:`rounded border bg-muted px-1.5 py-0.5 font-mono text-[10px]`,children:`/`}),(0,l.jsx)(`span`,{children:`Commandes`}),(0,l.jsx)(`span`,{className:`mx-1`,children:`|`}),(0,l.jsx)(`kbd`,{className:`rounded border bg-muted px-1.5 py-0.5 font-mono text-[10px]`,children:`Ctrl+Espace`}),(0,l.jsx)(`span`,{children:`Copilot`})]}),(0,l.jsx)(`div`,{style:{minHeight:m},children:(0,l.jsx)(n,{placeholder:d,readOnly:u,className:t.t(`prose prose-sm max-w-none p-4`,`focus-within:outline-none`,`[&_[data-slate-editor]]:outline-none [&_[data-slate-editor]]:min-h-[inherit]`,p)})})]})}),_&&(0,l.jsx)(`p`,{className:`text-sm text-destructive`,children:_})]})});O.displayName=`AIWriterInner`,t.n();var k=s.forwardRef(({value:e,onChange:n,readOnly:r=!1,placeholder:i=`Commencez a rediger votre document...`,className:o,editorClassName:c,minHeight:u=500,label:d,description:f,error:p,title:m,onTitleChange:h,showTOC:g=!0,enableMentions:_=!1,enableSlashCommands:v=!1,enableAI:y=!1,aiEndpoint:b,aiSystemPrompt:x,enableDnD:S=!1,enableMarkdown:C=!0,extraPlugins:w,editorRef:T},E)=>{let[D,O]=s.useState(null),[k,M]=s.useState(!1),[ee,te]=s.useState([]),N=s.useRef({enableMentions:_,enableSlashCommands:v,enableAI:y,enableDnD:S,enableMarkdown:C,aiEndpoint:b,aiSystemPrompt:x});return N.current={enableMentions:_,enableSlashCommands:v,enableAI:y,enableDnD:S,enableMarkdown:C,aiEndpoint:b,aiSystemPrompt:x},s.useEffect(()=>{let e=!1;return(async()=>{try{let t=N.current,[n,r,i,a,o,s,c]=await Promise.all([import(`platejs/react`),import(`@platejs/basic-nodes/react`),import(`@platejs/table/react`),import(`@platejs/layout/react`),import(`@platejs/callout/react`),import(`@platejs/link/react`),import(`@platejs/indent/react`)]),l=[r.BoldPlugin,r.ItalicPlugin,r.UnderlinePlugin,r.StrikethroughPlugin,r.CodePlugin,r.HighlightPlugin,r.SuperscriptPlugin,r.SubscriptPlugin,r.H1Plugin,r.H2Plugin,r.H3Plugin,r.H4Plugin,r.H5Plugin,r.H6Plugin,r.BlockquotePlugin,i.TablePlugin,i.TableRowPlugin,i.TableCellPlugin,i.TableCellHeaderPlugin,a.ColumnPlugin,a.ColumnItemPlugin,o.CalloutPlugin,s.LinkPlugin.configure({options:{allowedSchemes:[`http`,`https`,`mailto`,`tel`]}}),c.IndentPlugin];try{let{TocPlugin:e}=await import(`@platejs/toc/react`);l.push(e)}catch{}try{let{BlockSelectionPlugin:e}=await import(`@platejs/selection/react`);l.push(e)}catch{}if(t.enableMentions)try{let{MentionPlugin:e,MentionInputPlugin:t}=await import(`@platejs/mention/react`);l.push(e.configure({options:{trigger:`@`,triggerPreviousCharPattern:/^$|^[\s"']$/,insertSpaceAfterMention:!0}}),t)}catch{}if(t.enableDnD)try{let{DndPlugin:e}=await import(`@platejs/dnd/react`);l.push(e)}catch{}if(t.enableMarkdown)try{let{MarkdownPlugin:e}=await import(`@platejs/markdown`);l.push(e)}catch{}if(t.enableAI&&t.aiEndpoint)try{let{AIPlugin:e,AIChatPlugin:n}=await import(`@platejs/ai/react`);l.push(e,n.configure({options:{chat:{api:t.aiEndpoint,body:{system:t.aiSystemPrompt??`You are a helpful writing assistant.`}}}}))}catch{}e||O({Plate:n.Plate,PlateContent:n.PlateContent,usePlateEditor:n.usePlateEditor,plugins:l})}catch(t){console.error(`[WakaDocumentEditor] Failed to load:`,t),e||M(!0)}})(),()=>{e=!0}},[]),s.useEffect(()=>{if(!g||!e){te([]);return}let t=[],n=0,r=new Set([`h1`,`h2`,`h3`,`h4`,`h5`,`h6`]);for(let i of e)if(r.has(i?.type)){let e=j(i);if(e.trim()){let r=parseInt(i.type.replace(`h`,``),10);t.push({id:`toc-${n++}`,text:e.trim(),level:r,depth:r-1})}}te(t)},[e,g]),D?(0,l.jsx)(A,{ref:E,bundle:D,value:e,onChange:n,readOnly:r,placeholder:i,className:o,editorClassName:c,minHeight:u,label:d,description:f,error:p,title:m,onTitleChange:h,showTOC:g,toc:ee,extraPlugins:w,editorRef:T}):(0,l.jsxs)(`div`,{ref:E,className:t.t(`space-y-1.5`,o),children:[d&&(0,l.jsx)(a.n,{children:d}),f&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f}),(0,l.jsxs)(`div`,{className:`relative`,children:[(0,l.jsx)(a.t,{placeholder:i,disabled:!0,style:{minHeight:u}}),(0,l.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-background/50 rounded-lg`,children:(0,l.jsx)(`span`,{className:`text-sm text-muted-foreground animate-pulse`,children:k?`Erreur de chargement de l'editeur`:`Chargement de l'editeur...`})})]}),p&&(0,l.jsx)(`p`,{className:`text-sm text-destructive`,children:p})]})});k.displayName=`WakaDocumentEditor`;var A=s.forwardRef(({bundle:{Plate:e,PlateContent:r,usePlateEditor:i,plugins:o},value:c,onChange:u,readOnly:d,placeholder:f,className:p,editorClassName:m,minHeight:h,label:g,description:_,error:v,title:y,onTitleChange:b,showTOC:x,toc:S,extraPlugins:C,editorRef:w},T)=>{let E=i({plugins:s.useMemo(()=>[...o,...C??[]],[o,C]),value:c??[{type:`p`,children:[{text:``}]}]});return s.useEffect(()=>{w&&(w.current=E)},[E,w]),(0,l.jsxs)(`div`,{ref:T,className:t.t(`space-y-1.5`,p),children:[g&&(0,l.jsx)(a.n,{children:g}),_&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:_}),(0,l.jsx)(e,{editor:E,onChange:u?({value:e})=>u(e):void 0,readOnly:d,children:(0,l.jsxs)(`div`,{className:t.t(`flex border rounded-lg overflow-hidden`,v&&`border-destructive`),children:[x&&S.length>0&&(0,l.jsxs)(`aside`,{className:`w-56 shrink-0 border-r bg-muted/20 hidden lg:block`,children:[(0,l.jsx)(`div`,{className:`p-3 border-b`,children:(0,l.jsx)(`h4`,{className:`text-xs font-bold uppercase tracking-wider text-muted-foreground`,children:`Table des matieres`})}),(0,l.jsx)(n.f,{className:`h-full max-h-[600px]`,children:(0,l.jsx)(`nav`,{className:`p-2 space-y-0.5`,children:S.map(e=>(0,l.jsx)(`button`,{className:t.t(`block w-full text-left px-2 py-1 rounded-md text-sm`,`hover:bg-accent/50 transition-colors truncate`,`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${e.depth*12+8}px`},title:e.text,children:e.text},e.id))})})]}),(0,l.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(y!==void 0||b)&&(0,l.jsx)(`div`,{className:`border-b px-6 py-4`,children:(0,l.jsx)(`input`,{type:`text`,value:y??``,onChange:e=>b?.(e.target.value),placeholder:`Titre du document`,readOnly:d,className:t.t(`w-full bg-transparent text-2xl font-bold text-foreground`,`placeholder:text-muted-foreground/50`,`focus:outline-none`)})}),(0,l.jsx)(`div`,{style:{minHeight:h},children:(0,l.jsx)(r,{placeholder:f,readOnly:d,className:t.t(`prose prose-sm max-w-none px-6 py-4`,`focus-within:outline-none`,`[&_[data-slate-editor]]:outline-none [&_[data-slate-editor]]:min-h-[inherit]`,m)})})]})]})}),v&&(0,l.jsx)(`p`,{className:`text-sm text-destructive`,children:v})]})});A.displayName=`DocumentEditorInner`;function j(e){return typeof e?.text==`string`?e.text:Array.isArray(e?.children)?e.children.map(e=>j(e)).join(``):``}t.n();var M=s.forwardRef(({markdownValue:e=``,onMarkdownChange:n,slateValue:r,onSlateChange:o,defaultMode:c=`rich`,readOnly:u=!1,placeholder:d=`Commencez a ecrire...`,className:f,editorClassName:p,minHeight:m=300,label:h,description:g,error:_,extraPlugins:v,editorRef:y},b)=>{let[x,S]=s.useState(c),[C,w]=s.useState(null),[T,E]=s.useState(!1),[D,O]=s.useState(e);s.useEffect(()=>{O(e)},[e]),s.useEffect(()=>{let e=!1;return(async()=>{try{let[t,n,r,i,a,o,s]=await Promise.all([import(`platejs/react`),import(`@platejs/basic-nodes/react`),import(`@platejs/table/react`),import(`@platejs/layout/react`),import(`@platejs/callout/react`),import(`@platejs/link/react`),import(`@platejs/markdown`)]),c=[n.BoldPlugin,n.ItalicPlugin,n.UnderlinePlugin,n.StrikethroughPlugin,n.CodePlugin,n.HighlightPlugin,n.H1Plugin,n.H2Plugin,n.H3Plugin,n.H4Plugin,n.BlockquotePlugin,r.TablePlugin,r.TableRowPlugin,r.TableCellPlugin,r.TableCellHeaderPlugin,i.ColumnPlugin,i.ColumnItemPlugin,a.CalloutPlugin,o.LinkPlugin.configure({options:{allowedSchemes:[`http`,`https`,`mailto`]}}),s.MarkdownPlugin];e||w({Plate:t.Plate,PlateContent:t.PlateContent,usePlateEditor:t.usePlateEditor,plugins:c,serializeMd:s.serializeMd,deserializeMd:s.deserializeMd})}catch(t){console.error(`[WakaMarkdownEditor] Failed to load:`,t),e||E(!0)}})(),()=>{e=!0}},[]);let k=(0,l.jsx)(`div`,{className:`flex items-center gap-1 p-1 border-b bg-muted/30`,children:[`rich`,`markdown`,`split`].map(e=>(0,l.jsx)(i.n,{type:`button`,variant:x===e?`secondary`:`ghost`,size:`sm`,className:`h-7 text-xs`,onClick:()=>S(e),children:e===`rich`?`Editeur`:e===`markdown`?`Markdown`:`Split`},e))}),A=s.useCallback(e=>{O(e),n?.(e)},[n]);return(0,l.jsxs)(`div`,{ref:b,className:t.t(`space-y-1.5`,f),children:[h&&(0,l.jsx)(a.n,{children:h}),g&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:g}),(0,l.jsxs)(`div`,{className:t.t(`border rounded-lg overflow-hidden`,_&&`border-destructive`),children:[!u&&k,x===`markdown`&&(0,l.jsx)(ee,{value:D,onChange:A,readOnly:u,placeholder:d,minHeight:m,className:p}),x===`rich`&&C&&(0,l.jsx)(te,{bundle:C,markdownValue:D,slateValue:r,onSlateChange:o,onMarkdownChange:n,readOnly:u,placeholder:d,minHeight:m,className:p,extraPlugins:v,editorRef:y}),x===`split`&&C&&(0,l.jsxs)(`div`,{className:`flex divide-x`,style:{minHeight:m},children:[(0,l.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,l.jsx)(te,{bundle:C,markdownValue:D,slateValue:r,onSlateChange:o,onMarkdownChange:n,readOnly:u,placeholder:d,minHeight:m,className:p,extraPlugins:v,editorRef:y})}),(0,l.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,l.jsx)(ee,{value:D,onChange:A,readOnly:u,placeholder:`Markdown...`,minHeight:m})})]}),!C&&x!==`markdown`&&(0,l.jsx)(`div`,{className:`relative`,style:{minHeight:m},children:(0,l.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-background/50`,children:(0,l.jsx)(`span`,{className:`text-sm text-muted-foreground animate-pulse`,children:T?`Erreur de chargement`:`Chargement...`})})})]}),_&&(0,l.jsx)(`p`,{className:`text-sm text-destructive`,children:_})]})});M.displayName=`WakaMarkdownEditor`;function ee({value:e,onChange:n,readOnly:r,placeholder:i,minHeight:o,className:s}){return(0,l.jsx)(a.t,{value:e,onChange:e=>n(e.target.value),readOnly:r,placeholder:i,style:{minHeight:o},className:t.t(`rounded-none border-0 resize-none font-mono text-sm`,`focus-visible:ring-0 focus-visible:ring-offset-0`,s)})}function te({bundle:{Plate:e,PlateContent:n,usePlateEditor:r,plugins:i,serializeMd:a},markdownValue:o,slateValue:c,onSlateChange:u,onMarkdownChange:d,readOnly:f,placeholder:p,minHeight:m,className:h,extraPlugins:g,editorRef:_}){let v=r({plugins:s.useMemo(()=>[...i,...g??[]],[i,g]),value:c??[{type:`p`,children:[{text:o||``}]}]});return s.useEffect(()=>{_&&(_.current=v)},[v,_]),(0,l.jsx)(e,{editor:v,onChange:s.useCallback(({value:e})=>{if(u?.(e),d&&a)try{d(a(v,{value:e}))}catch{}},[v,u,d,a]),readOnly:f,children:(0,l.jsx)(`div`,{style:{minHeight:m},children:(0,l.jsx)(n,{placeholder:p,readOnly:f,className:t.t(`prose prose-sm max-w-none p-4`,`focus-within:outline-none`,`[&_[data-slate-editor]]:outline-none [&_[data-slate-editor]]:min-h-[inherit]`,h)})})})}t.n();var N=[{key:`user-story`,label:`User Story`,description:`En tant que [role], je veux [action] afin de [benefice]`,icon:c.Users,category:`Fonctionnel`,createNodes:()=>[{type:`callout`,variant:`info`,children:[{text:``}]},{type:`h3`,children:[{text:`User Story`}]},{type:`p`,children:[{text:`En tant que `,bold:!0},{text:`[role]`}]},{type:`p`,children:[{text:`Je veux `,bold:!0},{text:`[action]`}]},{type:`p`,children:[{text:`Afin de `,bold:!0},{text:`[benefice attendu]`}]},{type:`p`,children:[{text:``}]}]},{key:`acceptance-criteria`,label:`Criteres d'acceptation`,description:`Given/When/Then avec scenarios de validation`,icon:c.CheckCircle2,category:`Fonctionnel`,createNodes:()=>[{type:`h3`,children:[{text:`Criteres d'acceptation`}]},{type:`table`,children:[{type:`tr`,children:[{type:`th`,children:[{type:`p`,children:[{text:`#`,bold:!0}]}]},{type:`th`,children:[{type:`p`,children:[{text:`Scenario`,bold:!0}]}]},{type:`th`,children:[{type:`p`,children:[{text:`Given`,bold:!0}]}]},{type:`th`,children:[{type:`p`,children:[{text:`When`,bold:!0}]}]},{type:`th`,children:[{type:`p`,children:[{text:`Then`,bold:!0}]}]}]},{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`AC-01`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Nominal`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`L'utilisateur est connecte`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Il clique sur le bouton`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Le resultat s'affiche`}]}]}]},{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`AC-02`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Erreur`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Le service est indisponible`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Il clique sur le bouton`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Un message d'erreur s'affiche`}]}]}]}]},{type:`p`,children:[{text:``}]}]},{key:`use-case`,label:`Cas d'utilisation`,description:`Acteur, pre-conditions, flux nominal, flux alternatifs`,icon:c.GitBranch,category:`Fonctionnel`,createNodes:()=>[{type:`h3`,children:[{text:`Cas d'utilisation : [Nom]`}]},{type:`column_group`,children:[{type:`column`,children:[{type:`h4`,children:[{text:`ACTEUR`}]},{type:`p`,children:[{text:`[Role utilisateur]`}]},{type:`h4`,children:[{text:`PRE-CONDITIONS`}]},{type:`p`,children:[{text:`- L'utilisateur est authentifie`}]},{type:`p`,children:[{text:`- [Autre condition]`}]},{type:`h4`,children:[{text:`POST-CONDITIONS`}]},{type:`p`,children:[{text:`- [Etat apres execution]`}]}]},{type:`column`,children:[{type:`h4`,children:[{text:`FLUX NOMINAL`}]},{type:`p`,children:[{text:`1. L'utilisateur accede a la page`}]},{type:`p`,children:[{text:`2. Le systeme affiche le formulaire`}]},{type:`p`,children:[{text:`3. L'utilisateur remplit et soumet`}]},{type:`p`,children:[{text:`4. Le systeme enregistre et confirme`}]},{type:`h4`,children:[{text:`FLUX ALTERNATIFS`}]},{type:`p`,children:[{text:`3a. Donnees invalides : erreur affichee`}]}]}]},{type:`p`,children:[{text:``}]}]},{key:`api-endpoint`,label:`Endpoint API`,description:`Specification d'un endpoint REST avec requete/reponse`,icon:c.Zap,category:`Technique`,createNodes:()=>[{type:`h3`,children:[{text:`API: [METHOD] /api/v1/[resource]`}]},{type:`table`,children:[{type:`tr`,children:[{type:`th`,children:[{type:`p`,children:[{text:`Propriete`,bold:!0}]}]},{type:`th`,children:[{type:`p`,children:[{text:`Valeur`,bold:!0}]}]}]},{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`Methode`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`GET | POST | PUT | DELETE`}]}]}]},{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`Authentification`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Bearer JWT`}]}]}]},{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`Permissions`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`[ROLE_REQUIRED]`}]}]}]},{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`Rate Limit`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`100 req/min`}]}]}]}]},{type:`h4`,children:[{text:`CORPS DE LA REQUETE`}]},{type:`blockquote`,children:[{text:`{ "field": "value" }`}]},{type:`h4`,children:[{text:`REPONSE 200`}]},{type:`blockquote`,children:[{text:`{ "data": { ... }, "meta": { "total": 42 } }`}]},{type:`p`,children:[{text:``}]}]},{key:`data-model`,label:`Modele de donnees`,description:`Schema d'entite avec champs, types et contraintes`,icon:c.Database,category:`Technique`,createNodes:()=>[{type:`h3`,children:[{text:`Modele : [NomEntite]`}]},{type:`table`,children:[{type:`tr`,children:[{type:`th`,children:[{type:`p`,children:[{text:`Champ`,bold:!0}]}]},{type:`th`,children:[{type:`p`,children:[{text:`Type`,bold:!0}]}]},{type:`th`,children:[{type:`p`,children:[{text:`Nullable`,bold:!0}]}]},{type:`th`,children:[{type:`p`,children:[{text:`Description`,bold:!0}]}]}]},{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`id`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`UUID`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Non`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Identifiant unique`}]}]}]},{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`createdAt`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`DateTime`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Non`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Date de creation`}]}]}]}]},{type:`p`,children:[{text:``}]}]},{key:`security-requirements`,label:`Exigences de securite`,description:`Regles OWASP, chiffrement, acces, conformite`,icon:c.Shield,category:`Non-fonctionnel`,createNodes:()=>[{type:`h3`,children:[{text:`Exigences de securite`}]},{type:`callout`,variant:`warning`,children:[{text:`Section obligatoire pour les modules HDS et les donnees sensibles`}]},{type:`table`,children:[{type:`tr`,children:[{type:`th`,children:[{type:`p`,children:[{text:`Categorie`,bold:!0}]}]},{type:`th`,children:[{type:`p`,children:[{text:`Exigence`,bold:!0}]}]},{type:`th`,children:[{type:`p`,children:[{text:`Niveau`,bold:!0}]}]}]},{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`Authentification`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`OAuth2 PKCE via Keycloak`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Obligatoire`}]}]}]},{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`Chiffrement`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`AES-256-GCM au repos, TLS 1.3 en transit`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Obligatoire`}]}]}]},{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`Audit`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`TracingInterceptor sur toutes les operations`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Obligatoire`}]}]}]}]},{type:`p`,children:[{text:``}]}]},{key:`risk-assessment`,label:`Risques et mitigations`,description:`Matrice de risques projet avec probabilite et impact`,icon:c.AlertTriangle,category:`Non-fonctionnel`,createNodes:()=>[{type:`h3`,children:[{text:`Analyse des risques`}]},{type:`table`,children:[{type:`tr`,children:[{type:`th`,children:[{type:`p`,children:[{text:`Risque`,bold:!0}]}]},{type:`th`,children:[{type:`p`,children:[{text:`Probabilite`,bold:!0}]}]},{type:`th`,children:[{type:`p`,children:[{text:`Impact`,bold:!0}]}]},{type:`th`,children:[{type:`p`,children:[{text:`Mitigation`,bold:!0}]}]}]},{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`[Description du risque]`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Moyen`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Haut`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`[Plan de mitigation]`}]}]}]}]},{type:`p`,children:[{text:``}]}]},{key:`spec-header`,label:`En-tete de specification`,description:`Bloc d'en-tete avec version, auteur, statut, date`,icon:c.BookOpen,category:`Document`,createNodes:()=>[{type:`h1`,children:[{text:`[Titre de la specification]`}]},{type:`table`,children:[{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`Version`,bold:!0}]}]},{type:`td`,children:[{type:`p`,children:[{text:`1.0.0`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Statut`,bold:!0}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Brouillon`}]}]}]},{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`Auteur`,bold:!0}]}]},{type:`td`,children:[{type:`p`,children:[{text:`[Nom]`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Date`,bold:!0}]}]},{type:`td`,children:[{type:`p`,children:[{text:new Date().toLocaleDateString(`fr-FR`)}]}]}]}]},{type:`h2`,children:[{text:`CONTEXTE`}]},{type:`p`,children:[{text:`[Description du contexte et des objectifs]`}]},{type:`h2`,children:[{text:`PERIMETRE`}]},{type:`p`,children:[{text:`[Ce qui est inclus et exclu du perimetre]`}]},{type:`p`,children:[{text:``}]}]}],ne=s.forwardRef(({value:e,onChange:n,readOnly:r=!1,placeholder:i=`Commencez votre specification...`,className:o,editorClassName:c,minHeight:u=500,label:d,description:f,error:p,customTemplates:m=[],showTemplateSidebar:h=!0,enableAI:g=!1,aiEndpoint:_,title:v,onTitleChange:y,extraPlugins:b,editorRef:x},S)=>{let[C,w]=s.useState(null),[T,E]=s.useState(!1),D=s.useRef(null),O=x??D,k=s.useMemo(()=>[...N,...m],[m]),A=s.useMemo(()=>{let e=new Map;for(let t of k){let n=t.category||`Autre`;e.has(n)||e.set(n,[]),e.get(n).push(t)}return e},[k]);s.useEffect(()=>{let e=!1;return(async()=>{try{let[t,n,r,i,a,o,s]=await Promise.all([import(`platejs/react`),import(`@platejs/basic-nodes/react`),import(`@platejs/table/react`),import(`@platejs/layout/react`),import(`@platejs/callout/react`),import(`@platejs/link/react`),import(`@platejs/indent/react`)]),c=[n.BoldPlugin,n.ItalicPlugin,n.UnderlinePlugin,n.StrikethroughPlugin,n.CodePlugin,n.HighlightPlugin,n.SuperscriptPlugin,n.SubscriptPlugin,n.H1Plugin,n.H2Plugin,n.H3Plugin,n.H4Plugin,n.H5Plugin,n.H6Plugin,n.BlockquotePlugin,r.TablePlugin,r.TableRowPlugin,r.TableCellPlugin,r.TableCellHeaderPlugin,i.ColumnPlugin,i.ColumnItemPlugin,a.CalloutPlugin,o.LinkPlugin.configure({options:{allowedSchemes:[`http`,`https`,`mailto`,`tel`]}}),s.IndentPlugin];try{let{TocPlugin:e}=await import(`@platejs/toc/react`);c.push(e)}catch{}try{let{BlockSelectionPlugin:e}=await import(`@platejs/selection/react`);c.push(e)}catch{}try{let{MarkdownPlugin:e}=await import(`@platejs/markdown`);c.push(e)}catch{}if(g&&_)try{let{AIPlugin:e,AIChatPlugin:t}=await import(`@platejs/ai/react`);c.push(e,t.configure({options:{chat:{api:_,body:{system:`You are a specification writing assistant for a PaaS platform.`}}}}))}catch{}e||w({Plate:t.Plate,PlateContent:t.PlateContent,usePlateEditor:t.usePlateEditor,plugins:c})}catch(t){console.error(`[WakaSpecEditor] Failed to load:`,t),e||E(!0)}})(),()=>{e=!0}},[g,_]);let j=s.useCallback(t=>{let r=t.createNodes(),i=[...e??[],...r];n?.(i)},[e,n]);return(0,l.jsxs)(`div`,{ref:S,className:t.t(`space-y-1.5`,o),children:[d&&(0,l.jsx)(a.n,{children:d}),f&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f}),(0,l.jsxs)(`div`,{className:t.t(`flex border rounded-lg overflow-hidden`,p&&`border-destructive`),children:[h&&!r&&(0,l.jsxs)(`aside`,{className:`w-52 shrink-0 border-r bg-muted/20 hidden md:block`,children:[(0,l.jsx)(`div`,{className:`p-3 border-b`,children:(0,l.jsx)(`h4`,{className:`text-xs font-bold uppercase tracking-wider text-muted-foreground`,children:`Blocs specification`})}),(0,l.jsx)(`div`,{className:`p-2 space-y-3 max-h-[600px] overflow-y-auto`,children:Array.from(A.entries()).map(([e,n])=>(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-muted-foreground px-1 mb-1`,children:e}),(0,l.jsx)(`div`,{className:`space-y-0.5`,children:n.map(e=>{let n=e.icon;return(0,l.jsxs)(`button`,{type:`button`,onClick:()=>j(e),className:t.t(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left`,`text-xs transition-colors cursor-pointer`,`hover:bg-accent/50 text-muted-foreground hover:text-foreground`),title:e.description,children:[(0,l.jsx)(n,{className:`h-3.5 w-3.5 shrink-0`}),(0,l.jsx)(`span`,{className:`truncate`,children:e.label})]},e.key)})})]},e))})]}),(0,l.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(v!==void 0||y)&&(0,l.jsx)(`div`,{className:`border-b px-6 py-4`,children:(0,l.jsx)(`input`,{type:`text`,value:v??``,onChange:e=>y?.(e.target.value),placeholder:`Titre de la specification`,readOnly:r,className:t.t(`w-full bg-transparent text-xl font-bold text-foreground`,`placeholder:text-muted-foreground/50 focus:outline-none`)})}),C?(0,l.jsx)(re,{bundle:C,value:e,onChange:n,readOnly:r,placeholder:i,editorClassName:c,minHeight:u,extraPlugins:b,editorRef:O}):(0,l.jsx)(`div`,{className:`relative`,style:{minHeight:u},children:(0,l.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-background/50`,children:(0,l.jsx)(`span`,{className:`text-sm text-muted-foreground animate-pulse`,children:T?`Erreur de chargement`:`Chargement de l'editeur...`})})})]})]}),p&&(0,l.jsx)(`p`,{className:`text-sm text-destructive`,children:p})]})});ne.displayName=`WakaSpecEditor`;function re({bundle:{Plate:e,PlateContent:n,usePlateEditor:r,plugins:i},value:a,onChange:o,readOnly:c,placeholder:u,editorClassName:d,minHeight:f,extraPlugins:p,editorRef:m}){let h=r({plugins:s.useMemo(()=>[...i,...p??[]],[i,p]),value:a??[{type:`p`,children:[{text:``}]}]});return s.useEffect(()=>{m&&(m.current=h)},[h,m]),(0,l.jsx)(e,{editor:h,onChange:o?({value:e})=>o(e):void 0,readOnly:c,children:(0,l.jsx)(`div`,{style:{minHeight:f},children:(0,l.jsx)(n,{placeholder:u,readOnly:c,className:t.t(`prose prose-sm max-w-none px-6 py-4`,`focus-within:outline-none`,`[&_[data-slate-editor]]:outline-none [&_[data-slate-editor]]:min-h-[inherit]`,d)})})})}t.n();var ie=s.forwardRef(({value:e,onChange:n,readOnly:r=!1,placeholder:i=`Glissez-deposez les blocs pour les reorganiser...`,className:o,editorClassName:c,minHeight:u=300,label:d,description:f,error:p,showDragHandles:m=!0,extraPlugins:h,editorRef:g},_)=>{let[v,y]=s.useState(null),[b,x]=s.useState(!1);return s.useEffect(()=>{let e=!1;return(async()=>{try{let[t,n,r,i,a,o,s,c]=await Promise.all([import(`platejs/react`),import(`@platejs/basic-nodes/react`),import(`@platejs/table/react`),import(`@platejs/layout/react`),import(`@platejs/callout/react`),import(`@platejs/link/react`),import(`@platejs/dnd/react`),import(`@platejs/selection/react`)]),l=[n.BoldPlugin,n.ItalicPlugin,n.UnderlinePlugin,n.StrikethroughPlugin,n.CodePlugin,n.HighlightPlugin,n.H1Plugin,n.H2Plugin,n.H3Plugin,n.H4Plugin,n.BlockquotePlugin,r.TablePlugin,r.TableRowPlugin,r.TableCellPlugin,r.TableCellHeaderPlugin,i.ColumnPlugin,i.ColumnItemPlugin,a.CalloutPlugin,o.LinkPlugin.configure({options:{allowedSchemes:[`http`,`https`,`mailto`,`tel`]}}),c.BlockSelectionPlugin,s.DndPlugin.configure({options:{enableScroller:!0}})];e||y({Plate:t.Plate,PlateContent:t.PlateContent,usePlateEditor:t.usePlateEditor,plugins:l})}catch(t){console.error(`[WakaDnDEditor] Failed to load:`,t),e||x(!0)}})(),()=>{e=!0}},[]),v?(0,l.jsx)(ae,{ref:_,bundle:v,value:e,onChange:n,readOnly:r,placeholder:i,className:o,editorClassName:c,minHeight:u,label:d,description:f,error:p,showDragHandles:m,extraPlugins:h,editorRef:g}):(0,l.jsxs)(`div`,{ref:_,className:t.t(`space-y-1.5`,o),children:[d&&(0,l.jsx)(a.n,{children:d}),f&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f}),(0,l.jsxs)(`div`,{className:`relative`,children:[(0,l.jsx)(a.t,{placeholder:i,disabled:!0,style:{minHeight:u}}),(0,l.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-background/50 rounded-lg`,children:(0,l.jsx)(`span`,{className:`text-sm text-muted-foreground animate-pulse`,children:b?`Erreur de chargement`:`Chargement...`})})]}),p&&(0,l.jsx)(`p`,{className:`text-sm text-destructive`,children:p})]})});ie.displayName=`WakaDnDEditor`;var ae=s.forwardRef(({bundle:{Plate:e,PlateContent:n,usePlateEditor:r,plugins:i},value:o,onChange:c,readOnly:u,placeholder:d,className:f,editorClassName:p,minHeight:m,label:h,description:g,error:_,showDragHandles:v,extraPlugins:y,editorRef:b},x)=>{let S=r({plugins:s.useMemo(()=>[...i,...y??[]],[i,y]),value:o??[{type:`p`,children:[{text:``}]}]});return s.useEffect(()=>{b&&(b.current=S)},[S,b]),(0,l.jsxs)(`div`,{ref:x,className:t.t(`space-y-1.5`,f),children:[h&&(0,l.jsx)(a.n,{children:h}),g&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:g}),(0,l.jsx)(e,{editor:S,onChange:c?({value:e})=>c(e):void 0,readOnly:u,children:(0,l.jsxs)(`div`,{className:t.t(`border rounded-lg overflow-hidden`,_&&`border-destructive`),children:[!u&&v&&(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b bg-muted/30 text-xs text-muted-foreground`,children:[(0,l.jsx)(`span`,{className:`inline-block w-4 text-center`,children:`☰`}),(0,l.jsx)(`span`,{children:`Survolez un bloc pour voir la poignee de glissement`})]}),(0,l.jsx)(`div`,{style:{minHeight:m},children:(0,l.jsx)(n,{placeholder:d,readOnly:u,className:t.t(`prose prose-sm max-w-none p-4`,`focus-within:outline-none`,`[&_[data-slate-editor]]:outline-none [&_[data-slate-editor]]:min-h-[inherit]`,v&&`[&_[data-slate-node='element']]:relative [&_[data-slate-node='element']]:pl-6`,p)})})]})}),_&&(0,l.jsx)(`p`,{className:`text-sm text-destructive`,children:_})]})});ae.displayName=`DnDEditorInner`,t.n();var oe=s.forwardRef(({value:e,onChange:n,readOnly:r=!1,placeholder:i=`Editez ensemble en temps reel...`,className:o,editorClassName:c,minHeight:u=400,label:d,description:f,error:p,documentId:m,currentUser:h,providers:g,maxParticipants:_=10,onUsersChange:v,showUsersBar:y=!0,extraPlugins:b,editorRef:x},S)=>{let[C,w]=s.useState(null),[T,E]=s.useState(!1),[D,O]=s.useState([h]),k=s.useRef({documentId:m,currentUser:h,providers:g,maxParticipants:_});return k.current={documentId:m,currentUser:h,providers:g,maxParticipants:_},s.useEffect(()=>{let e=!1;return(async()=>{try{let t=k.current,[n,r,i,a,o,s,c]=await Promise.all([import(`platejs/react`),import(`@platejs/basic-nodes/react`),import(`@platejs/table/react`),import(`@platejs/layout/react`),import(`@platejs/callout/react`),import(`@platejs/link/react`),import(`@platejs/yjs/react`)]),l=[r.BoldPlugin,r.ItalicPlugin,r.UnderlinePlugin,r.StrikethroughPlugin,r.CodePlugin,r.HighlightPlugin,r.H1Plugin,r.H2Plugin,r.H3Plugin,r.H4Plugin,r.BlockquotePlugin,i.TablePlugin,i.TableRowPlugin,i.TableCellPlugin,i.TableCellHeaderPlugin,a.ColumnPlugin,a.ColumnItemPlugin,o.CalloutPlugin,s.LinkPlugin.configure({options:{allowedSchemes:[`http`,`https`,`mailto`,`tel`]}})],u=t.providers.map(e=>e.type===`hocuspocus`?{type:`hocuspocus`,options:{name:e.roomName,url:e.url,...e.options}}:{type:`webrtc`,options:{roomName:e.roomName,maxConns:t.maxParticipants-1,signaling:[e.url],...e.options}});l.push(c.YjsPlugin.configure({options:{cursors:{data:{name:t.currentUser.name,color:t.currentUser.color}},providers:u}})),e||w({Plate:n.Plate,PlateContent:n.PlateContent,usePlateEditor:n.usePlateEditor,YjsPlugin:c.YjsPlugin,plugins:l})}catch(t){console.error(`[WakaCollaborativeEditor] Failed to load:`,t),e||E(!0)}})(),()=>{e=!0}},[]),s.useEffect(()=>{v?.(D)},[D,v]),C?(0,l.jsx)(se,{ref:S,bundle:C,value:e,onChange:n,readOnly:r,placeholder:i,className:o,editorClassName:c,minHeight:u,label:d,description:f,error:p,documentId:m,currentUser:h,showUsersBar:y,connectedUsers:D,setConnectedUsers:O,extraPlugins:b,editorRef:x}):(0,l.jsxs)(`div`,{ref:S,className:t.t(`space-y-1.5`,o),children:[d&&(0,l.jsx)(a.n,{children:d}),f&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f}),(0,l.jsxs)(`div`,{className:`relative`,children:[(0,l.jsx)(a.t,{placeholder:i,disabled:!0,style:{minHeight:u}}),(0,l.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-background/50 rounded-lg`,children:(0,l.jsx)(`span`,{className:`text-sm text-muted-foreground animate-pulse`,children:T?`Erreur de chargement (@platejs/yjs requis)`:`Connexion a la session collaborative...`})})]}),p&&(0,l.jsx)(`p`,{className:`text-sm text-destructive`,children:p})]})});oe.displayName=`WakaCollaborativeEditor`;var se=s.forwardRef(({bundle:{Plate:e,PlateContent:i,usePlateEditor:o,YjsPlugin:c,plugins:u},value:d,onChange:f,readOnly:p,placeholder:m,className:h,editorClassName:g,minHeight:_,label:v,description:y,error:b,documentId:x,showUsersBar:S,connectedUsers:C,extraPlugins:w,editorRef:T},E)=>{let D=o({plugins:s.useMemo(()=>[...u,...w??[]],[u,w]),skipInitialization:!0},[x]);return s.useEffect(()=>{try{D.getApi(c).yjs.init({id:x,autoSelect:`end`,value:d??[{type:`p`,children:[{text:``}]}]})}catch{}return()=>{try{D.getApi(c).yjs.destroy()}catch{}}},[D,x,c,d]),s.useEffect(()=>{T&&(T.current=D)},[D,T]),(0,l.jsxs)(`div`,{ref:E,className:t.t(`space-y-1.5`,h),children:[v&&(0,l.jsx)(a.n,{children:v}),y&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:y}),(0,l.jsx)(e,{editor:D,onChange:f?({value:e})=>f(e):void 0,readOnly:p,children:(0,l.jsxs)(`div`,{className:t.t(`border rounded-lg overflow-hidden`,b&&`border-destructive`),children:[S&&(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b bg-muted/30`,children:[(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`En ligne :`}),(0,l.jsx)(`div`,{className:`flex items-center -space-x-1.5`,children:C.map(e=>(0,l.jsx)(n.m,{className:`h-6 w-6 border-2 border-background`,children:(0,l.jsx)(n.h,{className:`text-[10px] text-white font-bold`,style:{backgroundColor:e.color},children:e.name.slice(0,2).toUpperCase()})},e.id))}),(0,l.jsxs)(r.t,{variant:`secondary`,className:`text-[10px] h-5`,children:[C.length,` connecte`,C.length>1?`s`:``]})]}),(0,l.jsx)(`div`,{style:{minHeight:_},children:(0,l.jsx)(i,{placeholder:m,readOnly:p,className:t.t(`prose prose-sm max-w-none p-4`,`focus-within:outline-none`,`[&_[data-slate-editor]]:outline-none [&_[data-slate-editor]]:min-h-[inherit]`,g)})})]})}),b&&(0,l.jsx)(`p`,{className:`text-sm text-destructive`,children:b})]})});se.displayName=`CollabEditorInner`,t.n();var ce=s.forwardRef(({original:e,modified:n,mode:i=`inline`,label:o,description:c,className:u,editorClassName:d,minHeight:f=200,showStats:p=!0,originalLabel:m=`Original`,modifiedLabel:h=`Modifie`,onDiffComputed:g},_)=>{let[v,y]=s.useState(null),[b,x]=s.useState({added:0,removed:0,modified:0,unchanged:0}),[S,C]=s.useState(!1);return s.useEffect(()=>{let t=!1;return(async()=>{try{let r=await import(`@platejs/diff`);if(r.computeDiff){let i=r.computeDiff(e,n);if(!t){y(i);let e={added:0,removed:0,modified:0,unchanged:0};if(Array.isArray(i))for(let t of i)t.diff===`insert`||t.diffOperation?.type===`insert`?e.added++:t.diff===`delete`||t.diffOperation?.type===`delete`?e.removed++:t.diff===`update`||t.diffOperation?.type===`update`?e.modified++:e.unchanged++;x(e),g?.(e)}}}catch(e){console.error(`[WakaDiffViewer] Failed to compute diff:`,e),t||C(!0)}})(),()=>{t=!0}},[e,n,g]),S||!v?(0,l.jsxs)(`div`,{ref:_,className:t.t(`space-y-1.5`,u),children:[o&&(0,l.jsx)(a.n,{children:o}),c&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:c}),S?(0,l.jsx)(de,{original:e,modified:n,mode:i,originalLabel:m,modifiedLabel:h,minHeight:f,editorClassName:d}):(0,l.jsx)(`div`,{className:`flex items-center justify-center border rounded-lg bg-muted/30`,style:{minHeight:f},children:(0,l.jsx)(`span`,{className:`text-sm text-muted-foreground animate-pulse`,children:`Calcul des differences...`})})]}):(0,l.jsxs)(`div`,{ref:_,className:t.t(`space-y-1.5`,u),children:[o&&(0,l.jsx)(a.n,{children:o}),c&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:c}),(0,l.jsxs)(`div`,{className:t.t(`border rounded-lg overflow-hidden`),children:[p&&(0,l.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-2 border-b bg-muted/30`,children:[(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground font-medium`,children:`Differences :`}),b.added>0&&(0,l.jsxs)(r.t,{variant:`secondary`,className:`bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300 text-[10px] h-5`,children:[`+`,b.added,` ajout`,b.added>1?`s`:``]}),b.removed>0&&(0,l.jsxs)(r.t,{variant:`secondary`,className:`bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300 text-[10px] h-5`,children:[`-`,b.removed,` suppression`,b.removed>1?`s`:``]}),b.modified>0&&(0,l.jsxs)(r.t,{variant:`secondary`,className:`bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-300 text-[10px] h-5`,children:[`~`,b.modified,` modification`,b.modified>1?`s`:``]}),b.added===0&&b.removed===0&&b.modified===0&&(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Aucune difference`})]}),i===`side-by-side`?(0,l.jsxs)(`div`,{className:`flex divide-x`,style:{minHeight:f},children:[(0,l.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,l.jsx)(`div`,{className:`px-3 py-1.5 border-b bg-red-50/50 dark:bg-red-950/10 text-xs font-medium text-muted-foreground`,children:m}),(0,l.jsx)(P,{nodes:e,diffType:`original`,className:d})]}),(0,l.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,l.jsx)(`div`,{className:`px-3 py-1.5 border-b bg-green-50/50 dark:bg-green-950/10 text-xs font-medium text-muted-foreground`,children:h}),(0,l.jsx)(P,{nodes:n,diffType:`modified`,className:d})]})]}):(0,l.jsx)(`div`,{style:{minHeight:f},children:(0,l.jsx)(le,{diffNodes:v,className:d})})]})]})});ce.displayName=`WakaDiffViewer`;function P({nodes:e,diffType:n,className:r}){return(0,l.jsx)(`div`,{className:t.t(`prose prose-sm max-w-none p-4 text-sm`,r),children:e.map((e,t)=>(0,l.jsx)(ue,{node:e,diffType:n},t))})}function le({diffNodes:e,className:n}){return(0,l.jsx)(`div`,{className:t.t(`prose prose-sm max-w-none p-4 text-sm`,n),children:e.map((e,n)=>{let r=e.diff||e.diffOperation?.type,i=``;return r===`insert`?i=`bg-green-100/60 dark:bg-green-900/20`:r===`delete`?i=`bg-red-100/60 dark:bg-red-900/20 line-through opacity-60`:r===`update`&&(i=`bg-amber-100/60 dark:bg-amber-900/20`),(0,l.jsx)(`div`,{className:t.t(`rounded px-1 -mx-1`,i),children:(0,l.jsx)(ue,{node:e,diffType:`modified`})},n)})})}function ue({node:e,diffType:t}){if(!e)return null;let n=fe(e);switch(e.type||`p`){case`h1`:return(0,l.jsx)(`h1`,{className:`text-xl font-bold mt-4 mb-1`,children:n});case`h2`:return(0,l.jsx)(`h2`,{className:`text-lg font-semibold mt-3 mb-1`,children:n});case`h3`:return(0,l.jsx)(`h3`,{className:`text-base font-semibold mt-2 mb-1`,children:n});case`blockquote`:return(0,l.jsx)(`blockquote`,{className:`border-l-2 border-muted-foreground/30 pl-3 italic text-muted-foreground`,children:n});default:return(0,l.jsx)(`p`,{className:`my-0.5 leading-relaxed`,children:n||`\xA0`})}}function de({original:e,modified:t,mode:n,originalLabel:r,modifiedLabel:i,minHeight:a,editorClassName:o}){return n===`side-by-side`?(0,l.jsxs)(`div`,{className:`flex divide-x border rounded-lg overflow-hidden`,style:{minHeight:a},children:[(0,l.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,l.jsx)(`div`,{className:`px-3 py-1.5 border-b bg-red-50/50 dark:bg-red-950/10 text-xs font-medium text-muted-foreground`,children:r}),(0,l.jsx)(P,{nodes:e,diffType:`original`,className:o})]}),(0,l.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,l.jsx)(`div`,{className:`px-3 py-1.5 border-b bg-green-50/50 dark:bg-green-950/10 text-xs font-medium text-muted-foreground`,children:i}),(0,l.jsx)(P,{nodes:t,diffType:`modified`,className:o})]})]}):(0,l.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,style:{minHeight:a},children:(0,l.jsxs)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:[`Installez `,(0,l.jsx)(`code`,{className:`bg-muted px-1 rounded`,children:`@platejs/diff`}),` pour la visualisation unifiee des differences.`]})})}function fe(e){return typeof e?.text==`string`?e.text:Array.isArray(e?.children)?e.children.map(e=>fe(e)).join(``):``}t.n();var pe=s.forwardRef(({value:e,onChange:n,readOnly:r=!1,placeholder:i=`Tapez @ pour mentionner un utilisateur...`,className:o,editorClassName:c,minHeight:u=200,label:d,description:f,error:p,onSearch:m,onMentionInserted:h,trigger:g=`@`,searchDebounceMs:_=300,maxResults:v=8,extraPlugins:y,editorRef:b},x)=>{let[S,C]=s.useState(null),[w,T]=s.useState(!1),[E,D]=s.useState([]),[O,k]=s.useState(!1),A=s.useRef(),j=s.useRef({onSearch:m,trigger:g,searchDebounceMs:_,maxResults:v,onMentionInserted:h});j.current={onSearch:m,trigger:g,searchDebounceMs:_,maxResults:v,onMentionInserted:h},s.useEffect(()=>{let e=!1;return(async()=>{try{let t=j.current,[n,r,i,a,o,s,c]=await Promise.all([import(`platejs/react`),import(`@platejs/basic-nodes/react`),import(`@platejs/table/react`),import(`@platejs/layout/react`),import(`@platejs/callout/react`),import(`@platejs/link/react`),import(`@platejs/mention/react`)]),l=[r.BoldPlugin,r.ItalicPlugin,r.UnderlinePlugin,r.StrikethroughPlugin,r.CodePlugin,r.HighlightPlugin,r.H1Plugin,r.H2Plugin,r.H3Plugin,r.H4Plugin,r.BlockquotePlugin,i.TablePlugin,i.TableRowPlugin,i.TableCellPlugin,i.TableCellHeaderPlugin,a.ColumnPlugin,a.ColumnItemPlugin,o.CalloutPlugin,s.LinkPlugin.configure({options:{allowedSchemes:[`http`,`https`,`mailto`,`tel`]}}),c.MentionPlugin.configure({options:{trigger:t.trigger,triggerPreviousCharPattern:/^$|^[\s"']$/,insertSpaceAfterMention:!0}}),c.MentionInputPlugin];e||C({Plate:n.Plate,PlateContent:n.PlateContent,usePlateEditor:n.usePlateEditor,plugins:l})}catch(t){console.error(`[WakaMentionEditor] Failed to load:`,t),e||T(!0)}})(),()=>{e=!0}},[]);let M=s.useCallback(e=>{if(A.current&&clearTimeout(A.current),!e.trim()){D([]),k(!1);return}k(!0),A.current=setTimeout(async()=>{try{let t=j.current;D((await t.onSearch(e)).slice(0,t.maxResults))}catch{D([])}finally{k(!1)}},j.current.searchDebounceMs)},[]);return S?(0,l.jsx)(me,{ref:x,bundle:S,value:e,onChange:n,readOnly:r,placeholder:i,className:o,editorClassName:c,minHeight:u,label:d,description:f,error:p,suggestions:E,searching:O,onSearch:M,onMentionInserted:h,extraPlugins:y,editorRef:b}):(0,l.jsxs)(`div`,{ref:x,className:t.t(`space-y-1.5`,o),children:[d&&(0,l.jsx)(a.n,{children:d}),f&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f}),(0,l.jsxs)(`div`,{className:`relative`,children:[(0,l.jsx)(a.t,{placeholder:i,disabled:!0,style:{minHeight:u}}),(0,l.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-background/50 rounded-lg`,children:(0,l.jsx)(`span`,{className:`text-sm text-muted-foreground animate-pulse`,children:w?`Erreur (@platejs/mention requis)`:`Chargement...`})})]}),p&&(0,l.jsx)(`p`,{className:`text-sm text-destructive`,children:p})]})});pe.displayName=`WakaMentionEditor`;var me=s.forwardRef(({bundle:{Plate:e,PlateContent:n,usePlateEditor:r,plugins:i},value:o,onChange:c,readOnly:u,placeholder:d,className:f,editorClassName:p,minHeight:m,label:h,description:g,error:_,suggestions:v,searching:y,extraPlugins:b,editorRef:x},S)=>{let C=r({plugins:s.useMemo(()=>[...i,...b??[]],[i,b]),value:o??[{type:`p`,children:[{text:``}]}]});return s.useEffect(()=>{x&&(x.current=C)},[C,x]),(0,l.jsxs)(`div`,{ref:S,className:t.t(`space-y-1.5`,f),children:[h&&(0,l.jsx)(a.n,{children:h}),g&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:g}),(0,l.jsx)(e,{editor:C,onChange:c?({value:e})=>c(e):void 0,readOnly:u,children:(0,l.jsxs)(`div`,{className:t.t(`border rounded-lg overflow-hidden relative`,_&&`border-destructive`),children:[(0,l.jsx)(`div`,{style:{minHeight:m},children:(0,l.jsx)(n,{placeholder:d,readOnly:u,className:t.t(`prose prose-sm max-w-none p-4`,`focus-within:outline-none`,`[&_[data-slate-editor]]:outline-none [&_[data-slate-editor]]:min-h-[inherit]`,p)})}),v.length>0&&(0,l.jsx)(he,{suggestions:v,searching:y})]})}),_&&(0,l.jsx)(`p`,{className:`text-sm text-destructive`,children:_})]})});me.displayName=`MentionEditorInner`;function he({suggestions:e,searching:r,className:i,onSelect:a}){return(0,l.jsxs)(`div`,{className:t.t(`absolute z-50 w-64 max-h-60 overflow-y-auto`,`rounded-lg border bg-popover shadow-lg`,`p-1 mt-1`,i),children:[r&&(0,l.jsx)(`div`,{className:`px-2 py-1.5 text-xs text-muted-foreground animate-pulse`,children:`Recherche...`}),e.map(e=>(0,l.jsxs)(`button`,{type:`button`,className:t.t(`flex w-full items-center gap-2.5 rounded-md px-2 py-1.5 text-left`,`text-sm transition-colors cursor-pointer`,`hover:bg-accent/50`),onClick:()=>a?.(e),children:[(0,l.jsxs)(n.m,{className:`h-6 w-6`,children:[e.avatar&&(0,l.jsx)(n.g,{src:e.avatar,alt:e.name}),(0,l.jsx)(n.h,{className:`text-[10px] bg-primary/10 text-primary`,children:e.name.slice(0,2).toUpperCase()})]}),(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`font-medium truncate`,children:e.name}),e.email&&(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground truncate`,children:e.email})]}),e.role&&(0,l.jsx)(`span`,{className:`text-[10px] text-muted-foreground shrink-0`,children:e.role})]},e.id))]})}he.displayName=`MentionSuggestions`,t.n();function ge({children:e,attributes:n,className:r}){return(0,l.jsx)(`table`,{...n,className:t.t(`w-full border-collapse text-sm my-4`,`border border-border rounded-lg overflow-hidden`,r),children:(0,l.jsx)(`tbody`,{children:e})})}ge.displayName=`TableElement`;function _e({children:e,attributes:n,className:r}){return(0,l.jsx)(`tr`,{...n,className:t.t(`border-b border-border last:border-b-0`,r),children:e})}_e.displayName=`TableRowElement`;function ve({children:e,attributes:n,className:r}){return(0,l.jsx)(`td`,{...n,className:t.t(`px-3 py-2 text-sm text-foreground`,`border-r border-border last:border-r-0`,r),children:e})}ve.displayName=`TableCellElement`;function ye({children:e,attributes:n,className:r}){return(0,l.jsx)(`th`,{...n,className:t.t(`px-3 py-2 text-xs font-bold uppercase tracking-wider`,`text-muted-foreground text-left bg-muted/50`,`border-r border-border last:border-r-0`,r),children:e})}ye.displayName=`TableCellHeaderElement`;function be({children:e,attributes:n,className:r}){return(0,l.jsx)(`div`,{...n,className:t.t(`flex gap-6 my-4`,r),children:e})}be.displayName=`ColumnGroupElement`;function xe({children:e,attributes:n,className:r}){return(0,l.jsx)(`div`,{...n,className:t.t(`flex-1 min-w-0`,r),children:e})}xe.displayName=`ColumnElement`;var Se={info:`bg-blue-50 border-blue-200 text-blue-900 dark:bg-blue-950/30 dark:border-blue-800 dark:text-blue-200`,warning:`bg-amber-50 border-amber-200 text-amber-900 dark:bg-amber-950/30 dark:border-amber-800 dark:text-amber-200`,success:`bg-green-50 border-green-200 text-green-900 dark:bg-green-950/30 dark:border-green-800 dark:text-green-200`,error:`bg-red-50 border-red-200 text-red-900 dark:bg-red-950/30 dark:border-red-800 dark:text-red-200`,dark:`bg-card border-border text-card-foreground`};function Ce({children:e,attributes:n,element:r,className:i}){let a=Se[r?.variant||`info`]??Se.info;return(0,l.jsx)(`div`,{...n,className:t.t(`border rounded-xl p-4 my-3`,a,i),children:e})}Ce.displayName=`CalloutElement`;function we({children:e,attributes:n,className:r}){return(0,l.jsx)(`h1`,{...n,className:t.t(`text-2xl font-extrabold text-foreground mt-8 mb-2 first:mt-0`,r),children:e})}we.displayName=`H1Element`;function Te({children:e,attributes:n,className:r}){return(0,l.jsx)(`h2`,{...n,className:t.t(`text-sm font-bold text-foreground uppercase tracking-wider`,`mt-6 mb-3 border-b-2 border-border pb-1.5`,r),children:e})}Te.displayName=`H2Element`;function Ee({children:e,attributes:n,className:r}){return(0,l.jsx)(`h3`,{...n,className:t.t(`text-sm font-semibold text-primary italic mt-1 mb-4`,r),children:e})}Ee.displayName=`H3Element`;function De({children:e,attributes:n,className:r}){return(0,l.jsx)(`h4`,{...n,className:t.t(`text-xs font-bold text-primary uppercase tracking-wide mt-2 mb-0.5`,r),children:e})}De.displayName=`H4Element`;function Oe({children:e,attributes:n,className:r}){return(0,l.jsx)(`h5`,{...n,className:t.t(`text-xs font-semibold text-muted-foreground mt-2 mb-0.5`,r),children:e})}Oe.displayName=`H5Element`;function ke({children:e,attributes:n,className:r}){return(0,l.jsx)(`h6`,{...n,className:t.t(`text-xs font-medium text-muted-foreground mt-2 mb-0.5`,r),children:e})}ke.displayName=`H6Element`;function Ae({children:e,attributes:n,className:r}){return(0,l.jsx)(`blockquote`,{...n,className:t.t(`border-l-3 border-primary/50 pl-4 py-2`,`bg-muted/30 rounded-r-lg`,`italic text-muted-foreground`,`my-3`,r),children:e})}Ae.displayName=`BlockquoteElement`;function je({children:e,attributes:n,className:r}){return(0,l.jsx)(`p`,{...n,className:t.t(`text-sm leading-relaxed text-foreground my-0.5`,r),children:e})}je.displayName=`ParagraphElement`;function Me({children:e,attributes:n,element:r,className:i}){return(0,l.jsx)(`a`,{...n,href:r?.url,target:`_blank`,rel:`noopener noreferrer`,className:t.t(`text-primary underline decoration-primary/30 hover:decoration-primary`,`transition-colors cursor-pointer`,i),children:e})}Me.displayName=`LinkElement`;function Ne({children:e,attributes:n,element:r,className:i}){return(0,l.jsxs)(`span`,{...n,contentEditable:!1,className:t.t(`inline-flex items-center rounded-md px-1.5 py-0.5`,`bg-primary/10 text-primary text-sm font-medium`,`border border-primary/20`,i),children:[`@`,r?.value||`unknown`,e]})}Ne.displayName=`MentionElement`;function Pe({attributes:e,className:n}){return(0,l.jsx)(`div`,{...e,className:t.t(`my-6`,n),children:(0,l.jsx)(`hr`,{className:`border-border`})})}Pe.displayName=`SeparatorElement`,t.n();function Fe({children:e,attributes:n,className:r}){return(0,l.jsx)(`strong`,{...n,className:t.t(`font-bold`,r),children:e})}Fe.displayName=`BoldLeaf`;function Ie({children:e,attributes:n,className:r}){return(0,l.jsx)(`em`,{...n,className:t.t(`italic`,r),children:e})}Ie.displayName=`ItalicLeaf`;function Le({children:e,attributes:n,className:r}){return(0,l.jsx)(`span`,{...n,className:t.t(`underline decoration-foreground/50`,r),children:e})}Le.displayName=`UnderlineLeaf`;function Re({children:e,attributes:n,className:r}){return(0,l.jsx)(`s`,{...n,className:t.t(`line-through text-muted-foreground`,r),children:e})}Re.displayName=`StrikethroughLeaf`;function ze({children:e,attributes:n,className:r}){return(0,l.jsx)(`code`,{...n,className:t.t(`rounded-md bg-muted px-1.5 py-0.5`,`font-mono text-[0.85em] text-foreground`,r),children:e})}ze.displayName=`CodeLeaf`;function Be({children:e,attributes:n,className:r}){return(0,l.jsx)(`mark`,{...n,className:t.t(`bg-yellow-200/60 dark:bg-yellow-500/30`,`rounded-sm px-0.5`,r),children:e})}Be.displayName=`HighlightLeaf`;function Ve({children:e,attributes:n,className:r}){return(0,l.jsx)(`sup`,{...n,className:t.t(`text-[0.75em]`,r),children:e})}Ve.displayName=`SuperscriptLeaf`;function He({children:e,attributes:n,className:r}){return(0,l.jsx)(`sub`,{...n,className:t.t(`text-[0.75em]`,r),children:e})}He.displayName=`SubscriptLeaf`;var Ue=e.r({USER_STORY_BLOCK_TYPE:()=>I,WakaUserStoryBlock:()=>F,createUserStoryNodes:()=>Ge,createUserStoryPlugin:()=>Ke});function We({label:e,icon:n,value:r,placeholder:i,readOnly:a,onChange:o}){return(0,l.jsxs)(`div`,{className:`flex items-start gap-3 group`,children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-1.5 pt-1 shrink-0 w-[90px]`,children:[(0,l.jsx)(`span`,{className:`text-blue-500 dark:text-blue-400`,children:n}),(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-wider text-blue-600 dark:text-blue-400`,children:e})]}),(0,l.jsx)(`div`,{className:`flex-1 min-w-0`,children:a?(0,l.jsx)(`p`,{className:`text-sm text-foreground py-1`,children:r||(0,l.jsx)(`span`,{className:`text-muted-foreground italic`,children:i})}):(0,l.jsx)(`input`,{type:`text`,value:r,onChange:e=>o?.(e.target.value),placeholder:i,className:t.t(`w-full bg-transparent text-sm text-foreground py-1 px-0`,`border-0 border-b border-transparent`,`focus:border-blue-300 dark:focus:border-blue-600`,`focus:outline-none transition-colors`,`placeholder:text-muted-foreground/50 placeholder:italic`)})})]})}function F({attributes:e,children:n,element:r,className:i}){let a=r,o=a?.priority,s=a?.storyId,c=a?.points;return(0,l.jsxs)(`div`,{...e,contentEditable:!1,className:t.t(`relative my-4 rounded-lg overflow-hidden`,`border-l-4 border-blue-500 dark:border-blue-400`,`bg-blue-50/50 dark:bg-blue-950/20`,`border border-blue-200/60 dark:border-blue-800/40`,`shadow-sm hover:shadow-md transition-shadow duration-200`,i),children:[(0,l.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 bg-blue-100/50 dark:bg-blue-900/20 border-b border-blue-200/40 dark:border-blue-800/30`,children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,l.jsx)(`svg`,{className:`h-4 w-4 text-blue-600 dark:text-blue-400`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:(0,l.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z`})}),(0,l.jsx)(`span`,{className:`text-xs font-bold uppercase tracking-wider text-blue-700 dark:text-blue-300`,children:`User Story`}),s&&(0,l.jsx)(`span`,{className:`text-[10px] font-mono font-semibold text-blue-500 dark:text-blue-400 bg-blue-100 dark:bg-blue-800/40 px-1.5 py-0.5 rounded`,children:s})]}),(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c!==void 0&&(0,l.jsx)(`span`,{className:`inline-flex items-center justify-center h-5 min-w-[20px] px-1 rounded-full bg-blue-200 dark:bg-blue-700/50 text-[10px] font-bold text-blue-800 dark:text-blue-200`,children:c}),o&&L[o]&&(0,l.jsx)(`span`,{className:t.t(`text-[10px] font-semibold px-2 py-0.5 rounded-full`,L[o].bg,L[o].color),children:L[o].label})]})]}),(0,l.jsxs)(`div`,{className:`px-4 py-3 space-y-2`,children:[(0,l.jsx)(We,{label:`As a`,icon:(0,l.jsx)(`svg`,{className:`h-3 w-3`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,children:(0,l.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z`})}),value:a?.role||``,placeholder:`role (e.g. platform administrator)`,readOnly:!0}),(0,l.jsx)(We,{label:`I want`,icon:(0,l.jsx)(`svg`,{className:`h-3 w-3`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,children:(0,l.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M13 10V3L4 14h7v7l9-11h-7z`})}),value:a?.action||``,placeholder:`action (e.g. to deploy services with one click)`,readOnly:!0}),(0,l.jsx)(We,{label:`So that`,icon:(0,l.jsx)(`svg`,{className:`h-3 w-3`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,children:(0,l.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z`})}),value:a?.benefit||``,placeholder:`benefit (e.g. I can reduce time-to-market)`,readOnly:!0})]}),(0,l.jsx)(`div`,{className:`hidden`,children:n})]})}function Ge(e){return[{type:I,role:e?.role||``,action:e?.action||``,benefit:e?.benefit||``,storyId:e?.storyId,priority:e?.priority,points:e?.points,children:[{text:``}]}]}async function Ke(){try{let{createPlatePlugin:e}=await import(`platejs/react`);return e({key:I,node:{isElement:!0,isVoid:!0,type:I,component:F}})}catch{return console.warn(`[WakaUserStoryBlock] platejs not installed`),null}}var I,L,qe=e.n((()=>{t.n(),I=`user_story`,L={must:{label:`Must Have`,color:`text-red-700 dark:text-red-400`,bg:`bg-red-50 dark:bg-red-500/10`},should:{label:`Should Have`,color:`text-amber-700 dark:text-amber-400`,bg:`bg-amber-50 dark:bg-amber-500/10`},could:{label:`Could Have`,color:`text-blue-700 dark:text-blue-400`,bg:`bg-blue-50 dark:bg-blue-500/10`},wont:{label:`Won't Have`,color:`text-gray-500 dark:text-gray-400`,bg:`bg-gray-50 dark:bg-gray-500/10`}},F.displayName=`WakaUserStoryBlock`})),Je=e.r({ACCEPTANCE_CRITERIA_BLOCK_TYPE:()=>z,WakaAcceptanceCriteriaBlock:()=>R,createAcceptanceCriteriaNodes:()=>Ze,createAcceptanceCriteriaPlugin:()=>Qe});function Ye({keyword:e,variant:n}){return(0,l.jsx)(`span`,{className:t.t(`inline-block text-[10px] font-bold uppercase tracking-wider px-1.5 py-0.5 rounded shrink-0 w-[52px] text-center`,{given:`bg-violet-100 text-violet-700 dark:bg-violet-500/15 dark:text-violet-400`,when:`bg-amber-100 text-amber-700 dark:bg-amber-500/15 dark:text-amber-400`,then:`bg-emerald-100 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-400`}[n]),children:e})}function Xe({criterion:e,index:n,readOnly:r}){let[i,a]=s.useState(!0);return(0,l.jsxs)(`div`,{className:t.t(`rounded-lg border transition-all duration-200`,e.validated?`border-emerald-200 dark:border-emerald-800/40 bg-emerald-50/30 dark:bg-emerald-950/10`:`border-border bg-card/50`),children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2`,children:[(0,l.jsx)(`button`,{type:`button`,disabled:r,className:t.t(`flex-shrink-0 h-5 w-5 rounded-md border-2 flex items-center justify-center transition-all duration-200`,e.validated?`bg-emerald-500 border-emerald-500 text-white`:`border-border hover:border-emerald-400`,r&&`cursor-default`),"aria-label":e.validated?`Mark as not validated`:`Mark as validated`,"aria-checked":e.validated,role:`checkbox`,children:e.validated&&(0,l.jsx)(`svg`,{className:`h-3 w-3`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:3,children:(0,l.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 13l4 4L19 7`})})}),(0,l.jsx)(`span`,{className:`text-[10px] font-mono font-bold text-muted-foreground bg-muted px-1.5 py-0.5 rounded shrink-0`,children:e.id}),(0,l.jsx)(`span`,{className:t.t(`text-sm font-medium flex-1 min-w-0 truncate`,e.validated&&`line-through text-muted-foreground`),children:e.scenario||`Unnamed scenario`}),(0,l.jsx)(`button`,{type:`button`,onClick:()=>a(!i),className:`text-muted-foreground hover:text-foreground transition-colors p-0.5`,"aria-label":i?`Collapse`:`Expand`,children:(0,l.jsx)(`svg`,{className:t.t(`h-3.5 w-3.5 transition-transform duration-200`,i&&`rotate-180`),viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,children:(0,l.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M19 9l-7 7-7-7`})})})]}),i&&(0,l.jsxs)(`div`,{className:`px-3 pb-3 pt-1 space-y-1.5 border-t border-border/50`,children:[(0,l.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,l.jsx)(Ye,{keyword:`Given`,variant:`given`}),(0,l.jsx)(`span`,{className:`text-sm text-foreground/80 pt-0.5`,children:e.given||(0,l.jsx)(`span`,{className:`italic text-muted-foreground`,children:`precondition...`})})]}),(0,l.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,l.jsx)(Ye,{keyword:`When`,variant:`when`}),(0,l.jsx)(`span`,{className:`text-sm text-foreground/80 pt-0.5`,children:e.when||(0,l.jsx)(`span`,{className:`italic text-muted-foreground`,children:`action...`})})]}),(0,l.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,l.jsx)(Ye,{keyword:`Then`,variant:`then`}),(0,l.jsx)(`span`,{className:`text-sm text-foreground/80 pt-0.5`,children:e.then||(0,l.jsx)(`span`,{className:`italic text-muted-foreground`,children:`expected result...`})})]})]})]})}function R({attributes:e,children:n,element:r,className:i}){let a=r,o=a?.criteria||[],s=a?.title||`Acceptance Criteria`,c=o.filter(e=>e.validated).length,u=o.length,d=u>0?c/u*100:0;return(0,l.jsxs)(`div`,{...e,contentEditable:!1,className:t.t(`my-4 rounded-lg overflow-hidden`,`border border-border`,`bg-card/30`,`shadow-sm`,i),children:[(0,l.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2.5 bg-muted/30 border-b border-border`,children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,l.jsx)(`svg`,{className:`h-4 w-4 text-emerald-600 dark:text-emerald-400`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:(0,l.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4`})}),(0,l.jsx)(`span`,{className:`text-xs font-bold uppercase tracking-wider text-foreground`,children:s})]}),(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,l.jsxs)(`span`,{className:`text-[10px] font-medium text-muted-foreground`,children:[c,`/`,u]}),(0,l.jsx)(`div`,{className:`w-16 h-1.5 bg-muted rounded-full overflow-hidden`,children:(0,l.jsx)(`div`,{className:`h-full bg-emerald-500 rounded-full transition-all duration-500`,style:{width:`${d}%`}})})]})]}),(0,l.jsx)(`div`,{className:`p-3 space-y-2`,children:o.length>0?o.map((e,t)=>(0,l.jsx)(Xe,{criterion:e,index:t,readOnly:!0},e.id)):(0,l.jsx)(`div`,{className:`py-6 text-center text-sm text-muted-foreground italic`,children:`No acceptance criteria defined yet.`})}),(0,l.jsx)(`div`,{className:`hidden`,children:n})]})}function Ze(e){return[{type:z,title:e?.title||`Acceptance Criteria`,criteria:e?.criteria||[{id:`AC-01`,scenario:`Nominal case`,given:`The user is authenticated`,when:`They perform the action`,then:`The expected result is displayed`,validated:!1},{id:`AC-02`,scenario:`Error case`,given:`The service is unavailable`,when:`They perform the action`,then:`An error message is displayed`,validated:!1}],children:[{text:``}]}]}async function Qe(){try{let{createPlatePlugin:e}=await import(`platejs/react`);return e({key:z,node:{isElement:!0,isVoid:!0,type:z,component:R}})}catch{return console.warn(`[WakaAcceptanceCriteriaBlock] platejs not installed`),null}}var z,$e=e.n((()=>{t.n(),z=`acceptance_criteria`,R.displayName=`WakaAcceptanceCriteriaBlock`})),et=e.r({API_ENDPOINT_BLOCK_TYPE:()=>V,WakaApiEndpointBlock:()=>B,createApiEndpointNodes:()=>it,createApiEndpointPlugin:()=>at});function tt({method:e}){let n=H[e]||H.GET;return(0,l.jsx)(`span`,{className:t.t(`inline-flex items-center px-2 py-0.5 rounded text-[11px] font-bold font-mono tracking-wide border`,n.bg,n.text,n.border),children:e})}function nt({status:e}){return(0,l.jsx)(`span`,{className:t.t(`text-[11px] font-mono font-bold px-1.5 py-0.5 rounded`,e<300?`text-emerald-700 dark:text-emerald-400 bg-emerald-50 dark:bg-emerald-500/10`:e<400?`text-blue-700 dark:text-blue-400 bg-blue-50 dark:bg-blue-500/10`:e<500?`text-amber-700 dark:text-amber-400 bg-amber-50 dark:bg-amber-500/10`:`text-red-700 dark:text-red-400 bg-red-50 dark:bg-red-500/10`),children:e})}function rt({code:e,label:n}){let[r,i]=s.useState(!1),a=e.split(`
|
|
28
|
+
{{selection}}`,group:`Traduire`}],D=s.forwardRef(({value:e,onChange:n,aiEndpoint:r,systemPrompt:i=`You are an advanced AI writing assistant. Help the user write, edit, and improve their content.`,aiActions:o=E,enableCopilot:c=!0,copilotDebounceMs:u=500,aiHeaders:d,readOnly:f=!1,placeholder:p=`Tapez / pour les commandes, ou commencez a ecrire...`,className:m,editorClassName:h,minHeight:g=300,label:_,description:v,error:y,extraPlugins:b,editorRef:x},S)=>{let[C,w]=s.useState(null),[T,D]=s.useState(!1),k=s.useRef({aiEndpoint:r,systemPrompt:i,aiActions:o,enableCopilot:c,copilotDebounceMs:u,aiHeaders:d});return k.current={aiEndpoint:r,systemPrompt:i,aiActions:o,enableCopilot:c,copilotDebounceMs:u,aiHeaders:d},s.useEffect(()=>{let e=!1;return(async()=>{try{let[t,n,r,i,a,o,s,c,l,u]=await Promise.all([import(`platejs/react`),import(`@platejs/basic-nodes/react`),import(`@platejs/table/react`),import(`@platejs/layout/react`),import(`@platejs/callout/react`),import(`@platejs/ai/react`),import(`@platejs/markdown`),import(`@platejs/selection/react`),import(`@platejs/link/react`),import(`@platejs/indent/react`)]),d=k.current,f=[n.BoldPlugin,n.ItalicPlugin,n.UnderlinePlugin,n.StrikethroughPlugin,n.CodePlugin,n.HighlightPlugin,n.H1Plugin,n.H2Plugin,n.H3Plugin,n.H4Plugin,n.BlockquotePlugin,r.TablePlugin,r.TableRowPlugin,r.TableCellPlugin,r.TableCellHeaderPlugin,i.ColumnPlugin,i.ColumnItemPlugin,a.CalloutPlugin,l.LinkPlugin.configure({options:{allowedSchemes:[`http`,`https`,`mailto`,`tel`]}}),u.IndentPlugin,c.BlockSelectionPlugin,s.MarkdownPlugin,o.AIPlugin,o.AIChatPlugin.configure({options:{chat:{api:d.aiEndpoint,body:{system:d.systemPrompt},headers:d.aiHeaders}}})];d.enableCopilot&&o.CopilotPlugin&&f.push(o.CopilotPlugin.configure(({api:e})=>({options:{completeOptions:{api:d.aiEndpoint,body:{system:d.systemPrompt},headers:d.aiHeaders,onFinish:(t,n)=>{n!==`0`&&e.copilot.setBlockSuggestion({text:n})}},debounceDelay:d.copilotDebounceMs},shortcuts:{accept:{keys:`tab`},acceptNextWord:{keys:`mod+right`},reject:{keys:`escape`},triggerSuggestion:{keys:`ctrl+space`}}}))),e||w({Plate:t.Plate,PlateContent:t.PlateContent,usePlateEditor:t.usePlateEditor,plugins:f})}catch(t){console.error(`[WakaAIWriter] Failed to load plugins:`,t),e||D(!0)}})(),()=>{e=!0}},[]),C?(0,l.jsx)(O,{ref:S,bundle:C,value:e,onChange:n,readOnly:f,placeholder:p,className:m,editorClassName:h,minHeight:g,label:_,description:v,error:y,extraPlugins:b,editorRef:x}):(0,l.jsxs)(`div`,{ref:S,className:t.t(`space-y-1.5`,m),children:[_&&(0,l.jsx)(a.n,{children:_}),v&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:v}),(0,l.jsxs)(`div`,{className:`relative`,children:[(0,l.jsx)(a.t,{placeholder:p,disabled:!0,style:{minHeight:g},className:t.t(y&&`border-destructive`)}),(0,l.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-background/50 rounded-lg`,children:(0,l.jsx)(`span`,{className:`text-sm text-muted-foreground animate-pulse`,children:T?`Erreur de chargement de l'editeur IA`:`Chargement de l'editeur IA...`})})]}),y&&(0,l.jsx)(`p`,{className:`text-sm text-destructive`,children:y})]})});D.displayName=`WakaAIWriter`;var O=s.forwardRef(({bundle:{Plate:e,PlateContent:n,usePlateEditor:r,plugins:i},value:o,onChange:c,readOnly:u,placeholder:d,className:f,editorClassName:p,minHeight:m,label:h,description:g,error:_,extraPlugins:v,editorRef:y},b)=>{let x=r({plugins:s.useMemo(()=>[...i,...v??[]],[i,v]),value:o??[{type:`p`,children:[{text:``}]}]});return s.useEffect(()=>{y&&(y.current=x)},[x,y]),(0,l.jsxs)(`div`,{ref:b,className:t.t(`space-y-1.5`,f),children:[h&&(0,l.jsx)(a.n,{children:h}),g&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:g}),(0,l.jsx)(e,{editor:x,onChange:c?({value:e})=>c(e):void 0,readOnly:u,children:(0,l.jsxs)(`div`,{className:t.t(`border rounded-lg overflow-hidden`,_&&`border-destructive`,u&&`opacity-80`),children:[!u&&(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b bg-muted/30 text-xs text-muted-foreground`,children:[(0,l.jsx)(`kbd`,{className:`rounded border bg-muted px-1.5 py-0.5 font-mono text-[10px]`,children:`Ctrl+J`}),(0,l.jsx)(`span`,{children:`Ouvrir le menu IA`}),(0,l.jsx)(`span`,{className:`mx-1`,children:`|`}),(0,l.jsx)(`kbd`,{className:`rounded border bg-muted px-1.5 py-0.5 font-mono text-[10px]`,children:`/`}),(0,l.jsx)(`span`,{children:`Commandes`}),(0,l.jsx)(`span`,{className:`mx-1`,children:`|`}),(0,l.jsx)(`kbd`,{className:`rounded border bg-muted px-1.5 py-0.5 font-mono text-[10px]`,children:`Ctrl+Espace`}),(0,l.jsx)(`span`,{children:`Copilot`})]}),(0,l.jsx)(`div`,{style:{minHeight:m},children:(0,l.jsx)(n,{placeholder:d,readOnly:u,className:t.t(`prose prose-sm max-w-none p-4`,`focus-within:outline-none`,`[&_[data-slate-editor]]:outline-none [&_[data-slate-editor]]:min-h-[inherit]`,p)})})]})}),_&&(0,l.jsx)(`p`,{className:`text-sm text-destructive`,children:_})]})});O.displayName=`AIWriterInner`,t.n();var k=s.forwardRef(({value:e,onChange:n,readOnly:r=!1,placeholder:i=`Commencez a rediger votre document...`,className:o,editorClassName:c,minHeight:u=500,label:d,description:f,error:p,title:m,onTitleChange:h,showTOC:g=!0,enableMentions:_=!1,enableSlashCommands:v=!1,enableAI:y=!1,aiEndpoint:b,aiSystemPrompt:x,enableDnD:S=!1,enableMarkdown:C=!0,extraPlugins:w,editorRef:T},E)=>{let[D,O]=s.useState(null),[k,M]=s.useState(!1),[ee,te]=s.useState([]),N=s.useRef({enableMentions:_,enableSlashCommands:v,enableAI:y,enableDnD:S,enableMarkdown:C,aiEndpoint:b,aiSystemPrompt:x});return N.current={enableMentions:_,enableSlashCommands:v,enableAI:y,enableDnD:S,enableMarkdown:C,aiEndpoint:b,aiSystemPrompt:x},s.useEffect(()=>{let e=!1;return(async()=>{try{let t=N.current,[n,r,i,a,o,s,c]=await Promise.all([import(`platejs/react`),import(`@platejs/basic-nodes/react`),import(`@platejs/table/react`),import(`@platejs/layout/react`),import(`@platejs/callout/react`),import(`@platejs/link/react`),import(`@platejs/indent/react`)]),l=[r.BoldPlugin,r.ItalicPlugin,r.UnderlinePlugin,r.StrikethroughPlugin,r.CodePlugin,r.HighlightPlugin,r.SuperscriptPlugin,r.SubscriptPlugin,r.H1Plugin,r.H2Plugin,r.H3Plugin,r.H4Plugin,r.H5Plugin,r.H6Plugin,r.BlockquotePlugin,i.TablePlugin,i.TableRowPlugin,i.TableCellPlugin,i.TableCellHeaderPlugin,a.ColumnPlugin,a.ColumnItemPlugin,o.CalloutPlugin,s.LinkPlugin.configure({options:{allowedSchemes:[`http`,`https`,`mailto`,`tel`]}}),c.IndentPlugin];try{let{TocPlugin:e}=await import(`@platejs/toc/react`);l.push(e)}catch{}try{let{BlockSelectionPlugin:e}=await import(`@platejs/selection/react`);l.push(e)}catch{}if(t.enableMentions)try{let{MentionPlugin:e,MentionInputPlugin:t}=await import(`@platejs/mention/react`);l.push(e.configure({options:{trigger:`@`,triggerPreviousCharPattern:/^$|^[\s"']$/,insertSpaceAfterMention:!0}}),t)}catch{}if(t.enableDnD)try{let{DndPlugin:e}=await import(`@platejs/dnd`);l.push(e)}catch{}if(t.enableMarkdown)try{let{MarkdownPlugin:e}=await import(`@platejs/markdown`);l.push(e)}catch{}if(t.enableAI&&t.aiEndpoint)try{let{AIPlugin:e,AIChatPlugin:n}=await import(`@platejs/ai/react`);l.push(e,n.configure({options:{chat:{api:t.aiEndpoint,body:{system:t.aiSystemPrompt??`You are a helpful writing assistant.`}}}}))}catch{}e||O({Plate:n.Plate,PlateContent:n.PlateContent,usePlateEditor:n.usePlateEditor,plugins:l})}catch(t){console.error(`[WakaDocumentEditor] Failed to load:`,t),e||M(!0)}})(),()=>{e=!0}},[]),s.useEffect(()=>{if(!g||!e){te([]);return}let t=[],n=0,r=new Set([`h1`,`h2`,`h3`,`h4`,`h5`,`h6`]);for(let i of e)if(r.has(i?.type)){let e=j(i);if(e.trim()){let r=parseInt(i.type.replace(`h`,``),10);t.push({id:`toc-${n++}`,text:e.trim(),level:r,depth:r-1})}}te(t)},[e,g]),D?(0,l.jsx)(A,{ref:E,bundle:D,value:e,onChange:n,readOnly:r,placeholder:i,className:o,editorClassName:c,minHeight:u,label:d,description:f,error:p,title:m,onTitleChange:h,showTOC:g,toc:ee,extraPlugins:w,editorRef:T}):(0,l.jsxs)(`div`,{ref:E,className:t.t(`space-y-1.5`,o),children:[d&&(0,l.jsx)(a.n,{children:d}),f&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f}),(0,l.jsxs)(`div`,{className:`relative`,children:[(0,l.jsx)(a.t,{placeholder:i,disabled:!0,style:{minHeight:u}}),(0,l.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-background/50 rounded-lg`,children:(0,l.jsx)(`span`,{className:`text-sm text-muted-foreground animate-pulse`,children:k?`Erreur de chargement de l'editeur`:`Chargement de l'editeur...`})})]}),p&&(0,l.jsx)(`p`,{className:`text-sm text-destructive`,children:p})]})});k.displayName=`WakaDocumentEditor`;var A=s.forwardRef(({bundle:{Plate:e,PlateContent:r,usePlateEditor:i,plugins:o},value:c,onChange:u,readOnly:d,placeholder:f,className:p,editorClassName:m,minHeight:h,label:g,description:_,error:v,title:y,onTitleChange:b,showTOC:x,toc:S,extraPlugins:C,editorRef:w},T)=>{let E=i({plugins:s.useMemo(()=>[...o,...C??[]],[o,C]),value:c??[{type:`p`,children:[{text:``}]}]});return s.useEffect(()=>{w&&(w.current=E)},[E,w]),(0,l.jsxs)(`div`,{ref:T,className:t.t(`space-y-1.5`,p),children:[g&&(0,l.jsx)(a.n,{children:g}),_&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:_}),(0,l.jsx)(e,{editor:E,onChange:u?({value:e})=>u(e):void 0,readOnly:d,children:(0,l.jsxs)(`div`,{className:t.t(`flex border rounded-lg overflow-hidden`,v&&`border-destructive`),children:[x&&S.length>0&&(0,l.jsxs)(`aside`,{className:`w-56 shrink-0 border-r bg-muted/20 hidden lg:block`,children:[(0,l.jsx)(`div`,{className:`p-3 border-b`,children:(0,l.jsx)(`h4`,{className:`text-xs font-bold uppercase tracking-wider text-muted-foreground`,children:`Table des matieres`})}),(0,l.jsx)(n.f,{className:`h-full max-h-[600px]`,children:(0,l.jsx)(`nav`,{className:`p-2 space-y-0.5`,children:S.map(e=>(0,l.jsx)(`button`,{className:t.t(`block w-full text-left px-2 py-1 rounded-md text-sm`,`hover:bg-accent/50 transition-colors truncate`,`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${e.depth*12+8}px`},title:e.text,children:e.text},e.id))})})]}),(0,l.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(y!==void 0||b)&&(0,l.jsx)(`div`,{className:`border-b px-6 py-4`,children:(0,l.jsx)(`input`,{type:`text`,value:y??``,onChange:e=>b?.(e.target.value),placeholder:`Titre du document`,readOnly:d,className:t.t(`w-full bg-transparent text-2xl font-bold text-foreground`,`placeholder:text-muted-foreground/50`,`focus:outline-none`)})}),(0,l.jsx)(`div`,{style:{minHeight:h},children:(0,l.jsx)(r,{placeholder:f,readOnly:d,className:t.t(`prose prose-sm max-w-none px-6 py-4`,`focus-within:outline-none`,`[&_[data-slate-editor]]:outline-none [&_[data-slate-editor]]:min-h-[inherit]`,m)})})]})]})}),v&&(0,l.jsx)(`p`,{className:`text-sm text-destructive`,children:v})]})});A.displayName=`DocumentEditorInner`;function j(e){return typeof e?.text==`string`?e.text:Array.isArray(e?.children)?e.children.map(e=>j(e)).join(``):``}t.n();var M=s.forwardRef(({markdownValue:e=``,onMarkdownChange:n,slateValue:r,onSlateChange:o,defaultMode:c=`rich`,readOnly:u=!1,placeholder:d=`Commencez a ecrire...`,className:f,editorClassName:p,minHeight:m=300,label:h,description:g,error:_,extraPlugins:v,editorRef:y},b)=>{let[x,S]=s.useState(c),[C,w]=s.useState(null),[T,E]=s.useState(!1),[D,O]=s.useState(e);s.useEffect(()=>{O(e)},[e]),s.useEffect(()=>{let e=!1;return(async()=>{try{let[t,n,r,i,a,o,s]=await Promise.all([import(`platejs/react`),import(`@platejs/basic-nodes/react`),import(`@platejs/table/react`),import(`@platejs/layout/react`),import(`@platejs/callout/react`),import(`@platejs/link/react`),import(`@platejs/markdown`)]),c=[n.BoldPlugin,n.ItalicPlugin,n.UnderlinePlugin,n.StrikethroughPlugin,n.CodePlugin,n.HighlightPlugin,n.H1Plugin,n.H2Plugin,n.H3Plugin,n.H4Plugin,n.BlockquotePlugin,r.TablePlugin,r.TableRowPlugin,r.TableCellPlugin,r.TableCellHeaderPlugin,i.ColumnPlugin,i.ColumnItemPlugin,a.CalloutPlugin,o.LinkPlugin.configure({options:{allowedSchemes:[`http`,`https`,`mailto`]}}),s.MarkdownPlugin];e||w({Plate:t.Plate,PlateContent:t.PlateContent,usePlateEditor:t.usePlateEditor,plugins:c,serializeMd:s.serializeMd,deserializeMd:s.deserializeMd})}catch(t){console.error(`[WakaMarkdownEditor] Failed to load:`,t),e||E(!0)}})(),()=>{e=!0}},[]);let k=(0,l.jsx)(`div`,{className:`flex items-center gap-1 p-1 border-b bg-muted/30`,children:[`rich`,`markdown`,`split`].map(e=>(0,l.jsx)(i.n,{type:`button`,variant:x===e?`secondary`:`ghost`,size:`sm`,className:`h-7 text-xs`,onClick:()=>S(e),children:e===`rich`?`Editeur`:e===`markdown`?`Markdown`:`Split`},e))}),A=s.useCallback(e=>{O(e),n?.(e)},[n]);return(0,l.jsxs)(`div`,{ref:b,className:t.t(`space-y-1.5`,f),children:[h&&(0,l.jsx)(a.n,{children:h}),g&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:g}),(0,l.jsxs)(`div`,{className:t.t(`border rounded-lg overflow-hidden`,_&&`border-destructive`),children:[!u&&k,x===`markdown`&&(0,l.jsx)(ee,{value:D,onChange:A,readOnly:u,placeholder:d,minHeight:m,className:p}),x===`rich`&&C&&(0,l.jsx)(te,{bundle:C,markdownValue:D,slateValue:r,onSlateChange:o,onMarkdownChange:n,readOnly:u,placeholder:d,minHeight:m,className:p,extraPlugins:v,editorRef:y}),x===`split`&&C&&(0,l.jsxs)(`div`,{className:`flex divide-x`,style:{minHeight:m},children:[(0,l.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,l.jsx)(te,{bundle:C,markdownValue:D,slateValue:r,onSlateChange:o,onMarkdownChange:n,readOnly:u,placeholder:d,minHeight:m,className:p,extraPlugins:v,editorRef:y})}),(0,l.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,l.jsx)(ee,{value:D,onChange:A,readOnly:u,placeholder:`Markdown...`,minHeight:m})})]}),!C&&x!==`markdown`&&(0,l.jsx)(`div`,{className:`relative`,style:{minHeight:m},children:(0,l.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-background/50`,children:(0,l.jsx)(`span`,{className:`text-sm text-muted-foreground animate-pulse`,children:T?`Erreur de chargement`:`Chargement...`})})})]}),_&&(0,l.jsx)(`p`,{className:`text-sm text-destructive`,children:_})]})});M.displayName=`WakaMarkdownEditor`;function ee({value:e,onChange:n,readOnly:r,placeholder:i,minHeight:o,className:s}){return(0,l.jsx)(a.t,{value:e,onChange:e=>n(e.target.value),readOnly:r,placeholder:i,style:{minHeight:o},className:t.t(`rounded-none border-0 resize-none font-mono text-sm`,`focus-visible:ring-0 focus-visible:ring-offset-0`,s)})}function te({bundle:{Plate:e,PlateContent:n,usePlateEditor:r,plugins:i,serializeMd:a},markdownValue:o,slateValue:c,onSlateChange:u,onMarkdownChange:d,readOnly:f,placeholder:p,minHeight:m,className:h,extraPlugins:g,editorRef:_}){let v=r({plugins:s.useMemo(()=>[...i,...g??[]],[i,g]),value:c??[{type:`p`,children:[{text:o||``}]}]});return s.useEffect(()=>{_&&(_.current=v)},[v,_]),(0,l.jsx)(e,{editor:v,onChange:s.useCallback(({value:e})=>{if(u?.(e),d&&a)try{d(a(v,{value:e}))}catch{}},[v,u,d,a]),readOnly:f,children:(0,l.jsx)(`div`,{style:{minHeight:m},children:(0,l.jsx)(n,{placeholder:p,readOnly:f,className:t.t(`prose prose-sm max-w-none p-4`,`focus-within:outline-none`,`[&_[data-slate-editor]]:outline-none [&_[data-slate-editor]]:min-h-[inherit]`,h)})})})}t.n();var N=[{key:`user-story`,label:`User Story`,description:`En tant que [role], je veux [action] afin de [benefice]`,icon:c.Users,category:`Fonctionnel`,createNodes:()=>[{type:`callout`,variant:`info`,children:[{text:``}]},{type:`h3`,children:[{text:`User Story`}]},{type:`p`,children:[{text:`En tant que `,bold:!0},{text:`[role]`}]},{type:`p`,children:[{text:`Je veux `,bold:!0},{text:`[action]`}]},{type:`p`,children:[{text:`Afin de `,bold:!0},{text:`[benefice attendu]`}]},{type:`p`,children:[{text:``}]}]},{key:`acceptance-criteria`,label:`Criteres d'acceptation`,description:`Given/When/Then avec scenarios de validation`,icon:c.CheckCircle2,category:`Fonctionnel`,createNodes:()=>[{type:`h3`,children:[{text:`Criteres d'acceptation`}]},{type:`table`,children:[{type:`tr`,children:[{type:`th`,children:[{type:`p`,children:[{text:`#`,bold:!0}]}]},{type:`th`,children:[{type:`p`,children:[{text:`Scenario`,bold:!0}]}]},{type:`th`,children:[{type:`p`,children:[{text:`Given`,bold:!0}]}]},{type:`th`,children:[{type:`p`,children:[{text:`When`,bold:!0}]}]},{type:`th`,children:[{type:`p`,children:[{text:`Then`,bold:!0}]}]}]},{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`AC-01`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Nominal`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`L'utilisateur est connecte`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Il clique sur le bouton`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Le resultat s'affiche`}]}]}]},{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`AC-02`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Erreur`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Le service est indisponible`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Il clique sur le bouton`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Un message d'erreur s'affiche`}]}]}]}]},{type:`p`,children:[{text:``}]}]},{key:`use-case`,label:`Cas d'utilisation`,description:`Acteur, pre-conditions, flux nominal, flux alternatifs`,icon:c.GitBranch,category:`Fonctionnel`,createNodes:()=>[{type:`h3`,children:[{text:`Cas d'utilisation : [Nom]`}]},{type:`column_group`,children:[{type:`column`,children:[{type:`h4`,children:[{text:`ACTEUR`}]},{type:`p`,children:[{text:`[Role utilisateur]`}]},{type:`h4`,children:[{text:`PRE-CONDITIONS`}]},{type:`p`,children:[{text:`- L'utilisateur est authentifie`}]},{type:`p`,children:[{text:`- [Autre condition]`}]},{type:`h4`,children:[{text:`POST-CONDITIONS`}]},{type:`p`,children:[{text:`- [Etat apres execution]`}]}]},{type:`column`,children:[{type:`h4`,children:[{text:`FLUX NOMINAL`}]},{type:`p`,children:[{text:`1. L'utilisateur accede a la page`}]},{type:`p`,children:[{text:`2. Le systeme affiche le formulaire`}]},{type:`p`,children:[{text:`3. L'utilisateur remplit et soumet`}]},{type:`p`,children:[{text:`4. Le systeme enregistre et confirme`}]},{type:`h4`,children:[{text:`FLUX ALTERNATIFS`}]},{type:`p`,children:[{text:`3a. Donnees invalides : erreur affichee`}]}]}]},{type:`p`,children:[{text:``}]}]},{key:`api-endpoint`,label:`Endpoint API`,description:`Specification d'un endpoint REST avec requete/reponse`,icon:c.Zap,category:`Technique`,createNodes:()=>[{type:`h3`,children:[{text:`API: [METHOD] /api/v1/[resource]`}]},{type:`table`,children:[{type:`tr`,children:[{type:`th`,children:[{type:`p`,children:[{text:`Propriete`,bold:!0}]}]},{type:`th`,children:[{type:`p`,children:[{text:`Valeur`,bold:!0}]}]}]},{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`Methode`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`GET | POST | PUT | DELETE`}]}]}]},{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`Authentification`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Bearer JWT`}]}]}]},{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`Permissions`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`[ROLE_REQUIRED]`}]}]}]},{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`Rate Limit`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`100 req/min`}]}]}]}]},{type:`h4`,children:[{text:`CORPS DE LA REQUETE`}]},{type:`blockquote`,children:[{text:`{ "field": "value" }`}]},{type:`h4`,children:[{text:`REPONSE 200`}]},{type:`blockquote`,children:[{text:`{ "data": { ... }, "meta": { "total": 42 } }`}]},{type:`p`,children:[{text:``}]}]},{key:`data-model`,label:`Modele de donnees`,description:`Schema d'entite avec champs, types et contraintes`,icon:c.Database,category:`Technique`,createNodes:()=>[{type:`h3`,children:[{text:`Modele : [NomEntite]`}]},{type:`table`,children:[{type:`tr`,children:[{type:`th`,children:[{type:`p`,children:[{text:`Champ`,bold:!0}]}]},{type:`th`,children:[{type:`p`,children:[{text:`Type`,bold:!0}]}]},{type:`th`,children:[{type:`p`,children:[{text:`Nullable`,bold:!0}]}]},{type:`th`,children:[{type:`p`,children:[{text:`Description`,bold:!0}]}]}]},{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`id`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`UUID`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Non`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Identifiant unique`}]}]}]},{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`createdAt`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`DateTime`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Non`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Date de creation`}]}]}]}]},{type:`p`,children:[{text:``}]}]},{key:`security-requirements`,label:`Exigences de securite`,description:`Regles OWASP, chiffrement, acces, conformite`,icon:c.Shield,category:`Non-fonctionnel`,createNodes:()=>[{type:`h3`,children:[{text:`Exigences de securite`}]},{type:`callout`,variant:`warning`,children:[{text:`Section obligatoire pour les modules HDS et les donnees sensibles`}]},{type:`table`,children:[{type:`tr`,children:[{type:`th`,children:[{type:`p`,children:[{text:`Categorie`,bold:!0}]}]},{type:`th`,children:[{type:`p`,children:[{text:`Exigence`,bold:!0}]}]},{type:`th`,children:[{type:`p`,children:[{text:`Niveau`,bold:!0}]}]}]},{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`Authentification`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`OAuth2 PKCE via Keycloak`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Obligatoire`}]}]}]},{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`Chiffrement`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`AES-256-GCM au repos, TLS 1.3 en transit`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Obligatoire`}]}]}]},{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`Audit`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`TracingInterceptor sur toutes les operations`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Obligatoire`}]}]}]}]},{type:`p`,children:[{text:``}]}]},{key:`risk-assessment`,label:`Risques et mitigations`,description:`Matrice de risques projet avec probabilite et impact`,icon:c.AlertTriangle,category:`Non-fonctionnel`,createNodes:()=>[{type:`h3`,children:[{text:`Analyse des risques`}]},{type:`table`,children:[{type:`tr`,children:[{type:`th`,children:[{type:`p`,children:[{text:`Risque`,bold:!0}]}]},{type:`th`,children:[{type:`p`,children:[{text:`Probabilite`,bold:!0}]}]},{type:`th`,children:[{type:`p`,children:[{text:`Impact`,bold:!0}]}]},{type:`th`,children:[{type:`p`,children:[{text:`Mitigation`,bold:!0}]}]}]},{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`[Description du risque]`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Moyen`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Haut`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`[Plan de mitigation]`}]}]}]}]},{type:`p`,children:[{text:``}]}]},{key:`spec-header`,label:`En-tete de specification`,description:`Bloc d'en-tete avec version, auteur, statut, date`,icon:c.BookOpen,category:`Document`,createNodes:()=>[{type:`h1`,children:[{text:`[Titre de la specification]`}]},{type:`table`,children:[{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`Version`,bold:!0}]}]},{type:`td`,children:[{type:`p`,children:[{text:`1.0.0`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Statut`,bold:!0}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Brouillon`}]}]}]},{type:`tr`,children:[{type:`td`,children:[{type:`p`,children:[{text:`Auteur`,bold:!0}]}]},{type:`td`,children:[{type:`p`,children:[{text:`[Nom]`}]}]},{type:`td`,children:[{type:`p`,children:[{text:`Date`,bold:!0}]}]},{type:`td`,children:[{type:`p`,children:[{text:new Date().toLocaleDateString(`fr-FR`)}]}]}]}]},{type:`h2`,children:[{text:`CONTEXTE`}]},{type:`p`,children:[{text:`[Description du contexte et des objectifs]`}]},{type:`h2`,children:[{text:`PERIMETRE`}]},{type:`p`,children:[{text:`[Ce qui est inclus et exclu du perimetre]`}]},{type:`p`,children:[{text:``}]}]}],ne=s.forwardRef(({value:e,onChange:n,readOnly:r=!1,placeholder:i=`Commencez votre specification...`,className:o,editorClassName:c,minHeight:u=500,label:d,description:f,error:p,customTemplates:m=[],showTemplateSidebar:h=!0,enableAI:g=!1,aiEndpoint:_,title:v,onTitleChange:y,extraPlugins:b,editorRef:x},S)=>{let[C,w]=s.useState(null),[T,E]=s.useState(!1),D=s.useRef(null),O=x??D,k=s.useMemo(()=>[...N,...m],[m]),A=s.useMemo(()=>{let e=new Map;for(let t of k){let n=t.category||`Autre`;e.has(n)||e.set(n,[]),e.get(n).push(t)}return e},[k]);s.useEffect(()=>{let e=!1;return(async()=>{try{let[t,n,r,i,a,o,s]=await Promise.all([import(`platejs/react`),import(`@platejs/basic-nodes/react`),import(`@platejs/table/react`),import(`@platejs/layout/react`),import(`@platejs/callout/react`),import(`@platejs/link/react`),import(`@platejs/indent/react`)]),c=[n.BoldPlugin,n.ItalicPlugin,n.UnderlinePlugin,n.StrikethroughPlugin,n.CodePlugin,n.HighlightPlugin,n.SuperscriptPlugin,n.SubscriptPlugin,n.H1Plugin,n.H2Plugin,n.H3Plugin,n.H4Plugin,n.H5Plugin,n.H6Plugin,n.BlockquotePlugin,r.TablePlugin,r.TableRowPlugin,r.TableCellPlugin,r.TableCellHeaderPlugin,i.ColumnPlugin,i.ColumnItemPlugin,a.CalloutPlugin,o.LinkPlugin.configure({options:{allowedSchemes:[`http`,`https`,`mailto`,`tel`]}}),s.IndentPlugin];try{let{TocPlugin:e}=await import(`@platejs/toc/react`);c.push(e)}catch{}try{let{BlockSelectionPlugin:e}=await import(`@platejs/selection/react`);c.push(e)}catch{}try{let{MarkdownPlugin:e}=await import(`@platejs/markdown`);c.push(e)}catch{}if(g&&_)try{let{AIPlugin:e,AIChatPlugin:t}=await import(`@platejs/ai/react`);c.push(e,t.configure({options:{chat:{api:_,body:{system:`You are a specification writing assistant for a PaaS platform.`}}}}))}catch{}e||w({Plate:t.Plate,PlateContent:t.PlateContent,usePlateEditor:t.usePlateEditor,plugins:c})}catch(t){console.error(`[WakaSpecEditor] Failed to load:`,t),e||E(!0)}})(),()=>{e=!0}},[g,_]);let j=s.useCallback(t=>{let r=t.createNodes(),i=[...e??[],...r];n?.(i)},[e,n]);return(0,l.jsxs)(`div`,{ref:S,className:t.t(`space-y-1.5`,o),children:[d&&(0,l.jsx)(a.n,{children:d}),f&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f}),(0,l.jsxs)(`div`,{className:t.t(`flex border rounded-lg overflow-hidden`,p&&`border-destructive`),children:[h&&!r&&(0,l.jsxs)(`aside`,{className:`w-52 shrink-0 border-r bg-muted/20 hidden md:block`,children:[(0,l.jsx)(`div`,{className:`p-3 border-b`,children:(0,l.jsx)(`h4`,{className:`text-xs font-bold uppercase tracking-wider text-muted-foreground`,children:`Blocs specification`})}),(0,l.jsx)(`div`,{className:`p-2 space-y-3 max-h-[600px] overflow-y-auto`,children:Array.from(A.entries()).map(([e,n])=>(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-muted-foreground px-1 mb-1`,children:e}),(0,l.jsx)(`div`,{className:`space-y-0.5`,children:n.map(e=>{let n=e.icon;return(0,l.jsxs)(`button`,{type:`button`,onClick:()=>j(e),className:t.t(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left`,`text-xs transition-colors cursor-pointer`,`hover:bg-accent/50 text-muted-foreground hover:text-foreground`),title:e.description,children:[(0,l.jsx)(n,{className:`h-3.5 w-3.5 shrink-0`}),(0,l.jsx)(`span`,{className:`truncate`,children:e.label})]},e.key)})})]},e))})]}),(0,l.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(v!==void 0||y)&&(0,l.jsx)(`div`,{className:`border-b px-6 py-4`,children:(0,l.jsx)(`input`,{type:`text`,value:v??``,onChange:e=>y?.(e.target.value),placeholder:`Titre de la specification`,readOnly:r,className:t.t(`w-full bg-transparent text-xl font-bold text-foreground`,`placeholder:text-muted-foreground/50 focus:outline-none`)})}),C?(0,l.jsx)(re,{bundle:C,value:e,onChange:n,readOnly:r,placeholder:i,editorClassName:c,minHeight:u,extraPlugins:b,editorRef:O}):(0,l.jsx)(`div`,{className:`relative`,style:{minHeight:u},children:(0,l.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-background/50`,children:(0,l.jsx)(`span`,{className:`text-sm text-muted-foreground animate-pulse`,children:T?`Erreur de chargement`:`Chargement de l'editeur...`})})})]})]}),p&&(0,l.jsx)(`p`,{className:`text-sm text-destructive`,children:p})]})});ne.displayName=`WakaSpecEditor`;function re({bundle:{Plate:e,PlateContent:n,usePlateEditor:r,plugins:i},value:a,onChange:o,readOnly:c,placeholder:u,editorClassName:d,minHeight:f,extraPlugins:p,editorRef:m}){let h=r({plugins:s.useMemo(()=>[...i,...p??[]],[i,p]),value:a??[{type:`p`,children:[{text:``}]}]});return s.useEffect(()=>{m&&(m.current=h)},[h,m]),(0,l.jsx)(e,{editor:h,onChange:o?({value:e})=>o(e):void 0,readOnly:c,children:(0,l.jsx)(`div`,{style:{minHeight:f},children:(0,l.jsx)(n,{placeholder:u,readOnly:c,className:t.t(`prose prose-sm max-w-none px-6 py-4`,`focus-within:outline-none`,`[&_[data-slate-editor]]:outline-none [&_[data-slate-editor]]:min-h-[inherit]`,d)})})})}t.n();var ie=s.forwardRef(({value:e,onChange:n,readOnly:r=!1,placeholder:i=`Glissez-deposez les blocs pour les reorganiser...`,className:o,editorClassName:c,minHeight:u=300,label:d,description:f,error:p,showDragHandles:m=!0,extraPlugins:h,editorRef:g},_)=>{let[v,y]=s.useState(null),[b,x]=s.useState(!1);return s.useEffect(()=>{let e=!1;return(async()=>{try{let[t,n,r,i,a,o,s,c]=await Promise.all([import(`platejs/react`),import(`@platejs/basic-nodes/react`),import(`@platejs/table/react`),import(`@platejs/layout/react`),import(`@platejs/callout/react`),import(`@platejs/link/react`),import(`@platejs/dnd`),import(`@platejs/selection/react`)]),l=[n.BoldPlugin,n.ItalicPlugin,n.UnderlinePlugin,n.StrikethroughPlugin,n.CodePlugin,n.HighlightPlugin,n.H1Plugin,n.H2Plugin,n.H3Plugin,n.H4Plugin,n.BlockquotePlugin,r.TablePlugin,r.TableRowPlugin,r.TableCellPlugin,r.TableCellHeaderPlugin,i.ColumnPlugin,i.ColumnItemPlugin,a.CalloutPlugin,o.LinkPlugin.configure({options:{allowedSchemes:[`http`,`https`,`mailto`,`tel`]}}),c.BlockSelectionPlugin,s.DndPlugin.configure({options:{enableScroller:!0}})];e||y({Plate:t.Plate,PlateContent:t.PlateContent,usePlateEditor:t.usePlateEditor,plugins:l})}catch(t){console.error(`[WakaDnDEditor] Failed to load:`,t),e||x(!0)}})(),()=>{e=!0}},[]),v?(0,l.jsx)(ae,{ref:_,bundle:v,value:e,onChange:n,readOnly:r,placeholder:i,className:o,editorClassName:c,minHeight:u,label:d,description:f,error:p,showDragHandles:m,extraPlugins:h,editorRef:g}):(0,l.jsxs)(`div`,{ref:_,className:t.t(`space-y-1.5`,o),children:[d&&(0,l.jsx)(a.n,{children:d}),f&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f}),(0,l.jsxs)(`div`,{className:`relative`,children:[(0,l.jsx)(a.t,{placeholder:i,disabled:!0,style:{minHeight:u}}),(0,l.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-background/50 rounded-lg`,children:(0,l.jsx)(`span`,{className:`text-sm text-muted-foreground animate-pulse`,children:b?`Erreur de chargement`:`Chargement...`})})]}),p&&(0,l.jsx)(`p`,{className:`text-sm text-destructive`,children:p})]})});ie.displayName=`WakaDnDEditor`;var ae=s.forwardRef(({bundle:{Plate:e,PlateContent:n,usePlateEditor:r,plugins:i},value:o,onChange:c,readOnly:u,placeholder:d,className:f,editorClassName:p,minHeight:m,label:h,description:g,error:_,showDragHandles:v,extraPlugins:y,editorRef:b},x)=>{let S=r({plugins:s.useMemo(()=>[...i,...y??[]],[i,y]),value:o??[{type:`p`,children:[{text:``}]}]});return s.useEffect(()=>{b&&(b.current=S)},[S,b]),(0,l.jsxs)(`div`,{ref:x,className:t.t(`space-y-1.5`,f),children:[h&&(0,l.jsx)(a.n,{children:h}),g&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:g}),(0,l.jsx)(e,{editor:S,onChange:c?({value:e})=>c(e):void 0,readOnly:u,children:(0,l.jsxs)(`div`,{className:t.t(`border rounded-lg overflow-hidden`,_&&`border-destructive`),children:[!u&&v&&(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b bg-muted/30 text-xs text-muted-foreground`,children:[(0,l.jsx)(`span`,{className:`inline-block w-4 text-center`,children:`☰`}),(0,l.jsx)(`span`,{children:`Survolez un bloc pour voir la poignee de glissement`})]}),(0,l.jsx)(`div`,{style:{minHeight:m},children:(0,l.jsx)(n,{placeholder:d,readOnly:u,className:t.t(`prose prose-sm max-w-none p-4`,`focus-within:outline-none`,`[&_[data-slate-editor]]:outline-none [&_[data-slate-editor]]:min-h-[inherit]`,v&&`[&_[data-slate-node='element']]:relative [&_[data-slate-node='element']]:pl-6`,p)})})]})}),_&&(0,l.jsx)(`p`,{className:`text-sm text-destructive`,children:_})]})});ae.displayName=`DnDEditorInner`,t.n();var oe=s.forwardRef(({value:e,onChange:n,readOnly:r=!1,placeholder:i=`Editez ensemble en temps reel...`,className:o,editorClassName:c,minHeight:u=400,label:d,description:f,error:p,documentId:m,currentUser:h,providers:g,maxParticipants:_=10,onUsersChange:v,showUsersBar:y=!0,extraPlugins:b,editorRef:x},S)=>{let[C,w]=s.useState(null),[T,E]=s.useState(!1),[D,O]=s.useState([h]),k=s.useRef({documentId:m,currentUser:h,providers:g,maxParticipants:_});return k.current={documentId:m,currentUser:h,providers:g,maxParticipants:_},s.useEffect(()=>{let e=!1;return(async()=>{try{let t=k.current,[n,r,i,a,o,s,c]=await Promise.all([import(`platejs/react`),import(`@platejs/basic-nodes/react`),import(`@platejs/table/react`),import(`@platejs/layout/react`),import(`@platejs/callout/react`),import(`@platejs/link/react`),import(`@platejs/yjs/react`)]),l=[r.BoldPlugin,r.ItalicPlugin,r.UnderlinePlugin,r.StrikethroughPlugin,r.CodePlugin,r.HighlightPlugin,r.H1Plugin,r.H2Plugin,r.H3Plugin,r.H4Plugin,r.BlockquotePlugin,i.TablePlugin,i.TableRowPlugin,i.TableCellPlugin,i.TableCellHeaderPlugin,a.ColumnPlugin,a.ColumnItemPlugin,o.CalloutPlugin,s.LinkPlugin.configure({options:{allowedSchemes:[`http`,`https`,`mailto`,`tel`]}})],u=t.providers.map(e=>e.type===`hocuspocus`?{type:`hocuspocus`,options:{name:e.roomName,url:e.url,...e.options}}:{type:`webrtc`,options:{roomName:e.roomName,maxConns:t.maxParticipants-1,signaling:[e.url],...e.options}});l.push(c.YjsPlugin.configure({options:{cursors:{data:{name:t.currentUser.name,color:t.currentUser.color}},providers:u}})),e||w({Plate:n.Plate,PlateContent:n.PlateContent,usePlateEditor:n.usePlateEditor,YjsPlugin:c.YjsPlugin,plugins:l})}catch(t){console.error(`[WakaCollaborativeEditor] Failed to load:`,t),e||E(!0)}})(),()=>{e=!0}},[]),s.useEffect(()=>{v?.(D)},[D,v]),C?(0,l.jsx)(se,{ref:S,bundle:C,value:e,onChange:n,readOnly:r,placeholder:i,className:o,editorClassName:c,minHeight:u,label:d,description:f,error:p,documentId:m,currentUser:h,showUsersBar:y,connectedUsers:D,setConnectedUsers:O,extraPlugins:b,editorRef:x}):(0,l.jsxs)(`div`,{ref:S,className:t.t(`space-y-1.5`,o),children:[d&&(0,l.jsx)(a.n,{children:d}),f&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f}),(0,l.jsxs)(`div`,{className:`relative`,children:[(0,l.jsx)(a.t,{placeholder:i,disabled:!0,style:{minHeight:u}}),(0,l.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-background/50 rounded-lg`,children:(0,l.jsx)(`span`,{className:`text-sm text-muted-foreground animate-pulse`,children:T?`Erreur de chargement (@platejs/yjs requis)`:`Connexion a la session collaborative...`})})]}),p&&(0,l.jsx)(`p`,{className:`text-sm text-destructive`,children:p})]})});oe.displayName=`WakaCollaborativeEditor`;var se=s.forwardRef(({bundle:{Plate:e,PlateContent:i,usePlateEditor:o,YjsPlugin:c,plugins:u},value:d,onChange:f,readOnly:p,placeholder:m,className:h,editorClassName:g,minHeight:_,label:v,description:y,error:b,documentId:x,showUsersBar:S,connectedUsers:C,extraPlugins:w,editorRef:T},E)=>{let D=o({plugins:s.useMemo(()=>[...u,...w??[]],[u,w]),skipInitialization:!0},[x]);return s.useEffect(()=>{try{D.getApi(c).yjs.init({id:x,autoSelect:`end`,value:d??[{type:`p`,children:[{text:``}]}]})}catch{}return()=>{try{D.getApi(c).yjs.destroy()}catch{}}},[D,x,c,d]),s.useEffect(()=>{T&&(T.current=D)},[D,T]),(0,l.jsxs)(`div`,{ref:E,className:t.t(`space-y-1.5`,h),children:[v&&(0,l.jsx)(a.n,{children:v}),y&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:y}),(0,l.jsx)(e,{editor:D,onChange:f?({value:e})=>f(e):void 0,readOnly:p,children:(0,l.jsxs)(`div`,{className:t.t(`border rounded-lg overflow-hidden`,b&&`border-destructive`),children:[S&&(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b bg-muted/30`,children:[(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`En ligne :`}),(0,l.jsx)(`div`,{className:`flex items-center -space-x-1.5`,children:C.map(e=>(0,l.jsx)(n.m,{className:`h-6 w-6 border-2 border-background`,children:(0,l.jsx)(n.h,{className:`text-[10px] text-white font-bold`,style:{backgroundColor:e.color},children:e.name.slice(0,2).toUpperCase()})},e.id))}),(0,l.jsxs)(r.t,{variant:`secondary`,className:`text-[10px] h-5`,children:[C.length,` connecte`,C.length>1?`s`:``]})]}),(0,l.jsx)(`div`,{style:{minHeight:_},children:(0,l.jsx)(i,{placeholder:m,readOnly:p,className:t.t(`prose prose-sm max-w-none p-4`,`focus-within:outline-none`,`[&_[data-slate-editor]]:outline-none [&_[data-slate-editor]]:min-h-[inherit]`,g)})})]})}),b&&(0,l.jsx)(`p`,{className:`text-sm text-destructive`,children:b})]})});se.displayName=`CollabEditorInner`,t.n();var ce=s.forwardRef(({original:e,modified:n,mode:i=`inline`,label:o,description:c,className:u,editorClassName:d,minHeight:f=200,showStats:p=!0,originalLabel:m=`Original`,modifiedLabel:h=`Modifie`,onDiffComputed:g},_)=>{let[v,y]=s.useState(null),[b,x]=s.useState({added:0,removed:0,modified:0,unchanged:0}),[S,C]=s.useState(!1);return s.useEffect(()=>{let t=!1;return(async()=>{try{let r=await import(`@platejs/diff`);if(r.computeDiff){let i=r.computeDiff(e,n);if(!t){y(i);let e={added:0,removed:0,modified:0,unchanged:0};if(Array.isArray(i))for(let t of i)t.diff===`insert`||t.diffOperation?.type===`insert`?e.added++:t.diff===`delete`||t.diffOperation?.type===`delete`?e.removed++:t.diff===`update`||t.diffOperation?.type===`update`?e.modified++:e.unchanged++;x(e),g?.(e)}}}catch(e){console.error(`[WakaDiffViewer] Failed to compute diff:`,e),t||C(!0)}})(),()=>{t=!0}},[e,n,g]),S||!v?(0,l.jsxs)(`div`,{ref:_,className:t.t(`space-y-1.5`,u),children:[o&&(0,l.jsx)(a.n,{children:o}),c&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:c}),S?(0,l.jsx)(de,{original:e,modified:n,mode:i,originalLabel:m,modifiedLabel:h,minHeight:f,editorClassName:d}):(0,l.jsx)(`div`,{className:`flex items-center justify-center border rounded-lg bg-muted/30`,style:{minHeight:f},children:(0,l.jsx)(`span`,{className:`text-sm text-muted-foreground animate-pulse`,children:`Calcul des differences...`})})]}):(0,l.jsxs)(`div`,{ref:_,className:t.t(`space-y-1.5`,u),children:[o&&(0,l.jsx)(a.n,{children:o}),c&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:c}),(0,l.jsxs)(`div`,{className:t.t(`border rounded-lg overflow-hidden`),children:[p&&(0,l.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-2 border-b bg-muted/30`,children:[(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground font-medium`,children:`Differences :`}),b.added>0&&(0,l.jsxs)(r.t,{variant:`secondary`,className:`bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300 text-[10px] h-5`,children:[`+`,b.added,` ajout`,b.added>1?`s`:``]}),b.removed>0&&(0,l.jsxs)(r.t,{variant:`secondary`,className:`bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300 text-[10px] h-5`,children:[`-`,b.removed,` suppression`,b.removed>1?`s`:``]}),b.modified>0&&(0,l.jsxs)(r.t,{variant:`secondary`,className:`bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-300 text-[10px] h-5`,children:[`~`,b.modified,` modification`,b.modified>1?`s`:``]}),b.added===0&&b.removed===0&&b.modified===0&&(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Aucune difference`})]}),i===`side-by-side`?(0,l.jsxs)(`div`,{className:`flex divide-x`,style:{minHeight:f},children:[(0,l.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,l.jsx)(`div`,{className:`px-3 py-1.5 border-b bg-red-50/50 dark:bg-red-950/10 text-xs font-medium text-muted-foreground`,children:m}),(0,l.jsx)(P,{nodes:e,diffType:`original`,className:d})]}),(0,l.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,l.jsx)(`div`,{className:`px-3 py-1.5 border-b bg-green-50/50 dark:bg-green-950/10 text-xs font-medium text-muted-foreground`,children:h}),(0,l.jsx)(P,{nodes:n,diffType:`modified`,className:d})]})]}):(0,l.jsx)(`div`,{style:{minHeight:f},children:(0,l.jsx)(le,{diffNodes:v,className:d})})]})]})});ce.displayName=`WakaDiffViewer`;function P({nodes:e,diffType:n,className:r}){return(0,l.jsx)(`div`,{className:t.t(`prose prose-sm max-w-none p-4 text-sm`,r),children:e.map((e,t)=>(0,l.jsx)(ue,{node:e,diffType:n},t))})}function le({diffNodes:e,className:n}){return(0,l.jsx)(`div`,{className:t.t(`prose prose-sm max-w-none p-4 text-sm`,n),children:e.map((e,n)=>{let r=e.diff||e.diffOperation?.type,i=``;return r===`insert`?i=`bg-green-100/60 dark:bg-green-900/20`:r===`delete`?i=`bg-red-100/60 dark:bg-red-900/20 line-through opacity-60`:r===`update`&&(i=`bg-amber-100/60 dark:bg-amber-900/20`),(0,l.jsx)(`div`,{className:t.t(`rounded px-1 -mx-1`,i),children:(0,l.jsx)(ue,{node:e,diffType:`modified`})},n)})})}function ue({node:e,diffType:t}){if(!e)return null;let n=fe(e);switch(e.type||`p`){case`h1`:return(0,l.jsx)(`h1`,{className:`text-xl font-bold mt-4 mb-1`,children:n});case`h2`:return(0,l.jsx)(`h2`,{className:`text-lg font-semibold mt-3 mb-1`,children:n});case`h3`:return(0,l.jsx)(`h3`,{className:`text-base font-semibold mt-2 mb-1`,children:n});case`blockquote`:return(0,l.jsx)(`blockquote`,{className:`border-l-2 border-muted-foreground/30 pl-3 italic text-muted-foreground`,children:n});default:return(0,l.jsx)(`p`,{className:`my-0.5 leading-relaxed`,children:n||`\xA0`})}}function de({original:e,modified:t,mode:n,originalLabel:r,modifiedLabel:i,minHeight:a,editorClassName:o}){return n===`side-by-side`?(0,l.jsxs)(`div`,{className:`flex divide-x border rounded-lg overflow-hidden`,style:{minHeight:a},children:[(0,l.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,l.jsx)(`div`,{className:`px-3 py-1.5 border-b bg-red-50/50 dark:bg-red-950/10 text-xs font-medium text-muted-foreground`,children:r}),(0,l.jsx)(P,{nodes:e,diffType:`original`,className:o})]}),(0,l.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,l.jsx)(`div`,{className:`px-3 py-1.5 border-b bg-green-50/50 dark:bg-green-950/10 text-xs font-medium text-muted-foreground`,children:i}),(0,l.jsx)(P,{nodes:t,diffType:`modified`,className:o})]})]}):(0,l.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,style:{minHeight:a},children:(0,l.jsxs)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:[`Installez `,(0,l.jsx)(`code`,{className:`bg-muted px-1 rounded`,children:`@platejs/diff`}),` pour la visualisation unifiee des differences.`]})})}function fe(e){return typeof e?.text==`string`?e.text:Array.isArray(e?.children)?e.children.map(e=>fe(e)).join(``):``}t.n();var pe=s.forwardRef(({value:e,onChange:n,readOnly:r=!1,placeholder:i=`Tapez @ pour mentionner un utilisateur...`,className:o,editorClassName:c,minHeight:u=200,label:d,description:f,error:p,onSearch:m,onMentionInserted:h,trigger:g=`@`,searchDebounceMs:_=300,maxResults:v=8,extraPlugins:y,editorRef:b},x)=>{let[S,C]=s.useState(null),[w,T]=s.useState(!1),[E,D]=s.useState([]),[O,k]=s.useState(!1),A=s.useRef(),j=s.useRef({onSearch:m,trigger:g,searchDebounceMs:_,maxResults:v,onMentionInserted:h});j.current={onSearch:m,trigger:g,searchDebounceMs:_,maxResults:v,onMentionInserted:h},s.useEffect(()=>{let e=!1;return(async()=>{try{let t=j.current,[n,r,i,a,o,s,c]=await Promise.all([import(`platejs/react`),import(`@platejs/basic-nodes/react`),import(`@platejs/table/react`),import(`@platejs/layout/react`),import(`@platejs/callout/react`),import(`@platejs/link/react`),import(`@platejs/mention/react`)]),l=[r.BoldPlugin,r.ItalicPlugin,r.UnderlinePlugin,r.StrikethroughPlugin,r.CodePlugin,r.HighlightPlugin,r.H1Plugin,r.H2Plugin,r.H3Plugin,r.H4Plugin,r.BlockquotePlugin,i.TablePlugin,i.TableRowPlugin,i.TableCellPlugin,i.TableCellHeaderPlugin,a.ColumnPlugin,a.ColumnItemPlugin,o.CalloutPlugin,s.LinkPlugin.configure({options:{allowedSchemes:[`http`,`https`,`mailto`,`tel`]}}),c.MentionPlugin.configure({options:{trigger:t.trigger,triggerPreviousCharPattern:/^$|^[\s"']$/,insertSpaceAfterMention:!0}}),c.MentionInputPlugin];e||C({Plate:n.Plate,PlateContent:n.PlateContent,usePlateEditor:n.usePlateEditor,plugins:l})}catch(t){console.error(`[WakaMentionEditor] Failed to load:`,t),e||T(!0)}})(),()=>{e=!0}},[]);let M=s.useCallback(e=>{if(A.current&&clearTimeout(A.current),!e.trim()){D([]),k(!1);return}k(!0),A.current=setTimeout(async()=>{try{let t=j.current;D((await t.onSearch(e)).slice(0,t.maxResults))}catch{D([])}finally{k(!1)}},j.current.searchDebounceMs)},[]);return S?(0,l.jsx)(me,{ref:x,bundle:S,value:e,onChange:n,readOnly:r,placeholder:i,className:o,editorClassName:c,minHeight:u,label:d,description:f,error:p,suggestions:E,searching:O,onSearch:M,onMentionInserted:h,extraPlugins:y,editorRef:b}):(0,l.jsxs)(`div`,{ref:x,className:t.t(`space-y-1.5`,o),children:[d&&(0,l.jsx)(a.n,{children:d}),f&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f}),(0,l.jsxs)(`div`,{className:`relative`,children:[(0,l.jsx)(a.t,{placeholder:i,disabled:!0,style:{minHeight:u}}),(0,l.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-background/50 rounded-lg`,children:(0,l.jsx)(`span`,{className:`text-sm text-muted-foreground animate-pulse`,children:w?`Erreur (@platejs/mention requis)`:`Chargement...`})})]}),p&&(0,l.jsx)(`p`,{className:`text-sm text-destructive`,children:p})]})});pe.displayName=`WakaMentionEditor`;var me=s.forwardRef(({bundle:{Plate:e,PlateContent:n,usePlateEditor:r,plugins:i},value:o,onChange:c,readOnly:u,placeholder:d,className:f,editorClassName:p,minHeight:m,label:h,description:g,error:_,suggestions:v,searching:y,extraPlugins:b,editorRef:x},S)=>{let C=r({plugins:s.useMemo(()=>[...i,...b??[]],[i,b]),value:o??[{type:`p`,children:[{text:``}]}]});return s.useEffect(()=>{x&&(x.current=C)},[C,x]),(0,l.jsxs)(`div`,{ref:S,className:t.t(`space-y-1.5`,f),children:[h&&(0,l.jsx)(a.n,{children:h}),g&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:g}),(0,l.jsx)(e,{editor:C,onChange:c?({value:e})=>c(e):void 0,readOnly:u,children:(0,l.jsxs)(`div`,{className:t.t(`border rounded-lg overflow-hidden relative`,_&&`border-destructive`),children:[(0,l.jsx)(`div`,{style:{minHeight:m},children:(0,l.jsx)(n,{placeholder:d,readOnly:u,className:t.t(`prose prose-sm max-w-none p-4`,`focus-within:outline-none`,`[&_[data-slate-editor]]:outline-none [&_[data-slate-editor]]:min-h-[inherit]`,p)})}),v.length>0&&(0,l.jsx)(he,{suggestions:v,searching:y})]})}),_&&(0,l.jsx)(`p`,{className:`text-sm text-destructive`,children:_})]})});me.displayName=`MentionEditorInner`;function he({suggestions:e,searching:r,className:i,onSelect:a}){return(0,l.jsxs)(`div`,{className:t.t(`absolute z-50 w-64 max-h-60 overflow-y-auto`,`rounded-lg border bg-popover shadow-lg`,`p-1 mt-1`,i),children:[r&&(0,l.jsx)(`div`,{className:`px-2 py-1.5 text-xs text-muted-foreground animate-pulse`,children:`Recherche...`}),e.map(e=>(0,l.jsxs)(`button`,{type:`button`,className:t.t(`flex w-full items-center gap-2.5 rounded-md px-2 py-1.5 text-left`,`text-sm transition-colors cursor-pointer`,`hover:bg-accent/50`),onClick:()=>a?.(e),children:[(0,l.jsxs)(n.m,{className:`h-6 w-6`,children:[e.avatar&&(0,l.jsx)(n.g,{src:e.avatar,alt:e.name}),(0,l.jsx)(n.h,{className:`text-[10px] bg-primary/10 text-primary`,children:e.name.slice(0,2).toUpperCase()})]}),(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`font-medium truncate`,children:e.name}),e.email&&(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground truncate`,children:e.email})]}),e.role&&(0,l.jsx)(`span`,{className:`text-[10px] text-muted-foreground shrink-0`,children:e.role})]},e.id))]})}he.displayName=`MentionSuggestions`,t.n();function ge({children:e,attributes:n,className:r}){return(0,l.jsx)(`table`,{...n,className:t.t(`w-full border-collapse text-sm my-4`,`border border-border rounded-lg overflow-hidden`,r),children:(0,l.jsx)(`tbody`,{children:e})})}ge.displayName=`TableElement`;function _e({children:e,attributes:n,className:r}){return(0,l.jsx)(`tr`,{...n,className:t.t(`border-b border-border last:border-b-0`,r),children:e})}_e.displayName=`TableRowElement`;function ve({children:e,attributes:n,className:r}){return(0,l.jsx)(`td`,{...n,className:t.t(`px-3 py-2 text-sm text-foreground`,`border-r border-border last:border-r-0`,r),children:e})}ve.displayName=`TableCellElement`;function ye({children:e,attributes:n,className:r}){return(0,l.jsx)(`th`,{...n,className:t.t(`px-3 py-2 text-xs font-bold uppercase tracking-wider`,`text-muted-foreground text-left bg-muted/50`,`border-r border-border last:border-r-0`,r),children:e})}ye.displayName=`TableCellHeaderElement`;function be({children:e,attributes:n,className:r}){return(0,l.jsx)(`div`,{...n,className:t.t(`flex gap-6 my-4`,r),children:e})}be.displayName=`ColumnGroupElement`;function xe({children:e,attributes:n,className:r}){return(0,l.jsx)(`div`,{...n,className:t.t(`flex-1 min-w-0`,r),children:e})}xe.displayName=`ColumnElement`;var Se={info:`bg-blue-50 border-blue-200 text-blue-900 dark:bg-blue-950/30 dark:border-blue-800 dark:text-blue-200`,warning:`bg-amber-50 border-amber-200 text-amber-900 dark:bg-amber-950/30 dark:border-amber-800 dark:text-amber-200`,success:`bg-green-50 border-green-200 text-green-900 dark:bg-green-950/30 dark:border-green-800 dark:text-green-200`,error:`bg-red-50 border-red-200 text-red-900 dark:bg-red-950/30 dark:border-red-800 dark:text-red-200`,dark:`bg-card border-border text-card-foreground`};function Ce({children:e,attributes:n,element:r,className:i}){let a=Se[r?.variant||`info`]??Se.info;return(0,l.jsx)(`div`,{...n,className:t.t(`border rounded-xl p-4 my-3`,a,i),children:e})}Ce.displayName=`CalloutElement`;function we({children:e,attributes:n,className:r}){return(0,l.jsx)(`h1`,{...n,className:t.t(`text-2xl font-extrabold text-foreground mt-8 mb-2 first:mt-0`,r),children:e})}we.displayName=`H1Element`;function Te({children:e,attributes:n,className:r}){return(0,l.jsx)(`h2`,{...n,className:t.t(`text-sm font-bold text-foreground uppercase tracking-wider`,`mt-6 mb-3 border-b-2 border-border pb-1.5`,r),children:e})}Te.displayName=`H2Element`;function Ee({children:e,attributes:n,className:r}){return(0,l.jsx)(`h3`,{...n,className:t.t(`text-sm font-semibold text-primary italic mt-1 mb-4`,r),children:e})}Ee.displayName=`H3Element`;function De({children:e,attributes:n,className:r}){return(0,l.jsx)(`h4`,{...n,className:t.t(`text-xs font-bold text-primary uppercase tracking-wide mt-2 mb-0.5`,r),children:e})}De.displayName=`H4Element`;function Oe({children:e,attributes:n,className:r}){return(0,l.jsx)(`h5`,{...n,className:t.t(`text-xs font-semibold text-muted-foreground mt-2 mb-0.5`,r),children:e})}Oe.displayName=`H5Element`;function ke({children:e,attributes:n,className:r}){return(0,l.jsx)(`h6`,{...n,className:t.t(`text-xs font-medium text-muted-foreground mt-2 mb-0.5`,r),children:e})}ke.displayName=`H6Element`;function Ae({children:e,attributes:n,className:r}){return(0,l.jsx)(`blockquote`,{...n,className:t.t(`border-l-3 border-primary/50 pl-4 py-2`,`bg-muted/30 rounded-r-lg`,`italic text-muted-foreground`,`my-3`,r),children:e})}Ae.displayName=`BlockquoteElement`;function je({children:e,attributes:n,className:r}){return(0,l.jsx)(`p`,{...n,className:t.t(`text-sm leading-relaxed text-foreground my-0.5`,r),children:e})}je.displayName=`ParagraphElement`;function Me({children:e,attributes:n,element:r,className:i}){return(0,l.jsx)(`a`,{...n,href:r?.url,target:`_blank`,rel:`noopener noreferrer`,className:t.t(`text-primary underline decoration-primary/30 hover:decoration-primary`,`transition-colors cursor-pointer`,i),children:e})}Me.displayName=`LinkElement`;function Ne({children:e,attributes:n,element:r,className:i}){return(0,l.jsxs)(`span`,{...n,contentEditable:!1,className:t.t(`inline-flex items-center rounded-md px-1.5 py-0.5`,`bg-primary/10 text-primary text-sm font-medium`,`border border-primary/20`,i),children:[`@`,r?.value||`unknown`,e]})}Ne.displayName=`MentionElement`;function Pe({attributes:e,className:n}){return(0,l.jsx)(`div`,{...e,className:t.t(`my-6`,n),children:(0,l.jsx)(`hr`,{className:`border-border`})})}Pe.displayName=`SeparatorElement`,t.n();function Fe({children:e,attributes:n,className:r}){return(0,l.jsx)(`strong`,{...n,className:t.t(`font-bold`,r),children:e})}Fe.displayName=`BoldLeaf`;function Ie({children:e,attributes:n,className:r}){return(0,l.jsx)(`em`,{...n,className:t.t(`italic`,r),children:e})}Ie.displayName=`ItalicLeaf`;function Le({children:e,attributes:n,className:r}){return(0,l.jsx)(`span`,{...n,className:t.t(`underline decoration-foreground/50`,r),children:e})}Le.displayName=`UnderlineLeaf`;function Re({children:e,attributes:n,className:r}){return(0,l.jsx)(`s`,{...n,className:t.t(`line-through text-muted-foreground`,r),children:e})}Re.displayName=`StrikethroughLeaf`;function ze({children:e,attributes:n,className:r}){return(0,l.jsx)(`code`,{...n,className:t.t(`rounded-md bg-muted px-1.5 py-0.5`,`font-mono text-[0.85em] text-foreground`,r),children:e})}ze.displayName=`CodeLeaf`;function Be({children:e,attributes:n,className:r}){return(0,l.jsx)(`mark`,{...n,className:t.t(`bg-yellow-200/60 dark:bg-yellow-500/30`,`rounded-sm px-0.5`,r),children:e})}Be.displayName=`HighlightLeaf`;function Ve({children:e,attributes:n,className:r}){return(0,l.jsx)(`sup`,{...n,className:t.t(`text-[0.75em]`,r),children:e})}Ve.displayName=`SuperscriptLeaf`;function He({children:e,attributes:n,className:r}){return(0,l.jsx)(`sub`,{...n,className:t.t(`text-[0.75em]`,r),children:e})}He.displayName=`SubscriptLeaf`;var Ue=e.r({USER_STORY_BLOCK_TYPE:()=>I,WakaUserStoryBlock:()=>F,createUserStoryNodes:()=>Ge,createUserStoryPlugin:()=>Ke});function We({label:e,icon:n,value:r,placeholder:i,readOnly:a,onChange:o}){return(0,l.jsxs)(`div`,{className:`flex items-start gap-3 group`,children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-1.5 pt-1 shrink-0 w-[90px]`,children:[(0,l.jsx)(`span`,{className:`text-blue-500 dark:text-blue-400`,children:n}),(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-wider text-blue-600 dark:text-blue-400`,children:e})]}),(0,l.jsx)(`div`,{className:`flex-1 min-w-0`,children:a?(0,l.jsx)(`p`,{className:`text-sm text-foreground py-1`,children:r||(0,l.jsx)(`span`,{className:`text-muted-foreground italic`,children:i})}):(0,l.jsx)(`input`,{type:`text`,value:r,onChange:e=>o?.(e.target.value),placeholder:i,className:t.t(`w-full bg-transparent text-sm text-foreground py-1 px-0`,`border-0 border-b border-transparent`,`focus:border-blue-300 dark:focus:border-blue-600`,`focus:outline-none transition-colors`,`placeholder:text-muted-foreground/50 placeholder:italic`)})})]})}function F({attributes:e,children:n,element:r,className:i}){let a=r,o=a?.priority,s=a?.storyId,c=a?.points;return(0,l.jsxs)(`div`,{...e,contentEditable:!1,className:t.t(`relative my-4 rounded-lg overflow-hidden`,`border-l-4 border-blue-500 dark:border-blue-400`,`bg-blue-50/50 dark:bg-blue-950/20`,`border border-blue-200/60 dark:border-blue-800/40`,`shadow-sm hover:shadow-md transition-shadow duration-200`,i),children:[(0,l.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 bg-blue-100/50 dark:bg-blue-900/20 border-b border-blue-200/40 dark:border-blue-800/30`,children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,l.jsx)(`svg`,{className:`h-4 w-4 text-blue-600 dark:text-blue-400`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:(0,l.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z`})}),(0,l.jsx)(`span`,{className:`text-xs font-bold uppercase tracking-wider text-blue-700 dark:text-blue-300`,children:`User Story`}),s&&(0,l.jsx)(`span`,{className:`text-[10px] font-mono font-semibold text-blue-500 dark:text-blue-400 bg-blue-100 dark:bg-blue-800/40 px-1.5 py-0.5 rounded`,children:s})]}),(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c!==void 0&&(0,l.jsx)(`span`,{className:`inline-flex items-center justify-center h-5 min-w-[20px] px-1 rounded-full bg-blue-200 dark:bg-blue-700/50 text-[10px] font-bold text-blue-800 dark:text-blue-200`,children:c}),o&&L[o]&&(0,l.jsx)(`span`,{className:t.t(`text-[10px] font-semibold px-2 py-0.5 rounded-full`,L[o].bg,L[o].color),children:L[o].label})]})]}),(0,l.jsxs)(`div`,{className:`px-4 py-3 space-y-2`,children:[(0,l.jsx)(We,{label:`As a`,icon:(0,l.jsx)(`svg`,{className:`h-3 w-3`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,children:(0,l.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z`})}),value:a?.role||``,placeholder:`role (e.g. platform administrator)`,readOnly:!0}),(0,l.jsx)(We,{label:`I want`,icon:(0,l.jsx)(`svg`,{className:`h-3 w-3`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,children:(0,l.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M13 10V3L4 14h7v7l9-11h-7z`})}),value:a?.action||``,placeholder:`action (e.g. to deploy services with one click)`,readOnly:!0}),(0,l.jsx)(We,{label:`So that`,icon:(0,l.jsx)(`svg`,{className:`h-3 w-3`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,children:(0,l.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z`})}),value:a?.benefit||``,placeholder:`benefit (e.g. I can reduce time-to-market)`,readOnly:!0})]}),(0,l.jsx)(`div`,{className:`hidden`,children:n})]})}function Ge(e){return[{type:I,role:e?.role||``,action:e?.action||``,benefit:e?.benefit||``,storyId:e?.storyId,priority:e?.priority,points:e?.points,children:[{text:``}]}]}async function Ke(){try{let{createPlatePlugin:e}=await import(`platejs/react`);return e({key:I,node:{isElement:!0,isVoid:!0,type:I,component:F}})}catch{return console.warn(`[WakaUserStoryBlock] platejs not installed`),null}}var I,L,qe=e.n((()=>{t.n(),I=`user_story`,L={must:{label:`Must Have`,color:`text-red-700 dark:text-red-400`,bg:`bg-red-50 dark:bg-red-500/10`},should:{label:`Should Have`,color:`text-amber-700 dark:text-amber-400`,bg:`bg-amber-50 dark:bg-amber-500/10`},could:{label:`Could Have`,color:`text-blue-700 dark:text-blue-400`,bg:`bg-blue-50 dark:bg-blue-500/10`},wont:{label:`Won't Have`,color:`text-gray-500 dark:text-gray-400`,bg:`bg-gray-50 dark:bg-gray-500/10`}},F.displayName=`WakaUserStoryBlock`})),Je=e.r({ACCEPTANCE_CRITERIA_BLOCK_TYPE:()=>z,WakaAcceptanceCriteriaBlock:()=>R,createAcceptanceCriteriaNodes:()=>Ze,createAcceptanceCriteriaPlugin:()=>Qe});function Ye({keyword:e,variant:n}){return(0,l.jsx)(`span`,{className:t.t(`inline-block text-[10px] font-bold uppercase tracking-wider px-1.5 py-0.5 rounded shrink-0 w-[52px] text-center`,{given:`bg-violet-100 text-violet-700 dark:bg-violet-500/15 dark:text-violet-400`,when:`bg-amber-100 text-amber-700 dark:bg-amber-500/15 dark:text-amber-400`,then:`bg-emerald-100 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-400`}[n]),children:e})}function Xe({criterion:e,index:n,readOnly:r}){let[i,a]=s.useState(!0);return(0,l.jsxs)(`div`,{className:t.t(`rounded-lg border transition-all duration-200`,e.validated?`border-emerald-200 dark:border-emerald-800/40 bg-emerald-50/30 dark:bg-emerald-950/10`:`border-border bg-card/50`),children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2`,children:[(0,l.jsx)(`button`,{type:`button`,disabled:r,className:t.t(`flex-shrink-0 h-5 w-5 rounded-md border-2 flex items-center justify-center transition-all duration-200`,e.validated?`bg-emerald-500 border-emerald-500 text-white`:`border-border hover:border-emerald-400`,r&&`cursor-default`),"aria-label":e.validated?`Mark as not validated`:`Mark as validated`,"aria-checked":e.validated,role:`checkbox`,children:e.validated&&(0,l.jsx)(`svg`,{className:`h-3 w-3`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:3,children:(0,l.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 13l4 4L19 7`})})}),(0,l.jsx)(`span`,{className:`text-[10px] font-mono font-bold text-muted-foreground bg-muted px-1.5 py-0.5 rounded shrink-0`,children:e.id}),(0,l.jsx)(`span`,{className:t.t(`text-sm font-medium flex-1 min-w-0 truncate`,e.validated&&`line-through text-muted-foreground`),children:e.scenario||`Unnamed scenario`}),(0,l.jsx)(`button`,{type:`button`,onClick:()=>a(!i),className:`text-muted-foreground hover:text-foreground transition-colors p-0.5`,"aria-label":i?`Collapse`:`Expand`,children:(0,l.jsx)(`svg`,{className:t.t(`h-3.5 w-3.5 transition-transform duration-200`,i&&`rotate-180`),viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,children:(0,l.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M19 9l-7 7-7-7`})})})]}),i&&(0,l.jsxs)(`div`,{className:`px-3 pb-3 pt-1 space-y-1.5 border-t border-border/50`,children:[(0,l.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,l.jsx)(Ye,{keyword:`Given`,variant:`given`}),(0,l.jsx)(`span`,{className:`text-sm text-foreground/80 pt-0.5`,children:e.given||(0,l.jsx)(`span`,{className:`italic text-muted-foreground`,children:`precondition...`})})]}),(0,l.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,l.jsx)(Ye,{keyword:`When`,variant:`when`}),(0,l.jsx)(`span`,{className:`text-sm text-foreground/80 pt-0.5`,children:e.when||(0,l.jsx)(`span`,{className:`italic text-muted-foreground`,children:`action...`})})]}),(0,l.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,l.jsx)(Ye,{keyword:`Then`,variant:`then`}),(0,l.jsx)(`span`,{className:`text-sm text-foreground/80 pt-0.5`,children:e.then||(0,l.jsx)(`span`,{className:`italic text-muted-foreground`,children:`expected result...`})})]})]})]})}function R({attributes:e,children:n,element:r,className:i}){let a=r,o=a?.criteria||[],s=a?.title||`Acceptance Criteria`,c=o.filter(e=>e.validated).length,u=o.length,d=u>0?c/u*100:0;return(0,l.jsxs)(`div`,{...e,contentEditable:!1,className:t.t(`my-4 rounded-lg overflow-hidden`,`border border-border`,`bg-card/30`,`shadow-sm`,i),children:[(0,l.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2.5 bg-muted/30 border-b border-border`,children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,l.jsx)(`svg`,{className:`h-4 w-4 text-emerald-600 dark:text-emerald-400`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:(0,l.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4`})}),(0,l.jsx)(`span`,{className:`text-xs font-bold uppercase tracking-wider text-foreground`,children:s})]}),(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,l.jsxs)(`span`,{className:`text-[10px] font-medium text-muted-foreground`,children:[c,`/`,u]}),(0,l.jsx)(`div`,{className:`w-16 h-1.5 bg-muted rounded-full overflow-hidden`,children:(0,l.jsx)(`div`,{className:`h-full bg-emerald-500 rounded-full transition-all duration-500`,style:{width:`${d}%`}})})]})]}),(0,l.jsx)(`div`,{className:`p-3 space-y-2`,children:o.length>0?o.map((e,t)=>(0,l.jsx)(Xe,{criterion:e,index:t,readOnly:!0},e.id)):(0,l.jsx)(`div`,{className:`py-6 text-center text-sm text-muted-foreground italic`,children:`No acceptance criteria defined yet.`})}),(0,l.jsx)(`div`,{className:`hidden`,children:n})]})}function Ze(e){return[{type:z,title:e?.title||`Acceptance Criteria`,criteria:e?.criteria||[{id:`AC-01`,scenario:`Nominal case`,given:`The user is authenticated`,when:`They perform the action`,then:`The expected result is displayed`,validated:!1},{id:`AC-02`,scenario:`Error case`,given:`The service is unavailable`,when:`They perform the action`,then:`An error message is displayed`,validated:!1}],children:[{text:``}]}]}async function Qe(){try{let{createPlatePlugin:e}=await import(`platejs/react`);return e({key:z,node:{isElement:!0,isVoid:!0,type:z,component:R}})}catch{return console.warn(`[WakaAcceptanceCriteriaBlock] platejs not installed`),null}}var z,$e=e.n((()=>{t.n(),z=`acceptance_criteria`,R.displayName=`WakaAcceptanceCriteriaBlock`})),et=e.r({API_ENDPOINT_BLOCK_TYPE:()=>V,WakaApiEndpointBlock:()=>B,createApiEndpointNodes:()=>it,createApiEndpointPlugin:()=>at});function tt({method:e}){let n=H[e]||H.GET;return(0,l.jsx)(`span`,{className:t.t(`inline-flex items-center px-2 py-0.5 rounded text-[11px] font-bold font-mono tracking-wide border`,n.bg,n.text,n.border),children:e})}function nt({status:e}){return(0,l.jsx)(`span`,{className:t.t(`text-[11px] font-mono font-bold px-1.5 py-0.5 rounded`,e<300?`text-emerald-700 dark:text-emerald-400 bg-emerald-50 dark:bg-emerald-500/10`:e<400?`text-blue-700 dark:text-blue-400 bg-blue-50 dark:bg-blue-500/10`:e<500?`text-amber-700 dark:text-amber-400 bg-amber-50 dark:bg-amber-500/10`:`text-red-700 dark:text-red-400 bg-red-50 dark:bg-red-500/10`),children:e})}function rt({code:e,label:n}){let[r,i]=s.useState(!1),a=e.split(`
|
|
29
29
|
`).length>6;return(0,l.jsxs)(`div`,{className:`mt-2`,children:[(0,l.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,l.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wider text-muted-foreground`,children:n}),a&&(0,l.jsx)(`button`,{type:`button`,onClick:()=>i(!r),className:`text-[10px] text-primary hover:underline`,children:r?`Collapse`:`Expand`})]}),(0,l.jsxs)(`pre`,{className:t.t(`text-[12px] font-mono leading-relaxed p-3 rounded-md overflow-x-auto`,`bg-gray-950 dark:bg-gray-900 text-gray-100`,`border border-gray-800/50`,!r&&a&&`max-h-[150px] overflow-hidden relative`),children:[!r&&a&&(0,l.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 h-10 bg-gradient-to-t from-gray-950 dark:from-gray-900 to-transparent`}),(0,l.jsx)(`code`,{children:e})]})]})}function B({attributes:e,children:n,element:r,className:i}){let a=r,o=a?.method||`GET`,c=a?.route||`/api/v1/resource`,u=H[o]||H.GET,[d,f]=s.useState(a?.params&&a.params.length>0?`params`:a?.requestBody?`body`:`responses`);return(0,l.jsxs)(`div`,{...e,contentEditable:!1,className:t.t(`my-4 rounded-lg overflow-hidden`,`border`,u.border,`shadow-sm`,i),children:[(0,l.jsxs)(`div`,{className:t.t(`flex items-center gap-3 px-4 py-3`,u.bg),children:[(0,l.jsx)(tt,{method:o}),(0,l.jsx)(`code`,{className:t.t(`text-sm font-mono font-semibold`,u.text),children:c})]}),(0,l.jsxs)(`div`,{className:`px-4 py-3 border-b border-border/50 bg-card/50`,children:[a?.description&&(0,l.jsx)(`p`,{className:`text-sm text-foreground mb-2`,children:a.description}),(0,l.jsxs)(`div`,{className:`flex flex-wrap gap-3 text-[11px]`,children:[a?.auth&&(0,l.jsxs)(`div`,{className:`flex items-center gap-1 text-muted-foreground`,children:[(0,l.jsx)(`svg`,{className:`h-3 w-3`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,children:(0,l.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z`})}),(0,l.jsx)(`span`,{className:`font-medium`,children:a.auth})]}),a?.permissions&&a.permissions.length>0&&(0,l.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,l.jsx)(`svg`,{className:`h-3 w-3 text-muted-foreground`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,children:(0,l.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z`})}),a.permissions.map((e,t)=>(0,l.jsx)(`span`,{className:`px-1.5 py-0.5 rounded bg-muted text-muted-foreground font-mono text-[10px]`,children:e},t))]}),a?.rateLimit&&(0,l.jsxs)(`div`,{className:`flex items-center gap-1 text-muted-foreground`,children:[(0,l.jsx)(`svg`,{className:`h-3 w-3`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,children:(0,l.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z`})}),(0,l.jsx)(`span`,{className:`font-medium`,children:a.rateLimit})]})]})]}),(0,l.jsx)(`div`,{className:`flex border-b border-border/50`,children:[{id:`params`,label:`Parameters`,count:a?.params?.length},{id:`body`,label:`Request Body`,show:!!a?.requestBody},{id:`responses`,label:`Responses`,count:a?.responses?.length}].filter(e=>e.show!==!1&&(e.count===void 0||e.count>0)).map(e=>(0,l.jsxs)(`button`,{type:`button`,onClick:()=>f(e.id),className:t.t(`px-4 py-2 text-xs font-medium transition-colors relative`,d===e.id?`text-foreground`:`text-muted-foreground hover:text-foreground`),children:[e.label,e.count!==void 0&&(0,l.jsxs)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:[`(`,e.count,`)`]}),d===e.id&&(0,l.jsx)(`div`,{className:t.t(`absolute bottom-0 left-0 right-0 h-0.5`,u.bg.replace(`bg-`,`bg-`).replace(`/15`,``)),style:{backgroundColor:o===`GET`?`#10b981`:o===`POST`?`#3b82f6`:o===`PUT`?`#f59e0b`:o===`DELETE`?`#ef4444`:`#6b7280`}})]},e.id))}),(0,l.jsxs)(`div`,{className:`px-4 py-3`,children:[d===`params`&&a?.params&&a.params.length>0&&(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{className:`border-b border-border`,children:[(0,l.jsx)(`th`,{className:`text-left font-semibold text-muted-foreground py-1.5 pr-4`,children:`Name`}),(0,l.jsx)(`th`,{className:`text-left font-semibold text-muted-foreground py-1.5 pr-4`,children:`Type`}),(0,l.jsx)(`th`,{className:`text-left font-semibold text-muted-foreground py-1.5 pr-4`,children:`Required`}),(0,l.jsx)(`th`,{className:`text-left font-semibold text-muted-foreground py-1.5`,children:`Description`})]})}),(0,l.jsx)(`tbody`,{children:a.params.map((e,t)=>(0,l.jsxs)(`tr`,{className:`border-b border-border/30`,children:[(0,l.jsx)(`td`,{className:`py-1.5 pr-4 font-mono font-medium text-foreground`,children:e.name}),(0,l.jsx)(`td`,{className:`py-1.5 pr-4 font-mono text-muted-foreground`,children:e.type}),(0,l.jsx)(`td`,{className:`py-1.5 pr-4`,children:e.required?(0,l.jsx)(`span`,{className:`text-red-600 dark:text-red-400 font-semibold`,children:`required`}):(0,l.jsx)(`span`,{className:`text-muted-foreground`,children:`optional`})}),(0,l.jsx)(`td`,{className:`py-1.5 text-muted-foreground`,children:e.description})]},t))})]})}),d===`body`&&a?.requestBody&&(0,l.jsx)(rt,{code:a.requestBody,label:`Request Body`}),d===`responses`&&a?.responses&&(0,l.jsx)(`div`,{className:`space-y-3`,children:a.responses.map((e,t)=>(0,l.jsxs)(`div`,{children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,l.jsx)(nt,{status:e.status}),(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.description})]}),e.body&&(0,l.jsx)(rt,{code:e.body,label:`Response ${e.status}`})]},t))})]}),(0,l.jsx)(`div`,{className:`hidden`,children:n})]})}function it(e){return[{type:V,method:e?.method||`GET`,route:e?.route||`/api/v1/resource/:id`,description:e?.description||`Retrieves a resource by its unique identifier.`,auth:e?.auth||`Bearer JWT`,permissions:e?.permissions||[`ROLE_USER`],rateLimit:e?.rateLimit||`100 req/min`,params:e?.params||[{name:`id`,type:`UUID`,required:!0,description:`Resource unique identifier`}],requestBody:e?.requestBody,responses:e?.responses||[{status:200,description:`Success`,body:`{
|
|
30
30
|
"data": {
|
|
31
31
|
"id": "uuid",
|
package/dist/editor.es.js
CHANGED
|
@@ -4,7 +4,7 @@ import { a as o, c as s, d as c, f as l, g as u, h as d, l as f, m as p, s as m,
|
|
|
4
4
|
import { t as g } from "./badge-BfiocODp.mjs";
|
|
5
5
|
import { n as _, t as v } from "./separator-ibN2mycs.mjs";
|
|
6
6
|
import { n as y, t as b } from "./textarea-DJDXJ3nd.mjs";
|
|
7
|
-
import { a as x, c as S, d as C, f as w, h as T, i as E, l as D, m as O, n as k, o as A, p as j, r as ee, s as te, t as ne, u as re } from "./waka-editor-plugins-
|
|
7
|
+
import { a as x, c as S, d as C, f as w, h as T, i as E, l as D, m as O, n as k, o as A, p as j, r as ee, s as te, t as ne, u as re } from "./waka-editor-plugins-Dwh4Vreq.mjs";
|
|
8
8
|
import * as M from "react";
|
|
9
9
|
import { AlertTriangle as ie, Bold as ae, BookOpen as oe, CheckCircle2 as se, Code as ce, Columns2 as le, Database as ue, GitBranch as de, Heading1 as fe, Heading2 as pe, Heading3 as me, Highlighter as he, Image as ge, Italic as _e, Link as ve, List as ye, ListOrdered as be, MessageSquarePlus as xe, Minus as Se, Quote as Ce, Shield as we, Sparkles as Te, Strikethrough as Ee, Table as De, Underline as Oe, Users as ke, Zap as Ae } from "lucide-react";
|
|
10
10
|
import { Fragment as je, jsx as N, jsxs as P } from "react/jsx-runtime";
|
|
@@ -259,7 +259,7 @@ var Fe = M.forwardRef(({ value: e, onChange: t, readOnly: n = !1, placeholder: r
|
|
|
259
259
|
let e = !1;
|
|
260
260
|
return (async () => {
|
|
261
261
|
try {
|
|
262
|
-
let [t, n] = await Promise.all([import("platejs/react"), import("./waka-editor-plugins-
|
|
262
|
+
let [t, n] = await Promise.all([import("platejs/react"), import("./waka-editor-plugins-Dwh4Vreq.mjs").then((e) => e.g)]), r = await n.loadCorePlugins(), i = n.getPresetLoaders(u), a = await Promise.all(i.map((e) => e())), o = [];
|
|
263
263
|
f && o.push(n.loadMarkdownPlugin()), p && o.push(n.loadMediaPlugins()), m && o.push(n.loadMentionPlugins()), h && o.push(n.loadDndPlugin()), g && o.push(n.loadTocPlugin());
|
|
264
264
|
let s = await Promise.all(o), c = [
|
|
265
265
|
...r,
|
|
@@ -1257,7 +1257,7 @@ var Ke = M.forwardRef(({ value: e, onChange: t, readOnly: n = !1, placeholder: r
|
|
|
1257
1257
|
} }), t);
|
|
1258
1258
|
} catch {}
|
|
1259
1259
|
if (t.enableDnD) try {
|
|
1260
|
-
let { DndPlugin: e } = await import("@platejs/dnd
|
|
1260
|
+
let { DndPlugin: e } = await import("@platejs/dnd");
|
|
1261
1261
|
l.push(e);
|
|
1262
1262
|
} catch {}
|
|
1263
1263
|
if (t.enableMarkdown) try {
|
|
@@ -2750,7 +2750,7 @@ var tt = M.forwardRef(({ value: e, onChange: t, readOnly: n = !1, placeholder: r
|
|
|
2750
2750
|
import("@platejs/layout/react"),
|
|
2751
2751
|
import("@platejs/callout/react"),
|
|
2752
2752
|
import("@platejs/link/react"),
|
|
2753
|
-
import("@platejs/dnd
|
|
2753
|
+
import("@platejs/dnd"),
|
|
2754
2754
|
import("@platejs/selection/react")
|
|
2755
2755
|
]), l = [
|
|
2756
2756
|
n.BoldPlugin,
|