bi-components-library 1.1.77 → 1.1.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -32,7 +32,7 @@ ${(e||"").replace(/\r\n/g,`
32
32
  `}),l.length>0&&u!=="loading"&&(l.forEach((d,p)=>{a.push({type:"markdown-module",key:s.key,moduleIndex:p,placeholder:"可编辑,内容不能为空",required:!0,minHeight:80,maxHeight:260,text:d.content})}),i=!0)}}return a},[e,n,r,t]);function Bl(e,t){const r=document.createElement("canvas").getContext("2d");if(!r)return 0;const a=window.getComputedStyle(t),i=a.fontStyle||"normal",s=a.fontWeight||"400",o=a.fontSize||"16px",u=a.fontFamily||"sans-serif";r.font=`${i} ${s} ${o} ${u}`;const d=(e||"").replace(/\r\n/g,`
33
33
  `).split(`
34
34
  `);let p=0;for(const y of d){const h=r.measureText(y||" ").width||0;p=Math.max(p,h)}const E=Number.parseFloat(a.letterSpacing||""),f=Number.isFinite(E)?E:0;if(f>0){const y=d.reduce((h,m)=>h.length>=m.length?h:m,"");p+=f*Math.max(0,y.length-1)}return Math.ceil(p)}function Rn(e,t){if(!e.current)return;e.current.querySelectorAll('[data-type="variable"]').forEach(r=>{if(r.dataset.variableRender==="antd-textarea")return;const i=r.innerText.replace(/\u200B/g,"").trim();if(i.length===0){const f=r.querySelector(".variable-info-icon");Array.from(r.childNodes).forEach(m=>{if(m.nodeType===Node.TEXT_NODE){r.removeChild(m);return}m.nodeType===Node.ELEMENT_NODE&&m.tagName==="BR"&&r.removeChild(m)});const y=document.createTextNode("​");f&&f.parentNode===r?r.insertBefore(y,f):r.firstChild?r.insertBefore(y,r.firstChild):r.appendChild(y),r.classList.add("show-placeholder");const h=r.dataset.placeholder||"";if(h){const b=(()=>{try{const L=Bl(h,r);if(!L||!Number.isFinite(L)){const _=Bn(h);return Math.max(0,_-22)}return L}catch{const L=Bn(h);return Math.max(0,L-22)}})(),T=(()=>{if(!r.classList.contains("rte-variable-with-icon"))return 0;const L=r.querySelector(".variable-info-icon:not(.hidden)");if(!L)return 24;try{const _=window.getComputedStyle(L),v=Math.ceil(L.getBoundingClientRect().width||0)||16,N=Math.ceil(Number.parseFloat(_.right||"0"))||4;return Math.max(16,Math.min(120,v+N+2))}catch{return 24}})();T>0?r.style.setProperty("--rte-icon-pad-right",`${T}px`):r.style.removeProperty("--rte-icon-pad-right");const C=2,S=T>0?T:8,A=Math.max(24,Math.min(600,Math.ceil(b+8+S+C)));r.style.minWidth=`${A}px`}else r.style.minWidth=""}else r.classList.remove("show-placeholder"),r.style.minWidth="",r.style.removeProperty("--rte-icon-pad-right");const s=r.innerText||"",o=!!r.querySelector("br")||s.includes(`
35
- `),u=r.offsetHeight>32,l=i.length>0&&(o||u);r.classList.toggle("rte-variable-multiline",l),r.classList.toggle("rte-variable-force-block",l);const d=r.closest(".rte-inline-group");d&&d.classList.toggle("rte-inline-group-force-block",l);const p=r.closest(".required-upload-group, .required-multi-first");p&&p.classList.toggle("rte-required-group-force-block",l);const E=p?p.parentElement?.closest(".exclusion-wrapper"):r.closest(".exclusion-wrapper");E&&E!==p&&E.classList.toggle("rte-exclusion-force-block",l)})}function _r(e,t,n,r){if(!e.current)return;const a=h=>{h.classList.contains("rte-richtext-host-expanded")&&(h.style.setProperty("display","flex","important"),h.style.setProperty("flex-direction","column","important"),h.style.setProperty("flex","1 1 auto","important"),h.style.setProperty("min-height","0","important"),h.style.setProperty("width","100%","important"),h.style.setProperty("align-self","stretch","important"))},i=h=>{if(!h.closest('[data-rte-force-hidden="1"]')){if(h.classList.contains("rte-richtext-host-expanded")){a(h);return}if(h.classList.contains("required-upload-group")){h.style.setProperty("display","inline-flex","important");return}if(h.classList.contains("exclusion-wrapper")){h.classList.contains("rte-exclusion-force-block")?h.style.setProperty("display","block","important"):h.style.setProperty("display","inline-block","important");return}h.style.setProperty("display","inline-block","important")}},s=h=>{h.closest('[data-rte-force-hidden="1"]')||(h.style.display="none",h.style.setProperty("display","none","important"))},o=t.some(h=>h.exclusionGroup==="separator");if(o){const h=[];let m=[];for(const v of t){if(v.exclusionGroup==="separator"){m.length&&h.push(m),m=[];continue}!v.exclusionGroup||v.exclusionGroup==="separator"||(v.type==="upload"&&v.key?m.push({type:"upload",key:v.key}):(v.type==="video-url"||v.type==="video-upload")&&v.key?m.push({type:v.type,key:v.key}):(v.type==="variable"||v.type==="multi-variable"||v.type==="markdown"||v.type==="markdown-name"||v.type==="markdown-module")&&v.key?m.push({type:v.type==="multi-variable"?"multi-variable":"variable",key:v.key}):m.push({type:"other",nodeType:v.type}))}m.length&&h.push(m);const g=v=>{const N=t.find(w=>w.type==="upload"&&w.key===v);return N?typeof N.maxCount=="number"&&N.maxCount>1?N.maxCount:1:0},b=h.map(v=>{for(const N of v)if(N.type!=="other"){if(N.type==="video-url"||N.type==="video-upload"){const w=r?.[N.key];if(w?.status==="success"&&w.videoUrl)return!0;if(N.type==="video-url"){const O=e.current.querySelector(`[data-type="variable"][data-node-type="video-url"][data-key="${N.key}"]`);if(O&&!O.classList.contains("show-placeholder")&&O.innerText.replace(/[\u200B\n]/g,"").trim().length>0)return!0}continue}if(N.type==="upload"){if(n[N.key]!==null&&n[N.key]!==void 0)return!0;const w=g(N.key);for(let O=0;O<w;O++){const R=`${N.key}-${O}`;if(n[R]!==null&&n[R]!==void 0)return!0}continue}if(N.type==="multi-variable"){const w=e.current.querySelectorAll(`[data-type="variable"][data-multi-key="${N.key}"]`);for(const O of w){if(O.dataset.variableRender==="antd-textarea"){const R=O.dataset.value||"";let I=R;try{I=decodeURIComponent(R)}catch{I=R}if(I.trim().length>0)return!0;continue}if(!O.classList.contains("show-placeholder")&&O.innerText.replace(/[\u200B\n]/g,"").trim().length>0)return!0}continue}if(N.type==="variable"){if(e.current.querySelector(`[data-node-type="markdown-module"][data-key="${N.key}"]`))return!0;const O=e.current.querySelector(`[data-type="variable"][data-key="${N.key}"]`);if(!O)continue;if(O.dataset.variableRender==="antd-textarea"){const R=O.dataset.value||"";let I=R;try{I=decodeURIComponent(R)}catch{I=R}if(I.trim().length>0)return!0}else if(!O.classList.contains("show-placeholder")&&O.innerText.replace(/[\u200B\n]/g,"").trim().length>0)return!0;continue}}return!1}),T=b.some(Boolean),C=T?b.findIndex(Boolean):-1,S=v=>e.current.querySelector(`[data-type="video-url"][data-key="${v}"], [data-type="video-upload"][data-key="${v}"], [data-type="variable"][data-node-type="video-url"][data-key="${v}"]`),A=v=>{for(const N of h[v]||[])if(N.type!=="other"){if(N.type==="video-url"||N.type==="video-upload"){const w=S(N.key);w&&i(w.closest(".exclusion-wrapper")||w);continue}if(N.type==="upload"){e.current.querySelectorAll(`[data-type="upload"][data-key="${N.key}"], [data-type="upload"][data-key^="${N.key}-"]`).forEach(O=>i(O.closest(".exclusion-wrapper")||O));continue}if(N.type==="multi-variable"){e.current.querySelectorAll(`[data-type="variable"][data-multi-key="${N.key}"]`).forEach(O=>{const R=O.closest(".exclusion-wrapper")||O;i(R)});continue}if(N.type==="variable"){const w=e.current.querySelector(`[data-type="variable"][data-key="${N.key}"]`);w&&i(w.closest(".exclusion-wrapper")||w),e.current.querySelectorAll(`[data-node-type="markdown-module"][data-key="${N.key}"]`).forEach(R=>{const I=R.closest(".exclusion-wrapper")||R.closest(".rte-markdown-module-container")||R;i(I)})}}},L=v=>{for(const N of h[v]||[])if(N.type!=="other"){if(N.type==="video-url"||N.type==="video-upload"){const w=S(N.key);w&&s(w.closest(".exclusion-wrapper")||w);continue}if(N.type==="upload"){e.current.querySelectorAll(`[data-type="upload"][data-key="${N.key}"], [data-type="upload"][data-key^="${N.key}-"]`).forEach(O=>s(O.closest(".exclusion-wrapper")||O));continue}if(N.type==="multi-variable"){e.current.querySelectorAll(`[data-type="variable"][data-multi-key="${N.key}"]`).forEach(O=>s(O.closest(".exclusion-wrapper")||O));continue}if(N.type==="variable"){const w=e.current.querySelector(`[data-type="variable"][data-key="${N.key}"]`);w&&s(w.closest(".exclusion-wrapper")||w),e.current.querySelectorAll(`[data-node-type="markdown-module"][data-key="${N.key}"]`).forEach(R=>{const I=R.closest(".exclusion-wrapper")||R.closest(".rte-markdown-module-container")||R;s(I)})}}};for(let v=0;v<h.length;v++)!T||v===C?A(v):L(v);e.current.querySelectorAll('[data-group="separator"]').forEach(v=>{v.closest('[data-rte-force-hidden="1"]')||(T?s(v):v.style.setProperty("display","inline-flex","important"))});return}const u=new Set,l={};for(const h of t)h.exclusionGroup&&h.exclusionGroup!=="separator"&&(u.add(h.exclusionGroup),l[h.exclusionGroup]||(l[h.exclusionGroup]=[]),l[h.exclusionGroup].push({type:h.type,key:h.key,exclusionGroup:h.exclusionGroup}));const d={};for(const h of u){d[h]=!1;for(const m of l[h])if((m.type==="video-url"||m.type==="video-upload")&&m.key){const g=r?.[m.key];if(g?.status==="success"&&g.videoUrl){d[h]=!0;break}if(m.type==="video-url"){const b=e.current.querySelector(`[data-type="variable"][data-node-type="video-url"][data-key="${m.key}"]`);if(b&&!b.classList.contains("show-placeholder")&&b.innerText.replace(/[\u200B\n]/g,"").trim().length>0){d[h]=!0;break}}}else if(m.type==="upload"&&m.key){if(n[m.key]!==null&&n[m.key]!==void 0){d[h]=!0;break}const g=t.find(b=>b.type==="upload"&&b.key===m.key);if(g&&typeof g.maxCount=="number")for(let b=0;b<g.maxCount;b++){const T=`${m.key}-${b}`;if(n[T]!==null&&n[T]!==void 0){d[h]=!0;break}}if(d[h])break}else if((m.type==="variable"||m.type==="multi-variable"||m.type==="markdown"||m.type==="markdown-name")&&m.key){if(e.current.querySelector(`[data-node-type="markdown-module"][data-key="${m.key}"]`)){d[h]=!0;break}const b=m.type==="multi-variable"?e.current.querySelectorAll(`[data-type="variable"][data-multi-key="${m.key}"]`):[e.current.querySelector(`[data-type="variable"][data-key="${m.key}"]`)].filter(Boolean);for(const T of b){if(T.dataset.variableRender==="antd-textarea"){const C=T.dataset.value||"";let S=C;try{S=decodeURIComponent(C)}catch{S=C}if(S.trim().length>0){d[h]=!0;break}continue}if(!T.classList.contains("show-placeholder")&&T.innerText.replace(/[\u200B\n]/g,"").trim().length>0){d[h]=!0;break}}if(d[h])break}}const E=Object.keys(d).filter(h=>d[h]).length>0;let f=null;if(E&&o){for(const h of t)if(h.exclusionGroup&&h.exclusionGroup!=="separator"&&d[h.exclusionGroup]){f=h.exclusionGroup;break}}for(const h of u){const m=e.current.querySelectorAll(`[data-group="${h}"]`);o&&E&&f?h===f?m.forEach(i):m.forEach(s):m.forEach(i)}e.current.querySelectorAll('[data-group="separator"]').forEach(h=>{h.closest('[data-rte-force-hidden="1"]')||(E?s(h):h.style.setProperty("display","inline-flex","important"))})}function vr(e,t,n,r,a){if(!e.current){r(!1);return}const i=h=>{const m=h.getAttribute("data-node-type")||"";if(m!=="report-module"&&m!=="markdown-module")return(h.textContent||"").replace(/[\u200B]/g,"").trim();const g=(h.textContent||"").replace(/[\u200B]/g,"").trim(),b=Array.from(h.querySelectorAll(":scope > div"));if(b.length===0)return g;let T=-1;for(let A=0;A<b.length;A++)if((b[A].textContent||"").replace(/[\u200B]/g,"").trim().length>0){T=A;break}return b.filter((A,L)=>L!==T).map(A=>(A.textContent||"").replace(/[\u200B]/g,"").trim()).join(`
35
+ `),u=r.offsetHeight>32,l=i.length>0&&(o||u);r.classList.toggle("rte-variable-multiline",l),r.classList.toggle("rte-variable-force-block",l);const d=r.closest(".rte-inline-group");d&&d.classList.toggle("rte-inline-group-force-block",l);const p=r.closest(".required-upload-group, .required-multi-first");p&&p.classList.toggle("rte-required-group-force-block",l);const E=p?p.parentElement?.closest(".exclusion-wrapper"):r.closest(".exclusion-wrapper");E&&E!==p&&E.classList.toggle("rte-exclusion-force-block",l)})}function _r(e,t,n,r){if(!e.current)return;const a=h=>{h.classList.contains("rte-richtext-host-expanded")&&(h.style.setProperty("display","flex","important"),h.style.setProperty("flex-direction","column","important"),h.style.setProperty("flex","1 1 auto","important"),h.style.setProperty("min-height","0","important"),h.style.setProperty("width","100%","important"),h.style.setProperty("align-self","stretch","important"))},i=h=>{if(!h.closest('[data-rte-force-hidden="1"]')){if(h.classList.contains("rte-richtext-host-expanded")){a(h);return}if(h.classList.contains("required-upload-group")){h.style.setProperty("display","inline-flex","important");return}if(h.classList.contains("exclusion-wrapper")){h.classList.contains("rte-exclusion-force-block")?h.style.setProperty("display","block","important"):h.style.setProperty("display","inline-block","important");return}h.style.setProperty("display","inline-block","important")}},s=h=>{h.closest('[data-rte-force-hidden="1"]')||(h.style.display="none",h.style.setProperty("display","none","important"))},o=t.some(h=>h.exclusionGroup==="separator");if(o){const h=[];let m=[];for(const v of t){if(v.exclusionGroup==="separator"){m.length&&h.push(m),m=[];continue}!v.exclusionGroup||v.exclusionGroup==="separator"||(v.type==="upload"&&v.key?m.push({type:"upload",key:v.key}):(v.type==="video-url"||v.type==="video-upload")&&v.key?m.push({type:v.type,key:v.key}):(v.type==="variable"||v.type==="multi-variable"||v.type==="markdown"||v.type==="markdown-name"||v.type==="markdown-module")&&v.key?m.push({type:v.type==="multi-variable"?"multi-variable":"variable",key:v.key}):m.push({type:"other",nodeType:v.type}))}m.length&&h.push(m);const g=v=>{const N=t.find(w=>w.type==="upload"&&w.key===v);return N?typeof N.maxCount=="number"&&N.maxCount>1?N.maxCount:1:0},b=h.map(v=>{for(const N of v)if(N.type!=="other"){if(N.type==="video-url"||N.type==="video-upload"){const w=r?.[N.key];if(w?.status==="success"&&w.videoUrl||w?.status==="loading")return!0;if(N.type==="video-url"){const O=e.current.querySelector(`[data-type="variable"][data-node-type="video-url"][data-key="${N.key}"]`);if(O&&!O.classList.contains("show-placeholder")&&O.innerText.replace(/[\u200B\n]/g,"").trim().length>0)return!0}continue}if(N.type==="upload"){if(n[N.key]!==null&&n[N.key]!==void 0)return!0;const w=g(N.key);for(let O=0;O<w;O++){const R=`${N.key}-${O}`;if(n[R]!==null&&n[R]!==void 0)return!0}continue}if(N.type==="multi-variable"){const w=e.current.querySelectorAll(`[data-type="variable"][data-multi-key="${N.key}"]`);for(const O of w){if(O.dataset.variableRender==="antd-textarea"){const R=O.dataset.value||"";let I=R;try{I=decodeURIComponent(R)}catch{I=R}if(I.trim().length>0)return!0;continue}if(!O.classList.contains("show-placeholder")&&O.innerText.replace(/[\u200B\n]/g,"").trim().length>0)return!0}continue}if(N.type==="variable"){if(e.current.querySelector(`[data-node-type="markdown-module"][data-key="${N.key}"]`))return!0;const O=e.current.querySelector(`[data-type="variable"][data-key="${N.key}"]`);if(!O)continue;if(O.dataset.variableRender==="antd-textarea"){const R=O.dataset.value||"";let I=R;try{I=decodeURIComponent(R)}catch{I=R}if(I.trim().length>0)return!0}else if(!O.classList.contains("show-placeholder")&&O.innerText.replace(/[\u200B\n]/g,"").trim().length>0)return!0;continue}}return!1}),T=b.some(Boolean),C=T?b.findIndex(Boolean):-1,S=v=>e.current.querySelector(`[data-type="video-url"][data-key="${v}"], [data-type="video-upload"][data-key="${v}"], [data-type="variable"][data-node-type="video-url"][data-key="${v}"]`),A=v=>{for(const N of h[v]||[])if(N.type!=="other"){if(N.type==="video-url"||N.type==="video-upload"){const w=S(N.key);w&&i(w.closest(".exclusion-wrapper")||w);continue}if(N.type==="upload"){e.current.querySelectorAll(`[data-type="upload"][data-key="${N.key}"], [data-type="upload"][data-key^="${N.key}-"]`).forEach(O=>i(O.closest(".exclusion-wrapper")||O));continue}if(N.type==="multi-variable"){e.current.querySelectorAll(`[data-type="variable"][data-multi-key="${N.key}"]`).forEach(O=>{const R=O.closest(".exclusion-wrapper")||O;i(R)});continue}if(N.type==="variable"){const w=e.current.querySelector(`[data-type="variable"][data-key="${N.key}"]`);w&&i(w.closest(".exclusion-wrapper")||w),e.current.querySelectorAll(`[data-node-type="markdown-module"][data-key="${N.key}"]`).forEach(R=>{const I=R.closest(".exclusion-wrapper")||R.closest(".rte-markdown-module-container")||R;i(I)})}}},L=v=>{for(const N of h[v]||[])if(N.type!=="other"){if(N.type==="video-url"||N.type==="video-upload"){const w=S(N.key);w&&s(w.closest(".exclusion-wrapper")||w);continue}if(N.type==="upload"){e.current.querySelectorAll(`[data-type="upload"][data-key="${N.key}"], [data-type="upload"][data-key^="${N.key}-"]`).forEach(O=>s(O.closest(".exclusion-wrapper")||O));continue}if(N.type==="multi-variable"){e.current.querySelectorAll(`[data-type="variable"][data-multi-key="${N.key}"]`).forEach(O=>s(O.closest(".exclusion-wrapper")||O));continue}if(N.type==="variable"){const w=e.current.querySelector(`[data-type="variable"][data-key="${N.key}"]`);w&&s(w.closest(".exclusion-wrapper")||w),e.current.querySelectorAll(`[data-node-type="markdown-module"][data-key="${N.key}"]`).forEach(R=>{const I=R.closest(".exclusion-wrapper")||R.closest(".rte-markdown-module-container")||R;s(I)})}}};for(let v=0;v<h.length;v++)!T||v===C?A(v):L(v);e.current.querySelectorAll('[data-group="separator"]').forEach(v=>{v.closest('[data-rte-force-hidden="1"]')||(T?s(v):v.style.setProperty("display","inline-flex","important"))});return}const u=new Set,l={};for(const h of t)h.exclusionGroup&&h.exclusionGroup!=="separator"&&(u.add(h.exclusionGroup),l[h.exclusionGroup]||(l[h.exclusionGroup]=[]),l[h.exclusionGroup].push({type:h.type,key:h.key,exclusionGroup:h.exclusionGroup}));const d={};for(const h of u){d[h]=!1;for(const m of l[h])if((m.type==="video-url"||m.type==="video-upload")&&m.key){const g=r?.[m.key];if(g?.status==="success"&&g.videoUrl||g?.status==="loading"){d[h]=!0;break}if(m.type==="video-url"){const b=e.current.querySelector(`[data-type="variable"][data-node-type="video-url"][data-key="${m.key}"]`);if(b&&!b.classList.contains("show-placeholder")&&b.innerText.replace(/[\u200B\n]/g,"").trim().length>0){d[h]=!0;break}}}else if(m.type==="upload"&&m.key){if(n[m.key]!==null&&n[m.key]!==void 0){d[h]=!0;break}const g=t.find(b=>b.type==="upload"&&b.key===m.key);if(g&&typeof g.maxCount=="number")for(let b=0;b<g.maxCount;b++){const T=`${m.key}-${b}`;if(n[T]!==null&&n[T]!==void 0){d[h]=!0;break}}if(d[h])break}else if((m.type==="variable"||m.type==="multi-variable"||m.type==="markdown"||m.type==="markdown-name")&&m.key){if(e.current.querySelector(`[data-node-type="markdown-module"][data-key="${m.key}"]`)){d[h]=!0;break}const b=m.type==="multi-variable"?e.current.querySelectorAll(`[data-type="variable"][data-multi-key="${m.key}"]`):[e.current.querySelector(`[data-type="variable"][data-key="${m.key}"]`)].filter(Boolean);for(const T of b){if(T.dataset.variableRender==="antd-textarea"){const C=T.dataset.value||"";let S=C;try{S=decodeURIComponent(C)}catch{S=C}if(S.trim().length>0){d[h]=!0;break}continue}if(!T.classList.contains("show-placeholder")&&T.innerText.replace(/[\u200B\n]/g,"").trim().length>0){d[h]=!0;break}}if(d[h])break}}const E=Object.keys(d).filter(h=>d[h]).length>0;let f=null;if(E&&o){for(const h of t)if(h.exclusionGroup&&h.exclusionGroup!=="separator"&&d[h.exclusionGroup]){f=h.exclusionGroup;break}}for(const h of u){const m=e.current.querySelectorAll(`[data-group="${h}"]`);o&&E&&f?h===f?m.forEach(i):m.forEach(s):m.forEach(i)}e.current.querySelectorAll('[data-group="separator"]').forEach(h=>{h.closest('[data-rte-force-hidden="1"]')||(E?s(h):h.style.setProperty("display","inline-flex","important"))})}function vr(e,t,n,r,a){if(!e.current){r(!1);return}const i=h=>{const m=h.getAttribute("data-node-type")||"";if(m!=="report-module"&&m!=="markdown-module")return(h.textContent||"").replace(/[\u200B]/g,"").trim();const g=(h.textContent||"").replace(/[\u200B]/g,"").trim(),b=Array.from(h.querySelectorAll(":scope > div"));if(b.length===0)return g;let T=-1;for(let A=0;A<b.length;A++)if((b[A].textContent||"").replace(/[\u200B]/g,"").trim().length>0){T=A;break}return b.filter((A,L)=>L!==T).map(A=>(A.textContent||"").replace(/[\u200B]/g,"").trim()).join(`
36
36
  `).trim()||g},s=h=>h?!!h.closest('[data-rte-force-hidden="1"]'):!1,o=[];for(let h=0;h<t.length;h++){const m=t[h];if((m.type==="variable"||m.type==="report-url"||m.type==="markdown"||m.type==="markdown-name"||m.type==="upload"||m.type==="multi-variable"||m.type==="select"||m.type==="textarea"||m.type==="richtext"||m.type==="report-module"||m.type==="markdown-module"||m.type==="datepicker"||m.type==="number-input"||m.type==="video-url"||m.type==="video-upload")&&m.required&&m.key){o.push({exclusionGroup:m.exclusionGroup||"",key:m.key,type:m.type==="multi-variable"||m.type==="report-url"||m.type==="markdown"||m.type==="markdown-name"?"variable":m.type==="report-module"||m.type==="markdown-module"?"richtext":m.type==="video-url"?"video-url":m.type==="video-upload"?"video-upload":m.type,isMultiVariable:m.type==="multi-variable",minCount:m.type==="multi-variable"||m.type==="upload"&&typeof m.minCount=="number"?m.minCount:void 0,moduleIndex:m.type==="report-module"||m.type==="markdown-module"?m.moduleIndex:void 0,__index:h});continue}if(m.type==="text"&&m.className?.includes("rte-text-required"))if(m.exclusionGroup)for(let g=h+1;g<t.length;g++){const b=t[g];if(b.exclusionGroup===m.exclusionGroup&&(b.type==="variable"||b.type==="markdown"||b.type==="upload"||b.type==="select"||b.type==="textarea"||b.type==="richtext"||b.type==="datepicker"||b.type==="number-input")&&b.key){o.push({exclusionGroup:m.exclusionGroup,key:b.key,type:b.type==="markdown"?"variable":b.type,__index:g});break}}else for(let g=h+1;g<t.length;g++){const b=t[g];if((b.type==="variable"||b.type==="markdown"||b.type==="upload"||b.type==="select"||b.type==="textarea"||b.type==="richtext"||b.type==="datepicker"||b.type==="number-input")&&b.key){o.push({exclusionGroup:b.exclusionGroup||"",key:b.key,type:b.type==="markdown"?"variable":b.type,__index:g});break}}}const u=t.some(h=>h.exclusionGroup==="separator"),l=[];if(u&&o.length>1){const h=[];t.forEach((m,g)=>{m.exclusionGroup==="separator"&&h.push(g)});for(const m of h){const b=o.filter(S=>typeof S.__index=="number"&&S.__index<m).sort((S,A)=>(A.__index??0)-(S.__index??0))[0],C=o.filter(S=>typeof S.__index=="number"&&S.__index>m).sort((S,A)=>(S.__index??0)-(A.__index??0))[0];b&&C&&l.push([b,C])}}if(o.length===0){if(t.length===0){if(!e.current){r(!1);return}const h=e.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"";r(h.length>0);return}r(!0);return}const d=o.filter(h=>{if(!e.current)return!1;if(h.exclusionGroup){const m=e.current.querySelectorAll(`[data-group="${h.exclusionGroup}"]`);if(m.length>0){const g=m[0];return s(g)?!0:g.style.display!=="none"}}if(h.type==="upload"&&h.key){const m=e.current.querySelector(`[data-type="upload"][data-key="${h.key}"]`)||e.current.querySelector(`[data-type="upload"][data-batch-key="${h.key}"]`);if(m){const g=m.closest("[data-group]")||m.parentElement;return s(g)?!0:g?g.style.display!=="none":!0}}else if(h.type==="variable"&&h.key)if(h.isMultiVariable){const m=e.current.querySelectorAll(`[data-type="variable"][data-multi-key="${h.key}"]`);if(m.length>0){const g=m[0],b=g.closest("[data-group]")||g.parentElement;return s(b)?!0:b?b.style.display!=="none":!0}}else{const m=e.current.querySelector(`[data-type="variable"][data-key="${h.key}"]`);if(m){const g=m.closest("[data-group]")||m.parentElement;return s(g)?!0:g?g.style.display!=="none":!0}}else if(h.type==="select"&&h.key){const m=e.current.querySelector(`[data-type="select"][data-key="${h.key}"]`);if(m){const g=m.closest("[data-group]")||m.parentElement;return s(g)?!0:g?g.style.display!=="none":!0}}else if(h.type==="textarea"&&h.key){const m=e.current.querySelector(`[data-type="textarea"][data-key="${h.key}"]`);if(m){const g=m.closest("[data-group]")||m.parentElement;return s(g)?!0:g?g.style.display!=="none":!0}}else if(h.type==="richtext"&&h.key){const m=typeof h.moduleIndex=="number"?`[data-type="richtext"][data-node-type="report-module"][data-key="${h.key}"][data-module-index="${h.moduleIndex}"], [data-type="richtext"][data-node-type="markdown-module"][data-key="${h.key}"][data-module-index="${h.moduleIndex}"]`:`[data-type="richtext"][data-key="${h.key}"]`,g=e.current.querySelector(m);if(g){const b=g.closest("[data-group]")||g.parentElement;return s(b)?!0:b?b.style.display!=="none":!0}}else if(h.type==="datepicker"&&h.key){const m=e.current.querySelector(`[data-type="datepicker"][data-key="${h.key}"]`);if(m){const g=m.closest("[data-group]")||m.parentElement;return s(g)?!0:g?g.style.display!=="none":!0}}else if(h.type==="number-input"&&h.key){const m=e.current.querySelector(`[data-type="number-input"][data-key="${h.key}"]`);if(m){const g=m.closest("[data-group]")||m.parentElement;return s(g)?!0:g?g.style.display!=="none":!0}}else if((h.type==="video-url"||h.type==="video-upload")&&h.key){const m=e.current.querySelector(`[data-type="${h.type}"][data-key="${h.key}"], [data-type="variable"][data-key="${h.key}"][data-node-type="video-url"]`);if(m){const g=m.closest("[data-group]")||m.parentElement;return s(g)?!0:g?g.style.display!=="none":!0}}return!1});if(d.length===0){r(!0);return}const p=new Set;l.forEach(h=>{h.forEach(m=>{m.key&&p.add(m.key)})});const E=d.filter(h=>!h.key||!p.has(h.key));let f=(l.length===0,!0);for(const h of l){const m=h.filter(b=>{if(!e.current)return!1;if(b.exclusionGroup){const T=e.current.querySelectorAll(`[data-group="${b.exclusionGroup}"]`);if(T.length>0){const C=T[0];return s(C)?!0:C.style.display!=="none"}}return!0});if(m.length===0)continue;let g=!1;for(const b of m)if(b.type==="upload"&&b.key){if(b.minCount&&b.minCount>0){let T=0;const C=e.current.querySelectorAll(`[data-type="upload"][data-batch-key="${b.key}"]`);if(C.length===0)continue;for(let S=0;S<C.length;S++){const L=C[S].dataset.key;L&&n[L]!=null&&(T+=1)}if(T>=b.minCount){g=!0;break}}else if(n[b.key]!==null&&n[b.key]!==void 0){g=!0;break}}else if(b.type==="variable"&&b.key)if(b.isMultiVariable){const T=e.current.querySelectorAll(`[data-type="variable"][data-multi-key="${b.key}"]`);let C=0;for(const A of Array.from(T)){if(A.classList.contains("show-placeholder"))continue;A.innerText.replace(/[\u200B\n]/g,"").trim().length>0&&(C+=1)}const S=b.minCount&&b.minCount>0?b.minCount:1;if(C>=S){g=!0;break}}else{const T=e.current.querySelector(`[data-type="variable"][data-key="${b.key}"]`);if(T){if(T.classList.contains("show-placeholder"))continue;if(T.innerText.replace(/[\u200B\n]/g,"").trim().length>0){const S=T.dataset.nodeType;if((S==="markdown"||S==="markdown-name")&&!!!e.current.querySelector(`[data-node-type="markdown-module"][data-key="${b.key}"]`))continue;g=!0;break}}}else if(b.type==="select"&&b.key){const T=e.current.querySelector(`[data-type="select"][data-key="${b.key}"]`);if(T&&(T.getAttribute("data-value")||"").trim().length>0){g=!0;break}}else if(b.type==="textarea"&&b.key){const T=e.current.querySelector(`[data-type="textarea"][data-key="${b.key}"]`);if(T&&(T.value||"").trim().length>0){g=!0;break}}else if(b.type==="richtext"&&b.key){const T=typeof b.moduleIndex=="number"?`[data-type="richtext"][data-node-type="report-module"][data-key="${b.key}"][data-module-index="${b.moduleIndex}"], [data-type="richtext"][data-node-type="markdown-module"][data-key="${b.key}"][data-module-index="${b.moduleIndex}"]`:`[data-type="richtext"][data-key="${b.key}"]`,C=e.current.querySelector(T);if(C){if(C.getAttribute("data-is-placeholder")==="true")continue;if(i(C).length>0){g=!0;break}}}else if(b.type==="datepicker"&&b.key){const T=e.current.querySelector(`[data-type="datepicker"][data-key="${b.key}"]`);if(T&&(T.getAttribute("data-value")||"").trim().length>0){g=!0;break}}else if(b.type==="number-input"&&b.key){const T=e.current.querySelector(`[data-type="number-input"][data-key="${b.key}"]`);if(T&&(T.value||"").trim().length>0){g=!0;break}}else if((b.type==="video-url"||b.type==="video-upload")&&b.key&&a?.[b.key]?.status==="success"){g=!0;break}if(!g){f=!1;break}}let y=!0;for(const h of E)if(h.type==="upload"&&h.key){if(h.minCount&&h.minCount>0){let m=0;const g=e.current.querySelectorAll(`[data-type="upload"][data-batch-key="${h.key}"]`);if(g.length===0){y=!1;break}for(let b=0;b<g.length;b++){const C=g[b].dataset.key;C&&n[C]!=null&&(m+=1)}if(m<h.minCount){y=!1;break}}else if(n[h.key]===null||n[h.key]===void 0){y=!1;break}}else if(h.type==="variable"&&h.key)if(h.isMultiVariable){const m=e.current.querySelectorAll(`[data-type="variable"][data-multi-key="${h.key}"]`);let g=0;for(const T of Array.from(m)){if(T.classList.contains("show-placeholder"))continue;T.innerText.replace(/[\u200B\n]/g,"").trim().length>0&&(g+=1)}const b=h.minCount&&h.minCount>0?h.minCount:1;if(g<b){y=!1;break}}else{const m=e.current.querySelector(`[data-type="variable"][data-key="${h.key}"]`);if(!m){y=!1;break}if(m.classList.contains("show-placeholder")){y=!1;break}if(m.innerText.replace(/[\u200B\n]/g,"").trim().length===0){y=!1;break}const b=m.dataset.nodeType;if((b==="markdown"||b==="markdown-name")&&!!!e.current.querySelector(`[data-node-type="markdown-module"][data-key="${h.key}"]`)){y=!1;break}}else if(h.type==="select"&&h.key){const m=e.current.querySelector(`[data-type="select"][data-key="${h.key}"]`);if(!m||(m.getAttribute("data-value")||"").trim().length===0){y=!1;break}}else if(h.type==="textarea"&&h.key){const m=e.current.querySelector(`[data-type="textarea"][data-key="${h.key}"]`);if(!m||(m.value||"").trim().length===0){y=!1;break}}else if(h.type==="richtext"&&h.key){const m=typeof h.moduleIndex=="number"?`[data-type="richtext"][data-node-type="report-module"][data-key="${h.key}"][data-module-index="${h.moduleIndex}"], [data-type="richtext"][data-node-type="markdown-module"][data-key="${h.key}"][data-module-index="${h.moduleIndex}"]`:`[data-type="richtext"][data-key="${h.key}"]`,g=e.current.querySelector(m);if(g&&g.getAttribute("data-is-placeholder")==="true"){y=!1;break}if(!g||i(g).length===0){y=!1;break}}else if(h.type==="datepicker"&&h.key){const m=e.current.querySelector(`[data-type="datepicker"][data-key="${h.key}"]`);if(!m||(m.getAttribute("data-value")||"").trim().length===0){y=!1;break}}else if(h.type==="number-input"&&h.key){const m=e.current.querySelector(`[data-type="number-input"][data-key="${h.key}"]`);if(!m||(m.value||"").trim().length===0){y=!1;break}}else if((h.type==="video-url"||h.type==="video-upload")&&h.key&&a?.[h.key]?.status!=="success"){y=!1;break}r(f&&y)}const Rl=({config:e,effectiveConfig:t,files:n,editorRef:r,setIsFormValid:a,multiVariableCounts:i,setMultiVariableCounts:s,videoState:o})=>{M.useLayoutEffect(()=>{const u=r.current;if(!u)return;const l=new Map,d=f=>{const y=f.target,h=f.relatedTarget;!y||!r.current||!r.current.contains(y)||h&&r.current.contains(h)||setTimeout(()=>{if(r.current){if(e.length===0){const m=r.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"";a(m.length>0);return}Rn(r),_r(r,t,n,o),vr(r,t,n,a,o)}},0)};u.addEventListener("blur",d,!0);const p=()=>{if(!r.current)return;l.forEach((h,m)=>{m.removeEventListener("blur",h,!1)}),l.clear();const f=r.current.querySelectorAll('[data-type="variable"][data-multi-key]'),y=h=>{h.stopPropagation(),h.stopImmediatePropagation();const m=h.target;if(!m||!r.current||!r.current.contains(m))return;const g=m.closest('[data-type="variable"][data-multi-key]');if(!g||!r.current.contains(g))return;let b=!1;if(l.forEach((N,w)=>{(w===g||w.contains(m))&&(b=!0)}),!b)return;const T=g.dataset.multiKey,C=g.dataset.key,S=g.dataset.index;if(!T||!C||S===void 0)return;const A=h.relatedTarget;if(!(!A||!r.current.contains(A)))return;const _=g.innerText.replace(/[\u200B\n]/g,"").trim(),v=/[、,,\s]+/;if(v.test(_)){const O=_.split(v).map(R=>R.trim()).filter(R=>R.length>0).slice(0,9);if(O.length>1){const R=e.find(I=>I.type==="multi-variable"&&I.key===T);if(R){const I=i[T]||1,x=parseInt(S,10),H=R.maxCount||9,U=[];for(let Q=0;Q<I;Q++){const P=`${T}_${Q}`,ee=r.current.querySelector(`[data-type="variable"][data-key="${P}"][data-multi-key="${T}"]`);if(ee){const ae=ee.innerText.replace(/[\u200B\n]/g,"").trim();U.push(ae)}}U.splice(x,1,...O);const $=U.slice(0,H);$.length>0&&$[$.length-1]!==""&&$.length<H&&$.push("");const V=Math.max($.length,1),k={};$.forEach((Q,P)=>{Q&&(k[`${T}_${P}`]=Q)}),r.current.querySelectorAll('[data-type="variable"]').forEach(Q=>{const P=Q.dataset.key,ee=Q.dataset.multiKey;if(P&&ee!==T){const ae=Q.innerText.replace(/[\u200B\n]/g,"").trim();ae&&(k[P]=ae)}}),r.current.__tempVariableValues=k,s(Q=>({...Q,[T]:V}))}}}};f.forEach(h=>{h.addEventListener("blur",y,!1),l.set(h,y)})},E=setTimeout(()=>{p()},0);return()=>{clearTimeout(E),u.removeEventListener("blur",d,!0),l.forEach((f,y)=>{y.removeEventListener("blur",f,!1)}),l.clear()}},[e,t,r,n,i,a,s])},Fl=({disabled:e,collapsed:t,onCollapsedChange:n,config:r,lockStructure:a,editorRef:i,containerRef:s,fileInputRef:o,onBeforeFilePickerOpen:u,files:l,setFiles:d,handleRemoveFile:p,setActiveBatchKey:E,setActiveBatchStartIndex:f,setActiveFileKey:y,isDraggingRef:h,richtextPrevScrollTopRef:m,videoState:g,setVideoState:b,videoFileInputRef:T,activeVideoKeyRef:C})=>{const S=(...L)=>{},A=L=>{try{const _=window.getSelection();if(!_)return S(L,"no selection");const v=_.rangeCount>0?_.getRangeAt(0):null;S(L,{rangeCount:_.rangeCount,isCollapsed:_.isCollapsed,anchorNode:_.anchorNode?.nodeType===Node.TEXT_NODE?"TEXT":_.anchorNode?.nodeName,anchorOffset:_.anchorOffset,focusNode:_.focusNode?.nodeType===Node.TEXT_NODE?"TEXT":_.focusNode?.nodeName,focusOffset:_.focusOffset,range:v?{startContainer:v.startContainer.nodeType===Node.TEXT_NODE?"TEXT":v.startContainer.nodeName,startOffset:v.startOffset,endContainer:v.endContainer.nodeType===Node.TEXT_NODE?"TEXT":v.endContainer.nodeName,endOffset:v.endOffset}:null})}catch{}};return M.useCallback(L=>{if(e)return;t&&n?.(!1);const _=L.target;if(S("click",{tag:_.tagName,cls:_.className}),A("before click"),_.closest('[data-type="datepicker"]'))return;if(_.closest(".tag-close-btn")){L.preventDefault(),L.stopPropagation();return}if(r.length===0)return;const w=(k,W)=>{if(!i.current)return;Array.from(i.current.children).forEach(P=>{if(P!==k)if(W)P.dataset.prevDisplay===void 0&&(P.dataset.prevDisplay=P.style.display||""),P.dataset.rteForceHidden="1",P.style.setProperty("display","none","important");else{if(P.dataset.prevDisplay!==void 0){const ee=P.dataset.prevDisplay;ee?P.style.display=ee:P.style.removeProperty("display"),delete P.dataset.prevDisplay}else P.style.removeProperty("display");delete P.dataset.rteForceHidden}})},O=_.closest(".rte-textarea-toggle");if(O){L.preventDefault(),L.stopPropagation();const k=O.closest(".rte-textarea-wrapper"),W=k?.querySelector('[data-type="textarea"]'),P=!(O.getAttribute("data-expanded")==="true");O.setAttribute("data-expanded",String(P)),O.textContent=P?"收起":"展开",k&&k.classList.toggle("rte-textarea-expanded",P);const ee=k?.closest(".rte-textarea-required");if(ee?ee.classList.toggle("rte-textarea-overlay",P):k&&k.classList.toggle("rte-textarea-overlay",P),W)if(P)W.classList.add("rte-textarea-expanded"),W.style.maxHeight="none",W.style.height="100%";else{W.classList.remove("rte-textarea-expanded");const ae=W.dataset.maxHeight||"252";W.style.maxHeight=`${ae}px`,W.style.height="auto"}i.current&&(P?i.current.classList.add("rte-overlay-active"):i.current.classList.remove("rte-overlay-active"));return}const R=_.closest(".rte-richtext-toggle");if(R){L.preventDefault(),L.stopPropagation();const k=R.closest(".rte-richtext-wrapper"),W=k?.querySelector('[data-type="richtext"]'),P=!(R.getAttribute("data-expanded")==="true");((J,re)=>{J.setAttribute("data-expanded",String(re)),J.innerHTML=re?'<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>'})(R,P);const ae=k?.closest(".rte-richtext-required");ae?ae.classList.toggle("rte-richtext-expanded",P):k&&k.classList.toggle("rte-richtext-expanded",P);const ne=k?.closest(".exclusion-wrapper")||k?.parentElement;if(W&&(P?(W.style.height="100%",W.style.overflow="auto"):(W.style.height="",W.style.overflow="")),ne&&(ne.classList.toggle("rte-richtext-host-expanded",P),w(ne,P)),i.current){if(i.current.classList.toggle("rte-richtext-fullscreen-active",P),s.current?.classList.toggle("rte-richtext-container-expanded",P),s.current)if(P){const J=Math.ceil(s.current.getBoundingClientRect().height||0);J>0&&s.current.style.setProperty("--rte-richtext-fullscreen-height",`${J}px`)}else s.current.style.removeProperty("--rte-richtext-fullscreen-height");if(P)m.current=i.current.scrollTop||0,setTimeout(()=>{i.current&&(i.current.scrollTop=0,i.current.scrollLeft=0)},0);else{const J=m.current||0;setTimeout(()=>{i.current&&(i.current.scrollTop=J)},0)}}return}if(_.closest('[data-type="text"]')){L.preventDefault(),L.stopPropagation();const k=window.getSelection();k&&k.removeAllRanges();return}if(a&&_.closest(".tag-node")){L.preventDefault(),L.stopPropagation();const W=window.getSelection();W&&W.removeAllRanges();return}const x=_.closest('[data-type="variable"]');if(x){if(h.current)return;if(x.dataset.variableRender!=="antd-textarea"){const k=!!_.closest(".variable-info-icon"),W=x.classList.contains("show-placeholder")||(x.innerText||"").replace(/[\u200B\n]/g,"").trim().length===0;if(S("v1 variable click",{key:x.dataset.key,isPlaceholder:W,isOnIcon:k,classes:x.className,innerText:x.innerText}),W&&!k){L.preventDefault();const Q=()=>{try{x.focus();const P=window.getSelection();if(!P)return;const ee=document.createTreeWalker(x,NodeFilter.SHOW_TEXT),ae=ee.nextNode()?ee.currentNode:null,ne=document.createRange();ae?(ne.setStart(ae,0),ne.collapse(!0)):(ne.selectNodeContents(x),ne.collapse(!0)),P.removeAllRanges(),P.addRange(ne),A("after placeCaretLeft()")}catch{}};setTimeout(()=>{window.requestAnimationFrame(Q),window.requestAnimationFrame(()=>A("post-raf (click)"))},0)}}setTimeout(()=>{const k=window.getSelection();k&&!k.isCollapsed||Rn(i)},10);return}const H=_.closest(".video-remove-btn");if(H){L.preventDefault(),L.stopPropagation();const W=H.closest('[data-type="video-url"], [data-type="video-upload"]')?.dataset.key;W&&b&&b(Q=>{const P={...Q};return delete P[W],P});return}const U=_.closest('[data-type="video-upload"]');if(U){L.preventDefault(),L.stopPropagation();const k=U.dataset.key;k&&T?.current&&C&&(C.current=k,T.current.value="",T.current.click());return}const $=_.closest(".file-remove-btn");if($){L.preventDefault(),L.stopPropagation();const k=$.closest('[data-type="upload"]'),W=k?.dataset.key,Q=k?.dataset.batchKey;if(W)if(Q){const P=r.find(ee=>ee.type==="upload"&&ee.key===Q);if(P&&typeof P.maxCount=="number"&&typeof P.minCount=="number"){const ee=P.maxCount;d(ae=>{const ne={...ae},J=[];for(let re=0;re<ee;re++){const pe=`${Q}-${re}`,ge=ne[pe];ge!=null&&pe!==W&&J.push(ge)}for(let re=0;re<ee;re++)delete ne[`${Q}-${re}`];return J.forEach((re,pe)=>{ne[`${Q}-${pe}`]=re}),ne})}else p(W)}else p(W);return}const V=_.closest('[data-type="upload"]');if(V){const k=V.dataset.key,W=V.dataset.batchKey,Q=V.dataset.batchIndex;if(k){const P=W||k,ee=r.find(ae=>ae.type==="upload"&&ae.key===P);if(o.current&&(ee?.accept?o.current.accept=ee.accept:ee?.acceptType==="image"?o.current.accept="image/*":ee?.acceptType==="file"?o.current.accept=".csv,.xlsx,.xls,.txt,.pdf,.doc,.docx,.json":o.current.accept=""),W){const ae=r.find(ne=>ne.type==="upload"&&ne.key===W);if(ae&&typeof ae.maxCount=="number"&&typeof ae.minCount=="number"){const ne=ae.maxCount,J=l[k]!=null,re=Q!=null?Number.parseInt(Q,10):NaN;if(J){o.current&&(o.current.multiple=!1),E(null),f(null),y(k),u?.(),o.current?.click();return}let pe=0;for(let ge=0;ge<ne;ge++)l[`${W}-${ge}`]!=null&&(pe+=1);pe<ne&&o.current?(o.current.multiple=!0,E(W),f(Number.isFinite(re)?re:null),y(null),u?.(),o.current.click()):(o.current&&(o.current.multiple=!1),E(null),f(null),y(k),u?.(),o.current?.click())}else o.current&&(o.current.multiple=!1),E(null),f(null),y(k),u?.(),o.current?.click()}else o.current&&(o.current.multiple=!1),E(null),f(null),y(k),u?.(),o.current?.click()}return}},[t,r,s,e,i,o,u,l,p,h,a,n,m,E,f,y,d,b,T,C])},Hl=({config:e,editorRef:t,setIsEmpty:n,setIsFormValid:r,setReportAnalyzeState:a,setMarkdownAnalyzeState:i,setMarkdownNameAnalyzeState:s,collapsed:o,measureExpandedContentHeight:u,effectiveConfig:l,files:d,multiVariableCounts:p,setMultiVariableCounts:E,savedCursorRef:f,videoState:y})=>M.useCallback(()=>{if(e.length===0){if(t.current){const g=!(t.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"");n(g),r(!g)}return}if(Rn(t),t.current&&t.current.querySelectorAll('[data-type="variable"][data-node-type="report-url"]').forEach(g=>{const b=g.dataset.key;if(!b)return;g.innerText.replace(/[\u200B\n]/g,"").trim()||a(C=>{const S=C[b];return!S||S.status==="idle"&&(!S.modules||S.modules.length===0)?C:{...C,[b]:{status:"idle",modules:[],lastParsedUrl:void 0,error:void 0}}})}),t.current&&t.current.querySelectorAll('[data-type="variable"][data-node-type="markdown"]').forEach(g=>{const b=g.dataset.key;if(!b)return;g.innerText.replace(/[\u200B\n]/g,"").trim()||i(C=>{const S=C[b];return!S||S.status==="idle"&&(!S.modules||S.modules.length===0)?C:{...C,[b]:{status:"idle",modules:[],lastParsedText:void 0,error:void 0}}})}),t.current&&t.current.querySelectorAll('[data-type="variable"][data-node-type="markdown-name"]').forEach(g=>{const b=g.dataset.key;if(!b)return;g.innerText.replace(/[\u200B\n]/g,"").trim()||s(C=>{const S=C[b];return!S||S.status==="idle"&&(!S.modules||S.modules.length===0)?C:{...C,[b]:{status:"idle",modules:[],lastParsedText:void 0,error:void 0}}})}),t.current&&t.current.querySelectorAll('[data-type="richtext"][data-node-type="markdown-module"]').forEach(g=>{const b=g.dataset.key;if(!b)return;const T=g.innerText.replace(/[\u200B\n]/g,"").trim();g.getAttribute("data-is-placeholder")==="true"&&T&&!T.startsWith("请补充:")&&g.removeAttribute("data-is-placeholder"),T||(i(C=>{const S=C[b];return!S||S.status==="idle"?C:{...C,[b]:{status:"idle",modules:[],lastParsedText:void 0,error:void 0}}}),s(C=>{const S=C[b];return!S||S.status==="idle"?C:{...C,[b]:{status:"idle",modules:[],lastParsedText:void 0,error:void 0}}}))}),t.current&&t.current.querySelectorAll('[data-type="variable"]').forEach(g=>{if(g.dataset.variableRender==="antd-textarea")return;const b=g.innerText||"",T=!!g.querySelector("br")||b.includes(`
37
37
  `),C=g.offsetHeight>32,A=b.replace(/\u200B/g,"").trim().length>0&&(T||C);g.classList.toggle("rte-variable-multiline",A),g.classList.toggle("rte-variable-force-block",A);const L=g.closest(".rte-inline-group");L&&L.classList.toggle("rte-inline-group-force-block",A);const _=g.closest(".required-upload-group, .required-multi-first");_&&_.classList.toggle("rte-required-group-force-block",A);const v=g.querySelector(".variable-info-icon");if(v){let N=!1;const w=document.createTreeWalker(g,NodeFilter.SHOW_TEXT,{acceptNode:O=>v.contains(O)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT});for(;w.nextNode();)if(w.currentNode.textContent?.replace(/[\u200B\n]/g,"").trim()){N=!0;break}N?v.classList.add("hidden"):v.classList.remove("hidden"),g.classList.toggle("rte-variable-with-icon",!v.classList.contains("hidden"))}}),o||window.requestAnimationFrame(()=>{u()}),_r(t,l,d,y),vr(t,l,d,r,y),!t.current)return;e.filter(m=>m.type==="multi-variable"&&m.key).forEach(m=>{if(!m.key)return;const g=m.maxCount||9,b=p[m.key]||1,T=[];for(let _=0;_<b;_++){const v=`${m.key}_${_}`,N=t.current.querySelector(`[data-type="variable"][data-key="${v}"][data-multi-key="${m.key}"]`);if(N){const w=(N.innerText||"").replace(/\u200B/g,"").replace(/\r\n/g,`
38
38
  `).trim();T.push(w)}}const S=(T[T.length-1]||"")==="";let A=!1,L=-1;for(let _=0;_<T.length-1;_++)if(T[_]===""){A=!0,L=_;break}if(A&&L>=0){const _=window.getSelection();if(_&&_.rangeCount>0){const R=_.getRangeAt(0),I=R.startContainer,x=I.nodeType===Node.ELEMENT_NODE?I.closest('[data-type="variable"][data-multi-key]'):I.parentElement?.closest('[data-type="variable"][data-multi-key]');if(x){const H=x.dataset.key;if(H){const U=document.createRange();U.setStartBefore(x),U.setEnd(R.startContainer,R.startOffset);const $=U.toString().length;f.current={key:H,offset:$}}}}const v=[...T];for(let R=L;R<v.length-1;R++)v[R]=v[R+1];v.pop();const N={};v.forEach((R,I)=>{R&&(N[`${m.key}_${I}`]=R)});const w=Math.max(S?v.length:v.length+1,1);t.current.querySelectorAll('[data-type="variable"]').forEach(R=>{const I=R.dataset.key,x=R.dataset.multiKey;if(I&&x!==m.key){const H=(R.innerText||"").replace(/\u200B/g,"").replace(/\r\n/g,`