@steedos-labs/plugin-workflow 3.0.51 → 3.0.52
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/designer/dist/assets/{index-CeMQUt8Y.js → index-BkLrUP0o.js} +5 -3
- package/designer/dist/assets/{index-Bs9qBPga.css → index-xR8ApdWL.css} +1 -1
- package/designer/dist/index.html +2 -2
- package/main/default/routes/am.router.js +2 -0
- package/main/default/routes/api_workflow_ai_form_design.router.js +16 -1
- package/main/default/routes/api_workflow_ai_form_design_stream.router.js +7 -3
- package/main/default/routes/api_workflow_next_step.router.js +1 -1
- package/main/default/routes/flow_form_design.ejs +2 -2
- package/main/default/test/FORMULA_SCAN_GUIDE.md +3 -0
- package/main/default/test/reports/formula-scan/SCAN_HISTORY.md +57 -0
- package/main/default/test/reports/formula-scan/scan-result-v10-20260327.json +31543 -0
- package/main/default/test/reports/formula-scan/scan-result-v9-20260327.json +31723 -0
- package/main/default/test/scan_production_formulas.js +25 -5
- package/main/default/triggers/amis_form_design.trigger.js +18 -17
- package/package.json +1 -1
|
@@ -21,7 +21,7 @@ Error generating stack: `+_.message+`
|
|
|
21
21
|
`);v=N.pop()||"";let E="";for(const $ of N)if($.startsWith("event: "))E=$.slice(7).trim();else if($.startsWith("data: ")){const k=$.slice(6);try{const M=JSON.parse(k);switch(E){case"progress":o&&o(M);break;case"chunk":o&&o({stage:"streaming",message:"AI 正在生成内容...",text:M.text,accumulated:M.accumulated});break;case"result":b=M,o&&o({stage:"complete",message:"转换完成!"});break;case"error":x=M.error||"AI 服务调用失败";break;case"done":break}}catch{}E=""}}function S(){f.read().then(({done:N,value:E})=>{if(N){v.trim()&&(v+=`
|
|
22
22
|
`,y()),x?d(new Error(x)):b?c(b):d(new Error("AI 未返回有效结果"));return}v+=p.decode(E,{stream:!0}),y(),S()}).catch(d)}S()})}function JT(e){const t=new Set(["_id","serverField","order","labelClassName","is_list_display","is_searchable","is_multiselect","validationRules","accept","multiple","valueFormat","approvalCommentSteps","colspan","tableColspan","valueType"]),n={};for(const r of Object.keys(e)){if(t.has(r))continue;const o=e[r];o==null||o===""||(r==="children"&&Array.isArray(o)?n.children=o.map(a=>JT(a)):n[r]=o)}return n}async function Use(e,t,n,r,o){return(await Ji.post("/am/ai/form-design",{fields:e.map(JT),events:t,userRequest:n,images:r},{baseURL:"/",timeout:3e5})).data}async function Wse(e,t){return(await Ji.post("/am/ai/code-generate",{systemPrompt:e,userMessage:t},{baseURL:"/",timeout:12e4})).data}async function Q2(e,t,n,r,o,a){let i="/am/ai/form-design-stream";const s={"Content-Type":"application/json"},l=JSON.stringify({fields:e.map(JT),events:t,userRequest:n,images:r,...o||{}}),c=await fetch(i,{method:"POST",headers:s,body:l});if(!c.ok){const d=await c.text();let f="AI 服务调用失败";try{f=JSON.parse(d).error||f}catch{d&&(f=d)}throw new Error(f)}return new Promise((d,f)=>{const p=c.body.getReader(),v=new TextDecoder;let b="",x=null,y=null;function S(){const E=b.split(`
|
|
23
23
|
`);b=E.pop()||"";let $="";for(const k of E)if(k.startsWith("event: "))$=k.slice(7).trim();else if(k.startsWith("data: ")){const M=k.slice(6);try{const j=JSON.parse(M);switch($){case"progress":a&&a(j);break;case"chunk":a&&a({stage:"streaming",message:"AI 正在生成内容...",text:j.text,accumulated:j.accumulated});break;case"result":x=j,a&&a({stage:"complete",message:"转换完成!"});break;case"error":y=j.error||"AI 服务调用失败";break;case"done":break}}catch{}$=""}}function N(){p.read().then(({done:E,value:$})=>{if(E){b.trim()&&(b+=`
|
|
24
|
-
`,S()),y?f(new Error(y)):x?d(x):f(new Error("AI 未返回有效结果"));return}b+=v.decode($,{stream:!0}),S(),N()}).catch(f)}N()})}async function qse(e,t){const n=await Ji.post(`/data/${e}`,t);return n.data?.data||n.data}async function Kse(e,t,n){const r=await Ji.patch(`/data/${e}/${t}`,n);return r.data?.data||r.data}async function Yse(e,t){return(await Ji.delete(`/data/${e}/${t}`)).data}async function Gse(e,t){const n=await Ji.get(`/data/${e}/${t}`);return n.data?.data||n.data}async function JD(e,t){const{objectName:n="",recordId:r="",parent:o="",collectionName:a="cfs.files.filerecord"}=t||{},i=new FormData;i.append("file",e),n&&i.append("object_name",n),r&&i.append("record_id",r),o&&i.append("parent",o);const s={},l=localStorage.getItem("steedos:spaceId"),c=localStorage.getItem("steedos:auth_token");return l&&c&&(s.Authorization=`Bearer ${l},${c}`),(await Ji.post(`/files/${a}`,i,{headers:s,timeout:6e4})).data}function vb(e,t,n="cfs.files.filerecord"){return`/api/v6/files/download/${n}/${e}/${encodeURIComponent(t||e)}`}async function Xse(e,t="cfs.files.filerecord"){if(!e.length)return{};const n=t.replace(/\./g,"_");try{const o=(await Ji.get(`/data/${n}`,{params:{filters:JSON.stringify(["_id","in",e]),fields:"_id,original",top:e.length,skip:0}})).data?.data||[],a={};for(const i of o)i._id&&i.original?.name&&(a[i._id]=i.original.name);return a}catch{return{}}}let wk=null,yb=null;async function Jse(){return wk||yb||(yb=(async()=>{try{let t="";const n={},o=await(await fetch(`${t}/service/api/amis-design/objects`,{headers:n})).json(),a=Array.isArray(o)?o:[];return wk=a,a}catch{return[]}finally{yb=null}})(),yb)}const ZD=new Map,Ck=new Map;async function Dx(e){if(!e)return[];const t=ZD.get(e);if(t)return t;const n=Ck.get(e);if(n)return n;const r=(async()=>{try{let a="";const i={},c=(await(await fetch(`${a}/service/api/amis-metadata-objects/objects/${encodeURIComponent(e)}/fields/options`,{headers:i})).json())?.data?.options??[];return ZD.set(e,c),c}catch{return[]}finally{Ck.delete(e)}})();return Ck.set(e,r),r}const BN="workflow_designer_backups";async function Zse(e){return qse(BN,e)}async function QD(e){return pv(BN,{filters:JSON.stringify(["form_id","=",e]),sort:"created desc",fields:"_id,name,backup_type,form_id,flow_id,created",top:20})}async function Qse(e){return Gse(BN,e)}async function ele(e){return Yse(BN,e)}async function eA(e){return(await pv("object_workflows",{filters:JSON.stringify(["flow_id","=",e]),fields:"_id,name,object_name,flow_id,field_map,field_map_back,field_map_script,field_map_back_script,sync_attachment,sync_type,sync_direction",top:100})).data||[]}async function tA(e,t){return Kse("object_workflows",e,t)}let XB=null;function tle(e){XB=e}function nle(){const e="/api/workflow/designer-v2/";return e.endsWith("/")?e:e+"/"}function rle(){return new URLSearchParams(window.location.search).get("flowId")}function nA(e){const t=nle(),n=rle(),r=n?`?flowId=${n}`:"",o=e==="form"?`${t}form-designer${r}`:`${t}${r}`;history.pushState({},"",o),XB?.(e)}function rA(e){return e.includes("/form-designer")?"form":"flow"}function ole({target:e,onConfirm:t,onCancel:n}){const r=e==="flow"?"流程设计":"表单设计";return g.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center",onMouseDown:o=>o.target===o.currentTarget&&n(),children:[g.jsx("div",{className:"absolute inset-0 bg-black/30 backdrop-blur-[2px]"}),g.jsxs("div",{className:"relative bg-white rounded-2xl shadow-2xl w-[340px] p-6 flex flex-col gap-4 animate-fade-in-scale",children:[g.jsx("div",{className:"flex items-center justify-center w-11 h-11 rounded-full bg-amber-50 border border-amber-100 mx-auto",children:g.jsx(X2,{className:"w-5 h-5 text-amber-500"})}),g.jsxs("div",{className:"text-center",children:[g.jsx("p",{className:"text-[15px] font-semibold text-gray-800 mb-1",children:"有未保存的修改"}),g.jsxs("p",{className:"text-[13px] text-gray-500 leading-relaxed",children:["切换到",g.jsxs("span",{className:"font-medium text-gray-700",children:["「",r,"」"]}),"后,当前未保存的内容将会丢失。"]})]}),g.jsxs("div",{className:"flex gap-2 mt-1",children:[g.jsx("button",{onClick:n,className:"flex-1 px-4 py-2 rounded-lg text-[13px] font-medium text-gray-600 bg-gray-100 hover:bg-gray-200 smooth-transition",children:"继续编辑"}),g.jsx("button",{onClick:t,className:"flex-1 px-4 py-2 rounded-lg text-[13px] font-medium text-white bg-amber-500 hover:bg-amber-600 smooth-transition",children:"放弃并离开"})]})]})]})}function qM({active:e,isDirty:t}){const[n,r]=h.useState(null),o=a=>{e!==a&&(t?r(a):nA(a))};return g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex items-center bg-gray-100 rounded-lg p-0.5",children:[g.jsxs("button",{onClick:()=>o("flow"),className:`flex items-center gap-1.5 rounded-md px-3 py-1 text-[12px] font-medium smooth-transition ${e==="flow"?"bg-white text-indigo-700 shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:[g.jsx(VT,{className:"w-3.5 h-3.5"}),"流程设计"]}),g.jsxs("button",{onClick:()=>o("form"),className:`flex items-center gap-1.5 rounded-md px-3 py-1 text-[12px] font-medium smooth-transition ${e==="form"?"bg-white text-emerald-700 shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:[g.jsx(IM,{className:"w-3.5 h-3.5"}),"表单设计"]})]}),n&&Ui.createPortal(g.jsx(ole,{target:n,onConfirm:()=>{r(null),nA(n)},onCancel:()=>r(null)}),document.body)]})}const oA=!1;function ale(){const{nodes:e,edges:t,loadFromStepsJson:n,exportToStepsJson:r,flowName:o,flowDescription:a,setFlowName:i,setFlowDescription:s,flowId:l,flowData:c,isDirty:d,markClean:f,nextEvents:p,flowProperties:v}=ho(),{loadVersions:b,saveVersion:x}=Ix(),y=h.useRef(null),[S,N]=h.useState(!1),[E,$]=h.useState(""),[k,M]=h.useState(!0);h.useEffect(()=>{l&&b(l)},[l]);const[j,I]=h.useState(!1),[R,F]=h.useState(""),[L,V]=h.useState(""),[z,T]=h.useState(""),[P,D]=h.useState(""),[H,W]=h.useState(!1),[Z,Y]=h.useState([]),[A,K]=h.useState(!1),[Q,G]=h.useState(null),J=h.useRef(void 0),X=h.useCallback((ce,oe="info")=>{J.current&&clearTimeout(J.current),G({message:ce,type:oe}),J.current=setTimeout(()=>G(null),oe==="error"?4e3:2500)},[]),ee=()=>{$(o),N(!0)},te=()=>{i(E.trim()),N(!1)},ne=()=>{N(!1)},le=async()=>{if(!l||!c){X("没有加载流程数据,无法保存","error");return}const ce=sre(e,t);if(ce.length>0){Y(ce),K(!0);return}W(!0);try{const me=r().map(je=>{const Fe={...je,id:je._id};return delete Fe._id,Fe.lines&&(Fe.lines=Fe.lines.map($e=>{const Ae={...$e,id:$e._id};return delete Ae._id,Ae})),Fe}),Ee={...c,id:c._id,name:o,descriptions:a,allow_select_step:v.allow_select_step,timeout_auto_submit:v.timeout_auto_submit,auto_remind:v.auto_remind,enable_distribute_instance_related:v.enable_distribute_instance_related,perms:v.perms,current:{...c.current,steps:me,nextEvents:p}};delete Ee._id,await WM(Ee),f(),X("保存成功","success"),x(l||null,r(),"手动保存","manual")}catch(oe){X("保存失败: "+(oe?.response?.data?.message||oe?.response?.data||oe?.message||"未知错误"),"error")}finally{W(!1)}},ae=h.useCallback(()=>{const ce=r(),oe=new Date,me=`${String(oe.getHours()).padStart(2,"0")}:${String(oe.getMinutes()).padStart(2,"0")}:${String(oe.getSeconds()).padStart(2,"0")}`;x(l||null,ce,`暂存 ${me}`,"stash"),X("已暂存到本地版本历史","success")},[r,x,l]),ie=()=>{y.current?.click()},de=ce=>{const oe=ce.target.files?.[0];if(!oe)return;const me=new FileReader;me.onload=Ee=>{try{let je=Ee.target?.result;je=je.replace(/NumberInt\((\d+)\)/g,"$1");const Fe=JSON.parse(je);Array.isArray(Fe)?n(Fe):Fe&&typeof Fe=="object"&&Fe.current&&Array.isArray(Fe.current.steps)?(Fe.name&&i(Fe.name),Fe.description&&s(Fe.description),n(Fe.current.steps)):X("JSON 格式错误: 需要一个步骤数组","error")}catch(je){X("JSON 解析失败: "+je.message,"error")}},me.readAsText(oe),ce.target.value=""},fe=()=>{const ce=r(),oe=new Blob([JSON.stringify(ce,null,2)],{type:"application/json"}),me=URL.createObjectURL(oe),Ee=document.createElement("a");Ee.href=me,Ee.download="workflow-steps.json",Ee.click(),URL.revokeObjectURL(me)};return g.jsxs("header",{className:"flex-shrink-0 bg-white border-b border-gray-200",children:[g.jsx("input",{ref:y,type:"file",accept:".json",className:"hidden",onChange:de}),g.jsxs("div",{className:"relative flex h-12 items-center px-4 gap-3",children:[g.jsxs("div",{className:"flex items-center gap-2.5",children:[g.jsx("div",{className:"w-7 h-7 rounded-lg bg-indigo-600 flex items-center justify-center flex-shrink-0",children:g.jsx(VT,{className:"w-3.5 h-3.5 text-white"})}),S?g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("input",{value:E,onChange:ce=>$(ce.target.value),className:"border border-gray-300 rounded-md px-2 py-1 text-[13px] w-48 focus:border-indigo-400 focus:ring-1 focus:ring-indigo-200 outline-none",placeholder:"流程名称",autoFocus:!0,onKeyDown:ce=>{ce.key==="Escape"&&ne(),ce.key==="Enter"&&te()}}),g.jsx("button",{onClick:te,className:"text-[12px] text-indigo-600 font-medium hover:text-indigo-800 whitespace-nowrap",children:"确定"}),g.jsx("button",{onClick:ne,className:"text-[12px] text-gray-400 hover:text-gray-600 whitespace-nowrap",children:"取消"})]}):g.jsxs("button",{onClick:ee,className:"flex items-center gap-1.5 group",title:"点击编辑流程名称",children:[g.jsx("h1",{className:"text-[14px] font-semibold text-gray-800 whitespace-nowrap",children:o||"未命名流程"}),g.jsx(Y2,{className:"w-3 h-3 text-gray-300 group-hover:text-gray-500 smooth-transition"})]})]}),g.jsx("div",{className:"absolute left-1/2 -translate-x-1/2",children:g.jsx(qM,{active:"flow",isDirty:d})}),g.jsx("div",{className:"flex-1"}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsxs("button",{onClick:ie,className:"flex items-center gap-1.5 rounded-md border border-gray-300 bg-white px-3 py-1.5 text-[13px] font-medium text-gray-700 hover:bg-gray-50 smooth-transition",title:"导入 Steps JSON",children:[g.jsx(vB,{className:"w-3.5 h-3.5"}),"导入"]}),g.jsxs("button",{onClick:fe,className:"flex items-center gap-1.5 rounded-md border border-gray-300 bg-white px-3 py-1.5 text-[13px] font-medium text-gray-700 hover:bg-gray-50 smooth-transition",title:"导出 Steps JSON",children:[g.jsx(gB,{className:"w-3.5 h-3.5"}),"导出"]}),g.jsxs("button",{onClick:ae,className:"flex items-center gap-1.5 rounded-md border border-gray-300 bg-white px-3 py-1.5 text-[13px] font-medium text-gray-700 hover:bg-gray-50 smooth-transition",title:"暂存到本地版本历史",children:[g.jsx(OT,{className:"w-3.5 h-3.5"}),"暂存"]}),g.jsxs("button",{onClick:le,disabled:H,className:"flex items-center gap-1.5 rounded-md bg-indigo-600 px-3 py-1.5 text-[13px] font-medium text-white hover:bg-indigo-700 disabled:opacity-50 smooth-transition",children:[H?g.jsx(au,{className:"w-3.5 h-3.5 animate-spin"}):g.jsx(PT,{className:"w-3.5 h-3.5"}),H?"保存中...":"保存"]}),oA]})]}),oA,Q&&g.jsx("div",{className:"fixed top-4 left-1/2 -translate-x-1/2 z-[100] animate-in fade-in slide-in-from-top-2 duration-200",children:g.jsxs("div",{className:`flex items-center gap-2 px-4 py-2.5 rounded-lg shadow-lg border text-[13px] font-medium ${Q.type==="success"?"bg-emerald-50 border-emerald-200 text-emerald-700":Q.type==="error"?"bg-red-50 border-red-200 text-red-700":"bg-blue-50 border-blue-200 text-blue-700"}`,children:[Q.type==="success"&&g.jsx(nm,{className:"w-4 h-4 text-emerald-500 flex-shrink-0"}),Q.type==="error"&&g.jsx(Tv,{className:"w-4 h-4 text-red-500 flex-shrink-0"}),Q.type==="info"&&g.jsx(AM,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}),g.jsx("span",{children:Q.message}),g.jsx("button",{onClick:()=>G(null),className:"ml-1 text-current opacity-50 hover:opacity-100",children:"×"})]})}),A&&Z.length>0&&g.jsx("div",{className:"fixed inset-0 bg-black/30 flex items-center justify-center z-50",onClick:()=>K(!1),children:g.jsxs("div",{className:"bg-white rounded-xl shadow-xl w-[420px] max-h-[80vh] flex flex-col",onClick:ce=>ce.stopPropagation(),children:[g.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-gray-100",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(X2,{className:"w-4.5 h-4.5 text-amber-500"}),g.jsx("h3",{className:"text-[14px] font-semibold text-gray-800",children:"保存校验未通过"}),g.jsxs("span",{className:"text-[11px] text-gray-400 bg-gray-100 rounded-full px-2 py-0.5",children:[Z.length," 项"]})]}),g.jsx("button",{onClick:()=>K(!1),className:"text-gray-400 hover:text-gray-600 smooth-transition",children:g.jsx(co,{className:"w-4 h-4"})})]}),g.jsx("div",{className:"overflow-y-auto px-5 py-3 space-y-2 flex-1",children:Z.map((ce,oe)=>g.jsxs("div",{className:"flex items-start gap-2.5 px-3 py-2.5 rounded-lg bg-amber-50/50 border border-amber-100 cursor-pointer hover:bg-amber-50 smooth-transition",onClick:()=>{ho.getState().selectNode(ce.nodeId),K(!1)},children:[g.jsx(Tv,{className:"w-3.5 h-3.5 text-amber-500 mt-0.5 flex-shrink-0"}),g.jsxs("div",{className:"min-w-0",children:[g.jsx("span",{className:"text-[12px] font-medium text-gray-700",children:ce.nodeName}),g.jsx("p",{className:"text-[11px] text-gray-500 mt-0.5",children:ce.message})]})]},oe))}),g.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 flex items-center justify-between",children:[g.jsx("p",{className:"text-[10px] text-gray-400",children:"点击条目可定位到对应节点"}),g.jsx("button",{onClick:()=>K(!1),className:"rounded-lg border border-gray-300 px-4 py-1.5 text-[12px] font-medium text-gray-600 hover:bg-gray-50 smooth-transition",children:"关闭"})]})]})})]})}const ile=[{id:"submit",label:"填写",icon:jT,color:"#3b82f6",bg:"#eff6ff",border:"#bfdbfe"},{id:"sign",label:"审批",icon:nm,color:"#6366f1",bg:"#eef2ff",border:"#c7d2fe"},{id:"counterSign",label:"会签",icon:HT,color:"#8b5cf6",bg:"#f5f3ff",border:"#ddd6fe"},{id:"condition",label:"条件",icon:TT,color:"#f59e0b",bg:"#fffbeb",border:"#fde68a"}];function sle(){const{nodes:e}=ho(),t=(n,r,o)=>{n.dataTransfer.setData("application/workflow-node-type",r),n.dataTransfer.setData("application/workflow-node-label",o),n.dataTransfer.effectAllowed="move"};return g.jsxs("aside",{className:"flex-shrink-0 w-52 border-r border-gray-200 bg-white flex flex-col",children:[g.jsxs("div",{className:"px-3 pt-3 pb-2",children:[g.jsx("h2",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"节点库"}),g.jsx("p",{className:"mt-0.5 text-[11px] text-gray-400",children:"拖拽节点到画布中"})]}),g.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar px-2 pb-2",children:g.jsx("div",{className:"space-y-0.5",children:ile.map(n=>{if(n.id==="divider")return g.jsx("div",{className:"my-1.5 h-px bg-gray-100"},"divider");const r=n.icon;return g.jsxs("div",{draggable:!0,onDragStart:o=>t(o,n.id,n.label),className:"group flex items-center gap-2.5 rounded-lg px-2.5 py-2 cursor-grab active:cursor-grabbing hover:bg-gray-50 border border-transparent hover:border-gray-200 smooth-transition select-none",children:[g.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md",style:{backgroundColor:n.bg,border:`1px solid ${n.border}`},children:g.jsx(r,{className:"h-3.5 w-3.5",style:{color:n.color}})}),g.jsx("span",{className:"text-[13px] font-medium text-gray-700 flex-1",children:n.label}),g.jsx(ms,{className:"h-3.5 w-3.5 text-gray-300 opacity-0 group-hover:opacity-100 smooth-transition"})]},n.id)})})}),g.jsx("div",{className:"border-t border-gray-100 px-3 py-2",children:g.jsxs("div",{className:"flex items-center justify-between text-[11px] text-gray-400",children:[g.jsx("span",{children:"画布节点"}),g.jsx("span",{className:"font-mono font-medium text-gray-600",children:e.length})]})})]})}const aA={start:{icon:g.jsx(DN,{className:"w-4 h-4"}),color:"#10b981",bg:"#ecfdf5",border:"#a7f3d0",selectedBorder:"#10b981"},submit:{icon:g.jsx(jT,{className:"w-4 h-4"}),color:"#3b82f6",bg:"#eff6ff",border:"#bfdbfe",selectedBorder:"#3b82f6"},sign:{icon:g.jsx(nm,{className:"w-4 h-4"}),color:"#6366f1",bg:"#eef2ff",border:"#c7d2fe",selectedBorder:"#6366f1"},counterSign:{icon:g.jsx(HT,{className:"w-4 h-4"}),color:"#8b5cf6",bg:"#f5f3ff",border:"#ddd6fe",selectedBorder:"#8b5cf6"},condition:{icon:g.jsx(TT,{className:"w-4 h-4"}),color:"#f59e0b",bg:"#fffbeb",border:"#fde68a",selectedBorder:"#f59e0b"},end:{icon:g.jsx(pB,{className:"w-4 h-4"}),color:"#ef4444",bg:"#fef2f2",border:"#fecaca",selectedBorder:"#ef4444"},notify:{icon:g.jsx(Tre,{className:"w-4 h-4"}),color:"#06b6d4",bg:"#ecfeff",border:"#a5f3fc",selectedBorder:"#06b6d4"},concurrentStart:{icon:g.jsx(poe,{className:"w-4 h-4"}),color:"#64748b",bg:"#f8fafc",border:"#e2e8f0",selectedBorder:"#64748b"},concurrentEnd:{icon:g.jsx(goe,{className:"w-4 h-4"}),color:"#64748b",bg:"#f8fafc",border:"#e2e8f0",selectedBorder:"#64748b"}},Zc=h.memo(({id:e,data:t,selected:n,type:r})=>{const o=r||t.step_type||"sign",a=t.label,i=aA[o]||aA.sign,s=jv[o]||o,l=t.deal_type?lle(t.deal_type):"",c=ho(M=>M.editingNodeId),d=ho(M=>M.setEditingNodeId),f=ho(M=>M.updateNodeLabel),p=ho(M=>M.nodes),v=c===e,[b,x]=h.useState(a||""),y=h.useRef(null);h.useEffect(()=>{v&&(x(a||""),setTimeout(()=>y.current?.focus(),0))},[v,a]);const S=h.useCallback(()=>{const M=b.trim();M&&M!==a&&(p.some(I=>I.id!==e&&String(I.data.label??"").trim()===M)||f(e,M)),d(null)},[b,a,e,f,d,p]),N=xD({handleType:"target"}),E=xD({handleType:"source"}),$=N.length,k=E.length;return g.jsxs(g.Fragment,{children:[o!=="start"&&g.jsxs("div",{className:"handle-wrapper handle-target",children:[g.jsx(Rv,{type:"target",position:An.Top,className:"workflow-handle workflow-handle-target",style:{background:"#3b82f6",border:"2px solid #fff",boxShadow:"0 0 0 1.5px #3b82f6"}}),g.jsx("span",{className:"handle-badge handle-badge-target",children:$})]}),g.jsxs("div",{className:"smooth-transition",style:{minWidth:160,background:"#fff",borderRadius:10,border:`1.5px solid ${n?i.selectedBorder:"#e5e7eb"}`,boxShadow:n?`0 0 0 2px ${i.selectedBorder}20, 0 4px 12px rgba(0,0,0,0.08)`:"0 1px 4px rgba(0,0,0,0.06)",overflow:"hidden"},children:[g.jsx("div",{style:{padding:"10px 14px"},children:g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[g.jsx("div",{style:{width:32,height:32,borderRadius:8,backgroundColor:i.bg,border:`1px solid ${i.border}`,display:"flex",alignItems:"center",justifyContent:"center",color:i.color,flexShrink:0},children:i.icon}),g.jsxs("div",{style:{flex:1,minWidth:0},children:[g.jsx("div",{style:{fontSize:13,fontWeight:600,color:"#1f2937",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:"18px"},children:v?g.jsx("input",{ref:y,value:b,onChange:M=>x(M.target.value),onBlur:S,onKeyDown:M=>{M.key==="Enter"&&S(),M.key==="Escape"&&d(null),M.stopPropagation()},onClick:M=>M.stopPropagation(),onMouseDown:M=>M.stopPropagation(),className:"w-full bg-white border border-indigo-400 rounded px-1 py-0 text-[13px] font-semibold text-gray-800 outline-none focus:ring-1 focus:ring-indigo-300",style:{lineHeight:"18px",minWidth:60}}):g.jsx("span",{onDoubleClick:M=>{M.stopPropagation(),d(e)},style:{cursor:"default"},title:"双击编辑名称",children:a||"未命名"})}),g.jsxs("div",{style:{fontSize:11,color:"#9ca3af",marginTop:2,lineHeight:"14px"},children:[s,l?` · ${l}`:""]})]})]})}),g.jsx("div",{style:{height:2,background:i.color,opacity:.6}})]}),o!=="end"&&g.jsxs("div",{className:"handle-wrapper handle-source",children:[g.jsx(Rv,{type:"source",position:An.Bottom,className:"workflow-handle workflow-handle-source",style:{background:"#f97316",border:"2px solid #fff",boxShadow:"0 0 0 1.5px #f97316"}}),g.jsx("span",{className:"handle-badge handle-badge-source",children:k})]})]})});function lle(e){return{pickupAtRuntime:"审批时指定",specifyUser:"指定人员",hrRole:"角色",applicantRole:"审批岗位",applicantSuperior:"上级",applicant:"申请人",userField:"人员字段",orgField:"部门字段",specifyOrg:"部门",userFieldRole:"人员字段岗位",orgFieldRole:"部门字段岗位"}[e]||""}Zc.displayName="WorkflowNode";const cle={start:Zc,submit:Zc,sign:Zc,counterSign:Zc,condition:Zc,end:Zc,notify:Zc,concurrentStart:Zc,concurrentEnd:Zc};function ule(){const{nodes:e,edges:t,onNodesChange:n,onEdgesChange:r,addEdge:o,selectNode:a,selectEdge:i,addNode:s,selectedNode:l,selectedEdge:c,deleteNode:d,deleteEdge:f,setEditingNodeId:p,updateEdgeData:v}=ho(),b=h.useRef(null),{screenToFlowPosition:x}=MN(),[y,S]=h.useState(null),[N,E]=h.useState(null),$=h.useRef(null),k=h.useCallback((Y,A)=>{Y.preventDefault(),a(A.id),S({x:Y.clientX,y:Y.clientY,type:"node",id:A.id,nodeType:A.type})},[a]),M=h.useCallback((Y,A)=>{Y.preventDefault(),i(A.id),S({x:Y.clientX,y:Y.clientY,type:"edge",id:A.id})},[i]),j=h.useCallback(()=>{y&&(y.type==="node"?d(y.id):f(y.id),S(null))},[y,d,f]),I=h.useCallback(()=>{if(y){if(y.type==="node")p(y.id);else{const A=t.find(K=>K.id===y.id)?.data?.label||"";E({id:y.id,x:y.x,y:y.y,value:A}),setTimeout(()=>$.current?.focus(),0)}S(null)}},[y,p,t]),R=h.useCallback((Y,A)=>{const K=A.data?.label||"";E({id:A.id,x:Y.clientX,y:Y.clientY,value:K}),setTimeout(()=>$.current?.focus(),0)},[]),F=h.useCallback(()=>{if(!N)return;const Y=N.value.trim(),K=t.find(Q=>Q.id===N.id)?.data?.label||"";Y!==K&&v(N.id,{label:Y}),E(null)},[N,t,v]),L=h.useCallback(()=>{E(null)},[]),V=h.useCallback(()=>{S(null)},[]),z=h.useMemo(()=>{const Y=!!l||!!c;return Y?t.map(A=>{if(c&&A.id===c)return{...A,className:"edge-selected",animated:!0,style:{stroke:"#10b981",strokeWidth:3},markerEnd:{type:Gu.ArrowClosed,color:"#10b981",width:20,height:20},labelStyle:{fill:"#fff",fontWeight:700,fontSize:12},labelBgStyle:{fill:"#10b981",fillOpacity:.95},labelBgPadding:[8,5],labelBgBorderRadius:5};if(l){const K=A.source===l,Q=A.target===l;if(K)return{...A,className:"edge-outgoing",animated:!0,style:{stroke:"#f97316",strokeWidth:2.5},markerEnd:{type:Gu.ArrowClosed,color:"#f97316",width:18,height:18},label:A.label?`${A.label} →`:"→ 出",labelStyle:{fill:"#fff",fontWeight:600,fontSize:11},labelBgStyle:{fill:"#f97316",fillOpacity:.9},labelBgPadding:[6,4],labelBgBorderRadius:4};if(Q)return{...A,className:"edge-incoming",animated:!0,style:{stroke:"#3b82f6",strokeWidth:2.5},markerEnd:{type:Gu.ArrowClosed,color:"#3b82f6",width:18,height:18},label:A.label?`${A.label} ←`:"← 入",labelStyle:{fill:"#fff",fontWeight:600,fontSize:11},labelBgStyle:{fill:"#3b82f6",fillOpacity:.9},labelBgPadding:[6,4],labelBgBorderRadius:4}}return Y?{...A,className:"edge-dimmed",animated:!1,style:{stroke:"#e2e8f0",strokeWidth:1},markerEnd:{type:Gu.ArrowClosed,color:"#e2e8f0",width:14,height:14}}:A}):t},[t,l,c]),T=h.useCallback(Y=>{Y.source&&Y.target&&o(Y.source,Y.target)},[o]),P=h.useCallback((Y,A)=>{i(A.id)},[i]),D=h.useCallback(()=>{a(null),i(null),S(null),E(null)},[a,i]),H=h.useCallback((Y,A)=>{a(A.id)},[a]),W=h.useCallback(Y=>{Y.preventDefault(),Y.dataTransfer.dropEffect="move"},[]),Z=h.useCallback(Y=>{Y.preventDefault();const A=Y.dataTransfer.getData("application/workflow-node-type"),K=Y.dataTransfer.getData("application/workflow-node-label");if(!A||!K)return;const Q=x({x:Y.clientX,y:Y.clientY});s(A,K,Q.x,Q.y)},[x,s]);return g.jsxs("div",{ref:b,style:{width:"100%",height:"100%"},children:[g.jsxs(rne,{nodes:e,edges:z,onNodesChange:n,onEdgesChange:r,onConnect:T,onNodeClick:H,onEdgeClick:P,onNodeContextMenu:k,onEdgeContextMenu:M,onEdgeDoubleClick:R,onPaneClick:D,onDragOver:W,onDrop:Z,nodeTypes:cle,defaultEdgeOptions:{type:"smoothstep",animated:!0,style:{stroke:"#94a3b8",strokeWidth:1.5},markerEnd:{type:Gu.ArrowClosed,color:"#94a3b8",width:16,height:16}},fitView:!0,proOptions:{hideAttribution:!0},children:[g.jsx(cne,{variant:Zu.Dots,gap:20,size:1,color:"#d1d5db"}),g.jsx(gne,{showInteractive:!1,position:"bottom-left"}),e.length>0&&g.jsx(One,{nodeColor:Y=>{switch(Y.type){case"start":return"#10b981";case"submit":return"#3b82f6";case"sign":return"#6366f1";case"counterSign":return"#8b5cf6";case"condition":return"#f59e0b";case"end":return"#ef4444";case"notify":return"#06b6d4";case"concurrentStart":return"#64748b";case"concurrentEnd":return"#64748b";default:return"#94a3b8"}},maskColor:"rgba(248, 250, 252, 0.7)",position:"bottom-right"})]}),e.length===0&&g.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:g.jsx("div",{className:"rounded-2xl bg-white border border-gray-200 p-10 shadow-sm",children:g.jsxs("div",{className:"flex flex-col items-center",children:[g.jsx("div",{className:"rounded-full bg-indigo-50 p-5 mb-5",children:g.jsx(VT,{className:"h-10 w-10 text-indigo-400"})}),g.jsx("h3",{className:"text-lg font-semibold text-gray-800",children:"开始设计工作流"}),g.jsx("p",{className:"mt-2 text-sm text-gray-500 text-center max-w-[260px]",children:"从左侧拖拽节点到此处"}),g.jsxs("div",{className:"mt-5 flex items-center gap-4 text-xs text-gray-400",children:[g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx($re,{className:"h-3.5 w-3.5"}),g.jsx("span",{children:"拖拽添加"})]}),g.jsx("div",{className:"h-3 w-px bg-gray-200"}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx(nae,{className:"h-3.5 w-3.5"}),g.jsx("span",{children:"点击配置"})]})]})]})})}),y&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"fixed inset-0 z-40",onClick:V,onContextMenu:Y=>{Y.preventDefault(),V()}}),g.jsxs("div",{className:"fixed z-50 bg-white rounded-lg shadow-lg border border-gray-200 py-1 min-w-[140px]",style:{left:y.x,top:y.y},children:[y.type==="node"&&g.jsxs("button",{onClick:I,className:"flex items-center gap-2 w-full px-3 py-2 text-[13px] text-gray-700 hover:bg-gray-100 smooth-transition",children:[g.jsx(Y2,{className:"w-3.5 h-3.5"}),"重命名"]}),y.type==="edge"&&g.jsxs("button",{onClick:I,className:"flex items-center gap-2 w-full px-3 py-2 text-[13px] text-gray-700 hover:bg-gray-100 smooth-transition",children:[g.jsx(Y2,{className:"w-3.5 h-3.5"}),"编辑名称"]}),y.type==="node"&&(y.nodeType==="start"||y.nodeType==="end")?g.jsxs("div",{className:"px-3 py-2 text-[12px] text-gray-400 cursor-default",children:[y.nodeType==="start"?"开始":"结束","节点不可删除"]}):g.jsxs("button",{onClick:j,className:"flex items-center gap-2 w-full px-3 py-2 text-[13px] text-red-600 hover:bg-red-50 smooth-transition",children:[g.jsx(Xi,{className:"w-3.5 h-3.5"}),"删除",y.type==="node"?"节点":"连线"]})]})]}),N&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"fixed inset-0 z-40",onClick:F}),g.jsx("div",{className:"fixed z-50 bg-white rounded-lg shadow-lg border border-gray-200 p-2",style:{left:N.x-80,top:N.y-16},children:g.jsx("input",{ref:$,value:N.value,onChange:Y=>E({...N,value:Y.target.value}),onBlur:F,onKeyDown:Y=>{Y.key==="Enter"&&F(),Y.key==="Escape"&&L()},placeholder:"连线名称",className:"w-40 border border-indigo-400 rounded px-2 py-1 text-[13px] text-gray-800 outline-none focus:ring-1 focus:ring-indigo-300"})})]})]})}function dle(){return g.jsx(tB,{children:g.jsx(ule,{})})}var Sk={exports:{}};var iA;function fle(){return iA||(iA=1,(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var a="",i=0;i<arguments.length;i++){var s=arguments[i];s&&(a=o(a,r(s)))}return a}function r(a){if(typeof a=="string"||typeof a=="number")return a;if(typeof a!="object")return"";if(Array.isArray(a))return n.apply(null,a);if(a.toString!==Object.prototype.toString&&!a.toString.toString().includes("[native code]"))return a.toString();var i="";for(var s in a)t.call(a,s)&&a[s]&&(i=o(i,s));return i}function o(a,i){return i?a?a+" "+i:a+i:a}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Sk)),Sk.exports}var hle=fle();const ke=Ol(hle);function et(){return et=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},et.apply(null,arguments)}function nn(e){"@babel/helpers - typeof";return nn=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},nn(e)}var ple=Symbol.for("react.element"),mle=Symbol.for("react.transitional.element"),gle=Symbol.for("react.fragment");function JB(e){return e&&nn(e)==="object"&&(e.$$typeof===ple||e.$$typeof===mle)&&e.type===gle}function el(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=[];return _e.Children.forEach(e,function(r){r==null&&!t.keepEmpty||(Array.isArray(r)?n=n.concat(el(r)):JB(r)&&r.props?n=n.concat(el(r.props.children,t)):n.push(r))}),n}var KM={},vle=function(t){};function yle(e,t){}function ble(e,t){}function xle(){KM={}}function ZB(e,t,n){!t&&!KM[n]&&(e(!1,n),KM[n]=!0)}function Qr(e,t){ZB(yle,e,t)}function wle(e,t){ZB(ble,e,t)}Qr.preMessage=vle;Qr.resetWarned=xle;Qr.noteOnce=wle;function Cle(e,t){if(nn(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(nn(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function QB(e){var t=Cle(e,"string");return nn(t)=="symbol"?t:t+""}function ue(e,t,n){return(t=QB(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function pe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?sA(Object(n),!0).forEach(function(r){ue(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sA(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ax(e){return e instanceof HTMLElement||e instanceof SVGElement}function HN(e){return e&&nn(e)==="object"&&Ax(e.nativeElement)?e.nativeElement:Ax(e)?e:null}function s2(e){var t=HN(e);if(t)return t;if(e instanceof _e.Component){var n;return(n=Mv.findDOMNode)===null||n===void 0?void 0:n.call(Mv,e)}return null}var Ek={exports:{}},ro={};var lA;function Sle(){if(lA)return ro;lA=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),i=Symbol.for("react.context"),s=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),v=Symbol.for("react.offscreen"),b;b=Symbol.for("react.module.reference");function x(y){if(typeof y=="object"&&y!==null){var S=y.$$typeof;switch(S){case e:switch(y=y.type,y){case n:case o:case r:case c:case d:return y;default:switch(y=y&&y.$$typeof,y){case s:case i:case l:case p:case f:case a:return y;default:return S}}case t:return S}}}return ro.ContextConsumer=i,ro.ContextProvider=a,ro.Element=e,ro.ForwardRef=l,ro.Fragment=n,ro.Lazy=p,ro.Memo=f,ro.Portal=t,ro.Profiler=o,ro.StrictMode=r,ro.Suspense=c,ro.SuspenseList=d,ro.isAsyncMode=function(){return!1},ro.isConcurrentMode=function(){return!1},ro.isContextConsumer=function(y){return x(y)===i},ro.isContextProvider=function(y){return x(y)===a},ro.isElement=function(y){return typeof y=="object"&&y!==null&&y.$$typeof===e},ro.isForwardRef=function(y){return x(y)===l},ro.isFragment=function(y){return x(y)===n},ro.isLazy=function(y){return x(y)===p},ro.isMemo=function(y){return x(y)===f},ro.isPortal=function(y){return x(y)===t},ro.isProfiler=function(y){return x(y)===o},ro.isStrictMode=function(y){return x(y)===r},ro.isSuspense=function(y){return x(y)===c},ro.isSuspenseList=function(y){return x(y)===d},ro.isValidElementType=function(y){return typeof y=="string"||typeof y=="function"||y===n||y===o||y===r||y===c||y===d||y===v||typeof y=="object"&&y!==null&&(y.$$typeof===p||y.$$typeof===f||y.$$typeof===a||y.$$typeof===i||y.$$typeof===l||y.$$typeof===b||y.getModuleId!==void 0)},ro.typeOf=x,ro}var cA;function Ele(){return cA||(cA=1,Ek.exports=Sle()),Ek.exports}var Nk=Ele();function od(e,t,n){var r=h.useRef({});return(!("value"in r.current)||n(r.current.condition,t))&&(r.current.value=e(),r.current.condition=t),r.current.value}var Nle=Number(h.version.split(".")[0]),Px=function(t,n){typeof t=="function"?t(n):nn(t)==="object"&&t&&"current"in t&&(t.current=n)},Zi=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=n.filter(Boolean);return o.length<=1?o[0]:function(a){n.forEach(function(i){Px(i,a)})}},cd=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return od(function(){return Zi.apply(void 0,n)},n,function(o,a){return o.length!==a.length||o.every(function(i,s){return i!==a[s]})})},cu=function(t){var n,r;if(!t)return!1;if(ZT(t)&&Nle>=19)return!0;var o=Nk.isMemo(t)?t.type.type:t.type;return!(typeof o=="function"&&!((n=o.prototype)!==null&&n!==void 0&&n.render)&&o.$$typeof!==Nk.ForwardRef||typeof t=="function"&&!((r=t.prototype)!==null&&r!==void 0&&r.render)&&t.$$typeof!==Nk.ForwardRef)};function ZT(e){return h.isValidElement(e)&&!JB(e)}var $le=function(t){return ZT(t)&&cu(t)},rm=function(t){if(t&&ZT(t)){var n=t;return n.props.propertyIsEnumerable("ref")?n.props.ref:n.ref}return null},YM=h.createContext(null);function _le(e){var t=e.children,n=e.onBatchResize,r=h.useRef(0),o=h.useRef([]),a=h.useContext(YM),i=h.useCallback(function(s,l,c){r.current+=1;var d=r.current;o.current.push({size:s,element:l,data:c}),Promise.resolve().then(function(){d===r.current&&(n?.(o.current),o.current=[])}),a?.(s,l,c)},[n,a]);return h.createElement(YM.Provider,{value:i},t)}var eH=(function(){if(typeof Map<"u")return Map;function e(t,n){var r=-1;return t.some(function(o,a){return o[0]===n?(r=a,!0):!1}),r}return(function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(n){var r=e(this.__entries__,n),o=this.__entries__[r];return o&&o[1]},t.prototype.set=function(n,r){var o=e(this.__entries__,n);~o?this.__entries__[o][1]=r:this.__entries__.push([n,r])},t.prototype.delete=function(n){var r=this.__entries__,o=e(r,n);~o&&r.splice(o,1)},t.prototype.has=function(n){return!!~e(this.__entries__,n)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(n,r){r===void 0&&(r=null);for(var o=0,a=this.__entries__;o<a.length;o++){var i=a[o];n.call(r,i[1],i[0])}},t})()})(),GM=typeof window<"u"&&typeof document<"u"&&window.document===document,eE=(function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()})(),kle=(function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(eE):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}})(),Ole=2;function Mle(e,t){var n=!1,r=!1,o=0;function a(){n&&(n=!1,e()),r&&s()}function i(){kle(a)}function s(){var l=Date.now();if(n){if(l-o<Ole)return;r=!0}else n=!0,r=!1,setTimeout(i,t);o=l}return s}var Rle=20,jle=["top","right","bottom","left","width","height","size","weight"],Tle=typeof MutationObserver<"u",Ile=(function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=Mle(this.refresh.bind(this),Rle)}return e.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},e.prototype.removeObserver=function(t){var n=this.observers_,r=n.indexOf(t);~r&&n.splice(r,1),!n.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){var t=this.updateObservers_();t&&this.refresh()},e.prototype.updateObservers_=function(){var t=this.observers_.filter(function(n){return n.gatherActive(),n.hasActive()});return t.forEach(function(n){return n.broadcastActive()}),t.length>0},e.prototype.connect_=function(){!GM||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),Tle?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!GM||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var n=t.propertyName,r=n===void 0?"":n,o=jle.some(function(a){return!!~r.indexOf(a)});o&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e})(),tH=(function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];Object.defineProperty(e,o,{value:t[o],enumerable:!1,writable:!1,configurable:!0})}return e}),Pv=(function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||eE}),nH=VN(0,0,0,0);function tE(e){return parseFloat(e)||0}function uA(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce(function(r,o){var a=e["border-"+o+"-width"];return r+tE(a)},0)}function Dle(e){for(var t=["top","right","bottom","left"],n={},r=0,o=t;r<o.length;r++){var a=o[r],i=e["padding-"+a];n[a]=tE(i)}return n}function Ale(e){var t=e.getBBox();return VN(0,0,t.width,t.height)}function Ple(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return nH;var r=Pv(e).getComputedStyle(e),o=Dle(r),a=o.left+o.right,i=o.top+o.bottom,s=tE(r.width),l=tE(r.height);if(r.boxSizing==="border-box"&&(Math.round(s+a)!==t&&(s-=uA(r,"left","right")+a),Math.round(l+i)!==n&&(l-=uA(r,"top","bottom")+i)),!zle(e)){var c=Math.round(s+a)-t,d=Math.round(l+i)-n;Math.abs(c)!==1&&(s-=c),Math.abs(d)!==1&&(l-=d)}return VN(o.left,o.top,s,l)}var Lle=(function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof Pv(e).SVGGraphicsElement}:function(e){return e instanceof Pv(e).SVGElement&&typeof e.getBBox=="function"}})();function zle(e){return e===Pv(e).document.documentElement}function Fle(e){return GM?Lle(e)?Ale(e):Ple(e):nH}function Ble(e){var t=e.x,n=e.y,r=e.width,o=e.height,a=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,i=Object.create(a.prototype);return tH(i,{x:t,y:n,width:r,height:o,top:n,right:t+r,bottom:o+n,left:t}),i}function VN(e,t,n,r){return{x:e,y:t,width:n,height:r}}var Hle=(function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=VN(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=Fle(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},e})(),Vle=(function(){function e(t,n){var r=Ble(n);tH(this,{target:t,contentRect:r})}return e})(),Ule=(function(){function e(t,n,r){if(this.activeObservations_=[],this.observations_=new eH,typeof t!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=n,this.callbackCtx_=r}return e.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof Pv(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)||(n.set(t,new Hle(t)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof Pv(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)&&(n.delete(t),n.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&t.activeObservations_.push(n)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,n=this.activeObservations_.map(function(r){return new Vle(r.target,r.broadcastRect())});this.callback_.call(t,n,t),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e})(),rH=typeof WeakMap<"u"?new WeakMap:new eH,oH=(function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=Ile.getInstance(),r=new Ule(t,n,this);rH.set(this,r)}return e})();["observe","unobserve","disconnect"].forEach(function(e){oH.prototype[e]=function(){var t;return(t=rH.get(this))[e].apply(t,arguments)}});var Wle=(function(){return typeof eE.ResizeObserver<"u"?eE.ResizeObserver:oH})(),_f=new Map;function qle(e){e.forEach(function(t){var n,r=t.target;(n=_f.get(r))===null||n===void 0||n.forEach(function(o){return o(r)})})}var aH=new Wle(qle);function Kle(e,t){_f.has(e)||(_f.set(e,new Set),aH.observe(e)),_f.get(e).add(t)}function Yle(e,t){_f.has(e)&&(_f.get(e).delete(t),_f.get(e).size||(aH.unobserve(e),_f.delete(e)))}function mo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dA(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,QB(r.key),r)}}function go(e,t,n){return t&&dA(e.prototype,t),n&&dA(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Lx(e,t){return Lx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Lx(e,t)}function Ml(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Lx(e,t)}function zx(e){return zx=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},zx(e)}function QT(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(QT=function(){return!!e})()}function Gt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Gle(e,t){if(t&&(nn(t)=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Gt(e)}function Rl(e){var t=QT();return function(){var n,r=zx(e);if(t){var o=zx(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Gle(this,n)}}var Xle=(function(e){Ml(n,e);var t=Rl(n);function n(){return mo(this,n),t.apply(this,arguments)}return go(n,[{key:"render",value:function(){return this.props.children}}]),n})(h.Component);function Jle(e,t){var n=e.children,r=e.disabled,o=h.useRef(null),a=h.useRef(null),i=h.useContext(YM),s=typeof n=="function",l=s?n(o):n,c=h.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),d=!s&&h.isValidElement(l)&&cu(l),f=d?rm(l):null,p=cd(f,o),v=function(){var S;return s2(o.current)||(o.current&&nn(o.current)==="object"?s2((S=o.current)===null||S===void 0?void 0:S.nativeElement):null)||s2(a.current)};h.useImperativeHandle(t,function(){return v()});var b=h.useRef(e);b.current=e;var x=h.useCallback(function(y){var S=b.current,N=S.onResize,E=S.data,$=y.getBoundingClientRect(),k=$.width,M=$.height,j=y.offsetWidth,I=y.offsetHeight,R=Math.floor(k),F=Math.floor(M);if(c.current.width!==R||c.current.height!==F||c.current.offsetWidth!==j||c.current.offsetHeight!==I){var L={width:R,height:F,offsetWidth:j,offsetHeight:I};c.current=L;var V=j===Math.round(k)?k:j,z=I===Math.round(M)?M:I,T=pe(pe({},L),{},{offsetWidth:V,offsetHeight:z});i?.(T,y,E),N&&Promise.resolve().then(function(){N(T,y)})}},[]);return h.useEffect(function(){var y=v();return y&&!r&&Kle(y,x),function(){return Yle(y,x)}},[o.current,r]),h.createElement(Xle,{ref:a},d?h.cloneElement(l,{ref:p}):l)}var Zle=h.forwardRef(Jle),Qle="rc-observer-key";function ece(e,t){var n=e.children,r=typeof n=="function"?[n]:el(n);return r.map(function(o,a){var i=o?.key||"".concat(Qle,"-").concat(a);return h.createElement(Zle,et({},e,{key:i,ref:a===0?t:void 0}),o)})}var _s=h.forwardRef(ece);_s.Collection=_le;function XM(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function tce(e){if(Array.isArray(e))return XM(e)}function iH(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function UN(e,t){if(e){if(typeof e=="string")return XM(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?XM(e,t):void 0}}function nce(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
24
|
+
`,S()),y?f(new Error(y)):x?d(x):f(new Error("AI 未返回有效结果"));return}b+=v.decode($,{stream:!0}),S(),N()}).catch(f)}N()})}async function qse(e,t){const n=await Ji.post(`/data/${e}`,t);return n.data?.data||n.data}async function Kse(e,t,n){const r=await Ji.patch(`/data/${e}/${t}`,n);return r.data?.data||r.data}async function Yse(e,t){return(await Ji.delete(`/data/${e}/${t}`)).data}async function Gse(e,t){const n=await Ji.get(`/data/${e}/${t}`);return n.data?.data||n.data}async function JD(e,t){const{objectName:n="",recordId:r="",parent:o="",collectionName:a="cfs.files.filerecord"}=t||{},i=new FormData;i.append("file",e),n&&i.append("object_name",n),r&&i.append("record_id",r),o&&i.append("parent",o);const s={},l=localStorage.getItem("steedos:spaceId"),c=localStorage.getItem("steedos:auth_token");return l&&c&&(s.Authorization=`Bearer ${l},${c}`),(await Ji.post(`/files/${a}`,i,{headers:s,timeout:6e4})).data}function vb(e,t,n="cfs.files.filerecord"){return`/api/v6/files/download/${n}/${e}/${encodeURIComponent(t||e)}`}async function Xse(e,t="cfs.files.filerecord"){if(!e.length)return{};const n=t.replace(/\./g,"_");try{const o=(await Ji.get(`/data/${n}`,{params:{filters:JSON.stringify(["_id","in",e]),fields:"_id,original",top:e.length,skip:0}})).data?.data||[],a={};for(const i of o)i._id&&i.original?.name&&(a[i._id]=i.original.name);return a}catch{return{}}}let wk=null,yb=null;async function Jse(){return wk||yb||(yb=(async()=>{try{let t="";const n={},o=await(await fetch(`${t}/service/api/amis-design/objects`,{headers:n})).json(),a=Array.isArray(o)?o:[];return wk=a,a}catch{return[]}finally{yb=null}})(),yb)}const ZD=new Map,Ck=new Map;async function Dx(e){if(!e)return[];const t=ZD.get(e);if(t)return t;const n=Ck.get(e);if(n)return n;const r=(async()=>{try{let a="";const i={},c=(await(await fetch(`${a}/service/api/amis-metadata-objects/objects/${encodeURIComponent(e)}/fields/options`,{headers:i})).json())?.data?.options??[];return ZD.set(e,c),c}catch{return[]}finally{Ck.delete(e)}})();return Ck.set(e,r),r}const BN="workflow_designer_backups";async function Zse(e){return qse(BN,e)}async function QD(e){return pv(BN,{filters:JSON.stringify(["form_id","=",e]),sort:"created desc",fields:"_id,name,backup_type,form_id,flow_id,created",top:20})}async function Qse(e){return Gse(BN,e)}async function ele(e){return Yse(BN,e)}async function eA(e){return(await pv("object_workflows",{filters:JSON.stringify(["flow_id","=",e]),fields:"_id,name,object_name,flow_id,field_map,field_map_back,field_map_script,field_map_back_script,sync_attachment,sync_type,sync_direction",top:100})).data||[]}async function tA(e,t){return Kse("object_workflows",e,t)}let XB=null;function tle(e){XB=e}function nle(){const e="/api/workflow/designer-v2/";return e.endsWith("/")?e:e+"/"}function rle(){return new URLSearchParams(window.location.search).get("flowId")}function nA(e){const t=nle(),n=rle(),r=n?`?flowId=${n}`:"",o=e==="form"?`${t}form-designer${r}`:`${t}${r}`;history.pushState({},"",o),XB?.(e)}function rA(e){return e.includes("/form-designer")?"form":"flow"}function ole({target:e,onConfirm:t,onCancel:n}){const r=e==="flow"?"流程设计":"表单设计";return g.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center",onMouseDown:o=>o.target===o.currentTarget&&n(),children:[g.jsx("div",{className:"absolute inset-0 bg-black/30 backdrop-blur-[2px]"}),g.jsxs("div",{className:"relative bg-white rounded-2xl shadow-2xl w-[340px] p-6 flex flex-col gap-4 animate-fade-in-scale",children:[g.jsx("div",{className:"flex items-center justify-center w-11 h-11 rounded-full bg-amber-50 border border-amber-100 mx-auto",children:g.jsx(X2,{className:"w-5 h-5 text-amber-500"})}),g.jsxs("div",{className:"text-center",children:[g.jsx("p",{className:"text-[15px] font-semibold text-gray-800 mb-1",children:"有未保存的修改"}),g.jsxs("p",{className:"text-[13px] text-gray-500 leading-relaxed",children:["切换到",g.jsxs("span",{className:"font-medium text-gray-700",children:["「",r,"」"]}),"后,当前未保存的内容将会丢失。"]})]}),g.jsxs("div",{className:"flex gap-2 mt-1",children:[g.jsx("button",{onClick:n,className:"flex-1 px-4 py-2 rounded-lg text-[13px] font-medium text-gray-600 bg-gray-100 hover:bg-gray-200 smooth-transition",children:"继续编辑"}),g.jsx("button",{onClick:t,className:"flex-1 px-4 py-2 rounded-lg text-[13px] font-medium text-white bg-amber-500 hover:bg-amber-600 smooth-transition",children:"放弃并离开"})]})]})]})}function qM({active:e,isDirty:t}){const[n,r]=h.useState(null),o=a=>{e!==a&&(t?r(a):nA(a))};return g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex items-center bg-gray-100 rounded-lg p-0.5",children:[g.jsxs("button",{onClick:()=>o("flow"),className:`flex items-center gap-1.5 rounded-md px-3 py-1 text-[12px] font-medium smooth-transition ${e==="flow"?"bg-white text-indigo-700 shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:[g.jsx(VT,{className:"w-3.5 h-3.5"}),"流程设计"]}),g.jsxs("button",{onClick:()=>o("form"),className:`flex items-center gap-1.5 rounded-md px-3 py-1 text-[12px] font-medium smooth-transition ${e==="form"?"bg-white text-emerald-700 shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:[g.jsx(IM,{className:"w-3.5 h-3.5"}),"表单设计"]})]}),n&&Ui.createPortal(g.jsx(ole,{target:n,onConfirm:()=>{r(null),nA(n)},onCancel:()=>r(null)}),document.body)]})}const oA=!1;function ale(){const{nodes:e,edges:t,loadFromStepsJson:n,exportToStepsJson:r,flowName:o,flowDescription:a,setFlowName:i,setFlowDescription:s,flowId:l,flowData:c,isDirty:d,markClean:f,nextEvents:p,flowProperties:v}=ho(),{loadVersions:b,saveVersion:x}=Ix(),y=h.useRef(null),[S,N]=h.useState(!1),[E,$]=h.useState(""),[k,M]=h.useState(!0);h.useEffect(()=>{l&&b(l)},[l]);const[j,I]=h.useState(!1),[R,F]=h.useState(""),[L,V]=h.useState(""),[z,T]=h.useState(""),[P,D]=h.useState(""),[H,W]=h.useState(!1),[Z,Y]=h.useState([]),[A,K]=h.useState(!1),[Q,G]=h.useState(null),J=h.useRef(void 0),X=h.useCallback((ce,oe="info")=>{J.current&&clearTimeout(J.current),G({message:ce,type:oe}),J.current=setTimeout(()=>G(null),oe==="error"?4e3:2500)},[]),ee=()=>{$(o),N(!0)},te=()=>{i(E.trim()),N(!1)},ne=()=>{N(!1)},le=async()=>{if(!l||!c){X("没有加载流程数据,无法保存","error");return}const ce=sre(e,t);if(ce.length>0){Y(ce),K(!0);return}W(!0);try{const me=r().map(je=>{const Fe={...je,id:je._id};return delete Fe._id,Fe.lines&&(Fe.lines=Fe.lines.map($e=>{const Ae={...$e,id:$e._id};return delete Ae._id,Ae})),Fe}),Ee={...c,id:c._id,name:o,descriptions:a,allow_select_step:v.allow_select_step,timeout_auto_submit:v.timeout_auto_submit,auto_remind:v.auto_remind,enable_distribute_instance_related:v.enable_distribute_instance_related,perms:v.perms,current:{...c.current,steps:me,nextEvents:p}};delete Ee._id,await WM(Ee),f(),X("保存成功","success"),x(l||null,r(),"手动保存","manual")}catch(oe){X("保存失败: "+(oe?.response?.data?.message||oe?.response?.data||oe?.message||"未知错误"),"error")}finally{W(!1)}},ae=h.useCallback(()=>{const ce=r(),oe=new Date,me=`${String(oe.getHours()).padStart(2,"0")}:${String(oe.getMinutes()).padStart(2,"0")}:${String(oe.getSeconds()).padStart(2,"0")}`;x(l||null,ce,`暂存 ${me}`,"stash"),X("已暂存到本地版本历史","success")},[r,x,l]),ie=()=>{y.current?.click()},de=ce=>{const oe=ce.target.files?.[0];if(!oe)return;const me=new FileReader;me.onload=Ee=>{try{let je=Ee.target?.result;je=je.replace(/NumberInt\((\d+)\)/g,"$1");const Fe=JSON.parse(je);Array.isArray(Fe)?n(Fe):Fe&&typeof Fe=="object"&&Fe.current&&Array.isArray(Fe.current.steps)?(Fe.name&&i(Fe.name),Fe.description&&s(Fe.description),n(Fe.current.steps)):X("JSON 格式错误: 需要一个步骤数组","error")}catch(je){X("JSON 解析失败: "+je.message,"error")}},me.readAsText(oe),ce.target.value=""},fe=()=>{const ce=r(),oe=new Blob([JSON.stringify(ce,null,2)],{type:"application/json"}),me=URL.createObjectURL(oe),Ee=document.createElement("a");Ee.href=me,Ee.download="workflow-steps.json",Ee.click(),URL.revokeObjectURL(me)};return g.jsxs("header",{className:"flex-shrink-0 bg-white border-b border-gray-200",children:[g.jsx("input",{ref:y,type:"file",accept:".json",className:"hidden",onChange:de}),g.jsxs("div",{className:"relative flex h-12 items-center px-4 gap-3",children:[g.jsxs("div",{className:"flex items-center gap-2.5",children:[g.jsx("div",{className:"w-7 h-7 rounded-lg bg-indigo-600 flex items-center justify-center flex-shrink-0",children:g.jsx(VT,{className:"w-3.5 h-3.5 text-white"})}),S?g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("input",{value:E,onChange:ce=>$(ce.target.value),className:"border border-gray-300 rounded-md px-2 py-1 text-[13px] w-48 focus:border-indigo-400 focus:ring-1 focus:ring-indigo-200 outline-none",placeholder:"流程名称",autoFocus:!0,onKeyDown:ce=>{ce.key==="Escape"&&ne(),ce.key==="Enter"&&te()}}),g.jsx("button",{onClick:te,className:"text-[12px] text-indigo-600 font-medium hover:text-indigo-800 whitespace-nowrap",children:"确定"}),g.jsx("button",{onClick:ne,className:"text-[12px] text-gray-400 hover:text-gray-600 whitespace-nowrap",children:"取消"})]}):g.jsxs("button",{onClick:ee,className:"flex items-center gap-1.5 group",title:"点击编辑流程名称",children:[g.jsx("h1",{className:"text-[14px] font-semibold text-gray-800 whitespace-nowrap",children:o||"未命名流程"}),g.jsx(Y2,{className:"w-3 h-3 text-gray-300 group-hover:text-gray-500 smooth-transition"})]})]}),g.jsx("div",{className:"absolute left-1/2 -translate-x-1/2",children:g.jsx(qM,{active:"flow",isDirty:d})}),g.jsx("div",{className:"flex-1"}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsxs("button",{onClick:ie,className:"flex items-center gap-1.5 rounded-md border border-gray-300 bg-white px-3 py-1.5 text-[13px] font-medium text-gray-700 hover:bg-gray-50 smooth-transition",title:"导入 Steps JSON",children:[g.jsx(vB,{className:"w-3.5 h-3.5"}),"导入"]}),g.jsxs("button",{onClick:fe,className:"flex items-center gap-1.5 rounded-md border border-gray-300 bg-white px-3 py-1.5 text-[13px] font-medium text-gray-700 hover:bg-gray-50 smooth-transition",title:"导出 Steps JSON",children:[g.jsx(gB,{className:"w-3.5 h-3.5"}),"导出"]}),g.jsxs("button",{onClick:ae,className:"flex items-center gap-1.5 rounded-md border border-gray-300 bg-white px-3 py-1.5 text-[13px] font-medium text-gray-700 hover:bg-gray-50 smooth-transition",title:"暂存到本地版本历史",children:[g.jsx(OT,{className:"w-3.5 h-3.5"}),"暂存"]}),g.jsxs("button",{onClick:le,disabled:H,className:"flex items-center gap-1.5 rounded-md bg-indigo-600 px-3 py-1.5 text-[13px] font-medium text-white hover:bg-indigo-700 disabled:opacity-50 smooth-transition",children:[H?g.jsx(au,{className:"w-3.5 h-3.5 animate-spin"}):g.jsx(PT,{className:"w-3.5 h-3.5"}),H?"保存中...":"保存"]}),oA]})]}),oA,Q&&g.jsx("div",{className:"fixed top-4 left-1/2 -translate-x-1/2 z-[100] animate-in fade-in slide-in-from-top-2 duration-200",children:g.jsxs("div",{className:`flex items-center gap-2 px-4 py-2.5 rounded-lg shadow-lg border text-[13px] font-medium ${Q.type==="success"?"bg-emerald-50 border-emerald-200 text-emerald-700":Q.type==="error"?"bg-red-50 border-red-200 text-red-700":"bg-blue-50 border-blue-200 text-blue-700"}`,children:[Q.type==="success"&&g.jsx(nm,{className:"w-4 h-4 text-emerald-500 flex-shrink-0"}),Q.type==="error"&&g.jsx(Tv,{className:"w-4 h-4 text-red-500 flex-shrink-0"}),Q.type==="info"&&g.jsx(AM,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}),g.jsx("span",{children:Q.message}),g.jsx("button",{onClick:()=>G(null),className:"ml-1 text-current opacity-50 hover:opacity-100",children:"×"})]})}),A&&Z.length>0&&g.jsx("div",{className:"fixed inset-0 bg-black/30 flex items-center justify-center z-50",onClick:()=>K(!1),children:g.jsxs("div",{className:"bg-white rounded-xl shadow-xl w-[420px] max-h-[80vh] flex flex-col",onClick:ce=>ce.stopPropagation(),children:[g.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-gray-100",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(X2,{className:"w-4.5 h-4.5 text-amber-500"}),g.jsx("h3",{className:"text-[14px] font-semibold text-gray-800",children:"保存校验未通过"}),g.jsxs("span",{className:"text-[11px] text-gray-400 bg-gray-100 rounded-full px-2 py-0.5",children:[Z.length," 项"]})]}),g.jsx("button",{onClick:()=>K(!1),className:"text-gray-400 hover:text-gray-600 smooth-transition",children:g.jsx(co,{className:"w-4 h-4"})})]}),g.jsx("div",{className:"overflow-y-auto px-5 py-3 space-y-2 flex-1",children:Z.map((ce,oe)=>g.jsxs("div",{className:"flex items-start gap-2.5 px-3 py-2.5 rounded-lg bg-amber-50/50 border border-amber-100 cursor-pointer hover:bg-amber-50 smooth-transition",onClick:()=>{ho.getState().selectNode(ce.nodeId),K(!1)},children:[g.jsx(Tv,{className:"w-3.5 h-3.5 text-amber-500 mt-0.5 flex-shrink-0"}),g.jsxs("div",{className:"min-w-0",children:[g.jsx("span",{className:"text-[12px] font-medium text-gray-700",children:ce.nodeName}),g.jsx("p",{className:"text-[11px] text-gray-500 mt-0.5",children:ce.message})]})]},oe))}),g.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 flex items-center justify-between",children:[g.jsx("p",{className:"text-[10px] text-gray-400",children:"点击条目可定位到对应节点"}),g.jsx("button",{onClick:()=>K(!1),className:"rounded-lg border border-gray-300 px-4 py-1.5 text-[12px] font-medium text-gray-600 hover:bg-gray-50 smooth-transition",children:"关闭"})]})]})})]})}const ile=[{id:"submit",label:"填写",icon:jT,color:"#3b82f6",bg:"#eff6ff",border:"#bfdbfe"},{id:"sign",label:"审批",icon:nm,color:"#6366f1",bg:"#eef2ff",border:"#c7d2fe"},{id:"counterSign",label:"会签",icon:HT,color:"#8b5cf6",bg:"#f5f3ff",border:"#ddd6fe"},{id:"condition",label:"条件",icon:TT,color:"#f59e0b",bg:"#fffbeb",border:"#fde68a"}];function sle(){const{nodes:e}=ho(),t=(n,r,o)=>{n.dataTransfer.setData("application/workflow-node-type",r),n.dataTransfer.setData("application/workflow-node-label",o),n.dataTransfer.effectAllowed="move"};return g.jsxs("aside",{className:"flex-shrink-0 w-52 border-r border-gray-200 bg-white flex flex-col",children:[g.jsxs("div",{className:"px-3 pt-3 pb-2",children:[g.jsx("h2",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"节点库"}),g.jsx("p",{className:"mt-0.5 text-[11px] text-gray-400",children:"拖拽节点到画布中"})]}),g.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar px-2 pb-2",children:g.jsx("div",{className:"space-y-0.5",children:ile.map(n=>{if(n.id==="divider")return g.jsx("div",{className:"my-1.5 h-px bg-gray-100"},"divider");const r=n.icon;return g.jsxs("div",{draggable:!0,onDragStart:o=>t(o,n.id,n.label),className:"group flex items-center gap-2.5 rounded-lg px-2.5 py-2 cursor-grab active:cursor-grabbing hover:bg-gray-50 border border-transparent hover:border-gray-200 smooth-transition select-none",children:[g.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md",style:{backgroundColor:n.bg,border:`1px solid ${n.border}`},children:g.jsx(r,{className:"h-3.5 w-3.5",style:{color:n.color}})}),g.jsx("span",{className:"text-[13px] font-medium text-gray-700 flex-1",children:n.label}),g.jsx(ms,{className:"h-3.5 w-3.5 text-gray-300 opacity-0 group-hover:opacity-100 smooth-transition"})]},n.id)})})}),g.jsx("div",{className:"border-t border-gray-100 px-3 py-2",children:g.jsxs("div",{className:"flex items-center justify-between text-[11px] text-gray-400",children:[g.jsx("span",{children:"画布节点"}),g.jsx("span",{className:"font-mono font-medium text-gray-600",children:e.length})]})})]})}const aA={start:{icon:g.jsx(DN,{className:"w-4 h-4"}),color:"#10b981",bg:"#ecfdf5",border:"#a7f3d0",selectedBorder:"#10b981"},submit:{icon:g.jsx(jT,{className:"w-4 h-4"}),color:"#3b82f6",bg:"#eff6ff",border:"#bfdbfe",selectedBorder:"#3b82f6"},sign:{icon:g.jsx(nm,{className:"w-4 h-4"}),color:"#6366f1",bg:"#eef2ff",border:"#c7d2fe",selectedBorder:"#6366f1"},counterSign:{icon:g.jsx(HT,{className:"w-4 h-4"}),color:"#8b5cf6",bg:"#f5f3ff",border:"#ddd6fe",selectedBorder:"#8b5cf6"},condition:{icon:g.jsx(TT,{className:"w-4 h-4"}),color:"#f59e0b",bg:"#fffbeb",border:"#fde68a",selectedBorder:"#f59e0b"},end:{icon:g.jsx(pB,{className:"w-4 h-4"}),color:"#ef4444",bg:"#fef2f2",border:"#fecaca",selectedBorder:"#ef4444"},notify:{icon:g.jsx(Tre,{className:"w-4 h-4"}),color:"#06b6d4",bg:"#ecfeff",border:"#a5f3fc",selectedBorder:"#06b6d4"},concurrentStart:{icon:g.jsx(poe,{className:"w-4 h-4"}),color:"#64748b",bg:"#f8fafc",border:"#e2e8f0",selectedBorder:"#64748b"},concurrentEnd:{icon:g.jsx(goe,{className:"w-4 h-4"}),color:"#64748b",bg:"#f8fafc",border:"#e2e8f0",selectedBorder:"#64748b"}},Zc=h.memo(({id:e,data:t,selected:n,type:r})=>{const o=r||t.step_type||"sign",a=t.label,i=aA[o]||aA.sign,s=jv[o]||o,l=t.deal_type?lle(t.deal_type):"",c=ho(M=>M.editingNodeId),d=ho(M=>M.setEditingNodeId),f=ho(M=>M.updateNodeLabel),p=ho(M=>M.nodes),v=c===e,[b,x]=h.useState(a||""),y=h.useRef(null);h.useEffect(()=>{v&&(x(a||""),setTimeout(()=>y.current?.focus(),0))},[v,a]);const S=h.useCallback(()=>{const M=b.trim();M&&M!==a&&(p.some(I=>I.id!==e&&String(I.data.label??"").trim()===M)||f(e,M)),d(null)},[b,a,e,f,d,p]),N=xD({handleType:"target"}),E=xD({handleType:"source"}),$=N.length,k=E.length;return g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:`handle-wrapper ${o==="start"?"handle-target-left":"handle-target"}`,children:[g.jsx(Rv,{type:"target",position:o==="start"?An.Left:An.Top,className:"workflow-handle workflow-handle-target",style:{background:"#3b82f6",border:"2px solid #fff",boxShadow:"0 0 0 1.5px #3b82f6"}}),g.jsx("span",{className:"handle-badge handle-badge-target",children:$})]}),g.jsxs("div",{className:"smooth-transition",style:{minWidth:160,background:"#fff",borderRadius:10,border:`1.5px solid ${n?i.selectedBorder:"#e5e7eb"}`,boxShadow:n?`0 0 0 2px ${i.selectedBorder}20, 0 4px 12px rgba(0,0,0,0.08)`:"0 1px 4px rgba(0,0,0,0.06)",overflow:"hidden"},children:[g.jsx("div",{style:{padding:"10px 14px"},children:g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[g.jsx("div",{style:{width:32,height:32,borderRadius:8,backgroundColor:i.bg,border:`1px solid ${i.border}`,display:"flex",alignItems:"center",justifyContent:"center",color:i.color,flexShrink:0},children:i.icon}),g.jsxs("div",{style:{flex:1,minWidth:0},children:[g.jsx("div",{style:{fontSize:13,fontWeight:600,color:"#1f2937",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:"18px"},children:v?g.jsx("input",{ref:y,value:b,onChange:M=>x(M.target.value),onBlur:S,onKeyDown:M=>{M.key==="Enter"&&S(),M.key==="Escape"&&d(null),M.stopPropagation()},onClick:M=>M.stopPropagation(),onMouseDown:M=>M.stopPropagation(),className:"w-full bg-white border border-indigo-400 rounded px-1 py-0 text-[13px] font-semibold text-gray-800 outline-none focus:ring-1 focus:ring-indigo-300",style:{lineHeight:"18px",minWidth:60}}):g.jsx("span",{onDoubleClick:M=>{M.stopPropagation(),d(e)},style:{cursor:"default"},title:"双击编辑名称",children:a||"未命名"})}),g.jsxs("div",{style:{fontSize:11,color:"#9ca3af",marginTop:2,lineHeight:"14px"},children:[s,l?` · ${l}`:""]})]})]})}),g.jsx("div",{style:{height:2,background:i.color,opacity:.6}})]}),o!=="end"&&g.jsxs("div",{className:"handle-wrapper handle-source",children:[g.jsx(Rv,{type:"source",position:An.Bottom,className:"workflow-handle workflow-handle-source",style:{background:"#f97316",border:"2px solid #fff",boxShadow:"0 0 0 1.5px #f97316"}}),g.jsx("span",{className:"handle-badge handle-badge-source",children:k})]})]})});function lle(e){return{pickupAtRuntime:"审批时指定",specifyUser:"指定人员",hrRole:"角色",applicantRole:"审批岗位",applicantSuperior:"上级",applicant:"申请人",userField:"人员字段",orgField:"部门字段",specifyOrg:"部门",userFieldRole:"人员字段岗位",orgFieldRole:"部门字段岗位"}[e]||""}Zc.displayName="WorkflowNode";const cle={start:Zc,submit:Zc,sign:Zc,counterSign:Zc,condition:Zc,end:Zc,notify:Zc,concurrentStart:Zc,concurrentEnd:Zc};function ule(){const{nodes:e,edges:t,onNodesChange:n,onEdgesChange:r,addEdge:o,selectNode:a,selectEdge:i,addNode:s,selectedNode:l,selectedEdge:c,deleteNode:d,deleteEdge:f,setEditingNodeId:p,updateEdgeData:v}=ho(),b=h.useRef(null),{screenToFlowPosition:x}=MN(),[y,S]=h.useState(null),[N,E]=h.useState(null),$=h.useRef(null),k=h.useCallback((Y,A)=>{Y.preventDefault(),a(A.id),S({x:Y.clientX,y:Y.clientY,type:"node",id:A.id,nodeType:A.type})},[a]),M=h.useCallback((Y,A)=>{Y.preventDefault(),i(A.id),S({x:Y.clientX,y:Y.clientY,type:"edge",id:A.id})},[i]),j=h.useCallback(()=>{y&&(y.type==="node"?d(y.id):f(y.id),S(null))},[y,d,f]),I=h.useCallback(()=>{if(y){if(y.type==="node")p(y.id);else{const A=t.find(K=>K.id===y.id)?.data?.label||"";E({id:y.id,x:y.x,y:y.y,value:A}),setTimeout(()=>$.current?.focus(),0)}S(null)}},[y,p,t]),R=h.useCallback((Y,A)=>{const K=A.data?.label||"";E({id:A.id,x:Y.clientX,y:Y.clientY,value:K}),setTimeout(()=>$.current?.focus(),0)},[]),F=h.useCallback(()=>{if(!N)return;const Y=N.value.trim(),K=t.find(Q=>Q.id===N.id)?.data?.label||"";Y!==K&&v(N.id,{label:Y}),E(null)},[N,t,v]),L=h.useCallback(()=>{E(null)},[]),V=h.useCallback(()=>{S(null)},[]),z=h.useMemo(()=>{const Y=!!l||!!c;return Y?t.map(A=>{if(c&&A.id===c)return{...A,className:"edge-selected",animated:!0,style:{stroke:"#10b981",strokeWidth:3},markerEnd:{type:Gu.ArrowClosed,color:"#10b981",width:20,height:20},labelStyle:{fill:"#fff",fontWeight:700,fontSize:12},labelBgStyle:{fill:"#10b981",fillOpacity:.95},labelBgPadding:[8,5],labelBgBorderRadius:5};if(l){const K=A.source===l,Q=A.target===l;if(K)return{...A,className:"edge-outgoing",animated:!0,style:{stroke:"#f97316",strokeWidth:2.5},markerEnd:{type:Gu.ArrowClosed,color:"#f97316",width:18,height:18},label:A.label?`${A.label} →`:"→ 出",labelStyle:{fill:"#fff",fontWeight:600,fontSize:11},labelBgStyle:{fill:"#f97316",fillOpacity:.9},labelBgPadding:[6,4],labelBgBorderRadius:4};if(Q)return{...A,className:"edge-incoming",animated:!0,style:{stroke:"#3b82f6",strokeWidth:2.5},markerEnd:{type:Gu.ArrowClosed,color:"#3b82f6",width:18,height:18},label:A.label?`${A.label} ←`:"← 入",labelStyle:{fill:"#fff",fontWeight:600,fontSize:11},labelBgStyle:{fill:"#3b82f6",fillOpacity:.9},labelBgPadding:[6,4],labelBgBorderRadius:4}}return Y?{...A,className:"edge-dimmed",animated:!1,style:{stroke:"#e2e8f0",strokeWidth:1},markerEnd:{type:Gu.ArrowClosed,color:"#e2e8f0",width:14,height:14}}:A}):t},[t,l,c]),T=h.useCallback(Y=>{Y.source&&Y.target&&o(Y.source,Y.target)},[o]),P=h.useCallback((Y,A)=>{i(A.id)},[i]),D=h.useCallback(()=>{a(null),i(null),S(null),E(null)},[a,i]),H=h.useCallback((Y,A)=>{a(A.id)},[a]),W=h.useCallback(Y=>{Y.preventDefault(),Y.dataTransfer.dropEffect="move"},[]),Z=h.useCallback(Y=>{Y.preventDefault();const A=Y.dataTransfer.getData("application/workflow-node-type"),K=Y.dataTransfer.getData("application/workflow-node-label");if(!A||!K)return;const Q=x({x:Y.clientX,y:Y.clientY});s(A,K,Q.x,Q.y)},[x,s]);return g.jsxs("div",{ref:b,style:{width:"100%",height:"100%"},children:[g.jsxs(rne,{nodes:e,edges:z,onNodesChange:n,onEdgesChange:r,onConnect:T,onNodeClick:H,onEdgeClick:P,onNodeContextMenu:k,onEdgeContextMenu:M,onEdgeDoubleClick:R,onPaneClick:D,onDragOver:W,onDrop:Z,nodeTypes:cle,defaultEdgeOptions:{type:"smoothstep",animated:!0,style:{stroke:"#94a3b8",strokeWidth:1.5},markerEnd:{type:Gu.ArrowClosed,color:"#94a3b8",width:16,height:16}},fitView:!0,proOptions:{hideAttribution:!0},children:[g.jsx(cne,{variant:Zu.Dots,gap:20,size:1,color:"#d1d5db"}),g.jsx(gne,{showInteractive:!1,position:"bottom-left"}),e.length>0&&g.jsx(One,{nodeColor:Y=>{switch(Y.type){case"start":return"#10b981";case"submit":return"#3b82f6";case"sign":return"#6366f1";case"counterSign":return"#8b5cf6";case"condition":return"#f59e0b";case"end":return"#ef4444";case"notify":return"#06b6d4";case"concurrentStart":return"#64748b";case"concurrentEnd":return"#64748b";default:return"#94a3b8"}},maskColor:"rgba(248, 250, 252, 0.7)",position:"bottom-right"})]}),e.length===0&&g.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:g.jsx("div",{className:"rounded-2xl bg-white border border-gray-200 p-10 shadow-sm",children:g.jsxs("div",{className:"flex flex-col items-center",children:[g.jsx("div",{className:"rounded-full bg-indigo-50 p-5 mb-5",children:g.jsx(VT,{className:"h-10 w-10 text-indigo-400"})}),g.jsx("h3",{className:"text-lg font-semibold text-gray-800",children:"开始设计工作流"}),g.jsx("p",{className:"mt-2 text-sm text-gray-500 text-center max-w-[260px]",children:"从左侧拖拽节点到此处"}),g.jsxs("div",{className:"mt-5 flex items-center gap-4 text-xs text-gray-400",children:[g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx($re,{className:"h-3.5 w-3.5"}),g.jsx("span",{children:"拖拽添加"})]}),g.jsx("div",{className:"h-3 w-px bg-gray-200"}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx(nae,{className:"h-3.5 w-3.5"}),g.jsx("span",{children:"点击配置"})]})]})]})})}),y&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"fixed inset-0 z-40",onClick:V,onContextMenu:Y=>{Y.preventDefault(),V()}}),g.jsxs("div",{className:"fixed z-50 bg-white rounded-lg shadow-lg border border-gray-200 py-1 min-w-[140px]",style:{left:y.x,top:y.y},children:[y.type==="node"&&g.jsxs("button",{onClick:I,className:"flex items-center gap-2 w-full px-3 py-2 text-[13px] text-gray-700 hover:bg-gray-100 smooth-transition",children:[g.jsx(Y2,{className:"w-3.5 h-3.5"}),"重命名"]}),y.type==="edge"&&g.jsxs("button",{onClick:I,className:"flex items-center gap-2 w-full px-3 py-2 text-[13px] text-gray-700 hover:bg-gray-100 smooth-transition",children:[g.jsx(Y2,{className:"w-3.5 h-3.5"}),"编辑名称"]}),y.type==="node"&&(y.nodeType==="start"||y.nodeType==="end")?g.jsxs("div",{className:"px-3 py-2 text-[12px] text-gray-400 cursor-default",children:[y.nodeType==="start"?"开始":"结束","节点不可删除"]}):g.jsxs("button",{onClick:j,className:"flex items-center gap-2 w-full px-3 py-2 text-[13px] text-red-600 hover:bg-red-50 smooth-transition",children:[g.jsx(Xi,{className:"w-3.5 h-3.5"}),"删除",y.type==="node"?"节点":"连线"]})]})]}),N&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"fixed inset-0 z-40",onClick:F}),g.jsx("div",{className:"fixed z-50 bg-white rounded-lg shadow-lg border border-gray-200 p-2",style:{left:N.x-80,top:N.y-16},children:g.jsx("input",{ref:$,value:N.value,onChange:Y=>E({...N,value:Y.target.value}),onBlur:F,onKeyDown:Y=>{Y.key==="Enter"&&F(),Y.key==="Escape"&&L()},placeholder:"连线名称",className:"w-40 border border-indigo-400 rounded px-2 py-1 text-[13px] text-gray-800 outline-none focus:ring-1 focus:ring-indigo-300"})})]})]})}function dle(){return g.jsx(tB,{children:g.jsx(ule,{})})}var Sk={exports:{}};var iA;function fle(){return iA||(iA=1,(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var a="",i=0;i<arguments.length;i++){var s=arguments[i];s&&(a=o(a,r(s)))}return a}function r(a){if(typeof a=="string"||typeof a=="number")return a;if(typeof a!="object")return"";if(Array.isArray(a))return n.apply(null,a);if(a.toString!==Object.prototype.toString&&!a.toString.toString().includes("[native code]"))return a.toString();var i="";for(var s in a)t.call(a,s)&&a[s]&&(i=o(i,s));return i}function o(a,i){return i?a?a+" "+i:a+i:a}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Sk)),Sk.exports}var hle=fle();const ke=Ol(hle);function et(){return et=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},et.apply(null,arguments)}function nn(e){"@babel/helpers - typeof";return nn=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},nn(e)}var ple=Symbol.for("react.element"),mle=Symbol.for("react.transitional.element"),gle=Symbol.for("react.fragment");function JB(e){return e&&nn(e)==="object"&&(e.$$typeof===ple||e.$$typeof===mle)&&e.type===gle}function el(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=[];return _e.Children.forEach(e,function(r){r==null&&!t.keepEmpty||(Array.isArray(r)?n=n.concat(el(r)):JB(r)&&r.props?n=n.concat(el(r.props.children,t)):n.push(r))}),n}var KM={},vle=function(t){};function yle(e,t){}function ble(e,t){}function xle(){KM={}}function ZB(e,t,n){!t&&!KM[n]&&(e(!1,n),KM[n]=!0)}function Qr(e,t){ZB(yle,e,t)}function wle(e,t){ZB(ble,e,t)}Qr.preMessage=vle;Qr.resetWarned=xle;Qr.noteOnce=wle;function Cle(e,t){if(nn(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(nn(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function QB(e){var t=Cle(e,"string");return nn(t)=="symbol"?t:t+""}function ue(e,t,n){return(t=QB(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function pe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?sA(Object(n),!0).forEach(function(r){ue(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sA(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ax(e){return e instanceof HTMLElement||e instanceof SVGElement}function HN(e){return e&&nn(e)==="object"&&Ax(e.nativeElement)?e.nativeElement:Ax(e)?e:null}function s2(e){var t=HN(e);if(t)return t;if(e instanceof _e.Component){var n;return(n=Mv.findDOMNode)===null||n===void 0?void 0:n.call(Mv,e)}return null}var Ek={exports:{}},ro={};var lA;function Sle(){if(lA)return ro;lA=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),i=Symbol.for("react.context"),s=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),v=Symbol.for("react.offscreen"),b;b=Symbol.for("react.module.reference");function x(y){if(typeof y=="object"&&y!==null){var S=y.$$typeof;switch(S){case e:switch(y=y.type,y){case n:case o:case r:case c:case d:return y;default:switch(y=y&&y.$$typeof,y){case s:case i:case l:case p:case f:case a:return y;default:return S}}case t:return S}}}return ro.ContextConsumer=i,ro.ContextProvider=a,ro.Element=e,ro.ForwardRef=l,ro.Fragment=n,ro.Lazy=p,ro.Memo=f,ro.Portal=t,ro.Profiler=o,ro.StrictMode=r,ro.Suspense=c,ro.SuspenseList=d,ro.isAsyncMode=function(){return!1},ro.isConcurrentMode=function(){return!1},ro.isContextConsumer=function(y){return x(y)===i},ro.isContextProvider=function(y){return x(y)===a},ro.isElement=function(y){return typeof y=="object"&&y!==null&&y.$$typeof===e},ro.isForwardRef=function(y){return x(y)===l},ro.isFragment=function(y){return x(y)===n},ro.isLazy=function(y){return x(y)===p},ro.isMemo=function(y){return x(y)===f},ro.isPortal=function(y){return x(y)===t},ro.isProfiler=function(y){return x(y)===o},ro.isStrictMode=function(y){return x(y)===r},ro.isSuspense=function(y){return x(y)===c},ro.isSuspenseList=function(y){return x(y)===d},ro.isValidElementType=function(y){return typeof y=="string"||typeof y=="function"||y===n||y===o||y===r||y===c||y===d||y===v||typeof y=="object"&&y!==null&&(y.$$typeof===p||y.$$typeof===f||y.$$typeof===a||y.$$typeof===i||y.$$typeof===l||y.$$typeof===b||y.getModuleId!==void 0)},ro.typeOf=x,ro}var cA;function Ele(){return cA||(cA=1,Ek.exports=Sle()),Ek.exports}var Nk=Ele();function od(e,t,n){var r=h.useRef({});return(!("value"in r.current)||n(r.current.condition,t))&&(r.current.value=e(),r.current.condition=t),r.current.value}var Nle=Number(h.version.split(".")[0]),Px=function(t,n){typeof t=="function"?t(n):nn(t)==="object"&&t&&"current"in t&&(t.current=n)},Zi=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=n.filter(Boolean);return o.length<=1?o[0]:function(a){n.forEach(function(i){Px(i,a)})}},cd=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return od(function(){return Zi.apply(void 0,n)},n,function(o,a){return o.length!==a.length||o.every(function(i,s){return i!==a[s]})})},cu=function(t){var n,r;if(!t)return!1;if(ZT(t)&&Nle>=19)return!0;var o=Nk.isMemo(t)?t.type.type:t.type;return!(typeof o=="function"&&!((n=o.prototype)!==null&&n!==void 0&&n.render)&&o.$$typeof!==Nk.ForwardRef||typeof t=="function"&&!((r=t.prototype)!==null&&r!==void 0&&r.render)&&t.$$typeof!==Nk.ForwardRef)};function ZT(e){return h.isValidElement(e)&&!JB(e)}var $le=function(t){return ZT(t)&&cu(t)},rm=function(t){if(t&&ZT(t)){var n=t;return n.props.propertyIsEnumerable("ref")?n.props.ref:n.ref}return null},YM=h.createContext(null);function _le(e){var t=e.children,n=e.onBatchResize,r=h.useRef(0),o=h.useRef([]),a=h.useContext(YM),i=h.useCallback(function(s,l,c){r.current+=1;var d=r.current;o.current.push({size:s,element:l,data:c}),Promise.resolve().then(function(){d===r.current&&(n?.(o.current),o.current=[])}),a?.(s,l,c)},[n,a]);return h.createElement(YM.Provider,{value:i},t)}var eH=(function(){if(typeof Map<"u")return Map;function e(t,n){var r=-1;return t.some(function(o,a){return o[0]===n?(r=a,!0):!1}),r}return(function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(n){var r=e(this.__entries__,n),o=this.__entries__[r];return o&&o[1]},t.prototype.set=function(n,r){var o=e(this.__entries__,n);~o?this.__entries__[o][1]=r:this.__entries__.push([n,r])},t.prototype.delete=function(n){var r=this.__entries__,o=e(r,n);~o&&r.splice(o,1)},t.prototype.has=function(n){return!!~e(this.__entries__,n)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(n,r){r===void 0&&(r=null);for(var o=0,a=this.__entries__;o<a.length;o++){var i=a[o];n.call(r,i[1],i[0])}},t})()})(),GM=typeof window<"u"&&typeof document<"u"&&window.document===document,eE=(function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()})(),kle=(function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(eE):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}})(),Ole=2;function Mle(e,t){var n=!1,r=!1,o=0;function a(){n&&(n=!1,e()),r&&s()}function i(){kle(a)}function s(){var l=Date.now();if(n){if(l-o<Ole)return;r=!0}else n=!0,r=!1,setTimeout(i,t);o=l}return s}var Rle=20,jle=["top","right","bottom","left","width","height","size","weight"],Tle=typeof MutationObserver<"u",Ile=(function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=Mle(this.refresh.bind(this),Rle)}return e.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},e.prototype.removeObserver=function(t){var n=this.observers_,r=n.indexOf(t);~r&&n.splice(r,1),!n.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){var t=this.updateObservers_();t&&this.refresh()},e.prototype.updateObservers_=function(){var t=this.observers_.filter(function(n){return n.gatherActive(),n.hasActive()});return t.forEach(function(n){return n.broadcastActive()}),t.length>0},e.prototype.connect_=function(){!GM||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),Tle?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!GM||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var n=t.propertyName,r=n===void 0?"":n,o=jle.some(function(a){return!!~r.indexOf(a)});o&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e})(),tH=(function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];Object.defineProperty(e,o,{value:t[o],enumerable:!1,writable:!1,configurable:!0})}return e}),Pv=(function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||eE}),nH=VN(0,0,0,0);function tE(e){return parseFloat(e)||0}function uA(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce(function(r,o){var a=e["border-"+o+"-width"];return r+tE(a)},0)}function Dle(e){for(var t=["top","right","bottom","left"],n={},r=0,o=t;r<o.length;r++){var a=o[r],i=e["padding-"+a];n[a]=tE(i)}return n}function Ale(e){var t=e.getBBox();return VN(0,0,t.width,t.height)}function Ple(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return nH;var r=Pv(e).getComputedStyle(e),o=Dle(r),a=o.left+o.right,i=o.top+o.bottom,s=tE(r.width),l=tE(r.height);if(r.boxSizing==="border-box"&&(Math.round(s+a)!==t&&(s-=uA(r,"left","right")+a),Math.round(l+i)!==n&&(l-=uA(r,"top","bottom")+i)),!zle(e)){var c=Math.round(s+a)-t,d=Math.round(l+i)-n;Math.abs(c)!==1&&(s-=c),Math.abs(d)!==1&&(l-=d)}return VN(o.left,o.top,s,l)}var Lle=(function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof Pv(e).SVGGraphicsElement}:function(e){return e instanceof Pv(e).SVGElement&&typeof e.getBBox=="function"}})();function zle(e){return e===Pv(e).document.documentElement}function Fle(e){return GM?Lle(e)?Ale(e):Ple(e):nH}function Ble(e){var t=e.x,n=e.y,r=e.width,o=e.height,a=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,i=Object.create(a.prototype);return tH(i,{x:t,y:n,width:r,height:o,top:n,right:t+r,bottom:o+n,left:t}),i}function VN(e,t,n,r){return{x:e,y:t,width:n,height:r}}var Hle=(function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=VN(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=Fle(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},e})(),Vle=(function(){function e(t,n){var r=Ble(n);tH(this,{target:t,contentRect:r})}return e})(),Ule=(function(){function e(t,n,r){if(this.activeObservations_=[],this.observations_=new eH,typeof t!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=n,this.callbackCtx_=r}return e.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof Pv(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)||(n.set(t,new Hle(t)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof Pv(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)&&(n.delete(t),n.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&t.activeObservations_.push(n)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,n=this.activeObservations_.map(function(r){return new Vle(r.target,r.broadcastRect())});this.callback_.call(t,n,t),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e})(),rH=typeof WeakMap<"u"?new WeakMap:new eH,oH=(function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=Ile.getInstance(),r=new Ule(t,n,this);rH.set(this,r)}return e})();["observe","unobserve","disconnect"].forEach(function(e){oH.prototype[e]=function(){var t;return(t=rH.get(this))[e].apply(t,arguments)}});var Wle=(function(){return typeof eE.ResizeObserver<"u"?eE.ResizeObserver:oH})(),_f=new Map;function qle(e){e.forEach(function(t){var n,r=t.target;(n=_f.get(r))===null||n===void 0||n.forEach(function(o){return o(r)})})}var aH=new Wle(qle);function Kle(e,t){_f.has(e)||(_f.set(e,new Set),aH.observe(e)),_f.get(e).add(t)}function Yle(e,t){_f.has(e)&&(_f.get(e).delete(t),_f.get(e).size||(aH.unobserve(e),_f.delete(e)))}function mo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dA(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,QB(r.key),r)}}function go(e,t,n){return t&&dA(e.prototype,t),n&&dA(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Lx(e,t){return Lx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Lx(e,t)}function Ml(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Lx(e,t)}function zx(e){return zx=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},zx(e)}function QT(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(QT=function(){return!!e})()}function Gt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Gle(e,t){if(t&&(nn(t)=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Gt(e)}function Rl(e){var t=QT();return function(){var n,r=zx(e);if(t){var o=zx(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Gle(this,n)}}var Xle=(function(e){Ml(n,e);var t=Rl(n);function n(){return mo(this,n),t.apply(this,arguments)}return go(n,[{key:"render",value:function(){return this.props.children}}]),n})(h.Component);function Jle(e,t){var n=e.children,r=e.disabled,o=h.useRef(null),a=h.useRef(null),i=h.useContext(YM),s=typeof n=="function",l=s?n(o):n,c=h.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),d=!s&&h.isValidElement(l)&&cu(l),f=d?rm(l):null,p=cd(f,o),v=function(){var S;return s2(o.current)||(o.current&&nn(o.current)==="object"?s2((S=o.current)===null||S===void 0?void 0:S.nativeElement):null)||s2(a.current)};h.useImperativeHandle(t,function(){return v()});var b=h.useRef(e);b.current=e;var x=h.useCallback(function(y){var S=b.current,N=S.onResize,E=S.data,$=y.getBoundingClientRect(),k=$.width,M=$.height,j=y.offsetWidth,I=y.offsetHeight,R=Math.floor(k),F=Math.floor(M);if(c.current.width!==R||c.current.height!==F||c.current.offsetWidth!==j||c.current.offsetHeight!==I){var L={width:R,height:F,offsetWidth:j,offsetHeight:I};c.current=L;var V=j===Math.round(k)?k:j,z=I===Math.round(M)?M:I,T=pe(pe({},L),{},{offsetWidth:V,offsetHeight:z});i?.(T,y,E),N&&Promise.resolve().then(function(){N(T,y)})}},[]);return h.useEffect(function(){var y=v();return y&&!r&&Kle(y,x),function(){return Yle(y,x)}},[o.current,r]),h.createElement(Xle,{ref:a},d?h.cloneElement(l,{ref:p}):l)}var Zle=h.forwardRef(Jle),Qle="rc-observer-key";function ece(e,t){var n=e.children,r=typeof n=="function"?[n]:el(n);return r.map(function(o,a){var i=o?.key||"".concat(Qle,"-").concat(a);return h.createElement(Zle,et({},e,{key:i,ref:a===0?t:void 0}),o)})}var _s=h.forwardRef(ece);_s.Collection=_le;function XM(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function tce(e){if(Array.isArray(e))return XM(e)}function iH(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function UN(e,t){if(e){if(typeof e=="string")return XM(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?XM(e,t):void 0}}function nce(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
25
25
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function it(e){return tce(e)||iH(e)||UN(e)||nce()}var sH=function(t){return+setTimeout(t,16)},lH=function(t){return clearTimeout(t)};typeof window<"u"&&"requestAnimationFrame"in window&&(sH=function(t){return window.requestAnimationFrame(t)},lH=function(t){return window.cancelAnimationFrame(t)});var fA=0,e3=new Map;function cH(e){e3.delete(e)}var cr=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;fA+=1;var r=fA;function o(a){if(a===0)cH(r),t();else{var i=sH(function(){o(a-1)});e3.set(r,i)}}return o(n),r};cr.cancel=function(e){var t=e3.get(e);return cH(e),lH(t)};function uH(e){if(Array.isArray(e))return e}function rce(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,a,i,s=[],l=!0,c=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(d){c=!0,o=d}finally{try{if(!l&&n.return!=null&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw o}}return s}}function dH(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
26
26
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ne(e,t){return uH(e)||rce(e,t)||UN(e,t)||dH()}function Fx(e){for(var t=0,n,r=0,o=e.length;o>=4;++r,o-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(o){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}function Pa(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function JM(e,t){if(!e)return!1;if(e.contains)return e.contains(t);for(var n=t;n;){if(n===e)return!0;n=n.parentNode}return!1}var hA="data-rc-order",pA="data-rc-priority",oce="rc-util-key",ZM=new Map;function fH(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.mark;return t?t.startsWith("data-")?t:"data-".concat(t):oce}function WN(e){if(e.attachTo)return e.attachTo;var t=document.querySelector("head");return t||document.body}function ace(e){return e==="queue"?"prependQueue":e?"prepend":"append"}function t3(e){return Array.from((ZM.get(e)||e).children).filter(function(t){return t.tagName==="STYLE"})}function hH(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Pa())return null;var n=t.csp,r=t.prepend,o=t.priority,a=o===void 0?0:o,i=ace(r),s=i==="prependQueue",l=document.createElement("style");l.setAttribute(hA,i),s&&a&&l.setAttribute(pA,"".concat(a)),n!=null&&n.nonce&&(l.nonce=n?.nonce),l.innerHTML=e;var c=WN(t),d=c.firstChild;if(r){if(s){var f=(t.styles||t3(c)).filter(function(p){if(!["prepend","prependQueue"].includes(p.getAttribute(hA)))return!1;var v=Number(p.getAttribute(pA)||0);return a>=v});if(f.length)return c.insertBefore(l,f[f.length-1].nextSibling),l}c.insertBefore(l,d)}else c.appendChild(l);return l}function pH(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=WN(t);return(t.styles||t3(n)).find(function(r){return r.getAttribute(fH(t))===e})}function Bx(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=pH(e,t);if(n){var r=WN(t);r.removeChild(n)}}function ice(e,t){var n=ZM.get(e);if(!n||!JM(document,n)){var r=hH("",t),o=r.parentNode;ZM.set(e,o),e.removeChild(r)}}function Qu(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=WN(n),o=t3(r),a=pe(pe({},n),{},{styles:o});ice(r,a);var i=pH(t,a);if(i){var s,l;if((s=a.csp)!==null&&s!==void 0&&s.nonce&&i.nonce!==((l=a.csp)===null||l===void 0?void 0:l.nonce)){var c;i.nonce=(c=a.csp)===null||c===void 0?void 0:c.nonce}return i.innerHTML!==e&&(i.innerHTML=e),i}var d=hH(e,a);return d.setAttribute(fH(a),t),d}function sce(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function mn(e,t){if(e==null)return{};var n,r,o=sce(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function mc(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=new Set;function o(a,i){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,l=r.has(a);if(Qr(!l,"Warning: There may be circular references"),l)return!1;if(a===i)return!0;if(n&&s>1)return!1;r.add(a);var c=s+1;if(Array.isArray(a)){if(!Array.isArray(i)||a.length!==i.length)return!1;for(var d=0;d<a.length;d++)if(!o(a[d],i[d],c))return!1;return!0}if(a&&i&&nn(a)==="object"&&nn(i)==="object"){var f=Object.keys(a);return f.length!==Object.keys(i).length?!1:f.every(function(p){return o(a[p],i[p],c)})}return!1}return o(e,t)}var lce="%";function QM(e){return e.join(lce)}var cce=(function(){function e(t){mo(this,e),ue(this,"instanceId",void 0),ue(this,"cache",new Map),ue(this,"extracted",new Set),this.instanceId=t}return go(e,[{key:"get",value:function(n){return this.opGet(QM(n))}},{key:"opGet",value:function(n){return this.cache.get(n)||null}},{key:"update",value:function(n,r){return this.opUpdate(QM(n),r)}},{key:"opUpdate",value:function(n,r){var o=this.cache.get(n),a=r(o);a===null?this.cache.delete(n):this.cache.set(n,a)}}]),e})(),Lv="data-token-hash",lc="data-css-hash",kf="__cssinjs_instance__";function uce(){var e=Math.random().toString(12).slice(2);if(typeof document<"u"&&document.head&&document.body){var t=document.body.querySelectorAll("style[".concat(lc,"]"))||[],n=document.head.firstChild;Array.from(t).forEach(function(o){o[kf]=o[kf]||e,o[kf]===e&&document.head.insertBefore(o,n)});var r={};Array.from(document.querySelectorAll("style[".concat(lc,"]"))).forEach(function(o){var a=o.getAttribute(lc);if(r[a]){if(o[kf]===e){var i;(i=o.parentNode)===null||i===void 0||i.removeChild(o)}}else r[a]=!0})}return new cce(e)}var N1=h.createContext({hashPriority:"low",cache:uce(),defaultCache:!0});function dce(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}var n3=(function(){function e(){mo(this,e),ue(this,"cache",void 0),ue(this,"keys",void 0),ue(this,"cacheCallTimes",void 0),this.cache=new Map,this.keys=[],this.cacheCallTimes=0}return go(e,[{key:"size",value:function(){return this.keys.length}},{key:"internalGet",value:function(n){var r,o,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i={map:this.cache};return n.forEach(function(s){if(!i)i=void 0;else{var l;i=(l=i)===null||l===void 0||(l=l.map)===null||l===void 0?void 0:l.get(s)}}),(r=i)!==null&&r!==void 0&&r.value&&a&&(i.value[1]=this.cacheCallTimes++),(o=i)===null||o===void 0?void 0:o.value}},{key:"get",value:function(n){var r;return(r=this.internalGet(n,!0))===null||r===void 0?void 0:r[0]}},{key:"has",value:function(n){return!!this.internalGet(n)}},{key:"set",value:function(n,r){var o=this;if(!this.has(n)){if(this.size()+1>e.MAX_CACHE_SIZE+e.MAX_CACHE_OFFSET){var a=this.keys.reduce(function(c,d){var f=Ne(c,2),p=f[1];return o.internalGet(d)[1]<p?[d,o.internalGet(d)[1]]:c},[this.keys[0],this.cacheCallTimes]),i=Ne(a,1),s=i[0];this.delete(s)}this.keys.push(n)}var l=this.cache;n.forEach(function(c,d){if(d===n.length-1)l.set(c,{value:[r,o.cacheCallTimes++]});else{var f=l.get(c);f?f.map||(f.map=new Map):l.set(c,{map:new Map}),l=l.get(c).map}})}},{key:"deleteByPath",value:function(n,r){var o=n.get(r[0]);if(r.length===1){var a;return o.map?n.set(r[0],{map:o.map}):n.delete(r[0]),(a=o.value)===null||a===void 0?void 0:a[0]}var i=this.deleteByPath(o.map,r.slice(1));return(!o.map||o.map.size===0)&&!o.value&&n.delete(r[0]),i}},{key:"delete",value:function(n){if(this.has(n))return this.keys=this.keys.filter(function(r){return!dce(r,n)}),this.deleteByPath(this.cache,n)}}]),e})();ue(n3,"MAX_CACHE_SIZE",20);ue(n3,"MAX_CACHE_OFFSET",5);var mA=0,mH=(function(){function e(t){mo(this,e),ue(this,"derivatives",void 0),ue(this,"id",void 0),this.derivatives=Array.isArray(t)?t:[t],this.id=mA,t.length===0&&(t.length>0,void 0),mA+=1}return go(e,[{key:"getDerivativeToken",value:function(n){return this.derivatives.reduce(function(r,o){return o(n,r)},void 0)}}]),e})(),$k=new n3;function eR(e){var t=Array.isArray(e)?e:[e];return $k.has(t)||$k.set(t,new mH(t)),$k.get(t)}var fce=new WeakMap,_k={};function hce(e,t){for(var n=fce,r=0;r<t.length;r+=1){var o=t[r];n.has(o)||n.set(o,new WeakMap),n=n.get(o)}return n.has(_k)||n.set(_k,e()),n.get(_k)}var gA=new WeakMap;function sx(e){var t=gA.get(e)||"";return t||(Object.keys(e).forEach(function(n){var r=e[n];t+=n,r instanceof mH?t+=r.id:r&&nn(r)==="object"?t+=sx(r):t+=r}),t=Fx(t),gA.set(e,t)),t}function vA(e,t){return Fx("".concat(t,"_").concat(sx(e)))}var tR=Pa();function De(e){return typeof e=="number"?"".concat(e,"px"):e}function nE(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(o)return e;var a=pe(pe({},r),{},ue(ue({},Lv,t),lc,n)),i=Object.keys(a).map(function(s){var l=a[s];return l?"".concat(s,'="').concat(l,'"'):null}).filter(function(s){return s}).join(" ");return"<style ".concat(i,">").concat(e,"</style>")}var l2=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return"--".concat(n?"".concat(n,"-"):"").concat(t).replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z0-9]+)/g,"$1-$2").replace(/([a-z])([A-Z0-9])/g,"$1-$2").toLowerCase()},pce=function(t,n,r){return Object.keys(t).length?".".concat(n).concat(r!=null&&r.scope?".".concat(r.scope):"","{").concat(Object.entries(t).map(function(o){var a=Ne(o,2),i=a[0],s=a[1];return"".concat(i,":").concat(s,";")}).join(""),"}"):""},gH=function(t,n,r){var o={},a={};return Object.entries(t).forEach(function(i){var s,l,c=Ne(i,2),d=c[0],f=c[1];if(r!=null&&(s=r.preserve)!==null&&s!==void 0&&s[d])a[d]=f;else if((typeof f=="string"||typeof f=="number")&&!(r!=null&&(l=r.ignore)!==null&&l!==void 0&&l[d])){var p,v=l2(d,r?.prefix);o[v]=typeof f=="number"&&!(r!=null&&(p=r.unitless)!==null&&p!==void 0&&p[d])?"".concat(f,"px"):String(f),a[d]="var(".concat(v,")")}}),[a,pce(o,n,{scope:r?.scope})]},yA=Pa()?h.useLayoutEffect:h.useEffect,or=function(t,n){var r=h.useRef(!0);yA(function(){return t(r.current)},n),yA(function(){return r.current=!1,function(){r.current=!0}},[])},nR=function(t,n){or(function(r){if(!r)return t()},n)},mce=pe({},bN),bA=mce.useInsertionEffect,gce=function(t,n,r){h.useMemo(t,r),or(function(){return n(!0)},r)},vce=bA?function(e,t,n){return bA(function(){return e(),t()},n)}:gce,yce=pe({},bN),bce=yce.useInsertionEffect,xce=function(t){var n=[],r=!1;function o(a){r||n.push(a)}return h.useEffect(function(){return r=!1,function(){r=!0,n.length&&n.forEach(function(a){return a()})}},t),o},wce=function(){return function(t){t()}},Cce=typeof bce<"u"?xce:wce;function r3(e,t,n,r,o){var a=h.useContext(N1),i=a.cache,s=[e].concat(it(t)),l=QM(s),c=Cce([l]),d=function(b){i.opUpdate(l,function(x){var y=x||[void 0,void 0],S=Ne(y,2),N=S[0],E=N===void 0?0:N,$=S[1],k=$,M=k||n(),j=[E,M];return b?b(j):j})};h.useMemo(function(){d()},[l]);var f=i.opGet(l),p=f[1];return vce(function(){o?.(p)},function(v){return d(function(b){var x=Ne(b,2),y=x[0],S=x[1];return v&&y===0&&o?.(p),[y+1,S]}),function(){i.opUpdate(l,function(b){var x=b||[],y=Ne(x,2),S=y[0],N=S===void 0?0:S,E=y[1],$=N-1;return $===0?(c(function(){(v||!i.opGet(l))&&r?.(E,!1)}),null):[N-1,E]})}},[l]),p}var Sce={},Ece="css",fp=new Map;function Nce(e){fp.set(e,(fp.get(e)||0)+1)}function $ce(e,t){if(typeof document<"u"){var n=document.querySelectorAll("style[".concat(Lv,'="').concat(e,'"]'));n.forEach(function(r){if(r[kf]===t){var o;(o=r.parentNode)===null||o===void 0||o.removeChild(r)}})}}var _ce=0;function kce(e,t){fp.set(e,(fp.get(e)||0)-1);var n=new Set;fp.forEach(function(r,o){r<=0&&n.add(o)}),fp.size-n.size>_ce&&n.forEach(function(r){$ce(r,t),fp.delete(r)})}var Oce=function(t,n,r,o){var a=r.getDerivativeToken(t),i=pe(pe({},a),n);return o&&(i=o(i)),i},vH="token";function Mce(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=h.useContext(N1),o=r.cache.instanceId,a=r.container,i=n.salt,s=i===void 0?"":i,l=n.override,c=l===void 0?Sce:l,d=n.formatToken,f=n.getComputedToken,p=n.cssVar,v=hce(function(){return Object.assign.apply(Object,[{}].concat(it(t)))},t),b=sx(v),x=sx(c),y=p?sx(p):"",S=r3(vH,[s,e.id,b,x,y],function(){var N,E=f?f(v,c,e):Oce(v,c,e,d),$=pe({},E),k="";if(p){var M=gH(E,p.key,{prefix:p.prefix,ignore:p.ignore,unitless:p.unitless,preserve:p.preserve}),j=Ne(M,2);E=j[0],k=j[1]}var I=vA(E,s);E._tokenKey=I,$._tokenKey=vA($,s);var R=(N=p?.key)!==null&&N!==void 0?N:I;E._themeKey=R,Nce(R);var F="".concat(Ece,"-").concat(Fx(I));return E._hashId=F,[E,F,$,k,p?.key||""]},function(N){kce(N[0]._themeKey,o)},function(N){var E=Ne(N,4),$=E[0],k=E[3];if(p&&k){var M=Qu(k,Fx("css-variables-".concat($._themeKey)),{mark:lc,prepend:"queue",attachTo:a,priority:-999});M[kf]=o,M.setAttribute(Lv,$._themeKey)}});return S}var Rce=function(t,n,r){var o=Ne(t,5),a=o[2],i=o[3],s=o[4],l=r||{},c=l.plain;if(!i)return null;var d=a._tokenKey,f=-999,p={"data-rc-order":"prependQueue","data-rc-priority":"".concat(f)},v=nE(i,s,d,p,c);return[f,d,v]},jce={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},yH="comm",bH="rule",xH="decl",Tce="@import",Ice="@namespace",Dce="@keyframes",Ace="@layer",wH=Math.abs,o3=String.fromCharCode;function CH(e){return e.trim()}function c2(e,t,n){return e.replace(t,n)}function Pce(e,t,n){return e.indexOf(t,n)}function mv(e,t){return e.charCodeAt(t)|0}function zv(e,t,n){return e.slice(t,n)}function ru(e){return e.length}function Lce(e){return e.length}function hS(e,t){return t.push(e),e}var qN=1,Fv=1,SH=0,kl=0,ma=0,r0="";function a3(e,t,n,r,o,a,i,s){return{value:e,root:t,parent:n,type:r,props:o,children:a,line:qN,column:Fv,length:i,return:"",siblings:s}}function zce(){return ma}function Fce(){return ma=kl>0?mv(r0,--kl):0,Fv--,ma===10&&(Fv=1,qN--),ma}function cc(){return ma=kl<SH?mv(r0,kl++):0,Fv++,ma===10&&(Fv=1,qN++),ma}function Of(){return mv(r0,kl)}function u2(){return kl}function KN(e,t){return zv(r0,e,t)}function Hx(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Bce(e){return qN=Fv=1,SH=ru(r0=e),kl=0,[]}function Hce(e){return r0="",e}function kk(e){return CH(KN(kl-1,rR(e===91?e+2:e===40?e+1:e)))}function Vce(e){for(;(ma=Of())&&ma<33;)cc();return Hx(e)>2||Hx(ma)>3?"":" "}function Uce(e,t){for(;--t&&cc()&&!(ma<48||ma>102||ma>57&&ma<65||ma>70&&ma<97););return KN(e,u2()+(t<6&&Of()==32&&cc()==32))}function rR(e){for(;cc();)switch(ma){case e:return kl;case 34:case 39:e!==34&&e!==39&&rR(ma);break;case 40:e===41&&rR(e);break;case 92:cc();break}return kl}function Wce(e,t){for(;cc()&&e+ma!==57;)if(e+ma===84&&Of()===47)break;return"/*"+KN(t,kl-1)+"*"+o3(e===47?e:cc())}function qce(e){for(;!Hx(Of());)cc();return KN(e,kl)}function Kce(e){return Hce(d2("",null,null,null,[""],e=Bce(e),0,[0],e))}function d2(e,t,n,r,o,a,i,s,l){for(var c=0,d=0,f=i,p=0,v=0,b=0,x=1,y=1,S=1,N=0,E="",$=o,k=a,M=r,j=E;y;)switch(b=N,N=cc()){case 40:if(b!=108&&mv(j,f-1)==58){Pce(j+=c2(kk(N),"&","&\f"),"&\f",wH(c?s[c-1]:0))!=-1&&(S=-1);break}case 34:case 39:case 91:j+=kk(N);break;case 9:case 10:case 13:case 32:j+=Vce(b);break;case 92:j+=Uce(u2()-1,7);continue;case 47:switch(Of()){case 42:case 47:hS(Yce(Wce(cc(),u2()),t,n,l),l),(Hx(b||1)==5||Hx(Of()||1)==5)&&ru(j)&&zv(j,-1,void 0)!==" "&&(j+=" ");break;default:j+="/"}break;case 123*x:s[c++]=ru(j)*S;case 125*x:case 59:case 0:switch(N){case 0:case 125:y=0;case 59+d:S==-1&&(j=c2(j,/\f/g,"")),v>0&&(ru(j)-f||x===0&&b===47)&&hS(v>32?wA(j+";",r,n,f-1,l):wA(c2(j," ","")+";",r,n,f-2,l),l);break;case 59:j+=";";default:if(hS(M=xA(j,t,n,c,d,o,s,E,$=[],k=[],f,a),a),N===123)if(d===0)d2(j,t,M,M,$,a,f,s,k);else{switch(p){case 99:if(mv(j,3)===110)break;case 108:if(mv(j,2)===97)break;default:d=0;case 100:case 109:case 115:}d?d2(e,M,M,r&&hS(xA(e,M,M,0,0,o,s,E,o,$=[],f,k),k),o,k,f,s,r?$:k):d2(j,M,M,M,[""],k,0,s,k)}}c=d=v=0,x=S=1,E=j="",f=i;break;case 58:f=1+ru(j),v=b;default:if(x<1){if(N==123)--x;else if(N==125&&x++==0&&Fce()==125)continue}switch(j+=o3(N),N*x){case 38:S=d>0?1:(j+="\f",-1);break;case 44:s[c++]=(ru(j)-1)*S,S=1;break;case 64:Of()===45&&(j+=kk(cc())),p=Of(),d=f=ru(E=j+=qce(u2())),N++;break;case 45:b===45&&ru(j)==2&&(x=0)}}return a}function xA(e,t,n,r,o,a,i,s,l,c,d,f){for(var p=o-1,v=o===0?a:[""],b=Lce(v),x=0,y=0,S=0;x<r;++x)for(var N=0,E=zv(e,p+1,p=wH(y=i[x])),$=e;N<b;++N)($=CH(y>0?v[N]+" "+E:c2(E,/&\f/g,v[N])))&&(l[S++]=$);return a3(e,t,n,o===0?bH:s,l,c,d,f)}function Yce(e,t,n,r){return a3(e,t,n,yH,o3(zce()),zv(e,2,-2),0,r)}function wA(e,t,n,r,o){return a3(e,t,n,xH,zv(e,0,r),zv(e,r+1,-1),r,o)}function oR(e,t){for(var n="",r=0;r<e.length;r++)n+=t(e[r],r,e,t)||"";return n}function Gce(e,t,n,r){switch(e.type){case Ace:if(e.children.length)break;case Tce:case Ice:case xH:return e.return=e.return||e.value;case yH:return"";case Dce:return e.return=e.value+"{"+oR(e.children,r)+"}";case bH:if(!ru(e.value=e.props.join(",")))return""}return ru(n=oR(e.children,r))?e.return=e.value+"{"+n+"}":""}var CA="data-ant-cssinjs-cache-path",EH="_FILE_STYLE__",Op,NH=!0;function Xce(){if(!Op&&(Op={},Pa())){var e=document.createElement("div");e.className=CA,e.style.position="fixed",e.style.visibility="hidden",e.style.top="-9999px",document.body.appendChild(e);var t=getComputedStyle(e).content||"";t=t.replace(/^"/,"").replace(/"$/,""),t.split(";").forEach(function(o){var a=o.split(":"),i=Ne(a,2),s=i[0],l=i[1];Op[s]=l});var n=document.querySelector("style[".concat(CA,"]"));if(n){var r;NH=!1,(r=n.parentNode)===null||r===void 0||r.removeChild(n)}document.body.removeChild(e)}}function Jce(e){return Xce(),!!Op[e]}function Zce(e){var t=Op[e],n=null;if(t&&Pa())if(NH)n=EH;else{var r=document.querySelector("style[".concat(lc,'="').concat(Op[e],'"]'));r?n=r.innerHTML:delete Op[e]}return[n,t]}var Qce="_skip_check_",$H="_multi_value_";function f2(e){var t=oR(Kce(e),Gce);return t.replace(/\{%%%\:[^;];}/g,";")}function eue(e){return nn(e)==="object"&&e&&(Qce in e||$H in e)}function SA(e,t,n){if(!t)return e;var r=".".concat(t),o=n==="low"?":where(".concat(r,")"):r,a=e.split(",").map(function(i){var s,l=i.trim().split(/\s+/),c=l[0]||"",d=((s=c.match(/^\w+/))===null||s===void 0?void 0:s[0])||"";return c="".concat(d).concat(o).concat(c.slice(d.length)),[c].concat(it(l.slice(1))).join(" ")});return a.join(",")}var tue=function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{root:!0,parentSelectors:[]},o=r.root,a=r.injectHash,i=r.parentSelectors,s=n.hashId,l=n.layer;n.path;var c=n.hashPriority,d=n.transformers,f=d===void 0?[]:d;n.linters;var p="",v={};function b(S){var N=S.getName(s);if(!v[N]){var E=e(S.style,n,{root:!1,parentSelectors:i}),$=Ne(E,1),k=$[0];v[N]="@keyframes ".concat(S.getName(s)).concat(k)}}function x(S){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return S.forEach(function(E){Array.isArray(E)?x(E,N):E&&N.push(E)}),N}var y=x(Array.isArray(t)?t:[t]);return y.forEach(function(S){var N=typeof S=="string"&&!o?{}:S;if(typeof N=="string")p+="".concat(N,`
|
|
27
27
|
`);else if(N._keyframe)b(N);else{var E=f.reduce(function($,k){var M;return(k==null||(M=k.visit)===null||M===void 0?void 0:M.call(k,$))||$},N);Object.keys(E).forEach(function($){var k=E[$];if(nn(k)==="object"&&k&&($!=="animationName"||!k._keyframe)&&!eue(k)){var M=!1,j=$.trim(),I=!1;(o||a)&&s?j.startsWith("@")?M=!0:j==="&"?j=SA("",s,c):j=SA($,s,c):o&&!s&&(j==="&"||j==="")&&(j="",I=!0);var R=e(k,n,{root:I,injectHash:M,parentSelectors:[].concat(it(i),[j])}),F=Ne(R,2),L=F[0],V=F[1];v=pe(pe({},v),V),p+="".concat(j).concat(L)}else{let P=function(D,H){var W=D.replace(/[A-Z]/g,function(Y){return"-".concat(Y.toLowerCase())}),Z=H;!jce[D]&&typeof Z=="number"&&Z!==0&&(Z="".concat(Z,"px")),D==="animationName"&&H!==null&&H!==void 0&&H._keyframe&&(b(H),Z=H.getName(s)),p+="".concat(W,":").concat(Z,";")};var z,T=(z=k?.value)!==null&&z!==void 0?z:k;nn(k)==="object"&&k!==null&&k!==void 0&&k[$H]&&Array.isArray(T)?T.forEach(function(D){P($,D)}):P($,T)}})}}),o?l&&(p&&(p="@layer ".concat(l.name," {").concat(p,"}")),l.dependencies&&(v["@layer ".concat(l.name)]=l.dependencies.map(function(S){return"@layer ".concat(S,", ").concat(l.name,";")}).join(`
|
|
@@ -505,6 +505,7 @@ ${e}`}const GL=["添加一个审批步骤在填写和结束之间","金额大于
|
|
|
505
505
|
- 支持比较运算符: ==, !=, >, <, >=, <=
|
|
506
506
|
- 支持逻辑运算符: &&, ||, !
|
|
507
507
|
- 公式内字段名直接写,不加 \${} 嵌套。正确: "\${RMB(amount)}",错误: "\${RMB(\${amount})}"
|
|
508
|
+
- ⚠️ 子表字段引用:在主表公式中对子表的子字段使用聚合函数时,直接使用子字段名,不需要加子表名前缀。正确: "\${SUM(amount)}",错误: "\${SUM(items.amount)}"。系统会自动从子表中提取该列进行聚合。
|
|
508
509
|
|
|
509
510
|
## 可用函数(完整列表,只能使用以下函数,禁止使用 Excel 函数或 JavaScript 方法)
|
|
510
511
|
|
|
@@ -563,7 +564,8 @@ ${e.length>0?e.map(n=>`- ${n.label}(字段名: ${n.name}, 类型: ${n.type})
|
|
|
563
564
|
- 条件判断: \${IF(分数 >= 60, "及格", "不及格")}
|
|
564
565
|
- 混合文本: 总金额: \${SUM(金额1, 金额2)} 元
|
|
565
566
|
- 人民币大写: \${RMB(总金额)}
|
|
566
|
-
- 日期差: \${IF(AND(开始日期, 结束日期), DATEDIF(开始日期, 结束日期, "d") + 1, 0)}
|
|
567
|
+
- 日期差: \${IF(AND(开始日期, 结束日期), DATEDIF(开始日期, 结束日期, "d") + 1, 0)}
|
|
568
|
+
- 子表字段求和(直接用子字段名,不加子表名前缀): \${SUM(unit_price)}`}const DMe=["求多个字段的合计","数量 × 单价,保留2位小数","根据条件显示不同文本","将金额转为人民币大写"];function AMe({value:e,onChange:t,fieldId:n}){const r=It($=>$.fields),o=h.useRef(null),[a,i]=h.useState(!1),[s,l]=h.useState(!0),[c,d]=h.useState(!0),[f,p]=h.useState({聚合:!0,数学:!0,逻辑:!0,文本:!0}),v=h.useMemo(()=>TMe(r,n),[r,n]),b=h.useMemo(()=>IMe(v),[v]),x=h.useCallback($=>{const k=o.current;if(!k){t(e+$);return}const M=k.selectionStart,j=k.selectionEnd,I=e.substring(0,M),R=e.substring(j),F=I+$+R;t(F),requestAnimationFrame(()=>{k.focus();const L=M+$.length;k.setSelectionRange(L,L)})},[e,t]),y=h.useCallback($=>{x($)},[x]),S=h.useCallback($=>{const k=o.current,M=k?k.selectionStart:e.length,j=k?k.selectionEnd:e.length,I=e.substring(M,j);if(I){const R=`${$.name}(${I})`,F=e.substring(0,M),L=e.substring(j);t(F+R+L),requestAnimationFrame(()=>{if(k){k.focus();const V=M+R.length;k.setSelectionRange(V,V)}})}else{const R=`${$.name}()`;x(R),requestAnimationFrame(()=>{if(k){k.focus();const F=M+$.name.length+1;k.setSelectionRange(F,F)}})}},[e,t,x]),N=$=>{p(k=>({...k,[$]:!k[$]}))},E=g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx("div",{className:"flex-1 min-w-0",children:g.jsx("textarea",{value:e,onChange:$=>t($.target.value),rows:3,className:"w-full border border-gray-200 rounded-md px-2.5 py-1.5 text-[13px] font-mono outline-none focus:border-indigo-400 focus:ring-1 focus:ring-indigo-200 smooth-transition resize-none",placeholder:"${SUM(qty1, qty2) * price}",spellCheck:!1})}),g.jsx("button",{onClick:()=>i(!0),className:"flex-shrink-0 rounded p-1 text-gray-400 hover:text-indigo-600 hover:bg-indigo-50 smooth-transition",title:"展开公式编辑器",children:g.jsx(IN,{className:"w-3.5 h-3.5"})})]});return g.jsxs(g.Fragment,{children:[E,g.jsx(aa,{open:a,onCancel:()=>i(!1),title:g.jsxs("div",{className:"flex items-center gap-2 text-[13px] font-semibold text-indigo-700",children:[g.jsx(G2,{className:"w-4 h-4"}),"公式编辑器"]}),footer:g.jsx("button",{onClick:()=>i(!1),className:"rounded-md bg-indigo-600 px-4 py-1.5 text-[13px] font-medium text-white hover:bg-indigo-700 smooth-transition",children:"完成"}),width:1060,centered:!0,destroyOnClose:!0,styles:{body:{height:"60vh",overflow:"hidden",padding:0}},children:g.jsxs("div",{className:"flex h-full overflow-hidden",children:[g.jsxs("div",{className:"w-52 flex-shrink-0 border-r border-gray-100 overflow-y-auto bg-gray-50/50",children:[g.jsxs("button",{onClick:()=>d(!c),className:"w-full flex items-center gap-1.5 px-3 py-2.5 text-[12px] font-semibold text-gray-600 hover:bg-gray-100 smooth-transition",children:[c?g.jsx(Cs,{className:"w-3.5 h-3.5"}):g.jsx(dv,{className:"w-3.5 h-3.5"}),g.jsx(G2,{className:"w-3.5 h-3.5"}),"公式函数"]}),c&&g.jsx("div",{className:"px-2 pb-2",children:jMe.map($=>g.jsxs("div",{className:"mb-1",children:[g.jsxs("button",{onClick:()=>N($.label),className:"w-full flex items-center gap-1 px-2 py-1 rounded text-[11px] font-medium text-gray-500 hover:bg-gray-100 smooth-transition",children:[f[$.label]?g.jsx(Cs,{className:"w-3 h-3"}):g.jsx(dv,{className:"w-3 h-3"}),$.label]}),f[$.label]&&g.jsx("div",{className:"space-y-0.5 ml-1",children:$.fns.map(k=>g.jsxs("button",{type:"button",onClick:()=>S(k),className:"w-full text-left px-2.5 py-1.5 rounded text-[12px] hover:bg-amber-50 hover:text-amber-700 smooth-transition group",title:`${k.desc}
|
|
567
569
|
用法: ${k.example}`,children:[g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"font-mono font-medium text-amber-600",children:k.name}),g.jsxs("span",{className:"text-[10px] text-gray-400 truncate",children:["(",k.args,")"]})]}),g.jsx("p",{className:"text-[10px] text-gray-400 group-hover:text-amber-500 truncate",children:k.desc})]},k.name))})]},$.label))})]}),g.jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative",children:[g.jsx("textarea",{ref:o,value:e,onChange:$=>t($.target.value),className:"flex-1 w-full px-4 py-3 text-[14px] font-mono outline-none resize-none border-none bg-white leading-relaxed",placeholder:`输入公式..
|
|
568
570
|
|
|
569
571
|
纯文本直接输入,公式用 \${} 包裹
|
|
@@ -899,7 +901,7 @@ if (!rows || rows.length === 0) {
|
|
|
899
901
|
form.message.error('请至少添加一行明细');
|
|
900
902
|
return false;
|
|
901
903
|
}
|
|
902
|
-
\`\`\``}const cPe=["设置某个字段的默认值为当前日期","根据条件隐藏某些字段","从API获取数据并填充字段","初始化子表默认行"],uPe=["根据字段值联动显示/隐藏其他字段","当某个字段变化时自动计算另一个字段","级联下拉:选择后动态加载子选项","子表行变化时汇总到主表字段"],dPe=["校验某些字段不能为空","校验数值范围是否合法","提交前调用外部API验证","校验子表至少有一行数据"],fPe=()=>{const{formName:e,formDescription:t,nameFormula:n,setFormName:r,setFormDescription:o,fields:a,loadForm:i,toJSON:s}=It(),l=It(We=>We.formTitle),c=It(We=>We.formId),d=It(We=>We.setFormId),f=It(We=>We.viewMode),p=It(We=>We.tableColumns),v=It(We=>We.tableTitleColor),b=It(We=>We.tableBorderColor),x=It(We=>We.tableShowOuterBorder),y=It(We=>We.formEvents),S=h.useMemo(()=>aPe(a),[a]),N=h.useMemo(()=>iPe(S),[S]),E=h.useMemo(()=>sPe(S),[S]),$=h.useMemo(()=>lPe(S),[S]),k=It(We=>We.setFormEvents),M=It(We=>We.selectField),j=It(We=>We.selectedFieldId),I=It(We=>We.setFlowSteps),R=yN(We=>We.saveVersion),F=yN(We=>We.loadVersions),L=Ix(We=>We.saveVersion),V=Ix(We=>We.loadVersions),z=Bb(We=>We.backups),T=Bb(We=>We.loadBackups),P=Bb(We=>We.createBackup),D=Bb(We=>We.fetchBackup),H=Bb(We=>We.removeBackup),W=It(We=>We.isDirty),Z=It(We=>We.markClean),Y=It(We=>We.canUndo),A=It(We=>We.canRedo),K=It(We=>We.undo),Q=It(We=>We.redo);h.useEffect(()=>{const We=mt=>{(mt.metaKey||mt.ctrlKey)&&(mt.key==="z"&&!mt.shiftKey?(mt.preventDefault(),K()):(mt.key==="z"&&mt.shiftKey||mt.key==="y")&&(mt.preventDefault(),Q()))};return window.addEventListener("keydown",We),()=>window.removeEventListener("keydown",We)},[K,Q]);const G=h.useRef(null),[J,X]=h.useState(!1),[ee,te]=h.useState(!1),[ne,le]=h.useState(""),[ae,ie]=h.useState(!1),[de,fe]=h.useState(null),[ce,oe]=h.useState(null),[me,Ee]=h.useState(!1),[je,Fe]=h.useState(""),[$e,Ae]=h.useState(""),[Te,Me]=h.useState([]),[Ze,Je]=h.useState(""),[Re,ge]=h.useState(!1),we=h.useRef(null),[Oe,ye]=h.useState(""),[ve,Ve]=h.useState(null),[Ce,Ie]=h.useState(""),[Pe,He]=h.useState(!1),[Ke,Ye]=h.useState(""),[rt,lt]=h.useState(""),[pt,zt]=h.useState([]),[Pt,Ot]=h.useState(""),[Dt,rn]=h.useState(!1),fn=h.useRef(null),[_t,Wt]=h.useState(!0),[Xt,Be]=h.useState(!1),[Le,Xe]=h.useState(!1),[ot,wt]=h.useState(null),[Mt,Jt]=h.useState(!0),[bt,gt]=h.useState(!1),[Tt,ln]=h.useState(""),[gn,Sn]=h.useState(""),[sn,Bt]=h.useState(""),[dn,ht]=h.useState(""),[kt,Vt]=h.useState(!1),[St,Ft]=h.useState(!1),[jn,qn]=h.useState(!1),[Kn,on]=h.useState(null),an=h.useRef(null),bn=h.useCallback(We=>{const mt=an.current;if(mt&&document.activeElement===mt.element){const Et=mt.element,At=Et.selectionStart??0,Ut=Et.selectionEnd??0,wn=y[mt.eventKey]||"",cn=wn.substring(0,At)+We+wn.substring(Ut);k({...y,[mt.eventKey]:cn}),requestAnimationFrame(()=>{Et.focus(),Et.selectionStart=Et.selectionEnd=At+We.length})}else navigator.clipboard.writeText(We);on(We),setTimeout(()=>on(null),1e3)},[y,k]),[hr,ur]=h.useState(!1),[wr,Yr]=h.useState(!1),[pr,gr]=h.useState("desktop"),[Pr,yo]=h.useState(!1),[Lr,Fn]=h.useState(""),[en,Qt]=h.useState(!1),[On,qt]=h.useState(""),Zt=h.useRef(void 0),[Nn,tr]=h.useState(null),[En,Gr]=h.useState(null),[_r,ao]=h.useState(!1);h.useEffect(()=>{we.current?.scrollIntoView({behavior:"smooth"})},[Ze]),h.useEffect(()=>{fn.current?.scrollIntoView({behavior:"smooth"})},[Pt]);const xn=h.useCallback((We,mt="info")=>{Zt.current&&clearTimeout(Zt.current),fe({message:We,type:mt}),Zt.current=setTimeout(()=>fe(null),mt==="error"?4e3:2500)},[]);h.useEffect(()=>{Z2()&&GB().then(ie);const mt=new URLSearchParams(window.location.search).get("flowId");!mt||!Z2()||(te(!0),le(""),YB(mt).then(Et=>{const{form:At,flow:Ut}=Et;if(Ut&&(Fn(Ut.name||""),I(Ut.current?.steps||[]),Gr(Ut)),At&&(tr(At),d(At._id),r(At.name||""),o(At.description||""),T(At._id),At.current?.fields)){const wn=At.current.fields;if(At.current?.version!=="v2")oe({rawFields:wn});else{const un=At.current?.events||{};i({_id:At._id,name:At.name||"",description:At.description||"",nameFormula:At.current?.name_forumla||"",formTitle:At.current?.formTitle||"",fields:wn,events:un,tableTitleColor:At.current?.tableTitleColor||"",tableBorderColor:At.current?.tableBorderColor||"#000000",tableShowOuterBorder:At.current?.tableShowOuterBorder!==!1}),F(At._id),R(At._id,wn,un,"服务器加载","init")}}}).catch(Et=>{le(Et?.response?.data?.message||Et?.message||"加载失败")}).finally(()=>{te(!1)}))},[]);const Rt=async()=>{if(!c||!Nn){R(c,a,y,"本地保存","manual"),xn("已保存到本地版本(未连接服务器)","info");return}X(!0);try{const We=a.map(Et=>{const At=Et,Ut=At.serverField||{};return{...Ut,...Et,fields:Et.type==="table"?Et.children:null,code:Et.name,name:Et.name,label:Et.label,type:Ut.type||Et.type,is_required:Et.required,is_wide:(Et.colspan||6)>=12,is_list_display:At.is_list_display??Ut.is_list_display,is_searchable:At.is_searchable??Ut.is_searchable,is_multiselect:At.is_multiselect??Ut.is_multiselect,description:Et.description||Ut.description||""}}),mt={...Nn,id:Nn._id,name:e,description:t,current:{...Nn.current,version:"v2",viewMode:f,tableColumns:p,fields:We,events:y,name_forumla:n,formTitle:l||void 0,tableTitleColor:v||void 0,tableBorderColor:b!=="#000000"?b:void 0,tableShowOuterBorder:x===!1?!1:void 0}};if(delete mt._id,await GD(mt),_r&&En)try{const Et=(En.current?.steps||[]).map(Ut=>{const wn={...Ut,id:Ut._id||Ut.id};return delete wn._id,wn.lines&&(wn.lines=wn.lines.map(cn=>{const un={...cn,id:cn._id||cn.id};return delete un._id,un})),wn}),At={...En,id:En._id,current:{...En.current,steps:Et},upgraded:!0};delete At._id,await WM(At),ao(!1)}catch(Et){console.warn("Failed to save flow data:",Et),xn("表单已保存,但流程数据保存失败: "+(Et?.message||"未知错误"),"error")}R(c,a,y,"手动保存","manual"),Z(),xn("保存成功","success")}catch(We){xn("保存失败: "+(We?.response?.data?.message||We?.response?.data||We?.message||"未知错误"),"error")}finally{X(!1)}},Kt=(We,mt)=>{const Et={},At={},Ut=cn=>{for(const un of cn){const vr=un.code||un.name,dr=un.name||un.label||un.code||"";vr&&(At[dr]||(At[dr]=[]),At[dr].push(un),vr!==dr&&(At[vr]||(At[vr]=[]),At[vr].push(un))),un.type==="table"&&Array.isArray(un.fields)&&Ut(un.fields),un.type==="section"&&Array.isArray(un.fields)&&Ut(un.fields),un.type==="grid"&&Array.isArray(un.fields)&&Ut(un.fields)}};Ut(We);const wn=cn=>{for(const un of cn){const vr=un.name,dr=un.label||un.name||"";if(vr&&dr&&At[dr])for(const So of At[dr]){const Io=So.code||So.name;Io&&Io!==vr&&(Et[Io]=vr),So._id&&So._id!==vr&&(Et[So._id]=vr)}un.type==="table"&&Array.isArray(un.children)&&wn(un.children),un.type==="section"&&Array.isArray(un.children)&&wn(un.children),un.type==="grid"&&Array.isArray(un.children)&&wn(un.children)}};return wn(mt),Et},Bn=(We,mt)=>{if(!We||!Array.isArray(We))return We;const Et=()=>{const cn=()=>Math.floor(Math.random()*4294967295).toString(16).padStart(8,"0");return cn()+cn()+cn()},At=cn=>cn.replace(/\{([^}]+)\}/g,(un,vr)=>mt[vr]?`{${mt[vr]}}`:un),Ut=cn=>Array.isArray(cn)?cn.map(un=>un.condition&&typeof un.condition=="string"?{...un,condition:At(un.condition)}:un):cn,wn=Object.keys(mt).length===0;return We.map(cn=>{const un=cn._id||Et();if(wn)return cn._id?cn:{...cn,_id:un};let vr=cn.permissions;if(cn.permissions&&typeof cn.permissions=="object"){vr={};for(const[Fa,S0]of Object.entries(cn.permissions)){const Vo=mt[Fa]||Fa;vr[Vo]=S0}}const dr=cn.lines?Ut(cn.lines):cn.lines,So=cn.approver_user_field&&mt[cn.approver_user_field]||cn.approver_user_field,Io=cn.approver_org_field&&mt[cn.approver_org_field]||cn.approver_org_field;return{...cn,_id:un,permissions:vr,lines:dr,approver_user_field:So,approver_org_field:Io}})},mr=async(We,mt)=>{if(!En?.current?.steps)return En;const Et=Kt(We,mt),At=Bn(En.current.steps,Et),Ut={...En,current:{...En.current,steps:At}};return Gr(Ut),I(At),ao(!0),Ut},Ir=async(We,mt)=>{const Et=En?._id;if(!Et)return[];try{const At=await eA(Et);if(!At||At.length===0)return[];const Ut=Kt(We,mt);if(Object.keys(Ut).length===0)return At;const wn=cn=>{if(!cn||typeof cn!="string")return cn;if(cn.includes(".")&&!cn.startsWith("instance.")){const[un,vr]=cn.split(".",2),dr=Ut[un]||un,So=Ut[vr]||vr;return`${dr}.${So}`}return cn.startsWith("instance.")?cn:Ut[cn]||cn};for(const cn of At){let un=!1;const vr={};if(Array.isArray(cn.field_map)){const So=cn.field_map.map(Io=>{if(Io.workflow_field){const Fa=wn(Io.workflow_field);if(Fa!==Io.workflow_field)return un=!0,{...Io,workflow_field:Fa}}return Io});un&&(vr.field_map=So)}let dr=!1;if(Array.isArray(cn.field_map_back)){const So=cn.field_map_back.map(Io=>{if(Io.workflow_field){const Fa=wn(Io.workflow_field);if(Fa!==Io.workflow_field)return dr=!0,{...Io,workflow_field:Fa}}return Io});dr&&(vr.field_map_back=So)}(un||dr)&&await tA(cn._id,vr)}return At}catch(At){return console.warn("Failed to migrate object_workflows:",At),[]}},jr=(We,mt)=>{const Et=JSON.stringify(We,null,2);return["请将以下旧版表单字段完整升级为新版 v2 格式,要求如下:","1. 字段名称(name)使用英文小写字母+下划线的命名规范,不要使用中文或特殊字符;","2. 字段标签(label):优先以审批单模板(instance_template)中的实际显示文本为准,若模板中未出现则保留旧版字段的中文含义;","3. 字段类型(type)根据旧版类型进行合理映射,如 text、number、date、select、checkbox、table、formula、autoNumber 等;",'4. ⚠️ 凡是有公式/自动计算的字段,type 必须是 "formula"(不能是 "number"),formula 属性写公式表达式。同时必须设置 valueType 表示计算结果的值类型:算术运算/SUM/ROUND 等结果为数字时设 "number"(默认),CONCAT/RMB/TEXT 等返回文本时设 "string",DATE/TODAY 等返回日期时设 "date"。如果 valueType 为 "number",用 precision 控制小数位数。"number" 类型仅用于用户手工输入数字的字段(无公式)。错误:{ type: "number", formula: "${a+b}" },正确:{ type: "formula", formula: "${a+b}", valueType: "number", precision: 2 }。grid/table 的 children 子字段同样适用此规则;','4.1 自动编号字段迁移:旧版中 default_value 包含 auto_number(...) 的字段,必须转为 type: "autoNumber"(只读字段,运行时自动生成编号),删除原 default_value,合理配置 autoNumberPrefix、autoNumberPadding(默认4)、autoNumberDateFormat(默认"YYYYMM")、autoNumberResetCycle(默认"monthly") 等属性;',"5. 子表字段(table)的子字段同样按以上规范处理;","6. 可见性规则(visibilityRules)中的 field 引用需更新为新版对应的字段 name;","7. 下拉选项(options)保留,格式为 [{label,value}];","8. 请输出所有字段,不要遗漏,也不要添加原来没有的字段。","9. 新版已不再支持 instance_template(审批单模板)、form_script(表单脚本)、flow_events(流程事件),请分析这些旧版数据中的业务逻辑,将其功能迁移到新版的 events(onInit / onValueChange / onSubmit)、字段的 visibilityRules、requiredRules、formula、min/max 等新版机制中实现。迁移时声明式字段配置优先(如 number 字段的 max 属性替代提交校验脚本),脚本兜底。不要在输出中返回 instance_template、form_script、flow_events 字段。","10. 字段布局是升级的核心目标,新版显示效果必须尽可能精确还原旧版审批单模板的视觉布局:"," - 首先统计模板 HTML 表格展开所有 colspan 后的实际最大总列数(包含标签列和数据列),然后选择布局方案:"," - ⭐ **优先使用【复杂表格布局】(grid 网格字段)**。只有模板表格极其简单(总列数 ≤ 6 且无任何 rowspan/colspan)时才考虑简单布局。如果你不确定用哪个,请用 grid。"," - 【简单布局】仅适用于:模板表格总列数 ≤ 6、每行最多 3 个输入字段、且无任何 rowspan 或 colspan 合并。使用 tableColumns + tableColspan 方案。如果模板中出现任何 rowspan 或 colspan,则不得使用简单布局,必须使用 grid。",' - 【复杂表格布局(grid)】模板有 rowspan/colspan、或总列数 > 6、或有多级表头:必须使用 grid 网格字段。将 HTML 表格每个 td 映射为 cellType:"label" 或 cellType:"input",rowspan/colspan 直接映射。绝大多数审批单模板都应使用此方案。'," - 若模板无法判断 colspan 则按旧版 is_wide 属性决定(is_wide=true 为 tableColumns,否则为 1)",' - 模板中的分类标题(如“工程费用”“其他费用”):简单布局时转为 section 字段并设置合适的 colorScheme;复杂表格布局时作为 grid 中的 cellType:"label" 静态文本',' - 【列数精确匹配】grid 的 gridCols 必须等于 HTML 表格展开所有 colspan 后的实际最大列数,禁止合并或删减列。如果表头"预算"或"决算"下方有多个子列,必须全部保留'," - 【单元格完整覆盖】gridData 的每行每列必须被覆盖(有 gridData 条目或被其他单元格的 rowspan/colspan 覆盖),不允许空洞。如果某列在表头有 colspan=2,数据行只需 1 列内容时也要设 colspan=2","11. 动态必填规则(requiredRules)中的 field 引用同样需更新为新版对应的字段 name;",'12. 如果提供了 flow_events 或 form_script,必须在 migrationLog 数组中为每条被迁移的业务逻辑记录迁移去向(如"flow_events: 金额>=500万校验 → 字段 xxx 的 max 属性"),不允许静默丢弃任何逻辑。','13. 旧公式中的跨对象引用(如 {applicant.organization.name}、{applicant.name} 等引用成员关联属性的公式):新版不再支持公式跨对象引用,应将此类公式字段改为普通文本字段(type: "text",readonly: true),并在成员字段(type: "member")上配置 pickerFillRules 填充规则,sourceField 使用点号表示法(如 "organization.name"),targetField 指向该文本字段。示例:旧公式 {applicant.organization.name} → 创建 text 字段 dept_name,成员字段配置 pickerFillRules: [{ "sourceField": "organization.name", "targetField": "dept_name" }]。','14. 如果提供了旧版标题公式(name_forumla),需要将其中的 {旧字段名} 引用更新为 {新版字段name},输出到 nameFormula 字段。例如旧版 "{申请人} 的 {类型} 申请" 转为 "{applicant_name} 的 {request_type} 申请"。公式中纯文本部分保持不变。','15. 日期/时间字段默认值迁移:旧版中 default_value 为 "{now}" 的字段,根据字段类型转换为新版动态 token——date 类型转为 "__TODAY__",datetime 类型转为 "__NOW__",time 类型转为 "__CURRENT_TIME__"。旧版 default_value 为 "{applicant.name}" 或 "{applicant}" 等引用当前用户的成员字段,转为 "__CURRENT_USER__"。旧版引用当前部门的,转为 "__CURRENT_USER_ORG__"。',`16. lookup 字段过滤条件迁移:旧版 filters 可能是 OData 格式的字符串(如 "((enablestate eq '2') and (hidden ne true))"),必须转换为 DevExpress JSON 数组格式。转换规则:eq → "=",ne → "<>",contains → "contains",startswith → "startswith",endswith → "endswith",gt → ">",ge → ">=",lt → "<",le → "<="。单条件格式:["field", "=", "value"];多条件 AND 格式:[["field1", "=", "val1"], "and", ["field2", "<>", "val2"]];多条件 OR 格式:[["field1", "=", "val1"], "or", ["field2", "=", "val2"]]。布尔值不加引号(如 true/false),字符串值保持引号。将转换后的 JSON 字符串设置到 lookupFilters 属性。`,'17. lookup 字段的 lookupDisplayFields 数组必须始终包含 lookupLabelField 的值(默认为 "name")。如果 lookupDisplayFields 未指定,默认为 ["name"]。',...mt?.trim()?["",`补充要求:${mt.trim()}`]:[],"","旧版字段数据(JSON):",Et].join(`
|
|
904
|
+
\`\`\``}const cPe=["设置某个字段的默认值为当前日期","根据条件隐藏某些字段","从API获取数据并填充字段","初始化子表默认行"],uPe=["根据字段值联动显示/隐藏其他字段","当某个字段变化时自动计算另一个字段","级联下拉:选择后动态加载子选项","子表行变化时汇总到主表字段"],dPe=["校验某些字段不能为空","校验数值范围是否合法","提交前调用外部API验证","校验子表至少有一行数据"],fPe=()=>{const{formName:e,formDescription:t,nameFormula:n,setFormName:r,setFormDescription:o,fields:a,loadForm:i,toJSON:s}=It(),l=It(We=>We.formTitle),c=It(We=>We.formId),d=It(We=>We.setFormId),f=It(We=>We.viewMode),p=It(We=>We.tableColumns),v=It(We=>We.tableTitleColor),b=It(We=>We.tableBorderColor),x=It(We=>We.tableShowOuterBorder),y=It(We=>We.formEvents),S=h.useMemo(()=>aPe(a),[a]),N=h.useMemo(()=>iPe(S),[S]),E=h.useMemo(()=>sPe(S),[S]),$=h.useMemo(()=>lPe(S),[S]),k=It(We=>We.setFormEvents),M=It(We=>We.selectField),j=It(We=>We.selectedFieldId),I=It(We=>We.setFlowSteps),R=yN(We=>We.saveVersion),F=yN(We=>We.loadVersions),L=Ix(We=>We.saveVersion),V=Ix(We=>We.loadVersions),z=Bb(We=>We.backups),T=Bb(We=>We.loadBackups),P=Bb(We=>We.createBackup),D=Bb(We=>We.fetchBackup),H=Bb(We=>We.removeBackup),W=It(We=>We.isDirty),Z=It(We=>We.markClean),Y=It(We=>We.canUndo),A=It(We=>We.canRedo),K=It(We=>We.undo),Q=It(We=>We.redo);h.useEffect(()=>{const We=mt=>{(mt.metaKey||mt.ctrlKey)&&(mt.key==="z"&&!mt.shiftKey?(mt.preventDefault(),K()):(mt.key==="z"&&mt.shiftKey||mt.key==="y")&&(mt.preventDefault(),Q()))};return window.addEventListener("keydown",We),()=>window.removeEventListener("keydown",We)},[K,Q]);const G=h.useRef(null),[J,X]=h.useState(!1),[ee,te]=h.useState(!1),[ne,le]=h.useState(""),[ae,ie]=h.useState(!1),[de,fe]=h.useState(null),[ce,oe]=h.useState(null),[me,Ee]=h.useState(!1),[je,Fe]=h.useState(""),[$e,Ae]=h.useState(""),[Te,Me]=h.useState([]),[Ze,Je]=h.useState(""),[Re,ge]=h.useState(!1),we=h.useRef(null),[Oe,ye]=h.useState(""),[ve,Ve]=h.useState(null),[Ce,Ie]=h.useState(""),[Pe,He]=h.useState(!1),[Ke,Ye]=h.useState(""),[rt,lt]=h.useState(""),[pt,zt]=h.useState([]),[Pt,Ot]=h.useState(""),[Dt,rn]=h.useState(!1),fn=h.useRef(null),[_t,Wt]=h.useState(!0),[Xt,Be]=h.useState(!1),[Le,Xe]=h.useState(!1),[ot,wt]=h.useState(null),[Mt,Jt]=h.useState(!0),[bt,gt]=h.useState(!1),[Tt,ln]=h.useState(""),[gn,Sn]=h.useState(""),[sn,Bt]=h.useState(""),[dn,ht]=h.useState(""),[kt,Vt]=h.useState(!1),[St,Ft]=h.useState(!1),[jn,qn]=h.useState(!1),[Kn,on]=h.useState(null),an=h.useRef(null),bn=h.useCallback(We=>{const mt=an.current;if(mt&&document.activeElement===mt.element){const Et=mt.element,At=Et.selectionStart??0,Ut=Et.selectionEnd??0,wn=y[mt.eventKey]||"",cn=wn.substring(0,At)+We+wn.substring(Ut);k({...y,[mt.eventKey]:cn}),requestAnimationFrame(()=>{Et.focus(),Et.selectionStart=Et.selectionEnd=At+We.length})}else navigator.clipboard.writeText(We);on(We),setTimeout(()=>on(null),1e3)},[y,k]),[hr,ur]=h.useState(!1),[wr,Yr]=h.useState(!1),[pr,gr]=h.useState("desktop"),[Pr,yo]=h.useState(!1),[Lr,Fn]=h.useState(""),[en,Qt]=h.useState(!1),[On,qt]=h.useState(""),Zt=h.useRef(void 0),[Nn,tr]=h.useState(null),[En,Gr]=h.useState(null),[_r,ao]=h.useState(!1);h.useEffect(()=>{we.current?.scrollIntoView({behavior:"smooth"})},[Ze]),h.useEffect(()=>{fn.current?.scrollIntoView({behavior:"smooth"})},[Pt]);const xn=h.useCallback((We,mt="info")=>{Zt.current&&clearTimeout(Zt.current),fe({message:We,type:mt}),Zt.current=setTimeout(()=>fe(null),mt==="error"?4e3:2500)},[]);h.useEffect(()=>{Z2()&&GB().then(ie);const mt=new URLSearchParams(window.location.search).get("flowId");!mt||!Z2()||(te(!0),le(""),YB(mt).then(Et=>{const{form:At,flow:Ut}=Et;if(Ut&&(Fn(Ut.name||""),I(Ut.current?.steps||[]),Gr(Ut)),At&&(tr(At),d(At._id),r(At.name||""),o(At.description||""),T(At._id),At.current?.fields)){const wn=At.current.fields;if(At.current?.version!=="v2")oe({rawFields:wn});else{const un=At.current?.events||{};i({_id:At._id,name:At.name||"",description:At.description||"",nameFormula:At.current?.name_forumla||"",formTitle:At.current?.formTitle||"",fields:wn,events:un,tableTitleColor:At.current?.tableTitleColor||"",tableBorderColor:At.current?.tableBorderColor||"#000000",tableShowOuterBorder:At.current?.tableShowOuterBorder!==!1}),F(At._id),R(At._id,wn,un,"服务器加载","init")}}}).catch(Et=>{le(Et?.response?.data?.message||Et?.message||"加载失败")}).finally(()=>{te(!1)}))},[]);const Rt=async()=>{if(!c||!Nn){R(c,a,y,"本地保存","manual"),xn("已保存到本地版本(未连接服务器)","info");return}X(!0);try{const We=a.map(Et=>{const At=Et,Ut=At.serverField||{};return{...Ut,...Et,fields:Et.type==="table"?Et.children:null,code:Et.name,name:Et.name,label:Et.label,type:Ut.type||Et.type,is_required:Et.required,is_wide:(Et.colspan||6)>=12,is_list_display:At.is_list_display??Ut.is_list_display,is_searchable:At.is_searchable??Ut.is_searchable,is_multiselect:At.is_multiselect??Ut.is_multiselect,description:Et.description||Ut.description||""}}),mt={...Nn,id:Nn._id,name:e,description:t,current:{...Nn.current,version:"v2",viewMode:f,tableColumns:p,fields:We,events:y,name_forumla:n,formTitle:l||void 0,tableTitleColor:v||void 0,tableBorderColor:b!=="#000000"?b:void 0,tableShowOuterBorder:x===!1?!1:void 0}};if(delete mt._id,await GD(mt),_r&&En)try{const Et=(En.current?.steps||[]).map(Ut=>{const wn={...Ut,id:Ut._id||Ut.id};return delete wn._id,wn.lines&&(wn.lines=wn.lines.map(cn=>{const un={...cn,id:cn._id||cn.id};return delete un._id,un})),wn}),At={...En,id:En._id,current:{...En.current,steps:Et},upgraded:!0};delete At._id,await WM(At),ao(!1)}catch(Et){console.warn("Failed to save flow data:",Et),xn("表单已保存,但流程数据保存失败: "+(Et?.message||"未知错误"),"error")}R(c,a,y,"手动保存","manual"),Z(),xn("保存成功","success")}catch(We){xn("保存失败: "+(We?.response?.data?.message||We?.response?.data||We?.message||"未知错误"),"error")}finally{X(!1)}},Kt=(We,mt)=>{const Et={},At={},Ut=cn=>{for(const un of cn){const vr=un.code||un.name,dr=un.name||un.label||un.code||"";vr&&(At[dr]||(At[dr]=[]),At[dr].push(un),vr!==dr&&(At[vr]||(At[vr]=[]),At[vr].push(un))),un.type==="table"&&Array.isArray(un.fields)&&Ut(un.fields),un.type==="section"&&Array.isArray(un.fields)&&Ut(un.fields),un.type==="grid"&&Array.isArray(un.fields)&&Ut(un.fields)}};Ut(We);const wn=cn=>{for(const un of cn){const vr=un.name,dr=un.label||un.name||"";if(vr&&dr&&At[dr])for(const So of At[dr]){const Io=So.code||So.name;Io&&Io!==vr&&(Et[Io]=vr),So._id&&So._id!==vr&&(Et[So._id]=vr)}un.type==="table"&&Array.isArray(un.children)&&wn(un.children),un.type==="section"&&Array.isArray(un.children)&&wn(un.children),un.type==="grid"&&Array.isArray(un.children)&&wn(un.children)}};return wn(mt),Et},Bn=(We,mt)=>{if(!We||!Array.isArray(We))return We;const Et=()=>{const cn=()=>Math.floor(Math.random()*4294967295).toString(16).padStart(8,"0");return cn()+cn()+cn()},At=cn=>cn.replace(/\{([^}]+)\}/g,(un,vr)=>mt[vr]?`{${mt[vr]}}`:un),Ut=cn=>Array.isArray(cn)?cn.map(un=>un.condition&&typeof un.condition=="string"?{...un,condition:At(un.condition)}:un):cn,wn=Object.keys(mt).length===0;return We.map(cn=>{const un=cn._id||Et();if(wn)return cn._id?cn:{...cn,_id:un};let vr=cn.permissions;if(cn.permissions&&typeof cn.permissions=="object"){vr={};for(const[Fa,S0]of Object.entries(cn.permissions)){const Vo=mt[Fa]||Fa;vr[Vo]=S0}}const dr=cn.lines?Ut(cn.lines):cn.lines,So=cn.approver_user_field&&mt[cn.approver_user_field]||cn.approver_user_field,Io=cn.approver_org_field&&mt[cn.approver_org_field]||cn.approver_org_field;return{...cn,_id:un,permissions:vr,lines:dr,approver_user_field:So,approver_org_field:Io}})},mr=async(We,mt)=>{if(!En?.current?.steps)return En;const Et=Kt(We,mt),At=Bn(En.current.steps,Et),Ut={...En,current:{...En.current,steps:At}};return Gr(Ut),I(At),ao(!0),Ut},Ir=async(We,mt)=>{const Et=En?._id;if(!Et)return[];try{const At=await eA(Et);if(!At||At.length===0)return[];const Ut=Kt(We,mt);if(Object.keys(Ut).length===0)return At;const wn=cn=>{if(!cn||typeof cn!="string")return cn;if(cn.includes(".")&&!cn.startsWith("instance.")){const[un,vr]=cn.split(".",2),dr=Ut[un]||un,So=Ut[vr]||vr;return`${dr}.${So}`}return cn.startsWith("instance.")?cn:Ut[cn]||cn};for(const cn of At){let un=!1;const vr={};if(Array.isArray(cn.field_map)){const So=cn.field_map.map(Io=>{if(Io.workflow_field){const Fa=wn(Io.workflow_field);if(Fa!==Io.workflow_field)return un=!0,{...Io,workflow_field:Fa}}return Io});un&&(vr.field_map=So)}let dr=!1;if(Array.isArray(cn.field_map_back)){const So=cn.field_map_back.map(Io=>{if(Io.workflow_field){const Fa=wn(Io.workflow_field);if(Fa!==Io.workflow_field)return dr=!0,{...Io,workflow_field:Fa}}return Io});dr&&(vr.field_map_back=So)}(un||dr)&&await tA(cn._id,vr)}return At}catch(At){return console.warn("Failed to migrate object_workflows:",At),[]}},jr=(We,mt)=>{const Et=JSON.stringify(We,null,2);return["请将以下旧版表单字段完整升级为新版 v2 格式,要求如下:","1. 字段名称(name)使用英文小写字母+下划线的命名规范,不要使用中文或特殊字符;","2. 字段标签(label):优先以审批单模板(instance_template)中的实际显示文本为准,若模板中未出现则保留旧版字段的中文含义;","3. 字段类型(type)根据旧版类型进行合理映射,如 text、number、date、select、checkbox、table、formula、autoNumber 等;",'4. ⚠️ 凡是有公式/自动计算的字段,type 必须是 "formula"(不能是 "number"),formula 属性写公式表达式。同时必须设置 valueType 表示计算结果的值类型:算术运算/SUM/ROUND 等结果为数字时设 "number"(默认),CONCAT/RMB/TEXT 等返回文本时设 "string",DATE/TODAY 等返回日期时设 "date"。如果 valueType 为 "number",用 precision 控制小数位数。"number" 类型仅用于用户手工输入数字的字段(无公式)。错误:{ type: "number", formula: "${a+b}" },正确:{ type: "formula", formula: "${a+b}", valueType: "number", precision: 2 }。grid/table 的 children 子字段同样适用此规则;','4.1 自动编号字段迁移:旧版中 default_value 包含 auto_number(...) 的字段,必须转为 type: "autoNumber"(只读字段,运行时自动生成编号),删除原 default_value,合理配置 autoNumberPrefix、autoNumberPadding(默认4)、autoNumberDateFormat(默认"YYYYMM")、autoNumberResetCycle(默认"monthly") 等属性;',"5. 子表字段(table)的子字段同样按以上规范处理;",'5.1 ⚠️ 子表字段引用规则:在主表公式中对子表(table)的子字段使用聚合函数时,直接使用子字段名,不需要加子表名前缀。系统会自动从子表数据中提取该列进行聚合。正确:${SUM(amount)}(amount 是子表的子字段名),错误:${SUM(items.amount)}(不要用 子表名.子字段名 的写法)。示例:子表 "items" 有子字段 "unit_price" 和 "quantity",主表求合计公式写 "${SUM(unit_price)}",不要写 "${SUM(items.unit_price)}";',"6. 可见性规则(visibilityRules)中的 field 引用需更新为新版对应的字段 name;","7. 下拉选项(options)保留,格式为 [{label,value}];","8. 请输出所有字段,不要遗漏,也不要添加原来没有的字段。","9. 新版已不再支持 instance_template(审批单模板)、form_script(表单脚本)、flow_events(流程事件),请分析这些旧版数据中的业务逻辑,将其功能迁移到新版的 events(onInit / onValueChange / onSubmit)、字段的 visibilityRules、requiredRules、formula、min/max 等新版机制中实现。迁移时声明式字段配置优先(如 number 字段的 max 属性替代提交校验脚本),脚本兜底。不要在输出中返回 instance_template、form_script、flow_events 字段。","10. 字段布局是升级的核心目标,新版显示效果必须尽可能精确还原旧版审批单模板的视觉布局:"," - 首先统计模板 HTML 表格展开所有 colspan 后的实际最大总列数(包含标签列和数据列),然后选择布局方案:"," - ⭐ **优先使用【复杂表格布局】(grid 网格字段)**。只有模板表格极其简单(总列数 ≤ 6 且无任何 rowspan/colspan)时才考虑简单布局。如果你不确定用哪个,请用 grid。"," - 【简单布局】仅适用于:模板表格总列数 ≤ 6、每行最多 3 个输入字段、且无任何 rowspan 或 colspan 合并。使用 tableColumns + tableColspan 方案。如果模板中出现任何 rowspan 或 colspan,则不得使用简单布局,必须使用 grid。",' - 【复杂表格布局(grid)】模板有 rowspan/colspan、或总列数 > 6、或有多级表头:必须使用 grid 网格字段。将 HTML 表格每个 td 映射为 cellType:"label" 或 cellType:"input",rowspan/colspan 直接映射。绝大多数审批单模板都应使用此方案。'," - 若模板无法判断 colspan 则按旧版 is_wide 属性决定(is_wide=true 为 tableColumns,否则为 1)",' - 模板中的分类标题(如“工程费用”“其他费用”):简单布局时转为 section 字段并设置合适的 colorScheme;复杂表格布局时作为 grid 中的 cellType:"label" 静态文本',' - 【列数精确匹配】grid 的 gridCols 必须等于 HTML 表格展开所有 colspan 后的实际最大列数,禁止合并或删减列。如果表头"预算"或"决算"下方有多个子列,必须全部保留'," - 【单元格完整覆盖】gridData 的每行每列必须被覆盖(有 gridData 条目或被其他单元格的 rowspan/colspan 覆盖),不允许空洞。如果某列在表头有 colspan=2,数据行只需 1 列内容时也要设 colspan=2","11. 动态必填规则(requiredRules)中的 field 引用同样需更新为新版对应的字段 name;",'12. 如果提供了 flow_events 或 form_script,必须在 migrationLog 数组中为每条被迁移的业务逻辑记录迁移去向(如"flow_events: 金额>=500万校验 → 字段 xxx 的 max 属性"),不允许静默丢弃任何逻辑。','13. 旧公式中的跨对象引用(如 {applicant.organization.name}、{applicant.name} 等引用成员关联属性的公式):新版不再支持公式跨对象引用,应将此类公式字段改为普通文本字段(type: "text",readonly: true),并在成员字段(type: "member")上配置 pickerFillRules 填充规则,sourceField 使用点号表示法(如 "organization.name"),targetField 指向该文本字段。示例:旧公式 {applicant.organization.name} → 创建 text 字段 dept_name,成员字段配置 pickerFillRules: [{ "sourceField": "organization.name", "targetField": "dept_name" }]。','14. 如果提供了旧版标题公式(name_forumla),需要将其中的 {旧字段名} 引用更新为 {新版字段name},输出到 nameFormula 字段。例如旧版 "{申请人} 的 {类型} 申请" 转为 "{applicant_name} 的 {request_type} 申请"。公式中纯文本部分保持不变。','15. 日期/时间字段默认值迁移:旧版中 default_value 为 "{now}" 的字段,根据字段类型转换为新版动态 token——date 类型转为 "__TODAY__",datetime 类型转为 "__NOW__",time 类型转为 "__CURRENT_TIME__"。旧版 default_value 为 "{applicant.name}" 或 "{applicant}" 等引用当前用户的成员字段,转为 "__CURRENT_USER__"。旧版引用当前部门的,转为 "__CURRENT_USER_ORG__"。',`16. lookup 字段过滤条件迁移:旧版 filters 可能是 OData 格式的字符串(如 "((enablestate eq '2') and (hidden ne true))"),必须转换为 DevExpress JSON 数组格式。转换规则:eq → "=",ne → "<>",contains → "contains",startswith → "startswith",endswith → "endswith",gt → ">",ge → ">=",lt → "<",le → "<="。单条件格式:["field", "=", "value"];多条件 AND 格式:[["field1", "=", "val1"], "and", ["field2", "<>", "val2"]];多条件 OR 格式:[["field1", "=", "val1"], "or", ["field2", "=", "val2"]]。布尔值不加引号(如 true/false),字符串值保持引号。将转换后的 JSON 字符串设置到 lookupFilters 属性。`,'17. lookup 字段的 lookupDisplayFields 数组必须始终包含 lookupLabelField 的值(默认为 "name")。如果 lookupDisplayFields 未指定,默认为 ["name"]。',...mt?.trim()?["",`补充要求:${mt.trim()}`]:[],"","旧版字段数据(JSON):",Et].join(`
|
|
903
905
|
`)},To=()=>{const We={},mt=En?.instance_template_backup||En?.instance_template;mt&&(We.instance_template=mt),Nn?.current?.form_script&&(We.form_script=Nn.current.form_script),En?.events&&(We.flow_events=typeof En.events=="string"?En.events:JSON.stringify(En.events));const Et=Nn?.current?.name_forumla;return Et&&(We.name_forumla=Et),Object.keys(We).length>0?We:void 0},Ho=async(We,mt)=>{if(We.events&&typeof We.events=="object"){const Ut={onInit:We.events.onInit||"",onValueChange:We.events.onValueChange||"",onSubmit:We.events.onSubmit||""};k(Ut)}const Et=mt||En;let At=!1;if(Et){const Ut={...Et};Ut.instance_template&&(Ut.instance_template="",At=!0),Ut.events&&(Ut.events="",At=!0),At&&(Gr(Ut),ao(!0))}if(Nn?.current?.form_script){const Ut={...Nn,current:{...Nn.current,form_script:""}};tr(Ut)}},Co=async()=>{if(ce){Ee(!0),Fe(""),Ae("正在准备..."),Me([]),Je(""),ge(!1);try{c&&(F(c),R(c,ce.rawFields,y||{},"AI 升级前备份(旧版表单)","auto")),En?._id&&En?.current?.steps&&(V(En._id),L(En._id,En.current.steps,"AI 升级前备份(旧版流程)","auto"));let We=[];if(En?._id)try{We=await eA(En._id)}catch(un){console.warn("Failed to fetch object_workflows for backup:",un)}c&&Nn&&await P({name:`AI 升级前备份 — ${e||c}`,formId:c,flowId:En?._id,backupType:"ai_upgrade",formSnapshot:Nn,flowSnapshot:En||void 0,objectWorkflowsSnapshot:We.length>0?We:void 0});const mt=jr(ce.rawFields,Oe),Et=To(),At=await Q2([],{},mt,void 0,Et,un=>{Ae({prepare:"准备中...",calling:"连接 AI...",streaming:"AI 生成中...",fallback:"切换请求...",parsing:"解析中...",validating:"校验中...",complete:"完成!"}[un.stage]||un.stage),un.stage!=="streaming"&&Me(dr=>[...dr,un.message]),un.accumulated&&Je(un.accumulated)});if(At?.error)throw new Error(At.error);if(!At?.fields||!Array.isArray(At.fields)||At.fields.length===0)throw new Error(At?.message||"AI 未返回有效字段数据");const Ut=Nn?.current?.name_forumla||"";let wn=At.nameFormula||"";if(!wn&&Ut){const un=Kt(ce.rawFields,At.fields);wn=Ut.replace(/\{([^}]+)\}/g,(vr,dr)=>un[dr]?`{${un[dr]}}`:`{${dr}}`)}i({_id:c||void 0,name:e,description:t,nameFormula:wn,fields:At.fields,tableColumns:typeof At.tableColumns=="number"?At.tableColumns:void 0}),c&&(F(c),R(c,At.fields,At.events||{},"版本升级(AI 转换)","init"));const cn=await mr(ce.rawFields,At.fields);await Ho(At,cn),await Ir(ce.rawFields,At.fields),Array.isArray(At.migrationLog)&&At.migrationLog.length>0&&Me(un=>[...un,"--- 旧版脚本迁移记录 ---",...At.migrationLog]),Ve(ce.rawFields),Ie(""),Ye(""),Wt(!0),oe(null),xn("表单已成功升级,请检查字段后点击「保存」按钮","success")}catch(We){const mt=We?.response?.data,Et=(typeof mt=="string"?mt:null)||mt?.error||mt?.message||(typeof mt=="object"?JSON.stringify(mt):null)||We?.message||"未知错误";Fe(Et)}finally{Ee(!1),Ae("")}}},sa=async()=>{if(ve){He(!0),Ye(""),lt("正在准备..."),zt([]),Ot(""),rn(!1);try{c&&a.length>0&&R(c,a,y||{},"重新转换前备份","auto"),En?._id&&En?.current?.steps&&L(En._id,En.current.steps,"重新转换前备份(流程)","auto");const We=jr(ve,Ce),mt=To(),Et=await Q2([],{},We,void 0,mt,Ut=>{lt({prepare:"准备中...",calling:"连接 AI...",streaming:"AI 生成中...",fallback:"切换请求...",parsing:"解析中...",validating:"校验中...",complete:"完成!"}[Ut.stage]||Ut.stage),Ut.stage!=="streaming"&&zt(cn=>[...cn,Ut.message]),Ut.accumulated&&Ot(Ut.accumulated)});if(Et?.error)throw new Error(Et.error);if(!Et?.fields||!Array.isArray(Et.fields)||Et.fields.length===0)throw new Error(Et?.message||"AI 未返回有效字段数据");i({_id:c||void 0,name:e,description:t,fields:Et.fields,tableColumns:typeof Et.tableColumns=="number"?Et.tableColumns:void 0}),c&&R(c,Et.fields,Et.events||{},"版本升级(重新转换)","ai");let At;ve&&(At=await mr(ve,Et.fields)),await Ho(Et,At),ve&&await Ir(ve,Et.fields),Array.isArray(Et.migrationLog)&&Et.migrationLog.length>0&&zt(Ut=>[...Ut,"--- 旧版脚本迁移记录 ---",...Et.migrationLog]),Ie(""),xn("重新转换完成,请检查字段后点击「保存」按钮","success")}catch(We){const mt=We?.response?.data,Et=(typeof mt=="string"?mt:null)||mt?.error||mt?.message||(typeof mt=="object"?JSON.stringify(mt):null)||We?.message||"未知错误";Ye(Et)}finally{He(!1),lt("")}}},jl=()=>{G.current?.click()},rl=We=>{const mt=We.target.files?.[0];if(!mt)return;const Et=new FileReader;Et.onload=At=>{try{const Ut=JSON.parse(At.target?.result);Ut&&Array.isArray(Ut.fields)?(a.length>0&&R(c,a,y,"导入前备份","auto"),i(Ut),xn("导入成功","success")):xn("JSON 格式错误","error")}catch(Ut){xn("JSON 解析失败: "+Ut.message,"error")}},Et.readAsText(mt),We.target.value=""},Cc=()=>{const We=s(),mt=new Blob([JSON.stringify(We,null,2)],{type:"application/json"}),Et=URL.createObjectURL(mt),At=document.createElement("a");At.href=Et,At.download=`form-${e||"export"}.json`,At.click(),URL.revokeObjectURL(Et)},hn=()=>{const We=new Date,mt=`${String(We.getHours()).padStart(2,"0")}:${String(We.getMinutes()).padStart(2,"0")}:${String(We.getSeconds()).padStart(2,"0")}`;R(c,a,y,`暂存 ${mt}`,"manual"),xn("已暂存到本地版本历史","success")},Mn=async We=>{Xe(!0);try{const mt=await D(We._id);if(!mt||!mt.form_snapshot){xn("无法获取备份数据","error");return}const Et=typeof mt.form_snapshot=="string"?JSON.parse(mt.form_snapshot):mt.form_snapshot,At=mt.flow_snapshot?typeof mt.flow_snapshot=="string"?JSON.parse(mt.flow_snapshot):mt.flow_snapshot:null,Ut={...Et,id:Et._id||Et.id};if(delete Ut._id,await GD(Ut),At){const wn=(At.current?.steps||[]).map(un=>{const vr={...un,id:un._id||un.id};return delete vr._id,vr.lines&&(vr.lines=vr.lines.map(dr=>{const So={...dr,id:dr._id||dr.id};return delete So._id,So})),vr}),cn={...At,id:At._id||At.id,current:{...At.current,steps:wn},upgraded:!1};delete cn._id,await WM(cn)}if(mt.object_workflows_snapshot)try{const wn=typeof mt.object_workflows_snapshot=="string"?JSON.parse(mt.object_workflows_snapshot):mt.object_workflows_snapshot;if(Array.isArray(wn)){for(const cn of wn)if(cn._id){const{_id:un,...vr}=cn;await tA(un,vr)}}}catch(wn){console.warn("Failed to restore object_workflows:",wn)}XT(),Be(!1),wt(null),xn("还原成功,正在重新加载页面...","success"),setTimeout(()=>window.location.reload(),800)}catch(mt){xn("还原失败: "+(mt?.response?.data?.message||mt?.message||"未知错误"),"error")}finally{Xe(!1)}};return ee?g.jsx("div",{className:"h-screen w-full flex items-center justify-center",children:g.jsxs("div",{className:"text-center",children:[g.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-indigo-600 mx-auto mb-3"}),g.jsx("p",{className:"text-sm text-gray-500",children:"加载表单数据中..."})]})}):ne?g.jsx("div",{className:"h-screen w-full flex items-center justify-center",children:g.jsxs("div",{className:"text-center",children:[g.jsx("p",{className:"text-sm text-red-500 mb-2",children:ne}),g.jsx("button",{onClick:()=>window.location.reload(),className:"text-sm text-indigo-600 hover:underline",children:"重试"})]})}):ce?g.jsxs("div",{className:"h-screen w-full flex flex-col overflow-hidden",children:[g.jsx("header",{className:"flex-shrink-0 bg-white border-b border-gray-200",children:g.jsxs("div",{className:"relative flex h-12 items-center px-4",children:[g.jsxs("div",{className:"flex items-center gap-2.5",children:[g.jsx("div",{className:"w-7 h-7 rounded-lg bg-emerald-600 flex items-center justify-center flex-shrink-0",children:g.jsx(IM,{className:"w-3.5 h-3.5 text-white"})}),g.jsx("h1",{className:"text-[14px] font-semibold text-gray-800 whitespace-nowrap",children:Lr||e||"未命名流程"})]}),g.jsx("div",{className:"absolute left-1/2 -translate-x-1/2",children:g.jsx(qM,{active:"form",isDirty:!1})})]})}),g.jsx("div",{className:"flex-1 flex items-start justify-center bg-gray-50 pt-16",children:g.jsxs("div",{className:"bg-white rounded-2xl shadow-xl border border-gray-200 w-[680px] p-8 space-y-6",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("div",{className:"w-10 h-10 rounded-xl bg-amber-100 flex items-center justify-center flex-shrink-0",children:g.jsx(X2,{className:"w-5 h-5 text-amber-600"})}),g.jsxs("div",{children:[g.jsx("h2",{className:"text-[16px] font-semibold text-gray-800",children:"检测到旧版表单格式"}),g.jsx("p",{className:"text-[12px] text-gray-400 mt-0.5",children:"当前表单使用旧版格式,无法直接编辑"})]})]}),g.jsxs("div",{className:"rounded-lg bg-amber-50 border border-amber-200 px-4 py-3 space-y-1.5",children:[g.jsx("p",{className:"text-[13px] font-medium text-amber-800",children:"升级前请注意以下风险:"}),g.jsxs("ul",{className:"text-[12px] text-amber-700 space-y-1 list-disc list-inside",children:[g.jsx("li",{children:"AI 将自动转换字段名称、类型和公式,可能存在偏差,请升级后仔细核对"}),g.jsx("li",{children:"旧版公式语法可能与新版不完全兼容,需要手动确认"}),g.jsx("li",{children:"关联字段、自定义脚本等复杂配置需升级后人工检查"}),g.jsx("li",{children:'升级过程不会覆盖服务器数据,需手动点击"保存"后才会生效'}),g.jsx("li",{children:"建议升级前先在服务器备份原始表单数据"})]})]}),g.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-gray-500",children:[g.jsxs("span",{className:"px-2 py-0.5 rounded bg-gray-100 text-gray-600 font-medium",children:[ce.rawFields.length," 个字段"]}),g.jsx("span",{children:"将由 AI 自动转换为新版格式"})]}),g.jsxs("div",{className:"space-y-1.5",children:[g.jsx("label",{className:"text-[12px] font-medium text-gray-600",children:"补充说明(可选)"}),g.jsx("textarea",{value:Oe,onChange:We=>ye(We.target.value),disabled:me,rows:2,placeholder:"如:金额字段使用 number 类型并开启千位分隔符;公式字段转成 RMB 大写...",className:"w-full resize-none rounded-lg border border-gray-200 px-3 py-2 text-[12px] text-gray-700 placeholder-gray-300 focus:outline-none focus:border-indigo-400 focus:ring-1 focus:ring-indigo-200 disabled:opacity-50"})]}),g.jsxs("div",{className:"flex gap-3 pt-1",children:[ae&&g.jsx("button",{onClick:Co,disabled:me,className:"flex-1 flex items-center justify-center gap-2 rounded-lg bg-indigo-600 px-4 py-2 text-[13px] font-medium text-white hover:bg-indigo-700 disabled:opacity-50 transition-colors",children:me?g.jsxs(g.Fragment,{children:[g.jsx(au,{className:"w-4 h-4 animate-spin"}),$e||"AI 转换中..."]}):g.jsxs(g.Fragment,{children:[g.jsx(vi,{className:"w-4 h-4"}),"AI 升级"]})}),me&&g.jsx("button",{onClick:()=>ge(!Re),className:`shrink-0 flex items-center justify-center w-9 h-9 rounded-lg border transition-colors ${Re?"bg-gray-800 border-gray-700 text-green-400":"bg-white border-gray-300 text-gray-500 hover:bg-gray-50 hover:text-gray-700"}`,title:"查看处理日志",children:g.jsx(Dv,{className:"w-4 h-4"})})]}),!ae&&g.jsxs("div",{className:"rounded-lg bg-amber-50 border border-amber-200 px-3 py-2.5 flex items-start gap-2",children:[g.jsx(AM,{className:"w-3.5 h-3.5 text-amber-500 flex-shrink-0 mt-0.5"}),g.jsxs("p",{className:"text-[11px] text-amber-700 leading-relaxed",children:["未配置环境变量 ",g.jsx("code",{className:"bg-amber-100 px-1 rounded text-[10px]",children:"WORKFLOW_AI_API_KEY"}),",AI 升级不可用。"]})]}),Re&&(Te.length>0||Ze)&&g.jsxs("div",{className:"rounded-lg bg-gray-900 border border-gray-700 overflow-hidden",children:[g.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-gray-800 border-b border-gray-700",children:[g.jsx("span",{className:"text-[11px] font-medium text-gray-400",children:"AI 输出"}),g.jsx("button",{onClick:()=>ge(!1),className:"text-gray-500 hover:text-gray-300",children:g.jsx(co,{className:"w-3 h-3"})})]}),Te.length>0&&g.jsx("div",{className:"px-3 py-1.5 border-b border-gray-800",children:Te.map((We,mt)=>g.jsxs("div",{className:"text-[10px] text-gray-500 font-mono",children:[g.jsx("span",{className:"text-gray-600 mr-1",children:"▸"}),We]},mt))}),Ze&&g.jsxs("div",{className:"max-h-[240px] overflow-y-auto px-3 py-2",children:[g.jsx("pre",{className:"font-mono text-[11px] text-green-400 whitespace-pre-wrap break-all",children:Ze}),g.jsx("div",{ref:we})]})]}),je&&g.jsxs("div",{className:"rounded-lg bg-red-50 border border-red-200 px-4 py-3 flex items-start gap-2.5",children:[g.jsx(Tv,{className:"w-4 h-4 text-red-500 flex-shrink-0 mt-0.5"}),g.jsxs("div",{className:"min-w-0",children:[g.jsx("p",{className:"text-[13px] font-medium text-red-700 mb-0.5",children:"升级失败"}),g.jsx("pre",{className:"text-[11px] text-red-600 whitespace-pre-wrap break-all font-mono",children:je})]})]})]})})]}):g.jsxs("div",{className:"h-screen w-full flex flex-col overflow-hidden",children:[g.jsxs("header",{className:"flex-shrink-0 bg-white border-b border-gray-200",children:[g.jsx("input",{ref:G,type:"file",accept:".json",className:"hidden",onChange:rl}),g.jsxs("div",{className:"relative flex h-12 items-center px-4 gap-3",children:[g.jsxs("div",{className:"flex items-center gap-2.5",children:[g.jsx("div",{className:"w-7 h-7 rounded-lg bg-emerald-600 flex items-center justify-center flex-shrink-0",children:g.jsx(IM,{className:"w-3.5 h-3.5 text-white"})}),en?g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("input",{value:On,onChange:We=>qt(We.target.value),className:"border border-gray-300 rounded-md px-2 py-1 text-[13px] w-48 focus:border-indigo-400 focus:ring-1 focus:ring-indigo-200 outline-none",placeholder:"表单名称",autoFocus:!0,onKeyDown:We=>{if(We.key==="Escape"&&Qt(!1),We.key==="Enter"){const mt=On.trim();r(mt),Fn(mt),Qt(!1)}}}),g.jsx("button",{onClick:()=>{const We=On.trim();r(We),Fn(We),Qt(!1)},className:"text-[12px] text-indigo-600 font-medium hover:text-indigo-800 whitespace-nowrap",children:"确定"}),g.jsx("button",{onClick:()=>Qt(!1),className:"text-[12px] text-gray-400 hover:text-gray-600 whitespace-nowrap",children:"取消"})]}):g.jsxs("button",{onClick:()=>{qt(Lr||e||""),Qt(!0)},className:"flex items-center gap-1.5 group",title:"点击编辑名称",children:[g.jsx("h1",{className:"text-[14px] font-semibold text-gray-800 whitespace-nowrap",children:Lr||e||"未命名流程"}),g.jsx(Y2,{className:"w-3 h-3 text-gray-300 group-hover:text-gray-500 smooth-transition"})]})]}),g.jsx("div",{className:"absolute left-1/2 -translate-x-1/2",children:g.jsx(qM,{active:"form",isDirty:W})}),g.jsx("div",{className:"flex-1"}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsxs("button",{onClick:jl,className:"flex items-center gap-1.5 rounded-md border border-gray-300 bg-white px-3 py-1.5 text-[13px] font-medium text-gray-700 hover:bg-gray-50 smooth-transition",title:"导入 JSON",children:[g.jsx(vB,{className:"w-3.5 h-3.5"}),"导入"]}),g.jsxs("button",{onClick:Cc,className:"flex items-center gap-1.5 rounded-md border border-gray-300 bg-white px-3 py-1.5 text-[13px] font-medium text-gray-700 hover:bg-gray-50 smooth-transition",title:"导出 JSON",children:[g.jsx(gB,{className:"w-3.5 h-3.5"}),"导出"]}),g.jsxs("button",{onClick:hn,className:"flex items-center gap-1.5 rounded-md border border-gray-300 bg-white px-3 py-1.5 text-[13px] font-medium text-gray-700 hover:bg-gray-50 smooth-transition",title:"暂存到本地版本历史",children:[g.jsx(OT,{className:"w-3.5 h-3.5"}),"暂存"]}),z.length>0&&g.jsxs("button",{onClick:()=>Be(!0),className:"flex items-center gap-1.5 rounded-md border border-gray-200 bg-white px-2.5 py-1 text-[12px] text-gray-500 hover:text-gray-700 hover:bg-gray-50 smooth-transition",title:"将表单和流程恢复到 AI 升级前的状态",children:[g.jsx(hv,{className:"w-3 h-3"}),"恢复到旧版"]}),g.jsxs("button",{onClick:Rt,disabled:J,className:"flex items-center gap-1.5 rounded-md bg-indigo-600 px-3 py-1.5 text-[13px] font-medium text-white hover:bg-indigo-700 disabled:opacity-50 smooth-transition",children:[J?g.jsx(au,{className:"w-3.5 h-3.5 animate-spin"}):g.jsx(PT,{className:"w-3.5 h-3.5"}),J?"保存中...":"保存"]}),p8]})]})]}),ve&&g.jsxs("div",{className:"flex-shrink-0 border-b border-amber-200 bg-amber-50",children:[g.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5",children:[g.jsx(vi,{className:"w-3.5 h-3.5 shrink-0 text-amber-600"}),g.jsx("span",{className:"flex-1 text-[12px] font-medium text-amber-800",children:"表单已从旧版升级,效果不满意?可补充说明后重新转换"}),g.jsx("button",{onClick:()=>Wt(!_t),className:"text-amber-400 hover:text-amber-600 smooth-transition",title:_t?"收起":"展开",children:g.jsx(Cs,{className:`w-4 h-4 transition-transform duration-200 ${_t?"rotate-180":""}`})})]}),_t&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex items-start gap-2 px-4 pb-2",children:[g.jsx("textarea",{value:Ce,onChange:We=>Ie(We.target.value),disabled:Pe,rows:1,placeholder:"描述问题或补充要求,如:请假天数公式不对、金额字段需要大写...",className:"flex-1 resize-none rounded-lg border border-amber-200 bg-white px-3 py-1.5 text-[12px] text-gray-700 placeholder-gray-400 focus:outline-none focus:border-amber-400 focus:ring-1 focus:ring-amber-200 disabled:opacity-50"}),g.jsxs("button",{onClick:sa,disabled:Pe,className:"shrink-0 flex items-center gap-1.5 rounded-lg bg-amber-500 px-3 py-1.5 text-[12px] font-medium text-white hover:bg-amber-600 disabled:opacity-50 smooth-transition",children:[Pe?g.jsx(au,{className:"w-3.5 h-3.5 animate-spin"}):g.jsx(vi,{className:"w-3.5 h-3.5"}),Pe?rt||"转换中...":"重新转换"]}),Pe&&g.jsx("button",{onClick:()=>rn(!Dt),className:`shrink-0 flex items-center justify-center w-7 h-7 rounded-lg border transition-colors ${Dt?"bg-gray-800 border-gray-700 text-green-400":"border-amber-200 text-amber-500 hover:bg-amber-100"}`,title:"查看处理日志",children:g.jsx(Dv,{className:"w-3.5 h-3.5"})}),g.jsx("button",{onClick:()=>{Ve(null),Wt(!1)},className:"shrink-0 rounded-lg border border-amber-200 px-2 py-1.5 text-[12px] text-amber-600 hover:bg-amber-100 smooth-transition",title:"不再显示",children:"关闭"})]}),Dt&&(pt.length>0||Pt)&&g.jsxs("div",{className:"mx-4 mb-2 rounded-lg bg-gray-900 border border-gray-700 overflow-hidden",children:[g.jsxs("div",{className:"flex items-center justify-between px-3 py-1 bg-gray-800 border-b border-gray-700",children:[g.jsx("span",{className:"text-[10px] font-medium text-gray-400",children:"AI 输出"}),g.jsx("button",{onClick:()=>rn(!1),className:"text-gray-500 hover:text-gray-300",children:g.jsx(co,{className:"w-3 h-3"})})]}),pt.length>0&&g.jsx("div",{className:"px-3 py-1 border-b border-gray-800",children:pt.map((We,mt)=>g.jsxs("div",{className:"text-[10px] text-gray-500 font-mono",children:[g.jsx("span",{className:"text-gray-600 mr-1",children:"▸"}),We]},mt))}),Pt&&g.jsxs("div",{className:"max-h-[160px] overflow-y-auto px-3 py-1.5",children:[g.jsx("pre",{className:"font-mono text-[10px] text-green-400 whitespace-pre-wrap break-all",children:Pt}),g.jsx("div",{ref:fn})]})]}),Ke&&g.jsx("div",{className:"px-4 pb-2",children:g.jsx("p",{className:"rounded bg-red-50 px-2 py-1 text-[11px] text-red-600",children:Ke})})]})]}),g.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0",children:[g.jsx(JW,{show:hr,defaultWidth:350,minWidth:350,maxFraction:.5,className:"bg-white",children:g.jsx(tPe,{sidebar:!0,onClose:()=>ur(!1)})}),g.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[g.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between border-b border-gray-100 bg-white px-3 py-1.5",children:[g.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-gray-400",children:[ae&&g.jsxs("button",{onClick:()=>ur(!hr),className:`flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium smooth-transition ${hr?"bg-purple-100 text-purple-700":"text-gray-400 hover:text-purple-600 hover:bg-purple-50"}`,title:"AI 表单助手",children:[g.jsx(vi,{className:"w-3.5 h-3.5"}),"AI"]}),g.jsx("div",{className:"mx-1.5 h-4 w-px bg-gray-200"}),g.jsx("button",{onClick:K,disabled:!Y,className:"rounded-md p-1.5 text-gray-500 hover:bg-gray-100 hover:text-gray-700 disabled:opacity-30 disabled:hover:bg-transparent smooth-transition",title:"撤销 (⌘Z)",children:g.jsx(FT,{className:"h-4 w-4"})}),g.jsx("button",{onClick:Q,disabled:!A,className:"rounded-md p-1.5 text-gray-500 hover:bg-gray-100 hover:text-gray-700 disabled:opacity-30 disabled:hover:bg-transparent smooth-transition",title:"重做 (⌘⇧Z)",children:g.jsx(AT,{className:"h-4 w-4"})}),g.jsx("div",{className:"w-px h-4 bg-gray-200"}),g.jsxs("span",{children:[a.length," 个字段"]})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsxs("button",{onClick:()=>Yr(!wr),className:`flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium smooth-transition ${wr?"bg-emerald-100 text-emerald-700":"text-gray-400 hover:text-gray-600 hover:bg-gray-100"}`,title:"预览表单",children:[g.jsx(RT,{className:"w-3.5 h-3.5"}),"预览"]}),wr&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"w-px h-4 bg-gray-200"}),g.jsxs("div",{className:"flex items-center gap-0.5 rounded-md border border-gray-200 p-0.5",children:[g.jsx("button",{onClick:()=>gr("desktop"),className:`flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] font-medium smooth-transition ${pr==="desktop"?"bg-blue-100 text-blue-700":"text-gray-400 hover:text-gray-600 hover:bg-gray-50"}`,title:"桌面模式",children:g.jsx(eae,{className:"w-3.5 h-3.5"})}),g.jsx("button",{onClick:()=>gr("tablet"),className:`flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] font-medium smooth-transition ${pr==="tablet"?"bg-blue-100 text-blue-700":"text-gray-400 hover:text-gray-600 hover:bg-gray-50"}`,title:"平板模式",children:g.jsx(Lae,{className:"w-3.5 h-3.5"})}),g.jsx("button",{onClick:()=>gr("mobile"),className:`flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] font-medium smooth-transition ${pr==="mobile"?"bg-blue-100 text-blue-700":"text-gray-400 hover:text-gray-600 hover:bg-gray-50"}`,title:"手机模式",children:g.jsx($ae,{className:"w-3.5 h-3.5"})})]}),g.jsxs("button",{onClick:()=>yo(!Pr),className:`flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium smooth-transition ${Pr?"bg-orange-100 text-orange-700":"text-gray-400 hover:text-gray-600 hover:bg-gray-100"}`,title:Pr?"切换为可编辑":"切换为只读",children:[Pr?g.jsx(DT,{className:"w-3.5 h-3.5"}):g.jsx(Hoe,{className:"w-3.5 h-3.5"}),Pr?"只读":"可编辑"]})]}),g.jsx("div",{className:"w-px h-4 bg-gray-200"}),g.jsxs("button",{onClick:()=>{Vt(!kt),kt||qn(!0)},className:`flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium smooth-transition ${kt?"bg-amber-100 text-amber-700":"text-gray-400 hover:text-gray-600 hover:bg-gray-100"}`,title:"表单事件",children:[g.jsx(Iv,{className:"w-3.5 h-3.5"}),"事件"]}),g.jsx(oPe,{}),g.jsx("div",{className:"w-px h-4 bg-gray-200"}),g.jsxs("button",{onClick:()=>M(null),className:`flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium smooth-transition ${j?"text-gray-400 hover:text-gray-600 hover:bg-gray-100":"bg-indigo-100 text-indigo-700"}`,title:"表单属性",children:[g.jsx(b1,{className:"w-3.5 h-3.5"}),"表单属性"]})]})]}),g.jsx("div",{className:"flex-1 flex overflow-hidden min-h-0",children:wr?g.jsx("div",{className:"flex-1 min-w-0 relative",children:g.jsx(K4e,{deviceMode:pr,readOnly:Pr})}):g.jsxs(g.Fragment,{children:[g.jsx(xOe,{}),g.jsx("div",{className:"flex-1 min-w-0 relative",children:g.jsx(bMe,{})}),g.jsx(YAe,{})]})})]})]}),g.jsx(aa,{open:kt,onCancel:()=>{Vt(!1),Ft(!1),qn(!1)},title:g.jsxs("div",{className:"flex items-center justify-between pr-8",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Iv,{className:"w-4 h-4 text-amber-600"}),g.jsx("span",{children:"表单事件"})]}),g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsxs("button",{onClick:()=>qn(!jn),className:`flex items-center gap-1 rounded-md px-2 py-1 text-[11px] font-medium smooth-transition ${jn?"bg-green-100 text-green-700":"text-gray-400 hover:text-gray-600 hover:bg-gray-100"}`,title:"查看当前表单字段",children:[g.jsx(q2,{className:"w-3.5 h-3.5"}),"字段"]}),g.jsxs("button",{onClick:()=>Ft(!St),className:`flex items-center gap-1 rounded-md px-2 py-1 text-[11px] font-medium smooth-transition ${St?"bg-blue-100 text-blue-700":"text-gray-400 hover:text-gray-600 hover:bg-gray-100"}`,title:"查看帮助文档",children:[g.jsx($D,{className:"w-3.5 h-3.5"}),"帮助"]})]})]}),footer:g.jsx("button",{onClick:()=>{Vt(!1),Ft(!1),qn(!1)},className:"rounded-md bg-indigo-600 px-4 py-1.5 text-[13px] font-medium text-white hover:bg-indigo-700 smooth-transition",children:"完成"}),width:St||jn?1060:640,centered:!0,destroyOnClose:!0,styles:{body:St||jn?{height:"60vh",overflow:"hidden"}:{maxHeight:"60vh",overflowY:"auto"}},children:g.jsxs("div",{className:St||jn?"flex gap-4 h-full":"",children:[g.jsxs("div",{className:`space-y-5 py-2 ${St||jn?"flex-1 min-w-0 overflow-y-auto pr-1":""}`,children:[g.jsxs("div",{children:[g.jsx("label",{className:"block text-[12px] font-medium text-gray-600 mb-1.5",children:"初始化事件 (onInit)"}),g.jsx("p",{className:"text-[10px] text-gray-400 mb-1.5",children:"表单加载后执行的 JavaScript 代码,支持 async/await。可用参数:form (表单实例), fields (字段数据)"}),g.jsxs("div",{className:"relative",children:[g.jsx("textarea",{value:y.onInit||"",onChange:We=>k({...y,onInit:We.target.value}),onFocus:We=>{an.current={element:We.target,eventKey:"onInit"}},onSelect:We=>{an.current={element:We.target,eventKey:"onInit"}},rows:8,className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-[13px] font-mono outline-none focus:border-amber-400 focus:ring-1 focus:ring-amber-200 smooth-transition resize-none bg-gray-50",placeholder:`// 支持异步函数 (async/await)
|
|
904
906
|
// 例如:
|
|
905
907
|
// var result = await fetch('/api/data');
|