bi-components-library 1.3.2-next.38 → 1.3.2-next.39
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/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -143,7 +143,7 @@ img.ProseMirror-separator {
|
|
|
143
143
|
`);return!a||!i?!1:e.chain().command(({tr:s})=>(s.delete(l.pos-2,l.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:l}=t,{$from:r,empty:a}=n;if(!a||r.parent.type!==this.type||!(r.parentOffset===r.parent.nodeSize-2))return!1;const s=r.after();return s===void 0?!1:l.nodeAt(s)?e.commands.command(({tr:u})=>(u.setSelection(ve.near(l.resolve(s))),!0)):e.commands.exitCode()}}},addInputRules(){return[No({find:M3,type:this.type,getAttributes:e=>({language:e[1]})}),No({find:D3,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new dt({key:new Rt("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),l=t.clipboardData.getData("vscode-editor-data"),r=l?JSON.parse(l):void 0,a=r?.mode;if(!n||!a)return!1;const{tr:i,schema:s}=e.state,o=s.text(n.replace(/\r\n?/g,`
|
|
144
144
|
`));return i.replaceSelectionWith(this.type.create({language:a},o)),i.selection.$from.parent.type!==this.type&&i.setSelection(pe.near(i.doc.resolve(Math.max(0,i.selection.from-2)))),i.setMeta("paste",!0),e.dispatch(i),!0}}})]}}),P3=Et.create({name:"doc",topNode:!0,content:"block+"});function B3(e={}){return new dt({view(t){return new R3(t,e)}})}class R3{constructor(t,n){var l;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(l=n.width)!==null&&l!==void 0?l:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let a=i=>{this[r](i)};return t.dom.addEventListener(r,a),{name:r,handler:a}})}destroy(){this.handlers.forEach(({name:t,handler:n})=>this.editorView.dom.removeEventListener(t,n))}update(t,n){this.cursorPos!=null&&n.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,l,r=this.editorView.dom,a=r.getBoundingClientRect(),i=a.width/r.offsetWidth,s=a.height/r.offsetHeight;if(n){let d=t.nodeBefore,f=t.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let m=h.getBoundingClientRect(),g=d?m.bottom:m.top;d&&f&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let v=this.width/2*s;l={left:m.left,right:m.right,top:g-v,bottom:g+v}}}}if(!l){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*i;l={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let o=this.editorView.dom.offsetParent;this.element||(this.element=o.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let u,c;if(!o||o==document.body&&getComputedStyle(o).position=="static")u=-pageXOffset,c=-pageYOffset;else{let d=o.getBoundingClientRect(),f=d.width/o.offsetWidth,h=d.height/o.offsetHeight;u=d.left-o.scrollLeft*f,c=d.top-o.scrollTop*h}this.element.style.left=(l.left-u)/i+"px",this.element.style.top=(l.top-c)/s+"px",this.element.style.width=(l.right-l.left)/i+"px",this.element.style.height=(l.bottom-l.top)/s+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),t)}dragover(t){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),l=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),r=l&&l.type.spec.disableDropCursor,a=typeof r=="function"?r(this.editorView,n,t):r;if(n&&!a){let i=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let s=hh(this.editorView.state.doc,i,this.editorView.dragging.slice);s!=null&&(i=s)}this.setCursor(i),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)}}const F3=it.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[B3(this.options)]}});class Fe extends ve{constructor(t){super(t,t)}map(t,n){let l=t.resolve(n.map(this.head));return Fe.valid(l)?new Fe(l):ve.near(l)}content(){return Z.empty}eq(t){return t instanceof Fe&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Fe(t.resolve(n.pos))}getBookmark(){return new Bo(this.anchor)}static valid(t){let n=t.parent;if(n.inlineContent||!H3(t)||!U3(t))return!1;let l=n.type.spec.allowGapCursor;if(l!=null)return l;let r=n.contentMatchAt(t.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,l=!1){e:for(;;){if(!l&&Fe.valid(t))return t;let r=t.pos,a=null;for(let i=t.depth;;i--){let s=t.node(i);if(n>0?t.indexAfter(i)<s.childCount:t.index(i)>0){a=s.child(n>0?t.indexAfter(i):t.index(i)-1);break}else if(i==0)return null;r+=n;let o=t.doc.resolve(r);if(Fe.valid(o))return o}for(;;){let i=n>0?a.firstChild:a.lastChild;if(!i){if(a.isAtom&&!a.isText&&!de.isSelectable(a)){t=t.doc.resolve(r+a.nodeSize*n),l=!1;continue e}break}a=i,r+=n;let s=t.doc.resolve(r);if(Fe.valid(s))return s}return null}}}Fe.prototype.visible=!1,Fe.findFrom=Fe.findGapCursorFrom,ve.jsonID("gapcursor",Fe);class Bo{constructor(t){this.pos=t}map(t){return new Bo(t.map(this.pos))}resolve(t){let n=t.resolve(this.pos);return Fe.valid(n)?new Fe(n):ve.near(n)}}function Ab(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function H3(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),l=e.node(t);if(n==0){if(l.type.spec.isolating)return!0;continue}for(let r=l.child(n-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||Ab(r.type))return!0;if(r.inlineContent)return!1}}return!0}function U3(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),l=e.node(t);if(n==l.childCount){if(l.type.spec.isolating)return!0;continue}for(let r=l.child(n);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||Ab(r.type))return!0;if(r.inlineContent)return!1}}return!0}function z3(){return new dt({props:{decorations:W3,createSelectionBetween(e,t,n){return t.pos==n.pos&&Fe.valid(n)?new Fe(n):null},handleClick:$3,handleKeyDown:V3,handleDOMEvents:{beforeinput:q3}}})}const V3=Up({ArrowLeft:Xa("horiz",-1),ArrowRight:Xa("horiz",1),ArrowUp:Xa("vert",-1),ArrowDown:Xa("vert",1)});function Xa(e,t){const n=e=="vert"?t>0?"down":"up":t>0?"right":"left";return function(l,r,a){let i=l.selection,s=t>0?i.$to:i.$from,o=i.empty;if(i instanceof pe){if(!a.endOfTextblock(n)||s.depth==0)return!1;o=!1,s=l.doc.resolve(t>0?s.after():s.before())}let u=Fe.findGapCursorFrom(s,t,o);return u?(r&&r(l.tr.setSelection(new Fe(u))),!0):!1}}function $3(e,t,n){if(!e||!e.editable)return!1;let l=e.state.doc.resolve(t);if(!Fe.valid(l))return!1;let r=e.posAtCoords({left:n.clientX,top:n.clientY});return r&&r.inside>-1&&de.isSelectable(e.state.doc.nodeAt(r.inside))?!1:(e.dispatch(e.state.tr.setSelection(new Fe(l))),!0)}function q3(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof Fe))return!1;let{$from:n}=e.state.selection,l=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!l)return!1;let r=G.empty;for(let i=l.length-1;i>=0;i--)r=G.from(l[i].createAndFill(null,r));let a=e.state.tr.replace(n.pos,n.pos,new Z(r,0,0));return a.setSelection(pe.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function W3(e){if(!(e.selection instanceof Fe))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",qe.create(e.doc,[At.widget(e.selection.head,t,{key:"gapcursor"})])}const Y3=it.create({name:"gapCursor",addProseMirrorPlugins(){return[z3()]},extendNodeSchema(e){var t;const n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:(t=Ee(le(e,"allowGapCursor",n)))!==null&&t!==void 0?t:null}}}),j3=Et.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:e}){return["br",pt(this.options.HTMLAttributes,e)]},renderText(){return`
|
|
145
145
|
`},addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:l})=>e.first([()=>e.exitCode(),()=>e.command(()=>{const{selection:r,storedMarks:a}=n;if(r.$from.parent.type.spec.isolating)return!1;const{keepMarks:i}=this.options,{splittableMarks:s}=l.extensionManager,o=a||r.$to.parentOffset&&r.$from.marks();return t().insertContent({type:this.name}).command(({tr:u,dispatch:c})=>{if(c&&o&&i){const d=o.filter(f=>s.includes(f.type.name));u.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),G3=Et.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,pt(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,"paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>No({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}});var Ja=200,Ke=function(){};Ke.prototype.append=function(t){return t.length?(t=Ke.from(t),!this.length&&t||t.length<Ja&&this.leafAppend(t)||this.length<Ja&&t.leafPrepend(this)||this.appendInner(t)):this},Ke.prototype.prepend=function(t){return t.length?Ke.from(t).append(this):this},Ke.prototype.appendInner=function(t){return new K3(this,t)},Ke.prototype.slice=function(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.length),t>=n?Ke.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))},Ke.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},Ke.prototype.forEach=function(t,n,l){n===void 0&&(n=0),l===void 0&&(l=this.length),n<=l?this.forEachInner(t,n,l,0):this.forEachInvertedInner(t,n,l,0)},Ke.prototype.map=function(t,n,l){n===void 0&&(n=0),l===void 0&&(l=this.length);var r=[];return this.forEach(function(a,i){return r.push(t(a,i))},n,l),r},Ke.from=function(t){return t instanceof Ke?t:t&&t.length?new Nb(t):Ke.empty};var Nb=function(e){function t(l){e.call(this),this.values=l}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(r,a){return r==0&&a==this.length?this:new t(this.values.slice(r,a))},t.prototype.getInner=function(r){return this.values[r]},t.prototype.forEachInner=function(r,a,i,s){for(var o=a;o<i;o++)if(r(this.values[o],s+o)===!1)return!1},t.prototype.forEachInvertedInner=function(r,a,i,s){for(var o=a-1;o>=i;o--)if(r(this.values[o],s+o)===!1)return!1},t.prototype.leafAppend=function(r){if(this.length+r.length<=Ja)return new t(this.values.concat(r.flatten()))},t.prototype.leafPrepend=function(r){if(this.length+r.length<=Ja)return new t(r.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(Ke);Ke.empty=new Nb([]);var K3=function(e){function t(n,l){e.call(this),this.left=n,this.right=l,this.length=n.length+l.length,this.depth=Math.max(n.depth,l.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(l){return l<this.left.length?this.left.get(l):this.right.get(l-this.left.length)},t.prototype.forEachInner=function(l,r,a,i){var s=this.left.length;if(r<s&&this.left.forEachInner(l,r,Math.min(a,s),i)===!1||a>s&&this.right.forEachInner(l,Math.max(r-s,0),Math.min(this.length,a)-s,i+s)===!1)return!1},t.prototype.forEachInvertedInner=function(l,r,a,i){var s=this.left.length;if(r>s&&this.right.forEachInvertedInner(l,r-s,Math.max(a,s)-s,i+s)===!1||a<s&&this.left.forEachInvertedInner(l,Math.min(r,s),a,i)===!1)return!1},t.prototype.sliceInner=function(l,r){if(l==0&&r==this.length)return this;var a=this.left.length;return r<=a?this.left.slice(l,r):l>=a?this.right.slice(l-a,r-a):this.left.slice(l,a).append(this.right.slice(0,r-a))},t.prototype.leafAppend=function(l){var r=this.right.leafAppend(l);if(r)return new t(this.left,r)},t.prototype.leafPrepend=function(l){var r=this.left.leafPrepend(l);if(r)return new t(r,this.right)},t.prototype.appendInner=function(l){return this.left.depth>=Math.max(this.right.depth,l.depth)+1?new t(this.left,new t(this.right,l)):new t(this,l)},t}(Ke);const Q3=500;class Ft{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,n){if(this.eventCount==0)return null;let l=this.items.length;for(;;l--)if(this.items.get(l-1).selection){--l;break}let r,a;n&&(r=this.remapping(l,this.items.length),a=r.maps.length);let i=t.tr,s,o,u=[],c=[];return this.items.forEach((d,f)=>{if(!d.step){r||(r=this.remapping(l,f+1),a=r.maps.length),a--,c.push(d);return}if(r){c.push(new Qt(d.map));let h=d.step.map(r.slice(a)),m;h&&i.maybeStep(h).doc&&(m=i.mapping.maps[i.mapping.maps.length-1],u.push(new Qt(m,void 0,void 0,u.length+c.length))),a--,m&&r.appendMap(m,a)}else i.maybeStep(d.step);if(d.selection)return s=r?d.selection.map(r.slice(a)):d.selection,o=new Ft(this.items.slice(0,l).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:o,transform:i,selection:s}}addTransform(t,n,l,r){let a=[],i=this.eventCount,s=this.items,o=!r&&s.length?s.get(s.length-1):null;for(let c=0;c<t.steps.length;c++){let d=t.steps[c].invert(t.docs[c]),f=new Qt(t.mapping.maps[c],d,n),h;(h=o&&o.merge(f))&&(f=h,c?a.pop():s=s.slice(0,s.length-1)),a.push(f),n&&(i++,n=void 0),r||(o=f)}let u=i-l.depth;return u>J3&&(s=X3(s,u),i-=u),new Ft(s.append(a),i)}remapping(t,n){let l=new gr;return this.items.forEach((r,a)=>{let i=r.mirrorOffset!=null&&a-r.mirrorOffset>=t?l.maps.length-r.mirrorOffset:void 0;l.appendMap(r.map,i)},t,n),l}addMaps(t){return this.eventCount==0?this:new Ft(this.items.append(t.map(n=>new Qt(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let l=[],r=Math.max(0,this.items.length-n),a=t.mapping,i=t.steps.length,s=this.eventCount;this.items.forEach(f=>{f.selection&&s--},r);let o=n;this.items.forEach(f=>{let h=a.getMirror(--o);if(h==null)return;i=Math.min(i,h);let m=a.maps[h];if(f.step){let g=t.steps[h].invert(t.docs[h]),v=f.selection&&f.selection.map(a.slice(o+1,h));v&&s++,l.push(new Qt(m,g,v))}else l.push(new Qt(m))},r);let u=[];for(let f=n;f<i;f++)u.push(new Qt(a.maps[f]));let c=this.items.slice(0,r).append(u).append(l),d=new Ft(c,s);return d.emptyItemCount()>Q3&&(d=d.compress(this.items.length-l.length)),d}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),l=n.maps.length,r=[],a=0;return this.items.forEach((i,s)=>{if(s>=t)r.push(i),i.selection&&a++;else if(i.step){let o=i.step.map(n.slice(l)),u=o&&o.getMap();if(l--,u&&n.appendMap(u,l),o){let c=i.selection&&i.selection.map(n.slice(l));c&&a++;let d=new Qt(u.invert(),o,c),f,h=r.length-1;(f=r.length&&r[h].merge(d))?r[h]=f:r.push(d)}}else i.map&&l--},this.items.length,0),new Ft(Ke.from(r.reverse()),a)}}Ft.empty=new Ft(Ke.empty,0);function X3(e,t){let n;return e.forEach((l,r)=>{if(l.selection&&t--==0)return n=r,!1}),e.slice(n)}class Qt{constructor(t,n,l,r){this.map=t,this.step=n,this.selection=l,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new Qt(n.getMap().invert(),n,this.selection)}}}class In{constructor(t,n,l,r,a){this.done=t,this.undone=n,this.prevRanges=l,this.prevTime=r,this.prevComposition=a}}const J3=20;function Z3(e,t,n,l){let r=n.getMeta(rl),a;if(r)return r.historyState;n.getMeta(nw)&&(e=new In(e.done,e.undone,null,0,-1));let i=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(i&&i.getMeta(rl))return i.getMeta(rl).redo?new In(e.done.addTransform(n,void 0,l,Za(t)),e.undone,wb(n.mapping.maps),e.prevTime,e.prevComposition):new In(e.done,e.undone.addTransform(n,void 0,l,Za(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(i&&i.getMeta("addToHistory")===!1)){let s=n.getMeta("composition"),o=e.prevTime==0||!i&&e.prevComposition!=s&&(e.prevTime<(n.time||0)-l.newGroupDelay||!ew(n,e.prevRanges)),u=i?Ro(e.prevRanges,n.mapping):wb(n.mapping.maps);return new In(e.done.addTransform(n,o?t.selection.getBookmark():void 0,l,Za(t)),Ft.empty,u,n.time,s??e.prevComposition)}else return(a=n.getMeta("rebased"))?new In(e.done.rebased(n,a),e.undone.rebased(n,a),Ro(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new In(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),Ro(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function ew(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((l,r)=>{for(let a=0;a<t.length;a+=2)l<=t[a+1]&&r>=t[a]&&(n=!0)}),n}function wb(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((l,r,a,i)=>t.push(a,i));return t}function Ro(e,t){if(!e)return null;let n=[];for(let l=0;l<e.length;l+=2){let r=t.map(e[l],1),a=t.map(e[l+1],-1);r<=a&&n.push(r,a)}return n}function tw(e,t,n){let l=Za(t),r=rl.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,l);if(!a)return null;let i=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),r,l),o=new In(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(i).setMeta(rl,{redo:n,historyState:o})}let Fo=!1,_b=null;function Za(e){let t=e.plugins;if(_b!=t){Fo=!1,_b=t;for(let n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){Fo=!0;break}}return Fo}const rl=new Rt("history"),nw=new Rt("closeHistory");function lw(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new dt({key:rl,state:{init(){return new In(Ft.empty,Ft.empty,null,0,-1)},apply(t,n,l){return Z3(n,l,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(t,n){let l=n.inputType,r=l=="historyUndo"?Ob:l=="historyRedo"?Mb:null;return!r||!t.editable?!1:(n.preventDefault(),r(t.state,t.dispatch))}}}})}function Ib(e,t){return(n,l)=>{let r=rl.getState(n);if(!r||(e?r.undone:r.done).eventCount==0)return!1;if(l){let a=tw(r,n,e);a&&l(t?a.scrollIntoView():a)}return!0}}const Ob=Ib(!1,!0),Mb=Ib(!0,!0),rw=it.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>Ob(e,t),redo:()=>({state:e,dispatch:t})=>Mb(e,t)}},addProseMirrorPlugins(){return[lw(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),aw=Et.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:e}){return["hr",pt(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!JN(t,t.schema.nodes[this.name]))return!1;const{selection:n}=t,{$from:l,$to:r}=n,a=e();return l.parentOffset===0?a.insertContentAt({from:Math.max(l.pos-1,0),to:r.pos},{type:this.name}):_N(n)?a.insertContentAt(r.pos,{type:this.name}):a.insertContent({type:this.name}),a.command(({tr:i,dispatch:s})=>{var o;if(s){const{$to:u}=i.selection,c=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?i.setSelection(pe.create(i.doc,u.pos+1)):u.nodeAfter.isBlock?i.setSelection(de.create(i.doc,u.pos)):i.setSelection(pe.create(i.doc,u.pos));else{const d=(o=u.parent.type.contentMatch.defaultType)===null||o===void 0?void 0:o.create();d&&(i.insert(c,d),i.setSelection(pe.create(i.doc,c+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[XN({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),iw=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,sw=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,ow=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,uw=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,cw=wn.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>e.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",pt(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Ll({find:iw,type:this.type}),Ll({find:ow,type:this.type})]},addPasteRules(){return[Pl({find:sw,type:this.type}),Pl({find:uw,type:this.type})]}}),dw=Et.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",pt(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),fw="listItem",Db="textStyle",Lb=/^(\d+)\.\s$/,hw=Et.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return t===1?["ol",pt(this.options.HTMLAttributes,n),0]:["ol",pt(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(fw,this.editor.getAttributes(Db)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=Dr({find:Lb,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Dr({find:Lb,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(Db)}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1],editor:this.editor})),[e]}}),pw=Et.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",pt(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),bw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,mw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,gw=wn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["s",pt(this.options.HTMLAttributes,e),0]},addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Ll({find:bw,type:this.type})]},addPasteRules(){return[Pl({find:mw,type:this.type})]}}),vw=Et.create({name:"text",group:"inline"}),yw=it.create({name:"starterKit",addExtensions(){const e=[];return this.options.bold!==!1&&e.push(A3.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(T3.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(w3.configure(this.options.bulletList)),this.options.code!==!1&&e.push(O3.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(L3.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(P3.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(F3.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(Y3.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(j3.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(G3.configure(this.options.heading)),this.options.history!==!1&&e.push(rw.configure(this.options.history)),this.options.horizontalRule!==!1&&e.push(aw.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(cw.configure(this.options.italic)),this.options.listItem!==!1&&e.push(dw.configure(this.options.listItem)),this.options.orderedList!==!1&&e.push(hw.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(pw.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(gw.configure(this.options.strike)),this.options.text!==!1&&e.push(vw.configure(this.options.text)),e}}),Ew=it.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new dt({key:new Rt("placeholder"),props:{decorations:({doc:e,selection:t})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:l}=t,r=[];if(!n)return null;const a=this.editor.isEmpty;return e.descendants((i,s)=>{const o=l>=s&&l<=s+i.nodeSize,u=!i.isLeaf&&Ka(i);if((o||!this.options.showOnlyCurrent)&&u){const c=[this.options.emptyNodeClass];a&&c.push(this.options.emptyEditorClass);const d=At.node(s,s+i.nodeSize,{class:c.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:i,pos:s,hasAnchor:o}):this.options.placeholder});r.push(d)}return this.options.includeChildren}),qe.create(e,r)}}})]}});function Tw(e){return[yw.configure({heading:{levels:[1,2,3]},history:{depth:50}}),Ew.configure({placeholder:e.placeholder??"",showOnlyWhenEditable:!0,emptyEditorClass:"rte-richtext-empty"})]}const Cw=({expanded:e,onToggle:t})=>b.jsxs("button",{type:"button",className:"rte-richtext-toggle","data-expanded":e?"true":"false",onClick:t,children:[b.jsx("i",{className:`iconfont ${e?"icon-shouqi1":"icon-zhankai2"}`}),b.jsx("span",{className:"rte-richtext-toggle-label",children:e?"收起":"展开"})]}),Pb=y.memo(({node:e,value:t,onChange:n,disabled:l,error:r,nodeDefaults:a,onExpandChange:i})=>{const s=typeof e.minHeight=="number"?e.minHeight:a?.richtext?.minHeight??40,o=typeof e.maxHeight=="number"?e.maxHeight:a?.richtext?.maxHeight??160,u=Math.max(o,s),c=e.expandable!==!1,[d,f]=y.useState(!1),h=y.useRef(n),m=y.useRef(e.key);y.useEffect(()=>{h.current=n},[n]),y.useEffect(()=>{m.current=e.key},[e.key]);const g=g3({extensions:Tw({placeholder:e.placeholder}),content:t||"",editable:!l,onUpdate:({editor:N})=>{const L=m.current;L&&h.current(L,N.getHTML())},editorProps:{attributes:{class:"rte-richtext","data-type":"richtext","data-key":e.key??""}}});y.useEffect(()=>{if(!g)return;const N=g.getHTML(),L=t??"";N!==L&&(g.isFocused||g.commands.setContent(L,!1))},[t,g]),y.useEffect(()=>{g&&g.setEditable(!l)},[l,g]);const v=y.useCallback(()=>{f(N=>{const L=!N;return e.key&&i?.(e.key,L),L})},[e.key,i]);if(!g)return null;const E={"--rte-richtext-min-height":`${s}px`,"--rte-richtext-max-height":`${u}px`},w=["rte-richtext-wrapper",c?"rte-richtext-toggleable":"",d?"rte-richtext-expanded":""].filter(Boolean).join(" ");return b.jsx("div",{className:`rte-richtext-container ${d?"rte-richtext-host-expanded":""} ${r?"rte-richtext-error":""}`,"data-key":e.key,children:b.jsxs("div",{className:w,style:E,children:[b.jsx(s3,{editor:g}),c&&b.jsx(Cw,{expanded:d,onToggle:v})]})})});Pb.displayName="RichtextNode";const Sw=e=>{const{node:t}=e;switch(t.type){case"text":return b.jsx(cu,{node:t});case"tag":return b.jsx(hi,{node:t,hideClose:e.hideAgentClose,onClose:e.onAgentExit});case"variable":return b.jsx(Qd,{node:t,value:typeof e.value=="string"?e.value:void 0,onChange:(n,l)=>e.onChange(n,l),disabled:e.disabled,error:e.error});case"number-input":return b.jsx(Xd,{node:t,value:typeof e.value=="string"?e.value:void 0,onChange:(n,l)=>e.onChange(n,l),disabled:e.disabled,error:e.error});case"select":return b.jsx(Jd,{node:t,value:typeof e.value=="string"?e.value:void 0,onChange:(n,l)=>e.onChange(n,l),disabled:e.disabled,error:e.error});case"searchable-select":return b.jsx(Zd,{node:t,value:typeof e.value=="string"?e.value:void 0,onChange:(n,l)=>e.onChange(n,l),disabled:e.disabled,error:e.error});case"datepicker":return b.jsx(sf,{node:t,value:typeof e.value=="string"?e.value:void 0,onChange:(n,l)=>e.onChange(n,l),disabled:e.disabled,error:e.error});case"cascader":return b.jsx(of,{node:t,value:typeof e.value=="string"?e.value:void 0,onChange:(n,l)=>e.onChange(n,l),disabled:e.disabled,error:e.error});case"textarea":return b.jsx(uf,{node:t,value:typeof e.value=="string"?e.value:void 0,onChange:(n,l)=>e.onChange(n,l),disabled:e.disabled,error:e.error,nodeDefaults:e.nodeDefaults});case"multi-variable":return b.jsx(df,{node:t,value:Array.isArray(e.value)?e.value:void 0,onChange:(n,l)=>e.onChange(n,l),disabled:e.disabled,error:e.error,reportListFetch:e.reportListFetch,onReportGoGenerate:e.onReportGoGenerate,onViewReport:e.onViewReport,hideCurrentSessionReport:e.hideCurrentSessionReport,reportNames:e.reportNames,onResolveName:e.onResolveMultiName,onClearReport:e.onClearReport,onShiftReportNames:e.onShiftReportNames});case"multi-variable-select":return b.jsx(hf,{node:t,value:Array.isArray(e.value)?e.value:void 0,onChange:(n,l)=>e.onChange(n,l),disabled:e.disabled,error:e.error,reportListFetch:e.reportListFetch,onReportGoGenerate:e.onReportGoGenerate,onViewReport:e.onViewReport,hideCurrentSessionReport:e.hideCurrentSessionReport,reportNames:e.reportNames,onResolveName:e.onResolveMultiName,onClearReport:e.onClearReport,onAnalyzeReport:e.onAnalyzeMultiReport,onShiftReportNames:e.onShiftReportNames});case"upload":return b.jsx(mf,{node:t,files:e.files??{},onFileChange:e.onFileChange??(()=>{}),disabled:e.disabled,error:e.error});case"video-url":return b.jsx(Sf,{node:t,value:typeof e.value=="string"?e.value:void 0,thumbnail:t.key?e.thumbnails?.[t.key]:void 0,onChange:(n,l)=>e.onChange(n,l),onThumbnailChange:e.onThumbnailChange,videoUrlParse:e.videoUrlParse,disabled:e.disabled,error:e.error});case"video-upload":return b.jsx(xf,{node:t,value:typeof e.value=="string"?e.value:void 0,thumbnail:t.key?e.thumbnails?.[t.key]:void 0,onChange:(n,l)=>e.onChange(n,l),onThumbnailChange:e.onThumbnailChange,videoUpload:e.videoUpload,disabled:e.disabled,error:e.error});case"report-url":return b.jsx(Af,{node:t,value:typeof e.value=="string"?e.value:void 0,onChange:(n,l)=>e.onChange(n,l),onParse:t.key&&e.onReportUrlParse?n=>e.onReportUrlParse(t.key,n):void 0,reportListFetch:e.reportListFetch,onReportGoGenerate:e.onReportGoGenerate,reportName:t.key&&e.reportNames?e.reportNames[t.key]:void 0,onClearReport:e.onClearReport&&t.key?()=>e.onClearReport(t.key):void 0,onViewReport:e.onViewReport,hideCurrentSessionReport:e.hideCurrentSessionReport,disabled:e.disabled,error:e.error});case"markdown":return b.jsx(oS,{node:t,value:typeof e.value=="string"?e.value:void 0,onChange:(n,l)=>e.onChange(n,l),onParse:t.key&&e.onMarkdownParse?n=>e.onMarkdownParse(t.key,n):void 0,disabled:e.disabled,error:e.error});case"markdown-name":return b.jsx(uS,{node:t,value:typeof e.value=="string"?e.value:void 0,onChange:(n,l)=>e.onChange(n,l),onParse:t.key&&e.onMarkdownNameParse?n=>e.onMarkdownNameParse(t.key,n):void 0,disabled:e.disabled,error:e.error});case"report-module":return b.jsx(sS,{node:t,value:typeof e.value=="string"?e.value:void 0,onChange:(n,l)=>e.onChange(n,l),disabled:e.disabled,error:e.error});case"markdown-module":return b.jsx(cS,{node:t,value:typeof e.value=="string"?e.value:void 0,onChange:(n,l)=>e.onChange(n,l),disabled:e.disabled,error:e.error});case"richtext":return b.jsx(Pb,{node:t,value:typeof e.value=="string"?e.value:void 0,onChange:(n,l)=>e.onChange(n,l),disabled:e.disabled,error:e.error,nodeDefaults:e.nodeDefaults,onExpandChange:e.onRichtextExpandChange});default:return b.jsx(Pm,{node:e.node,value:e.value,onChange:e.onChange,index:e.index})}},Bb=y.memo(Sw);Bb.displayName="NodeRenderer";const Rb=e=>typeof e=="string"||Array.isArray(e)&&e.every(t=>typeof t=="string"),Fb=(e,t)=>e===t?!0:Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((n,l)=>n===t[l]):!1,xw=e=>{const t=new Map;for(const n of e)if(n.type==="upload"&&n.key){const l=typeof n.maxCount=="number"&&typeof n.minCount=="number"&&n.maxCount>1;t.set(n.key,{batch:l,maxCount:l?n.maxCount:1})}return t};function kw(e,t,n,l,r,a){const i=y.useRef({});y.useEffect(()=>{if(!e)return;const s=xw(l);n(u=>{const c={...u};let d=!1;for(const[f,h]of Object.entries(e)){if(s.has(f)||!Rb(h))continue;const m=c[f],g=m===void 0||m===""||Array.isArray(m)&&m.length===0,v=!Fb(i.current[f],h);(g||v)&&(Fb(m,h)||(c[f]=h,d=!0))}return d?c:u}),a(u=>{const c={...u};let d=!1;for(const[f,h]of s){const m=e[f];if(m==null)continue;const g=(Array.isArray(m)?m:[m]).filter(v=>v!=null&&v!=="");if(g.length!==0)if(h.batch)for(let v=0;v<g.length&&v<h.maxCount;v+=1){const E=`${f}-${v}`;c[E]==null&&(c[E]=g[v],d=!0)}else c[f]==null&&(c[f]=g[0],d=!0)}return d?c:u});const o={};for(const[u,c]of Object.entries(e))Rb(c)&&(o[u]=c);i.current=o},[e,l,n,a])}const Hb=new Set(["upload"]);function Ub(e){return Hb.has(e.type)?typeof e.maxCount=="number"&&typeof e.minCount=="number"&&e.maxCount>1?`至少上传 ${e.minCount} 个文件`:"请上传":"请填写"}function zb(e){return e.type==="report-module"||e.type==="markdown-module"?`${e.key}__module_${e.moduleIndex??0}`:e.key}function Aw(e,t,n,l=new Set){const r={},a=new Map;for(const i of e){if(!i.required||!i.key||l.has(i.key))continue;const s=i.exclusionGroup;if(s&&s!=="separator"){const o=a.get(s)??[];o.push(i),a.set(s,o);continue}ei(i,t,n)||(r[zb(i)]=Ub(i))}for(const[,i]of a)if(!i.some(s=>ei(s,t,n)))for(const s of i)r[zb(s)]=Ub(s);return r}function ei(e,t,n){if(!e.key)return!0;if(Hb.has(e.type)){if(typeof e.maxCount=="number"&&typeof e.minCount=="number"&&e.maxCount>1){let s=0;for(let o=0;o<(e.maxCount??0);o+=1)n[`${e.key}-${o}`]&&(s+=1);return s>=(e.minCount??1)}return!!n[e.key]}const l=e.type==="report-module"||e.type==="markdown-module"?`${e.key}__module_${e.moduleIndex??0}`:e.key,r=t[l];return r!==void 0&&r!==""&&!(Array.isArray(r)&&(r.length===0||r.every(i=>!i||!i.trim())))?!0:e.defaultValue!==void 0&&e.defaultValue!==null&&String(e.defaultValue)!==""}function Nw(e,t,n,l=new Set){const r=e.filter(s=>s.required&&s.key&&!l.has(s.key));if(r.length===0)return!0;const a=new Map,i=[];for(const s of r){const o=s.exclusionGroup;if(o&&o!=="separator"){const u=a.get(o)??[];u.push(s),a.set(o,u)}else i.push(s)}for(const s of i)if(!ei(s,t,n))return!1;for(const[,s]of a)if(!s.some(o=>ei(o,t,n)))return!1;return!0}function ww(e){const[t,n]=y.useState({}),l=y.useCallback((a,i,s=new Set)=>{const o=Aw(e,a,i,s);return n(o),Object.keys(o).length===0},[e]),r=y.useCallback(a=>{n(i=>{if(!(a in i))return i;const s={...i};return delete s[a],s})},[]);return{errors:t,validate:l,clearError:r}}const _w=new Set(["upload"]);function Vb(e,t,n){if(!e.key)return!1;if(_w.has(e.type)){if(n[e.key]!=null)return!0;if(typeof e.maxCount=="number"&&e.maxCount>1){for(let r=0;r<e.maxCount;r+=1)if(n[`${e.key}-${r}`]!=null)return!0}return!1}const l=t[e.key];return Array.isArray(l)?l.some(r=>r&&r.trim().length>0):l!=null&&String(l).trim()!==""}function Iw(e,t,n){if(e.some(s=>s.exclusionGroup==="separator")){const s=[];let o=[];for(const h of e){if(h.exclusionGroup==="separator"){o.length&&s.push(o),o=[];continue}!h.exclusionGroup||!h.key||o.push(h)}o.length&&s.push(o);const u=s.map(h=>h.some(m=>Vb(m,t,n))),c=u.some(Boolean),d=u.findIndex(Boolean),f=new Set;return c&&s.forEach((h,m)=>{if(m!==d)for(const g of h)g.key&&f.add(g.key)}),{excludedKeys:f,hideSeparator:c}}const r=new Map;for(const s of e){if(!s.exclusionGroup||s.exclusionGroup==="separator"||!s.key)continue;const o=s.exclusionGroup;Vb(s,t,n)?r.set(o,!0):r.has(o)||r.set(o,!1)}let a=null;for(const s of e)if(s.exclusionGroup&&s.exclusionGroup!=="separator"&&r.get(s.exclusionGroup)){a=s.exclusionGroup;break}const i=new Set;if(a)for(const s of e)!s.key||!s.exclusionGroup||s.exclusionGroup!=="separator"&&s.exclusionGroup!==a&&i.add(s.key);return{excludedKeys:i,hideSeparator:a!==null}}function Ow(e,t,n){return y.useMemo(()=>Iw(e,t,n),[e,t,n])}function Mw(e){const t=y.useRef({}),n=y.useRef({}),l=y.useCallback(async(s,o)=>{if(!e.reportAnalyze)return{status:"unconfigured"};const u=(t.current[s]??0)+1;t.current[s]=u;try{const c=await e.reportAnalyze(Ss(o));return t.current[s]!==u?{status:"stale"}:{status:"success",modules:c.modules}}catch{return t.current[s]!==u?{status:"stale"}:{status:"failed"}}},[e.reportAnalyze]),r=y.useCallback(async(s,o)=>{if(!e.markdownAnalyze)return null;const u=(t.current[s]??0)+1;t.current[s]=u;try{const c=await e.markdownAnalyze({text:o});return t.current[s]!==u?null:c}catch{return null}},[e.markdownAnalyze]),a=y.useCallback(async(s,o)=>{if(!e.markdownNameAnalyze)return null;const u=(t.current[s]??0)+1;t.current[s]=u;try{const c=await e.markdownNameAnalyze({text:o});return t.current[s]!==u?null:c}catch{return null}},[e.markdownNameAnalyze]),i=y.useCallback(async(s,o,u)=>{if(!e.reportNameResolve)return{status:"skip"};const c=(o||"").trim();if(!/^https?:\/\//i.test(c))return{status:"skip"};const d=(n.current[s]??0)+1;n.current[s]=d;try{const f=await e.reportNameResolve({url:c,nodeKey:s,nodeType:u});return n.current[s]!==d?{status:"stale"}:{status:"success",name:f.name,url:f.url||c}}catch{return n.current[s]!==d?{status:"stale"}:{status:"failed"}}},[e.reportNameResolve]);return{analyzeReport:l,analyzeMarkdown:r,analyzeMarkdownName:a,resolveReportName:i}}const $b=//g,ti=e=>String(e??"").replace($b,"").trim(),Dw=e=>!e||!/<[a-z][\s\S]*>/i.test(e)?e:(new DOMParser().parseFromString(e,"text/html").body.textContent||"").replace($b,"").trim(),Lw=e=>e==="multi-variable"||e==="multi-variable-select",Ho=(e,t)=>{if(!t)return"";const n=e[t];return Array.isArray(n)?ti(n[0]):ti(n)},Pw=(e,t)=>{if(!t)return[];const n=e[t];if(Array.isArray(n))return n.map(ti).filter(Boolean);const l=ti(n);return l?[l]:[]},qb=e=>typeof e=="string"?decodeURIComponent(e.split("/").pop()?.split("?")[0]||"file"):e.name;async function Bw(e){const t=e.split("/").pop()?.split("?")[0]||"file",n=decodeURIComponent(t);try{const l=await fetch(`/api/image-proxy?url=${encodeURIComponent(e)}`);if(!l.ok)return e;const r=await l.blob();return new File([r],n,{type:r.type||"application/octet-stream"})}catch{return e}}const Uo=async(e,t,n,l,r)=>{if(!(n==null||n==="")){if(n instanceof File){e.append(t,n);return}if(r&&typeof n=="string"&&/^https?:\/\//i.test(n)){const a=await Bw(n);e.append(t,a);return}if(Array.isArray(n)){if(l.has(t)){for(const a of n)await Uo(e,t,a,l,r);return}for(let a=0;a<n.length;a+=1)await Uo(e,`${t}[${a}]`,n[a],l,r);return}e.append(t,String(n))}},Rw=["variable","report-url","markdown","markdown-name","select","searchable-select","cascader","textarea","richtext","datepicker","number-input","video-url","video-upload"];async function Fw(e){const{config:t,values:n,files:l,footerFiles:r,markdownModules:a}=e,i={},s=[],o=new Set(["url"]);for(const f of t){const h=f.key;if(f.type==="text"||f.type==="tag"){f.text&&s.push(f.text);continue}if(h&&Lw(f.type)){const m=Pw(n,h);m.length>0&&(i[h]=m,o.add(h),s.push(m.join(" ")));continue}if(h&&Rw.includes(f.type)){let m=Ho(n,h);if(!m&&f.type==="number-input"&&typeof f.defaultNumber=="number"&&(m=String(f.defaultNumber)),!m&&typeof f.defaultValue=="string"&&f.defaultValue!==""&&(m=f.defaultValue),!m)continue;if(i[h]=m,s.push(m),f.type==="report-url"){const g=i.url;i.url=g===void 0?m:Array.isArray(g)?[...g,m]:[String(g),m]}if(f.type==="markdown"||f.type==="markdown-name"){const g=f.sourceTextKey||`${h}__sourceText`;i[g]=m}continue}if(h&&(f.type==="report-module"||f.type==="markdown-module")){const m=`${h}__module_${f.moduleIndex??0}`,g=Ho(n,m)||Ho(n,h),v=Dw(g);v&&(Array.isArray(i[h])||(i[h]=[]),i[h].push(v),o.add(h),s.push(v));continue}if(h&&f.type==="upload")if(typeof f.maxCount=="number"&&typeof f.minCount=="number"&&f.maxCount>1){const g=[];for(let v=0;v<(f.maxCount??0);v+=1){const E=l[`${h}-${v}`];E&&g.push(E)}g.length>0&&(i[h]=g,s.push(` [附带${g.length}个文件: ${g.map(qb).join(", ")}] `))}else{const g=l[h];g&&(i[h]=g,s.push(` [附带文件: ${qb(g)}] `))}}const u=s.join("").trim(),c=new FormData;c.append("fullPrompt",u);const d=new Set;for(const f of t)f.type==="upload"&&f.key&&d.add(f.key);if(a)for(const f of t){if(!f.key||f.type!=="markdown"&&f.type!=="markdown-name")continue;const h=a[f.key];if(!h||h.length===0)continue;const m=h.map(v=>(v?.markdown||"").trim()).filter(v=>v.length>0);if(m.length===0)continue;const g=`${f.key}__markdown`;i[g]=m,o.add(g)}for(const[f,h]of Object.entries(i))await Uo(c,f,h,o,d.has(f));return r.forEach(f=>{c.append("fileUrls",f)}),{formData:c,fullPrompt:u,hasContent:u.length>0||r.length>0}}function Hw(e,t,n=new Set){const l=[];let r=!1;for(const a of e){if((a.type==="markdown"||a.type==="markdown-name")&&a.key){const s=t.markdownModules[a.key],o=n.has(a.key),u=!!s&&s.length>0;if(a.type==="markdown-name"){l.push(a),o&&!u&&l.push({type:"text",className:"rte-markdown-parsing",text:"解析中...",exclusionGroup:a.exclusionGroup}),u&&(s.forEach((c,d)=>{l.push({type:"markdown-module",key:a.key,moduleIndex:d,text:c.title,placeholder:"可编辑,内容不能为空",exclusionGroup:a.exclusionGroup,required:a.required})}),r=!0);continue}if(o&&!u){l.push({type:"text",key:a.key,className:"rte-markdown-parsing",text:"解析中...",exclusionGroup:a.exclusionGroup});continue}if(u){s.forEach((c,d)=>{l.push({type:"markdown-module",key:a.key,moduleIndex:d,text:c.title,placeholder:"可编辑,内容不能为空",exclusionGroup:a.exclusionGroup,required:a.required})}),r=!0;continue}l.push(a);continue}if(r){if(a.type==="text"&&a.text?.startsWith(`
|
|
146
|
-
`)){l.push({...a,text:a.text.slice(1)}),r=!1;continue}if(a.exclusionGroup==="separator"){l.push(a);continue}}l.push(a),a.type==="report-url"&&a.key&&t.reportModules[a.key]&&t.reportModules[a.key].forEach((s,o)=>{l.push({type:"report-module",key:a.key,moduleIndex:o,text:s.title,exclusionGroup:a.exclusionGroup,required:a.required})})}return l}const Uw={reportModules:{},markdownModules:{}},zw={adjustX:1,adjustY:0,shiftY:!0},Wb=y.memo(({options:e,onSelect:t,disabled:n,currentAgent:l})=>{const[r,a]=y.useState(!1),i=e.filter(u=>u.isShowNew!==1).map(u=>({key:u.key,label:b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[u.icon&&b.jsx("i",{className:u.icon}),b.jsx("span",{children:u.label})]}),onClick:()=>t?.(u)})),o=`rte-agent-badge${!!l?" rte-agent-badge-selected":r?" rte-agent-badge-active":""}`;return b.jsx(ae.Dropdown,{menu:{items:i,selectedKeys:l?[String(l.key)]:[]},disabled:n,placement:"bottomLeft",autoAdjustOverflow:zw,trigger:["click"],overlayClassName:"rte-agent-dropdown",onOpenChange:a,children:b.jsxs("div",{className:o,style:{cursor:e.length>0?"pointer":"default"},children:[b.jsx("i",{className:"iconfont icon-zhinengti",style:{fontSize:"16px"}}),b.jsx("span",{className:"rte-agent-text",children:"智能体"})]})})});Wb.displayName="AgentDropdown";const Vw=["全部技能","我的技能","系统技能","订阅技能"],$w={system:"系统技能",mine:"我的技能",subscribe:"订阅技能"},ni="基于用户上传的抖音推广数据,智能分析高潜力商品与爆品抖音推广数据,智能分析高潜力商品与爆品商品机会",li=["淘宝天猫","抖音电商","市场选品","+7..."],qw=[{id:"c1",title:"抖音推广找潜力爆品",desc:ni,tags:li,badge:"system",heat:"3.5"},{id:"c2",title:"抖音推广找潜力爆品",desc:ni,tags:li,badge:"system",heat:"6.6"},{id:"c3",title:"抖音推广找潜力爆品",desc:ni,tags:li,badge:"mine"},{id:"c4",title:"抖音推广找潜力爆品",desc:ni,tags:li,badge:"subscribe",heat:"6.6"}],Ww=e=>({id:e.id,title:e.title,desc:e.desc??"",tags:e.tags??[],badge:e.badge??"system",heat:e.heat}),Yw=()=>b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M6.2 1a5.2 5.2 0 0 1 4.06 8.45l2.6 2.6a.6.6 0 0 1-.85.85l-2.6-2.6A5.2 5.2 0 1 1 6.2 1Zm0 1.2a4 4 0 1 0 0 8 4 4 0 0 0 0-8Z",fill:"#4E5969"})}),jw=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[b.jsx("path",{d:"M8 2v7M8 9 5.5 6.5M8 9l2.5-2.5",stroke:"#666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"}),b.jsx("path",{d:"M3 10v2a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-2",stroke:"#666",strokeWidth:"1.2",strokeLinecap:"round"})]}),Gw=()=>b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M8 1.5l1.6 3.7 4 .35-3 2.65.9 3.9L8 10.1 4.5 12l.9-3.9-3-2.65 4-.35L8 1.5Z",fill:"#fff"})}),Kw=()=>b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:b.jsx("path",{d:"M9.60187 14.5546C9.23569 14.5546 8.94275 14.4081 8.6498 14.1884C8.35686 13.8955 8.13716 13.5293 8.13716 13.0899V11.6251C6.52597 11.6251 3.88948 12.0646 2.49801 13.9687C2.2783 14.3349 1.76565 14.5546 1.32623 14.6278H1.10653C0.374166 14.4813 -0.0652517 13.8222 0.00799105 13.0899C0.374166 9.94073 1.47272 7.67041 3.37683 6.13247C4.76831 5.03394 6.3795 4.44805 8.13716 4.30157V2.9101C8.13716 2.25098 8.4301 1.66509 9.01599 1.44538C9.52864 1.29892 10.1145 1.37215 10.5539 1.81157L15.241 6.57189C15.6072 6.86484 15.8269 7.30424 15.9001 7.81689C15.9734 8.32955 15.8269 8.8422 15.4607 9.20837C15.3875 9.28161 15.3143 9.42807 15.1678 9.50132L10.6272 14.1152C10.3342 14.4081 9.96804 14.5546 9.60187 14.5546ZM8.43009 10.1604H9.60187V13.0899L14.2157 8.32955L14.289 8.25631C14.3622 8.18308 14.3622 8.0366 14.3622 7.96336C14.3622 7.81689 14.289 7.74366 14.2157 7.67041L14.1425 7.59718L9.52864 2.9101V5.69306L8.50333 5.7663C6.96539 5.7663 5.50066 6.27894 4.25567 7.23101C2.79094 8.40278 1.83889 10.3069 1.54595 12.7969C3.37683 10.5266 6.5992 10.1604 8.43009 10.1604Z",fill:"currentColor"})}),Qw=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("path",{d:"M13.85 7.35C13.4903 7.35 13.2 7.64033 13.2 8V12.3333C13.2 12.8114 12.8114 13.2 12.3333 13.2H3.66667C3.18856 13.2 2.8 12.8114 2.8 12.3333V3.66667C2.8 3.18856 3.18856 2.8 3.66667 2.8H8C8.35967 2.8 8.65 2.50967 8.65 2.15C8.65 1.79033 8.35967 1.5 8 1.5H3.23333C2.27567 1.5 1.5 2.27567 1.5 3.23333V12.7667C1.5 13.7243 2.27567 14.5 3.23333 14.5H12.7667C13.7243 14.5 14.5 13.7243 14.5 12.7667V8C14.5 7.64033 14.2097 7.35 13.85 7.35Z",fill:"currentColor"}),b.jsx("path",{d:"M5.7483 10.4682C6.00108 10.721 6.41419 10.721 6.66697 10.4682L13.7144 3.42075C13.9672 3.16797 13.9672 2.75486 13.7144 2.50208C13.4616 2.24931 13.0485 2.24931 12.7957 2.50208L5.7483 9.54808C5.49552 9.80086 5.49552 10.2154 5.7483 10.4682Z",fill:"currentColor"})]}),Xw=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("path",{d:"M4.12488 5.02012H11.8779L11.1331 12.6138C11.1164 12.7828 11.0373 12.9396 10.9114 13.0536C10.7855 13.1676 10.6217 13.2307 10.4518 13.2306H5.55096C5.38127 13.2304 5.21769 13.1672 5.09198 13.0533C4.96627 12.9393 4.88739 12.7827 4.87067 12.6138L4.12488 5.02012ZM3.80233 3.74945C3.66582 3.74934 3.53081 3.77782 3.40598 3.83306C3.28116 3.8883 3.16929 3.96908 3.07757 4.07018C2.98586 4.17128 2.91634 4.29048 2.8735 4.42008C2.83065 4.54969 2.81542 4.68683 2.8288 4.82268L3.60586 12.738C3.65342 13.2208 3.87886 13.6688 4.23837 13.9947C4.59787 14.3206 5.06573 14.5012 5.55096 14.5012H10.4518C10.9371 14.5012 11.4049 14.3206 11.7644 13.9947C12.1239 13.6688 12.3494 13.2208 12.3969 12.738L13.175 4.82268C13.1883 4.68683 13.1731 4.54969 13.1303 4.42008C13.0874 4.29048 13.0179 4.17128 12.9262 4.07018C12.8345 3.96908 12.7226 3.8883 12.5978 3.83306C12.4729 3.77782 12.3379 3.74934 12.2014 3.74945H3.80135H3.80233Z",fill:"currentColor"}),b.jsx("path",{d:"M1.5 4.28322C1.5 4.11472 1.56694 3.95312 1.68608 3.83397C1.80523 3.71482 1.96683 3.64789 2.13533 3.64789H13.8646C13.948 3.64787 14.0306 3.6643 14.1077 3.69622C14.1848 3.72814 14.2549 3.77494 14.3139 3.83394C14.3729 3.89293 14.4197 3.96298 14.4516 4.04007C14.4836 4.11715 14.5 4.19978 14.5 4.28322C14.5 4.36666 14.4836 4.44929 14.4516 4.52638C14.4197 4.60347 14.3729 4.67351 14.3139 4.73251C14.2549 4.7915 14.1848 4.8383 14.1077 4.87022C14.0306 4.90214 13.948 4.91857 13.8646 4.91855H2.13533C1.96683 4.91855 1.80523 4.85162 1.68608 4.73247C1.56694 4.61332 1.5 4.45172 1.5 4.28322Z",fill:"currentColor"}),b.jsx("path",{d:"M5.02081 3.11277C5.02081 2.22135 5.74314 1.5 6.63358 1.5H9.3704C10.2618 1.5 10.9832 2.22135 10.9832 3.11277V4.92102H5.02081V3.11277ZM6.63358 2.77067C6.58866 2.77067 6.54417 2.77952 6.50266 2.79671C6.46116 2.8139 6.42345 2.8391 6.39168 2.87087C6.35991 2.90263 6.33471 2.94035 6.31752 2.98185C6.30033 3.02336 6.29148 3.06784 6.29148 3.11277V3.65036H9.7125V3.11277C9.7125 3.06784 9.70366 3.02336 9.68646 2.98185C9.66927 2.94035 9.64407 2.90263 9.61231 2.87087C9.58054 2.8391 9.54282 2.8139 9.50132 2.79671C9.45981 2.77952 9.41533 2.77067 9.3704 2.77067H6.63358Z",fill:"currentColor"})]}),Jw=()=>b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M3.5 8h8M8 4.5 11.5 8 8 11.5",stroke:"#fff",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),Zw=({tags:e})=>b.jsx("div",{className:"rte-skill-card-tags",children:e.map((t,n)=>b.jsx("span",{className:"rte-skill-tag",children:t},n))}),e6=()=>b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:b.jsx("path",{d:"M8.87301 3.52364C9.08579 3.52364 9.28984 3.60817 9.4403 3.75862C9.59075 3.90907 9.67527 4.11313 9.67527 4.3259V11.8137C9.67527 12.0265 9.59075 12.2305 9.4403 12.381C9.28984 12.5314 9.08579 12.6159 8.87301 12.6159H2.98976C2.88441 12.6159 2.78008 12.5952 2.68275 12.5549C2.58541 12.5146 2.49697 12.4555 2.42248 12.381C2.34798 12.3065 2.28889 12.218 2.24857 12.1207C2.20825 12.0234 2.1875 11.919 2.1875 11.8137V4.3259C2.1875 4.11313 2.27202 3.90907 2.42248 3.75862C2.57293 3.60817 2.77699 3.52364 2.98976 3.52364H8.87301ZM8.60559 4.59332H3.25718V11.5463H8.60559V4.59332ZM11.0102 1.38428C11.2098 1.38415 11.4022 1.45838 11.5499 1.59248C11.6977 1.72658 11.7901 1.91092 11.8093 2.10952L11.8125 2.18654V9.40315C11.8123 9.53947 11.7601 9.67059 11.6666 9.76971C11.573 9.86884 11.4451 9.92849 11.309 9.93648C11.1729 9.94447 11.0389 9.90019 10.9344 9.8127C10.8298 9.7252 10.7627 9.60109 10.7466 9.46573L10.7428 9.40315V2.45396H5.39655C5.26555 2.45394 5.13911 2.40585 5.04121 2.3188C4.94332 2.23175 4.88078 2.1118 4.86545 1.9817L4.86171 1.91912C4.86172 1.78812 4.90982 1.66168 4.99687 1.56379C5.08392 1.46589 5.20387 1.40335 5.33397 1.38802L5.39655 1.38428H11.0102Z",fill:"currentColor"})}),t6=()=>b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:b.jsx("path",{d:"M1.5548 5.88011C1.4304 5.76419 1.26586 5.70108 1.09584 5.70408C0.925831 5.70708 0.76362 5.77595 0.643383 5.89619C0.523147 6.01643 0.454274 6.17864 0.451274 6.34865C0.448274 6.51867 0.511382 6.68321 0.627302 6.80761L5.0023 11.1826C5.12535 11.3055 5.29215 11.3745 5.46605 11.3745C5.63996 11.3745 5.80676 11.3055 5.9298 11.1826L13.3673 3.74511C13.4832 3.62071 13.5463 3.45617 13.5433 3.28615C13.5403 3.11614 13.4715 2.95393 13.3512 2.83369C13.231 2.71345 13.0688 2.64458 12.8988 2.64158C12.7287 2.63858 12.5642 2.70169 12.4398 2.81761L5.46605 9.79049L1.5548 5.87923V5.88011Z",fill:"currentColor"})}),n6=()=>b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:b.jsx("path",{d:"M9.60188 14.5546C9.23571 14.5546 8.94276 14.4081 8.64982 14.1884C8.35687 13.8955 8.13717 13.5293 8.13717 13.0899V11.6251C6.52599 11.6251 3.88949 12.0646 2.49803 13.9687C2.27831 14.3349 1.76566 14.5546 1.32625 14.6278H1.10654C0.374181 14.4813 -0.0652364 13.8222 0.00800631 13.0899C0.374181 9.94073 1.47273 7.67041 3.37685 6.13247C4.76833 5.03394 6.37951 4.44805 8.13717 4.30157V2.9101C8.13717 2.25098 8.43012 1.66509 9.01601 1.44538C9.52865 1.29892 10.1145 1.37215 10.5539 1.81157L15.241 6.57189C15.6072 6.86484 15.8269 7.30424 15.9002 7.81689C15.9734 8.32955 15.8269 8.8422 15.4607 9.20837C15.3875 9.28161 15.3143 9.42807 15.1678 9.50132L10.6272 14.1152C10.3342 14.4081 9.96806 14.5546 9.60188 14.5546ZM8.4301 10.1604H9.60188V13.0899L14.2157 8.32955L14.289 8.25631C14.3622 8.18308 14.3622 8.0366 14.3622 7.96336C14.3622 7.81689 14.289 7.74366 14.2157 7.67041L14.1425 7.59718L9.52865 2.9101V5.69306L8.50335 5.7663C6.9654 5.7663 5.50068 6.27894 4.25568 7.23101C2.79096 8.40278 1.83891 10.3069 1.54596 12.7969C3.37685 10.5266 6.59922 10.1604 8.4301 10.1604Z",fill:"#7C3AED"})}),l6=({code:e})=>{const[t,n]=y.useState(!1),l=async r=>{r.stopPropagation();try{await navigator.clipboard.writeText(e),n(!0),window.setTimeout(()=>n(!1),2e3)}catch{ae.message.error("复制失败")}};return b.jsxs("div",{className:"rte-skill-share",onClick:r=>r.stopPropagation(),children:[b.jsxs("div",{className:"rte-skill-share-head",children:[b.jsxs("div",{className:"rte-skill-share-title",children:[b.jsx(n6,{}),b.jsx("span",{children:"分享码"})]}),b.jsx("span",{className:"rte-skill-share-hint",children:"复制后粘贴在「导入技能」即可使用"})]}),b.jsxs("div",{className:"rte-skill-share-box",children:[b.jsx("span",{className:"rte-skill-share-code",children:e}),b.jsxs("button",{type:"button",className:`rte-skill-share-copy${t?" rte-skill-share-copy-done":""}`,onClick:l,children:[t?b.jsx(t6,{}):b.jsx(e6,{}),b.jsx("span",{children:t?"已复制":"复制"})]})]})]})},r6=({card:e,selected:t,onClick:n,onShare:l,onEdit:r,onDelete:a,onUse:i,getPopupContainer:s})=>{const o=E=>E.stopPropagation(),[u,c]=y.useState(!1),[d,f]=y.useState(""),[h,m]=y.useState(!1),g=u||h,v=async E=>{if(c(E),!E){f("");return}try{const w=await l();f(typeof w=="string"&&w?w:`SK-${e.id}`)}catch{f(`SK-${e.id}`)}};return b.jsxs("div",{className:`rte-skill-card${t?" rte-skill-card-selected":""}`,onClick:n,role:"button","aria-pressed":t,children:[b.jsxs("div",{className:"rte-skill-card-header",children:[b.jsx("div",{className:"rte-skill-card-title",children:e.title}),b.jsxs("div",{className:`rte-skill-card-actions${g?" rte-skill-card-actions-pinned":""}`,children:[b.jsx(ae.Popover,{open:u,onOpenChange:v,trigger:"click",placement:"bottomRight",arrow:!1,overlayClassName:"rte-skill-share-popover",zIndex:1e4,getPopupContainer:s,content:b.jsx(l6,{code:d}),children:b.jsx("button",{type:"button",className:"rte-skill-card-action",title:"分享","aria-label":"分享",onClick:o,children:b.jsx(Kw,{})})}),b.jsx("button",{type:"button",className:"rte-skill-card-action",title:"编辑","aria-label":"编辑",onClick:E=>{o(E),r()},children:b.jsx(Qw,{})}),b.jsx(ae.Popconfirm,{title:"删除技能后不可恢复,确认删除吗?",open:h,onOpenChange:m,okText:"确认",cancelText:"取消",placement:"bottomRight",arrow:!1,overlayClassName:"rte-skill-delete-confirm",zIndex:1e4,icon:b.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.5 9C1.5 4.85786 4.85786 1.5 9 1.5C13.1421 1.5 16.5 4.85786 16.5 9C16.5 13.1421 13.1421 16.5 9 16.5C4.85786 16.5 1.5 13.1421 1.5 9ZM8.25 11.25V12.75H9.75V11.25H8.25ZM9.75 10.5L9.75 5.25H8.25L8.25 10.5H9.75Z",fill:"#F53F3F"})}),okButtonProps:{danger:!0},getPopupContainer:s,onConfirm:E=>{E?.stopPropagation(),m(!1),a()},onCancel:E=>{E?.stopPropagation(),m(!1)},children:b.jsx("button",{type:"button",className:"rte-skill-card-action rte-skill-card-action-delete",title:"删除","aria-label":"删除",onClick:o,children:b.jsx(Xw,{})})})]})]}),b.jsx("div",{className:"rte-skill-card-desc",children:e.desc}),b.jsx(Zw,{tags:e.tags}),b.jsx("div",{className:"rte-skill-card-divider"}),b.jsxs("div",{className:"rte-skill-card-footer",children:[b.jsx("span",{className:`rte-skill-card-badge rte-skill-card-badge-${e.badge}`,children:$w[e.badge]}),e.heat&&b.jsxs("span",{className:"rte-skill-card-heat",children:[b.jsx("span",{className:"rte-skill-card-heat-num",children:e.heat}),b.jsx("span",{className:"rte-skill-card-heat-text",children:"万人正在使用"})]}),b.jsxs("button",{type:"button",className:"rte-skill-card-use",onClick:E=>{o(E),i()},children:[b.jsx(Jw,{}),b.jsx("span",{children:"去使用"})]})]})]})},Yb=y.memo(({selectedId:e,onSelect:t,onAction:n,skillListFetch:l})=>{const[r,a]=y.useState(0),[i,s]=y.useState(l?[]:qw),[o,u]=y.useState(!1),c=Vn(),d=c?()=>c:void 0,f=y.useCallback(async()=>{if(l){u(!0);try{const g=await l();s(g.map(Ww))}catch{ae.message.error("技能列表加载失败")}finally{u(!1)}}},[l]);y.useEffect(()=>{f()},[f]);const h=g=>{e===g.id?t?.(null):t?.({id:g.id,title:g.title})},m=async g=>{try{await n?.("delete",{id:g.id,title:g.title})}catch{ae.message.error("删除失败");return}e===g.id&&t?.(null),l?await f():s(v=>v.filter(E=>E.id!==g.id)),ae.message.success("已删除技能")};return b.jsxs("div",{className:"rte-skill-panel",children:[b.jsxs("div",{className:"rte-skill-panel-header",children:[b.jsx("div",{className:"rte-skill-tabs",children:Vw.map((g,v)=>b.jsxs("div",{className:`rte-skill-tab${v===r?" rte-skill-tab-active":""}`,onClick:()=>a(v),children:[b.jsx("span",{className:"rte-skill-tab-text",children:g}),b.jsx("span",{className:"rte-skill-tab-underline"})]},g))}),b.jsxs("div",{className:"rte-skill-actions",children:[b.jsxs("div",{className:"rte-skill-search",children:[b.jsx("input",{className:"rte-skill-search-input",placeholder:"请输入想搜索的技能名称",readOnly:!0}),b.jsx("span",{className:"rte-skill-search-icon",children:b.jsx(Yw,{})})]}),b.jsxs("button",{type:"button",className:"rte-skill-import-btn",children:[b.jsx(jw,{}),b.jsx("span",{children:"导入技能"})]}),b.jsxs("button",{type:"button",className:"rte-skill-create-btn",children:[b.jsx(Gw,{}),b.jsx("span",{children:"基于会话创建技能"})]})]})]}),o?b.jsx("div",{className:"rte-skill-cards-status",children:b.jsx(ae.Spin,{})}):i.length===0?b.jsx("div",{className:"rte-skill-cards-status",children:"暂无技能"}):b.jsx("div",{className:"rte-skill-cards",children:i.map(g=>b.jsx(r6,{card:g,selected:e===g.id,onClick:()=>h(g),onShare:()=>n?.("share",{id:g.id,title:g.title}),onEdit:()=>n?.("edit",{id:g.id,title:g.title}),onDelete:()=>m(g),onUse:()=>t?.({id:g.id,title:g.title}),getPopupContainer:d},g.id))})]})});Yb.displayName="SkillPanel";const jb=8,a6=()=>b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:b.jsx("path",{d:"M10.4103 0.600098C11.2711 0.600098 11.9863 1.2657 11.9863 2.1081C11.9863 2.2985 11.9479 2.4873 11.8751 2.6641L10.9119 4.9921H12.6255C13.4455 4.9921 14.1327 5.5961 14.1959 6.3817L14.2007 6.5009C14.2007 6.8905 14.0431 7.2641 13.7639 7.5433L6.28226 15.0321C6.05292 15.2576 5.74735 15.3888 5.42594 15.3999C5.10452 15.411 4.79062 15.3012 4.54626 15.0921C4.19986 14.7929 4.05346 14.3297 4.16706 13.9113L5.20146 9.4593H3.28146C2.63906 9.4593 2.09506 8.9873 2.03666 8.3649L2.03186 8.2537C2.03186 8.0993 2.06306 7.9457 2.12066 7.8073L4.67986 1.5513C4.92146 0.970498 5.50306 0.600098 6.14306 0.600098H10.4103ZM10.4103 1.8001H6.14386C5.97906 1.8001 5.83986 1.8889 5.78866 2.0105L3.23586 8.2521C3.24066 8.2521 3.24626 8.2537 3.25346 8.2553L3.28306 8.2585H5.55506C5.62866 8.2585 5.70146 8.2665 5.77186 8.2833C6.26786 8.4001 6.58466 8.8937 6.45506 9.3713L5.33506 14.1857L5.35586 14.1969C5.37426 14.2017 5.39586 14.2009 5.41266 14.1953L5.43426 14.1833L12.9151 6.6953C12.9414 6.67028 12.9625 6.64029 12.9772 6.60706C12.9919 6.57383 12.9999 6.53802 13.0007 6.5017C13.0007 6.3417 12.8415 6.1937 12.6247 6.1937H10.4887C10.3799 6.1937 10.2719 6.1745 10.1687 6.1377C10.0535 6.09806 9.94761 6.03536 9.85749 5.95342C9.76737 5.87149 9.6949 5.77204 9.64451 5.66115C9.59412 5.55026 9.56687 5.43027 9.56442 5.30849C9.56197 5.18672 9.58437 5.06572 9.63026 4.9529L10.7671 2.2049C10.7797 2.17445 10.7862 2.14184 10.7863 2.1089C10.7863 1.9481 10.6279 1.8001 10.4111 1.8001H10.4103ZM7.10386 2.6433C7.25151 2.70252 7.3696 2.81796 7.43215 2.96423C7.49471 3.1105 7.49662 3.27562 7.43746 3.4233L6.79746 5.0233C6.73604 5.16775 6.62045 5.28238 6.4755 5.34261C6.33054 5.40283 6.16775 5.40385 6.02205 5.34544C5.87635 5.28704 5.75934 5.17386 5.69612 5.03018C5.6329 4.88651 5.6285 4.72378 5.68386 4.5769L6.32386 2.9769C6.38308 2.82925 6.49852 2.71116 6.64479 2.6486C6.79106 2.58605 6.95618 2.58414 7.10386 2.6433Z",fill:"currentColor",stroke:"currentColor",strokeWidth:"0.2"})}),Gb=y.memo(({disabled:e,selectedSkill:t,onSkillSelect:n,onSkillAction:l,skillListFetch:r})=>{const[a,i]=y.useState(!1),[s,o]=y.useState(null),u=y.useRef(null),c=y.useRef(null),d=Vn(),f=y.useCallback(()=>(u.current?.closest(".rich-text-editor")??u.current)?.getBoundingClientRect()??null,[]),h=y.useCallback(()=>{const w=f();if(!w)return;const N=w.bottom+jb,L=Math.max(0,window.innerHeight-N-jb),C=(c.current?.offsetParent??d)?.getBoundingClientRect(),I=C?.left??0,_=C?.top??0;o({left:w.left-I,top:N-_,width:w.width,maxHeight:L})},[f,d]);y.useLayoutEffect(()=>{if(a)return h(),window.addEventListener("scroll",h,!0),window.addEventListener("resize",h),()=>{window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h)}},[a,h]),y.useEffect(()=>{if(!a)return;const w=N=>{const L=N.target;u.current?.contains(L)||c.current?.contains(L)||L instanceof Element&&L.closest(".rte-skill-delete-confirm, .rte-skill-share-popover")||i(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[a]);const m=y.useCallback(()=>{e||i(w=>!w)},[e]),g=y.useCallback(w=>{n?.(w),w&&i(!1)},[n]),v=!!t,E=`rte-skill-badge${v?" rte-skill-badge-selected":a?" rte-skill-badge-active":""}`;return b.jsxs(b.Fragment,{children:[b.jsxs("div",{ref:u,className:E,onClick:m,role:"button","aria-pressed":a||v,style:{cursor:e?"not-allowed":"pointer"},children:[b.jsx(a6,{}),b.jsx("span",{className:"rte-skill-text",children:"技能"})]}),a&&fi.createPortal(b.jsx("div",{ref:c,className:"rte-skill-panel-popup",style:{position:"fixed",left:s?.left??0,top:s?.top??0,width:s?.width,zIndex:9999,maxHeight:s?.maxHeight,display:"flex",flexDirection:"column",overflow:"hidden",visibility:s?"visible":"hidden"},children:b.jsx(Yb,{selectedId:t?.id??null,onSelect:g,onAction:l,skillListFetch:r})}),d??document.body)]})});Gb.displayName="SkillButton";const i6=10*1024*1024,s6=50*1024*1024,o6="图片大小不能超过 10MB",u6="文件总大小不能超过 50MB",c6=e=>e.type?.startsWith("image/")||/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(e.name||""),d6=(e,t)=>{let n=!1;const l=t.filter(o=>c6(o)&&o.size>i6?(n=!0,!1):!0),r=e.reduce((o,u)=>o+u.size,0),a=[];let i=r,s=!1;for(const o of l){if(i+o.size>s6){s=!0;break}a.push(o),i+=o.size}return{accepted:a,imageOversize:n,totalExceeded:s}},Kb=y.memo(({files:e,onChange:t,disabled:n})=>{const l=y.useRef(null),r=y.useCallback(i=>{const s=Array.from(i.target.files??[]);if(i.target.value="",s.length===0)return;const{accepted:o,imageOversize:u,totalExceeded:c}=d6(e,s);u&&ae.message.error(o6),c&&ae.message.error(u6),o.length>0&&t([...e,...o])},[e,t]),a=y.useCallback(()=>{n||l.current?.click()},[n]);return b.jsxs("div",{className:"rte-footer-upload",children:[b.jsx("div",{className:"rte-footer-upload-btn",onClick:a,title:"上传文件",style:{cursor:n?"not-allowed":"pointer",opacity:n?.6:1,pointerEvents:n?"none":"auto"},children:b.jsx("i",{className:"iconfont icon-lianjie",style:{fontSize:"16px"}})}),b.jsx("input",{ref:l,type:"file",multiple:!0,style:{display:"none"},onChange:r})]})});Kb.displayName="UploadButton";const Qb=y.memo(({onClick:e,loading:t,disabled:n})=>b.jsx("button",{type:"button",className:"rich-text-editor-send-button","data-testid":"rte-send-button",onClick:e,disabled:n||t,children:t?b.jsx("span",{className:"rte-send-spinner"}):b.jsx("i",{className:"iconfont icon-fasong"})}));Qb.displayName="SendButton";const Xb=y.memo(({currentAgent:e})=>{const t=e?.points;return t==null?null:b.jsxs("div",{className:"rte-points-badge",style:{position:"relative"},children:[b.jsx("i",{className:"iconfont icon-jifen",style:{marginRight:"4px",fontSize:"16px"}}),b.jsxs("span",{style:{fontSize:"16px",lineHeight:"22px"},children:["-",String(t)]}),e?.labelValue===2&&b.jsx("div",{className:"rte-limited-free-badge",children:b.jsx("span",{className:"rte-limited-free-text",children:"限时免费"})})]})});Xb.displayName="PointsBadge";const Jb=y.memo(({isProcessing:e,loading:t,disabled:n,sendDisabled:l,showFooterUpload:r=!0,footerFiles:a,onFooterFilesChange:i,agentOptions:s,onAgentSelect:o,hideAgentButton:u,currentAgent:c,selectedSkill:d,onSkillSelect:f,onSkillAction:h,skillListFetch:m,onSend:g,padding:v="12px 16px"})=>{const E=y.useCallback(w=>{if(w.reduce((O,C)=>O+C.size,0)>52428800){const O=[];let C=0;for(const I of w){if(C+I.size>52428800)break;O.push(I),C+=I.size}i(O)}else i(w)},[i]);return b.jsxs("div",{className:"rich-text-editor-footer",style:{padding:v},children:[b.jsxs("div",{className:"rich-text-editor-footer-left",children:[b.jsxs("div",{className:"rich-text-editor-brand",children:[!u&&s&&s.length>0&&b.jsx(Wb,{options:s,onSelect:o,disabled:n||e,currentAgent:c}),b.jsx(Gb,{disabled:n||e,selectedSkill:d,onSkillSelect:f,onSkillAction:h,skillListFetch:m})]}),r&&b.jsx(Kb,{files:a,onChange:E,disabled:n||e})]}),b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[b.jsxs("div",{className:"rte-brand-badge",children:[b.jsx("div",{className:"rte-brand-badge",children:b.jsx("img",{src:"https://oospublic.sealseek.cn/file/website/ball.png",alt:""})}),b.jsx("span",{className:"rte-brand-text",style:{marginLeft:"4px"},children:"SealSeek 2.0"})]}),b.jsx(Xb,{currentAgent:c}),b.jsx(Qb,{onClick:g,loading:t||e,disabled:n||l})]})]})});Jb.displayName="Footer";const f6=e=>e<1024?`${e}B`:e<1024*1024?`${Math.round(e/1024)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`,h6=e=>(e.type?.startsWith("image/")??!1)||/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(e.name||""),p6=e=>{const t=(e||"").split(".").pop()?.toLowerCase()||"";return["xls","xla","xlb","xlc","xlm","xlsx","xlt","xlw","csv","tsv","iif"].includes(t)?"icon-a-xlsxcsv":["doc","docx","dot","odt","rtf","wiz"].includes(t)?"icon-docx":["ppt","pptx","pot","ppa","pps","pwz"].includes(t)?"icon-ppt":["txt","asm","bat","c","cc","conf","cpp","css","cxx","def","dic","eml","h","hh","in","js","ksh","php","pkl","rb","tar","tex","ts","xml"].includes(t)?"icon-txt":t==="pdf"?"icon-pdf":["html","htm","json","ics","ifb"].includes(t)?"icon-a-htmljson":t==="md"?"icon-md":"icon-lianjie"},b6=({file:e,onRemove:t})=>{const n=h6(e),l=Vn(),r=pf(n?e:null);return b.jsxs("div",{className:"rte-footer-file-chip",children:[n?b.jsx(ae.Image,{className:"rte-footer-file-thumb",width:32,height:32,src:r,alt:e.name,preview:l?{getContainer:()=>l}:void 0}):b.jsx("div",{className:"rte-footer-file-icon",children:b.jsx("svg",{style:{width:"18px",height:"18px"},"aria-hidden":"true",children:b.jsx("use",{xlinkHref:`#${p6(e.name)}`})})}),b.jsxs("div",{className:"rte-footer-file-info",children:[b.jsx("span",{className:"rte-footer-file-name",title:e.name,children:e.name}),b.jsx("span",{className:"rte-footer-file-size",children:f6(e.size)})]}),b.jsx("span",{className:"rte-footer-file-remove",onClick:a=>{a.stopPropagation(),t()},children:b.jsx("i",{className:"iconfont icon-guanbi",style:{width:"8px",height:"8px",fontSize:"8px",display:"flex",alignItems:"center"}})})]})},Zb=y.memo(({files:e,onChange:t})=>{const n=y.useRef(null),[l,r]=y.useState({showLeft:!1,showRight:!1}),a=y.useCallback(()=>{const o=n.current;o&&r({showLeft:o.scrollLeft>0,showRight:o.scrollLeft+o.clientWidth<o.scrollWidth-1})},[]);y.useLayoutEffect(()=>{a()},[e,a]);const i=y.useCallback(o=>{const u=n.current;u&&(u.scrollBy({left:o*200,behavior:"smooth"}),window.setTimeout(a,300))},[a]),s=y.useCallback(o=>()=>t(e.filter((u,c)=>c!==o)),[e,t]);return e.length===0?null:b.jsxs("div",{className:"rte-footer-files-wrapper",children:[l.showLeft&&b.jsx("div",{className:"rte-footer-files-mask rte-footer-files-mask-left",children:b.jsx("span",{className:"rte-footer-files-arrow rte-footer-files-arrow-left",onClick:()=>i(-1),children:b.jsx("svg",{style:{width:"16px",height:"16px",transform:"rotate(180deg)"},"aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-fanhuijiantou"})})})}),b.jsx("div",{className:"rte-footer-files-list",ref:n,onScroll:a,children:e.map((o,u)=>b.jsx(b6,{file:o,onRemove:s(u)},`${o.name}-${o.size}-${u}`))}),l.showRight&&b.jsx("div",{className:"rte-footer-files-mask rte-footer-files-mask-right",children:b.jsx("span",{className:"rte-footer-files-arrow rte-footer-files-arrow-right",onClick:()=>i(1),children:b.jsx("svg",{style:{width:"16px",height:"16px"},"aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-fanhuijiantou"})})})})]})});Zb.displayName="FooterFilesList";const em=9999,tm=e=>{const{config:t,onSend:n,isProcessing:l=!1,disabled:r=!1,placeholder:a,nodeValues:i,onFilesChange:s,onFooterFilesChange:o,footerFiles:u,width:c,background:d="transparent",border:f,maxHeight:h,minHeight:m,editorMinHeight:g,editorPadding:v,className:E,videoUrlParse:w,videoUpload:N,reportAnalyze:L,reportListFetch:O,onReportGoGenerate:C,reportNameResolve:I,onViewReport:_,hideCurrentSessionReport:A,markdownAnalyze:R,markdownNameAnalyze:P,agentOptions:F,onAgentSelect:V,onAgentExit:B,onSkillAction:T,skillListFetch:H,loading:W,hideButtons:q,footerPadding:K,showFooterUpload:S,lockStructure:ie=!0,collapsed:ee=!1,onCollapsedChange:D,collapseTransitionMs:fe=260,nodeDefaults:Ae,onExpandedHeightChange:Se,collapsedTotalHeight:ue,toggleOnBlankClick:Ce=!0,getPopupContainer:Oe,scrollContainerRef:xe,autoCollapseOnScroll:st}=e,[Qe,bt]=y.useState({}),[ot,On]=y.useState({}),[he,Le]=y.useState(u??[]),[Mn,rn]=y.useState({}),[Dn,Ln]=y.useState(Uw),[ri,ai]=y.useState(()=>new Set),[ii,al]=y.useState({}),[Y,J]=y.useState(null),be=y.useCallback(()=>Oe?.()??Y??document.body,[Oe,Y]),[ye,Me]=y.useState(null),Nt=y.useCallback((z,ne)=>{Me(ne?z:null)},[]),Pt=y.useRef(null),[Ht,il]=y.useState(58),[wt,ut]=y.useState(58),[Pn,Ut]=y.useState(!1),[Vo,cm]=y.useState(!1),dm=y.useRef(0),fm=y.useRef(ee),[si,hm]=y.useState(!1);fm.current!==ee&&(fm.current=ee,dm.current=(typeof performance<"u"?performance.now():Date.now())+fe,hm(!0)),y.useEffect(()=>{if(!si)return;const z=setTimeout(()=>hm(!1),fe);return()=>clearTimeout(z)},[si,ee,fe]);const[sl,pm]=y.useState(""),$o=y.useRef(null),bm=y.useRef(null),[qo,mm]=y.useState(0),Wo=y.useRef(!1);y.useEffect(()=>{if(!u||u.length===he.length&&u.every((te,re)=>{const se=he[re];return se&&te.name===se.name&&te.size===se.size&&te.lastModified===se.lastModified}))return;const ne=50*1024*1024;if(u.reduce((te,re)=>te+re.size,0)>ne){const te=[];let re=0;for(const se of u){if(re+se.size>ne)break;te.push(se),re+=se.size}Le(te)}else Wo.current=!0,Le(u)},[u]);const Tt=y.useMemo(()=>Hw(t,Dn,ri),[t,Dn,ri]),Yo=y.useRef(null),gm=y.useRef(!1);y.useEffect(()=>{const z=t.find(ne=>ne.type==="tag")?.text??null;if(!gm.current){gm.current=!0,Yo.current=z;return}Yo.current!==z&&(Yo.current=z,Le(ne=>ne.length===0?ne:[]))},[t]);const Br=y.useMemo(()=>{const z=t.find(ne=>ne.type==="tag")?.text;if(!(!z||!F))return F.find(ne=>ne.label===z)},[t,F]);kw(i,Qe,bt,Tt,ot,On);const Rr=y.useRef(new Map),vm=y.useRef(""),ym=(t.find(z=>z.type==="tag")?.text||"")+"||"+t.filter(z=>z.key&&z.type!=="report-module"&&z.type!=="markdown-module").map(z=>`${z.type}:${z.key}`).join("|");vm.current!==ym&&(vm.current=ym,Rr.current=new Map);const[an,oi]=y.useState(null),_6=y.useCallback(z=>{oi(z),z&&Br&&B?.()},[Br,B]),I6=y.useCallback(z=>{oi(null),V?.(z)},[V]);y.useEffect(()=>{Br&&oi(null)},[Br]);const{errors:O6,validate:Em,clearError:Tm}=ww(Tt),{excludedKeys:Fr,hideSeparator:M6}=Ow(Tt,Qe,ot),{analyzeReport:ui,analyzeMarkdown:Cm,analyzeMarkdownName:Sm,resolveReportName:ci}=Mw({reportAnalyze:L,markdownAnalyze:R,markdownNameAnalyze:P,reportNameResolve:I}),xm=z=>typeof z!="string"?!z:z.replace(/<[^>]*>/g,"").replace(/ /gi,"").replace(/\s/g,"").replace(/[]/g,"").trim()==="",jo=y.useCallback((z,ne)=>{bt(te=>({...te,[z]:ne})),Tm(z);const ce=/^(.+)__module_\d+$/.exec(z);if(ce&&xm(ne)){const te=ce[1];Tt.find(se=>se.key===te&&se.type==="markdown-module")&&bt(se=>{const me={...se,[z]:ne};return Object.keys(me).filter(_e=>_e.startsWith(`${te}__module_`)).every(_e=>xm(me[_e]))&&(Ln(_e=>{if(!_e.markdownModules[te])return _e;const Be={..._e.markdownModules};return delete Be[te],{..._e,markdownModules:Be}}),Object.keys(me).filter(_e=>_e.startsWith(`${te}__module_`)).forEach(_e=>delete me[_e]),me[te]=""),me});return}if(typeof ne=="string"&&ne.trim()===""){const te=Tt.find(re=>re.key===z);te?.type==="report-url"?(Ln(re=>{if(!re.reportModules[z])return re;const se={...re.reportModules};return delete se[z],{...re,reportModules:se}}),al(re=>{if(!(z in re))return re;const se={...re};return delete se[z],se})):(te?.type==="markdown"||te?.type==="markdown-name")&&Ln(re=>{if(!re.markdownModules[z])return re;const se={...re.markdownModules};return delete se[z],{...re,markdownModules:se}})}},[Tm,Tt]),D6=y.useCallback((z,ne)=>{On(ce=>({...ce,[z]:ne}))},[]),L6=y.useCallback((z,ne)=>rn(ce=>({...ce,[z]:ne})),[]),P6=y.useCallback(z=>{al(ne=>{if(!(z in ne))return ne;const ce=z.match(/^(.+)_(\d+)$/);if(!ce){const Ie={...ne};return delete Ie[z],Ie}const[,te,re]=ce,se=parseInt(re,10),me={};for(const[Ie,_e]of Object.entries(ne)){if(Ie===z)continue;const Be=Ie.match(/^(.+)_(\d+)$/);if(Be&&Be[1]===te){const ct=parseInt(Be[2],10);ct>se?me[`${te}_${ct-1}`]=_e:me[Ie]=_e}else me[Ie]=_e}return me})},[]),B6=y.useCallback((z,ne)=>{al(ce=>{const te=`${z}_`,re=[];for(const me of Object.keys(ce)){if(!me.startsWith(te))continue;const Ie=me.slice(te.length);/^\d+$/.test(Ie)&&re.push([Number(Ie),ce[me]])}if(re.length===0)return ce;const se={...ce};for(const[me]of re)delete se[`${z}_${me}`];for(const[me,Ie]of re){if(me===ne)continue;const _e=me>ne?me-1:me;se[`${z}_${_e}`]=Ie}return se})},[]),Go=y.useCallback(async(z,ne,ce)=>{const te=await ci(z,ne,ce);return te.status==="success"&&al(re=>({...re,[z]:te.name})),te},[ci]),R6=y.useCallback((z,ne)=>{ui(z,ne).then(ce=>{ce.status==="success"&&Ln(te=>({...te,reportModules:{...te.reportModules,[z]:ce.modules}}))})},[ui]),Ko=y.useCallback(async(z,ne)=>{ci(z,ne,"report-url").then(te=>{te.status==="success"&&al(re=>({...re,[z]:te.name}))});const ce=await ui(z,ne);ce.status==="success"?(Ln(te=>({...te,reportModules:{...te.reportModules,[z]:ce.modules}})),bt(te=>{const re={...te};return ce.modules.forEach((se,me)=>{re[`${z}__module_${me}`]=se.content}),re})):ce.status==="failed"&&(jo(z,""),bt(te=>{let re=!1;const se={...te};for(const me of Object.keys(se))me.startsWith(`${z}__module_`)&&(delete se[me],re=!0);return re?se:te}))},[ui,ci,jo]);y.useEffect(()=>{if(!i||t.length===0)return;const z=t.filter(ce=>ce.type==="report-url"&&ce.key),ne=t.filter(ce=>ce.type==="multi-variable-select"&&ce.key);if(!(z.length===0&&ne.length===0)){for(const ce of z){const te=ce.key,re=i[te]??i[`${te}__url`];if(!re||typeof re=="string"&&!re.trim())continue;const se=Array.isArray(re)?String(re[0]??""):String(re);se&&Rr.current.get(te)!==se&&(Rr.current.set(te,se),setTimeout(()=>{Ko(te,se)},100))}for(const ce of ne){const te=ce.key,re=i[te];!Array.isArray(re)||re.length===0||re.forEach((se,me)=>{const Ie=typeof se=="string"?se.trim():"";if(!Ie)return;const _e=`${te}_${me}`;Rr.current.get(_e)!==Ie&&(Rr.current.set(_e,Ie),setTimeout(()=>{Go(_e,Ie,"multi-variable-select")},100))})}}},[i,t,Ko,Go]);const di=y.useCallback(async(z,ne,ce)=>{const re=Date.now();ai(se=>{const me=new Set(se);return me.add(z),me});try{const se=await ce(z,ne),me=Date.now()-re;me<500&&await new Promise(Ie=>setTimeout(Ie,500-me)),se&&(Ln(Ie=>({...Ie,markdownModules:{...Ie.markdownModules,[z]:se.modules}})),bt(Ie=>{const _e={...Ie};return se.modules.forEach((Be,ct)=>{_e[`${z}__module_${ct}`]=Be.content}),_e}))}finally{ai(se=>{if(!se.has(z))return se;const me=new Set(se);return me.delete(z),me})}},[]),F6=y.useCallback((z,ne)=>di(z,ne,Cm),[di,Cm]),H6=y.useCallback((z,ne)=>di(z,ne,Sm),[di,Sm]);y.useEffect(()=>{s?.(ot)},[ot,s]),y.useEffect(()=>{if(Wo.current){Wo.current=!1;return}o?.(he)},[he,o]);const Qo=y.useCallback(async()=>{if(l||r)return;if(t.length===0){const te=sl.trim();if(!te)return;const re=an?`【${an.title}】${te}`:te;n(te,re),pm("");return}if(!Em(Qe,ot,Fr))return;const{formData:z,fullPrompt:ne,hasContent:ce}=await Fw({config:Tt,values:Qe,files:ot,footerFiles:he,markdownModules:Dn.markdownModules});ce&&n(z,ne)},[t.length,sl,an,Tt,Qe,ot,he,Dn.markdownModules,l,r,Em,n,Fr]),U6=y.useCallback(z=>{z.key==="Enter"&&(z.nativeEvent.isComposing||z.keyCode===229||z.shiftKey||(z.preventDefault(),Qo()))},[Qo]),z6=y.useMemo(()=>t.length===0?sl.trim().length>0:Nw(Tt,Qe,ot,Fr),[t.length,sl,Tt,Qe,ot,Fr]);y.useLayoutEffect(()=>{if(!an){mm(0);return}const z=bm.current;if(!z)return;const ne=z.getBoundingClientRect().width-2;mm(Math.max(0,ne))},[an]),y.useLayoutEffect(()=>{const z=$o.current;z&&(z.style.height="auto",z.style.height=`${z.scrollHeight}px`)},[sl,qo]);const V6={width:c,background:d,border:f,maxHeight:h,...m&&!ee?{minHeight:m}:{},...g?{"--rte-editor-min-height":typeof g=="number"?`${g}px`:g}:{},...v?{"--rte-editor-padding":v}:{}},km=typeof ue=="number"?ue:Ht,Am={maxHeight:ee?km:Math.max(wt,km),minHeight:ee||si?0:void 0,overflow:ee||si?"hidden":Pn?"auto":"hidden",transition:Vo?"none":`max-height ${fe}ms cubic-bezier(0.4, 0, 0.2, 1)`,willChange:"max-height"},Nm=y.useCallback(()=>{ee&&Ce&&D?.(!1),$o.current?.focus()},[ee,Ce,D]),Xo=y.useCallback(()=>{const z=Pt.current;if(!z)return;if(!ee&&(typeof performance<"u"?performance.now():Date.now())>=dm.current){const te=z.style.maxHeight;z.style.maxHeight="none";const re=z.offsetHeight;z.style.maxHeight=te;const se=Math.max(0,Math.ceil(z.scrollHeight||0),Math.ceil(re||0));se>0&&ut(me=>me===se?me:se)}try{const ce=z.getBoundingClientRect(),te=z.querySelector(".rte-config-fade")??z,re=document.createRange();re.selectNodeContents(te);const se=Array.from(re.getClientRects());if(se.length>0){const me=Math.min(...se.map(ct=>ct.top)),Ie=2;let _e=0;for(const ct of se)Math.abs(ct.top-me)<=Ie&&(_e=Math.max(_e,ct.bottom));const Be=_e>0?Math.ceil(_e-ce.top):0;Be>0&&il(ct=>ct===Be?ct:Be)}}catch{}const ne=z.scrollHeight>z.clientHeight+1;Ut(ce=>ce===ne?ce:ne)},[ee]),Rl=y.useMemo(()=>Tt.filter(z=>z.key&&z.type!=="report-module"&&z.type!=="markdown-module").map(z=>`${z.type}:${z.key}`).join("|"),[Tt]),wm=y.useRef(Rl);wm.current!==Rl&&(wm.current=Rl,ee||(ut(em),cm(!0))),y.useEffect(()=>{if(!Vo)return;const z=setTimeout(()=>cm(!1),fe);return()=>clearTimeout(z)},[Vo,Rl,fe]),y.useLayoutEffect(()=>{const z=Pt.current;if(!z||(Xo(),typeof ResizeObserver>"u"))return;const ne=new ResizeObserver(()=>Xo());ne.observe(z);const ce=z.querySelector(".rte-default-textarea, .rte-config-fade");return ce&&ne.observe(ce),()=>ne.disconnect()},[Xo,Tt,ot,he.length,ii,ee,Rl,sl]);const _m=y.useRef(-1);y.useEffect(()=>{ee||wt<=0||wt>=em||_m.current!==wt&&(_m.current=wt,Se?.(wt))},[wt,ee,Se]);const Im=y.useMemo(()=>new Set(["pdf","xla","xlb","xlc","xlm","xls","xlsx","xlt","xlw","csv","tsv","iif","doc","docx","dot","odt","rtf","pot","ppa","pps","ppt","pptx","pwz","wiz","asm","bat","c","cc","conf","cpp","css","cxx","def","dic","eml","h","hh","htm","html","ics","ifb","in","js","json","ksh","png","jpeg","jpg","gif","webp","md","php","pkl","rb","tar","tex","ts","txt","xml"]),[]),$6=y.useCallback(z=>{const ne=z.clipboardData?.files;if(!ne||ne.length===0||(z.preventDefault(),t.some(Be=>Be.type==="tag")))return;const te=[];let re=!1;for(const Be of Array.from(ne)){const ct=(Be.name||"").split(".").pop()?.toLowerCase()||"";Im.has(ct)?te.push(Be):re=!0}if(re&&ae.message.error("粘贴文件中含不支持的类型,已自动过滤"),te.length===0)return;const se=50*1024*1024,me=he.reduce((Be,ct)=>Be+ct.size,0),Ie=[];let _e=me;for(const Be of te){if(_e+Be.size>se){ae.message.error("文件总大小不能超过 50MB");break}Ie.push(Be),_e+=Be.size}Ie.length>0&&Le(Be=>[...Ie,...Be])},[Im,t,he]);return b.jsx(ae.ConfigProvider,{getPopupContainer:be,children:b.jsxs(Gd.Provider,{value:Y,children:[b.jsxs("div",{className:`rich-text-editor ${ye?"rte-richtext-container-expanded":""} ${E??""}`,"data-component":"structured-editor",style:V6,onPaste:$6,children:[b.jsx(Zb,{files:he,onChange:Le}),t.length===0?b.jsxs("div",{ref:Pt,className:`rte-editor rte-editor-default${an?" rte-editor-default-with-skill":""}`,style:Am,onClick:Nm,children:[an&&b.jsx("span",{ref:bm,className:"rte-skill-inline-tag-wrap",contentEditable:!1,children:b.jsx(hi,{node:{type:"tag",text:an.title},onClose:()=>oi(null)})}),b.jsx("textarea",{ref:$o,className:"rte-default-textarea",value:sl,onChange:z=>pm(z.target.value),onKeyDown:U6,placeholder:a??"",disabled:r,rows:1,style:qo?{textIndent:`${qo}px`}:void 0})]}):b.jsx("div",{ref:Pt,className:`rte-editor${ye?" rte-richtext-fullscreen-active":""}`,style:Am,onClick:Nm,children:b.jsx("div",{className:"rte-config-fade",children:Tt.map((z,ne)=>{if(z.key&&Fr.has(z.key)||M6&&z.exclusionGroup==="separator"||ye&&z.key!==ye)return null;const ce=(z.type==="report-module"||z.type==="markdown-module")&&z.key?`${z.key}__module_${z.moduleIndex??0}`:z.key;return b.jsx(Bb,{node:z,value:ce?Qe[ce]:void 0,files:ot,onChange:jo,onFileChange:D6,thumbnails:Mn,onThumbnailChange:L6,videoUrlParse:w,videoUpload:N,reportListFetch:O,onReportGoGenerate:C,onViewReport:_,hideCurrentSessionReport:A,reportNames:ii,onClearReport:P6,onResolveMultiName:Go,onAnalyzeMultiReport:R6,onShiftReportNames:B6,onAgentExit:B,hideAgentClose:q==="hideTagClose",onReportUrlParse:Ko,onMarkdownParse:F6,onMarkdownNameParse:H6,onRichtextExpandChange:Nt,disabled:r,error:ce?O6[ce]:void 0,index:ne,nodeDefaults:Ae},ce??`text-${ne}`)})},Rl)}),b.jsx(Jb,{isProcessing:l,loading:W,disabled:r,sendDisabled:!z6,showFooterUpload:S,footerFiles:he,onFooterFilesChange:Le,agentOptions:F,onAgentSelect:I6,hideAgentButton:q==="hideAgent",currentAgent:Br,selectedSkill:an,onSkillSelect:_6,onSkillAction:T,skillListFetch:H,onSend:Qo,padding:K})]}),b.jsx("div",{className:"rte-popup-host",ref:J})]})})},nm="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAFSSURBVHgB3ZTtccIwDIaVXv83I2SDZgSP0BHMBG0naEZhA2boBGQDswHdQJUOGRxjO0Z8HPDe6eJzJD2W4gjgEYSIn2xwK6EIFHqBGysJpMP3ZB0oRbEtmal1NtIxl4OWWsoxEsvqofJ0rgTNASOYq+7SXKDsuYvAcgkq/PWwBLQWqIfdjeRStaBUc4qzgLi9/BzJNmS/sh6bpvmrTfSFacU3scWy1mQryWdSnXiFE8QVUJINLTuyhWzzz/1OZmTN9hEckqtfUOwIGlGCpVRjE+94JFqpMtTeVzO8/UmPxpZU8Qa7aln8Tb9pfwla4WHWrjPvvbbnTBsX7PmLs83EDAH0BxSw1G31+/1FoDg/vPcXR+wocQS1apj4+P92FfhOoLyuBfYlmPgYnGoCjWADzAkzUyJ430awLmphPaxWQVU22BuuApPkHaanjcXSN3t6/QNjTMSJWDcs1QAAAABJRU5ErkJggg==",m6=[{label:"5页",value:5},{label:"10页",value:10},{label:"15页",value:15},{label:"30页",value:30}],g6=({autoLoading:e,batchSize:t,loadingProgress:n,loadIcon:l,onBatchSizeChange:r,onLoadNextPage:a,onStartAutoLoad:i,onStopLoad:s})=>e&&n?b.jsxs("div",{className:"auto_load_progress",children:[l||b.jsx("img",{src:nm,alt:"自动加载",width:14,height:14}),b.jsxs("span",{children:["正在加载第",n.currentPage,"/",n.totalPages,"页"]}),b.jsx(ae.Progress,{percent:n.percentage,type:"line",size:[160,8]}),b.jsx("span",{onClick:s,className:"auto_load_stop_btn",children:"停止加载"})]}):b.jsxs("div",{className:"auto_load_container",children:[b.jsx("div",{onClick:a,className:"auto_load_next_btn",style:{backgroundColor:e?"#f5f5f5":"#2563eb"},children:"加载下一页"}),b.jsxs("div",{className:"right_control_wrap",style:{backgroundColor:e?"#f5f5f5":"#2563eb"},children:[b.jsxs("div",{className:"auto_load_btn",onClick:e?void 0:i,children:[l||b.jsx("img",{src:nm,alt:"自动加载",width:14,height:14}),b.jsx("span",{children:"自动加载"})]}),b.jsx(ae.Select,{value:t,onChange:r,options:m6,disabled:e,size:"small",className:"auto_load_select",popupMatchSelectWidth:84})]})]}),v6=({current:e,loadIcon:t,pageSize:n,total:l,cachedPages:r,loadedCount:a,autoLoading:i=!1,loadingProgress:s,onChange:o,onLoadNextPage:u,onStartAutoLoad:c,onStopLoading:d})=>{const[f,h]=y.useState(5),m=Math.ceil(l/n),g=y.useMemo(()=>r.length>=m,[r,m]),v=()=>Array.from({length:m},(N,L)=>L+1).filter(N=>!r.includes(N)).slice(0,f),E=(w,N,L)=>{const O=r.includes(w);return N==="prev"||N==="next"||N==="jump-prev"||N==="jump-next"?b.jsx("div",{className:"pageBox",children:L}):b.jsxs("div",{className:"pageBox",style:{backgroundColor:e===w?"#2563EB":"#f5f5f5",color:e===w?"#fff":O?"#171717":"#a3a3a3"},children:[w,!O&&b.jsx("span",{className:"unload_spot"})]})};return b.jsxs("div",{className:"pagination_footer",children:[b.jsxs("div",{className:"pagination_leftWrap",children:[b.jsxs("span",{className:"pagination_total",children:[b.jsx(zt.InfoCircleOutlined,{style:{color:"#2563EB",marginRight:"4px"}}),"已加载: ",a,"/",l,"条数据"]}),!g&&b.jsx(g6,{loadIcon:t||void 0,autoLoading:i,batchSize:f,loadingProgress:s,disabled:!u||!c,onBatchSizeChange:h,onLoadNextPage:()=>u?.(),onStartAutoLoad:()=>{const w=v();c?.(w)},onStopLoad:()=>d?.()})]}),b.jsx(ae.Pagination,{current:e,pageSize:n,total:l,onChange:w=>o(w),showSizeChanger:!1,showQuickJumper:!1,showTotal:()=>"",itemRender:E})]})},lm=e=>{const{loading:t,autoLoading:n,loadingProgress:l,columns:r=[],dataSource:a=[],total:i,current:s,pageSize:o,cachedPages:u,onChangePage:c,onLoadNextPage:d,onStartAutoLoad:f,onStopLoading:h,...m}=e,g=y.useRef(null),v=y.useCallback(E=>{c(E),u.includes(E)&&g.current?.scrollTo({key:`${(E-1)*o+1}`})},[u,c,o]);return b.jsxs("div",{className:"flex flex-col",children:[b.jsx(ae.Table,{ref:g,...m,columns:r,dataSource:a,pagination:!1,virtual:!0}),b.jsx(v6,{loading:t,autoLoading:n,loadingProgress:l,current:s,pageSize:o,total:i,loadedCount:a.length,cachedPages:u,onChange:v,onLoadNextPage:d,onStartAutoLoad:f,onStopLoading:h})]})};lm.__docgenInfo={displayName:"VirtualTable",description:"虚拟滚动表格组件,支持分页、数据缓存和自动加载功能。",props:{loading:{description:"加载状态",name:"loading",required:!0,type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},total:{description:"总数据条数",name:"total",required:!0,type:{name:"number",raw:"number"},defaultValue:{value:"0"}},current:{description:"当前页码",name:"current",required:!0,type:{name:"number",raw:"number"},defaultValue:{value:"1"}},pageSize:{description:"每页数据条数",name:"pageSize",required:!0,type:{name:"number",raw:"number"},defaultValue:{value:"10"}},cachedPages:{description:"已缓存的页码数组",name:"cachedPages",required:!0,type:{name:"number[]",raw:"number[]"},defaultValue:{value:"[]"}},dataSource:{description:"数据源",name:"dataSource",required:!0,type:{name:"Array<T>",raw:"Array<T>"},defaultValue:{value:"[]"}},onChangePage:{description:"页码变更回调函数",name:"onChangePage",required:!0,type:{name:"function",raw:"function(page: number): void"},defaultValue:{value:"-"}},autoLoading:{description:"是否正在自动加载",name:"autoLoading",required:!0,type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},loadingProgress:{description:"加载进度信息",name:"loadingProgress",required:!0,type:{name:"object",raw:"{percentage: 0, currentPage: 1, totalPages: 5}"},defaultValue:{value:"-"}},onLoadNextPage:{description:"加载下一页回调函数",name:"onLoadNextPage",required:!1,type:{name:"function",raw:"function(page: number): void"},defaultValue:{value:"-"}},onStartAutoLoad:{description:"开始自动加载回调函数",name:"onStartAutoLoad",required:!1,type:{name:"function",raw:"function(loadNextPages: number[]): void"},defaultValue:{value:"-"}},onStopLoading:{description:"停止加载回调函数",name:"onStopLoading",required:!1,type:{name:"function",raw:"function(): void"},defaultValue:{value:"-"}},columns:{description:"表格列配置",name:"columns",required:!0,type:{name:"Array<object>",raw:"Array<object>"},defaultValue:{value:"[]"}}}};const rm=({texts:e=[],placeholder:t="请输入内容",animationSpeed:n=100,autoPlay:l=!0,value:r,onChange:a,...i})=>{const[s,o]=y.useState(""),[u,c]=y.useState(0),[d,f]=y.useState(!1),[h,m]=y.useState(!1),[g,v]=y.useState(!1),E=y.useRef(void 0),w=y.useRef(void 0),N=y.useRef(e),L=y.useRef(u),O=y.useRef(h),C=y.useRef(s);y.useEffect(()=>{N.current=e,L.current=u,O.current=h,C.current=s});const I=y.useCallback((B,T)=>{let H=0;v(!0);const W=()=>{H<B.length?(o(B.slice(0,H+1)),H++,w.current=window.setTimeout(W,n)):(v(!1),T?.())};W()},[n]),_=y.useCallback(B=>{let T=C.current.length;const H=()=>{T>0?(o(C.current.slice(0,T-1)),T--,w.current=window.setTimeout(H,n/2)):B?.()};H()},[n]),A=y.useCallback(()=>{if(N.current.length===0||O.current)return;f(!0);const B=N.current[L.current];C.current?_(()=>{I(B,()=>{E.current=window.setTimeout(()=>{c(T=>(T+1)%N.current.length),f(!1)},2e3)})}):I(B,()=>{E.current=window.setTimeout(()=>{c(T=>(T+1)%N.current.length),f(!1)},2e3)})},[_,I]);y.useEffect(()=>(l&&e.length>0&&!h&&A(),()=>{E.current&&window.clearTimeout(E.current),w.current&&window.clearTimeout(w.current)}),[u,h,l,e.length,A]),y.useEffect(()=>{!d&&l&&e.length>0&&!h&&A()},[u,d,l,e.length,h,A]);const R=B=>{m(!0),E.current&&window.clearTimeout(E.current),w.current&&window.clearTimeout(w.current),f(!1),v(!1),i.onFocus?.(B)},P=B=>{m(!1),!r&&e.length>0&&(o(""),c(0)),i.onBlur?.(B)},F=B=>{a?.(B.target.value),i.onChange?.(B)},V=()=>h||r?t:s||t;return b.jsxs("div",{style:{position:"relative"},children:[b.jsx(ae.Input,{...i,value:r,onChange:F,onFocus:R,onBlur:P,placeholder:V(),style:{...i.style,position:"relative",zIndex:1}}),!h&&!r&&s&&b.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",paddingLeft:11,paddingRight:11,color:"#bfbfbf",pointerEvents:"none",zIndex:2,fontSize:14,fontFamily:"inherit"},children:[b.jsx("span",{children:s}),g&&b.jsx("span",{style:{display:"inline-block",width:1,height:"1.2em",backgroundColor:"#1890ff",marginLeft:2,animation:"blink 1s infinite"}})]}),b.jsx("style",{children:`
|
|
146
|
+
`)){l.push({...a,text:a.text.slice(1)}),r=!1;continue}if(a.exclusionGroup==="separator"){l.push(a);continue}}l.push(a),a.type==="report-url"&&a.key&&t.reportModules[a.key]&&t.reportModules[a.key].forEach((s,o)=>{l.push({type:"report-module",key:a.key,moduleIndex:o,text:s.title,exclusionGroup:a.exclusionGroup,required:a.required})})}return l}const Uw={reportModules:{},markdownModules:{}},zw={adjustX:1,adjustY:0,shiftY:!0},Wb=y.memo(({options:e,onSelect:t,disabled:n,currentAgent:l})=>{const[r,a]=y.useState(!1),i=e.filter(u=>u.isShowNew!==1).map(u=>({key:u.key,label:b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[u.icon&&b.jsx("i",{className:u.icon}),b.jsx("span",{children:u.label})]}),onClick:()=>t?.(u)})),o=`rte-agent-badge${!!l?" rte-agent-badge-selected":r?" rte-agent-badge-active":""}`;return b.jsx(ae.Dropdown,{menu:{items:i,selectedKeys:l?[String(l.key)]:[]},disabled:n,placement:"bottomLeft",autoAdjustOverflow:zw,trigger:["click"],overlayClassName:"rte-agent-dropdown",onOpenChange:a,children:b.jsxs("div",{className:o,style:{cursor:e.length>0?"pointer":"default"},children:[b.jsx("i",{className:"iconfont icon-zhinengti",style:{fontSize:"16px"}}),b.jsx("span",{className:"rte-agent-text",children:"智能体"})]})})});Wb.displayName="AgentDropdown";const Vw=["全部技能","我的技能","系统技能","订阅技能"],$w={system:"系统技能",mine:"我的技能",subscribe:"订阅技能"},ni="基于用户上传的抖音推广数据,智能分析高潜力商品与爆品抖音推广数据,智能分析高潜力商品与爆品商品机会",li=["淘宝天猫","抖音电商","市场选品","+7..."],qw=[{id:"c1",title:"抖音推广找潜力爆品",desc:ni,tags:li,badge:"system",heat:"3.5"},{id:"c2",title:"抖音推广找潜力爆品",desc:ni,tags:li,badge:"system",heat:"6.6"},{id:"c3",title:"抖音推广找潜力爆品",desc:ni,tags:li,badge:"mine"},{id:"c4",title:"抖音推广找潜力爆品",desc:ni,tags:li,badge:"subscribe",heat:"6.6"}],Ww=e=>({id:e.id,title:e.title,desc:e.desc??"",tags:e.tags??[],badge:e.badge??"system",heat:e.heat}),Yw=()=>b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M6.2 1a5.2 5.2 0 0 1 4.06 8.45l2.6 2.6a.6.6 0 0 1-.85.85l-2.6-2.6A5.2 5.2 0 1 1 6.2 1Zm0 1.2a4 4 0 1 0 0 8 4 4 0 0 0 0-8Z",fill:"#4E5969"})}),jw=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[b.jsx("path",{d:"M8 2v7M8 9 5.5 6.5M8 9l2.5-2.5",stroke:"#666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"}),b.jsx("path",{d:"M3 10v2a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-2",stroke:"#666",strokeWidth:"1.2",strokeLinecap:"round"})]}),Gw=()=>b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M8 1.5l1.6 3.7 4 .35-3 2.65.9 3.9L8 10.1 4.5 12l.9-3.9-3-2.65 4-.35L8 1.5Z",fill:"#fff"})}),Kw=()=>b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:b.jsx("path",{d:"M9.60187 14.5546C9.23569 14.5546 8.94275 14.4081 8.6498 14.1884C8.35686 13.8955 8.13716 13.5293 8.13716 13.0899V11.6251C6.52597 11.6251 3.88948 12.0646 2.49801 13.9687C2.2783 14.3349 1.76565 14.5546 1.32623 14.6278H1.10653C0.374166 14.4813 -0.0652517 13.8222 0.00799105 13.0899C0.374166 9.94073 1.47272 7.67041 3.37683 6.13247C4.76831 5.03394 6.3795 4.44805 8.13716 4.30157V2.9101C8.13716 2.25098 8.4301 1.66509 9.01599 1.44538C9.52864 1.29892 10.1145 1.37215 10.5539 1.81157L15.241 6.57189C15.6072 6.86484 15.8269 7.30424 15.9001 7.81689C15.9734 8.32955 15.8269 8.8422 15.4607 9.20837C15.3875 9.28161 15.3143 9.42807 15.1678 9.50132L10.6272 14.1152C10.3342 14.4081 9.96804 14.5546 9.60187 14.5546ZM8.43009 10.1604H9.60187V13.0899L14.2157 8.32955L14.289 8.25631C14.3622 8.18308 14.3622 8.0366 14.3622 7.96336C14.3622 7.81689 14.289 7.74366 14.2157 7.67041L14.1425 7.59718L9.52864 2.9101V5.69306L8.50333 5.7663C6.96539 5.7663 5.50066 6.27894 4.25567 7.23101C2.79094 8.40278 1.83889 10.3069 1.54595 12.7969C3.37683 10.5266 6.5992 10.1604 8.43009 10.1604Z",fill:"currentColor"})}),Qw=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("path",{d:"M13.85 7.35C13.4903 7.35 13.2 7.64033 13.2 8V12.3333C13.2 12.8114 12.8114 13.2 12.3333 13.2H3.66667C3.18856 13.2 2.8 12.8114 2.8 12.3333V3.66667C2.8 3.18856 3.18856 2.8 3.66667 2.8H8C8.35967 2.8 8.65 2.50967 8.65 2.15C8.65 1.79033 8.35967 1.5 8 1.5H3.23333C2.27567 1.5 1.5 2.27567 1.5 3.23333V12.7667C1.5 13.7243 2.27567 14.5 3.23333 14.5H12.7667C13.7243 14.5 14.5 13.7243 14.5 12.7667V8C14.5 7.64033 14.2097 7.35 13.85 7.35Z",fill:"currentColor"}),b.jsx("path",{d:"M5.7483 10.4682C6.00108 10.721 6.41419 10.721 6.66697 10.4682L13.7144 3.42075C13.9672 3.16797 13.9672 2.75486 13.7144 2.50208C13.4616 2.24931 13.0485 2.24931 12.7957 2.50208L5.7483 9.54808C5.49552 9.80086 5.49552 10.2154 5.7483 10.4682Z",fill:"currentColor"})]}),Xw=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("path",{d:"M4.12488 5.02012H11.8779L11.1331 12.6138C11.1164 12.7828 11.0373 12.9396 10.9114 13.0536C10.7855 13.1676 10.6217 13.2307 10.4518 13.2306H5.55096C5.38127 13.2304 5.21769 13.1672 5.09198 13.0533C4.96627 12.9393 4.88739 12.7827 4.87067 12.6138L4.12488 5.02012ZM3.80233 3.74945C3.66582 3.74934 3.53081 3.77782 3.40598 3.83306C3.28116 3.8883 3.16929 3.96908 3.07757 4.07018C2.98586 4.17128 2.91634 4.29048 2.8735 4.42008C2.83065 4.54969 2.81542 4.68683 2.8288 4.82268L3.60586 12.738C3.65342 13.2208 3.87886 13.6688 4.23837 13.9947C4.59787 14.3206 5.06573 14.5012 5.55096 14.5012H10.4518C10.9371 14.5012 11.4049 14.3206 11.7644 13.9947C12.1239 13.6688 12.3494 13.2208 12.3969 12.738L13.175 4.82268C13.1883 4.68683 13.1731 4.54969 13.1303 4.42008C13.0874 4.29048 13.0179 4.17128 12.9262 4.07018C12.8345 3.96908 12.7226 3.8883 12.5978 3.83306C12.4729 3.77782 12.3379 3.74934 12.2014 3.74945H3.80135H3.80233Z",fill:"currentColor"}),b.jsx("path",{d:"M1.5 4.28322C1.5 4.11472 1.56694 3.95312 1.68608 3.83397C1.80523 3.71482 1.96683 3.64789 2.13533 3.64789H13.8646C13.948 3.64787 14.0306 3.6643 14.1077 3.69622C14.1848 3.72814 14.2549 3.77494 14.3139 3.83394C14.3729 3.89293 14.4197 3.96298 14.4516 4.04007C14.4836 4.11715 14.5 4.19978 14.5 4.28322C14.5 4.36666 14.4836 4.44929 14.4516 4.52638C14.4197 4.60347 14.3729 4.67351 14.3139 4.73251C14.2549 4.7915 14.1848 4.8383 14.1077 4.87022C14.0306 4.90214 13.948 4.91857 13.8646 4.91855H2.13533C1.96683 4.91855 1.80523 4.85162 1.68608 4.73247C1.56694 4.61332 1.5 4.45172 1.5 4.28322Z",fill:"currentColor"}),b.jsx("path",{d:"M5.02081 3.11277C5.02081 2.22135 5.74314 1.5 6.63358 1.5H9.3704C10.2618 1.5 10.9832 2.22135 10.9832 3.11277V4.92102H5.02081V3.11277ZM6.63358 2.77067C6.58866 2.77067 6.54417 2.77952 6.50266 2.79671C6.46116 2.8139 6.42345 2.8391 6.39168 2.87087C6.35991 2.90263 6.33471 2.94035 6.31752 2.98185C6.30033 3.02336 6.29148 3.06784 6.29148 3.11277V3.65036H9.7125V3.11277C9.7125 3.06784 9.70366 3.02336 9.68646 2.98185C9.66927 2.94035 9.64407 2.90263 9.61231 2.87087C9.58054 2.8391 9.54282 2.8139 9.50132 2.79671C9.45981 2.77952 9.41533 2.77067 9.3704 2.77067H6.63358Z",fill:"currentColor"})]}),Jw=()=>b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M3.5 8h8M8 4.5 11.5 8 8 11.5",stroke:"#fff",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),Zw=({tags:e})=>b.jsx("div",{className:"rte-skill-card-tags",children:e.map((t,n)=>b.jsx("span",{className:"rte-skill-tag",children:t},n))}),e6=()=>b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:b.jsx("path",{d:"M8.87301 3.52364C9.08579 3.52364 9.28984 3.60817 9.4403 3.75862C9.59075 3.90907 9.67527 4.11313 9.67527 4.3259V11.8137C9.67527 12.0265 9.59075 12.2305 9.4403 12.381C9.28984 12.5314 9.08579 12.6159 8.87301 12.6159H2.98976C2.88441 12.6159 2.78008 12.5952 2.68275 12.5549C2.58541 12.5146 2.49697 12.4555 2.42248 12.381C2.34798 12.3065 2.28889 12.218 2.24857 12.1207C2.20825 12.0234 2.1875 11.919 2.1875 11.8137V4.3259C2.1875 4.11313 2.27202 3.90907 2.42248 3.75862C2.57293 3.60817 2.77699 3.52364 2.98976 3.52364H8.87301ZM8.60559 4.59332H3.25718V11.5463H8.60559V4.59332ZM11.0102 1.38428C11.2098 1.38415 11.4022 1.45838 11.5499 1.59248C11.6977 1.72658 11.7901 1.91092 11.8093 2.10952L11.8125 2.18654V9.40315C11.8123 9.53947 11.7601 9.67059 11.6666 9.76971C11.573 9.86884 11.4451 9.92849 11.309 9.93648C11.1729 9.94447 11.0389 9.90019 10.9344 9.8127C10.8298 9.7252 10.7627 9.60109 10.7466 9.46573L10.7428 9.40315V2.45396H5.39655C5.26555 2.45394 5.13911 2.40585 5.04121 2.3188C4.94332 2.23175 4.88078 2.1118 4.86545 1.9817L4.86171 1.91912C4.86172 1.78812 4.90982 1.66168 4.99687 1.56379C5.08392 1.46589 5.20387 1.40335 5.33397 1.38802L5.39655 1.38428H11.0102Z",fill:"currentColor"})}),t6=()=>b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:b.jsx("path",{d:"M1.5548 5.88011C1.4304 5.76419 1.26586 5.70108 1.09584 5.70408C0.925831 5.70708 0.76362 5.77595 0.643383 5.89619C0.523147 6.01643 0.454274 6.17864 0.451274 6.34865C0.448274 6.51867 0.511382 6.68321 0.627302 6.80761L5.0023 11.1826C5.12535 11.3055 5.29215 11.3745 5.46605 11.3745C5.63996 11.3745 5.80676 11.3055 5.9298 11.1826L13.3673 3.74511C13.4832 3.62071 13.5463 3.45617 13.5433 3.28615C13.5403 3.11614 13.4715 2.95393 13.3512 2.83369C13.231 2.71345 13.0688 2.64458 12.8988 2.64158C12.7287 2.63858 12.5642 2.70169 12.4398 2.81761L5.46605 9.79049L1.5548 5.87923V5.88011Z",fill:"currentColor"})}),n6=()=>b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:b.jsx("path",{d:"M9.60188 14.5546C9.23571 14.5546 8.94276 14.4081 8.64982 14.1884C8.35687 13.8955 8.13717 13.5293 8.13717 13.0899V11.6251C6.52599 11.6251 3.88949 12.0646 2.49803 13.9687C2.27831 14.3349 1.76566 14.5546 1.32625 14.6278H1.10654C0.374181 14.4813 -0.0652364 13.8222 0.00800631 13.0899C0.374181 9.94073 1.47273 7.67041 3.37685 6.13247C4.76833 5.03394 6.37951 4.44805 8.13717 4.30157V2.9101C8.13717 2.25098 8.43012 1.66509 9.01601 1.44538C9.52865 1.29892 10.1145 1.37215 10.5539 1.81157L15.241 6.57189C15.6072 6.86484 15.8269 7.30424 15.9002 7.81689C15.9734 8.32955 15.8269 8.8422 15.4607 9.20837C15.3875 9.28161 15.3143 9.42807 15.1678 9.50132L10.6272 14.1152C10.3342 14.4081 9.96806 14.5546 9.60188 14.5546ZM8.4301 10.1604H9.60188V13.0899L14.2157 8.32955L14.289 8.25631C14.3622 8.18308 14.3622 8.0366 14.3622 7.96336C14.3622 7.81689 14.289 7.74366 14.2157 7.67041L14.1425 7.59718L9.52865 2.9101V5.69306L8.50335 5.7663C6.9654 5.7663 5.50068 6.27894 4.25568 7.23101C2.79096 8.40278 1.83891 10.3069 1.54596 12.7969C3.37685 10.5266 6.59922 10.1604 8.4301 10.1604Z",fill:"#7C3AED"})}),l6=({code:e})=>{const[t,n]=y.useState(!1),l=async r=>{r.stopPropagation();try{await navigator.clipboard.writeText(e),n(!0),window.setTimeout(()=>n(!1),2e3)}catch{ae.message.error("复制失败")}};return b.jsxs("div",{className:"rte-skill-share",onClick:r=>r.stopPropagation(),children:[b.jsxs("div",{className:"rte-skill-share-head",children:[b.jsxs("div",{className:"rte-skill-share-title",children:[b.jsx(n6,{}),b.jsx("span",{children:"分享码"})]}),b.jsx("span",{className:"rte-skill-share-hint",children:"复制后粘贴在「导入技能」即可使用"})]}),b.jsxs("div",{className:"rte-skill-share-box",children:[b.jsx("span",{className:"rte-skill-share-code",children:e}),b.jsxs("button",{type:"button",className:`rte-skill-share-copy${t?" rte-skill-share-copy-done":""}`,onClick:l,children:[t?b.jsx(t6,{}):b.jsx(e6,{}),b.jsx("span",{children:t?"已复制":"复制"})]})]})]})},r6=({card:e,selected:t,onClick:n,onShare:l,onEdit:r,onDelete:a,onUse:i,getPopupContainer:s})=>{const o=E=>E.stopPropagation(),[u,c]=y.useState(!1),[d,f]=y.useState(""),[h,m]=y.useState(!1),g=u||h,v=async E=>{if(c(E),!E){f("");return}try{const w=await l();f(typeof w=="string"&&w?w:`SK-${e.id}`)}catch{f(`SK-${e.id}`)}};return b.jsxs("div",{className:`rte-skill-card${t?" rte-skill-card-selected":""}`,onClick:n,role:"button","aria-pressed":t,children:[b.jsxs("div",{className:"rte-skill-card-header",children:[b.jsx("div",{className:"rte-skill-card-title",children:e.title}),b.jsxs("div",{className:`rte-skill-card-actions${g?" rte-skill-card-actions-pinned":""}`,children:[b.jsx(ae.Popover,{open:u,onOpenChange:v,trigger:"click",placement:"bottomRight",arrow:!1,overlayClassName:"rte-skill-share-popover",zIndex:1e4,getPopupContainer:s,content:b.jsx(l6,{code:d}),children:b.jsx("button",{type:"button",className:"rte-skill-card-action",title:"分享","aria-label":"分享",onClick:o,children:b.jsx(Kw,{})})}),b.jsx("button",{type:"button",className:"rte-skill-card-action",title:"编辑","aria-label":"编辑",onClick:E=>{o(E),r()},children:b.jsx(Qw,{})}),b.jsx(ae.Popconfirm,{title:"删除技能后不可恢复,确认删除吗?",open:h,onOpenChange:m,okText:"确认",cancelText:"取消",placement:"bottomRight",arrow:!1,overlayClassName:"rte-skill-delete-confirm",zIndex:1e4,icon:b.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.5 9C1.5 4.85786 4.85786 1.5 9 1.5C13.1421 1.5 16.5 4.85786 16.5 9C16.5 13.1421 13.1421 16.5 9 16.5C4.85786 16.5 1.5 13.1421 1.5 9ZM8.25 11.25V12.75H9.75V11.25H8.25ZM9.75 10.5L9.75 5.25H8.25L8.25 10.5H9.75Z",fill:"#F53F3F"})}),okButtonProps:{danger:!0},getPopupContainer:s,onConfirm:E=>{E?.stopPropagation(),m(!1),a()},onCancel:E=>{E?.stopPropagation(),m(!1)},children:b.jsx("button",{type:"button",className:"rte-skill-card-action rte-skill-card-action-delete",title:"删除","aria-label":"删除",onClick:o,children:b.jsx(Xw,{})})})]})]}),b.jsx("div",{className:"rte-skill-card-desc",children:e.desc}),b.jsx(Zw,{tags:e.tags}),b.jsx("div",{className:"rte-skill-card-divider"}),b.jsxs("div",{className:"rte-skill-card-footer",children:[b.jsx("span",{className:`rte-skill-card-badge rte-skill-card-badge-${e.badge}`,children:$w[e.badge]}),e.heat&&b.jsxs("span",{className:"rte-skill-card-heat",children:[b.jsx("span",{className:"rte-skill-card-heat-num",children:e.heat}),b.jsx("span",{className:"rte-skill-card-heat-text",children:"万人正在使用"})]}),b.jsxs("button",{type:"button",className:"rte-skill-card-use",onClick:E=>{o(E),i()},children:[b.jsx(Jw,{}),b.jsx("span",{children:"去使用"})]})]})]})},Yb=y.memo(({selectedId:e,onSelect:t,onAction:n,skillListFetch:l})=>{const[r,a]=y.useState(0),[i,s]=y.useState(l?[]:qw),[o,u]=y.useState(!1),c=Vn(),d=c?()=>c:void 0,f=y.useCallback(async()=>{if(l){u(!0);try{const g=await l();s(g.map(Ww))}catch{ae.message.error("技能列表加载失败")}finally{u(!1)}}},[l]);y.useEffect(()=>{f()},[f]);const h=g=>{e===g.id?t?.(null):t?.({id:g.id,title:g.title})},m=async g=>{try{await n?.("delete",{id:g.id,title:g.title})}catch{ae.message.error("删除失败");return}e===g.id&&t?.(null),l?await f():s(v=>v.filter(E=>E.id!==g.id)),ae.message.success("已删除技能")};return b.jsxs("div",{className:"rte-skill-panel",children:[b.jsxs("div",{className:"rte-skill-panel-header",children:[b.jsx("div",{className:"rte-skill-tabs",children:Vw.map((g,v)=>b.jsxs("div",{className:`rte-skill-tab${v===r?" rte-skill-tab-active":""}`,onClick:()=>a(v),children:[b.jsx("span",{className:"rte-skill-tab-text",children:g}),b.jsx("span",{className:"rte-skill-tab-underline"})]},g))}),b.jsxs("div",{className:"rte-skill-actions",children:[b.jsxs("div",{className:"rte-skill-search",children:[b.jsx("input",{className:"rte-skill-search-input",placeholder:"请输入想搜索的技能名称",readOnly:!0}),b.jsx("span",{className:"rte-skill-search-icon",children:b.jsx(Yw,{})})]}),b.jsxs("button",{type:"button",className:"rte-skill-import-btn",children:[b.jsx(jw,{}),b.jsx("span",{children:"导入技能"})]}),b.jsxs("button",{type:"button",className:"rte-skill-create-btn",children:[b.jsx(Gw,{}),b.jsx("span",{children:"基于会话创建技能"})]})]})]}),o?b.jsx("div",{className:"rte-skill-cards-status",children:b.jsx(ae.Spin,{})}):i.length===0?b.jsx("div",{className:"rte-skill-cards-status",children:"暂无技能"}):b.jsx("div",{className:"rte-skill-cards",children:i.map(g=>b.jsx(r6,{card:g,selected:e===g.id,onClick:()=>h(g),onShare:()=>n?.("share",{id:g.id,title:g.title}),onEdit:()=>n?.("edit",{id:g.id,title:g.title}),onDelete:()=>m(g),onUse:()=>t?.({id:g.id,title:g.title}),getPopupContainer:d},g.id))})]})});Yb.displayName="SkillPanel";const jb=8,a6=()=>b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:b.jsx("path",{d:"M10.4103 0.600098C11.2711 0.600098 11.9863 1.2657 11.9863 2.1081C11.9863 2.2985 11.9479 2.4873 11.8751 2.6641L10.9119 4.9921H12.6255C13.4455 4.9921 14.1327 5.5961 14.1959 6.3817L14.2007 6.5009C14.2007 6.8905 14.0431 7.2641 13.7639 7.5433L6.28226 15.0321C6.05292 15.2576 5.74735 15.3888 5.42594 15.3999C5.10452 15.411 4.79062 15.3012 4.54626 15.0921C4.19986 14.7929 4.05346 14.3297 4.16706 13.9113L5.20146 9.4593H3.28146C2.63906 9.4593 2.09506 8.9873 2.03666 8.3649L2.03186 8.2537C2.03186 8.0993 2.06306 7.9457 2.12066 7.8073L4.67986 1.5513C4.92146 0.970498 5.50306 0.600098 6.14306 0.600098H10.4103ZM10.4103 1.8001H6.14386C5.97906 1.8001 5.83986 1.8889 5.78866 2.0105L3.23586 8.2521C3.24066 8.2521 3.24626 8.2537 3.25346 8.2553L3.28306 8.2585H5.55506C5.62866 8.2585 5.70146 8.2665 5.77186 8.2833C6.26786 8.4001 6.58466 8.8937 6.45506 9.3713L5.33506 14.1857L5.35586 14.1969C5.37426 14.2017 5.39586 14.2009 5.41266 14.1953L5.43426 14.1833L12.9151 6.6953C12.9414 6.67028 12.9625 6.64029 12.9772 6.60706C12.9919 6.57383 12.9999 6.53802 13.0007 6.5017C13.0007 6.3417 12.8415 6.1937 12.6247 6.1937H10.4887C10.3799 6.1937 10.2719 6.1745 10.1687 6.1377C10.0535 6.09806 9.94761 6.03536 9.85749 5.95342C9.76737 5.87149 9.6949 5.77204 9.64451 5.66115C9.59412 5.55026 9.56687 5.43027 9.56442 5.30849C9.56197 5.18672 9.58437 5.06572 9.63026 4.9529L10.7671 2.2049C10.7797 2.17445 10.7862 2.14184 10.7863 2.1089C10.7863 1.9481 10.6279 1.8001 10.4111 1.8001H10.4103ZM7.10386 2.6433C7.25151 2.70252 7.3696 2.81796 7.43215 2.96423C7.49471 3.1105 7.49662 3.27562 7.43746 3.4233L6.79746 5.0233C6.73604 5.16775 6.62045 5.28238 6.4755 5.34261C6.33054 5.40283 6.16775 5.40385 6.02205 5.34544C5.87635 5.28704 5.75934 5.17386 5.69612 5.03018C5.6329 4.88651 5.6285 4.72378 5.68386 4.5769L6.32386 2.9769C6.38308 2.82925 6.49852 2.71116 6.64479 2.6486C6.79106 2.58605 6.95618 2.58414 7.10386 2.6433Z",fill:"currentColor",stroke:"currentColor",strokeWidth:"0.2"})}),Gb=y.memo(({disabled:e,selectedSkill:t,onSkillSelect:n,onSkillAction:l,skillListFetch:r})=>{const[a,i]=y.useState(!1),[s,o]=y.useState(null),u=y.useRef(null),c=y.useRef(null),d=Vn(),f=y.useCallback(()=>(u.current?.closest(".rich-text-editor")??u.current)?.getBoundingClientRect()??null,[]),h=y.useCallback(()=>{const w=f();if(!w)return;const N=w.bottom+jb,L=Math.max(0,window.innerHeight-N-jb),C=(c.current?.offsetParent??d)?.getBoundingClientRect(),I=C?.left??0,_=C?.top??0;o({left:w.left-I,top:N-_,width:w.width,maxHeight:L})},[f,d]);y.useLayoutEffect(()=>{if(a)return h(),window.addEventListener("scroll",h,!0),window.addEventListener("resize",h),()=>{window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h)}},[a,h]),y.useEffect(()=>{if(!a)return;const w=N=>{const L=N.target;u.current?.contains(L)||c.current?.contains(L)||L instanceof Element&&L.closest(".rte-skill-delete-confirm, .rte-skill-share-popover")||i(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[a]);const m=y.useCallback(()=>{e||i(w=>!w)},[e]),g=y.useCallback(w=>{n?.(w),w&&i(!1)},[n]),v=!!t,E=`rte-skill-badge${v?" rte-skill-badge-selected":a?" rte-skill-badge-active":""}`;return b.jsxs(b.Fragment,{children:[b.jsxs("div",{ref:u,className:E,onClick:m,"data-rte-skill-button":"true","aria-pressed":a||v,style:{cursor:e?"not-allowed":"pointer"},children:[b.jsx(a6,{}),b.jsx("span",{className:"rte-skill-text",children:"技能"})]}),a&&fi.createPortal(b.jsx("div",{ref:c,className:"rte-skill-panel-popup",style:{position:"fixed",left:s?.left??0,top:s?.top??0,width:s?.width,zIndex:9999,maxHeight:s?.maxHeight,display:"flex",flexDirection:"column",overflow:"hidden",visibility:s?"visible":"hidden"},children:b.jsx(Yb,{selectedId:t?.id??null,onSelect:g,onAction:l,skillListFetch:r})}),d??document.body)]})});Gb.displayName="SkillButton";const i6=10*1024*1024,s6=50*1024*1024,o6="图片大小不能超过 10MB",u6="文件总大小不能超过 50MB",c6=e=>e.type?.startsWith("image/")||/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(e.name||""),d6=(e,t)=>{let n=!1;const l=t.filter(o=>c6(o)&&o.size>i6?(n=!0,!1):!0),r=e.reduce((o,u)=>o+u.size,0),a=[];let i=r,s=!1;for(const o of l){if(i+o.size>s6){s=!0;break}a.push(o),i+=o.size}return{accepted:a,imageOversize:n,totalExceeded:s}},Kb=y.memo(({files:e,onChange:t,disabled:n})=>{const l=y.useRef(null),r=y.useCallback(i=>{const s=Array.from(i.target.files??[]);if(i.target.value="",s.length===0)return;const{accepted:o,imageOversize:u,totalExceeded:c}=d6(e,s);u&&ae.message.error(o6),c&&ae.message.error(u6),o.length>0&&t([...e,...o])},[e,t]),a=y.useCallback(()=>{n||l.current?.click()},[n]);return b.jsxs("div",{className:"rte-footer-upload",children:[b.jsx("div",{className:"rte-footer-upload-btn",onClick:a,title:"上传文件",style:{cursor:n?"not-allowed":"pointer",opacity:n?.6:1,pointerEvents:n?"none":"auto"},children:b.jsx("i",{className:"iconfont icon-lianjie",style:{fontSize:"16px"}})}),b.jsx("input",{ref:l,type:"file",multiple:!0,style:{display:"none"},onChange:r})]})});Kb.displayName="UploadButton";const Qb=y.memo(({onClick:e,loading:t,disabled:n})=>b.jsx("button",{type:"button",className:"rich-text-editor-send-button","data-testid":"rte-send-button",onClick:e,disabled:n||t,children:t?b.jsx("span",{className:"rte-send-spinner"}):b.jsx("i",{className:"iconfont icon-fasong"})}));Qb.displayName="SendButton";const Xb=y.memo(({currentAgent:e})=>{const t=e?.points;return t==null?null:b.jsxs("div",{className:"rte-points-badge",style:{position:"relative"},children:[b.jsx("i",{className:"iconfont icon-jifen",style:{marginRight:"4px",fontSize:"16px"}}),b.jsxs("span",{style:{fontSize:"16px",lineHeight:"22px"},children:["-",String(t)]}),e?.labelValue===2&&b.jsx("div",{className:"rte-limited-free-badge",children:b.jsx("span",{className:"rte-limited-free-text",children:"限时免费"})})]})});Xb.displayName="PointsBadge";const Jb=y.memo(({isProcessing:e,loading:t,disabled:n,sendDisabled:l,showFooterUpload:r=!0,footerFiles:a,onFooterFilesChange:i,agentOptions:s,onAgentSelect:o,hideAgentButton:u,currentAgent:c,selectedSkill:d,onSkillSelect:f,onSkillAction:h,skillListFetch:m,onSend:g,padding:v="12px 16px"})=>{const E=y.useCallback(w=>{if(w.reduce((O,C)=>O+C.size,0)>52428800){const O=[];let C=0;for(const I of w){if(C+I.size>52428800)break;O.push(I),C+=I.size}i(O)}else i(w)},[i]);return b.jsxs("div",{className:"rich-text-editor-footer",style:{padding:v},children:[b.jsxs("div",{className:"rich-text-editor-footer-left",children:[b.jsxs("div",{className:"rich-text-editor-brand",children:[!u&&s&&s.length>0&&b.jsx(Wb,{options:s,onSelect:o,disabled:n||e,currentAgent:c}),b.jsx(Gb,{disabled:n||e,selectedSkill:d,onSkillSelect:f,onSkillAction:h,skillListFetch:m})]}),r&&b.jsx(Kb,{files:a,onChange:E,disabled:n||e})]}),b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[b.jsxs("div",{className:"rte-brand-badge",children:[b.jsx("div",{className:"rte-brand-badge",children:b.jsx("img",{src:"https://oospublic.sealseek.cn/file/website/ball.png",alt:""})}),b.jsx("span",{className:"rte-brand-text",style:{marginLeft:"4px"},children:"SealSeek 2.0"})]}),b.jsx(Xb,{currentAgent:c}),b.jsx(Qb,{onClick:g,loading:t||e,disabled:n||l})]})]})});Jb.displayName="Footer";const f6=e=>e<1024?`${e}B`:e<1024*1024?`${Math.round(e/1024)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`,h6=e=>(e.type?.startsWith("image/")??!1)||/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(e.name||""),p6=e=>{const t=(e||"").split(".").pop()?.toLowerCase()||"";return["xls","xla","xlb","xlc","xlm","xlsx","xlt","xlw","csv","tsv","iif"].includes(t)?"icon-a-xlsxcsv":["doc","docx","dot","odt","rtf","wiz"].includes(t)?"icon-docx":["ppt","pptx","pot","ppa","pps","pwz"].includes(t)?"icon-ppt":["txt","asm","bat","c","cc","conf","cpp","css","cxx","def","dic","eml","h","hh","in","js","ksh","php","pkl","rb","tar","tex","ts","xml"].includes(t)?"icon-txt":t==="pdf"?"icon-pdf":["html","htm","json","ics","ifb"].includes(t)?"icon-a-htmljson":t==="md"?"icon-md":"icon-lianjie"},b6=({file:e,onRemove:t})=>{const n=h6(e),l=Vn(),r=pf(n?e:null);return b.jsxs("div",{className:"rte-footer-file-chip",children:[n?b.jsx(ae.Image,{className:"rte-footer-file-thumb",width:32,height:32,src:r,alt:e.name,preview:l?{getContainer:()=>l}:void 0}):b.jsx("div",{className:"rte-footer-file-icon",children:b.jsx("svg",{style:{width:"18px",height:"18px"},"aria-hidden":"true",children:b.jsx("use",{xlinkHref:`#${p6(e.name)}`})})}),b.jsxs("div",{className:"rte-footer-file-info",children:[b.jsx("span",{className:"rte-footer-file-name",title:e.name,children:e.name}),b.jsx("span",{className:"rte-footer-file-size",children:f6(e.size)})]}),b.jsx("span",{className:"rte-footer-file-remove",onClick:a=>{a.stopPropagation(),t()},children:b.jsx("i",{className:"iconfont icon-guanbi",style:{width:"8px",height:"8px",fontSize:"8px",display:"flex",alignItems:"center"}})})]})},Zb=y.memo(({files:e,onChange:t})=>{const n=y.useRef(null),[l,r]=y.useState({showLeft:!1,showRight:!1}),a=y.useCallback(()=>{const o=n.current;o&&r({showLeft:o.scrollLeft>0,showRight:o.scrollLeft+o.clientWidth<o.scrollWidth-1})},[]);y.useLayoutEffect(()=>{a()},[e,a]);const i=y.useCallback(o=>{const u=n.current;u&&(u.scrollBy({left:o*200,behavior:"smooth"}),window.setTimeout(a,300))},[a]),s=y.useCallback(o=>()=>t(e.filter((u,c)=>c!==o)),[e,t]);return e.length===0?null:b.jsxs("div",{className:"rte-footer-files-wrapper",children:[l.showLeft&&b.jsx("div",{className:"rte-footer-files-mask rte-footer-files-mask-left",children:b.jsx("span",{className:"rte-footer-files-arrow rte-footer-files-arrow-left",onClick:()=>i(-1),children:b.jsx("svg",{style:{width:"16px",height:"16px",transform:"rotate(180deg)"},"aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-fanhuijiantou"})})})}),b.jsx("div",{className:"rte-footer-files-list",ref:n,onScroll:a,children:e.map((o,u)=>b.jsx(b6,{file:o,onRemove:s(u)},`${o.name}-${o.size}-${u}`))}),l.showRight&&b.jsx("div",{className:"rte-footer-files-mask rte-footer-files-mask-right",children:b.jsx("span",{className:"rte-footer-files-arrow rte-footer-files-arrow-right",onClick:()=>i(1),children:b.jsx("svg",{style:{width:"16px",height:"16px"},"aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-fanhuijiantou"})})})})]})});Zb.displayName="FooterFilesList";const em=9999,tm=e=>{const{config:t,onSend:n,isProcessing:l=!1,disabled:r=!1,placeholder:a,nodeValues:i,onFilesChange:s,onFooterFilesChange:o,footerFiles:u,width:c,background:d="transparent",border:f,maxHeight:h,minHeight:m,editorMinHeight:g,editorPadding:v,className:E,videoUrlParse:w,videoUpload:N,reportAnalyze:L,reportListFetch:O,onReportGoGenerate:C,reportNameResolve:I,onViewReport:_,hideCurrentSessionReport:A,markdownAnalyze:R,markdownNameAnalyze:P,agentOptions:F,onAgentSelect:V,onAgentExit:B,onSkillAction:T,skillListFetch:H,loading:W,hideButtons:q,footerPadding:K,showFooterUpload:S,lockStructure:ie=!0,collapsed:ee=!1,onCollapsedChange:D,collapseTransitionMs:fe=260,nodeDefaults:Ae,onExpandedHeightChange:Se,collapsedTotalHeight:ue,toggleOnBlankClick:Ce=!0,getPopupContainer:Oe,scrollContainerRef:xe,autoCollapseOnScroll:st}=e,[Qe,bt]=y.useState({}),[ot,On]=y.useState({}),[he,Le]=y.useState(u??[]),[Mn,rn]=y.useState({}),[Dn,Ln]=y.useState(Uw),[ri,ai]=y.useState(()=>new Set),[ii,al]=y.useState({}),[Y,J]=y.useState(null),be=y.useCallback(()=>Oe?.()??Y??document.body,[Oe,Y]),[ye,Me]=y.useState(null),Nt=y.useCallback((z,ne)=>{Me(ne?z:null)},[]),Pt=y.useRef(null),[Ht,il]=y.useState(58),[wt,ut]=y.useState(58),[Pn,Ut]=y.useState(!1),[Vo,cm]=y.useState(!1),dm=y.useRef(0),fm=y.useRef(ee),[si,hm]=y.useState(!1);fm.current!==ee&&(fm.current=ee,dm.current=(typeof performance<"u"?performance.now():Date.now())+fe,hm(!0)),y.useEffect(()=>{if(!si)return;const z=setTimeout(()=>hm(!1),fe);return()=>clearTimeout(z)},[si,ee,fe]);const[sl,pm]=y.useState(""),$o=y.useRef(null),bm=y.useRef(null),[qo,mm]=y.useState(0),Wo=y.useRef(!1);y.useEffect(()=>{if(!u||u.length===he.length&&u.every((te,re)=>{const se=he[re];return se&&te.name===se.name&&te.size===se.size&&te.lastModified===se.lastModified}))return;const ne=50*1024*1024;if(u.reduce((te,re)=>te+re.size,0)>ne){const te=[];let re=0;for(const se of u){if(re+se.size>ne)break;te.push(se),re+=se.size}Le(te)}else Wo.current=!0,Le(u)},[u]);const Tt=y.useMemo(()=>Hw(t,Dn,ri),[t,Dn,ri]),Yo=y.useRef(null),gm=y.useRef(!1);y.useEffect(()=>{const z=t.find(ne=>ne.type==="tag")?.text??null;if(!gm.current){gm.current=!0,Yo.current=z;return}Yo.current!==z&&(Yo.current=z,Le(ne=>ne.length===0?ne:[]))},[t]);const Br=y.useMemo(()=>{const z=t.find(ne=>ne.type==="tag")?.text;if(!(!z||!F))return F.find(ne=>ne.label===z)},[t,F]);kw(i,Qe,bt,Tt,ot,On);const Rr=y.useRef(new Map),vm=y.useRef(""),ym=(t.find(z=>z.type==="tag")?.text||"")+"||"+t.filter(z=>z.key&&z.type!=="report-module"&&z.type!=="markdown-module").map(z=>`${z.type}:${z.key}`).join("|");vm.current!==ym&&(vm.current=ym,Rr.current=new Map);const[an,oi]=y.useState(null),_6=y.useCallback(z=>{oi(z),z&&Br&&B?.()},[Br,B]),I6=y.useCallback(z=>{oi(null),V?.(z)},[V]);y.useEffect(()=>{Br&&oi(null)},[Br]);const{errors:O6,validate:Em,clearError:Tm}=ww(Tt),{excludedKeys:Fr,hideSeparator:M6}=Ow(Tt,Qe,ot),{analyzeReport:ui,analyzeMarkdown:Cm,analyzeMarkdownName:Sm,resolveReportName:ci}=Mw({reportAnalyze:L,markdownAnalyze:R,markdownNameAnalyze:P,reportNameResolve:I}),xm=z=>typeof z!="string"?!z:z.replace(/<[^>]*>/g,"").replace(/ /gi,"").replace(/\s/g,"").replace(/[]/g,"").trim()==="",jo=y.useCallback((z,ne)=>{bt(te=>({...te,[z]:ne})),Tm(z);const ce=/^(.+)__module_\d+$/.exec(z);if(ce&&xm(ne)){const te=ce[1];Tt.find(se=>se.key===te&&se.type==="markdown-module")&&bt(se=>{const me={...se,[z]:ne};return Object.keys(me).filter(_e=>_e.startsWith(`${te}__module_`)).every(_e=>xm(me[_e]))&&(Ln(_e=>{if(!_e.markdownModules[te])return _e;const Be={..._e.markdownModules};return delete Be[te],{..._e,markdownModules:Be}}),Object.keys(me).filter(_e=>_e.startsWith(`${te}__module_`)).forEach(_e=>delete me[_e]),me[te]=""),me});return}if(typeof ne=="string"&&ne.trim()===""){const te=Tt.find(re=>re.key===z);te?.type==="report-url"?(Ln(re=>{if(!re.reportModules[z])return re;const se={...re.reportModules};return delete se[z],{...re,reportModules:se}}),al(re=>{if(!(z in re))return re;const se={...re};return delete se[z],se})):(te?.type==="markdown"||te?.type==="markdown-name")&&Ln(re=>{if(!re.markdownModules[z])return re;const se={...re.markdownModules};return delete se[z],{...re,markdownModules:se}})}},[Tm,Tt]),D6=y.useCallback((z,ne)=>{On(ce=>({...ce,[z]:ne}))},[]),L6=y.useCallback((z,ne)=>rn(ce=>({...ce,[z]:ne})),[]),P6=y.useCallback(z=>{al(ne=>{if(!(z in ne))return ne;const ce=z.match(/^(.+)_(\d+)$/);if(!ce){const Ie={...ne};return delete Ie[z],Ie}const[,te,re]=ce,se=parseInt(re,10),me={};for(const[Ie,_e]of Object.entries(ne)){if(Ie===z)continue;const Be=Ie.match(/^(.+)_(\d+)$/);if(Be&&Be[1]===te){const ct=parseInt(Be[2],10);ct>se?me[`${te}_${ct-1}`]=_e:me[Ie]=_e}else me[Ie]=_e}return me})},[]),B6=y.useCallback((z,ne)=>{al(ce=>{const te=`${z}_`,re=[];for(const me of Object.keys(ce)){if(!me.startsWith(te))continue;const Ie=me.slice(te.length);/^\d+$/.test(Ie)&&re.push([Number(Ie),ce[me]])}if(re.length===0)return ce;const se={...ce};for(const[me]of re)delete se[`${z}_${me}`];for(const[me,Ie]of re){if(me===ne)continue;const _e=me>ne?me-1:me;se[`${z}_${_e}`]=Ie}return se})},[]),Go=y.useCallback(async(z,ne,ce)=>{const te=await ci(z,ne,ce);return te.status==="success"&&al(re=>({...re,[z]:te.name})),te},[ci]),R6=y.useCallback((z,ne)=>{ui(z,ne).then(ce=>{ce.status==="success"&&Ln(te=>({...te,reportModules:{...te.reportModules,[z]:ce.modules}}))})},[ui]),Ko=y.useCallback(async(z,ne)=>{ci(z,ne,"report-url").then(te=>{te.status==="success"&&al(re=>({...re,[z]:te.name}))});const ce=await ui(z,ne);ce.status==="success"?(Ln(te=>({...te,reportModules:{...te.reportModules,[z]:ce.modules}})),bt(te=>{const re={...te};return ce.modules.forEach((se,me)=>{re[`${z}__module_${me}`]=se.content}),re})):ce.status==="failed"&&(jo(z,""),bt(te=>{let re=!1;const se={...te};for(const me of Object.keys(se))me.startsWith(`${z}__module_`)&&(delete se[me],re=!0);return re?se:te}))},[ui,ci,jo]);y.useEffect(()=>{if(!i||t.length===0)return;const z=t.filter(ce=>ce.type==="report-url"&&ce.key),ne=t.filter(ce=>ce.type==="multi-variable-select"&&ce.key);if(!(z.length===0&&ne.length===0)){for(const ce of z){const te=ce.key,re=i[te]??i[`${te}__url`];if(!re||typeof re=="string"&&!re.trim())continue;const se=Array.isArray(re)?String(re[0]??""):String(re);se&&Rr.current.get(te)!==se&&(Rr.current.set(te,se),setTimeout(()=>{Ko(te,se)},100))}for(const ce of ne){const te=ce.key,re=i[te];!Array.isArray(re)||re.length===0||re.forEach((se,me)=>{const Ie=typeof se=="string"?se.trim():"";if(!Ie)return;const _e=`${te}_${me}`;Rr.current.get(_e)!==Ie&&(Rr.current.set(_e,Ie),setTimeout(()=>{Go(_e,Ie,"multi-variable-select")},100))})}}},[i,t,Ko,Go]);const di=y.useCallback(async(z,ne,ce)=>{const re=Date.now();ai(se=>{const me=new Set(se);return me.add(z),me});try{const se=await ce(z,ne),me=Date.now()-re;me<500&&await new Promise(Ie=>setTimeout(Ie,500-me)),se&&(Ln(Ie=>({...Ie,markdownModules:{...Ie.markdownModules,[z]:se.modules}})),bt(Ie=>{const _e={...Ie};return se.modules.forEach((Be,ct)=>{_e[`${z}__module_${ct}`]=Be.content}),_e}))}finally{ai(se=>{if(!se.has(z))return se;const me=new Set(se);return me.delete(z),me})}},[]),F6=y.useCallback((z,ne)=>di(z,ne,Cm),[di,Cm]),H6=y.useCallback((z,ne)=>di(z,ne,Sm),[di,Sm]);y.useEffect(()=>{s?.(ot)},[ot,s]),y.useEffect(()=>{if(Wo.current){Wo.current=!1;return}o?.(he)},[he,o]);const Qo=y.useCallback(async()=>{if(l||r)return;if(t.length===0){const te=sl.trim();if(!te)return;const re=an?`【${an.title}】${te}`:te;n(te,re),pm("");return}if(!Em(Qe,ot,Fr))return;const{formData:z,fullPrompt:ne,hasContent:ce}=await Fw({config:Tt,values:Qe,files:ot,footerFiles:he,markdownModules:Dn.markdownModules});ce&&n(z,ne)},[t.length,sl,an,Tt,Qe,ot,he,Dn.markdownModules,l,r,Em,n,Fr]),U6=y.useCallback(z=>{z.key==="Enter"&&(z.nativeEvent.isComposing||z.keyCode===229||z.shiftKey||(z.preventDefault(),Qo()))},[Qo]),z6=y.useMemo(()=>t.length===0?sl.trim().length>0:Nw(Tt,Qe,ot,Fr),[t.length,sl,Tt,Qe,ot,Fr]);y.useLayoutEffect(()=>{if(!an){mm(0);return}const z=bm.current;if(!z)return;const ne=z.getBoundingClientRect().width-2;mm(Math.max(0,ne))},[an]),y.useLayoutEffect(()=>{const z=$o.current;z&&(z.style.height="auto",z.style.height=`${z.scrollHeight}px`)},[sl,qo]);const V6={width:c,background:d,border:f,maxHeight:h,...m&&!ee?{minHeight:m}:{},...g?{"--rte-editor-min-height":typeof g=="number"?`${g}px`:g}:{},...v?{"--rte-editor-padding":v}:{}},km=typeof ue=="number"?ue:Ht,Am={maxHeight:ee?km:Math.max(wt,km),minHeight:ee||si?0:void 0,overflow:ee||si?"hidden":Pn?"auto":"hidden",transition:Vo?"none":`max-height ${fe}ms cubic-bezier(0.4, 0, 0.2, 1)`,willChange:"max-height"},Nm=y.useCallback(()=>{ee&&Ce&&D?.(!1),$o.current?.focus()},[ee,Ce,D]),Xo=y.useCallback(()=>{const z=Pt.current;if(!z)return;if(!ee&&(typeof performance<"u"?performance.now():Date.now())>=dm.current){const te=z.style.maxHeight;z.style.maxHeight="none";const re=z.offsetHeight;z.style.maxHeight=te;const se=Math.max(0,Math.ceil(z.scrollHeight||0),Math.ceil(re||0));se>0&&ut(me=>me===se?me:se)}try{const ce=z.getBoundingClientRect(),te=z.querySelector(".rte-config-fade")??z,re=document.createRange();re.selectNodeContents(te);const se=Array.from(re.getClientRects());if(se.length>0){const me=Math.min(...se.map(ct=>ct.top)),Ie=2;let _e=0;for(const ct of se)Math.abs(ct.top-me)<=Ie&&(_e=Math.max(_e,ct.bottom));const Be=_e>0?Math.ceil(_e-ce.top):0;Be>0&&il(ct=>ct===Be?ct:Be)}}catch{}const ne=z.scrollHeight>z.clientHeight+1;Ut(ce=>ce===ne?ce:ne)},[ee]),Rl=y.useMemo(()=>Tt.filter(z=>z.key&&z.type!=="report-module"&&z.type!=="markdown-module").map(z=>`${z.type}:${z.key}`).join("|"),[Tt]),wm=y.useRef(Rl);wm.current!==Rl&&(wm.current=Rl,ee||(ut(em),cm(!0))),y.useEffect(()=>{if(!Vo)return;const z=setTimeout(()=>cm(!1),fe);return()=>clearTimeout(z)},[Vo,Rl,fe]),y.useLayoutEffect(()=>{const z=Pt.current;if(!z||(Xo(),typeof ResizeObserver>"u"))return;const ne=new ResizeObserver(()=>Xo());ne.observe(z);const ce=z.querySelector(".rte-default-textarea, .rte-config-fade");return ce&&ne.observe(ce),()=>ne.disconnect()},[Xo,Tt,ot,he.length,ii,ee,Rl,sl]);const _m=y.useRef(-1);y.useEffect(()=>{ee||wt<=0||wt>=em||_m.current!==wt&&(_m.current=wt,Se?.(wt))},[wt,ee,Se]);const Im=y.useMemo(()=>new Set(["pdf","xla","xlb","xlc","xlm","xls","xlsx","xlt","xlw","csv","tsv","iif","doc","docx","dot","odt","rtf","pot","ppa","pps","ppt","pptx","pwz","wiz","asm","bat","c","cc","conf","cpp","css","cxx","def","dic","eml","h","hh","htm","html","ics","ifb","in","js","json","ksh","png","jpeg","jpg","gif","webp","md","php","pkl","rb","tar","tex","ts","txt","xml"]),[]),$6=y.useCallback(z=>{const ne=z.clipboardData?.files;if(!ne||ne.length===0||(z.preventDefault(),t.some(Be=>Be.type==="tag")))return;const te=[];let re=!1;for(const Be of Array.from(ne)){const ct=(Be.name||"").split(".").pop()?.toLowerCase()||"";Im.has(ct)?te.push(Be):re=!0}if(re&&ae.message.error("粘贴文件中含不支持的类型,已自动过滤"),te.length===0)return;const se=50*1024*1024,me=he.reduce((Be,ct)=>Be+ct.size,0),Ie=[];let _e=me;for(const Be of te){if(_e+Be.size>se){ae.message.error("文件总大小不能超过 50MB");break}Ie.push(Be),_e+=Be.size}Ie.length>0&&Le(Be=>[...Ie,...Be])},[Im,t,he]);return b.jsx(ae.ConfigProvider,{getPopupContainer:be,children:b.jsxs(Gd.Provider,{value:Y,children:[b.jsxs("div",{className:`rich-text-editor ${ye?"rte-richtext-container-expanded":""} ${E??""}`,"data-component":"structured-editor",style:V6,onPaste:$6,children:[b.jsx(Zb,{files:he,onChange:Le}),t.length===0?b.jsxs("div",{ref:Pt,className:`rte-editor rte-editor-default${an?" rte-editor-default-with-skill":""}`,style:Am,onClick:Nm,children:[an&&b.jsx("span",{ref:bm,className:"rte-skill-inline-tag-wrap",contentEditable:!1,children:b.jsx(hi,{node:{type:"tag",text:an.title},onClose:()=>oi(null)})}),b.jsx("textarea",{ref:$o,className:"rte-default-textarea",value:sl,onChange:z=>pm(z.target.value),onKeyDown:U6,placeholder:a??"",disabled:r,rows:1,style:qo?{textIndent:`${qo}px`}:void 0})]}):b.jsx("div",{ref:Pt,className:`rte-editor${ye?" rte-richtext-fullscreen-active":""}`,style:Am,onClick:Nm,children:b.jsx("div",{className:"rte-config-fade",children:Tt.map((z,ne)=>{if(z.key&&Fr.has(z.key)||M6&&z.exclusionGroup==="separator"||ye&&z.key!==ye)return null;const ce=(z.type==="report-module"||z.type==="markdown-module")&&z.key?`${z.key}__module_${z.moduleIndex??0}`:z.key;return b.jsx(Bb,{node:z,value:ce?Qe[ce]:void 0,files:ot,onChange:jo,onFileChange:D6,thumbnails:Mn,onThumbnailChange:L6,videoUrlParse:w,videoUpload:N,reportListFetch:O,onReportGoGenerate:C,onViewReport:_,hideCurrentSessionReport:A,reportNames:ii,onClearReport:P6,onResolveMultiName:Go,onAnalyzeMultiReport:R6,onShiftReportNames:B6,onAgentExit:B,hideAgentClose:q==="hideTagClose",onReportUrlParse:Ko,onMarkdownParse:F6,onMarkdownNameParse:H6,onRichtextExpandChange:Nt,disabled:r,error:ce?O6[ce]:void 0,index:ne,nodeDefaults:Ae},ce??`text-${ne}`)})},Rl)}),b.jsx(Jb,{isProcessing:l,loading:W,disabled:r,sendDisabled:!z6,showFooterUpload:S,footerFiles:he,onFooterFilesChange:Le,agentOptions:F,onAgentSelect:I6,hideAgentButton:q==="hideAgent",currentAgent:Br,selectedSkill:an,onSkillSelect:_6,onSkillAction:T,skillListFetch:H,onSend:Qo,padding:K})]}),b.jsx("div",{className:"rte-popup-host",ref:J})]})})},nm="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAFSSURBVHgB3ZTtccIwDIaVXv83I2SDZgSP0BHMBG0naEZhA2boBGQDswHdQJUOGRxjO0Z8HPDe6eJzJD2W4gjgEYSIn2xwK6EIFHqBGysJpMP3ZB0oRbEtmal1NtIxl4OWWsoxEsvqofJ0rgTNASOYq+7SXKDsuYvAcgkq/PWwBLQWqIfdjeRStaBUc4qzgLi9/BzJNmS/sh6bpvmrTfSFacU3scWy1mQryWdSnXiFE8QVUJINLTuyhWzzz/1OZmTN9hEckqtfUOwIGlGCpVRjE+94JFqpMtTeVzO8/UmPxpZU8Qa7aln8Tb9pfwla4WHWrjPvvbbnTBsX7PmLs83EDAH0BxSw1G31+/1FoDg/vPcXR+wocQS1apj4+P92FfhOoLyuBfYlmPgYnGoCjWADzAkzUyJ430awLmphPaxWQVU22BuuApPkHaanjcXSN3t6/QNjTMSJWDcs1QAAAABJRU5ErkJggg==",m6=[{label:"5页",value:5},{label:"10页",value:10},{label:"15页",value:15},{label:"30页",value:30}],g6=({autoLoading:e,batchSize:t,loadingProgress:n,loadIcon:l,onBatchSizeChange:r,onLoadNextPage:a,onStartAutoLoad:i,onStopLoad:s})=>e&&n?b.jsxs("div",{className:"auto_load_progress",children:[l||b.jsx("img",{src:nm,alt:"自动加载",width:14,height:14}),b.jsxs("span",{children:["正在加载第",n.currentPage,"/",n.totalPages,"页"]}),b.jsx(ae.Progress,{percent:n.percentage,type:"line",size:[160,8]}),b.jsx("span",{onClick:s,className:"auto_load_stop_btn",children:"停止加载"})]}):b.jsxs("div",{className:"auto_load_container",children:[b.jsx("div",{onClick:a,className:"auto_load_next_btn",style:{backgroundColor:e?"#f5f5f5":"#2563eb"},children:"加载下一页"}),b.jsxs("div",{className:"right_control_wrap",style:{backgroundColor:e?"#f5f5f5":"#2563eb"},children:[b.jsxs("div",{className:"auto_load_btn",onClick:e?void 0:i,children:[l||b.jsx("img",{src:nm,alt:"自动加载",width:14,height:14}),b.jsx("span",{children:"自动加载"})]}),b.jsx(ae.Select,{value:t,onChange:r,options:m6,disabled:e,size:"small",className:"auto_load_select",popupMatchSelectWidth:84})]})]}),v6=({current:e,loadIcon:t,pageSize:n,total:l,cachedPages:r,loadedCount:a,autoLoading:i=!1,loadingProgress:s,onChange:o,onLoadNextPage:u,onStartAutoLoad:c,onStopLoading:d})=>{const[f,h]=y.useState(5),m=Math.ceil(l/n),g=y.useMemo(()=>r.length>=m,[r,m]),v=()=>Array.from({length:m},(N,L)=>L+1).filter(N=>!r.includes(N)).slice(0,f),E=(w,N,L)=>{const O=r.includes(w);return N==="prev"||N==="next"||N==="jump-prev"||N==="jump-next"?b.jsx("div",{className:"pageBox",children:L}):b.jsxs("div",{className:"pageBox",style:{backgroundColor:e===w?"#2563EB":"#f5f5f5",color:e===w?"#fff":O?"#171717":"#a3a3a3"},children:[w,!O&&b.jsx("span",{className:"unload_spot"})]})};return b.jsxs("div",{className:"pagination_footer",children:[b.jsxs("div",{className:"pagination_leftWrap",children:[b.jsxs("span",{className:"pagination_total",children:[b.jsx(zt.InfoCircleOutlined,{style:{color:"#2563EB",marginRight:"4px"}}),"已加载: ",a,"/",l,"条数据"]}),!g&&b.jsx(g6,{loadIcon:t||void 0,autoLoading:i,batchSize:f,loadingProgress:s,disabled:!u||!c,onBatchSizeChange:h,onLoadNextPage:()=>u?.(),onStartAutoLoad:()=>{const w=v();c?.(w)},onStopLoad:()=>d?.()})]}),b.jsx(ae.Pagination,{current:e,pageSize:n,total:l,onChange:w=>o(w),showSizeChanger:!1,showQuickJumper:!1,showTotal:()=>"",itemRender:E})]})},lm=e=>{const{loading:t,autoLoading:n,loadingProgress:l,columns:r=[],dataSource:a=[],total:i,current:s,pageSize:o,cachedPages:u,onChangePage:c,onLoadNextPage:d,onStartAutoLoad:f,onStopLoading:h,...m}=e,g=y.useRef(null),v=y.useCallback(E=>{c(E),u.includes(E)&&g.current?.scrollTo({key:`${(E-1)*o+1}`})},[u,c,o]);return b.jsxs("div",{className:"flex flex-col",children:[b.jsx(ae.Table,{ref:g,...m,columns:r,dataSource:a,pagination:!1,virtual:!0}),b.jsx(v6,{loading:t,autoLoading:n,loadingProgress:l,current:s,pageSize:o,total:i,loadedCount:a.length,cachedPages:u,onChange:v,onLoadNextPage:d,onStartAutoLoad:f,onStopLoading:h})]})};lm.__docgenInfo={displayName:"VirtualTable",description:"虚拟滚动表格组件,支持分页、数据缓存和自动加载功能。",props:{loading:{description:"加载状态",name:"loading",required:!0,type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},total:{description:"总数据条数",name:"total",required:!0,type:{name:"number",raw:"number"},defaultValue:{value:"0"}},current:{description:"当前页码",name:"current",required:!0,type:{name:"number",raw:"number"},defaultValue:{value:"1"}},pageSize:{description:"每页数据条数",name:"pageSize",required:!0,type:{name:"number",raw:"number"},defaultValue:{value:"10"}},cachedPages:{description:"已缓存的页码数组",name:"cachedPages",required:!0,type:{name:"number[]",raw:"number[]"},defaultValue:{value:"[]"}},dataSource:{description:"数据源",name:"dataSource",required:!0,type:{name:"Array<T>",raw:"Array<T>"},defaultValue:{value:"[]"}},onChangePage:{description:"页码变更回调函数",name:"onChangePage",required:!0,type:{name:"function",raw:"function(page: number): void"},defaultValue:{value:"-"}},autoLoading:{description:"是否正在自动加载",name:"autoLoading",required:!0,type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},loadingProgress:{description:"加载进度信息",name:"loadingProgress",required:!0,type:{name:"object",raw:"{percentage: 0, currentPage: 1, totalPages: 5}"},defaultValue:{value:"-"}},onLoadNextPage:{description:"加载下一页回调函数",name:"onLoadNextPage",required:!1,type:{name:"function",raw:"function(page: number): void"},defaultValue:{value:"-"}},onStartAutoLoad:{description:"开始自动加载回调函数",name:"onStartAutoLoad",required:!1,type:{name:"function",raw:"function(loadNextPages: number[]): void"},defaultValue:{value:"-"}},onStopLoading:{description:"停止加载回调函数",name:"onStopLoading",required:!1,type:{name:"function",raw:"function(): void"},defaultValue:{value:"-"}},columns:{description:"表格列配置",name:"columns",required:!0,type:{name:"Array<object>",raw:"Array<object>"},defaultValue:{value:"[]"}}}};const rm=({texts:e=[],placeholder:t="请输入内容",animationSpeed:n=100,autoPlay:l=!0,value:r,onChange:a,...i})=>{const[s,o]=y.useState(""),[u,c]=y.useState(0),[d,f]=y.useState(!1),[h,m]=y.useState(!1),[g,v]=y.useState(!1),E=y.useRef(void 0),w=y.useRef(void 0),N=y.useRef(e),L=y.useRef(u),O=y.useRef(h),C=y.useRef(s);y.useEffect(()=>{N.current=e,L.current=u,O.current=h,C.current=s});const I=y.useCallback((B,T)=>{let H=0;v(!0);const W=()=>{H<B.length?(o(B.slice(0,H+1)),H++,w.current=window.setTimeout(W,n)):(v(!1),T?.())};W()},[n]),_=y.useCallback(B=>{let T=C.current.length;const H=()=>{T>0?(o(C.current.slice(0,T-1)),T--,w.current=window.setTimeout(H,n/2)):B?.()};H()},[n]),A=y.useCallback(()=>{if(N.current.length===0||O.current)return;f(!0);const B=N.current[L.current];C.current?_(()=>{I(B,()=>{E.current=window.setTimeout(()=>{c(T=>(T+1)%N.current.length),f(!1)},2e3)})}):I(B,()=>{E.current=window.setTimeout(()=>{c(T=>(T+1)%N.current.length),f(!1)},2e3)})},[_,I]);y.useEffect(()=>(l&&e.length>0&&!h&&A(),()=>{E.current&&window.clearTimeout(E.current),w.current&&window.clearTimeout(w.current)}),[u,h,l,e.length,A]),y.useEffect(()=>{!d&&l&&e.length>0&&!h&&A()},[u,d,l,e.length,h,A]);const R=B=>{m(!0),E.current&&window.clearTimeout(E.current),w.current&&window.clearTimeout(w.current),f(!1),v(!1),i.onFocus?.(B)},P=B=>{m(!1),!r&&e.length>0&&(o(""),c(0)),i.onBlur?.(B)},F=B=>{a?.(B.target.value),i.onChange?.(B)},V=()=>h||r?t:s||t;return b.jsxs("div",{style:{position:"relative"},children:[b.jsx(ae.Input,{...i,value:r,onChange:F,onFocus:R,onBlur:P,placeholder:V(),style:{...i.style,position:"relative",zIndex:1}}),!h&&!r&&s&&b.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",paddingLeft:11,paddingRight:11,color:"#bfbfbf",pointerEvents:"none",zIndex:2,fontSize:14,fontFamily:"inherit"},children:[b.jsx("span",{children:s}),g&&b.jsx("span",{style:{display:"inline-block",width:1,height:"1.2em",backgroundColor:"#1890ff",marginLeft:2,animation:"blink 1s infinite"}})]}),b.jsx("style",{children:`
|
|
147
147
|
@keyframes blink {
|
|
148
148
|
0%, 50% { opacity: 1; }
|
|
149
149
|
51%, 100% { opacity: 0; }
|