@baishuyun/ai-design 2.1.8 → 2.1.9

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.
@@ -169,7 +169,7 @@ React keys must be passed directly to JSX without using spread:
169
169
  `})]})},lc=({size:e=30,className:t})=>a.jsx("div",{className:t,style:{backgroundImage:`${G0}`,backgroundRepeat:"no-repeat",backgroundSize:"cover",width:e,height:e,aspectRatio:"1/1"}}),dS=({name:e,icon:t,variant:n="default"})=>{const r=n==="default"?16:24;if(!e)return null;const o={default:"text-[#999] text-[14px] font-[400]",active:"text-[#0265FF] text-[14px] font-[700]"},s=typeof t=="string"&&/^https?:\/\//.test(t)?a.jsx("img",{src:t,alt:"",className:"rounded-full",width:r,height:r}):t||a.jsx(lc,{size:r});return a.jsxs("div",{className:"flex items-center gap-1.5",children:[s,a.jsx("div",{className:o[n],children:e})]})},fS=({label:e,children:t,className:n})=>a.jsxs("div",{className:j("flex gap-2 items-start w-full",n),children:[a.jsx("div",{className:"w-[100px] shrink-0 text-[#666] text-sm leading-normal truncate",children:e}),a.jsx("div",{className:"flex-1 min-w-0 text-sm leading-normal whitespace-pre-wrap break-words",children:t!=null?t:a.jsx("span",{className:"text-[#666]",children:"无"})})]}),pS=({children:e})=>a.jsx("div",{className:"flex flex-col gap-[10px] w-full",children:e}),hS=({title:e,desc:t,index:n,icon:r,onClick:o,iconCode:i,className:s,compact:l})=>{const c=qe({"text-[18px]":l},"text-[#0265FF]"),u=qe({"text-[16px]":l,"font-[500]":l},"truncate !text-[#121111] group-hover:text-[#0265FF]"),d=qe({"text-[12px]":!l,"text-[14px]":l},"text-[#666] leading-5");return a.jsxs("div",{className:j("bs-card group flex flex-col cursor-pointer p-2.5 rounded-lg max-w-[350px] border border-[#e0e0e0] bg-white",l?"gap-1.5":"gap-2.5",oe,s),onClick:()=>{o==null||o(e,i)},children:[a.jsxs("div",{className:j("flex items-center gap-1.5 rounded-[4px] bg-white",{"h-[26px]":l,"px-2.5 h-[34px]":!l}),children:[r===void 0?null:a.jsx("div",{className:c,children:r}),a.jsx("div",{className:u,children:e})]}),a.jsx("div",{className:d,children:t})]})},i9=({icon:e,iconBgColor:t,title:n,description:r,height:o,selected:i,badge:s,onClick:l})=>a.jsx("div",{className:j("flex flex-col p-[10px] rounded-[4px] cursor-pointer","border",{"bg-[#EFF0F6] border-[#EFF0F6]":i,"bg-white border-[#E0E0E0]":!i},oe),style:{height:o},onClick:l,children:a.jsxs("div",{className:"flex items-start gap-[12px] w-full",children:[a.jsx("div",{className:"shrink-0 size-[42px] rounded-[23px] flex items-center justify-center p-[7px]",style:{backgroundColor:t},children:a.jsx("div",{className:"size-[28px] flex items-center justify-center",children:e})}),a.jsxs("div",{className:"flex flex-col gap-[6px] min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center justify-between w-full",children:[a.jsx("p",{className:"text-[14px] font-bold text-[#030303] truncate",children:n}),s&&a.jsx("span",{className:"shrink-0 bg-[#4ACCC1] text-white text-[12px] leading-[normal] px-[6px] h-[20px] rounded-[4px] flex items-center justify-center ml-[8px]",children:s})]}),a.jsx("p",{className:"text-[12px] text-[#999] w-full",children:r})]})]})}),s9=({agent:e,className:t})=>a.jsxs("div",{className:j("bg-[#e5e6eb] content-stretch flex gap-[4px] items-center px-[6px] rounded-[100px] w-fit h-[26px]",t),children:[a.jsx("div",{className:"relative rounded-[3.5px] shrink-0 size-[14px]",children:a.jsx("img",{alt:"",className:"absolute inset-0 max-w-none object-cover pointer-events-none rounded-[3.5px] size-full",src:e.icon})}),a.jsx("p",{className:"leading-[normal] shrink-0 text-[#030303] text-[12px] whitespace-nowrap",children:e.name})]}),cc=[{triggerType:"form_field",title:"表单字段触发",description:"表单中数据发生变化时,触发自动化操作",icon:a.jsx(il,{}),minIcon:a.jsx(il,{size:12}),iconBgColor:"rgba(77, 96, 159, 0.1)"},{triggerType:"form_action",title:"表单动作触发",description:"表单中数据发生变化时,触发自动化操作",icon:a.jsx("div",{className:"text-[#0265FF]",children:a.jsx(M3,{})}),minIcon:a.jsx(N3,{size:12}),iconBgColor:"rgba(2, 101, 255, 0.1)"},{triggerType:"form_flow_node",title:"表单流程节点触发",description:"表单中数据发生变化时,触发自动化操作",icon:a.jsx("div",{className:"text-[#FF9921]",children:a.jsx(cl,{})}),minIcon:a.jsx(cl,{size:12}),iconBgColor:"rgba(255, 153, 33, 0.1)"}],mS=({triggerType:e})=>{const t=cc.find(o=>o.triggerType===e);if(!t)return null;const{minIcon:n,iconBgColor:r}=t;return a.jsx("div",{className:"shrink-0 rounded-full flex items-center justify-center p-[7px]",style:{backgroundColor:r,width:18,height:18},children:a.jsx("div",{className:"flex items-center justify-center",children:n})})},gS=({value:e,onChange:t,configList:n=cc})=>a.jsx("div",{className:"grid grid-cols-3 gap-5",children:n.map(r=>a.jsx(i9,{icon:r.icon,iconBgColor:r.iconBgColor,title:r.title,description:r.description,badge:r.badge,selected:e===r.triggerType,onClick:()=>t==null?void 0:t(r.triggerType)},r.triggerType))});var xS=Object.defineProperty,gi=(e,t)=>xS(e,"name",{value:t,configurable:!0}),uc="Collapsible",[bS,uB]=It(uc),[CS,dc]=bS(uc),wS=S.forwardRef(gi(function(t,n){const{__scopeCollapsible:r,open:o,defaultOpen:i,disabled:s,onOpenChange:l,...c}=t,[u,d]=tn({prop:o,defaultProp:i!=null?i:!1,onChange:l,caller:uc});return a.jsx(CS,{scope:r,disabled:s,contentId:en(),open:u,onOpenToggle:S.useCallback(()=>d(f=>!f),[d]),children:a.jsx(Be.div,{"data-state":Ks(u),"data-disabled":s?"":void 0,...c,ref:n})})},"Collapsible")),yS="CollapsibleTrigger",vS=S.forwardRef(gi(function(t,n){const{__scopeCollapsible:r,...o}=t,i=dc(yS,r);return a.jsx(Be.button,{type:"button","aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":Ks(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...o,ref:n,onClick:je(t.onClick,i.onOpenToggle)})},"CollapsibleTrigger")),a9="CollapsibleContent",kS=S.forwardRef(gi(function(t,n){const{forceMount:r,...o}=t,i=dc(a9,t.__scopeCollapsible);return a.jsx(hn,{present:r||i.open,children:({present:s})=>a.jsx(ES,{...o,ref:n,present:s})})},"CollapsibleContent")),ES=S.forwardRef(gi(function(t,n){const{__scopeCollapsible:r,present:o,children:i,...s}=t,l=dc(a9,r),[c,u]=S.useState(o),d=S.useRef(null),f=Ue(n,d),p=S.useRef(0),h=p.current,m=S.useRef(0),g=m.current,x=l.open||c,C=S.useRef(x),w=S.useRef(void 0);return S.useEffect(()=>{const k=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(k)},[]),lt(()=>{const k=d.current;if(k){w.current=w.current||{transitionDuration:k.style.transitionDuration,animationName:k.style.animationName},k.style.transitionDuration="0s",k.style.animationName="none";const y=k.getBoundingClientRect();p.current=y.height,m.current=y.width,C.current||(k.style.transitionDuration=w.current.transitionDuration,k.style.animationName=w.current.animationName),u(o)}},[l.open,o]),a.jsx(Be.div,{"data-state":Ks(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!x,...s,ref:f,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...t.style},children:x&&i})},"CollapsibleContentImpl"));function Ks(e){return e?"open":"closed"}gi(Ks,"getState");var SS=wS,_S=Object.defineProperty,ir=(e,t)=>_S(e,"name",{value:t,configurable:!0}),fc="Checkbox",[NS,dB]=It(fc),[MS,pc]=NS(fc);function l9(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:o,disabled:i,form:s,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[p,h]=tn({prop:n,defaultProp:o!=null?o:!1,onChange:c,caller:fc}),[m,g]=S.useState(null),[x,C]=S.useState(null),w=S.useRef(!1),[k,y]=S.useReducer(_=>_+1,0),E=m?!!s||!!m.closest("form"):!0,v={checked:p,disabled:i,setChecked:h,control:m,setControl:g,name:l,form:s,value:d,hasConsumerStoppedPropagationRef:w,userInteractionCount:k,onUserInteraction:y,required:u,defaultChecked:sr(o)?!1:o,isFormControl:E,bubbleInput:x,setBubbleInput:C};return a.jsx(MS,{scope:t,...v,children:c9(f)?f(v):r})}ir(l9,"CheckboxProvider");var LS="CheckboxTrigger",AS=S.forwardRef(ir(function({__scopeCheckbox:t,onKeyDown:n,onClick:r,...o},i){const{control:s,value:l,disabled:c,checked:u,required:d,setControl:f,setChecked:p,hasConsumerStoppedPropagationRef:h,onUserInteraction:m,isFormControl:g,bubbleInput:x}=pc(LS,t),C=Ue(i,f),w=S.useRef(u);return S.useEffect(()=>{const k=s==null?void 0:s.form;if(k){const y=ir(()=>p(w.current),"reset");return k.addEventListener("reset",y),()=>k.removeEventListener("reset",y)}},[s,p]),a.jsx(Be.button,{type:"button",role:"checkbox","aria-checked":sr(u)?"mixed":u,"aria-required":d,"data-state":hc(u),"data-disabled":c?"":void 0,disabled:c,value:l,...o,ref:C,onKeyDown:je(n,k=>{k.key==="Enter"&&k.preventDefault()}),onClick:je(r,k=>{m(),p(y=>sr(y)?!0:!y),x&&g&&(h.current=k.isPropagationStopped(),h.current||k.stopPropagation())})})},"CheckboxTrigger")),TS=S.forwardRef(ir(function(t,n){const{__scopeCheckbox:r,name:o,checked:i,defaultChecked:s,required:l,disabled:c,value:u,onCheckedChange:d,form:f,...p}=t;return a.jsx(l9,{__scopeCheckbox:r,checked:i,defaultChecked:s,disabled:c,required:l,onCheckedChange:d,name:o,form:f,value:u,internal_do_not_use_render:({isFormControl:h})=>a.jsxs(a.Fragment,{children:[a.jsx(AS,{...p,ref:n,__scopeCheckbox:r}),h&&a.jsx(IS,{__scopeCheckbox:r})]})})},"Checkbox")),FS="CheckboxIndicator",jS=S.forwardRef(ir(function(t,n){const{__scopeCheckbox:r,forceMount:o,...i}=t,s=pc(FS,r);return a.jsx(hn,{present:o||sr(s.checked)||s.checked===!0,children:a.jsx(Be.span,{"data-state":hc(s.checked),"data-disabled":s.disabled?"":void 0,...i,ref:n,style:{pointerEvents:"none",...t.style}})})},"CheckboxIndicator")),OS="CheckboxBubbleInput",IS=S.forwardRef(ir(function({__scopeCheckbox:t,onClick:n,...r},o){const{control:i,hasConsumerStoppedPropagationRef:s,userInteractionCount:l,checked:c,defaultChecked:u,required:d,disabled:f,name:p,value:h,form:m,bubbleInput:g,setBubbleInput:x}=pc(OS,t),C=Ue(o,x),w=Yo(i),k=S.useRef(!1),y=S.useRef(c),E=S.useRef(l);S.useEffect(()=>{const _=g;if(!_)return;const L=window.HTMLInputElement.prototype,M=Object.getOwnPropertyDescriptor(L,"checked").set,B=l!==E.current;E.current=l;const P=y.current!==c;y.current=c;const A=!(B&&s.current);if(P&&M){k.current=!B;const O=new Event("click",{bubbles:A});_.indeterminate=sr(c),M.call(_,sr(c)?!1:c),_.dispatchEvent(O),k.current=!1}},[g,c,s,l]);const v=S.useRef(sr(c)?!1:c);return a.jsx(Be.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u!=null?u:v.current,required:d,disabled:f,name:p,value:h,form:m,...r,tabIndex:-1,ref:C,onClick:je(n,_=>{k.current&&_.stopPropagation()}),style:{...r.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function c9(e){return typeof e=="function"}ir(c9,"isFunction");function sr(e){return e==="indeterminate"}ir(sr,"isIndeterminate");function hc(e){return sr(e)?"indeterminate":e?"checked":"unchecked"}ir(hc,"getState");var DS=Object.defineProperty,mc=(e,t)=>DS(e,"name",{value:t,configurable:!0}),gc=!1;function u9(){const[e,t]=S.useState(gc);return S.useEffect(()=>{gc||(gc=!0,t(!0))},[]),e}mc(u9,"useIsHydrated");var d9=S[" useSyncExternalStore ".trim().toString()];function f9(){return()=>{}}mc(f9,"subscribe");function p9(){return d9(f9,()=>!0,()=>!1)}mc(p9,"useIsHydratedModern");var RS=typeof d9=="function"?p9:u9,PS=Object.defineProperty,Br=(e,t)=>PS(e,"name",{value:t,configurable:!0}),xc="rovingFocusGroup.onEntryFocus",HS={bubbles:!1,cancelable:!0},Xs="RovingFocusGroup",[bc,h9,BS]=ml(Xs),[zS,Qs]=It(Xs,[BS]),[VS,US]=zS(Xs),ZS=S.forwardRef(Br(function(t,n){return a.jsx(bc.Provider,{scope:t.__scopeRovingFocusGroup,children:a.jsx(bc.Slot,{scope:t.__scopeRovingFocusGroup,children:a.jsx(WS,{...t,ref:n})})})},"RovingFocusGroup")),WS=S.forwardRef(Br(function(t,n){const{__scopeRovingFocusGroup:r,orientation:o,loop:i=!1,dir:s,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...p}=t,h=S.useRef(null),m=Ue(n,h),g=ti(s),[x,C]=tn({prop:l,defaultProp:c!=null?c:null,onChange:u,caller:Xs}),[w,k]=S.useState(!1),y=pn(d),E=h9(r),v=S.useRef(!1),[_,L]=S.useState(0);return S.useEffect(()=>{const T=h.current;if(T)return T.addEventListener(xc,y),()=>T.removeEventListener(xc,y)},[y]),a.jsx(VS,{scope:r,orientation:o,dir:g,loop:i,currentTabStopId:x,onItemFocus:S.useCallback(T=>C(T),[C]),onItemShiftTab:S.useCallback(()=>k(!0),[]),onFocusableItemAdd:S.useCallback(()=>L(T=>T+1),[]),onFocusableItemRemove:S.useCallback(()=>L(T=>T-1),[]),children:a.jsx(Be.div,{tabIndex:w||_===0?-1:0,"data-orientation":o,...p,ref:m,style:{outline:"none",...t.style},onMouseDown:je(t.onMouseDown,()=>{v.current=!0}),onFocus:je(t.onFocus,T=>{const M=!v.current;if(T.target===T.currentTarget&&M&&!w){const B=new CustomEvent(xc,HS);if(T.currentTarget.dispatchEvent(B),!B.defaultPrevented){const P=E().filter(V=>V.focusable),A=P.find(V=>V.active),O=P.find(V=>V.id===x),I=[A,O,...P].filter(Boolean).map(V=>V.ref.current);Cc(I,f)}}v.current=!1}),onBlur:je(t.onBlur,()=>k(!1))})})},"RovingFocusGroupImpl")),GS="RovingFocusGroupItem",$S=S.forwardRef(Br(function(t,n){const{__scopeRovingFocusGroup:r,focusable:o=!0,active:i=!1,tabStopId:s,children:l,...c}=t,u=en(),d=s||u,f=US(GS,r),p=f.currentTabStopId===d,h=h9(r),{onFocusableItemAdd:m,onFocusableItemRemove:g,currentTabStopId:x}=f,C=RS();return lt(()=>{if(!(!C||!o))return m(),()=>g()},[C,o,m,g]),S.useEffect(()=>{if(!(C||!o))return m(),()=>g()},[C,o,m,g]),a.jsx(bc.ItemSlot,{scope:r,id:d,focusable:o,active:i,children:a.jsx(Be.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...c,ref:n,onMouseDown:je(t.onMouseDown,w=>{o?f.onItemFocus(d):w.preventDefault()}),onFocus:je(t.onFocus,()=>f.onItemFocus(d)),onKeyDown:je(t.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){f.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const k=g9(w,f.orientation,f.dir);if(k!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let E=h().filter(v=>v.focusable).map(v=>v.ref.current);if(k==="last")E.reverse();else if(k==="prev"||k==="next"){k==="prev"&&E.reverse();const v=E.indexOf(w.currentTarget);E=f.loop?x9(E,v+1):E.slice(v+1)}setTimeout(()=>Cc(E))}}),children:typeof l=="function"?l({isCurrentTabStop:p,hasTabStop:x!=null}):l})})},"RovingFocusGroupItem")),qS={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function m9(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}Br(m9,"getDirectionAwareKey");function g9(e,t,n){const r=m9(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return qS[r]}Br(g9,"getFocusIntent");function Cc(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}Br(Cc,"focusFirst");function x9(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Br(x9,"wrapArray");var b9=ZS,C9=$S,YS=Object.defineProperty,zt=(e,t)=>YS(e,"name",{value:t,configurable:!0}),w9="Radio",[KS,y9]=It(w9),[XS,wc]=KS(w9);function v9(e){const{__scopeRadio:t,checked:n=!1,children:r,disabled:o,form:i,name:s,onCheck:l,required:c,value:u="on",internal_do_not_use_render:d}=e,[f,p]=S.useState(null),[h,m]=S.useState(null),g=S.useRef(!1),[x,C]=S.useReducer(y=>y+1,0),w=f?!!i||!!f.closest("form"):!0,k={checked:n,disabled:o,required:c,name:s,form:i,value:u,control:f,setControl:p,hasConsumerStoppedPropagationRef:g,userInteractionCount:x,onUserInteraction:C,isFormControl:w,bubbleInput:h,setBubbleInput:m,onCheck:zt(()=>l==null?void 0:l(),"onCheck")};return a.jsx(XS,{scope:t,...k,children:k9(d)?d(k):r})}zt(v9,"RadioProvider");var QS="RadioTrigger",JS=S.forwardRef(zt(function({__scopeRadio:t,onClick:n,...r},o){const{checked:i,disabled:s,value:l,setControl:c,onCheck:u,hasConsumerStoppedPropagationRef:d,onUserInteraction:f,isFormControl:p,bubbleInput:h}=wc(QS,t),m=Ue(o,c);return a.jsx(Be.button,{type:"button",role:"radio","aria-checked":i,"data-state":E9(i),"data-disabled":s?"":void 0,disabled:s,value:l,...r,ref:m,onClick:je(n,g=>{i||(f(),u()),h&&p&&(d.current=g.isPropagationStopped(),d.current||g.stopPropagation())})})},"RadioTrigger")),e_="RadioBubbleInput",t_=S.forwardRef(zt(function({__scopeRadio:t,onClick:n,...r},o){const{control:i,checked:s,required:l,disabled:c,name:u,value:d,form:f,bubbleInput:p,setBubbleInput:h,hasConsumerStoppedPropagationRef:m,userInteractionCount:g}=wc(e_,t),x=Ue(o,h),C=Yo(i),w=S.useRef(!1),k=S.useRef(s),y=S.useRef(g);S.useEffect(()=>{const v=p;if(!v)return;const _=window.HTMLInputElement.prototype,T=Object.getOwnPropertyDescriptor(_,"checked").set,M=g!==y.current;y.current=g;const B=k.current!==s;k.current=s;const P=!(M&&m.current);if(B&&T){w.current=!M;const A=new Event("click",{bubbles:P});T.call(v,s),v.dispatchEvent(A),w.current=!1}},[p,s,m,g]);const E=S.useRef(s);return a.jsx(Be.input,{type:"radio","aria-hidden":!0,defaultChecked:E.current,required:l,disabled:c,name:u,value:d,form:f,...r,tabIndex:-1,ref:x,onClick:je(n,v=>{w.current&&v.stopPropagation()}),style:{...r.style,...C,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"RadioBubbleInput"));function k9(e){return typeof e=="function"}zt(k9,"isFunction");function E9(e){return e?"checked":"unchecked"}zt(E9,"getState");var n_=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],yc="RadioGroup",[r_,fB]=It(yc,[Qs,y9]),S9=Qs(),vc=y9(),[o_,i_]=r_(yc),s_=S.forwardRef(zt(function(t,n){const{__scopeRadioGroup:r,name:o,form:i,defaultValue:s,value:l,required:c=!1,disabled:u=!1,orientation:d,dir:f,loop:p=!0,onValueChange:h,...m}=t,g=S9(r),x=ti(f),[C,w]=tn({prop:l,defaultProp:s!=null?s:null,onChange:h,caller:yc}),[k,y]=S.useState(null),E=Ue(n,y),v=S.useRef(C);return S.useEffect(()=>{const _=i?k==null?void 0:k.ownerDocument.getElementById(i):k==null?void 0:k.closest("form");if(_ instanceof HTMLFormElement){const L=zt(()=>w(v.current),"reset");return _.addEventListener("reset",L),()=>_.removeEventListener("reset",L)}},[k,i,w]),a.jsx(o_,{scope:r,name:o,form:i,required:c,disabled:u,value:C,onValueChange:w,children:a.jsx(b9,{asChild:!0,...g,orientation:d,dir:x,loop:p,children:a.jsx(Be.div,{role:"radiogroup","aria-required":c,"aria-orientation":d,"data-disabled":u?"":void 0,dir:x,...m,ref:E})})})},"RadioGroup")),a_="RadioGroupItemProvider",l_="RadioGroupItemTrigger";function _9(e){const{__scopeRadioGroup:t,value:n,disabled:r,children:o,internal_do_not_use_render:i}=e,s=i_(a_,t),l=vc(t),c=s.disabled||r;return a.jsx(v9,{...l,checked:s.value===n,disabled:c,required:s.required,name:s.name,form:s.form,value:n,onCheck:()=>s.onValueChange(n),internal_do_not_use_render:i,children:o})}zt(_9,"RadioGroupItemProvider");var c_=S.forwardRef(zt(function(t,n){const{__scopeRadioGroup:r,...o}=t,i=S9(r),s=vc(r),{checked:l,disabled:c}=wc(l_,s.__scopeRadio),u=S.useRef(null),d=Ue(n,u),f=S.useRef(!1);return S.useEffect(()=>{const p=zt(m=>{n_.includes(m.key)&&(f.current=!0)},"handleKeyDown"),h=zt(()=>f.current=!1,"handleKeyUp");return document.addEventListener("keydown",p),document.addEventListener("keyup",h),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",h)}},[]),a.jsx(C9,{asChild:!0,...i,focusable:!c,active:l,children:a.jsx(JS,{...s,...o,ref:d,onKeyDown:je(o.onKeyDown,p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:je(o.onFocus,()=>{var p;f.current&&((p=u.current)==null||p.click())})})})},"RadioGroupItemTrigger")),u_=S.forwardRef(zt(function(t,n){const{__scopeRadioGroup:r,value:o,disabled:i,...s}=t;return a.jsx(_9,{__scopeRadioGroup:r,value:o,disabled:i,internal_do_not_use_render:({isFormControl:l})=>a.jsxs(a.Fragment,{children:[a.jsx(c_,{...s,ref:n,__scopeRadioGroup:r}),l&&a.jsx(d_,{__scopeRadioGroup:r})]})})},"RadioGroupItem")),d_=S.forwardRef(zt(function(t,n){const{__scopeRadioGroup:r,...o}=t,i=vc(r);return a.jsx(t_,{...i,...o,ref:n})},"RadioGroupItemBubbleInput")),f_=Object.defineProperty,Cr=(e,t)=>f_(e,"name",{value:t,configurable:!0}),kc="Switch",[p_,pB]=It(kc),[h_,Ec]=p_(kc);function N9(e){const{__scopeSwitch:t,checked:n,children:r,defaultChecked:o,disabled:i,form:s,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[p,h]=tn({prop:n,defaultProp:o!=null?o:!1,onChange:c,caller:kc}),[m,g]=S.useState(null),[x,C]=S.useState(null),w=S.useRef(!1),[k,y]=S.useReducer(_=>_+1,0),E=m?!!s||!!m.closest("form"):!0,v={checked:p,setChecked:h,disabled:i,control:m,setControl:g,name:l,form:s,value:d,hasConsumerStoppedPropagationRef:w,userInteractionCount:k,onUserInteraction:y,required:u,defaultChecked:o,isFormControl:E,bubbleInput:x,setBubbleInput:C};return a.jsx(h_,{scope:t,...v,children:M9(f)?f(v):r})}Cr(N9,"SwitchProvider");var m_="SwitchTrigger",g_=S.forwardRef(Cr(function({__scopeSwitch:t,onClick:n,...r},o){const{control:i,form:s,value:l,disabled:c,checked:u,required:d,setControl:f,setChecked:p,hasConsumerStoppedPropagationRef:h,onUserInteraction:m,isFormControl:g,bubbleInput:x}=Ec(m_,t),C=Ue(o,f),w=S.useRef(u);return S.useEffect(()=>{const k=s?i==null?void 0:i.ownerDocument.getElementById(s):i==null?void 0:i.form;if(k instanceof HTMLFormElement){const y=Cr(()=>p(w.current),"reset");return k.addEventListener("reset",y),()=>k.removeEventListener("reset",y)}},[i,s,p]),a.jsx(Be.button,{type:"button",role:"switch","aria-checked":u,"aria-required":d,"data-state":Sc(u),"data-disabled":c?"":void 0,disabled:c,value:l,...r,ref:C,onClick:je(n,k=>{m(),p(y=>!y),x&&g&&(h.current=k.isPropagationStopped(),h.current||k.stopPropagation())})})},"SwitchTrigger")),x_=S.forwardRef(Cr(function(t,n){const{__scopeSwitch:r,name:o,checked:i,defaultChecked:s,required:l,disabled:c,value:u,onCheckedChange:d,form:f,...p}=t;return a.jsx(N9,{__scopeSwitch:r,checked:i,defaultChecked:s,disabled:c,required:l,onCheckedChange:d,name:o,form:f,value:u,internal_do_not_use_render:({isFormControl:h})=>a.jsxs(a.Fragment,{children:[a.jsx(g_,{...p,ref:n,__scopeSwitch:r}),h&&a.jsx(y_,{__scopeSwitch:r})]})})},"Switch")),b_="SwitchThumb",C_=S.forwardRef(Cr(function(t,n){const{__scopeSwitch:r,...o}=t,i=Ec(b_,r);return a.jsx(Be.span,{"data-state":Sc(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:n})},"SwitchThumb")),w_="SwitchBubbleInput",y_=S.forwardRef(Cr(function({__scopeSwitch:t,onClick:n,...r},o){const{control:i,hasConsumerStoppedPropagationRef:s,userInteractionCount:l,checked:c,defaultChecked:u,required:d,disabled:f,name:p,value:h,form:m,bubbleInput:g,setBubbleInput:x}=Ec(w_,t),C=Ue(o,x),w=Yo(i),k=S.useRef(!1),y=S.useRef(c),E=S.useRef(l);S.useEffect(()=>{const _=g;if(!_)return;const L=window.HTMLInputElement.prototype,M=Object.getOwnPropertyDescriptor(L,"checked").set,B=l!==E.current;E.current=l;const P=y.current!==c;y.current=c;const A=!(B&&s.current);if(P&&M){k.current=!B;const O=new Event("click",{bubbles:A});M.call(_,c),_.dispatchEvent(O),k.current=!1}},[g,c,s,l]);const v=S.useRef(c);return a.jsx(Be.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u!=null?u:v.current,required:d,disabled:f,name:p,value:h,form:m,...r,tabIndex:-1,ref:C,onClick:je(n,_=>{k.current&&_.stopPropagation()}),style:{...r.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function M9(e){return typeof e=="function"}Cr(M9,"isFunction");function Sc(e){return e?"checked":"unchecked"}Cr(Sc,"getState");var v_=Object.defineProperty,xo=(e,t)=>v_(e,"name",{value:t,configurable:!0}),_c="Tabs",[k_,hB]=It(_c,[Qs]),L9=Qs(),[E_,Nc]=k_(_c),S_=S.forwardRef(xo(function(t,n){const{__scopeTabs:r,value:o,onValueChange:i,defaultValue:s,orientation:l="horizontal",dir:c,activationMode:u="automatic",...d}=t,f=ti(c),[p,h]=tn({prop:o,onChange:i,defaultProp:s!=null?s:"",caller:_c});return a.jsx(E_,{scope:r,baseId:en(),value:p,onValueChange:h,orientation:l,dir:f,activationMode:u,children:a.jsx(Be.div,{dir:f,"data-orientation":l,...d,ref:n})})},"Tabs")),__="TabsList",N_=S.forwardRef(xo(function(t,n){const{__scopeTabs:r,loop:o=!0,...i}=t,s=Nc(__,r),l=L9(r);return a.jsx(b9,{asChild:!0,...l,orientation:s.orientation,dir:s.dir,loop:o,children:a.jsx(Be.div,{role:"tablist","aria-orientation":s.orientation,...i,ref:n})})},"TabsList")),M_="TabsTrigger",L_=S.forwardRef(xo(function(t,n){const{__scopeTabs:r,value:o,disabled:i=!1,...s}=t,l=Nc(M_,r),c=L9(r),u=Mc(l.baseId,o),d=Lc(l.baseId,o),f=o===l.value;return a.jsx(C9,{asChild:!0,...c,focusable:!i,active:f,children:a.jsx(Be.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":d,"data-state":f?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:u,...s,ref:n,onMouseDown:je(t.onMouseDown,p=>{!i&&p.button===0&&p.ctrlKey===!1?l.onValueChange(o):p.preventDefault()}),onKeyDown:je(t.onKeyDown,p=>{i||p.target!==p.currentTarget||[" ","Enter"].includes(p.key)&&l.onValueChange(o)}),onFocus:je(t.onFocus,()=>{const p=l.activationMode!=="manual";!f&&!i&&p&&l.onValueChange(o)})})})},"TabsTrigger")),A_="TabsContent",T_=S.forwardRef(xo(function(t,n){const{__scopeTabs:r,value:o,forceMount:i,children:s,...l}=t,c=Nc(A_,r),u=Mc(c.baseId,o),d=Lc(c.baseId,o),f=o===c.value,p=S.useRef(f);return S.useEffect(()=>{const h=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(h)},[]),a.jsx(hn,{present:i||f,children:({present:h})=>a.jsx(Be.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!h,id:d,tabIndex:0,...l,ref:n,style:{...t.style,animationDuration:p.current?"0s":void 0},children:h&&s})})},"TabsContent"));function Mc(e,t){return`${e}-trigger-${t}`}xo(Mc,"makeTriggerId");function Lc(e,t){return`${e}-content-${t}`}xo(Lc,"makeContentId");var F_=S_,A9=N_,T9=L_,F9=T_;function j_({className:e,size:t="default",...n}){return a.jsx(x_,{"data-slot":"switch","data-size":t,className:j("peer group/switch inline-flex shrink-0 items-center rounded-full transition-colors outline-none focus-visible:ring-[3px] focus-visible:ring-[#4ACC8C]/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[20px] data-[size=default]:w-[40px] data-[size=sm]:h-[14px] data-[size=sm]:w-[28px] data-[state=checked]:bg-[#4ACC8C] data-[state=unchecked]:bg-[#ccc]",e),...n,children:a.jsx(C_,{"data-slot":"switch-thumb",className:j("pointer-events-none block rounded-full bg-white transition-transform group-data-[size=default]/switch:size-[16px] group-data-[size=sm]/switch:size-[10px] data-[state=checked]:translate-x-[22px] data-[state=unchecked]:translate-x-[2px]")})})}const O_={submit:"提交数据",edit:"编辑数据",delete:"删除数据",init:"表单初始化",edit_init:"表单编辑初始化"},I_={flow_end:"流程结束",flow_node:"流程节点"};function D_(e,t){var c,u,d,f,p;const[n,r]=b.useState(void 0),o=async(h,m)=>{const g=await(t==null?void 0:t.getEntry({appId:h,entryId:m}));r(g)};b.useEffect(()=>{!e.appId||!e.formId||o(e.appId,e.formId)},[e.appId,e.formId]);const i=n?n.name:e.formId,l=(d=b.useMemo(()=>{var m,g,x,C;const h={};for(const w of(g=(m=n==null?void 0:n.content)==null?void 0:m.items)!=null?g:[]){const k=(C=(x=w.widget)==null?void 0:x.widgetName)!=null?C:"";k&&(h[k]=w.label)}return h},[(c=n==null?void 0:n.content)==null?void 0:c.items])[(u=e.triggerFieldWidgetName)!=null?u:""])!=null?d:e.triggerFieldWidgetName;switch(e.triggerType){case"form_action":{const h=((f=e.formActionTriggerType)==null?void 0:f.map(m=>O_[m]||m).join("/"))||"";return h?`${i}
170
170
  ${h}`:i}case"form_flow_node":{const h=((p=e.flowNodeTriggerType)==null?void 0:p.map(m=>I_[m]||m).join("/"))||"";return h?`${i}
171
171
  ${h}`:i}case"form_field":return e.triggerFieldWidgetName?`${i} / ${l}`:i;case"universal":return"开箱即用,无需触发";case"scheduler":return"按计划时间触发";default:return""}}const j9=({helper:e,className:t,onEnabledChange:n,onViewLogs:r,onEdit:o,getAgent:i,onCopy:s,onDelete:l,formService:c})=>{const u=D_(e,c),d=i(e.agentId);return a.jsxs("div",{className:j("bg-white border border-[#e0e0e0] border-solid content-stretch flex flex-col items-start rounded-[10px] w-full group min-w-[335px]",t),children:[a.jsxs("div",{className:"grid-cols-1 grid-rows-[max-content] inline-grid leading-[0] place-items-start shrink-0 w-full",children:[a.jsxs("div",{className:"col-1 content-stretch flex h-[42px] items-center justify-between ml-0 mt-0 px-[12px] row-1 w-full",children:[a.jsxs("div",{className:"content-stretch flex gap-[6px] items-center min-w-0",children:[a.jsx(mS,{triggerType:e.triggerType,size:18}),a.jsx("p",{className:"leading-[normal] text-[#030303] text-[14px] truncate",children:e.helperName})]}),a.jsxs("div",{className:"content-stretch flex gap-[10px] items-center opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:[o&&a.jsx(nn,{icon:a.jsx(Jo,{}),rounded:!0,onClick:o}),s&&a.jsx(nn,{icon:a.jsx(w3,{}),rounded:!0,onClick:s}),l&&a.jsx(nn,{icon:a.jsx(Ss,{}),rounded:!0,onClick:l})]})]}),a.jsx("div",{className:"col-1 h-0 ml-0 mt-[42px] row-1 w-full border-b border-[#e0e0e0]"})]}),a.jsxs("div",{className:"content-stretch flex flex-col h-[172px] items-start justify-between p-[12px] shrink-0 w-full",children:[a.jsxs("div",{className:"content-stretch flex flex-col gap-[6px] items-start shrink-0 text-[14px] w-full",children:[a.jsx("p",{className:"min-w-full shrink-0 text-[#666] w-[min-content]",children:"触发:"}),u.split(`
172
- `).map((f,p)=>a.jsx("p",{className:"shrink-0 text-[#030303] whitespace-nowrap overflow-hidden text-ellipsis max-w-full",children:f},p))]}),d&&a.jsx(s9,{agent:d})]}),a.jsxs("div",{className:"grid-rows-[max-content] inline-grid leading-[0] place-items-start shrink-0 w-full",children:[a.jsx("div",{className:"col-1 h-0 ml-0 mt-0 row-1 w-full border-t border-[#e0e0e0]"}),a.jsxs("div",{className:"col-1 content-stretch flex h-[42px] items-center justify-between ml-0 mt-0 px-[12px] row-1 w-full",children:[a.jsx(j_,{checked:e.enabled,onCheckedChange:n}),r&&a.jsx("button",{className:"leading-[normal] shrink-0 text-[#0265ff] text-[12px] whitespace-nowrap hover:underline",onClick:r,children:"查看执行日志"})]})]})]})},R_=({items:e,className:t,getAgent:n,onEnabledChange:r,onViewLogs:o,onEdit:i,onCopy:s,onDelete:l,formService:c})=>a.jsx("div",{className:j("content-start flex flex-wrap gap-[20px] items-start",t),children:e.map(u=>a.jsx(j9,{formService:c,helper:u,getAgent:n,className:"w-[335px] shrink-0",onEnabledChange:r?d=>r(u.id,d):void 0,onViewLogs:o?()=>o(u.id):void 0,onEdit:i?()=>i(u.id):void 0,onCopy:s?()=>s(u.id):void 0,onDelete:l?()=>l(u.id):void 0},u.id))}),P_=()=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:"shrink-0",children:a.jsx("path",{d:"M8 3.333v9.334M3.333 8h9.334",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})}),H_=({description:e,detailAddress:t,btnLabel:n="新建智能体助手",onCreateClick:r,className:o})=>a.jsxs("div",{className:j("content-stretch flex flex-col items-center justify-center py-[40px] px-[20px] w-full",o),children:[a.jsx(p3,{}),a.jsxs("div",{className:"mt-[16px] text-center text-[#999] text-[14px] leading-[normal]",children:[a.jsx("p",{className:"mb-0",children:e}),t?a.jsx("p",{children:a.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-[#0265ff] underline [text-decoration-skip-ink:none] decoration-solid",children:"了解详情"})}):null]}),a.jsxs("button",{onClick:r,className:"mt-[12px] bg-[#0265ff] content-stretch flex gap-[6px] items-center pl-[16px] pr-[20px] py-[7px] rounded-[4px] cursor-pointer border-none",children:[a.jsx(P_,{}),a.jsx("span",{className:"text-[14px] text-white whitespace-nowrap leading-[normal]",children:n})]})]}),B_=({agent:e,className:t,onSelect:n,onLogClick:r})=>a.jsx("div",{className:j("bg-white border border-[#e0e0e0] border-solid content-stretch flex flex-col items-start p-[16px] rounded-[10px] w-full drop-shadow-[0px_0px_5px_rgba(0,0,0,0.04)] hover:drop-shadow-[0px_0px_8px_rgba(0,0,0,0.1)]",oe,t),onClick:n,children:a.jsxs("div",{className:"content-stretch flex flex-col gap-[12px] items-start w-full",children:[a.jsxs("div",{className:"content-stretch flex items-center justify-between w-full",children:[a.jsxs("div",{className:"content-stretch flex gap-[10px] items-center min-w-0",children:[a.jsx("img",{alt:e.name,className:"rounded-[20px] shrink-0 size-[40px] object-cover",src:e.icon}),a.jsx("p",{className:"font-bold leading-[normal] overflow-hidden shrink-0 text-[#030303] text-[18px] text-ellipsis whitespace-nowrap",children:e.name}),e.installCount!=null&&e.installCount>0&&a.jsx("div",{className:"bg-[#f5f7fa] content-stretch flex h-[26px] items-center justify-center px-[6px] py-[10px] rounded-[100px] shrink-0",children:a.jsxs("p",{className:"leading-[normal] shrink-0 text-[#4d609f] text-[12px] whitespace-nowrap",children:["安装次数:",e.installCount.toLocaleString()]})})]}),a.jsxs("div",{className:"content-stretch flex gap-[10px] items-center shrink-0",children:[e.version&&a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"leading-[normal] shrink-0 text-[#999] text-[12px] whitespace-nowrap",children:["版本:",e.version]}),a.jsx("div",{className:"h-[14px] shrink-0 w-[1px] bg-[#e0e0e0]"})]}),!!e.lastUpdated&&a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"leading-[normal] shrink-0 text-[#999] text-[12px] whitespace-nowrap",children:e.lastUpdated}),a.jsx("div",{className:"h-[14px] shrink-0 w-[1px] bg-[#e0e0e0]"})]}),a.jsx("button",{className:"bg-[#eff0f6] content-stretch flex flex-col h-[30px] items-center justify-center px-[16px] py-[7px] rounded-[4px] shrink-0 cursor-pointer border-none hover:bg-[#f0f6ff] group/select",onClick:n,children:a.jsx("span",{className:"leading-[normal] shrink-0 text-[#030303] text-[14px] whitespace-nowrap group-hover/select:text-[#0265ff]",children:"选择"})})]})]}),e.description&&a.jsx("p",{className:"leading-[normal] shrink-0 text-[#666] text-[14px] w-full line-clamp-2",children:e.description})]})}),z_=()=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:a.jsx("path",{d:"M6.5 8.5C7.05228 8.5 7.5 8.94772 7.5 9.5V14C7.5 14.5177 7.10667 14.9438 6.60254 14.9951L6.5 15H2L1.89746 14.9951C1.42703 14.9472 1.05278 14.573 1.00488 14.1025L1 14V9.5C1 8.94772 1.44772 8.5 2 8.5H6.5ZM14 8.5C14.5523 8.5 15 8.94772 15 9.5V14C15 14.5177 14.6067 14.9438 14.1025 14.9951L14 15H9.5L9.39746 14.9951C8.92703 14.9472 8.55278 14.573 8.50488 14.1025L8.5 14V9.5C8.5 8.94772 8.94772 8.5 9.5 8.5H14ZM9.5 14H14V9.5H9.5V14ZM2 14H6.5V9.5H2V14ZM6.5 1C7.05228 1 7.5 1.44772 7.5 2V6.5C7.5 7.01768 7.10667 7.44379 6.60254 7.49512L6.5 7.5H2L1.89746 7.49512C1.42703 7.44722 1.05278 7.07297 1.00488 6.60254L1 6.5V2C1 1.44772 1.44772 1 2 1H6.5ZM14 1C14.5523 1 15 1.44772 15 2V6.5C15 7.01768 14.6067 7.44379 14.1025 7.49512L14 7.5H9.5L9.39746 7.49512C8.92703 7.44722 8.55278 7.07297 8.50488 6.60254L8.5 6.5V2C8.5 1.44772 8.94772 1 9.5 1H14ZM2 6.5H6.5V2H2V6.5ZM9.5 6.5H14V2H9.5V6.5Z",fill:"#666666"})}),V_=[{id:"all-agent",label:"全部"},{id:"system-agent",label:"系统智能体",icon:a.jsx(z_,{})},{id:"custom-agent",label:"自定义智能体",icon:a.jsx(Jo,{})}],U_=({value:e,onChange:t,className:n})=>a.jsx("div",{className:j("flex flex-col",n),children:V_.map(r=>{const o=e===r.id;return a.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(r.id),className:j("flex items-center gap-[6px] w-full h-[34px] px-[10px] rounded-[4px] text-left",o?"bg-[#EFF0F6]":"hover:bg-[#EFF0F6]",oe),children:[r.icon&&a.jsx("span",{className:"shrink-0 size-[16px] flex items-center justify-center text-[#666666]",children:r.icon}),a.jsx("span",{className:j("text-[14px] text-[#030303] leading-[normal] whitespace-nowrap",o?"font-bold":"font-normal"),children:r.label})]},r.id)})}),O9=[{id:"newest",label:"最新"},{id:"oldest",label:"最早"}],Z_=({value:e="newest",onChange:t,className:n})=>{var c,u;const[r,o]=b.useState(!1),i=(u=(c=O9.find(d=>d.id===e))==null?void 0:c.label)!=null?u:"最新",{portalContainer:s,setTriggerRef:l}=Gn("data-bs-weekdays-select-portal");return a.jsxs(ht,{open:r,onOpenChange:o,children:[a.jsx(mt,{asChild:!0,children:a.jsxs("button",{type:"button",ref:l,className:j("flex items-center gap-[6px] px-[10px] h-[34px] rounded-[4px] bg-transparent","text-[14px] text-[#030303] leading-[normal] whitespace-nowrap","hover:bg-[#EFF0F6]",r&&"bg-[#EFF0F6]",oe,n),children:[a.jsx(on,{code:"",className:"text-[16px]"}),a.jsx("span",{children:i})]})}),a.jsx(ut,{align:"start",sideOffset:4,className:"w-auto min-w-[100px] rounded-[4px] bg-white p-[4px] shadow-[0px_0px_8px_rgba(0,0,0,0.1)]",portalContainer:s,children:O9.map(d=>{const f=e===d.id;return a.jsxs("button",{type:"button",onClick:()=>{t==null||t(d.id),o(!1)},className:j("flex items-center justify-between w-full h-[34px] px-[10px] rounded-[4px] text-left",f?"bg-[#EFF0F6] text-[#0265FF]":"bg-white text-[#030303] hover:bg-[#EFF0F6]",oe),children:[a.jsx("span",{className:"text-[14px] leading-[normal] whitespace-nowrap",children:d.label}),a.jsx(gw,{size:16,className:j("shrink-0",f?"opacity-100":"opacity-0")})]},d.id)})})]})},I9=300,W_=()=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:a.jsx("path",{d:"M13.9004 15H2.65039C2.25257 15 1.87104 14.842 1.58973 14.5607C1.30843 14.2794 1.15039 13.8978 1.15039 13.5V4.5C1.15039 4.10218 1.30843 3.72064 1.58973 3.43934C1.87104 3.15804 2.25257 3 2.65039 3H7.15039L8.65039 4.5H13.9004C14.0974 4.5 14.2924 4.5388 14.4744 4.61418C14.6564 4.68956 14.8218 4.80005 14.9611 4.93934C15.1003 5.07863 15.2108 5.24399 15.2862 5.42597C15.3616 5.60796 15.4004 5.80302 15.4004 6H2.65039V13.5L4.25539 7.5H16.0754C16.1927 7.49595 16.3093 7.51947 16.4158 7.56867C16.5223 7.61788 16.6158 7.69139 16.6888 7.78331C16.7617 7.87523 16.8121 7.98298 16.8358 8.0979C16.8595 8.21282 16.856 8.33171 16.8254 8.445L15.3704 13.875C15.2865 14.1999 15.0961 14.4873 14.8296 14.6913C14.5631 14.8952 14.2359 15.0039 13.9004 15Z",fill:"#6F81BD"})}),G_=()=>a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:a.jsx("path",{d:"M3 3L9 9M9 3L3 9",stroke:"#999999",strokeWidth:"1.2",strokeLinecap:"round"})}),$_=()=>a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:[a.jsx("circle",{cx:"2",cy:"6",r:"1",fill:"#999999"}),a.jsx("circle",{cx:"6",cy:"6",r:"1",fill:"#999999"}),a.jsx("circle",{cx:"10",cy:"6",r:"1",fill:"#999999"})]}),D9={0:"pl-[10px]",1:"pl-[32px]",2:"pl-[54px]",3:"pl-[76px]"};function R9(e){var t;return(t=D9[Math.min(e,3)])!=null?t:D9[3]}function q_(e,t){const n=t.toLowerCase().trim(),r=new Map;for(const u of e){const d=u.parent||"0";r.has(d)||r.set(d,[]),r.get(d).push(u)}const o=new Set(e.map(u=>u.id)),i=new Set(r.keys()),s=Array.from(i).filter(u=>u==="0"||!o.has(u));function l(u,d){var h,m,g,x,C;const f=r.get(u)||[],p=[];for(const w of f){const k=w.itemType==="group",y=l(w.id,d+1),E=!n||((h=w==null?void 0:w.name)==null?void 0:h.toLowerCase().includes(n));k?(E||y.length>0)&&p.push({id:w.id,name:w.name,icon:(m=w.icon)!=null?m:0,type:(g=w.type)!=null?g:"group",itemType:"group",children:y,depth:d,form:w}):E&&p.push({id:w.id,name:w.name,icon:(x=w.icon)!=null?x:0,type:(C=w.type)!=null?C:"form",itemType:"form",children:[],depth:d,form:w})}return p}const c=[];for(const u of s)c.push(...l(u,0));return c}function Y_({item:e,depth:t,isSelected:n,onClick:r}){return a.jsx("div",{className:j("flex items-center justify-between h-[34px] px-[10px] cursor-pointer rounded-[4px] shrink-0",R9(t),n?"bg-[#F0F6FF] text-[#0265FF]":"text-[#030303] hover:bg-[#EFF0F6]",oe),onClick:r,children:a.jsxs("span",{className:"flex items-center gap-[6px] min-w-0 flex-1",children:[a.jsx(on,{name:e.icon}),a.jsx("span",{className:"text-[14px] leading-[normal] truncate",children:e.name})]})})}function P9({item:e,selectedIds:t,onSelect:n}){const[r,o]=b.useState(!0);return e.itemType==="group"?a.jsxs("div",{children:[a.jsxs("div",{className:j("flex items-center gap-[6px] h-[34px] px-[10px] cursor-pointer rounded-[4px]",R9(e.depth),"hover:bg-[#EFF0F6]",oe),onClick:()=>o(!r),children:[a.jsx("span",{className:j("shrink-0 flex items-center justify-center w-[16px] h-[16px] text-[#666666]",oe,r&&"rotate-90"),children:a.jsx(Fr,{className:"-rotate-90",size:16})}),a.jsx(W_,{}),a.jsx("span",{className:"text-[14px] text-[#030303] truncate",children:e.name})]}),r&&e.children.map(i=>a.jsx(P9,{item:i,selectedIds:t,onSelect:n},i.id))]}):a.jsx(Y_,{item:e,depth:e.depth,isSelected:t.has(e.id),onClick:()=>{e.form&&n(e.form)}})}function H9({searchQuery:e,onSearchChange:t,tree:n,selectedIds:r,onSelect:o,hasSearch:i,allowEmpty:s,emptyLabel:l,onEmptySelect:c}){return a.jsxs("div",{className:j("bg-white rounded-[10px] shadow-[0px_0px_5px_rgba(0,0,0,0.04)] p-[4px]","flex min-h-0 flex-col gap-[4px] overflow-hidden"),style:{maxHeight:I9},children:[a.jsxs("div",{className:"flex shrink-0 items-center gap-[6px] border border-[#E0E0E0] rounded-[4px] h-[30px] px-[10px] py-[5px]",children:[a.jsx(gn,{}),a.jsx("input",{type:"text",value:e,onChange:u=>t(u.target.value),placeholder:"输入表单名称来搜索",className:"flex-1 outline-none text-[14px] placeholder:text-[#999999] bg-transparent min-w-0 text-[#030303]"})]}),s&&!i&&a.jsx("div",{className:j("flex items-center h-[34px] px-[10px] cursor-pointer rounded-[4px] shrink-0",r.size===0?"bg-[#F0F6FF] text-[#0265FF]":"text-[#030303] hover:bg-[#EFF0F6]",oe),onClick:c,children:a.jsx("span",{className:"text-[14px] leading-[normal] truncate",children:l})}),a.jsx("div",{className:"flex min-h-0 flex-col gap-0 overflow-y-auto",children:n.length>0?n.map(u=>a.jsx(P9,{item:u,selectedIds:r,onSelect:o},u.id)):i?a.jsx("div",{className:"text-[12px] text-[#999999] py-[8px] text-center",children:"无匹配结果"}):a.jsx("div",{className:"text-[12px] text-[#999999] py-[8px] text-center",children:"暂无表单"})})]})}const Ac=b.forwardRef(({items:e,multiple:t=!1,value:n,defaultValue:r,onChange:o,placeholder:i="请选择表单",disabled:s=!1,className:l,allowEmpty:c=!1,emptyLabel:u="无",maxVisibleChips:d=4,popoverOnly:f},p)=>{var le;const[h,m]=b.useState(!1),[g,x]=b.useState(""),[C,w]=b.useState(r),k=b.useRef(null),y=b.useRef(null),[E,v]=b.useState(null),{popoverStyle:_,updatePopoverPosition:L}=sc(k,{estimatedHeight:I9}),T=n!=null?n:C,M=b.useMemo(()=>Array.isArray(T)?new Set(T):new Set(T?[T]:[]),[T]),B=Array.isArray(T)?void 0:T,P=b.useMemo(()=>q_(e,g),[e,g]),A=b.useMemo(()=>{var Q;return B&&(Q=e.find(ee=>ee.id===B&&ee.itemType!=="group"))!=null?Q:null},[e,B]),O=b.useMemo(()=>t?e.filter(Q=>M.has(Q.id)&&Q.itemType!=="group"):[],[t,e,M]),H=O.slice(0,d),I=O.length-H.length,V=g.trim().length>0,z=b.useCallback(Q=>{if(k.current=Q,!Q){v(null);return}const ee=Q.getRootNode();if(ee instanceof ShadowRoot){const J=ee.querySelector("[data-bs-form-select-portal]");if(J){v(J);return}const ie=ee.getElementById("ai-office-container")||ee,ve=document.createElement("div");ve.setAttribute("data-bs-form-select-portal","true"),ie.appendChild(ve),v(ve);return}v(null)},[]),$=b.useCallback(()=>{m(!1),x("")},[]),N=b.useCallback(()=>{s||(h?$():(m(!0),L()))},[s,h,$,L]),U=b.useCallback(Q=>{if(!t){w(Q.id),o==null||o({form:Q}),$();return}const ee=M.has(Q.id)?[...M].filter(J=>J!==Q.id):[...M,Q.id];w(ee),o==null||o({forms:e.filter(J=>ee.includes(J.id)&&J.itemType!=="group")})},[t,M,e,o,$]),te=b.useCallback((Q,ee)=>{if(ee.stopPropagation(),s)return;const J=[...M].filter(ie=>ie!==Q);w(J),o==null||o({forms:e.filter(ie=>J.includes(ie.id)&&ie.itemType!=="group")})},[s,M,e,o]),F=b.useCallback(()=>{w(""),o==null||o({}),$()},[o,$]);b.useEffect(()=>{var ie;if(!h)return;const Q=(ie=k.current)==null?void 0:ie.getRootNode(),ee=Q!=null?Q:document,J=ve=>{const ye=ve.target;y.current&&y.current.contains(ye)||k.current&&k.current.contains(ye)||$()};return ee.addEventListener("mousedown",J),()=>{ee.removeEventListener("mousedown",J)}},[h,$]),b.useEffect(()=>{if(!h)return;const Q=()=>{L()};return window.addEventListener("resize",Q),()=>window.removeEventListener("resize",Q)},[h,L]),b.useLayoutEffect(()=>{if(!h)return;let Q;const ee=()=>{L(),Q=requestAnimationFrame(ee)};return Q=requestAnimationFrame(ee),()=>cancelAnimationFrame(Q)},[h,L]),b.useEffect(()=>{var ie;if(!h)return;const Q=ve=>{ve.key==="Escape"&&$()},ee=(ie=k.current)==null?void 0:ie.getRootNode(),J=ee!=null?ee:document;return J.addEventListener("keydown",Q),()=>J.removeEventListener("keydown",Q)},[h,$]),b.useEffect(()=>{if(!h)return;const Q=y.current;if(!Q)return;const ee=J=>J.stopPropagation();return Q.addEventListener("mousedown",ee),Q.addEventListener("pointerdown",ee),Q.addEventListener("wheel",ee),()=>{Q.removeEventListener("mousedown",ee),Q.removeEventListener("pointerdown",ee),Q.removeEventListener("wheel",ee)}},[h]);const re=t&&O.length>0;return f?a.jsx(H9,{searchQuery:g,onSearchChange:x,tree:P,selectedIds:M,onSelect:U,hasSearch:V,allowEmpty:c&&!t,emptyLabel:u,onEmptySelect:F}):a.jsxs("div",{ref:p,className:j("relative inline-flex min-w-0 w-full",l),children:[a.jsxs("div",{ref:z,className:j("flex items-center gap-[10px] px-[10px] py-[7px] rounded-[4px] cursor-pointer select-none w-full","bg-white border",h?"border-[#0265FF]":"border-[#E0E0E0] hover:border-[#0265FF]",oe,s&&"opacity-50 cursor-not-allowed"),onClick:N,children:[re?a.jsxs("span",{className:"flex items-center gap-[4px] min-w-0 flex-1 overflow-x-auto scrollbar-hide",children:[H.map(Q=>{var ee;return a.jsxs("span",{className:"flex items-center gap-[4px] bg-[#EEEEEE] rounded-[2px] h-[26px] px-[6px] shrink-0 max-w-[160px]",onClick:J=>te(Q.id,J),children:[a.jsx(on,{name:(ee=Q.icon)!=null?ee:0,style:{fontSize:14}}),a.jsx("span",{className:"text-[14px] text-[#030303] truncate leading-[normal]",children:Q.name}),a.jsx("span",{className:"cursor-pointer flex items-center shrink-0 hover:bg-[#EFF0F6]",children:a.jsx(G_,{})})]},Q.id)}),I>0&&a.jsxs("span",{className:"flex items-center gap-[4px] bg-[#EEEEEE] rounded-[2px] h-[26px] px-[6px] shrink-0",children:[a.jsxs("span",{className:"text-[14px] text-[#030303] leading-[normal]",children:["+",I]}),a.jsx($_,{})]})]}):a.jsx("span",{className:"flex items-center gap-[6px] min-w-0 flex-1",children:A?a.jsxs(a.Fragment,{children:[a.jsx(on,{name:(le=A.icon)!=null?le:0}),a.jsx("span",{className:"text-[14px] text-[#030303] leading-[normal] truncate",children:A.name})]}):a.jsx("span",{className:"text-[14px] text-[#999999] leading-[normal] truncate",children:c&&!t?u:i})}),a.jsx("span",{className:j("shrink-0 flex items-center justify-center w-[16px] h-[16px] text-[#666666]",oe,h&&"rotate-180"),children:a.jsx(Fr,{size:16})})]}),h&&at.createPortal(a.jsx("div",{ref:y,className:"flex flex-col",style:_,children:a.jsx(H9,{searchQuery:g,onSearchChange:x,tree:P,selectedIds:M,onSelect:U,hasSearch:V,allowEmpty:c&&!t,emptyLabel:u,onEmptySelect:F})}),E||document.body)]})});Ac.displayName="FormSelect";function B9(e){var n;const t=e.type==="group";return{id:e.entryId,label:e.name,type:t?"formGroup":"form",formIcon:e.icon,data:t?void 0:e,children:(n=e.child)==null?void 0:n.map(B9)}}function z9(e){const t=e.formList;if(!t)return[];const n=[],r=o=>{o!=null&&o.length&&n.push(...o.map(B9))};return r(t.form),r(t.dash),r(t.aggregate_table),r(t.etl_table),n}function V9(e){var t;return{id:e._id,label:e.appname,type:"app",appIcon:(t=e.style)==null?void 0:t.icon,children:z9(e)}}function Tc(e,t){var i,s;const n=(i=e==null?void 0:e.items)!=null?i:[];if(!t)return[{key:"all",nodes:n.map(l=>{var c;return{id:l._id,label:l.name,type:"appGroup",children:((c=l.apps)!=null?c:[]).map(V9)}})}];let r=[];for(const l of n){const c=((s=l.apps)!=null?s:[]).find(u=>u._id===t);if(c){r=z9(c);break}}const o=n.map(l=>{var c;return{id:l._id,label:l.name,type:"appGroup",children:((c=l.apps)!=null?c:[]).filter(u=>u._id!==t).map(V9)}});return[{key:"current",title:"当前应用表单",nodes:r},{key:"other",title:"其他应用表单",nodes:o}]}function K_(e){const t=new Set,n=r=>{for(const o of r)o.children&&o.children.length>0&&(t.add(o.id),n(o.children))};return n(e),t}function X_(e,t){const n=t.trim().toLowerCase();if(!n)return e;const r=o=>{const i=[];for(const s of o){const l=s.label.toLowerCase().includes(n),c=s.children?r(s.children):[];(l||c.length>0)&&i.push({...s,children:c.length>0?c:s.children})}return i};return r(e)}function Q_(e){const[t,n]=b.useState(""),[r,o]=b.useState(new Set),i=b.useCallback(u=>!r.has(u),[r]),s=b.useCallback(u=>{o(d=>{const f=new Set(d);return f.has(u)?f.delete(u):f.add(u),f})},[]),l=b.useMemo(()=>{const u=t.trim().length>0;return e.map(d=>({...d,nodes:X_(d.nodes,t),searching:u}))},[e,t]),c=b.useMemo(()=>l.reduce((u,d)=>u+U9(d.nodes),0),[l]);return{searchQuery:t,setSearchQuery:n,filteredSections:l,isExpanded:i,toggleExpanded:s,searching:t.trim().length>0,hasResult:c>0,expandableIds:b.useMemo(()=>K_(e.reduce((u,d)=>u.concat(d.nodes),[])),[e])}}function U9(e){let t=0;for(const n of e)n.children&&n.children.length>0?t+=U9(n.children):t+=1;return t}const Z9=()=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:a.jsx("path",{d:"M13.9004 15H2.65039C2.25257 15 1.87104 14.842 1.58973 14.5607C1.30843 14.2794 1.15039 13.8978 1.15039 13.5V4.5C1.15039 4.10218 1.30843 3.72064 1.58973 3.43934C1.87104 3.15804 2.25257 3 2.65039 3H7.15039L8.65039 4.5H13.9004C14.0974 4.5 14.2924 4.5388 14.4744 4.61418C14.6564 4.68956 14.8218 4.80005 14.9611 4.93934C15.1003 5.07863 15.2108 5.24399 15.2862 5.42597C15.3616 5.60796 15.4004 5.80302 15.4004 6H2.65039V13.5L4.25539 7.5H16.0754C16.1927 7.49595 16.3093 7.51947 16.4158 7.56867C16.5223 7.61788 16.6158 7.69139 16.6888 7.78331C16.7617 7.87523 16.8121 7.98298 16.8358 8.0979C16.8595 8.21282 16.856 8.33171 16.8254 8.445L15.3704 13.875C15.2865 14.1999 15.0961 14.4873 14.8296 14.6913C14.5631 14.8952 14.2359 15.0039 13.9004 15Z",fill:"#6F81BD"})}),J_=({expanded:e})=>a.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",className:j("shrink-0",oe),style:{transform:e?"rotate(0deg)":"rotate(-90deg)"},children:a.jsx("path",{d:"M6 8L9 11L12 8",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),W9=({sections:e,value:t,onSelect:n,searchPlaceholder:r="输入应用/表单名称来搜索",maxHeight:o=400,className:i})=>{const{searchQuery:s,setSearchQuery:l,filteredSections:c,isExpanded:u,toggleExpanded:d,searching:f,hasResult:p}=Q_(e),h=b.useCallback(g=>{const x=g.children&&g.children.length>0;if(x||g.type!=="form"){x&&d(g.id);return}g.data&&n({appId:g.data.appId,entryId:g.data.entryId,form:g.data})},[n,d]),m=(g,x)=>{const C=g.children&&g.children.length>0,w=f||u(g.id),k=g.type==="form"&&t===g.id,y=x*22+10;return a.jsxs("div",{children:[a.jsxs("button",{type:"button",onClick:()=>h(g),className:j("flex items-center gap-[6px] w-full h-[34px] rounded-[4px] text-left pr-[10px] py-[10px]",oe,k?"bg-[#EFF0F6] text-[#030303]":"text-[#030303] hover:bg-[#EFF0F6]"),style:{paddingLeft:`${y}px`},children:[C&&a.jsx(J_,{expanded:w}),g.type==="appGroup"||g.type==="formGroup"?a.jsx(Z9,{}):null,g.type==="app"&&g.appIcon!=null&&a.jsx(Zd,{name:g.appIcon}),g.type==="form"&&g.formIcon!=null&&a.jsx(on,{name:g.formIcon}),a.jsx("span",{className:"text-[14px] truncate leading-[normal] flex-1 min-w-0",children:g.label})]}),C&&w&&a.jsx("div",{children:g.children.map(E=>m(E,x+1))})]},g.id)};return a.jsxs("div",{className:j("flex flex-col gap-[4px]",i),children:[a.jsxs("div",{className:"flex items-center gap-[6px] border border-[#E0E0E0] rounded-[4px] h-[30px] px-[10px] py-[5px]",children:[a.jsx(gn,{}),a.jsx("input",{type:"text",value:s,onChange:g=>l(g.target.value),placeholder:r,className:"flex-1 outline-none text-[14px] placeholder:text-[#999999] bg-transparent min-w-0 text-[#030303]"})]}),a.jsx("div",{className:"overflow-y-auto",style:{maxHeight:o,scrollbarWidth:"none"},"data-vaul-no-drag":!0,children:p?c.map(g=>a.jsxs("div",{children:[g.title&&a.jsxs("div",{className:"flex flex-col justify-between h-[32px] pr-[10px] pt-[9px]",children:[a.jsxs("div",{className:"flex items-center gap-[6px]",children:[a.jsx(Z9,{}),a.jsx("span",{className:"text-[12px] text-[#666666] leading-[normal]",children:g.title})]}),a.jsx("div",{className:"h-px bg-[#E0E0E0] mt-[7px]"})]}),g.nodes.map(x=>m(x,0))]},g.key)):a.jsx("div",{className:"flex items-center justify-center h-[60px] text-[12px] text-[#999999]",children:f?"未找到相关应用/表单":"暂无可选表单"})})]})},eN=({open:e})=>a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:j("shrink-0",oe),style:{transform:e?"rotate(180deg)":"rotate(0deg)"},children:a.jsx("path",{d:"M4 6L8 10L12 6",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})});function tN(e,t){if(!t)return null;let n=null;const r=o=>{for(const i of o){if(n)return;if(i.type==="form"&&i.id===t){n={label:i.label,formIcon:i.formIcon};return}i.children&&r(i.children)}};return e.forEach(o=>r(o.nodes)),n}const nN=({data:e,currentAppId:t,value:n,defaultValue:r,onChange:o,placeholder:i="请选择表单",searchPlaceholder:s,disabled:l=!1,className:c})=>{var _;const[u,d]=b.useState(!1),[f,p]=b.useState(r!=null?r:""),[h,m]=b.useState(null),[g,x]=b.useState(0),C=b.useRef(null),w=n!==void 0?n:f,k=b.useMemo(()=>Tc(e,t),[e,t]),y=b.useMemo(()=>tN(k,w),[k,w]),E=b.useCallback(L=>{if(C.current=L,L&&x(L.offsetWidth),!L){m(null);return}const T=L.getRootNode();if(T instanceof ShadowRoot){const M=T.querySelector("[data-bs-team-form-select-portal]");if(M){m(M);return}const B=document.createElement("div");B.setAttribute("data-bs-team-form-select-portal","true"),T.appendChild(B),m(B)}else m(null)},[]),v=b.useCallback(L=>{n===void 0&&p(L.entryId),o==null||o(L),d(!1)},[n,o]);return a.jsx("div",{className:j("relative",c),children:a.jsxs(ht,{open:u,onOpenChange:L=>{l||(d(L),L&&C.current&&x(C.current.offsetWidth))},children:[a.jsx(mt,{asChild:!0,children:a.jsxs("button",{ref:E,type:"button",disabled:l,className:j("flex items-center justify-between w-full h-[34px] gap-2.5 px-[10px]","bg-white border border-[#E0E0E0] rounded-[4px]","text-left cursor-pointer hover:border-[#0265FF]",l&&"opacity-50 cursor-not-allowed hover:border-[#E0E0E0]",u&&"border-[#0265FF]",oe),children:[a.jsx("span",{className:j("text-[14px] leading-[normal] truncate",y?"text-[#030303]":"text-[#999999]"),children:(_=y==null?void 0:y.label)!=null?_:i}),a.jsx(eN,{open:u})]})}),a.jsx(ut,{align:"start",sideOffset:4,portalContainer:h,className:"!border-0 rounded-[10px] shadow-[0px_0px_5px_rgba(0,0,0,0.04)] p-[12px]",style:{minWidth:g||void 0},children:a.jsx(W9,{sections:k,value:w,onSelect:v,searchPlaceholder:s})})]})})},rN=({data:e,currentAppId:t,value:n,onChange:r,open:o,defaultOpen:i,onOpenChange:s,searchPlaceholder:l,trigger:c,status:u,onRetry:d})=>{const[f,p]=b.useState(i!=null?i:!1),h=o!==void 0?o:f,m=b.useMemo(()=>Tc(e,t),[e,t]),g=b.useCallback(C=>{o===void 0&&p(C),s==null||s(C)},[o,s]),x=b.useCallback(C=>{r==null||r(C),g(!1)},[r,g]);return a.jsxs(a.Fragment,{children:[c&&a.jsx("span",{onClick:()=>g(!0),children:c}),a.jsx(ul,{open:h,onOpenChange:g,direction:"left",width:300,title:"切换表单",children:a.jsx("div",{className:"h-full overflow-hidden p-[12px]",children:u==="error"?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-[12px]",children:[a.jsx("span",{className:"text-[12px] text-[#999999]",children:"应用/表单加载失败"}),d&&a.jsx("button",{type:"button",onClick:d,className:"h-[30px] px-[16px] rounded-[4px] border border-[#E0E0E0] text-[14px] text-[#0265FF] active:bg-[#F0F6FF]",children:"重试"})]}):u==="loading"?a.jsx("div",{className:"flex items-center justify-center h-full text-[12px] text-[#999999]",children:"加载中…"}):a.jsx(W9,{sections:m,value:n,onSelect:x,searchPlaceholder:l,maxHeight:"calc(100vh - 60px)"})})})]})},oN=()=>a.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("rect",{x:"0.5",y:"0.5",width:"7",height:"7",rx:"1",fill:"#0265ff"})}),Pn=S.forwardRef(({className:e,children:t,id:n,readonly:r,disabled:o,intermediate:i,...s},l)=>{const c=S.useId(),u=n!=null?n:c;return a.jsxs("label",{htmlFor:u,className:j("inline-flex items-center gap-[6px] select-none text-[#121111] text-[14px]",o?"cursor-not-allowed":"cursor-pointer",{"pointer-events-none":r}),children:[a.jsx(TS,{ref:l,id:u,disabled:o,className:j("inline-flex shrink-0 items-center justify-center","w-[16px] h-[16px] rounded-[2px] box-border border","transition-colors duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#0265FF] focus-visible:ring-offset-1","border-[#E0E0E0] bg-white","hover:border-[#0265FF]","data-[state=checked]:bg-[#0265FF] data-[state=checked]:border-[#0265FF]","disabled:cursor-not-allowed disabled:bg-[#F0F0F0] disabled:border-[#C2C2C2]","disabled:data-[state=checked]:bg-[#C2C2C2] disabled:data-[state=checked]:border-[#C2C2C2]",i&&"bg-white border-[#0265FF] text-[#0265FF]",e,{"opacity-50":r}),...s,children:a.jsx(jS,{className:"text-white",forceMount:i||void 0,children:i?a.jsx(oN,{}):a.jsx(al,{})})}),t!=null&&a.jsx("span",{className:j("text-sm leading-none",o&&"text-[#C2C2C2]"),children:t})]})});Pn.displayName="SquareChecker";function iN(e){return e.map(t=>({id:t._id,label:t.name,type:"group",children:t.apps.map(n=>{var r;return{id:n._id,label:n.appname,type:"app",color:String(((r=n.style)==null?void 0:r.color)||"#666666"),data:n}})}))}const G9=()=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:a.jsx("path",{d:"M13.9004 15H2.65039C2.25257 15 1.87104 14.842 1.58973 14.5607C1.30843 14.2794 1.15039 13.8978 1.15039 13.5V4.5C1.15039 4.10218 1.30843 3.72064 1.58973 3.43934C1.87104 3.15804 2.25257 3 2.65039 3H7.15039L8.65039 4.5H13.9004C14.0974 4.5 14.2924 4.5388 14.4744 4.61418C14.6564 4.68956 14.8218 4.80005 14.9611 4.93934C15.1003 5.07863 15.2108 5.24399 15.2862 5.42597C15.3616 5.60796 15.4004 5.80302 15.4004 6H2.65039V13.5L4.25539 7.5H16.0754C16.1927 7.49595 16.3093 7.51947 16.4158 7.56867C16.5223 7.61788 16.6158 7.69139 16.6888 7.78331C16.7617 7.87523 16.8121 7.98298 16.8358 8.0979C16.8595 8.21282 16.856 8.33171 16.8254 8.445L15.3704 13.875C15.2865 14.1999 15.0961 14.4873 14.8296 14.6913C14.5631 14.8952 14.2359 15.0039 13.9004 15Z",fill:"#6F81BD"})}),sN=({expanded:e})=>a.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",className:j("shrink-0",oe),style:{transform:e?"rotate(0deg)":"rotate(-90deg)"},children:a.jsx("path",{d:"M6 8L9 11L12 8",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),aN=()=>a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:a.jsx("path",{d:"M3 3L9 9M9 3L3 9",stroke:"#999999",strokeWidth:"1.2",strokeLinecap:"round"})}),lN=()=>a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:[a.jsx("circle",{cx:"2",cy:"6",r:"1",fill:"#999999"}),a.jsx("circle",{cx:"6",cy:"6",r:"1",fill:"#999999"}),a.jsx("circle",{cx:"10",cy:"6",r:"1",fill:"#999999"})]}),$9=({open:e})=>a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:j("shrink-0",oe),style:{transform:e?"rotate(180deg)":"rotate(0deg)"},children:a.jsx("path",{d:"M4 6L8 10L12 6",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),Js="__all__";function cN(e){const t=new Map,n=r=>{for(const o of r)t.set(o.id,o),o.children&&n(o.children)};return n(e),t}const uN=({nodes:e,mode:t="single",popoverContentOnly:n,showAll:r=!1,allowEmpty:o=!1,emptyLabel:i="无",value:s,defaultValue:l,onChange:c,placeholder:u="请选择",searchPlaceholder:d="输入应用名称来搜索",disabled:f=!1,maxVisibleChips:p=4,className:h,contentCls:m,disableMaxHeight:g})=>{const[x,C]=b.useState(!1),[w,k]=b.useState(""),[y,E]=b.useState(l!=null?l:t==="multiple"?[]:""),[v,_]=b.useState(null),[L,T]=b.useState(0),M=b.useRef(null),B=qe({"max-h-[400px]":!g,"max-h-full":g}),[P,A]=b.useState(()=>{const W=new Set,K=(Y,se)=>{for(const ne of Y)ne.children&&ne.children.length>0&&se<2&&(W.add(ne.id),K(ne.children,se+1))};return K(e,0),W}),O=s!==void 0?s:y,H=b.useMemo(()=>cN(e),[e]),I=b.useMemo(()=>t==="multiple"?new Set(Array.isArray(O)?O:[]):new Set(typeof O=="string"&&O?[O]:[]),[O,t]),V=b.useMemo(()=>(Array.isArray(O)?O:O?[O]:[]).map(K=>{var Y,se;return(se=(Y=H.get(K))==null?void 0:Y.label)!=null?se:K}),[O,H]),z=t==="single"&&V.length===1?V[0]===Js?"全部应用":V[0]:null,$=b.useMemo(()=>{if(!w.trim())return e;const W=w.toLowerCase(),K=Y=>{var ne;const se=[];for(const xe of Y){const ae=(ne=xe==null?void 0:xe.label)==null?void 0:ne.toLowerCase().includes(W),Ie=xe.children?K(xe.children):[];(ae||Ie.length>0)&&se.push({...xe,children:Ie.length>0?Ie:xe.children})}return se};return K(e)},[e,w]),N=b.useCallback(W=>{if(M.current=W,W&&T(W.offsetWidth),!W){_(null);return}const K=W.getRootNode();if(K instanceof ShadowRoot){const Y=K.querySelector("[data-bs-app-select-portal]");if(Y){_(Y);return}const se=document.createElement("div");se.setAttribute("data-bs-app-select-portal","true"),K.appendChild(se),_(se)}else _(null)},[]),U=b.useCallback(W=>{s===void 0&&E(W),c==null||c(W)},[s,c]),te=b.useCallback(W=>{A(K=>{const Y=new Set(K);return Y.has(W)?Y.delete(W):Y.add(W),Y})},[]),F=b.useCallback((W,K)=>{if(K.type==="group"||K.children&&K.children.length>0){te(W);return}if(t==="single")U(W),C(!1);else{const Y=Array.isArray(O)?[...O]:[],se=Y.indexOf(W);se>=0?Y.splice(se,1):Y.push(W),U(Y)}},[t,O,U,te]),re=b.useCallback((W,K)=>{K.stopPropagation(),t==="multiple"&&Array.isArray(O)&&U(O.filter(Y=>Y!==W))},[t,O,U]),le=b.useCallback(W=>{f||(C(W),W&&M.current&&T(M.current.offsetWidth),W||k(""))},[f]),Q=t==="multiple"?V:[],ee=Q.slice(0,p),J=Q.length-ee.length,ie=b.useCallback((W,K)=>{var ae;const Y=W.children&&W.children.length>0,se=P.has(W.id),ne=I.has(W.id),xe=K*22+10;return a.jsxs("div",{children:[a.jsxs("button",{type:"button",onClick:()=>F(W.id,W),className:j("flex items-center gap-[6px] w-full h-[34px] rounded-[4px] text-left","pr-[10px]",oe,ne?"bg-[#F0F6FF] text-[#0265FF]":"text-[#030303] hover:bg-[#EFF0F6]"),style:{paddingLeft:`${xe}px`,paddingTop:"10px",paddingBottom:"10px"},children:[Y&&a.jsx(sN,{expanded:se}),W.type==="group"&&!Y&&a.jsx(G9,{}),W.type==="group"&&Y&&a.jsx(G9,{}),W.type==="app"&&a.jsx(Zd,{name:(ae=W.data)==null?void 0:ae.style.icon}),a.jsx("span",{className:"text-[14px] truncate leading-[normal] flex-1 min-w-0",children:W.label}),t==="multiple"&&!Y&&W.type!=="group"&&a.jsx("span",{onClick:Ie=>Ie.stopPropagation(),className:"grid place-items-center",children:a.jsx(Pn,{checked:ne,onCheckedChange:()=>F(W.id,W),className:"shrink-0"})})]}),Y&&se&&a.jsx("div",{children:W.children.map(Ie=>ie(Ie,K+1))})]},W.id)},[P,I,t,F]),ve=t==="multiple"&&Q.length>0,ye=a.jsxs("div",{className:qe("flex min-h-0 flex-col gap-[4px]",m),children:[a.jsxs("div",{className:"flex shrink-0 items-center gap-[6px] border border-[#E0E0E0] rounded-[4px] h-[30px] px-[10px] py-[5px]",children:[a.jsx(gn,{}),a.jsx("input",{type:"text",value:w,onChange:W=>k(W.target.value),placeholder:d,className:"flex-1 outline-none text-[14px] placeholder:text-[#999999] bg-transparent min-w-0 text-[#030303]"})]}),o&&t==="single"&&!w.trim()&&a.jsx("button",{type:"button",onClick:()=>{U(""),C(!1)},className:j("flex shrink-0 items-center w-full h-[34px] rounded-[4px] text-left","px-[10px]",oe,"text-[#030303] hover:bg-[#EFF0F6]"),children:a.jsx("span",{className:"text-[14px] leading-[normal]",children:i})}),r&&t==="single"&&!w.trim()&&a.jsx("button",{type:"button",onClick:()=>{U(Js),C(!1)},className:j("flex shrink-0 items-center w-full h-[34px] rounded-[4px] text-left","px-[10px]",oe,I.has(Js)?"bg-[#F0F6FF] text-[#0265FF]":"text-[#030303] hover:bg-[#EFF0F6]"),children:a.jsx("span",{className:"text-[14px] leading-[normal]",children:"全部应用"})}),a.jsx("div",{className:qe("min-h-0 overflow-y-auto",B),children:$.length>0?$.map(W=>ie(W,0)):a.jsx("div",{className:"flex items-center justify-center h-[60px] text-[12px] text-[#999999]",children:w.trim()?"未找到相关应用":"暂无应用"})})]});return n?ye:a.jsx("div",{className:j("relative",h),children:a.jsxs(ht,{open:x,onOpenChange:le,children:[a.jsx(mt,{asChild:!0,children:a.jsx("button",{ref:N,type:"button",disabled:f,className:j("flex items-center justify-between w-full h-[34px] gap-2.5","bg-white border border-[#E0E0E0] rounded-[4px]","py-[7px]",ve?"pl-[4px] pr-[10px]":"px-[10px]","text-left cursor-pointer","hover:border-[#0265FF]",f&&"opacity-50 cursor-not-allowed hover:border-[#E0E0E0]",x&&"border-[#0265FF]",oe),children:ve?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-[4px] min-w-0 flex-1 overflow-x-auto scrollbar-hide",children:[ee.map((W,K)=>a.jsxs("span",{className:"flex items-center gap-[4px] bg-[#EEEEEE] rounded-[2px] h-[26px] px-[6px] shrink-0 max-w-[160px]",onClick:Y=>{Y.stopPropagation();const se=Array.isArray(O)?O:[];se[K]&&re(se[K],Y)},children:[a.jsx("span",{className:"text-[14px] text-[#030303] truncate leading-[normal]",children:W}),a.jsx("span",{className:"cursor-pointer flex items-center shrink-0 hover:bg-[#EFF0F6]",children:a.jsx(aN,{})})]},K)),J>0&&a.jsxs("span",{className:"flex items-center gap-[4px] bg-[#EEEEEE] rounded-[2px] h-[26px] px-[6px] shrink-0",children:[a.jsxs("span",{className:"text-[14px] text-[#030303] leading-[normal]",children:["+",J]}),a.jsx(lN,{})]})]}),a.jsx($9,{open:x})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:j("text-[14px] leading-[normal] truncate",z?"text-[#030303]":"text-[#999999]"),children:z!=null?z:o?i:u}),a.jsx($9,{open:x})]})})}),a.jsx(ut,{align:"start",sideOffset:4,portalContainer:v,className:"flex flex-col overflow-hidden !border-0 rounded-[10px] shadow-[0px_0px_5px_rgba(0,0,0,0.04)] p-[4px]",style:{minWidth:L||void 0,maxHeight:300},children:ye})]})})},Fc=({defaultChecked:e=!1,checked:t,onCheckedChange:n,title:r,description:o,disabled:i=!1,className:s})=>{const[l,c]=b.useState(!!e),u=t!==void 0,d=u?!!t:l,f=b.useRef(d);f.current=d;const p=h=>{if(h.target!==h.currentTarget||i)return;const m=!f.current;u||c(m),n==null||n(m)};return a.jsxs("div",{role:"button",tabIndex:i?-1:0,"aria-checked":d,"aria-disabled":i,onClick:p,onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),p(h))},className:j("flex flex-col gap-[6px] p-[10px] rounded-[4px] cursor-pointer select-none bg-white","border",d?"border-[#0265FF]":"border-[#E0E0E0]",i&&"cursor-not-allowed opacity-50",s),children:[a.jsxs("div",{className:"inline-flex items-center gap-[6px] pointer-events-none",children:[a.jsx(Pn,{checked:d,disabled:i}),a.jsx("span",{className:"text-[#121111] text-[14px]",children:r})]}),o!=null&&a.jsx("p",{className:"text-[#666] text-[12px] pl-[22px] pointer-events-none",children:o})]})},dN=[{type:"submit",title:"表单提交数据"},{type:"edit",title:"表单编辑数据"},{type:"delete",title:"表单删除数据"},{type:"init",title:"表单初始化"},{type:"edit_init",title:"表单编辑初始化"}],fN=({multiple:e=!1,value:t,onChange:n})=>{const r=e?Array.isArray(t)?t:[]:null;return a.jsx("div",{className:"flex gap-[20px]",children:dN.map(o=>{const i=e?r.includes(o.type):t===o.type;return a.jsx(Fc,{className:"flex-[1_0_0] min-w-px",title:o.title,checked:i,onCheckedChange:s=>{if(e){const l=s?[...r,o.type]:r.filter(c=>c!==o.type);n==null||n(l)}else s&&(n==null||n(o.type))}},o.type)})})},pN=[{type:"flow_end",title:"流程结束"},{type:"flow_node",title:"流程节点"}],hN=({multiple:e=!1,value:t,onChange:n})=>{const r=e?Array.isArray(t)?t:[]:null;return a.jsx("div",{className:"flex gap-[20px]",children:pN.map(o=>{const i=e?r.includes(o.type):t===o.type;return a.jsx(Fc,{className:"flex-[1_0_0] min-w-px max-w-[216px]",title:o.title,checked:i,onCheckedChange:s=>{if(e){const l=s?[...r,o.type]:r.filter(c=>c!==o.type);n==null||n(l)}else s&&(n==null||n(o.type))}},o.type)})})},mN=[{value:"custom",label:"自定义时间"},{value:"date_field",label:"根据表单日期时间字段"}],q9=({value:e,onChange:t,placeholder:n="请选择时间来源类型",disabled:r=!1,className:o})=>a.jsxs(er,{value:e,onValueChange:i=>t==null?void 0:t(i),disabled:r,children:[a.jsx(Fn,{className:o,children:a.jsx(tr,{placeholder:n})}),a.jsx(jn,{children:mN.map(i=>a.jsx(On,{value:i.value,children:i.label},i.value))})]}),jc=1e3,Oc=2999,Ic=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],gN=["一","二","三","四","五","六","日"];function xN(e,t){const o=(new Date(e,t,1).getDay()-1+7)%7;return new Date(e,t,1-o)}function Y9(e,t){return new Date(e,t+1,0).getDate()}function K9(e,t,n){const r=e.h*36e5+e.m*6e4+e.s*1e3+e.ms,o=t.h*36e5+t.m*6e4+t.s*1e3+t.ms,i=n.h*36e5+n.m*6e4+n.s*1e3+n.ms;return r>=o&&r<=i}function bo(e,t,n,r,o="day"){if(o==="year"){const l=e.getFullYear();return l>=t.getFullYear()&&l<=n.getFullYear()}if(o==="month"){const l=e.getFullYear(),c=e.getMonth(),u=t.getFullYear(),d=t.getMonth(),f=n.getFullYear(),p=n.getMonth();return!(l<u||l>f||l===u&&c<d||l===f&&c>p)}e.setHours(0,0,0,0);const i=new Date(t);i.setHours(0,0,0,0);const s=new Date(n);return s.setHours(0,0,0,0),!(e<i||e>s||r&&r.length>0&&!r.includes(e.getDay()))}function bN(e,t,n){const r=e.getTime(),o=t.getTime(),i=n.getTime();return r<o?new Date(t):r>i?new Date(n):new Date(e)}function X9(e,t,n){if(n==="year")return e.getFullYear()>t.getFullYear();const r=e.getFullYear(),o=e.getMonth(),i=t.getFullYear(),s=t.getMonth();return r>i||r===i&&o>s}function Q9(e,t,n){if(n==="year")return e.getFullYear()<t.getFullYear();const r=e.getFullYear(),o=e.getMonth(),i=t.getFullYear(),s=t.getMonth();return r<i||r===i&&o<s}function e1(e,t){const n=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0"),i=String(e.getHours()).padStart(2,"0"),s=String(e.getMinutes()).padStart(2,"0"),l=String(e.getSeconds()).padStart(2,"0");return t==="yyyy-MM-dd"?`${n}-${r}-${o}`:t==="yyyy-MM-dd HH:mm:ss"?`${n}-${r}-${o} ${i}:${s}:${l}`:t==="yyyy-MM-dd HH:mm"?`${n}-${r}-${o} ${i}:${s}`:t==="HH:mm:ss"?`${i}:${s}:${l}`:t==="HH:mm"?`${i}:${s}`:t==="yyyy-MM"?`${n}-${r}`:t==="yyyy"?`${n}`:`${n}-${r}-${o}`}const zr="text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px]",xi='text-[#999] relative pointer-events-none before:absolute before:left-0 before:right-0 before:top-1 before:h-[28px] before:bg-[#f3f3f3] before:opacity-60 before:content-[""]';function CN({year:e,month:t,day:n,format:r,minDate:o,maxDate:i,week:s,onYearReduce:l,onYearAdd:c,onMonthReduce:u,onMonthAdd:d,onMonthMenu:f,onYearMenu:p,onChangeDay:h}){const m=r.includes("dd"),g=b.useMemo(()=>{const x=xN(e,t),C=new Date,w=`${C.getFullYear()}-${C.getMonth()}-${C.getDate()}`,k=[],y=new Date(x);for(let E=0;E<6;E++){const v=[];for(let _=0;_<7;_++){const L=y.getDate(),T=y.getMonth(),M=y.getFullYear();let B=bo(new Date(M,T,L,0,0,0,0),o,i,s,"day")?"":"disabled";B||(t!==T?B="oday":(B="day",(_===5||_===6)&&(B+=" weekend"),`${M}-${T}-${L}`===w&&(B+=" today"),n===L&&t===T&&(B+=" selected"))),v.push({day:L,month:T,year:M,css:B,key:`d${M}-${T}-${L}`}),y.setDate(y.getDate()+1)}k.push(v)}for(;k.length>4&&k[k.length-1].every(E=>E.month!==t);)k.pop();return k},[e,t,n,o,i,s]);return m?a.jsxs(a.Fragment,{children:[a.jsxs("thead",{children:[a.jsxs("tr",{children:[a.jsx("td",{className:j(zr,"btn prevm hover:text-[#0265ff]",!X9(new Date(e,t,1),o,"year")&&"disabled "+xi),colSpan:1,onClick:l,children:a.jsx(bw,{size:14})}),a.jsx("td",{className:j(zr,"btn prevm hover:text-[#0265ff]",!X9(new Date(e,t,1),o,"month")&&"disabled "+xi),colSpan:1,onClick:u,children:a.jsx(Ls,{size:14})}),a.jsxs("td",{className:j(zr,"title font-bold p-0.5"),colSpan:3,children:[a.jsx("span",{className:"title-month mr-1.5 hover:text-[#0265ff] cursor-pointer",onClick:f,children:Ic[t]}),a.jsx("span",{children:", "}),a.jsx("span",{className:"title-year hover:text-[#0265ff] cursor-pointer",onClick:p,children:e})]}),a.jsx("td",{className:j(zr,"btn nextm hover:text-[#0265ff]",!Q9(new Date(e,t,1),i,"month")&&"disabled "+xi),colSpan:1,onClick:d,children:a.jsx(As,{size:14})}),a.jsx("td",{className:j(zr,"btn nextm hover:text-[#0265ff]",!Q9(new Date(e,t,1),i,"year")&&"disabled "+xi),colSpan:1,onClick:c,children:a.jsx(Cw,{size:14})})]}),a.jsx("tr",{children:gN.map((x,C)=>a.jsx("td",{className:j(zr,"day name week font-bold hover:bg-transparent hover:p-0 hover:border-none",(C===5||C===6)&&"text-[#e34d59]"),children:x},x))})]}),a.jsx("tbody",{children:g.slice(0,6).map((x,C)=>a.jsx("tr",{children:x.map(w=>{const k=w.css.includes("disabled"),y=w.css.includes("oday"),E=w.css.includes("today"),v=w.css.includes("selected"),_=w.css.includes("weekend");return a.jsx("td",{className:j(zr,k&&xi,y&&"text-[#e0e0e0] hover:bg-[rgba(2,101,255,0.08)]",!k&&!y&&"hover:bg-[rgba(2,101,255,0.08)]",E&&"font-bold text-[#0265ff]",_&&"text-[#e34d59]",v&&"font-bold p-[1px] text-white border border-[#0265ff] bg-[#0265ff] hover:border-[#0265ff] hover:bg-[#0265ff]"),onClick:()=>h(w.day,w.month,w.year,w.css),children:a.jsx("div",{className:"day-wrapper",children:a.jsx("div",{className:"day-item",children:w.day})})},w.key)})},C))})]}):null}const bi="text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px]",wN='text-[#999] relative pointer-events-none before:absolute before:left-0 before:right-0 before:top-[20px] before:h-[28px] before:bg-[#f3f3f3] before:opacity-60 before:content-[""]';function yN({year:e,month:t,showYear:n,position:r,minDate:o,maxDate:i,week:s,onYearReduce:l,onYearAdd:c,onYearMenu:u,onMountOk:d}){const f=p=>bo(p,o,i,s,"month");return a.jsxs("table",{cellSpacing:0,cellPadding:0,className:"mt bg-white rounded-[4px]",style:{position:r},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("td",{className:j(bi,"btn prevy hover:text-[#0265ff]"),colSpan:1,onClick:l,children:a.jsx(Ls,{size:14})}),a.jsx("td",{className:j(bi,"year title font-bold p-0.5"),colSpan:1,children:a.jsx("span",{className:"title-year hover:text-[#0265ff] cursor-pointer",onClick:u,children:e})}),a.jsx("td",{className:j(bi,"btn nexty hover:text-[#0265ff]"),colSpan:1,onClick:c,children:a.jsx(As,{size:14})})]})}),a.jsx("tbody",{children:[0,1,2,3].map(p=>a.jsx("tr",{children:[0,1,2].map(h=>{const m=p*3+h;if(m>11)return a.jsx("td",{className:bi},m);const g=f(new Date(e,m,1)),x=t===m&&!n,C=!g;return a.jsx("td",{className:j(bi,"month w-[58px] h-[38px] hover:bg-[rgba(2,101,255,0.08)]",x&&"font-bold p-[1px] text-white border border-[#0265ff] bg-[#0265ff] hover:border-[#0265ff] hover:bg-[#0265ff]",C&&wN),onClick:()=>{C||d(m)},children:Ic[m]},m)})},p))})]})}const t1="text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px]",vN='text-[#999] relative pointer-events-none before:absolute before:left-0 before:right-0 before:top-[14px] before:h-[28px] before:bg-[#f3f3f3] before:opacity-60 before:content-[""]';function J9({year:e,position:t,showYearLabel:n,minDate:r,maxDate:o,week:i,onYearFReduce:s,onYearFAdd:l,onSelectYear:c}){const u=e-9,d=e+10,f=b.useMemo(()=>{const p=[];for(let h=0;h<5;h++){const m=[];for(let g=0;g<4;g++){const x=u+h*4+g,C=bo(new Date(x,0,1),r,o,i,"year");m.push({year:x,isSelected:e===x,isDisabled:!C})}p.push(m)}return p},[u,e,r,o,i]);return a.jsxs("table",{cellSpacing:0,cellPadding:0,className:"yt bg-white rounded-[4px] w-full h-full",style:{position:t},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("td",{className:j(t1,"btn prevy hover:text-[#0265ff] grid place-content-center"),colSpan:1,onClick:s,children:a.jsx(Ls,{size:14})}),a.jsx("td",{className:j(t1,"year title font-bold p-0.5"),colSpan:2,children:n?`${u}年 - ${d}年`:`${u} - ${d}`}),a.jsx("td",{className:j(t1,"btn nexty hover:text-[#0265ff] grid place-content-center"),colSpan:1,onClick:l,children:a.jsx(As,{size:14})})]})}),a.jsx("tbody",{children:f.map((p,h)=>a.jsx("tr",{children:p.map(m=>a.jsx("td",{className:j(t1,"year",m.isSelected&&"font-bold p-[1px] text-white border border-[#0265ff] bg-[#0265ff] hover:border-[#0265ff] hover:bg-[#0265ff]",m.isDisabled&&vN),onClick:()=>{m.isDisabled||c(m.year)},children:m.year},m.year))},h))})]})}const kN="h-[32px] leading-[32px] text-center cursor-pointer rounded-[4px] hover:bg-[rgba(2,101,255,0.08)]";function EN({hours:e,minutes:t,seconds:n,year:r,month:o,day:i,format:s,minDate:l,maxDate:c,startTime:u,endTime:d,onHoursChange:f,onMinutesChange:p,onSecondsChange:h}){const m=s.includes("mm"),g=s.includes("ss"),x=C=>{const w=C==="hours"?24:60,k={hours:"时",minutes:"分",seconds:"秒"},y=C==="hours"?e:C==="minutes"?t:n,E=C==="hours"?f:C==="minutes"?p:h;return a.jsxs("div",{className:j("col flex-1 border-l border-[#e0e0e0]",C),children:[a.jsx("div",{className:"label h-[32px] leading-[32px] text-center",children:k[C]}),a.jsx("div",{className:"col-list h-[200px] overflow-auto",children:Array.from({length:w},(v,_)=>{const L=y===_;let T=!1;const M=l.getFullYear()===r&&l.getMonth()===o&&l.getDate()===i,B=c.getFullYear()===r&&c.getMonth()===o&&c.getDate()===i;return M&&(T=!K9({h:C==="hours"?_:e,m:C==="minutes"?_:t,s:C==="seconds"?_:n,ms:0},u,{h:23,m:59,s:59,ms:999})),B&&!T&&(T=!K9({h:C==="hours"?_:e,m:C==="minutes"?_:t,s:C==="seconds"?_:n,ms:0},{h:0,m:0,s:0,ms:0},d)),a.jsx("div",{className:j(kN,L&&!T&&"select bg-[rgba(2,101,255,0.2)]",T&&"text-[#999] pointer-events-none opacity-80"),onClick:()=>{T||E(_)},children:_>9?_:`0${_}`},_)})})]})};return a.jsxs("div",{className:"time-range w-[180px]",children:[a.jsxs("div",{className:"time-input flex h-[40px] border-l border-[#e0e0e0]",children:[a.jsx("input",{type:"number",value:e,className:"h-[24px] w-[38px] my-[10px] mx-[10px] mt-[10px] text-center pl-[5px] flex-1",onChange:C=>{const w=Math.min(23,Math.max(0,parseInt(C.target.value)||0));f(w)}}),m&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"leading-[40px]",children:":"}),a.jsx("input",{type:"number",value:t,className:"h-[24px] w-[38px] my-[10px] mx-[10px] mt-[10px] text-center pl-[5px] flex-1",onChange:C=>{const w=Math.min(59,Math.max(0,parseInt(C.target.value)||0));p(w)}})]}),g&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"leading-[40px]",children:":"}),a.jsx("input",{type:"number",value:n,className:"h-[24px] w-[38px] my-[10px] mx-[10px] mt-[10px] text-center pl-[5px] flex-1",onChange:C=>{const w=Math.min(59,Math.max(0,parseInt(C.target.value)||0));h(w)}})]})]}),a.jsxs("div",{className:"time-select-range flex border-t border-[#e0e0e0]",style:{height:"calc(100% - 40px)"},children:[x("hours"),m&&x("minutes"),g&&x("seconds")]})]})}function SN({hasTime:e,hasDay:t,todayCls:n,onToday:r,onOk:o}){return!e&&!t?null:a.jsx("div",{className:"footer h-[40px] leading-[40px] text-center border-t border-[#e0e0e0]",children:a.jsxs("div",{className:"hms px-[10px]",children:[a.jsx("div",{className:j("btn cursor-pointer px-[5px] mx-[5px]",e?"current-time float-left text-[#0265ff] ml-0 pl-0 text-center":"today float-left text-[#0265ff] ml-0 pl-0 text-center",n==="disabled"&&"text-[#999] pointer-events-none opacity-80"),onClick:r,children:e?"当前时间":"今天"}),e&&a.jsx("div",{className:"btn ok mr-0 text-white bg-[#0265ff] rounded-[4px] h-[24px] leading-[24px] mt-[8px] float-right cursor-pointer px-[5px] hover:opacity-80",onClick:o,children:"确定"})]})})}function e7({value:e,onChange:t,format:n="yyyy-MM-dd",minDate:r,maxDate:o,week:i,className:s}){const l=e?new Date(e):new Date,[c,u]=b.useState(l.getFullYear()),[d,f]=b.useState(l.getMonth()),[p,h]=b.useState(l.getDate()),[m,g]=b.useState(l.getHours()),[x,C]=b.useState(l.getMinutes()),[w,k]=b.useState(l.getSeconds()),[y,E]=b.useState(!1),[v,_]=b.useState(!1),[L,T]=b.useState(n.includes("HH")),M=b.useMemo(()=>r!=null?r:new Date(jc,0,1,0,0,0,0),[r]),B=b.useMemo(()=>o!=null?o:new Date(Oc,11,31,23,59,59,999),[o]),P=b.useMemo(()=>i?i.map(me=>parseInt(String(me))):[],[i]),A=b.useMemo(()=>n==="yyyy-MM-dd HH:mm:ss"?{h:M.getHours(),m:M.getMinutes(),s:M.getSeconds(),ms:M.getMilliseconds()}:{h:0,m:0,s:0,ms:0},[n,M]),O=b.useMemo(()=>n==="yyyy-MM-dd HH:mm:ss"?{h:B.getHours(),m:B.getMinutes(),s:B.getSeconds(),ms:B.getMilliseconds()}:{h:23,m:59,s:59,ms:999},[n,B]);b.useEffect(()=>{e&&(u(e.getFullYear()),f(e.getMonth()),h(e.getDate()),g(e.getHours()),C(e.getMinutes()),k(e.getSeconds()))},[e]),b.useEffect(()=>{if(!e&&bo(new Date,M,B,P,"day")){const me=bN(new Date,M,B);u(me.getFullYear()),f(me.getMonth()),h(me.getDate())}},[]);const H=b.useCallback((me,Ae)=>t==null?void 0:t(me,Ae),[t]),I=b.useCallback((me,Ae="day")=>bo(me,M,B,P,Ae),[M,B,P]),V=b.useCallback(me=>{const Ae=new Date(c,d,p,m,x,w);H(I(Ae)?Ae:null,me)},[c,d,p,m,x,w,I,H]),z=b.useCallback(()=>{let me=c,Ae=d,Ze=p;d===0?(Ae=11,me=c-1):Ae=d-1;const et=Y9(me,Ae);Ze>et&&(Ze=et),u(me),f(Ae),h(Ze)},[c,d,p]),$=b.useCallback(()=>{let me=c,Ae=d,Ze=p;d===11?(Ae=0,me=c+1):Ae=d+1;const et=Y9(me,Ae);Ze>et&&(Ze=et),u(me),f(Ae),h(Ze)},[c,d,p]),N=b.useCallback(()=>{c>jc&&u(me=>me-1)},[c]),U=b.useCallback(()=>{c<Oc&&u(me=>me+1)},[c]),te=b.useCallback(()=>{c>jc&&u(me=>me-20)},[c]),F=b.useCallback(()=>{c<Oc&&u(me=>me+20)},[c]),re=b.useCallback(me=>{if(u(me),_(!1),n==="yyyy-MM"&&(h(1),g(0),C(0),k(0),E(!1)),n==="yyyy"){const Ae=new Date(me,0,1,0,0,0);H(I(Ae,"year")?Ae:null,!0)}T(n.includes("HH"))},[n,I,H]),le=b.useCallback(me=>{if(f(me),E(!1),_(!1),n==="yyyy-MM"){h(1),g(0),C(0),k(0);const Ae=new Date(c,me,1,0,0,0);H(I(Ae,"month")?Ae:null,!0)}T(n.includes("HH"))},[n,c,I,H]),Q=b.useCallback((me,Ae,Ze,et)=>{if(!et.includes("disabled")&&(u(Ze),f(Ae),h(me),!["HH:mm:ss","yyyy-MM-dd HH:mm:ss","yyyy-MM-dd HH:mm","HH:mm"].includes(n))){const Z=new Date(Ze,Ae,me,0,0,0);H(I(Z)?Z:null,!0)}},[n,I,H]),ee=b.useCallback(()=>{const me=new Date;if(u(me.getFullYear()),f(me.getMonth()),h(me.getDate()),g(me.getHours()),C(me.getMinutes()),k(me.getSeconds()),!["HH:mm:ss","yyyy-MM-dd HH:mm:ss","yyyy-MM-dd HH:mm","HH:mm"].includes(n)){const Ae=new Date(me.getFullYear(),me.getMonth(),me.getDate(),0,0,0);H(I(Ae)?Ae:null,!0)}},[n,I,H]),J=b.useCallback(()=>V(!0),[V]),ie=b.useCallback(me=>bo(me!=null?me:new Date,M,B,P,"day")?"":"disabled",[M,B,P]),ve=b.useCallback(me=>g(me),[]),ye=b.useCallback(me=>C(me),[]),W=b.useCallback(me=>k(me),[]),K=n.includes("yyyy"),Y=n.includes("HH"),se=n.includes("dd"),ne=n==="yyyy-MM",xe=n==="yyyy",ae=ie(),Ie=b.useCallback(()=>{E(!0),_(!1),T(!1)},[]),Fe=b.useCallback(()=>{_(!0),T(!1)},[]),Le=se?"min-h-[270px]":ne?"min-h-[180px]":"min-h-[270px]";return a.jsxs("div",{className:j("relative inline-block text-sm text-[#333] bg-white rounded-[4px] leading-none border-none",n,s),children:[a.jsxs("div",{className:"flex",children:[K&&a.jsxs("div",{className:j("data-range",Le),style:{minWidth:xe?220:270},children:[!xe&&a.jsxs("div",{className:"relative",children:[a.jsxs("table",{cellSpacing:0,cellPadding:0,className:"dt p-[3px] rounded-[4px]",style:{width:ne?"100%":270},children:[ne&&!v&&a.jsxs(a.Fragment,{children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("td",{className:"text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px] btn prevy hover:text-[#0265ff] grid place-content-center",colSpan:1,onClick:N,children:a.jsx(Ls,{size:14,className:"inline"})}),a.jsx("td",{className:"text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px] year title font-bold",colSpan:1,children:a.jsx("span",{className:"title-year hover:text-[#0265ff] cursor-pointer",onClick:Fe,children:c})}),a.jsx("td",{className:"text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px] btn nexty hover:text-[#0265ff] grid place-content-center",colSpan:1,onClick:U,children:a.jsx(As,{size:14,className:"inline"})})]})}),a.jsx("tbody",{children:[0,1,2].map(me=>a.jsx("tr",{children:[0,1,2].map(Ae=>{const Ze=me*3+Ae,et=I(new Date(c,Ze,1),"month"),Z=d===Ze,X=!et;return a.jsx("td",{className:j("text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px] month hover:bg-[rgba(2,101,255,0.08)]",Z&&"font-bold p-[1px] text-white border border-[#0265ff] bg-[#0265ff] hover:border-[#0265ff] hover:bg-[#0265ff]",X&&'text-[#999] relative pointer-events-none before:absolute before:left-0 before:right-0 before:top-[14px] before:h-[28px] before:bg-[#f3f3f3] before:opacity-60 before:content-[""]'),onClick:()=>{X||le(Ze)},children:Ic[Ze]},Ze)})},me))})]}),se&&a.jsx(CN,{year:c,month:d,day:p,format:n,minDate:M,maxDate:B,week:P,onYearReduce:N,onYearAdd:U,onMonthReduce:z,onMonthAdd:$,onMonthMenu:Ie,onYearMenu:Fe,onChangeDay:Q})]}),se&&!ne&&y&&!v&&a.jsx("div",{className:"absolute inset-0 z-[1]",children:a.jsx(yN,{year:c,month:d,showYear:v,position:"absolute",minDate:M,maxDate:B,week:P,onYearReduce:N,onYearAdd:U,onYearMenu:Fe,onMountOk:le})}),!xe&&v&&a.jsx("div",{className:j(ne?"relative":"absolute inset-0 z-[1]"),children:a.jsx(J9,{year:c,position:ne?"relative":"absolute",showYearLabel:ne,minDate:M,maxDate:B,week:P,onYearFReduce:te,onYearFAdd:F,onSelectYear:re})})]}),xe&&a.jsx(J9,{year:c,position:"relative",showYearLabel:!0,minDate:M,maxDate:B,week:P,onYearFReduce:te,onYearFAdd:F,onSelectYear:re})]}),L&&Y&&a.jsx(EN,{hours:m,minutes:x,seconds:w,year:c,month:d,day:p,format:n,minDate:M,maxDate:B,startTime:A,endTime:O,onHoursChange:ve,onMinutesChange:ye,onSecondsChange:W})]}),a.jsx(SN,{hasTime:Y,hasDay:se,todayCls:ae,onToday:ee,onOk:J})]})}function wr({value:e,onChange:t,format:n="yyyy-MM-dd",minDate:r,maxDate:o,week:i,placeholder:s,disabled:l,className:c}){const[u,d]=b.useState(!1),f=b.useCallback((x,C)=>{t==null||t(x),C&&d(!1)},[t]),p=e?e1(e,n):"",h=s!=null?s:_N(n),{portalContainer:m,setTriggerRef:g}=Gn("data-bs-date-input-portal");return a.jsxs(ht,{open:u,onOpenChange:d,children:[a.jsx(mt,{asChild:!0,disabled:l,children:a.jsxs("div",{className:j("flex items-center h-[34px] rounded-[4px] bg-white border border-[#e0e0e0] pl-[2px] pr-[10px] py-[2px] cursor-pointer","hover:border-[#0265FF]",u&&"border-[#0265FF]",l&&"opacity-50 cursor-not-allowed",c),ref:g,children:[a.jsx("div",{className:"flex-1 flex items-center justify-center h-[30px] px-[10px] py-[7px] rounded-[4px] min-w-0",children:a.jsx("span",{className:j("flex-1 text-[14px] leading-[normal] truncate",e?"text-[#030303]":"text-[#999999]"),children:p||h})}),a.jsx(Q1,{className:"shrink-0 size-[16px] text-[#999999]"})]})}),a.jsx(ut,{className:"w-auto p-0",align:"start",portalContainer:m,children:a.jsx(e7,{value:e,onChange:f,format:n,minDate:r,maxDate:o,week:i})})]})}function _N(e){switch(e){case"yyyy-MM-dd":return"请选择日期";case"yyyy-MM-dd HH:mm:ss":return"请选择日期时间";case"yyyy-MM-dd HH:mm":return"请选择日期时间";case"HH:mm:ss":return"请选择时间";case"HH:mm":return"请选择时间";case"yyyy-MM":return"请选择月份";case"yyyy":return"请选择年份";default:return"请选择日期"}}const NN=({expanded:e})=>a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:j("shrink-0",oe),style:{transform:e?"rotate(0deg)":"rotate(-90deg)"},children:a.jsx("path",{d:"M5 7L8 10L11 7",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),MN=({open:e})=>a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:j("shrink-0",oe),style:{transform:e?"rotate(180deg)":"rotate(0deg)"},children:a.jsx("path",{d:"M4 6L8 10L12 6",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),Co={},LN=["text","textarea","password","radio","radiogroup","combo","combocheck","checkboxgroup","address","location","separator","user","usergroup","dept","deptgroup","sn","formula","flowState","flowstate","subform","unknown"],AN=["number"],TN=["datetime"],FN=["upload","image","linkdata","linkquery","dataload","signature"];for(const e of LN)Co[e]={label:"文本",bgColor:"#F0F6FF",textColor:"#0265FF"};for(const e of AN)Co[e]={label:"数字",bgColor:"#FDF4D9",textColor:"#F4B700"};for(const e of TN)Co[e]={label:"日期",bgColor:"#EEDEFE",textColor:"#8E24F9"};for(const e of FN)Co[e]={label:"附件",bgColor:"#DDF6DD",textColor:"#1EC31E"};Co.button={label:"按钮",bgColor:"#DDF6DD",textColor:"#1EC31E"};function jN({style:e}){return a.jsx("span",{className:"text-[12px] rounded-[100px] h-[20px] px-[6px] flex items-center justify-center shrink-0 leading-[normal]",style:{backgroundColor:e.bgColor,color:e.textColor},children:e.label})}const ON=["dataload","linkquery","linkdata","button","separator","subform"];function Dc(e,t){var n;return((n=e.widget)==null?void 0:n.widgetName)||String(t)}function IN(e,t,n){var r;return((r=t.widget)==null?void 0:r.widgetName)||`${e}-${n}`}function DN(e,t){var o,i,s,l,c,u;const n=t.toLowerCase().trim(),r=[];for(let d=0;d<e.length;d++){const f=e[d];if(ON.includes((o=f.widget)==null?void 0:o.type))continue;const p=f.label,h=(i=f.widget)==null?void 0:i.widgetName,m=(s=f.widget)==null?void 0:s.items,g=m==null?void 0:m.filter(E=>"widget"in E),x=g&&g.length>0,C=h||Dc(f,d),w=[];if(x)for(let E=0;E<g.length;E++){const v=g[E],_=((l=v.widget)==null?void 0:l.widgetName)||`${C}-item-${E}`,L=`${h}.${_}`;w.push({key:L,label:v.label||`选项 ${E+1}`,field:f,fieldType:(c=v.widget)==null?void 0:c.type,depth:1,children:[],isExpandable:!1,widgetName:L})}const k=!n||p.toLowerCase().includes(n),y=w.some(E=>{var v;return(v=E==null?void 0:E.label)==null?void 0:v.toLowerCase().includes(n)});(k||y)&&r.push({key:C,label:p,field:f,fieldType:(u=f.widget)==null?void 0:u.type,depth:0,children:w,isExpandable:x,widgetName:h})}return r}const n1=({fields:e,selectedKey:t,onSelect:n,searchPlaceholder:r="搜索",showTypeBadge:o=!1,width:i,className:s})=>{const[l,c]=b.useState(""),[u,d]=b.useState(()=>{var x,C;const g=new Set;for(let w=0;w<e.length;w++)(C=(x=e[w].widget)==null?void 0:x.items)!=null&&C.length&&g.add(Dc(e[w],w));return g}),f=b.useMemo(()=>DN(e,l),[e,l]),p=b.useCallback(g=>{d(x=>{const C=new Set(x);return C.has(g)?C.delete(g):C.add(g),C})},[]),h=b.useCallback(g=>{g.isExpandable||g.field&&n(g.field,g.key)},[n]),m=b.useCallback(g=>{const x=u.has(g.key),C=t!=null&&g.key===t,w=g.depth*22+10,k=g.fieldType&&o?Co[g.fieldType]:void 0,y=()=>{g.isExpandable?p(g.key):h(g)},E=v=>{v.stopPropagation(),p(g.key)};return a.jsxs("div",{children:[a.jsxs("button",{type:"button",onClick:y,className:j("flex items-center justify-between w-full h-[34px] rounded-[4px] text-left","pr-[10px]",oe,C?"bg-[#F0F6FF] text-[#0265FF]":"text-[#030303] hover:bg-[#EFF0F6]"),style:{paddingLeft:`${w}px`,paddingTop:7,paddingBottom:7},children:[a.jsxs("div",{className:"flex items-center gap-[8px] min-w-0 flex-1",children:[g.isExpandable?a.jsx("span",{onClick:E,className:"flex items-center cursor-pointer",children:a.jsx(NN,{expanded:x})}):g.depth>0?a.jsx("span",{className:"w-[16px] h-[16px] shrink-0"}):null,a.jsx("span",{className:"text-[14px] truncate leading-[normal]",children:g.label})]}),k&&a.jsx(jN,{style:k})]}),g.isExpandable&&x&&a.jsx("div",{children:g.children.map(v=>m(v))})]},g.key)},[u,t,o,h,p]);return a.jsxs("div",{className:j("bg-white drop-shadow-[0px_0px_8px_rgba(0,0,0,0.1)] rounded-[4px] p-[4px]","flex flex-col gap-[4px]",s),style:i?{width:i}:void 0,children:[a.jsxs("div",{className:"flex items-center gap-[6px] border border-[#E0E0E0] rounded-[4px] h-[34px] px-[10px] py-[7px] shrink-0",children:[a.jsx(gn,{}),a.jsx("input",{type:"text",value:l,onChange:g=>c(g.target.value),placeholder:r,className:"flex-1 outline-none text-[14px] placeholder:text-[#999999] bg-transparent min-w-0 text-[#030303]"})]}),a.jsx("div",{className:"max-h-[400px] overflow-y-auto flex flex-col",children:f.length>0?f.map(g=>m(g)):a.jsx("div",{className:"flex items-center justify-center h-[60px] text-[12px] text-[#999999]",children:l.trim()?"未找到相关字段":"暂无字段"})})]})};function RN(e){var n,r,o;const t=new Map;for(let i=0;i<e.length;i++){const s=e[i],l=Dc(s,i);t.set(l,s.label);const c=(n=s.widget)==null?void 0:n.items;if(c)for(let u=0;u<c.length;u++){const d=c[u];if("widget"in d){const f=`${(r=s.widget)==null?void 0:r.widgetName}.${(o=d.widget)==null?void 0:o.widgetName}`;t.set(f,d.label||`选项 ${u+1}`)}else{const f=IN(l,d,u);t.set(f,d.text||`选项 ${u+1}`)}}}return t}function PN(e,t){var n;return t&&(n=RN(e).get(t))!=null?n:null}const Rc=({fields:e,value:t,defaultValue:n,onChange:r,placeholder:o="请选择字段",searchPlaceholder:i="输入字段名称来搜索",disabled:s=!1,showTypeBadge:l=!0,className:c})=>{const[u,d]=b.useState(!1),[f,p]=b.useState(n),[h,m]=b.useState(null),[g,x]=b.useState(0),C=b.useRef(null),w=t!==void 0?t:f,k=b.useMemo(()=>PN(e,w),[e,w]),y=b.useCallback((_,L)=>{t===void 0&&p(L),r==null||r(_,L),d(!1)},[t,r]),E=b.useCallback(_=>{s||(d(_),_&&C.current&&x(C.current.offsetWidth))},[s]),v=b.useCallback(_=>{if(C.current=_,_&&x(_.offsetWidth),!_){m(null);return}const L=_.getRootNode();if(L instanceof ShadowRoot){const T=L.querySelector("[data-bs-field-select-portal]");if(T){m(T);return}const M=document.createElement("div");M.setAttribute("data-bs-field-select-portal","true"),L.appendChild(M),m(M)}else m(null)},[]);return a.jsx("div",{className:j("relative",c),children:a.jsxs(ht,{open:u,onOpenChange:E,children:[a.jsx(mt,{asChild:!0,children:a.jsxs("button",{ref:v,type:"button",disabled:s,className:j("flex items-center justify-between w-full h-[34px]","bg-white border rounded-[4px]","px-[10px] py-[7px]","text-left cursor-pointer","hover:border-[#0265FF]",s&&"opacity-50 cursor-not-allowed hover:border-[#E0E0E0]",u?"border-[#0265FF]":"border-[#E0E0E0]",oe),children:[a.jsx("span",{className:j("text-[14px] leading-[normal] truncate",k?"text-[#030303]":"text-[#999999]"),children:k!=null?k:o}),a.jsx(MN,{open:u})]})}),a.jsx(ut,{align:"start",sideOffset:4,portalContainer:h,className:"!border-0 !p-0",style:{minWidth:g||void 0},children:a.jsx(n1,{fields:e,selectedKey:w,onSelect:y,searchPlaceholder:i,showTypeBadge:l})})]})})},t7=[{value:"before",label:"之前"},{value:"after",label:"之后"},{value:"day",label:"当天"},{value:"time",label:"当时"}];function HN(e){return e==="date"?t7.filter(t=>t.value!=="time"):t7.filter(t=>t.value!=="day")}const BN=({value:e,onChange:t,dateFieldType:n,placeholder:r="请选择偏移类型",disabled:o=!1,className:i})=>{const s=HN(n);return a.jsxs(er,{value:e,onValueChange:l=>t==null?void 0:t(l),disabled:o,children:[a.jsx(Fn,{className:i,children:a.jsx(tr,{placeholder:r})}),a.jsx(jn,{children:s.map(l=>a.jsx(On,{value:l.value,children:l.label},l.value))})]})},zN=[{value:"minute",label:"分钟"},{value:"hour",label:"小时"},{value:"day",label:"天"}],VN=({value:e,onChange:t,placeholder:n="请选择偏移单位",disabled:r=!1,className:o})=>a.jsxs(er,{value:e,onValueChange:i=>t==null?void 0:t(i),disabled:r,children:[a.jsx(Fn,{className:o,children:a.jsx(tr,{placeholder:n})}),a.jsx(jn,{children:zN.map(i=>a.jsx(On,{value:i.value,children:i.label},i.value))})]}),yr=1440,n7=j("h-[34px] px-[10px] py-[7px] rounded-[4px] bg-white border border-[#e0e0e0]","text-[14px] text-[#030303] placeholder:text-[#999999]","focus:outline-none focus:border-[#0265FF]","disabled:bg-[#EFF0F6] disabled:cursor-not-allowed","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none");function UN(e){return e==="date"?{dateFieldType:"date",offsetType:"day",offsetValue:0,offsetUnit:"minute"}:{dateFieldType:"datetime",offsetType:"time",offsetValue:0,offsetUnit:"minute"}}function r7(e,t){return t==="date"&&e==="time"?"day":t==="datetime"&&e==="day"?"time":e}function ZN(e){const t=Math.max(0,Math.floor(e))%yr,n=new Date(2024,0,1);return n.setHours(Math.floor(t/60),t%60,0,0),n}function WN(e){return e.getHours()*60+e.getMinutes()}function o7({value:e,onChange:t,dateFieldType:n,disabled:r=!1,className:o}){const i=e!==void 0,[s,l]=b.useState(()=>e!=null?e:UN(n)),c=b.useRef(e);b.useEffect(()=>{e!==void 0&&l(e),c.current=e},[e]);const u=e!=null?e:s,d=b.useCallback(T=>{i||l(T),t==null||t(T)},[i,t]),f=r7(u.offsetType,n),p=n==="date"&&(f==="before"||f==="after"),h=n==="datetime"&&(f==="before"||f==="after"),m=n==="date",g=n==="datetime"&&(f==="before"||f==="after"),x=n==="date"?p?u.offsetValue%yr:u.offsetValue:0,C=ZN(x),w=p?Math.max(0,Math.floor(u.offsetValue/yr)):1,k=h?u.offsetValue:0,y=b.useCallback(T=>{const M=r7(T,n),B=u.offsetValue%yr;d(n==="date"?M==="day"?{dateFieldType:"date",offsetType:"day",offsetValue:B,offsetUnit:"minute"}:{dateFieldType:"date",offsetType:M,offsetValue:B,offsetUnit:"minute"}:M==="time"?{dateFieldType:"datetime",offsetType:"time",offsetValue:0,offsetUnit:"minute"}:{dateFieldType:"datetime",offsetType:M,offsetValue:u.offsetValue,offsetUnit:u.offsetUnit})},[n,u.offsetValue,u.offsetUnit,d]),E=b.useCallback(T=>{if(!T)return;const M=WN(T);if(n==="date")if(f==="day")d({dateFieldType:"date",offsetType:"day",offsetValue:M,offsetUnit:"minute"});else{const B=Math.max(0,Math.floor(u.offsetValue/yr));d({dateFieldType:"date",offsetType:f,offsetValue:B*yr+M,offsetUnit:"minute"})}},[n,f,u.offsetValue,d]),v=b.useCallback(T=>{const M=parseInt(T.target.value,10),B=isNaN(M)?0:Math.max(0,M),P=u.offsetValue%yr;d({dateFieldType:"date",offsetType:f,offsetValue:B*yr+P,offsetUnit:"minute"})},[f,u.offsetValue,d]),_=b.useCallback(T=>{const M=parseInt(T.target.value,10),B=isNaN(M)?0:Math.max(0,M);d({dateFieldType:"datetime",offsetType:f,offsetValue:B,offsetUnit:u.offsetUnit})},[f,u.offsetUnit,d]),L=b.useCallback(T=>{d({dateFieldType:"datetime",offsetType:f,offsetValue:u.offsetValue,offsetUnit:T})},[f,u.offsetValue,d]);return a.jsxs("div",{className:j("flex items-center gap-[10px]",o),children:[a.jsx(BN,{value:f,onChange:y,dateFieldType:n,disabled:r}),p&&a.jsx("input",{type:"number",value:w,onChange:v,disabled:r,min:0,step:1,className:j(n7,"w-[60px]")}),p&&a.jsx("span",{className:"text-[14px] text-[#030303] shrink-0",children:"天"}),h&&a.jsx("input",{type:"number",value:k,onChange:_,disabled:r,min:0,step:1,className:j(n7,"w-[80px]")}),g&&a.jsx(VN,{value:u.offsetUnit,onChange:L,disabled:r}),m&&a.jsx(wr,{value:C,onChange:E,format:"HH:mm",disabled:r})]})}function GN(e){return typeof e=="object"&&e!==null&&"formId"in e}function Pc(e,t){var n,r,o,i;return{dateFieldType:"datetime",offsetType:"time",offsetValue:0,offsetUnit:"minute",...t,...e,formId:(r=(n=e.formId)!=null?n:t==null?void 0:t.formId)!=null?r:"",fieldId:(i=(o=e.fieldId)!=null?o:t==null?void 0:t.fieldId)!=null?i:""}}function $N(e){if(typeof e=="string"||typeof e=="number"){const t=new Date(e);return isNaN(t.getTime())?void 0:t}}function qN({value:e,onChange:t,forms:n=[],fields:r=[],dateFormat:o="yyyy-MM-dd",disabled:i=!1,className:s}){const l=e==null?void 0:e.type,c=GN(e==null?void 0:e.customTriggerTimePayload)?e.customTriggerTimePayload:void 0,u=b.useCallback(m=>{t==null||t({type:m})},[t]),d=b.useCallback(m=>{t==null||t({type:"custom",customTriggerTimePayload:m?m.toISOString():void 0})},[t]),f=b.useCallback(m=>{var x;const g=Pc({formId:((x=m.form)==null?void 0:x.id)||""},c);t==null||t({type:"date_field",customTriggerTimePayload:g})},[t,c]),p=b.useCallback((m,g)=>{const x=Pc({fieldId:g},c);t==null||t({type:"date_field",customTriggerTimePayload:x})},[t,c]),h=b.useCallback(m=>{const g=Pc({dateFieldType:m.dateFieldType,offsetType:m.offsetType,offsetValue:m.offsetValue,offsetUnit:m.offsetUnit},c);t==null||t({type:"date_field",customTriggerTimePayload:g})},[t,c]);return a.jsxs("div",{className:j("flex flex-col gap-[10px]",s),children:[a.jsxs("div",{className:"flex gap-[22px] items-start w-full",children:[a.jsx(q9,{className:"flex-1 min-w-0",value:l,onChange:u,disabled:i}),l==="custom"&&a.jsx(wr,{className:"flex-1 min-w-0",value:$N(e==null?void 0:e.customTriggerTimePayload),onChange:d,format:o,disabled:i}),l==="date_field"&&a.jsx(Ac,{className:"flex-1 min-w-0",items:n,value:c==null?void 0:c.formId,onChange:f,disabled:i})]}),l==="date_field"&&a.jsxs("div",{className:"flex items-start gap-[10px] w-full",children:[a.jsx(Rc,{className:"w-[300px]",fields:r,value:c==null?void 0:c.fieldId,onChange:p,disabled:i}),c&&a.jsx(o7,{value:{dateFieldType:c.dateFieldType,offsetType:c.offsetType,offsetValue:c.offsetValue,offsetUnit:c.offsetUnit},onChange:h,dateFieldType:c.dateFieldType,disabled:i})]})]})}const i7=[{value:"none",label:"不重复触发"},{value:"daily",label:"每天触发一次"},{value:"weekly",label:"每周触发一次"},{value:"everyTwoWeeks",label:"每两周触发一次"},{value:"monthly",label:"每月触发一次"},{value:"yearly",label:"每年触发一次"},{value:"custom",label:"自定义重复"}],s7=({value:e,onChange:t,placeholder:n="请选择重复类型",disabled:r=!1,className:o})=>a.jsxs(er,{value:e,onValueChange:i=>t==null?void 0:t(i),disabled:r,children:[a.jsx(Fn,{className:o,children:a.jsx(tr,{placeholder:n})}),a.jsx(jn,{children:i7.map(i=>a.jsx(On,{value:i.value,children:i.label},i.value))})]}),wo=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",className:e,children:a.jsx("path",{d:"M7 0C7.91925 -1.93718e-08 8.8295 0.18106 9.67878 0.532843C10.5281 0.884626 11.2997 1.40024 11.9497 2.05025C12.5998 2.70026 13.1154 3.47194 13.4672 4.32122C13.8189 5.17049 14 6.08075 14 7C14 7.91925 13.8189 8.8295 13.4672 9.67878C13.1154 10.5281 12.5998 11.2997 11.9497 11.9497C11.2997 12.5998 10.5281 13.1154 9.67878 13.4672C8.8295 13.8189 7.91925 14 7 14C3.13372 14 1.39103e-08 10.8658 0 7C0 3.13372 3.13372 1.39103e-08 7 0ZM10.1495 3.85C10.0301 3.7308 9.86825 3.66386 9.69953 3.66386C9.53081 3.66386 9.36898 3.7308 9.24956 3.85L7 6.10058L4.74993 3.85C4.6295 3.73566 4.46918 3.67288 4.30313 3.67503C4.13708 3.67718 3.97844 3.7441 3.86102 3.86153C3.7436 3.97895 3.67668 4.13759 3.67452 4.30364C3.67237 4.46968 3.73515 4.63001 3.84949 4.75044L6.10109 7L3.85 9.24956C3.73566 9.36999 3.67288 9.53031 3.67503 9.69636C3.67718 9.86241 3.7441 10.021 3.86153 10.1385C3.97895 10.2559 4.13759 10.3228 4.30364 10.325C4.46969 10.3271 4.63001 10.2643 4.75044 10.15L7 7.8984L9.24956 10.1495C9.37027 10.2621 9.52995 10.3234 9.69497 10.3205C9.85999 10.3177 10.0175 10.2509 10.1342 10.1342C10.2509 10.0175 10.3178 9.86008 10.3208 9.69507C10.3237 9.53005 10.2625 9.37033 10.15 9.24956L7.8984 7L10.1495 4.74993C10.2688 4.63049 10.3359 4.46856 10.3359 4.29971C10.3359 4.13086 10.2688 3.96892 10.1495 3.84949V3.85Z",fill:"#666666"})}),yo=[{value:"mon",label:"星期一"},{value:"tue",label:"星期二"},{value:"wed",label:"星期三"},{value:"thu",label:"星期四"},{value:"fri",label:"星期五"},{value:"sat",label:"星期六"},{value:"sun",label:"星期日"}],YN=()=>a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:a.jsx("path",{d:"M3 3L9 9M9 3L3 9",stroke:"#999999",strokeWidth:"1.2",strokeLinecap:"round"})}),a7=({open:e})=>a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:j("shrink-0",oe),style:{transform:e?"rotate(180deg)":"rotate(0deg)"},children:a.jsx("path",{d:"M4 6L8 10L12 6",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),l7=({value:e=[],onChange:t,placeholder:n="请选择工作日",disabled:r=!1,className:o})=>{const[i,s]=b.useState(!1),[l,c]=b.useState(!1),u=e.length===yo.length,d=e.length>0&&e.length<yo.length,{portalContainer:f,setTriggerRef:p}=Gn("data-bs-weekdays-select-portal"),h=b.useCallback(y=>{const E=e.includes(y)?e.filter(v=>v!==y):[...e,y];t==null||t(E)},[e,t]),m=b.useCallback(()=>{u?t==null||t([]):t==null||t(yo.map(y=>y.value))},[u,t]),g=b.useCallback(y=>{y.stopPropagation(),t==null||t([])},[t]),x=b.useCallback((y,E)=>{E.stopPropagation(),t==null||t(e.filter(v=>v!==y))},[e,t]),C=b.useCallback(y=>{r||s(y)},[r]),w=e.length>0,k=w&&l;return a.jsx("div",{className:j("relative",o),children:a.jsxs(ht,{open:i,onOpenChange:C,children:[a.jsx(mt,{asChild:!0,children:a.jsx("button",{type:"button",disabled:r,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),ref:p,className:j("flex items-center justify-between w-full h-[34px] gap-2.5","bg-white border border-[#E0E0E0] rounded-[4px]","py-[7px]",w?"pl-[4px] pr-[10px]":"px-[10px]","text-left cursor-pointer","hover:border-[#0265FF]",r&&"opacity-50 cursor-not-allowed hover:border-[#E0E0E0]",i&&"border-[#0265FF]",oe),children:w?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex items-center gap-[4px] min-w-0 flex-1 overflow-x-auto scrollbar-hide",children:e.map(y=>{const E=yo.find(v=>v.value===y);return a.jsxs("span",{className:"flex items-center gap-[4px] bg-[#EEEEEE] rounded-[2px] h-[26px] px-[6px] shrink-0",children:[a.jsx("span",{className:"text-[14px] text-[#030303] leading-[normal]",children:E==null?void 0:E.label}),a.jsx("span",{className:"cursor-pointer flex items-center shrink-0",onClick:v=>x(y,v),children:a.jsx(YN,{})})]},y)})}),k?a.jsx("span",{className:"cursor-pointer flex items-center shrink-0",onClick:g,children:a.jsx(wo,{})}):a.jsx(a7,{open:i})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-[14px] text-[#999999] leading-[normal] truncate",children:n}),a.jsx(a7,{open:i})]})})}),a.jsx(ut,{align:"start",sideOffset:4,className:"!border-0 rounded-[8px] shadow-[0px_6px_16px_rgba(0,0,0,0.06)] p-[4px]",portalContainer:f,children:a.jsxs("div",{className:"flex flex-col",children:[a.jsxs("button",{type:"button",onClick:m,className:j("flex items-center gap-[6px] h-[34px] px-[10px] py-[7px] rounded-[4px] text-left","hover:bg-[#EFF0F6]",oe),children:[a.jsx(Pn,{checked:u,intermediate:d,onCheckedChange:m,className:"shrink-0"}),a.jsx("span",{className:"text-[14px] font-bold text-[#0265FF] leading-[normal]",children:"全选"})]}),yo.map(y=>{const E=e.includes(y.value);return a.jsxs("button",{type:"button",onClick:()=>h(y.value),className:j("flex items-center gap-[6px] h-[34px] px-[10px] py-[7px] rounded-[4px] text-left","hover:bg-[#EFF0F6]",oe),children:[a.jsx(Pn,{checked:E,onCheckedChange:()=>h(y.value),className:"shrink-0"}),a.jsx("span",{className:"text-[14px] text-[#030303] leading-[normal]",children:y.label})]},y.value)})]})})]})})},KN=F_,c7=S.forwardRef(({className:e,...t},n)=>a.jsx(A9,{ref:n,className:j("inline-flex items-center w-full gap-[2px] p-[2px] bg-[#EFF0F6] rounded-[4px]",e),...t}));c7.displayName=A9.displayName;const Hc=S.forwardRef(({className:e,...t},n)=>a.jsx(T9,{ref:n,className:j("inline-flex items-center justify-center w-full h-[30px]","px-[10px] py-[7px] rounded-[4px]","text-[14px] text-[#121111] leading-normal","bg-transparent border border-solid border-[#EFF0F6]","transition-all duration-200 ease-out","outline-none cursor-pointer","hover:text-[#121111] hover:border-[#E0E0E0] hover:bg-white","data-[state=active]:text-[#0265FF] data-[state=active]:border-[#E0E0E0] data-[state=active]:bg-white","focus-visible:ring-2 focus-visible:ring-[#0265FF] focus-visible:ring-offset-1",e),...t}));Hc.displayName=T9.displayName;const Bc=S.forwardRef(({className:e,...t},n)=>a.jsx(F9,{ref:n,className:j("mt-2 outline-none","data-[state=inactive]:hidden",e),...t}));Bc.displayName=F9.displayName;const r1=[{value:1,label:"1"},{value:2,label:"2"},{value:3,label:"3"},{value:4,label:"4"},{value:5,label:"5"},{value:6,label:"6"},{value:7,label:"7"},{value:8,label:"8"},{value:9,label:"9"},{value:10,label:"10"},{value:11,label:"11"},{value:12,label:"12"},{value:13,label:"13"},{value:14,label:"14"},{value:15,label:"15"},{value:16,label:"16"},{value:17,label:"17"},{value:18,label:"18"},{value:19,label:"19"},{value:20,label:"20"},{value:21,label:"21"},{value:22,label:"22"},{value:23,label:"23"},{value:24,label:"24"},{value:25,label:"25"},{value:26,label:"26"},{value:27,label:"27"},{value:28,label:"28"},{value:29,label:"29"},{value:30,label:"30"},{value:31,label:"31"}],XN={label:"最后一个自然日"},u7=7,QN=()=>a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:a.jsx("path",{d:"M3 3L9 9M9 3L3 9",stroke:"#999999",strokeWidth:"1.2",strokeLinecap:"round"})}),d7=({open:e})=>a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:j("shrink-0",oe),style:{transform:e?"rotate(180deg)":"rotate(0deg)"},children:a.jsx("path",{d:"M4 6L8 10L12 6",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),f7=({value:e=[],onChange:t,placeholder:n="请选择日期",disabled:r=!1,className:o})=>{const[i,s]=b.useState(!1),[l,c]=b.useState(!1),[u,d]=b.useState(e),{portalContainer:f,setTriggerRef:p}=Gn("data-bs-weekdays-select-portal"),h=i?u:e,m=b.useMemo(()=>h.filter(A=>A!=="last"),[h]),g=b.useMemo(()=>h.includes("last"),[h]),x=m.length===31,C=b.useCallback(A=>{d(O=>O.includes(A)?O.filter(H=>H!==A):[...O,A])},[]),w=b.useCallback(()=>{d(A=>{if(A.filter(V=>V!=="last").length===31)return A.filter(V=>V==="last");const H=r1.map(V=>V.value),I=A.includes("last")?["last"]:[];return[...H,...I]})},[]),k=b.useCallback(()=>{const A=new Date().getDate();d(O=>O.includes(A)?O:[...O,A])},[]),y=b.useCallback(()=>{d(A=>A.includes("last")?A.filter(O=>O!=="last"):[...A,"last"])},[]),E=b.useCallback(()=>{t==null||t(u),s(!1)},[u,t]),v=b.useCallback(A=>{r||(A&&d([...e]),s(A))},[r,e]),_=b.useCallback(A=>{A.stopPropagation(),t==null||t([])},[t]),L=b.useCallback((A,O)=>{O.stopPropagation(),t==null||t(e.filter(H=>H!==A))},[e,t]),T=e.length>0,M=T&&l,B=b.useCallback(A=>A==="last"?"最后一天":`${A}日`,[]),P=b.useMemo(()=>{const A=[];for(let O=0;O<r1.length;O+=u7)A.push(r1.slice(O,O+u7));return A},[]);return a.jsx("div",{className:j("relative",o),children:a.jsxs(ht,{open:i,onOpenChange:v,children:[a.jsx(mt,{asChild:!0,children:a.jsx("button",{type:"button",ref:p,disabled:r,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),className:j("flex items-center justify-between w-full h-[34px] gap-2.5","bg-white border border-[#E0E0E0] rounded-[4px]","py-[7px]",T?"pl-[4px] pr-[10px]":"px-[10px]","text-left cursor-pointer","hover:border-[#0265FF]",r&&"opacity-50 cursor-not-allowed hover:border-[#E0E0E0]",i&&"border-[#0265FF]",oe),children:T?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex items-center gap-[4px] min-w-0 flex-1 overflow-x-auto scrollbar-hide",children:e.map(A=>a.jsxs("span",{className:"flex items-center gap-[4px] bg-[#EEEEEE] rounded-[2px] h-[26px] px-[6px] shrink-0",children:[a.jsx("span",{className:"text-[14px] text-[#030303] leading-[normal]",children:B(A)}),a.jsx("span",{className:"cursor-pointer flex items-center shrink-0",onClick:O=>L(A,O),children:a.jsx(QN,{})})]},A))}),M?a.jsx("span",{className:"cursor-pointer flex items-center shrink-0",onClick:_,children:a.jsx(wo,{})}):a.jsx(d7,{open:i})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-[14px] text-[#999999] leading-[normal] truncate",children:n}),a.jsx(d7,{open:i})]})})}),a.jsx(ut,{align:"start",sideOffset:4,portalContainer:f,className:"!border-0 rounded-[8px] shadow-[0px_6px_16px_rgba(0,0,0,0.06)] p-0",style:{width:"310px"},children:a.jsxs(KN,{defaultValue:"specific",children:[a.jsx("div",{className:"px-[4px] pt-[4px] flex justify-center",children:a.jsxs(c7,{children:[a.jsx(Hc,{value:"specific",children:"指定日期"}),a.jsx(Hc,{value:"relative",children:"相对日期"})]})}),a.jsxs(Bc,{value:"specific",className:"mt-0",children:[a.jsxs("div",{className:"px-[8px] pt-[8px] pb-[4px]",children:[a.jsxs("button",{type:"button",onClick:w,className:j("flex items-center gap-[6px] w-full h-[34px] px-[10px] py-[7px] rounded-[4px] text-left mb-[4px]","hover:bg-[#EFF0F6]",oe),children:[a.jsx(Pn,{checked:x,intermediate:m.length>0&&!x,onCheckedChange:w,className:"shrink-0"}),a.jsx("span",{className:"text-[14px] font-bold text-[#0265FF] leading-[normal]",children:"全选"})]}),a.jsx("div",{className:"flex flex-col gap-[2px]",children:P.map((A,O)=>a.jsx("div",{className:"flex gap-[4px]",children:A.map(H=>{const I=m.includes(H.value);return a.jsx("button",{type:"button",onClick:()=>C(H.value),className:j("flex items-center justify-center w-[36px] h-[30px] rounded-[4px]","text-[14px] leading-[normal]","transition-all duration-200 ease-out",I?"bg-[#0265FF] text-white":"text-[#030303] hover:bg-[#EFF0F6]"),children:H.label},H.value)})},O))})]}),a.jsxs("div",{className:"flex items-center justify-between px-[12px] py-[8px] border-t border-[#E0E0E0] mt-[4px]",children:[a.jsx("button",{type:"button",onClick:k,className:j("h-[28px] px-[12px] rounded-[4px] text-[14px]","text-[#0265FF] hover:bg-[#EFF0F6]",oe),children:"今天"}),a.jsx("button",{type:"button",onClick:E,className:j("h-[28px] px-[16px] rounded-[4px] text-[14px]","bg-[#0265FF] text-white hover:bg-[#0255DD]",oe),children:"确认"})]})]}),a.jsxs(Bc,{value:"relative",className:"mt-0",children:[a.jsx("div",{className:"px-[8px] pt-[8px] pb-[4px]",children:a.jsxs("button",{type:"button",onClick:y,className:j("flex items-center gap-[6px] w-full h-[34px] px-[10px] py-[7px] rounded-[4px] text-left","hover:bg-[#EFF0F6]",oe),children:[a.jsx(Pn,{checked:g,onCheckedChange:y,className:"shrink-0"}),a.jsx("span",{className:"text-[14px] text-[#030303] leading-[normal]",children:XN.label})]})}),a.jsx("div",{className:"flex items-center justify-center px-[12px] py-[8px] border-t border-[#E0E0E0] mt-[4px]",children:a.jsx("button",{type:"button",onClick:E,className:j("h-[28px] px-[16px] rounded-[4px] text-[14px]","bg-[#0265FF] text-white hover:bg-[#0255DD]",oe),children:"确认"})})]})]})})]})})},p7=[{value:"week",label:"按周重复"},{value:"month",label:"按月重复"}],h7=({value:e,onChange:t,placeholder:n="请选择重复方式",disabled:r=!1,className:o})=>a.jsxs(er,{value:e,onValueChange:i=>t==null?void 0:t(i),disabled:r,children:[a.jsx(Fn,{className:o,children:a.jsx(tr,{placeholder:n})}),a.jsx(jn,{children:p7.map(i=>a.jsx(On,{value:i.value,children:i.label},i.value))})]}),JN=j("h-[34px] px-[10px] py-[7px] rounded-[4px] bg-white border border-[#e0e0e0]","text-[14px] text-[#030303] placeholder:text-[#999999]","focus:outline-none focus:border-[#0265FF]","disabled:bg-[#EFF0F6] disabled:cursor-not-allowed","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none","w-[60px]");function eM(){return{repeatBy:"week",interval:1,repeatDetailDates:[]}}function tM({value:e,onChange:t,disabled:n=!1,className:r}){var m,g,x;const o=e==null?void 0:e.type,i=e==null?void 0:e.customRepeatPreference,s=i==null?void 0:i.repeatBy,l=b.useCallback(C=>{C==="custom"?t==null||t({type:"custom",customRepeatPreference:i!=null?i:eM()}):t==null||t({type:C})},[t,i]),c=b.useCallback(C=>{i&&(t==null||t({type:"custom",customRepeatPreference:{...i,repeatBy:C,repeatDetailDates:[]}}))},[t,i]),u=b.useCallback(C=>{if(!i)return;const w=parseInt(C.target.value,10),k=isNaN(w)?1:Math.max(1,w);t==null||t({type:"custom",customRepeatPreference:{...i,interval:k}})},[t,i]),d=b.useCallback(C=>{i&&(t==null||t({type:"custom",customRepeatPreference:{...i,repeatDetailDates:C}}))},[t,i]),f=b.useCallback(C=>{i&&(t==null||t({type:"custom",customRepeatPreference:{...i,repeatDetailDates:C}}))},[t,i]),p=(m=i==null?void 0:i.repeatDetailDates)!=null?m:[],h=(g=i==null?void 0:i.repeatDetailDates)!=null?g:[];return a.jsxs("div",{className:j("flex flex-col gap-[10px]",r),children:[a.jsx(s7,{value:o,onChange:l,disabled:n}),o==="custom"&&a.jsxs("div",{className:"flex items-start gap-[10px] w-full",children:[a.jsx(h7,{className:"w-[200px] shrink-0",value:s,onChange:c,disabled:n}),a.jsx("span",{className:"text-[14px] text-[#030303] leading-[34px] shrink-0",children:"每"}),a.jsx("input",{type:"number",value:(x=i==null?void 0:i.interval)!=null?x:1,onChange:u,disabled:n,min:1,step:1,className:JN}),a.jsx("span",{className:"text-[14px] text-[#030303] leading-[34px] shrink-0",children:s==="month"?"月":"周"}),s==="week"&&a.jsx(l7,{className:"flex-1 min-w-0",value:p,onChange:d,disabled:n}),s==="month"&&a.jsx(f7,{className:"flex-1 min-w-0",value:h,onChange:f,disabled:n})]})]})}const m7=({flipped:e})=>a.jsx("svg",{width:"40",height:"4",viewBox:"0 0 40 4",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{display:"block",flexShrink:0},children:e?a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"2",cy:"2",r:"2",fill:"#D9D9D9"}),a.jsx("path",{d:"M10 2H40",stroke:"#E0E0E0"})]}):a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M0 2H30",stroke:"#E0E0E0"}),a.jsx("circle",{cx:"38",cy:"2",r:"2",fill:"#D9D9D9"})]})}),nM=({children:e,className:t})=>a.jsxs("div",{className:j("flex items-center justify-center gap-[10px]",t),children:[a.jsx(m7,{}),e!=null&&a.jsx("span",{className:"text-[#999] text-[14px] whitespace-nowrap leading-[normal] shrink-0",children:e}),a.jsx(m7,{flipped:!0})]}),g7=["eq","neq","gt","lt","gte","lte","contains","not_contains","in","nin","all","empty","not_empty","range","like","unlike"],x7=({value:e,defaultValue:t="eq",onChange:n,operators:r,fieldType:o,operatorLabels:i,borderless:s=!1,disabled:l=!1,className:c})=>{var y,E;const[u,d]=b.useState(!1),[f,p]=b.useState(t),[h,m]=b.useState(null),g=b.useMemo(()=>(!r||r.length===0?g7:g7.filter(_=>new Set(r).has(_))).map(_=>{var L;return{value:_,label:(L=i==null?void 0:i[_])!=null?L:Bh(_,o)}}),[r,o,i]),x=(()=>{const v=e!==void 0?e:f;return g.length>0&&!g.find(_=>_.value===v)?g[0].value:v})(),C=(E=(y=g.find(v=>v.value===x))==null?void 0:y.label)!=null?E:"",w=b.useCallback(v=>{e===void 0&&p(v),n==null||n(v),d(!1)},[e,n]),k=b.useCallback(v=>{if(!v){m(null);return}const _=v.getRootNode();if(_ instanceof ShadowRoot){const L=_.querySelector("[data-bs-relational-operator-select-portal]");if(L){m(L);return}const T=document.createElement("div");T.setAttribute("data-bs-relational-operator-select-portal","true"),_.appendChild(T),m(T)}else m(null)},[]);return a.jsx("div",{className:j("relative inline-flex",c),children:a.jsxs(ht,{open:u,onOpenChange:d,children:[a.jsx(mt,{asChild:!0,children:a.jsxs("button",{ref:k,type:"button",disabled:l,className:j("flex items-center justify-between gap-[10px]","min-w-[82px] px-[10px] w-full","text-left cursor-pointer",s?"h-[34px] bg-transparent":j("h-[31px] bg-white border rounded-[4px]",u?"border-[#0265FF]":"border-[#E0E0E0] hover:border-[#0265FF]"),l&&"opacity-50 cursor-not-allowed",!l&&!s&&"hover:border-[#0265FF]",oe),children:[a.jsx("span",{className:"text-[14px] leading-[normal] text-[#030303] truncate",children:C}),a.jsx("span",{className:j("shrink-0 flex items-center justify-center w-[16px] h-[16px] text-[#666666]",oe,u&&"rotate-180"),children:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:a.jsx("path",{d:"M4 6L8 10L12 6",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}),a.jsx(ut,{align:"start",sideOffset:4,portalContainer:h,className:"!border-0 rounded-[10px] shadow-[0px_0px_5px_rgba(0,0,0,0.04)] p-[4px] min-w-[82px]",children:a.jsx("div",{className:"flex flex-col gap-0 max-h-[320px] overflow-y-auto",children:g.map(v=>a.jsx("button",{type:"button",onClick:()=>w(v.value),className:j("h-[34px] px-[10px] rounded-[4px] text-left text-[14px] leading-[normal] whitespace-nowrap shrink-0",x===v.value?"bg-[#F0F6FF] text-[#0265FF]":"text-[#030303] hover:bg-[#EFF0F6]",oe),children:v.label},v.value))})})]})})},rM=({avatar:e,width:t,onDockClick:n,onCloseClick:r,draggable:o,isDragging:i,isDocked:s,onDragStart:l})=>a.jsxs("div",{className:j("flex items-center justify-between","px-4","h-[52px] min-w-[200px]",{"w-full":!t,[`w-[${t}px]`]:t,"cursor-grab":o&&!i,"cursor-grabbing":i}),style:{backgroundImage:Y0,backgroundSize:"cover",backgroundRepeat:"no-repeat"},onMouseDown:o?l:void 0,children:[e,a.jsxs("div",{className:"actions flex items-center gap-2.5 text-[#666]",children:[a.jsx(nn,{onMouseDown:c=>{c.stopPropagation()},tooltip:s?"悬浮":"右侧打开",icon:s?a.jsx(l3,{}):a.jsx(a3,{}),onClick:n}),a.jsx(nn,{icon:a.jsx(ol,{}),onClick:r})]})]}),b7=({defaultChecked:e=!1,checked:t,onCheckedChange:n,children:r,disabled:o=!1,isMobile:i,className:s})=>{const[l,c]=b.useState(e),u=t!==void 0,d=u?t:l,f=()=>{if(o)return;const m=!d;u||c(m),n==null||n(m)},p=qe({"w-4 h-4":!i,"w-[20px] h-[20px]":i}),h=qe({"text-[14px]":!i,"text-[16px]":i});return a.jsxs("button",{type:"button",role:"checkbox","aria-checked":d,disabled:o,onClick:f,className:j("inline-flex items-center gap-[6px] cursor-pointer select-none","text-[#121111]",h,o&&"cursor-not-allowed opacity-50",s),children:[a.jsx("span",{className:j("inline-flex items-center justify-center rounded-full transition-colors duration-200 box-border border",p,d?"bg-[#2E60FF] border-transparent":"bg-white border-[#e0e0e0]"),children:d&&a.jsx("span",{className:"text-white",children:a.jsx(al,{})})}),r&&a.jsx("span",{className:"",children:r})]})},oM=({defaultChecked:e=!1,checked:t,onCheckedChange:n,title:r,description:o,disabled:i=!1,className:s})=>{const[l,c]=b.useState(e),u=t!==void 0,d=u?t:l,f=()=>{if(i)return;const p=!d;u||c(p),n==null||n(p)};return a.jsxs("button",{type:"button",role:"checkbox","aria-checked":d,disabled:i,onClick:f,className:j("flex flex-col gap-[6px] p-[10px] rounded-[4px] cursor-pointer select-none","border border-[#e0e0e0]",i&&"cursor-not-allowed opacity-50",s),children:[a.jsxs("div",{className:"inline-flex items-center gap-[6px]",children:[a.jsx(b7,{checked:d,onCheckedChange:p=>{d||f()},disabled:i}),a.jsx("span",{className:"text-[#030303] text-[14px]",children:r})]}),a.jsx("p",{className:"text-[#666] text-[12px] pl-[22px]",children:o})]})},o1=({title:e,ghost:t,content:n,icon:r,disableExpand:o,children:i,defaultOpen:s,isMobile:l})=>{const[c,u]=b.useState(s),d=l?"text-[16px]":"text-[14px]",f="w-[16px] h-[16px]",p=qe({"bg-[#fafafa] border border-[#e0e0e0] border-solid p-2.5":!t}),m=c&&t?"":e,g=r===void 0?a.jsx(u3,{}):r;return a.jsxs("div",{className:qe("flex flex-col gap-2.5 rounded-lg w-full",p),children:[a.jsxs("div",{className:j("flex items-center justify-between w-full",{"cursor-pointer":!o}),onClick:()=>{o||u(!c)},children:[a.jsxs("div",{className:"flex gap-2.5 items-center",children:[g?a.jsx("div",{className:qe("shrink-0 flex items-center",f),children:g}):null,a.jsx("p",{className:`text-[#666] ${d} leading-normal`,children:m})]}),a.jsx("button",{onClick:()=>{o||u(!c)},className:j("flex items-center justify-center w-5 h-5 rounded-[4px] cursor-pointer hover:bg-[#EFF0F6]",oe,{"pointer-events-none opacity-0":o}),children:a.jsx(_s,{isOpen:c})})]}),c&&!o&&a.jsx("div",{className:`text-[#121111] ${d} word-wrap`,children:n||i})]})};function C7({open:e,onOpenChange:t,title:n,description:r,linkText:o="留在此页",onLinkClick:i,cancelText:s="不保存",onCancel:l,confirmText:c="保存并继续",onConfirm:u,container:d,showLink:f=!0,showCancel:p=!0}){const h={borderRadius:4,padding:"6px 20px"};return a.jsx(r5,{open:e,onOpenChange:t,children:a.jsxs(Ma,{container:d,className:j("w-[480px] max-w-[480px] p-0 gap-0 rounded-[10px] border-none","shadow-[0px_0px_10px_0px_rgba(0,0,0,0.04)]","[&>button]:hidden"),children:[a.jsxs(La,{className:"flex flex-row items-start gap-[10px] p-9 pb-0",children:[a.jsx("div",{className:"size-[30px] shrink-0 text-[#0265FF]",children:a.jsx(g3,{})}),a.jsxs("div",{className:"flex flex-col gap-2",children:[a.jsx(Ta,{className:"text-[16px] font-[700] text-[#030303] leading-normal",children:n}),r&&a.jsx(Fa,{className:"text-[14px] text-[#666] leading-normal",children:r})]})]}),a.jsxs(Aa,{className:"flex flex-row items-center !justify-between p-9 pt-6",children:[f?a.jsx("button",{type:"button",className:"text-[14px] text-[#0265ff] hover:text-[#0265ff]/80 bg-transparent border-none cursor-pointer",onClick:i||(()=>{console.log("Link clicked"),t==null||t(!1)}),children:o}):a.jsx("div",{}),a.jsxs("div",{className:"flex items-center gap-3",children:[p&&a.jsx($s,{className:"hover:text-[#121111]",onClick:l,children:s}),a.jsx("button",{type:"button",onClick:u,style:h,className:j("text-[14px] text-white bg-[#0265ff]","hover:bg-[#0265ff]/80 cursor-pointer border-none"),children:c})]})]})]})})}function iM(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];if(r.isSubForm){const o=[];let i=n+1;for(;i<e.length&&e[i].isFieldInSubForm&&e[i].parentFormName===r.fieldName;)o.push(e[i]),i++;t.push({kind:"subform",parent:r,children:o}),n=i}else t.push({kind:"field",field:r}),n++}return t}const sn="flex items-center px-1.5 py-2.5 text-[12px] leading-normal";function w7({field:e,isSubFormChild:t=!1}){return a.jsxs("div",{className:"flex items-center w-full",children:[a.jsxs("div",{className:j(sn,"w-20 shrink-0 min-h-[34px]"),children:[t&&a.jsx("span",{className:"inline-flex items-center justify-center shrink-0 w-5 h-5 opacity-0",children:a.jsx(_s,{})}),a.jsx("span",{children:e.fieldName})]}),a.jsx("div",{className:j(sn,"w-[72px] shrink-0 min-h-[34px]"),children:e.type}),a.jsx("div",{className:j(sn,"w-10 shrink-0 min-h-[34px]"),children:e.required?"是":"否"}),a.jsx("div",{className:j(sn,"flex-1 min-w-0 min-h-[34px]"),children:a.jsx("span",{className:"break-words min-w-0",children:e.description})})]})}function sM({parent:e,children:t}){const[n,r]=b.useState(!0),o=b.useCallback(()=>r(i=>!i),[]);return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center w-full",children:[a.jsxs("div",{className:j(sn,"w-20 shrink-0 min-h-[34px]"),children:[a.jsx("button",{type:"button",onClick:o,className:"inline-flex items-center justify-center shrink-0 w-5 h-5 rounded cursor-pointer text-[#666] relative -left-[2px]",children:a.jsx(_s,{isOpen:n})}),a.jsx("span",{children:e.fieldName})]}),a.jsx("div",{className:j(sn,"w-[72px] shrink-0 min-h-[34px] "),children:e.type}),a.jsx("div",{className:j(sn,"w-10 shrink-0 min-h-[34px]"),children:e.required?"是":"否"}),a.jsx("div",{className:j(sn,"flex-1 min-w-0 min-h-[34px]"),children:a.jsx("span",{className:"break-words min-w-0",children:e.description})})]}),n&&t.map((i,s)=>a.jsx(w7,{field:i,isSubFormChild:!0},s))]})}function aM({fields:e}){const t=b.useMemo(()=>iM(e),[e]);return a.jsxs("div",{className:"flex flex-col items-start w-full bg-white rounded-[10px] overflow-hidden text-black my-[10px] border border-[#E0E0E0]",children:[a.jsxs("div",{className:"flex items-center w-full shrink-0 bg-[#E5E6EB] rounded-t-[10px] border-b border-[#E0E0E0]",children:[a.jsx("div",{className:j(sn,"w-20 shrink-0 h-[34px] font-bold"),children:"名称"}),a.jsx("div",{className:j(sn,"w-[72px] shrink-0 h-[34px] font-bold"),children:"类型"}),a.jsx("div",{className:j(sn,"w-10 shrink-0 h-[34px] font-bold justify-center"),children:"必填"}),a.jsx("div",{className:j(sn,"flex-1 min-w-0 h-[34px] font-bold"),children:"说明"})]}),a.jsx("div",{className:"flex flex-col items-start w-full",children:t.map((n,r)=>n.kind==="field"?a.jsx(w7,{field:n.field},r):a.jsx(sM,{parent:n.parent,children:n.children},r))})]})}const lM=()=>a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex gap-[2px] flex-shrink-0 relative -left-[4px] top-[3px]",children:[a.jsx("div",{className:"w-[2px] h-[2px] rounded-full bg-[#0265FF] flex-shrink-0",style:{animation:"pulse 1.4s ease-in-out infinite",animationDelay:"0s",marginRight:"2px"}}),a.jsx("div",{className:"w-[2px] h-[2px] rounded-full bg-[#0265FF] flex-shrink-0",style:{animation:"pulse 1.4s ease-in-out infinite",animationDelay:"0.2s",marginRight:"2px"}}),a.jsx("div",{className:"w-[2px] h-[2px] rounded-full bg-[#0265FF] flex-shrink-0",style:{animation:"pulse 1.4s ease-in-out infinite",animationDelay:"0.4s"}})]}),a.jsx("style",{children:`
172
+ `).map((f,p)=>a.jsx("p",{className:"shrink-0 text-[#030303] whitespace-nowrap overflow-hidden text-ellipsis max-w-full",children:f},p))]}),d&&a.jsx(s9,{agent:d})]}),a.jsxs("div",{className:"grid-rows-[max-content] inline-grid leading-[0] place-items-start shrink-0 w-full",children:[a.jsx("div",{className:"col-1 h-0 ml-0 mt-0 row-1 w-full border-t border-[#e0e0e0]"}),a.jsxs("div",{className:"col-1 content-stretch flex h-[42px] items-center justify-between ml-0 mt-0 px-[12px] row-1 w-full",children:[a.jsx(j_,{checked:e.enabled,onCheckedChange:n}),r&&a.jsx("button",{className:"leading-[normal] shrink-0 text-[#0265ff] text-[12px] whitespace-nowrap hover:underline",onClick:r,children:"查看执行日志"})]})]})]})},R_=({items:e,className:t,getAgent:n,onEnabledChange:r,onViewLogs:o,onEdit:i,onCopy:s,onDelete:l,formService:c})=>a.jsx("div",{className:j("content-start flex flex-wrap gap-[20px] items-start",t),children:e.map(u=>a.jsx(j9,{formService:c,helper:u,getAgent:n,className:"w-[335px] shrink-0",onEnabledChange:r?d=>r(u.id,d):void 0,onViewLogs:o?()=>o(u.id):void 0,onEdit:i?()=>i(u.id):void 0,onCopy:s?()=>s(u.id):void 0,onDelete:l?()=>l(u.id):void 0},u.id))}),P_=()=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:"shrink-0",children:a.jsx("path",{d:"M8 3.333v9.334M3.333 8h9.334",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})}),H_=({description:e,detailAddress:t,btnLabel:n="新建智能体助手",onCreateClick:r,className:o})=>a.jsxs("div",{className:j("content-stretch flex flex-col items-center justify-center py-[40px] px-[20px] w-full",o),children:[a.jsx(p3,{}),a.jsxs("div",{className:"mt-[16px] text-center text-[#999] text-[14px] leading-[normal]",children:[a.jsx("p",{className:"mb-0",children:e}),t?a.jsx("p",{children:a.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-[#0265ff] underline [text-decoration-skip-ink:none] decoration-solid",children:"了解详情"})}):null]}),a.jsxs("button",{onClick:r,className:"mt-[12px] bg-[#0265ff] content-stretch flex gap-[6px] items-center pl-[16px] pr-[20px] py-[7px] rounded-[4px] cursor-pointer border-none",children:[a.jsx(P_,{}),a.jsx("span",{className:"text-[14px] text-white whitespace-nowrap leading-[normal]",children:n})]})]}),B_=({agent:e,className:t,onSelect:n,onLogClick:r})=>a.jsx("div",{className:j("bg-white border border-[#e0e0e0] border-solid content-stretch flex flex-col items-start p-[16px] rounded-[10px] w-full drop-shadow-[0px_0px_5px_rgba(0,0,0,0.04)] hover:drop-shadow-[0px_0px_8px_rgba(0,0,0,0.1)]",oe,t),onClick:n,children:a.jsxs("div",{className:"content-stretch flex flex-col gap-[12px] items-start w-full",children:[a.jsxs("div",{className:"content-stretch flex items-center justify-between w-full",children:[a.jsxs("div",{className:"content-stretch flex gap-[10px] items-center min-w-0",children:[a.jsx("img",{alt:e.name,className:"rounded-[20px] shrink-0 size-[40px] object-cover",src:e.icon}),a.jsx("p",{className:"font-bold leading-[normal] overflow-hidden shrink-0 text-[#030303] text-[18px] text-ellipsis whitespace-nowrap",children:e.name}),e.installCount!=null&&e.installCount>0&&a.jsx("div",{className:"bg-[#f5f7fa] content-stretch flex h-[26px] items-center justify-center px-[6px] py-[10px] rounded-[100px] shrink-0",children:a.jsxs("p",{className:"leading-[normal] shrink-0 text-[#4d609f] text-[12px] whitespace-nowrap",children:["安装次数:",e.installCount.toLocaleString()]})})]}),a.jsxs("div",{className:"content-stretch flex gap-[10px] items-center shrink-0",children:[e.version&&a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"leading-[normal] shrink-0 text-[#999] text-[12px] whitespace-nowrap",children:["版本:",e.version]}),a.jsx("div",{className:"h-[14px] shrink-0 w-[1px] bg-[#e0e0e0]"})]}),!!e.lastUpdated&&a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"leading-[normal] shrink-0 text-[#999] text-[12px] whitespace-nowrap",children:e.lastUpdated}),a.jsx("div",{className:"h-[14px] shrink-0 w-[1px] bg-[#e0e0e0]"})]}),a.jsx("button",{className:"bg-[#eff0f6] content-stretch flex flex-col h-[30px] items-center justify-center px-[16px] py-[7px] rounded-[4px] shrink-0 cursor-pointer border-none hover:bg-[#f0f6ff] group/select",onClick:n,children:a.jsx("span",{className:"leading-[normal] shrink-0 text-[#030303] text-[14px] whitespace-nowrap group-hover/select:text-[#0265ff]",children:"选择"})})]})]}),e.description&&a.jsx("p",{className:"leading-[normal] shrink-0 text-[#666] text-[14px] w-full line-clamp-2",children:e.description})]})}),z_=()=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:a.jsx("path",{d:"M6.5 8.5C7.05228 8.5 7.5 8.94772 7.5 9.5V14C7.5 14.5177 7.10667 14.9438 6.60254 14.9951L6.5 15H2L1.89746 14.9951C1.42703 14.9472 1.05278 14.573 1.00488 14.1025L1 14V9.5C1 8.94772 1.44772 8.5 2 8.5H6.5ZM14 8.5C14.5523 8.5 15 8.94772 15 9.5V14C15 14.5177 14.6067 14.9438 14.1025 14.9951L14 15H9.5L9.39746 14.9951C8.92703 14.9472 8.55278 14.573 8.50488 14.1025L8.5 14V9.5C8.5 8.94772 8.94772 8.5 9.5 8.5H14ZM9.5 14H14V9.5H9.5V14ZM2 14H6.5V9.5H2V14ZM6.5 1C7.05228 1 7.5 1.44772 7.5 2V6.5C7.5 7.01768 7.10667 7.44379 6.60254 7.49512L6.5 7.5H2L1.89746 7.49512C1.42703 7.44722 1.05278 7.07297 1.00488 6.60254L1 6.5V2C1 1.44772 1.44772 1 2 1H6.5ZM14 1C14.5523 1 15 1.44772 15 2V6.5C15 7.01768 14.6067 7.44379 14.1025 7.49512L14 7.5H9.5L9.39746 7.49512C8.92703 7.44722 8.55278 7.07297 8.50488 6.60254L8.5 6.5V2C8.5 1.44772 8.94772 1 9.5 1H14ZM2 6.5H6.5V2H2V6.5ZM9.5 6.5H14V2H9.5V6.5Z",fill:"#666666"})}),V_=[{id:"all-agent",label:"全部"},{id:"system-agent",label:"系统智能体",icon:a.jsx(z_,{})},{id:"custom-agent",label:"自定义智能体",icon:a.jsx(Jo,{})}],U_=({value:e,onChange:t,className:n})=>a.jsx("div",{className:j("flex flex-col",n),children:V_.map(r=>{const o=e===r.id;return a.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(r.id),className:j("flex items-center gap-[6px] w-full h-[34px] px-[10px] rounded-[4px] text-left",o?"bg-[#EFF0F6]":"hover:bg-[#EFF0F6]",oe),children:[r.icon&&a.jsx("span",{className:"shrink-0 size-[16px] flex items-center justify-center text-[#666666]",children:r.icon}),a.jsx("span",{className:j("text-[14px] text-[#030303] leading-[normal] whitespace-nowrap",o?"font-bold":"font-normal"),children:r.label})]},r.id)})}),O9=[{id:"newest",label:"最新"},{id:"oldest",label:"最早"}],Z_=({value:e="newest",onChange:t,className:n})=>{var c,u;const[r,o]=b.useState(!1),i=(u=(c=O9.find(d=>d.id===e))==null?void 0:c.label)!=null?u:"最新",{portalContainer:s,setTriggerRef:l}=Gn("data-bs-weekdays-select-portal");return a.jsxs(ht,{open:r,onOpenChange:o,children:[a.jsx(mt,{asChild:!0,children:a.jsxs("button",{type:"button",ref:l,className:j("flex items-center gap-[6px] px-[10px] h-[34px] rounded-[4px] bg-transparent","text-[14px] text-[#030303] leading-[normal] whitespace-nowrap","hover:bg-[#EFF0F6]",r&&"bg-[#EFF0F6]",oe,n),children:[a.jsx(on,{code:"",className:"text-[16px]"}),a.jsx("span",{children:i})]})}),a.jsx(ut,{align:"start",sideOffset:4,className:"w-auto min-w-[100px] rounded-[4px] bg-white p-[4px] shadow-[0px_0px_8px_rgba(0,0,0,0.1)]",portalContainer:s,children:O9.map(d=>{const f=e===d.id;return a.jsxs("button",{type:"button",onClick:()=>{t==null||t(d.id),o(!1)},className:j("flex items-center justify-between w-full h-[34px] px-[10px] rounded-[4px] text-left",f?"bg-[#EFF0F6] text-[#0265FF]":"bg-white text-[#030303] hover:bg-[#EFF0F6]",oe),children:[a.jsx("span",{className:"text-[14px] leading-[normal] whitespace-nowrap",children:d.label}),a.jsx(gw,{size:16,className:j("shrink-0",f?"opacity-100":"opacity-0")})]},d.id)})})]})},I9=300,W_=()=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:a.jsx("path",{d:"M13.9004 15H2.65039C2.25257 15 1.87104 14.842 1.58973 14.5607C1.30843 14.2794 1.15039 13.8978 1.15039 13.5V4.5C1.15039 4.10218 1.30843 3.72064 1.58973 3.43934C1.87104 3.15804 2.25257 3 2.65039 3H7.15039L8.65039 4.5H13.9004C14.0974 4.5 14.2924 4.5388 14.4744 4.61418C14.6564 4.68956 14.8218 4.80005 14.9611 4.93934C15.1003 5.07863 15.2108 5.24399 15.2862 5.42597C15.3616 5.60796 15.4004 5.80302 15.4004 6H2.65039V13.5L4.25539 7.5H16.0754C16.1927 7.49595 16.3093 7.51947 16.4158 7.56867C16.5223 7.61788 16.6158 7.69139 16.6888 7.78331C16.7617 7.87523 16.8121 7.98298 16.8358 8.0979C16.8595 8.21282 16.856 8.33171 16.8254 8.445L15.3704 13.875C15.2865 14.1999 15.0961 14.4873 14.8296 14.6913C14.5631 14.8952 14.2359 15.0039 13.9004 15Z",fill:"#6F81BD"})}),G_=()=>a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:a.jsx("path",{d:"M3 3L9 9M9 3L3 9",stroke:"#999999",strokeWidth:"1.2",strokeLinecap:"round"})}),$_=()=>a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:[a.jsx("circle",{cx:"2",cy:"6",r:"1",fill:"#999999"}),a.jsx("circle",{cx:"6",cy:"6",r:"1",fill:"#999999"}),a.jsx("circle",{cx:"10",cy:"6",r:"1",fill:"#999999"})]}),D9={0:"pl-[10px]",1:"pl-[32px]",2:"pl-[54px]",3:"pl-[76px]"};function R9(e){var t;return(t=D9[Math.min(e,3)])!=null?t:D9[3]}function q_(e,t){const n=t.toLowerCase().trim(),r=new Map;for(const u of e){const d=u.parent||"0";r.has(d)||r.set(d,[]),r.get(d).push(u)}const o=new Set(e.map(u=>u.id)),i=new Set(r.keys()),s=Array.from(i).filter(u=>u==="0"||!o.has(u));function l(u,d){var h,m,g,x,C;const f=r.get(u)||[],p=[];for(const w of f){const k=w.itemType==="group",y=l(w.id,d+1),E=!n||((h=w==null?void 0:w.name)==null?void 0:h.toLowerCase().includes(n));k?(E||y.length>0)&&p.push({id:w.id,name:w.name,icon:(m=w.icon)!=null?m:0,type:(g=w.type)!=null?g:"group",itemType:"group",children:y,depth:d,form:w}):E&&p.push({id:w.id,name:w.name,icon:(x=w.icon)!=null?x:0,type:(C=w.type)!=null?C:"form",itemType:"form",children:[],depth:d,form:w})}return p}const c=[];for(const u of s)c.push(...l(u,0));return c}function Y_({item:e,depth:t,isSelected:n,onClick:r}){return a.jsx("div",{className:j("flex items-center justify-between h-[34px] px-[10px] cursor-pointer rounded-[4px] shrink-0",R9(t),n?"bg-[#F0F6FF] text-[#0265FF]":"text-[#030303] hover:bg-[#EFF0F6]",oe),onClick:r,children:a.jsxs("span",{className:"flex items-center gap-[6px] min-w-0 flex-1",children:[a.jsx(on,{name:e.icon}),a.jsx("span",{className:"text-[14px] leading-[normal] truncate",children:e.name})]})})}function P9({item:e,selectedIds:t,onSelect:n}){const[r,o]=b.useState(!0);return e.itemType==="group"?a.jsxs("div",{children:[a.jsxs("div",{className:j("flex items-center gap-[6px] h-[34px] px-[10px] cursor-pointer rounded-[4px]",R9(e.depth),"hover:bg-[#EFF0F6]",oe),onClick:()=>o(!r),children:[a.jsx("span",{className:j("shrink-0 flex items-center justify-center w-[16px] h-[16px] text-[#666666]",oe,r&&"rotate-90"),children:a.jsx(Fr,{className:"-rotate-90",size:16})}),a.jsx(W_,{}),a.jsx("span",{className:"text-[14px] text-[#030303] truncate",children:e.name})]}),r&&e.children.map(i=>a.jsx(P9,{item:i,selectedIds:t,onSelect:n},i.id))]}):a.jsx(Y_,{item:e,depth:e.depth,isSelected:t.has(e.id),onClick:()=>{e.form&&n(e.form)}})}function H9({searchQuery:e,onSearchChange:t,tree:n,selectedIds:r,onSelect:o,hasSearch:i,allowEmpty:s,emptyLabel:l,onEmptySelect:c}){return a.jsxs("div",{className:j("bg-white rounded-[10px] shadow-[0px_0px_5px_rgba(0,0,0,0.04)] p-[4px]","flex min-h-0 flex-col gap-[4px] overflow-hidden"),style:{maxHeight:I9},children:[a.jsxs("div",{className:"flex shrink-0 items-center gap-[6px] border border-[#E0E0E0] rounded-[4px] h-[30px] px-[10px] py-[5px]",children:[a.jsx(gn,{}),a.jsx("input",{type:"text",value:e,onChange:u=>t(u.target.value),placeholder:"输入表单名称来搜索",className:"flex-1 outline-none text-[14px] placeholder:text-[#999999] bg-transparent min-w-0 text-[#030303]"})]}),s&&!i&&a.jsx("div",{className:j("flex items-center h-[34px] px-[10px] cursor-pointer rounded-[4px] shrink-0",r.size===0?"bg-[#F0F6FF] text-[#0265FF]":"text-[#030303] hover:bg-[#EFF0F6]",oe),onClick:c,children:a.jsx("span",{className:"text-[14px] leading-[normal] truncate",children:l})}),a.jsx("div",{className:"flex min-h-0 flex-col gap-0 overflow-y-auto",children:n.length>0?n.map(u=>a.jsx(P9,{item:u,selectedIds:r,onSelect:o},u.id)):i?a.jsx("div",{className:"text-[12px] text-[#999999] py-[8px] text-center",children:"无匹配结果"}):a.jsx("div",{className:"text-[12px] text-[#999999] py-[8px] text-center",children:"暂无表单"})})]})}const Ac=b.forwardRef(({items:e,multiple:t=!1,value:n,defaultValue:r,onChange:o,placeholder:i="请选择表单",disabled:s=!1,className:l,allowEmpty:c=!1,emptyLabel:u="无",maxVisibleChips:d=4,popoverOnly:f},p)=>{var le;const[h,m]=b.useState(!1),[g,x]=b.useState(""),[C,w]=b.useState(r),k=b.useRef(null),y=b.useRef(null),[E,v]=b.useState(null),{popoverStyle:_,updatePopoverPosition:L}=sc(k,{estimatedHeight:I9}),T=n!=null?n:C,M=b.useMemo(()=>Array.isArray(T)?new Set(T):new Set(T?[T]:[]),[T]),B=Array.isArray(T)?void 0:T,P=b.useMemo(()=>q_(e,g),[e,g]),A=b.useMemo(()=>{var Q;return B&&(Q=e.find(ee=>ee.id===B&&ee.itemType!=="group"))!=null?Q:null},[e,B]),O=b.useMemo(()=>t?e.filter(Q=>M.has(Q.id)&&Q.itemType!=="group"):[],[t,e,M]),H=O.slice(0,d),I=O.length-H.length,V=g.trim().length>0,z=b.useCallback(Q=>{if(k.current=Q,!Q){v(null);return}const ee=Q.getRootNode();if(ee instanceof ShadowRoot){const J=ee.querySelector("[data-bs-form-select-portal]");if(J){v(J);return}const ie=ee.getElementById("ai-office-container")||ee,ve=document.createElement("div");ve.setAttribute("data-bs-form-select-portal","true"),ie.appendChild(ve),v(ve);return}v(null)},[]),$=b.useCallback(()=>{m(!1),x("")},[]),N=b.useCallback(()=>{s||(h?$():(m(!0),L()))},[s,h,$,L]),U=b.useCallback(Q=>{if(!t){w(Q.id),o==null||o({form:Q}),$();return}const ee=M.has(Q.id)?[...M].filter(J=>J!==Q.id):[...M,Q.id];w(ee),o==null||o({forms:e.filter(J=>ee.includes(J.id)&&J.itemType!=="group")})},[t,M,e,o,$]),te=b.useCallback((Q,ee)=>{if(ee.stopPropagation(),s)return;const J=[...M].filter(ie=>ie!==Q);w(J),o==null||o({forms:e.filter(ie=>J.includes(ie.id)&&ie.itemType!=="group")})},[s,M,e,o]),F=b.useCallback(()=>{w(""),o==null||o({}),$()},[o,$]);b.useEffect(()=>{var ie;if(!h)return;const Q=(ie=k.current)==null?void 0:ie.getRootNode(),ee=Q!=null?Q:document,J=ve=>{const ye=ve.target;y.current&&y.current.contains(ye)||k.current&&k.current.contains(ye)||$()};return ee.addEventListener("mousedown",J),()=>{ee.removeEventListener("mousedown",J)}},[h,$]),b.useEffect(()=>{if(!h)return;const Q=()=>{L()};return window.addEventListener("resize",Q),()=>window.removeEventListener("resize",Q)},[h,L]),b.useLayoutEffect(()=>{if(!h)return;let Q;const ee=()=>{L(),Q=requestAnimationFrame(ee)};return Q=requestAnimationFrame(ee),()=>cancelAnimationFrame(Q)},[h,L]),b.useEffect(()=>{var ie;if(!h)return;const Q=ve=>{ve.key==="Escape"&&$()},ee=(ie=k.current)==null?void 0:ie.getRootNode(),J=ee!=null?ee:document;return J.addEventListener("keydown",Q),()=>J.removeEventListener("keydown",Q)},[h,$]),b.useEffect(()=>{if(!h)return;const Q=y.current;if(!Q)return;const ee=J=>J.stopPropagation();return Q.addEventListener("mousedown",ee),Q.addEventListener("pointerdown",ee),Q.addEventListener("wheel",ee),()=>{Q.removeEventListener("mousedown",ee),Q.removeEventListener("pointerdown",ee),Q.removeEventListener("wheel",ee)}},[h]);const re=t&&O.length>0;return f?a.jsx(H9,{searchQuery:g,onSearchChange:x,tree:P,selectedIds:M,onSelect:U,hasSearch:V,allowEmpty:c&&!t,emptyLabel:u,onEmptySelect:F}):a.jsxs("div",{ref:p,className:j("relative inline-flex min-w-0 w-full",l),children:[a.jsxs("div",{ref:z,className:j("flex items-center gap-[10px] px-[10px] py-[7px] rounded-[4px] cursor-pointer select-none w-full","bg-white border",h?"border-[#0265FF]":"border-[#E0E0E0] hover:border-[#0265FF]",oe,s&&"opacity-50 cursor-not-allowed"),onClick:N,children:[re?a.jsxs("span",{className:"flex items-center gap-[4px] min-w-0 flex-1 overflow-x-auto scrollbar-hide",children:[H.map(Q=>{var ee;return a.jsxs("span",{className:"flex items-center gap-[4px] bg-[#EEEEEE] rounded-[2px] h-[26px] px-[6px] shrink-0 max-w-[160px]",onClick:J=>te(Q.id,J),children:[a.jsx(on,{name:(ee=Q.icon)!=null?ee:0,style:{fontSize:14}}),a.jsx("span",{className:"text-[14px] text-[#030303] truncate leading-[normal]",children:Q.name}),a.jsx("span",{className:"cursor-pointer flex items-center shrink-0 hover:bg-[#EFF0F6]",children:a.jsx(G_,{})})]},Q.id)}),I>0&&a.jsxs("span",{className:"flex items-center gap-[4px] bg-[#EEEEEE] rounded-[2px] h-[26px] px-[6px] shrink-0",children:[a.jsxs("span",{className:"text-[14px] text-[#030303] leading-[normal]",children:["+",I]}),a.jsx($_,{})]})]}):a.jsx("span",{className:"flex items-center gap-[6px] min-w-0 flex-1",children:A?a.jsxs(a.Fragment,{children:[a.jsx(on,{name:(le=A.icon)!=null?le:0}),a.jsx("span",{className:"text-[14px] text-[#030303] leading-[normal] truncate",children:A.name})]}):a.jsx("span",{className:"text-[14px] text-[#999999] leading-[normal] truncate",children:c&&!t?u:i})}),a.jsx("span",{className:j("shrink-0 flex items-center justify-center w-[16px] h-[16px] text-[#666666]",oe,h&&"rotate-180"),children:a.jsx(Fr,{size:16})})]}),h&&at.createPortal(a.jsx("div",{ref:y,className:"flex flex-col",style:_,children:a.jsx(H9,{searchQuery:g,onSearchChange:x,tree:P,selectedIds:M,onSelect:U,hasSearch:V,allowEmpty:c&&!t,emptyLabel:u,onEmptySelect:F})}),E||document.body)]})});Ac.displayName="FormSelect";function B9(e){var n;const t=e.type==="group";return{id:e.entryId,label:e.name,type:t?"formGroup":"form",formIcon:e.icon,data:t?void 0:e,children:(n=e.child)==null?void 0:n.map(B9)}}function z9(e){const t=e.formList;if(!t)return[];const n=[],r=o=>{o!=null&&o.length&&n.push(...o.map(B9))};return r(t.form),r(t.dash),r(t.aggregate_table),r(t.etl_table),n}function V9(e){var t;return{id:e._id,label:e.appname,type:"app",appIcon:(t=e.style)==null?void 0:t.icon,children:z9(e)}}function Tc(e,t){var i,s;const n=(i=e==null?void 0:e.items)!=null?i:[];if(!t)return[{key:"all",nodes:n.map(l=>{var c;return{id:l._id,label:l.name,type:"appGroup",children:((c=l.apps)!=null?c:[]).map(V9)}})}];let r=[];for(const l of n){const c=((s=l.apps)!=null?s:[]).find(u=>u._id===t);if(c){r=z9(c);break}}const o=n.map(l=>{var c;return{id:l._id,label:l.name,type:"appGroup",children:((c=l.apps)!=null?c:[]).filter(u=>u._id!==t).map(V9)}});return[{key:"current",title:"当前应用表单",nodes:r},{key:"other",title:"其他应用表单",nodes:o}]}function K_(e){const t=new Set,n=r=>{for(const o of r)o.children&&o.children.length>0&&(t.add(o.id),n(o.children))};return n(e),t}function X_(e,t){const n=t.trim().toLowerCase();if(!n)return e;const r=o=>{const i=[];for(const s of o){const l=s.label.toLowerCase().includes(n),c=s.children?r(s.children):[];(l||c.length>0)&&i.push({...s,children:c.length>0?c:s.children})}return i};return r(e)}function Q_(e){const[t,n]=b.useState(""),[r,o]=b.useState(new Set),i=b.useCallback(u=>!r.has(u),[r]),s=b.useCallback(u=>{o(d=>{const f=new Set(d);return f.has(u)?f.delete(u):f.add(u),f})},[]),l=b.useMemo(()=>{const u=t.trim().length>0;return e.map(d=>({...d,nodes:X_(d.nodes,t),searching:u}))},[e,t]),c=b.useMemo(()=>l.reduce((u,d)=>u+U9(d.nodes),0),[l]);return{searchQuery:t,setSearchQuery:n,filteredSections:l,isExpanded:i,toggleExpanded:s,searching:t.trim().length>0,hasResult:c>0,expandableIds:b.useMemo(()=>K_(e.reduce((u,d)=>u.concat(d.nodes),[])),[e])}}function U9(e){let t=0;for(const n of e)n.children&&n.children.length>0?t+=U9(n.children):t+=1;return t}const Z9=()=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:a.jsx("path",{d:"M13.9004 15H2.65039C2.25257 15 1.87104 14.842 1.58973 14.5607C1.30843 14.2794 1.15039 13.8978 1.15039 13.5V4.5C1.15039 4.10218 1.30843 3.72064 1.58973 3.43934C1.87104 3.15804 2.25257 3 2.65039 3H7.15039L8.65039 4.5H13.9004C14.0974 4.5 14.2924 4.5388 14.4744 4.61418C14.6564 4.68956 14.8218 4.80005 14.9611 4.93934C15.1003 5.07863 15.2108 5.24399 15.2862 5.42597C15.3616 5.60796 15.4004 5.80302 15.4004 6H2.65039V13.5L4.25539 7.5H16.0754C16.1927 7.49595 16.3093 7.51947 16.4158 7.56867C16.5223 7.61788 16.6158 7.69139 16.6888 7.78331C16.7617 7.87523 16.8121 7.98298 16.8358 8.0979C16.8595 8.21282 16.856 8.33171 16.8254 8.445L15.3704 13.875C15.2865 14.1999 15.0961 14.4873 14.8296 14.6913C14.5631 14.8952 14.2359 15.0039 13.9004 15Z",fill:"#6F81BD"})}),J_=({expanded:e})=>a.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",className:j("shrink-0",oe),style:{transform:e?"rotate(0deg)":"rotate(-90deg)"},children:a.jsx("path",{d:"M6 8L9 11L12 8",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),W9=({sections:e,value:t,onSelect:n,searchPlaceholder:r="输入应用/表单名称来搜索",maxHeight:o=400,className:i})=>{const{searchQuery:s,setSearchQuery:l,filteredSections:c,isExpanded:u,toggleExpanded:d,searching:f,hasResult:p}=Q_(e),h=b.useCallback(g=>{const x=g.children&&g.children.length>0;if(x||g.type!=="form"){x&&d(g.id);return}g.data&&n({appId:g.data.appId,entryId:g.data.entryId,form:g.data})},[n,d]),m=(g,x)=>{const C=g.children&&g.children.length>0,w=f||u(g.id),k=g.type==="form"&&t===g.id,y=x*22+10;return a.jsxs("div",{children:[a.jsxs("button",{type:"button",onClick:()=>h(g),className:j("flex items-center gap-[6px] w-full h-[34px] rounded-[4px] text-left pr-[10px] py-[10px]",oe,k?"bg-[#EFF0F6] text-[#030303]":"text-[#030303] hover:bg-[#EFF0F6]"),style:{paddingLeft:`${y}px`},children:[C&&a.jsx(J_,{expanded:w}),g.type==="appGroup"||g.type==="formGroup"?a.jsx(Z9,{}):null,g.type==="app"&&g.appIcon!=null&&a.jsx(Zd,{name:g.appIcon}),g.type==="form"&&g.formIcon!=null&&a.jsx(on,{name:g.formIcon}),a.jsx("span",{className:"text-[14px] truncate leading-[normal] flex-1 min-w-0",children:g.label})]}),C&&w&&a.jsx("div",{children:g.children.map(E=>m(E,x+1))})]},g.id)};return a.jsxs("div",{className:j("flex flex-col gap-[4px]",i),children:[a.jsxs("div",{className:"flex items-center gap-[6px] border border-[#E0E0E0] rounded-[4px] h-[30px] px-[10px] py-[5px]",children:[a.jsx(gn,{}),a.jsx("input",{type:"text",value:s,onChange:g=>l(g.target.value),placeholder:r,className:"flex-1 outline-none text-[14px] placeholder:text-[#999999] bg-transparent min-w-0 text-[#030303]"})]}),a.jsx("div",{className:"overflow-y-auto",style:{maxHeight:o,scrollbarWidth:"none"},"data-vaul-no-drag":!0,children:p?c.map(g=>a.jsxs("div",{children:[g.title&&a.jsxs("div",{className:"flex flex-col justify-between h-[32px] pr-[10px] pt-[9px]",children:[a.jsxs("div",{className:"flex items-center gap-[6px]",children:[a.jsx(Z9,{}),a.jsx("span",{className:"text-[12px] text-[#666666] leading-[normal]",children:g.title})]}),a.jsx("div",{className:"h-px bg-[#E0E0E0] mt-[7px]"})]}),g.nodes.map(x=>m(x,0))]},g.key)):a.jsx("div",{className:"flex items-center justify-center h-[60px] text-[12px] text-[#999999]",children:f?"未找到相关应用/表单":"暂无可选表单"})})]})},eN=({open:e})=>a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:j("shrink-0",oe),style:{transform:e?"rotate(180deg)":"rotate(0deg)"},children:a.jsx("path",{d:"M4 6L8 10L12 6",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})});function tN(e,t){if(!t)return null;let n=null;const r=o=>{for(const i of o){if(n)return;if(i.type==="form"&&i.id===t){n={label:i.label,formIcon:i.formIcon};return}i.children&&r(i.children)}};return e.forEach(o=>r(o.nodes)),n}const nN=({data:e,currentAppId:t,value:n,defaultValue:r,onChange:o,placeholder:i="请选择表单",searchPlaceholder:s,disabled:l=!1,className:c})=>{var _;const[u,d]=b.useState(!1),[f,p]=b.useState(r!=null?r:""),[h,m]=b.useState(null),[g,x]=b.useState(0),C=b.useRef(null),w=n!==void 0?n:f,k=b.useMemo(()=>Tc(e,t),[e,t]),y=b.useMemo(()=>tN(k,w),[k,w]),E=b.useCallback(L=>{if(C.current=L,L&&x(L.offsetWidth),!L){m(null);return}const T=L.getRootNode();if(T instanceof ShadowRoot){const M=T.querySelector("[data-bs-team-form-select-portal]");if(M){m(M);return}const B=document.createElement("div");B.setAttribute("data-bs-team-form-select-portal","true"),T.appendChild(B),m(B)}else m(null)},[]),v=b.useCallback(L=>{n===void 0&&p(L.entryId),o==null||o(L),d(!1)},[n,o]);return a.jsx("div",{className:j("relative",c),children:a.jsxs(ht,{open:u,onOpenChange:L=>{l||(d(L),L&&C.current&&x(C.current.offsetWidth))},children:[a.jsx(mt,{asChild:!0,children:a.jsxs("button",{ref:E,type:"button",disabled:l,className:j("flex items-center justify-between w-full h-[34px] gap-2.5 px-[10px]","bg-white border border-[#E0E0E0] rounded-[4px]","text-left cursor-pointer hover:border-[#0265FF]",l&&"opacity-50 cursor-not-allowed hover:border-[#E0E0E0]",u&&"border-[#0265FF]",oe),children:[a.jsx("span",{className:j("text-[14px] leading-[normal] truncate",y?"text-[#030303]":"text-[#999999]"),children:(_=y==null?void 0:y.label)!=null?_:i}),a.jsx(eN,{open:u})]})}),a.jsx(ut,{align:"start",sideOffset:4,portalContainer:h,className:"!border-0 rounded-[10px] shadow-[0px_0px_5px_rgba(0,0,0,0.04)] p-[12px]",style:{minWidth:g||void 0},children:a.jsx(W9,{sections:k,value:w,onSelect:v,searchPlaceholder:s})})]})})},rN=({data:e,currentAppId:t,value:n,onChange:r,open:o,defaultOpen:i,onOpenChange:s,searchPlaceholder:l,trigger:c,status:u,onRetry:d})=>{const[f,p]=b.useState(i!=null?i:!1),h=o!==void 0?o:f,m=b.useMemo(()=>Tc(e,t),[e,t]),g=b.useCallback(C=>{o===void 0&&p(C),s==null||s(C)},[o,s]),x=b.useCallback(C=>{r==null||r(C),g(!1)},[r,g]);return a.jsxs(a.Fragment,{children:[c&&a.jsx("span",{onClick:()=>g(!0),children:c}),a.jsx(ul,{open:h,onOpenChange:g,direction:"left",width:300,title:"切换表单",children:a.jsx("div",{className:"h-full overflow-hidden p-[12px]",children:u==="error"?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-[12px]",children:[a.jsx("span",{className:"text-[12px] text-[#999999]",children:"应用/表单加载失败"}),d&&a.jsx("button",{type:"button",onClick:d,className:"h-[30px] px-[16px] rounded-[4px] border border-[#E0E0E0] text-[14px] text-[#0265FF] active:bg-[#F0F6FF]",children:"重试"})]}):u==="loading"?a.jsx("div",{className:"flex items-center justify-center h-full text-[12px] text-[#999999]",children:"加载中…"}):a.jsx(W9,{sections:m,value:n,onSelect:x,searchPlaceholder:l,maxHeight:"calc(100vh - 60px)"})})})]})},oN=()=>a.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("rect",{x:"0.5",y:"0.5",width:"7",height:"7",rx:"1",fill:"#0265ff"})}),Pn=S.forwardRef(({className:e,children:t,id:n,readonly:r,disabled:o,intermediate:i,...s},l)=>{const c=S.useId(),u=n!=null?n:c;return a.jsxs("label",{htmlFor:u,className:j("inline-flex items-center gap-[6px] select-none text-[#121111] text-[14px]",o?"cursor-not-allowed":"cursor-pointer",{"pointer-events-none":r}),children:[a.jsx(TS,{ref:l,id:u,disabled:o,className:j("inline-flex shrink-0 items-center justify-center","w-[16px] h-[16px] rounded-[2px] box-border border","transition-colors duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#0265FF] focus-visible:ring-offset-1","border-[#E0E0E0] bg-white","hover:border-[#0265FF]","data-[state=checked]:bg-[#0265FF] data-[state=checked]:border-[#0265FF]","disabled:cursor-not-allowed disabled:bg-[#F0F0F0] disabled:border-[#C2C2C2]","disabled:data-[state=checked]:bg-[#C2C2C2] disabled:data-[state=checked]:border-[#C2C2C2]",i&&"bg-white border-[#0265FF] text-[#0265FF]",e,{"opacity-50":r}),...s,children:a.jsx(jS,{className:"text-white",forceMount:i||void 0,children:i?a.jsx(oN,{}):a.jsx(al,{})})}),t!=null&&a.jsx("span",{className:j("text-sm leading-none",o&&"text-[#C2C2C2]"),children:t})]})});Pn.displayName="SquareChecker";function iN(e){return e.map(t=>({id:t._id,label:t.name,type:"group",children:t.apps.map(n=>{var r;return{id:n._id,label:n.appname,type:"app",color:String(((r=n.style)==null?void 0:r.color)||"#666666"),data:n}})}))}const G9=()=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:a.jsx("path",{d:"M13.9004 15H2.65039C2.25257 15 1.87104 14.842 1.58973 14.5607C1.30843 14.2794 1.15039 13.8978 1.15039 13.5V4.5C1.15039 4.10218 1.30843 3.72064 1.58973 3.43934C1.87104 3.15804 2.25257 3 2.65039 3H7.15039L8.65039 4.5H13.9004C14.0974 4.5 14.2924 4.5388 14.4744 4.61418C14.6564 4.68956 14.8218 4.80005 14.9611 4.93934C15.1003 5.07863 15.2108 5.24399 15.2862 5.42597C15.3616 5.60796 15.4004 5.80302 15.4004 6H2.65039V13.5L4.25539 7.5H16.0754C16.1927 7.49595 16.3093 7.51947 16.4158 7.56867C16.5223 7.61788 16.6158 7.69139 16.6888 7.78331C16.7617 7.87523 16.8121 7.98298 16.8358 8.0979C16.8595 8.21282 16.856 8.33171 16.8254 8.445L15.3704 13.875C15.2865 14.1999 15.0961 14.4873 14.8296 14.6913C14.5631 14.8952 14.2359 15.0039 13.9004 15Z",fill:"#6F81BD"})}),sN=({expanded:e})=>a.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",className:j("shrink-0",oe),style:{transform:e?"rotate(0deg)":"rotate(-90deg)"},children:a.jsx("path",{d:"M6 8L9 11L12 8",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),aN=()=>a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:a.jsx("path",{d:"M3 3L9 9M9 3L3 9",stroke:"#999999",strokeWidth:"1.2",strokeLinecap:"round"})}),lN=()=>a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:[a.jsx("circle",{cx:"2",cy:"6",r:"1",fill:"#999999"}),a.jsx("circle",{cx:"6",cy:"6",r:"1",fill:"#999999"}),a.jsx("circle",{cx:"10",cy:"6",r:"1",fill:"#999999"})]}),$9=({open:e})=>a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:j("shrink-0",oe),style:{transform:e?"rotate(180deg)":"rotate(0deg)"},children:a.jsx("path",{d:"M4 6L8 10L12 6",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),Js="__all__";function cN(e){const t=new Map,n=r=>{for(const o of r)t.set(o.id,o),o.children&&n(o.children)};return n(e),t}const uN=({nodes:e,mode:t="single",popoverContentOnly:n,showAll:r=!1,allowEmpty:o=!1,emptyLabel:i="无",value:s,defaultValue:l,onChange:c,placeholder:u="请选择",searchPlaceholder:d="输入应用名称来搜索",disabled:f=!1,maxVisibleChips:p=4,className:h,contentCls:m,disableMaxHeight:g})=>{const[x,C]=b.useState(!1),[w,k]=b.useState(""),[y,E]=b.useState(l!=null?l:t==="multiple"?[]:""),[v,_]=b.useState(null),[L,T]=b.useState(0),M=b.useRef(null),B=qe({"max-h-[400px]":!g,"max-h-full":g}),[P,A]=b.useState(()=>{const W=new Set,K=(Y,se)=>{for(const ne of Y)ne.children&&ne.children.length>0&&se<2&&(W.add(ne.id),K(ne.children,se+1))};return K(e,0),W}),O=s!==void 0?s:y,H=b.useMemo(()=>cN(e),[e]),I=b.useMemo(()=>t==="multiple"?new Set(Array.isArray(O)?O:[]):new Set(typeof O=="string"&&O?[O]:[]),[O,t]),V=b.useMemo(()=>(Array.isArray(O)?O:O?[O]:[]).map(K=>{var Y,se;return(se=(Y=H.get(K))==null?void 0:Y.label)!=null?se:K}),[O,H]),z=t==="single"&&V.length===1?V[0]===Js?"全部应用":V[0]:null,$=b.useMemo(()=>{if(!w.trim())return e;const W=w.toLowerCase(),K=Y=>{var ne;const se=[];for(const xe of Y){const ae=(ne=xe==null?void 0:xe.label)==null?void 0:ne.toLowerCase().includes(W),Ie=xe.children?K(xe.children):[];(ae||Ie.length>0)&&se.push({...xe,children:Ie.length>0?Ie:xe.children})}return se};return K(e)},[e,w]),N=b.useCallback(W=>{if(M.current=W,W&&T(W.offsetWidth),!W){_(null);return}const K=W.getRootNode();if(K instanceof ShadowRoot){const Y=K.querySelector("[data-bs-app-select-portal]");if(Y){_(Y);return}const se=document.createElement("div");se.setAttribute("data-bs-app-select-portal","true"),K.appendChild(se),_(se)}else _(null)},[]),U=b.useCallback(W=>{s===void 0&&E(W),c==null||c(W)},[s,c]),te=b.useCallback(W=>{A(K=>{const Y=new Set(K);return Y.has(W)?Y.delete(W):Y.add(W),Y})},[]),F=b.useCallback((W,K)=>{if(K.type==="group"||K.children&&K.children.length>0){te(W);return}if(t==="single")U(W),C(!1);else{const Y=Array.isArray(O)?[...O]:[],se=Y.indexOf(W);se>=0?Y.splice(se,1):Y.push(W),U(Y)}},[t,O,U,te]),re=b.useCallback((W,K)=>{K.stopPropagation(),t==="multiple"&&Array.isArray(O)&&U(O.filter(Y=>Y!==W))},[t,O,U]),le=b.useCallback(W=>{f||(C(W),W&&M.current&&T(M.current.offsetWidth),W||k(""))},[f]),Q=t==="multiple"?V:[],ee=Q.slice(0,p),J=Q.length-ee.length,ie=b.useCallback((W,K)=>{var ae;const Y=W.children&&W.children.length>0,se=P.has(W.id),ne=I.has(W.id),xe=K*22+10;return a.jsxs("div",{children:[a.jsxs("button",{type:"button",onClick:()=>F(W.id,W),className:j("flex items-center gap-[6px] w-full h-[34px] rounded-[4px] text-left","pr-[10px]",oe,ne?"bg-[#F0F6FF] text-[#0265FF]":"text-[#030303] hover:bg-[#EFF0F6]"),style:{paddingLeft:`${xe}px`,paddingTop:"10px",paddingBottom:"10px"},children:[Y&&a.jsx(sN,{expanded:se}),W.type==="group"&&!Y&&a.jsx(G9,{}),W.type==="group"&&Y&&a.jsx(G9,{}),W.type==="app"&&a.jsx(Zd,{name:(ae=W.data)==null?void 0:ae.style.icon}),a.jsx("span",{className:"text-[14px] truncate leading-[normal] flex-1 min-w-0",children:W.label}),t==="multiple"&&!Y&&W.type!=="group"&&a.jsx("span",{onClick:Ie=>Ie.stopPropagation(),className:"grid place-items-center",children:a.jsx(Pn,{checked:ne,onCheckedChange:()=>F(W.id,W),className:"shrink-0"})})]}),Y&&se&&a.jsx("div",{children:W.children.map(Ie=>ie(Ie,K+1))})]},W.id)},[P,I,t,F]),ve=t==="multiple"&&Q.length>0,ye=a.jsxs("div",{className:qe("flex min-h-0 flex-col gap-[4px]",m),children:[a.jsxs("div",{className:"flex shrink-0 items-center gap-[6px] border border-[#E0E0E0] rounded-[4px] h-[30px] px-[10px] py-[5px]",children:[a.jsx(gn,{}),a.jsx("input",{type:"text",value:w,onChange:W=>k(W.target.value),placeholder:d,className:"flex-1 outline-none text-[14px] placeholder:text-[#999999] bg-transparent min-w-0 text-[#030303]"})]}),o&&t==="single"&&!w.trim()&&a.jsx("button",{type:"button",onClick:()=>{U(""),C(!1)},className:j("flex shrink-0 items-center w-full h-[34px] rounded-[4px] text-left","px-[10px]",oe,"text-[#030303] hover:bg-[#EFF0F6]"),children:a.jsx("span",{className:"text-[14px] leading-[normal]",children:i})}),r&&t==="single"&&!w.trim()&&a.jsx("button",{type:"button",onClick:()=>{U(Js),C(!1)},className:j("flex shrink-0 items-center w-full h-[34px] rounded-[4px] text-left","px-[10px]",oe,I.has(Js)?"bg-[#F0F6FF] text-[#0265FF]":"text-[#030303] hover:bg-[#EFF0F6]"),children:a.jsx("span",{className:"text-[14px] leading-[normal]",children:"全部应用"})}),a.jsx("div",{className:qe("min-h-0 overflow-y-auto",B),children:$.length>0?$.map(W=>ie(W,0)):a.jsx("div",{className:"flex items-center justify-center h-[60px] text-[12px] text-[#999999]",children:w.trim()?"未找到相关应用":"暂无应用"})})]});return n?ye:a.jsx("div",{className:j("relative",h),children:a.jsxs(ht,{open:x,onOpenChange:le,children:[a.jsx(mt,{asChild:!0,children:a.jsx("button",{ref:N,type:"button",disabled:f,className:j("flex items-center justify-between w-full h-[34px] gap-2.5","bg-white border border-[#E0E0E0] rounded-[4px]","py-[7px]",ve?"pl-[4px] pr-[10px]":"px-[10px]","text-left cursor-pointer","hover:border-[#0265FF]",f&&"opacity-50 cursor-not-allowed hover:border-[#E0E0E0]",x&&"border-[#0265FF]",oe),children:ve?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-[4px] min-w-0 flex-1 overflow-x-auto scrollbar-hide",children:[ee.map((W,K)=>a.jsxs("span",{className:"flex items-center gap-[4px] bg-[#EEEEEE] rounded-[2px] h-[26px] px-[6px] shrink-0 max-w-[160px]",onClick:Y=>{Y.stopPropagation();const se=Array.isArray(O)?O:[];se[K]&&re(se[K],Y)},children:[a.jsx("span",{className:"text-[14px] text-[#030303] truncate leading-[normal]",children:W}),a.jsx("span",{className:"cursor-pointer flex items-center shrink-0 hover:bg-[#EFF0F6]",children:a.jsx(aN,{})})]},K)),J>0&&a.jsxs("span",{className:"flex items-center gap-[4px] bg-[#EEEEEE] rounded-[2px] h-[26px] px-[6px] shrink-0",children:[a.jsxs("span",{className:"text-[14px] text-[#030303] leading-[normal]",children:["+",J]}),a.jsx(lN,{})]})]}),a.jsx($9,{open:x})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:j("text-[14px] leading-[normal] truncate",z?"text-[#030303]":"text-[#999999]"),children:z!=null?z:o?i:u}),a.jsx($9,{open:x})]})})}),a.jsx(ut,{align:"start",sideOffset:4,portalContainer:v,className:"flex flex-col overflow-hidden !border-0 rounded-[10px] shadow-[0px_0px_5px_rgba(0,0,0,0.04)] p-[4px]",style:{minWidth:L||void 0,maxHeight:300},children:ye})]})})},Fc=({defaultChecked:e=!1,checked:t,onCheckedChange:n,title:r,description:o,disabled:i=!1,className:s})=>{const[l,c]=b.useState(!!e),u=t!==void 0,d=u?!!t:l,f=b.useRef(d);f.current=d;const p=h=>{if(h.target!==h.currentTarget||i)return;const m=!f.current;u||c(m),n==null||n(m)};return a.jsxs("div",{role:"button",tabIndex:i?-1:0,"aria-checked":d,"aria-disabled":i,onClick:p,onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),p(h))},className:j("flex flex-col gap-[6px] p-[10px] rounded-[4px] cursor-pointer select-none bg-white","border",d?"border-[#0265FF]":"border-[#E0E0E0]",i&&"cursor-not-allowed opacity-50",s),children:[a.jsxs("div",{className:"inline-flex items-center gap-[6px] pointer-events-none",children:[a.jsx(Pn,{checked:d,disabled:i}),a.jsx("span",{className:"text-[#121111] text-[14px]",children:r})]}),o!=null&&a.jsx("p",{className:"text-[#666] text-[12px] pl-[22px] pointer-events-none",children:o})]})},dN=[{type:"submit",title:"表单提交数据"},{type:"edit",title:"表单编辑数据"},{type:"delete",title:"表单删除数据"},{type:"init",title:"表单初始化"},{type:"edit_init",title:"表单编辑初始化"}],fN=({multiple:e=!1,value:t,onChange:n})=>{const r=e?Array.isArray(t)?t:[]:null;return a.jsx("div",{className:"flex gap-[20px]",children:dN.map(o=>{const i=e?r.includes(o.type):t===o.type;return a.jsx(Fc,{className:"flex-[1_0_0] min-w-px",title:o.title,checked:i,onCheckedChange:s=>{if(e){const l=s?[...r,o.type]:r.filter(c=>c!==o.type);n==null||n(l)}else s&&(n==null||n(o.type))}},o.type)})})},pN=[{type:"flow_end",title:"流程结束"},{type:"flow_node",title:"流程节点"}],hN=({multiple:e=!1,value:t,onChange:n})=>{const r=e?Array.isArray(t)?t:[]:null;return a.jsx("div",{className:"flex gap-[20px]",children:pN.map(o=>{const i=e?r.includes(o.type):t===o.type;return a.jsx(Fc,{className:"flex-[1_0_0] min-w-px max-w-[216px]",title:o.title,checked:i,onCheckedChange:s=>{if(e){const l=s?[...r,o.type]:r.filter(c=>c!==o.type);n==null||n(l)}else s&&(n==null||n(o.type))}},o.type)})})},mN=[{value:"custom",label:"自定义时间"},{value:"date_field",label:"根据表单日期时间字段"}],q9=({value:e,onChange:t,placeholder:n="请选择时间来源类型",disabled:r=!1,className:o})=>a.jsxs(er,{value:e,onValueChange:i=>t==null?void 0:t(i),disabled:r,children:[a.jsx(Fn,{className:o,children:a.jsx(tr,{placeholder:n})}),a.jsx(jn,{children:mN.map(i=>a.jsx(On,{value:i.value,children:i.label},i.value))})]}),jc=1e3,Oc=2999,Ic=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],gN=["一","二","三","四","五","六","日"];function xN(e,t){const o=(new Date(e,t,1).getDay()-1+7)%7;return new Date(e,t,1-o)}function Y9(e,t){return new Date(e,t+1,0).getDate()}function K9(e,t,n){const r=e.h*36e5+e.m*6e4+e.s*1e3+e.ms,o=t.h*36e5+t.m*6e4+t.s*1e3+t.ms,i=n.h*36e5+n.m*6e4+n.s*1e3+n.ms;return r>=o&&r<=i}function bo(e,t,n,r,o="day"){if(o==="year"){const l=e.getFullYear();return l>=t.getFullYear()&&l<=n.getFullYear()}if(o==="month"){const l=e.getFullYear(),c=e.getMonth(),u=t.getFullYear(),d=t.getMonth(),f=n.getFullYear(),p=n.getMonth();return!(l<u||l>f||l===u&&c<d||l===f&&c>p)}e.setHours(0,0,0,0);const i=new Date(t);i.setHours(0,0,0,0);const s=new Date(n);return s.setHours(0,0,0,0),!(e<i||e>s||r&&r.length>0&&!r.includes(e.getDay()))}function bN(e,t,n){const r=e.getTime(),o=t.getTime(),i=n.getTime();return r<o?new Date(t):r>i?new Date(n):new Date(e)}function X9(e,t,n){if(n==="year")return e.getFullYear()>t.getFullYear();const r=e.getFullYear(),o=e.getMonth(),i=t.getFullYear(),s=t.getMonth();return r>i||r===i&&o>s}function Q9(e,t,n){if(n==="year")return e.getFullYear()<t.getFullYear();const r=e.getFullYear(),o=e.getMonth(),i=t.getFullYear(),s=t.getMonth();return r<i||r===i&&o<s}function e1(e,t){const n=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0"),i=String(e.getHours()).padStart(2,"0"),s=String(e.getMinutes()).padStart(2,"0"),l=String(e.getSeconds()).padStart(2,"0");return t==="yyyy-MM-dd"?`${n}-${r}-${o}`:t==="yyyy-MM-dd HH:mm:ss"?`${n}-${r}-${o} ${i}:${s}:${l}`:t==="yyyy-MM-dd HH:mm"?`${n}-${r}-${o} ${i}:${s}`:t==="HH:mm:ss"?`${i}:${s}:${l}`:t==="HH:mm"?`${i}:${s}`:t==="yyyy-MM"?`${n}-${r}`:t==="yyyy"?`${n}`:`${n}-${r}-${o}`}const zr="text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px]",xi='text-[#999] relative pointer-events-none before:absolute before:left-0 before:right-0 before:top-1 before:h-[28px] before:bg-[#f3f3f3] before:opacity-60 before:content-[""]';function CN({year:e,month:t,day:n,format:r,minDate:o,maxDate:i,week:s,onYearReduce:l,onYearAdd:c,onMonthReduce:u,onMonthAdd:d,onMonthMenu:f,onYearMenu:p,onChangeDay:h}){const m=r.includes("dd"),g=b.useMemo(()=>{const x=xN(e,t),C=new Date,w=`${C.getFullYear()}-${C.getMonth()}-${C.getDate()}`,k=[],y=new Date(x);for(let E=0;E<6;E++){const v=[];for(let _=0;_<7;_++){const L=y.getDate(),T=y.getMonth(),M=y.getFullYear();let B=bo(new Date(M,T,L,0,0,0,0),o,i,s,"day")?"":"disabled";B||(t!==T?B="oday":(B="day",(_===5||_===6)&&(B+=" weekend"),`${M}-${T}-${L}`===w&&(B+=" today"),n===L&&t===T&&(B+=" selected"))),v.push({day:L,month:T,year:M,css:B,key:`d${M}-${T}-${L}`}),y.setDate(y.getDate()+1)}k.push(v)}for(;k.length>4&&k[k.length-1].every(E=>E.month!==t);)k.pop();return k},[e,t,n,o,i,s]);return m?a.jsxs(a.Fragment,{children:[a.jsxs("thead",{children:[a.jsxs("tr",{children:[a.jsx("td",{className:j(zr,"btn prevm hover:text-[#0265ff]",!X9(new Date(e,t,1),o,"year")&&"disabled "+xi),colSpan:1,onClick:l,children:a.jsx(bw,{size:14})}),a.jsx("td",{className:j(zr,"btn prevm hover:text-[#0265ff]",!X9(new Date(e,t,1),o,"month")&&"disabled "+xi),colSpan:1,onClick:u,children:a.jsx(Ls,{size:14})}),a.jsxs("td",{className:j(zr,"title font-bold p-0.5"),colSpan:3,children:[a.jsx("span",{className:"title-month mr-1.5 hover:text-[#0265ff] cursor-pointer",onClick:f,children:Ic[t]}),a.jsx("span",{children:", "}),a.jsx("span",{className:"title-year hover:text-[#0265ff] cursor-pointer",onClick:p,children:e})]}),a.jsx("td",{className:j(zr,"btn nextm hover:text-[#0265ff]",!Q9(new Date(e,t,1),i,"month")&&"disabled "+xi),colSpan:1,onClick:d,children:a.jsx(As,{size:14})}),a.jsx("td",{className:j(zr,"btn nextm hover:text-[#0265ff]",!Q9(new Date(e,t,1),i,"year")&&"disabled "+xi),colSpan:1,onClick:c,children:a.jsx(Cw,{size:14})})]}),a.jsx("tr",{children:gN.map((x,C)=>a.jsx("td",{className:j(zr,"day name week font-bold hover:bg-transparent hover:p-0 hover:border-none",(C===5||C===6)&&"text-[#e34d59]"),children:x},x))})]}),a.jsx("tbody",{children:g.slice(0,6).map((x,C)=>a.jsx("tr",{children:x.map(w=>{const k=w.css.includes("disabled"),y=w.css.includes("oday"),E=w.css.includes("today"),v=w.css.includes("selected"),_=w.css.includes("weekend");return a.jsx("td",{className:j(zr,k&&xi,y&&"text-[#e0e0e0] hover:bg-[rgba(2,101,255,0.08)]",!k&&!y&&"hover:bg-[rgba(2,101,255,0.08)]",E&&"font-bold text-[#0265ff]",_&&"text-[#e34d59]",v&&"font-bold p-[1px] text-white border border-[#0265ff] bg-[#0265ff] hover:border-[#0265ff] hover:bg-[#0265ff]"),onClick:()=>h(w.day,w.month,w.year,w.css),children:a.jsx("div",{className:"day-wrapper",children:a.jsx("div",{className:"day-item",children:w.day})})},w.key)})},C))})]}):null}const bi="text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px]",wN='text-[#999] relative pointer-events-none before:absolute before:left-0 before:right-0 before:top-[20px] before:h-[28px] before:bg-[#f3f3f3] before:opacity-60 before:content-[""]';function yN({year:e,month:t,showYear:n,position:r,minDate:o,maxDate:i,week:s,onYearReduce:l,onYearAdd:c,onYearMenu:u,onMountOk:d}){const f=p=>bo(p,o,i,s,"month");return a.jsxs("table",{cellSpacing:0,cellPadding:0,className:"mt bg-white rounded-[4px]",style:{position:r},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("td",{className:j(bi,"btn prevy hover:text-[#0265ff]"),colSpan:1,onClick:l,children:a.jsx(Ls,{size:14})}),a.jsx("td",{className:j(bi,"year title font-bold p-0.5"),colSpan:1,children:a.jsx("span",{className:"title-year hover:text-[#0265ff] cursor-pointer",onClick:u,children:e})}),a.jsx("td",{className:j(bi,"btn nexty hover:text-[#0265ff]"),colSpan:1,onClick:c,children:a.jsx(As,{size:14})})]})}),a.jsx("tbody",{children:[0,1,2,3].map(p=>a.jsx("tr",{children:[0,1,2].map(h=>{const m=p*3+h;if(m>11)return a.jsx("td",{className:bi},m);const g=f(new Date(e,m,1)),x=t===m&&!n,C=!g;return a.jsx("td",{className:j(bi,"month w-[58px] h-[38px] hover:bg-[rgba(2,101,255,0.08)]",x&&"font-bold p-[1px] text-white border border-[#0265ff] bg-[#0265ff] hover:border-[#0265ff] hover:bg-[#0265ff]",C&&wN),onClick:()=>{C||d(m)},children:Ic[m]},m)})},p))})]})}const t1="text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px]",vN='text-[#999] relative pointer-events-none before:absolute before:left-0 before:right-0 before:top-[14px] before:h-[28px] before:bg-[#f3f3f3] before:opacity-60 before:content-[""]';function J9({year:e,position:t,showYearLabel:n,minDate:r,maxDate:o,week:i,onYearFReduce:s,onYearFAdd:l,onSelectYear:c}){const u=e-9,d=e+10,f=b.useMemo(()=>{const p=[];for(let h=0;h<5;h++){const m=[];for(let g=0;g<4;g++){const x=u+h*4+g,C=bo(new Date(x,0,1),r,o,i,"year");m.push({year:x,isSelected:e===x,isDisabled:!C})}p.push(m)}return p},[u,e,r,o,i]);return a.jsxs("table",{cellSpacing:0,cellPadding:0,className:"yt bg-white rounded-[4px] w-full h-full",style:{position:t},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("td",{className:j(t1,"btn prevy hover:text-[#0265ff] grid place-content-center"),colSpan:1,onClick:s,children:a.jsx(Ls,{size:14})}),a.jsx("td",{className:j(t1,"year title font-bold p-0.5"),colSpan:2,children:n?`${u}年 - ${d}年`:`${u} - ${d}`}),a.jsx("td",{className:j(t1,"btn nexty hover:text-[#0265ff] grid place-content-center"),colSpan:1,onClick:l,children:a.jsx(As,{size:14})})]})}),a.jsx("tbody",{children:f.map((p,h)=>a.jsx("tr",{children:p.map(m=>a.jsx("td",{className:j(t1,"year",m.isSelected&&"font-bold p-[1px] text-white border border-[#0265ff] bg-[#0265ff] hover:border-[#0265ff] hover:bg-[#0265ff]",m.isDisabled&&vN),onClick:()=>{m.isDisabled||c(m.year)},children:m.year},m.year))},h))})]})}const kN="h-[32px] leading-[32px] text-center cursor-pointer rounded-[4px] hover:bg-[rgba(2,101,255,0.08)]";function EN({hours:e,minutes:t,seconds:n,year:r,month:o,day:i,format:s,minDate:l,maxDate:c,startTime:u,endTime:d,onHoursChange:f,onMinutesChange:p,onSecondsChange:h}){const m=s.includes("mm"),g=s.includes("ss"),x=C=>{const w=C==="hours"?24:60,k={hours:"时",minutes:"分",seconds:"秒"},y=C==="hours"?e:C==="minutes"?t:n,E=C==="hours"?f:C==="minutes"?p:h;return a.jsxs("div",{className:j("col flex-1 border-l border-[#e0e0e0]",C),children:[a.jsx("div",{className:"label h-[32px] leading-[32px] text-center",children:k[C]}),a.jsx("div",{className:"col-list h-[200px] overflow-auto",children:Array.from({length:w},(v,_)=>{const L=y===_;let T=!1;const M=l.getFullYear()===r&&l.getMonth()===o&&l.getDate()===i,B=c.getFullYear()===r&&c.getMonth()===o&&c.getDate()===i;return M&&(T=!K9({h:C==="hours"?_:e,m:C==="minutes"?_:t,s:C==="seconds"?_:n,ms:0},u,{h:23,m:59,s:59,ms:999})),B&&!T&&(T=!K9({h:C==="hours"?_:e,m:C==="minutes"?_:t,s:C==="seconds"?_:n,ms:0},{h:0,m:0,s:0,ms:0},d)),a.jsx("div",{className:j(kN,L&&!T&&"select bg-[rgba(2,101,255,0.2)]",T&&"text-[#999] pointer-events-none opacity-80"),onClick:()=>{T||E(_)},children:_>9?_:`0${_}`},_)})})]})};return a.jsxs("div",{className:"time-range w-[180px]",children:[a.jsxs("div",{className:"time-input flex h-[40px] border-l border-[#e0e0e0]",children:[a.jsx("input",{type:"number",value:e,className:"h-[24px] w-[38px] my-[10px] mx-[10px] mt-[10px] text-center pl-[5px] flex-1",onChange:C=>{const w=Math.min(23,Math.max(0,parseInt(C.target.value)||0));f(w)}}),m&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"leading-[40px]",children:":"}),a.jsx("input",{type:"number",value:t,className:"h-[24px] w-[38px] my-[10px] mx-[10px] mt-[10px] text-center pl-[5px] flex-1",onChange:C=>{const w=Math.min(59,Math.max(0,parseInt(C.target.value)||0));p(w)}})]}),g&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"leading-[40px]",children:":"}),a.jsx("input",{type:"number",value:n,className:"h-[24px] w-[38px] my-[10px] mx-[10px] mt-[10px] text-center pl-[5px] flex-1",onChange:C=>{const w=Math.min(59,Math.max(0,parseInt(C.target.value)||0));h(w)}})]})]}),a.jsxs("div",{className:"time-select-range flex border-t border-[#e0e0e0]",style:{height:"calc(100% - 40px)"},children:[x("hours"),m&&x("minutes"),g&&x("seconds")]})]})}function SN({hasTime:e,hasDay:t,todayCls:n,onToday:r,onOk:o}){return!e&&!t?null:a.jsx("div",{className:"footer h-[40px] leading-[40px] text-center border-t border-[#e0e0e0]",children:a.jsxs("div",{className:"hms px-[10px]",children:[a.jsx("div",{className:j("btn cursor-pointer px-[5px] mx-[5px]",e?"current-time float-left text-[#0265ff] ml-0 pl-0 text-center":"today float-left text-[#0265ff] ml-0 pl-0 text-center",n==="disabled"&&"text-[#999] pointer-events-none opacity-80"),onClick:r,children:e?"当前时间":"今天"}),e&&a.jsx("div",{className:"btn ok mr-0 text-white bg-[#0265ff] rounded-[4px] h-[24px] leading-[24px] mt-[8px] float-right cursor-pointer px-[5px] hover:opacity-80",onClick:o,children:"确定"})]})})}function e7({value:e,onChange:t,format:n="yyyy-MM-dd",minDate:r,maxDate:o,week:i,className:s}){const l=e?new Date(e):new Date,[c,u]=b.useState(l.getFullYear()),[d,f]=b.useState(l.getMonth()),[p,h]=b.useState(l.getDate()),[m,g]=b.useState(l.getHours()),[x,C]=b.useState(l.getMinutes()),[w,k]=b.useState(l.getSeconds()),[y,E]=b.useState(!1),[v,_]=b.useState(!1),[L,T]=b.useState(n.includes("HH")),M=b.useMemo(()=>r!=null?r:new Date(jc,0,1,0,0,0,0),[r]),B=b.useMemo(()=>o!=null?o:new Date(Oc,11,31,23,59,59,999),[o]),P=b.useMemo(()=>i?i.map(me=>parseInt(String(me))):[],[i]),A=b.useMemo(()=>n==="yyyy-MM-dd HH:mm:ss"?{h:M.getHours(),m:M.getMinutes(),s:M.getSeconds(),ms:M.getMilliseconds()}:{h:0,m:0,s:0,ms:0},[n,M]),O=b.useMemo(()=>n==="yyyy-MM-dd HH:mm:ss"?{h:B.getHours(),m:B.getMinutes(),s:B.getSeconds(),ms:B.getMilliseconds()}:{h:23,m:59,s:59,ms:999},[n,B]);b.useEffect(()=>{e&&(u(e.getFullYear()),f(e.getMonth()),h(e.getDate()),g(e.getHours()),C(e.getMinutes()),k(e.getSeconds()))},[e]),b.useEffect(()=>{if(!e&&bo(new Date,M,B,P,"day")){const me=bN(new Date,M,B);u(me.getFullYear()),f(me.getMonth()),h(me.getDate())}},[]);const H=b.useCallback((me,Ae)=>t==null?void 0:t(me,Ae),[t]),I=b.useCallback((me,Ae="day")=>bo(me,M,B,P,Ae),[M,B,P]),V=b.useCallback(me=>{const Ae=new Date(c,d,p,m,x,w);H(I(Ae)?Ae:null,me)},[c,d,p,m,x,w,I,H]),z=b.useCallback(()=>{let me=c,Ae=d,Ze=p;d===0?(Ae=11,me=c-1):Ae=d-1;const et=Y9(me,Ae);Ze>et&&(Ze=et),u(me),f(Ae),h(Ze)},[c,d,p]),$=b.useCallback(()=>{let me=c,Ae=d,Ze=p;d===11?(Ae=0,me=c+1):Ae=d+1;const et=Y9(me,Ae);Ze>et&&(Ze=et),u(me),f(Ae),h(Ze)},[c,d,p]),N=b.useCallback(()=>{c>jc&&u(me=>me-1)},[c]),U=b.useCallback(()=>{c<Oc&&u(me=>me+1)},[c]),te=b.useCallback(()=>{c>jc&&u(me=>me-20)},[c]),F=b.useCallback(()=>{c<Oc&&u(me=>me+20)},[c]),re=b.useCallback(me=>{if(u(me),_(!1),n==="yyyy-MM"&&(h(1),g(0),C(0),k(0),E(!1)),n==="yyyy"){const Ae=new Date(me,0,1,0,0,0);H(I(Ae,"year")?Ae:null,!0)}T(n.includes("HH"))},[n,I,H]),le=b.useCallback(me=>{if(f(me),E(!1),_(!1),n==="yyyy-MM"){h(1),g(0),C(0),k(0);const Ae=new Date(c,me,1,0,0,0);H(I(Ae,"month")?Ae:null,!0)}T(n.includes("HH"))},[n,c,I,H]),Q=b.useCallback((me,Ae,Ze,et)=>{if(!et.includes("disabled")&&(u(Ze),f(Ae),h(me),!["HH:mm:ss","yyyy-MM-dd HH:mm:ss","yyyy-MM-dd HH:mm","HH:mm"].includes(n))){const Z=new Date(Ze,Ae,me,0,0,0);H(I(Z)?Z:null,!0)}},[n,I,H]),ee=b.useCallback(()=>{const me=new Date;if(u(me.getFullYear()),f(me.getMonth()),h(me.getDate()),g(me.getHours()),C(me.getMinutes()),k(me.getSeconds()),!["HH:mm:ss","yyyy-MM-dd HH:mm:ss","yyyy-MM-dd HH:mm","HH:mm"].includes(n)){const Ae=new Date(me.getFullYear(),me.getMonth(),me.getDate(),0,0,0);H(I(Ae)?Ae:null,!0)}},[n,I,H]),J=b.useCallback(()=>V(!0),[V]),ie=b.useCallback(me=>bo(me!=null?me:new Date,M,B,P,"day")?"":"disabled",[M,B,P]),ve=b.useCallback(me=>g(me),[]),ye=b.useCallback(me=>C(me),[]),W=b.useCallback(me=>k(me),[]),K=n.includes("yyyy"),Y=n.includes("HH"),se=n.includes("dd"),ne=n==="yyyy-MM",xe=n==="yyyy",ae=ie(),Ie=b.useCallback(()=>{E(!0),_(!1),T(!1)},[]),Fe=b.useCallback(()=>{_(!0),T(!1)},[]),Le=se?"min-h-[270px]":ne?"min-h-[180px]":"min-h-[270px]";return a.jsxs("div",{className:j("relative inline-block text-sm text-[#333] bg-white rounded-[4px] leading-none border-none",n,s),children:[a.jsxs("div",{className:"flex",children:[K&&a.jsxs("div",{className:j("data-range",Le),style:{minWidth:xe?220:270},children:[!xe&&a.jsxs("div",{className:"relative",children:[a.jsxs("table",{cellSpacing:0,cellPadding:0,className:"dt p-[3px] rounded-[4px]",style:{width:ne?"100%":270},children:[ne&&!v&&a.jsxs(a.Fragment,{children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("td",{className:"text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px] btn prevy hover:text-[#0265ff] grid place-content-center",colSpan:1,onClick:N,children:a.jsx(Ls,{size:14,className:"inline"})}),a.jsx("td",{className:"text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px] year title font-bold",colSpan:1,children:a.jsx("span",{className:"title-year hover:text-[#0265ff] cursor-pointer",onClick:Fe,children:c})}),a.jsx("td",{className:"text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px] btn nexty hover:text-[#0265ff] grid place-content-center",colSpan:1,onClick:U,children:a.jsx(As,{size:14,className:"inline"})})]})}),a.jsx("tbody",{children:[0,1,2].map(me=>a.jsx("tr",{children:[0,1,2].map(Ae=>{const Ze=me*3+Ae,et=I(new Date(c,Ze,1),"month"),Z=d===Ze,X=!et;return a.jsx("td",{className:j("text-center p-0.5 min-w-[36px] h-[36px] cursor-pointer align-middle rounded-[4px] month hover:bg-[rgba(2,101,255,0.08)]",Z&&"font-bold p-[1px] text-white border border-[#0265ff] bg-[#0265ff] hover:border-[#0265ff] hover:bg-[#0265ff]",X&&'text-[#999] relative pointer-events-none before:absolute before:left-0 before:right-0 before:top-[14px] before:h-[28px] before:bg-[#f3f3f3] before:opacity-60 before:content-[""]'),onClick:()=>{X||le(Ze)},children:Ic[Ze]},Ze)})},me))})]}),se&&a.jsx(CN,{year:c,month:d,day:p,format:n,minDate:M,maxDate:B,week:P,onYearReduce:N,onYearAdd:U,onMonthReduce:z,onMonthAdd:$,onMonthMenu:Ie,onYearMenu:Fe,onChangeDay:Q})]}),se&&!ne&&y&&!v&&a.jsx("div",{className:"absolute inset-0 z-[1]",children:a.jsx(yN,{year:c,month:d,showYear:v,position:"absolute",minDate:M,maxDate:B,week:P,onYearReduce:N,onYearAdd:U,onYearMenu:Fe,onMountOk:le})}),!xe&&v&&a.jsx("div",{className:j(ne?"relative":"absolute inset-0 z-[1]"),children:a.jsx(J9,{year:c,position:ne?"relative":"absolute",showYearLabel:ne,minDate:M,maxDate:B,week:P,onYearFReduce:te,onYearFAdd:F,onSelectYear:re})})]}),xe&&a.jsx(J9,{year:c,position:"relative",showYearLabel:!0,minDate:M,maxDate:B,week:P,onYearFReduce:te,onYearFAdd:F,onSelectYear:re})]}),L&&Y&&a.jsx(EN,{hours:m,minutes:x,seconds:w,year:c,month:d,day:p,format:n,minDate:M,maxDate:B,startTime:A,endTime:O,onHoursChange:ve,onMinutesChange:ye,onSecondsChange:W})]}),a.jsx(SN,{hasTime:Y,hasDay:se,todayCls:ae,onToday:ee,onOk:J})]})}function wr({value:e,onChange:t,format:n="yyyy-MM-dd",minDate:r,maxDate:o,week:i,placeholder:s,disabled:l,className:c}){const[u,d]=b.useState(!1),f=b.useCallback((x,C)=>{t==null||t(x),C&&d(!1)},[t]),p=e?e1(e,n):"",h=s!=null?s:_N(n),{portalContainer:m,setTriggerRef:g}=Gn("data-bs-date-input-portal");return a.jsxs(ht,{open:u,onOpenChange:d,children:[a.jsx(mt,{asChild:!0,disabled:l,children:a.jsxs("div",{className:j("flex items-center h-[34px] rounded-[4px] bg-white border border-[#e0e0e0] pl-[2px] pr-[10px] py-[2px] cursor-pointer","hover:border-[#0265FF]",u&&"border-[#0265FF]",l&&"opacity-50 cursor-not-allowed",c),ref:g,children:[a.jsx("div",{className:"flex-1 flex items-center justify-center h-[30px] px-[10px] py-[7px] rounded-[4px] min-w-0",children:a.jsx("span",{className:j("flex-1 text-[14px] leading-[normal] truncate",e?"text-[#030303]":"text-[#999999]"),children:p||h})}),a.jsx(Q1,{className:"shrink-0 size-[16px] text-[#999999]"})]})}),a.jsx(ut,{className:"w-auto p-0",align:"start",portalContainer:m,children:a.jsx(e7,{value:e,onChange:f,format:n,minDate:r,maxDate:o,week:i})})]})}function _N(e){switch(e){case"yyyy-MM-dd":return"请选择日期";case"yyyy-MM-dd HH:mm:ss":return"请选择日期时间";case"yyyy-MM-dd HH:mm":return"请选择日期时间";case"HH:mm:ss":return"请选择时间";case"HH:mm":return"请选择时间";case"yyyy-MM":return"请选择月份";case"yyyy":return"请选择年份";default:return"请选择日期"}}const NN=({expanded:e})=>a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:j("shrink-0",oe),style:{transform:e?"rotate(0deg)":"rotate(-90deg)"},children:a.jsx("path",{d:"M5 7L8 10L11 7",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),MN=({open:e})=>a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:j("shrink-0",oe),style:{transform:e?"rotate(180deg)":"rotate(0deg)"},children:a.jsx("path",{d:"M4 6L8 10L12 6",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),Co={},LN=["text","textarea","password","radio","radiogroup","combo","combocheck","checkboxgroup","address","location","separator","user","usergroup","dept","deptgroup","sn","formula","flowState","flowstate","subform","unknown"],AN=["number"],TN=["datetime"],FN=["upload","image","linkdata","linkquery","dataload","signature"];for(const e of LN)Co[e]={label:"文本",bgColor:"#F0F6FF",textColor:"#0265FF"};for(const e of AN)Co[e]={label:"数字",bgColor:"#FDF4D9",textColor:"#F4B700"};for(const e of TN)Co[e]={label:"日期",bgColor:"#EEDEFE",textColor:"#8E24F9"};for(const e of FN)Co[e]={label:"附件",bgColor:"#DDF6DD",textColor:"#1EC31E"};Co.button={label:"按钮",bgColor:"#DDF6DD",textColor:"#1EC31E"};function jN({style:e}){return a.jsx("span",{className:"text-[12px] rounded-[100px] h-[20px] px-[6px] flex items-center justify-center shrink-0 leading-[normal]",style:{backgroundColor:e.bgColor,color:e.textColor},children:e.label})}const ON=["dataload","linkquery","linkdata","separator","subform"];function Dc(e,t){var n;return((n=e.widget)==null?void 0:n.widgetName)||String(t)}function IN(e,t,n){var r;return((r=t.widget)==null?void 0:r.widgetName)||`${e}-${n}`}function DN(e,t){var o,i,s,l,c,u;const n=t.toLowerCase().trim(),r=[];for(let d=0;d<e.length;d++){const f=e[d];if(ON.includes((o=f.widget)==null?void 0:o.type))continue;const p=f.label,h=(i=f.widget)==null?void 0:i.widgetName,m=(s=f.widget)==null?void 0:s.items,g=m==null?void 0:m.filter(E=>"widget"in E),x=g&&g.length>0,C=h||Dc(f,d),w=[];if(x)for(let E=0;E<g.length;E++){const v=g[E],_=((l=v.widget)==null?void 0:l.widgetName)||`${C}-item-${E}`,L=`${h}.${_}`;w.push({key:L,label:v.label||`选项 ${E+1}`,field:f,fieldType:(c=v.widget)==null?void 0:c.type,depth:1,children:[],isExpandable:!1,widgetName:L})}const k=!n||p.toLowerCase().includes(n),y=w.some(E=>{var v;return(v=E==null?void 0:E.label)==null?void 0:v.toLowerCase().includes(n)});(k||y)&&r.push({key:C,label:p,field:f,fieldType:(u=f.widget)==null?void 0:u.type,depth:0,children:w,isExpandable:x,widgetName:h})}return r}const n1=({fields:e,selectedKey:t,onSelect:n,searchPlaceholder:r="搜索",showTypeBadge:o=!1,width:i,className:s})=>{const[l,c]=b.useState(""),[u,d]=b.useState(()=>{var x,C;const g=new Set;for(let w=0;w<e.length;w++)(C=(x=e[w].widget)==null?void 0:x.items)!=null&&C.length&&g.add(Dc(e[w],w));return g}),f=b.useMemo(()=>DN(e,l),[e,l]),p=b.useCallback(g=>{d(x=>{const C=new Set(x);return C.has(g)?C.delete(g):C.add(g),C})},[]),h=b.useCallback(g=>{g.isExpandable||g.field&&n(g.field,g.key)},[n]),m=b.useCallback(g=>{const x=u.has(g.key),C=t!=null&&g.key===t,w=g.depth*22+10,k=g.fieldType&&o?Co[g.fieldType]:void 0,y=()=>{g.isExpandable?p(g.key):h(g)},E=v=>{v.stopPropagation(),p(g.key)};return a.jsxs("div",{children:[a.jsxs("button",{type:"button",onClick:y,className:j("flex items-center justify-between w-full h-[34px] rounded-[4px] text-left","pr-[10px]",oe,C?"bg-[#F0F6FF] text-[#0265FF]":"text-[#030303] hover:bg-[#EFF0F6]"),style:{paddingLeft:`${w}px`,paddingTop:7,paddingBottom:7},children:[a.jsxs("div",{className:"flex items-center gap-[8px] min-w-0 flex-1",children:[g.isExpandable?a.jsx("span",{onClick:E,className:"flex items-center cursor-pointer",children:a.jsx(NN,{expanded:x})}):g.depth>0?a.jsx("span",{className:"w-[16px] h-[16px] shrink-0"}):null,a.jsx("span",{className:"text-[14px] truncate leading-[normal]",children:g.label})]}),k&&a.jsx(jN,{style:k})]}),g.isExpandable&&x&&a.jsx("div",{children:g.children.map(v=>m(v))})]},g.key)},[u,t,o,h,p]);return a.jsxs("div",{className:j("bg-white drop-shadow-[0px_0px_8px_rgba(0,0,0,0.1)] rounded-[4px] p-[4px]","flex flex-col gap-[4px]",s),style:i?{width:i}:void 0,children:[a.jsxs("div",{className:"flex items-center gap-[6px] border border-[#E0E0E0] rounded-[4px] h-[34px] px-[10px] py-[7px] shrink-0",children:[a.jsx(gn,{}),a.jsx("input",{type:"text",value:l,onChange:g=>c(g.target.value),placeholder:r,className:"flex-1 outline-none text-[14px] placeholder:text-[#999999] bg-transparent min-w-0 text-[#030303]"})]}),a.jsx("div",{className:"max-h-[400px] overflow-y-auto flex flex-col",children:f.length>0?f.map(g=>m(g)):a.jsx("div",{className:"flex items-center justify-center h-[60px] text-[12px] text-[#999999]",children:l.trim()?"未找到相关字段":"暂无字段"})})]})};function RN(e){var n,r,o;const t=new Map;for(let i=0;i<e.length;i++){const s=e[i],l=Dc(s,i);t.set(l,s.label);const c=(n=s.widget)==null?void 0:n.items;if(c)for(let u=0;u<c.length;u++){const d=c[u];if("widget"in d){const f=`${(r=s.widget)==null?void 0:r.widgetName}.${(o=d.widget)==null?void 0:o.widgetName}`;t.set(f,d.label||`选项 ${u+1}`)}else{const f=IN(l,d,u);t.set(f,d.text||`选项 ${u+1}`)}}}return t}function PN(e,t){var n;return t&&(n=RN(e).get(t))!=null?n:null}const Rc=({fields:e,value:t,defaultValue:n,onChange:r,placeholder:o="请选择字段",searchPlaceholder:i="输入字段名称来搜索",disabled:s=!1,showTypeBadge:l=!0,className:c})=>{const[u,d]=b.useState(!1),[f,p]=b.useState(n),[h,m]=b.useState(null),[g,x]=b.useState(0),C=b.useRef(null),w=t!==void 0?t:f,k=b.useMemo(()=>PN(e,w),[e,w]),y=b.useCallback((_,L)=>{t===void 0&&p(L),r==null||r(_,L),d(!1)},[t,r]),E=b.useCallback(_=>{s||(d(_),_&&C.current&&x(C.current.offsetWidth))},[s]),v=b.useCallback(_=>{if(C.current=_,_&&x(_.offsetWidth),!_){m(null);return}const L=_.getRootNode();if(L instanceof ShadowRoot){const T=L.querySelector("[data-bs-field-select-portal]");if(T){m(T);return}const M=document.createElement("div");M.setAttribute("data-bs-field-select-portal","true"),L.appendChild(M),m(M)}else m(null)},[]);return a.jsx("div",{className:j("relative",c),children:a.jsxs(ht,{open:u,onOpenChange:E,children:[a.jsx(mt,{asChild:!0,children:a.jsxs("button",{ref:v,type:"button",disabled:s,className:j("flex items-center justify-between w-full h-[34px]","bg-white border rounded-[4px]","px-[10px] py-[7px]","text-left cursor-pointer","hover:border-[#0265FF]",s&&"opacity-50 cursor-not-allowed hover:border-[#E0E0E0]",u?"border-[#0265FF]":"border-[#E0E0E0]",oe),children:[a.jsx("span",{className:j("text-[14px] leading-[normal] truncate",k?"text-[#030303]":"text-[#999999]"),children:k!=null?k:o}),a.jsx(MN,{open:u})]})}),a.jsx(ut,{align:"start",sideOffset:4,portalContainer:h,className:"!border-0 !p-0",style:{minWidth:g||void 0},children:a.jsx(n1,{fields:e,selectedKey:w,onSelect:y,searchPlaceholder:i,showTypeBadge:l})})]})})},t7=[{value:"before",label:"之前"},{value:"after",label:"之后"},{value:"day",label:"当天"},{value:"time",label:"当时"}];function HN(e){return e==="date"?t7.filter(t=>t.value!=="time"):t7.filter(t=>t.value!=="day")}const BN=({value:e,onChange:t,dateFieldType:n,placeholder:r="请选择偏移类型",disabled:o=!1,className:i})=>{const s=HN(n);return a.jsxs(er,{value:e,onValueChange:l=>t==null?void 0:t(l),disabled:o,children:[a.jsx(Fn,{className:i,children:a.jsx(tr,{placeholder:r})}),a.jsx(jn,{children:s.map(l=>a.jsx(On,{value:l.value,children:l.label},l.value))})]})},zN=[{value:"minute",label:"分钟"},{value:"hour",label:"小时"},{value:"day",label:"天"}],VN=({value:e,onChange:t,placeholder:n="请选择偏移单位",disabled:r=!1,className:o})=>a.jsxs(er,{value:e,onValueChange:i=>t==null?void 0:t(i),disabled:r,children:[a.jsx(Fn,{className:o,children:a.jsx(tr,{placeholder:n})}),a.jsx(jn,{children:zN.map(i=>a.jsx(On,{value:i.value,children:i.label},i.value))})]}),yr=1440,n7=j("h-[34px] px-[10px] py-[7px] rounded-[4px] bg-white border border-[#e0e0e0]","text-[14px] text-[#030303] placeholder:text-[#999999]","focus:outline-none focus:border-[#0265FF]","disabled:bg-[#EFF0F6] disabled:cursor-not-allowed","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none");function UN(e){return e==="date"?{dateFieldType:"date",offsetType:"day",offsetValue:0,offsetUnit:"minute"}:{dateFieldType:"datetime",offsetType:"time",offsetValue:0,offsetUnit:"minute"}}function r7(e,t){return t==="date"&&e==="time"?"day":t==="datetime"&&e==="day"?"time":e}function ZN(e){const t=Math.max(0,Math.floor(e))%yr,n=new Date(2024,0,1);return n.setHours(Math.floor(t/60),t%60,0,0),n}function WN(e){return e.getHours()*60+e.getMinutes()}function o7({value:e,onChange:t,dateFieldType:n,disabled:r=!1,className:o}){const i=e!==void 0,[s,l]=b.useState(()=>e!=null?e:UN(n)),c=b.useRef(e);b.useEffect(()=>{e!==void 0&&l(e),c.current=e},[e]);const u=e!=null?e:s,d=b.useCallback(T=>{i||l(T),t==null||t(T)},[i,t]),f=r7(u.offsetType,n),p=n==="date"&&(f==="before"||f==="after"),h=n==="datetime"&&(f==="before"||f==="after"),m=n==="date",g=n==="datetime"&&(f==="before"||f==="after"),x=n==="date"?p?u.offsetValue%yr:u.offsetValue:0,C=ZN(x),w=p?Math.max(0,Math.floor(u.offsetValue/yr)):1,k=h?u.offsetValue:0,y=b.useCallback(T=>{const M=r7(T,n),B=u.offsetValue%yr;d(n==="date"?M==="day"?{dateFieldType:"date",offsetType:"day",offsetValue:B,offsetUnit:"minute"}:{dateFieldType:"date",offsetType:M,offsetValue:B,offsetUnit:"minute"}:M==="time"?{dateFieldType:"datetime",offsetType:"time",offsetValue:0,offsetUnit:"minute"}:{dateFieldType:"datetime",offsetType:M,offsetValue:u.offsetValue,offsetUnit:u.offsetUnit})},[n,u.offsetValue,u.offsetUnit,d]),E=b.useCallback(T=>{if(!T)return;const M=WN(T);if(n==="date")if(f==="day")d({dateFieldType:"date",offsetType:"day",offsetValue:M,offsetUnit:"minute"});else{const B=Math.max(0,Math.floor(u.offsetValue/yr));d({dateFieldType:"date",offsetType:f,offsetValue:B*yr+M,offsetUnit:"minute"})}},[n,f,u.offsetValue,d]),v=b.useCallback(T=>{const M=parseInt(T.target.value,10),B=isNaN(M)?0:Math.max(0,M),P=u.offsetValue%yr;d({dateFieldType:"date",offsetType:f,offsetValue:B*yr+P,offsetUnit:"minute"})},[f,u.offsetValue,d]),_=b.useCallback(T=>{const M=parseInt(T.target.value,10),B=isNaN(M)?0:Math.max(0,M);d({dateFieldType:"datetime",offsetType:f,offsetValue:B,offsetUnit:u.offsetUnit})},[f,u.offsetUnit,d]),L=b.useCallback(T=>{d({dateFieldType:"datetime",offsetType:f,offsetValue:u.offsetValue,offsetUnit:T})},[f,u.offsetValue,d]);return a.jsxs("div",{className:j("flex items-center gap-[10px]",o),children:[a.jsx(BN,{value:f,onChange:y,dateFieldType:n,disabled:r}),p&&a.jsx("input",{type:"number",value:w,onChange:v,disabled:r,min:0,step:1,className:j(n7,"w-[60px]")}),p&&a.jsx("span",{className:"text-[14px] text-[#030303] shrink-0",children:"天"}),h&&a.jsx("input",{type:"number",value:k,onChange:_,disabled:r,min:0,step:1,className:j(n7,"w-[80px]")}),g&&a.jsx(VN,{value:u.offsetUnit,onChange:L,disabled:r}),m&&a.jsx(wr,{value:C,onChange:E,format:"HH:mm",disabled:r})]})}function GN(e){return typeof e=="object"&&e!==null&&"formId"in e}function Pc(e,t){var n,r,o,i;return{dateFieldType:"datetime",offsetType:"time",offsetValue:0,offsetUnit:"minute",...t,...e,formId:(r=(n=e.formId)!=null?n:t==null?void 0:t.formId)!=null?r:"",fieldId:(i=(o=e.fieldId)!=null?o:t==null?void 0:t.fieldId)!=null?i:""}}function $N(e){if(typeof e=="string"||typeof e=="number"){const t=new Date(e);return isNaN(t.getTime())?void 0:t}}function qN({value:e,onChange:t,forms:n=[],fields:r=[],dateFormat:o="yyyy-MM-dd",disabled:i=!1,className:s}){const l=e==null?void 0:e.type,c=GN(e==null?void 0:e.customTriggerTimePayload)?e.customTriggerTimePayload:void 0,u=b.useCallback(m=>{t==null||t({type:m})},[t]),d=b.useCallback(m=>{t==null||t({type:"custom",customTriggerTimePayload:m?m.toISOString():void 0})},[t]),f=b.useCallback(m=>{var x;const g=Pc({formId:((x=m.form)==null?void 0:x.id)||""},c);t==null||t({type:"date_field",customTriggerTimePayload:g})},[t,c]),p=b.useCallback((m,g)=>{const x=Pc({fieldId:g},c);t==null||t({type:"date_field",customTriggerTimePayload:x})},[t,c]),h=b.useCallback(m=>{const g=Pc({dateFieldType:m.dateFieldType,offsetType:m.offsetType,offsetValue:m.offsetValue,offsetUnit:m.offsetUnit},c);t==null||t({type:"date_field",customTriggerTimePayload:g})},[t,c]);return a.jsxs("div",{className:j("flex flex-col gap-[10px]",s),children:[a.jsxs("div",{className:"flex gap-[22px] items-start w-full",children:[a.jsx(q9,{className:"flex-1 min-w-0",value:l,onChange:u,disabled:i}),l==="custom"&&a.jsx(wr,{className:"flex-1 min-w-0",value:$N(e==null?void 0:e.customTriggerTimePayload),onChange:d,format:o,disabled:i}),l==="date_field"&&a.jsx(Ac,{className:"flex-1 min-w-0",items:n,value:c==null?void 0:c.formId,onChange:f,disabled:i})]}),l==="date_field"&&a.jsxs("div",{className:"flex items-start gap-[10px] w-full",children:[a.jsx(Rc,{className:"w-[300px]",fields:r,value:c==null?void 0:c.fieldId,onChange:p,disabled:i}),c&&a.jsx(o7,{value:{dateFieldType:c.dateFieldType,offsetType:c.offsetType,offsetValue:c.offsetValue,offsetUnit:c.offsetUnit},onChange:h,dateFieldType:c.dateFieldType,disabled:i})]})]})}const i7=[{value:"none",label:"不重复触发"},{value:"daily",label:"每天触发一次"},{value:"weekly",label:"每周触发一次"},{value:"everyTwoWeeks",label:"每两周触发一次"},{value:"monthly",label:"每月触发一次"},{value:"yearly",label:"每年触发一次"},{value:"custom",label:"自定义重复"}],s7=({value:e,onChange:t,placeholder:n="请选择重复类型",disabled:r=!1,className:o})=>a.jsxs(er,{value:e,onValueChange:i=>t==null?void 0:t(i),disabled:r,children:[a.jsx(Fn,{className:o,children:a.jsx(tr,{placeholder:n})}),a.jsx(jn,{children:i7.map(i=>a.jsx(On,{value:i.value,children:i.label},i.value))})]}),wo=({className:e})=>a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",className:e,children:a.jsx("path",{d:"M7 0C7.91925 -1.93718e-08 8.8295 0.18106 9.67878 0.532843C10.5281 0.884626 11.2997 1.40024 11.9497 2.05025C12.5998 2.70026 13.1154 3.47194 13.4672 4.32122C13.8189 5.17049 14 6.08075 14 7C14 7.91925 13.8189 8.8295 13.4672 9.67878C13.1154 10.5281 12.5998 11.2997 11.9497 11.9497C11.2997 12.5998 10.5281 13.1154 9.67878 13.4672C8.8295 13.8189 7.91925 14 7 14C3.13372 14 1.39103e-08 10.8658 0 7C0 3.13372 3.13372 1.39103e-08 7 0ZM10.1495 3.85C10.0301 3.7308 9.86825 3.66386 9.69953 3.66386C9.53081 3.66386 9.36898 3.7308 9.24956 3.85L7 6.10058L4.74993 3.85C4.6295 3.73566 4.46918 3.67288 4.30313 3.67503C4.13708 3.67718 3.97844 3.7441 3.86102 3.86153C3.7436 3.97895 3.67668 4.13759 3.67452 4.30364C3.67237 4.46968 3.73515 4.63001 3.84949 4.75044L6.10109 7L3.85 9.24956C3.73566 9.36999 3.67288 9.53031 3.67503 9.69636C3.67718 9.86241 3.7441 10.021 3.86153 10.1385C3.97895 10.2559 4.13759 10.3228 4.30364 10.325C4.46969 10.3271 4.63001 10.2643 4.75044 10.15L7 7.8984L9.24956 10.1495C9.37027 10.2621 9.52995 10.3234 9.69497 10.3205C9.85999 10.3177 10.0175 10.2509 10.1342 10.1342C10.2509 10.0175 10.3178 9.86008 10.3208 9.69507C10.3237 9.53005 10.2625 9.37033 10.15 9.24956L7.8984 7L10.1495 4.74993C10.2688 4.63049 10.3359 4.46856 10.3359 4.29971C10.3359 4.13086 10.2688 3.96892 10.1495 3.84949V3.85Z",fill:"#666666"})}),yo=[{value:"mon",label:"星期一"},{value:"tue",label:"星期二"},{value:"wed",label:"星期三"},{value:"thu",label:"星期四"},{value:"fri",label:"星期五"},{value:"sat",label:"星期六"},{value:"sun",label:"星期日"}],YN=()=>a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:a.jsx("path",{d:"M3 3L9 9M9 3L3 9",stroke:"#999999",strokeWidth:"1.2",strokeLinecap:"round"})}),a7=({open:e})=>a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:j("shrink-0",oe),style:{transform:e?"rotate(180deg)":"rotate(0deg)"},children:a.jsx("path",{d:"M4 6L8 10L12 6",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),l7=({value:e=[],onChange:t,placeholder:n="请选择工作日",disabled:r=!1,className:o})=>{const[i,s]=b.useState(!1),[l,c]=b.useState(!1),u=e.length===yo.length,d=e.length>0&&e.length<yo.length,{portalContainer:f,setTriggerRef:p}=Gn("data-bs-weekdays-select-portal"),h=b.useCallback(y=>{const E=e.includes(y)?e.filter(v=>v!==y):[...e,y];t==null||t(E)},[e,t]),m=b.useCallback(()=>{u?t==null||t([]):t==null||t(yo.map(y=>y.value))},[u,t]),g=b.useCallback(y=>{y.stopPropagation(),t==null||t([])},[t]),x=b.useCallback((y,E)=>{E.stopPropagation(),t==null||t(e.filter(v=>v!==y))},[e,t]),C=b.useCallback(y=>{r||s(y)},[r]),w=e.length>0,k=w&&l;return a.jsx("div",{className:j("relative",o),children:a.jsxs(ht,{open:i,onOpenChange:C,children:[a.jsx(mt,{asChild:!0,children:a.jsx("button",{type:"button",disabled:r,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),ref:p,className:j("flex items-center justify-between w-full h-[34px] gap-2.5","bg-white border border-[#E0E0E0] rounded-[4px]","py-[7px]",w?"pl-[4px] pr-[10px]":"px-[10px]","text-left cursor-pointer","hover:border-[#0265FF]",r&&"opacity-50 cursor-not-allowed hover:border-[#E0E0E0]",i&&"border-[#0265FF]",oe),children:w?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex items-center gap-[4px] min-w-0 flex-1 overflow-x-auto scrollbar-hide",children:e.map(y=>{const E=yo.find(v=>v.value===y);return a.jsxs("span",{className:"flex items-center gap-[4px] bg-[#EEEEEE] rounded-[2px] h-[26px] px-[6px] shrink-0",children:[a.jsx("span",{className:"text-[14px] text-[#030303] leading-[normal]",children:E==null?void 0:E.label}),a.jsx("span",{className:"cursor-pointer flex items-center shrink-0",onClick:v=>x(y,v),children:a.jsx(YN,{})})]},y)})}),k?a.jsx("span",{className:"cursor-pointer flex items-center shrink-0",onClick:g,children:a.jsx(wo,{})}):a.jsx(a7,{open:i})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-[14px] text-[#999999] leading-[normal] truncate",children:n}),a.jsx(a7,{open:i})]})})}),a.jsx(ut,{align:"start",sideOffset:4,className:"!border-0 rounded-[8px] shadow-[0px_6px_16px_rgba(0,0,0,0.06)] p-[4px]",portalContainer:f,children:a.jsxs("div",{className:"flex flex-col",children:[a.jsxs("button",{type:"button",onClick:m,className:j("flex items-center gap-[6px] h-[34px] px-[10px] py-[7px] rounded-[4px] text-left","hover:bg-[#EFF0F6]",oe),children:[a.jsx(Pn,{checked:u,intermediate:d,onCheckedChange:m,className:"shrink-0"}),a.jsx("span",{className:"text-[14px] font-bold text-[#0265FF] leading-[normal]",children:"全选"})]}),yo.map(y=>{const E=e.includes(y.value);return a.jsxs("button",{type:"button",onClick:()=>h(y.value),className:j("flex items-center gap-[6px] h-[34px] px-[10px] py-[7px] rounded-[4px] text-left","hover:bg-[#EFF0F6]",oe),children:[a.jsx(Pn,{checked:E,onCheckedChange:()=>h(y.value),className:"shrink-0"}),a.jsx("span",{className:"text-[14px] text-[#030303] leading-[normal]",children:y.label})]},y.value)})]})})]})})},KN=F_,c7=S.forwardRef(({className:e,...t},n)=>a.jsx(A9,{ref:n,className:j("inline-flex items-center w-full gap-[2px] p-[2px] bg-[#EFF0F6] rounded-[4px]",e),...t}));c7.displayName=A9.displayName;const Hc=S.forwardRef(({className:e,...t},n)=>a.jsx(T9,{ref:n,className:j("inline-flex items-center justify-center w-full h-[30px]","px-[10px] py-[7px] rounded-[4px]","text-[14px] text-[#121111] leading-normal","bg-transparent border border-solid border-[#EFF0F6]","transition-all duration-200 ease-out","outline-none cursor-pointer","hover:text-[#121111] hover:border-[#E0E0E0] hover:bg-white","data-[state=active]:text-[#0265FF] data-[state=active]:border-[#E0E0E0] data-[state=active]:bg-white","focus-visible:ring-2 focus-visible:ring-[#0265FF] focus-visible:ring-offset-1",e),...t}));Hc.displayName=T9.displayName;const Bc=S.forwardRef(({className:e,...t},n)=>a.jsx(F9,{ref:n,className:j("mt-2 outline-none","data-[state=inactive]:hidden",e),...t}));Bc.displayName=F9.displayName;const r1=[{value:1,label:"1"},{value:2,label:"2"},{value:3,label:"3"},{value:4,label:"4"},{value:5,label:"5"},{value:6,label:"6"},{value:7,label:"7"},{value:8,label:"8"},{value:9,label:"9"},{value:10,label:"10"},{value:11,label:"11"},{value:12,label:"12"},{value:13,label:"13"},{value:14,label:"14"},{value:15,label:"15"},{value:16,label:"16"},{value:17,label:"17"},{value:18,label:"18"},{value:19,label:"19"},{value:20,label:"20"},{value:21,label:"21"},{value:22,label:"22"},{value:23,label:"23"},{value:24,label:"24"},{value:25,label:"25"},{value:26,label:"26"},{value:27,label:"27"},{value:28,label:"28"},{value:29,label:"29"},{value:30,label:"30"},{value:31,label:"31"}],XN={label:"最后一个自然日"},u7=7,QN=()=>a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:a.jsx("path",{d:"M3 3L9 9M9 3L3 9",stroke:"#999999",strokeWidth:"1.2",strokeLinecap:"round"})}),d7=({open:e})=>a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:j("shrink-0",oe),style:{transform:e?"rotate(180deg)":"rotate(0deg)"},children:a.jsx("path",{d:"M4 6L8 10L12 6",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),f7=({value:e=[],onChange:t,placeholder:n="请选择日期",disabled:r=!1,className:o})=>{const[i,s]=b.useState(!1),[l,c]=b.useState(!1),[u,d]=b.useState(e),{portalContainer:f,setTriggerRef:p}=Gn("data-bs-weekdays-select-portal"),h=i?u:e,m=b.useMemo(()=>h.filter(A=>A!=="last"),[h]),g=b.useMemo(()=>h.includes("last"),[h]),x=m.length===31,C=b.useCallback(A=>{d(O=>O.includes(A)?O.filter(H=>H!==A):[...O,A])},[]),w=b.useCallback(()=>{d(A=>{if(A.filter(V=>V!=="last").length===31)return A.filter(V=>V==="last");const H=r1.map(V=>V.value),I=A.includes("last")?["last"]:[];return[...H,...I]})},[]),k=b.useCallback(()=>{const A=new Date().getDate();d(O=>O.includes(A)?O:[...O,A])},[]),y=b.useCallback(()=>{d(A=>A.includes("last")?A.filter(O=>O!=="last"):[...A,"last"])},[]),E=b.useCallback(()=>{t==null||t(u),s(!1)},[u,t]),v=b.useCallback(A=>{r||(A&&d([...e]),s(A))},[r,e]),_=b.useCallback(A=>{A.stopPropagation(),t==null||t([])},[t]),L=b.useCallback((A,O)=>{O.stopPropagation(),t==null||t(e.filter(H=>H!==A))},[e,t]),T=e.length>0,M=T&&l,B=b.useCallback(A=>A==="last"?"最后一天":`${A}日`,[]),P=b.useMemo(()=>{const A=[];for(let O=0;O<r1.length;O+=u7)A.push(r1.slice(O,O+u7));return A},[]);return a.jsx("div",{className:j("relative",o),children:a.jsxs(ht,{open:i,onOpenChange:v,children:[a.jsx(mt,{asChild:!0,children:a.jsx("button",{type:"button",ref:p,disabled:r,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),className:j("flex items-center justify-between w-full h-[34px] gap-2.5","bg-white border border-[#E0E0E0] rounded-[4px]","py-[7px]",T?"pl-[4px] pr-[10px]":"px-[10px]","text-left cursor-pointer","hover:border-[#0265FF]",r&&"opacity-50 cursor-not-allowed hover:border-[#E0E0E0]",i&&"border-[#0265FF]",oe),children:T?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex items-center gap-[4px] min-w-0 flex-1 overflow-x-auto scrollbar-hide",children:e.map(A=>a.jsxs("span",{className:"flex items-center gap-[4px] bg-[#EEEEEE] rounded-[2px] h-[26px] px-[6px] shrink-0",children:[a.jsx("span",{className:"text-[14px] text-[#030303] leading-[normal]",children:B(A)}),a.jsx("span",{className:"cursor-pointer flex items-center shrink-0",onClick:O=>L(A,O),children:a.jsx(QN,{})})]},A))}),M?a.jsx("span",{className:"cursor-pointer flex items-center shrink-0",onClick:_,children:a.jsx(wo,{})}):a.jsx(d7,{open:i})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-[14px] text-[#999999] leading-[normal] truncate",children:n}),a.jsx(d7,{open:i})]})})}),a.jsx(ut,{align:"start",sideOffset:4,portalContainer:f,className:"!border-0 rounded-[8px] shadow-[0px_6px_16px_rgba(0,0,0,0.06)] p-0",style:{width:"310px"},children:a.jsxs(KN,{defaultValue:"specific",children:[a.jsx("div",{className:"px-[4px] pt-[4px] flex justify-center",children:a.jsxs(c7,{children:[a.jsx(Hc,{value:"specific",children:"指定日期"}),a.jsx(Hc,{value:"relative",children:"相对日期"})]})}),a.jsxs(Bc,{value:"specific",className:"mt-0",children:[a.jsxs("div",{className:"px-[8px] pt-[8px] pb-[4px]",children:[a.jsxs("button",{type:"button",onClick:w,className:j("flex items-center gap-[6px] w-full h-[34px] px-[10px] py-[7px] rounded-[4px] text-left mb-[4px]","hover:bg-[#EFF0F6]",oe),children:[a.jsx(Pn,{checked:x,intermediate:m.length>0&&!x,onCheckedChange:w,className:"shrink-0"}),a.jsx("span",{className:"text-[14px] font-bold text-[#0265FF] leading-[normal]",children:"全选"})]}),a.jsx("div",{className:"flex flex-col gap-[2px]",children:P.map((A,O)=>a.jsx("div",{className:"flex gap-[4px]",children:A.map(H=>{const I=m.includes(H.value);return a.jsx("button",{type:"button",onClick:()=>C(H.value),className:j("flex items-center justify-center w-[36px] h-[30px] rounded-[4px]","text-[14px] leading-[normal]","transition-all duration-200 ease-out",I?"bg-[#0265FF] text-white":"text-[#030303] hover:bg-[#EFF0F6]"),children:H.label},H.value)})},O))})]}),a.jsxs("div",{className:"flex items-center justify-between px-[12px] py-[8px] border-t border-[#E0E0E0] mt-[4px]",children:[a.jsx("button",{type:"button",onClick:k,className:j("h-[28px] px-[12px] rounded-[4px] text-[14px]","text-[#0265FF] hover:bg-[#EFF0F6]",oe),children:"今天"}),a.jsx("button",{type:"button",onClick:E,className:j("h-[28px] px-[16px] rounded-[4px] text-[14px]","bg-[#0265FF] text-white hover:bg-[#0255DD]",oe),children:"确认"})]})]}),a.jsxs(Bc,{value:"relative",className:"mt-0",children:[a.jsx("div",{className:"px-[8px] pt-[8px] pb-[4px]",children:a.jsxs("button",{type:"button",onClick:y,className:j("flex items-center gap-[6px] w-full h-[34px] px-[10px] py-[7px] rounded-[4px] text-left","hover:bg-[#EFF0F6]",oe),children:[a.jsx(Pn,{checked:g,onCheckedChange:y,className:"shrink-0"}),a.jsx("span",{className:"text-[14px] text-[#030303] leading-[normal]",children:XN.label})]})}),a.jsx("div",{className:"flex items-center justify-center px-[12px] py-[8px] border-t border-[#E0E0E0] mt-[4px]",children:a.jsx("button",{type:"button",onClick:E,className:j("h-[28px] px-[16px] rounded-[4px] text-[14px]","bg-[#0265FF] text-white hover:bg-[#0255DD]",oe),children:"确认"})})]})]})})]})})},p7=[{value:"week",label:"按周重复"},{value:"month",label:"按月重复"}],h7=({value:e,onChange:t,placeholder:n="请选择重复方式",disabled:r=!1,className:o})=>a.jsxs(er,{value:e,onValueChange:i=>t==null?void 0:t(i),disabled:r,children:[a.jsx(Fn,{className:o,children:a.jsx(tr,{placeholder:n})}),a.jsx(jn,{children:p7.map(i=>a.jsx(On,{value:i.value,children:i.label},i.value))})]}),JN=j("h-[34px] px-[10px] py-[7px] rounded-[4px] bg-white border border-[#e0e0e0]","text-[14px] text-[#030303] placeholder:text-[#999999]","focus:outline-none focus:border-[#0265FF]","disabled:bg-[#EFF0F6] disabled:cursor-not-allowed","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none","w-[60px]");function eM(){return{repeatBy:"week",interval:1,repeatDetailDates:[]}}function tM({value:e,onChange:t,disabled:n=!1,className:r}){var m,g,x;const o=e==null?void 0:e.type,i=e==null?void 0:e.customRepeatPreference,s=i==null?void 0:i.repeatBy,l=b.useCallback(C=>{C==="custom"?t==null||t({type:"custom",customRepeatPreference:i!=null?i:eM()}):t==null||t({type:C})},[t,i]),c=b.useCallback(C=>{i&&(t==null||t({type:"custom",customRepeatPreference:{...i,repeatBy:C,repeatDetailDates:[]}}))},[t,i]),u=b.useCallback(C=>{if(!i)return;const w=parseInt(C.target.value,10),k=isNaN(w)?1:Math.max(1,w);t==null||t({type:"custom",customRepeatPreference:{...i,interval:k}})},[t,i]),d=b.useCallback(C=>{i&&(t==null||t({type:"custom",customRepeatPreference:{...i,repeatDetailDates:C}}))},[t,i]),f=b.useCallback(C=>{i&&(t==null||t({type:"custom",customRepeatPreference:{...i,repeatDetailDates:C}}))},[t,i]),p=(m=i==null?void 0:i.repeatDetailDates)!=null?m:[],h=(g=i==null?void 0:i.repeatDetailDates)!=null?g:[];return a.jsxs("div",{className:j("flex flex-col gap-[10px]",r),children:[a.jsx(s7,{value:o,onChange:l,disabled:n}),o==="custom"&&a.jsxs("div",{className:"flex items-start gap-[10px] w-full",children:[a.jsx(h7,{className:"w-[200px] shrink-0",value:s,onChange:c,disabled:n}),a.jsx("span",{className:"text-[14px] text-[#030303] leading-[34px] shrink-0",children:"每"}),a.jsx("input",{type:"number",value:(x=i==null?void 0:i.interval)!=null?x:1,onChange:u,disabled:n,min:1,step:1,className:JN}),a.jsx("span",{className:"text-[14px] text-[#030303] leading-[34px] shrink-0",children:s==="month"?"月":"周"}),s==="week"&&a.jsx(l7,{className:"flex-1 min-w-0",value:p,onChange:d,disabled:n}),s==="month"&&a.jsx(f7,{className:"flex-1 min-w-0",value:h,onChange:f,disabled:n})]})]})}const m7=({flipped:e})=>a.jsx("svg",{width:"40",height:"4",viewBox:"0 0 40 4",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{display:"block",flexShrink:0},children:e?a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"2",cy:"2",r:"2",fill:"#D9D9D9"}),a.jsx("path",{d:"M10 2H40",stroke:"#E0E0E0"})]}):a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M0 2H30",stroke:"#E0E0E0"}),a.jsx("circle",{cx:"38",cy:"2",r:"2",fill:"#D9D9D9"})]})}),nM=({children:e,className:t})=>a.jsxs("div",{className:j("flex items-center justify-center gap-[10px]",t),children:[a.jsx(m7,{}),e!=null&&a.jsx("span",{className:"text-[#999] text-[14px] whitespace-nowrap leading-[normal] shrink-0",children:e}),a.jsx(m7,{flipped:!0})]}),g7=["eq","neq","gt","lt","gte","lte","contains","not_contains","in","nin","all","empty","not_empty","range","like","unlike"],x7=({value:e,defaultValue:t="eq",onChange:n,operators:r,fieldType:o,operatorLabels:i,borderless:s=!1,disabled:l=!1,className:c})=>{var y,E;const[u,d]=b.useState(!1),[f,p]=b.useState(t),[h,m]=b.useState(null),g=b.useMemo(()=>(!r||r.length===0?g7:g7.filter(_=>new Set(r).has(_))).map(_=>{var L;return{value:_,label:(L=i==null?void 0:i[_])!=null?L:Bh(_,o)}}),[r,o,i]),x=(()=>{const v=e!==void 0?e:f;return g.length>0&&!g.find(_=>_.value===v)?g[0].value:v})(),C=(E=(y=g.find(v=>v.value===x))==null?void 0:y.label)!=null?E:"",w=b.useCallback(v=>{e===void 0&&p(v),n==null||n(v),d(!1)},[e,n]),k=b.useCallback(v=>{if(!v){m(null);return}const _=v.getRootNode();if(_ instanceof ShadowRoot){const L=_.querySelector("[data-bs-relational-operator-select-portal]");if(L){m(L);return}const T=document.createElement("div");T.setAttribute("data-bs-relational-operator-select-portal","true"),_.appendChild(T),m(T)}else m(null)},[]);return a.jsx("div",{className:j("relative inline-flex",c),children:a.jsxs(ht,{open:u,onOpenChange:d,children:[a.jsx(mt,{asChild:!0,children:a.jsxs("button",{ref:k,type:"button",disabled:l,className:j("flex items-center justify-between gap-[10px]","min-w-[82px] px-[10px] w-full","text-left cursor-pointer",s?"h-[34px] bg-transparent":j("h-[31px] bg-white border rounded-[4px]",u?"border-[#0265FF]":"border-[#E0E0E0] hover:border-[#0265FF]"),l&&"opacity-50 cursor-not-allowed",!l&&!s&&"hover:border-[#0265FF]",oe),children:[a.jsx("span",{className:"text-[14px] leading-[normal] text-[#030303] truncate",children:C}),a.jsx("span",{className:j("shrink-0 flex items-center justify-center w-[16px] h-[16px] text-[#666666]",oe,u&&"rotate-180"),children:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:a.jsx("path",{d:"M4 6L8 10L12 6",stroke:"#666666",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}),a.jsx(ut,{align:"start",sideOffset:4,portalContainer:h,className:"!border-0 rounded-[10px] shadow-[0px_0px_5px_rgba(0,0,0,0.04)] p-[4px] min-w-[82px]",children:a.jsx("div",{className:"flex flex-col gap-0 max-h-[320px] overflow-y-auto",children:g.map(v=>a.jsx("button",{type:"button",onClick:()=>w(v.value),className:j("h-[34px] px-[10px] rounded-[4px] text-left text-[14px] leading-[normal] whitespace-nowrap shrink-0",x===v.value?"bg-[#F0F6FF] text-[#0265FF]":"text-[#030303] hover:bg-[#EFF0F6]",oe),children:v.label},v.value))})})]})})},rM=({avatar:e,width:t,onDockClick:n,onCloseClick:r,draggable:o,isDragging:i,isDocked:s,onDragStart:l})=>a.jsxs("div",{className:j("flex items-center justify-between","px-4","h-[52px] min-w-[200px]",{"w-full":!t,[`w-[${t}px]`]:t,"cursor-grab":o&&!i,"cursor-grabbing":i}),style:{backgroundImage:Y0,backgroundSize:"cover",backgroundRepeat:"no-repeat"},onMouseDown:o?l:void 0,children:[e,a.jsxs("div",{className:"actions flex items-center gap-2.5 text-[#666]",children:[a.jsx(nn,{onMouseDown:c=>{c.stopPropagation()},tooltip:s?"悬浮":"右侧打开",icon:s?a.jsx(l3,{}):a.jsx(a3,{}),onClick:n}),a.jsx(nn,{icon:a.jsx(ol,{}),onClick:r})]})]}),b7=({defaultChecked:e=!1,checked:t,onCheckedChange:n,children:r,disabled:o=!1,isMobile:i,className:s})=>{const[l,c]=b.useState(e),u=t!==void 0,d=u?t:l,f=()=>{if(o)return;const m=!d;u||c(m),n==null||n(m)},p=qe({"w-4 h-4":!i,"w-[20px] h-[20px]":i}),h=qe({"text-[14px]":!i,"text-[16px]":i});return a.jsxs("button",{type:"button",role:"checkbox","aria-checked":d,disabled:o,onClick:f,className:j("inline-flex items-center gap-[6px] cursor-pointer select-none","text-[#121111]",h,o&&"cursor-not-allowed opacity-50",s),children:[a.jsx("span",{className:j("inline-flex items-center justify-center rounded-full transition-colors duration-200 box-border border",p,d?"bg-[#2E60FF] border-transparent":"bg-white border-[#e0e0e0]"),children:d&&a.jsx("span",{className:"text-white",children:a.jsx(al,{})})}),r&&a.jsx("span",{className:"",children:r})]})},oM=({defaultChecked:e=!1,checked:t,onCheckedChange:n,title:r,description:o,disabled:i=!1,className:s})=>{const[l,c]=b.useState(e),u=t!==void 0,d=u?t:l,f=()=>{if(i)return;const p=!d;u||c(p),n==null||n(p)};return a.jsxs("button",{type:"button",role:"checkbox","aria-checked":d,disabled:i,onClick:f,className:j("flex flex-col gap-[6px] p-[10px] rounded-[4px] cursor-pointer select-none","border border-[#e0e0e0]",i&&"cursor-not-allowed opacity-50",s),children:[a.jsxs("div",{className:"inline-flex items-center gap-[6px]",children:[a.jsx(b7,{checked:d,onCheckedChange:p=>{d||f()},disabled:i}),a.jsx("span",{className:"text-[#030303] text-[14px]",children:r})]}),a.jsx("p",{className:"text-[#666] text-[12px] pl-[22px]",children:o})]})},o1=({title:e,ghost:t,content:n,icon:r,disableExpand:o,children:i,defaultOpen:s,isMobile:l})=>{const[c,u]=b.useState(s),d=l?"text-[16px]":"text-[14px]",f="w-[16px] h-[16px]",p=qe({"bg-[#fafafa] border border-[#e0e0e0] border-solid p-2.5":!t}),m=c&&t?"":e,g=r===void 0?a.jsx(u3,{}):r;return a.jsxs("div",{className:qe("flex flex-col gap-2.5 rounded-lg w-full",p),children:[a.jsxs("div",{className:j("flex items-center justify-between w-full",{"cursor-pointer":!o}),onClick:()=>{o||u(!c)},children:[a.jsxs("div",{className:"flex gap-2.5 items-center",children:[g?a.jsx("div",{className:qe("shrink-0 flex items-center",f),children:g}):null,a.jsx("p",{className:`text-[#666] ${d} leading-normal`,children:m})]}),a.jsx("button",{onClick:()=>{o||u(!c)},className:j("flex items-center justify-center w-5 h-5 rounded-[4px] cursor-pointer hover:bg-[#EFF0F6]",oe,{"pointer-events-none opacity-0":o}),children:a.jsx(_s,{isOpen:c})})]}),c&&!o&&a.jsx("div",{className:`text-[#121111] ${d} word-wrap`,children:n||i})]})};function C7({open:e,onOpenChange:t,title:n,description:r,linkText:o="留在此页",onLinkClick:i,cancelText:s="不保存",onCancel:l,confirmText:c="保存并继续",onConfirm:u,container:d,showLink:f=!0,showCancel:p=!0}){const h={borderRadius:4,padding:"6px 20px"};return a.jsx(r5,{open:e,onOpenChange:t,children:a.jsxs(Ma,{container:d,className:j("w-[480px] max-w-[480px] p-0 gap-0 rounded-[10px] border-none","shadow-[0px_0px_10px_0px_rgba(0,0,0,0.04)]","[&>button]:hidden"),children:[a.jsxs(La,{className:"flex flex-row items-start gap-[10px] p-9 pb-0",children:[a.jsx("div",{className:"size-[30px] shrink-0 text-[#0265FF]",children:a.jsx(g3,{})}),a.jsxs("div",{className:"flex flex-col gap-2",children:[a.jsx(Ta,{className:"text-[16px] font-[700] text-[#030303] leading-normal",children:n}),r&&a.jsx(Fa,{className:"text-[14px] text-[#666] leading-normal",children:r})]})]}),a.jsxs(Aa,{className:"flex flex-row items-center !justify-between p-9 pt-6",children:[f?a.jsx("button",{type:"button",className:"text-[14px] text-[#0265ff] hover:text-[#0265ff]/80 bg-transparent border-none cursor-pointer",onClick:i||(()=>{console.log("Link clicked"),t==null||t(!1)}),children:o}):a.jsx("div",{}),a.jsxs("div",{className:"flex items-center gap-3",children:[p&&a.jsx($s,{className:"hover:text-[#121111]",onClick:l,children:s}),a.jsx("button",{type:"button",onClick:u,style:h,className:j("text-[14px] text-white bg-[#0265ff]","hover:bg-[#0265ff]/80 cursor-pointer border-none"),children:c})]})]})]})})}function iM(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];if(r.isSubForm){const o=[];let i=n+1;for(;i<e.length&&e[i].isFieldInSubForm&&e[i].parentFormName===r.fieldName;)o.push(e[i]),i++;t.push({kind:"subform",parent:r,children:o}),n=i}else t.push({kind:"field",field:r}),n++}return t}const sn="flex items-center px-1.5 py-2.5 text-[12px] leading-normal";function w7({field:e,isSubFormChild:t=!1}){return a.jsxs("div",{className:"flex items-center w-full",children:[a.jsxs("div",{className:j(sn,"w-20 shrink-0 min-h-[34px]"),children:[t&&a.jsx("span",{className:"inline-flex items-center justify-center shrink-0 w-5 h-5 opacity-0",children:a.jsx(_s,{})}),a.jsx("span",{children:e.fieldName})]}),a.jsx("div",{className:j(sn,"w-[72px] shrink-0 min-h-[34px]"),children:e.type}),a.jsx("div",{className:j(sn,"w-10 shrink-0 min-h-[34px]"),children:e.required?"是":"否"}),a.jsx("div",{className:j(sn,"flex-1 min-w-0 min-h-[34px]"),children:a.jsx("span",{className:"break-words min-w-0",children:e.description})})]})}function sM({parent:e,children:t}){const[n,r]=b.useState(!0),o=b.useCallback(()=>r(i=>!i),[]);return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center w-full",children:[a.jsxs("div",{className:j(sn,"w-20 shrink-0 min-h-[34px]"),children:[a.jsx("button",{type:"button",onClick:o,className:"inline-flex items-center justify-center shrink-0 w-5 h-5 rounded cursor-pointer text-[#666] relative -left-[2px]",children:a.jsx(_s,{isOpen:n})}),a.jsx("span",{children:e.fieldName})]}),a.jsx("div",{className:j(sn,"w-[72px] shrink-0 min-h-[34px] "),children:e.type}),a.jsx("div",{className:j(sn,"w-10 shrink-0 min-h-[34px]"),children:e.required?"是":"否"}),a.jsx("div",{className:j(sn,"flex-1 min-w-0 min-h-[34px]"),children:a.jsx("span",{className:"break-words min-w-0",children:e.description})})]}),n&&t.map((i,s)=>a.jsx(w7,{field:i,isSubFormChild:!0},s))]})}function aM({fields:e}){const t=b.useMemo(()=>iM(e),[e]);return a.jsxs("div",{className:"flex flex-col items-start w-full bg-white rounded-[10px] overflow-hidden text-black my-[10px] border border-[#E0E0E0]",children:[a.jsxs("div",{className:"flex items-center w-full shrink-0 bg-[#E5E6EB] rounded-t-[10px] border-b border-[#E0E0E0]",children:[a.jsx("div",{className:j(sn,"w-20 shrink-0 h-[34px] font-bold"),children:"名称"}),a.jsx("div",{className:j(sn,"w-[72px] shrink-0 h-[34px] font-bold"),children:"类型"}),a.jsx("div",{className:j(sn,"w-10 shrink-0 h-[34px] font-bold justify-center"),children:"必填"}),a.jsx("div",{className:j(sn,"flex-1 min-w-0 h-[34px] font-bold"),children:"说明"})]}),a.jsx("div",{className:"flex flex-col items-start w-full",children:t.map((n,r)=>n.kind==="field"?a.jsx(w7,{field:n.field},r):a.jsx(sM,{parent:n.parent,children:n.children},r))})]})}const lM=()=>a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex gap-[2px] flex-shrink-0 relative -left-[4px] top-[3px]",children:[a.jsx("div",{className:"w-[2px] h-[2px] rounded-full bg-[#0265FF] flex-shrink-0",style:{animation:"pulse 1.4s ease-in-out infinite",animationDelay:"0s",marginRight:"2px"}}),a.jsx("div",{className:"w-[2px] h-[2px] rounded-full bg-[#0265FF] flex-shrink-0",style:{animation:"pulse 1.4s ease-in-out infinite",animationDelay:"0.2s",marginRight:"2px"}}),a.jsx("div",{className:"w-[2px] h-[2px] rounded-full bg-[#0265FF] flex-shrink-0",style:{animation:"pulse 1.4s ease-in-out infinite",animationDelay:"0.4s"}})]}),a.jsx("style",{children:`
173
173
  @keyframes pulse {
174
174
  0%, 60%, 100% {
175
175
  opacity: 0.3;