bi-components-library 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +2 -2
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
${(e||"").replace(/\r\n/g,`
|
|
15
15
|
`)}
|
|
16
16
|
\`\`\``,ki=e=>{const t=(e||"").replace(/\r\n/g,`
|
|
17
|
-
`).trim(),n=t.match(/^```[a-zA-Z0-9_-]*\n([\s\S]*?)\n```$/);return n?`<pre><code>${ie(n[1]||"")}</code></pre>`:`<div style="white-space:pre-wrap;">${ie(t)}</div>`},kl=({config:e,messageApi:t,activeBatchKey:n,activeFileKey:r,activeBatchStartIndex:a,setActiveFileKey:i,setActiveBatchKey:s,setActiveBatchStartIndex:o,setFiles:u})=>{const l=L.useCallback(p=>{if(!p.target.files){p.target&&(p.target.value=""),i(null),s(null),o(null);return}const E=10*1024*1024,c=h=>h.type?.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(h.name||""),y=h=>c(h)&&h.size>E;if(n&&p.target.files&&p.target.files.length>0){const h=n,m=e.find(_=>_.type==="upload"&&_.key===h),g=Array.from(p.target.files),b=g.filter(_=>!y(_)),T=g.length-b.length;if(T>0&&t.error(`已自动过滤 ${T} 张超过 10MB 的图片,仅允许上传 10MB 以内图片`),m&&typeof m.maxCount=="number"&&typeof m.minCount=="number"){const _=m.maxCount,w=typeof a=="number"?a:0;u(C=>{const O={...C};let A=Math.min(Math.max(w,0),_-1);for(const S of b){for(;A<_&&O[`${h}-${A}`]!=null;)A+=1;if(A>=_)break;O[`${h}-${A}`]=S,A+=1}return O})}}else if(r&&p.target.files[0]){const h=p.target.files[0],m=r;y(h)?t.error("图片大小不能超过 10MB(仅允许上传 10MB 以内图片)"):u(g=>({...g,[m]:h}))}p.target&&(p.target.value=""),i(null),s(null),o(null)},[n,a,r,e,t,s,o,i,u]),d=L.useCallback(p=>{u(E=>{const c={...E};return delete c[p],c})},[u]);return{handleFileChange:l,handleRemoveFile:d}};function wl(e){const t=e.trim();try{const r=new URL(t);if(r.protocol==="http:"||r.protocol==="https:")return t}catch{}const n=t.match(/https?:\/\/[^\s\u4e00-\u9fff\u3000-\u303f\uff00-\uffef]+/);return n?n[0]:t}function Nl(e){return new Promise((t,n)=>{const r=document.createElement("video"),a=URL.createObjectURL(e);r.preload="auto",r.muted=!0,r.src=a,r.onloadeddata=()=>{r.currentTime=0},r.onseeked=()=>{try{const i=document.createElement("canvas");i.width=r.videoWidth,i.height=r.videoHeight;const s=i.getContext("2d");if(!s)return URL.revokeObjectURL(a),n(new Error("canvas context unavailable"));s.drawImage(r,0,0,i.width,i.height);const o=i.toDataURL("image/jpeg",.7);URL.revokeObjectURL(a),t(o)}catch(i){URL.revokeObjectURL(a),n(i)}},r.onerror=()=>{URL.revokeObjectURL(a),n(new Error("video load error"))}})}function Il(e){return new Promise(t=>{const n=document.createElement("video");n.crossOrigin="anonymous",n.preload="auto",n.muted=!0,n.playsInline=!0,n.src=e;const r=setTimeout(()=>{a(),t("")},1e4),a=()=>{clearTimeout(r),n.onloadeddata=null,n.onseeked=null,n.onerror=null};n.onloadeddata=()=>{n.currentTime=0},n.onseeked=()=>{try{const i=document.createElement("canvas");i.width=n.videoWidth||320,i.height=n.videoHeight||180;const s=i.getContext("2d");if(s){s.drawImage(n,0,0,i.width,i.height);const o=i.toDataURL("image/jpeg",.7);a(),t(o)}else a(),t("")}catch{a(),t("")}},n.onerror=()=>{a(),t("")}})}function Ll(e,t,n,r,a=[]){const i=L.useRef(n);i.current=n;const s=L.useCallback(async(o,u)=>{if(!t||!u.trim())return;const l=wl(u);r(c=>({...c,[o]:{status:"loading",progress:0}}));const d=2*Math.PI*6.5;let p=0;const E=setInterval(()=>{p=Math.min(p+Math.random()*15+5,90);const c=e.current?.querySelector(`[data-type="video-url"][data-key="${o}"] .video-upload-progress-ring circle:last-child`);c&&c.setAttribute("stroke-dashoffset",String(d*(1-p/100)))},400);try{const c=await t({url:l});if(clearInterval(E),r(y=>({...y,[o]:{status:"success",videoUrl:c.videoUrl,thumbnail:c.thumbnail||"",fileName:l}})),!c.thumbnail&&c.videoUrl){const y=`/api/download-report-pdf?url=${encodeURIComponent(c.videoUrl)}`;Il(y).then(h=>{h&&r(m=>{const g=m[o];return!g||g.status!=="success"?m:{...m,[o]:{...g,thumbnail:h}}})})}}catch(c){clearInterval(E),r(y=>({...y,[o]:{status:"error",errorMsg:c instanceof Error?c.message:"解析失败"}}))}},[t,r,e]);L.useEffect(()=>{const o=e.current;if(!o||!t)return;const u=d=>{const p=d.target?.closest?.('[data-node-type="video-url"]');if(!p)return;const E=p.dataset.key;E&&setTimeout(()=>{const c=(p.innerText||"").replace(/\u200B/g,"").trim();c&&s(E,c)},0)},l=d=>{const p=d.target?.closest?.('[data-node-type="video-url"]');if(!p)return;const E=p.dataset.key;if(!E)return;const c=i.current[E];if(c?.status==="success"||c?.status==="loading")return;const y=(p.innerText||"").replace(/\u200B/g,"").trim();y&&s(E,y)};return o.addEventListener("paste",u,!0),o.addEventListener("focusout",l,!0),()=>{o.removeEventListener("paste",u,!0),o.removeEventListener("focusout",l,!0)}},[e,t,s,...a])}function Ol(e,t){return L.useCallback(async(n,r)=>{if(!e)return;t(s=>({...s,[n]:{status:"loading",file:r,fileName:r.name,progress:0}}));const a=await Nl(r).catch(()=>"");a&&t(s=>{const o=s[n];return!o||o.status!=="loading"?s:{...s,[n]:{...o,thumbnail:a}}});const i=s=>{t(o=>{const u=o[n];return!u||u.status!=="loading"?o:{...o,[n]:{...u,progress:s}}})};try{const s=await e(r,i);t(o=>({...o,[n]:{status:"success",videoUrl:s.videoUrl,thumbnail:s.thumbnail||a,file:r,fileName:r.name}}))}catch(s){t(o=>({...o,[n]:{status:"error",file:r,fileName:r.name,errorMsg:s instanceof Error?s.message:"上传失败"}}))}},[e,t])}function Dl(e,t,n,r){L.useEffect(()=>{const a=e.current;if(!a)return;const i=o=>{const u=o.target?.closest?.('[data-type="video-url"], [data-type="video-upload"]');if(!u)return;const l=u.dataset.key;if(!l)return;const d=t[l];d?.status==="success"&&d.videoUrl&&n({key:l,anchorEl:u,type:"video-preview"})},s=o=>{if(r)return;const u=o.target?.closest?.('[data-type="video-url"], [data-type="video-upload"]');if(!u)return;const l=o.relatedTarget;l?.closest?.(".rte-tooltip-overlay")||l&&u.contains(l)||n(null)};return a.addEventListener("mouseover",i,!0),a.addEventListener("mouseout",s,!0),()=>{a.removeEventListener("mouseover",i,!0),a.removeEventListener("mouseout",s,!0)}},[e,t,n,r])}const Pl=e=>{const t=e.trim();if(!t)return{url:""};let n=null;try{n=new URL(t)}catch{try{n=new URL(`https://${t}`)}catch{return{url:t}}}const r=n.pathname.split("/").filter(Boolean),a=r.findIndex(u=>u==="report"),i=a>=0?r[a+1]:void 0,s=r[0]&&r[0].length<=5?r[0]:void 0,o=n.searchParams.get("agentId")||void 0;return{url:t,reportId:i,agentId:o,lang:s}},Ml=e=>(e?.modules||[]).map((t,n)=>{const r=(t?.title||`模块${n+1}`).trim()||`模块${n+1}`,a=(t?.content||"").trim();return{title:r,content:a.length>0?a:`请补充:${r}`}}),kr=e=>(e?.modules||[]).map((t,n)=>{const r=(t?.title||`模块${n+1}`).trim()||`模块${n+1}`,a=(t?.markdown||"").trim(),i=(t?.content||"").trim()||(a?ki(a):"");return{title:r,content:i.length>0?i:`请补充:${r}`,markdown:a}}),Bl=({config:e,editorRef:t,files:n,setFiles:r,multiVariableCounts:a,setMultiVariableCounts:i,reportAnalyzeState:s,setReportAnalyzeState:o,markdownAnalyzeState:u,setMarkdownAnalyzeState:l,markdownNameAnalyzeState:d,setMarkdownNameAnalyzeState:p,nodeValues:E})=>{const c=L.useRef({}),y=L.useRef({}),h=L.useRef({}),m=L.useRef(s),g=L.useRef(u),b=L.useRef(d),T=L.useCallback(C=>C.find(A=>A.type==="tag")?.text||null,[]),_=L.useRef(e),w=L.useRef(null);L.useEffect(()=>{y.current=n},[n]),L.useEffect(()=>{h.current=a},[a]),L.useEffect(()=>{m.current=s},[s]),L.useEffect(()=>{g.current=u},[u]),L.useEffect(()=>{b.current=d},[d]),L.useEffect(()=>{const C=T(_.current),O=T(e);if(C&&C!==O&&t.current){const A={};t.current.querySelectorAll('[data-type="variable"]').forEach(B=>{const N=B.dataset.key;if(N){const x=B.innerText.replace(/[\u200B\n]/g,"").trim();x&&(A[N]=x)}}),t.current.querySelectorAll('[data-type="select"]').forEach(B=>{const N=B.dataset.key;if(N){const x=(B.getAttribute("data-value")||"").trim();x&&(A[N]=x)}}),t.current.querySelectorAll('[data-type="searchable-select"]').forEach(B=>{const N=B.dataset.key;if(N){const x=(B.getAttribute("data-value")||"").trim();x&&(A[N]=x)}}),t.current.querySelectorAll('[data-type="textarea"]').forEach(B=>{const N=B.dataset.key;if(N){const x=B.value.replace(/[\u200B]/g,"").trim();x&&(A[N]=x)}}),c.current[C]={variableValues:A,files:{...y.current},multiVariableCounts:{...h.current},reportAnalyzeState:{...m.current},markdownAnalyzeState:{...g.current},markdownNameAnalyzeState:{...b.current}}}if(O&&c.current[O]){const A=c.current[O];w.current=A,r(A.files),i(A.multiVariableCounts),o(A.reportAnalyzeState),l(A.markdownAnalyzeState),p(A.markdownNameAnalyzeState)}else if(O){w.current=null;const A={};e.forEach(S=>{if(S.type==="multi-variable"&&S.key){const k=E?.[S.key];Array.isArray(k)&&k.length>0?A[S.key]=Math.min(k.length,S.maxCount??9):A[S.key]=1}}),i(A),r({}),o({}),l({}),p({})}else w.current=null,i({}),r({}),o({}),l({}),p({});_.current=e},[e,t,T,r,i,o,l,p]),L.useLayoutEffect(()=>{w.current&&t.current&&(t.current.__tempVariableValues=w.current.variableValues,setTimeout(()=>{w.current&&(w.current=null)},0))})},Rl=e=>{const t={},n=e.current;return n&&(n.querySelectorAll('[data-type="variable"]').forEach(r=>{const a=r.dataset.key;if(!a)return;if(r.dataset.variableRender==="antd-textarea"){const s=(r.getAttribute("data-value")||"").trim();if(!s)return;try{const u=(decodeURIComponent(s)||"").replace(/\r\n/g,`
|
|
17
|
+
`).trim(),n=t.match(/^```[a-zA-Z0-9_-]*\n([\s\S]*?)\n```$/);return n?`<pre><code>${ie(n[1]||"")}</code></pre>`:`<div style="white-space:pre-wrap;">${ie(t)}</div>`},kl=({config:e,messageApi:t,activeBatchKey:n,activeFileKey:r,activeBatchStartIndex:a,setActiveFileKey:i,setActiveBatchKey:s,setActiveBatchStartIndex:o,setFiles:u})=>{const l=L.useCallback(p=>{if(!p.target.files){p.target&&(p.target.value=""),i(null),s(null),o(null);return}const E=10*1024*1024,c=h=>h.type?.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(h.name||""),y=h=>c(h)&&h.size>E;if(n&&p.target.files&&p.target.files.length>0){const h=n,m=e.find(_=>_.type==="upload"&&_.key===h),g=Array.from(p.target.files),b=g.filter(_=>!y(_)),T=g.length-b.length;if(T>0&&t.error(`已自动过滤 ${T} 张超过 10MB 的图片,仅允许上传 10MB 以内图片`),m&&typeof m.maxCount=="number"&&typeof m.minCount=="number"){const _=m.maxCount,w=typeof a=="number"?a:0;u(C=>{const O={...C};let A=Math.min(Math.max(w,0),_-1);for(const S of b){for(;A<_&&O[`${h}-${A}`]!=null;)A+=1;if(A>=_)break;O[`${h}-${A}`]=S,A+=1}return O})}}else if(r&&p.target.files[0]){const h=p.target.files[0],m=r;y(h)?t.error("图片大小不能超过 10MB(仅允许上传 10MB 以内图片)"):u(g=>({...g,[m]:h}))}p.target&&(p.target.value=""),i(null),s(null),o(null)},[n,a,r,e,t,s,o,i,u]),d=L.useCallback(p=>{u(E=>{const c={...E};return delete c[p],c})},[u]);return{handleFileChange:l,handleRemoveFile:d}};function wl(e){const t=e.trim();try{const r=new URL(t);if(r.protocol==="http:"||r.protocol==="https:")return t}catch{}const n=t.match(/https?:\/\/[^\s\u4e00-\u9fff\u3000-\u303f\uff00-\uffef]+/);return n?n[0]:t}function Nl(e){return new Promise((t,n)=>{const r=document.createElement("video"),a=URL.createObjectURL(e);r.preload="auto",r.muted=!0,r.src=a,r.onloadeddata=()=>{r.currentTime=0},r.onseeked=()=>{try{const i=document.createElement("canvas");i.width=r.videoWidth,i.height=r.videoHeight;const s=i.getContext("2d");if(!s)return URL.revokeObjectURL(a),n(new Error("canvas context unavailable"));s.drawImage(r,0,0,i.width,i.height);const o=i.toDataURL("image/jpeg",.7);URL.revokeObjectURL(a),t(o)}catch(i){URL.revokeObjectURL(a),n(i)}},r.onerror=()=>{URL.revokeObjectURL(a),n(new Error("video load error"))}})}function Il(e){return new Promise(t=>{const n=document.createElement("video");n.crossOrigin="anonymous",n.preload="auto",n.muted=!0,n.playsInline=!0,n.src=e;const r=setTimeout(()=>{a(),t("")},1e4),a=()=>{clearTimeout(r),n.onloadeddata=null,n.onseeked=null,n.onerror=null};n.onloadeddata=()=>{n.currentTime=0},n.onseeked=()=>{try{const i=document.createElement("canvas");i.width=n.videoWidth||320,i.height=n.videoHeight||180;const s=i.getContext("2d");if(s){s.drawImage(n,0,0,i.width,i.height);const o=i.toDataURL("image/jpeg",.7);a(),t(o)}else a(),t("")}catch{a(),t("")}},n.onerror=()=>{a(),t("")}})}function Ll(e,t,n,r,a=[]){const i=L.useRef(n);i.current=n;const s=L.useCallback(async(o,u)=>{if(!t||!u.trim())return;const l=wl(u);r(c=>({...c,[o]:{status:"loading",progress:0}}));const d=2*Math.PI*6.5;let p=0;const E=setInterval(()=>{p=Math.min(p+Math.random()*15+5,90);const c=e.current?.querySelector(`[data-type="video-url"][data-key="${o}"] .video-upload-progress-ring circle:last-child`);c&&c.setAttribute("stroke-dashoffset",String(d*(1-p/100)))},400);try{const c=await t({url:l});if(clearInterval(E),r(y=>({...y,[o]:{status:"success",videoUrl:c.videoUrl,thumbnail:c.thumbnail||"",fileName:l}})),!c.thumbnail&&c.videoUrl){const y=`/api/download-report-pdf?url=${encodeURIComponent(c.videoUrl)}`;Il(y).then(h=>{h&&r(m=>{const g=m[o];return!g||g.status!=="success"?m:{...m,[o]:{...g,thumbnail:h}}})})}}catch(c){clearInterval(E),r(y=>({...y,[o]:{status:"error",errorMsg:c instanceof Error?c.message:"解析失败"}}))}},[t,r,e]);L.useEffect(()=>{const o=e.current;if(!o||!t)return;const u=d=>{const p=d.target?.closest?.('[data-node-type="video-url"]');if(!p)return;const E=p.dataset.key;E&&setTimeout(()=>{const c=(p.innerText||"").replace(/\u200B/g,"").trim();c&&s(E,c)},0)},l=d=>{const p=d.target?.closest?.('[data-node-type="video-url"]');if(!p)return;const E=p.dataset.key;if(!E)return;const c=i.current[E];if(c?.status==="success"||c?.status==="loading")return;const y=(p.innerText||"").replace(/\u200B/g,"").trim();y&&s(E,y)};return o.addEventListener("paste",u,!0),o.addEventListener("focusout",l,!0),()=>{o.removeEventListener("paste",u,!0),o.removeEventListener("focusout",l,!0)}},[e,t,s,...a])}function Ol(e,t){return L.useCallback(async(n,r)=>{if(!e)return;t(s=>({...s,[n]:{status:"loading",file:r,fileName:r.name,progress:0}}));const a=await Nl(r).catch(()=>"");a&&t(s=>{const o=s[n];return!o||o.status!=="loading"?s:{...s,[n]:{...o,thumbnail:a}}});const i=s=>{t(o=>{const u=o[n];return!u||u.status!=="loading"?o:{...o,[n]:{...u,progress:s}}})};try{const s=await e(r,i);t(o=>({...o,[n]:{status:"success",videoUrl:s.videoUrl,thumbnail:s.thumbnail||a,file:r,fileName:r.name}}))}catch(s){t(o=>({...o,[n]:{status:"error",file:r,fileName:r.name,errorMsg:s instanceof Error?s.message:"上传失败"}}))}},[e,t])}function Dl(e,t,n,r){L.useEffect(()=>{const a=e.current;if(!a)return;const i=o=>{const u=o.target?.closest?.('[data-type="video-url"], [data-type="video-upload"]');if(!u)return;const l=u.dataset.key;if(!l)return;const d=t[l];d?.status==="success"&&d.videoUrl&&n({key:l,anchorEl:u,type:"video-preview"})},s=o=>{if(r)return;const u=o.target?.closest?.('[data-type="video-url"], [data-type="video-upload"]');if(!u)return;const l=o.relatedTarget;l?.closest?.(".rte-tooltip-overlay")||l&&u.contains(l)||n(null)};return a.addEventListener("mouseover",i,!0),a.addEventListener("mouseout",s,!0),()=>{a.removeEventListener("mouseover",i,!0),a.removeEventListener("mouseout",s,!0)}},[e,t,n,r])}const Pl=e=>{const t=e.trim();if(!t)return{url:""};let n=null;try{n=new URL(t)}catch{try{n=new URL(`https://${t}`)}catch{return{url:t}}}const r=n.pathname.split("/").filter(Boolean),a=r.findIndex(u=>u==="report"),i=a>=0?r[a+1]:void 0,s=r[0]&&r[0].length<=5?r[0]:void 0,o=n.searchParams.get("agentId")||void 0;return{url:t,reportId:i,agentId:o,lang:s}},Ml=e=>(e?.modules||[]).map((t,n)=>{const r=(t?.title||`模块${n+1}`).trim()||`模块${n+1}`,a=(t?.content||"").trim();return{title:r,content:a.length>0?a:`请补充:${r}`}}),kr=e=>(e?.modules||[]).map((t,n)=>{const r=(t?.title||`模块${n+1}`).trim()||`模块${n+1}`,a=(t?.markdown||"").trim(),i=(t?.content||"").trim()||(a?ki(a):"");return{title:r,content:i.length>0?i:`请补充:${r}`,markdown:a}}),Bl=({config:e,editorRef:t,files:n,setFiles:r,multiVariableCounts:a,setMultiVariableCounts:i,reportAnalyzeState:s,setReportAnalyzeState:o,markdownAnalyzeState:u,setMarkdownAnalyzeState:l,markdownNameAnalyzeState:d,setMarkdownNameAnalyzeState:p,nodeValues:E})=>{const c=L.useRef({}),y=L.useRef({}),h=L.useRef({}),m=L.useRef(s),g=L.useRef(u),b=L.useRef(d),T=L.useCallback(C=>C.find(A=>A.type==="tag")?.text||null,[]),_=L.useRef(e),w=L.useRef(null);L.useEffect(()=>{y.current=n},[n]),L.useEffect(()=>{h.current=a},[a]),L.useEffect(()=>{m.current=s},[s]),L.useEffect(()=>{g.current=u},[u]),L.useEffect(()=>{b.current=d},[d]),L.useEffect(()=>{const C=T(_.current),O=T(e);if(C&&C!==O&&t.current){const A={};t.current.querySelectorAll('[data-type="variable"]').forEach(B=>{const N=B.dataset.key;if(N){const x=B.innerText.replace(/[\u200B\n]/g,"").trim();x&&(A[N]=x)}}),t.current.querySelectorAll('[data-type="select"]').forEach(B=>{const N=B.dataset.key;if(N){const x=(B.getAttribute("data-value")||"").trim();x&&(A[N]=x)}}),t.current.querySelectorAll('[data-type="searchable-select"]').forEach(B=>{const N=B.dataset.key;if(N){const x=(B.getAttribute("data-value")||"").trim();x&&(A[N]=x)}}),t.current.querySelectorAll('[data-type="textarea"]').forEach(B=>{const N=B.dataset.key;if(N){const x=B.value.replace(/[\u200B]/g,"").trim();x&&(A[N]=x)}}),c.current[C]={variableValues:A,files:{...y.current},multiVariableCounts:{...h.current},reportAnalyzeState:{...m.current},markdownAnalyzeState:{...g.current},markdownNameAnalyzeState:{...b.current}}}if(O&&c.current[O]){const A=c.current[O];w.current=A,r(A.files),i(A.multiVariableCounts),o(A.reportAnalyzeState),l(A.markdownAnalyzeState),p(A.markdownNameAnalyzeState)}else if(O){w.current=null;const A={};e.forEach(S=>{if(S.type==="multi-variable"&&S.key){const k=E?.[S.key];Array.isArray(k)&&k.length>0?A[S.key]=Math.min(k.length+1,S.maxCount??9):A[S.key]=1}}),i(A),r({}),o({}),l({}),p({})}else w.current=null,i({}),r({}),o({}),l({}),p({});_.current=e},[e,t,T,r,i,o,l,p]),L.useLayoutEffect(()=>{w.current&&t.current&&(t.current.__tempVariableValues=w.current.variableValues,setTimeout(()=>{w.current&&(w.current=null)},0))})},Rl=e=>{const t={},n=e.current;return n&&(n.querySelectorAll('[data-type="variable"]').forEach(r=>{const a=r.dataset.key;if(!a)return;if(r.dataset.variableRender==="antd-textarea"){const s=(r.getAttribute("data-value")||"").trim();if(!s)return;try{const u=(decodeURIComponent(s)||"").replace(/\r\n/g,`
|
|
18
18
|
`).trim();u&&(t[a]=u)}catch{const o=s.trim();o&&(t[a]=o)}return}const i=(r.innerText||"").replace(/\u200B/g,"").replace(/\r\n/g,`
|
|
19
19
|
`).trim();if(i){const s=r.getAttribute("data-node-type")||"";s==="report-url"?t[`${a}__url`]=i:s==="markdown-name"?t[`${a}__name`]=i:t[a]=i}}),n.querySelectorAll('[data-type="select"]').forEach(r=>{const a=r.dataset.key;if(!a)return;const i=(r.getAttribute("data-value")||"").trim();i&&(t[a]=i)}),n.querySelectorAll('[data-type="textarea"]').forEach(r=>{const a=r.dataset.key;if(!a)return;const i=r.value.replace(/[\u200B]/g,"").trim();i&&(t[a]=i)}),n.querySelectorAll('[data-type="richtext"]').forEach(r=>{const a=r.dataset.key;if(!a)return;const i=r.getAttribute("data-node-type")||"";if(i==="report-module"||i==="markdown-module"){const o=Number.parseInt(r.getAttribute("data-module-index")||"0",10),u=(r.innerHTML||"").replace(/[\u200B]/g,"").trim();t[`${a}__module_${Number.isFinite(o)?o:0}`]=u;return}const s=(r.textContent||"").replace(/[\u200B]/g,"").trim();s&&(t[a]=s)}),n.querySelectorAll('[data-type="datepicker"]').forEach(r=>{const a=r.dataset.key;if(!a)return;const i=(r.getAttribute("data-value")||"").trim();i&&(t[a]=i)}),n.querySelectorAll('[data-type="number-input"]').forEach(r=>{const a=r.dataset.key;if(!a)return;const i=(r.value||"").trim();i&&(t[a]=i)}),n.querySelectorAll('[data-type="searchable-select"]').forEach(r=>{const a=r.dataset.key;if(!a)return;const i=(r.getAttribute("data-value")||"").trim();i&&(t[a]=i)})),t},Fl=({reportAnalyze:e,markdownAnalyze:t,markdownNameAnalyze:n,reportAnalyzeState:r,setReportAnalyzeState:a,markdownAnalyzeState:i,setMarkdownAnalyzeState:s,markdownNameAnalyzeState:o,setMarkdownNameAnalyzeState:u,editorRef:l,reportAnalyzeRef:d,markdownAnalyzeRef:p,markdownNameAnalyzeRef:E,markdownAnalyzeStateRef:c,markdownNameAnalyzeStateRef:y})=>{const h=L.useCallback(()=>Rl(l),[l]),m=L.useCallback((C,O)=>{const A=(O||"").trim();if(!C)return;if(!A){a(M=>({...M,[C]:{status:"idle",modules:[],lastParsedUrl:void 0,error:void 0}}));return}const S=r[C];if(S?.lastParsedUrl&&S.lastParsedUrl===A&&(S.status==="loading"||S.status==="success"))return;a(M=>({...M,[C]:{...M[C],status:"loading",error:void 0,lastParsedUrl:A}}));const k=Pl(A);(e||(async M=>({modules:[{title:"第1张:人群+场景直击图",content:`视觉要求:养宠人在客厅场景中,宠物(猫/狗)自然趴在旁;画面聚焦“人+宠+整洁氛围”。
|
|
20
20
|
(reportId=${M.reportId||"unknown"}, agentId=${M.agentId||"1"})`},{title:"第2张:痛点放大对比图",content:"左侧:杂乱堆放、难清理;右侧:分区收纳、拿取方便。文案≤15字,绑定人群+场景+需求。"}]})))(k).then(M=>{const B=Ml(M);if(l.current){const N=h();B.forEach((x,H)=>{N[`${C}__module_${H}`]=x.content}),l.current.__tempVariableValues=N}a(N=>({...N,[C]:{status:"success",error:void 0,lastParsedUrl:A,modules:B}}))}).catch(M=>{const B=M instanceof Error?M.message:String(M);a(N=>({...N,[C]:{...N[C]||{modules:[]},status:"error",error:B||"解析失败",lastParsedUrl:A,modules:[]}}))})},[h,l,e,r,a]),g=L.useCallback((C,O)=>{const A=(O||"").trim();if(!C)return;if(!A){s(N=>({...N,[C]:{status:"idle",modules:[],lastParsedText:void 0,error:void 0}}));return}const S=i[C];if(S?.lastParsedText&&S.lastParsedText===A&&S.status==="success")return;if(!t){const N=vi(A),x=kr({modules:[{title:"内容",content:ki(N),markdown:N}]});if(l.current){const H=h();x.forEach((U,$)=>{H[`${C}__module_${$}`]=U.content}),l.current.__tempVariableValues=H}s(H=>({...H,[C]:{status:"success",error:void 0,lastParsedText:A,modules:x}}));return}const k=c.current[C]?.status==="loading";k||s(N=>({...N,[C]:{...N[C],status:"loading",error:void 0,lastParsedText:A}}));const I=500,M=Date.now();setTimeout(()=>{t({text:A}).then(x=>{const H=kr(x),U=Date.now()-M,$=Math.max(0,I-U);setTimeout(()=>{if(l.current){const V=h();H.forEach((v,Y)=>{V[`${C}__module_${Y}`]=v.content}),l.current.__tempVariableValues=V}s(V=>({...V,[C]:{status:"success",error:void 0,lastParsedText:A,modules:H}}))},$)}).catch(x=>{const H=x instanceof Error?x.message:String(x);s(U=>({...U,[C]:{...U[C]||{modules:[]},status:"error",error:H,lastParsedText:A}}))})},k?0:50)},[h,l,t,i,c,s]),b=L.useCallback((C,O)=>{const A=(O||"").trim();if(!C)return;if(!A){u(N=>({...N,[C]:{status:"idle",modules:[],lastParsedText:void 0,error:void 0}}));return}const S=y.current[C];if(S?.lastParsedText&&S.lastParsedText===A&&S.status==="success"||!n)return;const k=y.current[C]?.status==="loading";k||u(N=>({...N,[C]:{...N[C],status:"loading",error:void 0,lastParsedText:A}}));const I=500,M=Date.now();setTimeout(()=>{n({text:A}).then(x=>{const H=kr(x),U=Date.now()-M,$=Math.max(0,I-U);setTimeout(()=>{if(l.current){const V=h();H.forEach((v,Y)=>{V[`${C}__module_${Y}`]=v.content}),l.current.__tempVariableValues=V}u(V=>({...V,[C]:{status:"success",error:void 0,lastParsedText:A,modules:H}}))},$)}).catch(x=>{const H=x instanceof Error?x.message:String(x);u(U=>({...U,[C]:{...U[C]||{modules:[]},status:"error",error:H,lastParsedText:A}}))})},k?0:50)},[h,l,n,y,u]);L.useEffect(()=>{d.current=m},[d,m]),L.useEffect(()=>{p.current=g},[p,g]),L.useLayoutEffect(()=>{E.current=b},[E,b]);const T=L.useCallback((C,O)=>{d.current(C,O)},[d]),_=L.useCallback((C,O)=>{p.current(C,O)},[p]),w=L.useCallback((C,O)=>{E.current(C,O)},[E]);return{handleReportUrlBlur:T,handleMarkdownBlur:_,handleMarkdownNameBlur:w}},Hl=({collapsed:e,collapseTransitionMs:t,contentRef:n,contentBodyRef:r,editorRef:a,debugIdRef:i,setCollapsedContentMaxHeightPx:s,setExpandedContentMaxHeightPx:o,setIsCollapseAnimating:u,effectiveConfig:l,files:d,multiVariableCounts:p,selectPortalsLength:E,datePickerPortalsLength:c,variablePortalsLength:y})=>{const h=L.useRef(""),m=L.useCallback(()=>{const b=r.current;if(!b)return;const T=Math.max(0,Math.ceil(b.scrollHeight||0));!Number.isFinite(T)||T<=0||o(_=>_===T?_:T)},[r,o]);L.useLayoutEffect(()=>{if(!e)return;const b=n.current,T=a.current;if(!(!b||!T))try{const _=T.getBoundingClientRect(),w=document.createRange();w.selectNodeContents(T);const C=Array.from(w.getClientRects());let O;if(C.length>0){const A=Math.min(...C.map(I=>I.top)),S=2;let k=0;for(const I of C)Math.abs(I.top-A)<=S&&(k=Math.max(k,I.bottom));O=k>0?Math.max(0,Math.ceil(k-_.top)):58}else{const A=window.getComputedStyle(T),S=Number.parseFloat(A.paddingTop)||0,k=Number.parseFloat(A.lineHeight)||34;O=Math.max(0,Math.ceil(S+k))||58}if(!Number.isFinite(O)||O<=0)return;s(A=>A===O?A:O)}catch{}},[e,n,a,l,d,p,E,c,y,s]),L.useLayoutEffect(()=>{if(!e)return;const b=n.current,T=r.current,_=a.current;if(!b)return;const w=()=>{b.scrollTop=0,b.scrollLeft=0,T&&(T.scrollTop=0,T.scrollLeft=0),_&&(_.scrollTop=0,_.scrollLeft=0)},O=(typeof t=="number"&&Number.isFinite(t)&&t>=0?t:260)+220;w();const A=B=>{B.preventDefault(),B.stopPropagation(),w()};b.addEventListener("wheel",A,{passive:!1}),b.addEventListener("touchmove",A,{passive:!1}),T&&(T.addEventListener("wheel",A,{passive:!1}),T.addEventListener("touchmove",A,{passive:!1}));const S=performance.now();let k=0;const I=B=>{w(),B-S<O&&(k=window.requestAnimationFrame(I))};k=window.requestAnimationFrame(I);const M=window.setTimeout(()=>{w()},O);return()=>{b.removeEventListener("wheel",A),b.removeEventListener("touchmove",A),T&&(T.removeEventListener("wheel",A),T.removeEventListener("touchmove",A)),window.cancelAnimationFrame(k),window.clearTimeout(M)}},[e,t,r,n,i,a]);const g=l.filter(b=>b.key&&b.type!=="report-module"&&b.type!=="markdown-module").map(b=>`${b.type}:${b.key}`).join("|");return g!==""&&h.current!==g&&(e||o(9999)),h.current=g,L.useEffect(()=>{if(e)return;const b=window.requestAnimationFrame(()=>{m();const T=window.setTimeout(()=>{m()},150);window.__rteSecondMeasureTimer=T});return()=>{window.cancelAnimationFrame(b);const T=window.__rteSecondMeasureTimer;T&&window.clearTimeout(T)}},[e,l,d,p,E,c,y,m]),L.useEffect(()=>{const b=typeof t=="number"&&Number.isFinite(t)&&t>=0?t:260;if(b<=0){u(!1);return}u(!0);const T=window.setTimeout(()=>u(!1),b);return()=>window.clearTimeout(T)},[e,t,u]),{measureExpandedContentHeight:m}},$l=({config:e,editorRef:t,setIsEmpty:n,setIsFormValid:r})=>{L.useEffect(()=>{if(e.length>0){n(!1);return}const a=()=>{if(!t.current){n(!0);return}const s=t.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"",o=t.current.querySelectorAll('[data-type="variable"]'),u=t.current.querySelectorAll('[data-type="upload"]');let l=!1;o.forEach(p=>{(p.textContent?.replace(/[\u200B\n]/g,"").trim()||"")&&(l=!0)}),u.forEach(p=>{p.querySelector(".upload-inner-wrapper.has-file")&&(l=!0)});const d=!s&&!l;n(d),e.length===0&&r(!d)};a();const i=new MutationObserver(a);return t.current&&i.observe(t.current,{childList:!0,subtree:!0,characterData:!0}),()=>{i.disconnect()}},[e,t,n,r])},Ul=({config:e,reportAnalyzeState:t,markdownAnalyzeState:n,markdownNameAnalyzeState:r})=>L.useMemo(()=>{if(e.length===0)return e;const a=[];let i=!1;for(const s of e){if(s.type==="markdown"&&s.key==="tableData"||(i&&s.type==="text"&&s.text?.startsWith(`
|
|
@@ -61,7 +61,7 @@ ${(e||"").replace(/\r\n/g,`
|
|
|
61
61
|
`).trim():""}catch{S=k.trim()}}else{const k=(O.innerText||"").replace(/\u200B/g,"").replace(/\r\n/g,`
|
|
62
62
|
`);S=k.replace(/\n/g,"").trim().length>0?k:""}if(S)p.current.add(A);else if(p.current.has(A)){T.add(A);const k=O.getAttribute("data-node-type");k==="report-url"?T.add(`${A}__url`):k==="markdown-name"&&T.add(`${A}__name`)}});const w=e.current.__tempVariableValues;if(w?(b=w,setTimeout(()=>{if(e.current){const C=e.current;C.__tempVariableValues===w&&delete C.__tempVariableValues}},100)):g||(e.current.querySelectorAll('[data-type="variable"]').forEach(B=>{const N=B.dataset.key;if(N){const H=(()=>{if(B.dataset.variableRender==="antd-textarea"){const V=(B.getAttribute("data-value")||"").trim();if(!V)return"";try{return decodeURIComponent(V).replace(/\r\n/g,`
|
|
63
63
|
`).trim()}catch{return V.trim()}}const U=(B.innerText||"").replace(/\u200B/g,"").replace(/\r\n/g,`
|
|
64
|
-
`);return U.replace(/\n/g,"").trim().length>0?U:""})();H&&(B.getAttribute("data-node-type")==="report-url"?b[`${N}__url`]=H:B.getAttribute("data-node-type")==="markdown-name"?b[`${N}__name`]=H:b[N]=H)}}),e.current.querySelectorAll('[data-type="select"]').forEach(B=>{const N=B.dataset.key;if(N){const x=(B.getAttribute("data-value")||"").trim();x&&(b[N]=x)}}),e.current.querySelectorAll('[data-type="searchable-select"]').forEach(B=>{const N=B.dataset.key;if(N){const x=(B.getAttribute("data-value")||"").trim();x&&(b[N]=x)}}),e.current.querySelectorAll('[data-type="textarea"]').forEach(B=>{const N=B.dataset.key;if(N){const x=B.value.replace(/[\u200B]/g,"").trim();x&&(b[N]=x)}}),e.current.querySelectorAll('[data-type="richtext"]').forEach(B=>{const N=B.dataset.key;if(N){const x=B.getAttribute("data-node-type")||"",H=x==="report-module"||x==="markdown-module",U=H?(B.innerHTML||"").replace(/[\u200B]/g,"").trim():(B.textContent||"").replace(/[\u200B]/g,"").trim();if(H){const $=Number.parseInt(B.getAttribute("data-module-index")||"0",10);b[`${N}__module_${Number.isFinite($)?$:0}`]=U}else U&&(b[N]=U)}}),e.current.querySelectorAll('[data-type="datepicker"]').forEach(B=>{const N=B.dataset.key;if(N){const x=(B.getAttribute("data-value")||"").trim();x&&(b[N]=x)}}),e.current.querySelectorAll('[data-type="number-input"]').forEach(B=>{const N=B.dataset.key;if(N){const x=(B.value||"").trim();x&&(b[N]=x)}})),l&&Object.keys(l).length>0){const C=new Set(t.filter(S=>S.type==="upload"&&S.key).map(S=>S.key)),O={};g||Object.entries(l).forEach(([S,k])=>{if(!Array.isArray(k))return;let I=0;for(let B=0;B<k.length;B++)`${S}_${B}`in b&&I++;let M=-1;for(let B=0;B<k.length;B++)p.current.has(`${S}_${B}`)&&(M=B);if(M>=I&&I<k.length)for(let B=I;B<k.length;B++)T.add(`${S}_${B}`)}),Object.entries(l).forEach(([S,k])=>{C.has(S)||(Array.isArray(k)?k.forEach((I,M)=>{I!=null&&String(I).trim()!==""&&(O[`${S}_${M}`]=String(I))}):k!=null&&String(k).trim()!==""&&(t.find(M=>M.key===S&&M.type==="report-url")?O[`${S}__url`]=String(k):O[S]=String(k)))});const A=y.current!==l;Object.entries(O).forEach(([S,k])=>{const I=S in b;!T.has(S)&&(!I||A)&&(b[S]=k)})}if(y.current=l,xb(e,t,n,r,b,a,o,u,d),g&&(c.current=!1),setTimeout(()=>{zn(e)},0),i?.current){const{key:C,offset:O}=i.current;setTimeout(()=>{if(!e.current)return;const A=e.current.querySelector(`[data-type="variable"][data-key="${C}"]`);if(A){if(A.dataset.variableRender==="antd-textarea"){const S=A.querySelector("textarea");if(S){S.focus();try{const k=S.value?.length??0;S.setSelectionRange(Math.min(O,k),Math.min(O,k))}catch{}i.current=null;return}}try{const S=document.createRange(),k=document.createTreeWalker(A,NodeFilter.SHOW_TEXT,null);let I=0,M=null,B=0;for(;k.nextNode();){const N=k.currentNode,x=N.textContent?.length||0;if(I+x>=O){M=N,B=O-I;break}I+=x}if(M){S.setStart(M,Math.min(B,M.textContent?.length||0)),S.collapse(!0);const N=window.getSelection();N&&(N.removeAllRanges(),N.addRange(S),A.focus())}else{S.selectNodeContents(A),S.collapse(!1);const N=window.getSelection();N&&(N.removeAllRanges(),N.addRange(S),A.focus())}}catch{const S=document.createRange();S.selectNodeContents(A),S.collapse(!1);const k=window.getSelection();k&&(k.removeAllRanges(),k.addRange(S),A.focus())}i.current=null}},0)}},[t,n,r,e,a,i,s,o,u,l,d]);L.useEffect(()=>{h()},[h])}function Sb(e,t,n,r,a){L.useEffect(()=>{const i=e.current;if(!i)return;const s=l=>typeof l=="string"?/\.(png|jpe?g|gif|webp|bmp|svg)(\?.*)?$/i.test(l):l.type?.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(l.name||""),o=l=>{const d=l.target?.closest(".upload-info-icon");if(d&&d.classList.contains("upload-info-icon")){const E=d.dataset.uploadKey;if(E){const c=d.dataset.tooltip||"";let y=!1;try{const m=JSON.parse(c);m&&m.type==="steps"&&Array.isArray(m.images)&&(y=!0)}catch{}if(y){const h=d.closest('[data-type="upload"], [data-type="video-upload"]');r({key:E,anchorEl:h||d,type:"upload"})}else{const h=d.closest('[data-type="upload"], [data-type="video-upload"]');r({key:E,anchorEl:h||d,type:"upload"})}}return}const p=l.target?.closest('[data-type="upload"]');if(p){const E=p.dataset.key;if(E){const c=n[E];c&&s(c)&&r({key:E,anchorEl:p,type:"upload-preview"})}}},u=l=>{if(a)return;const d=l.target?.closest(".upload-info-icon"),p=l.relatedTarget;if(p?.closest?.(".rte-tooltip-overlay"))return;if(d&&d.classList.contains("upload-info-icon")){const c=d.closest('[data-type="upload"], [data-type="video-upload"]');if(p&&c&&c.contains(p))return;if(!p||!i.contains(p))r(null);else{const y=p.closest('[data-type="upload"], [data-type="video-upload"]');(!y||y!==c)&&r(null)}return}const E=l.target?.closest('[data-type="upload"], [data-type="video-upload"]');if(E){const c=p;if(c?.closest?.(".rte-tooltip-overlay")||c&&E.contains(c))return;r(null)}};return i.addEventListener("mouseover",o,!0),i.addEventListener("mouseout",u,!0),()=>{i.removeEventListener("mouseover",o,!0),i.removeEventListener("mouseout",u,!0)}},[t,n,e,r,a])}function Ab(e,t,n,r,a){L.useEffect(()=>{const i=e.current;if(!i)return;const s=d=>{if(r==="hideTagClose")return;const p=d.currentTarget,E=p.dataset.tooltip,c=p.dataset.tagKey||"";E&&n({key:c,anchorEl:p,type:"tag"})},o=d=>{a||d.relatedTarget?.closest?.(".rte-tooltip-overlay")||n(null)};let u;const l=()=>{i.querySelectorAll(".tag-node[data-tooltip]").forEach(p=>{p.addEventListener("mouseenter",s),p.addEventListener("mouseleave",o)})};return u=requestAnimationFrame(()=>{u=requestAnimationFrame(l)}),()=>{cancelAnimationFrame(u),i.querySelectorAll(".tag-node[data-tooltip]").forEach(p=>{p.removeEventListener("mouseenter",s),p.removeEventListener("mouseleave",o)})}},[t,e,n,r,a])}function _b(e,t,n,r){L.useEffect(()=>{const a=e.current;if(!a)return;const i=o=>{const u=o.target?.closest(".variable-info-icon");if(u&&u.classList.contains("variable-info-icon")){const d=u.dataset.variableKey;d&&n({key:d,anchorEl:u,type:"variable"});return}const l=o.target?.closest('[data-type="variable"][data-node-type="report-url"][data-tooltip]');if(l){const d=l.dataset.key;d&&n({key:d,anchorEl:l,type:"variable"})}},s=o=>{if(r)return;const u=o.target,l=o.relatedTarget;if(l?.closest?.(".rte-tooltip-overlay"))return;const d=u?.closest?.(".variable-info-icon"),p=u?.closest?.('[data-type="variable"][data-node-type="report-url"][data-tooltip]');if(d||p){if(!l||!a.contains(l)){n(null);return}const E=!!l.closest?.(".variable-info-icon"),c=!!l.closest?.('[data-type="variable"][data-node-type="report-url"][data-tooltip]');!E&&!c&&n(null)}};return a.addEventListener("mouseover",i,!0),a.addEventListener("mouseout",s,!0),()=>{a.removeEventListener("mouseover",i,!0),a.removeEventListener("mouseout",s,!0)}},[t,e,n,r])}function vb(e,t,n,r,a){L.useEffect(()=>{const i=e.current;if(!i)return;const s=p=>typeof p=="string"?/\.(png|jpe?g|gif|webp|bmp|svg)(\?.*)?$/i.test(p):p.type?.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(p.name||""),o=p=>{const E=p.currentTarget,c=E.dataset.fileName,y=E.closest('[data-type="upload"]'),h=y?.dataset.key||"",m=h?n[h]:null;if(m&&s(m)){r({key:h,anchorEl:y||E,type:"upload-preview"});return}c&&r({key:h,anchorEl:y||E,type:"upload-label"})},u=p=>{a||p.relatedTarget?.closest?.(".rte-tooltip-overlay")||r(null)};let l;const d=()=>{i.querySelectorAll(".upload-label[data-file-name]").forEach(E=>{E.addEventListener("mouseenter",o),E.addEventListener("mouseleave",u)})};return l=requestAnimationFrame(()=>{l=requestAnimationFrame(d)}),()=>{cancelAnimationFrame(l),i.querySelectorAll(".upload-label[data-file-name]").forEach(E=>{E.removeEventListener("mouseenter",o),E.removeEventListener("mouseleave",u)})}},[t,n,e,r,a])}function kb(e,t,n,r,a,i){L.useEffect(()=>{const s=setTimeout(()=>{wr(e,t,n,a),Nr(e,t,n,r,a)},0);return()=>clearTimeout(s)},[n,t,e,r,a,i])}function wb(e,t){const n=L.useRef(0),r=L.useRef(0);L.useEffect(()=>{if(!e.current)return;let a=!1,i=0;const s=b=>b instanceof HTMLElement?!!(b.closest(".rte-datepicker-wrapper")||b.closest(".rte-datepicker-host")||b.closest(".ant-picker")||b.closest(".ant-picker-dropdown")):!1,o=b=>b instanceof HTMLElement?!!(b.closest(".rte-select-wrapper")||b.closest(".rte-select-host")||b.closest(".ant-select")||b.closest(".ant-select-dropdown")):!1,u=b=>{a=!0,s(b.target)&&(n.current=Date.now()),o(b.target)&&(r.current=Date.now())},l=()=>{a=!1,i=Date.now()};let d=!1,p=0;const E=()=>{d=!0},c=()=>{d=!1,p=Date.now()},y=()=>{p=Date.now()},h=b=>{s(b.target)&&(n.current=Date.now()),o(b.target)&&(r.current=Date.now())},m=()=>{if(Date.now()-n.current<800||Date.now()-r.current<800)return;const b=document.activeElement;if(b&&(b.closest(".rte-datepicker-wrapper")||b.closest(".rte-datepicker-host")||b.closest(".ant-picker-dropdown")||b.tagName==="INPUT"&&b.closest(".ant-picker")||b.closest(".rte-select-wrapper")||b.closest(".rte-select-host")||b.closest(".ant-select")||b.closest(".ant-select-dropdown"))||!e.current)return;const T=window.getSelection();if(!T||T.rangeCount===0||t.current||a||d||Date.now()-p<500)return;const _=T.getRangeAt(0);if(!_.collapsed)return e.current.contains(_.commonAncestorContainer),void 0;const w=T.anchorNode;if(!w||!e.current.contains(w))return;let C=!1,O=!1;if(w.nodeType===Node.ELEMENT_NODE){const S=w;(S.closest('[data-type="datepicker"]')||S.closest(".rte-datepicker-wrapper")||S.closest(".rte-datepicker-host"))&&(C=!0),(S.closest('[data-type="select"]')||S.closest(".rte-select-wrapper")||S.closest(".rte-select-host"))&&(O=!0)}else if(w.parentElement){const S=w.parentElement;(S.closest('[data-type="datepicker"]')||S.closest(".rte-datepicker-wrapper")||S.closest(".rte-datepicker-host"))&&(C=!0),(S.closest('[data-type="select"]')||S.closest(".rte-select-wrapper")||S.closest(".rte-select-host"))&&(O=!0)}if(C||O)return;let A=null;if(w.nodeType===Node.ELEMENT_NODE?A=w.closest('[data-type="variable"]'):w.nodeType===Node.TEXT_NODE&&w.parentElement&&(A=w.parentElement.closest('[data-type="variable"]')),!A){if(Date.now()-i>500)return;const S=e.current.querySelectorAll('[data-type="variable"]');if(S.length>0){let k=null;for(const I of Array.from(S))if(I.style.display!=="none"){k=I;break}if(!k&&S.length>0&&(k=S[0]),k){const I=document.createRange();I.selectNodeContents(k),I.collapse(!1),T.removeAllRanges(),T.addRange(I),k.focus()}else T.removeAllRanges()}else T.removeAllRanges()}},g=e.current;return g&&(g.addEventListener("compositionstart",E),g.addEventListener("compositionend",c),g.addEventListener("input",y)),document.addEventListener("mousedown",u),document.addEventListener("mouseup",l),document.addEventListener("focusin",h),document.addEventListener("selectionchange",m),()=>{g&&(g.removeEventListener("compositionstart",E),g.removeEventListener("compositionend",c),g.removeEventListener("input",y)),document.removeEventListener("mousedown",u),document.removeEventListener("mouseup",l),document.removeEventListener("focusin",h),document.removeEventListener("selectionchange",m)}},[e,t])}var Tr={exports:{}},Nb=Tr.exports,Hu;function $u(){return Hu||(Hu=1,function(e,t){(function(n,r){e.exports=r()})(Nb,function(){var n=1e3,r=6e4,a=36e5,i="millisecond",s="second",o="minute",u="hour",l="day",d="week",p="month",E="quarter",c="year",y="date",h="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,g=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,b={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(N){var x=["th","st","nd","rd"],H=N%100;return"["+N+(x[(H-20)%10]||x[H]||x[0])+"]"}},T=function(N,x,H){var U=String(N);return!U||U.length>=x?N:""+Array(x+1-U.length).join(H)+N},_={s:T,z:function(N){var x=-N.utcOffset(),H=Math.abs(x),U=Math.floor(H/60),$=H%60;return(x<=0?"+":"-")+T(U,2,"0")+":"+T($,2,"0")},m:function N(x,H){if(x.date()<H.date())return-N(H,x);var U=12*(H.year()-x.year())+(H.month()-x.month()),$=x.clone().add(U,p),V=H-$<0,v=x.clone().add(U+(V?-1:1),p);return+(-(U+(H-$)/(V?$-v:v-$))||0)},a:function(N){return N<0?Math.ceil(N)||0:Math.floor(N)},p:function(N){return{M:p,y:c,w:d,d:l,D:y,h:u,m:o,s,ms:i,Q:E}[N]||String(N||"").toLowerCase().replace(/s$/,"")},u:function(N){return N===void 0}},w="en",C={};C[w]=b;var O="$isDayjsObject",A=function(N){return N instanceof M||!(!N||!N[O])},S=function N(x,H,U){var $;if(!x)return w;if(typeof x=="string"){var V=x.toLowerCase();C[V]&&($=V),H&&(C[V]=H,$=V);var v=x.split("-");if(!$&&v.length>1)return N(v[0])}else{var Y=x.name;C[Y]=x,$=Y}return!U&&$&&(w=$),$||!U&&w},k=function(N,x){if(A(N))return N.clone();var H=typeof x=="object"?x:{};return H.date=N,H.args=arguments,new M(H)},I=_;I.l=S,I.i=A,I.w=function(N,x){return k(N,{locale:x.$L,utc:x.$u,x:x.$x,$offset:x.$offset})};var M=function(){function N(H){this.$L=S(H.locale,null,!0),this.parse(H),this.$x=this.$x||H.x||{},this[O]=!0}var x=N.prototype;return x.parse=function(H){this.$d=function(U){var $=U.date,V=U.utc;if($===null)return new Date(NaN);if(I.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var v=$.match(m);if(v){var Y=v[2]-1||0,J=(v[7]||"0").substring(0,3);return V?new Date(Date.UTC(v[1],Y,v[3]||1,v[4]||0,v[5]||0,v[6]||0,J)):new Date(v[1],Y,v[3]||1,v[4]||0,v[5]||0,v[6]||0,J)}}return new Date($)}(H),this.init()},x.init=function(){var H=this.$d;this.$y=H.getFullYear(),this.$M=H.getMonth(),this.$D=H.getDate(),this.$W=H.getDay(),this.$H=H.getHours(),this.$m=H.getMinutes(),this.$s=H.getSeconds(),this.$ms=H.getMilliseconds()},x.$utils=function(){return I},x.isValid=function(){return this.$d.toString()!==h},x.isSame=function(H,U){var $=k(H);return this.startOf(U)<=$&&$<=this.endOf(U)},x.isAfter=function(H,U){return k(H)<this.startOf(U)},x.isBefore=function(H,U){return this.endOf(U)<k(H)},x.$g=function(H,U,$){return I.u(H)?this[U]:this.set($,H)},x.unix=function(){return Math.floor(this.valueOf()/1e3)},x.valueOf=function(){return this.$d.getTime()},x.startOf=function(H,U){var $=this,V=!!I.u(U)||U,v=I.p(H),Y=function(oe,ge){var Oe=I.w($.$u?Date.UTC($.$y,ge,oe):new Date($.$y,ge,oe),$);return V?Oe:Oe.endOf(l)},J=function(oe,ge){return I.w($.toDate()[oe].apply($.toDate("s"),(V?[0,0,0,0]:[23,59,59,999]).slice(ge)),$)},P=this.$W,ee=this.$M,te=this.$D,ae="set"+(this.$u?"UTC":"");switch(v){case c:return V?Y(1,0):Y(31,11);case p:return V?Y(1,ee):Y(0,ee+1);case d:var Q=this.$locale().weekStart||0,re=(P<Q?P+7:P)-Q;return Y(V?te-re:te+(6-re),ee);case l:case y:return J(ae+"Hours",0);case u:return J(ae+"Minutes",1);case o:return J(ae+"Seconds",2);case s:return J(ae+"Milliseconds",3);default:return this.clone()}},x.endOf=function(H){return this.startOf(H,!1)},x.$set=function(H,U){var $,V=I.p(H),v="set"+(this.$u?"UTC":""),Y=($={},$[l]=v+"Date",$[y]=v+"Date",$[p]=v+"Month",$[c]=v+"FullYear",$[u]=v+"Hours",$[o]=v+"Minutes",$[s]=v+"Seconds",$[i]=v+"Milliseconds",$)[V],J=V===l?this.$D+(U-this.$W):U;if(V===p||V===c){var P=this.clone().set(y,1);P.$d[Y](J),P.init(),this.$d=P.set(y,Math.min(this.$D,P.daysInMonth())).$d}else Y&&this.$d[Y](J);return this.init(),this},x.set=function(H,U){return this.clone().$set(H,U)},x.get=function(H){return this[I.p(H)]()},x.add=function(H,U){var $,V=this;H=Number(H);var v=I.p(U),Y=function(ee){var te=k(V);return I.w(te.date(te.date()+Math.round(ee*H)),V)};if(v===p)return this.set(p,this.$M+H);if(v===c)return this.set(c,this.$y+H);if(v===l)return Y(1);if(v===d)return Y(7);var J=($={},$[o]=r,$[u]=a,$[s]=n,$)[v]||1,P=this.$d.getTime()+H*J;return I.w(P,this)},x.subtract=function(H,U){return this.add(-1*H,U)},x.format=function(H){var U=this,$=this.$locale();if(!this.isValid())return $.invalidDate||h;var V=H||"YYYY-MM-DDTHH:mm:ssZ",v=I.z(this),Y=this.$H,J=this.$m,P=this.$M,ee=$.weekdays,te=$.months,ae=$.meridiem,Q=function(ge,Oe,Pe,ot){return ge&&(ge[Oe]||ge(U,V))||Pe[Oe].slice(0,ot)},re=function(ge){return I.s(Y%12||12,ge,"0")},oe=ae||function(ge,Oe,Pe){var ot=ge<12?"AM":"PM";return Pe?ot.toLowerCase():ot};return V.replace(g,function(ge,Oe){return Oe||function(Pe){switch(Pe){case"YY":return String(U.$y).slice(-2);case"YYYY":return I.s(U.$y,4,"0");case"M":return P+1;case"MM":return I.s(P+1,2,"0");case"MMM":return Q($.monthsShort,P,te,3);case"MMMM":return Q(te,P);case"D":return U.$D;case"DD":return I.s(U.$D,2,"0");case"d":return String(U.$W);case"dd":return Q($.weekdaysMin,U.$W,ee,2);case"ddd":return Q($.weekdaysShort,U.$W,ee,3);case"dddd":return ee[U.$W];case"H":return String(Y);case"HH":return I.s(Y,2,"0");case"h":return re(1);case"hh":return re(2);case"a":return oe(Y,J,!0);case"A":return oe(Y,J,!1);case"m":return String(J);case"mm":return I.s(J,2,"0");case"s":return String(U.$s);case"ss":return I.s(U.$s,2,"0");case"SSS":return I.s(U.$ms,3,"0");case"Z":return v}return null}(ge)||v.replace(":","")})},x.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},x.diff=function(H,U,$){var V,v=this,Y=I.p(U),J=k(H),P=(J.utcOffset()-this.utcOffset())*r,ee=this-J,te=function(){return I.m(v,J)};switch(Y){case c:V=te()/12;break;case p:V=te();break;case E:V=te()/3;break;case d:V=(ee-P)/6048e5;break;case l:V=(ee-P)/864e5;break;case u:V=ee/a;break;case o:V=ee/r;break;case s:V=ee/n;break;default:V=ee}return $?V:I.a(V)},x.daysInMonth=function(){return this.endOf(p).$D},x.$locale=function(){return C[this.$L]},x.locale=function(H,U){if(!H)return this.$L;var $=this.clone(),V=S(H,U,!0);return V&&($.$L=V),$},x.clone=function(){return I.w(this.$d,this)},x.toDate=function(){return new Date(this.valueOf())},x.toJSON=function(){return this.isValid()?this.toISOString():null},x.toISOString=function(){return this.$d.toISOString()},x.toString=function(){return this.$d.toUTCString()},N}(),B=M.prototype;return k.prototype=B,[["$ms",i],["$s",s],["$m",o],["$H",u],["$W",l],["$M",p],["$y",c],["$D",y]].forEach(function(N){B[N[1]]=function(x){return this.$g(x,N[0],N[1])}}),k.extend=function(N,x){return N.$i||(N(x,M,k),N.$i=!0),k},k.locale=S,k.isDayjs=A,k.unix=function(N){return k(1e3*N)},k.en=C[w],k.Ls=C,k.p={},k})}(Tr)),Tr.exports}var Ib=$u();const yr=Yr(Ib);var xr={exports:{}},Lb=xr.exports,Uu;function Ob(){return Uu||(Uu=1,function(e,t){(function(n,r){e.exports=r($u())})(Lb,function(n){function r(s){return s&&typeof s=="object"&&"default"in s?s:{default:s}}var a=r(n),i={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(s,o){return o==="W"?s+"周":s+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(s,o){var u=100*s+o;return u<600?"凌晨":u<900?"早上":u<1100?"上午":u<1300?"中午":u<1800?"下午":"晚上"}};return a.default.locale(i,null,!0),i})}(xr)),xr.exports}Ob();function Pn(e){"@babel/helpers - typeof";return Pn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pn(e)}function Db(e,t){if(Pn(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Pn(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Pb(e){var t=Db(e,"string");return Pn(t)=="symbol"?t:t+""}function Mb(e,t,n){return(t=Pb(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function zu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qu(Object(n),!0).forEach(function(r){Mb(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Bb={yearFormat:"YYYY",dayFormat:"D",cellMeridiemFormat:"A",monthBeforeYear:!0},Rb=zu(zu({},Bb),{},{locale:"zh_CN",today:"今天",now:"此刻",backToToday:"返回今天",ok:"确定",timeSelect:"选择时间",dateSelect:"选择日期",weekSelect:"选择周",clear:"清除",week:"周",month:"月",year:"年",previousMonth:"上个月 (翻页上键)",nextMonth:"下个月 (翻页下键)",monthSelect:"选择月份",yearSelect:"选择年份",decadeSelect:"选择年代",previousYear:"上一年 (Control键加左方向键)",nextYear:"下一年 (Control键加右方向键)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世纪",nextCentury:"下一世纪",yearFormat:"YYYY年",cellDateFormat:"D",monthBeforeYear:!1});const Fb={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]},Vu={lang:Object.assign({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},Rb),timePickerLocale:Object.assign({},Fb)};Vu.lang.ok="确定",yr.locale("zh-cn");const{RangePicker:Hb}=ce.DatePicker,$b=({host:e,onChange:t})=>{const n=e.dataset.key,r=e.dataset.value,a=e.dataset.placeholder,i=e.dataset.limitRange?parseInt(e.dataset.limitRange,10):void 0,s=e.dataset.disableFuture==="true",[o,u]=L.useState(()=>{if(!r)return null;const h=r.split(",");return h.length===2&&h[0]&&h[1]?[yr(h[0]),yr(h[1])]:null}),[l,d]=L.useState(null),p=h=>h?s&&h.isAfter(yr(),"day")?!0:!i||!l||!l[0]?!1:Math.abs(h.diff(l[0],"days"))>i:!1,E=h=>{d(h)},c=h=>{if(u(h),d(null),h&&h[0]&&h[1]){const m=`${h[0].format("YYYY-MM-DD")},${h[1].format("YYYY-MM-DD")}`;e.setAttribute("data-value",m),t(n,m)}else e.setAttribute("data-value",""),t(n,"")},y=h=>{d(h?o:null)};return rn.createPortal(q.jsx("div",{className:"rte-datepicker-wrapper",contentEditable:!1,style:{display:"inline-block",verticalAlign:"middle",width:"260px",marginLeft:"4px",marginRight:"4px",fontSize:"16px",height:"30px",lineHeight:"30px"},children:q.jsx(Hb,{value:o,disabledDate:p,onCalendarChange:E,onChange:c,onOpenChange:y,placeholder:[a||"开始日期",a||"结束日期"],style:{width:"100%"},size:"small",allowClear:!0,locale:Vu,getPopupContainer:()=>document.body,popupClassName:"rte-datepicker-dropdown"})}),e)},Ub=e=>{const[t,n]=L.useState([]);return L.useEffect(()=>{const r=e.current;if(!r)return;const a=()=>{const s=r.querySelectorAll(".rte-datepicker-host"),o=[];s.forEach(u=>{const l=u.getAttribute("data-key");l&&o.push(q.jsx($b,{host:u,onChange:()=>{if(e.current){const d=new Event("input",{bubbles:!0});e.current.dispatchEvent(d)}}},`datepicker-${l}`))}),n(o)};a();const i=new MutationObserver(s=>{let o=!1;for(const u of s)if(u.type==="childList"){let l=!1;if(u.addedNodes.forEach(d=>{if(d.nodeType===Node.ELEMENT_NODE){const p=d;(p.classList?.contains("rte-datepicker-host")||p.querySelector?.(".rte-datepicker-host"))&&(l=!0)}}),u.removedNodes.forEach(d=>{if(d.nodeType===Node.ELEMENT_NODE){const p=d;(p.classList?.contains("rte-datepicker-host")||p.querySelector?.(".rte-datepicker-host"))&&(l=!0)}}),l){o=!0;break}}o&&a()});return i.observe(r,{childList:!0,subtree:!0}),()=>i.disconnect()},[e]),t},Gu=({config:e,onSend:t,isProcessing:n=!1,disabled:r=!1,width:a,lockStructure:i=!1,agentOptions:s=[],onAgentSelect:o,onAgentExit:u,loading:l=!1,placeholder:d,border:p,background:E="transparent",hideButtons:c,maxHeight:y,minHeight:h,editorMinHeight:m,editorPadding:g,footerPadding:b,collapsed:T=!1,reportAnalyze:_,markdownAnalyze:w,markdownNameAnalyze:C,onCollapsedChange:O,collapseTransitionMs:A=260,debugTooltipSticky:S=!1,nodeValues:k,onFilesChange:I,showFooterUpload:M=!0,videoUrlParse:B,videoUpload:N})=>{const[x,H]=ce.message.useMessage(),U=L.useRef(null),$=L.useRef(null),V=L.useRef(null),v=L.useRef(null),Y=L.useRef(null),J=L.useRef(null),P=L.useRef("");if(!P.current){const ue=Math.random().toString(36).slice(2,8);P.current=`rte_${ue}`}const[ee,te]=L.useState({});L.useEffect(()=>{I?.(ee)},[ee,I]);const[ae,Q]=L.useState(null),[re,oe]=L.useState(null),[ge,Oe]=L.useState(null),[Pe,ot]=L.useState({}),Zt=L.useRef(null),en=L.useRef(null),{tooltipPortal:Cr,setPopoverVisible:ft}=V1({config:e,files:ee,debugTooltipSticky:S,videoState:Pe}),{handleFileChange:Sr,handleRemoveFile:Ar}=kl({config:e,messageApi:x,activeBatchKey:re,activeFileKey:ae,activeBatchStartIndex:ge,setActiveFileKey:Q,setActiveBatchKey:oe,setActiveBatchStartIndex:Oe,setFiles:te}),tn=L.useRef(!1),ri=L.useRef(null),{handleMouseDown:ai,handleMouseMove:ii,handleMouseUp:si,handleDoubleClick:oi}=Wl({lockStructure:i,onAgentExit:u,editorRef:v,setPopoverVisible:ft,isDraggingRef:tn,mouseDownPosRef:ri}),[W,Z]=L.useState(!1),se=L.useRef(null),[fe,be]=L.useState(!0),je=L.useRef(0),[ut,et]=L.useState(58),[Dt,Pt]=L.useState(58),[He,St]=L.useState(!1),[ze,ui]=L.useState(null),Rn=L.useRef(!1),Fn=L.useRef(!1),lt=L.useRef(null),[li,ci]=L.useState({}),_r=L.useRef(()=>{}),[Mt,vr]=L.useState({}),el=L.useRef(()=>{}),tT=L.useRef({}),di=L.useRef(Mt);L.useEffect(()=>{di.current=Mt},[Mt]);const[Bt,fi]=L.useState({}),tl=L.useRef(()=>{}),nl=L.useRef(Bt);L.useEffect(()=>{nl.current=Bt},[Bt]);const[Rt,Hn]=L.useState(()=>{const ue={};return e.forEach(pe=>{pe.type==="multi-variable"&&pe.key&&(ue[pe.key]=1)}),ue});Bl({config:e,editorRef:v,files:ee,setFiles:te,multiVariableCounts:Rt,setMultiVariableCounts:Hn,reportAnalyzeState:li,setReportAnalyzeState:ci,markdownAnalyzeState:Mt,setMarkdownAnalyzeState:vr,markdownNameAnalyzeState:Bt,setMarkdownNameAnalyzeState:fi,nodeValues:k});const rl=L.useRef(k);if(k!==rl.current&&(rl.current=k,k)){const ue={};let pe=!1;e.forEach(Te=>{if(Te.type==="multi-variable"&&Te.key){const Xe=k[Te.key];if(Array.isArray(Xe)&&Xe.length>0){const nn=Te.maxCount??9,Un=Math.min(Xe.length,nn);Rt[Te.key]!==Un&&(ue[Te.key]=Un,pe=!0)}}}),pe&&Hn(Te=>({...Te,...ue}))}const _e=Ul({config:e,reportAnalyzeState:li,markdownAnalyzeState:Mt,markdownNameAnalyzeState:Bt}),{handleReportUrlBlur:nT,handleMarkdownBlur:rT,handleMarkdownNameBlur:aT}=Fl({reportAnalyze:_,markdownAnalyze:w,markdownNameAnalyze:C,reportAnalyzeState:li,setReportAnalyzeState:ci,markdownAnalyzeState:Mt,setMarkdownAnalyzeState:vr,markdownNameAnalyzeState:Bt,setMarkdownNameAnalyzeState:fi,editorRef:v,reportAnalyzeRef:_r,markdownAnalyzeRef:el,markdownNameAnalyzeRef:tl,markdownAnalyzeStateRef:di,markdownNameAnalyzeStateRef:nl});Sl(v,nT,[_e]),Al(v,aT,[_e]),_l(v,rT,[_e]),Cl(v,[_e]),Cb(v,_e,ee,i,Rt,se,void 0,c,void 0,k,Pe);const pi=L.useRef(new Set),al=L.useRef(_e),il=L.useRef(k);(al.current!==_e||il.current!==k)&&(al.current=_e,il.current=k,pi.current=new Set),L.useEffect(()=>{if(!k||!_e||_e.length===0)return;const ue=_e.filter(ye=>ye.type==="upload"&&ye.key);if(ue.length===0)return;const pe={},Te=(ye,Ce)=>{Ce&&(Ce instanceof File?pe[ye]=Ce:typeof Ce=="string"&&Ce.trim()&&(pe[ye]=Ce.trim()))};for(const ye of ue){const Ce=ye.key;if(pi.current.has(Ce))continue;const Ae=k[Ce],Re=typeof ye.maxCount=="number"&&ye.maxCount>1;if(Array.isArray(Ae)&&Ae.length>0){Re?Ae.forEach((De,Ve)=>Te(`${Ce}-${Ve}`,De)):Te(Ce,Ae[0]);continue}if(Ae&&!Array.isArray(Ae)){Te(Ce,Ae);continue}if(Re)for(let De=0;De<ye.maxCount;De++){const Ve=`${Ce}-${De}`,At=k[Ve];if(!At)break;Te(Ve,At)}}if(Object.keys(pe).length===0)return;for(const ye of ue)k[ye.key]!==void 0&&pi.current.add(ye.key);te(ye=>{const Ce={...ye};let Ae=!1;for(const Re of ue){const De=Re.key;if(k[De]===void 0)continue;if(typeof Re.maxCount=="number"&&Re.maxCount>1)for(let At=0;At<Re.maxCount;At++){const gi=`${De}-${At}`;!pe[gi]&&ye[gi]&&(Ce[gi]=null,Ae=!0)}}for(const[Re,De]of Object.entries(pe))ye[Re]!==De&&(Ce[Re]=De,Ae=!0);return Ae?Ce:ye});const Xe=Object.entries(pe).filter(([,ye])=>typeof ye=="string");if(Xe.length===0)return;const nn=async ye=>{const Ce=ye.split("/").pop()?.split("?")[0]||"file",Ae=decodeURIComponent(Ce),Re=async De=>{const Ve=await De.blob();return new File([Ve],Ae,{type:Ve.type||"application/octet-stream"})};try{const De=`/api/image-proxy?url=${encodeURIComponent(ye)}`,Ve=await fetch(De);if(Ve.ok)return Re(Ve)}catch{}return null};let Un=!1;return Promise.all(Xe.map(async([ye,Ce])=>{const Ae=await nn(Ce);return Ae?{key:ye,file:Ae}:null})).then(ye=>{if(Un)return;const Ce={};for(const Ae of ye)Ae&&(Ce[Ae.key]=Ae.file);Object.keys(Ce).length>0&&te(Ae=>{const Re={...Ae};let De=!1;for(const[Ve,At]of Object.entries(Ce))typeof Re[Ve]=="string"&&(Re[Ve]=At,De=!0);return De?Re:Ae})}),()=>{Un=!0}},[k,_e]);const hi=L.useRef(new Set),sl=L.useRef(""),ol=(e||[]).filter(ue=>ue.key&&ue.type!=="report-module"&&ue.type!=="markdown-module").map(ue=>`${ue.type}:${ue.key}`).join("|");sl.current!==ol&&(sl.current=ol,hi.current=new Set),L.useEffect(()=>{if(!k||!e||e.length===0)return;const ue=e.filter(pe=>pe.type==="report-url"&&pe.key);if(ue.length!==0)for(const pe of ue){const Te=pe.key;if(hi.current.has(Te))continue;const Xe=k[Te]??k[`${Te}__url`];if(!Xe||typeof Xe=="string"&&!Xe.trim())continue;const nn=Array.isArray(Xe)?Xe[0]:String(Xe);nn&&(hi.current.add(Te),setTimeout(()=>{_r.current(Te,nn)},100))}},[k,e,_r]),Sb(v,_e,ee,ft,S),Ab(v,_e,ft,c,S),vb(v,_e,ee,ft,S),_b(v,_e,ft,S),kb(v,_e,ee,Z,Pe,k),Ll(v,B,Pe,ot,[_e]);const iT=Ol(N,ot);Dl(v,Pe,ft,S),wb(v,tn);const ul=hl(v),sT=gl(v),ll=xl(v);L.useEffect(()=>{if(!v.current)return;v.current.querySelectorAll(".rte-richtext-toggle").forEach(pe=>{const Te=pe.getAttribute("data-expanded")==="true";pe.innerHTML=Te?'<i class="iconfont icon-shouqi1"></i><span class="rte-richtext-toggle-label">收起</span>':'<i class="iconfont icon-zhankai2"></i><span class="rte-richtext-toggle-label">展开</span>'})},[_e,v]);const cl=Ub(v),{measureExpandedContentHeight:$n}=Hl({collapsed:T,collapseTransitionMs:A,contentRef:$,contentBodyRef:V,editorRef:v,debugIdRef:P,setCollapsedContentMaxHeightPx:et,setExpandedContentMaxHeightPx:Pt,setIsCollapseAnimating:St,effectiveConfig:_e,files:ee,multiVariableCounts:Rt,selectPortalsLength:ul.length,datePickerPortalsLength:cl.length,variablePortalsLength:ll.length}),oT=()=>{if(T)return;const ue=V.current;if(!ue)return;const pe=Math.ceil(ue.getBoundingClientRect().height||0);pe>0&&ui(pe),Rn.current=!0,Fn.current=!1,lt.current&&(window.clearTimeout(lt.current),lt.current=null)};L.useEffect(()=>{const ue=()=>{Rn.current&&(Fn.current=!0,lt.current&&window.clearTimeout(lt.current),lt.current=window.setTimeout(()=>{lt.current=null,Rn.current=!1,Fn.current=!1,ui(null),window.requestAnimationFrame(()=>$n())},450))};return window.addEventListener("focus",ue),()=>window.removeEventListener("focus",ue)},[$n]),L.useEffect(()=>{!Rn.current||!Fn.current||(lt.current&&(window.clearTimeout(lt.current),lt.current=null),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{ui(null),$n(),Rn.current=!1,Fn.current=!1})}))},[ee,$n]),$l({config:e,editorRef:v,setIsEmpty:be,setIsFormValid:Z});const uT=Vl({disabled:r,collapsed:T,onCollapsedChange:O,config:e,lockStructure:i,editorRef:v,containerRef:U,fileInputRef:Y,onBeforeFilePickerOpen:oT,files:ee,setFiles:te,handleRemoveFile:Ar,setActiveBatchKey:oe,setActiveBatchStartIndex:Oe,setActiveFileKey:Q,isDraggingRef:tn,richtextPrevScrollTopRef:je,videoState:Pe,setVideoState:ot,videoFileInputRef:Zt,activeVideoKeyRef:en}),mi=Gl({config:e,editorRef:v,setIsEmpty:be,setIsFormValid:Z,setReportAnalyzeState:ci,setMarkdownAnalyzeState:vr,setMarkdownNameAnalyzeState:fi,collapsed:T,measureExpandedContentHeight:$n,effectiveConfig:_e,files:ee,multiVariableCounts:Rt,setMultiVariableCounts:Hn,savedCursorRef:se,videoState:Pe}),lT=jl({disabled:r,config:e,multiVariableCounts:Rt,setMultiVariableCounts:Hn,editorRef:v,handleInput:mi,markdownAnalyzeRef:el,reportAnalyzeRef:_r,markdownNameAnalyzeRef:tl,markdownAnalyzeStateRef:di,markdownRawTextRef:tT,setMarkdownAnalyzeState:vr});zl({config:e,effectiveConfig:_e,files:ee,editorRef:v,setIsFormValid:Z,multiVariableCounts:Rt,setMultiVariableCounts:Hn,videoState:Pe});const cT=Yl({disabled:r,lockStructure:i,config:e,editorRef:v,handleInput:mi}),dT=Xl({config:e,files:ee,onSend:t,isProcessing:n,disabled:r,loading:l,isFormValid:W,editorRef:v,markdownAnalyzeState:Mt,markdownNameAnalyzeState:Bt,videoState:Pe}),fT={...a?{width:typeof a=="number"?`${a}px`:a}:{},...p?{border:p}:{},...E?{background:E}:{},...y?{maxHeight:typeof y=="number"?`${y}px`:y}:{},...h?{minHeight:typeof h=="number"?`${h}px`:h}:{},...y?{"--rte-richtext-fullscreen-height":typeof y=="number"?`${y}px`:y}:{},...m?{"--rte-editor-min-height":typeof m=="number"?`${m}px`:m}:{},...g?{"--rte-editor-padding":g}:{},...b?{"--rte-footer-padding":b}:{}},pT=typeof A=="number"&&Number.isFinite(A)&&A>=0?A:260,hT={overflow:"hidden"},mT=ze!=null?`${ze}px`:T?`${ut}px`:`${Math.max(Dt,ut)}px`,gT=ze!=null||T||He?"hidden":"auto",ET=ze!=null?"none":`max-height ${pT}ms cubic-bezier(0.4, 0, 0.2, 1)`,bT={maxHeight:mT,minHeight:T?0:void 0,overflow:gT,overscrollBehavior:"contain",transition:ET,willChange:"max-height"};return q.jsxs("div",{className:"rich-text-editor",style:fT,"data-disabled":r,ref:U,children:[H,q.jsx("div",{className:"rich-text-editor-content",ref:$,style:hT,children:q.jsxs("div",{ref:V,className:"rich-text-editor-content-body",style:bT,children:[q.jsx("div",{ref:v,className:`rte-editor ${e.length===0?"rte-editor-default":""} ${fe&&d?"rte-editor-empty":""}`,contentEditable:e.length===0,suppressContentEditableWarning:!0,"data-placeholder":d,onMouseDown:ai,onMouseMove:ii,onMouseUp:si,onClick:uT,onDoubleClick:oi,onInput:mi,onKeyDown:cT,onPaste:lT}),q.jsx("input",{type:"file",ref:Y,className:"rte-file-input",accept:".csv,.xlsx,.xls,.txt,.pdf,image/*",onChange:Sr}),q.jsx("input",{type:"file",ref:Zt,className:"rte-file-input",accept:"video/*",onChange:ue=>{const pe=ue.target.files?.[0],Te=en.current;pe&&pe.size>1024*1024*1024?x.warning("视频文件不能超过1GB"):pe&&Te&&iT(Te,pe),en.current=null,Zt.current&&(Zt.current.value="")}})]})}),q.jsxs("div",{className:"rich-text-editor-footer",children:[q.jsxs("div",{className:"rich-text-editor-footer-left",children:[q.jsx("div",{className:"rich-text-editor-brand",children:c!=="hideAgent"&&q.jsx(ce.Dropdown,{placement:"topLeft",menu:{items:s.filter(ue=>ue.isShowNew!==1).map(ue=>({key:ue.key,label:q.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[ue.icon&&q.jsx("i",{className:ue.icon}),q.jsx("span",{children:ue.label})]}),onClick:()=>{o?.(ue)}}))},trigger:["click"],disabled:r||n,overlayClassName:"rte-agent-dropdown",children:q.jsxs("div",{className:"rte-agent-badge",style:{cursor:s.length>0?"pointer":"default"},children:[q.jsx("i",{className:"iconfont icon-zhinengti",style:{fontSize:"16px"}}),q.jsx("span",{className:"rte-agent-text",children:"智能体"})]})})}),M&&q.jsxs(q.Fragment,{children:[q.jsx("div",{className:"rte-footer-upload-btn",onClick:()=>J.current?.click(),title:"上传文件",children:q.jsx("i",{className:"iconfont icon-lianjie",style:{fontSize:"16px"}})}),q.jsx("input",{type:"file",ref:J,className:"rte-file-input",accept:".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,",multiple:!0,onChange:Sr})]})]}),q.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[q.jsxs("div",{className:"rte-brand-badge",children:[q.jsx("div",{className:"rte-brand-badge",children:q.jsx("img",{src:"https://oospublic.sealseek.cn/file/website/ball.png",alt:""})}),q.jsx("span",{className:"rte-brand-text",style:{marginLeft:"4px"},children:"SealSeek 2.0"})]}),(()=>{const ue=e.find(Te=>Te.type==="tag");if(!ue||!ue.text)return null;const pe=s.find(Te=>Te.label===ue.text);return!pe||pe.points===void 0||pe.points===null?null:q.jsxs("div",{className:"rte-points-badge",style:{position:"relative"},children:[q.jsx("i",{className:"iconfont icon-jifen",style:{marginRight:"4px",fontSize:"16px"}}),q.jsxs("span",{style:{fontSize:"16px",lineHeight:"22px"},children:["-",String(pe.points)]}),pe.labelValue===2&&q.jsx("div",{className:"rte-limited-free-badge",children:q.jsx("span",{className:"rte-limited-free-text",children:"限时免费"})})]})})(),q.jsx("button",{type:"button",onClick:dT,disabled:n||r||l||!W,className:"rich-text-editor-send-button",children:n||l?q.jsx("span",{className:"rte-send-spinner"}):q.jsx("i",{className:"iconfont icon-fasong"})})]})]}),Cr,cl,ul,sT,ll]})};Gu.__docgenInfo={displayName:"RichTextEditor",description:"结构化富文本输入组件,支持标签、变量输入块、文件上传以及互斥显示逻辑。",props:{config:{name:"config",required:!0,description:"结构化输入配置节点数组",type:{name:"InputNode[]",raw:"InputNode[]"}},onSend:{name:"onSend",required:!0,description:"点击发送按钮时的回调,返回数据与拼接后的 Prompt",type:{name:"function",raw:"(data: Record<string, any>, fullPrompt: string) => void"}},isProcessing:{name:"isProcessing",required:!1,description:"是否处于处理状态(禁用输入与发送)",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}}}};const Yu="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAFSSURBVHgB3ZTtccIwDIaVXv83I2SDZgSP0BHMBG0naEZhA2boBGQDswHdQJUOGRxjO0Z8HPDe6eJzJD2W4gjgEYSIn2xwK6EIFHqBGysJpMP3ZB0oRbEtmal1NtIxl4OWWsoxEsvqofJ0rgTNASOYq+7SXKDsuYvAcgkq/PWwBLQWqIfdjeRStaBUc4qzgLi9/BzJNmS/sh6bpvmrTfSFacU3scWy1mQryWdSnXiFE8QVUJINLTuyhWzzz/1OZmTN9hEckqtfUOwIGlGCpVRjE+94JFqpMtTeVzO8/UmPxpZU8Qa7aln8Tb9pfwla4WHWrjPvvbbnTBsX7PmLs83EDAH0BxSw1G31+/1FoDg/vPcXR+wocQS1apj4+P92FfhOoLyuBfYlmPgYnGoCjWADzAkzUyJ430awLmphPaxWQVU22BuuApPkHaanjcXSN3t6/QNjTMSJWDcs1QAAAABJRU5ErkJggg==",qb=[{label:"5页",value:5},{label:"10页",value:10},{label:"15页",value:15},{label:"30页",value:30}],zb=({autoLoading:e,batchSize:t,loadingProgress:n,loadIcon:r,onBatchSizeChange:a,onLoadNextPage:i,onStartAutoLoad:s,onStopLoad:o})=>e&&n?q.jsxs("div",{className:"auto_load_progress",children:[r||q.jsx("img",{src:Yu,alt:"自动加载",width:14,height:14}),q.jsxs("span",{children:["正在加载第",n.currentPage,"/",n.totalPages,"页"]}),q.jsx(ce.Progress,{percent:n.percentage,type:"line",size:[160,8]}),q.jsx("span",{onClick:o,className:"auto_load_stop_btn",children:"停止加载"})]}):q.jsxs("div",{className:"auto_load_container",children:[q.jsx("div",{onClick:i,className:"auto_load_next_btn",style:{backgroundColor:e?"#f5f5f5":"#2563eb"},children:"加载下一页"}),q.jsxs("div",{className:"right_control_wrap",style:{backgroundColor:e?"#f5f5f5":"#2563eb"},children:[q.jsxs("div",{className:"auto_load_btn",onClick:e?void 0:s,children:[r||q.jsx("img",{src:Yu,alt:"自动加载",width:14,height:14}),q.jsx("span",{children:"自动加载"})]}),q.jsx(ce.Select,{value:t,onChange:a,options:qb,disabled:e,size:"small",className:"auto_load_select",popupMatchSelectWidth:84})]})]}),Vb=({current:e,loadIcon:t,pageSize:n,total:r,cachedPages:a,loadedCount:i,autoLoading:s=!1,loadingProgress:o,onChange:u,onLoadNextPage:l,onStartAutoLoad:d,onStopLoading:p})=>{const[E,c]=L.useState(5),y=Math.ceil(r/n),h=L.useMemo(()=>a.length>=y,[a,y]),m=()=>Array.from({length:y},(T,_)=>_+1).filter(T=>!a.includes(T)).slice(0,E),g=(b,T,_)=>{const w=a.includes(b);return T==="prev"||T==="next"||T==="jump-prev"||T==="jump-next"?q.jsx("div",{className:"pageBox",children:_}):q.jsxs("div",{className:"pageBox",style:{backgroundColor:e===b?"#2563EB":"#f5f5f5",color:e===b?"#fff":w?"#171717":"#a3a3a3"},children:[b,!w&&q.jsx("span",{className:"unload_spot"})]})};return q.jsxs("div",{className:"pagination_footer",children:[q.jsxs("div",{className:"pagination_leftWrap",children:[q.jsxs("span",{className:"pagination_total",children:[q.jsx(ht.InfoCircleOutlined,{style:{color:"#2563EB",marginRight:"4px"}}),"已加载: ",i,"/",r,"条数据"]}),!h&&q.jsx(zb,{loadIcon:t||void 0,autoLoading:s,batchSize:E,loadingProgress:o,disabled:!l||!d,onBatchSizeChange:c,onLoadNextPage:()=>l?.(),onStartAutoLoad:()=>{const b=m();d?.(b)},onStopLoad:()=>p?.()})]}),q.jsx(ce.Pagination,{current:e,pageSize:n,total:r,onChange:b=>u(b),showSizeChanger:!1,showQuickJumper:!1,showTotal:()=>"",itemRender:g})]})},Wu=e=>{const{loading:t,autoLoading:n,loadingProgress:r,columns:a=[],dataSource:i=[],total:s,current:o,pageSize:u,cachedPages:l,onChangePage:d,onLoadNextPage:p,onStartAutoLoad:E,onStopLoading:c,...y}=e,h=L.useRef(null),m=L.useCallback(g=>{d(g),l.includes(g)&&h.current?.scrollTo({key:`${(g-1)*u+1}`})},[l,d,u]);return q.jsxs("div",{className:"flex flex-col",children:[q.jsx(ce.Table,{ref:h,...y,columns:a,dataSource:i,pagination:!1,virtual:!0}),q.jsx(Vb,{loading:t,autoLoading:n,loadingProgress:r,current:o,pageSize:u,total:s,loadedCount:i.length,cachedPages:l,onChange:m,onLoadNextPage:p,onStartAutoLoad:E,onStopLoading:c})]})};Wu.__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 ju=({texts:e=[],placeholder:t="请输入内容",animationSpeed:n=100,autoPlay:r=!0,value:a,onChange:i,...s})=>{const[o,u]=L.useState(""),[l,d]=L.useState(0),[p,E]=L.useState(!1),[c,y]=L.useState(!1),[h,m]=L.useState(!1),g=L.useRef(void 0),b=L.useRef(void 0),T=L.useRef(e),_=L.useRef(l),w=L.useRef(c),C=L.useRef(o);L.useEffect(()=>{T.current=e,_.current=l,w.current=c,C.current=o});const O=L.useCallback((N,x)=>{let H=0;m(!0);const U=()=>{H<N.length?(u(N.slice(0,H+1)),H++,b.current=window.setTimeout(U,n)):(m(!1),x?.())};U()},[n]),A=L.useCallback(N=>{let x=C.current.length;const H=()=>{x>0?(u(C.current.slice(0,x-1)),x--,b.current=window.setTimeout(H,n/2)):N?.()};H()},[n]),S=L.useCallback(()=>{if(T.current.length===0||w.current)return;E(!0);const N=T.current[_.current];C.current?A(()=>{O(N,()=>{g.current=window.setTimeout(()=>{d(x=>(x+1)%T.current.length),E(!1)},2e3)})}):O(N,()=>{g.current=window.setTimeout(()=>{d(x=>(x+1)%T.current.length),E(!1)},2e3)})},[A,O]);L.useEffect(()=>(r&&e.length>0&&!c&&S(),()=>{g.current&&window.clearTimeout(g.current),b.current&&window.clearTimeout(b.current)}),[l,c,r,e.length,S]),L.useEffect(()=>{!p&&r&&e.length>0&&!c&&S()},[l,p,r,e.length,c,S]);const k=N=>{y(!0),g.current&&window.clearTimeout(g.current),b.current&&window.clearTimeout(b.current),E(!1),m(!1),s.onFocus?.(N)},I=N=>{y(!1),!a&&e.length>0&&(u(""),d(0)),s.onBlur?.(N)},M=N=>{i?.(N.target.value),s.onChange?.(N)},B=()=>c||a?t:o||t;return q.jsxs("div",{style:{position:"relative"},children:[q.jsx(ce.Input,{...s,value:a,onChange:M,onFocus:k,onBlur:I,placeholder:B(),style:{...s.style,position:"relative",zIndex:1}}),!c&&!a&&o&&q.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:[q.jsx("span",{children:o}),h&&q.jsx("span",{style:{display:"inline-block",width:1,height:"1.2em",backgroundColor:"#1890ff",marginLeft:2,animation:"blink 1s infinite"}})]}),q.jsx("style",{children:`
|
|
64
|
+
`);return U.replace(/\n/g,"").trim().length>0?U:""})();H&&(B.getAttribute("data-node-type")==="report-url"?b[`${N}__url`]=H:B.getAttribute("data-node-type")==="markdown-name"?b[`${N}__name`]=H:b[N]=H)}}),e.current.querySelectorAll('[data-type="select"]').forEach(B=>{const N=B.dataset.key;if(N){const x=(B.getAttribute("data-value")||"").trim();x&&(b[N]=x)}}),e.current.querySelectorAll('[data-type="searchable-select"]').forEach(B=>{const N=B.dataset.key;if(N){const x=(B.getAttribute("data-value")||"").trim();x&&(b[N]=x)}}),e.current.querySelectorAll('[data-type="textarea"]').forEach(B=>{const N=B.dataset.key;if(N){const x=B.value.replace(/[\u200B]/g,"").trim();x&&(b[N]=x)}}),e.current.querySelectorAll('[data-type="richtext"]').forEach(B=>{const N=B.dataset.key;if(N){const x=B.getAttribute("data-node-type")||"",H=x==="report-module"||x==="markdown-module",U=H?(B.innerHTML||"").replace(/[\u200B]/g,"").trim():(B.textContent||"").replace(/[\u200B]/g,"").trim();if(H){const $=Number.parseInt(B.getAttribute("data-module-index")||"0",10);b[`${N}__module_${Number.isFinite($)?$:0}`]=U}else U&&(b[N]=U)}}),e.current.querySelectorAll('[data-type="datepicker"]').forEach(B=>{const N=B.dataset.key;if(N){const x=(B.getAttribute("data-value")||"").trim();x&&(b[N]=x)}}),e.current.querySelectorAll('[data-type="number-input"]').forEach(B=>{const N=B.dataset.key;if(N){const x=(B.value||"").trim();x&&(b[N]=x)}})),l&&Object.keys(l).length>0){const C=new Set(t.filter(S=>S.type==="upload"&&S.key).map(S=>S.key)),O={};g||Object.entries(l).forEach(([S,k])=>{if(!Array.isArray(k))return;let I=0;for(let B=0;B<k.length;B++)`${S}_${B}`in b&&I++;let M=-1;for(let B=0;B<k.length;B++)p.current.has(`${S}_${B}`)&&(M=B);if(M>=I&&I<k.length)for(let B=I;B<k.length;B++)T.add(`${S}_${B}`)}),Object.entries(l).forEach(([S,k])=>{C.has(S)||(Array.isArray(k)?k.forEach((I,M)=>{I!=null&&String(I).trim()!==""&&(O[`${S}_${M}`]=String(I))}):k!=null&&String(k).trim()!==""&&(t.find(M=>M.key===S&&M.type==="report-url")?O[`${S}__url`]=String(k):O[S]=String(k)))});const A=y.current!==l;Object.entries(O).forEach(([S,k])=>{const I=S in b;!T.has(S)&&(!I||A)&&(b[S]=k)})}if(y.current=l,xb(e,t,n,r,b,a,o,u,d),g&&(c.current=!1),setTimeout(()=>{zn(e)},0),i?.current){const{key:C,offset:O}=i.current;setTimeout(()=>{if(!e.current)return;const A=e.current.querySelector(`[data-type="variable"][data-key="${C}"]`);if(A){if(A.dataset.variableRender==="antd-textarea"){const S=A.querySelector("textarea");if(S){S.focus();try{const k=S.value?.length??0;S.setSelectionRange(Math.min(O,k),Math.min(O,k))}catch{}i.current=null;return}}try{const S=document.createRange(),k=document.createTreeWalker(A,NodeFilter.SHOW_TEXT,null);let I=0,M=null,B=0;for(;k.nextNode();){const N=k.currentNode,x=N.textContent?.length||0;if(I+x>=O){M=N,B=O-I;break}I+=x}if(M){S.setStart(M,Math.min(B,M.textContent?.length||0)),S.collapse(!0);const N=window.getSelection();N&&(N.removeAllRanges(),N.addRange(S),A.focus())}else{S.selectNodeContents(A),S.collapse(!1);const N=window.getSelection();N&&(N.removeAllRanges(),N.addRange(S),A.focus())}}catch{const S=document.createRange();S.selectNodeContents(A),S.collapse(!1);const k=window.getSelection();k&&(k.removeAllRanges(),k.addRange(S),A.focus())}i.current=null}},0)}},[t,n,r,e,a,i,s,o,u,l,d]);L.useEffect(()=>{h()},[h])}function Sb(e,t,n,r,a){L.useEffect(()=>{const i=e.current;if(!i)return;const s=l=>typeof l=="string"?/\.(png|jpe?g|gif|webp|bmp|svg)(\?.*)?$/i.test(l):l.type?.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(l.name||""),o=l=>{const d=l.target?.closest(".upload-info-icon");if(d&&d.classList.contains("upload-info-icon")){const E=d.dataset.uploadKey;if(E){const c=d.dataset.tooltip||"";let y=!1;try{const m=JSON.parse(c);m&&m.type==="steps"&&Array.isArray(m.images)&&(y=!0)}catch{}if(y){const h=d.closest('[data-type="upload"], [data-type="video-upload"]');r({key:E,anchorEl:h||d,type:"upload"})}else{const h=d.closest('[data-type="upload"], [data-type="video-upload"]');r({key:E,anchorEl:h||d,type:"upload"})}}return}const p=l.target?.closest('[data-type="upload"]');if(p){const E=p.dataset.key;if(E){const c=n[E];c&&s(c)&&r({key:E,anchorEl:p,type:"upload-preview"})}}},u=l=>{if(a)return;const d=l.target?.closest(".upload-info-icon"),p=l.relatedTarget;if(p?.closest?.(".rte-tooltip-overlay"))return;if(d&&d.classList.contains("upload-info-icon")){const c=d.closest('[data-type="upload"], [data-type="video-upload"]');if(p&&c&&c.contains(p))return;if(!p||!i.contains(p))r(null);else{const y=p.closest('[data-type="upload"], [data-type="video-upload"]');(!y||y!==c)&&r(null)}return}const E=l.target?.closest('[data-type="upload"], [data-type="video-upload"]');if(E){const c=p;if(c?.closest?.(".rte-tooltip-overlay")||c&&E.contains(c))return;r(null)}};return i.addEventListener("mouseover",o,!0),i.addEventListener("mouseout",u,!0),()=>{i.removeEventListener("mouseover",o,!0),i.removeEventListener("mouseout",u,!0)}},[t,n,e,r,a])}function Ab(e,t,n,r,a){L.useEffect(()=>{const i=e.current;if(!i)return;const s=d=>{if(r==="hideTagClose")return;const p=d.currentTarget,E=p.dataset.tooltip,c=p.dataset.tagKey||"";E&&n({key:c,anchorEl:p,type:"tag"})},o=d=>{a||d.relatedTarget?.closest?.(".rte-tooltip-overlay")||n(null)};let u;const l=()=>{i.querySelectorAll(".tag-node[data-tooltip]").forEach(p=>{p.addEventListener("mouseenter",s),p.addEventListener("mouseleave",o)})};return u=requestAnimationFrame(()=>{u=requestAnimationFrame(l)}),()=>{cancelAnimationFrame(u),i.querySelectorAll(".tag-node[data-tooltip]").forEach(p=>{p.removeEventListener("mouseenter",s),p.removeEventListener("mouseleave",o)})}},[t,e,n,r,a])}function _b(e,t,n,r){L.useEffect(()=>{const a=e.current;if(!a)return;const i=o=>{const u=o.target?.closest(".variable-info-icon");if(u&&u.classList.contains("variable-info-icon")){const d=u.dataset.variableKey;d&&n({key:d,anchorEl:u,type:"variable"});return}const l=o.target?.closest('[data-type="variable"][data-node-type="report-url"][data-tooltip]');if(l){const d=l.dataset.key;d&&n({key:d,anchorEl:l,type:"variable"})}},s=o=>{if(r)return;const u=o.target,l=o.relatedTarget;if(l?.closest?.(".rte-tooltip-overlay"))return;const d=u?.closest?.(".variable-info-icon"),p=u?.closest?.('[data-type="variable"][data-node-type="report-url"][data-tooltip]');if(d||p){if(!l||!a.contains(l)){n(null);return}const E=!!l.closest?.(".variable-info-icon"),c=!!l.closest?.('[data-type="variable"][data-node-type="report-url"][data-tooltip]');!E&&!c&&n(null)}};return a.addEventListener("mouseover",i,!0),a.addEventListener("mouseout",s,!0),()=>{a.removeEventListener("mouseover",i,!0),a.removeEventListener("mouseout",s,!0)}},[t,e,n,r])}function vb(e,t,n,r,a){L.useEffect(()=>{const i=e.current;if(!i)return;const s=p=>typeof p=="string"?/\.(png|jpe?g|gif|webp|bmp|svg)(\?.*)?$/i.test(p):p.type?.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(p.name||""),o=p=>{const E=p.currentTarget,c=E.dataset.fileName,y=E.closest('[data-type="upload"]'),h=y?.dataset.key||"",m=h?n[h]:null;if(m&&s(m)){r({key:h,anchorEl:y||E,type:"upload-preview"});return}c&&r({key:h,anchorEl:y||E,type:"upload-label"})},u=p=>{a||p.relatedTarget?.closest?.(".rte-tooltip-overlay")||r(null)};let l;const d=()=>{i.querySelectorAll(".upload-label[data-file-name]").forEach(E=>{E.addEventListener("mouseenter",o),E.addEventListener("mouseleave",u)})};return l=requestAnimationFrame(()=>{l=requestAnimationFrame(d)}),()=>{cancelAnimationFrame(l),i.querySelectorAll(".upload-label[data-file-name]").forEach(E=>{E.removeEventListener("mouseenter",o),E.removeEventListener("mouseleave",u)})}},[t,n,e,r,a])}function kb(e,t,n,r,a,i){L.useEffect(()=>{const s=setTimeout(()=>{wr(e,t,n,a),Nr(e,t,n,r,a)},0);return()=>clearTimeout(s)},[n,t,e,r,a,i])}function wb(e,t){const n=L.useRef(0),r=L.useRef(0);L.useEffect(()=>{if(!e.current)return;let a=!1,i=0;const s=b=>b instanceof HTMLElement?!!(b.closest(".rte-datepicker-wrapper")||b.closest(".rte-datepicker-host")||b.closest(".ant-picker")||b.closest(".ant-picker-dropdown")):!1,o=b=>b instanceof HTMLElement?!!(b.closest(".rte-select-wrapper")||b.closest(".rte-select-host")||b.closest(".ant-select")||b.closest(".ant-select-dropdown")):!1,u=b=>{a=!0,s(b.target)&&(n.current=Date.now()),o(b.target)&&(r.current=Date.now())},l=()=>{a=!1,i=Date.now()};let d=!1,p=0;const E=()=>{d=!0},c=()=>{d=!1,p=Date.now()},y=()=>{p=Date.now()},h=b=>{s(b.target)&&(n.current=Date.now()),o(b.target)&&(r.current=Date.now())},m=()=>{if(Date.now()-n.current<800||Date.now()-r.current<800)return;const b=document.activeElement;if(b&&(b.closest(".rte-datepicker-wrapper")||b.closest(".rte-datepicker-host")||b.closest(".ant-picker-dropdown")||b.tagName==="INPUT"&&b.closest(".ant-picker")||b.closest(".rte-select-wrapper")||b.closest(".rte-select-host")||b.closest(".ant-select")||b.closest(".ant-select-dropdown"))||!e.current)return;const T=window.getSelection();if(!T||T.rangeCount===0||t.current||a||d||Date.now()-p<500)return;const _=T.getRangeAt(0);if(!_.collapsed)return e.current.contains(_.commonAncestorContainer),void 0;const w=T.anchorNode;if(!w||!e.current.contains(w))return;let C=!1,O=!1;if(w.nodeType===Node.ELEMENT_NODE){const S=w;(S.closest('[data-type="datepicker"]')||S.closest(".rte-datepicker-wrapper")||S.closest(".rte-datepicker-host"))&&(C=!0),(S.closest('[data-type="select"]')||S.closest(".rte-select-wrapper")||S.closest(".rte-select-host"))&&(O=!0)}else if(w.parentElement){const S=w.parentElement;(S.closest('[data-type="datepicker"]')||S.closest(".rte-datepicker-wrapper")||S.closest(".rte-datepicker-host"))&&(C=!0),(S.closest('[data-type="select"]')||S.closest(".rte-select-wrapper")||S.closest(".rte-select-host"))&&(O=!0)}if(C||O)return;let A=null;if(w.nodeType===Node.ELEMENT_NODE?A=w.closest('[data-type="variable"]'):w.nodeType===Node.TEXT_NODE&&w.parentElement&&(A=w.parentElement.closest('[data-type="variable"]')),!A){if(Date.now()-i>500)return;const S=e.current.querySelectorAll('[data-type="variable"]');if(S.length>0){let k=null;for(const I of Array.from(S))if(I.style.display!=="none"){k=I;break}if(!k&&S.length>0&&(k=S[0]),k){const I=document.createRange();I.selectNodeContents(k),I.collapse(!1),T.removeAllRanges(),T.addRange(I),k.focus()}else T.removeAllRanges()}else T.removeAllRanges()}},g=e.current;return g&&(g.addEventListener("compositionstart",E),g.addEventListener("compositionend",c),g.addEventListener("input",y)),document.addEventListener("mousedown",u),document.addEventListener("mouseup",l),document.addEventListener("focusin",h),document.addEventListener("selectionchange",m),()=>{g&&(g.removeEventListener("compositionstart",E),g.removeEventListener("compositionend",c),g.removeEventListener("input",y)),document.removeEventListener("mousedown",u),document.removeEventListener("mouseup",l),document.removeEventListener("focusin",h),document.removeEventListener("selectionchange",m)}},[e,t])}var Tr={exports:{}},Nb=Tr.exports,Hu;function $u(){return Hu||(Hu=1,function(e,t){(function(n,r){e.exports=r()})(Nb,function(){var n=1e3,r=6e4,a=36e5,i="millisecond",s="second",o="minute",u="hour",l="day",d="week",p="month",E="quarter",c="year",y="date",h="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,g=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,b={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(N){var x=["th","st","nd","rd"],H=N%100;return"["+N+(x[(H-20)%10]||x[H]||x[0])+"]"}},T=function(N,x,H){var U=String(N);return!U||U.length>=x?N:""+Array(x+1-U.length).join(H)+N},_={s:T,z:function(N){var x=-N.utcOffset(),H=Math.abs(x),U=Math.floor(H/60),$=H%60;return(x<=0?"+":"-")+T(U,2,"0")+":"+T($,2,"0")},m:function N(x,H){if(x.date()<H.date())return-N(H,x);var U=12*(H.year()-x.year())+(H.month()-x.month()),$=x.clone().add(U,p),V=H-$<0,v=x.clone().add(U+(V?-1:1),p);return+(-(U+(H-$)/(V?$-v:v-$))||0)},a:function(N){return N<0?Math.ceil(N)||0:Math.floor(N)},p:function(N){return{M:p,y:c,w:d,d:l,D:y,h:u,m:o,s,ms:i,Q:E}[N]||String(N||"").toLowerCase().replace(/s$/,"")},u:function(N){return N===void 0}},w="en",C={};C[w]=b;var O="$isDayjsObject",A=function(N){return N instanceof M||!(!N||!N[O])},S=function N(x,H,U){var $;if(!x)return w;if(typeof x=="string"){var V=x.toLowerCase();C[V]&&($=V),H&&(C[V]=H,$=V);var v=x.split("-");if(!$&&v.length>1)return N(v[0])}else{var Y=x.name;C[Y]=x,$=Y}return!U&&$&&(w=$),$||!U&&w},k=function(N,x){if(A(N))return N.clone();var H=typeof x=="object"?x:{};return H.date=N,H.args=arguments,new M(H)},I=_;I.l=S,I.i=A,I.w=function(N,x){return k(N,{locale:x.$L,utc:x.$u,x:x.$x,$offset:x.$offset})};var M=function(){function N(H){this.$L=S(H.locale,null,!0),this.parse(H),this.$x=this.$x||H.x||{},this[O]=!0}var x=N.prototype;return x.parse=function(H){this.$d=function(U){var $=U.date,V=U.utc;if($===null)return new Date(NaN);if(I.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var v=$.match(m);if(v){var Y=v[2]-1||0,J=(v[7]||"0").substring(0,3);return V?new Date(Date.UTC(v[1],Y,v[3]||1,v[4]||0,v[5]||0,v[6]||0,J)):new Date(v[1],Y,v[3]||1,v[4]||0,v[5]||0,v[6]||0,J)}}return new Date($)}(H),this.init()},x.init=function(){var H=this.$d;this.$y=H.getFullYear(),this.$M=H.getMonth(),this.$D=H.getDate(),this.$W=H.getDay(),this.$H=H.getHours(),this.$m=H.getMinutes(),this.$s=H.getSeconds(),this.$ms=H.getMilliseconds()},x.$utils=function(){return I},x.isValid=function(){return this.$d.toString()!==h},x.isSame=function(H,U){var $=k(H);return this.startOf(U)<=$&&$<=this.endOf(U)},x.isAfter=function(H,U){return k(H)<this.startOf(U)},x.isBefore=function(H,U){return this.endOf(U)<k(H)},x.$g=function(H,U,$){return I.u(H)?this[U]:this.set($,H)},x.unix=function(){return Math.floor(this.valueOf()/1e3)},x.valueOf=function(){return this.$d.getTime()},x.startOf=function(H,U){var $=this,V=!!I.u(U)||U,v=I.p(H),Y=function(oe,ge){var Oe=I.w($.$u?Date.UTC($.$y,ge,oe):new Date($.$y,ge,oe),$);return V?Oe:Oe.endOf(l)},J=function(oe,ge){return I.w($.toDate()[oe].apply($.toDate("s"),(V?[0,0,0,0]:[23,59,59,999]).slice(ge)),$)},P=this.$W,ee=this.$M,te=this.$D,ae="set"+(this.$u?"UTC":"");switch(v){case c:return V?Y(1,0):Y(31,11);case p:return V?Y(1,ee):Y(0,ee+1);case d:var Q=this.$locale().weekStart||0,re=(P<Q?P+7:P)-Q;return Y(V?te-re:te+(6-re),ee);case l:case y:return J(ae+"Hours",0);case u:return J(ae+"Minutes",1);case o:return J(ae+"Seconds",2);case s:return J(ae+"Milliseconds",3);default:return this.clone()}},x.endOf=function(H){return this.startOf(H,!1)},x.$set=function(H,U){var $,V=I.p(H),v="set"+(this.$u?"UTC":""),Y=($={},$[l]=v+"Date",$[y]=v+"Date",$[p]=v+"Month",$[c]=v+"FullYear",$[u]=v+"Hours",$[o]=v+"Minutes",$[s]=v+"Seconds",$[i]=v+"Milliseconds",$)[V],J=V===l?this.$D+(U-this.$W):U;if(V===p||V===c){var P=this.clone().set(y,1);P.$d[Y](J),P.init(),this.$d=P.set(y,Math.min(this.$D,P.daysInMonth())).$d}else Y&&this.$d[Y](J);return this.init(),this},x.set=function(H,U){return this.clone().$set(H,U)},x.get=function(H){return this[I.p(H)]()},x.add=function(H,U){var $,V=this;H=Number(H);var v=I.p(U),Y=function(ee){var te=k(V);return I.w(te.date(te.date()+Math.round(ee*H)),V)};if(v===p)return this.set(p,this.$M+H);if(v===c)return this.set(c,this.$y+H);if(v===l)return Y(1);if(v===d)return Y(7);var J=($={},$[o]=r,$[u]=a,$[s]=n,$)[v]||1,P=this.$d.getTime()+H*J;return I.w(P,this)},x.subtract=function(H,U){return this.add(-1*H,U)},x.format=function(H){var U=this,$=this.$locale();if(!this.isValid())return $.invalidDate||h;var V=H||"YYYY-MM-DDTHH:mm:ssZ",v=I.z(this),Y=this.$H,J=this.$m,P=this.$M,ee=$.weekdays,te=$.months,ae=$.meridiem,Q=function(ge,Oe,Pe,ot){return ge&&(ge[Oe]||ge(U,V))||Pe[Oe].slice(0,ot)},re=function(ge){return I.s(Y%12||12,ge,"0")},oe=ae||function(ge,Oe,Pe){var ot=ge<12?"AM":"PM";return Pe?ot.toLowerCase():ot};return V.replace(g,function(ge,Oe){return Oe||function(Pe){switch(Pe){case"YY":return String(U.$y).slice(-2);case"YYYY":return I.s(U.$y,4,"0");case"M":return P+1;case"MM":return I.s(P+1,2,"0");case"MMM":return Q($.monthsShort,P,te,3);case"MMMM":return Q(te,P);case"D":return U.$D;case"DD":return I.s(U.$D,2,"0");case"d":return String(U.$W);case"dd":return Q($.weekdaysMin,U.$W,ee,2);case"ddd":return Q($.weekdaysShort,U.$W,ee,3);case"dddd":return ee[U.$W];case"H":return String(Y);case"HH":return I.s(Y,2,"0");case"h":return re(1);case"hh":return re(2);case"a":return oe(Y,J,!0);case"A":return oe(Y,J,!1);case"m":return String(J);case"mm":return I.s(J,2,"0");case"s":return String(U.$s);case"ss":return I.s(U.$s,2,"0");case"SSS":return I.s(U.$ms,3,"0");case"Z":return v}return null}(ge)||v.replace(":","")})},x.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},x.diff=function(H,U,$){var V,v=this,Y=I.p(U),J=k(H),P=(J.utcOffset()-this.utcOffset())*r,ee=this-J,te=function(){return I.m(v,J)};switch(Y){case c:V=te()/12;break;case p:V=te();break;case E:V=te()/3;break;case d:V=(ee-P)/6048e5;break;case l:V=(ee-P)/864e5;break;case u:V=ee/a;break;case o:V=ee/r;break;case s:V=ee/n;break;default:V=ee}return $?V:I.a(V)},x.daysInMonth=function(){return this.endOf(p).$D},x.$locale=function(){return C[this.$L]},x.locale=function(H,U){if(!H)return this.$L;var $=this.clone(),V=S(H,U,!0);return V&&($.$L=V),$},x.clone=function(){return I.w(this.$d,this)},x.toDate=function(){return new Date(this.valueOf())},x.toJSON=function(){return this.isValid()?this.toISOString():null},x.toISOString=function(){return this.$d.toISOString()},x.toString=function(){return this.$d.toUTCString()},N}(),B=M.prototype;return k.prototype=B,[["$ms",i],["$s",s],["$m",o],["$H",u],["$W",l],["$M",p],["$y",c],["$D",y]].forEach(function(N){B[N[1]]=function(x){return this.$g(x,N[0],N[1])}}),k.extend=function(N,x){return N.$i||(N(x,M,k),N.$i=!0),k},k.locale=S,k.isDayjs=A,k.unix=function(N){return k(1e3*N)},k.en=C[w],k.Ls=C,k.p={},k})}(Tr)),Tr.exports}var Ib=$u();const yr=Yr(Ib);var xr={exports:{}},Lb=xr.exports,Uu;function Ob(){return Uu||(Uu=1,function(e,t){(function(n,r){e.exports=r($u())})(Lb,function(n){function r(s){return s&&typeof s=="object"&&"default"in s?s:{default:s}}var a=r(n),i={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(s,o){return o==="W"?s+"周":s+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(s,o){var u=100*s+o;return u<600?"凌晨":u<900?"早上":u<1100?"上午":u<1300?"中午":u<1800?"下午":"晚上"}};return a.default.locale(i,null,!0),i})}(xr)),xr.exports}Ob();function Pn(e){"@babel/helpers - typeof";return Pn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pn(e)}function Db(e,t){if(Pn(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Pn(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Pb(e){var t=Db(e,"string");return Pn(t)=="symbol"?t:t+""}function Mb(e,t,n){return(t=Pb(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function zu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qu(Object(n),!0).forEach(function(r){Mb(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Bb={yearFormat:"YYYY",dayFormat:"D",cellMeridiemFormat:"A",monthBeforeYear:!0},Rb=zu(zu({},Bb),{},{locale:"zh_CN",today:"今天",now:"此刻",backToToday:"返回今天",ok:"确定",timeSelect:"选择时间",dateSelect:"选择日期",weekSelect:"选择周",clear:"清除",week:"周",month:"月",year:"年",previousMonth:"上个月 (翻页上键)",nextMonth:"下个月 (翻页下键)",monthSelect:"选择月份",yearSelect:"选择年份",decadeSelect:"选择年代",previousYear:"上一年 (Control键加左方向键)",nextYear:"下一年 (Control键加右方向键)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世纪",nextCentury:"下一世纪",yearFormat:"YYYY年",cellDateFormat:"D",monthBeforeYear:!1});const Fb={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]},Vu={lang:Object.assign({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},Rb),timePickerLocale:Object.assign({},Fb)};Vu.lang.ok="确定",yr.locale("zh-cn");const{RangePicker:Hb}=ce.DatePicker,$b=({host:e,onChange:t})=>{const n=e.dataset.key,r=e.dataset.value,a=e.dataset.placeholder,i=e.dataset.limitRange?parseInt(e.dataset.limitRange,10):void 0,s=e.dataset.disableFuture==="true",[o,u]=L.useState(()=>{if(!r)return null;const h=r.split(",");return h.length===2&&h[0]&&h[1]?[yr(h[0]),yr(h[1])]:null}),[l,d]=L.useState(null),p=h=>h?s&&h.isAfter(yr(),"day")?!0:!i||!l||!l[0]?!1:Math.abs(h.diff(l[0],"days"))>i:!1,E=h=>{d(h)},c=h=>{if(u(h),d(null),h&&h[0]&&h[1]){const m=`${h[0].format("YYYY-MM-DD")},${h[1].format("YYYY-MM-DD")}`;e.setAttribute("data-value",m),t(n,m)}else e.setAttribute("data-value",""),t(n,"")},y=h=>{d(h?o:null)};return rn.createPortal(q.jsx("div",{className:"rte-datepicker-wrapper",contentEditable:!1,style:{display:"inline-block",verticalAlign:"middle",width:"260px",marginLeft:"4px",marginRight:"4px",fontSize:"16px",height:"30px",lineHeight:"30px"},children:q.jsx(Hb,{value:o,disabledDate:p,onCalendarChange:E,onChange:c,onOpenChange:y,placeholder:[a||"开始日期",a||"结束日期"],style:{width:"100%"},size:"small",allowClear:!0,locale:Vu,getPopupContainer:()=>document.body,popupClassName:"rte-datepicker-dropdown"})}),e)},Ub=e=>{const[t,n]=L.useState([]);return L.useEffect(()=>{const r=e.current;if(!r)return;const a=()=>{const s=r.querySelectorAll(".rte-datepicker-host"),o=[];s.forEach(u=>{const l=u.getAttribute("data-key");l&&o.push(q.jsx($b,{host:u,onChange:()=>{if(e.current){const d=new Event("input",{bubbles:!0});e.current.dispatchEvent(d)}}},`datepicker-${l}`))}),n(o)};a();const i=new MutationObserver(s=>{let o=!1;for(const u of s)if(u.type==="childList"){let l=!1;if(u.addedNodes.forEach(d=>{if(d.nodeType===Node.ELEMENT_NODE){const p=d;(p.classList?.contains("rte-datepicker-host")||p.querySelector?.(".rte-datepicker-host"))&&(l=!0)}}),u.removedNodes.forEach(d=>{if(d.nodeType===Node.ELEMENT_NODE){const p=d;(p.classList?.contains("rte-datepicker-host")||p.querySelector?.(".rte-datepicker-host"))&&(l=!0)}}),l){o=!0;break}}o&&a()});return i.observe(r,{childList:!0,subtree:!0}),()=>i.disconnect()},[e]),t},Gu=({config:e,onSend:t,isProcessing:n=!1,disabled:r=!1,width:a,lockStructure:i=!1,agentOptions:s=[],onAgentSelect:o,onAgentExit:u,loading:l=!1,placeholder:d,border:p,background:E="transparent",hideButtons:c,maxHeight:y,minHeight:h,editorMinHeight:m,editorPadding:g,footerPadding:b,collapsed:T=!1,reportAnalyze:_,markdownAnalyze:w,markdownNameAnalyze:C,onCollapsedChange:O,collapseTransitionMs:A=260,debugTooltipSticky:S=!1,nodeValues:k,onFilesChange:I,showFooterUpload:M=!0,videoUrlParse:B,videoUpload:N})=>{const[x,H]=ce.message.useMessage(),U=L.useRef(null),$=L.useRef(null),V=L.useRef(null),v=L.useRef(null),Y=L.useRef(null),J=L.useRef(null),P=L.useRef("");if(!P.current){const ue=Math.random().toString(36).slice(2,8);P.current=`rte_${ue}`}const[ee,te]=L.useState({});L.useEffect(()=>{I?.(ee)},[ee,I]);const[ae,Q]=L.useState(null),[re,oe]=L.useState(null),[ge,Oe]=L.useState(null),[Pe,ot]=L.useState({}),Zt=L.useRef(null),en=L.useRef(null),{tooltipPortal:Cr,setPopoverVisible:ft}=V1({config:e,files:ee,debugTooltipSticky:S,videoState:Pe}),{handleFileChange:Sr,handleRemoveFile:Ar}=kl({config:e,messageApi:x,activeBatchKey:re,activeFileKey:ae,activeBatchStartIndex:ge,setActiveFileKey:Q,setActiveBatchKey:oe,setActiveBatchStartIndex:Oe,setFiles:te}),tn=L.useRef(!1),ri=L.useRef(null),{handleMouseDown:ai,handleMouseMove:ii,handleMouseUp:si,handleDoubleClick:oi}=Wl({lockStructure:i,onAgentExit:u,editorRef:v,setPopoverVisible:ft,isDraggingRef:tn,mouseDownPosRef:ri}),[W,Z]=L.useState(!1),se=L.useRef(null),[fe,be]=L.useState(!0),je=L.useRef(0),[ut,et]=L.useState(58),[Dt,Pt]=L.useState(58),[He,St]=L.useState(!1),[ze,ui]=L.useState(null),Rn=L.useRef(!1),Fn=L.useRef(!1),lt=L.useRef(null),[li,ci]=L.useState({}),_r=L.useRef(()=>{}),[Mt,vr]=L.useState({}),el=L.useRef(()=>{}),tT=L.useRef({}),di=L.useRef(Mt);L.useEffect(()=>{di.current=Mt},[Mt]);const[Bt,fi]=L.useState({}),tl=L.useRef(()=>{}),nl=L.useRef(Bt);L.useEffect(()=>{nl.current=Bt},[Bt]);const[Rt,Hn]=L.useState(()=>{const ue={};return e.forEach(pe=>{pe.type==="multi-variable"&&pe.key&&(ue[pe.key]=1)}),ue});Bl({config:e,editorRef:v,files:ee,setFiles:te,multiVariableCounts:Rt,setMultiVariableCounts:Hn,reportAnalyzeState:li,setReportAnalyzeState:ci,markdownAnalyzeState:Mt,setMarkdownAnalyzeState:vr,markdownNameAnalyzeState:Bt,setMarkdownNameAnalyzeState:fi,nodeValues:k});const rl=L.useRef(k);if(k!==rl.current&&(rl.current=k,k)){const ue={};let pe=!1;e.forEach(Te=>{if(Te.type==="multi-variable"&&Te.key){const Xe=k[Te.key];if(Array.isArray(Xe)&&Xe.length>0){const nn=Te.maxCount??9,Un=Math.min(Xe.length+1,nn);Rt[Te.key]!==Un&&(ue[Te.key]=Un,pe=!0)}}}),pe&&Hn(Te=>({...Te,...ue}))}const _e=Ul({config:e,reportAnalyzeState:li,markdownAnalyzeState:Mt,markdownNameAnalyzeState:Bt}),{handleReportUrlBlur:nT,handleMarkdownBlur:rT,handleMarkdownNameBlur:aT}=Fl({reportAnalyze:_,markdownAnalyze:w,markdownNameAnalyze:C,reportAnalyzeState:li,setReportAnalyzeState:ci,markdownAnalyzeState:Mt,setMarkdownAnalyzeState:vr,markdownNameAnalyzeState:Bt,setMarkdownNameAnalyzeState:fi,editorRef:v,reportAnalyzeRef:_r,markdownAnalyzeRef:el,markdownNameAnalyzeRef:tl,markdownAnalyzeStateRef:di,markdownNameAnalyzeStateRef:nl});Sl(v,nT,[_e]),Al(v,aT,[_e]),_l(v,rT,[_e]),Cl(v,[_e]),Cb(v,_e,ee,i,Rt,se,void 0,c,void 0,k,Pe);const pi=L.useRef(new Set),al=L.useRef(_e),il=L.useRef(k);(al.current!==_e||il.current!==k)&&(al.current=_e,il.current=k,pi.current=new Set),L.useEffect(()=>{if(!k||!_e||_e.length===0)return;const ue=_e.filter(ye=>ye.type==="upload"&&ye.key);if(ue.length===0)return;const pe={},Te=(ye,Ce)=>{Ce&&(Ce instanceof File?pe[ye]=Ce:typeof Ce=="string"&&Ce.trim()&&(pe[ye]=Ce.trim()))};for(const ye of ue){const Ce=ye.key;if(pi.current.has(Ce))continue;const Ae=k[Ce],Re=typeof ye.maxCount=="number"&&ye.maxCount>1;if(Array.isArray(Ae)&&Ae.length>0){Re?Ae.forEach((De,Ve)=>Te(`${Ce}-${Ve}`,De)):Te(Ce,Ae[0]);continue}if(Ae&&!Array.isArray(Ae)){Te(Ce,Ae);continue}if(Re)for(let De=0;De<ye.maxCount;De++){const Ve=`${Ce}-${De}`,At=k[Ve];if(!At)break;Te(Ve,At)}}if(Object.keys(pe).length===0)return;for(const ye of ue)k[ye.key]!==void 0&&pi.current.add(ye.key);te(ye=>{const Ce={...ye};let Ae=!1;for(const Re of ue){const De=Re.key;if(k[De]===void 0)continue;if(typeof Re.maxCount=="number"&&Re.maxCount>1)for(let At=0;At<Re.maxCount;At++){const gi=`${De}-${At}`;!pe[gi]&&ye[gi]&&(Ce[gi]=null,Ae=!0)}}for(const[Re,De]of Object.entries(pe))ye[Re]!==De&&(Ce[Re]=De,Ae=!0);return Ae?Ce:ye});const Xe=Object.entries(pe).filter(([,ye])=>typeof ye=="string");if(Xe.length===0)return;const nn=async ye=>{const Ce=ye.split("/").pop()?.split("?")[0]||"file",Ae=decodeURIComponent(Ce),Re=async De=>{const Ve=await De.blob();return new File([Ve],Ae,{type:Ve.type||"application/octet-stream"})};try{const De=`/api/image-proxy?url=${encodeURIComponent(ye)}`,Ve=await fetch(De);if(Ve.ok)return Re(Ve)}catch{}return null};let Un=!1;return Promise.all(Xe.map(async([ye,Ce])=>{const Ae=await nn(Ce);return Ae?{key:ye,file:Ae}:null})).then(ye=>{if(Un)return;const Ce={};for(const Ae of ye)Ae&&(Ce[Ae.key]=Ae.file);Object.keys(Ce).length>0&&te(Ae=>{const Re={...Ae};let De=!1;for(const[Ve,At]of Object.entries(Ce))typeof Re[Ve]=="string"&&(Re[Ve]=At,De=!0);return De?Re:Ae})}),()=>{Un=!0}},[k,_e]);const hi=L.useRef(new Set),sl=L.useRef(""),ol=(e||[]).filter(ue=>ue.key&&ue.type!=="report-module"&&ue.type!=="markdown-module").map(ue=>`${ue.type}:${ue.key}`).join("|");sl.current!==ol&&(sl.current=ol,hi.current=new Set),L.useEffect(()=>{if(!k||!e||e.length===0)return;const ue=e.filter(pe=>pe.type==="report-url"&&pe.key);if(ue.length!==0)for(const pe of ue){const Te=pe.key;if(hi.current.has(Te))continue;const Xe=k[Te]??k[`${Te}__url`];if(!Xe||typeof Xe=="string"&&!Xe.trim())continue;const nn=Array.isArray(Xe)?Xe[0]:String(Xe);nn&&(hi.current.add(Te),setTimeout(()=>{_r.current(Te,nn)},100))}},[k,e,_r]),Sb(v,_e,ee,ft,S),Ab(v,_e,ft,c,S),vb(v,_e,ee,ft,S),_b(v,_e,ft,S),kb(v,_e,ee,Z,Pe,k),Ll(v,B,Pe,ot,[_e]);const iT=Ol(N,ot);Dl(v,Pe,ft,S),wb(v,tn);const ul=hl(v),sT=gl(v),ll=xl(v);L.useEffect(()=>{if(!v.current)return;v.current.querySelectorAll(".rte-richtext-toggle").forEach(pe=>{const Te=pe.getAttribute("data-expanded")==="true";pe.innerHTML=Te?'<i class="iconfont icon-shouqi1"></i><span class="rte-richtext-toggle-label">收起</span>':'<i class="iconfont icon-zhankai2"></i><span class="rte-richtext-toggle-label">展开</span>'})},[_e,v]);const cl=Ub(v),{measureExpandedContentHeight:$n}=Hl({collapsed:T,collapseTransitionMs:A,contentRef:$,contentBodyRef:V,editorRef:v,debugIdRef:P,setCollapsedContentMaxHeightPx:et,setExpandedContentMaxHeightPx:Pt,setIsCollapseAnimating:St,effectiveConfig:_e,files:ee,multiVariableCounts:Rt,selectPortalsLength:ul.length,datePickerPortalsLength:cl.length,variablePortalsLength:ll.length}),oT=()=>{if(T)return;const ue=V.current;if(!ue)return;const pe=Math.ceil(ue.getBoundingClientRect().height||0);pe>0&&ui(pe),Rn.current=!0,Fn.current=!1,lt.current&&(window.clearTimeout(lt.current),lt.current=null)};L.useEffect(()=>{const ue=()=>{Rn.current&&(Fn.current=!0,lt.current&&window.clearTimeout(lt.current),lt.current=window.setTimeout(()=>{lt.current=null,Rn.current=!1,Fn.current=!1,ui(null),window.requestAnimationFrame(()=>$n())},450))};return window.addEventListener("focus",ue),()=>window.removeEventListener("focus",ue)},[$n]),L.useEffect(()=>{!Rn.current||!Fn.current||(lt.current&&(window.clearTimeout(lt.current),lt.current=null),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{ui(null),$n(),Rn.current=!1,Fn.current=!1})}))},[ee,$n]),$l({config:e,editorRef:v,setIsEmpty:be,setIsFormValid:Z});const uT=Vl({disabled:r,collapsed:T,onCollapsedChange:O,config:e,lockStructure:i,editorRef:v,containerRef:U,fileInputRef:Y,onBeforeFilePickerOpen:oT,files:ee,setFiles:te,handleRemoveFile:Ar,setActiveBatchKey:oe,setActiveBatchStartIndex:Oe,setActiveFileKey:Q,isDraggingRef:tn,richtextPrevScrollTopRef:je,videoState:Pe,setVideoState:ot,videoFileInputRef:Zt,activeVideoKeyRef:en}),mi=Gl({config:e,editorRef:v,setIsEmpty:be,setIsFormValid:Z,setReportAnalyzeState:ci,setMarkdownAnalyzeState:vr,setMarkdownNameAnalyzeState:fi,collapsed:T,measureExpandedContentHeight:$n,effectiveConfig:_e,files:ee,multiVariableCounts:Rt,setMultiVariableCounts:Hn,savedCursorRef:se,videoState:Pe}),lT=jl({disabled:r,config:e,multiVariableCounts:Rt,setMultiVariableCounts:Hn,editorRef:v,handleInput:mi,markdownAnalyzeRef:el,reportAnalyzeRef:_r,markdownNameAnalyzeRef:tl,markdownAnalyzeStateRef:di,markdownRawTextRef:tT,setMarkdownAnalyzeState:vr});zl({config:e,effectiveConfig:_e,files:ee,editorRef:v,setIsFormValid:Z,multiVariableCounts:Rt,setMultiVariableCounts:Hn,videoState:Pe});const cT=Yl({disabled:r,lockStructure:i,config:e,editorRef:v,handleInput:mi}),dT=Xl({config:e,files:ee,onSend:t,isProcessing:n,disabled:r,loading:l,isFormValid:W,editorRef:v,markdownAnalyzeState:Mt,markdownNameAnalyzeState:Bt,videoState:Pe}),fT={...a?{width:typeof a=="number"?`${a}px`:a}:{},...p?{border:p}:{},...E?{background:E}:{},...y?{maxHeight:typeof y=="number"?`${y}px`:y}:{},...h?{minHeight:typeof h=="number"?`${h}px`:h}:{},...y?{"--rte-richtext-fullscreen-height":typeof y=="number"?`${y}px`:y}:{},...m?{"--rte-editor-min-height":typeof m=="number"?`${m}px`:m}:{},...g?{"--rte-editor-padding":g}:{},...b?{"--rte-footer-padding":b}:{}},pT=typeof A=="number"&&Number.isFinite(A)&&A>=0?A:260,hT={overflow:"hidden"},mT=ze!=null?`${ze}px`:T?`${ut}px`:`${Math.max(Dt,ut)}px`,gT=ze!=null||T||He?"hidden":"auto",ET=ze!=null?"none":`max-height ${pT}ms cubic-bezier(0.4, 0, 0.2, 1)`,bT={maxHeight:mT,minHeight:T?0:void 0,overflow:gT,overscrollBehavior:"contain",transition:ET,willChange:"max-height"};return q.jsxs("div",{className:"rich-text-editor",style:fT,"data-disabled":r,ref:U,children:[H,q.jsx("div",{className:"rich-text-editor-content",ref:$,style:hT,children:q.jsxs("div",{ref:V,className:"rich-text-editor-content-body",style:bT,children:[q.jsx("div",{ref:v,className:`rte-editor ${e.length===0?"rte-editor-default":""} ${fe&&d?"rte-editor-empty":""}`,contentEditable:e.length===0,suppressContentEditableWarning:!0,"data-placeholder":d,onMouseDown:ai,onMouseMove:ii,onMouseUp:si,onClick:uT,onDoubleClick:oi,onInput:mi,onKeyDown:cT,onPaste:lT}),q.jsx("input",{type:"file",ref:Y,className:"rte-file-input",accept:".csv,.xlsx,.xls,.txt,.pdf,image/*",onChange:Sr}),q.jsx("input",{type:"file",ref:Zt,className:"rte-file-input",accept:"video/*",onChange:ue=>{const pe=ue.target.files?.[0],Te=en.current;pe&&pe.size>1024*1024*1024?x.warning("视频文件不能超过1GB"):pe&&Te&&iT(Te,pe),en.current=null,Zt.current&&(Zt.current.value="")}})]})}),q.jsxs("div",{className:"rich-text-editor-footer",children:[q.jsxs("div",{className:"rich-text-editor-footer-left",children:[q.jsx("div",{className:"rich-text-editor-brand",children:c!=="hideAgent"&&q.jsx(ce.Dropdown,{placement:"topLeft",menu:{items:s.filter(ue=>ue.isShowNew!==1).map(ue=>({key:ue.key,label:q.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[ue.icon&&q.jsx("i",{className:ue.icon}),q.jsx("span",{children:ue.label})]}),onClick:()=>{o?.(ue)}}))},trigger:["click"],disabled:r||n,overlayClassName:"rte-agent-dropdown",children:q.jsxs("div",{className:"rte-agent-badge",style:{cursor:s.length>0?"pointer":"default"},children:[q.jsx("i",{className:"iconfont icon-zhinengti",style:{fontSize:"16px"}}),q.jsx("span",{className:"rte-agent-text",children:"智能体"})]})})}),M&&q.jsxs(q.Fragment,{children:[q.jsx("div",{className:"rte-footer-upload-btn",onClick:()=>J.current?.click(),title:"上传文件",children:q.jsx("i",{className:"iconfont icon-lianjie",style:{fontSize:"16px"}})}),q.jsx("input",{type:"file",ref:J,className:"rte-file-input",accept:".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,",multiple:!0,onChange:Sr})]})]}),q.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[q.jsxs("div",{className:"rte-brand-badge",children:[q.jsx("div",{className:"rte-brand-badge",children:q.jsx("img",{src:"https://oospublic.sealseek.cn/file/website/ball.png",alt:""})}),q.jsx("span",{className:"rte-brand-text",style:{marginLeft:"4px"},children:"SealSeek 2.0"})]}),(()=>{const ue=e.find(Te=>Te.type==="tag");if(!ue||!ue.text)return null;const pe=s.find(Te=>Te.label===ue.text);return!pe||pe.points===void 0||pe.points===null?null:q.jsxs("div",{className:"rte-points-badge",style:{position:"relative"},children:[q.jsx("i",{className:"iconfont icon-jifen",style:{marginRight:"4px",fontSize:"16px"}}),q.jsxs("span",{style:{fontSize:"16px",lineHeight:"22px"},children:["-",String(pe.points)]}),pe.labelValue===2&&q.jsx("div",{className:"rte-limited-free-badge",children:q.jsx("span",{className:"rte-limited-free-text",children:"限时免费"})})]})})(),q.jsx("button",{type:"button",onClick:dT,disabled:n||r||l||!W,className:"rich-text-editor-send-button",children:n||l?q.jsx("span",{className:"rte-send-spinner"}):q.jsx("i",{className:"iconfont icon-fasong"})})]})]}),Cr,cl,ul,sT,ll]})};Gu.__docgenInfo={displayName:"RichTextEditor",description:"结构化富文本输入组件,支持标签、变量输入块、文件上传以及互斥显示逻辑。",props:{config:{name:"config",required:!0,description:"结构化输入配置节点数组",type:{name:"InputNode[]",raw:"InputNode[]"}},onSend:{name:"onSend",required:!0,description:"点击发送按钮时的回调,返回数据与拼接后的 Prompt",type:{name:"function",raw:"(data: Record<string, any>, fullPrompt: string) => void"}},isProcessing:{name:"isProcessing",required:!1,description:"是否处于处理状态(禁用输入与发送)",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}}}};const Yu="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAFSSURBVHgB3ZTtccIwDIaVXv83I2SDZgSP0BHMBG0naEZhA2boBGQDswHdQJUOGRxjO0Z8HPDe6eJzJD2W4gjgEYSIn2xwK6EIFHqBGysJpMP3ZB0oRbEtmal1NtIxl4OWWsoxEsvqofJ0rgTNASOYq+7SXKDsuYvAcgkq/PWwBLQWqIfdjeRStaBUc4qzgLi9/BzJNmS/sh6bpvmrTfSFacU3scWy1mQryWdSnXiFE8QVUJINLTuyhWzzz/1OZmTN9hEckqtfUOwIGlGCpVRjE+94JFqpMtTeVzO8/UmPxpZU8Qa7aln8Tb9pfwla4WHWrjPvvbbnTBsX7PmLs83EDAH0BxSw1G31+/1FoDg/vPcXR+wocQS1apj4+P92FfhOoLyuBfYlmPgYnGoCjWADzAkzUyJ430awLmphPaxWQVU22BuuApPkHaanjcXSN3t6/QNjTMSJWDcs1QAAAABJRU5ErkJggg==",qb=[{label:"5页",value:5},{label:"10页",value:10},{label:"15页",value:15},{label:"30页",value:30}],zb=({autoLoading:e,batchSize:t,loadingProgress:n,loadIcon:r,onBatchSizeChange:a,onLoadNextPage:i,onStartAutoLoad:s,onStopLoad:o})=>e&&n?q.jsxs("div",{className:"auto_load_progress",children:[r||q.jsx("img",{src:Yu,alt:"自动加载",width:14,height:14}),q.jsxs("span",{children:["正在加载第",n.currentPage,"/",n.totalPages,"页"]}),q.jsx(ce.Progress,{percent:n.percentage,type:"line",size:[160,8]}),q.jsx("span",{onClick:o,className:"auto_load_stop_btn",children:"停止加载"})]}):q.jsxs("div",{className:"auto_load_container",children:[q.jsx("div",{onClick:i,className:"auto_load_next_btn",style:{backgroundColor:e?"#f5f5f5":"#2563eb"},children:"加载下一页"}),q.jsxs("div",{className:"right_control_wrap",style:{backgroundColor:e?"#f5f5f5":"#2563eb"},children:[q.jsxs("div",{className:"auto_load_btn",onClick:e?void 0:s,children:[r||q.jsx("img",{src:Yu,alt:"自动加载",width:14,height:14}),q.jsx("span",{children:"自动加载"})]}),q.jsx(ce.Select,{value:t,onChange:a,options:qb,disabled:e,size:"small",className:"auto_load_select",popupMatchSelectWidth:84})]})]}),Vb=({current:e,loadIcon:t,pageSize:n,total:r,cachedPages:a,loadedCount:i,autoLoading:s=!1,loadingProgress:o,onChange:u,onLoadNextPage:l,onStartAutoLoad:d,onStopLoading:p})=>{const[E,c]=L.useState(5),y=Math.ceil(r/n),h=L.useMemo(()=>a.length>=y,[a,y]),m=()=>Array.from({length:y},(T,_)=>_+1).filter(T=>!a.includes(T)).slice(0,E),g=(b,T,_)=>{const w=a.includes(b);return T==="prev"||T==="next"||T==="jump-prev"||T==="jump-next"?q.jsx("div",{className:"pageBox",children:_}):q.jsxs("div",{className:"pageBox",style:{backgroundColor:e===b?"#2563EB":"#f5f5f5",color:e===b?"#fff":w?"#171717":"#a3a3a3"},children:[b,!w&&q.jsx("span",{className:"unload_spot"})]})};return q.jsxs("div",{className:"pagination_footer",children:[q.jsxs("div",{className:"pagination_leftWrap",children:[q.jsxs("span",{className:"pagination_total",children:[q.jsx(ht.InfoCircleOutlined,{style:{color:"#2563EB",marginRight:"4px"}}),"已加载: ",i,"/",r,"条数据"]}),!h&&q.jsx(zb,{loadIcon:t||void 0,autoLoading:s,batchSize:E,loadingProgress:o,disabled:!l||!d,onBatchSizeChange:c,onLoadNextPage:()=>l?.(),onStartAutoLoad:()=>{const b=m();d?.(b)},onStopLoad:()=>p?.()})]}),q.jsx(ce.Pagination,{current:e,pageSize:n,total:r,onChange:b=>u(b),showSizeChanger:!1,showQuickJumper:!1,showTotal:()=>"",itemRender:g})]})},Wu=e=>{const{loading:t,autoLoading:n,loadingProgress:r,columns:a=[],dataSource:i=[],total:s,current:o,pageSize:u,cachedPages:l,onChangePage:d,onLoadNextPage:p,onStartAutoLoad:E,onStopLoading:c,...y}=e,h=L.useRef(null),m=L.useCallback(g=>{d(g),l.includes(g)&&h.current?.scrollTo({key:`${(g-1)*u+1}`})},[l,d,u]);return q.jsxs("div",{className:"flex flex-col",children:[q.jsx(ce.Table,{ref:h,...y,columns:a,dataSource:i,pagination:!1,virtual:!0}),q.jsx(Vb,{loading:t,autoLoading:n,loadingProgress:r,current:o,pageSize:u,total:s,loadedCount:i.length,cachedPages:l,onChange:m,onLoadNextPage:p,onStartAutoLoad:E,onStopLoading:c})]})};Wu.__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 ju=({texts:e=[],placeholder:t="请输入内容",animationSpeed:n=100,autoPlay:r=!0,value:a,onChange:i,...s})=>{const[o,u]=L.useState(""),[l,d]=L.useState(0),[p,E]=L.useState(!1),[c,y]=L.useState(!1),[h,m]=L.useState(!1),g=L.useRef(void 0),b=L.useRef(void 0),T=L.useRef(e),_=L.useRef(l),w=L.useRef(c),C=L.useRef(o);L.useEffect(()=>{T.current=e,_.current=l,w.current=c,C.current=o});const O=L.useCallback((N,x)=>{let H=0;m(!0);const U=()=>{H<N.length?(u(N.slice(0,H+1)),H++,b.current=window.setTimeout(U,n)):(m(!1),x?.())};U()},[n]),A=L.useCallback(N=>{let x=C.current.length;const H=()=>{x>0?(u(C.current.slice(0,x-1)),x--,b.current=window.setTimeout(H,n/2)):N?.()};H()},[n]),S=L.useCallback(()=>{if(T.current.length===0||w.current)return;E(!0);const N=T.current[_.current];C.current?A(()=>{O(N,()=>{g.current=window.setTimeout(()=>{d(x=>(x+1)%T.current.length),E(!1)},2e3)})}):O(N,()=>{g.current=window.setTimeout(()=>{d(x=>(x+1)%T.current.length),E(!1)},2e3)})},[A,O]);L.useEffect(()=>(r&&e.length>0&&!c&&S(),()=>{g.current&&window.clearTimeout(g.current),b.current&&window.clearTimeout(b.current)}),[l,c,r,e.length,S]),L.useEffect(()=>{!p&&r&&e.length>0&&!c&&S()},[l,p,r,e.length,c,S]);const k=N=>{y(!0),g.current&&window.clearTimeout(g.current),b.current&&window.clearTimeout(b.current),E(!1),m(!1),s.onFocus?.(N)},I=N=>{y(!1),!a&&e.length>0&&(u(""),d(0)),s.onBlur?.(N)},M=N=>{i?.(N.target.value),s.onChange?.(N)},B=()=>c||a?t:o||t;return q.jsxs("div",{style:{position:"relative"},children:[q.jsx(ce.Input,{...s,value:a,onChange:M,onFocus:k,onBlur:I,placeholder:B(),style:{...s.style,position:"relative",zIndex:1}}),!c&&!a&&o&&q.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:[q.jsx("span",{children:o}),h&&q.jsx("span",{style:{display:"inline-block",width:1,height:"1.2em",backgroundColor:"#1890ff",marginLeft:2,animation:"blink 1s infinite"}})]}),q.jsx("style",{children:`
|
|
65
65
|
@keyframes blink {
|
|
66
66
|
0%, 50% { opacity: 1; }
|
|
67
67
|
51%, 100% { opacity: 0; }
|