bi-components-library 1.3.2-next.72 → 1.3.2-next.73

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.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(ge.near(l.resolve(s))),!0)):e.commands.exitCode()}}},addInputRules(){return[Ro({find:eN,type:this.type,getAttributes:e=>({language:e[1]})}),Ro({find:tN,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new ot({key:new zt("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}}})]}}),lN=yt.create({name:"doc",topNode:!0,content:"block+"});function rN(e={}){return new ot({view(t){return new aN(t,e)}})}class aN{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 b=h.getBoundingClientRect(),v=d?b.bottom:b.top;d&&f&&(v=(v+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*s;l={left:b.left,right:b.right,top:v-g,bottom:v+g}}}}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=kh(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 iN=it.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[rN(this.options)]}});class He extends ge{constructor(t){super(t,t)}map(t,n){let l=t.resolve(n.map(this.head));return He.valid(l)?new He(l):ge.near(l)}content(){return le.empty}eq(t){return t instanceof He&&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 He(t.resolve(n.pos))}getBookmark(){return new Yo(this.anchor)}static valid(t){let n=t.parent;if(n.inlineContent||!sN(t)||!oN(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&&He.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(He.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(He.valid(s))return s}return null}}}He.prototype.visible=!1,He.findFrom=He.findGapCursorFrom,ge.jsonID("gapcursor",He);class Yo{constructor(t){this.pos=t}map(t){return new Yo(t.map(this.pos))}resolve(t){let n=t.resolve(this.pos);return He.valid(n)?new He(n):ge.near(n)}}function F0(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function sN(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||F0(r.type))return!0;if(r.inlineContent)return!1}}return!0}function oN(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||F0(r.type))return!0;if(r.inlineContent)return!1}}return!0}function uN(){return new ot({props:{decorations:hN,createSelectionBetween(e,t,n){return t.pos==n.pos&&He.valid(n)?new He(n):null},handleClick:dN,handleKeyDown:cN,handleDOMEvents:{beforeinput:fN}}})}const cN=Jp({ArrowLeft:ii("horiz",-1),ArrowRight:ii("horiz",1),ArrowUp:ii("vert",-1),ArrowDown:ii("vert",1)});function ii(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=He.findGapCursorFrom(s,t,o);return u?(r&&r(l.tr.setSelection(new He(u))),!0):!1}}function dN(e,t,n){if(!e||!e.editable)return!1;let l=e.state.doc.resolve(t);if(!He.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 He(l))),!0)}function fN(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof He))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=K.empty;for(let i=l.length-1;i>=0;i--)r=K.from(l[i].createAndFill(null,r));let a=e.state.tr.replace(n.pos,n.pos,new le(r,0,0));return a.setSelection(pe.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function hN(e){if(!(e.selection instanceof He))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",We.create(e.doc,[Nt.widget(e.selection.head,t,{key:"gapcursor"})])}const pN=it.create({name:"gapCursor",addProseMirrorPlugins(){return[uN()]},extendNodeSchema(e){var t;const n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:(t=ye(ae(e,"allowGapCursor",n)))!==null&&t!==void 0?t:null}}}),bN=yt.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",dt(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()}}}),mN=yt.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]}`,dt(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=>Ro({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}});var si=200,Qe=function(){};Qe.prototype.append=function(t){return t.length?(t=Qe.from(t),!this.length&&t||t.length<si&&this.leafAppend(t)||this.length<si&&t.leafPrepend(this)||this.appendInner(t)):this},Qe.prototype.prepend=function(t){return t.length?Qe.from(t).append(this):this},Qe.prototype.appendInner=function(t){return new gN(this,t)},Qe.prototype.slice=function(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.length),t>=n?Qe.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))},Qe.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},Qe.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)},Qe.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},Qe.from=function(t){return t instanceof Qe?t:t&&t.length?new H0(t):Qe.empty};var H0=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<=si)return new t(this.values.concat(r.flatten()))},t.prototype.leafPrepend=function(r){if(this.length+r.length<=si)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}(Qe);Qe.empty=new H0([]);var gN=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}(Qe);const vN=500;class Vt{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 Zt(d.map));let h=d.step.map(r.slice(a)),b;h&&i.maybeStep(h).doc&&(b=i.mapping.maps[i.mapping.maps.length-1],u.push(new Zt(b,void 0,void 0,u.length+c.length))),a--,b&&r.appendMap(b,a)}else i.maybeStep(d.step);if(d.selection)return s=r?d.selection.map(r.slice(a)):d.selection,o=new Vt(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 Zt(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>EN&&(s=yN(s,u),i-=u),new Vt(s.append(a),i)}remapping(t,n){let l=new Nr;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 Vt(this.items.append(t.map(n=>new Zt(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 b=a.maps[h];if(f.step){let v=t.steps[h].invert(t.docs[h]),g=f.selection&&f.selection.map(a.slice(o+1,h));g&&s++,l.push(new Zt(b,v,g))}else l.push(new Zt(b))},r);let u=[];for(let f=n;f<i;f++)u.push(new Zt(a.maps[f]));let c=this.items.slice(0,r).append(u).append(l),d=new Vt(c,s);return d.emptyItemCount()>vN&&(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 Zt(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 Vt(Qe.from(r.reverse()),a)}}Vt.empty=new Vt(Qe.empty,0);function yN(e,t){let n;return e.forEach((l,r)=>{if(l.selection&&t--==0)return n=r,!1}),e.slice(n)}class Zt{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 Zt(n.getMap().invert(),n,this.selection)}}}class Dn{constructor(t,n,l,r,a){this.done=t,this.undone=n,this.prevRanges=l,this.prevTime=r,this.prevComposition=a}}const EN=20;function TN(e,t,n,l){let r=n.getMeta(ol),a;if(r)return r.historyState;n.getMeta(xN)&&(e=new Dn(e.done,e.undone,null,0,-1));let i=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(i&&i.getMeta(ol))return i.getMeta(ol).redo?new Dn(e.done.addTransform(n,void 0,l,oi(t)),e.undone,U0(n.mapping.maps),e.prevTime,e.prevComposition):new Dn(e.done,e.undone.addTransform(n,void 0,l,oi(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||!CN(n,e.prevRanges)),u=i?jo(e.prevRanges,n.mapping):U0(n.mapping.maps);return new Dn(e.done.addTransform(n,o?t.selection.getBookmark():void 0,l,oi(t)),Vt.empty,u,n.time,s??e.prevComposition)}else return(a=n.getMeta("rebased"))?new Dn(e.done.rebased(n,a),e.undone.rebased(n,a),jo(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new Dn(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),jo(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function CN(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 U0(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 jo(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 SN(e,t,n){let l=oi(t),r=ol.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 Dn(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(i).setMeta(ol,{redo:n,historyState:o})}let Go=!1,z0=null;function oi(e){let t=e.plugins;if(z0!=t){Go=!1,z0=t;for(let n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){Go=!0;break}}return Go}const ol=new zt("history"),xN=new zt("closeHistory");function kN(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new ot({key:ol,state:{init(){return new Dn(Vt.empty,Vt.empty,null,0,-1)},apply(t,n,l){return TN(n,l,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(t,n){let l=n.inputType,r=l=="historyUndo"?$0:l=="historyRedo"?q0:null;return!r||!t.editable?!1:(n.preventDefault(),r(t.state,t.dispatch))}}}})}function V0(e,t){return(n,l)=>{let r=ol.getState(n);if(!r||(e?r.undone:r.done).eventCount==0)return!1;if(l){let a=SN(r,n,e);a&&l(t?a.scrollIntoView():a)}return!0}}const $0=V0(!1,!0),q0=V0(!0,!0),AN=it.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>$0(e,t),redo:()=>({state:e,dispatch:t})=>q0(e,t)}},addProseMirrorPlugins(){return[kN(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()}}}),NN=yt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:e}){return["hr",dt(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!EA(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}):X6(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[yA({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),wN=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,_N=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,IN=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,ON=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,MN=On.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",dt(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[zl({find:wN,type:this.type}),zl({find:IN,type:this.type})]},addPasteRules(){return[Vl({find:_N,type:this.type}),Vl({find:ON,type:this.type})]}}),DN=yt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",dt(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)}}}),LN="listItem",W0="textStyle",Y0=/^(\d+)\.\s$/,PN=yt.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",dt(this.options.HTMLAttributes,n),0]:["ol",dt(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(LN,this.editor.getAttributes(W0)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=$r({find:Y0,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=$r({find:Y0,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(W0)}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1],editor:this.editor})),[e]}}),BN=yt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",dt(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),RN=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,FN=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,HN=On.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",dt(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[zl({find:RN,type:this.type})]},addPasteRules(){return[Vl({find:FN,type:this.type})]}}),UN=yt.create({name:"text",group:"inline"}),zN=it.create({name:"starterKit",addExtensions(){const e=[];return this.options.bold!==!1&&e.push(GA.configure(this.options.bold)),this.options.blockquote!==!1&&e.push($A.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(QA.configure(this.options.bulletList)),this.options.code!==!1&&e.push(ZA.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(nN.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(lN.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(iN.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(pN.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(bN.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(mN.configure(this.options.heading)),this.options.history!==!1&&e.push(AN.configure(this.options.history)),this.options.horizontalRule!==!1&&e.push(NN.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(MN.configure(this.options.italic)),this.options.listItem!==!1&&e.push(DN.configure(this.options.listItem)),this.options.orderedList!==!1&&e.push(PN.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(BN.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(HN.configure(this.options.strike)),this.options.text!==!1&&e.push(UN.configure(this.options.text)),e}}),VN=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 ot({key:new zt("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&&ri(i);if((o||!this.options.showOnlyCurrent)&&u){const c=[this.options.emptyNodeClass];a&&c.push(this.options.emptyEditorClass);const d=Nt.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}),We.create(e,r)}}})]}});function $N(e){return[zN.configure({heading:{levels:[1,2,3]},history:{depth:50}}),VN.configure({placeholder:e.placeholder??"",showOnlyWhenEditable:!0,emptyEditorClass:"rte-richtext-empty"})]}const qN=({expanded:e,onToggle:t})=>m.jsxs("button",{type:"button",className:"rte-richtext-toggle","data-expanded":e?"true":"false",onClick:t,children:[m.jsx("i",{className:`iconfont ${e?"icon-shouqi1":"icon-zhankai2"}`}),m.jsx("span",{className:"rte-richtext-toggle-label",children:e?"收起":"展开"})]}),j0=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),b=y.useRef(e.key);y.useEffect(()=>{h.current=n},[n]),y.useEffect(()=>{b.current=e.key},[e.key]);const v=HA({extensions:$N({placeholder:e.placeholder}),content:t||"",editable:!l,onUpdate:({editor:k})=>{const M=b.current;M&&h.current(M,k.getHTML())},editorProps:{attributes:{class:"rte-richtext","data-type":"richtext","data-key":e.key??""}}});y.useEffect(()=>{if(!v)return;const k=v.getHTML(),M=t??"";k!==M&&(v.isFocused||v.commands.setContent(M,!1))},[t,v]),y.useEffect(()=>{v&&v.setEditable(!l)},[l,v]);const g=y.useCallback(()=>{f(k=>{const M=!k;return e.key&&i?.(e.key,M),M})},[e.key,i]);if(!v)return null;const T={"--rte-richtext-min-height":`${s}px`,"--rte-richtext-max-height":`${u}px`},N=["rte-richtext-wrapper",c?"rte-richtext-toggleable":"",d?"rte-richtext-expanded":""].filter(Boolean).join(" ");return m.jsx("div",{className:`rte-richtext-container ${d?"rte-richtext-host-expanded":""} ${r?"rte-richtext-error":""}`,"data-key":e.key,children:m.jsxs("div",{className:N,style:T,children:[m.jsx(_A,{editor:v}),c&&m.jsx(qN,{expanded:d,onToggle:g})]})})});j0.displayName="RichtextNode";const WN=e=>{const{node:t}=e;switch(t.type){case"text":return m.jsx(Tu,{node:t});case"tag":{const l=!e.hideAgentClose&&!!e.onAgentExit&&!t.tooltip?{...t,tooltip:"点击退出智能体"}:t;return m.jsx(Cu,{node:l,hideClose:e.hideAgentClose,onClose:()=>e.onAgentExit?.("tag-close")})}case"variable":return m.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});case"number-input":return m.jsx(cf,{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 m.jsx(df,{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 m.jsx(ff,{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 m.jsx(yf,{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 m.jsx(Ef,{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 m.jsx(Tf,{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 m.jsx(Sf,{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 m.jsx(kf,{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 m.jsx(wf,{node:t,files:e.files??{},onFileChange:e.onFileChange??(()=>{}),disabled:e.disabled,error:e.error});case"video-url":return m.jsx(Pf,{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 m.jsx(Bf,{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,onFileChange:e.onFileChange,videoUpload:e.videoUpload,disabled:e.disabled,error:e.error});case"report-url":return m.jsx(Ff,{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 m.jsx(I3,{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 m.jsx(O3,{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 m.jsx(_3,{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 m.jsx(M3,{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 m.jsx(j0,{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 m.jsx(nm,{node:e.node,value:e.value,onChange:e.onChange,index:e.index})}},G0=y.memo(WN);G0.displayName="NodeRenderer";const K0=e=>typeof e=="string"||Array.isArray(e)&&e.every(t=>typeof t=="string"),Q0=(e,t)=>e===t?!0:Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((n,l)=>n===t[l]):!1,YN=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 jN(e,t,n,l,r,a){const i=y.useRef({});y.useEffect(()=>{if(!e)return;const s=YN(l);n(u=>{const c={...u};let d=!1;for(const[f,h]of Object.entries(e)){if(s.has(f)||!K0(h))continue;const b=c[f],v=b===void 0||b===""||Array.isArray(b)&&b.length===0,g=!Q0(i.current[f],h);(v||g)&&(Q0(b,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 b=e[f];if(b==null)continue;const v=(Array.isArray(b)?b:[b]).filter(g=>g!=null&&g!=="");if(v.length!==0)if(h.batch)for(let g=0;g<v.length&&g<h.maxCount;g+=1){const T=`${f}-${g}`;c[T]==null&&(c[T]=v[g],d=!0)}else c[f]==null&&(c[f]=v[0],d=!0)}return d?c:u});const o={};for(const[u,c]of Object.entries(e))K0(c)&&(o[u]=c);i.current=o},[e,l,n,a])}const X0=new Set(["upload"]);function J0(e){return X0.has(e.type)?typeof e.maxCount=="number"&&typeof e.minCount=="number"&&e.maxCount>1?`至少上传 ${e.minCount} 个文件`:"请上传":"请填写"}function Z0(e){return e.type==="report-module"||e.type==="markdown-module"?`${e.key}__module_${e.moduleIndex??0}`:e.key}function GN(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}ui(i,t,n)||(r[Z0(i)]=J0(i))}for(const[,i]of a)if(!i.some(s=>ui(s,t,n)))for(const s of i)r[Z0(s)]=J0(s);return r}function ui(e,t,n){if(!e.key)return!0;if(X0.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 KN(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(!ui(s,t,n))return!1;for(const[,s]of a)if(!s.some(o=>ui(o,t,n)))return!1;return!0}function QN(e){const[t,n]=y.useState({}),l=y.useCallback((a,i,s=new Set)=>{const o=GN(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 XN=new Set(["upload"]);function eb(e,t,n){if(!e.key)return!1;if(XN.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 JN(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(b=>eb(b,t,n))),c=u.some(Boolean),d=u.findIndex(Boolean),f=new Set;return c&&s.forEach((h,b)=>{if(b!==d)for(const v of h)v.key&&f.add(v.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;eb(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 ZN(e,t,n){return y.useMemo(()=>JN(e,t,n),[e,t,n])}function e4(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(Ds(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 tb=/​/g,ci=e=>String(e??"").replace(tb,"").trim(),t4=e=>!e||!/<[a-z][\s\S]*>/i.test(e)?e:(new DOMParser().parseFromString(e,"text/html").body.textContent||"").replace(tb,"").trim(),n4=e=>e==="multi-variable"||e==="multi-variable-select",di=(e,t)=>{if(!t)return"";const n=e[t];return Array.isArray(n)?ci(n[0]):ci(n)},l4=(e,t)=>{if(!t)return[];const n=e[t];if(Array.isArray(n))return n.map(ci).filter(Boolean);const l=ci(n);return l?[l]:[]},Ko=e=>typeof e=="string"?decodeURIComponent(e.split("/").pop()?.split("?")[0]||"file"):e.name;async function r4(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 Qo=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 r4(n);e.append(t,a);return}if(Array.isArray(n)){if(l.has(t)){for(const a of n)await Qo(e,t,a,l,r);return}for(let a=0;a<n.length;a+=1)await Qo(e,`${t}[${a}]`,n[a],l,r);return}e.append(t,String(n))}},a4=["variable","report-url","markdown","markdown-name","select","searchable-select","cascader","textarea","richtext","datepicker","number-input","video-url"];async function i4(e){const{config:t,values:n,files:l,footerFiles:r,markdownModules:a,excludedKeys:i,hideSeparator:s}=e,o={},u=[],c=new Set(["url"]);for(const b of t){const v=b.key;if(!(v&&i?.has(v))){if(b.type==="text"||b.type==="tag"){if(s&&b.exclusionGroup==="separator")continue;b.text&&u.push(b.text);continue}if(v&&n4(b.type)){const g=l4(n,v);g.length>0&&(o[v]=g,c.add(v),u.push(g.join(" ")));continue}if(v&&a4.includes(b.type)){let g=di(n,v);if(!g&&b.type==="number-input"&&typeof b.defaultNumber=="number"&&(g=String(b.defaultNumber)),!g&&typeof b.defaultValue=="string"&&b.defaultValue!==""&&(g=b.defaultValue),!g)continue;if(o[v]=g,u.push(g),b.type==="report-url"){const T=o.url;o.url=T===void 0?g:Array.isArray(T)?[...T,g]:[String(T),g]}if(b.type==="markdown"||b.type==="markdown-name"){const T=b.sourceTextKey||`${v}__sourceText`;o[T]=g}continue}if(v&&(b.type==="report-module"||b.type==="markdown-module")){const g=`${v}__module_${b.moduleIndex??0}`,T=di(n,g)||di(n,v),N=t4(T);N&&(Array.isArray(o[v])||(o[v]=[]),o[v].push(N),c.add(v),u.push(N));continue}if(v&&b.type==="upload"){if(typeof b.maxCount=="number"&&typeof b.minCount=="number"&&b.maxCount>1){const T=[];for(let N=0;N<(b.maxCount??0);N+=1){const k=l[`${v}-${N}`];k&&T.push(k)}T.length>0&&(o[v]=T,u.push(` [附带${T.length}个文件: ${T.map(Ko).join(", ")}] `))}else{const T=l[v];T&&(o[v]=T,u.push(` [附带文件: ${Ko(T)}] `))}continue}if(v&&b.type==="video-upload"){const g=l[v];if(g)o[v]=g,u.push(` [附带视频: ${Ko(g)}] `);else{const T=di(n,v);T&&(o[v]=T,u.push(T))}continue}}}const d=u.join("").trim(),f=new FormData;f.append("fullPrompt",d);const h=new Set;for(const b of t)b.type==="upload"&&b.key&&h.add(b.key);if(a)for(const b of t){if(!b.key||b.type!=="markdown"&&b.type!=="markdown-name")continue;const v=a[b.key];if(!v||v.length===0)continue;const g=v.map(N=>(N?.markdown||"").trim()).filter(N=>N.length>0);if(g.length===0)continue;const T=`${b.key}__markdown`;o[T]=g,c.add(T)}for(const[b,v]of Object.entries(o))await Qo(f,b,v,c,h.has(b));return r.forEach(b=>{f.append("fileUrls",b)}),{formData:f,fullPrompt:d,hasContent:d.length>0||r.length>0}}function s4(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 o4={reportModules:{},markdownModules:{}},u4={adjustX:1,adjustY:1,shiftX:!1,shiftY:!1},nb=y.memo(({options:e,onSelect:t,disabled:n,currentAgent:l,onOpenChange:r})=>{const[a,i]=y.useState(!1),s=d=>{i(d),r?.(d)},o=e.filter(d=>d.isShowNew!==1).map(d=>({key:d.key,label:m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[d.icon&&m.jsx("i",{className:d.icon}),m.jsx("span",{children:d.label})]}),onClick:()=>t?.(d)})),c=`rte-agent-badge${!!l?" rte-agent-badge-selected":a?" rte-agent-badge-active":""}`;return m.jsx(ue.Dropdown,{menu:{items:o,selectedKeys:l?[String(l.key)]:[]},disabled:n,placement:"bottomLeft",autoAdjustOverflow:u4,trigger:["click"],overlayClassName:"rte-agent-dropdown",onOpenChange:s,children:m.jsxs("div",{className:c,style:{cursor:e.length>0?"pointer":"default"},children:[m.jsx("i",{className:"iconfont icon-zhinengti",style:{fontSize:"16px"}}),m.jsx("span",{className:"rte-agent-text",children:"智能体"})]})})});nb.displayName="AgentDropdown";function lb(e="width"){const t=y.useRef(null),[n,l]=y.useState(!1),r=y.useCallback(()=>{const a=t.current;a&&l(e==="height"?a.scrollHeight>a.clientHeight:a.scrollWidth>a.clientWidth)},[e]);return[t,n,r]}const c4=["全部技能","我的技能","订阅技能","系统技能"],d4=["all","mine","subscribe","system"],f4=20,h4={system:"系统技能",mine:"我的技能",subscribe:"订阅技能"},Ln="基于用户上传的抖音推广数据,智能分析高潜力商品与爆品抖音推广数据,智能分析高潜力商品与爆品商品机会",Pn=["淘宝天猫","抖音电商","市场选品","京东商城","拼多多","小红书","快手电商","视频号"],Bn="当用户需要尖锐吐槽、阴阳怪气评论、犀利差评、回怼话术或讽刺性改写时使用本技能;用户只需提供对象、场景、原话或想表达的不满,即可触发生成。",p4=[{id:"c1",title:"抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让",desc:Ln,tags:Pn,badge:"system",heat:"3.5",usageInstruction:Bn},{id:"c2",title:"抖音推广找潜力爆品",desc:Ln,tags:Pn,badge:"system",heat:"6.6",usageInstruction:Bn},{id:"c3",title:"抖音推广找潜力爆品",desc:Ln,tags:Pn,badge:"mine",usageInstruction:Bn},{id:"c4",title:"抖音推广找潜力爆品",desc:Ln,tags:Pn,badge:"subscribe",heat:"6.6",usageInstruction:Bn},{id:"c4",title:"抖音推广找潜力爆品",desc:Ln,tags:Pn,badge:"subscribe",heat:"6.6",usageInstruction:Bn},{id:"c4",title:"抖音推广找潜力爆品",desc:Ln,tags:Pn,badge:"mine",heat:"6.6",usageInstruction:Bn},{id:"c4",title:"抖音推广找潜力爆品",desc:Ln,tags:Pn,badge:"mine",heat:"6.6",usageInstruction:Bn},{id:"c4",title:"抖音推广找潜力爆品",desc:Ln,tags:Pn,badge:"mine",heat:"6.6",usageInstruction:Bn}],b4=e=>({id:e.id,title:e.title,desc:e.desc??"",usageInstruction:e.usageInstruction,tags:e.tags??[],badge:e.badge??"system",heat:e.heat}),m4=()=>m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:m.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"})}),g4=[()=>m.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:m.jsx("path",{d:"M5.99358 8.85714C6.27231 8.85714 6.53962 8.97003 6.73671 9.17096C6.9338 9.37189 7.04453 9.64441 7.04453 9.92857V12.9286C7.04453 13.2127 6.9338 13.4853 6.73671 13.6862C6.53962 13.8871 6.27231 14 5.99358 14H3.05094L2.94375 13.9946C2.6849 13.9676 2.4451 13.8436 2.27076 13.6467C2.09642 13.4497 1.99994 13.1939 2 12.9286V9.92857C1.99994 9.66329 2.09642 9.40742 2.27076 9.21049C2.4451 9.01355 2.6849 8.88956 2.94375 8.8625L3.05094 8.85714H5.99358ZM11.0087 8.74571C11.0323 8.68643 11.0727 8.63567 11.1247 8.59993C11.1768 8.5642 11.2381 8.54511 11.3008 8.54511C11.3636 8.54511 11.4249 8.5642 11.477 8.59993C11.529 8.63567 11.5694 8.68643 11.593 8.74571L12.1521 10.1675C12.168 10.2079 12.1917 10.2446 12.2219 10.2753C12.252 10.3061 12.288 10.3303 12.3276 10.3464L13.8021 10.9486C13.8585 10.9716 13.9072 11.0109 13.9423 11.0615C13.9773 11.1121 13.9973 11.172 13.9997 11.234C14.0022 11.2959 13.987 11.3572 13.956 11.4106C13.9251 11.4639 13.8796 11.507 13.8252 11.5346L12.3024 12.3104C12.2369 12.3438 12.1849 12.3995 12.1553 12.4679L11.5888 13.7675C11.564 13.8242 11.5236 13.8724 11.4725 13.9062C11.4214 13.94 11.3618 13.958 11.3008 13.958C11.2399 13.958 11.1803 13.94 11.1292 13.9062C11.0781 13.8724 11.0377 13.8242 11.0129 13.7675L10.4454 12.4679C10.4158 12.3995 10.3638 12.3438 10.2982 12.3104L8.77753 11.5357C8.7231 11.5081 8.67767 11.465 8.6467 11.4117C8.61574 11.3583 8.60056 11.297 8.603 11.235C8.60545 11.1731 8.62541 11.1132 8.66047 11.0626C8.69554 11.0119 8.74422 10.9727 8.80065 10.9496L10.2751 10.3475C10.3147 10.3313 10.3507 10.3071 10.3809 10.2764C10.411 10.2456 10.4348 10.209 10.4506 10.1686L11.0097 8.74679L11.0087 8.74571ZM3.05094 12.9286H5.99358V9.92857H3.05094V12.9286ZM5.99358 2C6.57371 2 7.04453 2.48 7.04453 3.07143V6.07143C7.04453 6.35559 6.9338 6.62811 6.73671 6.82904C6.53962 7.02997 6.27231 7.14286 5.99358 7.14286H3.05094L2.94375 7.1375C2.6849 7.11044 2.4451 6.98644 2.27076 6.78951C2.09642 6.59258 1.99994 6.33671 2 6.07143V3.07143C1.99994 2.80615 2.09642 2.55028 2.27076 2.35335C2.4451 2.15641 2.6849 2.03242 2.94375 2.00536L3.05094 2H5.99358ZM12.7196 2C12.9984 2 13.2657 2.11288 13.4628 2.31381C13.6598 2.51475 13.7706 2.78727 13.7706 3.07143V6.07143C13.7706 6.35559 13.6598 6.62811 13.4628 6.82904C13.2657 7.02997 12.9984 7.14286 12.7196 7.14286H9.77698L9.66873 7.1375C9.41016 7.10996 9.17075 6.98579 8.99668 6.78893C8.8226 6.59207 8.72619 6.33647 8.72604 6.07143V3.07143C8.72596 2.80632 8.82228 2.55059 8.99641 2.35368C9.17053 2.15677 9.41007 2.03266 9.66873 2.00536L9.77698 2H12.7196ZM9.77698 6.07143H12.7196V3.07143H9.77698V6.07143ZM3.05094 6.07143H5.99358V3.07143H3.05094V6.07143Z",fill:"currentColor"})}),()=>m.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[m.jsx("path",{d:"M12.6358 2.44435C12.8831 2.19815 13.2831 2.199 13.5293 2.44624C13.7755 2.69349 13.7746 3.0935 13.5274 3.33968L3.31858 13.5054C3.07133 13.7516 2.67132 13.7508 2.42513 13.5035C2.17893 13.2563 2.17977 12.8563 2.42701 12.6101L12.6358 2.44435Z",fill:"currentColor"}),m.jsx("path",{d:"M5.27212 5.97815L4.9117 7.22356C4.85382 7.42362 4.64471 7.53887 4.44466 7.48097C4.38352 7.46327 4.32785 7.43039 4.28284 7.38538C4.23783 7.34037 4.20495 7.2847 4.18726 7.22356L3.82686 5.97814C3.76198 5.75394 3.64142 5.54982 3.47639 5.38478C3.31136 5.21975 3.10723 5.09917 2.88304 5.03429L1.6376 4.67391C1.43755 4.61602 1.3223 4.40692 1.3802 4.20687C1.39789 4.14573 1.43077 4.09006 1.47578 4.04505C1.52079 4.00004 1.57646 3.96716 1.6376 3.94946L2.88303 3.58908C3.10722 3.5242 3.31135 3.40363 3.47638 3.23859C3.64141 3.07356 3.76198 2.86943 3.82686 2.64523L4.18726 1.39981C4.24514 1.19975 4.45425 1.08451 4.65429 1.1424C4.71544 1.1601 4.77111 1.19298 4.81612 1.23799C4.86112 1.283 4.89401 1.33867 4.9117 1.39981L5.27209 2.64523C5.33696 2.86943 5.45753 3.07356 5.62257 3.2386C5.7876 3.40363 5.99173 3.5242 6.21593 3.58908L7.46135 3.94946C7.66141 4.00735 7.77666 4.21646 7.71876 4.4165C7.70107 4.47764 7.66818 4.53331 7.62318 4.57832C7.57817 4.62333 7.5225 4.65621 7.46135 4.67391L6.21593 5.03429C5.99173 5.09917 5.7876 5.21974 5.62257 5.38478C5.45753 5.54981 5.33696 5.75394 5.27209 5.97814L5.27212 5.97815ZM12.4587 10.7095L12.3937 10.934C12.3494 11.0869 12.1896 11.175 12.0368 11.1308C11.99 11.1172 11.9475 11.0921 11.9131 11.0577C11.8787 11.0233 11.8536 10.9808 11.8401 10.934L11.7751 10.7095C11.7102 10.4853 11.5896 10.2811 11.4246 10.1161C11.2596 9.95108 11.0554 9.83051 10.8312 9.76564L10.6067 9.70065C10.4538 9.65642 10.3657 9.49662 10.41 9.34376C10.4235 9.29703 10.4486 9.25448 10.483 9.22009C10.5174 9.18569 10.5599 9.16056 10.6067 9.14704L10.8312 9.08206C11.0554 9.01718 11.2596 8.89661 11.4246 8.73158C11.5896 8.56655 11.7102 8.36242 11.7751 8.13823L11.8401 7.91366C11.8843 7.76078 12.0441 7.67272 12.197 7.71694C12.2437 7.73046 12.2862 7.75559 12.3206 7.78999C12.355 7.82439 12.3801 7.86693 12.3937 7.91366L12.4587 8.13823C12.5235 8.36242 12.6441 8.56655 12.8091 8.73158C12.9742 8.89661 13.1783 9.01718 13.4025 9.08206L13.6271 9.14704C13.7799 9.19129 13.868 9.35108 13.8238 9.50394C13.8102 9.55067 13.7851 9.59321 13.7507 9.62761C13.7163 9.662 13.6738 9.68713 13.6271 9.70065L13.4025 9.76564C13.1783 9.83051 12.9742 9.95108 12.8091 10.1161C12.6441 10.2811 12.5235 10.4853 12.4587 10.7095ZM8.73493 13.6947L8.66994 13.9193C8.6257 14.0722 8.46591 14.1602 8.31305 14.116C8.26632 14.1025 8.22378 14.0774 8.18938 14.043C8.15498 14.0086 8.12986 13.966 8.11634 13.9193L8.05135 13.6947C7.98647 13.4705 7.8659 13.2664 7.70087 13.1014C7.53584 12.9363 7.33171 12.8158 7.10752 12.7509L6.88295 12.6859C6.73007 12.6417 6.64201 12.4819 6.68624 12.329C6.69976 12.2823 6.72489 12.2397 6.75928 12.2054C6.79368 12.171 6.83622 12.1458 6.88295 12.1323L7.10752 12.0673C7.33171 12.0024 7.53584 11.8819 7.70087 11.7168C7.8659 11.5518 7.98647 11.3477 8.05135 11.1235L8.11634 10.8989C8.16058 10.746 8.32037 10.658 8.47323 10.7022C8.51996 10.7157 8.5625 10.7409 8.5969 10.7753C8.6313 10.8097 8.65642 10.8522 8.66994 10.8989L8.73493 11.1235C8.7998 11.3477 8.92037 11.5518 9.08541 11.7168C9.25044 11.8819 9.45456 12.0024 9.67876 12.0673L9.90333 12.1323C10.0562 12.1766 10.1443 12.3363 10.1 12.4892C10.0865 12.5359 10.0614 12.5785 10.027 12.6129C9.9926 12.6473 9.95006 12.6724 9.90333 12.6859L9.67876 12.7509C9.45456 12.8158 9.25044 12.9363 9.08541 13.1014C8.92037 13.2664 8.7998 13.4705 8.73493 13.6947Z",fill:"currentColor"})]}),()=>m.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[m.jsx("path",{d:"M12.2 1.69995H3.8C3.2201 1.69995 2.75 2.17467 2.75 2.76025V13.3632C2.75 13.3754 2.75021 13.3875 2.75061 13.3996C2.76856 13.9361 3.21367 14.2996 3.68722 14.2996C3.86807 14.2996 4.05311 14.2465 4.22003 14.1298L7.39764 11.9084C7.5726 11.7858 7.78102 11.72 7.99466 11.7198C8.2083 11.7197 8.4168 11.7853 8.59191 11.9077L11.7803 14.1308C11.9471 14.2471 12.1318 14.3 12.3124 14.3C12.7861 14.3 13.2314 13.9362 13.2494 13.3996C13.2498 13.3875 13.25 13.3754 13.25 13.3632V2.76025C13.25 2.17467 12.7799 1.69995 12.2 1.69995ZM12.2 13.1434L9.19248 11.0464C8.83927 10.8001 8.42531 10.6699 7.99537 10.6699C7.56449 10.6698 7.14976 10.8005 6.79602 11.0478L3.8 13.1423V2.76025C3.8 2.75802 3.8 2.75322 3.80289 2.74995H12.1971C12.2 2.75322 12.2 2.75801 12.2 2.76025V13.1434Z",fill:"currentColor"}),m.jsx("path",{d:"M10.4117 6.27223H8.52499V4.36187C8.52499 4.07192 8.28994 3.83687 7.99999 3.83687C7.71004 3.83687 7.47499 4.07192 7.47499 4.36187V6.27223H5.58828C5.29833 6.27223 5.06328 6.50728 5.06328 6.79723V6.80751C5.06328 7.09746 5.29833 7.33251 5.58828 7.33251H7.47499V9.24287C7.47499 9.53282 7.71004 9.76787 7.99999 9.76787C8.28994 9.76787 8.52499 9.53282 8.52499 9.24287V7.33251H10.4117C10.7017 7.33251 10.9367 7.09746 10.9367 6.80751V6.79723C10.9367 6.50728 10.7017 6.27223 10.4117 6.27223Z",fill:"currentColor"})]}),()=>m.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[m.jsx("path",{d:"M11.8231 2.3562H4.19204C3.60373 2.36812 3.04399 2.61212 2.63483 3.03501C2.22567 3.4579 2.00026 4.02539 2.00775 4.61377V9.14983C2.00026 9.73821 2.22567 10.3057 2.63483 10.7286C3.04399 11.1515 3.60373 11.3955 4.19204 11.4074H11.8231C12.4114 11.3955 12.9711 11.1515 13.3803 10.7286C13.7895 10.3057 14.0149 9.73821 14.0074 9.14983V4.61377C14.0149 4.02539 13.7895 3.4579 13.3803 3.03501C12.9711 2.61212 12.4114 2.36812 11.8231 2.3562ZM12.9152 9.12192C12.9176 9.26764 12.8911 9.41238 12.8375 9.54789C12.7839 9.6834 12.704 9.80701 12.6026 9.91167C12.5012 10.0163 12.3802 10.1 12.2464 10.1579C12.1127 10.2157 11.9688 10.2467 11.8231 10.249H4.19204C3.89804 10.2434 3.61817 10.1218 3.41354 9.91067C3.20891 9.6995 3.09616 9.41594 3.09989 9.12192V4.61377C3.09759 4.46822 3.12403 4.32364 3.17771 4.18833C3.23139 4.05303 3.31126 3.92964 3.41272 3.82526C3.51418 3.72088 3.63525 3.63756 3.76898 3.58006C3.90272 3.52257 4.04648 3.49204 4.19204 3.49022H11.8231C12.1165 3.49572 12.3958 3.61686 12.6004 3.82727C12.8049 4.03768 12.9181 4.32034 12.9152 4.61377V9.12192Z",fill:"currentColor"}),m.jsx("path",{d:"M11.0091 13.6431H5.01099C4.862 13.6431 4.71911 13.5839 4.61376 13.4785C4.50841 13.3732 4.44922 13.2303 4.44922 13.0813C4.44922 12.9323 4.50841 12.7894 4.61376 12.6841C4.71911 12.5787 4.862 12.5195 5.01099 12.5195H11.0091C11.1581 12.5195 11.3009 12.5787 11.4063 12.6841C11.5117 12.7894 11.5708 12.9323 11.5708 13.0813C11.5708 13.2303 11.5117 13.3732 11.4063 13.4785C11.3009 13.5839 11.1581 13.6431 11.0091 13.6431Z",fill:"currentColor"})]})],v4=()=>m.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[m.jsx("path",{d:"M14.365 4.88313C13.9832 4.88313 13.7286 5.13768 13.7286 5.51949V12.9649C13.7286 13.4104 13.4104 13.7286 12.965 13.7286H3.03771C2.59225 13.7286 2.27407 13.4104 2.27407 12.9649V3.03768C2.27407 2.59222 2.59225 2.27404 3.03771 2.27404H6.66498C7.0468 2.27404 7.30134 2.01949 7.30134 1.63768C7.30134 1.25586 7.0468 1.00131 6.66498 1.00131H3.03771C1.89225 1.00131 1.00134 1.89222 1.00134 3.03768V12.9649C1.00134 14.1104 1.89225 15.0013 3.03771 15.0013H12.965C14.1104 15.0013 15.0013 14.1104 15.0013 12.9649V5.51949C15.0013 5.20131 14.7468 4.88313 14.365 4.88313Z",fill:"#666666"}),m.jsx("path",{d:"M5.2637 7.55586C5.00916 7.30131 4.62734 7.30131 4.37279 7.55586C4.11825 7.8104 4.11825 8.19222 4.37279 8.44677L7.55461 11.6286C7.61825 11.6922 7.68188 11.7559 7.74552 11.7559C7.80916 11.8195 7.93643 11.8195 8.00007 11.8195C8.0637 11.8195 8.19098 11.8195 8.25461 11.7559C8.31825 11.6922 8.38188 11.6922 8.44552 11.6286L11.6273 8.44677C11.8819 8.19222 11.8819 7.8104 11.6273 7.55586C11.3728 7.30131 10.991 7.30131 10.7364 7.55586L8.63643 9.65586V8.00131C8.63643 4.81949 11.1819 2.27404 14.3637 2.27404C14.7455 2.27404 15.0001 2.01949 15.0001 1.63768C15.0001 1.25586 14.7455 1.00131 14.3637 1.00131C10.4819 1.00131 7.3637 4.11949 7.3637 8.00131V9.65586L5.2637 7.55586Z",fill:"#666666"})]}),y4=()=>m.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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"})}),E4=()=>m.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[m.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"}),m.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"})]}),T4=()=>m.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[m.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"}),m.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"}),m.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"})]}),C4=()=>m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:m.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"})}),S4=()=>m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:m.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"})}),x4=()=>m.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:m.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"})}),k4=({code:e})=>{const{message:t}=ue.App.useApp(),[n,l]=y.useState(!1),r=async a=>{a.stopPropagation();try{await navigator.clipboard.writeText(e),l(!0),window.setTimeout(()=>l(!1),2e3)}catch{t.error("复制失败")}};return m.jsxs("div",{className:"rte-skill-share",onClick:a=>a.stopPropagation(),children:[m.jsxs("div",{className:"rte-skill-share-head",children:[m.jsxs("div",{className:"rte-skill-share-title",children:[m.jsx(x4,{}),m.jsx("span",{children:"分享码"})]}),m.jsx("span",{className:"rte-skill-share-hint",children:"复制后粘贴在「导入技能」即可使用"})]}),m.jsxs("div",{className:"rte-skill-share-box",children:[m.jsx("span",{className:"rte-skill-share-code",children:e}),m.jsxs("button",{type:"button",className:`rte-skill-share-copy${n?" rte-skill-share-copy-done":""}`,onClick:r,children:[n?m.jsx(S4,{}):m.jsx(C4,{}),m.jsx("span",{children:n?"已复制":"复制"})]})]})]})},A4=({card:e,selected:t,onClick:n,onShare:l,onEdit:r,onDelete:a,onUse:i,getPopupContainer:s})=>{const o=_=>_.stopPropagation(),[u,c,d]=lb(),[f,h,b]=lb("height"),[v,g]=y.useState(!1),[T,N]=y.useState(""),[k,M]=y.useState(!1),O=v||k,S=async _=>{if(g(_),!_){N("");return}try{const I=await l();N(typeof I=="string"&&I?I:`SK-${e.id}`)}catch{N(`SK-${e.id}`)}};return m.jsxs("div",{className:`rte-skill-card${t?" rte-skill-card-selected":""}${O?" rte-skill-card-pinned":""}`,onClick:n,"data-rte-skill-card":"true","aria-pressed":t,children:[m.jsxs("div",{className:"rte-skill-card-header",children:[m.jsx(hl,{title:c?e.title:"",placement:"top",mouseEnterDelay:.3,getPopupContainer:s,zIndex:1e4,children:m.jsx("div",{className:"rte-skill-card-title",ref:u,onMouseEnter:d,children:e.title})}),m.jsxs("div",{className:`rte-skill-card-aside${O?" rte-skill-card-aside-pinned":""}`,children:[m.jsx("span",{className:`rte-skill-card-badge rte-skill-card-badge-${e.badge}`,children:h4[e.badge]}),m.jsxs("div",{className:`rte-skill-card-actions${O?" rte-skill-card-actions-pinned":""}`,children:[e.badge==="mine"&&m.jsx(ue.Popover,{open:v,onOpenChange:S,trigger:"click",placement:"bottomRight",arrow:!1,overlayClassName:"rte-skill-share-popover",zIndex:1e4,getPopupContainer:s,content:m.jsx(k4,{code:T}),children:m.jsx("button",{type:"button",className:`rte-skill-card-action${v?" rte-skill-card-action-active":""}`,title:"分享","aria-label":"分享",onClick:o,children:m.jsx(y4,{})})}),e.badge==="mine"&&m.jsx("button",{type:"button",className:"rte-skill-card-action",title:"编辑","aria-label":"编辑",onClick:_=>{o(_),r()},children:m.jsx(E4,{})}),e.badge!=="mine"&&m.jsx("button",{type:"button",className:"rte-skill-card-action",title:"查看详情","aria-label":"查看详情",onClick:_=>{o(_),r()},children:m.jsx("i",{className:"iconfont icon-chakanjinengxiangqing"})}),e.badge!=="system"&&m.jsx(ue.Popconfirm,{title:"删除技能后不可恢复,确认删除吗?",open:k,onOpenChange:M,okText:"确认",cancelText:"取消",placement:"bottomRight",arrow:!1,overlayClassName:"rte-skill-delete-confirm",zIndex:1e4,icon:m.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:m.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:_=>{_?.stopPropagation(),M(!1),a()},onCancel:_=>{_?.stopPropagation(),M(!1)},children:m.jsx("button",{type:"button",className:`rte-skill-card-action rte-skill-card-action-delete${k?" rte-skill-card-action-active":""}`,title:"删除","aria-label":"删除",onClick:o,children:m.jsx(T4,{})})})]})]})]}),m.jsx(hl,{title:h?e.desc:"",placement:"top",mouseEnterDelay:.3,getPopupContainer:s,zIndex:1e4,children:m.jsx("div",{className:"rte-skill-card-desc",ref:f,onMouseEnter:b,children:e.desc})})]})},rb=y.memo(({selectedId:e,onSelect:t,onCardClick:n,onAction:l,skillListFetch:r,onHeaderAction:a,showCreateSkill:i=!0,createDisabled:s})=>{const{message:o}=ue.App.useApp(),[u,c]=y.useState(0),[d,f]=y.useState(r?[]:p4),[h,b]=y.useState(!1),[v,g]=y.useState(!!r),T=y.useRef(0),N=y.useCallback(()=>{g(!0),T.current=window.setTimeout(()=>{g(!1),b(!0)},300)},[]),k=y.useCallback(()=>{window.clearTimeout(T.current),g(!1),b(!1)},[]),[M,O]=y.useState(""),[S,_]=y.useState(""),I=Al(),A=I?()=>I:void 0,R=y.useRef(0),L=y.useRef(null),H=y.useRef(0),$=y.useRef(0),B=y.useCallback(()=>{const C=L.current;C&&(C.classList.add("is-scrolling"),window.clearTimeout($.current),$.current=window.setTimeout(()=>{C.classList.remove("is-scrolling")},300))},[]);y.useEffect(()=>{const C=window.setTimeout(()=>_(M.trim()),300);return()=>window.clearTimeout(C)},[M]);const E=y.useCallback(async()=>{if(!r)return;const C=++R.current;N();try{const ne=await r({skillType:d4[u],pageIndex:1,pageSize:f4,keyword:S||void 0});if(C!==R.current)return;f(ne.map(b4))}catch{C===R.current&&o.error("技能列表加载失败")}finally{C===R.current&&k()}},[r,u,S,N,k]);y.useEffect(()=>{E()},[E]),y.useEffect(()=>{L.current?.scrollTo({top:0})},[u,S]);const[F,V]=y.useState(!1);y.useLayoutEffect(()=>{if(u===0&&!h&&d.length>0){const C=L.current;C&&(H.current=C.clientHeight),V(!1)}else!h&&d.length>0&&H.current>0?requestAnimationFrame(()=>{const C=L.current;C&&V(C.scrollHeight<H.current)}):V(!1)},[u,h,d]);const q=C=>{n?.({id:C.id,title:C.title}),t?.({id:C.id,title:C.title,desc:C.desc||void 0,usageInstruction:C.usageInstruction})},G=async C=>{try{await l?.("delete",{id:C.id,title:C.title})}catch{o.error("删除失败");return}e===C.id&&t?.(null),r?await E():f(ne=>ne.filter(ie=>ie.id!==C.id)),o.success("已删除技能")};return m.jsxs("div",{className:"rte-skill-panel",children:[m.jsxs("div",{className:"rte-skill-panel-header",children:[m.jsxs("div",{className:"rte-skill-search",children:[m.jsx("input",{className:"rte-skill-search-input",placeholder:"请输入想搜索的技能名称或描述",value:M,onChange:C=>O(C.target.value)}),m.jsx("span",{className:"rte-skill-search-icon",children:m.jsx(m4,{})})]}),m.jsxs("div",{className:"rte-skill-actions",children:[m.jsxs("button",{type:"button",className:"rte-skill-import-btn",onClick:()=>a?.("import"),children:[m.jsx(v4,{}),m.jsx("span",{children:"导入技能"})]}),i&&m.jsxs("button",{type:"button",className:`rte-skill-create-btn${s?" rte-skill-create-btn-disabled":""}`,disabled:s,onClick:()=>!s&&a?.("create"),children:[m.jsx("i",{className:"iconfont icon-jiyudangqianduihuachuangjianjineng"}),m.jsx("span",{children:"基于当前会话创建技能"})]})]})]}),m.jsxs("div",{className:"rte-skill-panel-body",children:[m.jsx("div",{className:"rte-skill-sidebar",children:c4.map((C,ne)=>{const ie=g4[ne];return m.jsxs("div",{className:`rte-skill-sidebar-item${ne===u?" rte-skill-sidebar-item-active":""}`,onClick:()=>c(ne),children:[m.jsx(ie,{}),m.jsx("span",{children:C})]},C)})}),h?m.jsx("div",{className:"rte-skill-cards-status",style:H.current?{minHeight:H.current}:void 0,children:m.jsx(ue.Spin,{})}):d.length===0?m.jsx("div",{className:"rte-skill-cards-status",style:H.current?{minHeight:H.current}:void 0,children:!v&&m.jsxs(m.Fragment,{children:[m.jsx("img",{className:"rte-skill-empty-img",src:"https://sealseek-public-read.oss-cn-hangzhou.aliyuncs.com/file/website/kongzhuangtai.svg",alt:"暂无数据"}),m.jsx("span",{className:"rte-skill-empty-text",children:"暂无技能"})]})}):m.jsxs("div",{className:"rte-skill-cards",ref:L,onScroll:B,style:u!==0&&H.current?{minHeight:H.current}:void 0,children:[d.map(C=>m.jsx(A4,{card:C,selected:e===C.id,onClick:()=>q(C),onShare:()=>l?.("share",{id:C.id,title:C.title}),onEdit:()=>l?.("edit",{id:C.id,title:C.title}),onDelete:()=>G(C),onUse:()=>t?.({id:C.id,title:C.title,desc:C.desc||void 0,usageInstruction:C.usageInstruction}),getPopupContainer:A},C.id)),F&&m.jsx("div",{className:"rte-skill-cards-end",children:"暂无更多技能~"})]})]})]})});rb.displayName="SkillPanel";const fi=4,N4=()=>m.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:m.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"})}),ab=y.memo(({disabled:e,selectedSkill:t,onSkillSelect:n,onSkillCardClick:l,onSkillAction:r,skillListFetch:a,onSkillHeaderAction:i,showCreateSkill:s,skillPanelOpen:o,onSkillPanelOpenChange:u,createDisabled:c,skillPanelOpenDelay:d})=>{const[f,h]=y.useState(!1),b=o!==void 0,[v,g]=y.useState(o??!1),T=y.useRef(0);y.useEffect(()=>{if(b)return o?d&&d>0?T.current=window.setTimeout(()=>g(!0),d):g(!0):(window.clearTimeout(T.current),g(!1)),()=>window.clearTimeout(T.current)},[b,o,d]);const N=b?v:f,k=y.useCallback(E=>{const F=typeof E=="function"?E(N):E;b||h(F),u?.(F)},[b,N,u]),[M,O]=y.useState(null),S=y.useRef(null),_=y.useRef(null),I=Al(),A=y.useCallback(()=>(S.current?.closest(".rich-text-editor")??S.current)?.getBoundingClientRect()??null,[]),R=y.useCallback(()=>{const E=A();if(!E)return;const F=Math.max(0,window.innerHeight-E.bottom-fi*2),V=Math.max(0,E.top-fi*2),G=(_.current?.scrollHeight??0)>F&&V>F,C=G?V:F,ie=(_.current?.offsetParent??I)?.getBoundingClientRect(),P=ie?.left??0,fe=ie?.top??0,Ee=E.left-P;if(G){const ce=(ie?.height??window.innerHeight)-(E.top-fi-fe);O({left:Ee,bottom:ce,width:E.width,maxHeight:C})}else O({left:Ee,top:E.bottom+fi-fe,width:E.width,maxHeight:C})},[A,I]);y.useLayoutEffect(()=>{if(!N)return;R();const E=requestAnimationFrame(R);window.addEventListener("scroll",R,!0),window.addEventListener("resize",R);const F=_.current?new ResizeObserver(R):null;F&&_.current&&F.observe(_.current);const V=S.current?.closest(".rich-text-editor"),q=V?new ResizeObserver(R):null;return q&&V&&q.observe(V),()=>{cancelAnimationFrame(E),window.removeEventListener("scroll",R,!0),window.removeEventListener("resize",R),F?.disconnect(),q?.disconnect()}},[N,R]),y.useEffect(()=>{if(!N||b)return;const E=F=>{const V=F.target;S.current?.contains(V)||_.current?.contains(V)||V instanceof Element&&V.closest(".rte-skill-delete-confirm, .rte-skill-share-popover")||k(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[N,b]);const L=y.useCallback(()=>{e||k(E=>!E)},[e]),H=y.useCallback(E=>{n?.(E),E&&k(!1)},[n]),$=!!t,B=`rte-skill-badge${$?" rte-skill-badge-selected":N?" rte-skill-badge-active":""}`;return m.jsxs(m.Fragment,{children:[m.jsxs("div",{ref:S,className:B,onClick:L,"data-rte-skill-button":"true","aria-pressed":N||$,style:{cursor:e?"not-allowed":"pointer"},children:[m.jsx(N4,{}),m.jsx("span",{className:"rte-skill-text",children:"技能"})]}),N&&Si.createPortal(m.jsx("div",{ref:_,className:"rte-skill-panel-popup","data-placement":M?.bottom!==void 0?"top":"bottom",style:{position:"fixed",left:M?.left??0,top:M?.top,bottom:M?.bottom,width:M?.width,zIndex:9999,maxHeight:M?.maxHeight,display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:16,visibility:M?"visible":"hidden"},children:m.jsx(rb,{selectedId:t?.id??null,onSelect:H,onCardClick:l,onAction:r,skillListFetch:a,onHeaderAction:i,showCreateSkill:s,createDisabled:c})}),I??document.body)]})});ab.displayName="SkillButton";const w4=10*1024*1024,_4=50*1024*1024,I4="图片大小不能超过 10MB",O4="文件总大小不能超过 50MB",M4=e=>e.type?.startsWith("image/")||/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(e.name||""),D4=(e,t)=>{let n=!1;const l=t.filter(o=>M4(o)&&o.size>w4?(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>_4){s=!0;break}a.push(o),i+=o.size}return{accepted:a,imageOversize:n,totalExceeded:s}},ib=y.memo(({files:e,onChange:t,disabled:n})=>{const{message:l}=ue.App.useApp(),r=y.useRef(null),a=y.useCallback(s=>{const o=Array.from(s.target.files??[]);if(s.target.value="",o.length===0)return;const{accepted:u,imageOversize:c,totalExceeded:d}=D4(e,o);c&&l.error(I4),d&&l.error(O4),u.length>0&&t([...e,...u])},[e,t,l]),i=y.useCallback(()=>{n||r.current?.click()},[n]);return m.jsxs("div",{className:"rte-footer-upload",children:[m.jsx("div",{className:"rte-footer-upload-btn",onClick:i,title:"上传文件",style:{cursor:n?"not-allowed":"pointer",opacity:n?.6:1,pointerEvents:n?"none":"auto"},children:m.jsx("i",{className:"iconfont icon-lianjie",style:{fontSize:"16px"}})}),m.jsx("input",{ref:r,type:"file",multiple:!0,style:{display:"none"},onChange:a})]})});ib.displayName="UploadButton";const sb=y.memo(({onClick:e,loading:t,disabled:n})=>m.jsx("button",{type:"button",className:"rich-text-editor-send-button","data-testid":"rte-send-button",onClick:e,disabled:n||t,children:t?m.jsx("span",{className:"rte-send-spinner"}):m.jsx("i",{className:"iconfont icon-fasong"})}));sb.displayName="SendButton";const ob=y.memo(({currentAgent:e})=>{const t=e?.points;return t==null?null:m.jsxs("div",{className:"rte-points-badge",style:{position:"relative"},children:[m.jsx("i",{className:"iconfont icon-jifen",style:{marginRight:"4px",fontSize:"16px"}}),m.jsxs("span",{style:{fontSize:"16px",lineHeight:"22px"},children:["-",String(t)]}),e?.labelValue===2&&m.jsx("div",{className:"rte-limited-free-badge",children:m.jsx("span",{className:"rte-limited-free-text",children:"限时免费"})})]})});ob.displayName="PointsBadge";const ub=y.memo(({isProcessing:e,loading:t,disabled:n,sendDisabled:l,showFooterUpload:r=!0,footerFiles:a,onFooterFilesChange:i,agentOptions:s,onAgentSelect:o,onAgentDropdownOpenChange:u,hideAgentButton:c,currentAgent:d,selectedSkill:f,onSkillSelect:h,onSkillCardClick:b,onSkillAction:v,skillListFetch:g,onSkillHeaderAction:T,showCreateSkill:N,createDisabled:k,skillPanelOpen:M,onSkillPanelOpenChange:O,skillPanelOpenDelay:S,onSend:_,padding:I="12px 16px"})=>{const A=y.useCallback(R=>{if(R.reduce(($,B)=>$+B.size,0)>52428800){const $=[];let B=0;for(const E of R){if(B+E.size>52428800)break;$.push(E),B+=E.size}i($)}else i(R)},[i]);return m.jsxs("div",{className:"rich-text-editor-footer",style:{padding:I},children:[m.jsxs("div",{className:"rich-text-editor-footer-left",children:[m.jsxs("div",{className:"rich-text-editor-brand",children:[!c&&s&&s.length>0&&m.jsx(nb,{options:s,onSelect:o,disabled:n||e,currentAgent:d,onOpenChange:u}),m.jsx(ab,{disabled:n||e,selectedSkill:f,onSkillSelect:h,onSkillCardClick:b,onSkillAction:v,skillListFetch:g,onSkillHeaderAction:T,showCreateSkill:N,createDisabled:k,skillPanelOpen:M,onSkillPanelOpenChange:O,skillPanelOpenDelay:S})]}),r&&m.jsx(ib,{files:a,onChange:A,disabled:n||e})]}),m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[m.jsxs("div",{className:"rte-brand-badge",children:[m.jsx("div",{className:"rte-brand-badge",children:m.jsx("img",{src:"https://oospublic.sealseek.cn/file/website/ball.png",alt:""})}),m.jsx("span",{className:"rte-brand-text",style:{marginLeft:"4px"},children:"SealSeek 2.0"})]}),m.jsx(ob,{currentAgent:d}),m.jsx(sb,{onClick:_,loading:t||e,disabled:n||l})]})]})});ub.displayName="Footer";const L4=e=>e<1024?`${e}B`:e<1024*1024?`${Math.round(e/1024)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`,P4=e=>(e.type?.startsWith("image/")??!1)||/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(e.name||""),B4=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"},R4=({file:e,onRemove:t})=>{const n=P4(e),l=Af(n?e:null);return m.jsxs("div",{className:"rte-footer-file-chip",children:[n?m.jsx(ue.Image,{className:"rte-footer-file-thumb",width:32,height:32,src:l,alt:e.name,preview:!1}):m.jsx("div",{className:"rte-footer-file-icon",children:m.jsx("svg",{style:{width:"18px",height:"18px"},"aria-hidden":"true",children:m.jsx("use",{xlinkHref:`#${B4(e.name)}`})})}),m.jsxs("div",{className:"rte-footer-file-info",children:[m.jsx("span",{className:"rte-footer-file-name",title:e.name,children:e.name}),m.jsx("span",{className:"rte-footer-file-size",children:L4(e.size)})]}),m.jsx("span",{className:"rte-footer-file-remove",onClick:r=>{r.stopPropagation(),t()},children:m.jsx("i",{className:"iconfont icon-guanbi",style:{width:"8px",height:"8px",fontSize:"8px",display:"flex",alignItems:"center"}})})]})},cb=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:m.jsxs("div",{className:"rte-footer-files-wrapper",children:[l.showLeft&&m.jsx("div",{className:"rte-footer-files-mask rte-footer-files-mask-left",children:m.jsx("span",{className:"rte-footer-files-arrow rte-footer-files-arrow-left",onClick:()=>i(-1),children:m.jsx("svg",{style:{width:"16px",height:"16px",transform:"rotate(180deg)"},"aria-hidden":"true",children:m.jsx("use",{xlinkHref:"#icon-fanhuijiantou"})})})}),m.jsx("div",{className:"rte-footer-files-list",ref:n,onScroll:a,children:e.map((o,u)=>m.jsx(R4,{file:o,onRemove:s(u)},`${o.name}-${o.size}-${u}`))}),l.showRight&&m.jsx("div",{className:"rte-footer-files-mask rte-footer-files-mask-right",children:m.jsx("span",{className:"rte-footer-files-arrow rte-footer-files-arrow-right",onClick:()=>i(1),children:m.jsx("svg",{style:{width:"16px",height:"16px"},"aria-hidden":"true",children:m.jsx("use",{xlinkHref:"#icon-fanhuijiantou"})})})})]})});cb.displayName="FooterFilesList";const db=9999,F4=({messageRef:e})=>{const{message:t}=ue.App.useApp();return e.current=t,null},fb=y.memo(({title:e,onClose:t})=>m.jsx("span",{className:"tag-node group",contentEditable:!1,children:m.jsx("span",{className:"tag-label","data-tag-clickable":"true",onMouseDown:n=>{n.preventDefault(),n.stopPropagation()},onClick:n=>{n.preventDefault(),n.stopPropagation(),t()},children:e})}));fb.displayName="SkillTag";const hb=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:b,editorMinHeight:v,editorPadding:g,className:T,videoUrlParse:N,videoUpload:k,reportAnalyze:M,reportListFetch:O,onReportGoGenerate:S,reportNameResolve:_,onViewReport:I,hideCurrentSessionReport:A,markdownAnalyze:R,markdownNameAnalyze:L,agentOptions:H,onAgentSelect:$,onAgentExit:B,onSkillAction:E,onSkillCardClick:F,onSkillHeaderAction:V,skillListFetch:q,showCreateSkill:G,createDisabled:C,skillPanelOpen:ne,onSkillPanelOpenChange:ie,skillPanelOpenDelay:P,selectedSkill:fe,onSkillSelect:Ee,loading:Se,hideButtons:ce,footerPadding:xe,showFooterUpload:De,lockStructure:Ae=!0,collapsed:Me=!1,onCollapsedChange:Ft,collapseTransitionMs:ft=260,nodeDefaults:ql,onExpandedHeightChange:Rn,collapsedTotalHeight:ke,toggleOnBlankClick:Fe=!0,getPopupContainer:un,scrollContainerRef:Fn,autoCollapseOnScroll:Wl}=e,[Et,Hn]=y.useState({}),[wt,hi]=y.useState({}),[st,Y]=y.useState(u??[]),[J,be]=y.useState({}),[ve,Oe]=y.useState(o4),[Tt,en]=y.useState(()=>new Set),[Ht,$t]=y.useState({}),[_t,ht]=y.useState(null),Un=y.useCallback(()=>un?.()??_t??document.body,[un,_t]),It=y.useRef(null),[pi,J4]=y.useState(null),Z4=y.useCallback((z,re)=>{J4(re?z:null)},[]),ul=y.useRef(null),[ew,tw]=y.useState(58),[cl,Cb]=y.useState(58),[Jo,Sb]=y.useState(!1),xb=y.useRef(0),kb=y.useRef(Me),[bi,Ab]=y.useState(!1);kb.current!==Me&&(kb.current=Me,xb.current=(typeof performance<"u"?performance.now():Date.now())+ft,Ab(!0)),y.useEffect(()=>{if(!bi)return;const z=setTimeout(()=>Ab(!1),ft);return()=>clearTimeout(z)},[bi,Me,ft]);const[dl,Nb]=y.useState(""),Yr=y.useRef(null),wb=y.useRef(null),[Zo,_b]=y.useState(0),[eu,Ib]=y.useState(0),tu=y.useRef(!1);y.useEffect(()=>{if(!u||u.length===st.length&&u.every((ee,te)=>{const Z=st[te];return Z&&ee.name===Z.name&&ee.size===Z.size&&ee.lastModified===Z.lastModified}))return;const re=50*1024*1024;if(u.reduce((ee,te)=>ee+te.size,0)>re){const ee=[];let te=0;for(const Z of u){if(te+Z.size>re)break;ee.push(Z),te+=Z.size}Y(ee)}else tu.current=!0,Y(u)},[u]);const Ct=y.useMemo(()=>s4(t,ve,Tt),[t,ve,Tt]),nu=y.useRef(null),Ob=y.useRef(!1);y.useEffect(()=>{const z=t.find(re=>re.type==="tag")?.text??null;if(!Ob.current){Ob.current=!0,nu.current=z;return}nu.current!==z&&(nu.current=z,Y(re=>re.length===0?re:[]))},[t]);const jr=y.useMemo(()=>{const z=t.find(re=>re.type==="tag")?.text;if(!(!z||!H))return H.find(re=>re.label===z)},[t,H]),nw=y.useMemo(()=>t.some(z=>z.type==="tag"),[t]),lw=G??!nw;jN(i,Et,Hn,Ct,wt,hi);const Gr=y.useRef(new Map),Mb=y.useRef(""),Db=(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("|");Mb.current!==Db&&(Mb.current=Db,Gr.current=new Map);const[pt,mi]=y.useState(null);y.useEffect(()=>{fe!==void 0&&mi(fe)},[fe]);const Lb=y.useCallback(z=>{mi(z),Ee?.(z),z&&jr&&B?.("skill-switch")},[jr,B,Ee]),rw=y.useCallback(z=>{mi(null),$?.(z)},[$]);y.useEffect(()=>{jr&&mi(null)},[jr]);const{errors:aw,validate:Pb,clearError:Bb}=QN(Ct),{excludedKeys:Yl,hideSeparator:Rb}=ZN(Ct,Et,wt),{analyzeReport:gi,analyzeMarkdown:Fb,analyzeMarkdownName:Hb,resolveReportName:vi}=e4({reportAnalyze:M,markdownAnalyze:R,markdownNameAnalyze:L,reportNameResolve:_}),Ub=z=>typeof z!="string"?!z:z.replace(/<[^>]*>/g,"").replace(/&nbsp;/gi,"").replace(/\s/g,"").replace(/[​‌‍]/g,"").trim()==="",lu=y.useCallback((z,re)=>{Hn(ee=>({...ee,[z]:re})),Bb(z);const oe=/^(.+)__module_\d+$/.exec(z);if(oe&&Ub(re)){const ee=oe[1];Ct.find(Z=>Z.key===ee&&Z.type==="markdown-module")&&Hn(Z=>{const he={...Z,[z]:re};return Object.keys(he).filter(Te=>Te.startsWith(`${ee}__module_`)).every(Te=>Ub(he[Te]))&&(Oe(Te=>{if(!Te.markdownModules[ee])return Te;const Le={...Te.markdownModules};return delete Le[ee],{...Te,markdownModules:Le}}),Object.keys(he).filter(Te=>Te.startsWith(`${ee}__module_`)).forEach(Te=>delete he[Te]),he[ee]=""),he});return}if(typeof re=="string"&&re.trim()===""){const ee=Ct.find(te=>te.key===z);ee?.type==="report-url"?(Oe(te=>{if(!te.reportModules[z])return te;const Z={...te.reportModules};return delete Z[z],{...te,reportModules:Z}}),$t(te=>{if(!(z in te))return te;const Z={...te};return delete Z[z],Z})):(ee?.type==="markdown"||ee?.type==="markdown-name")&&Oe(te=>{if(!te.markdownModules[z])return te;const Z={...te.markdownModules};return delete Z[z],{...te,markdownModules:Z}})}},[Bb,Ct]),iw=y.useCallback((z,re)=>{hi(oe=>({...oe,[z]:re}))},[]),sw=y.useCallback((z,re)=>be(oe=>({...oe,[z]:re})),[]),ow=y.useCallback(z=>{$t(re=>{if(!(z in re))return re;const oe=z.match(/^(.+)_(\d+)$/);if(!oe){const Ne={...re};return delete Ne[z],Ne}const[,ee,te]=oe,Z=parseInt(te,10),he={};for(const[Ne,Te]of Object.entries(re)){if(Ne===z)continue;const Le=Ne.match(/^(.+)_(\d+)$/);if(Le&&Le[1]===ee){const Ot=parseInt(Le[2],10);Ot>Z?he[`${ee}_${Ot-1}`]=Te:he[Ne]=Te}else he[Ne]=Te}return he})},[]),uw=y.useCallback((z,re)=>{$t(oe=>{const ee=`${z}_`,te=[];for(const he of Object.keys(oe)){if(!he.startsWith(ee))continue;const Ne=he.slice(ee.length);/^\d+$/.test(Ne)&&te.push([Number(Ne),oe[he]])}if(te.length===0)return oe;const Z={...oe};for(const[he]of te)delete Z[`${z}_${he}`];for(const[he,Ne]of te){if(he===re)continue;const Te=he>re?he-1:he;Z[`${z}_${Te}`]=Ne}return Z})},[]),ru=y.useCallback(async(z,re,oe)=>{const ee=await vi(z,re,oe);return ee.status==="success"&&$t(te=>({...te,[z]:ee.name})),ee},[vi]),cw=y.useCallback((z,re)=>{gi(z,re).then(oe=>{oe.status==="success"&&Oe(ee=>({...ee,reportModules:{...ee.reportModules,[z]:oe.modules}}))})},[gi]),au=y.useCallback(async(z,re)=>{vi(z,re,"report-url").then(ee=>{ee.status==="success"&&$t(te=>({...te,[z]:ee.name}))});const oe=await gi(z,re);oe.status==="success"?(Oe(ee=>({...ee,reportModules:{...ee.reportModules,[z]:oe.modules}})),Hn(ee=>{const te={...ee};return oe.modules.forEach((Z,he)=>{te[`${z}__module_${he}`]=Z.content}),te})):oe.status==="failed"&&(lu(z,""),Hn(ee=>{let te=!1;const Z={...ee};for(const he of Object.keys(Z))he.startsWith(`${z}__module_`)&&(delete Z[he],te=!0);return te?Z:ee}))},[gi,vi,lu]);y.useEffect(()=>{if(!i||t.length===0)return;const z=t.filter(oe=>oe.type==="report-url"&&oe.key),re=t.filter(oe=>oe.type==="multi-variable-select"&&oe.key);if(!(z.length===0&&re.length===0)){for(const oe of z){const ee=oe.key,te=i[ee]??i[`${ee}__url`];if(!te||typeof te=="string"&&!te.trim())continue;const Z=Array.isArray(te)?String(te[0]??""):String(te);Z&&Gr.current.get(ee)!==Z&&(Gr.current.set(ee,Z),setTimeout(()=>{au(ee,Z)},100))}for(const oe of re){const ee=oe.key,te=i[ee];!Array.isArray(te)||te.length===0||te.forEach((Z,he)=>{const Ne=typeof Z=="string"?Z.trim():"";if(!Ne)return;const Te=`${ee}_${he}`;Gr.current.get(Te)!==Ne&&(Gr.current.set(Te,Ne),setTimeout(()=>{ru(Te,Ne,"multi-variable-select")},100))})}}},[i,t,au,ru]);const yi=y.useCallback(async(z,re,oe)=>{const te=Date.now();en(Z=>{const he=new Set(Z);return he.add(z),he});try{const Z=await oe(z,re),he=Date.now()-te;he<500&&await new Promise(Ne=>setTimeout(Ne,500-he)),Z&&(Oe(Ne=>({...Ne,markdownModules:{...Ne.markdownModules,[z]:Z.modules}})),Hn(Ne=>{const Te={...Ne};return Z.modules.forEach((Le,Ot)=>{Te[`${z}__module_${Ot}`]=Le.content}),Te}))}finally{en(Z=>{if(!Z.has(z))return Z;const he=new Set(Z);return he.delete(z),he})}},[]),dw=y.useCallback((z,re)=>yi(z,re,Fb),[yi,Fb]),fw=y.useCallback((z,re)=>yi(z,re,Hb),[yi,Hb]);y.useEffect(()=>{s?.(wt)},[wt,s]),y.useEffect(()=>{if(tu.current){tu.current=!1;return}o?.(st)},[st,o]);const iu=y.useCallback(async()=>{if(l||r)return;const z=pt?{skillCode:pt.id,skillName:pt.title}:void 0;if(t.length===0){const te=dl.trim();if(!te&&!st.length)return;const Z=pt?`【${pt.title}】${te}`:te;if(st.length){const he=new FormData;Z&&he.append("prompt",Z),st.forEach(Ne=>he.append("files",Ne)),n(he,Z,z)}else n(te,Z,z);Nb(""),Y([]);return}if(!Pb(Et,wt,Yl))return;const{formData:re,fullPrompt:oe,hasContent:ee}=await i4({config:Ct,values:Et,files:wt,footerFiles:st,markdownModules:ve.markdownModules,excludedKeys:Yl,hideSeparator:Rb});ee&&(n(re,oe,z),Y([]))},[t.length,dl,pt,Ct,Et,wt,st,ve.markdownModules,l,r,Pb,n,Yl]),hw=y.useCallback(z=>{z.key==="Enter"&&(z.nativeEvent.isComposing||z.keyCode===229||z.shiftKey||(z.preventDefault(),iu()))},[iu]),pw=y.useMemo(()=>t.length===0?dl.trim().length>0:KN(Ct,Et,wt,Yl),[t.length,dl,Ct,Et,wt,Yl]);y.useLayoutEffect(()=>{if(!pt){_b(0),Ib(0);return}const z=wb.current,re=z?.querySelector(".tag-node");if(!z||!re)return;const oe=re.getClientRects();if(oe.length===0)return;const ee=z.getBoundingClientRect().left,te=oe[0],Z=oe[oe.length-1];_b(Math.max(0,Z.right-ee-2)),Ib(Math.max(0,Math.round(Z.top-te.top)))},[pt,t.length]),y.useEffect(()=>{!pt||t.length>0||Yr.current?.focus()},[pt,t.length]);const zb=y.useRef(null),[bw,Vb]=y.useState(!1);y.useEffect(()=>{const z=re=>{const oe=zb.current;if(!oe)return;const ee=re.target;oe.contains(ee)||_t&&_t.contains(ee)?Vb(!0):Vb(!1)};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[_t]);const $b=y.useCallback(()=>{requestAnimationFrame(()=>{if(t.length===0){Yr.current?.focus();return}ul.current?.querySelector('textarea:not([disabled]), input:not([disabled]):not([type="hidden"]), [contenteditable="true"]')?.focus()})},[t.length]),mw=y.useCallback(z=>{ie?.(z),z&&$b()},[ie,$b]);y.useLayoutEffect(()=>{const z=Yr.current;z&&(z.style.height="auto",z.style.height=`${z.scrollHeight}px`)},[dl,Zo,eu]);const gw={width:c,background:d,border:f,maxHeight:h,...b&&!Me?{minHeight:b}:{},...v?{"--rte-editor-min-height":typeof v=="number"?`${v}px`:v}:{},...g?{"--rte-editor-padding":g}:{}},qb=typeof ke=="number"?ke:ew,Wb={maxHeight:Me?qb:Math.max(cl,qb),minHeight:Me||bi?0:void 0,overflow:Me||bi?"hidden":"auto",transition:Jo?"none":`max-height ${ft}ms cubic-bezier(0.4, 0, 0.2, 1)`,willChange:"max-height"},Yb=y.useCallback(()=>{Me&&Fe&&Ft?.(!1),Yr.current?.focus()},[Me,Fe,Ft]),jb=y.useRef(0),vw=y.useCallback(()=>{const z=ul.current,re=document.activeElement;!z||!re||!z.contains(re)||(jb.current=typeof performance<"u"?performance.now():Date.now())},[]),Ei=y.useCallback(()=>{const z=ul.current;if(z){if(!Me&&(typeof performance<"u"?performance.now():Date.now())>=xb.current){const oe=z.style.maxHeight;z.style.maxHeight="none";const ee=z.offsetHeight,te=z.scrollHeight,Z=z.parentElement;let he=1/0;if(Z){let Le=0;for(const Ti of Array.from(Z.children))Ti!==z&&(Le+=Ti.offsetHeight);const Ot=getComputedStyle(Z),su=parseFloat(Ot.paddingTop)+parseFloat(Ot.paddingBottom);he=Math.max(0,Z.clientHeight-Le-su)}z.style.maxHeight=oe;const Ne=Math.max(Math.ceil(te||0),Math.ceil(ee||0)),Te=Math.min(Ne,Math.ceil(he));Te>0&&Cb(Le=>Le===Te?Le:Te)}try{const re=z.getBoundingClientRect(),oe=z.querySelector(".rte-config-fade")??z,ee=document.createRange();ee.selectNodeContents(oe);const te=Array.from(ee.getClientRects()).filter(Z=>Z.height>0);if(te.length>0){const Z=Math.min(...te.map(fl=>fl.top)),he=parseFloat(getComputedStyle(z).lineHeight)||34,Ne=Math.max(he,1);let Te=Z+Ne*.6;for(let fl=0;fl<5;fl++){let Ci=Te;for(const Xb of te)Xb.top<Te&&(Ci=Math.max(Ci,Xb.bottom));if(Ci===Te)break;Te=Ci}const Le=Te>0?Math.ceil(Te-re.top):0,Ot=getComputedStyle(z),su=parseFloat(Ot.paddingTop)||0,Ti=Math.ceil(su+Ne),ou=Math.max(Le,Ti);ou>0&&tw(fl=>fl===ou?fl:ou)}}catch{}}},[Me]),jl=y.useMemo(()=>Ct.filter(z=>z.key&&z.type!=="report-module"&&z.type!=="markdown-module").map(z=>`${z.type}:${z.key}`).join("|"),[Ct]),Gb=y.useRef(jl);Gb.current!==jl&&(Gb.current=jl,Me||(Cb(db),Sb(!0))),y.useEffect(()=>{if(!Jo)return;const z=setTimeout(()=>Sb(!1),ft);return()=>clearTimeout(z)},[Jo,jl,ft]),y.useLayoutEffect(()=>{const z=ul.current;if(!z||(Ei(),typeof ResizeObserver>"u"))return;const re=()=>{const Z=ul.current;if(!Z)return;(typeof performance<"u"?performance.now():Date.now())-jb.current<600&&Z.contains(document.activeElement)&&Z.scrollHeight>Z.clientHeight&&(Z.scrollTop=Z.scrollHeight)},oe=new ResizeObserver(()=>Ei());oe.observe(z);const ee=z.querySelector(".rte-default-textarea, .rte-config-fade"),te=ee?new ResizeObserver(()=>{Ei(),re()}):null;return ee&&te&&te.observe(ee),()=>{oe.disconnect(),te?.disconnect()}},[Ei,Ct,wt,st.length,Ht,Me,jl,dl]);const Kb=y.useRef(-1);y.useEffect(()=>{Me||cl<=0||cl>=db||Kb.current!==cl&&(Kb.current=cl,Rn?.(cl))},[cl,Me,Rn]);const Qb=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"]),[]),yw=y.useCallback(z=>{const re=z.clipboardData?.files;if(!re||re.length===0||(z.preventDefault(),t.some(Le=>Le.type==="tag")))return;const ee=[];let te=!1;for(const Le of Array.from(re)){const Ot=(Le.name||"").split(".").pop()?.toLowerCase()||"";Qb.has(Ot)?ee.push(Le):te=!0}if(te&&It.current?.error("粘贴文件中含不支持的类型,已自动过滤"),ee.length===0)return;const Z=50*1024*1024,he=st.reduce((Le,Ot)=>Le+Ot.size,0),Ne=[];let Te=he;for(const Le of ee){if(Te+Le.size>Z){It.current?.error("文件总大小不能超过 50MB");break}Ne.push(Le),Te+=Le.size}Ne.length>0&&Y(Le=>[...Ne,...Le])},[Qb,t,st]);return m.jsx(ue.ConfigProvider,{getPopupContainer:Un,children:m.jsxs(ue.App,{component:!1,message:{getContainer:()=>_t??document.body},children:[m.jsx(F4,{messageRef:It}),m.jsxs(sf.Provider,{value:_t,children:[m.jsxs("div",{ref:zb,className:`rich-text-editor ${pi?"rte-richtext-container-expanded":""} ${bw?"rte-editor-selected":""} ${T??""}`,"data-component":"structured-editor",style:gw,onPaste:yw,children:[m.jsx(cb,{files:st,onChange:Y}),t.length===0?m.jsxs("div",{ref:ul,className:`rte-editor rte-editor-default${pt?" rte-editor-default-with-skill":""}`,style:Wb,onClick:Yb,children:[pt&&m.jsx("span",{ref:wb,className:"rte-skill-inline-tag-wrap",contentEditable:!1,children:m.jsx(fb,{title:pt.title,onClose:()=>Lb(null)})}),m.jsx("textarea",{ref:Yr,className:"rte-default-textarea",value:dl,onChange:z=>Nb(z.target.value),onKeyDown:hw,placeholder:pt?.usageInstruction||a||"",disabled:r,rows:1,style:{textIndent:Zo?`${Zo}px`:void 0,paddingTop:eu?`${eu}px`:void 0}})]}):m.jsx("div",{ref:ul,className:`rte-editor${pi?" rte-richtext-fullscreen-active":""}`,style:Wb,onClick:Yb,onInput:vw,children:m.jsx("div",{className:"rte-config-fade",children:Ct.map((z,re)=>{if(z.key&&Yl.has(z.key)||Rb&&z.exclusionGroup==="separator"||pi&&z.key!==pi)return null;const oe=(z.type==="report-module"||z.type==="markdown-module")&&z.key?`${z.key}__module_${z.moduleIndex??0}`:z.key;return m.jsx(G0,{node:z,value:oe?Et[oe]:void 0,files:wt,onChange:lu,onFileChange:iw,thumbnails:J,onThumbnailChange:sw,videoUrlParse:N,videoUpload:k,reportListFetch:O,onReportGoGenerate:S,onViewReport:I,hideCurrentSessionReport:A,reportNames:Ht,onClearReport:ow,onResolveMultiName:ru,onAnalyzeMultiReport:cw,onShiftReportNames:uw,onAgentExit:B,hideAgentClose:ce==="hideTagClose",onReportUrlParse:au,onMarkdownParse:dw,onMarkdownNameParse:fw,onRichtextExpandChange:Z4,disabled:r,error:oe?aw[oe]:void 0,index:re,nodeDefaults:ql},oe??`text-${re}`)})},jl)}),m.jsx(ub,{isProcessing:l,loading:Se,disabled:r,sendDisabled:!pw,showFooterUpload:De,footerFiles:st,onFooterFilesChange:Y,agentOptions:H,onAgentSelect:rw,hideAgentButton:ce==="hideAgent",currentAgent:jr,selectedSkill:pt,onSkillSelect:Lb,onSkillCardClick:F,onSkillAction:E,skillListFetch:q,onSkillHeaderAction:V,showCreateSkill:lw,createDisabled:C,skillPanelOpen:ne,onSkillPanelOpenChange:mw,skillPanelOpenDelay:P,onSend:iu,padding:xe})]}),m.jsx("div",{className:"rte-popup-host",ref:ht})]})]})})},pb="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAFSSURBVHgB3ZTtccIwDIaVXv83I2SDZgSP0BHMBG0naEZhA2boBGQDswHdQJUOGRxjO0Z8HPDe6eJzJD2W4gjgEYSIn2xwK6EIFHqBGysJpMP3ZB0oRbEtmal1NtIxl4OWWsoxEsvqofJ0rgTNASOYq+7SXKDsuYvAcgkq/PWwBLQWqIfdjeRStaBUc4qzgLi9/BzJNmS/sh6bpvmrTfSFacU3scWy1mQryWdSnXiFE8QVUJINLTuyhWzzz/1OZmTN9hEckqtfUOwIGlGCpVRjE+94JFqpMtTeVzO8/UmPxpZU8Qa7aln8Tb9pfwla4WHWrjPvvbbnTBsX7PmLs83EDAH0BxSw1G31+/1FoDg/vPcXR+wocQS1apj4+P92FfhOoLyuBfYlmPgYnGoCjWADzAkzUyJ430awLmphPaxWQVU22BuuApPkHaanjcXSN3t6/QNjTMSJWDcs1QAAAABJRU5ErkJggg==",H4=[{label:"5页",value:5},{label:"10页",value:10},{label:"15页",value:15},{label:"30页",value:30}],U4=({autoLoading:e,batchSize:t,loadingProgress:n,loadIcon:l,onBatchSizeChange:r,onLoadNextPage:a,onStartAutoLoad:i,onStopLoad:s})=>e&&n?m.jsxs("div",{className:"auto_load_progress",children:[l||m.jsx("img",{src:pb,alt:"自动加载",width:14,height:14}),m.jsxs("span",{children:["正在加载第",n.currentPage,"/",n.totalPages,"页"]}),m.jsx(ue.Progress,{percent:n.percentage,type:"line",size:[160,8]}),m.jsx("span",{onClick:s,className:"auto_load_stop_btn",children:"停止加载"})]}):m.jsxs("div",{className:"auto_load_container",children:[m.jsx("div",{onClick:a,className:"auto_load_next_btn",style:{backgroundColor:e?"#f5f5f5":"#2563eb"},children:"加载下一页"}),m.jsxs("div",{className:"right_control_wrap",style:{backgroundColor:e?"#f5f5f5":"#2563eb"},children:[m.jsxs("div",{className:"auto_load_btn",onClick:e?void 0:i,children:[l||m.jsx("img",{src:pb,alt:"自动加载",width:14,height:14}),m.jsx("span",{children:"自动加载"})]}),m.jsx(ue.Select,{value:t,onChange:r,options:H4,disabled:e,size:"small",className:"auto_load_select",popupMatchSelectWidth:84})]})]}),z4=({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),b=Math.ceil(l/n),v=y.useMemo(()=>r.length>=b,[r,b]),g=()=>Array.from({length:b},(k,M)=>M+1).filter(k=>!r.includes(k)).slice(0,f),T=(N,k,M)=>{const O=r.includes(N);return k==="prev"||k==="next"||k==="jump-prev"||k==="jump-next"?m.jsx("div",{className:"pageBox",children:M}):m.jsxs("div",{className:"pageBox",style:{backgroundColor:e===N?"#2563EB":"#f5f5f5",color:e===N?"#fff":O?"#171717":"#a3a3a3"},children:[N,!O&&m.jsx("span",{className:"unload_spot"})]})};return m.jsxs("div",{className:"pagination_footer",children:[m.jsxs("div",{className:"pagination_leftWrap",children:[m.jsxs("span",{className:"pagination_total",children:[m.jsx(qt.InfoCircleOutlined,{style:{color:"#2563EB",marginRight:"4px"}}),"已加载: ",a,"/",l,"条数据"]}),!v&&m.jsx(U4,{loadIcon:t||void 0,autoLoading:i,batchSize:f,loadingProgress:s,disabled:!u||!c,onBatchSizeChange:h,onLoadNextPage:()=>u?.(),onStartAutoLoad:()=>{const N=g();c?.(N)},onStopLoad:()=>d?.()})]}),m.jsx(ue.Pagination,{current:e,pageSize:n,total:l,onChange:N=>o(N),showSizeChanger:!1,showQuickJumper:!1,showTotal:()=>"",itemRender:T})]})},bb=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,...b}=e,v=y.useRef(null),g=y.useCallback(T=>{c(T),u.includes(T)&&v.current?.scrollTo({key:`${(T-1)*o+1}`})},[u,c,o]);return m.jsxs("div",{className:"flex flex-col",children:[m.jsx(ue.Table,{ref:v,...b,columns:r,dataSource:a,pagination:!1,virtual:!0}),m.jsx(z4,{loading:t,autoLoading:n,loadingProgress:l,current:s,pageSize:o,total:i,loadedCount:a.length,cachedPages:u,onChange:g,onLoadNextPage:d,onStartAutoLoad:f,onStopLoading:h})]})};bb.__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 mb=({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,b]=y.useState(!1),[v,g]=y.useState(!1),T=y.useRef(void 0),N=y.useRef(void 0),k=y.useRef(e),M=y.useRef(u),O=y.useRef(h),S=y.useRef(s);y.useEffect(()=>{k.current=e,M.current=u,O.current=h,S.current=s});const _=y.useCallback((B,E)=>{let F=0;g(!0);const V=()=>{F<B.length?(o(B.slice(0,F+1)),F++,N.current=window.setTimeout(V,n)):(g(!1),E?.())};V()},[n]),I=y.useCallback(B=>{let E=S.current.length;const F=()=>{E>0?(o(S.current.slice(0,E-1)),E--,N.current=window.setTimeout(F,n/2)):B?.()};F()},[n]),A=y.useCallback(()=>{if(k.current.length===0||O.current)return;f(!0);const B=k.current[M.current];S.current?I(()=>{_(B,()=>{T.current=window.setTimeout(()=>{c(E=>(E+1)%k.current.length),f(!1)},2e3)})}):_(B,()=>{T.current=window.setTimeout(()=>{c(E=>(E+1)%k.current.length),f(!1)},2e3)})},[I,_]);y.useEffect(()=>(l&&e.length>0&&!h&&A(),()=>{T.current&&window.clearTimeout(T.current),N.current&&window.clearTimeout(N.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=>{b(!0),T.current&&window.clearTimeout(T.current),N.current&&window.clearTimeout(N.current),f(!1),g(!1),i.onFocus?.(B)},L=B=>{b(!1),!r&&e.length>0&&(o(""),c(0)),i.onBlur?.(B)},H=B=>{a?.(B.target.value),i.onChange?.(B)},$=()=>h||r?t:s||t;return m.jsxs("div",{style:{position:"relative"},children:[m.jsx(ue.Input,{...i,value:r,onChange:H,onFocus:R,onBlur:L,placeholder:$(),style:{...i.style,position:"relative",zIndex:1}}),!h&&!r&&s&&m.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:[m.jsx("span",{children:s}),v&&m.jsx("span",{style:{display:"inline-block",width:1,height:"1.2em",backgroundColor:"#1890ff",marginLeft:2,animation:"blink 1s infinite"}})]}),m.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 o4={reportModules:{},markdownModules:{}},u4={adjustX:1,adjustY:1,shiftX:!1,shiftY:!1},nb=y.memo(({options:e,onSelect:t,disabled:n,currentAgent:l,onOpenChange:r})=>{const[a,i]=y.useState(!1),s=d=>{i(d),r?.(d)},o=e.filter(d=>d.isShowNew!==1).map(d=>({key:d.key,label:m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[d.icon&&m.jsx("i",{className:d.icon}),m.jsx("span",{children:d.label})]}),onClick:()=>t?.(d)})),c=`rte-agent-badge${!!l?" rte-agent-badge-selected":a?" rte-agent-badge-active":""}`;return m.jsx(ue.Dropdown,{menu:{items:o,selectedKeys:l?[String(l.key)]:[]},disabled:n,placement:"bottomLeft",autoAdjustOverflow:u4,trigger:["click"],overlayClassName:"rte-agent-dropdown",onOpenChange:s,children:m.jsxs("div",{className:c,style:{cursor:e.length>0?"pointer":"default"},children:[m.jsx("i",{className:"iconfont icon-zhinengti",style:{fontSize:"16px"}}),m.jsx("span",{className:"rte-agent-text",children:"智能体"})]})})});nb.displayName="AgentDropdown";function lb(e="width"){const t=y.useRef(null),[n,l]=y.useState(!1),r=y.useCallback(()=>{const a=t.current;a&&l(e==="height"?a.scrollHeight>a.clientHeight:a.scrollWidth>a.clientWidth)},[e]);return[t,n,r]}const c4=["全部技能","我的技能","订阅技能","系统技能"],d4=["all","mine","subscribe","system"],f4=20,h4={system:"系统技能",mine:"我的技能",subscribe:"订阅技能"},Ln="基于用户上传的抖音推广数据,智能分析高潜力商品与爆品抖音推广数据,智能分析高潜力商品与爆品商品机会",Pn=["淘宝天猫","抖音电商","市场选品","京东商城","拼多多","小红书","快手电商","视频号"],Bn="当用户需要尖锐吐槽、阴阳怪气评论、犀利差评、回怼话术或讽刺性改写时使用本技能;用户只需提供对象、场景、原话或想表达的不满,即可触发生成。",p4=[{id:"c1",title:"抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让",desc:Ln,tags:Pn,badge:"system",heat:"3.5",usageInstruction:Bn},{id:"c2",title:"抖音推广找潜力爆品",desc:Ln,tags:Pn,badge:"system",heat:"6.6",usageInstruction:Bn},{id:"c3",title:"抖音推广找潜力爆品",desc:Ln,tags:Pn,badge:"mine",usageInstruction:Bn},{id:"c4",title:"抖音推广找潜力爆品",desc:Ln,tags:Pn,badge:"subscribe",heat:"6.6",usageInstruction:Bn},{id:"c4",title:"抖音推广找潜力爆品",desc:Ln,tags:Pn,badge:"subscribe",heat:"6.6",usageInstruction:Bn},{id:"c4",title:"抖音推广找潜力爆品",desc:Ln,tags:Pn,badge:"mine",heat:"6.6",usageInstruction:Bn},{id:"c4",title:"抖音推广找潜力爆品",desc:Ln,tags:Pn,badge:"mine",heat:"6.6",usageInstruction:Bn},{id:"c4",title:"抖音推广找潜力爆品",desc:Ln,tags:Pn,badge:"mine",heat:"6.6",usageInstruction:Bn}],b4=e=>({id:e.id,title:e.title,desc:e.desc??"",usageInstruction:e.usageInstruction,tags:e.tags??[],badge:e.badge??"system",heat:e.heat}),m4=()=>m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:m.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"})}),g4=[()=>m.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:m.jsx("path",{d:"M5.99358 8.85714C6.27231 8.85714 6.53962 8.97003 6.73671 9.17096C6.9338 9.37189 7.04453 9.64441 7.04453 9.92857V12.9286C7.04453 13.2127 6.9338 13.4853 6.73671 13.6862C6.53962 13.8871 6.27231 14 5.99358 14H3.05094L2.94375 13.9946C2.6849 13.9676 2.4451 13.8436 2.27076 13.6467C2.09642 13.4497 1.99994 13.1939 2 12.9286V9.92857C1.99994 9.66329 2.09642 9.40742 2.27076 9.21049C2.4451 9.01355 2.6849 8.88956 2.94375 8.8625L3.05094 8.85714H5.99358ZM11.0087 8.74571C11.0323 8.68643 11.0727 8.63567 11.1247 8.59993C11.1768 8.5642 11.2381 8.54511 11.3008 8.54511C11.3636 8.54511 11.4249 8.5642 11.477 8.59993C11.529 8.63567 11.5694 8.68643 11.593 8.74571L12.1521 10.1675C12.168 10.2079 12.1917 10.2446 12.2219 10.2753C12.252 10.3061 12.288 10.3303 12.3276 10.3464L13.8021 10.9486C13.8585 10.9716 13.9072 11.0109 13.9423 11.0615C13.9773 11.1121 13.9973 11.172 13.9997 11.234C14.0022 11.2959 13.987 11.3572 13.956 11.4106C13.9251 11.4639 13.8796 11.507 13.8252 11.5346L12.3024 12.3104C12.2369 12.3438 12.1849 12.3995 12.1553 12.4679L11.5888 13.7675C11.564 13.8242 11.5236 13.8724 11.4725 13.9062C11.4214 13.94 11.3618 13.958 11.3008 13.958C11.2399 13.958 11.1803 13.94 11.1292 13.9062C11.0781 13.8724 11.0377 13.8242 11.0129 13.7675L10.4454 12.4679C10.4158 12.3995 10.3638 12.3438 10.2982 12.3104L8.77753 11.5357C8.7231 11.5081 8.67767 11.465 8.6467 11.4117C8.61574 11.3583 8.60056 11.297 8.603 11.235C8.60545 11.1731 8.62541 11.1132 8.66047 11.0626C8.69554 11.0119 8.74422 10.9727 8.80065 10.9496L10.2751 10.3475C10.3147 10.3313 10.3507 10.3071 10.3809 10.2764C10.411 10.2456 10.4348 10.209 10.4506 10.1686L11.0097 8.74679L11.0087 8.74571ZM3.05094 12.9286H5.99358V9.92857H3.05094V12.9286ZM5.99358 2C6.57371 2 7.04453 2.48 7.04453 3.07143V6.07143C7.04453 6.35559 6.9338 6.62811 6.73671 6.82904C6.53962 7.02997 6.27231 7.14286 5.99358 7.14286H3.05094L2.94375 7.1375C2.6849 7.11044 2.4451 6.98644 2.27076 6.78951C2.09642 6.59258 1.99994 6.33671 2 6.07143V3.07143C1.99994 2.80615 2.09642 2.55028 2.27076 2.35335C2.4451 2.15641 2.6849 2.03242 2.94375 2.00536L3.05094 2H5.99358ZM12.7196 2C12.9984 2 13.2657 2.11288 13.4628 2.31381C13.6598 2.51475 13.7706 2.78727 13.7706 3.07143V6.07143C13.7706 6.35559 13.6598 6.62811 13.4628 6.82904C13.2657 7.02997 12.9984 7.14286 12.7196 7.14286H9.77698L9.66873 7.1375C9.41016 7.10996 9.17075 6.98579 8.99668 6.78893C8.8226 6.59207 8.72619 6.33647 8.72604 6.07143V3.07143C8.72596 2.80632 8.82228 2.55059 8.99641 2.35368C9.17053 2.15677 9.41007 2.03266 9.66873 2.00536L9.77698 2H12.7196ZM9.77698 6.07143H12.7196V3.07143H9.77698V6.07143ZM3.05094 6.07143H5.99358V3.07143H3.05094V6.07143Z",fill:"currentColor"})}),()=>m.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[m.jsx("path",{d:"M12.6358 2.44435C12.8831 2.19815 13.2831 2.199 13.5293 2.44624C13.7755 2.69349 13.7746 3.0935 13.5274 3.33968L3.31858 13.5054C3.07133 13.7516 2.67132 13.7508 2.42513 13.5035C2.17893 13.2563 2.17977 12.8563 2.42701 12.6101L12.6358 2.44435Z",fill:"currentColor"}),m.jsx("path",{d:"M5.27212 5.97815L4.9117 7.22356C4.85382 7.42362 4.64471 7.53887 4.44466 7.48097C4.38352 7.46327 4.32785 7.43039 4.28284 7.38538C4.23783 7.34037 4.20495 7.2847 4.18726 7.22356L3.82686 5.97814C3.76198 5.75394 3.64142 5.54982 3.47639 5.38478C3.31136 5.21975 3.10723 5.09917 2.88304 5.03429L1.6376 4.67391C1.43755 4.61602 1.3223 4.40692 1.3802 4.20687C1.39789 4.14573 1.43077 4.09006 1.47578 4.04505C1.52079 4.00004 1.57646 3.96716 1.6376 3.94946L2.88303 3.58908C3.10722 3.5242 3.31135 3.40363 3.47638 3.23859C3.64141 3.07356 3.76198 2.86943 3.82686 2.64523L4.18726 1.39981C4.24514 1.19975 4.45425 1.08451 4.65429 1.1424C4.71544 1.1601 4.77111 1.19298 4.81612 1.23799C4.86112 1.283 4.89401 1.33867 4.9117 1.39981L5.27209 2.64523C5.33696 2.86943 5.45753 3.07356 5.62257 3.2386C5.7876 3.40363 5.99173 3.5242 6.21593 3.58908L7.46135 3.94946C7.66141 4.00735 7.77666 4.21646 7.71876 4.4165C7.70107 4.47764 7.66818 4.53331 7.62318 4.57832C7.57817 4.62333 7.5225 4.65621 7.46135 4.67391L6.21593 5.03429C5.99173 5.09917 5.7876 5.21974 5.62257 5.38478C5.45753 5.54981 5.33696 5.75394 5.27209 5.97814L5.27212 5.97815ZM12.4587 10.7095L12.3937 10.934C12.3494 11.0869 12.1896 11.175 12.0368 11.1308C11.99 11.1172 11.9475 11.0921 11.9131 11.0577C11.8787 11.0233 11.8536 10.9808 11.8401 10.934L11.7751 10.7095C11.7102 10.4853 11.5896 10.2811 11.4246 10.1161C11.2596 9.95108 11.0554 9.83051 10.8312 9.76564L10.6067 9.70065C10.4538 9.65642 10.3657 9.49662 10.41 9.34376C10.4235 9.29703 10.4486 9.25448 10.483 9.22009C10.5174 9.18569 10.5599 9.16056 10.6067 9.14704L10.8312 9.08206C11.0554 9.01718 11.2596 8.89661 11.4246 8.73158C11.5896 8.56655 11.7102 8.36242 11.7751 8.13823L11.8401 7.91366C11.8843 7.76078 12.0441 7.67272 12.197 7.71694C12.2437 7.73046 12.2862 7.75559 12.3206 7.78999C12.355 7.82439 12.3801 7.86693 12.3937 7.91366L12.4587 8.13823C12.5235 8.36242 12.6441 8.56655 12.8091 8.73158C12.9742 8.89661 13.1783 9.01718 13.4025 9.08206L13.6271 9.14704C13.7799 9.19129 13.868 9.35108 13.8238 9.50394C13.8102 9.55067 13.7851 9.59321 13.7507 9.62761C13.7163 9.662 13.6738 9.68713 13.6271 9.70065L13.4025 9.76564C13.1783 9.83051 12.9742 9.95108 12.8091 10.1161C12.6441 10.2811 12.5235 10.4853 12.4587 10.7095ZM8.73493 13.6947L8.66994 13.9193C8.6257 14.0722 8.46591 14.1602 8.31305 14.116C8.26632 14.1025 8.22378 14.0774 8.18938 14.043C8.15498 14.0086 8.12986 13.966 8.11634 13.9193L8.05135 13.6947C7.98647 13.4705 7.8659 13.2664 7.70087 13.1014C7.53584 12.9363 7.33171 12.8158 7.10752 12.7509L6.88295 12.6859C6.73007 12.6417 6.64201 12.4819 6.68624 12.329C6.69976 12.2823 6.72489 12.2397 6.75928 12.2054C6.79368 12.171 6.83622 12.1458 6.88295 12.1323L7.10752 12.0673C7.33171 12.0024 7.53584 11.8819 7.70087 11.7168C7.8659 11.5518 7.98647 11.3477 8.05135 11.1235L8.11634 10.8989C8.16058 10.746 8.32037 10.658 8.47323 10.7022C8.51996 10.7157 8.5625 10.7409 8.5969 10.7753C8.6313 10.8097 8.65642 10.8522 8.66994 10.8989L8.73493 11.1235C8.7998 11.3477 8.92037 11.5518 9.08541 11.7168C9.25044 11.8819 9.45456 12.0024 9.67876 12.0673L9.90333 12.1323C10.0562 12.1766 10.1443 12.3363 10.1 12.4892C10.0865 12.5359 10.0614 12.5785 10.027 12.6129C9.9926 12.6473 9.95006 12.6724 9.90333 12.6859L9.67876 12.7509C9.45456 12.8158 9.25044 12.9363 9.08541 13.1014C8.92037 13.2664 8.7998 13.4705 8.73493 13.6947Z",fill:"currentColor"})]}),()=>m.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[m.jsx("path",{d:"M12.2 1.69995H3.8C3.2201 1.69995 2.75 2.17467 2.75 2.76025V13.3632C2.75 13.3754 2.75021 13.3875 2.75061 13.3996C2.76856 13.9361 3.21367 14.2996 3.68722 14.2996C3.86807 14.2996 4.05311 14.2465 4.22003 14.1298L7.39764 11.9084C7.5726 11.7858 7.78102 11.72 7.99466 11.7198C8.2083 11.7197 8.4168 11.7853 8.59191 11.9077L11.7803 14.1308C11.9471 14.2471 12.1318 14.3 12.3124 14.3C12.7861 14.3 13.2314 13.9362 13.2494 13.3996C13.2498 13.3875 13.25 13.3754 13.25 13.3632V2.76025C13.25 2.17467 12.7799 1.69995 12.2 1.69995ZM12.2 13.1434L9.19248 11.0464C8.83927 10.8001 8.42531 10.6699 7.99537 10.6699C7.56449 10.6698 7.14976 10.8005 6.79602 11.0478L3.8 13.1423V2.76025C3.8 2.75802 3.8 2.75322 3.80289 2.74995H12.1971C12.2 2.75322 12.2 2.75801 12.2 2.76025V13.1434Z",fill:"currentColor"}),m.jsx("path",{d:"M10.4117 6.27223H8.52499V4.36187C8.52499 4.07192 8.28994 3.83687 7.99999 3.83687C7.71004 3.83687 7.47499 4.07192 7.47499 4.36187V6.27223H5.58828C5.29833 6.27223 5.06328 6.50728 5.06328 6.79723V6.80751C5.06328 7.09746 5.29833 7.33251 5.58828 7.33251H7.47499V9.24287C7.47499 9.53282 7.71004 9.76787 7.99999 9.76787C8.28994 9.76787 8.52499 9.53282 8.52499 9.24287V7.33251H10.4117C10.7017 7.33251 10.9367 7.09746 10.9367 6.80751V6.79723C10.9367 6.50728 10.7017 6.27223 10.4117 6.27223Z",fill:"currentColor"})]}),()=>m.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[m.jsx("path",{d:"M11.8231 2.3562H4.19204C3.60373 2.36812 3.04399 2.61212 2.63483 3.03501C2.22567 3.4579 2.00026 4.02539 2.00775 4.61377V9.14983C2.00026 9.73821 2.22567 10.3057 2.63483 10.7286C3.04399 11.1515 3.60373 11.3955 4.19204 11.4074H11.8231C12.4114 11.3955 12.9711 11.1515 13.3803 10.7286C13.7895 10.3057 14.0149 9.73821 14.0074 9.14983V4.61377C14.0149 4.02539 13.7895 3.4579 13.3803 3.03501C12.9711 2.61212 12.4114 2.36812 11.8231 2.3562ZM12.9152 9.12192C12.9176 9.26764 12.8911 9.41238 12.8375 9.54789C12.7839 9.6834 12.704 9.80701 12.6026 9.91167C12.5012 10.0163 12.3802 10.1 12.2464 10.1579C12.1127 10.2157 11.9688 10.2467 11.8231 10.249H4.19204C3.89804 10.2434 3.61817 10.1218 3.41354 9.91067C3.20891 9.6995 3.09616 9.41594 3.09989 9.12192V4.61377C3.09759 4.46822 3.12403 4.32364 3.17771 4.18833C3.23139 4.05303 3.31126 3.92964 3.41272 3.82526C3.51418 3.72088 3.63525 3.63756 3.76898 3.58006C3.90272 3.52257 4.04648 3.49204 4.19204 3.49022H11.8231C12.1165 3.49572 12.3958 3.61686 12.6004 3.82727C12.8049 4.03768 12.9181 4.32034 12.9152 4.61377V9.12192Z",fill:"currentColor"}),m.jsx("path",{d:"M11.0091 13.6431H5.01099C4.862 13.6431 4.71911 13.5839 4.61376 13.4785C4.50841 13.3732 4.44922 13.2303 4.44922 13.0813C4.44922 12.9323 4.50841 12.7894 4.61376 12.6841C4.71911 12.5787 4.862 12.5195 5.01099 12.5195H11.0091C11.1581 12.5195 11.3009 12.5787 11.4063 12.6841C11.5117 12.7894 11.5708 12.9323 11.5708 13.0813C11.5708 13.2303 11.5117 13.3732 11.4063 13.4785C11.3009 13.5839 11.1581 13.6431 11.0091 13.6431Z",fill:"currentColor"})]})],v4=()=>m.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[m.jsx("path",{d:"M14.365 4.88313C13.9832 4.88313 13.7286 5.13768 13.7286 5.51949V12.9649C13.7286 13.4104 13.4104 13.7286 12.965 13.7286H3.03771C2.59225 13.7286 2.27407 13.4104 2.27407 12.9649V3.03768C2.27407 2.59222 2.59225 2.27404 3.03771 2.27404H6.66498C7.0468 2.27404 7.30134 2.01949 7.30134 1.63768C7.30134 1.25586 7.0468 1.00131 6.66498 1.00131H3.03771C1.89225 1.00131 1.00134 1.89222 1.00134 3.03768V12.9649C1.00134 14.1104 1.89225 15.0013 3.03771 15.0013H12.965C14.1104 15.0013 15.0013 14.1104 15.0013 12.9649V5.51949C15.0013 5.20131 14.7468 4.88313 14.365 4.88313Z",fill:"#666666"}),m.jsx("path",{d:"M5.2637 7.55586C5.00916 7.30131 4.62734 7.30131 4.37279 7.55586C4.11825 7.8104 4.11825 8.19222 4.37279 8.44677L7.55461 11.6286C7.61825 11.6922 7.68188 11.7559 7.74552 11.7559C7.80916 11.8195 7.93643 11.8195 8.00007 11.8195C8.0637 11.8195 8.19098 11.8195 8.25461 11.7559C8.31825 11.6922 8.38188 11.6922 8.44552 11.6286L11.6273 8.44677C11.8819 8.19222 11.8819 7.8104 11.6273 7.55586C11.3728 7.30131 10.991 7.30131 10.7364 7.55586L8.63643 9.65586V8.00131C8.63643 4.81949 11.1819 2.27404 14.3637 2.27404C14.7455 2.27404 15.0001 2.01949 15.0001 1.63768C15.0001 1.25586 14.7455 1.00131 14.3637 1.00131C10.4819 1.00131 7.3637 4.11949 7.3637 8.00131V9.65586L5.2637 7.55586Z",fill:"#666666"})]}),y4=()=>m.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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"})}),E4=()=>m.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[m.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"}),m.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"})]}),T4=()=>m.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[m.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"}),m.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"}),m.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"})]}),C4=()=>m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:m.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"})}),S4=()=>m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:m.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"})}),x4=()=>m.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:m.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"})}),k4=({code:e})=>{const{message:t}=ue.App.useApp(),[n,l]=y.useState(!1),r=async a=>{a.stopPropagation();try{await navigator.clipboard.writeText(e),l(!0),window.setTimeout(()=>l(!1),2e3)}catch{t.error("复制失败")}};return m.jsxs("div",{className:"rte-skill-share",onClick:a=>a.stopPropagation(),children:[m.jsxs("div",{className:"rte-skill-share-head",children:[m.jsxs("div",{className:"rte-skill-share-title",children:[m.jsx(x4,{}),m.jsx("span",{children:"分享码"})]}),m.jsx("span",{className:"rte-skill-share-hint",children:"复制后粘贴在「导入技能」即可使用"})]}),m.jsxs("div",{className:"rte-skill-share-box",children:[m.jsx("span",{className:"rte-skill-share-code",children:e}),m.jsxs("button",{type:"button",className:`rte-skill-share-copy${n?" rte-skill-share-copy-done":""}`,onClick:r,children:[n?m.jsx(S4,{}):m.jsx(C4,{}),m.jsx("span",{children:n?"已复制":"复制"})]})]})]})},A4=({card:e,selected:t,onClick:n,onShare:l,onEdit:r,onDelete:a,onUse:i,getPopupContainer:s})=>{const o=_=>_.stopPropagation(),[u,c,d]=lb(),[f,h,b]=lb("height"),[v,g]=y.useState(!1),[T,N]=y.useState(""),[k,M]=y.useState(!1),O=v||k,S=async _=>{if(g(_),!_){N("");return}try{const I=await l();N(typeof I=="string"&&I?I:`SK-${e.id}`)}catch{N(`SK-${e.id}`)}};return m.jsxs("div",{className:`rte-skill-card${t?" rte-skill-card-selected":""}${O?" rte-skill-card-pinned":""}`,onClick:n,"data-rte-skill-card":"true","aria-pressed":t,children:[m.jsxs("div",{className:"rte-skill-card-header",children:[m.jsx(hl,{title:c?e.title:"",placement:"top",mouseEnterDelay:.3,getPopupContainer:s,zIndex:1e4,children:m.jsx("div",{className:"rte-skill-card-title",ref:u,onMouseEnter:d,children:e.title})}),m.jsxs("div",{className:`rte-skill-card-aside${O?" rte-skill-card-aside-pinned":""}`,children:[m.jsx("span",{className:`rte-skill-card-badge rte-skill-card-badge-${e.badge}`,children:h4[e.badge]}),m.jsxs("div",{className:`rte-skill-card-actions${O?" rte-skill-card-actions-pinned":""}`,children:[e.badge==="mine"&&m.jsx(ue.Popover,{open:v,onOpenChange:S,trigger:"click",placement:"bottomRight",arrow:!1,overlayClassName:"rte-skill-share-popover",zIndex:1e4,getPopupContainer:s,content:m.jsx(k4,{code:T}),children:m.jsx("button",{type:"button",className:`rte-skill-card-action${v?" rte-skill-card-action-active":""}`,title:"分享","aria-label":"分享",onClick:o,children:m.jsx(y4,{})})}),e.badge==="mine"&&m.jsx("button",{type:"button",className:"rte-skill-card-action",title:"编辑","aria-label":"编辑",onClick:_=>{o(_),r()},children:m.jsx(E4,{})}),e.badge!=="mine"&&m.jsx("button",{type:"button",className:"rte-skill-card-action",title:"查看详情","aria-label":"查看详情",onClick:_=>{o(_),r()},children:m.jsx("i",{className:"iconfont icon-chakanjinengxiangqing"})}),e.badge!=="system"&&m.jsx(ue.Popconfirm,{title:"删除技能后不可恢复,确认删除吗?",open:k,onOpenChange:M,okText:"确认",cancelText:"取消",placement:"bottomRight",arrow:!1,overlayClassName:"rte-skill-delete-confirm",zIndex:1e4,icon:m.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:m.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:_=>{_?.stopPropagation(),M(!1),a()},onCancel:_=>{_?.stopPropagation(),M(!1)},children:m.jsx("button",{type:"button",className:`rte-skill-card-action rte-skill-card-action-delete${k?" rte-skill-card-action-active":""}`,title:"删除","aria-label":"删除",onClick:o,children:m.jsx(T4,{})})})]})]})]}),m.jsx(hl,{title:h?e.desc:"",placement:"top",mouseEnterDelay:.3,getPopupContainer:s,zIndex:1e4,children:m.jsx("div",{className:"rte-skill-card-desc",ref:f,onMouseEnter:b,children:e.desc})})]})},rb=y.memo(({selectedId:e,onSelect:t,onCardClick:n,onAction:l,skillListFetch:r,onHeaderAction:a,showCreateSkill:i=!0,createDisabled:s})=>{const{message:o}=ue.App.useApp(),[u,c]=y.useState(0),[d,f]=y.useState(r?[]:p4),[h,b]=y.useState(!1),[v,g]=y.useState(!!r),T=y.useRef(0),N=y.useCallback(()=>{g(!0),T.current=window.setTimeout(()=>{g(!1),b(!0)},300)},[]),k=y.useCallback(()=>{window.clearTimeout(T.current),g(!1),b(!1)},[]),[M,O]=y.useState(""),[S,_]=y.useState(""),I=Al(),A=I?()=>I:void 0,R=y.useRef(0),L=y.useRef(null),H=y.useRef(0),$=y.useRef(0),B=y.useCallback(()=>{const C=L.current;C&&(C.classList.add("is-scrolling"),window.clearTimeout($.current),$.current=window.setTimeout(()=>{C.classList.remove("is-scrolling")},300))},[]);y.useEffect(()=>{const C=window.setTimeout(()=>_(M.trim()),300);return()=>window.clearTimeout(C)},[M]);const E=y.useCallback(async()=>{if(!r)return;const C=++R.current;N();try{const ne=await r({skillType:d4[u],pageIndex:1,pageSize:f4,keyword:S||void 0});if(C!==R.current)return;f(ne.map(b4))}catch{C===R.current&&o.error("技能列表加载失败")}finally{C===R.current&&k()}},[r,u,S,N,k]);y.useEffect(()=>{E()},[E]),y.useEffect(()=>{L.current?.scrollTo({top:0})},[u,S]);const[F,V]=y.useState(!1);y.useLayoutEffect(()=>{if(u===0&&!h&&d.length>0){const C=L.current;C&&(H.current=C.clientHeight),V(!1)}else!h&&d.length>0&&H.current>0?requestAnimationFrame(()=>{const C=L.current;C&&V(C.scrollHeight<H.current)}):V(!1)},[u,h,d]);const q=C=>{n?.({id:C.id,title:C.title}),t?.({id:C.id,title:C.title,desc:C.desc||void 0,usageInstruction:C.usageInstruction})},G=async C=>{try{await l?.("delete",{id:C.id,title:C.title})}catch{o.error("删除失败");return}e===C.id&&t?.(null),r?await E():f(ne=>ne.filter(ie=>ie.id!==C.id)),o.success("已删除技能")};return m.jsxs("div",{className:"rte-skill-panel",children:[m.jsxs("div",{className:"rte-skill-panel-header",children:[m.jsxs("div",{className:"rte-skill-search",children:[m.jsx("input",{className:"rte-skill-search-input",placeholder:"请输入想搜索的技能名称或描述",value:M,onChange:C=>O(C.target.value)}),m.jsx("span",{className:"rte-skill-search-icon",children:m.jsx(m4,{})})]}),m.jsxs("div",{className:"rte-skill-actions",children:[m.jsxs("button",{type:"button",className:"rte-skill-import-btn",onClick:()=>a?.("import"),children:[m.jsx(v4,{}),m.jsx("span",{children:"导入技能"})]}),i&&m.jsxs("button",{type:"button",className:`rte-skill-create-btn${s?" rte-skill-create-btn-disabled":""}`,disabled:s,onClick:()=>!s&&a?.("create"),children:[m.jsx("i",{className:"iconfont icon-jiyudangqianduihuachuangjianjineng"}),m.jsx("span",{children:"基于当前会话创建技能"})]})]})]}),m.jsxs("div",{className:"rte-skill-panel-body",children:[m.jsx("div",{className:"rte-skill-sidebar",children:c4.map((C,ne)=>{const ie=g4[ne];return m.jsxs("div",{className:`rte-skill-sidebar-item${ne===u?" rte-skill-sidebar-item-active":""}`,onClick:()=>c(ne),children:[m.jsx(ie,{}),m.jsx("span",{children:C})]},C)})}),h?m.jsx("div",{className:"rte-skill-cards-status",style:H.current?{minHeight:H.current}:void 0,children:m.jsx(ue.Spin,{})}):d.length===0?m.jsx("div",{className:"rte-skill-cards-status",style:H.current?{minHeight:H.current}:void 0,children:!v&&m.jsxs(m.Fragment,{children:[m.jsx("img",{className:"rte-skill-empty-img",src:"https://sealseek-public-read.oss-cn-hangzhou.aliyuncs.com/file/website/kongzhuangtai.svg",alt:"暂无数据"}),m.jsx("span",{className:"rte-skill-empty-text",children:"暂无技能"})]})}):m.jsxs("div",{className:"rte-skill-cards",ref:L,onScroll:B,style:u!==0&&H.current?{minHeight:H.current}:void 0,children:[d.map(C=>m.jsx(A4,{card:C,selected:e===C.id,onClick:()=>q(C),onShare:()=>l?.("share",{id:C.id,title:C.title}),onEdit:()=>l?.("edit",{id:C.id,title:C.title}),onDelete:()=>G(C),onUse:()=>t?.({id:C.id,title:C.title,desc:C.desc||void 0,usageInstruction:C.usageInstruction}),getPopupContainer:A},C.id)),F&&m.jsx("div",{className:"rte-skill-cards-end",children:"暂无更多技能~"})]})]})]})});rb.displayName="SkillPanel";const fi=4,N4=()=>m.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:m.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"})}),ab=y.memo(({disabled:e,selectedSkill:t,onSkillSelect:n,onSkillCardClick:l,onSkillAction:r,skillListFetch:a,onSkillHeaderAction:i,showCreateSkill:s,skillPanelOpen:o,onSkillPanelOpenChange:u,createDisabled:c,skillPanelOpenDelay:d})=>{const[f,h]=y.useState(!1),b=o!==void 0,[v,g]=y.useState(o??!1),T=y.useRef(0);y.useEffect(()=>{if(b)return o?d&&d>0?T.current=window.setTimeout(()=>g(!0),d):g(!0):(window.clearTimeout(T.current),g(!1)),()=>window.clearTimeout(T.current)},[b,o,d]);const N=b?v:f,k=y.useCallback(E=>{const F=typeof E=="function"?E(N):E;b||h(F),u?.(F)},[b,N,u]),[M,O]=y.useState(null),S=y.useRef(null),_=y.useRef(null),I=Al(),A=y.useCallback(()=>(S.current?.closest(".rich-text-editor")??S.current)?.getBoundingClientRect()??null,[]),R=y.useCallback(()=>{const E=A();if(!E)return;const F=Math.max(0,window.innerHeight-E.bottom-fi*2),V=Math.max(0,E.top-fi*2),G=(_.current?.scrollHeight??0)>F&&V>F,C=G?V:F,ie=(_.current?.offsetParent??I)?.getBoundingClientRect(),P=ie?.left??0,fe=ie?.top??0,Ee=E.left-P;if(G){const ce=(ie?.height??window.innerHeight)-(E.top-fi-fe);O({left:Ee,bottom:ce,width:E.width,maxHeight:C})}else O({left:Ee,top:E.bottom+fi-fe,width:E.width,maxHeight:C})},[A,I]);y.useLayoutEffect(()=>{if(!N)return;R();const E=requestAnimationFrame(R);window.addEventListener("scroll",R,!0),window.addEventListener("resize",R);const F=_.current?new ResizeObserver(R):null;F&&_.current&&F.observe(_.current);const V=S.current?.closest(".rich-text-editor"),q=V?new ResizeObserver(R):null;return q&&V&&q.observe(V),()=>{cancelAnimationFrame(E),window.removeEventListener("scroll",R,!0),window.removeEventListener("resize",R),F?.disconnect(),q?.disconnect()}},[N,R]),y.useEffect(()=>{if(!N||b)return;const E=F=>{const V=F.target;S.current?.contains(V)||_.current?.contains(V)||V instanceof Element&&V.closest(".rte-skill-delete-confirm, .rte-skill-share-popover")||k(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[N,b]);const L=y.useCallback(()=>{e||k(E=>!E)},[e]),H=y.useCallback(E=>{n?.(E),E&&k(!1)},[n]),$=!!t,B=`rte-skill-badge${$?" rte-skill-badge-selected":N?" rte-skill-badge-active":""}`;return m.jsxs(m.Fragment,{children:[m.jsxs("div",{ref:S,className:B,onClick:L,"data-rte-skill-button":"true","aria-pressed":N||$,style:{cursor:e?"not-allowed":"pointer"},children:[m.jsx(N4,{}),m.jsx("span",{className:"rte-skill-text",children:"技能"})]}),N&&Si.createPortal(m.jsx("div",{ref:_,className:"rte-skill-panel-popup","data-placement":M?.bottom!==void 0?"top":"bottom",style:{position:"fixed",left:M?.left??0,top:M?.top,bottom:M?.bottom,width:M?.width,zIndex:9999,maxHeight:M?.maxHeight,display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:16,visibility:M?"visible":"hidden"},children:m.jsx(rb,{selectedId:t?.id??null,onSelect:H,onCardClick:l,onAction:r,skillListFetch:a,onHeaderAction:i,showCreateSkill:s,createDisabled:c})}),I??document.body)]})});ab.displayName="SkillButton";const w4=10*1024*1024,_4=50*1024*1024,I4="图片大小不能超过 10MB",O4="文件总大小不能超过 50MB",M4=e=>e.type?.startsWith("image/")||/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(e.name||""),D4=(e,t)=>{let n=!1;const l=t.filter(o=>M4(o)&&o.size>w4?(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>_4){s=!0;break}a.push(o),i+=o.size}return{accepted:a,imageOversize:n,totalExceeded:s}},ib=y.memo(({files:e,onChange:t,disabled:n})=>{const{message:l}=ue.App.useApp(),r=y.useRef(null),a=y.useCallback(s=>{const o=Array.from(s.target.files??[]);if(s.target.value="",o.length===0)return;const{accepted:u,imageOversize:c,totalExceeded:d}=D4(e,o);c&&l.error(I4),d&&l.error(O4),u.length>0&&t([...e,...u])},[e,t,l]),i=y.useCallback(()=>{n||r.current?.click()},[n]);return m.jsxs("div",{className:"rte-footer-upload",children:[m.jsx("div",{className:"rte-footer-upload-btn",onClick:i,title:"上传文件",style:{cursor:n?"not-allowed":"pointer",opacity:n?.6:1,pointerEvents:n?"none":"auto"},children:m.jsx("i",{className:"iconfont icon-lianjie",style:{fontSize:"16px"}})}),m.jsx("input",{ref:r,type:"file",multiple:!0,style:{display:"none"},onChange:a})]})});ib.displayName="UploadButton";const sb=y.memo(({onClick:e,loading:t,disabled:n})=>m.jsx("button",{type:"button",className:"rich-text-editor-send-button","data-testid":"rte-send-button",onClick:e,disabled:n||t,children:t?m.jsx("span",{className:"rte-send-spinner"}):m.jsx("i",{className:"iconfont icon-fasong"})}));sb.displayName="SendButton";const ob=y.memo(({currentAgent:e})=>{const t=e?.points;return t==null?null:m.jsxs("div",{className:"rte-points-badge",style:{position:"relative"},children:[m.jsx("i",{className:"iconfont icon-jifen",style:{marginRight:"4px",fontSize:"16px"}}),m.jsxs("span",{style:{fontSize:"16px",lineHeight:"22px"},children:["-",String(t)]}),e?.labelValue===2&&m.jsx("div",{className:"rte-limited-free-badge",children:m.jsx("span",{className:"rte-limited-free-text",children:"限时免费"})})]})});ob.displayName="PointsBadge";const ub=y.memo(({isProcessing:e,loading:t,disabled:n,sendDisabled:l,showFooterUpload:r=!0,footerFiles:a,onFooterFilesChange:i,agentOptions:s,onAgentSelect:o,onAgentDropdownOpenChange:u,hideAgentButton:c,currentAgent:d,selectedSkill:f,onSkillSelect:h,onSkillCardClick:b,onSkillAction:v,skillListFetch:g,onSkillHeaderAction:T,showCreateSkill:N,createDisabled:k,skillPanelOpen:M,onSkillPanelOpenChange:O,skillPanelOpenDelay:S,onSend:_,padding:I="12px 16px"})=>{const A=y.useCallback(R=>{if(R.reduce(($,B)=>$+B.size,0)>52428800){const $=[];let B=0;for(const E of R){if(B+E.size>52428800)break;$.push(E),B+=E.size}i($)}else i(R)},[i]);return m.jsxs("div",{className:"rich-text-editor-footer",style:{padding:I},children:[m.jsxs("div",{className:"rich-text-editor-footer-left",children:[m.jsxs("div",{className:"rich-text-editor-brand",children:[!c&&s&&s.length>0&&m.jsx(nb,{options:s,onSelect:o,disabled:n||e,currentAgent:d,onOpenChange:u}),m.jsx(ab,{disabled:n||e,selectedSkill:f,onSkillSelect:h,onSkillCardClick:b,onSkillAction:v,skillListFetch:g,onSkillHeaderAction:T,showCreateSkill:N,createDisabled:k,skillPanelOpen:M,onSkillPanelOpenChange:O,skillPanelOpenDelay:S})]}),r&&m.jsx(ib,{files:a,onChange:A,disabled:n||e})]}),m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[m.jsxs("div",{className:"rte-brand-badge",children:[m.jsx("div",{className:"rte-brand-badge",children:m.jsx("img",{src:"https://oospublic.sealseek.cn/file/website/ball.png",alt:""})}),m.jsx("span",{className:"rte-brand-text",style:{marginLeft:"4px"},children:"SealSeek 2.0"})]}),m.jsx(ob,{currentAgent:d}),m.jsx(sb,{onClick:_,loading:t||e,disabled:n||l})]})]})});ub.displayName="Footer";const L4=e=>e<1024?`${e}B`:e<1024*1024?`${Math.round(e/1024)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`,P4=e=>(e.type?.startsWith("image/")??!1)||/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(e.name||""),B4=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"},R4=({file:e,onRemove:t})=>{const n=P4(e),l=Af(n?e:null);return m.jsxs("div",{className:"rte-footer-file-chip",children:[n?m.jsx(ue.Image,{className:"rte-footer-file-thumb",width:32,height:32,src:l,alt:e.name,preview:{mask:null}}):m.jsx("div",{className:"rte-footer-file-icon",children:m.jsx("svg",{style:{width:"18px",height:"18px"},"aria-hidden":"true",children:m.jsx("use",{xlinkHref:`#${B4(e.name)}`})})}),m.jsxs("div",{className:"rte-footer-file-info",children:[m.jsx("span",{className:"rte-footer-file-name",title:e.name,children:e.name}),m.jsx("span",{className:"rte-footer-file-size",children:L4(e.size)})]}),m.jsx("span",{className:"rte-footer-file-remove",onClick:r=>{r.stopPropagation(),t()},children:m.jsx("i",{className:"iconfont icon-guanbi",style:{width:"8px",height:"8px",fontSize:"8px",display:"flex",alignItems:"center"}})})]})},cb=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:m.jsxs("div",{className:"rte-footer-files-wrapper",children:[l.showLeft&&m.jsx("div",{className:"rte-footer-files-mask rte-footer-files-mask-left",children:m.jsx("span",{className:"rte-footer-files-arrow rte-footer-files-arrow-left",onClick:()=>i(-1),children:m.jsx("svg",{style:{width:"16px",height:"16px",transform:"rotate(180deg)"},"aria-hidden":"true",children:m.jsx("use",{xlinkHref:"#icon-fanhuijiantou"})})})}),m.jsx("div",{className:"rte-footer-files-list",ref:n,onScroll:a,children:e.map((o,u)=>m.jsx(R4,{file:o,onRemove:s(u)},`${o.name}-${o.size}-${u}`))}),l.showRight&&m.jsx("div",{className:"rte-footer-files-mask rte-footer-files-mask-right",children:m.jsx("span",{className:"rte-footer-files-arrow rte-footer-files-arrow-right",onClick:()=>i(1),children:m.jsx("svg",{style:{width:"16px",height:"16px"},"aria-hidden":"true",children:m.jsx("use",{xlinkHref:"#icon-fanhuijiantou"})})})})]})});cb.displayName="FooterFilesList";const db=9999,F4=({messageRef:e})=>{const{message:t}=ue.App.useApp();return e.current=t,null},fb=y.memo(({title:e,onClose:t})=>m.jsx("span",{className:"tag-node group",contentEditable:!1,children:m.jsx("span",{className:"tag-label","data-tag-clickable":"true",onMouseDown:n=>{n.preventDefault(),n.stopPropagation()},onClick:n=>{n.preventDefault(),n.stopPropagation(),t()},children:e})}));fb.displayName="SkillTag";const hb=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:b,editorMinHeight:v,editorPadding:g,className:T,videoUrlParse:N,videoUpload:k,reportAnalyze:M,reportListFetch:O,onReportGoGenerate:S,reportNameResolve:_,onViewReport:I,hideCurrentSessionReport:A,markdownAnalyze:R,markdownNameAnalyze:L,agentOptions:H,onAgentSelect:$,onAgentExit:B,onSkillAction:E,onSkillCardClick:F,onSkillHeaderAction:V,skillListFetch:q,showCreateSkill:G,createDisabled:C,skillPanelOpen:ne,onSkillPanelOpenChange:ie,skillPanelOpenDelay:P,selectedSkill:fe,onSkillSelect:Ee,loading:Se,hideButtons:ce,footerPadding:xe,showFooterUpload:De,lockStructure:Ae=!0,collapsed:Me=!1,onCollapsedChange:Ft,collapseTransitionMs:ft=260,nodeDefaults:ql,onExpandedHeightChange:Rn,collapsedTotalHeight:ke,toggleOnBlankClick:Fe=!0,getPopupContainer:un,scrollContainerRef:Fn,autoCollapseOnScroll:Wl}=e,[Et,Hn]=y.useState({}),[wt,hi]=y.useState({}),[st,Y]=y.useState(u??[]),[J,be]=y.useState({}),[ve,Oe]=y.useState(o4),[Tt,en]=y.useState(()=>new Set),[Ht,$t]=y.useState({}),[_t,ht]=y.useState(null),Un=y.useCallback(()=>un?.()??_t??document.body,[un,_t]),It=y.useRef(null),[pi,J4]=y.useState(null),Z4=y.useCallback((z,re)=>{J4(re?z:null)},[]),ul=y.useRef(null),[ew,tw]=y.useState(58),[cl,Cb]=y.useState(58),[Jo,Sb]=y.useState(!1),xb=y.useRef(0),kb=y.useRef(Me),[bi,Ab]=y.useState(!1);kb.current!==Me&&(kb.current=Me,xb.current=(typeof performance<"u"?performance.now():Date.now())+ft,Ab(!0)),y.useEffect(()=>{if(!bi)return;const z=setTimeout(()=>Ab(!1),ft);return()=>clearTimeout(z)},[bi,Me,ft]);const[dl,Nb]=y.useState(""),Yr=y.useRef(null),wb=y.useRef(null),[Zo,_b]=y.useState(0),[eu,Ib]=y.useState(0),tu=y.useRef(!1);y.useEffect(()=>{if(!u||u.length===st.length&&u.every((ee,te)=>{const Z=st[te];return Z&&ee.name===Z.name&&ee.size===Z.size&&ee.lastModified===Z.lastModified}))return;const re=50*1024*1024;if(u.reduce((ee,te)=>ee+te.size,0)>re){const ee=[];let te=0;for(const Z of u){if(te+Z.size>re)break;ee.push(Z),te+=Z.size}Y(ee)}else tu.current=!0,Y(u)},[u]);const Ct=y.useMemo(()=>s4(t,ve,Tt),[t,ve,Tt]),nu=y.useRef(null),Ob=y.useRef(!1);y.useEffect(()=>{const z=t.find(re=>re.type==="tag")?.text??null;if(!Ob.current){Ob.current=!0,nu.current=z;return}nu.current!==z&&(nu.current=z,Y(re=>re.length===0?re:[]))},[t]);const jr=y.useMemo(()=>{const z=t.find(re=>re.type==="tag")?.text;if(!(!z||!H))return H.find(re=>re.label===z)},[t,H]),nw=y.useMemo(()=>t.some(z=>z.type==="tag"),[t]),lw=G??!nw;jN(i,Et,Hn,Ct,wt,hi);const Gr=y.useRef(new Map),Mb=y.useRef(""),Db=(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("|");Mb.current!==Db&&(Mb.current=Db,Gr.current=new Map);const[pt,mi]=y.useState(null);y.useEffect(()=>{fe!==void 0&&mi(fe)},[fe]);const Lb=y.useCallback(z=>{mi(z),Ee?.(z),z&&jr&&B?.("skill-switch")},[jr,B,Ee]),rw=y.useCallback(z=>{mi(null),$?.(z)},[$]);y.useEffect(()=>{jr&&mi(null)},[jr]);const{errors:aw,validate:Pb,clearError:Bb}=QN(Ct),{excludedKeys:Yl,hideSeparator:Rb}=ZN(Ct,Et,wt),{analyzeReport:gi,analyzeMarkdown:Fb,analyzeMarkdownName:Hb,resolveReportName:vi}=e4({reportAnalyze:M,markdownAnalyze:R,markdownNameAnalyze:L,reportNameResolve:_}),Ub=z=>typeof z!="string"?!z:z.replace(/<[^>]*>/g,"").replace(/&nbsp;/gi,"").replace(/\s/g,"").replace(/[​‌‍]/g,"").trim()==="",lu=y.useCallback((z,re)=>{Hn(ee=>({...ee,[z]:re})),Bb(z);const oe=/^(.+)__module_\d+$/.exec(z);if(oe&&Ub(re)){const ee=oe[1];Ct.find(Z=>Z.key===ee&&Z.type==="markdown-module")&&Hn(Z=>{const he={...Z,[z]:re};return Object.keys(he).filter(Te=>Te.startsWith(`${ee}__module_`)).every(Te=>Ub(he[Te]))&&(Oe(Te=>{if(!Te.markdownModules[ee])return Te;const Le={...Te.markdownModules};return delete Le[ee],{...Te,markdownModules:Le}}),Object.keys(he).filter(Te=>Te.startsWith(`${ee}__module_`)).forEach(Te=>delete he[Te]),he[ee]=""),he});return}if(typeof re=="string"&&re.trim()===""){const ee=Ct.find(te=>te.key===z);ee?.type==="report-url"?(Oe(te=>{if(!te.reportModules[z])return te;const Z={...te.reportModules};return delete Z[z],{...te,reportModules:Z}}),$t(te=>{if(!(z in te))return te;const Z={...te};return delete Z[z],Z})):(ee?.type==="markdown"||ee?.type==="markdown-name")&&Oe(te=>{if(!te.markdownModules[z])return te;const Z={...te.markdownModules};return delete Z[z],{...te,markdownModules:Z}})}},[Bb,Ct]),iw=y.useCallback((z,re)=>{hi(oe=>({...oe,[z]:re}))},[]),sw=y.useCallback((z,re)=>be(oe=>({...oe,[z]:re})),[]),ow=y.useCallback(z=>{$t(re=>{if(!(z in re))return re;const oe=z.match(/^(.+)_(\d+)$/);if(!oe){const Ne={...re};return delete Ne[z],Ne}const[,ee,te]=oe,Z=parseInt(te,10),he={};for(const[Ne,Te]of Object.entries(re)){if(Ne===z)continue;const Le=Ne.match(/^(.+)_(\d+)$/);if(Le&&Le[1]===ee){const Ot=parseInt(Le[2],10);Ot>Z?he[`${ee}_${Ot-1}`]=Te:he[Ne]=Te}else he[Ne]=Te}return he})},[]),uw=y.useCallback((z,re)=>{$t(oe=>{const ee=`${z}_`,te=[];for(const he of Object.keys(oe)){if(!he.startsWith(ee))continue;const Ne=he.slice(ee.length);/^\d+$/.test(Ne)&&te.push([Number(Ne),oe[he]])}if(te.length===0)return oe;const Z={...oe};for(const[he]of te)delete Z[`${z}_${he}`];for(const[he,Ne]of te){if(he===re)continue;const Te=he>re?he-1:he;Z[`${z}_${Te}`]=Ne}return Z})},[]),ru=y.useCallback(async(z,re,oe)=>{const ee=await vi(z,re,oe);return ee.status==="success"&&$t(te=>({...te,[z]:ee.name})),ee},[vi]),cw=y.useCallback((z,re)=>{gi(z,re).then(oe=>{oe.status==="success"&&Oe(ee=>({...ee,reportModules:{...ee.reportModules,[z]:oe.modules}}))})},[gi]),au=y.useCallback(async(z,re)=>{vi(z,re,"report-url").then(ee=>{ee.status==="success"&&$t(te=>({...te,[z]:ee.name}))});const oe=await gi(z,re);oe.status==="success"?(Oe(ee=>({...ee,reportModules:{...ee.reportModules,[z]:oe.modules}})),Hn(ee=>{const te={...ee};return oe.modules.forEach((Z,he)=>{te[`${z}__module_${he}`]=Z.content}),te})):oe.status==="failed"&&(lu(z,""),Hn(ee=>{let te=!1;const Z={...ee};for(const he of Object.keys(Z))he.startsWith(`${z}__module_`)&&(delete Z[he],te=!0);return te?Z:ee}))},[gi,vi,lu]);y.useEffect(()=>{if(!i||t.length===0)return;const z=t.filter(oe=>oe.type==="report-url"&&oe.key),re=t.filter(oe=>oe.type==="multi-variable-select"&&oe.key);if(!(z.length===0&&re.length===0)){for(const oe of z){const ee=oe.key,te=i[ee]??i[`${ee}__url`];if(!te||typeof te=="string"&&!te.trim())continue;const Z=Array.isArray(te)?String(te[0]??""):String(te);Z&&Gr.current.get(ee)!==Z&&(Gr.current.set(ee,Z),setTimeout(()=>{au(ee,Z)},100))}for(const oe of re){const ee=oe.key,te=i[ee];!Array.isArray(te)||te.length===0||te.forEach((Z,he)=>{const Ne=typeof Z=="string"?Z.trim():"";if(!Ne)return;const Te=`${ee}_${he}`;Gr.current.get(Te)!==Ne&&(Gr.current.set(Te,Ne),setTimeout(()=>{ru(Te,Ne,"multi-variable-select")},100))})}}},[i,t,au,ru]);const yi=y.useCallback(async(z,re,oe)=>{const te=Date.now();en(Z=>{const he=new Set(Z);return he.add(z),he});try{const Z=await oe(z,re),he=Date.now()-te;he<500&&await new Promise(Ne=>setTimeout(Ne,500-he)),Z&&(Oe(Ne=>({...Ne,markdownModules:{...Ne.markdownModules,[z]:Z.modules}})),Hn(Ne=>{const Te={...Ne};return Z.modules.forEach((Le,Ot)=>{Te[`${z}__module_${Ot}`]=Le.content}),Te}))}finally{en(Z=>{if(!Z.has(z))return Z;const he=new Set(Z);return he.delete(z),he})}},[]),dw=y.useCallback((z,re)=>yi(z,re,Fb),[yi,Fb]),fw=y.useCallback((z,re)=>yi(z,re,Hb),[yi,Hb]);y.useEffect(()=>{s?.(wt)},[wt,s]),y.useEffect(()=>{if(tu.current){tu.current=!1;return}o?.(st)},[st,o]);const iu=y.useCallback(async()=>{if(l||r)return;const z=pt?{skillCode:pt.id,skillName:pt.title}:void 0;if(t.length===0){const te=dl.trim();if(!te&&!st.length)return;const Z=pt?`【${pt.title}】${te}`:te;if(st.length){const he=new FormData;Z&&he.append("prompt",Z),st.forEach(Ne=>he.append("files",Ne)),n(he,Z,z)}else n(te,Z,z);Nb(""),Y([]);return}if(!Pb(Et,wt,Yl))return;const{formData:re,fullPrompt:oe,hasContent:ee}=await i4({config:Ct,values:Et,files:wt,footerFiles:st,markdownModules:ve.markdownModules,excludedKeys:Yl,hideSeparator:Rb});ee&&(n(re,oe,z),Y([]))},[t.length,dl,pt,Ct,Et,wt,st,ve.markdownModules,l,r,Pb,n,Yl]),hw=y.useCallback(z=>{z.key==="Enter"&&(z.nativeEvent.isComposing||z.keyCode===229||z.shiftKey||(z.preventDefault(),iu()))},[iu]),pw=y.useMemo(()=>t.length===0?dl.trim().length>0:KN(Ct,Et,wt,Yl),[t.length,dl,Ct,Et,wt,Yl]);y.useLayoutEffect(()=>{if(!pt){_b(0),Ib(0);return}const z=wb.current,re=z?.querySelector(".tag-node");if(!z||!re)return;const oe=re.getClientRects();if(oe.length===0)return;const ee=z.getBoundingClientRect().left,te=oe[0],Z=oe[oe.length-1];_b(Math.max(0,Z.right-ee-2)),Ib(Math.max(0,Math.round(Z.top-te.top)))},[pt,t.length]),y.useEffect(()=>{!pt||t.length>0||Yr.current?.focus()},[pt,t.length]);const zb=y.useRef(null),[bw,Vb]=y.useState(!1);y.useEffect(()=>{const z=re=>{const oe=zb.current;if(!oe)return;const ee=re.target;oe.contains(ee)||_t&&_t.contains(ee)?Vb(!0):Vb(!1)};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[_t]);const $b=y.useCallback(()=>{requestAnimationFrame(()=>{if(t.length===0){Yr.current?.focus();return}ul.current?.querySelector('textarea:not([disabled]), input:not([disabled]):not([type="hidden"]), [contenteditable="true"]')?.focus()})},[t.length]),mw=y.useCallback(z=>{ie?.(z),z&&$b()},[ie,$b]);y.useLayoutEffect(()=>{const z=Yr.current;z&&(z.style.height="auto",z.style.height=`${z.scrollHeight}px`)},[dl,Zo,eu]);const gw={width:c,background:d,border:f,maxHeight:h,...b&&!Me?{minHeight:b}:{},...v?{"--rte-editor-min-height":typeof v=="number"?`${v}px`:v}:{},...g?{"--rte-editor-padding":g}:{}},qb=typeof ke=="number"?ke:ew,Wb={maxHeight:Me?qb:Math.max(cl,qb),minHeight:Me||bi?0:void 0,overflow:Me||bi?"hidden":"auto",transition:Jo?"none":`max-height ${ft}ms cubic-bezier(0.4, 0, 0.2, 1)`,willChange:"max-height"},Yb=y.useCallback(()=>{Me&&Fe&&Ft?.(!1),Yr.current?.focus()},[Me,Fe,Ft]),jb=y.useRef(0),vw=y.useCallback(()=>{const z=ul.current,re=document.activeElement;!z||!re||!z.contains(re)||(jb.current=typeof performance<"u"?performance.now():Date.now())},[]),Ei=y.useCallback(()=>{const z=ul.current;if(z){if(!Me&&(typeof performance<"u"?performance.now():Date.now())>=xb.current){const oe=z.style.maxHeight;z.style.maxHeight="none";const ee=z.offsetHeight,te=z.scrollHeight,Z=z.parentElement;let he=1/0;if(Z){let Le=0;for(const Ti of Array.from(Z.children))Ti!==z&&(Le+=Ti.offsetHeight);const Ot=getComputedStyle(Z),su=parseFloat(Ot.paddingTop)+parseFloat(Ot.paddingBottom);he=Math.max(0,Z.clientHeight-Le-su)}z.style.maxHeight=oe;const Ne=Math.max(Math.ceil(te||0),Math.ceil(ee||0)),Te=Math.min(Ne,Math.ceil(he));Te>0&&Cb(Le=>Le===Te?Le:Te)}try{const re=z.getBoundingClientRect(),oe=z.querySelector(".rte-config-fade")??z,ee=document.createRange();ee.selectNodeContents(oe);const te=Array.from(ee.getClientRects()).filter(Z=>Z.height>0);if(te.length>0){const Z=Math.min(...te.map(fl=>fl.top)),he=parseFloat(getComputedStyle(z).lineHeight)||34,Ne=Math.max(he,1);let Te=Z+Ne*.6;for(let fl=0;fl<5;fl++){let Ci=Te;for(const Xb of te)Xb.top<Te&&(Ci=Math.max(Ci,Xb.bottom));if(Ci===Te)break;Te=Ci}const Le=Te>0?Math.ceil(Te-re.top):0,Ot=getComputedStyle(z),su=parseFloat(Ot.paddingTop)||0,Ti=Math.ceil(su+Ne),ou=Math.max(Le,Ti);ou>0&&tw(fl=>fl===ou?fl:ou)}}catch{}}},[Me]),jl=y.useMemo(()=>Ct.filter(z=>z.key&&z.type!=="report-module"&&z.type!=="markdown-module").map(z=>`${z.type}:${z.key}`).join("|"),[Ct]),Gb=y.useRef(jl);Gb.current!==jl&&(Gb.current=jl,Me||(Cb(db),Sb(!0))),y.useEffect(()=>{if(!Jo)return;const z=setTimeout(()=>Sb(!1),ft);return()=>clearTimeout(z)},[Jo,jl,ft]),y.useLayoutEffect(()=>{const z=ul.current;if(!z||(Ei(),typeof ResizeObserver>"u"))return;const re=()=>{const Z=ul.current;if(!Z)return;(typeof performance<"u"?performance.now():Date.now())-jb.current<600&&Z.contains(document.activeElement)&&Z.scrollHeight>Z.clientHeight&&(Z.scrollTop=Z.scrollHeight)},oe=new ResizeObserver(()=>Ei());oe.observe(z);const ee=z.querySelector(".rte-default-textarea, .rte-config-fade"),te=ee?new ResizeObserver(()=>{Ei(),re()}):null;return ee&&te&&te.observe(ee),()=>{oe.disconnect(),te?.disconnect()}},[Ei,Ct,wt,st.length,Ht,Me,jl,dl]);const Kb=y.useRef(-1);y.useEffect(()=>{Me||cl<=0||cl>=db||Kb.current!==cl&&(Kb.current=cl,Rn?.(cl))},[cl,Me,Rn]);const Qb=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"]),[]),yw=y.useCallback(z=>{const re=z.clipboardData?.files;if(!re||re.length===0||(z.preventDefault(),t.some(Le=>Le.type==="tag")))return;const ee=[];let te=!1;for(const Le of Array.from(re)){const Ot=(Le.name||"").split(".").pop()?.toLowerCase()||"";Qb.has(Ot)?ee.push(Le):te=!0}if(te&&It.current?.error("粘贴文件中含不支持的类型,已自动过滤"),ee.length===0)return;const Z=50*1024*1024,he=st.reduce((Le,Ot)=>Le+Ot.size,0),Ne=[];let Te=he;for(const Le of ee){if(Te+Le.size>Z){It.current?.error("文件总大小不能超过 50MB");break}Ne.push(Le),Te+=Le.size}Ne.length>0&&Y(Le=>[...Ne,...Le])},[Qb,t,st]);return m.jsx(ue.ConfigProvider,{getPopupContainer:Un,children:m.jsxs(ue.App,{component:!1,message:{getContainer:()=>_t??document.body},children:[m.jsx(F4,{messageRef:It}),m.jsxs(sf.Provider,{value:_t,children:[m.jsxs("div",{ref:zb,className:`rich-text-editor ${pi?"rte-richtext-container-expanded":""} ${bw?"rte-editor-selected":""} ${T??""}`,"data-component":"structured-editor",style:gw,onPaste:yw,children:[m.jsx(cb,{files:st,onChange:Y}),t.length===0?m.jsxs("div",{ref:ul,className:`rte-editor rte-editor-default${pt?" rte-editor-default-with-skill":""}`,style:Wb,onClick:Yb,children:[pt&&m.jsx("span",{ref:wb,className:"rte-skill-inline-tag-wrap",contentEditable:!1,children:m.jsx(fb,{title:pt.title,onClose:()=>Lb(null)})}),m.jsx("textarea",{ref:Yr,className:"rte-default-textarea",value:dl,onChange:z=>Nb(z.target.value),onKeyDown:hw,placeholder:pt?.usageInstruction||a||"",disabled:r,rows:1,style:{textIndent:Zo?`${Zo}px`:void 0,paddingTop:eu?`${eu}px`:void 0}})]}):m.jsx("div",{ref:ul,className:`rte-editor${pi?" rte-richtext-fullscreen-active":""}`,style:Wb,onClick:Yb,onInput:vw,children:m.jsx("div",{className:"rte-config-fade",children:Ct.map((z,re)=>{if(z.key&&Yl.has(z.key)||Rb&&z.exclusionGroup==="separator"||pi&&z.key!==pi)return null;const oe=(z.type==="report-module"||z.type==="markdown-module")&&z.key?`${z.key}__module_${z.moduleIndex??0}`:z.key;return m.jsx(G0,{node:z,value:oe?Et[oe]:void 0,files:wt,onChange:lu,onFileChange:iw,thumbnails:J,onThumbnailChange:sw,videoUrlParse:N,videoUpload:k,reportListFetch:O,onReportGoGenerate:S,onViewReport:I,hideCurrentSessionReport:A,reportNames:Ht,onClearReport:ow,onResolveMultiName:ru,onAnalyzeMultiReport:cw,onShiftReportNames:uw,onAgentExit:B,hideAgentClose:ce==="hideTagClose",onReportUrlParse:au,onMarkdownParse:dw,onMarkdownNameParse:fw,onRichtextExpandChange:Z4,disabled:r,error:oe?aw[oe]:void 0,index:re,nodeDefaults:ql},oe??`text-${re}`)})},jl)}),m.jsx(ub,{isProcessing:l,loading:Se,disabled:r,sendDisabled:!pw,showFooterUpload:De,footerFiles:st,onFooterFilesChange:Y,agentOptions:H,onAgentSelect:rw,hideAgentButton:ce==="hideAgent",currentAgent:jr,selectedSkill:pt,onSkillSelect:Lb,onSkillCardClick:F,onSkillAction:E,skillListFetch:q,onSkillHeaderAction:V,showCreateSkill:lw,createDisabled:C,skillPanelOpen:ne,onSkillPanelOpenChange:mw,skillPanelOpenDelay:P,onSend:iu,padding:xe})]}),m.jsx("div",{className:"rte-popup-host",ref:ht})]})]})})},pb="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAFSSURBVHgB3ZTtccIwDIaVXv83I2SDZgSP0BHMBG0naEZhA2boBGQDswHdQJUOGRxjO0Z8HPDe6eJzJD2W4gjgEYSIn2xwK6EIFHqBGysJpMP3ZB0oRbEtmal1NtIxl4OWWsoxEsvqofJ0rgTNASOYq+7SXKDsuYvAcgkq/PWwBLQWqIfdjeRStaBUc4qzgLi9/BzJNmS/sh6bpvmrTfSFacU3scWy1mQryWdSnXiFE8QVUJINLTuyhWzzz/1OZmTN9hEckqtfUOwIGlGCpVRjE+94JFqpMtTeVzO8/UmPxpZU8Qa7aln8Tb9pfwla4WHWrjPvvbbnTBsX7PmLs83EDAH0BxSw1G31+/1FoDg/vPcXR+wocQS1apj4+P92FfhOoLyuBfYlmPgYnGoCjWADzAkzUyJ430awLmphPaxWQVU22BuuApPkHaanjcXSN3t6/QNjTMSJWDcs1QAAAABJRU5ErkJggg==",H4=[{label:"5页",value:5},{label:"10页",value:10},{label:"15页",value:15},{label:"30页",value:30}],U4=({autoLoading:e,batchSize:t,loadingProgress:n,loadIcon:l,onBatchSizeChange:r,onLoadNextPage:a,onStartAutoLoad:i,onStopLoad:s})=>e&&n?m.jsxs("div",{className:"auto_load_progress",children:[l||m.jsx("img",{src:pb,alt:"自动加载",width:14,height:14}),m.jsxs("span",{children:["正在加载第",n.currentPage,"/",n.totalPages,"页"]}),m.jsx(ue.Progress,{percent:n.percentage,type:"line",size:[160,8]}),m.jsx("span",{onClick:s,className:"auto_load_stop_btn",children:"停止加载"})]}):m.jsxs("div",{className:"auto_load_container",children:[m.jsx("div",{onClick:a,className:"auto_load_next_btn",style:{backgroundColor:e?"#f5f5f5":"#2563eb"},children:"加载下一页"}),m.jsxs("div",{className:"right_control_wrap",style:{backgroundColor:e?"#f5f5f5":"#2563eb"},children:[m.jsxs("div",{className:"auto_load_btn",onClick:e?void 0:i,children:[l||m.jsx("img",{src:pb,alt:"自动加载",width:14,height:14}),m.jsx("span",{children:"自动加载"})]}),m.jsx(ue.Select,{value:t,onChange:r,options:H4,disabled:e,size:"small",className:"auto_load_select",popupMatchSelectWidth:84})]})]}),z4=({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),b=Math.ceil(l/n),v=y.useMemo(()=>r.length>=b,[r,b]),g=()=>Array.from({length:b},(k,M)=>M+1).filter(k=>!r.includes(k)).slice(0,f),T=(N,k,M)=>{const O=r.includes(N);return k==="prev"||k==="next"||k==="jump-prev"||k==="jump-next"?m.jsx("div",{className:"pageBox",children:M}):m.jsxs("div",{className:"pageBox",style:{backgroundColor:e===N?"#2563EB":"#f5f5f5",color:e===N?"#fff":O?"#171717":"#a3a3a3"},children:[N,!O&&m.jsx("span",{className:"unload_spot"})]})};return m.jsxs("div",{className:"pagination_footer",children:[m.jsxs("div",{className:"pagination_leftWrap",children:[m.jsxs("span",{className:"pagination_total",children:[m.jsx(qt.InfoCircleOutlined,{style:{color:"#2563EB",marginRight:"4px"}}),"已加载: ",a,"/",l,"条数据"]}),!v&&m.jsx(U4,{loadIcon:t||void 0,autoLoading:i,batchSize:f,loadingProgress:s,disabled:!u||!c,onBatchSizeChange:h,onLoadNextPage:()=>u?.(),onStartAutoLoad:()=>{const N=g();c?.(N)},onStopLoad:()=>d?.()})]}),m.jsx(ue.Pagination,{current:e,pageSize:n,total:l,onChange:N=>o(N),showSizeChanger:!1,showQuickJumper:!1,showTotal:()=>"",itemRender:T})]})},bb=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,...b}=e,v=y.useRef(null),g=y.useCallback(T=>{c(T),u.includes(T)&&v.current?.scrollTo({key:`${(T-1)*o+1}`})},[u,c,o]);return m.jsxs("div",{className:"flex flex-col",children:[m.jsx(ue.Table,{ref:v,...b,columns:r,dataSource:a,pagination:!1,virtual:!0}),m.jsx(z4,{loading:t,autoLoading:n,loadingProgress:l,current:s,pageSize:o,total:i,loadedCount:a.length,cachedPages:u,onChange:g,onLoadNextPage:d,onStartAutoLoad:f,onStopLoading:h})]})};bb.__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 mb=({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,b]=y.useState(!1),[v,g]=y.useState(!1),T=y.useRef(void 0),N=y.useRef(void 0),k=y.useRef(e),M=y.useRef(u),O=y.useRef(h),S=y.useRef(s);y.useEffect(()=>{k.current=e,M.current=u,O.current=h,S.current=s});const _=y.useCallback((B,E)=>{let F=0;g(!0);const V=()=>{F<B.length?(o(B.slice(0,F+1)),F++,N.current=window.setTimeout(V,n)):(g(!1),E?.())};V()},[n]),I=y.useCallback(B=>{let E=S.current.length;const F=()=>{E>0?(o(S.current.slice(0,E-1)),E--,N.current=window.setTimeout(F,n/2)):B?.()};F()},[n]),A=y.useCallback(()=>{if(k.current.length===0||O.current)return;f(!0);const B=k.current[M.current];S.current?I(()=>{_(B,()=>{T.current=window.setTimeout(()=>{c(E=>(E+1)%k.current.length),f(!1)},2e3)})}):_(B,()=>{T.current=window.setTimeout(()=>{c(E=>(E+1)%k.current.length),f(!1)},2e3)})},[I,_]);y.useEffect(()=>(l&&e.length>0&&!h&&A(),()=>{T.current&&window.clearTimeout(T.current),N.current&&window.clearTimeout(N.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=>{b(!0),T.current&&window.clearTimeout(T.current),N.current&&window.clearTimeout(N.current),f(!1),g(!1),i.onFocus?.(B)},L=B=>{b(!1),!r&&e.length>0&&(o(""),c(0)),i.onBlur?.(B)},H=B=>{a?.(B.target.value),i.onChange?.(B)},$=()=>h||r?t:s||t;return m.jsxs("div",{style:{position:"relative"},children:[m.jsx(ue.Input,{...i,value:r,onChange:H,onFocus:R,onBlur:L,placeholder:$(),style:{...i.style,position:"relative",zIndex:1}}),!h&&!r&&s&&m.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:[m.jsx("span",{children:s}),v&&m.jsx("span",{style:{display:"inline-block",width:1,height:"1.2em",backgroundColor:"#1890ff",marginLeft:2,animation:"blink 1s infinite"}})]}),m.jsx("style",{children:`
147
147
  @keyframes blink {
148
148
  0%, 50% { opacity: 1; }
149
149
  51%, 100% { opacity: 0; }